From c7eafc3610b65eafe408d4959ded4c1aab44157a Mon Sep 17 00:00:00 2001 From: arpi Date: Fri, 13 Sep 2002 19:43:17 +0000 Subject: avifile sync - 95% cosmetics 5% bug git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7387 b3059339-0415-0410-9bf9-f77b7e298cf2 --- loader/afl.c | 94 +++++++--------- loader/com.h | 25 +++-- loader/driver.c | 248 ++++++++++++++++------------------------ loader/driver.h | 21 +++- loader/dshow/DS_Filter.c | 6 +- loader/dshow/allocator.c | 10 +- loader/dshow/allocator.h | 9 +- loader/dshow/cmediasample.c | 3 +- loader/dshow/guids.c | 63 +++++------ loader/dshow/guids.h | 95 +++++++--------- loader/dshow/inputpin.c | 2 +- loader/dshow/inputpin.h | 9 +- loader/dshow/interfaces.h | 37 ++++-- loader/dshow/iunk.h | 5 +- loader/dshow/outputpin.c | 49 ++++---- loader/dshow/outputpin.h | 12 +- loader/elfdll.c | 30 ++--- loader/ext.c | 27 ++--- loader/ext.h | 2 +- loader/ldt_keeper.c | 91 ++++++++------- loader/ldt_keeper.h | 11 +- loader/loader.h | 267 +------------------------------------------ loader/module.c | 40 ++----- loader/module.h | 6 - loader/pe_image.c | 28 ++--- loader/pe_resource.c | 16 +-- loader/registry.c | 117 +++++++++---------- loader/resource.c | 25 +++-- loader/win32.c | 268 +++++++++++++++++++++++++++++--------------- loader/win32.h | 21 ++-- loader/wine/avifmt.h | 2 +- loader/wine/mmreg.h | 8 +- loader/wine/module.h | 10 ++ loader/wine/msacm.h | 3 +- loader/wine/pe_image.h | 2 +- loader/wine/vfw.h | 24 ++-- loader/wineacm.h | 25 ++++- 37 files changed, 753 insertions(+), 958 deletions(-) delete mode 100644 loader/module.h (limited to 'loader') diff --git a/loader/afl.c b/loader/afl.c index d80ffbd6f1..d1024b1a55 100644 --- a/loader/afl.c +++ b/loader/afl.c @@ -21,12 +21,6 @@ ***************************************************************************/ #include "config.h" -#include -#include -#include - -#include "win32.h" - #include "wine/winbase.h" #include "wine/windef.h" #include "wine/winuser.h" @@ -38,15 +32,16 @@ #include "wine/msacmdrv.h" #include "wineacm.h" #include "ext.h" - #include "driver.h" +#include +#include +#include +#pragma pack(1) #define OpenDriverA DrvOpen #define CloseDriver DrvClose -#pragma pack(1) - -static PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has) +static inline PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has) { return (PWINE_ACMSTREAM)has; } @@ -75,7 +70,7 @@ MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule, * LoadDriver on it, to be sure we can call SendDriverMessage on the * hDrvr handle. */ - *phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, NULL, hinstModule); + *phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, 0, hinstModule); /* FIXME: lParam, dwPriority and fdwAdd ignored */ @@ -195,7 +190,6 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe HDRVR hdrv; - TRACE("(%p, %x, %08lu)\n", phad, hadid, fdwOpen); if (!phad) @@ -208,8 +202,9 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe if (fdwOpen) return MMSYSERR_INVALFLAG; - pad = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER)); - if (!pad) return MMSYSERR_NOMEM; + pad = (PWINE_ACMDRIVER) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER)); + if (!pad) + return MMSYSERR_NOMEM; pad->obj.pACMDriverID = padid; icopen.fccType = mmioFOURCC('a', 'u', 'd', 'c'); @@ -217,7 +212,8 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe icopen.dwSize = sizeof(ICOPEN); icopen.dwFlags = 0; - if (!padid->hInstModule) + icopen.pV1Reserved = padid->pszFileName; + if (!padid->hInstModule) pad->hDrvr = OpenDriverA((long)&icopen); else pad->hDrvr = padid->hInstModule; @@ -226,7 +222,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe HeapFree(MSACM_hHeap, 0, pad); return MMSYSERR_ERROR; } - + pad->pfnDriverProc = GetProcAddress(pad->hDrvr, "DriverProc"); /* insert new pad at beg of list */ @@ -235,7 +231,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe /* FIXME: Create a WINE_ACMDRIVER32 */ *phad = (HACMDRIVER)pad; - + return MMSYSERR_NOERROR; } @@ -269,22 +265,19 @@ PWINE_ACMDRIVERID MSACM_pLastACMDriverID = NULL; /*********************************************************************** * MSACM_RegisterDriver32() */ -PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName, +PWINE_ACMDRIVERID MSACM_RegisterDriver(const char* pszFileName, + WORD wFormatTag, 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); + TRACE("('%s', '%x', 0x%08x)\n", pszFileName, wFormatTag, hinstModule); padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)); - padid->pszDriverAlias = (char*)malloc(strlen(pszDriverAlias)+1); - strcpy(padid->pszDriverAlias, pszDriverAlias); + padid->pszFileName = (char*)malloc(strlen(pszFileName)+1); + strcpy(padid->pszFileName, pszFileName); // 1~strdup(pszDriverAlias); - padid->pszFileName = pszFileName; + padid->wFormatTag = wFormatTag; padid->hInstModule = hinstModule; padid->bEnabled = TRUE; padid->pACMDriverList = NULL; @@ -299,23 +292,6 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName, 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() @@ -327,10 +303,8 @@ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p) 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->pszFileName) + free(p->pszFileName); if (p == MSACM_pFirstACMDriverID) MSACM_pFirstACMDriverID = p->pNextACMDriverID; @@ -400,8 +374,6 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw int wfxSrcSize; int wfxDstSize; - //printf("gcc-3.0 bug, pwfxSrc=%p, pwfxSrc->cbSize=%d\n", pwfxSrc, pwfxSrc->cbSize); - TRACE("(%p, 0x%08x, %p, %p, %p, %ld, %ld, %ld)\n", phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen); @@ -418,13 +390,15 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw wfxDstSize = SIZEOF_WFX(pwfxDst); #undef SIZEOF_WFX - was = HeapAlloc(MSACM_hHeap, 0, sizeof(*was) + wfxSrcSize + wfxDstSize + ((pwfltr) ? sizeof(WAVEFILTER) : 0)); + was = (PWINE_ACMSTREAM) 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); + // LHACM is checking for 0x1 + // but if this will not help + // was->drvInst.pwfxSrc->wFormatTag = 1; was->drvInst.pwfxDst = (PWAVEFORMATEX)((LPSTR)was + sizeof(*was) + wfxSrcSize); memcpy(was->drvInst.pwfxDst, pwfxDst, wfxDstSize); if (pwfltr) { @@ -481,10 +455,14 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw } } acmDriverClose(had, 0L);*/ - if(MSACM_pFirstACMDriverID==NULL) - MSACM_RegisterAllDrivers(); + //if(MSACM_pFirstACMDriverID==NULL) + // MSACM_RegisterAllDrivers(); - for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID) { + for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID) + { + /* Check Format */ + if ((int)wadi->wFormatTag != (int)pwfxSrc->wFormatTag) continue; + ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L); if (ret == MMSYSERR_NOERROR) { if ((wad = MSACM_GetDriver(had)) != 0) { @@ -493,6 +471,8 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw was->hAcmDriver = had; ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L); + //lhacm - crash printf("RETOPEN %d\n", ret); + //ret = 0; if (ret == MMSYSERR_NOERROR) { if (fdwOpen & ACM_STREAMOPENF_QUERY) { acmDriverClose(had, 0L); @@ -514,6 +494,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw if (phas) *phas = (HACMSTREAM)was; TRACE("=> (%d)\n", ret); + CodecAlloc(); return ret; } errCleanUp: @@ -540,6 +521,7 @@ MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose) if (was->hAcmDriver) acmDriverClose(was->hAcmDriver, 0L); HeapFree(MSACM_hHeap, 0, was); + CodecRelease(); } TRACE("=> (%d)\n", ret); return ret; @@ -556,7 +538,7 @@ MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, 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)) diff --git a/loader/com.h b/loader/com.h index 84a667f0fd..741b25232b 100644 --- a/loader/com.h +++ b/loader/com.h @@ -1,7 +1,14 @@ #ifndef AVIFILE_COM_H #define AVIFILE_COM_H +#ifdef HAVE_CONFIG_H +#include +#endif +#ifdef HAVE_STDINT_H +#include +#else #include +#endif /** * Internal functions and structures for COM emulation code. @@ -27,12 +34,12 @@ typedef struct } GUID; #endif -extern GUID IID_IUnknown; -extern GUID IID_IClassFactory; +extern const GUID IID_IUnknown; +extern const GUID IID_IClassFactory; -typedef long (*GETCLASSOBJECT) (GUID* clsid, GUID* iid, void** ppv); -int RegisterComClass(GUID* clsid, GETCLASSOBJECT gcs); -int UnregisterComClass(GUID* clsid, GETCLASSOBJECT gcs); +typedef long (*GETCLASSOBJECT) (GUID* clsid, const GUID* iid, void** ppv); +int RegisterComClass(const GUID* clsid, GETCLASSOBJECT gcs); +int UnregisterComClass(const GUID* clsid, GETCLASSOBJECT gcs); #ifndef STDCALL #define STDCALL __attribute__((__stdcall__)) @@ -42,7 +49,7 @@ struct IUnknown; struct IClassFactory; struct IUnknown_vt { - long STDCALL (*QueryInterface)(struct IUnknown* _this, GUID* iid, void** ppv); + long STDCALL (*QueryInterface)(struct IUnknown* _this, const GUID* iid, void** ppv); long STDCALL (*AddRef)(struct IUnknown* _this) ; long STDCALL (*Release)(struct IUnknown* _this) ; } ; @@ -54,10 +61,10 @@ typedef struct IUnknown struct IClassFactory_vt { - long STDCALL (*QueryInterface)(struct IUnknown* _this, GUID* iid, void** ppv); + long STDCALL (*QueryInterface)(struct IUnknown* _this, const 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); + long STDCALL (*CreateInstance)(struct IClassFactory* _this, struct IUnknown* pUnkOuter, const GUID* riid, void** ppvObject); }; struct IClassFactory @@ -66,7 +73,7 @@ struct IClassFactory }; long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter, - long dwClsContext, GUID* riid, void** ppv); + long dwClsContext, const GUID* riid, void** ppv); #ifdef __cplusplus }; diff --git a/loader/driver.c b/loader/driver.c index 09dc49f8dc..b33942a7a8 100644 --- a/loader/driver.c +++ b/loader/driver.c @@ -1,4 +1,5 @@ -#include +#include "config.h" + #include #ifdef HAVE_MALLOC_H #include @@ -17,22 +18,26 @@ #include "ldt_keeper.h" #include "driver.h" +extern char* def_path; #if 1 + /* * STORE_ALL/REST_ALL seems like an attempt to workaround problems due to * WINAPI/no-WINAPI bustage. * - * There should be no need for the STORE_ALL/REST_ALL hack once all + * There should be no need for the STORE_ALL/REST_ALL hack once all * function definitions agree with their prototypes (WINAPI-wise) and * we make sure, that we do not call these functions without a proper * prototype in scope. */ -#define STORE_ALL /**/ -#define REST_ALL /**/ + +#define STORE_ALL +#define REST_ALL #else +// this asm code is no longer needed #define STORE_ALL \ - __asm__( \ + __asm__ __volatile__ ( \ "push %%ebx\n\t" \ "push %%ecx\n\t" \ "push %%edx\n\t" \ @@ -40,7 +45,7 @@ "push %%edi\n\t"::) #define REST_ALL \ - __asm__( \ + __asm__ __volatile__ ( \ "pop %%edi\n\t" \ "pop %%esi\n\t" \ "pop %%edx\n\t" \ @@ -48,180 +53,125 @@ "pop %%ebx\n\t"::) #endif +static int needs_free=0; +void SetCodecPath(const char* path) +{ + if(needs_free)free(def_path); + if(path==0) + { + def_path=WIN32_PATH; + needs_free=0; + return; + } + def_path = (char*) malloc(strlen(path)+1); + strcpy(def_path, path); + needs_free=1; +} - - static DWORD dwDrvID = 0; - -LRESULT WINAPI SendDriverMessage( HDRVR hDriver, UINT message, - LPARAM lParam1, LPARAM lParam2 ) +LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT message, + LPARAM lParam1, LPARAM lParam2) { DRVR* module=(DRVR*)hDriver; int result; -#ifdef DETAILED_OUT +#ifndef __svr4__ + char qw[300]; +#endif +#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; + if (!module || !module->hDriverModule || !module->DriverProc) return -1; +#ifndef __svr4__ + __asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw)); +#endif + + Setup_FS_Segment(); + STORE_ALL; - result=module->DriverProc(module->dwDriverID,1,message,lParam1,lParam2); + result=module->DriverProc(module->dwDriverID, hDriver, message, lParam1, lParam2); REST_ALL; -#ifdef DETAILED_OUT + +#ifndef __svr4__ + __asm__ __volatile__ ("frstor (%0)\n\t": :"r"(&qw)); +#endif + +#ifdef DETAILED_OUT printf("\t\tResult: %X\n", result); -#endif +#endif return result; -} +} -static NPDRVR DrvAlloc(HDRVR*lpDriver, LPUINT lpDrvResult) +void DrvClose(HDRVR hDriver) { - NPDRVR npDriver; - /* allocate and lock handle */ - if (lpDriver) + if (hDriver) { - if ( (*lpDriver = (HDRVR) malloc(sizeof(DRVR))) ) - { - if ((npDriver = (NPDRVR) *lpDriver)) - { - *lpDrvResult = MMSYSERR_NOERROR; - return (npDriver); - } - free((NPDRVR)*lpDriver); - } - return (*lpDrvResult = MMSYSERR_NOMEM, (NPDRVR) 0); + DRVR* d = (DRVR*)hDriver; + if (d->hDriverModule) + { + Setup_FS_Segment(); + if (d->DriverProc) + { + SendDriverMessage(hDriver, DRV_CLOSE, 0, 0); + d->dwDriverID = 0; + SendDriverMessage(hDriver, DRV_FREE, 0, 0); + } + FreeLibrary(d->hDriverModule); + } + free(d); } - return (*lpDrvResult = MMSYSERR_INVALPARAM, (NPDRVR) 0); + CodecRelease(); } - -static void DrvFree(HDRVR hDriver) +//DrvOpen(LPCSTR lpszDriverName, LPCSTR lpszSectionName, LPARAM lParam2) +HDRVR DrvOpen(LPARAM lParam2) { + NPDRVR hDriver; int i; - Setup_FS_Segment(); - 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* win32_codec_name=NULL; // must be set before calling DrvOpen() !!! - -HDRVR VFWAPI -DrvOpen(LPARAM lParam2) -{ - ICOPEN *icopen=(ICOPEN *) lParam2; - UINT uDrvResult; - HDRVR hDriver; - NPDRVR npDriver; - char unknown[0x24]; -// char* codec_name=icopen->fccHandler; + char unknown[0x124]; + const char* filename = (const char*) ((ICOPEN*) lParam2)->pV1Reserved; +#ifdef MPLAYER Setup_LDT_Keeper(); + printf("Loading codec DLL: '%s'\n",filename); +#endif - if (!(npDriver = DrvAlloc(&hDriver, &uDrvResult))) + hDriver = (NPDRVR) malloc(sizeof(DRVR)); + if (!hDriver) return ((HDRVR) 0); + memset((void*)hDriver, 0, sizeof(DRVR)); - if (!(npDriver->hDriverModule = LoadLibraryA(win32_codec_name))) { - printf("Can't open library %s\n", win32_codec_name); - DrvFree(hDriver); - return ((HDRVR) 0); - } + CodecAlloc(); + Setup_FS_Segment(); -#if 0 + hDriver->hDriverModule = LoadLibraryA(filename); + if (!hDriver->hDriverModule) { - 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; + printf("Can't open library %s\n", filename); + DrvClose((HDRVR)hDriver); + return ((HDRVR) 0); } -#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 (wrong/missing GUID?)\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); + hDriver->DriverProc = (DRIVERPROC) GetProcAddress(hDriver->hDriverModule, + "DriverProc"); + if (!hDriver->DriverProc) + { + printf("Library %s is not a valid VfW/ACM codec\n", filename); + DrvClose((HDRVR)hDriver); + return ((HDRVR) 0); } - //TRACE("DriverProc == %X\n", npDriver->DriverProc); - npDriver->dwDriverID = ++dwDrvID; - - Setup_FS_Segment(); + TRACE("DriverProc == %X\n", hDriver->DriverProc); + SendDriverMessage((HDRVR)hDriver, DRV_LOAD, 0, 0); + TRACE("DRV_LOAD Ok!\n"); + SendDriverMessage((HDRVR)hDriver, DRV_ENABLE, 0, 0); + TRACE("DRV_ENABLE Ok!\n"); + hDriver->dwDriverID = ++dwDrvID; // generate new id - 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 and remmeber proper DriverID + hDriver->dwDriverID = SendDriverMessage((HDRVR)hDriver, DRV_OPEN, (LPARAM) unknown, lParam2); + TRACE("DRV_OPEN Ok!(%X)\n", hDriver->dwDriverID); - // 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); + printf("Loaded DLL driver %s\n", filename); + return (HDRVR)hDriver; } - diff --git a/loader/driver.h b/loader/driver.h index 59a7753353..751f0379e8 100644 --- a/loader/driver.h +++ b/loader/driver.h @@ -1,11 +1,22 @@ - #ifndef loader_driver_h #define loader_driver_h -//#include "wine/windef.h" -//#include "wine/vfw.h" +#ifdef __cplusplus +extern "C" { +#endif + +#include "wine/windef.h" +#include "wine/driver.h" -extern HDRVR VFWAPI DrvOpen(LPARAM lParam2); -extern void DrvClose(HDRVR hdrvr); +void SetCodecPath(const char* path); +void CodecAlloc(void); +void CodecRelease(void); + +HDRVR DrvOpen(LPARAM lParam2); +void DrvClose(HDRVR hdrvr); + +#ifdef __cplusplus +} +#endif #endif diff --git a/loader/dshow/DS_Filter.c b/loader/dshow/DS_Filter.c index e1d11aa801..fb910ee99e 100644 --- a/loader/dshow/DS_Filter.c +++ b/loader/dshow/DS_Filter.c @@ -1,9 +1,10 @@ #include "DS_Filter.h" #include "driver.h" #include "com.h" -#include "module.h" #include #include +#include +#include "win32.h" // printf macro typedef long STDCALL (*GETCLASS) (const GUID*, const GUID*, void**); @@ -145,7 +146,7 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, object->vt->Release((IUnknown*)object); if (result || !This->m_pFilter) { - em = "object does not have IBaseFilter interface"; + em = "object does not provide IBaseFilter interface"; break; } // enumerate pins @@ -228,7 +229,6 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, break; } - printf("Using DirectShow codec: %s\n", dllname); init++; break; } diff --git a/loader/dshow/allocator.c b/loader/dshow/allocator.c index bc129dc422..c5600f40d9 100644 --- a/loader/dshow/allocator.c +++ b/loader/dshow/allocator.c @@ -2,9 +2,17 @@ #include "com.h" #include "wine/winerror.h" #include +#include static int AllocatorKeeper = 0; +struct _avm_list_t +{ + struct _avm_list_t* next; + struct _avm_list_t* prev; + void* member; +}; + static inline int avm_list_size(avm_list_t* head) { avm_list_t* it = head; @@ -100,7 +108,7 @@ static inline avm_list_t* avm_list_find(avm_list_t* head, void* member) return NULL; } -static long MemAllocator_CreateAllocator(GUID* clsid, GUID* iid, void** ppv) +static long MemAllocator_CreateAllocator(GUID* clsid, const GUID* iid, void** ppv) { IMemAllocator* p; int result; diff --git a/loader/dshow/allocator.h b/loader/dshow/allocator.h index 8556370635..b4f6aaf703 100644 --- a/loader/dshow/allocator.h +++ b/loader/dshow/allocator.h @@ -4,14 +4,9 @@ #include "interfaces.h" #include "cmediasample.h" -typedef struct avm_list_t -{ - struct avm_list_t* next; - struct avm_list_t* prev; - void* member; -} avm_list_t; - +typedef struct _avm_list_t avm_list_t; typedef struct _MemAllocator MemAllocator; + struct _MemAllocator { IMemAllocator_vt* vt; diff --git a/loader/dshow/cmediasample.c b/loader/dshow/cmediasample.c index eba60dd4a0..e618f68674 100644 --- a/loader/dshow/cmediasample.c +++ b/loader/dshow/cmediasample.c @@ -2,9 +2,10 @@ #include "wine/winerror.h" #include #include +#include static long STDCALL CMediaSample_QueryInterface(IUnknown* This, - /* [in] */ IID* iid, + /* [in] */ const GUID* iid, /* [iid_is][out] */ void **ppv) { Debug printf("CMediaSample_QueryInterface(%p) called\n", This); diff --git a/loader/dshow/guids.c b/loader/dshow/guids.c index f1ee0aaa37..9dae571fad 100644 --- a/loader/dshow/guids.c +++ b/loader/dshow/guids.c @@ -1,68 +1,67 @@ #include "guids.h" int DSHOW_DEBUG = 0; -GUID CLSID_DivxDecompressorCF={0x82CCd3E0, 0xF71A, 0x11D0, +const GUID CLSID_DivxDecompressorCF={0x82CCd3E0, 0xF71A, 0x11D0, { 0x9f, 0xe5, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}}; -GUID IID_IDivxFilterInterface={0xd132ee97, 0x3e38, 0x4030, +const GUID IID_IDivxFilterInterface={0xd132ee97, 0x3e38, 0x4030, {0x8b, 0x17, 0x59, 0x16, 0x3b, 0x30, 0xa1, 0xf5}}; -GUID CLSID_IV50_Decoder={0x30355649, 0x0000, 0x0010, +const GUID CLSID_IV50_Decoder={0x30355649, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID IID_IBaseFilter={0x56a86895, 0x0ad4, 0x11ce, +const GUID IID_IBaseFilter={0x56a86895, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; -GUID IID_IEnumPins={0x56a86892, 0x0ad4, 0x11ce, +const GUID IID_IEnumPins={0x56a86892, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; -GUID IID_IEnumMediaTypes={0x89c31040, 0x846b, 0x11ce, +const GUID IID_IEnumMediaTypes={0x89c31040, 0x846b, 0x11ce, {0x97, 0xd3, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}}; -GUID IID_IMemInputPin={0x56a8689d, 0x0ad4, 0x11ce, +const GUID IID_IMemInputPin={0x56a8689d, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; -GUID IID_IMemAllocator={0x56a8689c, 0x0ad4, 0x11ce, +const GUID IID_IMemAllocator={0x56a8689c, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; -GUID IID_IMediaSample={0x56a8689a, 0x0ad4, 0x11ce, +const GUID IID_IMediaSample={0x56a8689a, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; -GUID MEDIATYPE_Video={0x73646976, 0x0000, 0x0010, +const GUID MEDIATYPE_Video={0x73646976, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID GUID_NULL={0x0, 0x0, 0x0, +const GUID GUID_NULL={0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; -GUID FORMAT_VideoInfo={0x05589f80, 0xc356, 0x11ce, +const GUID FORMAT_VideoInfo={0x05589f80, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}}; -GUID MEDIASUBTYPE_RGB565={0xe436eb7b, 0x524f, 0x11ce, +const GUID MEDIASUBTYPE_RGB565={0xe436eb7b, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; -GUID MEDIASUBTYPE_RGB555={0xe436eb7c, 0x524f, 0x11ce, +const GUID MEDIASUBTYPE_RGB555={0xe436eb7c, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; -GUID MEDIASUBTYPE_RGB24={0xe436eb7d, 0x524f, 0x11ce, +const GUID MEDIASUBTYPE_RGB24={0xe436eb7d, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; -GUID MEDIASUBTYPE_RGB32={0xe436eb7e, 0x524f, 0x11ce, +const GUID MEDIASUBTYPE_RGB32={0xe436eb7e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}}; -GUID MEDIASUBTYPE_YUYV={0x56595559, 0x0000, 0x0010, +const GUID MEDIASUBTYPE_YUYV={0x56595559, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID MEDIASUBTYPE_IYUV={0x56555949, 0x0000, 0x0010, +const GUID MEDIASUBTYPE_IYUV={0x56555949, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID MEDIASUBTYPE_YVU9={0x39555659, 0x0000, 0x0010, +const GUID MEDIASUBTYPE_YVU9={0x39555659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID MEDIASUBTYPE_Y411={0x31313459, 0x0000, 0x0010, +const GUID MEDIASUBTYPE_Y411={0x31313459, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID MEDIASUBTYPE_Y41P={0x50313459, 0x0000, 0x0010, +const GUID MEDIASUBTYPE_Y41P={0x50313459, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID MEDIASUBTYPE_YUY2={0x32595559, 0x0000, 0x0010, +const GUID MEDIASUBTYPE_YUY2={0x32595559, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID MEDIASUBTYPE_YVYU={0x55595659, 0x0000, 0x0010, +const GUID MEDIASUBTYPE_YVYU={0x55595659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID MEDIASUBTYPE_UYVY={0x59565955, 0x0000, 0x0010, +const GUID MEDIASUBTYPE_UYVY={0x59565955, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID MEDIASUBTYPE_Y211={0x31313259, 0x0000, 0x0010, +const GUID MEDIASUBTYPE_Y211={0x31313259, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID MEDIASUBTYPE_YV12={0x32315659, 0x0000, 0x0010, +const GUID MEDIASUBTYPE_YV12={0x32315659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID MEDIASUBTYPE_I420={0x30323449, 0x0000, 0x0010, +const GUID MEDIASUBTYPE_I420={0x30323449, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID MEDIASUBTYPE_IF09={0x39304649, 0x0000, 0x0010, +const GUID MEDIASUBTYPE_IF09={0x39304649, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -GUID CLSID_MemoryAllocator={0x1e651cc0, 0xb199, 0x11d0, +const GUID CLSID_MemoryAllocator={0x1e651cc0, 0xb199, 0x11d0, {0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45}}; -GUID IID_DivxHidden={0x598eba01, 0xb49a, 0x11d2, +const GUID IID_DivxHidden={0x598eba01, 0xb49a, 0x11d2, {0xa1, 0xc1, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}}; -GUID IID_Iv50Hidden={0x665a4442, 0xd905, 0x11d0, +const GUID IID_Iv50Hidden={0x665a4442, 0xd905, 0x11d0, {0xa3, 0x0e, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}; - diff --git a/loader/dshow/guids.h b/loader/dshow/guids.h index 882ba4c291..6198f06632 100644 --- a/loader/dshow/guids.h +++ b/loader/dshow/guids.h @@ -1,5 +1,5 @@ -#ifndef GUIDS_H -#define GUIDS_H +#ifndef DS_GUIDS_H +#define DS_GUIDS_H #include "com.h" #include "wine/module.h" @@ -22,12 +22,6 @@ typedef struct __attribute__((__packed__)) _MediaType char* pbFormat; //0x44 } AM_MEDIA_TYPE; -typedef enum -{ - PINDIR_INPUT = 0, - PINDIR_OUTPUT -} PIN_DIRECTION; - typedef long long REFERENCE_TIME; typedef struct __attribute__((__packed__)) RECT32 @@ -35,8 +29,8 @@ typedef struct __attribute__((__packed__)) RECT32 int left, top, right, bottom; } RECT32; -typedef struct __attribute__((__packed__)) tagVIDEOINFOHEADER { - +typedef struct __attribute__((__packed__)) tagVIDEOINFOHEADER +{ RECT32 rcSource; // The bit we really want to use RECT32 rcTarget; // Where the video should go unsigned long dwBitRate; // Approximate bit data rate @@ -46,52 +40,39 @@ typedef struct __attribute__((__packed__)) tagVIDEOINFOHEADER { //int reserved[3]; } VIDEOINFOHEADER; -typedef struct _AllocatorProperties -{ - long cBuffers; - long cbBuffer; - long cbAlign; - long cbPrefix; -} ALLOCATOR_PROPERTIES; - -typedef struct _IBaseFilter IBaseFilter; -typedef struct _PinInfo -{ - IBaseFilter* pFilter; - PIN_DIRECTION dir; - unsigned short achName[128]; -} PIN_INFO; - +typedef GUID CLSID; +typedef GUID IID; -extern GUID IID_IBaseFilter; -extern GUID IID_IEnumPins; -extern GUID IID_IEnumMediaTypes; -extern GUID IID_IMemInputPin; -extern GUID IID_IMemAllocator; -extern GUID IID_IMediaSample; -extern GUID IID_DivxHidden; -extern GUID IID_Iv50Hidden; -extern GUID CLSID_DivxDecompressorCF; -extern GUID IID_IDivxFilterInterface; -extern GUID CLSID_IV50_Decoder; -extern GUID CLSID_MemoryAllocator; -extern GUID MEDIATYPE_Video; -extern GUID GUID_NULL; -extern GUID FORMAT_VideoInfo; -extern GUID MEDIASUBTYPE_RGB565; -extern GUID MEDIASUBTYPE_RGB555; -extern GUID MEDIASUBTYPE_RGB24; -extern GUID MEDIASUBTYPE_RGB32; -extern GUID MEDIASUBTYPE_YUYV; -extern GUID MEDIASUBTYPE_IYUV; -extern GUID MEDIASUBTYPE_YVU9; -extern GUID MEDIASUBTYPE_Y411; -extern GUID MEDIASUBTYPE_Y41P; -extern GUID MEDIASUBTYPE_YUY2; -extern GUID MEDIASUBTYPE_YVYU; -extern GUID MEDIASUBTYPE_UYVY; -extern GUID MEDIASUBTYPE_Y211; -extern GUID MEDIASUBTYPE_YV12; -extern GUID MEDIASUBTYPE_I420; +extern const GUID IID_IBaseFilter; +extern const GUID IID_IEnumPins; +extern const GUID IID_IEnumMediaTypes; +extern const GUID IID_IMemInputPin; +extern const GUID IID_IMemAllocator; +extern const GUID IID_IMediaSample; +extern const GUID IID_DivxHidden; +extern const GUID IID_Iv50Hidden; +extern const GUID CLSID_DivxDecompressorCF; +extern const GUID IID_IDivxFilterInterface; +extern const GUID CLSID_IV50_Decoder; +extern const GUID CLSID_MemoryAllocator; +extern const GUID MEDIATYPE_Video; +extern const GUID GUID_NULL; +extern const GUID FORMAT_VideoInfo; +extern const GUID MEDIASUBTYPE_RGB565; +extern const GUID MEDIASUBTYPE_RGB555; +extern const GUID MEDIASUBTYPE_RGB24; +extern const GUID MEDIASUBTYPE_RGB32; +extern const GUID MEDIASUBTYPE_YUYV; +extern const GUID MEDIASUBTYPE_IYUV; +extern const GUID MEDIASUBTYPE_YVU9; +extern const GUID MEDIASUBTYPE_Y411; +extern const GUID MEDIASUBTYPE_Y41P; +extern const GUID MEDIASUBTYPE_YUY2; +extern const GUID MEDIASUBTYPE_YVYU; +extern const GUID MEDIASUBTYPE_UYVY; +extern const GUID MEDIASUBTYPE_Y211; +extern const GUID MEDIASUBTYPE_YV12; +extern const GUID MEDIASUBTYPE_I420; +extern const GUID MEDIASUBTYPE_IF09; -#endif +#endif /* DS_GUIDS_H */ diff --git a/loader/dshow/inputpin.c b/loader/dshow/inputpin.c index 89264ec086..5fcc039e1c 100644 --- a/loader/dshow/inputpin.c +++ b/loader/dshow/inputpin.c @@ -4,7 +4,7 @@ #include #include -static int unimplemented(const char* s, void* p) +static inline int unimplemented(const char* s, void* p) { Debug printf("%s(%p) called (UNIMPLEMENTED)", s, p); return E_NOTIMPL; diff --git a/loader/dshow/inputpin.h b/loader/dshow/inputpin.h index 1ad9a2d608..04f27a6171 100644 --- a/loader/dshow/inputpin.h +++ b/loader/dshow/inputpin.h @@ -33,20 +33,19 @@ struct _CBaseFilter CBaseFilter* CBaseFilterCreate(const AM_MEDIA_TYPE* vhdr, CBaseFilter2* parent); -typedef struct _CInputPin CInputPin; -struct _CInputPin +typedef struct { IPin_vt* vt; DECLARE_IUNKNOWN(); CBaseFilter* parent; AM_MEDIA_TYPE type; GUID interfaces[1]; -}; +} CInputPin; CInputPin* CInputPinCreate(CBaseFilter* parent, const AM_MEDIA_TYPE* vhdr); -typedef struct CRemotePin +typedef struct { IPin_vt* vt; DECLARE_IUNKNOWN(); @@ -58,7 +57,7 @@ typedef struct CRemotePin CRemotePin* CRemotePinCreate(CBaseFilter* pt, IPin* rpin); -typedef struct CRemotePin2 +typedef struct { IPin_vt* vt; DECLARE_IUNKNOWN(); diff --git a/loader/dshow/interfaces.h b/loader/dshow/interfaces.h index 23b02a5090..92a7718cd0 100644 --- a/loader/dshow/interfaces.h +++ b/loader/dshow/interfaces.h @@ -2,26 +2,41 @@ #define DS_INTERFACES_H /* - -Definition of important DirectShow interfaces. -Created using freely-available DirectX 8.0 SDK -( http://msdn.microsoft.com ) - -*/ + * Definition of important DirectShow interfaces. + * Created using freely-available DirectX 8.0 SDK + * ( http://msdn.microsoft.com ) + */ #include "iunk.h" #include "com.h" -//typedef GUID& REFIID; -typedef GUID CLSID; -typedef GUID IID; - /* Sh*t. MSVC++ and g++ use different methods of storing vtables. */ typedef struct _IReferenceClock IReferenceClock; typedef struct _IFilterGraph IFilterGraph; -enum PIN_DIRECTION; +typedef struct _IBaseFilter IBaseFilter; + +typedef enum +{ + PINDIR_INPUT = 0, + PINDIR_OUTPUT +} PIN_DIRECTION; + +typedef struct _PinInfo +{ + IBaseFilter* pFilter; + PIN_DIRECTION dir; + unsigned short achName[128]; +} PIN_INFO; + +typedef struct _AllocatorProperties +{ + long cBuffers; + long cbBuffer; + long cbAlign; + long cbPrefix; +} ALLOCATOR_PROPERTIES; typedef struct _IEnumMediaTypes IEnumMediaTypes; typedef struct IEnumMediaTypes_vt diff --git a/loader/dshow/iunk.h b/loader/dshow/iunk.h index 6dbf00ffaa..3c66b154c7 100644 --- a/loader/dshow/iunk.h +++ b/loader/dshow/iunk.h @@ -2,10 +2,9 @@ #define DS_IUNK_H #include "guids.h" -#include #define INHERIT_IUNKNOWN() \ - long STDCALL ( *QueryInterface )(IUnknown * This, GUID* riid, void **ppvObject); \ + long STDCALL ( *QueryInterface )(IUnknown * This, const GUID* riid, void **ppvObject); \ long STDCALL ( *AddRef )(IUnknown * This); \ long STDCALL ( *Release )(IUnknown * This); @@ -14,7 +13,7 @@ #define IMPLEMENT_IUNKNOWN(CLASSNAME) \ static long STDCALL CLASSNAME ## _QueryInterface(IUnknown * This, \ - GUID* riid, void **ppvObject) \ + const GUID* riid, void **ppvObject) \ { \ CLASSNAME * me = (CLASSNAME *)This; \ GUID* r; unsigned int i = 0; \ diff --git a/loader/dshow/outputpin.c b/loader/dshow/outputpin.c index 4546d0294d..5e9a76b9ef 100644 --- a/loader/dshow/outputpin.c +++ b/loader/dshow/outputpin.c @@ -4,13 +4,14 @@ #include "outputpin.h" #include #include +#include /* An object beyond interface IEnumMediaTypes. Returned by COutputPin through call IPin::EnumMediaTypes(). */ -static int unimplemented(const char* s, void* p) +static inline int output_unimplemented(const char* s, void* p) { Debug printf("%s(%p) called (UNIMPLEMENTED)", s, p); return E_NOTIMPL; @@ -24,6 +25,15 @@ typedef struct CEnumMediaTypes GUID interfaces[2]; } CEnumMediaTypes; +struct _COutputMemPin +{ + IMemInputPin_vt* vt; + DECLARE_IUNKNOWN(); + char** frame_pointer; + long* frame_size_pointer; + MemAllocator* pAllocator; + COutputPin* parent; +}; static HRESULT STDCALL CEnumMediaTypes_Next(IEnumMediaTypes * This, /* [in] */ ULONG cMediaTypes, @@ -58,8 +68,7 @@ static HRESULT STDCALL CEnumMediaTypes_Next(IEnumMediaTypes * This, static HRESULT STDCALL CEnumMediaTypes_Skip(IEnumMediaTypes * This, /* [in] */ ULONG cMediaTypes) { - Debug unimplemented("CEnumMediaTypes::Skip", This); - return E_NOTIMPL; + return output_unimplemented("CEnumMediaTypes::Skip", This); } static HRESULT STDCALL CEnumMediaTypes_Reset(IEnumMediaTypes * This) @@ -121,7 +130,7 @@ CEnumMediaTypes* CEnumMediaTypesCreate(const AM_MEDIA_TYPE* amt) *************/ -static HRESULT STDCALL COutputPin_QueryInterface(IUnknown* This, GUID* iid, void** ppv) +static HRESULT STDCALL COutputPin_QueryInterface(IUnknown* This, const GUID* iid, void** ppv) { COutputPin* p = (COutputPin*) This; @@ -214,8 +223,7 @@ static HRESULT STDCALL COutputPin_ConnectionMediaType(IPin * This, static HRESULT STDCALL COutputPin_QueryPinInfo(IPin * This, /* [out] */ PIN_INFO *pInfo) { - Debug unimplemented("COutputPin_QueryPinInfo", This); - return E_NOTIMPL; + return output_unimplemented("COutputPin_QueryPinInfo", This); } static HRESULT STDCALL COutputPin_QueryDirection(IPin * This, @@ -231,15 +239,13 @@ static HRESULT STDCALL COutputPin_QueryDirection(IPin * This, static HRESULT STDCALL COutputPin_QueryId(IPin * This, /* [out] */ LPWSTR *Id) { - Debug unimplemented("COutputPin_QueryId", This); - return E_NOTIMPL; + return output_unimplemented("COutputPin_QueryId", This); } static HRESULT STDCALL COutputPin_QueryAccept(IPin * This, /* [in] */ const AM_MEDIA_TYPE *pmt) { - Debug unimplemented("COutputPin_QueryAccept", This); - return E_NOTIMPL; + return output_unimplemented("COutputPin_QueryAccept", This); } static HRESULT STDCALL COutputPin_EnumMediaTypes(IPin * This, @@ -256,26 +262,22 @@ static HRESULT STDCALL COutputPin_QueryInternalConnections(IPin * This, /* [out] */ IPin **apPin, /* [out][in] */ ULONG *nPin) { - Debug unimplemented("COutputPin_QueryInternalConnections", This); - return E_NOTIMPL; + return output_unimplemented("COutputPin_QueryInternalConnections", This); } static HRESULT STDCALL COutputPin_EndOfStream(IPin * This) { - Debug unimplemented("COutputPin_EndOfStream", This); - return E_NOTIMPL; + return output_unimplemented("COutputPin_EndOfStream", This); } static HRESULT STDCALL COutputPin_BeginFlush(IPin * This) { - Debug unimplemented("COutputPin_BeginFlush", This); - return E_NOTIMPL; + return output_unimplemented("COutputPin_BeginFlush", This); } static HRESULT STDCALL COutputPin_EndFlush(IPin * This) { - Debug unimplemented("COutputPin_EndFlush", This); - return E_NOTIMPL; + return output_unimplemented("COutputPin_EndFlush", This); } static HRESULT STDCALL COutputPin_NewSegment(IPin * This, @@ -292,7 +294,7 @@ static HRESULT STDCALL COutputPin_NewSegment(IPin * This, // IMemInputPin->IUnknown methods -static HRESULT STDCALL COutputPin_M_QueryInterface(IUnknown* This, GUID* iid, void** ppv) +static HRESULT STDCALL COutputPin_M_QueryInterface(IUnknown* This, const GUID* iid, void** ppv) { COutputPin* p = (COutputPin*)This; @@ -351,8 +353,7 @@ static HRESULT STDCALL COutputPin_NotifyAllocator(IMemInputPin* This, static HRESULT STDCALL COutputPin_GetAllocatorRequirements(IMemInputPin* This, /* [out] */ ALLOCATOR_PROPERTIES* pProps) { - Debug unimplemented("COutputPin_GetAllocatorRequirements", This); - return E_NOTIMPL; + return output_unimplemented("COutputPin_GetAllocatorRequirements", This); } static HRESULT STDCALL COutputPin_Receive(IMemInputPin* This, @@ -395,14 +396,12 @@ static HRESULT STDCALL COutputPin_ReceiveMultiple(IMemInputPin * This, /* [in] */ long nSamples, /* [out] */ long *nSamplesProcessed) { - Debug unimplemented("COutputPin_ReceiveMultiple", This); - return E_NOTIMPL; + return output_unimplemented("COutputPin_ReceiveMultiple", This); } static HRESULT STDCALL COutputPin_ReceiveCanBlock(IMemInputPin * This) { - Debug unimplemented("COutputPin_ReceiveCanBlock", This); - return E_NOTIMPL; + return output_unimplemented("COutputPin_ReceiveCanBlock", This); } static void COutputPin_SetFramePointer(COutputPin* This, char** z) diff --git a/loader/dshow/outputpin.h b/loader/dshow/outputpin.h index 016b36787f..1e802f6e02 100644 --- a/loader/dshow/outputpin.h +++ b/loader/dshow/outputpin.h @@ -5,18 +5,8 @@ #include "allocator.h" -typedef struct _COutputPin COutputPin; - typedef struct _COutputMemPin COutputMemPin; -struct _COutputMemPin -{ - IMemInputPin_vt* vt; - DECLARE_IUNKNOWN(); - char** frame_pointer; - long* frame_size_pointer; - MemAllocator* pAllocator; - COutputPin* parent; -}; +typedef struct _COutputPin COutputPin; struct _COutputPin { diff --git a/loader/elfdll.c b/loader/elfdll.c index b54dbce6e3..c393c4e294 100644 --- a/loader/elfdll.c +++ b/loader/elfdll.c @@ -3,16 +3,16 @@ * * Copyright 1999 Bertho A. Stultiens */ -#include +#include "config.h" #ifdef HAVE_LIBDL -#include -#include -#include -#include -#include -#include +#include "wine/windef.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) @@ -22,16 +22,6 @@ #include #include -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; @@ -202,7 +192,7 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path) // wm->binfmt.pe.pe_resource = (PIMAGE_RESOURCE_DIRECTORY)RVA(hModule, dir->VirtualAddress); - wm->filename = malloc(strlen(path)+1); + wm->filename = (char*) malloc(strlen(path)+1); strcpy(wm->filename, path); wm->modname = strrchr( wm->filename, '\\' ); if (!wm->modname) wm->modname = wm->filename; @@ -221,7 +211,7 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path) if(local_wm) { - local_wm->next=malloc(sizeof(modref_list)); + local_wm->next = (modref_list*) malloc(sizeof(modref_list)); local_wm->next->prev=local_wm; local_wm->next->next=NULL; local_wm->next->wm=wm; @@ -229,7 +219,7 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path) } else { - local_wm=malloc(sizeof(modref_list)); + local_wm = (modref_list*) malloc(sizeof(modref_list)); local_wm->next=local_wm->prev=NULL; local_wm->wm=wm; } diff --git a/loader/ext.c b/loader/ext.c index eb56db1478..638b0cb488 100644 --- a/loader/ext.c +++ b/loader/ext.c @@ -18,10 +18,11 @@ #include #include #include -#include -#include -#include -#include + +#include "wine/windef.h" +#include "wine/winbase.h" +#include "wine/debugtools.h" +#include "wine/heap.h" #include "ext.h" #if 0 @@ -188,18 +189,18 @@ WIN_BOOL WINAPI IsBadReadPtr(LPCVOID data, UINT size) LPSTR HEAP_strdupA(HANDLE heap, DWORD flags, LPCSTR string) { // return strdup(string); - char* answ=malloc(strlen(string)+1); + char* answ = (char*) malloc(strlen(string) + 1); strcpy(answ, string); return answ; } LPWSTR HEAP_strdupAtoW(HANDLE heap, DWORD flags, LPCSTR string) { int size, i; - short* answer; + WCHAR* answer; if(string==0) return 0; size=strlen(string); - answer=malloc(2 * (size + 1)); + answer = (WCHAR*) malloc(sizeof(WCHAR) * (size + 1)); for(i=0; i<=size; i++) answer[i]=(short)string[i]; return answer; @@ -213,7 +214,7 @@ LPSTR HEAP_strdupWtoA(HANDLE heap, DWORD flags, LPCWSTR string) size=0; while(string[size]) size++; - answer=malloc(size+2); + answer = (char*) malloc(size + 2); for(i=0; i<=size; i++) answer[i]=(char)string[i]; return answer; @@ -390,12 +391,12 @@ HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr, { if(fm==0) { - fm=malloc(sizeof(file_mapping)); + fm = (file_mapping*) malloc(sizeof(file_mapping)); fm->prev=NULL; } else { - fm->next=malloc(sizeof(file_mapping)); + fm->next = (file_mapping*) malloc(sizeof(file_mapping)); fm->next->prev=fm; fm=fm->next; } @@ -403,7 +404,7 @@ HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr, fm->handle=answer; if(name) { - fm->name=malloc(strlen(name)+1); + fm->name = (char*) malloc(strlen(name)+1); strcpy(fm->name, name); } else @@ -509,9 +510,9 @@ LPVOID WINAPI VirtualAlloc(LPVOID address, DWORD size, DWORD type, DWORD protec } else { - virt_alloc *new_vm=malloc(sizeof(virt_alloc)); + virt_alloc *new_vm = (virt_alloc*) malloc(sizeof(virt_alloc)); new_vm->mapping_size=size; - new_vm->address=answer; + new_vm->address=(char*)answer; new_vm->prev=vm; if(type == MEM_RESERVE) new_vm->state=0; diff --git a/loader/ext.h b/loader/ext.h index fa4f52d43e..579e85beca 100644 --- a/loader/ext.h +++ b/loader/ext.h @@ -1,7 +1,7 @@ #ifndef loader_ext_h #define loader_ext_h -#include +#include "wine/windef.h" extern LPVOID FILE_dommap( int unix_handle, LPVOID start, DWORD size_high, DWORD size_low, diff --git a/loader/ldt_keeper.c b/loader/ldt_keeper.c index 8ae013c616..d71bac8ce2 100644 --- a/loader/ldt_keeper.c +++ b/loader/ldt_keeper.c @@ -4,8 +4,13 @@ * be modified before program creates first thread * - avifile includes this file from C++ code * and initializes it at the start of player! + * it might sound like a hack and it really is - but + * as aviplay is deconding video with more than just one + * thread currently it's necessary to do it this way + * this might change in the future */ +/* applied some modification to make make our xine friend more happy */ #include "ldt_keeper.h" #include @@ -19,6 +24,14 @@ #ifdef __linux__ #include #include +/* prototype it here, so we won't depend on kernel headers */ +#ifdef __cplusplus +extern "C" { +#endif +int modify_ldt(int func, void *ptr, unsigned long bytecount); +#ifdef __cplusplus +} +#endif #else #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include @@ -33,7 +46,7 @@ #ifdef __cplusplus extern "C" { #endif -extern int sysi86(int, void*); +int sysi86(int, void*); #ifdef __cplusplus } #endif @@ -69,20 +82,13 @@ struct modify_ldt_ldt_s { /* user level (privilege level: 3) ldt (1<<2) segment selector */ #define LDT_SEL(idx) ((idx) << 3 | 1 << 2 | 3) +/* i got this value from wine sources, it's the first free LDT entry */ #ifndef TEB_SEL_IDX -#define TEB_SEL_IDX 1 +#define TEB_SEL_IDX 17 #endif -#define TEB_SEL LDT_SEL(TEB_SEL_IDX) -/** - * - * This should be performed before we create first thread. See remarks - * for write_ldt(), linux/kernel/ldt.c. - * - */ +#define TEB_SEL LDT_SEL(TEB_SEL_IDX) -void* fs_seg = NULL; -static char* prev_struct = NULL; /** * here is a small logical problem with Restore for multithreaded programs - * in C++ we use static class for this... @@ -98,6 +104,8 @@ void Setup_FS_Segment(void) ); } +/* we don't need this - use modify_ldt instead */ +#if 0 #ifdef __linux__ /* XXX: why is this routine from libc redefined here? */ /* NOTE: the redefined version ignores the count param, count is hardcoded as 16 */ @@ -130,6 +138,7 @@ static int LDT_Modify( int func, struct modify_ldt_ldt_s *ptr, return -1; } #endif +#endif #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content ) @@ -147,31 +156,34 @@ static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt } #endif -void Setup_LDT_Keeper(void) +//void* fs_seg=0; + +ldt_fs_t* Setup_LDT_Keeper(void) { struct modify_ldt_ldt_s array; - int fd; int ret; + ldt_fs_t* ldt_fs = (ldt_fs_t*) malloc(sizeof(ldt_fs_t)); - if (fs_seg) - return; + if (!ldt_fs) + return NULL; - prev_struct = 0; - fd = open("/dev/zero", O_RDWR); - if(fd<0){ - perror( "Cannot open /dev/zero for READ+WRITE. Check permissions! error: " ); - return; + ldt_fs->fd = open("/dev/zero", O_RDWR); + if(ldt_fs->fd<0){ + perror( "Cannot open /dev/zero for READ+WRITE. Check permissions! error: "); + return NULL; } - fs_seg = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE, - fd, 0); - if(fs_seg==(void*)-1) +// fs_seg= + ldt_fs->fs_seg = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE, + ldt_fs->fd, 0); + if (ldt_fs->fs_seg == (void*)-1) { perror("ERROR: Couldn't allocate memory for fs segment"); - return; + close(ldt_fs->fd); + free(ldt_fs); + return NULL; } -// printf("fs seg %p\n", fs_seg); - *(void**)((char*)fs_seg+0x18) = fs_seg; - array.base_addr=(int)fs_seg; + *(void**)((char*)ldt_fs->fs_seg+0x18) = ldt_fs->fs_seg; + array.base_addr=(int)ldt_fs->fs_seg; array.entry_number=TEB_SEL_IDX; array.limit=array.base_addr+getpagesize()-1; array.seg_32bit=1; @@ -180,7 +192,8 @@ void Setup_LDT_Keeper(void) array.contents=MODIFY_LDT_CONTENTS_DATA; array.limit_in_pages=0; #ifdef __linux__ - ret=LDT_Modify(0x1, &array, sizeof(struct modify_ldt_ldt_s)); + //ret=LDT_Modify(0x1, &array, sizeof(struct modify_ldt_ldt_s)); + ret=modify_ldt(0x1, &array, sizeof(struct modify_ldt_ldt_s)); if(ret<0) { perror("install_fs"); @@ -200,7 +213,6 @@ void Setup_LDT_Keeper(void) printf("Couldn't install fs segment, expect segfault\n"); printf("Did you reconfigure the kernel with \"options USER_LDT\"?\n"); } - printf("Set_LDT\n"); } #endif /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ */ @@ -223,17 +235,20 @@ void Setup_LDT_Keeper(void) Setup_FS_Segment(); - prev_struct = (char*)malloc(sizeof(char) * 8); - *(void**)array.base_addr = prev_struct; - close(fd); + ldt_fs->prev_struct = (char*)malloc(sizeof(char) * 8); + *(void**)array.base_addr = ldt_fs->prev_struct; + + return ldt_fs; } -void Restore_LDT_Keeper(void) +void Restore_LDT_Keeper(ldt_fs_t* ldt_fs) { - if (fs_seg == 0) + if (ldt_fs == NULL || ldt_fs->fs_seg == 0) return; - if (prev_struct) - free(prev_struct); - munmap((char*)fs_seg, getpagesize()); - fs_seg = 0; + if (ldt_fs->prev_struct) + free(ldt_fs->prev_struct); + munmap((char*)ldt_fs->fs_seg, getpagesize()); + ldt_fs->fs_seg = 0; + close(ldt_fs->fd); + free(ldt_fs); } diff --git a/loader/ldt_keeper.h b/loader/ldt_keeper.h index eec7da298a..d36ebb892c 100644 --- a/loader/ldt_keeper.h +++ b/loader/ldt_keeper.h @@ -5,9 +5,16 @@ extern "C" { #endif + +typedef struct { + void* fs_seg; + char* prev_struct; + int fd; +} ldt_fs_t; + void Setup_FS_Segment(void); -void Setup_LDT_Keeper(void); -void Restore_LDT_Keeper(void); +ldt_fs_t* Setup_LDT_Keeper(void); +void Restore_LDT_Keeper(ldt_fs_t* ldt_fs); #ifdef __cplusplus } #endif diff --git a/loader/loader.h b/loader/loader.h index 8f5ffae9be..5599462bd3 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -8,16 +8,16 @@ #ifndef _LOADER_H #define _LOADER_H -#include -#include -#include -#include -#include + #ifdef __cplusplus extern "C" { #endif -extern char* win32_codec_name; // must be set before calling DrvOpen() !!! +#include "wine/windef.h" +#include "wine/driver.h" +#include "wine/mmreg.h" +#include "wine/vfw.h" +#include "wine/msacm.h" unsigned int _GetPrivateProfileIntA(const char* appname, const char* keyname, int default_value, const char* filename); int _GetPrivateProfileStringA(const char* appname, const char* keyname, @@ -25,261 +25,6 @@ int _GetPrivateProfileStringA(const char* appname, const char* keyname, 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); - INT WINAPI LoadStringA( HINSTANCE instance, UINT resource_id, LPSTR buffer, INT buflen ); diff --git a/loader/module.c b/loader/module.c index ec6ad7a078..b532c06def 100644 --- a/loader/module.c +++ b/loader/module.c @@ -16,32 +16,22 @@ #include -#include -#include -#include -#include -#include -#include +#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" #ifdef HAVE_LIBDL #include -#include +#include "wine/elfdll.h" #endif #include "win32.h" -#include "module.h" -//#include "driver.h" +#include "driver.h" //#undef TRACE //#define TRACE printf -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; modref_list* local_wm=NULL; @@ -217,7 +207,7 @@ static WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved ) //local_wm=wm; if(local_wm) { - local_wm->next=malloc(sizeof(modref_l