/* Aga16.dll. 16 bit side of the thunk for aga32.dll */ #ifndef APYENTRY #define APYENTRY #endif #define W32SUT_16 #include #include #include #include #include "w32sut.h" #define SYNCHSPAWN 1 UT16CBPROC glpfnUT16CallBack; int FAR PASCAL LibMain (HANDLE hLibInst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine) { return (1); } DWORD FAR PASCAL UTInit (UT16CBPROC lpfnUT16CallBack, LPVOID lpBuf) { glpfnUT16CallBack = lpfnUT16CallBack; return (1); } DWORD FAR PASCAL UTProc (LPVOID lpBuf, DWORD dwFunc) { switch (dwFunc) { case SYNCHSPAWN: { WORD WM_WAKEUP = RegisterWindowMessage("WAKEUP"); UINT nCmdShow; LPCSTR lpszCmdLine; HINSTANCE inst; HTASK child = NULL; TASKENTRY te; BOOL ok; BOOL again = TRUE; BYTE i; MSG msg; lpszCmdLine = (LPSTR) ((LPDWORD)lpBuf)[0]; nCmdShow = (UINT) ((LPDWORD)lpBuf)[1]; inst = WinExec(lpszCmdLine, nCmdShow); te.dwSize = sizeof(TASKENTRY); for (ok = TaskFirst(&te); ok && child == NULL; ok = TaskNext(&te)) if (te.hInst == inst) { child = te.hTask; break; } for (i = 0; again; i++) {/* Esegue la TaskFindHandle ogni 256 cicli */ if (i == 0 && ok && TaskFindHandle(&te, child) == FALSE) break; /* Questo (utilizzato in agalight.dll) metodo non funziona in Win32s. GetMessage(&msg, (HWND)NULL, 0, 0); TranslateMessage(&msg); if (msg.message == WM_WAKEUP && msg.wParam == child) break; */ while (PeekMessage(&msg, NULL, 0,0, PM_REMOVE) && again) { if (msg.message == WM_QUIT || (msg.message == WM_WAKEUP && msg.wParam == child)) again=FALSE; TranslateMessage(&msg); DispatchMessage(&msg); } } return inst >= 32; } } return ((DWORD) -1L); } int FAR PASCAL _WEP(int bSystemExit) { return (1); }