Sync to Wine-20050628:

Robert Shearman <rob@codeweavers.com>
- Convert some registry helper functions to use unicode versions of
  CLSID & registry functions (untested).
- Add registry entries for local-only OLE interfaces.
- Change IUnknown to local interface.
- IUnknown isn't a remotable interface so the stub manager shouldn't
  need a marshaller for it.
- Change the RPC code to use the unicode versions of the CLSID &
  registry functions.
- Don't disconnect proxies flagged with SORFP_NOLIFETIMEMGMT. It makes
  no sense and only causes trouble for proxies that depend on these
  proxies being available.
- Change some of the registry helper functions to use the unicode
  versions of the CLSID & registry functions.
- Reindent CoGetClassObject and output an error message if the class
  isn't registered.
- Add tests for the touched functions.
Dmitry Timoshkov <dmitry@codeweavers.com>
- Make remaining OLE interface vtables const.
Richard Cohen <richard@daijobu.co.uk>
- Base FileMonikerImpl_Save() on XP.
- Correct handling of Unicode strings & multibyte locales.
- More error checking.
- Change ERR to WARN.
- Match Windows quick & dirty estimate for GetSizeMax().
Stefan Huehner <stefan@huehner.org>
- Fix some more -Wstrict-prototypes warnings.
Mike Hearn <mike@navi.cx>
- Add some tracing to the IRemUnknown RpcProxyBuffer implementation.
Eric Pouech <pouech-eric@wanadoo.fr>
- Const correctness fixes.
Richard Cohen <richard@daijobu.co.uk>
- IEnum::Clone shouldn't do a Reset.
Marcus Meissner <marcus@jet.franken.de>
- Removed CLSID_CompositeMoniker (conflicting with static definition).
Alexandre Julliard <julliard@winehq.org>
- Sort entry points alphabetically.

svn path=/trunk/; revision=17036
This commit is contained in:
Gé van Geldorp 2005-08-03 22:31:39 +00:00
parent 9faf200230
commit 7ba677508a
33 changed files with 529 additions and 437 deletions

View file

