Sign in to follow this  
Followers 0
lafafmentvotre

Insert value between every caracters

4 posts in this topic

Hello

Sorry by advance for my bad english.

I want to convert a string to a hex string. I use this script :

#include <string.au3>
$text = _StringToHex(@UserName)
MsgBox(0, "New string is", $text)

but after , i want to insert Between every caracters the value "00" (double zero) to use in a REG_BINARY :

RegWrite("HKCU\Software\Microsoft\Office\8.0\Common\UserInfo", "UserName", "REG_BINARY", "" & $Text)

because this REG_BINARY use 00 between every caracters.

My result for lafafmentvotre is : 6C616661666D656E74766F747265

the result to obtain is : 6C0061006600610066006D0065006E00740076006F00740072006500

I dont find the function to do this (i see stringreplace but i'm not shure it's the good function to do this).

Else, this script must match with every string.

Thanks for help.

Share this post


Link to post
Share on other sites



You think true. thanks for help. I just add "0000" at the end of value like this :

#include <string.au3>
$string = @UserName
$len = StringLen($string)
Global $text
For $i = 1 to $len
    $text &= _StringToHex(StringMid($string,$i,1)) & "00"
Next
MsgBox(0, "New string is", $text)
RegWrite("HKCU\Software\Microsoft\Office\11.0\Common\UserInfo", "UserName", "REG_BINARY", "" & $text & "0000")

Really thanks

Share this post


Link to post
Share on other sites

May I ask what kind of program you are making that would need to write to "HKCU\Software\Microsoft\Office\11.0\Common\UserInfo\UserName" ?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0