954,219 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

problem in usin registry api

hi

i write a program to add a value in windows registry but it didn't work
and doesn't add anything in registry, what's a problem?
my assembler is masm32.

and here is my code:

.386
.model flat, stdcall
option casemap:none

include windows.inc
include kernel32.inc
include advapi32.inc

includelib kernel32.lib
includelib advapi32.lib

.data
    szRegSubKey db    "Software\Microsoft\Windows\CurrentVersion\Policies\System", 0
    szValue     db    "DisableTaskMgr", 0
	
.data?
    hKey    PHKEY    ?

.code
start:

    invoke  RegOpenKeyEx, RegOpenKeyEx, ADDR szRegSubKey, NULL, KEY_ALL_ACCESS, ADDR hKey
	
    OR    EAX, EAX
    JNE   _error
		  invoke  RegSetValueEx, hKey, ADDR szValue, NULL, REG_DWORD, 1, DWORD

_error:

    invoke  RegCloseKey, hKey
    invoke  ExitProcess, NULL

end start
BlZbB
Newbie Poster
6 posts since Sep 2007
Reputation Points: 10
Solved Threads: 1
 

try

invoke RegOpenKeyEx HKEY_LOCAL_MACHINE, ADDR szRegSubKey, NULL, KEY_ALL_ACCESS, ADDR hKey)
Tight_Coder_Ex
Posting Whiz in Training
215 posts since Feb 2005
Reputation Points: 47
Solved Threads: 17
 

thanks Tight_Coder_Ex it's work. :icon_lol:

BlZbB
Newbie Poster
6 posts since Sep 2007
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You