Re: Editing the nth byte of a BINARY Registry Value
- From: "Gary" <Gary@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 5 Apr 2005 06:45:04 -0700
Thank You Dan that was just what I was after
Best Regards
Gary
"Dan Khanseitov" wrote:
> Hi!
>
> Example:
>
> I need change binary value (one byte "0a" to "03" ) in key
>
> [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
>
> "DaylightStart"=hex:00,00,0a,00,05,00,03,00,00,00,00,00,00,00,00,00
>
> to the new value.
>
> Script:
>
> ****************************************************************************************
> const HKEY_LOCAL_MACHINE = &H80000002
> strComputer = "."
>
> Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
> & strComputer & "\root\default:StdRegProv")
>
> 'Define byte's array
> Dim bArray
>
> strKeyPath = "SYSTEM\CurrentControlSet\Control\TimeZoneInformation"
>
> 'Fill array with values of the key;
> 'array elemnts starts from 0 an up,
> 'so I need to change bArray(2) element's value
>
> objReg.GetBinaryValue HKEY_LOCAL_MACHINE, strKeyPath, "DaylightStart",
> bArray
>
> 'Changing value
> bArray(2) = 3
>
> 'Write infromation back
> objReg.SetBinaryValue HKEY_LOCAL_MACHINE, strKeyPath, "DaylightStart",
> bArray
>
> Set objReg = Nothing
>
>
> ****************************************************************************************
>
> Regards,
> Dan
>
> Gary wrote :
> > Hello
> >
> > I'm trying to edit a Binary Registry value which I can do by doing a full
> > replace of the data, but because the data could be different from machine to
> > machine and only specific bytes change I was trying to write a script that
> > would allow me just edit specific bytes for example byte 6 and 63, but I
> > don't know the best way to go about it.
> >
> > Could I use to the Replace function in this example?
> > Replace(reg_string, "00", "01", 63, 1, 0)
> >
> > If so would someone be able be able to help me read in a binary registry
> > value that I could run the replace on.
> >
> > I really don't have any preference how I get to how I get this to work, my
> > programming knowledge is limited so any advice or help would be most
> > appreciated.
> >
> > Thanks for time
> >
> > Gary
> >
> > PS My reference to a byte is if you export out from the registery a binary
> > value
> > eg "1"=hex:03,00,00,00,00,00,00,
> >
> > I'm asuming that the number inbetween the coma's represets a byte and I've
> > worked out byte's that I would need to change.
> >
> > Please feel free to tell me if i'm being a doughnut
>
>
>
.
- References:
- Editing the nth byte of a BINARY Registry Value
- From: Gary
- Re: Editing the nth byte of a BINARY Registry Value
- From: Dan Khanseitov
- Editing the nth byte of a BINARY Registry Value
- Prev by Date: Re: Schedule + VBScipt
- Next by Date: send a mail include an attachment with CDO, if the attachment is in the DataBase, How to do it?
- Previous by thread: Re: Editing the nth byte of a BINARY Registry Value
- Next by thread: Enable / Disable 802.1x with some script
- Index(es):
Relevant Pages
|