Trying to convert a binary reg value to a string so I can search for
text in the string. Anyone got any ideas.

The reg file is included below. I'm trying to convert the hex value
so I can retrieve the string value '146CL23CB628'.

Any ideas appreciated.

Thanks

------------------------------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\_Test\Device Parameters]
"EDID"=hex:00,ff,ff,ff,ff,ff,ff,00,0e,11,93,13,38,32,36,42,2e,0b,01,03,68,20,\
18,7e,ea,bb,b9,a3,52,46,98,24,0f,48,4c,ad,ef,80,31,59,45,59,61,59,71,4f,81,\
80,a9,45,01,01,01,01,ea,24,00,60,41,00,28,30,30,60,13,00,38,ea,10,00,00,1e,\
00,00,00,fd,00,32,a0,1e,55,11,00,0a,20,20,20,20,20,20,00,00,00,ff,00,31,34,\
36,43,4c,32,33,43,42,36,32,38,0a,00,00,00,fc,00,43,4f,4d,50,41,51,20,56,37,\
32,30,0a,20,00,91,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00

Re: Covert hex to string... how? by Evertjan

Evertjan
Fri Oct 24 04:11:05 CDT 2003

Nathan Reeves wrote on 24 okt 2003 in microsoft.public.scripting.vbscript:

> Trying to convert a binary reg value to a string so I can search for
> text in the string. Anyone got any ideas.
>
> The reg file is included below. I'm trying to convert the hex value
> so I can retrieve the string value '146CL23CB628'.

<script language=vbs>

t = "00,ff,ff,ff,ff,ff,ff,00,0e,11,93,13,38,"
t = t & "32,36,42,2e,0b,01,03,68,20,"
t = t & "18,7e,ea,bb,b9,a3,52,46,98,24,0f,48,"
t = t & "4c,ad,ef,80,31,59,45,59,61,59,71,4f,81,"
t = t & "80,a9,45,01,01,01,01,ea,24,00,60,41,"
t = t & "00,28,30,30,60,13,00,38,ea,10,00,00,1e,"
t = t & "00,00,00,fd,00,32,a0,1e,55,11,00,0a,"
t = t & "20,20,20,20,20,20,00,00,00,ff,00,31,34,"
t = t & "36,43,4c,32,33,43,42,36,32,38,0a,00,"
t = t & "00,00,fc,00,43,4f,4d,50,41,51,20,56,37,"
t = t & "32,30,0a,20,00,91"

s = ""
while len(t)>1
cc = left(t,2)
t = mid(t,4)
c = CLng("&H" & cc)
if c > 31 then
s = s & Chr(c)
else
s = s & "<span style='color:red;'>?</span>"
end if
wend
document.write s

</script>




--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: Covert hex to string... how? by Ray

Ray
Fri Oct 24 09:09:54 CDT 2003

Instead of mid'ing, I think splitting your values into an array may be a bit
more efficient.

Or, you could be a maniac and do:

t = "Chr(CLng(&H" & Replace(t, ",", ")) & Chr(CLng(&H") & "))"

s = Eval(t)

I hate Eval.

Ray at work


"Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
news:Xns941E71C926EE4eejj99@194.109.133.29...
> Nathan Reeves wrote on 24 okt 2003 in microsoft.public.scripting.vbscript:
>
> > Trying to convert a binary reg value to a string so I can search for
> > text in the string. Anyone got any ideas.
> >
> > The reg file is included below. I'm trying to convert the hex value
> > so I can retrieve the string value '146CL23CB628'.
>
> <script language=vbs>
>
> t = "00,ff,ff,ff,ff,ff,ff,00,0e,11,93,13,38,"
> t = t & "32,36,42,2e,0b,01,03,68,20,"
> t = t & "18,7e,ea,bb,b9,a3,52,46,98,24,0f,48,"
> t = t & "4c,ad,ef,80,31,59,45,59,61,59,71,4f,81,"
> t = t & "80,a9,45,01,01,01,01,ea,24,00,60,41,"
> t = t & "00,28,30,30,60,13,00,38,ea,10,00,00,1e,"
> t = t & "00,00,00,fd,00,32,a0,1e,55,11,00,0a,"
> t = t & "20,20,20,20,20,20,00,00,00,ff,00,31,34,"
> t = t & "36,43,4c,32,33,43,42,36,32,38,0a,00,"
> t = t & "00,00,fc,00,43,4f,4d,50,41,51,20,56,37,"
> t = t & "32,30,0a,20,00,91"
>
> s = ""
> while len(t)>1
> cc = left(t,2)
> t = mid(t,4)
> c = CLng("&H" & cc)
> if c > 31 then
> s = s & Chr(c)
> else
> s = s & "<span style='color:red;'>?</span>"
> end if
> wend
> document.write s
>
> </script>
>
>
>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)



Re: Covert hex to string... how? by Ross

Ross
Fri Oct 24 13:16:51 CDT 2003

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in
news:OwXsAijmDHA.1284@TK2MSFTNGP09.phx.gbl:

> Instead of mid'ing, I think splitting your values into an array may be
> a bit more efficient.
>
> Or, you could be a maniac and do:
>
> t = "Chr(CLng(&H" & Replace(t, ",", ")) & Chr(CLng(&H") & "))"
>
> s = Eval(t)
>
> I hate Eval.
>

That is indeed pretty maniacal!


Here's a short split/join solution:

arr = Split(t,",")
For i = 0 to UBound(arr)
arr(i) = Chr(CLng("&H" & arr(i)))
Next
s = Join(arr,"")



Re: Covert hex to string... how? by TDM

TDM
Fri Oct 24 16:27:18 CDT 2003


Nathan,

I am thinking that your real intent may be to manipulate a binary value in
the registry, which returns type Byte from a Typename, is this correct ?

I played around a while back with this to make edits and changes to the
IE toolbar, but I failed. However, you have given me an idea to get this
done now, dump to file, edit file, then put back in registry when done. I
was attempting to do all the manipulation "inside" the script.

Should I be correct, please post your solution if you will.

TDM

"Nathan Reeves" <Nathan.Reeves@Halliburton.com> wrote in message
news:bfa8f923.0310240043.3a82a44a@posting.google.com...
> Trying to convert a binary reg value to a string so I can search for
> text in the string. Anyone got any ideas.
>
> The reg file is included below. I'm trying to convert the hex value
> so I can retrieve the string value '146CL23CB628'.
>
> Any ideas appreciated.
>
> Thanks
>
> ------------------------------
> Windows Registry Editor Version 5.00
>
> [HKEY_LOCAL_MACHINE\Software\_Test\Device Parameters]
>
"EDID"=hex:00,ff,ff,ff,ff,ff,ff,00,0e,11,93,13,38,32,36,42,2e,0b,01,03,68,20
,\
>
18,7e,ea,bb,b9,a3,52,46,98,24,0f,48,4c,ad,ef,80,31,59,45,59,61,59,71,4f,81,\
>
80,a9,45,01,01,01,01,ea,24,00,60,41,00,28,30,30,60,13,00,38,ea,10,00,00,1e,\
>
00,00,00,fd,00,32,a0,1e,55,11,00,0a,20,20,20,20,20,20,00,00,00,ff,00,31,34,\
>
36,43,4c,32,33,43,42,36,32,38,0a,00,00,00,fc,00,43,4f,4d,50,41,51,20,56,37,\
>
32,30,0a,20,00,91,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
>
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
>
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
>
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
>
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
> 00,00,00,00,00,00,00,00,00