aboutsummaryrefslogtreecommitdiffhomepage
path: root/loader
diff options
context:
space:
mode:
authorGravatar arpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-02-24 20:28:24 +0000
committerGravatar arpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-02-24 20:28:24 +0000
commitd34041569e71fc9bd772354e94dc9d16061072a5 (patch)
tree8f481cae1c70f32d1756fbe5f39000577b73042d /loader
parente95a95ece09bac96bdfd37322f96c6f57ef79ebc (diff)
Initial revision
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'loader')
-rw-r--r--loader/Makefile30
-rw-r--r--loader/afl.c763
-rw-r--r--loader/com.h66
-rw-r--r--loader/config.h74
-rw-r--r--loader/driver.c223
-rw-r--r--loader/elfdll.c305
-rw-r--r--loader/ext.c565
-rw-r--r--loader/loader.h286
-rw-r--r--loader/module.c618
-rw-r--r--loader/pe_image.c936
-rw-r--r--loader/pe_resource.c391
-rw-r--r--loader/registry.c421
-rw-r--r--loader/registry.h24
-rw-r--r--loader/resource.c478
-rw-r--r--loader/stubs.s36
-rw-r--r--loader/vfl.c330
-rw-r--r--loader/win32.c1706
-rw-r--r--loader/win32.h1
-rw-r--r--loader/wine/avifmt.h246
-rw-r--r--loader/wine/basetsd.h145
-rw-r--r--loader/wine/config.h442
-rw-r--r--loader/wine/debugtools.h93
-rw-r--r--loader/wine/driver.h112
-rw-r--r--loader/wine/elfdll.h14
-rw-r--r--loader/wine/heap.h56
-rw-r--r--loader/wine/ldt.h98
-rw-r--r--loader/wine/mmreg.h104
-rw-r--r--loader/wine/module.h198
-rw-r--r--loader/wine/msacm.h942
-rw-r--r--loader/wine/msacmdrv.h203
-rw-r--r--loader/wine/ntdef.h101
-rw-r--r--loader/wine/pe_image.h81
-rw-r--r--loader/wine/poppack.h15
-rw-r--r--loader/wine/pshpack1.h13
-rw-r--r--loader/wine/pshpack2.h12
-rw-r--r--loader/wine/pshpack4.h15
-rw-r--r--loader/wine/pshpack8.h12
-rw-r--r--loader/wine/vfw.h654
-rw-r--r--loader/wine/winbase.h1791
-rw-r--r--loader/wine/windef.h656
-rw-r--r--loader/wine/windows.h38
-rw-r--r--loader/wine/winerror.h1658
-rw-r--r--loader/wine/winestring.h13
-rw-r--r--loader/wine/winnt.h2665
-rw-r--r--loader/wine/winreg.h57
-rw-r--r--loader/wine/winuser.h2929
-rw-r--r--loader/wineacm.h55
47 files changed, 20671 insertions, 0 deletions
diff --git a/loader/Makefile b/loader/Makefile
new file mode 100644
index 0000000000..2ecc1c32fe
--- /dev/null
+++ b/loader/Makefile
@@ -0,0 +1,30 @@
+include ../config.mak
+
+# Generated automatically from Makefile.in by configure.
+DEFINES=-rdynamic -fPIC $(WIN32_PATH) $(CDOPT) -D__WINE__ -Ddbg_printf=__vprintf \
+ -DTRACE=__vprintf
+# -DDETAILED_OUT
+
+LIB_OBJECTS= pe_image.o module.o \
+ext.o win32.o driver.o pe_resource.o \
+resource.o registry.o elfdll.o afl.o vfl.o
+
+CFLAGS=-g -I.
+
+CDOPT=-g
+all: libloader.a
+
+clean:
+ -rm -f *.o libloader.a
+
+distclean: clean
+
+.c.o: $@
+ $(CC) $(CFLAGS) $(DEFINES) -c $<
+
+libloader.a: $(LIB_OBJECTS) stubs.s
+ $(CC) -c ./stubs.s -o stubs.o
+ $(AR) -r libloader.a $(LIB_OBJECTS) stubs.o
+
+dep:
+ echo "dependency not required/supported"
diff --git a/loader/afl.c b/loader/afl.c
new file mode 100644
index 0000000000..7816a3f139
--- /dev/null
+++ b/loader/afl.c
@@ -0,0 +1,763 @@
+/**************************************************************************
+
+
+ This file will contain an interface to ACM drivers.
+ Its content will be based mainly on wine/dlls/msacm32
+ actually, for audio decompression only the following functions
+ are needed:
+
+ acmStreamOpen ( takes formats of src and dest, returns stream handle )
+ acmStreamPrepareHeader ( takes stream handler and info on data )
+ acmStreamConvert ( the same as PrepareHeader )
+ acmStreamUnprepareHeader
+ acmStreamClose
+ acmStreamSize
+ maybe acmStreamReset
+
+ In future I'll also add functions for format enumeration,
+ but not right now.
+
+
+***************************************************************************/
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#include <wine/winbase.h>
+#include <wine/windef.h>
+#include <wine/winuser.h>
+#include <wine/vfw.h>
+#include <wine/winestring.h>
+#include <wine/driver.h>
+#include <wine/winerror.h>
+#include <wine/msacm.h>
+#include <wine/msacmdrv.h>
+#include "wineacm.h"
+#pragma pack(1)
+#define OpenDriverA DrvOpen
+extern HDRVR VFWAPI DrvOpen(long);
+#define CloseDriver DrvClose
+extern HDRVR VFWAPI DrvClose(long);
+
+static PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has)
+{
+ return (PWINE_ACMSTREAM)has;
+}
+
+/***********************************************************************
+ * acmDriverAddA (MSACM32.2)
+ */
+MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule,
+ LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)
+{
+ if (!phadid)
+ return MMSYSERR_INVALPARAM;
+
+ /* Check if any unknown flags */
+ if (fdwAdd &
+ ~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND|
+ ACM_DRIVERADDF_GLOBAL))
+ return MMSYSERR_INVALFLAG;
+
+ /* Check if any incompatible flags */
+ if ((fdwAdd & ACM_DRIVERADDF_FUNCTION) &&
+ (fdwAdd & ACM_DRIVERADDF_NOTIFYHWND))
+ return MMSYSERR_INVALFLAG;
+
+ /* FIXME: in fact, should GetModuleFileName(hinstModule) and do a
+ * LoadDriver on it, to be sure we can call SendDriverMessage on the
+ * hDrvr handle.
+ */
+ *phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, NULL, hinstModule);
+
+ /* FIXME: lParam, dwPriority and fdwAdd ignored */
+
+ return MMSYSERR_NOERROR;
+}
+
+/***********************************************************************
+ * acmDriverClose (MSACM32.4)
+ */
+MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose)
+{
+ PWINE_ACMDRIVER p;
+ PWINE_ACMDRIVER* tp;
+
+ if (fdwClose)
+ return MMSYSERR_INVALFLAG;
+
+ p = MSACM_GetDriver(had);
+ if (!p)
+ return MMSYSERR_INVALHANDLE;
+
+ for (tp = &(p->obj.pACMDriverID->pACMDriverList); *tp; *tp = (*tp)->pNextACMDriver) {
+ if (*tp == p) {
+ *tp = (*tp)->pNextACMDriver;
+ break;
+ }
+ }
+
+ if (p->hDrvr && !p->obj.pACMDriverID->pACMDriverList)
+ CloseDriver(p->hDrvr);
+
+ HeapFree(MSACM_hHeap, 0, p);
+
+ return MMSYSERR_NOERROR;
+}
+
+/***********************************************************************
+ * acmDriverEnum (MSACM32.7)
+ */
+MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum)
+{
+ PWINE_ACMDRIVERID p;
+ DWORD fdwSupport;
+
+ if (!fnCallback) {
+ return MMSYSERR_INVALPARAM;
+ }
+
+ if (fdwEnum && ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED)) {
+ return MMSYSERR_INVALFLAG;
+ }
+
+ for (p = MSACM_pFirstACMDriverID; p; p = p->pNextACMDriverID) {
+ fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
+ if (!p->bEnabled) {
+ if (fdwEnum & ACM_DRIVERENUMF_DISABLED)
+ fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED;
+ else
+ continue;
+ }
+ (*fnCallback)((HACMDRIVERID) p, dwInstance, fdwSupport);
+ }
+
+ return MMSYSERR_NOERROR;
+}
+
+/***********************************************************************
+ * acmDriverID (MSACM32.8)
+ */
+MMRESULT WINAPI acmDriverID(HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID)
+{
+ PWINE_ACMOBJ pao;
+
+ pao = MSACM_GetObj(hao);
+ if (!pao)
+ return MMSYSERR_INVALHANDLE;
+
+ if (!phadid)
+ return MMSYSERR_INVALPARAM;
+
+ if (fdwDriverID)
+ return MMSYSERR_INVALFLAG;
+
+ *phadid = (HACMDRIVERID) pao->pACMDriverID;
+
+ return MMSYSERR_NOERROR;
+}
+
+/***********************************************************************
+ * acmDriverMessage (MSACM32.9)
+ * FIXME
+ * Not implemented
+ */
+LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
+{
+ PWINE_ACMDRIVER pad = MSACM_GetDriver(had);
+ if (!pad)
+ return MMSYSERR_INVALPARAM;
+
+ /* FIXME: Check if uMsg legal */
+
+ if (!SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2))
+ return MMSYSERR_NOTSUPPORTED;
+
+ return MMSYSERR_NOERROR;
+}
+
+
+/***********************************************************************
+ * acmDriverOpen (MSACM32.10)
+ */
+MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen)
+{
+ PWINE_ACMDRIVERID padid;
+ PWINE_ACMDRIVER pad;
+ ICOPEN icopen;
+ HDRVR hdrv;
+
+
+
+ TRACE("(%p, %x, %08lu)\n", phad, hadid, fdwOpen);
+
+ if (!phad)
+ return MMSYSERR_INVALPARAM;
+
+ padid = MSACM_GetDriverID(hadid);
+ if (!padid)
+ return MMSYSERR_INVALHANDLE;
+
+ if (fdwOpen)
+ return MMSYSERR_INVALFLAG;
+
+ pad = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER));
+ if (!pad) return MMSYSERR_NOMEM;
+
+ pad->obj.pACMDriverID = padid;
+ icopen.fccType = mmioFOURCC('a', 'u', 'd', 'c');
+ icopen.fccHandler = (long)padid->pszFileName;
+ icopen.dwSize = sizeof(ICOPEN);
+ icopen.dwFlags = 0;
+
+ if (!padid->hInstModule)
+ pad->hDrvr = OpenDriverA((long)&icopen);
+ else
+ pad->hDrvr = padid->hInstModule;
+
+ if (!pad->hDrvr) {
+ HeapFree(MSACM_hHeap, 0, pad);
+ return MMSYSERR_ERROR;
+ }
+
+ pad->pfnDriverProc = GetProcAddress(pad->hDrvr, "DriverProc");
+
+ /* insert new pad at beg of list */
+ pad->pNextACMDriver = padid->pACMDriverList;
+ padid->pACMDriverList = pad;
+
+ /* FIXME: Create a WINE_ACMDRIVER32 */
+ *phad = (HACMDRIVER)pad;
+
+ return MMSYSERR_NOERROR;
+}
+
+/***********************************************************************
+ * acmDriverRemove (MSACM32.12)
+ */
+MMRESULT WINAPI acmDriverRemove(HACMDRIVERID hadid, DWORD fdwRemove)
+{
+ PWINE_ACMDRIVERID padid;
+
+ padid = MSACM_GetDriverID(hadid);
+ if (!padid)
+ return MMSYSERR_INVALHANDLE;
+
+ if (fdwRemove)
+ return MMSYSERR_INVALFLAG;
+
+ MSACM_UnregisterDriver(padid);
+
+ return MMSYSERR_NOERROR;
+}
+
+
+
+/**********************************************************************/
+
+HANDLE MSACM_hHeap = (HANDLE) NULL;
+PWINE_ACMDRIVERID MSACM_pFirstACMDriverID = NULL;
+PWINE_ACMDRIVERID MSACM_pLastACMDriverID = NULL;
+
+/***********************************************************************
+ * MSACM_RegisterDriver32()
+ */
+PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName,
+ HINSTANCE hinstModule)
+//
+// File names are stored in driver.c. I reuse this variable to store driver ID
+// in it. If it's <0x10000, it is primary codec for corresponding format.
+//
+{
+ PWINE_ACMDRIVERID padid;
+
+ TRACE("('%s', '%x', 0x%08x)\n", pszDriverAlias, pszFileName, hinstModule);
+
+ padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
+ padid->pszDriverAlias = (char*)malloc(strlen(pszDriverAlias)+1);
+ strcpy(padid->pszDriverAlias, pszDriverAlias);
+// 1~strdup(pszDriverAlias);
+ padid->pszFileName = pszFileName;
+ padid->hInstModule = hinstModule;
+ padid->bEnabled = TRUE;
+ padid->pACMDriverList = NULL;
+ padid->pNextACMDriverID = NULL;
+ padid->pPrevACMDriverID = MSACM_pLastACMDriverID;
+ if (MSACM_pLastACMDriverID)
+ MSACM_pLastACMDriverID->pNextACMDriverID = padid;
+ MSACM_pLastACMDriverID = padid;
+ if (!MSACM_pFirstACMDriverID)
+ MSACM_pFirstACMDriverID = padid;
+
+ return padid;
+}
+
+/***********************************************************************
+ * MSACM_RegisterAllDrivers32()
+ */
+void MSACM_RegisterAllDrivers(void)
+{
+ LPSTR pszBuffer;
+ DWORD dwBufferLength;
+
+ if (MSACM_pFirstACMDriverID)
+ return;
+
+ MSACM_RegisterDriver("divxa32", (LPSTR)0x161, 0); // DivX/WMA [07]
+ MSACM_RegisterDriver("msadp32", (LPSTR)0x2, 0); // MS ADPCM [08]
+ MSACM_RegisterDriver("l3codeca", (LPSTR)0x55, 0); // MPEG Layer-3 [12]
+// MSACM_RegisterDriver("imaadp32", (LPSTR)0x11, 0); // IMA ADPCM [13]
+// MSACM_RegisterDriver("msgsm32", (LPSTR)0x32, 0); // MS GSM 6.10 [14]
+}
+
+/***********************************************************************
+ * MSACM_UnregisterDriver32()
+ */
+PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
+{
+ PWINE_ACMDRIVERID pNextACMDriverID;
+
+ while (p->pACMDriverList)
+ acmDriverClose((HACMDRIVER) p->pACMDriverList, 0);
+
+ if (p->pszDriverAlias)
+ HeapFree(MSACM_hHeap, 0, p->pszDriverAlias);
+// if (p->pszFileName)
+// HeapFree(MSACM_hHeap, 0, p->pszFileName);
+
+ if (p == MSACM_pFirstACMDriverID)
+ MSACM_pFirstACMDriverID = p->pNextACMDriverID;
+ if (p == MSACM_pLastACMDriverID)
+ MSACM_pLastACMDriverID = p->pPrevACMDriverID;
+
+ if (p->pPrevACMDriverID)
+ p->pPrevACMDriverID->pNextACMDriverID = p->pNextACMDriverID;
+ if (p->pNextACMDriverID)
+ p->pNextACMDriverID->pPrevACMDriverID = p->pPrevACMDriverID;
+
+ pNextACMDriverID = p->pNextACMDriverID;
+
+ HeapFree(MSACM_hHeap, 0, p);
+
+ return pNextACMDriverID;
+}
+
+/***********************************************************************
+ * MSACM_UnregisterAllDrivers32()
+ * FIXME
+ * Where should this function be called?
+ */
+void MSACM_UnregisterAllDrivers(void)
+{
+ PWINE_ACMDRIVERID p;
+
+ for (p = MSACM_pFirstACMDriverID; p; p = MSACM_UnregisterDriver(p));
+}
+
+/***********************************************************************
+ * MSACM_GetDriverID32()
+ */
+PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID)
+{
+ return (PWINE_ACMDRIVERID)hDriverID;
+}
+
+/***********************************************************************
+ * MSACM_GetDriver32()
+ */
+PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver)
+{
+ return (PWINE_ACMDRIVER)hDriver;
+}
+
+/***********************************************************************
+ * MSACM_GetObj32()
+ */
+PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj)
+{
+ return (PWINE_ACMOBJ)hObj;
+}
+
+
+
+/***********************************************************************
+ * acmStreamOpen (MSACM32.40)
+ */
+MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
+ PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback,
+ DWORD dwInstance, DWORD fdwOpen)
+{
+ PWINE_ACMSTREAM was;
+ PWINE_ACMDRIVER wad;
+ MMRESULT ret;
+ int wfxSrcSize;
+ int wfxDstSize;
+
+ TRACE("(%p, 0x%08x, %p, %p, %p, %ld, %ld, %ld)\n",
+ phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen);
+
+ TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n",
+ pwfxSrc->wFormatTag, pwfxSrc->nChannels, pwfxSrc->nSamplesPerSec, pwfxSrc->nAvgBytesPerSec,
+ pwfxSrc->nBlockAlign, pwfxSrc->wBitsPerSample, pwfxSrc->cbSize);
+
+ TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n",
+ pwfxDst->wFormatTag, pwfxDst->nChannels, pwfxDst->nSamplesPerSec, pwfxDst->nAvgBytesPerSec,
+ pwfxDst->nBlockAlign, pwfxDst->wBitsPerSample, pwfxDst->cbSize);
+
+#define SIZEOF_WFX(wfx) (sizeof(WAVEFORMATEX) + ((wfx->wFormatTag == WAVE_FORMAT_PCM) ? 0 : wfx->cbSize))
+ wfxSrcSize = SIZEOF_WFX(pwfxSrc);
+ wfxDstSize = SIZEOF_WFX(pwfxDst);
+#undef SIZEOF_WFX
+
+ was = HeapAlloc(MSACM_hHeap, 0, sizeof(*was) + wfxSrcSize + wfxDstSize + ((pwfltr) ? sizeof(WAVEFILTER) : 0));
+ if (was == NULL)
+ return MMSYSERR_NOMEM;
+
+ was->drvInst.cbStruct = sizeof(was->drvInst);
+ was->drvInst.pwfxSrc = (PWAVEFORMATEX)((LPSTR)was + sizeof(*was));
+ memcpy(was->drvInst.pwfxSrc, pwfxSrc, wfxSrcSize);
+ was->drvInst.pwfxDst = (PWAVEFORMATEX)((LPSTR)was + sizeof(*was) + wfxSrcSize);
+ memcpy(was->drvInst.pwfxDst, pwfxDst, wfxDstSize);
+ if (pwfltr) {
+ was->drvInst.pwfltr = (PWAVEFILTER)((LPSTR)was + sizeof(*was) + wfxSrcSize + wfxDstSize);
+ memcpy(was->drvInst.pwfltr, pwfltr, sizeof(WAVEFILTER));
+ } else {
+ was->drvInst.pwfltr = NULL;
+ }
+ was->drvInst.dwCallback = dwCallback;
+ was->drvInst.dwInstance = dwInstance;
+ was->drvInst.fdwOpen = fdwOpen;
+ was->drvInst.fdwDriver = 0L;
+ was->drvInst.dwDriver = 0L;
+ was->drvInst.has = (HACMSTREAM)was;
+
+ if (had) {
+ if (!(wad = MSACM_GetDriver(had))) {
+ ret = MMSYSERR_INVALPARAM;
+ goto errCleanUp;
+ }
+
+ was->obj.pACMDriverID = wad->obj.pACMDriverID;
+ was->pDrv = wad;
+ was->hAcmDriver = 0; /* not to close it in acmStreamClose */
+
+ ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);
+ if (ret != MMSYSERR_NOERROR)
+ goto errCleanUp;
+ } else {
+ PWINE_ACMDRIVERID wadi;
+ short drv_tag;
+ ret = ACMERR_NOTPOSSIBLE;
+/* if(pwfxSrc->wFormatTag==1)//compression
+ drv_tag=pwfxDst->wFormatTag;
+ else
+ if(pwfxDst->wFormatTag==1)//decompression
+ drv_tag=pwfxSrc->wFormatTag;
+ else
+ goto errCleanUp;
+
+ ret=acmDriverOpen2(drv_tag);
+ if (ret == MMSYSERR_NOERROR) {
+ if ((wad = MSACM_GetDriver(had)) != 0) {
+ was->obj.pACMDriverID = wad->obj.pACMDriverID;
+ was->pDrv = wad;
+ was->hAcmDriver = had;
+
+ ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);
+ if (ret == MMSYSERR_NOERROR) {
+ if (fdwOpen & ACM_STREAMOPENF_QUERY) {
+ acmDriverClose(had, 0L);
+ }
+ break;
+ }
+ }
+ acmDriverClose(had, 0L);*/
+ if(MSACM_pFirstACMDriverID==NULL)
+ MSACM_RegisterAllDrivers();
+
+ for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID) {
+ ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L);
+ if (ret == MMSYSERR_NOERROR) {
+ if ((wad = MSACM_GetDriver(had)) != 0) {
+ was->obj.pACMDriverID = wad->obj.pACMDriverID;
+ was->pDrv = wad;
+ was->hAcmDriver = had;
+
+ ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);
+ if (ret == MMSYSERR_NOERROR) {
+ if (fdwOpen & ACM_STREAMOPENF_QUERY) {
+ acmDriverClose(had, 0L);
+ }
+ break;
+ }
+ }
+ // no match, close this acm driver and try next one
+ acmDriverClose(had, 0L);
+ }
+ }
+ if (ret != MMSYSERR_NOERROR) {
+ ret = ACMERR_NOTPOSSIBLE;
+ goto errCleanUp;
+ }
+ }
+ ret = MMSYSERR_NOERROR;
+ if (!(fdwOpen & ACM_STREAMOPENF_QUERY)) {
+ if (phas)
+ *phas = (HACMSTREAM)was;
+ TRACE("=> (%d)\n", ret);
+ return ret;
+ }
+errCleanUp:
+ if (phas)
+ *phas = (HACMSTREAM)0;
+ HeapFree(MSACM_hHeap, 0, was);
+ TRACE("=> (%d)\n", ret);
+ return ret;
+}
+
+
+MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose)
+{
+ PWINE_ACMSTREAM was;
+ MMRESULT ret;
+
+ TRACE("(0x%08x, %ld)\n", has, fdwClose);
+
+ if ((was = ACM_GetStream(has)) == NULL) {
+ return MMSYSERR_INVALHANDLE;
+ }
+ ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CLOSE, (DWORD)&was->drvInst, 0);
+ if (ret == MMSYSERR_NOERROR) {
+ if (was->hAcmDriver)
+ acmDriverClose(was->hAcmDriver, 0L);
+ HeapFree(MSACM_hHeap, 0, was);
+ }
+ TRACE("=> (%d)\n", ret);
+ return ret;
+}
+
+/***********************************************************************
+ * acmStreamConvert (MSACM32.38)
+ */
+MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash,
+ DWORD fdwConvert)
+{
+ PWINE_ACMSTREAM was;
+ MMRESULT ret = MMSYSERR_NOERROR;
+ PACMDRVSTREAMHEADER padsh;
+
+ TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwConvert);
+
+ if ((was = ACM_GetStream(has)) == NULL)
+ return MMSYSERR_INVALHANDLE;
+ if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER))
+ return MMSYSERR_INVALPARAM;
+
+ if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED))
+ return ACMERR_UNPREPARED;
+
+ /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same
+ * size. some fields are private to msacm internals, and are exposed
+ * in ACMSTREAMHEADER in the dwReservedDriver array
+ */
+ padsh = (PACMDRVSTREAMHEADER)pash;
+
+ /* check that pointers have not been modified */
+ if (padsh->pbPreparedSrc != padsh->pbSrc ||
+ padsh->cbPreparedSrcLength < padsh->cbSrcLength ||
+ padsh->pbPreparedDst != padsh->pbDst ||
+ padsh->cbPreparedDstLength < padsh->cbDstLength) {
+ return MMSYSERR_INVALPARAM;
+ }
+
+ padsh->fdwConvert = fdwConvert;
+
+ ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CONVERT, (DWORD)&was->drvInst, (DWORD)padsh);
+ if (ret == MMSYSERR_NOERROR) {
+ padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_DONE;
+ }
+ TRACE("=> (%d)\n", ret);
+ return ret;
+}
+
+
+/***********************************************************************
+ * acmStreamPrepareHeader (MSACM32.41)
+ */
+MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash,
+ DWORD fdwPrepare)
+{
+ PWINE_ACMSTREAM was;
+ MMRESULT ret = MMSYSERR_NOERROR;
+ PACMDRVSTREAMHEADER padsh;
+
+ TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwPrepare);
+
+ if ((was = ACM_GetStream(has)) == NULL)
+ return MMSYSERR_INVALHANDLE;
+ if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER))
+ return MMSYSERR_INVALPARAM;
+ if (fdwPrepare)
+ ret = MMSYSERR_INVALFLAG;
+
+ if (pash->fdwStatus & ACMSTREAMHEADER_STATUSF_DONE)
+ return MMSYSERR_NOERROR;
+
+ /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same
+ * size. some fields are private to msacm internals, and are exposed
+ * in ACMSTREAMHEADER in the dwReservedDriver array
+ */
+ padsh = (PACMDRVSTREAMHEADER)pash;
+
+ padsh->fdwConvert = fdwPrepare;
+ padsh->padshNext = NULL;
+ padsh->fdwDriver = padsh->dwDriver = 0L;
+
+ padsh->fdwPrepared = 0;
+ padsh->dwPrepared = 0;
+ padsh->pbPreparedSrc = 0;
+ padsh->cbPreparedSrcLength = 0;
+ padsh->pbPreparedDst = 0;
+ padsh->cbPreparedDstLength = 0;
+
+ ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_PREPARE, (DWORD)&was->drvInst, (DWORD)padsh);
+ if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) {
+ ret = MMSYSERR_NOERROR;
+ padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE);
+ padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_PREPARED;
+ padsh->fdwPrepared = padsh->fdwStatus;
+ padsh->dwPrepared = 0;
+ padsh->pbPreparedSrc = padsh->pbSrc;
+ padsh->cbPreparedSrcLength = padsh->cbSrcLength;
+ padsh->pbPreparedDst = padsh->pbDst;
+ padsh->cbPreparedDstLength = padsh->cbDstLength;
+ } else {
+ padsh->fdwPrepared = 0;
+ padsh->dwPrepared = 0;
+ padsh->pbPreparedSrc = 0;
+ padsh->cbPreparedSrcLength = 0;
+ padsh->pbPreparedDst = 0;
+ padsh->cbPreparedDstLength = 0;
+ }
+ TRACE("=> (%d)\n", ret);
+ return ret;
+}
+
+/***********************************************************************
+ * acmStreamReset (MSACM32.42)
+ */
+MMRESULT WINAPI acmStreamReset(HACMSTREAM has, DWORD fdwReset)
+{
+ PWINE_ACMSTREAM was;
+ MMRESULT ret = MMSYSERR_NOERROR;
+
+ TRACE("(0x%08x, %ld)\n", has, fdwReset);
+
+ if (fdwReset) {
+ ret = MMSYSERR_INVALFLAG;
+ } else if ((was = ACM_GetStream(has)) == NULL) {
+ return MMSYSERR_INVALHANDLE;
+ } else if (was->drvInst.fdwOpen & ACM_STREAMOPENF_ASYNC) {
+ ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_RESET, (DWORD)&was->drvInst, 0);
+ }
+ TRACE("=> (%d)\n", ret);
+ return ret;
+}
+
+/***********************************************************************
+ * acmStreamSize (MSACM32.43)
+ */
+MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput,
+ LPDWORD pdwOutputBytes, DWORD fdwSize)
+{
+ PWINE_ACMSTREAM was;
+ ACMDRVSTREAMSIZE adss;
+ MMRESULT ret;
+
+ TRACE("(0x%08x, %ld, %p, %ld)\n", has, cbInput, pdwOutputBytes, fdwSize);
+
+ if ((was = ACM_GetStream(has)) == NULL) {
+ return MMSYSERR_INVALHANDLE;
+ }
+ if ((fdwSize & ~ACM_STREAMSIZEF_QUERYMASK) != 0) {
+ return MMSYSERR_INVALFLAG;
+ }
+
+ *pdwOutputBytes = 0L;
+
+ switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) {
+ case ACM_STREAMSIZEF_DESTINATION:
+ adss.cbDstLength = cbInput;
+ adss.cbSrcLength = 0;
+ break;
+ case ACM_STREAMSIZEF_SOURCE:
+ adss.cbSrcLength = cbInput;
+ adss.cbDstLength = 0;
+ break;
+ default:
+ return MMSYSERR_INVALFLAG;
+ }
+
+ adss.cbStruct = sizeof(adss);
+ adss.fdwSize = fdwSize;
+ ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_SIZE,
+ (DWORD)&was->drvInst, (DWORD)&adss);
+ if (ret == MMSYSERR_NOERROR) {
+ switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) {
+ case ACM_STREAMSIZEF_DESTINATION:
+ *pdwOutputBytes = adss.cbSrcLength;
+ break;
+ case ACM_STREAMSIZEF_SOURCE:
+ *pdwOutputBytes = adss.cbDstLength;
+ break;
+ }
+ }
+ TRACE("=> (%d) [%lu]\n", ret, *pdwOutputBytes);
+ return ret;
+}
+
+/***********************************************************************
+ * acmStreamUnprepareHeader (MSACM32.44)
+ */
+MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash,
+ DWORD fdwUnprepare)
+{
+ PWINE_ACMSTREAM was;
+ MMRESULT ret = MMSYSERR_NOERROR;
+ PACMDRVSTREAMHEADER padsh;
+
+ TRACE("(0x%08x, %p, %ld)\n", has, pash, fdwUnprepare);
+
+ if ((was = ACM_GetStream(has)) == NULL)
+ return MMSYSERR_INVALHANDLE;
+ if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER))
+ return MMSYSERR_INVALPARAM;
+
+ if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED))
+ return ACMERR_UNPREPARED;
+
+ /* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same
+ * size. some fields are private to msacm internals, and are exposed
+ * in ACMSTREAMHEADER in the dwReservedDriver array
+ */
+ padsh = (PACMDRVSTREAMHEADER)pash;
+
+ /* check that pointers have not been modified */
+ if (padsh->pbPreparedSrc != padsh->pbSrc ||
+ padsh->cbPreparedSrcLength < padsh->cbSrcLength ||
+ padsh->pbPreparedDst != padsh->pbDst ||
+ padsh->cbPreparedDstLength < padsh->cbDstLength) {
+ return MMSYSERR_INVALPARAM;
+ }
+
+ padsh->fdwConvert = fdwUnprepare;
+
+ ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_UNPREPARE, (DWORD)&was->drvInst, (DWORD)padsh);
+ if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) {
+ ret = MMSYSERR_NOERROR;
+ padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE|ACMSTREAMHEADER_STATUSF_PREPARED);
+ }
+ TRACE("=> (%d)\n", ret);
+ return ret;
+}
diff --git a/loader/com.h b/loader/com.h
new file mode 100644
index 0000000000..fe229cb579
--- /dev/null
+++ b/loader/com.h
@@ -0,0 +1,66 @@
+/**
+ * Internal functions and structures for COM emulation code.
+ */
+
+#ifndef COM_H
+#define COM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void* CoTaskMemAlloc(unsigned long cb);
+void CoTaskMemFree(void* cb);
+
+typedef struct
+{
+ long f1;
+ short f2;
+ short f3;
+ char f4[8];
+} GUID;
+
+extern GUID IID_IUnknown;
+extern GUID IID_IClassFactory;
+
+typedef long (*GETCLASSOBJECT) (GUID* clsid, GUID* iid, void** ppv);
+int RegisterComClass(GUID* clsid, GETCLASSOBJECT gcs);
+
+#ifndef STDCALL
+#define STDCALL __attribute__((__stdcall__))
+#endif
+
+struct IUnknown;
+struct IClassFactory;
+struct IUnknown_vt
+{
+ long STDCALL (*QueryInterface)(struct IUnknown* _this, GUID* iid, void** ppv);
+ long STDCALL (*AddRef)(struct IUnknown* _this) ;
+ long STDCALL (*Release)(struct IUnknown* _this) ;
+} ;
+struct IUnknown
+{
+ struct IUnknown_vt* vt;
+};
+
+struct IClassFactory_vt
+{
+ long STDCALL (*QueryInterface)(struct IUnknown* _this, GUID* iid, void** ppv);
+ long STDCALL (*AddRef)(struct IUnknown* _this) ;
+ long STDCALL (*Release)(struct IUnknown* _this) ;
+ long STDCALL (*CreateInstance)(struct IClassFactory* _this, struct IUnknown* pUnkOuter, GUID* riid, void** ppvObject);
+};
+
+struct IClassFactory
+{
+ struct IClassFactory_vt* vt;
+};
+
+long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
+ long dwClsContext, GUID* riid, void** ppv);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif \ No newline at end of file
diff --git a/loader/config.h b/loader/config.h
new file mode 100644
index 0000000000..15ff49d602
--- /dev/null
+++ b/loader/config.h
@@ -0,0 +1,74 @@
+
+/* include/config.h. Generated automatically by configure. */
+/* include/config.h.in. Generated automatically from configure.in by autoheader. */
+#define USE_SDL 1
+/* #undef QUIET */
+/* #undef TIMING */
+/* #undef DETAILED_OUT */
+#define MMX 1
+#define HAVE_LIBXXF86DGA 1
+#define HAVE_LIBXXF86VM 1
+#define USE_TSC 1
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define if you don't have vprintf but do have _doprnt. */
+/* #undef HAVE_DOPRNT */
+
+/* Define if you have a working `mmap' system call. */
+#define HAVE_MMAP 1
+
+/* Define if you have the vprintf function. */
+#define HAVE_VPRINTF 1
+
+/* Define as __inline if that's what the C compiler calls it. */
+/* #undef inline */
+
+/* Define as the return type of signal handlers (int or void). */
+#define RETSIGTYPE void
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define if you have the ftime function. */
+#define HAVE_FTIME 1
+
+/* Define if you have the getpagesize function. */
+#define HAVE_GETPAGESIZE 1
+
+/* Define if you have the gettimeofday function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define if you have the strdup function. */
+#define HAVE_STRDUP 1
+
+/* Define if you have the strstr function. */
+#define HAVE_STRSTR 1
+
+/* Define if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define if you have the <malloc.h> header file. */
+#define HAVE_MALLOC_H 1
+
+/* Define if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have the dl library (-ldl). */
+#define HAVE_LIBDL 1
+
+/* Define if you have the jpeg library (-ljpeg). */
+#define HAVE_LIBJPEG 1
diff --git a/loader/driver.c b/loader/driver.c
new file mode 100644
index 0000000000..d682bd295c
--- /dev/null
+++ b/loader/driver.c
@@ -0,0 +1,223 @@
+#include <config.h>
+#include <stdio.h>
+
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#else
+#include <stdlib.h>
+#endif
+
+#include <wine/driver.h>
+#include <wine/pe_image.h>
+#include <wine/winreg.h>
+#include <wine/vfw.h>
+#include <registry.h>
+
+//#include "com.h"
+//typedef long STDCALL (*GETCLASS) (GUID*, GUID*, void**);
+
+
+#ifdef __FreeBSD__
+#include <sys/time.h>
+#endif
+
+
+#define STORE_ALL \
+ __asm__ ( \
+ "push %%ebx\n\t" \
+ "push %%ecx\n\t" \
+ "push %%edx\n\t" \
+ "push %%esi\n\t" \
+ "push %%edi\n\t"::)
+
+#define REST_ALL \
+ __asm__ ( \
+ "pop %%edi\n\t" \
+ "pop %%esi\n\t" \
+ "pop %%edx\n\t" \
+ "pop %%ecx\n\t" \
+ "pop %%ebx\n\t"::)
+
+
+
+typedef struct {
+ UINT uDriverSignature;
+ HINSTANCE hDriverModule;
+ DRIVERPROC DriverProc;
+ DWORD dwDriverID;
+} DRVR;
+
+typedef DRVR *PDRVR;
+typedef DRVR *NPDRVR;
+typedef DRVR *LPDRVR;
+
+static DWORD dwDrvID = 0;
+
+
+LRESULT WINAPI SendDriverMessage( HDRVR hDriver, UINT message,
+ LPARAM lParam1, LPARAM lParam2 )
+{
+ DRVR* module=(DRVR*)hDriver;
+ int result;
+#ifdef DETAILED_OUT
+ printf("SendDriverMessage: driver %X, message %X, arg1 %X, arg2 %X\n", hDriver, message, lParam1, lParam2);
+#endif
+ if(module==0)return -1;
+ if(module->hDriverModule==0)return -1;
+ if(module->DriverProc==0)return -1;
+ STORE_ALL;
+ result=module->DriverProc(module->dwDriverID,1,message,lParam1,lParam2);
+ REST_ALL;
+#ifdef DETAILED_OUT
+ printf("\t\tResult: %X\n", result);
+#endif
+ return result;
+}
+
+static NPDRVR DrvAlloc(HDRVR*lpDriver, LPUINT lpDrvResult)
+{
+ NPDRVR npDriver;
+ /* allocate and lock handle */
+ if (lpDriver)
+ {
+ if ( (*lpDriver = (HDRVR) malloc(sizeof(DRVR))) )
+ {
+ if ((npDriver = (NPDRVR) *lpDriver))
+ {
+ *lpDrvResult = MMSYSERR_NOERROR;
+ return (npDriver);
+ }
+ free((NPDRVR)*lpDriver);
+ }
+ return (*lpDrvResult = MMSYSERR_NOMEM, (NPDRVR) 0);
+ }
+ return (*lpDrvResult = MMSYSERR_INVALPARAM, (NPDRVR) 0);
+}
+
+
+static void DrvFree(HDRVR hDriver)
+{
+ int i;
+ if(hDriver)
+ if(((DRVR*)hDriver)->hDriverModule)
+ if(((DRVR*)hDriver)->DriverProc)
+ (((DRVR*)hDriver)->DriverProc)(((DRVR*)hDriver)->dwDriverID, hDriver, DRV_CLOSE, 0, 0);
+ if(hDriver) {
+ if(((DRVR*)hDriver)->hDriverModule)
+ if(((DRVR*)hDriver)->DriverProc)
+ (((DRVR*)hDriver)->DriverProc)(0, hDriver, DRV_FREE, 0, 0);
+ FreeLibrary(((DRVR*)hDriver)->hDriverModule);
+ free((NPDRVR)hDriver);
+ return;
+ }
+}
+
+void DrvClose(HDRVR hdrvr)
+{
+ DrvFree(hdrvr);
+}
+
+
+char* def_path=WIN32_PATH; // path to codecs
+char* win32_codec_name=NULL; // must be set before calling DrvOpen() !!!
+
+HDRVR
+DrvOpen(LPARAM lParam2)
+{
+ ICOPEN *icopen=(ICOPEN *) lParam2;
+ UINT uDrvResult;
+ HDRVR hDriver;
+ NPDRVR npDriver;
+ char unknown[0x24];
+// char* codec_name=icopen->fccHandler;
+
+ if (!(npDriver = DrvAlloc(&hDriver, &uDrvResult)))
+ return ((HDRVR) 0);
+
+ if (!(npDriver->hDriverModule = expLoadLibraryA(win32_codec_name))) {
+ printf("Can't open library %s\n", win32_codec_name);
+ DrvFree(hDriver);
+ return ((HDRVR) 0);
+ }
+
+#if 0
+ {
+ unsigned char *p=((char*)npDriver->hDriverModule);
+ double *dp;
+ int i;
+ p+=0x14c0;
+ for(i=0;i<16;i++)printf(" %02X",p[i]); printf("\n");
+ dp=(double*)p;
+ printf("divx bitrate = %f\n",(float)(*dp));
+// *(double*)((char*)npDriver->hDriverModule+0x14c0)=bitrate;
+ }
+#endif
+
+ if (!(npDriver->DriverProc = (DRIVERPROC)
+ GetProcAddress(npDriver->hDriverModule, "DriverProc"))) {
+#if 1
+ printf("Library %s is not a VfW/ACM valid codec\n", win32_codec_name);
+#else
+ // Try DirectShow...
+ GETCLASS func=(GETCLASS)GetProcAddress(npDriver->hDriverModule,"DllGetClassObject");
+ if(!func)
+ printf("Library %s is not a valid VfW/ACM/DShow codec\n", win32_codec_name);
+ else {
+ HRESULT result;
+ struct IClassFactory* factory=0;
+ struct IUnknown* object=0;
+ GUID CLSID_Voxware={0x73f7a062, 0x8829, 0x11d1,
+ {0xb5, 0x50, 0x00, 0x60, 0x97, 0x24, 0x2d, 0x8d}};
+ GUID* id=&CLSID_Voxware;
+
+ result=func(id, &IID_IClassFactory, (void**)&factory);
+ if(result || (!factory)) printf("No such class object\n");
+
+ printf("Calling factory->vt->CreateInstance()\n");
+ printf("addr = %X\n",(unsigned int)factory->vt->CreateInstance);
+ result=factory->vt->CreateInstance(factory, 0, &IID_IUnknown, (void**)&object);
+ printf("Calling factory->vt->Release()\n");
+ factory->vt->Release((struct IUnknown*)factory);
+ if(result || (!object)) printf("Class factory failure\n");
+
+ printf("DirectShow codecs not yet supported...\n");
+ }
+#endif
+
+ FreeLibrary(npDriver->hDriverModule);
+ DrvFree(hDriver);
+ return ((HDRVR) 0);
+
+ }
+
+ //TRACE("DriverProc == %X\n", npDriver->DriverProc);
+ npDriver->dwDriverID = ++dwDrvID;
+
+ STORE_ALL;
+ (npDriver->DriverProc)(0, hDriver, DRV_LOAD, 0, 0);
+ REST_ALL;
+ //TRACE("DRV_LOAD Ok!\n");
+ STORE_ALL;
+ (npDriver->DriverProc)(0, hDriver, DRV_ENABLE, 0, 0);
+ REST_ALL;
+ //TRACE("DRV_ENABLE Ok!\n");
+
+ // open driver
+ STORE_ALL;
+ npDriver->dwDriverID=(npDriver->DriverProc)(npDriver->dwDriverID, hDriver, DRV_OPEN,
+ (LPARAM) (LPSTR) unknown, lParam2);
+ REST_ALL;
+
+ //TRACE("DRV_OPEN Ok!(%X)\n", npDriver->dwDriverID);
+
+ if (uDrvResult)
+ {
+ DrvFree(hDriver);
+ hDriver = (HDRVR) 0;
+ }
+
+ printf("Successfully loaded codec %s\n",win32_codec_name);
+
+ return (hDriver);
+}
+
diff --git a/loader/elfdll.c b/loader/elfdll.c
new file mode 100644
index 0000000000..b4cf623995
--- /dev/null
+++ b/loader/elfdll.c
@@ -0,0 +1,305 @@
+/*
+ * Elf-dll loader functions
+ *
+ * Copyright 1999 Bertho A. Stultiens
+ */
+#include <config.h>
+
+#ifdef HAVE_LIBDL
+
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+
+#include <wine/config.h>
+#include <wine/windef.h>
+//#include <wine/global.h>
+//#include <wine/process.h>
+#include <wine/module.h>
+#include <wine/heap.h>
+#include <wine/elfdll.h>
+#include <wine/debugtools.h>
+#include <wine/winerror.h>
+
+//DEFAULT_DEBUG_CHANNEL(elfdll)
+
+#include <dlfcn.h>
+
+struct modref_list_t;
+
+typedef struct modref_list_t
+{
+ WINE_MODREF* wm;
+ struct modref_list_t *next;
+ struct modref_list_t *prev;
+}
+modref_list;
+
+
+//WINE_MODREF *local_wm=NULL;
+extern modref_list* local_wm;
+
+
+/*------------------ HACKS -----------------*/
+extern DWORD fixup_imports(WINE_MODREF *wm);
+extern void dump_exports(HMODULE hModule);
+/*---------------- END HACKS ---------------*/
+
+//char *extra_ld_library_path = "/usr/lib/win32";
+extern char* def_path;
+
+struct elfdll_image
+{
+ HMODULE pe_module_start;
+ DWORD pe_module_size;
+};
+
+
+/****************************************************************************
+ * ELFDLL_dlopen
+ *
+ * Wrapper for dlopen to search the EXTRA_LD_LIBRARY_PATH from wine.conf
+ * manually because libdl.so caches the environment and does not accept our
+ * changes.
+ */
+void *ELFDLL_dlopen(const char *libname, int flags)
+{
+ char buffer[256];
+ int namelen;
+ void *handle;
+ char *ldpath;
+
+ /* First try the default path search of dlopen() */
+ handle = dlopen(libname, flags);
+ if(handle)
+ return handle;
+
+ /* Now try to construct searches through our extra search-path */
+ namelen = strlen(libname);
+ ldpath = def_path;
+ while(ldpath && *ldpath)
+ {
+ int len;
+ char *cptr;
+ char *from;
+
+ from = ldpath;
+ cptr = strchr(ldpath, ':');
+ if(!cptr)
+ {
+ len = strlen(ldpath);
+ ldpath = NULL;
+ }
+ else
+ {
+ len = cptr - ldpath;
+ ldpath = cptr + 1;
+ }
+
+ if(len + namelen + 1 >= sizeof(buffer))
+ {
+ ERR("Buffer overflow! Check EXTRA_LD_LIBRARY_PATH or increase buffer size.\n");
+ return NULL;
+ }
+
+ strncpy(buffer, from, len);
+ if(len)
+ {
+ buffer[len] = '/';
+ strcpy(buffer + len + 1, libname);
+ }
+ else
+ strcpy(buffer + len, libname);
+
+ TRACE("Trying dlopen('%s', %d)\n", buffer, flags);
+
+ handle = dlopen(buffer, flags);
+ if(handle)
+ return handle;
+ }
+ return NULL;
+}
+
+
+/****************************************************************************
+ * get_sobasename (internal)
+ *
+ */
+static LPSTR get_sobasename(LPCSTR path, LPSTR name)
+{
+ char *cptr;
+
+ /* Strip the path from the library name */
+ if((cptr = strrchr(path, '/')))
+ {
+ char *cp = strrchr(cptr+1, '\\');
+ if(cp && cp > cptr)
+ cptr = cp;
+ }
+ else
+ cptr = strrchr(path, '\\');
+
+ if(!cptr)
+ cptr = (char *)path; /* No '/' nor '\\' in path */
+ else
+ cptr++;
+
+ strcpy(name, cptr);
+ cptr = strrchr(name, '.');
+ if(cptr)
+ *cptr = '\0'; /* Strip extension */
+
+ /* Convert to lower case.
+ * This must be done manually because it is not sure that
+ * other modules are accessible.
+ */
+ for(cptr = name; *cptr; cptr++)
+ *cptr = tolower(*cptr);
+
+ return name;
+}
+
+
+/****************************************************************************
+ * ELFDLL_CreateModref (internal)
+ *
+ * INPUT
+ * hModule - the header from the elf-dll's data-segment
+ * path - requested path from original call
+ *
+ * OUTPUT
+ * A WINE_MODREF pointer to the new object
+ *
+ * BUGS
+ * - Does not handle errors due to dependencies correctly
+ * - path can be wrong
+ */
+#define RVA(base, va) (((DWORD)base) + ((DWORD)va))
+
+static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path)
+{
+// IMAGE_NT_HEADERS *nt = PE_HEADER(hModule);
+ IMAGE_DATA_DIRECTORY *dir;
+ IMAGE_IMPORT_DESCRIPTOR *pe_import = NULL;
+ WINE_MODREF *wm;
+ int len;
+ HANDLE procheap = GetProcessHeap();
+
+ wm = (WINE_MODREF *)HeapAlloc(procheap, HEAP_ZERO_MEMORY, sizeof(*wm));
+ if(!wm)
+ return NULL;
+
+ wm->module = hModule;
+ wm->type = MODULE32_ELF; /* FIXME */
+
+// dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_EXPORT;
+// if(dir->Size)
+// wm->binfmt.pe.pe_export = (PIMAGE_EXPORT_DIRECTORY)RVA(hModule, dir->VirtualAddress);
+
+// dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_IMPORT;
+// if(dir->Size)
+// pe_import = wm->binfmt.pe.pe_import = (PIMAGE_IMPORT_DESCRIPTOR)RVA(hModule, dir->VirtualAddress);
+
+// dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_RESOURCE;
+// if(dir->Size)
+// wm->binfmt.pe.pe_resource = (PIMAGE_RESOURCE_DIRECTORY)RVA(hModule, dir->VirtualAddress);
+
+
+ wm->filename = malloc(strlen(path)+1);
+ strcpy(wm->filename, path);
+ wm->modname = strrchr( wm->filename, '\\' );
+ if (!wm->modname) wm->modname = wm->filename;
+ else wm->modname++;
+/*
+ len = GetShortPathNameA( wm->filename, NULL, 0 );
+ wm->short_filename = (char *)HeapAlloc( procheap, 0, len+1 );
+ GetShortPathNameA( wm->filename, wm->short_filename, len+1 );
+ wm->short_modname = strrchr( wm->short_filename, '\\' );
+ if (!wm->short_modname) wm->short_modname = wm->short_filename;
+ else wm->short_modname++;
+*/
+ /* Link MODREF into process list */
+
+// EnterCriticalSection( &PROCESS_Current()->crit_section );
+
+ if(local_wm)
+ {
+ local_wm->next=malloc(sizeof(modref_list));
+ local_wm->next->prev=local_wm;
+ local_wm->next->next=NULL;
+ local_wm->next->wm=wm;
+ local_wm=local_wm->next;
+ }
+ else
+ {
+ local_wm=malloc(sizeof(modref_list));
+ local_wm->next=local_wm->prev=NULL;
+ local_wm->wm=wm;
+ }
+
+// LeaveCriticalSection( &PROCESS_Current()->crit_section );
+ return wm;
+}
+
+/****************************************************************************
+ * ELFDLL_LoadLibraryExA (internal)
+ *
+ * Implementation of elf-dll loading for PE modules
+ */
+WINE_MODREF *ELFDLL_LoadLibraryExA(LPCSTR path, DWORD flags)
+{
+ LPVOID dlhandle;
+ struct elfdll_image *image;
+ char name[129];
+ char soname[129];
+ WINE_MODREF *wm;
+
+ get_sobasename(path, name);
+ strcpy(soname, name);
+ strcat(soname, ".so");
+
+ /* Try to open the elf-dll */
+ dlhandle = ELFDLL_dlopen(soname, RTLD_LAZY);
+ if(!dlhandle)
+ {
+ WARN("Could not load %s (%s)\n", soname, dlerror());
+ SetLastError( ERROR_FILE_NOT_FOUND );
+ return NULL;
+ }
+
+ /* Get the 'dllname_elfdll_image' variable */
+/* strcpy(soname, name);
+ strcat(soname, "_elfdll_image");
+ image = (struct elfdll_image *)dlsym(dlhandle, soname);
+ if(!image)
+ {
+ ERR("Could not get elfdll image descriptor %s (%s)\n", soname, dlerror());
+ dlclose(dlhandle);
+ SetLastError( ERROR_BAD_FORMAT );
+ return NULL;
+ }
+
+*/
+ wm = ELFDLL_CreateModref((int)dlhandle, path);
+ if(!wm)
+ {
+ ERR("Could not create WINE_MODREF for %s\n", path);
+ dlclose(dlhandle);
+ SetLastError( ERROR_OUTOFMEMORY );
+ return NULL;
+ }
+
+ return wm;
+}
+
+
+/****************************************************************************
+ * ELFDLL_UnloadLibrary (internal)
+ *
+ * Unload an elf-dll completely from memory and deallocate the modref
+ */
+void ELFDLL_UnloadLibrary(WINE_MODREF *wm)
+{
+}
+
+#endif /*HAVE_LIBDL*/
diff --git a/loader/ext.c b/loader/ext.c
new file mode 100644
index 0000000000..e978fac0c4
--- /dev/null
+++ b/loader/ext.c
@@ -0,0 +1,565 @@
+/********************************************************
+ *
+ *
+ * Stub functions for Wine module
+ *
+ *
+ ********************************************************/
+#include <config.h>
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#else
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdarg.h>
+#include <wine/windef.h>
+//#include <wine/winbase.h>
+int dbg_header_err( const char *dbg_channel, const char *func )
+{
+ return 0;
+}
+int dbg_header_warn( const char *dbg_channel, const char *func )
+{
+ return 0;
+}
+int dbg_header_fixme( const char *dbg_channel, const char *func )
+{
+ return 0;
+}
+int dbg_header_trace( const char *dbg_channel, const char *func )
+{
+ return 0;
+}
+int dbg_vprintf( const char *format, ... )
+{
+ return 0;
+}
+int __vprintf( const char *format, ... )
+{
+#ifdef DETAILED_OUT
+ va_list va;
+ va_start(va, format);
+ vprintf(format, va);
+ va_end(va);
+ fflush(stdout);
+#endif
+ return 0;
+}
+
+int GetProcessHeap()
+{
+ return 1;
+}
+
+void* HeapAlloc(int heap, int flags, int size)
+{
+ if(flags & 0x8)
+ return calloc(size, 1);
+ else
+ return malloc(size);
+}
+
+int HeapFree(int heap, int flags, void* mem)
+{
+ free(mem);
+ return 1;
+}
+
+static int last_error;
+
+int GetLastError()
+{
+ return last_error;
+}
+
+int SetLastError(int error)
+{
+ return last_error=error;
+}
+
+int ReadFile(int handle, void* mem, unsigned long size, long* result, long flags)
+{
+ *result=read(handle, mem, size);
+ return *result;
+}
+int lstrcmpiA(const char* c1, const char* c2)
+{
+ return strcasecmp(c1,c2);
+}
+int lstrcpynA(char* dest, const char* src, int num)
+{
+ return strncmp(dest,src,num);
+}
+int lstrlenA(const char* s)
+{
+ return strlen(s);
+}
+int lstrlenW(const short* s)
+{
+ int l;
+ if(!s)
+ return 0;
+ l=0;
+ while(s[l])
+ l++;
+ return l;
+}
+int lstrcpynWtoA(char* dest, const char* src, int count)
+{
+ int moved=0;
+ if((dest==0) || (src==0))
+ return 0;
+ while(moved<count)
+ {
+ *dest=*src;
+ moved++;
+ if(*src==0)
+ return moved;
+ src++;
+ dest++;
+ }
+}
+int wcsnicmp(const unsigned short* s1, const unsigned short* s2, int n)
+{
+ if(s1==0)
+ return;
+ if(s2==0)
+ return;
+ while(n>0)
+ {
+ if(*s1<*s2)
+ return -1;
+ else
+ if(*s1>*s2)
+ return 1;
+ else
+ if(*s1==0)
+ return 0;
+ s1++;
+ s2++;
+ n--;
+ }
+ return 0;
+}
+
+
+int IsBadReadPtr(void* data, int size)
+{
+ if(size==0)
+ return 0;
+ if(data==NULL)
+ return 1;
+ return 0;
+}
+char* HEAP_strdupA(const char* string)
+{
+// return strdup(string);
+ char* answ=malloc(strlen(string)+1);
+ strcpy(answ, string);
+ return answ;
+}
+short* HEAP_strdupAtoW(void* heap, void* hz, const char* string)
+{
+ int size, i;
+ short* answer;
+ if(string==0)
+ return 0;
+ size=strlen(string);
+ answer=malloc(size+size+2);
+ for(i=0; i<=size; i++)
+ answer[i]=(short)string[i];
+ return answer;
+}
+char* HEAP_strdupWtoA(void* heap, void* hz, const short* string)
+{
+ int size, i;
+ char* answer;
+ if(string==0)
+ return 0;
+ size=0;
+ while(string[size])
+ size++;
+ answer=malloc(size+2);
+ for(i=0; i<=size; i++)
+ answer[i]=(char)string[i];
+ return answer;
+}
+
+/***********************************************************************
+ * FILE_dommap
+ */
+
+//#define MAP_PRIVATE
+//#define MAP_SHARED
+#undef MAP_ANON
+LPVOID FILE_dommap( int unix_handle, LPVOID start,
+ DWORD size_high, DWORD size_low,
+ DWORD offset_high, DWORD offset_low,
+ int prot, int flags )
+{
+ int fd = -1;
+ int pos;
+ LPVOID ret;
+
+ if (size_high || offset_high)
+ printf("offsets larger than 4Gb not supported\n");
+
+ if (unix_handle == -1)
+ {
+#ifdef MAP_ANON
+// printf("Anonymous\n");
+ flags |= MAP_ANON;
+#else
+ static int fdzero = -1;
+
+ if (fdzero == -1)
+ {
+ if ((fdzero = open( "/dev/zero", O_RDONLY )) == -1)
+ {
+ perror( "/dev/zero: open" );
+ exit(1);
+ }
+ }
+ fd = fdzero;
+#endif /* MAP_ANON */
+ /* Linux EINVAL's on us if we don't pass MAP_PRIVATE to an anon mmap */
+#ifdef MAP_SHARED
+ flags &= ~MAP_SHARED;
+#endif
+#ifdef MAP_PRIVATE
+ flags |= MAP_PRIVATE;
+#endif
+ }
+ else fd = unix_handle;
+// printf("fd %x, start %x, size %x, pos %x, prot %x\n",fd,start,size_low, offset_low, prot);
+// if ((ret = mmap( start, size_low, prot,
+// flags, fd, offset_low )) != (LPVOID)-1)
+ if ((ret = mmap( start, size_low, prot,
+ MAP_PRIVATE | MAP_FIXED, fd, offset_low )) != (LPVOID)-1)
+ {
+// printf("address %08x\n", *(int*)ret);
+// printf("%x\n", ret);
+ return ret;
+ }
+
+// printf("mmap %d\n", errno);
+
+ /* mmap() failed; if this is because the file offset is not */
+ /* page-aligned (EINVAL), or because the underlying filesystem */
+ /* does not support mmap() (ENOEXEC), we do it by hand. */
+
+ if (unix_handle == -1) return ret;
+ if ((errno != ENOEXEC) && (errno != EINVAL)) return ret;
+ if (prot & PROT_WRITE)
+ {
+ /* We cannot fake shared write mappings */
+#ifdef MAP_SHARED
+ if (flags & MAP_SHARED) return ret;
+#endif
+#ifdef MAP_PRIVATE
+ if (!(flags & MAP_PRIVATE)) return ret;
+#endif
+ }
+/* printf( "FILE_mmap: mmap failed (%d), faking it\n", errno );*/
+ /* Reserve the memory with an anonymous mmap */
+ ret = FILE_dommap( -1, start, size_high, size_low, 0, 0,
+ PROT_READ | PROT_WRITE, flags );
+ if (ret == (LPVOID)-1)
+// {
+// perror(
+ return ret;
+ /* Now read in the file */
+ if ((pos = lseek( fd, offset_low, SEEK_SET )) == -1)
+ {
+ FILE_munmap( ret, size_high, size_low );
+// printf("lseek\n");
+ return (LPVOID)-1;
+ }
+ read( fd, ret, size_low );
+ lseek( fd, pos, SEEK_SET ); /* Restore the file pointer */
+ mprotect( ret, size_low, prot ); /* Set the right protection */
+// printf("address %08x\n", *(int*)ret);
+ return ret;
+}
+
+
+/***********************************************************************
+ * FILE_munmap
+ */
+int FILE_munmap( LPVOID start, DWORD size_high, DWORD size_low )
+{
+ if (size_high)
+ printf("offsets larger than 4Gb not supported\n");
+ return munmap( start, size_low );
+}
+static int mapping_size=0;
+
+struct file_mapping_s;
+typedef struct file_mapping_s
+{
+ int mapping_size;
+ char* name;
+ HANDLE handle;
+ struct file_mapping_s* next;
+ struct file_mapping_s* prev;
+}file_mapping;
+static file_mapping* fm=0;
+
+
+
+#define PAGE_NOACCESS 0x01
+#define PAGE_READONLY 0x02
+#define PAGE_READWRITE 0x04
+#define PAGE_WRITECOPY 0x08
+#define PAGE_EXECUTE 0x10
+#define PAGE_EXECUTE_READ 0x20
+#define PAGE_EXECUTE_READWRITE 0x40
+#define PAGE_EXECUTE_WRITECOPY 0x80
+#define PAGE_GUARD 0x100
+#define PAGE_NOCACHE 0x200
+
+HANDLE CreateFileMappingA(int hFile, void* lpAttr,
+DWORD flProtect, DWORD dwMaxHigh, DWORD dwMaxLow, const char* name)
+{
+ unsigned int len;
+ HANDLE answer;
+ int anon=0;
+ int mmap_access=0;
+ if(hFile<0)
+ {
+ anon=1;
+ hFile=open("/dev/zero", O_RDWR);
+ if(hFile<0)
+ return 0;
+ }
+ if(!anon)
+ {
+ len=lseek(hFile, 0, SEEK_END);
+ lseek(hFile, 0, SEEK_SET);
+ }
+ else len=dwMaxLow;
+
+ if(flProtect & PAGE_READONLY)
+ mmap_access |=PROT_READ;
+ else
+ mmap_access |=PROT_READ|PROT_WRITE;
+
+ answer=(HANDLE)mmap(NULL, len, mmap_access, MAP_PRIVATE, hFile, 0);
+ if(anon)
+ close(hFile);
+ if(answer!=(HANDLE)-1)
+ {
+ if(fm==0)
+ {
+ fm=malloc(sizeof(file_mapping));
+ fm->prev=NULL;
+ }
+ else
+ {
+ fm->next=malloc(sizeof(file_mapping));
+ fm->next->prev=fm;
+ fm=fm->next;
+ }
+ fm->next=NULL;
+ fm->handle=answer;
+ if(name)
+ {
+ fm->name=malloc(strlen(name)+1);
+ strcpy(fm->name, name);
+ }
+ else
+ fm->name=NULL;
+ fm->mapping_size=len;
+
+ if(anon)
+ close(hFile);
+ return answer;
+ }
+ return (HANDLE)0;
+}
+int UnmapViewOfFile(HANDLE handle)
+{
+ file_mapping* p;
+ int result;
+ if(fm==0)
+ return (HANDLE)0;
+ for(p=fm; p; p=p->next)
+ {
+ if(p->handle==handle)
+ {
+ result=munmap((void*)handle, p->mapping_size);
+ if(p->next)p->next->prev=p->prev;
+ if(p->prev)p->prev->next=p->next;
+ if(p->name)
+ free(p->name);
+ if(p==fm)
+ fm=p->prev;
+ free(p);
+ return result;
+ }
+ }
+ return 0;
+}
+//static int va_size=0;
+struct virt_alloc_s;
+typedef struct virt_alloc_s
+{
+ int mapping_size;
+ char* address;
+ struct virt_alloc_s* next;
+ struct virt_alloc_s* prev;
+ int state;
+}virt_alloc;
+static virt_alloc* vm=0;
+#define MEM_COMMIT 0x00001000
+#define MEM_RESERVE 0x00002000
+
+void* VirtualAlloc(void* address, DWORD size, DWORD type, DWORD protection)
+{
+ void* answer;
+ int fd=open("/dev/zero", O_RDWR);
+ size=(size+0xffff)&(~0xffff);
+// printf("VirtualAlloc(0x%08X, %d)\n", address
+ if(address!=0)
+ {
+ //check whether we can allow to allocate this
+ virt_alloc* str=vm;
+ while(str)
+ {
+ if((unsigned)address>=(unsigned)str->address+str->mapping_size)
+ {
+ str=str->prev;
+ continue;
+ }
+ if((unsigned)address+size<(unsigned)str->address)
+ {
+ str=str->prev;
+ continue;
+ }
+ if(str->state==0)
+ {
+#warning FIXME
+ if(((unsigned)address+size<(unsigned)str->address+str->mapping_size) && (type & MEM_COMMIT))
+ {
+ close(fd);
+ return address; //returning previously reserved memory
+ }
+ return NULL;
+ }
+ close(fd);
+ return NULL;
+ }
+ answer=mmap(address, size, PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_FIXED | MAP_PRIVATE, fd, 0);
+ }
+ else
+ answer=mmap(address, size, PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_PRIVATE, fd, 0);
+// answer=FILE_dommap(-1, address, 0, size, 0, 0,
+// PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE);
+ close(fd);
+ if(answer==(void*)-1)
+ {
+ printf("Error no %d\n", errno);
+ printf("VirtualAlloc(0x%08X, %d) failed\n", address, size);
+ return NULL;
+ }
+ else
+ {
+ virt_alloc *new_vm=malloc(sizeof(virt_alloc));
+ new_vm->mapping_size=size;
+ new_vm->address=answer;
+ new_vm->prev=vm;
+ if(type == MEM_RESERVE)
+ new_vm->state=0;
+ else
+ new_vm->state=1;
+ if(vm)
+ vm->next=new_vm;
+ vm=new_vm;
+ vm->next=0;
+// if(va_size!=0)
+// printf("Multiple VirtualAlloc!\n");
+// printf("answer=0x%08x\n", answer);
+ return answer;
+ }
+}
+int VirtualFree(void* address, int t1, int t2)//not sure
+{
+ virt_alloc* str=vm;
+ int answer;
+ while(str)
+ {
+ if(address!=str->address)
+ {
+ str=str->prev;
+ continue;
+ }
+ answer=munmap(str->address, str->mapping_size);
+ if(str->next)str->next->prev=str->prev;
+ if(str->prev)str->prev->next=str->next;
+ if(vm==str)vm=0;
+ free(str);
+ return 0;
+ }
+ return -1;
+}
+
+int WideCharToMultiByte(unsigned int codepage, long flags, const short* src,
+ int srclen,char* dest, int destlen, const char* defch, int* used_defch)
+{
+ int i;
+ if(src==0)
+ return 0;
+ for(i=0; i<srclen; i++)
+ printf("%c", src[i]);
+ printf("\n");
+ if(dest==0)
+ {
+ for(i=0; i<srclen; i++)
+ {
+ src++;
+ if(*src==0)
+ return i+1;
+ }
+ return srclen+1;
+ }
+ if(used_defch)
+ *used_defch=0;
+ for(i=0; i<min(srclen, destlen); i++)
+ {
+ *dest=(char)*src;
+ dest++;
+ src++;
+ if(*src==0)
+ return i+1;
+ }
+ return min(srclen, destlen);
+}
+int MultiByteToWideChar(unsigned int codepage,long flags, const char* src, int srclen,
+ short* dest, int destlen)
+{
+ return 0;
+}
+HANDLE OpenFileMappingA(long access, long prot, char* name)
+{
+ file_mapping* p;
+ if(fm==0)
+ return (HANDLE)0;
+ if(name==0)
+ return (HANDLE)0;
+ for(p=fm; p; p=p->prev)
+ {
+ if(p->name==0)
+ continue;
+ if(strcmp(p->name, name)==0)
+ return p->handle;
+ }
+ return 0;
+}
diff --git a/loader/loader.h b/loader/loader.h
new file mode 100644
index 0000000000..f94fe0044d
--- /dev/null
+++ b/loader/loader.h
@@ -0,0 +1,286 @@
+/********************************************************
+
+ Win32 binary loader interface
+ Copyright 2000 Eugene Smith (divx@euro.ru)
+ Shamelessly stolen from Wine project
+
+*********************************************************/
+
+#ifndef _LOADER_H
+#define _LOADER_H
+#include <wine/windef.h>
+#include <wine/driver.h>
+#include <wine/mmreg.h>
+#include <wine/vfw.h>
+#include <wine/msacm.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void SetCodecPath(const char* path);
+unsigned int _GetPrivateProfileIntA(const char* appname, const char* keyname, int default_value, const char* filename);
+int _GetPrivateProfileStringA(const char* appname, const char* keyname,
+ const char* def_val, char* dest, unsigned int len, const char* filename);
+int _WritePrivateProfileStringA(const char* appname, const char* keyname,
+ const char* string, const char* filename);
+
+
+/**********************************************
+
+ MS VFW ( Video For Windows ) interface
+
+**********************************************/
+
+long VFWAPIV ICCompress(
+ HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpData,
+ LPBITMAPINFOHEADER lpbiInput,void* lpBits,long* lpckid,
+ long* lpdwFlags,long lFrameNum,long dwFrameSize,long dwQuality,
+ LPBITMAPINFOHEADER lpbiPrev,void* lpPrev
+);
+
+long VFWAPIV ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits);
+
+WIN_BOOL VFWAPI ICInfo(long fccType, long fccHandler, ICINFO * lpicinfo);
+LRESULT VFWAPI ICGetInfo(HIC hic,ICINFO *picinfo, long cb);
+HIC VFWAPI ICOpen(long fccType, long fccHandler, UINT wMode);
+HIC VFWAPI ICOpenFunction(long fccType, long fccHandler, unsigned int wMode, void* lpfnHandler);
+
+LRESULT VFWAPI ICClose(HIC hic);
+LRESULT VFWAPI ICSendMessage(HIC hic, unsigned int msg, long dw1, long dw2);
+HIC VFWAPI ICLocate(long fccType, long fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, short wFlags);
+
+int VFWAPI ICDoSomething();
+
+#define ICCompressGetFormat(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic,ICM_COMPRESS_GET_FORMAT,(long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ )
+
+#define ICCompressGetFormatSize(hic,lpbi) ICCompressGetFormat(hic,lpbi,NULL)
+
+#define ICGetDefaultKeyFrameRate(hic,lpint) \
+ ICSendMessage( \
+ hic, ICM_GETDEFAULTKEYFRAMERATE, \
+ (long)(void*)(lpint), \
+ 0 )
+
+#define ICGetDefaultQuality(hic,lpint) \
+ ICSendMessage( \
+ hic, ICM_GETDEFAULTQUALITY, \
+ (long)(void*)(lpint), \
+ 0 )
+
+
+#define ICCompressBegin(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic, ICM_COMPRESS_BEGIN, (long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ )
+
+#define ICCompressGetSize(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic, ICM_COMPRESS_GET_SIZE, (long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ )
+
+#define ICCompressQuery(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic, ICM_COMPRESS_QUERY, (long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ )
+
+
+#define ICCompressEnd(hic) ICSendMessage(hic, ICM_COMPRESS_END, 0, 0)
+
+
+
+#define ICDecompressBegin(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic, ICM_DECOMPRESS_BEGIN, (long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ )
+
+#define ICDecompressQuery(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic,ICM_DECOMPRESS_QUERY, (long)(void*)(lpbiInput), \
+ (long) (void*)(lpbiOutput) \
+ )
+
+#define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput) \
+ ((long)ICSendMessage( \
+ hic,ICM_DECOMPRESS_GET_FORMAT, (long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ ))
+
+#define ICDecompressGetFormatSize(hic, lpbi) \
+ ICDecompressGetFormat(hic, lpbi, NULL)
+
+#define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic, ICM_DECOMPRESS_GET_PALETTE, (long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ )
+
+#define ICDecompressSetPalette(hic,lpbiPalette) \
+ ICSendMessage( \
+ hic,ICM_DECOMPRESS_SET_PALETTE, \
+ (long)(void*)(lpbiPalette),0 \
+ )
+
+#define ICDecompressEnd(hic) ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0)
+
+
+/*****************************************************
+
+ MS ACM ( Audio Compression Manager ) interface
+
+******************************************************/
+
+
+MMRESULT WINAPI acmDriverAddA(
+ PHACMDRIVERID phadid, HINSTANCE hinstModule,
+ LPARAM lParam, DWORD dwPriority, DWORD fdwAdd
+);
+MMRESULT WINAPI acmDriverAddW(
+ PHACMDRIVERID phadid, HINSTANCE hinstModule,
+ LPARAM lParam, DWORD dwPriority, DWORD fdwAdd
+);
+MMRESULT WINAPI acmDriverClose(
+ HACMDRIVER had, DWORD fdwClose
+);
+MMRESULT WINAPI acmDriverDetailsA(
+ HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmDriverDetailsW(
+ HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmDriverEnum(
+ ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmDriverID(
+ HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID
+);
+LRESULT WINAPI acmDriverMessage(
+ HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2
+);
+MMRESULT WINAPI acmDriverOpen(
+ PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen
+);
+MMRESULT WINAPI acmDriverPriority(
+ HACMDRIVERID hadid, DWORD dwPriority, DWORD fdwPriority
+);
+MMRESULT WINAPI acmDriverRemove(
+ HACMDRIVERID hadid, DWORD fdwRemove
+);
+MMRESULT WINAPI acmFilterChooseA(
+ PACMFILTERCHOOSEA pafltrc
+);
+MMRESULT WINAPI acmFilterChooseW(
+ PACMFILTERCHOOSEW pafltrc
+);
+MMRESULT WINAPI acmFilterDetailsA(
+ HACMDRIVER had, PACMFILTERDETAILSA pafd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFilterDetailsW(
+ HACMDRIVER had, PACMFILTERDETAILSW pafd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFilterEnumA(
+ HACMDRIVER had, PACMFILTERDETAILSA pafd,
+ ACMFILTERENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFilterEnumW(
+ HACMDRIVER had, PACMFILTERDETAILSW pafd,
+ ACMFILTERENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFilterTagDetailsA(
+ HACMDRIVER had, PACMFILTERTAGDETAILSA paftd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFilterTagDetailsW(
+ HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFilterTagEnumA(
+ HACMDRIVER had, PACMFILTERTAGDETAILSA paftd,
+ ACMFILTERTAGENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFilterTagEnumW(
+ HACMDRIVER had, PACMFILTERTAGDETAILSW paftd,
+ ACMFILTERTAGENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFormatChooseA(
+ PACMFORMATCHOOSEA pafmtc
+);
+MMRESULT WINAPI acmFormatChooseW(
+ PACMFORMATCHOOSEW pafmtc
+);
+MMRESULT WINAPI acmFormatDetailsA(
+ HACMDRIVER had, PACMFORMATDETAILSA pafd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFormatDetailsW(
+ HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFormatEnumA(
+ HACMDRIVER had, PACMFORMATDETAILSA pafd,
+ ACMFORMATENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFormatEnumW(
+ HACMDRIVER had, PACMFORMATDETAILSW pafd,
+ ACMFORMATENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFormatSuggest(
+ HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst,
+ DWORD cbwfxDst, DWORD fdwSuggest
+);
+MMRESULT WINAPI acmFormatTagDetailsA(
+ HACMDRIVER had, PACMFORMATTAGDETAILSA paftd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFormatTagDetailsW(
+ HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFormatTagEnumA(
+ HACMDRIVER had, PACMFORMATTAGDETAILSA paftd,
+ ACMFORMATTAGENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFormatTagEnumW(
+ HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
+ ACMFORMATTAGENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+DWORD WINAPI acmGetVersion(
+);
+MMRESULT WINAPI acmMetrics(
+ HACMOBJ hao, UINT uMetric, LPVOID pMetric
+);
+MMRESULT WINAPI acmStreamClose(
+ HACMSTREAM has, DWORD fdwClose
+);
+MMRESULT WINAPI acmStreamConvert(
+ HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwConvert
+);
+MMRESULT WINAPI acmStreamMessage(
+ HACMSTREAM has, UINT uMsg, LPARAM lParam1, LPARAM lParam2
+);
+MMRESULT WINAPI acmStreamOpen(
+ PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
+ PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback,
+ DWORD dwInstance, DWORD fdwOpen
+);
+MMRESULT WINAPI acmStreamPrepareHeader(
+ HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwPrepare
+);
+MMRESULT WINAPI acmStreamReset(
+ HACMSTREAM has, DWORD fdwReset
+);
+MMRESULT WINAPI acmStreamSize(
+ HACMSTREAM has, DWORD cbInput,
+ LPDWORD pdwOutputBytes, DWORD fdwSize
+);
+MMRESULT WINAPI acmStreamUnprepareHeader(
+ HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwUnprepare
+);
+void MSACM_RegisterAllDrivers(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __LOADER_H */
+
diff --git a/loader/module.c b/loader/module.c
new file mode 100644
index 0000000000..69cba22c93
--- /dev/null
+++ b/loader/module.c
@@ -0,0 +1,618 @@
+/*
+ * Modules
+ *
+ * Copyright 1995 Alexandre Julliard
+ */
+#include <config.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/mman.h>
+#include <sys/types.h>
+/*
+#ifdef __linux__
+#include <asm/unistd.h>
+#include <asm/ldt.h>
+#else
+#define LDT_ENTRIES 8192
+#define LDT_ENTRY_SIZE 8
+
+struct modify_ldt_ldt_s {
+ unsigned int entry_number;
+ unsigned long base_addr;
+ unsigned int limit;
+ unsigned int seg_32bit:1;
+ unsigned int contents:2;
+ unsigned int read_exec_only:1;
+ unsigned int limit_in_pages:1;
+ unsigned int seg_not_present:1;
+ unsigned int useable:1;
+};
+
+#define MODIFY_LDT_CONTENTS_DATA 0
+#define MODIFY_LDT_CONTENTS_STACK 1
+#define MODIFY_LDT_CONTENTS_CODE 2
+#define __NR_modify_ldt 123
+#endif
+
+*/
+#include <wine/windef.h>
+#include <wine/winerror.h>
+#include <wine/heap.h>
+#include <wine/module.h>
+#include <wine/pe_image.h>
+#include <wine/debugtools.h>
+
+struct modref_list_t;
+
+typedef struct modref_list_t
+{
+ WINE_MODREF* wm;
+ struct modref_list_t *next;
+ struct modref_list_t *prev;
+}
+modref_list;
+
+
+/***********************************************************************
+ * LDT_EntryToBytes
+ *
+ * Convert an ldt_entry structure to the raw bytes of the descriptor.
+ */
+/*static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content )
+{
+ *buffer++ = ((content->base_addr & 0x0000ffff) << 16) |
+ (content->limit & 0x0ffff);
+ *buffer = (content->base_addr & 0xff000000) |
+ ((content->base_addr & 0x00ff0000)>>16) |
+ (content->limit & 0xf0000) |
+ (content->contents << 10) |
+ ((content->read_exec_only == 0) << 9) |
+ ((content->seg_32bit != 0) << 22) |
+ ((content->limit_in_pages != 0) << 23) |
+ 0xf000;
+}
+*/
+
+//
+// funcs:
+//
+// 0 read LDT
+// 1 write old mode
+// 0x11 write
+//
+/*
+static int modify_ldt( int func, struct modify_ldt_ldt_s *ptr,
+ unsigned long count )
+{
+ int res;
+#ifdef __PIC__
+ __asm__ __volatile__( "pushl %%ebx\n\t"
+ "movl %2,%%ebx\n\t"
+ "int $0x80\n\t"
+ "popl %%ebx"
+ : "=a" (res)
+ : "0" (__NR_modify_ldt),
+ "r" (func),
+ "c" (ptr),
+ "d" (sizeof(struct modify_ldt_ldt_s)*count) );
+#else
+ __asm__ __volatile__("int $0x80"
+ : "=a" (res)
+ : "0" (__NR_modify_ldt),
+ "b" (func),
+ "c" (ptr),
+ "d" (sizeof(struct modify_ldt_ldt_s)*count) );
+#endif
+ if (res >= 0) return res;
+ errno = -res;
+ return -1;
+}
+static int fs_installed=0;
+static char* fs_seg=0;
+static int install_fs()
+{
+ struct modify_ldt_ldt_s array;
+ int fd;
+ int ret;
+ void* prev_struct;
+
+ if(fs_installed)
+ return 0;
+
+ fd=open("/dev/zero", O_RDWR);
+ fs_seg=mmap((void*)0xbf000000, 0x30000, PROT_READ | PROT_WRITE, MAP_PRIVATE,
+ fd, 0);
+ if(fs_seg==0)
+ {
+ printf("ERROR: Couldn't allocate memory for fs segment\n");
+ return -1;
+ }
+ array.base_addr=((int)fs_seg+0xffff) & 0xffff0000;
+ array.entry_number=0x1;
+ array.limit=array.base_addr+getpagesize()-1;
+ array.seg_32bit=1;
+ array.read_exec_only=0;
+ array.seg_not_present=0;
+ array.contents=MODIFY_LDT_CONTENTS_DATA;
+ array.limit_in_pages=0;
+#ifdef linux
+ ret=modify_ldt(0x1, &array, 1);
+ if(ret<0)
+ {
+ perror("install_fs");
+ MESSAGE("Couldn't install fs segment, expect segfault\n");
+ }
+#endif
+
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+ {
+ long d[2];
+
+ LDT_EntryToBytes( d, &array );
+ ret = i386_set_ldt(0x1, (union descriptor *)d, 1);
+ if (ret < 0)
+ {
+ perror("install_fs");
+ MESSAGE("Did you reconfigure the kernel with \"options USER_LDT\"?\n");
+ }
+ }
+#endif
+ __asm__
+ (
+ "movl $0xf,%eax\n\t"
+// "pushw %ax\n\t"
+ "movw %ax, %fs\n\t"
+ );
+ prev_struct=malloc(8);
+ *(void**)array.base_addr=prev_struct;
+ printf("prev_struct: 0x%X\n", prev_struct);
+ close(fd);
+
+ fs_installed=1;
+ return 0;
+};
+static int uninstall_fs()
+{
+ printf("Uninstalling FS segment\n");
+ if(fs_seg==0)
+ return -1;
+ munmap(fs_seg, 0x30000);
+ fs_installed=0;
+ return 0;
+}
+
+*/
+//WINE_MODREF *local_wm=NULL;
+modref_list* local_wm=NULL;
+
+WINE_MODREF *MODULE_FindModule(LPCSTR m)
+{
+ modref_list* list=local_wm;
+ TRACE("Module %s request\n", m);
+ if(list==NULL)
+ return NULL;
+ while(strcmp(m, list->wm->filename))
+ {
+// printf("%s: %x\n", list->wm->filename, list->wm->module);
+ list=list->prev;
+ if(list==NULL)
+ return NULL;
+ }
+ TRACE("Resolved to %s\n", list->wm->filename);
+ return list->wm;
+}
+
+void MODULE_RemoveFromList(WINE_MODREF *mod)
+{
+ modref_list* list=local_wm;
+ if(list==0)
+ return;
+ if(mod==0)
+ return;
+ if((list->prev==NULL)&&(list->next==NULL))
+ {
+ free(list);
+ local_wm=NULL;
+// uninstall_fs();
+ return;
+ }
+ for(;list;list=list->prev)
+ {
+ if(list->wm==mod)
+ {
+ if(list->prev)
+ list->prev->next=list->next;
+ if(list->next)
+ list->next->prev=list->prev;
+ if(list==local_wm)
+ local_wm=list->prev;
+ free(list);
+ return;
+ }
+ }
+}
+
+WINE_MODREF *MODULE32_LookupHMODULE(HMODULE m)
+{
+ modref_list* list=local_wm;
+ TRACE("Module %X request\n", m);
+ if(list==NULL)
+ return NULL;
+ while(m!=list->wm->module)
+ {
+// printf("Checking list %X wm %X module %X\n",
+// list, list->wm, list->wm->module);
+ list=list->prev;
+ if(list==NULL)
+ return NULL;
+ }
+ TRACE("LookupHMODULE hit %X\n", list->wm);
+ return list->wm;
+}
+
+/*************************************************************************
+ * MODULE_InitDll
+ */
+static WIN_BOOL MODULE_InitDll( WINE_MODREF *wm, DWORD type, LPVOID lpReserved )
+{
+ WIN_BOOL retv = TRUE;
+
+ static LPCSTR typeName[] = { "PROCESS_DETACH", "PROCESS_ATTACH",
+ "THREAD_ATTACH", "THREAD_DETACH" };
+ assert( wm );
+
+
+ /* Skip calls for modules loaded with special load flags */
+
+ if ( ( wm->flags & WINE_MODREF_DONT_RESOLVE_REFS )
+ || ( wm->flags & WINE_MODREF_LOAD_AS_DATAFILE ) )
+ return TRUE;
+
+
+ TRACE("(%s,%s,%p) - CALL\n", wm->modname, typeName[type], lpReserved );
+
+ /* Call the initialization routine */
+ switch ( wm->type )
+ {
+ case MODULE32_PE:
+ retv = PE_InitDLL( wm, type, lpReserved );
+ break;
+
+ case MODULE32_ELF:
+ /* no need to do that, dlopen() already does */
+ break;
+
+ default:
+ ERR("wine_modref type %d not handled.\n", wm->type );
+ retv = FALSE;
+ break;
+ }
+
+ /* The state of the module list may have changed due to the call
+ to PE_InitDLL. We cannot assume that this module has not been
+ deleted. */
+ TRACE("(%p,%s,%p) - RETURN %d\n", wm, typeName[type], lpReserved, retv );
+
+ return retv;
+}
+
+/*************************************************************************
+ * MODULE_DllProcessAttach
+ *
+ * Send the process attach notification to all DLLs the given module
+ * depends on (recursively). This is somewhat complicated due to the fact that
+ *
+ * - we have to respect the module dependencies, i.e. modules implicitly
+ * referenced by another module have to be initialized before the module
+ * itself can be initialized
+ *
+ * - the initialization routine of a DLL can itself call LoadLibrary,
+ * thereby introducing a whole new set of dependencies (even involving
+ * the 'old' modules) at any time during the whole process
+ *
+ * (Note that this routine can be recursively entered not only directly
+ * from itself, but also via LoadLibrary from one of the called initialization
+ * routines.)
+ *
+ * Furthermore, we need to rearrange the main WINE_MODREF list to allow
+ * the process *detach* notifications to be sent in the correct order.
+ * This must not only take into account module dependencies, but also
+ * 'hidden' dependencies created by modules calling LoadLibrary in their
+ * attach notification routine.
+ *
+ * The strategy is rather simple: we move a WINE_MODREF to the head of the
+ * list after the attach notification has returned. This implies that the
+ * detach notifications are called in the reverse of the sequence the attach
+ * notifications *returned*.
+ *
+ * NOTE: Assumes that the process critical section is held!
+ *
+ */
+WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved )
+{
+ WIN_BOOL retv = TRUE;
+ int i;
+ assert( wm );
+
+ /* prevent infinite recursion in case of cyclical dependencies */
+ if ( ( wm->flags & WINE_MODREF_MARKER )
+ || ( wm->flags & WINE_MODREF_PROCESS_ATTACHED ) )
+ return retv;
+
+ TRACE("(%s,%p) - START\n", wm->modname, lpReserved );
+
+ /* Tag current MODREF to prevent recursive loop */
+ wm->flags |= WINE_MODREF_MARKER;
+
+ /* Recursively attach all DLLs this one depends on */
+/* for ( i = 0; retv && i < wm->nDeps; i++ )
+ if ( wm->deps[i] )
+ retv = MODULE_DllProcessAttach( wm->deps[i], lpReserved );
+*/
+ /* Call DLL entry point */
+
+ //local_wm=wm;
+ if(local_wm)
+ {
+ local_wm->next=malloc(sizeof(modref_list));
+ local_wm->next->prev=local_wm;
+ local_wm->next->next=NULL;
+ local_wm->next->wm=wm;
+ local_wm=local_wm->next;
+ }
+ else
+ {
+ local_wm=malloc(sizeof(modref_list));
+ local_wm->next=local_wm->prev=NULL;
+ local_wm->wm=wm;
+ }
+ /* Remove recursion flag */
+ wm->flags &= ~WINE_MODREF_MARKER;
+
+ if ( retv )
+ {
+ retv = MODULE_InitDll( wm, DLL_PROCESS_ATTACH, lpReserved );
+ if ( retv )
+ wm->flags |= WINE_MODREF_PROCESS_ATTACHED;
+ }
+
+
+ TRACE("(%s,%p) - END\n", wm->modname, lpReserved );
+
+ return retv;
+}
+
+/*************************************************************************
+ * MODULE_DllProcessDetach
+ *
+ * Send DLL process detach notifications. See the comment about calling
+ * sequence at MODULE_DllProcessAttach. Unless the bForceDetach flag
+ * is set, only DLLs with zero refcount are notified.
+ */
+void MODULE_DllProcessDetach( WINE_MODREF* wm, WIN_BOOL bForceDetach, LPVOID lpReserved )
+{
+// WINE_MODREF *wm=local_wm;
+ wm->flags &= ~WINE_MODREF_PROCESS_ATTACHED;
+ MODULE_InitDll( wm, DLL_PROCESS_DETACH, lpReserved );
+}
+
+
+/***********************************************************************
+ * LoadLibraryExA (KERNEL32)
+ */
+HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
+{
+ WINE_MODREF *wm;
+
+ if(!libname)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
+// if(fs_installed==0)
+// install_fs();
+
+
+ wm = MODULE_LoadLibraryExA( libname, hfile, flags );
+ if ( wm )
+ {
+ if ( !MODULE_DllProcessAttach( wm, NULL ) )
+ {
+ WARN_(module)("Attach failed for module '%s', \n", libname);
+ MODULE_FreeLibrary(wm);
+ SetLastError(ERROR_DLL_INIT_FAILED);
+ MODULE_RemoveFromList(wm);
+ wm = NULL;
+ }
+ }
+
+ return wm ? wm->module : 0;
+}
+
+
+/***********************************************************************
+ * MODULE_LoadLibraryExA (internal)
+ *
+ * Load a PE style module according to the load order.
+ *
+ * The HFILE parameter is not used and marked reserved in the SDK. I can
+ * only guess that it should force a file to be mapped, but I rather
+ * ignore the parameter because it would be extremely difficult to
+ * integrate this with different types of module represenations.
+ *
+ */
+WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags )
+{
+ DWORD err = GetLastError();
+ WINE_MODREF *pwm;
+ int i;
+// module_loadorder_t *plo;
+
+
+ SetLastError( ERROR_FILE_NOT_FOUND );
+ TRACE("Trying native dll '%s'\n", libname);
+ pwm = PE_LoadLibraryExA(libname, flags);
+#ifdef HAVE_LIBDL
+ if(!pwm)
+ {
+ TRACE("Trying ELF dll '%s'\n", libname);
+ pwm=(WINE_MODREF*)ELFDLL_LoadLibraryExA(libname, flags);
+ }
+#endif
+// printf("0x%08x\n", pwm);
+// break;
+ if(pwm)
+ {
+ /* Initialize DLL just loaded */
+ TRACE("Loaded module '%s' at 0x%08x, \n", libname, pwm->module);
+ /* Set the refCount here so that an attach failure will */
+ /* decrement the dependencies through the MODULE_FreeLibrary call. */
+ pwm->refCount++;
+
+ SetLastError( err ); /* restore last error */
+ return pwm;
+ }
+
+
+ WARN("Failed to load module '%s'; error=0x%08lx, \n", libname, GetLastError());
+ return NULL;
+}
+
+/***********************************************************************
+ * LoadLibraryA (KERNEL32)
+ */
+HMODULE WINAPI LoadLibraryA(LPCSTR libname) {
+ return LoadLibraryExA(libname,0,0);
+}
+
+
+/***********************************************************************
+ * FreeLibrary
+ */
+WIN_BOOL WINAPI FreeLibrary(HINSTANCE hLibModule)
+{
+ WIN_BOOL retv = FALSE;
+ WINE_MODREF *wm;
+
+ wm=MODULE32_LookupHMODULE(hLibModule);
+// wm=local_wm;
+
+ if ( !wm || !hLibModule )
+ {
+ SetLastError( ERROR_INVALID_HANDLE );
+ return 0;
+ }
+ else
+ retv = MODULE_FreeLibrary( wm );
+
+ MODULE_RemoveFromList(wm);
+
+ return retv;
+}
+
+/***********************************************************************
+ * MODULE_DecRefCount
+ *
+ * NOTE: Assumes that the process critical section is held!
+ */
+static void MODULE_DecRefCount( WINE_MODREF *wm )
+{
+ int i;
+
+ if ( wm->flags & WINE_MODREF_MARKER )
+ return;
+
+ if ( wm->refCount <= 0 )
+ return;
+
+ --wm->refCount;
+ TRACE("(%s) refCount: %d\n", wm->modname, wm->refCount );
+
+ if ( wm->refCount == 0 )
+ {
+ wm->flags |= WINE_MODREF_MARKER;
+
+ for ( i = 0; i < wm->nDeps; i++ )
+ if ( wm->deps[i] )
+ MODULE_DecRefCount( wm->deps[i] );
+
+ wm->flags &= ~WINE_MODREF_MARKER;
+ }
+}
+
+/***********************************************************************
+ * MODULE_FreeLibrary
+ *
+ * NOTE: Assumes that the process critical section is held!
+ */
+WIN_BOOL MODULE_FreeLibrary( WINE_MODREF *wm )
+{
+ TRACE("(%s) - START\n", wm->modname );
+
+ /* Recursively decrement reference counts */
+ //MODULE_DecRefCount( wm );
+
+ /* Call process detach notifications */
+ MODULE_DllProcessDetach( wm, FALSE, NULL );
+
+ PE_UnloadLibrary(wm);
+
+ TRACE("END\n");
+
+ return TRUE;
+}
+
+/***********************************************************************
+ * GetProcAddress (KERNEL32.257)
+ */
+FARPROC WINAPI GetProcAddress( HMODULE hModule, LPCSTR function )
+{
+ return MODULE_GetProcAddress( hModule, function, TRUE );
+}
+
+/***********************************************************************
+ * MODULE_GetProcAddress (internal)
+ */
+FARPROC MODULE_GetProcAddress(
+ HMODULE hModule, /* [in] current module handle */
+ LPCSTR function, /* [in] function to be looked up */
+ WIN_BOOL snoop )
+{
+ WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule );
+// WINE_MODREF *wm=local_wm;
+ FARPROC retproc;
+
+ if (HIWORD(function))
+ TRACE_(win32)("(%08lx,%s)\n",(DWORD)hModule,function);
+ else
+ TRACE_(win32)("(%08lx,%p)\n",(DWORD)hModule,function);
+ if (!wm) {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return (FARPROC)0;
+ }
+ switch (wm->type)
+ {
+ case MODULE32_PE:
+ retproc = PE_FindExportedFunction( wm, function, snoop );
+ if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND);
+ return retproc;
+#ifdef HAVE_LIBDL
+ case MODULE32_ELF:
+ retproc = (FARPROC) dlsym( wm->module, function);
+ if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND);
+ return retproc;
+#endif
+ default:
+ ERR("wine_modref type %d not handled.\n",wm->type);
+ SetLastError(ERROR_INVALID_HANDLE);
+ return (FARPROC)0;
+ }
+}
+
diff --git a/loader/pe_image.c b/loader/pe_image.c
new file mode 100644
index 0000000000..cc8eef6746
--- /dev/null
+++ b/loader/pe_image.c
@@ -0,0 +1,936 @@
+/*
+ * Copyright 1994 Eric Youndale & Erik Bos
+ * Copyright 1995 Martin von Löwis
+ * Copyright 1996-98 Marcus Meissner
+ *
+ * based on Eric Youndale's pe-test and:
+ *
+ * ftp.microsoft.com:/pub/developer/MSDN/CD8/PEFILE.ZIP
+ * make that:
+ * ftp.microsoft.com:/developr/MSDN/OctCD/PEFILE.ZIP
+ */
+/* Notes:
+ * Before you start changing something in this file be aware of the following:
+ *
+ * - There are several functions called recursively. In a very subtle and
+ * obscure way. DLLs can reference each other recursively etc.
+ * - If you want to enhance, speed up or clean up something in here, think
+ * twice WHY it is implemented in that strange way. There is usually a reason.
+ * Though sometimes it might just be lazyness ;)
+ * - In PE_MapImage, right before fixup_imports() all external and internal
+ * state MUST be correct since this function can be called with the SAME image
+ * AGAIN. (Thats recursion for you.) That means MODREF.module and
+ * NE_MODULE.module32.
+ * - Sometimes, we can't use Linux mmap() to mmap() the images directly.
+ *
+ * The problem is, that there is not direct 1:1 mapping from a diskimage and
+ * a memoryimage. The headers at the start are mapped linear, but the sections
+ * are not. Older x86 pe binaries are 512 byte aligned in file and 4096 byte
+ * aligned in memory. Linux likes them 4096 byte aligned in memory (due to
+ * x86 pagesize, this cannot be fixed without a rather large kernel rewrite)
+ * and 'blocksize' file-aligned (offsets). Since we have 512/1024/2048 (CDROM)
+ * and other byte blocksizes, we can't always do this. We *can* do this for
+ * newer pe binaries produced by MSVC 5 and later, since they are also aligned
+ * to 4096 byte boundaries on disk.
+ */
+#include <config.h>
+#include <wine/config.h>
+
+#include <errno.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+#include <wine/windef.h>
+#include <wine/winbase.h>
+#include <wine/winerror.h>
+#include <wine/heap.h>
+#include <wine/pe_image.h>
+#include <wine/module.h>
+#include <wine/debugtools.h>
+
+#include "win32.h"
+
+#define RVA(x) ((void *)((char *)load_addr+(unsigned int)(x)))
+
+#define AdjustPtr(ptr,delta) ((char *)(ptr) + (delta))
+
+extern void* LookupExternal(const char* library, int ordinal);
+extern void* LookupExternalByName(const char* library, const char* name);
+
+void dump_exports( HMODULE hModule )
+{
+ char *Module;
+ int i, j;
+ u_short *ordinal;
+ u_long *function,*functions;
+ u_char **name;
+ unsigned int load_addr = hModule;
+
+ DWORD rva_start = PE_HEADER(hModule)->OptionalHeader
+ .DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
+ DWORD rva_end = rva_start + PE_HEADER(hModule)->OptionalHeader
+ .DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size;
+ IMAGE_EXPORT_DIRECTORY *pe_exports = (IMAGE_EXPORT_DIRECTORY*)RVA(rva_start);
+
+ Module = (char*)RVA(pe_exports->Name);
+ TRACE("*******EXPORT DATA*******\n");
+ TRACE("Module name is %s, %ld functions, %ld names\n",
+ Module, pe_exports->NumberOfFunctions, pe_exports->NumberOfNames);
+
+ ordinal=(u_short*) RVA(pe_exports->AddressOfNameOrdinals);
+ functions=function=(u_long*) RVA(pe_exports->AddressOfFunctions);
+ name=(u_char**) RVA(pe_exports->AddressOfNames);
+
+ TRACE(" Ord RVA Addr Name\n" );
+ for (i=0;i<pe_exports->NumberOfFunctions;i++, function++)
+ {
+ if (!*function) continue;
+ if (TRACE_ON(win32))
+ {
+ DPRINTF( "%4ld %08lx %p", i + pe_exports->Base, *function, RVA(*function) );
+
+ for (j = 0; j < pe_exports->NumberOfNames; j++)
+ if (ordinal[j] == i)
+ {
+ DPRINTF( " %s", (char*)RVA(name[j]) );
+ break;
+ }
+ if ((*function >= rva_start) && (*function <= rva_end))
+ DPRINTF(" (forwarded -> %s)", (char *)RVA(*function));
+ DPRINTF("\n");
+ }
+ }
+}
+
+/* Look up the specified function or ordinal in the exportlist:
+ * If it is a string:
+ * - look up the name in the Name list.
+ * - look up the ordinal with that index.
+ * - use the ordinal as offset into the functionlist
+ * If it is a ordinal:
+ * - use ordinal-pe_export->Base as offset into the functionlist
+ */
+FARPROC PE_FindExportedFunction(
+ WINE_MODREF *wm,
+ LPCSTR funcName,
+ WIN_BOOL snoop )
+{
+ u_short * ordinals;
+ u_long * function;
+ u_char ** name, *ename = NULL;
+ int i, ordinal;
+ PE_MODREF *pem = &(wm->binfmt.pe);
+ IMAGE_EXPORT_DIRECTORY *exports = pem->pe_export;
+ unsigned int load_addr = wm->module;
+ u_long rva_start, rva_end, addr;
+ char * forward;
+
+ if (HIWORD(funcName))
+ TRACE("(%s)\n",funcName);
+ else
+ TRACE("(%d)\n",(int)funcName);
+ if (!exports) {
+ /* Not a fatal problem, some apps do
+ * GetProcAddress(0,"RegisterPenApp") which triggers this
+ * case.
+ */
+ WARN("Module %08x(%s)/MODREF %p doesn't have a exports table.\n",wm->module,wm->modname,pem);
+ return NULL;
+ }
+ ordinals= (u_short*) RVA(exports->AddressOfNameOrdinals);
+ function= (u_long*) RVA(exports->AddressOfFunctions);
+ name = (u_char **) RVA(exports->AddressOfNames);
+ forward = NULL;
+ rva_start = PE_HEADER(wm->module)->OptionalHeader
+ .DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
+ rva_end = rva_start + PE_HEADER(wm->module)->OptionalHeader
+ .DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size;
+
+ if (HIWORD(funcName))
+ {
+
+ int min = 0, max = exports->NumberOfNames - 1;
+ while (min <= max)
+ {
+ int res, pos = (min + max) / 2;
+ ename = RVA(name[pos]);
+ if (!(res = strcmp( ename, funcName )))
+ {
+ ordinal = ordinals[pos];
+ goto found;
+ }
+ if (res > 0) max = pos - 1;
+ else min = pos + 1;
+ }
+
+ for (i = 0; i < exports->NumberOfNames; i++)
+ {
+ ename = RVA(name[i]);
+ if (!strcmp( ename, funcName ))
+ {
+ ERR( "%s.%s required a linear search\n", wm->modname, funcName );
+ ordinal = ordinals[i];
+ goto found;
+ }
+ }
+ return NULL;
+ }
+ else
+ {
+ ordinal = LOWORD(funcName) - exports->Base;
+ if (snoop && name)
+ {
+ for (i = 0; i < exports->NumberOfNames; i++)
+ if (ordinals[i] == ordinal)
+ {
+ ename = RVA(name[i]);
+ break;
+ }
+ }
+ }
+
+ found:
+ if (ordinal >= exports->NumberOfFunctions)
+ {
+ TRACE(" ordinal %ld out of range!\n", ordinal + exports->Base );
+ return NULL;
+ }
+ addr = function[ordinal];
+ if (!addr) return NULL;
+ if ((addr < rva_start) || (addr >= rva_end))
+ {
+ FARPROC proc = RVA(addr);
+ if (snoop)
+ {
+ if (!ename) ename = "@";
+// proc = SNOOP_GetProcAddress(wm->module,ename,ordinal,proc);
+ TRACE("SNOOP_GetProcAddress n/a\n");
+
+ }
+ return proc;
+ }
+ else
+ {
+ WINE_MODREF *wm;
+ char *forward = RVA(addr);
+ char module[256];
+ char *end = strchr(forward, '.');
+
+ if (!end) return NULL;
+ if (end - forward >= sizeof(module)) return NULL;
+ memcpy( module, forward, end - forward );
+ module[end-forward] = 0;
+ if (!(wm = MODULE_FindModule( module )))
+ {
+ ERR("module not found for forward '%s'\n", forward );
+ return NULL;
+ }
+ return MODULE_GetProcAddress( wm->module, end + 1, snoop );
+ }
+}
+
+DWORD fixup_imports( WINE_MODREF *wm )
+{
+ IMAGE_IMPORT_DESCRIPTOR *pe_imp;
+ PE_MODREF *pem;
+ unsigned int load_addr = wm->module;
+ int i,characteristics_detection=1;
+ char *modname;
+
+ assert(wm->type==MODULE32_PE);
+ pem = &(wm->binfmt.pe);
+ if (pem->pe_export)
+ modname = (char*) RVA(pem->pe_export->Name);
+ else
+ modname = "<unknown>";
+
+
+ TRACE("Dumping imports list\n");
+
+
+ pe_imp = pem->pe_import;
+ if (!pe_imp) return 0;
+
+ /* We assume that we have at least one import with !0 characteristics and
+ * detect broken imports with all characteristsics 0 (notably Borland) and
+ * switch the detection off for them.
+ */
+ for (i = 0; pe_imp->Name ; pe_imp++) {
+ if (!i && !pe_imp->u.Characteristics)
+ characteristics_detection = 0;
+ if (characteristics_detection && !pe_imp->u.Characteristics)
+ break;
+ i++;
+ }
+ if (!i) return 0;
+
+
+ wm->nDeps = i;
+ wm->deps = HeapAlloc( GetProcessHeap(), 0, i*sizeof(WINE_MODREF *) );
+
+ /* load the imported modules. They are automatically
+ * added to the modref list of the process.
+ */
+
+ for (i = 0, pe_imp = pem->pe_import; pe_imp->Name ; pe_imp++) {
+ WINE_MODREF *wmImp;
+ IMAGE_IMPORT_BY_NAME *pe_name;
+ PIMAGE_THUNK_DATA import_list,thunk_list;
+ char *name = (char *) RVA(pe_imp->Name);
+
+ if (characteristics_detection && !pe_imp->u.Characteristics)
+ break;
+
+//#warning FIXME: here we should fill imports
+ TRACE("Loading imports for %s.dll\n", name);
+
+ if (pe_imp->u.OriginalFirstThunk != 0) {
+ TRACE("Microsoft style imports used\n");
+ import_list =(PIMAGE_THUNK_DATA) RVA(pe_imp->u.OriginalFirstThunk);
+ thunk_list = (PIMAGE_THUNK_DATA) RVA(pe_imp->FirstThunk);
+
+ while (import_list->u1.Ordinal) {
+ if (IMAGE_SNAP_BY_ORDINAL(import_list->u1.Ordinal)) {
+ int ordinal = IMAGE_ORDINAL(import_list->u1.Ordinal);
+
+// TRACE("--- Ordinal %s,%d\n", name, ordinal);
+
+ thunk_list->u1.Function=LookupExternal(
+ name, ordinal);
+ } else {
+ pe_name = (PIMAGE_IMPORT_BY_NAME)RVA(import_list->u1.AddressOfData);
+// TRACE("--- %s %s.%d\n", pe_name->Name, name, pe_name->Hint);
+ thunk_list->u1.Function=LookupExternalByName(
+ name, pe_name->Name);
+ }
+ import_list++;
+ thunk_list++;
+ }
+ } else {
+ TRACE("Borland style imports used\n");
+ thunk_list = (PIMAGE_THUNK_DATA) RVA(pe_imp->FirstThunk);
+ while (thunk_list->u1.Ordinal) {
+ if (IMAGE_SNAP_BY_ORDINAL(thunk_list->u1.Ordinal)) {
+
+ int ordinal = IMAGE_ORDINAL(thunk_list->u1.Ordinal);
+
+ TRACE("--- Ordinal %s.%d\n",name,ordinal);
+ thunk_list->u1.Function=LookupExternal(
+ name, ordinal);
+ } else {
+ pe_name=(PIMAGE_IMPORT_BY_NAME) RVA(thunk_list->u1.AddressOfData);
+ TRACE("--- %s %s.%d\n",
+ pe_name->Name,name,pe_name->Hint);
+ thunk_list->u1.Function=LookupExternalByName(
+ name, pe_name->Name);
+ }
+ thunk_list++;
+ }
+ }
+
+
+ }
+ return 0;
+}
+
+static int calc_vma_size( HMODULE hModule )
+{
+ int i,vma_size = 0;
+ IMAGE_SECTION_HEADER *pe_seg = PE_SECTIONS(hModule);
+
+ TRACE("Dump of segment table\n");
+ TRACE(" Name VSz Vaddr SzRaw Fileadr *Reloc *Lineum #Reloc #Linum Char\n");
+ for (i = 0; i< PE_HEADER(hModule)->FileHeader.NumberOfSections; i++)
+ {
+ TRACE("%8s: %4.4lx %8.8lx %8.8lx %8.8lx %8.8lx %8.8lx %4.4x %4.4x %8.8lx\n",
+ pe_seg->Name,
+ pe_seg->Misc.VirtualSize,
+ pe_seg->VirtualAddress,
+ pe_seg->SizeOfRawData,
+ pe_seg->PointerToRawData,
+ pe_seg->PointerToRelocations,
+ pe_seg->PointerToLinenumbers,
+ pe_seg->NumberOfRelocations,
+ pe_seg->NumberOfLinenumbers,
+ pe_seg->Characteristics);
+ vma_size=max(vma_size, pe_seg->VirtualAddress+pe_seg->SizeOfRawData);
+ vma_size=max(vma_size, pe_seg->VirtualAddress+pe_seg->Misc.VirtualSize);
+ pe_seg++;
+ }
+ return vma_size;
+}
+
+static void do_relocations( unsigned int load_addr, IMAGE_BASE_RELOCATION *r )
+{
+ int delta = load_addr - PE_HEADER(load_addr)->OptionalHeader.ImageBase;
+ int hdelta = (delta >> 16) & 0xFFFF;
+ int ldelta = delta & 0xFFFF;
+
+ if(delta == 0)
+
+ return;
+ while(r->VirtualAddress)
+ {
+ char *page = (char*) RVA(r->VirtualAddress);
+ int count = (r->SizeOfBlock - 8)/2;
+ int i;
+ TRACE_(fixup)("%x relocations for page %lx\n",
+ count, r->VirtualAddress);
+
+ for(i=0;i<count;i++)
+ {
+ int offset = r->TypeOffset[i] & 0xFFF;
+ int type = r->TypeOffset[i] >> 12;
+// TRACE_(fixup)("patching %x type %x\n", offset, type);
+ switch(type)
+ {
+ case IMAGE_REL_BASED_ABSOLUTE: break;
+ case IMAGE_REL_BASED_HIGH:
+ *(short*)(page+offset) += hdelta;
+ break;
+ case IMAGE_REL_BASED_LOW:
+ *(short*)(page+offset) += ldelta;
+ break;
+ case IMAGE_REL_BASED_HIGHLOW:
+ *(int*)(page+offset) += delta;
+
+ break;
+ case IMAGE_REL_BASED_HIGHADJ:
+ FIXME("Don't know what to do with IMAGE_REL_BASED_HIGHADJ\n");
+ break;
+ case IMAGE_REL_BASED_MIPS_JMPADDR:
+ FIXME("Is this a MIPS machine ???\n");
+ break;
+ default:
+ FIXME("Unknown fixup type\n");
+ break;
+ }
+ }
+ r = (IMAGE_BASE_RELOCATION*)((char*)r + r->SizeOfBlock);
+ }
+}
+
+
+
+
+
+/**********************************************************************
+ * PE_LoadImage
+ * Load one PE format DLL/EXE into memory
+ *
+ * Unluckily we can't just mmap the sections where we want them, for
+ * (at least) Linux does only support offsets which are page-aligned.
+ *
+ * BUT we have to map the whole image anyway, for Win32 programs sometimes
+ * want to access them. (HMODULE32 point to the start of it)
+ */
+HMODULE PE_LoadImage( int handle, LPCSTR filename, WORD *version )
+{
+ HMODULE hModule;
+ HANDLE mapping;
+
+ IMAGE_NT_HEADERS *nt;
+ IMAGE_SECTION_HEADER *pe_sec;
+ IMAGE_DATA_DIRECTORY *dir;
+ BY_HANDLE_FILE_INFORMATION bhfi;
+ int i, rawsize, lowest_va, vma_size, file_size = 0;
+ DWORD load_addr = 0, aoep, reloc = 0;
+// struct get_read_fd_request *req = get_req_buffer();
+ int unix_handle = handle;
+ int page_size = getpagesize();
+
+
+// if ( GetFileInformationByHandle( hFile, &bhfi ) )
+// file_size = bhfi.nFileSizeLow;
+ file_size=lseek(handle, 0, SEEK_END);
+ lseek(handle, 0, SEEK_SET);
+
+//#warning fix CreateFileMappingA
+ mapping = CreateFileMappingA( handle, NULL, PAGE_READONLY | SEC_COMMIT,
+ 0, 0, NULL );
+ if (!mapping)
+ {
+ WARN("CreateFileMapping error %ld\n", GetLastError() );
+ return 0;
+ }
+// hModule = (HMODULE)MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
+ hModule=(HMODULE)mapping;
+// CloseHandle( mapping );
+ if (!hModule)
+ {
+ WARN("MapViewOfFile error %ld\n", GetLastError() );
+ return 0;
+ }
+ if ( *(WORD*)hModule !=IMAGE_DOS_SIGNATURE)
+ {
+ WARN("%s image doesn't have DOS signature, but 0x%04x\n", filename,*(WORD*)hModule);
+ goto error;
+ }
+
+ nt = PE_HEADER( hModule );
+
+
+ if ( nt->Signature != IMAGE_NT_SIGNATURE )
+ {
+ WARN("%s image doesn't have PE signature, but 0x%08lx\n", filename, nt->Signature );
+ goto error;
+ }
+
+
+ if ( nt->FileHeader.Machine != IMAGE_FILE_MACHINE_I386 )
+ {
+ MESSAGE("Trying to load PE image for unsupported architecture (");
+ switch (nt->FileHeader.Machine)
+ {
+ case IMAGE_FILE_MACHINE_UNKNOWN: MESSAGE("Unknown"); break;
+ case IMAGE_FILE_MACHINE_I860: MESSAGE("I860"); break;
+ case IMAGE_FILE_MACHINE_R3000: MESSAGE("R3000"); break;
+ case IMAGE_FILE_MACHINE_R4000: MESSAGE("R4000"); break;
+ case IMAGE_FILE_MACHINE_R10000: MESSAGE("R10000"); break;
+ case IMAGE_FILE_MACHINE_ALPHA: MESSAGE("Alpha"); break;
+ case IMAGE_FILE_MACHINE_POWERPC: MESSAGE("PowerPC"); break;
+ default: MESSAGE("Unknown-%04x", nt->FileHeader.Machine); break;
+ }
+ MESSAGE(")\n");
+ goto error;
+ }
+
+
+ pe_sec = PE_SECTIONS( hModule );
+ rawsize = 0; lowest_va = 0x10000;
+ for (i = 0; i < nt->FileHeader.NumberOfSections; i++)
+ {
+ if (lowest_va > pe_sec[i].VirtualAddress)
+ lowest_va = pe_sec[i].VirtualAddress;
+ if (pe_sec[i].Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA)
+ continue;
+ if (pe_sec[i].PointerToRawData+pe_sec[i].SizeOfRawData > rawsize)
+ rawsize = pe_sec[i].PointerToRawData+pe_sec[i].SizeOfRawData;
+ }
+
+
+ if ( file_size && file_size < rawsize )
+ {
+ ERR("PE module is too small (header: %d, filesize: %d), "
+ "probably truncated download?\n",
+ rawsize, file_size );
+ goto error;
+ }
+
+
+ aoep = nt->OptionalHeader.AddressOfEntryPoint;
+ if (aoep && (aoep < lowest_va))
+ FIXME("VIRUS WARNING: '%s' has an invalid entrypoint (0x%08lx) "
+ "below the first virtual address (0x%08x) "
+ "(possibly infected by Tchernobyl/SpaceFiller virus)!\n",
+ filename, aoep, lowest_va );
+
+
+ /* FIXME: Hack! While we don't really support shared sections yet,
+ * this checks for those special cases where the whole DLL
+ * consists only of shared sections and is mapped into the
+ * shared address space > 2GB. In this case, we assume that
+ * the module got mapped at its base address. Thus we simply
+ * check whether the module has actually been mapped there
+ * and use it, if so. This is needed to get Win95 USER32.DLL
+ * to work (until we support shared sections properly).
+ */
+
+ if ( nt->OptionalHeader.ImageBase & 0x80000000 )
+ {
+ HMODULE sharedMod = (HMODULE)nt->OptionalHeader.ImageBase;
+ IMAGE_NT_HEADERS *sharedNt = (PIMAGE_NT_HEADERS)
+ ( (LPBYTE)sharedMod + ((LPBYTE)nt - (LPBYTE)hModule) );
+
+ /* Well, this check is not really comprehensive,
+ but should be good enough for now ... */
+ if ( !IsBadReadPtr( (LPBYTE)sharedMod, sizeof(IMAGE_DOS_HEADER) )
+ && memcmp( (LPBYTE)sharedMod, (LPBYTE)hModule, sizeof(IMAGE_DOS_HEADER) ) == 0
+ && !IsBadReadPtr( sharedNt, sizeof(IMAGE_NT_HEADERS) )
+ && memcmp( sharedNt, nt, sizeof(IMAGE_NT_HEADERS) ) == 0 )
+ {
+ UnmapViewOfFile( (LPVOID)hModule );
+ return sharedMod;
+ }
+ }
+
+
+
+ load_addr = nt->OptionalHeader.ImageBase;
+ vma_size = calc_vma_size( hModule );
+
+ load_addr = (DWORD)VirtualAlloc( (void*)load_addr, vma_size,
+ MEM_RESERVE | MEM_COMMIT,
+ PAGE_EXECUTE_READWRITE );
+ if (load_addr == 0)
+ {
+
+ FIXME("We need to perform base relocations for %s\n", filename);
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_BASERELOC;
+ if (dir->Size)
+ reloc = dir->VirtualAddress;
+ else
+ {
+ FIXME( "FATAL: Need to relocate %s, but no relocation records present (%s). Try to run that file directly !\n",
+ filename,
+ (nt->FileHeader.Characteristics&IMAGE_FILE_RELOCS_STRIPPED)?
+ "stripped during link" : "unknown reason" );
+ goto error;
+ }
+
+ /* FIXME: If we need to relocate a system DLL (base > 2GB) we should
+ * really make sure that the *new* base address is also > 2GB.
+ * Some DLLs really check the MSB of the module handle :-/
+ */
+ if ( nt->OptionalHeader.ImageBase & 0x80000000 )
+ ERR( "Forced to relocate system DLL (base > 2GB). This is not good.\n" );
+
+ load_addr = (DWORD)VirtualAlloc( NULL, vma_size,
+ MEM_RESERVE | MEM_COMMIT,
+ PAGE_EXECUTE_READWRITE );
+ if (!load_addr) {
+ FIXME_(win32)(
+ "FATAL: Couldn't load module %s (out of memory, %d needed)!\n", filename, vma_size);
+ goto error;
+ }
+ }
+
+ TRACE("Load addr is %lx (base %lx), range %x\n",
+ load_addr, nt->OptionalHeader.ImageBase, vma_size );
+ TRACE_(segment)("Loading %s at %lx, range %x\n",
+ filename, load_addr, vma_size );
+
+#if 0
+
+ *(PIMAGE_DOS_HEADER)load_addr = *(PIMAGE_DOS_HEADER)hModule;
+ *PE_HEADER( load_addr ) = *nt;
+ memcpy( PE_SECTIONS(load_addr), PE_SECTIONS(hModule),
+ sizeof(IMAGE_SECTION_HEADER) * nt->FileHeader.NumberOfSections );
+
+
+ memcpy( load_addr, hModule, lowest_fa );
+#endif
+
+ if ((void*)FILE_dommap( handle, (void *)load_addr, 0, nt->OptionalHeader.SizeOfHeaders,
+ 0, 0, PROT_EXEC | PROT_WRITE | PROT_READ,
+ MAP_PRIVATE | MAP_FIXED ) != (void*)load_addr)
+ {
+ ERR_(win32)( "Critical Error: failed to map PE header to necessary address.\n");
+ goto error;
+ }
+
+
+ pe_sec = PE_SECTIONS( hModule );
+ for (i = 0; i < nt->FileHeader.NumberOfSections; i++, pe_sec++)
+ {
+ if (!pe_sec->SizeOfRawData || !pe_sec->PointerToRawData) continue;
+ TRACE("%s: mmaping section %s at %p off %lx size %lx/%lx\n",
+ filename, pe_sec->Name, (void*)RVA(pe_sec->VirtualAddress),
+ pe_sec->PointerToRawData, pe_sec->SizeOfRawData, pe_sec->Misc.VirtualSize );
+ if ((void*)FILE_dommap( unix_handle, (void*)RVA(pe_sec->VirtualAddress),
+ 0, pe_sec->SizeOfRawData, 0, pe_sec->PointerToRawData,
+ PROT_EXEC | PROT_WRITE | PROT_READ,
+ MAP_PRIVATE | MAP_FIXED ) != (void*)RVA(pe_sec->VirtualAddress))
+ {
+
+ ERR_(win32)( "Critical Error: failed to map PE section to necessary address.\n");
+ goto error;
+ }
+ if ((pe_sec->SizeOfRawData < pe_sec->Misc.VirtualSize) &&
+ (pe_sec->SizeOfRawData & (page_size-1)))
+ {
+ DWORD end = (pe_sec->SizeOfRawData & ~(page_size-1)) + page_size;
+ if (end > pe_sec->Misc.VirtualSize) end = pe_sec->Misc.VirtualSize;
+ TRACE("clearing %p - %p\n",
+ RVA(pe_sec->VirtualAddress) + pe_sec->SizeOfRawData,
+ RVA(pe_sec->VirtualAddress) + end );
+ memset( (char*)RVA(pe_sec->VirtualAddress) + pe_sec->SizeOfRawData, 0,
+ end - pe_sec->SizeOfRawData );
+ }
+ }
+
+
+ if ( reloc )
+ do_relocations( load_addr, (IMAGE_BASE_RELOCATION *)RVA(reloc) );
+
+
+ *version = ( (nt->OptionalHeader.MajorSubsystemVersion & 0xff) << 8 )
+ | (nt->OptionalHeader.MinorSubsystemVersion & 0xff);
+
+
+ UnmapViewOfFile( (LPVOID)hModule );
+ return (HMODULE)load_addr;
+
+error:
+ if (unix_handle != -1) close( unix_handle );
+ if (load_addr) VirtualFree( (LPVOID)load_addr, 0, MEM_RELEASE );
+ UnmapViewOfFile( (LPVOID)hModule );
+ return 0;
+}
+
+/**********************************************************************
+ * PE_CreateModule
+ *
+ * Create WINE_MODREF structure for loaded HMODULE32, link it into
+ * process modref_list, and fixup all imports.
+ *
+ * Note: hModule must point to a correctly allocated PE image,
+ * with base relocations applied; the 16-bit dummy module
+ * associated to hModule must already exist.
+ *
+ * Note: This routine must always be called in the context of the
+ * process that is to own the module to be created.
+ */
+WINE_MODREF *PE_CreateModule( HMODULE hModule,
+ LPCSTR filename, DWORD flags, WIN_BOOL builtin )
+{
+ DWORD load_addr = (DWORD)hModule;
+ IMAGE_NT_HEADERS *nt = PE_HEADER(hModule);
+ IMAGE_DATA_DIRECTORY *dir;
+ IMAGE_IMPORT_DESCRIPTOR *pe_import = NULL;
+ IMAGE_EXPORT_DIRECTORY *pe_export = NULL;
+ IMAGE_RESOURCE_DIRECTORY *pe_resource = NULL;
+ WINE_MODREF *wm;
+ int result;
+
+
+
+
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_EXPORT;
+ if (dir->Size)
+ pe_export = (PIMAGE_EXPORT_DIRECTORY)RVA(dir->VirtualAddress);
+
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_IMPORT;
+ if (dir->Size)
+ pe_import = (PIMAGE_IMPORT_DESCRIPTOR)RVA(dir->VirtualAddress);
+
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_RESOURCE;
+ if (dir->Size)
+ pe_resource = (PIMAGE_RESOURCE_DIRECTORY)RVA(dir->VirtualAddress);
+
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_EXCEPTION;
+ if (dir->Size) FIXME("Exception directory ignored\n" );
+
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_SECURITY;
+ if (dir->Size) FIXME("Security directory ignored\n" );
+
+
+
+
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_DEBUG;
+ if (dir->Size) TRACE("Debug directory ignored\n" );
+
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_COPYRIGHT;
+ if (dir->Size) FIXME("Copyright string ignored\n" );
+
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_GLOBALPTR;
+ if (dir->Size) FIXME("Global Pointer (MIPS) ignored\n" );
+
+
+
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG;
+ if (dir->Size) FIXME("Load Configuration directory ignored\n" );
+
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT;
+ if (dir->Size) TRACE("Bound Import directory ignored\n" );
+
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_IAT;
+ if (dir->Size) TRACE("Import Address Table directory ignored\n" );
+
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT;
+ if (dir->Size)
+ {
+ TRACE("Delayed import, stub calls LoadLibrary\n" );
+ /*
+ * Nothing to do here.
+ */
+
+#ifdef ImgDelayDescr
+ /*
+ * This code is useful to observe what the heck is going on.
+ */
+ {
+ ImgDelayDescr *pe_delay = NULL;
+ pe_delay = (PImgDelayDescr)RVA(dir->VirtualAddress);
+ TRACE_(delayhlp)("pe_delay->grAttrs = %08x\n", pe_delay->grAttrs);
+ TRACE_(delayhlp)("pe_delay->szName = %s\n", pe_delay->szName);
+ TRACE_(delayhlp)("pe_delay->phmod = %08x\n", pe_delay->phmod);
+ TRACE_(delayhlp)("pe_delay->pIAT = %08x\n", pe_delay->pIAT);
+ TRACE_(delayhlp)("pe_delay->pINT = %08x\n", pe_delay->pINT);
+ TRACE_(delayhlp)("pe_delay->pBoundIAT = %08x\n", pe_delay->pBoundIAT);
+ TRACE_(delayhlp)("pe_delay->pUnloadIAT = %08x\n", pe_delay->pUnloadIAT);
+ TRACE_(delayhlp)("pe_delay->dwTimeStamp = %08x\n", pe_delay->dwTimeStamp);
+ }
+#endif
+ }
+
+ dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR;
+ if (dir->Size) FIXME("Unknown directory 14 ignored\n" );
+
+ dir = nt->OptionalHeader.DataDirectory+15;
+ if (dir->Size) FIXME("Unknown directory 15 ignored\n" );
+
+
+
+
+ wm = (WINE_MODREF *)HeapAlloc( GetProcessHeap(),
+ HEAP_ZERO_MEMORY, sizeof(*wm) );
+ wm->module = hModule;
+
+ if ( builtin )
+ wm->flags |= WINE_MODREF_INTERNAL;
+ if ( flags & DONT_RESOLVE_DLL_REFERENCES )
+ wm->flags |= WINE_MODREF_DONT_RESOLVE_REFS;
+ if ( flags & LOAD_LIBRARY_AS_DATAFILE )
+ wm->flags |= WINE_MODREF_LOAD_AS_DATAFILE;
+
+ wm->type = MODULE32_PE;
+ wm->binfmt.pe.pe_export = pe_export;
+ wm->binfmt.pe.pe_import = pe_import;
+ wm->binfmt.pe.pe_resource = pe_resource;
+ wm->binfmt.pe.tlsindex = -1;
+
+ wm->filename = malloc(strlen(filename)+1);
+ strcpy(wm->filename, filename );
+ wm->modname = strrchr( wm->filename, '\\' );
+ if (!wm->modname) wm->modname = wm->filename;
+ else wm->modname++;
+
+ if ( pe_export )
+ dump_exports( hModule );
+
+ /* Fixup Imports */
+
+ if ( pe_import
+ && !( wm->flags & WINE_MODREF_LOAD_AS_DATAFILE )
+ && !( wm->flags & WINE_MODREF_DONT_RESOLVE_REFS )
+ && fixup_imports( wm ) )
+ {
+ /* remove entry from modref chain */
+ return NULL;
+ }
+
+ return wm;
+
+ return wm;
+}
+
+/******************************************************************************
+ * The PE Library Loader frontend.
+ * FIXME: handle the flags.
+ */
+WINE_MODREF *PE_LoadLibraryExA (LPCSTR name, DWORD flags)
+{
+ HMODULE hModule32;
+ WINE_MODREF *wm;
+ char filename[256];
+ int hFile;
+ WORD version = 0;
+
+
+ strncpy(filename, name, sizeof(filename));
+ hFile=open(filename, O_RDONLY);
+ if(hFile==-1)
+ return NULL;
+
+
+ hModule32 = PE_LoadImage( hFile, filename, &version );
+ if (!hModule32)
+ {
+ SetLastError( ERROR_OUTOFMEMORY );
+ return NULL;
+ }
+
+ if ( !(wm = PE_CreateModule( hModule32, filename, flags, FALSE )) )
+ {
+ ERR( "can't load %s\n", filename );
+ SetLastError( ERROR_OUTOFMEMORY );
+ return NULL;
+ }
+ close(hFile);
+ return wm;
+}
+
+
+/*****************************************************************************
+ * PE_UnloadLibrary
+ *
+ * Unload the library unmapping the image and freeing the modref structure.
+ */
+void PE_UnloadLibrary(WINE_MODREF *wm)
+{
+ TRACE(" unloading %s\n", wm->filename);
+
+ HeapFree( GetProcessHeap(), 0, wm->filename );
+ HeapFree( GetProcessHeap(), 0, wm->short_filename );
+ HeapFree( GetProcessHeap(), 0, wm );
+}
+
+/*****************************************************************************
+ * Load the PE main .EXE. All other loading is done by PE_LoadLibraryExA
+ * FIXME: this function should use PE_LoadLibraryExA, but currently can't
+ * due to the PROCESS_Create stuff.
+ */
+
+/* Called if the library is loaded or freed.
+ * NOTE: if a thread attaches a DLL, the current thread will only do
+ * DLL_PROCESS_ATTACH. Only new created threads do DLL_THREAD_ATTACH
+ * (SDK)
+ */
+WIN_BOOL PE_InitDLL( WINE_MODREF *wm, DWORD type, LPVOID lpReserved )
+{
+ WIN_BOOL retv = TRUE;
+ assert( wm->type == MODULE32_PE );
+
+
+ if ((PE_HEADER(wm->module)->FileHeader.Characteristics & IMAGE_FILE_DLL) &&
+ (PE_HEADER(wm->module)->OptionalHeader.AddressOfEntryPoint)
+ ) {
+ DLLENTRYPROC entry ;
+ entry = (void*)PE_FindExportedFunction(wm, "DllMain", 0);
+ if(entry==NULL)
+ entry = (void*)RVA_PTR( wm->module,OptionalHeader.AddressOfEntryPoint );
+
+ TRACE_(relay)("CallTo32(entryproc=%p,module=%08x,type=%ld,res=%p)\n",
+ entry, wm->module, type, lpReserved );
+ printf("Entering DllMain(");
+ switch(type)
+ {
+ case DLL_PROCESS_DETACH:
+ printf("DLL_PROCESS_DETACH) ");
+ break;
+ case DLL_PROCESS_ATTACH:
+ printf("DLL_PROCESS_ATTACH) ");
+ break;
+ case DLL_THREAD_DETACH:
+ printf("DLL_THREAD_DETACH) ");
+ break;
+ case DLL_THREAD_ATTACH:
+ printf("DLL_THREAD_ATTACH) ");
+ break;
+ }
+ printf("for %s\n", wm->filename);
+ retv = entry( wm->module, type, lpReserved );
+ }
+
+ return retv;
+}
+
+static LPVOID
+_fixup_address(PIMAGE_OPTIONAL_HEADER opt,int delta,LPVOID addr) {
+ if ( ((DWORD)addr>opt->ImageBase) &&
+ ((DWORD)addr<opt->ImageBase+opt->SizeOfImage)
+ )
+
+ return (LPVOID)(((DWORD)addr)+delta);
+ else
+
+ return addr;
+}
diff --git a/loader/pe_resource.c b/loader/pe_resource.c
new file mode 100644
index 0000000000..7edfac614b
--- /dev/null
+++ b/loader/pe_resource.c
@@ -0,0 +1,391 @@
+/*
+ * PE (Portable Execute) File Resources
+ *
+ * Copyright 1995 Thomas Sandford
+ * Copyright 1996 Martin von Loewis
+ *
+ * Based on the Win16 resource handling code in loader/resource.c
+ * Copyright 1993 Robert J. Amstadt
+ * Copyright 1995 Alexandre Julliard
+ * Copyright 1997 Marcus Meissner
+ */
+#include <config.h>
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <wine/winestring.h>
+#include <wine/windef.h>
+#include <wine/pe_image.h>
+#include <wine/module.h>
+#include <wine/heap.h>
+//#include "task.h"
+//#include "process.h"
+//#include "stackframe.h"
+#include <wine/debugtools.h>
+
+/**********************************************************************
+ * HMODULE32toPE_MODREF
+ *
+ * small helper function to get a PE_MODREF from a passed HMODULE32
+ */
+static PE_MODREF*
+HMODULE32toPE_MODREF(HMODULE hmod) {
+ WINE_MODREF *wm;
+
+ wm = MODULE32_LookupHMODULE( hmod );
+ if (!wm || wm->type!=MODULE32_PE)
+ return NULL;
+ return &(wm->binfmt.pe);
+}
+
+/**********************************************************************
+ * GetResDirEntryW
+ *
+ * Helper function - goes down one level of PE resource tree
+ *
+ */
+PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY resdirptr,
+ LPCWSTR name,DWORD root,
+ WIN_BOOL allowdefault)
+{
+ int entrynum;
+ PIMAGE_RESOURCE_DIRECTORY_ENTRY entryTable;
+ int namelen;
+
+ if (HIWORD(name)) {
+ if (name[0]=='#') {
+ char buf[10];
+
+ lstrcpynWtoA(buf,name+1,10);
+ return GetResDirEntryW(resdirptr,(LPCWSTR)atoi(buf),root,allowdefault);
+ }
+ entryTable = (PIMAGE_RESOURCE_DIRECTORY_ENTRY) (
+ (BYTE *) resdirptr +
+ sizeof(IMAGE_RESOURCE_DIRECTORY));
+ namelen = lstrlenW(name);
+ for (entrynum = 0; entrynum < resdirptr->NumberOfNamedEntries; entrynum++)
+ {
+ PIMAGE_RESOURCE_DIR_STRING_U str =
+ (PIMAGE_RESOURCE_DIR_STRING_U) (root +
+ entryTable[entrynum].u1.s.NameOffset);
+ if(namelen != str->Length)
+ continue;
+ if(wcsnicmp(name,str->NameString,str->Length)==0)
+ return (PIMAGE_RESOURCE_DIRECTORY) (
+ root +
+ entryTable[entrynum].u2.s.OffsetToDirectory);
+ }
+ return NULL;
+ } else {
+ entryTable = (PIMAGE_RESOURCE_DIRECTORY_ENTRY) (
+ (BYTE *) resdirptr +
+ sizeof(IMAGE_RESOURCE_DIRECTORY) +
+ resdirptr->NumberOfNamedEntries * sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY));
+ for (entrynum = 0; entrynum < resdirptr->NumberOfIdEntries; entrynum++)
+ if ((DWORD)entryTable[entrynum].u1.Name == (DWORD)name)
+ return (PIMAGE_RESOURCE_DIRECTORY) (
+ root +
+ entryTable[entrynum].u2.s.OffsetToDirectory);
+ /* just use first entry if no default can be found */
+ if (allowdefault && !name && resdirptr->NumberOfIdEntries)
+ return (PIMAGE_RESOURCE_DIRECTORY) (
+ root +
+ entryTable[0].u2.s.OffsetToDirectory);
+ return NULL;
+ }
+}
+
+/**********************************************************************
+ * GetResDirEntryA
+ */
+PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA( PIMAGE_RESOURCE_DIRECTORY resdirptr,
+ LPCSTR name, DWORD root,
+ WIN_BOOL allowdefault )
+{
+ PIMAGE_RESOURCE_DIRECTORY retv;
+ LPWSTR nameW = HIWORD(name)? HEAP_strdupAtoW( GetProcessHeap(), 0, name )
+ : (LPWSTR)name;
+
+ retv = GetResDirEntryW( resdirptr, nameW, root, allowdefault );
+
+ if ( HIWORD(name) ) HeapFree( GetProcessHeap(), 0, nameW );
+
+ return retv;
+}
+
+/**********************************************************************
+ * PE_FindResourceEx32W
+ */
+HANDLE PE_FindResourceExW(
+ WINE_MODREF *wm,LPCWSTR name,LPCWSTR type,WORD lang
+) {
+ PIMAGE_RESOURCE_DIRECTORY resdirptr;
+ DWORD root;
+ HANDLE result;
+ PE_MODREF *pem = &(wm->binfmt.pe);
+
+ if (!pem || !pem->pe_resource)
+ return 0;
+
+ resdirptr = pem->pe_resource;
+ root = (DWORD) resdirptr;
+ if ((resdirptr = GetResDirEntryW(resdirptr, type, root, FALSE)) == NULL)
+ return 0;
+ if ((resdirptr = GetResDirEntryW(resdirptr, name, root, FALSE)) == NULL)
+ return 0;
+ result = (HANDLE)GetResDirEntryW(resdirptr, (LPCWSTR)(UINT)lang, root, FALSE);
+ /* Try LANG_NEUTRAL, too */
+ if(!result)
+ return (HANDLE)GetResDirEntryW(resdirptr, (LPCWSTR)0, root, TRUE);
+ return result;
+}
+
+
+/**********************************************************************
+ * PE_LoadResource32
+ */
+HANDLE PE_LoadResource( WINE_MODREF *wm, HANDLE hRsrc )
+{
+ if (!hRsrc || !wm || wm->type!=MODULE32_PE)
+ return 0;
+ return (HANDLE) (wm->module + ((PIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->OffsetToData);
+}
+
+
+/**********************************************************************
+ * PE_SizeofResource32
+ */
+DWORD PE_SizeofResource( HINSTANCE hModule, HANDLE hRsrc )
+{
+ /* we don't need hModule */
+ if (!hRsrc)
+ return 0;
+ return ((PIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->Size;
+}
+
+/**********************************************************************
+ * PE_EnumResourceTypes32A
+ */
+WIN_BOOL
+PE_EnumResourceTypesA(HMODULE hmod,ENUMRESTYPEPROCA lpfun,LONG lparam) {
+ PE_MODREF *pem = HMODULE32toPE_MODREF(hmod);
+ int i;
+ PIMAGE_RESOURCE_DIRECTORY resdir;
+ PIMAGE_RESOURCE_DIRECTORY_ENTRY et;
+ WIN_BOOL ret;
+ HANDLE heap = GetProcessHeap();
+
+ if (!pem || !pem->pe_resource)
+ return FALSE;
+
+ resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
+ et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
+ ret = FALSE;
+ for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
+ LPSTR name;
+
+ if (et[i].u1.s.NameIsString)
+ name = HEAP_strdupWtoA(heap,0,(LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.s.NameOffset));
+ else
+ name = (LPSTR)(int)et[i].u1.Id;
+ ret = lpfun(hmod,name,lparam);
+ if (HIWORD(name))
+ HeapFree(heap,0,name);
+ if (!ret)
+ break;
+ }
+ return ret;
+}
+
+/**********************************************************************
+ * PE_EnumResourceTypes32W
+ */
+WIN_BOOL
+PE_EnumResourceTypesW(HMODULE hmod,ENUMRESTYPEPROCW lpfun,LONG lparam) {
+ PE_MODREF *pem = HMODULE32toPE_MODREF(hmod);
+ int i;
+ PIMAGE_RESOURCE_DIRECTORY resdir;
+ PIMAGE_RESOURCE_DIRECTORY_ENTRY et;
+ WIN_BOOL ret;
+
+ if (!pem || !pem->pe_resource)
+ return FALSE;
+
+ resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
+ et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
+ ret = FALSE;
+ for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
+ LPWSTR type;
+ if (et[i].u1.s.NameIsString)
+ type = (LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.s.NameOffset);
+ else
+ type = (LPWSTR)(int)et[i].u1.Id;
+
+ ret = lpfun(hmod,type,lparam);
+ if (!ret)
+ break;
+ }
+ return ret;
+}
+
+/**********************************************************************
+ * PE_EnumResourceNames32A
+ */
+WIN_BOOL
+PE_EnumResourceNamesA(
+ HMODULE hmod,LPCSTR type,ENUMRESNAMEPROCA lpfun,LONG lparam
+) {
+ PE_MODREF *pem = HMODULE32toPE_MODREF(hmod);
+ int i;
+ PIMAGE_RESOURCE_DIRECTORY resdir;
+ PIMAGE_RESOURCE_DIRECTORY_ENTRY et;
+ WIN_BOOL ret;
+ HANDLE heap = GetProcessHeap();
+ LPWSTR typeW;
+
+ if (!pem || !pem->pe_resource)
+ return FALSE;
+ resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
+ if (HIWORD(type))
+ typeW = HEAP_strdupAtoW(heap,0,type);
+ else
+ typeW = (LPWSTR)type;
+ resdir = GetResDirEntryW(resdir,typeW,(DWORD)pem->pe_resource,FALSE);
+ if (HIWORD(typeW))
+ HeapFree(heap,0,typeW);
+ if (!resdir)
+ return FALSE;
+ et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
+ ret = FALSE;
+ for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
+ LPSTR name;
+
+ if (et[i].u1.s.NameIsString)
+ name = HEAP_strdupWtoA(heap,0,(LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.s.NameOffset));
+ else
+ name = (LPSTR)(int)et[i].u1.Id;
+ ret = lpfun(hmod,type,name,lparam);
+ if (HIWORD(name)) HeapFree(heap,0,name);
+ if (!ret)
+ break;
+ }
+ return ret;
+}
+
+/**********************************************************************
+ * PE_EnumResourceNames32W
+ */
+WIN_BOOL
+PE_EnumResourceNamesW(
+ HMODULE hmod,LPCWSTR type,ENUMRESNAMEPROCW lpfun,LONG lparam
+) {
+ PE_MODREF *pem = HMODULE32toPE_MODREF(hmod);
+ int i;
+ PIMAGE_RESOURCE_DIRECTORY resdir;
+ PIMAGE_RESOURCE_DIRECTORY_ENTRY et;
+ WIN_BOOL ret;
+
+ if (!pem || !pem->pe_resource)
+ return FALSE;
+
+ resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
+ resdir = GetResDirEntryW(resdir,type,(DWORD)pem->pe_resource,FALSE);
+ if (!resdir)
+ return FALSE;
+ et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
+ ret = FALSE;
+ for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
+ LPWSTR name;
+ if (et[i].u1.s.NameIsString)
+ name = (LPWSTR)((LPBYTE)pem->pe_resource+et[i].u1.s.NameOffset);
+ else
+ name = (LPWSTR)(int)et[i].u1.Id;
+ ret = lpfun(hmod,type,name,lparam);
+ if (!ret)
+ break;
+ }
+ return ret;
+}
+
+/**********************************************************************
+ * PE_EnumResourceNames32A
+ */
+WIN_BOOL
+PE_EnumResourceLanguagesA(
+ HMODULE hmod,LPCSTR name,LPCSTR type,ENUMRESLANGPROCA lpfun,
+ LONG lparam
+) {
+ PE_MODREF *pem = HMODULE32toPE_MODREF(hmod);
+ int i;
+ PIMAGE_RESOURCE_DIRECTORY resdir;
+ PIMAGE_RESOURCE_DIRECTORY_ENTRY et;
+ WIN_BOOL ret;
+ HANDLE heap = GetProcessHeap();
+ LPWSTR nameW,typeW;
+
+ if (!pem || !pem->pe_resource)
+ return FALSE;
+
+ resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
+ if (HIWORD(name))
+ nameW = HEAP_strdupAtoW(heap,0,name);
+ else
+ nameW = (LPWSTR)name;
+ resdir = GetResDirEntryW(resdir,nameW,(DWORD)pem->pe_resource,FALSE);
+ if (HIWORD(nameW))
+ HeapFree(heap,0,nameW);
+ if (!resdir)
+ return FALSE;
+ if (HIWORD(type))
+ typeW = HEAP_strdupAtoW(heap,0,type);
+ else
+ typeW = (LPWSTR)type;
+ resdir = GetResDirEntryW(resdir,typeW,(DWORD)pem->pe_resource,FALSE);
+ if (HIWORD(typeW))
+ HeapFree(heap,0,typeW);
+ if (!resdir)
+ return FALSE;
+ et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
+ ret = FALSE;
+ for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
+ /* languages are just ids... I hopem */
+ ret = lpfun(hmod,name,type,et[i].u1.Id,lparam);
+ if (!ret)
+ break;
+ }
+ return ret;
+}
+
+/**********************************************************************
+ * PE_EnumResourceLanguages32W
+ */
+WIN_BOOL
+PE_EnumResourceLanguagesW(
+ HMODULE hmod,LPCWSTR name,LPCWSTR type,ENUMRESLANGPROCW lpfun,
+ LONG lparam
+) {
+ PE_MODREF *pem = HMODULE32toPE_MODREF(hmod);
+ int i;
+ PIMAGE_RESOURCE_DIRECTORY resdir;
+ PIMAGE_RESOURCE_DIRECTORY_ENTRY et;
+ WIN_BOOL ret;
+
+ if (!pem || !pem->pe_resource)
+ return FALSE;
+
+ resdir = (PIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
+ resdir = GetResDirEntryW(resdir,name,(DWORD)pem->pe_resource,FALSE);
+ if (!resdir)
+ return FALSE;
+ resdir = GetResDirEntryW(resdir,type,(DWORD)pem->pe_resource,FALSE);
+ if (!resdir)
+ return FALSE;
+ et =(PIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
+ ret = FALSE;
+ for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
+ ret = lpfun(hmod,name,type,et[i].u1.Id,lparam);
+ if (!ret)
+ break;
+ }
+ return ret;
+}
diff --git a/loader/registry.c b/loader/registry.c
new file mode 100644
index 0000000000..a8dfaa0e03
--- /dev/null
+++ b/loader/registry.c
@@ -0,0 +1,421 @@
+#include <config.h>
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <sys/types.h>
+
+#include <wine/winbase.h>
+#include <wine/winreg.h>
+#include <wine/winnt.h>
+#include <wine/winerror.h>
+
+#include <registry.h>
+
+struct reg_value
+{
+ int type;
+ char* name;
+ int len;
+ char* value;
+};
+
+static int reg_size=0;
+
+static struct reg_value* regs=0;
+
+struct reg_handle_s;
+typedef struct reg_handle_s
+{
+ int handle;
+ char* name;
+ struct reg_handle_s* next;
+ struct reg_handle_s* prev;
+} reg_handle_t;
+
+static reg_handle_t* head=0;
+
+#define DIR -25
+
+static void create_registry();
+static void open_registry();
+static void save_registry();
+
+
+
+
+static void create_registry(){
+ if(regs)
+ {
+ printf("Logic error: create_registry() called with existing registry\n");
+ save_registry();
+ return;
+ }
+ regs=(struct reg_value*)malloc(3*sizeof(struct reg_value));
+ regs[0].type=regs[1].type=DIR;
+ regs[0].name=(char*)malloc(5);
+ strcpy(regs[0].name, "HKLM");
+ regs[1].name=(char*)malloc(5);
+ strcpy(regs[1].name, "HKCU");
+ regs[0].value=regs[1].value=NULL;
+ regs[0].len=regs[1].len=0;
+ reg_size=2;
+ save_registry();
+}
+static void open_registry()
+{
+ int fd;
+ int i;
+ int len;
+ struct passwd* pwent;
+ char* pathname;
+ if(regs)
+ {
+ printf("Multiple open_registry(>\n");
+ return;
+ }
+ pwent=getpwuid(getuid());
+ pathname=(char*)malloc(strlen(pwent->pw_dir)+20);
+ strcpy(pathname, pwent->pw_dir);
+ strcat(pathname, "/.registry");
+ fd=open(pathname, O_RDONLY);
+ free(pathname);
+ if(fd==-1)
+ {
+ printf("Creating new registry\n");
+ create_registry();
+ return;
+ }
+ read(fd, &reg_size, 4);
+ regs=(struct reg_value*)malloc(reg_size*sizeof(struct reg_value));
+ for(i=0; i<reg_size; i++)
+ {
+ read(fd,&regs[i].type,4);
+ read(fd,&len,4);
+ regs[i].name=(char*)malloc(len+1);
+ if(regs[i].name==0)
+ {
+ reg_size=i+1;
+ goto error;
+ }
+ read(fd, regs[i].name, len);
+ regs[i].name[len]=0;
+ read(fd,&regs[i].len,4);
+ regs[i].value=(char*)malloc(regs[i].len+1);
+ if(regs[i].value==0)
+ {
+ free(regs[i].name);
+ reg_size=i+1;
+ goto error;
+ }
+ read(fd, regs[i].value, regs[i].len);
+ regs[i].value[regs[i].len]=0;
+ }
+error:
+ close(fd);
+ return;
+}
+
+static void save_registry()
+{
+ int fd, i, len;
+ struct passwd* pwent;
+ char* pathname;
+ pwent=getpwuid(getuid());
+ pathname=(char*)malloc(strlen(pwent->pw_dir)+20);
+ strcpy(pathname, pwent->pw_dir);
+ strcat(pathname, "/.registry");
+ fd=open(pathname, O_WRONLY | O_CREAT, 00777);
+ free(pathname);
+ if(fd==-1)
+ {
+ printf("Failed to open registry file for writing.\n");
+ return;
+ }
+ write(fd, &reg_size, 4);
+ for(i=0; i<reg_size; i++)
+ {
+ write(fd, &regs[i].type, 4);
+ len=strlen(regs[i].name);
+ write(fd, &len, 4);
+ write(fd, regs[i].name, len);
+ write(fd, &regs[i].len, 4);
+ write(fd, regs[i].value, regs[i].len);
+ }
+ close(fd);
+}
+static reg_handle_t* find_handle_by_name(const char* name)
+{
+ reg_handle_t* t;
+// printf("REGISTRY: find_handle_by_name(%s)\n",name);
+ for(t=head; t; t=t->prev)
+ {
+ if(!strcmp(t->name, name))
+ {
+ return t;
+ }
+ }
+ return 0;
+}
+static struct reg_value* find_value_by_name(const char* name)
+{
+ int i;
+// printf("REGISTRY: find_value_by_name(%s)\n",name);
+ for(i=0; i<reg_size; i++)
+ if(!strcmp(regs[i].name, name))
+ return regs+i;
+ return 0;
+}
+static reg_handle_t* find_handle(int handle)
+{
+ reg_handle_t* t;
+// printf("REGISTRY: find_handle(%d)\n",handle);
+ for(t=head; t; t=t->prev)
+ {
+ if(t->handle==handle)
+ {
+ return t;
+ }
+ }
+ return 0;
+}
+static int generate_handle()
+{
+ static int zz=249;
+ zz++;
+ while((zz==HKEY_LOCAL_MACHINE) || (zz==HKEY_CURRENT_USER))
+ zz++;
+ return zz;
+}
+
+static reg_handle_t* insert_handle(long handle, const char* name)
+{
+ reg_handle_t* t;
+ t=(reg_handle_t*)malloc(sizeof(reg_handle_t));
+ if(head==0)
+ {
+ t->prev=0;
+ }
+ else
+ {
+ head->next=t;
+ t->prev=head;
+ }
+ t->next=0;
+ t->name=(char*)malloc(strlen(name)+1);
+ strcpy(t->name, name);
+ t->handle=handle;
+ head=t;
+ return t;
+}
+static char* build_keyname(long key, const char* subkey)
+{
+ char* full_name;
+ reg_handle_t* t;
+ if((t=find_handle(key))==0)
+ {
+ TRACE("Invalid key\n");
+ return NULL;
+ }
+ if(subkey==NULL)
+ subkey="<default>";
+ full_name=(char*)malloc(strlen(t->name)+strlen(subkey)+10);
+ strcpy(full_name, t->name);
+ strcat(full_name, "\\");
+ strcat(full_name, subkey);
+ return full_name;
+}
+struct reg_value* insert_reg_value(int handle, const char* name, int type, const void* value, int len)
+{
+ reg_handle_t* t;
+ struct reg_value* v;
+ char* fullname;
+ if((fullname=build_keyname(handle, name))==NULL)
+ {
+ TRACE("Invalid handle\n");
+ return NULL;
+ }
+
+ if((v=find_value_by_name(fullname))==0)
+ //creating new value in registry
+ {
+ if(regs==0)
+ create_registry();
+ regs=(struct reg_value*)realloc(regs, sizeof(struct reg_value)*(reg_size+1));
+ v=regs+reg_size;
+ reg_size++;
+ }
+ else
+ //replacing old one
+ {
+ free(v->value);
+ free(v->name);
+ }
+ v->type=type;
+ v->len=len;
+ v->value=(char*)malloc(len);
+ memcpy(v->value, value, len);
+ v->name=(char*)malloc(strlen(fullname)+1);
+ strcpy(v->name, fullname);
+ save_registry();
+ return v;
+}
+
+static void init_registry()
+{
+// printf("Initializing registry\n");
+ open_registry();
+ insert_handle(HKEY_LOCAL_MACHINE, "HKLM");
+ insert_handle(HKEY_CURRENT_USER, "HKCU");
+}
+static reg_handle_t* find_handle_2(long key, const char* subkey)
+{
+ char* full_name;
+ reg_handle_t* t;
+ if((t=find_handle(key))==0)
+ {
+ TRACE("Invalid key\n");
+ return (reg_handle_t*)-1;
+ }
+ if(subkey==NULL)
+ return t;
+ full_name=(char*)malloc(strlen(t->name)+strlen(subkey)+10);
+ strcpy(full_name, t->name);
+ strcat(full_name, "\\");
+ strcat(full_name, subkey);
+ t=find_handle_by_name(full_name);
+ free(full_name);
+ return t;
+}
+
+long RegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey)
+{
+ char* full_name;
+ reg_handle_t* t;
+ struct reg_value* v;
+ TRACE("Opening key %s\n", subkey);
+
+ if(!regs)
+ init_registry()
+;
+/* t=find_handle_2(key, subkey);
+
+ if(t==0)
+ return -1;
+
+ if(t==(reg_handle_t*)-1)
+ return -1;
+
+*/ full_name=build_keyname(key, subkey);
+ if(!full_name)
+ return -1;
+ v=find_value_by_name(full_name);
+
+ t=insert_handle(generate_handle(), full_name);
+ *newkey=t->handle;
+ free(full_name);
+
+ return 0;
+}
+long RegCloseKey(long key)
+{
+ reg_handle_t *handle;
+ if(key==HKEY_LOCAL_MACHINE)
+ return 0;
+ if(key==HKEY_CURRENT_USER)
+ return 0;
+ handle=find_handle(key);
+ if(handle==0)
+ return 0;
+ if(handle->prev)
+ handle->prev->next=handle->next;
+ if(handle->next)
+ handle->next->prev=handle->prev;
+ if(handle->name)
+ free(handle->name);
+ if(handle==head)
+ head=head->prev;
+ free(handle);
+ return 1;
+}
+long RegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count)
+{
+ struct reg_value* t;
+ char* c;
+ TRACE("Querying value %s\n", value);
+ if(!regs)
+ init_registry()
+;
+ c=build_keyname(key, value);
+ if(c==NULL)
+ return 1;
+ if((t=find_value_by_name(c))==0)
+ {
+ free(c);
+ return 2;
+ }
+ free(c);
+ if(type)
+ *type=t->type;
+ if(data)
+ {
+ memcpy(data, t->value, (t->len<*count)?t->len:*count);
+ TRACE("returning %d bytes: %d\n", t->len, *(int*)data);
+ }
+ if(*count<t->len)
+ {
+ *count=t->len;
+ return ERROR_MORE_DATA;
+ }
+ else
+ {
+ *count=t->len;
+ }
+ return 0;
+}
+long RegCreateKeyExA(long key, const char* name, long reserved,
+ void* classs, long options, long security,
+ void* sec_attr, int* newkey, int* status)
+{
+ reg_handle_t* t;
+ char* fullname;
+ struct reg_value* v;
+// TRACE("Creating/Opening key %s\n", name);
+ TRACE("Creating/Opening key %s\n", name);
+ if(!regs)
+ init_registry()
+;
+ fullname=build_keyname(key, name);
+ if(fullname==NULL)
+ return 1;
+ v=find_value_by_name(fullname);
+ if(v==0)
+ {
+ int qw=45708;
+ v=insert_reg_value(key, name, DIR, &qw, 4);
+ *status=REG_CREATED_NEW_KEY;
+// return 0;
+ }
+ else
+ *status=REG_OPENED_EXISTING_KEY;
+
+ t=insert_handle(generate_handle(), fullname);
+ *newkey=t->handle;
+ free(fullname);
+ return 0;
+}
+long RegSetValueExA(long key, const char* name, long v1, long v2, const void* data, long size)
+{
+ struct reg_value* t;
+ char* c;
+ TRACE("Request to set value %s\n", name);
+ if(!regs)
+ init_registry()
+;
+ c=build_keyname(key, name);
+ if(c==NULL)
+ return 1;
+ insert_reg_value(key, name, v2, data, size);
+ free(c);
+ return 0;
+}
diff --git a/loader/registry.h b/loader/registry.h
new file mode 100644
index 0000000000..2e794799e7
--- /dev/null
+++ b/loader/registry.h
@@ -0,0 +1,24 @@
+/********************************************************
+
+ Declaration of registry access functions
+ Copyright 2000 Eugene Smith (divx@euro.ru)
+
+*********************************************************/
+
+
+#ifndef REGISTRY_H
+#define REGISTRY_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+long RegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey);
+long RegCloseKey(long key);
+long RegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count);
+long RegCreateKeyExA(long key, const char* name, long reserved,
+ void* classs, long options, long security,
+ void* sec_attr, int* newkey, int* status);
+long RegSetValueExA(long key, const char* name, long v1, long v2, const void* data, long size);
+#ifdef __cplusplus
+};
+#endif
+#endif
diff --git a/loader/resource.c b/loader/resource.c
new file mode 100644
index 0000000000..1c5b4654d8
--- /dev/null
+++ b/loader/resource.c
@@ -0,0 +1,478 @@
+/*
+ * Resources
+ *
+ * Copyright 1993 Robert J. Amstadt
+ * Copyright 1995 Alexandre Julliard
+ */
+#include <config.h>
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <wine/winbase.h>
+#include <wine/windef.h>
+#include <wine/winuser.h>
+#include <wine/heap.h>
+#include <wine/module.h>
+#include <wine/debugtools.h>
+#include <wine/winerror.h>
+#define CP_ACP 0
+
+WORD WINE_LanguageId=0x409;//english
+
+#define HRSRC_MAP_BLOCKSIZE 16
+
+typedef struct _HRSRC_ELEM
+{
+ HANDLE hRsrc;
+ WORD type;
+} HRSRC_ELEM;
+
+typedef struct _HRSRC_MAP
+{
+ int nAlloc;
+ int nUsed;
+ HRSRC_ELEM *elem;
+} HRSRC_MAP;
+
+static HRSRC RES_FindResource2( HMODULE hModule, LPCSTR type,
+ LPCSTR name, WORD lang, int unicode)
+{
+ HRSRC hRsrc = 0;
+ LPWSTR typeStr, nameStr;
+ WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule );
+
+ if(!wm)
+ return 0;
+ /* 32-bit PE module */
+
+
+ if ( HIWORD( type ) && (!unicode))
+ typeStr = HEAP_strdupAtoW( GetProcessHeap(), 0, type );
+ else
+ typeStr = (LPWSTR)type;
+ if ( HIWORD( name ) && (!unicode))
+ nameStr = HEAP_strdupAtoW( GetProcessHeap(), 0, name );
+ else
+ nameStr = (LPWSTR)name;
+
+ hRsrc = PE_FindResourceExW( wm, nameStr, typeStr, lang );
+
+ if ( HIWORD( type ) && (!unicode))
+ HeapFree( GetProcessHeap(), 0, typeStr );
+ if ( HIWORD( name ) && (!unicode))
+ HeapFree( GetProcessHeap(), 0, nameStr );
+
+ return hRsrc;
+}
+
+/**********************************************************************
+ * RES_FindResource
+ */
+
+static HRSRC RES_FindResource( HMODULE hModule, LPCSTR type,
+ LPCSTR name, WORD lang, int unicode )
+{
+ HRSRC hRsrc;
+// __TRY
+// {
+ hRsrc = RES_FindResource2(hModule, type, name, lang, unicode);
+// }
+// __EXCEPT(page_fault)
+// {
+// WARN("page fault\n");
+// SetLastError(ERROR_INVALID_PARAMETER);
+// return 0;
+// }
+// __ENDTRY
+ return hRsrc;
+}
+
+/**********************************************************************
+ * RES_SizeofResource
+ */
+static DWORD RES_SizeofResource( HMODULE hModule, HRSRC hRsrc)
+{
+ DWORD size = 0;
+ HRSRC hRsrc32;
+
+// HMODULE16 hMod16 = MapHModuleLS( hModule );
+// NE_MODULE *pModule = NE_GetPtr( hMod16 );
+// WINE_MODREF *wm = pModule && pModule->module32?
+// MODULE32_LookupHMODULE( pModule->module32 ) : NULL;
+ WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule );
+
+ if ( !hModule || !hRsrc ) return 0;
+
+ /* 32-bit PE module */
+ /* If we got a 16-bit hRsrc, convert it */
+// hRsrc32 = HIWORD(hRsrc)? hRsrc : MapHRsrc16To32( pModule, hRsrc );
+ if(!HIWORD(hRsrc))
+ {
+ printf("16-bit hRsrcs not supported\n");
+ return 0;
+ }
+ size = PE_SizeofResource( hModule, hRsrc );
+ return size;
+}
+
+/**********************************************************************
+ * RES_AccessResource
+ */
+static HFILE RES_AccessResource( HMODULE hModule, HRSRC hRsrc )
+{
+ HFILE hFile = HFILE_ERROR;
+
+ WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule );
+
+ if ( !hModule || !hRsrc ) return HFILE_ERROR;
+
+ /* 32-bit PE module */
+ FIXME("32-bit modules not yet supported.\n" );
+ hFile = HFILE_ERROR;
+
+ return hFile;
+}
+
+/**********************************************************************
+ * RES_LoadResource
+ */
+static HGLOBAL RES_LoadResource( HMODULE hModule, HRSRC hRsrc)
+{
+ HGLOBAL hMem = 0;
+ HRSRC hRsrc32;
+ WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule );
+
+
+ if ( !hModule || !hRsrc ) return 0;
+
+ /* 32-bit PE module */
+
+ /* If we got a 16-bit hRsrc, convert it */
+// hRsrc32 = HIWORD(hRsrc)? hRsrc : MapHRsrc16To32( pModule, hRsrc );
+ if(!HIWORD(hRsrc))
+ {
+ printf("16-bit hRsrcs not supported\n");
+ return 0;
+ }
+ hMem = PE_LoadResource( wm, hRsrc );
+
+ return hMem;
+}
+
+/**********************************************************************
+ * RES_LockResource
+ */
+static LPVOID RES_LockResource( HGLOBAL handle )
+{
+ LPVOID bits = NULL;
+
+ TRACE("(%08x, %s)\n", handle, "PE" );
+
+ bits = (LPVOID)handle;
+
+ return bits;
+}
+
+/**********************************************************************
+ * RES_FreeResource
+ */
+static WIN_BOOL RES_FreeResource( HGLOBAL handle )
+{
+ HGLOBAL retv = handle;
+ return (WIN_BOOL)retv;
+}
+
+/**********************************************************************
+ * FindResourceA (KERNEL32.128)
+ */
+HANDLE WINAPI FindResourceA( HMODULE hModule, LPCSTR name, LPCSTR type )
+{
+ return RES_FindResource( hModule, type, name,
+ WINE_LanguageId, 0);
+}
+HANDLE WINAPI FindResourceW( HMODULE hModule, LPCWSTR name, LPCWSTR type )
+{
+ return RES_FindResource( hModule, (LPCSTR)type, (LPCSTR)name,
+ WINE_LanguageId, 1);
+}
+
+/**********************************************************************
+ * FindResourceExA (KERNEL32.129)
+ */
+HANDLE WINAPI FindResourceExA( HMODULE hModule,
+ LPCSTR type, LPCSTR name, WORD lang )
+{
+ return RES_FindResource( hModule, type, name,
+ lang, 0 );
+}
+
+HANDLE WINAPI FindResourceExW( HMODULE hModule,
+ LPCWSTR type, LPCWSTR name, WORD lang )
+{
+ return RES_FindResource( hModule, (LPCSTR)type, (LPCSTR)name,
+ lang, 1 );
+}
+
+
+
+/**********************************************************************
+ * LockResource (KERNEL32.384)
+ */
+LPVOID WINAPI LockResource( HGLOBAL handle )
+{
+ return RES_LockResource( handle );
+}
+
+
+/**********************************************************************
+ * FreeResource (KERNEL32.145)
+ */
+WIN_BOOL WINAPI FreeResource( HGLOBAL handle )
+{
+ return RES_FreeResource( handle );
+}
+
+
+/**********************************************************************
+ * AccessResource (KERNEL32.64)
+ */
+INT WINAPI AccessResource( HMODULE hModule, HRSRC hRsrc )
+{
+ return RES_AccessResource( hModule, hRsrc );
+}
+/**********************************************************************
+ * SizeofResource (KERNEL32.522)
+ */
+DWORD WINAPI SizeofResource( HINSTANCE hModule, HRSRC hRsrc )
+{
+ return RES_SizeofResource( hModule, hRsrc );
+}
+
+
+INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id,
+ LPWSTR buffer, INT buflen );
+
+/**********************************************************************
+ * LoadStringA (USER32.375)
+ */
+INT WINAPI LoadStringA( HINSTANCE instance, UINT resource_id,
+ LPSTR buffer, INT buflen )
+{
+ INT retval;
+ INT wbuflen;
+ INT abuflen;
+ LPWSTR wbuf = NULL;
+ LPSTR abuf = NULL;
+
+ if ( buffer != NULL && buflen > 0 )
+ *buffer = 0;
+
+ wbuflen = LoadStringW(instance,resource_id,NULL,0);
+ if ( !wbuflen )
+ return 0;
+ wbuflen ++;
+
+ retval = 0;
+ wbuf = HeapAlloc( GetProcessHeap(), 0, wbuflen * sizeof(WCHAR) );
+ wbuflen = LoadStringW(instance,resource_id,wbuf,wbuflen);
+ if ( wbuflen > 0 )
+ {
+ abuflen = WideCharToMultiByte(CP_ACP,0,wbuf,wbuflen,NULL,0,NULL,NULL);
+ if ( abuflen > 0 )
+ {
+ if ( buffer == NULL || buflen == 0 )
+ retval = abuflen;
+ else
+ {
+ abuf = HeapAlloc( GetProcessHeap(), 0, abuflen * sizeof(CHAR) );
+ abuflen = WideCharToMultiByte(CP_ACP,0,wbuf,wbuflen,abuf,abuflen,NULL,NULL);
+ if ( abuflen > 0 )
+ {
+ abuflen = min(abuflen,buflen - 1);
+ memcpy( buffer, abuf, abuflen );
+ buffer[abuflen] = 0;
+ retval = abuflen;
+ }
+ HeapFree( GetProcessHeap(), 0, abuf );
+ }
+ }
+ }
+ HeapFree( GetProcessHeap(), 0, wbuf );
+
+ return retval;
+}
+
+/**********************************************************************
+ * LoadStringW (USER32.376)
+ */
+INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id,
+ LPWSTR buffer, INT buflen )
+{
+ HGLOBAL hmem;
+ HRSRC hrsrc;
+ WCHAR *p;
+ int string_num;
+ int i;
+
+ if (HIWORD(resource_id)==0xFFFF) /* netscape 3 passes this */
+ resource_id = (UINT)(-((INT)resource_id));
+ TRACE("instance = %04x, id = %04x, buffer = %08x, "
+ "length = %d\n", instance, (int)resource_id, (int) buffer, buflen);
+
+ /* Use bits 4 - 19 (incremented by 1) as resourceid, mask out
+ * 20 - 31. */
+ hrsrc = FindResourceW( instance, (LPCWSTR)(((resource_id>>4)&0xffff)+1),
+ RT_STRINGW );
+ if (!hrsrc) return 0;
+ hmem = LoadResource( instance, hrsrc );
+ if (!hmem) return 0;
+
+ p = LockResource(hmem);
+ string_num = resource_id & 0x000f;
+ for (i = 0; i < string_num; i++)
+ p += *p + 1;
+
+ TRACE("strlen = %d\n", (int)*p );
+
+ if (buffer == NULL) return *p;
+ i = min(buflen - 1, *p);
+ if (i > 0) {
+ memcpy(buffer, p + 1, i * sizeof (WCHAR));
+ buffer[i] = (WCHAR) 0;
+ } else {
+ if (buflen > 1) {
+ buffer[0] = (WCHAR) 0;
+ return 0;
+ }
+#if 0
+ WARN("Dont know why caller give buflen=%d *p=%d trying to obtain string '%s'\n", buflen, *p, p + 1);
+#endif
+ }
+
+ TRACE("String loaded !\n");
+ return i;
+}
+
+/* Messages...used by FormatMessage32* (KERNEL32.something)
+ *
+ * They can be specified either directly or using a message ID and
+ * loading them from the resource.
+ *
+ * The resourcedata has following format:
+ * start:
+ * 0: DWORD nrofentries
+ * nrofentries * subentry:
+ * 0: DWORD firstentry
+ * 4: DWORD lastentry
+ * 8: DWORD offset from start to the stringentries
+ *
+ * (lastentry-firstentry) * stringentry:
+ * 0: WORD len (0 marks end)
+ * 2: WORD flags
+ * 4: CHAR[len-4]
+ * (stringentry i of a subentry refers to the ID 'firstentry+i')
+ *
+ * Yes, ANSI strings in win32 resources. Go figure.
+ */
+
+/**********************************************************************
+ * LoadMessageA (internal)
+ */
+INT WINAPI LoadMessageA( HMODULE instance, UINT id, WORD lang,
+ LPSTR buffer, INT buflen )
+{
+ HGLOBAL hmem;
+ HRSRC hrsrc;
+ PMESSAGE_RESOURCE_DATA mrd;
+ PMESSAGE_RESOURCE_BLOCK mrb;
+ PMESSAGE_RESOURCE_ENTRY mre;
+ int i,slen;
+
+ TRACE("instance = %08lx, id = %08lx, buffer = %p, length = %ld\n", (DWORD)instance, (DWORD)id, buffer, (DWORD)buflen);
+
+ /*FIXME: I am not sure about the '1' ... But I've only seen those entries*/
+ hrsrc = FindResourceExW(instance,RT_MESSAGELISTW,(LPWSTR)1,lang);
+ if (!hrsrc) return 0;
+ hmem = LoadResource( instance, hrsrc );
+ if (!hmem) return 0;
+
+ mrd = (PMESSAGE_RESOURCE_DATA)LockResource(hmem);
+ mre = NULL;
+ mrb = &(mrd->Blocks[0]);
+ for (i=mrd->NumberOfBlocks;i--;) {
+ if ((id>=mrb->LowId) && (id<=mrb->HighId)) {
+ mre = (PMESSAGE_RESOURCE_ENTRY)(((char*)mrd)+mrb->OffsetToEntries);
+ id -= mrb->LowId;
+ break;
+ }
+ mrb++;
+ }
+ if (!mre)
+ return 0;
+ for (i=id;i--;) {
+ if (!mre->Length)
+ return 0;
+ mre = (PMESSAGE_RESOURCE_ENTRY)(((char*)mre)+(mre->Length));
+ }
+ slen=mre->Length;
+ TRACE(" - strlen=%d\n",slen);
+ i = min(buflen - 1, slen);
+ if (buffer == NULL)
+ return slen;
+ if (i>0) {
+ lstrcpynA(buffer,(char*)mre->Text,i);
+ buffer[i]=0;
+ } else {
+ if (buflen>1) {
+ buffer[0]=0;
+ return 0;
+ }
+ }
+ if (buffer)
+ TRACE("'%s' copied !\n", buffer);
+ return i;
+}
+
+
+
+/**********************************************************************
+ * EnumResourceTypesA (KERNEL32.90)
+ */
+WIN_BOOL WINAPI EnumResourceTypesA( HMODULE hmodule,ENUMRESTYPEPROCA lpfun,
+ LONG lParam)
+{
+ /* FIXME: move WINE_MODREF stuff here */
+ return PE_EnumResourceTypesA(hmodule,lpfun,lParam);
+}
+
+/**********************************************************************
+ * EnumResourceNamesA (KERNEL32.88)
+ */
+WIN_BOOL WINAPI EnumResourceNamesA( HMODULE hmodule, LPCSTR type,
+ ENUMRESNAMEPROCA lpfun, LONG lParam )
+{
+ /* FIXME: move WINE_MODREF stuff here */
+ return PE_EnumResourceNamesA(hmodule,type,lpfun,lParam);
+}
+/**********************************************************************
+ * EnumResourceLanguagesA (KERNEL32.86)
+ */
+WIN_BOOL WINAPI EnumResourceLanguagesA( HMODULE hmodule, LPCSTR type,
+ LPCSTR name, ENUMRESLANGPROCA lpfun,
+ LONG lParam)
+{
+ /* FIXME: move WINE_MODREF stuff here */
+ return PE_EnumResourceLanguagesA(hmodule,type,name,lpfun,lParam);
+}
+/**********************************************************************
+ * LoadResource (KERNEL32.370)
+ */
+HGLOBAL WINAPI LoadResource( HINSTANCE hModule, HRSRC hRsrc )
+{
+ return RES_LoadResource( hModule, hRsrc);
+}
diff --git a/loader/stubs.s b/loader/stubs.s
new file mode 100644
index 0000000000..519eefa58f
--- /dev/null
+++ b/loader/stubs.s
@@ -0,0 +1,36 @@
+ .file "stubs.c"
+ .version "01.01"
+gcc2_compiled.:
+.section .rodata
+.LC0:
+ .string "Called unk_%s\n"
+.text
+ .align 4
+.globl unk_exp1
+ .type unk_exp1,@function
+unk_exp1:
+ pushl %ebp
+ movl %esp,%ebp
+ subl $4,%esp
+ movl $1,-4(%ebp)
+ movl -4(%ebp),%eax
+ movl %eax,%ecx
+ movl %ecx,%edx
+ sall $4,%edx
+ subl %eax,%edx
+ leal 0(,%edx,2),%eax
+ movl %eax,%edx
+ addl $export_names,%edx
+ pushl %edx
+ pushl $.LC0
+ call printf
+ addl $8,%esp
+ xorl %eax,%eax
+ jmp .L1
+ .align 4
+.L1:
+ leave
+ ret
+.Lfe1:
+ .size unk_exp1,.Lfe1-unk_exp1
+ .ident "GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)"
diff --git a/loader/vfl.c b/loader/vfl.c
new file mode 100644
index 0000000000..82cc4041b0
--- /dev/null
+++ b/loader/vfl.c
@@ -0,0 +1,330 @@
+/*
+ * Copyright 1998 Marcus Meissner
+ */
+#include <config.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#include "wine/winbase.h"
+#include "wine/windef.h"
+#include "wine/winuser.h"
+#include "wine/vfw.h"
+#include "wine/winestring.h"
+#include "wine/driver.h"
+#include "wine/avifmt.h"
+
+#define FIXME_(X) printf
+#define FIXME printf
+
+long VFWAPI VideoForWindowsVersion(void);
+
+extern void* my_mreq(int size, int to_zero);
+extern void DrvClose(HDRVR hdrvr);
+extern int my_release(char* memory);
+
+long VFWAPIV ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits);
+
+WIN_BOOL VFWAPI ICInfo(long fccType, long fccHandler, ICINFO * lpicinfo);
+LRESULT VFWAPI ICGetInfo(HIC hic,ICINFO *picinfo, long cb);
+HIC VFWAPI ICOpen(long fccType, long fccHandler, UINT wMode);
+HIC VFWAPI ICOpenFunction(long fccType, long fccHandler, unsigned int wMode, void* lpfnHandler);
+
+LRESULT VFWAPI ICClose(HIC hic);
+LRESULT VFWAPI ICSendMessage(HIC hic, unsigned int msg, long dw1, long dw2);
+HIC VFWAPI ICLocate(long fccType, long fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, short wFlags);
+
+#define OpenDriverA DrvOpen
+extern HDRVR VFWAPI DrvOpen(long);
+#define STORE_ALL \
+ __asm__ ( \
+ "push %%ebx\n\t" \
+ "push %%ecx\n\t" \
+ "push %%edx\n\t" \
+ "push %%esi\n\t" \
+ "push %%edi\n\t"::)
+
+#define REST_ALL \
+ __asm__ ( \
+ "pop %%edi\n\t" \
+ "pop %%esi\n\t" \
+ "pop %%edx\n\t" \
+ "pop %%ecx\n\t" \
+ "pop %%ebx\n\t"::)
+
+
+typedef struct {
+ unsigned int uDriverSignature;
+ void* hDriverModule;
+ DRIVERPROC DriverProc;
+ long dwDriverID;
+} DRVR;
+
+/***********************************************************************
+ * VideoForWindowsVersion [MSVFW.2][MSVIDEO.2]
+ * Returns the version in major.minor form.
+ * In Windows95 this returns 0x040003b6 (4.950)
+ */
+long VideoForWindowsVersion(void) {
+ return 0x040003B6; /* 4.950 */
+}
+
+/* system.ini: [drivers] */
+
+/***********************************************************************
+ * ICInfo [MSVFW.33]
+ * Get information about an installable compressor. Return TRUE if there
+ * is one.
+ */
+int VFWAPI
+ICInfo(
+ long fccType, /* [in] type of compressor ('vidc') */
+ long fccHandler, /* [in] <n>th compressor */
+ ICINFO *lpicinfo /* [out] information about compressor */
+) {
+ char type[5];
+
+ memcpy(type,&fccType,4);type[4]=0;
+
+ /* does OpenDriver/CloseDriver */
+ lpicinfo->dwSize = sizeof(ICINFO);
+ lpicinfo->fccType = fccType;
+ lpicinfo->dwFlags = 0;
+/*
+ if (GetPrivateProfileStringA("drivers32",NULL,NULL,buf,2000,"system.ini")) {
+ char *s = buf;
+ while (*s) {
+ if (!lstrncmpiA(type,s,4)) {
+ if(!fccHandler--) {
+ lpicinfo->fccHandler = mmioStringToFOURCCA(s+5,0);
+ return TRUE;
+ }
+ }
+ s=s+lstrlenA(s)+1;
+ }
+ }
+*/
+ return TRUE;
+}
+
+/***********************************************************************
+ * ICOpen [MSVFW.37]
+ * Opens an installable compressor. Return special handle.
+ */
+HIC VFWAPI
+ICOpen(long fccType,long fccHandler,unsigned int wMode) {
+ char type[5],handler[5],codecname[20];
+ ICOPEN icopen;
+ HDRVR hdrv;
+ WINE_HIC *whic;
+
+ memcpy(type,&fccType,4);type[4]=0;
+ memcpy(handler,&fccHandler,4);handler[4]=0;
+
+ sprintf(codecname,"%s.%s",type,handler);
+
+ /* Well, lParam2 is in fact a LPVIDEO_OPEN_PARMS, but it has the
+ * same layout as ICOPEN
+ */
+ icopen.fccType = fccType;
+ icopen.fccHandler = fccHandler;
+ icopen.dwSize = sizeof(ICOPEN);
+ icopen.dwFlags = wMode;
+ /* FIXME: do we need to fill out the rest too? */
+// hdrv=OpenDriverA(codecname,"drivers32",(long)&icopen);
+ hdrv=OpenDriverA((long)&icopen);
+/*
+ if (!hdrv) {
+ if (!strcasecmp(type,"vids")) {
+ sprintf(codecname,"vidc.%s",handler);
+ fccType = mmioFOURCC('v','i','d','c');
+ }
+// hdrv=OpenDriverA(codecname,"drivers32",(long)&icopen);
+ hdrv=OpenDriverA((long)&icopen);
+*/
+ if (!hdrv)
+ return 0;
+// }
+ whic = (WINE_HIC*)my_mreq(sizeof(WINE_HIC), 0);
+ whic->hdrv = hdrv;
+ whic->driverproc= ((DRVR*)hdrv)->DriverProc;
+// whic->private = ICSendMessage((HIC)whic,DRV_OPEN,0,(long)&icopen);
+ whic->private = ((DRVR*)hdrv)->dwDriverID;
+ return (HIC)whic;
+}
+
+/***********************************************************************
+ * ICOpenFunction [MSVFW.38]
+ */
+HIC VFWAPI ICOpenFunction(long fccType, long fccHandler, unsigned int wMode,
+void* lpfnHandler) {
+ char type[5],handler[5];
+ HIC hic;
+ WINE_HIC *whic;
+
+ memcpy(type,&fccType,4);type[4]=0;
+ memcpy(handler,&fccHandler,4);handler[4]=0;
+ FIXME("(%s,%s,%d,%p), stub!\n",type,handler,wMode,lpfnHandler);
+ hic = ICOpen(fccType,fccHandler,wMode);
+ if (!hic)
+ return hic;
+ whic = (WINE_HIC*)hic;
+ whic->driverproc = (DRIVERPROC)lpfnHandler;
+ return hic;
+}
+
+
+/***********************************************************************
+ * ICGetInfo [MSVFW.30]
+ */
+LRESULT VFWAPI
+ICGetInfo(HIC hic,ICINFO *picinfo,long cb) {
+ LRESULT ret;
+
+ ret = ICSendMessage(hic,ICM_GETINFO,(long)picinfo,cb);
+
+ return ret;
+}
+
+/***********************************************************************
+ * ICLocate [MSVFW.35]
+ */
+HIC VFWAPI
+ICLocate(
+ long fccType, long fccHandler, LPBITMAPINFOHEADER lpbiIn,
+ LPBITMAPINFOHEADER lpbiOut, short wMode
+) {
+ char type[5],handler[5];
+ HIC hic;
+ long querymsg;
+
+ switch (wMode) {
+ case ICMODE_FASTCOMPRESS:
+ case ICMODE_COMPRESS:
+ querymsg = ICM_COMPRESS_QUERY;
+ break;
+ case ICMODE_DECOMPRESS:
+ case ICMODE_FASTDECOMPRESS:
+ querymsg = ICM_DECOMPRESS_QUERY;
+ break;
+ case ICMODE_DRAW:
+ querymsg = ICM_DRAW_QUERY;
+ break;
+ default:
+ FIXME("Unknown mode (%d)\n",wMode);
+ return 0;
+ }
+
+ /* Easy case: handler/type match, we just fire a query and return */
+ hic = ICOpen(fccType,fccHandler,wMode);
+ if (hic) {
+ if (!ICSendMessage(hic,querymsg,(long)lpbiIn,(long)lpbiOut))
+ return hic;
+ ICClose(hic);
+ }
+ type[4]='\0';memcpy(type,&fccType,4);
+ handler[4]='\0';memcpy(handler,&fccHandler,4);
+ if (fccType==streamtypeVIDEO) {
+ hic = ICLocate(ICTYPE_VIDEO,fccHandler,lpbiIn,lpbiOut,wMode);
+ if (hic)
+ return hic;
+ }
+ FIXME("(%s,%s,%p,%p,0x%04x),unhandled!\n",type,handler,lpbiIn,lpbiOut,wMode);
+ return 0;
+}
+
+/***********************************************************************
+ * ICCompress [MSVFW.23]
+ */
+long VFWAPIV
+ICCompress(
+ HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpData,
+ LPBITMAPINFOHEADER lpbiInput,void* lpBits,long* lpckid,
+ long* lpdwFlags,long lFrameNum,long dwFrameSize,long dwQuality,
+ LPBITMAPINFOHEADER lpbiPrev,void* lpPrev
+) {
+ ICCOMPRESS iccmp;
+
+ iccmp.dwFlags = dwFlags;
+
+ iccmp.lpbiOutput = lpbiOutput;
+ iccmp.lpOutput = lpData;
+ iccmp.lpbiInput = lpbiInput;
+ iccmp.lpInput = lpBits;
+
+ iccmp.lpckid = lpckid;
+ iccmp.lpdwFlags = lpdwFlags;
+ iccmp.lFrameNum = lFrameNum;
+ iccmp.dwFrameSize = dwFrameSize;
+ iccmp.dwQuality = dwQuality;
+ iccmp.lpbiPrev = lpbiPrev;
+ iccmp.lpPrev = lpPrev;
+ return ICSendMessage(hic,ICM_COMPRESS,(long)&iccmp,sizeof(iccmp));
+}
+
+/***********************************************************************
+ * ICDecompress [MSVFW.26]
+ */
+long VFWAPIV
+ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits) {
+ ICDECOMPRESS icd;
+ int result;
+ icd.dwFlags = dwFlags;
+ icd.lpbiInput = lpbiFormat;
+ icd.lpInput = lpData;
+
+ icd.lpbiOutput = lpbi;
+ icd.lpOutput = lpBits;
+ icd.ckid = 0;
+ STORE_ALL;
+ result=ICSendMessage(hic,ICM_DECOMPRESS,(long)&icd,sizeof(icd));
+ REST_ALL;
+ return result;
+}
+
+/***********************************************************************
+ * ICSendMessage [MSVFW.40]
+ */
+LRESULT VFWAPI
+ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2) {
+ LRESULT ret;
+ WINE_HIC *whic = (WINE_HIC*)hic;
+ char qw[200];
+
+ __asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw));
+ STORE_ALL;
+ /*__asm__
+ (
+ "pushl %eax\n\t"
+ "movl $0xf,%eax\n\t"
+ "movw %ax, %fs\n\t"
+ "popl %eax\n\t"
+ );*/
+ ret = whic->driverproc(whic->private,1,msg,lParam1,lParam2);
+ REST_ALL;
+ __asm__ __volatile__ ("frstor (%0)\n\t": :"r"(&qw));
+// } else
+
+// ret = SendDriverMessage(whic->hdrv,msg,lParam1,lParam2);
+// TRACE(" -> 0x%08lx\n",ret);
+ return ret;
+}
+
+
+/***********************************************************************
+ * ICClose [MSVFW.22]
+ */
+LRESULT VFWAPI ICClose(HIC hic) {
+ WINE_HIC *whic = (WINE_HIC*)hic;
+ /* FIXME: correct? */
+// CloseDriver(whic->hdrv,0,0);
+ DrvClose(whic->hdrv);
+//#warning FIXME: DrvClose
+ my_release(whic);
+ return 0;
+}
+int VFWAPI ICDoSomething()
+{
+ return 0;
+}
+
diff --git a/loader/win32.c b/loader/win32.c
new file mode 100644
index 0000000000..e0b76798ef
--- /dev/null
+++ b/loader/win32.c
@@ -0,0 +1,1706 @@
+/***********************************************************
+
+ Win32 emulation code. Functions that emulate
+ responses from corresponding Win32 API calls.
+ Since we are not going to be able to load
+ virtually any DLL, we can only implement this
+ much, adding needed functions with each new codec.
+
+************************************************************/
+
+#include <config.h>
+
+#include "win32.h"
+#include <stdio.h>
+#include <pthread.h>
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#else
+#include <stdlib.h>
+#endif
+#include <time.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/timeb.h>
+
+#include <wine/winbase.h>
+#include <wine/winreg.h>
+#include <wine/winnt.h>
+#include <wine/winerror.h>
+#include <wine/debugtools.h>
+#include <wine/module.h>
+
+#include <registry.h>
+#include <loader.h>
+#ifdef USE_TSC
+static unsigned int localcount()
+{
+ int a;
+ __asm__ __volatile__("rdtsc\n\t"
+ :"=a"(a)
+ :
+ :"edx");
+ return a;
+}
+static void longcount(long long* z)
+{
+ __asm__ __volatile__(
+ "pushl %%ebx\n\t"
+ "movl %%eax, %%ebx\n\t"
+ "rdtsc\n\t"
+ "movl %%eax, 0(%%ebx)\n\t"
+ "movl %%edx, 4(%%ebx)\n\t"
+ "popl %%ebx\n\t"
+ ::"a"(z));
+}
+#else
+#include <sys/time.h>
+#include <unistd.h>
+static unsigned int localcount()
+{
+ struct timeval tv;
+ unsigned limit=~0;
+ limit/=1000000;
+ gettimeofday(&tv, 0);
+ return limit*tv.tv_usec;
+}
+static void longcount(long long* z)
+{
+ struct timeval tv;
+ unsigned long long result;
+ unsigned limit=~0;
+ if(!z)return;
+ limit/=1000000;
+ gettimeofday(&tv, 0);
+ result=tv.tv_sec;
+ result<<=32;
+ result+=limit*tv.tv_usec;
+ *z=result;
+}
+#endif
+
+void dbgprintf(char* fmt, ...)
+{
+#ifdef DETAILED_OUT
+#if 1
+ va_list va;
+ va_start(va, fmt);
+ vprintf(fmt, va);
+ va_end(va);
+#else
+ va_list va;
+ FILE* f;
+ va_start(va, fmt);
+ f=fopen("./log", "a");
+ if(f==0)return;
+ vfprintf(f, fmt, va);
+ fsync(f);
+ fclose(f);
+#endif
+#endif
+}
+char export_names[500][30]={
+"name1",
+//"name2",
+//"name3"
+};
+//#define min(x,y) ((x)<(y)?(x):(y))
+
+static unsigned char* heap=NULL;
+static int heap_counter=0;
+void test_heap()
+{
+ int offset=0;
+ if(heap==0)
+ return;
+ while(offset<heap_counter)
+ {
+ if(*(int*)(heap+offset)!=0x433476)
+ {
+ printf("Heap corruption at address %d\n", offset);
+ return;
+ }
+ offset+=8+*(int*)(heap+offset+4);
+ }
+ for(;offset<min(offset+1000, 20000000); offset++)
+ if(heap[offset]!=0xCC)
+ {
+ printf("Free heap corruption at address %d\n", offset);
+ }
+}
+#undef MEMORY_DEBUG
+
+#ifdef MEMORY_DEBUG
+
+void* my_mreq(int size, int to_zero)
+{
+ static int test=0;
+ test++;
+ if(test%10==0)printf("Memory: %d bytes allocated\n", heap_counter);
+// test_heap();
+ if(heap==NULL)
+ {
+ heap=malloc(20000000);
+ memset(heap, 0xCC,20000000);
+ }
+ if(heap==0)
+ {
+ printf("No enough memory\n");
+ return 0;
+ }
+ if(heap_counter+size>20000000)
+ {
+ printf("No enough memory\n");
+ return 0;
+ }
+ *(int*)(heap+heap_counter)=0x433476;
+ heap_counter+=4;
+ *(int*)(heap+heap_counter)=size;
+ heap_counter+=4;
+ printf("Allocated %d bytes of memory: sys %d, user %d-%d\n", size, heap_counter-8, heap_counter, heap_counter+size);
+ if(to_zero)
+ memset(heap+heap_counter, 0, size);
+ heap_counter+=size;
+ return heap+heap_counter-size;
+}
+int my_release(char* memory)
+{
+// test_heap();
+ if(memory==NULL)
+ {
+ printf("ERROR: free(0)\n");
+ return 0;
+ }
+ if(*(int*)(memory-8)!=0x433476)
+ {
+ printf("MEMORY CORRUPTION !!!!!!!!!!!!!!!!!!!\n");
+ return 0;
+ }
+ printf("Freed %d bytes of memory\n", *(int*)(memory-4));
+// memset(memory-8, *(int*)(memory-4), 0xCC);
+ return 0;
+}
+
+#else
+void* my_mreq(int size, int to_zero)
+{
+ void* answer;
+ if(to_zero)
+ answer=calloc(size+4, 1);
+ else
+ answer=malloc(size+4);
+ *(int*)answer=size;
+ return (int*)answer+1;
+}
+int my_release(char* memory)
+{
+ if(memory==0)return 0;
+ free(memory-4);
+ return 0;
+}
+#endif
+int my_size(char* memory)
+{
+ return *(int*)(memory-4);
+}
+
+extern int unk_exp1;
+char extcode[20000];// place for 200 unresolved exports
+int pos=0;
+
+int WINAPI ext_unknown()
+{
+ printf("Unknown func called\n");
+ return 0;
+}
+int WINAPI expIsBadWritePtr(void* ptr, unsigned int count)
+{
+ dbgprintf("IsBadWritePtr(%x, %x)\n", ptr, count);
+ if(count==0)
+ return 0;
+ if(ptr==0)
+ return 1;
+ return 0;
+}
+int WINAPI expIsBadReadPtr(void* ptr, unsigned int count)
+{
+ dbgprintf("IsBadReadPtr(%x, %x)\n", ptr, count);
+ if(count==0)
+ return 0;
+ if(ptr==0)
+ return 1;
+ return 0;
+}
+void* CDECL expmalloc(int size)
+{
+//printf("malloc");
+// return malloc(size);
+ void* result=my_mreq(size,0);
+ dbgprintf("malloc(%x)\n", size);
+ if(result==0)
+ {
+ dbgprintf("returns 0\n");
+ printf("WARNING: malloc() failed\n");
+ }
+ return result;
+}
+void CDECL expfree(void* mem)
+{
+// return free(mem);
+ dbgprintf("free(%x)\n", mem);
+ my_release(mem);
+}
+void* CDECL expnew(int size)
+{
+// printf("NEW:: Call from address %08x\n STACK DUMP:\n", *(-1+(int*)&size));
+// printf("%08x %08x %08x %08x\n",
+// size, *(1+(int*)&size),
+// *(2+(int*)&size),*(3+(int*)&size));
+ void* result=expmalloc(size);
+ dbgprintf("new(%x)\n", size);
+ if(result==0)
+ {
+ dbgprintf("returns 0\n");
+ printf("WARNING: malloc() failed\n");
+ }
+ return result;
+
+}
+int CDECL expdelete(void* memory)
+{
+ dbgprintf("delete(%x)\n", memory);
+ expfree(memory);
+ return 0;
+}
+int WINAPI expDisableThreadLibraryCalls(int module)
+{
+ dbgprintf("DisableThreadLibraryCalls(%x)\n", module);
+ return 0;
+}
+int CDECL exp_initterm(int v1, int v2)
+{
+ return 0;
+}
+
+typedef struct {
+ unsigned int uDriverSignature;
+ void* hDriverModule;
+ void* DriverProc;
+ unsigned int dwDriverID;
+} DRVR;
+
+void* WINAPI expGetDriverModuleHandle(DRVR* pdrv)
+{
+ dbgprintf("GetDriverModuleHandle(%x)\n", pdrv);
+ return pdrv->hDriverModule;
+}
+
+void* WINAPI expGetModuleHandleA(const char* name)
+{
+ WINE_MODREF* wm;
+ dbgprintf("GetModuleHandleA(%s)\n", name);
+ if(!name)return 0;
+ wm=MODULE_FindModule(name);
+ if(wm==0)return 0;
+ return (void*)(wm->module);
+}
+struct th_list_t;
+typedef struct th_list_t{
+int id;
+void* thread;
+struct th_list_t* next;
+struct th_list_t* prev;
+}th_list;
+
+static th_list* list=NULL;
+
+
+
+void* WINAPI expCreateThread(void* pSecAttr, long dwStackSize, void* lpStartAddress,
+ void* lpParameter, long dwFlags, long* dwThreadId)
+{
+ pthread_t *pth;
+// printf("CreateThread:");
+ pth=my_mreq(sizeof(pthread_t), 0);
+ dbgprintf("pthread_create\n");
+ pthread_create(pth, NULL, (void*(*)(void*))lpStartAddress, lpParameter);
+ if(dwFlags)
+ dbgprintf( "WARNING: CreateThread flags not supported\n");
+ if(dwThreadId)
+ *dwThreadId=(long)pth;
+ dbgprintf( "Created thread %08X\n", pth);
+ if(list==NULL)
+ {
+ list=my_mreq(sizeof(th_list), 1);
+ list->next=list->prev=NULL;
+ }
+ else
+ {
+ list->next=my_mreq(sizeof(th_list), 0);
+ list->next->prev=list;
+ list->next->next=NULL;
+ list=list->next;
+ }
+ list->thread=pth;
+ return pth;
+}
+
+struct mutex_list_t;
+
+struct mutex_list_t
+{
+ pthread_mutex_t *pm;
+ char name[64];
+ struct mutex_list_t* next;
+ struct mutex_list_t* prev;
+};
+typedef struct mutex_list_t mutex_list;
+static mutex_list* mlist=NULL;
+void* WINAPI expCreateEventA(void* pSecAttr, char bManualReset,
+ char bInitialState, const char* name)
+{
+#warning ManualReset
+ pthread_mutex_t *pm;
+ dbgprintf("CreateEvent\n");
+ if(mlist!=NULL)
+ {
+ mutex_list* pp=mlist;
+ if(name!=NULL)
+ do
+ {
+ if(strcmp(pp->name, name)==0)
+ return pp->pm;
+ }while(pp=pp->prev);
+ }
+ pm=my_mreq(sizeof(pthread_mutex_t), 0);
+ pthread_mutex_init(pm, NULL);
+ if(mlist==NULL)
+ {
+ mlist=my_mreq(sizeof(mutex_list), 00);
+ mlist->next=mlist->prev=NULL;
+ }
+ else
+ {
+ mlist->next=my_mreq(sizeof(mutex_list), 00);
+ mlist->next->prev=mlist->next;
+ mlist->next->next=NULL;
+ mlist=mlist->next;
+ }
+ mlist->pm=pm;
+ if(name!=NULL)
+ strncpy(mlist->name, name, 64);
+ else
+ mlist->name[0]=0;
+ if(pm==NULL)
+ dbgprintf("ERROR::: CreateEventA failure\n");
+ if(bInitialState)
+ pthread_mutex_lock(pm);
+ return pm;
+}
+
+void* WINAPI expSetEvent(void* event)
+{
+ dbgprintf("Trying to lock %X\n", event);
+ pthread_mutex_lock(event);
+}
+void* WINAPI expResetEvent(void* event)
+{
+ dbgprintf("Unlocking %X\n", event);
+ pthread_mutex_unlock(event);
+}
+
+void* WINAPI expWaitForSingleObject(void* object, int duration)
+{
+#warning not sure
+ dbgprintf("WaitForSingleObject: duration %d\n", duration);
+ pthread_mutex_lock(object);
+ pthread_mutex_unlock(object);
+}
+
+static BYTE PF[64] = {0,};
+
+void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
+{
+ /* FIXME: better values for the two entries below... */
+ static int cache = 0;
+ static SYSTEM_INFO cachedsi;
+ HKEY xhkey=0,hkey;
+ dbgprintf("GetSystemInfo()\n");
+
+ if (cache) {
+ memcpy(si,&cachedsi,sizeof(*si));
+ return;
+ }
+ memset(PF,0,sizeof(PF));
+
+ cachedsi.u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL;
+ cachedsi.dwPageSize = getpagesize();
+
+ /* FIXME: better values for the two entries below... */
+ cachedsi.lpMinimumApplicationAddress = (void *)0x40000000;
+ cachedsi.lpMaximumApplicationAddress = (void *)0x7FFFFFFF;
+ cachedsi.dwActiveProcessorMask = 1;
+ cachedsi.dwNumberOfProcessors = 1;
+ cachedsi.dwProcessorType = PROCESSOR_INTEL_386;
+ cachedsi.dwAllocationGranularity = 0x10000;
+ cachedsi.wProcessorLevel = 3; /* pentium */
+ cachedsi.wProcessorRevision = 0;
+
+#ifdef __FreeBSD__
+ cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
+ cachedsi.wProcessorLevel= 5;
+ PF[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
+#ifdef MMX
+ PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE;
+#endif
+ cachedsi.dwNumberOfProcessors=1;
+#else
+ {
+ char buf[20];
+ char line[200];
+ FILE *f = fopen ("/proc/cpuinfo", "r");
+
+ if (!f)
+ return;
+ xhkey = 0;
+ while (fgets(line,200,f)!=NULL) {
+ char *s,*value;
+
+ /* NOTE: the ':' is the only character we can rely on */
+ if (!(value = strchr(line,':')))
+ continue;
+ /* terminate the valuename */
+ *value++ = '\0';
+ /* skip any leading spaces */
+ while (*value==' ') value++;
+ if ((s=strchr(value,'\n')))
+ *s='\0';
+
+ /* 2.1 method */
+ if (!lstrncmpiA(line, "cpu family",strlen("cpu family"))) {
+ if (isdigit (value[0])) {
+ switch (value[0] - '0') {
+ case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386;
+ cachedsi.wProcessorLevel= 3;
+ break;
+ case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486;
+ cachedsi.wProcessorLevel= 4;
+ break;
+ case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
+ cachedsi.wProcessorLevel= 5;
+ break;
+ case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
+ cachedsi.wProcessorLevel= 5;
+ break;
+ default:cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
+ cachedsi.wProcessorLevel= 5;
+ break;
+ }
+ }
+ /* set the CPU type of the current processor */
+ sprintf(buf,"CPU %ld",cachedsi.dwProcessorType);
+ continue;
+ }
+ /* old 2.0 method */
+ if (!lstrncmpiA(line, "cpu",strlen("cpu"))) {
+ if ( isdigit (value[0]) && value[1] == '8' &&
+ value[2] == '6' && value[3] == 0
+ ) {
+ switch (value[0] - '0') {
+ case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386;
+ cachedsi.wProcessorLevel= 3;
+ break;
+ case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486;
+ cachedsi.wProcessorLevel= 4;
+ break;
+ case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
+ cachedsi.wProcessorLevel= 5;
+ break;
+ case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
+ cachedsi.wProcessorLevel= 5;
+ break;
+ default:cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
+ cachedsi.wProcessorLevel= 5;
+ break;
+ }
+ }
+ /* set the CPU type of the current processor */
+ sprintf(buf,"CPU %ld",cachedsi.dwProcessorType);
+ continue;
+ }
+ if (!lstrncmpiA(line,"fdiv_bug",strlen("fdiv_bug"))) {
+ if (!lstrncmpiA(value,"yes",3))
+ PF[PF_FLOATING_POINT_PRECISION_ERRATA] = TRUE;
+
+ continue;
+ }
+ if (!lstrncmpiA(line,"fpu",strlen("fpu"))) {
+ if (!lstrncmpiA(value,"no",2))
+ PF[PF_FLOATING_POINT_EMULATED] = TRUE;
+
+ continue;
+ }
+ if (!lstrncmpiA(line,"processor",strlen("processor"))) {
+ /* processor number counts up...*/
+ int x;
+
+ if (sscanf(value,"%d",&x))
+ if (x+1>cachedsi.dwNumberOfProcessors)
+ cachedsi.dwNumberOfProcessors=x+1;
+
+ /* Create a new processor subkey on a multiprocessor
+ * system
+ */
+ sprintf(buf,"%d",x);
+ }
+ if (!lstrncmpiA(line,"stepping",strlen("stepping"))) {
+ int x;
+
+ if (sscanf(value,"%d",&x))
+ cachedsi.wProcessorRevision = x;
+ }
+ if ( (!lstrncmpiA(line,"flags",strlen("flags"))) ||
+ (!lstrncmpiA(line,"features",strlen("features"))) ) {
+ if (strstr(value,"cx8"))
+ PF[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
+ if (strstr(value,"mmx"))
+ PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE;
+
+ }
+ }
+ fclose (f);
+ }
+#endif /* __FreeBSD__ */
+ memcpy(si,&cachedsi,sizeof(*si));
+}
+
+long WINAPI expGetVersion()
+{
+ return 0xC0000A04;//Windows 98
+}
+
+HANDLE WINAPI expHeapCreate(long flags, long init_size, long max_size)
+{
+// printf("HeapCreate:");
+ dbgprintf("HeapCreate(%X, %X, %X)\n", flags, init_size, max_size);
+ if(init_size==0)
+ return (HANDLE)my_mreq(0x110000, 0);
+ else
+ return (HANDLE)my_mreq(init_size, 0);
+}
+void* WINAPI expHeapAlloc(HANDLE heap, int flags, int size)
+{
+ void* z;
+ dbgprintf("HeapAlloc(%X, %X, %X)\n", heap, flags, size);
+// printf("HeapAlloc:");
+ z=my_mreq(size, flags&8);
+// z=HeapAlloc(heap,flags,size);
+ if(z==0)
+ printf("HeapAlloc failure\n");
+ return z;
+}
+long WINAPI expHeapDestroy(void* heap)
+{
+ dbgprintf("HeapDestroy(%X)\n", heap);
+ my_release(heap);
+ return 1;
+}
+
+long WINAPI expHeapFree(int arg1, int arg2, void* ptr)
+{
+ dbgprintf("HeapFree(%X, %X, %X)\n", arg1, arg2, ptr);
+ my_release(ptr);
+ return 1;
+}
+long WINAPI expHeapSize(int heap, int flags, void* pointer)
+{
+ return my_size(pointer);
+}
+long WINAPI expGetProcessHeap(void)
+{
+ return 1;
+}
+void* WINAPI expVirtualAlloc(void* v1, long v2, long v3, long v4)
+{
+ void* z;
+ dbgprintf("VirtualAlloc(%d %d %d %d) \n",v1,v2,v3,v4);
+ z=VirtualAlloc(v1, v2, v3, v4);
+ if(z==0)
+ printf("VirtualAlloc failure\n");
+ return z;
+}
+int WINAPI expVirtualFree(void* v1, int v2, int v3)
+{
+ dbgprintf("VirtualFree(%X %X %X) \n",v1,v2,v3);
+ return VirtualFree(v1,v2,v3);
+}
+struct CRITSECT
+{
+ pthread_t id;
+ pthread_mutex_t mutex;
+ int locked;
+};
+void WINAPI expInitializeCriticalSection(CRITICAL_SECTION* c)
+{
+ struct CRITSECT cs;
+ dbgprintf("InitCriticalSection(%X) \n", c);
+/* if(sizeof(pthread_mutex_t)>sizeof(CRITICAL_SECTION))
+ {
+ printf(" ERROR:::: sizeof(pthread_mutex_t) is %d, expected <=%d!\n",
+ sizeof(pthread_mutex_t), sizeof(CRITICAL_SECTION));
+ return;
+ }*/
+/* pthread_mutex_init((pthread_mutex_t*)c, NULL); */
+ pthread_mutex_init(&cs.mutex, NULL);
+ cs.locked=0;
+ *(void**)c=malloc(sizeof cs);
+ memcpy(*(void**)c, &cs, sizeof cs);
+ return;
+}
+void WINAPI expEnterCriticalSection(CRITICAL_SECTION* c)
+{
+ struct CRITSECT* cs=(struct CRITSECT*)c;
+ dbgprintf("EnterCriticalSection(%X) \n",c);
+// cs.id=pthread_self();
+ if(cs->locked)
+ if(cs->id==pthread_self())
+ return;
+ pthread_mutex_lock(&(cs->mutex));
+ cs->locked=1;
+ cs->id=pthread_self();
+ return;
+}
+void WINAPI expLeaveCriticalSection(CRITICAL_SECTION* c)
+{
+ struct CRITSECT* cs=(struct CRITSECT*)c;
+ dbgprintf("LeaveCriticalSection(%X) \n",c);
+ cs->locked=0;
+ pthread_mutex_unlock(&(cs->mutex));
+ return;
+}
+void WINAPI expDeleteCriticalSection(CRITICAL_SECTION *c)
+{
+ dbgprintf("DeleteCriticalSection(%X) \n",c);
+ pthread_mutex_destroy((pthread_mutex_t*)c);
+ return;
+}
+int WINAPI expGetCurrentThreadId()
+{
+ dbgprintf("GetCurrentThreadId() \n");
+ return getpid();
+}
+struct tls_s;
+typedef struct tls_s
+{
+ void* value;
+ int used;
+ struct tls_s* prev;
+ struct tls_s* next;
+}tls_t;
+
+tls_t* g_tls=NULL;
+
+void* WINAPI expTlsAlloc()
+{
+ dbgprintf("TlsAlloc \n");
+ if(g_tls==NULL)
+ {
+ g_tls=my_mreq(sizeof(tls_t), 0);
+ g_tls->next=g_tls->prev=NULL;
+ }
+ else
+ {
+ g_tls->next=my_mreq(sizeof(tls_t), 0);
+ g_tls->next->prev=g_tls;
+ g_tls->next->next=NULL;
+ g_tls=g_tls->next;
+ }
+ return g_tls;
+}
+
+int WINAPI expTlsSetValue(tls_t* index, void* value)
+{
+ dbgprintf("TlsSetVal(%X %X) \n", index, value );
+ if(index==0)
+ return 0;
+ index->value=value;
+ return 1;
+}
+void* WINAPI expTlsGetValue(tls_t* index)
+{
+ dbgprintf("TlsGetVal(%X) \n", index );
+ if(index==0)
+ return 0;
+ return index->value;
+}
+int WINAPI expTlsFree(tls_t* index)
+{
+ dbgprintf("TlsFree(%X) \n", index);
+ if(index==0)
+ return 0;
+ if(index->next)
+ index->next->prev=index->prev;
+ if(index->prev)
+ index->prev->next=index->next;
+ my_release((void*)index);
+ return 1;
+}
+
+void* WINAPI expLocalAlloc(int flags, int size)
+{
+ void* z;
+ dbgprintf("LocalAlloc(%d, flags %X)\n", size, flags);
+ if(flags&GMEM_ZEROINIT)
+ z=my_mreq(size, 1);
+ else
+ z=my_mreq(size, 0);
+ if(z==0)
+ printf("LocalAlloc() failed\n");
+ return z;
+}
+void* WINAPI expLocalLock(void* z)
+{
+ dbgprintf("LocalLock\n");
+ return z;
+}
+void* WINAPI expGlobalAlloc(int flags, int size)
+{
+ void* z;
+ dbgprintf("GlobalAlloc(%d, flags 0x%X)\n", size, flags);
+ if(flags&GMEM_ZEROINIT)
+ z=my_mreq(size, 1);
+ else
+ z=my_mreq(size, 0);
+ if(z==0)
+ printf("LocalAlloc() failed\n");
+ return z;
+}
+void* WINAPI expGlobalLock(void* z)
+{
+ dbgprintf("GlobalLock\n");
+ return z;
+}
+
+int WINAPI expLoadStringA(long instance, long id, void* buf, long size)
+{
+ dbgprintf("LoadStringA\n");
+ return LoadStringA(instance, id, buf, size);
+}
+
+long WINAPI expMultiByteToWideChar(long v1, long v2, char* s1, long siz1, char* s2, int siz2)
+{
+#warning FIXME
+ dbgprintf("MB2WCh\n");
+ dbgprintf("WARNING: Unsupported call: MBToWCh %s\n", s1);
+ if(s2==0)
+ return 1;
+ s2[0]=s2[1]=0;
+ return 1;
+}
+long WINAPI expWideCharToMultiByte(long v1, long v2, short* s1, long siz1, char* s2, int siz2, char* c3, int* siz3)
+{
+ int result;
+ dbgprintf("WCh2MB\n");
+ result=WideCharToMultiByte(v1, v2, s1, siz1, s2, siz2, c3, siz3);
+ dbgprintf("=> %d\n", result);
+ return result;
+}
+long WINAPI expGetVersionExA(OSVERSIONINFOA* c)
+{
+ dbgprintf("GetVersionExA\n");
+ c->dwMajorVersion=4;
+ c->dwMinorVersion=10;
+ c->dwBuildNumber=0x40a07ce;
+ c->dwPlatformId=VER_PLATFORM_WIN32_WINDOWS;
+ strcpy(c->szCSDVersion, "Win98");
+ return 1;
+}
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+HANDLE WINAPI expCreateSemaphoreA(char* v1, long init_count, long max_count, char* name)
+{
+#warning FIXME
+/* struct sembuf buf[1];
+ int sem=semget(IPC_PRIVATE,1,IPC_CREAT);
+ if(sem==-1)
+ {
+ printf("semget() failed\n");
+ return (HANDLE)-1;
+ }
+ buf[0].sem_num=0;
+ printf("%s\n", name);
+ printf("Init count %d, max count %d\n", init_count, max_count);
+ buf[0].sem_op=-max_count+init_count;
+ buf[0].sem_flg=0;
+ if(semop(sem, &buf, 1)<0)
+ {
+ printf("semop() failed\n");
+ }
+ return sem;
+*/
+ void* z;
+ dbgprintf("CreateSemaphoreA\n");
+ z=my_mreq(24, 0);
+ pthread_mutex_init(z, NULL);
+ return (HANDLE)z;
+}
+
+long WINAPI expReleaseSemaphore(long hsem, long increment, long* prev_count)
+{
+// The state of a semaphore object is signaled when its count
+// is greater than zero and nonsignaled when its count is equal to zero
+// Each time a waiting thread is released because of the semaphore's signaled
+// state, the count of the semaphore is decreased by one.
+ struct sembuf buf[1];
+ dbgprintf("ReleaseSemaphore\n");
+ dbgprintf("WARNING: Unsupported call: ReleaseSemaphoreA\n");
+/* if(hsem==-1)return 0;
+ buf[0].sem_num=0;
+ buf[0].sem_op=-1;
+ buf[0].sem_flg=0;
+ if(semop(hsem, &buf, 1)<0)
+ {
+ printf("ReleaseSemaphore: semop() failed\n");
+ }*/
+
+ return 1;//zero on error
+}
+
+
+long WINAPI expRegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey)
+{
+ dbgprintf("RegOpenKeyExA(%d,%s)\n", key, subkey);
+ return RegOpenKeyExA(key, subkey, reserved, access, newkey);
+}
+long WINAPI expRegCloseKey(long key)
+{
+ dbgprintf("RegCloseKey()\n");
+ return RegCloseKey(key);
+}
+long WINAPI expRegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count)
+{
+ dbgprintf("RegQueryValueExA()\n");
+ return RegQueryValueExA(key, value, reserved, type, data, count);
+}
+long WINAPI expRegCreateKeyExA(long key, const char* name, long reserved,
+ void* classs, long options, long security,
+ void* sec_attr, int* newkey, int* status)
+{
+ dbgprintf("RegCreateKeyExA()\n");
+ return RegCreateKeyExA(key, name, reserved, classs, options, security, sec_attr, newkey, status);
+}
+long WINAPI expRegSetValueExA(long key, const char* name, long v1, long v2, void* data, long size)
+{
+ dbgprintf("RegSetValueExA()\n");
+ return RegSetValueExA(key, name, v1, v2, data, size);
+}
+
+long WINAPI expRegOpenKeyA (
+long hKey,
+ LPCSTR lpSubKey,
+ int* phkResult
+){
+ return RegOpenKeyExA(hKey, lpSubKey, 0, 0, phkResult);
+}
+
+long WINAPI expQueryPerformanceCounter(long long* z)
+{
+ dbgprintf("QueryPerformanceCounter()\n");
+ longcount(z);
+ return 1;
+}
+
+static double old_freq()
+{
+ int i=time(NULL);
+ int x,y;
+ while(i==time(NULL));
+ x=localcount();
+ i++;
+ while(i==time(NULL));
+ y=localcount();
+ return (double)(y-x)/1000.;
+}
+static double CPU_Freq()
+{
+#ifdef USE_TSC
+ FILE *f = fopen ("/proc/cpuinfo", "r");
+ char line[200];
+ char model[200]="unknown";
+ char flags[500]="";
+ char *s,*value;
+ double freq=-1;
+
+ if (!f)
+ {
+ printf("Can't open /proc/cpuinfo for reading\n");
+ return old_freq();
+ }
+ while (fgets(line,200,f)!=NULL)
+ {
+ /* NOTE: the ':' is the only character we can rely on */
+ if (!(value = strchr(line,':')))
+ continue;
+ /* terminate the valuename */
+ *value++ = '\0';
+ /* skip any leading spaces */
+ while (*value==' ') value++;
+ if ((s=strchr(value,'\n')))
+ *s='\0';
+
+ if (!strncasecmp(line, "cpu MHz",strlen("cpu MHz")))
+ {
+ sscanf(value, "%lf", &freq);
+ freq*=1000;
+ break;
+ }
+ continue;
+
+ }
+ fclose(f);
+ if(freq<0)return old_freq();
+ return freq;
+#else
+ return old_freq();
+#endif
+}
+
+long WINAPI expQueryPerformanceFrequency(long long* z)
+{
+ dbgprintf("QueryPerformanceFrequency()\n");
+ *z=(long long)CPU_Freq();
+ return 1;
+}
+long WINAPI exptimeGetTime()
+{
+ struct timeval t;
+ dbgprintf("timeGetTime()\n");
+ gettimeofday(&t, 0);
+ return 1000*t.tv_sec+t.tv_usec/1000;
+}
+void* WINAPI expLocalHandle(void* v)
+{
+ dbgprintf("LocalHandle\n");
+ return v;
+}
+void* WINAPI expGlobalHandle(void* v)
+{
+ dbgprintf("GlobalHandle\n");
+ return v;
+}
+int WINAPI expGlobalUnlock(void* v)
+{
+ dbgprintf("GlobalUnlock\n");
+ return 1;
+}
+//
+void* WINAPI expGlobalFree(void* v)
+{
+ dbgprintf("GlobalFree(%X)\n", v);
+ my_release(v);
+ return 0;
+}
+
+int WINAPI expLocalUnlock(void* v)
+{
+ dbgprintf("LocalUnlock\n");
+ return 1;
+}
+//
+void* WINAPI expLocalFree(void* v)
+{
+ dbgprintf("LocalFree(%X)\n", v);
+ my_release(v);
+ return 0;
+}
+
+HRSRC WINAPI expFindResourceA(HMODULE module, char* name, char* type)
+{
+ dbgprintf("FindResourceA\n");
+ return FindResourceA(module, name, type);
+}
+HGLOBAL WINAPI expLoadResource(HMODULE module, HRSRC res)
+{
+ dbgprintf("LoadResource\n");
+ return LoadResource(module, res);;
+}
+void* WINAPI expLockResource(long res)
+{
+ dbgprintf("LockResource\n");
+ return LockResource(res);
+}
+int WINAPI expFreeResource(long res)
+{
+ dbgprintf("FreeResource\n");
+ return FreeResource(res);
+}
+//bool fun(HANDLE)
+//!0 on success
+int WINAPI expCloseHandle(long v1)
+{
+ dbgprintf("CloseHandle\n");
+ return 1;
+}
+
+const char* WINAPI expGetCommandLineA()
+{
+ dbgprintf("GetCommandLine\n");
+ return "c:\\aviplay.exe";
+}
+LPWSTR WINAPI expGetEnvironmentStringsW()
+{
+ static wchar_t envs[]={'p', 'a', 't', 'h', ' ', 'c', ':', '\\', 0, 0};
+ dbgprintf("GetEnvStringsW\n");
+ return (LPWSTR)envs;
+}
+
+int WINAPI expFreeEnvironmentStringsW(short* strings)
+{
+ dbgprintf("FreeEnvStringsW\n");
+ return 1;
+}
+LPCSTR WINAPI expGetEnvironmentStrings()
+{
+ dbgprintf("GetEnvStrings\n");
+ return "\0\0";
+}
+
+int WINAPI expGetStartupInfoA(STARTUPINFOA *s)
+{
+ int i;
+ dbgprintf("GetStartupInfoA\n");
+/*
+ for(i=0; i<sizeof(STARTUPINFOA)/4; i++)
+ ((int*)s)[i]=i+0x200;
+*/
+ memset(s, 0, sizeof(*s));
+ s->cb=sizeof(*s);
+ s->lpReserved="qwe";
+ s->lpDesktop="rty";
+ s->lpTitle="uio";
+ s->dwX=s->dwY=0;
+ s->dwXSize=s->dwYSize=200;
+ s->dwFlags=s->wShowWindow=0;
+ return 1;
+}
+
+int WINAPI expGetStdHandle(int z)
+{
+ dbgprintf("GetStdHandle\n");
+ dbgprintf("WARNING: Unsupported call: GetStdHandle\n");
+ return 1234;
+}
+int WINAPI expGetFileType(int handle)
+{
+ dbgprintf("GetFileType\n");
+ dbgprintf("WARNING: Unsupported call: GetFileType\n");
+ return 5678;
+}
+int WINAPI expSetHandleCount(int count)
+{
+ dbgprintf("SetHandleCount\n");
+ return 1;
+}
+int WINAPI expGetACP()
+{
+ dbgprintf("GetACP\n");
+ dbgprintf("WARNING: Unsupported call: GetACP\n");
+ return 0;
+}
+extern WINE_MODREF *MODULE32_LookupHMODULE(HMODULE m);
+int WINAPI expGetModuleFileNameA(int module, char* s, int len)
+{
+ WINE_MODREF *mr;
+ dbgprintf("GetModuleFileNameA\n");
+// printf("File name of module %X requested\n", module);
+ if(s==0)
+ return 0;
+ if(len<35)
+ return 0;
+ strcpy(s, "c:\\windows\\system\\");
+ mr=MODULE32_LookupHMODULE(module);
+ if(mr==0)//oops
+ {
+ strcat(s, "aviplay.dll");
+ return 1;
+ }
+ if(strrchr(mr->filename, '/')==NULL)
+ strcat(s, mr->filename);
+ else
+ strcat(s, strrchr(mr->filename, '/')+1);
+ return 1;
+}
+
+int WINAPI expSetUnhandledExceptionFilter(void* filter)
+{
+ dbgprintf("SetUnhandledExcFilter\n");
+ return 1;//unsupported and probably won't ever be supported
+}
+extern char* def_path;
+
+int WINAPI expLoadLibraryA(char* name)
+{
+ char qq[256];
+ dbgprintf("LoadLibraryA\n");
+ printf("They want library %s\n", name);
+ strcpy(qq, def_path);
+ strcat(qq, "/");
+ strcat(qq, name);
+ return LoadLibraryA(qq);
+}
+int WINAPI expFreeLibrary(int module)
+{
+ dbgprintf("FreeLibrary\n");
+ return FreeLibrary(module);
+}
+void* WINAPI expGetProcAddress(HMODULE mod, char* name)
+{
+ dbgprintf("GetProcAddress\n");
+ return GetProcAddress(mod, name);
+}
+
+long WINAPI expCreateFileMappingA(int hFile, void* lpAttr,
+ long flProtect, long dwMaxHigh, long dwMaxLow, const char* name)
+{
+ dbgprintf("CreateFileMappingA\n");
+ return CreateFileMappingA(hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, name);
+}
+
+long WINAPI expOpenFileMappingA(long hFile, long hz, const char* name)
+{
+ dbgprintf("OpenFileMappingA\n");
+ return OpenFileMappingA(hFile, hz, name);
+}
+
+void* WINAPI expMapViewOfFile(HANDLE file, DWORD mode, DWORD offHigh, DWORD offLow, DWORD size)
+{
+ dbgprintf("MapViewOfFile(%d, %x, %x, %x, %x)\n",
+ file,mode,offHigh,offLow,size);
+ return (char*)file+offLow;
+}
+
+void* WINAPI expUnmapViewOfFile(void* view)
+{
+ dbgprintf("UnmapViewOfFile()\n");
+ return 0;
+}
+
+void* WINAPI expSleep(int time)
+{
+ dbgprintf("Sleep(%d)\n", time);
+ usleep(time);
+ return 0;
+}
+ // why does IV32 codec want to call this? I don't know ...
+void* WINAPI expCreateCompatibleDC(int hdc)
+{
+ dbgprintf("CreateCompatibleDC(%d)\n", hdc);
+ return (void*)129;
+}
+
+int WINAPI expGetDeviceCaps(int hdc, int unk)
+{
+ dbgprintf("GetDeviceCaps(%d, %d)\n", hdc, unk);
+ return 0;
+}
+
+WIN_BOOL WINAPI expDeleteDC(int hdc)
+{
+ dbgprintf("DeleteDC(%d)\n", hdc);
+ return 0;
+}
+
+int expwsprintfA(char* string, char* format, ...)
+{
+ va_list va;
+ va_start(va, format);
+ dbgprintf("wsprintfA\n");
+ return vsprintf(string, format, va);
+}
+
+int WINAPI expGetPrivateProfileIntA(const char* appname, const char* keyname, int default_value, const char* filename)
+{
+ int size=255;
+ char buffer[256];
+ char* fullname;
+ int result;
+
+ buffer[255]=0;
+ dbgprintf("GetPrivateProfileIntA(%s, %s, %s)\n", appname, keyname, filename );
+ if(!(appname && keyname && filename) ) return default_value;
+ fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
+ strcpy(fullname, "Software\\IniFileMapping\\");
+ strcat(fullname, appname);
+ strcat(fullname, "\\");
+ strcat(fullname, keyname);
+ strcat(fullname, "\\");
+ strcat(fullname, filename);
+ result=RegQueryValueExA(HKEY_LOCAL_MACHINE, fullname, NULL, NULL, (int*)buffer, &size);
+ if((size>=0)&&(size<256))
+ buffer[size]=0;
+// printf("GetPrivateProfileIntA(%s, %s, %s) -> %s\n", appname, keyname, filename, buffer);
+ free(fullname);
+ if(result)
+ return default_value;
+ else
+ return atoi(buffer);
+}
+int WINAPI expGetPrivateProfileStringA(const char* appname, const char* keyname,
+ const char* def_val, char* dest, unsigned int len, const char* filename)
+{
+ int result;
+ int size;
+ char* fullname;
+ dbgprintf("GetPrivateProfileStringA(%s, %s, %s, %X, %X, %s)\n", appname, keyname, def_val, dest, len, filename );
+ if(!(appname && keyname && filename) ) return 0;
+ fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
+ strcpy(fullname, "Software\\IniFileMapping\\");
+ strcat(fullname, appname);
+ strcat(fullname, "\\");
+ strcat(fullname, keyname);
+ strcat(fullname, "\\");
+ strcat(fullname, filename);
+ size=len;
+ result=RegQueryValueExA(HKEY_LOCAL_MACHINE, fullname, NULL, NULL, (int*)dest, &size);
+// printf("GetPrivateProfileStringA(%s, %s, %s, %X, %X, %s)\n", appname, keyname, def_val, dest, len, filename );
+ free(fullname);
+ if(!result)
+ return size;
+ strncpy(dest, def_val, size);
+ return size;
+}
+int WINAPI expWritePrivateProfileStringA(const char* appname, const char* keyname,
+ const char* string, const char* filename)
+{
+ int size=256;
+ char* fullname;
+ dbgprintf("WritePrivateProfileStringA(%s, %s, %s, %s)\n", appname, keyname, string, filename );
+ if(!(appname && keyname && filename) ) return -1;
+ fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
+ strcpy(fullname, "Software\\IniFileMapping\\");
+ strcat(fullname, appname);
+ strcat(fullname, "\\");
+ strcat(fullname, keyname);
+ strcat(fullname, "\\");
+ strcat(fullname, filename);
+ RegSetValueExA(HKEY_LOCAL_MACHINE, fullname, 0, REG_SZ, (int*)string, strlen(string));
+// printf("RegSetValueExA(%s,%d)\n", string, strlen(string));
+// printf("WritePrivateProfileStringA(%s, %s, %s, %s)\n", appname, keyname, string, filename );
+ free(fullname);
+ return 0;
+}
+
+unsigned int _GetPrivateProfileIntA(const char* appname, const char* keyname, INT default_value, const char* filename)
+{
+ return expGetPrivateProfileIntA(appname, keyname, default_value, filename);
+}
+int _GetPrivateProfileStringA(const char* appname, const char* keyname,
+ const char* def_val, char* dest, unsigned int len, const char* filename)
+{
+ return expGetPrivateProfileStringA(appname, keyname, def_val, dest, len, filename);
+}
+int _WritePrivateProfileStringA(const char* appname, const char* keyname,
+ const char* string, const char* filename)
+{
+ return expWritePrivateProfileStringA(appname, keyname, string, filename);
+}
+
+
+int WINAPI expDefDriverProc(int _private, int id, int msg, int arg1, int arg2)
+{
+ printf("Called DefDriverProc(%X)\n", msg);
+ return 0;
+}
+
+int WINAPI expSizeofResource(int v1, int v2)
+{
+ dbgprintf("SizeofResource()\n");
+ return SizeofResource(v1, v2);
+}
+
+int WINAPI expGetLastError()
+{
+ dbgprintf("GetLastError()\n");
+ return GetLastError();
+}
+
+void WINAPI expSetLastError(int error)
+{
+ dbgprintf("SetLastError()\n");
+ SetLastError(error);
+}
+
+char* expstrrchr(char* string, int value)
+{
+ return strrchr(string, value);
+}
+
+char* expstrchr(char* string, int value)
+{
+ return strchr(string, value);
+}
+
+int WINAPI expGetFileVersionInfoSizeA(const char* name, int* lpHandle)
+{
+ printf("GetFileVersionInfoSizeA(%s,0x%X)\n", name, lpHandle);
+ return 0;
+}
+
+int WINAPI expIsBadStringPtrW(const short* string, int nchars)
+{
+ if(string==0)return 1;
+ return 0;
+}
+extern long WINAPI InterlockedExchangeAdd( long* dest, long incr )
+{
+ long ret;
+ __asm__ __volatile__( "lock; xaddl %0,(%1)"
+ : "=r" (ret) : "r" (dest), "0" (incr) : "memory" );
+ return ret;
+}
+
+extern long WINAPI expInterlockedIncrement( long* dest )
+{
+ return InterlockedExchangeAdd( dest, 1 ) + 1;
+}
+extern long WINAPI expInterlockedDecrement( long* dest )
+{
+ return InterlockedExchangeAdd( dest, -1 ) - 1;
+}
+
+extern void WINAPI expOutputDebugStringA( const char* string )
+{
+ fprintf(stderr, "DEBUG: %s\n", string);
+}
+
+int WINAPI expGetDC(int hwnd)
+{
+ return 0;
+}
+
+int WINAPI expGetDesktopWindow()
+{
+ return 0;
+}
+
+int WINAPI expReleaseDC(int hwnd, int hdc)
+{
+ return 0;
+}
+
+int WINAPI expGetSystemPaletteEntries(int hdc, int iStartIndex, int nEntries, void* lppe)
+{
+ return 0;
+}
+/*
+typedef struct _TIME_ZONE_INFORMATION {
+ long Bias;
+ char StandardName[32];
+ SYSTEMTIME StandardDate;
+ long StandardBias;
+ char DaylightName[32];
+ SYSTEMTIME DaylightDate;
+ long DaylightBias;
+} TIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;
+*/
+
+int WINAPI expGetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
+{
+ memset(lpTimeZoneInformation, 0, sizeof(TIME_ZONE_INFORMATION));
+ return 0;
+}
+
+void WINAPI expGetLocalTime(SYSTEMTIME* systime)
+{
+ time_t local_time;
+ struct tm *local_tm;
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ local_time=tv.tv_sec;
+ local_tm=localtime(&local_time);
+
+ systime->wYear = local_tm->tm_year + 1900;
+ systime->wMonth = local_tm->tm_mon + 1;
+ systime->wDayOfWeek = local_tm->tm_wday;
+ systime->wDay = local_tm->tm_mday;
+ systime->wHour = local_tm->tm_hour;
+ systime->wMinute = local_tm->tm_min;
+ systime->wSecond = local_tm->tm_sec;
+ systime->wMilliseconds = (tv.tv_usec / 1000) % 1000;
+}
+
+int WINAPI expGetSystemTime(SYSTEMTIME* systime)
+{
+ time_t local_time;
+ struct tm *local_tm;
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ local_time=tv.tv_sec;
+ local_tm=gmtime(&local_time);
+
+ systime->wYear = local_tm->tm_year + 1900;
+ systime->wMonth = local_tm->tm_mon + 1;
+ systime->wDayOfWeek = local_tm->tm_wday;
+ systime->wDay = local_tm->tm_mday;
+ systime->wHour = local_tm->tm_hour;
+ systime->wMinute = local_tm->tm_min;
+ systime->wSecond = local_tm->tm_sec;
+ systime->wMilliseconds = (tv.tv_usec / 1000) % 1000;
+
+}
+
+int WINAPI expGetEnvironmentVariableA(const char* name, char* field, int size)
+{
+ dbgprintf("GetEnvironmentVariableA\n");
+ printf("%s %x %x\n", name, field, size);
+ if(field)field[0]=0;
+ return 0;
+}
+
+
+//HDRVR WINAPI expOpenDriverA(LPCSTR szDriverName, LPCSTR szSectionName, LPARAM lParam2);
+//HDRVR WINAPI expOpenDriverW(LPCWSTR szDriverName, LPCWSTR szSectionName, LPARAM lParam2);
+HDRVR WINAPI expOpenDriver(LPCSTR szDriverName, LPCSTR szSectionName, LPARAM lParam2){
+ printf("winmm32::OpenDriver() called\n");
+ return NULL;
+}
+
+
+struct exports
+{
+ char name[64];
+ int id;
+ void* func;
+};
+struct libs
+{
+ char name[64];
+ int length;
+ struct exports* exps;
+};
+
+#define FF(X,Y) \
+{#X, Y, (void*)exp##X},
+
+struct exports exp_kernel32[]={
+FF(IsBadWritePtr, 357)
+FF(IsBadReadPtr, 354)
+FF(IsBadStringPtrW, -1)
+FF(DisableThreadLibraryCalls, -1)
+FF(CreateThread, -1)
+FF(CreateEventA, -1)
+FF(SetEvent, -1)
+FF(ResetEvent, -1)
+FF(WaitForSingleObject, -1)
+FF(GetSystemInfo, -1)
+FF(GetVersion, 332)
+FF(HeapCreate, 461)
+FF(HeapAlloc, -1)
+FF(HeapDestroy, -1)
+FF(HeapFree, -1)
+FF(HeapSize, -1)
+FF(GetProcessHeap, -1)
+FF(VirtualAlloc, -1)
+FF(VirtualFree, -1)
+FF(InitializeCriticalSection, -1)
+FF(EnterCriticalSection, -1)
+FF(LeaveCriticalSection, -1)
+FF(DeleteCriticalSection, -1)
+FF(TlsAlloc, -1)
+FF(TlsFree, -1)
+FF(TlsGetValue, -1)
+FF(TlsSetValue, -1)
+FF(GetCurrentThreadId, -1)
+FF(LocalAlloc, -1)
+FF(LocalLock, -1)
+FF(GlobalAlloc, -1)
+FF(GlobalLock, -1)
+FF(MultiByteToWideChar, 427)
+FF(WideCharToMultiByte, -1)
+FF(GetVersionExA, -1)
+FF(CreateSemaphoreA, -1)
+FF(QueryPerformanceCounter, -1)
+FF(QueryPerformanceFrequency, -1)
+FF(LocalHandle, -1)
+FF(LocalUnlock, -1)
+FF(LocalFree, -1)
+FF(GlobalHandle, -1)
+FF(GlobalUnlock, -1)
+FF(GlobalFree, -1)
+FF(LoadResource, -1)
+FF(ReleaseSemaphore, -1)
+FF(FindResourceA, -1)
+FF(LockResource, -1)
+FF(FreeResource, -1)
+FF(SizeofResource, -1)
+FF(CloseHandle, -1)
+FF(GetCommandLineA, -1)
+FF(GetEnvironmentStringsW, -1)
+FF(FreeEnvironmentStringsW, -1)
+FF(GetEnvironmentStrings, -1)
+FF(GetStartupInfoA, -1)
+FF(GetStdHandle, -1)
+FF(GetFileType, -1)
+FF(SetHandleCount, -1)
+FF(GetACP, -1)
+FF(GetModuleFileNameA, -1)
+FF(SetUnhandledExceptionFilter, -1)
+FF(LoadLibraryA, -1)
+FF(GetProcAddress, -1)
+FF(FreeLibrary, -1)
+FF(CreateFileMappingA, -1)
+FF(OpenFileMappingA, -1)
+FF(MapViewOfFile, -1)
+FF(UnmapViewOfFile, -1)
+FF(Sleep, -1)
+FF(GetModuleHandleA, -1)
+FF(GetPrivateProfileIntA, -1)
+FF(GetPrivateProfileStringA, -1)
+FF(WritePrivateProfileStringA, -1)
+FF(GetLastError, -1)
+FF(SetLastError, -1)
+FF(InterlockedIncrement, -1)
+FF(InterlockedDecrement, -1)
+FF(GetTimeZoneInformation, -1)
+FF(OutputDebugStringA, -1)
+FF(GetLocalTime, -1)
+FF(GetSystemTime, -1)
+FF(GetEnvironmentVariableA, -1)
+};
+
+struct exports exp_msvcrt[]={
+FF(malloc, -1)
+FF(_initterm, -1)
+FF(free, -1)
+{"??3@YAXPAX@Z", -1, expdelete},
+{"??2@YAPAXI@Z", -1, expnew},
+FF(strrchr, -1)
+FF(strchr, -1)
+};
+struct exports exp_winmm[]={
+FF(GetDriverModuleHandle, -1)
+FF(timeGetTime, -1)
+FF(DefDriverProc, -1)
+FF(OpenDriver, -1)
+};
+struct exports exp_user32[]={
+FF(LoadStringA, -1)
+FF(wsprintfA, -1)
+FF(GetDC, -1)
+FF(GetDesktopWindow, -1)
+FF(ReleaseDC, -1)
+};
+struct exports exp_advapi32[]={
+FF(RegOpenKeyA, -1)
+FF(RegOpenKeyExA, -1)
+FF(RegCreateKeyExA, -1)
+FF(RegQueryValueExA, -1)
+FF(RegSetValueExA, -1)
+FF(RegCloseKey, -1)
+};
+struct exports exp_gdi32[]={
+FF(CreateCompatibleDC, -1)
+FF(GetDeviceCaps, -1)
+FF(DeleteDC, -1)
+FF(GetSystemPaletteEntries, -1)
+};
+struct exports exp_version[]={
+FF(GetFileVersionInfoSizeA, -1)
+};
+#define LL(X) \
+{#X".dll", sizeof(exp_##X)/sizeof(struct exports), exp_##X},
+
+struct libs libraries[]={
+LL(kernel32)
+LL(msvcrt)
+LL(winmm)
+LL(user32)
+LL(advapi32)
+LL(gdi32)
+LL(version)
+};
+
+void* LookupExternal(const char* library, int ordinal)
+{
+ char* answ;
+ int i,j;
+ if(library==0)
+ {
+ printf("ERROR: library=0\n");
+ return (void*)ext_unknown;
+ }
+ printf("External func %s:%d\n", library, ordinal);
+// printf("%x %x\n", &unk_exp1, &unk_exp2);
+
+ for(i=0; i<sizeof(libraries)/sizeof(struct libs); i++)
+ {
+ if(strcasecmp(library, libraries[i].name))
+ continue;
+ for(j=0; j<libraries[i].length; j++)
+ {
+ if(ordinal!=libraries[i].exps[j].id)
+ continue;
+ printf("Hit: 0x%08X\n", libraries[i].exps[j].func);
+ return libraries[i].exps[j].func;
+ }
+ }
+ if(pos>150)return 0;
+ answ=(char*)extcode+pos*0x64;
+ memcpy(answ, &unk_exp1, 0x64);
+ *(int*)(answ+9)=pos;
+ *(int*)(answ+47)-=((int)answ-(int)&unk_exp1);
+ sprintf(export_names[pos], "%s:%d", library, ordinal);
+ pos++;
+ return (void*)answ;
+}
+
+void* LookupExternalByName(const char* library, const char* name)
+{
+ char* answ;
+ int i,j;
+// return (void*)ext_unknown;
+ if(library==0)
+ {
+ printf("ERROR: library=0\n");
+ return (void*)ext_unknown;
+ }
+ if(name==0)
+ {
+ printf("ERROR: name=0\n");
+ return (void*)ext_unknown;
+ }
+// printf("External func %s:%s\n", library, name);
+ for(i=0; i<sizeof(libraries)/sizeof(struct libs); i++)
+ {
+ if(strcasecmp(library, libraries[i].name))
+ continue;
+ for(j=0; j<libraries[i].length; j++)
+ {
+ if(strcmp(name, libraries[i].exps[j].name))
+ continue;
+// printf("Hit: 0x%08X\n", libraries[i].exps[j].func);
+ return libraries[i].exps[j].func;
+ }
+ }// printf("%x %x\n", &unk_exp1, &unk_exp2);
+ //printf("Missing (%d) External func %s:%s\n", pos, library, name);
+ if(pos>150){
+// printf("Warning! Too many missing externals!\n");
+ return 0;
+ }
+ strcpy(export_names[pos], name);
+ answ=(char*)extcode+pos*0x64;
+ memcpy(answ, &unk_exp1, 0x64);
+ *(int*)(answ+9)=pos;
+ *(int*)(answ+47)-=((int)answ-(int)&unk_exp1);
+ pos++;
+ return (void*)answ;
+// memcpy(extcode, &unk_exp1, 0x64);
+// *(int*)(extcode+52)-=((int)extcode-(int)&unk_exp1);
+// return (void*)extcode;
+// printf("Unknown func %s:%s\n", library, name);
+// return (void*)ext_unknown;
+}
+
diff --git a/loader/win32.h b/loader/win32.h
new file mode 100644
index 0000000000..327cfb2989
--- /dev/null
+++ b/loader/win32.h
@@ -0,0 +1 @@
+int ext_unknown();
diff --git a/loader/wine/avifmt.h b/loader/wine/avifmt.h
new file mode 100644
index 0000000000..33646a9f34
--- /dev/null
+++ b/loader/wine/avifmt.h
@@ -0,0 +1,246 @@
+/****************************************************************************
+ *
+ * AVIFMT - AVI file format definitions
+ *
+ ****************************************************************************/
+#ifndef AVIFMT
+
+#define AVIFMT
+
+#ifndef NOAVIFMT
+
+
+#ifndef __WINE_WINDEF_H
+#include <wine/windef.h>
+#endif
+
+#ifndef __WINE_MMSYSTEM_H
+#ifndef __WINE_MSACM_H
+typedef DWORD FOURCC;
+#endif
+#endif
+
+
+#ifdef _MSC_VER
+#pragma warning(disable:4200)
+#endif
+
+/* The following is a short description of the AVI file format. Please
+ * see the accompanying documentation for a full explanation.
+ *
+ * An AVI file is the following RIFF form:
+ *
+ * RIFF('AVI'
+ * LIST('hdrl'
+ * avih(<MainAVIHeader>)
+ * LIST ('strl'
+ * strh(<Stream header>)
+ * strf(<Stream format>)
+ * ... additional header data
+ * LIST('movi'
+ * { LIST('rec'
+ * SubChunk...
+ * )
+ * | SubChunk } ....
+ * )
+ * [ <AVIIndex> ]
+ * )
+ *
+ * The main file header specifies how many streams are present. For
+ * each one, there must be a stream header chunk and a stream format
+ * chunk, enlosed in a 'strl' LIST chunk. The 'strf' chunk contains
+ * type-specific format information; for a video stream, this should
+ * be a BITMAPINFO structure, including palette. For an audio stream,
+ * this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure.
+ *
+ * The actual data is contained in subchunks within the 'movi' LIST
+ * chunk. The first two characters of each data chunk are the
+ * stream number with which that data is associated.
+ *
+ * Some defined chunk types:
+ * Video Streams:
+ * ##db: RGB DIB bits
+ * ##dc: RLE8 compressed DIB bits
+ * ##pc: Palette Change
+ *
+ * Audio Streams:
+ * ##wb: waveform audio bytes
+ *
+ * The grouping into LIST 'rec' chunks implies only that the contents of
+ * the chunk should be read into memory at the same time. This
+ * grouping is used for files specifically intended to be played from
+ * CD-ROM.
+ *
+ * The index chunk at the end of the file should contain one entry for
+ * each data chunk in the file.
+ *
+ * Limitations for the current software:
+ * Only one video stream and one audio stream are allowed.
+ * The streams must start at the beginning of the file.
+ *
+ *
+ * To register codec types please obtain a copy of the Multimedia
+ * Developer Registration Kit from:
+ *
+ * Microsoft Corporation
+ * Multimedia Systems Group
+ * Product Marketing
+ * One Microsoft Way
+ * Redmond, WA 98052-6399
+ *
+ */
+
+#ifndef mmioFOURCC
+#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
+ ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
+ ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
+#endif
+
+/* Macro to make a TWOCC out of two characters */
+#ifndef aviTWOCC
+#define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
+#endif
+
+typedef WORD TWOCC;
+
+/* form types, list types, and chunk types */
+#define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ')
+#define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l')
+#define ckidAVIMAINHDR mmioFOURCC('a', 'v', 'i', 'h')
+#define listtypeSTREAMHEADER mmioFOURCC('s', 't', 'r', 'l')
+#define ckidSTREAMHEADER mmioFOURCC('s', 't', 'r', 'h')
+#define ckidSTREAMFORMAT mmioFOURCC('s', 't', 'r', 'f')
+#define ckidSTREAMHANDLERDATA mmioFOURCC('s', 't', 'r', 'd')
+#define ckidSTREAMNAME mmioFOURCC('s', 't', 'r', 'n')
+
+#define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i')
+#define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ')
+
+#define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1')
+
+/*
+** Stream types for the <fccType> field of the stream header.
+*/
+#define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
+#define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
+#define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
+#define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
+
+/* Basic chunk types */
+#define cktypeDIBbits aviTWOCC('d', 'b')
+#define cktypeDIBcompressed aviTWOCC('d', 'c')
+#define cktypePALchange aviTWOCC('p', 'c')
+#define cktypeWAVEbytes aviTWOCC('w', 'b')
+
+/* Chunk id to use for extra chunks for padding. */
+#define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K')
+
+/*
+** Useful macros
+**
+** Warning: These are nasty macro, and MS C 6.0 compiles some of them
+** incorrectly if optimizations are on. Ack.
+*/
+
+/* Macro to get stream number out of a FOURCC ckid */
+#define FromHex(n) (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0'))
+#define StreamFromFOURCC(fcc) ((WORD) ((FromHex(LOBYTE(LOWORD(fcc))) << 4) + \
+ (FromHex(HIBYTE(LOWORD(fcc))))))
+
+/* Macro to get TWOCC chunk type out of a FOURCC ckid */
+#define TWOCCFromFOURCC(fcc) HIWORD(fcc)
+
+/* Macro to make a ckid for a chunk out of a TWOCC and a stream number
+** from 0-255.
+*/
+#define ToHex(n) ((BYTE) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0')))
+#define MAKEAVICKID(tcc, stream) \
+ MAKELONG((ToHex((stream) & 0x0f) << 8) | \
+ (ToHex(((stream) & 0xf0) >> 4)), tcc)
+
+/*
+** Main AVI File Header
+*/
+
+/* flags for use in <dwFlags> in AVIFileHdr */
+#define AVIF_HASINDEX 0x00000010 // Index at end of file?
+#define AVIF_MUSTUSEINDEX 0x00000020
+#define AVIF_ISINTERLEAVED 0x00000100
+#define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames?
+#define AVIF_WASCAPTUREFILE 0x00010000
+#define AVIF_COPYRIGHTED 0x00020000
+
+/* The AVI File Header LIST chunk should be padded to this size */
+#define AVI_HEADERSIZE 2048 // size of AVI header list
+
+typedef struct
+{
+ DWORD dwMicroSecPerFrame; // frame display rate (or 0L)
+ DWORD dwMaxBytesPerSec; // max. transfer rate
+ DWORD dwPaddingGranularity; // pad to multiples of this
+ // size; normally 2K.
+ DWORD dwFlags; // the ever-present flags
+ DWORD dwTotalFrames; // # frames in file
+ DWORD dwInitialFrames;
+ DWORD dwStreams;
+ DWORD dwSuggestedBufferSize;
+
+ DWORD dwWidth;
+ DWORD dwHeight;
+
+ DWORD dwReserved[4];
+} MainAVIHeader;
+
+/*
+** Stream header
+*/
+
+#define AVISF_DISABLED 0x00000001
+
+#define AVISF_VIDEO_PALCHANGES 0x00010000
+
+
+typedef struct {
+ FOURCC fccType;
+ FOURCC fccHandler;
+ DWORD dwFlags; /* Contains AVITF_* flags */
+ WORD wPriority;
+ WORD wLanguage;
+ DWORD dwInitialFrames;
+ DWORD dwScale;
+ DWORD dwRate; /* dwRate / dwScale == samples/second */
+ DWORD dwStart;
+ DWORD dwLength; /* In units above... */
+ DWORD dwSuggestedBufferSize;
+ DWORD dwQuality;
+ DWORD dwSampleSize;
+ RECT rcFrame;
+} AVIStreamHeader;
+
+/* Flags for index */
+#define AVIIF_LIST 0x00000001L // chunk is a 'LIST'
+#define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
+
+#define AVIIF_NOTIME 0x00000100L // this frame doesn't take any time
+#define AVIIF_COMPUSE 0x0FFF0000L // these bits are for compressor use
+
+#define FOURCC_RIFF mmioFOURCC('R', 'I', 'F', 'F')
+#define FOURCC_LIST mmioFOURCC('L', 'I', 'S', 'T')
+
+typedef struct
+{
+ DWORD ckid;
+ DWORD dwFlags;
+ DWORD dwChunkOffset; // Position of chunk
+ DWORD dwChunkLength; // Length of chunk
+} AVIINDEXENTRY;
+
+#define AVISTREAMREAD_CONVENIENT (-1L)
+
+/*
+** Palette change chunk
+**
+** Used in video streams.
+*/
+#endif /* NOAVIFMT */
+#endif
diff --git a/loader/wine/basetsd.h b/loader/wine/basetsd.h
new file mode 100644
index 0000000000..7b5d3aba92
--- /dev/null
+++ b/loader/wine/basetsd.h
@@ -0,0 +1,145 @@
+/*
+ * Compilers that uses ILP32, LP64 or P64 type models
+ * for both Win32 and Win64 are supported by this file.
+ */
+
+#ifndef __WINE_BASETSD_H
+#define __WINE_BASETSD_H
+
+#ifdef __WINE__
+#include "config.h"
+#endif /* defined(__WINE__) */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* defined(__cplusplus) */
+
+/*
+ * Win32 was easy to implement under Unix since most (all?) 32-bit
+ * Unices uses the same type model (ILP32) as Win32, where int, long
+ * and pointer are 32-bit.
+ *
+ * Win64, however, will cause some problems when implemented under Unix.
+ * Linux/{Alpha, Sparc64} and most (all?) other 64-bit Unices uses
+ * the LP64 type model where int is 32-bit and long and pointer are
+ * 64-bit. Win64 on the other hand uses the P64 (sometimes called LLP64)
+ * type model where int and long are 32 bit and pointer is 64-bit.
+ */
+
+/* Type model indepent typedefs */
+
+typedef char __int8;
+typedef unsigned char __uint8;
+
+typedef short __int16;
+typedef unsigned short __uint16;
+
+typedef int __int32;
+typedef unsigned int __uint32;
+
+typedef long long __int64;
+typedef unsigned long long __uint64;
+
+#if defined(_WIN64)
+
+typedef __uint32 __ptr32;
+typedef void *__ptr64;
+
+#else /* FIXME: defined(_WIN32) */
+
+typedef void *__ptr32;
+typedef __uint64 __ptr64;
+
+#endif
+
+/* Always signed and 32 bit wide */
+
+typedef __int32 LONG32;
+//typedef __int32 INT32;
+
+typedef LONG32 *PLONG32;
+//typedef INT32 *PINT32;
+
+/* Always unsigned and 32 bit wide */
+
+typedef __uint32 ULONG32;
+typedef __uint32 DWORD32;
+typedef __uint32 UINT32;
+
+typedef ULONG32 *PULONG32;
+typedef DWORD32 *PDWORD32;
+typedef UINT32 *PUINT32;
+
+/* Always signed and 64 bit wide */
+
+typedef __int64 LONG64;
+typedef __int64 INT64;
+
+typedef LONG64 *PLONG64;
+typedef INT64 *PINT64;
+
+/* Always unsigned and 64 bit wide */
+
+typedef __uint64 ULONG64;
+typedef __uint64 DWORD64;
+typedef __uint64 UINT64;
+
+typedef ULONG64 *PULONG64;
+typedef DWORD64 *PDWORD64;
+typedef UINT64 *PUINT64;
+
+/* Win32 or Win64 dependent typedef/defines. */
+
+#ifdef _WIN64
+
+typedef __int64 INT_PTR, *PINT_PTR;
+typedef __uint64 UINT_PTR, *PUINT_PTR;
+
+#define MAXINT_PTR 0x7fffffffffffffff
+#define MININT_PTR 0x8000000000000000
+#define MAXUINT_PTR 0xffffffffffffffff
+
+typedef __int32 HALF_PTR, *PHALF_PTR;
+typedef __int32 UHALF_PTR, *PUHALF_PTR;
+
+#define MAXHALF_PTR 0x7fffffff
+#define MINHALF_PTR 0x80000000
+#define MAXUHALF_PTR 0xffffffff
+
+typedef __int64 LONG_PTR, *PLONG_PTR;
+typedef __uint64 ULONG_PTR, *PULONG_PTR;
+typedef __uint64 DWORD_PTR, *PDWORD_PTR;
+
+#else /* FIXME: defined(_WIN32) */
+
+typedef __int32 INT_PTR, *PINT_PTR;
+typedef __uint32 UINT_PTR, *PUINT_PTR;
+
+#define MAXINT_PTR 0x7fffffff
+#define MININT_PTR 0x80000000
+#define MAXUINT_PTR 0xffffffff
+
+typedef __int16 HALF_PTR, *PHALF_PTR;
+typedef __uint16 UHALF_PTR, *PUHALF_PTR;
+
+#define MAXUHALF_PTR 0xffff
+#define MAXHALF_PTR 0x7fff
+#define MINHALF_PTR 0x8000
+
+typedef __int32 LONG_PTR, *PLONG_PTR;
+typedef __uint32 ULONG_PTR, *PULONG_PTR;
+typedef __uint32 DWORD_PTR, *PDWORD_PTR;
+
+#endif /* defined(_WIN64) || defined(_WIN32) */
+
+typedef INT_PTR SSIZE_T, *PSSIZE_T;
+typedef UINT_PTR SIZE_T, *PSIZE_T;
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* defined(__cplusplus) */
+
+#endif /* !defined(__WINE_BASETSD_H) */
+
+
+
diff --git a/loader/wine/config.h b/loader/wine/config.h
new file mode 100644
index 0000000000..dc651b3d89
--- /dev/null
+++ b/loader/wine/config.h
@@ -0,0 +1,442 @@
+/* include/config.h. Generated automatically by configure. */
+/* include/config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if using alloca.c. */
+/* #undef C_ALLOCA */
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define if you have alloca, as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
+#define HAVE_ALLOCA_H 1
+
+/* Define as __inline if that's what the C compiler calls it. */
+/* #undef inline */
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+/* #undef size_t */
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+/* #undef STACK_DIRECTION */
+
+/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+/* #undef STAT_MACROS_BROKEN */
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if your processor stores words with the most significant
+ byte first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define if the X Window System is missing or not being used. */
+/* #undef X_DISPLAY_MISSING */
+
+/* Define if symbols declared in assembly code need an underscore prefix */
+/* #undef NEED_UNDERSCORE_PREFIX */
+
+/* Define to use .string instead of .ascii */
+#define HAVE_ASM_STRING 1
+
+/* Define if struct msghdr contains msg_accrights */
+/* #undef HAVE_MSGHDR_ACCRIGHTS */
+
+/* Define if struct sockaddr_un contains sun_len */
+/* #undef HAVE_SOCKADDR_SUN_LEN */
+
+/* Define if you have the Xxf86dga library (-lXxf86dga). */
+#define HAVE_LIBXXF86DGA 1
+
+/* Define if you have the Xxf86dga library version 2.0 (-lXxf86dga). */
+/* #undef HAVE_LIBXXF86DGA2 */
+
+/* Define if you have the X Shm extension */
+#define HAVE_LIBXXSHM 1
+
+/* Define if you have the Xxf86vm library */
+#define HAVE_LIBXXF86VM 1
+
+/* Define if you have the Xpm library */
+#define HAVE_LIBXXPM 1
+
+/* Define if you have the Open Sound system. */
+#define HAVE_OSS 1
+
+/* Define if you have the Open Sound system (MIDI interface). */
+#define HAVE_OSS_MIDI 1
+
+/* Define if X libraries are not reentrant (compiled without -D_REENTRANT). */
+/* #undef NO_REENTRANT_X11 */
+
+/* Define if libc is not reentrant */
+/* #undef NO_REENTRANT_LIBC */
+
+/* Define if libc uses __errno_location for reentrant errno */
+#define HAVE__ERRNO_LOCATION 1
+
+/* Define if libc uses __error for reentrant errno */
+/* #undef HAVE__ERROR */
+
+/* Define if libc uses ___errno for reentrant errno */
+/* #undef HAVE___ERRNO */
+
+/* Define if libc uses __thr_errno for reentrant errno */
+/* #undef HAVE__THR_ERRNO */
+
+/* Define if all debug messages are to be compiled out */
+/* #undef NO_DEBUG_MSGS */
+
+/* Define if TRACE messages are to be compiled out */
+/* #undef NO_TRACE_MSGS */
+
+/* Define if the struct statfs has the member bavail */
+#define STATFS_HAS_BAVAIL 1
+
+/* Define if the struct statfs has the member bfree */
+#define STATFS_HAS_BFREE 1
+
+/* Define if the struct statfs is defined by <sys/vfs.h> */
+#define STATFS_DEFINED_BY_SYS_VFS 1
+
+/* Define if the struct statfs is defined by <sys/statfs.h> */
+#define STATFS_DEFINED_BY_SYS_STATFS 1
+
+/* Define if the struct statfs is defined by <sys/mount.h> */
+/* #undef STATFS_DEFINED_BY_SYS_MOUNT */
+
+/* Define if ncurses have the new resizeterm function */
+#define HAVE_RESIZETERM 1
+
+/* Define if ncurses have the new getbkgd function */
+#define HAVE_GETBKGD 1
+
+/* Define if IPX should use netipx/ipx.h from libc */
+#define HAVE_IPX_GNU 1
+
+/* Define if IPX includes are taken from Linux kernel */
+/* #undef HAVE_IPX_LINUX */
+
+/* Define if Mesa is present on the system or not */
+/* #undef HAVE_LIBMESAGL */
+
+/* Define if the system has dynamic link library support with the dl* API */
+#define HAVE_DL_API 1
+
+/* Define if <linux/joystick.h> defines the Linux 2.2 joystick API */
+#define HAVE_LINUX_22_JOYSTICK_API 1
+
+/* Define if the OpenGL implementation supports the GL_EXT_color_table extension */
+/* #undef HAVE_GL_COLOR_TABLE */
+
+/* Define if the OpenGL implementation supports the GL_EXT_paletted_texture extension */
+/* #undef HAVE_GL_PALETTED_TEXTURE */
+
+/* The number of bytes in a long long. */
+#define SIZEOF_LONG_LONG 8
+
+/* Define if you have the __libc_fork function. */
+/* #undef HAVE___LIBC_FORK */
+
+/* Define if you have the _lwp_create function. */
+/* #undef HAVE__LWP_CREATE */
+
+/* Define if you have the clone function. */
+#define HAVE_CLONE 1
+
+/* Define if you have the connect function. */
+#define HAVE_CONNECT 1
+
+/* Define if you have the dlopen function. */
+/* #undef HAVE_DLOPEN */
+
+/* Define if you have the gethostbyname function. */
+#define HAVE_GETHOSTBYNAME 1
+
+/* Define if you have the getnetbyaddr function. */
+#define HAVE_GETNETBYADDR 1
+
+/* Define if you have the getnetbyname function. */
+#define HAVE_GETNETBYNAME 1
+
+/* Define if you have the getpagesize function. */
+#define HAVE_GETPAGESIZE 1
+
+/* Define if you have the getprotobyname function. */
+#define HAVE_GETPROTOBYNAME 1
+
+/* Define if you have the getprotobynumber function. */
+#define HAVE_GETPROTOBYNUMBER 1
+
+/* Define if you have the getservbyport function. */
+#define HAVE_GETSERVBYPORT 1
+
+/* Define if you have the getsockopt function. */
+#define HAVE_GETSOCKOPT 1
+
+/* Define if you have the inet_network function. */
+#define HAVE_INET_NETWORK 1
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE 1
+
+/* Define if you have the openpty function. */
+#define HAVE_OPENPTY 1
+
+/* Define if you have the rfork function. */
+/* #undef HAVE_RFORK */
+
+/* Define if you have the select function. */
+#define HAVE_SELECT 1
+
+/* Define if you have the sendmsg function. */
+#define HAVE_SENDMSG 1
+
+/* Define if you have the settimeofday function. */
+#define HAVE_SETTIMEOFDAY 1
+
+/* Define if you have the sigaltstack function. */
+#define HAVE_SIGALTSTACK 1
+
+/* Define if you have the statfs function. */
+#define HAVE_STATFS 1
+
+/* Define if you have the strcasecmp function. */
+#define HAVE_STRCASECMP 1
+
+/* Define if you have the strerror function. */
+#define HAVE_STRERROR 1
+
+/* Define if you have the strncasecmp function. */
+#define HAVE_STRNCASECMP 1
+
+/* Define if you have the tcgetattr function. */
+#define HAVE_TCGETATTR 1
+
+/* Define if you have the timegm function. */
+#define HAVE_TIMEGM 1
+
+/* Define if you have the usleep function. */
+#define HAVE_USLEEP 1
+
+/* Define if you have the vfscanf function. */
+#define HAVE_VFSCANF 1
+
+/* Define if you have the wait4 function. */
+#define HAVE_WAIT4 1
+
+/* Define if you have the waitpid function. */
+#define HAVE_WAITPID 1
+
+/* Define if you have the <GL/gl.h> header file. */
+/* #undef HAVE_GL_GL_H */
+
+/* Define if you have the <GL/glx.h> header file. */
+/* #undef HAVE_GL_GLX_H */
+
+/* Define if you have the <X11/Xlib.h> header file. */
+#define HAVE_X11_XLIB_H 1
+
+/* Define if you have the <X11/extensions/XShm.h> header file. */
+#define HAVE_X11_EXTENSIONS_XSHM_H 1
+
+/* Define if you have the <X11/extensions/xf86dga.h> header file. */
+#define HAVE_X11_EXTENSIONS_XF86DGA_H 1
+
+/* Define if you have the <X11/extensions/xf86vmode.h> header file. */
+#define HAVE_X11_EXTENSIONS_XF86VMODE_H 1
+
+/* Define if you have the <X11/xpm.h> header file. */
+#define HAVE_X11_XPM_H 1
+
+/* Define if you have the <a.out.h> header file. */
+#define HAVE_A_OUT_H 1
+
+/* Define if you have the <a_out.h> header file. */
+#define HAVE_A_OUT_H 1
+
+/* Define if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define if you have the <arpa/nameser.h> header file. */
+#define HAVE_ARPA_NAMESER_H 1
+
+/* Define if you have the <curses.h> header file. */
+/* #undef HAVE_CURSES_H */
+
+/* Define if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define if you have the <elf.h> header file. */
+#define HAVE_ELF_H 1
+
+/* Define if you have the <float.h> header file. */
+#define HAVE_FLOAT_H 1
+
+/* Define if you have the <libio.h> header file. */
+#define HAVE_LIBIO_H 1
+
+/* Define if you have the <link.h> header file. */
+#define HAVE_LINK_H 1
+
+/* Define if you have the <linux/cdrom.h> header file. */
+#define HAVE_LINUX_CDROM_H 1
+
+/* Define if you have the <linux/joystick.h> header file. */
+#define HAVE_LINUX_JOYSTICK_H 1
+
+/* Define if you have the <linux/ucdrom.h> header file. */
+/* #undef HAVE_LINUX_UCDROM_H */
+
+/* Define if you have the <machine/soundcard.h> header file. */
+/* #undef HAVE_MACHINE_SOUNDCARD_H */
+
+/* Define if you have the <ncurses.h> header file. */
+#define HAVE_NCURSES_H 1
+
+/* Define if you have the <net/if.h> header file. */
+#define HAVE_NET_IF_H 1
+
+/* Define if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define if you have the <netinet/tcp.h> header file. */
+#define HAVE_NETINET_TCP_H 1
+
+/* Define if you have the <pty.h> header file. */
+#define HAVE_PTY_H 1
+
+/* Define if you have the <resolv.h> header file. */
+#define HAVE_RESOLV_H 1
+
+/* Define if you have the <sched.h> header file. */
+#define HAVE_SCHED_H 1
+
+/* Define if you have the <socket.h> header file. */
+/* #undef HAVE_SOCKET_H */
+
+/* Define if you have the <soundcard.h> header file. */
+/* #undef HAVE_SOUNDCARD_H */
+
+/* Define if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define if you have the <sys/cdio.h> header file. */
+/* #undef HAVE_SYS_CDIO_H */
+
+/* Define if you have the <sys/errno.h> header file. */
+#define HAVE_SYS_ERRNO_H 1
+
+/* Define if you have the <sys/file.h> header file. */
+#define HAVE_SYS_FILE_H 1
+
+/* Define if you have the <sys/filio.h> header file. */
+/* #undef HAVE_SYS_FILIO_H */
+
+/* Define if you have the <sys/ipc.h> header file. */
+#define HAVE_SYS_IPC_H 1
+
+/* Define if you have the <sys/lwp.h> header file. */
+/* #undef HAVE_SYS_LWP_H */
+
+/* Define if you have the <sys/mman.h> header file. */
+#define HAVE_SYS_MMAN_H 1
+
+/* Define if you have the <sys/modem.h> header file. */
+/* #undef HAVE_SYS_MODEM_H */
+
+/* Define if you have the <sys/mount.h> header file. */
+#define HAVE_SYS_MOUNT_H 1
+
+/* Define if you have the <sys/msg.h> header file. */
+#define HAVE_SYS_MSG_H 1
+
+/* Define if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define if you have the <sys/reg.h> header file. */
+#define HAVE_SYS_REG_H 1
+
+/* Define if you have the <sys/shm.h> header file. */
+#define HAVE_SYS_SHM_H 1
+
+/* Define if you have the <sys/signal.h> header file. */
+#define HAVE_SYS_SIGNAL_H 1
+
+/* Define if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define if you have the <sys/sockio.h> header file. */
+/* #undef HAVE_SYS_SOCKIO_H */
+
+/* Define if you have the <sys/soundcard.h> header file. */
+#define HAVE_SYS_SOUNDCARD_H 1
+
+/* Define if you have the <sys/statfs.h> header file. */
+#define HAVE_SYS_STATFS_H 1
+
+/* Define if you have the <sys/strtio.h> header file. */
+/* #undef HAVE_SYS_STRTIO_H */
+
+/* Define if you have the <sys/syscall.h> header file. */
+#define HAVE_SYS_SYSCALL_H 1
+
+/* Define if you have the <sys/v86.h> header file. */
+/* #undef HAVE_SYS_V86_H */
+
+/* Define if you have the <sys/v86intr.h> header file. */
+/* #undef HAVE_SYS_V86INTR_H */
+
+/* Define if you have the <sys/vfs.h> header file. */
+#define HAVE_SYS_VFS_H 1
+
+/* Define if you have the <sys/vm86.h> header file. */
+#define HAVE_SYS_VM86_H 1
+
+/* Define if you have the <sys/wait.h> header file. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define if you have the <syscall.h> header file. */
+#define HAVE_SYSCALL_H 1
+
+/* Define if you have the <ucontext.h> header file. */
+#define HAVE_UCONTEXT_H 1
+
+/* Define if you have the <wctype.h> header file. */
+#define HAVE_WCTYPE_H 1
+
+/* Define if you have the curses library (-lcurses). */
+/* #undef HAVE_LIBCURSES */
+
+/* Define if you have the i386 library (-li386). */
+/* #undef HAVE_LIBI386 */
+
+/* Define if you have the m library (-lm). */
+#define HAVE_LIBM 1
+
+/* Define if you have the mmap library (-lmmap). */
+/* #undef HAVE_LIBMMAP */
+
+/* Define if you have the ncurses library (-lncurses). */
+#define HAVE_LIBNCURSES 1
+
+/* Define if you have the ossaudio library (-lossaudio). */
+/* #undef HAVE_LIBOSSAUDIO */
+
+/* Define if you have the w library (-lw). */
+/* #undef HAVE_LIBW */
+
+/* Define if you have the xpg4 library (-lxpg4). */
+/* #undef HAVE_LIBXPG4 */
diff --git a/loader/wine/debugtools.h b/loader/wine/debugtools.h
new file mode 100644
index 0000000000..ce2448db87
--- /dev/null
+++ b/loader/wine/debugtools.h
@@ -0,0 +1,93 @@
+
+#ifndef __WINE_DEBUGTOOLS_H
+#define __WINE_DEBUGTOOLS_H
+
+#ifdef __WINE__ /* Debugging interface is internal to Wine */
+
+#include <stdarg.h>
+#include "config.h"
+#include "windef.h"
+
+struct _GUID;
+
+/* Internal definitions (do not use these directly) */
+
+enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT };
+
+#ifndef NO_TRACE_MSGS
+# define __GET_DEBUGGING_trace(dbch) ((dbch)[0] & (1 << __DBCL_TRACE))
+#else
+# define __GET_DEBUGGING_trace(dbch) 0
+#endif
+
+#ifndef NO_DEBUG_MSGS
+# define __GET_DEBUGGING_warn(dbch) ((dbch)[0] & (1 << __DBCL_WARN))
+# define __GET_DEBUGGING_fixme(dbch) ((dbch)[0] & (1 << __DBCL_FIXME))
+#else
+# define __GET_DEBUGGING_warn(dbch) 0
+# define __GET_DEBUGGING_fixme(dbch) 0
+#endif
+
+/* define error macro regardless of what is configured */
+#define __GET_DEBUGGING_err(dbch) ((dbch)[0] & (1 << __DBCL_ERR))
+
+#define __GET_DEBUGGING(dbcl,dbch) __GET_DEBUGGING_##dbcl(dbch)
+#define __SET_DEBUGGING(dbcl,dbch,on) \
+ ((on) ? ((dbch)[0] |= 1 << (dbcl)) : ((dbch)[0] &= ~(1 << (dbcl))))
+
+#ifndef __GNUC__
+#define __FUNCTION__ ""
+#endif
+
+#define __DPRINTF(dbcl,dbch) \
+ (!__GET_DEBUGGING(dbcl,(dbch)) || (dbg_header_##dbcl((dbch),__FUNCTION__),0)) ? \
+ (void)0 : (void)dbg_printf
+
+/* Exported definitions and macros */
+
+/* These function return a printable version of a string, including
+ quotes. The string will be valid for some time, but not indefinitely
+ as strings are re-used. */
+extern LPCSTR debugstr_an (LPCSTR s, int n);
+extern LPCSTR debugstr_wn (LPCWSTR s, int n);
+extern LPCSTR debugres_a (LPCSTR res);
+extern LPCSTR debugres_w (LPCWSTR res);
+extern LPCSTR debugstr_guid( const struct _GUID *id );
+extern LPCSTR debugstr_hex_dump (const void *ptr, int len);
+extern int dbg_header_err( const char *dbg_channel, const char *func );
+extern int dbg_header_warn( const char *dbg_channel, const char *func );
+extern int dbg_header_fixme( const char *dbg_channel, const char *func );
+extern int dbg_header_trace( const char *dbg_channel, const char *func );
+extern int dbg_vprintf( const char *format, va_list args );
+
+static inline LPCSTR debugstr_a( LPCSTR s ) { return debugstr_an( s, 80 ); }
+static inline LPCSTR debugstr_w( LPCWSTR s ) { return debugstr_wn( s, 80 ); }
+
+#ifdef __GNUC__
+extern int dbg_printf(const char *format, ...) __attribute__((format (printf,1,2)));
+#else
+extern int dbg_printf(const char *format, ...);
+#endif
+
+#define TRACE_(X) TRACE
+#define WARN_(X) TRACE
+#define WARN TRACE
+#define ERR_(X) printf
+#define ERR printf
+#define FIXME_(X) TRACE
+#define FIXME TRACE
+
+#define TRACE_ON(X) 1
+#define ERR_ON(X) 1
+
+#define DECLARE_DEBUG_CHANNEL(ch) \
+ extern char dbch_##ch[];
+#define DEFAULT_DEBUG_CHANNEL(ch) \
+ extern char dbch_##ch[]; static char * const __dbch_default = dbch_##ch;
+
+#define DPRINTF dbg_printf
+#define MESSAGE dbg_printf
+
+#endif /* __WINE__ */
+
+#endif /* __WINE_DEBUGTOOLS_H */
diff --git a/loader/wine/driver.h b/loader/wine/driver.h
new file mode 100644
index 0000000000..dc8661aa3a
--- /dev/null
+++ b/loader/wine/driver.h
@@ -0,0 +1,112 @@
+/*
+ * Drivers definitions
+ */
+
+#ifndef __WINE_DRIVER_H
+#define __WINE_DRIVER_H
+
+#include "windef.h"
+
+#define MMSYSERR_BASE 0
+
+#define MMSYSERR_NOERROR 0 /* no error */
+#define MMSYSERR_ERROR (MMSYSERR_BASE + 1) /* unspecified error */
+#define MMSYSERR_BADDEVICEID (MMSYSERR_BASE + 2) /* device ID out of range */
+#define MMSYSERR_NOTENABLED (MMSYSERR_BASE + 3) /* driver failed enable */
+#define MMSYSERR_ALLOCATED (MMSYSERR_BASE + 4) /* device already allocated */
+#define MMSYSERR_INVALHANDLE (MMSYSERR_BASE + 5) /* device handle is invalid */
+#define MMSYSERR_NODRIVER (MMSYSERR_BASE + 6) /* no device driver present */
+#define MMSYSERR_NOMEM (MMSYSERR_BASE + 7) /* memory allocation error */
+#define MMSYSERR_NOTSUPPORTED (MMSYSERR_BASE + 8) /* function isn't supported */
+#define MMSYSERR_BADERRNUM (MMSYSERR_BASE + 9) /* error value out of range */
+#define MMSYSERR_INVALFLAG (MMSYSERR_BASE + 10) /* invalid flag passed */
+#define MMSYSERR_INVALPARAM (MMSYSERR_BASE + 11) /* invalid parameter passed */
+#define MMSYSERR_LASTERROR (MMSYSERR_BASE + 11) /* last error in range */
+
+#define DRV_LOAD 0x0001
+#define DRV_ENABLE 0x0002
+#define DRV_OPEN 0x0003
+#define DRV_CLOSE 0x0004
+#define DRV_DISABLE 0x0005
+#define DRV_FREE 0x0006
+#define DRV_CONFIGURE 0x0007
+#define DRV_QUERYCONFIGURE 0x0008
+#define DRV_INSTALL 0x0009
+#define DRV_REMOVE 0x000A
+#define DRV_EXITSESSION 0x000B
+#define DRV_EXITAPPLICATION 0x000C
+#define DRV_POWER 0x000F
+
+#define DRV_RESERVED 0x0800
+#define DRV_USER 0x4000
+
+#define DRVCNF_CANCEL 0x0000
+#define DRVCNF_OK 0x0001
+#define DRVCNF_RESTART 0x0002
+
+#define DRVEA_NORMALEXIT 0x0001
+#define DRVEA_ABNORMALEXIT 0x0002
+
+#define DRV_SUCCESS 0x0001
+#define DRV_FAILURE 0x0000
+
+#define GND_FIRSTINSTANCEONLY 0x00000001
+
+#define GND_FORWARD 0x00000000
+#define GND_REVERSE 0x00000002
+
+typedef struct {
+ DWORD dwDCISize;
+ LPCSTR lpszDCISectionName;
+ LPCSTR lpszDCIAliasName;
+} DRVCONFIGINFO16, *LPDRVCONFIGINFO16;
+
+typedef struct {
+ DWORD dwDCISize;
+ LPCWSTR lpszDCISectionName;
+ LPCWSTR lpszDCIAliasName;
+} DRVCONFIGINFO, *LPDRVCONFIGINFO;
+
+
+/* GetDriverInfo16 references this structure, so this a struct defined
+ * in the Win16 API.
+ * GetDriverInfo has been deprecated in Win32.
+ */
+typedef struct
+{
+ UINT16 length;
+ HDRVR16 hDriver;
+ HINSTANCE16 hModule;
+ CHAR szAliasName[128];
+} DRIVERINFOSTRUCT16, *LPDRIVERINFOSTRUCT16;
+
+LRESULT WINAPI DefDriverProc16(DWORD dwDevID, HDRVR16 hDriv, UINT16 wMsg,
+ LPARAM dwParam1, LPARAM dwParam2);
+LRESULT WINAPI DefDriverProc(DWORD dwDriverIdentifier, HDRVR hdrvr,
+ UINT Msg, LPARAM lParam1, LPARAM lParam2);
+HDRVR16 WINAPI OpenDriver16(LPCSTR szDriverName, LPCSTR szSectionName,
+ LPARAM lParam2);
+HDRVR WINAPI OpenDriverA(LPCSTR szDriverName, LPCSTR szSectionName,
+ LPARAM lParam2);
+HDRVR WINAPI OpenDriverW(LPCWSTR szDriverName, LPCWSTR szSectionName,
+ LPARAM lParam2);
+#define OpenDriver WINELIB_NAME_AW(OpenDriver)
+LRESULT WINAPI CloseDriver16(HDRVR16 hDriver, LPARAM lParam1, LPARAM lParam2);
+LRESULT WINAPI CloseDriver(HDRVR hDriver, LPARAM lParam1, LPARAM lParam2);
+LRESULT WINAPI SendDriverMessage16( HDRVR16 hDriver, UINT16 message,
+ LPARAM lParam1, LPARAM lParam2 );
+LRESULT WINAPI SendDriverMessage( HDRVR hDriver, UINT message,
+ LPARAM lParam1, LPARAM lParam2 );
+HMODULE16 WINAPI GetDriverModuleHandle16(HDRVR16 hDriver);
+HMODULE WINAPI GetDriverModuleHandle(HDRVR hDriver);
+
+DWORD WINAPI GetDriverFlags( HDRVR hDriver );
+#ifdef __WINE__
+/* this call (GetDriverFlags) is not documented, nor the flags returned.
+ * here are Wine only definitions
+ */
+#define WINE_GDF_EXIST 0x80000000
+#define WINE_GDF_16BIT 0x10000000
+#endif
+
+#endif /* __WINE_DRIVER_H */
diff --git a/loader/wine/elfdll.h b/loader/wine/elfdll.h
new file mode 100644
index 0000000000..1f356856ff
--- /dev/null
+++ b/loader/wine/elfdll.h
@@ -0,0 +1,14 @@
+#ifndef __WINE_ELFDLL_H
+#define __WINE_ELFDLL_H
+
+#include "module.h"
+#include "windef.h"
+
+WINE_MODREF *ELFDLL_LoadLibraryExA(LPCSTR libname, DWORD flags);
+HINSTANCE16 ELFDLL_LoadModule16(LPCSTR libname);
+void ELFDLL_UnloadLibrary(WINE_MODREF *wm);
+
+void *ELFDLL_dlopen(const char *libname, int flags);
+extern char *extra_ld_library_path;
+
+#endif
diff --git a/loader/wine/heap.h b/loader/wine/heap.h
new file mode 100644
index 0000000000..bd0604b752
--- /dev/null
+++ b/loader/wine/heap.h
@@ -0,0 +1,56 @@
+/*
+ * Win32 heap definitions
+ *
+ * Copyright 1996 Alexandre Julliard
+ */
+
+#ifndef __WINE_HEAP_H
+#define __WINE_HEAP_H
+
+#include "config.h"
+
+#include "winbase.h"
+
+extern HANDLE SystemHeap;
+extern HANDLE SegptrHeap;
+
+extern int HEAP_IsInsideHeap( HANDLE heap, DWORD flags, LPCVOID ptr );
+extern SEGPTR HEAP_GetSegptr( HANDLE heap, DWORD flags, LPCVOID ptr );
+extern LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str );
+extern LPWSTR HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str );
+extern LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str );
+extern LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str );
+
+/* SEGPTR helper macros */
+
+#define SEGPTR_ALLOC(size) \
+ (HeapAlloc( SegptrHeap, 0, (size) ))
+#define SEGPTR_NEW(type) \
+ ((type *)HeapAlloc( SegptrHeap, 0, sizeof(type) ))
+#define SEGPTR_STRDUP(str) \
+ (HIWORD(str) ? HEAP_strdupA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
+#define SEGPTR_STRDUP_WtoA(str) \
+ (HIWORD(str) ? HEAP_strdupWtoA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
+ /* define an inline function, a macro won't do */
+static inline SEGPTR WINE_UNUSED SEGPTR_Get(LPCVOID ptr) {
+ return (HIWORD(ptr) ? HEAP_GetSegptr( SegptrHeap, 0, ptr ) : (SEGPTR)ptr);
+}
+#define SEGPTR_GET(ptr) SEGPTR_Get(ptr)
+#define SEGPTR_FREE(ptr) \
+ (HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0)
+
+/* system heap private data */
+/* you must lock the system heap before using this structure */
+typedef struct
+{
+ void *gdi; /* GDI heap */
+ void *user; /* USER handle table */
+ void *cursor; /* cursor information */
+ void *queue; /* message queues descriptor */
+ void *win; /* windows descriptor */
+ void *root; /* X11 root window */
+} SYSTEM_HEAP_DESCR;
+
+extern SYSTEM_HEAP_DESCR *SystemHeapDescr;
+
+#endif /* __WINE_HEAP_H */
diff --git a/loader/wine/ldt.h b/loader/wine/ldt.h
new file mode 100644
index 0000000000..f87ecc14e2
--- /dev/null
+++ b/loader/wine/ldt.h
@@ -0,0 +1,98 @@
+/*
+ * LDT copy
+ *
+ * Copyright 1995 Alexandre Julliard
+ */
+
+#ifndef __WINE_LDT_H
+#define __WINE_LDT_H
+
+#include "windef.h"
+enum seg_type
+{
+ SEGMENT_DATA = 0,
+ SEGMENT_STACK = 1,
+ SEGMENT_CODE = 2
+};
+
+ /* This structure represents a real LDT entry. */
+ /* It is used by get_ldt_entry() and set_ldt_entry(). */
+typedef struct
+{
+ unsigned long base; /* base address */
+ unsigned long limit; /* segment limit (in pages or bytes) */
+ int seg_32bit; /* is segment 32-bit? */
+ int read_only; /* is segment read-only? */
+ int limit_in_pages; /* is the limit in pages or bytes? */
+ enum seg_type type; /* segment type */
+} ldt_entry;
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+extern void LDT_BytesToEntry( const unsigned long *buffer, ldt_entry *content);
+extern void LDT_EntryToBytes( unsigned long *buffer, const ldt_entry *content);
+extern int LDT_GetEntry( int entry, ldt_entry *content );
+extern int LDT_SetEntry( int entry, const ldt_entry *content );
+extern void LDT_Print( int start, int length );
+
+
+ /* This structure is used to build the local copy of the LDT. */
+typedef struct
+{
+ unsigned long base; /* base address or 0 if entry is free */
+ unsigned long limit; /* limit in bytes or 0 if entry is free */
+} ldt_copy_entry;
+
+#define LDT_SIZE 8192
+
+extern ldt_copy_entry ldt_copy[LDT_SIZE];
+
+#define __AHSHIFT 3 /* don't change! */
+#define __AHINCR (1 << __AHSHIFT)
+
+#define SELECTOR_TO_ENTRY(sel) (((int)(sel) & 0xffff) >> __AHSHIFT)
+#define ENTRY_TO_SELECTOR(i) ((i) ? (((int)(i) << __AHSHIFT) | 7) : 0)
+#define IS_LDT_ENTRY_FREE(i) (!(ldt_flags_copy[(i)] & LDT_FLAGS_ALLOCATED))
+#define IS_SELECTOR_FREE(sel) (IS_LDT_ENTRY_FREE(SELECTOR_TO_ENTRY(sel)))
+#define GET_SEL_BASE(sel) (ldt_copy[SELECTOR_TO_ENTRY(sel)].base)
+#define GET_SEL_LIMIT(sel) (ldt_copy[SELECTOR_TO_ENTRY(sel)].limit)
+
+/* Convert a segmented ptr (16:16) to a linear (32) pointer */
+
+#define PTR_SEG_OFF_TO_LIN(seg,off) \
+ ((void*)(GET_SEL_BASE(seg) + (unsigned int)(off)))
+#define PTR_SEG_TO_LIN(ptr) \
+ PTR_SEG_OFF_TO_LIN(SELECTOROF(ptr),OFFSETOF(ptr))
+#define PTR_SEG_OFF_TO_SEGPTR(seg,off) \
+ ((SEGPTR)MAKELONG(off,seg))
+#define PTR_SEG_OFF_TO_HUGEPTR(seg,off) \
+ PTR_SEG_OFF_TO_SEGPTR( (seg) + (HIWORD(off) << __AHSHIFT), LOWORD(off) )
+
+#define W32S_APPLICATION() (PROCESS_Current()->flags & PDB32_WIN32S_PROC)
+#define W32S_OFFSET 0x10000
+#define W32S_APP2WINE(addr, offset) ((addr)? (DWORD)(addr) + (DWORD)(offset) : 0)
+#define W32S_WINE2APP(addr, offset) ((addr)? (DWORD)(addr) - (DWORD)(offset) : 0)
+
+extern unsigned char ldt_flags_copy[LDT_SIZE];
+
+#define LDT_FLAGS_TYPE 0x03 /* Mask for segment type */
+#define LDT_FLAGS_READONLY 0x04 /* Segment is read-only (data) */
+#define LDT_FLAGS_EXECONLY 0x04 /* Segment is execute-only (code) */
+#define LDT_FLAGS_32BIT 0x08 /* Segment is 32-bit (code or stack) */
+#define LDT_FLAGS_BIG 0x10 /* Segment is big (limit is in pages) */
+#define LDT_FLAGS_ALLOCATED 0x80 /* Segment is allocated (no longer free) */
+
+#define GET_SEL_FLAGS(sel) (ldt_flags_copy[SELECTOR_TO_ENTRY(sel)])
+
+#define FIRST_LDT_ENTRY_TO_ALLOC 17
+
+/* Determine if sel is a system selector (i.e. not managed by Wine) */
+#define IS_SELECTOR_SYSTEM(sel) \
+ (!((sel) & 4) || (SELECTOR_TO_ENTRY(sel) < FIRST_LDT_ENTRY_TO_ALLOC))
+#define IS_SELECTOR_32BIT(sel) \
+ (IS_SELECTOR_SYSTEM(sel) || (GET_SEL_FLAGS(sel) & LDT_FLAGS_32BIT))
+#ifdef __cplusplus
+}
+#endif
+#endif /* __WINE_LDT_H */
diff --git a/loader/wine/mmreg.h b/loader/wine/mmreg.h
new file mode 100644
index 0000000000..74e26250d0
--- /dev/null
+++ b/loader/wine/mmreg.h
@@ -0,0 +1,104 @@
+/*
+ * mmreg.h - Declarations for ???
+ */
+
+#ifndef __WINE_MMREG_H
+#define __WINE_MMREG_H
+
+/***********************************************************************
+ * Defines/Enums
+ */
+
+#ifndef _ACM_WAVEFILTER
+#define _ACM_WAVEFILTER
+
+#include "windef.h"
+
+#define WAVE_FILTER_UNKNOWN 0x0000
+#define WAVE_FILTER_DEVELOPMENT 0xFFFF
+
+typedef struct _WAVEFILTER {
+ DWORD cbStruct;
+ DWORD dwFilterTag;
+ DWORD fdwFilter;
+ DWORD dwReserved[5];
+} WAVEFILTER, *PWAVEFILTER, *NPWAVEFILTER, *LPWAVEFILTER;
+#endif /* _ACM_WAVEFILTER */
+
+#ifndef WAVE_FILTER_VOLUME
+#define WAVE_FILTER_VOLUME 0x0001
+
+typedef struct _WAVEFILTER_VOLUME {
+ WAVEFILTER wfltr;
+ DWORD dwVolume;
+} VOLUMEWAVEFILTER, *PVOLUMEWAVEFILTER, *NPVOLUMEWAVEFILTER, *LPVOLUMEWAVEFILTER;
+#endif /* WAVE_FILTER_VOLUME */
+
+#ifndef WAVE_FILTER_ECHO
+#define WAVE_FILTER_ECHO 0x0002
+
+typedef struct WAVEFILTER_ECHO {
+ WAVEFILTER wfltr;
+ DWORD dwVolume;
+ DWORD dwDelay;
+} ECHOWAVEFILTER, *PECHOWAVEFILTER, *NPECHOWAVEFILTER, *LPECHOWAVEFILTER;
+#endif /* WAVEFILTER_ECHO */
+
+#ifndef _WAVEFORMATEX_
+#define _WAVEFORMATEX_
+typedef struct _WAVEFORMATEX {
+ WORD wFormatTag;
+ WORD nChannels;
+ DWORD nSamplesPerSec;
+ DWORD nAvgBytesPerSec;
+ WORD nBlockAlign;
+ WORD wBitsPerSample;
+ WORD cbSize;
+} WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
+#endif /* _WAVEFORMATEX_ */
+
+/* WAVE form wFormatTag IDs */
+#define WAVE_FORMAT_UNKNOWN 0x0000 /* Microsoft Corporation */
+#define WAVE_FORMAT_ADPCM 0x0002 /* Microsoft Corporation */
+#define WAVE_FORMAT_IBM_CVSD 0x0005 /* IBM Corporation */
+#define WAVE_FORMAT_ALAW 0x0006 /* Microsoft Corporation */
+#define WAVE_FORMAT_MULAW 0x0007 /* Microsoft Corporation */
+#define WAVE_FORMAT_OKI_ADPCM 0x0010 /* OKI */
+#define WAVE_FORMAT_DVI_ADPCM 0x0011 /* Intel Corporation */
+#define WAVE_FORMAT_IMA_ADPCM (WAVE_FORMAT_DVI_ADPCM) /* Intel Corporation */
+#define WAVE_FORMAT_MEDIASPACE_ADPCM 0x0012 /* Videologic */
+#define WAVE_FORMAT_SIERRA_ADPCM 0x0013 /* Sierra Semiconductor Corp */
+#define WAVE_FORMAT_G723_ADPCM 0x0014 /* Antex Electronics Corporation */
+#define WAVE_FORMAT_DIGISTD 0x0015 /* DSP Solutions, Inc. */
+#define WAVE_FORMAT_DIGIFIX 0x0016 /* DSP Solutions, Inc. */
+#define WAVE_FORMAT_DIALOGIC_OKI_ADPCM 0x0017 /* Dialogic Corporation */
+#define WAVE_FORMAT_YAMAHA_ADPCM 0x0020 /* Yamaha Corporation of America */
+#define WAVE_FORMAT_SONARC 0x0021 /* Speech Compression */
+#define WAVE_FORMAT_DSPGROUP_TRUESPEECH 0x0022 /* DSP Group, Inc */
+#define WAVE_FORMAT_ECHOSC1 0x0023 /* Echo Speech Corporation */
+#define WAVE_FORMAT_AUDIOFILE_AF36 0x0024 /* */
+#define WAVE_FORMAT_APTX 0x0025 /* Audio Processing Technology */
+#define WAVE_FORMAT_AUDIOFILE_AF10 0x0026 /* */
+#define WAVE_FORMAT_DOLBY_AC2 0x0030 /* Dolby Laboratories */
+#define WAVE_FORMAT_GSM610 0x0031 /* Microsoft Corporation */
+#define WAVE_FORMAT_ANTEX_ADPCME 0x0033 /* Antex Electronics Corporation */
+#define WAVE_FORMAT_CONTROL_RES_VQLPC 0x0034 /* Control Resources Limited */
+#define WAVE_FORMAT_DIGIREAL 0x0035 /* DSP Solutions, Inc. */
+#define WAVE_FORMAT_DIGIADPCM 0x0036 /* DSP Solutions, Inc. */
+#define WAVE_FORMAT_CONTROL_RES_CR10 0x0037 /* Control Resources Limited */
+#define WAVE_FORMAT_NMS_VBXADPCM 0x0038 /* Natural MicroSystems */
+#define WAVE_FORMAT_G721_ADPCM 0x0040 /* Antex Electronics Corporation */
+#define WAVE_FORMAT_MPEG 0x0050 /* Microsoft Corporation */
+#define WAVE_FORMAT_CREATIVE_ADPCM 0x0200 /* Creative Labs, Inc */
+#define WAVE_FORMAT_CREATIVE_FASTSPEECH8 0x0202 /* Creative Labs, Inc */
+#define WAVE_FORMAT_CREATIVE_FASTSPEECH10 0x0203 /* Creative Labs, Inc */
+#define WAVE_FORMAT_FM_TOWNS_SND 0x0300 /* Fujitsu Corp. */
+#define WAVE_FORMAT_OLIGSM 0x1000 /* Ing C. Olivetti & C., S.p.A. */
+#define WAVE_FORMAT_OLIADPCM 0x1001 /* Ing C. Olivetti & C., S.p.A. */
+#define WAVE_FORMAT_OLICELP 0x1002 /* Ing C. Olivetti & C., S.p.A. */
+#define WAVE_FORMAT_OLISBC 0x1003 /* Ing C. Olivetti & C., S.p.A. */
+#define WAVE_FORMAT_OLIOPR 0x1004 /* Ing C. Olivetti & C., S.p.A. */
+
+#define WAVE_FORMAT_DEVELOPMENT (0xFFFF)
+
+#endif /* __WINE_MMREG_H */
diff --git a/loader/wine/module.h b/loader/wine/module.h
new file mode 100644
index 0000000000..7237c95f06
--- /dev/null
+++ b/loader/wine/module.h
@@ -0,0 +1,198 @@
+/*
+ * Module definitions
+ *
+ * Copyright 1995 Alexandre Julliard
+ */
+
+#ifndef __WINE_MODULE_H
+#define __WINE_MODULE_H
+
+#include "windef.h"
+//#include "dosexe.h"
+#include "pe_image.h"
+
+
+
+typedef struct {
+ BYTE type;
+ BYTE flags;
+ BYTE segnum;
+ WORD offs WINE_PACKED;
+} ET_ENTRY;
+
+typedef struct {
+ WORD first; /* ordinal */
+ WORD last; /* ordinal */
+ WORD next; /* bundle */
+} ET_BUNDLE;
+
+
+ /* In-memory segment table */
+typedef struct
+{
+ WORD filepos; /* Position in file, in sectors */
+ WORD size; /* Segment size on disk */
+ WORD flags; /* Segment flags */
+ WORD minsize; /* Min. size of segment in memory */
+ HANDLE16 hSeg; /* Selector or handle (selector - 1) */
+ /* of segment in memory */
+} SEGTABLEENTRY;
+
+
+ /* Self-loading modules contain this structure in their first segment */
+
+#include "pshpack1.h"
+
+typedef struct
+{
+ WORD version; /* Must be "A0" (0x3041) */
+ WORD reserved;
+ FARPROC16 BootApp; /* startup procedure */
+ FARPROC16 LoadAppSeg; /* procedure to load a segment */
+ FARPROC16 reserved2;
+ FARPROC16 MyAlloc; /* memory allocation procedure,
+ * wine must write this field */
+ FARPROC16 EntryAddrProc;
+ FARPROC16 ExitProc; /* exit procedure */
+ WORD reserved3[4];
+ FARPROC16 SetOwner; /* Set Owner procedure, exported by wine */
+} SELFLOADHEADER;
+
+ /* Parameters for LoadModule() */
+typedef struct
+{
+ HGLOBAL16 hEnvironment; /* Environment segment */
+ SEGPTR cmdLine WINE_PACKED; /* Command-line */
+ SEGPTR showCmd WINE_PACKED; /* Code for ShowWindow() */
+ SEGPTR reserved WINE_PACKED;
+} LOADPARAMS16;
+
+typedef struct
+{
+ LPSTR lpEnvAddress;
+ LPSTR lpCmdLine;
+ UINT16 *lpCmdShow;
+ DWORD dwReserved;
+} LOADPARAMS;
+
+#include "poppack.h"
+
+/* internal representation of 32bit modules. per process. */
+typedef enum {
+ MODULE32_PE = 1,
+ MODULE32_ELF,
+ MODULE32_ELFDLL
+} MODULE32_TYPE;
+
+typedef struct _wine_modref
+{
+ struct _wine_modref *next;
+ struct _wine_modref *prev;
+ MODULE32_TYPE type;
+ union {
+ PE_MODREF pe;
+ ELF_MODREF elf;
+ } binfmt;
+
+ HMODULE module;
+
+ int nDeps;
+ struct _wine_modref **deps;
+
+ int flags;
+ int refCount;
+
+ char *filename;
+ char *modname;
+ char *short_filename;
+ char *short_modname;
+} WINE_MODREF;
+
+#define WINE_MODREF_INTERNAL 0x00000001
+#define WINE_MODREF_NO_DLL_CALLS 0x00000002
+#define WINE_MODREF_PROCESS_ATTACHED 0x00000004
+#define WINE_MODREF_LOAD_AS_DATAFILE 0x00000010
+#define WINE_MODREF_DONT_RESOLVE_REFS 0x00000020
+#define WINE_MODREF_MARKER 0x80000000
+
+
+
+/* Resource types */
+typedef struct resource_typeinfo_s NE_TYPEINFO;
+typedef struct resource_nameinfo_s NE_NAMEINFO;
+
+#define NE_SEG_TABLE(pModule) \
+ ((SEGTABLEENTRY *)((char *)(pModule) + (pModule)->seg_table))
+
+#define NE_MODULE_TABLE(pModule) \
+ ((WORD *)((char *)(pModule) + (pModule)->modref_table))
+
+#define NE_MODULE_NAME(pModule) \
+ (((OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo))->szPathName)
+
+/* module.c */
+extern FARPROC MODULE_GetProcAddress( HMODULE hModule, LPCSTR function, WIN_BOOL snoop );
+extern WINE_MODREF *MODULE32_LookupHMODULE( HMODULE hModule );
+extern WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved );
+extern void MODULE_DllProcessDetach( WINE_MODREF *wm, WIN_BOOL bForceDetach, LPVOID lpReserved );
+extern void MODULE_DllThreadAttach( LPVOID lpReserved );
+extern void MODULE_DllThreadDetach( LPVOID lpReserved );
+extern WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags );
+extern WIN_BOOL MODULE_FreeLibrary( WINE_MODREF *wm );
+extern WINE_MODREF *MODULE_FindModule( LPCSTR path );
+extern HMODULE MODULE_CreateDummyModule( LPCSTR filename, HMODULE module32 );
+extern FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE hmodule, LPCSTR name );
+extern SEGPTR WINAPI HasGPHandler16( SEGPTR address );
+extern void MODULE_WalkModref( DWORD id );
+
+/* resource.c */
+extern INT WINAPI AccessResource(HMODULE,HRSRC);
+/*
+/ loader/ne/module.c
+extern NE_MODULE *NE_GetPtr( HMODULE16 hModule );
+extern void NE_DumpModule( HMODULE16 hModule );
+extern void NE_WalkModules(void);
+extern void NE_RegisterModule( NE_MODULE *pModule );
+extern WORD NE_GetOrdinal( HMODULE16 hModule, const char *name );
+extern FARPROC16 WINAPI NE_GetEntryPoint( HMODULE16 hModule, WORD ordinal );
+extern FARPROC16 NE_GetEntryPointEx( HMODULE16 hModule, WORD ordinal, WIN_BOOL16 snoop );
+extern WIN_BOOL16 NE_SetEntryPoint( HMODULE16 hModule, WORD ordinal, WORD offset );
+extern int NE_OpenFile( NE_MODULE *pModule );
+extern WIN_BOOL NE_CreateProcess( HANDLE hFile, LPCSTR filename, LPCSTR cmd_line, LPCSTR env,
+ LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
+ WIN_BOOL inherit, DWORD flags, LPSTARTUPINFOA startup,
+ LPPROCESS_INFORMATION info );
+extern WIN_BOOL NE_InitProcess( NE_MODULE *pModule );
+
+
+/ loader/ne/resource.c
+extern HGLOBAL16 WINAPI NE_DefResourceHandler(HGLOBAL16,HMODULE16,HRSRC16);
+extern WIN_BOOL NE_InitResourceHandler( HMODULE16 hModule );
+extern HRSRC16 NE_FindResource( NE_MODULE *pModule, LPCSTR name, LPCSTR type );
+extern INT16 NE_AccessResource( NE_MODULE *pModule, HRSRC16 hRsrc );
+extern DWORD NE_SizeofResource( NE_MODULE *pModule, HRSRC16 hRsrc );
+extern HGLOBAL16 NE_LoadResource( NE_MODULE *pModule, HRSRC16 hRsrc );
+extern WIN_BOOL16 NE_FreeResource( NE_MODULE *pModule, HGLOBAL16 handle );
+extern NE_TYPEINFO *NE_FindTypeSection( LPBYTE pResTab, NE_TYPEINFO *pTypeInfo, LPCSTR typeId );
+extern NE_NAMEINFO *NE_FindResourceFromType( LPBYTE pResTab, NE_TYPEINFO *pTypeInfo, LPCSTR resId );
+
+// loader/ne/segment.c
+extern WIN_BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum );
+extern WIN_BOOL NE_LoadAllSegments( NE_MODULE *pModule );
+extern WIN_BOOL NE_CreateSegment( NE_MODULE *pModule, int segnum );
+extern WIN_BOOL NE_CreateAllSegments( NE_MODULE *pModule );
+extern HINSTANCE16 NE_GetInstance( NE_MODULE *pModule );
+extern void NE_InitializeDLLs( HMODULE16 hModule );
+extern void NE_DllProcessAttach( HMODULE16 hModule );
+
+// loader/ne/convert.c
+HGLOBAL16 NE_LoadPEResource( NE_MODULE *pModule, WORD type, LPVOID bits, DWORD size );
+*/
+/* relay32/builtin.c */
+extern WINE_MODREF *BUILTIN32_LoadLibraryExA(LPCSTR name, DWORD flags);
+extern HMODULE BUILTIN32_LoadExeModule( LPCSTR *filename );
+extern void BUILTIN32_UnloadLibrary(WINE_MODREF *wm);
+extern void *BUILTIN32_dlopen( const char *name );
+extern int BUILTIN32_dlclose( void *handle );
+
+#endif /* __WINE_MODULE_H */
diff --git a/loader/wine/msacm.h b/loader/wine/msacm.h
new file mode 100644
index 0000000000..b76c1095a8
--- /dev/null
+++ b/loader/wine/msacm.h
@@ -0,0 +1,942 @@
+/*
+ * msacm.h - Declarations for MSACM
+ */
+
+#ifndef __WINE_MSACM_H
+#define __WINE_MSACM_H
+
+#include "windef.h"
+#include "driver.h"
+#include "mmreg.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* defined(__cplusplus) */
+
+//typedef WORD VERSION; /* major (high byte), minor (low byte) */
+
+typedef UINT16 MMVERSION16;
+typedef UINT MMVERSION;
+typedef UINT16 MCIDEVICEID16;
+typedef UINT MCIDEVICEID;
+typedef UINT16 MMRESULT16;
+typedef UINT MMRESULT;
+typedef DWORD FOURCC; /* a four character code */
+
+
+
+#define WAVE_FORMAT_PCM 1
+
+/***********************************************************************
+ * Defines/Enums
+ */
+
+#define ACMERR_BASE 512
+#define ACMERR_NOTPOSSIBLE (ACMERR_BASE + 0)
+#define ACMERR_BUSY (ACMERR_BASE + 1)
+#define ACMERR_UNPREPARED (ACMERR_BASE + 2)
+#define ACMERR_CANCELED (ACMERR_BASE + 3)
+
+#define MM_ACM_OPEN MM_STREAM_OPEN
+#define MM_ACM_CLOSE MM_STREAM_CLOSE
+#define MM_ACM_DONE MM_STREAM_DONE
+
+#define ACM_DRIVERADDF_FUNCTION 0x00000003L
+#define ACM_DRIVERADDF_NOTIFYHWND 0x00000004L
+#define ACM_DRIVERADDF_TYPEMASK 0x00000007L
+#define ACM_DRIVERADDF_LOCAL 0x00000000L
+#define ACM_DRIVERADDF_GLOBAL 0x00000008L
+
+#define ACMDRIVERDETAILS_SHORTNAME_CHARS 32
+#define ACMDRIVERDETAILS_LONGNAME_CHARS 128
+#define ACMDRIVERDETAILS_COPYRIGHT_CHARS 80
+#define ACMDRIVERDETAILS_LICENSING_CHARS 128
+#define ACMDRIVERDETAILS_FEATURES_CHARS 512
+
+#define ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC mmioFOURCC('a', 'u', 'd', 'c')
+#define ACMDRIVERDETAILS_FCCCOMP_UNDEFINED mmioFOURCC('\0', '\0', '\0', '\0')
+
+#define ACMDRIVERDETAILS_SUPPORTF_CODEC 0x00000001L
+#define ACMDRIVERDETAILS_SUPPORTF_CONVERTER 0x00000002L
+#define ACMDRIVERDETAILS_SUPPORTF_FILTER 0x00000004L
+#define ACMDRIVERDETAILS_SUPPORTF_HARDWARE 0x00000008L
+#define ACMDRIVERDETAILS_SUPPORTF_ASYNC 0x00000010L
+#define ACMDRIVERDETAILS_SUPPORTF_LOCAL 0x40000000L
+#define ACMDRIVERDETAILS_SUPPORTF_DISABLED 0x80000000L
+
+#define ACM_DRIVERENUMF_NOLOCAL 0x40000000L
+#define ACM_DRIVERENUMF_DISABLED 0x80000000L
+
+#define ACM_DRIVERPRIORITYF_ENABLE 0x00000001L
+#define ACM_DRIVERPRIORITYF_DISABLE 0x00000002L
+#define ACM_DRIVERPRIORITYF_ABLEMASK 0x00000003L
+#define ACM_DRIVERPRIORITYF_BEGIN 0x00010000L
+#define ACM_DRIVERPRIORITYF_END 0x00020000L
+#define ACM_DRIVERPRIORITYF_DEFERMASK 0x00030000L
+
+#define MM_ACM_FILTERCHOOSE 0x8000
+
+#define FILTERCHOOSE_MESSAGE 0
+#define FILTERCHOOSE_FILTERTAG_VERIFY (FILTERCHOOSE_MESSAGE+0)
+#define FILTERCHOOSE_FILTER_VERIFY (FILTERCHOOSE_MESSAGE+1)
+#define FILTERCHOOSE_CUSTOM_VERIFY (FILTERCHOOSE_MESSAGE+2)
+
+#define ACMFILTERCHOOSE_STYLEF_SHOWHELP 0x00000004L
+#define ACMFILTERCHOOSE_STYLEF_ENABLEHOOK 0x00000008L
+#define ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATE 0x00000010L
+#define ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATEHANDLE 0x00000020L
+#define ACMFILTERCHOOSE_STYLEF_INITTOFILTERSTRUCT 0x00000040L
+#define ACMFILTERCHOOSE_STYLEF_CONTEXTHELP 0x00000080L
+
+#define ACMFILTERDETAILS_FILTER_CHARS 128
+
+#define ACM_FILTERDETAILSF_INDEX 0x00000000L
+#define ACM_FILTERDETAILSF_FILTER 0x00000001L
+#define ACM_FILTERDETAILSF_QUERYMASK 0x0000000FL
+
+#define ACMFILTERTAGDETAILS_FILTERTAG_CHARS 48
+
+#define ACM_FILTERTAGDETAILSF_INDEX 0x00000000L
+#define ACM_FILTERTAGDETAILSF_FILTERTAG 0x00000001L
+#define ACM_FILTERTAGDETAILSF_LARGESTSIZE 0x00000002L
+#define ACM_FILTERTAGDETAILSF_QUERYMASK 0x0000000FL
+
+#define ACM_FILTERENUMF_DWFILTERTAG 0x00010000L
+
+#define ACMHELPMSGSTRINGA "acmchoose_help"
+#define ACMHELPMSGSTRINGW L"acmchoose_help"
+#define ACMHELPMSGSTRING16 "acmchoose_help"
+
+#define ACMHELPMSGCONTEXTMENUA "acmchoose_contextmenu"
+#define ACMHELPMSGCONTEXTMENUW L"acmchoose_contextmenu"
+#define ACMHELPMSGCONTEXTMENU16 "acmchoose_contextmenu"
+
+#define ACMHELPMSGCONTEXTHELPA "acmchoose_contexthelp"
+#define ACMHELPMSGCONTEXTHELPW L"acmchoose_contexthelp"
+#define ACMHELPMSGCONTEXTHELP16 "acmchoose_contexthelp"
+
+#define MM_ACM_FORMATCHOOSE 0x8000
+
+#define FORMATCHOOSE_MESSAGE 0
+#define FORMATCHOOSE_FORMATTAG_VERIFY (FORMATCHOOSE_MESSAGE+0)
+#define FORMATCHOOSE_FORMAT_VERIFY (FORMATCHOOSE_MESSAGE+1)
+#define FORMATCHOOSE_CUSTOM_VERIFY (FORMATCHOOSE_MESSAGE+2)
+
+#define ACMFORMATCHOOSE_STYLEF_SHOWHELP 0x00000004L
+#define ACMFORMATCHOOSE_STYLEF_ENABLEHOOK 0x00000008L
+#define ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE 0x00000010L
+#define ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE 0x00000020L
+#define ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT 0x00000040L
+#define ACMFORMATCHOOSE_STYLEF_CONTEXTHELP 0x00000080L
+
+#define ACMFORMATDETAILS_FORMAT_CHARS 128
+
+#define ACM_FORMATDETAILSF_INDEX 0x00000000L
+#define ACM_FORMATDETAILSF_FORMAT 0x00000001L
+#define ACM_FORMATDETAILSF_QUERYMASK 0x0000000FL
+
+#define ACM_FORMATENUMF_WFORMATTAG 0x00010000L
+#define ACM_FORMATENUMF_NCHANNELS 0x00020000L
+#define ACM_FORMATENUMF_NSAMPLESPERSEC 0x00040000L
+#define ACM_FORMATENUMF_WBITSPERSAMPLE 0x00080000L
+#define ACM_FORMATENUMF_CONVERT 0x00100000L
+#define ACM_FORMATENUMF_SUGGEST 0x00200000L
+#define ACM_FORMATENUMF_HARDWARE 0x00400000L
+#define ACM_FORMATENUMF_INPUT 0x00800000L
+#define ACM_FORMATENUMF_OUTPUT 0x01000000L
+
+#define ACM_FORMATSUGGESTF_WFORMATTAG 0x00010000L
+#define ACM_FORMATSUGGESTF_NCHANNELS 0x00020000L
+#define ACM_FORMATSUGGESTF_NSAMPLESPERSEC 0x00040000L
+#define ACM_FORMATSUGGESTF_WBITSPERSAMPLE 0x00080000L
+#define ACM_FORMATSUGGESTF_TYPEMASK 0x00FF0000L
+
+#define ACMFORMATTAGDETAILS_FORMATTAG_CHARS 48
+
+#define ACM_FORMATTAGDETAILSF_INDEX 0x00000000L
+#define ACM_FORMATTAGDETAILSF_FORMATTAG 0x00000001L
+#define ACM_FORMATTAGDETAILSF_LARGESTSIZE 0x00000002L
+#define ACM_FORMATTAGDETAILSF_QUERYMASK 0x0000000FL
+
+#define ACM_METRIC_COUNT_DRIVERS 1
+#define ACM_METRIC_COUNT_CODECS 2
+#define ACM_METRIC_COUNT_CONVERTERS 3
+#define ACM_METRIC_COUNT_FILTERS 4
+#define ACM_METRIC_COUNT_DISABLED 5
+#define ACM_METRIC_COUNT_HARDWARE 6
+#define ACM_METRIC_COUNT_LOCAL_DRIVERS 20
+#define ACM_METRIC_COUNT_LOCAL_CODECS 21
+#define ACM_METRIC_COUNT_LOCAL_CONVERTERS 22
+#define ACM_METRIC_COUNT_LOCAL_FILTERS 23
+#define ACM_METRIC_COUNT_LOCAL_DISABLED 24
+#define ACM_METRIC_HARDWARE_WAVE_INPUT 30
+#define ACM_METRIC_HARDWARE_WAVE_OUTPUT 31
+#define ACM_METRIC_MAX_SIZE_FORMAT 50
+#define ACM_METRIC_MAX_SIZE_FILTER 51
+#define ACM_METRIC_DRIVER_SUPPORT 100
+#define ACM_METRIC_DRIVER_PRIORITY 101
+
+#define ACM_STREAMCONVERTF_BLOCKALIGN 0x00000004
+#define ACM_STREAMCONVERTF_START 0x00000010
+#define ACM_STREAMCONVERTF_END 0x00000020
+
+#define ACMSTREAMHEADER_STATUSF_DONE 0x00010000L
+#define ACMSTREAMHEADER_STATUSF_PREPARED 0x00020000L
+#define ACMSTREAMHEADER_STATUSF_INQUEUE 0x00100000L
+
+#define ACM_STREAMOPENF_QUERY 0x00000001
+#define ACM_STREAMOPENF_ASYNC 0x00000002
+#define ACM_STREAMOPENF_NONREALTIME 0x00000004
+
+#define ACM_STREAMSIZEF_SOURCE 0x00000000L
+#define ACM_STREAMSIZEF_DESTINATION 0x00000001L
+#define ACM_STREAMSIZEF_QUERYMASK 0x0000000FL
+
+#define ACMDM_USER (DRV_USER + 0x0000)
+#define ACMDM_RESERVED_LOW (DRV_USER + 0x2000)
+#define ACMDM_RESERVED_HIGH (DRV_USER + 0x2FFF)
+
+#define ACMDM_BASE ACMDM_RESERVED_LOW
+
+#define ACMDM_DRIVER_ABOUT (ACMDM_BASE + 11)
+
+/***********************************************************************
+ * Callbacks
+ */
+
+typedef WIN_BOOL CALLBACK ( *ACMDRIVERENUMCB)(
+ HACMDRIVERID hadid, DWORD dwInstance, DWORD fdwSupport
+);
+
+typedef WIN_BOOL16 CALLBACK ( *ACMDRIVERENUMCB16)(
+ HACMDRIVERID16 hadid, DWORD dwInstance, DWORD fdwSupport
+);
+
+typedef UINT CALLBACK ( *ACMFILTERCHOOSEHOOKPROCA)(
+ HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
+);
+
+typedef UINT CALLBACK ( *ACMFILTERCHOOSEHOOKPROCW)(
+ HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
+);
+
+typedef UINT CALLBACK ( *ACMFILTERCHOOSEHOOKPROC16)(
+ HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
+);
+
+typedef UINT CALLBACK ( *ACMFORMATCHOOSEHOOKPROCA)(
+ HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
+);
+
+typedef UINT CALLBACK ( *ACMFORMATCHOOSEHOOKPROCW)(
+ HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
+);
+
+typedef UINT16 CALLBACK ( *ACMFORMATCHOOSEHOOKPROC16)(
+ HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam
+);
+
+/***********************************************************************
+ * Structures
+ */
+
+typedef struct _ACMDRIVERDETAILSA
+{
+ DWORD cbStruct;
+
+ FOURCC fccType;
+ FOURCC fccComp;
+
+ WORD wMid;
+ WORD wPid;
+
+ DWORD vdwACM;
+ DWORD vdwDriver;
+
+ DWORD fdwSupport;
+ DWORD cFormatTags;
+ DWORD cFilterTags;
+
+ HICON hicon;
+
+ CHAR szShortName[ACMDRIVERDETAILS_SHORTNAME_CHARS];
+ CHAR szLongName[ACMDRIVERDETAILS_LONGNAME_CHARS];
+ CHAR szCopyright[ACMDRIVERDETAILS_COPYRIGHT_CHARS];
+ CHAR szLicensing[ACMDRIVERDETAILS_LICENSING_CHARS];
+ CHAR szFeatures[ACMDRIVERDETAILS_FEATURES_CHARS];
+} ACMDRIVERDETAILSA, *PACMDRIVERDETAILSA;
+
+typedef struct _ACMDRIVERDETAILSW
+{
+ DWORD cbStruct;
+
+ FOURCC fccType;
+ FOURCC fccComp;
+
+ WORD wMid;
+ WORD wPid;
+
+ DWORD vdwACM;
+ DWORD vdwDriver;
+
+ DWORD fdwSupport;
+ DWORD cFormatTags;
+ DWORD cFilterTags;
+
+ HICON hicon;
+
+ WCHAR szShortName[ACMDRIVERDETAILS_SHORTNAME_CHARS];
+ WCHAR szLongName[ACMDRIVERDETAILS_LONGNAME_CHARS];
+ WCHAR szCopyright[ACMDRIVERDETAILS_COPYRIGHT_CHARS];
+ WCHAR szLicensing[ACMDRIVERDETAILS_LICENSING_CHARS];
+ WCHAR szFeatures[ACMDRIVERDETAILS_FEATURES_CHARS];
+} ACMDRIVERDETAILSW, *PACMDRIVERDETAILSW;
+
+typedef struct _ACMDRIVERDETAILS16
+{
+ DWORD cbStruct;
+
+ FOURCC fccType;
+ FOURCC fccComp;
+
+ WORD wMid;
+ WORD wPid;
+
+ DWORD vdwACM;
+ DWORD vdwDriver;
+
+ DWORD fdwSupport;
+ DWORD cFormatTags;
+ DWORD cFilterTags;
+
+ HICON16 hicon;
+
+ CHAR szShortName[ACMDRIVERDETAILS_SHORTNAME_CHARS];
+ CHAR szLongName[ACMDRIVERDETAILS_LONGNAME_CHARS];
+ CHAR szCopyright[ACMDRIVERDETAILS_COPYRIGHT_CHARS];
+ CHAR szLicensing[ACMDRIVERDETAILS_LICENSING_CHARS];
+ CHAR szFeatures[ACMDRIVERDETAILS_FEATURES_CHARS];
+} ACMDRIVERDETAILS16, *NPACMDRIVERDETAILS16, *LPACMDRIVERDETAILS16;
+
+typedef struct _ACMFILTERCHOOSEA
+{
+ DWORD cbStruct;
+ DWORD fdwStyle;
+
+ HWND hwndOwner;
+
+ PWAVEFILTER pwfltr;
+ DWORD cbwfltr;
+
+ LPCSTR pszTitle;
+
+ CHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
+ CHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS];
+ LPSTR pszName;
+ DWORD cchName;
+
+ DWORD fdwEnum;
+ PWAVEFILTER pwfltrEnum;
+
+ HINSTANCE hInstance;
+ LPCSTR pszTemplateName;
+ LPARAM lCustData;
+ ACMFILTERCHOOSEHOOKPROCA pfnHook;
+} ACMFILTERCHOOSEA, *PACMFILTERCHOOSEA;
+
+typedef struct _ACMFILTERCHOOSEW
+{
+ DWORD cbStruct;
+ DWORD fdwStyle;
+
+ HWND hwndOwner;
+
+ PWAVEFILTER pwfltr;
+ DWORD cbwfltr;
+
+ LPCWSTR pszTitle;
+
+ WCHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
+ WCHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS];
+ LPWSTR pszName;
+ DWORD cchName;
+
+ DWORD fdwEnum;
+ PWAVEFILTER pwfltrEnum;
+
+ HINSTANCE hInstance;
+ LPCWSTR pszTemplateName;
+ LPARAM lCustData;
+ ACMFILTERCHOOSEHOOKPROCW pfnHook;
+} ACMFILTERCHOOSEW, *PACMFILTERCHOOSEW;
+
+typedef struct _ACMFILTERCHOOSE16
+{
+ DWORD cbStruct;
+ DWORD fdwStyle;
+
+ HWND16 hwndOwner;
+
+ LPWAVEFILTER pwfltr;
+ DWORD cbwfltr;
+
+ LPCSTR pszTitle;
+
+ char szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
+ char szFilter[ACMFILTERDETAILS_FILTER_CHARS];
+ LPSTR pszName;
+ DWORD cchName;
+
+ DWORD fdwEnum;
+ LPWAVEFILTER pwfltrEnum;
+
+ HINSTANCE16 hInstance;
+ LPCSTR pszTemplateName;
+ LPARAM lCustData;
+ ACMFILTERCHOOSEHOOKPROC16 pfnHook;
+} ACMFILTERCHOOSE16, *NPACMFILTERCHOOSE16, *LPACMFILTERCHOOSE16;
+
+typedef struct _ACMFILTERDETAILSA
+{
+ DWORD cbStruct;
+ DWORD dwFilterIndex;
+ DWORD dwFilterTag;
+ DWORD fdwSupport;
+ PWAVEFILTER pwfltr;
+ DWORD cbwfltr;
+ CHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS];
+} ACMFILTERDETAILSA, *PACMFILTERDETAILSA;
+
+typedef struct _ACMFILTERDETAILSW
+{
+ DWORD cbStruct;
+ DWORD dwFilterIndex;
+ DWORD dwFilterTag;
+ DWORD fdwSupport;
+ PWAVEFILTER pwfltr;
+ DWORD cbwfltr;
+ WCHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS];
+} ACMFILTERDETAILSW, *PACMFILTERDETAILSW;
+
+typedef struct _ACMFILTERDETAILS16
+{
+ DWORD cbStruct;
+ DWORD dwFilterIndex;
+ DWORD dwFilterTag;
+ DWORD fdwSupport;
+ LPWAVEFILTER pwfltr;
+ DWORD cbwfltr;
+ CHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS];
+} ACMFILTERDETAILS16, *NPACMFILTERDETAILS16, *LPACMFILTERDETAILS16;
+
+typedef struct _ACMFILTERTAGDETAILSA
+{
+ DWORD cbStruct;
+ DWORD dwFilterTagIndex;
+ DWORD dwFilterTag;
+ DWORD cbFilterSize;
+ DWORD fdwSupport;
+ DWORD cStandardFilters;
+ CHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
+} ACMFILTERTAGDETAILSA, *PACMFILTERTAGDETAILSA;
+
+typedef struct _ACMFILTERTAGDETAILSW
+{
+ DWORD cbStruct;
+ DWORD dwFilterTagIndex;
+ DWORD dwFilterTag;
+ DWORD cbFilterSize;
+ DWORD fdwSupport;
+ DWORD cStandardFilters;
+ WCHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
+} ACMFILTERTAGDETAILSW, *PACMFILTERTAGDETAILSW;
+
+typedef struct _ACMFILTERTAGDETAILS16
+{
+ DWORD cbStruct;
+ DWORD dwFilterTagIndex;
+ DWORD dwFilterTag;
+ DWORD cbFilterSize;
+ DWORD fdwSupport;
+ DWORD cStandardFilters;
+ CHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
+} ACMFILTERTAGDETAILS16, *NPACMFILTERTAGDETAILS16, *LPACMFILTERTAGDETAILS16;
+
+typedef struct _ACMFORMATCHOOSEA
+{
+ DWORD cbStruct;
+ DWORD fdwStyle;
+
+ HWND hwndOwner;
+
+ PWAVEFORMATEX pwfx;
+ DWORD cbwfx;
+ LPCSTR pszTitle;
+
+ CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
+ CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
+
+ LPSTR pszName;
+ DWORD cchName;
+
+ DWORD fdwEnum;
+ PWAVEFORMATEX pwfxEnum;
+
+ HINSTANCE hInstance;
+ LPCSTR pszTemplateName;
+ LPARAM lCustData;
+ ACMFORMATCHOOSEHOOKPROCA pfnHook;
+} ACMFORMATCHOOSEA, *PACMFORMATCHOOSEA;
+
+typedef struct _ACMFORMATCHOOSEW
+{
+ DWORD cbStruct;
+ DWORD fdwStyle;
+
+ HWND hwndOwner;
+
+ PWAVEFORMATEX pwfx;
+ DWORD cbwfx;
+ LPCWSTR pszTitle;
+
+ WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
+ WCHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
+
+ LPWSTR pszName;
+ DWORD cchName;
+
+ DWORD fdwEnum;
+ LPWAVEFORMATEX pwfxEnum;
+
+ HINSTANCE hInstance;
+ LPCWSTR pszTemplateName;
+ LPARAM lCustData;
+ ACMFORMATCHOOSEHOOKPROCW pfnHook;
+} ACMFORMATCHOOSEW, *PACMFORMATCHOOSEW;
+
+typedef struct _ACMFORMATCHOOSE16
+{
+ DWORD cbStruct;
+ DWORD fdwStyle;
+
+ HWND16 hwndOwner;
+
+ LPWAVEFORMATEX pwfx;
+ DWORD cbwfx;
+ LPCSTR pszTitle;
+
+ CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
+ CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
+
+ LPSTR pszName;
+ DWORD cchName;
+
+ DWORD fdwEnum;
+ LPWAVEFORMATEX pwfxEnum;
+
+ HINSTANCE16 hInstance;
+ LPCSTR pszTemplateName;
+ LPARAM lCustData;
+ ACMFORMATCHOOSEHOOKPROC16 pfnHook;
+} ACMFORMATCHOOSE16, *NPACMFORMATCHOOSE16, *LPACMFORMATCHOOSE16;
+
+typedef struct _ACMFORMATDETAILSA
+{
+ DWORD cbStruct;
+ DWORD dwFormatIndex;
+ DWORD dwFormatTag;
+ DWORD fdwSupport;
+ PWAVEFORMATEX pwfx;
+ DWORD cbwfx;
+ CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
+} ACMFORMATDETAILSA, *PACMFORMATDETAILSA;
+
+typedef struct _ACMFORMATDETAILSW
+{
+ DWORD cbStruct;
+ DWORD dwFormatIndex;
+ DWORD dwFormatTag;
+ DWORD fdwSupport;
+ PWAVEFORMATEX pwfx;
+ DWORD cbwfx;
+ WCHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
+} ACMFORMATDETAILSW, *PACMFORMATDETAILSW;
+
+typedef struct _ACMFORMATDETAILS16
+{
+ DWORD cbStruct;
+ DWORD dwFormatIndex;
+ DWORD dwFormatTag;
+ DWORD fdwSupport;
+ LPWAVEFORMATEX pwfx;
+ DWORD cbwfx;
+ CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
+} ACMFORMATDETAILS16, *NPACMFORMATDETAILS16, *LPACMFORMATDETAILS16;
+
+typedef struct _ACMFORMATTAGDETAILSA
+{
+ DWORD cbStruct;
+ DWORD dwFormatTagIndex;
+ DWORD dwFormatTag;
+ DWORD cbFormatSize;
+ DWORD fdwSupport;
+ DWORD cStandardFormats;
+ CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
+} ACMFORMATTAGDETAILSA, *PACMFORMATTAGDETAILSA;
+
+typedef struct _ACMFORMATTAGDETAILSW
+{
+ DWORD cbStruct;
+ DWORD dwFormatTagIndex;
+ DWORD dwFormatTag;
+ DWORD cbFormatSize;
+ DWORD fdwSupport;
+ DWORD cStandardFormats;
+ WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
+} ACMFORMATTAGDETAILSW, *PACMFORMATTAGDETAILSW;
+
+typedef struct _ACMFORMATTAGDETAILS16
+{
+ DWORD cbStruct;
+ DWORD dwFormatTagIndex;
+ DWORD dwFormatTag;
+ DWORD cbFormatSize;
+ DWORD fdwSupport;
+ DWORD cStandardFormats;
+ CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
+} ACMFORMATTAGDETAILS16, *NPACMFORMATTAGDETAILS16, *LPACMFORMATTAGDETAILS16;
+
+typedef struct _ACMSTREAMHEADER
+{
+ DWORD cbStruct;
+ DWORD fdwStatus;
+ DWORD dwUser;
+ LPBYTE pbSrc;
+ DWORD cbSrcLength;
+ DWORD cbSrcLengthUsed;
+ DWORD dwSrcUser;
+ LPBYTE pbDst;
+ DWORD cbDstLength;
+ DWORD cbDstLengthUsed;
+ DWORD dwDstUser;
+ DWORD dwReservedDriver[10];
+} ACMSTREAMHEADER16, *NPACMSTREAMHEADER16, *LPACMSTREAMHEADER16,
+ ACMSTREAMHEADER, *PACMSTREAMHEADER;
+
+/***********************************************************************
+ * Callbacks 2
+ */
+
+typedef WIN_BOOL CALLBACK ( *ACMFILTERENUMCBA)(
+ HACMDRIVERID hadid, PACMFILTERDETAILSA pafd,
+ DWORD dwInstance, DWORD fdwSupport
+);
+
+typedef WIN_BOOL CALLBACK ( *ACMFILTERENUMCBW)(
+ HACMDRIVERID hadid, PACMFILTERDETAILSW pafd,
+ DWORD dwInstance, DWORD fdwSupport
+);
+
+typedef WIN_BOOL16 CALLBACK ( *ACMFILTERENUMCB16)(
+ HACMDRIVERID16 hadid, LPACMFILTERDETAILS16 pafd,
+ DWORD dwInstance, DWORD fdwSupport
+);
+
+typedef WIN_BOOL CALLBACK ( *ACMFILTERTAGENUMCBA)(
+ HACMDRIVERID hadid, PACMFILTERTAGDETAILSA paftd,
+ DWORD dwInstance, DWORD fdwSupport
+);
+
+typedef WIN_BOOL CALLBACK ( *ACMFILTERTAGENUMCBW)(
+ HACMDRIVERID hadid, PACMFILTERTAGDETAILSW paftd,
+ DWORD dwInstance, DWORD fdwSupport
+);
+
+typedef WIN_BOOL16 CALLBACK ( *ACMFILTERTAGENUMCB16)(
+ HACMDRIVERID16 hadid, LPACMFILTERTAGDETAILS16 paftd,
+ DWORD dwInstance, DWORD fdwSupport
+);
+
+typedef WIN_BOOL CALLBACK ( *ACMFORMATENUMCBA)(
+ HACMDRIVERID hadid, PACMFORMATDETAILSA pafd,
+ DWORD dwInstance, DWORD fdwSupport
+);
+
+typedef WIN_BOOL CALLBACK ( *ACMFORMATENUMCBW)(
+ HACMDRIVERID hadid, PACMFORMATDETAILSW pafd,
+ DWORD dwInstance, DWORD fdwSupport
+);
+
+typedef WIN_BOOL16 CALLBACK ( *ACMFORMATENUMCB16)(
+ HACMDRIVERID16 hadid, LPACMFORMATDETAILS16 pafd,
+ DWORD dwInstance, DWORD fdwSupport
+);
+
+typedef WIN_BOOL CALLBACK ( *ACMFORMATTAGENUMCBA)(
+ HACMDRIVERID hadid, PACMFORMATTAGDETAILSA paftd,
+ DWORD dwInstance, DWORD fdwSupport
+);
+
+typedef WIN_BOOL CALLBACK ( *ACMFORMATTAGENUMCBW)(
+ HACMDRIVERID hadid, PACMFORMATTAGDETAILSW paftd,
+ DWORD dwInstance, DWORD fdwSupport
+);
+
+typedef WIN_BOOL16 CALLBACK ( *ACMFORMATTAGENUMCB16)(
+ HACMDRIVERID16 hadid, LPACMFORMATTAGDETAILS16 paftd,
+ DWORD dwInstance, DWORD fdwSupport
+);
+
+/***********************************************************************
+ * Functions - Win16
+ */
+
+DWORD WINAPI acmGetVersion16(
+);
+MMRESULT16 WINAPI acmMetrics16(
+ HACMOBJ16 hao, UINT16 uMetric, LPVOID pMetric
+);
+MMRESULT16 WINAPI acmDriverEnum16(
+ ACMDRIVERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT16 WINAPI acmDriverDetails16(
+ HACMDRIVERID16 hadid, LPACMDRIVERDETAILS16 padd, DWORD fdwDetails
+);
+MMRESULT16 WINAPI acmDriverAdd16(
+ LPHACMDRIVERID16 phadid, HINSTANCE16 hinstModule,
+ LPARAM lParam, DWORD dwPriority, DWORD fdwAdd
+);
+MMRESULT16 WINAPI acmDriverRemove16(
+ HACMDRIVERID16 hadid, DWORD fdwRemove
+);
+MMRESULT16 WINAPI acmDriverOpen16(
+ LPHACMDRIVER16 phad, HACMDRIVERID16 hadid, DWORD fdwOpen
+);
+MMRESULT16 WINAPI acmDriverClose16(
+ HACMDRIVER16 had, DWORD fdwClose
+);
+LRESULT WINAPI acmDriverMessage16(
+ HACMDRIVER16 had, UINT16 uMsg, LPARAM lParam1, LPARAM lParam2
+);
+MMRESULT16 WINAPI acmDriverID16(
+ HACMOBJ16 hao, LPHACMDRIVERID16 phadid, DWORD fdwDriverID
+);
+MMRESULT16 WINAPI acmDriverPriority16(
+ HACMDRIVERID16 hadid, DWORD dwPriority, DWORD fdwPriority
+);
+MMRESULT16 WINAPI acmFormatTagDetails16(
+ HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd, DWORD fdwDetails
+);
+MMRESULT16 WINAPI acmFormatTagEnum16(
+ HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd,
+ ACMFORMATTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT16 WINAPI acmFormatChoose16(
+ LPACMFORMATCHOOSE16 pafmtc
+);
+MMRESULT16 WINAPI acmFormatDetails16(
+ HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd, DWORD fdwDetails
+);
+MMRESULT16 WINAPI acmFormatEnum16(
+ HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd,
+ ACMFORMATENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT16 WINAPI acmFormatSuggest16(
+ HACMDRIVER16 had, LPWAVEFORMATEX pwfxSrc,
+ LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest
+);
+MMRESULT16 WINAPI acmFilterTagDetails16(
+ HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd, DWORD fdwDetails
+);
+MMRESULT16 WINAPI acmFilterTagEnum16(
+ HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd,
+ ACMFILTERTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT16 WINAPI acmFilterChoose16(
+ LPACMFILTERCHOOSE16 pafltrc
+);
+MMRESULT16 WINAPI acmFilterDetails16(
+ HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd, DWORD fdwDetails
+);
+MMRESULT16 WINAPI acmFilterEnum16(
+ HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd,
+ ACMFILTERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT16 WINAPI acmStreamOpen16(
+ LPHACMSTREAM16 phas, HACMDRIVER16 had,
+ LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst,
+ LPWAVEFILTER pwfltr, DWORD dwCallback,
+ DWORD dwInstance, DWORD fdwOpen
+);
+MMRESULT16 WINAPI acmStreamClose16(
+ HACMSTREAM16 has, DWORD fdwClose
+);
+MMRESULT16 WINAPI acmStreamSize16(
+ HACMSTREAM16 has, DWORD cbInput,
+ LPDWORD pdwOutputBytes, DWORD fdwSize
+);
+MMRESULT16 WINAPI acmStreamConvert16(
+ HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwConvert
+);
+MMRESULT16 WINAPI acmStreamReset16(
+ HACMSTREAM16 has, DWORD fdwReset
+);
+MMRESULT16 WINAPI acmStreamPrepareHeader16(
+ HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwPrepare
+);
+MMRESULT16 WINAPI acmStreamUnprepareHeader16(
+ HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwUnprepare
+);
+
+/***********************************************************************
+ * Functions - Win32
+ */
+
+MMRESULT WINAPI acmDriverAddA(
+ PHACMDRIVERID phadid, HINSTANCE hinstModule,
+ LPARAM lParam, DWORD dwPriority, DWORD fdwAdd
+);
+MMRESULT WINAPI acmDriverAddW(
+ PHACMDRIVERID phadid, HINSTANCE hinstModule,
+ LPARAM lParam, DWORD dwPriority, DWORD fdwAdd
+);
+MMRESULT WINAPI acmDriverClose(
+ HACMDRIVER had, DWORD fdwClose
+);
+MMRESULT WINAPI acmDriverDetailsA(
+ HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmDriverDetailsW(
+ HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmDriverEnum(
+ ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmDriverID(
+ HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID
+);
+LRESULT WINAPI acmDriverMessage(
+ HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2
+);
+MMRESULT WINAPI acmDriverOpen(
+ PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen
+);
+MMRESULT WINAPI acmDriverPriority(
+ HACMDRIVERID hadid, DWORD dwPriority, DWORD fdwPriority
+);
+MMRESULT WINAPI acmDriverRemove(
+ HACMDRIVERID hadid, DWORD fdwRemove
+);
+MMRESULT WINAPI acmFilterChooseA(
+ PACMFILTERCHOOSEA pafltrc
+);
+MMRESULT WINAPI acmFilterChooseW(
+ PACMFILTERCHOOSEW pafltrc
+);
+MMRESULT WINAPI acmFilterDetailsA(
+ HACMDRIVER had, PACMFILTERDETAILSA pafd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFilterDetailsW(
+ HACMDRIVER had, PACMFILTERDETAILSW pafd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFilterEnumA(
+ HACMDRIVER had, PACMFILTERDETAILSA pafd,
+ ACMFILTERENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFilterEnumW(
+ HACMDRIVER had, PACMFILTERDETAILSW pafd,
+ ACMFILTERENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFilterTagDetailsA(
+ HACMDRIVER had, PACMFILTERTAGDETAILSA paftd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFilterTagDetailsW(
+ HACMDRIVER had, PACMFILTERTAGDETAILSW paftd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFilterTagEnumA(
+ HACMDRIVER had, PACMFILTERTAGDETAILSA paftd,
+ ACMFILTERTAGENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFilterTagEnumW(
+ HACMDRIVER had, PACMFILTERTAGDETAILSW paftd,
+ ACMFILTERTAGENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFormatChooseA(
+ PACMFORMATCHOOSEA pafmtc
+);
+MMRESULT WINAPI acmFormatChooseW(
+ PACMFORMATCHOOSEW pafmtc
+);
+MMRESULT WINAPI acmFormatDetailsA(
+ HACMDRIVER had, PACMFORMATDETAILSA pafd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFormatDetailsW(
+ HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFormatEnumA(
+ HACMDRIVER had, PACMFORMATDETAILSA pafd,
+ ACMFORMATENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFormatEnumW(
+ HACMDRIVER had, PACMFORMATDETAILSW pafd,
+ ACMFORMATENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFormatSuggest(
+ HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst,
+ DWORD cbwfxDst, DWORD fdwSuggest
+);
+MMRESULT WINAPI acmFormatTagDetailsA(
+ HACMDRIVER had, PACMFORMATTAGDETAILSA paftd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFormatTagDetailsW(
+ HACMDRIVER had, PACMFORMATTAGDETAILSW paftd, DWORD fdwDetails
+);
+MMRESULT WINAPI acmFormatTagEnumA(
+ HACMDRIVER had, PACMFORMATTAGDETAILSA paftd,
+ ACMFORMATTAGENUMCBA fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+MMRESULT WINAPI acmFormatTagEnumW(
+ HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
+ ACMFORMATTAGENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum
+);
+DWORD WINAPI acmGetVersion(
+);
+MMRESULT WINAPI acmMetrics(
+ HACMOBJ hao, UINT uMetric, LPVOID pMetric
+);
+MMRESULT WINAPI acmStreamClose(
+ HACMSTREAM has, DWORD fdwClose
+);
+MMRESULT WINAPI acmStreamConvert(
+ HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwConvert
+);
+MMRESULT WINAPI acmStreamMessage(
+ HACMSTREAM has, UINT uMsg, LPARAM lParam1, LPARAM lParam2
+);
+MMRESULT WINAPI acmStreamOpen(
+ PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
+ PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback,
+ DWORD dwInstance, DWORD fdwOpen
+);
+MMRESULT WINAPI acmStreamPrepareHeader(
+ HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwPrepare
+);
+MMRESULT WINAPI acmStreamReset(
+ HACMSTREAM has, DWORD fdwReset
+);
+MMRESULT WINAPI acmStreamSize(
+ HACMSTREAM has, DWORD cbInput,
+ LPDWORD pdwOutputBytes, DWORD fdwSize
+);
+MMRESULT WINAPI acmStreamUnprepareHeader(
+ HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwUnprepare
+);
+void MSACM_RegisterAllDrivers(void);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* defined(__cplusplus) */
+
+#endif /* __WINE_MSACM_H */
+
+
diff --git a/loader/wine/msacmdrv.h b/loader/wine/msacmdrv.h
new file mode 100644
index 0000000000..2e23a17d79
--- /dev/null
+++ b/loader/wine/msacmdrv.h
@@ -0,0 +1,203 @@
+/*
+ * msacmdrv.h - Declarations for MSACM driver
+ */
+
+#ifndef __WINE_MSACMDRV_H
+#define __WINE_MSACMDRV_H
+
+#include "windef.h"
+#include "msacm.h"
+
+/***********************************************************************
+ * Types
+ */
+
+/***********************************************************************
+ * Defines/Enums
+ */
+
+#define MAKE_ACM_VERSION(mjr, mnr, bld) \
+ (((long)(mjr)<<24) | ((long)(mnr)<<16) | ((long)bld))
+
+#define ACMDRVOPENDESC_SECTIONNAME_CHARS
+
+#define ACMDM_DRIVER_NOTIFY (ACMDM_BASE + 1)
+#define ACMDM_DRIVER_DETAILS (ACMDM_BASE + 10)
+
+#define ACMDM_HARDWARE_WAVE_CAPS_INPUT (ACMDM_BASE + 20)
+#define ACMDM_HARDWARE_WAVE_CAPS_OUTPUT (ACMDM_BASE + 21)
+
+#define ACMDM_FORMATTAG_DETAILS (ACMDM_BASE + 25)
+#define ACMDM_FORMAT_DETAILS (ACMDM_BASE + 26)
+#define ACMDM_FORMAT_SUGGEST (ACMDM_BASE + 27)
+
+#define ACMDM_FILTERTAG_DETAILS (ACMDM_BASE + 50)
+#define ACMDM_FILTER_DETAILS (ACMDM_BASE + 51)
+
+#define ACMDM_STREAM_OPEN (ACMDM_BASE + 76)
+#define ACMDM_STREAM_CLOSE (ACMDM_BASE + 77)
+#define ACMDM_STREAM_SIZE (ACMDM_BASE + 78)
+#define ACMDM_STREAM_CONVERT (ACMDM_BASE + 79)
+#define ACMDM_STREAM_RESET (ACMDM_BASE + 80)
+#define ACMDM_STREAM_PREPARE (ACMDM_BASE + 81)
+#define ACMDM_STREAM_UNPREPARE (ACMDM_BASE + 82)
+#define ACMDM_STREAM_UPDATE (ACMDM_BASE + 83)
+
+/***********************************************************************
+ * Structures
+ */
+
+typedef struct _ACMDRVOPENDESCA
+{
+ DWORD cbStruct;
+ FOURCC fccType;
+ FOURCC fccComp;
+ DWORD dwVersion;
+ DWORD dwFlags;
+ DWORD dwError;
+ LPCSTR pszSectionName;
+ LPCSTR pszAliasName;
+ DWORD dnDevNode;
+} ACMDRVOPENDESCA, *PACMDRVOPENDESCA;
+
+typedef struct _ACMDRVOPENDESCW
+{
+ DWORD cbStruct;
+ FOURCC fccType;
+ FOURCC fccComp;
+ DWORD dwVersion;
+ DWORD dwFlags;
+ DWORD dwError;
+ LPCWSTR pszSectionName;
+ LPCWSTR pszAliasName;
+ DWORD dnDevNode;
+} ACMDRVOPENDESCW, *PACMDRVOPENDESCW;
+
+typedef struct _ACMDRVOPENDESC16
+{
+ DWORD cbStruct;
+ FOURCC fccType;
+ FOURCC fccComp;
+ DWORD dwVersion;
+ DWORD dwFlags;
+ DWORD dwError;
+ LPCSTR pszSectionName;
+ LPCSTR pszAliasName;
+ DWORD dnDevNode;
+} ACMDRVOPENDESC16, *NPACMDRVOPENDESC16, *LPACMDRVOPENDESC16;
+
+typedef struct _ACMDRVSTREAMINSTANCE16
+{
+ DWORD cbStruct;
+ LPWAVEFORMATEX pwfxSrc;
+ LPWAVEFORMATEX pwfxDst;
+ LPWAVEFILTER pwfltr;
+ DWORD dwCallback;
+ DWORD dwInstance;
+ DWORD fdwOpen;
+ DWORD fdwDriver;
+ DWORD dwDriver;
+ HACMSTREAM16 has;
+} ACMDRVSTREAMINSTANCE16, *NPACMDRVSTREAMINSTANCE16, *LPACMDRVSTREAMINSTANCE16;
+
+typedef struct _ACMDRVSTREAMINSTANCE
+{
+ DWORD cbStruct;
+ PWAVEFORMATEX pwfxSrc;
+ PWAVEFORMATEX pwfxDst;
+ PWAVEFILTER pwfltr;
+ DWORD dwCallback;
+ DWORD dwInstance;
+ DWORD fdwOpen;
+ DWORD fdwDriver;
+ DWORD dwDriver;
+ HACMSTREAM has;
+} ACMDRVSTREAMINSTANCE, *PACMDRVSTREAMINSTANCE;
+
+
+typedef struct _ACMDRVSTREAMHEADER16 *LPACMDRVSTREAMHEADER16;
+typedef struct _ACMDRVSTREAMHEADER16 {
+ DWORD cbStruct;
+ DWORD fdwStatus;
+ DWORD dwUser;
+ LPBYTE pbSrc;
+ DWORD cbSrcLength;
+ DWORD cbSrcLengthUsed;
+ DWORD dwSrcUser;
+ LPBYTE pbDst;
+ DWORD cbDstLength;
+ DWORD cbDstLengthUsed;
+ DWORD dwDstUser;
+
+ DWORD fdwConvert;
+ LPACMDRVSTREAMHEADER16 *padshNext;
+ DWORD fdwDriver;
+ DWORD dwDriver;
+
+ /* Internal fields for ACM */
+ DWORD fdwPrepared;
+ DWORD dwPrepared;
+ LPBYTE pbPreparedSrc;
+ DWORD cbPreparedSrcLength;
+ LPBYTE pbPreparedDst;
+ DWORD cbPreparedDstLength;
+} ACMDRVSTREAMHEADER16, *NPACMDRVSTREAMHEADER16;
+
+typedef struct _ACMDRVSTREAMHEADER *PACMDRVSTREAMHEADER;
+typedef struct _ACMDRVSTREAMHEADER {
+ DWORD cbStruct;
+ DWORD fdwStatus;
+ DWORD dwUser;
+ LPBYTE pbSrc;
+ DWORD cbSrcLength;
+ DWORD cbSrcLengthUsed;
+ DWORD dwSrcUser;
+ LPBYTE pbDst;
+ DWORD cbDstLength;
+ DWORD cbDstLengthUsed;
+ DWORD dwDstUser;
+
+ DWORD fdwConvert;
+ PACMDRVSTREAMHEADER *padshNext;
+ DWORD fdwDriver;
+ DWORD dwDriver;
+
+ /* Internal fields for ACM */
+ DWORD fdwPrepared;
+ DWORD dwPrepared;
+ LPBYTE pbPreparedSrc;
+ DWORD cbPreparedSrcLength;
+ LPBYTE pbPreparedDst;
+ DWORD cbPreparedDstLength;
+} ACMDRVSTREAMHEADER;
+
+typedef struct _ACMDRVSTREAMSIZE
+{
+ DWORD cbStruct;
+ DWORD fdwSize;
+ DWORD cbSrcLength;
+ DWORD cbDstLength;
+} ACMDRVSTREAMSIZE16, *NPACMDRVSTREAMSIZE16, *LPACMDRVSTREAMSIZE16,
+ ACMDRVSTREAMSIZE, *PACMDRVSTREAMSIZE;
+
+typedef struct _ACMDRVFORMATSUGGEST16
+{
+ DWORD cbStruct;
+ DWORD fdwSuggest;
+ LPWAVEFORMATEX pwfxSrc;
+ DWORD cbwfxSrc;
+ LPWAVEFORMATEX pwfxDst;
+ DWORD cbwfxDst;
+} ACMDRVFORMATSUGGEST16, *NPACMDRVFORMATSUGGEST, *LPACMDRVFORMATSUGGEST;
+
+typedef struct _ACMDRVFORMATSUGGEST
+{
+ DWORD cbStruct;
+ DWORD fdwSuggest;
+ PWAVEFORMATEX pwfxSrc;
+ DWORD cbwfxSrc;
+ PWAVEFORMATEX pwfxDst;
+ DWORD cbwfxDst;
+} ACMDRVFORMATSUGGEST, *PACMDRVFORMATSUGGEST;
+
+#endif /* __WINE_MSACMDRV_H */
diff --git a/loader/wine/ntdef.h b/loader/wine/ntdef.h
new file mode 100644
index 0000000000..edf0af86c1
--- /dev/null
+++ b/loader/wine/ntdef.h
@@ -0,0 +1,101 @@
+#ifndef __WINE_NTDEF_H
+#define __WINE_NTDEF_H
+
+#include "basetsd.h"
+#include "windef.h"
+
+#include "pshpack1.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define NTAPI __stdcall
+
+#ifndef IN
+#define IN
+#endif
+
+#ifndef OUT
+#define OUT
+#endif
+
+#ifndef OPTIONAL
+#define OPTIONAL
+#endif
+
+#ifndef VOID
+#define VOID void
+#endif
+
+typedef LONG NTSTATUS;
+typedef NTSTATUS *PNTSTATUS;
+
+typedef short CSHORT;
+typedef CSHORT *PCSHORT;
+
+typedef WCHAR * PWCHAR;
+
+/* NT lowlevel Strings (handled by Rtl* functions in NTDLL)
+ * If they are zero terminated, Length does not include the terminating 0.
+ */
+
+typedef struct _STRING {
+ USHORT Length;
+ USHORT MaximumLength;
+ PSTR Buffer;
+} STRING,*PSTRING,ANSI_STRING,*PANSI_STRING;
+
+typedef struct _CSTRING {
+ USHORT Length;
+ USHORT MaximumLength;
+ PCSTR Buffer;
+} CSTRING,*PCSTRING;
+
+typedef struct _UNICODE_STRING {
+ USHORT Length; /* bytes */
+ USHORT MaximumLength; /* bytes */
+ PWSTR Buffer;
+} UNICODE_STRING,*PUNICODE_STRING;
+
+/*
+ Objects
+*/
+
+#define OBJ_INHERIT 0x00000002L
+#define OBJ_PERMANENT 0x00000010L
+#define OBJ_EXCLUSIVE 0x00000020L
+#define OBJ_CASE_INSENSITIVE 0x00000040L
+#define OBJ_OPENIF 0x00000080L
+#define OBJ_OPENLINK 0x00000100L
+#define OBJ_KERNEL_HANDLE 0x00000200L
+#define OBJ_VALID_ATTRIBUTES 0x000003F2L
+
+typedef struct _OBJECT_ATTRIBUTES
+{ ULONG Length;
+ HANDLE RootDirectory;
+ PUNICODE_STRING ObjectName;
+ ULONG Attributes;
+ PVOID SecurityDescriptor; /* type SECURITY_DESCRIPTOR */
+ PVOID SecurityQualityOfService; /* type SECURITY_QUALITY_OF_SERVICE */
+} OBJECT_ATTRIBUTES;
+
+typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES;
+
+#define InitializeObjectAttributes(p,n,a,r,s) \
+{ (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
+ (p)->RootDirectory = r; \
+ (p)->Attributes = a; \
+ (p)->ObjectName = n; \
+ (p)->SecurityDescriptor = s; \
+ (p)->SecurityQualityOfService = NULL; \
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#include "poppack.h"
+
+#endif
diff --git a/loader/wine/pe_image.h b/loader/wine/pe_image.h
new file mode 100644
index 0000000000..9b4f322c6d
--- /dev/null
+++ b/loader/wine/pe_image.h
@@ -0,0 +1,81 @@
+#ifndef __WINE_PE_IMAGE_H
+#define __WINE_PE_IMAGE_H
+
+#include "windef.h"
+#include "winbase.h"
+
+#define PE_HEADER(module) \
+ ((IMAGE_NT_HEADERS*)((LPBYTE)(module) + \
+ (((IMAGE_DOS_HEADER*)(module))->e_lfanew)))
+
+#define PE_SECTIONS(module) \
+ ((IMAGE_SECTION_HEADER*)((LPBYTE)&PE_HEADER(module)->OptionalHeader + \
+ PE_HEADER(module)->FileHeader.SizeOfOptionalHeader))
+
+#define RVA_PTR(module,field) ((LPBYTE)(module) + PE_HEADER(module)->field)
+
+/* modreference used for attached processes
+ * all section are calculated here, relocations etc.
+ */
+typedef struct {
+ PIMAGE_IMPORT_DESCRIPTOR pe_import;
+ PIMAGE_EXPORT_DIRECTORY pe_export;
+ PIMAGE_RESOURCE_DIRECTORY pe_resource;
+ int tlsindex;
+} PE_MODREF;
+
+struct _wine_modref;
+extern int PE_unloadImage(HMODULE hModule);
+extern FARPROC PE_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName, WIN_BOOL snoop);
+extern WIN_BOOL PE_EnumResourceTypesA(HMODULE,ENUMRESTYPEPROCA,LONG);
+extern WIN_BOOL PE_EnumResourceTypesW(HMODULE,ENUMRESTYPEPROCW,LONG);
+extern WIN_BOOL PE_EnumResourceNamesA(HMODULE,LPCSTR,ENUMRESNAMEPROCA,LONG);
+extern WIN_BOOL PE_EnumResourceNamesW(HMODULE,LPCWSTR,ENUMRESNAMEPROCW,LONG);
+extern WIN_BOOL PE_EnumResourceLanguagesA(HMODULE,LPCSTR,LPCSTR,ENUMRESLANGPROCA,LONG);
+extern WIN_BOOL PE_EnumResourceLanguagesW(HMODULE,LPCWSTR,LPCWSTR,ENUMRESLANGPROCW,LONG);
+extern HRSRC PE_FindResourceExW(struct _wine_modref*,LPCWSTR,LPCWSTR,WORD);
+extern DWORD PE_SizeofResource(HMODULE,HRSRC);
+extern struct _wine_modref *PE_LoadLibraryExA(LPCSTR, DWORD);
+extern void PE_UnloadLibrary(struct _wine_modref *);
+extern HGLOBAL PE_LoadResource(struct _wine_modref *wm,HRSRC);
+extern HMODULE PE_LoadImage( int hFile, LPCSTR filename, WORD *version );
+extern struct _wine_modref *PE_CreateModule( HMODULE hModule, LPCSTR filename,
+ DWORD flags, WIN_BOOL builtin );
+extern WIN_BOOL PE_CreateProcess( HANDLE hFile, LPCSTR filename, LPCSTR cmd_line, LPCSTR env,
+ LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
+ WIN_BOOL inherit, DWORD flags, LPSTARTUPINFOA startup,
+ LPPROCESS_INFORMATION info );
+
+extern void PE_InitTls(void);
+extern WIN_BOOL PE_InitDLL(struct _wine_modref *wm, DWORD type, LPVOID lpReserved);
+
+extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY,LPCSTR,DWORD,WIN_BOOL);
+extern PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD,WIN_BOOL);
+
+typedef DWORD CALLBACK (*DLLENTRYPROC)(HMODULE,DWORD,LPVOID);
+
+typedef struct {
+ WORD popl WINE_PACKED; /* 0x8f 0x05 */
+ DWORD addr_popped WINE_PACKED;/* ... */
+ BYTE pushl1 WINE_PACKED; /* 0x68 */
+ DWORD newret WINE_PACKED; /* ... */
+ BYTE pushl2 WINE_PACKED; /* 0x68 */
+ DWORD origfun WINE_PACKED; /* original function */
+ BYTE ret1 WINE_PACKED; /* 0xc3 */
+ WORD addesp WINE_PACKED; /* 0x83 0xc4 */
+ BYTE nrofargs WINE_PACKED; /* nr of arguments to add esp, */
+ BYTE pushl3 WINE_PACKED; /* 0x68 */
+ DWORD oldret WINE_PACKED; /* Filled out from popl above */
+ BYTE ret2 WINE_PACKED; /* 0xc3 */
+} ELF_STDCALL_STUB;
+
+typedef struct {
+ void* dlhandle;
+ ELF_STDCALL_STUB *stubs;
+} ELF_MODREF;
+
+extern struct _wine_modref *ELF_LoadLibraryExA( LPCSTR libname, DWORD flags);
+extern void ELF_UnloadLibrary(struct _wine_modref *);
+extern FARPROC ELF_FindExportedFunction(struct _wine_modref *wm, LPCSTR funcName);
+
+#endif /* __WINE_PE_IMAGE_H */
diff --git a/loader/wine/poppack.h b/loader/wine/poppack.h
new file mode 100644
index 0000000000..7104791591
--- /dev/null
+++ b/loader/wine/poppack.h
@@ -0,0 +1,15 @@
+#ifdef __WINE_PSHPACK_H
+#undef __WINE_PSHPACK_H
+
+#if defined(__GNUC__) || defined(__SUNPRO_C)
+#pragma pack()
+#elif defined(__SUNPRO_CC)
+#warning "Assumes default alignment is 4"
+#pragma pack(4)
+#elif !defined(RC_INVOKED)
+#error "Restoration of the previous alignment isn't supported by the compiler"
+#endif /* defined(__GNUC__) || defined(__SUNPRO_C) ; !defined(RC_INVOKED) */
+
+#else /* defined(__WINE_PSHPACK_H) */
+#error "Popping alignment isn't possible since no alignment has been pushed"
+#endif /* defined(__WINE_PSHPACK_H) */
diff --git a/loader/wine/pshpack1.h b/loader/wine/pshpack1.h
new file mode 100644
index 0000000000..e560250c26
--- /dev/null
+++ b/loader/wine/pshpack1.h
@@ -0,0 +1,13 @@
+#ifndef __WINE_PSHPACK_H
+#define __WINE_PSHPACK_H 1
+
+#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+//#pragma pack(1)
+#elif !defined(RC_INVOKED)
+#error "1 as alignment isn't supported by the compiler"
+#endif /* defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */
+
+#else /* !defined(__WINE_PSHPACK_H) */
+#error "Nested pushing of alignment isn't supported by the compiler"
+#endif /* !defined(__WINE_PSHPACK_H) */
+
diff --git a/loader/wine/pshpack2.h b/loader/wine/pshpack2.h
new file mode 100644
index 0000000000..887b1e17bc
--- /dev/null
+++ b/loader/wine/pshpack2.h
@@ -0,0 +1,12 @@
+#ifndef __WINE_PSHPACK_H
+#define __WINE_PSHPACK_H 2
+
+#if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+//#pragma pack(2)
+#elif !defined(RC_INVOKED)
+#error "2 as alignment isn't supported by the compiler"
+#endif /* defined(__GNUC__) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */
+
+#else /* !defined(__WINE_PSHPACK_H) */
+#error "Nested pushing of alignment isn't supported by the compiler"
+#endif /* !defined(__WINE_PSHPACK_H) */
diff --git a/loader/wine/pshpack4.h b/loader/wine/pshpack4.h
new file mode 100644
index 0000000000..9fdaf70a71
--- /dev/null
+++ b/loader/wine/pshpack4.h
@@ -0,0 +1,15 @@
+#ifndef __WINE_PSHPACK_H
+#define __WINE_PSHPACK_H 4
+
+#if defined(__GNUC__) || defined(__SUNPRO_CC)
+//#pragma pack(4)
+#elif defined(__SUNPRO_C)
+//#pragma pack()
+#elif !defined(RC_INVOKED)
+#error "4 as alignment isn't supported by the compiler"
+#endif /* defined(__GNUC__) || defined(__SUNPRO_CC) ; !defined(RC_INVOKED) */
+
+#else /* !defined(__WINE_PSHPACK_H) */
+#error "Nested pushing of alignment isn't supported by the compiler"
+#endif /* !defined(__WINE_PSHPACK_H) */
+
diff --git a/loader/wine/pshpack8.h b/loader/wine/pshpack8.h
new file mode 100644
index 0000000000..74d13a4722
--- /dev/null
+++ b/loader/wine/pshpack8.h
@@ -0,0 +1,12 @@
+#ifndef __WINE_PSHPACK_H
+#define __WINE_PSHPACK_H 8
+
+#if 0
+//#pragma pack(8)
+#elif !defined(RC_INVOKED)
+#error "8 as alignment is not supported"
+#endif /* 0 ; !defined(RC_INVOKED) */
+
+#else /* !defined(__WINE_PSHPACK_H) */
+#error "Nested pushing of alignment isn't supported by the compiler"
+#endif /* !defined(__WINE_PSHPACK_H) */
diff --git a/loader/wine/vfw.h b/loader/wine/vfw.h
new file mode 100644
index 0000000000..2b79bbc73d
--- /dev/null
+++ b/loader/wine/vfw.h
@@ -0,0 +1,654 @@
+#ifndef __WINE_VFW_H
+#define __WINE_VFW_H
+//#include "pshpack1.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifndef __WINE_WINGDI_H
+
+typedef struct
+{
+ short bfType;
+ long bfSize;
+ short bfReserved1;
+ short bfReserved2;
+ long bfOffBits;
+} BITMAPFILEHEADER;
+
+typedef struct
+{
+ long biSize;
+ long biWidth;
+ long biHeight;
+ short biPlanes;
+ short biBitCount;
+ long biCompression;
+ long biSizeImage;
+ long biXPelsPerMeter;
+ long biYPelsPerMeter;
+ long biClrUsed;
+ long biClrImportant;
+} BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
+typedef struct {
+ BITMAPINFOHEADER bmiHeader;
+ int bmiColors[1];
+} BITMAPINFO, *LPBITMAPINFO;
+#endif
+#define VFWAPI
+#define VFWAPIV
+#ifndef __WINE_WINDEF_H
+typedef long (__stdcall__ *DRIVERPROC)(long,HDRVR,unsigned int,long,long);
+#endif
+
+
+
+#ifndef mmioFOURCC
+#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
+ ( (long)(unsigned char)(ch0) | ( (long)(unsigned char)(ch1) << 8 ) | \
+ ( (long)(unsigned char)(ch2) << 16 ) | ( (long)(unsigned char)(ch3) << 24 ) )
+#endif
+
+#ifndef aviTWOCC
+#define aviTWOCC(ch0, ch1) ((short)(unsigned char)(ch0) | ((short)(unsigned char)(ch1) << 8))
+#endif
+
+#define ICTYPE_VIDEO mmioFOURCC('v', 'i', 'd', 'c')
+#define ICTYPE_AUDIO mmioFOURCC('a', 'u', 'd', 'c')
+
+
+/* Installable Compressor M? */
+
+/* HIC struct (same layout as Win95 one) */
+typedef struct tagWINE_HIC {
+ long magic; /* 00: 'Smag' */
+ HANDLE curthread; /* 04: */
+ long type; /* 08: */
+ long handler; /* 0C: */
+ HDRVR hdrv; /* 10: */
+#ifndef __cplusplus
+ long private; /* 14:(handled by SendDriverMessage)*/
+#else
+ long _private; /* 14:(handled by SendDriverMessage)*/
+#endif
+ DRIVERPROC driverproc; /* 18:(handled by SendDriverMessage)*/
+ long x1; /* 1c: name? */
+ short x2; /* 20: */
+ long x3; /* 22: */
+ /* 26: */
+} WINE_HIC;
+
+/* error return codes */
+#define ICERR_OK 0
+#define ICERR_DONTDRAW 1
+#define ICERR_NEWPALETTE 2
+#define ICERR_GOTOKEYFRAME 3
+#define ICERR_STOPDRAWING 4
+
+#define ICERR_UNSUPPORTED -1
+#define ICERR_BADFORMAT -2
+#define ICERR_MEMORY -3
+#define ICERR_INTERNAL -4
+#define ICERR_BADFLAGS -5
+#define ICERR_BADPARAM -6
+#define ICERR_BADSIZE -7
+#define ICERR_BADHANDLE -8
+#define ICERR_CANTUPDATE -9
+#define ICERR_ABORT -10
+#define ICERR_ERROR -100
+#define ICERR_BADBITDEPTH -200
+#define ICERR_BADIMAGESIZE -201
+
+#define ICERR_CUSTOM -400
+
+/* ICM Messages */
+#define ICM_USER (DRV_USER+0x0000)
+
+/* ICM driver message range */
+#define ICM_RESERVED_LOW (DRV_USER+0x1000)
+#define ICM_RESERVED_HIGH (DRV_USER+0x2000)
+#define ICM_RESERVED ICM_RESERVED_LOW
+
+#define ICM_GETSTATE (ICM_RESERVED+0)
+#define ICM_SETSTATE (ICM_RESERVED+1)
+#define ICM_GETINFO (ICM_RESERVED+2)
+
+#define ICM_CONFIGURE (ICM_RESERVED+10)
+#define ICM_ABOUT (ICM_RESERVED+11)
+/* */
+
+#define ICM_GETDEFAULTQUALITY (ICM_RESERVED+30)
+#define ICM_GETQUALITY (ICM_RESERVED+31)
+#define ICM_SETQUALITY (ICM_RESERVED+32)
+
+#define ICM_SET (ICM_RESERVED+40)
+#define ICM_GET (ICM_RESERVED+41)
+
+/* 2 constant FOURCC codes */
+#define ICM_FRAMERATE mmioFOURCC('F','r','m','R')
+#define ICM_KEYFRAMERATE mmioFOURCC('K','e','y','R')
+
+#define ICM_COMPRESS_GET_FORMAT (ICM_USER+4)
+#define ICM_COMPRESS_GET_SIZE (ICM_USER+5)
+#define ICM_COMPRESS_QUERY (ICM_USER+6)
+#define ICM_COMPRESS_BEGIN (ICM_USER+7)
+#define ICM_COMPRESS (ICM_USER+8)
+#define ICM_COMPRESS_END (ICM_USER+9)
+
+#define ICM_DECOMPRESS_GET_FORMAT (ICM_USER+10)
+#define ICM_DECOMPRESS_QUERY (ICM_USER+11)
+#define ICM_DECOMPRESS_BEGIN (ICM_USER+12)
+#define ICM_DECOMPRESS (ICM_USER+13)
+#define ICM_DECOMPRESS_END (ICM_USER+14)
+#define ICM_DECOMPRESS_SET_PALETTE (ICM_USER+29)
+#define ICM_DECOMPRESS_GET_PALETTE (ICM_USER+30)
+
+#define ICM_DRAW_QUERY (ICM_USER+31)
+#define ICM_DRAW_BEGIN (ICM_USER+15)
+#define ICM_DRAW_GET_PALETTE (ICM_USER+16)
+#define ICM_DRAW_START (ICM_USER+18)
+#define ICM_DRAW_STOP (ICM_USER+19)
+#define ICM_DRAW_END (ICM_USER+21)
+#define ICM_DRAW_GETTIME (ICM_USER+32)
+#define ICM_DRAW (ICM_USER+33)
+#define ICM_DRAW_WINDOW (ICM_USER+34)
+#define ICM_DRAW_SETTIME (ICM_USER+35)
+#define ICM_DRAW_REALIZE (ICM_USER+36)
+#define ICM_DRAW_FLUSH (ICM_USER+37)
+#define ICM_DRAW_RENDERBUFFER (ICM_USER+38)
+
+#define ICM_DRAW_START_PLAY (ICM_USER+39)
+#define ICM_DRAW_STOP_PLAY (ICM_USER+40)
+
+#define ICM_DRAW_SUGGESTFORMAT (ICM_USER+50)
+#define ICM_DRAW_CHANGEPALETTE (ICM_USER+51)
+
+#define ICM_GETBUFFERSWANTED (ICM_USER+41)
+
+#define ICM_GETDEFAULTKEYFRAMERATE (ICM_USER+42)
+
+#define ICM_DECOMPRESSEX_BEGIN (ICM_USER+60)
+#define ICM_DECOMPRESSEX_QUERY (ICM_USER+61)
+#define ICM_DECOMPRESSEX (ICM_USER+62)
+#define ICM_DECOMPRESSEX_END (ICM_USER+63)
+
+#define ICM_COMPRESS_FRAMES_INFO (ICM_USER+70)
+#define ICM_SET_STATUS_PROC (ICM_USER+72)
+
+/* structs */
+
+typedef struct {
+ long dwSize; /* 00: size */
+ long fccType; /* 04: type 'vidc' usually */
+ long fccHandler; /* 08: */
+ long dwVersion; /* 0c: version of compman opening you */
+ long dwFlags; /* 10: LOshort is type specific */
+ LRESULT dwError; /* 14: */
+ void* pV1Reserved; /* 18: */
+ void* pV2Reserved; /* 1c: */
+ long dnDevNode; /* 20: */
+ /* 24: */
+} ICOPEN,*LPICOPEN;
+
+#define ICCOMPRESS_KEYFRAME 0x00000001L
+
+typedef struct {
+ long dwFlags;
+ LPBITMAPINFOHEADER lpbiOutput;
+ void* lpOutput;
+ LPBITMAPINFOHEADER lpbiInput;
+ void* lpInput;
+ long* lpckid;
+ long* lpdwFlags;
+ long lFrameNum;
+ long dwFrameSize;
+ long dwQuality;
+ LPBITMAPINFOHEADER lpbiPrev;
+ void* lpPrev;
+} ICCOMPRESS;
+
+long VFWAPIV ICCompress(
+ HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpData,
+ LPBITMAPINFOHEADER lpbiInput,void* lpBits,long* lpckid,
+ long* lpdwFlags,long lFrameNum,long dwFrameSize,long dwQuality,
+ LPBITMAPINFOHEADER lpbiPrev,void* lpPrev
+);
+
+
+#define ICCompressGetFormat(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic,ICM_COMPRESS_GET_FORMAT,(long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ )
+
+#define ICCompressGetFormatSize(hic,lpbi) ICCompressGetFormat(hic,lpbi,NULL)
+
+#define ICGetDefaultKeyFrameRate(hic,lpint) \
+ ICSendMessage( \
+ hic, ICM_GETDEFAULTKEYFRAMERATE, \
+ (long)(void*)(lpint), \
+ 0 )
+
+#define ICGetDefaultQuality(hic,lpint) \
+ ICSendMessage( \
+ hic, ICM_GETDEFAULTQUALITY, \
+ (long)(void*)(lpint), \
+ 0 )
+
+
+#define ICCompressBegin(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic, ICM_COMPRESS_BEGIN, (long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ )
+
+#define ICCompressGetSize(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic, ICM_COMPRESS_GET_SIZE, (long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ )
+
+#define ICCompressQuery(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic, ICM_COMPRESS_QUERY, (long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ )
+
+
+#define ICCompressEnd(hic) ICSendMessage(hic, ICM_COMPRESS_END, 0, 0)
+
+/* ICCOMPRESSFRAMES.dwFlags */
+#define ICCOMPRESSFRAMES_PADDING 0x00000001
+typedef struct {
+ long dwFlags;
+ LPBITMAPINFOHEADER lpbiOutput;
+ LPARAM lOutput;
+ LPBITMAPINFOHEADER lpbiInput;
+ LPARAM lInput;
+ long lStartFrame;
+ long lFrameCount;
+ long lQuality;
+ long lDataRate;
+ long lKeyRate;
+ long dwRate;
+ long dwScale;
+ long dwOverheadPerFrame;
+ long dwReserved2;
+ long CALLBACK (*GetData)(LPARAM lInput,long lFrame,void* lpBits,long len);
+ long CALLBACK (*PutData)(LPARAM lOutput,long lFrame,void* lpBits,long len);
+} ICCOMPRESSFRAMES;
+
+/* Values for wMode of ICOpen() */
+#define ICMODE_COMPRESS 1
+#define ICMODE_DECOMPRESS 2
+#define ICMODE_FASTDECOMPRESS 3
+#define ICMODE_QUERY 4
+#define ICMODE_FASTCOMPRESS 5
+#define ICMODE_DRAW 8
+
+/* quality flags */
+#define ICQUALITY_LOW 0
+#define ICQUALITY_HIGH 10000
+#define ICQUALITY_DEFAULT -1
+
+typedef struct {
+ long dwSize; /* 00: */
+ long fccType; /* 04:compressor type 'vidc' 'audc' */
+ long fccHandler; /* 08:compressor sub-type 'rle ' 'jpeg' 'pcm '*/
+ long dwFlags; /* 0c:flags LOshort is type specific */
+ long dwVersion; /* 10:version of the driver */
+ long dwVersionICM; /* 14:version of the ICM used */
+ /*
+ * under Win32, the driver always returns UNICODE strings.
+ */
+ WCHAR szName[16]; /* 18:short name */
+ WCHAR szDescription[128]; /* 38:long name */
+ WCHAR szDriver[128]; /* 138:driver that contains compressor*/
+ /* 238: */
+} ICINFO;
+
+/* ICINFO.dwFlags */
+#define VIDCF_QUALITY 0x0001 /* supports quality */
+#define VIDCF_CRUNCH 0x0002 /* supports crunching to a frame size */
+#define VIDCF_TEMPORAL 0x0004 /* supports inter-frame compress */
+#define VIDCF_COMPRESSFRAMES 0x0008 /* wants the compress all frames message */
+#define VIDCF_DRAW 0x0010 /* supports drawing */
+#define VIDCF_FASTTEMPORALC 0x0020 /* does not need prev frame on compress */
+#define VIDCF_FASTTEMPORALD 0x0080 /* does not need prev frame on decompress */
+#define VIDCF_QUALITYTIME 0x0040 /* supports temporal quality */
+
+#define VIDCF_FASTTEMPORAL (VIDCF_FASTTEMPORALC|VIDCF_FASTTEMPORALD)
+
+
+/* function shortcuts */
+/* ICM_ABOUT */
+#define ICMF_ABOUT_QUERY 0x00000001
+
+#define ICQueryAbout(hic) \
+ (ICSendMessage(hic,ICM_ABOUT,(long)-1,ICMF_ABOUT_QUERY)==ICERR_OK)
+
+#define ICAbout(hic, hwnd) ICSendMessage(hic,ICM_ABOUT,(long)(unsigned int)(hwnd),0)
+
+/* ICM_CONFIGURE */
+#define ICMF_CONFIGURE_QUERY 0x00000001
+#define ICQueryConfigure(hic) \
+ (ICSendMessage(hic,ICM_CONFIGURE,(long)-1,ICMF_CONFIGURE_QUERY)==ICERR_OK)
+
+#define ICConfigure(hic,hwnd) \
+ ICSendMessage(hic,ICM_CONFIGURE,(long)(unsigned int)(hwnd),0)
+
+/* Decompression stuff */
+#define ICDECOMPRESS_HURRYUP 0x80000000 /* don't draw just buffer (hurry up!) */
+#define ICDECOMPRESS_UPDATE 0x40000000 /* don't draw just update screen */
+#define ICDECOMPRESS_PREROL 0x20000000 /* this frame is before real start */
+#define ICDECOMPRESS_NULLFRAME 0x10000000 /* repeat last frame */
+#define ICDECOMPRESS_NOTKEYFRAME 0x08000000 /* this frame is not a key frame */
+
+typedef struct {
+ long dwFlags; /* flags (from AVI index...) */
+ LPBITMAPINFOHEADER lpbiInput; /* BITMAPINFO of compressed data */
+ void* lpInput; /* compressed data */
+ LPBITMAPINFOHEADER lpbiOutput; /* DIB to decompress to */
+ void* lpOutput;
+ long ckid; /* ckid from AVI file */
+} ICDECOMPRESS;
+
+typedef struct {
+ long dwFlags;
+ LPBITMAPINFOHEADER lpbiSrc;
+ void* lpSrc;
+ LPBITMAPINFOHEADER lpbiDst;
+ void* lpDst;
+
+ /* changed for ICM_DECOMPRESSEX */
+ INT xDst; /* destination rectangle */
+ INT yDst;
+ INT dxDst;
+ INT dyDst;
+
+ INT xSrc; /* source rectangle */
+ INT ySrc;
+ INT dxSrc;
+ INT dySrc;
+} ICDECOMPRESSEX;
+
+
+long VFWAPIV ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits);
+
+
+#define ICDecompressBegin(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic, ICM_DECOMPRESS_BEGIN, (long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ )
+
+#define ICDecompressQuery(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic,ICM_DECOMPRESS_QUERY, (long)(void*)(lpbiInput), \
+ (long) (void*)(lpbiOutput) \
+ )
+
+#define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput) \
+ ((long)ICSendMessage( \
+ hic,ICM_DECOMPRESS_GET_FORMAT, (long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ ))
+
+#define ICDecompressGetFormatSize(hic, lpbi) \
+ ICDecompressGetFormat(hic, lpbi, NULL)
+
+#define ICDecompressGetPalette(hic, lpbiInput, lpbiOutput) \
+ ICSendMessage( \
+ hic, ICM_DECOMPRESS_GET_PALETTE, (long)(void*)(lpbiInput), \
+ (long)(void*)(lpbiOutput) \
+ )
+
+#define ICDecompressSetPalette(hic,lpbiPalette) \
+ ICSendMessage( \
+ hic,ICM_DECOMPRESS_SET_PALETTE, \
+ (long)(void*)(lpbiPalette),0 \
+ )
+
+#define ICDecompressEnd(hic) ICSendMessage(hic, ICM_DECOMPRESS_END, 0, 0)
+
+
+#define ICDRAW_QUERY 0x00000001L /* test for support */
+#define ICDRAW_FULLSCREEN 0x00000002L /* draw to full screen */
+#define ICDRAW_HDC 0x00000004L /* draw to a HDC/HWND */
+
+
+WIN_BOOL VFWAPI ICInfo(long fccType, long fccHandler, ICINFO * lpicinfo);
+LRESULT VFWAPI ICGetInfo(HIC hic,ICINFO *picinfo, long cb);
+HIC VFWAPI ICOpen(long fccType, long fccHandler, UINT wMode);
+HIC VFWAPI ICOpenFunction(long fccType, long fccHandler, unsigned int wMode, void* lpfnHandler);
+
+LRESULT VFWAPI ICClose(HIC hic);
+LRESULT VFWAPI ICSendMessage(HIC hic, unsigned int msg, long dw1, long dw2);
+HIC VFWAPI ICLocate(long fccType, long fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, short wFlags);
+
+int VFWAPI ICDoSomething();
+
+long VFWAPIV ICDrawBegin(
+ HIC hic,
+ long dwFlags,/* flags */
+ HPALETTE hpal, /* palette to draw with */
+ HWND hwnd, /* window to draw to */
+ HDC hdc, /* HDC to draw to */
+ INT xDst, /* destination rectangle */
+ INT yDst,
+ INT dxDst,
+ INT dyDst,
+ LPBITMAPINFOHEADER lpbi, /* format of frame to draw */
+ INT xSrc, /* source rectangle */
+ INT ySrc,
+ INT dxSrc,
+ INT dySrc,
+ long dwRate, /* frames/second = (dwRate/dwScale) */
+ long dwScale
+);
+
+/* as passed to ICM_DRAW_BEGIN (FIXME: correct only for Win32?) */
+typedef struct {
+ long dwFlags;
+ HPALETTE hpal;
+ HWND hwnd;
+ HDC hdc;
+ INT xDst;
+ INT yDst;
+ INT dxDst;
+ INT dyDst;
+ LPBITMAPINFOHEADER lpbi;
+ INT xSrc;
+ INT ySrc;
+ INT dxSrc;
+ INT dySrc;
+ long dwRate;
+ long dwScale;
+} ICDRAWBEGIN;
+
+#define ICDRAW_HURRYUP 0x80000000L /* don't draw just buffer (hurry up!) */
+#define ICDRAW_UPDATE 0x40000000L /* don't draw just update screen */
+#define ICDRAW_PREROLL 0x20000000L /* this frame is before real start */
+#define ICDRAW_NULLFRAME 0x10000000L /* repeat last frame */
+#define ICDRAW_NOTKEYFRAME 0x08000000L /* this frame is not a key frame */
+
+typedef struct {
+ long dwFlags;
+ void* lpFormat;
+ void* lpData;
+ long cbData;
+ long lTime;
+} ICDRAW;
+
+long VFWAPIV ICDraw(HIC hic,long dwFlags,void* lpFormat,void* lpData,long cbData,long lTime);
+
+
+#define AVIGETFRAMEF_BESTDISPLAYFMT 1
+
+typedef struct _AVISTREAMINFOA {
+ long fccType;
+ long fccHandler;
+ long dwFlags; /* AVIIF_* */
+ long dwCaps;
+ short wPriority;
+ short wLanguage;
+ long dwScale;
+ long dwRate; /* dwRate / dwScale == samples/second */
+ long dwStart;
+ long dwLength; /* In units above... */
+ long dwInitialFrames;
+ long dwSuggestedBufferSize;
+ long dwQuality;
+ long dwSampleSize;
+ RECT rcFrame;
+ long dwEditCount;
+ long dwFormatChangeCount;
+ char szName[64];
+} AVISTREAMINFOA, * LPAVISTREAMINFOA, *PAVISTREAMINFOA;
+
+typedef struct _AVISTREAMINFOW {
+ long fccType;
+ long fccHandler;
+ long dwFlags;
+ long dwCaps;
+ short wPriority;
+ short wLanguage;
+ long dwScale;
+ long dwRate; /* dwRate / dwScale == samples/second */
+ long dwStart;
+ long dwLength; /* In units above... */
+ long dwInitialFrames;
+ long dwSuggestedBufferSize;
+ long dwQuality;
+ long dwSampleSize;
+ RECT rcFrame;
+ long dwEditCount;
+ long dwFormatChangeCount;
+ short szName[64];
+} AVISTREAMINFOW, * LPAVISTREAMINFOW, *PAVISTREAMINFOW;
+DECL_WINELIB_TYPE_AW(AVISTREAMINFO)
+DECL_WINELIB_TYPE_AW(LPAVISTREAMINFO)
+DECL_WINELIB_TYPE_AW(PAVISTREAMINFO)
+
+#define AVISTREAMINFO_DISABLED 0x00000001
+#define AVISTREAMINFO_FORMATCHANGES 0x00010000
+
+/* AVIFILEINFO.dwFlags */
+#define AVIFILEINFO_HASINDEX 0x00000010
+#define AVIFILEINFO_MUSTUSEINDEX 0x00000020
+#define AVIFILEINFO_ISINTERLEAVED 0x00000100
+#define AVIFILEINFO_WASCAPTUREFILE 0x00010000
+#define AVIFILEINFO_COPYRIGHTED 0x00020000
+
+/* AVIFILEINFO.dwCaps */
+#define AVIFILECAPS_CANREAD 0x00000001
+#define AVIFILECAPS_CANWRITE 0x00000002
+#define AVIFILECAPS_ALLKEYFRAMES 0x00000010
+#define AVIFILECAPS_NOCOMPRESSION 0x00000020
+
+typedef struct _AVIFILEINFOW {
+ long dwMaxBytesPerSec;
+ long dwFlags;
+ long dwCaps;
+ long dwStreams;
+ long dwSuggestedBufferSize;
+ long dwWidth;
+ long dwHeight;
+ long dwScale;
+ long dwRate;
+ long dwLength;
+ long dwEditCount;
+ short szFileType[64];
+} AVIFILEINFOW, * LPAVIFILEINFOW, *PAVIFILEINFOW;
+
+typedef struct _AVIFILEINFOA {
+ long dwMaxBytesPerSec;
+ long dwFlags;
+ long dwCaps;
+ long dwStreams;
+ long dwSuggestedBufferSize;
+ long dwWidth;
+ long dwHeight;
+ long dwScale;
+ long dwRate;
+ long dwLength;
+ long dwEditCount;
+ char szFileType[64];
+} AVIFILEINFOA, * LPAVIFILEINFOA, *PAVIFILEINFOA;
+
+DECL_WINELIB_TYPE_AW(AVIFILEINFO)
+DECL_WINELIB_TYPE_AW(PAVIFILEINFO)
+DECL_WINELIB_TYPE_AW(LPAVIFILEINFO)
+
+/* AVICOMPRESSOPTIONS.dwFlags. determines presence of fields in below struct */
+#define AVICOMPRESSF_INTERLEAVE 0x00000001
+#define AVICOMPRESSF_DATARATE 0x00000002
+#define AVICOMPRESSF_KEYFRAMES 0x00000004
+#define AVICOMPRESSF_VALID 0x00000008
+
+typedef struct {
+ long fccType; /* stream type, for consistency */
+ long fccHandler; /* compressor */
+ long dwKeyFrameEvery; /* keyframe rate */
+ long dwQuality; /* compress quality 0-10,000 */
+ long dwBytesPerSecond; /* unsigned chars per second */
+ long dwFlags; /* flags... see below */
+ void* lpFormat; /* save format */
+ long cbFormat;
+ void* lpParms; /* compressor options */
+ long cbParms;
+ long dwInterleaveEvery; /* for non-video streams only */
+} AVICOMPRESSOPTIONS, *LPAVICOMPRESSOPTIONS,*PAVICOMPRESSOPTIONS;
+
+
+
+typedef struct {
+ long cbSize; // set to sizeof(COMPVARS) before
+ // calling ICCompressorChoose
+ long dwFlags; // see below...
+ HIC hic; // HIC of chosen compressor
+ long fccType; // basically ICTYPE_VIDEO
+ long fccHandler; // handler of chosen compressor or
+ // "" or "DIB "
+ LPBITMAPINFO lpbiIn; // input format
+ LPBITMAPINFO lpbiOut; // output format - will compress to this
+ void* lpBitsOut;
+ void* lpBitsPrev;
+ long lFrame;
+ long lKey; // key frames how often?
+ long lDataRate; // desired data rate KB/Sec
+ long lQ; // desired quality
+ long lKeyCount;
+ void* lpState; // state of compressor
+ long cbState; // size of the state
+} COMPVARS, *PCOMPVARS;
+
+// FLAGS for dwFlags element of COMPVARS structure:
+
+
+#define AVIERR_OK 0
+#define MAKE_AVIERR(error) MAKE_SCODE(SEVERITY_ERROR,FACILITY_ITF,0x4000+error)
+
+#define AVIERR_UNSUPPORTED MAKE_AVIERR(101)
+#define AVIERR_BADFORMAT MAKE_AVIERR(102)
+#define AVIERR_MEMORY MAKE_AVIERR(103)
+#define AVIERR_INTERNAL MAKE_AVIERR(104)
+#define AVIERR_BADFLAGS MAKE_AVIERR(105)
+#define AVIERR_BADPARAM MAKE_AVIERR(106)
+#define AVIERR_BADSIZE MAKE_AVIERR(107)
+#define AVIERR_BADHANDLE MAKE_AVIERR(108)
+#define AVIERR_FILEREAD MAKE_AVIERR(109)
+#define AVIERR_FILEWRITE MAKE_AVIERR(110)
+#define AVIERR_FILEOPEN MAKE_AVIERR(111)
+#define AVIERR_COMPRESSOR MAKE_AVIERR(112)
+#define AVIERR_NOCOMPRESSOR MAKE_AVIERR(113)
+#define AVIERR_READONLY MAKE_AVIERR(114)
+#define AVIERR_NODATA MAKE_AVIERR(115)
+#define AVIERR_BUFFERTOOSMALL MAKE_AVIERR(116)
+#define AVIERR_CANTCOMPRESS MAKE_AVIERR(117)
+#define AVIERR_USERABORT MAKE_AVIERR(198)
+#define AVIERR_ERROR MAKE_AVIERR(199)
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __WINE_VFW_H */
diff --git a/loader/wine/winbase.h b/loader/wine/winbase.h
new file mode 100644
index 0000000000..ee12af3632
--- /dev/null
+++ b/loader/wine/winbase.h
@@ -0,0 +1,1791 @@
+#ifndef __WINE_WINBASE_H
+#define __WINE_WINBASE_H
+
+#include "basetsd.h"
+#include "winnt.h"
+#include "winestring.h"
+#include "pshpack1.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct tagCOORD {
+ INT16 x;
+ INT16 y;
+} COORD, *LPCOORD;
+
+
+ /* Windows Exit Procedure flag values */
+#define WEP_FREE_DLL 0
+#define WEP_SYSTEM_EXIT 1
+
+typedef DWORD CALLBACK (*LPTHREAD_START_ROUTINE)(LPVOID);
+
+#define EXCEPTION_DEBUG_EVENT 1
+#define CREATE_THREAD_DEBUG_EVENT 2
+#define CREATE_PROCESS_DEBUG_EVENT 3
+#define EXIT_THREAD_DEBUG_EVENT 4
+#define EXIT_PROCESS_DEBUG_EVENT 5
+#define LOAD_DLL_DEBUG_EVENT 6
+#define UNLOAD_DLL_DEBUG_EVENT 7
+#define OUTPUT_DEBUG_STRING_EVENT 8
+#define RIP_EVENT 9
+
+typedef struct _EXCEPTION_DEBUG_INFO {
+ EXCEPTION_RECORD ExceptionRecord;
+ DWORD dwFirstChance;
+} EXCEPTION_DEBUG_INFO;
+
+typedef struct _CREATE_THREAD_DEBUG_INFO {
+ HANDLE hThread;
+ LPVOID lpThreadLocalBase;
+ LPTHREAD_START_ROUTINE lpStartAddress;
+} CREATE_THREAD_DEBUG_INFO;
+
+typedef struct _CREATE_PROCESS_DEBUG_INFO {
+ HANDLE hFile;
+ HANDLE hProcess;
+ HANDLE hThread;
+ LPVOID lpBaseOfImage;
+ DWORD dwDebugInfoFileOffset;
+ DWORD nDebugInfoSize;
+ LPVOID lpThreadLocalBase;
+ LPTHREAD_START_ROUTINE lpStartAddress;
+ LPVOID lpImageName;
+ WORD fUnicode;
+} CREATE_PROCESS_DEBUG_INFO;
+
+typedef struct _EXIT_THREAD_DEBUG_INFO {
+ DWORD dwExitCode;
+} EXIT_THREAD_DEBUG_INFO;
+
+typedef struct _EXIT_PROCESS_DEBUG_INFO {
+ DWORD dwExitCode;
+} EXIT_PROCESS_DEBUG_INFO;
+
+typedef struct _LOAD_DLL_DEBUG_INFO {
+ HANDLE hFile;
+ LPVOID lpBaseOfDll;
+ DWORD dwDebugInfoFileOffset;
+ DWORD nDebugInfoSize;
+ LPVOID lpImageName;
+ WORD fUnicode;
+} LOAD_DLL_DEBUG_INFO;
+
+typedef struct _UNLOAD_DLL_DEBUG_INFO {
+ LPVOID lpBaseOfDll;
+} UNLOAD_DLL_DEBUG_INFO;
+
+typedef struct _OUTPUT_DEBUG_STRING_INFO {
+ LPSTR lpDebugStringData;
+ WORD fUnicode;
+ WORD nDebugStringLength;
+} OUTPUT_DEBUG_STRING_INFO;
+
+typedef struct _RIP_INFO {
+ DWORD dwError;
+ DWORD dwType;
+} RIP_INFO;
+
+typedef struct _DEBUG_EVENT {
+ DWORD dwDebugEventCode;
+ DWORD dwProcessId;
+ DWORD dwThreadId;
+ union {
+ EXCEPTION_DEBUG_INFO Exception;
+ CREATE_THREAD_DEBUG_INFO CreateThread;
+ CREATE_PROCESS_DEBUG_INFO CreateProcessInfo;
+ EXIT_THREAD_DEBUG_INFO ExitThread;
+ EXIT_PROCESS_DEBUG_INFO ExitProcess;
+ LOAD_DLL_DEBUG_INFO LoadDll;
+ UNLOAD_DLL_DEBUG_INFO UnloadDll;
+ OUTPUT_DEBUG_STRING_INFO DebugString;
+ RIP_INFO RipInfo;
+ } u;
+} DEBUG_EVENT, *LPDEBUG_EVENT;
+
+#define OFS_MAXPATHNAME 128
+typedef struct
+{
+ BYTE cBytes;
+ BYTE fFixedDisk;
+ WORD nErrCode;
+ BYTE reserved[4];
+ BYTE szPathName[OFS_MAXPATHNAME];
+} OFSTRUCT, *LPOFSTRUCT;
+
+#define OF_READ 0x0000
+#define OF_WRITE 0x0001
+#define OF_READWRITE 0x0002
+#define OF_SHARE_COMPAT 0x0000
+#define OF_SHARE_EXCLUSIVE 0x0010
+#define OF_SHARE_DENY_WRITE 0x0020
+#define OF_SHARE_DENY_READ 0x0030
+#define OF_SHARE_DENY_NONE 0x0040
+#define OF_PARSE 0x0100
+#define OF_DELETE 0x0200
+#define OF_VERIFY 0x0400 /* Used with OF_REOPEN */
+#define OF_SEARCH 0x0400 /* Used without OF_REOPEN */
+#define OF_CANCEL 0x0800
+#define OF_CREATE 0x1000
+#define OF_PROMPT 0x2000
+#define OF_EXIST 0x4000
+#define OF_REOPEN 0x8000
+
+/* SetErrorMode values */
+#define SEM_FAILCRITICALERRORS 0x0001
+#define SEM_NOGPFAULTERRORBOX 0x0002
+#define SEM_NOALIGNMENTFAULTEXCEPT 0x0004
+#define SEM_NOOPENFILEERRORBOX 0x8000
+
+/* CopyFileEx flags */
+#define COPY_FILE_FAIL_IF_EXISTS 0x00000001
+#define COPY_FILE_RESTARTABLE 0x00000002
+#define COPY_FILE_OPEN_SOURCE_FOR_WRITE 0x00000004
+
+/* GetTempFileName() Flags */
+#define TF_FORCEDRIVE 0x80
+
+#define DRIVE_CANNOTDETERMINE 0
+#define DRIVE_DOESNOTEXIST 1
+#define DRIVE_REMOVABLE 2
+#define DRIVE_FIXED 3
+#define DRIVE_REMOTE 4
+/* Win32 additions */
+#define DRIVE_CDROM 5
+#define DRIVE_RAMDISK 6
+
+/* The security attributes structure */
+typedef struct _SECURITY_ATTRIBUTES
+{
+ DWORD nLength;
+ LPVOID lpSecurityDescriptor;
+ WIN_BOOL bInheritHandle;
+} SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
+
+#ifndef _FILETIME_
+#define _FILETIME_
+/* 64 bit number of 100 nanoseconds intervals since January 1, 1601 */
+typedef struct
+{
+ DWORD dwLowDateTime;
+ DWORD dwHighDateTime;
+} FILETIME, *LPFILETIME;
+#endif /* _FILETIME_ */
+
+/* Find* structures */
+typedef struct
+{
+ DWORD dwFileAttributes;
+ FILETIME ftCreationTime;
+ FILETIME ftLastAccessTime;
+ FILETIME ftLastWriteTime;
+ DWORD nFileSizeHigh;
+ DWORD nFileSizeLow;
+ DWORD dwReserved0;
+ DWORD dwReserved1;
+ CHAR cFileName[260];
+ CHAR cAlternateFileName[14];
+} WIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
+
+typedef struct
+{
+ DWORD dwFileAttributes;
+ FILETIME ftCreationTime;
+ FILETIME ftLastAccessTime;
+ FILETIME ftLastWriteTime;
+ DWORD nFileSizeHigh;
+ DWORD nFileSizeLow;
+ DWORD dwReserved0;
+ DWORD dwReserved1;
+ WCHAR cFileName[260];
+ WCHAR cAlternateFileName[14];
+} WIN32_FIND_DATAW, *LPWIN32_FIND_DATAW;
+
+DECL_WINELIB_TYPE_AW(WIN32_FIND_DATA)
+DECL_WINELIB_TYPE_AW(LPWIN32_FIND_DATA)
+
+typedef struct
+{
+ LPVOID lpData;
+ DWORD cbData;
+ BYTE cbOverhead;
+ BYTE iRegionIndex;
+ WORD wFlags;
+ union {
+ struct {
+ HANDLE hMem;
+ DWORD dwReserved[3];
+ } Block;
+ struct {
+ DWORD dwCommittedSize;
+ DWORD dwUnCommittedSize;
+ LPVOID lpFirstBlock;
+ LPVOID lpLastBlock;
+ } Region;
+ } Foo;
+} PROCESS_HEAP_ENTRY, *LPPROCESS_HEAP_ENTRY;
+
+#define PROCESS_HEAP_REGION 0x0001
+#define PROCESS_HEAP_UNCOMMITTED_RANGE 0x0002
+#define PROCESS_HEAP_ENTRY_BUSY 0x0004
+#define PROCESS_HEAP_ENTRY_MOVEABLE 0x0010
+#define PROCESS_HEAP_ENTRY_DDESHARE 0x0020
+
+#define INVALID_HANDLE_VALUE16 ((HANDLE16) -1)
+#define INVALID_HANDLE_VALUE ((HANDLE) -1)
+
+#define TLS_OUT_OF_INDEXES ((DWORD)0xFFFFFFFF)
+
+/* comm */
+
+#define CBR_110 0xFF10
+#define CBR_300 0xFF11
+#define CBR_600 0xFF12
+#define CBR_1200 0xFF13
+#define CBR_2400 0xFF14
+#define CBR_4800 0xFF15
+#define CBR_9600 0xFF16
+#define CBR_14400 0xFF17
+#define CBR_19200 0xFF18
+#define CBR_38400 0xFF1B
+#define CBR_56000 0xFF1F
+#define CBR_128000 0xFF23
+#define CBR_256000 0xFF27
+
+#define NOPARITY 0
+#define ODDPARITY 1
+#define EVENPARITY 2
+#define MARKPARITY 3
+#define SPACEPARITY 4
+#define ONESTOPBIT 0
+#define ONE5STOPBITS 1
+#define TWOSTOPBITS 2
+
+#define IGNORE 0
+#define INFINITE16 0xFFFF
+#define INFINITE 0xFFFFFFFF
+
+#define CE_RXOVER 0x0001
+#define CE_OVERRUN 0x0002
+#define CE_RXPARITY 0x0004
+#define CE_FRAME 0x0008
+#define CE_BREAK 0x0010
+#define CE_CTSTO 0x0020
+#define CE_DSRTO 0x0040
+#define CE_RLSDTO 0x0080
+#define CE_TXFULL 0x0100
+#define CE_PTO 0x0200
+#define CE_IOE 0x0400
+#define CE_DNS 0x0800
+#define CE_OOP 0x1000
+#define CE_MODE 0x8000
+
+#define IE_BADID -1
+#define IE_OPEN -2
+#define IE_NOPEN -3
+#define IE_MEMORY -4
+#define IE_DEFAULT -5
+#define IE_HARDWARE -10
+#define IE_BYTESIZE -11
+#define IE_BAUDRATE -12
+
+#define EV_RXCHAR 0x0001
+#define EV_RXFLAG 0x0002
+#define EV_TXEMPTY 0x0004
+#define EV_CTS 0x0008
+#define EV_DSR 0x0010
+#define EV_RLSD 0x0020
+#define EV_BREAK 0x0040
+#define EV_ERR 0x0080
+#define EV_RING 0x0100
+#define EV_PERR 0x0200
+#define EV_CTSS 0x0400
+#define EV_DSRS 0x0800
+#define EV_RLSDS 0x1000
+#define EV_RINGTE 0x2000
+#define EV_RingTe EV_RINGTE
+
+#define SETXOFF 1
+#define SETXON 2
+#define SETRTS 3
+#define CLRRTS 4
+#define SETDTR 5
+#define CLRDTR 6
+#define RESETDEV 7
+#define SETBREAK 8
+#define CLRBREAK 9
+
+#define GETBASEIRQ 10
+
+/* Purge functions for Comm Port */
+#define PURGE_TXABORT 0x0001 /* Kill the pending/current writes to the
+ comm port */
+#define PURGE_RXABORT 0x0002 /*Kill the pending/current reads to
+ the comm port */
+#define PURGE_TXCLEAR 0x0004 /* Kill the transmit queue if there*/
+#define PURGE_RXCLEAR 0x0008 /* Kill the typeahead buffer if there*/
+
+
+/* Modem Status Flags */
+#define MS_CTS_ON ((DWORD)0x0010)
+#define MS_DSR_ON ((DWORD)0x0020)
+#define MS_RING_ON ((DWORD)0x0040)
+#define MS_RLSD_ON ((DWORD)0x0080)
+
+#define RTS_CONTROL_DISABLE 0
+#define RTS_CONTROL_ENABLE 1
+#define RTS_CONTROL_HANDSHAKE 2
+#define RTS_CONTROL_TOGGLE 3
+
+#define DTR_CONTROL_DISABLE 0
+#define DTR_CONTROL_ENABLE 1
+#define DTR_CONTROL_HANDSHAKE 2
+
+#define CSTF_CTSHOLD 0x01
+#define CSTF_DSRHOLD 0x02
+#define CSTF_RLSDHOLD 0x04
+#define CSTF_XOFFHOLD 0x08
+#define CSTF_XOFFSENT 0x10
+#define CSTF_EOF 0x20
+#define CSTF_TXIM 0x40
+
+#define MAKEINTRESOURCEA(i) (LPSTR)((DWORD)((WORD)(i)))
+#define MAKEINTRESOURCEW(i) (LPWSTR)((DWORD)((WORD)(i)))
+#define MAKEINTRESOURCE WINELIB_NAME_AW(MAKEINTRESOURCE)
+
+/* Predefined resource types */
+#define RT_CURSORA MAKEINTRESOURCEA(1)
+#define RT_CURSORW MAKEINTRESOURCEW(1)
+#define RT_CURSOR WINELIB_NAME_AW(RT_CURSOR)
+#define RT_BITMAPA MAKEINTRESOURCEA(2)
+#define RT_BITMAPW MAKEINTRESOURCEW(2)
+#define RT_BITMAP WINELIB_NAME_AW(RT_BITMAP)
+#define RT_ICONA MAKEINTRESOURCEA(3)
+#define RT_ICONW MAKEINTRESOURCEW(3)
+#define RT_ICON WINELIB_NAME_AW(RT_ICON)
+#define RT_MENUA MAKEINTRESOURCEA(4)
+#define RT_MENUW MAKEINTRESOURCEW(4)
+#define RT_MENU WINELIB_NAME_AW(RT_MENU)
+#define RT_DIALOGA MAKEINTRESOURCEA(5)
+#define RT_DIALOGW MAKEINTRESOURCEW(5)
+#define RT_DIALOG WINELIB_NAME_AW(RT_DIALOG)
+#define RT_STRINGA MAKEINTRESOURCEA(6)
+#define RT_STRINGW MAKEINTRESOURCEW(6)
+#define RT_STRING WINELIB_NAME_AW(RT_STRING)
+#define RT_FONTDIRA MAKEINTRESOURCEA(7)
+#define RT_FONTDIRW MAKEINTRESOURCEW(7)
+#define RT_FONTDIR WINELIB_NAME_AW(RT_FONTDIR)
+#define RT_FONTA MAKEINTRESOURCEA(8)
+#define RT_FONTW MAKEINTRESOURCEW(8)
+#define RT_FONT WINELIB_NAME_AW(RT_FONT)
+#define RT_ACCELERATORA MAKEINTRESOURCEA(9)
+#define RT_ACCELERATORW MAKEINTRESOURCEW(9)
+#define RT_ACCELERATOR WINELIB_NAME_AW(RT_ACCELERATOR)
+#define RT_RCDATAA MAKEINTRESOURCEA(10)
+#define RT_RCDATAW MAKEINTRESOURCEW(10)
+#define RT_RCDATA WINELIB_NAME_AW(RT_RCDATA)
+#define RT_MESSAGELISTA MAKEINTRESOURCEA(11)
+#define RT_MESSAGELISTW MAKEINTRESOURCEW(11)
+#define RT_MESSAGELIST WINELIB_NAME_AW(RT_MESSAGELIST)
+#define RT_GROUP_CURSORA MAKEINTRESOURCEA(12)
+#define RT_GROUP_CURSORW MAKEINTRESOURCEW(12)
+#define RT_GROUP_CURSOR WINELIB_NAME_AW(RT_GROUP_CURSOR)
+#define RT_GROUP_ICONA MAKEINTRESOURCEA(14)
+#define RT_GROUP_ICONW MAKEINTRESOURCEW(14)
+#define RT_GROUP_ICON WINELIB_NAME_AW(RT_GROUP_ICON)
+
+
+#define LMEM_FIXED 0
+#define LMEM_MOVEABLE 0x0002
+#define LMEM_NOCOMPACT 0x0010
+#define LMEM_NODISCARD 0x0020
+#define LMEM_ZEROINIT 0x0040
+#define LMEM_MODIFY 0x0080
+#define LMEM_DISCARDABLE 0x0F00
+#define LMEM_DISCARDED 0x4000
+#define LMEM_LOCKCOUNT 0x00FF
+
+#define LPTR (LMEM_FIXED | LMEM_ZEROINIT)
+
+#define GMEM_FIXED 0x0000
+#define GMEM_MOVEABLE 0x0002
+#define GMEM_NOCOMPACT 0x0010
+#define GMEM_NODISCARD 0x0020
+#define GMEM_ZEROINIT 0x0040
+#define GMEM_MODIFY 0x0080
+#define GMEM_DISCARDABLE 0x0100
+#define GMEM_NOT_BANKED 0x1000
+#define GMEM_SHARE 0x2000
+#define GMEM_DDESHARE 0x2000
+#define GMEM_NOTIFY 0x4000
+#define GMEM_LOWER GMEM_NOT_BANKED
+#define GMEM_DISCARDED 0x4000
+#define GMEM_LOCKCOUNT 0x00ff
+#define GMEM_INVALID_HANDLE 0x8000
+
+#define GHND (GMEM_MOVEABLE | GMEM_ZEROINIT)
+#define GPTR (GMEM_FIXED | GMEM_ZEROINIT)
+
+
+typedef struct tagMEMORYSTATUS
+{
+ DWORD dwLength;
+ DWORD dwMemoryLoad;
+ DWORD dwTotalPhys;
+ DWORD dwAvailPhys;
+ DWORD dwTotalPageFile;
+ DWORD dwAvailPageFile;
+ DWORD dwTotalVirtual;
+ DWORD dwAvailVirtual;
+} MEMORYSTATUS, *LPMEMORYSTATUS;
+
+
+#ifndef NOLOGERROR
+
+/* LogParamError and LogError values */
+
+/* Error modifier bits */
+#define ERR_WARNING 0x8000
+#define ERR_PARAM 0x4000
+
+#define ERR_SIZE_MASK 0x3000
+#define ERR_BYTE 0x1000
+#define ERR_WORD 0x2000
+#define ERR_DWORD 0x3000
+
+/* LogParamError() values */
+
+/* Generic parameter values */
+#define ERR_BAD_VALUE 0x6001
+#define ERR_BAD_FLAGS 0x6002
+#define ERR_BAD_INDEX 0x6003
+#define ERR_BAD_DVALUE 0x7004
+#define ERR_BAD_DFLAGS 0x7005
+#define ERR_BAD_DINDEX 0x7006
+#define ERR_BAD_PTR 0x7007
+#define ERR_BAD_FUNC_PTR 0x7008
+#define ERR_BAD_SELECTOR 0x6009
+#define ERR_BAD_STRING_PTR 0x700a
+#define ERR_BAD_HANDLE 0x600b
+
+/* KERNEL parameter errors */
+#define ERR_BAD_HINSTANCE 0x6020
+#define ERR_BAD_HMODULE 0x6021
+#define ERR_BAD_GLOBAL_HANDLE 0x6022
+#define ERR_BAD_LOCAL_HANDLE 0x6023
+#define ERR_BAD_ATOM 0x6024
+#define ERR_BAD_HFILE 0x6025
+
+/* USER parameter errors */
+#define ERR_BAD_HWND 0x6040
+#define ERR_BAD_HMENU 0x6041
+#define ERR_BAD_HCURSOR 0x6042
+#define ERR_BAD_HICON 0x6043
+#define ERR_BAD_HDWP 0x6044
+#define ERR_BAD_CID 0x6045
+#define ERR_BAD_HDRVR 0x6046
+
+/* GDI parameter errors */
+#define ERR_BAD_COORDS 0x7060
+#define ERR_BAD_GDI_OBJECT 0x6061
+#define ERR_BAD_HDC 0x6062
+#define ERR_BAD_HPEN 0x6063
+#define ERR_BAD_HFONT 0x6064
+#define ERR_BAD_HBRUSH 0x6065
+#define ERR_BAD_HBITMAP 0x6066
+#define ERR_BAD_HRGN 0x6067
+#define ERR_BAD_HPALETTE 0x6068
+#define ERR_BAD_HMETAFILE 0x6069
+
+
+/* LogError() values */
+
+/* KERNEL errors */
+#define ERR_GALLOC 0x0001
+#define ERR_GREALLOC 0x0002
+#define ERR_GLOCK 0x0003
+#define ERR_LALLOC 0x0004
+#define ERR_LREALLOC 0x0005
+#define ERR_LLOCK 0x0006
+#define ERR_ALLOCRES 0x0007
+#define ERR_LOCKRES 0x0008
+#define ERR_LOADMODULE 0x0009
+
+/* USER errors */
+#define ERR_CREATEDLG 0x0040
+#define ERR_CREATEDLG2 0x0041
+#define ERR_REGISTERCLASS 0x0042
+#define ERR_DCBUSY 0x0043
+#define ERR_CREATEWND 0x0044
+#define ERR_STRUCEXTRA 0x0045
+#define ERR_LOADSTR 0x0046
+#define ERR_LOADMENU 0x0047
+#define ERR_NESTEDBEGINPAINT 0x0048
+#define ERR_BADINDEX 0x0049
+#define ERR_CREATEMENU 0x004a
+
+/* GDI errors */
+#define ERR_CREATEDC 0x0080
+#define ERR_CREATEMETA 0x0081
+#define ERR_DELOBJSELECTED 0x0082
+#define ERR_SELBITMAP 0x0083
+
+
+
+/* Debugging support (DEBUG SYSTEM ONLY) */
+typedef struct
+{
+ UINT16 flags;
+ DWORD dwOptions WINE_PACKED;
+ DWORD dwFilter WINE_PACKED;
+ CHAR achAllocModule[8] WINE_PACKED;
+ DWORD dwAllocBreak WINE_PACKED;
+ DWORD dwAllocCount WINE_PACKED;
+} WINDEBUGINFO, *LPWINDEBUGINFO;
+
+/* WINDEBUGINFO flags values */
+#define WDI_OPTIONS 0x0001
+#define WDI_FILTER 0x0002
+#define WDI_ALLOCBREAK 0x0004
+
+/* dwOptions values */
+#define DBO_CHECKHEAP 0x0001
+#define DBO_BUFFERFILL 0x0004
+#define DBO_DISABLEGPTRAPPING 0x0010
+#define DBO_CHECKFREE 0x0020
+
+#define DBO_SILENT 0x8000
+
+#define DBO_TRACEBREAK 0x2000
+#define DBO_WARNINGBREAK 0x1000
+#define DBO_NOERRORBREAK 0x0800
+#define DBO_NOFATALBREAK 0x0400
+#define DBO_INT3BREAK 0x0100
+
+/* DebugOutput flags values */
+#define DBF_TRACE 0x0000
+#define DBF_WARNING 0x4000
+#define DBF_ERROR 0x8000
+#define DBF_FATAL 0xc000
+
+/* dwFilter values */
+#define DBF_KERNEL 0x1000
+#define DBF_KRN_MEMMAN 0x0001
+#define DBF_KRN_LOADMODULE 0x0002
+#define DBF_KRN_SEGMENTLOAD 0x0004
+#define DBF_USER 0x0800
+#define DBF_GDI 0x0400
+#define DBF_MMSYSTEM 0x0040
+#define DBF_PENWIN 0x0020
+#define DBF_APPLICATION 0x0008
+#define DBF_DRIVER 0x0010
+
+#endif /* NOLOGERROR */
+
+typedef struct {
+ WORD wYear;
+ WORD wMonth;
+ WORD wDayOfWeek;
+ WORD wDay;
+ WORD wHour;
+ WORD wMinute;
+ WORD wSecond;
+ WORD wMilliseconds;
+} SYSTEMTIME, *LPSYSTEMTIME;
+
+/* The 'overlapped' data structure used by async I/O functions.
+ */
+typedef struct {
+ DWORD Internal;
+ DWORD InternalHigh;
+ DWORD Offset;
+ DWORD OffsetHigh;
+ HANDLE hEvent;
+} OVERLAPPED, *LPOVERLAPPED;
+
+/* Process startup information.
+ */
+
+/* STARTUPINFO.dwFlags */
+#define STARTF_USESHOWWINDOW 0x00000001
+#define STARTF_USESIZE 0x00000002
+#define STARTF_USEPOSITION 0x00000004
+#define STARTF_USECOUNTCHARS 0x00000008
+#define STARTF_USEFILLATTRIBUTE 0x00000010
+#define STARTF_RUNFULLSCREEN 0x00000020
+#define STARTF_FORCEONFEEDBACK 0x00000040
+#define STARTF_FORCEOFFFEEDBACK 0x00000080
+#define STARTF_USESTDHANDLES 0x00000100
+#define STARTF_USEHOTKEY 0x00000200
+
+typedef struct {
+ DWORD cb; /* 00: size of struct */
+ LPSTR lpReserved; /* 04: */
+ LPSTR lpDesktop; /* 08: */
+ LPSTR lpTitle; /* 0c: */
+ DWORD dwX; /* 10: */
+ DWORD dwY; /* 14: */
+ DWORD dwXSize; /* 18: */
+ DWORD dwYSize; /* 1c: */
+ DWORD dwXCountChars; /* 20: */
+ DWORD dwYCountChars; /* 24: */
+ DWORD dwFillAttribute; /* 28: */
+ DWORD dwFlags; /* 2c: */
+ WORD wShowWindow; /* 30: */
+ WORD cbReserved2; /* 32: */
+ BYTE *lpReserved2; /* 34: */
+ HANDLE hStdInput; /* 38: */
+ HANDLE hStdOutput; /* 3c: */
+ HANDLE hStdError; /* 40: */
+} STARTUPINFOA, *LPSTARTUPINFOA;
+
+typedef struct {
+ DWORD cb;
+ LPWSTR lpReserved;
+ LPWSTR lpDesktop;
+ LPWSTR lpTitle;
+ DWORD dwX;
+ DWORD dwY;
+ DWORD dwXSize;
+ DWORD dwYSize;
+ DWORD dwXCountChars;
+ DWORD dwYCountChars;
+ DWORD dwFillAttribute;
+ DWORD dwFlags;
+ WORD wShowWindow;
+ WORD cbReserved2;
+ BYTE *lpReserved2;
+ HANDLE hStdInput;
+ HANDLE hStdOutput;
+ HANDLE hStdError;
+} STARTUPINFOW, *LPSTARTUPINFOW;
+
+DECL_WINELIB_TYPE_AW(STARTUPINFO)
+DECL_WINELIB_TYPE_AW(LPSTARTUPINFO)
+
+typedef struct {
+ HANDLE hProcess;
+ HANDLE hThread;
+ DWORD dwProcessId;
+ DWORD dwThreadId;
+} PROCESS_INFORMATION,*LPPROCESS_INFORMATION;
+
+typedef struct {
+ LONG Bias;
+ WCHAR StandardName[32];
+ SYSTEMTIME StandardDate;
+ LONG StandardBias;
+ WCHAR DaylightName[32];
+ SYSTEMTIME DaylightDate;
+ LONG DaylightBias;
+} TIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;
+
+#define TIME_ZONE_ID_UNKNOWN 0
+#define TIME_ZONE_ID_STANDARD 1
+#define TIME_ZONE_ID_DAYLIGHT 2
+
+/* CreateProcess: dwCreationFlag values
+ */
+#define DEBUG_PROCESS 0x00000001
+#define DEBUG_ONLY_THIS_PROCESS 0x00000002
+#define CREATE_SUSPENDED 0x00000004
+#define DETACHED_PROCESS 0x00000008
+#define CREATE_NEW_CONSOLE 0x00000010
+#define NORMAL_PRIORITY_CLASS 0x00000020
+#define IDLE_PRIORITY_CLASS 0x00000040
+#define HIGH_PRIORITY_CLASS 0x00000080
+#define REALTIME_PRIORITY_CLASS 0x00000100
+#define CREATE_NEW_PROCESS_GROUP 0x00000200
+#define CREATE_UNICODE_ENVIRONMENT 0x00000400
+#define CREATE_SEPARATE_WOW_VDM 0x00000800
+#define CREATE_SHARED_WOW_VDM 0x00001000
+#define CREATE_DEFAULT_ERROR_MODE 0x04000000
+#define CREATE_NO_WINDOW 0x08000000
+#define PROFILE_USER 0x10000000
+#define PROFILE_KERNEL 0x20000000
+#define PROFILE_SERVER 0x40000000
+
+
+/* File object type definitions
+ */
+#define FILE_TYPE_UNKNOWN 0
+#define FILE_TYPE_DISK 1
+#define FILE_TYPE_CHAR 2
+#define FILE_TYPE_PIPE 3
+#define FILE_TYPE_REMOTE 32768
+
+/* File creation flags
+ */
+#define FILE_FLAG_WRITE_THROUGH 0x80000000UL
+#define FILE_FLAG_OVERLAPPED 0x40000000L
+#define FILE_FLAG_NO_BUFFERING 0x20000000L
+#define FILE_FLAG_RANDOM_ACCESS 0x10000000L
+#define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000L
+#define FILE_FLAG_DELETE_ON_CLOSE 0x04000000L
+#define FILE_FLAG_BACKUP_SEMANTICS 0x02000000L
+#define FILE_FLAG_POSIX_SEMANTICS 0x01000000L
+#define CREATE_NEW 1
+#define CREATE_ALWAYS 2
+#define OPEN_EXISTING 3
+#define OPEN_ALWAYS 4
+#define TRUNCATE_EXISTING 5
+
+/* Standard handle identifiers
+ */
+#define STD_INPUT_HANDLE ((DWORD) -10)
+#define STD_OUTPUT_HANDLE ((DWORD) -11)
+#define STD_ERROR_HANDLE ((DWORD) -12)
+
+typedef struct
+{
+ int dwFileAttributes;
+ FILETIME ftCreationTime;
+ FILETIME ftLastAccessTime;
+ FILETIME ftLastWriteTime;
+ int dwVolumeSerialNumber;
+ int nFileSizeHigh;
+ int nFileSizeLow;
+ int nNumberOfLinks;
+ int nFileIndexHigh;
+ int nFileIndexLow;
+} BY_HANDLE_FILE_INFORMATION ;
+
+
+typedef struct _SYSTEM_POWER_STATUS
+{
+ WIN_BOOL16 ACLineStatus;
+ BYTE BatteryFlag;
+ BYTE BatteryLifePercent;
+ BYTE reserved;
+ DWORD BatteryLifeTime;
+ DWORD BatteryFullLifeTime;
+} SYSTEM_POWER_STATUS, *LPSYSTEM_POWER_STATUS;
+
+typedef struct _MEMORY_BASIC_INFORMATION
+{
+ LPVOID BaseAddress;
+ LPVOID AllocationBase;
+ DWORD AllocationProtect;
+ DWORD RegionSize;
+ DWORD State;
+ DWORD Protect;
+ DWORD Type;
+} MEMORY_BASIC_INFORMATION,*LPMEMORY_BASIC_INFORMATION;
+
+
+typedef WIN_BOOL CALLBACK (*CODEPAGE_ENUMPROCA)(LPSTR);
+typedef WIN_BOOL CALLBACK (*CODEPAGE_ENUMPROCW)(LPWSTR);
+DECL_WINELIB_TYPE_AW(CODEPAGE_ENUMPROC)
+typedef WIN_BOOL CALLBACK (*LOCALE_ENUMPROCA)(LPSTR);
+typedef WIN_BOOL CALLBACK (*LOCALE_ENUMPROCW)(LPWSTR);
+DECL_WINELIB_TYPE_AW(LOCALE_ENUMPROC)
+
+typedef struct tagSYSTEM_INFO
+{
+ union {
+ DWORD dwOemId; /* Obsolete field - do not use */
+ struct {
+ WORD wProcessorArchitecture;
+ WORD wReserved;
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME;
+ DWORD dwPageSize;
+ LPVOID lpMinimumApplicationAddress;
+ LPVOID lpMaximumApplicationAddress;
+ DWORD dwActiveProcessorMask;
+ DWORD dwNumberOfProcessors;
+ DWORD dwProcessorType;
+ DWORD dwAllocationGranularity;
+ WORD wProcessorLevel;
+ WORD wProcessorRevision;
+} SYSTEM_INFO, *LPSYSTEM_INFO;
+
+/* {G,S}etPriorityClass */
+#define NORMAL_PRIORITY_CLASS 0x00000020
+#define IDLE_PRIORITY_CLASS 0x00000040
+#define HIGH_PRIORITY_CLASS 0x00000080
+#define REALTIME_PRIORITY_CLASS 0x00000100
+
+typedef WIN_BOOL CALLBACK (*ENUMRESTYPEPROCA)(HMODULE,LPSTR,LONG);
+typedef WIN_BOOL CALLBACK (*ENUMRESTYPEPROCW)(HMODULE,LPWSTR,LONG);
+typedef WIN_BOOL CALLBACK (*ENUMRESNAMEPROCA)(HMODULE,LPCSTR,LPSTR,LONG);
+typedef WIN_BOOL CALLBACK (*ENUMRESNAMEPROCW)(HMODULE,LPCWSTR,LPWSTR,LONG);
+typedef WIN_BOOL CALLBACK (*ENUMRESLANGPROCA)(HMODULE,LPCSTR,LPCSTR,WORD,LONG);
+typedef WIN_BOOL CALLBACK (*ENUMRESLANGPROCW)(HMODULE,LPCWSTR,LPCWSTR,WORD,LONG);
+
+DECL_WINELIB_TYPE_AW(ENUMRESTYPEPROC)
+DECL_WINELIB_TYPE_AW(ENUMRESNAMEPROC)
+DECL_WINELIB_TYPE_AW(ENUMRESLANGPROC)
+
+/* flags that can be passed to LoadLibraryEx */
+#define DONT_RESOLVE_DLL_REFERENCES 0x00000001
+#define LOAD_LIBRARY_AS_DATAFILE 0x00000002
+#define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008
+
+/* ifdef _x86_ ... */
+typedef struct _LDT_ENTRY {
+ WORD LimitLow;
+ WORD BaseLow;
+ union {
+ struct {
+ BYTE BaseMid;
+ BYTE Flags1;/*Declare as bytes to avoid alignment problems */
+ BYTE Flags2;
+ BYTE BaseHi;
+ } Bytes;
+ struct {
+ unsigned BaseMid : 8;
+ unsigned Type : 5;
+ unsigned Dpl : 2;
+ unsigned Pres : 1;
+ unsigned LimitHi : 4;
+ unsigned Sys : 1;
+ unsigned Reserved_0 : 1;
+ unsigned Default_Big : 1;
+ unsigned Granularity : 1;
+ unsigned BaseHi : 8;
+ } Bits;
+ } HighWord;
+} LDT_ENTRY, *LPLDT_ENTRY;
+
+
+typedef enum _GET_FILEEX_INFO_LEVELS {
+ GetFileExInfoStandard
+} GET_FILEEX_INFO_LEVELS;
+
+typedef struct _WIN32_FILE_ATTRIBUTES_DATA {
+ DWORD dwFileAttributes;
+ FILETIME ftCreationTime;
+ FILETIME ftLastAccessTime;
+ FILETIME ftLastWriteTime;
+ DWORD nFileSizeHigh;
+ DWORD nFileSizeLow;
+} WIN32_FILE_ATTRIBUTE_DATA, *LPWIN32_FILE_ATTRIBUTE_DATA;
+
+typedef struct _DllVersionInfo {
+ DWORD cbSize;
+ DWORD dwMajorVersion;
+ DWORD dwMinorVersion;
+ DWORD dwBuildNumber;
+ DWORD dwPlatformID;
+} DLLVERSIONINFO;
+
+/*
+ * This one seems to be a Win32 only definition. It also is defined with
+ * WINAPI instead of CALLBACK in the windows headers.
+ */
+typedef DWORD WINAPI (*LPPROGRESS_ROUTINE)(LARGE_INTEGER, LARGE_INTEGER, LARGE_INTEGER,
+ LARGE_INTEGER, DWORD, DWORD, HANDLE,
+ HANDLE, LPVOID);
+
+
+#define WAIT_FAILED 0xffffffff
+#define WAIT_OBJECT_0 0
+#define WAIT_ABANDONED STATUS_ABANDONED_WAIT_0
+#define WAIT_ABANDONED_0 STATUS_ABANDONED_WAIT_0
+#define WAIT_IO_COMPLETION STATUS_USER_APC
+#define WAIT_TIMEOUT STATUS_TIMEOUT
+#define STILL_ACTIVE STATUS_PENDING
+
+#define PAGE_NOACCESS 0x01
+#define PAGE_READONLY 0x02
+#define PAGE_READWRITE 0x04
+#define PAGE_WRITECOPY 0x08
+#define PAGE_EXECUTE 0x10
+#define PAGE_EXECUTE_READ 0x20
+#define PAGE_EXECUTE_READWRITE 0x40
+#define PAGE_EXECUTE_WRITECOPY 0x80
+#define PAGE_GUARD 0x100
+#define PAGE_NOCACHE 0x200
+
+#define MEM_COMMIT 0x00001000
+#define MEM_RESERVE 0x00002000
+#define MEM_DECOMMIT 0x00004000
+#define MEM_RELEASE 0x00008000
+#define MEM_FREE 0x00010000
+#define MEM_PRIVATE 0x00020000
+#define MEM_MAPPED 0x00040000
+#define MEM_TOP_DOWN 0x00100000
+#ifdef __WINE__
+#define MEM_SYSTEM 0x80000000
+#endif
+
+#define SEC_FILE 0x00800000
+#define SEC_IMAGE 0x01000000
+#define SEC_RESERVE 0x04000000
+#define SEC_COMMIT 0x08000000
+#define SEC_NOCACHE 0x10000000
+
+#define FILE_BEGIN 0
+#define FILE_CURRENT 1
+#define FILE_END 2
+
+#define FILE_CASE_SENSITIVE_SEARCH 0x00000001
+#define FILE_CASE_PRESERVED_NAMES 0x00000002
+#define FILE_UNICODE_ON_DISK 0x00000004
+#define FILE_PERSISTENT_ACLS 0x00000008
+
+#define FILE_MAP_COPY 0x00000001
+#define FILE_MAP_WRITE 0x00000002
+#define FILE_MAP_READ 0x00000004
+#define FILE_MAP_ALL_ACCESS 0x000f001f
+
+#define MOVEFILE_REPLACE_EXISTING 0x00000001
+#define MOVEFILE_COPY_ALLOWED 0x00000002
+#define MOVEFILE_DELAY_UNTIL_REBOOT 0x00000004
+
+#define FS_CASE_SENSITIVE FILE_CASE_SENSITIVE_SEARCH
+#define FS_CASE_IS_PRESERVED FILE_CASE_PRESERVED_NAMES
+#define FS_UNICODE_STORED_ON_DISK FILE_UNICODE_ON_DISK
+
+#define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION
+#define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT
+#define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT
+#define EXCEPTION_SINGLE_STEP STATUS_SINGLE_STEP
+#define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED
+#define EXCEPTION_FLT_DENORMAL_OPERAND STATUS_FLOAT_DENORMAL_OPERAND
+#define EXCEPTION_FLT_DIVIDE_BY_ZERO STATUS_FLOAT_DIVIDE_BY_ZERO
+#define EXCEPTION_FLT_INEXACT_RESULT STATUS_FLOAT_INEXACT_RESULT
+#define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION
+#define EXCEPTION_FLT_OVERFLOW STATUS_FLOAT_OVERFLOW
+#define EXCEPTION_FLT_STACK_CHECK STATUS_FLOAT_STACK_CHECK
+#define EXCEPTION_FLT_UNDERFLOW STATUS_FLOAT_UNDERFLOW
+#define EXCEPTION_INT_DIVIDE_BY_ZERO STATUS_INTEGER_DIVIDE_BY_ZERO
+#define EXCEPTION_INT_OVERFLOW STATUS_INTEGER_OVERFLOW
+#define EXCEPTION_PRIV_INSTRUCTION STATUS_PRIVILEGED_INSTRUCTION
+#define EXCEPTION_IN_PAGE_ERROR STATUS_IN_PAGE_ERROR
+#define EXCEPTION_ILLEGAL_INSTRUCTION STATUS_ILLEGAL_INSTRUCTION
+#define EXCEPTION_NONCONTINUABLE_EXCEPTION STATUS_NONCONTINUABLE_EXCEPTION
+#define EXCEPTION_STACK_OVERFLOW STATUS_STACK_OVERFLOW
+#define EXCEPTION_INVALID_DISPOSITION STATUS_INVALID_DISPOSITION
+#define EXCEPTION_GUARD_PAGE STATUS_GUARD_PAGE_VIOLATION
+#define EXCEPTION_INVALID_HANDLE STATUS_INVALID_HANDLE
+#define CONTROL_C_EXIT STATUS_CONTROL_C_EXIT
+
+/* Wine extension; Windows doesn't have a name for this code */
+#define EXCEPTION_CRITICAL_SECTION_WAIT 0xc0000194
+
+#define DUPLICATE_CLOSE_SOURCE 0x00000001
+#define DUPLICATE_SAME_ACCESS 0x00000002
+
+#define HANDLE_FLAG_INHERIT 0x00000001
+#define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x00000002
+
+#define HINSTANCE_ERROR 32
+
+#define THREAD_PRIORITY_LOWEST THREAD_BASE_PRIORITY_MIN
+#define THREAD_PRIORITY_BELOW_NORMAL (THREAD_PRIORITY_LOWEST+1)
+#define THREAD_PRIORITY_NORMAL 0
+#define THREAD_PRIORITY_HIGHEST THREAD_BASE_PRIORITY_MAX
+#define THREAD_PRIORITY_ABOVE_NORMAL (THREAD_PRIORITY_HIGHEST-1)
+#define THREAD_PRIORITY_ERROR_RETURN (0x7fffffff)
+#define THREAD_PRIORITY_TIME_CRITICAL THREAD_BASE_PRIORITY_LOWRT
+#define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE
+
+/* Could this type be considered opaque? */
+typedef struct {
+ LPVOID DebugInfo;
+ LONG LockCount;
+ LONG RecursionCount;
+ HANDLE OwningThread;
+ HANDLE LockSemaphore;
+ DWORD Reserved;
+}CRITICAL_SECTION;
+
+#ifdef __WINE__
+#define CRITICAL_SECTION_INIT { 0, -1, 0, 0, 0, 0 }
+#endif
+
+typedef struct {
+ DWORD dwOSVersionInfoSize;
+ DWORD dwMajorVersion;
+ DWORD dwMinorVersion;
+ DWORD dwBuildNumber;
+ DWORD dwPlatformId;
+ CHAR szCSDVersion[128];
+} OSVERSIONINFO16;
+
+typedef struct {
+ DWORD dwOSVersionInfoSize;
+ DWORD dwMajorVersion;
+ DWORD dwMinorVersion;
+ DWORD dwBuildNumber;
+ DWORD dwPlatformId;
+ CHAR szCSDVersion[128];
+} OSVERSIONINFOA;
+
+typedef struct {
+ DWORD dwOSVersionInfoSize;
+ DWORD dwMajorVersion;
+ DWORD dwMinorVersion;
+ DWORD dwBuildNumber;
+ DWORD dwPlatformId;
+ WCHAR szCSDVersion[128];
+} OSVERSIONINFOW;
+
+DECL_WINELIB_TYPE_AW(OSVERSIONINFO)
+
+#define VER_PLATFORM_WIN32s 0
+#define VER_PLATFORM_WIN32_WINDOWS 1
+#define VER_PLATFORM_WIN32_NT 2
+
+typedef struct tagCOMSTAT
+{
+ DWORD status;
+ DWORD cbInQue;
+ DWORD cbOutQue;
+} COMSTAT,*LPCOMSTAT;
+
+typedef struct tagDCB
+{
+ DWORD DCBlength;
+ DWORD BaudRate;
+ unsigned fBinary :1;
+ unsigned fParity :1;
+ unsigned fOutxCtsFlow :1;
+ unsigned fOutxDsrFlow :1;
+ unsigned fDtrControl :2;
+ unsigned fDsrSensitivity :1;
+ unsigned fTXContinueOnXoff :1;
+ unsigned fOutX :1;
+ unsigned fInX :1;
+ unsigned fErrorChar :1;
+ unsigned fNull :1;
+ unsigned fRtsControl :2;
+ unsigned fAbortOnError :1;
+ unsigned fDummy2 :17;
+ WORD wReserved;
+ WORD XonLim;
+ WORD XoffLim;
+ BYTE ByteSize;
+ BYTE Parity;
+ BYTE StopBits;
+ char XonChar;
+ char XoffChar;
+ char ErrorChar;
+ char EofChar;
+ char EvtChar;
+} DCB, *LPDCB;
+
+
+
+typedef struct tagCOMMTIMEOUTS {
+ DWORD ReadIntervalTimeout;
+ DWORD ReadTotalTimeoutMultiplier;
+ DWORD ReadTotalTimeoutConstant;
+ DWORD WriteTotalTimeoutMultiplier;
+ DWORD WriteTotalTimeoutConstant;
+} COMMTIMEOUTS,*LPCOMMTIMEOUTS;
+
+#include "poppack.h"
+
+typedef void CALLBACK (*PAPCFUNC)(ULONG_PTR);
+typedef void CALLBACK (*PTIMERAPCROUTINE)(LPVOID,DWORD,DWORD);
+
+WIN_BOOL WINAPI ClearCommError(INT,LPDWORD,LPCOMSTAT);
+WIN_BOOL WINAPI BuildCommDCBA(LPCSTR,LPDCB);
+WIN_BOOL WINAPI BuildCommDCBW(LPCWSTR,LPDCB);
+#define BuildCommDCB WINELIB_NAME_AW(BuildCommDCB)
+WIN_BOOL WINAPI BuildCommDCBAndTimeoutsA(LPCSTR,LPDCB,LPCOMMTIMEOUTS);
+WIN_BOOL WINAPI BuildCommDCBAndTimeoutsW(LPCWSTR,LPDCB,LPCOMMTIMEOUTS);
+#define BuildCommDCBAndTimeouts WINELIB_NAME_AW(BuildCommDCBAndTimeouts)
+WIN_BOOL WINAPI GetCommTimeouts(HANDLE,LPCOMMTIMEOUTS);
+WIN_BOOL WINAPI SetCommTimeouts(HANDLE,LPCOMMTIMEOUTS);
+WIN_BOOL WINAPI GetCommState(INT,LPDCB);
+WIN_BOOL WINAPI SetCommState(INT,LPDCB);
+WIN_BOOL WINAPI TransmitCommChar(INT,CHAR);
+WIN_BOOL WINAPI SetupComm(HANDLE, DWORD, DWORD);
+WIN_BOOL WINAPI GetCommProperties(HANDLE, LPDCB *);
+
+/*DWORD WINAPI GetVersion( void );*/
+WIN_BOOL16 WINAPI GetVersionEx16(OSVERSIONINFO16*);
+WIN_BOOL WINAPI GetVersionExA(OSVERSIONINFOA*);
+WIN_BOOL WINAPI GetVersionExW(OSVERSIONINFOW*);
+#define GetVersionEx WINELIB_NAME_AW(GetVersionEx)
+
+/*int WinMain(HINSTANCE, HINSTANCE prev, char *cmd, int show);*/
+
+void WINAPI DeleteCriticalSection(CRITICAL_SECTION *lpCrit);
+void WINAPI EnterCriticalSection(CRITICAL_SECTION *lpCrit);
+WIN_BOOL WINAPI TryEnterCriticalSection(CRITICAL_SECTION *lpCrit);
+void WINAPI InitializeCriticalSection(CRITICAL_SECTION *lpCrit);
+void WINAPI LeaveCriticalSection(CRITICAL_SECTION *lpCrit);
+void WINAPI MakeCriticalSectionGlobal(CRITICAL_SECTION *lpCrit);
+WIN_BOOL WINAPI GetProcessWorkingSetSize(HANDLE,LPDWORD,LPDWORD);
+DWORD WINAPI QueueUserAPC(PAPCFUNC,HANDLE,ULONG_PTR);
+void WINAPI RaiseException(DWORD,DWORD,DWORD,const LPDWORD);
+WIN_BOOL WINAPI SetProcessWorkingSetSize(HANDLE,DWORD,DWORD);
+WIN_BOOL WINAPI TerminateProcess(HANDLE,DWORD);
+WIN_BOOL WINAPI TerminateThread(HANDLE,DWORD);
+WIN_BOOL WINAPI GetExitCodeThread(HANDLE,LPDWORD);
+
+/* GetBinaryType return values.
+ */
+
+#define SCS_32BIT_BINARY 0
+#define SCS_DOS_BINARY 1
+#define SCS_WOW_BINARY 2
+#define SCS_PIF_BINARY 3
+#define SCS_POSIX_BINARY 4
+#define SCS_OS216_BINARY 5
+
+WIN_BOOL WINAPI GetBinaryTypeA( LPCSTR lpApplicationName, LPDWORD lpBinaryType );
+WIN_BOOL WINAPI GetBinaryTypeW( LPCWSTR lpApplicationName, LPDWORD lpBinaryType );
+#define GetBinaryType WINELIB_NAME_AW(GetBinaryType)
+
+WIN_BOOL16 WINAPI GetWinDebugInfo16(LPWINDEBUGINFO,UINT16);
+WIN_BOOL16 WINAPI SetWinDebugInfo16(LPWINDEBUGINFO);
+/* Declarations for functions that exist only in Win32 */
+
+
+WIN_BOOL WINAPI AttachThreadInput(DWORD,DWORD,WIN_BOOL);
+WIN_BOOL WINAPI AccessCheck(PSECURITY_DESCRIPTOR,HANDLE,DWORD,PGENERIC_MAPPING,PPRIVILEGE_SET,LPDWORD,LPDWORD,LPWIN_BOOL);
+WIN_BOOL WINAPI AdjustTokenPrivileges(HANDLE,WIN_BOOL,LPVOID,DWORD,LPVOID,LPDWORD);
+WIN_BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID *);
+WIN_BOOL WINAPI AllocateLocallyUniqueId(PLUID);
+WIN_BOOL WINAPI AllocConsole(void);
+WIN_BOOL WINAPI AreFileApisANSI(void);
+WIN_BOOL WINAPI BackupEventLogA(HANDLE,LPCSTR);
+WIN_BOOL WINAPI BackupEventLogW(HANDLE,LPCWSTR);
+#define BackupEventLog WINELIB_NAME_AW(BackupEventLog)
+WIN_BOOL WINAPI Beep(DWORD,DWORD);
+WIN_BOOL WINAPI CancelWaitableTimer(HANDLE);
+WIN_BOOL WINAPI ClearEventLogA(HANDLE,LPCSTR);
+WIN_BOOL WINAPI ClearEventLogW(HANDLE,LPCWSTR);
+#define ClearEventLog WINELIB_NAME_AW(ClearEventLog)
+WIN_BOOL WINAPI CloseEventLog(HANDLE);
+WIN_BOOL WINAPI CloseHandle(HANDLE);
+WIN_BOOL WINAPI ContinueDebugEvent(DWORD,DWORD,DWORD);
+HANDLE WINAPI ConvertToGlobalHandle(HANDLE hSrc);
+WIN_BOOL WINAPI CopyFileA(LPCSTR,LPCSTR,WIN_BOOL);
+WIN_BOOL WINAPI CopyFileW(LPCWSTR,LPCWSTR,WIN_BOOL);
+#define CopyFile WINELIB_NAME_AW(CopyFile)
+WIN_BOOL WINAPI CopyFileExA(LPCSTR, LPCSTR, LPPROGRESS_ROUTINE, LPVOID, LPWIN_BOOL, DWORD);
+WIN_BOOL WINAPI CopyFileExW(LPCWSTR, LPCWSTR, LPPROGRESS_ROUTINE, LPVOID, LPWIN_BOOL, DWORD);
+#define CopyFileEx WINELIB_NAME_AW(CopyFileEx)
+WIN_BOOL WINAPI CopySid(DWORD,PSID,PSID);
+INT WINAPI CompareFileTime(LPFILETIME,LPFILETIME);
+HANDLE WINAPI CreateEventA(LPSECURITY_ATTRIBUTES,WIN_BOOL,WIN_BOOL,LPCSTR);
+HANDLE WINAPI CreateEventW(LPSECURITY_ATTRIBUTES,WIN_BOOL,WIN_BOOL,LPCWSTR);
+#define CreateEvent WINELIB_NAME_AW(CreateEvent)
+HANDLE WINAPI CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,
+ DWORD,DWORD,HANDLE);
+HANDLE WINAPI CreateFileW(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,
+ DWORD,DWORD,HANDLE);
+#define CreateFile WINELIB_NAME_AW(CreateFile)
+HANDLE WINAPI CreateFileMappingA(HANDLE,LPSECURITY_ATTRIBUTES,DWORD,
+ DWORD,DWORD,LPCSTR);
+HANDLE WINAPI CreateFileMappingW(HANDLE,LPSECURITY_ATTRIBUTES,DWORD,
+ DWORD,DWORD,LPCWSTR);
+#define CreateFileMapping WINELIB_NAME_AW(CreateFileMapping)
+HANDLE WINAPI CreateMutexA(LPSECURITY_ATTRIBUTES,WIN_BOOL,LPCSTR);
+HANDLE WINAPI CreateMutexW(LPSECURITY_ATTRIBUTES,WIN_BOOL,LPCWSTR);
+#define CreateMutex WINELIB_NAME_AW(CreateMutex)
+WIN_BOOL WINAPI CreatePipe(PHANDLE,PHANDLE,LPSECURITY_ATTRIBUTES,DWORD);
+WIN_BOOL WINAPI CreateProcessA(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,
+ LPSECURITY_ATTRIBUTES,WIN_BOOL,DWORD,LPVOID,LPCSTR,
+ LPSTARTUPINFOA,LPPROCESS_INFORMATION);
+WIN_BOOL WINAPI CreateProcessW(LPCWSTR,LPWSTR,LPSECURITY_ATTRIBUTES,
+ LPSECURITY_ATTRIBUTES,WIN_BOOL,DWORD,LPVOID,LPCWSTR,
+ LPSTARTUPINFOW,LPPROCESS_INFORMATION);
+#define CreateProcess WINELIB_NAME_AW(CreateProcess)
+HANDLE WINAPI CreateSemaphoreA(LPSECURITY_ATTRIBUTES,LONG,LONG,LPCSTR);
+HANDLE WINAPI CreateSemaphoreW(LPSECURITY_ATTRIBUTES,LONG,LONG,LPCWSTR);
+#define CreateSemaphore WINELIB_NAME_AW(CreateSemaphore)
+HANDLE WINAPI CreateThread(LPSECURITY_ATTRIBUTES,DWORD,LPTHREAD_START_ROUTINE,LPVOID,DWORD,LPDWORD);
+HANDLE WINAPI CreateWaitableTimerA(LPSECURITY_ATTRIBUTES,WIN_BOOL,LPCSTR);
+HANDLE WINAPI CreateWaitableTimerW(LPSECURITY_ATTRIBUTES,WIN_BOOL,LPCWSTR);
+#define CreateWaitableTimer WINELIB_NAME_AW(CreateWaitableTimer)
+WIN_BOOL WINAPI DebugActiveProcess(DWORD);
+void WINAPI DebugBreak(void);
+WIN_BOOL WINAPI DeregisterEventSource(HANDLE);
+WIN_BOOL WINAPI DisableThreadLibraryCalls(HMODULE);
+WIN_BOOL WINAPI DosDateTimeToFileTime(WORD,WORD,LPFILETIME);
+WIN_BOOL WINAPI DuplicateHandle(HANDLE,HANDLE,HANDLE,HANDLE*,DWORD,WIN_BOOL,DWORD);
+WIN_BOOL WINAPI EnumDateFormatsA(DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags);
+WIN_BOOL WINAPI EnumDateFormatsW(DATEFMT_ENUMPROCW lpDateFmtEnumProc, LCID Locale, DWORD dwFlags);
+#define EnumDateFormats WINELIB_NAME_AW(EnumDateFormats)
+WIN_BOOL WINAPI EnumResourceLanguagesA(HMODULE,LPCSTR,LPCSTR,
+ ENUMRESLANGPROCA,LONG);
+WIN_BOOL WINAPI EnumResourceLanguagesW(HMODULE,LPCWSTR,LPCWSTR,
+ ENUMRESLANGPROCW,LONG);
+#define EnumResourceLanguages WINELIB_NAME_AW(EnumResourceLanguages)
+WIN_BOOL WINAPI EnumResourceNamesA(HMODULE,LPCSTR,ENUMRESNAMEPROCA,
+ LONG);
+WIN_BOOL WINAPI EnumResourceNamesW(HMODULE,LPCWSTR,ENUMRESNAMEPROCW,
+ LONG);
+#define EnumResourceNames WINELIB_NAME_AW(EnumResourceNames)
+WIN_BOOL WINAPI EnumResourceTypesA(HMODULE,ENUMRESTYPEPROCA,LONG);
+WIN_BOOL WINAPI EnumResourceTypesW(HMODULE,ENUMRESTYPEPROCW,LONG);
+#define EnumResourceTypes WINELIB_NAME_AW(EnumResourceTypes)
+WIN_BOOL WINAPI EnumSystemCodePagesA(CODEPAGE_ENUMPROCA,DWORD);
+WIN_BOOL WINAPI EnumSystemCodePagesW(CODEPAGE_ENUMPROCW,DWORD);
+#define EnumSystemCodePages WINELIB_NAME_AW(EnumSystemCodePages)
+WIN_BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA,DWORD);
+WIN_BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD);
+#define EnumSystemLocales WINELIB_NAME_AW(EnumSystemLocales)
+WIN_BOOL WINAPI EnumTimeFormatsA(TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags);
+WIN_BOOL WINAPI EnumTimeFormatsW(TIMEFMT_ENUMPROCW lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags);
+#define EnumTimeFormats WINELIB_NAME_AW(EnumTimeFormats)
+WIN_BOOL WINAPI EqualSid(PSID, PSID);
+WIN_BOOL WINAPI EqualPrefixSid(PSID,PSID);
+VOID WINAPI ExitProcess(DWORD) WINE_NORETURN;
+VOID WINAPI ExitThread(DWORD) WINE_NORETURN;
+DWORD WINAPI ExpandEnvironmentStringsA(LPCSTR,LPSTR,DWORD);
+DWORD WINAPI ExpandEnvironmentStringsW(LPCWSTR,LPWSTR,DWORD);
+#define ExpandEnvironmentStrings WINELIB_NAME_AW(ExpandEnvironmentStrings)
+WIN_BOOL WINAPI FileTimeToDosDateTime(const FILETIME*,LPWORD,LPWORD);
+WIN_BOOL WINAPI FileTimeToLocalFileTime(const FILETIME*,LPFILETIME);
+WIN_BOOL WINAPI FileTimeToSystemTime(const FILETIME*,LPSYSTEMTIME);
+HANDLE WINAPI FindFirstChangeNotificationA(LPCSTR,WIN_BOOL,DWORD);
+HANDLE WINAPI FindFirstChangeNotificationW(LPCWSTR,WIN_BOOL,DWORD);
+#define FindFirstChangeNotification WINELIB_NAME_AW(FindFirstChangeNotification)
+WIN_BOOL WINAPI FindNextChangeNotification(HANDLE);
+WIN_BOOL WINAPI FindCloseChangeNotification(HANDLE);
+HRSRC WINAPI FindResourceExA(HMODULE,LPCSTR,LPCSTR,WORD);
+HRSRC WINAPI FindResourceExW(HMODULE,LPCWSTR,LPCWSTR,WORD);
+#define FindResourceEx WINELIB_NAME_AW(FindResourceEx)
+WIN_BOOL WINAPI FlushConsoleInputBuffer(HANDLE);
+WIN_BOOL WINAPI FlushFileBuffers(HANDLE);
+WIN_BOOL WINAPI FlushViewOfFile(LPCVOID, DWORD);
+DWORD WINAPI FormatMessageA(DWORD,LPCVOID,DWORD,DWORD,LPSTR,
+ DWORD,LPDWORD);
+DWORD WINAPI FormatMessageW(DWORD,LPCVOID,DWORD,DWORD,LPWSTR,
+ DWORD,LPDWORD);
+#define FormatMessage WINELIB_NAME_AW(FormatMessage)
+WIN_BOOL WINAPI FreeConsole(void);
+WIN_BOOL WINAPI FreeEnvironmentStringsA(LPSTR);
+WIN_BOOL WINAPI FreeEnvironmentStringsW(LPWSTR);
+#define FreeEnvironmentStrings WINELIB_NAME_AW(FreeEnvironmentStrings)
+PVOID WINAPI FreeSid(PSID);
+UINT WINAPI GetACP(void);
+LPCSTR WINAPI GetCommandLineA(void);
+LPCWSTR WINAPI GetCommandLineW(void);
+#define GetCommandLine WINELIB_NAME_AW(GetCommandLine)
+WIN_BOOL WINAPI GetComputerNameA(LPSTR,LPDWORD);
+WIN_BOOL WINAPI GetComputerNameW(LPWSTR,LPDWORD);
+#define GetComputerName WINELIB_NAME_AW(GetComputerName)
+UINT WINAPI GetConsoleCP(void);
+WIN_BOOL WINAPI GetConsoleMode(HANDLE,LPDWORD);
+UINT WINAPI GetConsoleOutputCP(void);
+DWORD WINAPI GetConsoleTitleA(LPSTR,DWORD);
+DWORD WINAPI GetConsoleTitleW(LPWSTR,DWORD);
+#define GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
+WIN_BOOL WINAPI GetCommMask(HANDLE, LPDWORD);
+WIN_BOOL WINAPI GetCommModemStatus(HANDLE, LPDWORD);
+HANDLE WINAPI GetCurrentProcess(void);
+HANDLE WINAPI GetCurrentThread(void);
+INT WINAPI GetDateFormatA(LCID,DWORD,LPSYSTEMTIME,LPCSTR,LPSTR,INT);
+INT WINAPI GetDateFormatW(LCID,DWORD,LPSYSTEMTIME,LPCWSTR,LPWSTR,INT);
+#define GetDateFormat WINELIB_NAME_AW(GetDateFormat)
+LPSTR WINAPI GetEnvironmentStringsA(void);
+LPWSTR WINAPI GetEnvironmentStringsW(void);
+#define GetEnvironmentStrings WINELIB_NAME_AW(GetEnvironmentStrings)
+DWORD WINAPI GetEnvironmentVariableA(LPCSTR,LPSTR,DWORD);
+DWORD WINAPI GetEnvironmentVariableW(LPCWSTR,LPWSTR,DWORD);
+#define GetEnvironmentVariable WINELIB_NAME_AW(GetEnvironmentVariable)
+WIN_BOOL WINAPI GetFileAttributesExA(LPCSTR,GET_FILEEX_INFO_LEVELS,LPVOID);
+WIN_BOOL WINAPI GetFileAttributesExW(LPCWSTR,GET_FILEEX_INFO_LEVELS,LPVOID);
+#define GetFileattributesEx WINELIB_NAME_AW(GetFileAttributesEx)
+DWORD WINAPI GetFileInformationByHandle(HANDLE,BY_HANDLE_FILE_INFORMATION*);
+WIN_BOOL WINAPI GetFileSecurityA(LPCSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,DWORD,LPDWORD);
+WIN_BOOL WINAPI GetFileSecurityW(LPCWSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,DWORD,LPDWORD);
+#define GetFileSecurity WINELIB_NAME_AW(GetFileSecurity)
+DWORD WINAPI GetFileSize(HANDLE,LPDWORD);
+WIN_BOOL WINAPI GetFileTime(HANDLE,LPFILETIME,LPFILETIME,LPFILETIME);
+DWORD WINAPI GetFileType(HANDLE);
+DWORD WINAPI GetFullPathNameA(LPCSTR,DWORD,LPSTR,LPSTR*);
+DWORD WINAPI GetFullPathNameW(LPCWSTR,DWORD,LPWSTR,LPWSTR*);
+#define GetFullPathName WINELIB_NAME_AW(GetFullPathName)
+WIN_BOOL WINAPI GetHandleInformation(HANDLE,LPDWORD);
+COORD WINAPI GetLargestConsoleWindowSize(HANDLE);
+DWORD WINAPI GetLengthSid(PSID);
+VOID WINAPI GetLocalTime(LPSYSTEMTIME);
+DWORD WINAPI GetLogicalDrives(void);
+DWORD WINAPI GetLongPathNameA(LPCSTR,LPSTR,DWORD);
+DWORD WINAPI GetLongPathNameW(LPCWSTR,LPWSTR,DWORD);
+#define GetLongPathName WINELIB_NAME_AW(GetLongPathName)
+WIN_BOOL WINAPI GetNumberOfConsoleInputEvents(HANDLE,LPDWORD);
+WIN_BOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD);
+WIN_BOOL WINAPI GetNumberOfEventLogRecords(HANDLE,PDWORD);
+UINT WINAPI GetOEMCP(void);
+WIN_BOOL WINAPI GetOldestEventLogRecord(HANDLE,PDWORD);
+DWORD WINAPI GetPriorityClass(HANDLE);
+DWORD WINAPI GetProcessVersion(DWORD);
+WIN_BOOL WINAPI GetSecurityDescriptorControl(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR_CONTROL,LPDWORD);
+WIN_BOOL WINAPI GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR,LPWIN_BOOL,PACL *,LPWIN_BOOL);
+WIN_BOOL WINAPI GetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR,PSID *,LPWIN_BOOL);
+DWORD WINAPI GetSecurityDescriptorLength(PSECURITY_DESCRIPTOR);
+WIN_BOOL WINAPI GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR,PSID *,LPWIN_BOOL);
+WIN_BOOL WINAPI GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR,LPWIN_BOOL,PACL *,LPWIN_BOOL);
+PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority(PSID);
+DWORD WINAPI GetSidLengthRequired(BYTE);
+PDWORD WINAPI GetSidSubAuthority(PSID,DWORD);
+PUCHAR WINAPI GetSidSubAuthorityCount(PSID);
+DWORD WINAPI GetShortPathNameA(LPCSTR,LPSTR,DWORD);
+DWORD WINAPI GetShortPathNameW(LPCWSTR,LPWSTR,DWORD);
+#define GetShortPathName WINELIB_NAME_AW(GetShortPathName)
+HFILE WINAPI GetStdHandle(DWORD);
+WIN_BOOL WINAPI GetStringTypeExA(LCID,DWORD,LPCSTR,INT,LPWORD);
+WIN_BOOL WINAPI GetStringTypeExW(LCID,DWORD,LPCWSTR,INT,LPWORD);
+#define GetStringTypeEx WINELIB_NAME_AW(GetStringTypeEx)
+VOID WINAPI GetSystemInfo(LPSYSTEM_INFO);
+WIN_BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS);
+VOID WINAPI GetSystemTime(LPSYSTEMTIME);
+VOID WINAPI GetSystemTimeAsFileTime(LPFILETIME);
+INT WINAPI GetTimeFormatA(LCID,DWORD,LPSYSTEMTIME,LPCSTR,LPSTR,INT);
+INT WINAPI GetTimeFormatW(LCID,DWORD,LPSYSTEMTIME,LPCWSTR,LPWSTR,INT);
+#define GetTimeFormat WINELIB_NAME_AW(GetTimeFormat)
+WIN_BOOL WINAPI GetThreadContext(HANDLE,CONTEXT *);
+LCID WINAPI GetThreadLocale(void);
+INT WINAPI GetThreadPriority(HANDLE);
+WIN_BOOL WINAPI GetThreadSelectorEntry(HANDLE,DWORD,LPLDT_ENTRY);
+WIN_BOOL WINAPI GetThreadTimes(HANDLE,LPFILETIME,LPFILETIME,LPFILETIME,LPFILETIME);
+WIN_BOOL WINAPI GetTokenInformation(HANDLE,TOKEN_INFORMATION_CLASS,LPVOID,DWORD,LPDWORD);
+WIN_BOOL WINAPI GetUserNameA(LPSTR,LPDWORD);
+WIN_BOOL WINAPI GetUserNameW(LPWSTR,LPDWORD);
+#define GetUserName WINELIB_NAME_AW(GetUserName)
+VOID WINAPI GlobalMemoryStatus(LPMEMORYSTATUS);
+LPVOID WINAPI HeapAlloc(HANDLE,DWORD,DWORD);
+DWORD WINAPI HeapCompact(HANDLE,DWORD);
+HANDLE WINAPI HeapCreate(DWORD,DWORD,DWORD);
+WIN_BOOL WINAPI HeapDestroy(HANDLE);
+WIN_BOOL WINAPI HeapFree(HANDLE,DWORD,LPVOID);
+WIN_BOOL WINAPI HeapLock(HANDLE);
+LPVOID WINAPI HeapReAlloc(HANDLE,DWORD,LPVOID,DWORD);
+DWORD WINAPI HeapSize(HANDLE,DWORD,LPVOID);
+WIN_BOOL WINAPI HeapUnlock(HANDLE);
+WIN_BOOL WINAPI HeapValidate(HANDLE,DWORD,LPCVOID);
+WIN_BOOL WINAPI HeapWalk(HANDLE,LPPROCESS_HEAP_ENTRY);
+WIN_BOOL WINAPI InitializeSid(PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
+WIN_BOOL WINAPI IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR);
+WIN_BOOL WINAPI IsValidSid(PSID);
+WIN_BOOL WINAPI ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL);
+WIN_BOOL WINAPI IsDBCSLeadByteEx(UINT,BYTE);
+WIN_BOOL WINAPI IsProcessorFeaturePresent(DWORD);
+WIN_BOOL WINAPI IsValidLocale(DWORD,DWORD);
+WIN_BOOL WINAPI LookupAccountSidA(LPCSTR,PSID,LPSTR,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE);
+WIN_BOOL WINAPI LookupAccountSidW(LPCWSTR,PSID,LPWSTR,LPDWORD,LPWSTR,LPDWORD,PSID_NAME_USE);
+#define LookupAccountSid WINELIB_NAME_AW(LookupAccountSidW)
+WIN_BOOL WINAPI LocalFileTimeToFileTime(const FILETIME*,LPFILETIME);
+WIN_BOOL WINAPI LockFile(HANDLE,DWORD,DWORD,DWORD,DWORD);
+WIN_BOOL WINAPI LockFileEx(HANDLE, DWORD, DWORD, DWORD, DWORD, LPOVERLAPPED);
+WIN_BOOL WINAPI LookupPrivilegeValueA(LPCSTR,LPCSTR,LPVOID);
+WIN_BOOL WINAPI LookupPrivilegeValueW(LPCWSTR,LPCWSTR,LPVOID);
+#define LookupPrivilegeValue WINELIB_NAME_AW(LookupPrivilegeValue)
+WIN_BOOL WINAPI MakeSelfRelativeSD(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,LPDWORD);
+HMODULE WINAPI MapHModuleSL(HMODULE16);
+HMODULE16 WINAPI MapHModuleLS(HMODULE);
+SEGPTR WINAPI MapLS(LPVOID);
+LPVOID WINAPI MapSL(SEGPTR);
+LPVOID WINAPI MapViewOfFile(HANDLE,DWORD,DWORD,DWORD,DWORD);
+LPVOID WINAPI MapViewOfFileEx(HANDLE,DWORD,DWORD,DWORD,DWORD,LPVOID);
+WIN_BOOL WINAPI MoveFileA(LPCSTR,LPCSTR);
+WIN_BOOL WINAPI MoveFileW(LPCWSTR,LPCWSTR);
+#define MoveFile WINELIB_NAME_AW(MoveFile)
+WIN_BOOL WINAPI MoveFileExA(LPCSTR,LPCSTR,DWORD);
+WIN_BOOL WINAPI MoveFileExW(LPCWSTR,LPCWSTR,DWORD);
+#define MoveFileEx WINELIB_NAME_AW(MoveFileEx)
+INT WINAPI MultiByteToWideChar(UINT,DWORD,LPCSTR,INT,LPWSTR,INT);
+WIN_BOOL WINAPI NotifyChangeEventLog(HANDLE,HANDLE);
+INT WINAPI WideCharToMultiByte(UINT,DWORD,LPCWSTR,INT,LPSTR,INT,LPCSTR,WIN_BOOL*);
+HANDLE WINAPI OpenBackupEventLogA(LPCSTR,LPCSTR);
+HANDLE WINAPI OpenBackupEventLogW(LPCWSTR,LPCWSTR);
+#define OpenBackupEventLog WINELIB_NAME_AW(OpenBackupEventLog)
+HANDLE WINAPI OpenEventA(DWORD,WIN_BOOL,LPCSTR);
+HANDLE WINAPI OpenEventW(DWORD,WIN_BOOL,LPCWSTR);
+#define OpenEvent WINELIB_NAME_AW(OpenEvent)
+HANDLE WINAPI OpenEventLogA(LPCSTR,LPCSTR);
+HANDLE WINAPI OpenEventLogW(LPCWSTR,LPCWSTR);
+#define OpenEventLog WINELIB_NAME_AW(OpenEventLog)
+HANDLE WINAPI OpenFileMappingA(DWORD,WIN_BOOL,LPCSTR);
+HANDLE WINAPI OpenFileMappingW(DWORD,WIN_BOOL,LPCWSTR);
+#define OpenFileMapping WINELIB_NAME_AW(OpenFileMapping)
+HANDLE WINAPI OpenMutexA(DWORD,WIN_BOOL,LPCSTR);
+HANDLE WINAPI OpenMutexW(DWORD,WIN_BOOL,LPCWSTR);
+#define OpenMutex WINELIB_NAME_AW(OpenMutex)
+HANDLE WINAPI OpenProcess(DWORD,WIN_BOOL,DWORD);
+WIN_BOOL WINAPI OpenProcessToken(HANDLE,DWORD,PHANDLE);
+HANDLE WINAPI OpenSemaphoreA(DWORD,WIN_BOOL,LPCSTR);
+HANDLE WINAPI OpenSemaphoreW(DWORD,WIN_BOOL,LPCWSTR);
+#define OpenSemaphore WINELIB_NAME_AW(OpenSemaphore)
+WIN_BOOL WINAPI OpenThreadToken(HANDLE,DWORD,WIN_BOOL,PHANDLE);
+HANDLE WINAPI OpenWaitableTimerA(DWORD,WIN_BOOL,LPCSTR);
+HANDLE WINAPI OpenWaitableTimerW(DWORD,WIN_BOOL,LPCWSTR);
+#define OpenWaitableTimer WINELIB_NAME_AW(OpenWaitableTimer)
+WIN_BOOL WINAPI PulseEvent(HANDLE);
+WIN_BOOL WINAPI PurgeComm(HANDLE,DWORD);
+DWORD WINAPI QueryDosDeviceA(LPCSTR,LPSTR,DWORD);
+DWORD WINAPI QueryDosDeviceW(LPCWSTR,LPWSTR,DWORD);
+#define QueryDosDevice WINELIB_NAME_AW(QueryDosDevice)
+WIN_BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER);
+WIN_BOOL WINAPI ReadConsoleA(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
+WIN_BOOL WINAPI ReadConsoleW(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
+#define ReadConsole WINELIB_NAME_AW(ReadConsole)
+WIN_BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,
+ COORD,LPDWORD);
+#define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
+WIN_BOOL WINAPI ReadEventLogA(HANDLE,DWORD,DWORD,LPVOID,DWORD,DWORD *,DWORD *);
+WIN_BOOL WINAPI ReadEventLogW(HANDLE,DWORD,DWORD,LPVOID,DWORD,DWORD *,DWORD *);
+#define ReadEventLog WINELIB_NAME_AW(ReadEventLog)
+WIN_BOOL WINAPI ReadFile(HANDLE,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
+HANDLE WINAPI RegisterEventSourceA(LPCSTR,LPCSTR);
+HANDLE WINAPI RegisterEventSourceW(LPCWSTR,LPCWSTR);
+#define RegisterEventSource WINELIB_NAME_AW(RegisterEventSource)
+WIN_BOOL WINAPI ReleaseMutex(HANDLE);
+WIN_BOOL WINAPI ReleaseSemaphore(HANDLE,LONG,LPLONG);
+WIN_BOOL WINAPI ReportEventA(HANDLE,WORD,WORD,DWORD,PSID,WORD,DWORD,LPCSTR *,LPVOID);
+WIN_BOOL WINAPI ReportEventW(HANDLE,WORD,WORD,DWORD,PSID,WORD,DWORD,LPCWSTR *,LPVOID);
+#define ReportEvent WINELIB_NAME_AW(ReportEvent)
+WIN_BOOL WINAPI ResetEvent(HANDLE);
+DWORD WINAPI ResumeThread(HANDLE);
+WIN_BOOL WINAPI RevertToSelf(void);
+DWORD WINAPI SearchPathA(LPCSTR,LPCSTR,LPCSTR,DWORD,LPSTR,LPSTR*);
+DWORD WINAPI SearchPathW(LPCWSTR,LPCWSTR,LPCWSTR,DWORD,LPWSTR,LPWSTR*);
+#define SearchPath WINELIB_NAME_AW(SearchPath)
+WIN_BOOL WINAPI SetCommMask(INT,DWORD);
+WIN_BOOL WINAPI SetComputerNameA(LPCSTR);
+WIN_BOOL WINAPI SetComputerNameW(LPCWSTR);
+#define SetComputerName WINELIB_NAME_AW(SetComputerName)
+WIN_BOOL WINAPI SetConsoleCursorPosition(HANDLE,COORD);
+WIN_BOOL WINAPI SetConsoleMode(HANDLE,DWORD);
+WIN_BOOL WINAPI SetConsoleTitleA(LPCSTR);
+WIN_BOOL WINAPI SetConsoleTitleW(LPCWSTR);
+#define SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
+WIN_BOOL WINAPI SetEndOfFile(HANDLE);
+WIN_BOOL WINAPI SetEnvironmentVariableA(LPCSTR,LPCSTR);
+WIN_BOOL WINAPI SetEnvironmentVariableW(LPCWSTR,LPCWSTR);
+#define SetEnvironmentVariable WINELIB_NAME_AW(SetEnvironmentVariable)
+WIN_BOOL WINAPI SetEvent(HANDLE);
+VOID WINAPI SetFileApisToANSI(void);
+VOID WINAPI SetFileApisToOEM(void);
+DWORD WINAPI SetFilePointer(HANDLE,LONG,LPLONG,DWORD);
+WIN_BOOL WINAPI SetFileSecurityA(LPCSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
+WIN_BOOL WINAPI SetFileSecurityW(LPCWSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
+#define SetFileSecurity WINELIB_NAME_AW(SetFileSecurity)
+WIN_BOOL WINAPI SetFileTime(HANDLE,const FILETIME*,const FILETIME*,const FILETIME*);
+WIN_BOOL WINAPI SetHandleInformation(HANDLE,DWORD,DWORD);
+WIN_BOOL WINAPI SetPriorityClass(HANDLE,DWORD);
+WIN_BOOL WINAPI SetLocalTime(const SYSTEMTIME*);
+WIN_BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR,WIN_BOOL,PACL,WIN_BOOL);
+WIN_BOOL WINAPI SetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR,PSID,WIN_BOOL);
+WIN_BOOL WINAPI SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR,PSID,WIN_BOOL);
+WIN_BOOL WINAPI SetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR,WIN_BOOL,PACL,WIN_BOOL);
+WIN_BOOL WINAPI SetStdHandle(DWORD,HANDLE);
+WIN_BOOL WINAPI SetSystemPowerState(WIN_BOOL,WIN_BOOL);
+WIN_BOOL WINAPI SetSystemTime(const SYSTEMTIME*);
+DWORD WINAPI SetThreadAffinityMask(HANDLE,DWORD);
+WIN_BOOL WINAPI SetThreadContext(HANDLE,const CONTEXT *);
+WIN_BOOL WINAPI SetThreadLocale(LCID);
+WIN_BOOL WINAPI SetThreadPriority(HANDLE,INT);
+WIN_BOOL WINAPI SetTimeZoneInformation(const LPTIME_ZONE_INFORMATION);
+WIN_BOOL WINAPI SetWaitableTimer(HANDLE,const LARGE_INTEGER*,LONG,PTIMERAPCROUTINE,LPVOID,WIN_BOOL);
+VOID WINAPI Sleep(DWORD);
+DWORD WINAPI SleepEx(DWORD,WIN_BOOL);
+DWORD WINAPI SuspendThread(HANDLE);
+WIN_BOOL WINAPI SystemTimeToFileTime(const SYSTEMTIME*,LPFILETIME);
+DWORD WINAPI TlsAlloc(void);
+WIN_BOOL WINAPI TlsFree(DWORD);
+LPVOID WINAPI TlsGetValue(DWORD);
+WIN_BOOL WINAPI TlsSetValue(DWORD,LPVOID);
+VOID WINAPI UnMapLS(SEGPTR);
+WIN_BOOL WINAPI UnlockFile(HANDLE,DWORD,DWORD,DWORD,DWORD);
+WIN_BOOL WINAPI UnmapViewOfFile(LPVOID);
+LPVOID WINAPI VirtualAlloc(LPVOID,DWORD,DWORD,DWORD);
+WIN_BOOL WINAPI VirtualFree(LPVOID,DWORD,DWORD);
+WIN_BOOL WINAPI VirtualLock(LPVOID,DWORD);
+WIN_BOOL WINAPI VirtualProtect(LPVOID,DWORD,DWORD,LPDWORD);
+WIN_BOOL WINAPI VirtualProtectEx(HANDLE,LPVOID,DWORD,DWORD,LPDWORD);
+DWORD WINAPI VirtualQuery(LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD);
+DWORD WINAPI VirtualQueryEx(HANDLE,LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD);
+WIN_BOOL WINAPI VirtualUnlock(LPVOID,DWORD);
+WIN_BOOL WINAPI WaitCommEvent(HANDLE,LPDWORD,LPOVERLAPPED);
+WIN_BOOL WINAPI WaitForDebugEvent(LPDEBUG_EVENT,DWORD);
+DWORD WINAPI WaitForMultipleObjects(DWORD,const HANDLE*,WIN_BOOL,DWORD);
+DWORD WINAPI WaitForMultipleObjectsEx(DWORD,const HANDLE*,WIN_BOOL,DWORD,WIN_BOOL);
+DWORD WINAPI WaitForSingleObject(HANDLE,DWORD);
+DWORD WINAPI WaitForSingleObjectEx(HANDLE,DWORD,WIN_BOOL);
+WIN_BOOL WINAPI WriteConsoleA(HANDLE,LPCVOID,DWORD,LPDWORD,LPVOID);
+WIN_BOOL WINAPI WriteConsoleW(HANDLE,LPCVOID,DWORD,LPDWORD,LPVOID);
+#define WriteConsole WINELIB_NAME_AW(WriteConsole)
+WIN_BOOL WINAPI WriteFile(HANDLE,LPCVOID,DWORD,LPDWORD,LPOVERLAPPED);
+LANGID WINAPI GetSystemDefaultLangID(void);
+LCID WINAPI GetSystemDefaultLCID(void);
+LANGID WINAPI GetUserDefaultLangID(void);
+LCID WINAPI GetUserDefaultLCID(void);
+ATOM WINAPI AddAtomA(LPCSTR);
+ATOM WINAPI AddAtomW(LPCWSTR);
+#define AddAtom WINELIB_NAME_AW(AddAtom)
+UINT WINAPI CompareStringA(DWORD,DWORD,LPCSTR,DWORD,LPCSTR,DWORD);
+UINT WINAPI CompareStringW(DWORD,DWORD,LPCWSTR,DWORD,LPCWSTR,DWORD);
+#define CompareString WINELIB_NAME_AW(CompareString)
+WIN_BOOL WINAPI CreateDirectoryA(LPCSTR,LPSECURITY_ATTRIBUTES);
+WIN_BOOL WINAPI CreateDirectoryW(LPCWSTR,LPSECURITY_ATTRIBUTES);
+#define CreateDirectory WINELIB_NAME_AW(CreateDirectory)
+WIN_BOOL WINAPI CreateDirectoryExA(LPCSTR,LPCSTR,LPSECURITY_ATTRIBUTES);
+WIN_BOOL WINAPI CreateDirectoryExW(LPCWSTR,LPCWSTR,LPSECURITY_ATTRIBUTES);
+#define CreateDirectoryEx WINELIB_NAME_AW(CreateDirectoryEx)
+WIN_BOOL WINAPI DefineDosDeviceA(DWORD,LPCSTR,LPCSTR);
+#define DefineHandleTable(w) ((w),TRUE)
+ATOM WINAPI DeleteAtom(ATOM);
+WIN_BOOL WINAPI DeleteFileA(LPCSTR);
+WIN_BOOL WINAPI DeleteFileW(LPCWSTR);
+#define DeleteFile WINELIB_NAME_AW(DeleteFile)
+void WINAPI FatalAppExitA(UINT,LPCSTR);
+void WINAPI FatalAppExitW(UINT,LPCWSTR);
+#define FatalAppExit WINELIB_NAME_AW(FatalAppExit)
+ATOM WINAPI FindAtomA(LPCSTR);
+ATOM WINAPI FindAtomW(LPCWSTR);
+#define FindAtom WINELIB_NAME_AW(FindAtom)
+WIN_BOOL WINAPI FindClose(HANDLE);
+HANDLE16 WINAPI FindFirstFile16(LPCSTR,LPWIN32_FIND_DATAA);
+HANDLE WINAPI FindFirstFileA(LPCSTR,LPWIN32_FIND_DATAA);
+HANDLE WINAPI FindFirstFileW(LPCWSTR,LPWIN32_FIND_DATAW);
+#define FindFirstFile WINELIB_NAME_AW(FindFirstFile)
+WIN_BOOL16 WINAPI FindNextFile16(HANDLE16,LPWIN32_FIND_DATAA);
+WIN_BOOL WINAPI FindNextFileA(HANDLE,LPWIN32_FIND_DATAA);
+WIN_BOOL WINAPI FindNextFileW(HANDLE,LPWIN32_FIND_DATAW);
+#define FindNextFile WINELIB_NAME_AW(FindNextFile)
+HRSRC WINAPI FindResourceA(HMODULE,LPCSTR,LPCSTR);
+HRSRC WINAPI FindResourceW(HMODULE,LPCWSTR,LPCWSTR);
+#define FindResource WINELIB_NAME_AW(FindResource)
+VOID WINAPI FreeLibrary16(HINSTANCE16);
+WIN_BOOL WINAPI FreeLibrary(HMODULE);
+#define FreeModule(handle) FreeLibrary(handle)
+#define FreeProcInstance(proc) /*nothing*/
+WIN_BOOL WINAPI FreeResource(HGLOBAL);
+UINT WINAPI GetAtomNameA(ATOM,LPSTR,INT);
+UINT WINAPI GetAtomNameW(ATOM,LPWSTR,INT);
+#define GetAtomName WINELIB_NAME_AW(GetAtomName)
+UINT WINAPI GetCurrentDirectoryA(UINT,LPSTR);
+UINT WINAPI GetCurrentDirectoryW(UINT,LPWSTR);
+#define GetCurrentDirectory WINELIB_NAME_AW(GetCurrentDirectory)
+WIN_BOOL WINAPI GetDiskFreeSpaceA(LPCSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD);
+WIN_BOOL WINAPI GetDiskFreeSpaceW(LPCWSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD);
+#define GetDiskFreeSpace WINELIB_NAME_AW(GetDiskFreeSpace)
+WIN_BOOL WINAPI GetDiskFreeSpaceExA(LPCSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER);
+WIN_BOOL WINAPI GetDiskFreeSpaceExW(LPCWSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER);
+#define GetDiskFreeSpaceEx WINELIB_NAME_AW(GetDiskFreeSpaceEx)
+UINT WINAPI GetDriveTypeA(LPCSTR);
+UINT WINAPI GetDriveTypeW(LPCWSTR);
+#define GetDriveType WINELIB_NAME_AW(GetDriveType)
+DWORD WINAPI GetFileAttributesA(LPCSTR);
+DWORD WINAPI GetFileAttributesW(LPCWSTR);
+#define GetFileAttributes WINELIB_NAME_AW(GetFileAttributes)
+#define GetFreeSpace(w) (0x100000L)
+UINT WINAPI GetLogicalDriveStringsA(UINT,LPSTR);
+UINT WINAPI GetLogicalDriveStringsW(UINT,LPWSTR);
+#define GetLogicalDriveStrings WINELIB_NAME_AW(GetLogicalDriveStrings)
+INT WINAPI GetLocaleInfoA(LCID,LCTYPE,LPSTR,INT);
+INT WINAPI GetLocaleInfoW(LCID,LCTYPE,LPWSTR,INT);
+#define GetLocaleInfo WINELIB_NAME_AW(GetLocaleInfo)
+DWORD WINAPI GetModuleFileNameA(HMODULE,LPSTR,DWORD);
+DWORD WINAPI GetModuleFileNameW(HMODULE,LPWSTR,DWORD);
+#define GetModuleFileName WINELIB_NAME_AW(GetModuleFileName)
+HMODULE WINAPI GetModuleHandleA(LPCSTR);
+HMODULE WINAPI GetModuleHandleW(LPCWSTR);
+#define GetModuleHandle WINELIB_NAME_AW(GetModuleHandle)
+WIN_BOOL WINAPI GetOverlappedResult(HANDLE,LPOVERLAPPED,LPDWORD,WIN_BOOL);
+UINT WINAPI GetPrivateProfileIntA(LPCSTR,LPCSTR,INT,LPCSTR);
+UINT WINAPI GetPrivateProfileIntW(LPCWSTR,LPCWSTR,INT,LPCWSTR);
+#define GetPrivateProfileInt WINELIB_NAME_AW(GetPrivateProfileInt)
+INT WINAPI GetPrivateProfileSectionA(LPCSTR,LPSTR,DWORD,LPCSTR);
+INT WINAPI GetPrivateProfileSectionW(LPCWSTR,LPWSTR,DWORD,LPCWSTR);
+#define GetPrivateProfileSection WINELIB_NAME_AW(GetPrivateProfileSection)
+DWORD WINAPI GetPrivateProfileSectionNamesA(LPSTR,DWORD,LPCSTR);
+DWORD WINAPI GetPrivateProfileSectionNamesW(LPWSTR,DWORD,LPCWSTR);
+#define GetPrivateProfileSectionNames WINELIB_NAME_AW(GetPrivateProfileSectionNames)
+INT WINAPI GetPrivateProfileStringA(LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT,LPCSTR);
+INT WINAPI GetPrivateProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,UINT,LPCWSTR);
+#define GetPrivateProfileString WINELIB_NAME_AW(GetPrivateProfileString)
+WIN_BOOL WINAPI GetPrivateProfileStructA(LPCSTR,LPCSTR,LPVOID,UINT,LPCSTR);
+WIN_BOOL WINAPI GetPrivateProfileStructW(LPCWSTR,LPCWSTR,LPVOID,UINT,LPCWSTR);
+#define GetPrivateProfileStruct WINELIB_NAME_AW(GetPrivateProfileStruct)
+FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR);
+UINT WINAPI GetProfileIntA(LPCSTR,LPCSTR,INT);
+UINT WINAPI GetProfileIntW(LPCWSTR,LPCWSTR,INT);
+#define GetProfileInt WINELIB_NAME_AW(GetProfileInt)
+INT WINAPI GetProfileSectionA(LPCSTR,LPSTR,DWORD);
+INT WINAPI GetProfileSectionW(LPCWSTR,LPWSTR,DWORD);
+#define GetProfileSection WINELIB_NAME_AW(GetProfileSection)
+INT WINAPI GetProfileStringA(LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT);
+INT WINAPI GetProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,UINT);
+#define GetProfileString WINELIB_NAME_AW(GetProfileString)
+VOID WINAPI GetStartupInfoA(LPSTARTUPINFOA);
+VOID WINAPI GetStartupInfoW(LPSTARTUPINFOW);
+#define GetStartupInfo WINELIB_NAME_AW(GetStartupInfo)
+WIN_BOOL WINAPI GetStringTypeA(LCID,DWORD,LPCSTR,INT,LPWORD);
+WIN_BOOL WINAPI GetStringTypeW(DWORD,LPCWSTR,INT,LPWORD);
+#define GetStringType WINELIB_NAME_AW(GetStringType)
+UINT WINAPI GetSystemDirectoryA(LPSTR,UINT);
+UINT WINAPI GetSystemDirectoryW(LPWSTR,UINT);
+#define GetSystemDirectory WINELIB_NAME_AW(GetSystemDirectory)
+UINT WINAPI GetTempFileNameA(LPCSTR,LPCSTR,UINT,LPSTR);
+UINT WINAPI GetTempFileNameW(LPCWSTR,LPCWSTR,UINT,LPWSTR);
+#define GetTempFileName WINELIB_NAME_AW(GetTempFileName)
+UINT WINAPI GetTempPathA(UINT,LPSTR);
+UINT WINAPI GetTempPathW(UINT,LPWSTR);
+#define GetTempPath WINELIB_NAME_AW(GetTempPath)
+LONG WINAPI GetVersion(void);
+WIN_BOOL WINAPI GetExitCodeProcess(HANDLE,LPDWORD);
+WIN_BOOL WINAPI GetVolumeInformationA(LPCSTR,LPSTR,DWORD,LPDWORD,LPDWORD,LPDWORD,LPSTR,DWORD);
+WIN_BOOL WINAPI GetVolumeInformationW(LPCWSTR,LPWSTR,DWORD,LPDWORD,LPDWORD,LPDWORD,LPWSTR,DWORD);
+#define GetVolumeInformation WINELIB_NAME_AW(GetVolumeInformation)
+UINT WINAPI GetWindowsDirectoryA(LPSTR,UINT);
+UINT WINAPI GetWindowsDirectoryW(LPWSTR,UINT);
+#define GetWindowsDirectory WINELIB_NAME_AW(GetWindowsDirectory)
+HGLOBAL16 WINAPI GlobalAlloc16(UINT16,DWORD);
+HGLOBAL WINAPI GlobalAlloc(UINT,DWORD);
+DWORD WINAPI GlobalCompact(DWORD);
+UINT WINAPI GlobalFlags(HGLOBAL);
+HGLOBAL16 WINAPI GlobalFree16(HGLOBAL16);
+HGLOBAL WINAPI GlobalFree(HGLOBAL);
+HGLOBAL WINAPI GlobalHandle(LPCVOID);
+WORD WINAPI GlobalFix16(HGLOBAL16);
+VOID WINAPI GlobalFix(HGLOBAL);
+LPVOID WINAPI GlobalLock16(HGLOBAL16);
+LPVOID WINAPI GlobalLock(HGLOBAL);
+HGLOBAL WINAPI GlobalReAlloc(HGLOBAL,DWORD,UINT);
+DWORD WINAPI GlobalSize16(HGLOBAL16);
+DWORD WINAPI GlobalSize(HGLOBAL);
+VOID WINAPI GlobalUnfix16(HGLOBAL16);
+VOID WINAPI GlobalUnfix(HGLOBAL);
+WIN_BOOL16 WINAPI GlobalUnlock16(HGLOBAL16);
+WIN_BOOL WINAPI GlobalUnlock(HGLOBAL);
+WIN_BOOL16 WINAPI GlobalUnWire16(HGLOBAL16);
+WIN_BOOL WINAPI GlobalUnWire(HGLOBAL);
+SEGPTR WINAPI GlobalWire16(HGLOBAL16);
+LPVOID WINAPI GlobalWire(HGLOBAL);
+WIN_BOOL WINAPI InitAtomTable(DWORD);
+WIN_BOOL WINAPI IsBadCodePtr(FARPROC);
+WIN_BOOL WINAPI IsBadHugeReadPtr(LPCVOID,UINT);
+WIN_BOOL WINAPI IsBadHugeWritePtr(LPVOID,UINT);
+WIN_BOOL WINAPI IsBadReadPtr(LPCVOID,UINT);
+WIN_BOOL WINAPI IsBadStringPtrA(LPCSTR,UINT);
+WIN_BOOL WINAPI IsBadStringPtrW(LPCWSTR,UINT);
+#define IsBadStringPtr WINELIB_NAME_AW(IsBadStringPtr)
+WIN_BOOL WINAPI IsBadWritePtr(LPVOID,UINT);
+WIN_BOOL WINAPI IsDBCSLeadByte(BYTE);
+WIN_BOOL WINAPI IsDebuggerPresent(void);
+HINSTANCE16 WINAPI LoadLibrary16(LPCSTR);
+HMODULE WINAPI LoadLibraryA(LPCSTR);
+HMODULE WINAPI LoadLibraryW(LPCWSTR);
+#define LoadLibrary WINELIB_NAME_AW(LoadLibrary)
+HMODULE WINAPI LoadLibraryExA(LPCSTR,HANDLE,DWORD);
+HMODULE WINAPI LoadLibraryExW(LPCWSTR,HANDLE,DWORD);
+#define LoadLibraryEx WINELIB_NAME_AW(LoadLibraryEx)
+HINSTANCE16 WINAPI LoadModule16(LPCSTR,LPVOID);
+HINSTANCE WINAPI LoadModule(LPCSTR,LPVOID);
+HGLOBAL WINAPI LoadResource(HMODULE,HRSRC);
+HLOCAL WINAPI LocalAlloc(UINT,DWORD);
+UINT WINAPI LocalCompact(UINT);
+UINT WINAPI LocalFlags(HLOCAL);
+HLOCAL WINAPI LocalFree(HLOCAL);
+HLOCAL WINAPI LocalHandle(LPCVOID);
+LPVOID WINAPI LocalLock(HLOCAL);
+HLOCAL WINAPI LocalReAlloc(HLOCAL,DWORD,UINT);
+UINT WINAPI LocalShrink(HGLOBAL,UINT);
+UINT WINAPI LocalSize(HLOCAL);
+WIN_BOOL WINAPI LocalUnlock(HLOCAL);
+LPVOID WINAPI LockResource(HGLOBAL);
+#define LockSegment(handle) GlobalFix((HANDLE)(handle))
+#define MakeProcInstance(proc,inst) (proc)
+HFILE16 WINAPI OpenFile16(LPCSTR,OFSTRUCT*,UINT16);
+HFILE WINAPI OpenFile(LPCSTR,OFSTRUCT*,UINT);
+VOID WINAPI OutputDebugStringA(LPCSTR);
+VOID WINAPI OutputDebugStringW(LPCWSTR);
+#define OutputDebugString WINELIB_NAME_AW(OutputDebugString)
+WIN_BOOL WINAPI ReadProcessMemory(HANDLE, LPCVOID, LPVOID, DWORD, LPDWORD);
+WIN_BOOL WINAPI RemoveDirectoryA(LPCSTR);
+WIN_BOOL WINAPI RemoveDirectoryW(LPCWSTR);
+#define RemoveDirectory WINELIB_NAME_AW(RemoveDirectory)
+WIN_BOOL WINAPI SetCurrentDirectoryA(LPCSTR);
+WIN_BOOL WINAPI SetCurrentDirectoryW(LPCWSTR);
+#define SetCurrentDirectory WINELIB_NAME_AW(SetCurrentDirectory)
+UINT WINAPI SetErrorMode(UINT);
+WIN_BOOL WINAPI SetFileAttributesA(LPCSTR,DWORD);
+WIN_BOOL WINAPI SetFileAttributesW(LPCWSTR,DWORD);
+#define SetFileAttributes WINELIB_NAME_AW(SetFileAttributes)
+UINT WINAPI SetHandleCount(UINT);
+#define SetSwapAreaSize(w) (w)
+WIN_BOOL WINAPI SetVolumeLabelA(LPCSTR,LPCSTR);
+WIN_BOOL WINAPI SetVolumeLabelW(LPCWSTR,LPCWSTR);
+#define SetVolumeLabel WINELIB_NAME_AW(SetVolumeLabel)
+DWORD WINAPI SizeofResource(HMODULE,HRSRC);
+#define UnlockSegment(handle) GlobalUnfix((HANDLE)(handle))
+WIN_BOOL WINAPI WritePrivateProfileSectionA(LPCSTR,LPCSTR,LPCSTR);
+WIN_BOOL WINAPI WritePrivateProfileSectionW(LPCWSTR,LPCWSTR,LPCWSTR);
+#define WritePrivateProfileSection WINELIB_NAME_AW(WritePrivateProfileSection)
+WIN_BOOL WINAPI WritePrivateProfileStringA(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
+WIN_BOOL WINAPI WritePrivateProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR);
+#define WritePrivateProfileString WINELIB_NAME_AW(WritePrivateProfileString)
+WIN_BOOL WINAPI WriteProfileSectionA(LPCSTR,LPCSTR);
+WIN_BOOL WINAPI WriteProfileSectionW(LPCWSTR,LPCWSTR);
+#define WritePrivateProfileSection WINELIB_NAME_AW(WritePrivateProfileSection)
+WIN_BOOL WINAPI WritePrivateProfileStructA(LPCSTR,LPCSTR,LPVOID,UINT,LPCSTR);
+WIN_BOOL WINAPI WritePrivateProfileStructW(LPCWSTR,LPCWSTR,LPVOID,UINT,LPCWSTR);
+#define WritePrivateProfileStruct WINELIB_NAME_AW(WritePrivateProfileStruct)
+WIN_BOOL WINAPI WriteProcessMemory(HANDLE, LPVOID, LPVOID, DWORD, LPDWORD);
+WIN_BOOL WINAPI WriteProfileStringA(LPCSTR,LPCSTR,LPCSTR);
+WIN_BOOL WINAPI WriteProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR);
+#define WriteProfileString WINELIB_NAME_AW(WriteProfileString)
+#define Yield32()
+LPSTR WINAPI lstrcatA(LPSTR,LPCSTR);
+LPWSTR WINAPI lstrcatW(LPWSTR,LPCWSTR);
+#define lstrcat WINELIB_NAME_AW(lstrcat)
+LPSTR WINAPI lstrcpyA(LPSTR,LPCSTR);
+LPWSTR WINAPI lstrcpyW(LPWSTR,LPCWSTR);
+#define lstrcpy WINELIB_NAME_AW(lstrcpy)
+LPSTR WINAPI lstrcpynA(LPSTR,LPCSTR,INT);
+LPWSTR WINAPI lstrcpynW(LPWSTR,LPCWSTR,INT);
+#define lstrcpyn WINELIB_NAME_AW(lstrcpyn)
+INT WINAPI lstrlenA(LPCSTR);
+INT WINAPI lstrlenW(LPCWSTR);
+#define lstrlen WINELIB_NAME_AW(lstrlen)
+HINSTANCE WINAPI WinExec(LPCSTR,UINT);
+LONG WINAPI _hread(HFILE,LPVOID,LONG);
+LONG WINAPI _hwrite(HFILE,LPCSTR,LONG);
+HFILE WINAPI _lcreat(LPCSTR,INT);
+HFILE WINAPI _lclose(HFILE);
+LONG WINAPI _llseek(HFILE,LONG,INT);
+HFILE WINAPI _lopen(LPCSTR,INT);
+UINT WINAPI _lread(HFILE,LPVOID,UINT);
+UINT WINAPI _lwrite(HFILE,LPCSTR,UINT);
+SEGPTR WINAPI WIN16_GlobalLock16(HGLOBAL16);
+INT WINAPI lstrcmpA(LPCSTR,LPCSTR);
+INT WINAPI lstrcmpW(LPCWSTR,LPCWSTR);
+#define lstrcmp WINELIB_NAME_AW(lstrcmp)
+INT WINAPI lstrcmpiA(LPCSTR,LPCSTR);
+INT WINAPI lstrcmpiW(LPCWSTR,LPCWSTR);
+#define lstrcmpi WINELIB_NAME_AW(lstrcmpi)
+
+/* compatibility macros */
+#define FillMemory RtlFillMemory
+#define MoveMemory RtlMoveMemory
+#define ZeroMemory RtlZeroMemory
+#define CopyMemory RtlCopyMemory
+
+DWORD WINAPI GetCurrentProcessId(void);
+DWORD WINAPI GetCurrentThreadId(void);
+DWORD WINAPI GetLastError(void);
+HANDLE WINAPI GetProcessHeap(void);
+PVOID WINAPI InterlockedCompareExchange(PVOID*,PVOID,PVOID);
+LONG WINAPI InterlockedDecrement(PLONG);
+LONG WINAPI InterlockedExchange(PLONG,LONG);
+LONG WINAPI InterlockedExchangeAdd(PLONG,LONG);
+LONG WINAPI InterlockedIncrement(PLONG);
+VOID WINAPI SetLastError(DWORD);
+
+#ifdef __WINE__
+#define GetCurrentProcess() ((HANDLE)0xffffffff)
+#define GetCurrentThread() ((HANDLE)0xfffffffe)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINE_WINBASE_H */
diff --git a/loader/wine/windef.h b/loader/wine/windef.h
new file mode 100644
index 0000000000..12338a754f
--- /dev/null
+++ b/loader/wine/windef.h
@@ -0,0 +1,656 @@
+/*
+ * Basic types definitions
+ *
+ * Copyright 1996 Alexandre Julliard
+ */
+
+#ifndef __WINE_WINDEF_H
+#define __WINE_WINDEF_H
+
+#ifdef __WINE__
+# include "config.h"
+# undef UNICODE
+#endif
+
+#ifdef _EGCS_
+#define __stdcall
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Misc. constants. */
+
+#ifdef FALSE
+#undef FALSE
+#endif
+#define FALSE 0
+
+#ifdef TRUE
+#undef TRUE
+#endif
+#define TRUE 1
+
+#ifdef NULL
+#undef NULL
+#endif
+#define NULL 0
+
+/* Macros to map Winelib names to the correct implementation name */
+/* depending on __WINE__ and UNICODE macros. */
+/* Note that Winelib is purely Win32. */
+
+#ifdef __WINE__
+# define WINELIB_NAME_AW(func) \
+ func##_must_be_suffixed_with_W_or_A_in_this_context \
+ func##_must_be_suffixed_with_W_or_A_in_this_context
+#else /* __WINE__ */
+# ifdef UNICODE
+# define WINELIB_NAME_AW(func) func##W
+# else
+# define WINELIB_NAME_AW(func) func##A
+# endif /* UNICODE */
+#endif /* __WINE__ */
+
+#ifdef __WINE__
+# define DECL_WINELIB_TYPE_AW(type) /* nothing */
+#else /* __WINE__ */
+# define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
+#endif /* __WINE__ */
+
+#ifndef NONAMELESSSTRUCT
+# if defined(__WINE__) || !defined(_FORCENAMELESSSTRUCT)
+# define NONAMELESSSTRUCT
+# endif
+#endif /* !defined(NONAMELESSSTRUCT) */
+
+#ifndef NONAMELESSUNION
+# if defined(__WINE__) || !defined(_FORCENAMELESSUNION) || !defined(__cplusplus)
+# define NONAMELESSUNION
+# endif
+#endif /* !defined(NONAMELESSUNION) */
+
+#ifndef NONAMELESSSTRUCT
+#define DUMMYSTRUCTNAME
+#define DUMMYSTRUCTNAME1
+#define DUMMYSTRUCTNAME2
+#define DUMMYSTRUCTNAME3
+#define DUMMYSTRUCTNAME4
+#define DUMMYSTRUCTNAME5
+#else /* !defined(NONAMELESSSTRUCT) */
+#define DUMMYSTRUCTNAME s
+#define DUMMYSTRUCTNAME1 s1
+#define DUMMYSTRUCTNAME2 s2
+#define DUMMYSTRUCTNAME3 s3
+#define DUMMYSTRUCTNAME4 s4
+#define DUMMYSTRUCTNAME5 s5
+#endif /* !defined(NONAMELESSSTRUCT) */
+
+#ifndef NONAMELESSUNION
+#define DUMMYUNIONNAME
+#define DUMMYUNIONNAME1
+#define DUMMYUNIONNAME2
+#define DUMMYUNIONNAME3
+#define DUMMYUNIONNAME4
+#define DUMMYUNIONNAME5
+#else /* !defined(NONAMELESSUNION) */
+#define DUMMYUNIONNAME u
+#define DUMMYUNIONNAME1 u1
+#define DUMMYUNIONNAME2 u2
+#define DUMMYUNIONNAME3 u3
+#define DUMMYUNIONNAME4 u4
+#define DUMMYUNIONNAME5 u5
+#endif /* !defined(NONAMELESSUNION) */
+
+/* Calling conventions definitions */
+
+#ifdef __i386__
+# if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
+# ifndef _EGCS_
+#define __stdcall __attribute__((__stdcall__))
+#define __cdecl __attribute__((__cdecl__))
+# define __RESTORE_ES __asm__ __volatile__("pushl %ds\n\tpopl %es")
+# endif
+# else
+//# error You need gcc >= 2.7 to build Wine on a 386
+# endif
+#else
+# define __stdcall
+# define __cdecl
+# define __RESTORE_ES
+#endif
+
+#define CALLBACK __stdcall
+#define WINAPI __stdcall
+#define APIPRIVATE __stdcall
+#define PASCAL __stdcall
+#define pascal __stdcall
+#define _pascal __stdcall
+#define _stdcall __stdcall
+#define _fastcall __stdcall
+#define __fastcall __stdcall
+#define __export __stdcall
+#define CDECL __cdecl
+#define _CDECL __cdecl
+#define cdecl __cdecl
+#define _cdecl __cdecl
+#define WINAPIV __cdecl
+#define APIENTRY WINAPI
+
+#define __declspec(x)
+#define dllimport
+#define dllexport
+
+#define CONST const
+
+/* Standard data types. These are the same for emulator and library. */
+
+typedef void VOID;
+typedef int INT;
+typedef unsigned int UINT;
+typedef unsigned short WORD;
+typedef unsigned long DWORD;
+typedef unsigned long ULONG;
+typedef unsigned char BYTE;
+typedef long LONG;
+typedef short SHORT;
+typedef unsigned short USHORT;
+typedef char CHAR;
+typedef unsigned char UCHAR;
+
+typedef LONG SCODE;
+
+/* Some systems might have wchar_t, but we really need 16 bit characters */
+typedef unsigned short WCHAR;
+typedef int WIN_BOOL;
+typedef double DATE;
+typedef double DOUBLE;
+typedef double LONGLONG;
+typedef double ULONGLONG;
+
+/* FIXME: Wine does not compile with strict on, therefore strict
+ * handles are presently only usable on machines where sizeof(UINT) ==
+ * sizeof(void*). HANDLEs are supposed to be void* but a large amount
+ * of WINE code operates on HANDLES as if they are UINTs. So to WINE
+ * they exist as UINTs but to the Winelib user who turns on strict,
+ * they exist as void*. If there is a size difference between UINT and
+ * void* then things get ugly. */
+#ifdef STRICT
+typedef VOID* HANDLE;
+#else
+typedef UINT HANDLE;
+#endif
+
+
+typedef HANDLE *LPHANDLE;
+
+/* Integer types. These are the same for emulator and library. */
+typedef UINT WPARAM;
+typedef LONG LPARAM;
+typedef LONG HRESULT;
+typedef LONG LRESULT;
+typedef WORD ATOM;
+typedef WORD CATCHBUF[9];
+typedef WORD *LPCATCHBUF;
+typedef HANDLE HHOOK;
+typedef HANDLE HMONITOR;
+typedef DWORD LCID;
+typedef WORD LANGID;
+typedef DWORD LCTYPE;
+typedef float FLOAT;
+
+/* Pointers types. These are the same for emulator and library. */
+/* winnt types */
+typedef VOID *PVOID;
+typedef const void *PCVOID;
+typedef CHAR *PCHAR;
+typedef UCHAR *PUCHAR;
+typedef BYTE *PBYTE;
+typedef WORD *PWORD;
+typedef USHORT *PUSHORT;
+typedef SHORT *PSHORT;
+typedef ULONG *PULONG;
+typedef LONG *PLONG;
+typedef DWORD *PDWORD;
+/* common win32 types */
+typedef CHAR *LPSTR;
+typedef CHAR *PSTR;
+typedef const CHAR *LPCSTR;
+typedef const CHAR *PCSTR;
+typedef WCHAR *LPWSTR;
+typedef WCHAR *PWSTR;
+typedef const WCHAR *LPCWSTR;
+typedef const WCHAR *PCWSTR;
+typedef BYTE *LPBYTE;
+typedef WORD *LPWORD;
+typedef DWORD *LPDWORD;
+typedef LONG *LPLONG;
+typedef VOID *LPVOID;
+typedef const VOID *LPCVOID;
+typedef INT *PINT;
+typedef INT *LPINT;
+typedef UINT *PUINT;
+typedef UINT *LPUINT;
+typedef FLOAT *PFLOAT;
+typedef FLOAT *LPFLOAT;
+typedef WIN_BOOL *PWIN_BOOL;
+typedef WIN_BOOL *LPWIN_BOOL;
+
+/* Special case: a segmented pointer is just a pointer in the user's code. */
+
+#ifdef __WINE__
+typedef DWORD SEGPTR;
+#else
+typedef void* SEGPTR;
+#endif /* __WINE__ */
+
+/* Handle types that exist both in Win16 and Win32. */
+
+#ifdef STRICT
+#define DECLARE_HANDLE(a) \
+ typedef struct a##__ { int unused; } *a; \
+ typedef a *P##a; \
+ typedef a *LP##a
+#else /*STRICT*/
+#define DECLARE_HANDLE(a) \
+ typedef HANDLE a; \
+ typedef a *P##a; \
+ typedef a *LP##a
+#endif /*STRICT*/
+
+DECLARE_HANDLE(HACMDRIVERID);
+DECLARE_HANDLE(HACMDRIVER);
+DECLARE_HANDLE(HACMOBJ);
+DECLARE_HANDLE(HACMSTREAM);
+DECLARE_HANDLE(HMETAFILEPICT);
+
+DECLARE_HANDLE(HACCEL);
+DECLARE_HANDLE(HBITMAP);
+DECLARE_HANDLE(HBRUSH);
+DECLARE_HANDLE(HCOLORSPACE);
+DECLARE_HANDLE(HCURSOR);
+DECLARE_HANDLE(HDC);
+DECLARE_HANDLE(HDROP);
+DECLARE_HANDLE(HDRVR);
+DECLARE_HANDLE(HDWP);
+DECLARE_HANDLE(HENHMETAFILE);
+DECLARE_HANDLE(HFILE);
+DECLARE_HANDLE(HFONT);
+DECLARE_HANDLE(HICON);
+DECLARE_HANDLE(HINSTANCE);
+DECLARE_HANDLE(HKEY);
+DECLARE_HANDLE(HMENU);
+DECLARE_HANDLE(HMETAFILE);
+DECLARE_HANDLE(HMIDI);
+DECLARE_HANDLE(HMIDIIN);
+DECLARE_HANDLE(HMIDIOUT);
+DECLARE_HANDLE(HMIDISTRM);
+DECLARE_HANDLE(HMIXER);
+DECLARE_HANDLE(HMIXEROBJ);
+DECLARE_HANDLE(HMMIO);
+DECLARE_HANDLE(HPALETTE);
+DECLARE_HANDLE(HPEN);
+DECLARE_HANDLE(HQUEUE);
+DECLARE_HANDLE(HRGN);
+DECLARE_HANDLE(HRSRC);
+DECLARE_HANDLE(HTASK);
+DECLARE_HANDLE(HWAVE);
+DECLARE_HANDLE(HWAVEIN);
+DECLARE_HANDLE(HWAVEOUT);
+DECLARE_HANDLE(HWINSTA);
+DECLARE_HANDLE(HDESK);
+DECLARE_HANDLE(HWND);
+DECLARE_HANDLE(HKL);
+DECLARE_HANDLE(HIC);
+DECLARE_HANDLE(HRASCONN);
+
+/* Handle types that must remain interchangeable even with strict on */
+
+typedef HINSTANCE HMODULE;
+typedef HANDLE HGDIOBJ;
+typedef HANDLE HGLOBAL;
+typedef HANDLE HLOCAL;
+typedef HANDLE GLOBALHANDLE;
+typedef HANDLE LOCALHANDLE;
+
+/* Callback function pointers types */
+//WIN_BOOL CALLBACK DATEFMT_ENUMPROCA(LPSTR);
+
+typedef WIN_BOOL CALLBACK (* DATEFMT_ENUMPROCA)(LPSTR);
+typedef WIN_BOOL CALLBACK (* DATEFMT_ENUMPROCW)(LPWSTR);
+DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC)
+typedef WIN_BOOL CALLBACK (*DLGPROC)(HWND,UINT,WPARAM,LPARAM);
+typedef LRESULT CALLBACK (*DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM);
+typedef INT CALLBACK (*EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT);
+typedef INT CALLBACK (*EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
+DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC)
+typedef LRESULT CALLBACK (*FARPROC)();
+typedef INT CALLBACK (*PROC)();
+typedef WIN_BOOL CALLBACK (*GRAYSTRINGPROC)(HDC,LPARAM,INT);
+typedef LRESULT CALLBACK (*HOOKPROC)(INT,WPARAM,LPARAM);
+typedef WIN_BOOL CALLBACK (*PROPENUMPROCA)(HWND,LPCSTR,HANDLE);
+typedef WIN_BOOL CALLBACK (*PROPENUMPROCW)(HWND,LPCWSTR,HANDLE);
+DECL_WINELIB_TYPE_AW(PROPENUMPROC)
+typedef WIN_BOOL CALLBACK (*PROPENUMPROCEXA)(HWND,LPCSTR,HANDLE,LPARAM);
+typedef WIN_BOOL CALLBACK (*PROPENUMPROCEXW)(HWND,LPCWSTR,HANDLE,LPARAM);
+DECL_WINELIB_TYPE_AW(PROPENUMPROCEX)
+typedef WIN_BOOL CALLBACK (* TIMEFMT_ENUMPROCA)(LPSTR);
+typedef WIN_BOOL CALLBACK (* TIMEFMT_ENUMPROCW)(LPWSTR);
+DECL_WINELIB_TYPE_AW(TIMEFMT_ENUMPROC)
+typedef VOID CALLBACK (*TIMERPROC)(HWND,UINT,UINT,DWORD);
+typedef WIN_BOOL CALLBACK (*WNDENUMPROC)(HWND,LPARAM);
+typedef LRESULT CALLBACK (*WNDPROC)(HWND,UINT,WPARAM,LPARAM);
+
+/*----------------------------------------------------------------------------
+** FIXME: Better isolate Wine's reliance on the xxx16 type definitions.
+** For now, we just isolate them to make the situation clear.
+**--------------------------------------------------------------------------*/
+/*
+ * Basic type definitions for 16 bit variations on Windows types.
+ * These types are provided mostly to insure compatibility with
+ * 16 bit windows code.
+ */
+
+#ifndef __WINE_WINDEF16_H
+#define __WINE_WINDEF16_H
+
+#include "windef.h"
+
+/* Standard data types */
+
+typedef short INT16;
+typedef unsigned short UINT16;
+typedef unsigned short WIN_BOOL16;
+
+typedef UINT16 HANDLE16;
+typedef HANDLE16 *LPHANDLE16;
+
+typedef UINT16 WPARAM16;
+typedef INT16 *LPINT16;
+typedef UINT16 *LPUINT16;
+
+#define DECLARE_HANDLE16(a) \
+ typedef HANDLE16 a##16; \
+ typedef a##16 *P##a##16; \
+ typedef a##16 *NP##a##16; \
+ typedef a##16 *LP##a##16
+
+DECLARE_HANDLE16(HACMDRIVERID);
+DECLARE_HANDLE16(HACMDRIVER);
+DECLARE_HANDLE16(HACMOBJ);
+DECLARE_HANDLE16(HACMSTREAM);
+DECLARE_HANDLE16(HMETAFILEPICT);
+
+DECLARE_HANDLE16(HACCEL);
+DECLARE_HANDLE16(HBITMAP);
+DECLARE_HANDLE16(HBRUSH);
+DECLARE_HANDLE16(HCOLORSPACE);
+DECLARE_HANDLE16(HCURSOR);
+DECLARE_HANDLE16(HDC);
+DECLARE_HANDLE16(HDROP);
+DECLARE_HANDLE16(HDRVR);
+DECLARE_HANDLE16(HDWP);
+DECLARE_HANDLE16(HENHMETAFILE);
+DECLARE_HANDLE16(HFILE);
+DECLARE_HANDLE16(HFONT);
+DECLARE_HANDLE16(HICON);
+DECLARE_HANDLE16(HINSTANCE);
+DECLARE_HANDLE16(HKEY);
+DECLARE_HANDLE16(HMENU);
+DECLARE_HANDLE16(HMETAFILE);
+DECLARE_HANDLE16(HMIDI);
+DECLARE_HANDLE16(HMIDIIN);
+DECLARE_HANDLE16(HMIDIOUT);
+DECLARE_HANDLE16(HMIDISTRM);
+DECLARE_HANDLE16(HMIXER);
+DECLARE_HANDLE16(HMIXEROBJ);
+DECLARE_HANDLE16(HMMIO);
+DECLARE_HANDLE16(HPALETTE);
+DECLARE_HANDLE16(HPEN);
+DECLARE_HANDLE16(HQUEUE);
+DECLARE_HANDLE16(HRGN);
+DECLARE_HANDLE16(HRSRC);
+DECLARE_HANDLE16(HTASK);
+DECLARE_HANDLE16(HWAVE);
+DECLARE_HANDLE16(HWAVEIN);
+DECLARE_HANDLE16(HWAVEOUT);
+DECLARE_HANDLE16(HWINSTA);
+DECLARE_HANDLE16(HDESK);
+DECLARE_HANDLE16(HWND);
+DECLARE_HANDLE16(HKL);
+DECLARE_HANDLE16(HIC);
+DECLARE_HANDLE16(HRASCONN);
+#undef DECLARE_HANDLE16
+
+typedef HINSTANCE16 HMODULE16;
+typedef HANDLE16 HGDIOBJ16;
+typedef HANDLE16 HGLOBAL16;
+typedef HANDLE16 HLOCAL16;
+
+/* The SIZE structure */
+typedef struct
+{
+ INT16 cx;
+ INT16 cy;
+} SIZE16, *PSIZE16, *LPSIZE16;
+
+/* The POINT structure */
+
+typedef struct
+{
+ INT16 x;
+ INT16 y;
+} POINT16, *PPOINT16, *LPPOINT16;
+
+/* The RECT structure */
+
+typedef struct
+{
+ INT16 left;
+ INT16 top;
+ INT16 right;
+ INT16 bottom;
+} RECT16, *LPRECT16;
+
+/* Callback function pointers types */
+
+typedef LRESULT CALLBACK (*DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM);
+typedef WIN_BOOL16 CALLBACK (*DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
+typedef INT16 CALLBACK (*EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16);
+typedef LRESULT CALLBACK (*FARPROC16)();
+typedef INT16 CALLBACK (*PROC16)();
+typedef WIN_BOOL16 CALLBACK (*GRAYSTRINGPROC16)(HDC16,LPARAM,INT16);
+typedef LRESULT CALLBACK (*HOOKPROC16)(INT16,WPARAM16,LPARAM);
+typedef WIN_BOOL16 CALLBACK (*PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16);
+typedef VOID CALLBACK (*TIMERPROC16)(HWND16,UINT16,UINT16,DWORD);
+typedef LRESULT CALLBACK (*WNDENUMPROC16)(HWND16,LPARAM);
+typedef LRESULT CALLBACK (*WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
+
+#endif /* __WINE_WINDEF16_H */
+
+/* Define some empty macros for compatibility with Windows code. */
+
+#ifndef __WINE__
+#define NEAR
+#define FAR
+#define near
+#define far
+#define _near
+#define _far
+#define IN
+#define OUT
+#define OPTIONAL
+#endif /* __WINE__ */
+
+/* Macro for structure packing. */
+
+#ifdef __GNUC__
+#ifndef _EGCS_
+#define WINE_PACKED __attribute__((packed))
+#define WINE_UNUSED __attribute__((unused))
+#define WINE_NORETURN __attribute__((noreturn))
+#endif
+#else
+#define WINE_PACKED /* nothing */
+#define WINE_UNUSED /* nothing */
+#define WINE_NORETURN /* nothing */
+#endif
+
+/* Macros to split words and longs. */
+
+#define LOBYTE(w) ((BYTE)(WORD)(w))
+#define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
+
+#define LOWORD(l) ((WORD)(DWORD)(l))
+#define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
+
+#define SLOWORD(l) ((INT16)(LONG)(l))
+#define SHIWORD(l) ((INT16)((LONG)(l) >> 16))
+
+#define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
+#define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
+#define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
+#define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
+#define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
+#define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
+
+#define SELECTOROF(ptr) (HIWORD(ptr))
+#define OFFSETOF(ptr) (LOWORD(ptr))
+
+#ifdef __WINE__
+/* macros to set parts of a DWORD (not in the Windows API) */
+#define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
+#define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
+#define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOWORD(val) & 0xff00))
+#define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
+#endif
+
+/* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
+/* Note: These macros are semantically broken, at least for wrc. wrc
+ spits out data in the platform's current binary format, *not* in
+ little-endian format. These macros are used throughout the resource
+ code to load and store data to the resources. Since it is unlikely
+ that we'll ever be dealing with little-endian resource data, the
+ byte-swapping nature of these macros has been disabled. Rather than
+ remove the use of these macros from the resource loading code, the
+ macros have simply been disabled. In the future, someone may want
+ to reactivate these macros for other purposes. In that case, the
+ resource code will have to be modified to use different macros. */
+
+#if 1
+#define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
+#define GET_WORD(ptr) (*(WORD *)(ptr))
+#define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
+#define GET_DWORD(ptr) (*(DWORD *)(ptr))
+#else
+#define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \
+ *((BYTE *)(ptr) + 1) = HIBYTE(w))
+#define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \
+ (WORD)(*((BYTE *)(ptr)+1) << 8)))
+#define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \
+ PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
+#define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
+ ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
+#endif /* 1 */
+
+/* min and max macros */
+#define __max(a,b) (((a) > (b)) ? (a) : (b))
+#define __min(a,b) (((a) < (b)) ? (a) : (b))
+#ifndef max
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+#ifndef min
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
+#define _MAX_PATH 260
+#define MAX_PATH 260
+#define _MAX_DRIVE 3
+#define _MAX_DIR 256
+#define _MAX_FNAME 255
+#define _MAX_EXT 256
+
+#define HFILE_ERROR16 ((HFILE16)-1)
+#define HFILE_ERROR ((HFILE)-1)
+
+/* The SIZE structure */
+typedef struct tagSIZE
+{
+ INT cx;
+ INT cy;
+} SIZE, *PSIZE, *LPSIZE;
+
+
+typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
+
+#define CONV_SIZE16TO32(s16,s32) \
+ ((s32)->cx = (INT)(s16)->cx, (s32)->cy = (INT)(s16)->cy)
+#define CONV_SIZE32TO16(s32,s16) \
+ ((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy)
+
+/* The POINT structure */
+typedef struct tagPOINT
+{
+ LONG x;
+ LONG y;
+} POINT, *PPOINT, *LPPOINT;
+
+typedef struct _POINTL
+{
+ LONG x;
+ LONG y;
+} POINTL;
+
+#define CONV_POINT16TO32(p16,p32) \
+ ((p32)->x = (INT)(p16)->x, (p32)->y = (INT)(p16)->y)
+#define CONV_POINT32TO16(p32,p16) \
+ ((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y)
+
+#define MAKEPOINT16(l) (*((POINT16 *)&(l)))
+
+/* The POINTS structure */
+
+typedef struct tagPOINTS
+{
+ SHORT x;
+ SHORT y;
+} POINTS, *PPOINTS, *LPPOINTS;
+
+
+#define MAKEPOINTS(l) (*((POINTS *)&(l)))
+
+
+/* The RECT structure */
+typedef struct tagRECT
+{
+ short left;
+ short top;
+ short right;
+ short bottom;
+} RECT, *PRECT, *LPRECT;
+typedef const RECT *LPCRECT;
+
+
+typedef struct tagRECTL
+{
+ LONG left;
+ LONG top;
+ LONG right;
+ LONG bottom;
+} RECTL, *PRECTL, *LPRECTL;
+
+typedef const RECTL *LPCRECTL;
+
+#define CONV_RECT16TO32(r16,r32) \
+ ((r32)->left = (INT)(r16)->left, (r32)->top = (INT)(r16)->top, \
+ (r32)->right = (INT)(r16)->right, (r32)->bottom = (INT)(r16)->bottom)
+#define CONV_RECT32TO16(r32,r16) \
+ ((r16)->left = (INT16)(r32)->left, (r16)->top = (INT16)(r32)->top, \
+ (r16)->right = (INT16)(r32)->right, (r16)->bottom = (INT16)(r32)->bottom)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINE_WINDEF_H */
diff --git a/loader/wine/windows.h b/loader/wine/windows.h
new file mode 100644
index 0000000000..cd62a03272
--- /dev/null
+++ b/loader/wine/windows.h
@@ -0,0 +1,38 @@
+#ifndef __WINE_WINDOWS_H
+#define __WINE_WINDOWS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "shell.h"
+#include "winreg.h"
+#include "winnetwk.h"
+#include "winver.h"
+#include "lzexpand.h"
+#include "shellapi.h"
+#include "ole2.h"
+#include "winnls.h"
+#include "objbase.h"
+#include "winspool.h"
+
+#if 0
+ Where does this belong? Nobody uses this stuff anyway.
+typedef struct {
+ BYTE i; /* much more .... */
+} KANJISTRUCT;
+typedef KANJISTRUCT *LPKANJISTRUCT;
+typedef KANJISTRUCT *NPKANJISTRUCT;
+typedef KANJISTRUCT *PKANJISTRUCT;
+
+
+#endif /* 0 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINE_WINDOWS_H */
diff --git a/loader/wine/winerror.h b/loader/wine/winerror.h
new file mode 100644
index 0000000000..0c78792b9c
--- /dev/null
+++ b/loader/wine/winerror.h
@@ -0,0 +1,1658 @@
+#ifndef __WINE_WINERROR_H
+#define __WINE_WINERROR_H
+
+
+extern int WIN32_LastError;
+
+#define FACILITY_NULL 0
+#define FACILITY_RPC 1
+#define FACILITY_DISPATCH 2
+#define FACILITY_STORAGE 3
+#define FACILITY_ITF 4
+#define FACILITY_WIN32 7
+#define FACILITY_WINDOWS 8
+#define FACILITY_SSPI 9
+#define FACILITY_CONTROL 10
+#define FACILITY_CERT 11
+#define FACILITY_INTERNET 12
+
+#define SEVERITY_ERROR 1
+
+
+#define MAKE_HRESULT(sev,fac,code) \
+ ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
+#define MAKE_SCODE(sev,fac,code) \
+ ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
+#define SUCCEEDED(stat) ((HRESULT)(stat)>=0)
+#define FAILED(stat) ((HRESULT)(stat)<0)
+
+#define HRESULT_CODE(hr) ((hr) & 0xFFFF)
+#define SCODE_CODE(sc) ((sc) & 0xFFFF)
+
+#define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1FFF)
+#define SCODE_FACILITY(sc) (((sc) >> 16) & 0x1FFF)
+
+/* ERROR_UNKNOWN is a placeholder for error conditions which haven't
+ * been tested yet so we're not exactly sure what will be returned.
+ * All instances of ERROR_UNKNOWN should be tested under Win95/NT
+ * and replaced.
+ */
+#define ERROR_UNKNOWN 99999
+
+#define SEVERITY_SUCCESS 0
+#define SEVERITY_ERROR 1
+
+#define NO_ERROR 0
+#define ERROR_SUCCESS 0
+#define ERROR_INVALID_FUNCTION 1
+#define ERROR_FILE_NOT_FOUND 2
+#define ERROR_PATH_NOT_FOUND 3
+#define ERROR_TOO_MANY_OPEN_FILES 4
+#define ERROR_ACCESS_DENIED 5
+#define ERROR_INVALID_HANDLE 6
+#define ERROR_ARENA_TRASHED 7
+#define ERROR_NOT_ENOUGH_MEMORY 8
+#define ERROR_INVALID_BLOCK 9
+#define ERROR_BAD_ENVIRONMENT 10
+#define ERROR_BAD_FORMAT 11
+#define ERROR_INVALID_ACCESS 12
+#define ERROR_INVALID_DATA 13
+#define ERROR_OUTOFMEMORY 14
+#define ERROR_INVALID_DRIVE 15
+#define ERROR_CURRENT_DIRECTORY 16
+#define ERROR_NOT_SAME_DEVICE 17
+#define ERROR_NO_MORE_FILES 18
+#define ERROR_WRITE_PROTECT 19
+#define ERROR_BAD_UNIT 20
+#define ERROR_NOT_READY 21
+#define ERROR_BAD_COMMAND 22
+#define ERROR_CRC 23
+#define ERROR_BAD_LENGTH 24
+#define ERROR_SEEK 25
+#define ERROR_NOT_DOS_DISK 26
+#define ERROR_SECTOR_NOT_FOUND 27
+#define ERROR_OUT_OF_PAPER 28
+#define ERROR_WRITE_FAULT 29
+#define ERROR_READ_FAULT 30
+#define ERROR_GEN_FAILURE 31
+#define ERROR_SHARING_VIOLATION 32
+#define ERROR_LOCK_VIOLATION 33
+#define ERROR_WRONG_DISK 34
+#define ERROR_SHARING_BUFFER_EXCEEDED 36
+#define ERROR_HANDLE_EOF 38
+#define ERROR_HANDLE_DISK_FULL 39
+#define ERROR_NOT_SUPPORTED 50
+#define ERROR_REM_NOT_LIST 51
+#define ERROR_DUP_NAME 52
+#define ERROR_BAD_NETPATH 53
+#define ERROR_NETWORK_BUSY 54
+#define ERROR_DEV_NOT_EXIST 55
+#define ERROR_TOO_MANY_CMDS 56
+#define ERROR_ADAP_HDW_ERR 57
+#define ERROR_BAD_NET_RESP 58
+#define ERROR_UNEXP_NET_ERR 59
+#define ERROR_BAD_REM_ADAP 60
+#define ERROR_PRINTQ_FULL 61
+#define ERROR_NO_SPOOL_SPACE 62
+#define ERROR_PRINT_CANCELLED 63
+#define ERROR_NETNAME_DELETED 64
+#define ERROR_NETWORK_ACCESS_DENIED 65
+#define ERROR_BAD_DEV_TYPE 66
+#define ERROR_BAD_NET_NAME 67
+#define ERROR_TOO_MANY_NAMES 68
+#define ERROR_TOO_MANY_SESS 69
+#define ERROR_SHARING_PAUSED 70
+#define ERROR_REQ_NOT_ACCEP 71
+#define ERROR_REDIR_PAUSED 72
+#define ERROR_FILE_EXISTS 80
+#define ERROR_CANNOT_MAKE 82
+#define ERROR_FAIL_I24 83
+#define ERROR_OUT_OF_STRUCTURES 84
+#define ERROR_ALREADY_ASSIGNED 85
+#define ERROR_INVALID_PASSWORD 86
+#define ERROR_INVALID_PARAMETER 87
+#define ERROR_NET_WRITE_FAULT 88
+#define ERROR_NO_PROC_SLOTS 89
+#define ERROR_TOO_MANY_SEMAPHORES 100
+#define ERROR_EXCL_SEM_ALREADY_OWNED 101
+#define ERROR_SEM_IS_SET 102
+#define ERROR_TOO_MANY_SEM_REQUESTS 103
+#define ERROR_INVALID_AT_INTERRUPT_TIME 104
+#define ERROR_SEM_OWNER_DIED 105
+#define ERROR_SEM_USER_LIMIT 106
+#define ERROR_DISK_CHANGE 107
+#define ERROR_DRIVE_LOCKED 108
+#define ERROR_BROKEN_PIPE 109
+#define ERROR_OPEN_FAILED 110
+#define ERROR_BUFFER_OVERFLOW 111
+#define ERROR_DISK_FULL 112
+#define ERROR_NO_MORE_SEARCH_HANDLES 113
+#define ERROR_INVALID_TARGET_HANDLE 114
+#define ERROR_INVALID_CATEGORY 117
+#define ERROR_INVALID_VERIFY_SWITCH 118
+#define ERROR_BAD_DRIVER_LEVEL 119
+#define ERROR_CALL_NOT_IMPLEMENTED 120
+#define ERROR_SEM_TIMEOUT 121
+#define ERROR_INSUFFICIENT_BUFFER 122
+#define ERROR_INVALID_NAME 123
+#define ERROR_INVALID_LEVEL 124
+#define ERROR_NO_VOLUME_LABEL 125
+#define ERROR_MOD_NOT_FOUND 126
+#define ERROR_PROC_NOT_FOUND 127
+#define ERROR_WAIT_NO_CHILDREN 128
+#define ERROR_CHILD_NOT_COMPLETE 129
+#define ERROR_DIRECT_ACCESS_HANDLE 130
+#define ERROR_NEGATIVE_SEEK 131
+#define ERROR_SEEK_ON_DEVICE 132
+#define ERROR_IS_JOIN_TARGET 133
+#define ERROR_IS_JOINED 134
+#define ERROR_IS_SUBSTED 135
+#define ERROR_NOT_JOINED 136
+#define ERROR_NOT_SUBSTED 137
+#define ERROR_JOIN_TO_JOIN 138
+#define ERROR_SUBST_TO_SUBST 139
+#define ERROR_JOIN_TO_SUBST 140
+#define ERROR_SUBST_TO_JOIN 141
+#define ERROR_BUSY_DRIVE 142
+#define ERROR_SAME_DRIVE 143
+#define ERROR_DIR_NOT_ROOT 144
+#define ERROR_DIR_NOT_EMPTY 145
+#define ERROR_IS_SUBST_PATH 146
+#define ERROR_IS_JOIN_PATH 147
+#define ERROR_PATH_BUSY 148
+#define ERROR_IS_SUBST_TARGET 149
+#define ERROR_SYSTEM_TRACE 150
+#define ERROR_INVALID_EVENT_COUNT 151
+#define ERROR_TOO_MANY_MUXWAITERS 152
+#define ERROR_INVALID_LIST_FORMAT 153
+#define ERROR_LABEL_TOO_LONG 154
+#define ERROR_TOO_MANY_TCBS 155
+#define ERROR_SIGNAL_REFUSED 156
+#define ERROR_DISCARDED 157
+#define ERROR_NOT_LOCKED 158
+#define ERROR_BAD_THREADID_ADDR 159
+#define ERROR_BAD_ARGUMENTS 160
+#define ERROR_BAD_PATHNAME 161
+#define ERROR_SIGNAL_PENDING 162
+#define ERROR_MAX_THRDS_REACHED 164
+#define ERROR_LOCK_FAILED 167
+#define ERROR_BUSY 170
+#define ERROR_CANCEL_VIOLATION 173
+#define ERROR_ATOMIC_LOCKS_NOT_SUPPORTED 174
+#define ERROR_INVALID_SEGMENT_NUMBER 180
+#define ERROR_INVALID_ORDINAL 182
+#define ERROR_ALREADY_EXISTS 183
+#define ERROR_INVALID_FLAG_NUMBER 186
+#define ERROR_SEM_NOT_FOUND 187
+#define ERROR_INVALID_STARTING_CODESEG 188
+#define ERROR_INVALID_STACKSEG 189
+#define ERROR_INVALID_MODULETYPE 190
+#define ERROR_INVALID_EXE_SIGNATURE 191
+#define ERROR_EXE_MARKED_INVALID 192
+#define ERROR_BAD_EXE_FORMAT 193
+#define ERROR_ITERATED_DATA_EXCEEDS_64k 194
+#define ERROR_INVALID_MINALLOCSIZE 195
+#define ERROR_DYNLINK_FROM_INVALID_RING 196
+#define ERROR_IOPL_NOT_ENABLED 197
+#define ERROR_INVALID_SEGDPL 198
+#define ERROR_AUTODATASEG_EXCEEDS_64k 199
+#define ERROR_RING2SEG_MUST_BE_MOVABLE 200
+#define ERROR_RELOC_CHAIN_XEEDS_SEGLIM 201
+#define ERROR_INFLOOP_IN_RELOC_CHAIN 202
+#define ERROR_ENVVAR_NOT_FOUND 203
+#define ERROR_NO_SIGNAL_SENT 205
+#define ERROR_FILENAME_EXCED_RANGE 206
+#define ERROR_RING2_STACK_IN_USE 207
+#define ERROR_META_EXPANSION_TOO_LONG 208
+#define ERROR_INVALID_SIGNAL_NUMBER 209
+#define ERROR_THREAD_1_INACTIVE 210
+#define ERROR_LOCKED 212
+#define ERROR_TOO_MANY_MODULES 214
+#define ERROR_NESTING_NOT_ALLOWED 215
+#define ERROR_EXE_MACHINE_TYPE_MISMATCH 216
+#define ERROR_BAD_PIPE 230
+#define ERROR_PIPE_BUSY 231
+#define ERROR_NO_DATA 232
+#define ERROR_PIPE_NOT_CONNECTED 233
+#define ERROR_MORE_DATA 234
+#define ERROR_VC_DISCONNECTED 240
+#define ERROR_INVALID_EA_NAME 254
+#define ERROR_EA_LIST_INCONSISTENT 255
+#define ERROR_NO_MORE_ITEMS 259
+#define ERROR_CANNOT_COPY 266
+#define ERROR_DIRECTORY 267
+#define ERROR_EAS_DIDNT_FIT 275
+#define ERROR_EA_FILE_CORRUPT 276
+#define ERROR_EA_TABLE_FULL 277
+#define ERROR_INVALID_EA_HANDLE 278
+#define ERROR_EAS_NOT_SUPPORTED 282
+#define ERROR_NOT_OWNER 288
+#define ERROR_TOO_MANY_POSTS 298
+#define ERROR_PARTIAL_COPY 299
+#define ERROR_OPLOCK_NOT_GRANTED 300
+#define ERROR_INVALID_OPLOCK_PROTOCOL 301
+#define ERROR_MR_MID_NOT_FOUND 317
+#define ERROR_INVALID_ADDRESS 487
+#define ERROR_ARITHMETIC_OVERFLOW 534
+#define ERROR_PIPE_CONNECTED 535
+#define ERROR_PIPE_LISTENING 536
+#define ERROR_EA_ACCESS_DENIED 994
+#define ERROR_OPERATION_ABORTED 995
+#define ERROR_IO_INCOMPLETE 996
+#define ERROR_IO_PENDING 997
+#define ERROR_NOACCESS 998
+#define ERROR_SWAPERROR 999
+#define ERROR_STACK_OVERFLOW 1001
+#define ERROR_INVALID_MESSAGE 1002
+#define ERROR_CAN_NOT_COMPLETE 1003
+#define ERROR_INVALID_FLAGS 1004
+#define ERROR_UNRECOGNIZED_VOLUME 1005
+#define ERROR_FILE_INVALID 1006
+#define ERROR_FULLSCREEN_MODE 1007
+#define ERROR_NO_TOKEN 1008
+#define ERROR_BADDB 1009
+#define ERROR_BADKEY 1010
+#define ERROR_CANTOPEN 1011
+#define ERROR_CANTREAD 1012
+#define ERROR_CANTWRITE 1013
+#define ERROR_REGISTRY_RECOVERED 1014
+#define ERROR_REGISTRY_CORRUPT 1015
+#define ERROR_REGISTRY_IO_FAILED 1016
+#define ERROR_NOT_REGISTRY_FILE 1017
+#define ERROR_KEY_DELETED 1018
+#define ERROR_NO_LOG_SPACE 1019
+#define ERROR_KEY_HAS_CHILDREN 1020
+#define ERROR_CHILD_MUST_BE_VOLATILE 1021
+#define ERROR_NOTIFY_ENUM_DIR 1022
+#define ERROR_DEPENDENT_SERVICES_RUNNING 1051
+#define ERROR_INVALID_SERVICE_CONTROL 1052
+#define ERROR_SERVICE_REQUEST_TIMEOUT 1053
+#define ERROR_SERVICE_NO_THREAD 1054
+#define ERROR_SERVICE_DATABASE_LOCKED 1055
+#define ERROR_SERVICE_ALREADY_RUNNING 1056
+#define ERROR_INVALID_SERVICE_ACCOUNT 1057
+#define ERROR_SERVICE_DISABLED 1058
+#define ERROR_CIRCULAR_DEPENDENCY 1059
+#define ERROR_SERVICE_DOES_NOT_EXIST 1060
+#define ERROR_SERVICE_CANNOT_ACCEPT_CTRL 1061
+#define ERROR_SERVICE_NOT_ACTIVE 1062
+#define ERROR_FAILED_SERVICE_CONTROLLER_CONNECT 1063
+#define ERROR_EXCEPTION_IN_SERVICE 1064
+#define ERROR_DATABASE_DOES_NOT_EXIST 1065
+#define ERROR_SERVICE_SPECIFIC_ERROR 1066
+#define ERROR_PROCESS_ABORTED 1067
+#define ERROR_SERVICE_DEPENDENCY_FAIL 1068
+#define ERROR_SERVICE_LOGON_FAILED 1069
+#define ERROR_SERVICE_START_HANG 1070
+#define ERROR_INVALID_SERVICE_LOCK 1071
+#define ERROR_SERVICE_MARKED_FOR_DELETE 1072
+#define ERROR_SERVICE_EXISTS 1073
+#define ERROR_ALREADY_RUNNING_LKG 1074
+#define ERROR_SERVICE_DEPENDENCY_DELETED 1075
+#define ERROR_BOOT_ALREADY_ACCEPTED 1076
+#define ERROR_SERVICE_NEVER_STARTED 1077
+#define ERROR_DUPLICATE_SERVICE_NAME 1078
+#define ERROR_DIFFERENT_SERVICE_ACCOUNT 1079
+#define ERROR_CANNOT_DETECT_DRIVER_FAILURE 1080
+#define ERROR_CANNOT_DETECT_PROCESS_ABORT 1081
+#define ERROR_NO_RECOVERY_PROGRAM 1082
+#define ERROR_SERVICE_NOT_IN_EXE 1083
+#define ERROR_END_OF_MEDIA 1100
+#define ERROR_FILEMARK_DETECTED 1101
+#define ERROR_BEGINNING_OF_MEDIA 1102
+#define ERROR_SETMARK_DETECTED 1103
+#define ERROR_NO_DATA_DETECTED 1104
+#define ERROR_PARTITION_FAILURE 1105
+#define ERROR_INVALID_BLOCK_LENGTH 1106
+#define ERROR_DEVICE_NOT_PARTITIONED 1107
+#define ERROR_UNABLE_TO_LOCK_MEDIA 1108
+#define ERROR_UNABLE_TO_UNLOAD_MEDIA 1109
+#define ERROR_MEDIA_CHANGED 1110
+#define ERROR_BUS_RESET 1111
+#define ERROR_NO_MEDIA_IN_DRIVE 1112
+#define ERROR_NO_UNICODE_TRANSLATION 1113
+#define ERROR_DLL_INIT_FAILED 1114
+#define ERROR_SHUTDOWN_IN_PROGRESS 1115
+#define ERROR_NO_SHUTDOWN_IN_PROGRESS 1116
+#define ERROR_IO_DEVICE 1117
+#define ERROR_SERIAL_NO_DEVICE 1118
+#define ERROR_IRQ_BUSY 1119
+#define ERROR_MORE_WRITES 1120
+#define ERROR_COUNTER_TIMEOUT 1121
+#define ERROR_FLOPPY_ID_MARK_NOT_FOUND 1122
+#define ERROR_FLOPPY_WRONG_CYLINDER 1123
+#define ERROR_FLOPPY_UNKNOWN_ERROR 1124
+#define ERROR_FLOPPY_BAD_REGISTERS 1125
+#define ERROR_DISK_RECALIBRATE_FAILED 1126
+#define ERROR_DISK_OPERATION_FAILED 1127
+#define ERROR_DISK_RESET_FAILED 1128
+#define ERROR_EOM_OVERFLOW 1129
+#define ERROR_NOT_ENOUGH_SERVER_MEMORY 1130
+#define ERROR_POSSIBLE_DEADLOCK 1131
+#define ERROR_MAPPED_ALIGNMENT 1132
+#define ERROR_SET_POWER_STATE_VETOED 1140
+#define ERROR_SET_POWER_STATE_FAILED 1141
+#define ERROR_TOO_MANY_LINKS 1142
+#define ERROR_OLD_WIN_VERSION 1150
+#define ERROR_APP_WRONG_OS 1151
+#define ERROR_SINGLE_INSTANCE_APP 1152
+#define ERROR_RMODE_APP 1153
+#define ERROR_INVALID_DLL 1154
+#define ERROR_NO_ASSOCIATION 1155
+#define ERROR_DDE_FAIL 1156
+#define ERROR_DLL_NOT_FOUND 1157
+#define ERROR_NO_MORE_USER_HANDLES 1158
+#define ERROR_MESSAGE_SYNC_ONLY 1159
+#define ERROR_SOURCE_ELEMENT_EMPTY 1160
+#define ERROR_DESTINATION_ELEMENT_FULL 1161
+#define ERROR_ILLEGAL_ELEMENT_ADDRESS 1162
+#define ERROR_MAGAZINE_NOT_PRESENT 1163
+#define ERROR_DEVICE_REINITIALIZATION_NEEDED 1164
+#define ERROR_DEVICE_REQUIRES_CLEANING 1165
+#define ERROR_DEVICE_DOOR_OPEN 1166
+#define ERROR_DEVICE_NOT_CONNECTED 1167
+#define ERROR_NOT_FOUND 1168
+#define ERROR_NO_MATCH 1169
+#define ERROR_SET_NOT_FOUND 1170
+#define ERROR_POINT_NOT_FOUND 1171
+#define ERROR_NO_TRACKING_SERVICE 1172
+#define ERROR_NO_VOLUME_ID 1173
+#define ERROR_UNABLE_TO_REMOVE_REPLACED 1175
+#define ERROR_UNABLE_TO_MOVE_REPLACEMENT 1176
+#define ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 1177
+#define ERROR_JOURNAL_DELETE_IN_PROGRESS 1178
+#define ERROR_JOURNAL_NOT_ACTIVE 1179
+#define ERROR_POTENTIAL_FILE_FOUND 1180
+#define ERROR_JOURNAL_ENTRY_DELETED 1181
+#define ERROR_BAD_DEVICE 1200
+#define ERROR_CONNECTION_UNAVAIL 1201
+#define ERROR_DEVICE_ALREADY_REMEMBERED 1202
+#define ERROR_NO_NET_OR_BAD_PATH 1203
+#define ERROR_BAD_PROVIDER 1204
+#define ERROR_CANNOT_OPEN_PROFILE 1205
+#define ERROR_BAD_PROFILE 1206
+#define ERROR_NOT_CONTAINER 1207
+#define ERROR_EXTENDED_ERROR 1208
+#define ERROR_INVALID_GROUPNAME 1209
+#define ERROR_INVALID_COMPUTERNAME 1210
+#define ERROR_INVALID_EVENTNAME 1211
+#define ERROR_INVALID_DOMAINNAME 1212
+#define ERROR_INVALID_SERVICENAME 1213
+#define ERROR_INVALID_NETNAME 1214
+#define ERROR_INVALID_SHARENAME 1215
+#define ERROR_INVALID_PASSWORDNAME 1216
+#define ERROR_INVALID_MESSAGENAME 1217
+#define ERROR_INVALID_MESSAGEDEST 1218
+#define ERROR_SESSION_CREDENTIAL_CONFLICT 1219
+#define ERROR_REMOTE_SESSION_LIMIT_EXCEEDED 1220
+#define ERROR_DUP_DOMAINNAME 1221
+#define ERROR_NO_NETWORK 1222
+#define ERROR_CANCELLED 1223
+#define ERROR_USER_MAPPED_FILE 1224
+#define ERROR_CONNECTION_REFUSED 1225
+#define ERROR_GRACEFUL_DISCONNECT 1226
+#define ERROR_ADDRESS_ALREADY_ASSOCIATED 1227
+#define ERROR_ADDRESS_NOT_ASSOCIATED 1228
+#define ERROR_CONNECTION_INVALID 1229
+#define ERROR_CONNECTION_ACTIVE 1230
+#define ERROR_NETWORK_UNREACHABLE 1231
+#define ERROR_HOST_UNREACHABLE 1232
+#define ERROR_PROTOCOL_UNREACHABLE 1233
+#define ERROR_PORT_UNREACHABLE 1234
+#define ERROR_REQUEST_ABORTED 1235
+#define ERROR_CONNECTION_ABORTED 1236
+#define ERROR_RETRY 1237
+#define ERROR_CONNECTION_COUNT_LIMIT 1238
+#define ERROR_LOGIN_TIME_RESTRICTION 1239
+#define ERROR_LOGIN_WKSTA_RESTRICTION 1240
+#define ERROR_INCORRECT_ADDRESS 1241
+#define ERROR_ALREADY_REGISTERED 1242
+#define ERROR_SERVICE_NOT_FOUND 1243
+#define ERROR_NOT_AUTHENTICATED 1244
+#define ERROR_NOT_LOGGED_ON 1245
+#define ERROR_CONTINUE 1246
+#define ERROR_ALREADY_INITIALIZED 1247
+#define ERROR_NO_MORE_DEVICES 1248
+#define ERROR_NO_SUCH_SITE 1249
+#define ERROR_DOMAIN_CONTROLLER_EXISTS 1250
+#define ERROR_ONLY_IF_CONNECTED 1251
+#define ERROR_OVERRIDE_NOCHANGES 1252
+#define ERROR_BAD_USER_PROFILE 1253
+#define ERROR_NOT_SUPPORTED_ON_SBS 1254
+#define ERROR_NOT_ALL_ASSIGNED 1300
+#define ERROR_SOME_NOT_MAPPED 1301
+#define ERROR_NO_QUOTAS_FOR_ACCOUNT 1302
+#define ERROR_LOCAL_USER_SESSION_KEY 1303
+#define ERROR_NULL_LM_PASSWORD 1304
+#define ERROR_UNKNOWN_REVISION 1305
+#define ERROR_REVISION_MISMATCH 1306
+#define ERROR_INVALID_OWNER 1307
+#define ERROR_INVALID_PRIMARY_GROUP 1308
+#define ERROR_NO_IMPERSONATION_TOKEN 1309
+#define ERROR_CANT_DISABLE_MANDATORY 1310
+#define ERROR_NO_LOGON_SERVERS 1311
+#define ERROR_NO_SUCH_LOGON_SESSION 1312
+#define ERROR_NO_SUCH_PRIVILEGE 1313
+#define ERROR_PRIVILEGE_NOT_HELD 1314
+#define ERROR_INVALID_ACCOUNT_NAME 1315
+#define ERROR_USER_EXISTS 1316
+#define ERROR_NO_SUCH_USER 1317
+#define ERROR_GROUP_EXISTS 1318
+#define ERROR_NO_SUCH_GROUP 1319
+#define ERROR_MEMBER_IN_GROUP 1320
+#define ERROR_MEMBER_NOT_IN_GROUP 1321
+#define ERROR_LAST_ADMIN 1322
+#define ERROR_WRONG_PASSWORD 1323
+#define ERROR_ILL_FORMED_PASSWORD 1324
+#define ERROR_PASSWORD_RESTRICTION 1325
+#define ERROR_LOGON_FAILURE 1326
+#define ERROR_ACCOUNT_RESTRICTION 1327
+#define ERROR_INVALID_LOGON_HOURS 1328
+#define ERROR_INVALID_WORKSTATION 1329
+#define ERROR_PASSWORD_EXPIRED 1330
+#define ERROR_ACCOUNT_DISABLED 1331
+#define ERROR_NONE_MAPPED 1332
+#define ERROR_TOO_MANY_LUIDS_REQUESTED 1333
+#define ERROR_LUIDS_EXHAUSTED 1334
+#define ERROR_INVALID_SUB_AUTHORITY 1335
+#define ERROR_INVALID_ACL 1336
+#define ERROR_INVALID_SID 1337
+#define ERROR_INVALID_SECURITY_DESCR 1338
+#define ERROR_BAD_INHERITANCE_ACL 1340
+#define ERROR_SERVER_DISABLED 1341
+#define ERROR_SERVER_NOT_DISABLED 1342
+#define ERROR_INVALID_ID_AUTHORITY 1343
+#define ERROR_ALLOTTED_SPACE_EXCEEDED 1344
+#define ERROR_INVALID_GROUP_ATTRIBUTES 1345
+#define ERROR_BAD_IMPERSONATION_LEVEL 1346
+#define ERROR_CANT_OPEN_ANONYMOUS 1347
+#define ERROR_BAD_VALIDATION_CLASS 1348
+#define ERROR_BAD_TOKEN_TYPE 1349
+#define ERROR_NO_SECURITY_ON_OBJECT 1350
+#define ERROR_CANT_ACCESS_DOMAIN_INFO 1351
+#define ERROR_INVALID_SERVER_STATE 1352
+#define ERROR_INVALID_DOMAIN_STATE 1353
+#define ERROR_INVALID_DOMAIN_ROLE 1354
+#define ERROR_NO_SUCH_DOMAIN 1355
+#define ERROR_DOMAIN_EXISTS 1356
+#define ERROR_DOMAIN_LIMIT_EXCEEDED 1357
+#define ERROR_INTERNAL_DB_CORRUPTION 1358
+#define ERROR_INTERNAL_ERROR 1359
+#define ERROR_GENERIC_NOT_MAPPED 1360
+#define ERROR_BAD_DESCRIPTOR_FORMAT 1361
+#define ERROR_NOT_LOGON_PROCESS 1362
+#define ERROR_LOGON_SESSION_EXISTS 1363
+#define ERROR_NO_SUCH_PACKAGE 1364
+#define ERROR_BAD_LOGON_SESSION_STATE 1365
+#define ERROR_LOGON_SESSION_COLLISION 1366
+#define ERROR_INVALID_LOGON_TYPE 1367
+#define ERROR_CANNOT_IMPERSONATE 1368
+#define ERROR_RXACT_INVALID_STATE 1369
+#define ERROR_RXACT_COMMIT_FAILURE 1370
+#define ERROR_SPECIAL_ACCOUNT 1371
+#define ERROR_SPECIAL_GROUP 1372
+#define ERROR_SPECIAL_USER 1373
+#define ERROR_MEMBERS_PRIMARY_GROUP 1374
+#define ERROR_TOKEN_ALREADY_IN_USE 1375
+#define ERROR_NO_SUCH_ALIAS 1376
+#define ERROR_MEMBER_NOT_IN_ALIAS 1377
+#define ERROR_MEMBER_IN_ALIAS 1378
+#define ERROR_ALIAS_EXISTS 1379
+#define ERROR_LOGON_NOT_GRANTED 1380
+#define ERROR_TOO_MANY_SECRETS 1381
+#define ERROR_SECRET_TOO_LONG 1382
+#define ERROR_INTERNAL_DB_ERROR 1383
+#define ERROR_TOO_MANY_CONTEXT_IDS 1384
+#define ERROR_LOGON_TYPE_NOT_GRANTED 1385
+#define ERROR_NT_CROSS_ENCRYPTION_REQUIRED 1386
+#define ERROR_NO_SUCH_MEMBER 1387
+#define ERROR_INVALID_MEMBER 1388
+#define ERROR_TOO_MANY_SIDS 1389
+#define ERROR_LM_CROSS_ENCRYPTION_REQUIRED 1390
+#define ERROR_NO_INHERITANCE 1391
+#define ERROR_FILE_CORRUPT 1392
+#define ERROR_DISK_CORRUPT 1393
+#define ERROR_NO_USER_SESSION_KEY 1394
+#define ERROR_LICENSE_QUOTA_EXCEEDED 1395
+#define ERROR_WRONG_TARGET_NAME 1396
+#define ERROR_MUTUAL_AUTH_FAILED 1397
+#define ERROR_TIME_SKEW 1398
+#define ERROR_INVALID_WINDOW_HANDLE 1400
+#define ERROR_INVALID_MENU_HANDLE 1401
+#define ERROR_INVALID_CURSOR_HANDLE 1402
+#define ERROR_INVALID_ACCEL_HANDLE 1403
+#define ERROR_INVALID_HOOK_HANDLE 1404
+#define ERROR_INVALID_DWP_HANDLE 1405
+#define ERROR_TLW_WITH_WSCHILD 1406
+#define ERROR_CANNOT_FIND_WND_CLASS 1407
+#define ERROR_WINDOW_OF_OTHER_THREAD 1408
+#define ERROR_HOTKEY_ALREADY_REGISTERED 1409
+#define ERROR_CLASS_ALREADY_EXISTS 1410
+#define ERROR_CLASS_DOES_NOT_EXIST 1411
+#define ERROR_CLASS_HAS_WINDOWS 1412
+#define ERROR_INVALID_INDEX 1413
+#define ERROR_INVALID_ICON_HANDLE 1414
+#define ERROR_PRIVATE_DIALOG_INDEX 1415
+#define ERROR_LISTBOX_ID_NOT_FOUND 1416
+#define ERROR_NO_WILDCARD_CHARACTERS 1417
+#define ERROR_CLIPBOARD_NOT_OPEN 1418
+#define ERROR_HOTKEY_NOT_REGISTERED 1419
+#define ERROR_WINDOW_NOT_DIALOG 1420
+#define ERROR_CONTROL_ID_NOT_FOUND 1421
+#define ERROR_INVALID_COMBOBOX_MESSAGE 1422
+#define ERROR_WINDOW_NOT_COMBOBOX 1423
+#define ERROR_INVALID_EDIT_HEIGHT 1424
+#define ERROR_DC_NOT_FOUND 1425
+#define ERROR_INVALID_HOOK_FILTER 1426
+#define ERROR_INVALID_FILTER_PROC 1427
+#define ERROR_HOOK_NEEDS_HMOD 1428
+#define ERROR_GLOBAL_ONLY_HOOK 1429
+#define ERROR_JOURNAL_HOOK_SET 1430
+#define ERROR_HOOK_NOT_INSTALLED 1431
+#define ERROR_INVALID_LB_MESSAGE 1432
+#define ERROR_SETCOUNT_ON_BAD_LB 1433
+#define ERROR_LB_WITHOUT_TABSTOPS 1434
+#define ERROR_DESTROY_OBJECT_OF_OTHER_THREAD 1435
+#define ERROR_CHILD_WINDOW_MENU 1436
+#define ERROR_NO_SYSTEM_MENU 1437
+#define ERROR_INVALID_MSGBOX_STYLE 1438
+#define ERROR_INVALID_SPI_VALUE 1439
+#define ERROR_SCREEN_ALREADY_LOCKED 1440
+#define ERROR_HWNDS_HAVE_DIFF_PARENT 1441
+#define ERROR_NOT_CHILD_WINDOW 1442
+#define ERROR_INVALID_GW_COMMAND 1443
+#define ERROR_INVALID_THREAD_ID 1444
+#define ERROR_NON_MDICHILD_WINDOW 1445
+#define ERROR_POPUP_ALREADY_ACTIVE 1446
+#define ERROR_NO_SCROLLBARS 1447
+#define ERROR_INVALID_SCROLLBAR_RANGE 1448
+#define ERROR_INVALID_SHOWWIN_COMMAND 1449
+#define ERROR_NO_SYSTEM_RESOURCES 1450
+#define ERROR_NONPAGED_SYSTEM_RESOURCES 1451
+#define ERROR_PAGED_SYSTEM_RESOURCES 1452
+#define ERROR_WORKING_SET_QUOTA 1453
+#define ERROR_PAGEFILE_QUOTA 1454
+#define ERROR_COMMITMENT_LIMIT 1455
+#define ERROR_MENU_ITEM_NOT_FOUND 1456
+#define ERROR_INVALID_KEYBOARD_HANDLE 1457
+#define ERROR_HOOK_TYPE_NOT_ALLOWED 1458
+#define ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION 1459
+#define ERROR_TIMEOUT 1460
+#define ERROR_INVALID_MONITOR_HANDLE 1461
+#define ERROR_EVENTLOG_FILE_CORRUPT 1500
+#define ERROR_EVENTLOG_CANT_START 1501
+#define ERROR_LOG_FILE_FULL 1502
+#define ERROR_EVENTLOG_FILE_CHANGED 1503
+#define ERROR_INSTALL_SERVICE_FAILURE 1601
+#define ERROR_INSTALL_USEREXIT 1602
+#define ERROR_INSTALL_FAILURE 1603
+#define ERROR_INSTALL_SUSPEND 1604
+#define ERROR_UNKNOWN_PRODUCT 1605
+#define ERROR_UNKNOWN_FEATURE 1606
+#define ERROR_UNKNOWN_COMPONENT 1607
+#define ERROR_UNKNOWN_PROPERTY 1608
+#define ERROR_INVALID_HANDLE_STATE 1609
+#define ERROR_BAD_CONFIGURATION 1610
+#define ERROR_INDEX_ABSENT 1611
+#define ERROR_INSTALL_SOURCE_ABSENT 1612
+#define ERROR_INSTALL_PACKAGE_VERSION 1613
+#define ERROR_PRODUCT_UNINSTALLED 1614
+#define ERROR_BAD_QUERY_SYNTAX 1615
+#define ERROR_INVALID_FIELD 1616
+#define ERROR_DEVICE_REMOVED 1617
+#define ERROR_INSTALL_ALREADY_RUNNING 1618
+#define ERROR_INSTALL_PACKAGE_OPEN_FAILED 1619
+#define ERROR_INSTALL_PACKAGE_INVALID 1620
+#define ERROR_INSTALL_UI_FAILURE 1621
+#define ERROR_INSTALL_LOG_FAILURE 1622
+#define ERROR_INSTALL_LANGUAGE_UNSUPPORTED 1623
+#define ERROR_INSTALL_TRANSFORM_FAILURE 1624
+#define ERROR_INSTALL_PACKAGE_REJECTED 1625
+#define ERROR_FUNCTION_NOT_CALLED 1626
+#define ERROR_FUNCTION_FAILED 1627
+#define ERROR_INVALID_TABLE 1628
+#define ERROR_DATATYPE_MISMATCH 1629
+#define ERROR_UNSUPPORTED_TYPE 1630
+#define ERROR_CREATE_FAILED 1631
+#define ERROR_INSTALL_TEMP_UNWRITABLE 1632
+#define ERROR_INSTALL_PLATFORM_UNSUPPORTED 1633
+#define ERROR_INSTALL_NOTUSED 1634
+#define ERROR_PATCH_PACKAGE_OPEN_FAILED 1635
+#define ERROR_PATCH_PACKAGE_INVALID 1636
+#define ERROR_PATCH_PACKAGE_UNSUPPORTED 1637
+#define ERROR_PRODUCT_VERSION 1638
+#define ERROR_INVALID_COMMAND_LINE 1639
+#define ERROR_INSTALL_REMOTE_DISALLOWED 1640
+#define ERROR_SUCCESS_REBOOT_INITIATED 1641
+#define RPC_S_INVALID_STRING_BINDING 1700
+#define RPC_S_WRONG_KIND_OF_BINDING 1701
+#define RPC_S_INVALID_BINDING 1702
+#define RPC_S_PROTSEQ_NOT_SUPPORTED 1703
+#define RPC_S_INVALID_RPC_PROTSEQ 1704
+#define RPC_S_INVALID_STRING_UUID 1705
+#define RPC_S_INVALID_ENDPOINT_FORMAT 1706
+#define RPC_S_INVALID_NET_ADDR 1707
+#define RPC_S_NO_ENDPOINT_FOUND 1708
+#define RPC_S_INVALID_TIMEOUT 1709
+#define RPC_S_OBJECT_NOT_FOUND 1710
+#define RPC_S_ALREADY_REGISTERED 1711
+#define RPC_S_TYPE_ALREADY_REGISTERED 1712
+#define RPC_S_ALREADY_LISTENING 1713
+#define RPC_S_NO_PROTSEQS_REGISTERED 1714
+#define RPC_S_NOT_LISTENING 1715
+#define RPC_S_UNKNOWN_MGR_TYPE 1716
+#define RPC_S_UNKNOWN_IF 1717
+#define RPC_S_NO_BINDINGS 1718
+#define RPC_S_NO_PROTSEQS 1719
+#define RPC_S_CANT_CREATE_ENDPOINT 1720
+#define RPC_S_OUT_OF_RESOURCES 1721
+#define RPC_S_SERVER_UNAVAILABLE 1722
+#define RPC_S_SERVER_TOO_BUSY 1723
+#define RPC_S_INVALID_NETWORK_OPTIONS 1724
+#define RPC_S_NO_CALL_ACTIVE 1725
+#define RPC_S_CALL_FAILED 1726
+#define RPC_S_CALL_FAILED_DNE 1727
+#define RPC_S_PROTOCOL_ERROR 1728
+#define RPC_S_UNSUPPORTED_TRANS_SYN 1730
+#define RPC_S_UNSUPPORTED_TYPE 1732
+#define RPC_S_INVALID_TAG 1733
+#define RPC_S_INVALID_BOUND 1734
+#define RPC_S_NO_ENTRY_NAME 1735
+#define RPC_S_INVALID_NAME_SYNTAX 1736
+#define RPC_S_UNSUPPORTED_NAME_SYNTAX 1737
+#define RPC_S_UUID_NO_ADDRESS 1739
+#define RPC_S_DUPLICATE_ENDPOINT 1740
+#define RPC_S_UNKNOWN_AUTHN_TYPE 1741
+#define RPC_S_MAX_CALLS_TOO_SMALL 1742
+#define RPC_S_STRING_TOO_LONG 1743
+#define RPC_S_PROTSEQ_NOT_FOUND 1744
+#define RPC_S_PROCNUM_OUT_OF_RANGE 1745
+#define RPC_S_BINDING_HAS_NO_AUTH 1746
+#define RPC_S_UNKNOWN_AUTHN_SERVICE 1747
+#define RPC_S_UNKNOWN_AUTHN_LEVEL 1748
+#define RPC_S_INVALID_AUTH_IDENTITY 1749
+#define RPC_S_UNKNOWN_AUTHZ_SERVICE 1750
+#define EPT_S_INVALID_ENTRY 1751
+#define EPT_S_CANT_PERFORM_OP 1752
+#define EPT_S_NOT_REGISTERED 1753
+#define RPC_S_NOTHING_TO_EXPORT 1754
+#define RPC_S_INCOMPLETE_NAME 1755
+#define RPC_S_INVALID_VERS_OPTION 1756
+#define RPC_S_NO_MORE_MEMBERS 1757
+#define RPC_S_NOT_ALL_OBJS_UNEXPORTED 1758
+#define RPC_S_INTERFACE_NOT_FOUND 1759
+#define RPC_S_ENTRY_ALREADY_EXISTS 1760
+#define RPC_S_ENTRY_NOT_FOUND 1761
+#define RPC_S_NAME_SERVICE_UNAVAILABLE 1762
+#define RPC_S_INVALID_NAF_ID 1763
+#define RPC_S_CANNOT_SUPPORT 1764
+#define RPC_S_NO_CONTEXT_AVAILABLE 1765
+#define RPC_S_INTERNAL_ERROR 1766
+#define RPC_S_ZERO_DIVIDE 1767
+#define RPC_S_ADDRESS_ERROR 1768
+#define RPC_S_FP_DIV_ZERO 1769
+#define RPC_S_FP_UNDERFLOW 1770
+#define RPC_S_FP_OVERFLOW 1771
+#define RPC_X_NO_MORE_ENTRIES 1772
+#define RPC_X_SS_CHAR_TRANS_OPEN_FAIL 1773
+#define RPC_X_SS_CHAR_TRANS_SHORT_FILE 1774
+#define RPC_X_SS_IN_NULL_CONTEXT 1775
+#define RPC_X_SS_CONTEXT_DAMAGED 1777
+#define RPC_X_SS_HANDLES_MISMATCH 1778
+#define RPC_X_SS_CANNOT_GET_CALL_HANDLE 1779
+#define RPC_X_NULL_REF_POINTER 1780
+#define RPC_X_ENUM_VALUE_OUT_OF_RANGE 1781
+#define RPC_X_BYTE_COUNT_TOO_SMALL 1782
+#define RPC_X_BAD_STUB_DATA 1783
+#define ERROR_INVALID_USER_BUFFER 1784
+#define ERROR_UNRECOGNIZED_MEDIA 1785
+#define ERROR_NO_TRUST_LSA_SECRET 1786
+#define ERROR_NO_TRUST_SAM_ACCOUNT 1787
+#define ERROR_TRUSTED_DOMAIN_FAILURE 1788
+#define ERROR_TRUSTED_RELATIONSHIP_FAILURE 1789
+#define ERROR_TRUST_FAILURE 1790
+#define RPC_S_CALL_IN_PROGRESS 1791
+#define ERROR_NETLOGON_NOT_STARTED 1792
+#define ERROR_ACCOUNT_EXPIRED 1793
+#define ERROR_REDIRECTOR_HAS_OPEN_HANDLES 1794
+#define ERROR_PRINTER_DRIVER_ALREADY_INSTALLED 1795
+#define ERROR_UNKNOWN_PORT 1796
+#define ERROR_UNKNOWN_PRINTER_DRIVER 1797
+#define ERROR_UNKNOWN_PRINTPROCESSOR 1798
+#define ERROR_INVALID_SEPARATOR_FILE 1799
+#define ERROR_INVALID_PRIORITY 1800
+#define ERROR_INVALID_PRINTER_NAME 1801
+#define ERROR_PRINTER_ALREADY_EXISTS 1802
+#define ERROR_INVALID_PRINTER_COMMAND 1803
+#define ERROR_INVALID_DATATYPE 1804
+#define ERROR_INVALID_ENVIRONMENT 1805
+#define RPC_S_NO_MORE_BINDINGS 1806
+#define ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 1807
+#define ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT 1808
+#define ERROR_NOLOGON_SERVER_TRUST_ACCOUNT 1809
+#define ERROR_DOMAIN_TRUST_INCONSISTENT 1810
+#define ERROR_SERVER_HAS_OPEN_HANDLES 1811
+#define ERROR_RESOURCE_DATA_NOT_FOUND 1812
+#define ERROR_RESOURCE_TYPE_NOT_FOUND 1813
+#define ERROR_RESOURCE_NAME_NOT_FOUND 1814
+#define ERROR_RESOURCE_LANG_NOT_FOUND 1815
+#define ERROR_NOT_ENOUGH_QUOTA 1816
+#define RPC_S_NO_INTERFACES 1817
+#define RPC_S_CALL_CANCELLED 1818
+#define RPC_S_BINDING_INCOMPLETE 1819
+#define RPC_S_COMM_FAILURE 1820
+#define RPC_S_UNSUPPORTED_AUTHN_LEVEL 1821
+#define RPC_S_NO_PRINC_NAME 1822
+#define RPC_S_NOT_RPC_ERROR 1823
+#define RPC_S_UUID_LOCAL_ONLY 1824
+#define RPC_S_SEC_PKG_ERROR 1825
+#define RPC_S_NOT_CANCELLED 1826
+#define RPC_X_INVALID_ES_ACTION 1827
+#define RPC_X_WRONG_ES_VERSION 1828
+#define RPC_X_WRONG_STUB_VERSION 1829
+#define RPC_X_INVALID_PIPE_OBJECT 1830
+#define RPC_X_WRONG_PIPE_ORDER 1831
+#define RPC_X_WRONG_PIPE_VERSION 1832
+#define RPC_S_GROUP_MEMBER_NOT_FOUND 1898
+#define EPT_S_CANT_CREATE 1899
+#define RPC_S_INVALID_OBJECT 1900
+#define ERROR_INVALID_TIME 1901
+#define ERROR_INVALID_FORM_NAME 1902
+#define ERROR_INVALID_FORM_SIZE 1903
+#define ERROR_ALREADY_WAITING 1904
+#define ERROR_PRINTER_DELETED 1905
+#define ERROR_INVALID_PRINTER_STATE 1906
+#define ERROR_PASSWORD_MUST_CHANGE 1907
+#define ERROR_DOMAIN_CONTROLLER_NOT_FOUND 1908
+#define ERROR_ACCOUNT_LOCKED_OUT 1909
+#define OR_INVALID_OXID 1910
+#define OR_INVALID_OID 1911
+#define OR_INVALID_SET 1912
+#define RPC_S_SEND_INCOMPLETE 1913
+#define RPC_S_INVALID_ASYNC_HANDLE 1914
+#define RPC_S_INVALID_ASYNC_CALL 1915
+#define RPC_X_PIPE_CLOSED 1916
+#define RPC_X_PIPE_DISCIPLINE_ERROR 1917
+#define RPC_X_PIPE_EMPTY 1918
+#define ERROR_NO_SITENAME 1919
+#define ERROR_CANT_ACCESS_FILE 1920
+#define ERROR_CANT_RESOLVE_FILENAME 1921
+#define RPC_S_ENTRY_TYPE_MISMATCH 1922
+#define RPC_S_NOT_ALL_OBJS_EXPORTED 1923
+#define RPC_S_INTERFACE_NOT_EXPORTED 1924
+#define RPC_S_PROFILE_NOT_ADDED 1925
+#define RPC_S_PRF_ELT_NOT_ADDED 1926
+#define RPC_S_PRF_ELT_NOT_REMOVED 1927
+#define RPC_S_GRP_ELT_NOT_ADDED 1928
+#define RPC_S_GRP_ELT_NOT_REMOVED 1929
+#define ERROR_INVALID_PIXEL_FORMAT 2000
+#define ERROR_BAD_DRIVER 2001
+#define ERROR_INVALID_WINDOW_STYLE 2002
+#define ERROR_METAFILE_NOT_SUPPORTED 2003
+#define ERROR_TRANSFORM_NOT_SUPPORTED 2004
+#define ERROR_CLIPPING_NOT_SUPPORTED 2005
+#define ERROR_INVALID_CMM 2010
+#define ERROR_INVALID_PROFILE 2011
+#define ERROR_TAG_NOT_FOUND 2012
+#define ERROR_TAG_NOT_PRESENT 2013
+#define ERROR_DUPLICATE_TAG 2014
+#define ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE 2015
+#define ERROR_PROFILE_NOT_FOUND 2016
+#define ERROR_INVALID_COLORSPACE 2017
+#define ERROR_ICM_NOT_ENABLED 2018
+#define ERROR_DELETING_ICM_XFORM 2019
+#define ERROR_INVALID_TRANSFORM 2020
+#define ERROR_COLORSPACE_MISMATCH 2021
+#define ERROR_INVALID_COLORINDEX 2022
+#define ERROR_CONNECTED_OTHER_PASSWORD 2108
+#define ERROR_BAD_USERNAME 2202
+#define ERROR_NOT_CONNECTED 2250
+#define ERROR_OPEN_FILES 2401
+#define ERROR_ACTIVE_CONNECTIONS 2402
+#define ERROR_DEVICE_IN_USE 2404
+#define ERROR_UNKNOWN_PRINT_MONITOR 3000
+#define ERROR_PRINTER_DRIVER_IN_USE 3001
+#define ERROR_SPOOL_FILE_NOT_FOUND 3002
+#define ERROR_SPL_NO_STARTDOC 3003
+#define ERROR_SPL_NO_ADDJOB 3004
+#define ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED 3005
+#define ERROR_PRINT_MONITOR_ALREADY_INSTALLED 3006
+#define ERROR_INVALID_PRINT_MONITOR 3007
+#define ERROR_PRINT_MONITOR_IN_USE 3008
+#define ERROR_PRINTER_HAS_JOBS_QUEUED 3009
+#define ERROR_SUCCESS_REBOOT_REQUIRED 3010
+#define ERROR_SUCCESS_RESTART_REQUIRED 3011
+#define ERROR_PRINTER_NOT_FOUND 3012
+#define ERROR_WINS_INTERNAL 4000
+#define ERROR_CAN_NOT_DEL_LOCAL_WINS 4001
+#define ERROR_STATIC_INIT 4002
+#define ERROR_INC_BACKUP 4003
+#define ERROR_FULL_BACKUP 4004
+#define ERROR_REC_NON_EXISTENT 4005
+#define ERROR_RPL_NOT_ALLOWED 4006
+#define ERROR_DHCP_ADDRESS_CONFLICT 4100
+#define ERROR_WMI_GUID_NOT_FOUND 4200
+#define ERROR_WMI_INSTANCE_NOT_FOUND 4201
+#define ERROR_WMI_ITEMID_NOT_FOUND 4202
+#define ERROR_WMI_TRY_AGAIN 4203
+#define ERROR_WMI_DP_NOT_FOUND 4204
+#define ERROR_WMI_UNRESOLVED_INSTANCE_REF 4205
+#define ERROR_WMI_ALREADY_ENABLED 4206
+#define ERROR_WMI_GUID_DISCONNECTED 4207
+#define ERROR_WMI_SERVER_UNAVAILABLE 4208
+#define ERROR_WMI_DP_FAILED 4209
+#define ERROR_WMI_INVALID_MOF 4210
+#define ERROR_WMI_INVALID_REGINFO 4211
+#define ERROR_WMI_ALREADY_DISABLED 4212
+#define ERROR_WMI_READ_ONLY 4213
+#define ERROR_WMI_SET_FAILURE 4214
+#define ERROR_INVALID_MEDIA 4300
+#define ERROR_INVALID_LIBRARY 4301
+#define ERROR_INVALID_MEDIA_POOL 4302
+#define ERROR_DRIVE_MEDIA_MISMATCH 4303
+#define ERROR_MEDIA_OFFLINE 4304
+#define ERROR_LIBRARY_OFFLINE 4305
+#define ERROR_EMPTY 4306
+#define ERROR_NOT_EMPTY 4307
+#define ERROR_MEDIA_UNAVAILABLE 4308
+#define ERROR_RESOURCE_DISABLED 4309
+#define ERROR_INVALID_CLEANER 4310
+#define ERROR_UNABLE_TO_CLEAN 4311
+#define ERROR_OBJECT_NOT_FOUND 4312
+#define ERROR_DATABASE_FAILURE 4313
+#define ERROR_DATABASE_FULL 4314
+#define ERROR_MEDIA_INCOMPATIBLE 4315
+#define ERROR_RESOURCE_NOT_PRESENT 4316
+#define ERROR_INVALID_OPERATION 4317
+#define ERROR_MEDIA_NOT_AVAILABLE 4318
+#define ERROR_DEVICE_NOT_AVAILABLE 4319
+#define ERROR_REQUEST_REFUSED 4320
+#define ERROR_INVALID_DRIVE_OBJECT 4321
+#define ERROR_LIBRARY_FULL 4322
+#define ERROR_MEDIUM_NOT_ACCESSIBLE 4323
+#define ERROR_UNABLE_TO_LOAD_MEDIUM 4324
+#define ERROR_UNABLE_TO_INVENTORY_DRIVE 4325
+#define ERROR_UNABLE_TO_INVENTORY_SLOT 4326
+#define ERROR_UNABLE_TO_INVENTORY_TRANSPORT 4327
+#define ERROR_TRANSPORT_FULL 4328
+#define ERROR_CONTROLLING_IEPORT 4329
+#define ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA 4330
+#define ERROR_CLEANER_SLOT_SET 4331
+#define ERROR_CLEANER_SLOT_NOT_SET 4332
+#define ERROR_CLEANER_CARTRIDGE_SPENT 4333
+#define ERROR_UNEXPECTED_OMID 4334
+#define ERROR_CANT_DELETE_LAST_ITEM 4335
+#define ERROR_MESSAGE_EXCEEDS_MAX_SIZE 4336
+#define ERROR_VOLUME_CONTAINS_SYS_FILES 4337
+#define ERROR_INDIGENOUS_TYPE 4338
+#define ERROR_NO_SUPPORTING_DRIVES 4339
+#define ERROR_FILE_OFFLINE 4350
+#define ERROR_REMOTE_STORAGE_NOT_ACTIVE 4351
+#define ERROR_REMOTE_STORAGE_MEDIA_ERROR 4352
+#define ERROR_NOT_A_REPARSE_POINT 4390
+#define ERROR_REPARSE_ATTRIBUTE_CONFLICT 4391
+#define ERROR_INVALID_REPARSE_DATA 4392
+#define ERROR_REPARSE_TAG_INVALID 4393
+#define ERROR_REPARSE_TAG_MISMATCH 4394
+#define ERROR_VOLUME_NOT_SIS_ENABLED 4500
+#define ERROR_DEPENDENT_RESOURCE_EXISTS 5001
+#define ERROR_DEPENDENCY_NOT_FOUND 5002
+#define ERROR_DEPENDENCY_ALREADY_EXISTS 5003
+#define ERROR_RESOURCE_NOT_ONLINE 5004
+#define ERROR_HOST_NODE_NOT_AVAILABLE 5005
+#define ERROR_RESOURCE_NOT_AVAILABLE 5006
+#define ERROR_RESOURCE_NOT_FOUND 5007
+#define ERROR_SHUTDOWN_CLUSTER 5008
+#define ERROR_CANT_EVICT_ACTIVE_NODE 5009
+#define ERROR_OBJECT_ALREADY_EXISTS 5010
+#define ERROR_OBJECT_IN_LIST 5011
+#define ERROR_GROUP_NOT_AVAILABLE 5012
+#define ERROR_GROUP_NOT_FOUND 5013
+#define ERROR_GROUP_NOT_ONLINE 5014
+#define ERROR_HOST_NODE_NOT_RESOURCE_OWNER 5015
+#define ERROR_HOST_NODE_NOT_GROUP_OWNER 5016
+#define ERROR_RESMON_CREATE_FAILED 5017
+#define ERROR_RESMON_ONLINE_FAILED 5018
+#define ERROR_RESOURCE_ONLINE 5019
+#define ERROR_QUORUM_RESOURCE 5020
+#define ERROR_NOT_QUORUM_CAPABLE 5021
+#define ERROR_CLUSTER_SHUTTING_DOWN 5022
+#define ERROR_INVALID_STATE 5023
+#define ERROR_RESOURCE_PROPERTIES_STORED 5024
+#define ERROR_NOT_QUORUM_CLASS 5025
+#define ERROR_CORE_RESOURCE 5026
+#define ERROR_QUORUM_RESOURCE_ONLINE_FAILED 5027
+#define ERROR_QUORUMLOG_OPEN_FAILED 5028
+#define ERROR_CLUSTERLOG_CORRUPT 5029
+#define ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE 5030
+#define ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE 5031
+#define ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND 5032
+#define ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE 5033
+#define ERROR_QUORUM_OWNER_ALIVE 5034
+#define ERROR_NETWORK_NOT_AVAILABLE 5035
+#define ERROR_NODE_NOT_AVAILABLE 5036
+#define ERROR_ALL_NODES_NOT_AVAILABLE 5037
+#define ERROR_RESOURCE_FAILED 5038
+#define ERROR_CLUSTER_INVALID_NODE 5039
+#define ERROR_CLUSTER_NODE_EXISTS 5040
+#define ERROR_CLUSTER_JOIN_IN_PROGRESS 5041
+#define ERROR_CLUSTER_NODE_NOT_FOUND 5042
+#define ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND 5043
+#define ERROR_CLUSTER_NETWORK_EXISTS 5044
+#define ERROR_CLUSTER_NETWORK_NOT_FOUND 5045
+#define ERROR_CLUSTER_NETINTERFACE_EXISTS 5046
+#define ERROR_CLUSTER_NETINTERFACE_NOT_FOUND 5047
+#define ERROR_CLUSTER_INVALID_REQUEST 5048
+#define ERROR_CLUSTER_INVALID_NETWORK_PROVIDER 5049
+#define ERROR_CLUSTER_NODE_DOWN 5050
+#define ERROR_CLUSTER_NODE_UNREACHABLE 5051
+#define ERROR_CLUSTER_NODE_NOT_MEMBER 5052
+#define ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS 5053
+#define ERROR_CLUSTER_INVALID_NETWORK 5054
+#define ERROR_CLUSTER_NODE_UP 5056
+#define ERROR_CLUSTER_IPADDR_IN_USE 5057
+#define ERROR_CLUSTER_NODE_NOT_PAUSED 5058
+#define ERROR_CLUSTER_NO_SECURITY_CONTEXT 5059
+#define ERROR_CLUSTER_NETWORK_NOT_INTERNAL 5060
+#define ERROR_CLUSTER_NODE_ALREADY_UP 5061
+#define ERROR_CLUSTER_NODE_ALREADY_DOWN 5062
+#define ERROR_CLUSTER_NETWORK_ALREADY_ONLINE 5063
+#define ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE 5064
+#define ERROR_CLUSTER_NODE_ALREADY_MEMBER 5065
+#define ERROR_CLUSTER_LAST_INTERNAL_NETWORK 5066
+#define ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS 5067
+#define ERROR_INVALID_OPERATION_ON_QUORUM 5068
+#define ERROR_DEPENDENCY_NOT_ALLOWED 5069
+#define ERROR_CLUSTER_NODE_PAUSED 5070
+#define ERROR_NODE_CANT_HOST_RESOURCE 5071
+#define ERROR_CLUSTER_NODE_NOT_READY 5072
+#define ERROR_CLUSTER_NODE_SHUTTING_DOWN 5073
+#define ERROR_CLUSTER_JOIN_ABORTED 5074
+#define ERROR_CLUSTER_INCOMPATIBLE_VERSIONS 5075
+#define ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED 5076
+#define ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED 5077
+#define ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND 5078
+#define ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED 5079
+#define ERROR_CLUSTER_RESNAME_NOT_FOUND 5080
+#define ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED 5081
+#define ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST 5082
+#define ERROR_CLUSTER_DATABASE_SEQMISMATCH 5083
+#define ERROR_RESMON_INVALID_STATE 5084
+#define ERROR_CLUSTER_GUM_NOT_LOCKER 5085
+#define ERROR_QUORUM_DISK_NOT_FOUND 5086
+#define ERROR_DATABASE_BACKUP_CORRUPT 5087
+#define ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT 5088
+#define ERROR_RESOURCE_PROPERTY_UNCHANGEABLE 5089
+#define ERROR_ENCRYPTION_FAILED 6000
+#define ERROR_DECRYPTION_FAILED 6001
+#define ERROR_FILE_ENCRYPTED 6002
+#define ERROR_NO_RECOVERY_POLICY 6003
+#define ERROR_NO_EFS 6004
+#define ERROR_WRONG_EFS 6005
+#define ERROR_NO_USER_KEYS 6006
+#define ERROR_FILE_NOT_ENCRYPTED 6007
+#define ERROR_NOT_EXPORT_FORMAT 6008
+#define ERROR_FILE_READ_ONLY 6009
+#define ERROR_DIR_EFS_DISALLOWED 6010
+#define ERROR_EFS_SERVER_NOT_TRUSTED 6011
+#define ERROR_NO_BROWSER_SERVERS_FOUND 6118
+#define SCHED_E_SERVICE_NOT_LOCALSYSTEM 6200
+#define ERROR_CTX_WINSTATION_NAME_INVALID 7001
+#define ERROR_CTX_INVALID_PD 7002
+#define ERROR_CTX_PD_NOT_FOUND 7003
+#define ERROR_CTX_WD_NOT_FOUND 7004
+#define ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY 7005
+#define ERROR_CTX_SERVICE_NAME_COLLISION 7006
+#define ERROR_CTX_CLOSE_PENDING 7007
+#define ERROR_CTX_NO_OUTBUF 7008
+#define ERROR_CTX_MODEM_INF_NOT_FOUND 7009
+#define ERROR_CTX_INVALID_MODEMNAME 7010
+#define ERROR_CTX_MODEM_RESPONSE_ERROR 7011
+#define ERROR_CTX_MODEM_RESPONSE_TIMEOUT 7012
+#define ERROR_CTX_MODEM_RESPONSE_NO_CARRIER 7013
+#define ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE 7014
+#define ERROR_CTX_MODEM_RESPONSE_BUSY 7015
+#define ERROR_CTX_MODEM_RESPONSE_VOICE 7016
+#define ERROR_CTX_TD_ERROR 7017
+#define ERROR_CTX_WINSTATION_NOT_FOUND 7022
+#define ERROR_CTX_WINSTATION_ALREADY_EXISTS 7023
+#define ERROR_CTX_WINSTATION_BUSY 7024
+#define ERROR_CTX_BAD_VIDEO_MODE 7025
+#define ERROR_CTX_GRAPHICS_INVALID 7035
+#define ERROR_CTX_LOGON_DISABLED 7037
+#define ERROR_CTX_NOT_CONSOLE 7038
+#define ERROR_CTX_CLIENT_QUERY_TIMEOUT 7040
+#define ERROR_CTX_CONSOLE_DISCONNECT 7041
+#define ERROR_CTX_CONSOLE_CONNECT 7042
+#define ERROR_CTX_SHADOW_DENIED 7044
+#define ERROR_CTX_WINSTATION_ACCESS_DENIED 7045
+#define ERROR_CTX_INVALID_WD 7049
+#define ERROR_CTX_SHADOW_INVALID 7050
+#define ERROR_CTX_SHADOW_DISABLED 7051
+#define ERROR_CTX_CLIENT_LICENSE_IN_USE 7052
+#define ERROR_CTX_CLIENT_LICENSE_NOT_SET 7053
+#define ERROR_CTX_LICENSE_NOT_AVAILABLE 7054
+#define ERROR_CTX_LICENSE_CLIENT_INVALID 7055
+#define ERROR_CTX_LICENSE_EXPIRED 7056
+#define FRS_ERR_INVALID_API_SEQUENCE 8001
+#define FRS_ERR_STARTING_SERVICE 8002
+#define FRS_ERR_STOPPING_SERVICE 8003
+#define FRS_ERR_INTERNAL_API 8004
+#define FRS_ERR_INTERNAL 8005
+#define FRS_ERR_SERVICE_COMM 8006
+#define FRS_ERR_INSUFFICIENT_PRIV 8007
+#define FRS_ERR_AUTHENTICATION 8008
+#define FRS_ERR_PARENT_INSUFFICIENT_PRIV 8009
+#define FRS_ERR_PARENT_AUTHENTICATION 8010
+#define FRS_ERR_CHILD_TO_PARENT_COMM 8011
+#define FRS_ERR_PARENT_TO_CHILD_COMM 8012
+#define FRS_ERR_SYSVOL_POPULATE 8013
+#define FRS_ERR_SYSVOL_POPULATE_TIMEOUT 8014
+#define FRS_ERR_SYSVOL_IS_BUSY 8015
+#define FRS_ERR_SYSVOL_DEMOTE 8016
+#define FRS_ERR_INVALID_SERVICE_PARAMETER 8017
+#define ERROR_DS_NOT_INSTALLED 8200
+#define ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY 8201
+#define ERROR_DS_NO_ATTRIBUTE_OR_VALUE 8202
+#define ERROR_DS_INVALID_ATTRIBUTE_SYNTAX 8203
+#define ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED 8204
+#define ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS 8205
+#define ERROR_DS_BUSY 8206
+#define ERROR_DS_UNAVAILABLE 8207
+#define ERROR_DS_NO_RIDS_ALLOCATED 8208
+#define ERROR_DS_NO_MORE_RIDS 8209
+#define ERROR_DS_INCORRECT_ROLE_OWNER 8210
+#define ERROR_DS_RIDMGR_INIT_ERROR 8211
+#define ERROR_DS_OBJ_CLASS_VIOLATION 8212
+#define ERROR_DS_CANT_ON_NON_LEAF 8213
+#define ERROR_DS_CANT_ON_RDN 8214
+#define ERROR_DS_CANT_MOD_OBJ_CLASS 8215
+#define ERROR_DS_CROSS_DOM_MOVE_ERROR 8216
+#define ERROR_DS_GC_NOT_AVAILABLE 8217
+#define ERROR_SHARED_POLICY 8218
+#define ERROR_POLICY_OBJECT_NOT_FOUND 8219
+#define ERROR_POLICY_ONLY_IN_DS 8220
+#define ERROR_PROMOTION_ACTIVE 8221
+#define ERROR_NO_PROMOTION_ACTIVE 8222
+#define ERROR_DS_OPERATIONS_ERROR 8224
+#define ERROR_DS_PROTOCOL_ERROR 8225
+#define ERROR_DS_TIMELIMIT_EXCEEDED 8226
+#define ERROR_DS_SIZELIMIT_EXCEEDED 8227
+#define ERROR_DS_ADMIN_LIMIT_EXCEEDED 8228
+#define ERROR_DS_COMPARE_FALSE 8229
+#define ERROR_DS_COMPARE_TRUE 8230
+#define ERROR_DS_AUTH_METHOD_NOT_SUPPORTED 8231
+#define ERROR_DS_STRONG_AUTH_REQUIRED 8232
+#define ERROR_DS_INAPPROPRIATE_AUTH 8233
+#define ERROR_DS_AUTH_UNKNOWN 8234
+#define ERROR_DS_REFERRAL 8235
+#define ERROR_DS_UNAVAILABLE_CRIT_EXTENSION 8236
+#define ERROR_DS_CONFIDENTIALITY_REQUIRED 8237
+#define ERROR_DS_INAPPROPRIATE_MATCHING 8238
+#define ERROR_DS_CONSTRAINT_VIOLATION 8239
+#define ERROR_DS_NO_SUCH_OBJECT 8240
+#define ERROR_DS_ALIAS_PROBLEM 8241
+#define ERROR_DS_INVALID_DN_SYNTAX 8242
+#define ERROR_DS_IS_LEAF 8243
+#define ERROR_DS_ALIAS_DEREF_PROBLEM 8244
+#define ERROR_DS_UNWILLING_TO_PERFORM 8245
+#define ERROR_DS_LOOP_DETECT 8246
+#define ERROR_DS_NAMING_VIOLATION 8247
+#define ERROR_DS_OBJECT_RESULTS_TOO_LARGE 8248
+#define ERROR_DS_AFFECTS_MULTIPLE_DSAS 8249
+#define ERROR_DS_SERVER_DOWN 8250
+#define ERROR_DS_LOCAL_ERROR 8251
+#define ERROR_DS_ENCODING_ERROR 8252
+#define ERROR_DS_DECODING_ERROR 8253
+#define ERROR_DS_FILTER_UNKNOWN 8254
+#define ERROR_DS_PARAM_ERROR 8255
+#define ERROR_DS_NOT_SUPPORTED 8256
+#define ERROR_DS_NO_RESULTS_RETURNED 8257
+#define ERROR_DS_CONTROL_NOT_FOUND 8258
+#define ERROR_DS_CLIENT_LOOP 8259
+#define ERROR_DS_REFERRAL_LIMIT_EXCEEDED 8260
+#define ERROR_DS_ROOT_MUST_BE_NC 8301
+#define ERROR_DS_ADD_REPLICA_INHIBITED 8302
+#define ERROR_DS_ATT_NOT_DEF_IN_SCHEMA 8303
+#define ERROR_DS_MAX_OBJ_SIZE_EXCEEDED 8304
+#define ERROR_DS_OBJ_STRING_NAME_EXISTS 8305
+#define ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA 8306
+#define ERROR_DS_RDN_DOESNT_MATCH_SCHEMA 8307
+#define ERROR_DS_NO_REQUESTED_ATTS_FOUND 8308
+#define ERROR_DS_USER_BUFFER_TO_SMALL 8309
+#define ERROR_DS_ATT_IS_NOT_ON_OBJ 8310
+#define ERROR_DS_ILLEGAL_MOD_OPERATION 8311
+#define ERROR_DS_OBJ_TOO_LARGE 8312
+#define ERROR_DS_BAD_INSTANCE_TYPE 8313
+#define ERROR_DS_MASTERDSA_REQUIRED 8314
+#define ERROR_DS_OBJECT_CLASS_REQUIRED 8315
+#define ERROR_DS_MISSING_REQUIRED_ATT 8316
+#define ERROR_DS_ATT_NOT_DEF_FOR_CLASS 8317
+#define ERROR_DS_ATT_ALREADY_EXISTS 8318
+#define ERROR_DS_CANT_ADD_ATT_VALUES 8320
+#define ERROR_DS_SINGLE_VALUE_CONSTRAINT 8321
+#define ERROR_DS_RANGE_CONSTRAINT 8322
+#define ERROR_DS_ATT_VAL_ALREADY_EXISTS 8323
+#define ERROR_DS_CANT_REM_MISSING_ATT 8324
+#define ERROR_DS_CANT_REM_MISSING_ATT_VAL 8325
+#define ERROR_DS_ROOT_CANT_BE_SUBREF 8326
+#define ERROR_DS_NO_CHAINING 8327
+#define ERROR_DS_NO_CHAINED_EVAL 8328
+#define ERROR_DS_NO_PARENT_OBJECT 8329
+#define ERROR_DS_PARENT_IS_AN_ALIAS 8330
+#define ERROR_DS_CANT_MIX_MASTER_AND_REPS 8331
+#define ERROR_DS_CHILDREN_EXIST 8332
+#define ERROR_DS_OBJ_NOT_FOUND 8333
+#define ERROR_DS_ALIASED_OBJ_MISSING 8334
+#define ERROR_DS_BAD_NAME_SYNTAX 8335
+#define ERROR_DS_ALIAS_POINTS_TO_ALIAS 8336
+#define ERROR_DS_CANT_DEREF_ALIAS 8337
+#define ERROR_DS_OUT_OF_SCOPE 8338
+#define ERROR_DS_CANT_DELETE_DSA_OBJ 8340
+#define ERROR_DS_GENERIC_ERROR 8341
+#define ERROR_DS_DSA_MUST_BE_INT_MASTER 8342
+#define ERROR_DS_CLASS_NOT_DSA 8343
+#define ERROR_DS_INSUFF_ACCESS_RIGHTS 8344
+#define ERROR_DS_ILLEGAL_SUPERIOR 8345
+#define ERROR_DS_ATTRIBUTE_OWNED_BY_SAM 8346
+#define ERROR_DS_NAME_TOO_MANY_PARTS 8347
+#define ERROR_DS_NAME_TOO_LONG 8348
+#define ERROR_DS_NAME_VALUE_TOO_LONG 8349
+#define ERROR_DS_NAME_UNPARSEABLE 8350
+#define ERROR_DS_NAME_TYPE_UNKNOWN 8351
+#define ERROR_DS_NOT_AN_OBJECT 8352
+#define ERROR_DS_SEC_DESC_TOO_SHORT 8353
+#define ERROR_DS_SEC_DESC_INVALID 8354
+#define ERROR_DS_NO_DELETED_NAME 8355
+#define ERROR_DS_SUBREF_MUST_HAVE_PARENT 8356
+#define ERROR_DS_NCNAME_MUST_BE_NC 8357
+#define ERROR_DS_CANT_ADD_SYSTEM_ONLY 8358
+#define ERROR_DS_CLASS_MUST_BE_CONCRETE 8359
+#define ERROR_DS_INVALID_DMD 8360
+#define ERROR_DS_OBJ_GUID_EXISTS 8361
+#define ERROR_DS_NOT_ON_BACKLINK 8362
+#define ERROR_DS_NO_CROSSREF_FOR_NC 8363
+#define ERROR_DS_SHUTTING_DOWN 8364
+#define ERROR_DS_UNKNOWN_OPERATION 8365
+#define ERROR_DS_INVALID_ROLE_OWNER 8366
+#define ERROR_DS_COULDNT_CONTACT_FSMO 8367
+#define ERROR_DS_CROSS_NC_DN_RENAME 8368
+#define ERROR_DS_CANT_MOD_SYSTEM_ONLY 8369
+#define ERROR_DS_REPLICATOR_ONLY 8370
+#define ERROR_DS_OBJ_CLASS_NOT_DEFINED 8371
+#define ERROR_DS_OBJ_CLASS_NOT_SUBCLASS 8372
+#define ERROR_DS_NAME_REFERENCE_INVALID 8373
+#define ERROR_DS_CROSS_REF_EXISTS 8374
+#define ERROR_DS_CANT_DEL_MASTER_CROSSREF 8375
+#define ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD 8376
+#define ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX 8377
+#define ERROR_DS_DUP_RDN 8378
+#define ERROR_DS_DUP_OID 8379
+#define ERROR_DS_DUP_MAPI_ID 8380
+#define ERROR_DS_DUP_SCHEMA_ID_GUID 8381
+#define ERROR_DS_DUP_LDAP_DISPLAY_NAME 8382
+#define ERROR_DS_SEMANTIC_ATT_TEST 8383
+#define ERROR_DS_SYNTAX_MISMATCH 8384
+#define ERROR_DS_EXISTS_IN_MUST_HAVE 8385
+#define ERROR_DS_EXISTS_IN_MAY_HAVE 8386
+#define ERROR_DS_NONEXISTENT_MAY_HAVE 8387
+#define ERROR_DS_NONEXISTENT_MUST_HAVE 8388
+#define ERROR_DS_AUX_CLS_TEST_FAIL 8389
+#define ERROR_DS_NONEXISTENT_POSS_SUP 8390
+#define ERROR_DS_SUB_CLS_TEST_FAIL 8391
+#define ERROR_DS_BAD_RDN_ATT_ID_SYNTAX 8392
+#define ERROR_DS_EXISTS_IN_AUX_CLS 8393
+#define ERROR_DS_EXISTS_IN_SUB_CLS 8394
+#define ERROR_DS_EXISTS_IN_POSS_SUP 8395
+#define ERROR_DS_RECALCSCHEMA_FAILED 8396
+#define ERROR_DS_TREE_DELETE_NOT_FINISHED 8397
+#define ERROR_DS_CANT_DELETE 8398
+#define ERROR_DS_ATT_SCHEMA_REQ_ID 8399
+#define ERROR_DS_BAD_ATT_SCHEMA_SYNTAX 8400
+#define ERROR_DS_CANT_CACHE_ATT 8401
+#define ERROR_DS_CANT_CACHE_CLASS 8402
+#define ERROR_DS_CANT_REMOVE_ATT_CACHE 8403
+#define ERROR_DS_CANT_REMOVE_CLASS_CACHE 8404
+#define ERROR_DS_CANT_RETRIEVE_DN 8405
+#define ERROR_DS_MISSING_SUPREF 8406
+#define ERROR_DS_CANT_RETRIEVE_INSTANCE 8407
+#define ERROR_DS_CODE_INCONSISTENCY 8408
+#define ERROR_DS_DATABASE_ERROR 8409
+#define ERROR_DS_GOVERNSID_MISSING 8410
+#define ERROR_DS_MISSING_EXPECTED_ATT 8411
+#define ERROR_DS_NCNAME_MISSING_CR_REF 8412
+#define ERROR_DS_SECURITY_CHECKING_ERROR 8413
+#define ERROR_DS_SCHEMA_NOT_LOADED 8414
+#define ERROR_DS_SCHEMA_ALLOC_FAILED 8415
+#define ERROR_DS_ATT_SCHEMA_REQ_SYNTAX 8416
+#define ERROR_DS_GCVERIFY_ERROR 8417
+#define ERROR_DS_DRA_SCHEMA_MISMATCH 8418
+#define ERROR_DS_CANT_FIND_DSA_OBJ 8419
+#define ERROR_DS_CANT_FIND_EXPECTED_NC 8420
+#define ERROR_DS_CANT_FIND_NC_IN_CACHE 8421
+#define ERROR_DS_CANT_RETRIEVE_CHILD 8422
+#define ERROR_DS_SECURITY_ILLEGAL_MODIFY 8423
+#define ERROR_DS_CANT_REPLACE_HIDDEN_REC 8424
+#define ERROR_DS_BAD_HIERARCHY_FILE 8425
+#define ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED 8426
+#define ERROR_DS_CONFIG_PARAM_MISSING 8427
+#define ERROR_DS_COUNTING_AB_INDICES_FAILED 8428
+#define ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED 8429
+#define ERROR_DS_INTERNAL_FAILURE 8430
+#define ERROR_DS_UNKNOWN_ERROR 8431
+#define ERROR_DS_ROOT_REQUIRES_CLASS_TOP 8432
+#define ERROR_DS_REFUSING_FSMO_ROLES 8433
+#define ERROR_DS_MISSING_FSMO_SETTINGS 8434
+#define ERROR_DS_UNABLE_TO_SURRENDER_ROLES 8435
+#define ERROR_DS_DRA_GENERIC 8436
+#define ERROR_DS_DRA_INVALID_PARAMETER 8437
+#define ERROR_DS_DRA_BUSY 8438
+#define ERROR_DS_DRA_BAD_DN 8439
+#define ERROR_DS_DRA_BAD_NC 8440
+#define ERROR_DS_DRA_DN_EXISTS 8441
+#define ERROR_DS_DRA_INTERNAL_ERROR 8442
+#define ERROR_DS_DRA_INCONSISTENT_DIT 8443
+#define ERROR_DS_DRA_CONNECTION_FAILED 8444
+#define ERROR_DS_DRA_BAD_INSTANCE_TYPE 8445
+#define ERROR_DS_DRA_OUT_OF_MEM 8446
+#define ERROR_DS_DRA_MAIL_PROBLEM 8447
+#define ERROR_DS_DRA_REF_ALREADY_EXISTS 8448
+#define ERROR_DS_DRA_REF_NOT_FOUND 8449
+#define ERROR_DS_DRA_OBJ_IS_REP_SOURCE 8450
+#define ERROR_DS_DRA_DB_ERROR 8451
+#define ERROR_DS_DRA_NO_REPLICA 8452
+#define ERROR_DS_DRA_ACCESS_DENIED 8453
+#define ERROR_DS_DRA_NOT_SUPPORTED 8454
+#define ERROR_DS_DRA_RPC_CANCELLED 8455
+#define ERROR_DS_DRA_SOURCE_DISABLED 8456
+#define ERROR_DS_DRA_SINK_DISABLED 8457
+#define ERROR_DS_DRA_NAME_COLLISION 8458
+#define ERROR_DS_DRA_SOURCE_REINSTALLED 8459
+#define ERROR_DS_DRA_MISSING_PARENT 8460
+#define ERROR_DS_DRA_PREEMPTED 8461
+#define ERROR_DS_DRA_ABANDON_SYNC 8462
+#define ERROR_DS_DRA_SHUTDOWN 8463
+#define ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET 8464
+#define ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA 8465
+#define ERROR_DS_DRA_EXTN_CONNECTION_FAILED 8466
+#define ERROR_DS_INSTALL_SCHEMA_MISMATCH 8467
+#define ERROR_DS_DUP_LINK_ID 8468
+#define ERROR_DS_NAME_ERROR_RESOLVING 8469
+#define ERROR_DS_NAME_ERROR_NOT_FOUND 8470
+#define ERROR_DS_NAME_ERROR_NOT_UNIQUE 8471
+#define ERROR_DS_NAME_ERROR_NO_MAPPING 8472
+#define ERROR_DS_NAME_ERROR_DOMAIN_ONLY 8473
+#define ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING 8474
+#define ERROR_DS_CONSTRUCTED_ATT_MOD 8475
+#define ERROR_DS_WRONG_OM_OBJ_CLASS 8476
+#define ERROR_DS_DRA_REPL_PENDING 8477
+#define ERROR_DS_DS_REQUIRED 8478
+#define ERROR_DS_INVALID_LDAP_DISPLAY_NAME 8479
+#define ERROR_DS_NON_BASE_SEARCH 8480
+#define ERROR_DS_CANT_RETRIEVE_ATTS 8481
+#define ERROR_DS_BACKLINK_WITHOUT_LINK 8482
+#define ERROR_DS_EPOCH_MISMATCH 8483
+#define ERROR_DS_SRC_NAME_MISMATCH 8484
+#define ERROR_DS_SRC_AND_DST_NC_IDENTICAL 8485
+#define ERROR_DS_DST_NC_MISMATCH 8486
+#define ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC 8487
+#define ERROR_DS_SRC_GUID_MISMATCH 8488
+#define ERROR_DS_CANT_MOVE_DELETED_OBJECT 8489
+#define ERROR_DS_PDC_OPERATION_IN_PROGRESS 8490
+#define ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD 8491
+#define ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION 8492
+#define ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS 8493
+#define ERROR_DS_NC_MUST_HAVE_NC_PARENT 8494
+#define ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE 8495
+#define ERROR_DS_DST_DOMAIN_NOT_NATIVE 8496
+#define ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER 8497
+#define ERROR_DS_CANT_MOVE_ACCOUNT_GROUP 8498
+#define ERROR_DS_CANT_MOVE_RESOURCE_GROUP 8499
+#define ERROR_DS_INVALID_SEARCH_FLAG 8500
+#define ERROR_DS_NO_TREE_DELETE_ABOVE_NC 8501
+#define ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE 8502
+#define ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE 8503
+#define ERROR_DS_SAM_INIT_FAILURE 8504
+#define ERROR_DS_SENSITIVE_GROUP_VIOLATION 8505
+#define ERROR_DS_CANT_MOD_PRIMARYGROUPID 8506
+#define ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD 8507
+#define ERROR_DS_NONSAFE_SCHEMA_CHANGE 8508
+#define ERROR_DS_SCHEMA_UPDATE_DISALLOWED 8509
+#define ERROR_DS_CANT_CREATE_UNDER_SCHEMA 8510
+#define ERROR_DS_INSTALL_NO_SRC_SCH_VERSION 8511
+#define ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE 8512
+#define ERROR_DS_INVALID_GROUP_TYPE 8513
+#define ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN 8514
+#define ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN 8515
+#define ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER 8516
+#define ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER 8517
+#define ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER 8518
+#define ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER 8519
+#define ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER 8520
+#define ERROR_DS_HAVE_PRIMARY_MEMBERS 8521
+#define ERROR_DS_STRING_SD_CONVERSION_FAILED 8522
+#define ERROR_DS_NAMING_MASTER_GC 8523
+#define ERROR_DS_LOOKUP_FAILURE 8524
+#define ERROR_DS_COULDNT_UPDATE_SPNS 8525
+#define ERROR_DS_CANT_RETRIEVE_SD 8526
+#define ERROR_DS_KEY_NOT_UNIQUE 8527
+#define ERROR_DS_WRONG_LINKED_ATT_SYNTAX 8528
+#define ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD 8529
+#define ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY 8530
+#define ERROR_DS_CANT_START 8531
+#define ERROR_DS_INIT_FAILURE 8532
+#define ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION 8533
+#define ERROR_DS_SOURCE_DOMAIN_IN_FOREST 8534
+#define ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST 8535
+#define ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED 8536
+#define ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN 8537
+#define ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER 8538
+#define ERROR_DS_SRC_SID_EXISTS_IN_FOREST 8539
+#define ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH 8540
+#define ERROR_SAM_INIT_FAILURE 8541
+#define ERROR_DS_DRA_SCHEMA_INFO_SHIP 8542
+#define ERROR_DS_DRA_SCHEMA_CONFLICT 8543
+#define ERROR_DS_DRA_EARLIER_SCHEMA_CONLICT 8544
+#define ERROR_DS_DRA_OBJ_NC_MISMATCH 8545
+#define ERROR_DS_NC_STILL_HAS_DSAS 8546
+#define ERROR_DS_GC_REQUIRED 8547
+#define ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY 8548
+#define ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS 8549
+#define ERROR_DS_CANT_ADD_TO_GC 8550
+#define ERROR_DS_NO_CHECKPOINT_WITH_PDC 8551
+#define ERROR_DS_SOURCE_AUDITING_NOT_ENABLED 8552
+#define ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC 8553
+#define ERROR_DS_INVALID_NAME_FOR_SPN 8554
+#define ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS 8555
+#define ERROR_DS_UNICODEPWD_NOT_IN_QUOTES 8556
+#define ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED 8557
+#define ERROR_DS_MUST_BE_RUN_ON_DST_DC 8558
+#define ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER 8559
+#define ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ 8560
+#define DNS_ERROR_RCODE_FORMAT_ERROR 9001
+#define DNS_ERROR_RCODE_SERVER_FAILURE 9002
+#define DNS_ERROR_RCODE_NAME_ERROR 9003
+#define DNS_ERROR_RCODE_NOT_IMPLEMENTED 9004
+#define DNS_ERROR_RCODE_REFUSED 9005
+#define DNS_ERROR_RCODE_YXDOMAIN 9006
+#define DNS_ERROR_RCODE_YXRRSET 9007
+#define DNS_ERROR_RCODE_NXRRSET 9008
+#define DNS_ERROR_RCODE_NOTAUTH 9009
+#define DNS_ERROR_RCODE_NOTZONE 9010
+#define DNS_ERROR_RCODE_BADSIG 9016
+#define DNS_ERROR_RCODE_BADKEY 9017
+#define DNS_ERROR_RCODE_BADTIME 9018
+#define DNS_INFO_NO_RECORDS 9501
+#define DNS_ERROR_BAD_PACKET 9502
+#define DNS_ERROR_NO_PACKET 9503
+#define DNS_ERROR_RCODE 9504
+#define DNS_ERROR_UNSECURE_PACKET 9505
+#define DNS_ERROR_INVALID_TYPE 9551
+#define DNS_ERROR_INVALID_IP_ADDRESS 9552
+#define DNS_ERROR_INVALID_PROPERTY 9553
+#define DNS_ERROR_TRY_AGAIN_LATER 9554
+#define DNS_ERROR_NOT_UNIQUE 9555
+#define DNS_ERROR_NON_RFC_NAME 9556
+#define DNS_STATUS_FQDN 9557
+#define DNS_STATUS_DOTTED_NAME 9558
+#define DNS_STATUS_SINGLE_PART_NAME 9559
+#define DNS_ERROR_INVALID_NAME_CHAR 9560
+#define DNS_ERROR_NUMERIC_NAME 9561
+#define DNS_ERROR_ZONE_DOES_NOT_EXIST 9601
+#define DNS_ERROR_NO_ZONE_INFO 9602
+#define DNS_ERROR_INVALID_ZONE_OPERATION 9603
+#define DNS_ERROR_ZONE_CONFIGURATION_ERROR 9604
+#define DNS_ERROR_ZONE_HAS_NO_SOA_RECORD 9605
+#define DNS_ERROR_ZONE_HAS_NO_NS_RECORDS 9606
+#define DNS_ERROR_ZONE_LOCKED 9607
+#define DNS_ERROR_ZONE_CREATION_FAILED 9608
+#define DNS_ERROR_ZONE_ALREADY_EXISTS 9609
+#define DNS_ERROR_AUTOZONE_ALREADY_EXISTS 9610
+#define DNS_ERROR_INVALID_ZONE_TYPE 9611
+#define DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP 9612
+#define DNS_ERROR_ZONE_NOT_SECONDARY 9613
+#define DNS_ERROR_NEED_SECONDARY_ADDRESSES 9614
+#define DNS_ERROR_WINS_INIT_FAILED 9615
+#define DNS_ERROR_NEED_WINS_SERVERS 9616
+#define DNS_ERROR_NBSTAT_INIT_FAILED 9617
+#define DNS_ERROR_SOA_DELETE_INVALID 9618
+#define DNS_ERROR_PRIMARY_REQUIRES_DATAFILE 9651
+#define DNS_ERROR_INVALID_DATAFILE_NAME 9652
+#define DNS_ERROR_DATAFILE_OPEN_FAILURE 9653
+#define DNS_ERROR_FILE_WRITEBACK_FAILED 9654
+#define DNS_ERROR_DATAFILE_PARSING 9655
+#define DNS_ERROR_RECORD_DOES_NOT_EXIST 9701
+#define DNS_ERROR_RECORD_FORMAT 9702
+#define DNS_ERROR_NODE_CREATION_FAILED 9703
+#define DNS_ERROR_UNKNOWN_RECORD_TYPE 9704
+#define DNS_ERROR_RECORD_TIMED_OUT 9705
+#define DNS_ERROR_NAME_NOT_IN_ZONE 9706
+#define DNS_ERROR_CNAME_LOOP 9707
+#define DNS_ERROR_NODE_IS_CNAME 9708
+#define DNS_ERROR_CNAME_COLLISION 9709
+#define DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT 9710
+#define DNS_ERROR_RECORD_ALREADY_EXISTS 9711
+#define DNS_ERROR_SECONDARY_DATA 9712
+#define DNS_ERROR_NO_CREATE_CACHE_DATA 9713
+#define DNS_ERROR_NAME_DOES_NOT_EXIST 9714
+#define DNS_WARNING_PTR_CREATE_FAILED 9715
+#define DNS_WARNING_DOMAIN_UNDELETED 9716
+#define DNS_ERROR_DS_UNAVAILABLE 9717
+#define DNS_ERROR_DS_ZONE_ALREADY_EXISTS 9718
+#define DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE 9719
+#define DNS_INFO_AXFR_COMPLETE 9751
+#define DNS_ERROR_AXFR 9752
+#define DNS_INFO_ADDED_LOCAL_WINS 9753
+#define DNS_STATUS_CONTINUE_NEEDED 9801
+#define DNS_ERROR_NO_TCPIP 9851
+#define DNS_ERROR_NO_DNS_SERVERS 9852
+
+/* HRESULT values for OLE, SHELL and other Interface stuff */
+/* the codes 4000-40ff are reserved for OLE */
+#define NOERROR 0L
+#define S_OK ((HRESULT)0L)
+#define S_FALSE ((HRESULT)1L)
+
+#define DISP_E_UNKNOWNINTERFACE 0x80020001L
+#define DISP_E_MEMBERNOTFOUND 0x80020003L
+#define DISP_E_PARAMNOTFOUND 0x80020004L
+#define DISP_E_TYPEMISMATCH 0x80020005L
+#define DISP_E_UNKNOWNNAME 0x80020006L
+#define DISP_E_NONAMEDARGS 0x80020007L
+#define DISP_E_BADVARTYPE 0x80020008L
+#define DISP_E_EXCEPTION 0x80020009L
+#define DISP_E_OVERFLOW 0x8002000AL
+#define DISP_E_BADINDEX 0x8002000BL
+#define DISP_E_UNKNOWNLCID 0x8002000CL
+#define DISP_E_ARRAYISLOCKED 0x8002000DL
+#define DISP_E_BADPARAMCOUNT 0x8002000EL
+#define DISP_E_PARAMNOTOPTIONAL 0x8002000FL
+
+#define TYPE_E_ELEMENTNOTFOUND 0x8002802BL
+#define TYPE_E_CANTLOADLIBRARY 0x80029C4AL
+
+/* OLE Clipboard */
+#define CLIPBRD_E_FIRST 0x800401D0L
+#define CLIPBRD_E_LAST 0x800401DFL
+#define CLIPBRD_S_FIRST 0x000401D0L
+#define CLIPBRD_S_LAST 0x000401DFL
+#define CLIPBRD_E_CANT_OPEN 0x800401D0L
+#define CLIPBRD_E_CANT_EMPTY 0x800401D1L
+#define CLIPBRD_E_CANT_SET 0x800401D2L
+#define CLIPBRD_E_BAD_DATA 0x800401D3L
+#define CLIPBRD_E_CANT_CLOSE 0x800401D4L
+
+/* Drag and Drop */
+#define DRAGDROP_S_DROP 0x00040100L
+#define DRAGDROP_S_CANCEL 0x00040101L
+#define DRAGDROP_E_NOTREGISTERED 0x80040100L
+#define DRAGDROP_E_ALREADYREGISTERED 0x80040101L
+#define DRAGDROP_S_USEDEFAULTCURSORS 0x00040102L
+
+#define E_UNEXPECTED 0x8000FFFF
+
+#define E_NOTIMPL 0x80004001
+#define E_NOINTERFACE 0x80004002
+#define E_POINTER 0x80004003
+#define E_ABORT 0x80004004
+#define E_FAIL 0x80004005
+#define E_UNSPEC E_FAIL /* must to be defined (used by FileMoniker, IOleLink and DoDragDrop as a return value) */
+
+/*#define CO_E_INIT_TLS 0x80004006
+#define CO_E_INIT_SHARED_ALLOCATOR 0x80004007
+#define CO_E_INIT_MEMORY_ALLOCATOR 0x80004008
+#define CO_E_INIT_CLASS_CACHE 0x80004009
+#define CO_E_INIT_RPC_CHANNEL 0x8000400A
+#define CO_E_INIT_TLS_SET_CHANNEL_CONTROL 0x8000400B
+#define CO_E_INIT_TLS_CHANNEL_CONTROL 0x8000400C
+#define CO_E_INIT_UNACCEPTED_USER_ALLOCATOR 0x8000400D
+#define CO_E_INIT_SCM_MUTEX_EXISTS 0x8000400E
+#define CO_E_INIT_SCM_FILE_MAPPING_EXISTS 0x8000400F
+#define CO_E_INIT_SCM_MAP_VIEW_OF_FILE 0x80004010
+#define CO_E_INIT_SCM_EXEC_FAILURE 0x80004011
+#define CO_E_INIT_ONLY_SINGLE_THREADED 0x80004012 */
+
+#define CO_S_NOTALLINTERFACES 0x00080012
+#define CO_E_NOTINITIALIZED 0x800401F0
+#define CO_E_ERRORINDLL 0x800401F9
+#define CO_E_OBJISREG 0x800401FB
+
+#define OLE_E_FIRST 0x80040000L
+#define OLE_E_LAST 0x800400FFL
+#define OLE_S_FIRST 0x00040000L
+#define OLE_S_LAST 0x000400FFL
+
+#define OLE_E_ENUM_NOMORE 0x80040002
+#define OLE_E_ADVISENOTSUPPORTED 0x80040003
+#define OLE_E_NOCONNECTION 0x80040004
+#define OLE_E_NOTRUNNING 0x80040005
+#define OLE_E_NOCACHE 0x80040006
+#define OLE_E_BLANK 0x80040007
+#define OLE_E_NOT_INPLACEACTIVE 0x80040010
+#define OLE_E_STATIC 0x8004000B
+#define OLE_E_PROMPTSAVECANCELLED 0x8004000C
+#define OLE_S_USEREG 0x00040000
+#define OLE_S_STATIC 0x00040001
+
+#define DV_E_FORMATETC 0x80040064
+#define DV_E_DVASPECT 0x8004006B
+#define DV_E_LINDEX 0x80040068
+#define DV_E_TYMED 0x80040069
+
+#define CLASS_E_NOAGGREGATION 0x80040110
+#define CLASS_E_CLASSNOTAVAILABLE 0x80040111
+
+#define DATA_S_SAMEFORMATETC 0x80040130
+
+#define E_ACCESSDENIED 0x80070005
+#define E_HANDLE 0x80070006
+#define E_OUTOFMEMORY 0x8007000E
+#define E_INVALIDARG 0x80070057
+
+/*#define OLE_E_FIRST 0x80040000L */
+/*#define OLE_E_LAST 0x800400FFL */
+/*#define OLE_S_FIRST 0x00040000L */
+/*#define OLE_S_LAST 0x000400FFL */
+
+#define MK_S_REDUCED_TO_SELF 0x000401E2
+#define MK_S_ME 0x000401E4
+#define MK_S_HIM 0x000401E5
+#define MK_S_US 0x000401E6
+#define MK_S_MONIKERALREADYREGISTERED 0x000401E7
+
+#define MK_E_EXCEEDEDDEADLINE 0x800401E1
+#define MK_E_NEEDGENERIC 0x800401E2
+#define MK_E_UNAVAILABLE 0x800401E3
+#define MK_E_SYNTAX 0x800401E4
+#define MK_E_NOOBJECT 0x800401E5
+#define MK_E_INVALIDEXTENSION 0x800401E6
+#define MK_E_INTERMEDIATEINTERFACENOTSUPPORTED 0x800401E7
+#define MK_E_NOTBINDABLE 0x800401E8
+#define MK_E_NOTBOUND 0x800401E9
+#define MK_E_CANTOPENFILE 0x800401EA
+#define MK_E_MIUSTBOTHERUSER 0x800401EB
+#define MK_E_NOINVERSE 0x800401EC
+#define MK_E_NOSTORAGE 0x800401ED
+#define MK_E_NOPREFIX 0x800401EE
+
+#define STG_E_INVALIDFUNCTION 0x80030001
+#define STG_E_FILENOTFOUND 0x80030002
+#define STG_E_PATHNOTFOUND 0x80030003
+#define STG_E_TOOMANYOPENFILES 0x80030004
+#define STG_E_ACCESSDENIED 0x80030005
+#define STG_E_INVALIDHANDLE 0x80030006
+#define STG_E_INSUFFICIENTMEMORY 0x80030008
+#define STG_E_INVALIDPOINTER 0x80030009
+#define STG_E_NOMOREFILES 0x80030012
+#define STG_E_DISKISWRITEPROTECTED 0x80030013
+#define STG_E_SEEKERROR 0x80030019
+#define STG_E_WRITEFAULT 0x8003001D
+#define STG_E_READFAULT 0x8003001E
+#define STG_E_SHAREVIOLATION 0x80030020
+#define STG_E_LOCKVIOLATION 0x80030021
+#define STG_E_FILEALREADYEXISTS 0x80030050
+#define STG_E_INVALIDPARAMETER 0x80030057
+#define STG_E_MEDIUMFULL 0x80030070
+#define STG_E_ABNORMALAPIEXIT 0x800300FA
+#define STG_E_INVALIDHEADER 0x800300FB
+#define STG_E_INVALIDNAME 0x800300FC
+#define STG_E_UNKNOWN 0x800300FD
+#define STG_E_UNIMPLEMENTEDFUNCTION 0x800300FE
+#define STG_E_INVALIDFLAG 0x800300FF
+#define STG_E_INUSE 0x80030100
+#define STG_E_NOTCURRENT 0x80030101
+#define STG_E_REVERTED 0x80030102
+#define STG_E_CANTSAVE 0x80030103
+#define STG_E_OLDFORMAT 0x80030104
+#define STG_E_OLDDLL 0x80030105
+#define STG_E_SHAREREQUIRED 0x80030106
+#define STG_E_NOTFILEBASEDSTORAGE 0x80030107
+#define STG_E_EXTANTMARSHALLINGS 0x80030108
+
+#define CONVERT10_E_OLESTREAM_GET 0x800401C0
+#define CONVERT10_E_OLESTREAM_PUT 0x800401C1
+#define CONVERT10_E_OLESTREAM_FMT 0x800401C2
+#define CONVERT10_E_OLESTREAM_BITMAP_TO_DIB 0x800401C3
+#define CONVERT10_E_STG_FMT 0x800401C4
+#define CONVERT10_E_STG_NO_STD_STREAM 0x800401C5
+#define CONVERT10_E_STG_DIB_TO_BITMAP 0x800401C6
+
+/* alten versionen
+#define E_NOTIMPL 0x80000001
+#define E_OUTOFMEMORY 0x80000002
+#define E_INVALIDARG 0x80000003
+#define E_NOINTERFACE 0x80000004
+#define E_POINTER 0x80000005
+#define E_HANDLE 0x80000006
+#define E_ABORT 0x80000007
+#define E_FAIL 0x80000008
+#define E_ACCESSDENIED 0x80000009 */
+
+/* Obtained from lcc-win32 include files */
+#define GDI_ERROR 0xffffffff
+
+
+/* registry errors */
+#define REGDB_E_READREGDB 0x80040150
+#define REGDB_E_CLASSNOTREG 0x80040154
+
+#define INPLACE_E_NOTUNDOABLE 0x800401A0
+#define INPLACE_E_NOTOOLSPACE 0x800401A1
+
+#define DATA_E_FORMATETC DV_E_FORMATETC
+
+#define CLASSFACTORY_E_FIRST 0x80040110L
+#define CLASSFACTORY_E_LAST 0x8004011FL
+#define CLASSFACTORY_S_FIRST 0x80040110L
+#define CLASSFACTORY_S_LAST 0x8004011FL
+
+#define CLASS_E_NOTLICENSED (CLASSFACTORY_E_FIRST+2)
+#define CLASS_E_NOAGGREGATION 0x80040110
+#define CLASS_E_CLASSNOTAVAILABLE 0x80040111
+
+
+#define OLEOBJ_E_NOVERBS 0x00040180L
+#define OLEOBJ_E_INVALIDVERB 0x00040181L
+#define OLEOBJ_S_INVALIDVERB 0x00040180L
+
+#endif /* __WINE_WINERROR_H */
diff --git a/loader/wine/winestring.h b/loader/wine/winestring.h
new file mode 100644
index 0000000000..5b66dc803c
--- /dev/null
+++ b/loader/wine/winestring.h
@@ -0,0 +1,13 @@
+#ifndef __WINE_WINE_WINESTRING_H
+#define __WINE_WINE_WINESTRING_H
+
+#include "windef.h"
+
+LPWSTR WINAPI lstrcpyAtoW(LPWSTR,LPCSTR);
+LPSTR WINAPI lstrcpyWtoA(LPSTR,LPCWSTR);
+LPWSTR WINAPI lstrcpynAtoW(LPWSTR,LPCSTR,INT);
+LPSTR WINAPI lstrcpynWtoA(LPSTR,LPCWSTR,INT);
+
+#define lstrncmpiA strncasecmp
+
+#endif /* __WINE_WINE_WINESTRING_H */
diff --git a/loader/wine/winnt.h b/loader/wine/winnt.h
new file mode 100644
index 0000000000..107172ef8d
--- /dev/null
+++ b/loader/wine/winnt.h
@@ -0,0 +1,2665 @@
+/*
+ * Win32 definitions for Windows NT
+ *
+ * Copyright 1996 Alexandre Julliard
+ */
+
+#ifndef __WINE_WINNT_H
+#define __WINE_WINNT_H
+
+#include "windef.h"
+
+#ifndef RC_INVOKED
+#include <string.h>
+#endif
+
+#include "pshpack1.h"
+/* Defines */
+
+/* Argument 1 passed to the DllEntryProc. */
+#define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
+#define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
+#define DLL_THREAD_ATTACH 2 /* attach new thread */
+#define DLL_THREAD_DETACH 3 /* detach thread */
+
+
+/* u.x.wProcessorArchitecture (NT) */
+#define PROCESSOR_ARCHITECTURE_INTEL 0
+#define PROCESSOR_ARCHITECTURE_MIPS 1
+#define PROCESSOR_ARCHITECTURE_ALPHA 2
+#define PROCESSOR_ARCHITECTURE_PPC 3
+#define PROCESSOR_ARCHITECTURE_SHX 4
+#define PROCESSOR_ARCHITECTURE_ARM 5
+#define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
+
+/* dwProcessorType */
+#define PROCESSOR_INTEL_386 386
+#define PROCESSOR_INTEL_486 486
+#define PROCESSOR_INTEL_PENTIUM 586
+#define PROCESSOR_INTEL_860 860
+#define PROCESSOR_MIPS_R2000 2000
+#define PROCESSOR_MIPS_R3000 3000
+#define PROCESSOR_MIPS_R4000 4000
+#define PROCESSOR_ALPHA_21064 21064
+#define PROCESSOR_PPC_601 601
+#define PROCESSOR_PPC_603 603
+#define PROCESSOR_PPC_604 604
+#define PROCESSOR_PPC_620 620
+#define PROCESSOR_HITACHI_SH3 10003
+#define PROCESSOR_HITACHI_SH3E 10004
+#define PROCESSOR_HITACHI_SH4 10005
+#define PROCESSOR_MOTOROLA_821 821
+#define PROCESSOR_SHx_SH3 103
+#define PROCESSOR_SHx_SH4 104
+#define PROCESSOR_STRONGARM 2577
+#define PROCESSOR_ARM720 1824 /* 0x720 */
+#define PROCESSOR_ARM820 2080 /* 0x820 */
+#define PROCESSOR_ARM920 2336 /* 0x920 */
+#define PROCESSOR_ARM_7TDMI 70001
+
+#define ANYSIZE_ARRAY 1
+
+#define MINCHAR 0x80
+#define MAXCHAR 0x7f
+#define MINSHORT 0x8000
+#define MAXSHORT 0x7fff
+#define MINLONG 0x80000000
+#define MAXLONG 0x7fffffff
+#define MAXBYTE 0xff
+#define MAXWORD 0xffff
+#define MAXDWORD 0xffffffff
+
+#define FIELD_OFFSET(type, field) \
+ ((LONG)(INT)&(((type *)0)->field))
+
+#define CONTAINING_RECORD(address, type, field) \
+ ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
+
+/* Types */
+
+/* TCHAR data types definitions for Winelib. */
+/* These types are _not_ defined for the emulator, because they */
+/* depend on the UNICODE macro that only exists in user's code. */
+
+#ifndef __WINE__
+# ifdef UNICODE
+typedef WCHAR TCHAR, *PTCHAR;
+typedef LPWSTR PTSTR, LPTSTR;
+typedef LPCWSTR PCTSTR, LPCTSTR;
+#define __TEXT(string) L##string /*probably wrong */
+# else /* UNICODE */
+typedef char TCHAR, *PTCHAR;
+typedef LPSTR PTSTR, LPTSTR;
+typedef LPCSTR PCTSTR, LPCTSTR;
+#define __TEXT(string) string
+# endif /* UNICODE */
+#endif /* __WINE__ */
+#define TEXT(quote) __TEXT(quote)
+
+typedef BYTE BOOLEAN;
+typedef BOOLEAN *PBOOLEAN;
+
+typedef struct _LIST_ENTRY {
+ struct _LIST_ENTRY *Flink;
+ struct _LIST_ENTRY *Blink;
+} LIST_ENTRY, *PLIST_ENTRY;
+
+typedef struct _SINGLE_LIST_ENTRY {
+ struct _SINGLE_LIST_ENTRY *Next;
+} SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
+
+/* Heap flags */
+
+#define HEAP_NO_SERIALIZE 0x00000001
+#define HEAP_GROWABLE 0x00000002
+#define HEAP_GENERATE_EXCEPTIONS 0x00000004
+#define HEAP_ZERO_MEMORY 0x00000008
+#define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
+#define HEAP_TAIL_CHECKING_ENABLED 0x00000020
+#define HEAP_FREE_CHECKING_ENABLED 0x00000040
+#define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
+#define HEAP_CREATE_ALIGN_16 0x00010000
+#define HEAP_CREATE_ENABLE_TRACING 0x00020000
+#define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */
+#define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */
+#define HEAP_WINE_CODE16SEG 0x04000000 /* Not a Win32 flag */
+#define HEAP_WINE_SHARED 0x08000000 /* Not a Win32 flag */
+
+/* Processor feature flags. */
+#define PF_FLOATING_POINT_PRECISION_ERRATA 0
+#define PF_FLOATING_POINT_EMULATED 1
+#define PF_COMPARE_EXCHANGE_DOUBLE 2
+#define PF_MMX_INSTRUCTIONS_AVAILABLE 3
+#define PF_PPC_MOVEMEM_64BIT_OK 4
+#define PF_ALPHA_BYTE_INSTRUCTIONS 5
+
+
+/* The Win32 register context */
+
+/* CONTEXT is the CPU-dependent context; it should be used */
+/* wherever a platform-specific context is needed (e.g. exception */
+/* handling, Win32 register functions). */
+
+/* CONTEXT86 is the i386-specific context; it should be used */
+/* wherever only a 386 context makes sense (e.g. DOS interrupts, */
+/* Win16 register functions), so that this code can be compiled */
+/* on all platforms. */
+
+#define SIZE_OF_80387_REGISTERS 80
+
+typedef struct _FLOATING_SAVE_AREA
+{
+ DWORD ControlWord;
+ DWORD StatusWord;
+ DWORD TagWord;
+ DWORD ErrorOffset;
+ DWORD ErrorSelector;
+ DWORD DataOffset;
+ DWORD DataSelector;
+ BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
+ DWORD Cr0NpxState;
+} FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
+
+typedef struct _CONTEXT86
+{
+ DWORD ContextFlags;
+
+ /* These are selected by CONTEXT_DEBUG_REGISTERS */
+ DWORD Dr0;
+ DWORD Dr1;
+ DWORD Dr2;
+ DWORD Dr3;
+ DWORD Dr6;
+ DWORD Dr7;
+
+ /* These are selected by CONTEXT_FLOATING_POINT */
+ FLOATING_SAVE_AREA FloatSave;
+
+ /* These are selected by CONTEXT_SEGMENTS */
+ DWORD SegGs;
+ DWORD SegFs;
+ DWORD SegEs;
+ DWORD SegDs;
+
+ /* These are selected by CONTEXT_INTEGER */
+ DWORD Edi;
+ DWORD Esi;
+ DWORD Ebx;
+ DWORD Edx;
+ DWORD Ecx;
+ DWORD Eax;
+
+ /* These are selected by CONTEXT_CONTROL */
+ DWORD Ebp;
+ DWORD Eip;
+ DWORD SegCs;
+ DWORD EFlags;
+ DWORD Esp;
+ DWORD SegSs;
+} CONTEXT86;
+
+#define CONTEXT_X86 0x00010000
+#define CONTEXT_i386 CONTEXT_X86
+#define CONTEXT_i486 CONTEXT_X86
+
+#define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
+#define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
+#define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
+#define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
+#define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
+#define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
+
+/* i386 context definitions */
+#ifdef __i386__
+
+#define CONTEXT_CONTROL CONTEXT86_CONTROL
+#define CONTEXT_INTEGER CONTEXT86_INTEGER
+#define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
+#define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
+#define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
+#define CONTEXT_FULL CONTEXT86_FULL
+
+typedef CONTEXT86 CONTEXT;
+
+#endif /* __i386__ */
+
+/* Alpha context definitions */
+#ifdef _ALPHA_
+
+#define CONTEXT_ALPHA 0x00020000
+
+#define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
+#define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
+#define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
+
+typedef struct _CONTEXT
+{
+ /* selected by CONTEXT_FLOATING_POINT */
+ ULONGLONG FltF0;
+ ULONGLONG FltF1;
+ ULONGLONG FltF2;
+ ULONGLONG FltF3;
+ ULONGLONG FltF4;
+ ULONGLONG FltF5;
+ ULONGLONG FltF6;
+ ULONGLONG FltF7;
+ ULONGLONG FltF8;
+ ULONGLONG FltF9;
+ ULONGLONG FltF10;
+ ULONGLONG FltF11;
+ ULONGLONG FltF12;
+ ULONGLONG FltF13;
+ ULONGLONG FltF14;
+ ULONGLONG FltF15;
+ ULONGLONG FltF16;
+ ULONGLONG FltF17;
+ ULONGLONG FltF18;
+ ULONGLONG FltF19;
+ ULONGLONG FltF20;
+ ULONGLONG FltF21;
+ ULONGLONG FltF22;
+ ULONGLONG FltF23;
+ ULONGLONG FltF24;
+ ULONGLONG FltF25;
+ ULONGLONG FltF26;
+ ULONGLONG FltF27;
+ ULONGLONG FltF28;
+ ULONGLONG FltF29;
+ ULONGLONG FltF30;
+ ULONGLONG FltF31;
+
+ /* selected by CONTEXT_INTEGER */
+ ULONGLONG IntV0;
+ ULONGLONG IntT0;
+ ULONGLONG IntT1;
+ ULONGLONG IntT2;
+ ULONGLONG IntT3;
+ ULONGLONG IntT4;
+ ULONGLONG IntT5;
+ ULONGLONG IntT6;
+ ULONGLONG IntT7;
+ ULONGLONG IntS0;
+ ULONGLONG IntS1;
+ ULONGLONG IntS2;
+ ULONGLONG IntS3;
+ ULONGLONG IntS4;
+ ULONGLONG IntS5;
+ ULONGLONG IntFp;
+ ULONGLONG IntA0;
+ ULONGLONG IntA1;
+ ULONGLONG IntA2;
+ ULONGLONG IntA3;
+ ULONGLONG IntA4;
+ ULONGLONG IntA5;
+ ULONGLONG IntT8;
+ ULONGLONG IntT9;
+ ULONGLONG IntT10;
+ ULONGLONG IntT11;
+ ULONGLONG IntRa;
+ ULONGLONG IntT12;
+ ULONGLONG IntAt;
+ ULONGLONG IntGp;
+ ULONGLONG IntSp;
+ ULONGLONG IntZero;
+
+ /* selected by CONTEXT_FLOATING_POINT */
+ ULONGLONG Fpcr;
+ ULONGLONG SoftFpcr;
+
+ /* selected by CONTEXT_CONTROL */
+ ULONGLONG Fir;
+ DWORD Psr;
+ DWORD ContextFlags;
+ DWORD Fill[4];
+} CONTEXT;
+
+#define _QUAD_PSR_OFFSET HighSoftFpcr
+#define _QUAD_FLAGS_OFFSET HighFir
+
+#endif /* _ALPHA_ */
+
+/* Mips context definitions */
+#ifdef _MIPS_
+
+#define CONTEXT_R4000 0x00010000
+
+#define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
+#define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
+#define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
+
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
+
+typedef struct _CONTEXT
+{
+ DWORD Argument[4];
+ /* These are selected by CONTEXT_FLOATING_POINT */
+ DWORD FltF0;
+ DWORD FltF1;
+ DWORD FltF2;
+ DWORD FltF3;
+ DWORD FltF4;
+ DWORD FltF5;
+ DWORD FltF6;
+ DWORD FltF7;
+ DWORD FltF8;
+ DWORD FltF9;
+ DWORD FltF10;
+ DWORD FltF11;
+ DWORD FltF12;
+ DWORD FltF13;
+ DWORD FltF14;
+ DWORD FltF15;
+ DWORD FltF16;
+ DWORD FltF17;
+ DWORD FltF18;
+ DWORD FltF19;
+ DWORD FltF20;
+ DWORD FltF21;
+ DWORD FltF22;
+ DWORD FltF23;
+ DWORD FltF24;
+ DWORD FltF25;
+ DWORD FltF26;
+ DWORD FltF27;
+ DWORD FltF28;
+ DWORD FltF29;
+ DWORD FltF30;
+ DWORD FltF31;
+
+ /* These are selected by CONTEXT_INTEGER */
+ DWORD IntZero;
+ DWORD IntAt;
+ DWORD IntV0;
+ DWORD IntV1;
+ DWORD IntA0;
+ DWORD IntA1;
+ DWORD IntA2;
+ DWORD IntA3;
+ DWORD IntT0;
+ DWORD IntT1;
+ DWORD IntT2;
+ DWORD IntT3;
+ DWORD IntT4;
+ DWORD IntT5;
+ DWORD IntT6;
+ DWORD IntT7;
+ DWORD IntS0;
+ DWORD IntS1;
+ DWORD IntS2;
+ DWORD IntS3;
+ DWORD IntS4;
+ DWORD IntS5;
+ DWORD IntS6;
+ DWORD IntS7;
+ DWORD IntT8;
+ DWORD IntT9;
+ DWORD IntK0;
+ DWORD IntK1;
+ DWORD IntGp;
+ DWORD IntSp;
+ DWORD IntS8;
+ DWORD IntRa;
+ DWORD IntLo;
+ DWORD IntHi;
+
+ /* These are selected by CONTEXT_FLOATING_POINT */
+ DWORD Fsr;
+
+ /* These are selected by CONTEXT_CONTROL */
+ DWORD Fir;
+ DWORD Psr;
+
+ DWORD ContextFlags;
+ DWORD Fill[2];
+} CONTEXT;
+
+#endif /* _MIPS_ */
+
+/* PowerPC context definitions */
+#ifdef __PPC__
+
+#define CONTEXT_CONTROL 0x0001
+#define CONTEXT_FLOATING_POINT 0x0002
+#define CONTEXT_INTEGER 0x0004
+#define CONTEXT_DEBUG_REGISTERS 0x0008
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
+
+typedef struct
+{
+ /* These are selected by CONTEXT_FLOATING_POINT */
+ double Fpr0;
+ double Fpr1;
+ double Fpr2;
+ double Fpr3;
+ double Fpr4;
+ double Fpr5;
+ double Fpr6;
+ double Fpr7;
+ double Fpr8;
+ double Fpr9;
+ double Fpr10;
+ double Fpr11;
+ double Fpr12;
+ double Fpr13;
+ double Fpr14;
+ double Fpr15;
+ double Fpr16;
+ double Fpr17;
+ double Fpr18;
+ double Fpr19;
+ double Fpr20;
+ double Fpr21;
+ double Fpr22;
+ double Fpr23;
+ double Fpr24;
+ double Fpr25;
+ double Fpr26;
+ double Fpr27;
+ double Fpr28;
+ double Fpr29;
+ double Fpr30;
+ double Fpr31;
+ double Fpscr;
+
+ /* These are selected by CONTEXT_INTEGER */
+ DWORD Gpr0;
+ DWORD Gpr1;
+ DWORD Gpr2;
+ DWORD Gpr3;
+ DWORD Gpr4;
+ DWORD Gpr5;
+ DWORD Gpr6;
+ DWORD Gpr7;
+ DWORD Gpr8;
+ DWORD Gpr9;
+ DWORD Gpr10;
+ DWORD Gpr11;
+ DWORD Gpr12;
+ DWORD Gpr13;
+ DWORD Gpr14;
+ DWORD Gpr15;
+ DWORD Gpr16;
+ DWORD Gpr17;
+ DWORD Gpr18;
+ DWORD Gpr19;
+ DWORD Gpr20;
+ DWORD Gpr21;
+ DWORD Gpr22;
+ DWORD Gpr23;
+ DWORD Gpr24;
+ DWORD Gpr25;
+ DWORD Gpr26;
+ DWORD Gpr27;
+ DWORD Gpr28;
+ DWORD Gpr29;
+ DWORD Gpr30;
+ DWORD Gpr31;
+
+ DWORD Cr;
+ DWORD Xer;
+
+ /* These are selected by CONTEXT_CONTROL */
+ DWORD Msr;
+ DWORD Iar;
+ DWORD Lr;
+ DWORD Ctr;
+
+ DWORD ContextFlags;
+ DWORD Fill[3];
+
+ /* These are selected by CONTEXT_DEBUG_REGISTERS */
+ DWORD Dr0;
+ DWORD Dr1;
+ DWORD Dr2;
+ DWORD Dr3;
+ DWORD Dr4;
+ DWORD Dr5;
+ DWORD Dr6;
+ DWORD Dr7;
+} CONTEXT;
+
+typedef struct _STACK_FRAME_HEADER
+{
+ DWORD BackChain;
+ DWORD GlueSaved1;
+ DWORD GlueSaved2;
+ DWORD Reserved1;
+ DWORD Spare1;
+ DWORD Spare2;
+
+ DWORD Parameter0;
+ DWORD Parameter1;
+ DWORD Parameter2;
+ DWORD Parameter3;
+ DWORD Parameter4;
+ DWORD Parameter5;
+ DWORD Parameter6;
+ DWORD Parameter7;
+} STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
+
+#endif /* __PPC__ */
+
+#ifdef __sparc__
+
+/*
+ * FIXME:
+ *
+ * There is no official CONTEXT structure defined for the SPARC
+ * architecture, so I just made one up.
+ *
+ * This structure is valid only for 32-bit SPARC architectures,
+ * not for 64-bit SPARC.
+ *
+ * Note that this structure contains only the 'top-level' registers;
+ * the rest of the register window chain is not visible.
+ *
+ * The layout follows the Solaris 'prgregset_t' structure.
+ *
+ */
+
+#define CONTEXT_SPARC 0x10000000
+
+#define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
+#define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
+#define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
+
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
+
+typedef struct _CONTEXT
+{
+ DWORD ContextFlags;
+
+ /* These are selected by CONTEXT_INTEGER */
+ DWORD g0;
+ DWORD g1;
+ DWORD g2;
+ DWORD g3;
+ DWORD g4;
+ DWORD g5;
+ DWORD g6;
+ DWORD g7;
+ DWORD o0;
+ DWORD o1;
+ DWORD o2;
+ DWORD o3;
+ DWORD o4;
+ DWORD o5;
+ DWORD o6;
+ DWORD o7;
+ DWORD l0;
+ DWORD l1;
+ DWORD l2;
+ DWORD l3;
+ DWORD l4;
+ DWORD l5;
+ DWORD l6;
+ DWORD l7;
+ DWORD i0;
+ DWORD i1;
+ DWORD i2;
+ DWORD i3;
+ DWORD i4;
+ DWORD i5;
+ DWORD i6;
+ DWORD i7;
+
+ /* These are selected by CONTEXT_CONTROL */
+ DWORD psr;
+ DWORD pc;
+ DWORD npc;
+ DWORD y;
+ DWORD wim;
+ DWORD tbr;
+
+ /* FIXME: floating point registers missing */
+
+} CONTEXT;
+
+#endif /* __sparc__ */
+
+#if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
+#error You need to define a CONTEXT for your CPU
+#endif
+
+typedef CONTEXT *PCONTEXT;
+typedef HANDLE *PHANDLE;
+
+#ifdef __WINE__
+
+/* Macros for easier access to i386 context registers */
+
+#define EAX_reg(context) ((context)->Eax)
+#define EBX_reg(context) ((context)->Ebx)
+#define ECX_reg(context) ((context)->Ecx)
+#define EDX_reg(context) ((context)->Edx)
+#define ESI_reg(context) ((context)->Esi)
+#define EDI_reg(context) ((context)->Edi)
+#define EBP_reg(context) ((context)->Ebp)
+
+#define CS_reg(context) ((context)->SegCs)
+#define DS_reg(context) ((context)->SegDs)
+#define ES_reg(context) ((context)->SegEs)
+#define FS_reg(context) ((context)->SegFs)
+#define GS_reg(context) ((context)->SegGs)
+#define SS_reg(context) ((context)->SegSs)
+
+#define EFL_reg(context) ((context)->EFlags)
+#define EIP_reg(context) ((context)->Eip)
+#define ESP_reg(context) ((context)->Esp)
+
+#define AX_reg(context) (*(WORD*)&EAX_reg(context))
+#define BX_reg(context) (*(WORD*)&EBX_reg(context))
+#define CX_reg(context) (*(WORD*)&ECX_reg(context))
+#define DX_reg(context) (*(WORD*)&EDX_reg(context))
+#define SI_reg(context) (*(WORD*)&ESI_reg(context))
+#define DI_reg(context) (*(WORD*)&EDI_reg(context))
+#define BP_reg(context) (*(WORD*)&EBP_reg(context))
+
+#define AL_reg(context) (*(BYTE*)&EAX_reg(context))
+#define AH_reg(context) (*((BYTE*)&EAX_reg(context)+1))
+#define BL_reg(context) (*(BYTE*)&EBX_reg(context))
+#define BH_reg(context) (*((BYTE*)&EBX_reg(context)+1))
+#define CL_reg(context) (*(BYTE*)&ECX_reg(context))
+#define CH_reg(context) (*((BYTE*)&ECX_reg(context)+1))
+#define DL_reg(context) (*(BYTE*)&EDX_reg(context))
+#define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1))
+
+#define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
+#define RESET_CFLAG(context) (EFL_reg(context) &= ~0x0001)
+#define SET_ZFLAG(context) (EFL_reg(context) |= 0x0040)
+#define RESET_ZFLAG(context) (EFL_reg(context) &= ~0x0040)
+
+#define ISV86(context) (EFL_reg(context) & 0x00020000)
+#define V86BASE(context) ((context)->Dr7) /* ugly */
+
+
+/* Macros to retrieve the current context */
+
+#ifdef __i386__
+
+#ifdef NEED_UNDERSCORE_PREFIX
+# define __ASM_NAME(name) "_" name
+#else
+# define __ASM_NAME(name) name
+#endif
+
+#ifdef __GNUC__
+# define __ASM_GLOBAL_FUNC(name,code) \
+ __asm__( ".align 4\n\t" \
+ ".globl " __ASM_NAME(#name) "\n\t" \
+ ".type " __ASM_NAME(#name) ",@function\n" \
+ __ASM_NAME(#name) ":\n\t" \
+ code );
+#else /* __GNUC__ */
+# define __ASM_GLOBAL_FUNC(name,code) \
+ void __asm_dummy_##name(void) { \
+ asm( ".align 4\n\t" \
+ ".globl " __ASM_NAME(#name) "\n\t" \
+ ".type " __ASM_NAME(#name) ",@function\n" \
+ __ASM_NAME(#name) ":\n\t" \
+ code ); \
+ }
+#endif /* __GNUC__ */
+
+#define _DEFINE_REGS_ENTRYPOINT( name, fn, args ) \
+ __ASM_GLOBAL_FUNC( name, \
+ "call " __ASM_NAME("CALL32_Regs") "\n\t" \
+ ".long " __ASM_NAME(#fn) "\n\t" \
+ ".byte " #args ", " #args )
+#define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
+ _DEFINE_REGS_ENTRYPOINT( name, fn, 0 )
+#define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
+ _DEFINE_REGS_ENTRYPOINT( name, fn, 4 )
+#define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
+ _DEFINE_REGS_ENTRYPOINT( name, fn, 8 )
+#define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
+ _DEFINE_REGS_ENTRYPOINT( name, fn, 12 )
+#define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
+ _DEFINE_REGS_ENTRYPOINT( name, fn, 16 )
+
+#endif /* __i386__ */
+
+#ifdef __sparc__
+/* FIXME: use getcontext() to retrieve full context */
+#define _GET_CONTEXT \
+ CONTEXT context; \
+ do { memset(&context, 0, sizeof(CONTEXT)); \
+ context.ContextFlags = CONTEXT_CONTROL; \
+ context.pc = (DWORD)__builtin_return_address(0); \
+ } while (0)
+
+#define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
+ void WINAPI name ( void ) \
+ { _GET_CONTEXT; fn( &context ); }
+#define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
+ void WINAPI name ( t1 a1 ) \
+ { _GET_CONTEXT; fn( a1, &context ); }
+#define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
+ void WINAPI name ( t1 a1, t2 a2 ) \
+ { _GET_CONTEXT; fn( a1, a2, &context ); }
+#define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
+ void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
+ { _GET_CONTEXT; fn( a1, a2, a3, &context ); }
+#define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
+ void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
+ { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
+
+#endif /* __sparc__ */
+
+#ifndef DEFINE_REGS_ENTRYPOINT_0
+#error You need to define DEFINE_REGS_ENTRYPOINT macros for your CPU
+#endif
+
+#ifdef __i386__
+# define GET_IP(context) ((LPVOID)(context)->Eip)
+#endif
+#ifdef __sparc__
+# define GET_IP(context) ((LPVOID)(context)->pc)
+#endif
+
+#if !defined(GET_IP) && !defined(RC_INVOKED)
+# error You must define GET_IP for this CPU
+#endif
+
+#endif /* __WINE__ */
+
+/*
+ * Exception codes
+ */
+
+#define STATUS_SUCCESS 0x00000000
+#define STATUS_WAIT_0 0x00000000
+#define STATUS_ABANDONED_WAIT_0 0x00000080
+#define STATUS_USER_APC 0x000000C0
+#define STATUS_TIMEOUT 0x00000102
+#define STATUS_PENDING 0x00000103
+
+#define STATUS_GUARD_PAGE_VIOLATION 0x80000001
+#define STATUS_DATATYPE_MISALIGNMENT 0x80000002
+#define STATUS_BREAKPOINT 0x80000003
+#define STATUS_SINGLE_STEP 0x80000004
+#define STATUS_BUFFER_OVERFLOW 0x80000005
+#define STATUS_NO_MORE_FILES 0x80000006
+#define STATUS_WAKE_SYSTEM_DEBUGGER 0x80000007
+
+#define STATUS_HANDLES_CLOSED 0x8000000A
+#define STATUS_NO_INHERITANCE 0x8000000B
+#define STATUS_GUID_SUBSTITUTION_MADE 0x8000000C
+#define STATUS_PARTIAL_COPY 0x8000000D
+#define STATUS_DEVICE_PAPER_EMPTY 0x8000000E
+#define STATUS_DEVICE_POWERED_OFF 0x8000000F
+#define STATUS_DEVICE_OFF_LINE 0x80000010
+#define STATUS_DEVICE_BUSY 0x80000011
+#define STATUS_NO_MORE_EAS 0x80000012
+#define STATUS_INVALID_EA_NAME 0x80000013
+#define STATUS_EA_LIST_INCONSISTENT 0x80000014
+#define STATUS_INVALID_EA_FLAG 0x80000015
+#define STATUS_VERIFY_REQUIRED 0x80000016
+#define STATUS_EXTRANEOUS_INFORMATION 0x80000017
+#define STATUS_RXACT_COMMIT_NECESSARY 0x80000018
+#define STATUS_NO_MORE_ENTRIES 0x8000001A
+#define STATUS_FILEMARK_DETECTED 0x8000001B
+#define STATUS_MEDIA_CHANGED 0x8000001C
+#define STATUS_BUS_RESET 0x8000001D
+#define STATUS_END_OF_MEDIA 0x8000001E
+#define STATUS_BEGINNING_OF_MEDIA 0x8000001F
+#define STATUS_MEDIA_CHECK 0x80000020
+#define STATUS_SETMARK_DETECTED 0x80000021
+#define STATUS_NO_DATA_DETECTED 0x80000022
+#define STATUS_REDIRECTOR_HAS_OPEN_HANDLES 0x80000023
+#define STATUS_SERVER_HAS_OPEN_HANDLES 0x80000024
+#define STATUS_ALREADY_DISCONNECTED 0x80000025
+#define STATUS_LONGJUMP 0x80000026
+
+#define STATUS_UNSUCCESSFUL 0xC0000001
+#define STATUS_NOT_IMPLEMENTED 0xC0000002
+#define STATUS_INVALID_INFO_CLASS 0xC0000003
+#define STATUS_INFO_LENGTH_MISMATCH 0xC0000004
+#define STATUS_ACCESS_VIOLATION 0xC0000005
+#define STATUS_IN_PAGE_ERROR 0xC0000006
+#define STATUS_PAGEFILE_QUOTA 0xC0000007
+#define STATUS_INVALID_HANDLE 0xC0000008
+#define STATUS_BAD_INITIAL_STACK 0xC0000009
+#define STATUS_BAD_INITIAL_PC 0xC000000A
+#define STATUS_INVALID_CID 0xC000000B
+#define STATUS_TIMER_NOT_CANCELED 0xC000000C
+#define STATUS_INVALID_PARAMETER 0xC000000D
+#define STATUS_NO_SUCH_DEVICE 0xC000000E
+#define STATUS_NO_SUCH_FILE 0xC000000F
+#define STATUS_INVALID_DEVICE_REQUEST 0xC0000010
+#define STATUS_END_OF_FILE 0xC0000011
+#define STATUS_WRONG_VOLUME 0xC0000012
+#define STATUS_NO_MEDIA_IN_DEVICE 0xC0000013
+#define STATUS_UNRECOGNIZED_MEDIA 0xC0000014
+#define STATUS_NONEXISTENT_SECTOR 0xC0000015
+#define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016
+#define STATUS_NO_MEMORY 0xC0000017
+#define STATUS_CONFLICTING_ADDRESSES 0xC0000018
+#define STATUS_NOT_MAPPED_VIEW 0xC0000019
+#define STATUS_UNABLE_TO_FREE_VM 0xC000001A
+#define STATUS_UNABLE_TO_DELETE_SECTION 0xC000001B
+#define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C
+#define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
+#define STATUS_INVALID_LOCK_SEQUENCE 0xC000001E
+#define STATUS_INVALID_VIEW_SIZE 0xC000001F
+#define STATUS_INVALID_FILE_FOR_SECTION 0xC0000020
+#define STATUS_ALREADY_COMMITTED 0xC0000021
+#define STATUS_ACCESS_DENIED 0xC0000022
+#define STATUS_BUFFER_TOO_SMALL 0xC0000023
+#define STATUS_OBJECT_TYPE_MISMATCH 0xC0000024
+#define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
+#define STATUS_INVALID_DISPOSITION 0xC0000026
+#define STATUS_UNWIND 0xC0000027
+#define STATUS_BAD_STACK 0xC0000028
+#define STATUS_INVALID_UNWIND_TARGET 0xC0000029
+#define STATUS_NOT_LOCKED 0xC000002A
+#define STATUS_PARITY_ERROR 0xC000002B
+#define STATUS_UNABLE_TO_DECOMMIT_VM 0xC000002C
+#define STATUS_NOT_COMMITTED 0xC000002D
+#define STATUS_INVALID_PORT_ATTRIBUTES 0xC000002E
+#define STATUS_PORT_MESSAGE_TOO_LONG 0xC000002F
+#define STATUS_INVALID_PARAMETER_MIX 0xC0000030
+#define STATUS_INVALID_QUOTA_LOWER 0xC0000031
+#define STATUS_DISK_CORRUPT_ERROR 0xC0000032
+#define STATUS_OBJECT_NAME_INVALID 0xC0000033
+#define STATUS_OBJECT_NAME_NOT_FOUND 0xC0000034
+#define STATUS_OBJECT_NAME_COLLISION 0xC0000035
+#define STATUS_PORT_DISCONNECTED 0xC0000037
+#define STATUS_DEVICE_ALREADY_ATTACHED 0xC0000038
+#define STATUS_OBJECT_PATH_INVALID 0xC0000039
+#define STATUS_OBJECT_PATH_NOT_FOUND 0xC000003A
+#define STATUS_PATH_SYNTAX_BAD 0xC000003B
+#define STATUS_DATA_OVERRUN 0xC000003C
+#define STATUS_DATA_LATE_ERROR 0xC000003D
+#define STATUS_DATA_ERROR 0xC000003E
+#define STATUS_CRC_ERROR 0xC000003F
+#define STATUS_SECTION_TOO_BIG 0xC0000040
+#define STATUS_PORT_CONNECTION_REFUSED 0xC0000041
+#define STATUS_INVALID_PORT_HANDLE 0xC0000042
+#define STATUS_SHARING_VIOLATION 0xC0000043
+#define STATUS_QUOTA_EXCEEDED 0xC0000044
+#define STATUS_INVALID_PAGE_PROTECTION 0xC0000045
+#define STATUS_MUTANT_NOT_OWNED 0xC0000046
+#define STATUS_SEMAPHORE_LIMIT_EXCEEDED 0xC0000047
+#define STATUS_PORT_ALREADY_SET 0xC0000048
+#define STATUS_SUSPEND_COUNT_EXCEEDED 0xC000004A
+#define STATUS_LOCK_NOT_GRANTED 0xC0000054 /* FIXME: not sure */
+#define STATUS_FILE_LOCK_CONFLICT 0xC0000055 /* FIXME: not sure */
+#define STATUS_UNKNOWN_REVISION 0xC0000058
+#define STATUS_INVALID_SECURITY_DESCR 0xC0000079
+#define STATUS_DISK_FULL 0xC000007F
+#define STATUS_SECTION_NOT_EXTENDED 0xC0000087
+#define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
+#define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
+#define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
+#define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
+#define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
+#define STATUS_FLOAT_OVERFLOW 0xC0000091
+#define STATUS_FLOAT_STACK_CHECK 0xC0000092
+#define STATUS_FLOAT_UNDERFLOW 0xC0000093
+#define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
+#define STATUS_INTEGER_OVERFLOW 0xC0000095
+#define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
+#define STATUS_MEDIA_WRITE_PROTECTED 0XC00000A2
+#define STATUS_INVALID_PARAMETER_2 0xC00000F0
+#define STATUS_STACK_OVERFLOW 0xC00000FD
+#define STATUS_DIRECTORY_NOT_EMPTY 0xC0000101
+#define STATUS_TOO_MANY_OPENED_FILES 0xC000011F
+#define STATUS_CONTROL_C_EXIT 0xC000013A
+#define STATUS_PIPE_BROKEN 0xC000014B
+#define STATUS_NOT_REGISTRY_FILE 0xC000015C
+#define STATUS_PARTITION_FAILURE 0xC0000172
+#define STATUS_INVALID_BLOCK_LENGTH 0xC0000173
+#define STATUS_DEVICE_NOT_PARTITIONED 0xC0000174
+#define STATUS_UNABLE_TO_LOCK_MEDIA 0xC0000175
+#define STATUS_UNABLE_TO_UNLOAD_MEDIA 0xC0000176
+#define STATUS_EOM_OVERFLOW 0xC0000177
+#define STATUS_NO_MEDIA 0xC0000178
+#define STATUS_NO_SUCH_MEMBER 0xC000017A
+#define STATUS_INVALID_MEMBER 0xC000017B
+#define STATUS_KEY_DELETED 0xC000017C
+#define STATUS_NO_LOG_SPACE 0xC000017D
+#define STATUS_TOO_MANY_SIDS 0xC000017E
+#define STATUS_LM_CROSS_ENCRYPTION_REQUIRED 0xC000017F
+#define STATUS_KEY_HAS_CHILDREN 0xC0000180
+#define STATUS_CHILD_MUST_BE_VOLATILE 0xC0000181
+#define STATUS_DEVICE_CONFIGURATION_ERROR0xC0000182
+#define STATUS_DRIVER_INTERNAL_ERROR 0xC0000183
+#define STATUS_INVALID_DEVICE_STATE 0xC0000184
+#define STATUS_IO_DEVICE_ERROR 0xC0000185
+#define STATUS_DEVICE_PROTOCOL_ERROR 0xC0000186
+#define STATUS_BACKUP_CONTROLLER 0xC0000187
+#define STATUS_LOG_FILE_FULL 0xC0000188
+#define STATUS_TOO_LATE 0xC0000189
+#define STATUS_NO_TRUST_LSA_SECRET 0xC000018A
+#define STATUS_NO_TRUST_SAM_ACCOUNT 0xC000018B
+#define STATUS_TRUSTED_DOMAIN_FAILURE 0xC000018C
+#define STATUS_TRUSTED_RELATIONSHIP_FAILURE 0xC000018D
+#define STATUS_EVENTLOG_FILE_CORRUPT 0xC000018E
+#define STATUS_EVENTLOG_CANT_START 0xC000018F
+#define STATUS_TRUST_FAILURE 0xC0000190
+#define STATUS_MUTANT_LIMIT_EXCEEDED 0xC0000191
+#define STATUS_NETLOGON_NOT_STARTED 0xC0000192
+#define STATUS_ACCOUNT_EXPIRED 0xC0000193
+#define STATUS_POSSIBLE_DEADLOCK 0xC0000194
+#define STATUS_NETWORK_CREDENTIAL_CONFLICT 0xC0000195
+#define STATUS_REMOTE_SESSION_LIMIT 0xC0000196
+#define STATUS_EVENTLOG_FILE_CHANGED 0xC0000197
+#define STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 0xC0000198
+#define STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT 0xC0000199
+#define STATUS_NOLOGON_SERVER_TRUST_ACCOUNT 0xC000019A
+#define STATUS_DOMAIN_TRUST_INCONSISTENT 0xC000019B
+#define STATUS_FS_DRIVER_REQUIRED 0xC000019C
+
+#define STATUS_RESOURCE_LANG_NOT_FOUND 0xC0000204
+
+#define MAXIMUM_WAIT_OBJECTS 64
+#define MAXIMUM_SUSPEND_COUNT 127
+
+
+/*
+ * Return values from the actual exception handlers
+ */
+
+#define ExceptionContinueExecution 0
+#define ExceptionContinueSearch 1
+#define ExceptionNestedException 2
+#define ExceptionCollidedUnwind 3
+
+/*
+ * Return values from filters in except() and from UnhandledExceptionFilter
+ */
+
+#define EXCEPTION_EXECUTE_HANDLER 1
+#define EXCEPTION_CONTINUE_SEARCH 0
+#define EXCEPTION_CONTINUE_EXECUTION -1
+
+/*
+ * From OS/2 2.0 exception handling
+ * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
+ */
+
+#define EH_NONCONTINUABLE 0x01
+#define EH_UNWINDING 0x02
+#define EH_EXIT_UNWIND 0x04
+#define EH_STACK_INVALID 0x08
+#define EH_NESTED_CALL 0x10
+
+#define EXCEPTION_CONTINUABLE 0
+#define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
+
+/*
+ * The exception record used by Win32 to give additional information
+ * about exception to exception handlers.
+ */
+
+#define EXCEPTION_MAXIMUM_PARAMETERS 15
+
+typedef struct __EXCEPTION_RECORD
+{
+ DWORD ExceptionCode;
+ DWORD ExceptionFlags;
+ struct __EXCEPTION_RECORD *ExceptionRecord;
+
+ LPVOID ExceptionAddress;
+ DWORD NumberParameters;
+ DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
+} EXCEPTION_RECORD, *PEXCEPTION_RECORD;
+
+/*
+ * The exception pointers structure passed to exception filters
+ * in except() and the UnhandledExceptionFilter().
+ */
+
+typedef struct _EXCEPTION_POINTERS
+{
+ PEXCEPTION_RECORD ExceptionRecord;
+ PCONTEXT ContextRecord;
+} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
+
+
+/*
+ * The exception frame, used for registering exception handlers
+ * Win32 cares only about this, but compilers generally emit
+ * larger exception frames for their own use.
+ */
+
+struct __EXCEPTION_FRAME;
+
+typedef DWORD (*PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct __EXCEPTION_FRAME*,
+ PCONTEXT,struct __EXCEPTION_FRAME **);
+
+typedef struct __EXCEPTION_FRAME
+{
+ struct __EXCEPTION_FRAME *Prev;
+ PEXCEPTION_HANDLER Handler;
+} EXCEPTION_FRAME, *PEXCEPTION_FRAME;
+
+#include "poppack.h"
+
+/*
+ * function pointer to a exception filter
+ */
+
+typedef LONG CALLBACK (*PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo);
+typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
+
+DWORD WINAPI UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers );
+LPTOP_LEVEL_EXCEPTION_FILTER
+WINAPI SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
+
+/* status values for ContinueDebugEvent */
+#define DBG_CONTINUE 0x00010002
+#define DBG_TERMINATE_THREAD 0x40010003
+#define DBG_TERMINATE_PROCESS 0x40010004
+#define DBG_CONTROL_C 0x40010005
+#define DBG_CONTROL_BREAK 0x40010008
+#define DBG_EXCEPTION_NOT_HANDLED 0x80010001
+
+typedef struct _NT_TIB
+{
+ struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
+ PVOID StackBase;
+ PVOID StackLimit;
+ PVOID SubSystemTib;
+ union {
+ PVOID FiberData;
+ DWORD Version;
+ } DUMMYUNIONNAME;
+ PVOID ArbitraryUserPointer;
+ struct _NT_TIB *Self;
+} NT_TIB, *PNT_TIB;
+
+struct _TEB;
+/*
+#if defined(__i386__) && defined(__GNUC__)
+extern inline struct _TEB * WINAPI NtCurrentTeb(void);
+extern inline struct _TEB * WINAPI NtCurrentTeb(void)
+{
+ struct _TEB *teb;
+ __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
+ return teb;
+}
+#else
+extern struct _TEB * WINAPI NtCurrentTeb(void);
+#endif
+*/
+
+/*
+ * File formats definitions
+ */
+
+typedef struct _IMAGE_DOS_HEADER {
+ WORD e_magic; /* 00: MZ Header signature */
+ WORD e_cblp; /* 02: Bytes on last page of file */
+ WORD e_cp; /* 04: Pages in file */
+ WORD e_crlc; /* 06: Relocations */
+ WORD e_cparhdr; /* 08: Size of header in paragraphs */
+ WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
+ WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
+ WORD e_ss; /* 0e: Initial (relative) SS value */
+ WORD e_sp; /* 10: Initial SP value */
+ WORD e_csum; /* 12: Checksum */
+ WORD e_ip; /* 14: Initial IP value */
+ WORD e_cs; /* 16: Initial (relative) CS value */
+ WORD e_lfarlc; /* 18: File address of relocation table */
+ WORD e_ovno; /* 1a: Overlay number */
+ WORD e_res[4]; /* 1c: Reserved words */
+ WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
+ WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
+ WORD e_res2[10]; /* 28: Reserved words */
+ DWORD e_lfanew; /* 3c: Offset to extended header */
+} IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
+
+#define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
+#define IMAGE_OS2_SIGNATURE 0x454E /* NE */
+#define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
+#define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
+#define IMAGE_VXD_SIGNATURE 0x454C /* LE */
+#define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
+
+/*
+ * This is the Windows executable (NE) header.
+ * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
+ */
+typedef struct
+{
+ WORD ne_magic; /* 00 NE signature 'NE' */
+ BYTE ne_ver; /* 02 Linker version number */
+ BYTE ne_rev; /* 03 Linker revision number */
+ WORD ne_enttab; /* 04 Offset to entry table relative to NE */
+ WORD ne_cbenttab; /* 06 Length of entry table in bytes */
+ LONG ne_crc; /* 08 Checksum */
+ WORD ne_flags; /* 0c Flags about segments in this file */
+ WORD ne_autodata; /* 0e Automatic data segment number */
+ WORD ne_heap; /* 10 Initial size of local heap */
+ WORD ne_stack; /* 12 Initial size of stack */
+ DWORD ne_csip; /* 14 Initial CS:IP */
+ DWORD ne_sssp; /* 18 Initial SS:SP */
+ WORD ne_cseg; /* 1c # of entries in segment table */
+ WORD ne_cmod; /* 1e # of entries in module reference tab. */
+ WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
+ WORD ne_segtab; /* 22 Offset to segment table */
+ WORD ne_rsrctab; /* 24 Offset to resource table */
+ WORD ne_restab; /* 26 Offset to resident-name table */
+ WORD ne_modtab; /* 28 Offset to module reference table */
+ WORD ne_imptab; /* 2a Offset to imported name table */
+ DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
+ WORD ne_cmovent; /* 30 # of movable entry points */
+ WORD ne_align; /* 32 Logical sector alignment shift count */
+ WORD ne_cres; /* 34 # of resource segments */
+ BYTE ne_exetyp; /* 36 Flags indicating target OS */
+ BYTE ne_flagsothers; /* 37 Additional information flags */
+ WORD fastload_offset; /* 38 Offset to fast load area (should be ne_pretthunks)*/
+ WORD fastload_length; /* 3a Length of fast load area (should be ne_psegrefbytes) */
+ WORD ne_swaparea; /* 3c Reserved by Microsoft */
+ WORD ne_expver; /* 3e Expected Windows version number */
+} IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER;
+
+typedef struct _IMAGE_VXD_HEADER {
+ WORD e32_magic;
+ BYTE e32_border;
+ BYTE e32_worder;
+ DWORD e32_level;
+ WORD e32_cpu;
+ WORD e32_os;
+ DWORD e32_ver;
+ DWORD e32_mflags;
+ DWORD e32_mpages;
+ DWORD e32_startobj;
+ DWORD e32_eip;
+ DWORD e32_stackobj;
+ DWORD e32_esp;
+ DWORD e32_pagesize;
+ DWORD e32_lastpagesize;
+ DWORD e32_fixupsize;
+ DWORD e32_fixupsum;
+ DWORD e32_ldrsize;
+ DWORD e32_ldrsum;
+ DWORD e32_objtab;
+ DWORD e32_objcnt;
+ DWORD e32_objmap;
+ DWORD e32_itermap;
+ DWORD e32_rsrctab;
+ DWORD e32_rsrccnt;
+ DWORD e32_restab;
+ DWORD e32_enttab;
+ DWORD e32_dirtab;
+ DWORD e32_dircnt;
+ DWORD e32_fpagetab;
+ DWORD e32_frectab;
+ DWORD e32_impmod;
+ DWORD e32_impmodcnt;
+ DWORD e32_impproc;
+ DWORD e32_pagesum;
+ DWORD e32_datapage;
+ DWORD e32_preload;
+ DWORD e32_nrestab;
+ DWORD e32_cbnrestab;
+ DWORD e32_nressum;
+ DWORD e32_autodata;
+ DWORD e32_debuginfo;
+ DWORD e32_debuglen;
+ DWORD e32_instpreload;
+ DWORD e32_instdemand;
+ DWORD e32_heapsize;
+ BYTE e32_res3[12];
+ DWORD e32_winresoff;
+ DWORD e32_winreslen;
+ WORD e32_devid;
+ WORD e32_ddkver;
+} IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
+
+
+/* These defines describe the meanings of the bits in the Characteristics
+ field */
+
+#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
+#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
+#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
+#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
+#define IMAGE_FILE_16BIT_MACHINE 0x0040
+#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
+#define IMAGE_FILE_32BIT_MACHINE 0x0100
+#define IMAGE_FILE_DEBUG_STRIPPED 0x0200
+#define IMAGE_FILE_SYSTEM 0x1000
+#define IMAGE_FILE_DLL 0x2000
+#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
+
+/* These are the settings of the Machine field. */
+#define IMAGE_FILE_MACHINE_UNKNOWN 0
+#define IMAGE_FILE_MACHINE_I860 0x14d
+#define IMAGE_FILE_MACHINE_I386 0x14c
+#define IMAGE_FILE_MACHINE_R3000 0x162
+#define IMAGE_FILE_MACHINE_R4000 0x166
+#define IMAGE_FILE_MACHINE_R10000 0x168
+#define IMAGE_FILE_MACHINE_ALPHA 0x184
+#define IMAGE_FILE_MACHINE_POWERPC 0x1F0
+
+#define IMAGE_SIZEOF_FILE_HEADER 20
+
+/* Possible Magic values */
+#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
+#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
+
+/* These are indexes into the DataDirectory array */
+#define IMAGE_FILE_EXPORT_DIRECTORY 0
+#define IMAGE_FILE_IMPORT_DIRECTORY 1
+#define IMAGE_FILE_RESOURCE_DIRECTORY 2
+#define IMAGE_FILE_EXCEPTION_DIRECTORY 3
+#define IMAGE_FILE_SECURITY_DIRECTORY 4
+#define IMAGE_FILE_BASE_RELOCATION_TABLE 5
+#define IMAGE_FILE_DEBUG_DIRECTORY 6
+#define IMAGE_FILE_DESCRIPTION_STRING 7
+#define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
+#define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
+#define IMAGE_FILE_CALLBACK_DIRECTORY 10
+
+/* Directory Entries, indices into the DataDirectory array */
+
+#define IMAGE_DIRECTORY_ENTRY_EXPORT 0
+#define IMAGE_DIRECTORY_ENTRY_IMPORT 1
+#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
+#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
+#define IMAGE_DIRECTORY_ENTRY_SECURITY 4
+#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
+#define IMAGE_DIRECTORY_ENTRY_DEBUG 6
+#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
+#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
+#define IMAGE_DIRECTORY_ENTRY_TLS 9
+#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
+#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
+#define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
+#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
+#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
+
+/* Subsystem Values */
+
+#define IMAGE_SUBSYSTEM_UNKNOWN 0
+#define IMAGE_SUBSYSTEM_NATIVE 1
+#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
+#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem*/
+#define IMAGE_SUBSYSTEM_OS2_CUI 5
+#define IMAGE_SUBSYSTEM_POSIX_CUI 7
+
+typedef struct _IMAGE_FILE_HEADER {
+ WORD Machine;
+ WORD NumberOfSections;
+ DWORD TimeDateStamp;
+ DWORD PointerToSymbolTable;
+ DWORD NumberOfSymbols;
+ WORD SizeOfOptionalHeader;
+ WORD Characteristics;
+} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
+
+typedef struct _IMAGE_DATA_DIRECTORY {
+ DWORD VirtualAddress;
+ DWORD Size;
+} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
+
+#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
+
+typedef struct _IMAGE_OPTIONAL_HEADER {
+
+ /* Standard fields */
+
+ WORD Magic;
+ BYTE MajorLinkerVersion;
+ BYTE MinorLinkerVersion;
+ DWORD SizeOfCode;
+ DWORD SizeOfInitializedData;
+ DWORD SizeOfUninitializedData;
+ DWORD AddressOfEntryPoint;
+ DWORD BaseOfCode;
+ DWORD BaseOfData;
+
+ /* NT additional fields */
+
+ DWORD ImageBase;
+ DWORD SectionAlignment;
+ DWORD FileAlignment;
+ WORD MajorOperatingSystemVersion;
+ WORD MinorOperatingSystemVersion;
+ WORD MajorImageVersion;
+ WORD MinorImageVersion;
+ WORD MajorSubsystemVersion;
+ WORD MinorSubsystemVersion;
+ DWORD Win32VersionValue;
+ DWORD SizeOfImage;
+ DWORD SizeOfHeaders;
+ DWORD CheckSum;
+ WORD Subsystem;
+ WORD DllCharacteristics;
+ DWORD SizeOfStackReserve;
+ DWORD SizeOfStackCommit;
+ DWORD SizeOfHeapReserve;
+ DWORD SizeOfHeapCommit;
+ DWORD LoaderFlags;
+ DWORD NumberOfRvaAndSizes;
+ IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
+} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
+
+typedef struct _IMAGE_NT_HEADERS {
+ DWORD Signature;
+ IMAGE_FILE_HEADER FileHeader;
+ IMAGE_OPTIONAL_HEADER OptionalHeader;
+} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
+
+#define IMAGE_SIZEOF_SHORT_NAME 8
+
+typedef struct _IMAGE_SECTION_HEADER {
+ BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
+ union {
+ DWORD PhysicalAddress;
+ DWORD VirtualSize;
+ } Misc;
+ DWORD VirtualAddress;
+ DWORD SizeOfRawData;
+ DWORD PointerToRawData;
+ DWORD PointerToRelocations;
+ DWORD PointerToLinenumbers;
+ WORD NumberOfRelocations;
+ WORD NumberOfLinenumbers;
+ DWORD Characteristics;
+} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
+
+#define IMAGE_SIZEOF_SECTION_HEADER 40
+
+#define IMAGE_FIRST_SECTION(ntheader) \
+ ((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \
+ ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
+
+/* These defines are for the Characteristics bitfield. */
+/* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
+/* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
+/* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
+/* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
+/* #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 - Reserved */
+/* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
+
+#define IMAGE_SCN_CNT_CODE 0x00000020
+#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
+#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
+
+#define IMAGE_SCN_LNK_OTHER 0x00000100
+#define IMAGE_SCN_LNK_INFO 0x00000200
+/* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
+#define IMAGE_SCN_LNK_REMOVE 0x00000800
+#define IMAGE_SCN_LNK_COMDAT 0x00001000
+
+/* 0x00002000 - Reserved */
+/* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
+#define IMAGE_SCN_MEM_FARDATA 0x00008000
+
+/* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
+#define IMAGE_SCN_MEM_PURGEABLE 0x00020000
+#define IMAGE_SCN_MEM_16BIT 0x00020000
+#define IMAGE_SCN_MEM_LOCKED 0x00040000
+#define IMAGE_SCN_MEM_PRELOAD 0x00080000
+
+#define IMAGE_SCN_ALIGN_1BYTES 0x00100000
+#define IMAGE_SCN_ALIGN_2BYTES 0x00200000
+#define IMAGE_SCN_ALIGN_4BYTES 0x00300000
+#define IMAGE_SCN_ALIGN_8BYTES 0x00400000
+#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
+#define IMAGE_SCN_ALIGN_32BYTES 0x00600000
+#define IMAGE_SCN_ALIGN_64BYTES 0x00700000
+/* 0x00800000 - Unused */
+
+#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
+
+
+#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
+#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
+#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
+#define IMAGE_SCN_MEM_SHARED 0x10000000
+#define IMAGE_SCN_MEM_EXECUTE 0x20000000
+#define IMAGE_SCN_MEM_READ 0x40000000
+#define IMAGE_SCN_MEM_WRITE 0x80000000
+
+#include "pshpack2.h"
+
+typedef struct _IMAGE_SYMBOL {
+ union {
+ BYTE ShortName[8];
+ struct {
+ DWORD Short;
+ DWORD Long;
+ } Name;
+ DWORD LongName[2];
+ } N;
+ DWORD Value;
+ SHORT SectionNumber;
+ WORD Type;
+ BYTE StorageClass;
+ BYTE NumberOfAuxSymbols;
+} IMAGE_SYMBOL;
+typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
+
+#define IMAGE_SIZEOF_SYMBOL 18
+
+typedef struct _IMAGE_LINENUMBER {
+ union {
+ DWORD SymbolTableIndex;
+ DWORD VirtualAddress;
+ } Type;
+ WORD Linenumber;
+} IMAGE_LINENUMBER;
+typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
+
+#define IMAGE_SIZEOF_LINENUMBER 6
+
+typedef union _IMAGE_AUX_SYMBOL {
+ struct {
+ DWORD TagIndex;
+ union {
+ struct {
+ WORD Linenumber;
+ WORD Size;
+ } LnSz;
+ DWORD TotalSize;
+ } Misc;
+ union {
+ struct {
+ DWORD PointerToLinenumber;
+ DWORD PointerToNextFunction;
+ } Function;
+ struct {
+ WORD Dimension[4];
+ } Array;
+ } FcnAry;
+ WORD TvIndex;
+ } Sym;
+ struct {
+ BYTE Name[IMAGE_SIZEOF_SYMBOL];
+ } File;
+ struct {
+ DWORD Length;
+ WORD NumberOfRelocations;
+ WORD NumberOfLinenumbers;
+ DWORD CheckSum;
+ SHORT Number;
+ BYTE Selection;
+ } Section;
+} IMAGE_AUX_SYMBOL;
+typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
+
+#define IMAGE_SIZEOF_AUX_SYMBOL 18
+
+#include "poppack.h"
+
+#define IMAGE_SYM_UNDEFINED (SHORT)0
+#define IMAGE_SYM_ABSOLUTE (SHORT)-1
+#define IMAGE_SYM_DEBUG (SHORT)-2
+
+#define IMAGE_SYM_TYPE_NULL 0x0000
+#define IMAGE_SYM_TYPE_VOID 0x0001
+#define IMAGE_SYM_TYPE_CHAR 0x0002
+#define IMAGE_SYM_TYPE_SHORT 0x0003
+#define IMAGE_SYM_TYPE_INT 0x0004
+#define IMAGE_SYM_TYPE_LONG 0x0005
+#define IMAGE_SYM_TYPE_FLOAT 0x0006
+#define IMAGE_SYM_TYPE_DOUBLE 0x0007
+#define IMAGE_SYM_TYPE_STRUCT 0x0008
+#define IMAGE_SYM_TYPE_UNION 0x0009
+#define IMAGE_SYM_TYPE_ENUM 0x000A
+#define IMAGE_SYM_TYPE_MOE 0x000B
+#define IMAGE_SYM_TYPE_BYTE 0x000C
+#define IMAGE_SYM_TYPE_WORD 0x000D
+#define IMAGE_SYM_TYPE_UINT 0x000E
+#define IMAGE_SYM_TYPE_DWORD 0x000F
+#define IMAGE_SYM_TYPE_PCODE 0x8000
+
+#define IMAGE_SYM_DTYPE_NULL 0
+#define IMAGE_SYM_DTYPE_POINTER 1
+#define IMAGE_SYM_DTYPE_FUNCTION 2
+#define IMAGE_SYM_DTYPE_ARRAY 3
+
+#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
+#define IMAGE_SYM_CLASS_NULL 0x0000
+#define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
+#define IMAGE_SYM_CLASS_EXTERNAL 0x0002
+#define IMAGE_SYM_CLASS_STATIC 0x0003
+#define IMAGE_SYM_CLASS_REGISTER 0x0004
+#define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
+#define IMAGE_SYM_CLASS_LABEL 0x0006
+#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
+#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
+#define IMAGE_SYM_CLASS_ARGUMENT 0x0009
+#define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
+#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
+#define IMAGE_SYM_CLASS_UNION_TAG 0x000C
+#define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
+#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
+#define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
+#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
+#define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
+#define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
+
+#define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
+#define IMAGE_SYM_CLASS_BLOCK 0x0064
+#define IMAGE_SYM_CLASS_FUNCTION 0x0065
+#define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
+#define IMAGE_SYM_CLASS_FILE 0x0067
+#define IMAGE_SYM_CLASS_SECTION 0x0068
+#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
+
+#define N_BTMASK 0x000F
+#define N_TMASK 0x0030
+#define N_TMASK1 0x00C0
+#define N_TMASK2 0x00F0
+#define N_BTSHFT 4
+#define N_TSHIFT 2
+
+#define BTYPE(x) ((x) & N_BTMASK)
+
+#ifndef ISPTR
+#define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
+#endif
+
+#ifndef ISFCN
+#define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
+#endif
+
+#ifndef ISARY
+#define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
+#endif
+
+#ifndef ISTAG
+#define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
+#endif
+
+#ifndef INCREF
+#define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
+#endif
+#ifndef DECREF
+#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
+#endif
+
+#define IMAGE_COMDAT_SELECT_NODUPLICATES 1
+#define IMAGE_COMDAT_SELECT_ANY 2
+#define IMAGE_COMDAT_SELECT_SAME_SIZE 3
+#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
+#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
+#define IMAGE_COMDAT_SELECT_LARGEST 6
+#define IMAGE_COMDAT_SELECT_NEWEST 7
+
+#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
+#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
+#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
+
+/* Export module directory */
+
+typedef struct _IMAGE_EXPORT_DIRECTORY {
+ DWORD Characteristics;
+ DWORD TimeDateStamp;
+ WORD MajorVersion;
+ WORD MinorVersion;
+ DWORD Name;
+ DWORD Base;
+ DWORD NumberOfFunctions;
+ DWORD NumberOfNames;
+ LPDWORD *AddressOfFunctions;
+ LPDWORD *AddressOfNames;
+ LPWORD *AddressOfNameOrdinals;
+} IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
+
+/* Import name entry */
+typedef struct _IMAGE_IMPORT_BY_NAME {
+ WORD Hint;
+ BYTE Name[1];
+} IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
+
+/* Import thunk */
+typedef struct _IMAGE_THUNK_DATA {
+ union {
+ LPBYTE ForwarderString;
+ FARPROC Function;
+ DWORD Ordinal;
+ PIMAGE_IMPORT_BY_NAME AddressOfData;
+ } u1;
+} IMAGE_THUNK_DATA,*PIMAGE_THUNK_DATA;
+
+/* Import module directory */
+
+typedef struct _IMAGE_IMPORT_DESCRIPTOR {
+ union {
+ DWORD Characteristics; /* 0 for terminating null import descriptor */
+ PIMAGE_THUNK_DATA OriginalFirstThunk; /* RVA to original unbound IAT */
+ } u;
+ DWORD TimeDateStamp; /* 0 if not bound,
+ * -1 if bound, and real date\time stamp
+ * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
+ * (new BIND)
+ * otherwise date/time stamp of DLL bound to
+ * (Old BIND)
+ */
+ DWORD ForwarderChain; /* -1 if no forwarders */
+ DWORD Name;
+ /* RVA to IAT (if bound this IAT has actual addresses) */
+ PIMAGE_THUNK_DATA FirstThunk;
+} IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
+
+#define IMAGE_ORDINAL_FLAG 0x80000000
+#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
+#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
+
+typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
+{
+ DWORD TimeDateStamp;
+ WORD OffsetModuleName;
+ WORD NumberOfModuleForwarderRefs;
+/* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
+} IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
+
+typedef struct _IMAGE_BOUND_FORWARDER_REF
+{
+ DWORD TimeDateStamp;
+ WORD OffsetModuleName;
+ WORD Reserved;
+} IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
+
+typedef struct _IMAGE_BASE_RELOCATION
+{
+ DWORD VirtualAddress;
+ DWORD SizeOfBlock;
+ WORD TypeOffset[1];
+} IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
+
+typedef struct _IMAGE_RELOCATION
+{
+ union {
+ DWORD VirtualAddress;
+ DWORD RelocCount;
+ } u;
+ DWORD SymbolTableIndex;
+ WORD Type;
+} IMAGE_RELOCATION;
+typedef IMAGE_RELOCATION *PIMAGE_RELOCATION;
+
+#define IMAGE_SIZEOF_RELOCATION 10
+
+/* generic relocation types */
+#define IMAGE_REL_BASED_ABSOLUTE 0
+#define IMAGE_REL_BASED_HIGH 1
+#define IMAGE_REL_BASED_LOW 2
+#define IMAGE_REL_BASED_HIGHLOW 3
+#define IMAGE_REL_BASED_HIGHADJ 4
+#define IMAGE_REL_BASED_MIPS_JMPADDR 5
+#define IMAGE_REL_BASED_SECTION 6
+#define IMAGE_REL_BASED_REL 7
+#define IMAGE_REL_BASED_MIPS_JMPADDR16 9
+#define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
+#define IMAGE_REL_BASED_DIR64 10
+#define IMAGE_REL_BASED_HIGH3ADJ 11
+
+/* I386 relocation types */
+#define IMAGE_REL_I386_ABSOLUTE 0
+#define IMAGE_REL_I386_DIR16 1
+#define IMAGE_REL_I386_REL16 2
+#define IMAGE_REL_I386_DIR32 6
+#define IMAGE_REL_I386_DIR32NB 7
+#define IMAGE_REL_I386_SEG12 9
+#define IMAGE_REL_I386_SECTION 10
+#define IMAGE_REL_I386_SECREL 11
+#define IMAGE_REL_I386_REL32 20
+
+/* MIPS relocation types */
+#define IMAGE_REL_MIPS_ABSOLUTE 0x0000
+#define IMAGE_REL_MIPS_REFHALF 0x0001
+#define IMAGE_REL_MIPS_REFWORD 0x0002
+#define IMAGE_REL_MIPS_JMPADDR 0x0003
+#define IMAGE_REL_MIPS_REFHI 0x0004
+#define IMAGE_REL_MIPS_REFLO 0x0005
+#define IMAGE_REL_MIPS_GPREL 0x0006
+#define IMAGE_REL_MIPS_LITERAL 0x0007
+#define IMAGE_REL_MIPS_SECTION 0x000A
+#define IMAGE_REL_MIPS_SECREL 0x000B
+#define IMAGE_REL_MIPS_SECRELLO 0x000C
+#define IMAGE_REL_MIPS_SECRELHI 0x000D
+#define IMAGE_REL_MIPS_JMPADDR16 0x0010
+#define IMAGE_REL_MIPS_REFWORDNB 0x0022
+#define IMAGE_REL_MIPS_PAIR 0x0025
+
+/* ALPHA relocation types */
+#define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
+#define IMAGE_REL_ALPHA_REFLONG 0x0001
+#define IMAGE_REL_ALPHA_REFQUAD 0x0002
+#define IMAGE_REL_ALPHA_GPREL 0x0003
+#define IMAGE_REL_ALPHA_LITERAL 0x0004
+#define IMAGE_REL_ALPHA_LITUSE 0x0005
+#define IMAGE_REL_ALPHA_GPDISP 0x0006
+#define IMAGE_REL_ALPHA_BRADDR 0x0007
+#define IMAGE_REL_ALPHA_HINT 0x0008
+#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
+#define IMAGE_REL_ALPHA_REFHI 0x000A
+#define IMAGE_REL_ALPHA_REFLO 0x000B
+#define IMAGE_REL_ALPHA_PAIR 0x000C
+#define IMAGE_REL_ALPHA_MATCH 0x000D
+#define IMAGE_REL_ALPHA_SECTION 0x000E
+#define IMAGE_REL_ALPHA_SECREL 0x000F
+#define IMAGE_REL_ALPHA_REFLONGNB 0x0010
+#define IMAGE_REL_ALPHA_SECRELLO 0x0011
+#define IMAGE_REL_ALPHA_SECRELHI 0x0012
+#define IMAGE_REL_ALPHA_REFQ3 0x0013
+#define IMAGE_REL_ALPHA_REFQ2 0x0014
+#define IMAGE_REL_ALPHA_REFQ1 0x0015
+#define IMAGE_REL_ALPHA_GPRELLO 0x0016
+#define IMAGE_REL_ALPHA_GPRELHI 0x0017
+
+/* PowerPC relocation types */
+#define IMAGE_REL_PPC_ABSOLUTE 0x0000
+#define IMAGE_REL_PPC_ADDR64 0x0001
+#define IMAGE_REL_PPC_ADDR 0x0002
+#define IMAGE_REL_PPC_ADDR24 0x0003
+#define IMAGE_REL_PPC_ADDR16 0x0004
+#define IMAGE_REL_PPC_ADDR14 0x0005
+#define IMAGE_REL_PPC_REL24 0x0006
+#define IMAGE_REL_PPC_REL14 0x0007
+#define IMAGE_REL_PPC_TOCREL16 0x0008
+#define IMAGE_REL_PPC_TOCREL14 0x0009
+#define IMAGE_REL_PPC_ADDR32NB 0x000A
+#define IMAGE_REL_PPC_SECREL 0x000B
+#define IMAGE_REL_PPC_SECTION 0x000C
+#define IMAGE_REL_PPC_IFGLUE 0x000D
+#define IMAGE_REL_PPC_IMGLUE 0x000E
+#define IMAGE_REL_PPC_SECREL16 0x000F
+#define IMAGE_REL_PPC_REFHI 0x0010
+#define IMAGE_REL_PPC_REFLO 0x0011
+#define IMAGE_REL_PPC_PAIR 0x0012
+#define IMAGE_REL_PPC_SECRELLO 0x0013
+#define IMAGE_REL_PPC_SECRELHI 0x0014
+#define IMAGE_REL_PPC_GPREL 0x0015
+#define IMAGE_REL_PPC_TYPEMASK 0x00FF
+/* modifier bits */
+#define IMAGE_REL_PPC_NEG 0x0100
+#define IMAGE_REL_PPC_BRTAKEN 0x0200
+#define IMAGE_REL_PPC_BRNTAKEN 0x0400
+#define IMAGE_REL_PPC_TOCDEFN 0x0800
+
+/* SH3 ? relocation type */
+#define IMAGE_REL_SH3_ABSOLUTE 0x0000
+#define IMAGE_REL_SH3_DIRECT16 0x0001
+#define IMAGE_REL_SH3_DIRECT 0x0002
+#define IMAGE_REL_SH3_DIRECT8 0x0003
+#define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
+#define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
+#define IMAGE_REL_SH3_DIRECT4 0x0006
+#define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
+#define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
+#define IMAGE_REL_SH3_PCREL8_WORD 0x0009
+#define IMAGE_REL_SH3_PCREL8_LONG 0x000A
+#define IMAGE_REL_SH3_PCREL12_WORD 0x000B
+#define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
+#define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
+#define IMAGE_REL_SH3_SECTION 0x000E
+#define IMAGE_REL_SH3_SECREL 0x000F
+#define IMAGE_REL_SH3_DIRECT32_NB 0x0010
+
+/* ARM (Archimedes?) relocation types */
+#define IMAGE_REL_ARM_ABSOLUTE 0x0000
+#define IMAGE_REL_ARM_ADDR 0x0001
+#define IMAGE_REL_ARM_ADDR32NB 0x0002
+#define IMAGE_REL_ARM_BRANCH24 0x0003
+#define IMAGE_REL_ARM_BRANCH11 0x0004
+#define IMAGE_REL_ARM_SECTION 0x000E
+#define IMAGE_REL_ARM_SECREL 0x000F
+
+/* IA64 relocation types */
+#define IMAGE_REL_IA64_ABSOLUTE 0x0000
+#define IMAGE_REL_IA64_IMM14 0x0001
+#define IMAGE_REL_IA64_IMM22 0x0002
+#define IMAGE_REL_IA64_IMM64 0x0003
+#define IMAGE_REL_IA64_DIR 0x0004
+#define IMAGE_REL_IA64_DIR64 0x0005
+#define IMAGE_REL_IA64_PCREL21B 0x0006
+#define IMAGE_REL_IA64_PCREL21M 0x0007
+#define IMAGE_REL_IA64_PCREL21F 0x0008
+#define IMAGE_REL_IA64_GPREL22 0x0009
+#define IMAGE_REL_IA64_LTOFF22 0x000A
+#define IMAGE_REL_IA64_SECTION 0x000B
+#define IMAGE_REL_IA64_SECREL22 0x000C
+#define IMAGE_REL_IA64_SECREL64I 0x000D
+#define IMAGE_REL_IA64_SECREL 0x000E
+#define IMAGE_REL_IA64_LTOFF64 0x000F
+#define IMAGE_REL_IA64_DIR32NB 0x0010
+#define IMAGE_REL_IA64_RESERVED_11 0x0011
+#define IMAGE_REL_IA64_RESERVED_12 0x0012
+#define IMAGE_REL_IA64_RESERVED_13 0x0013
+#define IMAGE_REL_IA64_RESERVED_14 0x0014
+#define IMAGE_REL_IA64_RESERVED_15 0x0015
+#define IMAGE_REL_IA64_RESERVED_16 0x0016
+#define IMAGE_REL_IA64_ADDEND 0x001F
+
+/* archive format */
+
+#define IMAGE_ARCHIVE_START_SIZE 8
+#define IMAGE_ARCHIVE_START "!<arch>\n"
+#define IMAGE_ARCHIVE_END "`\n"
+#define IMAGE_ARCHIVE_PAD "\n"
+#define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
+#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
+
+typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
+{
+ BYTE Name[16];
+ BYTE Date[12];
+ BYTE UserID[6];
+ BYTE GroupID[6];
+ BYTE Mode[8];
+ BYTE Size[10];
+ BYTE EndHeader[2];
+} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
+
+#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
+
+/*
+ * Resource directory stuff
+ */
+typedef struct _IMAGE_RESOURCE_DIRECTORY {
+ DWORD Characteristics;
+ DWORD TimeDateStamp;
+ WORD MajorVersion;
+ WORD MinorVersion;
+ WORD NumberOfNamedEntries;
+ WORD NumberOfIdEntries;
+ /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
+} IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
+
+#define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
+#define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
+
+typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
+ union {
+ struct {
+ unsigned NameOffset:31;
+ unsigned NameIsString:1;
+ } s;
+ DWORD Name;
+ WORD Id;
+ } u1;
+ union {
+ DWORD OffsetToData;
+ struct {
+ unsigned OffsetToDirectory:31;
+ unsigned DataIsDirectory:1;
+ } s;
+ } u2;
+} IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
+
+
+typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
+ WORD Length;
+ CHAR NameString[ 1 ];
+} IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
+
+typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
+ WORD Length;
+ WCHAR NameString[ 1 ];
+} IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
+
+typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
+ DWORD OffsetToData;
+ DWORD Size;
+ DWORD CodePage;
+ DWORD ResourceHandle;
+} IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
+
+
+typedef VOID CALLBACK (*PIMAGE_TLS_CALLBACK)(
+ LPVOID DllHandle,DWORD Reason,LPVOID Reserved
+);
+
+typedef struct _IMAGE_TLS_DIRECTORY {
+ DWORD StartAddressOfRawData;
+ DWORD EndAddressOfRawData;
+ LPDWORD AddressOfIndex;
+ PIMAGE_TLS_CALLBACK *AddressOfCallBacks;
+ DWORD SizeOfZeroFill;
+ DWORD Characteristics;
+} IMAGE_TLS_DIRECTORY,*PIMAGE_TLS_DIRECTORY;
+
+typedef struct _IMAGE_DEBUG_DIRECTORY {
+ DWORD Characteristics;
+ DWORD TimeDateStamp;
+ WORD MajorVersion;
+ WORD MinorVersion;
+ DWORD Type;
+ DWORD SizeOfData;
+ DWORD AddressOfRawData;
+ DWORD PointerToRawData;
+} IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
+
+#define IMAGE_DEBUG_TYPE_UNKNOWN 0
+#define IMAGE_DEBUG_TYPE_COFF 1
+#define IMAGE_DEBUG_TYPE_CODEVIEW 2
+#define IMAGE_DEBUG_TYPE_FPO 3
+#define IMAGE_DEBUG_TYPE_MISC 4
+#define IMAGE_DEBUG_TYPE_EXCEPTION 5
+#define IMAGE_DEBUG_TYPE_FIXUP 6
+#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
+#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
+#define IMAGE_DEBUG_TYPE_BORLAND 9
+#define IMAGE_DEBUG_TYPE_RESERVED10 10
+
+typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
+ DWORD NumberOfSymbols;
+ DWORD LvaToFirstSymbol;
+ DWORD NumberOfLinenumbers;
+ DWORD LvaToFirstLinenumber;
+ DWORD RvaToFirstByteOfCode;
+ DWORD RvaToLastByteOfCode;
+ DWORD RvaToFirstByteOfData;
+ DWORD RvaToLastByteOfData;
+} IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
+
+#define FRAME_FPO 0
+#define FRAME_TRAP 1
+#define FRAME_TSS 2
+#define FRAME_NONFPO 3
+
+typedef struct _FPO_DATA {
+ DWORD ulOffStart;
+ DWORD cbProcSize;
+ DWORD cdwLocals;
+ WORD cdwParams;
+ unsigned cbProlog : 8;
+ unsigned cbRegs : 3;
+ unsigned fHasSEH : 1;
+ unsigned fUseBP : 1;
+ unsigned reserved : 1;
+ unsigned cbFrame : 2;
+} FPO_DATA, *PFPO_DATA;
+
+typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
+ DWORD Characteristics;
+ DWORD TimeDateStamp;
+ WORD MajorVersion;
+ WORD MinorVersion;
+ DWORD GlobalFlagsClear;
+ DWORD GlobalFlagsSet;
+ DWORD CriticalSectionDefaultTimeout;
+ DWORD DeCommitFreeBlockThreshold;
+ DWORD DeCommitTotalFreeThreshold;
+ PVOID LockPrefixTable;
+ DWORD MaximumAllocationSize;
+ DWORD VirtualMemoryThreshold;
+ DWORD ProcessHeapFlags;
+ DWORD ProcessAffinityMask;
+ WORD CSDVersion;
+ WORD Reserved1;
+ PVOID EditList;
+ DWORD Reserved[1];
+} IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
+
+typedef struct _IMAGE_FUNCTION_ENTRY {
+ DWORD StartingAddress;
+ DWORD EndingAddress;
+ DWORD EndOfPrologue;
+} IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
+
+/* This is the structure that appears at the very start of a .DBG file. */
+
+typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
+ WORD Signature;
+ WORD Flags;
+ WORD Machine;
+ WORD Characteristics;
+ DWORD TimeDateStamp;
+ DWORD CheckSum;
+ DWORD ImageBase;
+ DWORD SizeOfImage;
+ DWORD NumberOfSections;
+ DWORD ExportedNamesSize;
+ DWORD DebugDirectorySize;
+ DWORD SectionAlignment;
+ DWORD Reserved[ 2 ];
+} IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
+
+#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
+
+
+typedef struct tagMESSAGE_RESOURCE_ENTRY {
+ WORD Length;
+ WORD Flags;
+ BYTE Text[1];
+} MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
+#define MESSAGE_RESOURCE_UNICODE 0x0001
+
+typedef struct tagMESSAGE_RESOURCE_BLOCK {
+ DWORD LowId;
+ DWORD HighId;
+ DWORD OffsetToEntries;
+} MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
+
+typedef struct tagMESSAGE_RESOURCE_DATA {
+ DWORD NumberOfBlocks;
+ MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
+} MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
+
+/*
+ * Here follows typedefs for security and tokens.
+ */
+
+/*
+ * First a constant for the following typdefs.
+ */
+
+#define ANYSIZE_ARRAY 1
+
+/* FIXME: Orphan. What does it point to? */
+typedef PVOID PACCESS_TOKEN;
+
+/*
+ * TOKEN_INFORMATION_CLASS
+ */
+
+typedef enum _TOKEN_INFORMATION_CLASS {
+ TokenUser = 1,
+ TokenGroups,
+ TokenPrivileges,
+ TokenOwner,
+ TokenPrimaryGroup,
+ TokenDefaultDacl,
+ TokenSource,
+ TokenType,
+ TokenImpersonationLevel,
+ TokenStatistics
+} TOKEN_INFORMATION_CLASS;
+
+#ifndef _SECURITY_DEFINED
+#define _SECURITY_DEFINED
+
+#include "pshpack1.h"
+
+typedef DWORD ACCESS_MASK, *PACCESS_MASK;
+
+typedef struct _GENERIC_MAPPING {
+ ACCESS_MASK GenericRead;
+ ACCESS_MASK GenericWrite;
+ ACCESS_MASK GenericExecute;
+ ACCESS_MASK GenericAll;
+} GENERIC_MAPPING, *PGENERIC_MAPPING;
+
+#ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
+#define SID_IDENTIFIER_AUTHORITY_DEFINED
+typedef struct {
+ BYTE Value[6];
+} SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
+#endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
+
+#ifndef SID_DEFINED
+#define SID_DEFINED
+typedef struct _SID {
+ BYTE Revision;
+ BYTE SubAuthorityCount;
+ SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
+ DWORD SubAuthority[1];
+} SID,*PSID;
+#endif /* !defined(SID_DEFINED) */
+
+#define SID_REVISION (1) /* Current revision */
+#define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
+#define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
+
+
+/*
+ * ACL
+ */
+
+#define ACL_REVISION1 1
+#define ACL_REVISION2 2
+#define ACL_REVISION3 3
+#define ACL_REVISION4 4
+
+#define MIN_ACL_REVISION ACL_REVISION2
+#define MAX_ACL_REVISION ACL_REVISION4
+
+typedef struct _ACL {
+ BYTE AclRevision;
+ BYTE Sbz1;
+ WORD AclSize;
+ WORD AceCount;
+ WORD Sbz2;
+} ACL, *PACL;
+
+/* SECURITY_DESCRIPTOR */
+#define SECURITY_DESCRIPTOR_REVISION 1
+#define SECURITY_DESCRIPTOR_REVISION1 1
+
+
+#define SE_OWNER_DEFAULTED 0x0001
+#define SE_GROUP_DEFAULTED 0x0002
+#define SE_DACL_PRESENT 0x0004
+#define SE_DACL_DEFAULTED 0x0008
+#define SE_SACL_PRESENT 0x0010
+#define SE_SACL_DEFAULTED 0x0020
+#define SE_SELF_RELATIVE 0x8000
+
+typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
+typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
+
+/* The security descriptor structure */
+typedef struct {
+ BYTE Revision;
+ BYTE Sbz1;
+ SECURITY_DESCRIPTOR_CONTROL Control;
+ DWORD Owner;
+ DWORD Group;
+ DWORD Sacl;
+ DWORD Dacl;
+} SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
+
+typedef struct {
+ BYTE Revision;
+ BYTE Sbz1;
+ SECURITY_DESCRIPTOR_CONTROL Control;
+ PSID Owner;
+ PSID Group;
+ PACL Sacl;
+ PACL Dacl;
+} SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
+
+#define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
+
+#include "poppack.h"
+
+#endif /* _SECURITY_DEFINED */
+
+#include "pshpack1.h"
+
+/*
+ * SID_AND_ATTRIBUTES
+ */
+
+typedef struct _SID_AND_ATTRIBUTES {
+ PSID Sid;
+ DWORD Attributes;
+} SID_AND_ATTRIBUTES ;
+
+/* security entities */
+#define SECURITY_NULL_RID (0x00000000L)
+#define SECURITY_WORLD_RID (0x00000000L)
+#define SECURITY_LOCAL_RID (0X00000000L)
+
+#define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
+
+/* S-1-1 */
+#define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
+
+/* S-1-2 */
+#define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
+
+/* S-1-3 */
+#define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
+#define SECURITY_CREATOR_OWNER_RID (0x00000000L)
+#define SECURITY_CREATOR_GROUP_RID (0x00000001L)
+#define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
+#define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
+
+/* S-1-4 */
+#define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
+
+/* S-1-5 */
+#define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
+#define SECURITY_DIALUP_RID 0x00000001L
+#define SECURITY_NETWORK_RID 0x00000002L
+#define SECURITY_BATCH_RID 0x00000003L
+#define SECURITY_INTERACTIVE_RID 0x00000004L
+#define SECURITY_LOGON_IDS_RID 0x00000005L
+#define SECURITY_SERVICE_RID 0x00000006L
+#define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
+#define SECURITY_PROXY_RID 0x00000008L
+#define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
+#define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
+#define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
+#define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
+#define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
+#define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
+#define SECURITY_NT_NON_UNIQUE 0x00000015L
+#define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
+
+#define DOMAIN_GROUP_RID_ADMINS 0x00000200L
+#define DOMAIN_GROUP_RID_USERS 0x00000201L
+#define DOMAIN_GROUP_RID_GUESTS 0x00000202L
+
+#define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
+#define DOMAIN_ALIAS_RID_USERS 0x00000221L
+#define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
+
+#define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
+
+#define SECURITY_LOGON_IDS_RID_COUNT (3L)
+
+/*
+ * TOKEN_USER
+ */
+
+typedef struct _TOKEN_USER {
+ SID_AND_ATTRIBUTES User;
+} TOKEN_USER;
+
+/*
+ * TOKEN_GROUPS
+ */
+
+typedef struct _TOKEN_GROUPS {
+ DWORD GroupCount;
+ SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
+} TOKEN_GROUPS;
+
+/*
+ * LUID_AND_ATTRIBUTES
+ */
+
+typedef union _LARGE_INTEGER {
+ struct {
+ DWORD LowPart;
+ LONG HighPart;
+ } DUMMYSTRUCTNAME;
+ LONGLONG QuadPart;
+} LARGE_INTEGER, *LPLARGE_INTEGER, *PLARGE_INTEGER;
+
+typedef union _ULARGE_INTEGER {
+ struct {
+ DWORD LowPart;
+ LONG HighPart;
+ } DUMMYSTRUCTNAME;
+ LONGLONG QuadPart;
+} ULARGE_INTEGER, *LPULARGE_INTEGER, *PULARGE_INTEGER;
+
+/*
+ * Locally Unique Identifier
+ */
+
+typedef LARGE_INTEGER LUID,*PLUID;
+
+typedef struct _LUID_AND_ATTRIBUTES {
+ LUID Luid;
+ DWORD Attributes;
+} LUID_AND_ATTRIBUTES;
+
+/*
+ * PRIVILEGE_SET
+ */
+
+typedef struct _PRIVILEGE_SET {
+ DWORD PrivilegeCount;
+ DWORD Control;
+ LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
+} PRIVILEGE_SET, *PPRIVILEGE_SET;
+
+/*
+ * TOKEN_PRIVILEGES
+ */
+
+typedef struct _TOKEN_PRIVILEGES {
+ DWORD PrivilegeCount;
+ LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
+} TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
+
+/*
+ * TOKEN_OWNER
+ */
+
+typedef struct _TOKEN_OWNER {
+ PSID Owner;
+} TOKEN_OWNER;
+
+/*
+ * TOKEN_PRIMARY_GROUP
+ */
+
+typedef struct _TOKEN_PRIMARY_GROUP {
+ PSID PrimaryGroup;
+} TOKEN_PRIMARY_GROUP;
+
+
+/*
+ * TOKEN_DEFAULT_DACL
+ */
+
+typedef struct _TOKEN_DEFAULT_DACL {
+ PACL DefaultDacl;
+} TOKEN_DEFAULT_DACL;
+
+/*
+ * TOKEN_SOURCEL
+ */
+
+typedef struct _TOKEN_SOURCE {
+ char Sourcename[8];
+ LUID SourceIdentifier;
+} TOKEN_SOURCE;
+
+/*
+ * TOKEN_TYPE
+ */
+
+typedef enum tagTOKEN_TYPE {
+ TokenPrimary = 1,
+ TokenImpersonation
+} TOKEN_TYPE;
+
+/*
+ * SECURITY_IMPERSONATION_LEVEL
+ */
+
+typedef enum _SECURITY_IMPERSONATION_LEVEL {
+ SecurityAnonymous,
+ SecurityIdentification,
+ SecurityImpersonation,
+ SecurityDelegation
+} SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
+
+
+typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
+ * PSECURITY_CONTEXT_TRACKING_MODE;
+/*
+ * Quality of Service
+ */
+
+typedef struct _SECURITY_QUALITY_OF_SERVICE {
+ DWORD Length;
+ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
+ SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
+ WIN_BOOL EffectiveOnly;
+} SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
+
+/*
+ * TOKEN_STATISTICS
+ */
+
+typedef struct _TOKEN_STATISTICS {
+ LUID TokenId;
+ LUID AuthenticationId;
+ LARGE_INTEGER ExpirationTime;
+ TOKEN_TYPE TokenType;
+ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
+ DWORD DynamicCharged;
+ DWORD DynamicAvailable;
+ DWORD GroupCount;
+ DWORD PrivilegeCount;
+ LUID ModifiedId;
+} TOKEN_STATISTICS;
+
+/*
+ * ACLs of NT
+ */
+
+#define ACL_REVISION 2
+
+#define ACL_REVISION1 1
+#define ACL_REVISION2 2
+
+/* ACEs, directly starting after an ACL */
+typedef struct _ACE_HEADER {
+ BYTE AceType;
+ BYTE AceFlags;
+ WORD AceSize;
+} ACE_HEADER,*PACE_HEADER;
+
+/* AceType */
+#define ACCESS_ALLOWED_ACE_TYPE 0
+#define ACCESS_DENIED_ACE_TYPE 1
+#define SYSTEM_AUDIT_ACE_TYPE 2
+#define SYSTEM_ALARM_ACE_TYPE 3
+
+/* inherit AceFlags */
+#define OBJECT_INHERIT_ACE 0x01
+#define CONTAINER_INHERIT_ACE 0x02
+#define NO_PROPAGATE_INHERIT_ACE 0x04
+#define INHERIT_ONLY_ACE 0x08
+#define VALID_INHERIT_FLAGS 0x0F
+
+/* AceFlags mask for what events we (should) audit */
+#define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
+#define FAILED_ACCESS_ACE_FLAG 0x80
+
+/* different ACEs depending on AceType
+ * SidStart marks the begin of a SID
+ * so the thing finally looks like this:
+ * 0: ACE_HEADER
+ * 4: ACCESS_MASK
+ * 8... : SID
+ */
+typedef struct _ACCESS_ALLOWED_ACE {
+ ACE_HEADER Header;
+ DWORD Mask;
+ DWORD SidStart;
+} ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
+
+typedef struct _ACCESS_DENIED_ACE {
+ ACE_HEADER Header;
+ DWORD Mask;
+ DWORD SidStart;
+} ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
+
+typedef struct _SYSTEM_AUDIT_ACE {
+ ACE_HEADER Header;
+ DWORD Mask;
+ DWORD SidStart;
+} SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
+
+typedef struct _SYSTEM_ALARM_ACE {
+ ACE_HEADER Header;
+ DWORD Mask;
+ DWORD SidStart;
+} SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
+
+typedef enum tagSID_NAME_USE {
+ SidTypeUser = 1,
+ SidTypeGroup,
+ SidTypeDomain,
+ SidTypeAlias,
+ SidTypeWellKnownGroup,
+ SidTypeDeletedAccount,
+ SidTypeInvalid,
+ SidTypeUnknown
+} SID_NAME_USE,*PSID_NAME_USE;
+
+/* Access rights */
+
+#define DELETE 0x00010000
+#define READ_CONTROL 0x00020000
+#define WRITE_DAC 0x00040000
+#define WRITE_OWNER 0x00080000
+#define SYNCHRONIZE 0x00100000
+#define STANDARD_RIGHTS_REQUIRED 0x000f0000
+
+#define STANDARD_RIGHTS_READ READ_CONTROL
+#define STANDARD_RIGHTS_WRITE READ_CONTROL
+#define STANDARD_RIGHTS_EXECUTE READ_CONTROL
+
+#define STANDARD_RIGHTS_ALL 0x001f0000
+
+#define SPECIFIC_RIGHTS_ALL 0x0000ffff
+
+#define GENERIC_READ 0x80000000
+#define GENERIC_WRITE 0x40000000
+#define GENERIC_EXECUTE 0x20000000
+#define GENERIC_ALL 0x10000000
+
+#define MAXIMUM_ALLOWED 0x02000000
+#define ACCESS_SYSTEM_SECURITY 0x01000000
+
+#define EVENT_MODIFY_STATE 0x0002
+#define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
+
+#define SEMAPHORE_MODIFY_STATE 0x0002
+#define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
+
+#define MUTEX_MODIFY_STATE 0x0001
+#define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
+
+#define PROCESS_TERMINATE 0x0001
+#define PROCESS_CREATE_THREAD 0x0002
+#define PROCESS_VM_OPERATION 0x0008
+#define PROCESS_VM_READ 0x0010
+#define PROCESS_VM_WRITE 0x0020
+#define PROCESS_DUP_HANDLE 0x0040
+#define PROCESS_CREATE_PROCESS 0x0080
+#define PROCESS_SET_QUOTA 0x0100
+#define PROCESS_SET_INFORMATION 0x0200
+#define PROCESS_QUERY_INFORMATION 0x0400
+#define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
+
+#define THREAD_TERMINATE 0x0001
+#define THREAD_SUSPEND_RESUME 0x0002
+#define THREAD_GET_CONTEXT 0x0008
+#define THREAD_SET_CONTEXT 0x0010
+#define THREAD_SET_INFORMATION 0x0020
+#define THREAD_QUERY_INFORMATION 0x0040
+#define THREAD_SET_THREAD_TOKEN 0x0080
+#define THREAD_IMPERSONATE 0x0100
+#define THREAD_DIRECT_IMPERSONATION 0x0200
+#define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
+
+#define THREAD_BASE_PRIORITY_LOWRT 15
+#define THREAD_BASE_PRIORITY_MAX 2
+#define THREAD_BASE_PRIORITY_MIN -2
+#define THREAD_BASE_PRIORITY_IDLE -15
+
+#define FILE_READ_DATA 0x0001 /* file & pipe */
+#define FILE_LIST_DIRECTORY 0x0001 /* directory */
+#define FILE_WRITE_DATA 0x0002 /* file & pipe */
+#define FILE_ADD_FILE 0x0002 /* directory */
+#define FILE_APPEND_DATA 0x0004 /* file */
+#define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
+#define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
+#define FILE_READ_EA 0x0008 /* file & directory */
+#define FILE_READ_PROPERTIES FILE_READ_EA
+#define FILE_WRITE_EA 0x0010 /* file & directory */
+#define FILE_WRITE_PROPERTIES FILE_WRITE_EA
+#define FILE_EXECUTE 0x0020 /* file */
+#define FILE_TRAVERSE 0x0020 /* directory */
+#define FILE_DELETE_CHILD 0x0040 /* directory */
+#define FILE_READ_ATTRIBUTES 0x0080 /* all */
+#define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
+#define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
+
+#define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
+ FILE_READ_ATTRIBUTES | FILE_READ_EA | \
+ SYNCHRONIZE)
+#define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
+ FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
+ FILE_APPEND_DATA | SYNCHRONIZE)
+#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
+ FILE_READ_ATTRIBUTES | SYNCHRONIZE)
+
+
+/* File attribute flags
+ */
+#define FILE_SHARE_READ 0x00000001L
+#define FILE_SHARE_WRITE 0x00000002L
+#define FILE_SHARE_DELETE 0x00000004L
+#define FILE_ATTRIBUTE_READONLY 0x00000001L
+#define FILE_ATTRIBUTE_HIDDEN 0x00000002L
+#define FILE_ATTRIBUTE_SYSTEM 0x00000004L
+#define FILE_ATTRIBUTE_LABEL 0x00000008L /* Not in Windows API */
+#define FILE_ATTRIBUTE_DIRECTORY 0x00000010L
+#define FILE_ATTRIBUTE_ARCHIVE 0x00000020L
+#define FILE_ATTRIBUTE_NORMAL 0x00000080L
+#define FILE_ATTRIBUTE_TEMPORARY 0x00000100L
+#define FILE_ATTRIBUTE_ATOMIC_WRITE 0x00000200L
+#define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L
+#define FILE_ATTRIBUTE_COMPRESSED 0x00000800L
+#define FILE_ATTRIBUTE_OFFLINE 0x00001000L
+
+/* File alignments (NT) */
+#define FILE_BYTE_ALIGNMENT 0x00000000
+#define FILE_WORD_ALIGNMENT 0x00000001
+#define FILE_LONG_ALIGNMENT 0x00000003
+#define FILE_QUAD_ALIGNMENT 0x00000007
+#define FILE_OCTA_ALIGNMENT 0x0000000f
+#define FILE_32_BYTE_ALIGNMENT 0x0000001f
+#define FILE_64_BYTE_ALIGNMENT 0x0000003f
+#define FILE_128_BYTE_ALIGNMENT 0x0000007f
+#define FILE_256_BYTE_ALIGNMENT 0x000000ff
+#define FILE_512_BYTE_ALIGNMENT 0x000001ff
+
+#define REG_NONE 0 /* no type */
+#define REG_SZ 1 /* string type (ASCII) */
+#define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
+#define REG_BINARY 3 /* binary format, callerspecific */
+/* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
+#define REG_DWORD 4 /* DWORD in little endian format */
+#define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
+#define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
+#define REG_LINK 6 /* symbolic link (UNICODE) */
+#define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
+#define REG_RESOURCE_LIST 8 /* resource list? huh? */
+#define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
+#define REG_RESOURCE_REQUIREMENTS_LIST 10
+
+/* ----------------------------- begin registry ----------------------------- */
+
+/* Registry security values */
+#define OWNER_SECURITY_INFORMATION 0x00000001
+#define GROUP_SECURITY_INFORMATION 0x00000002
+#define DACL_SECURITY_INFORMATION 0x00000004
+#define SACL_SECURITY_INFORMATION 0x00000008
+
+#define REG_OPTION_RESERVED 0x00000000
+#define REG_OPTION_NON_VOLATILE 0x00000000
+#define REG_OPTION_VOLATILE 0x00000001
+#define REG_OPTION_CREATE_LINK 0x00000002
+#define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
+#define REG_OPTION_OPEN_LINK 0x00000008
+#define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
+ REG_OPTION_NON_VOLATILE| \
+ REG_OPTION_VOLATILE| \
+ REG_OPTION_CREATE_LINK| \
+ REG_OPTION_BACKUP_RESTORE| \
+ REG_OPTION_OPEN_LINK)
+
+
+#define REG_CREATED_NEW_KEY 0x00000001
+#define REG_OPENED_EXISTING_KEY 0x00000002
+
+/* For RegNotifyChangeKeyValue */
+#define REG_NOTIFY_CHANGE_NAME 0x1
+
+#define KEY_QUERY_VALUE 0x00000001
+#define KEY_SET_VALUE 0x00000002
+#define KEY_CREATE_SUB_KEY 0x00000004
+#define KEY_ENUMERATE_SUB_KEYS 0x00000008
+#define KEY_NOTIFY 0x00000010
+#define KEY_CREATE_LINK 0x00000020
+
+#define KEY_READ ((STANDARD_RIGHTS_READ| \
+ KEY_QUERY_VALUE| \
+ KEY_ENUMERATE_SUB_KEYS| \
+ KEY_NOTIFY) \
+ & (~SYNCHRONIZE) \
+ )
+#define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
+ KEY_SET_VALUE| \
+ KEY_CREATE_SUB_KEY) \
+ & (~SYNCHRONIZE) \
+ )
+#define KEY_EXECUTE ((KEY_READ) \
+ & (~SYNCHRONIZE)) \
+ )
+#define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
+ KEY_QUERY_VALUE| \
+ KEY_SET_VALUE| \
+ KEY_CREATE_SUB_KEY| \
+ KEY_ENUMERATE_SUB_KEYS| \
+ KEY_NOTIFY| \
+ KEY_CREATE_LINK) \
+ & (~SYNCHRONIZE) \
+ )
+/* ------------------------------ end registry ------------------------------ */
+
+
+#define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
+#define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
+#define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
+#define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
+#define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
+
+#include "poppack.h"
+
+#endif /* __WINE_WINNT_H */
diff --git a/loader/wine/winreg.h b/loader/wine/winreg.h
new file mode 100644
index 0000000000..8c290b58f2
--- /dev/null
+++ b/loader/wine/winreg.h
@@ -0,0 +1,57 @@
+/*
+ * Win32 registry defines (see also winnt.h)
+ */
+#ifndef __WINE_WINREG_H
+#define __WINE_WINREG_H
+
+#include "winbase.h"
+#include "winnt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* defined(__cplusplus) */
+
+/*
+#define SHELL_ERROR_SUCCESS 0L
+#define SHELL_ERROR_BADDB 1L
+#define SHELL_ERROR_BADKEY 2L
+#define SHELL_ERROR_CANTOPEN 3L
+#define SHELL_ERROR_CANTREAD 4L
+#define SHELL_ERROR_CANTWRITE 5L
+#define SHELL_ERROR_OUTOFMEMORY 6L
+#define SHELL_ERROR_INVALID_PARAMETER 7L
+#define SHELL_ERROR_ACCESS_DENIED 8L
+*/
+
+#define HKEY_CLASSES_ROOT ((HKEY) 0x80000000)
+#define HKEY_CURRENT_USER ((HKEY) 0x80000001)
+#define HKEY_LOCAL_MACHINE ((HKEY) 0x80000002)
+#define HKEY_USERS ((HKEY) 0x80000003)
+#define HKEY_PERFORMANCE_DATA ((HKEY) 0x80000004)
+#define HKEY_CURRENT_CONFIG ((HKEY) 0x80000005)
+#define HKEY_DYN_DATA ((HKEY) 0x80000006)
+
+/*
+ * registry provider structs
+ */
+typedef struct value_entA
+{ LPSTR ve_valuename;
+ DWORD ve_valuelen;
+ DWORD_PTR ve_valueptr;
+ DWORD ve_type;
+} VALENTA, *PVALENTA;
+
+typedef struct value_entW {
+ LPWSTR ve_valuename;
+ DWORD ve_valuelen;
+ DWORD_PTR ve_valueptr;
+ DWORD ve_type;
+} VALENTW, *PVALENTW;
+
+typedef ACCESS_MASK REGSAM;
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* defined(__cplusplus) */
+
+#endif /* __WINE_WINREG_H */
diff --git a/loader/wine/winuser.h b/loader/wine/winuser.h
new file mode 100644
index 0000000000..d74864ef7d
--- /dev/null
+++ b/loader/wine/winuser.h
@@ -0,0 +1,2929 @@
+#ifndef _WINUSER_
+#define _WINUSER_
+
+#ifndef RC_INVOKED
+#include <stdarg.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "pshpack1.h"
+
+/* flags for HIGHCONTRAST dwFlags field */
+#define HCF_HIGHCONTRASTON 0x00000001
+#define HCF_AVAILABLE 0x00000002
+#define HCF_HOTKEYACTIVE 0x00000004
+#define HCF_CONFIRMHOTKEY 0x00000008
+#define HCF_HOTKEYSOUND 0x00000010
+#define HCF_INDICATOR 0x00000020
+#define HCF_HOTKEYAVAILABLE 0x00000040
+
+typedef struct tagHIGHCONTRASTA
+{
+ UINT cbSize;
+ DWORD dwFlags;
+ LPSTR lpszDefaultScheme;
+} HIGHCONTRASTA, *LPHIGHCONTRASTA;
+
+typedef struct tagHIGHCONTRASTW
+{
+ UINT cbSize;
+ DWORD dwFlags;
+ LPWSTR lpszDefaultScheme;
+} HIGHCONTRASTW, *LPHIGHCONTRASTW;
+
+DECL_WINELIB_TYPE_AW(HIGHCONTRAST)
+DECL_WINELIB_TYPE_AW(LPHIGHCONTRAST)
+
+typedef struct
+{
+ UINT message;
+ UINT paramL;
+ UINT paramH;
+ DWORD time;
+ HWND hwnd;
+} EVENTMSG, *LPEVENTMSG;
+
+
+ /* Mouse hook structure */
+
+typedef struct
+{
+ POINT pt;
+ HWND hwnd;
+ UINT wHitTestCode;
+ DWORD dwExtraInfo;
+} MOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT, *LPMOUSEHOOKSTRUCT;
+
+
+ /* Hardware hook structure */
+
+typedef struct
+{
+ HWND hWnd;
+ UINT wMessage;
+ WPARAM wParam;
+ LPARAM lParam;
+} HARDWAREHOOKSTRUCT, *LPHARDWAREHOOKSTRUCT;
+
+
+ /* Debug hook structure */
+
+typedef struct
+{
+ DWORD idThread;
+ DWORD idThreadInstaller;
+ LPARAM lParam;
+ WPARAM wParam;
+ INT code;
+} DEBUGHOOKINFO, *LPDEBUGHOOKINFO;
+
+#define HKL_PREV 0
+#define HKL_NEXT 1
+
+#define KLF_ACTIVATE 0x00000001
+#define KLF_SUBSTITUTE_OK 0x00000002
+#define KLF_UNLOADPREVIOUS 0x00000004
+#define KLF_REORDER 0x00000008
+#define KLF_REPLACELANG 0x00000010
+#define KLF_NOTELLSHELL 0x00000080
+
+#define KL_NAMELENGTH 9
+
+ /***** Dialogs *****/
+#ifdef FSHIFT
+/* Gcc on Solaris has a version of this that we don't care about. */
+#undef FSHIFT
+#endif
+
+#define FVIRTKEY TRUE /* Assumed to be == TRUE */
+#define FNOINVERT 0x02
+#define FSHIFT 0x04
+#define FCONTROL 0x08
+#define FALT 0x10
+
+
+typedef struct tagANIMATIONINFO
+{
+ UINT cbSize;
+ INT iMinAnimate;
+} ANIMATIONINFO, *LPANIMATIONINFO;
+
+typedef struct tagNMHDR
+{
+ HWND hwndFrom;
+ UINT idFrom;
+ UINT code;
+} NMHDR, *LPNMHDR;
+
+typedef struct
+{
+ UINT cbSize;
+ INT iTabLength;
+ INT iLeftMargin;
+ INT iRightMargin;
+ UINT uiLengthDrawn;
+} DRAWTEXTPARAMS,*LPDRAWTEXTPARAMS;
+
+#define WM_USER 0x0400
+
+#define DT_EDITCONTROL 0x00002000
+#define DT_PATH_ELLIPSIS 0x00004000
+#define DT_END_ELLIPSIS 0x00008000
+#define DT_MODIFYSTRING 0x00010000
+#define DT_RTLREADING 0x00020000
+#define DT_WORD_ELLIPSIS 0x00040000
+
+typedef struct
+{
+ LPARAM lParam;
+ WPARAM16 wParam;
+ UINT16 message;
+ HWND16 hwnd;
+} CWPSTRUCT16, *LPCWPSTRUCT16;
+
+typedef struct
+{
+ LPARAM lParam;
+ WPARAM wParam;
+ UINT message;
+ HWND hwnd;
+} CWPSTRUCT, *LPCWPSTRUCT;
+
+
+
+typedef struct
+{
+ LRESULT lResult;
+ LPARAM lParam;
+ WPARAM16 wParam;
+ DWORD message;
+ HWND16 hwnd;
+} CWPRETSTRUCT16, *LPCWPRETSTRUCT16;
+
+typedef struct
+{
+ LRESULT lResult;
+ LPARAM lParam;
+ WPARAM wParam;
+ DWORD message;
+ HWND hwnd;
+} CWPRETSTRUCT, *LPCWPRETSTRUCT;
+
+typedef struct
+{
+ UINT length;
+ UINT flags;
+ UINT showCmd;
+ POINT ptMinPosition WINE_PACKED;
+ POINT ptMaxPosition WINE_PACKED;
+ RECT rcNormalPosition WINE_PACKED;
+} WINDOWPLACEMENT, *LPWINDOWPLACEMENT;
+
+
+ /* WINDOWPLACEMENT flags */
+#define WPF_SETMINPOSITION 0x0001
+#define WPF_RESTORETOMAXIMIZED 0x0002
+
+/***** Dialogs *****/
+
+ /* cbWndExtra bytes for dialog class */
+#define DLGWINDOWEXTRA 30
+
+/* Button control styles */
+#define BS_PUSHBUTTON 0x00000000L
+#define BS_DEFPUSHBUTTON 0x00000001L
+#define BS_CHECKBOX 0x00000002L
+#define BS_AUTOCHECKBOX 0x00000003L
+#define BS_RADIOBUTTON 0x00000004L
+#define BS_3STATE 0x00000005L
+#define BS_AUTO3STATE 0x00000006L
+#define BS_GROUPBOX 0x00000007L
+#define BS_USERBUTTON 0x00000008L
+#define BS_AUTORADIOBUTTON 0x00000009L
+#define BS_OWNERDRAW 0x0000000BL
+#define BS_LEFTTEXT 0x00000020L
+
+#define BS_TEXT 0x00000000L
+#define BS_ICON 0x00000040L
+#define BS_BITMAP 0x00000080L
+#define BS_LEFT 0x00000100L
+#define BS_RIGHT 0x00000200L
+#define BS_CENTER 0x00000300L
+#define BS_TOP 0x00000400L
+#define BS_BOTTOM 0x00000800L
+#define BS_VCENTER 0x00000C00L
+#define BS_PUSHLIKE 0x00001000L
+#define BS_MULTILINE 0x00002000L
+#define BS_NOTIFY 0x00004000L
+#define BS_FLAT 0x00008000L
+
+ /* Dialog styles */
+#define DS_ABSALIGN 0x0001
+#define DS_SYSMODAL 0x0002
+#define DS_3DLOOK 0x0004 /* win95 */
+#define DS_FIXEDSYS 0x0008 /* win95 */
+#define DS_NOFAILCREATE 0x0010 /* win95 */
+#define DS_LOCALEDIT 0x0020
+#define DS_SETFONT 0x0040
+#define DS_MODALFRAME 0x0080
+#define DS_NOIDLEMSG 0x0100
+#define DS_SETFOREGROUND 0x0200 /* win95 */
+#define DS_CONTROL 0x0400 /* win95 */
+#define DS_CENTER 0x0800 /* win95 */
+#define DS_CENTERMOUSE 0x1000 /* win95 */
+#define DS_CONTEXTHELP 0x2000 /* win95 */
+
+
+ /* Dialog messages */
+#define DM_GETDEFID (WM_USER+0)
+#define DM_SETDEFID (WM_USER+1)
+
+#define DC_HASDEFID 0x534b
+
+/* Owner draw control types */
+#define ODT_MENU 1
+#define ODT_LISTBOX 2
+#define ODT_COMBOBOX 3
+#define ODT_BUTTON 4
+#define ODT_STATIC 5
+
+/* Owner draw actions */
+#define ODA_DRAWENTIRE 0x0001
+#define ODA_SELECT 0x0002
+#define ODA_FOCUS 0x0004
+
+/* Owner draw state */
+#define ODS_SELECTED 0x0001
+#define ODS_GRAYED 0x0002
+#define ODS_DISABLED 0x0004
+#define ODS_CHECKED 0x0008
+#define ODS_FOCUS 0x0010
+#define ODS_COMBOBOXEDIT 0x1000
+#define ODS_HOTLIGHT 0x0040
+#define ODS_INACTIVE 0x0080
+
+/* Edit control styles */
+#define ES_LEFT 0x00000000
+#define ES_CENTER 0x00000001
+#define ES_RIGHT 0x00000002
+#define ES_MULTILINE 0x00000004
+#define ES_UPPERCASE 0x00000008
+#define ES_LOWERCASE 0x00000010
+#define ES_PASSWORD 0x00000020
+#define ES_AUTOVSCROLL 0x00000040
+#define ES_AUTOHSCROLL 0x00000080
+#define ES_NOHIDESEL 0x00000100
+#define ES_OEMCONVERT 0x00000400
+#define ES_READONLY 0x00000800
+#define ES_WANTRETURN 0x00001000
+#define ES_NUMBER 0x00002000
+
+/* OEM Resource Ordinal Numbers */
+#define OBM_CLOSED 32731
+#define OBM_RADIOCHECK 32732
+#define OBM_TRTYPE 32733
+#define OBM_LFARROWI 32734
+#define OBM_RGARROWI 32735
+#define OBM_DNARROWI 32736
+#define OBM_UPARROWI 32737
+#define OBM_COMBO 32738
+#define OBM_MNARROW 32739
+#define OBM_LFARROWD 32740
+#define OBM_RGARROWD 32741
+#define OBM_DNARROWD 32742
+#define OBM_UPARROWD 32743
+#define OBM_RESTORED 32744
+#define OBM_ZOOMD 32745
+#define OBM_REDUCED 32746
+#define OBM_RESTORE 32747
+#define OBM_ZOOM 32748
+#define OBM_REDUCE 32749
+#define OBM_LFARROW 32750
+#define OBM_RGARROW 32751
+#define OBM_DNARROW 32752
+#define OBM_UPARROW 32753
+#define OBM_CLOSE 32754
+#define OBM_OLD_RESTORE 32755
+#define OBM_OLD_ZOOM 32756
+#define OBM_OLD_REDUCE 32757
+#define OBM_BTNCORNERS 32758
+#define OBM_CHECKBOXES 32759
+#define OBM_CHECK 32760
+#define OBM_BTSIZE 32761
+#define OBM_OLD_LFARROW 32762
+#define OBM_OLD_RGARROW 32763
+#define OBM_OLD_DNARROW 32764
+#define OBM_OLD_UPARROW 32765
+#define OBM_SIZE 32766
+#define OBM_OLD_CLOSE 32767
+
+#define OCR_BUMMER 100
+#define OCR_DRAGOBJECT 101
+
+#define OCR_NORMAL 32512
+#define OCR_IBEAM 32513
+#define OCR_WAIT 32514
+#define OCR_CROSS 32515
+#define OCR_UP 32516
+#define OCR_SIZE 32640
+#define OCR_ICON 32641
+#define OCR_SIZENWSE 32642
+#define OCR_SIZENESW 32643
+#define OCR_SIZEWE 32644
+#define OCR_SIZENS 32645
+#define OCR_SIZEALL 32646
+#define OCR_ICOCUR 32647
+#define OCR_NO 32648
+#define OCR_APPSTARTING 32650
+#define OCR_HELP 32651 /* only defined in wine */
+
+#define OIC_SAMPLE 32512
+#define OIC_HAND 32513
+#define OIC_QUES 32514
+#define OIC_BANG 32515
+#define OIC_NOTE 32516
+#define OIC_PORTRAIT 32517
+#define OIC_LANDSCAPE 32518
+#define OIC_WINEICON 32519
+#define OIC_FOLDER 32520
+#define OIC_FOLDER2 32521
+#define OIC_FLOPPY 32522
+#define OIC_CDROM 32523
+#define OIC_HDISK 32524
+#define OIC_NETWORK 32525
+
+#define COLOR_SCROLLBAR 0
+#define COLOR_BACKGROUND 1
+#define COLOR_ACTIVECAPTION 2
+#define COLOR_INACTIVECAPTION 3
+#define COLOR_MENU 4
+#define COLOR_WINDOW 5
+#define COLOR_WINDOWFRAME 6
+#define COLOR_MENUTEXT 7
+#define COLOR_WINDOWTEXT 8
+#define COLOR_CAPTIONTEXT 9
+#define COLOR_ACTIVEBORDER 10
+#define COLOR_INACTIVEBORDER 11
+#define COLOR_APPWORKSPACE 12
+#define COLOR_HIGHLIGHT 13
+#define COLOR_HIGHLIGHTTEXT 14
+#define COLOR_BTNFACE 15
+#define COLOR_BTNSHADOW 16
+#define COLOR_GRAYTEXT 17
+#define COLOR_BTNTEXT 18
+#define COLOR_INACTIVECAPTIONTEXT 19
+#define COLOR_BTNHIGHLIGHT 20
+/* win95 colors */
+#define COLOR_3DDKSHADOW 21
+#define COLOR_3DLIGHT 22
+#define COLOR_INFOTEXT 23
+#define COLOR_INFOBK 24
+#define COLOR_DESKTOP COLOR_BACKGROUND
+#define COLOR_3DFACE COLOR_BTNFACE
+#define COLOR_3DSHADOW COLOR_BTNSHADOW
+#define COLOR_3DHIGHLIGHT COLOR_BTNHIGHLIGHT
+#define COLOR_3DHILIGHT COLOR_BTNHIGHLIGHT
+#define COLOR_BTNHILIGHT COLOR_BTNHIGHLIGHT
+/* win98 colors */
+#define COLOR_ALTERNATEBTNFACE 25 /* undocumented, constant's name unknown */
+#define COLOR_HOTLIGHT 26
+#define COLOR_GRADIENTACTIVECAPTION 27
+#define COLOR_GRADIENTINACTIVECAPTION 28
+
+ /* WM_CTLCOLOR values */
+#define CTLCOLOR_MSGBOX 0
+#define CTLCOLOR_EDIT 1
+#define CTLCOLOR_LISTBOX 2
+#define CTLCOLOR_BTN 3
+#define CTLCOLOR_DLG 4
+#define CTLCOLOR_SCROLLBAR 5
+#define CTLCOLOR_STATIC 6
+
+/* Edit control messages */
+#define EM_GETSEL 0x00b0
+#define EM_SETSEL 0x00b1
+#define EM_GETRECT 0x00b2
+#define EM_SETRECT 0x00b3
+#define EM_SETRECTNP 0x00b4
+#define EM_SCROLL 0x00b5
+#define EM_LINESCROLL 0x00b6
+#define EM_SCROLLCARET 0x00b7
+#define EM_GETMODIFY 0x00b8
+#define EM_SETMODIFY 0x00b9
+#define EM_GETLINECOUNT 0x00ba
+#define EM_LINEINDEX 0x00bb
+#define EM_SETHANDLE 0x00bc
+#define EM_GETHANDLE 0x00bd
+#define EM_GETTHUMB 0x00be
+/* FIXME : missing from specs 0x00bf and 0x00c0 */
+#define EM_LINELENGTH 0x00c1
+#define EM_REPLACESEL 0x00c2
+/* FIXME : missing from specs 0x00c3 */
+#define EM_GETLINE 0x00c4
+#define EM_LIMITTEXT 0x00c5
+#define EM_CANUNDO 0x00c6
+#define EM_UNDO 0x00c7
+#define EM_FMTLINES 0x00c8
+#define EM_LINEFROMCHAR 0x00c9
+/* FIXME : missing from specs 0x00ca */
+#define EM_SETTABSTOPS 0x00cb
+#define EM_SETPASSWORDCHAR 0x00cc
+#define EM_EMPTYUNDOBUFFER 0x00cd
+#define EM_GETFIRSTVISIBLELINE 0x00ce
+#define EM_SETREADONLY 0x00cf
+#define EM_SETWORDBREAKPROC 0x00d0
+#define EM_GETWORDBREAKPROC 0x00d1
+#define EM_GETPASSWORDCHAR 0x00d2
+#define EM_SETMARGINS 0x00d3
+#define EM_GETMARGINS 0x00d4
+#define EM_GETLIMITTEXT 0x00d5
+#define EM_POSFROMCHAR 0x00d6
+#define EM_CHARFROMPOS 0x00d7
+/* a name change since win95 */
+#define EM_SETLIMITTEXT EM_LIMITTEXT
+
+/* EDITWORDBREAKPROC code values */
+#define WB_LEFT 0
+#define WB_RIGHT 1
+#define WB_ISDELIMITER 2
+
+/* Edit control notification codes */
+#define EN_SETFOCUS 0x0100
+#define EN_KILLFOCUS 0x0200
+#define EN_CHANGE 0x0300
+#define EN_UPDATE 0x0400
+#define EN_ERRSPACE 0x0500
+#define EN_MAXTEXT 0x0501
+#define EN_HSCROLL 0x0601
+#define EN_VSCROLL 0x0602
+
+/* New since win95 : EM_SETMARGIN parameters */
+#define EC_LEFTMARGIN 0x0001
+#define EC_RIGHTMARGIN 0x0002
+#define EC_USEFONTINFO 0xffff
+
+
+/* Messages */
+
+ /* WM_GETDLGCODE values */
+
+
+#define WM_NULL 0x0000
+#define WM_CREATE 0x0001
+#define WM_DESTROY 0x0002
+#define WM_MOVE 0x0003
+#define WM_SIZEWAIT 0x0004
+#define WM_SIZE 0x0005
+#define WM_ACTIVATE 0x0006
+#define WM_SETFOCUS 0x0007
+#define WM_KILLFOCUS 0x0008
+#define WM_SETVISIBLE 0x0009
+#define WM_ENABLE 0x000a
+#define WM_SETREDRAW 0x000b
+#define WM_SETTEXT 0x000c
+#define WM_GETTEXT 0x000d
+#define WM_GETTEXTLENGTH 0x000e
+#define WM_PAINT 0x000f
+#define WM_CLOSE 0x0010
+#define WM_QUERYENDSESSION 0x0011
+#define WM_QUIT 0x0012
+#define WM_QUERYOPEN 0x0013
+#define WM_ERASEBKGND 0x0014
+#define WM_SYSCOLORCHANGE 0x0015
+#define WM_ENDSESSION 0x0016
+#define WM_SYSTEMERROR 0x0017
+#define WM_SHOWWINDOW 0x0018
+#define WM_CTLCOLOR 0x0019
+#define WM_WININICHANGE 0x001a
+#define WM_SETTINGCHANGE WM_WININICHANGE
+#define WM_DEVMODECHANGE 0x001b
+#define WM_ACTIVATEAPP 0x001c
+#define WM_FONTCHANGE 0x001d
+#define WM_TIMECHANGE 0x001e
+#define WM_CANCELMODE 0x001f
+#define WM_SETCURSOR 0x0020
+#define WM_MOUSEACTIVATE 0x0021
+#define WM_CHILDACTIVATE 0x0022
+#define WM_QUEUESYNC 0x0023
+#define WM_GETMINMAXINFO 0x0024
+
+#define WM_PAINTICON 0x0026
+#define WM_ICONERASEBKGND 0x0027
+#define WM_NEXTDLGCTL 0x0028
+#define WM_ALTTABACTIVE 0x0029
+#define WM_SPOOLERSTATUS 0x002a
+#define WM_DRAWITEM 0x002b
+#define WM_MEASUREITEM 0x002c
+#define WM_DELETEITEM 0x002d
+#define WM_VKEYTOITEM 0x002e
+#define WM_CHARTOITEM 0x002f
+#define WM_SETFONT 0x0030
+#define WM_GETFONT 0x0031
+#define WM_SETHOTKEY 0x0032
+#define WM_GETHOTKEY 0x0033
+#define WM_FILESYSCHANGE 0x0034
+#define WM_ISACTIVEICON 0x0035
+#define WM_QUERYPARKICON 0x0036
+#define WM_QUERYDRAGICON 0x0037
+#define WM_QUERYSAVESTATE 0x0038
+#define WM_COMPAREITEM 0x0039
+#define WM_TESTING 0x003a
+
+#define WM_OTHERWINDOWCREATED 0x003c
+#define WM_OTHERWINDOWDESTROYED 0x003d
+#define WM_ACTIVATESHELLWINDOW 0x003e
+
+#define WM_COMPACTING 0x0041
+
+#define WM_COMMNOTIFY 0x0044
+#define WM_WINDOWPOSCHANGING 0x0046
+#define WM_WINDOWPOSCHANGED 0x0047
+#define WM_POWER 0x0048
+
+ /* Win32 4.0 messages */
+#define WM_COPYDATA 0x004a
+#define WM_CANCELJOURNAL 0x004b
+#define WM_NOTIFY 0x004e
+#define WM_HELP 0x0053
+#define WM_NOTIFYFORMAT 0x0055
+
+#define WM_CONTEXTMENU 0x007b
+#define WM_STYLECHANGING 0x007c
+#define WM_STYLECHANGED 0x007d
+#define WM_DISPLAYCHANGE 0x007e
+#define WM_GETICON 0x007f
+#define WM_SETICON 0x0080
+
+ /* Non-client system messages */
+#define WM_NCCREATE 0x0081
+#define WM_NCDESTROY 0x0082
+#define WM_NCCALCSIZE 0x0083
+#define WM_NCHITTEST 0x0084
+#define WM_NCPAINT 0x0085
+#define WM_NCACTIVATE 0x0086
+
+#define WM_GETDLGCODE 0x0087
+#define WM_SYNCPAINT 0x0088
+#define WM_SYNCTASK 0x0089
+
+ /* Non-client mouse messages */
+#define WM_NCMOUSEMOVE 0x00a0
+#define WM_NCLBUTTONDOWN 0x00a1
+#define WM_NCLBUTTONUP 0x00a2
+#define WM_NCLBUTTONDBLCLK 0x00a3
+#define WM_NCRBUTTONDOWN 0x00a4
+#define WM_NCRBUTTONUP 0x00a5
+#define WM_NCRBUTTONDBLCLK 0x00a6
+#define WM_NCMBUTTONDOWN 0x00a7
+#define WM_NCMBUTTONUP 0x00a8
+#define WM_NCMBUTTONDBLCLK 0x00a9
+
+ /* Keyboard messages */
+#define WM_KEYDOWN 0x0100
+#define WM_KEYUP 0x0101
+#define WM_CHAR 0x0102
+#define WM_DEADCHAR 0x0103
+#define WM_SYSKEYDOWN 0x0104
+#define WM_SYSKEYUP 0x0105
+#define WM_SYSCHAR 0x0106
+#define WM_SYSDEADCHAR 0x0107
+#define WM_KEYFIRST WM_KEYDOWN
+#define WM_KEYLAST 0x0108
+
+/* Win32 4.0 messages for IME */
+#define WM_IME_STARTCOMPOSITION 0x010d
+#define WM_IME_ENDCOMPOSITION 0x010e
+#define WM_IME_COMPOSITION 0x010f
+#define WM_IME_KEYLAST 0x010f
+
+#define WM_INITDIALOG 0x0110
+#define WM_COMMAND 0x0111
+#define WM_SYSCOMMAND 0x0112
+#define WM_TIMER 0x0113
+#define WM_SYSTIMER 0x0118
+
+ /* scroll messages */
+#define WM_HSCROLL 0x0114
+#define WM_VSCROLL 0x0115
+
+/* Menu messages */
+#define WM_INITMENU 0x0116
+#define WM_INITMENUPOPUP 0x0117
+
+#define WM_MENUSELECT 0x011F
+#define WM_MENUCHAR 0x0120
+#define WM_ENTERIDLE 0x0121
+
+#define WM_LBTRACKPOINT 0x0131
+
+ /* Win32 CTLCOLOR messages */
+#define WM_CTLCOLORMSGBOX 0x0132
+#define WM_CTLCOLOREDIT 0x0133
+#define WM_CTLCOLORLISTBOX 0x0134
+#define WM_CTLCOLORBTN 0x0135
+#define WM_CTLCOLORDLG 0x0136
+#define WM_CTLCOLORSCROLLBAR 0x0137
+#define WM_CTLCOLORSTATIC 0x0138
+
+ /* Mouse messages */
+#define WM_MOUSEMOVE 0x0200
+#define WM_LBUTTONDOWN 0x0201
+#define WM_LBUTTONUP 0x0202
+#define WM_LBUTTONDBLCLK 0x0203
+#define WM_RBUTTONDOWN 0x0204
+#define WM_RBUTTONUP 0x0205
+#define WM_RBUTTONDBLCLK 0x0206
+#define WM_MBUTTONDOWN 0x0207
+#define WM_MBUTTONUP 0x0208
+#define WM_MBUTTONDBLCLK 0x0209
+#define WM_MOUSEWHEEL 0x020A
+#define WM_MOUSEFIRST WM_MOUSEMOVE
+
+
+#define WM_MOUSELAST WM_MOUSEWHEEL
+
+#define WHEEL_DELTA 120
+#define WHEEL_PAGESCROLL (UINT_MAX)
+#define WM_PARENTNOTIFY 0x0210
+#define WM_ENTERMENULOOP 0x0211
+#define WM_EXITMENULOOP 0x0212
+#define WM_NEXTMENU 0x0213
+
+ /* Win32 4.0 messages */
+#define WM_SIZING 0x0214
+#define WM_CAPTURECHANGED 0x0215
+#define WM_MOVING 0x0216
+
+ /* MDI messages */
+#define WM_MDICREATE 0x0220
+#define WM_MDIDESTROY 0x0221
+#define WM_MDIACTIVATE 0x0222
+#define WM_MDIRESTORE 0x0223
+#define WM_MDINEXT 0x0224
+#define WM_MDIMAXIMIZE 0x0225
+#define WM_MDITILE 0x0226
+#define WM_MDICASCADE 0x0227
+#define WM_MDIICONARRANGE 0x0228
+#define WM_MDIGETACTIVE 0x0229
+#define WM_MDIREFRESHMENU 0x0234
+
+ /* D&D messages */
+#define WM_DROPOBJECT 0x022A
+#define WM_QUERYDROPOBJECT 0x022B
+#define WM_BEGINDRAG 0x022C
+#define WM_DRAGLOOP 0x022D
+#define WM_DRAGSELECT 0x022E
+#define WM_DRAGMOVE 0x022F
+#define WM_MDISETMENU 0x0230
+
+#define WM_ENTERSIZEMOVE 0x0231
+#define WM_EXITSIZEMOVE 0x0232
+#define WM_DROPFILES 0x0233
+
+
+/* Win32 4.0 messages for IME */
+#define WM_IME_SETCONTEXT 0x0281
+#define WM_IME_NOTIFY 0x0282
+#define WM_IME_CONTROL 0x0283
+#define WM_IME_COMPOSITIONFULL 0x0284
+#define WM_IME_SELECT 0x0285
+#define WM_IME_CHAR 0x0286
+/* Win32 5.0 messages for IME */
+#define WM_IME_REQUEST 0x0288
+
+/* Win32 4.0 messages for IME */
+#define WM_IME_KEYDOWN 0x0290
+#define WM_IME_KEYUP 0x0291
+
+/* Clipboard command messages */
+#define WM_CUT 0x0300
+#define WM_COPY 0x0301
+#define WM_PASTE 0x0302
+#define WM_CLEAR 0x0303
+#define WM_UNDO 0x0304
+
+/* Clipboard owner messages */
+#define WM_RENDERFORMAT 0x0305
+#define WM_RENDERALLFORMATS 0x0306
+#define WM_DESTROYCLIPBOARD 0x0307
+
+/* Clipboard viewer messages */
+#define WM_DRAWCLIPBOARD 0x0308
+#define WM_PAINTCLIPBOARD 0x0309
+#define WM_VSCROLLCLIPBOARD 0x030A
+#define WM_SIZECLIPBOARD 0x030B
+#define WM_ASKCBFORMATNAME 0x030C
+#define WM_CHANGECBCHAIN 0x030D
+#define WM_HSCROLLCLIPBOARD 0x030E
+
+#define WM_QUERYNEWPALETTE 0x030F
+#define WM_PALETTEISCHANGING 0x0310
+#define WM_PALETTECHANGED 0x0311
+#define WM_HOTKEY 0x0312
+
+#define WM_PRINT 0x0317
+#define WM_PRINTCLIENT 0x0318
+
+ /* FIXME: This does not belong to any libwine interface header */
+ /* MFC messages [360-38f] */
+
+#define WM_QUERYAFXWNDPROC 0x0360
+#define WM_SIZEPARENT 0x0361
+#define WM_SETMESSAGESTRING 0x0362
+#define WM_IDLEUPDATECMDUI 0x0363
+#define WM_INITIALUPDATE 0x0364
+#define WM_COMMANDHELP 0x0365
+#define WM_HELPHITTEST 0x0366
+#define WM_EXITHELPMODE 0x0367
+#define WM_RECALCPARENT 0x0368
+#define WM_SIZECHILD 0x0369
+#define WM_KICKIDLE 0x036A
+#define WM_QUERYCENTERWND 0x036B
+#define WM_DISABLEMODAL 0x036C
+#define WM_FLOATSTATUS 0x036D
+#define WM_ACTIVATETOPLEVEL 0x036E
+#define WM_QUERY3DCONTROLS 0x036F
+#define WM_SOCKET_NOTIFY 0x0373
+#define WM_SOCKET_DEAD 0x0374
+#define WM_POPMESSAGESTRING 0x0375
+#define WM_OCC_LOADFROMSTREAM 0x0376
+#define WM_OCC_LOADFROMSTORAGE 0x0377
+#define WM_OCC_INITNEW 0x0378
+#define WM_OCC_LOADFROMSTREAM_EX 0x037A
+#define WM_OCC_LOADFROMSTORAGE_EX 0x037B
+#define WM_QUEUE_SENTINEL 0x0379
+
+#define WM_PENWINFIRST 0x0380
+#define WM_PENWINLAST 0x038F
+
+/* end of MFC messages */
+
+/* FIXME: The following two lines do not belong to any libwine interface header */
+#define WM_COALESCE_FIRST 0x0390
+#define WM_COALESCE_LAST 0x039F
+
+#define WM_APP 0x8000
+
+
+#define DLGC_WANTARROWS 0x0001
+#define DLGC_WANTTAB 0x0002
+#define DLGC_WANTALLKEYS 0x0004
+#define DLGC_WANTMESSAGE 0x0004
+#define DLGC_HASSETSEL 0x0008
+#define DLGC_DEFPUSHBUTTON 0x0010
+#define DLGC_UNDEFPUSHBUTTON 0x0020
+#define DLGC_RADIOBUTTON 0x0040
+#define DLGC_WANTCHARS 0x0080
+#define DLGC_STATIC 0x0100
+#define DLGC_BUTTON 0x2000
+
+/* Standard dialog button IDs */
+#define IDOK 1
+#define IDCANCEL 2
+#define IDABORT 3
+#define IDRETRY 4
+#define IDIGNORE 5
+#define IDYES 6
+#define IDNO 7
+#define IDCLOSE 8
+#define IDHELP 9
+
+/****** Window classes ******/
+
+typedef struct tagCREATESTRUCTA
+{
+ LPVOID lpCreateParams;
+ HINSTANCE hInstance;
+ HMENU hMenu;
+ HWND hwndParent;
+ INT cy;
+ INT cx;
+ INT y;
+ INT x;
+ LONG style;
+ LPCSTR lpszName;
+ LPCSTR lpszClass;
+ DWORD dwExStyle;
+} CREATESTRUCTA, *LPCREATESTRUCTA;
+
+typedef struct
+{
+ LPVOID lpCreateParams;
+ HINSTANCE hInstance;
+ HMENU hMenu;
+ HWND hwndParent;
+ INT cy;
+ INT cx;
+ INT y;
+ INT x;
+ LONG style;
+ LPCWSTR lpszName;
+ LPCWSTR lpszClass;
+ DWORD dwExStyle;
+} CREATESTRUCTW, *LPCREATESTRUCTW;
+
+DECL_WINELIB_TYPE_AW(CREATESTRUCT)
+DECL_WINELIB_TYPE_AW(LPCREATESTRUCT)
+
+typedef struct
+{
+ HDC hdc;
+ WIN_BOOL fErase;
+ RECT rcPaint;
+ WIN_BOOL fRestore;
+ WIN_BOOL fIncUpdate;
+ BYTE rgbReserved[32];
+} PAINTSTRUCT, *PPAINTSTRUCT, *LPPAINTSTRUCT;
+
+typedef struct
+{
+ HMENU hWindowMenu;
+ UINT idFirstChild;
+} CLIENTCREATESTRUCT, *LPCLIENTCREATESTRUCT;
+
+
+typedef struct
+{
+ LPCSTR szClass;
+ LPCSTR szTitle;
+ HINSTANCE hOwner;
+ INT x;
+ INT y;
+ INT cx;
+ INT cy;
+ DWORD style;
+ LPARAM lParam;
+} MDICREATESTRUCTA, *LPMDICREATESTRUCTA;
+
+typedef struct
+{
+ LPCWSTR szClass;
+ LPCWSTR szTitle;
+ HINSTANCE hOwner;
+ INT x;
+ INT y;
+ INT cx;
+ INT cy;
+ DWORD style;
+ LPARAM lParam;
+} MDICREATESTRUCTW, *LPMDICREATESTRUCTW;
+
+DECL_WINELIB_TYPE_AW(MDICREATESTRUCT)
+DECL_WINELIB_TYPE_AW(LPMDICREATESTRUCT)
+
+#define MDITILE_VERTICAL 0x0000
+#define MDITILE_HORIZONTAL 0x0001
+#define MDITILE_SKIPDISABLED 0x0002
+
+#define MDIS_ALLCHILDSTYLES 0x0001
+
+typedef struct {
+ DWORD styleOld;
+ DWORD styleNew;
+} STYLESTRUCT, *LPSTYLESTRUCT;
+
+ /* Offsets for GetWindowLong() and GetWindowWord() */
+#define GWL_USERDATA (-21)
+#define GWL_EXSTYLE (-20)
+#define GWL_STYLE (-16)
+#define GWW_ID (-12)
+#define GWL_ID GWW_ID
+#define GWW_HWNDPARENT (-8)
+#define GWL_HWNDPARENT GWW_HWNDPARENT
+#define GWW_HINSTANCE (-6)
+#define GWL_HINSTANCE GWW_HINSTANCE
+#define GWL_WNDPROC (-4)
+#define DWL_MSGRESULT 0
+#define DWL_DLGPROC 4
+#define DWL_USER 8
+
+ /* GetWindow() constants */
+#define GW_HWNDFIRST 0
+#define GW_HWNDLAST 1
+#define GW_HWNDNEXT 2
+#define GW_HWNDPREV 3
+#define GW_OWNER 4
+#define GW_CHILD 5
+
+ /* WM_GETMINMAXINFO struct */
+typedef struct
+{
+ POINT ptReserved;
+ POINT ptMaxSize;
+ POINT ptMaxPosition;
+ POINT ptMinTrackSize;
+ POINT ptMaxTrackSize;
+} MINMAXINFO, *PMINMAXINFO, *LPMINMAXINFO;
+
+
+ /* RedrawWindow() flags */
+#define RDW_INVALIDATE 0x0001
+#define RDW_INTERNALPAINT 0x0002
+#define RDW_ERASE 0x0004
+#define RDW_VALIDATE 0x0008
+#define RDW_NOINTERNALPAINT 0x0010
+#define RDW_NOERASE 0x0020
+#define RDW_NOCHILDREN 0x0040
+#define RDW_ALLCHILDREN 0x0080
+#define RDW_UPDATENOW 0x0100
+#define RDW_ERASENOW 0x0200
+#define RDW_FRAME 0x0400
+#define RDW_NOFRAME 0x0800
+
+/* debug flags */
+#define DBGFILL_ALLOC 0xfd
+#define DBGFILL_FREE 0xfb
+#define DBGFILL_BUFFER 0xf9
+#define DBGFILL_STACK 0xf7
+
+ /* WM_WINDOWPOSCHANGING/CHANGED struct */
+typedef struct tagWINDOWPOS
+{
+ HWND hwnd;
+ HWND hwndInsertAfter;
+ INT x;
+ INT y;
+ INT cx;
+ INT cy;
+ UINT flags;
+} WINDOWPOS, *PWINDOWPOS, *LPWINDOWPOS;
+
+
+ /* WM_MOUSEACTIVATE return values */
+#define MA_ACTIVATE 1
+#define MA_ACTIVATEANDEAT 2
+#define MA_NOACTIVATE 3
+#define MA_NOACTIVATEANDEAT 4
+
+ /* WM_ACTIVATE wParam values */
+#define WA_INACTIVE 0
+#define WA_ACTIVE 1
+#define WA_CLICKACTIVE 2
+
+/* WM_GETICON/WM_SETICON params values */
+#define ICON_SMALL 0
+#define ICON_BIG 1
+
+ /* WM_NCCALCSIZE parameter structure */
+typedef struct
+{
+ RECT rgrc[3];
+ WINDOWPOS *lppos;
+} NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS;
+
+
+ /* WM_NCCALCSIZE return flags */
+#define WVR_ALIGNTOP 0x0010
+#define WVR_ALIGNLEFT 0x0020
+#define WVR_ALIGNBOTTOM 0x0040
+#define WVR_ALIGNRIGHT 0x0080
+#define WVR_HREDRAW 0x0100
+#define WVR_VREDRAW 0x0200
+#define WVR_REDRAW (WVR_HREDRAW | WVR_VREDRAW)
+#define WVR_VALIDRECTS 0x0400
+
+ /* WM_NCHITTEST return codes */
+#define HTERROR (-2)
+#define HTTRANSPARENT (-1)
+#define HTNOWHERE 0
+#define HTCLIENT 1
+#define HTCAPTION 2
+#define HTSYSMENU 3
+#define HTSIZE 4
+#define HTMENU 5
+#define HTHSCROLL 6
+#define HTVSCROLL 7
+#define HTMINBUTTON 8
+#define HTMAXBUTTON 9
+#define HTLEFT 10
+#define HTRIGHT 11
+#define HTTOP 12
+#define HTTOPLEFT 13
+#define HTTOPRIGHT 14
+#define HTBOTTOM 15
+#define HTBOTTOMLEFT 16
+#define HTBOTTOMRIGHT 17
+#define HTBORDER 18
+#define HTGROWBOX HTSIZE
+#define HTREDUCE HTMINBUTTON
+#define HTZOOM HTMAXBUTTON
+#define HTOBJECT 19
+#define HTCLOSE 20
+#define HTHELP 21
+#define HTSIZEFIRST HTLEFT
+#define HTSIZELAST HTBOTTOMRIGHT
+
+ /* WM_SYSCOMMAND parameters */
+#ifdef SC_SIZE /* at least HP-UX: already defined in /usr/include/sys/signal.h */
+#undef SC_SIZE
+#endif
+#define SC_SIZE 0xf000
+#define SC_MOVE 0xf010
+#define SC_MINIMIZE 0xf020
+#define SC_MAXIMIZE 0xf030
+#define SC_NEXTWINDOW 0xf040
+#define SC_PREVWINDOW 0xf050
+#define SC_CLOSE 0xf060
+#define SC_VSCROLL 0xf070
+#define SC_HSCROLL 0xf080
+#define SC_MOUSEMENU 0xf090
+#define SC_KEYMENU 0xf100
+#define SC_ARRANGE 0xf110
+#define SC_RESTORE 0xf120
+#define SC_TASKLIST 0xf130
+#define SC_SCREENSAVE 0xf140
+#define SC_HOTKEY 0xf150
+
+#define CS_VREDRAW 0x0001
+#define CS_HREDRAW 0x0002
+#define CS_KEYCVTWINDOW 0x0004
+#define CS_DBLCLKS 0x0008
+#define CS_OWNDC 0x0020
+#define CS_CLASSDC 0x0040
+#define CS_PARENTDC 0x0080
+#define CS_NOKEYCVT 0x0100
+#define CS_NOCLOSE 0x0200
+#define CS_SAVEBITS 0x0800
+#define CS_BYTEALIGNCLIENT 0x1000
+#define CS_BYTEALIGNWINDOW 0x2000
+#define CS_GLOBALCLASS 0x4000
+#define CS_IME 0x00010000
+
+#define PRF_CHECKVISIBLE 0x00000001L
+#define PRF_NONCLIENT 0x00000002L
+#define PRF_CLIENT 0x00000004L
+#define PRF_ERASEBKGND 0x00000008L
+#define PRF_CHILDREN 0x00000010L
+#define PRF_OWNED 0x00000020L
+
+ /* Offsets for GetClassLong() and GetClassWord() */
+#define GCL_MENUNAME (-8)
+#define GCW_HBRBACKGROUND (-10)
+#define GCL_HBRBACKGROUND GCW_HBRBACKGROUND
+#define GCW_HCURSOR (-12)
+#define GCL_HCURSOR GCW_HCURSOR
+#define GCW_HICON (-14)
+#define GCL_HICON GCW_HICON
+#define GCW_HMODULE (-16)
+#define GCL_HMODULE GCW_HMODULE
+#define GCW_CBWNDEXTRA (-18)
+#define GCL_CBWNDEXTRA GCW_CBWNDEXTRA
+#define GCW_CBCLSEXTRA (-20)
+#define GCL_CBCLSEXTRA GCW_CBCLSEXTRA
+#define GCL_WNDPROC (-24)
+#define GCW_STYLE (-26)
+#define GCL_STYLE GCW_STYLE
+#define GCW_ATOM (-32)
+#define GCW_HICONSM (-34)
+#define GCL_HICONSM GCW_HICONSM
+
+
+/***** Window hooks *****/
+
+ /* Hook values */
+#define WH_MIN (-1)
+#define WH_MSGFILTER (-1)
+#define WH_JOURNALRECORD 0
+#define WH_JOURNALPLAYBACK 1
+#define WH_KEYBOARD 2
+#define WH_GETMESSAGE 3
+#define WH_CALLWNDPROC 4
+#define WH_CBT 5
+#define WH_SYSMSGFILTER 6
+#define WH_MOUSE 7
+#define WH_HARDWARE 8
+#define WH_DEBUG 9
+#define WH_SHELL 10
+#define WH_FOREGROUNDIDLE 11
+#define WH_CALLWNDPROCRET 12
+#define WH_MAX 12
+
+#define WH_MINHOOK WH_MIN
+#define WH_MAXHOOK WH_MAX
+#define WH_NB_HOOKS (WH_MAXHOOK-WH_MINHOOK+1)
+
+ /* Hook action codes */
+#define HC_ACTION 0
+#define HC_GETNEXT 1
+#define HC_SKIP 2
+#define HC_NOREMOVE 3
+#define HC_NOREM HC_NOREMOVE
+#define HC_SYSMODALON 4
+#define HC_SYSMODALOFF 5
+
+ /* CallMsgFilter() values */
+#define MSGF_DIALOGBOX 0
+#define MSGF_MESSAGEBOX 1
+#define MSGF_MENU 2
+#define MSGF_MOVE 3
+#define MSGF_SIZE 4
+#define MSGF_SCROLLBAR 5
+#define MSGF_NEXTWINDOW 6
+#define MSGF_MAINLOOP 8
+#define MSGF_USER 4096
+
+typedef struct
+{
+ UINT style;
+ WNDPROC lpfnWndProc;
+ INT cbClsExtra;
+ INT cbWndExtra;
+ HINSTANCE hInstance;
+ HICON hIcon;
+ HCURSOR hCursor;
+ HBRUSH hbrBackground;
+ LPCSTR lpszMenuName;
+ LPCSTR lpszClassName;
+} WNDCLASSA, *LPWNDCLASSA;
+
+typedef struct
+{
+ UINT style;
+ WNDPROC lpfnWndProc;
+ INT cbClsExtra;
+ INT cbWndExtra;
+ HINSTANCE hInstance;
+ HICON hIcon;
+ HCURSOR hCursor;
+ HBRUSH hbrBackground;
+ LPCWSTR lpszMenuName;
+ LPCWSTR lpszClassName;
+} WNDCLASSW, *LPWNDCLASSW;
+
+DECL_WINELIB_TYPE_AW(WNDCLASS)
+DECL_WINELIB_TYPE_AW(LPWNDCLASS)
+
+typedef struct {
+ DWORD dwData;
+ DWORD cbData;
+ LPVOID lpData;
+} COPYDATASTRUCT, *PCOPYDATASTRUCT, *LPCOPYDATASTRUCT;
+
+typedef struct {
+ HMENU hmenuIn;
+ HMENU hmenuNext;
+ HWND hwndNext;
+} MDINEXTMENU, *PMDINEXTMENU, *LPMDINEXTMENU;
+
+/* WinHelp internal structure */
+typedef struct {
+ WORD size;
+ WORD command;
+ LONG data;
+ LONG reserved;
+ WORD ofsFilename;
+ WORD ofsData;
+} WINHELP,*LPWINHELP;
+
+typedef struct
+{
+ UINT16 mkSize;
+ BYTE mkKeyList;
+ BYTE szKeyphrase[1];
+} MULTIKEYHELP, *LPMULTIKEYHELP;
+
+typedef struct {
+ WORD wStructSize;
+ WORD x;
+ WORD y;
+ WORD dx;
+ WORD dy;
+ WORD wMax;
+ char rgchMember[2];
+} HELPWININFO, *LPHELPWININFO;
+
+#define HELP_CONTEXT 0x0001
+#define HELP_QUIT 0x0002
+#define HELP_INDEX 0x0003
+#define HELP_CONTENTS 0x0003
+#define HELP_HELPONHELP 0x0004
+#define HELP_SETINDEX 0x0005
+#define HELP_SETCONTENTS 0x0005
+#define HELP_CONTEXTPOPUP 0x0008
+#define HELP_FORCEFILE 0x0009
+#define HELP_KEY 0x0101
+#define HELP_COMMAND 0x0102
+#define HELP_PARTIALKEY 0x0105
+#define HELP_MULTIKEY 0x0201
+#define HELP_SETWINPOS 0x0203
+#define HELP_CONTEXTMENU 0x000a
+#define HELP_FINDER 0x000b
+#define HELP_WM_HELP 0x000c
+#define HELP_SETPOPUP_POS 0x000d
+
+#define HELP_TCARD 0x8000
+#define HELP_TCARD_DATA 0x0010
+#define HELP_TCARD_OTHER_CALLER 0x0011
+
+
+ /* ChangeDisplaySettings return codes */
+
+#define DISP_CHANGE_SUCCESSFUL 0
+#define DISP_CHANGE_RESTART 1
+#define DISP_CHANGE_FAILED (-1)
+#define DISP_CHANGE_BADMODE (-2)
+#define DISP_CHANGE_NOTUPDATED (-3)
+#define DISP_CHANGE_BADFLAGS (-4)
+#define DISP_CHANGE_BADPARAM (-5)
+
+/* ChangeDisplaySettings.dwFlags */
+#define CDS_UPDATEREGISTRY 0x00000001
+#define CDS_TEST 0x00000002
+#define CDS_FULLSCREEN 0x00000004
+#define CDS_GLOBAL 0x00000008
+#define CDS_SET_PRIMARY 0x00000010
+#define CDS_RESET 0x40000000
+#define CDS_SETRECT 0x20000000
+#define CDS_NORESET 0x10000000
+
+/* flags to FormatMessage */
+#define FORMAT_MESSAGE_ALLOCATE_BUFFER 0x00000100
+#define FORMAT_MESSAGE_IGNORE_INSERTS 0x00000200
+#define FORMAT_MESSAGE_FROM_STRING 0x00000400
+#define FORMAT_MESSAGE_FROM_HMODULE 0x00000800
+#define FORMAT_MESSAGE_FROM_SYSTEM 0x00001000
+#define FORMAT_MESSAGE_ARGUMENT_ARRAY 0x00002000
+#define FORMAT_MESSAGE_MAX_WIDTH_MASK 0x000000FF
+
+typedef struct
+{
+ UINT cbSize;
+ UINT style;
+ WNDPROC lpfnWndProc;
+ INT cbClsExtra;
+ INT cbWndExtra;
+ HINSTANCE hInstance;
+ HICON hIcon;
+ HCURSOR hCursor;
+ HBRUSH hbrBackground;
+ LPCSTR lpszMenuName;
+ LPCSTR lpszClassName;
+ HICON hIconSm;
+} WNDCLASSEXA, *LPWNDCLASSEXA;
+
+typedef struct
+{
+ UINT cbSize;
+ UINT style;
+ WNDPROC lpfnWndProc;
+ INT cbClsExtra;
+ INT cbWndExtra;
+ HINSTANCE hInstance;
+ HICON hIcon;
+ HCURSOR hCursor;
+ HBRUSH hbrBackground;
+ LPCWSTR lpszMenuName;
+ LPCWSTR lpszClassName;
+ HICON hIconSm;
+} WNDCLASSEXW, *LPWNDCLASSEXW;
+
+DECL_WINELIB_TYPE_AW(WNDCLASSEX)
+DECL_WINELIB_TYPE_AW(LPWNDCLASSEX)
+
+typedef struct tagMSG
+{
+ HWND hwnd;
+ UINT message;
+ WPARAM wParam;
+ LPARAM lParam;
+ DWORD time;
+ POINT pt;
+} MSG, *LPMSG;
+
+#define POINTSTOPOINT(pt, pts) \
+ { (pt).x = (LONG)(SHORT)LOWORD(*(LONG*)&pts); \
+ (pt).y = (LONG)(SHORT)HIWORD(*(LONG*)&pts); }
+
+#define POINTTOPOINTS(pt) (MAKELONG((short)((pt).x), (short)((pt).y)))
+
+
+/* Cursors / Icons */
+
+typedef struct {
+ WIN_BOOL fIcon;
+ DWORD xHotspot;
+ DWORD yHotspot;
+ HBITMAP hbmMask;
+ HBITMAP hbmColor;
+} ICONINFO,*LPICONINFO;
+
+
+/* this is the 6 byte accel struct used in Win32 when presented to the user */
+typedef struct
+{
+ BYTE fVirt;
+ BYTE pad0;
+ WORD key;
+ WORD cmd;
+} ACCEL, *LPACCEL;
+
+/* this is the 8 byte accel struct used in Win32 resources (internal only) */
+typedef struct
+{
+ BYTE fVirt;
+ BYTE pad0;
+ WORD key;
+ WORD cmd;
+ WORD pad1;
+} PE_ACCEL, *LPPE_ACCEL;
+
+
+/* Flags for TrackPopupMenu */
+#define TPM_LEFTBUTTON 0x0000
+#define TPM_RIGHTBUTTON 0x0002
+#define TPM_LEFTALIGN 0x0000
+#define TPM_CENTERALIGN 0x0004
+#define TPM_RIGHTALIGN 0x0008
+#define TPM_TOPALIGN 0x0000
+#define TPM_VCENTERALIGN 0x0010
+#define TPM_BOTTOMALIGN 0x0020
+#define TPM_HORIZONTAL 0x0000
+#define TPM_VERTICAL 0x0040
+#define TPM_NONOTIFY 0x0080
+#define TPM_RETURNCMD 0x0100
+
+typedef struct
+{
+ UINT cbSize;
+ RECT rcExclude;
+} TPMPARAMS, *LPTPMPARAMS;
+
+/* FIXME: not sure this one is correct */
+typedef struct {
+ UINT cbSize;
+ UINT fMask;
+ UINT fType;
+ UINT fState;
+ UINT wID;
+ HMENU hSubMenu;
+ HBITMAP hbmpChecked;
+ HBITMAP hbmpUnchecked;
+ DWORD dwItemData;
+ LPSTR dwTypeData;
+ UINT cch;
+ HBITMAP hbmpItem;
+} MENUITEMINFOA, *LPMENUITEMINFOA;
+
+typedef struct {
+ UINT cbSize;
+ UINT fMask;
+ UINT fType;
+ UINT fState;
+ UINT wID;
+ HMENU hSubMenu;
+ HBITMAP hbmpChecked;
+ HBITMAP hbmpUnchecked;
+ DWORD dwItemData;
+ LPWSTR dwTypeData;
+ UINT cch;
+ HBITMAP hbmpItem;
+} MENUITEMINFOW, *LPMENUITEMINFOW;
+
+DECL_WINELIB_TYPE_AW(MENUITEMINFO)
+DECL_WINELIB_TYPE_AW(LPMENUITEMINFO)
+
+typedef struct {
+ DWORD cbSize;
+ DWORD fMask;
+ DWORD dwStyle;
+ UINT cyMax;
+ HBRUSH hbrBack;
+ DWORD dwContextHelpID;
+ DWORD dwMenuData;
+} MENUINFO, *LPMENUINFO;
+
+typedef MENUINFO const * LPCMENUINFO;
+
+#define MIM_MAXHEIGHT 0x00000001
+#define MIM_BACKGROUND 0x00000002
+#define MIM_HELPID 0x00000004
+#define MIM_MENUDATA 0x00000008
+#define MIM_STYLE 0x00000010
+#define MIM_APPLYTOSUBMENUS 0x80000000
+
+typedef struct {
+ WORD versionNumber;
+ WORD offset;
+} MENUITEMTEMPLATEHEADER, *PMENUITEMTEMPLATEHEADER;
+
+
+typedef struct {
+ WORD mtOption;
+ WORD mtID;
+ WCHAR mtString[1];
+} MENUITEMTEMPLATE, *PMENUITEMTEMPLATE;
+
+
+typedef VOID MENUTEMPLATE;
+typedef PVOID *LPMENUTEMPLATE;
+
+/* Field specifiers for MENUITEMINFO[AW] type. */
+#define MIIM_STATE 0x00000001
+#define MIIM_ID 0x00000002
+#define MIIM_SUBMENU 0x00000004
+#define MIIM_CHECKMARKS 0x00000008
+#define MIIM_TYPE 0x00000010
+#define MIIM_DATA 0x00000020
+#define MIIM_STRING 0x00000040
+#define MIIM_BITMAP 0x00000080
+#define MIIM_FTYPE 0x00000100
+
+#define HBMMENU_CALLBACK ((HBITMAP) -1)
+#define HBMMENU_SYSTEM ((HBITMAP) 1)
+#define HBMMENU_MBAR_RESTORE ((HBITMAP) 2)
+#define HBMMENU_MBAR_MINIMIZE ((HBITMAP) 3)
+#define HBMMENU_MBAR_CLOSE ((HBITMAP) 5)
+#define HBMMENU_MBAR_CLOSE_D ((HBITMAP) 6)
+#define HBMMENU_MBAR_MINIMIZE_D ((HBITMAP) 7)
+#define HBMMENU_POPUP_CLOSE ((HBITMAP) 8)
+#define HBMMENU_POPUP_RESTORE ((HBITMAP) 9)
+#define HBMMENU_POPUP_MAXIMIZE ((HBITMAP) 10)
+#define HBMMENU_POPUP_MINIMIZE ((HBITMAP) 11)
+
+/* DrawState defines ... */
+typedef WIN_BOOL CALLBACK (*DRAWSTATEPROC)(HDC,LPARAM,WPARAM,INT,INT);
+
+/* WM_H/VSCROLL commands */
+#define SB_LINEUP 0
+#define SB_LINELEFT 0
+#define SB_LINEDOWN 1
+#define SB_LINERIGHT 1
+#define SB_PAGEUP 2
+#define SB_PAGELEFT 2
+#define SB_PAGEDOWN 3
+#define SB_PAGERIGHT 3
+#define SB_THUMBPOSITION 4
+#define SB_THUMBTRACK 5
+#define SB_TOP 6
+#define SB_LEFT 6
+#define SB_BOTTOM 7
+#define SB_RIGHT 7
+#define SB_ENDSCROLL 8
+
+/* Scroll bar selection constants */
+#define SB_HORZ 0
+#define SB_VERT 1
+#define SB_CTL 2
+#define SB_BOTH 3
+
+/* Scrollbar styles */
+#define SBS_HORZ 0x0000L
+#define SBS_VERT 0x0001L
+#define SBS_TOPALIGN 0x0002L
+#define SBS_LEFTALIGN 0x0002L
+#define SBS_BOTTOMALIGN 0x0004L
+#define SBS_RIGHTALIGN 0x0004L
+#define SBS_SIZEBOXTOPLEFTALIGN 0x0002L
+#define SBS_SIZEBOXBOTTOMRIGHTALIGN 0x0004L
+#define SBS_SIZEBOX 0x0008L
+#define SBS_SIZEGRIP 0x0010L
+
+/* EnableScrollBar() flags */
+#define ESB_ENABLE_BOTH 0x0000
+#define ESB_DISABLE_BOTH 0x0003
+
+#define ESB_DISABLE_LEFT 0x0001
+#define ESB_DISABLE_RIGHT 0x0002
+
+#define ESB_DISABLE_UP 0x0001
+#define ESB_DISABLE_DOWN 0x0002
+
+#define ESB_DISABLE_LTUP ESB_DISABLE_LEFT
+#define ESB_DISABLE_RTDN ESB_DISABLE_RIGHT
+
+/* Win32 button control messages */
+#define BM_GETCHECK 0x00f0
+#define BM_SETCHECK 0x00f1
+#define BM_GETSTATE 0x00f2
+#define BM_SETSTATE 0x00f3
+#define BM_SETSTYLE 0x00f4
+#define BM_CLICK 0x00f5
+#define BM_GETIMAGE 0x00f6
+#define BM_SETIMAGE 0x00f7
+/* Winelib button control messages */
+
+/* Button notification codes */
+#define BN_CLICKED 0
+#define BN_PAINT 1
+#define BN_HILITE 2
+#define BN_UNHILITE 3
+#define BN_DISABLE 4
+#define BN_DOUBLECLICKED 5
+
+/* Button states */
+#define BST_UNCHECKED 0x0000
+#define BST_CHECKED 0x0001
+#define BST_INDETERMINATE 0x0002
+#define BST_PUSHED 0x0004
+#define BST_FOCUS 0x0008
+
+/* Static Control Styles */
+#define SS_LEFT 0x00000000L
+#define SS_CENTER 0x00000001L
+#define SS_RIGHT 0x00000002L
+#define SS_ICON 0x00000003L
+#define SS_BLACKRECT 0x00000004L
+#define SS_GRAYRECT 0x00000005L
+#define SS_WHITERECT 0x00000006L
+#define SS_BLACKFRAME 0x00000007L
+#define SS_GRAYFRAME 0x00000008L
+#define SS_WHITEFRAME 0x00000009L
+
+#define SS_SIMPLE 0x0000000BL
+#define SS_LEFTNOWORDWRAP 0x0000000CL
+
+#define SS_OWNERDRAW 0x0000000DL
+#define SS_BITMAP 0x0000000EL
+#define SS_ENHMETAFILE 0x0000000FL
+
+#define SS_ETCHEDHORZ 0x00000010L
+#define SS_ETCHEDVERT 0x00000011L
+#define SS_ETCHEDFRAME 0x00000012L
+#define SS_TYPEMASK 0x0000001FL
+
+#define SS_NOPREFIX 0x00000080L
+#define SS_NOTIFY 0x00000100L
+#define SS_CENTERIMAGE 0x00000200L
+#define SS_RIGHTJUST 0x00000400L
+#define SS_REALSIZEIMAGE 0x00000800L
+#define SS_SUNKEN 0x00001000L
+
+/* Static Control Messages */
+#define STM_SETICON 0x0170
+#define STM_GETICON 0x0171
+#define STM_SETIMAGE 0x0172
+#define STM_GETIMAGE 0x0173
+
+/* Scrollbar messages */
+#define SBM_SETPOS 0x00e0
+#define SBM_GETPOS 0x00e1
+#define SBM_SETRANGE 0x00e2
+#define SBM_GETRANGE 0x00e3
+#define SBM_ENABLE_ARROWS 0x00e4
+#define SBM_SETRANGEREDRAW 0x00e6
+#define SBM_SETSCROLLINFO 0x00e9
+#define SBM_GETSCROLLINFO 0x00ea
+
+/* Scrollbar info */
+typedef struct
+{
+ UINT cbSize;
+ UINT fMask;
+ INT nMin;
+ INT nMax;
+ UINT nPage;
+ INT nPos;
+ INT nTrackPos;
+} SCROLLINFO, *LPSCROLLINFO;
+
+/* GetScrollInfo() flags */
+#define SIF_RANGE 0x0001
+#define SIF_PAGE 0x0002
+#define SIF_POS 0x0004
+#define SIF_DISABLENOSCROLL 0x0008
+#define SIF_TRACKPOS 0x0010
+#define SIF_ALL (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS)
+
+/* Listbox styles */
+#define LBS_NOTIFY 0x0001
+#define LBS_SORT 0x0002
+#define LBS_NOREDRAW 0x0004
+#define LBS_MULTIPLESEL 0x0008
+#define LBS_OWNERDRAWFIXED 0x0010
+#define LBS_OWNERDRAWVARIABLE 0x0020
+#define LBS_HASSTRINGS 0x0040
+#define LBS_USETABSTOPS 0x0080
+#define LBS_NOINTEGRALHEIGHT 0x0100
+#define LBS_MULTICOLUMN 0x0200
+#define LBS_WANTKEYBOARDINPUT 0x0400
+#define LBS_EXTENDEDSEL 0x0800
+#define LBS_DISABLENOSCROLL 0x1000
+#define LBS_NODATA 0x2000
+#define LBS_NOSEL 0x4000
+#define LBS_STANDARD (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER)
+
+/* Listbox messages */
+#define LB_ADDSTRING 0x0180
+#define LB_INSERTSTRING 0x0181
+#define LB_DELETESTRING 0x0182
+#define LB_SELITEMRANGEEX 0x0183
+#define LB_RESETCONTENT 0x0184
+#define LB_SETSEL 0x0185
+#define LB_SETCURSEL 0x0186
+#define LB_GETSEL 0x0187
+#define LB_GETCURSEL 0x0188
+#define LB_GETTEXT 0x0189
+#define LB_GETTEXTLEN 0x018a
+#define LB_GETCOUNT 0x018b
+#define LB_SELECTSTRING 0x018c
+#define LB_DIR 0x018d
+#define LB_GETTOPINDEX 0x018e
+#define LB_FINDSTRING 0x018f
+#define LB_GETSELCOUNT 0x0190
+#define LB_GETSELITEMS 0x0191
+#define LB_SETTABSTOPS 0x0192
+#define LB_GETHORIZONTALEXTENT 0x0193
+#define LB_SETHORIZONTALEXTENT 0x0194
+#define LB_SETCOLUMNWIDTH 0x0195
+#define LB_ADDFILE 0x0196
+#define LB_SETTOPINDEX 0x0197
+#define LB_GETITEMRECT 0x0198
+#define LB_GETITEMDATA 0x0199
+#define LB_SETITEMDATA 0x019a
+#define LB_SELITEMRANGE 0x019b
+#define LB_SETANCHORINDEX 0x019c
+#define LB_GETANCHORINDEX 0x019d
+#define LB_SETCARETINDEX 0x019e
+#define LB_GETCARETINDEX 0x019f
+#define LB_SETITEMHEIGHT 0x01a0
+#define LB_GETITEMHEIGHT 0x01a1
+#define LB_FINDSTRINGEXACT 0x01a2
+#define LB_CARETON 0x01a3
+#define LB_CARETOFF 0x01a4
+#define LB_SETLOCALE 0x01a5
+#define LB_GETLOCALE 0x01a6
+#define LB_SETCOUNT 0x01a7
+#define LB_INITSTORAGE 0x01a8
+#define LB_ITEMFROMPOINT 0x01a9
+
+/* Listbox notification codes */
+#define LBN_ERRSPACE (-2)
+#define LBN_SELCHANGE 1
+#define LBN_DBLCLK 2
+#define LBN_SELCANCEL 3
+#define LBN_SETFOCUS 4
+#define LBN_KILLFOCUS 5
+
+/* Listbox message return values */
+#define LB_OKAY 0
+#define LB_ERR (-1)
+#define LB_ERRSPACE (-2)
+
+#define LB_CTLCODE 0L
+
+/* Combo box styles */
+#define CBS_SIMPLE 0x0001L
+#define CBS_DROPDOWN 0x0002L
+#define CBS_DROPDOWNLIST 0x0003L
+#define CBS_OWNERDRAWFIXED 0x0010L
+#define CBS_OWNERDRAWVARIABLE 0x0020L
+#define CBS_AUTOHSCROLL 0x0040L
+#define CBS_OEMCONVERT 0x0080L
+#define CBS_SORT 0x0100L
+#define CBS_HASSTRINGS 0x0200L
+#define CBS_NOINTEGRALHEIGHT 0x0400L
+#define CBS_DISABLENOSCROLL 0x0800L
+
+#define CBS_UPPERCASE 0x2000L
+#define CBS_LOWERCASE 0x4000L
+
+
+/* Combo box messages */
+#define CB_GETEDITSEL 0x0140
+#define CB_LIMITTEXT 0x0141
+#define CB_SETEDITSEL 0x0142
+#define CB_ADDSTRING 0x0143
+#define CB_DELETESTRING 0x0144
+#define CB_DIR 0x0145
+#define CB_GETCOUNT 0x0146
+#define CB_GETCURSEL 0x0147
+#define CB_GETLBTEXT 0x0148
+#define CB_GETLBTEXTLEN 0x0149
+#define CB_INSERTSTRING 0x014a
+#define CB_RESETCONTENT 0x014b
+#define CB_FINDSTRING 0x014c
+#define CB_SELECTSTRING 0x014d
+#define CB_SETCURSEL 0x014e
+#define CB_SHOWDROPDOWN 0x014f
+#define CB_GETITEMDATA 0x0150
+#define CB_SETITEMDATA 0x0151
+#define CB_GETDROPPEDCONTROLRECT 0x0152
+#define CB_SETITEMHEIGHT 0x0153
+#define CB_GETITEMHEIGHT 0x0154
+#define CB_SETEXTENDEDUI 0x0155
+#define CB_GETEXTENDEDUI 0x0156
+#define CB_GETDROPPEDSTATE 0x0157
+#define CB_FINDSTRINGEXACT 0x0158
+#define CB_SETLOCALE 0x0159
+#define CB_GETLOCALE 0x015a
+#define CB_GETTOPINDEX 0x015b
+#define CB_SETTOPINDEX 0x015c
+#define CB_GETHORIZONTALEXTENT 0x015d
+#define CB_SETHORIZONTALEXTENT 0x015e
+#define CB_GETDROPPEDWIDTH 0x015f
+#define CB_SETDROPPEDWIDTH 0x0160
+#define CB_INITSTORAGE 0x0161
+
+/* Combo box notification codes */
+#define CBN_ERRSPACE (-1)
+#define CBN_SELCHANGE 1
+#define CBN_DBLCLK 2
+#define CBN_SETFOCUS 3
+#define CBN_KILLFOCUS 4
+#define CBN_EDITCHANGE 5
+#define CBN_EDITUPDATE 6
+#define CBN_DROPDOWN 7
+#define CBN_CLOSEUP 8
+#define CBN_SELENDOK 9
+#define CBN_SELENDCANCEL 10
+
+/* Combo box message return values */
+#define CB_OKAY 0
+#define CB_ERR (-1)
+#define CB_ERRSPACE (-2)
+
+#define MB_OK 0x00000000
+#define MB_OKCANCEL 0x00000001
+#define MB_ABORTRETRYIGNORE 0x00000002
+#define MB_YESNOCANCEL 0x00000003
+#define MB_YESNO 0x00000004
+#define MB_RETRYCANCEL 0x00000005
+#define MB_TYPEMASK 0x0000000F
+
+#define MB_ICONHAND 0x00000010
+#define MB_ICONQUESTION 0x00000020
+#define MB_ICONEXCLAMATION 0x00000030
+#define MB_ICONASTERISK 0x00000040
+#define MB_USERICON 0x00000080
+#define MB_ICONMASK 0x000000F0
+
+#define MB_ICONINFORMATION MB_ICONASTERISK
+#define MB_ICONSTOP MB_ICONHAND
+#define MB_ICONWARNING MB_ICONEXCLAMATION
+#define MB_ICONERROR MB_ICONHAND
+
+#define MB_DEFBUTTON1 0x00000000
+#define MB_DEFBUTTON2 0x00000100
+#define MB_DEFBUTTON3 0x00000200
+#define MB_DEFBUTTON4 0x00000300
+#define MB_DEFMASK 0x00000F00
+
+#define MB_APPLMODAL 0x00000000
+#define MB_SYSTEMMODAL 0x00001000
+#define MB_TASKMODAL 0x00002000
+#define MB_MODEMASK 0x00003000
+
+#define MB_HELP 0x00004000
+#define MB_NOFOCUS 0x00008000
+#define MB_MISCMASK 0x0000C000
+
+#define MB_SETFOREGROUND 0x00010000
+#define MB_DEFAULT_DESKTOP_ONLY 0x00020000
+#define MB_SERVICE_NOTIFICATION 0x00040000
+#define MB_TOPMOST 0x00040000
+#define MB_RIGHT 0x00080000
+#define MB_RTLREADING 0x00100000
+
+#define HELPINFO_WINDOW 0x0001
+#define HELPINFO_MENUITEM 0x0002
+
+/* Structure pointed to by lParam of WM_HELP */
+typedef struct
+{
+ UINT cbSize; /* Size in bytes of this struct */
+ INT iContextType; /* Either HELPINFO_WINDOW or HELPINFO_MENUITEM */
+ INT iCtrlId; /* Control Id or a Menu item Id. */
+ HANDLE hItemHandle; /* hWnd of control or hMenu. */
+ DWORD dwContextId; /* Context Id associated with this item */
+ POINT MousePos; /* Mouse Position in screen co-ordinates */
+} HELPINFO,*LPHELPINFO;
+
+typedef void CALLBACK (*MSGBOXCALLBACK)(LPHELPINFO lpHelpInfo);
+
+typedef struct
+{
+ UINT cbSize;
+ HWND hwndOwner;
+ HINSTANCE hInstance;
+ LPCSTR lpszText;
+ LPCSTR lpszCaption;
+ DWORD dwStyle;
+ LPCSTR lpszIcon;
+ DWORD dwContextHelpId;
+ MSGBOXCALLBACK lpfnMsgBoxCallback;
+ DWORD dwLanguageId;
+} MSGBOXPARAMSA,*LPMSGBOXPARAMSA;
+
+typedef struct
+{
+ UINT cbSize;
+ HWND hwndOwner;
+ HINSTANCE hInstance;
+ LPCWSTR lpszText;
+ LPCWSTR lpszCaption;
+ DWORD dwStyle;
+ LPCWSTR lpszIcon;
+ DWORD dwContextHelpId;
+ MSGBOXCALLBACK lpfnMsgBoxCallback;
+ DWORD dwLanguageId;
+} MSGBOXPARAMSW,*LPMSGBOXPARAMSW;
+
+DECL_WINELIB_TYPE_AW(MSGBOXPARAMS)
+DECL_WINELIB_TYPE_AW(LPMSGBOXPARAMS)
+
+typedef struct _numberfmt32a {
+ UINT NumDigits;
+ UINT LeadingZero;
+ UINT Grouping;
+ LPCSTR lpDecimalSep;
+ LPCSTR lpThousandSep;
+ UINT NegativeOrder;
+} NUMBERFMTA;
+
+typedef struct _numberfmt32w {
+ UINT NumDigits;
+ UINT LeadingZero;
+ UINT Grouping;
+ LPCWSTR lpDecimalSep;
+ LPCWSTR lpThousandSep;
+ UINT NegativeOrder;
+} NUMBERFMTW;
+
+typedef struct _currencyfmt32a
+{
+ UINT NumDigits;
+ UINT LeadingZero;
+ UINT Grouping;
+ LPCSTR lpDecimalSep;
+ LPCSTR lpThousandSep;
+ UINT NegativeOrder;
+ UINT PositiveOrder;
+ LPCSTR lpCurrencySymbol;
+} CURRENCYFMTA;
+
+typedef struct _currencyfmt32w
+{
+ UINT NumDigits;
+ UINT LeadingZero;
+ UINT Grouping;
+ LPCWSTR lpDecimalSep;
+ LPCWSTR lpThousandSep;
+ UINT NegativeOrder;
+ UINT PositiveOrder;
+ LPCWSTR lpCurrencySymbol;
+} CURRENCYFMTW;
+
+#define MONITOR_DEFAULTTONULL 0x00000000
+#define MONITOR_DEFAULTTOPRIMARY 0x00000001
+#define MONITOR_DEFAULTTONEAREST 0x00000002
+
+#define MONITORINFOF_PRIMARY 0x00000001
+
+typedef struct tagMONITORINFO
+{
+ DWORD cbSize;
+ RECT rcMonitor;
+ RECT rcWork;
+ DWORD dwFlags;
+} MONITORINFO, *LPMONITORINFO;
+
+
+typedef WIN_BOOL CALLBACK (*MONITORENUMPROC)(HMONITOR,HDC,LPRECT,LPARAM);
+
+/* FIXME: use this instead of LPCVOID for CreateDialogIndirectParam
+ and DialogBoxIndirectParam */
+typedef struct tagDLGTEMPLATE
+{
+ DWORD style;
+ DWORD dwExtendedStyle;
+ WORD cdit;
+ short x;
+ short y;
+ short cx;
+ short cy;
+} DLGTEMPLATE;
+
+typedef DLGTEMPLATE *LPDLGTEMPLATEA;
+typedef DLGTEMPLATE *LPDLGTEMPLATEW;
+#define LPDLGTEMPLATE WINELIB_NAME_AW(LPDLGTEMPLATE)
+typedef const DLGTEMPLATE *LPCDLGTEMPLATEA;
+typedef const DLGTEMPLATE *LPCDLGTEMPLATEW;
+#define LPCDLGTEMPLATE WINELIB_NAME_AW(LPCDLGTEMPLATE)
+
+typedef struct tagDLGITEMTEMPLATE
+{
+ DWORD style;
+ DWORD dwExtendedStyle;
+ short x;
+ short y;
+ short cx;
+ short cy;
+ WORD id;
+} DLGITEMTEMPLATE;
+
+typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEA;
+typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEW;
+#define LPDLGITEMTEMPLATE WINELIB_NAME_AW(LPDLGITEMTEMPLATE)
+typedef const DLGITEMTEMPLATE *LPCDLGITEMTEMPLATEA;
+typedef const DLGITEMTEMPLATE *LPCDLGITEMTEMPLATEW;
+#define LPCDLGITEMTEMPLATE WINELIB_NAME_AW(LPCDLGITEMTEMPLATE)
+
+
+ /* CBT hook values */
+#define HCBT_MOVESIZE 0
+#define HCBT_MINMAX 1
+#define HCBT_QS 2
+#define HCBT_CREATEWND 3
+#define HCBT_DESTROYWND 4
+#define HCBT_ACTIVATE 5
+#define HCBT_CLICKSKIPPED 6
+#define HCBT_KEYSKIPPED 7
+#define HCBT_SYSCOMMAND 8
+#define HCBT_SETFOCUS 9
+
+ /* CBT hook structures */
+
+typedef struct
+{
+ CREATESTRUCTA *lpcs;
+ HWND hwndInsertAfter;
+} CBT_CREATEWNDA, *LPCBT_CREATEWNDA;
+
+typedef struct
+{
+ CREATESTRUCTW *lpcs;
+ HWND hwndInsertAfter;
+} CBT_CREATEWNDW, *LPCBT_CREATEWNDW;
+
+DECL_WINELIB_TYPE_AW(CBT_CREATEWND)
+DECL_WINELIB_TYPE_AW(LPCBT_CREATEWND)
+
+typedef struct
+{
+ WIN_BOOL fMouse;
+ HWND hWndActive;
+} CBTACTIVATESTRUCT, *LPCBTACTIVATESTRUCT;
+
+
+/* modifiers for RegisterHotKey */
+#define MOD_ALT 0x0001
+#define MOD_CONTROL 0x0002
+#define MOD_SHIFT 0x0004
+#define MOD_WIN 0x0008
+
+/* ids for RegisterHotKey */
+#define IDHOT_SNAPWINDOW (-1) /* SHIFT-PRINTSCRN */
+#define IDHOT_SNAPDESKTOP (-2) /* PRINTSCRN */
+
+ /* keybd_event flags */
+#define KEYEVENTF_EXTENDEDKEY 0x0001
+#define KEYEVENTF_KEYUP 0x0002
+#define KEYEVENTF_WINE_FORCEEXTENDED 0x8000
+
+ /* mouse_event flags */
+#define MOUSEEVENTF_MOVE 0x0001
+#define MOUSEEVENTF_LEFTDOWN 0x0002
+#define MOUSEEVENTF_LEFTUP 0x0004
+#define MOUSEEVENTF_RIGHTDOWN 0x0008
+#define MOUSEEVENTF_RIGHTUP 0x0010
+#define MOUSEEVENTF_MIDDLEDOWN 0x0020
+#define MOUSEEVENTF_MIDDLEUP 0x0040
+#define MOUSEEVENTF_WHEEL 0x0800
+#define MOUSEEVENTF_ABSOLUTE 0x8000
+
+/* ExitWindows() flags */
+#define EW_RESTARTWINDOWS 0x0042
+#define EW_REBOOTSYSTEM 0x0043
+#define EW_EXITANDEXECAPP 0x0044
+
+/* ExitWindowsEx() flags */
+#define EWX_LOGOFF 0
+#define EWX_SHUTDOWN 1
+#define EWX_REBOOT 2
+#define EWX_FORCE 4
+#define EWX_POWEROFF 8
+
+/* SetLastErrorEx types */
+#define SLE_ERROR 0x00000001
+#define SLE_MINORERROR 0x00000002
+#define SLE_WARNING 0x00000003
+
+/* Predefined resources */
+#define IDI_APPLICATIONA MAKEINTRESOURCEA(32512)
+#define IDI_APPLICATIONW MAKEINTRESOURCEW(32512)
+#define IDI_APPLICATION WINELIB_NAME_AW(IDI_APPLICATION)
+#define IDI_HANDA MAKEINTRESOURCEA(32513)
+#define IDI_HANDW MAKEINTRESOURCEW(32513)
+#define IDI_HAND WINELIB_NAME_AW(IDI_HAND)
+#define IDI_QUESTIONA MAKEINTRESOURCEA(32514)
+#define IDI_QUESTIONW MAKEINTRESOURCEW(32514)
+#define IDI_QUESTION WINELIB_NAME_AW(IDI_QUESTION)
+#define IDI_EXCLAMATIONA MAKEINTRESOURCEA(32515)
+#define IDI_EXCLAMATIONW MAKEINTRESOURCEW(32515)
+#define IDI_EXCLAMATION WINELIB_NAME_AW(IDI_EXCLAMATION)
+#define IDI_ASTERISKA MAKEINTRESOURCEA(32516)
+#define IDI_ASTERISKW MAKEINTRESOURCEW(32516)
+#define IDI_ASTERISK WINELIB_NAME_AW(IDI_ASTERISK)
+
+#define IDC_BUMMERA MAKEINTRESOURCEA(100)
+#define IDC_BUMMERW MAKEINTRESOURCEW(100)
+#define IDC_BUMMER WINELIB_NAME_AW(IDC_BUMMER)
+#define IDC_ARROWA MAKEINTRESOURCEA(32512)
+#define IDC_ARROWW MAKEINTRESOURCEW(32512)
+#define IDC_ARROW WINELIB_NAME_AW(IDC_ARROW)
+#define IDC_IBEAMA MAKEINTRESOURCEA(32513)
+#define IDC_IBEAMW MAKEINTRESOURCEW(32513)
+#define IDC_IBEAM WINELIB_NAME_AW(IDC_IBEAM)
+#define IDC_WAITA MAKEINTRESOURCEA(32514)
+#define IDC_WAITW MAKEINTRESOURCEW(32514)
+#define IDC_WAIT WINELIB_NAME_AW(IDC_WAIT)
+#define IDC_CROSSA MAKEINTRESOURCEA(32515)
+#define IDC_CROSSW MAKEINTRESOURCEW(32515)
+#define IDC_CROSS WINELIB_NAME_AW(IDC_CROSS)
+#define IDC_UPARROWA MAKEINTRESOURCEA(32516)
+#define IDC_UPARROWW MAKEINTRESOURCEW(32516)
+#define IDC_UPARROW WINELIB_NAME_AW(IDC_UPARROW)
+#define IDC_SIZEA MAKEINTRESOURCEA(32640)
+#define IDC_SIZEW MAKEINTRESOURCEW(32640)
+#define IDC_SIZE WINELIB_NAME_AW(IDC_SIZE)
+#define IDC_ICONA MAKEINTRESOURCEA(32641)
+#define IDC_ICONW MAKEINTRESOURCEW(32641)
+#define IDC_ICON WINELIB_NAME_AW(IDC_ICON)
+#define IDC_SIZENWSEA MAKEINTRESOURCEA(32642)
+#define IDC_SIZENWSEW MAKEINTRESOURCEW(32642)
+#define IDC_SIZENWSE WINELIB_NAME_AW(IDC_SIZENWSE)
+#define IDC_SIZENESWA MAKEINTRESOURCEA(32643)
+#define IDC_SIZENESWW MAKEINTRESOURCEW(32643)
+#define IDC_SIZENESW WINELIB_NAME_AW(IDC_SIZENESW)
+#define IDC_SIZEWEA MAKEINTRESOURCEA(32644)
+#define IDC_SIZEWEW MAKEINTRESOURCEW(32644)
+#define IDC_SIZEWE WINELIB_NAME_AW(IDC_SIZEWE)
+#define IDC_SIZENSA MAKEINTRESOURCEA(32645)
+#define IDC_SIZENSW MAKEINTRESOURCEW(32645)
+#define IDC_SIZENS WINELIB_NAME_AW(IDC_SIZENS)
+#define IDC_SIZEALLA MAKEINTRESOURCEA(32646)
+#define IDC_SIZEALLW MAKEINTRESOURCEW(32646)
+#define IDC_SIZEALL WINELIB_NAME_AW(IDC_SIZEALL)
+#define IDC_NOA MAKEINTRESOURCEA(32648)
+#define IDC_NOW MAKEINTRESOURCEW(32648)
+#define IDC_NO WINELIB_NAME_AW(IDC_NO)
+#define IDC_APPSTARTINGA MAKEINTRESOURCEA(32650)
+#define IDC_APPSTARTINGW MAKEINTRESOURCEW(32650)
+#define IDC_APPSTARTING WINELIB_NAME_AW(IDC_APPSTARTING)
+#define IDC_HELPA MAKEINTRESOURCEA(32651)
+#define IDC_HELPW MAKEINTRESOURCEW(32651)
+#define IDC_HELP WINELIB_NAME_AW(IDC_HELP)
+
+#define MNC_IGNORE 0
+#define MNC_CLOSE 1
+#define MNC_EXECUTE 2
+#define MNC_SELECT 3
+
+/* SystemParametersInfo */
+/* defines below are for all win versions */
+#define SPI_GETBEEP 1
+#define SPI_SETBEEP 2
+#define SPI_GETMOUSE 3
+#define SPI_SETMOUSE 4
+#define SPI_GETBORDER 5
+#define SPI_SETBORDER 6
+#define SPI_GETKEYBOARDSPEED 10
+#define SPI_SETKEYBOARDSPEED 11
+#define SPI_LANGDRIVER 12
+#define SPI_ICONHORIZONTALSPACING 13
+#define SPI_GETSCREENSAVETIMEOUT 14
+#define SPI_SETSCREENSAVETIMEOUT 15
+#define SPI_GETSCREENSAVEACTIVE 16
+#define SPI_SETSCREENSAVEACTIVE 17
+#define SPI_GETGRIDGRANULARITY 18
+#define SPI_SETGRIDGRANULARITY 19
+#define SPI_SETDESKWALLPAPER 20
+#define SPI_SETDESKPATTERN 21
+#define SPI_GETKEYBOARDDELAY 22
+#define SPI_SETKEYBOARDDELAY 23
+#define SPI_ICONVERTICALSPACING 24
+#define SPI_GETICONTITLEWRAP 25
+#define SPI_SETICONTITLEWRAP 26
+#define SPI_GETMENUDROPALIGNMENT 27
+#define SPI_SETMENUDROPALIGNMENT 28
+#define SPI_SETDOUBLECLKWIDTH 29
+#define SPI_SETDOUBLECLKHEIGHT 30
+#define SPI_GETICONTITLELOGFONT 31
+#define SPI_SETDOUBLECLICKTIME 32
+#define SPI_SETMOUSEBUTTONSWAP 33
+#define SPI_SETICONTITLELOGFONT 34
+#define SPI_GETFASTTASKSWITCH 35
+#define SPI_SETFASTTASKSWITCH 36
+#define SPI_SETDRAGFULLWINDOWS 37
+#define SPI_GETDRAGFULLWINDOWS 38
+
+#define SPI_GETFILTERKEYS 50
+#define SPI_SETFILTERKEYS 51
+#define SPI_GETTOGGLEKEYS 52
+#define SPI_SETTOGGLEKEYS 53
+#define SPI_GETMOUSEKEYS 54
+#define SPI_SETMOUSEKEYS 55
+#define SPI_GETSHOWSOUNDS 56
+#define SPI_SETSHOWSOUNDS 57
+#define SPI_GETSTICKYKEYS 58
+#define SPI_SETSTICKYKEYS 59
+#define SPI_GETACCESSTIMEOUT 60
+#define SPI_SETACCESSTIMEOUT 61
+
+#define SPI_GETSOUNDSENTRY 64
+#define SPI_SETSOUNDSENTRY 65
+
+/* defines below are for all win versions WINVER >= 0x0400 */
+#define SPI_SETDRAGFULLWINDOWS 37
+#define SPI_GETDRAGFULLWINDOWS 38
+#define SPI_GETNONCLIENTMETRICS 41
+#define SPI_SETNONCLIENTMETRICS 42
+#define SPI_GETMINIMIZEDMETRICS 43
+#define SPI_SETMINIMIZEDMETRICS 44
+#define SPI_GETICONMETRICS 45
+#define SPI_SETICONMETRICS 46
+#define SPI_SETWORKAREA 47
+#define SPI_GETWORKAREA 48
+#define SPI_SETPENWINDOWS 49
+
+#define SPI_GETSERIALKEYS 62
+#define SPI_SETSERIALKEYS 63
+#define SPI_GETHIGHCONTRAST 66
+#define SPI_SETHIGHCONTRAST 67
+#define SPI_GETKEYBOARDPREF 68
+#define SPI_SETKEYBOARDPREF 69
+#define SPI_GETSCREENREADER 70
+#define SPI_SETSCREENREADER 71
+#define SPI_GETANIMATION 72
+#define SPI_SETANIMATION 73
+#define SPI_GETFONTSMOOTHING 74
+#define SPI_SETFONTSMOOTHING 75
+#define SPI_SETDRAGWIDTH 76
+#define SPI_SETDRAGHEIGHT 77
+#define SPI_SETHANDHELD 78
+#define SPI_GETLOWPOWERTIMEOUT 79
+#define SPI_GETPOWEROFFTIMEOUT 80
+#define SPI_SETLOWPOWERTIMEOUT 81
+#define SPI_SETPOWEROFFTIMEOUT 82
+#define SPI_GETLOWPOWERACTIVE 83
+#define SPI_GETPOWEROFFACTIVE 84
+#define SPI_SETLOWPOWERACTIVE 85
+#define SPI_SETPOWEROFFACTIVE 86
+#define SPI_SETCURSORS 87
+#define SPI_SETICONS 88
+#define SPI_GETDEFAULTINPUTLANG 89
+#define SPI_SETDEFAULTINPUTLANG 90
+#define SPI_SETLANGTOGGLE 91
+#define SPI_GETWINDOWSEXTENSION 92
+#define SPI_SETMOUSETRAILS 93
+#define SPI_GETMOUSETRAILS 94
+#define SPI_SETSCREENSAVERRUNNING 97
+#define SPI_SCREENSAVERRUNNING SPI_SETSCREENSAVERRUNNING
+
+/* defines below are for all win versions (_WIN32_WINNT >= 0x0400) ||
+ * (_WIN32_WINDOWS > 0x0400) */
+#define SPI_GETMOUSEHOVERWIDTH 98
+#define SPI_SETMOUSEHOVERWIDTH 99
+#define SPI_GETMOUSEHOVERHEIGHT 100
+#define SPI_SETMOUSEHOVERHEIGHT 101
+#define SPI_GETMOUSEHOVERTIME 102
+#define SPI_SETMOUSEHOVERTIME 103
+#define SPI_GETWHEELSCROLLLINES 104
+#define SPI_SETWHEELSCROLLLINES 105
+
+#define SPI_GETSHOWIMEUI 110
+#define SPI_SETSHOWIMEUI 111
+
+/* defines below are for all win versions WINVER >= 0x0500 */
+#define SPI_GETMOUSESPEED 112
+#define SPI_SETMOUSESPEED 113
+#define SPI_GETSCREENSAVERRUNNING 114
+
+#define SPI_GETACTIVEWINDOWTRACKING 0x1000
+#define SPI_SETACTIVEWINDOWTRACKING 0x1001
+#define SPI_GETMENUANIMATION 0x1002
+#define SPI_SETMENUANIMATION 0x1003
+#define SPI_GETCOMBOBOXANIMATION 0x1004
+#define SPI_SETCOMBOBOXANIMATION 0x1005
+#define SPI_GETLISTBOXSMOOTHSCROLLING 0x1006
+#define SPI_SETLISTBOXSMOOTHSCROLLING 0x1007
+#define SPI_GETGRADIENTCAPTIONS 0x1008
+#define SPI_SETGRADIENTCAPTIONS 0x1009
+#define SPI_GETMENUUNDERLINES 0x100A
+#define SPI_SETMENUUNDERLINES 0x100B
+#define SPI_GETACTIVEWNDTRKZORDER 0x100C
+#define SPI_SETACTIVEWNDTRKZORDER 0x100D
+#define SPI_GETHOTTRACKING 0x100E
+#define SPI_SETHOTTRACKING 0x100F
+#define SPI_GETFOREGROUNDLOCKTIMEOUT 0x2000
+#define SPI_SETFOREGROUNDLOCKTIMEOUT 0x2001
+#define SPI_GETACTIVEWNDTRKTIMEOUT 0x2002
+#define SPI_SETACTIVEWNDTRKTIMEOUT 0x2003
+#define SPI_GETFOREGROUNDFLASHCOUNT 0x2004
+#define SPI_SETFOREGROUNDFLASHCOUNT 0x2005
+
+/* SystemParametersInfo flags */
+
+#define SPIF_UPDATEINIFILE 1
+#define SPIF_SENDWININICHANGE 2
+#define SPIF_SENDCHANGE SPIF_SENDWININICHANGE
+
+
+
+
+/* Window Styles */
+#define WS_OVERLAPPED 0x00000000L
+#define WS_POPUP 0x80000000L
+#define WS_CHILD 0x40000000L
+#define WS_MINIMIZE 0x20000000L
+#define WS_VISIBLE 0x10000000L
+#define WS_DISABLED 0x08000000L
+#define WS_CLIPSIBLINGS 0x04000000L
+#define WS_CLIPCHILDREN 0x02000000L
+#define WS_MAXIMIZE 0x01000000L
+#define WS_CAPTION 0x00C00000L
+#define WS_BORDER 0x00800000L
+#define WS_DLGFRAME 0x00400000L
+#define WS_VSCROLL 0x00200000L
+#define WS_HSCROLL 0x00100000L
+#define WS_SYSMENU 0x00080000L
+#define WS_THICKFRAME 0x00040000L
+#define WS_GROUP 0x00020000L
+#define WS_TABSTOP 0x00010000L
+#define WS_MINIMIZEBOX 0x00020000L
+#define WS_MAXIMIZEBOX 0x00010000L
+#define WS_TILED WS_OVERLAPPED
+#define WS_ICONIC WS_MINIMIZE
+#define WS_SIZEBOX WS_THICKFRAME
+#define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME| WS_MINIMIZEBOX | WS_MAXIMIZEBOX)
+#define WS_POPUPWINDOW (WS_POPUP | WS_BORDER | WS_SYSMENU)
+#define WS_CHILDWINDOW (WS_CHILD)
+#define WS_TILEDWINDOW (WS_OVERLAPPEDWINDOW)
+
+/* Window extended styles */
+#define WS_EX_DLGMODALFRAME 0x00000001L
+#define WS_EX_DRAGDETECT 0x00000002L
+#define WS_EX_NOPARENTNOTIFY 0x00000004L
+#define WS_EX_TOPMOST 0x00000008L
+#define WS_EX_ACCEPTFILES 0x00000010L
+#define WS_EX_TRANSPARENT 0x00000020L
+
+/* New Win95/WinNT4 styles */
+#define WS_EX_MDICHILD 0x00000040L
+#define WS_EX_TOOLWINDOW 0x00000080L
+#define WS_EX_WINDOWEDGE 0x00000100L
+#define WS_EX_CLIENTEDGE 0x00000200L
+#define WS_EX_CONTEXTHELP 0x00000400L
+#define WS_EX_RIGHT 0x00001000L
+#define WS_EX_LEFT 0x00000000L
+#define WS_EX_RTLREADING 0x00002000L
+#define WS_EX_LTRREADING 0x00000000L
+#define WS_EX_LEFTSCROLLBAR 0x00004000L
+#define WS_EX_RIGHTSCROLLBAR 0x00000000L
+#define WS_EX_CONTROLPARENT 0x00010000L
+#define WS_EX_STATICEDGE 0x00020000L
+#define WS_EX_APPWINDOW 0x00040000L
+
+#define WS_EX_OVERLAPPEDWINDOW (WS_EX_WINDOWEDGE|WS_EX_CLIENTEDGE)
+#define WS_EX_PALETTEWINDOW (WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW|WS_EX_TOPMOST)
+
+/* WINE internal... */
+#define WS_EX_TRAYWINDOW 0x80000000L
+
+/* Window scrolling */
+#define SW_SCROLLCHILDREN 0x0001
+#define SW_INVALIDATE 0x0002
+#define SW_ERASE 0x0004
+
+/* CreateWindow() coordinates */
+#define CW_USEDEFAULT ((INT)0x80000000)
+
+/* ChildWindowFromPointEx Flags */
+#define CWP_ALL 0x0000
+#define CWP_SKIPINVISIBLE 0x0001
+#define CWP_SKIPDISABLED 0x0002
+#define CWP_SKIPTRANSPARENT 0x0004
+
+ /* PeekMessage() options */
+#define PM_NOREMOVE 0x0000
+#define PM_REMOVE 0x0001
+#define PM_NOYIELD 0x0002
+
+/* WM_SHOWWINDOW wParam codes */
+#define SW_PARENTCLOSING 1
+#define SW_OTHERMAXIMIZED 2
+#define SW_PARENTOPENING 3
+#define SW_OTHERRESTORED 4
+
+ /* ShowWindow() codes */
+#define SW_HIDE 0
+#define SW_SHOWNORMAL 1
+#define SW_NORMAL 1
+#define SW_SHOWMINIMIZED 2
+#define SW_SHOWMAXIMIZED 3
+#define SW_MAXIMIZE 3
+#define SW_SHOWNOACTIVATE 4
+#define SW_SHOW 5
+#define SW_MINIMIZE 6
+#define SW_SHOWMINNOACTIVE 7
+#define SW_SHOWNA 8
+#define SW_RESTORE 9
+#define SW_SHOWDEFAULT 10
+#define SW_MAX 10
+#define SW_NORMALNA 0xCC /* undoc. flag in MinMaximize */
+
+ /* WM_SIZE message wParam values */
+#define SIZE_RESTORED 0
+#define SIZE_MINIMIZED 1
+#define SIZE_MAXIMIZED 2
+#define SIZE_MAXSHOW 3
+#define SIZE_MAXHIDE 4
+#define SIZENORMAL SIZE_RESTORED
+#define SIZEICONIC SIZE_MINIMIZED
+#define SIZEFULLSCREEN SIZE_MAXIMIZED
+#define SIZEZOOMSHOW SIZE_MAXSHOW
+#define SIZEZOOMHIDE SIZE_MAXHIDE
+
+/* SetWindowPos() and WINDOWPOS flags */
+#define SWP_NOSIZE 0x0001
+#define SWP_NOMOVE 0x0002
+#define SWP_NOZORDER 0x0004
+#define SWP_NOREDRAW 0x0008
+#define SWP_NOACTIVATE 0x0010
+#define SWP_FRAMECHANGED 0x0020 /* The frame changed: send WM_NCCALCSIZE */
+#define SWP_SHOWWINDOW 0x0040
+#define SWP_HIDEWINDOW 0x0080
+#define SWP_NOCOPYBITS 0x0100
+#define SWP_NOOWNERZORDER 0x0200 /* Don't do owner Z ordering */
+
+#define SWP_DRAWFRAME SWP_FRAMECHANGED
+#define SWP_NOREPOSITION SWP_NOOWNERZORDER
+
+#define SWP_NOSENDCHANGING 0x0400
+#define SWP_DEFERERASE 0x2000
+#define SWP_ASYNCWINDOWPOS 0x4000
+
+#define HWND_DESKTOP ((HWND)0)
+#define HWND_BROADCAST ((HWND)0xffff)
+
+/* SetWindowPos() hwndInsertAfter field values */
+#define HWND_TOP ((HWND)0)
+#define HWND_BOTTOM ((HWND)1)
+#define HWND_TOPMOST ((HWND)-1)
+#define HWND_NOTOPMOST ((HWND)-2)
+
+#define MF_INSERT 0x0000
+#define MF_CHANGE 0x0080
+#define MF_APPEND 0x0100
+#define MF_DELETE 0x0200
+#define MF_REMOVE 0x1000
+#define MF_END 0x0080
+
+#define MF_ENABLED 0x0000
+#define MF_GRAYED 0x0001
+#define MF_DISABLED 0x0002
+#define MF_STRING 0x0000
+#define MF_BITMAP 0x0004
+#define MF_UNCHECKED 0x0000
+#define MF_CHECKED 0x0008
+#define MF_POPUP 0x0010
+#define MF_MENUBARBREAK 0x0020
+#define MF_MENUBREAK 0x0040
+#define MF_UNHILITE 0x0000
+#define MF_HILITE 0x0080
+#define MF_OWNERDRAW 0x0100
+#define MF_USECHECKBITMAPS 0x0200
+#define MF_BYCOMMAND 0x0000
+#define MF_BYPOSITION 0x0400
+#define MF_SEPARATOR 0x0800
+#define MF_DEFAULT 0x1000
+#define MF_SYSMENU 0x2000
+#define MF_HELP 0x4000
+#define MF_RIGHTJUSTIFY 0x4000
+#define MF_MOUSESELECT 0x8000
+
+/* Flags for extended menu item types. */
+#define MFT_STRING MF_STRING
+#define MFT_BITMAP MF_BITMAP
+#define MFT_MENUBARBREAK MF_MENUBARBREAK
+#define MFT_MENUBREAK MF_MENUBREAK
+#define MFT_OWNERDRAW MF_OWNERDRAW
+#define MFT_RADIOCHECK 0x00000200L
+#define MFT_SEPARATOR MF_SEPARATOR
+#define MFT_RIGHTORDER 0x00002000L
+#define MFT_RIGHTJUSTIFY MF_RIGHTJUSTIFY
+
+/* Flags for extended menu item states. */
+#define MFS_GRAYED 0x00000003L
+#define MFS_DISABLED MFS_GRAYED
+#define MFS_CHECKED MF_CHECKED
+#define MFS_HILITE MF_HILITE
+#define MFS_ENABLED MF_ENABLED
+#define MFS_UNCHECKED MF_UNCHECKED
+#define MFS_UNHILITE MF_UNHILITE
+#define MFS_DEFAULT MF_DEFAULT
+#define MFS_MASK 0x0000108BL
+#define MFS_HOTTRACKDRAWN 0x10000000L
+#define MFS_CACHEDBMP 0x20000000L
+#define MFS_BOTTOMGAPDROP 0x40000000L
+#define MFS_TOPGAPDROP 0x80000000L
+#define MFS_GAPDROP 0xC0000000L
+
+/* for GetMenuDefaultItem */
+#define GMDI_USEDISABLED 0x0001L
+#define GMDI_GOINTOPOPUPS 0x0002L
+
+#define DT_TOP 0
+#define DT_LEFT 0
+#define DT_CENTER 1
+#define DT_RIGHT 2
+#define DT_VCENTER 4
+#define DT_BOTTOM 8
+#define DT_WORDBREAK 16
+#define DT_SINGLELINE 32
+#define DT_EXPANDTABS 64
+#define DT_TABSTOP 128
+#define DT_NOCLIP 256
+#define DT_EXTERNALLEADING 512
+#define DT_CALCRECT 1024
+#define DT_NOPREFIX 2048
+#define DT_INTERNAL 4096
+
+/* DrawCaption()/DrawCaptionTemp() flags */
+#define DC_ACTIVE 0x0001
+#define DC_SMALLCAP 0x0002
+#define DC_ICON 0x0004
+#define DC_TEXT 0x0008
+#define DC_INBUTTON 0x0010
+
+/* DrawEdge() flags */
+#define BDR_RAISEDOUTER 0x0001
+#define BDR_SUNKENOUTER 0x0002
+#define BDR_RAISEDINNER 0x0004
+#define BDR_SUNKENINNER 0x0008
+
+#define BDR_OUTER 0x0003
+#define BDR_INNER 0x000c
+#define BDR_RAISED 0x0005
+#define BDR_SUNKEN 0x000a
+
+#define EDGE_RAISED (BDR_RAISEDOUTER | BDR_RAISEDINNER)
+#define EDGE_SUNKEN (BDR_SUNKENOUTER | BDR_SUNKENINNER)
+#define EDGE_ETCHED (BDR_SUNKENOUTER | BDR_RAISEDINNER)
+#define EDGE_BUMP (BDR_RAISEDOUTER | BDR_SUNKENINNER)
+
+/* border flags */
+#define BF_LEFT 0x0001
+#define BF_TOP 0x0002
+#define BF_RIGHT 0x0004
+#define BF_BOTTOM 0x0008
+#define BF_DIAGONAL 0x0010
+#define BF_MIDDLE 0x0800 /* Fill in the middle */
+#define BF_SOFT 0x1000 /* For softer buttons */
+#define BF_ADJUST 0x2000 /* Calculate the space left over */
+#define BF_FLAT 0x4000 /* For flat rather than 3D borders */
+#define BF_MONO 0x8000 /* For monochrome borders */
+#define BF_TOPLEFT (BF_TOP | BF_LEFT)
+#define BF_TOPRIGHT (BF_TOP | BF_RIGHT)
+#define BF_BOTTOMLEFT (BF_BOTTOM | BF_LEFT)
+#define BF_BOTTOMRIGHT (BF_BOTTOM | BF_RIGHT)
+#define BF_RECT (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM)
+#define BF_DIAGONAL_ENDTOPRIGHT (BF_DIAGONAL | BF_TOP | BF_RIGHT)
+#define BF_DIAGONAL_ENDTOPLEFT (BF_DIAGONAL | BF_TOP | BF_LEFT)
+#define BF_DIAGONAL_ENDBOTTOMLEFT (BF_DIAGONAL | BF_BOTTOM | BF_LEFT)
+#define BF_DIAGONAL_ENDBOTTOMRIGHT (BF_DIAGONAL | BF_BOTTOM | BF_RIGHT)
+
+/* DrawFrameControl() uType's */
+
+#define DFC_CAPTION 1
+#define DFC_MENU 2
+#define DFC_SCROLL 3
+#define DFC_BUTTON 4
+
+/* uState's */
+
+#define DFCS_CAPTIONCLOSE 0x0000
+#define DFCS_CAPTIONMIN 0x0001
+#define DFCS_CAPTIONMAX 0x0002
+#define DFCS_CAPTIONRESTORE 0x0003
+#define DFCS_CAPTIONHELP 0x0004 /* Windows 95 only */
+
+#define DFCS_MENUARROW 0x0000
+#define DFCS_MENUCHECK 0x0001
+#define DFCS_MENUBULLET 0x0002
+#define DFCS_MENUARROWRIGHT 0x0004
+
+#define DFCS_SCROLLUP 0x0000
+#define DFCS_SCROLLDOWN 0x0001
+#define DFCS_SCROLLLEFT 0x0002
+#define DFCS_SCROLLRIGHT 0x0003
+#define DFCS_SCROLLCOMBOBOX 0x0005
+#define DFCS_SCROLLSIZEGRIP 0x0008
+#define DFCS_SCROLLSIZEGRIPRIGHT 0x0010
+
+#define DFCS_BUTTONCHECK 0x0000
+#define DFCS_BUTTONRADIOIMAGE 0x0001
+#define DFCS_BUTTONRADIOMASK 0x0002 /* to draw nonsquare button */
+#define DFCS_BUTTONRADIO 0x0004
+#define DFCS_BUTTON3STATE 0x0008
+#define DFCS_BUTTONPUSH 0x0010
+
+/* additional state of the control */
+
+#define DFCS_INACTIVE 0x0100
+#define DFCS_PUSHED 0x0200
+#define DFCS_CHECKED 0x0400
+#define DFCS_ADJUSTRECT 0x2000 /* exclude surrounding edge */
+#define DFCS_FLAT 0x4000
+#define DFCS_MONO 0x8000
+
+/* Image type */
+#define DST_COMPLEX 0x0000
+#define DST_TEXT 0x0001
+#define DST_PREFIXTEXT 0x0002
+#define DST_ICON 0x0003
+#define DST_BITMAP 0x0004
+
+/* State type */
+#define DSS_NORMAL 0x0000
+#define DSS_UNION 0x0010 /* Gray string appearance */
+#define DSS_DISABLED 0x0020
+#define DSS_DEFAULT 0x0040 /* Make it bold */
+#define DSS_MONO 0x0080
+#define DSS_RIGHT 0x8000
+
+typedef struct
+{
+ UINT CtlType;
+ UINT CtlID;
+ UINT itemID;
+ UINT itemAction;
+ UINT itemState;
+ HWND hwndItem;
+ HDC hDC;
+ RECT rcItem WINE_PACKED;
+ DWORD itemData WINE_PACKED;
+} DRAWITEMSTRUCT, *PDRAWITEMSTRUCT, *LPDRAWITEMSTRUCT;
+
+
+typedef struct
+{
+ UINT CtlType;
+ UINT CtlID;
+ UINT itemID;
+ UINT itemWidth;
+ UINT itemHeight;
+ DWORD itemData;
+} MEASUREITEMSTRUCT, *PMEASUREITEMSTRUCT, *LPMEASUREITEMSTRUCT;
+
+
+typedef struct
+{
+ UINT CtlType;
+ UINT CtlID;
+ UINT itemID;
+ HWND hwndItem;
+ DWORD itemData;
+} DELETEITEMSTRUCT, *LPDELETEITEMSTRUCT;
+
+
+typedef struct
+{
+ UINT CtlType;
+ UINT CtlID;
+ HWND hwndItem;
+ UINT itemID1;
+ DWORD itemData1;
+ UINT itemID2;
+ DWORD itemData2;
+ DWORD dwLocaleId;
+} COMPAREITEMSTRUCT, *PCOMPAREITEMSTRUCT, *LPCOMPAREITEMSTRUCT;
+
+
+/* WM_KEYUP/DOWN/CHAR HIWORD(lParam) flags */
+#define KF_EXTENDED 0x0100
+#define KF_DLGMODE 0x0800
+#define KF_MENUMODE 0x1000
+#define KF_ALTDOWN 0x2000
+#define KF_REPEAT 0x4000
+#define KF_UP 0x8000
+
+/* Virtual key codes */
+#define VK_LBUTTON 0x01
+#define VK_RBUTTON 0x02
+#define VK_CANCEL 0x03
+#define VK_MBUTTON 0x04
+/* 0x05-0x07 Undefined */
+#define VK_BACK 0x08
+#define VK_TAB 0x09
+/* 0x0A-0x0B Undefined */
+#define VK_CLEAR 0x0C
+#define VK_RETURN 0x0D
+/* 0x0E-0x0F Undefined */
+#define VK_SHIFT 0x10
+#define VK_CONTROL 0x11
+#define VK_MENU 0x12
+#define VK_PAUSE 0x13
+#define VK_CAPITAL 0x14
+/* 0x15-0x19 Reserved for Kanji systems */
+/* 0x1A Undefined */
+#define VK_ESCAPE 0x1B
+/* 0x1C-0x1F Reserved for Kanji systems */
+#define VK_SPACE 0x20
+#define VK_PRIOR 0x21
+#define VK_NEXT 0x22
+#define VK_END 0x23
+#define VK_HOME 0x24
+#define VK_LEFT 0x25
+#define VK_UP 0x26
+#define VK_RIGHT 0x27
+#define VK_DOWN 0x28
+#define VK_SELECT 0x29
+#define VK_PRINT 0x2A /* OEM specific in Windows 3.1 SDK */
+#define VK_EXECUTE 0x2B
+#define VK_SNAPSHOT 0x2C
+#define VK_INSERT 0x2D
+#define VK_DELETE 0x2E
+#define VK_HELP 0x2F
+#define VK_0 0x30
+#define VK_1 0x31
+#define VK_2 0x32
+#define VK_3 0x33
+#define VK_4 0x34
+#define VK_5 0x35
+#define VK_6 0x36
+#define VK_7 0x37
+#define VK_8 0x38
+#define VK_9 0x39
+/* 0x3A-0x40 Undefined */
+#define VK_A 0x41
+#define VK_B 0x42
+#define VK_C 0x43
+#define VK_D 0x44
+#define VK_E 0x45
+#define VK_F 0x46
+#define VK_G 0x47
+#define VK_H 0x48
+#define VK_I 0x49
+#define VK_J 0x4A
+#define VK_K 0x4B
+#define VK_L 0x4C
+#define VK_M 0x4D
+#define VK_N 0x4E
+#define VK_O 0x4F
+#define VK_P 0x50
+#define VK_Q 0x51
+#define VK_R 0x52
+#define VK_S 0x53
+#define VK_T 0x54
+#define VK_U 0x55
+#define VK_V 0x56
+#define VK_W 0x57
+#define VK_X 0x58
+#define VK_Y 0x59
+#define VK_Z 0x5A
+
+#define VK_LWIN 0x5B
+#define VK_RWIN 0x5C
+#define VK_APPS 0x5D
+/* 0x5E-0x5F Unassigned */
+#define VK_NUMPAD0 0x60
+#define VK_NUMPAD1 0x61
+#define VK_NUMPAD2 0x62
+#define VK_NUMPAD3 0x63
+#define VK_NUMPAD4 0x64
+#define VK_NUMPAD5 0x65
+#define VK_NUMPAD6 0x66
+#define VK_NUMPAD7 0x67
+#define VK_NUMPAD8 0x68
+#define VK_NUMPAD9 0x69
+#define VK_MULTIPLY 0x6A
+#define VK_ADD 0x6B
+#define VK_SEPARATOR 0x6C
+#define VK_SUBTRACT 0x6D
+#define VK_DECIMAL 0x6E
+#define VK_DIVIDE 0x6F
+#define VK_F1 0x70
+#define VK_F2 0x71
+#define VK_F3 0x72
+#define VK_F4 0x73
+#define VK_F5 0x74
+#define VK_F6 0x75
+#define VK_F7 0x76
+#define VK_F8 0x77
+#define VK_F9 0x78
+#define VK_F10 0x79
+#define VK_F11 0x7A
+#define VK_F12 0x7B
+#define VK_F13 0x7C
+#define VK_F14 0x7D
+#define VK_F15 0x7E
+#define VK_F16 0x7F
+#define VK_F17 0x80
+#define VK_F18 0x81
+#define VK_F19 0x82
+#define VK_F20 0x83
+#define VK_F21 0x84
+#define VK_F22 0x85
+#define VK_F23 0x86
+#define VK_F24 0x87
+/* 0x88-0x8F Unassigned */
+#define VK_NUMLOCK 0x90
+#define VK_SCROLL 0x91
+/* 0x92-0x9F Unassigned */
+/*
+ * differencing between right and left shift/control/alt key.
+ * Used only by GetAsyncKeyState() and GetKeyState().
+ */
+#define VK_LSHIFT 0xA0
+#define VK_RSHIFT 0xA1
+#define VK_LCONTROL 0xA2
+#define VK_RCONTROL 0xA3
+#define VK_LMENU 0xA4
+#define VK_RMENU 0xA5
+/* 0xA6-0xB9 Unassigned */
+#define VK_OEM_1 0xBA
+#define VK_OEM_PLUS 0xBB
+#define VK_OEM_COMMA 0xBC
+#define VK_OEM_MINUS 0xBD
+#define VK_OEM_PERIOD 0xBE
+#define VK_OEM_2 0xBF
+#define VK_OEM_3 0xC0
+/* 0xC1-0xDA Unassigned */
+#define VK_OEM_4 0xDB
+#define VK_OEM_5 0xDC
+#define VK_OEM_6 0xDD
+#define VK_OEM_7 0xDE
+/* 0xDF-0xE4 OEM specific */
+
+#define VK_PROCESSKEY 0xE5
+
+/* 0xE6 OEM specific */
+/* 0xE7-0xE8 Unassigned */
+/* 0xE9-0xF5 OEM specific */
+
+#define VK_ATTN 0xF6
+#define VK_CRSEL 0xF7
+#define VK_EXSEL 0xF8
+#define VK_EREOF 0xF9
+#define VK_PLAY 0xFA
+#define VK_ZOOM 0xFB
+#define VK_NONAME 0xFC
+#define VK_PA1 0xFD
+#define VK_OEM_CLEAR 0xFE
+
+ /* Key status flags for mouse events */
+#define MK_LBUTTON 0x0001
+#define MK_RBUTTON 0x0002
+#define MK_SHIFT 0x0004
+#define MK_CONTROL 0x0008
+#define MK_MBUTTON 0x0010
+
+ /* Queue status flags */
+#define QS_KEY 0x0001
+#define QS_MOUSEMOVE 0x0002
+#define QS_MOUSEBUTTON 0x0004
+#define QS_MOUSE (QS_MOUSEMOVE | QS_MOUSEBUTTON)
+#define QS_POSTMESSAGE 0x0008
+#define QS_TIMER 0x0010
+#define QS_PAINT 0x0020
+#define QS_SENDMESSAGE 0x0040
+#define QS_HOTKEY 0x0080
+#define QS_INPUT (QS_MOUSE | QS_KEY)
+#define QS_ALLEVENTS (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY)
+#define QS_ALLINPUT (QS_ALLEVENTS | QS_SENDMESSAGE)
+
+#define DDL_READWRITE 0x0000
+#define DDL_READONLY 0x0001
+#define DDL_HIDDEN 0x0002
+#define DDL_SYSTEM 0x0004
+#define DDL_DIRECTORY 0x0010
+#define DDL_ARCHIVE 0x0020
+
+#define DDL_POSTMSGS 0x2000
+#define DDL_DRIVES 0x4000
+#define DDL_EXCLUSIVE 0x8000
+
+ /* Shell hook values */
+#define HSHELL_WINDOWCREATED 1
+#define HSHELL_WINDOWDESTROYED 2
+#define HSHELL_ACTIVATESHELLWINDOW 3
+
+/* Predefined Clipboard Formats */
+#define CF_TEXT 1
+#define CF_BITMAP 2
+#define CF_METAFILEPICT 3
+#define CF_SYLK 4
+#define CF_DIF 5
+#define CF_TIFF 6
+#define CF_OEMTEXT 7
+#define CF_DIB 8
+#define CF_PALETTE 9
+#define CF_PENDATA 10
+#define CF_RIFF 11
+#define CF_WAVE 12
+#define CF_ENHMETAFILE 14
+#define CF_HDROP 15
+#define CF_LOCALE 16
+#define CF_MAX 17
+
+#define CF_OWNERDISPLAY 0x0080
+#define CF_DSPTEXT 0x0081
+#define CF_DSPBITMAP 0x0082
+#define CF_DSPMETAFILEPICT 0x0083
+
+/* "Private" formats don't get GlobalFree()'d */
+#define CF_PRIVATEFIRST 0x0200
+#define CF_PRIVATELAST 0x02FF
+
+/* "GDIOBJ" formats do get DeleteObject()'d */
+#define CF_GDIOBJFIRST 0x0300
+#define CF_GDIOBJLAST 0x03FF
+
+
+/* DragObject stuff */
+
+typedef struct
+{
+ HWND16 hWnd;
+ HANDLE16 hScope;
+ WORD wFlags;
+ HANDLE16 hList;
+ HANDLE16 hOfStruct;
+ POINT16 pt WINE_PACKED;
+ LONG l WINE_PACKED;
+} DRAGINFO, *LPDRAGINFO;
+
+#define DRAGOBJ_PROGRAM 0x0001
+#define DRAGOBJ_DATA 0x0002
+#define DRAGOBJ_DIRECTORY 0x0004
+#define DRAGOBJ_MULTIPLE 0x0008
+#define DRAGOBJ_EXTERNAL 0x8000
+
+#define DRAG_PRINT 0x544E5250
+#define DRAG_FILE 0x454C4946
+
+/* types of LoadImage */
+#define IMAGE_BITMAP 0
+#define IMAGE_ICON 1
+#define IMAGE_CURSOR 2
+#define IMAGE_ENHMETAFILE 3
+
+/* loadflags to LoadImage */
+#define LR_DEFAULTCOLOR 0x0000
+#define LR_MONOCHROME 0x0001
+#define LR_COLOR 0x0002
+#define LR_COPYRETURNORG 0x0004
+#define LR_COPYDELETEORG 0x0008
+#define LR_LOADFROMFILE 0x0010
+#define LR_LOADTRANSPARENT 0x0020
+#define LR_DEFAULTSIZE 0x0040
+#define LR_VGA_COLOR 0x0080
+#define LR_LOADMAP3DCOLORS 0x1000
+#define LR_CREATEDIBSECTION 0x2000
+#define LR_COPYFROMRESOURCE 0x4000
+#define LR_SHARED 0x8000
+
+/* Flags for DrawIconEx. */
+#define DI_MASK 1
+#define DI_IMAGE 2
+#define DI_NORMAL (DI_MASK | DI_IMAGE)
+#define DI_COMPAT 4
+#define DI_DEFAULTSIZE 8
+
+ /* misc messages */
+#define WM_CPL_LAUNCH (WM_USER + 1000)
+#define WM_CPL_LAUNCHED (WM_USER + 1001)
+
+/* WM_NOTIFYFORMAT commands and return values */
+#define NFR_ANSI 1
+#define NFR_UNICODE 2
+#define NF_QUERY 3
+#define NF_REQUERY 4
+
+#include "poppack.h"
+#define EnumTaskWindows(handle,proc,lparam) \
+ EnumThreadWindows(handle,proc,lparam)
+#define OemToAnsiA OemToCharA
+#define OemToAnsiW OemToCharW
+#define OemToAnsi WINELIB_NAME_AW(OemToAnsi)
+#define OemToAnsiBuffA OemToCharBuffA
+#define OemToAnsiBuffW OemToCharBuffW
+#define OemToAnsiBuff WINELIB_NAME_AW(OemToAnsiBuff)
+#define AnsiToOemA CharToOemA
+#define AnsiToOemW CharToOemW
+#define AnsiToOem WINELIB_NAME_AW(AnsiToOem)
+#define AnsiToOemBuffA CharToOemBuffA
+#define AnsiToOemBuffW CharToOemBuffW
+#define AnsiToOemBuff WINELIB_NAME_AW(AnsiToOemBuff)
+/* NOTE: This is SYSTEM.3, not USER.182, which is also named KillSystemTimer */
+WORD WINAPI SYSTEM_KillSystemTimer( WORD );
+
+/* Extra functions that don't exist in the Windows API */
+
+HPEN WINAPI GetSysColorPen(INT);
+INT WINAPI LoadMessageA(HMODULE,UINT,WORD,LPSTR,INT);
+INT WINAPI LoadMessageW(HMODULE,UINT,WORD,LPWSTR,INT);
+
+VOID WINAPI ScreenSwitchEnable16(WORD);
+
+#define WC_DIALOG (LPSTR)((DWORD)((WORD)( 0x8002)))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINUSER_ */
diff --git a/loader/wineacm.h b/loader/wineacm.h
new file mode 100644
index 0000000000..f215d754d7
--- /dev/null
+++ b/loader/wineacm.h
@@ -0,0 +1,55 @@
+/* -*- tab-width: 8; c-basic-offset: 4 -*- */
+
+/***********************************************************************
+ * Wine specific - Win32
+ */
+typedef struct _WINE_ACMDRIVERID *PWINE_ACMDRIVERID;
+typedef struct _WINE_ACMDRIVER *PWINE_ACMDRIVER;
+
+typedef struct _WINE_ACMOBJ
+{
+ PWINE_ACMDRIVERID pACMDriverID;
+} WINE_ACMOBJ, *PWINE_ACMOBJ;
+
+typedef struct _WINE_ACMDRIVER
+{
+ WINE_ACMOBJ obj;
+ HDRVR hDrvr;
+ DRIVERPROC pfnDriverProc;
+ PWINE_ACMDRIVER pNextACMDriver;
+} WINE_ACMDRIVER;
+
+typedef struct _WINE_ACMSTREAM
+{
+ WINE_ACMOBJ obj;
+ PWINE_ACMDRIVER pDrv;
+ ACMDRVSTREAMINSTANCE drvInst;
+ HACMDRIVER hAcmDriver;
+} WINE_ACMSTREAM, *PWINE_ACMSTREAM;
+
+typedef struct _WINE_ACMDRIVERID
+{
+ LPSTR pszDriverAlias;
+ LPSTR pszFileName;
+ HINSTANCE hInstModule; /* NULL if global */
+ DWORD dwProcessID; /* ID of process which installed a local driver */
+ WIN_BOOL bEnabled;
+ PWINE_ACMDRIVER pACMDriverList;
+ PWINE_ACMDRIVERID pNextACMDriverID;
+ PWINE_ACMDRIVERID pPrevACMDriverID;
+} WINE_ACMDRIVERID;
+
+/* From internal.c */
+extern HANDLE MSACM_hHeap;
+extern PWINE_ACMDRIVERID MSACM_pFirstACMDriverID;
+extern PWINE_ACMDRIVERID MSACM_pLastACMDriverID;
+PWINE_ACMDRIVERID MSACM_RegisterDriver(
+ LPSTR pszDriverAlias, LPSTR pszFileName,
+ HINSTANCE hinstModule);
+void MSACM_RegisterAllDrivers(void);
+PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p);
+void MSACM_UnregisterAllDrivers(void);
+PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID);
+PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver);
+PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj);
+