Topic: Confused on translating old registry commands  (Read 6801 times)

0 Members and 1 Guest are viewing this topic.

Confused on translating old registry commands
« on: January 16, 2013, 07:53:58 AM »

JonF

  • Code Baker
  • Chef
  • ***
  • Date Registered: Jan 2011
  • Posts: 286
I'm confused.

It appears to me that hive_load,HKU is replaced by RegHiveLoad,Tmp_software,%RegSoftware% and writes to HKLM\Software. But in Win8PE_SE config.script, for example, I see:

Code: [Select]
RegHiveLoad,Tmp_Default,%RegDefault%
RegWrite,HKLM,0x4,Tmp_Default\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced,Hidden,1

Does that value wind up in HKLM\Software or HKCU\Software? Is the HKLM superfluous?

Re: Confused on translating old registry commands
« Reply #1 on: January 16, 2013, 12:24:47 PM »

ChrisR

  • Win7PE SE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 2785
Hi Jon,

If you ask this question, you Jon, it means that it is not completely clear for all  :wink:

About this "Hidden" key, in Real Win8, I have the keys in HKCU, 
Code: [Select]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"Hidden"=dword:00000001
"HideFileExt"=dword:00000000
"ShowSuperHidden"=dword:00000001

which is indeed converted into
Code: [Select]
RegHiveLoad,Tmp_Default,%RegDefault%
RegWrite,HKLM,0x4,Tmp_Default\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced,Hidden,1
RegWrite,HKLM,0x4,Tmp_Default\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced,HideFileExt,0
RegWrite,HKLM,0x4,Tmp_Default\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced,ShowSuperHidden,1
RegHiveUnLoad,Tmp_Default

Once mounted, Tmp_Default and all keys under are in the branch HKEY_LOCAL_MACHINE, HKLM => RegWrite,HKLM,0x
ila_rendered


Otherwise, an reply from Galapo
Code: [Select]
all of the errors relate to 'Hive_Load', 'Hive_Unload', and 'reg_add'. In more recent times it has been realised that it is better to use the functions 'RegHiveLoad', 'RegHiveUnLoad', and 'RegWrite'.
Thus there is some incompatibility with this initial release of Macro Library with older plugins.

I share this view, in these old plugins Reg_Add function called a macro (another script) to be converted into native RegWrite,HKLM,0x
It seems better to economise this macro execution here and to write directly the native function RegWrite,HKLM, faster, as clear in my opinion.
It is the same thing for 'Hive_Load', 'Hive_Unload'.


HKLM, HKCU, it is true that it can be confusing with Tmp_Default, Tmp_Software...
So for those who still have scripts with the old syntax, here is a conversion table.
Code: [Select]
Hive_Load,HKU (or Machine) => RegHiveLoad,Tmp_Software,%RegSoftware%
reg_add,0x1,%reg% => RegWrite,HKLM,0x1,Tmp_Software 
Hive_Unload,HKU => RegHiveUnLoad,Tmp_Software,%RegSoftware%
 
Hive_Load,HKCU => RegHiveLoad,Tmp_Default,%RegDefault%
reg_add,0x1,"%reg% => RegWrite,HKLM,0x1,Tmp_Default
Hive_Unload,HKCU => RegHiveUnLoad,Tmp_Default,%RegDefault%

Hive_Load,HKLM (or System) => RegHiveLoad,Tmp_System,%RegSystem%
reg_add,0x1,%reg% => RegWrite,HKLM,0x1,Tmp_System
Hive_Unload,HKLM => RegHiveUnLoad,Tmp_System,%RegSystem%

RegHiveLoad,Tmp_Components,%RegComponents%
RegHiveUnLoad,Tmp_Components

I hope that it is clear
:cheers:
« Last Edit: January 16, 2013, 12:30:58 PM by ChrisR »

Re: Confused on translating old registry commands
« Reply #2 on: January 17, 2013, 08:46:22 AM »

JonF

  • Code Baker
  • Chef
  • ***
  • Date Registered: Jan 2011
  • Posts: 286
Thanks, I'll take a look at it.

Re: Confused on translating old registry commands
« Reply #3 on: January 17, 2013, 11:01:26 AM »

