RegOpenKeyEx() api issue.
-
I have to open a registry key whose length is more than 255 charecter length. I have called RegOpenKeyEx() function to open the key. But it failed. i came to know that i can call this function recussively to open such keys of long path.But the 1st call only succeed. code piece: DWORD status = RegOpenKeyEx( HKEY_CURRENT_USER , L"SOFTWARE\xyz\Connections\\properties\", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &hKey ); in next call DWORD status = RegOpenKeyEx( hKey , L"Fallback\server\item", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, subkeyhKey ); the 2nd call failed. giving error no 6. the actuall key is SOFTWARE\xyz\Connections\<GUID>\properties\Fallback\server\item can you help me out to fix this.... thanks in advance....
Birajendu SonicWALL Bangalore India
-
I have to open a registry key whose length is more than 255 charecter length. I have called RegOpenKeyEx() function to open the key. But it failed. i came to know that i can call this function recussively to open such keys of long path.But the 1st call only succeed. code piece: DWORD status = RegOpenKeyEx( HKEY_CURRENT_USER , L"SOFTWARE\xyz\Connections\\properties\", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &hKey ); in next call DWORD status = RegOpenKeyEx( hKey , L"Fallback\server\item", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, subkeyhKey ); the 2nd call failed. giving error no 6. the actuall key is SOFTWARE\xyz\Connections\<GUID>\properties\Fallback\server\item can you help me out to fix this.... thanks in advance....
Birajendu SonicWALL Bangalore India
birajendu wrote:
i came to know that i can call this function recussively
Do you mean iteratively? :-D
birajendu wrote:
DWORD status = RegOpenKeyEx( hKey , L"Fallback\server\item", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, subkeyhKey );
shouldn't be
DWORD status = RegOpenKeyEx(
hKey ,
L"Fallback\server\item",
0,
KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS,
&subkeyhKey
);
?If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
birajendu wrote:
i came to know that i can call this function recussively
Do you mean iteratively? :-D
birajendu wrote:
DWORD status = RegOpenKeyEx( hKey , L"Fallback\server\item", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, subkeyhKey );
shouldn't be
DWORD status = RegOpenKeyEx(
hKey ,
L"Fallback\server\item",
0,
KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS,
&subkeyhKey
);
?If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]CPallini wrote:
DWORD status = RegOpenKeyEx(hKey ,L"Fallback\server\item",0,KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS,&subkeyhKey);
Sorry it was a typo... I am using like this only. status = RegOpenKeyEx(hKey , L"Fallback\server\item", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &subkeyhKey); Still the same error...
Birajendu SonicWALL Bangalore India
-
I have to open a registry key whose length is more than 255 charecter length. I have called RegOpenKeyEx() function to open the key. But it failed. i came to know that i can call this function recussively to open such keys of long path.But the 1st call only succeed. code piece: DWORD status = RegOpenKeyEx( HKEY_CURRENT_USER , L"SOFTWARE\xyz\Connections\\properties\", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &hKey ); in next call DWORD status = RegOpenKeyEx( hKey , L"Fallback\server\item", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, subkeyhKey ); the 2nd call failed. giving error no 6. the actuall key is SOFTWARE\xyz\Connections\<GUID>\properties\Fallback\server\item can you help me out to fix this.... thanks in advance....
Birajendu SonicWALL Bangalore India
-
CPallini wrote:
DWORD status = RegOpenKeyEx(hKey ,L"Fallback\server\item",0,KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS,&subkeyhKey);
Sorry it was a typo... I am using like this only. status = RegOpenKeyEx(hKey , L"Fallback\server\item", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &subkeyhKey); Still the same error...
Birajendu SonicWALL Bangalore India
Since error code
6
is 'invalid handle
', what is the value of thestatus
variable immediately after the first previous call? :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Since error code
6
is 'invalid handle
', what is the value of thestatus
variable immediately after the first previous call? :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Value of Status variable is only 6, error i got from Getlasterror() is 0.
Birajendu SonicWALL Bangalore India
Immediately after the first
RegOpenKeyEx
call is6
? :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Immediately after the first
RegOpenKeyEx
call is6
? :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
I have to open a registry key whose length is more than 255 charecter length. I have called RegOpenKeyEx() function to open the key. But it failed. i came to know that i can call this function recussively to open such keys of long path.But the 1st call only succeed. code piece: DWORD status = RegOpenKeyEx( HKEY_CURRENT_USER , L"SOFTWARE\xyz\Connections\\properties\", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &hKey ); in next call DWORD status = RegOpenKeyEx( hKey , L"Fallback\server\item", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, subkeyhKey ); the 2nd call failed. giving error no 6. the actuall key is SOFTWARE\xyz\Connections\<GUID>\properties\Fallback\server\item can you help me out to fix this.... thanks in advance....
Birajendu SonicWALL Bangalore India
It appears no one has mentioned it yet, but you need to use double backslashes. Instead of
L"SOFTWARE\xyz\Connections\\properties\"
you should use
L"SOFTWARE\\xyz\\Connections\\properties\\"
Hope that helps.
Karl - WK5M PP-ASEL-IA (N43CS) PGP Key: 0xDB02E193 PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193