mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
Sync widl, comcat, ole32, oleaut32 and rpcrt4 to wine 1.1.12
widl can now automatically generate boilerplate code for DLLs hosting RPC proxies (and ole32 and oleaut32 now use this feature): invoke the generation automatically from rbuild rules for rpcproxy modules svn path=/trunk/; revision=38774
This commit is contained in:
parent
dea2fe126b
commit
936851e20d
93 changed files with 4780 additions and 6260 deletions
|
@ -18,9 +18,9 @@
|
|||
<file>irot.idl</file>
|
||||
<file>rpcss.rc</file>
|
||||
</module>
|
||||
<module name="rpcss_epm_server" type="rpcserver">
|
||||
<module name="rpcss_epm_server" type="rpcserver" allowwarnings="true">
|
||||
<file>epm.idl</file>
|
||||
</module>
|
||||
<module name="rpcss_irot_server" type="rpcserver">
|
||||
<module name="rpcss_irot_server" type="rpcserver" allowwarnings="true">
|
||||
<file>irot.idl</file>
|
||||
</module>
|
||||
|
|
|
@ -15,10 +15,5 @@
|
|||
<library>uuid</library>
|
||||
<library>ntdll</library>
|
||||
<file>comcat_main.c</file>
|
||||
<file>factory.c</file>
|
||||
<file>information.c</file>
|
||||
<file>manager.c</file>
|
||||
<file>register.c</file>
|
||||
<file>regsvr.c</file>
|
||||
<file>version.rc</file>
|
||||
</module>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ stdcall -private DllCanUnloadNow()
|
||||
@ stdcall -private DllGetClassObject(ptr ptr ptr)
|
||||
@ stdcall -private DllGetClassObject(ptr ptr ptr) ole32.DllGetClassObject
|
||||
@ stdcall -private DllRegisterServer()
|
||||
@ stdcall -private DllUnregisterServer()
|
||||
|
|
|
@ -18,38 +18,37 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "comcat_private.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "wine/debug.h"
|
||||
#define COBJMACROS
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
LONG dll_ref = 0;
|
||||
|
||||
/***********************************************************************
|
||||
* Global string constant definitions
|
||||
*/
|
||||
const WCHAR clsid_keyname[6] = { 'C', 'L', 'S', 'I', 'D', 0 };
|
||||
|
||||
/***********************************************************************
|
||||
* DllGetClassObject (COMCAT.@)
|
||||
*/
|
||||
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
if (IsEqualGUID(rclsid, &CLSID_StdComponentCategoriesMgr)) {
|
||||
return IClassFactory_QueryInterface((LPCLASSFACTORY)&COMCAT_ClassFactory, iid, ppv);
|
||||
}
|
||||
FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
}
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "winreg.h"
|
||||
#include "winerror.h"
|
||||
#include "ole2.h"
|
||||
|
||||
/***********************************************************************
|
||||
* DllCanUnloadNow (COMCAT.@)
|
||||
*/
|
||||
HRESULT WINAPI DllCanUnloadNow(void)
|
||||
{
|
||||
return dll_ref != 0 ? S_FALSE : S_OK;
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
/* NOTE: DllRegisterServer and DllUnregisterServer are in regsvr.c */
|
||||
/***********************************************************************
|
||||
* DllRegisterServer (COMCAT.@)
|
||||
*/
|
||||
HRESULT WINAPI DllRegisterServer(void)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DllUnregisterServer (COMCAT.@)
|
||||
*/
|
||||
HRESULT WINAPI DllUnregisterServer(void)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
/*
|
||||
* includes for comcat.dll
|
||||
*
|
||||
* Copyright (C) 2002 John K. Hohm
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "winreg.h"
|
||||
#include "winerror.h"
|
||||
|
||||
#include "ole2.h"
|
||||
#include "comcat.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
|
||||
|
||||
/**********************************************************************
|
||||
* Dll lifetime tracking declaration for comcat.dll
|
||||
*/
|
||||
extern LONG dll_ref;
|
||||
|
||||
/**********************************************************************
|
||||
* ClassFactory declaration for comcat.dll
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/* IUnknown fields */
|
||||
const IClassFactoryVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
} ClassFactoryImpl;
|
||||
|
||||
extern ClassFactoryImpl COMCAT_ClassFactory;
|
||||
|
||||
/**********************************************************************
|
||||
* StdComponentCategoriesMgr declaration for comcat.dll
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/* IUnknown fields */
|
||||
const IUnknownVtbl *unkVtbl;
|
||||
const ICatRegisterVtbl *regVtbl;
|
||||
const ICatInformationVtbl *infVtbl;
|
||||
LONG ref;
|
||||
} ComCatMgrImpl;
|
||||
|
||||
extern ComCatMgrImpl COMCAT_ComCatMgr;
|
||||
extern const ICatRegisterVtbl COMCAT_ICatRegister_Vtbl;
|
||||
extern const ICatInformationVtbl COMCAT_ICatInformation_Vtbl;
|
||||
|
||||
/**********************************************************************
|
||||
* Global string constant declarations
|
||||
*/
|
||||
extern const WCHAR clsid_keyname[6];
|
|
@ -1,149 +0,0 @@
|
|||
/*
|
||||
* ClassFactory implementation for comcat.dll
|
||||
*
|
||||
* Copyright (C) 2002 John K. Hohm
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "comcat_private.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
static ULONG WINAPI COMCAT_IClassFactory_AddRef(LPCLASSFACTORY iface);
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_IClassFactory_QueryInterface (also IUnknown)
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_IClassFactory_QueryInterface(
|
||||
LPCLASSFACTORY iface,
|
||||
REFIID riid,
|
||||
LPVOID *ppvObj)
|
||||
{
|
||||
ClassFactoryImpl *This = (ClassFactoryImpl *)iface;
|
||||
TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
|
||||
|
||||
if (This == NULL || ppvObj == NULL) return E_POINTER;
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
||||
IsEqualGUID(riid, &IID_IClassFactory))
|
||||
{
|
||||
*ppvObj = (LPVOID)iface;
|
||||
COMCAT_IClassFactory_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_IClassFactory_AddRef (also IUnknown)
|
||||
*/
|
||||
static ULONG WINAPI COMCAT_IClassFactory_AddRef(LPCLASSFACTORY iface)
|
||||
{
|
||||
ClassFactoryImpl *This = (ClassFactoryImpl *)iface;
|
||||
ULONG ref;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
ref = InterlockedIncrement(&This->ref);
|
||||
if (ref == 1) {
|
||||
InterlockedIncrement(&dll_ref);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_IClassFactory_Release (also IUnknown)
|
||||
*/
|
||||
static ULONG WINAPI COMCAT_IClassFactory_Release(LPCLASSFACTORY iface)
|
||||
{
|
||||
ClassFactoryImpl *This = (ClassFactoryImpl *)iface;
|
||||
ULONG ref;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
ref = InterlockedDecrement(&This->ref);
|
||||
if (ref == 0) {
|
||||
InterlockedDecrement(&dll_ref);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_IClassFactory_CreateInstance
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_IClassFactory_CreateInstance(
|
||||
LPCLASSFACTORY iface,
|
||||
LPUNKNOWN pUnkOuter,
|
||||
REFIID riid,
|
||||
LPVOID *ppvObj)
|
||||
{
|
||||
ClassFactoryImpl *This = (ClassFactoryImpl *)iface;
|
||||
HRESULT res;
|
||||
TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
|
||||
|
||||
if (This == NULL || ppvObj == NULL) return E_POINTER;
|
||||
|
||||
/* Don't support aggregation (Windows doesn't) */
|
||||
if (pUnkOuter != NULL) return CLASS_E_NOAGGREGATION;
|
||||
|
||||
res = IUnknown_QueryInterface((LPUNKNOWN)&COMCAT_ComCatMgr, riid, ppvObj);
|
||||
if (SUCCEEDED(res)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_IClassFactory_LockServer
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_IClassFactory_LockServer(
|
||||
LPCLASSFACTORY iface,
|
||||
BOOL fLock)
|
||||
{
|
||||
TRACE("\n");
|
||||
|
||||
if (fLock != FALSE) {
|
||||
IClassFactory_AddRef(iface);
|
||||
} else {
|
||||
IClassFactory_Release(iface);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* IClassFactory_Vtbl
|
||||
*/
|
||||
static const IClassFactoryVtbl IClassFactory_Vtbl =
|
||||
{
|
||||
COMCAT_IClassFactory_QueryInterface,
|
||||
COMCAT_IClassFactory_AddRef,
|
||||
COMCAT_IClassFactory_Release,
|
||||
COMCAT_IClassFactory_CreateInstance,
|
||||
COMCAT_IClassFactory_LockServer
|
||||
};
|
||||
|
||||
/**********************************************************************
|
||||
* static ClassFactory instance
|
||||
*/
|
||||
ClassFactoryImpl COMCAT_ClassFactory = { &IClassFactory_Vtbl, 0 };
|
|
@ -1,968 +0,0 @@
|
|||
/*
|
||||
* ComCatMgr ICatInformation implementation for comcat.dll
|
||||
*
|
||||
* Copyright (C) 2002 John K. Hohm
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "comcat_private.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
static LPENUMCATEGORYINFO COMCAT_IEnumCATEGORYINFO_Construct(LCID lcid);
|
||||
static HRESULT COMCAT_GetCategoryDesc(HKEY key, LCID lcid, PWCHAR pszDesc,
|
||||
ULONG buf_wchars);
|
||||
|
||||
struct class_categories {
|
||||
LPCWSTR impl_strings;
|
||||
LPCWSTR req_strings;
|
||||
};
|
||||
|
||||
static struct class_categories *COMCAT_PrepareClassCategories(
|
||||
ULONG impl_count, const CATID *impl_catids, ULONG req_count, const CATID *req_catids);
|
||||
static HRESULT COMCAT_IsClassOfCategories(
|
||||
HKEY key, struct class_categories const* class_categories);
|
||||
static LPENUMGUID COMCAT_CLSID_IEnumGUID_Construct(
|
||||
struct class_categories *class_categories);
|
||||
static LPENUMGUID COMCAT_CATID_IEnumGUID_Construct(
|
||||
REFCLSID rclsid, LPCWSTR impl_req);
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatInformation_QueryInterface
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatInformation_QueryInterface(
|
||||
LPCATINFORMATION iface,
|
||||
REFIID riid,
|
||||
LPVOID *ppvObj)
|
||||
{
|
||||
ICOM_THIS_MULTI(ComCatMgrImpl, infVtbl, iface);
|
||||
TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
|
||||
|
||||
if (This == NULL || ppvObj == NULL) return E_POINTER;
|
||||
|
||||
return IUnknown_QueryInterface((LPUNKNOWN)&This->unkVtbl, riid, ppvObj);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatInformation_AddRef
|
||||
*/
|
||||
static ULONG WINAPI COMCAT_ICatInformation_AddRef(LPCATINFORMATION iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(ComCatMgrImpl, infVtbl, iface);
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
return IUnknown_AddRef((LPUNKNOWN)&This->unkVtbl);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatInformation_Release
|
||||
*/
|
||||
static ULONG WINAPI COMCAT_ICatInformation_Release(LPCATINFORMATION iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(ComCatMgrImpl, infVtbl, iface);
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
return IUnknown_Release((LPUNKNOWN)&This->unkVtbl);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatInformation_EnumCategories
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatInformation_EnumCategories(
|
||||
LPCATINFORMATION iface,
|
||||
LCID lcid,
|
||||
LPENUMCATEGORYINFO *ppenumCatInfo)
|
||||
{
|
||||
/* ICOM_THIS_MULTI(ComCatMgrImpl, infVtbl, iface); */
|
||||
TRACE("\n");
|
||||
|
||||
if (iface == NULL || ppenumCatInfo == NULL) return E_POINTER;
|
||||
|
||||
*ppenumCatInfo = COMCAT_IEnumCATEGORYINFO_Construct(lcid);
|
||||
if (*ppenumCatInfo == NULL) return E_OUTOFMEMORY;
|
||||
IEnumCATEGORYINFO_AddRef(*ppenumCatInfo);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatInformation_GetCategoryDesc
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatInformation_GetCategoryDesc(
|
||||
LPCATINFORMATION iface,
|
||||
REFCATID rcatid,
|
||||
LCID lcid,
|
||||
PWCHAR *ppszDesc)
|
||||
{
|
||||
/* ICOM_THIS_MULTI(ComCatMgrImpl, infVtbl, iface); */
|
||||
WCHAR keyname[60] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
|
||||
't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
|
||||
'r', 'i', 'e', 's', '\\', 0 };
|
||||
HKEY key;
|
||||
HRESULT res;
|
||||
|
||||
TRACE("\n\tCATID:\t%s\n\tLCID:\t%X\n",debugstr_guid(rcatid), lcid);
|
||||
|
||||
if (rcatid == NULL || ppszDesc == NULL) return E_INVALIDARG;
|
||||
|
||||
/* 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);
|
||||
if (res != ERROR_SUCCESS) return CAT_E_CATIDNOEXIST;
|
||||
|
||||
/* Allocate a sensible amount of memory for the description. */
|
||||
*ppszDesc = (PWCHAR) CoTaskMemAlloc(128 * sizeof(WCHAR));
|
||||
if (*ppszDesc == NULL) {
|
||||
RegCloseKey(key);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
/* Get the description, and make sure it's null terminated. */
|
||||
res = COMCAT_GetCategoryDesc(key, lcid, *ppszDesc, 128);
|
||||
RegCloseKey(key);
|
||||
if (FAILED(res)) {
|
||||
CoTaskMemFree(*ppszDesc);
|
||||
return res;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatInformation_EnumClassesOfCategories
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatInformation_EnumClassesOfCategories(
|
||||
LPCATINFORMATION iface,
|
||||
ULONG cImplemented,
|
||||
CATID *rgcatidImpl,
|
||||
ULONG cRequired,
|
||||
CATID *rgcatidReq,
|
||||
LPENUMCLSID *ppenumCLSID)
|
||||
{
|
||||
/* ICOM_THIS_MULTI(ComCatMgrImpl, infVtbl, iface); */
|
||||
struct class_categories *categories;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (cImplemented == (ULONG)-1)
|
||||
cImplemented = 0;
|
||||
if (cRequired == (ULONG)-1)
|
||||
cRequired = 0;
|
||||
|
||||
if (iface == NULL || ppenumCLSID == NULL ||
|
||||
(cImplemented && rgcatidImpl == NULL) ||
|
||||
(cRequired && rgcatidReq == NULL)) return E_POINTER;
|
||||
|
||||
categories = COMCAT_PrepareClassCategories(cImplemented, rgcatidImpl,
|
||||
cRequired, rgcatidReq);
|
||||
if (categories == NULL) return E_OUTOFMEMORY;
|
||||
*ppenumCLSID = COMCAT_CLSID_IEnumGUID_Construct(categories);
|
||||
if (*ppenumCLSID == NULL) {
|
||||
HeapFree(GetProcessHeap(), 0, categories);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
IEnumGUID_AddRef(*ppenumCLSID);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatInformation_IsClassOfCategories
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatInformation_IsClassOfCategories(
|
||||
LPCATINFORMATION iface,
|
||||
REFCLSID rclsid,
|
||||
ULONG cImplemented,
|
||||
CATID *rgcatidImpl,
|
||||
ULONG cRequired,
|
||||
CATID *rgcatidReq)
|
||||
{
|
||||
/* ICOM_THIS_MULTI(ComCatMgrImpl, infVtbl, iface); */
|
||||
WCHAR keyname[45] = { 'C', 'L', 'S', 'I', 'D', '\\', 0 };
|
||||
HRESULT res;
|
||||
struct class_categories *categories;
|
||||
HKEY key;
|
||||
|
||||
if (WINE_TRACE_ON(ole)) {
|
||||
ULONG count;
|
||||
TRACE("\n\tCLSID:\t%s\n\tImplemented %u\n",debugstr_guid(rclsid),cImplemented);
|
||||
for (count = 0; count < cImplemented; ++count)
|
||||
TRACE("\t\t%s\n",debugstr_guid(&rgcatidImpl[count]));
|
||||
TRACE("\tRequired %u\n",cRequired);
|
||||
for (count = 0; count < cRequired; ++count)
|
||||
TRACE("\t\t%s\n",debugstr_guid(&rgcatidReq[count]));
|
||||
}
|
||||
|
||||
if ((cImplemented && rgcatidImpl == NULL) ||
|
||||
(cRequired && rgcatidReq == NULL)) return E_POINTER;
|
||||
|
||||
res = StringFromGUID2(rclsid, keyname + 6, 39);
|
||||
if (FAILED(res)) return res;
|
||||
|
||||
categories = COMCAT_PrepareClassCategories(cImplemented, rgcatidImpl,
|
||||
cRequired, rgcatidReq);
|
||||
if (categories == NULL) return E_OUTOFMEMORY;
|
||||
|
||||
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &key);
|
||||
if (res == ERROR_SUCCESS) {
|
||||
res = COMCAT_IsClassOfCategories(key, categories);
|
||||
RegCloseKey(key);
|
||||
} else res = S_FALSE;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, categories);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatInformation_EnumImplCategoriesOfClass
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatInformation_EnumImplCategoriesOfClass(
|
||||
LPCATINFORMATION iface,
|
||||
REFCLSID rclsid,
|
||||
LPENUMCATID *ppenumCATID)
|
||||
{
|
||||
/* ICOM_THIS_MULTI(ComCatMgrImpl, infVtbl, iface); */
|
||||
static const WCHAR postfix[24] = { '\\', 'I', 'm', 'p', 'l', 'e', 'm', 'e',
|
||||
'n', 't', 'e', 'd', ' ', 'C', 'a', 't',
|
||||
'e', 'g', 'o', 'r', 'i', 'e', 's', 0 };
|
||||
|
||||
TRACE("\n\tCLSID:\t%s\n",debugstr_guid(rclsid));
|
||||
|
||||
if (iface == NULL || rclsid == NULL || ppenumCATID == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*ppenumCATID = COMCAT_CATID_IEnumGUID_Construct(rclsid, postfix);
|
||||
if (*ppenumCATID == NULL) return E_OUTOFMEMORY;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatInformation_EnumReqCategoriesOfClass
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatInformation_EnumReqCategoriesOfClass(
|
||||
LPCATINFORMATION iface,
|
||||
REFCLSID rclsid,
|
||||
LPENUMCATID *ppenumCATID)
|
||||
{
|
||||
/* ICOM_THIS_MULTI(ComCatMgrImpl, infVtbl, iface); */
|
||||
static const WCHAR postfix[21] = { '\\', 'R', 'e', 'q', 'u', 'i', 'r', 'e',
|
||||
'd', ' ', 'C', 'a', 't', 'e', 'g', 'o',
|
||||
'r', 'i', 'e', 's', 0 };
|
||||
|
||||
TRACE("\n\tCLSID:\t%s\n",debugstr_guid(rclsid));
|
||||
|
||||
if (iface == NULL || rclsid == NULL || ppenumCATID == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*ppenumCATID = COMCAT_CATID_IEnumGUID_Construct(rclsid, postfix);
|
||||
if (*ppenumCATID == NULL) return E_OUTOFMEMORY;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatInformation_Vtbl
|
||||
*/
|
||||
const ICatInformationVtbl COMCAT_ICatInformation_Vtbl =
|
||||
{
|
||||
COMCAT_ICatInformation_QueryInterface,
|
||||
COMCAT_ICatInformation_AddRef,
|
||||
COMCAT_ICatInformation_Release,
|
||||
COMCAT_ICatInformation_EnumCategories,
|
||||
COMCAT_ICatInformation_GetCategoryDesc,
|
||||
COMCAT_ICatInformation_EnumClassesOfCategories,
|
||||
COMCAT_ICatInformation_IsClassOfCategories,
|
||||
COMCAT_ICatInformation_EnumImplCategoriesOfClass,
|
||||
COMCAT_ICatInformation_EnumReqCategoriesOfClass
|
||||
};
|
||||
|
||||
/**********************************************************************
|
||||
* IEnumCATEGORYINFO implementation
|
||||
*
|
||||
* This implementation is not thread-safe. The manager itself is, but
|
||||
* I can't imagine a valid use of an enumerator in several threads.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const IEnumCATEGORYINFOVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
LCID lcid;
|
||||
HKEY key;
|
||||
DWORD next_index;
|
||||
} IEnumCATEGORYINFOImpl;
|
||||
|
||||
static ULONG WINAPI COMCAT_IEnumCATEGORYINFO_AddRef(LPENUMCATEGORYINFO iface)
|
||||
{
|
||||
IEnumCATEGORYINFOImpl *This = (IEnumCATEGORYINFOImpl *)iface;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_QueryInterface(
|
||||
LPENUMCATEGORYINFO iface,
|
||||
REFIID riid,
|
||||
LPVOID *ppvObj)
|
||||
{
|
||||
IEnumCATEGORYINFOImpl *This = (IEnumCATEGORYINFOImpl *)iface;
|
||||
TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
|
||||
|
||||
if (This == NULL || ppvObj == NULL) return E_POINTER;
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
||||
IsEqualGUID(riid, &IID_IEnumCATEGORYINFO))
|
||||
{
|
||||
*ppvObj = (LPVOID)iface;
|
||||
COMCAT_IEnumCATEGORYINFO_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI COMCAT_IEnumCATEGORYINFO_Release(LPENUMCATEGORYINFO iface)
|
||||
{
|
||||
IEnumCATEGORYINFOImpl *This = (IEnumCATEGORYINFOImpl *)iface;
|
||||
ULONG ref;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
ref = InterlockedDecrement(&This->ref);
|
||||
if (ref == 0) {
|
||||
if (This->key) RegCloseKey(This->key);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_Next(
|
||||
LPENUMCATEGORYINFO iface,
|
||||
ULONG celt,
|
||||
CATEGORYINFO *rgelt,
|
||||
ULONG *pceltFetched)
|
||||
{
|
||||
IEnumCATEGORYINFOImpl *This = (IEnumCATEGORYINFOImpl *)iface;
|
||||
ULONG fetched = 0;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL || rgelt == NULL) return E_POINTER;
|
||||
|
||||
if (This->key) while (fetched < celt) {
|
||||
HRESULT res;
|
||||
WCHAR catid[39];
|
||||
DWORD cName = 39;
|
||||
HKEY subkey;
|
||||
|
||||
res = RegEnumKeyExW(This->key, This->next_index, catid, &cName,
|
||||
NULL, NULL, NULL, NULL);
|
||||
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) break;
|
||||
++(This->next_index);
|
||||
|
||||
res = CLSIDFromString(catid, &rgelt->catid);
|
||||
if (FAILED(res)) continue;
|
||||
|
||||
res = RegOpenKeyExW(This->key, catid, 0, KEY_READ, &subkey);
|
||||
if (res != ERROR_SUCCESS) continue;
|
||||
|
||||
res = COMCAT_GetCategoryDesc(subkey, This->lcid,
|
||||
rgelt->szDescription, 128);
|
||||
RegCloseKey(subkey);
|
||||
if (FAILED(res)) continue;
|
||||
|
||||
rgelt->lcid = This->lcid;
|
||||
++fetched;
|
||||
++rgelt;
|
||||
}
|
||||
|
||||
if (pceltFetched) *pceltFetched = fetched;
|
||||
return fetched == celt ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_Skip(
|
||||
LPENUMCATEGORYINFO iface,
|
||||
ULONG celt)
|
||||
{
|
||||
IEnumCATEGORYINFOImpl *This = (IEnumCATEGORYINFOImpl *)iface;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
This->next_index += celt;
|
||||
/* This should return S_FALSE when there aren't celt elems to skip. */
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_Reset(LPENUMCATEGORYINFO iface)
|
||||
{
|
||||
IEnumCATEGORYINFOImpl *This = (IEnumCATEGORYINFOImpl *)iface;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
This->next_index = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_Clone(
|
||||
LPENUMCATEGORYINFO iface,
|
||||
IEnumCATEGORYINFO **ppenum)
|
||||
{
|
||||
IEnumCATEGORYINFOImpl *This = (IEnumCATEGORYINFOImpl *)iface;
|
||||
static const WCHAR keyname[] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
|
||||
't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
|
||||
'r', 'i', 'e', 's', 0 };
|
||||
IEnumCATEGORYINFOImpl *new_this;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL || ppenum == NULL) return E_POINTER;
|
||||
|
||||
new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl));
|
||||
if (new_this == NULL) return E_OUTOFMEMORY;
|
||||
|
||||
new_this->lpVtbl = This->lpVtbl;
|
||||
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);
|
||||
new_this->next_index = This->next_index;
|
||||
|
||||
*ppenum = (LPENUMCATEGORYINFO)new_this;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IEnumCATEGORYINFOVtbl COMCAT_IEnumCATEGORYINFO_Vtbl =
|
||||
{
|
||||
COMCAT_IEnumCATEGORYINFO_QueryInterface,
|
||||
COMCAT_IEnumCATEGORYINFO_AddRef,
|
||||
COMCAT_IEnumCATEGORYINFO_Release,
|
||||
COMCAT_IEnumCATEGORYINFO_Next,
|
||||
COMCAT_IEnumCATEGORYINFO_Skip,
|
||||
COMCAT_IEnumCATEGORYINFO_Reset,
|
||||
COMCAT_IEnumCATEGORYINFO_Clone
|
||||
};
|
||||
|
||||
static LPENUMCATEGORYINFO COMCAT_IEnumCATEGORYINFO_Construct(LCID lcid)
|
||||
{
|
||||
IEnumCATEGORYINFOImpl *This;
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl));
|
||||
if (This) {
|
||||
static const WCHAR keyname[] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
|
||||
't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
|
||||
'r', 'i', 'e', 's', 0 };
|
||||
|
||||
This->lpVtbl = &COMCAT_IEnumCATEGORYINFO_Vtbl;
|
||||
This->lcid = lcid;
|
||||
RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &This->key);
|
||||
}
|
||||
return (LPENUMCATEGORYINFO)This;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_GetCategoryDesc
|
||||
*/
|
||||
static HRESULT COMCAT_GetCategoryDesc(HKEY key, LCID lcid, PWCHAR pszDesc,
|
||||
ULONG buf_wchars)
|
||||
{
|
||||
static const WCHAR fmt[] = { '%', 'l', 'X', 0 };
|
||||
WCHAR valname[5];
|
||||
HRESULT res;
|
||||
DWORD type, size = (buf_wchars - 1) * sizeof(WCHAR);
|
||||
|
||||
if (pszDesc == NULL) return E_INVALIDARG;
|
||||
|
||||
/* FIXME: lcid comparisons are more complex than this! */
|
||||
wsprintfW(valname, fmt, lcid);
|
||||
res = RegQueryValueExW(key, valname, 0, &type, (LPBYTE)pszDesc, &size);
|
||||
if (res != ERROR_SUCCESS || type != REG_SZ) {
|
||||
FIXME("Simplified lcid comparison\n");
|
||||
return CAT_E_NODESCRIPTION;
|
||||
}
|
||||
pszDesc[size / sizeof(WCHAR)] = (WCHAR)0;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_PrepareClassCategories
|
||||
*/
|
||||
static struct class_categories *COMCAT_PrepareClassCategories(
|
||||
ULONG impl_count, const CATID *impl_catids, ULONG req_count, const CATID *req_catids)
|
||||
{
|
||||
struct class_categories *categories;
|
||||
WCHAR *strings;
|
||||
|
||||
categories = HeapAlloc(
|
||||
GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(struct class_categories) +
|
||||
((impl_count + req_count) * 39 + 2) * sizeof(WCHAR));
|
||||
if (categories == NULL) return categories;
|
||||
|
||||
strings = (WCHAR *)(categories + 1);
|
||||
categories->impl_strings = strings;
|
||||
while (impl_count--) {
|
||||
StringFromGUID2(impl_catids++, strings, 39);
|
||||
strings += 39;
|
||||
}
|
||||
*strings++ = 0;
|
||||
|
||||
categories->req_strings = strings;
|
||||
while (req_count--) {
|
||||
StringFromGUID2(req_catids++, strings, 39);
|
||||
strings += 39;
|
||||
}
|
||||
*strings++ = 0;
|
||||
|
||||
return categories;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_IsClassOfCategories
|
||||
*/
|
||||
static HRESULT COMCAT_IsClassOfCategories(
|
||||
HKEY key,
|
||||
struct class_categories const* categories)
|
||||
{
|
||||
static const WCHAR impl_keyname[] = { 'I', 'm', 'p', 'l', 'e', 'm', 'e', 'n',
|
||||
't', 'e', 'd', ' ', 'C', 'a', 't', 'e',
|
||||
'g', 'o', 'r', 'i', 'e', 's', 0 };
|
||||
static const WCHAR req_keyname[] = { 'R', 'e', 'q', 'u', 'i', 'r', 'e', 'd',
|
||||
' ', 'C', 'a', 't', 'e', 'g', 'o', 'r',
|
||||
'i', 'e', 's', 0 };
|
||||
HKEY subkey;
|
||||
HRESULT res;
|
||||
DWORD index;
|
||||
LPCWSTR string;
|
||||
|
||||
/* Check that every given category is implemented by class. */
|
||||
res = RegOpenKeyExW(key, impl_keyname, 0, 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);
|
||||
if (res != ERROR_SUCCESS) {
|
||||
RegCloseKey(subkey);
|
||||
return S_FALSE;
|
||||
}
|
||||
RegCloseKey(catkey);
|
||||
}
|
||||
RegCloseKey(subkey);
|
||||
|
||||
/* Check that all categories required by class are given. */
|
||||
res = RegOpenKeyExW(key, req_keyname, 0, KEY_READ, &subkey);
|
||||
if (res == ERROR_SUCCESS) {
|
||||
for (index = 0; ; ++index) {
|
||||
WCHAR keyname[39];
|
||||
DWORD size = 39;
|
||||
|
||||
res = RegEnumKeyExW(subkey, index, keyname, &size,
|
||||
NULL, NULL, NULL, NULL);
|
||||
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) break;
|
||||
if (size != 38) continue; /* bogus catid in registry */
|
||||
for (string = categories->req_strings; *string; string += 39)
|
||||
if (!strcmpiW(string, keyname)) break;
|
||||
if (!*string) {
|
||||
RegCloseKey(subkey);
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
RegCloseKey(subkey);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* ClassesOfCategories IEnumCLSID (IEnumGUID) implementation
|
||||
*
|
||||
* This implementation is not thread-safe. The manager itself is, but
|
||||
* I can't imagine a valid use of an enumerator in several threads.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const IEnumGUIDVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
struct class_categories *categories;
|
||||
HKEY key;
|
||||
DWORD next_index;
|
||||
} CLSID_IEnumGUIDImpl;
|
||||
|
||||
static ULONG WINAPI COMCAT_CLSID_IEnumGUID_AddRef(LPENUMGUID iface)
|
||||
{
|
||||
CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface;
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_QueryInterface(
|
||||
LPENUMGUID iface,
|
||||
REFIID riid,
|
||||
LPVOID *ppvObj)
|
||||
{
|
||||
CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface;
|
||||
TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
|
||||
|
||||
if (This == NULL || ppvObj == NULL) return E_POINTER;
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
||||
IsEqualGUID(riid, &IID_IEnumGUID))
|
||||
{
|
||||
*ppvObj = (LPVOID)iface;
|
||||
COMCAT_CLSID_IEnumGUID_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI COMCAT_CLSID_IEnumGUID_Release(LPENUMGUID iface)
|
||||
{
|
||||
CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface;
|
||||
ULONG ref;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
ref = InterlockedDecrement(&This->ref);
|
||||
if (ref == 0) {
|
||||
if (This->key) RegCloseKey(This->key);
|
||||
HeapFree(GetProcessHeap(), 0, (LPVOID)This->categories);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Next(
|
||||
LPENUMGUID iface,
|
||||
ULONG celt,
|
||||
GUID *rgelt,
|
||||
ULONG *pceltFetched)
|
||||
{
|
||||
CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface;
|
||||
ULONG fetched = 0;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL || rgelt == NULL) return E_POINTER;
|
||||
|
||||
if (This->key) while (fetched < celt) {
|
||||
HRESULT res;
|
||||
WCHAR clsid[39];
|
||||
DWORD cName = 39;
|
||||
HKEY subkey;
|
||||
|
||||
res = RegEnumKeyExW(This->key, This->next_index, clsid, &cName,
|
||||
NULL, NULL, NULL, NULL);
|
||||
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) break;
|
||||
++(This->next_index);
|
||||
|
||||
res = CLSIDFromString(clsid, rgelt);
|
||||
if (FAILED(res)) continue;
|
||||
|
||||
res = RegOpenKeyExW(This->key, clsid, 0, KEY_READ, &subkey);
|
||||
if (res != ERROR_SUCCESS) continue;
|
||||
|
||||
res = COMCAT_IsClassOfCategories(subkey, This->categories);
|
||||
RegCloseKey(subkey);
|
||||
if (res != S_OK) continue;
|
||||
|
||||
++fetched;
|
||||
++rgelt;
|
||||
}
|
||||
|
||||
if (pceltFetched) *pceltFetched = fetched;
|
||||
return fetched == celt ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Skip(
|
||||
LPENUMGUID iface,
|
||||
ULONG celt)
|
||||
{
|
||||
CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
This->next_index += celt;
|
||||
FIXME("Never returns S_FALSE\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Reset(LPENUMGUID iface)
|
||||
{
|
||||
CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
This->next_index = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Clone(
|
||||
LPENUMGUID iface,
|
||||
IEnumGUID **ppenum)
|
||||
{
|
||||
CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface;
|
||||
static const WCHAR keyname[] = { 'C', 'L', 'S', 'I', 'D', 0 };
|
||||
CLSID_IEnumGUIDImpl *new_this;
|
||||
DWORD size;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL || ppenum == NULL) return E_POINTER;
|
||||
|
||||
new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl));
|
||||
if (new_this == NULL) return E_OUTOFMEMORY;
|
||||
|
||||
new_this->lpVtbl = This->lpVtbl;
|
||||
new_this->ref = 1;
|
||||
size = HeapSize(GetProcessHeap(), 0, (LPVOID)This->categories);
|
||||
new_this->categories =
|
||||
HeapAlloc(GetProcessHeap(), 0, size);
|
||||
if (new_this->categories == NULL) {
|
||||
HeapFree(GetProcessHeap(), 0, new_this);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
memcpy((LPVOID)new_this->categories, This->categories, size);
|
||||
/* FIXME: could we more efficiently use DuplicateHandle? */
|
||||
RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &new_this->key);
|
||||
new_this->next_index = This->next_index;
|
||||
|
||||
*ppenum = (LPENUMGUID)new_this;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IEnumGUIDVtbl COMCAT_CLSID_IEnumGUID_Vtbl =
|
||||
{
|
||||
COMCAT_CLSID_IEnumGUID_QueryInterface,
|
||||
COMCAT_CLSID_IEnumGUID_AddRef,
|
||||
COMCAT_CLSID_IEnumGUID_Release,
|
||||
COMCAT_CLSID_IEnumGUID_Next,
|
||||
COMCAT_CLSID_IEnumGUID_Skip,
|
||||
COMCAT_CLSID_IEnumGUID_Reset,
|
||||
COMCAT_CLSID_IEnumGUID_Clone
|
||||
};
|
||||
|
||||
static LPENUMGUID COMCAT_CLSID_IEnumGUID_Construct(struct class_categories *categories)
|
||||
{
|
||||
CLSID_IEnumGUIDImpl *This;
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl));
|
||||
if (This) {
|
||||
static const WCHAR keyname[] = { 'C', 'L', 'S', 'I', 'D', 0 };
|
||||
|
||||
This->lpVtbl = &COMCAT_CLSID_IEnumGUID_Vtbl;
|
||||
This->categories = categories;
|
||||
RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &This->key);
|
||||
}
|
||||
return (LPENUMGUID)This;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* CategoriesOfClass IEnumCATID (IEnumGUID) implementation
|
||||
*
|
||||
* This implementation is not thread-safe. The manager itself is, but
|
||||
* I can't imagine a valid use of an enumerator in several threads.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const IEnumGUIDVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
WCHAR keyname[68];
|
||||
HKEY key;
|
||||
DWORD next_index;
|
||||
} CATID_IEnumGUIDImpl;
|
||||
|
||||
static ULONG WINAPI COMCAT_CATID_IEnumGUID_AddRef(LPENUMGUID iface)
|
||||
{
|
||||
CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface;
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_CATID_IEnumGUID_QueryInterface(
|
||||
LPENUMGUID iface,
|
||||
REFIID riid,
|
||||
LPVOID *ppvObj)
|
||||
{
|
||||
CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface;
|
||||
TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
|
||||
|
||||
if (This == NULL || ppvObj == NULL) return E_POINTER;
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
||||
IsEqualGUID(riid, &IID_IEnumGUID))
|
||||
{
|
||||
*ppvObj = (LPVOID)iface;
|
||||
COMCAT_CATID_IEnumGUID_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI COMCAT_CATID_IEnumGUID_Release(LPENUMGUID iface)
|
||||
{
|
||||
CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface;
|
||||
ULONG ref;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
ref = InterlockedDecrement(&This->ref);
|
||||
if (ref == 0) {
|
||||
if (This->key) RegCloseKey(This->key);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Next(
|
||||
LPENUMGUID iface,
|
||||
ULONG celt,
|
||||
GUID *rgelt,
|
||||
ULONG *pceltFetched)
|
||||
{
|
||||
CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface;
|
||||
ULONG fetched = 0;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL || rgelt == NULL) return E_POINTER;
|
||||
|
||||
if (This->key) while (fetched < celt) {
|
||||
HRESULT res;
|
||||
WCHAR catid[39];
|
||||
DWORD cName = 39;
|
||||
|
||||
res = RegEnumKeyExW(This->key, This->next_index, catid, &cName,
|
||||
NULL, NULL, NULL, NULL);
|
||||
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) break;
|
||||
++(This->next_index);
|
||||
|
||||
res = CLSIDFromString(catid, rgelt);
|
||||
if (FAILED(res)) continue;
|
||||
|
||||
++fetched;
|
||||
++rgelt;
|
||||
}
|
||||
|
||||
if (pceltFetched) *pceltFetched = fetched;
|
||||
return fetched == celt ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Skip(
|
||||
LPENUMGUID iface,
|
||||
ULONG celt)
|
||||
{
|
||||
CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
This->next_index += celt;
|
||||
FIXME("Never returns S_FALSE\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Reset(LPENUMGUID iface)
|
||||
{
|
||||
CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
This->next_index = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Clone(
|
||||
LPENUMGUID iface,
|
||||
IEnumGUID **ppenum)
|
||||
{
|
||||
CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface;
|
||||
CATID_IEnumGUIDImpl *new_this;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL || ppenum == NULL) return E_POINTER;
|
||||
|
||||
new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl));
|
||||
if (new_this == NULL) return E_OUTOFMEMORY;
|
||||
|
||||
new_this->lpVtbl = This->lpVtbl;
|
||||
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);
|
||||
new_this->next_index = This->next_index;
|
||||
|
||||
*ppenum = (LPENUMGUID)new_this;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IEnumGUIDVtbl COMCAT_CATID_IEnumGUID_Vtbl =
|
||||
{
|
||||
COMCAT_CATID_IEnumGUID_QueryInterface,
|
||||
COMCAT_CATID_IEnumGUID_AddRef,
|
||||
COMCAT_CATID_IEnumGUID_Release,
|
||||
COMCAT_CATID_IEnumGUID_Next,
|
||||
COMCAT_CATID_IEnumGUID_Skip,
|
||||
COMCAT_CATID_IEnumGUID_Reset,
|
||||
COMCAT_CATID_IEnumGUID_Clone
|
||||
};
|
||||
|
||||
static LPENUMGUID COMCAT_CATID_IEnumGUID_Construct(
|
||||
REFCLSID rclsid, LPCWSTR postfix)
|
||||
{
|
||||
CATID_IEnumGUIDImpl *This;
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl));
|
||||
if (This) {
|
||||
WCHAR prefix[6] = { 'C', 'L', 'S', 'I', 'D', '\\' };
|
||||
|
||||
This->lpVtbl = &COMCAT_CATID_IEnumGUID_Vtbl;
|
||||
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);
|
||||
}
|
||||
return (LPENUMGUID)This;
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
/*
|
||||
* ComCatMgr IUnknown implementation for comcat.dll
|
||||
*
|
||||
* Copyright (C) 2002 John K. Hohm
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "comcat_private.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
static ULONG WINAPI COMCAT_IUnknown_AddRef(LPUNKNOWN iface);
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_IUnknown_QueryInterface
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_IUnknown_QueryInterface(
|
||||
LPUNKNOWN iface,
|
||||
REFIID riid,
|
||||
LPVOID *ppvObj)
|
||||
{
|
||||
ICOM_THIS_MULTI(ComCatMgrImpl, unkVtbl, iface);
|
||||
TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
|
||||
|
||||
if (This == NULL || ppvObj == NULL) return E_POINTER;
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)) {
|
||||
*ppvObj = &This->unkVtbl;
|
||||
COMCAT_IUnknown_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (IsEqualGUID(riid, &IID_ICatRegister)) {
|
||||
*ppvObj = &This->regVtbl;
|
||||
COMCAT_IUnknown_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (IsEqualGUID(riid, &IID_ICatInformation)) {
|
||||
*ppvObj = &This->infVtbl;
|
||||
COMCAT_IUnknown_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_IUnknown_AddRef
|
||||
*/
|
||||
static ULONG WINAPI COMCAT_IUnknown_AddRef(LPUNKNOWN iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(ComCatMgrImpl, unkVtbl, iface);
|
||||
ULONG ref;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
ref = InterlockedIncrement(&This->ref);
|
||||
if (ref == 1) {
|
||||
InterlockedIncrement(&dll_ref);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_IUnknown_Release
|
||||
*/
|
||||
static ULONG WINAPI COMCAT_IUnknown_Release(LPUNKNOWN iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(ComCatMgrImpl, unkVtbl, iface);
|
||||
ULONG ref;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
ref = InterlockedDecrement(&This->ref);
|
||||
if (ref == 0) {
|
||||
InterlockedDecrement(&dll_ref);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_IUnknown_Vtbl
|
||||
*/
|
||||
static const IUnknownVtbl COMCAT_IUnknown_Vtbl =
|
||||
{
|
||||
COMCAT_IUnknown_QueryInterface,
|
||||
COMCAT_IUnknown_AddRef,
|
||||
COMCAT_IUnknown_Release
|
||||
};
|
||||
|
||||
/**********************************************************************
|
||||
* static ComCatMgr instance
|
||||
*/
|
||||
ComCatMgrImpl COMCAT_ComCatMgr =
|
||||
{
|
||||
&COMCAT_IUnknown_Vtbl,
|
||||
&COMCAT_ICatRegister_Vtbl,
|
||||
&COMCAT_ICatInformation_Vtbl,
|
||||
0
|
||||
};
|
|
@ -1,342 +0,0 @@
|
|||
/*
|
||||
* ComCatMgr ICatRegister implementation for comcat.dll
|
||||
*
|
||||
* Copyright (C) 2002 John K. Hohm
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "comcat_private.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
/**********************************************************************
|
||||
* File-scope string constants
|
||||
*/
|
||||
static const WCHAR comcat_keyname[21] = {
|
||||
'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n', 't', ' ', 'C', 'a',
|
||||
't', 'e', 'g', 'o', 'r', 'i', 'e', 's', 0 };
|
||||
static const WCHAR impl_keyname[23] = {
|
||||
'I', 'm', 'p', 'l', 'e', 'm', 'e', 'n',
|
||||
't', 'e', 'd', ' ', 'C', 'a', 't', 'e',
|
||||
'g', 'o', 'r', 'i', 'e', 's', 0 };
|
||||
static const WCHAR req_keyname[20] = {
|
||||
'R', 'e', 'q', 'u', 'i', 'r', 'e', 'd',
|
||||
' ', 'C', 'a', 't', 'e', 'g', 'o', 'r',
|
||||
'i', 'e', 's', 0 };
|
||||
|
||||
static HRESULT COMCAT_RegisterClassCategories(
|
||||
REFCLSID rclsid, LPCWSTR type,
|
||||
ULONG cCategories, const CATID *rgcatid);
|
||||
static HRESULT COMCAT_UnRegisterClassCategories(
|
||||
REFCLSID rclsid, LPCWSTR type,
|
||||
ULONG cCategories, const CATID *rgcatid);
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatRegister_QueryInterface
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatRegister_QueryInterface(
|
||||
LPCATREGISTER iface,
|
||||
REFIID riid,
|
||||
LPVOID *ppvObj)
|
||||
{
|
||||
ICOM_THIS_MULTI(ComCatMgrImpl, regVtbl, iface);
|
||||
TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
|
||||
|
||||
if (This == NULL || ppvObj == NULL) return E_POINTER;
|
||||
|
||||
return IUnknown_QueryInterface((LPUNKNOWN)&This->unkVtbl, riid, ppvObj);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatRegister_AddRef
|
||||
*/
|
||||
static ULONG WINAPI COMCAT_ICatRegister_AddRef(LPCATREGISTER iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(ComCatMgrImpl, regVtbl, iface);
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
return IUnknown_AddRef((LPUNKNOWN)&This->unkVtbl);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatRegister_Release
|
||||
*/
|
||||
static ULONG WINAPI COMCAT_ICatRegister_Release(LPCATREGISTER iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(ComCatMgrImpl, regVtbl, iface);
|
||||
TRACE("\n");
|
||||
|
||||
if (This == NULL) return E_POINTER;
|
||||
|
||||
return IUnknown_Release((LPUNKNOWN)&This->unkVtbl);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatRegister_RegisterCategories
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatRegister_RegisterCategories(
|
||||
LPCATREGISTER iface,
|
||||
ULONG cCategories,
|
||||
CATEGORYINFO *rgci)
|
||||
{
|
||||
/* ICOM_THIS_MULTI(ComCatMgrImpl, regVtbl, iface); */
|
||||
HKEY comcat_key;
|
||||
HRESULT res;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (iface == NULL || (cCategories && rgci == NULL))
|
||||
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);
|
||||
if (res != ERROR_SUCCESS) return E_FAIL;
|
||||
|
||||
for (; cCategories; --cCategories, ++rgci) {
|
||||
static const WCHAR fmt[] = { '%', 'l', 'X', 0 };
|
||||
WCHAR keyname[39];
|
||||
WCHAR valname[9];
|
||||
HKEY cat_key;
|
||||
|
||||
/* 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);
|
||||
if (res != ERROR_SUCCESS) continue;
|
||||
|
||||
/* Set the value for this locale's description. */
|
||||
wsprintfW(valname, fmt, rgci->lcid);
|
||||
RegSetValueExW(cat_key, valname, 0, REG_SZ,
|
||||
(CONST BYTE*)(rgci->szDescription),
|
||||
(lstrlenW(rgci->szDescription) + 1) * sizeof(WCHAR));
|
||||
|
||||
RegCloseKey(cat_key);
|
||||
}
|
||||
|
||||
RegCloseKey(comcat_key);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatRegister_UnRegisterCategories
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatRegister_UnRegisterCategories(
|
||||
LPCATREGISTER iface,
|
||||
ULONG cCategories,
|
||||
CATID *rgcatid)
|
||||
{
|
||||
/* ICOM_THIS_MULTI(ComCatMgrImpl, regVtbl, iface); */
|
||||
HKEY comcat_key;
|
||||
HRESULT res;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (iface == NULL || (cCategories && rgcatid == NULL))
|
||||
return E_POINTER;
|
||||
|
||||
/* Open the component categories key. */
|
||||
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, comcat_keyname, 0,
|
||||
KEY_READ | KEY_WRITE, &comcat_key);
|
||||
if (res != ERROR_SUCCESS) return E_FAIL;
|
||||
|
||||
for (; cCategories; --cCategories, ++rgcatid) {
|
||||
WCHAR keyname[39];
|
||||
|
||||
/* Delete the key for this category. */
|
||||
if (!StringFromGUID2(rgcatid, keyname, 39)) continue;
|
||||
RegDeleteKeyW(comcat_key, keyname);
|
||||
}
|
||||
|
||||
RegCloseKey(comcat_key);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatRegister_RegisterClassImplCategories
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatRegister_RegisterClassImplCategories(
|
||||
LPCATREGISTER iface,
|
||||
REFCLSID rclsid,
|
||||
ULONG cCategories,
|
||||
CATID *rgcatid)
|
||||
{
|
||||
/* ICOM_THIS_MULTI(ComCatMgrImpl, regVtbl, iface); */
|
||||
TRACE("\n");
|
||||
|
||||
return COMCAT_RegisterClassCategories(
|
||||
rclsid, impl_keyname, cCategories, rgcatid);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatRegister_UnRegisterClassImplCategories
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatRegister_UnRegisterClassImplCategories(
|
||||
LPCATREGISTER iface,
|
||||
REFCLSID rclsid,
|
||||
ULONG cCategories,
|
||||
CATID *rgcatid)
|
||||
{
|
||||
/* ICOM_THIS_MULTI(ComCatMgrImpl, regVtbl, iface); */
|
||||
TRACE("\n");
|
||||
|
||||
return COMCAT_UnRegisterClassCategories(
|
||||
rclsid, impl_keyname, cCategories, rgcatid);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatRegister_RegisterClassReqCategories
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatRegister_RegisterClassReqCategories(
|
||||
LPCATREGISTER iface,
|
||||
REFCLSID rclsid,
|
||||
ULONG cCategories,
|
||||
CATID *rgcatid)
|
||||
{
|
||||
/* ICOM_THIS_MULTI(ComCatMgrImpl, regVtbl, iface); */
|
||||
TRACE("\n");
|
||||
|
||||
return COMCAT_RegisterClassCategories(
|
||||
rclsid, req_keyname, cCategories, rgcatid);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatRegister_UnRegisterClassReqCategories
|
||||
*/
|
||||
static HRESULT WINAPI COMCAT_ICatRegister_UnRegisterClassReqCategories(
|
||||
LPCATREGISTER iface,
|
||||
REFCLSID rclsid,
|
||||
ULONG cCategories,
|
||||
CATID *rgcatid)
|
||||
{
|
||||
/* ICOM_THIS_MULTI(ComCatMgrImpl, regVtbl, iface); */
|
||||
TRACE("\n");
|
||||
|
||||
return COMCAT_UnRegisterClassCategories(
|
||||
rclsid, req_keyname, cCategories, rgcatid);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_ICatRegister_Vtbl
|
||||
*/
|
||||
const ICatRegisterVtbl COMCAT_ICatRegister_Vtbl =
|
||||
{
|
||||
COMCAT_ICatRegister_QueryInterface,
|
||||
COMCAT_ICatRegister_AddRef,
|
||||
COMCAT_ICatRegister_Release,
|
||||
COMCAT_ICatRegister_RegisterCategories,
|
||||
COMCAT_ICatRegister_UnRegisterCategories,
|
||||
COMCAT_ICatRegister_RegisterClassImplCategories,
|
||||
COMCAT_ICatRegister_UnRegisterClassImplCategories,
|
||||
COMCAT_ICatRegister_RegisterClassReqCategories,
|
||||
COMCAT_ICatRegister_UnRegisterClassReqCategories
|
||||
};
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_RegisterClassCategories
|
||||
*/
|
||||
static HRESULT COMCAT_RegisterClassCategories(
|
||||
REFCLSID rclsid,
|
||||
LPCWSTR type,
|
||||
ULONG cCategories,
|
||||
const CATID *rgcatid)
|
||||
{
|
||||
WCHAR keyname[39];
|
||||
HRESULT res;
|
||||
HKEY clsid_key, class_key, type_key;
|
||||
|
||||
if (cCategories && rgcatid == NULL) return E_POINTER;
|
||||
|
||||
/* Format the class key name. */
|
||||
res = StringFromGUID2(rclsid, keyname, 39);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
if (res == ERROR_SUCCESS) {
|
||||
for (; cCategories; --cCategories, ++rgcatid) {
|
||||
HKEY key;
|
||||
|
||||
/* Format the category key name. */
|
||||
res = StringFromGUID2(rgcatid, keyname, 39);
|
||||
if (FAILED(res)) continue;
|
||||
|
||||
/* Do the register. */
|
||||
res = RegCreateKeyExW(type_key, keyname, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &key, NULL);
|
||||
if (res == ERROR_SUCCESS) RegCloseKey(key);
|
||||
}
|
||||
res = S_OK;
|
||||
} else res = E_FAIL;
|
||||
RegCloseKey(class_key);
|
||||
} else res = E_FAIL;
|
||||
RegCloseKey(clsid_key);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* COMCAT_UnRegisterClassCategories
|
||||
*/
|
||||
static HRESULT COMCAT_UnRegisterClassCategories(
|
||||
REFCLSID rclsid,
|
||||
LPCWSTR type,
|
||||
ULONG cCategories,
|
||||
const CATID *rgcatid)
|
||||
{
|
||||
WCHAR keyname[68] = { 'C', 'L', 'S', 'I', 'D', '\\' };
|
||||
HRESULT res;
|
||||
HKEY type_key;
|
||||
|
||||
if (cCategories && rgcatid == NULL) return E_POINTER;
|
||||
|
||||
/* Format the class category type key name. */
|
||||
res = StringFromGUID2(rclsid, keyname + 6, 39);
|
||||
if (FAILED(res)) return res;
|
||||
keyname[44] = '\\';
|
||||
lstrcpyW(keyname + 45, type);
|
||||
|
||||
/* Open the class category type key. */
|
||||
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0,
|
||||
KEY_READ | KEY_WRITE, &type_key);
|
||||
if (res != ERROR_SUCCESS) return E_FAIL;
|
||||
|
||||
for (; cCategories; --cCategories, ++rgcatid) {
|
||||
/* Format the category key name. */
|
||||
res = StringFromGUID2(rgcatid, keyname, 39);
|
||||
if (FAILED(res)) continue;
|
||||
|
||||
/* Do the unregister. */
|
||||
RegDeleteKeyW(type_key, keyname);
|
||||
}
|
||||
RegCloseKey(type_key);
|
||||
|
||||
return S_OK;
|
||||
}
|
|
@ -1,418 +0,0 @@
|
|||
/*
|
||||
* self-registerable dll functions for comcat.dll
|
||||
*
|
||||
* Copyright (C) 2002-2003 John K. Hohm
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "winreg.h"
|
||||
#include "winerror.h"
|
||||
|
||||
#include "ole2.h"
|
||||
#include "comcat.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
/*
|
||||
* Near the bottom of this file are the exported DllRegisterServer and
|
||||
* DllUnregisterServer, which make all this worthwhile.
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
* interface for self-registering
|
||||
*/
|
||||
struct regsvr_interface
|
||||
{
|
||||
IID const *iid; /* NULL for end of list */
|
||||
LPCSTR name; /* can be NULL to omit */
|
||||
IID const *base_iid; /* can be NULL to omit */
|
||||
int num_methods; /* can be <0 to omit */
|
||||
CLSID const *ps_clsid; /* can be NULL to omit */
|
||||
CLSID const *ps_clsid32; /* can be NULL to omit */
|
||||
};
|
||||
|
||||
static HRESULT register_interfaces(struct regsvr_interface const *list);
|
||||
static HRESULT unregister_interfaces(struct regsvr_interface const *list);
|
||||
|
||||
struct regsvr_coclass
|
||||
{
|
||||
CLSID const *clsid; /* NULL for end of list */
|
||||
LPCSTR name; /* can be NULL to omit */
|
||||
LPCSTR ips; /* can be NULL to omit */
|
||||
LPCSTR ips32; /* can be NULL to omit */
|
||||
LPCSTR ips32_tmodel; /* can be NULL to omit */
|
||||
};
|
||||
|
||||
static HRESULT register_coclasses(struct regsvr_coclass const *list);
|
||||
static HRESULT unregister_coclasses(struct regsvr_coclass const *list);
|
||||
|
||||
/***********************************************************************
|
||||
* static string constants
|
||||
*/
|
||||
static WCHAR const interface_keyname[10] = {
|
||||
'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 };
|
||||
static WCHAR const base_ifa_keyname[14] = {
|
||||
'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c',
|
||||
'e', 0 };
|
||||
static WCHAR const num_methods_keyname[11] = {
|
||||
'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 };
|
||||
static WCHAR const ps_clsid_keyname[15] = {
|
||||
'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
|
||||
'i', 'd', 0 };
|
||||
static WCHAR const ps_clsid32_keyname[17] = {
|
||||
'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
|
||||
'i', 'd', '3', '2', 0 };
|
||||
static WCHAR const clsid_keyname[6] = {
|
||||
'C', 'L', 'S', 'I', 'D', 0 };
|
||||
static WCHAR const ips_keyname[13] = {
|
||||
'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
|
||||
0 };
|
||||
static WCHAR const ips32_keyname[15] = {
|
||||
'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
|
||||
'3', '2', 0 };
|
||||
static char const tmodel_valuename[] = "ThreadingModel";
|
||||
|
||||
/***********************************************************************
|
||||
* static helper functions
|
||||
*/
|
||||
static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid);
|
||||
static LONG register_key_defvalueW(HKEY base, WCHAR const *name,
|
||||
WCHAR const *value);
|
||||
static LONG register_key_defvalueA(HKEY base, WCHAR const *name,
|
||||
char const *value);
|
||||
|
||||
/***********************************************************************
|
||||
* register_interfaces
|
||||
*/
|
||||
static HRESULT register_interfaces(struct regsvr_interface const *list)
|
||||
{
|
||||
LONG res = ERROR_SUCCESS;
|
||||
HKEY interface_key;
|
||||
|
||||
res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &interface_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_return;
|
||||
|
||||
for (; res == ERROR_SUCCESS && list->iid; ++list) {
|
||||
WCHAR buf[39];
|
||||
HKEY iid_key;
|
||||
|
||||
StringFromGUID2(list->iid, buf, 39);
|
||||
res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &iid_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_interface_key;
|
||||
|
||||
if (list->name) {
|
||||
res = RegSetValueExA(iid_key, NULL, 0, REG_SZ,
|
||||
(CONST BYTE*)(list->name),
|
||||
strlen(list->name) + 1);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
}
|
||||
|
||||
if (list->base_iid) {
|
||||
res = register_key_guid(iid_key, base_ifa_keyname, list->base_iid);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
}
|
||||
|
||||
if (0 <= list->num_methods) {
|
||||
static WCHAR const fmt[3] = { '%', 'd', 0 };
|
||||
HKEY key;
|
||||
|
||||
res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
|
||||
wsprintfW(buf, fmt, list->num_methods);
|
||||
res = RegSetValueExW(key, NULL, 0, REG_SZ,
|
||||
(CONST BYTE*)buf,
|
||||
(lstrlenW(buf) + 1) * sizeof(WCHAR));
|
||||
RegCloseKey(key);
|
||||
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
}
|
||||
|
||||
if (list->ps_clsid) {
|
||||
res = register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
}
|
||||
|
||||
if (list->ps_clsid32) {
|
||||
res = register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
}
|
||||
|
||||
error_close_iid_key:
|
||||
RegCloseKey(iid_key);
|
||||
}
|
||||
|
||||
error_close_interface_key:
|
||||
RegCloseKey(interface_key);
|
||||
error_return:
|
||||
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* unregister_interfaces
|
||||
*/
|
||||
static HRESULT unregister_interfaces(struct regsvr_interface const *list)
|
||||
{
|
||||
LONG res = ERROR_SUCCESS;
|
||||
HKEY interface_key;
|
||||
|
||||
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0,
|
||||
KEY_READ | KEY_WRITE, &interface_key);
|
||||
if (res == ERROR_FILE_NOT_FOUND) return S_OK;
|
||||
if (res != ERROR_SUCCESS) goto error_return;
|
||||
|
||||
for (; res == ERROR_SUCCESS && list->iid; ++list) {
|
||||
WCHAR buf[39];
|
||||
|
||||
StringFromGUID2(list->iid, buf, 39);
|
||||
res = RegDeleteTreeW(interface_key, buf);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
RegCloseKey(interface_key);
|
||||
error_return:
|
||||
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* register_coclasses
|
||||
*/
|
||||
static HRESULT register_coclasses(struct regsvr_coclass const *list)
|
||||
{
|
||||
LONG res = ERROR_SUCCESS;
|
||||
HKEY coclass_key;
|
||||
|
||||
res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_return;
|
||||
|
||||
for (; res == ERROR_SUCCESS && list->clsid; ++list) {
|
||||
WCHAR buf[39];
|
||||
HKEY clsid_key;
|
||||
|
||||
StringFromGUID2(list->clsid, buf, 39);
|
||||
res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
|
||||
|
||||
if (list->name) {
|
||||
res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ,
|
||||
(CONST BYTE*)(list->name),
|
||||
strlen(list->name) + 1);
|
||||
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
|
||||
}
|
||||
|
||||
if (list->ips) {
|
||||
res = register_key_defvalueA(clsid_key, ips_keyname, list->ips);
|
||||
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
|
||||
}
|
||||
|
||||
if (list->ips32) {
|
||||
HKEY ips32_key;
|
||||
|
||||
res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL,
|
||||
&ips32_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
|
||||
|
||||
res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ,
|
||||
(CONST BYTE*)list->ips32,
|
||||
lstrlenA(list->ips32) + 1);
|
||||
if (res == ERROR_SUCCESS && list->ips32_tmodel)
|
||||
res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ,
|
||||
(CONST BYTE*)list->ips32_tmodel,
|
||||
strlen(list->ips32_tmodel) + 1);
|
||||
RegCloseKey(ips32_key);
|
||||
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
|
||||
}
|
||||
|
||||
error_close_clsid_key:
|
||||
RegCloseKey(clsid_key);
|
||||
}
|
||||
|
||||
error_close_coclass_key:
|
||||
RegCloseKey(coclass_key);
|
||||
error_return:
|
||||
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* unregister_coclasses
|
||||
*/
|
||||
static HRESULT unregister_coclasses(struct regsvr_coclass const *list)
|
||||
{
|
||||
LONG res = ERROR_SUCCESS;
|
||||
HKEY coclass_key;
|
||||
|
||||
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0,
|
||||
KEY_READ | KEY_WRITE, &coclass_key);
|
||||
if (res == ERROR_FILE_NOT_FOUND) return S_OK;
|
||||
if (res != ERROR_SUCCESS) goto error_return;
|
||||
|
||||
for (; res == ERROR_SUCCESS && list->clsid; ++list) {
|
||||
WCHAR buf[39];
|
||||
|
||||
StringFromGUID2(list->clsid, buf, 39);
|
||||
res = RegDeleteTreeW(coclass_key, buf);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
error_return:
|
||||
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* regsvr_key_guid
|
||||
*/
|
||||
static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid)
|
||||
{
|
||||
WCHAR buf[39];
|
||||
|
||||
StringFromGUID2(guid, buf, 39);
|
||||
return register_key_defvalueW(base, name, buf);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* regsvr_key_defvalueW
|
||||
*/
|
||||
static LONG register_key_defvalueW(
|
||||
HKEY base,
|
||||
WCHAR const *name,
|
||||
WCHAR const *value)
|
||||
{
|
||||
LONG res;
|
||||
HKEY key;
|
||||
|
||||
res = RegCreateKeyExW(base, name, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &key, NULL);
|
||||
if (res != ERROR_SUCCESS) return res;
|
||||
res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
|
||||
(lstrlenW(value) + 1) * sizeof(WCHAR));
|
||||
RegCloseKey(key);
|
||||
return res;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* regsvr_key_defvalueA
|
||||
*/
|
||||
static LONG register_key_defvalueA(
|
||||
HKEY base,
|
||||
WCHAR const *name,
|
||||
char const *value)
|
||||
{
|
||||
LONG res;
|
||||
HKEY key;
|
||||
|
||||
res = RegCreateKeyExW(base, name, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &key, NULL);
|
||||
if (res != ERROR_SUCCESS) return res;
|
||||
res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
|
||||
lstrlenA(value) + 1);
|
||||
RegCloseKey(key);
|
||||
return res;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* coclass list
|
||||
*/
|
||||
static struct regsvr_coclass const coclass_list[] = {
|
||||
{ &CLSID_StdComponentCategoriesMgr,
|
||||
"Component Categories Manager",
|
||||
NULL,
|
||||
"comcat.dll",
|
||||
"Both"
|
||||
},
|
||||
{ NULL } /* list terminator */
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* interface list
|
||||
*/
|
||||
static GUID const CLSID_PSFactoryBuffer_actxprxy = {
|
||||
0xB8DA6310, 0xE19B, 0x11D0, {0x93,0x3C,0x00,0xA0,0xC9,0x0D,0xCA,0xA9} };
|
||||
|
||||
static struct regsvr_interface const interface_list[] = {
|
||||
{ &IID_IEnumGUID,
|
||||
"IEnumGUID",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer_actxprxy
|
||||
},
|
||||
{ &IID_IEnumCATEGORYINFO,
|
||||
"IEnumCATEGORYINFO",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer_actxprxy
|
||||
},
|
||||
{ &IID_ICatRegister,
|
||||
"ICatRegister",
|
||||
NULL,
|
||||
9,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer_actxprxy
|
||||
},
|
||||
{ &IID_ICatInformation,
|
||||
"ICatInformation",
|
||||
NULL,
|
||||
9,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer_actxprxy
|
||||
},
|
||||
{ NULL } /* list terminator */
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* DllRegisterServer (COMCAT.@)
|
||||
*/
|
||||
HRESULT WINAPI DllRegisterServer(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
hr = register_coclasses(coclass_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = register_interfaces(interface_list);
|
||||
return hr;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DllUnregisterServer (COMCAT.@)
|
||||
*/
|
||||
HRESULT WINAPI DllUnregisterServer(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
hr = unregister_coclasses(coclass_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = unregister_interfaces(interface_list);
|
||||
return hr;
|
||||
}
|
|
@ -116,7 +116,7 @@ static ULONG WINAPI ClassMoniker_AddRef(IMoniker* iface)
|
|||
/******************************************************************************
|
||||
* ClassMoniker_Destroy (local function)
|
||||
*******************************************************************************/
|
||||
static HRESULT WINAPI ClassMoniker_Destroy(ClassMoniker* This)
|
||||
static HRESULT ClassMoniker_Destroy(ClassMoniker* This)
|
||||
{
|
||||
TRACE("(%p)\n",This);
|
||||
|
||||
|
@ -693,7 +693,7 @@ static const IROTDataVtbl ROTDataVtbl =
|
|||
/******************************************************************************
|
||||
* ClassMoniker_Construct (local function)
|
||||
*******************************************************************************/
|
||||
static HRESULT WINAPI ClassMoniker_Construct(ClassMoniker* This, REFCLSID rclsid)
|
||||
static HRESULT ClassMoniker_Construct(ClassMoniker* This, REFCLSID rclsid)
|
||||
{
|
||||
TRACE("(%p,%s)\n",This,debugstr_guid(rclsid));
|
||||
|
||||
|
|
|
@ -78,7 +78,9 @@
|
|||
|
||||
#include "storage32.h"
|
||||
|
||||
#define HANDLE_ERROR(err) { hr = err; TRACE("(HRESULT=%x)\n", (HRESULT)err); goto CLEANUP; }
|
||||
#include "compobj_private.h"
|
||||
|
||||
#define HANDLE_ERROR(err) do { hr = err; TRACE("(HRESULT=%x)\n", (HRESULT)err); goto CLEANUP; } while (0)
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
|
@ -313,6 +315,7 @@ HRESULT WINAPI OleSetClipboard(IDataObject* pDataObj)
|
|||
IEnumFORMATETC* penumFormatetc = NULL;
|
||||
FORMATETC rgelt;
|
||||
BOOL bClipboardOpen = FALSE;
|
||||
struct oletls *info = COM_CurrentInfo();
|
||||
/*
|
||||
HGLOBAL hDataObject = 0;
|
||||
OLEClipbrd **ppDataObject;
|
||||
|
@ -320,6 +323,12 @@ HRESULT WINAPI OleSetClipboard(IDataObject* pDataObj)
|
|||
|
||||
TRACE("(%p)\n", pDataObj);
|
||||
|
||||
if(!info)
|
||||
WARN("Could not allocate tls\n");
|
||||
else
|
||||
if(!info->ole_inits)
|
||||
return CO_E_NOTINITIALIZED;
|
||||
|
||||
/*
|
||||
* Make sure we have a clipboard object
|
||||
*/
|
||||
|
@ -414,7 +423,7 @@ HRESULT WINAPI OleSetClipboard(IDataObject* pDataObj)
|
|||
if (hDataObject==0)
|
||||
HANDLE_ERROR( E_OUTOFMEMORY );
|
||||
|
||||
ppDataObject = (OLEClipbrd**)GlobalLock(hDataObject);
|
||||
ppDataObject = GlobalLock(hDataObject);
|
||||
*ppDataObject = theOleClipboard;
|
||||
GlobalUnlock(hDataObject);
|
||||
|
||||
|
@ -958,7 +967,7 @@ static HRESULT OLEClipbrd_RenderFormat(IDataObject *pIDataObject, LPFORMATETC pF
|
|||
|
||||
if (SUCCEEDED(hr = IDataObject_GetData(theOleClipboard->pIDataObjectSrc, &fmt2, &std2)))
|
||||
{
|
||||
mfp = (METAFILEPICT *)GlobalLock(std2.u.hGlobal);
|
||||
mfp = GlobalLock(std2.u.hGlobal);
|
||||
}
|
||||
|
||||
if (mfp)
|
||||
|
@ -1237,7 +1246,8 @@ static HRESULT WINAPI OLEClipbrd_IDataObject_GetData(
|
|||
}
|
||||
|
||||
if ( pformatetcIn->lindex != -1 )
|
||||
return DV_E_LINDEX;
|
||||
return DV_E_FORMATETC;
|
||||
|
||||
if ( (pformatetcIn->tymed & TYMED_HGLOBAL) != TYMED_HGLOBAL )
|
||||
return DV_E_TYMED;
|
||||
/*
|
||||
|
|
|
@ -181,7 +181,7 @@ static HRESULT COMCAT_GetCategoryDesc(HKEY key, LCID lcid, PWCHAR pszDesc,
|
|||
FIXME("Simplified lcid comparison\n");
|
||||
return CAT_E_NODESCRIPTION;
|
||||
}
|
||||
pszDesc[size / sizeof(WCHAR)] = (WCHAR)0;
|
||||
pszDesc[size / sizeof(WCHAR)] = 0;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ static HRESULT WINAPI COMCAT_ICatInformation_GetCategoryDesc(
|
|||
if (res != ERROR_SUCCESS) return CAT_E_CATIDNOEXIST;
|
||||
|
||||
/* Allocate a sensible amount of memory for the description. */
|
||||
*ppszDesc = (PWCHAR) CoTaskMemAlloc(128 * sizeof(WCHAR));
|
||||
*ppszDesc = CoTaskMemAlloc(128 * sizeof(WCHAR));
|
||||
if (*ppszDesc == NULL) {
|
||||
RegCloseKey(key);
|
||||
return E_OUTOFMEMORY;
|
||||
|
|
|
@ -63,8 +63,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
HINSTANCE OLE32_hInstance = 0;
|
||||
|
||||
#define ARRAYSIZE(array) (sizeof(array)/sizeof((array)[0]))
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -209,14 +207,14 @@ static void COMPOBJ_InitProcess( void )
|
|||
*/
|
||||
memset(&wclass, 0, sizeof(wclass));
|
||||
wclass.lpfnWndProc = apartment_wndproc;
|
||||
wclass.hInstance = OLE32_hInstance;
|
||||
wclass.hInstance = hProxyDll;
|
||||
wclass.lpszClassName = wszAptWinClass;
|
||||
RegisterClassW(&wclass);
|
||||
}
|
||||
|
||||
static void COMPOBJ_UninitProcess( void )
|
||||
{
|
||||
UnregisterClassW(wszAptWinClass, OLE32_hInstance);
|
||||
UnregisterClassW(wszAptWinClass, hProxyDll);
|
||||
}
|
||||
|
||||
static void COM_TlsDestroy(void)
|
||||
|
@ -227,6 +225,7 @@ static void COM_TlsDestroy(void)
|
|||
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);
|
||||
HeapFree(GetProcessHeap(), 0, info);
|
||||
NtCurrentTeb()->ReservedForOle = NULL;
|
||||
}
|
||||
|
@ -728,7 +727,7 @@ HRESULT apartment_createwindowifneeded(struct apartment *apt)
|
|||
{
|
||||
HWND hwnd = CreateWindowW(wszAptWinClass, NULL, 0,
|
||||
0, 0, 0, 0,
|
||||
HWND_MESSAGE, 0, OLE32_hInstance, NULL);
|
||||
HWND_MESSAGE, 0, hProxyDll, NULL);
|
||||
if (!hwnd)
|
||||
{
|
||||
ERR("CreateWindow failed with error %d\n", GetLastError());
|
||||
|
@ -1013,6 +1012,80 @@ DWORD WINAPI CoBuildVersion(void)
|
|||
return (rmm<<16)+rup;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* CoRegisterInitializeSpy [OLE32.@]
|
||||
*
|
||||
* Add a Spy that watches CoInitializeEx calls
|
||||
*
|
||||
* PARAMS
|
||||
* spy [I] Pointer to IUnknown interface that will be QueryInterface'd.
|
||||
* cookie [II] cookie receiver
|
||||
*
|
||||
* RETURNS
|
||||
* Success: S_OK if not already initialized, S_FALSE otherwise.
|
||||
* Failure: HRESULT code.
|
||||
*
|
||||
* SEE ALSO
|
||||
* CoInitializeEx
|
||||
*/
|
||||
HRESULT WINAPI CoRegisterInitializeSpy(IInitializeSpy *spy, ULARGE_INTEGER *cookie)
|
||||
{
|
||||
struct oletls *info = COM_CurrentInfo();
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p, %p)\n", spy, cookie);
|
||||
|
||||
if (!spy || !cookie || !info)
|
||||
{
|
||||
if (!info)
|
||||
WARN("Could not allocate tls\n");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (info->spy)
|
||||
{
|
||||
FIXME("Already registered?\n");
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
hr = IUnknown_QueryInterface(spy, &IID_IInitializeSpy, (void **) &info->spy);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
cookie->QuadPart = (DWORD_PTR)spy;
|
||||
return S_OK;
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* CoRevokeInitializeSpy [OLE32.@]
|
||||
*
|
||||
* Remove a spy that previously watched CoInitializeEx calls
|
||||
*
|
||||
* PARAMS
|
||||
* cookie [I] The cookie obtained from a previous CoRegisterInitializeSpy call
|
||||
*
|
||||
* RETURNS
|
||||
* Success: S_OK if a spy is removed
|
||||
* Failure: E_INVALIDARG
|
||||
*
|
||||
* SEE ALSO
|
||||
* CoInitializeEx
|
||||
*/
|
||||
HRESULT WINAPI CoRevokeInitializeSpy(ULARGE_INTEGER cookie)
|
||||
{
|
||||
struct oletls *info = COM_CurrentInfo();
|
||||
TRACE("(%s)\n", wine_dbgstr_longlong(cookie.QuadPart));
|
||||
|
||||
if (!info || !info->spy || cookie.QuadPart != (DWORD_PTR)info->spy)
|
||||
return E_INVALIDARG;
|
||||
|
||||
IUnknown_Release(info->spy);
|
||||
info->spy = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* CoInitialize [OLE32.@]
|
||||
*
|
||||
|
@ -1069,6 +1142,7 @@ HRESULT WINAPI CoInitialize(LPVOID lpReserved)
|
|||
*/
|
||||
HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
|
||||
{
|
||||
struct oletls *info = COM_CurrentInfo();
|
||||
HRESULT hr = S_OK;
|
||||
APARTMENT *apt;
|
||||
|
||||
|
@ -1096,7 +1170,10 @@ HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
|
|||
RunningObjectTableImpl_Initialize();
|
||||
}
|
||||
|
||||
if (!(apt = COM_CurrentInfo()->apt))
|
||||
if (info->spy)
|
||||
IInitializeSpy_PreInitialize(info->spy, dwCoInit, info->inits);
|
||||
|
||||
if (!(apt = info->apt))
|
||||
{
|
||||
apt = apartment_get_or_create(dwCoInit);
|
||||
if (!apt) return E_OUTOFMEMORY;
|
||||
|
@ -1113,7 +1190,10 @@ HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
|
|||
else
|
||||
hr = S_FALSE;
|
||||
|
||||
COM_CurrentInfo()->inits++;
|
||||
info->inits++;
|
||||
|
||||
if (info->spy)
|
||||
IInitializeSpy_PostInitialize(info->spy, hr, dwCoInit, info->inits);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
@ -1144,10 +1224,16 @@ void WINAPI CoUninitialize(void)
|
|||
/* will only happen on OOM */
|
||||
if (!info) return;
|
||||
|
||||
if (info->spy)
|
||||
IInitializeSpy_PreUninitialize(info->spy, info->inits);
|
||||
|
||||
/* sanity check */
|
||||
if (!info->inits)
|
||||
{
|
||||
ERR("Mismatched CoUninitialize\n");
|
||||
|
||||
if (info->spy)
|
||||
IInitializeSpy_PostUninitialize(info->spy, info->inits);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1173,6 +1259,8 @@ void WINAPI CoUninitialize(void)
|
|||
ERR( "CoUninitialize() - not CoInitialized.\n" );
|
||||
InterlockedExchangeAdd(&s_COMLockCount,1); /* restore the lock count. */
|
||||
}
|
||||
if (info->spy)
|
||||
IInitializeSpy_PostUninitialize(info->spy, info->inits);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -1267,7 +1355,7 @@ HRESULT WINAPI CoCreateGuid(GUID *pguid)
|
|||
* SEE ALSO
|
||||
* StringFromCLSID
|
||||
*/
|
||||
static HRESULT WINAPI __CLSIDFromString(LPCWSTR s, CLSID *id)
|
||||
static HRESULT __CLSIDFromString(LPCWSTR s, CLSID *id)
|
||||
{
|
||||
int i;
|
||||
BYTE table[256];
|
||||
|
@ -3771,7 +3859,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
|||
|
||||
switch(fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
OLE32_hInstance = hinstDLL;
|
||||
hProxyDll = hinstDLL;
|
||||
COMPOBJ_InitProcess();
|
||||
if (TRACE_ON(ole)) CoRegisterMallocSpy((LPVOID)-1);
|
||||
break;
|
||||
|
@ -3782,7 +3870,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
|||
COMPOBJ_UninitProcess();
|
||||
RPC_UnregisterAllChannelHooks();
|
||||
COMPOBJ_DllList_Free();
|
||||
OLE32_hInstance = 0;
|
||||
break;
|
||||
|
||||
case DLL_THREAD_DETACH:
|
||||
|
|
|
@ -175,6 +175,7 @@ struct oletls
|
|||
struct apartment *apt;
|
||||
IErrorInfo *errorinfo; /* see errorinfo.c */
|
||||
IUnknown *state; /* see CoSetState */
|
||||
IInitializeSpy *spy; /* The "SPY" from CoInitializeSpy */
|
||||
DWORD inits; /* number of times CoInitializeEx called */
|
||||
DWORD ole_inits; /* number of times OleInitialize called */
|
||||
GUID causality_id; /* unique identifier for each COM call */
|
||||
|
@ -211,7 +212,6 @@ struct stub_manager *get_stub_manager_from_object(APARTMENT *apt, void *object);
|
|||
BOOL stub_manager_notify_unmarshal(struct stub_manager *m, const IPID *ipid);
|
||||
BOOL stub_manager_is_table_marshaled(struct stub_manager *m, const IPID *ipid);
|
||||
void stub_manager_release_marshal_data(struct stub_manager *m, ULONG refs, const IPID *ipid, BOOL tableweak);
|
||||
HRESULT ipid_to_stub_manager(const IPID *ipid, APARTMENT **stub_apt, struct stub_manager **stubmgr_ret);
|
||||
HRESULT ipid_get_dispatch_params(const IPID *ipid, APARTMENT **stub_apt, IRpcStubBuffer **stub, IRpcChannelBuffer **chan, IID *iid, IUnknown **iface);
|
||||
HRESULT start_apartment_remote_unknown(void);
|
||||
|
||||
|
@ -302,12 +302,16 @@ static inline GUID COM_CurrentCausalityId(void)
|
|||
# define DEBUG_SET_CRITSEC_NAME(cs, name) (cs)->DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": " name)
|
||||
# define DEBUG_CLEAR_CRITSEC_NAME(cs) (cs)->DebugInfo->Spare[0] = 0
|
||||
|
||||
extern HINSTANCE OLE32_hInstance; /* FIXME: make static */
|
||||
|
||||
#define CHARS_IN_GUID 39 /* including NULL */
|
||||
|
||||
#define WINE_CLSCTX_DONT_HOST 0x80000000
|
||||
|
||||
/* from dlldata.c */
|
||||
extern HINSTANCE hProxyDll DECLSPEC_HIDDEN;
|
||||
extern HRESULT WINAPI OLE32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv) DECLSPEC_HIDDEN;
|
||||
extern HRESULT WINAPI OLE32_DllRegisterServer(void) DECLSPEC_HIDDEN;
|
||||
extern HRESULT WINAPI OLE32_DllUnregisterServer(void) DECLSPEC_HIDDEN;
|
||||
|
||||
/* Exported non-interface Data Advise Holder functions */
|
||||
HRESULT DataAdviseHolder_OnConnect(IDataAdviseHolder *iface, IDataObject *pDelegate);
|
||||
void DataAdviseHolder_OnDisconnect(IDataAdviseHolder *iface);
|
||||
|
|
|
@ -71,6 +71,12 @@ enum storage_state
|
|||
storage_state_loaded
|
||||
};
|
||||
|
||||
enum object_state
|
||||
{
|
||||
object_state_not_running,
|
||||
object_state_running
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* DefaultHandler
|
||||
*
|
||||
|
@ -123,6 +129,7 @@ struct DefaultHandler
|
|||
IPersistStorage *pPSDelegate;
|
||||
/* IDataObject delegate */
|
||||
IDataObject *pDataDelegate;
|
||||
enum object_state object_state;
|
||||
|
||||
/* connection cookie for the advise on the delegate OLE object */
|
||||
DWORD dwAdvConn;
|
||||
|
@ -420,6 +427,25 @@ static HRESULT WINAPI DefaultHandler_SetHostNames(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static void release_delegates(DefaultHandler *This)
|
||||
{
|
||||
if (This->pDataDelegate)
|
||||
{
|
||||
IDataObject_Release(This->pDataDelegate);
|
||||
This->pDataDelegate = NULL;
|
||||
}
|
||||
if (This->pPSDelegate)
|
||||
{
|
||||
IPersistStorage_Release(This->pPSDelegate);
|
||||
This->pPSDelegate = NULL;
|
||||
}
|
||||
if (This->pOleDelegate)
|
||||
{
|
||||
IOleObject_Release(This->pOleDelegate);
|
||||
This->pOleDelegate = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* undoes the work done by DefaultHandler_Run */
|
||||
static void DefaultHandler_Stop(DefaultHandler *This)
|
||||
{
|
||||
|
@ -432,18 +458,8 @@ static void DefaultHandler_Stop(DefaultHandler *This)
|
|||
|
||||
if (This->dataAdviseHolder)
|
||||
DataAdviseHolder_OnDisconnect(This->dataAdviseHolder);
|
||||
if (This->pDataDelegate)
|
||||
{
|
||||
IDataObject_Release(This->pDataDelegate);
|
||||
This->pDataDelegate = NULL;
|
||||
}
|
||||
if (This->pPSDelegate)
|
||||
{
|
||||
IPersistStorage_Release(This->pPSDelegate);
|
||||
This->pPSDelegate = NULL;
|
||||
}
|
||||
IOleObject_Release(This->pOleDelegate);
|
||||
This->pOleDelegate = NULL;
|
||||
|
||||
This->object_state = object_state_not_running;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
@ -469,6 +485,7 @@ static HRESULT WINAPI DefaultHandler_Close(
|
|||
hr = IOleObject_Close(This->pOleDelegate, dwSaveOption);
|
||||
|
||||
DefaultHandler_Stop(This);
|
||||
release_delegates(This);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
@ -1296,11 +1313,15 @@ static HRESULT WINAPI DefaultHandler_Run(
|
|||
if (object_is_running(This))
|
||||
return S_OK;
|
||||
|
||||
release_delegates(This);
|
||||
|
||||
hr = CoCreateInstance(&This->clsid, NULL, CLSCTX_LOCAL_SERVER,
|
||||
&IID_IOleObject, (void **)&This->pOleDelegate);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
This->object_state = object_state_running;
|
||||
|
||||
hr = IOleObject_Advise(This->pOleDelegate,
|
||||
(IAdviseSink *)&This->lpvtblIAdviseSink,
|
||||
&This->dwAdvConn);
|
||||
|
@ -1339,7 +1360,10 @@ static HRESULT WINAPI DefaultHandler_Run(
|
|||
hr = DataAdviseHolder_OnConnect(This->dataAdviseHolder, This->pDataDelegate);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
DefaultHandler_Stop(This);
|
||||
release_delegates(This);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
@ -1356,7 +1380,7 @@ static BOOL WINAPI DefaultHandler_IsRunning(
|
|||
|
||||
TRACE("()\n");
|
||||
|
||||
if (This->pOleDelegate)
|
||||
if (This->object_state == object_state_running)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
@ -1934,6 +1958,7 @@ static DefaultHandler* DefaultHandler_Construct(
|
|||
This->pOleDelegate = NULL;
|
||||
This->pPSDelegate = NULL;
|
||||
This->pDataDelegate = NULL;
|
||||
This->object_state = object_state_not_running;
|
||||
|
||||
This->dwAdvConn = 0;
|
||||
This->storage = NULL;
|
||||
|
@ -1947,6 +1972,7 @@ static void DefaultHandler_Destroy(
|
|||
{
|
||||
/* release delegates */
|
||||
DefaultHandler_Stop(This);
|
||||
release_delegates(This);
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, This->containerApp );
|
||||
This->containerApp = NULL;
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
/* this code is from SysAllocStringLen (ole2disp.c in oleaut32) */
|
||||
static BSTR WINAPI ERRORINFO_SysAllocString(const OLECHAR* in)
|
||||
static BSTR ERRORINFO_SysAllocString(const OLECHAR* in)
|
||||
{
|
||||
DWORD bufferSize;
|
||||
DWORD* newBuffer;
|
||||
|
@ -99,7 +99,7 @@ static BSTR WINAPI ERRORINFO_SysAllocString(const OLECHAR* in)
|
|||
}
|
||||
|
||||
/* this code is from SysFreeString (ole2disp.c in oleaut32)*/
|
||||
static VOID WINAPI ERRORINFO_SysFreeString(BSTR in)
|
||||
static VOID ERRORINFO_SysFreeString(BSTR in)
|
||||
{
|
||||
DWORD* bufferPointer;
|
||||
|
||||
|
|
|
@ -63,8 +63,8 @@ static inline IMoniker *impl_from_IROTData( IROTData *iface )
|
|||
}
|
||||
|
||||
/* Local function used by filemoniker implementation */
|
||||
static HRESULT WINAPI FileMonikerImpl_Construct(FileMonikerImpl* iface, LPCOLESTR lpszPathName);
|
||||
static HRESULT WINAPI FileMonikerImpl_Destroy(FileMonikerImpl* iface);
|
||||
static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* iface, LPCOLESTR lpszPathName);
|
||||
static HRESULT FileMonikerImpl_Destroy(FileMonikerImpl* iface);
|
||||
|
||||
/*******************************************************************************
|
||||
* FileMoniker_QueryInterface
|
||||
|
@ -456,7 +456,7 @@ FileMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize)
|
|||
/******************************************************************************
|
||||
* FileMoniker_Destroy (local function)
|
||||
*******************************************************************************/
|
||||
HRESULT WINAPI FileMonikerImpl_Destroy(FileMonikerImpl* This)
|
||||
HRESULT FileMonikerImpl_Destroy(FileMonikerImpl* This)
|
||||
{
|
||||
TRACE("(%p)\n",This);
|
||||
|
||||
|
@ -1333,8 +1333,7 @@ static const IROTDataVtbl VT_ROTDataImpl =
|
|||
/******************************************************************************
|
||||
* FileMoniker_Construct (local function)
|
||||
*/
|
||||
static HRESULT WINAPI
|
||||
FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPathName)
|
||||
static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPathName)
|
||||
{
|
||||
int nb=0,i;
|
||||
int sizeStr=lstrlenW(lpszPathName);
|
||||
|
|
|
@ -97,8 +97,8 @@ static HRESULT WINAPI ItemMonikerImpl_ParseDisplayName(IMoniker* iface,IBindCtx*
|
|||
static HRESULT WINAPI ItemMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys);
|
||||
|
||||
/* Local function used by ItemMoniker implementation */
|
||||
static HRESULT WINAPI ItemMonikerImpl_Construct(ItemMonikerImpl* iface, LPCOLESTR lpszDelim,LPCOLESTR lpszPathName);
|
||||
static HRESULT WINAPI ItemMonikerImpl_Destroy(ItemMonikerImpl* iface);
|
||||
static HRESULT ItemMonikerImpl_Construct(ItemMonikerImpl* iface, LPCOLESTR lpszDelim,LPCOLESTR lpszPathName);
|
||||
static HRESULT ItemMonikerImpl_Destroy(ItemMonikerImpl* iface);
|
||||
|
||||
/********************************************************************************/
|
||||
/* IROTData prototype functions */
|
||||
|
@ -391,7 +391,7 @@ HRESULT WINAPI ItemMonikerImpl_GetSizeMax(IMoniker* iface,
|
|||
/******************************************************************************
|
||||
* ItemMoniker_Construct (local function)
|
||||
*******************************************************************************/
|
||||
static HRESULT WINAPI ItemMonikerImpl_Construct(ItemMonikerImpl* This, LPCOLESTR lpszDelim,LPCOLESTR lpszItem)
|
||||
static HRESULT ItemMonikerImpl_Construct(ItemMonikerImpl* This, LPCOLESTR lpszDelim,LPCOLESTR lpszItem)
|
||||
{
|
||||
|
||||
int sizeStr1=lstrlenW(lpszItem), sizeStr2;
|
||||
|
@ -429,7 +429,7 @@ static HRESULT WINAPI ItemMonikerImpl_Construct(ItemMonikerImpl* This, LPCOLESTR
|
|||
/******************************************************************************
|
||||
* ItemMoniker_Destroy (local function)
|
||||
*******************************************************************************/
|
||||
static HRESULT WINAPI ItemMonikerImpl_Destroy(ItemMonikerImpl* This)
|
||||
static HRESULT ItemMonikerImpl_Destroy(ItemMonikerImpl* This)
|
||||
{
|
||||
TRACE("(%p)\n",This);
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ HRESULT CDECL HGLOBALLockBytesImpl16_QueryInterface(
|
|||
REFIID riid, /* [in] */
|
||||
void** ppvObject) /* [out][iid_is] (ptr to SEGPTR!) */
|
||||
{
|
||||
HGLOBALLockBytesImpl16* const This=(HGLOBALLockBytesImpl16*)MapSL((SEGPTR)iface);
|
||||
HGLOBALLockBytesImpl16* const This = MapSL((SEGPTR)iface);
|
||||
|
||||
TRACE("(%p,%s,%p)\n",iface,debugstr_guid(riid),ppvObject);
|
||||
/*
|
||||
|
|
|
@ -93,7 +93,7 @@ typedef struct EnumMonikerImpl
|
|||
|
||||
|
||||
/* IEnumMoniker Local functions*/
|
||||
static HRESULT WINAPI EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *moniker_list,
|
||||
static HRESULT EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *moniker_list,
|
||||
ULONG pos, IEnumMoniker **ppenumMoniker);
|
||||
|
||||
static IrotHandle get_irot_handle(void)
|
||||
|
@ -342,7 +342,7 @@ RunningObjectTableImpl_AddRef(IRunningObjectTable* iface)
|
|||
/***********************************************************************
|
||||
* RunningObjectTable_Initialize
|
||||
*/
|
||||
static HRESULT WINAPI
|
||||
static HRESULT
|
||||
RunningObjectTableImpl_Destroy(void)
|
||||
{
|
||||
struct list *cursor, *cursor2;
|
||||
|
@ -1463,7 +1463,7 @@ static const IEnumMonikerVtbl VT_EnumMonikerImpl =
|
|||
* Used by EnumRunning to create the structure and EnumClone
|
||||
* to copy the structure
|
||||
*/
|
||||
static HRESULT WINAPI EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *moniker_list,
|
||||
static HRESULT EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *moniker_list,
|
||||
ULONG current_pos,
|
||||
IEnumMoniker **ppenumMoniker)
|
||||
{
|
||||
|
|
|
@ -572,7 +572,7 @@ SEGPTR WINAPI CoMemAlloc(DWORD size, DWORD dwMemContext, DWORD x) {
|
|||
TRACE("(%d, 0x%08x, 0x%08x)\n", size, dwMemContext, x);
|
||||
hres = _xmalloc16(size, &segptr);
|
||||
if (hres != S_OK)
|
||||
return (SEGPTR)0;
|
||||
return 0;
|
||||
return segptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -1405,7 +1405,7 @@ static LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lPar
|
|||
goto NEXTHOOK;
|
||||
|
||||
/* Get the menu descriptor */
|
||||
pOleMenuDescriptor = (OleMenuDescriptor *) GlobalLock( hOleMenu );
|
||||
pOleMenuDescriptor = GlobalLock( hOleMenu );
|
||||
if ( !pOleMenuDescriptor ) /* Bad descriptor! */
|
||||
goto NEXTHOOK;
|
||||
|
||||
|
@ -1524,7 +1524,7 @@ static LRESULT CALLBACK OLEMenu_GetMsgProc(INT code, WPARAM wParam, LPARAM lPara
|
|||
}
|
||||
|
||||
/* Get the menu descriptor */
|
||||
pOleMenuDescriptor = (OleMenuDescriptor *) GlobalLock( hOleMenu );
|
||||
pOleMenuDescriptor = GlobalLock( hOleMenu );
|
||||
if ( !pOleMenuDescriptor ) /* Bad descriptor! */
|
||||
goto NEXTHOOK;
|
||||
|
||||
|
@ -1579,7 +1579,7 @@ HOLEMENU WINAPI OleCreateMenuDescriptor(
|
|||
sizeof(OleMenuDescriptor) ) ) )
|
||||
return 0;
|
||||
|
||||
pOleMenuDescriptor = (OleMenuDescriptor *) GlobalLock( hOleMenu );
|
||||
pOleMenuDescriptor = GlobalLock( hOleMenu );
|
||||
if ( !pOleMenuDescriptor )
|
||||
return 0;
|
||||
|
||||
|
@ -1664,7 +1664,7 @@ HRESULT WINAPI OleSetMenuDescriptor(
|
|||
return E_FAIL;
|
||||
|
||||
/* Get the menu descriptor */
|
||||
pOleMenuDescriptor = (OleMenuDescriptor *) GlobalLock( hOleMenu );
|
||||
pOleMenuDescriptor = GlobalLock( hOleMenu );
|
||||
if ( !pOleMenuDescriptor )
|
||||
return E_UNEXPECTED;
|
||||
|
||||
|
@ -2119,19 +2119,19 @@ static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo)
|
|||
{
|
||||
if (*trackerInfo->pdwEffect & DROPEFFECT_MOVE)
|
||||
{
|
||||
SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCEA(1)));
|
||||
SetCursor(LoadCursorA(hProxyDll, MAKEINTRESOURCEA(1)));
|
||||
}
|
||||
else if (*trackerInfo->pdwEffect & DROPEFFECT_COPY)
|
||||
{
|
||||
SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCEA(2)));
|
||||
SetCursor(LoadCursorA(hProxyDll, MAKEINTRESOURCEA(2)));
|
||||
}
|
||||
else if (*trackerInfo->pdwEffect & DROPEFFECT_LINK)
|
||||
{
|
||||
SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCEA(3)));
|
||||
SetCursor(LoadCursorA(hProxyDll, MAKEINTRESOURCEA(3)));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCEA(0)));
|
||||
SetCursor(LoadCursorA(hProxyDll, MAKEINTRESOURCEA(0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2815,6 +2815,22 @@ HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, /* [out] */
|
|||
|
||||
switch(pvarSrc->vt)
|
||||
{
|
||||
case VT_EMPTY:
|
||||
case VT_NULL:
|
||||
case VT_I1:
|
||||
case VT_UI1:
|
||||
case VT_I2:
|
||||
case VT_UI2:
|
||||
case VT_BOOL:
|
||||
case VT_I4:
|
||||
case VT_UI4:
|
||||
case VT_R4:
|
||||
case VT_ERROR:
|
||||
case VT_I8:
|
||||
case VT_UI8:
|
||||
case VT_R8:
|
||||
case VT_CY:
|
||||
case VT_DATE:
|
||||
case VT_FILETIME:
|
||||
break;
|
||||
case VT_STREAM:
|
||||
|
|
|
@ -113,7 +113,7 @@ HGLOBAL16 WINAPI OleMetaFilePictFromIconAndLabel16(
|
|||
hmf = CloseMetaFile(hdc);
|
||||
|
||||
hmf16 = GlobalAlloc16(0, sizeof(METAFILEPICT16));
|
||||
mf16 = (METAFILEPICT16 *)GlobalLock16(hmf16);
|
||||
mf16 = GlobalLock16(hmf16);
|
||||
mf16->mm = MM_ANISOTROPIC;
|
||||
mf16->xExt = 20; /* FIXME: bogus */
|
||||
mf16->yExt = 20; /* ditto */
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
<define name="__WINESRC__" />
|
||||
<define name="_WIN32_WINNT">0x600</define>
|
||||
<define name="_OLE32_" />
|
||||
<define name="ENTRY_PREFIX">OLE32_</define>
|
||||
<define name="PROXY_CLSID">CLSID_PSFactoryBuffer</define>
|
||||
<define name="REGISTER_PROXY_DLL" />
|
||||
<define name="COM_NO_WINDOWS_H" />
|
||||
<library>wine</library>
|
||||
<library>advapi32</library>
|
||||
|
@ -74,6 +77,9 @@
|
|||
<define name="_OLE32_" />
|
||||
<define name="COM_NO_WINDOWS_H" />
|
||||
<define name="__WINESRC__" />
|
||||
<define name="ENTRY_PREFIX">OLE32_</define>
|
||||
<define name="PROXY_CLSID">CLSID_PSFactoryBuffer</define>
|
||||
<define name="REGISTER_PROXY_DLL"/>
|
||||
<file>dcom.idl</file>
|
||||
<file>ole32_unknwn.idl</file>
|
||||
<file>ole32_objidl.idl</file>
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
@ stub CoQueryReleaseObject
|
||||
@ stdcall CoRegisterChannelHook(ptr ptr)
|
||||
@ stdcall CoRegisterClassObject(ptr ptr long long ptr)
|
||||
@ stdcall CoRegisterInitializeSpy(ptr ptr)
|
||||
@ stdcall CoRegisterMallocSpy (ptr)
|
||||
@ stdcall CoRegisterMessageFilter(ptr ptr)
|
||||
@ stdcall CoRegisterPSClsid(ptr ptr)
|
||||
|
@ -67,6 +68,7 @@
|
|||
@ stdcall CoResumeClassObjects()
|
||||
@ stdcall CoRevertToSelf()
|
||||
@ stdcall CoRevokeClassObject(long)
|
||||
@ stdcall CoRevokeInitializeSpy(double)
|
||||
@ stdcall CoRevokeMallocSpy()
|
||||
@ stdcall CoSetProxyBlanket(ptr long long wstr long long ptr long)
|
||||
@ stdcall CoSetState(ptr)
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
Index: ole32.rbuild
|
||||
===================================================================
|
||||
--- ole32.rbuild (revision 31639)
|
||||
+++ ole32.rbuild (working copy)
|
||||
@@ -13,6 +13,7 @@
|
||||
<library>advapi32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
+ <library>ole32_irot_client</library>
|
||||
<library>rpcrt4</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
|
@ -36,33 +36,11 @@
|
|||
#include "objbase.h"
|
||||
#include "ole2.h"
|
||||
#include "rpc.h"
|
||||
#include "rpcproxy.h"
|
||||
|
||||
#include "compobj_private.h"
|
||||
#include "moniker.h"
|
||||
#include "comcat.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
static CStdPSFactoryBuffer PSFactoryBuffer;
|
||||
|
||||
CSTDSTUBBUFFERRELEASE(&PSFactoryBuffer)
|
||||
|
||||
extern const ExtendedProxyFileInfo dcom_ProxyFileInfo;
|
||||
extern const ExtendedProxyFileInfo ole32_objidl_ProxyFileInfo;
|
||||
extern const ExtendedProxyFileInfo ole32_oleidl_ProxyFileInfo;
|
||||
extern const ExtendedProxyFileInfo ole32_unknwn_ProxyFileInfo;
|
||||
|
||||
static const ProxyFileInfo *OLE32_ProxyFileList[] = {
|
||||
&dcom_ProxyFileInfo,
|
||||
&ole32_objidl_ProxyFileInfo,
|
||||
&ole32_oleidl_ProxyFileInfo,
|
||||
&ole32_unknwn_ProxyFileInfo,
|
||||
NULL
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* DllGetClassObject [OLE32.@]
|
||||
*/
|
||||
|
@ -92,6 +70,5 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
|
|||
if (IsEqualGUID(rclsid, &CLSID_StdComponentCategoriesMgr))
|
||||
return ComCatCF_Create(iid, ppv);
|
||||
|
||||
return NdrDllGetClassObject(rclsid, iid, ppv, OLE32_ProxyFileList,
|
||||
&CLSID_PSFactoryBuffer, &PSFactoryBuffer);
|
||||
return OLE32_DllGetClassObject(rclsid, iid, ppv);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "moniker.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
|
@ -155,7 +156,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list)
|
|||
KEY_READ | KEY_WRITE, NULL, &key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
|
||||
wsprintfW(buf, fmt, list->num_methods);
|
||||
sprintfW(buf, fmt, list->num_methods);
|
||||
res = RegSetValueExW(key, NULL, 0, REG_SZ,
|
||||
(CONST BYTE*)buf,
|
||||
(lstrlenW(buf) + 1) * sizeof(WCHAR));
|
||||
|
@ -509,69 +510,38 @@ static struct regsvr_coclass const coclass_list[] = {
|
|||
* interface list
|
||||
*/
|
||||
|
||||
#define INTERFACE_ENTRY(interface, base, clsid32, clsid16) { &IID_##interface, #interface, base, sizeof(interface##Vtbl)/sizeof(void*), clsid16, clsid32 }
|
||||
#define BAS_INTERFACE_ENTRY(interface, base) INTERFACE_ENTRY(interface, &IID_##base, &CLSID_PSFactoryBuffer, NULL)
|
||||
#define STD_INTERFACE_ENTRY(interface) INTERFACE_ENTRY(interface, NULL, &CLSID_PSFactoryBuffer, NULL)
|
||||
#define ACTX_INTERFACE_ENTRY(interface) INTERFACE_ENTRY(interface, NULL, &CLSID_PSFactoryBuffer_actxprxy, NULL)
|
||||
#define LCL_INTERFACE_ENTRY(interface) INTERFACE_ENTRY(interface, NULL, NULL, NULL)
|
||||
#define INTERFACE_ENTRY(interface, base, clsid32) { &IID_##interface, #interface, base, sizeof(interface##Vtbl)/sizeof(void*), NULL, clsid32 }
|
||||
#define BAS_INTERFACE_ENTRY(interface, base) INTERFACE_ENTRY(interface, &IID_##base, NULL)
|
||||
#define ACTX_INTERFACE_ENTRY(interface) INTERFACE_ENTRY(interface, NULL, &CLSID_PSFactoryBuffer_actxprxy)
|
||||
#define LCL_INTERFACE_ENTRY(interface) INTERFACE_ENTRY(interface, NULL, NULL)
|
||||
|
||||
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(ILockBytes),
|
||||
STD_INTERFACE_ENTRY(IStorage),
|
||||
STD_INTERFACE_ENTRY(IStream),
|
||||
STD_INTERFACE_ENTRY(IEnumSTATSTG),
|
||||
STD_INTERFACE_ENTRY(IBindCtx),
|
||||
BAS_INTERFACE_ENTRY(IMoniker, IPersistStream),
|
||||
STD_INTERFACE_ENTRY(IRunningObjectTable),
|
||||
STD_INTERFACE_ENTRY(IRootStorage),
|
||||
LCL_INTERFACE_ENTRY(IMessageFilter),
|
||||
LCL_INTERFACE_ENTRY(IStdMarshalInfo),
|
||||
LCL_INTERFACE_ENTRY(IExternalConnection),
|
||||
LCL_INTERFACE_ENTRY(IMallocSpy),
|
||||
LCL_INTERFACE_ENTRY(IMultiQI),
|
||||
STD_INTERFACE_ENTRY(IEnumUnknown),
|
||||
STD_INTERFACE_ENTRY(IEnumString),
|
||||
STD_INTERFACE_ENTRY(IEnumMoniker),
|
||||
STD_INTERFACE_ENTRY(IEnumFORMATETC),
|
||||
STD_INTERFACE_ENTRY(IEnumOLEVERB),
|
||||
STD_INTERFACE_ENTRY(IEnumSTATDATA),
|
||||
BAS_INTERFACE_ENTRY(IPersistStream, IPersist),
|
||||
BAS_INTERFACE_ENTRY(IPersistStorage, IPersist),
|
||||
BAS_INTERFACE_ENTRY(IPersistFile, IPersist),
|
||||
STD_INTERFACE_ENTRY(IPersist),
|
||||
STD_INTERFACE_ENTRY(IViewObject),
|
||||
STD_INTERFACE_ENTRY(IDataObject),
|
||||
STD_INTERFACE_ENTRY(IAdviseSink),
|
||||
LCL_INTERFACE_ENTRY(IDataAdviseHolder),
|
||||
LCL_INTERFACE_ENTRY(IOleAdviseHolder),
|
||||
STD_INTERFACE_ENTRY(IOleObject),
|
||||
BAS_INTERFACE_ENTRY(IOleInPlaceObject, IOleWindow),
|
||||
STD_INTERFACE_ENTRY(IOleWindow),
|
||||
BAS_INTERFACE_ENTRY(IOleInPlaceUIWindow, IOleWindow),
|
||||
STD_INTERFACE_ENTRY(IOleInPlaceFrame),
|
||||
BAS_INTERFACE_ENTRY(IOleInPlaceActiveObject, IOleWindow),
|
||||
STD_INTERFACE_ENTRY(IOleClientSite),
|
||||
BAS_INTERFACE_ENTRY(IOleInPlaceSite, IOleWindow),
|
||||
STD_INTERFACE_ENTRY(IParseDisplayName),
|
||||
BAS_INTERFACE_ENTRY(IOleContainer, IParseDisplayName),
|
||||
BAS_INTERFACE_ENTRY(IOleItemContainer, IOleContainer),
|
||||
STD_INTERFACE_ENTRY(IOleLink),
|
||||
STD_INTERFACE_ENTRY(IOleCache),
|
||||
LCL_INTERFACE_ENTRY(IDropSource),
|
||||
STD_INTERFACE_ENTRY(IDropTarget),
|
||||
BAS_INTERFACE_ENTRY(IAdviseSink2, IAdviseSink),
|
||||
STD_INTERFACE_ENTRY(IRunnableObject),
|
||||
BAS_INTERFACE_ENTRY(IViewObject2, IViewObject),
|
||||
BAS_INTERFACE_ENTRY(IOleCache2, IOleCache),
|
||||
STD_INTERFACE_ENTRY(IOleCacheControl),
|
||||
STD_INTERFACE_ENTRY(IRemUnknown),
|
||||
LCL_INTERFACE_ENTRY(IClientSecurity),
|
||||
LCL_INTERFACE_ENTRY(IServerSecurity),
|
||||
STD_INTERFACE_ENTRY(ISequentialStream),
|
||||
ACTX_INTERFACE_ENTRY(IEnumGUID),
|
||||
ACTX_INTERFACE_ENTRY(IEnumCATEGORYINFO),
|
||||
ACTX_INTERFACE_ENTRY(ICatRegister),
|
||||
|
@ -588,7 +558,9 @@ HRESULT WINAPI DllRegisterServer(void)
|
|||
|
||||
TRACE("\n");
|
||||
|
||||
hr = register_coclasses(coclass_list);
|
||||
hr = OLE32_DllRegisterServer();
|
||||
if (SUCCEEDED(hr))
|
||||
hr = register_coclasses(coclass_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = register_interfaces(interface_list);
|
||||
return hr;
|
||||
|
@ -606,5 +578,7 @@ HRESULT WINAPI DllUnregisterServer(void)
|
|||
hr = unregister_coclasses(coclass_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = unregister_interfaces(interface_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = OLE32_DllUnregisterServer();
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -725,7 +725,7 @@ static DWORD BIGBLOCKFILE_GetProtectMode(DWORD openFlags)
|
|||
*
|
||||
* See the documentation of ILockBytes for more info.
|
||||
*/
|
||||
static HRESULT WINAPI ImplBIGBLOCKFILE_ReadAt(
|
||||
static HRESULT ImplBIGBLOCKFILE_ReadAt(
|
||||
BigBlockFile* const This,
|
||||
ULARGE_INTEGER ulOffset, /* [in] */
|
||||
void* pv, /* [length_is][size_is][out] */
|
||||
|
@ -812,7 +812,7 @@ static HRESULT WINAPI ImplBIGBLOCKFILE_ReadAt(
|
|||
*
|
||||
* See the documentation of ILockBytes for more info.
|
||||
*/
|
||||
static HRESULT WINAPI ImplBIGBLOCKFILE_WriteAt(
|
||||
static HRESULT ImplBIGBLOCKFILE_WriteAt(
|
||||
BigBlockFile* const This,
|
||||
ULARGE_INTEGER ulOffset, /* [in] */
|
||||
const void* pv, /* [size_is][in] */
|
||||
|
|
|
@ -706,8 +706,7 @@ STORAGE_look_for_named_pps(stream_access16*str,int n,LPOLESTR name) {
|
|||
/******************************************************************************
|
||||
* STORAGE_dump_pps_entry [Internal]
|
||||
*
|
||||
* FIXME
|
||||
* Function is unused
|
||||
* This function is there to simplify debugging. It is otherwise unused.
|
||||
*/
|
||||
void
|
||||
STORAGE_dump_pps_entry(struct storage_pps_entry *stde) {
|
||||
|
@ -1623,46 +1622,6 @@ typedef struct
|
|||
ULARGE_INTEGER offset;
|
||||
} IStream32Impl;
|
||||
|
||||
/*****************************************************************************
|
||||
* IStream32_QueryInterface [VTABLE]
|
||||
*/
|
||||
HRESULT WINAPI IStream_fnQueryInterface(
|
||||
IStream* iface,REFIID refiid,LPVOID *obj
|
||||
) {
|
||||
IStream32Impl *This = (IStream32Impl *)iface;
|
||||
|
||||
TRACE_(relay)("(%p)->(%s,%p)\n",This,debugstr_guid(refiid),obj);
|
||||
if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
|
||||
*obj = This;
|
||||
return 0;
|
||||
}
|
||||
return OLE_E_ENUM_NOMORE;
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* IStream32_AddRef [VTABLE]
|
||||
*/
|
||||
ULONG WINAPI IStream_fnAddRef(IStream* iface) {
|
||||
IStream32Impl *This = (IStream32Impl *)iface;
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* IStream32_Release [VTABLE]
|
||||
*/
|
||||
ULONG WINAPI IStream_fnRelease(IStream* iface) {
|
||||
IStream32Impl *This = (IStream32Impl *)iface;
|
||||
ULONG ref;
|
||||
FlushFileBuffers(This->hf);
|
||||
ref = InterlockedDecrement(&This->ref);
|
||||
if (!ref) {
|
||||
CloseHandle(This->hf);
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* IStorage16_QueryInterface [STORAGE.500]
|
||||
*/
|
||||
|
|
|
@ -22,12 +22,10 @@
|
|||
500 cdecl IStorage16_QueryInterface(ptr ptr ptr) IStorage16_fnQueryInterface
|
||||
501 cdecl IStorage16_AddRef(ptr) IStorage16_fnAddRef
|
||||
502 cdecl IStorage16_Release(ptr) IStorage16_fnRelease
|
||||
#503 cdecl IStorage16_CreateStream(ptr str long long long ptr) IStorage16_fnCreateStream
|
||||
503 stub IStorage16_CreateStream
|
||||
503 cdecl IStorage16_CreateStream(ptr str long long long ptr) IStorage16_fnCreateStream
|
||||
|
||||
504 cdecl IStorage16_OpenStream(ptr str ptr long long ptr) IStorage16_fnOpenStream
|
||||
#505 cdecl IStorage16_CreateStorage(ptr str long long long ptr) IStorage16_fnCreateStorage
|
||||
505 stub IStorage16_CreateStorage
|
||||
505 cdecl IStorage16_CreateStorage(ptr str long long long ptr) IStorage16_fnCreateStorage
|
||||
506 cdecl IStorage16_OpenStorage(ptr str ptr long ptr long ptr) IStorage16_fnOpenStorage
|
||||
507 cdecl IStorage16_CopyTo(ptr long ptr ptr ptr) IStorage16_fnCopyTo
|
||||
508 stub IStorage16_MoveElementTo
|
||||
|
@ -46,8 +44,7 @@
|
|||
519 cdecl IStream16_AddRef(ptr) IStream16_fnAddRef
|
||||
520 cdecl IStream16_Release(ptr) IStream16_fnRelease
|
||||
521 cdecl IStream16_Read(ptr ptr long ptr) IStream16_fnRead
|
||||
#522 cdecl IStream16_Write(ptr ptr long ptr) IStream16_fnWrite
|
||||
522 stub IStream16_Write
|
||||
522 cdecl IStream16_Write(ptr ptr long ptr) IStream16_fnWrite
|
||||
523 cdecl IStream16_Seek(ptr double long ptr) IStream16_fnSeek
|
||||
524 stub IStream16_SetSize
|
||||
525 stub IStream16_CopyTo
|
||||
|
|
|
@ -6606,7 +6606,7 @@ static HRESULT OLECONVERT_LoadOLE10(LPOLESTREAM pOleStream, OLECONVERT_OLESTREAM
|
|||
|
||||
if(hRes == S_OK)
|
||||
{
|
||||
/* Get the TypeID...more info needed for this field */
|
||||
/* Get the TypeID... more info needed for this field */
|
||||
dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwTypeID), sizeof(pData->dwTypeID));
|
||||
if(dwSize != sizeof(pData->dwTypeID))
|
||||
{
|
||||
|
|
|
@ -367,7 +367,7 @@ static struct stub_manager *get_stub_manager_from_ipid(APARTMENT *apt, const IPI
|
|||
return result;
|
||||
}
|
||||
|
||||
HRESULT ipid_to_stub_manager(const IPID *ipid, APARTMENT **stub_apt, struct stub_manager **stubmgr_ret)
|
||||
static HRESULT ipid_to_stub_manager(const IPID *ipid, APARTMENT **stub_apt, struct stub_manager **stubmgr_ret)
|
||||
{
|
||||
/* FIXME: hack for IRemUnknown */
|
||||
if (ipid->Data2 == 0xffff)
|
||||
|
|
|
@ -260,7 +260,7 @@ void __RPC_USER CLIPFORMAT_UserFree(ULONG *pFlags, CLIPFORMAT *pCF)
|
|||
* so nothing to do */
|
||||
}
|
||||
|
||||
static ULONG __RPC_USER handle_UserSize(ULONG *pFlags, ULONG StartingSize, HANDLE *handle)
|
||||
static ULONG handle_UserSize(ULONG *pFlags, ULONG StartingSize, HANDLE *handle)
|
||||
{
|
||||
if (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE)
|
||||
{
|
||||
|
@ -271,7 +271,7 @@ static ULONG __RPC_USER handle_UserSize(ULONG *pFlags, ULONG StartingSize, HANDL
|
|||
return StartingSize + sizeof(RemotableHandle);
|
||||
}
|
||||
|
||||
static unsigned char * __RPC_USER handle_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HANDLE *handle)
|
||||
static unsigned char * handle_UserMarshal(ULONG *pFlags, unsigned char *pBuffer, HANDLE *handle)
|
||||
{
|
||||
RemotableHandle *remhandle = (RemotableHandle *)pBuffer;
|
||||
if (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE)
|
||||
|
@ -285,7 +285,7 @@ static unsigned char * __RPC_USER handle_UserMarshal(ULONG *pFlags, unsigned cha
|
|||
return pBuffer + sizeof(RemotableHandle);
|
||||
}
|
||||
|
||||
static unsigned char * __RPC_USER handle_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HANDLE *handle)
|
||||
static unsigned char * handle_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, HANDLE *handle)
|
||||
{
|
||||
RemotableHandle *remhandle = (RemotableHandle *)pBuffer;
|
||||
if (remhandle->fContext != WDT_INPROC_CALL)
|
||||
|
@ -294,7 +294,7 @@ static unsigned char * __RPC_USER handle_UserUnmarshal(ULONG *pFlags, unsigned c
|
|||
return pBuffer + sizeof(RemotableHandle);
|
||||
}
|
||||
|
||||
static void __RPC_USER handle_UserFree(ULONG *pFlags, HANDLE *phMenu)
|
||||
static void handle_UserFree(ULONG *pFlags, HANDLE *phMenu)
|
||||
{
|
||||
/* nothing to do */
|
||||
}
|
||||
|
@ -1891,25 +1891,26 @@ void __RPC_USER STGMEDIUM_UserFree(ULONG *pFlags, STGMEDIUM *pStgMedium)
|
|||
|
||||
ULONG __RPC_USER ASYNC_STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, ASYNC_STGMEDIUM *pStgMedium)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
return StartingSize;
|
||||
TRACE("\n");
|
||||
return STGMEDIUM_UserSize(pFlags, StartingSize, pStgMedium);
|
||||
}
|
||||
|
||||
unsigned char * __RPC_USER ASYNC_STGMEDIUM_UserMarshal( ULONG *pFlags, unsigned char *pBuffer, ASYNC_STGMEDIUM *pStgMedium)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
return pBuffer;
|
||||
TRACE("\n");
|
||||
return STGMEDIUM_UserMarshal(pFlags, pBuffer, pStgMedium);
|
||||
}
|
||||
|
||||
unsigned char * __RPC_USER ASYNC_STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, ASYNC_STGMEDIUM *pStgMedium)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
return pBuffer;
|
||||
TRACE("\n");
|
||||
return STGMEDIUM_UserUnmarshal(pFlags, pBuffer, pStgMedium);
|
||||
}
|
||||
|
||||
void __RPC_USER ASYNC_STGMEDIUM_UserFree(ULONG *pFlags, ASYNC_STGMEDIUM *pStgMedium)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
TRACE("\n");
|
||||
STGMEDIUM_UserFree(pFlags, pStgMedium);
|
||||
}
|
||||
|
||||
ULONG __RPC_USER FLAG_STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, FLAG_STGMEDIUM *pStgMedium)
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
static IDispatch * WINAPI StdDispatch_Construct(IUnknown * punkOuter, void * pvThis, ITypeInfo * pTypeInfo);
|
||||
static IDispatch * StdDispatch_Construct(IUnknown * punkOuter, void * pvThis, ITypeInfo * pTypeInfo);
|
||||
|
||||
/******************************************************************************
|
||||
* DispInvoke (OLEAUT32.30)
|
||||
|
@ -425,7 +425,7 @@ static const IDispatchVtbl StdDispatch_VTable =
|
|||
StdDispatch_Invoke
|
||||
};
|
||||
|
||||
static IDispatch * WINAPI StdDispatch_Construct(
|
||||
static IDispatch * StdDispatch_Construct(
|
||||
IUnknown * punkOuter,
|
||||
void * pvThis,
|
||||
ITypeInfo * pTypeInfo)
|
||||
|
|
|
@ -41,8 +41,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
|||
|
||||
static BOOL BSTR_bCache = TRUE; /* Cache allocations to minimise alloc calls? */
|
||||
|
||||
HMODULE OLEAUT32_hModule = NULL;
|
||||
|
||||
/******************************************************************************
|
||||
* BSTR {OLEAUT32}
|
||||
*
|
||||
|
@ -419,8 +417,7 @@ INT WINAPI SysReAllocString(LPBSTR old,LPCOLESTR str)
|
|||
/*
|
||||
* Make sure we free the old string.
|
||||
*/
|
||||
if (*old!=NULL)
|
||||
SysFreeString(*old);
|
||||
SysFreeString(*old);
|
||||
|
||||
/*
|
||||
* Allocate the new string
|
||||
|
@ -697,7 +694,8 @@ HRESULT WINAPI OleTranslateColor(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
extern HRESULT OLEAUTPS_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv);
|
||||
extern HRESULT WINAPI OLEAUTPS_DllGetClassObject(REFCLSID, REFIID, LPVOID *) DECLSPEC_HIDDEN;
|
||||
extern BOOL WINAPI OLEAUTPS_DllMain(HINSTANCE, DWORD, LPVOID) DECLSPEC_HIDDEN;
|
||||
|
||||
extern void _get_STDFONT_CF(LPVOID *);
|
||||
extern void _get_STDPIC_CF(LPVOID *);
|
||||
|
@ -831,18 +829,7 @@ HRESULT WINAPI DllCanUnloadNow(void)
|
|||
*/
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
TRACE("(%p,%d,%p)\n", hInstDll, fdwReason, lpvReserved);
|
||||
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DisableThreadLibraryCalls(hInstDll);
|
||||
OLEAUT32_hModule = hInstDll;
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
};
|
||||
|
||||
return TRUE;
|
||||
return OLEAUTPS_DllMain( hInstDll, fdwReason, lpvReserved );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -8,6 +8,12 @@
|
|||
<include base="ReactOS">include/reactos/wine</include>
|
||||
<define name="__WINESRC__" />
|
||||
<define name="_WIN32_WINNT">0x600</define>
|
||||
<define name="PROXY_CLSID">CLSID_PSDispatch</define>
|
||||
<define name="COM_NO_WINDOWS_H"/>
|
||||
<define name="_OLEAUT32_"/>
|
||||
<define name="PROXY_DELEGATION"/>
|
||||
<define name="REGISTER_PROXY_DLL"/>
|
||||
<define name="ENTRY_PREFIX">OLEAUTPS_</define>
|
||||
<file>connpt.c</file>
|
||||
<file>dispatch.c</file>
|
||||
<file>hash.c</file>
|
||||
|
@ -44,6 +50,12 @@
|
|||
<library>pseh</library>
|
||||
</module>
|
||||
<module name="oleaut32_proxy" type="rpcproxy" allowwarnings="true">
|
||||
<define name="COM_NO_WINDOWS_H"/>
|
||||
<define name="PROXY_CLSID">CLSID_PSDispatch</define>
|
||||
<define name="_OLEAUT32_"/>
|
||||
<define name="PROXY_DELEGATION"/>
|
||||
<define name="REGISTER_PROXY_DLL"/>
|
||||
<define name="ENTRY_PREFIX">OLEAUTPS_</define>
|
||||
<file>oleaut32_oaidl.idl</file>
|
||||
<file>oleaut32_ocidl.idl</file>
|
||||
</module>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_KOREAN, SUBLANG_NEUTRAL
|
||||
LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
{
|
||||
|
|
|
@ -16,5 +16,4 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
cpp_quote("#include <winuser.h>")
|
||||
#include "ocidl.idl"
|
||||
|
|
|
@ -328,7 +328,7 @@ static void OLEFont_SendNotify(OLEFontImpl* this, DISPID dispID)
|
|||
*
|
||||
* See Windows documentation for more details on IUnknown methods.
|
||||
*/
|
||||
HRESULT WINAPI OLEFontImpl_QueryInterface(
|
||||
static HRESULT WINAPI OLEFontImpl_QueryInterface(
|
||||
IFont* iface,
|
||||
REFIID riid,
|
||||
void** ppvObject)
|
||||
|
@ -384,7 +384,7 @@ HRESULT WINAPI OLEFontImpl_QueryInterface(
|
|||
*
|
||||
* See Windows documentation for more details on IUnknown methods.
|
||||
*/
|
||||
ULONG WINAPI OLEFontImpl_AddRef(
|
||||
static ULONG WINAPI OLEFontImpl_AddRef(
|
||||
IFont* iface)
|
||||
{
|
||||
OLEFontImpl *this = (OLEFontImpl *)iface;
|
||||
|
@ -397,7 +397,7 @@ ULONG WINAPI OLEFontImpl_AddRef(
|
|||
*
|
||||
* See Windows documentation for more details on IUnknown methods.
|
||||
*/
|
||||
ULONG WINAPI OLEFontImpl_Release(
|
||||
static ULONG WINAPI OLEFontImpl_Release(
|
||||
IFont* iface)
|
||||
{
|
||||
OLEFontImpl *this = (OLEFontImpl *)iface;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*
|
||||
* Copyright 2000 Huw D M Davies for CodeWeavers.
|
||||
* Copyright 2001 Marcus Meissner
|
||||
* Copyright 2008 Kirill K. Smirnov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -508,7 +509,6 @@ static void OLEPicture_SendNotify(OLEPictureImpl* this, DISPID dispID)
|
|||
IUnknown_Release(CD.pUnk);
|
||||
}
|
||||
IEnumConnections_Release(pEnum);
|
||||
return;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
@ -637,6 +637,10 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc,
|
|||
TRACE("prcWBounds (%d,%d) - (%d,%d)\n", prcWBounds->left, prcWBounds->top,
|
||||
prcWBounds->right, prcWBounds->bottom);
|
||||
|
||||
if(cx == 0 || cy == 0 || cxSrc == 0 || cySrc == 0){
|
||||
return CTL_E_INVALIDPROPERTYVALUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* While the documentation suggests this to be here (or after rendering?)
|
||||
* it does cause an endless recursion in my sample app. -MM 20010804
|
||||
|
@ -644,6 +648,10 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc,
|
|||
*/
|
||||
|
||||
switch(This->desc.picType) {
|
||||
case PICTYPE_UNINITIALIZED:
|
||||
case PICTYPE_NONE:
|
||||
/* nothing to do */
|
||||
return S_OK;
|
||||
case PICTYPE_BITMAP:
|
||||
{
|
||||
HBITMAP hbmpOld;
|
||||
|
@ -1035,7 +1043,7 @@ static int _gif_inputfunc(GifFileType *gif, GifByteType *data, int len) {
|
|||
struct gifdata *gd = (struct gifdata*)gif->UserData;
|
||||
|
||||
if (len+gd->curoff > gd->len) {
|
||||
FIXME("Trying to read %d bytes, but only %d available.\n",len, gd->len-gd->curoff);
|
||||
ERR("Trying to read %d bytes, but only %d available.\n",len, gd->len-gd->curoff);
|
||||
len = gd->len - gd->curoff;
|
||||
}
|
||||
memcpy(data, gd->data+gd->curoff, len);
|
||||
|
@ -1065,14 +1073,14 @@ static HRESULT OLEPictureImpl_LoadGif(OLEPictureImpl *This, BYTE *xbuf, ULONG xr
|
|||
gif = DGifOpen((void*)&gd, _gif_inputfunc);
|
||||
ret = DGifSlurp(gif);
|
||||
if (ret == GIF_ERROR) {
|
||||
FIXME("Failed reading GIF using libgif.\n");
|
||||
ERR("Failed reading GIF using libgif.\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
TRACE("screen height %d, width %d\n", gif->SWidth, gif->SHeight);
|
||||
TRACE("color res %d, backgcolor %d\n", gif->SColorResolution, gif->SBackGroundColor);
|
||||
TRACE("imgcnt %d\n", gif->ImageCount);
|
||||
if (gif->ImageCount<1) {
|
||||
FIXME("GIF stream does not have images inside?\n");
|
||||
ERR("GIF stream does not have images inside?\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
TRACE("curimage: %d x %d, on %dx%d, interlace %d\n",
|
||||
|
@ -1258,7 +1266,7 @@ static HRESULT OLEPictureImpl_LoadJpeg(OLEPictureImpl *This, BYTE *xbuf, ULONG x
|
|||
|
||||
if(!libjpeg_handle) {
|
||||
if(!load_libjpeg()) {
|
||||
FIXME("Failed reading JPEG because unable to find %s\n", SONAME_LIBJPEG);
|
||||
ERR("Failed reading JPEG because unable to find %s\n", SONAME_LIBJPEG);
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
@ -1297,7 +1305,7 @@ static HRESULT OLEPictureImpl_LoadJpeg(OLEPictureImpl *This, BYTE *xbuf, ULONG x
|
|||
while ( jd.output_scanline<jd.output_height ) {
|
||||
x = pjpeg_read_scanlines(&jd,&samprow,1);
|
||||
if (x != 1) {
|
||||
FIXME("failed to read current scanline?\n");
|
||||
ERR("failed to read current scanline?\n");
|
||||
break;
|
||||
}
|
||||
/* We have to convert from RGB to BGR, see MSDN/ BITMAPINFOHEADER */
|
||||
|
@ -1610,9 +1618,7 @@ succ:
|
|||
|
||||
end:
|
||||
if(png_ptr)
|
||||
ppng_destroy_read_struct(&png_ptr,
|
||||
(info_ptr ? &info_ptr : (png_infopp) NULL),
|
||||
(png_infopp)NULL);
|
||||
ppng_destroy_read_struct(&png_ptr, info_ptr ? &info_ptr : NULL, NULL);
|
||||
HeapFree(GetProcessHeap(), 0, row_pointers);
|
||||
HeapFree(GetProcessHeap(), 0, pngdata);
|
||||
return ret;
|
||||
|
@ -1671,7 +1677,7 @@ static HRESULT OLEPictureImpl_LoadIcon(OLEPictureImpl *This, BYTE *xbuf, ULONG x
|
|||
0
|
||||
);
|
||||
if (!hicon) {
|
||||
FIXME("CreateIcon failed.\n");
|
||||
ERR("CreateIcon failed.\n");
|
||||
return E_FAIL;
|
||||
} else {
|
||||
This->desc.picType = PICTYPE_ICON;
|
||||
|
@ -1686,39 +1692,24 @@ static HRESULT OLEPictureImpl_LoadIcon(OLEPictureImpl *This, BYTE *xbuf, ULONG x
|
|||
}
|
||||
}
|
||||
|
||||
static HRESULT OLEPictureImpl_LoadMetafile(OLEPictureImpl *This,
|
||||
const BYTE *data, ULONG size)
|
||||
static HRESULT OLEPictureImpl_LoadEnhMetafile(OLEPictureImpl *This,
|
||||
const BYTE *data, ULONG size)
|
||||
{
|
||||
HMETAFILE hmf;
|
||||
HENHMETAFILE hemf;
|
||||
|
||||
/* SetMetaFileBitsEx performs data check on its own */
|
||||
hmf = SetMetaFileBitsEx(size, data);
|
||||
if (hmf)
|
||||
{
|
||||
This->desc.picType = PICTYPE_METAFILE;
|
||||
This->desc.u.wmf.hmeta = hmf;
|
||||
This->desc.u.wmf.xExt = 0;
|
||||
This->desc.u.wmf.yExt = 0;
|
||||
|
||||
This->origWidth = 0;
|
||||
This->origHeight = 0;
|
||||
This->himetricWidth = 0;
|
||||
This->himetricHeight = 0;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
ENHMETAHEADER hdr;
|
||||
|
||||
hemf = SetEnhMetaFileBits(size, data);
|
||||
if (!hemf) return E_FAIL;
|
||||
|
||||
GetEnhMetaFileHeader(hemf, sizeof(hdr), &hdr);
|
||||
|
||||
This->desc.picType = PICTYPE_ENHMETAFILE;
|
||||
This->desc.u.emf.hemf = hemf;
|
||||
|
||||
This->origWidth = 0;
|
||||
This->origHeight = 0;
|
||||
This->himetricWidth = 0;
|
||||
This->himetricHeight = 0;
|
||||
This->himetricWidth = hdr.rclFrame.right - hdr.rclFrame.left;
|
||||
This->himetricHeight = hdr.rclFrame.bottom - hdr.rclFrame.top;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -1727,16 +1718,24 @@ static HRESULT OLEPictureImpl_LoadAPM(OLEPictureImpl *This,
|
|||
const BYTE *data, ULONG size)
|
||||
{
|
||||
APM_HEADER *header = (APM_HEADER *)data;
|
||||
HRESULT hr;
|
||||
HMETAFILE hmf;
|
||||
|
||||
if (size < sizeof(APM_HEADER))
|
||||
return E_FAIL;
|
||||
if (header->key != 0x9ac6cdd7)
|
||||
return E_FAIL;
|
||||
|
||||
if ((hr = OLEPictureImpl_LoadMetafile(This, data + sizeof(APM_HEADER), size - sizeof(*header))) != S_OK)
|
||||
return hr;
|
||||
/* SetMetaFileBitsEx performs data check on its own */
|
||||
hmf = SetMetaFileBitsEx(size - sizeof(*header), data + sizeof(*header));
|
||||
if (!hmf) return E_FAIL;
|
||||
|
||||
This->desc.picType = PICTYPE_METAFILE;
|
||||
This->desc.u.wmf.hmeta = hmf;
|
||||
This->desc.u.wmf.xExt = 0;
|
||||
This->desc.u.wmf.yExt = 0;
|
||||
|
||||
This->origWidth = 0;
|
||||
This->origHeight = 0;
|
||||
This->himetricWidth = MulDiv((INT)header->right - header->left, 2540, header->inch);
|
||||
This->himetricHeight = MulDiv((INT)header->bottom - header->top, 2540, header->inch);
|
||||
return S_OK;
|
||||
|
@ -1807,8 +1806,8 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
|
|||
do {
|
||||
hr=IStream_Read(pStm,header,8,&xread);
|
||||
if (hr || xread!=8) {
|
||||
FIXME("Failure while reading picture header (hr is %x, nread is %d).\n",hr,xread);
|
||||
return hr;
|
||||
ERR("Failure while reading picture header (hr is %x, nread is %d).\n",hr,xread);
|
||||
return (hr?hr:E_FAIL);
|
||||
}
|
||||
headerread += xread;
|
||||
xread = 0;
|
||||
|
@ -1885,7 +1884,7 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
|
|||
break;
|
||||
}
|
||||
if (xread != This->datalen)
|
||||
FIXME("Could only read %d of %d bytes out of stream?\n",xread,This->datalen);
|
||||
ERR("Could only read %d of %d bytes out of stream?\n",xread,This->datalen);
|
||||
}
|
||||
if (This->datalen == 0) { /* Marks the "NONE" picture */
|
||||
This->desc.picType = PICTYPE_NONE;
|
||||
|
@ -1924,8 +1923,8 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
/* let's see if it's a metafile */
|
||||
hr = OLEPictureImpl_LoadMetafile(This, xbuf, xread);
|
||||
/* let's see if it's a EMF */
|
||||
hr = OLEPictureImpl_LoadEnhMetafile(This, xbuf, xread);
|
||||
if (hr == S_OK) break;
|
||||
|
||||
FIXME("Unknown magic %04x, %d read bytes:\n",magic,xread);
|
||||
|
@ -2643,7 +2642,7 @@ HRESULT WINAPI OleLoadPicture( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
|
|||
return hr;
|
||||
hr = IPicture_QueryInterface(newpic,&IID_IPersistStream, (LPVOID*)&ps);
|
||||
if (hr) {
|
||||
FIXME("Could not get IPersistStream iface from Ole Picture?\n");
|
||||
ERR("Could not get IPersistStream iface from Ole Picture?\n");
|
||||
IPicture_Release(newpic);
|
||||
*ppvObj = NULL;
|
||||
return hr;
|
||||
|
@ -2659,7 +2658,7 @@ HRESULT WINAPI OleLoadPicture( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
|
|||
}
|
||||
hr = IPicture_QueryInterface(newpic,riid,ppvObj);
|
||||
if (hr)
|
||||
FIXME("Failed to get interface %s from IPicture.\n",debugstr_guid(riid));
|
||||
ERR("Failed to get interface %s from IPicture.\n",debugstr_guid(riid));
|
||||
IPicture_Release(newpic);
|
||||
return hr;
|
||||
}
|
||||
|
@ -2682,16 +2681,23 @@ HRESULT WINAPI OleLoadPictureEx( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
|
|||
return hr;
|
||||
hr = IPicture_QueryInterface(newpic,&IID_IPersistStream, (LPVOID*)&ps);
|
||||
if (hr) {
|
||||
FIXME("Could not get IPersistStream iface from Ole Picture?\n");
|
||||
ERR("Could not get IPersistStream iface from Ole Picture?\n");
|
||||
IPicture_Release(newpic);
|
||||
*ppvObj = NULL;
|
||||
return hr;
|
||||
}
|
||||
IPersistStream_Load(ps,lpstream);
|
||||
hr = IPersistStream_Load(ps,lpstream);
|
||||
IPersistStream_Release(ps);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("IPersistStream_Load failed\n");
|
||||
IPicture_Release(newpic);
|
||||
*ppvObj = NULL;
|
||||
return hr;
|
||||
}
|
||||
hr = IPicture_QueryInterface(newpic,riid,ppvObj);
|
||||
if (hr)
|
||||
FIXME("Failed to get interface %s from IPicture.\n",debugstr_guid(riid));
|
||||
ERR("Failed to get interface %s from IPicture.\n",debugstr_guid(riid));
|
||||
IPicture_Release(newpic);
|
||||
return hr;
|
||||
}
|
||||
|
@ -2797,7 +2803,7 @@ HRESULT WINAPI OleLoadPicturePath( LPOLESTR szURLorPath, LPUNKNOWN punkCaller,
|
|||
|
||||
hRes = IPicture_QueryInterface(ipicture,riid,ppvRet);
|
||||
if (hRes)
|
||||
FIXME("Failed to get interface %s from IPicture.\n",debugstr_guid(riid));
|
||||
ERR("Failed to get interface %s from IPicture.\n",debugstr_guid(riid));
|
||||
|
||||
IPicture_Release(ipicture);
|
||||
return hRes;
|
||||
|
|
|
@ -59,7 +59,7 @@ static HRESULT copy_to_variant(void *src, VARIANT *pvar, enum VARENUM vt)
|
|||
|
||||
#define CASE_COPY(x) \
|
||||
case VT_ ## x: \
|
||||
V_ ## x(pvar) = *(typeof(V_ ## x(pvar))*)src; \
|
||||
memcpy(&V_ ## x(pvar), src, sizeof(V_ ## x(pvar))); \
|
||||
break
|
||||
|
||||
switch(vt) {
|
||||
|
@ -106,7 +106,7 @@ static HRESULT copy_from_variant(VARIANT *src, void *dest, enum VARENUM vt)
|
|||
|
||||
#define CASE_COPY(x) \
|
||||
case VT_ ## x: \
|
||||
*(typeof(V_ ## x(&var))*)dest = V_ ## x(&var); \
|
||||
memcpy(dest, &V_ ## x(&var), sizeof(V_ ## x(&var))); \
|
||||
break
|
||||
|
||||
switch(vt) {
|
||||
|
@ -236,6 +236,9 @@ static HRESULT WINAPI IRecordInfoImpl_RecordClear(IRecordInfo *iface, PVOID pvEx
|
|||
case VT_UINT_PTR:
|
||||
*(void**)var = NULL;
|
||||
break;
|
||||
case VT_SAFEARRAY:
|
||||
SafeArrayDestroy((SAFEARRAY*)var);
|
||||
break;
|
||||
default:
|
||||
FIXME("Not supported vt = %d\n", This->fields[i].vt);
|
||||
break;
|
||||
|
@ -412,8 +415,7 @@ static HRESULT WINAPI IRecordInfoImpl_GetFieldNames(IRecordInfo *iface, ULONG *p
|
|||
BSTR *rgBstrNames)
|
||||
{
|
||||
IRecordInfoImpl *This = (IRecordInfoImpl*)iface;
|
||||
ULONG n = This->n_vars;
|
||||
int i;
|
||||
ULONG n = This->n_vars, i;
|
||||
|
||||
TRACE("(%p)->(%p %p)\n", This, pcNames, rgBstrNames);
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "typelib.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
|
@ -150,7 +151,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list)
|
|||
KEY_READ | KEY_WRITE, NULL, &key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
|
||||
wsprintfW(buf, fmt, list->num_methods);
|
||||
sprintfW(buf, fmt, list->num_methods);
|
||||
res = RegSetValueExW(key, NULL, 0, REG_SZ,
|
||||
(CONST BYTE*)buf,
|
||||
(lstrlenW(buf) + 1) * sizeof(WCHAR));
|
||||
|
@ -466,353 +467,62 @@ static struct regsvr_coclass const coclass_list[] = {
|
|||
/***********************************************************************
|
||||
* interface list
|
||||
*/
|
||||
#define INTERFACE_ENTRY(interface, clsid16, clsid32) { &IID_##interface, #interface, NULL, sizeof(interface##Vtbl)/sizeof(void*), clsid16, clsid32 }
|
||||
#define LCL_INTERFACE_ENTRY(interface) INTERFACE_ENTRY(interface, NULL, NULL)
|
||||
#define PSFAC_INTERFACE_ENTRY(interface) INTERFACE_ENTRY(interface, NULL, &CLSID_PSFactoryBuffer)
|
||||
#define CLSID_INTERFACE_ENTRY(interface,clsid) INTERFACE_ENTRY(interface, clsid, clsid)
|
||||
|
||||
static struct regsvr_interface const interface_list[] = {
|
||||
{ &IID_IDispatch,
|
||||
"IDispatch",
|
||||
NULL,
|
||||
7,
|
||||
&CLSID_PSDispatch,
|
||||
&CLSID_PSDispatch
|
||||
},
|
||||
{ &IID_ITypeInfo,
|
||||
"ITypeInfo",
|
||||
NULL,
|
||||
22,
|
||||
&CLSID_PSTypeInfo,
|
||||
&CLSID_PSTypeInfo
|
||||
},
|
||||
{ &IID_ITypeLib,
|
||||
"ITypeLib",
|
||||
NULL,
|
||||
13,
|
||||
&CLSID_PSTypeLib,
|
||||
&CLSID_PSTypeLib
|
||||
},
|
||||
{ &IID_ITypeComp,
|
||||
"ITypeComp",
|
||||
NULL,
|
||||
5,
|
||||
&CLSID_PSTypeComp,
|
||||
&CLSID_PSTypeComp
|
||||
},
|
||||
{ &IID_IEnumVARIANT,
|
||||
"IEnumVARIANT",
|
||||
NULL,
|
||||
15,
|
||||
&CLSID_PSEnumVariant,
|
||||
&CLSID_PSEnumVariant
|
||||
},
|
||||
{ &IID_ICreateTypeInfo,
|
||||
"ICreateTypeInfo",
|
||||
NULL,
|
||||
26,
|
||||
NULL,
|
||||
NULL
|
||||
},
|
||||
{ &IID_ICreateTypeLib,
|
||||
"ICreateTypeLib",
|
||||
NULL,
|
||||
13,
|
||||
NULL,
|
||||
NULL
|
||||
},
|
||||
{ &IID_ITypeInfo2,
|
||||
"ITypeInfo2",
|
||||
NULL,
|
||||
32,
|
||||
NULL,
|
||||
&CLSID_PSDispatch
|
||||
},
|
||||
{ &IID_ITypeLib2,
|
||||
"ITypeLib2",
|
||||
NULL,
|
||||
16,
|
||||
NULL,
|
||||
&CLSID_PSDispatch
|
||||
},
|
||||
{ &IID_IPropertyPage2,
|
||||
"IPropertyPage2",
|
||||
NULL,
|
||||
15,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IErrorInfo,
|
||||
"IErrorInfo",
|
||||
NULL,
|
||||
8,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_ICreateErrorInfo,
|
||||
"ICreateErrorInfo",
|
||||
NULL,
|
||||
8,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IPersistPropertyBag2,
|
||||
"IPersistPropertyBag2",
|
||||
NULL,
|
||||
8,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IPropertyBag2,
|
||||
"IPropertyBag2",
|
||||
NULL,
|
||||
8,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IErrorLog,
|
||||
"IErrorLog",
|
||||
NULL,
|
||||
4,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IPerPropertyBrowsing,
|
||||
"IPerPropertyBrowsing",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IPersistPropertyBag,
|
||||
"IPersistPropertyBag",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IAdviseSinkEx,
|
||||
"IAdviseSinkEx",
|
||||
NULL,
|
||||
9,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IFontEventsDisp,
|
||||
"IFontEventsDisp",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IPropertyBag,
|
||||
"IPropertyBag",
|
||||
NULL,
|
||||
5,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IPointerInactive,
|
||||
"IPointerInactive",
|
||||
NULL,
|
||||
6,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_ISimpleFrameSite,
|
||||
"ISimpleFrameSite",
|
||||
NULL,
|
||||
5,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IPicture,
|
||||
"IPicture",
|
||||
NULL,
|
||||
17,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IPictureDisp,
|
||||
"IPictureDisp",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IPersistStreamInit,
|
||||
"IPersistStreamInit",
|
||||
NULL,
|
||||
9,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IOleUndoUnit,
|
||||
"IOleUndoUnit",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IPropertyNotifySink,
|
||||
"IPropertyNotifySink",
|
||||
NULL,
|
||||
5,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IOleInPlaceSiteEx,
|
||||
"IOleInPlaceSiteEx",
|
||||
NULL,
|
||||
18,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IOleParentUndoUnit,
|
||||
"IOleParentUndoUnit",
|
||||
NULL,
|
||||
12,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IProvideClassInfo2,
|
||||
"IProvideClassInfo2",
|
||||
NULL,
|
||||
5,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IProvideMultipleClassInfo,
|
||||
"IProvideMultipleClassInfo",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IProvideClassInfo,
|
||||
"IProvideClassInfo",
|
||||
NULL,
|
||||
4,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IConnectionPointContainer,
|
||||
"IConnectionPointContainer",
|
||||
NULL,
|
||||
5,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IEnumConnectionPoints,
|
||||
"IEnumConnectionPoints",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IConnectionPoint,
|
||||
"IConnectionPoint",
|
||||
NULL,
|
||||
8,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IEnumConnections,
|
||||
"IEnumConnections",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IOleControl,
|
||||
"IOleControl",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IOleControlSite,
|
||||
"IOleControlSite",
|
||||
NULL,
|
||||
10,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_ISpecifyPropertyPages,
|
||||
"ISpecifyPropertyPages",
|
||||
NULL,
|
||||
4,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IPropertyPageSite,
|
||||
"IPropertyPageSite",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IPropertyPage,
|
||||
"IPropertyPage",
|
||||
NULL,
|
||||
14,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IClassFactory2,
|
||||
"IClassFactory2",
|
||||
NULL,
|
||||
8,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IEnumOleUndoUnits,
|
||||
"IEnumOleUndoUnits",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IPersistMemory,
|
||||
"IPersistMemory",
|
||||
NULL,
|
||||
9,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IFont,
|
||||
"IFont",
|
||||
NULL,
|
||||
27,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IFontDisp,
|
||||
"IFontDisp",
|
||||
NULL,
|
||||
7,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IQuickActivate,
|
||||
"IQuickActivate",
|
||||
NULL,
|
||||
6,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IOleUndoManager,
|
||||
"IOleUndoManager",
|
||||
NULL,
|
||||
15,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
{ &IID_IObjectWithSite,
|
||||
"IObjectWithSite",
|
||||
NULL,
|
||||
5,
|
||||
NULL,
|
||||
&CLSID_PSFactoryBuffer
|
||||
},
|
||||
LCL_INTERFACE_ENTRY(ICreateTypeInfo),
|
||||
LCL_INTERFACE_ENTRY(ICreateTypeLib),
|
||||
CLSID_INTERFACE_ENTRY(IDispatch,&CLSID_PSDispatch),
|
||||
CLSID_INTERFACE_ENTRY(IEnumVARIANT,&CLSID_PSEnumVariant),
|
||||
CLSID_INTERFACE_ENTRY(ITypeComp,&CLSID_PSTypeComp),
|
||||
CLSID_INTERFACE_ENTRY(ITypeInfo,&CLSID_PSTypeInfo),
|
||||
CLSID_INTERFACE_ENTRY(ITypeLib,&CLSID_PSTypeLib),
|
||||
PSFAC_INTERFACE_ENTRY(IAdviseSinkEx),
|
||||
PSFAC_INTERFACE_ENTRY(IClassFactory2),
|
||||
PSFAC_INTERFACE_ENTRY(IConnectionPoint),
|
||||
PSFAC_INTERFACE_ENTRY(IConnectionPointContainer),
|
||||
PSFAC_INTERFACE_ENTRY(ICreateErrorInfo),
|
||||
PSFAC_INTERFACE_ENTRY(IEnumConnectionPoints),
|
||||
PSFAC_INTERFACE_ENTRY(IEnumConnections),
|
||||
PSFAC_INTERFACE_ENTRY(IEnumOleUndoUnits),
|
||||
PSFAC_INTERFACE_ENTRY(IErrorInfo),
|
||||
PSFAC_INTERFACE_ENTRY(IErrorLog),
|
||||
PSFAC_INTERFACE_ENTRY(IFont),
|
||||
PSFAC_INTERFACE_ENTRY(IObjectWithSite),
|
||||
PSFAC_INTERFACE_ENTRY(IOleControl),
|
||||
PSFAC_INTERFACE_ENTRY(IOleControlSite),
|
||||
PSFAC_INTERFACE_ENTRY(IOleInPlaceSiteEx),
|
||||
PSFAC_INTERFACE_ENTRY(IOleParentUndoUnit),
|
||||
PSFAC_INTERFACE_ENTRY(IOleUndoManager),
|
||||
PSFAC_INTERFACE_ENTRY(IOleUndoUnit),
|
||||
PSFAC_INTERFACE_ENTRY(IPerPropertyBrowsing),
|
||||
PSFAC_INTERFACE_ENTRY(IPersistMemory),
|
||||
PSFAC_INTERFACE_ENTRY(IPersistPropertyBag),
|
||||
PSFAC_INTERFACE_ENTRY(IPersistPropertyBag2),
|
||||
PSFAC_INTERFACE_ENTRY(IPersistStreamInit),
|
||||
PSFAC_INTERFACE_ENTRY(IPicture),
|
||||
PSFAC_INTERFACE_ENTRY(IPointerInactive),
|
||||
PSFAC_INTERFACE_ENTRY(IPropertyBag),
|
||||
PSFAC_INTERFACE_ENTRY(IPropertyBag2),
|
||||
PSFAC_INTERFACE_ENTRY(IPropertyNotifySink),
|
||||
PSFAC_INTERFACE_ENTRY(IPropertyPage),
|
||||
PSFAC_INTERFACE_ENTRY(IPropertyPage2),
|
||||
PSFAC_INTERFACE_ENTRY(IPropertyPageSite),
|
||||
PSFAC_INTERFACE_ENTRY(IProvideClassInfo),
|
||||
PSFAC_INTERFACE_ENTRY(IProvideClassInfo2),
|
||||
PSFAC_INTERFACE_ENTRY(IProvideMultipleClassInfo),
|
||||
PSFAC_INTERFACE_ENTRY(IQuickActivate),
|
||||
PSFAC_INTERFACE_ENTRY(ISimpleFrameSite),
|
||||
PSFAC_INTERFACE_ENTRY(ISpecifyPropertyPages),
|
||||
{ NULL } /* list terminator */
|
||||
};
|
||||
|
||||
extern HRESULT WINAPI OLEAUTPS_DllRegisterServer(void) DECLSPEC_HIDDEN;
|
||||
extern HRESULT WINAPI OLEAUTPS_DllUnregisterServer(void) DECLSPEC_HIDDEN;
|
||||
|
||||
/***********************************************************************
|
||||
* DllRegisterServer (OLEAUT32.@)
|
||||
*/
|
||||
|
@ -822,7 +532,9 @@ HRESULT WINAPI DllRegisterServer(void)
|
|||
|
||||
TRACE("\n");
|
||||
|
||||
hr = register_coclasses(coclass_list);
|
||||
hr = OLEAUTPS_DllRegisterServer();
|
||||
if (SUCCEEDED(hr))
|
||||
hr = register_coclasses(coclass_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = register_interfaces(interface_list);
|
||||
return hr;
|
||||
|
@ -840,5 +552,7 @@ HRESULT WINAPI DllUnregisterServer(void)
|
|||
hr = unregister_coclasses(coclass_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = unregister_interfaces(interface_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = OLEAUTPS_DllUnregisterServer();
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ static void SAFEARRAY_SetFeatures(VARTYPE vt, SAFEARRAY *psa)
|
|||
static SAFEARRAY* SAFEARRAY_Create(VARTYPE vt, UINT cDims, const SAFEARRAYBOUND *rgsabound, ULONG ulSize)
|
||||
{
|
||||
SAFEARRAY *psa = NULL;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (!rgsabound)
|
||||
return NULL;
|
||||
|
@ -314,8 +314,7 @@ static HRESULT SAFEARRAY_DestroyData(SAFEARRAY *psa, ULONG ulStartCell)
|
|||
|
||||
while(ulCellCount--)
|
||||
{
|
||||
if (*lpBstr)
|
||||
SysFreeString(*lpBstr);
|
||||
SysFreeString(*lpBstr);
|
||||
lpBstr++;
|
||||
}
|
||||
}
|
||||
|
@ -865,8 +864,7 @@ HRESULT WINAPI SafeArrayPutElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData
|
|||
BSTR lpBstr = (BSTR)pvData;
|
||||
BSTR* lpDest = (BSTR*)lpvDest;
|
||||
|
||||
if (*lpDest)
|
||||
SysFreeString(*lpDest);
|
||||
SysFreeString(*lpDest);
|
||||
|
||||
*lpDest = SysAllocStringByteLen((char*)lpBstr, SysStringByteLen(lpBstr));
|
||||
if (!*lpDest)
|
||||
|
|
|
@ -1420,8 +1420,8 @@ xCall(LPVOID retptr, int method, TMProxyImpl *tpinfo /*, args */)
|
|||
TRACE_(olerelay)("(");
|
||||
}
|
||||
|
||||
if (iname) SysFreeString(iname);
|
||||
if (fname) SysFreeString(fname);
|
||||
SysFreeString(iname);
|
||||
SysFreeString(fname);
|
||||
|
||||
memset(&buf,0,sizeof(buf));
|
||||
|
||||
|
@ -2080,7 +2080,7 @@ TMStubImpl_Invoke(
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if (iname) SysFreeString (iname);
|
||||
SysFreeString (iname);
|
||||
|
||||
/* Need them for hack below */
|
||||
memset(names,0,sizeof(names));
|
||||
|
|
|
@ -64,7 +64,9 @@
|
|||
#include "winnls.h"
|
||||
#include "winreg.h"
|
||||
#include "winuser.h"
|
||||
#include "lzexpand.h"
|
||||
|
||||
#include "wine/winbase16.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "objbase.h"
|
||||
#include "typelib.h"
|
||||
|
@ -394,7 +396,7 @@ HRESULT WINAPI LoadTypeLibEx(
|
|||
/* else fall-through */
|
||||
|
||||
case REGKIND_REGISTER:
|
||||
if (!SUCCEEDED(res = RegisterTypeLib(*pptLib, (LPOLESTR)szPath, NULL)))
|
||||
if (FAILED(res = RegisterTypeLib(*pptLib, (LPOLESTR)szPath, NULL)))
|
||||
{
|
||||
IUnknown_Release(*pptLib);
|
||||
*pptLib = 0;
|
||||
|
@ -491,7 +493,7 @@ HRESULT WINAPI RegisterTypeLib(
|
|||
if (ptlib == NULL || szFullPath == NULL)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (!SUCCEEDED(ITypeLib_GetLibAttr(ptlib, &attr)))
|
||||
if (FAILED(ITypeLib_GetLibAttr(ptlib, &attr)))
|
||||
return E_FAIL;
|
||||
|
||||
get_typelib_key( &attr->guid, attr->wMajorVerNum, attr->wMinorVerNum, keyName );
|
||||
|
@ -838,7 +840,7 @@ enddeleteloop:
|
|||
}
|
||||
|
||||
end:
|
||||
if (tlibPath) SysFreeString(tlibPath);
|
||||
SysFreeString(tlibPath);
|
||||
if (typeLib) ITypeLib_Release(typeLib);
|
||||
if (subKey) RegCloseKey(subKey);
|
||||
if (key) RegCloseKey(key);
|
||||
|
@ -1034,7 +1036,7 @@ static inline ITypeInfoImpl *info_impl_from_ITypeComp( ITypeComp *iface )
|
|||
static const ITypeInfo2Vtbl tinfvt;
|
||||
static const ITypeCompVtbl tcompvt;
|
||||
|
||||
static ITypeInfo2 * WINAPI ITypeInfo_Constructor(void);
|
||||
static ITypeInfo2 * ITypeInfo_Constructor(void);
|
||||
|
||||
typedef struct tagTLBContext
|
||||
{
|
||||
|
@ -1294,7 +1296,7 @@ static void dump_Variant(const VARIANT * pvar)
|
|||
|
||||
static void dump_DispParms(const DISPPARAMS * pdp)
|
||||
{
|
||||
int index;
|
||||
unsigned int index;
|
||||
|
||||
TRACE("args=%u named args=%u\n", pdp->cArgs, pdp->cNamedArgs);
|
||||
|
||||
|
@ -2326,6 +2328,220 @@ static HRESULT TLB_PEFile_Open(LPCWSTR path, INT index, LPVOID *ppBase, DWORD *p
|
|||
return TYPE_E_CANTLOADLIBRARY;
|
||||
}
|
||||
|
||||
typedef struct TLB_NEFile
|
||||
{
|
||||
const IUnknownVtbl *lpvtbl;
|
||||
LONG refs;
|
||||
LPVOID typelib_base;
|
||||
} TLB_NEFile;
|
||||
|
||||
static HRESULT WINAPI TLB_NEFile_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
if (IsEqualIID(riid, &IID_IUnknown))
|
||||
{
|
||||
*ppv = iface;
|
||||
IUnknown_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI TLB_NEFile_AddRef(IUnknown *iface)
|
||||
{
|
||||
TLB_NEFile *This = (TLB_NEFile *)iface;
|
||||
return InterlockedIncrement(&This->refs);
|
||||
}
|
||||
|
||||
static ULONG WINAPI TLB_NEFile_Release(IUnknown *iface)
|
||||
{
|
||||
TLB_NEFile *This = (TLB_NEFile *)iface;
|
||||
ULONG refs = InterlockedDecrement(&This->refs);
|
||||
if (!refs)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, This->typelib_base);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
return refs;
|
||||
}
|
||||
|
||||
static const IUnknownVtbl TLB_NEFile_Vtable =
|
||||
{
|
||||
TLB_NEFile_QueryInterface,
|
||||
TLB_NEFile_AddRef,
|
||||
TLB_NEFile_Release
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* read_xx_header [internal]
|
||||
*/
|
||||
static int read_xx_header( HFILE lzfd )
|
||||
{
|
||||
IMAGE_DOS_HEADER mzh;
|
||||
char magic[3];
|
||||
|
||||
LZSeek( lzfd, 0, SEEK_SET );
|
||||
if ( sizeof(mzh) != LZRead( lzfd, (LPSTR)&mzh, sizeof(mzh) ) )
|
||||
return 0;
|
||||
if ( mzh.e_magic != IMAGE_DOS_SIGNATURE )
|
||||
return 0;
|
||||
|
||||
LZSeek( lzfd, mzh.e_lfanew, SEEK_SET );
|
||||
if ( 2 != LZRead( lzfd, magic, 2 ) )
|
||||
return 0;
|
||||
|
||||
LZSeek( lzfd, mzh.e_lfanew, SEEK_SET );
|
||||
|
||||
if ( magic[0] == 'N' && magic[1] == 'E' )
|
||||
return IMAGE_OS2_SIGNATURE;
|
||||
if ( magic[0] == 'P' && magic[1] == 'E' )
|
||||
return IMAGE_NT_SIGNATURE;
|
||||
|
||||
magic[2] = '\0';
|
||||
WARN("Can't handle %s files.\n", magic );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* find_ne_resource [internal]
|
||||
*/
|
||||
static BOOL find_ne_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid,
|
||||
DWORD *resLen, DWORD *resOff )
|
||||
{
|
||||
IMAGE_OS2_HEADER nehd;
|
||||
NE_TYPEINFO *typeInfo;
|
||||
NE_NAMEINFO *nameInfo;
|
||||
DWORD nehdoffset;
|
||||
LPBYTE resTab;
|
||||
DWORD resTabSize;
|
||||
int count;
|
||||
|
||||
/* Read in NE header */
|
||||
nehdoffset = LZSeek( lzfd, 0, SEEK_CUR );
|
||||
if ( sizeof(nehd) != LZRead( lzfd, (LPSTR)&nehd, sizeof(nehd) ) ) return 0;
|
||||
|
||||
resTabSize = nehd.ne_restab - nehd.ne_rsrctab;
|
||||
if ( !resTabSize )
|
||||
{
|
||||
TRACE("No resources in NE dll\n" );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Read in resource table */
|
||||
resTab = HeapAlloc( GetProcessHeap(), 0, resTabSize );
|
||||
if ( !resTab ) return FALSE;
|
||||
|
||||
LZSeek( lzfd, nehd.ne_rsrctab + nehdoffset, SEEK_SET );
|
||||
if ( resTabSize != LZRead( lzfd, (char*)resTab, resTabSize ) )
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, resTab );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Find resource */
|
||||
typeInfo = (NE_TYPEINFO *)(resTab + 2);
|
||||
|
||||
if (HIWORD(typeid) != 0) /* named type */
|
||||
{
|
||||
BYTE len = strlen( typeid );
|
||||
while (typeInfo->type_id)
|
||||
{
|
||||
if (!(typeInfo->type_id & 0x8000))
|
||||
{
|
||||
BYTE *p = resTab + typeInfo->type_id;
|
||||
if ((*p == len) && !strncasecmp( (char*)p+1, typeid, len )) goto found_type;
|
||||
}
|
||||
typeInfo = (NE_TYPEINFO *)((char *)(typeInfo + 1) +
|
||||
typeInfo->count * sizeof(NE_NAMEINFO));
|
||||
}
|
||||
}
|
||||
else /* numeric type id */
|
||||
{
|
||||
WORD id = LOWORD(typeid) | 0x8000;
|
||||
while (typeInfo->type_id)
|
||||
{
|
||||
if (typeInfo->type_id == id) goto found_type;
|
||||
typeInfo = (NE_TYPEINFO *)((char *)(typeInfo + 1) +
|
||||
typeInfo->count * sizeof(NE_NAMEINFO));
|
||||
}
|
||||
}
|
||||
TRACE("No typeid entry found for %p\n", typeid );
|
||||
HeapFree( GetProcessHeap(), 0, resTab );
|
||||
return FALSE;
|
||||
|
||||
found_type:
|
||||
nameInfo = (NE_NAMEINFO *)(typeInfo + 1);
|
||||
|
||||
if (HIWORD(resid) != 0) /* named resource */
|
||||
{
|
||||
BYTE len = strlen( resid );
|
||||
for (count = typeInfo->count; count > 0; count--, nameInfo++)
|
||||
{
|
||||
BYTE *p = resTab + nameInfo->id;
|
||||
if (nameInfo->id & 0x8000) continue;
|
||||
if ((*p == len) && !strncasecmp( (char*)p+1, resid, len )) goto found_name;
|
||||
}
|
||||
}
|
||||
else /* numeric resource id */
|
||||
{
|
||||
WORD id = LOWORD(resid) | 0x8000;
|
||||
for (count = typeInfo->count; count > 0; count--, nameInfo++)
|
||||
if (nameInfo->id == id) goto found_name;
|
||||
}
|
||||
TRACE("No resid entry found for %p\n", typeid );
|
||||
HeapFree( GetProcessHeap(), 0, resTab );
|
||||
return FALSE;
|
||||
|
||||
found_name:
|
||||
/* Return resource data */
|
||||
if ( resLen ) *resLen = nameInfo->length << *(WORD *)resTab;
|
||||
if ( resOff ) *resOff = nameInfo->offset << *(WORD *)resTab;
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, resTab );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static HRESULT TLB_NEFile_Open(LPCWSTR path, INT index, LPVOID *ppBase, DWORD *pdwTLBLength, IUnknown **ppFile){
|
||||
|
||||
HFILE lzfd = -1;
|
||||
OFSTRUCT ofs;
|
||||
HRESULT hr = TYPE_E_CANTLOADLIBRARY;
|
||||
TLB_NEFile *This = NULL;
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
|
||||
if (!This) return E_OUTOFMEMORY;
|
||||
|
||||
This->lpvtbl = &TLB_NEFile_Vtable;
|
||||
This->refs = 1;
|
||||
This->typelib_base = NULL;
|
||||
|
||||
lzfd = LZOpenFileW( (LPWSTR)path, &ofs, OF_READ );
|
||||
if ( lzfd >= 0 && read_xx_header( lzfd ) == IMAGE_OS2_SIGNATURE )
|
||||
{
|
||||
DWORD reslen, offset;
|
||||
if( find_ne_resource( lzfd, "TYPELIB", MAKEINTRESOURCEA(index), &reslen, &offset ) )
|
||||
{
|
||||
This->typelib_base = HeapAlloc(GetProcessHeap(), 0, reslen);
|
||||
if( !This->typelib_base )
|
||||
hr = E_OUTOFMEMORY;
|
||||
else
|
||||
{
|
||||
LZSeek( lzfd, offset, SEEK_SET );
|
||||
reslen = LZRead( lzfd, This->typelib_base, reslen );
|
||||
LZClose( lzfd );
|
||||
*ppBase = This->typelib_base;
|
||||
*pdwTLBLength = reslen;
|
||||
*ppFile = (IUnknown *)&This->lpvtbl;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( lzfd >= 0) LZClose( lzfd );
|
||||
TLB_NEFile_Release((IUnknown *)&This->lpvtbl);
|
||||
return hr;
|
||||
}
|
||||
|
||||
typedef struct TLB_Mapping
|
||||
{
|
||||
|
@ -2485,6 +2701,8 @@ static HRESULT TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath
|
|||
/* now actually load and parse the typelib */
|
||||
|
||||
ret = TLB_PEFile_Open(pszPath, index, &pBase, &dwTLBLength, &pFile);
|
||||
if (ret == TYPE_E_CANTLOADLIBRARY)
|
||||
ret = TLB_NEFile_Open(pszPath, index, &pBase, &dwTLBLength, &pFile);
|
||||
if (ret == TYPE_E_CANTLOADLIBRARY)
|
||||
ret = TLB_Mapping_Open(pszPath, &pBase, &dwTLBLength, &pFile);
|
||||
if (SUCCEEDED(ret))
|
||||
|
@ -2973,7 +3191,7 @@ static WORD *SLTG_DoElem(WORD *pType, char *pBlk,
|
|||
static sltg_ref_lookup_t *SLTG_DoRefs(SLTG_RefInfo *pRef, ITypeLibImpl *pTL,
|
||||
char *pNameTable)
|
||||
{
|
||||
int ref;
|
||||
unsigned int ref;
|
||||
char *name;
|
||||
TLBRefType *ref_type;
|
||||
sltg_ref_lookup_t *table;
|
||||
|
@ -3833,29 +4051,17 @@ static ULONG WINAPI ITypeLib2_fnRelease( ITypeLib2 *iface)
|
|||
}
|
||||
TRACE(" destroying ITypeLib(%p)\n",This);
|
||||
|
||||
if (This->Name)
|
||||
{
|
||||
SysFreeString(This->Name);
|
||||
This->Name = NULL;
|
||||
}
|
||||
SysFreeString(This->Name);
|
||||
This->Name = NULL;
|
||||
|
||||
if (This->DocString)
|
||||
{
|
||||
SysFreeString(This->DocString);
|
||||
This->DocString = NULL;
|
||||
}
|
||||
SysFreeString(This->DocString);
|
||||
This->DocString = NULL;
|
||||
|
||||
if (This->HelpFile)
|
||||
{
|
||||
SysFreeString(This->HelpFile);
|
||||
This->HelpFile = NULL;
|
||||
}
|
||||
SysFreeString(This->HelpFile);
|
||||
This->HelpFile = NULL;
|
||||
|
||||
if (This->HelpStringDll)
|
||||
{
|
||||
SysFreeString(This->HelpStringDll);
|
||||
This->HelpStringDll = NULL;
|
||||
}
|
||||
SysFreeString(This->HelpStringDll);
|
||||
This->HelpStringDll = NULL;
|
||||
|
||||
for (pCustData = This->pCustData; pCustData; pCustData = pCustDataNext)
|
||||
{
|
||||
|
@ -3916,7 +4122,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfo(
|
|||
UINT index,
|
||||
ITypeInfo **ppTInfo)
|
||||
{
|
||||
int i;
|
||||
UINT i;
|
||||
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
ITypeInfoImpl *pTypeInfo = This->pTypeInfo;
|
||||
|
@ -3954,9 +4160,9 @@ static HRESULT WINAPI ITypeLib2_fnGetTypeInfoType(
|
|||
TYPEKIND *pTKind)
|
||||
{
|
||||
ITypeLibImpl *This = (ITypeLibImpl *)iface;
|
||||
int i;
|
||||
UINT i;
|
||||
ITypeInfoImpl *pTInfo = This->pTypeInfo;
|
||||
|
||||
|
||||
if (ITypeLib2_fnGetTypeInfoCount(iface) < index + 1)
|
||||
return TYPE_E_ELEMENTNOTFOUND;
|
||||
|
||||
|
@ -4599,7 +4805,7 @@ static const ITypeCompVtbl tlbtcvt =
|
|||
};
|
||||
|
||||
/*================== ITypeInfo(2) Methods ===================================*/
|
||||
static ITypeInfo2 * WINAPI ITypeInfo_Constructor(void)
|
||||
static ITypeInfo2 * ITypeInfo_Constructor(void)
|
||||
{
|
||||
ITypeInfoImpl * pTypeInfoImpl;
|
||||
|
||||
|
@ -4679,27 +4885,18 @@ static ULONG WINAPI ITypeInfo_fnRelease(ITypeInfo2 *iface)
|
|||
if (This->no_free_data)
|
||||
goto finish_free;
|
||||
|
||||
if (This->Name)
|
||||
{
|
||||
SysFreeString(This->Name);
|
||||
This->Name = 0;
|
||||
}
|
||||
SysFreeString(This->Name);
|
||||
This->Name = NULL;
|
||||
|
||||
if (This->DocString)
|
||||
{
|
||||
SysFreeString(This->DocString);
|
||||
This->DocString = 0;
|
||||
}
|
||||
SysFreeString(This->DocString);
|
||||
This->DocString = NULL;
|
||||
|
||||
if (This->DllName)
|
||||
{
|
||||
SysFreeString(This->DllName);
|
||||
This->DllName = 0;
|
||||
}
|
||||
SysFreeString(This->DllName);
|
||||
This->DllName = NULL;
|
||||
|
||||
for (pFInfo = This->funclist; pFInfo; pFInfo = pFInfoNext)
|
||||
{
|
||||
UINT i;
|
||||
INT i;
|
||||
for(i = 0;i < pFInfo->funcdesc.cParams; i++)
|
||||
{
|
||||
ELEMDESC *elemdesc = &pFInfo->funcdesc.lprgelemdescParam[i];
|
||||
|
@ -4934,7 +5131,7 @@ HRESULT ITypeInfoImpl_GetInternalFuncDesc( ITypeInfo *iface, UINT index, const F
|
|||
{
|
||||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
const TLBFuncDesc *pFDesc;
|
||||
int i;
|
||||
UINT i;
|
||||
|
||||
for(i=0, pFDesc=This->funclist; i!=index && pFDesc; i++, pFDesc=pFDesc->next)
|
||||
;
|
||||
|
@ -5127,7 +5324,7 @@ static HRESULT WINAPI ITypeInfo_fnGetVarDesc( ITypeInfo2 *iface, UINT index,
|
|||
LPVARDESC *ppVarDesc)
|
||||
{
|
||||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
int i;
|
||||
UINT i;
|
||||
const TLBVarDesc *pVDesc;
|
||||
|
||||
TRACE("(%p) index %d\n", This, index);
|
||||
|
@ -5219,7 +5416,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeOfImplType(
|
|||
HREFTYPE *pRefType)
|
||||
{
|
||||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
int i;
|
||||
UINT i;
|
||||
HRESULT hr = S_OK;
|
||||
const TLBImplType *pImpl = This->impltypelist;
|
||||
|
||||
|
@ -5282,7 +5479,7 @@ static HRESULT WINAPI ITypeInfo_fnGetImplTypeFlags( ITypeInfo2 *iface,
|
|||
UINT index, INT *pImplTypeFlags)
|
||||
{
|
||||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
int i;
|
||||
UINT i;
|
||||
TLBImplType *pImpl;
|
||||
|
||||
TRACE("(%p) index %d\n", This, index);
|
||||
|
@ -5308,7 +5505,7 @@ static HRESULT WINAPI ITypeInfo_fnGetIDsOfNames( ITypeInfo2 *iface,
|
|||
const TLBFuncDesc *pFDesc;
|
||||
const TLBVarDesc *pVDesc;
|
||||
HRESULT ret=S_OK;
|
||||
int i;
|
||||
UINT i;
|
||||
|
||||
TRACE("(%p) Name %s cNames %d\n", This, debugstr_w(*rgszNames),
|
||||
cNames);
|
||||
|
@ -5488,7 +5685,7 @@ _invoke(FARPROC func,CALLCONV callconv, int nrargs, DWORD *args) {
|
|||
/* The size of the argument on the stack in DWORD units (in all x86 call
|
||||
* convetions the arguments on the stack are DWORD-aligned)
|
||||
*/
|
||||
int _dispargsize(VARTYPE vt)
|
||||
static int _dispargsize(VARTYPE vt)
|
||||
{
|
||||
switch (vt) {
|
||||
case VT_I8:
|
||||
|
@ -5684,7 +5881,8 @@ DispCallFunc(
|
|||
void* pvInstance, ULONG_PTR oVft, CALLCONV cc, VARTYPE vtReturn, UINT cActuals,
|
||||
VARTYPE* prgvt, VARIANTARG** prgpvarg, VARIANT* pvargResult)
|
||||
{
|
||||
int i, argsize, argspos;
|
||||
int argsize, argspos;
|
||||
UINT i;
|
||||
DWORD *args;
|
||||
HRESULT hres;
|
||||
|
||||
|
@ -5698,7 +5896,7 @@ DispCallFunc(
|
|||
|
||||
for (i=0;i<cActuals;i++)
|
||||
{
|
||||
TRACE("arg %d: type %d, size %d\n",i,prgvt[i],_dispargsize(prgvt[i]));
|
||||
TRACE("arg %u: type %d, size %d\n",i,prgvt[i],_dispargsize(prgvt[i]));
|
||||
dump_Variant(prgpvarg[i]);
|
||||
argsize += _dispargsize(prgvt[i]);
|
||||
}
|
||||
|
@ -5714,7 +5912,7 @@ DispCallFunc(
|
|||
for (i=0;i<cActuals;i++)
|
||||
{
|
||||
VARIANT *arg = prgpvarg[i];
|
||||
TRACE("Storing arg %d (%d as %d)\n",i,V_VT(arg),prgvt[i]);
|
||||
TRACE("Storing arg %u (%d as %d)\n",i,V_VT(arg),prgvt[i]);
|
||||
if (prgvt[i] == VT_VARIANT)
|
||||
memcpy(&args[argspos], arg, _dispargsize(prgvt[i]) * sizeof(DWORD));
|
||||
else
|
||||
|
@ -6470,7 +6668,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo(
|
|||
ref_type->pImpTLInfo->lcid,
|
||||
&pTLib);
|
||||
|
||||
if(!SUCCEEDED(result)) {
|
||||
if(FAILED(result)) {
|
||||
BSTR libnam=SysAllocString(ref_type->pImpTLInfo->name);
|
||||
result=LoadTypeLib(libnam, &pTLib);
|
||||
SysFreeString(libnam);
|
||||
|
@ -6526,7 +6724,7 @@ static HRESULT WINAPI ITypeInfo_fnAddressOfMember( ITypeInfo2 *iface,
|
|||
{
|
||||
ERR("couldn't load %s\n", debugstr_w(dll));
|
||||
SysFreeString(dll);
|
||||
if (entry) SysFreeString(entry);
|
||||
SysFreeString(entry);
|
||||
return STG_E_FILENOTFOUND;
|
||||
}
|
||||
/* FIXME: store library somewhere where we can free it */
|
||||
|
@ -6552,7 +6750,7 @@ static HRESULT WINAPI ITypeInfo_fnAddressOfMember( ITypeInfo2 *iface,
|
|||
}
|
||||
|
||||
SysFreeString(dll);
|
||||
if (entry) SysFreeString(entry);
|
||||
SysFreeString(entry);
|
||||
|
||||
if (!*ppv)
|
||||
return TYPE_E_DLLFUNCTIONNOTFOUND;
|
||||
|
@ -6823,7 +7021,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetFuncCustData(
|
|||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
TLBCustData *pCData=NULL;
|
||||
TLBFuncDesc * pFDesc;
|
||||
int i;
|
||||
UINT i;
|
||||
for(i=0, pFDesc=This->funclist; i!=index && pFDesc; i++,
|
||||
pFDesc=pFDesc->next);
|
||||
|
||||
|
@ -6855,7 +7053,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetParamCustData(
|
|||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
TLBCustData *pCData=NULL;
|
||||
TLBFuncDesc * pFDesc;
|
||||
int i;
|
||||
UINT i;
|
||||
|
||||
for(i=0, pFDesc=This->funclist; i!=indexFunc && pFDesc; i++,pFDesc=pFDesc->next);
|
||||
|
||||
|
@ -6888,7 +7086,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetVarCustData(
|
|||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
TLBCustData *pCData=NULL;
|
||||
TLBVarDesc * pVDesc;
|
||||
int i;
|
||||
UINT i;
|
||||
|
||||
for(i=0, pVDesc=This->varlist; i!=index && pVDesc; i++, pVDesc=pVDesc->next);
|
||||
|
||||
|
@ -6924,7 +7122,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetImplTypeCustData(
|
|||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
TLBCustData *pCData=NULL;
|
||||
TLBImplType * pRDesc;
|
||||
int i;
|
||||
UINT i;
|
||||
|
||||
for(i=0, pRDesc=This->impltypelist; i!=index && pRDesc; i++, pRDesc=pRDesc->next);
|
||||
|
||||
|
@ -7051,7 +7249,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllFuncCustData(
|
|||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
TLBCustData *pCData;
|
||||
TLBFuncDesc * pFDesc;
|
||||
int i;
|
||||
UINT i;
|
||||
TRACE("(%p) index %d\n", This, index);
|
||||
for(i=0, pFDesc=This->funclist; i!=index && pFDesc; i++,
|
||||
pFDesc=pFDesc->next)
|
||||
|
@ -7087,7 +7285,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllParamCustData( ITypeInfo2 * iface,
|
|||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
TLBCustData *pCData=NULL;
|
||||
TLBFuncDesc * pFDesc;
|
||||
int i;
|
||||
UINT i;
|
||||
TRACE("(%p) index %d\n", This, indexFunc);
|
||||
for(i=0, pFDesc=This->funclist; i!=indexFunc && pFDesc; i++,
|
||||
pFDesc=pFDesc->next)
|
||||
|
@ -7124,7 +7322,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllVarCustData( ITypeInfo2 * iface,
|
|||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
TLBCustData *pCData;
|
||||
TLBVarDesc * pVDesc;
|
||||
int i;
|
||||
UINT i;
|
||||
TRACE("(%p) index %d\n", This, index);
|
||||
for(i=0, pVDesc=This->varlist; i!=index && pVDesc; i++,
|
||||
pVDesc=pVDesc->next)
|
||||
|
@ -7162,7 +7360,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllImplTypeCustData(
|
|||
ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
|
||||
TLBCustData *pCData;
|
||||
TLBImplType * pRDesc;
|
||||
int i;
|
||||
UINT i;
|
||||
TRACE("(%p) index %d\n", This, index);
|
||||
for(i=0, pRDesc=This->impltypelist; i!=index && pRDesc; i++,
|
||||
pRDesc=pRDesc->next)
|
||||
|
@ -7252,7 +7450,7 @@ HRESULT WINAPI CreateDispTypeInfo(
|
|||
{
|
||||
ITypeInfoImpl *pTIClass, *pTIIface;
|
||||
ITypeLibImpl *pTypeLibImpl;
|
||||
int param, func;
|
||||
unsigned int param, func;
|
||||
TLBFuncDesc **ppFuncDesc;
|
||||
TLBRefType *ref;
|
||||
|
||||
|
|
|
@ -1349,7 +1349,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddRefTypeInfo(
|
|||
* implementation of ITypeInfo. So we need to do the following...
|
||||
*/
|
||||
res = ITypeInfo_GetContainingTypeLib(pTInfo, &container, &index);
|
||||
if (!SUCCEEDED(res)) {
|
||||
if (FAILED(res)) {
|
||||
TRACE("failed to find containing typelib.\n");
|
||||
return res;
|
||||
}
|
||||
|
@ -1708,7 +1708,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetFuncAndParamNames(
|
|||
{
|
||||
ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
|
||||
|
||||
int i;
|
||||
UINT i;
|
||||
int offset;
|
||||
char *namedata;
|
||||
|
||||
|
|
|
@ -148,16 +148,16 @@ MakeMapObject(int ColorCount,
|
|||
/*** FIXME: Our ColorCount has to be a power of two. Is it necessary to
|
||||
* make the user know that or should we automatically round up instead? */
|
||||
if (ColorCount != (1 << BitSize(ColorCount))) {
|
||||
return ((ColorMapObject *) NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Object = ungif_alloc(sizeof(ColorMapObject));
|
||||
if (Object == (ColorMapObject *) NULL) {
|
||||
return ((ColorMapObject *) NULL);
|
||||
if (Object == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Object->Colors = ungif_calloc(ColorCount, sizeof(GifColorType));
|
||||
if (Object->Colors == (GifColorType *) NULL) {
|
||||
if (Object->Colors == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -413,9 +413,9 @@ DGifGetImageDesc(GifFileType * GifFile) {
|
|||
return GIF_ERROR;
|
||||
}
|
||||
}
|
||||
sp->RasterBits = (unsigned char *)NULL;
|
||||
sp->RasterBits = NULL;
|
||||
sp->ExtensionBlockCount = 0;
|
||||
sp->ExtensionBlocks = (ExtensionBlock *) NULL;
|
||||
sp->ExtensionBlocks = NULL;
|
||||
|
||||
GifFile->ImageCount++;
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include "ole2.h"
|
||||
#include "oleauto.h"
|
||||
#include "rpcproxy.h"
|
||||
#include "typelib.h"
|
||||
#include "ocidl.h"
|
||||
#include "wine/debug.h"
|
||||
|
@ -46,25 +45,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
|||
#define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
|
||||
#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
|
||||
|
||||
static CStdPSFactoryBuffer PSFactoryBuffer;
|
||||
|
||||
CSTDSTUBBUFFERRELEASE(&PSFactoryBuffer)
|
||||
|
||||
extern const ExtendedProxyFileInfo oleaut32_oaidl_ProxyFileInfo;
|
||||
extern const ExtendedProxyFileInfo oleaut32_ocidl_ProxyFileInfo;
|
||||
|
||||
static const ProxyFileInfo *OLEAUT32_ProxyFileList[] = {
|
||||
&oleaut32_oaidl_ProxyFileInfo,
|
||||
&oleaut32_ocidl_ProxyFileInfo,
|
||||
NULL
|
||||
};
|
||||
|
||||
HRESULT OLEAUTPS_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
||||
{
|
||||
return NdrDllGetClassObject(rclsid, riid, ppv, OLEAUT32_ProxyFileList,
|
||||
&CLSID_PSDispatch, &PSFactoryBuffer);
|
||||
}
|
||||
|
||||
static void dump_user_flags(const ULONG *pFlags)
|
||||
{
|
||||
if (HIWORD(*pFlags) == NDR_LOCAL_DATA_REPRESENTATION)
|
||||
|
@ -186,12 +166,9 @@ unsigned char * WINAPI BSTR_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer,
|
|||
header = (bstr_wire_t*)Buffer;
|
||||
if(header->len != header->len2)
|
||||
FIXME("len %08x != len2 %08x\n", header->len, header->len2);
|
||||
|
||||
if(*pstr)
|
||||
{
|
||||
SysFreeString(*pstr);
|
||||
*pstr = NULL;
|
||||
}
|
||||
|
||||
SysFreeString(*pstr);
|
||||
*pstr = NULL;
|
||||
|
||||
if(header->byte_len != 0xffffffff)
|
||||
*pstr = SysAllocStringByteLen((char*)(header + 1), header->byte_len);
|
||||
|
@ -203,11 +180,8 @@ unsigned char * WINAPI BSTR_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer,
|
|||
void WINAPI BSTR_UserFree(ULONG *pFlags, BSTR *pstr)
|
||||
{
|
||||
TRACE("(%x,%p) => %p\n", *pFlags, pstr, *pstr);
|
||||
if (*pstr)
|
||||
{
|
||||
SysFreeString(*pstr);
|
||||
*pstr = NULL;
|
||||
}
|
||||
SysFreeString(*pstr);
|
||||
*pstr = NULL;
|
||||
}
|
||||
|
||||
/* VARIANT */
|
||||
|
|
|
@ -1391,7 +1391,7 @@ VARIANT_FormatNumber_Bool:
|
|||
break;
|
||||
|
||||
case FMT_NUM_DECIMAL:
|
||||
if ((np.dwOutFlags & NUMPRS_NEG) && !(dwState & NUM_WROTE_SIGN))
|
||||
if ((np.dwOutFlags & NUMPRS_NEG) && !(dwState & NUM_WROTE_SIGN) && !header->starts[1])
|
||||
{
|
||||
/* last chance for a negative sign in the .# case */
|
||||
TRACE("write negative sign\n");
|
||||
|
@ -1476,7 +1476,7 @@ VARIANT_FormatNumber_Bool:
|
|||
{
|
||||
int count, count_max, position;
|
||||
|
||||
if ((np.dwOutFlags & NUMPRS_NEG) && !(dwState & NUM_WROTE_SIGN))
|
||||
if ((np.dwOutFlags & NUMPRS_NEG) && !(dwState & NUM_WROTE_SIGN) && !header->starts[1])
|
||||
{
|
||||
TRACE("write negative sign\n");
|
||||
localeValue = LOCALE_SNEGATIVESIGN;
|
||||
|
@ -1532,7 +1532,6 @@ VARIANT_FormatNumber_Bool:
|
|||
}
|
||||
}
|
||||
count = min(count_max, pad);
|
||||
count_max -= count;
|
||||
pad -= count;
|
||||
TRACE("write %d whole trailing 0's\n", count);
|
||||
while (count--)
|
||||
|
|
|
@ -608,8 +608,7 @@ HRESULT WINAPI VariantClear(VARIANTARG* pVarg)
|
|||
}
|
||||
else if (V_VT(pVarg) == VT_BSTR)
|
||||
{
|
||||
if (V_BSTR(pVarg))
|
||||
SysFreeString(V_BSTR(pVarg));
|
||||
SysFreeString(V_BSTR(pVarg));
|
||||
}
|
||||
else if (V_VT(pVarg) == VT_RECORD)
|
||||
{
|
||||
|
@ -2323,7 +2322,7 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE *rgbDig,
|
|||
whole = whole * dblMultipliers[10];
|
||||
multiplier10 -= 10;
|
||||
}
|
||||
if (multiplier10)
|
||||
if (multiplier10 && !bOverflow)
|
||||
{
|
||||
if (whole > dblMaximums[multiplier10])
|
||||
{
|
||||
|
@ -2334,9 +2333,10 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE *rgbDig,
|
|||
whole = whole * dblMultipliers[multiplier10];
|
||||
}
|
||||
|
||||
TRACE("Scaled double value is %16.16g\n", whole);
|
||||
if (!bOverflow)
|
||||
TRACE("Scaled double value is %16.16g\n", whole);
|
||||
|
||||
while (divisor10 > 10)
|
||||
while (divisor10 > 10 && !bOverflow)
|
||||
{
|
||||
if (whole < dblMinimums[10] && whole != 0)
|
||||
{
|
||||
|
@ -2347,7 +2347,7 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE *rgbDig,
|
|||
whole = whole / dblMultipliers[10];
|
||||
divisor10 -= 10;
|
||||
}
|
||||
if (divisor10)
|
||||
if (divisor10 && !bOverflow)
|
||||
{
|
||||
if (whole < dblMinimums[divisor10] && whole != 0)
|
||||
{
|
||||
|
@ -5673,14 +5673,14 @@ HRESULT WINAPI VarPow(LPVARIANT left, LPVARIANT right, LPVARIANT result)
|
|||
}
|
||||
|
||||
hr = VariantChangeType(&dl,left,0,resvt);
|
||||
if (!SUCCEEDED(hr)) {
|
||||
if (FAILED(hr)) {
|
||||
ERR("Could not change passed left argument to VT_R8, handle it differently.\n");
|
||||
hr = E_FAIL;
|
||||
goto end;
|
||||
}
|
||||
|
||||
hr = VariantChangeType(&dr,right,0,resvt);
|
||||
if (!SUCCEEDED(hr)) {
|
||||
if (FAILED(hr)) {
|
||||
ERR("Could not change passed right argument to VT_R8, handle it differently.\n");
|
||||
hr = E_FAIL;
|
||||
goto end;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(variant);
|
||||
|
||||
extern HMODULE OLEAUT32_hModule;
|
||||
extern HMODULE hProxyDll DECLSPEC_HIDDEN;
|
||||
|
||||
#define CY_MULTIPLIER 10000 /* 4 dp of precision */
|
||||
#define CY_MULTIPLIER_F 10000.0
|
||||
|
@ -153,7 +153,7 @@ static HRESULT VARIANT_FromDisp(IDispatch* pdispIn, LCID lcid, void* pOut,
|
|||
|
||||
/* Compiler cast where input cannot be negative */
|
||||
#define NEGTST(dest, src, func) RETTYP _##func(src in, dest* out) { \
|
||||
if (in < (src)0) return DISP_E_OVERFLOW; *out = in; return S_OK; }
|
||||
if (in < 0) return DISP_E_OVERFLOW; *out = in; return S_OK; }
|
||||
|
||||
/* Compiler cast where input cannot be > some number */
|
||||
#define POSTST(dest, src, func, tst) RETTYP _##func(src in, dest* out) { \
|
||||
|
@ -5949,11 +5949,11 @@ static BOOL VARIANT_GetLocalisedText(LANGID langId, DWORD dwId, WCHAR *lpszDest)
|
|||
{
|
||||
HRSRC hrsrc;
|
||||
|
||||
hrsrc = FindResourceExW( OLEAUT32_hModule, (LPWSTR)RT_STRING,
|
||||
hrsrc = FindResourceExW( hProxyDll, (LPWSTR)RT_STRING,
|
||||
MAKEINTRESOURCEW((dwId >> 4) + 1), langId );
|
||||
if (hrsrc)
|
||||
{
|
||||
HGLOBAL hmem = LoadResource( OLEAUT32_hModule, hrsrc );
|
||||
HGLOBAL hmem = LoadResource( hProxyDll, hrsrc );
|
||||
|
||||
if (hmem)
|
||||
{
|
||||
|
|
|
@ -193,7 +193,7 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static void WINAPI StdProxy_Destruct(LPRPCPROXYBUFFER iface)
|
||||
static void StdProxy_Destruct(LPRPCPROXYBUFFER iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
|
||||
|
||||
|
|
|
@ -36,12 +36,25 @@
|
|||
|
||||
#include "rpcproxy.h"
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "cpsf.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
static void format_clsid( WCHAR *buffer, const CLSID *clsid )
|
||||
{
|
||||
static const WCHAR clsid_formatW[] = {'{','%','0','8','X','-','%','0','4','X','-','%','0','4','X','-',
|
||||
'%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X',
|
||||
'%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','}',0};
|
||||
|
||||
sprintfW( buffer, clsid_formatW, clsid->Data1, clsid->Data2, clsid->Data3,
|
||||
clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
|
||||
clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] );
|
||||
|
||||
}
|
||||
|
||||
static BOOL FindProxyInfo(const ProxyFileInfo **pProxyFileList, REFIID riid, const ProxyFileInfo **pProxyInfo, int *pIndex)
|
||||
{
|
||||
while (*pProxyFileList) {
|
||||
|
@ -147,7 +160,7 @@ HRESULT WINAPI NdrDllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv,
|
|||
*ppv = NULL;
|
||||
if (!pPSFactoryBuffer->lpVtbl) {
|
||||
const ProxyFileInfo **pProxyFileList2;
|
||||
int max_delegating_vtbl_size = 0;
|
||||
DWORD max_delegating_vtbl_size = 0;
|
||||
pPSFactoryBuffer->lpVtbl = &CStdPSFactory_Vtbl;
|
||||
pPSFactoryBuffer->RefCount = 0;
|
||||
pPSFactoryBuffer->pProxyFileList = pProxyFileList;
|
||||
|
@ -158,7 +171,7 @@ HRESULT WINAPI NdrDllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv,
|
|||
* async interfaces */
|
||||
void * const *pSrcRpcStubVtbl = (void * const *)&CStdStubBuffer_Vtbl;
|
||||
void **pRpcStubVtbl = (void **)&(*pProxyFileList2)->pStubVtblList[i]->Vtbl;
|
||||
int j;
|
||||
unsigned int j;
|
||||
|
||||
if ((*pProxyFileList2)->pDelegatedIIDs && (*pProxyFileList2)->pDelegatedIIDs[i]) {
|
||||
pSrcRpcStubVtbl = (void * const *)&CStdStubBuffer_Delegating_Vtbl;
|
||||
|
@ -197,6 +210,7 @@ HRESULT WINAPI NdrDllCanUnloadNow(CStdPSFactoryBuffer *pPSFactoryBuffer)
|
|||
return !(pPSFactoryBuffer->RefCount);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* NdrDllRegisterProxy [RPCRT4.@]
|
||||
*/
|
||||
|
@ -204,13 +218,21 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
|
|||
const ProxyFileInfo **pProxyFileList,
|
||||
const CLSID *pclsid)
|
||||
{
|
||||
LPSTR clsid;
|
||||
char keyname[120], module[MAX_PATH];
|
||||
static const WCHAR bothW[] = {'B','o','t','h',0};
|
||||
static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0};
|
||||
static const WCHAR clsid32W[] = {'P','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2',0};
|
||||
static const WCHAR interfaceW[] = {'I','n','t','e','r','f','a','c','e','\\',0};
|
||||
static const WCHAR psfactoryW[] = {'P','S','F','a','c','t','o','r','y','B','u','f','f','e','r',0};
|
||||
static const WCHAR numformatW[] = {'%','u',0};
|
||||
static const WCHAR nummethodsW[] = {'N','u','m','M','e','t','h','o','d','s',0};
|
||||
static const WCHAR inprocserverW[] = {'I','n','P','r','o','c','S','e','r','v','e','r','3','2',0};
|
||||
static const WCHAR threadingmodelW[] = {'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0};
|
||||
WCHAR clsid[39], keyname[50], module[MAX_PATH];
|
||||
HKEY key, subkey;
|
||||
DWORD len;
|
||||
|
||||
TRACE("(%p,%p,%s)\n", hDll, pProxyFileList, debugstr_guid(pclsid));
|
||||
UuidToStringA((UUID*)pclsid, (unsigned char**)&clsid);
|
||||
format_clsid( clsid, pclsid );
|
||||
|
||||
/* register interfaces to point to clsid */
|
||||
while (*pProxyFileList) {
|
||||
|
@ -218,23 +240,19 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
|
|||
for (u=0; u<(*pProxyFileList)->TableSize; u++) {
|
||||
CInterfaceStubVtbl *proxy = (*pProxyFileList)->pStubVtblList[u];
|
||||
PCInterfaceName name = (*pProxyFileList)->pNamesArray[u];
|
||||
LPSTR iid;
|
||||
|
||||
TRACE("registering %s %s => %s\n", name, debugstr_guid(proxy->header.piid), clsid);
|
||||
TRACE("registering %s %s => %s\n",
|
||||
debugstr_a(name), debugstr_guid(proxy->header.piid), debugstr_w(clsid));
|
||||
|
||||
UuidToStringA((UUID*)proxy->header.piid, (unsigned char**)&iid);
|
||||
snprintf(keyname, sizeof(keyname), "Interface\\{%s}", iid);
|
||||
RpcStringFreeA((unsigned char**)&iid);
|
||||
if (RegCreateKeyExA(HKEY_CLASSES_ROOT, keyname, 0, NULL, 0,
|
||||
KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS) {
|
||||
strcpyW( keyname, interfaceW );
|
||||
format_clsid( keyname + strlenW(keyname), proxy->header.piid );
|
||||
if (RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key) == ERROR_SUCCESS) {
|
||||
WCHAR num[10];
|
||||
if (name)
|
||||
RegSetValueExA(key, NULL, 0, REG_SZ, (const BYTE *)name, strlen(name));
|
||||
if (RegCreateKeyExA(key, "ProxyStubClsid32", 0, NULL, 0,
|
||||
KEY_WRITE, NULL, &subkey, NULL) == ERROR_SUCCESS) {
|
||||
snprintf(module, sizeof(module), "{%s}", clsid);
|
||||
RegSetValueExA(subkey, NULL, 0, REG_SZ, (LPBYTE)module, strlen(module));
|
||||
RegCloseKey(subkey);
|
||||
}
|
||||
RegSetValueExA(key, NULL, 0, REG_SZ, (const BYTE *)name, strlen(name)+1);
|
||||
RegSetValueW( key, clsid32W, REG_SZ, clsid, 0 );
|
||||
sprintfW(num, numformatW, proxy->header.DispatchTableCount);
|
||||
RegSetValueW( key, nummethodsW, REG_SZ, num, 0 );
|
||||
RegCloseKey(key);
|
||||
}
|
||||
}
|
||||
|
@ -242,25 +260,22 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
|
|||
}
|
||||
|
||||
/* register clsid to point to module */
|
||||
snprintf(keyname, sizeof(keyname), "CLSID\\{%s}", clsid);
|
||||
len = GetModuleFileNameA(hDll, module, sizeof(module));
|
||||
strcpyW( keyname, clsidW );
|
||||
strcatW( keyname, clsid );
|
||||
len = GetModuleFileNameW(hDll, module, sizeof(module)/sizeof(WCHAR));
|
||||
if (len && len < sizeof(module)) {
|
||||
TRACE("registering CLSID %s => %s\n", clsid, module);
|
||||
if (RegCreateKeyExA(HKEY_CLASSES_ROOT, keyname, 0, NULL, 0,
|
||||
KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS) {
|
||||
RegSetValueExA(subkey, NULL, 0, REG_SZ, (const BYTE *)"PSFactoryBuffer", strlen("PSFactoryBuffer"));
|
||||
if (RegCreateKeyExA(key, "InProcServer32", 0, NULL, 0,
|
||||
KEY_WRITE, NULL, &subkey, NULL) == ERROR_SUCCESS) {
|
||||
RegSetValueExA(subkey, NULL, 0, REG_SZ, (LPBYTE)module, strlen(module));
|
||||
RegSetValueExA(subkey, "ThreadingModel", 0, REG_SZ, (const BYTE *)"Both", strlen("Both"));
|
||||
RegCloseKey(subkey);
|
||||
TRACE("registering CLSID %s => %s\n", debugstr_w(clsid), debugstr_w(module));
|
||||
if (RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key) == ERROR_SUCCESS) {
|
||||
RegSetValueExW(subkey, NULL, 0, REG_SZ, (const BYTE *)psfactoryW, sizeof(psfactoryW));
|
||||
if (RegCreateKeyW(key, inprocserverW, &subkey) == ERROR_SUCCESS) {
|
||||
RegSetValueExW(subkey, NULL, 0, REG_SZ, (LPBYTE)module, (strlenW(module)+1)*sizeof(WCHAR));
|
||||
RegSetValueExW(subkey, threadingmodelW, 0, REG_SZ, (const BYTE *)bothW, sizeof(bothW));
|
||||
RegCloseKey(subkey);
|
||||
}
|
||||
RegCloseKey(key);
|
||||
}
|
||||
RegCloseKey(key);
|
||||
}
|
||||
}
|
||||
|
||||
/* done */
|
||||
RpcStringFreeA((unsigned char**)&clsid);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -271,12 +286,11 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
|
|||
const ProxyFileInfo **pProxyFileList,
|
||||
const CLSID *pclsid)
|
||||
{
|
||||
LPSTR clsid;
|
||||
char keyname[120], module[MAX_PATH];
|
||||
DWORD len;
|
||||
static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0};
|
||||
static const WCHAR interfaceW[] = {'I','n','t','e','r','f','a','c','e','\\',0};
|
||||
WCHAR keyname[50];
|
||||
|
||||
TRACE("(%p,%p,%s)\n", hDll, pProxyFileList, debugstr_guid(pclsid));
|
||||
UuidToStringA((UUID*)pclsid, (unsigned char**)&clsid);
|
||||
|
||||
/* unregister interfaces */
|
||||
while (*pProxyFileList) {
|
||||
|
@ -284,27 +298,20 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
|
|||
for (u=0; u<(*pProxyFileList)->TableSize; u++) {
|
||||
CInterfaceStubVtbl *proxy = (*pProxyFileList)->pStubVtblList[u];
|
||||
PCInterfaceName name = (*pProxyFileList)->pNamesArray[u];
|
||||
LPSTR iid;
|
||||
|
||||
TRACE("unregistering %s %s <= %s\n", name, debugstr_guid(proxy->header.piid), clsid);
|
||||
TRACE("unregistering %s %s\n", debugstr_a(name), debugstr_guid(proxy->header.piid));
|
||||
|
||||
UuidToStringA((UUID*)proxy->header.piid, (unsigned char**)&iid);
|
||||
snprintf(keyname, sizeof(keyname), "Interface\\{%s}", iid);
|
||||
RpcStringFreeA((unsigned char**)&iid);
|
||||
RegDeleteKeyA(HKEY_CLASSES_ROOT, keyname);
|
||||
strcpyW( keyname, interfaceW );
|
||||
format_clsid( keyname + strlenW(keyname), proxy->header.piid );
|
||||
RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
|
||||
}
|
||||
pProxyFileList++;
|
||||
}
|
||||
|
||||
/* unregister clsid */
|
||||
snprintf(keyname, sizeof(keyname), "CLSID\\{%s}", clsid);
|
||||
len = GetModuleFileNameA(hDll, module, sizeof(module));
|
||||
if (len && len < sizeof(module)) {
|
||||
TRACE("unregistering CLSID %s <= %s\n", clsid, module);
|
||||
RegDeleteKeyA(HKEY_CLASSES_ROOT, keyname);
|
||||
}
|
||||
strcpyW( keyname, clsidW );
|
||||
format_clsid( keyname + strlenW(keyname), pclsid );
|
||||
RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
|
||||
|
||||
/* done */
|
||||
RpcStringFreeA((unsigned char**)&clsid);
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ int WINAPI NdrFullPointerQueryPointer(PFULL_PTR_XLAT_TABLES pXlatTables,
|
|||
ULONG *pRefId )
|
||||
{
|
||||
ULONG Hash = 0;
|
||||
int i;
|
||||
unsigned int i;
|
||||
PFULL_PTR_TO_REFID_ELEMENT XlatTableEntry;
|
||||
|
||||
TRACE("(%p, %p, %d, %p)\n", pXlatTables, pPointer, QueryType, pRefId);
|
||||
|
@ -186,7 +186,7 @@ void WINAPI NdrFullPointerInsertRefId(PFULL_PTR_XLAT_TABLES pXlatTables,
|
|||
ULONG RefId, void *pPointer)
|
||||
{
|
||||
ULONG Hash = 0;
|
||||
int i;
|
||||
unsigned int i;
|
||||
PFULL_PTR_TO_REFID_ELEMENT XlatTableEntry;
|
||||
|
||||
TRACE("(%p, 0x%x, %p)\n", pXlatTables, RefId, pPointer);
|
||||
|
@ -211,7 +211,7 @@ void WINAPI NdrFullPointerInsertRefId(PFULL_PTR_XLAT_TABLES pXlatTables,
|
|||
int WINAPI NdrFullPointerFree(PFULL_PTR_XLAT_TABLES pXlatTables, void *Pointer)
|
||||
{
|
||||
ULONG Hash = 0;
|
||||
int i;
|
||||
unsigned int i;
|
||||
PFULL_PTR_TO_REFID_ELEMENT XlatTableEntry;
|
||||
ULONG RefId = 0;
|
||||
|
||||
|
|
|
@ -391,7 +391,7 @@ void * WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len)
|
|||
return p;
|
||||
}
|
||||
|
||||
static void WINAPI NdrFree(MIDL_STUB_MESSAGE *pStubMsg, unsigned char *Pointer)
|
||||
static void NdrFree(MIDL_STUB_MESSAGE *pStubMsg, unsigned char *Pointer)
|
||||
{
|
||||
TRACE("(%p, %p)\n", pStubMsg, Pointer);
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ void WINAPI NdrRpcSmSetClientToOsf(PMIDL_STUB_MESSAGE pMessage)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void WINAPI dump_RPC_FC_PROC_PF(PARAM_ATTRIBUTES param_attributes)
|
||||
static void dump_RPC_FC_PROC_PF(PARAM_ATTRIBUTES param_attributes)
|
||||
{
|
||||
if (param_attributes.MustSize) TRACE(" MustSize");
|
||||
if (param_attributes.MustFree) TRACE(" MustFree");
|
||||
|
@ -123,7 +123,7 @@ static void WINAPI dump_RPC_FC_PROC_PF(PARAM_ATTRIBUTES param_attributes)
|
|||
if (param_attributes.ServerAllocSize) TRACE(" ServerAllocSize = %d", param_attributes.ServerAllocSize * 8);
|
||||
}
|
||||
|
||||
static void WINAPI dump_INTERPRETER_OPT_FLAGS(INTERPRETER_OPT_FLAGS Oi2Flags)
|
||||
static void dump_INTERPRETER_OPT_FLAGS(INTERPRETER_OPT_FLAGS Oi2Flags)
|
||||
{
|
||||
if (Oi2Flags.ServerMustSize) TRACE(" ServerMustSize");
|
||||
if (Oi2Flags.ClientMustSize) TRACE(" ClientMustSize");
|
||||
|
|
|
@ -1061,6 +1061,8 @@ RPC_STATUS WINAPI RpcMgmtWaitServerListen( void )
|
|||
|
||||
LeaveCriticalSection(&listen_cs);
|
||||
|
||||
FIXME("not waiting for server calls to finish\n");
|
||||
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -501,7 +501,6 @@ static size_t rpcrt4_ncacn_np_get_top_of_tower(unsigned char *tower_data,
|
|||
memcpy(tower_data, networkaddr, networkaddr_size);
|
||||
else
|
||||
tower_data[0] = 0;
|
||||
tower_data += networkaddr_size;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
@ -714,7 +713,6 @@ static size_t rpcrt4_ncalrpc_get_top_of_tower(unsigned char *tower_data,
|
|||
pipe_floor->count_rhs = endpoint_size;
|
||||
|
||||
memcpy(tower_data, endpoint, endpoint_size);
|
||||
tower_data += endpoint_size;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
@ -756,6 +754,8 @@ static RPC_STATUS rpcrt4_ncalrpc_parse_top_of_tower(const unsigned char *tower_d
|
|||
|
||||
/**** ncacn_ip_tcp support ****/
|
||||
|
||||
#ifdef HAVE_SOCKETPAIR
|
||||
|
||||
typedef struct _RpcConnection_tcp
|
||||
{
|
||||
RpcConnection common;
|
||||
|
@ -1348,7 +1348,8 @@ static void rpcrt4_protseq_sock_free_wait_array(RpcServerProtseq *protseq, void
|
|||
static int rpcrt4_protseq_sock_wait_for_new_connection(RpcServerProtseq *protseq, unsigned int count, void *wait_array)
|
||||
{
|
||||
struct pollfd *poll_info = wait_array;
|
||||
int ret, i;
|
||||
int ret;
|
||||
unsigned int i;
|
||||
RpcConnection *cconn;
|
||||
RpcConnection_tcp *conn;
|
||||
|
||||
|
@ -1395,6 +1396,8 @@ static int rpcrt4_protseq_sock_wait_for_new_connection(RpcServerProtseq *protseq
|
|||
return 1;
|
||||
}
|
||||
|
||||
#endif /* HAVE_SOCKETPAIR */
|
||||
|
||||
static const struct connection_ops conn_protseq_list[] = {
|
||||
{ "ncacn_np",
|
||||
{ EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB },
|
||||
|
@ -1422,6 +1425,7 @@ static const struct connection_ops conn_protseq_list[] = {
|
|||
rpcrt4_ncalrpc_get_top_of_tower,
|
||||
rpcrt4_ncalrpc_parse_top_of_tower,
|
||||
},
|
||||
#ifdef HAVE_SOCKETPAIR
|
||||
{ "ncacn_ip_tcp",
|
||||
{ EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP },
|
||||
rpcrt4_conn_tcp_alloc,
|
||||
|
@ -1435,6 +1439,7 @@ static const struct connection_ops conn_protseq_list[] = {
|
|||
rpcrt4_ncacn_ip_tcp_get_top_of_tower,
|
||||
rpcrt4_ncacn_ip_tcp_parse_top_of_tower,
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -1458,6 +1463,7 @@ static const struct protseq_ops protseq_list[] =
|
|||
rpcrt4_protseq_np_wait_for_new_connection,
|
||||
rpcrt4_protseq_ncalrpc_open_endpoint,
|
||||
},
|
||||
#ifdef HAVE_SOCKETPAIR
|
||||
{
|
||||
"ncacn_ip_tcp",
|
||||
rpcrt4_protseq_sock_alloc,
|
||||
|
@ -1467,13 +1473,14 @@ static const struct protseq_ops protseq_list[] =
|
|||
rpcrt4_protseq_sock_wait_for_new_connection,
|
||||
rpcrt4_protseq_ncacn_ip_tcp_open_endpoint,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
#define ARRAYSIZE(a) (sizeof((a)) / sizeof((a)[0]))
|
||||
|
||||
const struct protseq_ops *rpcrt4_get_protseq_ops(const char *protseq)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
for(i=0; i<ARRAYSIZE(protseq_list); i++)
|
||||
if (!strcmp(protseq_list[i].name, protseq))
|
||||
return &protseq_list[i];
|
||||
|
@ -1482,7 +1489,7 @@ const struct protseq_ops *rpcrt4_get_protseq_ops(const char *protseq)
|
|||
|
||||
static const struct connection_ops *rpcrt4_get_conn_protseq_ops(const char *protseq)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
for(i=0; i<ARRAYSIZE(conn_protseq_list); i++)
|
||||
if (!strcmp(conn_protseq_list[i].name, protseq))
|
||||
return &conn_protseq_list[i];
|
||||
|
@ -1636,7 +1643,7 @@ RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data,
|
|||
const twr_empty_floor_t *floor4;
|
||||
const struct connection_ops *protseq_ops = NULL;
|
||||
RPC_STATUS status;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (tower_size < sizeof(*protocol_floor))
|
||||
return EPT_S_NOT_REGISTERED;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<importlibrary definition="rpcrt4.spec" />
|
||||
<include base="rpcrt4">.</include>
|
||||
<include base="ReactOS">include/reactos/wine</include>
|
||||
<define name="_WIN32_WINNT">0x600</define>
|
||||
<define name="_RPCRT4_" />
|
||||
<define name="COM_NO_WINDOWS_H" />
|
||||
<define name="MSWMSG" />
|
||||
|
|
|
@ -78,7 +78,7 @@ static CRITICAL_SECTION_DEBUG threaddata_cs_debug =
|
|||
};
|
||||
static CRITICAL_SECTION threaddata_cs = { &threaddata_cs_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
struct list threaddata_list = LIST_INIT(threaddata_list);
|
||||
static struct list threaddata_list = LIST_INIT(threaddata_list);
|
||||
|
||||
struct context_handle_list
|
||||
{
|
||||
|
|
|
@ -111,7 +111,7 @@ typedef unsigned char boolean;
|
|||
#define midl_user_free MIDL_user_free
|
||||
#define midl_user_allocate MIDL_user_allocate
|
||||
|
||||
#define NdrFcShort(s) (unsigned char)(s & 0xff), (unsigned char)((s & 0xff00) >> 8)
|
||||
#define NdrFcShort(s) (unsigned char)(s & 0xff), (unsigned char)(s >> 8)
|
||||
#define NdrFcLong(s) (unsigned char)(s & 0xff), (unsigned char)((s & 0x0000ff00) >> 8), \
|
||||
(unsigned char)((s & 0x00ff0000) >> 16), (unsigned char)(s >> 24)
|
||||
|
||||
|
@ -220,7 +220,7 @@ typedef struct _MIDL_STUB_MESSAGE
|
|||
int fNeedMCCP:1;
|
||||
int fUnused:3;
|
||||
int fUnused2:16;
|
||||
unsigned long dwDestContext;
|
||||
DWORD dwDestContext;
|
||||
void *pvDestContext;
|
||||
NDR_SCONTEXT *SavedContextHandles;
|
||||
LONG ParamNumber;
|
||||
|
@ -230,7 +230,7 @@ typedef struct _MIDL_STUB_MESSAGE
|
|||
ULONG *SizePtrOffsetArray;
|
||||
ULONG *SizePtrLengthArray;
|
||||
void *pArgQueue;
|
||||
unsigned long dwStubPhase;
|
||||
DWORD dwStubPhase;
|
||||
void *LowStackMark;
|
||||
PNDR_ASYNC_MESSAGE pAsyncMsg;
|
||||
PNDR_CORRELATION_INFO pCorrInfo;
|
||||
|
@ -291,8 +291,8 @@ typedef struct _USER_MARSHAL_ROUTINE_QUADRUPLE
|
|||
|
||||
/* 'USRC' */
|
||||
#define USER_MARSHAL_CB_SIGNATURE \
|
||||
( ( (unsigned long)'U' << 24 ) | ( (unsigned long)'S' << 16 ) | \
|
||||
( (unsigned long)'R' << 8 ) | ( (unsigned long)'C' ) )
|
||||
( ( (DWORD)'U' << 24 ) | ( (DWORD)'S' << 16 ) | \
|
||||
( (DWORD)'R' << 8 ) | ( (DWORD)'C' ) )
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -462,8 +462,7 @@ typedef struct _FULL_PTR_XLAT_TABLES {
|
|||
|
||||
struct IRpcStubBuffer;
|
||||
|
||||
typedef unsigned long error_status_t;
|
||||
|
||||
typedef ULONG error_status_t;
|
||||
typedef void * NDR_CCONTEXT;
|
||||
|
||||
typedef struct _SCONTEXT_QUEUE {
|
||||
|
@ -650,13 +649,13 @@ RPCRTAPI void RPC_ENTRY
|
|||
NdrAsyncServerCall( PRPC_MESSAGE pRpcMsg );
|
||||
|
||||
RPCRTAPI LONG RPC_ENTRY
|
||||
NdrStubCall2( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, unsigned long * pdwStubPhase );
|
||||
NdrStubCall2( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
|
||||
RPCRTAPI LONG RPC_ENTRY
|
||||
NdrStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, unsigned long * pdwStubPhase );
|
||||
NdrStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
|
||||
RPCRTAPI LONG RPC_ENTRY
|
||||
NdrAsyncStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, unsigned long * pdwStubPhase );
|
||||
NdrAsyncStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
|
||||
RPCRTAPI LONG RPC_ENTRY
|
||||
NdrDcomAsyncStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, unsigned long * pdwStubPhase );
|
||||
NdrDcomAsyncStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
|
||||
|
||||
RPCRTAPI void* RPC_ENTRY
|
||||
NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg, SIZE_T Len ) __WINE_ALLOC_SIZE(2);
|
||||
|
|
|
@ -125,7 +125,7 @@ typedef struct tagCStdPSFactoryBuffer
|
|||
|
||||
#define STUB_FORWARDING_FUNCTION NdrStubForwardingFunction
|
||||
|
||||
ULONG STDMETHODCALLTYPE CStdStubBuffer2_Release(IRpcStubBuffer *This);
|
||||
ULONG STDMETHODCALLTYPE CStdStubBuffer2_Release(IRpcStubBuffer *This) DECLSPEC_HIDDEN;
|
||||
ULONG STDMETHODCALLTYPE NdrCStdStubBuffer2_Release(IRpcStubBuffer *This, IPSFactoryBuffer *pPSF);
|
||||
|
||||
#define CStdStubBuffer_DELEGATING_METHODS 0, 0, CStdStubBuffer2_Release, 0, 0, 0, 0, 0, 0, 0
|
||||
|
@ -136,7 +136,7 @@ HRESULT WINAPI
|
|||
ULONG WINAPI
|
||||
CStdStubBuffer_AddRef( IRpcStubBuffer *This );
|
||||
ULONG WINAPI
|
||||
CStdStubBuffer_Release( IRpcStubBuffer *This );
|
||||
CStdStubBuffer_Release( IRpcStubBuffer *This ) DECLSPEC_HIDDEN;
|
||||
ULONG WINAPI
|
||||
NdrCStdStubBuffer_Release( IRpcStubBuffer *This, IPSFactoryBuffer *pPSF );
|
||||
HRESULT WINAPI
|
||||
|
@ -233,10 +233,10 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
|
|||
|
||||
/* macros used in dlldata.c files */
|
||||
#define EXTERN_PROXY_FILE(proxy) \
|
||||
EXTERN_C const ProxyFileInfo proxy##_ProxyFileInfo;
|
||||
EXTERN_C const ProxyFileInfo proxy##_ProxyFileInfo DECLSPEC_HIDDEN;
|
||||
|
||||
#define PROXYFILE_LIST_START \
|
||||
const ProxyFileInfo *aProxyFileList[] = \
|
||||
const ProxyFileInfo * aProxyFileList[] DECLSPEC_HIDDEN = \
|
||||
{
|
||||
|
||||
#define REFERENCE_PROXY_FILE(proxy) \
|
||||
|
@ -251,11 +251,11 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
|
|||
/* define PROXY_CLSID_IS to specify the CLSID data of the PSFactoryBuffer */
|
||||
/* define neither to use the GUID of the first interface */
|
||||
#ifdef PROXY_CLSID
|
||||
# define CLSID_PSFACTORYBUFFER extern CLSID PROXY_CLSID;
|
||||
# define CLSID_PSFACTORYBUFFER extern CLSID PROXY_CLSID DECLSPEC_HIDDEN;
|
||||
#else
|
||||
# ifdef PROXY_CLSID_IS
|
||||
# define CLSID_PSFACTORYBUFFER const CLSID CLSID_PSFactoryBuffer = \
|
||||
PROXY_CLSID_IS;
|
||||
# define CLSID_PSFACTORYBUFFER const CLSID CLSID_PSFactoryBuffer DECLSPEC_HIDDEN; \
|
||||
const CLSID CLSID_PSFactoryBuffer = PROXY_CLSID_IS;
|
||||
# define PROXY_CLSID CLSID_PSFactoryBuffer
|
||||
# else
|
||||
# define CLSID_PSFACTORYBUFFER
|
||||
|
@ -286,6 +286,8 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
|
|||
#endif
|
||||
|
||||
#define DLLDATA_GETPROXYDLLINFO(pfl, rclsid) \
|
||||
void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo ***ppProxyFileInfo, \
|
||||
const CLSID **ppClsid) DECLSPEC_HIDDEN; \
|
||||
void RPC_ENTRY GetProxyDllInfo(const ProxyFileInfo ***ppProxyFileInfo, \
|
||||
const CLSID **ppClsid) \
|
||||
{ \
|
||||
|
@ -294,6 +296,7 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
|
|||
}
|
||||
|
||||
#define DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, factory) \
|
||||
HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, void **ppv) DECLSPEC_HIDDEN; \
|
||||
HRESULT WINAPI DLLGETCLASSOBJECT_ENTRY(REFCLSID rclsid, REFIID riid, \
|
||||
void **ppv) \
|
||||
{ \
|
||||
|
@ -302,14 +305,16 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
|
|||
}
|
||||
|
||||
#define DLLCANUNLOADNOW(factory) \
|
||||
HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void) DECLSPEC_HIDDEN; \
|
||||
HRESULT WINAPI DLLCANUNLOADNOW_ENTRY(void) \
|
||||
{ \
|
||||
return NdrDllCanUnloadNow((factory)); \
|
||||
}
|
||||
|
||||
#define REGISTER_PROXY_DLL_ROUTINES(pfl, factory_clsid) \
|
||||
HINSTANCE hProxyDll = NULL; \
|
||||
HINSTANCE hProxyDll DECLSPEC_HIDDEN = NULL; \
|
||||
\
|
||||
BOOL WINAPI DLLMAIN_ENTRY(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DECLSPEC_HIDDEN; \
|
||||
BOOL WINAPI DLLMAIN_ENTRY(HINSTANCE hinstDLL, DWORD fdwReason, \
|
||||
LPVOID lpvReserved) \
|
||||
{ \
|
||||
|
@ -321,11 +326,13 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
|
|||
return TRUE; \
|
||||
} \
|
||||
\
|
||||
HRESULT WINAPI DLLREGISTERSERVER_ENTRY(void) DECLSPEC_HIDDEN; \
|
||||
HRESULT WINAPI DLLREGISTERSERVER_ENTRY(void) \
|
||||
{ \
|
||||
return NdrDllRegisterProxy(hProxyDll, (pfl), (factory_clsid)); \
|
||||
} \
|
||||
\
|
||||
HRESULT WINAPI DLLUNREGISTERSERVER_ENTRY(void) DECLSPEC_HIDDEN; \
|
||||
HRESULT WINAPI DLLUNREGISTERSERVER_ENTRY(void) \
|
||||
{ \
|
||||
return NdrDllUnregisterProxy(hProxyDll, (pfl), (factory_clsid)); \
|
||||
|
@ -340,7 +347,7 @@ ULONG WINAPI CStdStubBuffer2_Release(IRpcStubBuffer *This) \
|
|||
|
||||
#define DLLDATA_ROUTINES(pfl, factory_clsid) \
|
||||
CLSID_PSFACTORYBUFFER \
|
||||
CStdPSFactoryBuffer gPFactory = { NULL, 0, NULL, 0 }; \
|
||||
CStdPSFactoryBuffer DECLSPEC_HIDDEN gPFactory = { NULL, 0, NULL, 0 }; \
|
||||
DLLDATA_GETPROXYDLLINFO(pfl, factory_clsid) \
|
||||
DLLGETCLASSOBJECTROUTINE(pfl, factory_clsid, &gPFactory) \
|
||||
DLLCANUNLOADNOW(&gPFactory) \
|
||||
|
|
|
@ -191,12 +191,9 @@ library stdole
|
|||
typedef [uuid(BF030645-9069-101B-AE2D-08002B2EC713), public]
|
||||
VARIANT_BOOL OLE_ENABLEDEFAULTBOOL;
|
||||
|
||||
/* FIXME: widl can't cope with enum attributes yet */
|
||||
/*
|
||||
[
|
||||
uuid(6650430A-BE0F-101A-8BBB-00AA00300CAB)
|
||||
]
|
||||
*/
|
||||
enum OLE_TRISTATE {
|
||||
Unchecked = 0,
|
||||
Checked = 1,
|
||||
|
@ -380,12 +377,9 @@ library stdole
|
|||
interface IPicture;
|
||||
};
|
||||
|
||||
/* FIXME: widl can't cope with enum attributes yet */
|
||||
/*
|
||||
[
|
||||
uuid(E6C8FA08-BD9F-11D0-985E-00C04FC29993)
|
||||
]
|
||||
*/
|
||||
enum LoadPictureConstants {
|
||||
Default = 0,
|
||||
Monochrome = 1,
|
||||
|
|
|
@ -22,75 +22,76 @@ cpp_quote("#define IROT_PROTSEQ {'n','c','a','l','r','p','c',0}")
|
|||
cpp_quote("#define IROT_ENDPOINT {'i','r','o','t',0}")
|
||||
|
||||
typedef struct tagMonikerComparisonData {
|
||||
ULONG ulCntData;
|
||||
[size_is(ulCntData)] BYTE abData[];
|
||||
ULONG ulCntData;
|
||||
[size_is(ulCntData)] BYTE abData[];
|
||||
} MonikerComparisonData;
|
||||
|
||||
[
|
||||
uuid(7a98c254-6808-11cf-b73b-00aa00b677a8),
|
||||
version(0.2)
|
||||
version(0.2),
|
||||
strict_context_handle
|
||||
]
|
||||
interface Irot
|
||||
{
|
||||
typedef struct tagInterfaceData
|
||||
{
|
||||
ULONG ulCntData;
|
||||
[size_is(ulCntData)] BYTE abData[];
|
||||
} InterfaceData;
|
||||
typedef struct tagInterfaceData
|
||||
{
|
||||
ULONG ulCntData;
|
||||
[size_is(ulCntData)] BYTE abData[];
|
||||
} InterfaceData;
|
||||
|
||||
typedef [unique] InterfaceData *PInterfaceData;
|
||||
typedef [unique] InterfaceData *PInterfaceData;
|
||||
|
||||
typedef struct tagInterfaceList
|
||||
{
|
||||
ULONG size;
|
||||
[size_is(size)] PInterfaceData interfaces[];
|
||||
} InterfaceList;
|
||||
typedef struct tagInterfaceList
|
||||
{
|
||||
ULONG size;
|
||||
[size_is(size)] PInterfaceData interfaces[];
|
||||
} InterfaceList;
|
||||
|
||||
typedef [unique] InterfaceList *PInterfaceList;
|
||||
typedef [unique] InterfaceList *PInterfaceList;
|
||||
|
||||
typedef DWORD IrotCookie;
|
||||
typedef DWORD IrotCookie;
|
||||
|
||||
typedef handle_t IrotHandle;
|
||||
typedef [context_handle] void *IrotContextHandle;
|
||||
typedef handle_t IrotHandle;
|
||||
typedef [context_handle] void *IrotContextHandle;
|
||||
|
||||
HRESULT IrotRegister(
|
||||
[in] IrotHandle h,
|
||||
[in] const MonikerComparisonData *moniker_data,
|
||||
[in] const InterfaceData *object,
|
||||
[in] const InterfaceData *moniker,
|
||||
[in] const FILETIME *time,
|
||||
[in] DWORD grfFlags,
|
||||
[out] IrotCookie *cookie,
|
||||
[out] IrotContextHandle *ctxt_handle);
|
||||
HRESULT IrotRegister(
|
||||
[in] IrotHandle h,
|
||||
[in] const MonikerComparisonData *moniker_data,
|
||||
[in] const InterfaceData *object,
|
||||
[in] const InterfaceData *moniker,
|
||||
[in] const FILETIME *time,
|
||||
[in] DWORD grfFlags,
|
||||
[out] IrotCookie *cookie,
|
||||
[out] IrotContextHandle *ctxt_handle);
|
||||
|
||||
HRESULT IrotRevoke(
|
||||
[in] IrotHandle h,
|
||||
[in] IrotCookie cookie,
|
||||
[in, out] IrotContextHandle *ctxt_handle,
|
||||
[out] PInterfaceData *object,
|
||||
[out] PInterfaceData *moniker);
|
||||
HRESULT IrotRevoke(
|
||||
[in] IrotHandle h,
|
||||
[in] IrotCookie cookie,
|
||||
[in, out] IrotContextHandle *ctxt_handle,
|
||||
[out] PInterfaceData *object,
|
||||
[out] PInterfaceData *moniker);
|
||||
|
||||
HRESULT IrotIsRunning(
|
||||
[in] IrotHandle h,
|
||||
[in] const MonikerComparisonData *moniker_data);
|
||||
HRESULT IrotIsRunning(
|
||||
[in] IrotHandle h,
|
||||
[in] const MonikerComparisonData *moniker_data);
|
||||
|
||||
HRESULT IrotGetObject(
|
||||
[in] IrotHandle h,
|
||||
[in] const MonikerComparisonData *moniker_data,
|
||||
[out] PInterfaceData *obj,
|
||||
[out] IrotCookie *cookie);
|
||||
HRESULT IrotGetObject(
|
||||
[in] IrotHandle h,
|
||||
[in] const MonikerComparisonData *moniker_data,
|
||||
[out] PInterfaceData *obj,
|
||||
[out] IrotCookie *cookie);
|
||||
|
||||
HRESULT IrotNoteChangeTime(
|
||||
[in] IrotHandle h,
|
||||
[in] IrotCookie cookie,
|
||||
[in] const FILETIME *time);
|
||||
HRESULT IrotNoteChangeTime(
|
||||
[in] IrotHandle h,
|
||||
[in] IrotCookie cookie,
|
||||
[in] const FILETIME *time);
|
||||
|
||||
HRESULT IrotGetTimeOfLastChange(
|
||||
[in] IrotHandle h,
|
||||
[in] const MonikerComparisonData *moniker_data,
|
||||
[out] FILETIME *time);
|
||||
HRESULT IrotGetTimeOfLastChange(
|
||||
[in] IrotHandle h,
|
||||
[in] const MonikerComparisonData *moniker_data,
|
||||
[out] FILETIME *time);
|
||||
|
||||
HRESULT IrotEnumRunning(
|
||||
[in] IrotHandle h,
|
||||
[out] PInterfaceList *list);
|
||||
HRESULT IrotEnumRunning(
|
||||
[in] IrotHandle h,
|
||||
[out] PInterfaceList *list);
|
||||
}
|
||||
|
|
|
@ -1011,6 +1011,31 @@ MingwModuleHandler::GenerateObjectMacros (
|
|||
|
||||
delete stubs_file;
|
||||
}
|
||||
|
||||
if ( module.type == RpcProxy )
|
||||
{
|
||||
const FileLocation *dlldata_file = GetDlldataFilename();
|
||||
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s += %s\n",
|
||||
objectsMacro.c_str(),
|
||||
ReplaceExtension ( backend->GetFullName ( *dlldata_file ), ".o" ).c_str() );
|
||||
|
||||
delete dlldata_file;
|
||||
}
|
||||
}
|
||||
|
||||
const FileLocation*
|
||||
MingwModuleHandler::GetDlldataFilename() const
|
||||
{
|
||||
std::string dlldata_path = "";
|
||||
size_t dlldata_path_len = module.xmlbuildFile.find_last_of(cSep);
|
||||
|
||||
if ( dlldata_path_len != std::string::npos && dlldata_path_len != 0 )
|
||||
dlldata_path = module.xmlbuildFile.substr(0, dlldata_path_len);
|
||||
|
||||
return new FileLocation( IntermediateDirectory, dlldata_path, module.name + ".dlldata.c" );
|
||||
}
|
||||
|
||||
/* caller needs to delete the returned object */
|
||||
|
@ -1139,6 +1164,13 @@ Rule widlProxyRule ( "$(source): ${$(module_name)_precondition}\n"
|
|||
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c",
|
||||
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.o",
|
||||
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
|
||||
Rule widlDlldataRule ( "$(source): $(dependencies) ${$(module_name)_precondition} $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
|
||||
"\t$(ECHO_WIDL)\n"
|
||||
"\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) --dlldata-only --dlldata=$(source) $(bare_dependencies)\n"
|
||||
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).o: $(source) $(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
|
||||
"\t$(ECHO_CC)\n"
|
||||
"\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
|
||||
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).o", NULL );
|
||||
Rule widlTlbRule ( "$(source): ${$(module_name)_precondition}\n"
|
||||
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(module_name).tlb: $(source)$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
|
||||
"\t$(ECHO_WIDL)\n"
|
||||
|
@ -1642,6 +1674,16 @@ MingwModuleHandler::GenerateObjectFileTargets ( const IfableData& data )
|
|||
|
||||
defRule->Execute ( fMakefile, backend, module, module.importLibrary->source, clean_files );
|
||||
}
|
||||
|
||||
if ( module.type == RpcProxy )
|
||||
{
|
||||
widlDlldataRule.Execute ( fMakefile,
|
||||
backend,
|
||||
module,
|
||||
GetDlldataFilename(),
|
||||
clean_files,
|
||||
ssprintf ( "$(%s_SOURCES)", module.name.c_str ()) );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -136,6 +136,7 @@ private:
|
|||
void GenerateSourceMacros ( const IfableData& data );
|
||||
void GenerateObjectMacros ( const IfableData& data );
|
||||
const FileLocation* GetPrecompiledHeaderFilename () const;
|
||||
const FileLocation* GetDlldataFilename () const;
|
||||
void GenerateGccCommand ( const FileLocation* sourceFile,
|
||||
const Rule *rule,
|
||||
const std::string& extraDependencies );
|
||||
|
|
|
@ -54,6 +54,7 @@ FixString ( const string& str, Backend *backend, const Module& module, const Fil
|
|||
ReplaceVariable ( ret, "$(source_path)", backend->GetFullPath ( *source ) );
|
||||
}
|
||||
ReplaceVariable ( ret, "$(dependencies)", dep );
|
||||
ReplaceVariable ( ret, "$(bare_dependencies)", additional_dependencies );
|
||||
ReplaceVariable ( ret, "$(module_name)", module.name );
|
||||
ReplaceVariable ( ret, "$(module_dllname)", module.GetDllName() );
|
||||
ReplaceVariable ( ret, "$(module_output)", GetTargetMacro ( module, true ) );
|
||||
|
|
|
@ -99,6 +99,50 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
context_handle_var = get_context_handle_var(func);
|
||||
}
|
||||
|
||||
print_client( "struct __frame_%s%s\n{\n", prefix_client, get_name(def) );
|
||||
indent++;
|
||||
print_client( "__DECL_EXCEPTION_FRAME\n" );
|
||||
print_client("MIDL_STUB_MESSAGE _StubMsg;\n");
|
||||
if (implicit_handle || explicit_handle_var || explicit_generic_handle_var || context_handle_var)
|
||||
{
|
||||
if (!implicit_handle && explicit_generic_handle_var)
|
||||
print_client("%s %s;\n",
|
||||
get_explicit_generic_handle_type(explicit_generic_handle_var)->name,
|
||||
explicit_generic_handle_var->name );
|
||||
print_client("RPC_BINDING_HANDLE _Handle;\n");
|
||||
}
|
||||
|
||||
if (!is_void(get_func_return_type(func)) && decl_indirect(get_func_return_type(func)))
|
||||
{
|
||||
print_client("void *_p_%s;\n", "_RetVal" );
|
||||
}
|
||||
indent--;
|
||||
print_client( "};\n\n" );
|
||||
|
||||
print_client( "static void __finally_%s%s(", prefix_client, get_name(def) );
|
||||
print_client( " struct __frame_%s%s *__frame )\n{\n", prefix_client, get_name(def) );
|
||||
indent++;
|
||||
|
||||
/* FIXME: emit client finally code */
|
||||
|
||||
if (has_full_pointer)
|
||||
write_full_pointer_free(client, indent, func);
|
||||
|
||||
print_client("NdrFreeBuffer(&__frame->_StubMsg);\n");
|
||||
|
||||
if (!implicit_handle && explicit_generic_handle_var)
|
||||
{
|
||||
fprintf(client, "\n");
|
||||
print_client("if (__frame->_Handle)\n");
|
||||
indent++;
|
||||
print_client("%s_unbind(__frame->%s, __frame->_Handle);\n",
|
||||
get_explicit_generic_handle_type(explicit_generic_handle_var)->name,
|
||||
explicit_generic_handle_var->name);
|
||||
indent--;
|
||||
}
|
||||
indent--;
|
||||
print_client( "}\n\n" );
|
||||
|
||||
write_type_decl_left(client, get_func_return_type(func));
|
||||
if (needs_space_after(get_func_return_type(func)))
|
||||
fprintf(client, " ");
|
||||
|
@ -115,6 +159,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
/* write the functions body */
|
||||
fprintf(client, "{\n");
|
||||
indent++;
|
||||
print_client( "struct __frame_%s%s __f, * const __frame = &__f;\n", prefix_client, get_name(def) );
|
||||
|
||||
/* declare return value '_RetVal' */
|
||||
if (!is_void(get_func_return_type(func)))
|
||||
|
@ -123,19 +168,24 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
write_type_decl_left(client, get_func_return_type(func));
|
||||
fprintf(client, " _RetVal;\n");
|
||||
}
|
||||
print_client("RPC_MESSAGE _RpcMessage;\n");
|
||||
|
||||
if (implicit_handle || explicit_handle_var || explicit_generic_handle_var || context_handle_var)
|
||||
print_client("RPC_BINDING_HANDLE _Handle = 0;\n");
|
||||
|
||||
print_client("RPC_MESSAGE _RpcMessage;\n");
|
||||
print_client("MIDL_STUB_MESSAGE _StubMsg;\n");
|
||||
{
|
||||
print_client( "__frame->_Handle = 0;\n" );
|
||||
if (!implicit_handle && explicit_generic_handle_var)
|
||||
print_client("__frame->%s = %s;\n",
|
||||
explicit_generic_handle_var->name, explicit_generic_handle_var->name );
|
||||
}
|
||||
if (!is_void(get_func_return_type(func)) && decl_indirect(get_func_return_type(func)))
|
||||
{
|
||||
print_client("void *_p_%s = &%s;\n",
|
||||
print_client("__frame->_p_%s = &%s;\n",
|
||||
"_RetVal", "_RetVal");
|
||||
}
|
||||
fprintf(client, "\n");
|
||||
|
||||
print_client( "RpcExceptionInit( 0, __finally_%s%s );\n", prefix_client, get_name(def) );
|
||||
|
||||
if (has_full_pointer)
|
||||
write_full_pointer_init(client, indent, func, FALSE);
|
||||
|
||||
|
@ -146,14 +196,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
print_client("{\n");
|
||||
indent++;
|
||||
|
||||
print_client("NdrClientInitializeNew(\n");
|
||||
indent++;
|
||||
print_client("(PRPC_MESSAGE)&_RpcMessage,\n");
|
||||
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||
print_client("(PMIDL_STUB_DESC)&%s_StubDesc,\n", iface->name);
|
||||
print_client("%d);\n", method_count);
|
||||
indent--;
|
||||
fprintf(client, "\n");
|
||||
print_client("NdrClientInitializeNew(&_RpcMessage, &__frame->_StubMsg, &%s_StubDesc, %d);\n",
|
||||
iface->name, method_count);
|
||||
|
||||
if (is_attr(def->attrs, ATTR_IDEMPOTENT) || is_attr(def->attrs, ATTR_BROADCAST))
|
||||
{
|
||||
|
@ -167,12 +211,12 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
|
||||
if (explicit_handle_var)
|
||||
{
|
||||
print_client("_Handle = %s;\n", explicit_handle_var->name);
|
||||
print_client("__frame->_Handle = %s;\n", explicit_handle_var->name);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
else if (explicit_generic_handle_var)
|
||||
{
|
||||
print_client("_Handle = %s_bind(%s);\n",
|
||||
print_client("__frame->_Handle = %s_bind(%s);\n",
|
||||
get_explicit_generic_handle_type(explicit_generic_handle_var)->name,
|
||||
explicit_generic_handle_var->name);
|
||||
fprintf(client, "\n");
|
||||
|
@ -185,7 +229,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
int is_ch_ptr = is_aliaschain_attr(context_handle_var->type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE;
|
||||
print_client("if (%s%s != 0)\n", is_ch_ptr ? "*" : "", context_handle_var->name);
|
||||
indent++;
|
||||
print_client("_Handle = NDRCContextBinding(%s%s);\n", is_ch_ptr ? "*" : "", context_handle_var->name);
|
||||
print_client("__frame->_Handle = NDRCContextBinding(%s%s);\n",
|
||||
is_ch_ptr ? "*" : "", context_handle_var->name);
|
||||
indent--;
|
||||
if (is_attr(context_handle_var->attrs, ATTR_IN) &&
|
||||
!is_attr(context_handle_var->attrs, ATTR_OUT))
|
||||
|
@ -199,38 +244,29 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
}
|
||||
else if (implicit_handle)
|
||||
{
|
||||
print_client("_Handle = %s;\n", implicit_handle);
|
||||
print_client("__frame->_Handle = %s;\n", implicit_handle);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
|
||||
write_remoting_arguments(client, indent, func, PASS_IN, PHASE_BUFFERSIZE);
|
||||
write_remoting_arguments(client, indent, func, "", PASS_IN, PHASE_BUFFERSIZE);
|
||||
|
||||
print_client("NdrGetBuffer(\n");
|
||||
indent++;
|
||||
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||
print_client("_StubMsg.BufferLength,\n");
|
||||
print_client("NdrGetBuffer(&__frame->_StubMsg, __frame->_StubMsg.BufferLength, ");
|
||||
if (implicit_handle || explicit_handle_var || explicit_generic_handle_var || context_handle_var)
|
||||
print_client("_Handle);\n");
|
||||
fprintf(client, "__frame->_Handle);\n\n");
|
||||
else
|
||||
print_client("%s__MIDL_AutoBindHandle);\n", iface->name);
|
||||
indent--;
|
||||
fprintf(client, "\n");
|
||||
fprintf(client,"%s__MIDL_AutoBindHandle);\n\n", iface->name);
|
||||
|
||||
/* marshal arguments */
|
||||
write_remoting_arguments(client, indent, func, PASS_IN, PHASE_MARSHAL);
|
||||
write_remoting_arguments(client, indent, func, "", PASS_IN, PHASE_MARSHAL);
|
||||
|
||||
/* send/receive message */
|
||||
/* print_client("NdrNsSendReceive(\n"); */
|
||||
/* print_client("(unsigned char *)_StubMsg.Buffer,\n"); */
|
||||
/* print_client("(unsigned char *)__frame->_StubMsg.Buffer,\n"); */
|
||||
/* print_client("(RPC_BINDING_HANDLE *) &%s__MIDL_AutoBindHandle);\n", iface->name); */
|
||||
print_client("NdrSendReceive(\n");
|
||||
indent++;
|
||||
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||
print_client("(unsigned char *)_StubMsg.Buffer);\n\n");
|
||||
indent--;
|
||||
print_client("NdrSendReceive(&__frame->_StubMsg, __frame->_StubMsg.Buffer);\n\n");
|
||||
|
||||
print_client("_StubMsg.BufferStart = (unsigned char *)_RpcMessage.Buffer;\n");
|
||||
print_client("_StubMsg.BufferEnd = _StubMsg.BufferStart + _RpcMessage.BufferLength;\n");
|
||||
print_client("__frame->_StubMsg.BufferStart = _RpcMessage.Buffer;\n");
|
||||
print_client("__frame->_StubMsg.BufferEnd = __frame->_StubMsg.BufferStart + _RpcMessage.BufferLength;\n");
|
||||
|
||||
if (has_out_arg_or_return(func))
|
||||
{
|
||||
|
@ -238,16 +274,14 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
|
||||
print_client("if ((_RpcMessage.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n");
|
||||
indent++;
|
||||
print_client("NdrConvert(\n");
|
||||
indent++;
|
||||
print_client("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||
print_client("(PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n", *proc_offset);
|
||||
indent -= 2;
|
||||
print_client("NdrConvert(&__frame->_StubMsg, (PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n",
|
||||
*proc_offset);
|
||||
indent--;
|
||||
}
|
||||
|
||||
/* unmarshall arguments */
|
||||
fprintf(client, "\n");
|
||||
write_remoting_arguments(client, indent, func, PASS_OUT, PHASE_UNMARSHAL);
|
||||
write_remoting_arguments(client, indent, func, "", PASS_OUT, PHASE_UNMARSHAL);
|
||||
|
||||
/* unmarshal return value */
|
||||
if (!is_void(get_func_return_type(func)))
|
||||
|
@ -256,7 +290,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
print_client("MIDL_memset(&%s, 0, sizeof(%s));\n", "_RetVal", "_RetVal");
|
||||
else if (is_ptr(get_func_return_type(func)) || is_array(get_func_return_type(func)))
|
||||
print_client("%s = 0;\n", "_RetVal");
|
||||
write_remoting_arguments(client, indent, func, PASS_RETURN, PHASE_UNMARSHAL);
|
||||
write_remoting_arguments(client, indent, func, "", PASS_RETURN, PHASE_UNMARSHAL);
|
||||
}
|
||||
|
||||
/* update proc_offset */
|
||||
|
@ -275,26 +309,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
print_client("RpcFinally\n");
|
||||
print_client("{\n");
|
||||
indent++;
|
||||
|
||||
|
||||
/* FIXME: emit client finally code */
|
||||
|
||||
if (has_full_pointer)
|
||||
write_full_pointer_free(client, indent, func);
|
||||
|
||||
print_client("NdrFreeBuffer((PMIDL_STUB_MESSAGE)&_StubMsg);\n");
|
||||
|
||||
if (!implicit_handle && explicit_generic_handle_var)
|
||||
{
|
||||
fprintf(client, "\n");
|
||||
print_client("if (_Handle)\n");
|
||||
indent++;
|
||||
print_client("%s_unbind(%s, _Handle);\n",
|
||||
get_explicit_generic_handle_type(explicit_generic_handle_var)->name,
|
||||
explicit_generic_handle_var->name);
|
||||
indent--;
|
||||
}
|
||||
|
||||
print_client( "__finally_%s%s( __frame );\n", prefix_client, get_name(def) );
|
||||
indent--;
|
||||
print_client("}\n");
|
||||
print_client("RpcEndFinally\n");
|
||||
|
@ -400,10 +415,10 @@ static void write_clientinterfacedecl(type_t *iface)
|
|||
indent--;
|
||||
print_client("};\n");
|
||||
if (old_names)
|
||||
print_client("RPC_IF_HANDLE %s_ClientIfHandle = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
|
||||
print_client("RPC_IF_HANDLE %s_ClientIfHandle DECLSPEC_HIDDEN = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
|
||||
iface->name, iface->name);
|
||||
else
|
||||
print_client("RPC_IF_HANDLE %s%s_v%d_%d_c_ifspec = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
|
||||
print_client("RPC_IF_HANDLE %s%s_v%d_%d_c_ifspec DECLSPEC_HIDDEN = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
|
||||
prefix_client, iface->name, MAJORVERSION(ver), MINORVERSION(ver), iface->name);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
|
@ -434,9 +449,16 @@ static void init_client(void)
|
|||
print_client("#endif\n");
|
||||
fprintf(client, "\n");
|
||||
print_client("#include \"%s\"\n", header_name);
|
||||
fprintf(client, "\n");
|
||||
print_client( "\n");
|
||||
print_client( "#ifndef DECLSPEC_HIDDEN\n");
|
||||
print_client( "#define DECLSPEC_HIDDEN\n");
|
||||
print_client( "#endif\n");
|
||||
print_client( "\n");
|
||||
write_exceptions( client );
|
||||
print_client( "\n");
|
||||
}
|
||||
|
||||
|
||||
static void write_client_ifaces(const statement_list_t *stmts, int expr_eval_routines, unsigned int *proc_offset)
|
||||
{
|
||||
const statement_t *stmt;
|
||||
|
@ -461,7 +483,7 @@ static void write_client_ifaces(const statement_list_t *stmts, int expr_eval_rou
|
|||
write_stubdescdecl(iface);
|
||||
write_function_stubs(iface, proc_offset);
|
||||
|
||||
print_client("#if !defined(__RPC_WIN32__)\n");
|
||||
print_client("#if !defined(__RPC_WIN%u__)\n", pointer_size == 8 ? 64 : 32);
|
||||
print_client("#error Invalid build platform for this stub.\n");
|
||||
print_client("#endif\n");
|
||||
|
||||
|
@ -474,20 +496,11 @@ static void write_client_ifaces(const statement_list_t *stmts, int expr_eval_rou
|
|||
}
|
||||
}
|
||||
|
||||
void write_client(const statement_list_t *stmts)
|
||||
static void write_client_routines(const statement_list_t *stmts)
|
||||
{
|
||||
unsigned int proc_offset = 0;
|
||||
int expr_eval_routines;
|
||||
|
||||
if (!do_client)
|
||||
return;
|
||||
if (do_everything && !need_stub_files(stmts))
|
||||
return;
|
||||
|
||||
init_client();
|
||||
if (!client)
|
||||
return;
|
||||
|
||||
write_formatstringsdecl(client, indent, stmts, need_stub);
|
||||
expr_eval_routines = write_expr_eval_routines(client, client_token);
|
||||
if (expr_eval_routines)
|
||||
|
@ -500,6 +513,39 @@ void write_client(const statement_list_t *stmts)
|
|||
|
||||
write_procformatstring(client, stmts, need_stub);
|
||||
write_typeformatstring(client, stmts, need_stub);
|
||||
}
|
||||
|
||||
void write_client(const statement_list_t *stmts)
|
||||
{
|
||||
if (!do_client)
|
||||
return;
|
||||
if (do_everything && !need_stub_files(stmts))
|
||||
return;
|
||||
|
||||
init_client();
|
||||
if (!client)
|
||||
return;
|
||||
|
||||
if (do_win32 && do_win64)
|
||||
{
|
||||
fprintf(client, "\n#ifndef _WIN64\n\n");
|
||||
pointer_size = 4;
|
||||
write_client_routines( stmts );
|
||||
fprintf(client, "\n#else /* _WIN64 */\n\n");
|
||||
pointer_size = 8;
|
||||
write_client_routines( stmts );
|
||||
fprintf(client, "\n#endif /* _WIN64 */\n");
|
||||
}
|
||||
else if (do_win32)
|
||||
{
|
||||
pointer_size = 4;
|
||||
write_client_routines( stmts );
|
||||
}
|
||||
else if (do_win64)
|
||||
{
|
||||
pointer_size = 8;
|
||||
write_client_routines( stmts );
|
||||
}
|
||||
|
||||
fclose(client);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "utils.h"
|
||||
#include "expr.h"
|
||||
#include "header.h"
|
||||
#include "typetree.h"
|
||||
|
||||
expr_t *make_expr(enum expr_type type)
|
||||
{
|
||||
|
@ -362,17 +363,14 @@ static type_t *find_identifier(const char *identifier, const type_t *cont_type,
|
|||
|
||||
*found_in_cont_type = 0;
|
||||
|
||||
if (cont_type && (cont_type->type == RPC_FC_FUNCTION || is_struct(cont_type->type)))
|
||||
fields = cont_type->fields_or_args;
|
||||
else if (cont_type && is_union(cont_type->type))
|
||||
if (cont_type)
|
||||
{
|
||||
if (cont_type->type == RPC_FC_ENCAPSULATED_UNION)
|
||||
{
|
||||
const var_t *uv = LIST_ENTRY(list_tail(cont_type->fields_or_args), const var_t, entry);
|
||||
fields = uv->type->fields_or_args;
|
||||
}
|
||||
else
|
||||
fields = cont_type->fields_or_args;
|
||||
if (cont_type->type == RPC_FC_FUNCTION)
|
||||
fields = type_function_get_args(cont_type);
|
||||
else if (is_struct(cont_type->type))
|
||||
fields = type_struct_get_fields(cont_type);
|
||||
else if (is_union(cont_type->type))
|
||||
fields = type_union_get_cases(cont_type);
|
||||
}
|
||||
|
||||
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
|
||||
|
@ -576,7 +574,7 @@ const type_t *expr_resolve_type(const struct expr_loc *expr_loc, const type_t *c
|
|||
|
||||
void write_expr(FILE *h, const expr_t *e, int brackets,
|
||||
int toplevel, const char *toplevel_prefix,
|
||||
const type_t *cont_type)
|
||||
const type_t *cont_type, const char *local_var_prefix)
|
||||
{
|
||||
switch (e->type)
|
||||
{
|
||||
|
@ -602,9 +600,13 @@ void write_expr(FILE *h, const expr_t *e, int brackets,
|
|||
{
|
||||
int found_in_cont_type;
|
||||
find_identifier(e->u.sval, cont_type, &found_in_cont_type);
|
||||
if (found_in_cont_type) fprintf(h, "%s", toplevel_prefix);
|
||||
if (found_in_cont_type)
|
||||
{
|
||||
fprintf(h, "%s%s", toplevel_prefix, e->u.sval);
|
||||
break;
|
||||
}
|
||||
}
|
||||
fprintf(h, "%s", e->u.sval);
|
||||
fprintf(h, "%s%s", local_var_prefix, e->u.sval);
|
||||
break;
|
||||
case EXPR_STRLIT:
|
||||
fprintf(h, "\"%s\"", e->u.sval);
|
||||
|
@ -614,33 +616,33 @@ void write_expr(FILE *h, const expr_t *e, int brackets,
|
|||
break;
|
||||
case EXPR_LOGNOT:
|
||||
fprintf(h, "!");
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
break;
|
||||
case EXPR_NOT:
|
||||
fprintf(h, "~");
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
break;
|
||||
case EXPR_POS:
|
||||
fprintf(h, "+");
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
break;
|
||||
case EXPR_NEG:
|
||||
fprintf(h, "-");
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
break;
|
||||
case EXPR_ADDRESSOF:
|
||||
fprintf(h, "&");
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
break;
|
||||
case EXPR_PPTR:
|
||||
fprintf(h, "*");
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
break;
|
||||
case EXPR_CAST:
|
||||
fprintf(h, "(");
|
||||
write_type_decl(h, e->u.tref, NULL);
|
||||
fprintf(h, ")");
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
break;
|
||||
case EXPR_SIZEOF:
|
||||
fprintf(h, "sizeof(");
|
||||
|
@ -666,7 +668,7 @@ void write_expr(FILE *h, const expr_t *e, int brackets,
|
|||
case EXPR_GTREQL:
|
||||
case EXPR_LESSEQL:
|
||||
if (brackets) fprintf(h, "(");
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
switch (e->type)
|
||||
{
|
||||
case EXPR_SHL: fprintf(h, " << "); break;
|
||||
|
@ -689,38 +691,38 @@ void write_expr(FILE *h, const expr_t *e, int brackets,
|
|||
case EXPR_LESSEQL: fprintf(h, " <= "); break;
|
||||
default: break;
|
||||
}
|
||||
write_expr(h, e->u.ext, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->u.ext, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
if (brackets) fprintf(h, ")");
|
||||
break;
|
||||
case EXPR_MEMBER:
|
||||
if (brackets) fprintf(h, "(");
|
||||
if (e->ref->type == EXPR_PPTR)
|
||||
{
|
||||
write_expr(h, e->ref->ref, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->ref->ref, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
fprintf(h, "->");
|
||||
}
|
||||
else
|
||||
{
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
fprintf(h, ".");
|
||||
}
|
||||
write_expr(h, e->u.ext, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->u.ext, 1, 0, toplevel_prefix, cont_type, "");
|
||||
if (brackets) fprintf(h, ")");
|
||||
break;
|
||||
case EXPR_COND:
|
||||
if (brackets) fprintf(h, "(");
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
fprintf(h, " ? ");
|
||||
write_expr(h, e->u.ext, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->u.ext, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
fprintf(h, " : ");
|
||||
write_expr(h, e->ext2, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->ext2, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
if (brackets) fprintf(h, ")");
|
||||
break;
|
||||
case EXPR_ARRAY:
|
||||
if (brackets) fprintf(h, "(");
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->ref, 1, toplevel, toplevel_prefix, cont_type, local_var_prefix);
|
||||
fprintf(h, "[");
|
||||
write_expr(h, e->u.ext, 1, toplevel, toplevel_prefix, cont_type);
|
||||
write_expr(h, e->u.ext, 1, 1, toplevel_prefix, cont_type, local_var_prefix);
|
||||
fprintf(h, "]");
|
||||
if (brackets) fprintf(h, ")");
|
||||
break;
|
||||
|
|
|
@ -37,4 +37,5 @@ extern expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, exp
|
|||
extern const type_t *expr_resolve_type(const struct expr_loc *expr_loc, const type_t *cont_type, const expr_t *expr);
|
||||
extern int compare_expr(const expr_t *a, const expr_t *b);
|
||||
|
||||
extern void write_expr(FILE *h, const expr_t *e, int brackets, int toplevel, const char *toplevel_prefix, const type_t *cont_type);
|
||||
extern void write_expr(FILE *h, const expr_t *e, int brackets, int toplevel, const char *toplevel_prefix,
|
||||
const type_t *cont_type, const char *local_var_prefix);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "parser.h"
|
||||
#include "header.h"
|
||||
#include "expr.h"
|
||||
#include "typetree.h"
|
||||
|
||||
typedef struct _user_type_t generic_handle_t;
|
||||
|
||||
|
@ -174,7 +175,7 @@ static void write_enums(FILE *h, var_list_t *enums)
|
|||
fprintf(h, "%s", get_name(v));
|
||||
if (v->eval) {
|
||||
fprintf(h, " = ");
|
||||
write_expr(h, v->eval, 0, 1, NULL, NULL);
|
||||
write_expr(h, v->eval, 0, 1, NULL, NULL, "");
|
||||
}
|
||||
}
|
||||
if (list_next( enums, &v->entry )) fprintf(h, ",\n");
|
||||
|
@ -204,12 +205,12 @@ void write_type_left(FILE *h, type_t *t, int declonly)
|
|||
switch (t->type) {
|
||||
case RPC_FC_ENUM16:
|
||||
case RPC_FC_ENUM32:
|
||||
if (!declonly && t->defined && !t->written && !t->ignore) {
|
||||
if (!declonly && t->defined && !t->written) {
|
||||
if (t->name) fprintf(h, "enum %s {\n", t->name);
|
||||
else fprintf(h, "enum {\n");
|
||||
t->written = TRUE;
|
||||
indentation++;
|
||||
write_enums(h, t->fields_or_args);
|
||||
write_enums(h, type_enum_get_values(t));
|
||||
indent(h, -1);
|
||||
fprintf(h, "}");
|
||||
}
|
||||
|
@ -222,24 +223,27 @@ void write_type_left(FILE *h, type_t *t, int declonly)
|
|||
case RPC_FC_PSTRUCT:
|
||||
case RPC_FC_BOGUS_STRUCT:
|
||||
case RPC_FC_ENCAPSULATED_UNION:
|
||||
if (!declonly && t->defined && !t->written && !t->ignore) {
|
||||
if (!declonly && t->defined && !t->written) {
|
||||
if (t->name) fprintf(h, "struct %s {\n", t->name);
|
||||
else fprintf(h, "struct {\n");
|
||||
t->written = TRUE;
|
||||
indentation++;
|
||||
write_fields(h, t->fields_or_args);
|
||||
if (t->type == RPC_FC_ENCAPSULATED_UNION)
|
||||
write_fields(h, type_encapsulated_union_get_fields(t));
|
||||
else
|
||||
write_fields(h, type_struct_get_fields(t));
|
||||
indent(h, -1);
|
||||
fprintf(h, "}");
|
||||
}
|
||||
else fprintf(h, "struct %s", t->name ? t->name : "");
|
||||
break;
|
||||
case RPC_FC_NON_ENCAPSULATED_UNION:
|
||||
if (!declonly && t->defined && !t->written && !t->ignore) {
|
||||
if (!declonly && t->defined && !t->written) {
|
||||
if (t->name) fprintf(h, "union %s {\n", t->name);
|
||||
else fprintf(h, "union {\n");
|
||||
t->written = TRUE;
|
||||
indentation++;
|
||||
write_fields(h, t->fields_or_args);
|
||||
write_fields(h, type_union_get_cases(t));
|
||||
indent(h, -1);
|
||||
fprintf(h, "}");
|
||||
}
|
||||
|
@ -308,7 +312,7 @@ void write_type_v(FILE *h, type_t *t, int is_field, int declonly,
|
|||
if (pt->type == RPC_FC_FUNCTION) {
|
||||
if (ptr_level) fputc(')', h);
|
||||
fputc('(', h);
|
||||
write_args(h, pt->fields_or_args, NULL, 0, FALSE);
|
||||
write_args(h, type_function_get_args(pt), NULL, 0, FALSE);
|
||||
fputc(')', h);
|
||||
} else
|
||||
write_type_right(h, t, is_field);
|
||||
|
@ -407,15 +411,22 @@ void check_for_additional_prototype_types(const var_list_t *list)
|
|||
* using a wire marshaled type */
|
||||
break;
|
||||
}
|
||||
else
|
||||
else if (type_is_complete(type))
|
||||
{
|
||||
check_for_additional_prototype_types(type->fields_or_args);
|
||||
var_list_t *vars = NULL;
|
||||
if (type->type == RPC_FC_ENUM16 || type->type == RPC_FC_ENUM32)
|
||||
vars = type_enum_get_values(type);
|
||||
else if (is_struct(type->type))
|
||||
vars = type_struct_get_fields(type);
|
||||
else if (is_union(type->type))
|
||||
vars = type_union_get_cases(type);
|
||||
check_for_additional_prototype_types(vars);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void write_user_types(void)
|
||||
static void write_user_types(FILE *header)
|
||||
{
|
||||
user_type_t *ut;
|
||||
LIST_FOR_EACH_ENTRY(ut, &user_type_list, user_type_t, entry)
|
||||
|
@ -428,7 +439,7 @@ void write_user_types(void)
|
|||
}
|
||||
}
|
||||
|
||||
void write_context_handle_rundowns(void)
|
||||
static void write_context_handle_rundowns(FILE *header)
|
||||
{
|
||||
context_handle_t *ch;
|
||||
LIST_FOR_EACH_ENTRY(ch, &context_handle_list, context_handle_t, entry)
|
||||
|
@ -438,7 +449,7 @@ void write_context_handle_rundowns(void)
|
|||
}
|
||||
}
|
||||
|
||||
void write_generic_handle_routines(void)
|
||||
static void write_generic_handle_routines(FILE *header)
|
||||
{
|
||||
generic_handle_t *gh;
|
||||
LIST_FOR_EACH_ENTRY(gh, &generic_handle_list, generic_handle_t, entry)
|
||||
|
@ -449,7 +460,7 @@ void write_generic_handle_routines(void)
|
|||
}
|
||||
}
|
||||
|
||||
void write_typedef(type_t *type)
|
||||
static void write_typedef(FILE *header, type_t *type)
|
||||
{
|
||||
fprintf(header, "typedef ");
|
||||
write_type_def_or_decl(header, type->orig, FALSE, "%s", type->name);
|
||||
|
@ -474,15 +485,15 @@ int is_const_decl(const var_t *var)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void write_declaration(const var_t *v, int is_in_interface)
|
||||
static void write_declaration(FILE *header, const var_t *v)
|
||||
{
|
||||
if (is_const_decl(v) && v->eval)
|
||||
{
|
||||
fprintf(header, "#define %s (", v->name);
|
||||
write_expr(header, v->eval, 0, 1, NULL, NULL);
|
||||
write_expr(header, v->eval, 0, 1, NULL, NULL, "");
|
||||
fprintf(header, ")\n\n");
|
||||
}
|
||||
else if (v->type->type != RPC_FC_FUNCTION || !is_in_interface)
|
||||
else
|
||||
{
|
||||
switch (v->stgclass)
|
||||
{
|
||||
|
@ -501,7 +512,7 @@ void write_declaration(const var_t *v, int is_in_interface)
|
|||
}
|
||||
}
|
||||
|
||||
void write_library(const typelib_t *typelib)
|
||||
static void write_library(FILE *header, const typelib_t *typelib)
|
||||
{
|
||||
const UUID *uuid = get_attrp(typelib->attrs, ATTR_UUID);
|
||||
fprintf(header, "\n");
|
||||
|
@ -526,18 +537,10 @@ const var_t* get_explicit_handle_var(const func_t* func)
|
|||
|
||||
const type_t* get_explicit_generic_handle_type(const var_t* var)
|
||||
{
|
||||
const type_t *t = var->type;
|
||||
|
||||
if (t->type == RPC_FC_BIND_PRIMITIVE)
|
||||
return NULL;
|
||||
|
||||
if (!is_ptr(t) && is_attr(t->attrs, ATTR_HANDLE))
|
||||
return t;
|
||||
else
|
||||
for (; is_ptr(t); t = t->ref)
|
||||
if (t->type != RPC_FC_BIND_PRIMITIVE && is_attr(t->attrs, ATTR_HANDLE))
|
||||
return t;
|
||||
|
||||
const type_t *t;
|
||||
for (t = var->type; is_ptr(t); t = t->ref)
|
||||
if (t->type != RPC_FC_BIND_PRIMITIVE && is_attr(t->attrs, ATTR_HANDLE))
|
||||
return t;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -751,7 +754,7 @@ static void write_method_proto(FILE *header, const type_t *iface)
|
|||
}
|
||||
}
|
||||
|
||||
void write_locals(FILE *fp, const type_t *iface, int body)
|
||||
static void write_locals(FILE *fp, const type_t *iface, int body)
|
||||
{
|
||||
static const char comment[]
|
||||
= "/* WIDL-generated stub. You must provide an implementation for this. */";
|
||||
|
@ -811,55 +814,60 @@ void write_locals(FILE *fp, const type_t *iface, int body)
|
|||
}
|
||||
}
|
||||
|
||||
static void write_function_proto(FILE *header, const type_t *iface, const func_t *fun, const char *prefix)
|
||||
static void write_local_stubs_stmts(FILE *local_stubs, const statement_list_t *stmts)
|
||||
{
|
||||
var_t *def = fun->def;
|
||||
const char *callconv = get_attrp(def->type->attrs, ATTR_CALLCONV);
|
||||
const statement_t *stmt;
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP)
|
||||
write_locals(local_stubs, stmt->u.type, TRUE);
|
||||
else if (stmt->type == STMT_LIBRARY)
|
||||
write_local_stubs_stmts(local_stubs, stmt->u.lib->stmts);
|
||||
}
|
||||
}
|
||||
|
||||
void write_local_stubs(const statement_list_t *stmts)
|
||||
{
|
||||
FILE *local_stubs;
|
||||
|
||||
if (!local_stubs_name) return;
|
||||
|
||||
local_stubs = fopen(local_stubs_name, "w");
|
||||
if (!local_stubs) {
|
||||
error("Could not open %s for output\n", local_stubs_name);
|
||||
return;
|
||||
}
|
||||
fprintf(local_stubs, "/* call_as/local stubs for %s */\n\n", input_name);
|
||||
fprintf(local_stubs, "#include <objbase.h>\n");
|
||||
fprintf(local_stubs, "#include \"%s\"\n\n", header_name);
|
||||
|
||||
write_local_stubs_stmts(local_stubs, stmts);
|
||||
|
||||
fclose(local_stubs);
|
||||
}
|
||||
|
||||
static void write_function_proto(FILE *header, const type_t *iface, const var_t *fun, const char *prefix)
|
||||
{
|
||||
const char *callconv = get_attrp(fun->type->attrs, ATTR_CALLCONV);
|
||||
|
||||
/* FIXME: do we need to handle call_as? */
|
||||
write_type_decl_left(header, get_func_return_type(fun));
|
||||
write_type_decl_left(header, fun->type->ref);
|
||||
fprintf(header, " ");
|
||||
if (callconv) fprintf(header, "%s ", callconv);
|
||||
fprintf(header, "%s%s(\n", prefix, get_name(def));
|
||||
if (fun->args)
|
||||
write_args(header, fun->args, iface->name, 0, TRUE);
|
||||
fprintf(header, "%s%s(\n", prefix, get_name(fun));
|
||||
if (fun->type->details.function->args)
|
||||
write_args(header, fun->type->details.function->args, iface->name, 0, TRUE);
|
||||
else
|
||||
fprintf(header, " void");
|
||||
fprintf(header, ");\n\n");
|
||||
}
|
||||
|
||||
static void write_function_protos(FILE *header, const type_t *iface)
|
||||
static void write_forward(FILE *header, type_t *iface)
|
||||
{
|
||||
const func_t *cur;
|
||||
int prefixes_differ = strcmp(prefix_client, prefix_server);
|
||||
|
||||
if (!iface->funcs) return;
|
||||
LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry )
|
||||
{
|
||||
if (prefixes_differ) {
|
||||
fprintf(header, "/* client prototype */\n");
|
||||
write_function_proto(header, iface, cur, prefix_client);
|
||||
fprintf(header, "/* server prototype */\n");
|
||||
}
|
||||
write_function_proto(header, iface, cur, prefix_server);
|
||||
}
|
||||
}
|
||||
|
||||
void write_forward(type_t *iface)
|
||||
{
|
||||
/* C/C++ forwards should only be written for object interfaces, so if we
|
||||
* have a full definition we only write one if we find [object] among the
|
||||
* attributes - however, if we don't have a full definition at this point
|
||||
* (i.e. this is an IDL forward), then we also assume that it is an object
|
||||
* interface, since non-object interfaces shouldn't need forwards */
|
||||
if ((!iface->defined || is_object(iface->attrs) || is_attr(iface->attrs, ATTR_DISPINTERFACE))
|
||||
&& !iface->written) {
|
||||
fprintf(header, "#ifndef __%s_FWD_DEFINED__\n", iface->name);
|
||||
fprintf(header, "#define __%s_FWD_DEFINED__\n", iface->name);
|
||||
fprintf(header, "typedef interface %s %s;\n", iface->name, iface->name);
|
||||
fprintf(header, "#endif\n\n" );
|
||||
iface->written = TRUE;
|
||||
}
|
||||
fprintf(header, "#ifndef __%s_FWD_DEFINED__\n", iface->name);
|
||||
fprintf(header, "#define __%s_FWD_DEFINED__\n", iface->name);
|
||||
fprintf(header, "typedef interface %s %s;\n", iface->name, iface->name);
|
||||
fprintf(header, "#endif\n\n" );
|
||||
}
|
||||
|
||||
static void write_iface_guid(FILE *header, const type_t *iface)
|
||||
|
@ -996,22 +1004,7 @@ static void write_rpc_interface_end(FILE *header, const type_t *iface)
|
|||
fprintf(header,"\n#endif /* __%s_INTERFACE_DEFINED__ */\n\n", iface->name);
|
||||
}
|
||||
|
||||
void write_interface(type_t *iface)
|
||||
{
|
||||
if (is_attr(iface->attrs, ATTR_DISPINTERFACE) || is_object(iface->attrs))
|
||||
{
|
||||
write_com_interface_start(header, iface);
|
||||
write_com_interface_end(header, iface);
|
||||
}
|
||||
else
|
||||
{
|
||||
write_rpc_interface_start(header, iface);
|
||||
write_function_protos(header, iface);
|
||||
write_rpc_interface_end(header, iface);
|
||||
}
|
||||
}
|
||||
|
||||
void write_coclass(type_t *cocl)
|
||||
static void write_coclass(FILE *header, type_t *cocl)
|
||||
{
|
||||
fprintf(header, "/*****************************************************************************\n");
|
||||
fprintf(header, " * %s coclass\n", cocl->name);
|
||||
|
@ -1020,7 +1013,7 @@ void write_coclass(type_t *cocl)
|
|||
fprintf(header, "\n");
|
||||
}
|
||||
|
||||
void write_coclass_forward(type_t *cocl)
|
||||
static void write_coclass_forward(FILE *header, type_t *cocl)
|
||||
{
|
||||
fprintf(header, "#ifndef __%s_FWD_DEFINED__\n", cocl->name);
|
||||
fprintf(header, "#define __%s_FWD_DEFINED__\n", cocl->name);
|
||||
|
@ -1028,7 +1021,7 @@ void write_coclass_forward(type_t *cocl)
|
|||
fprintf(header, "#endif /* defined __%s_FWD_DEFINED__ */\n\n", cocl->name );
|
||||
}
|
||||
|
||||
void write_import(const char *fname)
|
||||
static void write_import(FILE *header, const char *fname)
|
||||
{
|
||||
char *hname, *p;
|
||||
|
||||
|
@ -1039,3 +1032,194 @@ void write_import(const char *fname)
|
|||
fprintf(header, "#include <%s>\n", hname);
|
||||
free(hname);
|
||||
}
|
||||
|
||||
static void write_imports(FILE *header, const statement_list_t *stmts)
|
||||
{
|
||||
const statement_t *stmt;
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
switch (stmt->type)
|
||||
{
|
||||
case STMT_TYPE:
|
||||
if (stmt->u.type->type == RPC_FC_IP)
|
||||
write_imports(header, stmt->u.type->stmts);
|
||||
break;
|
||||
case STMT_TYPEREF:
|
||||
case STMT_IMPORTLIB:
|
||||
/* not included in header */
|
||||
break;
|
||||
case STMT_IMPORT:
|
||||
write_import(header, stmt->u.str);
|
||||
break;
|
||||
case STMT_TYPEDEF:
|
||||
case STMT_MODULE:
|
||||
case STMT_CPPQUOTE:
|
||||
case STMT_DECLARATION:
|
||||
/* not processed here */
|
||||
break;
|
||||
case STMT_LIBRARY:
|
||||
write_imports(header, stmt->u.lib->stmts);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void write_forward_decls(FILE *header, const statement_list_t *stmts)
|
||||
{
|
||||
const statement_t *stmt;
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
switch (stmt->type)
|
||||
{
|
||||
case STMT_TYPE:
|
||||
if (stmt->u.type->type == RPC_FC_IP)
|
||||
{
|
||||
if (is_object(stmt->u.type->attrs) || is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE))
|
||||
write_forward(header, stmt->u.type);
|
||||
}
|
||||
else if (stmt->u.type->type == RPC_FC_COCLASS)
|
||||
write_coclass_forward(header, stmt->u.type);
|
||||
break;
|
||||
case STMT_TYPEREF:
|
||||
case STMT_IMPORTLIB:
|
||||
/* not included in header */
|
||||
break;
|
||||
case STMT_IMPORT:
|
||||
case STMT_TYPEDEF:
|
||||
case STMT_MODULE:
|
||||
case STMT_CPPQUOTE:
|
||||
case STMT_DECLARATION:
|
||||
/* not processed here */
|
||||
break;
|
||||
case STMT_LIBRARY:
|
||||
write_forward_decls(header, stmt->u.lib->stmts);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void write_header_stmts(FILE *header, const statement_list_t *stmts, const type_t *iface, int ignore_funcs)
|
||||
{
|
||||
const statement_t *stmt;
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
switch (stmt->type)
|
||||
{
|
||||
case STMT_TYPE:
|
||||
if (stmt->u.type->type == RPC_FC_IP)
|
||||
{
|
||||
type_t *iface = stmt->u.type;
|
||||
if (is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE) || is_object(stmt->u.type->attrs))
|
||||
{
|
||||
write_com_interface_start(header, iface);
|
||||
write_header_stmts(header, iface->stmts, stmt->u.type, TRUE);
|
||||
write_com_interface_end(header, iface);
|
||||
}
|
||||
else
|
||||
{
|
||||
write_rpc_interface_start(header, iface);
|
||||
write_header_stmts(header, iface->stmts, iface, FALSE);
|
||||
write_rpc_interface_end(header, iface);
|
||||
}
|
||||
}
|
||||
else if (stmt->u.type->type == RPC_FC_COCLASS)
|
||||
write_coclass(header, stmt->u.type);
|
||||
else
|
||||
{
|
||||
write_type_def_or_decl(header, stmt->u.type, FALSE, NULL);
|
||||
fprintf(header, ";\n\n");
|
||||
}
|
||||
break;
|
||||
case STMT_TYPEREF:
|
||||
/* FIXME: shouldn't write out forward declarations for undefined
|
||||
* interfaces but a number of our IDL files depend on this */
|
||||
if (stmt->u.type->type == RPC_FC_IP && !stmt->u.type->written)
|
||||
write_forward(header, stmt->u.type);
|
||||
break;
|
||||
case STMT_IMPORTLIB:
|
||||
case STMT_MODULE:
|
||||
/* not included in header */
|
||||
break;
|
||||
case STMT_IMPORT:
|
||||
/* not processed here */
|
||||
break;
|
||||
case STMT_TYPEDEF:
|
||||
{
|
||||
const type_list_t *type_entry = stmt->u.type_list;
|
||||
for (; type_entry; type_entry = type_entry->next)
|
||||
write_typedef(header, type_entry->type);
|
||||
break;
|
||||
}
|
||||
case STMT_LIBRARY:
|
||||
write_library(header, stmt->u.lib);
|
||||
write_header_stmts(header, stmt->u.lib->stmts, NULL, FALSE);
|
||||
break;
|
||||
case STMT_CPPQUOTE:
|
||||
fprintf(header, "%s\n", stmt->u.str);
|
||||
break;
|
||||
case STMT_DECLARATION:
|
||||
if (iface && stmt->u.var->type->type == RPC_FC_FUNCTION)
|
||||
{
|
||||
if (!ignore_funcs)
|
||||
{
|
||||
int prefixes_differ = strcmp(prefix_client, prefix_server);
|
||||
|
||||
if (prefixes_differ)
|
||||
{
|
||||
fprintf(header, "/* client prototype */\n");
|
||||
write_function_proto(header, iface, stmt->u.var, prefix_client);
|
||||
fprintf(header, "/* server prototype */\n");
|
||||
}
|
||||
write_function_proto(header, iface, stmt->u.var, prefix_server);
|
||||
}
|
||||
}
|
||||
else
|
||||
write_declaration(header, stmt->u.var);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void write_header(const statement_list_t *stmts)
|
||||
{
|
||||
FILE *header;
|
||||
|
||||
if (!do_header) return;
|
||||
|
||||
if(!(header = fopen(header_name, "w"))) {
|
||||
error("Could not open %s for output\n", header_name);
|
||||
return;
|
||||
}
|
||||
fprintf(header, "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n\n", PACKAGE_VERSION, input_name);
|
||||
fprintf(header, "#include <rpc.h>\n" );
|
||||
fprintf(header, "#include <rpcndr.h>\n\n" );
|
||||
|
||||
fprintf(header, "#ifndef __WIDL_%s\n", header_token);
|
||||
fprintf(header, "#define __WIDL_%s\n\n", header_token);
|
||||
start_cplusplus_guard(header);
|
||||
|
||||
fprintf(header, "/* Headers for imported files */\n\n");
|
||||
write_imports(header, stmts);
|
||||
fprintf(header, "\n");
|
||||
|
||||
/* FIXME: should be before imported file includes */
|
||||
fprintf(header, "/* Forward declarations */\n\n");
|
||||
write_forward_decls(header, stmts);
|
||||
fprintf(header, "\n");
|
||||
|
||||
write_header_stmts(header, stmts, NULL, FALSE);
|
||||
|
||||
fprintf(header, "/* Begin additional prototypes for all interfaces */\n");
|
||||
fprintf(header, "\n");
|
||||
write_user_types(header);
|
||||
write_generic_handle_routines(header);
|
||||
write_context_handle_rundowns(header);
|
||||
fprintf(header, "\n");
|
||||
fprintf(header, "/* End additional prototypes */\n");
|
||||
fprintf(header, "\n");
|
||||
|
||||
end_cplusplus_guard(header);
|
||||
fprintf(header, "#endif /* __WIDL_%s */\n", header_token);
|
||||
|
||||
fclose(header);
|
||||
}
|
||||
|
|
|
@ -47,18 +47,6 @@ extern int need_proxy_file(const statement_list_t *stmts);
|
|||
extern const var_t *is_callas(const attr_list_t *list);
|
||||
extern void write_args(FILE *h, const var_list_t *arg, const char *name, int obj, int do_indent);
|
||||
extern void write_array(FILE *h, array_dims_t *v, int field);
|
||||
extern void write_import(const char *fname);
|
||||
extern void write_forward(type_t *iface);
|
||||
extern void write_interface(type_t *iface);
|
||||
extern void write_locals(FILE *fp, const type_t *iface, int body);
|
||||
extern void write_coclass(type_t *cocl);
|
||||
extern void write_coclass_forward(type_t *cocl);
|
||||
extern void write_typedef(type_t *type);
|
||||
extern void write_declaration(const var_t *v, int is_in_interface);
|
||||
extern void write_library(const typelib_t *typelib);
|
||||
extern void write_user_types(void);
|
||||
extern void write_context_handle_rundowns(void);
|
||||
extern void write_generic_handle_routines(void);
|
||||
extern const var_t* get_explicit_handle_var(const func_t* func);
|
||||
extern const type_t* get_explicit_generic_handle_type(const var_t* var);
|
||||
extern const var_t* get_explicit_generic_handle_var(const func_t* func);
|
||||
|
@ -86,19 +74,11 @@ static inline int is_string_type(const attr_list_t *attrs, const type_t *type)
|
|||
|
||||
static inline int is_context_handle(const type_t *type)
|
||||
{
|
||||
if (is_attr(type->attrs, ATTR_CONTEXTHANDLE))
|
||||
return 1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (is_attr(type->attrs, ATTR_CONTEXTHANDLE))
|
||||
const type_t *t;
|
||||
for (t = type; is_ptr(t); t = t->ref)
|
||||
if (is_attr(t->attrs, ATTR_CONTEXTHANDLE))
|
||||
return 1;
|
||||
else if (type->kind == TKIND_ALIAS)
|
||||
type = type->orig;
|
||||
else if (is_ptr(type))
|
||||
type = type->ref;
|
||||
else return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -45,4 +45,7 @@ void pop_import(void);
|
|||
|
||||
int is_type(const char *name);
|
||||
|
||||
void check_functions(const type_t *iface);
|
||||
func_list_t *gen_function_list(const statement_list_t *stmts);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -47,6 +47,8 @@ double [0-9]+\.[0-9]+([eE][+-]?[0-9]+)*
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -82,6 +84,19 @@ struct {
|
|||
} import_stack[MAX_IMPORT_DEPTH];
|
||||
int import_stack_ptr = 0;
|
||||
|
||||
/* converts an integer in string form to an unsigned long and prints an error
|
||||
* on overflow */
|
||||
static unsigned long xstrtoul(const char *nptr, char **endptr, int base)
|
||||
{
|
||||
unsigned long l;
|
||||
|
||||
errno = 0;
|
||||
l = strtoul(nptr, endptr, base);
|
||||
if (l == ULONG_MAX && errno == ERANGE)
|
||||
error_loc("integer constant %s is too large\n", nptr);
|
||||
return l;
|
||||
}
|
||||
|
||||
UUID *parse_uuid(const char *u)
|
||||
{
|
||||
UUID* uuid = xmalloc(sizeof(UUID));
|
||||
|
@ -154,11 +169,11 @@ UUID *parse_uuid(const char *u)
|
|||
return aUUID;
|
||||
}
|
||||
<INITIAL,ATTR>{hex} {
|
||||
parser_lval.num = strtoul(yytext, NULL, 0);
|
||||
parser_lval.num = xstrtoul(yytext, NULL, 0);
|
||||
return aHEXNUM;
|
||||
}
|
||||
<INITIAL,ATTR>{int} {
|
||||
parser_lval.num = strtoul(yytext, NULL, 0);
|
||||
parser_lval.num = xstrtoul(yytext, NULL, 0);
|
||||
return aNUM;
|
||||
}
|
||||
<INITIAL>{double} {
|
||||
|
@ -244,7 +259,7 @@ static const struct keyword keywords[] = {
|
|||
{"short", tSHORT},
|
||||
{"signed", tSIGNED},
|
||||
{"sizeof", tSIZEOF},
|
||||
{"small", tSMALL},
|
||||
{"small", tSMALL},
|
||||
{"static", tSTATIC},
|
||||
{"stdcall", tSTDCALL},
|
||||
{"struct", tSTRUCT},
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -335,7 +335,7 @@
|
|||
|
||||
|
||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||
#line 179 "parser.y"
|
||||
#line 177 "parser.y"
|
||||
typedef union YYSTYPE {
|
||||
attr_t *attr;
|
||||
attr_list_t *attr_list;
|
||||
|
@ -374,4 +374,3 @@ typedef union YYSTYPE {
|
|||
extern YYSTYPE parser_lval;
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -586,6 +586,8 @@ char *yytext;
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -621,6 +623,19 @@ struct {
|
|||
} import_stack[MAX_IMPORT_DEPTH];
|
||||
int import_stack_ptr = 0;
|
||||
|
||||
/* converts an integer in string form to an unsigned long and prints an error
|
||||
* on overflow */
|
||||
static unsigned long xstrtoul(const char *nptr, char **endptr, int base)
|
||||
{
|
||||
unsigned long l;
|
||||
|
||||
errno = 0;
|
||||
l = strtoul(nptr, endptr, base);
|
||||
if (l == ULONG_MAX && errno == ERANGE)
|
||||
error_loc("integer constant %s is too large\n", nptr);
|
||||
return l;
|
||||
}
|
||||
|
||||
UUID *parse_uuid(const char *u)
|
||||
{
|
||||
UUID* uuid = xmalloc(sizeof(UUID));
|
||||
|
@ -646,7 +661,7 @@ UUID *parse_uuid(const char *u)
|
|||
* The flexer starts here
|
||||
**************************************************************************
|
||||
*/
|
||||
#line 650 "parser.yy.c"
|
||||
#line 665 "parser.yy.c"
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
|
@ -800,9 +815,9 @@ YY_DECL
|
|||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 112 "parser.l"
|
||||
#line 127 "parser.l"
|
||||
|
||||
#line 806 "parser.yy.c"
|
||||
#line 821 "parser.yy.c"
|
||||
|
||||
if ( yy_init )
|
||||
{
|
||||
|
@ -888,12 +903,12 @@ do_action: /* This label is used only to access EOF actions. */
|
|||
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 113 "parser.l"
|
||||
#line 128 "parser.l"
|
||||
yy_push_state(PP_LINE);
|
||||
YY_BREAK
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 114 "parser.l"
|
||||
#line 129 "parser.l"
|
||||
{
|
||||
int lineno;
|
||||
char *cptr, *fname;
|
||||
|
@ -916,12 +931,12 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 133 "parser.l"
|
||||
#line 148 "parser.l"
|
||||
yy_push_state(QUOTE); cbufidx = 0;
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 134 "parser.l"
|
||||
#line 149 "parser.l"
|
||||
{
|
||||
yy_pop_state();
|
||||
parser_lval.str = get_buffered_cstring();
|
||||
|
@ -930,12 +945,12 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 139 "parser.l"
|
||||
#line 154 "parser.l"
|
||||
yy_push_state(WSTRQUOTE);
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 140 "parser.l"
|
||||
#line 155 "parser.l"
|
||||
{
|
||||
yy_pop_state();
|
||||
parser_lval.str = get_buffered_cstring();
|
||||
|
@ -943,40 +958,40 @@ YY_RULE_SETUP
|
|||
}
|
||||
YY_BREAK
|
||||
case 7:
|
||||
#line 146 "parser.l"
|
||||
#line 161 "parser.l"
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 146 "parser.l"
|
||||
#line 161 "parser.l"
|
||||
addcchar(yytext[1]);
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 147 "parser.l"
|
||||
#line 162 "parser.l"
|
||||
addcchar('\\'); addcchar(yytext[1]);
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 148 "parser.l"
|
||||
#line 163 "parser.l"
|
||||
addcchar(yytext[0]);
|
||||
YY_BREAK
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 149 "parser.l"
|
||||
#line 164 "parser.l"
|
||||
yy_push_state(ATTR); return '[';
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 150 "parser.l"
|
||||
#line 165 "parser.l"
|
||||
yy_pop_state(); return ']';
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 151 "parser.l"
|
||||
#line 166 "parser.l"
|
||||
return attr_token(yytext);
|
||||
YY_BREAK
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 152 "parser.l"
|
||||
#line 167 "parser.l"
|
||||
{
|
||||
parser_lval.uuid = parse_uuid(yytext);
|
||||
return aUUID;
|
||||
|
@ -984,23 +999,23 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
#line 156 "parser.l"
|
||||
#line 171 "parser.l"
|
||||
{
|
||||
parser_lval.num = strtoul(yytext, NULL, 0);
|
||||
parser_lval.num = xstrtoul(yytext, NULL, 0);
|
||||
return aHEXNUM;
|
||||
}
|
||||
YY_BREAK
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 160 "parser.l"
|
||||
#line 175 "parser.l"
|
||||
{
|
||||
parser_lval.num = strtoul(yytext, NULL, 0);
|
||||
parser_lval.num = xstrtoul(yytext, NULL, 0);
|
||||
return aNUM;
|
||||
}
|
||||
YY_BREAK
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 164 "parser.l"
|
||||
#line 179 "parser.l"
|
||||
{
|
||||
parser_lval.dbl = strtod(yytext, NULL);
|
||||
return aDOUBLE;
|
||||
|
@ -1011,72 +1026,72 @@ case 18:
|
|||
yy_c_buf_p = yy_cp -= 1;
|
||||
YY_DO_BEFORE_ACTION; /* set up yytext again */
|
||||
YY_RULE_SETUP
|
||||
#line 168 "parser.l"
|
||||
#line 183 "parser.l"
|
||||
return tSAFEARRAY;
|
||||
YY_BREAK
|
||||
case 19:
|
||||
YY_RULE_SETUP
|
||||
#line 169 "parser.l"
|
||||
#line 184 "parser.l"
|
||||
return kw_token(yytext);
|
||||
YY_BREAK
|
||||
case 20:
|
||||
YY_RULE_SETUP
|
||||
#line 170 "parser.l"
|
||||
#line 185 "parser.l"
|
||||
line_number++;
|
||||
YY_BREAK
|
||||
case 21:
|
||||
YY_RULE_SETUP
|
||||
#line 171 "parser.l"
|
||||
#line 186 "parser.l"
|
||||
|
||||
YY_BREAK
|
||||
case 22:
|
||||
YY_RULE_SETUP
|
||||
#line 172 "parser.l"
|
||||
#line 187 "parser.l"
|
||||
return SHL;
|
||||
YY_BREAK
|
||||
case 23:
|
||||
YY_RULE_SETUP
|
||||
#line 173 "parser.l"
|
||||
#line 188 "parser.l"
|
||||
return SHR;
|
||||
YY_BREAK
|
||||
case 24:
|
||||
YY_RULE_SETUP
|
||||
#line 174 "parser.l"
|
||||
#line 189 "parser.l"
|
||||
return MEMBERPTR;
|
||||
YY_BREAK
|
||||
case 25:
|
||||
YY_RULE_SETUP
|
||||
#line 175 "parser.l"
|
||||
#line 190 "parser.l"
|
||||
return EQUALITY;
|
||||
YY_BREAK
|
||||
case 26:
|
||||
YY_RULE_SETUP
|
||||
#line 176 "parser.l"
|
||||
#line 191 "parser.l"
|
||||
return INEQUALITY;
|
||||
YY_BREAK
|
||||
case 27:
|
||||
YY_RULE_SETUP
|
||||
#line 177 "parser.l"
|
||||
#line 192 "parser.l"
|
||||
return GREATEREQUAL;
|
||||
YY_BREAK
|
||||
case 28:
|
||||
YY_RULE_SETUP
|
||||
#line 178 "parser.l"
|
||||
#line 193 "parser.l"
|
||||
return LESSEQUAL;
|
||||
YY_BREAK
|
||||
case 29:
|
||||
YY_RULE_SETUP
|
||||
#line 179 "parser.l"
|
||||
#line 194 "parser.l"
|
||||
return LOGICALOR;
|
||||
YY_BREAK
|
||||
case 30:
|
||||
YY_RULE_SETUP
|
||||
#line 180 "parser.l"
|
||||
#line 195 "parser.l"
|
||||
return LOGICALAND;
|
||||
YY_BREAK
|
||||
case 31:
|
||||
YY_RULE_SETUP
|
||||
#line 181 "parser.l"
|
||||
#line 196 "parser.l"
|
||||
return yytext[0];
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
|
@ -1084,7 +1099,7 @@ case YY_STATE_EOF(QUOTE):
|
|||
case YY_STATE_EOF(WSTRQUOTE):
|
||||
case YY_STATE_EOF(ATTR):
|
||||
case YY_STATE_EOF(PP_LINE):
|
||||
#line 182 "parser.l"
|
||||
#line 197 "parser.l"
|
||||
{
|
||||
if (import_stack_ptr)
|
||||
return aEOF;
|
||||
|
@ -1093,10 +1108,10 @@ case YY_STATE_EOF(PP_LINE):
|
|||
YY_BREAK
|
||||
case 32:
|
||||
YY_RULE_SETUP
|
||||
#line 187 "parser.l"
|
||||
#line 202 "parser.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 1100 "parser.yy.c"
|
||||
#line 1115 "parser.yy.c"
|
||||
|
||||
case YY_END_OF_BUFFER:
|
||||
{
|
||||
|
@ -1982,7 +1997,7 @@ int main()
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
#line 187 "parser.l"
|
||||
#line 202 "parser.l"
|
||||
|
||||
|
||||
#ifndef parser_wrap
|
||||
|
@ -2043,7 +2058,7 @@ static const struct keyword keywords[] = {
|
|||
{"short", tSHORT},
|
||||
{"signed", tSIGNED},
|
||||
{"sizeof", tSIZEOF},
|
||||
{"small", tSMALL},
|
||||
{"small", tSMALL},
|
||||
{"static", tSTATIC},
|
||||
{"stdcall", tSTDCALL},
|
||||
{"struct", tSTRUCT},
|
||||
|
|
|
@ -109,8 +109,24 @@ static void init_proxy(const statement_list_t *stmts)
|
|||
print_proxy( "\n");
|
||||
print_proxy( "#include \"%s\"\n", header_name);
|
||||
print_proxy( "\n");
|
||||
write_formatstringsdecl(proxy, indent, stmts, need_proxy);
|
||||
write_stubdescproto();
|
||||
print_proxy( "#ifndef DECLSPEC_HIDDEN\n");
|
||||
print_proxy( "#define DECLSPEC_HIDDEN\n");
|
||||
print_proxy( "#endif\n");
|
||||
print_proxy( "\n");
|
||||
write_exceptions( proxy );
|
||||
print_proxy( "\n");
|
||||
print_proxy( "struct __proxy_frame\n");
|
||||
print_proxy( "{\n");
|
||||
print_proxy( " __DECL_EXCEPTION_FRAME\n");
|
||||
print_proxy( " MIDL_STUB_MESSAGE _StubMsg;\n");
|
||||
print_proxy( " void *This;\n");
|
||||
print_proxy( "};\n");
|
||||
print_proxy( "\n");
|
||||
print_proxy("static int __proxy_filter( struct __proxy_frame *__frame )\n");
|
||||
print_proxy( "{\n");
|
||||
print_proxy( " return (__frame->_StubMsg.dwStubPhase != PROXY_SENDRECEIVE);\n");
|
||||
print_proxy( "}\n");
|
||||
print_proxy( "\n");
|
||||
}
|
||||
|
||||
static void clear_output_vars( const var_list_t *args )
|
||||
|
@ -145,6 +161,9 @@ int cant_be_null(const var_t *v)
|
|||
if (is_aliaschain_attr(type, ATTR_CONTEXTHANDLE))
|
||||
return 0;
|
||||
|
||||
if (is_user_type(type))
|
||||
return 0;
|
||||
|
||||
if (! attrs && type)
|
||||
{
|
||||
attrs = type->attrs;
|
||||
|
@ -173,6 +192,29 @@ int cant_be_null(const var_t *v)
|
|||
return 1; /* Default is RPC_FC_RP. */
|
||||
}
|
||||
|
||||
static int need_delegation(const type_t *iface)
|
||||
{
|
||||
return iface->ref && iface->ref->ref && iface->ref->ignore;
|
||||
}
|
||||
|
||||
static int get_delegation_indirect(const type_t *iface, const type_t ** delegate_to)
|
||||
{
|
||||
const type_t * cur_iface;
|
||||
for (cur_iface = iface; cur_iface != NULL; cur_iface = cur_iface->ref)
|
||||
if (need_delegation(cur_iface))
|
||||
{
|
||||
if(delegate_to)
|
||||
*delegate_to = cur_iface->ref;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int need_delegation_indirect(const type_t *iface)
|
||||
{
|
||||
return get_delegation_indirect(iface, NULL);
|
||||
}
|
||||
|
||||
static void proxy_check_pointers( const var_list_t *args )
|
||||
{
|
||||
const var_t *arg;
|
||||
|
@ -189,7 +231,7 @@ static void proxy_check_pointers( const var_list_t *args )
|
|||
}
|
||||
}
|
||||
|
||||
static void free_variable( const var_t *arg )
|
||||
static void free_variable( const var_t *arg, const char *local_var_prefix )
|
||||
{
|
||||
unsigned int type_offset = arg->type->typestring_offset;
|
||||
expr_t *iid;
|
||||
|
@ -198,10 +240,10 @@ static void free_variable( const var_t *arg )
|
|||
|
||||
if (size)
|
||||
{
|
||||
print_proxy( "_StubMsg.MaxCount = " );
|
||||
write_expr(proxy, size, 0, 1, NULL, NULL);
|
||||
print_proxy( "__frame->_StubMsg.MaxCount = " );
|
||||
write_expr(proxy, size, 0, 1, NULL, NULL, local_var_prefix);
|
||||
fprintf(proxy, ";\n\n");
|
||||
print_proxy( "NdrClearOutParameters( &_StubMsg, ");
|
||||
print_proxy( "NdrClearOutParameters( &__frame->_StubMsg, ");
|
||||
fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
|
||||
fprintf(proxy, "(void*)%s );\n", arg->name );
|
||||
return;
|
||||
|
@ -226,11 +268,11 @@ static void free_variable( const var_t *arg )
|
|||
iid = get_attrp( arg->attrs, ATTR_IIDIS );
|
||||
if( iid )
|
||||
{
|
||||
print_proxy( "_StubMsg.MaxCount = (unsigned long) " );
|
||||
write_expr(proxy, iid, 1, 1, NULL, NULL);
|
||||
print_proxy( "__frame->_StubMsg.MaxCount = (ULONG_PTR) " );
|
||||
write_expr(proxy, iid, 1, 1, NULL, NULL, local_var_prefix);
|
||||
print_proxy( ";\n\n" );
|
||||
}
|
||||
print_proxy( "NdrClearOutParameters( &_StubMsg, ");
|
||||
print_proxy( "NdrClearOutParameters( &__frame->_StubMsg, ");
|
||||
fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset );
|
||||
fprintf(proxy, "(void*)%s );\n", arg->name );
|
||||
break;
|
||||
|
@ -240,7 +282,7 @@ static void free_variable( const var_t *arg )
|
|||
}
|
||||
}
|
||||
|
||||
static void proxy_free_variables( var_list_t *args )
|
||||
static void proxy_free_variables( var_list_t *args, const char *local_var_prefix )
|
||||
{
|
||||
const var_t *arg;
|
||||
|
||||
|
@ -248,7 +290,7 @@ static void proxy_free_variables( var_list_t *args )
|
|||
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
|
||||
if (is_attr(arg->attrs, ATTR_OUT))
|
||||
{
|
||||
free_variable( arg );
|
||||
free_variable( arg, local_var_prefix );
|
||||
fprintf(proxy, "\n");
|
||||
}
|
||||
}
|
||||
|
@ -263,12 +305,23 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
|
|||
if (!callconv) callconv = "";
|
||||
|
||||
indent = 0;
|
||||
print_proxy( "static void __finally_%s_%s_Proxy( struct __proxy_frame *__frame )\n",
|
||||
iface->name, get_name(def) );
|
||||
print_proxy( "{\n");
|
||||
indent++;
|
||||
if (has_full_pointer) write_full_pointer_free(proxy, indent, cur);
|
||||
print_proxy( "NdrProxyFreeBuffer( __frame->This, &__frame->_StubMsg );\n" );
|
||||
indent--;
|
||||
print_proxy( "}\n");
|
||||
print_proxy( "\n");
|
||||
|
||||
write_type_decl_left(proxy, get_func_return_type(cur));
|
||||
print_proxy( " %s %s_%s_Proxy(\n", callconv, iface->name, get_name(def));
|
||||
write_args(proxy, cur->args, iface->name, 1, TRUE);
|
||||
print_proxy( ")\n");
|
||||
print_proxy( "{\n");
|
||||
indent ++;
|
||||
print_proxy( "struct __proxy_frame __f, * const __frame = &__f;\n" );
|
||||
/* local variables */
|
||||
if (has_ret) {
|
||||
print_proxy( "" );
|
||||
|
@ -281,7 +334,6 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
|
|||
print_proxy(" _RetVal = 0;\n");
|
||||
}
|
||||
print_proxy( "RPC_MESSAGE _RpcMessage;\n" );
|
||||
print_proxy( "MIDL_STUB_MESSAGE _StubMsg;\n" );
|
||||
if (has_ret) {
|
||||
if (decl_indirect(get_func_return_type(cur)))
|
||||
print_proxy("void *_p_%s = &%s;\n",
|
||||
|
@ -289,6 +341,9 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
|
|||
}
|
||||
print_proxy( "\n");
|
||||
|
||||
print_proxy( "RpcExceptionInit( __proxy_filter, __finally_%s_%s_Proxy );\n", iface->name, get_name(def) );
|
||||
print_proxy( "__frame->This = This;\n" );
|
||||
|
||||
if (has_full_pointer)
|
||||
write_full_pointer_init(proxy, indent, cur, FALSE);
|
||||
|
||||
|
@ -298,31 +353,31 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
|
|||
print_proxy( "RpcTryExcept\n" );
|
||||
print_proxy( "{\n" );
|
||||
indent++;
|
||||
print_proxy( "NdrProxyInitialize(This, &_RpcMessage, &_StubMsg, &Object_StubDesc, %d);\n", idx);
|
||||
print_proxy( "NdrProxyInitialize(This, &_RpcMessage, &__frame->_StubMsg, &Object_StubDesc, %d);\n", idx);
|
||||
proxy_check_pointers( cur->args );
|
||||
|
||||
print_proxy( "RpcTryFinally\n" );
|
||||
print_proxy( "{\n" );
|
||||
indent++;
|
||||
|
||||
write_remoting_arguments(proxy, indent, cur, PASS_IN, PHASE_BUFFERSIZE);
|
||||
write_remoting_arguments(proxy, indent, cur, "", PASS_IN, PHASE_BUFFERSIZE);
|
||||
|
||||
print_proxy( "NdrProxyGetBuffer(This, &_StubMsg);\n" );
|
||||
print_proxy( "NdrProxyGetBuffer(This, &__frame->_StubMsg);\n" );
|
||||
|
||||
write_remoting_arguments(proxy, indent, cur, PASS_IN, PHASE_MARSHAL);
|
||||
write_remoting_arguments(proxy, indent, cur, "", PASS_IN, PHASE_MARSHAL);
|
||||
|
||||
print_proxy( "NdrProxySendReceive(This, &_StubMsg);\n" );
|
||||
print_proxy( "NdrProxySendReceive(This, &__frame->_StubMsg);\n" );
|
||||
fprintf(proxy, "\n");
|
||||
print_proxy( "_StubMsg.BufferStart = _RpcMessage.Buffer;\n" );
|
||||
print_proxy( "_StubMsg.BufferEnd = _StubMsg.BufferStart + _RpcMessage.BufferLength;\n\n" );
|
||||
print_proxy( "__frame->_StubMsg.BufferStart = _RpcMessage.Buffer;\n" );
|
||||
print_proxy( "__frame->_StubMsg.BufferEnd = __frame->_StubMsg.BufferStart + _RpcMessage.BufferLength;\n\n" );
|
||||
|
||||
print_proxy("if ((_RpcMessage.DataRepresentation & 0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n");
|
||||
indent++;
|
||||
print_proxy("NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[%u]);\n", proc_offset );
|
||||
print_proxy("NdrConvert( &__frame->_StubMsg, &__MIDL_ProcFormatString.Format[%u]);\n", proc_offset );
|
||||
indent--;
|
||||
fprintf(proxy, "\n");
|
||||
|
||||
write_remoting_arguments(proxy, indent, cur, PASS_OUT, PHASE_UNMARSHAL);
|
||||
write_remoting_arguments(proxy, indent, cur, "", PASS_OUT, PHASE_UNMARSHAL);
|
||||
|
||||
if (has_ret)
|
||||
{
|
||||
|
@ -330,7 +385,7 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
|
|||
print_proxy("MIDL_memset(&%s, 0, sizeof(%s));\n", "_RetVal", "_RetVal");
|
||||
else if (is_ptr(get_func_return_type(cur)) || is_array(get_func_return_type(cur)))
|
||||
print_proxy("%s = 0;\n", "_RetVal");
|
||||
write_remoting_arguments(proxy, indent, cur, PASS_RETURN, PHASE_UNMARSHAL);
|
||||
write_remoting_arguments(proxy, indent, cur, "", PASS_RETURN, PHASE_UNMARSHAL);
|
||||
}
|
||||
|
||||
indent--;
|
||||
|
@ -338,19 +393,17 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx,
|
|||
print_proxy( "RpcFinally\n" );
|
||||
print_proxy( "{\n" );
|
||||
indent++;
|
||||
if (has_full_pointer)
|
||||
write_full_pointer_free(proxy, indent, cur);
|
||||
print_proxy( "NdrProxyFreeBuffer(This, &_StubMsg);\n" );
|
||||
print_proxy( "__finally_%s_%s_Proxy( __frame );\n", iface->name, get_name(def) );
|
||||
indent--;
|
||||
print_proxy( "}\n");
|
||||
print_proxy( "RpcEndFinally\n" );
|
||||
indent--;
|
||||
print_proxy( "}\n" );
|
||||
print_proxy( "RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)\n" );
|
||||
print_proxy( "RpcExcept(__frame->_StubMsg.dwStubPhase != PROXY_SENDRECEIVE)\n" );
|
||||
print_proxy( "{\n" );
|
||||
if (has_ret) {
|
||||
indent++;
|
||||
proxy_free_variables( cur->args );
|
||||
proxy_free_variables( cur->args, "" );
|
||||
print_proxy( "_RetVal = NdrProxyErrorHandler(RpcExceptionCode());\n" );
|
||||
indent--;
|
||||
}
|
||||
|
@ -374,6 +427,24 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
|
|||
int has_full_pointer = is_full_pointer_function(cur);
|
||||
|
||||
indent = 0;
|
||||
print_proxy( "struct __frame_%s_%s_Stub\n{\n", iface->name, get_name(def));
|
||||
indent++;
|
||||
print_proxy( "__DECL_EXCEPTION_FRAME\n" );
|
||||
print_proxy( "MIDL_STUB_MESSAGE _StubMsg;\n");
|
||||
print_proxy( "%s * _This;\n", iface->name );
|
||||
declare_stub_args( proxy, indent, cur );
|
||||
indent--;
|
||||
print_proxy( "};\n\n" );
|
||||
|
||||
print_proxy( "static void __finally_%s_%s_Stub(", iface->name, get_name(def) );
|
||||
print_proxy( " struct __frame_%s_%s_Stub *__frame )\n{\n", iface->name, get_name(def) );
|
||||
indent++;
|
||||
write_remoting_arguments(proxy, indent, cur, "__frame->", PASS_OUT, PHASE_FREE);
|
||||
if (has_full_pointer)
|
||||
write_full_pointer_free(proxy, indent, cur);
|
||||
indent--;
|
||||
print_proxy( "}\n\n" );
|
||||
|
||||
print_proxy( "void __RPC_STUB %s_%s_Stub(\n", iface->name, get_name(def));
|
||||
indent++;
|
||||
print_proxy( "IRpcStubBuffer* This,\n");
|
||||
|
@ -383,17 +454,18 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
|
|||
indent--;
|
||||
print_proxy( "{\n");
|
||||
indent++;
|
||||
print_proxy("%s * _This = (%s*)((CStdStubBuffer*)This)->pvServerObject;\n", iface->name, iface->name);
|
||||
print_proxy("MIDL_STUB_MESSAGE _StubMsg;\n");
|
||||
declare_stub_args( proxy, indent, cur );
|
||||
fprintf(proxy, "\n");
|
||||
print_proxy( "struct __frame_%s_%s_Stub __f, * const __frame = &__f;\n\n",
|
||||
iface->name, get_name(def) );
|
||||
|
||||
print_proxy("__frame->_This = (%s*)((CStdStubBuffer*)This)->pvServerObject;\n\n", iface->name);
|
||||
|
||||
/* FIXME: trace */
|
||||
|
||||
print_proxy("NdrStubInitialize(_pRpcMessage, &_StubMsg, &Object_StubDesc, _pRpcChannelBuffer);\n");
|
||||
print_proxy("NdrStubInitialize(_pRpcMessage, &__frame->_StubMsg, &Object_StubDesc, _pRpcChannelBuffer);\n");
|
||||
fprintf(proxy, "\n");
|
||||
print_proxy( "RpcExceptionInit( 0, __finally_%s_%s_Stub );\n", iface->name, get_name(def) );
|
||||
|
||||
write_parameters_init(proxy, indent, cur);
|
||||
write_parameters_init(proxy, indent, cur, "__frame->");
|
||||
|
||||
print_proxy("RpcTryFinally\n");
|
||||
print_proxy("{\n");
|
||||
|
@ -402,73 +474,82 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas,
|
|||
write_full_pointer_init(proxy, indent, cur, TRUE);
|
||||
print_proxy("if ((_pRpcMessage->DataRepresentation & 0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n");
|
||||
indent++;
|
||||
print_proxy("NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[%u]);\n", proc_offset );
|
||||
print_proxy("NdrConvert( &__frame->_StubMsg, &__MIDL_ProcFormatString.Format[%u]);\n", proc_offset );
|
||||
indent--;
|
||||
fprintf(proxy, "\n");
|
||||
|
||||
write_remoting_arguments(proxy, indent, cur, PASS_IN, PHASE_UNMARSHAL);
|
||||
write_remoting_arguments(proxy, indent, cur, "__frame->", PASS_IN, PHASE_UNMARSHAL);
|
||||
fprintf(proxy, "\n");
|
||||
|
||||
assign_stub_out_args( proxy, indent, cur );
|
||||
assign_stub_out_args( proxy, indent, cur, "__frame->" );
|
||||
|
||||
print_proxy("*_pdwStubPhase = STUB_CALL_SERVER;\n");
|
||||
fprintf(proxy, "\n");
|
||||
print_proxy("");
|
||||
if (has_ret) fprintf(proxy, "_RetVal = ");
|
||||
if (has_ret) fprintf(proxy, "__frame->_RetVal = ");
|
||||
if (cas) fprintf(proxy, "%s_%s_Stub", iface->name, cas);
|
||||
else fprintf(proxy, "_This->lpVtbl->%s", get_name(def));
|
||||
fprintf(proxy, "(_This");
|
||||
else fprintf(proxy, "__frame->_This->lpVtbl->%s", get_name(def));
|
||||
fprintf(proxy, "(__frame->_This");
|
||||
|
||||
if (cur->args)
|
||||
{
|
||||
LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry )
|
||||
fprintf(proxy, ", %s%s", arg->type->declarray ? "*" : "", get_name(arg));
|
||||
fprintf(proxy, ", %s__frame->%s", arg->type->declarray ? "*" : "", arg->name);
|
||||
}
|
||||
fprintf(proxy, ");\n");
|
||||
fprintf(proxy, "\n");
|
||||
print_proxy("*_pdwStubPhase = STUB_MARSHAL;\n");
|
||||
fprintf(proxy, "\n");
|
||||
|
||||
write_remoting_arguments(proxy, indent, cur, PASS_OUT, PHASE_BUFFERSIZE);
|
||||
write_remoting_arguments(proxy, indent, cur, "__frame->", PASS_OUT, PHASE_BUFFERSIZE);
|
||||
|
||||
if (!is_void(get_func_return_type(cur)))
|
||||
write_remoting_arguments(proxy, indent, cur, PASS_RETURN, PHASE_BUFFERSIZE);
|
||||
write_remoting_arguments(proxy, indent, cur, "__frame->", PASS_RETURN, PHASE_BUFFERSIZE);
|
||||
|
||||
print_proxy("NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg);\n");
|
||||
print_proxy("NdrStubGetBuffer(This, _pRpcChannelBuffer, &__frame->_StubMsg);\n");
|
||||
|
||||
write_remoting_arguments(proxy, indent, cur, PASS_OUT, PHASE_MARSHAL);
|
||||
write_remoting_arguments(proxy, indent, cur, "__frame->", PASS_OUT, PHASE_MARSHAL);
|
||||
fprintf(proxy, "\n");
|
||||
|
||||
/* marshall the return value */
|
||||
if (!is_void(get_func_return_type(cur)))
|
||||
write_remoting_arguments(proxy, indent, cur, PASS_RETURN, PHASE_MARSHAL);
|
||||
write_remoting_arguments(proxy, indent, cur, "__frame->", PASS_RETURN, PHASE_MARSHAL);
|
||||
|
||||
indent--;
|
||||
print_proxy("}\n");
|
||||
print_proxy("RpcFinally\n");
|
||||
print_proxy("{\n");
|
||||
|
||||
write_remoting_arguments(proxy, indent+1, cur, PASS_OUT, PHASE_FREE);
|
||||
|
||||
if (has_full_pointer)
|
||||
write_full_pointer_free(proxy, indent, cur);
|
||||
|
||||
indent++;
|
||||
print_proxy( "__finally_%s_%s_Stub( __frame );\n", iface->name, get_name(def) );
|
||||
indent--;
|
||||
print_proxy("}\n");
|
||||
print_proxy("RpcEndFinally\n");
|
||||
|
||||
print_proxy("_pRpcMessage->BufferLength = _StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer;\n");
|
||||
print_proxy("_pRpcMessage->BufferLength = __frame->_StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer;\n");
|
||||
indent--;
|
||||
|
||||
print_proxy("}\n");
|
||||
print_proxy("\n");
|
||||
}
|
||||
|
||||
static int count_methods(type_t *iface)
|
||||
{
|
||||
const func_t *cur;
|
||||
int count = 0;
|
||||
|
||||
if (iface->ref) count = count_methods(iface->ref);
|
||||
if (iface->funcs)
|
||||
LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry )
|
||||
if (!is_callas(cur->def->attrs)) count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
static int write_proxy_methods(type_t *iface, int skip)
|
||||
{
|
||||
const func_t *cur;
|
||||
int i = 0;
|
||||
|
||||
if (iface->ref) i = write_proxy_methods(iface->ref, iface->ref->ref != NULL);
|
||||
if (iface->ref) i = write_proxy_methods(iface->ref, need_delegation(iface));
|
||||
if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) {
|
||||
var_t *def = cur->def;
|
||||
if (!is_callas(def->attrs)) {
|
||||
|
@ -486,7 +567,7 @@ static int write_stub_methods(type_t *iface, int skip)
|
|||
const func_t *cur;
|
||||
int i = 0;
|
||||
|
||||
if (iface->ref) i = write_stub_methods(iface->ref, TRUE);
|
||||
if (iface->ref) i = write_stub_methods(iface->ref, need_delegation(iface));
|
||||
else return i; /* skip IUnknown */
|
||||
|
||||
if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) {
|
||||
|
@ -503,17 +584,15 @@ static int write_stub_methods(type_t *iface, int skip)
|
|||
|
||||
static void write_proxy(type_t *iface, unsigned int *proc_offset)
|
||||
{
|
||||
int midx = -1, stubs;
|
||||
int midx = -1, count;
|
||||
const func_t *cur;
|
||||
|
||||
if (!iface->funcs) return;
|
||||
|
||||
/* FIXME: check for [oleautomation], shouldn't generate proxies/stubs if specified */
|
||||
|
||||
fprintf(proxy, "/*****************************************************************************\n");
|
||||
fprintf(proxy, " * %s interface\n", iface->name);
|
||||
fprintf(proxy, " */\n");
|
||||
LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry )
|
||||
if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry )
|
||||
{
|
||||
const var_t *def = cur->def;
|
||||
if (!is_local(def->attrs)) {
|
||||
|
@ -538,8 +617,11 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
|
|||
}
|
||||
}
|
||||
|
||||
count = count_methods(iface);
|
||||
if (midx != -1 && midx != count) error("invalid count %u/%u\n", count, midx);
|
||||
|
||||
/* proxy vtable */
|
||||
print_proxy( "static const CINTERFACE_PROXY_VTABLE(%d) _%sProxyVtbl =\n", midx, iface->name);
|
||||
print_proxy( "static const CINTERFACE_PROXY_VTABLE(%d) _%sProxyVtbl =\n", count, iface->name);
|
||||
print_proxy( "{\n");
|
||||
indent++;
|
||||
print_proxy( "{\n", iface->name);
|
||||
|
@ -561,25 +643,26 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
|
|||
print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name);
|
||||
print_proxy( "{\n");
|
||||
indent++;
|
||||
stubs = write_stub_methods(iface, FALSE);
|
||||
write_stub_methods(iface, FALSE);
|
||||
fprintf(proxy, "\n");
|
||||
indent--;
|
||||
fprintf(proxy, "};\n");
|
||||
print_proxy( "\n");
|
||||
print_proxy( "static const CInterfaceStubVtbl _%sStubVtbl =\n", iface->name);
|
||||
print_proxy( "static %sCInterfaceStubVtbl _%sStubVtbl =\n",
|
||||
need_delegation_indirect(iface) ? "" : "const ", iface->name);
|
||||
print_proxy( "{\n");
|
||||
indent++;
|
||||
print_proxy( "{\n");
|
||||
indent++;
|
||||
print_proxy( "&IID_%s,\n", iface->name);
|
||||
print_proxy( "0,\n");
|
||||
print_proxy( "%d,\n", stubs+3);
|
||||
print_proxy( "%d,\n", count);
|
||||
print_proxy( "&%s_table[-3],\n", iface->name);
|
||||
indent--;
|
||||
print_proxy( "},\n", iface->name);
|
||||
print_proxy( "{\n");
|
||||
indent++;
|
||||
print_proxy( "CStdStubBuffer_METHODS\n");
|
||||
print_proxy( "CStdStubBuffer_%s\n", need_delegation_indirect(iface) ? "DELEGATING_METHODS" : "METHODS");
|
||||
indent--;
|
||||
print_proxy( "}\n");
|
||||
indent--;
|
||||
|
@ -644,58 +727,53 @@ static void write_proxy_stmts(const statement_list_t *stmts, unsigned int *proc_
|
|||
}
|
||||
}
|
||||
|
||||
static void write_proxy_iface_name_format(const statement_list_t *stmts, const char *format)
|
||||
static int cmp_iid( const void *ptr1, const void *ptr2 )
|
||||
{
|
||||
const statement_t *stmt;
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
if (stmt->type == STMT_LIBRARY)
|
||||
write_proxy_iface_name_format(stmt->u.lib->stmts, format);
|
||||
else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP)
|
||||
{
|
||||
type_t *iface = stmt->u.type;
|
||||
if (iface->ref && iface->funcs && need_proxy(iface))
|
||||
fprintf(proxy, format, iface->name);
|
||||
}
|
||||
}
|
||||
const type_t * const *iface1 = ptr1;
|
||||
const type_t * const *iface2 = ptr2;
|
||||
const UUID *uuid1 = get_attrp( (*iface1)->attrs, ATTR_UUID );
|
||||
const UUID *uuid2 = get_attrp( (*iface2)->attrs, ATTR_UUID );
|
||||
return memcmp( uuid1, uuid2, sizeof(UUID) );
|
||||
}
|
||||
|
||||
static void write_iid_lookup(const statement_list_t *stmts, const char *file_id, int *c)
|
||||
static void build_iface_list( const statement_list_t *stmts, type_t **ifaces[], int *count )
|
||||
{
|
||||
const statement_t *stmt;
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
if (stmt->type == STMT_LIBRARY)
|
||||
write_iid_lookup(stmt->u.lib->stmts, file_id, c);
|
||||
else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP)
|
||||
const statement_t *stmt;
|
||||
|
||||
if (!stmts) return;
|
||||
LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
type_t *iface = stmt->u.type;
|
||||
if(iface->ref && iface->funcs && need_proxy(iface))
|
||||
{
|
||||
fprintf(proxy, " if (!_%s_CHECK_IID(%d))\n", file_id, *c);
|
||||
fprintf(proxy, " {\n");
|
||||
fprintf(proxy, " *pIndex = %d;\n", *c);
|
||||
fprintf(proxy, " return 1;\n");
|
||||
fprintf(proxy, " }\n");
|
||||
(*c)++;
|
||||
}
|
||||
if (stmt->type == STMT_LIBRARY)
|
||||
build_iface_list(stmt->u.lib->stmts, ifaces, count);
|
||||
else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP)
|
||||
{
|
||||
type_t *iface = stmt->u.type;
|
||||
if (iface->ref && need_proxy(iface))
|
||||
{
|
||||
*ifaces = xrealloc( *ifaces, (*count + 1) * sizeof(*ifaces) );
|
||||
(*ifaces)[(*count)++] = iface;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void write_proxies(const statement_list_t *stmts)
|
||||
static type_t **sort_interfaces( const statement_list_t *stmts, int *count )
|
||||
{
|
||||
type_t **ifaces = NULL;
|
||||
|
||||
*count = 0;
|
||||
build_iface_list( stmts, &ifaces, count );
|
||||
qsort( ifaces, *count, sizeof(*ifaces), cmp_iid );
|
||||
return ifaces;
|
||||
}
|
||||
|
||||
static void write_proxy_routines(const statement_list_t *stmts)
|
||||
{
|
||||
int expr_eval_routines;
|
||||
char *file_id = proxy_token;
|
||||
int c;
|
||||
unsigned int proc_offset = 0;
|
||||
|
||||
if (!do_proxies) return;
|
||||
if (do_everything && !need_proxy_file(stmts)) return;
|
||||
|
||||
init_proxy(stmts);
|
||||
if(!proxy) return;
|
||||
|
||||
write_formatstringsdecl(proxy, indent, stmts, need_proxy);
|
||||
write_stubdescproto();
|
||||
write_proxy_stmts(stmts, &proc_offset);
|
||||
|
||||
expr_eval_routines = write_expr_eval_routines(proxy, proxy_token);
|
||||
|
@ -704,52 +782,115 @@ void write_proxies(const statement_list_t *stmts)
|
|||
write_user_quad_list(proxy);
|
||||
write_stubdesc(expr_eval_routines);
|
||||
|
||||
print_proxy( "#if !defined(__RPC_WIN32__)\n");
|
||||
print_proxy( "#if !defined(__RPC_WIN%u__)\n", pointer_size == 8 ? 64 : 32);
|
||||
print_proxy( "#error Currently only Wine and WIN32 are supported.\n");
|
||||
print_proxy( "#endif\n");
|
||||
print_proxy( "\n");
|
||||
write_procformatstring(proxy, stmts, need_proxy);
|
||||
write_typeformatstring(proxy, stmts, need_proxy);
|
||||
|
||||
}
|
||||
|
||||
void write_proxies(const statement_list_t *stmts)
|
||||
{
|
||||
char *file_id = proxy_token;
|
||||
int i, count, have_baseiid;
|
||||
type_t **interfaces;
|
||||
const type_t * delegate_to;
|
||||
|
||||
if (!do_proxies) return;
|
||||
if (do_everything && !need_proxy_file(stmts)) return;
|
||||
|
||||
init_proxy(stmts);
|
||||
if(!proxy) return;
|
||||
|
||||
if (do_win32 && do_win64)
|
||||
{
|
||||
fprintf(proxy, "\n#ifndef _WIN64\n\n");
|
||||
pointer_size = 4;
|
||||
write_proxy_routines( stmts );
|
||||
fprintf(proxy, "\n#else /* _WIN64 */\n\n");
|
||||
pointer_size = 8;
|
||||
write_proxy_routines( stmts );
|
||||
fprintf(proxy, "#endif /* _WIN64 */\n\n");
|
||||
}
|
||||
else if (do_win32)
|
||||
{
|
||||
pointer_size = 4;
|
||||
write_proxy_routines( stmts );
|
||||
}
|
||||
else if (do_win64)
|
||||
{
|
||||
pointer_size = 8;
|
||||
write_proxy_routines( stmts );
|
||||
}
|
||||
|
||||
interfaces = sort_interfaces(stmts, &count);
|
||||
fprintf(proxy, "static const CInterfaceProxyVtbl* const _%s_ProxyVtblList[] =\n", file_id);
|
||||
fprintf(proxy, "{\n");
|
||||
write_proxy_iface_name_format(stmts, " (const CInterfaceProxyVtbl*)&_%sProxyVtbl,\n");
|
||||
for (i = 0; i < count; i++)
|
||||
fprintf(proxy, " (const CInterfaceProxyVtbl*)&_%sProxyVtbl,\n", interfaces[i]->name);
|
||||
fprintf(proxy, " 0\n");
|
||||
fprintf(proxy, "};\n");
|
||||
fprintf(proxy, "\n");
|
||||
|
||||
fprintf(proxy, "static const CInterfaceStubVtbl* const _%s_StubVtblList[] =\n", file_id);
|
||||
fprintf(proxy, "{\n");
|
||||
write_proxy_iface_name_format(stmts, " (const CInterfaceStubVtbl*)&_%sStubVtbl,\n");
|
||||
for (i = 0; i < count; i++)
|
||||
fprintf(proxy, " &_%sStubVtbl,\n", interfaces[i]->name);
|
||||
fprintf(proxy, " 0\n");
|
||||
fprintf(proxy, "};\n");
|
||||
fprintf(proxy, "\n");
|
||||
|
||||
fprintf(proxy, "static PCInterfaceName const _%s_InterfaceNamesList[] =\n", file_id);
|
||||
fprintf(proxy, "{\n");
|
||||
write_proxy_iface_name_format(stmts, " \"%s\",\n");
|
||||
for (i = 0; i < count; i++)
|
||||
fprintf(proxy, " \"%s\",\n", interfaces[i]->name);
|
||||
fprintf(proxy, " 0\n");
|
||||
fprintf(proxy, "};\n");
|
||||
fprintf(proxy, "\n");
|
||||
|
||||
fprintf(proxy, "#define _%s_CHECK_IID(n) IID_GENERIC_CHECK_IID(_%s, pIID, n)\n", file_id, file_id);
|
||||
fprintf(proxy, "\n");
|
||||
fprintf(proxy, "int __stdcall _%s_IID_Lookup(const IID* pIID, int* pIndex)\n", file_id);
|
||||
if ((have_baseiid = does_any_iface(stmts, need_delegation_indirect)))
|
||||
{
|
||||
fprintf(proxy, "static const IID * _%s_BaseIIDList[] =\n", file_id);
|
||||
fprintf(proxy, "{\n");
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (get_delegation_indirect(interfaces[i], &delegate_to))
|
||||
fprintf( proxy, " &IID_%s, /* %s */\n", delegate_to->name, interfaces[i]->name );
|
||||
else
|
||||
fprintf( proxy, " 0,\n" );
|
||||
}
|
||||
fprintf(proxy, " 0\n");
|
||||
fprintf(proxy, "};\n");
|
||||
fprintf(proxy, "\n");
|
||||
}
|
||||
|
||||
fprintf(proxy, "static int __stdcall _%s_IID_Lookup(const IID* pIID, int* pIndex)\n", file_id);
|
||||
fprintf(proxy, "{\n");
|
||||
c = 0;
|
||||
write_iid_lookup(stmts, file_id, &c);
|
||||
fprintf(proxy, " int low = 0, high = %d;\n", count - 1);
|
||||
fprintf(proxy, "\n");
|
||||
fprintf(proxy, " while (low <= high)\n");
|
||||
fprintf(proxy, " {\n");
|
||||
fprintf(proxy, " int pos = (low + high) / 2;\n");
|
||||
fprintf(proxy, " int res = IID_GENERIC_CHECK_IID(_%s, pIID, pos);\n", file_id);
|
||||
fprintf(proxy, " if (!res) { *pIndex = pos; return 1; }\n");
|
||||
fprintf(proxy, " if (res > 0) low = pos + 1;\n");
|
||||
fprintf(proxy, " else high = pos - 1;\n");
|
||||
fprintf(proxy, " }\n");
|
||||
fprintf(proxy, " return 0;\n");
|
||||
fprintf(proxy, "}\n");
|
||||
fprintf(proxy, "\n");
|
||||
|
||||
fprintf(proxy, "const ExtendedProxyFileInfo %s_ProxyFileInfo =\n", file_id);
|
||||
fprintf(proxy, "const ExtendedProxyFileInfo %s_ProxyFileInfo DECLSPEC_HIDDEN =\n", file_id);
|
||||
fprintf(proxy, "{\n");
|
||||
fprintf(proxy, " (const PCInterfaceProxyVtblList*)_%s_ProxyVtblList,\n", file_id);
|
||||
fprintf(proxy, " (const PCInterfaceStubVtblList*)_%s_StubVtblList,\n", file_id);
|
||||
fprintf(proxy, " _%s_InterfaceNamesList,\n", file_id);
|
||||
fprintf(proxy, " 0,\n");
|
||||
if (have_baseiid) fprintf(proxy, " _%s_BaseIIDList,\n", file_id);
|
||||
else fprintf(proxy, " 0,\n");
|
||||
fprintf(proxy, " _%s_IID_Lookup,\n", file_id);
|
||||
fprintf(proxy, " %d,\n", c);
|
||||
fprintf(proxy, " %d,\n", count);
|
||||
fprintf(proxy, " 1,\n");
|
||||
fprintf(proxy, " 0,\n");
|
||||
fprintf(proxy, " 0,\n");
|
||||
|
|
|
@ -63,34 +63,52 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
/* check for a defined binding handle */
|
||||
explicit_handle_var = get_explicit_handle_var(func);
|
||||
|
||||
print_server("struct __frame_%s_%s\n{\n", iface->name, get_name(def));
|
||||
indent++;
|
||||
print_server("__DECL_EXCEPTION_FRAME\n");
|
||||
print_server("MIDL_STUB_MESSAGE _StubMsg;\n");
|
||||
|
||||
/* Declare arguments */
|
||||
declare_stub_args(server, indent, func);
|
||||
|
||||
indent--;
|
||||
print_server("};\n\n");
|
||||
|
||||
print_server("static void __finally_%s_%s(", iface->name, get_name(def));
|
||||
fprintf(server," struct __frame_%s_%s *__frame )\n{\n", iface->name, get_name(def));
|
||||
|
||||
indent++;
|
||||
write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_FREE);
|
||||
|
||||
if (has_full_pointer)
|
||||
write_full_pointer_free(server, indent, func);
|
||||
|
||||
indent--;
|
||||
print_server("}\n\n");
|
||||
|
||||
print_server("void __RPC_STUB %s_%s( PRPC_MESSAGE _pRpcMessage )\n", iface->name, get_name(def));
|
||||
|
||||
/* write the functions body */
|
||||
fprintf(server, "{\n");
|
||||
indent++;
|
||||
|
||||
/* Declare arguments */
|
||||
declare_stub_args(server, indent, func);
|
||||
|
||||
print_server("MIDL_STUB_MESSAGE _StubMsg;\n");
|
||||
print_server("RPC_STATUS _Status;\n");
|
||||
print_server("struct __frame_%s_%s __f, * const __frame = &__f;\n", iface->name, get_name(def));
|
||||
if (has_out_arg_or_return(func)) print_server("RPC_STATUS _Status;\n");
|
||||
fprintf(server, "\n");
|
||||
|
||||
|
||||
print_server("((void)(_Status));\n");
|
||||
print_server("NdrServerInitializeNew(\n");
|
||||
indent++;
|
||||
print_server("_pRpcMessage,\n");
|
||||
print_server("&_StubMsg,\n");
|
||||
print_server("&__frame->_StubMsg,\n");
|
||||
print_server("&%s_StubDesc);\n", iface->name);
|
||||
indent--;
|
||||
fprintf(server, "\n");
|
||||
print_server( "RpcExceptionInit( __server_filter, __finally_%s_%s );\n", iface->name, get_name(def));
|
||||
|
||||
write_parameters_init(server, indent, func);
|
||||
write_parameters_init(server, indent, func, "__frame->");
|
||||
|
||||
if (explicit_handle_var)
|
||||
{
|
||||
print_server("%s = _pRpcMessage->Handle;\n", explicit_handle_var->name);
|
||||
print_server("__frame->%s = _pRpcMessage->Handle;\n", explicit_handle_var->name);
|
||||
fprintf(server, "\n");
|
||||
}
|
||||
|
||||
|
@ -108,18 +126,16 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
{
|
||||
print_server("if ((_pRpcMessage->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n");
|
||||
indent++;
|
||||
print_server("NdrConvert(\n");
|
||||
indent++;
|
||||
print_server("(PMIDL_STUB_MESSAGE)&_StubMsg,\n");
|
||||
print_server("(PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n", *proc_offset);
|
||||
indent -= 2;
|
||||
print_server("NdrConvert(&__frame->_StubMsg, (PFORMAT_STRING)&__MIDL_ProcFormatString.Format[%u]);\n",
|
||||
*proc_offset);
|
||||
indent--;
|
||||
fprintf(server, "\n");
|
||||
|
||||
/* unmarshall arguments */
|
||||
write_remoting_arguments(server, indent, func, PASS_IN, PHASE_UNMARSHAL);
|
||||
write_remoting_arguments(server, indent, func, "__frame->", PASS_IN, PHASE_UNMARSHAL);
|
||||
}
|
||||
|
||||
print_server("if (_StubMsg.Buffer > _StubMsg.BufferEnd)\n");
|
||||
print_server("if (__frame->_StubMsg.Buffer > __frame->_StubMsg.BufferEnd)\n");
|
||||
print_server("{\n");
|
||||
indent++;
|
||||
print_server("RpcRaiseException(RPC_X_BAD_STUB_DATA);\n");
|
||||
|
@ -137,11 +153,11 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
fprintf(server, "\n");
|
||||
|
||||
/* Assign 'out' arguments */
|
||||
assign_stub_out_args(server, indent, func);
|
||||
assign_stub_out_args(server, indent, func, "__frame->");
|
||||
|
||||
/* Call the real server function */
|
||||
if (!is_void(get_func_return_type(func)))
|
||||
print_server("_RetVal = ");
|
||||
print_server("__frame->_RetVal = ");
|
||||
else
|
||||
print_server("");
|
||||
fprintf(server, "%s%s", prefix_server, get_name(def));
|
||||
|
@ -166,11 +182,12 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
int is_ch_ptr = is_aliaschain_attr(var->type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE;
|
||||
print_server("(");
|
||||
write_type_decl_left(server, var->type);
|
||||
fprintf(server, ")%sNDRSContextValue(%s)", is_ch_ptr ? "" : "*", var->name);
|
||||
fprintf(server, ")%sNDRSContextValue(__frame->%s)",
|
||||
is_ch_ptr ? "" : "*", var->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_server("%s%s", var->type->declarray ? "*" : "", get_name(var));
|
||||
print_server("%s__frame->%s", var->type->declarray ? "*" : "", var->name);
|
||||
}
|
||||
}
|
||||
fprintf(server, ");\n");
|
||||
|
@ -183,12 +200,12 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
|
||||
if (has_out_arg_or_return(func))
|
||||
{
|
||||
write_remoting_arguments(server, indent, func, PASS_OUT, PHASE_BUFFERSIZE);
|
||||
write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_BUFFERSIZE);
|
||||
|
||||
if (!is_void(get_func_return_type(func)))
|
||||
write_remoting_arguments(server, indent, func, PASS_RETURN, PHASE_BUFFERSIZE);
|
||||
write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_BUFFERSIZE);
|
||||
|
||||
print_server("_pRpcMessage->BufferLength = _StubMsg.BufferLength;\n");
|
||||
print_server("_pRpcMessage->BufferLength = __frame->_StubMsg.BufferLength;\n");
|
||||
fprintf(server, "\n");
|
||||
print_server("_Status = I_RpcGetBuffer(_pRpcMessage);\n");
|
||||
print_server("if (_Status)\n");
|
||||
|
@ -196,38 +213,30 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
|||
print_server("RpcRaiseException(_Status);\n");
|
||||
indent--;
|
||||
fprintf(server, "\n");
|
||||
print_server("_StubMsg.Buffer = (unsigned char *)_pRpcMessage->Buffer;\n");
|
||||
print_server("__frame->_StubMsg.Buffer = _pRpcMessage->Buffer;\n");
|
||||
fprintf(server, "\n");
|
||||
}
|
||||
|
||||
/* marshall arguments */
|
||||
write_remoting_arguments(server, indent, func, PASS_OUT, PHASE_MARSHAL);
|
||||
write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_MARSHAL);
|
||||
|
||||
/* marshall the return value */
|
||||
if (!is_void(get_func_return_type(func)))
|
||||
write_remoting_arguments(server, indent, func, PASS_RETURN, PHASE_MARSHAL);
|
||||
write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_MARSHAL);
|
||||
|
||||
indent--;
|
||||
print_server("}\n");
|
||||
print_server("RpcFinally\n");
|
||||
print_server("{\n");
|
||||
indent++;
|
||||
|
||||
write_remoting_arguments(server, indent, func, PASS_OUT, PHASE_FREE);
|
||||
|
||||
if (has_full_pointer)
|
||||
write_full_pointer_free(server, indent, func);
|
||||
|
||||
print_server("__finally_%s_%s( __frame );\n", iface->name, get_name(def));
|
||||
indent--;
|
||||
print_server("}\n");
|
||||
print_server("RpcEndFinally\n");
|
||||
|
||||
/* calculate buffer length */
|
||||
fprintf(server, "\n");
|
||||
print_server("_pRpcMessage->BufferLength =\n");
|
||||
indent++;
|
||||
print_server("(unsigned int)(_StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer);\n");
|
||||
indent--;
|
||||
print_server("_pRpcMessage->BufferLength = __frame->_StubMsg.Buffer - (unsigned char *)_pRpcMessage->Buffer;\n");
|
||||
indent--;
|
||||
fprintf(server, "}\n");
|
||||
fprintf(server, "\n");
|
||||
|
@ -251,15 +260,13 @@ static void write_dispatchtable(type_t *iface)
|
|||
if (iface->funcs) LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
|
||||
{
|
||||
var_t *def = func->def;
|
||||
|
||||
print_server("%s_%s,\n", iface->name, get_name(def));
|
||||
|
||||
method_count++;
|
||||
}
|
||||
print_server("0\n");
|
||||
indent--;
|
||||
print_server("};\n");
|
||||
print_server("RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable =\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
print_server("static RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable =\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
print_server("{\n");
|
||||
indent++;
|
||||
print_server("%u,\n", method_count);
|
||||
|
@ -323,7 +330,7 @@ static void write_serverinterfacedecl(type_t *iface)
|
|||
|
||||
if (endpoints) write_endpoints( server, iface->name, endpoints );
|
||||
|
||||
print_server("extern RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable;\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
print_server("static RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable;\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
fprintf(server, "\n");
|
||||
print_server("static const RPC_SERVER_INTERFACE %s___RpcServerInterface =\n", iface->name );
|
||||
print_server("{\n");
|
||||
|
@ -351,10 +358,10 @@ static void write_serverinterfacedecl(type_t *iface)
|
|||
indent--;
|
||||
print_server("};\n");
|
||||
if (old_names)
|
||||
print_server("RPC_IF_HANDLE %s_ServerIfHandle = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n",
|
||||
print_server("RPC_IF_HANDLE %s_ServerIfHandle DECLSPEC_HIDDEN = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n",
|
||||
iface->name, iface->name);
|
||||
else
|
||||
print_server("RPC_IF_HANDLE %s%s_v%d_%d_s_ifspec = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n",
|
||||
print_server("RPC_IF_HANDLE %s%s_v%d_%d_s_ifspec DECLSPEC_HIDDEN = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n",
|
||||
prefix_server, iface->name, MAJORVERSION(ver), MINORVERSION(ver), iface->name);
|
||||
fprintf(server, "\n");
|
||||
}
|
||||
|
@ -370,9 +377,25 @@ static void init_server(void)
|
|||
print_server("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
|
||||
print_server("#include <string.h>\n");
|
||||
fprintf(server, "\n");
|
||||
print_server("#define _SEH_NO_NATIVE_NLG\n");
|
||||
print_server("#include \"%s\"\n", header_name);
|
||||
fprintf(server, "\n");
|
||||
print_server("\n");
|
||||
print_server( "#ifndef DECLSPEC_HIDDEN\n");
|
||||
print_server( "#define DECLSPEC_HIDDEN\n");
|
||||
print_server( "#endif\n");
|
||||
print_server( "\n");
|
||||
write_exceptions( server );
|
||||
print_server("\n");
|
||||
print_server("struct __server_frame\n");
|
||||
print_server("{\n");
|
||||
print_server(" __DECL_EXCEPTION_FRAME\n");
|
||||
print_server(" MIDL_STUB_MESSAGE _StubMsg;\n");
|
||||
print_server("};\n");
|
||||
print_server("\n");
|
||||
print_server("static int __server_filter( struct __server_frame *__frame )\n");
|
||||
print_server( "{\n");
|
||||
print_server( " return RPC_BAD_STUB_DATA_EXCEPTION_FILTER;\n");
|
||||
print_server( "}\n");
|
||||
print_server( "\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -401,7 +424,7 @@ static void write_server_stmts(const statement_list_t *stmts, int expr_eval_rout
|
|||
|
||||
write_function_stubs(iface, proc_offset);
|
||||
|
||||
print_server("#if !defined(__RPC_WIN32__)\n");
|
||||
print_server("#if !defined(__RPC_WIN%u__)\n", pointer_size == 8 ? 64 : 32);
|
||||
print_server("#error Invalid build platform for this stub.\n");
|
||||
print_server("#endif\n");
|
||||
|
||||
|
@ -413,20 +436,11 @@ static void write_server_stmts(const statement_list_t *stmts, int expr_eval_rout
|
|||
}
|
||||
}
|
||||
|
||||
void write_server(const statement_list_t *stmts)
|
||||
static void write_server_routines(const statement_list_t *stmts)
|
||||
{
|
||||
unsigned int proc_offset = 0;
|
||||
int expr_eval_routines;
|
||||
|
||||
if (!do_server)
|
||||
return;
|
||||
if (do_everything && !need_stub_files(stmts))
|
||||
return;
|
||||
|
||||
init_server();
|
||||
if (!server)
|
||||
return;
|
||||
|
||||
write_formatstringsdecl(server, indent, stmts, need_stub);
|
||||
expr_eval_routines = write_expr_eval_routines(server, server_token);
|
||||
if (expr_eval_routines)
|
||||
|
@ -439,6 +453,39 @@ void write_server(const statement_list_t *stmts)
|
|||
|
||||
write_procformatstring(server, stmts, need_stub);
|
||||
write_typeformatstring(server, stmts, need_stub);
|
||||
}
|
||||
|
||||
void write_server(const statement_list_t *stmts)
|
||||
{
|
||||
if (!do_server)
|
||||
return;
|
||||
if (do_everything && !need_stub_files(stmts))
|
||||
return;
|
||||
|
||||
init_server();
|
||||
if (!server)
|
||||
return;
|
||||
|
||||
if (do_win32 && do_win64)
|
||||
{
|
||||
fprintf(server, "\n#ifndef _WIN64\n\n");
|
||||
pointer_size = 4;
|
||||
write_server_routines( stmts );
|
||||
fprintf(server, "\n#else /* _WIN64 */\n\n");
|
||||
pointer_size = 8;
|
||||
write_server_routines( stmts );
|
||||
fprintf(server, "\n#endif /* _WIN64 */\n");
|
||||
}
|
||||
else if (do_win32)
|
||||
{
|
||||
pointer_size = 4;
|
||||
write_server_routines( stmts );
|
||||
}
|
||||
else if (do_win64)
|
||||
{
|
||||
pointer_size = 8;
|
||||
write_server_routines( stmts );
|
||||
}
|
||||
|
||||
fclose(server);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -41,21 +41,24 @@ typedef int (*type_pred_t)(const type_t *);
|
|||
void write_formatstringsdecl(FILE *f, int indent, const statement_list_t *stmts, type_pred_t pred);
|
||||
void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred);
|
||||
void write_typeformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred);
|
||||
void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, enum pass pass, const var_t *var, const char *varname);
|
||||
void write_remoting_arguments(FILE *file, int indent, const func_t *func, enum pass pass, enum remoting_phase phase);
|
||||
void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, enum remoting_phase phase,
|
||||
enum pass pass, const var_t *var, const char *varname);
|
||||
void write_remoting_arguments(FILE *file, int indent, const func_t *func, const char *local_var_prefix,
|
||||
enum pass pass, enum remoting_phase phase);
|
||||
size_t get_size_procformatstring_type(const char *name, const type_t *type, const attr_list_t *attrs);
|
||||
size_t get_size_procformatstring_func(const func_t *func);
|
||||
size_t get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred);
|
||||
size_t get_size_typeformatstring(const statement_list_t *stmts, type_pred_t pred);
|
||||
void assign_stub_out_args( FILE *file, int indent, const func_t *func );
|
||||
void assign_stub_out_args( FILE *file, int indent, const func_t *func, const char *local_var_prefix );
|
||||
void declare_stub_args( FILE *file, int indent, const func_t *func );
|
||||
int write_expr_eval_routines(FILE *file, const char *iface);
|
||||
void write_expr_eval_routine_list(FILE *file, const char *iface);
|
||||
void write_user_quad_list(FILE *file);
|
||||
void write_endpoints( FILE *f, const char *prefix, const str_list_t *list );
|
||||
void write_exceptions( FILE *file );
|
||||
size_t type_memsize(const type_t *t, unsigned int *align);
|
||||
int decl_indirect(const type_t *t);
|
||||
void write_parameters_init(FILE *file, int indent, const func_t *func);
|
||||
void write_parameters_init(FILE *file, int indent, const func_t *func, const char *local_var_prefix);
|
||||
void print(FILE *file, int indent, const char *format, va_list ap);
|
||||
int get_padding(const var_list_t *fields);
|
||||
int is_user_type(const type_t *t);
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
#include "widltypes.h"
|
||||
#include "typelib_struct.h"
|
||||
|
||||
int in_typelib = 0;
|
||||
|
||||
static typelib_t *typelib;
|
||||
|
||||
type_t *duptype(type_t *t, int dupname)
|
||||
|
@ -245,7 +243,6 @@ unsigned short get_type_vt(type_t *t)
|
|||
|
||||
void start_typelib(typelib_t *typelib_type)
|
||||
{
|
||||
in_typelib++;
|
||||
if (!do_typelib) return;
|
||||
|
||||
typelib = typelib_type;
|
||||
|
@ -254,23 +251,11 @@ void start_typelib(typelib_t *typelib_type)
|
|||
|
||||
void end_typelib(void)
|
||||
{
|
||||
in_typelib--;
|
||||
if (!typelib) return;
|
||||
|
||||
create_msft_typelib(typelib);
|
||||
}
|
||||
|
||||
void add_typelib_entry(type_t *t)
|
||||
{
|
||||
typelib_entry_t *entry;
|
||||
if (!typelib) return;
|
||||
|
||||
chat("add kind %i: %s\n", t->kind, t->name);
|
||||
entry = xmalloc(sizeof(*entry));
|
||||
entry->type = t;
|
||||
list_add_tail( &typelib->entries, &entry->entry );
|
||||
}
|
||||
|
||||
static void tlb_read(int fd, void *buf, int count)
|
||||
{
|
||||
if(read(fd, buf, count) < count)
|
||||
|
@ -353,10 +338,10 @@ static void read_importlib(importlib_t *importlib)
|
|||
|
||||
file_name = wpp_find_include(importlib->name, NULL);
|
||||
if(file_name) {
|
||||
fd = open(file_name, O_RDONLY | O_BINARY);
|
||||
fd = open(file_name, O_RDONLY | O_BINARY );
|
||||
free(file_name);
|
||||
}else {
|
||||
fd = open(importlib->name, O_RDONLY | O_BINARY);
|
||||
fd = open(importlib->name, O_RDONLY | O_BINARY );
|
||||
}
|
||||
|
||||
if(fd < 0)
|
||||
|
|
|
@ -21,10 +21,8 @@
|
|||
#ifndef __WIDL_TYPELIB_H
|
||||
#define __WIDL_TYPELIB_H
|
||||
|
||||
extern int in_typelib;
|
||||
extern void start_typelib(typelib_t *typelib_type);
|
||||
extern void end_typelib(void);
|
||||
extern void add_typelib_entry(type_t *t);
|
||||
extern void add_importlib(const char *name);
|
||||
|
||||
/* Copied from wtypes.h. Not included directly because that would create a
|
||||
|
|
98
reactos/tools/widl/typetree.c
Normal file
98
reactos/tools/widl/typetree.c
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* IDL Type Tree
|
||||
*
|
||||
* Copyright 2008 Robert Shearman
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "widl.h"
|
||||
#include "utils.h"
|
||||
#include "parser.h"
|
||||
#include "typetree.h"
|
||||
#include "header.h"
|
||||
|
||||
type_t *type_new_function(var_list_t *args)
|
||||
{
|
||||
type_t *t = make_type(RPC_FC_FUNCTION, NULL);
|
||||
t->details.function = xmalloc(sizeof(*t->details.function));
|
||||
t->details.function->args = args;
|
||||
return t;
|
||||
}
|
||||
|
||||
type_t *type_new_pointer(type_t *ref, attr_list_t *attrs)
|
||||
{
|
||||
type_t *t = make_type(pointer_default, ref);
|
||||
t->attrs = attrs;
|
||||
return t;
|
||||
}
|
||||
|
||||
static int compute_method_indexes(type_t *iface)
|
||||
{
|
||||
int idx;
|
||||
func_t *f;
|
||||
|
||||
if (iface->ref)
|
||||
idx = compute_method_indexes(iface->ref);
|
||||
else
|
||||
idx = 0;
|
||||
|
||||
if (!iface->funcs)
|
||||
return idx;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( f, iface->funcs, func_t, entry )
|
||||
if (! is_callas(f->def->attrs))
|
||||
f->idx = idx++;
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts)
|
||||
{
|
||||
iface->ref = inherit;
|
||||
iface->details.iface = xmalloc(sizeof(*iface->details.iface));
|
||||
iface->funcs = gen_function_list(stmts);
|
||||
iface->details.iface->disp_props = NULL;
|
||||
iface->details.iface->disp_methods = NULL;
|
||||
iface->stmts = stmts;
|
||||
iface->defined = TRUE;
|
||||
check_functions(iface);
|
||||
compute_method_indexes(iface);
|
||||
}
|
||||
|
||||
void type_dispinterface_define(type_t *iface, var_list_t *props, func_list_t *methods)
|
||||
{
|
||||
iface->ref = find_type("IDispatch", 0);
|
||||
if (!iface->ref) error_loc("IDispatch is undefined\n");
|
||||
iface->details.iface = xmalloc(sizeof(*iface->details.iface));
|
||||
iface->funcs = NULL;
|
||||
iface->details.iface->disp_props = props;
|
||||
iface->details.iface->disp_methods = methods;
|
||||
iface->stmts = NULL;
|
||||
iface->defined = TRUE;
|
||||
check_functions(iface);
|
||||
compute_method_indexes(iface);
|
||||
}
|
||||
|
||||
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface)
|
||||
{
|
||||
type_dispinterface_define(dispiface, iface->details.iface->disp_props,
|
||||
iface->details.iface->disp_methods);
|
||||
}
|
107
reactos/tools/widl/typetree.h
Normal file
107
reactos/tools/widl/typetree.h
Normal file
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* IDL Type Tree
|
||||
*
|
||||
* Copyright 2008 Robert Shearman
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "widltypes.h"
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef WIDL_TYPE_TREE_H
|
||||
#define WIDL_TYPE_TREE_H
|
||||
|
||||
type_t *type_new_function(var_list_t *args);
|
||||
type_t *type_new_pointer(type_t *ref, attr_list_t *attrs);
|
||||
void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts);
|
||||
void type_dispinterface_define(type_t *iface, var_list_t *props, func_list_t *methods);
|
||||
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
|
||||
|
||||
static inline var_list_t *type_struct_get_fields(const type_t *type)
|
||||
{
|
||||
assert(is_struct(type->type));
|
||||
return type->details.structure->fields;
|
||||
}
|
||||
|
||||
static inline var_list_t *type_function_get_args(const type_t *type)
|
||||
{
|
||||
assert(type->type == RPC_FC_FUNCTION);
|
||||
return type->details.function->args;
|
||||
}
|
||||
|
||||
static inline var_list_t *type_enum_get_values(const type_t *type)
|
||||
{
|
||||
assert(type->type == RPC_FC_ENUM16 || type->type == RPC_FC_ENUM32);
|
||||
return type->details.enumeration->enums;
|
||||
}
|
||||
|
||||
static inline var_t *type_union_get_switch_value(const type_t *type)
|
||||
{
|
||||
assert(type->type == RPC_FC_ENCAPSULATED_UNION);
|
||||
return LIST_ENTRY(list_head(type->details.structure->fields), var_t, entry);
|
||||
}
|
||||
|
||||
static inline var_list_t *type_encapsulated_union_get_fields(const type_t *type)
|
||||
{
|
||||
assert(type->type == RPC_FC_ENCAPSULATED_UNION);
|
||||
return type->details.structure->fields;
|
||||
}
|
||||
|
||||
static inline var_list_t *type_union_get_cases(const type_t *type)
|
||||
{
|
||||
assert(type->type == RPC_FC_ENCAPSULATED_UNION ||
|
||||
type->type == RPC_FC_NON_ENCAPSULATED_UNION);
|
||||
if (type->type == RPC_FC_ENCAPSULATED_UNION)
|
||||
{
|
||||
const var_t *uv = LIST_ENTRY(list_tail(type->details.structure->fields), const var_t, entry);
|
||||
return uv->type->details.structure->fields;
|
||||
}
|
||||
else
|
||||
return type->details.structure->fields;
|
||||
}
|
||||
|
||||
static inline var_list_t *type_dispiface_get_props(const type_t *type)
|
||||
{
|
||||
assert(type->type == RPC_FC_IP);
|
||||
return type->details.iface->disp_props;
|
||||
}
|
||||
|
||||
static inline var_list_t *type_dispiface_get_methods(const type_t *type)
|
||||
{
|
||||
assert(type->type == RPC_FC_IP);
|
||||
return type->details.iface->disp_methods;
|
||||
}
|
||||
|
||||
static inline int type_is_defined(const type_t *type)
|
||||
{
|
||||
return type->defined;
|
||||
}
|
||||
|
||||
static inline int type_is_complete(const type_t *type)
|
||||
{
|
||||
if (type->type == RPC_FC_FUNCTION)
|
||||
return (type->details.function != NULL);
|
||||
else if (type->type == RPC_FC_IP)
|
||||
return (type->details.iface != NULL);
|
||||
else if (type->type == RPC_FC_ENUM16 || type->type == RPC_FC_ENUM32)
|
||||
return (type->details.enumeration != NULL);
|
||||
else if (is_struct(type->type) || is_union(type->type))
|
||||
return (type->details.structure != NULL);
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* WIDL_TYPE_TREE_H */
|
|
@ -78,6 +78,8 @@ static const char usage[] =
|
|||
" -U file Name of interface identifiers file (default is infile_i.c)\n"
|
||||
" -V Print version and exit\n"
|
||||
" -W Enable pedantic warnings\n"
|
||||
" --win32 Only generate 32-bit code\n"
|
||||
" --win64 Only generate 64-bit code\n"
|
||||
"Debug level 'n' is a bitmask with following meaning:\n"
|
||||
" * 0x01 Tell which resource is parsed (verbose mode)\n"
|
||||
" * 0x02 Dump internal structures\n"
|
||||
|
@ -106,6 +108,8 @@ int do_idfile = 0;
|
|||
int do_dlldata = 0;
|
||||
int no_preprocess = 0;
|
||||
int old_names = 0;
|
||||
int do_win32 = 1;
|
||||
int do_win64 = 1;
|
||||
|
||||
char *input_name;
|
||||
char *header_name;
|
||||
|
@ -128,10 +132,10 @@ const char *prefix_server = "";
|
|||
int line_number = 1;
|
||||
|
||||
FILE *header;
|
||||
FILE *local_stubs;
|
||||
FILE *proxy;
|
||||
FILE *idfile;
|
||||
|
||||
size_t pointer_size = 0;
|
||||
|
||||
time_t now;
|
||||
|
||||
enum {
|
||||
|
@ -141,7 +145,9 @@ enum {
|
|||
LOCAL_STUBS_OPTION,
|
||||
PREFIX_ALL_OPTION,
|
||||
PREFIX_CLIENT_OPTION,
|
||||
PREFIX_SERVER_OPTION
|
||||
PREFIX_SERVER_OPTION,
|
||||
WIN32_OPTION,
|
||||
WIN64_OPTION
|
||||
};
|
||||
|
||||
static const char short_options[] =
|
||||
|
@ -154,6 +160,8 @@ static const struct option long_options[] = {
|
|||
{ "prefix-all", 1, 0, PREFIX_ALL_OPTION },
|
||||
{ "prefix-client", 1, 0, PREFIX_CLIENT_OPTION },
|
||||
{ "prefix-server", 1, 0, PREFIX_SERVER_OPTION },
|
||||
{ "win32", 0, 0, WIN32_OPTION },
|
||||
{ "win64", 0, 0, WIN64_OPTION },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
@ -174,7 +182,7 @@ static char *make_token(const char *name)
|
|||
token = xstrdup(name);
|
||||
for (i=0; token[i]; i++) {
|
||||
if (!isalnum(token[i])) token[i] = '_';
|
||||
else token[i] = tolower(token[i]);
|
||||
else token[i] = toupper(token[i]);
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
@ -205,14 +213,14 @@ static void set_everything(int x)
|
|||
do_dlldata = x;
|
||||
}
|
||||
|
||||
static void start_cplusplus_guard(FILE *fp)
|
||||
void start_cplusplus_guard(FILE *fp)
|
||||
{
|
||||
fprintf(fp, "#ifdef __cplusplus\n");
|
||||
fprintf(fp, "extern \"C\" {\n");
|
||||
fprintf(fp, "#endif\n\n");
|
||||
}
|
||||
|
||||
static void end_cplusplus_guard(FILE *fp)
|
||||
void end_cplusplus_guard(FILE *fp)
|
||||
{
|
||||
fprintf(fp, "#ifdef __cplusplus\n");
|
||||
fprintf(fp, "}\n");
|
||||
|
@ -333,6 +341,65 @@ void write_dlldata(const statement_list_t *stmts)
|
|||
free_filename_nodes(&filenames);
|
||||
}
|
||||
|
||||
static void write_id_data_stmts(const statement_list_t *stmts)
|
||||
{
|
||||
const statement_t *stmt;
|
||||
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
|
||||
{
|
||||
if (stmt->type == STMT_TYPE)
|
||||
{
|
||||
const type_t *type = stmt->u.type;
|
||||
if (type->type == RPC_FC_IP)
|
||||
{
|
||||
const UUID *uuid;
|
||||
if (!is_object(type->attrs) && !is_attr(type->attrs, ATTR_DISPINTERFACE))
|
||||
continue;
|
||||
uuid = get_attrp(type->attrs, ATTR_UUID);
|
||||
write_guid(idfile, is_attr(type->attrs, ATTR_DISPINTERFACE) ? "DIID" : "IID",
|
||||
type->name, uuid);
|
||||
}
|
||||
else if (type->type == RPC_FC_COCLASS)
|
||||
{
|
||||
const UUID *uuid = get_attrp(type->attrs, ATTR_UUID);
|
||||
write_guid(idfile, "CLSID", type->name, uuid);
|
||||
}
|
||||
}
|
||||
else if (stmt->type == STMT_LIBRARY)
|
||||
{
|
||||
const UUID *uuid = get_attrp(stmt->u.lib->attrs, ATTR_UUID);
|
||||
write_guid(idfile, "LIBID", stmt->u.lib->name, uuid);
|
||||
write_id_data_stmts(stmt->u.lib->stmts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void write_id_data(const statement_list_t *stmts)
|
||||
{
|
||||
if (!do_idfile) return;
|
||||
|
||||
idfile_token = make_token(idfile_name);
|
||||
|
||||
idfile = fopen(idfile_name, "w");
|
||||
if (! idfile) {
|
||||
error("Could not open %s for output\n", idfile_name);
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(idfile, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
|
||||
fprintf(idfile, "from %s - Do not edit ***/\n\n", input_name);
|
||||
fprintf(idfile, "#include <rpc.h>\n");
|
||||
fprintf(idfile, "#include <rpcndr.h>\n\n");
|
||||
fprintf(idfile, "#include <initguid.h>\n\n");
|
||||
start_cplusplus_guard(idfile);
|
||||
|
||||
write_id_data_stmts(stmts);
|
||||
|
||||
fprintf(idfile, "\n");
|
||||
end_cplusplus_guard(idfile);
|
||||
|
||||
fclose(idfile);
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
extern char* optarg;
|
||||
|
@ -375,6 +442,14 @@ int main(int argc,char *argv[])
|
|||
case PREFIX_SERVER_OPTION:
|
||||
prefix_server = xstrdup(optarg);
|
||||
break;
|
||||
case WIN32_OPTION:
|
||||
do_win32 = 1;
|
||||
do_win64 = 0;
|
||||
break;
|
||||
case WIN64_OPTION:
|
||||
do_win32 = 0;
|
||||
do_win64 = 1;
|
||||
break;
|
||||
case 'c':
|
||||
do_everything = 0;
|
||||
do_client = 1;
|
||||
|
@ -551,77 +626,11 @@ int main(int argc,char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if(do_header) {
|
||||
header_token = make_token(header_name);
|
||||
|
||||
if(!(header = fopen(header_name, "w"))) {
|
||||
fprintf(stderr, "Could not open %s for output\n", header_name);
|
||||
return 1;
|
||||
}
|
||||
fprintf(header, "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
|
||||
fprintf(header, "#include <rpc.h>\n" );
|
||||
fprintf(header, "#include <rpcndr.h>\n\n" );
|
||||
fprintf(header, "#ifndef __%s__\n", header_token);
|
||||
fprintf(header, "#define __%s__\n", header_token);
|
||||
start_cplusplus_guard(header);
|
||||
}
|
||||
|
||||
if (local_stubs_name) {
|
||||
local_stubs = fopen(local_stubs_name, "w");
|
||||
if (!local_stubs) {
|
||||
fprintf(stderr, "Could not open %s for output\n", local_stubs_name);
|
||||
return 1;
|
||||
}
|
||||
fprintf(local_stubs, "/* call_as/local stubs for %s */\n\n", input_name);
|
||||
fprintf(local_stubs, "#include <objbase.h>\n");
|
||||
fprintf(local_stubs, "#include \"%s\"\n\n", header_name);
|
||||
}
|
||||
|
||||
if (do_idfile) {
|
||||
idfile_token = make_token(idfile_name);
|
||||
|
||||
idfile = fopen(idfile_name, "w");
|
||||
if (! idfile) {
|
||||
fprintf(stderr, "Could not open %s for output\n", idfile_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(idfile, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
|
||||
fprintf(idfile, "from %s - Do not edit ***/\n\n", input_name);
|
||||
fprintf(idfile, "#include <rpc.h>\n");
|
||||
fprintf(idfile, "#include <rpcndr.h>\n\n");
|
||||
fprintf(idfile, "#include <initguid.h>\n\n");
|
||||
start_cplusplus_guard(idfile);
|
||||
}
|
||||
header_token = make_token(header_name);
|
||||
|
||||
init_types();
|
||||
ret = parser_parse();
|
||||
|
||||
if(do_header) {
|
||||
fprintf(header, "/* Begin additional prototypes for all interfaces */\n");
|
||||
fprintf(header, "\n");
|
||||
write_user_types();
|
||||
write_generic_handle_routines();
|
||||
write_context_handle_rundowns();
|
||||
fprintf(header, "\n");
|
||||
fprintf(header, "/* End additional prototypes */\n");
|
||||
fprintf(header, "\n");
|
||||
end_cplusplus_guard(header);
|
||||
fprintf(header, "#endif /* __%s__ */\n", header_token);
|
||||
fclose(header);
|
||||
}
|
||||
|
||||
if (local_stubs) {
|
||||
fclose(local_stubs);
|
||||
}
|
||||
|
||||
if (do_idfile) {
|
||||
fprintf(idfile, "\n");
|
||||
end_cplusplus_guard(idfile);
|
||||
|
||||
fclose(idfile);
|
||||
}
|
||||
|
||||
fclose(parser_in);
|
||||
|
||||
if(ret) {
|
||||
|
|
|
@ -45,9 +45,12 @@ extern int do_server;
|
|||
extern int do_idfile;
|
||||
extern int do_dlldata;
|
||||
extern int old_names;
|
||||
extern int do_win32;
|
||||
extern int do_win64;
|
||||
|
||||
extern char *input_name;
|
||||
extern char *header_name;
|
||||
extern char *header_token;
|
||||
extern char *local_stubs_name;
|
||||
extern char *typelib_name;
|
||||
extern char *dlldata_name;
|
||||
|
@ -59,18 +62,21 @@ extern char *server_name;
|
|||
extern char *server_token;
|
||||
extern const char *prefix_client;
|
||||
extern const char *prefix_server;
|
||||
extern size_t pointer_size;
|
||||
extern time_t now;
|
||||
|
||||
extern int line_number;
|
||||
extern int char_number;
|
||||
|
||||
extern FILE* header;
|
||||
extern FILE* local_stubs;
|
||||
extern FILE* idfile;
|
||||
|
||||
extern void write_header(const statement_list_t *stmts);
|
||||
extern void write_id_data(const statement_list_t *stmts);
|
||||
extern void write_proxies(const statement_list_t *stmts);
|
||||
extern void write_client(const statement_list_t *stmts);
|
||||
extern void write_server(const statement_list_t *stmts);
|
||||
extern void write_local_stubs(const statement_list_t *stmts);
|
||||
extern void write_dlldata(const statement_list_t *stmts);
|
||||
|
||||
extern void start_cplusplus_guard(FILE *fp);
|
||||
extern void end_cplusplus_guard(FILE *fp);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<file>server.c</file>
|
||||
<file>typegen.c</file>
|
||||
<file>typelib.c</file>
|
||||
<file>typetree.c</file>
|
||||
<file>utils.c</file>
|
||||
<file>widl.c</file>
|
||||
<file>write_msft.c</file>
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#define max(a, b) ((a) > (b) ? a : b)
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include "guiddef.h"
|
||||
#include "wine/rpcfc.h"
|
||||
#include "wine/list.h"
|
||||
|
@ -268,14 +269,42 @@ struct _expr_t {
|
|||
struct list entry;
|
||||
};
|
||||
|
||||
struct struct_details
|
||||
{
|
||||
var_list_t *fields;
|
||||
};
|
||||
|
||||
struct enumeration_details
|
||||
{
|
||||
var_list_t *enums;
|
||||
};
|
||||
|
||||
struct func_details
|
||||
{
|
||||
var_list_t *args;
|
||||
};
|
||||
|
||||
struct iface_details
|
||||
{
|
||||
func_list_t *disp_methods;
|
||||
var_list_t *disp_props;
|
||||
};
|
||||
|
||||
struct _type_t {
|
||||
const char *name;
|
||||
enum type_kind kind;
|
||||
unsigned char type;
|
||||
struct _type_t *ref;
|
||||
attr_list_t *attrs;
|
||||
union
|
||||
{
|
||||
struct struct_details *structure;
|
||||
struct enumeration_details *enumeration;
|
||||
struct func_details *function;
|
||||
struct iface_details *iface;
|
||||
} details;
|
||||
func_list_t *funcs; /* interfaces and modules */
|
||||
var_list_t *fields_or_args; /* interfaces, structures, enumerations and functions (for args) */
|
||||
statement_list_t *stmts; /* interfaces and modules */
|
||||
ifref_list_t *ifaces; /* coclasses */
|
||||
unsigned long dim; /* array dimension */
|
||||
expr_t *size_is, *length_is;
|
||||
|
@ -320,7 +349,7 @@ struct _declarator_t {
|
|||
struct _func_t {
|
||||
var_t *def;
|
||||
var_list_t *args;
|
||||
int ignore, idx;
|
||||
int idx;
|
||||
|
||||
/* parser-internal */
|
||||
struct list entry;
|
||||
|
@ -368,7 +397,6 @@ struct _typelib_t {
|
|||
char *name;
|
||||
char *filename;
|
||||
const attr_list_t *attrs;
|
||||
struct list entries;
|
||||
struct list importlibs;
|
||||
statement_list_t *stmts;
|
||||
};
|
||||
|
@ -405,6 +433,7 @@ void check_for_additional_prototype_types(const var_list_t *list);
|
|||
void init_types(void);
|
||||
type_t *alloc_type(void);
|
||||
void set_all_tfswrite(int val);
|
||||
void clear_all_offsets(void);
|
||||
|
||||
type_t *duptype(type_t *t, int dupname);
|
||||
type_t *alias(type_t *t, const char *name);
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "utils.h"
|
||||
#include "header.h"
|
||||
#include "hash.h"
|
||||
#include "typetree.h"
|
||||
|
||||
enum MSFT_segment_index {
|
||||
MSFT_SEG_TYPEINFO = 0, /* type information */
|
||||
|
@ -1966,14 +1967,14 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
|
|||
if (dispinterface->funcs)
|
||||
LIST_FOR_EACH_ENTRY( func, dispinterface->funcs, const func_t, entry ) idx++;
|
||||
|
||||
if (dispinterface->fields_or_args)
|
||||
LIST_FOR_EACH_ENTRY( var, dispinterface->fields_or_args, var_t, entry )
|
||||
if (type_dispiface_get_props(dispinterface))
|
||||
LIST_FOR_EACH_ENTRY( var, type_dispiface_get_props(dispinterface), var_t, entry )
|
||||
add_var_desc(msft_typeinfo, idx++, var);
|
||||
|
||||
if (dispinterface->funcs)
|
||||
if (type_dispiface_get_methods(dispinterface))
|
||||
{
|
||||
idx = 0;
|
||||
LIST_FOR_EACH_ENTRY( func, dispinterface->funcs, const func_t, entry )
|
||||
LIST_FOR_EACH_ENTRY( func, type_dispiface_get_methods(dispinterface), const func_t, entry )
|
||||
if(add_func_desc(msft_typeinfo, func, idx) == S_OK)
|
||||
idx++;
|
||||
}
|
||||
|
@ -2050,8 +2051,8 @@ static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure)
|
|||
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_RECORD, structure->name, structure->attrs);
|
||||
msft_typeinfo->typeinfo->size = 0;
|
||||
|
||||
if (structure->fields_or_args)
|
||||
LIST_FOR_EACH_ENTRY( cur, structure->fields_or_args, var_t, entry )
|
||||
if (type_struct_get_fields(structure))
|
||||
LIST_FOR_EACH_ENTRY( cur, type_struct_get_fields(structure), var_t, entry )
|
||||
add_var_desc(msft_typeinfo, idx++, cur);
|
||||
}
|
||||
|
||||
|
@ -2065,8 +2066,8 @@ static void add_enum_typeinfo(msft_typelib_t *typelib, type_t *enumeration)
|
|||
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ENUM, enumeration->name, enumeration->attrs);
|
||||
msft_typeinfo->typeinfo->size = 0;
|
||||
|
||||
if (enumeration->fields_or_args)
|
||||
LIST_FOR_EACH_ENTRY( cur, enumeration->fields_or_args, var_t, entry )
|
||||
if (type_enum_get_values(enumeration))
|
||||
LIST_FOR_EACH_ENTRY( cur, type_enum_get_values(enumeration), var_t, entry )
|
||||
add_var_desc(msft_typeinfo, idx++, cur);
|
||||
}
|
||||
|
||||
|
@ -2188,38 +2189,54 @@ static void add_module_typeinfo(msft_typelib_t *typelib, type_t *module)
|
|||
msft_typeinfo->typeinfo->size = idx;
|
||||
}
|
||||
|
||||
static void add_entry(msft_typelib_t *typelib, typelib_entry_t *entry)
|
||||
static void add_entry(msft_typelib_t *typelib, const statement_t *stmt)
|
||||
{
|
||||
switch(entry->type->kind) {
|
||||
case TKIND_INTERFACE:
|
||||
case TKIND_DISPATCH:
|
||||
add_interface_typeinfo(typelib, entry->type);
|
||||
switch(stmt->type) {
|
||||
case STMT_LIBRARY:
|
||||
case STMT_IMPORT:
|
||||
case STMT_CPPQUOTE:
|
||||
case STMT_DECLARATION:
|
||||
/* not included in typelib */
|
||||
break;
|
||||
|
||||
case TKIND_RECORD:
|
||||
add_structure_typeinfo(typelib, entry->type);
|
||||
case STMT_IMPORTLIB:
|
||||
/* not processed here */
|
||||
break;
|
||||
|
||||
case TKIND_ENUM:
|
||||
add_enum_typeinfo(typelib, entry->type);
|
||||
case STMT_TYPEDEF:
|
||||
{
|
||||
const type_list_t *type_entry = stmt->u.type_list;
|
||||
for (; type_entry; type_entry = type_entry->next)
|
||||
if (is_attr(type_entry->type->attrs, ATTR_PUBLIC))
|
||||
add_typedef_typeinfo(typelib, type_entry->type);
|
||||
break;
|
||||
|
||||
case TKIND_ALIAS:
|
||||
add_typedef_typeinfo(typelib, entry->type);
|
||||
}
|
||||
case STMT_MODULE:
|
||||
add_module_typeinfo(typelib, stmt->u.type);
|
||||
break;
|
||||
|
||||
case TKIND_COCLASS:
|
||||
add_coclass_typeinfo(typelib, entry->type);
|
||||
break;
|
||||
|
||||
case TKIND_MODULE:
|
||||
add_module_typeinfo(typelib, entry->type);
|
||||
break;
|
||||
|
||||
default:
|
||||
error("add_entry: unhandled type %d\n", entry->type->kind);
|
||||
case STMT_TYPE:
|
||||
case STMT_TYPEREF:
|
||||
{
|
||||
type_t *type = stmt->u.type;
|
||||
switch (type->kind) {
|
||||
case TKIND_INTERFACE:
|
||||
case TKIND_DISPATCH:
|
||||
add_interface_typeinfo(typelib, type);
|
||||
break;
|
||||
case TKIND_RECORD:
|
||||
add_structure_typeinfo(typelib, type);
|
||||
break;
|
||||
case TKIND_ENUM:
|
||||
add_enum_typeinfo(typelib, type);
|
||||
break;
|
||||
case TKIND_COCLASS:
|
||||
add_coclass_typeinfo(typelib, type);
|
||||
break;
|
||||
default:
|
||||
error("add_entry: unhandled type %d\n", type->kind);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void set_name(msft_typelib_t *typelib)
|
||||
|
@ -2494,7 +2511,7 @@ int create_msft_typelib(typelib_t *typelib)
|
|||
{
|
||||
msft_typelib_t *msft;
|
||||
int failed = 0;
|
||||
typelib_entry_t *entry;
|
||||
const statement_t *stmt;
|
||||
time_t cur_time;
|
||||
char *time_override;
|
||||
unsigned int version = 5 << 24 | 1 << 16 | 164; /* 5.01.0164 */
|
||||
|
@ -2547,8 +2564,9 @@ int create_msft_typelib(typelib_t *typelib)
|
|||
set_custdata(msft, &midl_time_guid, VT_UI4, &cur_time, &msft->typelib_header.CustomDataOffset);
|
||||
set_custdata(msft, &midl_version_guid, VT_UI4, &version, &msft->typelib_header.CustomDataOffset);
|
||||
|
||||
LIST_FOR_EACH_ENTRY( entry, &typelib->entries, typelib_entry_t, entry )
|
||||
add_entry(msft, entry);
|
||||
if (typelib->stmts)
|
||||
LIST_FOR_EACH_ENTRY( stmt, typelib->stmts, const statement_t, entry )
|
||||
add_entry(msft, stmt);
|
||||
|
||||
save_all_changes(msft);
|
||||
free(msft);
|
||||
|
|
Loading…
Reference in a new issue