summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libw32dll/DirectShow/DS_VideoDecoder.c9
-rw-r--r--src/libw32dll/DirectShow/allocator.h3
-rw-r--r--src/libw32dll/DirectShow/inputpin.c2
-rw-r--r--src/libw32dll/DirectShow/inputpin.h2
-rw-r--r--src/libw32dll/DirectShow/outputpin.c39
-rw-r--r--src/libw32dll/DirectShow/outputpin.h14
-rw-r--r--src/libw32dll/w32codec.c30
-rw-r--r--src/libw32dll/wine/afl.c97
-rw-r--r--src/libw32dll/wine/com.h2
-rw-r--r--src/libw32dll/wine/driver.c3
-rw-r--r--src/libw32dll/wine/driver.h6
-rw-r--r--src/libw32dll/wine/ldt_keeper.c69
-rw-r--r--src/libw32dll/wine/ldt_keeper.h6
-rw-r--r--src/libw32dll/wine/mmreg.h230
-rw-r--r--src/libw32dll/wine/module.c6
-rw-r--r--src/libw32dll/wine/module.h63
-rw-r--r--src/libw32dll/wine/msacm.h3
-rw-r--r--src/libw32dll/wine/registry.c7
-rw-r--r--src/libw32dll/wine/stubs.s11
-rw-r--r--src/libw32dll/wine/vfw.h15
-rw-r--r--src/libw32dll/wine/win32.c510
-rw-r--r--src/libw32dll/wine/windef.h8
-rw-r--r--src/libw32dll/wine/wineacm.h25
-rw-r--r--src/libw32dll/wine/winnt.h4
24 files changed, 822 insertions, 342 deletions
diff --git a/src/libw32dll/DirectShow/DS_VideoDecoder.c b/src/libw32dll/DirectShow/DS_VideoDecoder.c
index faa080fef..33c51b4d2 100644
--- a/src/libw32dll/DirectShow/DS_VideoDecoder.c
+++ b/src/libw32dll/DirectShow/DS_VideoDecoder.c
@@ -106,10 +106,10 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD
bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ?
sizeof(BITMAPINFOHEADER) : format->biSize;
- bihs = sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER) + bihs;
this->iv.m_bh = (BITMAPINFOHEADER*)malloc(bihs);
memcpy(this->iv.m_bh, format, bihs);
+
this->iv.m_State = STOP;
//this->iv.m_pFrame = 0;
this->iv.m_Mode = DIRECT;
@@ -118,6 +118,7 @@ DS_VideoDecoder * DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEAD
this->iv.m_fQuality = 0.0f;
this->iv.m_bCapable16b = true;
+ bihs += sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER);
this->m_sVhdr = (VIDEOINFOHEADER*)malloc(bihs);
memset(this->m_sVhdr, 0, bihs);
memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize);
@@ -725,7 +726,7 @@ int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value)
{
if (this->m_bIsDivX4) {
IDivxFilterInterface* pIDivx=NULL;
- printf("DS_SetValue for DIVX4, name=%s value=%d\n",name,value);
+// printf("DS_SetValue for DIVX4, name=%s value=%d\n",name,value);
if (this->m_pDS_Filter->m_pFilter->vt->QueryInterface((IUnknown*)this->m_pDS_Filter->m_pFilter, &IID_IDivxFilterInterface, (void**)&pIDivx))
{
printf("No such interface\n");
@@ -764,7 +765,7 @@ int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value)
// get5=set4 19
// get6=set5 23
hidden = (IHidden*)((int)this->m_pDS_Filter->m_pFilter + 0xb8);
- printf("DS_SetValue for DIVX, name=%s value=%d\n",name,value);
+// printf("DS_SetValue for DIVX, name=%s value=%d\n",name,value);
if (strcmp(name, "Quality") == 0)
{
this->m_iLastQuality = value;
@@ -826,7 +827,7 @@ int DS_VideoDecoder_SetValue(DS_VideoDecoder *this, const char* name, int value)
return result;
}
#endif
- printf("DS_SetValue for ????, name=%s value=%d\n",name,value);
+// printf("DS_SetValue for ????, name=%s value=%d\n",name,value);
return 0;
}
/*
diff --git a/src/libw32dll/DirectShow/allocator.h b/src/libw32dll/DirectShow/allocator.h
index c8c62b2fc..855637063 100644
--- a/src/libw32dll/DirectShow/allocator.h
+++ b/src/libw32dll/DirectShow/allocator.h
@@ -27,7 +27,6 @@ struct _MemAllocator
void ( *ResetPointer )(MemAllocator* This);
};
-MemAllocator* MemAllocatorCreate(void);
-void MemAllocator_Destroy(MemAllocator* This);
+MemAllocator* MemAllocatorCreate();
#endif /* DS_ALLOCATOR_H */
diff --git a/src/libw32dll/DirectShow/inputpin.c b/src/libw32dll/DirectShow/inputpin.c
index 4e6f7fece..cde1df2ed 100644
--- a/src/libw32dll/DirectShow/inputpin.c
+++ b/src/libw32dll/DirectShow/inputpin.c
@@ -4,7 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
-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/src/libw32dll/DirectShow/inputpin.h b/src/libw32dll/DirectShow/inputpin.h
index 14c0992d6..1ad9a2d60 100644
--- a/src/libw32dll/DirectShow/inputpin.h
+++ b/src/libw32dll/DirectShow/inputpin.h
@@ -14,7 +14,7 @@ struct _CBaseFilter2
IPin* ( *GetPin )(CBaseFilter2* This);
};
-CBaseFilter2* CBaseFilter2Create(void);
+CBaseFilter2* CBaseFilter2Create();
typedef struct _CBaseFilter CBaseFilter;
diff --git a/src/libw32dll/DirectShow/outputpin.c b/src/libw32dll/DirectShow/outputpin.c
index 9763922b7..8ca12d792 100644
--- a/src/libw32dll/DirectShow/outputpin.c
+++ b/src/libw32dll/DirectShow/outputpin.c
@@ -10,14 +10,12 @@
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;
}
-/* In outputpin.h now *********
-******************************
typedef struct CEnumMediaTypes
{
IEnumMediaTypes_vt* vt;
@@ -25,7 +23,7 @@ typedef struct CEnumMediaTypes
AM_MEDIA_TYPE type;
GUID interfaces[2];
} CEnumMediaTypes;
-********************/
+
static HRESULT STDCALL CEnumMediaTypes_Next(IEnumMediaTypes * This,
/* [in] */ ULONG cMediaTypes,
@@ -60,8 +58,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)
@@ -216,8 +213,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,
@@ -233,15 +229,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,
@@ -258,26 +252,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,
@@ -353,8 +343,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,
@@ -397,14 +386,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/src/libw32dll/DirectShow/outputpin.h b/src/libw32dll/DirectShow/outputpin.h
index f95295e59..016b36787 100644
--- a/src/libw32dll/DirectShow/outputpin.h
+++ b/src/libw32dll/DirectShow/outputpin.h
@@ -33,18 +33,4 @@ struct _COutputPin
COutputPin* COutputPinCreate(const AM_MEDIA_TYPE* vhdr);
-typedef struct _CEnumMediaTypes CEnumMediaTypes;
-
-struct _CEnumMediaTypes
-{
- IEnumMediaTypes_vt* vt;
- DECLARE_IUNKNOWN();
- AM_MEDIA_TYPE type;
- GUID interfaces[2];
-} ;
-
-
-void CEnumMediaTypes_Destroy(CEnumMediaTypes* This);
-CEnumMediaTypes* CEnumMediaTypesCreate(const AM_MEDIA_TYPE* amt);
-
#endif /* DS_OUTPUTPIN_H */
diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c
index fa044499e..93787eeae 100644
--- a/src/libw32dll/w32codec.c
+++ b/src/libw32dll/w32codec.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: w32codec.c,v 1.81 2002/06/12 12:22:36 f1rmb Exp $
+ * $Id: w32codec.c,v 1.82 2002/06/21 01:44:17 miguelfreitas Exp $
*
* routines for using w32 codecs
* DirectShow support by Miguel Freitas (Nov/2001)
@@ -81,6 +81,12 @@ static GUID dvsd_clsid =
{0xAF, 0x79, 0x00, 0xAA, 0x00, 0xB6, 0x7A, 0x42}
};
+static GUID msmpeg4_clsid =
+{
+ 0x82CCd3E0, 0xF71A, 0x11D0,
+ { 0x9f, 0xe5, 0x00, 0x60, 0x97, 0x78, 0xea, 0x66}
+};
+
/* some data is shared inside wine loader.
* this mutex seems to avoid some segfaults
@@ -124,7 +130,7 @@ typedef struct w32v_decoder_s {
int stream_id;
int skipframes;
- LDT_FS *ldt_fs;
+ ldt_fs_t *ldt_fs;
} w32v_decoder_t;
typedef struct w32a_decoder_s {
@@ -156,7 +162,7 @@ typedef struct w32a_decoder_s {
GUID *guid;
DS_AudioDecoder *ds_dec;
- LDT_FS *ldt_fs;
+ ldt_fs_t *ldt_fs;
} w32a_decoder_t;
@@ -166,7 +172,7 @@ typedef struct w32a_decoder_s {
* the last of them to close both.
* hopefuly some day we will fix the wine loader to remove that.
*/
-#define SYNC_SHUTDOWN
+//#define SYNC_SHUTDOWN
#ifdef SYNC_SHUTDOWN
w32v_decoder_t *w32v_instance;
@@ -281,10 +287,17 @@ static char* get_vids_codec_name(w32v_decoder_t *this,
switch (buf_type) {
case BUF_VIDEO_MSMPEG4_V12:
/* Microsoft MPEG-4 v1/v2 */
+ /* old dll is disabled now due segfaults
+ * (using directshow instead)
this->yuv_supported=1;
this->yuv_hack_needed=1;
this->flipped=1;
return "mpg4c32.dll";
+ */
+ this->yuv_supported=1;
+ this->ds_driver = 1;
+ this->guid=&msmpeg4_clsid;
+ return "mpg4ds32.ax";
case BUF_VIDEO_MSMPEG4_V3:
/* Microsoft MPEG-4 v3 */
@@ -876,7 +889,9 @@ static void w32v_close (video_decoder_t *this_gen) {
if( this->ds_dec )
DS_VideoDecoder_Destroy(this->ds_dec);
}
+#ifdef SYNC_SHUTDOWN
w32v_instance = NULL;
+#endif
Restore_LDT_Keeper( this->ldt_fs );
}
pthread_mutex_unlock(&win32_codec_mutex);
@@ -1297,14 +1312,19 @@ static void w32a_close (audio_decoder_t *this_gen) {
#endif
{
if( !this->ds_driver ) {
- if( this->srcstream )
+ if( this->srcstream ) {
acmStreamClose(this->srcstream, 0);
+ this->srcstream = 0;
+ }
} else {
if( this->ds_dec )
DS_AudioDecoder_Destroy(this->ds_dec);
+ this->ds_dec = NULL;
}
+#ifdef SYNC_SHUTDOWN
w32a_instance = NULL;
+#endif
Restore_LDT_Keeper(this->ldt_fs);
}
pthread_mutex_unlock(&win32_codec_mutex);
diff --git a/src/libw32dll/wine/afl.c b/src/libw32dll/wine/afl.c
index e43c0ec02..693d152e3 100644
--- a/src/libw32dll/wine/afl.c
+++ b/src/libw32dll/wine/afl.c
@@ -21,6 +21,9 @@
***************************************************************************/
#include "config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include "winbase.h"
#include "windef.h"
@@ -33,19 +36,15 @@
#include "msacmdrv.h"
#include "wineacm.h"
#include "ext.h"
+
#include "driver.h"
-#include "debugtools.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#pragma pack(1)
#define OpenDriverA DrvOpen
#define CloseDriver DrvClose
-extern char *win32_codec_name;
+#pragma pack(1)
-static inline PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has)
+static PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has)
{
return (PWINE_ACMSTREAM)has;
}
@@ -74,7 +73,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, 0, hinstModule);
+ *phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, NULL, hinstModule);
/* FIXME: lParam, dwPriority and fdwAdd ignored */
@@ -191,7 +190,8 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
PWINE_ACMDRIVERID padid;
PWINE_ACMDRIVER pad;
ICOPEN icopen;
- HDRVR hdrv;
+ /* HDRVR hdrv; -- not used */
+
TRACE("(%p, %x, %08lu)\n", phad, hadid, fdwOpen);
@@ -207,8 +207,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
return MMSYSERR_INVALFLAG;
pad = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER));
- if (!pad)
- return MMSYSERR_NOMEM;
+ if (!pad) return MMSYSERR_NOMEM;
pad->obj.pACMDriverID = padid;
icopen.fccType = mmioFOURCC('a', 'u', 'd', 'c');
@@ -216,8 +215,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
icopen.dwSize = sizeof(ICOPEN);
icopen.dwFlags = 0;
- icopen.pV1Reserved = padid->pszFileName;
- if (!padid->hInstModule)
+ if (!padid->hInstModule)
pad->hDrvr = OpenDriverA((long)&icopen);
else
pad->hDrvr = padid->hInstModule;
@@ -226,7 +224,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 +233,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
/* FIXME: Create a WINE_ACMDRIVER32 */
*phad = (HACMDRIVER)pad;
-
+
return MMSYSERR_NOERROR;
}
@@ -269,19 +267,22 @@ PWINE_ACMDRIVERID MSACM_pLastACMDriverID = NULL;
/***********************************************************************
* MSACM_RegisterDriver32()
*/
-PWINE_ACMDRIVERID MSACM_RegisterDriver(const char* pszFileName,
- WORD wFormatTag,
+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", pszFileName, wFormatTag, hinstModule);
+ TRACE("('%s', '%x', 0x%08x)\n", pszDriverAlias, pszFileName, hinstModule);
padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
- padid->pszFileName = (char*)malloc(strlen(pszFileName)+1);
- strcpy(padid->pszFileName, pszFileName);
+ padid->pszDriverAlias = (char*)malloc(strlen(pszDriverAlias)+1);
+ strcpy(padid->pszDriverAlias, pszDriverAlias);
// 1~strdup(pszDriverAlias);
- padid->wFormatTag = wFormatTag;
+ padid->pszFileName = pszFileName;
padid->hInstModule = hinstModule;
padid->bEnabled = TRUE;
padid->pACMDriverList = NULL;
@@ -296,6 +297,23 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(const char* pszFileName,
return padid;
}
+/***********************************************************************
+ * MSACM_RegisterAllDrivers32()
+ */
+void MSACM_RegisterAllDrivers(void)
+{
+ /*LPSTR pszBuffer;
+ DWORD dwBufferLength; -- not used */
+
+ 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()
@@ -307,8 +325,10 @@ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
while (p->pACMDriverList)
acmDriverClose((HACMDRIVER) p->pACMDriverList, 0);
- if (p->pszFileName)
- free(p->pszFileName);
+ 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;
@@ -378,6 +398,8 @@ 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);
@@ -397,6 +419,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
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);
@@ -430,7 +453,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
goto errCleanUp;
} else {
PWINE_ACMDRIVERID wadi;
- short drv_tag;
+ /* short drv_tag; -- not used */
ret = ACMERR_NOTPOSSIBLE;
/* if(pwfxSrc->wFormatTag==1)//compression
drv_tag=pwfxDst->wFormatTag;
@@ -456,22 +479,10 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
}
}
acmDriverClose(had, 0L);*/
- //if(MSACM_pFirstACMDriverID==NULL)
- // MSACM_RegisterAllDrivers();
-
- for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID)
- {
- /* Check Format */
- if ((int)wadi->wFormatTag != (int)pwfxSrc->wFormatTag) continue;
- }
- if( !wadi )
- MSACM_RegisterDriver(win32_codec_name, (int)pwfxSrc->wFormatTag, 0);
+ if(MSACM_pFirstACMDriverID==NULL)
+ MSACM_RegisterAllDrivers();
- for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID)
- {
- /* Check Format */
- if ((int)wadi->wFormatTag != (int)pwfxSrc->wFormatTag) continue;
-
+ for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID) {
ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L);
if (ret == MMSYSERR_NOERROR) {
if ((wad = MSACM_GetDriver(had)) != 0) {
@@ -480,8 +491,6 @@ 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);
@@ -503,7 +512,6 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
if (phas)
*phas = (HACMSTREAM)was;
TRACE("=> (%d)\n", ret);
- CodecAlloc();
return ret;
}
errCleanUp:
@@ -530,7 +538,6 @@ 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;
@@ -547,7 +554,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/src/libw32dll/wine/com.h b/src/libw32dll/wine/com.h
index 4082b1350..84a667f0f 100644
--- a/src/libw32dll/wine/com.h
+++ b/src/libw32dll/wine/com.h
@@ -65,7 +65,7 @@ struct IClassFactory
struct IClassFactory_vt* vt;
};
-long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
+long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
long dwClsContext, GUID* riid, void** ppv);
#ifdef __cplusplus
diff --git a/src/libw32dll/wine/driver.c b/src/libw32dll/wine/driver.c
index 7b7c305ed..59ffdd768 100644
--- a/src/libw32dll/wine/driver.c
+++ b/src/libw32dll/wine/driver.c
@@ -9,7 +9,6 @@
#endif
#include "win32.h"
-#include "driver.h"
#include "pe_image.h"
#include "winreg.h"
#include "vfw.h"
@@ -131,7 +130,7 @@ DrvOpen(LPARAM lParam2)
char unknown[0x24];
// char* codec_name=icopen->fccHandler;
- //Setup_LDT_Keeper();
+ Setup_FS_Segment();
if (!(npDriver = DrvAlloc(&hDriver, &uDrvResult)))
return ((HDRVR) 0);
diff --git a/src/libw32dll/wine/driver.h b/src/libw32dll/wine/driver.h
index 545f99c2b..b491933df 100644
--- a/src/libw32dll/wine/driver.h
+++ b/src/libw32dll/wine/driver.h
@@ -113,12 +113,12 @@ DWORD WINAPI GetDriverFlags( HDRVR hDriver );
extern "C" {
#endif
-void SetCodecPath(const char* path);
void CodecAlloc(void);
void CodecRelease(void);
-HDRVR DrvOpen(LPARAM lParam2);
-void DrvClose(HDRVR hdrvr);
+#include "vfw.h"
+extern HDRVR VFWAPI DrvOpen(LPARAM lParam2);
+extern void DrvClose(HDRVR hdrvr);
#ifdef __cplusplus
}
diff --git a/src/libw32dll/wine/ldt_keeper.c b/src/libw32dll/wine/ldt_keeper.c
index fedf0033b..b7c611ddc 100644
--- a/src/libw32dll/wine/ldt_keeper.c
+++ b/src/libw32dll/wine/ldt_keeper.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: ldt_keeper.c,v 1.3 2001/11/08 21:39:04 miguelfreitas Exp $
+ * $Id: ldt_keeper.c,v 1.4 2002/06/21 01:44:17 miguelfreitas Exp $
*
*
* contents:
@@ -46,12 +46,14 @@
* 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 "winnt.h"
-*/
#include <string.h>
#include <stdlib.h>
@@ -65,9 +67,16 @@
#include <asm/unistd.h>
#include <asm/ldt.h>
/* 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 <machine/segments.h>
#include <machine/sysarch.h>
#endif
@@ -79,7 +88,7 @@ int modify_ldt(int func, void *ptr, unsigned long bytecount);
#ifdef __cplusplus
extern "C" {
#endif
-extern int sysi86(int, void*);
+int sysi86(int, void*);
#ifdef __cplusplus
}
#endif
@@ -88,7 +97,7 @@ extern int sysi86(int, void*);
#define NUMSYSLDTS 6 /* Let's hope the SunOS 5.8 value is OK */
#endif
-#define TEB_SEL_IDX NUMSYSLDTS
+#define TEB_SEL_IDX NUMSYSLDTS
#endif
#define LDT_ENTRIES 8192
@@ -123,14 +132,6 @@ struct modify_ldt_ldt_s {
#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.
- *
- */
-
-
-/**
* here is a small logical problem with Restore for multithreaded programs -
* in C++ we use static class for this...
*/
@@ -138,8 +139,6 @@ struct modify_ldt_ldt_s {
#ifdef __cplusplus
extern "C"
#endif
-
-
void Setup_FS_Segment(void)
{
__asm__ __volatile__(
@@ -154,6 +153,8 @@ __ASM_GLOBAL_FUNC( __set_fs, "movl 4(%esp),%eax\n\tmovw %ax,%fs\n\tret" )
/* 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 */
static int LDT_Modify( int func, struct modify_ldt_ldt_s *ptr,
unsigned long count )
{
@@ -201,22 +202,30 @@ static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt
}
#endif
-LDT_FS * Setup_LDT_Keeper(void)
+ldt_fs_t* Setup_LDT_Keeper(void)
{
struct modify_ldt_ldt_s array;
int ret;
- LDT_FS *ldt_fs;
-
- ldt_fs = malloc( sizeof( LDT_FS ) );
-
+ ldt_fs_t* ldt_fs = (ldt_fs_t*) malloc(sizeof(ldt_fs_t));
+
+ if (!ldt_fs)
+ return NULL;
+
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;
+ }
ldt_fs->fs_seg = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE,
- ldt_fs->fd, 0);
- if(ldt_fs->fs_seg==(void*)-1)
+ ldt_fs->fd, 0);
+ if (ldt_fs->fs_seg == (void*)-1)
{
perror("ERROR: Couldn't allocate memory for fs segment");
+ close(ldt_fs->fd);
+ free(ldt_fs);
return NULL;
}
+ *(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;
@@ -226,6 +235,7 @@ LDT_FS * 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=modify_ldt(0x1, &array, sizeof(struct modify_ldt_ldt_s));
if(ret<0)
{
@@ -271,21 +281,18 @@ LDT_FS * Setup_LDT_Keeper(void)
ldt_fs->prev_struct = (char*)malloc(sizeof(char) * 8);
*(void**)array.base_addr = ldt_fs->prev_struct;
-
+
return ldt_fs;
}
-void Restore_LDT_Keeper(LDT_FS *ldt_fs)
+void Restore_LDT_Keeper(ldt_fs_t* ldt_fs)
{
- if (ldt_fs == NULL)
- return;
- if (ldt_fs->fs_seg == 0)
+ if (ldt_fs == NULL || ldt_fs->fs_seg == 0)
return;
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 );
+ free(ldt_fs);
}
diff --git a/src/libw32dll/wine/ldt_keeper.h b/src/libw32dll/wine/ldt_keeper.h
index 451fba4fe..d36ebb892 100644
--- a/src/libw32dll/wine/ldt_keeper.h
+++ b/src/libw32dll/wine/ldt_keeper.h
@@ -10,11 +10,11 @@ typedef struct {
void* fs_seg;
char* prev_struct;
int fd;
-} LDT_FS;
+} ldt_fs_t;
void Setup_FS_Segment(void);
-LDT_FS * Setup_LDT_Keeper(void);
-void Restore_LDT_Keeper(LDT_FS * ldt_fs);
+ldt_fs_t* Setup_LDT_Keeper(void);
+void Restore_LDT_Keeper(ldt_fs_t* ldt_fs);
#ifdef __cplusplus
}
#endif
diff --git a/src/libw32dll/wine/mmreg.h b/src/libw32dll/wine/mmreg.h
index 74e26250d..e59ae0a47 100644
--- a/src/libw32dll/wine/mmreg.h
+++ b/src/libw32dll/wine/mmreg.h
@@ -17,7 +17,7 @@
#define WAVE_FILTER_UNKNOWN 0x0000
#define WAVE_FILTER_DEVELOPMENT 0xFFFF
-typedef struct _WAVEFILTER {
+typedef struct __attribute__((__packed__)) _WAVEFILTER {
DWORD cbStruct;
DWORD dwFilterTag;
DWORD fdwFilter;
@@ -28,7 +28,7 @@ typedef struct _WAVEFILTER {
#ifndef WAVE_FILTER_VOLUME
#define WAVE_FILTER_VOLUME 0x0001
-typedef struct _WAVEFILTER_VOLUME {
+typedef struct __attribute__((__packed__)) _WAVEFILTER_VOLUME {
WAVEFILTER wfltr;
DWORD dwVolume;
} VOLUMEWAVEFILTER, *PVOLUMEWAVEFILTER, *NPVOLUMEWAVEFILTER, *LPVOLUMEWAVEFILTER;
@@ -37,7 +37,7 @@ typedef struct _WAVEFILTER_VOLUME {
#ifndef WAVE_FILTER_ECHO
#define WAVE_FILTER_ECHO 0x0002
-typedef struct WAVEFILTER_ECHO {
+typedef struct __attribute__((__packed__)) WAVEFILTER_ECHO {
WAVEFILTER wfltr;
DWORD dwVolume;
DWORD dwDelay;
@@ -46,7 +46,7 @@ typedef struct WAVEFILTER_ECHO {
#ifndef _WAVEFORMATEX_
#define _WAVEFORMATEX_
-typedef struct _WAVEFORMATEX {
+typedef struct __attribute__((__packed__)) _WAVEFORMATEX {
WORD wFormatTag;
WORD nChannels;
DWORD nSamplesPerSec;
@@ -57,48 +57,186 @@ typedef struct _WAVEFORMATEX {
} WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
#endif /* _WAVEFORMATEX_ */
+#ifndef GUID_TYPE
+#define GUID_TYPE
+typedef struct
+{
+ unsigned long f1;
+ unsigned short f2;
+ unsigned short f3;
+ unsigned char f4[8];
+} GUID;
+#endif
+
+#ifndef _WAVEFORMATEXTENSIBLE_
+#define _WAVEFORMATEXTENSIBLE_
+typedef struct {
+ WAVEFORMATEX Format;
+ union {
+ WORD wValidBitsPerSample; /* bits of precision */
+ WORD wSamplesPerBlock; /* valid if wBitsPerSample==0 */
+ WORD wReserved; /* If neither applies, set to zero. */
+ } Samples;
+ DWORD dwChannelMask; /* which channels are */
+ /* present in stream */
+ GUID SubFormat;
+} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
+#endif // !_WAVEFORMATEXTENSIBLE_
+
+typedef struct mpeglayer3waveformat_tag {
+ WORD wFormatTag WINE_PACKED;
+ WORD nChannels WINE_PACKED;
+ DWORD nSamplesPerSec WINE_PACKED;
+ DWORD nAvgBytesPerSec WINE_PACKED;
+ WORD nBlockAlign WINE_PACKED;
+ WORD wBitsPerSample WINE_PACKED;
+ WORD cbSize WINE_PACKED;
+ WORD wID WINE_PACKED;
+ DWORD fdwFlags WINE_PACKED;
+ WORD nBlockSize WINE_PACKED;
+ WORD nFramesPerBlock WINE_PACKED;
+ WORD nCodecDelay WINE_PACKED;
+} MPEGLAYER3WAVEFORMAT;
+
/* 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)
+
+#define WAVE_FORMAT_UNKNOWN 0x0000 /* Microsoft Corporation */
+#define WAVE_FORMAT_ADPCM 0x0002 /* Microsoft Corporation */
+#define WAVE_FORMAT_IEEE_FLOAT 0x0003 /* Microsoft Corporation */
+#define WAVE_FORMAT_VSELP 0x0004 /* Compaq Computer Corp. */
+#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_DTS 0x0008 /* 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_MEDIAVISION_ADPCM 0x0018 /* Media Vision, Inc. */
+#define WAVE_FORMAT_CU_CODEC 0x0019 /* Hewlett-Packard Company */
+#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 /* Virtual Music, Inc. */
+#define WAVE_FORMAT_APTX 0x0025 /* Audio Processing Technology */
+#define WAVE_FORMAT_AUDIOFILE_AF10 0x0026 /* Virtual Music, Inc. */
+#define WAVE_FORMAT_PROSODY_1612 0x0027 /* Aculab plc */
+#define WAVE_FORMAT_LRC 0x0028 /* Merging Technologies S.A. */
+#define WAVE_FORMAT_DOLBY_AC2 0x0030 /* Dolby Laboratories */
+#define WAVE_FORMAT_GSM610 0x0031 /* Microsoft Corporation */
+#define WAVE_FORMAT_MSNAUDIO 0x0032 /* 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_CS_IMAADPCM 0x0039 /* Crystal Semiconductor IMA ADPCM */
+#define WAVE_FORMAT_ECHOSC3 0x003A /* Echo Speech Corporation */
+#define WAVE_FORMAT_ROCKWELL_ADPCM 0x003B /* Rockwell International */
+#define WAVE_FORMAT_ROCKWELL_DIGITALK 0x003C /* Rockwell International */
+#define WAVE_FORMAT_XEBEC 0x003D /* Xebec Multimedia Solutions Limited */
+#define WAVE_FORMAT_G721_ADPCM 0x0040 /* Antex Electronics Corporation */
+#define WAVE_FORMAT_G728_CELP 0x0041 /* Antex Electronics Corporation */
+#define WAVE_FORMAT_MSG723 0x0042 /* Microsoft Corporation */
+#define WAVE_FORMAT_MPEG 0x0050 /* Microsoft Corporation */
+#define WAVE_FORMAT_RT24 0x0052 /* InSoft, Inc. */
+#define WAVE_FORMAT_PAC 0x0053 /* InSoft, Inc. */
+#define WAVE_FORMAT_MPEGLAYER3 0x0055 /* ISO/MPEG Layer3 Format Tag */
+#define WAVE_FORMAT_LUCENT_G723 0x0059 /* Lucent Technologies */
+#define WAVE_FORMAT_CIRRUS 0x0060 /* Cirrus Logic */
+#define WAVE_FORMAT_ESPCM 0x0061 /* ESS Technology */
+#define WAVE_FORMAT_VOXWARE 0x0062 /* Voxware Inc */
+#define WAVE_FORMAT_CANOPUS_ATRAC 0x0063 /* Canopus, co., Ltd. */
+#define WAVE_FORMAT_G726_ADPCM 0x0064 /* APICOM */
+#define WAVE_FORMAT_G722_ADPCM 0x0065 /* APICOM */
+#define WAVE_FORMAT_DSAT_DISPLAY 0x0067 /* Microsoft Corporation */
+#define WAVE_FORMAT_VOXWARE_BYTE_ALIGNED 0x0069 /* Voxware Inc */
+#define WAVE_FORMAT_VOXWARE_AC8 0x0070 /* Voxware Inc */
+#define WAVE_FORMAT_VOXWARE_AC10 0x0071 /* Voxware Inc */
+#define WAVE_FORMAT_VOXWARE_AC16 0x0072 /* Voxware Inc */
+#define WAVE_FORMAT_VOXWARE_AC20 0x0073 /* Voxware Inc */
+#define WAVE_FORMAT_VOXWARE_RT24 0x0074 /* Voxware Inc */
+#define WAVE_FORMAT_VOXWARE_RT29 0x0075 /* Voxware Inc */
+#define WAVE_FORMAT_VOXWARE_RT29HW 0x0076 /* Voxware Inc */
+#define WAVE_FORMAT_VOXWARE_VR12 0x0077 /* Voxware Inc */
+#define WAVE_FORMAT_VOXWARE_VR18 0x0078 /* Voxware Inc */
+#define WAVE_FORMAT_VOXWARE_TQ40 0x0079 /* Voxware Inc */
+#define WAVE_FORMAT_SOFTSOUND 0x0080 /* Softsound, Ltd. */
+#define WAVE_FORMAT_VOXWARE_TQ60 0x0081 /* Voxware Inc */
+#define WAVE_FORMAT_MSRT24 0x0082 /* Microsoft Corporation */
+#define WAVE_FORMAT_G729A 0x0083 /* AT&T Labs, Inc. */
+#define WAVE_FORMAT_MVI_MVI2 0x0084 /* Motion Pixels */
+#define WAVE_FORMAT_DF_G726 0x0085 /* DataFusion Systems (Pty) (Ltd) */
+#define WAVE_FORMAT_DF_GSM610 0x0086 /* DataFusion Systems (Pty) (Ltd) */
+#define WAVE_FORMAT_ISIAUDIO 0x0088 /* Iterated Systems, Inc. */
+#define WAVE_FORMAT_ONLIVE 0x0089 /* OnLive! Technologies, Inc. */
+#define WAVE_FORMAT_SBC24 0x0091 /* Siemens Business Communications Sys */
+#define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 /* Sonic Foundry */
+#define WAVE_FORMAT_MEDIASONIC_G723 0x0093 /* MediaSonic */
+#define WAVE_FORMAT_PROSODY_8KBPS 0x0094 /* Aculab plc */
+#define WAVE_FORMAT_ZYXEL_ADPCM 0x0097 /* ZyXEL Communications, Inc. */
+#define WAVE_FORMAT_PHILIPS_LPCBB 0x0098 /* Philips Speech Processing */
+#define WAVE_FORMAT_PACKED 0x0099 /* Studer Professional Audio AG */
+#define WAVE_FORMAT_MALDEN_PHONYTALK 0x00A0 /* Malden Electronics Ltd. */
+#define WAVE_FORMAT_RHETOREX_ADPCM 0x0100 /* Rhetorex Inc. */
+#define WAVE_FORMAT_IRAT 0x0101 /* BeCubed Software Inc. */
+#define WAVE_FORMAT_VIVO_G723 0x0111 /* Vivo Software */
+#define WAVE_FORMAT_VIVO_SIREN 0x0112 /* Vivo Software */
+#define WAVE_FORMAT_DIGITAL_G723 0x0123 /* Digital Equipment Corporation */
+#define WAVE_FORMAT_SANYO_LD_ADPCM 0x0125 /* Sanyo Electric Co., Ltd. */
+#define WAVE_FORMAT_SIPROLAB_ACEPLNET 0x0130 /* Sipro Lab Telecom Inc. */
+#define WAVE_FORMAT_SIPROLAB_ACELP4800 0x0131 /* Sipro Lab Telecom Inc. */
+#define WAVE_FORMAT_SIPROLAB_ACELP8V3 0x0132 /* Sipro Lab Telecom Inc. */
+#define WAVE_FORMAT_SIPROLAB_G729 0x0133 /* Sipro Lab Telecom Inc. */
+#define WAVE_FORMAT_SIPROLAB_G729A 0x0134 /* Sipro Lab Telecom Inc. */
+#define WAVE_FORMAT_SIPROLAB_KELVIN 0x0135 /* Sipro Lab Telecom Inc. */
+#define WAVE_FORMAT_G726ADPCM 0x0140 /* Dictaphone Corporation */
+#define WAVE_FORMAT_QUALCOMM_PUREVOICE 0x0150 /* Qualcomm, Inc. */
+#define WAVE_FORMAT_QUALCOMM_HALFRATE 0x0151 /* Qualcomm, Inc. */
+#define WAVE_FORMAT_TUBGSM 0x0155 /* Ring Zero Systems, Inc. */
+#define WAVE_FORMAT_MSAUDIO1 0x0160 /* 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_UHER_ADPCM 0x0210 /* UHER informatic GmbH */
+#define WAVE_FORMAT_QUARTERDECK 0x0220 /* Quarterdeck Corporation */
+#define WAVE_FORMAT_ILINK_VC 0x0230 /* I-link Worldwide */
+#define WAVE_FORMAT_RAW_SPORT 0x0240 /* Aureal Semiconductor */
+#define WAVE_FORMAT_IPI_HSX 0x0250 /* Interactive Products, Inc. */
+#define WAVE_FORMAT_IPI_RPELP 0x0251 /* Interactive Products, Inc. */
+#define WAVE_FORMAT_CS2 0x0260 /* Consistent Software */
+#define WAVE_FORMAT_SONY_SCX 0x0270 /* Sony Corp. */
+#define WAVE_FORMAT_FM_TOWNS_SND 0x0300 /* Fujitsu Corp. */
+#define WAVE_FORMAT_BTV_DIGITAL 0x0400 /* Brooktree Corporation */
+#define WAVE_FORMAT_QDESIGN_MUSIC 0x0450 /* QDesign Corporation */
+#define WAVE_FORMAT_VME_VMPCM 0x0680 /* AT&T Labs, Inc. */
+#define WAVE_FORMAT_TPC 0x0681 /* AT&T Labs, Inc. */
+#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_LH_CODEC 0x1100 /* Lernout & Hauspie */
+#define WAVE_FORMAT_NORRIS 0x1400 /* Norris Communications, Inc. */
+#define WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS 0x1500 /* AT&T Labs, Inc. */
+#define WAVE_FORMAT_DVM 0x2000 /* FAST Multimedia AG */
+
+#if !defined(WAVE_FORMAT_EXTENSIBLE)
+#define WAVE_FORMAT_EXTENSIBLE 0xFFFE /* Microsoft */
+#endif // !defined(WAVE_FORMAT_EXTENSIBLE)
+//
+// the WAVE_FORMAT_DEVELOPMENT format tag can be used during the
+// development phase of a new wave format. Before shipping, you MUST
+// acquire an official format tag from Microsoft.
+//
+#define WAVE_FORMAT_DEVELOPMENT (0xFFFF)
+
#endif /* __WINE_MMREG_H */
diff --git a/src/libw32dll/wine/module.c b/src/libw32dll/wine/module.c
index 1f0cc923a..f7bee81d6 100644
--- a/src/libw32dll/wine/module.c
+++ b/src/libw32dll/wine/module.c
@@ -193,7 +193,7 @@ static WIN_BOOL MODULE_InitDll( WINE_MODREF *wm, DWORD type, LPVOID lpReserved )
static WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved )
{
WIN_BOOL retv = TRUE;
- int i;
+ /* int i; -- not used */
assert( wm );
/* prevent infinite recursion in case of cyclical dependencies */
@@ -254,7 +254,7 @@ static WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved )
static void MODULE_DllProcessDetach( WINE_MODREF* wm, WIN_BOOL bForceDetach, LPVOID lpReserved )
{
// WINE_MODREF *wm=local_wm;
- modref_list* l = local_wm;
+ /* modref_list* l = local_wm; -- not used */
wm->flags &= ~WINE_MODREF_PROCESS_ATTACHED;
MODULE_InitDll( wm, DLL_PROCESS_DETACH, lpReserved );
/* while (l)
@@ -281,7 +281,7 @@ static WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD fl
{
DWORD err = GetLastError();
WINE_MODREF *pwm;
- int i;
+ /* int i; -- not used */
// module_loadorder_t *plo;
SetLastError( ERROR_FILE_NOT_FOUND );
diff --git a/src/libw32dll/wine/module.h b/src/libw32dll/wine/module.h
index 4dc0c2b36..91e94b122 100644
--- a/src/libw32dll/wine/module.h
+++ b/src/libw32dll/wine/module.h
@@ -8,11 +8,9 @@
#define __WINE_MODULE_H
#include "windef.h"
-//#include "dosexe.h"
#include "pe_image.h"
-
typedef struct {
BYTE type;
BYTE flags;
@@ -133,70 +131,9 @@ typedef struct resource_nameinfo_s NE_NAMEINFO;
/* module.c */
extern FARPROC MODULE_GetProcAddress( HMODULE hModule, LPCSTR function, WIN_BOOL snoop );
extern WINE_MODREF *MODULE32_LookupHMODULE( HMODULE hModule );
-/* This is static */
-/* extern WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved ); */
-/* This is static */
-/* extern void MODULE_DllProcessDetach( WINE_MODREF *wm, WIN_BOOL bForceDetach, LPVOID lpReserved ); */
-extern void MODULE_DllThreadAttach( LPVOID lpReserved );
-extern void MODULE_DllThreadDetach( LPVOID lpReserved );
-/* This is static */
-/* extern WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags ); */
-/* This is static */
-/* 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/src/libw32dll/wine/msacm.h b/src/libw32dll/wine/msacm.h
index b1204f974..b76c1095a 100644
--- a/src/libw32dll/wine/msacm.h
+++ b/src/libw32dll/wine/msacm.h
@@ -5,8 +5,6 @@
#ifndef __WINE_MSACM_H
#define __WINE_MSACM_H
-#define D_MSACM 1
-
#include "windef.h"
#include "driver.h"
#include "mmreg.h"
@@ -933,6 +931,7 @@ MMRESULT WINAPI acmStreamSize(
MMRESULT WINAPI acmStreamUnprepareHeader(
HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwUnprepare
);
+void MSACM_RegisterAllDrivers(void);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/libw32dll/wine/registry.c b/src/libw32dll/wine/registry.c
index 48ffec1a0..c8495d453 100644
--- a/src/libw32dll/wine/registry.c
+++ b/src/libw32dll/wine/registry.c
@@ -18,11 +18,12 @@
//#undef TRACE
//#define TRACE printf
-// ...can be set before init_registry() call
-char* regpathname = 0;
+extern char *get_path ( char * );
+// ...can be set before init_registry() call
+char* regpathname = NULL;
-static char* localregpathname = 0;
+static char* localregpathname = NULL;
typedef struct reg_handle_s
{
diff --git a/src/libw32dll/wine/stubs.s b/src/libw32dll/wine/stubs.s
index d2ca31259..6aa90ee9d 100644
--- a/src/libw32dll/wine/stubs.s
+++ b/src/libw32dll/wine/stubs.s
@@ -22,3 +22,14 @@ unk_exp1:
xorl %eax,%eax
leave
ret
+.globl exp_EH_prolog
+exp_EH_prolog:
+ pushl $0xff
+ pushl %eax
+ pushl %fs:0
+ movl %esp, %fs:0
+ movl 12(%esp), %eax
+ movl %ebp, 12(%esp)
+ leal 12(%esp), %ebp
+ pushl %eax
+ ret
diff --git a/src/libw32dll/wine/vfw.h b/src/libw32dll/wine/vfw.h
index 37983db3d..7889a1822 100644
--- a/src/libw32dll/wine/vfw.h
+++ b/src/libw32dll/wine/vfw.h
@@ -1,13 +1,12 @@
#ifndef __WINE_VFW_H
#define __WINE_VFW_H
-#define D_VFW 1
//#include "pshpack1.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __WINE_WINGDI_H
-typedef struct
+typedef struct __attribute__((__packed__))
{
short bfType;
long bfSize;
@@ -18,7 +17,7 @@ typedef struct
#ifndef _BITMAPINFOHEADER_
#define _BITMAPINFOHEADER_
-typedef struct
+typedef struct __attribute__((__packed__))
{
long biSize;
long biWidth;
@@ -215,10 +214,10 @@ typedef struct {
} ICCOMPRESS;
long VFWAPIV ICCompress(
- HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpData,
- LPBITMAPINFOHEADER lpbiInput,void* lpBits,long* lpckid,
+ HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiOutput,void* lpOutputBuf,
+ LPBITMAPINFOHEADER lpbiInput,void* lpImage,long* lpckid,
long* lpdwFlags,long lFrameNum,long dwFrameSize,long dwQuality,
- LPBITMAPINFOHEADER lpbiPrev,void* lpPrev
+ LPBITMAPINFOHEADER lpbiInputPrev,void* lpImagePrev
);
@@ -381,9 +380,7 @@ typedef struct {
long VFWAPIV ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits);
-
long VFWAPIV ICDecompressEx(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits);
-
long VFWAPIV ICUniversalEx(HIC hic,int command,LPBITMAPINFOHEADER lpbiFormat,LPBITMAPINFOHEADER lpbi);
@@ -410,7 +407,7 @@ long VFWAPIV ICUniversalEx(HIC hic,int command,LPBITMAPINFOHEADER lpbiFormat,LPB
hic,ICM_DECOMPRESSEX_QUERY, (lpbiInput), \
(lpbiOutput) \
)
-
+
#define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput) \
((long)ICSendMessage( \
hic,ICM_DECOMPRESS_GET_FORMAT, (long)(void*)(lpbiInput), \
diff --git a/src/libw32dll/wine/win32.c b/src/libw32dll/wine/win32.c
index 4d671a15b..a6a5f7e17 100644
--- a/src/libw32dll/wine/win32.c
+++ b/src/libw32dll/wine/win32.c
@@ -187,17 +187,16 @@ static inline void dbgprintf(char* fmt, ...)
va_end(va);
}
#endif
-#if 0
-// al3x: it break divx audio. btw it should be if(verbose>2){ ... } anyway...
-// #ifdef MPLAYER
+#undef MPLAYER
+#ifdef MPLAYER
#include "../mp_msg.h"
+ if (verbose > 2)
{
- char buf[1024];
va_list va;
-
- va_start(va, fmt);
- vsnprintf((char *)&buf[0], 1023, fmt, va);
- mp_dbg(MSGT_WIN32, MSGL_DBG3, (char *)&buf[0]);
+
+ va_start(va, fmt);
+// vprintf(fmt, va);
+ mp_dbg(MSGT_WIN32, MSGL_DBG3, fmt, va);
va_end(va);
}
#endif
@@ -336,6 +335,7 @@ struct CRITSECT
pthread_t id;
pthread_mutex_t mutex;
int locked;
+ long deadbeef;
};
void* mreq_private(int size, int to_zero, int type);
@@ -407,6 +407,7 @@ int my_release(void* memory)
break;
default:
//memset(memory, 0xcc, header->size);
+ ;
}
header->deadbeef = 0;
@@ -444,17 +445,19 @@ inline void* my_mreq(int size, int to_zero)
return mreq_private(size, to_zero, AREATYPE_CLIENT);
}
-static inline int my_size(void* memory)
+static /*inline*/ int my_size(void* memory)
{
+ if(!memory) return 0;
return ((alloc_header*)memory)[-1].size;
}
static void* my_realloc(void* memory, int size)
{
void *ans = memory;
- int osize = my_size(memory);
+ int osize;
if (memory == NULL)
return my_mreq(size, 0);
+ osize = my_size(memory);
if (osize < size)
{
ans = my_mreq(size, 0);
@@ -506,6 +509,7 @@ static HMODULE WINAPI expGetDriverModuleHandle(DRVR* pdrv)
}
#define MODULE_HANDLE_kernel32 ((HMODULE)0x120)
+#define MODULE_HANDLE_user32 ((HMODULE)0x121)
static HMODULE WINAPI expGetModuleHandleA(const char* name)
{
@@ -781,12 +785,20 @@ static void* WINAPI expWaitForSingleObject(void* object, int duration)
return (void *)ret;
}
+static int pf_set = 0;
static BYTE PF[64] = {0,};
+static void WINAPI expGetSystemInfo(SYSTEM_INFO* si); /* forward declaration */
+
static WIN_BOOL WINAPI expIsProcessorFeaturePresent(DWORD v)
{
WIN_BOOL result;
if(v>63)result=0;
+ if (!pf_set)
+ {
+ SYSTEM_INFO si;
+ expGetSystemInfo(&si);
+ }
else result=PF[v];
dbgprintf("IsProcessorFeaturePresent(0x%x) => 0x%x\n", v, result);
return result;
@@ -811,9 +823,7 @@ static void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
/* FIXME: better values for the two entries below... */
static int cache = 0;
static SYSTEM_INFO cachedsi;
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__)
unsigned int regs[4];
-#endif
dbgprintf("GetSystemInfo(%p) =>\n", si);
if (cache) {
@@ -822,6 +832,7 @@ static void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
return;
}
memset(PF,0,sizeof(PF));
+ pf_set = 1;
cachedsi.u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL;
cachedsi.dwPageSize = getpagesize();
@@ -1092,17 +1103,17 @@ static long WINAPI expHeapDestroy(void* heap)
return 1;
}
-static long WINAPI expHeapFree(int arg1, int arg2, void* ptr)
+static long WINAPI expHeapFree(HANDLE heap, DWORD dwFlags, LPVOID lpMem)
{
- dbgprintf("HeapFree(0x%x, 0x%x, pointer 0x%x) => 1\n", arg1, arg2, ptr);
- if (heapfreehack != ptr && ptr != (void*)0xffffffff)
- my_release(ptr);
+ dbgprintf("HeapFree(0x%x, 0x%x, pointer 0x%x) => 1\n", heap, dwFlags, lpMem);
+ if (heapfreehack != lpMem && lpMem != (void*)0xffffffff)
+ my_release(lpMem);
else
{
if (!heapfreehackshown++)
- printf("Info: HeapFree deallocating same memory twice! (%p)\n", ptr);
+ printf("Info: HeapFree deallocating same memory twice! (%p)\n", lpMem);
}
- heapfreehack = ptr;
+ heapfreehack = lpMem;
return 1;
}
static long WINAPI expHeapSize(int heap, int flags, void* pointer)
@@ -1208,8 +1219,8 @@ static void WINAPI expInitializeCriticalSection(CRITICAL_SECTION* c)
printf("InitializeCriticalSection(%p) - no more space in list\n", c);
return;
}
- printf("got unused space at %d\n", i);
- cs = expmalloc(sizeof(struct CRITSECT));
+ dbgprintf("got unused space at %d\n", i);
+ cs = malloc(sizeof(struct CRITSECT));
if (!cs)
{
printf("InitializeCriticalSection(%p) - out of memory\n", c);
@@ -1224,10 +1235,12 @@ static void WINAPI expInitializeCriticalSection(CRITICAL_SECTION* c)
}
#else
{
- struct CRITSECT* cs = mreq_private(sizeof(struct CRITSECT), 0, AREATYPE_CRITSECT);
+ struct CRITSECT* cs = mreq_private(sizeof(struct CRITSECT) + sizeof(CRITICAL_SECTION),
+ 0, AREATYPE_CRITSECT);
pthread_mutex_init(&cs->mutex, NULL);
cs->locked=0;
- *(void**)c = cs;
+ cs->deadbeef = 0xdeadbeef;
+ *(void**)c = cs + 1;
}
#endif
return;
@@ -1238,17 +1251,18 @@ static void WINAPI expEnterCriticalSection(CRITICAL_SECTION* c)
#ifdef CRITSECS_NEWTYPE
struct CRITSECT* cs = critsecs_get_unix(c);
#else
- struct CRITSECT* cs=*(struct CRITSECT**)c;
+ struct CRITSECT* cs = (*(struct CRITSECT**)c) - 1;
+
#endif
- dbgprintf("EnterCriticalSection(0x%x)\n",c);
+ dbgprintf("EnterCriticalSection(0x%x) %p maso:0x%x\n",c, cs, cs->deadbeef);
if (!cs)
{
- printf("entered uninitialized critisec!\n");
+ dbgprintf("entered uninitialized critisec!\n");
expInitializeCriticalSection(c);
#ifdef CRITSECS_NEWTYPE
cs=critsecs_get_unix(c);
#else
- cs=*(struct CRITSECT**)c;
+ cs = (*(struct CRITSECT**)c) - 1;
#endif
printf("Win32 Warning: Accessed uninitialized Critical Section (%p)!\n", c);
}
@@ -1265,13 +1279,13 @@ static void WINAPI expLeaveCriticalSection(CRITICAL_SECTION* c)
#ifdef CRITSECS_NEWTYPE
struct CRITSECT* cs = critsecs_get_unix(c);
#else
- struct CRITSECT* cs=*(struct CRITSECT**)c;
+ struct CRITSECT* cs = (*(struct CRITSECT**)c) - 1;
#endif
// struct CRITSECT* cs=(struct CRITSECT*)c;
- dbgprintf("LeaveCriticalSection(0x%x)\n",c);
+ dbgprintf("LeaveCriticalSection(0x%x) 0x%x\n",c, cs->deadbeef);
if (!cs)
{
- printf("Win32 Warning: Leaving noninitialized Critical Section %p!!\n", c);
+ printf("Win32 Warning: Leaving uninitialized Critical Section %p!!\n", c);
return;
}
cs->locked=0;
@@ -1283,7 +1297,7 @@ static void WINAPI expDeleteCriticalSection(CRITICAL_SECTION *c)
#ifdef CRITSECS_NEWTYPE
struct CRITSECT* cs = critsecs_get_unix(c);
#else
- struct CRITSECT* cs=*(struct CRITSECT**)c;
+ struct CRITSECT* cs= (*(struct CRITSECT**)c) - 1;
#endif
// struct CRITSECT* cs=(struct CRITSECT*)c;
dbgprintf("DeleteCriticalSection(0x%x)\n",c);
@@ -1337,31 +1351,35 @@ static int WINAPI expTlsAlloc()
if(tls_use_map[i]==0)
{
tls_use_map[i]=1;
+ dbgprintf("TlsAlloc() => %d\n",i);
return i;
}
+ dbgprintf("TlsAlloc() => -1 (ERROR)\n");
return -1;
}
-static int WINAPI expTlsSetValue(void idx, void* value)
+static int WINAPI expTlsSetValue(DWORD index, void* value)
{
- int index = (int) idx;
- if((index<0) || (index>64))
+ dbgprintf("TlsSetValue(%d,%p)\n",index,value);
+// if((index<0) || (index>64))
+ if((index>=64))
return 0;
*(void**)((char*)fs_seg+0x88+4*index) = value;
return 1;
}
-static void* WINAPI expTlsGetValue(int idx)
+static void* WINAPI expTlsGetValue(DWORD index)
{
- int index = (int) idx;
- if((index<0) || (index>64))
- return 0;
- return *(void**)((char*)fs_seg+0x88+index);
+ dbgprintf("TlsGetValue(%d)\n",index);
+// if((index<0) || (index>64))
+ if((index>=64)) return NULL;
+ return *(void**)((char*)fs_seg+0x88+4*index);
}
static int WINAPI expTlsFree(int idx)
{
int index = (int) idx;
+ dbgprintf("TlsFree(%d)\n",index);
if((index<0) || (index>64))
return 0;
tls_use_map[index]=0;
@@ -1589,7 +1607,7 @@ static long WINAPI expGetVersionExA(OSVERSIONINFOA* c)
c->dwMajorVersion=4;
c->dwMinorVersion=0;
c->dwBuildNumber=0x4000457;
-#if 0
+#if 1
// leave it here for testing win9x-only codecs
c->dwPlatformId=VER_PLATFORM_WIN32_WINDOWS;
strcpy(c->szCSDVersion, " B");
@@ -1932,7 +1950,8 @@ static HRSRC WINAPI expFindResourceA(HMODULE module, char* name, char* type)
HRSRC result;
result=FindResourceA(module, name, type);
- dbgprintf("FindResourceA(module 0x%x, name 0x%x(%s), type 0x%x(%s)) => 0x%x\n", module, HIWORD(name) ? name : "UNICODE", HIWORD(type) ? type : "UNICODE", result);
+ dbgprintf("FindResourceA(module 0x%x, name 0x%x(%s), type 0x%x(%s)) => 0x%x\n",
+ module, name, HIWORD(name) ? name : "UNICODE", type, HIWORD(type) ? type : "UNICODE", result);
return result;
}
@@ -1960,6 +1979,10 @@ static int WINAPI expFreeResource(long res)
static int WINAPI expCloseHandle(long v1)
{
dbgprintf("CloseHandle(0x%x) => 1\n", v1);
+ /* do not close stdin,stdout and stderr */
+ if (v1 > 2)
+ if (!close(v1))
+ return 0;
return 1;
}
@@ -2132,10 +2155,14 @@ static int WINAPI expLoadLibraryA(char* name)
// PIMJ and VIVO audio are loading kernel32.dll
if (strcasecmp(name, "kernel32.dll") == 0 || strcasecmp(name, "kernel32") == 0)
-// return MODULE_HANDLE_kernel32;
- return ERROR_SUCCESS; /* yeah, we have also the kernel32 calls */
+ return MODULE_HANDLE_kernel32;
+// return ERROR_SUCCESS; /* yeah, we have also the kernel32 calls */
/* exported -> do not return failed! */
+ if (strcasecmp(name, "user32.dll") == 0 || strcasecmp(name, "user32") == 0)
+// return MODULE_HANDLE_kernel32;
+ return MODULE_HANDLE_user32;
+
result=LoadLibraryA(name);
dbgprintf("Returned LoadLibraryA(0x%x='%s'), def_path=%s => 0x%x\n", name, name, win32_def_path, result);
@@ -2150,10 +2177,14 @@ static int WINAPI expFreeLibrary(int module)
static void* WINAPI expGetProcAddress(HMODULE mod, char* name)
{
void* result;
- if(mod!=MODULE_HANDLE_kernel32)
+ switch(mod){
+ case MODULE_HANDLE_kernel32:
+ result=LookupExternalByName("kernel32.dll", name); break;
+ case MODULE_HANDLE_user32:
+ result=LookupExternalByName("user32.dll", name); break;
+ default:
result=GetProcAddress(mod, name);
- else
- result=LookupExternalByName("kernel32.dll", name);
+ }
dbgprintf("GetProcAddress(0x%x, '%s') => 0x%x\n", mod, name, result);
return result;
}
@@ -2214,6 +2245,7 @@ static void* WINAPI expSleep(int time)
dbgprintf("Sleep(%d) => 0\n", time);
return 0;
}
+
// why does IV32 codec want to call this? I don't know ...
static int WINAPI expCreateCompatibleDC(int hdc)
{
@@ -2679,6 +2711,12 @@ static int WINAPI expGetEnvironmentVariableA(const char* name, char* field, int
return strlen(field);
}
+static int WINAPI expSetEnvironmentVariableA(const char *name, const char *value)
+{
+ dbgprintf("SetEnvironmentVariableA(%s, %s)\n", name, value);
+ return 0;
+}
+
static void* WINAPI expCoTaskMemAlloc(ULONG cb)
{
return my_mreq(cb, 0);
@@ -2788,8 +2826,23 @@ long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
static int WINAPI expIsRectEmpty(CONST RECT *lprc)
{
- int r = (!lprc || (lprc->right == lprc->left) || (lprc->top == lprc->bottom));
+ int r = 0;
+// int r = (!lprc || (lprc->right == lprc->left) || (lprc->top == lprc->bottom));
+ int w,h;
+
+ if (lprc)
+ {
+ w = lprc->right - lprc->left;
+ h = lprc->bottom - lprc->top;
+ if (w <= 0 || h <= 0)
+ r = 1;
+ }
+ else
+ r = 1;
+
dbgprintf("IsRectEmpty(%p) => %s\n", lprc, (r) ? "TRUE" : "FALSE");
+// printf("Rect: left: %d, top: %d, right: %d, bottom: %d\n",
+// lprc->left, lprc->top, lprc->right, lprc->bottom);
return r;
}
@@ -2934,14 +2987,69 @@ static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
return r;
}
+#if 0
+ /* we need this for some virtualdub filters */
+ {
+ int r;
+ int flg = 0;
+ if (GENERIC_READ & i1)
+ flg |= O_RDONLY;
+ else if (GENERIC_WRITE & i1)
+ {
+ flg |= O_WRONLY;
+ printf("Warning: openning filename %s %d (flags; 0x%x) for write\n", cs1, r, flg);
+ }
+ r=open(cs1, flg);
+ return r;
+ }
+#endif
+
return atoi(cs1+2);
}
+static UINT WINAPI expGetSystemDirectoryA(
+ char* lpBuffer, // address of buffer for system directory
+ UINT uSize // size of directory buffer
+){
+ dbgprintf("GetSystemDirectoryA(%p,%d)\n", lpBuffer,uSize);
+ if(!lpBuffer) strcpy(lpBuffer,".");
+ return 1;
+}
+/*
static char sysdir[]=".";
static LPCSTR WINAPI expGetSystemDirectoryA()
{
dbgprintf("GetSystemDirectoryA() => 0x%x='%s'\n", sysdir, sysdir);
return sysdir;
}
+*/
+static DWORD WINAPI expGetFullPathNameA
+(
+ LPCTSTR lpFileName,
+ DWORD nBufferLength,
+ LPTSTR lpBuffer,
+ LPTSTR lpFilePart
+){
+ if(!lpFileName) return 0;
+ dbgprintf("GetFullPathNameA('%s',%d,%p,%p)\n",lpFileName,nBufferLength,
+ lpBuffer, lpFilePart);
+ strcpy(lpFilePart, lpFileName);
+ strcpy(lpBuffer, lpFileName);
+// strncpy(lpBuffer, lpFileName, rindex(lpFileName, '\\')-lpFileName);
+ return strlen(lpBuffer);
+}
+
+static DWORD WINAPI expGetShortPathNameA
+(
+ LPCSTR longpath,
+ LPSTR shortpath,
+ DWORD shortlen
+){
+ if(!longpath) return 0;
+ dbgprintf("GetShortPathNameA('%s',%p,%d)\n",longpath,shortpath,shortlen);
+ strcpy(shortpath,longpath);
+ return strlen(shortpath);
+}
+
static WIN_BOOL WINAPI expReadFile(HANDLE h,LPVOID pv,DWORD size,LPDWORD rd,LPOVERLAPPED unused)
{
int result;
@@ -3075,6 +3183,7 @@ static HRESULT WINAPI expCoCreateFreeThreadedMarshaler(void *pUnkOuter, void **p
{
printf("CoCreateFreeThreadedMarshaler(%p, %p) called!\n",
pUnkOuter, ppUnkInner);
+// return 0;
return ERROR_CALL_NOT_IMPLEMENTED;
}
@@ -3134,6 +3243,15 @@ static void expfree(void* mem)
dbgprintf("free(%p)\n", mem);
my_release(mem);
}
+/* needed by atrac3.acm */
+static void *expcalloc(int num, int size)
+{
+ void* result=my_mreq(num*size,1);
+ dbgprintf("calloc(%d,%d) => %p\n", num,size,result);
+ if(result==0)
+ printf("WARNING: calloc() failed\n");
+ return result;
+}
static void* expnew(int size)
{
// printf("NEW:: Call from address %08x\n STACK DUMP:\n", *(-1+(int*)&size));
@@ -3156,11 +3274,32 @@ static int expdelete(void* memory)
my_release(memory);
return 0;
}
+#if 1
static int exp_initterm(int v1, int v2)
{
dbgprintf("_initterm(0x%x, 0x%x) => 0\n", v1, v2);
return 0;
}
+#else
+/* merged from wine - 2002.04.21 */
+typedef void (*_INITTERMFUNC)(void);
+static int exp_initterm(_INITTERMFUNC *start, _INITTERMFUNC *end)
+{
+ _INITTERMFUNC *current = start;
+
+ dbgprintf("_initterm(0x%x, 0x%x)\n", start, end);
+ while (current < end)
+ {
+ if (*current)
+ {
+ printf("call init func: %p\n", *current);
+ (**current)();
+ }
+ current++;
+ }
+ return 0;
+}
+#endif
static int expwsprintfA(char* string, char* format, ...)
{
@@ -3489,7 +3628,181 @@ static int exp_setjmp3(void* jmpbuf, int x)
return 0;
}
+static DWORD WINAPI expGetCurrentProcessId(void)
+{
+ return getpid(); //(DWORD)NtCurrentTeb()->pid;
+}
+static HANDLE WINAPI
+expCreateMutexA( SECURITY_ATTRIBUTES *sa, WIN_BOOL owner, LPCSTR name ){
+ static int x=0xcfcf9898;
+ //++x;
+ dbgprintf("CreateMutexA(%p,%d,'%s') => %d\n",sa,owner,name,x);
+ return x;
+}
+
+typedef struct {
+ UINT wPeriodMin;
+ UINT wPeriodMax;
+} TIMECAPS, *LPTIMECAPS;
+
+static MMRESULT WINAPI exptimeGetDevCaps(LPTIMECAPS lpCaps, UINT wSize)
+{
+ dbgprintf("timeGetDevCaps(%p, %u) !\n", lpCaps, wSize);
+
+ lpCaps->wPeriodMin = 1;
+ lpCaps->wPeriodMax = 65535;
+ return 0;
+}
+
+static MMRESULT WINAPI exptimeBeginPeriod(UINT wPeriod)
+{
+ dbgprintf("timeBeginPeriod(%u) !\n", wPeriod);
+
+ if (wPeriod < 1 || wPeriod > 65535) return 96+1; //TIMERR_NOCANDO;
+ return 0;
+}
+
+static void WINAPI expGlobalMemoryStatus(
+ LPMEMORYSTATUS lpmem
+) {
+ static MEMORYSTATUS cached_memstatus;
+ static int cache_lastchecked = 0;
+ SYSTEM_INFO si;
+ FILE *f;
+
+ if (time(NULL)==cache_lastchecked) {
+ memcpy(lpmem,&cached_memstatus,sizeof(MEMORYSTATUS));
+ return;
+ }
+
+#if 1
+ f = fopen( "/proc/meminfo", "r" );
+ if (f)
+ {
+ char buffer[256];
+ int total, used, free, shared, buffers, cached;
+
+ lpmem->dwLength = sizeof(MEMORYSTATUS);
+ lpmem->dwTotalPhys = lpmem->dwAvailPhys = 0;
+ lpmem->dwTotalPageFile = lpmem->dwAvailPageFile = 0;
+ while (fgets( buffer, sizeof(buffer), f ))
+ {
+ /* old style /proc/meminfo ... */
+ if (sscanf( buffer, "Mem: %d %d %d %d %d %d", &total, &used, &free, &shared, &buffers, &cached ))
+ {
+ lpmem->dwTotalPhys += total;
+ lpmem->dwAvailPhys += free + buffers + cached;
+ }
+ if (sscanf( buffer, "Swap: %d %d %d", &total, &used, &free ))
+ {
+ lpmem->dwTotalPageFile += total;
+ lpmem->dwAvailPageFile += free;
+ }
+
+ /* new style /proc/meminfo ... */
+ if (sscanf(buffer, "MemTotal: %d", &total))
+ lpmem->dwTotalPhys = total*1024;
+ if (sscanf(buffer, "MemFree: %d", &free))
+ lpmem->dwAvailPhys = free*1024;
+ if (sscanf(buffer, "SwapTotal: %d", &total))
+ lpmem->dwTotalPageFile = total*1024;
+ if (sscanf(buffer, "SwapFree: %d", &free))
+ lpmem->dwAvailPageFile = free*1024;
+ if (sscanf(buffer, "Buffers: %d", &buffers))
+ lpmem->dwAvailPhys += buffers*1024;
+ if (sscanf(buffer, "Cached: %d", &cached))
+ lpmem->dwAvailPhys += cached*1024;
+ }
+ fclose( f );
+
+ if (lpmem->dwTotalPhys)
+ {
+ DWORD TotalPhysical = lpmem->dwTotalPhys+lpmem->dwTotalPageFile;
+ DWORD AvailPhysical = lpmem->dwAvailPhys+lpmem->dwAvailPageFile;
+ lpmem->dwMemoryLoad = (TotalPhysical-AvailPhysical)
+ / (TotalPhysical / 100);
+ }
+ } else
+#endif
+ {
+ /* FIXME: should do something for other systems */
+ lpmem->dwMemoryLoad = 0;
+ lpmem->dwTotalPhys = 16*1024*1024;
+ lpmem->dwAvailPhys = 16*1024*1024;
+ lpmem->dwTotalPageFile = 16*1024*1024;
+ lpmem->dwAvailPageFile = 16*1024*1024;
+ }
+ expGetSystemInfo(&si);
+ lpmem->dwTotalVirtual = si.lpMaximumApplicationAddress-si.lpMinimumApplicationAddress;
+ /* FIXME: we should track down all the already allocated VM pages and substract them, for now arbitrarily remove 64KB so that it matches NT */
+ lpmem->dwAvailVirtual = lpmem->dwTotalVirtual-64*1024;
+ memcpy(&cached_memstatus,lpmem,sizeof(MEMORYSTATUS));
+ cache_lastchecked = time(NULL);
+
+ /* it appears some memory display programs want to divide by these values */
+ if(lpmem->dwTotalPageFile==0)
+ lpmem->dwTotalPageFile++;
+
+ if(lpmem->dwAvailPageFile==0)
+ lpmem->dwAvailPageFile++;
+}
+
+/**********************************************************************
+ * SetThreadPriority [KERNEL32.@] Sets priority for thread.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+static WIN_BOOL WINAPI expSetThreadPriority(
+ HANDLE hthread, /* [in] Handle to thread */
+ INT priority) /* [in] Thread priority level */
+{
+ dbgprintf("SetThreadPriority(%p,%d)\n",hthread,priority);
+ return TRUE;
+}
+
+static void WINAPI expExitProcess( DWORD status )
+{
+ printf("EXIT - code %d\n",status);
+ exit(status);
+}
+
+static INT WINAPI expMessageBoxA(HWND hWnd, LPCSTR text, LPCSTR title, UINT type){
+ printf("MSGBOX '%s' '%s' (%d)\n",text,title,type);
+ return 1;
+}
+
+/* these are needed for mss1 */
+
+/* defined in stubs.s */
+void exp_EH_prolog(void);
+
+#include <netinet/in.h>
+static WINAPI inline unsigned long int exphtonl(unsigned long int hostlong)
+{
+// dbgprintf("htonl(%x) => %x\n", hostlong, htonl(hostlong));
+ return htonl(hostlong);
+}
+
+static WINAPI inline unsigned long int expntohl(unsigned long int netlong)
+{
+// dbgprintf("ntohl(%x) => %x\n", netlong, ntohl(netlong));
+ return ntohl(netlong);
+}
+
+int expRegisterClassA(const void/*WNDCLASSA*/ *wc)
+{
+ dbgprintf("RegisterClassA(%p) => random id\n", wc);
+ return time(NULL); /* be precise ! */
+}
+
+int expUnregisterClassA(const char *className, HINSTANCE hInstance)
+{
+ dbgprintf("UnregisterClassA(%s, %p) => 0\n", className, hInstance);
+ return 0;
+}
struct exports
{
@@ -3600,6 +3913,7 @@ struct exports exp_kernel32[]=
FF(GetLocalTime, -1)
FF(GetSystemTime, -1)
FF(GetEnvironmentVariableA, -1)
+ FF(SetEnvironmentVariableA, -1)
FF(RtlZeroMemory,-1)
FF(RtlMoveMemory,-1)
FF(RtlFillMemory,-1)
@@ -3616,6 +3930,8 @@ struct exports exp_kernel32[]=
FF(CreateFileA,-1)
FF(GetSystemDirectoryA,-1)
FF(GetWindowsDirectoryA,-1)
+ FF(GetShortPathNameA,-1)
+ FF(GetFullPathNameA,-1)
FF(SetErrorMode, -1)
FF(IsProcessorFeaturePresent, -1)
FF(GetProcessAffinityMask, -1)
@@ -3633,6 +3949,12 @@ struct exports exp_kernel32[]=
FF(DuplicateHandle,-1)
FF(GetTickCount, -1)
FF(SetThreadAffinityMask,-1)
+ FF(GetCurrentProcessId,-1)
+ FF(CreateMutexA,-1)
+ FF(GlobalMemoryStatus,-1)
+ FF(SetThreadPriority,-1)
+ FF(ExitProcess,-1)
+ {"LoadLibraryExA", -1, (void*)&LoadLibraryExA},
};
struct exports exp_msvcrt[]={
@@ -3674,6 +3996,9 @@ struct exports exp_msvcrt[]={
FF(fprintf,-1)
FF(printf,-1)
FF(getenv,-1)
+ FF(_EH_prolog,-1)
+ FF(calloc,-1)
+ {"ceil",-1,(void*)&ceil}
};
struct exports exp_winmm[]={
FF(GetDriverModuleHandle, -1)
@@ -3681,6 +4006,8 @@ struct exports exp_winmm[]={
FF(DefDriverProc, -1)
FF(OpenDriverA, -1)
FF(OpenDriver, -1)
+ FF(timeGetDevCaps, -1)
+ FF(timeBeginPeriod, -1)
};
struct exports exp_user32[]={
FF(LoadStringA, -1)
@@ -3699,6 +4026,9 @@ struct exports exp_user32[]={
FF(GetSysColorBrush,-1)
FF(GetWindowDC, -1)
FF(DrawTextA, -1)
+ FF(MessageBoxA, -1)
+ FF(RegisterClassA, -1)
+ FF(UnregisterClassA, -1)
};
struct exports exp_advapi32[]={
FF(RegCloseKey, -1)
@@ -3739,11 +4069,46 @@ struct exports exp_comctl32[]={
FF(StringFromGUID2, -1)
FF(InitCommonControls, 17)
};
-
+struct exports exp_wsock32[]={
+ FF(htonl,8)
+ FF(ntohl,14)
+};
struct exports exp_msdmo[]={
FF(memcpy, -1) // just test
};
+/* realplayer8:
+ DLL Name: PNCRT.dll
+ vma: Hint/Ord Member-Name
+ 22ff4 615 free
+ 2302e 250 _ftol
+ 22fea 666 malloc
+ 2303e 609 fprintf
+ 2305e 167 _adjust_fdiv
+ 23052 280 _initterm
+
+ 22ffc 176 _beginthreadex
+ 23036 284 _iob
+ 2300e 85 __CxxFrameHandler
+ 23022 411 _purecall
+*/
+struct exports exp_pncrt[]={
+ FF(malloc, -1) // just test
+ FF(free, -1) // just test
+ FF(fprintf, -1) // just test
+ {"_adjust_fdiv", -1, (void*)&_adjust_fdiv},
+ FF(_ftol,-1)
+ FF(_initterm, -1)
+};
+
+/* needed for Morgand MJPEG */
+struct exports exp_msvfw32[]={
+ {"ICOpen", -1, (void *)&ICOpen},
+ {"ICClose", -1, (void *)&ICClose},
+ {"ICDecompress", -1, (void *)&ICDecompress},
+ {"ICSendMessage", -1, (void *)&ICSendMessage}
+};
+
#define LL(X) \
{#X".dll", sizeof(exp_##X)/sizeof(struct exports), exp_##X},
@@ -3758,11 +4123,17 @@ struct libs libraries[]={
LL(ole32)
LL(crtdll)
LL(comctl32)
+ LL(wsock32)
LL(msdmo)
+ LL(msvfw32)
+ LL(pncrt)
};
-
-char* win32_called_unk = "Called unk_%s\n";
-
+#if defined(__CYGWIN__) || defined(__OS2__) || defined (__OpenBSD__)
+#define MANGLE(a) "_" #a
+#else
+#define MANGLE(a) #a
+#endif
+static char* called_unk = "Called unk_%s\n";
static void ext_stubs(void)
{
// expects:
@@ -3774,9 +4145,9 @@ static void ext_stubs(void)
"movl $0, %eax \n\t"
"movl $0, %edx \n\t"
"shl $5,%eax \n\t" // ax * 32
- "addl $export_names,%eax \n\t"
+ "addl $"MANGLE(export_names)",%eax \n\t"
"pushl %eax \n\t"
- "pushl win32_called_unk \n\t"
+ "pushl "MANGLE(called_unk)" \n\t"
"call *%edx \n\t" // printf (via dx)
"addl $8,%esp \n\t"
"xorl %eax,%eax \n\t"
@@ -3817,6 +4188,8 @@ void* LookupExternal(const char* library, int ordinal)
}
// printf("%x %x\n", &unk_exp1, &unk_exp2);
+ printf("External func %s:%d\n", library, ordinal);
+
for(i=0; i<sizeof(libraries)/sizeof(struct libs); i++)
{
if(strcasecmp(library, libraries[i].name))
@@ -3829,7 +4202,36 @@ void* LookupExternal(const char* library, int ordinal)
return libraries[i].exps[j].func;
}
}
- printf("External func %s:%d\n", library, ordinal);
+
+ /* ok, this is a hack, and a big memory leak. should be fixed. - alex */
+ {
+ HMODULE *hand;
+ WINE_MODREF *wm;
+ void *func;
+
+ hand = LoadLibraryA(library);
+ if (!hand)
+ goto no_dll;
+ wm = MODULE32_LookupHMODULE(hand);
+ if (!wm)
+ {
+ FreeLibrary(hand);
+ goto no_dll;
+ }
+ func = PE_FindExportedFunction(wm, ordinal, 0);
+ if (!func)
+ {
+ printf("No such ordinal in external dll\n");
+ FreeLibrary(hand);
+ goto no_dll;
+ }
+
+ printf("External dll loaded (offset: %p, func: %p)\n",
+ hand, func);
+ return func;
+ }
+
+no_dll:
if(pos>150)return 0;
sprintf(export_names[pos], "%s:%d", library, ordinal);
return add_stub(pos);
@@ -3881,7 +4283,7 @@ void my_garbagecollection(void)
unfreecnt++;
my_release(mem);
}
- printf("Total Unfree %d bytes cnt %d [%p,%d]\n",unfree, unfreecnt, last_alloc, alccnt);
+ dbgprintf("Total Unfree %d bytes cnt %d [%p,%d]\n",unfree, unfreecnt, last_alloc, alccnt);
#endif
g_tls = NULL;
list = NULL;
diff --git a/src/libw32dll/wine/windef.h b/src/libw32dll/wine/windef.h
index 38b498101..8c1865a6e 100644
--- a/src/libw32dll/wine/windef.h
+++ b/src/libw32dll/wine/windef.h
@@ -105,7 +105,7 @@ extern "C" {
/* Calling conventions definitions */
-#if defined(__i386__) && !defined(WINE_TYPEDEFS_ONLY)
+#ifdef __i386__
# if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
# ifndef _EGCS_
#define __stdcall __attribute__((__stdcall__))
@@ -127,18 +127,24 @@ extern "C" {
#define PASCAL __stdcall
#define pascal __stdcall
#define _pascal __stdcall
+#if !defined(__CYGWIN__)
#define _stdcall __stdcall
+#endif
#define _fastcall __stdcall
#define __fastcall __stdcall
#define __export __stdcall
#define CDECL __cdecl
#define _CDECL __cdecl
#define cdecl __cdecl
+#if !defined(__CYGWIN__)
#define _cdecl __cdecl
+#endif
#define WINAPIV __cdecl
#define APIENTRY WINAPI
+#if !defined(__CYGWIN__)
#define __declspec(x)
+#endif
#define dllimport
#define dllexport
diff --git a/src/libw32dll/wine/wineacm.h b/src/libw32dll/wine/wineacm.h
index e7604dc64..5984a68c5 100644
--- a/src/libw32dll/wine/wineacm.h
+++ b/src/libw32dll/wine/wineacm.h
@@ -1,19 +1,8 @@
-#ifndef WINEACM_H
-#define WINEACM_H
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/***********************************************************************
* Wine specific - Win32
*/
-
-
-#include "msacmdrv.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* defined(__cplusplus) */
-
-
typedef struct _WINE_ACMDRIVERID *PWINE_ACMDRIVERID;
typedef struct _WINE_ACMDRIVER *PWINE_ACMDRIVER;
@@ -28,7 +17,6 @@ typedef struct _WINE_ACMDRIVER
HDRVR hDrvr;
DRIVERPROC pfnDriverProc;
PWINE_ACMDRIVER pNextACMDriver;
- int iUsage;
} WINE_ACMDRIVER;
typedef struct _WINE_ACMSTREAM
@@ -41,8 +29,8 @@ typedef struct _WINE_ACMSTREAM
typedef struct _WINE_ACMDRIVERID
{
+ LPSTR pszDriverAlias;
LPSTR pszFileName;
- WORD wFormatTag;
HINSTANCE hInstModule; /* NULL if global */
DWORD dwProcessID; /* ID of process which installed a local driver */
WIN_BOOL bEnabled;
@@ -55,18 +43,13 @@ typedef struct _WINE_ACMDRIVERID
extern HANDLE MSACM_hHeap;
extern PWINE_ACMDRIVERID MSACM_pFirstACMDriverID;
extern PWINE_ACMDRIVERID MSACM_pLastACMDriverID;
-
-PWINE_ACMDRIVERID MSACM_RegisterDriver(const char* pszFileName,
- WORD wFormatTag,
+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);
-#ifdef __cplusplus
-} /* extern "C" */
-#endif /* defined(__cplusplus) */
-
-#endif /* WINEACM_H */
diff --git a/src/libw32dll/wine/winnt.h b/src/libw32dll/wine/winnt.h
index 478f8b78f..401c39889 100644
--- a/src/libw32dll/wine/winnt.h
+++ b/src/libw32dll/wine/winnt.h
@@ -81,7 +81,7 @@
/* These types are _not_ defined for the emulator, because they */
/* depend on the UNICODE macro that only exists in user's code. */
-#ifndef __WINE__
+//#ifndef __WINE__
# ifdef UNICODE
typedef WCHAR TCHAR, *PTCHAR;
typedef LPWSTR PTSTR, LPTSTR;
@@ -93,7 +93,7 @@ typedef LPSTR PTSTR, LPTSTR;
typedef LPCSTR PCTSTR, LPCTSTR;
#define __TEXT(string) string
# endif /* UNICODE */
-#endif /* __WINE__ */
+//#endif /* __WINE__ */
#define TEXT(quote) __TEXT(quote)
typedef BYTE BOOLEAN;