Use MapLS/UnMapLS instead of SEGPTR_* macros.
This commit is contained in:
parent
b3a3a8f3bc
commit
851297919b
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include "wine/obj_base.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "heap.h"
|
||||
#include "ifs.h"
|
||||
|
||||
#include "debugtools.h"
|
||||
|
@ -199,35 +198,36 @@ LPVOID WINAPI IMalloc16_fnHeapMinimize(IMalloc16* iface) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static ICOM_VTABLE(IMalloc16)* msegvt16 = NULL;
|
||||
|
||||
/******************************************************************************
|
||||
* IMalloc16_Constructor [VTABLE]
|
||||
*/
|
||||
LPMALLOC16
|
||||
IMalloc16_Constructor() {
|
||||
IMalloc16Impl* This;
|
||||
HMODULE16 hcomp = GetModuleHandle16("COMPOBJ");
|
||||
IMalloc16_Constructor()
|
||||
{
|
||||
static ICOM_VTABLE(IMalloc16) vt16;
|
||||
static SEGPTR msegvt16;
|
||||
IMalloc16Impl* This;
|
||||
HMODULE16 hcomp = GetModuleHandle16("COMPOBJ");
|
||||
|
||||
This = (IMalloc16Impl*)SEGPTR_NEW(IMalloc16Impl);
|
||||
if (!msegvt16) {
|
||||
msegvt16 = SEGPTR_NEW(ICOM_VTABLE(IMalloc16));
|
||||
|
||||
#define VTENT(x) msegvt16->x = (void*)GetProcAddress16(hcomp,"IMalloc16_"#x);assert(msegvt16->x)
|
||||
VTENT(QueryInterface);
|
||||
VTENT(AddRef);
|
||||
VTENT(Release);
|
||||
VTENT(Alloc);
|
||||
VTENT(Realloc);
|
||||
VTENT(Free);
|
||||
VTENT(GetSize);
|
||||
VTENT(DidAlloc);
|
||||
VTENT(HeapMinimize);
|
||||
This = HeapAlloc( GetProcessHeap(), 0, sizeof(IMalloc16Impl) );
|
||||
if (!msegvt16)
|
||||
{
|
||||
#define VTENT(x) vt16.x = (void*)GetProcAddress16(hcomp,"IMalloc16_"#x);assert(vt16.x)
|
||||
VTENT(QueryInterface);
|
||||
VTENT(AddRef);
|
||||
VTENT(Release);
|
||||
VTENT(Alloc);
|
||||
VTENT(Realloc);
|
||||
VTENT(Free);
|
||||
VTENT(GetSize);
|
||||
VTENT(DidAlloc);
|
||||
VTENT(HeapMinimize);
|
||||
#undef VTENT
|
||||
}
|
||||
ICOM_VTBL(This) = (ICOM_VTABLE(IMalloc16)*)SEGPTR_GET(msegvt16);
|
||||
This->ref = 1;
|
||||
return (LPMALLOC16)SEGPTR_GET(This);
|
||||
msegvt16 = MapLS( &vt16 );
|
||||
}
|
||||
ICOM_VTBL(This) = (ICOM_VTABLE(IMalloc16)*)msegvt16;
|
||||
This->ref = 1;
|
||||
return (LPMALLOC16)MapLS( This );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
#include "ntddk.h"
|
||||
#include "winerror.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wingdi.h"
|
||||
#include "wtypes.h"
|
||||
#include "wine/obj_base.h"
|
||||
#include "wine/obj_storage.h"
|
||||
#include "heap.h"
|
||||
#include "debugtools.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
@ -715,7 +715,8 @@ ULONG WINAPI IStream16_fnRelease(IStream16* iface) {
|
|||
This->ref--;
|
||||
if (!This->ref) {
|
||||
CloseHandle(This->hf);
|
||||
SEGPTR_FREE(This);
|
||||
UnMapLS( This->thisptr );
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
|
@ -1117,9 +1118,7 @@ static void _create_istream16(LPSTREAM16 *str) {
|
|||
VTENT(Stat);
|
||||
VTENT(Clone);
|
||||
#undef VTENT
|
||||
segstrvt16 = SEGPTR_NEW(ICOM_VTABLE(IStream16));
|
||||
memcpy(segstrvt16,&strvt16,sizeof(strvt16));
|
||||
segstrvt16 = (ICOM_VTABLE(IStream16)*)SEGPTR_GET(segstrvt16);
|
||||
segstrvt16 = (ICOM_VTABLE(IStream16)*)MapLS( &strvt16 );
|
||||
} else {
|
||||
#define VTENT(xfn) strvt16.xfn = IStream16_fn##xfn;
|
||||
VTENT(QueryInterface);
|
||||
|
@ -1142,10 +1141,10 @@ static void _create_istream16(LPSTREAM16 *str) {
|
|||
segstrvt16 = &strvt16;
|
||||
}
|
||||
}
|
||||
lpst = SEGPTR_NEW(IStream16Impl);
|
||||
lpst = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpst) );
|
||||
ICOM_VTBL(lpst) = segstrvt16;
|
||||
lpst->ref = 1;
|
||||
lpst->thisptr = SEGPTR_GET(lpst);
|
||||
lpst->thisptr = MapLS( lpst );
|
||||
*str = (void*)lpst->thisptr;
|
||||
}
|
||||
|
||||
|
@ -1198,7 +1197,7 @@ ULONG WINAPI IStream_fnRelease(IStream* iface) {
|
|||
This->ref--;
|
||||
if (!This->ref) {
|
||||
CloseHandle(This->hf);
|
||||
SEGPTR_FREE(This);
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
|
@ -1251,7 +1250,8 @@ ULONG WINAPI IStorage16_fnRelease(IStorage16* iface) {
|
|||
This->ref--;
|
||||
if (This->ref)
|
||||
return This->ref;
|
||||
SEGPTR_FREE(This);
|
||||
UnMapLS( This->thisptr );
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1262,10 +1262,14 @@ HRESULT WINAPI IStorage16_fnStat(
|
|||
LPSTORAGE16 iface,STATSTG16 *pstatstg, DWORD grfStatFlag
|
||||
) {
|
||||
ICOM_THIS(IStorage16Impl,iface);
|
||||
DWORD len = WideCharToMultiByte( CP_ACP, 0, This->stde.pps_rawname, -1, NULL, 0, NULL, NULL );
|
||||
LPSTR nameA = HeapAlloc( GetProcessHeap(), 0, len );
|
||||
|
||||
TRACE("(%p)->(%p,0x%08lx)\n",
|
||||
This,pstatstg,grfStatFlag
|
||||
);
|
||||
pstatstg->pwcsName=(LPOLESTR16)SEGPTR_GET(SEGPTR_STRDUP_WtoA(This->stde.pps_rawname));
|
||||
WideCharToMultiByte( CP_ACP, 0, This->stde.pps_rawname, -1, nameA, len, NULL, NULL );
|
||||
pstatstg->pwcsName=(LPOLESTR16)MapLS( nameA );
|
||||
pstatstg->type = This->stde.pps_type;
|
||||
pstatstg->cbSize.s.LowPart = This->stde.pps_size;
|
||||
pstatstg->mtime = This->stde.pps_ft1; /* FIXME */ /* why? */
|
||||
|
@ -1520,9 +1524,7 @@ static void _create_istorage16(LPSTORAGE16 *stg) {
|
|||
VTENT(SetStateBits)
|
||||
VTENT(Stat)
|
||||
#undef VTENT
|
||||
segstvt16 = SEGPTR_NEW(ICOM_VTABLE(IStorage16));
|
||||
memcpy(segstvt16,&stvt16,sizeof(stvt16));
|
||||
segstvt16 = (ICOM_VTABLE(IStorage16)*)SEGPTR_GET(segstvt16);
|
||||
segstvt16 = (ICOM_VTABLE(IStorage16)*)MapLS( &stvt16 );
|
||||
} else {
|
||||
#define VTENT(xfn) stvt16.xfn = IStorage16_fn##xfn;
|
||||
VTENT(QueryInterface)
|
||||
|
@ -1549,10 +1551,10 @@ static void _create_istorage16(LPSTORAGE16 *stg) {
|
|||
segstvt16 = &stvt16;
|
||||
}
|
||||
}
|
||||
lpst = SEGPTR_NEW(IStorage16Impl);
|
||||
lpst = HeapAlloc( GetProcessHeap(), 0, sizeof(*lpst) );
|
||||
ICOM_VTBL(lpst) = segstvt16;
|
||||
lpst->ref = 1;
|
||||
lpst->thisptr = SEGPTR_GET(lpst);
|
||||
lpst->thisptr = MapLS(lpst);
|
||||
*stg = (void*)lpst->thisptr;
|
||||
}
|
||||
|
||||
|
@ -1648,11 +1650,14 @@ HRESULT WINAPI StgIsStorageFile16(LPCOLESTR16 fn) {
|
|||
HRESULT WINAPI
|
||||
StgIsStorageFile(LPCOLESTR fn)
|
||||
{
|
||||
LPOLESTR16 xfn = HEAP_strdupWtoA(GetProcessHeap(),0,fn);
|
||||
HRESULT ret = StgIsStorageFile16(xfn);
|
||||
HRESULT ret;
|
||||
DWORD len = WideCharToMultiByte( CP_ACP, 0, fn, -1, NULL, 0, NULL, NULL );
|
||||
LPSTR strA = HeapAlloc( GetProcessHeap(), 0, len );
|
||||
|
||||
HeapFree(GetProcessHeap(),0,xfn);
|
||||
return ret;
|
||||
WideCharToMultiByte( CP_ACP, 0, fn, -1, strA, len, NULL, NULL );
|
||||
ret = StgIsStorageFile16(strA);
|
||||
HeapFree( GetProcessHeap(), 0, strA );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "winuser.h"
|
||||
#include "wine/winuser16.h"
|
||||
#include "wine/port.h"
|
||||
#include "heap.h"
|
||||
#include "win.h"
|
||||
#include "winerror.h"
|
||||
|
||||
|
@ -88,8 +87,9 @@ struct DosDeviceStruct {
|
|||
OVERLAPPED read_ov, write_ov;
|
||||
/* save terminal states */
|
||||
DCB16 dcb;
|
||||
/* pointer to unknown(==undocumented) comm structure */
|
||||
LPCVOID *unknown;
|
||||
/* pointer to unknown(==undocumented) comm structure */
|
||||
SEGPTR seg_unknown;
|
||||
BYTE unknown[40];
|
||||
};
|
||||
|
||||
static struct DosDeviceStruct COM[MAX_PORTS];
|
||||
|
@ -521,8 +521,8 @@ INT16 WINAPI OpenComm16(LPCSTR device,UINT16 cbInQueue,UINT16 cbOutQueue)
|
|||
ERR("Couldn't open %s ! (%s)\n", COM[port].devicename, strerror(errno));
|
||||
return IE_HARDWARE;
|
||||
} else {
|
||||
COM[port].unknown = SEGPTR_ALLOC(40);
|
||||
memset(COM[port].unknown, 0, 40);
|
||||
memset(COM[port].unknown, 0, sizeof(COM[port].unknown));
|
||||
COM[port].seg_unknown = 0;
|
||||
COM[port].handle = handle;
|
||||
COM[port].commerror = 0;
|
||||
COM[port].eventmask = 0;
|
||||
|
@ -609,8 +609,7 @@ INT16 WINAPI CloseComm16(INT16 cid)
|
|||
}
|
||||
if (!(cid&FLAG_LPT)) {
|
||||
/* COM port */
|
||||
SEGPTR_FREE(COM[cid].unknown); /* [LW] */
|
||||
|
||||
UnMapLS( COM[cid].seg_unknown );
|
||||
CloseHandle(COM[cid].read_ov.hEvent);
|
||||
CloseHandle(COM[cid].write_ov.hEvent);
|
||||
|
||||
|
@ -843,7 +842,8 @@ SEGPTR WINAPI SetCommEventMask16(INT16 cid,UINT16 fuEvtMask)
|
|||
COMM_MSRUpdate( ptr->handle, stol );
|
||||
|
||||
TRACE(" modem dcd construct %x\n",*stol);
|
||||
return SEGPTR_GET(COM[cid].unknown);
|
||||
if (!COM[cid].seg_unknown) COM[cid].seg_unknown = MapLS( COM[cid].unknown );
|
||||
return COM[cid].seg_unknown;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
|
@ -95,34 +95,30 @@ static int DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
|
|||
* lParam2 is a pointer to DRVCONFIGINFO
|
||||
*/
|
||||
if (*lParam2) {
|
||||
LPDRVCONFIGINFO16 dci16 = (LPDRVCONFIGINFO16)SEGPTR_ALLOC(sizeof(DRVCONFIGINFO16));
|
||||
LPDRVCONFIGINFO16 dci16 = HeapAlloc( GetProcessHeap(), 0, sizeof(*dci16) );
|
||||
LPDRVCONFIGINFO dci32 = (LPDRVCONFIGINFO)(*lParam2);
|
||||
|
||||
if (dci16) {
|
||||
LPSTR str1, str2;
|
||||
LPSTR str1;
|
||||
|
||||
dci16->dwDCISize = sizeof(DRVCONFIGINFO16);
|
||||
|
||||
if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCISectionName)) != NULL &&
|
||||
(str2 = SEGPTR_STRDUP(str1)) != NULL) {
|
||||
dci16->lpszDCISectionName = SEGPTR_GET(str2);
|
||||
if (!HeapFree(GetProcessHeap(), 0, str1))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCISectionName)) != NULL)
|
||||
{
|
||||
dci16->lpszDCISectionName = MapLS( str1 );
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCIAliasName)) != NULL &&
|
||||
(str2 = SEGPTR_STRDUP(str1)) != NULL) {
|
||||
dci16->lpszDCIAliasName = SEGPTR_GET(str2);
|
||||
if (!HeapFree(GetProcessHeap(), 0, str1))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCIAliasName)) != NULL)
|
||||
{
|
||||
dci16->lpszDCIAliasName = MapLS( str1 );
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
*lParam2 = (LPARAM)SEGPTR_GET(dci16);
|
||||
*lParam2 = MapLS( dci16 );
|
||||
ret = 1;
|
||||
} else {
|
||||
ret = 0;
|
||||
|
@ -168,13 +164,12 @@ static int DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2)
|
|||
/* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */
|
||||
if (lParam2) {
|
||||
LPDRVCONFIGINFO16 dci16 = MapSL(lParam2);
|
||||
|
||||
if (!SEGPTR_FREE(MapSL(dci16->lpszDCISectionName)))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
if (!SEGPTR_FREE(MapSL(dci16->lpszDCIAliasName)))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
if (!SEGPTR_FREE(dci16))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCISectionName) );
|
||||
HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCIAliasName) );
|
||||
HeapFree( GetProcessHeap(), 0, dci16 );
|
||||
UnMapLS( lParam2 );
|
||||
UnMapLS( dci16->lpszDCISectionName );
|
||||
UnMapLS( dci16->lpszDCIAliasName );
|
||||
}
|
||||
ret = 0;
|
||||
break;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "wine/winbase16.h"
|
||||
#include "heap.h"
|
||||
#include "winreg.h"
|
||||
#include "winver.h"
|
||||
#include "winemm.h"
|
||||
|
@ -584,8 +583,8 @@ static MMDRV_MapType MMDRV_MidiOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
break;
|
||||
case MODM_GETDEVCAPS:
|
||||
{
|
||||
LPMIDIOUTCAPSA moc32 = (LPMIDIOUTCAPSA)*lpParam1;
|
||||
LPSTR ptr = SEGPTR_ALLOC(sizeof(LPMIDIOUTCAPSA) + sizeof(MIDIOUTCAPS16));
|
||||
LPMIDIOUTCAPSA moc32 = (LPMIDIOUTCAPSA)*lpParam1;
|
||||
LPSTR ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(LPMIDIOUTCAPSA)+sizeof(MIDIOUTCAPS16));
|
||||
|
||||
if (ptr) {
|
||||
*(LPMIDIOUTCAPSA*)ptr = moc32;
|
||||
|
@ -593,7 +592,7 @@ static MMDRV_MapType MMDRV_MidiOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
} else {
|
||||
ret = MMDRV_MAP_NOMEM;
|
||||
}
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPMIDIOUTCAPSA);
|
||||
*lpParam1 = (DWORD)MapLS(ptr) + sizeof(LPMIDIOUTCAPSA);
|
||||
*lpParam2 = sizeof(MIDIOUTCAPS16);
|
||||
}
|
||||
break;
|
||||
|
@ -601,12 +600,14 @@ static MMDRV_MapType MMDRV_MidiOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
{
|
||||
LPMIDIHDR mh32 = (LPMIDIHDR)*lpParam1;
|
||||
LPMIDIHDR mh16;
|
||||
LPVOID ptr = SEGPTR_ALLOC(sizeof(LPMIDIHDR) + sizeof(MIDIHDR) + mh32->dwBufferLength);
|
||||
LPVOID ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPMIDIHDR) + sizeof(MIDIHDR) + mh32->dwBufferLength);
|
||||
|
||||
if (ptr) {
|
||||
*(LPMIDIHDR*)ptr = mh32;
|
||||
mh16 = (LPMIDIHDR)((LPSTR)ptr + sizeof(LPMIDIHDR));
|
||||
mh16->lpData = (LPSTR)SEGPTR_GET(ptr) + sizeof(LPMIDIHDR) + sizeof(MIDIHDR);
|
||||
*lpParam1 = MapLS(mh16);
|
||||
mh16->lpData = (LPSTR)*lpParam1 + sizeof(MIDIHDR);
|
||||
/* data will be copied on WODM_WRITE */
|
||||
mh16->dwBufferLength = mh32->dwBufferLength;
|
||||
mh16->dwBytesRecorded = mh32->dwBytesRecorded;
|
||||
|
@ -620,9 +621,8 @@ static MMDRV_MapType MMDRV_MidiOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
mh32->reserved = *lpParam2;
|
||||
|
||||
TRACE("mh16=%08lx mh16->lpData=%08lx mh32->buflen=%lu mh32->lpData=%08lx\n",
|
||||
(DWORD)SEGPTR_GET(ptr) + sizeof(LPMIDIHDR), (DWORD)mh16->lpData,
|
||||
*lpParam1, (DWORD)mh16->lpData,
|
||||
mh32->dwBufferLength, (DWORD)mh32->lpData);
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPMIDIHDR);
|
||||
*lpParam2 = sizeof(MIDIHDR);
|
||||
|
||||
ret = MMDRV_MAP_OKMEM;
|
||||
|
@ -640,15 +640,14 @@ static MMDRV_MapType MMDRV_MidiOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
|
||||
assert(*(LPMIDIHDR*)ptr == mh32);
|
||||
|
||||
TRACE("mh16=%08lx mh16->lpData=%08lx mh32->buflen=%lu mh32->lpData=%08lx\n",
|
||||
(DWORD)SEGPTR_GET(ptr) + sizeof(LPMIDIHDR), (DWORD)mh16->lpData,
|
||||
mh32->dwBufferLength, (DWORD)mh32->lpData);
|
||||
|
||||
if (wMsg == MODM_LONGDATA)
|
||||
memcpy((LPSTR)mh16 + sizeof(MIDIHDR), mh32->lpData, mh32->dwBufferLength);
|
||||
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPMIDIHDR);
|
||||
*lpParam1 = MapLS(mh16);
|
||||
*lpParam2 = sizeof(MIDIHDR);
|
||||
TRACE("mh16=%08lx mh16->lpData=%08lx mh32->buflen=%lu mh32->lpData=%08lx\n",
|
||||
*lpParam1, (DWORD)mh16->lpData, mh32->dwBufferLength, (DWORD)mh32->lpData);
|
||||
|
||||
/* dwBufferLength can be reduced between prepare & write */
|
||||
if (mh16->dwBufferLength < mh32->dwBufferLength) {
|
||||
ERR("Size of buffer has been increased (%ld, %ld)\n",
|
||||
|
@ -672,10 +671,12 @@ static MMDRV_MapType MMDRV_MidiOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
MIDIOPENDESC16 mod16: openDesc passed to driver
|
||||
MIDIOPENSTRMID cIds
|
||||
*/
|
||||
ptr = SEGPTR_ALLOC(sizeof(LPMIDIOPENDESC) + 2*sizeof(DWORD) + sizeof(MIDIOPENDESC16) +
|
||||
mod32->cIds ? (mod32->cIds - 1) * sizeof(MIDIOPENSTRMID) : 0);
|
||||
ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPMIDIOPENDESC) + 2*sizeof(DWORD) + sizeof(MIDIOPENDESC16) +
|
||||
mod32->cIds ? (mod32->cIds - 1) * sizeof(MIDIOPENSTRMID) : 0);
|
||||
|
||||
if (ptr) {
|
||||
SEGPTR segptr = MapLS(ptr);
|
||||
*(LPMIDIOPENDESC*)ptr = mod32;
|
||||
*(LPDWORD)(ptr + sizeof(LPMIDIOPENDESC)) = *lpdwUser;
|
||||
mod16 = (LPMIDIOPENDESC16)((LPSTR)ptr + sizeof(LPMIDIOPENDESC) + 2*sizeof(DWORD));
|
||||
|
@ -687,8 +688,8 @@ static MMDRV_MapType MMDRV_MidiOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
mod16->cIds = mod32->cIds;
|
||||
memcpy(&mod16->rgIds, &mod32->rgIds, mod32->cIds * sizeof(MIDIOPENSTRMID));
|
||||
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPMIDIOPENDESC) + 2*sizeof(DWORD);
|
||||
*lpdwUser = (DWORD)SEGPTR_GET(ptr) + sizeof(LPMIDIOPENDESC) + sizeof(DWORD);
|
||||
*lpParam1 = (DWORD)segptr + sizeof(LPMIDIOPENDESC) + 2*sizeof(DWORD);
|
||||
*lpdwUser = (DWORD)segptr + sizeof(LPMIDIOPENDESC) + sizeof(DWORD);
|
||||
|
||||
ret = MMDRV_MAP_OKMEM;
|
||||
} else {
|
||||
|
@ -736,9 +737,8 @@ static MMDRV_MapType MMDRV_MidiOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
moc32->wNotes = moc16->wNotes;
|
||||
moc32->wChannelMask = moc16->wChannelMask;
|
||||
moc32->dwSupport = moc16->dwSupport;
|
||||
|
||||
if (!SEGPTR_FREE(ptr))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
UnMapLS( *lpParam1 );
|
||||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
ret = MMDRV_MAP_OK;
|
||||
}
|
||||
break;
|
||||
|
@ -751,13 +751,13 @@ static MMDRV_MapType MMDRV_MidiOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
LPMIDIHDR mh32 = *(LPMIDIHDR*)ptr;
|
||||
|
||||
assert(mh32->lpNext == (LPMIDIHDR)mh16);
|
||||
UnMapLS( *lpParam1 );
|
||||
mh32->dwBytesRecorded = mh16->dwBytesRecorded;
|
||||
mh32->dwUser = mh16->dwUser;
|
||||
mh32->dwFlags = mh16->dwFlags;
|
||||
|
||||
if (wMsg == MODM_UNPREPARE) {
|
||||
if (!SEGPTR_FREE(ptr))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
mh32->lpNext = 0;
|
||||
}
|
||||
ret = MMDRV_MAP_OK;
|
||||
|
@ -767,12 +767,10 @@ static MMDRV_MapType MMDRV_MidiOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
{
|
||||
LPMIDIOPENDESC16 mod16 = MapSL(*lpParam1);
|
||||
LPSTR ptr = (LPSTR)mod16 - sizeof(LPMIDIOPENDESC) - 2*sizeof(DWORD);
|
||||
|
||||
UnMapLS( *lpParam1 );
|
||||
**(DWORD**)(ptr + sizeof(LPMIDIOPENDESC)) = *(LPDWORD)(ptr + sizeof(LPMIDIOPENDESC) + sizeof(DWORD));
|
||||
|
||||
if (!SEGPTR_FREE(ptr))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
ret = MMDRV_MAP_OK;
|
||||
}
|
||||
break;
|
||||
|
@ -1052,15 +1050,17 @@ static MMDRV_MapType MMDRV_WaveIn_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPDW
|
|||
sz += ((LPWAVEFORMATEX)wod32->lpFormat)->cbSize;
|
||||
}
|
||||
|
||||
ptr = SEGPTR_ALLOC(sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD) + sizeof(WAVEOPENDESC16) + sz);
|
||||
ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD) + sizeof(WAVEOPENDESC16) + sz);
|
||||
|
||||
if (ptr) {
|
||||
SEGPTR seg_ptr = MapLS( ptr );
|
||||
*(LPWAVEOPENDESC*)ptr = wod32;
|
||||
*(LPDWORD)(ptr + sizeof(LPWAVEOPENDESC)) = *lpdwUser;
|
||||
wod16 = (LPWAVEOPENDESC16)((LPSTR)ptr + sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD));
|
||||
|
||||
wod16->hWave = wod32->hWave;
|
||||
wod16->lpFormat = (LPWAVEFORMATEX)((DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD) + sizeof(WAVEOPENDESC16));
|
||||
wod16->lpFormat = (LPWAVEFORMATEX)(seg_ptr + sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD) + sizeof(WAVEOPENDESC16));
|
||||
memcpy(wod16 + 1, wod32->lpFormat, sz);
|
||||
|
||||
wod16->dwCallback = wod32->dwCallback;
|
||||
|
@ -1068,8 +1068,8 @@ static MMDRV_MapType MMDRV_WaveIn_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPDW
|
|||
wod16->uMappedDeviceID = wod32->uMappedDeviceID;
|
||||
wod16->dnDevNode = wod32->dnDevNode;
|
||||
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD);
|
||||
*lpdwUser = (DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEOPENDESC) + sizeof(DWORD);
|
||||
*lpParam1 = seg_ptr + sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD);
|
||||
*lpdwUser = seg_ptr + sizeof(LPWAVEOPENDESC) + sizeof(DWORD);
|
||||
|
||||
ret = MMDRV_MAP_OKMEM;
|
||||
} else {
|
||||
|
@ -1081,12 +1081,14 @@ static MMDRV_MapType MMDRV_WaveIn_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPDW
|
|||
{
|
||||
LPWAVEHDR wh32 = (LPWAVEHDR)*lpParam1;
|
||||
LPWAVEHDR wh16;
|
||||
LPVOID ptr = SEGPTR_ALLOC(sizeof(LPWAVEHDR) + sizeof(WAVEHDR) + wh32->dwBufferLength);
|
||||
LPVOID ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPWAVEHDR) + sizeof(WAVEHDR) + wh32->dwBufferLength);
|
||||
|
||||
if (ptr) {
|
||||
SEGPTR seg_ptr = MapLS( ptr );
|
||||
*(LPWAVEHDR*)ptr = wh32;
|
||||
wh16 = (LPWAVEHDR)((LPSTR)ptr + sizeof(LPWAVEHDR));
|
||||
wh16->lpData = (LPSTR)SEGPTR_GET(ptr) + sizeof(LPWAVEHDR) + sizeof(WAVEHDR);
|
||||
wh16->lpData = (LPSTR)seg_ptr + sizeof(LPWAVEHDR) + sizeof(WAVEHDR);
|
||||
/* data will be copied on WODM_WRITE */
|
||||
wh16->dwBufferLength = wh32->dwBufferLength;
|
||||
wh16->dwBytesRecorded = wh32->dwBytesRecorded;
|
||||
|
@ -1097,9 +1099,9 @@ static MMDRV_MapType MMDRV_WaveIn_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPDW
|
|||
/* could link the wh32->lpNext at this level for memory house keeping */
|
||||
wh32->lpNext = wh16; /* for reuse in unprepare and write */
|
||||
TRACE("wh16=%08lx wh16->lpData=%08lx wh32->buflen=%lu wh32->lpData=%08lx\n",
|
||||
(DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEHDR), (DWORD)wh16->lpData,
|
||||
seg_ptr + sizeof(LPWAVEHDR), (DWORD)wh16->lpData,
|
||||
wh32->dwBufferLength, (DWORD)wh32->lpData);
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEHDR);
|
||||
*lpParam1 = seg_ptr + sizeof(LPWAVEHDR);
|
||||
*lpParam2 = sizeof(WAVEHDR);
|
||||
|
||||
ret = MMDRV_MAP_OKMEM;
|
||||
|
@ -1114,17 +1116,18 @@ static MMDRV_MapType MMDRV_WaveIn_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPDW
|
|||
LPWAVEHDR wh32 = (LPWAVEHDR)(*lpParam1);
|
||||
LPWAVEHDR wh16 = wh32->lpNext;
|
||||
LPSTR ptr = (LPSTR)wh16 - sizeof(LPWAVEHDR);
|
||||
SEGPTR seg_ptr = MapLS( ptr );
|
||||
|
||||
assert(*(LPWAVEHDR*)ptr == wh32);
|
||||
|
||||
TRACE("wh16=%08lx wh16->lpData=%08lx wh32->buflen=%lu wh32->lpData=%08lx\n",
|
||||
(DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEHDR), (DWORD)wh16->lpData,
|
||||
seg_ptr + sizeof(LPWAVEHDR), (DWORD)wh16->lpData,
|
||||
wh32->dwBufferLength, (DWORD)wh32->lpData);
|
||||
|
||||
if (wMsg == WIDM_ADDBUFFER)
|
||||
memcpy((LPSTR)wh16 + sizeof(WAVEHDR), wh32->lpData, wh32->dwBufferLength);
|
||||
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEHDR);
|
||||
*lpParam1 = seg_ptr + sizeof(LPWAVEHDR);
|
||||
*lpParam2 = sizeof(WAVEHDR);
|
||||
/* dwBufferLength can be reduced between prepare & write */
|
||||
if (wh32->dwBufferLength < wh16->dwBufferLength) {
|
||||
|
@ -1138,8 +1141,8 @@ static MMDRV_MapType MMDRV_WaveIn_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPDW
|
|||
break;
|
||||
case WIDM_GETDEVCAPS:
|
||||
{
|
||||
LPWAVEINCAPSA wic32 = (LPWAVEINCAPSA)*lpParam1;
|
||||
LPSTR ptr = SEGPTR_ALLOC(sizeof(LPWAVEINCAPSA) + sizeof(WAVEINCAPS16));
|
||||
LPWAVEINCAPSA wic32 = (LPWAVEINCAPSA)*lpParam1;
|
||||
LPSTR ptr = HeapAlloc( GetProcessHeap(), 0 ,sizeof(LPWAVEINCAPSA) + sizeof(WAVEINCAPS16));
|
||||
|
||||
if (ptr) {
|
||||
*(LPWAVEINCAPSA*)ptr = wic32;
|
||||
|
@ -1147,15 +1150,15 @@ static MMDRV_MapType MMDRV_WaveIn_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPDW
|
|||
} else {
|
||||
ret = MMDRV_MAP_NOMEM;
|
||||
}
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEINCAPSA);
|
||||
*lpParam1 = MapLS(ptr) + sizeof(LPWAVEINCAPSA);
|
||||
*lpParam2 = sizeof(WAVEINCAPS16);
|
||||
}
|
||||
break;
|
||||
case WIDM_GETPOS:
|
||||
{
|
||||
LPMMTIME mmt32 = (LPMMTIME)*lpParam1;
|
||||
LPSTR ptr = SEGPTR_ALLOC(sizeof(LPMMTIME) + sizeof(MMTIME16));
|
||||
LPMMTIME16 mmt16 = (LPMMTIME16)(ptr + sizeof(LPMMTIME));
|
||||
LPMMTIME mmt32 = (LPMMTIME)*lpParam1;
|
||||
LPSTR ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(LPMMTIME) + sizeof(MMTIME16));
|
||||
LPMMTIME16 mmt16 = (LPMMTIME16)(ptr + sizeof(LPMMTIME));
|
||||
|
||||
if (ptr) {
|
||||
*(LPMMTIME*)ptr = mmt32;
|
||||
|
@ -1164,35 +1167,15 @@ static MMDRV_MapType MMDRV_WaveIn_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPDW
|
|||
} else {
|
||||
ret = MMDRV_MAP_NOMEM;
|
||||
}
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPMMTIME);
|
||||
*lpParam1 = MapLS(ptr) + sizeof(LPMMTIME);
|
||||
*lpParam2 = sizeof(MMTIME16);
|
||||
}
|
||||
break;
|
||||
case DRVM_MAPPER_STATUS:
|
||||
{
|
||||
LPDWORD p32 = (LPDWORD)*lpParam2;
|
||||
int sz;
|
||||
LPSTR ptr;
|
||||
LPDWORD p16;
|
||||
|
||||
switch (*lpParam1) {
|
||||
case WAVEIN_MAPPER_STATUS_DEVICE: sz = sizeof(DWORD); break;
|
||||
case WAVEIN_MAPPER_STATUS_MAPPED: sz = sizeof(DWORD); break;
|
||||
case WAVEIN_MAPPER_STATUS_FORMAT: sz = sizeof(WAVEFORMATEX); break;
|
||||
default:
|
||||
ERR("Unknown value: %lu\n", *lpParam1);
|
||||
return MMDRV_MAP_MSGERROR;
|
||||
}
|
||||
ptr = SEGPTR_ALLOC(sizeof(LPDWORD) + sz);
|
||||
p16 = (LPDWORD)(ptr + sizeof(LPDWORD));
|
||||
|
||||
if (ptr) {
|
||||
*(LPDWORD*)ptr = p32;
|
||||
ret = MMDRV_MAP_OKMEM;
|
||||
} else {
|
||||
ret = MMDRV_MAP_NOMEM;
|
||||
}
|
||||
*lpParam2 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPDWORD);
|
||||
LPDWORD p32 = (LPDWORD)*lpParam2;
|
||||
*lpParam2 = MapLS(p32);
|
||||
ret = MMDRV_MAP_OKMEM;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1224,12 +1207,10 @@ static MMDRV_MapType MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDW
|
|||
LPSTR ptr = (LPSTR)wod16 - sizeof(LPWAVEOPENDESC) - 2*sizeof(DWORD);
|
||||
LPWAVEOPENDESC wod32 = *(LPWAVEOPENDESC*)ptr;
|
||||
|
||||
UnMapLS( *lpParam1 );
|
||||
wod32->uMappedDeviceID = wod16->uMappedDeviceID;
|
||||
**(DWORD**)(ptr + sizeof(LPWAVEOPENDESC)) = *(LPDWORD)(ptr + sizeof(LPWAVEOPENDESC) + sizeof(DWORD));
|
||||
|
||||
if (!SEGPTR_FREE(ptr))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
ret = MMDRV_MAP_OK;
|
||||
}
|
||||
break;
|
||||
|
@ -1247,10 +1228,10 @@ static MMDRV_MapType MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDW
|
|||
wh32->dwUser = wh16->dwUser;
|
||||
wh32->dwFlags = wh16->dwFlags;
|
||||
wh32->dwLoops = wh16->dwLoops;
|
||||
UnMapLS( *lpParam1 );
|
||||
|
||||
if (wMsg == WIDM_UNPREPARE) {
|
||||
if (!SEGPTR_FREE(ptr))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
wh32->lpNext = 0;
|
||||
}
|
||||
ret = MMDRV_MAP_OK;
|
||||
|
@ -1268,8 +1249,8 @@ static MMDRV_MapType MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDW
|
|||
strcpy(wic32->szPname, wic16->szPname);
|
||||
wic32->dwFormats = wic16->dwFormats;
|
||||
wic32->wChannels = wic16->wChannels;
|
||||
if (!SEGPTR_FREE(ptr))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
UnMapLS( *lpParam1 );
|
||||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
ret = MMDRV_MAP_OK;
|
||||
}
|
||||
break;
|
||||
|
@ -1280,33 +1261,14 @@ static MMDRV_MapType MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDW
|
|||
LPMMTIME mmt32 = *(LPMMTIME*)ptr;
|
||||
|
||||
MMSYSTEM_MMTIME16to32(mmt32, mmt16);
|
||||
|
||||
if (!SEGPTR_FREE(ptr))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
|
||||
UnMapLS( *lpParam1 );
|
||||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
ret = MMDRV_MAP_OK;
|
||||
}
|
||||
break;
|
||||
case DRVM_MAPPER_STATUS:
|
||||
{
|
||||
LPDWORD p16 = MapSL(*lpParam2);
|
||||
LPSTR ptr = (LPSTR)p16 - sizeof(LPDWORD);
|
||||
LPDWORD p32 = *(LPDWORD*)ptr;
|
||||
int sz;
|
||||
|
||||
switch (*lpParam1) {
|
||||
case WAVEIN_MAPPER_STATUS_DEVICE: sz = sizeof(DWORD); break;
|
||||
case WAVEIN_MAPPER_STATUS_MAPPED: sz = sizeof(DWORD); break;
|
||||
case WAVEIN_MAPPER_STATUS_FORMAT: sz = sizeof(WAVEFORMATEX); break;
|
||||
default:
|
||||
ERR("Unknown value: %lu\n", *lpParam1);
|
||||
return MMDRV_MAP_MSGERROR;
|
||||
}
|
||||
|
||||
memcpy(p32, p16, sz);
|
||||
if (!SEGPTR_FREE(ptr))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
|
||||
UnMapLS( *lpParam2 );
|
||||
ret = MMDRV_MAP_OK;
|
||||
}
|
||||
break;
|
||||
|
@ -1586,8 +1548,9 @@ static MMDRV_MapType MMDRV_WaveOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
|
||||
case WODM_GETDEVCAPS:
|
||||
{
|
||||
LPWAVEOUTCAPSA woc32 = (LPWAVEOUTCAPSA)*lpParam1;
|
||||
LPSTR ptr = SEGPTR_ALLOC(sizeof(LPWAVEOUTCAPSA) + sizeof(WAVEOUTCAPS16));
|
||||
LPWAVEOUTCAPSA woc32 = (LPWAVEOUTCAPSA)*lpParam1;
|
||||
LPSTR ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPWAVEOUTCAPSA) + sizeof(WAVEOUTCAPS16));
|
||||
|
||||
if (ptr) {
|
||||
*(LPWAVEOUTCAPSA*)ptr = woc32;
|
||||
|
@ -1595,7 +1558,7 @@ static MMDRV_MapType MMDRV_WaveOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
} else {
|
||||
ret = MMDRV_MAP_NOMEM;
|
||||
}
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEOUTCAPSA);
|
||||
*lpParam1 = MapLS(ptr) + sizeof(LPWAVEOUTCAPSA);
|
||||
*lpParam2 = sizeof(WAVEOUTCAPS16);
|
||||
}
|
||||
break;
|
||||
|
@ -1609,9 +1572,9 @@ static MMDRV_MapType MMDRV_WaveOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
break;
|
||||
case WODM_GETPOS:
|
||||
{
|
||||
LPMMTIME mmt32 = (LPMMTIME)*lpParam1;
|
||||
LPSTR ptr = SEGPTR_ALLOC(sizeof(LPMMTIME) + sizeof(MMTIME16));
|
||||
LPMMTIME16 mmt16 = (LPMMTIME16)(ptr + sizeof(LPMMTIME));
|
||||
LPMMTIME mmt32 = (LPMMTIME)*lpParam1;
|
||||
LPSTR ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(LPMMTIME) + sizeof(MMTIME16));
|
||||
LPMMTIME16 mmt16 = (LPMMTIME16)(ptr + sizeof(LPMMTIME));
|
||||
|
||||
if (ptr) {
|
||||
*(LPMMTIME*)ptr = mmt32;
|
||||
|
@ -1620,7 +1583,7 @@ static MMDRV_MapType MMDRV_WaveOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
} else {
|
||||
ret = MMDRV_MAP_NOMEM;
|
||||
}
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPMMTIME);
|
||||
*lpParam1 = MapLS(ptr) + sizeof(LPMMTIME);
|
||||
*lpParam2 = sizeof(MMTIME16);
|
||||
}
|
||||
break;
|
||||
|
@ -1648,15 +1611,17 @@ static MMDRV_MapType MMDRV_WaveOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
sz += ((LPWAVEFORMATEX)wod32->lpFormat)->cbSize;
|
||||
}
|
||||
|
||||
ptr = SEGPTR_ALLOC(sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD) + sizeof(WAVEOPENDESC16) + sz);
|
||||
ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD) + sizeof(WAVEOPENDESC16) + sz);
|
||||
|
||||
if (ptr) {
|
||||
SEGPTR seg_ptr = MapLS( ptr );
|
||||
*(LPWAVEOPENDESC*)ptr = wod32;
|
||||
*(LPDWORD)(ptr + sizeof(LPWAVEOPENDESC)) = *lpdwUser;
|
||||
wod16 = (LPWAVEOPENDESC16)((LPSTR)ptr + sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD));
|
||||
|
||||
wod16->hWave = wod32->hWave;
|
||||
wod16->lpFormat = (LPWAVEFORMATEX)((DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD) + sizeof(WAVEOPENDESC16));
|
||||
wod16->lpFormat = (LPWAVEFORMATEX)(seg_ptr + sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD) + sizeof(WAVEOPENDESC16));
|
||||
memcpy(wod16 + 1, wod32->lpFormat, sz);
|
||||
|
||||
wod16->dwCallback = wod32->dwCallback;
|
||||
|
@ -1664,8 +1629,8 @@ static MMDRV_MapType MMDRV_WaveOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
wod16->uMappedDeviceID = wod32->uMappedDeviceID;
|
||||
wod16->dnDevNode = wod32->dnDevNode;
|
||||
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD);
|
||||
*lpdwUser = (DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEOPENDESC) + sizeof(DWORD);
|
||||
*lpParam1 = seg_ptr + sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD);
|
||||
*lpdwUser = seg_ptr + sizeof(LPWAVEOPENDESC) + sizeof(DWORD);
|
||||
|
||||
ret = MMDRV_MAP_OKMEM;
|
||||
} else {
|
||||
|
@ -1677,12 +1642,14 @@ static MMDRV_MapType MMDRV_WaveOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
{
|
||||
LPWAVEHDR wh32 = (LPWAVEHDR)*lpParam1;
|
||||
LPWAVEHDR wh16;
|
||||
LPVOID ptr = SEGPTR_ALLOC(sizeof(LPWAVEHDR) + sizeof(WAVEHDR) + wh32->dwBufferLength);
|
||||
LPVOID ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPWAVEHDR) + sizeof(WAVEHDR) + wh32->dwBufferLength);
|
||||
|
||||
if (ptr) {
|
||||
SEGPTR seg_ptr = MapLS( ptr );
|
||||
*(LPWAVEHDR*)ptr = wh32;
|
||||
wh16 = (LPWAVEHDR)((LPSTR)ptr + sizeof(LPWAVEHDR));
|
||||
wh16->lpData = (LPSTR)SEGPTR_GET(ptr) + sizeof(LPWAVEHDR) + sizeof(WAVEHDR);
|
||||
wh16->lpData = (LPSTR)seg_ptr + sizeof(LPWAVEHDR) + sizeof(WAVEHDR);
|
||||
/* data will be copied on WODM_WRITE */
|
||||
wh16->dwBufferLength = wh32->dwBufferLength;
|
||||
wh16->dwBytesRecorded = wh32->dwBytesRecorded;
|
||||
|
@ -1693,9 +1660,9 @@ static MMDRV_MapType MMDRV_WaveOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
/* could link the wh32->lpNext at this level for memory house keeping */
|
||||
wh32->lpNext = wh16; /* for reuse in unprepare and write */
|
||||
TRACE("wh16=%08lx wh16->lpData=%08lx wh32->buflen=%lu wh32->lpData=%08lx\n",
|
||||
(DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEHDR), (DWORD)wh16->lpData,
|
||||
seg_ptr + sizeof(LPWAVEHDR), (DWORD)wh16->lpData,
|
||||
wh32->dwBufferLength, (DWORD)wh32->lpData);
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEHDR);
|
||||
*lpParam1 = seg_ptr + sizeof(LPWAVEHDR);
|
||||
*lpParam2 = sizeof(WAVEHDR);
|
||||
|
||||
ret = MMDRV_MAP_OKMEM;
|
||||
|
@ -1710,17 +1677,18 @@ static MMDRV_MapType MMDRV_WaveOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
LPWAVEHDR wh32 = (LPWAVEHDR)(*lpParam1);
|
||||
LPWAVEHDR wh16 = wh32->lpNext;
|
||||
LPSTR ptr = (LPSTR)wh16 - sizeof(LPWAVEHDR);
|
||||
SEGPTR seg_ptr = MapLS( ptr );
|
||||
|
||||
assert(*(LPWAVEHDR*)ptr == wh32);
|
||||
|
||||
TRACE("wh16=%08lx wh16->lpData=%08lx wh32->buflen=%lu wh32->lpData=%08lx\n",
|
||||
(DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEHDR), (DWORD)wh16->lpData,
|
||||
seg_ptr + sizeof(LPWAVEHDR), (DWORD)wh16->lpData,
|
||||
wh32->dwBufferLength, (DWORD)wh32->lpData);
|
||||
|
||||
if (wMsg == WODM_WRITE)
|
||||
memcpy((LPSTR)wh16 + sizeof(WAVEHDR), wh32->lpData, wh32->dwBufferLength);
|
||||
|
||||
*lpParam1 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPWAVEHDR);
|
||||
*lpParam1 = seg_ptr + sizeof(LPWAVEHDR);
|
||||
*lpParam2 = sizeof(WAVEHDR);
|
||||
/* dwBufferLength can be reduced between prepare & write */
|
||||
if (wh16->dwBufferLength < wh32->dwBufferLength) {
|
||||
|
@ -1734,30 +1702,9 @@ static MMDRV_MapType MMDRV_WaveOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
break;
|
||||
case DRVM_MAPPER_STATUS:
|
||||
{
|
||||
LPDWORD p32 = (LPDWORD)*lpParam2;
|
||||
int sz;
|
||||
LPSTR ptr;
|
||||
LPDWORD p16;
|
||||
|
||||
switch (*lpParam1) {
|
||||
case WAVEOUT_MAPPER_STATUS_DEVICE: sz = sizeof(DWORD); break;
|
||||
case WAVEOUT_MAPPER_STATUS_MAPPED: sz = sizeof(DWORD); break;
|
||||
case WAVEOUT_MAPPER_STATUS_FORMAT: sz = sizeof(WAVEFORMATEX); break;
|
||||
default:
|
||||
ERR("Unknown value: %lu\n", *lpParam1);
|
||||
return MMDRV_MAP_MSGERROR;
|
||||
}
|
||||
ptr = SEGPTR_ALLOC(sizeof(LPDWORD) + sz);
|
||||
p16 = (LPDWORD)(ptr + sizeof(LPDWORD));
|
||||
|
||||
if (ptr) {
|
||||
*(LPDWORD*)ptr = p32;
|
||||
memcpy(p16, p32, sz);
|
||||
ret = MMDRV_MAP_OKMEM;
|
||||
} else {
|
||||
ret = MMDRV_MAP_NOMEM;
|
||||
}
|
||||
*lpParam2 = (DWORD)SEGPTR_GET(ptr) + sizeof(LPDWORD);
|
||||
LPDWORD p32 = (LPDWORD)*lpParam2;
|
||||
*lpParam2 = MapLS(p32);
|
||||
ret = MMDRV_MAP_OKMEM;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1802,8 +1749,8 @@ static MMDRV_MapType MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
woc32->dwFormats = woc16->dwFormats;
|
||||
woc32->wChannels = woc16->wChannels;
|
||||
woc32->dwSupport = woc16->dwSupport;
|
||||
if (!SEGPTR_FREE(ptr))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
UnMapLS( *lpParam1 );
|
||||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
ret = MMDRV_MAP_OK;
|
||||
}
|
||||
break;
|
||||
|
@ -1822,10 +1769,8 @@ static MMDRV_MapType MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
LPMMTIME mmt32 = *(LPMMTIME*)ptr;
|
||||
|
||||
MMSYSTEM_MMTIME16to32(mmt32, mmt16);
|
||||
|
||||
if (!SEGPTR_FREE(ptr))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
|
||||
UnMapLS( *lpParam1 );
|
||||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
ret = MMDRV_MAP_OK;
|
||||
}
|
||||
break;
|
||||
|
@ -1837,10 +1782,8 @@ static MMDRV_MapType MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
|
||||
wod32->uMappedDeviceID = wod16->uMappedDeviceID;
|
||||
**(DWORD**)(ptr + sizeof(LPWAVEOPENDESC)) = *(LPDWORD)(ptr + sizeof(LPWAVEOPENDESC) + sizeof(DWORD));
|
||||
|
||||
if (!SEGPTR_FREE(ptr))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
|
||||
UnMapLS( *lpParam1 );
|
||||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
ret = MMDRV_MAP_OK;
|
||||
}
|
||||
break;
|
||||
|
@ -1858,9 +1801,9 @@ static MMDRV_MapType MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
wh32->dwFlags = wh16->dwFlags;
|
||||
wh32->dwLoops = wh16->dwLoops;
|
||||
|
||||
UnMapLS( *lpParam1 );
|
||||
if (wMsg == WODM_UNPREPARE) {
|
||||
if (!SEGPTR_FREE(ptr))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
wh32->lpNext = 0;
|
||||
}
|
||||
ret = MMDRV_MAP_OK;
|
||||
|
@ -1872,24 +1815,7 @@ static MMDRV_MapType MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD
|
|||
break;
|
||||
case DRVM_MAPPER_STATUS:
|
||||
{
|
||||
LPDWORD p16 = MapSL(*lpParam2);
|
||||
LPSTR ptr = (LPSTR)p16 - sizeof(LPDWORD);
|
||||
LPDWORD p32 = *(LPDWORD*)ptr;
|
||||
int sz;
|
||||
|
||||
switch (*lpParam1) {
|
||||
case WAVEOUT_MAPPER_STATUS_DEVICE: sz = sizeof(DWORD); break;
|
||||
case WAVEOUT_MAPPER_STATUS_MAPPED: sz = sizeof(DWORD); break;
|
||||
case WAVEOUT_MAPPER_STATUS_FORMAT: sz = sizeof(WAVEFORMATEX); break;
|
||||
default:
|
||||
ERR("Unknown value: %lu\n", *lpParam1);
|
||||
return MMDRV_MAP_MSGERROR;
|
||||
}
|
||||
|
||||
memcpy(p32, p16, sz);
|
||||
if (!SEGPTR_FREE(ptr))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
|
||||
UnMapLS( *lpParam2 );
|
||||
ret = MMDRV_MAP_OK;
|
||||
}
|
||||
break;
|
||||
|
|
197
dlls/winmm/mci.c
197
dlls/winmm/mci.c
|
@ -19,10 +19,9 @@
|
|||
#include "wine/mmsystem16.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "digitalv.h"
|
||||
#include "heap.h"
|
||||
#include "winemm.h"
|
||||
|
||||
#include "debugtools.h"
|
||||
#include "debugtools.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(mci);
|
||||
|
||||
|
@ -1056,9 +1055,12 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpwstrCommand, LPSTR lpstrRet,
|
|||
{
|
||||
LPSTR lpstrCommand;
|
||||
UINT ret;
|
||||
INT len;
|
||||
|
||||
/* FIXME: is there something to do with lpstrReturnString ? */
|
||||
lpstrCommand = HEAP_strdupWtoA(GetProcessHeap(), 0, lpwstrCommand);
|
||||
len = WideCharToMultiByte( CP_ACP, 0, lpwstrCommand, -1, NULL, 0, NULL, NULL );
|
||||
lpstrCommand = HeapAlloc( GetProcessHeap(), 0, len );
|
||||
WideCharToMultiByte( CP_ACP, 0, lpwstrCommand, -1, lpstrCommand, len, NULL, NULL );
|
||||
ret = mciSendStringA(lpstrCommand, lpstrRet, uRetLen, hwndCallback);
|
||||
HeapFree(GetProcessHeap(), 0, lpstrCommand);
|
||||
return ret;
|
||||
|
@ -1476,7 +1478,7 @@ static MCI_MapType MCI_UnMapMsg16To32A(WORD uDevType, WORD wMsg, DWORD lParam)
|
|||
*/
|
||||
static MCI_MapType MCI_MsgMapper32To16_Create(void** ptr, int size16, DWORD map, BOOLEAN keep)
|
||||
{
|
||||
void* lp = SEGPTR_ALLOC((keep ? sizeof(void**) : 0) + size16);
|
||||
void* lp = HeapAlloc( GetProcessHeap(), 0, (keep ? sizeof(void**) : 0) + size16 );
|
||||
LPBYTE p16, p32;
|
||||
|
||||
if (!lp) {
|
||||
|
@ -1486,10 +1488,10 @@ static MCI_MapType MCI_MsgMapper32To16_Create(void** ptr, int size16, DWORD map,
|
|||
if (keep) {
|
||||
*(void**)lp = *ptr;
|
||||
p16 = (LPBYTE)lp + sizeof(void**);
|
||||
*ptr = (char*)SEGPTR_GET(lp) + sizeof(void**);
|
||||
*ptr = (char*)MapLS(lp) + sizeof(void**);
|
||||
} else {
|
||||
p16 = lp;
|
||||
*ptr = (void*)SEGPTR_GET(lp);
|
||||
*ptr = (void*)MapLS(lp);
|
||||
}
|
||||
|
||||
if (map == 0) {
|
||||
|
@ -1508,11 +1510,32 @@ static MCI_MapType MCI_MsgMapper32To16_Create(void** ptr, int size16, DWORD map,
|
|||
size16 -= sz; /* DEBUG only */
|
||||
} else {
|
||||
switch (nibble) {
|
||||
case 0x1: *( LPINT16)p16 = ( INT16)*( LPINT16)p32; p16 += 2; p32 += 4; size16 -= 2; break;
|
||||
case 0x2: *(LPUINT16)p16 = (UINT16)*(LPUINT16)p32; p16 += 2; p32 += 4; size16 -= 2; break;
|
||||
case 0x6: *(LPDWORD)p16 = 0; p16 += 4; p32 += 4; size16 -= 4; break;
|
||||
case 0x7: *(LPDWORD)p16 = SEGPTR_GET(SEGPTR_STRDUP(*(LPSTR*)p32));p16 += 4; p32 += 4; size16 -= 4; break;
|
||||
default: FIXME("Unknown nibble for mapping (%x)\n", nibble);
|
||||
case 0x1:
|
||||
*(LPINT16)p16 = *(LPINT)p32;
|
||||
p16 += sizeof(INT16);
|
||||
p32 += sizeof(INT);
|
||||
size16 -= sizeof(INT16);
|
||||
break;
|
||||
case 0x2:
|
||||
*(LPUINT16)p16 = *(LPUINT)p32;
|
||||
p16 += sizeof(UINT16);
|
||||
p32 += sizeof(UINT);
|
||||
size16 -= sizeof(UINT16);
|
||||
break;
|
||||
case 0x6:
|
||||
*(LPDWORD)p16 = 0;
|
||||
p16 += sizeof(DWORD);
|
||||
p32 += sizeof(DWORD);
|
||||
size16 -= sizeof(DWORD);
|
||||
break;
|
||||
case 0x7:
|
||||
*(SEGPTR *)p16 = MapLS( *(LPSTR *)p32 );
|
||||
p16 += sizeof(SEGPTR);
|
||||
p32 += sizeof(LPSTR);
|
||||
size16 -= sizeof(SEGPTR);
|
||||
break;
|
||||
default:
|
||||
FIXME("Unknown nibble for mapping (%x)\n", nibble);
|
||||
}
|
||||
}
|
||||
map >>= 4;
|
||||
|
@ -1536,6 +1559,7 @@ static MCI_MapType MCI_MsgMapper32To16_Destroy(void* ptr, int size16, DWORD map,
|
|||
LPBYTE p32, p16;
|
||||
unsigned nibble;
|
||||
|
||||
UnMapLS( (SEGPTR)ptr );
|
||||
if (kept) {
|
||||
alloc = (char*)msg16 - sizeof(void**);
|
||||
p32 = *(void**)alloc;
|
||||
|
@ -1553,15 +1577,31 @@ static MCI_MapType MCI_MsgMapper32To16_Destroy(void* ptr, int size16, DWORD map,
|
|||
size16 -= (nibble & 7) + 1;
|
||||
} else {
|
||||
switch (nibble) {
|
||||
case 0x1: *( LPINT)p32 = *( LPINT16)p16; p16 += 2; p32 += 4; size16 -= 2; break;
|
||||
case 0x2: *(LPUINT)p32 = *(LPUINT16)p16; p16 += 2; p32 += 4; size16 -= 2; break;
|
||||
case 0x6: p16 += 4; p32 += 4; size16 -= 4; break;
|
||||
case 0x7: strcpy(*(LPSTR*)p32, MapSL(*(DWORD*)p16));
|
||||
if (!SEGPTR_FREE(MapSL(*(DWORD*)p16))) {
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
}
|
||||
p16 += 4; p32 += 4; size16 -= 4; break;
|
||||
default: FIXME("Unknown nibble for mapping (%x)\n", nibble);
|
||||
case 0x1:
|
||||
*(LPINT)p32 = *(LPINT16)p16;
|
||||
p16 += sizeof(INT16);
|
||||
p32 += sizeof(INT);
|
||||
size16 -= sizeof(INT16);
|
||||
break;
|
||||
case 0x2:
|
||||
*(LPUINT)p32 = *(LPUINT16)p16;
|
||||
p16 += sizeof(UINT16);
|
||||
p32 += sizeof(UINT);
|
||||
size16 -= sizeof(UINT16);
|
||||
break;
|
||||
case 0x6:
|
||||
p16 += sizeof(UINT);
|
||||
p32 += sizeof(UINT);
|
||||
size16 -= sizeof(UINT);
|
||||
break;
|
||||
case 0x7:
|
||||
UnMapLS( *(SEGPTR *)p16 );
|
||||
p16 += sizeof(SEGPTR);
|
||||
p32 += sizeof(char*);
|
||||
size16 -= sizeof(SEGPTR);
|
||||
break;
|
||||
default:
|
||||
FIXME("Unknown nibble for mapping (%x)\n", nibble);
|
||||
}
|
||||
}
|
||||
map >>= 4;
|
||||
|
@ -1573,10 +1613,8 @@ static MCI_MapType MCI_MsgMapper32To16_Destroy(void* ptr, int size16, DWORD map,
|
|||
alloc = msg16;
|
||||
}
|
||||
|
||||
if (!SEGPTR_FREE(alloc)) {
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
}
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, alloc );
|
||||
}
|
||||
return MCI_MAP_OK;
|
||||
}
|
||||
|
||||
|
@ -1640,20 +1678,17 @@ static MCI_MapType MCI_MapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DW
|
|||
case MCI_INFO:
|
||||
{
|
||||
LPMCI_INFO_PARMSA mip32a = (LPMCI_INFO_PARMSA)(*lParam);
|
||||
char* ptr;
|
||||
LPMCI_INFO_PARMS16 mip16;
|
||||
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_INFO_PARMS16); break;
|
||||
default: size = sizeof(MCI_INFO_PARMS16); break;
|
||||
}
|
||||
ptr = SEGPTR_ALLOC(sizeof(LPMCI_INFO_PARMSA) + size);
|
||||
|
||||
if (ptr) {
|
||||
*(LPMCI_INFO_PARMSA*)ptr = mip32a;
|
||||
mip16 = (LPMCI_INFO_PARMS16)(ptr + sizeof(LPMCI_INFO_PARMSA));
|
||||
mip16 = HeapAlloc( GetProcessHeap(), 0, size);
|
||||
if (mip16)
|
||||
{
|
||||
mip16->dwCallback = mip32a->dwCallback;
|
||||
mip16->lpstrReturn = SEGPTR_GET(SEGPTR_ALLOC(mip32a->dwRetSize));
|
||||
mip16->lpstrReturn = MapLS( mip32a->lpstrReturn );
|
||||
mip16->dwRetSize = mip32a->dwRetSize;
|
||||
if (uDevType == MCI_DEVTYPE_DIGITAL_VIDEO) {
|
||||
((LPMCI_DGV_INFO_PARMS16)mip16)->dwItem = ((LPMCI_DGV_INFO_PARMSA)mip32a)->dwItem;
|
||||
|
@ -1661,7 +1696,7 @@ static MCI_MapType MCI_MapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DW
|
|||
} else {
|
||||
return MCI_MAP_NOMEM;
|
||||
}
|
||||
*lParam = (LPARAM)SEGPTR_GET(ptr) + sizeof(LPMCI_INFO_PARMSA);
|
||||
*lParam = MapLS(mip16);
|
||||
}
|
||||
return MCI_MAP_OKMEM;
|
||||
/* case MCI_MARK: */
|
||||
|
@ -1670,7 +1705,8 @@ static MCI_MapType MCI_MapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DW
|
|||
case MCI_OPEN_DRIVER:
|
||||
{
|
||||
LPMCI_OPEN_PARMSA mop32a = (LPMCI_OPEN_PARMSA)(*lParam);
|
||||
char* ptr = SEGPTR_ALLOC(sizeof(LPMCI_OPEN_PARMSA) + sizeof(MCI_OPEN_PARMS16) + 2 * sizeof(DWORD));
|
||||
char* ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPMCI_OPEN_PARMSA) + sizeof(MCI_OPEN_PARMS16) + 2 * sizeof(DWORD));
|
||||
LPMCI_OPEN_PARMS16 mop16;
|
||||
|
||||
|
||||
|
@ -1685,7 +1721,7 @@ static MCI_MapType MCI_MapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DW
|
|||
mop16->lpstrDeviceType = (SEGPTR)mop32a->lpstrDeviceType;
|
||||
} else {
|
||||
/* string */
|
||||
mop16->lpstrDeviceType = mop32a->lpstrDeviceType ? SEGPTR_GET(SEGPTR_STRDUP(mop32a->lpstrDeviceType)) : 0;
|
||||
mop16->lpstrDeviceType = MapLS( mop32a->lpstrDeviceType );
|
||||
}
|
||||
} else {
|
||||
/* nuthin' */
|
||||
|
@ -1695,13 +1731,13 @@ static MCI_MapType MCI_MapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DW
|
|||
if (dwFlags & MCI_OPEN_ELEMENT_ID) {
|
||||
mop16->lpstrElementName = (SEGPTR)mop32a->lpstrElementName;
|
||||
} else {
|
||||
mop16->lpstrElementName = mop32a->lpstrElementName ? SEGPTR_GET(SEGPTR_STRDUP(mop32a->lpstrElementName)) : 0;
|
||||
mop16->lpstrElementName = MapLS( mop32a->lpstrElementName );
|
||||
}
|
||||
} else {
|
||||
mop16->lpstrElementName = 0;
|
||||
}
|
||||
if (dwFlags & MCI_OPEN_ALIAS) {
|
||||
mop16->lpstrAlias = mop32a->lpstrAlias ? SEGPTR_GET(SEGPTR_STRDUP(mop32a->lpstrAlias)) : 0;
|
||||
mop16->lpstrAlias = MapLS( mop32a->lpstrAlias );
|
||||
} else {
|
||||
mop16->lpstrAlias = 0;
|
||||
}
|
||||
|
@ -1717,7 +1753,7 @@ static MCI_MapType MCI_MapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DW
|
|||
} else {
|
||||
return MCI_MAP_NOMEM;
|
||||
}
|
||||
*lParam = (LPARAM)SEGPTR_GET(ptr) + sizeof(LPMCI_OPEN_PARMSA);
|
||||
*lParam = (LPARAM)MapLS(ptr) + sizeof(LPMCI_OPEN_PARMSA);
|
||||
}
|
||||
return MCI_MAP_OKMEM;
|
||||
/* case MCI_PASTE:*/
|
||||
|
@ -1803,23 +1839,24 @@ static MCI_MapType MCI_MapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DW
|
|||
break;
|
||||
case MCI_SYSINFO:
|
||||
{
|
||||
LPMCI_SYSINFO_PARMSA msip32a = (LPMCI_SYSINFO_PARMSA)(*lParam);
|
||||
char* ptr = SEGPTR_ALLOC(sizeof(LPMCI_SYSINFO_PARMSA) + sizeof(MCI_SYSINFO_PARMS16));
|
||||
LPMCI_SYSINFO_PARMS16 msip16;
|
||||
LPMCI_SYSINFO_PARMSA msip32a = (LPMCI_SYSINFO_PARMSA)(*lParam);
|
||||
LPMCI_SYSINFO_PARMS16 msip16;
|
||||
char* ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPMCI_SYSINFO_PARMSA) + sizeof(MCI_SYSINFO_PARMS16) );
|
||||
|
||||
if (ptr) {
|
||||
*(LPMCI_SYSINFO_PARMSA*)(ptr) = msip32a;
|
||||
msip16 = (LPMCI_SYSINFO_PARMS16)(ptr + sizeof(LPMCI_SYSINFO_PARMSA));
|
||||
|
||||
msip16->dwCallback = msip32a->dwCallback;
|
||||
msip16->lpstrReturn = SEGPTR_GET(SEGPTR_ALLOC(msip32a->dwRetSize));
|
||||
msip16->lpstrReturn = MapLS( msip32a->lpstrReturn );
|
||||
msip16->dwRetSize = msip32a->dwRetSize;
|
||||
msip16->dwNumber = msip32a->dwNumber;
|
||||
msip16->wDeviceType = msip32a->wDeviceType;
|
||||
} else {
|
||||
return MCI_MAP_NOMEM;
|
||||
}
|
||||
*lParam = (LPARAM)SEGPTR_GET(ptr) + sizeof(LPMCI_SYSINFO_PARMSA);
|
||||
*lParam = (LPARAM)MapLS(ptr) + sizeof(LPMCI_SYSINFO_PARMSA);
|
||||
}
|
||||
return MCI_MAP_OKMEM;
|
||||
/* case MCI_UNDO: */
|
||||
|
@ -1852,21 +1889,21 @@ static MCI_MapType MCI_MapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DW
|
|||
break;
|
||||
case DRV_OPEN:
|
||||
{
|
||||
LPMCI_OPEN_DRIVER_PARMSA modp32a = (LPMCI_OPEN_DRIVER_PARMSA)(*lParam);
|
||||
char* ptr = SEGPTR_ALLOC(sizeof(LPMCI_OPEN_DRIVER_PARMSA) + sizeof(MCI_OPEN_DRIVER_PARMS16));
|
||||
LPMCI_OPEN_DRIVER_PARMS16 modp16;
|
||||
|
||||
LPMCI_OPEN_DRIVER_PARMSA modp32a = (LPMCI_OPEN_DRIVER_PARMSA)(*lParam);
|
||||
LPMCI_OPEN_DRIVER_PARMS16 modp16;
|
||||
char *ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPMCI_OPEN_DRIVER_PARMSA) + sizeof(MCI_OPEN_DRIVER_PARMS16));
|
||||
|
||||
if (ptr) {
|
||||
*(LPMCI_OPEN_DRIVER_PARMSA*)(ptr) = modp32a;
|
||||
modp16 = (LPMCI_OPEN_DRIVER_PARMS16)(ptr + sizeof(LPMCI_OPEN_DRIVER_PARMSA));
|
||||
modp16->wDeviceID = modp32a->wDeviceID;
|
||||
modp16->lpstrParams = modp32a->lpstrParams ? SEGPTR_GET(SEGPTR_STRDUP(modp32a->lpstrParams)) : 0;
|
||||
modp16->lpstrParams = MapLS( modp32a->lpstrParams );
|
||||
/* other fields are gonna be filled by the driver, don't copy them */
|
||||
} else {
|
||||
return MCI_MAP_NOMEM;
|
||||
}
|
||||
*lParam = (LPARAM)SEGPTR_GET(ptr) + sizeof(LPMCI_OPEN_DRIVER_PARMSA);
|
||||
*lParam = (LPARAM)MapLS(ptr) + sizeof(LPMCI_OPEN_DRIVER_PARMSA);
|
||||
}
|
||||
return MCI_MAP_OKMEM;
|
||||
case DRV_LOAD:
|
||||
|
@ -1923,15 +1960,10 @@ static MCI_MapType MCI_UnMapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags,
|
|||
/* case MCI_INDEX: */
|
||||
case MCI_INFO:
|
||||
{
|
||||
LPMCI_INFO_PARMS16 mip16 = (LPMCI_INFO_PARMS16)MapSL(lParam);
|
||||
LPMCI_INFO_PARMSA mip32a = *(LPMCI_INFO_PARMSA*)((char*)mip16 - sizeof(LPMCI_INFO_PARMSA));
|
||||
|
||||
memcpy(mip32a->lpstrReturn, MapSL(mip16->lpstrReturn), mip32a->dwRetSize);
|
||||
|
||||
if (!SEGPTR_FREE(MapSL(mip16->lpstrReturn)))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
if (!SEGPTR_FREE((char*)mip16 - sizeof(LPMCI_INFO_PARMSA)))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
LPMCI_INFO_PARMS16 mip16 = (LPMCI_INFO_PARMS16)MapSL(lParam);
|
||||
UnMapLS( lParam );
|
||||
UnMapLS( mip16->lpstrReturn );
|
||||
HeapFree( GetProcessHeap(), 0, mip16 );
|
||||
}
|
||||
return MCI_MAP_OK;
|
||||
/* case MCI_MARK: */
|
||||
|
@ -1941,22 +1973,15 @@ static MCI_MapType MCI_UnMapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags,
|
|||
if (lParam) {
|
||||
LPMCI_OPEN_PARMS16 mop16 = (LPMCI_OPEN_PARMS16)MapSL(lParam);
|
||||
LPMCI_OPEN_PARMSA mop32a = *(LPMCI_OPEN_PARMSA*)((char*)mop16 - sizeof(LPMCI_OPEN_PARMSA));
|
||||
|
||||
UnMapLS( lParam );
|
||||
mop32a->wDeviceID = mop16->wDeviceID;
|
||||
if ((dwFlags & MCI_OPEN_TYPE) && !
|
||||
(dwFlags & MCI_OPEN_TYPE_ID) &&
|
||||
!SEGPTR_FREE(MapSL(mop16->lpstrDeviceType)))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
if ((dwFlags & MCI_OPEN_ELEMENT) &&
|
||||
!(dwFlags & MCI_OPEN_ELEMENT_ID) &&
|
||||
!SEGPTR_FREE(MapSL(mop16->lpstrElementName)))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
if ((dwFlags & MCI_OPEN_ALIAS) &&
|
||||
!SEGPTR_FREE(MapSL(mop16->lpstrAlias)))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
|
||||
if (!SEGPTR_FREE((char*)mop16 - sizeof(LPMCI_OPEN_PARMSA)))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
if ((dwFlags & MCI_OPEN_TYPE) && !(dwFlags & MCI_OPEN_TYPE_ID))
|
||||
UnMapLS( mop16->lpstrDeviceType );
|
||||
if ((dwFlags & MCI_OPEN_ELEMENT) && !(dwFlags & MCI_OPEN_ELEMENT_ID))
|
||||
UnMapLS( mop16->lpstrElementName );
|
||||
if (dwFlags & MCI_OPEN_ALIAS)
|
||||
UnMapLS( mop16->lpstrAlias );
|
||||
HeapFree( GetProcessHeap(), 0, (char*)mop16 - sizeof(LPMCI_OPEN_PARMSA) );
|
||||
}
|
||||
return MCI_MAP_OK;
|
||||
/* case MCI_PASTE:*/
|
||||
|
@ -1994,18 +2019,15 @@ static MCI_MapType MCI_UnMapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags,
|
|||
LPMCI_DGV_STATUS_PARMS16 mdsp16 = (LPMCI_DGV_STATUS_PARMS16)MapSL(lParam);
|
||||
LPMCI_DGV_STATUS_PARMSA mdsp32a = *(LPMCI_DGV_STATUS_PARMSA*)((char*)mdsp16 - sizeof(LPMCI_DGV_STATUS_PARMSA));
|
||||
|
||||
UnMapLS( lParam );
|
||||
if (mdsp16) {
|
||||
mdsp32a->dwReturn = mdsp16->dwReturn;
|
||||
if (dwFlags & MCI_DGV_STATUS_DISKSPACE) {
|
||||
TRACE("MCI_STATUS (DGV) lpstrDrive=%08lx\n", mdsp16->lpstrDrive);
|
||||
TRACE("MCI_STATUS (DGV) lpstrDrive=%s\n", (LPSTR)MapSL(mdsp16->lpstrDrive));
|
||||
|
||||
/* FIXME: see map function */
|
||||
strcpy(mdsp32a->lpstrDrive, (LPSTR)MapSL(mdsp16->lpstrDrive));
|
||||
UnMapLS( mdsp16->lpstrDrive );
|
||||
}
|
||||
|
||||
if (!SEGPTR_FREE((char*)mdsp16 - sizeof(LPMCI_DGV_STATUS_PARMSA)))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
HeapFree( GetProcessHeap(), 0, (char*)mdsp16 - sizeof(LPMCI_DGV_STATUS_PARMSA) );
|
||||
} else {
|
||||
return MCI_MAP_NOMEM;
|
||||
}
|
||||
|
@ -2024,14 +2046,11 @@ static MCI_MapType MCI_UnMapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags,
|
|||
LPMCI_SYSINFO_PARMS16 msip16 = (LPMCI_SYSINFO_PARMS16)MapSL(lParam);
|
||||
LPMCI_SYSINFO_PARMSA msip32a = *(LPMCI_SYSINFO_PARMSA*)((char*)msip16 - sizeof(LPMCI_SYSINFO_PARMSA));
|
||||
|
||||
UnMapLS( lParam );
|
||||
if (msip16) {
|
||||
msip16->dwCallback = msip32a->dwCallback;
|
||||
memcpy(msip32a->lpstrReturn, MapSL(msip16->lpstrReturn), msip32a->dwRetSize);
|
||||
if (!SEGPTR_FREE(MapSL(msip16->lpstrReturn)))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
|
||||
if (!SEGPTR_FREE((char*)msip16 - sizeof(LPMCI_SYSINFO_PARMSA)))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
msip16->dwCallback = msip32a->dwCallback;
|
||||
UnMapLS( msip16->lpstrReturn );
|
||||
HeapFree( GetProcessHeap(), 0, (char*)msip16 - sizeof(LPMCI_SYSINFO_PARMSA) );
|
||||
} else {
|
||||
return MCI_MAP_NOMEM;
|
||||
}
|
||||
|
@ -2062,12 +2081,12 @@ static MCI_MapType MCI_UnMapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags,
|
|||
if (lParam) {
|
||||
LPMCI_OPEN_DRIVER_PARMS16 modp16 = (LPMCI_OPEN_DRIVER_PARMS16)MapSL(lParam);
|
||||
LPMCI_OPEN_DRIVER_PARMSA modp32a = *(LPMCI_OPEN_DRIVER_PARMSA*)((char*)modp16 - sizeof(LPMCI_OPEN_DRIVER_PARMSA));
|
||||
|
||||
|
||||
UnMapLS( lParam );
|
||||
modp32a->wCustomCommandTable = modp16->wCustomCommandTable;
|
||||
modp32a->wType = modp16->wType;
|
||||
|
||||
if (modp16->lpstrParams && !SEGPTR_FREE(MapSL(modp16->lpstrParams)))
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
UnMapLS( modp16->lpstrParams );
|
||||
HeapFree( GetProcessHeap(), 0, (char *)modp16 - sizeof(LPMCI_OPEN_DRIVER_PARMSA) );
|
||||
}
|
||||
return MCI_MAP_OK;
|
||||
case DRV_LOAD:
|
||||
|
|
|
@ -338,28 +338,15 @@ static LPMMIOPROC MMIO_InstallIOProc(FOURCC fccIOProc, LPMMIOPROC pIOProc,
|
|||
static LRESULT MMIO_Map32To16(DWORD wMsg, LPARAM* lp1, LPARAM* lp2)
|
||||
{
|
||||
switch (wMsg) {
|
||||
case MMIOM_OPEN:
|
||||
{
|
||||
char *lp = SEGPTR_STRDUP( (LPSTR)*lp1 );
|
||||
if (!lp) return MMSYSERR_NOMEM;
|
||||
*lp1 = SEGPTR_GET(lp);
|
||||
}
|
||||
break;
|
||||
case MMIOM_CLOSE:
|
||||
case MMIOM_SEEK:
|
||||
/* nothing to do */
|
||||
break;
|
||||
case MMIOM_OPEN:
|
||||
case MMIOM_READ:
|
||||
case MMIOM_WRITE:
|
||||
case MMIOM_WRITEFLUSH:
|
||||
{
|
||||
void* lp = SEGPTR_ALLOC(*lp2);
|
||||
if (!lp) return MMSYSERR_NOMEM;
|
||||
|
||||
if (wMsg != MMIOM_READ)
|
||||
memcpy(lp, (void*)*lp1, *lp2);
|
||||
*lp1 = SEGPTR_GET(lp);
|
||||
}
|
||||
*lp1 = MapLS( (void *)*lp1 );
|
||||
break;
|
||||
default:
|
||||
TRACE("Not a mappable message (%ld)\n", wMsg);
|
||||
|
@ -374,23 +361,15 @@ static LRESULT MMIO_UnMap32To16(DWORD wMsg, LPARAM lParam1, LPARAM lParam2,
|
|||
LPARAM lp1, LPARAM lp2)
|
||||
{
|
||||
switch (wMsg) {
|
||||
case MMIOM_OPEN:
|
||||
if (!SEGPTR_FREE((void*)lp1)) {
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
}
|
||||
break;
|
||||
case MMIOM_CLOSE:
|
||||
case MMIOM_SEEK:
|
||||
/* nothing to do */
|
||||
break;
|
||||
case MMIOM_OPEN:
|
||||
case MMIOM_READ:
|
||||
memcpy((void*)lParam1, MapSL(lp1), lp2);
|
||||
/* fall through */
|
||||
case MMIOM_WRITE:
|
||||
case MMIOM_WRITEFLUSH:
|
||||
if (!SEGPTR_FREE(MapSL(lp1))) {
|
||||
FIXME("bad free line=%d\n", __LINE__);
|
||||
}
|
||||
UnMapLS( lp1 );
|
||||
break;
|
||||
default:
|
||||
TRACE("Not a mappable message (%ld)\n", wMsg);
|
||||
|
@ -398,48 +377,13 @@ static LRESULT MMIO_UnMap32To16(DWORD wMsg, LPARAM lParam1, LPARAM lParam2,
|
|||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
* MMIO_GenerateInfoForIOProc [INTERNAL]
|
||||
*/
|
||||
static SEGPTR MMIO_GenerateInfoForIOProc(const WINE_MMIO* wm)
|
||||
{
|
||||
LPMMIOINFO16 mmioInfo16 = SEGPTR_ALLOC(sizeof(MMIOINFO16));
|
||||
|
||||
memset(mmioInfo16, 0, sizeof(MMIOINFO16));
|
||||
|
||||
mmioInfo16->lDiskOffset = wm->info.lDiskOffset;
|
||||
mmioInfo16->adwInfo[0] = wm->info.adwInfo[0];
|
||||
mmioInfo16->adwInfo[1] = wm->info.adwInfo[1];
|
||||
mmioInfo16->adwInfo[2] = wm->info.adwInfo[2];
|
||||
mmioInfo16->adwInfo[3] = wm->info.adwInfo[3];
|
||||
|
||||
return SEGPTR_GET(mmioInfo16);
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
* MMIO_UpdateInfoForIOProc [INTERNAL]
|
||||
*/
|
||||
static LRESULT MMIO_UpdateInfoForIOProc(WINE_MMIO* wm, SEGPTR segmmioInfo16)
|
||||
{
|
||||
MMIOINFO16* mmioInfo16 = MapSL(segmmioInfo16);
|
||||
|
||||
wm->info.lDiskOffset = mmioInfo16->lDiskOffset;
|
||||
wm->info.adwInfo[0] = mmioInfo16->adwInfo[0];
|
||||
wm->info.adwInfo[1] = mmioInfo16->adwInfo[1];
|
||||
wm->info.adwInfo[2] = mmioInfo16->adwInfo[2];
|
||||
wm->info.adwInfo[3] = mmioInfo16->adwInfo[3];
|
||||
|
||||
if (!SEGPTR_FREE(mmioInfo16)) FIXME("bad free\n");
|
||||
|
||||
return MMSYSERR_NOERROR;
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
* MMIO_SendMessage [INTERNAL]
|
||||
*/
|
||||
static LRESULT MMIO_SendMessage(LPWINE_MMIO wm, DWORD wMsg, LPARAM lParam1,
|
||||
LPARAM lParam2, enum mmioProcType type)
|
||||
{
|
||||
MMIOINFO16 mmioInfo16;
|
||||
LRESULT result;
|
||||
SEGPTR segmmioInfo16;
|
||||
LPARAM lp1 = lParam1, lp2 = lParam2;
|
||||
|
@ -451,7 +395,12 @@ static LRESULT MMIO_SendMessage(LPWINE_MMIO wm, DWORD wMsg, LPARAM lParam1,
|
|||
|
||||
switch (wm->ioProc->type) {
|
||||
case MMIO_PROC_16:
|
||||
segmmioInfo16 = MMIO_GenerateInfoForIOProc(wm);
|
||||
memset( &mmioInfo16, 0, sizeof(MMIOINFO16));
|
||||
mmioInfo16.lDiskOffset = wm->info.lDiskOffset;
|
||||
mmioInfo16.adwInfo[0] = wm->info.adwInfo[0];
|
||||
mmioInfo16.adwInfo[1] = wm->info.adwInfo[1];
|
||||
mmioInfo16.adwInfo[2] = wm->info.adwInfo[2];
|
||||
mmioInfo16.adwInfo[3] = wm->info.adwInfo[3];
|
||||
if (wm->ioProc->type != type) {
|
||||
/* map (lParam1, lParam2) into (lp1, lp2) 32=>16 */
|
||||
if ((result = MMIO_Map32To16(wMsg, &lp1, &lp2)) != MMSYSERR_NOERROR)
|
||||
|
@ -460,13 +409,17 @@ static LRESULT MMIO_SendMessage(LPWINE_MMIO wm, DWORD wMsg, LPARAM lParam1,
|
|||
/* FIXME: is wm->info.pIOProc a segmented or a linear address ?
|
||||
* sounds to me it's a segmented one, should use a thunk somewhere
|
||||
*/
|
||||
result = ((LPMMIOPROC16)wm->info.pIOProc)((LPSTR)segmmioInfo16,
|
||||
wMsg, lp1, lp2);
|
||||
|
||||
segmmioInfo16 = MapLS( &mmioInfo16 );
|
||||
result = ((LPMMIOPROC16)wm->info.pIOProc)((LPSTR)segmmioInfo16, wMsg, lp1, lp2);
|
||||
UnMapLS( segmmioInfo16 );
|
||||
if (wm->ioProc->type != type) {
|
||||
MMIO_UnMap32To16(wMsg, lParam1, lParam2, lp1, lp2);
|
||||
}
|
||||
MMIO_UpdateInfoForIOProc(wm, segmmioInfo16);
|
||||
wm->info.lDiskOffset = mmioInfo16.lDiskOffset;
|
||||
wm->info.adwInfo[0] = mmioInfo16.adwInfo[0];
|
||||
wm->info.adwInfo[1] = mmioInfo16.adwInfo[1];
|
||||
wm->info.adwInfo[2] = mmioInfo16.adwInfo[2];
|
||||
wm->info.adwInfo[3] = mmioInfo16.adwInfo[3];
|
||||
break;
|
||||
case MMIO_PROC_32A:
|
||||
case MMIO_PROC_32W:
|
||||
|
|
|
@ -4864,12 +4864,12 @@ DWORD WINAPI waveInMessage16(HWAVEIN16 hWaveIn, UINT16 uMessage,
|
|||
*/
|
||||
HINSTANCE16 WINAPI mmTaskCreate16(SEGPTR spProc, HINSTANCE16 *lphMmTask, DWORD dwPmt)
|
||||
{
|
||||
DWORD *pShowCmd;
|
||||
LPSTR cmdline;
|
||||
LOADPARAMS16* lp;
|
||||
HINSTANCE16 ret;
|
||||
HINSTANCE16 handle;
|
||||
|
||||
char cmdline[16];
|
||||
DWORD showCmd = 0x40002;
|
||||
LOADPARAMS16 lp;
|
||||
|
||||
TRACE("(%08lx, %p, %08lx);\n", spProc, lphMmTask, dwPmt);
|
||||
/* This to work requires NE modules to be started with a binary command line
|
||||
* which is not currently the case. A patch exists but has never been committed.
|
||||
|
@ -4880,25 +4880,20 @@ HINSTANCE16 WINAPI mmTaskCreate16(SEGPTR spProc, HINSTANCE16 *lphMmTask, DWORD d
|
|||
*/
|
||||
FIXME("This is currently broken. It will fail\n");
|
||||
|
||||
cmdline = SEGPTR_ALLOC(0x0d);
|
||||
cmdline[0] = 0x0d;
|
||||
*(LPDWORD)(cmdline + 1) = (DWORD)spProc;
|
||||
*(LPDWORD)(cmdline + 5) = dwPmt;
|
||||
*(LPDWORD)(cmdline + 9) = 0;
|
||||
|
||||
pShowCmd = SEGPTR_ALLOC(sizeof(DWORD));
|
||||
*pShowCmd = 0x40002;
|
||||
|
||||
lp = (LOADPARAMS16*)HeapAlloc(GetProcessHeap(), 0, sizeof(LOADPARAMS16));
|
||||
lp->hEnvironment = 0;
|
||||
lp->cmdLine = SEGPTR_GET(cmdline);
|
||||
lp->showCmd = SEGPTR_GET(pShowCmd);
|
||||
lp->reserved = 0;
|
||||
lp.hEnvironment = 0;
|
||||
lp.cmdLine = MapLS(cmdline);
|
||||
lp.showCmd = MapLS(&showCmd);
|
||||
lp.reserved = 0;
|
||||
|
||||
#ifndef USE_MM_TSK_WINE
|
||||
handle = LoadModule16("c:\\windows\\system\\mmtask.tsk", lp);
|
||||
handle = LoadModule16("c:\\windows\\system\\mmtask.tsk", &lp);
|
||||
#else
|
||||
handle = LoadModule16("mmtask.tsk", lp);
|
||||
handle = LoadModule16("mmtask.tsk", &lp);
|
||||
#endif
|
||||
if (handle < 32) {
|
||||
ret = (handle) ? 1 : 2;
|
||||
|
@ -4909,10 +4904,8 @@ HINSTANCE16 WINAPI mmTaskCreate16(SEGPTR spProc, HINSTANCE16 *lphMmTask, DWORD d
|
|||
if (lphMmTask)
|
||||
*lphMmTask = handle;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lp);
|
||||
SEGPTR_FREE(pShowCmd);
|
||||
SEGPTR_FREE(cmdline);
|
||||
|
||||
UnMapLS( lp.cmdLine );
|
||||
UnMapLS( lp.showCmd );
|
||||
TRACE("=> 0x%04x/%d\n", handle, ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
#include "wsipx.h"
|
||||
#include "wine/winsock16.h"
|
||||
#include "winnt.h"
|
||||
#include "heap.h"
|
||||
#include "services.h"
|
||||
#include "wine/server.h"
|
||||
#include "file.h"
|
||||
|
@ -114,9 +113,7 @@ extern CRITICAL_SECTION csWSgetXXXbyYYY;
|
|||
/* ws_... struct conversion flags */
|
||||
|
||||
#define WS_DUP_LINEAR 0x0001
|
||||
#define WS_DUP_NATIVE 0x0000 /* not used anymore */
|
||||
#define WS_DUP_OFFSET 0x0002 /* internal pointers are offsets */
|
||||
#define WS_DUP_SEGPTR 0x0004 /* internal pointers are SEGPTRs */
|
||||
#define WS_DUP_SEGPTR 0x0002 /* internal pointers are SEGPTRs */
|
||||
/* by default, internal pointers are linear */
|
||||
typedef struct /* WSAAsyncSelect() control struct */
|
||||
{
|
||||
|
@ -138,17 +135,20 @@ typedef struct /* WSAAsyncSelect() control struct */
|
|||
static volatile HANDLE accept_old[WS_ACCEPT_QUEUE], accept_new[WS_ACCEPT_QUEUE];
|
||||
|
||||
static void *he_buffer; /* typecast for Win16/32 ws_hostent */
|
||||
static SEGPTR he_buffer_seg;
|
||||
static void *se_buffer; /* typecast for Win16/32 ws_servent */
|
||||
static SEGPTR se_buffer_seg;
|
||||
static void *pe_buffer; /* typecast for Win16/32 ws_protoent */
|
||||
static char* local_buffer; /* allocated from SEGPTR heap */
|
||||
static char* dbuffer; /* buffer for dummies (32 bytes) */
|
||||
static SEGPTR pe_buffer_seg;
|
||||
static char* local_buffer;
|
||||
static SEGPTR dbuffer_seg;
|
||||
static INT num_startup; /* reference counter */
|
||||
static FARPROC blocking_hook;
|
||||
|
||||
/* function prototypes */
|
||||
int WS_dup_he(struct hostent* p_he, int flag);
|
||||
int WS_dup_pe(struct protoent* p_pe, int flag);
|
||||
int WS_dup_se(struct servent* p_se, int flag);
|
||||
static int WS_dup_he(struct hostent* p_he, int flag);
|
||||
static int WS_dup_pe(struct protoent* p_pe, int flag);
|
||||
static int WS_dup_se(struct servent* p_se, int flag);
|
||||
|
||||
typedef void WIN_hostent;
|
||||
typedef void WIN_protoent;
|
||||
|
@ -323,16 +323,22 @@ static void WINSOCK_DeleteIData(void)
|
|||
{
|
||||
/* delete scratch buffers */
|
||||
|
||||
if (he_buffer) SEGPTR_FREE(he_buffer);
|
||||
if (se_buffer) SEGPTR_FREE(se_buffer);
|
||||
if (pe_buffer) SEGPTR_FREE(pe_buffer);
|
||||
if (local_buffer) SEGPTR_FREE(local_buffer);
|
||||
if (dbuffer) SEGPTR_FREE(dbuffer);
|
||||
UnMapLS( he_buffer_seg );
|
||||
UnMapLS( se_buffer_seg );
|
||||
UnMapLS( pe_buffer_seg );
|
||||
UnMapLS( dbuffer_seg );
|
||||
if (he_buffer) HeapFree( GetProcessHeap(), 0, he_buffer );
|
||||
if (se_buffer) HeapFree( GetProcessHeap(), 0, se_buffer );
|
||||
if (pe_buffer) HeapFree( GetProcessHeap(), 0, pe_buffer );
|
||||
if (local_buffer) HeapFree( GetProcessHeap(), 0, local_buffer );
|
||||
he_buffer = NULL;
|
||||
se_buffer = NULL;
|
||||
pe_buffer = NULL;
|
||||
local_buffer = NULL;
|
||||
dbuffer = NULL;
|
||||
he_buffer_seg = 0;
|
||||
se_buffer_seg = 0;
|
||||
pe_buffer_seg = 0;
|
||||
dbuffer_seg = 0;
|
||||
num_startup = 0;
|
||||
}
|
||||
|
||||
|
@ -714,9 +720,9 @@ static char* check_buffer(int size)
|
|||
if (local_buffer)
|
||||
{
|
||||
if (local_buflen >= size ) return local_buffer;
|
||||
SEGPTR_FREE(local_buffer);
|
||||
HeapFree( GetProcessHeap(), 0, local_buffer );
|
||||
}
|
||||
local_buffer = SEGPTR_ALLOC((local_buflen = size));
|
||||
local_buffer = HeapAlloc( GetProcessHeap(), 0, (local_buflen = size) );
|
||||
return local_buffer;
|
||||
}
|
||||
|
||||
|
@ -726,9 +732,11 @@ static struct ws_hostent* check_buffer_he(int size)
|
|||
if (he_buffer)
|
||||
{
|
||||
if (he_len >= size ) return he_buffer;
|
||||
SEGPTR_FREE(he_buffer);
|
||||
UnMapLS( he_buffer_seg );
|
||||
HeapFree( GetProcessHeap(), 0, he_buffer );
|
||||
}
|
||||
he_buffer = SEGPTR_ALLOC((he_len = size));
|
||||
he_buffer = HeapAlloc( GetProcessHeap(), 0, (he_len = size) );
|
||||
he_buffer_seg = MapLS( he_buffer );
|
||||
return he_buffer;
|
||||
}
|
||||
|
||||
|
@ -738,9 +746,11 @@ static void* check_buffer_se(int size)
|
|||
if (se_buffer)
|
||||
{
|
||||
if (se_len >= size ) return se_buffer;
|
||||
SEGPTR_FREE(se_buffer);
|
||||
UnMapLS( se_buffer_seg );
|
||||
HeapFree( GetProcessHeap(), 0, se_buffer );
|
||||
}
|
||||
se_buffer = SEGPTR_ALLOC((se_len = size));
|
||||
se_buffer = HeapAlloc( GetProcessHeap(), 0, (se_len = size) );
|
||||
se_buffer_seg = MapLS( he_buffer );
|
||||
return se_buffer;
|
||||
}
|
||||
|
||||
|
@ -750,9 +760,11 @@ static struct ws_protoent* check_buffer_pe(int size)
|
|||
if (pe_buffer)
|
||||
{
|
||||
if (pe_len >= size ) return pe_buffer;
|
||||
SEGPTR_FREE(pe_buffer);
|
||||
UnMapLS( pe_buffer_seg );
|
||||
HeapFree( GetProcessHeap(), 0, pe_buffer );
|
||||
}
|
||||
pe_buffer = SEGPTR_ALLOC((pe_len = size));
|
||||
pe_buffer = HeapAlloc( GetProcessHeap(), 0, (pe_len = size) );
|
||||
pe_buffer_seg = MapLS( he_buffer );
|
||||
return pe_buffer;
|
||||
}
|
||||
|
||||
|
@ -1374,17 +1386,11 @@ char* WINAPI WS_inet_ntoa(struct WS_in_addr in)
|
|||
* propensity to decode addresses in ws_hostent structure without
|
||||
* saving them first...
|
||||
*/
|
||||
static char dbuffer[16]; /* Yes, 16: 4*3 digits + 3 '.' + 1 '\0' */
|
||||
|
||||
char* s = inet_ntoa(*((struct in_addr*)&in));
|
||||
if( s )
|
||||
{
|
||||
if( dbuffer == NULL ) {
|
||||
/* Yes, 16: 4*3 digits + 3 '.' + 1 '\0' */
|
||||
if((dbuffer = (char*) SEGPTR_ALLOC(16)) == NULL )
|
||||
{
|
||||
SetLastError(WSAENOBUFS);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
strcpy(dbuffer, s);
|
||||
return dbuffer;
|
||||
}
|
||||
|
@ -1397,8 +1403,10 @@ char* WINAPI WS_inet_ntoa(struct WS_in_addr in)
|
|||
*/
|
||||
SEGPTR WINAPI WINSOCK_inet_ntoa16(struct in_addr in)
|
||||
{
|
||||
char* retVal = WS_inet_ntoa(*((struct WS_in_addr*)&in));
|
||||
return SEGPTR_GET(retVal);
|
||||
char* retVal;
|
||||
if (!(retVal = WS_inet_ntoa(*((struct WS_in_addr*)&in)))) return 0;
|
||||
if (!dbuffer_seg) dbuffer_seg = MapLS( retVal );
|
||||
return dbuffer_seg;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2414,7 +2422,6 @@ SOCKET16 WINAPI WINSOCK_socket16(INT16 af, INT16 type, INT16 protocol)
|
|||
* the relay32/wsock32.spec.
|
||||
*/
|
||||
|
||||
static char* NULL_STRING = "NULL";
|
||||
|
||||
/***********************************************************************
|
||||
* __ws_gethostbyaddr
|
||||
|
@ -2464,11 +2471,9 @@ static WIN_hostent* __ws_gethostbyaddr(const char *addr, int len, int type, int
|
|||
*/
|
||||
SEGPTR WINAPI WINSOCK_gethostbyaddr16(const char *addr, INT16 len, INT16 type)
|
||||
{
|
||||
WIN_hostent* retval;
|
||||
TRACE("ptr %08x, len %d, type %d\n",
|
||||
(unsigned) addr, len, type);
|
||||
retval = __ws_gethostbyaddr( addr, len, type, WS_DUP_SEGPTR );
|
||||
return SEGPTR_GET(retval);
|
||||
TRACE("ptr %p, len %d, type %d\n", addr, len, type);
|
||||
if (!__ws_gethostbyaddr( addr, len, type, WS_DUP_SEGPTR )) return 0;
|
||||
return he_buffer_seg;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -2527,10 +2532,9 @@ static WIN_hostent * __ws_gethostbyname(const char *name, int dup_flag)
|
|||
*/
|
||||
SEGPTR WINAPI WINSOCK_gethostbyname16(const char *name)
|
||||
{
|
||||
WIN_hostent* retval;
|
||||
TRACE("%s\n", (name)?name:NULL_STRING);
|
||||
retval = __ws_gethostbyname( name, WS_DUP_SEGPTR );
|
||||
return SEGPTR_GET(retval);
|
||||
TRACE( "%s\n", debugstr_a(name) );
|
||||
if (!__ws_gethostbyname( name, WS_DUP_SEGPTR )) return 0;
|
||||
return he_buffer_seg;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -2538,7 +2542,7 @@ SEGPTR WINAPI WINSOCK_gethostbyname16(const char *name)
|
|||
*/
|
||||
struct WS_hostent* WINAPI WS_gethostbyname(const char* name)
|
||||
{
|
||||
TRACE("%s\n", (name)?name:NULL_STRING);
|
||||
TRACE( "%s\n", debugstr_a(name) );
|
||||
return __ws_gethostbyname( name, WS_DUP_LINEAR );
|
||||
}
|
||||
|
||||
|
@ -2572,10 +2576,9 @@ static WIN_protoent* __ws_getprotobyname(const char *name, int dup_flag)
|
|||
*/
|
||||
SEGPTR WINAPI WINSOCK_getprotobyname16(const char *name)
|
||||
{
|
||||
WIN_protoent* retval;
|
||||
TRACE("%s\n", (name)?name:NULL_STRING);
|
||||
retval = __ws_getprotobyname(name, WS_DUP_SEGPTR);
|
||||
return SEGPTR_GET(retval);
|
||||
TRACE( "%s\n", debugstr_a(name) );
|
||||
if (!__ws_getprotobyname(name, WS_DUP_SEGPTR)) return 0;
|
||||
return pe_buffer_seg;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -2583,7 +2586,7 @@ SEGPTR WINAPI WINSOCK_getprotobyname16(const char *name)
|
|||
*/
|
||||
struct WS_protoent* WINAPI WS_getprotobyname(const char* name)
|
||||
{
|
||||
TRACE("%s\n", (name)?name:NULL_STRING);
|
||||
TRACE( "%s\n", debugstr_a(name) );
|
||||
return __ws_getprotobyname(name, WS_DUP_LINEAR);
|
||||
}
|
||||
|
||||
|
@ -2616,10 +2619,9 @@ static WIN_protoent* __ws_getprotobynumber(int number, int dup_flag)
|
|||
*/
|
||||
SEGPTR WINAPI WINSOCK_getprotobynumber16(INT16 number)
|
||||
{
|
||||
WIN_protoent* retval;
|
||||
TRACE("%i\n", number);
|
||||
retval = __ws_getprotobynumber(number, WS_DUP_SEGPTR);
|
||||
return SEGPTR_GET(retval);
|
||||
if (!__ws_getprotobynumber(number, WS_DUP_SEGPTR)) return 0;
|
||||
return pe_buffer_seg;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -2668,11 +2670,9 @@ static WIN_servent* __ws_getservbyname(const char *name, const char *proto, int
|
|||
*/
|
||||
SEGPTR WINAPI WINSOCK_getservbyname16(const char *name, const char *proto)
|
||||
{
|
||||
WIN_servent* retval;
|
||||
TRACE("'%s', '%s'\n",
|
||||
(name)?name:NULL_STRING, (proto)?proto:NULL_STRING);
|
||||
retval = __ws_getservbyname(name, proto, WS_DUP_SEGPTR);
|
||||
return SEGPTR_GET(retval);
|
||||
TRACE( "%s, %s\n", debugstr_a(name), debugstr_a(proto) );
|
||||
if (!__ws_getservbyname(name, proto, WS_DUP_SEGPTR)) return 0;
|
||||
return se_buffer_seg;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -2680,8 +2680,7 @@ SEGPTR WINAPI WINSOCK_getservbyname16(const char *name, const char *proto)
|
|||
*/
|
||||
struct WS_servent* WINAPI WS_getservbyname(const char *name, const char *proto)
|
||||
{
|
||||
TRACE("'%s', '%s'\n",
|
||||
(name)?name:NULL_STRING, (proto)?proto:NULL_STRING);
|
||||
TRACE( "%s, %s\n", debugstr_a(name), debugstr_a(proto) );
|
||||
return __ws_getservbyname(name, proto, WS_DUP_LINEAR);
|
||||
}
|
||||
|
||||
|
@ -2717,11 +2716,9 @@ static WIN_servent* __ws_getservbyport(int port, const char* proto, int dup_flag
|
|||
*/
|
||||
SEGPTR WINAPI WINSOCK_getservbyport16(INT16 port, const char *proto)
|
||||
{
|
||||
WIN_servent* retval;
|
||||
TRACE("%d (i.e. port %d), '%s'\n",
|
||||
(int)port, (int)ntohl(port), (proto)?proto:NULL_STRING);
|
||||
retval = __ws_getservbyport(port, proto, WS_DUP_SEGPTR);
|
||||
return SEGPTR_GET(retval);
|
||||
TRACE("%d (i.e. port %d), %s\n", (int)port, (int)ntohl(port), debugstr_a(proto));
|
||||
if (!__ws_getservbyport(port, proto, WS_DUP_SEGPTR)) return 0;
|
||||
return se_buffer_seg;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -2729,8 +2726,7 @@ SEGPTR WINAPI WINSOCK_getservbyport16(INT16 port, const char *proto)
|
|||
*/
|
||||
struct WS_servent* WINAPI WS_getservbyport(int port, const char *proto)
|
||||
{
|
||||
TRACE("%d (i.e. port %d), '%s'\n",
|
||||
(int)port, (int)ntohl(port), (proto)?proto:NULL_STRING);
|
||||
TRACE("%d (i.e. port %d), %s\n", (int)port, (int)ntohl(port), debugstr_a(proto));
|
||||
return __ws_getservbyport(port, proto, WS_DUP_LINEAR);
|
||||
}
|
||||
|
||||
|
@ -3144,7 +3140,7 @@ static int hostent_size(struct hostent* p_he)
|
|||
* and handle all Win16/Win32 dependent things (struct size, ...) *correctly*.
|
||||
* Dito for protoent and servent.
|
||||
*/
|
||||
int WS_dup_he(struct hostent* p_he, int flag)
|
||||
static int WS_dup_he(struct hostent* p_he, int flag)
|
||||
{
|
||||
/* Convert hostent structure into ws_hostent so that the data fits
|
||||
* into local_buffer. Internal pointers can be linear, SEGPTR, or
|
||||
|
@ -3166,8 +3162,7 @@ int WS_dup_he(struct hostent* p_he, int flag)
|
|||
p_to32 = he_buffer;
|
||||
|
||||
p = p_to;
|
||||
p_base = (flag & WS_DUP_OFFSET) ? NULL
|
||||
: ((flag & WS_DUP_SEGPTR) ? (char*)SEGPTR_GET(p) : p);
|
||||
p_base = (flag & WS_DUP_SEGPTR) ? (char*)he_buffer_seg : he_buffer;
|
||||
p += (flag & WS_DUP_SEGPTR) ?
|
||||
sizeof(struct ws_hostent16) : sizeof(struct WS_hostent);
|
||||
p_name = p;
|
||||
|
@ -3211,7 +3206,7 @@ static int protoent_size(struct protoent* p_pe)
|
|||
return size;
|
||||
}
|
||||
|
||||
int WS_dup_pe(struct protoent* p_pe, int flag)
|
||||
static int WS_dup_pe(struct protoent* p_pe, int flag)
|
||||
{
|
||||
int size = protoent_size(p_pe);
|
||||
if( size )
|
||||
|
@ -3226,8 +3221,7 @@ int WS_dup_pe(struct protoent* p_pe, int flag)
|
|||
p_to16 = pe_buffer;
|
||||
p_to32 = pe_buffer;
|
||||
p = p_to;
|
||||
p_base = (flag & WS_DUP_OFFSET) ? NULL
|
||||
: ((flag & WS_DUP_SEGPTR) ? (char*)SEGPTR_GET(p) : p);
|
||||
p_base = (flag & WS_DUP_SEGPTR) ? (char*)pe_buffer_seg : pe_buffer;
|
||||
p += (flag & WS_DUP_SEGPTR) ?
|
||||
sizeof(struct ws_protoent16) : sizeof(struct WS_protoent);
|
||||
p_name = p;
|
||||
|
@ -3265,7 +3259,7 @@ static int servent_size(struct servent* p_se)
|
|||
return size;
|
||||
}
|
||||
|
||||
int WS_dup_se(struct servent* p_se, int flag)
|
||||
static int WS_dup_se(struct servent* p_se, int flag)
|
||||
{
|
||||
int size = servent_size(p_se);
|
||||
if( size )
|
||||
|
@ -3280,8 +3274,7 @@ int WS_dup_se(struct servent* p_se, int flag)
|
|||
p_to16 = se_buffer;
|
||||
p_to32 = se_buffer;
|
||||
p = p_to;
|
||||
p_base = (flag & WS_DUP_OFFSET) ? NULL
|
||||
: ((flag & WS_DUP_SEGPTR) ? (char*)SEGPTR_GET(p) : p);
|
||||
p_base = (flag & WS_DUP_SEGPTR) ? (char*)se_buffer_seg : se_buffer;
|
||||
p += (flag & WS_DUP_SEGPTR) ?
|
||||
sizeof(struct ws_servent16) : sizeof(struct WS_servent);
|
||||
p_name = p;
|
||||
|
|
Loading…
Reference in New Issue