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.
which API call are you waiting for ? :biggrin:
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.
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 ?
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
also important:
QuoteWhile using RegEnumValue, an application should not call any
registry functions that might change the key being queried.
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.
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
.....if not, plug it into Olly