>Here's a thing to try:  Modify the WaitForRX function to add another
>COMMS_RX_THREAD_DATA param, like:
>
>Check the generated code to make sure the new rsCheck param doesn't get
>optimized away.  Then, run the code and see if the breakpoint is hit, and if it is,
>check out the value of rsThreadData.  The idea is to add a check parameter to
>the function to see if it gets corrupetd as well/instead of the real parameter, so
>that we can get further ideas about how to proceed.

An interesting result: the breakpoint was hit (rsCheckData had been corrupted to 0x00000001), but rsThreadData - the value created from the same pointer when the function was called - was NOT corrupted:

rsCheckData = 0x00000001
rsThreadData = 0x02F51F54

On the outside of the function (up the call stack one level to the place where it is called), psThreadData (still held in ESI) is valid (0x02F51F54). Thus, although it was passed in twice with the same value, the first one got corrupted on entry!

ASM for the call to WaitForRX():

508:          while (!psThreadData->bTerminate)
02CC1B75   cmp         dword ptr [esi],edi
02CC1B77   jne         CommsRXThreadProc+5Ah (02cc1b96)
509:          {
510:              dwNumBytes = WaitForRX(*psThreadData, *psThreadData, sNotifyOverlapData);
02CC1B79   lea         eax,[sNotifyOverlapData]
02CC1B7C   push        eax
02CC1B7D   push        esi
02CC1B7E   push        esi
02CC1B7F   call        WaitForRX (02cc1bac)

ASM for WaitForRX() itself:

523:  DWORD WaitForRX(COMMS_RX_THREAD_DATA_S& rsCheckData, COMMS_RX_THREAD_DATA_S& rsThreadData, OVERLAPPED& rsNotifyOverlapData)
524:  {
02CC1BAC   push        ebp
02CC1BAD   mov         ebp,esp
02CC1BAF   sub         esp,10h
525:      BOOL    bDone ;
526:      COMSTAT sStatus ;
527:      DWORD   dwEvent, dwError, dwDummy, dwNumBytes ;
528:
529:  // JDEBUG
530:  if ( (DWORD)&rsCheckData == 0x00000001)
02CC1BB2   cmp         dword ptr [rsCheckData],1
02CC1BB6   jne         WaitForRX+12h (02cc1bbe)
531:      ::DebugBreak();
02CC1BB8   call        dword ptr [EMAIL PROTECTED] (02d093d4)]

(At this point,

rsCheckData = 0x00000001
rsThreadData = 0x02F51F54

}


Does this help in any way?

--
Jason Teagle
[EMAIL PROTECTED]
 

_______________________________________________
msvc mailing list
[email protected]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for 
subscription changes, and list archive.

Reply via email to