News:

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

Main Menu

Wait for API call ?

Started by Don57, February 08, 2013, 03:19:13 AM

Previous topic - Next topic

Don57

I need to wait for an API call to fill return buffers. The only thing that comes to mind is CreateProcess and WaitForSingleObject which I don't thing will work with an API call.

dedndave

which API call are you waiting for ?   :biggrin:

Don57

RegEnumValue - if I try to read the buffer right after the call the data is not correct. If I wait to read the data , the proper data is returned, it is almost as if the call takes time to write to the 5 buffers.

dedndave

that seems very strange
it's not supposed to be an asyncronous function
i.e., when the function returns, the buffers should be filled, according to the return status

are you calling it in a thread or something ?

dedndave

QuoteIf the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is a system error code.

ERROR_SUCCESS = 0

if it returns 0, the buffers should be valid

dedndave

also important:
QuoteWhile using RegEnumValue, an application should not call any
registry functions that might change the key being queried.

Don57

The call is from the mainline. If I use the routines that I wrote for debugging and read all the returned buffers in orders the data is valid.
However when I try to read just lp_lp_RegValueName and lp_RegData the data becomes incorrect. For example DisplayName becomes SystemComponent. It is almost as if the buffers have not finished writting.

dedndave

something is fishy
i guess i would take a closer look at the difference between the 2 programs
perhaps the second test piece is overwriting a buffer
you might also check to see that, if the buffer is on the stack, that ESP is below it   :P

disassembling the code may give you some insight

dedndave

.....if not, plug it into Olly