News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

regCreateKeyEx Q

Started by DC, August 12, 2011, 03:39:13 AM

Previous topic - Next topic

DC

pretty rusty at this...
this code isn't putting a key in the reg...
iDisp is saying  REG_OPENED_EXISTING_KEY...
but when I look with regeditthe key isn't there...

    m2m     sSA.nLength, sizeof SECURITY_ATTRIBUTES
    m2m     sSA.lpSecurityDescriptor,NULL
    m2m     sSA.bInheritHandle,TRUE
    invoke  RegCreateKeyEx, HKEY_LOCAL_MACHINE,addr szFakePath,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,addr sSA,addr hOpenKey,addr iDisp

8|
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net

dedndave

it should not be necessary to use a SECURITY_ATTRIBUTES structure

to use these functions, you must also...
        INCLUDE    \masm32\include\advapi32.inc
        INCLUDELIB \masm32\lib\advapi32.lib

        .DATA

szSubKey db 'SOFTWARE\TempKey',0

        .DATA?

dwSize   dd ?

        .CODE

        INVOKE  RegCreateKeyEx,HKEY_CURRENT_USER,offset szSubKey,NULL,NULL,
                NULL,KEY_CREATE_SUB_KEY or KEY_SET_VALUE,NULL,offset dwSize,NULL

DC

thanx... that's working....
I was also looking in CURRENT_USER instead of LOCAL_MACHINE so I don't know if my other code was working or not...
the offset/addr  thing has always been confusing to me... i'll experiment and see...
thanx again dedndave
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net

DC

p.s. it's also good to know I don't have to mess with those security structures.... reading about those almost made me throw away my computer...
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net

dedndave

well - that's why i stay in HKEY_CURRENT_USER   :lol

under vista and/or win7, you may have to mess with security issues if using other keys
the simple solution is to have the user run the program as an administrator
but, that's not always desirable

DC

hhhhmmmmmmmmm...
this is part of my registration for some PhotoShop filters...
is it possible that folks without admin privileges wouldn't be able to register via LOCAL_MACHINE but could via CURRENT_USER?
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net

dedndave

no - if your stuff has to go in HKLM, then it has to go in HKLM   :P
i don't recall the different access levels for different keys
you can probably google it or search the forum

DC

I apreciate your help...
have many good ones...
this isn't daja vu, I'm just learning it for the 37th time
http://www.bmath.net

Astro

Quote from: DC on August 12, 2011, 04:35:40 AM
p.s. it's also good to know I don't have to mess with those security structures.... reading about those almost made me throw away my computer...
They're not that bad. I have a working example somewhere - I'll dig it out and post it.