/* * FinishDebugging - undo all the stuff done by InitDebugging */ void FinishDebugging( void ) { InterruptUnRegister( NULL ); if( faultInstance != NULL ) { FreeProcInstance( faultInstance ); } NotifyUnRegister( NULL ); if( notifyInstance != NULL ) { FreeProcInstance( notifyInstance ); } if( WDebug386 ) { ResetDebugInterrupts32(); DebuggerIsExecuting( -1 ); Out((OUT_INIT,"Debug interrupts reset")); FreeLibrary( wint32 ); } KillWDebug386(); // FreeProcInstance( SubClassProcInstance ); FiniDebugHook(); WasInt32 = FALSE; if( CSAlias != NULL ) { FreeSelector( CSAlias ); } CSAlias = 0; DisableHookEvents(); HookRtn = NULL; } /* FinishDebugging */
/* * MySpawn - spawn a windows app */ int MySpawn( char *cmd ) { FARPROC proc; HANDLE inst; cmd_struct cmds; char path[FILENAME_MAX]; #ifndef __WINDOWS_386__ char buffer[FILENAME_MAX]; #endif int rc; GetSpawnCommandLine( path, cmd, &cmds ); cmds.cmd[cmds.len] = 0; proc = MakeProcInstance( (FARPROC)NotifyHandler, InstanceHandle ); if( !NotifyRegister( (HANDLE)NULLHANDLE, (LPFNNOTIFYCALLBACK)proc, NF_NORMAL ) ) { FreeProcInstance( proc ); return( -1 ); } strcat( path, " " ); strcat( path, &(cmds.cmd[0]) ); inst = (HANDLE) WinExec( (LPCSTR)path, SW_SHOWNORMAL ); if( inst > (HANDLE)32 ) { union REGS in_regs, out_regs; doneExec = FALSE; #ifdef __WINDOWS_386__ moduleHandle = GetModuleHandle( PASS_WORD_AS_POINTER( inst ) ); #else GetModuleFileName( inst, buffer, FILENAME_MAX - 1 ); moduleHandle = GetModuleHandle( buffer ); #endif // waiting doesn't work under win-os2 so don't wait! in_regs.h.ah = 0x30; in_regs.h.al = 0x0; intdos( &in_regs, &out_regs ); if( out_regs.h.al == 20 ) { doneExec = TRUE; } instanceHandle = inst; EditFlags.HoldEverything = TRUE; while( !doneExec ) { MessageLoop( TRUE ); Yield(); } EditFlags.HoldEverything = FALSE; rc = 0; } else { rc = -1; } NotifyUnRegister( (HANDLE)NULLHANDLE ); FreeProcInstance( proc ); return( rc ); } /* MySpawn */