RegCreateKeyEx failed in Vista
-
Hi all I am facing a strange issue. I call RegCreateKeyEx to create a key in the Vista registry , but it fails . Could any one please help me find out what I am missing ...? HKEY hk=NULL; char tmp_Path[256] = "Software\\Company\\PreferredNos\\no_device"; dwResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, tmp_Path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, NULL) ; if(hk!=NULL) RegCloseKey(hk); if ( dwResult != ERROR_SUCCESS ) { SpiDebug ((DBG_INFO , _T("TSP"), _T(" RegCreateKeyExFAILED"))) }
redindian
-
Hi all I am facing a strange issue. I call RegCreateKeyEx to create a key in the Vista registry , but it fails . Could any one please help me find out what I am missing ...? HKEY hk=NULL; char tmp_Path[256] = "Software\\Company\\PreferredNos\\no_device"; dwResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, tmp_Path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, NULL) ; if(hk!=NULL) RegCloseKey(hk); if ( dwResult != ERROR_SUCCESS ) { SpiDebug ((DBG_INFO , _T("TSP"), _T(" RegCreateKeyExFAILED"))) }
redindian
Did you check the return value?
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
Hi all I am facing a strange issue. I call RegCreateKeyEx to create a key in the Vista registry , but it fails . Could any one please help me find out what I am missing ...? HKEY hk=NULL; char tmp_Path[256] = "Software\\Company\\PreferredNos\\no_device"; dwResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, tmp_Path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, NULL) ; if(hk!=NULL) RegCloseKey(hk); if ( dwResult != ERROR_SUCCESS ) { SpiDebug ((DBG_INFO , _T("TSP"), _T(" RegCreateKeyExFAILED"))) }
redindian
Do you have the correct access rights ?
Cédric Moonen Software developer
Charting control [v1.3] -
Hi all I am facing a strange issue. I call RegCreateKeyEx to create a key in the Vista registry , but it fails . Could any one please help me find out what I am missing ...? HKEY hk=NULL; char tmp_Path[256] = "Software\\Company\\PreferredNos\\no_device"; dwResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, tmp_Path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, NULL) ; if(hk!=NULL) RegCloseKey(hk); if ( dwResult != ERROR_SUCCESS ) { SpiDebug ((DBG_INFO , _T("TSP"), _T(" RegCreateKeyExFAILED"))) }
redindian
dharani wrote:
I call RegCreateKeyEx to create a key in the Vista registry , but it fails .
Straight from the docs: If the function fails, the return value is a nonzero error code defined in Winerror.h. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Hi all I am facing a strange issue. I call RegCreateKeyEx to create a key in the Vista registry , but it fails . Could any one please help me find out what I am missing ...? HKEY hk=NULL; char tmp_Path[256] = "Software\\Company\\PreferredNos\\no_device"; dwResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, tmp_Path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, NULL) ; if(hk!=NULL) RegCloseKey(hk); if ( dwResult != ERROR_SUCCESS ) { SpiDebug ((DBG_INFO , _T("TSP"), _T(" RegCreateKeyExFAILED"))) }
redindian
dharani wrote:
KEY_ALL_ACCESS
Never do that - only request the access levels that you really need. Peace!
-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles -
Hi all I am facing a strange issue. I call RegCreateKeyEx to create a key in the Vista registry , but it fails . Could any one please help me find out what I am missing ...? HKEY hk=NULL; char tmp_Path[256] = "Software\\Company\\PreferredNos\\no_device"; dwResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, tmp_Path, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hk, NULL) ; if(hk!=NULL) RegCloseKey(hk); if ( dwResult != ERROR_SUCCESS ) { SpiDebug ((DBG_INFO , _T("TSP"), _T(" RegCreateKeyExFAILED"))) }
redindian
What was return value of dwResult ?