flat assembler
Message board for the users of flat assembler.

Index > Windows > Win32 Registry

Author
Thread Post new topic Reply to topic
Igor



Joined: 08 Nov 2003
Posts: 2
Location: Ukraine
Igor 20 Nov 2003, 19:46
I want use registry.
How can I write "hKey ... myhandle"?
Post 20 Nov 2003, 19:46
View user's profile Send private message Reply with quote
eet_1024



Joined: 22 Jul 2003
Posts: 59
eet_1024 20 Nov 2003, 23:24
Code:
   invoke   RegCreateKey, [.hKey], [.lpszSubKey], [.HKEY]
   invoke   RegSetValueEx, [.HKEY], [.lpszName], 0, REG_SZ, szTemp, [._size]
   invoke   RegCloseKey, [.HKEY]
    
Post 20 Nov 2003, 23:24
View user's profile Send private message Reply with quote
Igor



Joined: 08 Nov 2003
Posts: 2
Location: Ukraine
Igor 21 Nov 2003, 13:35
This is my program code:
Code:
;************************************************************
format PE GUI 4.0
entry start
include '%include%\win32a.inc'
section '.data' data readable writeable
my_subkey       db 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run',0
my_value_name   db 'MyProgram',0
my_value_data:
                db 'Myprogram.exe'
                db 0
my_value_size   db $-my_value_data
my_hkey    dw ?
section '.code' code readable executable
  start:
        invoke   RegOpenKeyEx,HKEY_LOCAL_MACHINE,my_subkey,my_hkey
        invoke   RegSetValueEx,my_hkey,my_value_name,0,REG_SZ,my_value_data,my_value_size
        invoke   RegCloseKey,my_hkey
exit:
        invoke ExitProcess,0
section '.idata' import data readable writeable
library kernel,'KERNEL32.DLL',\
        advapi,'ADVAPI32.DLL'
import  kernel,\
        ExitProcess,'ExitProcess'
import advapi,\
       RegOpenKeyEx,'RegOpenKeyExA',\
       RegSetValueEx,'RegSetValueExA',\
       RegCloseKey,'RegCloseKey'
;************************************************************
    

After compiling and run my program didn’t add “my_value_name” in registry. What is wrong?
Post 21 Nov 2003, 13:35
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.