Adding binaries to a registry?
-
Hi all, i am trying to add a set of binaries to registry but the size of the value i am trying to add is giving me 825243701 :doh: . any help is appriciated. Regards, KDevloper
Check Registry value limits[^] It's better not to store huge data inside registry. it will increase the registry size, of the registry and also affects the performance. As per the recommendation from MSFT, data above 2KB should be stored as file.
-Sarath. "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts
-
Check Registry value limits[^] It's better not to store huge data inside registry. it will increase the registry size, of the registry and also affects the performance. As per the recommendation from MSFT, data above 2KB should be stored as file.
-Sarath. "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts
Even i restricted the size the value does not appear at the registry.Below is the code: CString szRegData = "NEW"; CString strData = "abcd"; HKEY hMainKey; DWORD dwsize = strData.GetLength(); if(RegOpenKey(HKEY_LOCAL_MACHINE,"Software\\abc\\abc\\Current Version",&hMainKey)==ERROR_SUCCESS) { if(RegSetValueEx(hMainKey,szRegData,NULL,REG_BINARY,(LPBYTE)strData.GetBuffer(),dwsize)==ERROR_SUCCESS) { strData.ReleaseBuffer(); RegCloseKey(hMainKey); return TRUE; } RegCloseKey(hMainKey); } Thanks &Regards, kDevloper
-
Even i restricted the size the value does not appear at the registry.Below is the code: CString szRegData = "NEW"; CString strData = "abcd"; HKEY hMainKey; DWORD dwsize = strData.GetLength(); if(RegOpenKey(HKEY_LOCAL_MACHINE,"Software\\abc\\abc\\Current Version",&hMainKey)==ERROR_SUCCESS) { if(RegSetValueEx(hMainKey,szRegData,NULL,REG_BINARY,(LPBYTE)strData.GetBuffer(),dwsize)==ERROR_SUCCESS) { strData.ReleaseBuffer(); RegCloseKey(hMainKey); return TRUE; } RegCloseKey(hMainKey); } Thanks &Regards, kDevloper
Why are you trying to add a string as binary data? Are you doing a
UNICODE
build? Who (or, probably, what) is giving you '825243701'? Where are you at 8:30 pm of yesterday (to complete the enquiry... :rolleyes: )? :)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] -
Why are you trying to add a string as binary data? Are you doing a
UNICODE
build? Who (or, probably, what) is giving you '825243701'? Where are you at 8:30 pm of yesterday (to complete the enquiry... :rolleyes: )? :)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]Hi Palini, It's not a kind of UNICODE Build, i have a set of values as say "12324323242300000",which i need to add to registry as REG_BINARY. The earlier vaue was as a result of a different way of implementation. but lets forget the giant value. i hope the lines of code will be my final way to implement :-D . Hey wat's dat " WER r u at...." Regards, KDevloper
-
Hi all, i am trying to add a set of binaries to registry but the size of the value i am trying to add is giving me 825243701 :doh: . any help is appriciated. Regards, KDevloper
See Registry Wrapper Class (CRegistry). Free source code ...[^] for more help.
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )