I m trying to make a registry tweak program.....Here is some code i have written

invoke RegOpenKeyEx,HKEY_CURRENT_USER,addr lCabinet,0,KEY_QUERY_VALUE,addr hReg

invoke RegQueryValueEx,hReg,SADD("FullPath"),0,addr DWTYPE,addr Buffer,addr DSIZE
.if eax==ERROR_SUCCESS
.if Buffer==1
mov TBar,1
invoke CheckDlgButton,hWin,IDC_TBAR,BST_CHECKED
.endif
.elseif
mov TBar,0
.endif

invoke RegQueryValueEx,hReg,SADD("Use Search Asst"),0,addr SZType,addr Buffer,addr DSIZE
.if eax==ERROR_SUCCESS
mov eax,dword ptr
cmp eax,'on'
je @1
mov VSearch,0
jmp @2
@1:
mov VSearch,1
invoke CheckDlgButton,hWin,IDC_SEARCH,BST_CHECKED
.endif

@2:
mov DSIZE,0
invoke RegQueryValueEx,hReg,SADD("FullPathAddress"),0,addr DWTYPE,addr Buffer,addr DSIZE
.if eax==ERROR_SUCCESS
.if Buffer==1
mov VAddress,1
invoke CheckDlgButton,hWin,IDC_ABAR,BST_CHECKED
.endif
.else
mov VAddress,0
.endif


After the regquery  for FullPathAddress i m getting error code 234..Which accoring to  Winerror.h

#define ERROR_MORE_DATA                  234L    // dderror

//
// MessageId: ERROR_VC_DISCONNECTED
//
// MessageText:
//
//  The session was canceled.

Why i m getting this error????
I saw if i put the regquery for the FullPathAddress above the "Use search Asst" then the code doesn't return any error...

The search asst is of REG_SZ and others are REG_DWORD
Posted on 2006-08-24 09:36:42 by sonic
In general, when dealing with the registry (or many other APIs) ERROR_MORE_DATA indicates that the buffer you are using to store the information is not large enough. In your case you have moved 0 into DSIZE, which tells the API that you are using a buffer size of 0 bytes. It will return ERROR_MORE_DATA in EAX and the size of buffer required in DSIZE, all other parameters are ignored. If you wish to read without first checking the buffer you should fill DSIZE with the actual size of the buffer, it will contain the number of bytes copied on return.

Donkey
Posted on 2006-08-24 22:52:29 by donkey
Many thanks donkey...I used SIZEOF Buffer and it worked...So i have to everytime move the sizeof Buffer into DSIZE after a Regquery is made...?
Posted on 2006-08-25 05:26:01 by sonic
There seems to be another problem.....How to change the value of (Default) keys......i m getting Not Found(error code 2) although it exists on trying to make a reg query...

EDIT: I seem to have found the method...I used NULL and it works

Cheers  :)
Posted on 2006-08-25 07:39:42 by sonic

Many thanks donkey...I used SIZEOF Buffer and it worked...So i have to everytime move the sizeof Buffer into DSIZE after a Regquery is made...?


Yes.
Posted on 2006-08-25 08:26:40 by donkey