Click here to Skip to main content
15,888,301 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWNDPROC Pin
Waldermort20-Oct-06 2:13
Waldermort20-Oct-06 2:13 
AnswerRe: WNDPROC Pin
tanvon malik23-Oct-06 20:12
tanvon malik23-Oct-06 20:12 
QuestionStrange Bug Pin
Demian Panello20-Oct-06 1:57
Demian Panello20-Oct-06 1:57 
QuestionCurrent user registry problem Pin
Raul Simcic20-Oct-06 1:50
Raul Simcic20-Oct-06 1:50 
AnswerRe: Current user registry problem Pin
Iain Clarke, Warrior Programmer20-Oct-06 2:40
Iain Clarke, Warrior Programmer20-Oct-06 2:40 
AnswerRe: Current user registry problem Pin
Mark Salsbery20-Oct-06 9:29
Mark Salsbery20-Oct-06 9:29 
AnswerRe: Current user registry problem Pin
Gary R. Wheeler20-Oct-06 11:36
Gary R. Wheeler20-Oct-06 11:36 
QuestionRegCreateKeyEx - Problems on Win Vista RC2 [modified] Pin
Nick_Chr20-Oct-06 1:14
Nick_Chr20-Oct-06 1:14 
Hi All,

I came across to a problem with the new Windows Vista - RC2, while using RegCreateKeyEx. I have a small function that sets a DWORD value to the Registry. It works fine on XP, but recently I used the Vista OS and I get an "Access Denied" Error (5).
Looking around the net I read about having to set the "access descriptor" within the SECURITY_ATTRIBUTES before passing to RegCreateKeyEx. But I haven't been able to find an example of doing that, or any other solution to my problem.

Forgot to mention: The error occurs when I try to set the ClearPageFileAtShutdown key to 1 within the HKEY_LOCAL_MACHINE, SYSTEM\CurrentControlSet\Session Manager\Memory Management.

#####################################################################
Here is the function that Im using:
LONG WriteRegDWORD( HKEY hKey, _TCHAR* sSubKey, _TCHAR* sKeyValueName, DWORD dwKeyValue )
{
   DWORD dwDisp = 0;
   SECURITY_ATTRIBUTES saSecAttr = {0};
   HKEY hKeyHandle = NULL;
   LONG Res = 0;

   Res = RegCreateKeyEx( hKey, sSubKey, 0, _T(""), 0, KEY_ALL_ACCESS, &saSecAttr,
                        &hKeyHandle, &dwDisp );
   if( Res == ERROR_SUCCESS )
   {
      Res = RegSetValueEx( hKeyHandle, sKeyValueName, 0, REG_DWORD, (LPBYTE)&dwKeyValue,
                         (DWORD)sizeof(DWORD) );
      if( Res != ERROR_SUCCESS )
      {
         _tprintf(_T("ERROR: %d \n"), Res );
      }
      RegCloseKey(hKeyHandle);
   }
   else
   {
      _tprintf( _T("ERROR: %d \n"), Res );
   }

   return Res;
}

#####################################################################

If anyone has a suggestion or solution to my problem I will highly appreciated.

Thank you,

Nick



-- modified at 7:38 Friday 20th October, 2006
AnswerRe: RegCreateKeyEx - Problems on Win Vista RC2 Pin
David Crow20-Oct-06 2:57
David Crow20-Oct-06 2:57 
GeneralRe: RegCreateKeyEx - Problems on Win Vista RC2 Pin
Nick_Chr20-Oct-06 3:24
Nick_Chr20-Oct-06 3:24 
GeneralRe: RegCreateKeyEx - Problems on Win Vista RC2 Pin
David Crow20-Oct-06 3:33
David Crow20-Oct-06 3:33 
AnswerRe: RegCreateKeyEx - Problems on Win Vista RC2 Pin
Michael Dunn20-Oct-06 8:26
sitebuilderMichael Dunn20-Oct-06 8:26 
AnswerSOLVED IT : RegCreateKeyEx - Problems on Win Vista RC2 Pin
Nick_Chr22-Oct-06 22:46
Nick_Chr22-Oct-06 22:46 
QuestionPROG TO ERASE...help Pin
zetkonrad20-Oct-06 1:09
zetkonrad20-Oct-06 1:09 
AnswerRe: PROG TO ERASE...help Pin
benjymous20-Oct-06 1:21
benjymous20-Oct-06 1:21 
GeneralRe: PROG TO ERASE...help Pin
PJ Arends20-Oct-06 6:06
professionalPJ Arends20-Oct-06 6:06 
GeneralRe: PROG TO ERASE...help Pin
Gary R. Wheeler20-Oct-06 11:45
Gary R. Wheeler20-Oct-06 11:45 
GeneralRe: PROG TO ERASE...help Pin
PJ Arends20-Oct-06 15:42
professionalPJ Arends20-Oct-06 15:42 
AnswerRe: PROG TO ERASE...help Pin
Hamid_RT20-Oct-06 2:34
Hamid_RT20-Oct-06 2:34 
QuestionRe: PROG TO ERASE...help Pin
David Crow20-Oct-06 2:59
David Crow20-Oct-06 2:59 
AnswerRe: PROG TO ERASE...help Pin
zetkonrad20-Oct-06 3:22
zetkonrad20-Oct-06 3:22 
Questiona question related to C Pin
Member 79930320-Oct-06 1:07
Member 79930320-Oct-06 1:07 
AnswerRe: a question related to C [modified] Pin
prasad_som20-Oct-06 1:13
prasad_som20-Oct-06 1:13 
AnswerRe: a question related to C Pin
benjymous20-Oct-06 1:14
benjymous20-Oct-06 1:14 
GeneralRe: a question related to C Pin
Member 79930321-Oct-06 0:06
Member 79930321-Oct-06 0:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.