RegRestoreKey is failing with permissons in win7. All other versions of windows I have no problems running this code. I wrote the code like 5y ago. lol.
From what I can find on the net, is that RegRestoreKey should request permission from UAC, and then continue. I never see the UAC popup, it just returns 1314 code.
Here is my code, can anyone help me here?
The Hive is current user.
Code:Public Function ImportRegKey(ByVal eKeyRoot As EnumKeyRoot, ByVal sKeyPath As String, ByVal sFileName As String) As Boolean Dim hKey As Long If EnablePrivilege(SE_RESTORE_NAME) Then If RegOpenKeyEx(eKeyRoot, sKeyPath, 0&, KEY_ALL_ACCESS, hKey) = ERROR_SUCCESS Then ImportRegKey = (RegRestoreKey(hKey, sFileName, REG_FORCE_RESTORE) = ERROR_SUCCESS) RegCloseKey hKey End If End If If Not ImportRegKey Then MsgBox RegRestoreKey(hKey, sFileName, REG_FORCE_RESTORE) ' prints 1314 End If End Function


Reply With Quote
