2 Replies - 588 Views - Last Post: 29 November 2012 - 02:09 AM

#1 Latias  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 73
  • Joined: 28-June 12

get dword value of windows registry

Posted 28 November 2012 - 09:15 AM

hey all

i made a registry tool which can create and delete windows registry keys.
all working fine exept retrieving a dword value from a subkey.

this is the code where it goes about also i will upload the whole project

	invoke RegCreateKeyEx, HKEY_CURRENT_USER, Addr NameOfKey, 0, 0, 0, KEY_WRITE, 0, Addr hKey, Addr lpdwDisp
		.if eax == ERROR_SUCCESS
			invoke MessageBox, hWnd, chr$("Key created!"), chr$("Succeeds"), MB_ICONINFORMATION
		.else
			invoke MessageBox, hWnd, chr$("Key not created!"), chr$("Error"), MB_IConerror
		.endif
	.endif




.elseif eax == GetDwordKey
	mov lpcbData, 4
	invoke RegQueryValueEx, hKey, chr$("This is a dword value"), 0, addr lpType, addr Buffer, addr lpcbData
   
		.if eax == ERROR_SUCCESS
			invoke SetDlgItemText, hWnd, 1013,ADDR Buffer
		.else
			invoke SetDlgItemText, hWnd, 1013, chr$("Dwordkey can't be retrieved!")
		.endif
.endif


project
removed

This post has been edited by Latias: 29 November 2012 - 02:01 AM


Is This A Good Question/Topic? 0
  • +

Replies To: get dword value of windows registry

#2 GunnerInc  Icon User is online

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,281
  • Joined: 28-March 11

Re: get dword value of windows registry

Posted 28 November 2012 - 04:49 PM

invoke RegCreateKeyEx, HKEY_CURRENT_USER, Addr NameOfKey, 0, 0, 0, KEY_WRITE, 0, Addr hKey, Addr lpdwDisp


Of course you cannot read anything from the registry, you opened/created the key for writing only! OR KEY_READ and you will be able to read from the registry:

invoke RegCreateKeyEx, HKEY_CURRENT_USER, Addr NameOfKey, 0, 0, 0, KEY_WRITE or KEY_READ, 0, Addr hKey, Addr lpdwDisp


Next issue:
Is a DWORD the same thing as a string??? This will show gibberish:
invoke SetDlgItemText, hWnd, 1013,ADDR Buffer


It should be:
invoke SetDlgItemInt, hWnd, 1013, ADDR Buffer, FALSE

Was This Post Helpful? 2
  • +
  • -

#3 Latias  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 73
  • Joined: 28-June 12

Re: get dword value of windows registry

Posted 29 November 2012 - 02:09 AM

oh great its working now! thanks again master
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1