News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Registry and chinese

Started by Amadeus, August 01, 2017, 08:10:25 PM

Previous topic - Next topic

Amadeus

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
e.g.


.data
SubKey db "Software\Test\Prova",0

.code
        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
.else
invoke MessageBox,hWin,addr Err,0,0
.endif
invoke RegCloseKey,hKey


it should create something like this

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
invoke MessageBoxW,0,chr$("TEST"),chr$("test"),40h
it shows me the chinese characters

thanks
Amadeus 

aw27

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.

HSE

Welcome Amadeus.

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

Regards. HSE
Equations in Assembly: SmplMath

Amadeus

thank you guys

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