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

Confused on translating old registry commands
« on: January 16, 2013, 05:53:58 PM »

JonF

  • Code Baker
  • Chef
  • ***
  • Date Registered: Jan 2011
  • Posts: 291
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, 10:24:47 PM »

ChrisR

  • XPE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 3494
« Last Edit: January 16, 2013, 10:30:58 PM by ChrisR »

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

JonF

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

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

Lancelot

  • Moderator, Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
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, 04:22:54 PM »

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, 04:28:23 PM »

Lancelot

  • Moderator, Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
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, 04:40:08 PM »

ChrisR

  • XPE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 3494
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, 05:42:31 PM »

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, 07:18:15 PM »

ChrisR

  • XPE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 3494
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, 07:23:20 PM by ChrisR »

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

JonF

  • Code Baker
  • Chef
  • ***
  • Date Registered: Jan 2011
  • Posts: 291
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, 09:35:37 PM »

Lancelot

  • Moderator, Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
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, 11:00:52 PM by Galapo »

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

BobxT

  • Jr. Chef
  • **
  • Location: Melbourne, Australia
  • Date Registered: Mar 2011
  • Posts: 57
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 21, 2013, 03:55:44 AM »

paraglider

  • Chef
  • ***
  • Date Registered: Mar 2011
  • Posts: 144
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 21, 2013, 06:07:47 AM »

Galapo

  • Gena Baker
  • Grand Chef
  • *****
  • Location: Australia
  • Date Registered: Sep 2010
  • Posts: 2207
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 21, 2013, 06:10:46 AM »

Galapo

  • Gena Baker
  • Grand Chef
  • *****
  • Location: Australia
  • Date Registered: Sep 2010
  • Posts: 2207
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, 10:22:31 AM »

ChrisR

  • XPE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 3494
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, 10:35:34 AM »

BobxT

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

Regards,
BobxT

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

BobxT

  • Jr. Chef
  • **
  • Location: Melbourne, Australia
  • Date Registered: Mar 2011
  • Posts: 57
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 22, 2013, 09:39:23 AM »

Lancelot

  • Moderator, Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
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, 10:33:52 AM »

Galapo

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

Regards,
Galapo.

 

Powered by EzPortal