- Export Wow64* functions in kernel32, because 32bit Windows also exports them.
- Sync ole32, oleaut32 with Wine-1.1.43.
svn path=/trunk/; revision=46959
@ stdcall WaitNamedPipeW (wstr long)
@ stdcall WideCharToMultiByte(long long wstr long ptr long ptr ptr)
@ stdcall WinExec(str long)
-#ifdef _M_AMD64
@ stdcall Wow64EnableWow64FsRedirection(long)
@ stdcall Wow64DisableWow64FsRedirection(long)
@ stdcall Wow64RevertWow64FsRedirection(long)
-#endif
@ stdcall WriteConsoleA(long ptr long ptr ptr)
@ stdcall WriteConsoleInputA(long ptr long ptr)
@ stdcall WriteConsoleInputVDMA(long long long long)
* SEE ALSO
* StringFromCLSID
*/
-static HRESULT __CLSIDFromString(LPCWSTR s, CLSID *id)
+static HRESULT __CLSIDFromString(LPCWSTR s, LPCLSID id)
{
int i;
BYTE table[256];
case DLL_PROCESS_ATTACH:
hProxyDll = hinstDLL;
COMPOBJ_InitProcess();
- if (TRACE_ON(ole)) CoRegisterMallocSpy((LPVOID)-1);
break;
case DLL_PROCESS_DETACH:
- if (TRACE_ON(ole)) CoRevokeMallocSpy();
OLEDD_UnInitialize();
COMPOBJ_UninitProcess();
RPC_UnregisterAllChannelHooks();
hres = IStream_Write (pStm, &object, sizeof (object), NULL);
if (hres != S_OK) return STG_E_MEDIUMFULL;
- hres = IStream_Write (pStm, &constant, sizeof (constant), NULL);
- if (hres != S_OK) return STG_E_MEDIUMFULL;
+ if (sizeof(object) == sizeof(DWORD))
+ {
+ 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);
if (hres != S_OK) return STG_E_MEDIUMFULL;
hres = IStream_Read (pStm, &object, sizeof (object), NULL);
if (hres != S_OK) return STG_E_READFAULT;
- hres = IStream_Read (pStm, &constant, sizeof (constant), NULL);
- if (hres != S_OK) return STG_E_READFAULT;
- if (constant != 0)
- FIXME("constant is 0x%x instead of 0\n", constant);
+ if (sizeof(object) == sizeof(DWORD))
+ {
+ hres = IStream_Read (pStm, &constant, sizeof (constant), NULL);
+ 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);
if (hres != S_OK) return STG_E_READFAULT;
hres = IStream_Read (pStm, &object, sizeof (object), NULL);
if (hres != S_OK) return STG_E_READFAULT;
- hres = IStream_Read (pStm, &constant, sizeof (constant), NULL);
- if (hres != S_OK) return STG_E_READFAULT;
- if (constant != 0)
- FIXME("constant is 0x%x instead of 0\n", constant);
+ if (sizeof(object) == sizeof(DWORD))
+ {
+ hres = IStream_Read (pStm, &constant, sizeof (constant), NULL);
+ 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);
if (hres != S_OK) return STG_E_READFAULT;
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.@]
*
TRACE("\n");
- /* HACK TO ACTIVATE OUT SPY */
- if (pMallocSpy == (LPVOID)-1) pMallocSpy =(IMallocSpy*)&MallocSpy;
-
if(Malloc32.pSpy) return CO_E_OBJISREG;
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) {
TRACE("SpyReleasePending with %u allocations left\n", Malloc32.SpyedAllocationsLeft);
Malloc32.SpyReleasePending = TRUE;
WCHAR cmd[MAX_PATH];
static const WCHAR rpcss[] = {'\\','r','p','c','s','s','.','e','x','e',0};
BOOL rslt;
+ void *redir;
TRACE("\n");
GetSystemDirectoryW( cmd, MAX_PATH - sizeof(rpcss)/sizeof(WCHAR) );
strcatW( cmd, rpcss );
+ Wow64DisableWow64FsRedirection( &redir );
rslt = CreateProcessW( cmd, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
+ Wow64RevertWow64FsRedirection( redir );
if (rslt)
{
<library>ole32_irot_client</library>
<library>ole32_proxy</library>
<library>rpcrt4</library>
+ <library>kernel32</library>
<library>ntdll</library>
<library>uuid</library>
<library>pseh</library>
/* [size_is((size+7)&~7)] */ unsigned char data[1];
} 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 list entry;
extensions_size = ChannelHooks_ServerGetSize(&message_state->channel_hook_info,
&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)
{
- 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)
msg->BufferLength += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]);
}
status = I_RpcGetBuffer(msg);
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? */;
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->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 */
*(DWORD *)msg->Buffer = 1;
msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
extensions_size = ChannelHooks_ClientGetSize(&message_state->channel_hook_info,
&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)
{
- 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)
msg->BufferLength += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]);
}
if (status == RPC_S_OK)
{
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.MinorVersion = COM_MINOR_VERSION;
ORPC_EXTENT_ARRAY *orpc_extent_array = msg->Buffer;
orpc_extent_array->size = extension_count;
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 */
*(DWORD *)msg->Buffer = 1;
msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
DWORD pointer_id;
DWORD i;
- memcpy(extensions, msg->Buffer, FIELD_OFFSET(ORPC_EXTENT_ARRAY, extent));
- msg->Buffer = (char *)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(WIRE_ORPC_EXTENT_ARRAY, extent);
if ((const char *)msg->Buffer + 2 * sizeof(DWORD) > end)
return RPC_E_INVALID_HEADER;
*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");
return RPC_E_INVALID_HEADER;
}
- memcpy(orpcthis, msg->Buffer, FIELD_OFFSET(ORPCTHIS, extensions));
- msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(ORPCTHIS, extensions);
+ memcpy(orpcthis, msg->Buffer, FIELD_OFFSET(WIRE_ORPCTHIS, extensions));
+ msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPCTHIS, extensions);
if ((const char *)msg->Buffer + sizeof(DWORD) > end)
return RPC_E_INVALID_HEADER;
*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");
return RPC_E_INVALID_HEADER;
}
- memcpy(orpcthat, msg->Buffer, FIELD_OFFSET(ORPCTHAT, extensions));
- msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(ORPCTHAT, extensions);
+ memcpy(orpcthat, msg->Buffer, FIELD_OFFSET(WIRE_ORPCTHAT, extensions));
+ msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPCTHAT, extensions);
if ((const char *)msg->Buffer + sizeof(DWORD) > end)
return RPC_E_INVALID_HEADER;
DWORD openFlags,
BOOL fileBased,
BOOL create,
+ ULONG sector_size,
StorageImpl** result)
{
StorageImpl* This;
/*
* Initialize the big block cache.
*/
- This->bigBlockSize = DEF_BIG_BLOCK_SIZE;
+ This->bigBlockSize = sector_size;
This->smallBlockSize = DEF_SMALL_BLOCK_SIZE;
This->bigBlockFile = BIGBLOCKFILE_Construct(hFile,
pLkbyt,
This->bigBlockDepotCount = 1;
This->bigBlockDepotStart[0] = 0;
This->rootStartBlock = 1;
+ This->smallBlockLimit = LIMIT_TO_USE_SMALL_BLOCK;
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->extBigBlockDepotStart = BLOCK_END_OF_CHAIN;
This->extBigBlockDepotCount = 0;
*/
This->prevFreeBlock = 0;
+ This->firstFreeSmallBlock = 0;
+
/*
* Create the block chain abstractions.
*/
OFFSET_ROOTSTARTBLOCK,
&This->rootStartBlock);
+ StorageUtl_ReadDWord(
+ headerBigBlock,
+ OFFSET_SMALLBLOCKLIMIT,
+ &This->smallBlockLimit);
+
StorageUtl_ReadDWord(
headerBigBlock,
OFFSET_SBDEPOTSTART,
* blocks, just make sure they are what we're expecting.
*/
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;
}
else
StorageUtl_WriteWord(headerBigBlock, 0x18, 0x3b);
StorageUtl_WriteWord(headerBigBlock, 0x1a, 0x3);
StorageUtl_WriteWord(headerBigBlock, 0x1c, (WORD)-2);
- StorageUtl_WriteDWord(headerBigBlock, 0x38, (DWORD)0x1000);
}
/*
OFFSET_ROOTSTARTBLOCK,
This->rootStartBlock);
+ StorageUtl_WriteDWord(
+ headerBigBlock,
+ OFFSET_SMALLBLOCKLIMIT,
+ This->smallBlockLimit);
+
StorageUtl_WriteDWord(
headerBigBlock,
OFFSET_SBDEPOTSTART,
DWORD openFlags,
BOOL fileBased,
BOOL create,
+ ULONG sector_size,
StorageBaseImpl** result)
{
StorageImpl *newStorage;
StorageBaseImpl *newTransactedStorage;
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 (openFlags & STGM_TRANSACTED)
* Initialize the virtual function table.
*/
newStorage->base.lpVtbl = &Storage32InternalImpl_Vtbl;
+ newStorage->base.pssVtbl = &IPropertySetStorage_Vtbl;
newStorage->base.baseVtbl = &StorageInternalImpl_BaseVtbl;
newStorage->base.openFlags = (openFlags & ~STGM_CREATE);
ULARGE_INTEGER offsetOfBlockInDepot;
DWORD buffer;
ULONG bytesRead;
- ULONG blockIndex = 0;
+ ULONG blockIndex = This->parentStorage->firstFreeSmallBlock;
ULONG nextBlockIndex = BLOCK_END_OF_CHAIN;
HRESULT res = S_OK;
ULONG smallBlocksPerBigBlock;
}
}
+ This->parentStorage->firstFreeSmallBlock = blockIndex+1;
+
smallBlocksPerBigBlock =
This->parentStorage->bigBlockSize / This->parentStorage->smallBlockSize;
&blockIndex)))
return FALSE;
SmallBlockChainStream_FreeBlock(This, extraBlock);
+ This->parentStorage->firstFreeSmallBlock = min(This->parentStorage->firstFreeSmallBlock, extraBlock);
extraBlock = blockIndex;
}
return chainEntry.size;
}
-/******************************************************************************
- * 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(
+static HRESULT create_storagefile(
LPCOLESTR pwcsName,
DWORD grfMode,
- DWORD reserved,
- IStorage **ppstgOpen)
+ DWORD grfAttrs,
+ STGOPTIONS* pStgOptions,
+ REFIID riid,
+ void** ppstgOpen)
{
StorageBaseImpl* newStorage = 0;
HANDLE hFile = INVALID_HANDLE_VALUE;
DWORD fileAttributes;
WCHAR tempFileName[MAX_PATH];
- TRACE("(%s, %x, %d, %p)\n",
- debugstr_w(pwcsName), grfMode,
- reserved, ppstgOpen);
-
if (ppstgOpen == 0)
return STG_E_INVALIDPOINTER;
- if (reserved != 0)
+
+ if (pStgOptions->ulSectorSize != MIN_BIG_BLOCK_SIZE && pStgOptions->ulSectorSize != MAX_BIG_BLOCK_SIZE)
return STG_E_INVALIDPARAMETER;
/* if no share mode given then DENY_NONE is the default */
grfMode,
TRUE,
TRUE,
+ pStgOptions->ulSectorSize,
&newStorage);
if (FAILED(hr))
goto end;
}
- /*
- * Get an "out" pointer for the caller.
- */
- *ppstgOpen = (IStorage*)newStorage;
+ hr = IStorage_QueryInterface((IStorage*)newStorage, riid, ppstgOpen);
+
+ IStorage_Release((IStorage*)newStorage);
end:
TRACE("<-- %p r = %08x\n", *ppstgOpen, 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.@]
*/
if (stgfmt == STGFMT_STORAGE || stgfmt == STGFMT_DOCFILE)
{
- FIXME("Stub: calling StgCreateDocfile, but ignoring pStgOptions and grfAttrs\n");
- return StgCreateDocfile(pwcsName, grfMode, 0, (IStorage **)ppObjectOpen);
+ return create_storagefile(pwcsName, grfMode, grfAttrs, pStgOptions, riid, ppObjectOpen);
}
+
ERR("Invalid stgfmt argument\n");
return STG_E_INVALIDPARAMETER;
}
grfMode,
TRUE,
FALSE,
+ 512,
&newStorage);
if (FAILED(hr))
grfMode,
FALSE,
TRUE,
+ 512,
&newStorage);
if (FAILED(hr))
grfMode,
FALSE,
FALSE,
+ 512,
&newStorage);
if (FAILED(hr))
static const ULONG OFFSET_SMALLBLOCKSIZEBITS = 0x00000020;
static const ULONG OFFSET_BBDEPOTCOUNT = 0x0000002C;
static const ULONG OFFSET_ROOTSTARTBLOCK = 0x00000030;
+static const ULONG OFFSET_SMALLBLOCKLIMIT = 0x00000038;
static const ULONG OFFSET_SBDEPOTSTART = 0x0000003C;
static const ULONG OFFSET_SBDEPOTCOUNT = 0x00000040;
static const ULONG OFFSET_EXTBBDEPOTSTART = 0x00000044;
static const ULONG OFFSET_PS_STARTBLOCK = 0x00000074;
static const ULONG OFFSET_PS_SIZE = 0x00000078;
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_BIG_BLOCK_SIZE = 0x0200;
static const WORD DEF_SMALL_BLOCK_SIZE = 0x0040;
#define STGTY_ROOT 0x05
#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 STGM_ACCESS_MODE(stgm) ((stgm)&0x0000f)
ULONG smallBlockSize;
ULONG bigBlockDepotCount;
ULONG rootStartBlock;
+ ULONG smallBlockLimit;
ULONG smallBlockDepotStart;
ULONG extBigBlockDepotStart;
ULONG extBigBlockDepotCount;
ULONG indexBlockDepotCached;
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.
*/
static HRESULT OLEPictureImpl_LoadAPM(OLEPictureImpl *This,
const BYTE *data, ULONG size)
{
- APM_HEADER *header = (APM_HEADER *)data;
+ const APM_HEADER *header = (const APM_HEADER *)data;
HMETAFILE hmf;
if (size < sizeof(APM_HEADER))
"Obsolete Font",
"OldFont"
},
+ { &IID_ISupportErrorInfo,
+ "PSSupportErrorInfo",
+ "ole2disp.dll",
+ "oleaut32.dll",
+ NULL
+ },
{ NULL } /* list terminator */
};
static HRESULT TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath, ITypeLib2 **ppTypeLib);
-/****************************************************************************
- * 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 )
+/* Get the path to a registered type library. Helper for QueryPathOfRegTypeLib. */
+static HRESULT query_typelib_path( REFGUID guid, WORD wMaj, WORD wMin,
+ SYSKIND syskind, LCID lcid, LPBSTR path )
{
HRESULT hr = TYPE_E_LIBNOTREGISTERED;
LCID myLCID = lcid;
{
LONG dwPathLen = sizeof(Path);
- get_lcid_subkey( myLCID, SYS_WIN32, buffer );
+ get_lcid_subkey( myLCID, syskind, buffer );
if (RegQueryValueW(hkey, buffer, Path, &dwPathLen))
{
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
*
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 */
get_interface_key( &tattr->guid, keyName );
}
/* 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;
goto end;
}
goto enddeleteloop;
}
- /* the path to the type */
- get_interface_key( &typeAttr->guid, subKeyName );
+ if ((kind == TKIND_INTERFACE && (typeAttr->wTypeFlags & TYPEFLAG_FOLEAUTOMATION)) ||
+ kind == TKIND_DISPATCH)
+ {
+ /* the path to the type */
+ get_interface_key( &typeAttr->guid, subKeyName );
+
+ /* Delete its bits */
+ if (RegOpenKeyExW(HKEY_CLASSES_ROOT, subKeyName, 0, KEY_WRITE, &subKey) != ERROR_SUCCESS)
+ goto enddeleteloop;
- /* Delete its bits */
- if (RegOpenKeyExW(HKEY_CLASSES_ROOT, subKeyName, 0, KEY_WRITE, &subKey) != ERROR_SUCCESS) {
- 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:
if (typeAttr) ITypeInfo_ReleaseTypeAttr(typeInfo, typeAttr);
{
if (!IS_INTRESOURCE(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 if(td[0] == VT_CARRAY)
{
/* 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)
{
if(pTypeLibImpl->pTypeDesc[i].vt != VT_CARRAY) continue;
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));
if(td[1]<0)
&subtypeinfo, &subdesckind, &subbindptr);
if (SUCCEEDED(hr) && (subdesckind != DESCKIND_NONE))
{
- TYPEDESC tdesc_appobject =
- {
- {
- (TYPEDESC *)pTypeInfo->hreftype
- },
- VT_USERDEFINED
- };
+ TYPEDESC tdesc_appobject;
const VARDESC vardesc_appobject =
{
-2, /* memid */
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));
/* cleanup things filled in by Bind call so we can put our
if (TRACE_ON(ole)) {
int i;
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");
}
continue;
}
+ src_arg = NULL;
+
if (cNamedArgs)
{
USHORT j;
- src_arg = NULL;
for (j = 0; j < cNamedArgs; j++)
if (rgdispidNamedArgs[j] == i || (i == func_desc->cParams-1 && rgdispidNamedArgs[j] == DISPID_PROPERTYPUT))
{
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++;
}
if (pBstrName)
*pBstrName = NULL;
if (pwOrdinal)
- *pwOrdinal = (DWORD)pFDesc->Entry;
+ *pwOrdinal = LOWORD(pFDesc->Entry);
return S_OK;
}
return TYPE_E_ELEMENTNOTFOUND;
return hres;
}
- This->typeinfo->cbSizeVft = typeattr->cbSizeVft;
+ This->typeinfo->cbSizeVft = typeattr->cbSizeVft * 4 / sizeof(void *);
ITypeInfo_ReleaseTypeAttr(inherited, typeattr);
ITypeInfo_Release(inherited);
(*ppTypeAttr)->cFuncs += 7;
(*ppTypeAttr)->cVars = This->typeinfo->cElement>>16;
(*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)->wTypeFlags = This->typeinfo->flags;
(*ppTypeAttr)->wMajorVerNum = This->typeinfo->version&0xffff;
*/
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.
* Here we use fp exceptions to catch overflows when storing the value.
*/
VOID WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE);
#endif
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 WriteFileEx(HANDLE,LPCVOID,DWORD,LPOVERLAPPED,LPOVERLAPPED_COMPLETION_ROUTINE);
BOOL WINAPI WriteFileGather(HANDLE,FILE_SEGMENT_ELEMENT*,DWORD,LPDWORD,LPOVERLAPPED);