Lancelot

  • Moderator, Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 6732
Hi JonF,

I am sure you already know RegCPE,
If required on some cases,  reminding "Reg ReConvert"
available
Gena\Utils\"Reg ReConvert"
Win7PESE\Utils\"Reg ReConvert"

 :cheers:

Re: Win7PE SE & Release
« Reply #4 on: January 21, 2013, 06:22:54 AM »

turbobaby

  • Apprentice
  • *
  • Date Registered: Oct 2012
  • Posts: 9
hello,
@ first: sorry for my english, i'm from germany

my question: why don't working the command RegWriteBinEx and RegWrite since last update? Is there another in exchange?

Thanks

turbobaby

Re: Re: Win7PE SE & Release
« Reply #5 on: January 21, 2013, 06:28:23 AM »

Lancelot

  • Moderator, Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 6732
Hi turbobaby,

As being The Man behind the idea of "RegWriteBinEx" command on wb,
 which was added to wb with ignorance of its bugs (at this point I am not behind ;) ),
   as a result, this command (and a set of others) never used on any Projects at TheOven  :great:

Re: Re: Win7PE SE & Release
« Reply #6 on: January 21, 2013, 06:40:08 AM »

ChrisR

  • Win7PE SE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 2785
Welcome turbobaby,

There is no problem with RegWrite, normally

RegHiveLoad,Tmp_Default,%RegDefault%     (or with Tmp_Software,%RegSoftware%,   Tmp_System,%RegSystem%)
RegWrite,HKLM,0x1,Tmp_Default\
RegHiveUnLoad,Tmp_Default

:cheers:

Re: Re: Win7PE SE & Release
« Reply #7 on: January 22, 2013, 07:42:31 AM »

turbobaby

  • Apprentice
  • *
  • Date Registered: Oct 2012
  • Posts: 9
can i use this code?

Hive_Load,Default
RegWrite,HKLM,0x2,%reg%\Software\Microsoft\Windows\CurrentVersion\RunOnce,WLan,"WLanStarts.au3"
Hive_Unload,Default

Re: Re: Win7PE SE & Release
« Reply #8 on: January 22, 2013, 09:18:15 AM »

ChrisR

  • Win7PE SE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 2785
It is better to open a new topic for your questions, It is locked now.

can i use this code?
No, you can use this
Code: [Select]
RegHiveLoad,Tmp_Default,%RegDefault%
RegWrite,HKLM,0x2,Tmp_Default\Software\Microsoft\Windows\CurrentVersion\RunOnce,WLAN,WLanStarts.au3
RegHiveUnLoad,Tmp_Default
« Last Edit: January 22, 2013, 09:23:20 AM by ChrisR »

Re: Confused on translating old registry commands
« Reply #9 on: January 24, 2013, 08:27:49 AM »

JonF

  • Code Baker
  • Chef
  • ***
  • Date Registered: Jan 2011
  • Posts: 286
FWIW, here are a couple of regex's for translating old stuff. From Notepad++ but should work in lots of editors.

