- Add Wow64* functions declarations to winbase.h

- Export Wow64* functions in kernel32, because 32bit Windows also exports them.
- Sync ole32, oleaut32 with Wine-1.1.43.

svn path=/trunk/; revision=46959
This commit is contained in:
Aleksey Bragin 2010-04-20 17:36:44 +00:00
parent fd7bc65588
commit 590cff7bd1
15 changed files with 232 additions and 304 deletions

View file

@ -966,11 +966,9 @@
@ stdcall WaitNamedPipeW (wstr long) @ stdcall WaitNamedPipeW (wstr long)
@ stdcall WideCharToMultiByte(long long wstr long ptr long ptr ptr) @ stdcall WideCharToMultiByte(long long wstr long ptr long ptr ptr)
@ stdcall WinExec(str long) @ stdcall WinExec(str long)
#ifdef _M_AMD64
@ stdcall Wow64EnableWow64FsRedirection(long) @ stdcall Wow64EnableWow64FsRedirection(long)
@ stdcall Wow64DisableWow64FsRedirection(long) @ stdcall Wow64DisableWow64FsRedirection(long)
@ stdcall Wow64RevertWow64FsRedirection(long) @ stdcall Wow64RevertWow64FsRedirection(long)
#endif
@ stdcall WriteConsoleA(long ptr long ptr ptr) @ stdcall WriteConsoleA(long ptr long ptr ptr)
@ stdcall WriteConsoleInputA(long ptr long ptr) @ stdcall WriteConsoleInputA(long ptr long ptr)
@ stdcall WriteConsoleInputVDMA(long long long long) @ stdcall WriteConsoleInputVDMA(long long long long)

View file

@ -1506,7 +1506,7 @@ HRESULT WINAPI CoCreateGuid(GUID *pguid)
* SEE ALSO * SEE ALSO
* StringFromCLSID * StringFromCLSID
*/ */
static HRESULT __CLSIDFromString(LPCWSTR s, CLSID *id) static HRESULT __CLSIDFromString(LPCWSTR s, LPCLSID id)
{ {
int i; int i;
BYTE table[256]; BYTE table[256];
@ -4153,11 +4153,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
hProxyDll = hinstDLL; hProxyDll = hinstDLL;
COMPOBJ_InitProcess(); COMPOBJ_InitProcess();
if (TRACE_ON(ole)) CoRegisterMallocSpy((LPVOID)-1);
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
if (TRACE_ON(ole)) CoRevokeMallocSpy();
OLEDD_UnInitialize(); OLEDD_UnInitialize();
COMPOBJ_UninitProcess(); COMPOBJ_UninitProcess();
RPC_UnregisterAllChannelHooks(); RPC_UnregisterAllChannelHooks();

View file

@ -204,8 +204,11 @@ FTMarshalImpl_MarshalInterface (LPMARSHAL iface, IStream * pStm, REFIID riid, vo
hres = IStream_Write (pStm, &object, sizeof (object), NULL); hres = IStream_Write (pStm, &object, sizeof (object), NULL);
if (hres != S_OK) return STG_E_MEDIUMFULL; if (hres != S_OK) return STG_E_MEDIUMFULL;
hres = IStream_Write (pStm, &constant, sizeof (constant), NULL); if (sizeof(object) == sizeof(DWORD))
if (hres != S_OK) return STG_E_MEDIUMFULL; {
hres = IStream_Write (pStm, &constant, sizeof (constant), NULL);
if (hres != S_OK) return STG_E_MEDIUMFULL;
}
hres = IStream_Write (pStm, &unknown_guid, sizeof (unknown_guid), NULL); hres = IStream_Write (pStm, &unknown_guid, sizeof (unknown_guid), NULL);
if (hres != S_OK) return STG_E_MEDIUMFULL; if (hres != S_OK) return STG_E_MEDIUMFULL;
@ -237,10 +240,13 @@ FTMarshalImpl_UnmarshalInterface (LPMARSHAL iface, IStream * pStm, REFIID riid,
hres = IStream_Read (pStm, &object, sizeof (object), NULL); hres = IStream_Read (pStm, &object, sizeof (object), NULL);
if (hres != S_OK) return STG_E_READFAULT; if (hres != S_OK) return STG_E_READFAULT;
hres = IStream_Read (pStm, &constant, sizeof (constant), NULL); if (sizeof(object) == sizeof(DWORD))
if (hres != S_OK) return STG_E_READFAULT; {
if (constant != 0) hres = IStream_Read (pStm, &constant, sizeof (constant), NULL);
FIXME("constant is 0x%x instead of 0\n", constant); if (hres != S_OK) return STG_E_READFAULT;
if (constant != 0)
FIXME("constant is 0x%x instead of 0\n", constant);
}
hres = IStream_Read (pStm, &unknown_guid, sizeof (unknown_guid), NULL); hres = IStream_Read (pStm, &unknown_guid, sizeof (unknown_guid), NULL);
if (hres != S_OK) return STG_E_READFAULT; if (hres != S_OK) return STG_E_READFAULT;
@ -267,10 +273,13 @@ static HRESULT WINAPI FTMarshalImpl_ReleaseMarshalData (LPMARSHAL iface, IStream
hres = IStream_Read (pStm, &object, sizeof (object), NULL); hres = IStream_Read (pStm, &object, sizeof (object), NULL);
if (hres != S_OK) return STG_E_READFAULT; if (hres != S_OK) return STG_E_READFAULT;
hres = IStream_Read (pStm, &constant, sizeof (constant), NULL); if (sizeof(object) == sizeof(DWORD))
if (hres != S_OK) return STG_E_READFAULT; {
if (constant != 0) hres = IStream_Read (pStm, &constant, sizeof (constant), NULL);
FIXME("constant is 0x%x instead of 0\n", constant); if (hres != S_OK) return STG_E_READFAULT;
if (constant != 0)
FIXME("constant is 0x%x instead of 0\n", constant);
}
hres = IStream_Read (pStm, &unknown_guid, sizeof (unknown_guid), NULL); hres = IStream_Read (pStm, &unknown_guid, sizeof (unknown_guid), NULL);
if (hres != S_OK) return STG_E_READFAULT; if (hres != S_OK) return STG_E_READFAULT;

View file

@ -359,173 +359,6 @@ static const IMallocVtbl VT_IMalloc32 =
IMalloc_fnHeapMinimize IMalloc_fnHeapMinimize
}; };
/******************************************************************************
* IMallocSpy implementation
*****************************************************************************/
/* set the vtable later */
static const IMallocSpyVtbl VT_IMallocSpy;
typedef struct {
const IMallocSpyVtbl *lpVtbl;
LONG ref;
} _MallocSpy;
/* this is the static object instance */
static _MallocSpy MallocSpy = {&VT_IMallocSpy, 0};
/******************************************************************************
* IMalloc32_QueryInterface [VTABLE]
*/
static HRESULT WINAPI IMallocSpy_fnQueryInterface(LPMALLOCSPY iface,REFIID refiid,LPVOID *obj)
{
TRACE("(%s,%p)\n",debugstr_guid(refiid),obj);
if (IsEqualIID(&IID_IUnknown,refiid) || IsEqualIID(&IID_IMallocSpy,refiid)) {
*obj = &MallocSpy;
return S_OK;
}
return E_NOINTERFACE;
}
/******************************************************************************
* IMalloc32_AddRef [VTABLE]
*/
static ULONG WINAPI IMallocSpy_fnAddRef (LPMALLOCSPY iface)
{
_MallocSpy *This = (_MallocSpy *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE ("(%p)->(count=%u)\n", This, ref - 1);
return ref;
}
/******************************************************************************
* IMalloc32_AddRelease [VTABLE]
*
* NOTES
* Our MallocSpy is static. If the count reaches 0 we dump the leaks
*/
static ULONG WINAPI IMallocSpy_fnRelease (LPMALLOCSPY iface)
{
_MallocSpy *This = (_MallocSpy *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE ("(%p)->(count=%u)\n", This, ref + 1);
if (!ref) {
/* our allocation list MUST be empty here */
}
return ref;
}
static ULONG WINAPI IMallocSpy_fnPreAlloc(LPMALLOCSPY iface, ULONG cbRequest)
{
_MallocSpy *This = (_MallocSpy *)iface;
TRACE ("(%p)->(%u)\n", This, cbRequest);
return cbRequest;
}
static PVOID WINAPI IMallocSpy_fnPostAlloc(LPMALLOCSPY iface, void* pActual)
{
_MallocSpy *This = (_MallocSpy *)iface;
TRACE ("(%p)->(%p)\n", This, pActual);
return pActual;
}
static PVOID WINAPI IMallocSpy_fnPreFree(LPMALLOCSPY iface, void* pRequest, BOOL fSpyed)
{
_MallocSpy *This = (_MallocSpy *)iface;
TRACE ("(%p)->(%p %u)\n", This, pRequest, fSpyed);
return pRequest;
}
static void WINAPI IMallocSpy_fnPostFree(LPMALLOCSPY iface, BOOL fSpyed)
{
_MallocSpy *This = (_MallocSpy *)iface;
TRACE ("(%p)->(%u)\n", This, fSpyed);
}
static ULONG WINAPI IMallocSpy_fnPreRealloc(LPMALLOCSPY iface, void* pRequest, ULONG cbRequest, void** ppNewRequest, BOOL fSpyed)
{
_MallocSpy *This = (_MallocSpy *)iface;
TRACE ("(%p)->(%p %u %u)\n", This, pRequest, cbRequest, fSpyed);
*ppNewRequest = pRequest;
return cbRequest;
}
static PVOID WINAPI IMallocSpy_fnPostRealloc(LPMALLOCSPY iface, void* pActual, BOOL fSpyed)
{
_MallocSpy *This = (_MallocSpy *)iface;
TRACE ("(%p)->(%p %u)\n", This, pActual, fSpyed);
return pActual;
}
static PVOID WINAPI IMallocSpy_fnPreGetSize(LPMALLOCSPY iface, void* pRequest, BOOL fSpyed)
{
_MallocSpy *This = (_MallocSpy *)iface;
TRACE ("(%p)->(%p %u)\n", This, pRequest, fSpyed);
return pRequest;
}
static ULONG WINAPI IMallocSpy_fnPostGetSize(LPMALLOCSPY iface, ULONG cbActual, BOOL fSpyed)
{
_MallocSpy *This = (_MallocSpy *)iface;
TRACE ("(%p)->(%u %u)\n", This, cbActual, fSpyed);
return cbActual;
}
static PVOID WINAPI IMallocSpy_fnPreDidAlloc(LPMALLOCSPY iface, void* pRequest, BOOL fSpyed)
{
_MallocSpy *This = (_MallocSpy *)iface;
TRACE ("(%p)->(%p %u)\n", This, pRequest, fSpyed);
return pRequest;
}
static int WINAPI IMallocSpy_fnPostDidAlloc(LPMALLOCSPY iface, void* pRequest, BOOL fSpyed, int fActual)
{
_MallocSpy *This = (_MallocSpy *)iface;
TRACE ("(%p)->(%p %u %u)\n", This, pRequest, fSpyed, fActual);
return fActual;
}
static void WINAPI IMallocSpy_fnPreHeapMinimize(LPMALLOCSPY iface)
{
_MallocSpy *This = (_MallocSpy *)iface;
TRACE ("(%p)->()\n", This);
}
static void WINAPI IMallocSpy_fnPostHeapMinimize(LPMALLOCSPY iface)
{
_MallocSpy *This = (_MallocSpy *)iface;
TRACE ("(%p)->()\n", This);
}
static void MallocSpyDumpLeaks(void) {
TRACE("leaks: %u\n", Malloc32.SpyedAllocationsLeft);
}
static const IMallocSpyVtbl VT_IMallocSpy =
{
IMallocSpy_fnQueryInterface,
IMallocSpy_fnAddRef,
IMallocSpy_fnRelease,
IMallocSpy_fnPreAlloc,
IMallocSpy_fnPostAlloc,
IMallocSpy_fnPreFree,
IMallocSpy_fnPostFree,
IMallocSpy_fnPreRealloc,
IMallocSpy_fnPostRealloc,
IMallocSpy_fnPreGetSize,
IMallocSpy_fnPostGetSize,
IMallocSpy_fnPreDidAlloc,
IMallocSpy_fnPostDidAlloc,
IMallocSpy_fnPreHeapMinimize,
IMallocSpy_fnPostHeapMinimize
};
/****************************************************************************** /******************************************************************************
* CoGetMalloc [OLE32.@] * CoGetMalloc [OLE32.@]
* *
@ -620,9 +453,6 @@ HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy)
TRACE("\n"); TRACE("\n");
/* HACK TO ACTIVATE OUT SPY */
if (pMallocSpy == (LPVOID)-1) pMallocSpy =(IMallocSpy*)&MallocSpy;
if(Malloc32.pSpy) return CO_E_OBJISREG; if(Malloc32.pSpy) return CO_E_OBJISREG;
EnterCriticalSection(&IMalloc32_SpyCS); EnterCriticalSection(&IMalloc32_SpyCS);
@ -661,11 +491,6 @@ HRESULT WINAPI CoRevokeMallocSpy(void)
EnterCriticalSection(&IMalloc32_SpyCS); EnterCriticalSection(&IMalloc32_SpyCS);
/* if it's our spy it's time to dump the leaks */
if (Malloc32.pSpy == (IMallocSpy*)&MallocSpy) {
MallocSpyDumpLeaks();
}
if (Malloc32.SpyedAllocationsLeft) { if (Malloc32.SpyedAllocationsLeft) {
TRACE("SpyReleasePending with %u allocations left\n", Malloc32.SpyedAllocationsLeft); TRACE("SpyReleasePending with %u allocations left\n", Malloc32.SpyedAllocationsLeft);
Malloc32.SpyReleasePending = TRUE; Malloc32.SpyReleasePending = TRUE;

View file

@ -127,6 +127,7 @@ static BOOL start_rpcss(void)
WCHAR cmd[MAX_PATH]; WCHAR cmd[MAX_PATH];
static const WCHAR rpcss[] = {'\\','r','p','c','s','s','.','e','x','e',0}; static const WCHAR rpcss[] = {'\\','r','p','c','s','s','.','e','x','e',0};
BOOL rslt; BOOL rslt;
void *redir;
TRACE("\n"); TRACE("\n");
@ -135,7 +136,9 @@ static BOOL start_rpcss(void)
GetSystemDirectoryW( cmd, MAX_PATH - sizeof(rpcss)/sizeof(WCHAR) ); GetSystemDirectoryW( cmd, MAX_PATH - sizeof(rpcss)/sizeof(WCHAR) );
strcatW( cmd, rpcss ); strcatW( cmd, rpcss );
Wow64DisableWow64FsRedirection( &redir );
rslt = CreateProcessW( cmd, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ); rslt = CreateProcessW( cmd, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
Wow64RevertWow64FsRedirection( redir );
if (rslt) if (rslt)
{ {

View file

@ -20,6 +20,7 @@
<library>ole32_irot_client</library> <library>ole32_irot_client</library>
<library>ole32_proxy</library> <library>ole32_proxy</library>
<library>rpcrt4</library> <library>rpcrt4</library>
<library>kernel32</library>
<library>ntdll</library> <library>ntdll</library>
<library>uuid</library> <library>uuid</library>
<library>pseh</library> <library>pseh</library>

View file

@ -144,6 +144,28 @@ typedef struct
/* [size_is((size+7)&~7)] */ unsigned char data[1]; /* [size_is((size+7)&~7)] */ unsigned char data[1];
} WIRE_ORPC_EXTENT; } WIRE_ORPC_EXTENT;
typedef struct
{
ULONG size;
ULONG reserved;
unsigned char extent[1];
} WIRE_ORPC_EXTENT_ARRAY;
typedef struct
{
ULONG version;
ULONG flags;
ULONG reserved1;
GUID cid;
unsigned char extensions[1];
} WIRE_ORPCTHIS;
typedef struct
{
ULONG flags;
unsigned char extensions[1];
} WIRE_ORPCTHAT;
struct channel_hook_entry struct channel_hook_entry
{ {
struct list entry; struct list entry;
@ -503,10 +525,10 @@ static HRESULT WINAPI ServerRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface,
extensions_size = ChannelHooks_ServerGetSize(&message_state->channel_hook_info, extensions_size = ChannelHooks_ServerGetSize(&message_state->channel_hook_info,
&channel_hook_data, &channel_hook_count, &extension_count); &channel_hook_data, &channel_hook_count, &extension_count);
msg->BufferLength += FIELD_OFFSET(ORPCTHAT, extensions) + 4; msg->BufferLength += FIELD_OFFSET(WIRE_ORPCTHAT, extensions) + sizeof(DWORD);
if (extensions_size) if (extensions_size)
{ {
msg->BufferLength += FIELD_OFFSET(ORPC_EXTENT_ARRAY, extent) + 2*sizeof(DWORD) + extensions_size; msg->BufferLength += FIELD_OFFSET(WIRE_ORPC_EXTENT_ARRAY, extent[2*sizeof(DWORD) + extensions_size]);
if (extension_count & 1) if (extension_count & 1)
msg->BufferLength += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]); msg->BufferLength += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]);
} }
@ -523,7 +545,7 @@ static HRESULT WINAPI ServerRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface,
status = I_RpcGetBuffer(msg); status = I_RpcGetBuffer(msg);
orpcthat = msg->Buffer; orpcthat = msg->Buffer;
msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(ORPCTHAT, extensions); msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPCTHAT, extensions);
orpcthat->flags = ORPCF_NULL /* FIXME? */; orpcthat->flags = ORPCF_NULL /* FIXME? */;
@ -533,10 +555,10 @@ static HRESULT WINAPI ServerRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface,
if (extensions_size) if (extensions_size)
{ {
ORPC_EXTENT_ARRAY *orpc_extent_array = msg->Buffer; WIRE_ORPC_EXTENT_ARRAY *orpc_extent_array = msg->Buffer;
orpc_extent_array->size = extension_count; orpc_extent_array->size = extension_count;
orpc_extent_array->reserved = 0; orpc_extent_array->reserved = 0;
msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(ORPC_EXTENT_ARRAY, extent); msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPC_EXTENT_ARRAY, extent);
/* NDR representation of orpc_extent_array->extent */ /* NDR representation of orpc_extent_array->extent */
*(DWORD *)msg->Buffer = 1; *(DWORD *)msg->Buffer = 1;
msg->Buffer = (char *)msg->Buffer + sizeof(DWORD); msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
@ -645,10 +667,10 @@ static HRESULT WINAPI ClientRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface,
extensions_size = ChannelHooks_ClientGetSize(&message_state->channel_hook_info, extensions_size = ChannelHooks_ClientGetSize(&message_state->channel_hook_info,
&channel_hook_data, &channel_hook_count, &extension_count); &channel_hook_data, &channel_hook_count, &extension_count);
msg->BufferLength += FIELD_OFFSET(ORPCTHIS, extensions) + 4; msg->BufferLength += FIELD_OFFSET(WIRE_ORPCTHIS, extensions) + sizeof(DWORD);
if (extensions_size) if (extensions_size)
{ {
msg->BufferLength += FIELD_OFFSET(ORPC_EXTENT_ARRAY, extent) + 2*sizeof(DWORD) + extensions_size; msg->BufferLength += FIELD_OFFSET(WIRE_ORPC_EXTENT_ARRAY, extent[2*sizeof(DWORD) + extensions_size]);
if (extension_count & 1) if (extension_count & 1)
msg->BufferLength += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]); msg->BufferLength += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]);
} }
@ -703,7 +725,7 @@ static HRESULT WINAPI ClientRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface,
if (status == RPC_S_OK) if (status == RPC_S_OK)
{ {
orpcthis = msg->Buffer; orpcthis = msg->Buffer;
msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(ORPCTHIS, extensions); msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPCTHIS, extensions);
orpcthis->version.MajorVersion = COM_MAJOR_VERSION; orpcthis->version.MajorVersion = COM_MAJOR_VERSION;
orpcthis->version.MinorVersion = COM_MINOR_VERSION; orpcthis->version.MinorVersion = COM_MINOR_VERSION;
@ -720,7 +742,7 @@ static HRESULT WINAPI ClientRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface,
ORPC_EXTENT_ARRAY *orpc_extent_array = msg->Buffer; ORPC_EXTENT_ARRAY *orpc_extent_array = msg->Buffer;
orpc_extent_array->size = extension_count; orpc_extent_array->size = extension_count;
orpc_extent_array->reserved = 0; orpc_extent_array->reserved = 0;
msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(ORPC_EXTENT_ARRAY, extent); msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPC_EXTENT_ARRAY, extent);
/* NDR representation of orpc_extent_array->extent */ /* NDR representation of orpc_extent_array->extent */
*(DWORD *)msg->Buffer = 1; *(DWORD *)msg->Buffer = 1;
msg->Buffer = (char *)msg->Buffer + sizeof(DWORD); msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
@ -1152,8 +1174,8 @@ static HRESULT unmarshal_ORPC_EXTENT_ARRAY(RPC_MESSAGE *msg, const char *end,
DWORD pointer_id; DWORD pointer_id;
DWORD i; DWORD i;
memcpy(extensions, msg->Buffer, FIELD_OFFSET(ORPC_EXTENT_ARRAY, extent)); memcpy(extensions, msg->Buffer, FIELD_OFFSET(WIRE_ORPC_EXTENT_ARRAY, extent));
msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(ORPC_EXTENT_ARRAY, extent); msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPC_EXTENT_ARRAY, extent);
if ((const char *)msg->Buffer + 2 * sizeof(DWORD) > end) if ((const char *)msg->Buffer + 2 * sizeof(DWORD) > end)
return RPC_E_INVALID_HEADER; return RPC_E_INVALID_HEADER;
@ -1205,14 +1227,14 @@ static HRESULT unmarshal_ORPCTHIS(RPC_MESSAGE *msg, ORPCTHIS *orpcthis,
*first_wire_orpc_extent = NULL; *first_wire_orpc_extent = NULL;
if (msg->BufferLength < FIELD_OFFSET(ORPCTHIS, extensions) + 4) if (msg->BufferLength < FIELD_OFFSET(WIRE_ORPCTHIS, extensions) + sizeof(DWORD))
{ {
ERR("invalid buffer length\n"); ERR("invalid buffer length\n");
return RPC_E_INVALID_HEADER; return RPC_E_INVALID_HEADER;
} }
memcpy(orpcthis, msg->Buffer, FIELD_OFFSET(ORPCTHIS, extensions)); memcpy(orpcthis, msg->Buffer, FIELD_OFFSET(WIRE_ORPCTHIS, extensions));
msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(ORPCTHIS, extensions); msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPCTHIS, extensions);
if ((const char *)msg->Buffer + sizeof(DWORD) > end) if ((const char *)msg->Buffer + sizeof(DWORD) > end)
return RPC_E_INVALID_HEADER; return RPC_E_INVALID_HEADER;
@ -1256,14 +1278,14 @@ static HRESULT unmarshal_ORPCTHAT(RPC_MESSAGE *msg, ORPCTHAT *orpcthat,
*first_wire_orpc_extent = NULL; *first_wire_orpc_extent = NULL;
if (msg->BufferLength < FIELD_OFFSET(ORPCTHAT, extensions) + 4) if (msg->BufferLength < FIELD_OFFSET(WIRE_ORPCTHAT, extensions) + sizeof(DWORD))
{ {
ERR("invalid buffer length\n"); ERR("invalid buffer length\n");
return RPC_E_INVALID_HEADER; return RPC_E_INVALID_HEADER;
} }
memcpy(orpcthat, msg->Buffer, FIELD_OFFSET(ORPCTHAT, extensions)); memcpy(orpcthat, msg->Buffer, FIELD_OFFSET(WIRE_ORPCTHAT, extensions));
msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(ORPCTHAT, extensions); msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPCTHAT, extensions);
if ((const char *)msg->Buffer + sizeof(DWORD) > end) if ((const char *)msg->Buffer + sizeof(DWORD) > end)
return RPC_E_INVALID_HEADER; return RPC_E_INVALID_HEADER;

View file

@ -2583,6 +2583,7 @@ static HRESULT StorageImpl_Construct(
DWORD openFlags, DWORD openFlags,
BOOL fileBased, BOOL fileBased,
BOOL create, BOOL create,
ULONG sector_size,
StorageImpl** result) StorageImpl** result)
{ {
StorageImpl* This; StorageImpl* This;
@ -2634,7 +2635,7 @@ static HRESULT StorageImpl_Construct(
/* /*
* Initialize the big block cache. * Initialize the big block cache.
*/ */
This->bigBlockSize = DEF_BIG_BLOCK_SIZE; This->bigBlockSize = sector_size;
This->smallBlockSize = DEF_SMALL_BLOCK_SIZE; This->smallBlockSize = DEF_SMALL_BLOCK_SIZE;
This->bigBlockFile = BIGBLOCKFILE_Construct(hFile, This->bigBlockFile = BIGBLOCKFILE_Construct(hFile,
pLkbyt, pLkbyt,
@ -2665,8 +2666,12 @@ static HRESULT StorageImpl_Construct(
This->bigBlockDepotCount = 1; This->bigBlockDepotCount = 1;
This->bigBlockDepotStart[0] = 0; This->bigBlockDepotStart[0] = 0;
This->rootStartBlock = 1; This->rootStartBlock = 1;
This->smallBlockLimit = LIMIT_TO_USE_SMALL_BLOCK;
This->smallBlockDepotStart = BLOCK_END_OF_CHAIN; This->smallBlockDepotStart = BLOCK_END_OF_CHAIN;
This->bigBlockSizeBits = DEF_BIG_BLOCK_SIZE_BITS; if (sector_size == 4096)
This->bigBlockSizeBits = MAX_BIG_BLOCK_SIZE_BITS;
else
This->bigBlockSizeBits = MIN_BIG_BLOCK_SIZE_BITS;
This->smallBlockSizeBits = DEF_SMALL_BLOCK_SIZE_BITS; This->smallBlockSizeBits = DEF_SMALL_BLOCK_SIZE_BITS;
This->extBigBlockDepotStart = BLOCK_END_OF_CHAIN; This->extBigBlockDepotStart = BLOCK_END_OF_CHAIN;
This->extBigBlockDepotCount = 0; This->extBigBlockDepotCount = 0;
@ -2711,6 +2716,8 @@ static HRESULT StorageImpl_Construct(
*/ */
This->prevFreeBlock = 0; This->prevFreeBlock = 0;
This->firstFreeSmallBlock = 0;
/* /*
* Create the block chain abstractions. * Create the block chain abstractions.
*/ */
@ -3348,6 +3355,11 @@ static HRESULT StorageImpl_LoadFileHeader(
OFFSET_ROOTSTARTBLOCK, OFFSET_ROOTSTARTBLOCK,
&This->rootStartBlock); &This->rootStartBlock);
StorageUtl_ReadDWord(
headerBigBlock,
OFFSET_SMALLBLOCKLIMIT,
&This->smallBlockLimit);
StorageUtl_ReadDWord( StorageUtl_ReadDWord(
headerBigBlock, headerBigBlock,
OFFSET_SBDEPOTSTART, OFFSET_SBDEPOTSTART,
@ -3382,9 +3394,11 @@ static HRESULT StorageImpl_LoadFileHeader(
* blocks, just make sure they are what we're expecting. * blocks, just make sure they are what we're expecting.
*/ */
if ((This->bigBlockSize != MIN_BIG_BLOCK_SIZE && This->bigBlockSize != MAX_BIG_BLOCK_SIZE) || if ((This->bigBlockSize != MIN_BIG_BLOCK_SIZE && This->bigBlockSize != MAX_BIG_BLOCK_SIZE) ||
This->smallBlockSize != DEF_SMALL_BLOCK_SIZE) This->smallBlockSize != DEF_SMALL_BLOCK_SIZE ||
This->smallBlockLimit != LIMIT_TO_USE_SMALL_BLOCK)
{ {
WARN("Broken OLE storage file\n"); FIXME("Broken OLE storage file? bigblock=0x%x, smallblock=0x%x, sblimit=0x%x\n",
This->bigBlockSize, This->smallBlockSize, This->smallBlockLimit);
hr = STG_E_INVALIDHEADER; hr = STG_E_INVALIDHEADER;
} }
else else
@ -3438,7 +3452,6 @@ static void StorageImpl_SaveFileHeader(
StorageUtl_WriteWord(headerBigBlock, 0x18, 0x3b); StorageUtl_WriteWord(headerBigBlock, 0x18, 0x3b);
StorageUtl_WriteWord(headerBigBlock, 0x1a, 0x3); StorageUtl_WriteWord(headerBigBlock, 0x1a, 0x3);
StorageUtl_WriteWord(headerBigBlock, 0x1c, (WORD)-2); StorageUtl_WriteWord(headerBigBlock, 0x1c, (WORD)-2);
StorageUtl_WriteDWord(headerBigBlock, 0x38, (DWORD)0x1000);
} }
/* /*
@ -3464,6 +3477,11 @@ static void StorageImpl_SaveFileHeader(
OFFSET_ROOTSTARTBLOCK, OFFSET_ROOTSTARTBLOCK,
This->rootStartBlock); This->rootStartBlock);
StorageUtl_WriteDWord(
headerBigBlock,
OFFSET_SMALLBLOCKLIMIT,
This->smallBlockLimit);
StorageUtl_WriteDWord( StorageUtl_WriteDWord(
headerBigBlock, headerBigBlock,
OFFSET_SBDEPOTSTART, OFFSET_SBDEPOTSTART,
@ -4341,13 +4359,14 @@ static HRESULT Storage_Construct(
DWORD openFlags, DWORD openFlags,
BOOL fileBased, BOOL fileBased,
BOOL create, BOOL create,
ULONG sector_size,
StorageBaseImpl** result) StorageBaseImpl** result)
{ {
StorageImpl *newStorage; StorageImpl *newStorage;
StorageBaseImpl *newTransactedStorage; StorageBaseImpl *newTransactedStorage;
HRESULT hr; HRESULT hr;
hr = StorageImpl_Construct(hFile, pwcsName, pLkbyt, openFlags, fileBased, create, &newStorage); hr = StorageImpl_Construct(hFile, pwcsName, pLkbyt, openFlags, fileBased, create, sector_size, &newStorage);
if (FAILED(hr)) goto end; if (FAILED(hr)) goto end;
if (openFlags & STGM_TRANSACTED) if (openFlags & STGM_TRANSACTED)
@ -4840,6 +4859,7 @@ static StorageInternalImpl* StorageInternalImpl_Construct(
* Initialize the virtual function table. * Initialize the virtual function table.
*/ */
newStorage->base.lpVtbl = &Storage32InternalImpl_Vtbl; newStorage->base.lpVtbl = &Storage32InternalImpl_Vtbl;
newStorage->base.pssVtbl = &IPropertySetStorage_Vtbl;
newStorage->base.baseVtbl = &StorageInternalImpl_BaseVtbl; newStorage->base.baseVtbl = &StorageInternalImpl_BaseVtbl;
newStorage->base.openFlags = (openFlags & ~STGM_CREATE); newStorage->base.openFlags = (openFlags & ~STGM_CREATE);
@ -5710,7 +5730,7 @@ static ULONG SmallBlockChainStream_GetNextFreeBlock(
ULARGE_INTEGER offsetOfBlockInDepot; ULARGE_INTEGER offsetOfBlockInDepot;
DWORD buffer; DWORD buffer;
ULONG bytesRead; ULONG bytesRead;
ULONG blockIndex = 0; ULONG blockIndex = This->parentStorage->firstFreeSmallBlock;
ULONG nextBlockIndex = BLOCK_END_OF_CHAIN; ULONG nextBlockIndex = BLOCK_END_OF_CHAIN;
HRESULT res = S_OK; HRESULT res = S_OK;
ULONG smallBlocksPerBigBlock; ULONG smallBlocksPerBigBlock;
@ -5819,6 +5839,8 @@ static ULONG SmallBlockChainStream_GetNextFreeBlock(
} }
} }
This->parentStorage->firstFreeSmallBlock = blockIndex+1;
smallBlocksPerBigBlock = smallBlocksPerBigBlock =
This->parentStorage->bigBlockSize / This->parentStorage->smallBlockSize; This->parentStorage->bigBlockSize / This->parentStorage->smallBlockSize;
@ -6117,6 +6139,7 @@ static BOOL SmallBlockChainStream_Shrink(
&blockIndex))) &blockIndex)))
return FALSE; return FALSE;
SmallBlockChainStream_FreeBlock(This, extraBlock); SmallBlockChainStream_FreeBlock(This, extraBlock);
This->parentStorage->firstFreeSmallBlock = min(This->parentStorage->firstFreeSmallBlock, extraBlock);
extraBlock = blockIndex; extraBlock = blockIndex;
} }
@ -6293,30 +6316,13 @@ static ULARGE_INTEGER SmallBlockChainStream_GetSize(SmallBlockChainStream* This)
return chainEntry.size; return chainEntry.size;
} }
/****************************************************************************** static HRESULT create_storagefile(
* StgCreateDocfile [OLE32.@]
* Creates a new compound file storage object
*
* PARAMS
* pwcsName [ I] Unicode string with filename (can be relative or NULL)
* grfMode [ I] Access mode for opening the new storage object (see STGM_ constants)
* reserved [ ?] unused?, usually 0
* ppstgOpen [IO] A pointer to IStorage pointer to the new onject
*
* RETURNS
* S_OK if the file was successfully created
* some STG_E_ value if error
* NOTES
* if pwcsName is NULL, create file with new unique name
* the function can returns
* STG_S_CONVERTED if the specified file was successfully converted to storage format
* (unrealized now)
*/
HRESULT WINAPI StgCreateDocfile(
LPCOLESTR pwcsName, LPCOLESTR pwcsName,
DWORD grfMode, DWORD grfMode,
DWORD reserved, DWORD grfAttrs,
IStorage **ppstgOpen) STGOPTIONS* pStgOptions,
REFIID riid,
void** ppstgOpen)
{ {
StorageBaseImpl* newStorage = 0; StorageBaseImpl* newStorage = 0;
HANDLE hFile = INVALID_HANDLE_VALUE; HANDLE hFile = INVALID_HANDLE_VALUE;
@ -6327,13 +6333,10 @@ HRESULT WINAPI StgCreateDocfile(
DWORD fileAttributes; DWORD fileAttributes;
WCHAR tempFileName[MAX_PATH]; WCHAR tempFileName[MAX_PATH];
TRACE("(%s, %x, %d, %p)\n",
debugstr_w(pwcsName), grfMode,
reserved, ppstgOpen);
if (ppstgOpen == 0) if (ppstgOpen == 0)
return STG_E_INVALIDPOINTER; return STG_E_INVALIDPOINTER;
if (reserved != 0)
if (pStgOptions->ulSectorSize != MIN_BIG_BLOCK_SIZE && pStgOptions->ulSectorSize != MAX_BIG_BLOCK_SIZE)
return STG_E_INVALIDPARAMETER; return STG_E_INVALIDPARAMETER;
/* if no share mode given then DENY_NONE is the default */ /* if no share mode given then DENY_NONE is the default */
@ -6435,6 +6438,7 @@ HRESULT WINAPI StgCreateDocfile(
grfMode, grfMode,
TRUE, TRUE,
TRUE, TRUE,
pStgOptions->ulSectorSize,
&newStorage); &newStorage);
if (FAILED(hr)) if (FAILED(hr))
@ -6442,10 +6446,9 @@ HRESULT WINAPI StgCreateDocfile(
goto end; goto end;
} }
/* hr = IStorage_QueryInterface((IStorage*)newStorage, riid, ppstgOpen);
* Get an "out" pointer for the caller.
*/ IStorage_Release((IStorage*)newStorage);
*ppstgOpen = (IStorage*)newStorage;
end: end:
TRACE("<-- %p r = %08x\n", *ppstgOpen, hr); TRACE("<-- %p r = %08x\n", *ppstgOpen, hr);
@ -6453,6 +6456,45 @@ end:
return hr; return hr;
} }
/******************************************************************************
* StgCreateDocfile [OLE32.@]
* Creates a new compound file storage object
*
* PARAMS
* pwcsName [ I] Unicode string with filename (can be relative or NULL)
* grfMode [ I] Access mode for opening the new storage object (see STGM_ constants)
* reserved [ ?] unused?, usually 0
* ppstgOpen [IO] A pointer to IStorage pointer to the new onject
*
* RETURNS
* S_OK if the file was successfully created
* some STG_E_ value if error
* NOTES
* if pwcsName is NULL, create file with new unique name
* the function can returns
* STG_S_CONVERTED if the specified file was successfully converted to storage format
* (unrealized now)
*/
HRESULT WINAPI StgCreateDocfile(
LPCOLESTR pwcsName,
DWORD grfMode,
DWORD reserved,
IStorage **ppstgOpen)
{
STGOPTIONS stgoptions = {1, 0, 512};
TRACE("(%s, %x, %d, %p)\n",
debugstr_w(pwcsName), grfMode,
reserved, ppstgOpen);
if (ppstgOpen == 0)
return STG_E_INVALIDPOINTER;
if (reserved != 0)
return STG_E_INVALIDPARAMETER;
return create_storagefile(pwcsName, grfMode, 0, &stgoptions, &IID_IStorage, (void**)ppstgOpen);
}
/****************************************************************************** /******************************************************************************
* StgCreateStorageEx [OLE32.@] * StgCreateStorageEx [OLE32.@]
*/ */
@ -6481,10 +6523,10 @@ HRESULT WINAPI StgCreateStorageEx(const WCHAR* pwcsName, DWORD grfMode, DWORD st
if (stgfmt == STGFMT_STORAGE || stgfmt == STGFMT_DOCFILE) if (stgfmt == STGFMT_STORAGE || stgfmt == STGFMT_DOCFILE)
{ {
FIXME("Stub: calling StgCreateDocfile, but ignoring pStgOptions and grfAttrs\n"); return create_storagefile(pwcsName, grfMode, grfAttrs, pStgOptions, riid, ppObjectOpen);
return StgCreateDocfile(pwcsName, grfMode, 0, (IStorage **)ppObjectOpen);
} }
ERR("Invalid stgfmt argument\n"); ERR("Invalid stgfmt argument\n");
return STG_E_INVALIDPARAMETER; return STG_E_INVALIDPARAMETER;
} }
@ -6707,6 +6749,7 @@ HRESULT WINAPI StgOpenStorage(
grfMode, grfMode,
TRUE, TRUE,
FALSE, FALSE,
512,
&newStorage); &newStorage);
if (FAILED(hr)) if (FAILED(hr))
@ -6754,6 +6797,7 @@ HRESULT WINAPI StgCreateDocfileOnILockBytes(
grfMode, grfMode,
FALSE, FALSE,
TRUE, TRUE,
512,
&newStorage); &newStorage);
if (FAILED(hr)) if (FAILED(hr))
@ -6801,6 +6845,7 @@ HRESULT WINAPI StgOpenStorageOnILockBytes(
grfMode, grfMode,
FALSE, FALSE,
FALSE, FALSE,
512,
&newStorage); &newStorage);
if (FAILED(hr)) if (FAILED(hr))

