alex 0c0abd6589 This commit was generated by cvs2svn to compensate for changes in r5942,
which included commits to RCS files with non-trunk default branches.

git-svn-id: svn://10.65.10.50/trunk@5943 c028cbd2-c16b-5b4b-a496-9718f37d4682
1998-01-15 16:39:02 +00:00

97 lines
2.0 KiB
C
Executable File

/* Aga16.dll. 16 bit side of the thunk for aga32.dll */
#ifndef APYENTRY
#define APYENTRY
#endif
#define W32SUT_16
#include <windows.h>
#include <toolhelp.h>
#include <stdio.h>
#include <malloc.h>
#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);
}