I would like to recover a data (type DWORD) in my registery. But I don't success. For a data (type string) I don't have any problem.
So how I must change this code to replace some String data by DWORD data ?

Even with the Flash REG_DWORD I don't success...

.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

include \masm32\include\advapi32.inc ;<-- Registres
includelib \masm32\lib\advapi32.lib

OkOkCreate db "C'est Ok pour Create",0
OkOkQuery db "C'est Ok pour Query",0
OkOkSet db "C'est Ok pour Set",0

ClassClef db "ClassClef",0 ;
Sous_Clef db "Software\Microsoft\Windows\CurrentVersion",0 ; Pour RegCreateKeyEx
reg dw 80 ;
Donnee_Lire db 50 dup(0),0
Taille_Donne_Lire dd 80
Valeur_Clef db "Mon texte",0 ; Pour RegQueryKeyEx et RegSetValueEx
Donnee_Ecrire db "RegSet a bien ecrit et RegQuery a bien Lu.",0 ; Pour RegSetValueEx

pHKey HANDLE ? ; Pour les quatre Reg...

; HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\=(RegSet a bien ecrit et RegQuery a bien Lu.)


invoke RegCreateKeyEx, HKEY_LOCAL_MACHINE, \
offset Sous_Clef, \
NULL, \ ;offset ClassClef, \
offset pHKey, \

invoke MessageBoxA, 0, offset OkOkCreate, offset OkOkCreate, 0

invoke RegSetValueEx, pHKey, \
addr Valeur_Clef, \
addr Donnee_Ecrire, \
sizeof Donnee_Ecrire

invoke MessageBoxA, 0, offset OkOkSet, offset OkOkSet, 0

invoke RegQueryValueEx, pHKey, \
offset Valeur_Clef, \
NULL , \
addr Donnee_Lire, \
addr Taille_Donne_Lire

invoke MessageBoxA, 0, offset Donnee_Lire, offset OkOkQuery, 0

invoke RegCloseKey, pHKey
xor eax,eax
invoke ExitProcess,eax

end start

Thanks ++
Posted on 2002-04-30 17:37:14 by Morgatte
is anybody understood what I said ?
Posted on 2002-05-01 03:09:43 by Morgatte
The big error in your code (i.e. once i saw this i didn't look any further) is that you used KEY_ALL_ACCESS when you called RegCreateKeyEx(). This will fail on any NT based system, you need to specify either (or a combination of) KEY_WRITE or KEY_READ. I am not sure whether the KEY_ALL_ACCESS will fail on a 9x machine.
Posted on 2002-05-01 05:20:41 by sluggy
Also, if you are trying to retrieve a DWORD from the key Valeur_Clef, then there is a problem with the last parameter of your RegQueryValueEx() call. The variable 'Taille_Donne_Lire' should == sizeof(DWORD) == 4 bytes (you are supposed to have the length of the data buffer (Donnee_Lire) in there).
Posted on 2002-05-01 05:32:59 by sluggy