View file

@ -46,6 +46,7 @@ static const ULONG OFFSET_BIGBLOCKSIZEBITS = 0x0000001e;
static const ULONG OFFSET_SMALLBLOCKSIZEBITS = 0x00000020; static const ULONG OFFSET_SMALLBLOCKSIZEBITS = 0x00000020;
static const ULONG OFFSET_BBDEPOTCOUNT = 0x0000002C; static const ULONG OFFSET_BBDEPOTCOUNT = 0x0000002C;
static const ULONG OFFSET_ROOTSTARTBLOCK = 0x00000030; static const ULONG OFFSET_ROOTSTARTBLOCK = 0x00000030;
static const ULONG OFFSET_SMALLBLOCKLIMIT = 0x00000038;
static const ULONG OFFSET_SBDEPOTSTART = 0x0000003C; static const ULONG OFFSET_SBDEPOTSTART = 0x0000003C;
static const ULONG OFFSET_SBDEPOTCOUNT = 0x00000040; static const ULONG OFFSET_SBDEPOTCOUNT = 0x00000040;
static const ULONG OFFSET_EXTBBDEPOTSTART = 0x00000044; static const ULONG OFFSET_EXTBBDEPOTSTART = 0x00000044;
@ -65,6 +66,8 @@ static const ULONG OFFSET_PS_MTIMEHIGH = 0x00000070;
static const ULONG OFFSET_PS_STARTBLOCK = 0x00000074; static const ULONG OFFSET_PS_STARTBLOCK = 0x00000074;
static const ULONG OFFSET_PS_SIZE = 0x00000078; static const ULONG OFFSET_PS_SIZE = 0x00000078;
static const WORD DEF_BIG_BLOCK_SIZE_BITS = 0x0009; static const WORD DEF_BIG_BLOCK_SIZE_BITS = 0x0009;
static const WORD MIN_BIG_BLOCK_SIZE_BITS = 0x0009;
static const WORD MAX_BIG_BLOCK_SIZE_BITS = 0x000c;
static const WORD DEF_SMALL_BLOCK_SIZE_BITS = 0x0006; static const WORD DEF_SMALL_BLOCK_SIZE_BITS = 0x0006;
static const WORD DEF_BIG_BLOCK_SIZE = 0x0200; static const WORD DEF_BIG_BLOCK_SIZE = 0x0200;
static const WORD DEF_SMALL_BLOCK_SIZE = 0x0040; static const WORD DEF_SMALL_BLOCK_SIZE = 0x0040;
@ -97,6 +100,8 @@ static const ULONG DIRENTRY_NULL = 0xFFFFFFFF;
#define STGTY_ROOT 0x05 #define STGTY_ROOT 0x05
#define COUNT_BBDEPOTINHEADER 109 #define COUNT_BBDEPOTINHEADER 109
/* FIXME: This value is stored in the header, but we hard-code it to 0x1000. */
#define LIMIT_TO_USE_SMALL_BLOCK 0x1000 #define LIMIT_TO_USE_SMALL_BLOCK 0x1000
#define STGM_ACCESS_MODE(stgm) ((stgm)&0x0000f) #define STGM_ACCESS_MODE(stgm) ((stgm)&0x0000f)
@ -351,6 +356,7 @@ struct StorageImpl
ULONG smallBlockSize; ULONG smallBlockSize;
ULONG bigBlockDepotCount; ULONG bigBlockDepotCount;
ULONG rootStartBlock; ULONG rootStartBlock;
ULONG smallBlockLimit;
ULONG smallBlockDepotStart; ULONG smallBlockDepotStart;
ULONG extBigBlockDepotStart; ULONG extBigBlockDepotStart;
ULONG extBigBlockDepotCount; ULONG extBigBlockDepotCount;
@ -360,6 +366,9 @@ struct StorageImpl
ULONG indexBlockDepotCached; ULONG indexBlockDepotCached;
ULONG prevFreeBlock; ULONG prevFreeBlock;
/* All small blocks before this one are known to be in use. */
ULONG firstFreeSmallBlock;
/* /*
* Abstraction of the big block chains for the chains of the header. * Abstraction of the big block chains for the chains of the header.
*/ */

