Author Topic: Registry and chinese  (Read 838 times)


  • Regular Member
  • *
  • Posts: 2
Registry and chinese
« on: August 01, 2017, 08:10:25 PM »
Hello all and good morning,
my name is Amadeus, i am from italy so english is not my native language, so please
apologize for the errors.

I'm pretty new to masm til now everything i become to run (naturelly with lot of reseach and try 'n error)  ::)

But now i come to a point and cant find any solution,what i am tryin
is to write to registry so that value is in chinese characters

Code: [Select]
SubKey db "Software\Test\Prova",0

        invoke RegCreateKeyEx,HKEY_CURRENT_USER,addr SubKey,NULL,NULL,NULL, KEY_ALL_ACCESS,NULL,addr hKey,NULL
.if eax == ERROR_SUCCESS
invoke RegSetValueExW,hKey,chr$("TEST1"),NULL,REG_SZ,chr$("test"),4
invoke MessageBox,hWin,addr Err,0,0
invoke RegCloseKey,hKey

it should create something like this

Code: [Select]
TEST1     REG_SZ    瑥獴
but it does not!!

i dont know why, i mean the rappresentation of "test" is 0x7465, 0x7374

any help is appreciate

p.s: if i use this
Code: [Select]
invoke MessageBoxW,0,chr$("TEST"),chr$("test"),40hit shows me the chinese characters



  • Member
  • *****
  • Posts: 1657
  • Let's Make ASM Great Again!
Re: Registry and chinese
« Reply #1 on: August 01, 2017, 08:29:59 PM »
Hello Amadeus,
I have not tested, but it appears that you are not counting with the NULL terminator of the REG_SZ on the number of bytes.

I would also recommend that you present a complete sample in order to avoid guesswork.


  • Member
  • ****
  • Posts: 890
  • <AMD>< 7-32>
Re: Registry and chinese
« Reply #2 on: August 01, 2017, 08:54:25 PM »
Welcome Amadeus.

You have an ANSI string, but you are calling a UNICODE function to write it. Try RegSetValueExA.

Regards. HSE


  • Regular Member
  • *
  • Posts: 2
Re: Registry and chinese
« Reply #3 on: August 01, 2017, 10:32:09 PM »
thank you guys

that was exactly what was wrong now
everythings is working :)