(Nt)Zw Registry calls
-
Hi, I created a class that uses the NtNative APIs found in the ntdll.dll. Everything works except the "Hive File" functions. Below is the "LoadKey" function:
BOOL CKey::LoadKey(CString csHiveFilePathName, ULONG ulFlags /* 0x0000 */) { ASSERT(csHiveFilePathName != _T("")); ASSERT((m_csRootPath == _T("\\Registry\\User") || m_csRootPath == _T("\\Registry\\Machine"))); BOOL bSuccess = TRUE; HANDLE hRootKey = NULL, hHiveFile = NULL; NT::UNICODE_STRING usRootKeyName, usHiveFileName, usHiveFile; NT::OBJECT_ATTRIBUTES DestinationKeyName, RegHiveFileName, RegHiveFile; int n=0; // Make sure the filenames is setup correctly if (csHiveFilePathName.Left(4) != _T("\\??\\")) csHiveFilePathName.Insert(0,_T("\\??\\")); // Enable the restore privilege m_NtStatus = EnablePrivilege(SE_RESTORE_NAME, TRUE); if(!NT_SUCCESS(m_NtStatus)) { bSuccess = FALSE; goto end_it; } WCHAR wszHiveFile[1024]; for (n=0; n