News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

RegEnumValue

Started by Don57, January 09, 2013, 06:29:38 AM

Previous topic - Next topic

dedndave

and, finally.....
      Next_Entry:

         push ecx
         mov  dw_BufSize, sizeof sz_Buffer-1
         push edx
         xor  ecx,ecx
         INVOKE  RegEnumKeyEx,hKeyKey,edx,offset sz_Buffer,offset dw_BufSize,ecx,ecx,ecx,ecx

         pop  edx
         pop  ecx
         inc  edx
         dec  ecx

push edx
push ecx
         CALL Read_SubKey                                                 ; read entries for subkeys
pop  ecx
pop  edx
             
         cmp  ecx,0
         jnz  Next_Entry

the call to Read_SubKey destroys the contents of EAX, ECX, and EDX   :P

better, yet....
      Next_Entry:

         push ecx
         mov  dw_BufSize, sizeof sz_Buffer-1
         push edx
         xor  ecx,ecx
         INVOKE  RegEnumKeyEx,hKeyKey,edx,offset sz_Buffer,offset dw_BufSize,ecx,ecx,ecx,ecx

         CALL Read_SubKey                                                 ; read entries for subkeys

         pop  edx
         pop  ecx
         inc  edx
         dec  ecx
         jnz  Next_Entry

dedndave


Don57

Thanks I'll give it a try.  :t

Don57

Still banging around trying to get RegEnumValue going. The in Read_SubKey PROC return only 2 of 5 pieces of data. lp_RegDataType (lpType) and lp_RegDataLen (lpcbData)., but the other three buffers are empty. I realize that buffer are static, I will dynamically allocate them and add further error checking when I get the call working.

dedndave

added 1 line   :P
Read_SubKey PROC

      CALL ParsePath                                                          ; path for sub key enumeration

      INVOKE RegOpenKeyEx, HKEY_LOCAL_MACHINE, offset sz_Buffer2, NULL, KEY_ALL_ACCESS, offset hSubKey 

      or eax,eax
      jnz Exit_RegSubOpen                                                     ; exit if error on open

      xor edx,edx                                                             ; zero index

      Next_SubEntry:

         push edx

mov lp_RegValueNameLen,sizeof lp_RegValueName-1

         INVOKE RegEnumValue........


no need to parse a new path name and open another handle, though
you can pass the handle from the RegOpenKeyEx to this proc
then - just use the subkey name   :t

Don57

Thanks. Be lost in the woods, with these API withhout your help.  :greenclp:

dedndave

the registry is a little tricky   :biggrin:

hfheatherfox07

Quote from: dedndave on January 16, 2013, 06:12:42 PM
the registry is a little tricky   :biggrin:

There is a very nice example in MASM32 examples  :biggrin:
In masm32 v9 it is example in "\masm32\examples\example06\regdemo" folder.
In masm32 v10 it is example in "\masm32\examples\example06\regdemo" folder.
In masm32 v11 it is example in "\masm32\examples\example04\regdemo" folder.  <<<---

Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

Magnum

I think the 3rd entry should be example 06.

I found it to be a good example of using an ini file in addition to commonly used reg functions.
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

Don57

Thanks everybody. The microsoft data sheets are confusing at times.

dedndave

sometimes, it's what they don't tell you that's confusing   :P

or - they tell you, but it's not in the document you'd expect - it's in some other document

Don57

Still working on this project. Added debugging routine to dump registry data to a file,  got tired of reading the heap. It appears that the data that I am reading is valid, but I am only returning about 40% of installed programs. Program creates Reg Data.txt file. I think the problem is the access keys in the EnumerateKeys PROC, but not sure.

dedndave

KEY_ALL

try KEY_ALL_ACCESS   :biggrin:

and.....

02/03/2013  03:57 PM           663,702 toolbar.bmp

ouch !
maybe that could be a 16 color image
better yet, create a bitmap and generate the image with code or something   :t

when i use a toolbar image, it usually has just icon type images
256 colors is plenty, regardless of what the other guys say - lol

Don57

Tried that but I'm on a 64 bit system, still doesn't get it.

dedndave

ok - i take it you are using win7 ?

there may well be security permission issues
you may have to add some UAC access stuff to the manifest

and - there is also the WOW32 issue
because when you access a 64-bit registry in 32-bit code, you are viewing a virtualized 32-bit version of it
this is an area where i have very little experience   :P

maybe the best approach is to write 64-bit code