wraithdu Posted January 28, 2012 Author Share Posted January 28, 2012 Apparently RegDeleteKeyEx is not available on 32-bit XP. I'm surprised this error hasn't been reported before. I'll have to look into the best way to fix it. For reference, the Ex functions are used to enable action on a specific 32 or 64 bit registry view on a 64-bit OS. Link to comment Share on other sites More sharing options...
wraithdu Posted January 28, 2012 Author Share Posted January 28, 2012 @step887 I've fixed the missing function error. Please test the new version and let me know how it goes. Thanks for reporting! Link to comment Share on other sites More sharing options...
step887 Posted January 29, 2012 Share Posted January 29, 2012 Thanks, the move and delete functions work great on xp now here is another issue(s) I have found with copy of multi reg sz.. -- I think I tracked it down to the _regread 1. Create a test mutli reg sz "hi" "whats" "up" on different lines, autoit regread : hi whats up regread func: 0x68006900200000007700680061007400730000007500700000000000 if I do _regwrite of this value is shows up as this value 2. did autoit regwrite and _regwrite of the above autoit regread -- and _regwrite comes out slightly different in regedit, it come out "hi whatsup" on one line regexport: (your regexport work great ) Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\test] "testmsz"=hex(7):68,00,69,00,20,00,00,00,77,00,68,00,61,00,74,00,73,00,00,00,\ 75,00,70,00,00,00,00,00 "autoit"=hex(7):68,00,69,00,20,00,00,00,77,00,68,00,61,00,74,00,73,00,00,00,75,\ 00,70,00,00,00,00,00 "regfunc"=hex(7):68,00,69,00,20,00,0a,00,77,00,68,00,61,00,74,00,73,00,0a,00,\ 75,00,70,00,00,00,00,00 in case you care here is the export of the copyvalue of the above testmsz Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\software\test] "copy"=hex(7):30,00,78,00,36,00,38,00,30,00,30,00,36,00,39,00,30,00,30,00,32,\ 00,30,00,30,00,30,00,30,00,30,00,30,00,30,00,37,00,37,00,30,00,30,00,36,00,\ 38,00,30,00,30,00,36,00,31,00,30,00,30,00,37,00,34,00,30,00,30,00,37,00,33,\ 00,30,00,30,00,30,00,30,00,30,00,30,00,37,00,35,00,30,00,30,00,37,00,30,00,\ 30,00,30,00,30,00,30,00,30,00,30,00,30,00,30,00,30,00,30,00,00,00,00,00 Link to comment Share on other sites More sharing options...
wraithdu Posted January 29, 2012 Author Share Posted January 29, 2012 Bah, I hate MULTI_SZ. One problem is that _RegRead returns UTF16LE binary data and like an idiot in the CopyValue function I call _RegWrite directly, which expects string data. I'll fix this (and in other places). Regarding your other test, don't mix native functions with UDF functions in this case. The returned and expected data types/formats are not necessarily compatible. Link to comment Share on other sites More sharing options...
wraithdu Posted January 29, 2012 Author Share Posted January 29, 2012 Alright, I think I've fixed it. The Copy/Move functions will work properly now. I've also allowed _RegWrite to accept REG_MULTI_SZ input as either CRLF or LF delimited substrings as string data (as returned from AutoIt native RegRead), or as UDF internal type NULL delimited substrings as UTF16LE binary data. Example data: ; string data $d = "Hi" & @CRLF & "whats" & @CRLF & "up" ; binary data $d = StringToBinary("Hi" & ChrW(0) & "whats" & ChrW(0) & "up", 2) ; note flag 2 for UTF16LE Link to comment Share on other sites More sharing options...
AZJIO Posted January 29, 2012 Share Posted January 29, 2012 (edited) wraithdu#include <_RegFunc.au3> _RegExport(@ScriptDir&'_RegFunc - out.reg', 'HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerAutoplayHandlersHandlersImgBurnBDBurningOnArrival_BuildImage')result:Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerAutoplayHandlersHandlersImgBurnBDBurningOnArrival_BuildImage] "DefaultIcon"=""C:Program FilesImgBurnImgBurn.exe",0"should be soWindows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerAutoplayHandlersHandlersImgBurnBDBurningOnArrival_BuildImage] "DefaultIcon"=""C:Program FilesImgBurnImgBurn.exe",0""DefaultIcon"=""C:Program FilesImgBurnImgBurn.exe",0"________________________________#include <_RegFunc.au3> _RegExport(@ScriptDir&'_RegFunc - out.reg', 'HKEY_LOCAL_MACHINESYSTEMControlSet001ControlArbitersReservedResources')# 10 [HKEY_LOCAL_MACHINESYSTEMControlSet001ControlArbitersReservedResources]nothing________________________________#include <_RegFunc.au3> _RegExport(@ScriptDir&'_RegFunc - out.reg', 'HKEY_LOCAL_MACHINEHARDWARERESOURCEMAPHardware Abstraction LayerACPI 1.0 - APIC platform MP')# 8 [HKEY_LOCAL_MACHINEHARDWARERESOURCEMAPHardware Abstraction LayerACPI 1.0 - APIC platform MP]nothing Edited January 29, 2012 by AZJIO My other projects or all Link to comment Share on other sites More sharing options...
wraithdu Posted January 29, 2012 Author Share Posted January 29, 2012 @AZJIO You like to try and break stuff huh? Try your tests again with the new version and see if it is fixed for you. You may need to take care of admin privileges on your own to make sure you have access to read the required keys. Link to comment Share on other sites More sharing options...
AZJIO Posted January 30, 2012 Share Posted January 30, 2012 wraithduI have full access. WinXPI just compared the results with the function Just I already had problems with some registry keys.I was not able to export the HKEY_LOCAL_MACHINEHARDWARERESOURCEMAPPnP ManagerPnpManager, while regedit is exported correctly.You like to try and break stuff huh?No. This is a very responsible function, I only warned of the shortcomings. I once compared the results of the export of its function with the results regedit and therefore knew about the registry keys that cause problems. My other projects or all Link to comment Share on other sites More sharing options...
wraithdu Posted January 30, 2012 Author Share Posted January 30, 2012 Don't take my breaking stuff comment seriously, I was just being sarcastic. I appreciate the bug reports.That said, are you still having problems with the updated version? I just tried the key you mentionedHKEY_LOCAL_MACHINEHARDWARERESOURCEMAPPnP ManagerPnpManagerand it exported identically to regedit. Now I'm on Win7 x64, so there could be a platform issue. Let me know. Link to comment Share on other sites More sharing options...
AZJIO Posted January 30, 2012 Share Posted January 30, 2012 wraithdu Yes, all is accurate My other projects or all Link to comment Share on other sites More sharing options...
step887 Posted January 30, 2012 Share Posted January 30, 2012 Thanks for all your hard work on this, it is a great UDF.. I tested on xp sp 3 32 bit and win 7 sp 1 64 bit and all the move/ copy/write functions work great.. a couple more issues -- tell me if you want me to stop finding stuff minor issue: msgbox(0,"", _regread("HKLM\software\test", "REG_MULTI_SZ") ) returns the binary data The following may not be an issue, it could be working as design on 64 bit (32 bit binary) _regexport ($testfile, "HKLM\software\test") correctly reads "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\test" however outputs Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\software\test] If I import with 32 bit script, will import to Wow6432Node, however if I double click on the reg file it will import to "HKEY_LOCAL_MACHINE\SOFTWARE\test" This time I have a possible, it seems to work on my limited testing, I am sure you will have a more elegant solution: in _regexport -- after: If Not _RegKeyExists($s_key) Then Return SetError(1, 0, 0) If @OSArch = "x64" And Not @AutoItX64 Then Select Case StringInStr($s_key, "HKLM32\SOFTWARE") $s_key = StringReplace($s_key, "HKLM32\SOFTWARE", "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node") Case StringInStr($s_key, "HKLM\SOFTWARE") $s_key = StringReplace($s_key, "HKLM\SOFTWARE", "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node") Case StringInStr($s_key, "HKEY_LOCAL_MACHINE\SOFTWARE") $s_key = StringReplace($s_key, "HKEY_LOCAL_MACHINE\SOFTWARE", "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node") Endselect EndIf Link to comment Share on other sites More sharing options...
AZJIO Posted January 30, 2012 Share Posted January 30, 2012 (edited) wraithdu What if to make function of export with return to a variable, instead of to a file? To add parameter which has two values "First" and "Next". The first variant returns with a line with a line "Windows Registry Editor Version 5.00". The second variant without this line to attach to the first variant. There will be a flexibility, possibility to process the data before save to a file. And allows you to export some selected keys in the same file Otherwise in a current kind it is enough to make "reg export" for example _RegExportToFile(@MyDocumentsDir&'_RegExport - Explorer.reg', 'HKEY_CLASSES_ROOT.avi') $data=_RegExportToData('HKEY_CLASSES_ROOT.7z', 0) ; Start $data&=_RegExportToData('HKEY_CLASSES_ROOT.wim', 1) ; Next $file = FileOpen(@ScriptDir&'file.reg',2) FileWrite($file, $data) FileClose($file) Func _RegExportToFile($Path, $Key) $data=_RegExportToData($Key, 0) ; Start $file = FileOpen($Path, 2) FileWrite($file, $data) FileClose($file) EndFunc Edited January 30, 2012 by AZJIO My other projects or all Link to comment Share on other sites More sharing options...
wraithdu Posted January 30, 2012 Author Share Posted January 30, 2012 (edited) minor issue:msgbox(0,"", _regread("HKLMsoftwaretest", "REG_MULTI_SZ") ) returns the binary dataThis is actually by design and defined in the header. I'm on the fence about changing it to match AutoIt's behavior, even though _regwrite will accept AutoIt fomatted MULTI_SZ data. I'm assuming from your report that you would expect the return to match AutoIt's format?The following may not be an issue, it could be working as designon 64 bit (32 bit binary)_regexport ($testfile, "HKLMsoftwaretest")correctly reads "HKEY_LOCAL_MACHINESOFTWAREWow6432Nodetest"however outputs......This is not by design however. You're right that the exported file should match platform and bitness. I'll look into it. Edited January 30, 2012 by wraithdu Link to comment Share on other sites More sharing options...
wraithdu Posted January 30, 2012 Author Share Posted January 30, 2012 (edited) So I've updated it to change the return of MULTI_SZ data to be comparable to AutoIt's RegRead (except I've used CRLF instead of LF - no idea why AutoIt returns LF).But I haven't changed the Wow6432Node stuff, and here's why... Look at this document:http://msdn.microsoft.com/en-us/library/aa384253(v=vs.85).aspxThere are keys within redirected keys which ARE NOT redirected. And the list is huge. And behavior is different by platform as well! I don't feel like hardcoding all that shit. It would be easier I think to require a user to be more aware of the environment and use keys like 'HKLMSoftwareWow6432Node' instead of 'HKLM32Software'.What do you think? Edited January 30, 2012 by wraithdu Link to comment Share on other sites More sharing options...
step887 Posted January 30, 2012 Share Posted January 30, 2012 Yea, that would be too much too code.. If someone is using this, I would hope they know what they are trying to accomplish I do not know about dll calls, it is on my list of stuff to get more familiar with ... Could you do a dll call to find what actual key is being accessed after the redirect .. if there was such a call, you could set s_key with the output.. Link to comment Share on other sites More sharing options...
AZJIO Posted January 30, 2012 Share Posted January 30, 2012 wraithdu I updated the example above, without loss of functional My other projects or all Link to comment Share on other sites More sharing options...
wraithdu Posted January 30, 2012 Author Share Posted January 30, 2012 Your suggestion only requires minor changes I think (omitting or including the file header), so it's something I can look at for sure. But what do you think about the redirection stuff? Link to comment Share on other sites More sharing options...
highend Posted January 31, 2012 Share Posted January 31, 2012 Your suggestion only requires minor changes I think (omitting or including the file header), so it's something I can look at for sure.Another vote for this. Being able to export several different registry keys into one file would be awesome...Regarding the import of registry entries from a. reg file: I suppose we have to use the windows command "reg" invoked via ShellExecuteWait? Link to comment Share on other sites More sharing options...
wraithdu Posted January 31, 2012 Author Share Posted January 31, 2012 You would import the same way as any registry file, yes. I've not written an import function yet, although that would be an interesting solution to the Wow6432Node discussion above. Link to comment Share on other sites More sharing options...
highend Posted January 31, 2012 Share Posted January 31, 2012 although that would be an interesting solution to the Wow6432Node discussion above.Hehe _RegExportToFile is our first priority though Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now