I am looking for an example regarding how to autostart my application in the registry...
Posted on 2006-07-07 16:08:28 by p0wder
.data?
tmp dd ?

.data
run_subkey      db "SOFTWARE\Microsoft\Windows\CurrentVersion\Run",0
run_name        db "your_application_name",0
run_path        db "C:\fullpathtoyouapplication",0

.code
        invoke  RegCreateKeyEx, HKEY_LOCAL_MACHINE, ADDR run_subkey, 0, 0, 0, KEY_WRITE, 0, ADDR tmp, 0
        cmp    eax, ERROR_SUCCESS
        jne    @f
        invoke  RegSetValueEx, , ADDR run_name, 0, REG_SZ, ADDR run_path, sizeof run_path
        invoke  RegCloseKey,
@@:
Posted on 2006-07-07 16:40:40 by arafel
You might want to use HKEY_CURRENT_USER in above example instead of HKEY_LOCAL_MACHINE. The latter one requires administrator privileges and is for every user, while the first one is user specific and can be used under every account.
Posted on 2006-07-07 16:53:55 by white scorpion
p0wder,

Can you tell use what are trying to achieve?
Posted on 2006-07-08 04:13:12 by Vortex
Two quick questions ...
1. Ok jne, jump if equal ... where is @f?

2. what is @@: ?

Thanks ...
Posted on 2006-07-08 08:35:46 by p0wder
@f means "next anonymous label" where @b means "previous anonymous label". (f == forward, b == backwards). @@: is an anonymous label.
Posted on 2006-07-08 08:51:53 by f0dder
I just had a few questions, just to make sure that i understand EXACTLY how this works, versus just copy/pasting. I need to learn ...

tmp		DD ?

ok uninitialized DOUBLE WORD data?

	invoke  RegCreateKeyEx, HKEY_CURRENT_USER, ADDR run_subkey, 0, 0, 0, KEY_WRITE, 0, ADDR tmp, 0
CMP    EAX, ERROR_SUCCESS
JNE    @f
invoke  RegSetValueEx, , ADDR run_name, 0, REG_SZ, ADDR run_path, SIZEOF run_path
invoke  RegCloseKey,
@@:


Ok create the key. Next compare eax tho - if it was not an initialized variable, why are we using it? thanks ...
Posted on 2006-07-09 18:10:30 by p0wder
Yes, is uninitialized DWORD data. RegCreateKeyEx puts handle to the opened key into it.

I would suggest downloading Microsoft Platform SDK (it's quite big, but if you connection can handle - it's worth it) or you can always search in msdn.microsoft.com to get more detailed info regarding particular API function.
Posted on 2006-07-10 06:00:27 by arafel