can anyone point me in the direction of some code showing how to write a string to registry, cuz my code that i wrote myself doesnt seem to work, any help would be apreciated!
thanx.
-brad
See hutch's site for the code area. I have some code there.
Change the flags if you want it to work in NT :-)
something like this:
.data
regKey db "Software\MyCompany\MyProgram",0
regStr db "MyEntry",0
regValu db "MyEntryValue"
.data?
hRegKey dd ?
.const
KEY_FIX_ACCESS equ (KEY_READ or KEY_WRITE)
.code
.
.
.
invoke RegOpenKeyEx,HKEY_CURRENT_USER,ADDR regKey, 0, KEY_FIX_ACCESS, ADDR hRegKey
invoke lnstr,ADDR regValu ;returns length of string in eax
invoke RegSetValueEx,hRegKey,ADDR regStr,0,REG_SZ, ADDR regValu,eax
This assumes the registry key HKEY_CURRENT_USER\Software\MyCompany\MyProgram" already exists. If not, you'll have to create it first. Try RegCreateKeyEx. If the key exists, it opens it. If the key doesn't exist, it creates and opens it. In either case, it returns the handle in eax.
invoke RegCreateKeyExA,HKEY_CURRENT_USER,ADDR regKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_FIX_ACCESS, NULL, ADDR hRegKey, NULL
Something like that, anyway.
This message was edited by Q, on 2/26/2001 1:47:41 AMOr you can see my program that show how to write a string and a number to the reg.
http://asmsource.8k.com/files32/regi32.zip
http://asmsource.8k.com/files32/regi.asm.txt
I havent had a chance to update this to win2k/nt yet, but all you need to do is change KEY_ALL_ACCESS, to KEY_WRITE and KEY_READ.
As always, if you decide to accept this code, the secretary will help you with any questions you may have. This message will self decruct in 5 seconds..
goodluck, John