BOOL far pascal zEnumTaskWindows( HANDLE pp1, FARPROC pp2, long pp3 ) { BOOL r; SaveRegs(); /* ** Log IN Parameters (No Create/Destroy Checking Yet!) */ LogIn( (LPSTR)"APICALL:EnumTaskWindows HANDLE+FARPROC+long+", pp1, pp2, pp3 ); pp2 = (FARPROC) HookAdd( (void far *)EnumTaskWin, (void far *)pp2 ) ; /* ** Call the API! */ RestoreRegs(); GrovelDS(); r = EnumTaskWindows(pp1,pp2,pp3); UnGrovelDS(); SaveRegs(); /* ** Log Return Code & OUT Parameters (No Create/Destroy Checking Yet!) */ LogOut( (LPSTR)"APIRET:EnumTaskWindows BOOL++++", r, (short)0, (short)0, (short)0 ); RestoreRegs(); return( r ); }
static int ssl_sock_init(void) { #ifdef WATT32 extern int _watt_do_exit; _watt_do_exit = 0; if (sock_init()) return (0); #elif defined(OPENSSL_SYS_WINDOWS) if (!wsa_init_done) { int err; #ifdef SIGINT signal(SIGINT,(void (*)(int))ssl_sock_cleanup); #endif wsa_init_done=1; memset(&wsa_state,0,sizeof(wsa_state)); if (WSAStartup(0x0101,&wsa_state)!=0) { err=WSAGetLastError(); BIO_printf(bio_err,"unable to start WINSOCK, error code=%d\n",err); return(0); } #ifdef OPENSSL_SYS_WIN16 EnumTaskWindows(GetCurrentTask(),enumproc,0L); lpTopWndProc=(FARPROC)GetWindowLong(topWnd,GWL_WNDPROC); lpTopHookProc=MakeProcInstance((FARPROC)topHookProc,_hInstance); SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopHookProc); #endif /* OPENSSL_SYS_WIN16 */ } #elif defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) WORD wVerReq; WSADATA wsaData; int err; if (!wsa_init_done) { # ifdef SIGINT signal(SIGINT,(void (*)(int))sock_cleanup); # endif wsa_init_done=1; wVerReq = MAKEWORD( 2, 0 ); err = WSAStartup(wVerReq,&wsaData); if (err != 0) { BIO_printf(bio_err,"unable to start WINSOCK2, error code=%d\n",err); return(0); } } #endif /* OPENSSL_SYS_WINDOWS */ return(1); }
BOOL RestoreFocusToChild ( HWND parent, HWND avoid_this_one ) { FoundChild = 0 ; EnumTaskWindows ( GetWindowTask ( parent ), EnumProc, ( LPARAM ) avoid_this_one ) ; if ( FoundChild ) { SetActiveWindow ( FoundChild ) ; return ( TRUE ) ; } else return ( FALSE ) ; }
restart_opts DebugeeWaitForMessage( void ) { MSG msg; HANDLE huser; HWND hwnddtop; HWND capture; HWND wnd; HANDLE hinst; /* * give up any capture in context of debugee */ capture = SetCapture(NULL); if( capture != NULL ) { ReleaseCapture(); Out((OUT_SOFT,"Capture hwnd=%04x", capture )); } /* * hang out and wait */ huser = GetModuleHandle( "USER"); hwnddtop = GetDesktopWindow(); wnd = GetFocus(); if( IsTaskWnd( wnd ) ) { FocusWnd = wnd; } wnd = GetActiveWindow(); if( IsTaskWnd( wnd ) ) { ActiveWnd = wnd; } if( HardModeRequired || SystemDebugState == SDS_NOTASKQUEUE || DebuggerWindow == NULL ) { Out((OUT_SOFT,"In HardMode Loop! req=%d,SDS=%d,Window=%4.4x",HardModeRequired,SystemDebugState,DebuggerWindow )); while( DebuggerState == ACTIVE ) { DirectedYield( DebuggerTask ); } if( capture != NULL ) { SetCapture( capture ); } return( AppMessage ); } Out((OUT_SOFT,"In SoftMode Loop task=%04x(%04x), act=%04x, foc=%04x, t=%d, DW=%04x", GetCurrentTask(), DebugeeTask, ActiveWnd, FocusWnd, TraceOn, DebuggerWindow )); DefaultProcInstance = (FARPROC)MakeProcInstance( (FARPROC)DefaultProc, DebugeeInstance ); EnumTaskProcInstance = MakeProcInstance( (FARPROC)EnumTaskWindowsFunc, DebugeeInstance ); EnumChildProcInstance = MakeProcInstance( (FARPROC)EnumChildWindowsFunc, DebugeeInstance ); EnumTaskWindows( GetCurrentTask(), (WNDENUMPROC)EnumTaskProcInstance, 0 ); FreeProcInstance( EnumChildProcInstance ); FreeProcInstance( EnumTaskProcInstance ); while( 1 ) { GetMessage( &msg, NULL, 0, 0 ); if( msg.hwnd == NULL && msg.message == WM_NULL && msg.lParam == MAGIC_COOKIE ) break; if( msg.hwnd != NULL ) { hinst = (HINSTANCE)GetWindowWord( msg.hwnd, GWW_HINSTANCE ); } else { hinst = NULL; } if( msg.hwnd == hwnddtop || hinst == huser ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } else { SubClassProc( msg.hwnd, msg.message, msg.wParam, msg.lParam ); } } if( !TraceOn && DebuggerWindow != NULL ) { if( IsTaskWnd( FocusWnd ) ) { Out((OUT_SOFT,"Focus Window to %4.4x", FocusWnd )); SetFocus( FocusWnd ); } if( IsTaskWnd( ActiveWnd ) ) { Out((OUT_SOFT,"Active Window to %4.4x", ActiveWnd )); SetActiveWindow( ActiveWnd ); } } ExitSoftMode(); FreeProcInstance( DefaultProcInstance ); if( capture != NULL ) { SetCapture( capture ); } Out((OUT_SOFT,"active=%04x, focus=%04x, TraceOn=%d, DW=%04x", ActiveWnd, FocusWnd, TraceOn, DebuggerWindow )); PostAppMessage( GetCurrentTask(), WM_NULL, 0, 0L ); return( msg.wParam ); } /* DebugeeWaitForMessage */
BOOL PASCAL _Cover_EnumTaskWindows( HANDLE task, FARPROC p, LONG param ) { return( EnumTaskWindows( task, SetProc( p, GETPROC_ENUMTASKWINDOWS ), param ) ); }