Find:
  (?:i)reg_add,(\dx\d,)("?)%reg%(.+)

Replace:
  RegWrite,HKLM,\1\2Tmp_Software\3 or

  RegWrite,HKLM,\1\2Tmp_Default\3 or

  RegWrite,HKLM,\1\2Tmp_System\3

Obviously, if you don't care what label you use for the currently loaded hive, you can use just one replace regex and do it all in one swell foop.

Re: Confused on translating old registry commands
« Reply #10 on: January 24, 2013, 11:35:37 AM »

Lancelot

  • Moderator, Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 6732
Hi JonF,

without labels, using name Tmp would be better, but not nice to figure out things on plugin at very first look

you can also make such replacement with labels,
just check "Reg ReConvert" , its interface gives you the path for your Find/Replace routine,
what it does for .reg files is same what you want to do, only with minor touchs you can also  :thumbsup:

this will give you advantage of using standart label names,
 which leads the advantage of loading/unloadings hives only once at begining/end on complicated plugins, gaining speed.  :cool:


Edit:
Here are some examples for conversions that would be useful:
(+ please check Chris Reply 1 above first  :wink: )

*
Code: [Select]
Hive_Load,Default
reg_add,0x1,"%reg%\Control Panel\Desktop\WindowMetrics",CaptionHeight,-315
Hive_Unload,Default
---->
Code: [Select]
RegHiveLoad,Tmp_Default,%RegDefault%
RegWrite,HKLM,0x1,"Tmp_Default\Control Panel\Desktop\WindowMetrics",CaptionHeight,-315
RegHiveUnLoad,Tmp_Default

*
Code: [Select]
hive_load,HKCU
reg_add,0x4,%reg%\Console,ColorTable00,0
hive_unload
---->
Code: [Select]
RegHiveLoad,Tmp_Default,%RegDefault%
RegWrite,HKLM,0x4,Tmp_Default\Console,ColorTable00,0
RegHiveUnLoad,Tmp_Default

*
Code: [Select]
Hive_Load,HKU
reg_add,0x2,%reg%\Classes\Folder\shell\treesize,,"TreeSize Free"
Hive_Unload,HKU
---->
Code: [Select]
RegHiveLoad,Tmp_Software,%RegSoftware%
RegWrite,HKLM,0x2,Tmp_Software\Classes\Folder\shell\treesize,,"TreeSize Free"
RegHiveUnLoad,Tmp_Software

*
Code: [Select]
Hive_Load,HKLM
reg_add,0x1,%reg%\ControlSet001\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318},Class,MEDIA
Hive_Unload,HKLM
---->
Code: [Select]
RegHiveLoad,Tmp_System,%RegSystem%
RegWrite,HKLM,0x1,Tmp_System\ControlSet001\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318},Class,MEDIA
RegHiveUnLoad,Tmp_System


+++
depricated method was not only causing slow process,
 but also causing confusions using different names,
  ( as in example using different name for same task Hive_Load,Default hive_load,HKCU )

now we have simple names that cause no confusion and fastest possible within builder limits.

Shortly:
We have mostly 3 hives to load with names %RegDefault% %RegSoftware% %RegSystem%
We have standart names for them Tmp_Default Tmp_Software Tmp_System

Even now, one can load all 3 at once and unload all 3 in the end, writing whatever one wants to registry


Code: [Select]
RegHiveLoad,Tmp_Default,%RegDefault%
RegHiveLoad,Tmp_Software,%RegSoftware%
RegHiveLoad,Tmp_System,%RegSystem%
....
...
...
RegHiveUnLoad,Tmp_Default
RegHiveUnLoad,Tmp_Software
RegHiveUnLoad,Tmp_System

****
Also, All projects have 2 essential plugins
Utils\"RegCPE"
Utils\"Reg ReConvert"
to help conversions  :thumbsup:

:ymca:
« Last Edit: March 21, 2013, 01:00:52 PM by Galapo »

Re: Confused on translating old registry commands
« Reply #11 on: March 20, 2013, 10:44:06 AM »

BobxT

  • Jr. Chef
  • **
  • Location: Melbourne, Australia
  • Date Registered: Mar 2011
  • Posts: 56
The first two examples (the Default and HKCU ones) in Lancelot's post still have the reg_add lines.

TIA,
BobxT

Re: Confused on translating old registry commands
« Reply #12 on: March 20, 2013, 05:55:44 PM »

paraglider

  • Chef
  • ***
  • Date Registered: Mar 2011
  • Posts: 137
Reg_Write has always been a very strange winbuilder command. The second parameter has always seemed to me to be on the wrong command. It would seem more logical to put it on the RegHiveLoad command so it controls which registry key the hive is loaded into. To me this would be more logical:

RegHiveLoad,Tmp_System,HKLM,%RegSystem%
RegWrite,0x1,Tmp_System\ControlSet001\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318},Class,MEDIA
RegHiveUnLoad,Tmp_System

Re: Confused on translating old registry commands
« Reply #13 on: March 20, 2013, 08:07:47 PM »

Galapo

  • Gena Baker
  • Grand Chef
  • *****
  • Location: Australia
  • Date Registered: Sep 2010
  • Posts: 1898
Hi paraglider,

I assume 'RegWrite' would also have to have the additional parameter as well.

