I save directory path to registry with this code:
HKEY hKey;
RegCreateKeyEx(HKEY_CURRENT_USER, L"Software\\BArtWell\\MyApp", 0, NULL, REG_OPTION_VOLATILE, KEY_WRITE, NULL, &hKey, NULL);
RegSetValueEx(hKey,L"Directory",0,REG_SZ,(LPBYTE)sz,(DWORD)wcslen(sz)*sizeof(wchar_t));
RegCloseKey(hKey);
And it is working fine before reboot. But after reboot path HKCU\Software\BArtWell\MyApp doesn’t exists. Tested on XP and Windows7 with same result. What I do wrong?
Read the documentation for
REG_OPTION_VOLATILE. Then replace it with 0.