Jump to content

RegWrite on 32-bit and 64-bit Windows


DCCD
 Share

Recommended Posts

Hi, is this the right way to use RegWrite func on 32-bit and 64-bit Windows

$HKEY_CURRENT_USER = 'HKEY_CURRENT_USER64'
If @OSArch = 'X86' Then $HKEY_CURRENT_USER = 'HKEY_CURRENT_USER'
RegWrite($HKEY_CURRENT_USER & '\Software\Microsoft\Windows\CurrentVersion\Run', 'Obd2Diag', 'REG_SZ', 'app')

Thanks in advance

Link to comment
Share on other sites

The Run subkey in HKEY_CURRENT_USER seems to be a shared key. So you can just use HKEY_CURRENT_USER for both architectures.

See this MSDN article about Registry Keys and WOW64 : https://msdn.microsoft.com/en-us/library/windows/desktop/aa384253%28v=vs.85%29.aspx

Edited by jguinch
Link to comment
Share on other sites

Thanks a lot, i really appreciate your help, ... i just ask because Autoit Help file says 

 

For registry interaction, use HKCR64 or HKLM64 to bypass the redirection mechanism see Registry Functions documentation.

 

 

When running on 64-bit Windows if you want to write a key or value specific to the 64-bit environment you have to suffix the HK... with 64 i.e. HKLM64.

 

As you said no need to change anything here  :thumbsup:

HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun

 

.

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

×
×
  • Create New...