I found this procedure that I am using successfully to add Registry values:
The problem is, I am stuck adding keys to HKEY_CURRENT_USER because it is hard coded.
Currently you call the function like this:
Here is the Prototype for the function:
What I would like to do, is add another parameter so I am not stuck adding values in HKEY_CURRENT_USER.
Is this process involved? If it is, I may as well just write my values in HKEY_CURRENT_USER, as I am sorta new at this.
Could it be as simple as changing adding another :DWORD to the prototype? (at work, no compiler here to test).
If so, would I have to change anything in the Proc itself, like replacing the hard coded value with a variable?
BTW - this board rocks. Glad I found it.
Regards,
Trope
SetRegKeysz PROC lpszString:DWORD, lpszKeyName:DWORD, lpszValueName:DWORD, dwStringLength
LOCAL Disp :DWORD
LOCAL pKey :DWORD
invoke RegCreateKeyEx, HKEY_CURRENT_USER,
lpszKeyName, NULL, NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, NULL,
addr pKey, addr Disp
.IF eax == ERROR_SUCCESS
invoke RegSetValueEx, pKey, lpszValueName,
NULL, REG_SZ,
lpszString, dwStringLength
invoke RegCloseKey, pKey
.ENDIF
ret
SetRegKeysz ENDP
The problem is, I am stuck adding keys to HKEY_CURRENT_USER because it is hard coded.
Currently you call the function like this:
invoke SetRegKeysz , ADDR RegistryTextToAdd, ADDR szKeyNameToAdd, ADDR szStringValueToAdd, SIZEOF szStringValueToAdd
Here is the Prototype for the function:
SetRegKeysz PROTO :DWORD, :DWORD, :DWORD, :DWORD
What I would like to do, is add another parameter so I am not stuck adding values in HKEY_CURRENT_USER.
Is this process involved? If it is, I may as well just write my values in HKEY_CURRENT_USER, as I am sorta new at this.
Could it be as simple as changing adding another :DWORD to the prototype? (at work, no compiler here to test).
If so, would I have to change anything in the Proc itself, like replacing the hard coded value with a variable?
BTW - this board rocks. Glad I found it.
Regards,
Trope
i had the same problem. but its easy to solve.
jsut add a new parameter.
and replace it with HKEY_CURRENT_USER.
here is my code:
useage:
jsut add a new parameter.
and replace it with HKEY_CURRENT_USER.
here is my code:
useage:
invoke SetRegString, HKEY_LOCAL_MACHINE,
chr$("Software\MASM\Registry Test\"),
chr$("StringKeyName"),
chr$("aaa")
SetRegString proc reg_HKEY:dword, lpszKeyName:dword, lpszValueName:dword, lpszString:dword
local Disp: dword
local pKey: dword
local dwSize: dword
invoke RegCreateKeyEx, reg_HKEY,
lpszKeyName, NULL, NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, NULL,
addr pKey, addr Disp
.if eax == ERROR_SUCCESS
invoke lstrlen, lpszString
mov dwSize, eax
invoke RegSetValueEx, pKey, lpszValueName,
NULL, REG_SZ,
lpszString, dwSize
push eax
invoke RegCloseKey, pKey
pop eax
.endif
ret
SetRegString endp
awesome! I was on the right track.
Could it be I am getting the hang on this... slowly? :o
Could it be I am getting the hang on this... slowly? :o
its easy. add new paramater to your proc "h_regkey:dword"
and replace "HKEY_CURRENT_USER" with "h_regkey". thats all
and replace "HKEY_CURRENT_USER" with "h_regkey". thats all