RegWrite,HKLM,0x1,Tmp_System\ControlSet001\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318},Class,MEDIA

Or maybe without the need of another parameter, so it would be

RegWrite,0x1,HKLM\Tmp_System\ControlSet001\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318},Class,MEDIA

Regards,
Galapo.

Re: Confused on translating old registry commands
« Reply #14 on: March 20, 2013, 08:10:46 PM »

Galapo

  • Gena Baker
  • Grand Chef
  • *****
  • Location: Australia
  • Date Registered: Sep 2010
  • Posts: 1898
I've fixed Lancelot's post above now. Should be less confusing. :wink:

Regards,
Galapo.

Re: Confused on translating old registry commands
« Reply #15 on: March 21, 2013, 12:22:31 AM »

ChrisR

  • Win7PE SE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 2785
Reg_Write has always been a very strange winbuilder command. The second parameter has always seemed to me to be on the wrong command. It would seem more logical to put it on the RegHiveLoad command so it controls which registry key the hive is loaded into. To me this would be more logical:
I not really understand why you think this  :wink:

If I look to reg cmdline
Reg Add HKLM\Software\Test /v TestKey /t REG_SZ /d "Hello this is a test"
or similar in Autoit without switch
RegWrite("HKLM\Software\Test", "TestKey", "REG_SZ", "Hello this is a test")

And for loading the hive
Reg Load HKLM\Tmp_System E:\xxx\Windows\System32\Config\System (or Reg Load HKU\Tmp_System E:\xxx\Windows\System32\Config\System)

For me the logical and easier syntax would be this one
Code: [Select]
RegHiveLoad,HKLM\Tmp_Software,%RegSoftware%
RegWrite,HKLM\Tmp_Software\Test,TestKey,REG_SZ,"Hello this is a test"
RegHiveUnLoad,HKLM\Tmp_Software

With the type (REG_SZ, REG_MULTI_SZ, REG_EXPAND_SZ, REG_DWORD, REG_QWORD and REG_BINARY but not 0x) after the Value.
and force loading hive in HKLM without the choice and indicate it, why not!

Some differences, but for me the existing syntax is not so bad, except for binary data (with bad choices RegWriteBin, RegWriteBinEx to avoid).

In any cases, the scripts will be easier to read for all now  :thumbsup:, without mixing RegWrite, Reg_Add
and with standart names %RegDefault%, %RegSoftware%, %RegSystem% and Tmp_Default, Tmp_Software, Tmp_System.
:cheers:

Re: Confused on translating old registry commands
« Reply #16 on: March 21, 2013, 12:35:34 AM »

BobxT

  • Jr. Chef
  • **
  • Location: Melbourne, Australia
  • Date Registered: Mar 2011
  • Posts: 56
Thanks very much.

Regards,
BobxT

Re: Confused on translating old registry commands
« Reply #17 on: March 21, 2013, 12:39:27 PM »

BobxT

  • Jr. Chef
  • **
  • Location: Melbourne, Australia
  • Date Registered: Mar 2011
  • Posts: 56
Hi Galapo,

Thanks for the correction, but another is needed.

Double quotes are missing from the RegWrite lines..

Regards,
BobxT

Re: Confused on translating old registry commands
« Reply #18 on: March 21, 2013, 11:39:23 PM »

Lancelot

  • Moderator, Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 6732
I am not sure what you mean with "Double Quotes",
If I understand correctly:
"Double Quotes" only needed (better to put) when there is <space>
ex:
"Hello this is a test"

Hello_this_is_a_test

RegCPE puts these kind of quotes only when there is <space>, and not when there is not <space>

*
If I understand incorrectly:
Still there maybe something I miss on examples missing from my eyes (being in very rush),
 if so let us know to fix (Galapo if so please fix  :great:)

:turtle:

Re: Confused on translating old registry commands
« Reply #19 on: March 22, 2013, 12:33:52 AM »

Galapo

  • Gena Baker
  • Grand Chef
  • *****
  • Location: Australia
  • Date Registered: Sep 2010
  • Posts: 1898
Sorry, I fixed the quotes (standardised) without posting that I had. :heh:

Regards,
Galapo.

 

Powered by EzPortal