Jump to content

_WinAPI_RegQueryReflectionKey example


jpm
 Share

Recommended Posts

I try to have a working example for _WinAPI_RegQueryReflectionKey()

The following does not works, any idea? 

Thanks

;~ #AutoIt3Wrapper_UseX64 = Y
;~ #RequireAdmin

#include <APIRegConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIError.au3>
#include <WinAPIReg.au3>

Global $g_sConsolewriteOut = ""

Local $hKey = _WinAPI_RegOpenKey($HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes', $KEY_QUERY_VALUE)
;~ Local $hKey = _WinAPI_RegOpenKey($HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes', $KEY_ALL_ACCESS) ; ERROR strange as it include $KEY_QUERY_VALUE
If @error Then
    MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), "RegOpenKey @error = " & @error, _WinAPI_GetErrorMessage(@extended))
    Exit
EndIf

_ConsoleWrite("@AutoItX64 = " & @AutoItX64 & " isAdmin=" & IsAdmin() & @CRLF & @CRLF)
Local $iReflectionEnabled = _WinAPI_RegEnableReflectionKey($hKey)
_ConsoleWrite("- Key Reflection Enabled = " & $iReflectionEnabled & " ???" & @CRLF)

Local $iReflectionQuery = _WinAPI_RegQueryReflectionKey($hKey)
_ConsoleWrite("! Key Reflection Query = " & $iReflectionQuery & " MUST BE = 0" & @CRLF)

Local $iReflectionDisabled = _WinAPI_RegDisableReflectionKey($hKey)
_ConsoleWrite("- Key Reflection Disabled = " & $iReflectionDisabled & @CRLF)

$iReflectionQuery = _WinAPI_RegQueryReflectionKey($hKey)
_ConsoleWrite("- Key Reflection Query after disabling = " & $iReflectionQuery & @CRLF)

_WinAPI_RegCloseKey($hKey)

MsgBox(($MB_ICONINFORMATION + $MB_SYSTEMMODAL), "ConsoleWrite Report", $g_sConsolewriteOut)

Func _ConsoleWrite($text, $iCurError = @error, $iCurExtended = @extended)
    ConsoleWrite($text)

    $g_sConsolewriteOut &= $text
    Return SetError($iCurError, $iCurExtended, 1)
EndFunc   ;==>_ConsoleWrite

 

Link to comment
Share on other sites

  • 2 weeks later...

I think Microsoft removed the functionality of those function many moons ago but maybe I'm missing something

https://msdn.microsoft.com/en-us/library/windows/desktop/dd464643(v=vs.85).aspx

 

Registry Reflection

 

[The information in this topic applies to Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, WOW64 no longer uses registry reflection and formerly reflected keys are shared instead. For more information, see Registry Keys Affected by WOW64.]

https://msdn.microsoft.com/en-us/library/aa384253(VS.85).aspx

 

If the key is not on the reflection list, this function succeeds but has no effect. For more information, see Registry Redirector and Registry Reflection.

https://msdn.microsoft.com/en-us/library/ms724859(v=vs.85).aspx

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...