View file

@ -1273,7 +1273,7 @@ static HRESULT OLEPictureImpl_LoadEnhMetafile(OLEPictureImpl *This,
static HRESULT OLEPictureImpl_LoadAPM(OLEPictureImpl *This, static HRESULT OLEPictureImpl_LoadAPM(OLEPictureImpl *This,
const BYTE *data, ULONG size) const BYTE *data, ULONG size)
{ {
APM_HEADER *header = (APM_HEADER *)data; const APM_HEADER *header = (const APM_HEADER *)data;
HMETAFILE hmf; HMETAFILE hmf;
if (size < sizeof(APM_HEADER)) if (size < sizeof(APM_HEADER))

View file

@ -480,6 +480,12 @@ static struct regsvr_coclass const coclass_list[] = {
"Obsolete Font", "Obsolete Font",
"OldFont" "OldFont"
}, },
{ &IID_ISupportErrorInfo,
"PSSupportErrorInfo",
"ole2disp.dll",
"oleaut32.dll",
NULL
},
{ NULL } /* list terminator */ { NULL } /* list terminator */
}; };

View file

@ -283,30 +283,9 @@ static WCHAR *get_lcid_subkey( LCID lcid, SYSKIND syskind, WCHAR *buffer )
static HRESULT TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath, ITypeLib2 **ppTypeLib); static HRESULT TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath, ITypeLib2 **ppTypeLib);
/**************************************************************************** /* Get the path to a registered type library. Helper for QueryPathOfRegTypeLib. */
* QueryPathOfRegTypeLib [OLEAUT32.164] static HRESULT query_typelib_path( REFGUID guid, WORD wMaj, WORD wMin,
* SYSKIND syskind, LCID lcid, LPBSTR path )
* Gets the path to a registered type library.
*
* PARAMS
* guid [I] referenced guid
* wMaj [I] major version
* wMin [I] minor version
* lcid [I] locale id
* path [O] path of typelib
*
* RETURNS
* Success: S_OK.
* Failure: If the type library is not registered then TYPE_E_LIBNOTREGISTERED
* or TYPE_E_REGISTRYACCESS if the type library registration key couldn't be
* opened.
*/
HRESULT WINAPI QueryPathOfRegTypeLib(
REFGUID guid,
WORD wMaj,
WORD wMin,
LCID lcid,
LPBSTR path )
{ {
HRESULT hr = TYPE_E_LIBNOTREGISTERED; HRESULT hr = TYPE_E_LIBNOTREGISTERED;
LCID myLCID = lcid; LCID myLCID = lcid;
@ -336,7 +315,7 @@ HRESULT WINAPI QueryPathOfRegTypeLib(
{ {
LONG dwPathLen = sizeof(Path); LONG dwPathLen = sizeof(Path);
get_lcid_subkey( myLCID, SYS_WIN32, buffer ); get_lcid_subkey( myLCID, syskind, buffer );
if (RegQueryValueW(hkey, buffer, Path, &dwPathLen)) if (RegQueryValueW(hkey, buffer, Path, &dwPathLen))
{ {
@ -368,6 +347,29 @@ HRESULT WINAPI QueryPathOfRegTypeLib(
return hr; return hr;
} }
/****************************************************************************
* QueryPathOfRegTypeLib [OLEAUT32.164]
*
* Gets the path to a registered type library.
*
* PARAMS
* guid [I] referenced guid
* wMaj [I] major version
* wMin [I] minor version
* lcid [I] locale id
* path [O] path of typelib
*
* RETURNS
* Success: S_OK.
* Failure: If the type library is not registered then TYPE_E_LIBNOTREGISTERED
* or TYPE_E_REGISTRYACCESS if the type library registration key couldn't be
* opened.
*/
HRESULT WINAPI QueryPathOfRegTypeLib( REFGUID guid, WORD wMaj, WORD wMin, LCID lcid, LPBSTR path )
{
return query_typelib_path( guid, wMaj, wMin, SYS_WIN32, lcid, path );
}
/****************************************************************************** /******************************************************************************
* CreateTypeLib [OLEAUT32.160] creates a typelib * CreateTypeLib [OLEAUT32.160] creates a typelib
* *
@ -691,7 +693,10 @@ HRESULT WINAPI RegisterTypeLib(
MESSAGE("\n"); MESSAGE("\n");
} }
if (tattr->wTypeFlags & (TYPEFLAG_FOLEAUTOMATION|TYPEFLAG_FDUAL|TYPEFLAG_FDISPATCHABLE)) /* Register all dispinterfaces (which includes dual interfaces) and
oleautomation interfaces */
if ((kind == TKIND_INTERFACE && (tattr->wTypeFlags & TYPEFLAG_FOLEAUTOMATION)) ||
kind == TKIND_DISPATCH)
{ {
/* register interface<->typelib coupling */ /* register interface<->typelib coupling */
get_interface_key( &tattr->guid, keyName ); get_interface_key( &tattr->guid, keyName );
@ -796,7 +801,7 @@ HRESULT WINAPI UnRegisterTypeLib(
} }
/* get the path to the typelib on disk */ /* get the path to the typelib on disk */
if (QueryPathOfRegTypeLib(libid, wVerMajor, wVerMinor, lcid, &tlibPath) != S_OK) { if (query_typelib_path(libid, wVerMajor, wVerMinor, syskind, lcid, &tlibPath) != S_OK) {
result = E_INVALIDARG; result = E_INVALIDARG;
goto end; goto end;
} }
@ -832,19 +837,23 @@ HRESULT WINAPI UnRegisterTypeLib(
goto enddeleteloop; goto enddeleteloop;
} }
/* the path to the type */ if ((kind == TKIND_INTERFACE && (typeAttr->wTypeFlags & TYPEFLAG_FOLEAUTOMATION)) ||
get_interface_key( &typeAttr->guid, subKeyName ); kind == TKIND_DISPATCH)
{
/* the path to the type */
get_interface_key( &typeAttr->guid, subKeyName );
/* Delete its bits */ /* Delete its bits */
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, subKeyName, 0, KEY_WRITE, &subKey) != ERROR_SUCCESS) { if (RegOpenKeyExW(HKEY_CLASSES_ROOT, subKeyName, 0, KEY_WRITE, &subKey) != ERROR_SUCCESS)
goto enddeleteloop; goto enddeleteloop;
RegDeleteKeyW(subKey, ProxyStubClsidW);
RegDeleteKeyW(subKey, ProxyStubClsid32W);
RegDeleteKeyW(subKey, TypeLibW);
RegCloseKey(subKey);
subKey = NULL;
RegDeleteKeyW(HKEY_CLASSES_ROOT, subKeyName);
} }
RegDeleteKeyW(subKey, ProxyStubClsidW);
RegDeleteKeyW(subKey, ProxyStubClsid32W);
RegDeleteKeyW(subKey, TypeLibW);
RegCloseKey(subKey);
subKey = NULL;
RegDeleteKeyW(HKEY_CLASSES_ROOT, subKeyName);
enddeleteloop: enddeleteloop:
if (typeAttr) ITypeInfo_ReleaseTypeAttr(typeInfo, typeAttr); if (typeAttr) ITypeInfo_ReleaseTypeAttr(typeInfo, typeAttr);
@ -1901,7 +1910,7 @@ MSFT_DoFuncs(TLBContext* pcx,
{ {
if (!IS_INTRESOURCE(pFuncRec->OptAttr[2])) if (!IS_INTRESOURCE(pFuncRec->OptAttr[2]))
ERR("ordinal 0x%08x invalid, IS_INTRESOURCE is false\n", pFuncRec->OptAttr[2]); ERR("ordinal 0x%08x invalid, IS_INTRESOURCE is false\n", pFuncRec->OptAttr[2]);
(*pptfd)->Entry = (BSTR)pFuncRec->OptAttr[2]; (*pptfd)->Entry = (BSTR)(DWORD_PTR)LOWORD(pFuncRec->OptAttr[2]);
} }
else else
{ {
@ -2927,7 +2936,7 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength)
else if(td[0] == VT_CARRAY) else if(td[0] == VT_CARRAY)
{ {
/* array descr table here */ /* array descr table here */
pTypeLibImpl->pTypeDesc[i].u.lpadesc = (void *)((int) td[2]); /* temp store offset in*/ pTypeLibImpl->pTypeDesc[i].u.lpadesc = (void *)(INT_PTR)td[2]; /* temp store offset in*/
} }
else if(td[0] == VT_USERDEFINED) else if(td[0] == VT_USERDEFINED)
{ {
@ -2942,7 +2951,7 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength)
if(pTypeLibImpl->pTypeDesc[i].vt != VT_CARRAY) continue; if(pTypeLibImpl->pTypeDesc[i].vt != VT_CARRAY) continue;
if(tlbSegDir.pArrayDescriptions.offset>0) if(tlbSegDir.pArrayDescriptions.offset>0)
{ {
MSFT_ReadLEWords(td, sizeof(td), &cx, tlbSegDir.pArrayDescriptions.offset + (int) pTypeLibImpl->pTypeDesc[i].u.lpadesc); MSFT_ReadLEWords(td, sizeof(td), &cx, tlbSegDir.pArrayDescriptions.offset + (INT_PTR)pTypeLibImpl->pTypeDesc[i].u.lpadesc);
pTypeLibImpl->pTypeDesc[i].u.lpadesc = TLB_Alloc(sizeof(ARRAYDESC)+sizeof(SAFEARRAYBOUND)*(td[3]-1)); pTypeLibImpl->pTypeDesc[i].u.lpadesc = TLB_Alloc(sizeof(ARRAYDESC)+sizeof(SAFEARRAYBOUND)*(td[3]-1));
if(td[1]<0) if(td[1]<0)
@ -4779,13 +4788,7 @@ static HRESULT WINAPI ITypeLibComp_fnBind(
&subtypeinfo, &subdesckind, &subbindptr); &subtypeinfo, &subdesckind, &subbindptr);
if (SUCCEEDED(hr) && (subdesckind != DESCKIND_NONE)) if (SUCCEEDED(hr) && (subdesckind != DESCKIND_NONE))
{ {
TYPEDESC tdesc_appobject = TYPEDESC tdesc_appobject;
{
{
(TYPEDESC *)pTypeInfo->hreftype
},
VT_USERDEFINED
};
const VARDESC vardesc_appobject = const VARDESC vardesc_appobject =
{ {
-2, /* memid */ -2, /* memid */
@ -4807,6 +4810,9 @@ static HRESULT WINAPI ITypeLibComp_fnBind(
VAR_STATIC /* varkind */ VAR_STATIC /* varkind */
}; };
tdesc_appobject.u.hreftype = pTypeInfo->hreftype;
tdesc_appobject.vt = VT_USERDEFINED;
TRACE("found in implicit app object: %s\n", debugstr_w(szName)); TRACE("found in implicit app object: %s\n", debugstr_w(szName));
/* cleanup things filled in by Bind call so we can put our /* cleanup things filled in by Bind call so we can put our
@ -5696,7 +5702,8 @@ _invoke(FARPROC func,CALLCONV callconv, int nrargs, DWORD *args) {
if (TRACE_ON(ole)) { if (TRACE_ON(ole)) {
int i; int i;
TRACE("Calling %p(",func); TRACE("Calling %p(",func);
for (i=0;i<nrargs;i++) TRACE("%08x,",args[i]); for (i=0;i<min(nrargs,30);i++) TRACE("%08x,",args[i]);
if (nrargs > 30) TRACE("...");
TRACE(")\n"); TRACE(")\n");
} }
@ -6102,10 +6109,11 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
continue; continue;
} }
src_arg = NULL;
if (cNamedArgs) if (cNamedArgs)
{ {
USHORT j; USHORT j;
src_arg = NULL;
for (j = 0; j < cNamedArgs; j++) for (j = 0; j < cNamedArgs; j++)
if (rgdispidNamedArgs[j] == i || (i == func_desc->cParams-1 && rgdispidNamedArgs[j] == DISPID_PROPERTYPUT)) if (rgdispidNamedArgs[j] == i || (i == func_desc->cParams-1 && rgdispidNamedArgs[j] == DISPID_PROPERTYPUT))
{ {
@ -6113,9 +6121,10 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
break; break;
} }
} }
else
if (!src_arg && vargs_converted + cNamedArgs < pDispParams->cArgs)
{ {
src_arg = vargs_converted < pDispParams->cArgs ? &pDispParams->rgvarg[pDispParams->cArgs - 1 - vargs_converted] : NULL; src_arg = &pDispParams->rgvarg[pDispParams->cArgs - 1 - vargs_converted];
vargs_converted++; vargs_converted++;
} }
@ -6596,7 +6605,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDllEntry( ITypeInfo2 *iface, MEMBERID memid
if (pBstrName) if (pBstrName)
*pBstrName = NULL; *pBstrName = NULL;
if (pwOrdinal) if (pwOrdinal)
*pwOrdinal = (DWORD)pFDesc->Entry; *pwOrdinal = LOWORD(pFDesc->Entry);
return S_OK; return S_OK;
} }
return TYPE_E_ELEMENTNOTFOUND; return TYPE_E_ELEMENTNOTFOUND;

View file

@ -2456,7 +2456,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
return hres; return hres;
} }
This->typeinfo->cbSizeVft = typeattr->cbSizeVft; This->typeinfo->cbSizeVft = typeattr->cbSizeVft * 4 / sizeof(void *);
ITypeInfo_ReleaseTypeAttr(inherited, typeattr); ITypeInfo_ReleaseTypeAttr(inherited, typeattr);
ITypeInfo_Release(inherited); ITypeInfo_Release(inherited);
@ -2928,7 +2928,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetTypeAttr(
(*ppTypeAttr)->cFuncs += 7; (*ppTypeAttr)->cFuncs += 7;
(*ppTypeAttr)->cVars = This->typeinfo->cElement>>16; (*ppTypeAttr)->cVars = This->typeinfo->cElement>>16;
(*ppTypeAttr)->cImplTypes = This->typeinfo->cImplTypes; (*ppTypeAttr)->cImplTypes = This->typeinfo->cImplTypes;
(*ppTypeAttr)->cbSizeVft = This->typekind==TKIND_DISPATCH ? 28 : This->typeinfo->cbSizeVft; (*ppTypeAttr)->cbSizeVft = This->typekind==TKIND_DISPATCH ? 7 * sizeof(void*) : This->typeinfo->cbSizeVft;
(*ppTypeAttr)->cbAlignment = (This->typeinfo->typekind>>11) & 0x1f; (*ppTypeAttr)->cbAlignment = (This->typeinfo->typekind>>11) & 0x1f;
(*ppTypeAttr)->wTypeFlags = This->typeinfo->flags; (*ppTypeAttr)->wTypeFlags = This->typeinfo->flags;
(*ppTypeAttr)->wMajorVerNum = This->typeinfo->version&0xffff; (*ppTypeAttr)->wMajorVerNum = This->typeinfo->version&0xffff;

View file

@ -3503,7 +3503,7 @@ HRESULT WINAPI VarCyFromR4(FLOAT fltIn, CY* pCyOut)
*/ */
HRESULT WINAPI VarCyFromR8(double dblIn, CY* pCyOut) HRESULT WINAPI VarCyFromR8(double dblIn, CY* pCyOut)
{ {
#if defined(__GNUC__) && defined(__i386__) #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
/* This code gives identical results to Win32 on Intel. /* This code gives identical results to Win32 on Intel.
* Here we use fp exceptions to catch overflows when storing the value. * Here we use fp exceptions to catch overflows when storing the value.
*/ */

View file

@ -2301,6 +2301,9 @@ VOID WINAPI WakeConditionVariable(PCONDITION_VARIABLE);
VOID WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE); VOID WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE);
#endif #endif
BOOL WINAPI WinLoadTrustProvider(GUID*); BOOL WINAPI WinLoadTrustProvider(GUID*);
BOOL WINAPI Wow64DisableWow64FsRedirection(PVOID*);
BOOLEAN WINAPI Wow64EnableWow64FsRedirection(BOOLEAN);
BOOL WINAPI Wow64RevertWow64FsRedirection(PVOID);
BOOL WINAPI WriteFile(HANDLE,LPCVOID,DWORD,LPDWORD,LPOVERLAPPED); BOOL WINAPI WriteFile(HANDLE,LPCVOID,DWORD,LPDWORD,LPOVERLAPPED);
BOOL WINAPI WriteFileEx(HANDLE,LPCVOID,DWORD,LPOVERLAPPED,LPOVERLAPPED_COMPLETION_ROUTINE); BOOL WINAPI WriteFileEx(HANDLE,LPCVOID,DWORD,LPOVERLAPPED,LPOVERLAPPED_COMPLETION_ROUTINE);
BOOL WINAPI WriteFileGather(HANDLE,FILE_SEGMENT_ELEMENT*,DWORD,LPDWORD,LPOVERLAPPED); BOOL WINAPI WriteFileGather(HANDLE,FILE_SEGMENT_ELEMENT*,DWORD,LPDWORD,LPOVERLAPPED);