Author Topic: GoBug question  (Read 2487 times)

shankle

  • Member
  • ****
  • Posts: 835
GoBug question
« on: August 24, 2012, 04:19:27 AM »
8-23-2012

for a 32-bit program
I set a breakpoint 2 instructions before the "CreateDC in WM_CREATE.
Then I single stepped(F5) 2 times to get to the call CreateDC.
Then I hit F6 to step over the call to CreateDC.
GoBug then threw up this message: "Sorry, cannot disassemble at present".
It should have stepped over the CreatDC call as I see it.
If I start GoBug over and set a breakpoint after the call to CreatDC
and single step to the call to GlobalUnlock. Then everything seems to
work fine.

.DATA
dwNeeded      dd  0
dwReturned    dd  0
pinfo4            dd  0
PrintCString   db  96 DUP 0

WndProc:
        FRAME hWnd,uMsg,wParam,lParam
        USES ebx,edi,esi
        Local hMemory,hdc,hdcPrn
; other code

.WM_CREATE
        cmp D[uMsg],WM_CREATE
        jne >>.WM_CHAR
        push ebx
        invoke  EnumPrinters, PRINTER_ENUM_LOCAL,NULL,4,NULL,\
                  0,addr dwNeeded,addr dwReturned               
        invoke  GlobalAlloc, GHND,[dwNeeded]
       mov       [hMemory], eax
       invoke  GlobalLock, eax   
        mov       [pinfo4],eax      
       invoke  EnumPrinters, PRINTER_ENUM_LOCAL,NULL,4,addr PrintCString,\
                                [dwNeeded],addr dwNeeded,addr dwReturned
        mov ebx,addr PrintCString
        mov edx, [ebx+PRINTER_INFO_4.pPrinterName]
;        invoke  CreateDC, NULL,addr PrintCString,NULL,NULL
        invoke  CreateDC, NULL,edx,NULL,NULL
       mov       [hdcPrn],eax
       mov     [hdc],eax
        invoke  GlobalUnlock, [hMemory]   
        invoke  GlobalFree, [hMemory]      
        pop ebx
        ret
; othercode
        ENDF
   
 
 
   

wjr

  • Member
  • **
  • Posts: 209
    • WJR's website
Re: GoBug question
« Reply #1 on: August 25, 2012, 07:51:55 AM »
Some API function calls will create a new thread. When single-stepping F5 or stepping-over F6, the default action for a new thread is to single-step. If you see the screen flip for a thread change, if you click on the Traffic Light button on the toolbar, you can switch the new thread to "run in the background", then click OK to flip back to show your code instead of the system code.