@ -42,12 +42,12 @@ const CLSID CLSID_AntiMoniker = {
/* AntiMoniker data structure */
typedef struct AntiMonikerImpl{
IMonikerVtbl* lpvtbl1; /* VTable relative to the IMoniker interface.*/
const IMonikerVtbl* lpvtbl1; /* VTable relative to the IMoniker interface.*/
/* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether
* two monikers are equal. That's whay IROTData interface is implemented by monikers.
*/
IROTDataVtbl* lpvtbl2; /* VTable relative to the IROTData interface.*/
const IROTDataVtbl* lpvtbl2; /* VTable relative to the IROTData interface.*/
ULONG ref; /* reference counter for this object */
@ -530,7 +530,7 @@ AntiMonikerROTDataImpl_GetComparaisonData(IROTData* iface, BYTE* pbData,
/********************************************************************************/
/* Virtual function table for the AntiMonikerImpl class which include IPersist,*/
/* IPersistStream and IMoniker functions. */
static IMonikerVtbl VT_AntiMonikerImpl =
static const IMonikerVtbl VT_AntiMonikerImpl =
{
AntiMonikerImpl_QueryInterface,
AntiMonikerImpl_AddRef,
@ -559,7 +559,7 @@ static IMonikerVtbl VT_AntiMonikerImpl =
/********************************************************************************/
/* Virtual function table for the IROTData class. */
static IROTDataVtbl VT_ROTDataImpl =
static const IROTDataVtbl VT_ROTDataImpl =
{
AntiMonikerROTDataImpl_QueryInterface,
AntiMonikerROTDataImpl_AddRef,

View file

@ -50,7 +50,7 @@ typedef struct BindCtxObject{
/* BindCtx data strucrture */
typedef struct BindCtxImpl{
IBindCtxVtbl *lpVtbl; /* VTable relative to the IBindCtx interface.*/
const IBindCtxVtbl *lpVtbl; /* VTable relative to the IBindCtx interface.*/
ULONG ref; /* reference counter for this object */
@ -474,7 +474,7 @@ static HRESULT BindCtxImpl_GetObjectIndex(BindCtxImpl* This,
}
/* Virtual function table for the BindCtx class. */
static IBindCtxVtbl VT_BindCtxImpl =
static const IBindCtxVtbl VT_BindCtxImpl =
{
BindCtxImpl_QueryInterface,
BindCtxImpl_AddRef,

View file

@ -96,7 +96,7 @@ struct OLEClipbrd
/*
* List all interface VTables here
*/
IDataObjectVtbl* lpvtbl1; /* IDataObject VTable */
const IDataObjectVtbl* lpvtbl1; /* IDataObject VTable */
/*
* The hidden OLE clipboard window. This window is used as the bridge between the
@ -135,7 +135,7 @@ typedef struct OLEClipbrd OLEClipbrd;
typedef struct
{
/* IEnumFORMATETC VTable */
IEnumFORMATETCVtbl *lpVtbl;
const IEnumFORMATETCVtbl *lpVtbl;
/* IEnumFORMATETC fields */
UINT posFmt; /* current enumerator position */
@ -250,7 +250,7 @@ static HRESULT WINAPI OLEClipbrd_IEnumFORMATETC_Clone(LPENUMFORMATETC iface, LPE
/*
* Virtual function table for the OLEClipbrd's exposed IDataObject interface
*/
static IDataObjectVtbl OLEClipbrd_IDataObject_VTable =
static const IDataObjectVtbl OLEClipbrd_IDataObject_VTable =
{
OLEClipbrd_IDataObject_QueryInterface,
OLEClipbrd_IDataObject_AddRef,
@ -269,7 +269,7 @@ static IDataObjectVtbl OLEClipbrd_IDataObject_VTable =
/*
* Virtual function table for IEnumFORMATETC interface
*/
static struct IEnumFORMATETCVtbl efvt =
static const IEnumFORMATETCVtbl efvt =
{
OLEClipbrd_IEnumFORMATETC_QueryInterface,
OLEClipbrd_IEnumFORMATETC_AddRef,

View file

@ -76,6 +76,8 @@ typedef LPCSTR LPCOLESTR16;
HINSTANCE OLE32_hInstance = 0; /* FIXME: make static ... */
#define ARRAYSIZE(array) (sizeof(array)/sizeof((array)[0]))
/****************************************************************************
* This section defines variables internal to the COM module.
*
@ -195,7 +197,7 @@ static void COMPOBJ_UninitProcess( void )
UnregisterClassW(wszAptWinClass, OLE32_hInstance);
}
static void COM_TlsDestroy()
static void COM_TlsDestroy(void)
{
struct oletls *info = NtCurrentTeb()->ReservedForOle;
if (info)
@ -981,6 +983,16 @@ INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
return MultiByteToWideChar( CP_ACP, 0, xguid, -1, str, cmax );
}
/* open HKCR\\CLSID\\{string form of clsid} key */
DWORD COM_OpenKeyForCLSID(REFCLSID clsid, REGSAM access, HKEY *key)
{
static const WCHAR wszCLSIDSlash[] = {'C','L','S','I','D','\\',0};
WCHAR path[CHARS_IN_GUID + ARRAYSIZE(wszCLSIDSlash) - 1];
strcpyW(path, wszCLSIDSlash);
StringFromGUID2(clsid, path + strlenW(wszCLSIDSlash), CHARS_IN_GUID);
return RegOpenKeyExW(HKEY_CLASSES_ROOT, path, 0, access, key);
}
/******************************************************************************
* ProgIDFromCLSID [OLE32.@]
*
@ -997,43 +1009,42 @@ INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
*/
HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID)
{
char strCLSID[50], *buf, *buf2;
DWORD buf2len;
HKEY xhkey;
LPMALLOC mllc;
static const WCHAR wszProgID[] = {'P','r','o','g','I','D',0};
HKEY hkey = NULL;
HKEY hkey_clsid;
HRESULT ret = S_OK;
WINE_StringFromCLSID(clsid, strCLSID);
buf = HeapAlloc(GetProcessHeap(), 0, strlen(strCLSID)+14);
sprintf(buf,"CLSID\\%s\\ProgID", strCLSID);
if (RegOpenKeyA(HKEY_CLASSES_ROOT, buf, &xhkey))
if (ERROR_SUCCESS != COM_OpenKeyForCLSID(clsid, KEY_READ, &hkey_clsid))
ret = REGDB_E_CLASSNOTREG;
HeapFree(GetProcessHeap(), 0, buf);
if (ret == S_OK)
{
buf2 = HeapAlloc(GetProcessHeap(), 0, 255);
buf2len = 255;
if (RegQueryValueA(xhkey, NULL, buf2, &buf2len))
if (RegOpenKeyExW(hkey_clsid, wszProgID, 0, KEY_READ, &hkey))
ret = REGDB_E_CLASSNOTREG;
RegCloseKey(hkey_clsid);
}
if (ret == S_OK)
{
DWORD progidlen = 0;
if (RegQueryValueW(hkey, NULL, NULL, &progidlen))
ret = REGDB_E_CLASSNOTREG;
if (ret == S_OK)
{
if (CoGetMalloc(0,&mllc))
ret = E_OUTOFMEMORY;
else
*lplpszProgID = CoTaskMemAlloc(progidlen * sizeof(WCHAR));
if (*lplpszProgID)
{
DWORD len = MultiByteToWideChar( CP_ACP, 0, buf2, -1, NULL, 0 );
*lplpszProgID = IMalloc_Alloc(mllc, len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, buf2, -1, *lplpszProgID, len );
if (RegQueryValueW(hkey, NULL, *lplpszProgID, &progidlen))
ret = REGDB_E_CLASSNOTREG;
}
else
ret = E_OUTOFMEMORY;
}
HeapFree(GetProcessHeap(), 0, buf2);
RegCloseKey(xhkey);
}
RegCloseKey(hkey);
return ret;
}
@ -1089,7 +1100,7 @@ HRESULT WINAPI CLSIDFromProgID16(LPCOLESTR16 progid, LPCLSID riid)
HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid)
{
static const WCHAR clsidW[] = { '\\','C','L','S','I','D',0 };
char buf2[80];
WCHAR buf2[CHARS_IN_GUID];
DWORD buf2len = sizeof(buf2);
HKEY xhkey;
@ -1103,13 +1114,13 @@ HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid)
}
HeapFree(GetProcessHeap(),0,buf);
if (RegQueryValueA(xhkey,NULL,buf2,&buf2len))
if (RegQueryValueW(xhkey,NULL,buf2,&buf2len))
{
RegCloseKey(xhkey);
return CO_E_CLASSSTRING;
}
RegCloseKey(xhkey);
return __CLSIDFromStringA(buf2,riid);
return CLSIDFromString(buf2,riid);
}
@ -1151,46 +1162,41 @@ HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid)
*/
HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
{
char *buf, buf2[40];
DWORD buf2len;
HKEY xhkey;
static const WCHAR wszInterface[] = {'I','n','t','e','r','f','a','c','e','\\',0};
static const WCHAR wszPSC[] = {'\\','P','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2',0};
WCHAR path[ARRAYSIZE(wszInterface) - 1 + CHARS_IN_GUID - 1 + ARRAYSIZE(wszPSC)];
WCHAR value[CHARS_IN_GUID];
DWORD len;
HKEY hkey;
TRACE("() riid=%s, pclsid=%p\n", debugstr_guid(riid), pclsid);
/* Get the input iid as a string */
WINE_StringFromCLSID(riid, buf2);
/* Allocate memory for the registry key we will construct.
(length of iid string plus constant length of static text */
buf = HeapAlloc(GetProcessHeap(), 0, strlen(buf2)+27);
if (buf == NULL)
return E_OUTOFMEMORY;
/* Construct the registry key we want */
sprintf(buf,"Interface\\%s\\ProxyStubClsid32", buf2);
/* Interface\\{string form of riid}\\ProxyStubClsid32 */
strcpyW(path, wszInterface);
StringFromGUID2(riid, path + ARRAYSIZE(wszInterface) - 1, CHARS_IN_GUID);
strcpyW(path + ARRAYSIZE(wszInterface) - 1 + CHARS_IN_GUID - 1, wszPSC);
/* Open the key.. */
if (RegOpenKeyA(HKEY_CLASSES_ROOT, buf, &xhkey))
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, path, 0, KEY_READ, &hkey))
{
WARN("No PSFactoryBuffer object is registered for IID %s\n", debugstr_guid(riid));
HeapFree(GetProcessHeap(),0,buf);
return REGDB_E_IIDNOTREG;
}
HeapFree(GetProcessHeap(),0,buf);
/* ... Once we have the key, query the registry to get the
value of CLSID as a string, and convert it into a
proper CLSID structure to be passed back to the app */
buf2len = sizeof(buf2);
if ( (RegQueryValueA(xhkey,NULL,buf2,&buf2len)) )
len = sizeof(value);
if (ERROR_SUCCESS != RegQueryValueW(hkey, NULL, value, &len))
{
RegCloseKey(xhkey);
RegCloseKey(hkey);
return REGDB_E_IIDNOTREG;
}
RegCloseKey(xhkey);
RegCloseKey(hkey);
/* We have the CLSid we want back from the registry as a string, so
lets convert it into a CLSID structure */
if ( (__CLSIDFromStringA(buf2,pclsid)) != NOERROR)
if (CLSIDFromString(value, pclsid) != NOERROR)
return REGDB_E_IIDNOTREG;
TRACE ("() Returning CLSID=%s\n", debugstr_guid(pclsid));
@ -1528,25 +1534,24 @@ end:
}
/***********************************************************************
* compobj_RegReadPath [internal]
* COM_RegReadPath [internal]
*
* Reads a registry value and expands it when necessary
*/
static HRESULT
compobj_RegReadPath(char * keyname, char * valuename, char * dst, DWORD dstlen)
HRESULT COM_RegReadPath(HKEY hkeyroot, const WCHAR *keyname, const WCHAR *valuename, WCHAR * dst, DWORD dstlen)
{
HRESULT hres;
HKEY key;
DWORD keytype;
char src[MAX_PATH];
DWORD dwLength = dstlen;
WCHAR src[MAX_PATH];
DWORD dwLength = dstlen * sizeof(WCHAR);
if((hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &key)) == ERROR_SUCCESS) {
if( (hres = RegQueryValueExA(key, NULL, NULL, &keytype, (LPBYTE)src, &dwLength)) == ERROR_SUCCESS ) {
if((hres = RegOpenKeyExW(hkeyroot, keyname, 0, KEY_READ, &key)) == ERROR_SUCCESS) {
if( (hres = RegQueryValueExW(key, NULL, NULL, &keytype, (LPBYTE)src, &dwLength)) == ERROR_SUCCESS ) {
if (keytype == REG_EXPAND_SZ) {
if (dstlen <= ExpandEnvironmentStringsA(src, dst, dstlen)) hres = ERROR_MORE_DATA;
if (dstlen <= ExpandEnvironmentStringsW(src, dst, dstlen)) hres = ERROR_MORE_DATA;
} else {
lstrcpynA(dst, src, dstlen);
lstrcpynW(dst, src, dstlen);
}
}
RegCloseKey (key);
@ -1565,16 +1570,10 @@ compobj_RegReadPath(char * keyname, char * valuename, char * dst, DWORD dstlen)
*/
HRESULT WINAPI CoGetClassObject(
REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo,
REFIID iid, LPVOID *ppv
) {
REFIID iid, LPVOID *ppv)
{
LPUNKNOWN regClassObject;
HRESULT hres = E_UNEXPECTED;
char xclsid[80];
HINSTANCE hLibrary;
typedef HRESULT (CALLBACK *DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv);
DllGetClassObjectFunc DllGetClassObject;
WINE_StringFromCLSID((LPCLSID)rclsid,xclsid);
TRACE("\n\tCLSID:\t%s,\n\tIID:\t%s\n", debugstr_guid(rclsid), debugstr_guid(iid));
@ -1589,9 +1588,7 @@ HRESULT WINAPI CoGetClassObject(
*/
if (S_OK == COM_GetRegisteredClassObject(rclsid, dwClsContext, &regClassObject))
{
/*
* Get the required interface from the retrieved pointer.
*/
/* Get the required interface from the retrieved pointer. */
hres = IUnknown_QueryInterface(regClassObject, iid, ppv);
/*
@ -1605,32 +1602,49 @@ HRESULT WINAPI CoGetClassObject(
}
/* first try: in-process */
if ((CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER) & dwClsContext) {
char keyname[MAX_PATH];
char dllpath[MAX_PATH+1];
if ((CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER) & dwClsContext)
{
static const WCHAR wszInprocServer32[] = {'I','n','p','r','o','c','S','e','r','v','e','r','3','2',0};
HINSTANCE hLibrary;
typedef HRESULT (CALLBACK *DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv);
DllGetClassObjectFunc DllGetClassObject;
WCHAR dllpath[MAX_PATH+1];
HKEY hkey;
sprintf(keyname,"CLSID\\%s\\InprocServer32",xclsid);
if ( compobj_RegReadPath(keyname, NULL, dllpath, sizeof(dllpath)) != ERROR_SUCCESS) {
/* failure: CLSID is not found in registry */
WARN("class %s not registered inproc\n", xclsid);
if (ERROR_SUCCESS != COM_OpenKeyForCLSID(rclsid, KEY_READ, &hkey))
{
ERR("class %s not registered\n", debugstr_guid(rclsid));
hres = REGDB_E_CLASSNOTREG;
} else {
if ((hLibrary = LoadLibraryExA(dllpath, 0, LOAD_WITH_ALTERED_SEARCH_PATH)) == 0) {
/* failure: DLL could not be loaded */
ERR("couldn't load InprocServer32 dll %s\n", dllpath);
hres = E_ACCESSDENIED; /* FIXME: or should this be CO_E_DLLNOTFOUND? */
} else if (!(DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject"))) {
/* failure: the dll did not export DllGetClassObject */
ERR("couldn't find function DllGetClassObject in %s\n", dllpath);
FreeLibrary( hLibrary );
hres = CO_E_DLLNOTFOUND;
} else {
/* OK: get the ClassObject */
COMPOBJ_DLLList_Add( hLibrary );
return DllGetClassObject(rclsid, iid, ppv);
}
}
}
if (COM_RegReadPath(hkey, wszInprocServer32, NULL, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS)
{
/* failure: CLSID is not found in registry */
WARN("class %s not registered inproc\n", debugstr_guid(rclsid));
hres = REGDB_E_CLASSNOTREG;
}
else
{
if ((hLibrary = LoadLibraryExW(dllpath, 0, LOAD_WITH_ALTERED_SEARCH_PATH)) == 0)
{
/* failure: DLL could not be loaded */
ERR("couldn't load InprocServer32 dll %s\n", debugstr_w(dllpath));
hres = E_ACCESSDENIED; /* FIXME: or should this be CO_E_DLLNOTFOUND? */
}
else if (!(DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject")))
{
/* failure: the dll did not export DllGetClassObject */
ERR("couldn't find function DllGetClassObject in %s\n", debugstr_w(dllpath));
FreeLibrary( hLibrary );
hres = CO_E_DLLNOTFOUND;
}
else
{
/* OK: get the ClassObject */
COMPOBJ_DLLList_Add( hLibrary );
return DllGetClassObject(rclsid, iid, ppv);
}
}
}
/* Next try out of process */
@ -2154,28 +2168,27 @@ HRESULT WINAPI CoSetState(IUnknown * pv)
*/
HRESULT WINAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew)
{
HKEY hkey = 0;
char buf[200];
WCHAR wbuf[200];
static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0};
HKEY hkey = NULL;
WCHAR buf[CHARS_IN_GUID];
DWORD len;
HRESULT res = S_OK;
sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]);
if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey))
if (ERROR_SUCCESS != COM_OpenKeyForCLSID(clsidOld, KEY_READ, &hkey))
{
res = REGDB_E_CLASSNOTREG;
goto done;
goto done;
}
len = 200;
len = sizeof(buf);
/* we can just query for the default value of AutoConvertTo key like that,
without opening the AutoConvertTo key and querying for NULL (default) */
if (RegQueryValueA(hkey,"AutoConvertTo",buf,&len))
if (RegQueryValueW(hkey, wszAutoConvertTo, buf, &len))
{
res = REGDB_E_KEYMISSING;
goto done;
goto done;
}
MultiByteToWideChar( CP_ACP, 0, buf, -1, wbuf, sizeof(wbuf)/sizeof(WCHAR) );
CLSIDFromString(wbuf,pClsidNew);
res = CLSIDFromString(buf, pClsidNew);
done:
if (hkey) RegCloseKey(hkey);
return res;
@ -2199,27 +2212,26 @@ done:
*/
HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
{
HKEY hkey = 0;
char buf[47];
char szClsidNew[39];
static const WCHAR wszAutoTreatAs[] = {'A','u','t','o','T','r','e','a','t','A','s',0};
static const WCHAR wszTreatAs[] = {'T','r','e','a','t','A','s',0};
HKEY hkey = NULL;
WCHAR szClsidNew[CHARS_IN_GUID];
HRESULT res = S_OK;
char auto_treat_as[39];
WCHAR auto_treat_as[CHARS_IN_GUID];
LONG auto_treat_as_size = sizeof(auto_treat_as);
CLSID id;
sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]);
WINE_StringFromCLSID(clsidNew, szClsidNew);
if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey))
if (ERROR_SUCCESS != COM_OpenKeyForCLSID(clsidOld, KEY_READ | KEY_WRITE, &hkey))
{
res = REGDB_E_CLASSNOTREG;
goto done;
}
if (!memcmp( clsidOld, clsidNew, sizeof(*clsidOld) ))
{
if (!RegQueryValueA(hkey, "AutoTreatAs", auto_treat_as, &auto_treat_as_size) &&
!__CLSIDFromStringA(auto_treat_as, &id))
if (!RegQueryValueW(hkey, wszAutoTreatAs, auto_treat_as, &auto_treat_as_size) &&
!CLSIDFromString(auto_treat_as, &id))
{
if (RegSetValueA(hkey, "TreatAs", REG_SZ, auto_treat_as, strlen(auto_treat_as)+1))
if (RegSetValueW(hkey, wszTreatAs, REG_SZ, auto_treat_as, sizeof(auto_treat_as)))
{
res = REGDB_E_WRITEREGDB;
goto done;
@ -2227,13 +2239,14 @@ HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
}
else
{
RegDeleteKeyA(hkey, "TreatAs");
RegDeleteKeyW(hkey, wszTreatAs);
goto done;
}
}
else if (RegSetValueA(hkey, "TreatAs", REG_SZ, szClsidNew, strlen(szClsidNew)+1))
else if (!StringFromGUID2(clsidNew, szClsidNew, ARRAYSIZE(szClsidNew)) &&
!RegSetValueW(hkey, wszTreatAs, REG_SZ, szClsidNew, sizeof(szClsidNew)))
{
res = REGDB_E_WRITEREGDB;
res = REGDB_E_WRITEREGDB;
goto done;
}
@ -2260,32 +2273,31 @@ done:
*/
HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID clsidNew)
{
HKEY hkey = 0;
char buf[200], szClsidNew[200];
static const WCHAR wszTreatAs[] = {'T','r','e','a','t','A','s',0};
HKEY hkey = NULL;
WCHAR szClsidNew[CHARS_IN_GUID];
HRESULT res = S_OK;
LONG len = sizeof(szClsidNew);
FIXME("(%s,%p)\n", debugstr_guid(clsidOld), clsidNew);
sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]);
memcpy(clsidNew,clsidOld,sizeof(CLSID)); /* copy over old value */
if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey))
if (COM_OpenKeyForCLSID(clsidOld, KEY_READ, &hkey))
{
res = REGDB_E_CLASSNOTREG;
goto done;
}
if (RegQueryValueA(hkey, "TreatAs", szClsidNew, &len))
if (RegQueryValueW(hkey, wszTreatAs, szClsidNew, &len))
{
res = S_FALSE;
goto done;
}
res = __CLSIDFromStringA(szClsidNew,clsidNew);
res = CLSIDFromString(szClsidNew,clsidNew);
if (FAILED(res))
FIXME("Failed CLSIDFromStringA(%s), hres %lx?\n",szClsidNew,res);
ERR("Failed CLSIDFromStringA(%s), hres 0x%08lx\n", debugstr_w(szClsidNew), res);
done:
if (hkey) RegCloseKey(hkey);
return res;
}
/******************************************************************************

View file

@ -163,6 +163,7 @@ extern void* StdGlobalInterfaceTableInstance;
extern HRESULT WINE_StringFromCLSID(const CLSID *id,LPSTR idstr);
HRESULT WINAPI __CLSIDFromStringA(LPCSTR idstr, CLSID *id);
DWORD COM_OpenKeyForCLSID(REFCLSID clsid, REGSAM access, HKEY *key);
HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv);
/* Stub Manager */
@ -256,4 +257,6 @@ static inline APARTMENT* COM_CurrentApt(void)
extern HINSTANCE OLE32_hInstance; /* FIXME: make static */
#define CHARS_IN_GUID 39 /* including NULL */
#endif /* __WINE_OLE_COMPOBJ_H */

View file

@ -37,7 +37,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(ole);
const CLSID CLSID_CompositeMoniker = {
static const CLSID CLSID_CompositeMoniker = {
0x309, 0, 0, {0xC0, 0, 0, 0, 0, 0, 0, 0x46}
};
@ -46,13 +46,13 @@ const CLSID CLSID_CompositeMoniker = {
/* CompositeMoniker data structure */
typedef struct CompositeMonikerImpl{
IMonikerVtbl* lpvtbl1; /* VTable relative to the IMoniker interface.*/
const IMonikerVtbl* lpvtbl1; /* VTable relative to the IMoniker interface.*/
/* The ROT (RunningObjectTable implementation) uses the IROTData
* interface to test whether two monikers are equal. That's why IROTData
* interface is implemented by monikers.
*/
IROTDataVtbl* lpvtbl2; /* VTable relative to the IROTData interface.*/
const IROTDataVtbl* lpvtbl2; /* VTable relative to the IROTData interface.*/
ULONG ref; /* reference counter for this object */
@ -68,7 +68,7 @@ typedef struct CompositeMonikerImpl{
/* EnumMoniker data structure */
typedef struct EnumMonikerImpl{
IEnumMonikerVtbl *lpVtbl; /* VTable relative to the IEnumMoniker interface.*/
const IEnumMonikerVtbl *lpVtbl; /* VTable relative to the IEnumMoniker interface.*/
ULONG ref; /* reference counter for this object */
@ -1388,7 +1388,7 @@ EnumMonikerImpl_Clone(IEnumMoniker* iface,IEnumMoniker** ppenum)
/********************************************************************************/
/* Virtual function table for the IROTData class */
static IEnumMonikerVtbl VT_EnumMonikerImpl =
static const IEnumMonikerVtbl VT_EnumMonikerImpl =
{
EnumMonikerImpl_QueryInterface,
EnumMonikerImpl_AddRef,
@ -1453,7 +1453,7 @@ EnumMonikerImpl_CreateEnumMoniker(IMoniker** tabMoniker, ULONG tabSize,
/* Virtual function table for the CompositeMonikerImpl class which includes */
/* IPersist, IPersistStream and IMoniker functions. */
static IMonikerVtbl VT_CompositeMonikerImpl =
static const IMonikerVtbl VT_CompositeMonikerImpl =
{
CompositeMonikerImpl_QueryInterface,
CompositeMonikerImpl_AddRef,
@ -1482,7 +1482,7 @@ static IMonikerVtbl VT_CompositeMonikerImpl =
/********************************************************************************/
/* Virtual function table for the IROTData class. */
static IROTDataVtbl VT_ROTDataImpl =
static const IROTDataVtbl VT_ROTDataImpl =
{
CompositeMonikerROTDataImpl_QueryInterface,
CompositeMonikerROTDataImpl_AddRef,

View file

@ -93,12 +93,12 @@ struct DataCache
/*
* List all interface VTables here
*/
IDataObjectVtbl* lpvtbl1;
IUnknownVtbl* lpvtbl2;
IPersistStorageVtbl* lpvtbl3;
IViewObject2Vtbl* lpvtbl4;
IOleCache2Vtbl* lpvtbl5;
IOleCacheControlVtbl* lpvtbl6;
const IDataObjectVtbl* lpvtbl1;
const IUnknownVtbl* lpvtbl2;
const IPersistStorageVtbl* lpvtbl3;
const IViewObject2Vtbl* lpvtbl4;
const IOleCache2Vtbl* lpvtbl5;
const IOleCacheControlVtbl* lpvtbl6;
/*
* Reference count of this object
@ -1617,14 +1617,14 @@ static HRESULT WINAPI DataCache_OnStop(
/*
* Virtual function tables for the DataCache class.
*/
static IUnknownVtbl DataCache_NDIUnknown_VTable =
static const IUnknownVtbl DataCache_NDIUnknown_VTable =
{
DataCache_NDIUnknown_QueryInterface,
DataCache_NDIUnknown_AddRef,
DataCache_NDIUnknown_Release
};
static IDataObjectVtbl DataCache_IDataObject_VTable =
static const IDataObjectVtbl DataCache_IDataObject_VTable =
{
DataCache_IDataObject_QueryInterface,
DataCache_IDataObject_AddRef,
@ -1640,7 +1640,7 @@ static IDataObjectVtbl DataCache_IDataObject_VTable =
DataCache_EnumDAdvise
};
static IPersistStorageVtbl DataCache_IPersistStorage_VTable =
static const IPersistStorageVtbl DataCache_IPersistStorage_VTable =
{
DataCache_IPersistStorage_QueryInterface,
DataCache_IPersistStorage_AddRef,
@ -1654,7 +1654,7 @@ static IPersistStorageVtbl DataCache_IPersistStorage_VTable =
DataCache_HandsOffStorage
};
static IViewObject2Vtbl DataCache_IViewObject2_VTable =
static const IViewObject2Vtbl DataCache_IViewObject2_VTable =
{
DataCache_IViewObject2_QueryInterface,
DataCache_IViewObject2_AddRef,
@ -1668,7 +1668,7 @@ static IViewObject2Vtbl DataCache_IViewObject2_VTable =
DataCache_GetExtent
};
static IOleCache2Vtbl DataCache_IOleCache2_VTable =
static const IOleCache2Vtbl DataCache_IOleCache2_VTable =
{
DataCache_IOleCache2_QueryInterface,
DataCache_IOleCache2_AddRef,
@ -1682,7 +1682,7 @@ static IOleCache2Vtbl DataCache_IOleCache2_VTable =
DataCache_DiscardCache
};
static IOleCacheControlVtbl DataCache_IOleCacheControl_VTable =
static const IOleCacheControlVtbl DataCache_IOleCacheControl_VTable =
{
DataCache_IOleCacheControl_QueryInterface,
DataCache_IOleCacheControl_AddRef,

View file

@ -70,10 +70,10 @@ struct DefaultHandler
/*
* List all interface VTables here
*/
IOleObjectVtbl* lpvtbl1;
IUnknownVtbl* lpvtbl2;
IDataObjectVtbl* lpvtbl3;
IRunnableObjectVtbl* lpvtbl4;
const IOleObjectVtbl* lpvtbl1;
const IUnknownVtbl* lpvtbl2;
const IDataObjectVtbl* lpvtbl3;
const IRunnableObjectVtbl* lpvtbl4;
/*
* Reference count of this object
@ -325,7 +325,7 @@ static HRESULT WINAPI DefaultHandler_SetContainedObject(
/*
* Virtual function tables for the DefaultHandler class.
*/
static IOleObjectVtbl DefaultHandler_IOleObject_VTable =
static const IOleObjectVtbl DefaultHandler_IOleObject_VTable =
{
DefaultHandler_QueryInterface,
DefaultHandler_AddRef,
@ -353,14 +353,14 @@ static IOleObjectVtbl DefaultHandler_IOleObject_VTable =
DefaultHandler_SetColorScheme
};
static IUnknownVtbl DefaultHandler_NDIUnknown_VTable =
static const IUnknownVtbl DefaultHandler_NDIUnknown_VTable =
{
DefaultHandler_NDIUnknown_QueryInterface,
DefaultHandler_NDIUnknown_AddRef,
DefaultHandler_NDIUnknown_Release,
};
static IDataObjectVtbl DefaultHandler_IDataObject_VTable =
static const IDataObjectVtbl DefaultHandler_IDataObject_VTable =
{
DefaultHandler_IDataObject_QueryInterface,
DefaultHandler_IDataObject_AddRef,
@ -376,7 +376,7 @@ static IDataObjectVtbl DefaultHandler_IDataObject_VTable =
DefaultHandler_EnumDAdvise
};
static IRunnableObjectVtbl DefaultHandler_IRunnableObject_VTable =
static const IRunnableObjectVtbl DefaultHandler_IRunnableObject_VTable =
{
DefaultHandler_IRunnableObject_QueryInterface,
DefaultHandler_IRunnableObject_AddRef,

View file

@ -128,9 +128,9 @@ static VOID WINAPI ERRORINFO_SysFreeString(BSTR in)
typedef struct ErrorInfoImpl
{
IErrorInfoVtbl *lpvtei;
ICreateErrorInfoVtbl *lpvtcei;
ISupportErrorInfoVtbl *lpvtsei;
const IErrorInfoVtbl *lpvtei;
const ICreateErrorInfoVtbl *lpvtcei;
const ISupportErrorInfoVtbl *lpvtsei;
DWORD ref;
GUID m_Guid;
@ -140,9 +140,9 @@ typedef struct ErrorInfoImpl
DWORD m_dwHelpContext;
} ErrorInfoImpl;
static IErrorInfoVtbl IErrorInfoImpl_VTable;
static ICreateErrorInfoVtbl ICreateErrorInfoImpl_VTable;
static ISupportErrorInfoVtbl ISupportErrorInfoImpl_VTable;
static const IErrorInfoVtbl IErrorInfoImpl_VTable;
static const ICreateErrorInfoVtbl ICreateErrorInfoImpl_VTable;
static const ISupportErrorInfoVtbl ISupportErrorInfoImpl_VTable;
/*
converts an object pointer to This
@ -303,7 +303,7 @@ static HRESULT WINAPI IErrorInfoImpl_GetHelpContext(
return S_OK;
}
static IErrorInfoVtbl IErrorInfoImpl_VTable =
static const IErrorInfoVtbl IErrorInfoImpl_VTable =
{
IErrorInfoImpl_QueryInterface,
IErrorInfoImpl_AddRef,
@ -402,7 +402,7 @@ static HRESULT WINAPI ICreateErrorInfoImpl_SetHelpContext(
return S_OK;
}
static ICreateErrorInfoVtbl ICreateErrorInfoImpl_VTable =
static const ICreateErrorInfoVtbl ICreateErrorInfoImpl_VTable =
{
ICreateErrorInfoImpl_QueryInterface,
ICreateErrorInfoImpl_AddRef,
@ -452,7 +452,7 @@ static HRESULT WINAPI ISupportErrorInfoImpl_InterfaceSupportsErrorInfo(
return (IsEqualIID(riid, &This->m_Guid)) ? S_OK : S_FALSE;
}
static ISupportErrorInfoVtbl ISupportErrorInfoImpl_VTable =
static const ISupportErrorInfoVtbl ISupportErrorInfoImpl_VTable =
{
ISupportErrorInfoImpl_QueryInterface,
ISupportErrorInfoImpl_AddRef,

View file

@ -46,12 +46,12 @@ const CLSID CLSID_FileMoniker = {
/* filemoniker data structure */
typedef struct FileMonikerImpl{
IMonikerVtbl* lpvtbl1; /* VTable relative to the IMoniker interface.*/
const IMonikerVtbl* lpvtbl1; /* VTable relative to the IMoniker interface.*/
/* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether
* two monikers are equal. That's whay IROTData interface is implemented by monikers.
*/
IROTDataVtbl* lpvtbl2; /* VTable relative to the IROTData interface.*/
const IROTDataVtbl* lpvtbl2; /* VTable relative to the IROTData interface.*/
ULONG ref; /* reference counter for this object */
@ -182,121 +182,155 @@ FileMonikerImpl_IsDirty(IMoniker* iface)
* written by FileMonikerImpl_Save
*/
static HRESULT WINAPI
FileMonikerImpl_Load(IMoniker* iface,IStream* pStm)
FileMonikerImpl_Load(IMoniker* iface, IStream* pStm)
{
HRESULT res;
CHAR* filePathA;
WCHAR* filePathW;
CHAR* filePathA = NULL;
WCHAR* filePathW = NULL;
ULONG bread;
WORD wbuffer;
DWORD dwbuffer,length,i,doubleLenHex,doubleLenDec;
DWORD dwbuffer, bytesA, bytesW, len;
int i;
FileMonikerImpl *This = (FileMonikerImpl *)iface;
TRACE("(%p,%p)\n",iface,pStm);
/* first WORD is non significative */
/* first WORD must be 0 */
res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread);
if (bread!=sizeof(WORD) || wbuffer!=0)
{
ERR("Couldn't read 0 word\n");
return E_FAIL;
WARN("Couldn't read 0 word\n");
goto fail;
}
/* read filePath string length (plus one) */
res=IStream_Read(pStm,&length,sizeof(DWORD),&bread);
res=IStream_Read(pStm,&bytesA,sizeof(DWORD),&bread);
if (bread != sizeof(DWORD))
{
ERR("Couldn't read file string length\n");
return E_FAIL;
WARN("Couldn't read file string length\n");
goto fail;
}
/* read filePath string */
filePathA=HeapAlloc(GetProcessHeap(),0,length);
res=IStream_Read(pStm,filePathA,length,&bread);
HeapFree(GetProcessHeap(),0,filePathA);
if (bread != length)
filePathA=HeapAlloc(GetProcessHeap(),0,bytesA);
if (!filePathA)
{
ERR("Couldn't read file path string\n");
return E_FAIL;
res = E_OUTOFMEMORY;
goto fail;
}
res=IStream_Read(pStm,filePathA,bytesA,&bread);
if (bread != bytesA)
{
WARN("Couldn't read file path string\n");
goto fail;
}
/* read the first constant */
IStream_Read(pStm,&dwbuffer,sizeof(DWORD),&bread);
if (bread != sizeof(DWORD) || dwbuffer != 0xDEADFFFF)
{
ERR("Couldn't read 0xDEADFFFF constant\n");
return E_FAIL;
WARN("Couldn't read 0xDEADFFFF constant\n");
goto fail;
}
length--;
for(i=0;i<10;i++){
res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread);
if (bread!=sizeof(WORD) || wbuffer!=0)
for(i=0;i<5;i++)
{
res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),&bread);
if (bread!=sizeof(DWORD) || dwbuffer!=0)
{
ERR("Couldn't read 0 padding\n");
return E_FAIL;
WARN("Couldn't read 0 padding\n");
goto fail;
}
}
if (length>8)
length=0;
res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),&bread);
if (bread!=sizeof(DWORD))
goto fail;
doubleLenHex=doubleLenDec=2*length;
if (length > 5)
doubleLenDec+=6;
if (!dwbuffer) /* No W-string */
{
bytesA--;
len=MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, filePathA, bytesA, NULL, 0);
if (!len)
goto fail;
filePathW=HeapAlloc(GetProcessHeap(),0,(len+1)*sizeof(WCHAR));
if (!filePathW)
{
res = E_OUTOFMEMORY;
goto fail;
}
MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, filePathA, -1, filePathW, len+1);
goto succeed;
}
if (dwbuffer < 6)
goto fail;
bytesW=dwbuffer - 6;
res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),&bread);
if (bread!=sizeof(DWORD) || dwbuffer!=doubleLenDec)
return E_FAIL;
if (length==0)
return res;
res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),&bread);
if (bread!=sizeof(DWORD) || dwbuffer!=doubleLenHex)
return E_FAIL;
if (bread!=sizeof(DWORD) || dwbuffer!=bytesW)
goto fail;
res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread);
if (bread!=sizeof(WORD) || wbuffer!=0x3)
return E_FAIL;
goto fail;
filePathW=HeapAlloc(GetProcessHeap(),0,(length+1)*sizeof(WCHAR));
filePathW[length]=0;
res=IStream_Read(pStm,filePathW,doubleLenHex,&bread);
if (bread!=doubleLenHex) {
HeapFree(GetProcessHeap(), 0, filePathW);
return E_FAIL;
len=bytesW/sizeof(WCHAR);
filePathW=HeapAlloc(GetProcessHeap(),0,(len+1)*sizeof(WCHAR));
if(!filePathW)
{
res = E_OUTOFMEMORY;
goto fail;
}
res=IStream_Read(pStm,filePathW,bytesW,&bread);
if (bread!=bytesW)
goto fail;
filePathW[len]=0;
succeed:
HeapFree(GetProcessHeap(),0,filePathA);
HeapFree(GetProcessHeap(),0,This->filePathName);
This->filePathName=filePathW;
return S_OK;
fail:
HeapFree(GetProcessHeap(), 0, filePathA);
HeapFree(GetProcessHeap(), 0, filePathW);
if (SUCCEEDED(res))
res = E_FAIL;
return res;
}
/******************************************************************************
* FileMoniker_Save
*
* This function saves data of this object. In the beginning I thougth
* This function saves data of this object. In the beginning I thought
* that I have just to write the filePath string on Stream. But, when I
* tested this function whith windows programs samples, I noticed that it
* was not the case. So I analysed data written by this function on
* Windows and what this did function exactly ! But I have no idea about
* its logic !
* I guessed data which must be written on stream is:
* tested this function with windows programs samples, I noticed that it
* was not the case. This implementation is based on XP SP2. Other versions
* of Windows have minor variations.
*
* Data which must be written on stream is:
* 1) WORD constant:zero
* 2) length of the path string ("\0" included)
* 3) path string type A
* 4) DWORD constant : 0xDEADFFFF
* 5) ten WORD constant: zero
* 6) DWORD: double-length of the the path string type W ("\0" not
* 5) five DWORD constant: zero
* 6) If we're only writing the multibyte version,
* write a zero DWORD and finish.
*
* 7) DWORD: double-length of the the path string type W ("\0" not
* included)
* 7) WORD constant: 0x3
* 8) filePath unicode string.
* if the length(filePath) > 8 or length(filePath) == 8 stop at step 5)
* 8) WORD constant: 0x3
* 9) filePath unicode string.
*
*/
static HRESULT WINAPI
FileMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty)
@ -305,64 +339,92 @@ FileMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty)
HRESULT res;
LPOLESTR filePathW=This->filePathName;
CHAR* filePathA;
DWORD len;
CHAR* filePathA;
DWORD bytesA, bytesW, len;
DWORD constant1 = 0xDEADFFFF; /* these constants are detected after analysing the data structure written by */
WORD constant2 = 0x3; /* FileMoniker_Save function in a windows program system */
static const DWORD DEADFFFF = 0xDEADFFFF; /* Constants */
static const DWORD ZERO = 0;
static const WORD THREE = 0x3;
WORD zero=0;
DWORD doubleLenHex;
DWORD doubleLenDec;
int i=0;
int i;
BOOL bUsedDefault, bWriteWide;
TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty);
if (pStm==NULL)
return E_POINTER;
/* write a DWORD set to 0 : constant */
res=IStream_Write(pStm,&zero,sizeof(WORD),NULL);
/* write a 0 WORD */
res=IStream_Write(pStm,&ZERO,sizeof(WORD),NULL);
if (!SUCCEEDED(res)) return res;
/* write length of filePath string ( "\0" included )*/
len = WideCharToMultiByte( CP_ACP, 0, filePathW, -1, NULL, 0, NULL, NULL );
res=IStream_Write(pStm,&len,sizeof(DWORD),NULL);
/* write length of filePath string ( 0 included )*/
bytesA = WideCharToMultiByte( CP_ACP, 0, filePathW, -1, NULL, 0, NULL, NULL );
res=IStream_Write(pStm,&bytesA,sizeof(DWORD),NULL);
if (!SUCCEEDED(res)) return res;
/* write filePath string type A */
filePathA=HeapAlloc(GetProcessHeap(),0,len);
WideCharToMultiByte( CP_ACP, 0, filePathW, -1, filePathA, len, NULL, NULL );
res=IStream_Write(pStm,filePathA,len,NULL);
/* write A string (with '\0') */
filePathA=HeapAlloc(GetProcessHeap(),0,bytesA);
if (!filePathA)
return E_OUTOFMEMORY;
WideCharToMultiByte( CP_ACP, 0, filePathW, -1, filePathA, bytesA, NULL, &bUsedDefault);
res=IStream_Write(pStm,filePathA,bytesA,NULL);
HeapFree(GetProcessHeap(),0,filePathA);
if (!SUCCEEDED(res)) return res;
/* write a DWORD set to 0xDEADFFFF: constant */
res=IStream_Write(pStm,&constant1,sizeof(DWORD),NULL);
/* write a DWORD 0xDEADFFFF */
res=IStream_Write(pStm,&DEADFFFF,sizeof(DWORD),NULL);
if (!SUCCEEDED(res)) return res;
len--;
/* write 10 times a DWORD set to 0 : constants */
for(i=0;i<10;i++)
res=IStream_Write(pStm,&zero,sizeof(WORD),NULL);
/* write 5 zero DWORDs */
for(i=0;i<5;i++)
{
res=IStream_Write(pStm,&ZERO,sizeof(DWORD),NULL);
if (!SUCCEEDED(res)) return res;
}
if (len>8)
len=0;
/* Write the wide version if:
* + couldn't convert to CP_ACP,
* or + it's a directory,
* or + there's a character > 0xFF
*/
len = lstrlenW(filePathW);
bWriteWide = (bUsedDefault || (len > 0 && filePathW[len-1]=='\\' ));
if (!bWriteWide)
{
WCHAR* pch;
for(pch=filePathW;*pch;++pch)
{
if (*pch > 0xFF)
{
bWriteWide = TRUE;
break;
}
}
}
doubleLenHex=doubleLenDec=2*len;
if (len > 5)
doubleLenDec+=6;
/* write double-length of the path string ( "\0" included )*/
res=IStream_Write(pStm,&doubleLenDec,sizeof(DWORD),NULL);
if (len==0)
if (!bWriteWide)
{
res=IStream_Write(pStm,&ZERO,sizeof(DWORD),NULL);
return res;
}
/* write double-length (hexa representation) of the path string ( "\0" included ) */
res=IStream_Write(pStm,&doubleLenHex,sizeof(DWORD),NULL);
/* write bytes needed for the filepathW (without 0) + 6 */
bytesW = len*sizeof(WCHAR) + 6;
res=IStream_Write(pStm,&bytesW,sizeof(DWORD),NULL);
if (!SUCCEEDED(res)) return res;
/* write a WORD set to 0x3: constant */
res=IStream_Write(pStm,&constant2,sizeof(WORD),NULL);
/* try again, without the extra 6 */
bytesW -= 6;
res=IStream_Write(pStm,&bytesW,sizeof(DWORD),NULL);
if (!SUCCEEDED(res)) return res;
/* write path unicode string */
res=IStream_Write(pStm,filePathW,doubleLenHex,NULL);
/* write a WORD 3 */
res=IStream_Write(pStm,&THREE,sizeof(WORD),NULL);
if (!SUCCEEDED(res)) return res;
/* write W string (no 0) */
res=IStream_Write(pStm,filePathW,bytesW,NULL);
return res;
}
@ -374,32 +436,17 @@ static HRESULT WINAPI
FileMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize)
{
FileMonikerImpl *This = (FileMonikerImpl *)iface;
DWORD len=lstrlenW(This->filePathName);
DWORD sizeMAx;
TRACE("(%p,%p)\n",iface,pcbSize);
if (!pcbSize)
return E_POINTER;
/* for more details see FileMonikerImpl_Save coments */
sizeMAx = sizeof(WORD) + /* first WORD is 0 */
sizeof(DWORD)+ /* length of filePath including "\0" in the end of the string */
(len+1)+ /* filePath string */
sizeof(DWORD)+ /* constant : 0xDEADFFFF */
10*sizeof(WORD)+ /* 10 zero WORD */
sizeof(DWORD); /* size of the unicode filePath: "\0" not included */
if (len==0 || len > 8)
return S_OK;
sizeMAx += sizeof(DWORD)+ /* size of the unicode filePath: "\0" not included */
sizeof(WORD)+ /* constant : 0x3 */
len*sizeof(WCHAR); /* unicde filePath string */
pcbSize->u.LowPart=sizeMAx;
pcbSize->u.HighPart=0;
/* We could calculate exactly (see ...::Save()) but instead
* we'll make a quick over-estimate, like Windows (NT4, XP) does.
*/
pcbSize->u.LowPart = 0x38 + 4 * lstrlenW(This->filePathName);
pcbSize->u.HighPart = 0;
return S_OK;
}
@ -1215,7 +1262,7 @@ FileMonikerROTDataImpl_GetComparisonData(IROTData* iface, BYTE* pbData,
* Virtual function table for the FileMonikerImpl class which include IPersist,
* IPersistStream and IMoniker functions.
*/
static IMonikerVtbl VT_FileMonikerImpl =
static const IMonikerVtbl VT_FileMonikerImpl =
{
FileMonikerImpl_QueryInterface,
FileMonikerImpl_AddRef,
@ -1243,7 +1290,7 @@ static IMonikerVtbl VT_FileMonikerImpl =
};
/* Virtual function table for the IROTData class. */
static IROTDataVtbl VT_ROTDataImpl =
static const IROTDataVtbl VT_ROTDataImpl =
{
FileMonikerROTDataImpl_QueryInterface,
FileMonikerROTDataImpl_AddRef,

View file

@ -37,9 +37,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(ole);
typedef struct _FTMarshalImpl {
IUnknownVtbl *lpVtbl;
const IUnknownVtbl *lpVtbl;
DWORD ref;
IMarshalVtbl *lpvtblFTM;
const IMarshalVtbl *lpvtblFTM;
IUnknown *pUnkOuter;
} FTMarshalImpl;
@ -93,7 +93,7 @@ static ULONG WINAPI IiFTMUnknown_fnRelease (IUnknown * iface)
return 0;
}
static IUnknownVtbl iunkvt =
static const IUnknownVtbl iunkvt =
{
IiFTMUnknown_fnQueryInterface,
IiFTMUnknown_fnAddRef,
@ -208,7 +208,7 @@ static HRESULT WINAPI FTMarshalImpl_DisconnectObject (LPMARSHAL iface, DWORD dwR
return S_OK;
}
static IMarshalVtbl ftmvtbl =
static const IMarshalVtbl ftmvtbl =
{
FTMarshalImpl_QueryInterface,
FTMarshalImpl_AddRef,

View file

@ -72,7 +72,7 @@ typedef struct StdGITEntry
/* Class data */
typedef struct StdGlobalInterfaceTableImpl
{
IGlobalInterfaceTableVtbl *lpVtbl;
const IGlobalInterfaceTableVtbl *lpVtbl;
ULONG ref;
struct StdGITEntry* firstEntry;
@ -360,7 +360,7 @@ static HRESULT WINAPI GITCF_LockServer(LPCLASSFACTORY iface, BOOL fLock)
return S_OK;
}
static IClassFactoryVtbl GITClassFactoryVtbl = {
static const IClassFactoryVtbl GITClassFactoryVtbl = {
GITCF_QueryInterface,
GITCF_AddRef,
GITCF_Release,
@ -368,7 +368,7 @@ static IClassFactoryVtbl GITClassFactoryVtbl = {
GITCF_LockServer
};
static IClassFactoryVtbl *PGITClassFactoryVtbl = &GITClassFactoryVtbl;
static const IClassFactoryVtbl *PGITClassFactoryVtbl = &GITClassFactoryVtbl;
HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv)
{
@ -378,7 +378,7 @@ HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv)
}
/* Virtual function table */
static IGlobalInterfaceTableVtbl StdGlobalInterfaceTableImpl_Vtbl =
static const IGlobalInterfaceTableVtbl StdGlobalInterfaceTableImpl_Vtbl =
{
StdGlobalInterfaceTable_QueryInterface,
StdGlobalInterfaceTable_AddRef,

View file

@ -54,7 +54,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(storage);
*/
struct HGLOBALStreamImpl
{
IStreamVtbl *lpVtbl; /* Needs to be the first item in the struct
const IStreamVtbl *lpVtbl; /* Needs to be the first item in the struct
* since we want to cast this in an IStream pointer */
/*
@ -629,7 +629,7 @@ static HRESULT WINAPI HGLOBALStreamImpl_Clone(
/*
* Virtual function table for the HGLOBALStreamImpl class.
*/
static IStreamVtbl HGLOBALStreamImpl_Vtbl =
static const IStreamVtbl HGLOBALStreamImpl_Vtbl =
{
HGLOBALStreamImpl_QueryInterface,
HGLOBALStreamImpl_AddRef,

View file

@ -47,10 +47,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(olemalloc);
*
*****************************************************************************/
/* set the vtable later */
static IMallocVtbl VT_IMalloc32;
static const IMallocVtbl VT_IMalloc32;
typedef struct {
IMallocVtbl *lpVtbl;
const IMallocVtbl *lpVtbl;
DWORD dummy; /* nothing, we are static */
IMallocSpy * pSpy; /* the spy when active */
DWORD SpyedAllocationsLeft; /* number of spyed allocations left */
@ -60,7 +60,7 @@ typedef struct {
} _Malloc32;
/* this is the static object instance */
_Malloc32 Malloc32 = {&VT_IMalloc32, 0, NULL, 0, 0, NULL, 0};
static _Malloc32 Malloc32 = {&VT_IMalloc32, 0, NULL, 0, 0, NULL, 0};
/* with a spy active all calls from pre to post methods are threadsave */
static CRITICAL_SECTION IMalloc32_SpyCS;
@ -344,7 +344,7 @@ static VOID WINAPI IMalloc_fnHeapMinimize(LPMALLOC iface) {
}
}
static IMallocVtbl VT_IMalloc32 =
static const IMallocVtbl VT_IMalloc32 =
{
IMalloc_fnQueryInterface,
IMalloc_fnAddRefRelease,
@ -362,15 +362,15 @@ static IMallocVtbl VT_IMalloc32 =
*****************************************************************************/
/* set the vtable later */
static IMallocSpyVtbl VT_IMallocSpy;
static const IMallocSpyVtbl VT_IMallocSpy;
typedef struct {
IMallocSpyVtbl *lpVtbl;
const IMallocSpyVtbl *lpVtbl;
DWORD ref;
} _MallocSpy;
/* this is the static object instance */
_MallocSpy MallocSpy = {&VT_IMallocSpy, 0};
static _MallocSpy MallocSpy = {&VT_IMallocSpy, 0};
/******************************************************************************
* IMalloc32_QueryInterface [VTABLE]
@ -501,11 +501,11 @@ static void WINAPI IMallocSpy_fnPostHeapMinimize(LPMALLOCSPY iface)
TRACE ("(%p)->()\n", This);
}
static void MallocSpyDumpLeaks() {
static void MallocSpyDumpLeaks(void) {
TRACE("leaks: %lu\n", Malloc32.SpyedAllocationsLeft);
}
static IMallocSpyVtbl VT_IMallocSpy =
static const IMallocSpyVtbl VT_IMallocSpy =
{
IMallocSpy_fnQueryInterface,
IMallocSpy_fnAddRef,

View file

@ -45,12 +45,12 @@ const CLSID CLSID_ItemMoniker = {
/* ItemMoniker data structure */
typedef struct ItemMonikerImpl{
IMonikerVtbl* lpvtbl1; /* VTable relative to the IMoniker interface.*/
const IMonikerVtbl* lpvtbl1; /* VTable relative to the IMoniker interface.*/
/* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether
* two monikers are equal. That's whay IROTData interface is implemented by monikers.
*/
IROTDataVtbl* lpvtbl2; /* VTable relative to the IROTData interface.*/
const IROTDataVtbl* lpvtbl2; /* VTable relative to the IROTData interface.*/
ULONG ref; /* reference counter for this object */
@ -113,7 +113,7 @@ static HRESULT WINAPI ItemMonikerROTDataImpl_GetComparisonData(IROTData* iface,B
/********************************************************************************/
/* Virtual function table for the ItemMonikerImpl class which include IPersist,*/
/* IPersistStream and IMoniker functions. */
static IMonikerVtbl VT_ItemMonikerImpl =
static const IMonikerVtbl VT_ItemMonikerImpl =
{
ItemMonikerImpl_QueryInterface,
ItemMonikerImpl_AddRef,
@ -142,7 +142,7 @@ static IMonikerVtbl VT_ItemMonikerImpl =
/********************************************************************************/
/* Virtual function table for the IROTData class. */
static IROTDataVtbl VT_ROTDataImpl =
static const IROTDataVtbl VT_ROTDataImpl =
{
ItemMonikerROTDataImpl_QueryInterface,
ItemMonikerROTDataImpl_AddRef,

View file

@ -90,28 +90,36 @@ HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnkno
struct stub_manager *manager;
struct ifstub *ifstub;
BOOL tablemarshal;
IRpcStubBuffer *stub;
IPSFactoryBuffer *psfb;
IRpcStubBuffer *stub = NULL;
HRESULT hr;
hr = apartment_getoxid(apt, &stdobjref->oxid);
if (hr != S_OK)
return hr;
hr = get_facbuf_for_iid(riid, &psfb);
if (hr != S_OK)
/* IUnknown doesn't require a stub buffer, because it never goes out on
* the wire */
if (!IsEqualIID(riid, &IID_IUnknown))
{
ERR("couldn't get IPSFactory buffer for interface %s\n", debugstr_guid(riid));
return hr;
}
IPSFactoryBuffer *psfb;
hr = IPSFactoryBuffer_CreateStub(psfb, riid, obj, &stub);
IPSFactoryBuffer_Release(psfb);
if (hr != S_OK)
{
ERR("Failed to create an IRpcStubBuffer from IPSFactory for %s\n", debugstr_guid(riid));
return hr;
hr = get_facbuf_for_iid(riid, &psfb);
if (hr != S_OK)
{
ERR("couldn't get IPSFactory buffer for interface %s\n", debugstr_guid(riid));
return hr;
}
hr = IPSFactoryBuffer_CreateStub(psfb, riid, obj, &stub);
IPSFactoryBuffer_Release(psfb);
if (hr != S_OK)
{
ERR("Failed to create an IRpcStubBuffer from IPSFactory for %s\n", debugstr_guid(riid));
return hr;
}
}
else /* need to addref object anyway */
IUnknown_AddRef(obj);
if (mshlflags & MSHLFLAGS_NOPING)
stdobjref->flags = SORF_NOPING;
@ -129,7 +137,7 @@ HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnkno
manager = new_stub_manager(apt, obj, mshlflags);
if (!manager)
{
IRpcStubBuffer_Release(stub);
if (stub) IRpcStubBuffer_Release(stub);
return E_OUTOFMEMORY;
}
}
@ -601,6 +609,12 @@ static void proxy_manager_disconnect(struct proxy_manager * This)
TRACE("oxid = %s, oid = %s\n", wine_dbgstr_longlong(This->oxid),
wine_dbgstr_longlong(This->oid));
/* SORFP_NOLIFTIMEMGMT proxies (for IRemUnknown) shouldn't be
* disconnected - it won't do anything anyway, except cause
* problems for other objects that depend on this proxy always
* working */
if (This->sorflags & SORFP_NOLIFETIMEMGMT) return;
EnterCriticalSection(&This->cs);
LIST_FOR_EACH(cursor, &This->interfaces)

View file

@ -52,7 +52,7 @@ struct HGLOBALLockBytesImpl
* Needs to be the first item in the struct
* since we want to cast this in an ILockBytes pointer
*/
ILockBytesVtbl *lpVtbl;
const ILockBytesVtbl *lpVtbl;
/*
* Reference count
@ -139,7 +139,7 @@ HRESULT WINAPI HGLOBALLockBytesImpl_Stat(
/*
* Virtual function table for the HGLOBALLockBytesImpl class.
*/
static ILockBytesVtbl HGLOBALLockBytesImpl_Vtbl =
static const ILockBytesVtbl HGLOBALLockBytesImpl_Vtbl =
{
HGLOBALLockBytesImpl_QueryInterface,
HGLOBALLockBytesImpl_AddRef,

View file

@ -52,7 +52,7 @@ struct HGLOBALLockBytesImpl16
* Needs to be the first item in the struct
* since we want to cast this in an ILockBytes pointer
*/
ILockBytes16Vtbl *lpVtbl;
const ILockBytes16Vtbl *lpVtbl;
ULONG ref;
/*
@ -176,7 +176,7 @@ HGLOBALLockBytesImpl16_Construct(HGLOBAL16 hGlobal,
#undef VTENT
msegvt16 = MapLS( &vt16 );
}
newLockBytes->lpVtbl = (ILockBytes16Vtbl*)msegvt16;
newLockBytes->lpVtbl = (const ILockBytes16Vtbl*)msegvt16;
newLockBytes->ref = 0;
/*
* Initialize the support.

View file

@ -716,7 +716,7 @@ HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, IMoniker ** ppmk)
}
/* Virtual function table for the IRunningObjectTable class. */
static IRunningObjectTableVtbl VT_RunningObjectTableImpl =
static const IRunningObjectTableVtbl VT_RunningObjectTableImpl =
{
RunningObjectTableImpl_QueryInterface,
RunningObjectTableImpl_AddRef,
@ -968,7 +968,7 @@ static HRESULT WINAPI EnumMonikerImpl_CreateEnumROTMoniker(MInterfacePointer **m
/* the initial reference is set to "1" */
This->ref = 1; /* set the ref count to one */
This->pos = 0; /* Set the list start posn to start */
This->pos = current_pos; /* Set the list start posn */
This->moniker_count = moniker_count; /* Need the same size table as ROT */
This->monikers = monikers;

View file

@ -6,7 +6,6 @@
extern const CLSID CLSID_FileMoniker;
extern const CLSID CLSID_ItemMoniker;
extern const CLSID CLSID_AntiMoniker;
extern const CLSID CLSID_CompositeMoniker;
HRESULT FileMonikerCF_Create(REFIID riid, LPVOID *ppv);
HRESULT ItemMonikerCF_Create(REFIID riid, LPVOID *ppv);

View file

@ -50,10 +50,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(ole);
HTASK16 hETask = 0;
WORD Table_ETask[62];
static HTASK16 hETask = 0;
static WORD Table_ETask[62];
LPMALLOC16 currentMalloc16=NULL;
static LPMALLOC16 currentMalloc16=NULL;
/* --- IMalloc16 implementation */
@ -61,7 +61,7 @@ LPMALLOC16 currentMalloc16=NULL;
typedef struct
{
/* IUnknown fields */
IMalloc16Vtbl *lpVtbl;
const IMalloc16Vtbl *lpVtbl;
DWORD ref;
/* IMalloc16 fields */
} IMalloc16Impl;
@ -196,7 +196,7 @@ IMalloc16_Constructor()
#undef VTENT
msegvt16 = MapLS( &vt16 );
}
This->lpVtbl = (IMalloc16Vtbl*)msegvt16;
This->lpVtbl = (const IMalloc16Vtbl*)msegvt16;
This->ref = 1;
return (LPMALLOC16)MapLS( This );
}
@ -310,7 +310,7 @@ _xmalloc16(DWORD size, SEGPTR *ptr) {
* everything we need.
*/
if (!K32WOWCallback16Ex(
(DWORD)((IMalloc16Vtbl*)MapSL(
(DWORD)((const IMalloc16Vtbl*)MapSL(
(SEGPTR)((LPMALLOC16)MapSL((SEGPTR)mllc))->lpVtbl )
)->Alloc,
WCB16_CDECL,
@ -356,23 +356,22 @@ HRESULT WINAPI ProgIDFromCLSID16(
REFCLSID clsid, /* [in] class id as found in registry */
LPOLESTR16 *lplpszProgID/* [out] associated Prog ID */
) {
char strCLSID[50], *buf, *buf2;
DWORD buf2len;
static const WCHAR wszProgID[] = {'P','r','o','g','I','D',0};
HKEY xhkey;
HKEY hkey;
HRESULT ret = S_OK;
WINE_StringFromCLSID(clsid, strCLSID);
buf = HeapAlloc(GetProcessHeap(), 0, strlen(strCLSID)+14);
sprintf(buf,"CLSID\\%s\\ProgID", strCLSID);
if (RegOpenKeyA(HKEY_CLASSES_ROOT, buf, &xhkey))
if (COM_OpenKeyForCLSID(clsid, KEY_READ, &hkey))
ret = REGDB_E_CLASSNOTREG;
if ((ret == S_OK) &&
RegOpenKeyW(hkey, wszProgID, &xhkey))
ret = REGDB_E_CLASSNOTREG;
HeapFree(GetProcessHeap(), 0, buf);
if (ret == S_OK)
{
buf2 = HeapAlloc(GetProcessHeap(), 0, 255);
DWORD buf2len;
char *buf2 = HeapAlloc(GetProcessHeap(), 0, 255);
buf2len = 255;
if (RegQueryValueA(xhkey, NULL, buf2, &buf2len))
ret = REGDB_E_CLASSNOTREG;
@ -429,12 +428,8 @@ HRESULT WINAPI CoRegisterClassObject16(
DWORD flags, /* [in] REGCLS flags indicating how connections are made */
LPDWORD lpdwRegister
) {
char buf[80];
WINE_StringFromCLSID(rclsid,buf);
FIXME("(%s,%p,0x%08lx,0x%08lx,%p),stub\n",
buf,pUnk,dwClsContext,flags,lpdwRegister
debugstr_guid(rclsid),pUnk,dwClsContext,flags,lpdwRegister
);
return 0;
}

View file

@ -46,6 +46,7 @@
#include "ole2ver.h"
#include "wownt32.h"
#include "wine/unicode.h"
#include "wine/winbase16.h"
#include "wine/wingdi16.h"
#include "wine/winuser16.h"
@ -2294,20 +2295,20 @@ HRESULT WINAPI OleCreate(
*/
HRESULT WINAPI OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew)
{
HKEY hkey = 0;
char buf[200], szClsidNew[200];
static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0};
HKEY hkey = NULL;
WCHAR szClsidNew[CHARS_IN_GUID];
HRESULT res = S_OK;
/* FIXME: convert to Unicode */
TRACE("(%s,%s)\n", debugstr_guid(clsidOld), debugstr_guid(clsidNew));
sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]);
WINE_StringFromCLSID(clsidNew, szClsidNew);
if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey))
if (COM_OpenKeyForCLSID(clsidOld, KEY_READ | KEY_WRITE, &hkey))
{
res = REGDB_E_CLASSNOTREG;
goto done;
}
if (RegSetValueA(hkey, "AutoConvertTo", REG_SZ, szClsidNew, strlen(szClsidNew)+1))
StringFromGUID2(clsidNew, szClsidNew, CHARS_IN_GUID);
if (RegSetValueW(hkey, wszAutoConvertTo, REG_SZ, szClsidNew, (strlenW(szClsidNew)+1) * sizeof(WCHAR)))
{
res = REGDB_E_WRITEREGDB;
goto done;

View file

@ -65,8 +65,8 @@
@ stdcall CoRevokeMallocSpy()
@ stdcall CoSetProxyBlanket(ptr long long wstr long long ptr long)
@ stdcall CoSetState(ptr)
@ stub CoSwitchCallContext
@ stdcall CoSuspendClassObjects()
@ stub CoSwitchCallContext
@ stdcall CoTaskMemAlloc(long)
@ stdcall CoTaskMemFree(ptr)
@ stdcall CoTaskMemRealloc(ptr long)
@ -146,8 +146,8 @@
@ stub HWND_UserMarshal
@ stub HWND_UserSize
@ stub HWND_UserUnmarshal
@ stub I_RemoteMain
@ stdcall IIDFromString(wstr ptr) CLSIDFromString
@ stub I_RemoteMain
@ stdcall IsAccelerator(long long ptr long)
@ stdcall IsEqualGUID(ptr ptr)
@ stub IsValidIid
@ -226,13 +226,17 @@
@ stdcall RegisterDragDrop(long ptr)
@ stdcall ReleaseStgMedium(ptr)
@ stdcall RevokeDragDrop(long)
@ stdcall SetConvertStg(ptr long)
@ stub SetDocumentBitStg
@ stdcall SetErrorInfo(long ptr)
@ stub SNB_UserFree
@ stub SNB_UserMarshal
@ stub SNB_UserSize
@ stub SNB_UserUnmarshal
@ stub STGMEDIUM_UserFree
@ stub STGMEDIUM_UserMarshal
@ stub STGMEDIUM_UserSize
@ stub STGMEDIUM_UserUnmarshal
@ stdcall SetConvertStg(ptr long)
@ stub SetDocumentBitStg
@ stdcall SetErrorInfo(long ptr)
@ stdcall StgCreateDocfile(wstr long long ptr)
@ stdcall StgCreateDocfileOnILockBytes(ptr long long ptr)
@ stdcall StgCreatePropSetStg(ptr long ptr)
@ -241,10 +245,6 @@
@ stub StgGetIFillLockBytesOnILockBytes
@ stdcall StgIsStorageFile(wstr)
@ stdcall StgIsStorageILockBytes(ptr)
@ stub STGMEDIUM_UserFree
@ stub STGMEDIUM_UserMarshal
@ stub STGMEDIUM_UserSize
@ stub STGMEDIUM_UserUnmarshal
@ stub StgOpenAsyncDocfileOnIFillLockBytes
@ stdcall StgOpenStorage(wstr ptr long ptr long ptr)
@ stdcall StgOpenStorageEx(wstr long long long ptr ptr ptr ptr)

View file

@ -41,7 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
*/
typedef struct OleAdviseHolderImpl
{
IOleAdviseHolderVtbl *lpVtbl;
const IOleAdviseHolderVtbl *lpVtbl;
DWORD ref;
@ -306,7 +306,7 @@ OleAdviseHolderImpl_SendOnClose (LPOLEADVISEHOLDER iface)
/**************************************************************************
* OleAdviseHolderImpl_VTable
*/
static struct IOleAdviseHolderVtbl oahvt =
static const IOleAdviseHolderVtbl oahvt =
{
OleAdviseHolderImpl_QueryInterface,
OleAdviseHolderImpl_AddRef,
@ -323,7 +323,7 @@ static struct IOleAdviseHolderVtbl oahvt =
* OleAdviseHolderImpl_Constructor
*/
static LPOLEADVISEHOLDER OleAdviseHolderImpl_Constructor()
static LPOLEADVISEHOLDER OleAdviseHolderImpl_Constructor(void)
{
OleAdviseHolderImpl* lpoah;
DWORD index;
@ -355,7 +355,7 @@ typedef struct DataAdviseConnection {
typedef struct DataAdviseHolder
{
IDataAdviseHolderVtbl *lpVtbl;
const IDataAdviseHolderVtbl *lpVtbl;
DWORD ref;
DWORD maxCons;
@ -625,7 +625,7 @@ static HRESULT WINAPI DataAdviseHolder_SendOnDataChange(
/**************************************************************************
* DataAdviseHolderImpl_VTable
*/
static struct IDataAdviseHolderVtbl DataAdviseHolderImpl_VTable =
static const IDataAdviseHolderVtbl DataAdviseHolderImpl_VTable =
{
DataAdviseHolder_QueryInterface,
DataAdviseHolder_AddRef,
@ -639,7 +639,7 @@ static struct IDataAdviseHolderVtbl DataAdviseHolderImpl_VTable =
/******************************************************************************
* DataAdviseHolder_Constructor
*/
static IDataAdviseHolder* DataAdviseHolder_Constructor()
static IDataAdviseHolder* DataAdviseHolder_Constructor(void)
{
DataAdviseHolder* newHolder;

View file

@ -88,7 +88,7 @@ const CLSID CLSID_PSFactoryBuffer = { 0x00000320, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0,
* COM will load the appropriate interface stubs and proxies as needed.
*/
typedef struct _CFStub {
IRpcStubBufferVtbl *lpvtbl;
const IRpcStubBufferVtbl *lpvtbl;
DWORD ref;
LPUNKNOWN pUnkServer;
@ -237,7 +237,7 @@ CFStub_DebugServerRelease(LPRPCSTUBBUFFER iface,void *pv) {
FIXME("(%p), stub!\n",pv);
}
static IRpcStubBufferVtbl cfstubvt = {
static const IRpcStubBufferVtbl cfstubvt = {
CFStub_QueryInterface,
CFStub_AddRef,
CFStub_Release,
@ -296,7 +296,8 @@ static ULONG WINAPI IRpcProxyBufferImpl_Release(LPRPCPROXYBUFFER iface) {
ULONG ref = InterlockedDecrement(&This->ref);
if (!ref) {
IRpcChannelBuffer_Release(This->chanbuf);This->chanbuf = NULL;
IRpcChannelBuffer_Release(This->chanbuf);
This->chanbuf = NULL;
HeapFree(GetProcessHeap(),0,This);
}
return ref;
@ -420,14 +421,14 @@ static HRESULT WINAPI CFProxy_LockServer(LPCLASSFACTORY iface,BOOL fLock) {
return S_OK;
}
static IRpcProxyBufferVtbl pspbvtbl = {
static const IRpcProxyBufferVtbl pspbvtbl = {
IRpcProxyBufferImpl_QueryInterface,
IRpcProxyBufferImpl_AddRef,
IRpcProxyBufferImpl_Release,
IRpcProxyBufferImpl_Connect,
IRpcProxyBufferImpl_Disconnect
};
static IClassFactoryVtbl cfproxyvt = {
static const IClassFactoryVtbl cfproxyvt = {
CFProxy_QueryInterface,
CFProxy_AddRef,
CFProxy_Release,
@ -846,13 +847,14 @@ static HRESULT WINAPI RURpcProxyBufferImpl_QueryInterface(LPRPCPROXYBUFFER iface
static ULONG WINAPI RURpcProxyBufferImpl_AddRef(LPRPCPROXYBUFFER iface) {
ICOM_THIS_MULTI(RemUnkProxy,lpvtbl_proxy,iface);
TRACE("%p, %ld\n", iface, This->refs + 1);
return InterlockedIncrement(&This->refs);
}
static ULONG WINAPI RURpcProxyBufferImpl_Release(LPRPCPROXYBUFFER iface) {
ICOM_THIS_MULTI(RemUnkProxy,lpvtbl_proxy,iface);
ULONG ref = InterlockedDecrement(&This->refs);
TRACE("%p, %ld\n", iface, ref);
if (!ref) {
IRpcChannelBuffer_Release(This->chan);This->chan = NULL;
HeapFree(GetProcessHeap(),0,This);
@ -863,12 +865,14 @@ static ULONG WINAPI RURpcProxyBufferImpl_Release(LPRPCPROXYBUFFER iface) {
static HRESULT WINAPI RURpcProxyBufferImpl_Connect(LPRPCPROXYBUFFER iface,IRpcChannelBuffer* pRpcChannelBuffer) {
ICOM_THIS_MULTI(RemUnkProxy,lpvtbl_proxy,iface);
TRACE("%p, %p\n", iface, pRpcChannelBuffer);
This->chan = pRpcChannelBuffer;
IRpcChannelBuffer_AddRef(This->chan);
return S_OK;
}
static void WINAPI RURpcProxyBufferImpl_Disconnect(LPRPCPROXYBUFFER iface) {
ICOM_THIS_MULTI(RemUnkProxy,lpvtbl_proxy,iface);
TRACE("%p, %p\n", iface, This->chan);
if (This->chan) {
IRpcChannelBuffer_Release(This->chan);
This->chan = NULL;
@ -956,7 +960,7 @@ PSFacBuf_CreateStub(
return E_FAIL;
}
static IPSFactoryBufferVtbl psfacbufvtbl = {
static const IPSFactoryBufferVtbl psfacbufvtbl = {
PSFacBuf_QueryInterface,
PSFacBuf_AddRef,
PSFacBuf_Release,
@ -965,7 +969,7 @@ static IPSFactoryBufferVtbl psfacbufvtbl = {
};
/* This is the whole PSFactoryBuffer object, just the vtableptr */
static IPSFactoryBufferVtbl *lppsfac = &psfacbufvtbl;
static const IPSFactoryBufferVtbl *lppsfac = &psfacbufvtbl;
/***********************************************************************
* DllGetClassObject [OLE32.@]

View file

@ -452,18 +452,31 @@ static struct regsvr_coclass const coclass_list[] = {
#define INTERFACE_ENTRY(interface, base, clsid32, clsid16) { &IID_##interface, #interface, base, sizeof(interface##Vtbl)/sizeof(void*), clsid16, clsid32 }
#define STD_INTERFACE_ENTRY(interface) INTERFACE_ENTRY(interface, NULL, &CLSID_PSFactoryBuffer, NULL)
#define LCL_INTERFACE_ENTRY(interface) INTERFACE_ENTRY(interface, NULL, NULL, NULL)
static struct regsvr_interface const interface_list[] = {
STD_INTERFACE_ENTRY(IUnknown),
static const struct regsvr_interface interface_list[] = {
LCL_INTERFACE_ENTRY(IUnknown),
STD_INTERFACE_ENTRY(IClassFactory),
LCL_INTERFACE_ENTRY(IMalloc),
LCL_INTERFACE_ENTRY(IMarshal),
STD_INTERFACE_ENTRY(IStorage),
STD_INTERFACE_ENTRY(IStream ),
LCL_INTERFACE_ENTRY(IMessageFilter),
LCL_INTERFACE_ENTRY(IStdMarshalInfo),
LCL_INTERFACE_ENTRY(IExternalConnection),
LCL_INTERFACE_ENTRY(IMallocSpy),
LCL_INTERFACE_ENTRY(IMultiQI),
STD_INTERFACE_ENTRY(IStream),
STD_INTERFACE_ENTRY(IPersistStorage),
STD_INTERFACE_ENTRY(IDataObject),
STD_INTERFACE_ENTRY(IAdviseSink),
LCL_INTERFACE_ENTRY(IDataAdviseHolder),
LCL_INTERFACE_ENTRY(IOleAdviseHolder),
STD_INTERFACE_ENTRY(IOleObject),
STD_INTERFACE_ENTRY(IOleClientSite),
LCL_INTERFACE_ENTRY(IDropSource),
STD_INTERFACE_ENTRY(IRemUnknown),
LCL_INTERFACE_ENTRY(IClientSecurity),
LCL_INTERFACE_ENTRY(IServerSecurity),
{ NULL } /* list terminator */
};

View file

@ -569,24 +569,27 @@ void RPC_StartRemoting(struct apartment *apt)
static HRESULT create_server(REFCLSID rclsid)
{
static const WCHAR wszLocalServer32[] = { 'L','o','c','a','l','S','e','r','v','e','r','3','2',0 };
static const WCHAR embedding[] = { ' ', '-','E','m','b','e','d','d','i','n','g',0 };
HKEY hkeyclsid;
HKEY key;
char buf[200];
HRESULT hres = E_UNEXPECTED;
char xclsid[80];
WCHAR exe[MAX_PATH+1];
DWORD exelen = sizeof(exe);
WCHAR command[MAX_PATH+sizeof(embedding)/sizeof(WCHAR)];
STARTUPINFOW sinfo;
PROCESS_INFORMATION pinfo;
WINE_StringFromCLSID((LPCLSID)rclsid,xclsid);
hres = HRESULT_FROM_WIN32(COM_OpenKeyForCLSID(rclsid, KEY_READ, &hkeyclsid));
if (hres != S_OK) {
ERR("class %s not registered\n", debugstr_guid(rclsid));
return REGDB_E_READREGDB;
}
sprintf(buf,"CLSID\\%s\\LocalServer32",xclsid);
hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, buf, 0, KEY_READ, &key);
hres = RegOpenKeyExW(hkeyclsid, wszLocalServer32, 0, KEY_READ, &key);
if (hres != ERROR_SUCCESS) {
WARN("CLSID %s not registered as LocalServer32\n", xclsid);
WARN("class %s not registered as LocalServer32\n", debugstr_guid(rclsid));
return REGDB_E_READREGDB; /* Probably */
}
@ -608,7 +611,7 @@ static HRESULT create_server(REFCLSID rclsid)
strcpyW(command, exe);
strcatW(command, embedding);
TRACE("activating local server '%s' for %s\n", debugstr_w(command), xclsid);
TRACE("activating local server %s for %s\n", debugstr_w(command), debugstr_guid(rclsid));
if (!CreateProcessW(exe, command, NULL, NULL, FALSE, 0, NULL, NULL, &sinfo, &pinfo)) {
WARN("failed to run local server %s\n", debugstr_w(exe));
@ -663,8 +666,7 @@ static DWORD start_local_service(LPCWSTR name, DWORD num, LPWSTR *params)
static HRESULT create_local_service(REFCLSID rclsid)
{
HRESULT hres = REGDB_E_READREGDB;
WCHAR buf[40], keyname[50];
static const WCHAR szClsId[] = { 'C','L','S','I','D','\\',0 };
WCHAR buf[CHARS_IN_GUID], keyname[50];
static const WCHAR szAppId[] = { 'A','p','p','I','d',0 };
static const WCHAR szAppIdKey[] = { 'A','p','p','I','d','\\',0 };
static const WCHAR szLocalService[] = { 'L','o','c','a','l','S','e','r','v','i','c','e',0 };
@ -676,9 +678,7 @@ static HRESULT create_local_service(REFCLSID rclsid)
TRACE("Attempting to start Local service for %s\n", debugstr_guid(rclsid));
/* read the AppID value under the class's key */
strcpyW(keyname,szClsId);
StringFromGUID2(rclsid,&keyname[6],39);
r = RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &hkey);
r = COM_OpenKeyForCLSID(rclsid, KEY_READ, &hkey);
if (r!=ERROR_SUCCESS)
return hres;
sz = sizeof buf;
@ -725,14 +725,20 @@ static HRESULT create_local_service(REFCLSID rclsid)
return hres;
}
#define PIPEPREF "\\\\.\\pipe\\"
static void get_localserver_pipe_name(WCHAR *pipefn, REFCLSID rclsid)
{
static const WCHAR wszPipeRef[] = {'\\','\\','.','\\','p','i','p','e','\\',0};
strcpyW(pipefn, wszPipeRef);
StringFromGUID2(rclsid, pipefn + sizeof(wszPipeRef)/sizeof(wszPipeRef[0]) - 1, CHARS_IN_GUID);
}
/* FIXME: should call to rpcss instead */
HRESULT RPC_GetLocalClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
{
HRESULT hres;
HANDLE hPipe;
char pipefn[200];
WCHAR pipefn[100];
DWORD res, bufferlen;
char marshalbuffer[200];
IStream *pStm;
@ -744,14 +750,13 @@ HRESULT RPC_GetLocalClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
TRACE("rclsid=%s, iid=%s\n", debugstr_guid(rclsid), debugstr_guid(iid));
strcpy(pipefn,PIPEPREF);
WINE_StringFromCLSID(rclsid,pipefn+strlen(PIPEPREF));
get_localserver_pipe_name(pipefn, rclsid);
while (tries++ < MAXTRIES) {
TRACE("waiting for %s\n", pipefn);
TRACE("waiting for %s\n", debugstr_w(pipefn));
WaitNamedPipeA( pipefn, NMPWAIT_WAIT_FOREVER );
hPipe = CreateFileA(pipefn, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
WaitNamedPipeW( pipefn, NMPWAIT_WAIT_FOREVER );
hPipe = CreateFileW(pipefn, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
if (hPipe == INVALID_HANDLE_VALUE) {
if (tries == 1) {
if ( (hres = create_server(rclsid)) &&
@ -759,7 +764,7 @@ HRESULT RPC_GetLocalClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
return hres;
Sleep(1000);
} else {
WARN("Connecting to %s, no response yet, retrying: le is %lx\n",pipefn,GetLastError());
WARN("Connecting to %s, no response yet, retrying: le is %lx\n", debugstr_w(pipefn), GetLastError());
Sleep(1000);
}
continue;
@ -804,7 +809,7 @@ static DWORD WINAPI local_server_thread(LPVOID param)
{
struct local_server_params * lsp = (struct local_server_params *)param;
HANDLE hPipe;
char pipefn[200];
WCHAR pipefn[100];
HRESULT hres;
IStream *pStm = lsp->stream;
STATSTG ststg;
@ -816,18 +821,17 @@ static DWORD WINAPI local_server_thread(LPVOID param)
TRACE("Starting threader for %s.\n",debugstr_guid(&lsp->clsid));
strcpy(pipefn,PIPEPREF);
WINE_StringFromCLSID(&lsp->clsid,pipefn+strlen(PIPEPREF));
get_localserver_pipe_name(pipefn, &lsp->clsid);
HeapFree(GetProcessHeap(), 0, lsp);
hPipe = CreateNamedPipeA( pipefn, PIPE_ACCESS_DUPLEX,
hPipe = CreateNamedPipeW( pipefn, PIPE_ACCESS_DUPLEX,
PIPE_TYPE_BYTE|PIPE_WAIT, PIPE_UNLIMITED_INSTANCES,
4096, 4096, 500 /* 0.5 second timeout */, NULL );
if (hPipe == INVALID_HANDLE_VALUE)
{
FIXME("pipe creation failed for %s, le is %ld\n",pipefn,GetLastError());
FIXME("pipe creation failed for %s, le is %ld\n", debugstr_w(pipefn), GetLastError());
return 1;
}

View file

@ -147,14 +147,14 @@ static HRESULT PropertyStorage_PropVariantCopy(PROPVARIANT *prop,
static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst,
LCID targetCP);
static IPropertyStorageVtbl IPropertyStorage_Vtbl;
static const IPropertyStorageVtbl IPropertyStorage_Vtbl;
/***********************************************************************
* Implementation of IPropertyStorage
*/
typedef struct tagPropertyStorage_impl
{
IPropertyStorageVtbl *vtbl;
const IPropertyStorageVtbl *vtbl;
DWORD ref;
CRITICAL_SECTION cs;
IStream *stm;
@ -2210,7 +2210,7 @@ static HRESULT WINAPI IPropertySetStorage_fnEnum(
/***********************************************************************
* vtables
*/
IPropertySetStorageVtbl IPropertySetStorage_Vtbl =
const IPropertySetStorageVtbl IPropertySetStorage_Vtbl =
{
IPropertySetStorage_fnQueryInterface,
IPropertySetStorage_fnAddRef,
@ -2221,7 +2221,7 @@ IPropertySetStorageVtbl IPropertySetStorage_Vtbl =
IPropertySetStorage_fnEnum
};
static IPropertyStorageVtbl IPropertyStorage_Vtbl =
static const IPropertyStorageVtbl IPropertyStorage_Vtbl =
{
IPropertyStorage_fnQueryInterface,
IPropertyStorage_fnAddRef,
@ -2310,7 +2310,7 @@ HRESULT WINAPI FmtIdToPropStgName(const FMTID *rfmtid, LPOLESTR str)
}
else
{
if (++fmtptr < (BYTE *)rfmtid + sizeof(FMTID))
if (++fmtptr < (const BYTE *)rfmtid + sizeof(FMTID))
i |= *fmtptr << bitsRemaining;
*pstr++ = (WCHAR)(fmtMap[i & CHARMASK]);
bitsRemaining += BITS_PER_BYTE - BITS_IN_CHARMASK;

View file

@ -819,7 +819,7 @@ static HRESULT WINAPI StgStreamImpl_Clone(
/*
* Virtual function table for the StgStreamImpl class.
*/
static IStreamVtbl StgStreamImpl_Vtbl =
static const IStreamVtbl StgStreamImpl_Vtbl =
{
StgStreamImpl_QueryInterface,
StgStreamImpl_AddRef,

View file

@ -91,9 +91,9 @@ static const BYTE STORAGE_magic[8] ={0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1};
#define READ_HEADER STORAGE_get_big_block(hf,-1,(LPBYTE)&sth);assert(!memcmp(STORAGE_magic,sth.magic,sizeof(STORAGE_magic)));
static IStorage16Vtbl stvt16;
static IStorage16Vtbl *segstvt16 = NULL;
static const IStorage16Vtbl *segstvt16 = NULL;
static IStream16Vtbl strvt16;
static IStream16Vtbl *segstrvt16 = NULL;
static const IStream16Vtbl *segstrvt16 = NULL;
/*ULONG WINAPI IStorage16_AddRef(LPSTORAGE16 this);*/
static void _create_istorage16(LPSTORAGE16 *stg);
@ -955,7 +955,7 @@ STORAGE_get_free_pps_entry(HANDLE hf) {
typedef struct
{
/* IUnknown fields */
IStream16Vtbl *lpVtbl;
const IStream16Vtbl *lpVtbl;
DWORD ref;
/* IStream16 fields */
SEGPTR thisptr; /* pointer to this struct as segmented */
@ -1413,7 +1413,7 @@ static void _create_istream16(LPSTREAM16 *str) {
VTENT(Stat);
VTENT(Clone);
#undef VTENT
segstrvt16 = (IStream16Vtbl*)MapLS( &strvt16 );
segstrvt16 = (const IStream16Vtbl*)MapLS( &strvt16 );
} else {
#define VTENT(xfn) strvt16.xfn = IStream16_fn##xfn;
VTENT(QueryInterface);
@ -1449,7 +1449,7 @@ static void _create_istream16(LPSTREAM16 *str) {
typedef struct
{
/* IUnknown fields */
IStreamVtbl *lpVtbl;
const IStreamVtbl *lpVtbl;
DWORD ref;
/* IStream32 fields */
struct storage_pps_entry stde;
@ -1503,7 +1503,7 @@ ULONG WINAPI IStream_fnRelease(IStream* iface) {
typedef struct
{
/* IUnknown fields */
IStorage16Vtbl *lpVtbl;
const IStorage16Vtbl *lpVtbl;
DWORD ref;
/* IStorage16 fields */
SEGPTR thisptr; /* pointer to this struct as segmented */
@ -1829,7 +1829,7 @@ static void _create_istorage16(LPSTORAGE16 *stg) {
VTENT(SetStateBits)
VTENT(Stat)
#undef VTENT
segstvt16 = (IStorage16Vtbl*)MapLS( &stvt16 );
segstvt16 = (const IStorage16Vtbl*)MapLS( &stvt16 );
} else {
#define VTENT(xfn) stvt16.xfn = IStorage16_fn##xfn;
VTENT(QueryInterface)
@ -1985,7 +1985,7 @@ HRESULT WINAPI StgIsStorageILockBytes16(SEGPTR plkbyt)
args[5] = 0;
if (!K32WOWCallback16Ex(
(DWORD)((ILockBytes16Vtbl*)MapSL(
(DWORD)((const ILockBytes16Vtbl*)MapSL(
(SEGPTR)((LPLOCKBYTES16)MapSL(plkbyt))->lpVtbl)
)->ReadAt,
WCB16_PASCAL,

View file

@ -157,7 +157,7 @@ static DWORD GetShareModeFromSTGM(DWORD stgm);
static DWORD GetAccessModeFromSTGM(DWORD stgm);
static DWORD GetCreationModeFromSTGM(DWORD stgm);
extern IPropertySetStorageVtbl IPropertySetStorage_Vtbl;
extern const IPropertySetStorageVtbl IPropertySetStorage_Vtbl;
@ -2178,7 +2178,7 @@ HRESULT WINAPI StorageImpl_SetStateBits(
/*
* Virtual function table for the IStorage32Impl class.
*/
static IStorageVtbl Storage32Impl_Vtbl =
static const IStorageVtbl Storage32Impl_Vtbl =
{
StorageBaseImpl_QueryInterface,
StorageBaseImpl_AddRef,
@ -3965,7 +3965,7 @@ ULONG IEnumSTATSTGImpl_PopSearchNode(
/*
* Virtual function table for the IEnumSTATSTGImpl class.
*/
static IEnumSTATSTGVtbl IEnumSTATSTGImpl_Vtbl =
static const IEnumSTATSTGVtbl IEnumSTATSTGImpl_Vtbl =
{
IEnumSTATSTGImpl_QueryInterface,
IEnumSTATSTGImpl_AddRef,
@ -4025,7 +4025,7 @@ IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
/*
* Virtual function table for the Storage32InternalImpl class.
*/
static IStorageVtbl Storage32InternalImpl_Vtbl =
static const IStorageVtbl Storage32InternalImpl_Vtbl =
{
StorageBaseImpl_QueryInterface,
StorageBaseImpl_AddRef,

View file

@ -214,10 +214,10 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName
*/
struct StorageBaseImpl
{
IStorageVtbl *lpVtbl; /* Needs to be the first item in the struct
const IStorageVtbl *lpVtbl; /* Needs to be the first item in the struct
* since we want to cast this in a Storage32 pointer */
IPropertySetStorageVtbl *pssVtbl; /* interface for adding a properties stream */
const IPropertySetStorageVtbl *pssVtbl; /* interface for adding a properties stream */
/*
* Reference count of this object
@ -427,7 +427,7 @@ HRESULT WINAPI StorageInternalImpl_Revert(
*/
struct IEnumSTATSTGImpl
{
IEnumSTATSTGVtbl *lpVtbl; /* Needs to be the first item in the struct
const IEnumSTATSTGVtbl *lpVtbl; /* Needs to be the first item in the struct
* since we want to cast this in an IEnumSTATSTG pointer */
ULONG ref; /* Reference count */
@ -481,7 +481,7 @@ INT IEnumSTATSTGImpl_FindParentProperty(
*/
struct StgStreamImpl
{
IStreamVtbl *lpVtbl; /* Needs to be the first item in the struct
const IStreamVtbl *lpVtbl; /* Needs to be the first item in the struct
* since we want to cast this to an IStream pointer */
/*

View file

@ -409,7 +409,7 @@ struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *s
if (!stub) return NULL;
stub->stubbuffer = sb;
IUnknown_AddRef(sb);
if (sb) IRpcStubBuffer_AddRef(sb);
/* no need to ref this, same object as sb */
stub->iface = iptr;
@ -446,7 +446,7 @@ static void stub_manager_delete_ifstub(struct stub_manager *m, struct ifstub *if
RPC_UnregisterInterface(&ifstub->iid);
IUnknown_Release(ifstub->stubbuffer);
if (ifstub->stubbuffer) IUnknown_Release(ifstub->stubbuffer);
IUnknown_Release(ifstub->iface);
HeapFree(GetProcessHeap(), 0, ifstub);