* Sync with Wine 1.5.19.
svn path=/trunk/; revision=57895
add_definitions(
-D__WINESRC__
-D_OLE32_
+ -DCOM_NO_WINDOWS_H
-DENTRY_PREFIX=OLE32_
-DPROXY_CLSID=CLSID_PSFactoryBuffer
- -DWINE_REGISTER_DLL
- -DCOM_NO_WINDOWS_H)
+ -DWINE_REGISTER_DLL)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c
${CMAKE_CURRENT_BINARY_DIR}/ole32.def)
+if(MSVC)
+ if(ARCH STREQUAL "i386")
+ list(APPEND SOURCE msvc-thiscall.c)
+ endif()
+ set_source_files_properties(stg_prop.c PROPERTIES COMPILE_FLAGS "/FImsvc.h")
+endif()
+
add_library(ole32 SHARED ${SOURCE})
set_module_type(ole32 win32dll)
target_link_libraries(ole32 wine uuid ${PSEH_LIB})
add_importlibs(ole32 advapi32 user32 gdi32 rpcrt4 msvcrt kernel32 ntdll)
+add_delay_importlibs(ole32 oleaut32)
add_dependencies(ole32 ole32idl)
add_cd_file(TARGET ole32 DESTINATION reactos/system32 FOR all)
(void**)ppmk);
}
-static HRESULT WINAPI AntiMonikerCF_QueryInterface(LPCLASSFACTORY iface,
- REFIID riid, LPVOID *ppv)
+static HRESULT WINAPI AntiMonikerCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
{
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
{
*ppv = iface;
- IUnknown_AddRef(iface);
+ IClassFactory_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
return hr;
}
-static HRESULT WINAPI ClassMonikerCF_QueryInterface(LPCLASSFACTORY iface,
- REFIID riid, LPVOID *ppv)
+static HRESULT WINAPI ClassMonikerCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
{
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
{
*ppv = iface;
- IUnknown_AddRef(iface);
+ IClassFactory_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
ProgIDFromCLSID(&clsID, &strProgID);
WideCharToMultiByte( CP_ACP, 0, strProgID, -1, strOleTypeName, sizeof(strOleTypeName), NULL, NULL );
- OLECONVERT_CreateOleStream(std.u.pstg);
+ STORAGE_CreateOleStream(std.u.pstg, 0);
OLECONVERT_CreateCompObjStream(std.u.pstg, strOleTypeName);
+ CoTaskMemFree(strProgID);
}
}
#include "ole2.h"
#include "comcat.h"
+#include "compobj_private.h"
+
#include "wine/unicode.h"
#include "wine/debug.h"
if (FAILED(res)) return res;
/* Create (or open) the CLSID key. */
- res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0,
- KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL);
+ res = create_classes_key(HKEY_CLASSES_ROOT, clsid_keyname, KEY_READ|KEY_WRITE, &clsid_key);
if (res != ERROR_SUCCESS) return E_FAIL;
/* Create (or open) the class key. */
- res = RegCreateKeyExW(clsid_key, keyname, 0, NULL, 0,
- KEY_READ | KEY_WRITE, NULL, &class_key, NULL);
+ res = create_classes_key(clsid_key, keyname, KEY_READ|KEY_WRITE, &class_key);
if (res == ERROR_SUCCESS) {
/* Create (or open) the category type key. */
- res = RegCreateKeyExW(class_key, type, 0, NULL, 0,
- KEY_READ | KEY_WRITE, NULL, &type_key, NULL);
+ res = create_classes_key(class_key, type, KEY_READ|KEY_WRITE, &type_key);
if (res == ERROR_SUCCESS) {
for (; cCategories; --cCategories, ++rgcatid) {
HKEY key;
if (FAILED(res)) continue;
/* Do the register. */
- res = RegCreateKeyExW(type_key, keyname, 0, NULL, 0,
- KEY_READ | KEY_WRITE, NULL, &key, NULL);
+ res = create_classes_key(type_key, keyname, KEY_READ|KEY_WRITE, &key);
if (res == ERROR_SUCCESS) RegCloseKey(key);
}
res = S_OK;
lstrcpyW(keyname + 45, type);
/* Open the class category type key. */
- res = RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0,
- KEY_READ | KEY_WRITE, &type_key);
+ res = open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ|KEY_WRITE, &type_key);
if (res != ERROR_SUCCESS) return E_FAIL;
for (; cCategories; --cCategories, ++rgcatid) {
/* Check that every given category is implemented by class. */
if (*categories->impl_strings) {
- res = RegOpenKeyExW(key, impl_keyname, 0, KEY_READ, &subkey);
+ res = open_classes_key(key, impl_keyname, KEY_READ, &subkey);
if (res != ERROR_SUCCESS) return S_FALSE;
for (string = categories->impl_strings; *string; string += 39) {
HKEY catkey;
- res = RegOpenKeyExW(subkey, string, 0, 0, &catkey);
+ res = open_classes_key(subkey, string, 0, &catkey);
if (res != ERROR_SUCCESS) {
RegCloseKey(subkey);
return S_FALSE;
}
/* Check that all categories required by class are given. */
- res = RegOpenKeyExW(key, req_keyname, 0, KEY_READ, &subkey);
+ res = open_classes_key(key, req_keyname, KEY_READ, &subkey);
if (res == ERROR_SUCCESS) {
for (index = 0; ; ++index) {
WCHAR keyname[39];
return E_POINTER;
/* Create (or open) the component categories key. */
- res = RegCreateKeyExW(HKEY_CLASSES_ROOT, comcat_keyname, 0, NULL, 0,
- KEY_READ | KEY_WRITE, NULL, &comcat_key, NULL);
+ res = create_classes_key(HKEY_CLASSES_ROOT, comcat_keyname, KEY_READ|KEY_WRITE, &comcat_key);
if (res != ERROR_SUCCESS) return E_FAIL;
for (; cCategories; --cCategories, ++rgci) {
/* Create (or open) the key for this category. */
if (!StringFromGUID2(&rgci->catid, keyname, 39)) continue;
- res = RegCreateKeyExW(comcat_key, keyname, 0, NULL, 0,
- KEY_READ | KEY_WRITE, NULL, &cat_key, NULL);
+ res = create_classes_key(comcat_key, keyname, KEY_READ|KEY_WRITE, &cat_key);
if (res != ERROR_SUCCESS) continue;
/* Set the value for this locale's description. */
return E_POINTER;
/* Open the component categories key. */
- res = RegOpenKeyExW(HKEY_CLASSES_ROOT, comcat_keyname, 0,
- KEY_READ | KEY_WRITE, &comcat_key);
+ res = open_classes_key(HKEY_CLASSES_ROOT, comcat_keyname, KEY_READ|KEY_WRITE, &comcat_key);
if (res != ERROR_SUCCESS) return E_FAIL;
for (; cCategories; --cCategories, ++rgcatid) {
/* Open the key for this category. */
if (!StringFromGUID2(rcatid, keyname + 21, 39)) return E_FAIL;
- res = RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &key);
+ res = open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &key);
if (res != ERROR_SUCCESS) return CAT_E_CATIDNOEXIST;
/* Allocate a sensible amount of memory for the description. */
cRequired, rgcatidReq);
if (categories == NULL) return E_OUTOFMEMORY;
- res = RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &key);
+ res = open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &key);
if (res == ERROR_SUCCESS) {
res = COMCAT_IsClassOfCategories(key, categories);
RegCloseKey(key);
IsEqualGUID(riid, &IID_IClassFactory))
{
*ppvObj = iface;
- IUnknown_AddRef(iface);
+ IClassFactory_AddRef(iface);
return S_OK;
}
hr = CLSIDFromString(catid, &rgelt->catid);
if (FAILED(hr)) continue;
- res = RegOpenKeyExW(This->key, catid, 0, KEY_READ, &subkey);
+ res = open_classes_key(This->key, catid, KEY_READ, &subkey);
if (res != ERROR_SUCCESS) continue;
hr = COMCAT_GetCategoryDesc(subkey, This->lcid,
new_this->ref = 1;
new_this->lcid = This->lcid;
/* FIXME: could we more efficiently use DuplicateHandle? */
- RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &new_this->key);
+ open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &new_this->key);
new_this->next_index = This->next_index;
*ppenum = &new_this->IEnumCATEGORYINFO_iface;
This->IEnumCATEGORYINFO_iface.lpVtbl = &COMCAT_IEnumCATEGORYINFO_Vtbl;
This->lcid = lcid;
- RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &This->key);
+ open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &This->key);
}
return &This->IEnumCATEGORYINFO_iface;
}
hr = CLSIDFromString(clsid, rgelt);
if (FAILED(hr)) continue;
- res = RegOpenKeyExW(This->key, clsid, 0, KEY_READ, &subkey);
+ res = open_classes_key(This->key, clsid, KEY_READ, &subkey);
if (res != ERROR_SUCCESS) continue;
hr = COMCAT_IsClassOfCategories(subkey, This->categories);
}
memcpy(new_this->categories, This->categories, size);
/* FIXME: could we more efficiently use DuplicateHandle? */
- RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &new_this->key);
+ open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &new_this->key);
new_this->next_index = This->next_index;
*ppenum = (LPENUMGUID)new_this;
This->lpVtbl = &COMCAT_CLSID_IEnumGUID_Vtbl;
This->categories = categories;
- RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &This->key);
+ open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &This->key);
}
return (LPENUMGUID)This;
}
new_this->ref = 1;
lstrcpyW(new_this->keyname, This->keyname);
/* FIXME: could we more efficiently use DuplicateHandle? */
- RegOpenKeyExW(HKEY_CLASSES_ROOT, new_this->keyname, 0, KEY_READ, &new_this->key);
+ open_classes_key(HKEY_CLASSES_ROOT, new_this->keyname, KEY_READ, &new_this->key);
new_this->next_index = This->next_index;
*ppenum = (LPENUMGUID)new_this;
memcpy(This->keyname, prefix, sizeof(prefix));
StringFromGUID2(rclsid, This->keyname + 6, 39);
lstrcpyW(This->keyname + 44, postfix);
- RegOpenKeyExW(HKEY_CLASSES_ROOT, This->keyname, 0, KEY_READ, &This->key);
+ open_classes_key(HKEY_CLASSES_ROOT, This->keyname, KEY_READ, &This->key);
}
return (LPENUMGUID)This;
}
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
};
static CRITICAL_SECTION csRegisteredClassList = { &class_cs_debug, -1, 0, 0, 0, 0 };
+/* wrapper for NtCreateKey that creates the key recursively if necessary */
+static NTSTATUS create_key( HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr )
+{
+ NTSTATUS status = NtCreateKey( (HANDLE *)retkey, access, attr, 0, NULL, 0, NULL );
+
+ if (status == STATUS_OBJECT_NAME_NOT_FOUND)
+ {
+ HANDLE subkey, root = attr->RootDirectory;
+ WCHAR *buffer = attr->ObjectName->Buffer;
+ DWORD attrs, pos = 0, i = 0, len = attr->ObjectName->Length / sizeof(WCHAR);
+ UNICODE_STRING str;
+
+ while (i < len && buffer[i] != '\\') i++;
+ if (i == len) return status;
+
+ attrs = attr->Attributes;
+ attr->ObjectName = &str;
+
+ while (i < len)
+ {
+ str.Buffer = buffer + pos;
+ str.Length = (i - pos) * sizeof(WCHAR);
+ status = NtCreateKey( &subkey, access, attr, 0, NULL, 0, NULL );
+ if (attr->RootDirectory != root) NtClose( attr->RootDirectory );
+ if (status) return status;
+ attr->RootDirectory = subkey;
+ while (i < len && buffer[i] == '\\') i++;
+ pos = i;
+ while (i < len && buffer[i] != '\\') i++;
+ }
+ str.Buffer = buffer + pos;
+ str.Length = (i - pos) * sizeof(WCHAR);
+ attr->Attributes = attrs;
+ status = NtCreateKey( (PHANDLE)retkey, access, attr, 0, NULL, 0, NULL );
+ if (attr->RootDirectory != root) NtClose( attr->RootDirectory );
+ }
+ return status;
+}
+
+#ifdef __REACTOS__
+static const WCHAR classes_rootW[] = L"\\REGISTRY\\Machine\\Software\\Classes";
+#else
+static const WCHAR classes_rootW[] =
+ {'M','a','c','h','i','n','e','\\','S','o','f','t','w','a','r','e','\\','C','l','a','s','s','e','s',0};
+#endif
+
+static HKEY classes_root_hkey;
+
+/* create the special HKEY_CLASSES_ROOT key */
+static HKEY create_classes_root_hkey(void)
+{
+ HKEY hkey, ret = 0;
+ OBJECT_ATTRIBUTES attr;
+ UNICODE_STRING name;
+
+ attr.Length = sizeof(attr);
+ attr.RootDirectory = 0;
+ attr.ObjectName = &name;
+ attr.Attributes = 0;
+ attr.SecurityDescriptor = NULL;
+ attr.SecurityQualityOfService = NULL;
+ RtlInitUnicodeString( &name, classes_rootW );
+ if (create_key( &hkey, MAXIMUM_ALLOWED, &attr )) return 0;
+ TRACE( "%s -> %p\n", debugstr_w(attr.ObjectName->Buffer), hkey );
+
+ if (!(ret = InterlockedCompareExchangePointer( (void **)&classes_root_hkey, hkey, 0 )))
+ ret = hkey;
+ else
+ NtClose( hkey ); /* somebody beat us to it */
+ return ret;
+}
+
+/* map the hkey from special root to normal key if necessary */
+static inline HKEY get_classes_root_hkey( HKEY hkey )
+{
+ HKEY ret = hkey;
+
+ if (hkey == HKEY_CLASSES_ROOT && !(ret = classes_root_hkey))
+ ret = create_classes_root_hkey();
+
+ return ret;
+}
+
+LSTATUS create_classes_key( HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey )
+{
+ OBJECT_ATTRIBUTES attr;
+ UNICODE_STRING nameW;
+
+ if (!(hkey = get_classes_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
+
+ attr.Length = sizeof(attr);
+ attr.RootDirectory = hkey;
+ attr.ObjectName = &nameW;
+ attr.Attributes = 0;
+ attr.SecurityDescriptor = NULL;
+ attr.SecurityQualityOfService = NULL;
+ RtlInitUnicodeString( &nameW, name );
+
+ return RtlNtStatusToDosError( create_key( retkey, access, &attr ) );
+}
+
+LSTATUS open_classes_key( HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey )
+{
+ OBJECT_ATTRIBUTES attr;
+ UNICODE_STRING nameW;
+
+ if (!(hkey = get_classes_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
+
+ attr.Length = sizeof(attr);
+ attr.RootDirectory = hkey;
+ attr.ObjectName = &nameW;
+ attr.Attributes = 0;
+ attr.SecurityDescriptor = NULL;
+ attr.SecurityQualityOfService = NULL;
+ RtlInitUnicodeString( &nameW, name );
+
+ return RtlNtStatusToDosError( NtOpenKey( (HANDLE *)retkey, access, &attr ) );
+}
+
/*****************************************************************************
* This section contains OpenDllList definitions
*
*/
typedef struct ManualResetEvent {
- ISynchronize ISynchronize_iface;
+ ISynchronize ISynchronize_iface;
+ ISynchronizeHandle ISynchronizeHandle_iface;
LONG ref;
HANDLE event;
} MREImpl;
static HRESULT WINAPI ISynchronize_fnQueryInterface(ISynchronize *iface, REFIID riid, void **ppv)
{
MREImpl *This = impl_from_ISynchronize(iface);
+
TRACE("%p (%s, %p)\n", This, debugstr_guid(riid), ppv);
- *ppv = NULL;
- if(IsEqualGUID(riid, &IID_IUnknown) ||
- IsEqualGUID(riid, &IID_ISynchronize))
- *ppv = This;
- else
+ if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ISynchronize)) {
+ *ppv = &This->ISynchronize_iface;
+ }else if(IsEqualGUID(riid, &IID_ISynchronizeHandle)) {
+ *ppv = &This->ISynchronizeHandle_iface;
+ }else {
ERR("Unknown interface %s requested.\n", debugstr_guid(riid));
-
- if(*ppv)
- {
- IUnknown_AddRef((IUnknown*)*ppv);
- return S_OK;
+ *ppv = NULL;
+ return E_NOINTERFACE;
}
- return E_NOINTERFACE;
+ IUnknown_AddRef((IUnknown*)*ppv);
+ return S_OK;
}
static ULONG WINAPI ISynchronize_fnAddRef(ISynchronize *iface)
ISynchronize_fnReset
};
+static inline MREImpl *impl_from_ISynchronizeHandle(ISynchronizeHandle *iface)
+{
+ return CONTAINING_RECORD(iface, MREImpl, ISynchronizeHandle_iface);
+}
+
+static HRESULT WINAPI SynchronizeHandle_QueryInterface(ISynchronizeHandle *iface, REFIID riid, void **ppv)
+{
+ MREImpl *This = impl_from_ISynchronizeHandle(iface);
+ return ISynchronize_QueryInterface(&This->ISynchronize_iface, riid, ppv);
+}
+
+static ULONG WINAPI SynchronizeHandle_AddRef(ISynchronizeHandle *iface)
+{
+ MREImpl *This = impl_from_ISynchronizeHandle(iface);
+ return ISynchronize_AddRef(&This->ISynchronize_iface);
+}
+
+static ULONG WINAPI SynchronizeHandle_Release(ISynchronizeHandle *iface)
+{
+ MREImpl *This = impl_from_ISynchronizeHandle(iface);
+ return ISynchronize_Release(&This->ISynchronize_iface);
+}
+
+static HRESULT WINAPI SynchronizeHandle_GetHandle(ISynchronizeHandle *iface, HANDLE *ph)
+{
+ MREImpl *This = impl_from_ISynchronizeHandle(iface);
+
+ *ph = This->event;
+ return S_OK;
+}
+
+static const ISynchronizeHandleVtbl SynchronizeHandleVtbl = {
+ SynchronizeHandle_QueryInterface,
+ SynchronizeHandle_AddRef,
+ SynchronizeHandle_Release,
+ SynchronizeHandle_GetHandle
+};
+
static HRESULT ManualResetEvent_Construct(IUnknown *punkouter, REFIID iid, void **ppv)
{
MREImpl *This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MREImpl));
This->ref = 1;
This->ISynchronize_iface.lpVtbl = &vt_ISynchronize;
+ This->ISynchronizeHandle_iface.lpVtbl = &SynchronizeHandleVtbl;
This->event = CreateEventW(NULL, TRUE, FALSE, NULL);
hr = ISynchronize_QueryInterface(&This->ISynchronize_iface, iid, ppv);
* apartment, which it must do. */
assert(list_empty(&apt->stubmgrs));
- if (apt->filter) IUnknown_Release(apt->filter);
+ if (apt->filter) IMessageFilter_Release(apt->filter);
/* free as many unused libraries as possible... */
apartment_freeunusedlibraries(apt, 0);
*
* Reads a registry value and expands it when necessary
*/
-static DWORD COM_RegReadPath(HKEY hkeyroot, const WCHAR *keyname, const WCHAR *valuename, WCHAR * dst, DWORD dstlen)
+static DWORD COM_RegReadPath(HKEY hkeyroot, WCHAR * dst, DWORD dstlen)
{
DWORD ret;
- HKEY key;
DWORD keytype;
WCHAR src[MAX_PATH];
DWORD dwLength = dstlen * sizeof(WCHAR);
- if((ret = RegOpenKeyExW(hkeyroot, keyname, 0, KEY_READ, &key)) == ERROR_SUCCESS) {
- if( (ret = RegQueryValueExW(key, NULL, NULL, &keytype, (LPBYTE)src, &dwLength)) == ERROR_SUCCESS ) {
+ if( (ret = RegQueryValueExW(hkeyroot, NULL, NULL, &keytype, (LPBYTE)src, &dwLength)) == ERROR_SUCCESS ) {
if (keytype == REG_EXPAND_SZ) {
if (dstlen <= ExpandEnvironmentStringsW(src, dst, dstlen)) ret = ERROR_MORE_DATA;
} else {
}
lstrcpynW(dst, src, dstlen);
}
- }
- RegCloseKey (key);
- }
+ }
return ret;
}
TRACE("clsid %s, iid %s\n", debugstr_guid(¶ms->clsid), debugstr_guid(¶ms->iid));
- if (COM_RegReadPath(params->hkeydll, NULL, NULL, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS)
+ if (COM_RegReadPath(params->hkeydll, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS)
{
/* failure: CLSID is not found in registry */
WARN("class %s not registered inproc\n", debugstr_guid(¶ms->clsid));
if (info->apt) apartment_release(info->apt);
if (info->errorinfo) IErrorInfo_Release(info->errorinfo);
if (info->state) IUnknown_Release(info->state);
- if (info->spy) IUnknown_Release(info->spy);
+ if (info->spy) IInitializeSpy_Release(info->spy);
if (info->context_token) IObjContext_Release(info->context_token);
HeapFree(GetProcessHeap(), 0, info);
NtCurrentTeb()->ReservedForOle = NULL;
return E_UNEXPECTED;
}
- hr = IUnknown_QueryInterface(spy, &IID_IInitializeSpy, (void **) &info->spy);
+ hr = IInitializeSpy_QueryInterface(spy, &IID_IInitializeSpy, (void **) &info->spy);
if (SUCCEEDED(hr))
{
cookie->QuadPart = (DWORD_PTR)spy;
if (!info || !info->spy || cookie.QuadPart != (DWORD_PTR)info->spy)
return E_INVALIDARG;
- IUnknown_Release(info->spy);
+ IInitializeSpy_Release(info->spy);
info->spy = NULL;
return S_OK;
}
TRACE("(%p, 0x%08x)\n", lpUnk, reserved);
+ if (!lpUnk) return E_INVALIDARG;
+
hr = IUnknown_QueryInterface(lpUnk, &IID_IMarshal, (void **)&marshal);
if (hr == S_OK)
{
strcpyW(path, wszCLSIDSlash);
StringFromGUID2(clsid, path + strlenW(wszCLSIDSlash), CHARS_IN_GUID);
- res = RegOpenKeyExW(HKEY_CLASSES_ROOT, path, 0, keyname ? KEY_READ : access, &key);
+ res = open_classes_key(HKEY_CLASSES_ROOT, path, keyname ? KEY_READ : access, &key);
if (res == ERROR_FILE_NOT_FOUND)
return REGDB_E_CLASSNOTREG;
else if (res != ERROR_SUCCESS)
return S_OK;
}
- res = RegOpenKeyExW(key, keyname, 0, access, subkey);
+ res = open_classes_key(key, keyname, access, subkey);
RegCloseKey(key);
if (res == ERROR_FILE_NOT_FOUND)
return REGDB_E_KEYMISSING;
strcpyW(keyname, szAppIdKey);
strcatW(keyname, buf);
- res = RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, access, subkey);
+ res = open_classes_key(HKEY_CLASSES_ROOT, keyname, access, subkey);
if (res == ERROR_FILE_NOT_FOUND)
return REGDB_E_KEYMISSING;
else if (res != ERROR_SUCCESS)
buf = HeapAlloc( GetProcessHeap(),0,(strlenW(progid)+8) * sizeof(WCHAR) );
strcpyW( buf, progid );
strcatW( buf, clsidW );
- if (RegOpenKeyW(HKEY_CLASSES_ROOT,buf,&xhkey))
+ if (open_classes_key(HKEY_CLASSES_ROOT, buf, MAXIMUM_ALLOWED, &xhkey))
{
HeapFree(GetProcessHeap(),0,buf);
WARN("couldn't open key for ProgID %s\n", debugstr_w(progid));
strcpyW(path + ARRAYSIZE(wszInterface) - 1 + CHARS_IN_GUID - 1, wszPSC);
/* Open the key.. */
- if (RegOpenKeyExW(HKEY_CLASSES_ROOT, path, 0, KEY_READ, &hkey))
+ if (open_classes_key(HKEY_CLASSES_ROOT, path, KEY_READ, &hkey))
{
WARN("No PSFactoryBuffer object is registered for IID %s\n", debugstr_guid(riid));
return REGDB_E_IIDNOTREG;
else
apartment_threaded = !apt->multi_threaded;
- if (COM_RegReadPath(hkeydll, NULL, NULL, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS)
+ if (COM_RegReadPath(hkeydll, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS)
{
/* failure: CLSID is not found in registry */
WARN("class %s not registered inproc\n", debugstr_guid(rclsid));
{
TRACE("waiting for rpc completion\n");
- res = WaitForMultipleObjectsEx(cHandles, pHandles,
- (dwFlags & COWAIT_WAITALL) ? TRUE : FALSE,
+ res = WaitForMultipleObjectsEx(cHandles, pHandles, (dwFlags & COWAIT_WAITALL) != 0,
(dwTimeout == INFINITE) ? INFINITE : start_time + dwTimeout - now,
- (dwFlags & COWAIT_ALERTABLE) ? TRUE : FALSE);
+ (dwFlags & COWAIT_ALERTABLE) != 0);
}
switch (res)
return S_OK;
}
+/***********************************************************************
+ * CoGetDefaultContext [OLE32.@]
+ */
+HRESULT WINAPI CoGetDefaultContext(APTTYPE type, REFIID riid, LPVOID *ppv)
+{
+ FIXME("%d %s %p stub\n", type, debugstr_guid(riid), ppv);
+ return E_NOINTERFACE;
+}
+
HRESULT Handler_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
static const WCHAR wszInprocHandler32[] = {'I','n','p','r','o','c','H','a','n','d','l','e','r','3','2',0};
{
WCHAR dllpath[MAX_PATH+1];
- if (COM_RegReadPath(hkey, NULL, NULL, dllpath, ARRAYSIZE(dllpath)) == ERROR_SUCCESS)
+ if (COM_RegReadPath(hkey, dllpath, ARRAYSIZE(dllpath)) == ERROR_SUCCESS)
{
static const WCHAR wszOle32[] = {'o','l','e','3','2','.','d','l','l',0};
if (!strcmpiW(dllpath, wszOle32))
struct stub_manager *new_stub_manager(APARTMENT *apt, IUnknown *object) DECLSPEC_HIDDEN;
ULONG stub_manager_ext_addref(struct stub_manager *m, ULONG refs, BOOL tableweak) DECLSPEC_HIDDEN;
ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL tableweak, BOOL last_unlock_releases) DECLSPEC_HIDDEN;
-struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, IUnknown *iptr, REFIID iid, MSHLFLAGS flags) DECLSPEC_HIDDEN;
+struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, IUnknown *iptr, REFIID iid,
+ DWORD dest_context, void *dest_context_data, MSHLFLAGS flags) DECLSPEC_HIDDEN;
struct ifstub *stub_manager_find_ifstub(struct stub_manager *m, REFIID iid, MSHLFLAGS flags) DECLSPEC_HIDDEN;
struct stub_manager *get_stub_manager(APARTMENT *apt, OID oid) DECLSPEC_HIDDEN;
struct stub_manager *get_stub_manager_from_object(APARTMENT *apt, void *object) DECLSPEC_HIDDEN;
HRESULT ipid_get_dispatch_params(const IPID *ipid, APARTMENT **stub_apt, IRpcStubBuffer **stub, IRpcChannelBuffer **chan, IID *iid, IUnknown **iface) DECLSPEC_HIDDEN;
HRESULT start_apartment_remote_unknown(void) DECLSPEC_HIDDEN;
-HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *obj, MSHLFLAGS mshlflags) DECLSPEC_HIDDEN;
+HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *obj, DWORD dest_context, void *dest_context_data, MSHLFLAGS mshlflags) DECLSPEC_HIDDEN;
/* RPC Backend */
const OXID_INFO *oxid_info,
DWORD dest_context, void *dest_context_data,
IRpcChannelBuffer **chan) DECLSPEC_HIDDEN;
-HRESULT RPC_CreateServerChannel(IRpcChannelBuffer **chan) DECLSPEC_HIDDEN;
+HRESULT RPC_CreateServerChannel(DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan) DECLSPEC_HIDDEN;
void RPC_ExecuteCall(struct dispatch_params *params) DECLSPEC_HIDDEN;
HRESULT RPC_RegisterInterface(REFIID riid) DECLSPEC_HIDDEN;
void RPC_UnregisterInterface(REFIID riid) DECLSPEC_HIDDEN;
extern UINT link_source_descriptor_clipboard_format DECLSPEC_HIDDEN;
extern UINT ole_private_data_clipboard_format DECLSPEC_HIDDEN;
+extern LSTATUS create_classes_key(HKEY, const WCHAR *, REGSAM, HKEY *) DECLSPEC_HIDDEN;
+extern LSTATUS open_classes_key(HKEY, const WCHAR *, REGSAM, HKEY *) DECLSPEC_HIDDEN;
+
#endif /* __WINE_OLE_COMPOBJ_H */
return E_NOTIMPL;
}
-static HRESULT WINAPI CompositeMonikerCF_QueryInterface(LPCLASSFACTORY iface,
- REFIID riid, LPVOID *ppv)
+static HRESULT WINAPI CompositeMonikerCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
{
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
{
*ppv = iface;
- IUnknown_AddRef(iface);
+ IClassFactory_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
{
DataCache *This = impl_from_IAdviseSink(iface);
TRACE("(%p)->(%s, %p)\n", This, debugstr_formatetc(fmt), med);
- IOleCache_SetData(&This->IOleCache2_iface, fmt, med, FALSE);
+ IOleCache2_SetData(&This->IOleCache2_iface, fmt, med, FALSE);
}
static void WINAPI DataCache_OnViewChange(IAdviseSink *iface, DWORD aspect, LONG index)
import "unknwn.idl";
-#ifdef __WIDL__
[
threading(both),
uuid(00000320-0000-0000-c000-000000000046)
]
coclass PSFactoryBuffer { interface IFactoryBuffer; }
-#endif
[
uuid(99fcfe60-5260-101b-bbcb-00aa0021347a),
#include "ole2.h"
#include "compobj_private.h"
+#include "storage32.h"
#include "wine/unicode.h"
#include "wine/debug.h"
}
else if (This->inproc_server && This->pOleDelegate)
{
- return IUnknown_QueryInterface(This->pOleDelegate, riid, ppvObject);
+ return IOleObject_QueryInterface(This->pOleDelegate, riid, ppvObject);
}
/* Check that we obtained an interface. */
release_delegates(This);
- hr = CoCreateInstance(&This->clsid, NULL, CLSCTX_LOCAL_SERVER,
+ hr = CoCreateInstance(&This->clsid, NULL, CLSCTX_ALL,
&IID_IOleObject, (void **)&This->pOleDelegate);
if (FAILED(hr))
return hr;
}
/***********************************************************************
- * init_ole_stream
*
- * Creates the '\1Ole' stream.
- * The format of this stream is as follows:
+ * The format of '\1Ole' stream is as follows:
*
* DWORD Version == 0x02000001
* DWORD Flags - low bit set indicates the object is a link otherwise it's embedded.
} ole_stream_header_t;
static const DWORD ole_stream_version = 0x02000001;
-static void init_ole_stream(IStorage *storage)
-{
- HRESULT hr;
- IStream *stream;
-
- hr = IStorage_CreateStream(storage, OleStream, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stream);
- if(SUCCEEDED(hr))
- {
- DWORD written;
- ole_stream_header_t header;
-
- header.version = ole_stream_version;
- header.flags = 0;
- header.link_update_opt = 0;
- header.res = 0;
- header.moniker_size = 0;
-
- IStream_Write(stream, &header, sizeof(header), &written);
- IStream_Release(stream);
- }
- return;
-}
-
static HRESULT load_ole_stream(DefaultHandler *This, IStorage *storage)
{
IStream *stream;
IStream_Release(stream);
}
else
- {
- init_ole_stream(storage);
- hr = S_OK;
- }
+ hr = STORAGE_CreateOleStream(storage, 0);
+
return hr;
}
HRESULT hr;
TRACE("(%p)->(%p)\n", iface, pStg);
- init_ole_stream(pStg);
+ hr = STORAGE_CreateOleStream(pStg, 0);
+ if (hr != S_OK) return hr;
hr = IPersistStorage_InitNew(This->dataCache_PersistStg, pStg);
This->IAdviseSink_iface.lpVtbl = &DefaultHandler_IAdviseSink_VTable;
This->IPersistStorage_iface.lpVtbl = &DefaultHandler_IPersistStorage_VTable;
- This->inproc_server = (flags & EMBDHLP_INPROC_SERVER) ? TRUE : FALSE;
+ This->inproc_server = (flags & EMBDHLP_INPROC_SERVER) != 0;
/*
* Start with one reference count. The caller of this function
WINE_DEFAULT_DEBUG_CHANNEL(ole);
-/* this code is from SysAllocStringLen (ole2disp.c in oleaut32) */
-static BSTR ERRORINFO_SysAllocString(const OLECHAR* in)
-{
- DWORD bufferSize;
- DWORD* newBuffer;
- WCHAR* stringBuffer;
- DWORD len;
-
- if (in == NULL)
- return NULL;
- /*
- * Find the length of the buffer passed-in, in bytes.
- */
- len = strlenW(in);
- bufferSize = len * sizeof (WCHAR);
-
- /*
- * Allocate a new buffer to hold the string.
- * don't forget to keep an empty spot at the beginning of the
- * buffer for the character count and an extra character at the
- * end for the '\0'.
- */
- newBuffer = HeapAlloc(GetProcessHeap(), 0,
- bufferSize + sizeof(WCHAR) + sizeof(DWORD));
-
- /*
- * If the memory allocation failed, return a null pointer.
- */
- if (newBuffer==0)
- return 0;
-
- /*
- * Copy the length of the string in the placeholder.
- */
- *newBuffer = bufferSize;
-
- /*
- * Skip the byte count.
- */
- newBuffer++;
-
- /*
- * Copy the information in the buffer. It is not possible to pass
- * a NULL pointer here.
- */
- memcpy(newBuffer, in, bufferSize);
-
- /*
- * Make sure that there is a nul character at the end of the
- * string.
- */
- stringBuffer = (WCHAR*)newBuffer;
- stringBuffer[len] = 0;
-
- return stringBuffer;
+static inline void *heap_alloc(size_t len)
+{
+ return HeapAlloc(GetProcessHeap(), 0, len);
}
-/* this code is from SysFreeString (ole2disp.c in oleaut32)*/
-static VOID ERRORINFO_SysFreeString(BSTR in)
+static inline BOOL heap_free(void *mem)
{
- DWORD* bufferPointer;
+ return HeapFree(GetProcessHeap(), 0, mem);
+}
- /* NULL is a valid parameter */
- if(!in) return;
+static inline WCHAR *heap_strdupW(const WCHAR *str)
+{
+ WCHAR *ret = NULL;
- /*
- * We have to be careful when we free a BSTR pointer, it points to
- * the beginning of the string but it skips the byte count contained
- * before the string.
- */
- bufferPointer = (DWORD*)in;
+ if(str) {
+ size_t size;
- bufferPointer--;
+ size = (strlenW(str)+1)*sizeof(WCHAR);
+ ret = heap_alloc(size);
+ if(ret)
+ memcpy(ret, str, size);
+ }
- /*
- * Free the memory from it's "real" origin.
- */
- HeapFree(GetProcessHeap(), 0, bufferPointer);
+ return ret;
}
-
typedef struct ErrorInfoImpl
{
- const IErrorInfoVtbl *lpvtei;
- const ICreateErrorInfoVtbl *lpvtcei;
- const ISupportErrorInfoVtbl *lpvtsei;
- LONG ref;
+ IErrorInfo IErrorInfo_iface;
+ ICreateErrorInfo ICreateErrorInfo_iface;
+ ISupportErrorInfo ISupportErrorInfo_iface;
+ LONG ref;
- GUID m_Guid;
- BSTR bstrSource;
- BSTR bstrDescription;
- BSTR bstrHelpFile;
- DWORD m_dwHelpContext;
+ GUID m_Guid;
+ WCHAR *source;
+ WCHAR *description;
+ WCHAR *help_file;
+ DWORD m_dwHelpContext;
} ErrorInfoImpl;
-static const IErrorInfoVtbl IErrorInfoImpl_VTable;
-static const ICreateErrorInfoVtbl ICreateErrorInfoImpl_VTable;
-static const ISupportErrorInfoVtbl ISupportErrorInfoImpl_VTable;
-
-/*
- converts an object pointer to This
- */
-
static inline ErrorInfoImpl *impl_from_IErrorInfo( IErrorInfo *iface )
{
- return (ErrorInfoImpl *)((char*)iface - FIELD_OFFSET(ErrorInfoImpl, lpvtei));
+ return CONTAINING_RECORD(iface, ErrorInfoImpl, IErrorInfo_iface);
}
static inline ErrorInfoImpl *impl_from_ICreateErrorInfo( ICreateErrorInfo *iface )
{
- return (ErrorInfoImpl *)((char*)iface - FIELD_OFFSET(ErrorInfoImpl, lpvtcei));
+ return CONTAINING_RECORD(iface, ErrorInfoImpl, ICreateErrorInfo_iface);
}
static inline ErrorInfoImpl *impl_from_ISupportErrorInfo( ISupportErrorInfo *iface )
{
- return (ErrorInfoImpl *)((char*)iface - FIELD_OFFSET(ErrorInfoImpl, lpvtsei));
+ return CONTAINING_RECORD(iface, ErrorInfoImpl, ISupportErrorInfo_iface);
}
-
-/*
- converts This to an object pointer
- */
-#define _IErrorInfo_(This) ((IErrorInfo*)&(This)->lpvtei)
-#define _ICreateErrorInfo_(This) (&(This)->lpvtcei)
-#define _ISupportErrorInfo_(This) (&(This)->lpvtsei)
-
-static IErrorInfo * IErrorInfoImpl_Constructor(void)
-{
- ErrorInfoImpl * ei = HeapAlloc(GetProcessHeap(), 0, sizeof(ErrorInfoImpl));
- if (ei)
- {
- ei->lpvtei = &IErrorInfoImpl_VTable;
- ei->lpvtcei = &ICreateErrorInfoImpl_VTable;
- ei->lpvtsei = &ISupportErrorInfoImpl_VTable;
- ei->ref = 1;
- ei->bstrSource = NULL;
- ei->bstrDescription = NULL;
- ei->bstrHelpFile = NULL;
- ei->m_dwHelpContext = 0;
- }
- return (IErrorInfo *)ei;
-}
-
-
static HRESULT WINAPI IErrorInfoImpl_QueryInterface(
IErrorInfo* iface,
REFIID riid,
- VOID** ppvoid)
+ void** ppvoid)
{
ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
- TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvoid);
+ TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid),ppvoid);
*ppvoid = NULL;
- if(IsEqualIID(riid, &IID_IErrorInfo))
+ if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IErrorInfo))
{
- *ppvoid = _IErrorInfo_(This);
+ *ppvoid = &This->IErrorInfo_iface;
}
else if(IsEqualIID(riid, &IID_ICreateErrorInfo))
{
- *ppvoid = _ICreateErrorInfo_(This);
+ *ppvoid = &This->ICreateErrorInfo_iface;
}
else if(IsEqualIID(riid, &IID_ISupportErrorInfo))
{
- *ppvoid = _ISupportErrorInfo_(This);
+ *ppvoid = &This->ISupportErrorInfo_iface;
}
if(*ppvoid)
{
TRACE("-- destroying IErrorInfo(%p)\n",This);
- ERRORINFO_SysFreeString(This->bstrSource);
- ERRORINFO_SysFreeString(This->bstrDescription);
- ERRORINFO_SysFreeString(This->bstrHelpFile);
- HeapFree(GetProcessHeap(),0,This);
- return 0;
+ heap_free(This->source);
+ heap_free(This->description);
+ heap_free(This->help_file);
+ heap_free(This);
}
return ref;
}
TRACE("(%p)->(pBstrSource=%p)\n",This,pBstrSource);
if (pBstrSource == NULL)
return E_INVALIDARG;
- *pBstrSource = ERRORINFO_SysAllocString(This->bstrSource);
+ *pBstrSource = SysAllocString(This->source);
return S_OK;
}
TRACE("(%p)->(pBstrDescription=%p)\n",This,pBstrDescription);
if (pBstrDescription == NULL)
return E_INVALIDARG;
- *pBstrDescription = ERRORINFO_SysAllocString(This->bstrDescription);
+ *pBstrDescription = SysAllocString(This->description);
return S_OK;
}
TRACE("(%p)->(pBstrHelpFile=%p)\n",This, pBstrHelpFile);
if (pBstrHelpFile == NULL)
return E_INVALIDARG;
- *pBstrHelpFile = ERRORINFO_SysAllocString(This->bstrHelpFile);
+ *pBstrHelpFile = SysAllocString(This->help_file);
return S_OK;
}
return S_OK;
}
-static const IErrorInfoVtbl IErrorInfoImpl_VTable =
+static const IErrorInfoVtbl ErrorInfoVtbl =
{
IErrorInfoImpl_QueryInterface,
IErrorInfoImpl_AddRef,
IErrorInfoImpl_Release,
-
IErrorInfoImpl_GetGUID,
IErrorInfoImpl_GetSource,
IErrorInfoImpl_GetDescription,
REFIID riid,
VOID** ppvoid)
{
- ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
- TRACE("(%p)\n", This);
- return IErrorInfo_QueryInterface(_IErrorInfo_(This), riid, ppvoid);
+ ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
+ return IErrorInfo_QueryInterface(&This->IErrorInfo_iface, riid, ppvoid);
}
static ULONG WINAPI ICreateErrorInfoImpl_AddRef(
ICreateErrorInfo* iface)
{
- ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
- TRACE("(%p)\n", This);
- return IErrorInfo_AddRef(_IErrorInfo_(This));
+ ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
+ return IErrorInfo_AddRef(&This->IErrorInfo_iface);
}
static ULONG WINAPI ICreateErrorInfoImpl_Release(
ICreateErrorInfo* iface)
{
- ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
- TRACE("(%p)\n", This);
- return IErrorInfo_Release(_IErrorInfo_(This));
+ ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
+ return IErrorInfo_Release(&This->IErrorInfo_iface);
}
{
ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
TRACE("(%p): %s\n",This, debugstr_w(szSource));
- if (This->bstrSource != NULL)
- ERRORINFO_SysFreeString(This->bstrSource);
- This->bstrSource = ERRORINFO_SysAllocString(szSource);
+
+ heap_free(This->source);
+ This->source = heap_strdupW(szSource);
return S_OK;
}
{
ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
TRACE("(%p): %s\n",This, debugstr_w(szDescription));
- if (This->bstrDescription != NULL)
- ERRORINFO_SysFreeString(This->bstrDescription);
- This->bstrDescription = ERRORINFO_SysAllocString(szDescription);
+ heap_free(This->description);
+ This->description = heap_strdupW(szDescription);
return S_OK;
}
{
ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
TRACE("(%p,%s)\n",This,debugstr_w(szHelpFile));
- if (This->bstrHelpFile != NULL)
- ERRORINFO_SysFreeString(This->bstrHelpFile);
- This->bstrHelpFile = ERRORINFO_SysAllocString(szHelpFile);
+ heap_free(This->help_file);
+ This->help_file = heap_strdupW(szHelpFile);
return S_OK;
}
return S_OK;
}
-static const ICreateErrorInfoVtbl ICreateErrorInfoImpl_VTable =
+static const ICreateErrorInfoVtbl CreateErrorInfoVtbl =
{
ICreateErrorInfoImpl_QueryInterface,
ICreateErrorInfoImpl_AddRef,
ICreateErrorInfoImpl_Release,
-
ICreateErrorInfoImpl_SetGUID,
ICreateErrorInfoImpl_SetSource,
ICreateErrorInfoImpl_SetDescription,
REFIID riid,
VOID** ppvoid)
{
- ErrorInfoImpl *This = impl_from_ISupportErrorInfo(iface);
- TRACE("(%p)\n", This);
-
- return IErrorInfo_QueryInterface(_IErrorInfo_(This), riid, ppvoid);
+ ErrorInfoImpl *This = impl_from_ISupportErrorInfo(iface);
+ return IErrorInfo_QueryInterface(&This->IErrorInfo_iface, riid, ppvoid);
}
-static ULONG WINAPI ISupportErrorInfoImpl_AddRef(
- ISupportErrorInfo* iface)
+static ULONG WINAPI ISupportErrorInfoImpl_AddRef(ISupportErrorInfo* iface)
{
- ErrorInfoImpl *This = impl_from_ISupportErrorInfo(iface);
- TRACE("(%p)\n", This);
- return IErrorInfo_AddRef(_IErrorInfo_(This));
+ ErrorInfoImpl *This = impl_from_ISupportErrorInfo(iface);
+ return IErrorInfo_AddRef(&This->IErrorInfo_iface);
}
-static ULONG WINAPI ISupportErrorInfoImpl_Release(
- ISupportErrorInfo* iface)
+static ULONG WINAPI ISupportErrorInfoImpl_Release(ISupportErrorInfo* iface)
{
- ErrorInfoImpl *This = impl_from_ISupportErrorInfo(iface);
- TRACE("(%p)\n", This);
- return IErrorInfo_Release(_IErrorInfo_(This));
+ ErrorInfoImpl *This = impl_from_ISupportErrorInfo(iface);
+ return IErrorInfo_Release(&This->IErrorInfo_iface);
}
-
static HRESULT WINAPI ISupportErrorInfoImpl_InterfaceSupportsErrorInfo(
ISupportErrorInfo* iface,
REFIID riid)
return (IsEqualIID(riid, &This->m_Guid)) ? S_OK : S_FALSE;
}
-static const ISupportErrorInfoVtbl ISupportErrorInfoImpl_VTable =
+static const ISupportErrorInfoVtbl SupportErrorInfoVtbl =
{
ISupportErrorInfoImpl_QueryInterface,
ISupportErrorInfoImpl_AddRef,
ISupportErrorInfoImpl_Release,
-
-
ISupportErrorInfoImpl_InterfaceSupportsErrorInfo
};
+static IErrorInfo* IErrorInfoImpl_Constructor(void)
+{
+ ErrorInfoImpl *This = heap_alloc(sizeof(ErrorInfoImpl));
+
+ if (!This) return NULL;
+
+ This->IErrorInfo_iface.lpVtbl = &ErrorInfoVtbl;
+ This->ICreateErrorInfo_iface.lpVtbl = &CreateErrorInfoVtbl;
+ This->ISupportErrorInfo_iface.lpVtbl = &SupportErrorInfoVtbl;
+ This->ref = 1;
+ This->source = NULL;
+ This->description = NULL;
+ This->help_file = NULL;
+ This->m_dwHelpContext = 0;
+
+ return &This->IErrorInfo_iface;
+}
+
/***********************************************************************
* CreateErrorInfo (OLE32.@)
*
static HRESULT WINAPI FileLockBytesImpl_QueryInterface(ILockBytes *iface, REFIID riid,
void **ppvObject)
{
- if (IsEqualIID(riid, &IID_ILockBytes) || IsEqualIID(riid, &IID_ILockBytes))
+ if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ILockBytes))
*ppvObject = iface;
else
{
return MK_S_REDUCED_TO_SELF;
}
+static void free_stringtable(LPOLESTR *stringTable)
+{
+ int i;
+
+ for (i=0; stringTable[i]!=NULL; i++)
+ CoTaskMemFree(stringTable[i]);
+ CoTaskMemFree(stringTable);
+}
+
/******************************************************************************
* FileMoniker_ComposeWith
*/
/* the length of the composed path string is raised by the sum of the two paths lengths */
newStr=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(lstrlenW(str1)+lstrlenW(str2)+1));
- if (newStr==NULL)
- return E_OUTOFMEMORY;
-
- /* new path is the concatenation of the rest of str1 and str2 */
- for(*newStr=0,j=0;j<=lastIdx1;j++)
- strcatW(newStr,strDec1[j]);
+ if (newStr)
+ {
+ /* new path is the concatenation of the rest of str1 and str2 */
+ for(*newStr=0,j=0;j<=lastIdx1;j++)
+ strcatW(newStr,strDec1[j]);
- if ((strDec2[i]==NULL && lastIdx1>-1 && lastIdx2>-1) || lstrcmpW(strDec2[i],bkSlash)!=0)
- strcatW(newStr,bkSlash);
+ if ((strDec2[i]==NULL && lastIdx1>-1 && lastIdx2>-1) || lstrcmpW(strDec2[i],bkSlash)!=0)
+ strcatW(newStr,bkSlash);
- for(j=i;j<=lastIdx2;j++)
- strcatW(newStr,strDec2[j]);
+ for(j=i;j<=lastIdx2;j++)
+ strcatW(newStr,strDec2[j]);
- /* create a new moniker with the new string */
- res=CreateFileMoniker(newStr,ppmkComposite);
+ /* create a new moniker with the new string */
+ res=CreateFileMoniker(newStr,ppmkComposite);
- /* free all strings space memory used by this function */
- HeapFree(GetProcessHeap(),0,newStr);
+ /* free all strings space memory used by this function */
+ HeapFree(GetProcessHeap(),0,newStr);
+ }
+ else res = E_OUTOFMEMORY;
- for(i=0; strDec1[i]!=NULL;i++)
- CoTaskMemFree(strDec1[i]);
- for(i=0; strDec2[i]!=NULL;i++)
- CoTaskMemFree(strDec2[i]);
- CoTaskMemFree(strDec1);
- CoTaskMemFree(strDec2);
+ free_stringtable(strDec1);
+ free_stringtable(strDec2);
CoTaskMemFree(str1);
CoTaskMemFree(str2);
return nb1;
nb2=FileMonikerImpl_DecomposePath(pathOther,&stringTable2);
if (FAILED(nb2))
+ {
+ free_stringtable(stringTable1);
return nb2;
+ }
if (nb1==0 || nb2==0)
+ {
+ free_stringtable(stringTable1);
+ free_stringtable(stringTable2);
return MK_E_NOPREFIX;
+ }
commonPath=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(min(lstrlenW(pathThis),lstrlenW(pathOther))+1));
if (!commonPath)
{
for(i=0;i<sameIdx;i++)
strcatW(commonPath,stringTable1[i]);
-
- for(i=0;i<nb1;i++)
- CoTaskMemFree(stringTable1[i]);
-
- CoTaskMemFree(stringTable1);
-
- for(i=0;i<nb2;i++)
- CoTaskMemFree(stringTable2[i]);
-
- CoTaskMemFree(stringTable2);
-
+
+ free_stringtable(stringTable1);
+ free_stringtable(stringTable2);
ret = CreateFileMoniker(commonPath,ppmkPrefix);
}
HeapFree(GetProcessHeap(),0,commonPath);
return res;
len1=FileMonikerImpl_DecomposePath(str1,&tabStr1);
+ if (FAILED(len1))
+ return E_OUTOFMEMORY;
len2=FileMonikerImpl_DecomposePath(str2,&tabStr2);
- if (FAILED(len1) || FAILED(len2))
- return E_OUTOFMEMORY;
+ if (FAILED(len2))
+ {
+ free_stringtable(tabStr1);
+ return E_OUTOFMEMORY;
+ }
/* count the number of similar items from the begin of the two paths */
for(sameIdx=0; ( (tabStr1[sameIdx]!=NULL) &&
res=CreateFileMoniker(relPath,ppmkRelPath);
- for(j=0; tabStr1[j]!=NULL;j++)
- CoTaskMemFree(tabStr1[j]);
- for(j=0; tabStr2[j]!=NULL;j++)
- CoTaskMemFree(tabStr2[j]);
- CoTaskMemFree(tabStr1);
- CoTaskMemFree(tabStr2);
+ free_stringtable(tabStr1);
+ free_stringtable(tabStr2);
CoTaskMemFree(str1);
CoTaskMemFree(str2);
HeapFree(GetProcessHeap(),0,relPath);
strcatW(This->filePathName,bkSlash);
}
- for(i=0; tabStr[i]!=NULL;i++)
- CoTaskMemFree(tabStr[i]);
- CoTaskMemFree(tabStr);
+ free_stringtable(tabStr);
return S_OK;
}
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
{
*ppv = iface;
- IUnknown_AddRef(iface);
+ IClassFactory_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
{
*ppv = iface;
- IUnknown_AddRef(iface);
+ IClassFactory_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
EnterCriticalSection(&IMalloc32_SpyCS);
- if (SUCCEEDED(IUnknown_QueryInterface(pMallocSpy, &IID_IMallocSpy, (LPVOID*)&pSpy))) {
+ if (SUCCEEDED(IMallocSpy_QueryInterface(pMallocSpy, &IID_IMallocSpy, (void**)&pSpy))) {
Malloc32.pSpy = pSpy;
hres = S_OK;
}
(void**)ppmk);
}
-static HRESULT WINAPI ItemMonikerCF_QueryInterface(LPCLASSFACTORY iface,
- REFIID riid, LPVOID *ppv)
+static HRESULT WINAPI ItemMonikerCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
{
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
{
*ppv = iface;
- IUnknown_AddRef(iface);
+ IClassFactory_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
/* imported object / proxy manager */
struct proxy_manager
{
- const IMultiQIVtbl *lpVtbl;
- const IMarshalVtbl *lpVtblMarshal;
- const IClientSecurityVtbl *lpVtblCliSec;
+ IMultiQI IMultiQI_iface;
+ IMarshal IMarshal_iface;
+ IClientSecurity IClientSecurity_iface;
struct apartment *parent; /* owning apartment (RO) */
struct list entry; /* entry in apartment (CS parent->cs) */
OXID oxid; /* object exported ID (RO) */
static inline struct proxy_manager *impl_from_IMarshal( IMarshal *iface )
{
- return (struct proxy_manager *)((char*)iface - FIELD_OFFSET(struct proxy_manager, lpVtblMarshal));
+ return CONTAINING_RECORD(iface, struct proxy_manager, IMarshal_iface);
}
static inline struct proxy_manager *impl_from_IClientSecurity( IClientSecurity *iface )
{
- return (struct proxy_manager *)((char*)iface - FIELD_OFFSET(struct proxy_manager, lpVtblCliSec));
+ return CONTAINING_RECORD(iface, struct proxy_manager, IClientSecurity_iface);
}
static HRESULT unmarshal_object(const STDOBJREF *stdobjref, APARTMENT *apt,
}
/* marshals an object into a STDOBJREF structure */
-HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *object, MSHLFLAGS mshlflags)
+HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *object,
+ DWORD dest_context, void *dest_context_data, MSHLFLAGS mshlflags)
{
struct stub_manager *manager;
struct ifstub *ifstub;
/* make sure ifstub that we are creating is unique */
ifstub = stub_manager_find_ifstub(manager, riid, mshlflags);
if (!ifstub)
- ifstub = stub_manager_new_ifstub(manager, stub, iobject, riid, mshlflags);
+ ifstub = stub_manager_new_ifstub(manager, stub, iobject, riid, dest_context, dest_context_data, mshlflags);
if (stub) IRpcStubBuffer_Release(stub);
IUnknown_Release(iobject);
static HRESULT WINAPI Proxy_QueryInterface(IMarshal *iface, REFIID riid, void **ppvObject)
{
struct proxy_manager *This = impl_from_IMarshal( iface );
- return IMultiQI_QueryInterface((IMultiQI *)&This->lpVtbl, riid, ppvObject);
+ return IMultiQI_QueryInterface(&This->IMultiQI_iface, riid, ppvObject);
}
static ULONG WINAPI Proxy_AddRef(IMarshal *iface)
{
struct proxy_manager *This = impl_from_IMarshal( iface );
- return IMultiQI_AddRef((IMultiQI *)&This->lpVtbl);
+ return IMultiQI_AddRef(&This->IMultiQI_iface);
}
static ULONG WINAPI Proxy_Release(IMarshal *iface)
{
struct proxy_manager *This = impl_from_IMarshal( iface );
- return IMultiQI_Release((IMultiQI *)&This->lpVtbl);
+ return IMultiQI_Release(&This->IMultiQI_iface);
}
static HRESULT WINAPI Proxy_MarshalInterface(
static HRESULT WINAPI ProxyCliSec_QueryInterface(IClientSecurity *iface, REFIID riid, void **ppvObject)
{
struct proxy_manager *This = impl_from_IClientSecurity( iface );
- return IMultiQI_QueryInterface((IMultiQI *)&This->lpVtbl, riid, ppvObject);
+ return IMultiQI_QueryInterface(&This->IMultiQI_iface, riid, ppvObject);
}
static ULONG WINAPI ProxyCliSec_AddRef(IClientSecurity *iface)
{
struct proxy_manager *This = impl_from_IClientSecurity( iface );
- return IMultiQI_AddRef((IMultiQI *)&This->lpVtbl);
+ return IMultiQI_AddRef(&This->IMultiQI_iface);
}
static ULONG WINAPI ProxyCliSec_Release(IClientSecurity *iface)
{
struct proxy_manager *This = impl_from_IClientSecurity( iface );
- return IMultiQI_Release((IMultiQI *)&This->lpVtbl);
+ return IMultiQI_Release(&This->IMultiQI_iface);
}
static HRESULT WINAPI ProxyCliSec_QueryBlanket(IClientSecurity *iface,
}
}
- This->lpVtbl = &ClientIdentity_Vtbl;
- This->lpVtblMarshal = &ProxyMarshal_Vtbl;
- This->lpVtblCliSec = &ProxyCliSec_Vtbl;
+ This->IMultiQI_iface.lpVtbl = &ClientIdentity_Vtbl;
+ This->IMarshal_iface.lpVtbl = &ProxyMarshal_Vtbl;
+ This->IClientSecurity_iface.lpVtbl = &ProxyCliSec_Vtbl;
list_init(&This->entry);
list_init(&This->interfaces);
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IMultiQI))
{
- *ppv = &This->lpVtbl;
- IUnknown_AddRef((IUnknown *)*ppv);
+ *ppv = &This->IMultiQI_iface;
+ IMultiQI_AddRef(&This->IMultiQI_iface);
return S_OK;
}
if (IsEqualIID(riid, &IID_IMarshal))
{
- *ppv = &This->lpVtblMarshal;
- IUnknown_AddRef((IUnknown *)*ppv);
+ *ppv = &This->IMarshal_iface;
+ IMarshal_AddRef(&This->IMarshal_iface);
return S_OK;
}
if (IsEqualIID(riid, &IID_IClientSecurity))
{
- *ppv = &This->lpVtblCliSec;
- IUnknown_AddRef((IUnknown *)*ppv);
+ *ppv = &This->IClientSecurity_iface;
+ IClientSecurity_AddRef(&This->IClientSecurity_iface);
return S_OK;
}
* proxy associated with the ifproxy as we handle IUnknown ourselves */
if (IsEqualIID(riid, &IID_IUnknown))
{
- ifproxy->iface = &This->lpVtbl;
- IMultiQI_AddRef((IMultiQI *)&This->lpVtbl);
+ ifproxy->iface = &This->IMultiQI_iface;
+ IMultiQI_AddRef(&This->IMultiQI_iface);
hr = S_OK;
}
else
* This ensures the COM identity rules are not violated, by having a
* one-to-one mapping of objects on the proxy side to objects on the
* stub side, no matter which interface you view the object through */
- hr = IPSFactoryBuffer_CreateProxy(psfb, (IUnknown *)&This->lpVtbl, riid,
+ hr = IPSFactoryBuffer_CreateProxy(psfb, (IUnknown*)&This->IMultiQI_iface, riid,
&ifproxy->proxy, &ifproxy->iface);
IPSFactoryBuffer_Release(psfb);
if (hr != S_OK)
/* be careful of a race with ClientIdentity_Release, which would
* cause us to return a proxy which is in the process of being
* destroyed */
- if (ClientIdentity_AddRef((IMultiQI *)&proxy->lpVtbl) != 0)
+ if (IMultiQI_AddRef(&proxy->IMultiQI_iface) != 0)
{
*proxy_found = proxy;
found = TRUE;
} StdMarshalImpl;
static HRESULT WINAPI
-StdMarshalImpl_QueryInterface(LPMARSHAL iface, REFIID riid, LPVOID *ppv)
+StdMarshalImpl_QueryInterface(IMarshal *iface, REFIID riid, void **ppv)
{
*ppv = NULL;
if (IsEqualIID(&IID_IUnknown, riid) || IsEqualIID(&IID_IMarshal, riid))
{
*ppv = iface;
- IUnknown_AddRef(iface);
+ IMarshal_AddRef(iface);
return S_OK;
}
FIXME("No interface for %s.\n", debugstr_guid(riid));
static HRESULT WINAPI
StdMarshalImpl_MarshalInterface(
- LPMARSHAL iface, IStream *pStm,REFIID riid, void* pv, DWORD dwDestContext,
- void* pvDestContext, DWORD mshlflags)
+ LPMARSHAL iface, IStream *pStm,REFIID riid, void* pv, DWORD dest_context,
+ void* dest_context_data, DWORD mshlflags)
{
STDOBJREF stdobjref;
ULONG res;
/* make sure this apartment can be reached from other threads / processes */
RPC_StartRemoting(apt);
- hres = marshal_object(apt, &stdobjref, riid, pv, mshlflags);
+ hres = marshal_object(apt, &stdobjref, riid, pv, dest_context, dest_context_data, mshlflags);
if (hres != S_OK)
{
ERR("Failed to create ifstub, hres=0x%x\n", hres);
/* release our reference to the proxy manager - the client/apartment
* will hold on to the remaining reference for us */
- if (proxy_manager) ClientIdentity_Release((IMultiQI*)&proxy_manager->lpVtbl);
+ if (proxy_manager) IMultiQI_Release(&proxy_manager->IMultiQI_iface);
return hr;
}
*/
struct HGLOBALLockBytesImpl
{
- /*
- * Needs to be the first item in the struct
- * since we want to cast this in an ILockBytes pointer
- */
- const ILockBytesVtbl *lpVtbl;
-
- /*
- * Reference count
- */
- LONG ref;
+ ILockBytes ILockBytes_iface;
+ LONG ref;
/*
* Support for the LockBytes object
typedef struct HGLOBALLockBytesImpl HGLOBALLockBytesImpl;
-/*
- * Method definition for the HGLOBALLockBytesImpl class.
- */
-static HGLOBALLockBytesImpl* HGLOBALLockBytesImpl_Construct(
- HGLOBAL hGlobal,
- BOOL fDeleteOnRelease);
-
-static void HGLOBALLockBytesImpl_Destroy(HGLOBALLockBytesImpl* This);
-
-static HRESULT WINAPI HGLOBALLockBytesImpl_SetSize( ILockBytes* iface, ULARGE_INTEGER libNewSize );
+static inline HGLOBALLockBytesImpl *impl_from_ILockBytes( ILockBytes *iface )
+{
+ return CONTAINING_RECORD(iface, HGLOBALLockBytesImpl, ILockBytes_iface);
+}
static const ILockBytesVtbl HGLOBALLockBytesImpl_Vtbl;
* This object supports a COM implementation of the ILockBytes interface.
*
* PARAMS
- * hGlobal [ I] Global memory handle
- * fDeleteOnRelease [ I] Whether the handle should be freed when the object is released.
- * ppLkbyt [ O] Address of ILockBytes pointer that receives
+ * global [ I] Global memory handle
+ * delete_on_release [ I] Whether the handle should be freed when the object is released.
+ * ret [ O] Address of ILockBytes pointer that receives
* the interface pointer to the new byte array object.
*
* RETURNS
* The ILockBytes interface instance calls the GlobalReAlloc function to grow
* the memory block as required.
*/
-HRESULT WINAPI CreateILockBytesOnHGlobal(HGLOBAL hGlobal,
- BOOL fDeleteOnRelease,
- LPLOCKBYTES* ppLkbyt)
+HRESULT WINAPI CreateILockBytesOnHGlobal(HGLOBAL global, BOOL delete_on_release, ILockBytes **ret)
{
- HGLOBALLockBytesImpl* newLockBytes;
+ HGLOBALLockBytesImpl* lockbytes;
- newLockBytes = HGLOBALLockBytesImpl_Construct(hGlobal, fDeleteOnRelease);
+ lockbytes = HeapAlloc(GetProcessHeap(), 0, sizeof(HGLOBALLockBytesImpl));
+ if (!lockbytes) return E_OUTOFMEMORY;
- if (newLockBytes != NULL)
- {
- return IUnknown_QueryInterface((IUnknown*)newLockBytes,
- &IID_ILockBytes,
- (void**)ppLkbyt);
- }
+ lockbytes->ILockBytes_iface.lpVtbl = &HGLOBALLockBytesImpl_Vtbl;
+ lockbytes->ref = 1;
+
+ /*
+ * Initialize the support.
+ */
+ lockbytes->supportHandle = global;
+ lockbytes->deleteOnRelease = delete_on_release;
+
+ /*
+ * This method will allocate a handle if one is not supplied.
+ */
+ if (lockbytes->supportHandle == 0)
+ lockbytes->supportHandle = GlobalAlloc(GMEM_MOVEABLE | GMEM_NODISCARD, 0);
+
+ /*
+ * Initialize the size of the array to the size of the handle.
+ */
+ lockbytes->byteArraySize.u.HighPart = 0;
+ lockbytes->byteArraySize.u.LowPart = GlobalSize(lockbytes->supportHandle);
- return E_OUTOFMEMORY;
+ *ret = &lockbytes->ILockBytes_iface;
+
+ return S_OK;
}
/******************************************************************************
* E_INVALIDARG if any parameters are invalid
*
*/
-HRESULT WINAPI GetHGlobalFromILockBytes(ILockBytes* plkbyt, HGLOBAL* phglobal)
+HRESULT WINAPI GetHGlobalFromILockBytes(ILockBytes* iface, HGLOBAL* phglobal)
{
- HGLOBALLockBytesImpl* const pMemLockBytes = (HGLOBALLockBytesImpl*)plkbyt;
+ HGLOBALLockBytesImpl* This = impl_from_ILockBytes(iface);
STATSTG stbuf;
HRESULT hres;
ULARGE_INTEGER start;
ULONG xread;
*phglobal = 0;
- if (pMemLockBytes->lpVtbl == &HGLOBALLockBytesImpl_Vtbl) {
- *phglobal = pMemLockBytes->supportHandle;
+ if (This->ILockBytes_iface.lpVtbl == &HGLOBALLockBytesImpl_Vtbl) {
+ *phglobal = This->supportHandle;
if (*phglobal == 0)
return E_INVALIDARG;
return S_OK;
}
/* It is not our lockbytes implementation, so use a more generic way */
- hres = ILockBytes_Stat(plkbyt,&stbuf,STATFLAG_NONAME);
+ hres = ILockBytes_Stat(iface,&stbuf,STATFLAG_NONAME);
if (hres != S_OK) {
ERR("Cannot ILockBytes_Stat, %x\n",hres);
return hres;
if (!*phglobal)
return E_INVALIDARG;
memset(&start,0,sizeof(start));
- hres = ILockBytes_ReadAt(plkbyt, start, GlobalLock(*phglobal), stbuf.cbSize.u.LowPart, &xread);
+ hres = ILockBytes_ReadAt(iface, start, GlobalLock(*phglobal), stbuf.cbSize.u.LowPart, &xread);
GlobalUnlock(*phglobal);
if (hres != S_OK) {
- FIXME("%p->ReadAt failed with %x\n",plkbyt,hres);
+ FIXME("%p->ReadAt failed with %x\n",iface,hres);
return hres;
}
if (stbuf.cbSize.u.LowPart != xread) {
*
*/
-/******************************************************************************
- * This is the constructor for the HGLOBALLockBytesImpl class.
- *
- * PARAMS
- * hGlobal [ I] Handle that will support the stream. can be NULL.
- * fDeleteOnRelease [ I] Flag set to TRUE if the HGLOBAL will be released
- * when the IStream object is destroyed.
- */
-static HGLOBALLockBytesImpl* HGLOBALLockBytesImpl_Construct(HGLOBAL hGlobal,
- BOOL fDeleteOnRelease)
-{
- HGLOBALLockBytesImpl* newLockBytes;
- newLockBytes = HeapAlloc(GetProcessHeap(), 0, sizeof(HGLOBALLockBytesImpl));
-
- if (newLockBytes!=0)
- {
- /*
- * Set up the virtual function table and reference count.
- */
- newLockBytes->lpVtbl = &HGLOBALLockBytesImpl_Vtbl;
- newLockBytes->ref = 0;
-
- /*
- * Initialize the support.
- */
- newLockBytes->supportHandle = hGlobal;
- newLockBytes->deleteOnRelease = fDeleteOnRelease;
-
- /*
- * This method will allocate a handle if one is not supplied.
- */
- if (newLockBytes->supportHandle == 0)
- {
- newLockBytes->supportHandle = GlobalAlloc(GMEM_MOVEABLE |
- GMEM_NODISCARD,
- 0);
- }
-
- /*
- * Initialize the size of the array to the size of the handle.
- */
- newLockBytes->byteArraySize.u.HighPart = 0;
- newLockBytes->byteArraySize.u.LowPart = GlobalSize(
- newLockBytes->supportHandle);
- }
-
- return newLockBytes;
-}
-
-/******************************************************************************
- * This is the destructor of the HGLOBALStreamImpl class.
- *
- * This method will clean-up all the resources used-up by the given
- * HGLOBALLockBytesImpl class. The pointer passed-in to this function will be
- * freed and will not be valid anymore.
- */
-static void HGLOBALLockBytesImpl_Destroy(HGLOBALLockBytesImpl* This)
-{
- /*
- * Release the HGlobal if the constructor asked for that.
- */
- if (This->deleteOnRelease)
- {
- GlobalFree(This->supportHandle);
- This->supportHandle = 0;
- }
-
- /*
- * Finally, free the memory used-up by the class.
- */
- HeapFree(GetProcessHeap(), 0, This);
-}
-
/******************************************************************************
* This implements the IUnknown method QueryInterface for this
* class
REFIID riid, /* [in] */
void** ppvObject) /* [iid_is][out] */
{
- HGLOBALLockBytesImpl* const This=(HGLOBALLockBytesImpl*)iface;
+ HGLOBALLockBytesImpl* This = impl_from_ILockBytes(iface);
- /*
- * Perform a sanity check on the parameters.
- */
if (ppvObject==0)
return E_INVALIDARG;
- /*
- * Initialize the return parameter.
- */
*ppvObject = 0;
- /*
- * Compare the riid with the interface IDs implemented by this object.
- */
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_ILockBytes))
{
- *ppvObject = This;
+ *ppvObject = &This->ILockBytes_iface;
}
-
- /*
- * Check that we obtained an interface.
- */
- if ((*ppvObject)==0)
+ else
return E_NOINTERFACE;
- /*
- * Query Interface always increases the reference count by one when it is
- * successful
- */
- IUnknown_AddRef(iface);
+ ILockBytes_AddRef(iface);
return S_OK;
}
*/
static ULONG WINAPI HGLOBALLockBytesImpl_AddRef(ILockBytes* iface)
{
- HGLOBALLockBytesImpl* const This=(HGLOBALLockBytesImpl*)iface;
+ HGLOBALLockBytesImpl* This = impl_from_ILockBytes(iface);
return InterlockedIncrement(&This->ref);
}
*/
static ULONG WINAPI HGLOBALLockBytesImpl_Release(ILockBytes* iface)
{
- HGLOBALLockBytesImpl* const This=(HGLOBALLockBytesImpl*)iface;
+ HGLOBALLockBytesImpl* This = impl_from_ILockBytes(iface);
ULONG ref;
ref = InterlockedDecrement(&This->ref);
-
- /*
- * If the reference count goes down to 0, perform suicide.
- */
- if (ref==0)
+ if (!ref)
{
- HGLOBALLockBytesImpl_Destroy(This);
+ if (This->deleteOnRelease)
+ {
+ GlobalFree(This->supportHandle);
+ This->supportHandle = 0;
+ }
+ HeapFree(GetProcessHeap(), 0, This);
}
return ref;
ULONG cb, /* [in] */
ULONG* pcbRead) /* [out] */
{
- HGLOBALLockBytesImpl* const This=(HGLOBALLockBytesImpl*)iface;
+ HGLOBALLockBytesImpl* This = impl_from_ILockBytes(iface);
void* supportBuffer;
ULONG bytesReadBuffer = 0;
ULONG cb, /* [in] */
ULONG* pcbWritten) /* [out] */
{
- HGLOBALLockBytesImpl* const This=(HGLOBALLockBytesImpl*)iface;
+ HGLOBALLockBytesImpl* This = impl_from_ILockBytes(iface);
void* supportBuffer;
ULARGE_INTEGER newSize;
if (newSize.u.LowPart > This->byteArraySize.u.LowPart)
{
/* grow stream */
- if (HGLOBALLockBytesImpl_SetSize(iface, newSize) == STG_E_MEDIUMFULL)
+ if (ILockBytes_SetSize(iface, newSize) == STG_E_MEDIUMFULL)
return STG_E_MEDIUMFULL;
}
ILockBytes* iface,
ULARGE_INTEGER libNewSize) /* [in] */
{
- HGLOBALLockBytesImpl* const This=(HGLOBALLockBytesImpl*)iface;
+ HGLOBALLockBytesImpl* This = impl_from_ILockBytes(iface);
HGLOBAL supportHandle;
/*
STATSTG* pstatstg, /* [out] */
DWORD grfStatFlag) /* [in] */
{
- HGLOBALLockBytesImpl* const This=(HGLOBALLockBytesImpl*)iface;
+ HGLOBALLockBytesImpl* This = impl_from_ILockBytes(iface);
memset(pstatstg, 0, sizeof(STATSTG));
if (hr == S_OK)
{
CoReleaseMarshalData(stream);
- IUnknown_Release(stream);
+ IStream_Release(stream);
}
}
MIDL_user_free(moniker);
if (hr == S_OK)
{
CoReleaseMarshalData(stream);
- IUnknown_Release(stream);
+ IStream_Release(stream);
}
}
HeapFree(GetProcessHeap(), 0, rot_entry->object);
--- /dev/null
+
+#define DEFINE_THISCALL_WRAPPER(func,args) \
+ typedef struct {int x[args/4];} _tag_##func; \
+ void __stdcall func(_tag_##func p1); \
+ __declspec(naked) void __stdcall func(_tag_##func p1) \
+ { \
+ __asm pop eax \
+ __asm push ecx \
+ __asm push eax \
+ __asm jmp func \
+ }
+
+DEFINE_THISCALL_WRAPPER(Allocate_PMemoryAllocator,8)
--- /dev/null
+
+#define __ASM_STDCALL_FUNC(name,args,code)
*/
static inline BOOL is_droptarget(HWND hwnd)
{
- return get_droptarget_handle(hwnd) ? TRUE : FALSE;
+ return get_droptarget_handle(hwnd) != 0;
}
/*************************************************************
/*
* Open the class id Key
*/
- hres = RegOpenKeyW(HKEY_CLASSES_ROOT,
- keyName,
- &clsidKey);
-
+ hres = open_classes_key(HKEY_CLASSES_ROOT, keyName, MAXIMUM_ALLOWED, &clsidKey);
if (hres != ERROR_SUCCESS)
return REGDB_E_CLASSNOTREG;
/*
* Open the class id Key
*/
- result = RegOpenKeyW(HKEY_CLASSES_ROOT,
- keyName,
- &clsidKey);
-
+ result = open_classes_key(HKEY_CLASSES_ROOT, keyName, MAXIMUM_ALLOWED, &clsidKey);
if (result != ERROR_SUCCESS)
return REGDB_E_CLASSNOTREG;
/*
* Get the MiscStatus
*/
- result = RegOpenKeyW(clsidKey,
- miscstatusW,
- &miscStatusKey);
-
-
+ result = open_classes_key(clsidKey, miscstatusW, MAXIMUM_ALLOWED, &miscStatusKey);
if (result != ERROR_SUCCESS)
{
RegCloseKey(clsidKey);
*/
sprintfW(keyName, dfmtW, dwAspect);
- result = RegOpenKeyW(miscStatusKey,
- keyName,
- &aspectKey);
-
+ result = open_classes_key(miscStatusKey, keyName, MAXIMUM_ALLOWED, &aspectKey);
if (result == ERROR_SUCCESS)
{
OLEUTL_ReadRegistryDWORDValue(aspectKey, pdwStatus);
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IEnumOLEVERB))
{
- IUnknown_AddRef(iface);
+ IEnumOLEVERB_AddRef(iface);
*ppv = iface;
return S_OK;
}
/*
* Initialize the object with its IPersistStorage interface.
*/
- hres = IOleObject_QueryInterface(pUnk,
- &IID_IPersistStorage,
- (void**)&persistStorage);
-
+ hres = IUnknown_QueryInterface(pUnk, &IID_IPersistStorage, (void**)&persistStorage);
if (SUCCEEDED(hres))
{
hres = IPersistStorage_Load(persistStorage, pStg);
if ( nPos < nWidth )
{
/* Odd elements are server menu widths */
- pOleMenuDescriptor->bIsServerItem = (i%2) ? TRUE : FALSE;
+ pOleMenuDescriptor->bIsServerItem = i%2;
break;
}
}
IUnknown *pUnk,
DWORD dwAspect,
HDC hdcDraw,
- LPCRECT lprcBounds)
+ LPCRECT rect)
{
HRESULT hres;
IViewObject *viewobject;
+ if (!pUnk) return E_INVALIDARG;
+
hres = IUnknown_QueryInterface(pUnk,
&IID_IViewObject,
(void**)&viewobject);
-
if (SUCCEEDED(hres))
{
- RECTL rectl;
-
- rectl.left = lprcBounds->left;
- rectl.right = lprcBounds->right;
- rectl.top = lprcBounds->top;
- rectl.bottom = lprcBounds->bottom;
- hres = IViewObject_Draw(viewobject, dwAspect, -1, 0, 0, 0, hdcDraw, &rectl, 0, 0, 0);
-
+ hres = IViewObject_Draw(viewobject, dwAspect, -1, 0, 0, 0, hdcDraw, (RECTL*)rect, 0, 0, 0);
IViewObject_Release(viewobject);
return hres;
}
else
- {
return DV_E_NOIVIEWOBJECT;
- }
}
/***********************************************************************
/***********************************************************************
* PropSysAllocString [OLE32.@]
- * NOTES:
- * Basically a copy of SysAllocStringLen.
+ * NOTES
+ * Forward to oleaut32.
*/
BSTR WINAPI PropSysAllocString(LPCOLESTR str)
{
- DWORD bufferSize;
- DWORD* newBuffer;
- WCHAR* stringBuffer;
- int len;
-
- if (!str) return 0;
-
- len = lstrlenW(str);
- /*
- * Find the length of the buffer passed-in, in bytes.
- */
- bufferSize = len * sizeof (WCHAR);
-
- /*
- * Allocate a new buffer to hold the string.
- * Don't forget to keep an empty spot at the beginning of the
- * buffer for the character count and an extra character at the
- * end for the NULL.
- */
- newBuffer = HeapAlloc(GetProcessHeap(), 0,
- bufferSize + sizeof(WCHAR) + sizeof(DWORD));
-
- /*
- * If the memory allocation failed, return a null pointer.
- */
- if (newBuffer==0)
- return 0;
-
- /*
- * Copy the length of the string in the placeholder.
- */
- *newBuffer = bufferSize;
-
- /*
- * Skip the byte count.
- */
- newBuffer++;
-
- memcpy(newBuffer, str, bufferSize);
-
- /*
- * Make sure that there is a nul character at the end of the
- * string.
- */
- stringBuffer = (WCHAR*)newBuffer;
- stringBuffer[len] = '\0';
-
- return stringBuffer;
+ return SysAllocString(str);
}
/***********************************************************************
* PropSysFreeString [OLE32.@]
* NOTES
- * Copy of SysFreeString.
+ * Forward to oleaut32.
*/
void WINAPI PropSysFreeString(LPOLESTR str)
{
- DWORD* bufferPointer;
-
- /* NULL is a valid parameter */
- if(!str) return;
-
- /*
- * We have to be careful when we free a BSTR pointer, it points to
- * the beginning of the string but it skips the byte count contained
- * before the string.
- */
- bufferPointer = (DWORD*)str;
-
- bufferPointer--;
-
- /*
- * Free the memory from its "real" origin.
- */
- HeapFree(GetProcessHeap(), 0, bufferPointer);
+ SysFreeString(str);
}
/******************************************************************************
{
case VT_EMPTY:
case VT_NULL:
+ case VT_I1:
case VT_I2:
case VT_I4:
+ case VT_I8:
case VT_R4:
case VT_R8:
case VT_CY:
case VT_UI1:
case VT_UI2:
case VT_UI4:
- case VT_I8:
case VT_UI8:
case VT_LPSTR:
case VT_LPWSTR:
case VT_BLOB_OBJECT:
case VT_CF:
case VT_CLSID:
+ case VT_I1|VT_VECTOR:
case VT_I2|VT_VECTOR:
case VT_I4|VT_VECTOR:
+ case VT_I8|VT_VECTOR:
case VT_R4|VT_VECTOR:
case VT_R8|VT_VECTOR:
case VT_CY|VT_VECTOR:
case VT_UI1|VT_VECTOR:
case VT_UI2|VT_VECTOR:
case VT_UI4|VT_VECTOR:
- case VT_I8|VT_VECTOR:
case VT_UI8|VT_VECTOR:
case VT_LPSTR|VT_VECTOR:
case VT_LPWSTR|VT_VECTOR:
{
case VT_EMPTY:
case VT_NULL:
+ case VT_I1:
case VT_I2:
case VT_I4:
+ case VT_I8:
case VT_R4:
case VT_R8:
case VT_CY:
case VT_UI1:
case VT_UI2:
case VT_UI4:
- case VT_I8:
case VT_UI8:
case VT_FILETIME:
break;
case VT_STORAGE:
case VT_STORED_OBJECT:
if (pvar->u.pStream)
- IUnknown_Release(pvar->u.pStream);
+ IStream_Release(pvar->u.pStream);
break;
case VT_CLSID:
case VT_LPSTR:
CoTaskMemFree(pvar->u.blob.pBlobData);
break;
case VT_BSTR:
- if (pvar->u.bstrVal)
- PropSysFreeString(pvar->u.bstrVal);
+ PropSysFreeString(pvar->u.bstrVal);
break;
case VT_CF:
if (pvar->u.pclipdata)
*/
static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf)
{
+ static const UINT fmt_id[] = { CF_METAFILEPICT, CF_BITMAP, CF_DIB };
+ UINT i;
HRESULT hr;
FORMATETC fmt;
STGMEDIUM med;
return hr;
}
+ for (i = 0; i < sizeof(fmt_id)/sizeof(fmt_id[0]); i++)
+ {
+ init_fmtetc(&fmt, fmt_id[i], TYMED_ISTORAGE);
+ hr = IDataObject_QueryGetData(data, &fmt);
+ if(SUCCEEDED(hr))
+ {
+ *src_cf = fmt_id[i];
+ return hr;
+ }
+ }
+
/* IPersistStorage */
hr = IDataObject_QueryInterface(data, &IID_IPersistStorage, (void**)&persist);
if(FAILED(hr)) return hr;
fmt, NULL, NULL, client_site, stg, obj);
}
+/******************************************************************************
+ * OleCreateLinkFromData [OLE32.@]
+ */
+HRESULT WINAPI OleCreateLinkFromData(IDataObject *data, REFIID iid,
+ DWORD renderopt, FORMATETC *fmt,
+ IOleClientSite *client_site, IStorage *stg,
+ void **obj)
+{
+ FIXME("%p,%s,%08x,%p,%p,%p,%p: semi-stub\n",
+ data, debugstr_guid(iid), renderopt, fmt, client_site, stg, obj);
+ return OleCreateFromData(data, iid, renderopt, fmt, client_site, stg, obj);
+}
+
+/******************************************************************************
+ * OleCreateStaticFromData [OLE32.@]
+ */
+HRESULT WINAPI OleCreateStaticFromData(IDataObject *data, REFIID iid,
+ DWORD renderopt, FORMATETC *fmt,
+ IOleClientSite *client_site, IStorage *stg,
+ void **obj)
+{
+ FIXME("%p,%s,%08x,%p,%p,%p,%p: semi-stub\n",
+ data, debugstr_guid(iid), renderopt, fmt, client_site, stg, obj);
+ return OleCreateFromData(data, iid, renderopt, fmt, client_site, stg, obj);
+}
/******************************************************************************
* OleDuplicateData [OLE32.@]
return E_NOTIMPL;
}
-/******************************************************************************
- * SetConvertStg [OLE32.@]
- */
-HRESULT WINAPI SetConvertStg(LPSTORAGE pStg, BOOL fConvert)
-{
- FIXME("(%p,%x), stub!\n", pStg, fConvert);
- return E_NOTIMPL;
-}
-
/******************************************************************************
* OleCreateLink [OLE32.@]
*/
return NULL;
}
-
-/******************************************************************************
- * OleCreateStaticFromData [OLE32.@]
- */
-HRESULT WINAPI OleCreateStaticFromData(LPDATAOBJECT pSrcDataObj, REFIID iid,
- DWORD renderopt, LPFORMATETC pFormatEtc, LPOLECLIENTSITE pClientSite,
- LPSTORAGE pStg, LPVOID* ppvObj)
-{
- FIXME("(srcdata=%p, refiid=%s, renderopt=%x, formatetc=%p, client=%p, storage=%p, ppv=%p), stub!\n",
- pSrcDataObj,debugstr_guid(iid),renderopt,pFormatEtc,pClientSite,pStg,ppvObj );
- return E_NOTIMPL;
-}
-
-/******************************************************************************
- * OleCreateLinkFromData [OLE32.@]
- */
-
-HRESULT WINAPI OleCreateLinkFromData(LPDATAOBJECT pSrcDataObj, REFIID riid,
- DWORD renderopt, LPFORMATETC pFormatEtc,
- LPOLECLIENTSITE pClientSite, LPSTORAGE pStg,
- LPVOID* ppvObj)
-{
- FIXME("(not shown), stub!\n");
- return E_NOTIMPL;
-}
-
/***********************************************************************
* OleRegEnumFormatEtc [OLE32.@]
*/
@ stdcall CoGetContextToken(ptr)
@ stdcall CoGetCurrentLogicalThreadId(ptr)
@ stdcall CoGetCurrentProcess()
+@ stdcall CoGetDefaultContext(long ptr ptr)
@ stub CoGetInstanceFromFile #@ stdcall (ptr ptr ptr long wstr long ptr) return 0,ERR_NOTIMPLEMENTED
@ stub CoGetInstanceFromIStorage #@ stdcall (ptr ptr ptr long ptr long ptr) return 0,ERR_NOTIMPLEMENTED
@ stdcall CoGetInterfaceAndReleaseStream(ptr ptr ptr)
@ stdcall SetConvertStg(ptr long)
@ stub SetDocumentBitStg
@ stdcall SetErrorInfo(long ptr)
+@ stdcall StgConvertPropertyToVariant(ptr long ptr ptr)
+@ stdcall StgConvertVariantToProperty(ptr long ptr ptr long long ptr)
@ stdcall StgCreateDocfile(wstr long long ptr)
@ stdcall StgCreateDocfileOnILockBytes(ptr long long ptr)
@ stdcall StgCreatePropSetStg(ptr long ptr)
#include "objidl.idl"
cpp_quote("#endif /* ole32_objidl.idl hack */")
-#ifndef __WIDL__
-#define threading(model)
-#define progid(str)
-#endif
-
[
threading(both),
uuid(00000300-0000-0000-c000-000000000046)
]
coclass DfMarshal { interface IMarshal; }
-#ifdef __WIDL__
[
helpstring("Picture (Metafile)"),
threading(both),
uuid(00000316-0000-0000-c000-000000000046)
]
coclass Picture_Dib { interface IPicture; }
-#endif
[
threading(both),
]
coclass ClassMoniker { interface IMoniker; }
-#ifdef __WIDL__
[
threading(both),
uuid(00000320-0000-0000-c000-000000000046)
]
coclass PSFactoryBuffer { interface IFactoryBuffer; }
-#endif
[
threading(apartment),
]
coclass StdGlobalInterfaceTable { interface IGlobalInterfaceTable; }
-#ifdef __WIDL__
[
helpstring("Component Categories Manager"),
threading(both),
uuid(0002e005-0000-0000-c000-000000000046)
]
coclass StdComponentCategoriesMgr { interface ICatRegister; interface ICatInformation; }
-#endif
#include "oleidl.idl"
-#ifdef __WIDL__
[
threading(both),
uuid(00000320-0000-0000-c000-000000000046)
]
coclass PSFactoryBuffer { interface IFactoryBuffer; }
-#endif
#include "unknwn.idl"
cpp_quote("#endif /* oleaut32_unknwn.idl hack */")
-#ifdef __WIDL__
[
threading(both),
uuid(00000320-0000-0000-c000-000000000046)
]
coclass PSFactoryBuffer { interface IFactoryBuffer; }
-#endif
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IEnumSTATDATA))
{
- IUnknown_AddRef(iface);
+ IEnumSTATDATA_AddRef(iface);
*ppv = iface;
return S_OK;
}
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
{
*ppv = iface;
- IUnknown_AddRef(iface);
+ IClassFactory_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
typedef struct
{
- const IRpcChannelBufferVtbl *lpVtbl;
- LONG refs;
+ IRpcChannelBuffer IRpcChannelBuffer_iface;
+ LONG refs;
+
+ DWORD dest_context; /* returned from GetDestCtx */
+ void *dest_context_data; /* returned from GetDestCtx */
} RpcChannelBuffer;
typedef struct
RPC_BINDING_HANDLE bind; /* handle to the remote server */
OXID oxid; /* apartment in which the channel is valid */
DWORD server_pid; /* id of server process */
- DWORD dest_context; /* returned from GetDestCtx */
- LPVOID dest_context_data; /* returned from GetDestCtx */
HANDLE event; /* cached event handle */
} ClientRpcChannelBuffer;
/* RPC Channel Buffer Functions */
-static HRESULT WINAPI RpcChannelBuffer_QueryInterface(LPRPCCHANNELBUFFER iface, REFIID riid, LPVOID *ppv)
+static HRESULT WINAPI RpcChannelBuffer_QueryInterface(IRpcChannelBuffer *iface, REFIID riid, LPVOID *ppv)
{
*ppv = NULL;
if (IsEqualIID(riid,&IID_IRpcChannelBuffer) || IsEqualIID(riid,&IID_IUnknown))
{
*ppv = iface;
- IUnknown_AddRef(iface);
+ IRpcChannelBuffer_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
TRACE("(%p,%p)\n", pdwDestContext, ppvDestContext);
- *pdwDestContext = This->dest_context;
- *ppvDestContext = This->dest_context_data;
+ *pdwDestContext = This->super.dest_context;
+ *ppvDestContext = This->super.dest_context_data;
return S_OK;
}
-static HRESULT WINAPI ServerRpcChannelBuffer_GetDestCtx(LPRPCCHANNELBUFFER iface, DWORD* pdwDestContext, void** ppvDestContext)
+static HRESULT WINAPI ServerRpcChannelBuffer_GetDestCtx(LPRPCCHANNELBUFFER iface, DWORD* dest_context, void** dest_context_data)
{
- WARN("(%p,%p), stub!\n", pdwDestContext, ppvDestContext);
+ RpcChannelBuffer *This = (RpcChannelBuffer *)iface;
- /* FIXME: implement this by storing the dwDestContext and pvDestContext
- * values passed into IMarshal_MarshalInterface and returning them here */
- *pdwDestContext = MSHCTX_DIFFERENTMACHINE;
- *ppvDestContext = NULL;
+ TRACE("(%p,%p)\n", dest_context, dest_context_data);
+
+ *dest_context = This->dest_context;
+ *dest_context_data = This->dest_context_data;
return S_OK;
}
return E_OUTOFMEMORY;
}
- This->super.lpVtbl = &ClientRpcChannelBufferVtbl;
+ This->super.IRpcChannelBuffer_iface.lpVtbl = &ClientRpcChannelBufferVtbl;
This->super.refs = 1;
+ This->super.dest_context = dest_context;
+ This->super.dest_context_data = dest_context_data;
This->bind = bind;
apartment_getoxid(COM_CurrentApt(), &This->oxid);
This->server_pid = oxid_info->dwPid;
- This->dest_context = dest_context;
- This->dest_context_data = dest_context_data;
This->event = NULL;
- *chan = (IRpcChannelBuffer*)This;
+ *chan = &This->super.IRpcChannelBuffer_iface;
return S_OK;
}
-HRESULT RPC_CreateServerChannel(IRpcChannelBuffer **chan)
+HRESULT RPC_CreateServerChannel(DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan)
{
RpcChannelBuffer *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if (!This)
return E_OUTOFMEMORY;
- This->lpVtbl = &ServerRpcChannelBufferVtbl;
+ This->IRpcChannelBuffer_iface.lpVtbl = &ServerRpcChannelBufferVtbl;
This->refs = 1;
+ This->dest_context = dest_context;
+ This->dest_context_data = dest_context_data;
- *chan = (IRpcChannelBuffer*)This;
+ *chan = &This->IRpcChannelBuffer_iface;
return S_OK;
}
* PropertyStorage_ReadFromStream
*/
+#include "config.h"
+#include "wine/port.h"
+
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include "dictionary.h"
#include "storage32.h"
#include "enumx.h"
+#include "oleauto.h"
WINE_DEFAULT_DEBUG_CHANNEL(storage);
static inline StorageImpl *impl_from_IPropertySetStorage( IPropertySetStorage *iface )
{
- return (StorageImpl *)((char*)iface - FIELD_OFFSET(StorageImpl, base.pssVtbl));
+ return CONTAINING_RECORD(iface, StorageImpl, base.IPropertySetStorage_iface);
}
/* These are documented in MSDN,
return hr;
}
+#ifdef __i386__
+#define __thiscall __stdcall
+#else
+#define __thiscall __cdecl
+#endif
+
+static void* __thiscall Allocate_CoTaskMemAlloc(void *userdata, ULONG size)
+{
+ return CoTaskMemAlloc(size);
+}
+
/* FIXME: there isn't any checking whether the read property extends past the
* end of the buffer.
*/
-static HRESULT PropertyStorage_ReadProperty(PropertyStorage_impl *This,
- PROPVARIANT *prop, const BYTE *data)
+static HRESULT PropertyStorage_ReadProperty(PROPVARIANT *prop, const BYTE *data,
+ UINT codepage, void* (__thiscall *allocate)(void *userdata, ULONG size), void *allocate_data)
{
HRESULT hr = S_OK;
DWORD count;
StorageUtl_ReadDWord(data, 0, &count);
- if (This->codePage == CP_UNICODE && count / 2)
+ if (codepage == CP_UNICODE && count % 2)
{
WARN("Unicode string has odd number of bytes\n");
hr = STG_E_INVALIDHEADER;
}
else
{
- prop->u.pszVal = CoTaskMemAlloc(count);
+ prop->u.pszVal = allocate(allocate_data, count);
if (prop->u.pszVal)
{
memcpy(prop->u.pszVal, data + sizeof(DWORD), count);
- /* This is stored in the code page specified in This->codePage.
+ /* This is stored in the code page specified in codepage.
* Don't convert it, the caller will just store it as-is.
*/
- if (This->codePage == CP_UNICODE)
+ if (codepage == CP_UNICODE)
{
/* Make sure it's NULL-terminated */
prop->u.pszVal[count / sizeof(WCHAR) - 1] = '\0';
}
break;
}
+ case VT_BSTR:
+ {
+ DWORD count, wcount;
+
+ StorageUtl_ReadDWord(data, 0, &count);
+ if (codepage == CP_UNICODE && count % 2)
+ {
+ WARN("Unicode string has odd number of bytes\n");
+ hr = STG_E_INVALIDHEADER;
+ }
+ else
+ {
+ if (codepage == CP_UNICODE)
+ wcount = count / 2;
+ else
+ wcount = MultiByteToWideChar(codepage, 0, (LPCSTR)(data + sizeof(DWORD)), count, NULL, 0);
+
+ prop->u.bstrVal = SysAllocStringLen(NULL, wcount); /* FIXME: use allocator? */
+
+ if (prop->u.bstrVal)
+ {
+ if (codepage == CP_UNICODE)
+ memcpy(prop->u.bstrVal, data + sizeof(DWORD), count);
+ else
+ MultiByteToWideChar(codepage, 0, (LPCSTR)(data + sizeof(DWORD)), count, prop->u.bstrVal, wcount);
+
+ prop->u.bstrVal[wcount - 1] = '\0';
+ TRACE("Read string value %s\n", debugstr_w(prop->u.bstrVal));
+ }
+ else
+ hr = STG_E_INSUFFICIENTMEMORY;
+ }
+ break;
+ }
case VT_BLOB:
{
DWORD count;
StorageUtl_ReadDWord(data, 0, &count);
prop->u.blob.cbSize = count;
- prop->u.blob.pBlobData = CoTaskMemAlloc(count);
+ prop->u.blob.pBlobData = allocate(allocate_data, count);
if (prop->u.blob.pBlobData)
{
memcpy(prop->u.blob.pBlobData, data + sizeof(DWORD), count);
DWORD count;
StorageUtl_ReadDWord(data, 0, &count);
- prop->u.pwszVal = CoTaskMemAlloc(count * sizeof(WCHAR));
+ prop->u.pwszVal = allocate(allocate_data, count * sizeof(WCHAR));
if (prop->u.pwszVal)
{
memcpy(prop->u.pwszVal, data + sizeof(DWORD),
if (len > 8)
{
len -= 8;
- prop->u.pclipdata = CoTaskMemAlloc(sizeof (CLIPDATA));
+ prop->u.pclipdata = allocate(allocate_data, sizeof (CLIPDATA));
prop->u.pclipdata->cbSize = len;
prop->u.pclipdata->ulClipFmt = tag;
- prop->u.pclipdata->pClipData = CoTaskMemAlloc(len - sizeof(prop->u.pclipdata->ulClipFmt));
+ prop->u.pclipdata->pClipData = allocate(allocate_data, len - sizeof(prop->u.pclipdata->ulClipFmt));
memcpy(prop->u.pclipdata->pClipData, data+8, len - sizeof(prop->u.pclipdata->ulClipFmt));
}
else
PROPVARIANT prop;
PropVariantInit(&prop);
- if (SUCCEEDED(PropertyStorage_ReadProperty(This, &prop,
- buf + idOffset->dwOffset - sizeof(PROPERTYSECTIONHEADER))))
+ if (SUCCEEDED(PropertyStorage_ReadProperty(&prop,
+ buf + idOffset->dwOffset - sizeof(PROPERTYSECTIONHEADER),
+ This->codePage, Allocate_CoTaskMemAlloc, NULL)))
{
TRACE("Read property with ID 0x%08x, type %d\n",
idOffset->propid, prop.vt);
void** ppvObject)
{
StorageImpl *This = impl_from_IPropertySetStorage(ppstg);
- return IStorage_QueryInterface( (IStorage*)This, riid, ppvObject );
+ return IStorage_QueryInterface( &This->base.IStorage_iface, riid, ppvObject );
}
/************************************************************************
IPropertySetStorage *ppstg)
{
StorageImpl *This = impl_from_IPropertySetStorage(ppstg);
- return IStorage_AddRef( (IStorage*)This );
+ return IStorage_AddRef( &This->base.IStorage_iface );
}
/************************************************************************
IPropertySetStorage *ppstg)
{
StorageImpl *This = impl_from_IPropertySetStorage(ppstg);
- return IStorage_Release( (IStorage*)This );
+ return IStorage_Release( &This->base.IStorage_iface );
}
/************************************************************************
if (FAILED(r))
goto end;
- r = IStorage_CreateStream( (IStorage*)This, name, grfMode, 0, 0, &stm );
+ r = IStorage_CreateStream( &This->base.IStorage_iface, name, grfMode, 0, 0, &stm );
if (FAILED(r))
goto end;
if (FAILED(r))
goto end;
- r = IStorage_OpenStream((IStorage*) This, name, 0, grfMode, 0, &stm );
+ r = IStorage_OpenStream( &This->base.IStorage_iface, name, 0, grfMode, 0, &stm );
if (FAILED(r))
goto end;
REFFMTID rfmtid)
{
StorageImpl *This = impl_from_IPropertySetStorage(ppstg);
- IStorage *stg = NULL;
WCHAR name[CCH_MAX_PROPSTG_NAME];
HRESULT r;
if (FAILED(r))
return r;
- stg = (IStorage*) This;
- return IStorage_DestroyElement(stg, name);
+ return IStorage_DestroyElement(&This->base.IStorage_iface, name);
}
/************************************************************************
StorageImpl *This,
IEnumSTATPROPSETSTG** ppenum)
{
- IStorage *stg = (IStorage*) &This->base.lpVtbl;
+ IStorage *stg = &This->base.IStorage_iface;
IEnumSTATSTG *penum = NULL;
STATSTG stat;
ULONG count;
/* add all the property set elements into a list */
r = IStorage_EnumElements(stg, 0, NULL, 0, &penum);
if (FAILED(r))
+ {
+ enumx_Release(enumx);
return E_OUTOFMEMORY;
+ }
while (1)
{
end:
return hr;
}
+
+#ifdef __i386__ /* thiscall functions are i386-specific */
+
+#define DEFINE_STDCALL_WRAPPER(num,func,args) \
+ __ASM_STDCALL_FUNC(func, args, \
+ "popl %eax\n\t" \
+ "popl %ecx\n\t" \
+ "pushl %eax\n\t" \
+ "movl (%ecx), %eax\n\t" \
+ "jmp *(4*(" #num "))(%eax)" )
+
+DEFINE_STDCALL_WRAPPER(0,Allocate_PMemoryAllocator,8)
+extern void* __thiscall Allocate_PMemoryAllocator(void *this, ULONG cbSize);
+
+#else
+
+static void* __thiscall Allocate_PMemoryAllocator(void *this, ULONG cbSize)
+{
+ void* (__thiscall *fn)(void*,ULONG) = **(void***)this;
+ return fn(this, cbSize);
+}
+
+#endif
+
+BOOLEAN WINAPI StgConvertPropertyToVariant(const SERIALIZEDPROPERTYVALUE* prop,
+ USHORT CodePage, PROPVARIANT* pvar, void* pma)
+{
+ HRESULT hr;
+
+ hr = PropertyStorage_ReadProperty(pvar, (const BYTE*)prop, CodePage, Allocate_PMemoryAllocator, pma);
+
+ if (FAILED(hr))
+ {
+ FIXME("should raise C++ exception on failure\n");
+ PropVariantInit(pvar);
+ }
+
+ return 0;
+}
+
+SERIALIZEDPROPERTYVALUE* WINAPI StgConvertVariantToProperty(const PROPVARIANT *pvar,
+ USHORT CodePage, SERIALIZEDPROPERTYVALUE *pprop, ULONG *pcb, PROPID pid,
+ BOOLEAN fReserved, ULONG *pcIndirect)
+{
+ FIXME("%p,%d,%p,%p,%d,%d,%p\n", pvar, CodePage, pprop, pcb, pid, fReserved, pcIndirect);
+
+ return NULL;
+}
/*
* Release the reference we are holding on the parent storage.
- * IStorage_Release((IStorage*)This->parentStorage);
+ * IStorage_Release(&This->parentStorage->IStorage_iface);
*
* No, don't do this. Some apps call IStorage_Release without
* calling IStream_Release first. If we grab a reference the
This->parentStorage = 0;
- /*
- * Finally, free the memory used-up by the class.
- */
HeapFree(GetProcessHeap(), 0, This);
}
REFIID riid, /* [in] */
void** ppvObject) /* [iid_is][out] */
{
- StgStreamImpl* const This=(StgStreamImpl*)iface;
+ StgStreamImpl* This = impl_from_IStream(iface);
- /*
- * Perform a sanity check on the parameters.
- */
if (ppvObject==0)
return E_INVALIDARG;
- /*
- * Initialize the return parameter.
- */
*ppvObject = 0;
- /*
- * Compare the riid with the interface IDs implemented by this object.
- */
if (IsEqualIID(&IID_IUnknown, riid) ||
- IsEqualIID(&IID_IPersist, riid) ||
- IsEqualIID(&IID_IPersistStream, riid) ||
IsEqualIID(&IID_ISequentialStream, riid) ||
IsEqualIID(&IID_IStream, riid))
{
- *ppvObject = This;
+ *ppvObject = &This->IStream_iface;
}
-
- /*
- * Check that we obtained an interface.
- */
- if ((*ppvObject)==0)
+ else
return E_NOINTERFACE;
- /*
- * Query Interface always increases the reference count by one when it is
- * successful
- */
IStream_AddRef(iface);
return S_OK;
static ULONG WINAPI StgStreamImpl_AddRef(
IStream* iface)
{
- StgStreamImpl* const This=(StgStreamImpl*)iface;
+ StgStreamImpl* This = impl_from_IStream(iface);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI StgStreamImpl_Release(
IStream* iface)
{
- StgStreamImpl* const This=(StgStreamImpl*)iface;
+ StgStreamImpl* This = impl_from_IStream(iface);
ULONG ref;
ULONG cb, /* [in] */
ULONG* pcbRead) /* [out] */
{
- StgStreamImpl* const This=(StgStreamImpl*)iface;
+ StgStreamImpl* This = impl_from_IStream(iface);
ULONG bytesReadBuffer;
HRESULT res;
ULONG cb, /* [in] */
ULONG* pcbWritten) /* [out] */
{
- StgStreamImpl* const This=(StgStreamImpl*)iface;
+ StgStreamImpl* This = impl_from_IStream(iface);
ULONG bytesWritten = 0;
HRESULT res;
DWORD dwOrigin, /* [in] */
ULARGE_INTEGER* plibNewPosition) /* [out] */
{
- StgStreamImpl* const This=(StgStreamImpl*)iface;
+ StgStreamImpl* This = impl_from_IStream(iface);
ULARGE_INTEGER newPosition;
DirEntry currentEntry;
IStream* iface,
ULARGE_INTEGER libNewSize) /* [in] */
{
- StgStreamImpl* const This=(StgStreamImpl*)iface;
+ StgStreamImpl* This = impl_from_IStream(iface);
HRESULT hr;
ULARGE_INTEGER* pcbRead, /* [out] */
ULARGE_INTEGER* pcbWritten) /* [out] */
{
- StgStreamImpl* const This=(StgStreamImpl*)iface;
+ StgStreamImpl* This = impl_from_IStream(iface);
HRESULT hr = S_OK;
BYTE tmpBuffer[128];
ULONG bytesRead, bytesWritten, copySize;
IStream* iface,
DWORD grfCommitFlags) /* [in] */
{
- StgStreamImpl* const This=(StgStreamImpl*)iface;
+ StgStreamImpl* This = impl_from_IStream(iface);
if (!This->parentStorage)
{
ULARGE_INTEGER cb, /* [in] */
DWORD dwLockType) /* [in] */
{
- StgStreamImpl* const This=(StgStreamImpl*)iface;
+ StgStreamImpl* This = impl_from_IStream(iface);
if (!This->parentStorage)
{
ULARGE_INTEGER cb, /* [in] */
DWORD dwLockType) /* [in] */
{
- StgStreamImpl* const This=(StgStreamImpl*)iface;
+ StgStreamImpl* This = impl_from_IStream(iface);
if (!This->parentStorage)
{
STATSTG* pstatstg, /* [out] */
DWORD grfStatFlag) /* [in] */
{
- StgStreamImpl* const This=(StgStreamImpl*)iface;
+ StgStreamImpl* This = impl_from_IStream(iface);
DirEntry currentEntry;
HRESULT hr;
IStream* iface,
IStream** ppstm) /* [out] */
{
- StgStreamImpl* const This=(StgStreamImpl*)iface;
+ StgStreamImpl* This = impl_from_IStream(iface);
HRESULT hres;
StgStreamImpl* new_stream;
LARGE_INTEGER seek_pos;
if (!new_stream)
return STG_E_INSUFFICIENTMEMORY; /* Currently the only reason for new_stream=0 */
- *ppstm = (IStream*) new_stream;
+ *ppstm = &new_stream->IStream_iface;
IStream_AddRef(*ppstm);
seek_pos.QuadPart = This->currentPosition.QuadPart;
- hres=StgStreamImpl_Seek (*ppstm, seek_pos, STREAM_SEEK_SET, NULL);
+ hres = IStream_Seek(*ppstm, seek_pos, STREAM_SEEK_SET, NULL);
assert (SUCCEEDED(hres));
/*
* Virtual function table for the StgStreamImpl class.
*/
-static const IStreamVtbl StgStreamImpl_Vtbl =
+static const IStreamVtbl StgStreamVtbl =
{
StgStreamImpl_QueryInterface,
StgStreamImpl_AddRef,
newStream = HeapAlloc(GetProcessHeap(), 0, sizeof(StgStreamImpl));
- if (newStream!=0)
+ if (newStream)
{
/*
* Set-up the virtual function table and reference count.
*/
- newStream->lpVtbl = &StgStreamImpl_Vtbl;
+ newStream->IStream_iface.lpVtbl = &StgStreamVtbl;
newStream->ref = 0;
newStream->parentStorage = parentStorage;
* We want to nail-down the reference to the storage in case the
* stream out-lives the storage in the client application.
*
- * -- IStorage_AddRef((IStorage*)newStream->parentStorage);
+ * -- IStorage_AddRef(&newStream->parentStorage->IStorage_iface);
*
* No, don't do this. Some apps call IStorage_Release without
* calling IStream_Release first. If we grab a reference the
#include "winreg.h"
#include "wine/wingdi16.h"
+#include "compobj_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(storage);
static const BYTE STORAGE_magic[8] ={0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1};
static const BYTE STORAGE_oldmagic[8] ={0xd0,0xcf,0x11,0xe0,0x0e,0x11,0xfc,0x0d};
-static const char rootEntryName[] = "Root Entry";
+static inline StorageBaseImpl *impl_from_IStorage( IStorage *iface )
+{
+ return CONTAINING_RECORD(iface, StorageBaseImpl, IStorage_iface);
+}
/****************************************************************************
* Storage32InternalImpl definitions.
REFIID riid,
void** ppvObject)
{
- StorageBaseImpl *This = (StorageBaseImpl *)iface;
+ StorageBaseImpl *This = impl_from_IStorage(iface);
- if ( (This==0) || (ppvObject==0) )
+ if (!ppvObject)
return E_INVALIDARG;
*ppvObject = 0;
if (IsEqualGUID(&IID_IUnknown, riid) ||
IsEqualGUID(&IID_IStorage, riid))
{
- *ppvObject = This;
+ *ppvObject = &This->IStorage_iface;
}
else if (IsEqualGUID(&IID_IPropertySetStorage, riid))
{
- *ppvObject = &This->pssVtbl;
+ *ppvObject = &This->IPropertySetStorage_iface;
}
-
- if ((*ppvObject)==0)
+ else
return E_NOINTERFACE;
IStorage_AddRef(iface);
static ULONG WINAPI StorageBaseImpl_AddRef(
IStorage* iface)
{
- StorageBaseImpl *This = (StorageBaseImpl *)iface;
+ StorageBaseImpl *This = impl_from_IStorage(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) AddRef to %d\n", This, ref);
static ULONG WINAPI StorageBaseImpl_Release(
IStorage* iface)
{
- StorageBaseImpl *This = (StorageBaseImpl *)iface;
+ StorageBaseImpl *This = impl_from_IStorage(iface);
ULONG ref = InterlockedDecrement(&This->ref);
DWORD reserved2, /* [in] */
IStream** ppstm) /* [out] */
{
- StorageBaseImpl *This = (StorageBaseImpl *)iface;
+ StorageBaseImpl *This = impl_from_IStorage(iface);
StgStreamImpl* newStream;
DirEntry currentEntry;
DirRef streamEntryRef;
newStream = StgStreamImpl_Construct(This, grfMode, streamEntryRef);
- if (newStream!=0)
+ if (newStream)
{
newStream->grfMode = grfMode;
- *ppstm = (IStream*)newStream;
+ *ppstm = &newStream->IStream_iface;
IStream_AddRef(*ppstm);
DWORD reserved, /* [in] */
IStorage** ppstg) /* [out] */
{
- StorageBaseImpl *This = (StorageBaseImpl *)iface;
+ StorageBaseImpl *This = impl_from_IStorage(iface);
StorageInternalImpl* newStorage;
StorageBaseImpl* newTransactedStorage;
DirEntry currentEntry;
iface, debugstr_w(pwcsName), pstgPriority,
grfMode, snbExclude, reserved, ppstg);
- if ( (This==0) || (pwcsName==NULL) || (ppstg==0) )
+ if ((pwcsName==NULL) || (ppstg==0) )
{
res = E_INVALIDARG;
goto end;
goto end;
}
- *ppstg = (IStorage*)newTransactedStorage;
+ *ppstg = &newTransactedStorage->IStorage_iface;
}
else
{
- *ppstg = (IStorage*)newStorage;
+ *ppstg = &newStorage->base.IStorage_iface;
}
list_add_tail(&This->storageHead, &newStorage->ParentListEntry);
DWORD reserved3, /* [in] */
IEnumSTATSTG** ppenum) /* [out] */
{
- StorageBaseImpl *This = (StorageBaseImpl *)iface;
+ StorageBaseImpl *This = impl_from_IStorage(iface);
IEnumSTATSTGImpl* newEnum;
TRACE("(%p, %d, %p, %d, %p)\n",
iface, reserved1, reserved2, reserved3, ppenum);
- if ( (This==0) || (ppenum==0))
+ if (!ppenum)
return E_INVALIDARG;
if (This->reverted)
This,
This->storageDirEntry);
- if (newEnum!=0)
+ if (newEnum)
{
*ppenum = &newEnum->IEnumSTATSTG_iface;
STATSTG* pstatstg, /* [out] */
DWORD grfStatFlag) /* [in] */
{
- StorageBaseImpl *This = (StorageBaseImpl *)iface;
+ StorageBaseImpl *This = impl_from_IStorage(iface);
DirEntry currentEntry;
HRESULT res = STG_E_UNKNOWN;
TRACE("(%p, %p, %x)\n",
iface, pstatstg, grfStatFlag);
- if ( (This==0) || (pstatstg==0))
+ if (!pstatstg)
{
res = E_INVALIDARG;
goto end;
const OLECHAR* pwcsOldName, /* [in] */
const OLECHAR* pwcsNewName) /* [in] */
{
- StorageBaseImpl *This = (StorageBaseImpl *)iface;
+ StorageBaseImpl *This = impl_from_IStorage(iface);
DirEntry currentEntry;
DirRef currentEntryRef;
DWORD reserved2, /* [in] */
IStream** ppstm) /* [out] */
{
- StorageBaseImpl *This = (StorageBaseImpl *)iface;
+ StorageBaseImpl *This = impl_from_IStorage(iface);
StgStreamImpl* newStream;
DirEntry currentEntry, newStreamEntry;
DirRef currentEntryRef, newStreamEntryRef;
*/
newStream = StgStreamImpl_Construct(This, grfMode, newStreamEntryRef);
- if (newStream != 0)
+ if (newStream)
{
- *ppstm = (IStream*)newStream;
-
+ *ppstm = &newStream->IStream_iface;
IStream_AddRef(*ppstm);
}
else
IStorage* iface,
REFCLSID clsid) /* [in] */
{
- StorageBaseImpl *This = (StorageBaseImpl *)iface;
+ StorageBaseImpl *This = impl_from_IStorage(iface);
HRESULT hRes;
DirEntry currentEntry;
DWORD reserved2, /* [in] */
IStorage **ppstg) /* [out] */
{
- StorageBaseImpl* const This=(StorageBaseImpl*)iface;
+ StorageBaseImpl* This = impl_from_IStorage(iface);
DirEntry currentEntry;
DirEntry newEntry;
StorageBaseImpl *base,
DirRef index)
{
- HRESULT hr;
BYTE emptyData[RAW_DIRENTRY_SIZE];
StorageImpl *storage = (StorageImpl*)base;
memset(emptyData, 0, RAW_DIRENTRY_SIZE);
- hr = StorageImpl_WriteRawDirEntry(storage, index, emptyData);
-
- return hr;
+ return StorageImpl_WriteRawDirEntry(storage, index, emptyData);
}
*/
if (hr == S_OK)
{
- pstrChild = (IStream*)StgStreamImpl_Construct(This, STGM_READ|STGM_SHARE_EXCLUSIVE, srcEntry);
- if (pstrChild)
- IStream_AddRef(pstrChild);
+ StgStreamImpl *streamimpl = StgStreamImpl_Construct(This, STGM_READ|STGM_SHARE_EXCLUSIVE, srcEntry);
+
+ if (streamimpl)
+ {
+ pstrChild = &streamimpl->IStream_iface;
+ if (pstrChild)
+ IStream_AddRef(pstrChild);
+ }
else
+ {
+ pstrChild = NULL;
hr = E_OUTOFMEMORY;
+ }
}
if (hr == S_OK)
SNB snbExclude, /* [unique][in] */
IStorage* pstgDest) /* [unique][in] */
{
- StorageBaseImpl* const This=(StorageBaseImpl*)iface;
+ StorageBaseImpl *This = impl_from_IStorage(iface);
BOOL skip_storage = FALSE, skip_stream = FALSE;
int i;
if (pstgDestAncestor->lpVtbl == &TransactedSnapshotImpl_Vtbl)
{
- TransactedSnapshotImpl *impl = (TransactedSnapshotImpl*) pstgDestAncestor;
+ TransactedSnapshotImpl *snapshot = (TransactedSnapshotImpl*) pstgDestAncestor;
- pstgDestAncestor = (IStorage*)impl->transactedParent;
+ pstgDestAncestor = &snapshot->transactedParent->IStorage_iface;
}
else if (pstgDestAncestor->lpVtbl == &Storage32InternalImpl_Vtbl)
{
- StorageInternalImpl *impl = (StorageInternalImpl*) pstgDestAncestor;
+ StorageInternalImpl *internal = (StorageInternalImpl*) pstgDestAncestor;
- pstgDestAncestor = (IStorage*)impl->parentStorage;
+ pstgDestAncestor = &internal->parentStorage->IStorage_iface;
}
else
break;
IStorage* iface,
DWORD grfCommitFlags)/* [in] */
{
- StorageBaseImpl* const base=(StorageBaseImpl*)iface;
+ StorageBaseImpl* This = impl_from_IStorage(iface);
TRACE("(%p %d)\n", iface, grfCommitFlags);
- return StorageBaseImpl_Flush(base);
+ return StorageBaseImpl_Flush(This);
}
/*************************************************************************
IStorage* iface,
const OLECHAR *pwcsName)/* [string][in] */
{
- StorageBaseImpl* const This=(StorageBaseImpl*)iface;
+ StorageBaseImpl *This = impl_from_IStorage(iface);
HRESULT hr = S_OK;
DirEntry entryToDelete;
/*
* Open the storage and enumerate it
*/
- hr = StorageBaseImpl_OpenStorage(
- (IStorage*)parentStorage,
+ hr = IStorage_OpenStorage(
+ &parentStorage->IStorage_iface,
entryDataToDelete.name,
0,
STGM_WRITE | STGM_SHARE_EXCLUSIVE,
size.u.HighPart = 0;
size.u.LowPart = 0;
- hr = StorageBaseImpl_OpenStream((IStorage*)parentStorage,
+ hr = IStorage_OpenStream(&parentStorage->IStorage_iface,
entryDataToDelete.name, NULL, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, &pis);
if (hr!=S_OK)
DirRef parentStorageIndex,
DirRef deletedIndex)
{
- HRESULT hr = S_OK;
DirEntry entryToDelete;
DirEntry parentEntry;
DirRef parentEntryRef;
ULONG typeOfRelation;
+ HRESULT hr;
hr = StorageBaseImpl_ReadDirEntry(This, deletedIndex, &entryToDelete);
DWORD grfStateBits,/* [in] */
DWORD grfMask) /* [in] */
{
- StorageBaseImpl* const This = (StorageBaseImpl*)iface;
+ StorageBaseImpl *This = impl_from_IStorage(iface);
if (This->reverted)
return STG_E_REVERTED;
list_init(&This->base.storageHead);
- This->base.lpVtbl = &Storage32Impl_Vtbl;
- This->base.pssVtbl = &IPropertySetStorage_Vtbl;
+ This->base.IStorage_iface.lpVtbl = &Storage32Impl_Vtbl;
+ This->base.IPropertySetStorage_iface.lpVtbl = &IPropertySetStorage_Vtbl;
This->base.baseVtbl = &StorageImpl_BaseVtbl;
This->base.openFlags = (openFlags & ~STGM_CREATE);
This->base.ref = 1;
*/
if (create)
{
+ static const WCHAR rootentryW[] = {'R','o','o','t',' ','E','n','t','r','y',0};
DirEntry rootEntry;
/*
* Initialize the directory table
*/
memset(&rootEntry, 0, sizeof(rootEntry));
- MultiByteToWideChar( CP_ACP, 0, rootEntryName, -1, rootEntry.name,
- sizeof(rootEntry.name)/sizeof(WCHAR) );
- rootEntry.sizeOfNameString = (strlenW(rootEntry.name)+1) * sizeof(WCHAR);
+ strcpyW(rootEntry.name, rootentryW);
+ rootEntry.sizeOfNameString = sizeof(rootentryW);
rootEntry.stgType = STGTY_ROOT;
- rootEntry.leftChild = DIRENTRY_NULL;
- rootEntry.rightChild = DIRENTRY_NULL;
+ rootEntry.leftChild = DIRENTRY_NULL;
+ rootEntry.rightChild = DIRENTRY_NULL;
rootEntry.dirRootEntry = DIRENTRY_NULL;
rootEntry.startingBlock = BLOCK_END_OF_CHAIN;
- rootEntry.size.u.HighPart = 0;
- rootEntry.size.u.LowPart = 0;
+ rootEntry.size.u.HighPart = 0;
+ rootEntry.size.u.LowPart = 0;
StorageImpl_WriteDirEntry(This, 0, &rootEntry);
}
end:
if (FAILED(hr))
{
- IStorage_Release((IStorage*)This);
+ IStorage_Release(&This->base.IStorage_iface);
*result = NULL;
}
else
IStorage* iface,
DWORD grfCommitFlags) /* [in] */
{
- TransactedSnapshotImpl* This = (TransactedSnapshotImpl*) iface;
+ TransactedSnapshotImpl* This = (TransactedSnapshotImpl*)impl_from_IStorage(iface);
TransactedDirEntry *root_entry;
DirRef i, dir_root_ref;
DirEntry data;
static HRESULT WINAPI TransactedSnapshotImpl_Revert(
IStorage* iface)
{
- TransactedSnapshotImpl* This = (TransactedSnapshotImpl*) iface;
+ TransactedSnapshotImpl* This = (TransactedSnapshotImpl*)impl_from_IStorage(iface);
ULARGE_INTEGER zero;
ULONG i;
{
TransactedSnapshotImpl* This = (TransactedSnapshotImpl*) iface;
- TransactedSnapshotImpl_Revert((IStorage*)iface);
-
- IStorage_Release((IStorage*)This->transactedParent);
-
- IStorage_Release((IStorage*)This->scratch);
-
+ IStorage_Revert(&This->base.IStorage_iface);
+ IStorage_Release(&This->transactedParent->IStorage_iface);
+ IStorage_Release(&This->scratch->IStorage_iface);
HeapFree(GetProcessHeap(), 0, This->entries);
-
HeapFree(GetProcessHeap(), 0, This);
}
*result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TransactedSnapshotImpl));
if (*result)
{
- (*result)->base.lpVtbl = &TransactedSnapshotImpl_Vtbl;
+ IStorage *scratch;
- /* This is OK because the property set storage functions use the IStorage functions. */
- (*result)->base.pssVtbl = parentStorage->pssVtbl;
+ (*result)->base.IStorage_iface.lpVtbl = &TransactedSnapshotImpl_Vtbl;
+ /* This is OK because the property set storage functions use the IStorage functions. */
+ (*result)->base.IPropertySetStorage_iface.lpVtbl = parentStorage->IPropertySetStorage_iface.lpVtbl;
(*result)->base.baseVtbl = &TransactedSnapshotImpl_BaseVtbl;
list_init(&(*result)->base.strmHead);
/* Create a new temporary storage to act as the scratch file. */
hr = StgCreateDocfile(NULL, STGM_READWRITE|STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_DELETEONRELEASE,
- 0, (IStorage**)&(*result)->scratch);
+ 0, &scratch);
+ (*result)->scratch = impl_from_IStorage(scratch);
if (SUCCEEDED(hr))
{
ULONG num_entries = 20;
(*result)->entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TransactedDirEntry) * num_entries);
-
(*result)->entries_size = num_entries;
-
(*result)->firstFreeEntry = 0;
if ((*result)->entries)
}
else
{
- IStorage_Release((IStorage*)(*result)->scratch);
+ IStorage_Release(scratch);
hr = E_OUTOFMEMORY;
}
{
hr = Storage_ConstructTransacted(&newStorage->base, &newTransactedStorage);
if (FAILED(hr))
- IStorage_Release((IStorage*)newStorage);
+ IStorage_Release(&newStorage->base.IStorage_iface);
else
*result = newTransactedStorage;
}
IStorage* iface,
DWORD grfCommitFlags) /* [in] */
{
- StorageBaseImpl* base = (StorageBaseImpl*) iface;
+ StorageBaseImpl* This = impl_from_IStorage(iface);
TRACE("(%p,%x)\n", iface, grfCommitFlags);
- return StorageBaseImpl_Flush(base);
+ return StorageBaseImpl_Flush(This);
}
/******************************************************************************
static void IEnumSTATSTGImpl_Destroy(IEnumSTATSTGImpl* This)
{
- IStorage_Release((IStorage*)This->parentStorage);
+ IStorage_Release(&This->parentStorage->IStorage_iface);
HeapFree(GetProcessHeap(), 0, This);
}
* enumeration out-lives the storage in the client application.
*/
newEnumeration->parentStorage = parentStorage;
- IStorage_AddRef((IStorage*)newEnumeration->parentStorage);
+ IStorage_AddRef(&newEnumeration->parentStorage->IStorage_iface);
newEnumeration->storageDirEntry = storageDirEntry;
/*
* Initialize the virtual function table.
*/
- newStorage->base.lpVtbl = &Storage32InternalImpl_Vtbl;
- newStorage->base.pssVtbl = &IPropertySetStorage_Vtbl;
+ newStorage->base.IStorage_iface.lpVtbl = &Storage32InternalImpl_Vtbl;
+ newStorage->base.IPropertySetStorage_iface.lpVtbl = &IPropertySetStorage_Vtbl;
newStorage->base.baseVtbl = &StorageInternalImpl_BaseVtbl;
newStorage->base.openFlags = (openFlags & ~STGM_CREATE);
goto end;
}
- hr = IStorage_QueryInterface((IStorage*)newStorage, riid, ppstgOpen);
-
- IStorage_Release((IStorage*)newStorage);
+ hr = IStorage_QueryInterface(&newStorage->IStorage_iface, riid, ppstgOpen);
+ IStorage_Release(&newStorage->IStorage_iface);
end:
TRACE("<-- %p r = %08x\n", *ppstgOpen, hr);
* StgCreatePropSetStg [OLE32.@]
*/
HRESULT WINAPI StgCreatePropSetStg(IStorage *pstg, DWORD reserved,
- IPropertySetStorage **ppPropSetStg)
+ IPropertySetStorage **propset)
{
- HRESULT hr;
-
- TRACE("(%p, 0x%x, %p)\n", pstg, reserved, ppPropSetStg);
+ TRACE("(%p, 0x%x, %p)\n", pstg, reserved, propset);
if (reserved)
- hr = STG_E_INVALIDPARAMETER;
- else
- hr = StorageBaseImpl_QueryInterface(pstg, &IID_IPropertySetStorage,
- (void**)ppPropSetStg);
- return hr;
+ return STG_E_INVALIDPARAMETER;
+
+ return IStorage_QueryInterface(pstg, &IID_IPropertySetStorage, (void**)propset);
}
/******************************************************************************
goto end;
}
- /*
- * Get an "out" pointer for the caller.
- */
- *ppstgOpen = (IStorage*)newStorage;
+ *ppstgOpen = &newStorage->IStorage_iface;
end:
TRACE("<-- %08x, IStorage %p\n", hr, ppstgOpen ? *ppstgOpen : NULL);
return hr;
}
- /*
- * Get an "out" pointer for the caller.
- */
- *ppstgOpen = (IStorage*)newStorage;
+ *ppstgOpen = &newStorage->IStorage_iface;
return hr;
}
return hr;
}
- /*
- * Get an "out" pointer for the caller.
- */
- *ppstgOpen = (IStorage*)newStorage;
+ *ppstgOpen = &newStorage->IStorage_iface;
return hr;
}
*/
HRESULT WINAPI WriteClassStg(IStorage* pStg, REFCLSID rclsid)
{
- HRESULT hRes;
-
if(!pStg)
return E_INVALIDARG;
if(!rclsid)
return STG_E_INVALIDPOINTER;
- hRes = IStorage_SetClass(pStg, rclsid);
-
- return hRes;
+ return IStorage_SetClass(pStg, rclsid);
}
/***********************************************************************
}
/*************************************************************************
- * OLECONVERT_CreateOleStream [Internal]
+ * STORAGE_CreateOleStream [Internal]
*
* Creates the "\001OLE" stream in the IStorage if necessary.
*
* PARAMS
- * pStorage [I] Dest storage to create the stream in
+ * storage [I] Dest storage to create the stream in
+ * flags [I] flags to be set for newly created stream
*
* RETURNS
- * Nothing
+ * HRESULT return value
*
* NOTES
- * This function is used by OleConvertOLESTREAMToIStorage only.
*
* This stream is still unknown, MS Word seems to have extra data
* but since the data is stored in the OLESTREAM there should be
* deleted it will create it with this default data.
*
*/
-void OLECONVERT_CreateOleStream(LPSTORAGE pStorage)
+HRESULT STORAGE_CreateOleStream(IStorage *storage, DWORD flags)
{
- HRESULT hRes;
- IStream *pStream;
- static const WCHAR wstrStreamName[] = {1,'O', 'l', 'e', 0};
- BYTE pOleStreamHeader [] =
+ static const WCHAR stream_1oleW[] = {1,'O','l','e',0};
+ static const DWORD version_magic = 0x02000001;
+ IStream *stream;
+ HRESULT hr;
+
+ hr = IStorage_CreateStream(storage, stream_1oleW, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stream);
+ if (hr == S_OK)
{
- 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00
- };
+ struct empty_1ole_stream {
+ DWORD version_magic;
+ DWORD flags;
+ DWORD update_options;
+ DWORD reserved;
+ DWORD mon_stream_size;
+ };
+ struct empty_1ole_stream stream_data;
- /* Create stream if not present */
- hRes = IStorage_CreateStream(pStorage, wstrStreamName,
- STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream );
+ stream_data.version_magic = version_magic;
+ stream_data.flags = flags;
+ stream_data.update_options = 0;
+ stream_data.reserved = 0;
+ stream_data.mon_stream_size = 0;
- if(hRes == S_OK)
- {
- /* Write default Data */
- hRes = IStream_Write(pStream, pOleStreamHeader, sizeof(pOleStreamHeader), NULL);
- IStream_Release(pStream);
+ hr = IStream_Write(stream, &stream_data, sizeof(stream_data), NULL);
+ IStream_Release(stream);
}
+
+ return hr;
}
/* write a string to a stream, preceded by its length */
/* ok, success... now we just need to store what we found */
if( pcf )
*pcf = RegisterClipboardFormatW( szOleTypeName );
- CoTaskMemFree( szOleTypeName );
if( lplpszUserType )
+ {
*lplpszUserType = szCLSIDName;
- CoTaskMemFree( szProgIDName );
+ szCLSIDName = NULL;
+ }
end:
+ CoTaskMemFree( szCLSIDName );
+ CoTaskMemFree( szOleTypeName );
+ CoTaskMemFree( szProgIDName );
IStream_Release( stm );
return r;
HKEY hKey;
LONG hErr;
/* Get the CLSID Default Name from the Registry */
- hErr = RegOpenKeyA(HKEY_CLASSES_ROOT, IStorageCompObj.strProgIDName, &hKey);
+ hErr = open_classes_key(HKEY_CLASSES_ROOT, bufferW, MAXIMUM_ALLOWED, &hKey);
if(hErr == ERROR_SUCCESS)
{
char strTemp[OLESTREAM_MAX_STR_LEN];
if(hRes == S_OK)
{
*dwSize = WideCharToMultiByte(CP_ACP, 0, wstrProgID, -1, strProgID, *dwSize, NULL, FALSE);
+ CoTaskMemFree(wstrProgID);
}
}
if(hRes == S_OK)
{
/*Create the Ole Stream if necessary */
- OLECONVERT_CreateOleStream(pstg);
+ STORAGE_CreateOleStream(pstg, 0);
}
}
return hRes;
}
+enum stream_1ole_flags {
+ OleStream_LinkedObject = 0x00000001,
+ OleStream_Convert = 0x00000004
+};
+
/***********************************************************************
* GetConvertStg (OLE32.@)
*/
-HRESULT WINAPI GetConvertStg(IStorage *stg) {
- FIXME("unimplemented stub!\n");
- return E_FAIL;
+HRESULT WINAPI GetConvertStg(IStorage *stg)
+{
+ static const WCHAR stream_1oleW[] = {1,'O','l','e',0};
+ static const DWORD version_magic = 0x02000001;
+ DWORD header[2];
+ IStream *stream;
+ HRESULT hr;
+
+ TRACE("%p\n", stg);
+
+ if (!stg) return E_INVALIDARG;
+
+ hr = IStorage_OpenStream(stg, stream_1oleW, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream);
+ if (FAILED(hr)) return hr;
+
+ hr = IStream_Read(stream, header, sizeof(header), NULL);
+ IStream_Release(stream);
+ if (FAILED(hr)) return hr;
+
+ if (header[0] != version_magic)
+ {
+ ERR("got wrong version magic for 1Ole stream, 0x%08x\n", header[0]);
+ return E_FAIL;
+ }
+
+ return header[1] & OleStream_Convert ? S_OK : S_FALSE;
+}
+
+/***********************************************************************
+ * SetConvertStg (OLE32.@)
+ */
+HRESULT WINAPI SetConvertStg(IStorage *storage, BOOL convert)
+{
+ DWORD flags = convert ? OleStream_Convert : 0;
+ HRESULT hr;
+
+ TRACE("(%p, %d)\n", storage, convert);
+
+ hr = STORAGE_CreateOleStream(storage, flags);
+ if (hr == STG_E_FILEALREADYEXISTS)
+ {
+ static const WCHAR stream_1oleW[] = {1,'O','l','e',0};
+ IStream *stream;
+ DWORD header[2];
+
+ hr = IStorage_OpenStream(storage, stream_1oleW, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stream);
+ if (FAILED(hr)) return hr;
+
+ hr = IStream_Read(stream, header, sizeof(header), NULL);
+ if (FAILED(hr))
+ {
+ IStream_Release(stream);
+ return hr;
+ }
+
+ /* update flag if differs */
+ if ((header[1] ^ flags) & OleStream_Convert)
+ {
+ LARGE_INTEGER pos;
+
+ if (header[1] & OleStream_Convert)
+ flags = header[1] & ~OleStream_Convert;
+ else
+ flags = header[1] | OleStream_Convert;
+
+ pos.QuadPart = sizeof(DWORD);
+ hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
+ if (FAILED(hr))
+ {
+ IStream_Release(stream);
+ return hr;
+ }
+
+ hr = IStream_Write(stream, &flags, sizeof(flags), NULL);
+ }
+ IStream_Release(stream);
+ }
+
+ return hr;
}
/******************************************************************************
/* clear the output args */
*pclsid = CLSID_NULL;
- res = IStream_Read(pStm,(void*)pclsid,sizeof(CLSID),&nbByte);
+ res = IStream_Read(pStm, pclsid, sizeof(CLSID), &nbByte);
if (FAILED(res))
return res;
* Ole Convert support
*/
-void OLECONVERT_CreateOleStream(LPSTORAGE pStorage) DECLSPEC_HIDDEN;
+HRESULT STORAGE_CreateOleStream(IStorage*, DWORD) DECLSPEC_HIDDEN;
HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName) DECLSPEC_HIDDEN;
/****************************************************************************
- * Storage32BaseImpl definitions.
+ * StorageBaseImpl definitions.
*
* This structure defines the base information contained in all implementations
- * of IStorage32 contained in this file storage implementation.
+ * of IStorage contained in this file storage implementation.
*
- * In OOP terms, this is the base class for all the IStorage32 implementations
+ * In OOP terms, this is the base class for all the IStorage implementations
* contained in this file.
*/
struct StorageBaseImpl
{
- const IStorageVtbl *lpVtbl; /* Needs to be the first item in the struct
- * since we want to cast this in a Storage32 pointer */
-
- const IPropertySetStorageVtbl *pssVtbl; /* interface for adding a properties stream */
+ IStorage IStorage_iface;
+ IPropertySetStorage IPropertySetStorage_iface; /* interface for adding a properties stream */
+ LONG ref;
/*
* Stream tracking list
*/
struct list storageHead;
- /*
- * Reference count of this object
- */
- LONG ref;
-
/*
* TRUE if this object has been invalidated
*/
/****************************************************************************
* StgStreamImpl definitions.
*
- * This class implements the IStream32 interface and represents a stream
+ * This class implements the IStream interface and represents a stream
* located inside a storage object.
*/
struct StgStreamImpl
{
- const IStreamVtbl *lpVtbl; /* Needs to be the first item in the struct
- * since we want to cast this to an IStream pointer */
+ IStream IStream_iface;
+ LONG ref;
/*
* We are an entry in the storage object's stream handler list
*/
-
struct list StrmListEntry;
- /*
- * Reference count
- */
- LONG ref;
-
/*
* Storage that is the parent(owner) of the stream
*/
ULARGE_INTEGER currentPosition;
};
+static inline StgStreamImpl *impl_from_IStream( IStream *iface )
+{
+ return CONTAINING_RECORD(iface, StgStreamImpl, IStream_iface);
+}
+
/*
* Method definition for the StgStreamImpl class.
*/
}
/* registers a new interface stub COM object with the stub manager and returns registration record */
-struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, IUnknown *iptr, REFIID iid, MSHLFLAGS flags)
+struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, IUnknown *iptr, REFIID iid, DWORD dest_context,
+ void *dest_context_data, MSHLFLAGS flags)
{
struct ifstub *stub;
HRESULT hr;
stub = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct ifstub));
if (!stub) return NULL;
- hr = RPC_CreateServerChannel(&stub->chan);
+ hr = RPC_CreateServerChannel(dest_context, dest_context_data, &stub->chan);
if (hr != S_OK)
{
HeapFree(GetProcessHeap(), 0, stub);
RPC_UnregisterInterface(&ifstub->iid);
- if (ifstub->stubbuffer) IUnknown_Release(ifstub->stubbuffer);
+ if (ifstub->stubbuffer) IRpcStubBuffer_Release(ifstub->stubbuffer);
IUnknown_Release(ifstub->iface);
IRpcChannelBuffer_Release(ifstub->chan);
for (i = 0; i < cIids; i++)
{
HRESULT hrobj = marshal_object(apt, &(*ppQIResults)[i].std, &iids[i],
- stubmgr->object, MSHLFLAGS_NORMAL);
+ stubmgr->object, MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
if (hrobj == S_OK)
successful_qis++;
(*ppQIResults)[i].hResult = hrobj;
{
STDOBJREF stdobjref; /* dummy - not used */
/* register it with the stub manager */
- hr = marshal_object(apt, &stdobjref, &IID_IRemUnknown, (IUnknown *)pRemUnknown, MSHLFLAGS_NORMAL|MSHLFLAGSP_REMUNKNOWN);
+ hr = marshal_object(apt, &stdobjref, &IID_IRemUnknown, (IUnknown *)pRemUnknown, MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL|MSHLFLAGSP_REMUNKNOWN);
/* release our reference to the object as the stub manager will manage the life cycle for us */
IRemUnknown_Release(pRemUnknown);
if (hr == S_OK)
}
if (HIWORD(*pFlags) == NDR_LOCAL_DATA_REPRESENTATION)
- return wine_dbg_sprintf("MAKELONG(NDR_LOCAL_REPRESENTATION, %s)", loword);
+ return wine_dbg_sprintf("MAKELONG(%s, NDR_LOCAL_DATA_REPRESENTATION)", loword);
else
- return wine_dbg_sprintf("MAKELONG(0x%04x, %s)", HIWORD(*pFlags), loword);
+ return wine_dbg_sprintf("MAKELONG(%s, 0x%04x)", loword, HIWORD(*pFlags));
}
/******************************************************************************
[case(VT_BYREF|VT_DISPATCH)] IDispatch **ppdispVal;
[case(VT_BYREF|VT_ARRAY)] LPSAFEARRAY *pparray;
[case(VT_BYREF|VT_VARIANT)] PROPVARIANT *pvarVal;
- } DUMMYUNIONNAME;
+ };
};
typedef struct tagPROPVARIANT *LPPROPVARIANT;
[out] IEnumSTATPROPSETSTG **ppenum);
}
+typedef struct SERIALIZEDPROPERTYVALUE {
+ DWORD dwType;
+ BYTE rgb[1];
+} SERIALIZEDPROPERTYVALUE;
cpp_quote("HRESULT WINAPI FreePropVariantArray(ULONG,PROPVARIANT*);")
cpp_quote("HRESULT WINAPI PropVariantClear(PROPVARIANT*);")
reactos/dll/win32/objsel # Synced to Wine-1.5.19
reactos/dll/win32/odbc32 # Out of sync. Depends on port of Linux ODBC.
reactos/dll/win32/odbccp32 # Synced to Wine-1.5.19
-reactos/dll/win32/ole32 # Synced to Wine-1.5.4
+reactos/dll/win32/ole32 # Synced to Wine-1.5.19
reactos/dll/win32/oleacc # Autosync
reactos/dll/win32/oleaut32 # Synced to Wine-1.5.19
reactos/dll/win32/olecli32 # Synced to Wine-1.5.19