mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 04:13:34 +00:00
- Switch to the new widl and new rpcrt4.
- Old widl had some more patches applies, and old rpcrt4 had Saveliy Tretiakov's patches applied. They were not explicitly added into this update (some of them might be reworked and got accepted by Wine). svn path=/trunk/; revision=31717
This commit is contained in:
@@ -15,10 +15,9 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
* TODO: Handle non-i386 architectures
|
||||
* Get rid of #if 0'ed code.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
@@ -45,7 +44,7 @@ struct StublessThunk;
|
||||
typedef struct {
|
||||
const IRpcProxyBufferVtbl *lpVtbl;
|
||||
LPVOID *PVtbl;
|
||||
DWORD RefCount;
|
||||
LONG RefCount;
|
||||
const MIDL_STUBLESS_PROXY_INFO *stubless;
|
||||
const IID* piid;
|
||||
LPUNKNOWN pUnkOuter;
|
||||
@@ -102,7 +101,7 @@ static HRESULT WINAPI ObjectStubless(DWORD index)
|
||||
|
||||
PFORMAT_STRING fs = This->stubless->ProcFormatString + This->stubless->FormatStringOffset[index];
|
||||
unsigned bytes = *(const WORD*)(fs+8) - STACK_ADJUST;
|
||||
TRACE("(%p)->(%ld)([%d bytes]) ret=%08lx\n", iface, index, bytes, *(DWORD*)(args+bytes));
|
||||
TRACE("(%p)->(%d)([%d bytes]) ret=%08x\n", iface, index, bytes, *(DWORD*)(args+bytes));
|
||||
|
||||
return NdrClientCall2(This->stubless->pStubDesc, fs, args);
|
||||
}
|
||||
@@ -174,7 +173,7 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
This->PVtbl = vtbl->Vtbl;
|
||||
|
||||
This->lpVtbl = &StdProxy_Vtbl;
|
||||
@@ -223,13 +222,13 @@ static HRESULT WINAPI StdProxy_QueryInterface(LPRPCPROXYBUFFER iface,
|
||||
if (IsEqualGUID(&IID_IUnknown,riid) ||
|
||||
IsEqualGUID(This->piid,riid)) {
|
||||
*obj = &This->PVtbl;
|
||||
This->RefCount++;
|
||||
InterlockedIncrement(&This->RefCount);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (IsEqualGUID(&IID_IRpcProxyBuffer,riid)) {
|
||||
*obj = &This->lpVtbl;
|
||||
This->RefCount++;
|
||||
InterlockedIncrement(&This->RefCount);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -241,19 +240,19 @@ static ULONG WINAPI StdProxy_AddRef(LPRPCPROXYBUFFER iface)
|
||||
ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
|
||||
TRACE("(%p)->AddRef()\n",This);
|
||||
|
||||
return ++(This->RefCount);
|
||||
return InterlockedIncrement(&This->RefCount);
|
||||
}
|
||||
|
||||
static ULONG WINAPI StdProxy_Release(LPRPCPROXYBUFFER iface)
|
||||
{
|
||||
ULONG refs;
|
||||
ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
|
||||
TRACE("(%p)->Release()\n",This);
|
||||
|
||||
if (!--(This->RefCount)) {
|
||||
refs = InterlockedDecrement(&This->RefCount);
|
||||
if (!refs)
|
||||
StdProxy_Destruct((LPRPCPROXYBUFFER)&This->lpVtbl);
|
||||
return 0;
|
||||
}
|
||||
return This->RefCount;
|
||||
return refs;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI StdProxy_Connect(LPRPCPROXYBUFFER iface,
|
||||
@@ -285,24 +284,22 @@ static const IRpcProxyBufferVtbl StdProxy_Vtbl =
|
||||
StdProxy_Disconnect
|
||||
};
|
||||
|
||||
HRESULT WINAPI StdProxy_GetChannel(LPVOID iface,
|
||||
LPRPCCHANNELBUFFER *ppChannel)
|
||||
static void StdProxy_GetChannel(LPVOID iface,
|
||||
LPRPCCHANNELBUFFER *ppChannel)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
|
||||
TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name);
|
||||
|
||||
*ppChannel = This->pChannel;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI StdProxy_GetIID(LPVOID iface,
|
||||
const IID **ppiid)
|
||||
static void StdProxy_GetIID(LPVOID iface,
|
||||
const IID **ppiid)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
|
||||
TRACE("(%p)->GetIID(%p) %s\n",This,ppiid,This->name);
|
||||
|
||||
*ppiid = This->piid;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IUnknown_QueryInterface_Proxy(LPUNKNOWN iface,
|
||||
@@ -318,32 +315,136 @@ ULONG WINAPI IUnknown_AddRef_Proxy(LPUNKNOWN iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
|
||||
TRACE("(%p)->AddRef() %s\n",This,This->name);
|
||||
#if 0 /* interface refcounting */
|
||||
return ++(This->RefCount);
|
||||
#else /* object refcounting */
|
||||
return IUnknown_AddRef(This->pUnkOuter);
|
||||
#endif
|
||||
}
|
||||
|
||||
ULONG WINAPI IUnknown_Release_Proxy(LPUNKNOWN iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
|
||||
TRACE("(%p)->Release() %s\n",This,This->name);
|
||||
#if 0 /* interface refcounting */
|
||||
if (!--(This->RefCount)) {
|
||||
StdProxy_Destruct((LPRPCPROXYBUFFER)&This->lpVtbl);
|
||||
return 0;
|
||||
}
|
||||
return This->RefCount;
|
||||
#else /* object refcounting */
|
||||
return IUnknown_Release(This->pUnkOuter);
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyInitialize [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrProxyInitialize(void *This,
|
||||
PRPC_MESSAGE pRpcMsg,
|
||||
PMIDL_STUB_MESSAGE pStubMsg,
|
||||
PMIDL_STUB_DESC pStubDescriptor,
|
||||
unsigned int ProcNum)
|
||||
{
|
||||
TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
|
||||
NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
|
||||
StdProxy_GetChannel(This, &pStubMsg->pRpcChannelBuffer);
|
||||
IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
|
||||
&pStubMsg->dwDestContext,
|
||||
&pStubMsg->pvDestContext);
|
||||
TRACE("channel=%p\n", pStubMsg->pRpcChannelBuffer);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyGetBuffer [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrProxyGetBuffer(void *This,
|
||||
PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
HRESULT hr;
|
||||
const IID *riid = NULL;
|
||||
|
||||
TRACE("(%p,%p)\n", This, pStubMsg);
|
||||
pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
|
||||
pStubMsg->dwStubPhase = PROXY_GETBUFFER;
|
||||
StdProxy_GetIID(This, &riid);
|
||||
hr = IRpcChannelBuffer_GetBuffer(pStubMsg->pRpcChannelBuffer,
|
||||
(RPCOLEMESSAGE*)pStubMsg->RpcMsg,
|
||||
riid);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
RpcRaiseException(hr);
|
||||
return;
|
||||
}
|
||||
pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
|
||||
pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
|
||||
pStubMsg->Buffer = pStubMsg->BufferStart;
|
||||
pStubMsg->dwStubPhase = PROXY_MARSHAL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxySendReceive [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrProxySendReceive(void *This,
|
||||
PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
ULONG Status = 0;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%p)\n", This, pStubMsg);
|
||||
|
||||
if (!pStubMsg->pRpcChannelBuffer)
|
||||
{
|
||||
WARN("Trying to use disconnected proxy %p\n", This);
|
||||
RpcRaiseException(RPC_E_DISCONNECTED);
|
||||
}
|
||||
|
||||
pStubMsg->dwStubPhase = PROXY_SENDRECEIVE;
|
||||
hr = IRpcChannelBuffer_SendReceive(pStubMsg->pRpcChannelBuffer,
|
||||
(RPCOLEMESSAGE*)pStubMsg->RpcMsg,
|
||||
&Status);
|
||||
pStubMsg->dwStubPhase = PROXY_UNMARSHAL;
|
||||
pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength;
|
||||
pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
|
||||
pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
|
||||
pStubMsg->Buffer = pStubMsg->BufferStart;
|
||||
|
||||
/* raise exception if call failed */
|
||||
if (hr == RPC_S_CALL_FAILED) RpcRaiseException(*(DWORD*)pStubMsg->Buffer);
|
||||
else if (FAILED(hr)) RpcRaiseException(hr);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyFreeBuffer [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrProxyFreeBuffer(void *This,
|
||||
PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%p)\n", This, pStubMsg);
|
||||
hr = IRpcChannelBuffer_FreeBuffer(pStubMsg->pRpcChannelBuffer,
|
||||
(RPCOLEMESSAGE*)pStubMsg->RpcMsg);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyErrorHandler [RPCRT4.@]
|
||||
*/
|
||||
HRESULT WINAPI NdrProxyErrorHandler(DWORD dwExceptionCode)
|
||||
{
|
||||
WARN("(0x%08x): a proxy call failed\n", dwExceptionCode);
|
||||
|
||||
if (FAILED(dwExceptionCode))
|
||||
return dwExceptionCode;
|
||||
else
|
||||
return HRESULT_FROM_WIN32(dwExceptionCode);
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
|
||||
LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv )
|
||||
{
|
||||
typedef INT (WINAPI *MessageBoxA)(HWND,LPCSTR,LPCSTR,UINT);
|
||||
HMODULE hUser32 = LoadLibraryA("user32");
|
||||
MessageBoxA pMessageBoxA = (void *)GetProcAddress(hUser32, "MessageBoxA");
|
||||
|
||||
FIXME("%p %p %s %p %p\n", pTypeInfo, pUnkOuter, debugstr_guid(riid), ppProxy, ppv);
|
||||
if (pMessageBoxA)
|
||||
{
|
||||
pMessageBoxA(NULL,
|
||||
"The native implementation of OLEAUT32.DLL cannot be used "
|
||||
"with Wine's RPCRT4.DLL. Remove OLEAUT32.DLL and try again.\n",
|
||||
"Wine: Unimplemented CreateProxyFromTypeInfo",
|
||||
0x10);
|
||||
ExitProcess(1);
|
||||
}
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
@@ -110,6 +110,12 @@ static HRESULT WINAPI CStdPSFactory_CreateStub(LPPSFACTORYBUFFER iface,
|
||||
pUnkServer,ppStub);
|
||||
if (!FindProxyInfo(This->pProxyFileList,riid,&ProxyInfo,&Index))
|
||||
return E_NOINTERFACE;
|
||||
|
||||
if(ProxyInfo->pDelegatedIIDs && ProxyInfo->pDelegatedIIDs[Index])
|
||||
return CStdStubBuffer_Delegating_Construct(riid, pUnkServer, ProxyInfo->pNamesArray[Index],
|
||||
ProxyInfo->pStubVtblList[Index], ProxyInfo->pDelegatedIIDs[Index],
|
||||
iface, ppStub);
|
||||
|
||||
return CStdStubBuffer_Construct(riid, pUnkServer, ProxyInfo->pNamesArray[Index],
|
||||
ProxyInfo->pStubVtblList[Index], iface, ppStub);
|
||||
}
|
||||
@@ -138,6 +144,7 @@ HRESULT WINAPI NdrDllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv,
|
||||
*ppv = NULL;
|
||||
if (!pPSFactoryBuffer->lpVtbl) {
|
||||
const ProxyFileInfo **pProxyFileList2;
|
||||
int max_delegating_vtbl_size = 0;
|
||||
pPSFactoryBuffer->lpVtbl = &CStdPSFactory_Vtbl;
|
||||
pPSFactoryBuffer->RefCount = 0;
|
||||
pPSFactoryBuffer->pProxyFileList = pProxyFileList;
|
||||
@@ -150,11 +157,19 @@ HRESULT WINAPI NdrDllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv,
|
||||
void **pRpcStubVtbl = (void **)&(*pProxyFileList2)->pStubVtblList[i]->Vtbl;
|
||||
int j;
|
||||
|
||||
if ((*pProxyFileList2)->pDelegatedIIDs && (*pProxyFileList2)->pDelegatedIIDs[i]) {
|
||||
pSrcRpcStubVtbl = (void * const *)&CStdStubBuffer_Delegating_Vtbl;
|
||||
if ((*pProxyFileList2)->pStubVtblList[i]->header.DispatchTableCount > max_delegating_vtbl_size)
|
||||
max_delegating_vtbl_size = (*pProxyFileList2)->pStubVtblList[i]->header.DispatchTableCount;
|
||||
}
|
||||
|
||||
for (j = 0; j < sizeof(IRpcStubBufferVtbl)/sizeof(void *); j++)
|
||||
if (!pRpcStubVtbl[j])
|
||||
pRpcStubVtbl[j] = pSrcRpcStubVtbl[j];
|
||||
}
|
||||
}
|
||||
if(max_delegating_vtbl_size > 0)
|
||||
create_delegating_vtbl(max_delegating_vtbl_size);
|
||||
}
|
||||
if (IsEqualGUID(rclsid, pclsid))
|
||||
return IPSFactoryBuffer_QueryInterface((LPPSFACTORYBUFFER)pPSFactoryBuffer, iid, ppv);
|
||||
@@ -210,7 +225,7 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
|
||||
if (RegCreateKeyExA(HKEY_CLASSES_ROOT, keyname, 0, NULL, 0,
|
||||
KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS) {
|
||||
if (name)
|
||||
RegSetValueExA(key, NULL, 0, REG_SZ, (LPBYTE)name, strlen(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);
|
||||
@@ -230,9 +245,11 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
|
||||
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);
|
||||
}
|
||||
RegCloseKey(key);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __WINE_CPSF_H
|
||||
@@ -28,10 +28,6 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
||||
LPPSFACTORYBUFFER pPSFactory,
|
||||
LPRPCPROXYBUFFER *ppProxy,
|
||||
LPVOID *ppvObj);
|
||||
HRESULT WINAPI StdProxy_GetChannel(LPVOID iface,
|
||||
LPRPCCHANNELBUFFER *ppChannel);
|
||||
HRESULT WINAPI StdProxy_GetIID(LPVOID iface,
|
||||
const IID **piid);
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
|
||||
LPUNKNOWN pUnkServer,
|
||||
@@ -40,8 +36,21 @@ HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
|
||||
LPPSFACTORYBUFFER pPSFactory,
|
||||
LPRPCSTUBBUFFER *ppStub);
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_Delegating_Construct(REFIID riid,
|
||||
LPUNKNOWN pUnkServer,
|
||||
PCInterfaceName name,
|
||||
CInterfaceStubVtbl *vtbl,
|
||||
REFIID delegating_iid,
|
||||
LPPSFACTORYBUFFER pPSFactory,
|
||||
LPRPCSTUBBUFFER *ppStub);
|
||||
|
||||
const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface);
|
||||
|
||||
const IRpcStubBufferVtbl CStdStubBuffer_Vtbl;
|
||||
const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl;
|
||||
|
||||
void create_delegating_vtbl(DWORD num_methods);
|
||||
|
||||
HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub);
|
||||
|
||||
#endif /* __WINE_CPSF_H */
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
@@ -25,18 +25,38 @@
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "excpt.h"
|
||||
|
||||
#include "objbase.h"
|
||||
|
||||
#include "rpcproxy.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/exception.h"
|
||||
|
||||
#include "cpsf.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
#define STUB_HEADER(This) (((CInterfaceStubHeader*)((This)->lpVtbl))[-1])
|
||||
#define STUB_HEADER(This) (((const CInterfaceStubHeader*)((This)->lpVtbl))[-1])
|
||||
|
||||
static WINE_EXCEPTION_FILTER(stub_filter)
|
||||
{
|
||||
if (GetExceptionInformation()->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
IUnknownVtbl *base_obj;
|
||||
IRpcStubBuffer *base_stub;
|
||||
CStdStubBuffer stub_buffer;
|
||||
} cstdstubbuffer_delegating_t;
|
||||
|
||||
static inline cstdstubbuffer_delegating_t *impl_from_delegating( IRpcStubBuffer *iface )
|
||||
{
|
||||
return (cstdstubbuffer_delegating_t*)((char *)iface - FIELD_OFFSET(cstdstubbuffer_delegating_t, stub_buffer));
|
||||
}
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
|
||||
LPUNKNOWN pUnkServer,
|
||||
@@ -46,7 +66,8 @@ HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
|
||||
LPRPCSTUBBUFFER *ppStub)
|
||||
{
|
||||
CStdStubBuffer *This;
|
||||
|
||||
IUnknown *pvServer;
|
||||
HRESULT r;
|
||||
TRACE("(%p,%p,%p,%p) %s\n", pUnkServer, vtbl, pPSFactory, ppStub, name);
|
||||
TRACE("iid=%s\n", debugstr_guid(vtbl->header.piid));
|
||||
TRACE("vtbl=%p\n", &vtbl->Vtbl);
|
||||
@@ -56,20 +77,244 @@ HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
|
||||
return RPC_E_UNEXPECTED;
|
||||
}
|
||||
|
||||
r = IUnknown_QueryInterface(pUnkServer, riid, (void**)&pvServer);
|
||||
if(FAILED(r))
|
||||
return r;
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(CStdStubBuffer));
|
||||
if (!This) return E_OUTOFMEMORY;
|
||||
if (!This) {
|
||||
IUnknown_Release(pvServer);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
This->lpVtbl = &vtbl->Vtbl;
|
||||
This->RefCount = 1;
|
||||
This->pvServerObject = pUnkServer;
|
||||
This->pvServerObject = pvServer;
|
||||
This->pPSFactory = pPSFactory;
|
||||
*ppStub = (LPRPCSTUBBUFFER)This;
|
||||
|
||||
IUnknown_AddRef(This->pvServerObject);
|
||||
IPSFactoryBuffer_AddRef(pPSFactory);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static CRITICAL_SECTION delegating_vtbl_section;
|
||||
static CRITICAL_SECTION_DEBUG critsect_debug =
|
||||
{
|
||||
0, 0, &delegating_vtbl_section,
|
||||
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
|
||||
0, 0, { (DWORD_PTR)(__FILE__ ": delegating_vtbl_section") }
|
||||
};
|
||||
static CRITICAL_SECTION delegating_vtbl_section = { &critsect_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD ref;
|
||||
DWORD size;
|
||||
void **methods;
|
||||
IUnknownVtbl vtbl;
|
||||
/* remaining entries in vtbl */
|
||||
} ref_counted_vtbl;
|
||||
|
||||
static struct
|
||||
{
|
||||
ref_counted_vtbl *table;
|
||||
} current_vtbl;
|
||||
|
||||
|
||||
static HRESULT WINAPI delegating_QueryInterface(IUnknown *pUnk, REFIID iid, void **ppv)
|
||||
{
|
||||
*ppv = (void *)pUnk;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static ULONG WINAPI delegating_AddRef(IUnknown *pUnk)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static ULONG WINAPI delegating_Release(IUnknown *pUnk)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(__i386__)
|
||||
|
||||
/* The idea here is to replace the first param on the stack
|
||||
ie. This (which will point to cstdstubbuffer_delegating_t)
|
||||
with This->stub_buffer.pvServerObject and then jump to the
|
||||
relevant offset in This->stub_buffer.pvServerObject's vtbl.
|
||||
*/
|
||||
#include "pshpack1.h"
|
||||
typedef struct {
|
||||
DWORD mov1; /* mov 0x4(%esp), %eax 8b 44 24 04 */
|
||||
WORD mov2; /* mov 0x10(%eax), %eax 8b 40 */
|
||||
BYTE sixteen; /* 10 */
|
||||
DWORD mov3; /* mov %eax, 0x4(%esp) 89 44 24 04 */
|
||||
WORD mov4; /* mov (%eax), %eax 8b 00 */
|
||||
WORD mov5; /* mov offset(%eax), %eax 8b 80 */
|
||||
DWORD offset; /* xx xx xx xx */
|
||||
WORD jmp; /* jmp *%eax ff e0 */
|
||||
BYTE pad[3]; /* lea 0x0(%esi), %esi 8d 76 00 */
|
||||
} vtbl_method_t;
|
||||
#include "poppack.h"
|
||||
|
||||
static void fill_table(IUnknownVtbl *vtbl, void **methods, DWORD num)
|
||||
{
|
||||
vtbl_method_t *method;
|
||||
void **entry;
|
||||
DWORD i;
|
||||
|
||||
vtbl->QueryInterface = delegating_QueryInterface;
|
||||
vtbl->AddRef = delegating_AddRef;
|
||||
vtbl->Release = delegating_Release;
|
||||
|
||||
method = (vtbl_method_t*)methods;
|
||||
entry = (void**)(vtbl + 1);
|
||||
|
||||
for(i = 3; i < num; i++)
|
||||
{
|
||||
*entry = method;
|
||||
method->mov1 = 0x0424448b;
|
||||
method->mov2 = 0x408b;
|
||||
method->sixteen = 0x10;
|
||||
method->mov3 = 0x04244489;
|
||||
method->mov4 = 0x008b;
|
||||
method->mov5 = 0x808b;
|
||||
method->offset = i << 2;
|
||||
method->jmp = 0xe0ff;
|
||||
method->pad[0] = 0x8d;
|
||||
method->pad[1] = 0x76;
|
||||
method->pad[2] = 0x00;
|
||||
|
||||
method++;
|
||||
entry++;
|
||||
}
|
||||
}
|
||||
|
||||
#else /* __i386__ */
|
||||
|
||||
typedef struct {int dummy;} vtbl_method_t;
|
||||
static void fill_table(IUnknownVtbl *vtbl, DWORD num)
|
||||
{
|
||||
ERR("delegated stubs are not supported on this architecture\n");
|
||||
}
|
||||
|
||||
#endif /* __i386__ */
|
||||
|
||||
void create_delegating_vtbl(DWORD num_methods)
|
||||
{
|
||||
TRACE("%d\n", num_methods);
|
||||
if(num_methods <= 3)
|
||||
{
|
||||
ERR("should have more than %d methods\n", num_methods);
|
||||
return;
|
||||
}
|
||||
|
||||
EnterCriticalSection(&delegating_vtbl_section);
|
||||
if(!current_vtbl.table || num_methods > current_vtbl.table->size)
|
||||
{
|
||||
DWORD size;
|
||||
DWORD old_protect;
|
||||
if(current_vtbl.table && current_vtbl.table->ref == 0)
|
||||
{
|
||||
TRACE("freeing old table\n");
|
||||
VirtualFree(current_vtbl.table->methods,
|
||||
(current_vtbl.table->size - 3) * sizeof(vtbl_method_t),
|
||||
MEM_RELEASE);
|
||||
HeapFree(GetProcessHeap(), 0, current_vtbl.table);
|
||||
}
|
||||
size = (num_methods - 3) * sizeof(vtbl_method_t);
|
||||
current_vtbl.table = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(ref_counted_vtbl, vtbl) + num_methods * sizeof(void*));
|
||||
current_vtbl.table->ref = 0;
|
||||
current_vtbl.table->size = num_methods;
|
||||
current_vtbl.table->methods = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||
fill_table(¤t_vtbl.table->vtbl, current_vtbl.table->methods, num_methods);
|
||||
VirtualProtect(current_vtbl.table->methods, size, PAGE_EXECUTE_READ, &old_protect);
|
||||
}
|
||||
LeaveCriticalSection(&delegating_vtbl_section);
|
||||
}
|
||||
|
||||
static IUnknownVtbl *get_delegating_vtbl(void)
|
||||
{
|
||||
IUnknownVtbl *ret;
|
||||
|
||||
EnterCriticalSection(&delegating_vtbl_section);
|
||||
current_vtbl.table->ref++;
|
||||
ret = ¤t_vtbl.table->vtbl;
|
||||
LeaveCriticalSection(&delegating_vtbl_section);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void release_delegating_vtbl(IUnknownVtbl *vtbl)
|
||||
{
|
||||
ref_counted_vtbl *table = (ref_counted_vtbl*)((DWORD *)vtbl - 1);
|
||||
|
||||
EnterCriticalSection(&delegating_vtbl_section);
|
||||
table->ref--;
|
||||
TRACE("ref now %d\n", table->ref);
|
||||
if(table->ref == 0 && table != current_vtbl.table)
|
||||
{
|
||||
TRACE("... and we're not current so free'ing\n");
|
||||
VirtualFree(current_vtbl.table->methods,
|
||||
(current_vtbl.table->size - 3) * sizeof(vtbl_method_t),
|
||||
MEM_RELEASE);
|
||||
HeapFree(GetProcessHeap(), 0, table);
|
||||
}
|
||||
LeaveCriticalSection(&delegating_vtbl_section);
|
||||
}
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_Delegating_Construct(REFIID riid,
|
||||
LPUNKNOWN pUnkServer,
|
||||
PCInterfaceName name,
|
||||
CInterfaceStubVtbl *vtbl,
|
||||
REFIID delegating_iid,
|
||||
LPPSFACTORYBUFFER pPSFactory,
|
||||
LPRPCSTUBBUFFER *ppStub)
|
||||
{
|
||||
cstdstubbuffer_delegating_t *This;
|
||||
IUnknown *pvServer;
|
||||
HRESULT r;
|
||||
|
||||
TRACE("(%p,%p,%p,%p) %s\n", pUnkServer, vtbl, pPSFactory, ppStub, name);
|
||||
TRACE("iid=%s delegating to %s\n", debugstr_guid(vtbl->header.piid), debugstr_guid(delegating_iid));
|
||||
TRACE("vtbl=%p\n", &vtbl->Vtbl);
|
||||
|
||||
if (!IsEqualGUID(vtbl->header.piid, riid))
|
||||
{
|
||||
ERR("IID mismatch during stub creation\n");
|
||||
return RPC_E_UNEXPECTED;
|
||||
}
|
||||
|
||||
r = IUnknown_QueryInterface(pUnkServer, riid, (void**)&pvServer);
|
||||
if(FAILED(r)) return r;
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
|
||||
if (!This)
|
||||
{
|
||||
IUnknown_Release(pvServer);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
This->base_obj = get_delegating_vtbl();
|
||||
r = create_stub(delegating_iid, (IUnknown*)&This->base_obj, &This->base_stub);
|
||||
if(FAILED(r))
|
||||
{
|
||||
release_delegating_vtbl(This->base_obj);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
IUnknown_Release(pvServer);
|
||||
return r;
|
||||
}
|
||||
|
||||
This->stub_buffer.lpVtbl = &vtbl->Vtbl;
|
||||
This->stub_buffer.RefCount = 1;
|
||||
This->stub_buffer.pvServerObject = pvServer;
|
||||
This->stub_buffer.pPSFactory = pPSFactory;
|
||||
*ppStub = (LPRPCSTUBBUFFER)&This->stub_buffer;
|
||||
|
||||
IPSFactoryBuffer_AddRef(pPSFactory);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface,
|
||||
REFIID riid,
|
||||
LPVOID *obj)
|
||||
@@ -77,12 +322,14 @@ HRESULT WINAPI CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface,
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj);
|
||||
|
||||
if (IsEqualGUID(&IID_IUnknown,riid) ||
|
||||
IsEqualGUID(&IID_IRpcStubBuffer,riid)) {
|
||||
*obj = This;
|
||||
This->RefCount++;
|
||||
if (IsEqualIID(&IID_IUnknown, riid) ||
|
||||
IsEqualIID(&IID_IRpcStubBuffer, riid))
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
*obj = iface;
|
||||
return S_OK;
|
||||
}
|
||||
*obj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
@@ -90,50 +337,81 @@ ULONG WINAPI CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
TRACE("(%p)->AddRef()\n",This);
|
||||
return ++(This->RefCount);
|
||||
return InterlockedIncrement(&This->RefCount);
|
||||
}
|
||||
|
||||
ULONG WINAPI NdrCStdStubBuffer_Release(LPRPCSTUBBUFFER iface,
|
||||
LPPSFACTORYBUFFER pPSF)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
ULONG refs;
|
||||
|
||||
TRACE("(%p)->Release()\n",This);
|
||||
|
||||
if (!--(This->RefCount)) {
|
||||
refs = InterlockedDecrement(&This->RefCount);
|
||||
if (!refs)
|
||||
{
|
||||
/* test_Release shows that native doesn't call Disconnect here.
|
||||
We'll leave it in for the time being. */
|
||||
IRpcStubBuffer_Disconnect(iface);
|
||||
if(This->pPSFactory)
|
||||
IPSFactoryBuffer_Release(This->pPSFactory);
|
||||
|
||||
IPSFactoryBuffer_Release(pPSF);
|
||||
HeapFree(GetProcessHeap(),0,This);
|
||||
return 0;
|
||||
}
|
||||
return This->RefCount;
|
||||
return refs;
|
||||
}
|
||||
|
||||
ULONG WINAPI NdrCStdStubBuffer2_Release(LPRPCSTUBBUFFER iface,
|
||||
LPPSFACTORYBUFFER pPSF)
|
||||
{
|
||||
FIXME("Not implemented\n");
|
||||
return 0;
|
||||
cstdstubbuffer_delegating_t *This = impl_from_delegating( iface );
|
||||
ULONG refs;
|
||||
|
||||
TRACE("(%p)->Release()\n", This);
|
||||
|
||||
refs = InterlockedDecrement(&This->stub_buffer.RefCount);
|
||||
if (!refs)
|
||||
{
|
||||
/* Just like NdrCStdStubBuffer_Release, we shouldn't call
|
||||
Disconnect here */
|
||||
IRpcStubBuffer_Disconnect((IRpcStubBuffer *)&This->stub_buffer);
|
||||
|
||||
IRpcStubBuffer_Release(This->base_stub);
|
||||
release_delegating_vtbl(This->base_obj);
|
||||
|
||||
IPSFactoryBuffer_Release(pPSF);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
return refs;
|
||||
}
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface,
|
||||
LPUNKNOWN lpUnkServer)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
TRACE("(%p)->Connect(%p)\n",This,lpUnkServer);
|
||||
This->pvServerObject = lpUnkServer;
|
||||
return S_OK;
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
HRESULT r;
|
||||
IUnknown *new = NULL;
|
||||
|
||||
TRACE("(%p)->Connect(%p)\n",This,lpUnkServer);
|
||||
|
||||
r = IUnknown_QueryInterface(lpUnkServer, STUB_HEADER(This).piid, (void**)&new);
|
||||
new = InterlockedExchangePointer((void**)&This->pvServerObject, new);
|
||||
if(new)
|
||||
IUnknown_Release(new);
|
||||
return r;
|
||||
}
|
||||
|
||||
void WINAPI CStdStubBuffer_Disconnect(LPRPCSTUBBUFFER iface)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
TRACE("(%p)->Disconnect()\n",This);
|
||||
if (This->pvServerObject)
|
||||
{
|
||||
IUnknown_Release(This->pvServerObject);
|
||||
This->pvServerObject = NULL;
|
||||
}
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
IUnknown *old;
|
||||
TRACE("(%p)->Disconnect()\n",This);
|
||||
|
||||
old = InterlockedExchangePointer((void**)&This->pvServerObject, NULL);
|
||||
|
||||
if(old)
|
||||
IUnknown_Release(old);
|
||||
}
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,
|
||||
@@ -142,13 +420,29 @@ HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
DWORD dwPhase = STUB_UNMARSHAL;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("(%p)->Invoke(%p,%p)\n",This,pMsg,pChannel);
|
||||
|
||||
if (STUB_HEADER(This).pDispatchTable)
|
||||
STUB_HEADER(This).pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
|
||||
else /* pure interpreted */
|
||||
NdrStubCall2(iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
|
||||
return S_OK;
|
||||
__TRY
|
||||
{
|
||||
if (STUB_HEADER(This).pDispatchTable)
|
||||
STUB_HEADER(This).pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
|
||||
else /* pure interpreted */
|
||||
NdrStubCall2(iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
|
||||
}
|
||||
__EXCEPT(stub_filter)
|
||||
{
|
||||
DWORD dwExceptionCode = GetExceptionCode();
|
||||
WARN("a stub call failed with exception 0x%08x (%d)\n", dwExceptionCode, dwExceptionCode);
|
||||
if (FAILED(dwExceptionCode))
|
||||
hr = dwExceptionCode;
|
||||
else
|
||||
hr = HRESULT_FROM_WIN32(dwExceptionCode);
|
||||
}
|
||||
__ENDTRY
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface,
|
||||
@@ -195,8 +489,111 @@ const IRpcStubBufferVtbl CStdStubBuffer_Vtbl =
|
||||
CStdStubBuffer_DebugServerRelease
|
||||
};
|
||||
|
||||
static HRESULT WINAPI CStdStubBuffer_Delegating_Connect(LPRPCSTUBBUFFER iface,
|
||||
LPUNKNOWN lpUnkServer)
|
||||
{
|
||||
cstdstubbuffer_delegating_t *This = impl_from_delegating(iface);
|
||||
HRESULT r;
|
||||
TRACE("(%p)->Connect(%p)\n", This, lpUnkServer);
|
||||
|
||||
r = CStdStubBuffer_Connect(iface, lpUnkServer);
|
||||
if(SUCCEEDED(r))
|
||||
r = IRpcStubBuffer_Connect(This->base_stub, (IUnknown*)&This->base_obj);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static void WINAPI CStdStubBuffer_Delegating_Disconnect(LPRPCSTUBBUFFER iface)
|
||||
{
|
||||
cstdstubbuffer_delegating_t *This = impl_from_delegating(iface);
|
||||
TRACE("(%p)->Disconnect()\n", This);
|
||||
|
||||
IRpcStubBuffer_Disconnect(This->base_stub);
|
||||
CStdStubBuffer_Disconnect(iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI CStdStubBuffer_Delegating_CountRefs(LPRPCSTUBBUFFER iface)
|
||||
{
|
||||
cstdstubbuffer_delegating_t *This = impl_from_delegating(iface);
|
||||
ULONG ret;
|
||||
TRACE("(%p)->CountRefs()\n", This);
|
||||
|
||||
ret = CStdStubBuffer_CountRefs(iface);
|
||||
ret += IRpcStubBuffer_CountRefs(This->base_stub);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl =
|
||||
{
|
||||
CStdStubBuffer_QueryInterface,
|
||||
CStdStubBuffer_AddRef,
|
||||
NULL,
|
||||
CStdStubBuffer_Delegating_Connect,
|
||||
CStdStubBuffer_Delegating_Disconnect,
|
||||
CStdStubBuffer_Invoke,
|
||||
CStdStubBuffer_IsIIDSupported,
|
||||
CStdStubBuffer_Delegating_CountRefs,
|
||||
CStdStubBuffer_DebugServerQueryInterface,
|
||||
CStdStubBuffer_DebugServerRelease
|
||||
};
|
||||
|
||||
const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
return STUB_HEADER(This).pServerInfo;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* NdrStubForwardingFunction [RPCRT4.@]
|
||||
*/
|
||||
void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *iface, IRpcChannelBuffer *pChannel,
|
||||
PRPC_MESSAGE pMsg, DWORD *pdwStubPhase )
|
||||
{
|
||||
/* Note pMsg is passed intact since RPCOLEMESSAGE is basically a RPC_MESSAGE. */
|
||||
|
||||
cstdstubbuffer_delegating_t *This = impl_from_delegating(iface);
|
||||
HRESULT r = IRpcStubBuffer_Invoke(This->base_stub, (RPCOLEMESSAGE*)pMsg, pChannel);
|
||||
if(FAILED(r)) RpcRaiseException(r);
|
||||
return;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrStubInitialize [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrStubInitialize(PRPC_MESSAGE pRpcMsg,
|
||||
PMIDL_STUB_MESSAGE pStubMsg,
|
||||
PMIDL_STUB_DESC pStubDescriptor,
|
||||
LPRPCCHANNELBUFFER pRpcChannelBuffer)
|
||||
{
|
||||
TRACE("(%p,%p,%p,%p)\n", pRpcMsg, pStubMsg, pStubDescriptor, pRpcChannelBuffer);
|
||||
NdrServerInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor);
|
||||
pStubMsg->pRpcChannelBuffer = pRpcChannelBuffer;
|
||||
IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
|
||||
&pStubMsg->dwDestContext,
|
||||
&pStubMsg->pvDestContext);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrStubGetBuffer [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrStubGetBuffer(LPRPCSTUBBUFFER iface,
|
||||
LPRPCCHANNELBUFFER pRpcChannelBuffer,
|
||||
PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p, %p, %p)\n", This, pRpcChannelBuffer, pStubMsg);
|
||||
|
||||
pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
|
||||
hr = IRpcChannelBuffer_GetBuffer(pRpcChannelBuffer,
|
||||
(RPCOLEMESSAGE *)pStubMsg->RpcMsg, STUB_HEADER(This).piid);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
RpcRaiseException(hr);
|
||||
return;
|
||||
}
|
||||
|
||||
pStubMsg->Buffer = pStubMsg->RpcMsg->Buffer;
|
||||
}
|
||||
|
||||
@@ -1,373 +0,0 @@
|
||||
/*
|
||||
* Context Handle Functions
|
||||
*
|
||||
* Copyright 2006 Saveliy Tretiakov
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "rpc.h"
|
||||
#include "rpcndr.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "rpc_binding.h"
|
||||
#include "ndr_contexth.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(rpcrt4);
|
||||
|
||||
static SContextHandle *CtxList = NULL;
|
||||
|
||||
static CRITICAL_SECTION CtxList_cs;
|
||||
static CRITICAL_SECTION_DEBUG CtxList_cs_debug =
|
||||
{
|
||||
0, 0, &CtxList_cs,
|
||||
{ &CtxList_cs_debug.ProcessLocksList, &CtxList_cs_debug.ProcessLocksList },
|
||||
0, 0, { (DWORD_PTR)(__FILE__ ": CtxList_cs") }
|
||||
};
|
||||
static CRITICAL_SECTION CtxList_cs = { &CtxList_cs_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
SContextHandle* RPCRT4_SrvAllocCtxHdl()
|
||||
{
|
||||
SContextHandle *Hdl, *Tmp;
|
||||
|
||||
if((Hdl = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(SContextHandle)))==NULL) return NULL;
|
||||
|
||||
EnterCriticalSection(&CtxList_cs);
|
||||
|
||||
if(!CtxList) CtxList = Hdl;
|
||||
else
|
||||
{
|
||||
for(Tmp = CtxList; Tmp->Next; Tmp = Tmp->Next);
|
||||
Tmp->Next = Hdl;
|
||||
Hdl->Prev = Tmp;
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&CtxList_cs);
|
||||
|
||||
return Hdl;
|
||||
}
|
||||
|
||||
void RPCRT4_SrvFreeCtxHdl(SContextHandle *Hdl)
|
||||
{
|
||||
EnterCriticalSection(&CtxList_cs);
|
||||
|
||||
if(Hdl->Prev && Hdl->Next)
|
||||
{
|
||||
((SContextHandle*)Hdl->Prev)->Next = Hdl->Next;
|
||||
((SContextHandle*)Hdl->Next)->Prev = Hdl->Prev;
|
||||
}
|
||||
else if(Hdl->Next)
|
||||
{
|
||||
((SContextHandle*)Hdl->Next)->Prev = NULL;
|
||||
CtxList = (SContextHandle*)Hdl->Next;
|
||||
}
|
||||
else if(Hdl->Prev)
|
||||
((SContextHandle*)Hdl->Prev)->Next = NULL;
|
||||
else CtxList = NULL;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, Hdl);
|
||||
LeaveCriticalSection(&CtxList_cs);
|
||||
}
|
||||
|
||||
SContextHandle* RPCRT4_SrvFindCtxHdl(ContextHandleNdr *CtxNdr)
|
||||
{
|
||||
SContextHandle *Hdl, *Ret=NULL;
|
||||
RPC_STATUS status;
|
||||
EnterCriticalSection(&CtxList_cs);
|
||||
|
||||
for(Hdl = CtxList; Hdl; Hdl = Hdl->Next)
|
||||
if(UuidCompare(&Hdl->Ndr.uuid, &CtxNdr->uuid, &status)==0)
|
||||
{
|
||||
Ret = Hdl;
|
||||
break;
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&CtxList_cs);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
SContextHandle* RPCRT4_SrvUnmarshallCtxHdl(ContextHandleNdr *Ndr)
|
||||
{
|
||||
SContextHandle *Hdl = NULL;
|
||||
RPC_STATUS status;
|
||||
|
||||
if(!Ndr)
|
||||
{
|
||||
if((Hdl = RPCRT4_SrvAllocCtxHdl())==NULL)
|
||||
RpcRaiseException(ERROR_OUTOFMEMORY);
|
||||
|
||||
UuidCreate(&Hdl->Ndr.uuid);
|
||||
}
|
||||
else if(!UuidIsNil(&Ndr->uuid, &status))
|
||||
Hdl = RPCRT4_SrvFindCtxHdl(Ndr);
|
||||
|
||||
return Hdl;
|
||||
}
|
||||
|
||||
void RPCRT4_SrvMarshallCtxHdl(SContextHandle *Hdl, ContextHandleNdr *Ndr)
|
||||
{
|
||||
if(!Hdl->Value)
|
||||
{
|
||||
RPCRT4_SrvFreeCtxHdl(Hdl);
|
||||
ZeroMemory(Ndr, sizeof(ContextHandleNdr));
|
||||
}
|
||||
else memcpy(Ndr, &Hdl->Ndr, sizeof(ContextHandleNdr));
|
||||
}
|
||||
|
||||
void RPCRT4_DoContextRundownIfNeeded(RpcConnection *Conn)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NDRCContextBinding
|
||||
*/
|
||||
RPC_BINDING_HANDLE WINAPI NDRCContextBinding(NDR_CCONTEXT CContext)
|
||||
{
|
||||
if(!CContext)
|
||||
RpcRaiseException(ERROR_INVALID_HANDLE);
|
||||
|
||||
return (RPC_BINDING_HANDLE)((CContextHandle*)CContext)->Binding;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NDRCContextMarshall
|
||||
*/
|
||||
void WINAPI NDRCContextMarshall(NDR_CCONTEXT CContext, void *pBuff )
|
||||
{
|
||||
CContextHandle *ctx = (CContextHandle*)CContext;
|
||||
memcpy(pBuff, &ctx->Ndr, sizeof(ContextHandleNdr));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrClientContextMarshall
|
||||
*/
|
||||
void WINAPI NdrClientContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
NDR_CCONTEXT ContextHandle,
|
||||
int fCheck)
|
||||
{
|
||||
if(!ContextHandle)
|
||||
RpcRaiseException(ERROR_INVALID_HANDLE);
|
||||
|
||||
NDRCContextMarshall(ContextHandle, pStubMsg->Buffer);
|
||||
|
||||
pStubMsg->Buffer += sizeof(ContextHandleNdr);
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NDRCContextUnmarshall
|
||||
*/
|
||||
void WINAPI NDRCContextUnmarshall(NDR_CCONTEXT *pCContext,
|
||||
RPC_BINDING_HANDLE hBinding,
|
||||
void *pBuff,
|
||||
unsigned long DataRepresentation )
|
||||
{
|
||||
CContextHandle *ctx = (CContextHandle*)*pCContext;
|
||||
ContextHandleNdr *ndr = (ContextHandleNdr*)pBuff;
|
||||
RPC_STATUS status;
|
||||
|
||||
if(UuidIsNil(&ndr->uuid, &status))
|
||||
{
|
||||
if(ctx)
|
||||
{
|
||||
RPCRT4_DestroyBinding(ctx->Binding);
|
||||
HeapFree(GetProcessHeap(), 0, ctx);
|
||||
}
|
||||
*pCContext = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ctx = HeapAlloc(GetProcessHeap(), 0, sizeof(CContextHandle));
|
||||
if(!ctx) RpcRaiseException(ERROR_OUTOFMEMORY);
|
||||
|
||||
status = RpcBindingCopy(hBinding, (RPC_BINDING_HANDLE*) &ctx->Binding);
|
||||
if(status != RPC_S_OK) RpcRaiseException(status);
|
||||
|
||||
memcpy(&ctx->Ndr, ndr, sizeof(ContextHandleNdr));
|
||||
*pCContext = (NDR_CCONTEXT)ctx;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrClientContextUnmarshall
|
||||
*/
|
||||
void WINAPI NdrClientContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
NDR_CCONTEXT * pContextHandle,
|
||||
RPC_BINDING_HANDLE BindHandle)
|
||||
{
|
||||
|
||||
if(!pContextHandle || !BindHandle)
|
||||
RpcRaiseException(ERROR_INVALID_HANDLE);
|
||||
|
||||
NDRCContextUnmarshall(pContextHandle,
|
||||
(CContextHandle*)BindHandle,
|
||||
pStubMsg->Buffer,
|
||||
pStubMsg->RpcMsg->DataRepresentation);
|
||||
|
||||
pStubMsg->Buffer += sizeof(ContextHandleNdr);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* RpcSmDestroyClientContext
|
||||
*/
|
||||
RPC_STATUS WINAPI RpcSmDestroyClientContext(void** ContextHandle)
|
||||
{
|
||||
CContextHandle *ctx = (CContextHandle*)ContextHandle;
|
||||
|
||||
if(!ctx)
|
||||
return RPC_X_SS_CONTEXT_MISMATCH;
|
||||
|
||||
RPCRT4_DestroyBinding(ctx->Binding);
|
||||
HeapFree(GetProcessHeap(), 0, ctx);
|
||||
*ContextHandle = NULL;
|
||||
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* RpcSsDestroyClientContext
|
||||
*/
|
||||
void WINAPI RpcSsDestroyClientContext(void** ContextHandle)
|
||||
{
|
||||
RPC_STATUS status;
|
||||
|
||||
status = RpcSmDestroyClientContext(ContextHandle);
|
||||
|
||||
if(status != RPC_S_OK)
|
||||
RpcRaiseException(status);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrContextHandleSize
|
||||
*/
|
||||
void WINAPI NdrContextHandleSize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
unsigned char* pMemory,
|
||||
PFORMAT_STRING pFormat)
|
||||
{
|
||||
FIXME("(%p, %p, %p): stub\n", pStubMsg, pMemory, pFormat);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrContextHandleInitialize
|
||||
*/
|
||||
NDR_SCONTEXT WINAPI NdrContextHandleInitialize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
PFORMAT_STRING pFormat)
|
||||
{
|
||||
FIXME("(%p, %p): stub\n", pStubMsg, pFormat);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrServerContextMarshall
|
||||
*/
|
||||
void WINAPI NdrServerContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
NDR_SCONTEXT ContextHandle,
|
||||
NDR_RUNDOWN RundownRoutine)
|
||||
{
|
||||
SContextHandle *Hdl;
|
||||
RpcBinding *Binding;
|
||||
|
||||
if(!ContextHandle)
|
||||
RpcRaiseException(ERROR_INVALID_HANDLE);
|
||||
|
||||
Hdl = (SContextHandle*)ContextHandle;
|
||||
Binding = (RpcBinding*)pStubMsg->RpcMsg->Handle;
|
||||
Hdl->Rundown = RundownRoutine;
|
||||
Hdl->Conn = Binding->FromConn;
|
||||
RPCRT4_SrvMarshallCtxHdl(Hdl, (ContextHandleNdr*)pStubMsg->Buffer);
|
||||
pStubMsg->Buffer += sizeof(ContextHandleNdr);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrServerContextUnmarshall
|
||||
*/
|
||||
NDR_SCONTEXT WINAPI NdrServerContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
SContextHandle *Hdl;
|
||||
|
||||
Hdl = RPCRT4_SrvUnmarshallCtxHdl((ContextHandleNdr*)pStubMsg->Buffer);
|
||||
return (NDR_SCONTEXT)Hdl;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrServerContextNewMarshall
|
||||
*/
|
||||
void WINAPI NdrServerContextNewMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
NDR_SCONTEXT ContextHandle,
|
||||
NDR_RUNDOWN RundownRoutine,
|
||||
PFORMAT_STRING pFormat)
|
||||
{
|
||||
FIXME("(%p, %p, %p, %p): stub\n", pStubMsg, ContextHandle, RundownRoutine, pFormat);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrServerContextNewUnmarshall
|
||||
*/
|
||||
NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
PFORMAT_STRING pFormat)
|
||||
{
|
||||
FIXME("(%p, %p): stub\n", pStubMsg, pFormat);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NDRSContextMarshall
|
||||
*/
|
||||
void WINAPI NDRSContextMarshall(IN NDR_SCONTEXT CContext,
|
||||
OUT void *pBuff,
|
||||
IN NDR_RUNDOWN userRunDownIn)
|
||||
{
|
||||
SContextHandle *Hdl;
|
||||
|
||||
if(!CContext)
|
||||
RpcRaiseException(ERROR_INVALID_HANDLE);
|
||||
|
||||
Hdl = (SContextHandle*)CContext;
|
||||
Hdl->Rundown = userRunDownIn;
|
||||
RPCRT4_SrvMarshallCtxHdl(Hdl, (ContextHandleNdr*)pBuff);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NDRSContextUnmarshall
|
||||
*/
|
||||
NDR_SCONTEXT WINAPI NDRSContextUnmarshall(IN void *pBuff,
|
||||
IN unsigned long DataRepresentation)
|
||||
{
|
||||
return (NDR_SCONTEXT) RPCRT4_SrvUnmarshallCtxHdl((ContextHandleNdr*)pBuff);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NDRSContextMarshallEx
|
||||
*/
|
||||
void WINAPI NDRSContextMarshallEx(IN RPC_BINDING_HANDLE BindingHandle,
|
||||
IN NDR_SCONTEXT CContext,
|
||||
OUT void *pBuff,
|
||||
IN NDR_RUNDOWN userRunDownIn)
|
||||
{
|
||||
FIXME("stub\n");
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NDRSContextUnmarshallEx
|
||||
*/
|
||||
NDR_SCONTEXT WINAPI NDRSContextUnmarshallEx(IN RPC_BINDING_HANDLE BindingHandle,
|
||||
IN void *pBuff,
|
||||
IN unsigned long DataRepresentation)
|
||||
{
|
||||
FIXME("stub\n");
|
||||
return NULL;
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Context Handle Functions
|
||||
*
|
||||
* Copyright 2006 Saveliy Tretiakov
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WINE_NDR_CONTEXTH_H
|
||||
#define __WINE_NDR_CONTEXTH_H
|
||||
|
||||
#include "wine/rpcss_shared.h"
|
||||
|
||||
typedef struct _ContextHandleNdr
|
||||
{
|
||||
UINT attributes;
|
||||
UUID uuid;
|
||||
} ContextHandleNdr;
|
||||
|
||||
typedef struct _CContextHandle
|
||||
{
|
||||
RpcBinding *Binding;
|
||||
ContextHandleNdr Ndr;
|
||||
} CContextHandle;
|
||||
|
||||
/*
|
||||
Keep this structure compatible with public rpcndr.h
|
||||
declaration, otherwise NDRSContextValue macro won't work.
|
||||
typedef struct {
|
||||
void *pad[2];
|
||||
void *userContext;
|
||||
} *NDR_SCONTEXT;
|
||||
*/
|
||||
|
||||
typedef struct _SContextHandle
|
||||
{
|
||||
PVOID Prev;
|
||||
PVOID Next;
|
||||
PVOID Value;
|
||||
NDR_RUNDOWN Rundown;
|
||||
RpcConnection *Conn;
|
||||
ContextHandleNdr Ndr;
|
||||
} SContextHandle;
|
||||
|
||||
void RPCRT4_DoContextRundownIfNeeded(RpcConnection *Conn);
|
||||
|
||||
#endif //__WINE_NDR_CONTEXTH_H
|
||||
+3792
-677
File diff suppressed because it is too large
Load Diff
@@ -1,327 +0,0 @@
|
||||
/*
|
||||
* MIDL proxy/stub stuff
|
||||
*
|
||||
* Copyright 2002 Ove Kåven, TransGaming Technologies
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* TODO:
|
||||
* - figure out whether we *really* got this right
|
||||
* - check for errors and throw exceptions
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "winreg.h"
|
||||
|
||||
#include "objbase.h"
|
||||
|
||||
#include "rpcproxy.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "cpsf.h"
|
||||
#include "ndr_misc.h"
|
||||
#include "rpcndr.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(rpc);
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyInitialize [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrProxyInitialize(void *This,
|
||||
PRPC_MESSAGE pRpcMsg,
|
||||
PMIDL_STUB_MESSAGE pStubMsg,
|
||||
PMIDL_STUB_DESC pStubDescriptor,
|
||||
unsigned int ProcNum)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
|
||||
NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
|
||||
if (This) StdProxy_GetChannel(This, &pStubMsg->pRpcChannelBuffer);
|
||||
if (pStubMsg->pRpcChannelBuffer) {
|
||||
hr = IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
|
||||
&pStubMsg->dwDestContext,
|
||||
&pStubMsg->pvDestContext);
|
||||
}
|
||||
TRACE("channel=%p\n", pStubMsg->pRpcChannelBuffer);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyGetBuffer [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrProxyGetBuffer(void *This,
|
||||
PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
HRESULT hr;
|
||||
const IID *riid = NULL;
|
||||
|
||||
TRACE("(%p,%p)\n", This, pStubMsg);
|
||||
pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
|
||||
pStubMsg->dwStubPhase = PROXY_GETBUFFER;
|
||||
hr = StdProxy_GetIID(This, &riid);
|
||||
hr = IRpcChannelBuffer_GetBuffer(pStubMsg->pRpcChannelBuffer,
|
||||
(RPCOLEMESSAGE*)pStubMsg->RpcMsg,
|
||||
riid);
|
||||
pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
|
||||
pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
|
||||
pStubMsg->Buffer = pStubMsg->BufferStart;
|
||||
pStubMsg->dwStubPhase = PROXY_MARSHAL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxySendReceive [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrProxySendReceive(void *This,
|
||||
PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
ULONG Status = 0;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%p)\n", This, pStubMsg);
|
||||
|
||||
if (!pStubMsg->pRpcChannelBuffer)
|
||||
{
|
||||
WARN("Trying to use disconnected proxy %p\n", This);
|
||||
RpcRaiseException(RPC_E_DISCONNECTED);
|
||||
}
|
||||
|
||||
pStubMsg->dwStubPhase = PROXY_SENDRECEIVE;
|
||||
hr = IRpcChannelBuffer_SendReceive(pStubMsg->pRpcChannelBuffer,
|
||||
(RPCOLEMESSAGE*)pStubMsg->RpcMsg,
|
||||
&Status);
|
||||
pStubMsg->dwStubPhase = PROXY_UNMARSHAL;
|
||||
pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength;
|
||||
pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
|
||||
pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
|
||||
pStubMsg->Buffer = pStubMsg->BufferStart;
|
||||
|
||||
/* raise exception if call failed */
|
||||
if (hr == RPC_S_CALL_FAILED) RpcRaiseException(*(DWORD*)pStubMsg->Buffer);
|
||||
else if (FAILED(hr)) RpcRaiseException(hr);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyFreeBuffer [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrProxyFreeBuffer(void *This,
|
||||
PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%p)\n", This, pStubMsg);
|
||||
hr = IRpcChannelBuffer_FreeBuffer(pStubMsg->pRpcChannelBuffer,
|
||||
(RPCOLEMESSAGE*)pStubMsg->RpcMsg);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyErrorHandler [RPCRT4.@]
|
||||
*/
|
||||
HRESULT WINAPI NdrProxyErrorHandler(DWORD dwExceptionCode)
|
||||
{
|
||||
WARN("(0x%08lx): a proxy call failed\n", dwExceptionCode);
|
||||
|
||||
if (FAILED(dwExceptionCode))
|
||||
return dwExceptionCode;
|
||||
else
|
||||
return HRESULT_FROM_WIN32(dwExceptionCode);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrStubInitialize [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrStubInitialize(PRPC_MESSAGE pRpcMsg,
|
||||
PMIDL_STUB_MESSAGE pStubMsg,
|
||||
PMIDL_STUB_DESC pStubDescriptor,
|
||||
LPRPCCHANNELBUFFER pRpcChannelBuffer)
|
||||
{
|
||||
TRACE("(%p,%p,%p,%p)\n", pRpcMsg, pStubMsg, pStubDescriptor, pRpcChannelBuffer);
|
||||
NdrServerInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor);
|
||||
pStubMsg->pRpcChannelBuffer = pRpcChannelBuffer;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrStubGetBuffer [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrStubGetBuffer(LPRPCSTUBBUFFER This,
|
||||
LPRPCCHANNELBUFFER pRpcChannelBuffer,
|
||||
PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
TRACE("(%p,%p)\n", This, pStubMsg);
|
||||
pStubMsg->pRpcChannelBuffer = pRpcChannelBuffer;
|
||||
pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
|
||||
I_RpcGetBuffer(pStubMsg->RpcMsg); /* ? */
|
||||
pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
|
||||
pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
|
||||
pStubMsg->Buffer = pStubMsg->BufferStart;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* NdrClientInitializeNew [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE pStubMsg,
|
||||
PMIDL_STUB_DESC pStubDesc, unsigned int ProcNum )
|
||||
{
|
||||
TRACE("(pRpcMessage == ^%p, pStubMsg == ^%p, pStubDesc == ^%p, ProcNum == %d)\n",
|
||||
pRpcMessage, pStubMsg, pStubDesc, ProcNum);
|
||||
|
||||
assert( pRpcMessage && pStubMsg && pStubDesc );
|
||||
|
||||
memset(pRpcMessage, 0, sizeof(RPC_MESSAGE));
|
||||
pRpcMessage->DataRepresentation = NDR_LOCAL_DATA_REPRESENTATION;
|
||||
|
||||
/* not everyone allocates stack space for w2kReserved */
|
||||
memset(pStubMsg, 0, FIELD_OFFSET(MIDL_STUB_MESSAGE,pCSInfo));
|
||||
|
||||
pStubMsg->ReuseBuffer = FALSE;
|
||||
pStubMsg->IsClient = TRUE;
|
||||
pStubMsg->StubDesc = pStubDesc;
|
||||
pStubMsg->pfnAllocate = pStubDesc->pfnAllocate;
|
||||
pStubMsg->pfnFree = pStubDesc->pfnFree;
|
||||
pStubMsg->RpcMsg = pRpcMessage;
|
||||
|
||||
pRpcMessage->ProcNum = ProcNum;
|
||||
pRpcMessage->RpcInterfaceInformation = pStubDesc->RpcInterfaceInformation;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrServerInitializeNew [RPCRT4.@]
|
||||
*/
|
||||
unsigned char* WINAPI NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
|
||||
PMIDL_STUB_DESC pStubDesc )
|
||||
{
|
||||
TRACE("(pRpcMsg == ^%p, pStubMsg == ^%p, pStubDesc == ^%p)\n", pRpcMsg, pStubMsg, pStubDesc);
|
||||
|
||||
assert( pRpcMsg && pStubMsg && pStubDesc );
|
||||
|
||||
/* not everyone allocates stack space for w2kReserved */
|
||||
memset(pStubMsg, 0, FIELD_OFFSET(MIDL_STUB_MESSAGE,pCSInfo));
|
||||
|
||||
pStubMsg->ReuseBuffer = TRUE;
|
||||
pStubMsg->IsClient = FALSE;
|
||||
pStubMsg->StubDesc = pStubDesc;
|
||||
pStubMsg->pfnAllocate = pStubDesc->pfnAllocate;
|
||||
pStubMsg->pfnFree = pStubDesc->pfnFree;
|
||||
pStubMsg->RpcMsg = pRpcMsg;
|
||||
pStubMsg->Buffer = pStubMsg->BufferStart = pRpcMsg->Buffer;
|
||||
pStubMsg->BufferLength = pRpcMsg->BufferLength;
|
||||
pStubMsg->BufferEnd = pStubMsg->Buffer + pStubMsg->BufferLength;
|
||||
|
||||
/* FIXME: determine the proper return value */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrGetBuffer [RPCRT4.@]
|
||||
*/
|
||||
unsigned char *WINAPI NdrGetBuffer(MIDL_STUB_MESSAGE *stubmsg, unsigned long buflen, RPC_BINDING_HANDLE handle)
|
||||
{
|
||||
TRACE("(stubmsg == ^%p, buflen == %lu, handle == %p): wild guess.\n", stubmsg, buflen, handle);
|
||||
|
||||
assert( stubmsg && stubmsg->RpcMsg );
|
||||
|
||||
/* I guess this is our chance to put the binding handle into the RPC_MESSAGE */
|
||||
stubmsg->RpcMsg->Handle = handle;
|
||||
|
||||
stubmsg->RpcMsg->BufferLength = buflen;
|
||||
if (I_RpcGetBuffer(stubmsg->RpcMsg) != S_OK)
|
||||
return NULL;
|
||||
|
||||
stubmsg->Buffer = stubmsg->BufferStart = stubmsg->RpcMsg->Buffer;
|
||||
stubmsg->BufferLength = stubmsg->RpcMsg->BufferLength;
|
||||
stubmsg->BufferEnd = stubmsg->Buffer + stubmsg->BufferLength;
|
||||
return (stubmsg->Buffer = (unsigned char *)stubmsg->RpcMsg->Buffer);
|
||||
}
|
||||
/***********************************************************************
|
||||
* NdrFreeBuffer [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrFreeBuffer(MIDL_STUB_MESSAGE *pStubMsg)
|
||||
{
|
||||
TRACE("(pStubMsg == ^%p): wild guess.\n", pStubMsg);
|
||||
I_RpcFreeBuffer(pStubMsg->RpcMsg);
|
||||
pStubMsg->BufferLength = 0;
|
||||
pStubMsg->Buffer = pStubMsg->BufferEnd = (unsigned char *)(pStubMsg->RpcMsg->Buffer = NULL);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* NdrSendReceive [RPCRT4.@]
|
||||
*/
|
||||
unsigned char *WINAPI NdrSendReceive( MIDL_STUB_MESSAGE *stubmsg, unsigned char *buffer )
|
||||
{
|
||||
RPC_STATUS status;
|
||||
|
||||
TRACE("(stubmsg == ^%p, buffer == ^%p)\n", stubmsg, buffer);
|
||||
|
||||
/* FIXME: how to handle errors? (raise exception?) */
|
||||
if (!stubmsg) {
|
||||
ERR("NULL stub message. No action taken.\n");
|
||||
return NULL;
|
||||
}
|
||||
if (!stubmsg->RpcMsg) {
|
||||
ERR("RPC Message not present in stub message. No action taken.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
status = I_RpcSendReceive(stubmsg->RpcMsg);
|
||||
if (status != RPC_S_OK)
|
||||
{
|
||||
WARN("I_RpcSendReceive did not return success.\n");
|
||||
/* FIXME: raise exception? */
|
||||
//RpcRaiseException(status);
|
||||
}
|
||||
|
||||
stubmsg->BufferLength = stubmsg->RpcMsg->BufferLength;
|
||||
stubmsg->BufferStart = stubmsg->RpcMsg->Buffer;
|
||||
stubmsg->BufferEnd = stubmsg->BufferStart + stubmsg->BufferLength;
|
||||
stubmsg->Buffer = stubmsg->BufferStart;
|
||||
|
||||
/* FIXME: is this the right return value? */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* NdrMapCommAndFaultStatus [RPCRT4.@]
|
||||
*/
|
||||
RPC_STATUS RPC_ENTRY NdrMapCommAndFaultStatus( PMIDL_STUB_MESSAGE pStubMsg,
|
||||
unsigned long *pCommStatus,
|
||||
unsigned long *pFaultStatus,
|
||||
RPC_STATUS Status )
|
||||
{
|
||||
FIXME("(%p, %p, %p, %ld): stub\n", pStubMsg, pCommStatus, pFaultStatus, Status);
|
||||
|
||||
*pCommStatus = 0;
|
||||
*pFaultStatus = 0;
|
||||
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* NdrStubForwardingFunction [RPCRT4.@]
|
||||
*/
|
||||
void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *This, IRpcChannelBuffer *pChannel,
|
||||
PRPC_MESSAGE pMsg, DWORD *pdwStubPhase )
|
||||
{
|
||||
FIXME("Not implemented\n");
|
||||
return;
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __WINE_NDR_MISC_H
|
||||
@@ -30,22 +30,36 @@
|
||||
|
||||
struct IPSFactoryBuffer;
|
||||
|
||||
#define ComputeConformance(pStubMsg, pMemory, pFormat, def) ComputeConformanceOrVariance(pStubMsg, pMemory, pFormat, def, &pStubMsg->MaxCount)
|
||||
#define ComputeVariance(pStubMsg, pMemory, pFormat, def) ComputeConformanceOrVariance(pStubMsg, pMemory, pFormat, def, &pStubMsg->ActualCount)
|
||||
PFORMAT_STRING ComputeConformanceOrVariance(
|
||||
MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory,
|
||||
PFORMAT_STRING pFormat, ULONG_PTR def, ULONG *pCount);
|
||||
PFORMAT_STRING pFormat, ULONG_PTR def, ULONG_PTR *pCount);
|
||||
|
||||
static inline PFORMAT_STRING ComputeConformance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def)
|
||||
{
|
||||
return ComputeConformanceOrVariance(pStubMsg, pMemory, pFormat, def, &pStubMsg->MaxCount);
|
||||
}
|
||||
|
||||
static inline PFORMAT_STRING ComputeVariance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def)
|
||||
{
|
||||
PFORMAT_STRING ret;
|
||||
ULONG_PTR ActualCount = pStubMsg->ActualCount;
|
||||
|
||||
pStubMsg->Offset = 0;
|
||||
ret = ComputeConformanceOrVariance(pStubMsg, pMemory, pFormat, def, &ActualCount);
|
||||
pStubMsg->ActualCount = (ULONG)ActualCount;
|
||||
return ret;
|
||||
}
|
||||
|
||||
typedef unsigned char* (WINAPI *NDR_MARSHALL) (PMIDL_STUB_MESSAGE, unsigned char*, PFORMAT_STRING);
|
||||
typedef unsigned char* (WINAPI *NDR_UNMARSHALL)(PMIDL_STUB_MESSAGE, unsigned char**,PFORMAT_STRING, unsigned char);
|
||||
typedef void (WINAPI *NDR_BUFFERSIZE)(PMIDL_STUB_MESSAGE, unsigned char*, PFORMAT_STRING);
|
||||
typedef unsigned long (WINAPI *NDR_MEMORYSIZE)(PMIDL_STUB_MESSAGE, PFORMAT_STRING);
|
||||
typedef ULONG (WINAPI *NDR_MEMORYSIZE)(PMIDL_STUB_MESSAGE, PFORMAT_STRING);
|
||||
typedef void (WINAPI *NDR_FREE) (PMIDL_STUB_MESSAGE, unsigned char*, PFORMAT_STRING);
|
||||
|
||||
extern NDR_MARSHALL NdrMarshaller[];
|
||||
extern NDR_UNMARSHALL NdrUnmarshaller[];
|
||||
extern NDR_BUFFERSIZE NdrBufferSizer[];
|
||||
extern NDR_MEMORYSIZE NdrMemorySizer[];
|
||||
extern NDR_FREE NdrFreer[];
|
||||
extern const NDR_MARSHALL NdrMarshaller[];
|
||||
extern const NDR_UNMARSHALL NdrUnmarshaller[];
|
||||
extern const NDR_BUFFERSIZE NdrBufferSizer[];
|
||||
extern const NDR_MEMORYSIZE NdrMemorySizer[];
|
||||
extern const NDR_FREE NdrFreer[];
|
||||
|
||||
#endif /* __WINE_NDR_MISC_H */
|
||||
|
||||
@@ -15,12 +15,10 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
* TODO:
|
||||
* - figure out whether we *really* got this right
|
||||
* - check for errors and throw exceptions
|
||||
* - what are the marshalling functions supposed to return?
|
||||
* - fix the wire-protocol to match MS/RPC
|
||||
* - finish RpcStream_Vtbl
|
||||
*/
|
||||
|
||||
@@ -35,13 +33,14 @@
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "winreg.h"
|
||||
|
||||
#include "objbase.h"
|
||||
|
||||
#include "ndr_misc.h"
|
||||
#include "rpcndr.h"
|
||||
#include "rpcproxy.h"
|
||||
#include "wine/rpcfc.h"
|
||||
#include "cpsf.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
@@ -83,7 +82,7 @@ typedef struct RpcStreamImpl
|
||||
DWORD RefCount;
|
||||
PMIDL_STUB_MESSAGE pMsg;
|
||||
LPDWORD size;
|
||||
char *data;
|
||||
unsigned char *data;
|
||||
DWORD pos;
|
||||
} RpcStreamImpl;
|
||||
|
||||
@@ -112,7 +111,7 @@ static ULONG WINAPI RpcStream_Release(LPSTREAM iface)
|
||||
{
|
||||
RpcStreamImpl *This = (RpcStreamImpl *)iface;
|
||||
if (!--(This->RefCount)) {
|
||||
TRACE("size=%ld\n", *This->size);
|
||||
TRACE("size=%d\n", *This->size);
|
||||
This->pMsg->Buffer = (unsigned char*)This->data + *This->size;
|
||||
HeapFree(GetProcessHeap(),0,This);
|
||||
return 0;
|
||||
@@ -146,7 +145,7 @@ static HRESULT WINAPI RpcStream_Write(LPSTREAM iface,
|
||||
ULONG *pcbWritten)
|
||||
{
|
||||
RpcStreamImpl *This = (RpcStreamImpl *)iface;
|
||||
if (This->data + cb > (char *)This->pMsg->BufferEnd)
|
||||
if (This->data + cb > (unsigned char *)This->pMsg->RpcMsg->Buffer + This->pMsg->BufferLength)
|
||||
return STG_E_MEDIUMFULL;
|
||||
memcpy(This->data + This->pos, pv, cb);
|
||||
This->pos += cb;
|
||||
@@ -216,10 +215,10 @@ static LPSTREAM RpcStream_Create(PMIDL_STUB_MESSAGE pStubMsg, BOOL init)
|
||||
This->RefCount = 1;
|
||||
This->pMsg = pStubMsg;
|
||||
This->size = (LPDWORD)pStubMsg->Buffer;
|
||||
This->data = (char*)(This->size + 1);
|
||||
This->data = (unsigned char*)(This->size + 1);
|
||||
This->pos = 0;
|
||||
if (init) *This->size = 0;
|
||||
TRACE("init size=%ld\n", *This->size);
|
||||
TRACE("init size=%d\n", *This->size);
|
||||
return (LPSTREAM)This;
|
||||
}
|
||||
|
||||
@@ -254,7 +253,7 @@ unsigned char * WINAPI NdrInterfacePointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
||||
pStubMsg->MaxCount = 0;
|
||||
if (!LoadCOM()) return NULL;
|
||||
if (pStubMsg->Buffer + sizeof(DWORD) < (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) {
|
||||
if (pStubMsg->Buffer + sizeof(DWORD) <= (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) {
|
||||
stream = RpcStream_Create(pStubMsg, TRUE);
|
||||
if (stream) {
|
||||
if (pMemory)
|
||||
@@ -288,12 +287,14 @@ unsigned char * WINAPI NdrInterfacePointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg
|
||||
*(LPVOID*)ppMemory = NULL;
|
||||
if (pStubMsg->Buffer + sizeof(DWORD) < (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) {
|
||||
stream = RpcStream_Create(pStubMsg, FALSE);
|
||||
if (stream) {
|
||||
if (!stream) RpcRaiseException(E_OUTOFMEMORY);
|
||||
if (*((RpcStreamImpl *)stream)->size != 0)
|
||||
hr = COM_UnmarshalInterface(stream, &IID_NULL, (LPVOID*)ppMemory);
|
||||
IStream_Release(stream);
|
||||
if (FAILED(hr))
|
||||
else
|
||||
hr = S_OK;
|
||||
IStream_Release(stream);
|
||||
if (FAILED(hr))
|
||||
RpcRaiseException(hr);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -314,18 +315,27 @@ void WINAPI NdrInterfacePointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
hr = COM_GetMarshalSizeMax(&size, riid, (LPUNKNOWN)pMemory,
|
||||
pStubMsg->dwDestContext, pStubMsg->pvDestContext,
|
||||
MSHLFLAGS_NORMAL);
|
||||
TRACE("size=%ld\n", size);
|
||||
TRACE("size=%d\n", size);
|
||||
pStubMsg->BufferLength += sizeof(DWORD) + size;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrInterfacePointerMemorySize [RPCRT4.@]
|
||||
*/
|
||||
unsigned long WINAPI NdrInterfacePointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
PFORMAT_STRING pFormat)
|
||||
ULONG WINAPI NdrInterfacePointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
PFORMAT_STRING pFormat)
|
||||
{
|
||||
FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
|
||||
return 0;
|
||||
ULONG size;
|
||||
|
||||
TRACE("(%p,%p)\n", pStubMsg, pFormat);
|
||||
|
||||
size = *(ULONG *)pStubMsg->Buffer;
|
||||
pStubMsg->Buffer += 4;
|
||||
pStubMsg->MemorySize += 4;
|
||||
|
||||
pStubMsg->Buffer += size;
|
||||
|
||||
return pStubMsg->MemorySize;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -357,3 +367,27 @@ void WINAPI NdrOleFree(void *NodeToFree)
|
||||
if (!LoadCOM()) return;
|
||||
COM_MemFree(NodeToFree);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Helper function to create a stub.
|
||||
* This probably looks very much like NdrpCreateStub.
|
||||
*/
|
||||
HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub)
|
||||
{
|
||||
CLSID clsid;
|
||||
IPSFactoryBuffer *psfac;
|
||||
HRESULT r;
|
||||
|
||||
if(!LoadCOM()) return E_FAIL;
|
||||
|
||||
r = COM_GetPSClsid( iid, &clsid );
|
||||
if(FAILED(r)) return r;
|
||||
|
||||
r = COM_GetClassObject( &clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IPSFactoryBuffer, (void**)&psfac );
|
||||
if(FAILED(r)) return r;
|
||||
|
||||
r = IPSFactoryBuffer_CreateStub(psfac, iid, pUnk, ppstub);
|
||||
|
||||
IPSFactoryBuffer_Release(psfac);
|
||||
return r;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -15,29 +15,87 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __WINE_RPC_BINDING_H
|
||||
#define __WINE_RPC_BINDING_H
|
||||
|
||||
#include "wine/rpcss_shared.h"
|
||||
#include "rpcndr.h"
|
||||
#include "security.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
|
||||
typedef struct _RpcAuthInfo
|
||||
{
|
||||
LONG refs;
|
||||
|
||||
ULONG AuthnLevel;
|
||||
ULONG AuthnSvc;
|
||||
CredHandle cred;
|
||||
TimeStamp exp;
|
||||
ULONG cbMaxToken;
|
||||
/* the auth identity pointer that the application passed us (freed by application) */
|
||||
RPC_AUTH_IDENTITY_HANDLE *identity;
|
||||
/* our copy of NT auth identity structure, if the authentication service
|
||||
* takes an NT auth identity */
|
||||
SEC_WINNT_AUTH_IDENTITY_W *nt_identity;
|
||||
} RpcAuthInfo;
|
||||
|
||||
typedef struct _RpcQualityOfService
|
||||
{
|
||||
LONG refs;
|
||||
|
||||
RPC_SECURITY_QOS_V2_W *qos;
|
||||
} RpcQualityOfService;
|
||||
|
||||
struct connection_ops;
|
||||
|
||||
typedef struct _RpcConnection
|
||||
{
|
||||
struct _RpcConnection* Next;
|
||||
struct _RpcBinding* Used;
|
||||
BOOL server;
|
||||
LPSTR Protseq;
|
||||
LPSTR NetworkAddr;
|
||||
LPSTR Endpoint;
|
||||
HANDLE conn, thread;
|
||||
OVERLAPPED ovl[2];
|
||||
LPWSTR NetworkOptions;
|
||||
const struct connection_ops *ops;
|
||||
USHORT MaxTransmissionSize;
|
||||
|
||||
/* authentication */
|
||||
CtxtHandle ctx;
|
||||
TimeStamp exp;
|
||||
ULONG attr;
|
||||
RpcAuthInfo *AuthInfo;
|
||||
ULONG encryption_auth_len;
|
||||
ULONG signature_auth_len;
|
||||
RpcQualityOfService *QOS;
|
||||
|
||||
/* client-only */
|
||||
struct list conn_pool_entry;
|
||||
ULONG assoc_group_id; /* association group returned during binding */
|
||||
|
||||
/* server-only */
|
||||
/* The active interface bound to server. */
|
||||
RPC_SYNTAX_IDENTIFIER ActiveInterface;
|
||||
USHORT NextCallId;
|
||||
struct _RpcConnection* Next;
|
||||
struct _RpcBinding *server_binding;
|
||||
} RpcConnection;
|
||||
|
||||
struct connection_ops {
|
||||
const char *name;
|
||||
unsigned char epm_protocols[2]; /* only floors 3 and 4. see http://www.opengroup.org/onlinepubs/9629399/apdxl.htm */
|
||||
RpcConnection *(*alloc)(void);
|
||||
RPC_STATUS (*open_connection_client)(RpcConnection *conn);
|
||||
RPC_STATUS (*handoff)(RpcConnection *old_conn, RpcConnection *new_conn);
|
||||
int (*read)(RpcConnection *conn, void *buffer, unsigned int len);
|
||||
int (*write)(RpcConnection *conn, const void *buffer, unsigned int len);
|
||||
int (*close)(RpcConnection *conn);
|
||||
void (*cancel_call)(RpcConnection *conn);
|
||||
size_t (*get_top_of_tower)(unsigned char *tower_data, const char *networkaddr, const char *endpoint);
|
||||
RPC_STATUS (*parse_top_of_tower)(const unsigned char *tower_data, size_t tower_size, char **networkaddr, char **endpoint);
|
||||
};
|
||||
|
||||
/* don't know what MS's structure looks like */
|
||||
typedef struct _RpcBinding
|
||||
{
|
||||
@@ -48,39 +106,92 @@ typedef struct _RpcBinding
|
||||
LPSTR Protseq;
|
||||
LPSTR NetworkAddr;
|
||||
LPSTR Endpoint;
|
||||
LPWSTR NetworkOptions;
|
||||
RPC_BLOCKING_FN BlockingFn;
|
||||
ULONG ServerTid;
|
||||
RpcConnection* FromConn;
|
||||
struct _RpcAssoc *Assoc;
|
||||
|
||||
/* authentication */
|
||||
RpcAuthInfo *AuthInfo;
|
||||
RpcQualityOfService *QOS;
|
||||
} RpcBinding;
|
||||
|
||||
LPSTR RPCRT4_strndupA(LPCSTR src, INT len);
|
||||
LPWSTR RPCRT4_strndupW(LPWSTR src, INT len);
|
||||
LPSTR RPCRT4_strdupWtoA(LPWSTR src);
|
||||
LPWSTR RPCRT4_strdupAtoW(LPSTR src);
|
||||
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT len);
|
||||
LPSTR RPCRT4_strdupWtoA(LPCWSTR src);
|
||||
LPWSTR RPCRT4_strdupAtoW(LPCSTR src);
|
||||
void RPCRT4_strfree(LPSTR src);
|
||||
|
||||
#define RPCRT4_strdupA(x) RPCRT4_strndupA((x),-1)
|
||||
#define RPCRT4_strdupW(x) RPCRT4_strndupW((x),-1)
|
||||
|
||||
RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPSTR Protseq, LPSTR NetworkAddr, LPSTR Endpoint, LPSTR NetworkOptions, RpcBinding* Binding);
|
||||
ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo);
|
||||
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo);
|
||||
BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2);
|
||||
ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos);
|
||||
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos);
|
||||
BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2);
|
||||
|
||||
RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS);
|
||||
RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection);
|
||||
RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection);
|
||||
RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection* Connection);
|
||||
RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection);
|
||||
RPC_STATUS RPCRT4_SpawnConnection(RpcConnection** Connection, RpcConnection* OldConnection);
|
||||
|
||||
RPC_STATUS RPCRT4_CreateBindingA(RpcBinding** Binding, BOOL server, LPSTR Protseq);
|
||||
RPC_STATUS RPCRT4_CreateBindingW(RpcBinding** Binding, BOOL server, LPWSTR Protseq);
|
||||
RPC_STATUS RPCRT4_CompleteBindingA(RpcBinding* Binding, LPSTR NetworkAddr, LPSTR Endpoint, LPSTR NetworkOptions);
|
||||
RPC_STATUS RPCRT4_CompleteBindingW(RpcBinding* Binding, LPWSTR NetworkAddr, LPWSTR Endpoint, LPWSTR NetworkOptions);
|
||||
RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPSTR Endpoint);
|
||||
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, UUID* ObjectUuid);
|
||||
RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPCSTR Endpoint);
|
||||
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, const UUID* ObjectUuid);
|
||||
RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection);
|
||||
RPC_STATUS RPCRT4_ExportBinding(RpcBinding** Binding, RpcBinding* OldBinding);
|
||||
RPC_STATUS RPCRT4_DestroyBinding(RpcBinding* Binding);
|
||||
RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection, PRPC_SYNTAX_IDENTIFIER TransferSyntax, PRPC_SYNTAX_IDENTIFIER InterfaceId);
|
||||
RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
|
||||
const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RPC_SYNTAX_IDENTIFIER *InterfaceId);
|
||||
RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection);
|
||||
BOOL RPCRT4_RPCSSOnDemandCall(PRPCSS_NP_MESSAGE msg, char *vardata_payload, PRPCSS_NP_REPLY reply);
|
||||
HANDLE RPCRT4_GetMasterMutex(void);
|
||||
HANDLE RPCRT4_RpcssNPConnect(void);
|
||||
|
||||
static inline const char *rpcrt4_conn_get_name(const RpcConnection *Connection)
|
||||
{
|
||||
return Connection->ops->name;
|
||||
}
|
||||
|
||||
static inline int rpcrt4_conn_read(RpcConnection *Connection,
|
||||
void *buffer, unsigned int len)
|
||||
{
|
||||
return Connection->ops->read(Connection, buffer, len);
|
||||
}
|
||||
|
||||
static inline int rpcrt4_conn_write(RpcConnection *Connection,
|
||||
const void *buffer, unsigned int len)
|
||||
{
|
||||
return Connection->ops->write(Connection, buffer, len);
|
||||
}
|
||||
|
||||
static inline int rpcrt4_conn_close(RpcConnection *Connection)
|
||||
{
|
||||
return Connection->ops->close(Connection);
|
||||
}
|
||||
|
||||
static inline void rpcrt4_conn_cancel_call(RpcConnection *Connection)
|
||||
{
|
||||
Connection->ops->cancel_call(Connection);
|
||||
}
|
||||
|
||||
static inline RPC_STATUS rpcrt4_conn_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
|
||||
{
|
||||
return old_conn->ops->handoff(old_conn, new_conn);
|
||||
}
|
||||
|
||||
/* floors 3 and up */
|
||||
RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint);
|
||||
RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint);
|
||||
|
||||
void RPCRT4_SetThreadCurrentConnection(RpcConnection *Connection);
|
||||
void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding);
|
||||
RpcBinding *RPCRT4_GetThreadCurrentCallHandle(void);
|
||||
void RPCRT4_PushThreadContextHandle(NDR_SCONTEXT SContext);
|
||||
void RPCRT4_RemoveThreadContextHandle(NDR_SCONTEXT SContext);
|
||||
NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __WINE_RPC_DEFS_H
|
||||
@@ -58,10 +58,10 @@ typedef struct
|
||||
RpcPktCommonHdr common;
|
||||
unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */
|
||||
unsigned short context_id; /* Presentation context identifier */
|
||||
unsigned char alert_count; /* Pending alert count */
|
||||
unsigned char padding[3]; /* Force alignment! */
|
||||
unsigned char cancel_count; /* Received cancel count */
|
||||
unsigned char reserved; /* Force alignment! */
|
||||
unsigned long status; /* Runtime fault code (RPC_STATUS) */
|
||||
unsigned long reserved;
|
||||
unsigned long reserved2;
|
||||
} RpcPktFaultHdr;
|
||||
|
||||
typedef struct
|
||||
@@ -88,9 +88,8 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char padding1[2]; /* Force alignment! */
|
||||
unsigned char num_results; /* Number of results */
|
||||
unsigned char padding2[3]; /* Force alignment! */
|
||||
unsigned char reserved[3]; /* Force alignment! */
|
||||
struct {
|
||||
unsigned short result;
|
||||
unsigned short reason;
|
||||
@@ -103,9 +102,10 @@ typedef struct
|
||||
unsigned short max_tsize; /* Maximum transmission fragment size */
|
||||
unsigned short max_rsize; /* Maximum receive fragment size */
|
||||
unsigned long assoc_gid; /* Associated group id */
|
||||
/*
|
||||
/*
|
||||
* Following this header are these fields:
|
||||
* RpcAddressString server_address;
|
||||
* [0 - 3 bytes of padding so that results is 4-byte aligned]
|
||||
* RpcResults results;
|
||||
* RPC_SYNTAX_IDENTIFIER transfer;
|
||||
*/
|
||||
@@ -134,6 +134,18 @@ typedef union
|
||||
RpcPktBindNAckHdr bind_nack;
|
||||
} RpcPktHdr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char auth_type; /* authentication scheme in use */
|
||||
unsigned char auth_level; /* RPC_C_AUTHN_LEVEL* */
|
||||
unsigned char auth_pad_length; /* length of padding to restore n % 4 alignment */
|
||||
unsigned char auth_reserved; /* reserved, must be zero */
|
||||
unsigned long auth_context_id; /* unique value for the authenticated connection */
|
||||
} RpcAuthVerifier;
|
||||
|
||||
#define RPC_AUTH_VERIFIER_LEN(common_hdr) \
|
||||
((common_hdr)->auth_len ? (common_hdr)->auth_len + sizeof(RpcAuthVerifier) : 0)
|
||||
|
||||
#define RPC_VER_MAJOR 5
|
||||
#define RPC_VER_MINOR 0
|
||||
|
||||
@@ -160,13 +172,30 @@ typedef union
|
||||
#define PKT_BIND_NACK 13
|
||||
#define PKT_ALTER_CONTEXT 14
|
||||
#define PKT_ALTER_CONTEXT_RESP 15
|
||||
#define PKT_AUTH3 16
|
||||
#define PKT_SHUTDOWN 17
|
||||
#define PKT_CO_CANCEL 18
|
||||
#define PKT_ORPHANED 19
|
||||
|
||||
#define RESULT_ACCEPT 0
|
||||
#define RESULT_ACCEPT 0
|
||||
#define RESULT_USER_REJECTION 1
|
||||
#define RESULT_PROVIDER_REJECTION 2
|
||||
|
||||
#define NO_REASON 0
|
||||
#define REASON_NONE 0
|
||||
#define REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED 1
|
||||
#define REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED 2
|
||||
#define REASON_LOCAL_LIMIT_EXCEEDED 3
|
||||
|
||||
#define REJECT_REASON_NOT_SPECIFIED 0
|
||||
#define REJECT_TEMPORARY_CONGESTION 1
|
||||
#define REJECT_LOCAL_LIMIT_EXCEEDED 2
|
||||
#define REJECT_CALLED_PADDR_UNKNOWN 3 /* not used */
|
||||
#define REJECT_PROTOCOL_VERSION_NOT_SUPPORTED 4
|
||||
#define REJECT_DEFAULT_CONTEXT_NOT_SUPPORTED 5 /* not used */
|
||||
#define REJECT_USER_DATA_NOT_READABLE 6 /* not used */
|
||||
#define REJECT_NO_PSAP_AVAILABLE 7 /* not used */
|
||||
#define REJECT_UNKNOWN_AUTHN_SERVICE 8
|
||||
#define REJECT_INVALID_CHECKSUM 9
|
||||
|
||||
#define NCADG_IP_UDP 0x08
|
||||
#define NCACN_IP_TCP 0x07
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
* TODO:
|
||||
* - actually do things right
|
||||
@@ -29,13 +29,13 @@
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "winreg.h"
|
||||
|
||||
#include "rpc.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "rpc_binding.h"
|
||||
#include "epm_towers.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
@@ -67,7 +67,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
* RpcEpRegisterA (RPCRT4.@)
|
||||
*/
|
||||
RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector,
|
||||
UUID_VECTOR *UuidVector, unsigned char *Annotation )
|
||||
UUID_VECTOR *UuidVector, RPC_CSTR Annotation )
|
||||
{
|
||||
RPCSS_NP_MESSAGE msg;
|
||||
RPCSS_NP_REPLY reply;
|
||||
@@ -231,7 +231,7 @@ RPC_STATUS WINAPI RpcEpResolveBinding( RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE
|
||||
msg.message_type = RPCSS_NP_MESSAGE_TYPEID_RESOLVEEPMSG;
|
||||
msg.message.resolveepmsg.iface = If->InterfaceId;
|
||||
msg.message.resolveepmsg.object = bind->ObjectUuid;
|
||||
|
||||
|
||||
msg.vardata_payload_size = strlen(bind->Protseq) + 1;
|
||||
|
||||
/* send the message */
|
||||
@@ -241,7 +241,144 @@ RPC_STATUS WINAPI RpcEpResolveBinding( RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE
|
||||
/* empty-string result means not registered */
|
||||
if (reply.as_string[0] == '\0')
|
||||
return EPT_S_NOT_REGISTERED;
|
||||
|
||||
|
||||
/* otherwise we fully bind the handle & return RPC_S_OK */
|
||||
return RPCRT4_ResolveBinding(Binding, reply.as_string);
|
||||
}
|
||||
|
||||
typedef unsigned int unsigned32;
|
||||
typedef struct twr_t
|
||||
{
|
||||
unsigned32 tower_length;
|
||||
/* [size_is] */ BYTE tower_octet_string[ 1 ];
|
||||
} twr_t;
|
||||
|
||||
/***********************************************************************
|
||||
* TowerExplode (RPCRT4.@)
|
||||
*/
|
||||
RPC_STATUS WINAPI TowerExplode(
|
||||
const twr_t *tower, PRPC_SYNTAX_IDENTIFIER object, PRPC_SYNTAX_IDENTIFIER syntax,
|
||||
char **protseq, char **endpoint, char **address)
|
||||
{
|
||||
size_t tower_size;
|
||||
RPC_STATUS status;
|
||||
const unsigned char *p;
|
||||
u_int16 floor_count;
|
||||
const twr_uuid_floor_t *object_floor;
|
||||
const twr_uuid_floor_t *syntax_floor;
|
||||
|
||||
if (protseq)
|
||||
*protseq = NULL;
|
||||
if (endpoint)
|
||||
*endpoint = NULL;
|
||||
if (address)
|
||||
*address = NULL;
|
||||
|
||||
tower_size = tower->tower_length;
|
||||
|
||||
if (tower_size < sizeof(u_int16))
|
||||
return EPT_S_NOT_REGISTERED;
|
||||
|
||||
p = &tower->tower_octet_string[0];
|
||||
|
||||
floor_count = *(const u_int16 *)p;
|
||||
p += sizeof(u_int16);
|
||||
tower_size -= sizeof(u_int16);
|
||||
TRACE("floor_count: %d\n", floor_count);
|
||||
/* FIXME: should we do something with the floor count? at the moment we don't */
|
||||
|
||||
if (tower_size < sizeof(*object_floor) + sizeof(*syntax_floor))
|
||||
return EPT_S_NOT_REGISTERED;
|
||||
|
||||
object_floor = (const twr_uuid_floor_t *)p;
|
||||
p += sizeof(*object_floor);
|
||||
tower_size -= sizeof(*object_floor);
|
||||
syntax_floor = (const twr_uuid_floor_t *)p;
|
||||
p += sizeof(*syntax_floor);
|
||||
tower_size -= sizeof(*syntax_floor);
|
||||
|
||||
if ((object_floor->count_lhs != sizeof(object_floor->protid) +
|
||||
sizeof(object_floor->uuid) + sizeof(object_floor->major_version)) ||
|
||||
(object_floor->protid != EPM_PROTOCOL_UUID) ||
|
||||
(object_floor->count_rhs != sizeof(object_floor->minor_version)))
|
||||
return EPT_S_NOT_REGISTERED;
|
||||
|
||||
if ((syntax_floor->count_lhs != sizeof(syntax_floor->protid) +
|
||||
sizeof(syntax_floor->uuid) + sizeof(syntax_floor->major_version)) ||
|
||||
(syntax_floor->protid != EPM_PROTOCOL_UUID) ||
|
||||
(syntax_floor->count_rhs != sizeof(syntax_floor->minor_version)))
|
||||
return EPT_S_NOT_REGISTERED;
|
||||
|
||||
status = RpcTransport_ParseTopOfTower(p, tower_size, protseq, address, endpoint);
|
||||
if ((status == RPC_S_OK) && syntax && object)
|
||||
{
|
||||
syntax->SyntaxGUID = syntax_floor->uuid;
|
||||
syntax->SyntaxVersion.MajorVersion = syntax_floor->major_version;
|
||||
syntax->SyntaxVersion.MinorVersion = syntax_floor->minor_version;
|
||||
object->SyntaxGUID = object_floor->uuid;
|
||||
object->SyntaxVersion.MajorVersion = object_floor->major_version;
|
||||
object->SyntaxVersion.MinorVersion = object_floor->minor_version;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* TowerConstruct (RPCRT4.@)
|
||||
*/
|
||||
RPC_STATUS WINAPI TowerConstruct(
|
||||
const RPC_SYNTAX_IDENTIFIER *object, const RPC_SYNTAX_IDENTIFIER *syntax,
|
||||
const char *protseq, const char *endpoint, const char *address,
|
||||
twr_t **tower)
|
||||
{
|
||||
size_t tower_size;
|
||||
RPC_STATUS status;
|
||||
unsigned char *p;
|
||||
twr_uuid_floor_t *object_floor;
|
||||
twr_uuid_floor_t *syntax_floor;
|
||||
|
||||
*tower = NULL;
|
||||
|
||||
status = RpcTransport_GetTopOfTower(NULL, &tower_size, protseq, address, endpoint);
|
||||
|
||||
if (status != RPC_S_OK)
|
||||
return status;
|
||||
|
||||
tower_size += sizeof(u_int16) + sizeof(*object_floor) + sizeof(*syntax_floor);
|
||||
*tower = I_RpcAllocate(FIELD_OFFSET(twr_t, tower_octet_string[tower_size]));
|
||||
if (!*tower)
|
||||
return RPC_S_OUT_OF_RESOURCES;
|
||||
|
||||
(*tower)->tower_length = tower_size;
|
||||
p = &(*tower)->tower_octet_string[0];
|
||||
*(u_int16 *)p = 5; /* number of floors */
|
||||
p += sizeof(u_int16);
|
||||
object_floor = (twr_uuid_floor_t *)p;
|
||||
p += sizeof(*object_floor);
|
||||
syntax_floor = (twr_uuid_floor_t *)p;
|
||||
p += sizeof(*syntax_floor);
|
||||
|
||||
object_floor->count_lhs = sizeof(object_floor->protid) + sizeof(object_floor->uuid) +
|
||||
sizeof(object_floor->major_version);
|
||||
object_floor->protid = EPM_PROTOCOL_UUID;
|
||||
object_floor->count_rhs = sizeof(object_floor->minor_version);
|
||||
object_floor->uuid = object->SyntaxGUID;
|
||||
object_floor->major_version = object->SyntaxVersion.MajorVersion;
|
||||
object_floor->minor_version = object->SyntaxVersion.MinorVersion;
|
||||
|
||||
syntax_floor->count_lhs = sizeof(syntax_floor->protid) + sizeof(syntax_floor->uuid) +
|
||||
sizeof(syntax_floor->major_version);
|
||||
syntax_floor->protid = EPM_PROTOCOL_UUID;
|
||||
syntax_floor->count_rhs = sizeof(syntax_floor->minor_version);
|
||||
syntax_floor->uuid = syntax->SyntaxGUID;
|
||||
syntax_floor->major_version = syntax->SyntaxVersion.MajorVersion;
|
||||
syntax_floor->minor_version = syntax->SyntaxVersion.MinorVersion;
|
||||
|
||||
status = RpcTransport_GetTopOfTower(p, &tower_size, protseq, address, endpoint);
|
||||
if (status != RPC_S_OK)
|
||||
{
|
||||
I_RpcFree(*tower);
|
||||
*tower = NULL;
|
||||
return status;
|
||||
}
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __WINE_RPC_MESSAGE_H
|
||||
@@ -24,12 +24,17 @@
|
||||
#include "wine/rpcss_shared.h"
|
||||
#include "rpc_defs.h"
|
||||
|
||||
typedef unsigned int NCA_STATUS;
|
||||
|
||||
RpcPktHdr *RPCRT4_BuildFaultHeader(unsigned long DataRepresentation, RPC_STATUS Status);
|
||||
RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, RPC_SYNTAX_IDENTIFIER *AbstractId, RPC_SYNTAX_IDENTIFIER *TransferId);
|
||||
RpcPktHdr *RPCRT4_BuildResponseHeader(unsigned long DataRepresentation, unsigned long BufferLength);
|
||||
RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, unsigned long AssocGroupId, const RPC_SYNTAX_IDENTIFIER *AbstractId, const RPC_SYNTAX_IDENTIFIER *TransferId);
|
||||
RpcPktHdr *RPCRT4_BuildBindNackHeader(unsigned long DataRepresentation, unsigned char RpcVersion, unsigned char RpcVersionMinor);
|
||||
RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, LPSTR ServerAddress, unsigned long Result, unsigned long Reason, RPC_SYNTAX_IDENTIFIER *TransferId);
|
||||
RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, unsigned long AssocGroupId, LPCSTR ServerAddress, unsigned long Result, unsigned long Reason, const RPC_SYNTAX_IDENTIFIER *TransferId);
|
||||
VOID RPCRT4_FreeHeader(RpcPktHdr *Header);
|
||||
RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength);
|
||||
RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg);
|
||||
NCA_STATUS RPC2NCA_STATUS(RPC_STATUS status);
|
||||
RPC_STATUS NCA2RPC_STATUS(NCA_STATUS status);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* RPC definitions
|
||||
*
|
||||
* Copyright 2003 Ove Kåven, TransGaming Technologies
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __WINE_RPC_MISC_H
|
||||
#define __WINE_RPC_MISC_H
|
||||
|
||||
/* flags for RPC_MESSAGE.RpcFlags */
|
||||
#define WINE_RPCFLAG_EXCEPTION 0x0001
|
||||
|
||||
#endif /* __WINE_RPC_MISC_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,26 +15,53 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __WINE_RPC_SERVER_H
|
||||
#define __WINE_RPC_SERVER_H
|
||||
|
||||
#include "rpc_binding.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
struct protseq_ops;
|
||||
|
||||
typedef struct _RpcServerProtseq
|
||||
{
|
||||
struct _RpcServerProtseq* Next;
|
||||
LPSTR Protseq;
|
||||
LPSTR Endpoint;
|
||||
UINT MaxCalls;
|
||||
RpcConnection* conn;
|
||||
const struct protseq_ops *ops; /* RO */
|
||||
struct list entry; /* CS ::server_cs */
|
||||
LPSTR Protseq; /* RO */
|
||||
UINT MaxCalls; /* RO */
|
||||
/* list of listening connections */
|
||||
RpcConnection* conn; /* CS cs */
|
||||
CRITICAL_SECTION cs;
|
||||
|
||||
/* is the server currently listening? */
|
||||
BOOL is_listening; /* CS ::listen_cs */
|
||||
/* mutex for ensuring only one thread can change state at a time */
|
||||
HANDLE mgr_mutex;
|
||||
/* set when server thread has finished opening connections */
|
||||
HANDLE server_ready_event;
|
||||
} RpcServerProtseq;
|
||||
|
||||
struct protseq_ops
|
||||
{
|
||||
const char *name;
|
||||
RpcServerProtseq *(*alloc)(void);
|
||||
void (*signal_state_changed)(RpcServerProtseq *protseq);
|
||||
/* previous array is passed in to allow reuse of memory */
|
||||
void *(*get_wait_array)(RpcServerProtseq *protseq, void *prev_array, unsigned int *count);
|
||||
void (*free_wait_array)(RpcServerProtseq *protseq, void *array);
|
||||
/* returns -1 for failure, 0 for server state changed and 1 to indicate a
|
||||
* new connection was established */
|
||||
int (*wait_for_new_connection)(RpcServerProtseq *protseq, unsigned int count, void *wait_array);
|
||||
/* opens the endpoint and optionally begins listening */
|
||||
RPC_STATUS (*open_endpoint)(RpcServerProtseq *protseq, LPSTR endpoint);
|
||||
};
|
||||
|
||||
typedef struct _RpcServerInterface
|
||||
{
|
||||
struct _RpcServerInterface* Next;
|
||||
struct list entry;
|
||||
RPC_SERVER_INTERFACE* If;
|
||||
UUID MgrTypeUuid;
|
||||
RPC_MGR_EPV* MgrEpv;
|
||||
@@ -42,6 +69,13 @@ typedef struct _RpcServerInterface
|
||||
UINT MaxCalls;
|
||||
UINT MaxRpcSize;
|
||||
RPC_IF_CALLBACK_FN* IfCallbackFn;
|
||||
LONG CurrentCalls; /* number of calls currently executing */
|
||||
/* set when unregistering interface to let the caller of
|
||||
* RpcServerUnregisterIf* know that all calls have finished */
|
||||
HANDLE CallsCompletedEvent;
|
||||
} RpcServerInterface;
|
||||
|
||||
void RPCRT4_new_client(RpcConnection* conn);
|
||||
const struct protseq_ops *rpcrt4_get_protseq_ops(const char *protseq);
|
||||
|
||||
#endif /* __WINE_RPC_SERVER_H */
|
||||
|
||||
+2
-2
@@ -375,7 +375,7 @@ static int rpcrt4_conn_np_read(RpcConnection *Connection,
|
||||
break;
|
||||
|
||||
ret = GetOverlappedResult(npc->pipe, &npc->ovl[0], &bytes_read, TRUE);
|
||||
if (!ret && GetLastError() != ERROR_MORE_DATA)
|
||||
if (!ret /*&& GetLastError() != ERROR_MORE_DATA*/)
|
||||
break;
|
||||
|
||||
bytes_left -= bytes_read;
|
||||
@@ -400,7 +400,7 @@ static int rpcrt4_conn_np_write(RpcConnection *Connection,
|
||||
break;
|
||||
|
||||
ret = GetOverlappedResult(npc->pipe, &npc->ovl[1], &bytes_written, TRUE);
|
||||
if (!ret && GetLastError() != ERROR_MORE_DATA)
|
||||
if (!ret /*&& GetLastError() != ERROR_MORE_DATA*/)
|
||||
break;
|
||||
|
||||
bytes_left -= bytes_written;
|
||||
@@ -17,28 +17,27 @@
|
||||
<library>ntdll</library>
|
||||
<library>kernel32</library>
|
||||
<library>advapi32</library>
|
||||
<library>secur32</library>
|
||||
<library>iphlpapi</library>
|
||||
<library>pseh</library>
|
||||
|
||||
<metadata
|
||||
description = "Support for the RPC layer of RPC over HTTP"
|
||||
version = "Wine-0_9_10"
|
||||
owner = "Wine" />
|
||||
|
||||
<library>ws2_32</library>
|
||||
<file>cproxy.c</file>
|
||||
<file>cpsf.c</file>
|
||||
<file>cstub.c</file>
|
||||
<file>ndr_contexthandle.c</file>
|
||||
<file>ndr_clientserver.c</file>
|
||||
<file>ndr_fullpointer.c</file>
|
||||
<file>ndr_marshall.c</file>
|
||||
<file>ndr_midl.c</file>
|
||||
<file>ndr_ole.c</file>
|
||||
<file>ndr_stubless.c</file>
|
||||
<file>rpc_assoc.c</file>
|
||||
<file>rpc_binding.c</file>
|
||||
<file>rpc_epmap.c</file>
|
||||
<file>rpc_message.c</file>
|
||||
<file>rpc_server.c</file>
|
||||
<file>ndr_contexth.c</file>
|
||||
<file>rpc_transport.c</file>
|
||||
<file>rpcrt4_main.c</file>
|
||||
<file>rpcss_np_client.c</file>
|
||||
<file>unix_func.c</file>
|
||||
<file>rpcrt4.rc</file>
|
||||
<file>rpcrt4.spec</file>
|
||||
</module>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
@ stdcall IUnknown_QueryInterface_Proxy(ptr ptr ptr)
|
||||
@ stdcall IUnknown_Release_Proxy(ptr)
|
||||
@ stub I_RpcAbortAsyncCall
|
||||
@ stub I_RpcAllocate
|
||||
@ stdcall I_RpcAllocate(long)
|
||||
@ stub I_RpcAsyncAbortCall
|
||||
@ stub I_RpcAsyncSendReceive # NT4
|
||||
@ stub I_RpcAsyncSetHandle
|
||||
@@ -45,13 +45,13 @@
|
||||
@ stub I_RpcDeleteMutex
|
||||
@ stub I_RpcEnableWmiTrace # wxp
|
||||
@ stub I_RpcExceptionFilter # wxp
|
||||
@ stub I_RpcFree
|
||||
@ stdcall I_RpcFree(ptr)
|
||||
@ stdcall I_RpcFreeBuffer(ptr)
|
||||
@ stub I_RpcFreePipeBuffer
|
||||
@ stub I_RpcGetAssociationContext
|
||||
@ stdcall I_RpcGetBuffer(ptr)
|
||||
@ stub I_RpcGetBufferWithObject
|
||||
@ stub I_RpcGetCurrentCallHandle
|
||||
@ stdcall I_RpcGetCurrentCallHandle()
|
||||
@ stub I_RpcGetExtendedError
|
||||
@ stub I_RpcGetServerContextList
|
||||
@ stub I_RpcGetThreadEvent # win9x
|
||||
@@ -59,7 +59,7 @@
|
||||
@ stub I_RpcIfInqTransferSyntaxes
|
||||
@ stub I_RpcLaunchDatagramReceiveThread # win9x
|
||||
@ stub I_RpcLogEvent
|
||||
@ stub I_RpcMapWin32Status
|
||||
@ stdcall I_RpcMapWin32Status(long)
|
||||
@ stub I_RpcMonitorAssociation
|
||||
@ stub I_RpcNegotiateTransferSyntax # wxp
|
||||
@ stub I_RpcNsBindingSetEntryName
|
||||
@@ -140,12 +140,12 @@
|
||||
@ stdcall NDRCContextBinding(ptr)
|
||||
@ stdcall NDRCContextMarshall(ptr ptr)
|
||||
@ stdcall NDRCContextUnmarshall(ptr ptr ptr long)
|
||||
@ stub NDRSContextMarshall2
|
||||
@ stdcall NDRSContextMarshall2(ptr ptr ptr ptr ptr long)
|
||||
@ stdcall NDRSContextMarshall(ptr ptr ptr)
|
||||
@ stdcall NDRSContextMarshallEx(ptr ptr ptr ptr)
|
||||
@ stub NDRSContextUnmarshall2
|
||||
@ stdcall NDRSContextUnmarshall(ptr long)
|
||||
@ stdcall NDRSContextUnmarshallEx(ptr ptr long)
|
||||
@ stdcall NDRSContextUnmarshall2(ptr ptr ptr ptr long)
|
||||
@ stdcall NDRSContextUnmarshall(ptr ptr)
|
||||
@ stdcall NDRSContextUnmarshallEx(ptr ptr ptr)
|
||||
@ stub NDRcopy
|
||||
@ stdcall NdrAllocate(ptr long)
|
||||
@ stub NdrAsyncClientCall
|
||||
@@ -158,7 +158,7 @@
|
||||
@ stdcall NdrCStdStubBuffer_Release(ptr ptr)
|
||||
@ stdcall NdrClearOutParameters(ptr ptr ptr)
|
||||
@ varargs NdrClientCall2(ptr ptr)
|
||||
@ stub NdrClientCall
|
||||
@ varargs NdrClientCall(ptr ptr) NdrClientCall2
|
||||
@ stdcall NdrClientContextMarshall(ptr ptr long)
|
||||
@ stdcall NdrClientContextUnmarshall(ptr ptr ptr)
|
||||
@ stub NdrClientInitialize
|
||||
@@ -221,12 +221,12 @@
|
||||
@ stdcall NdrFixedArrayMemorySize(ptr ptr)
|
||||
@ stdcall NdrFixedArrayUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrFreeBuffer(ptr)
|
||||
@ stub NdrFullPointerFree
|
||||
@ stub NdrFullPointerInsertRefId
|
||||
@ stub NdrFullPointerQueryPointer
|
||||
@ stub NdrFullPointerQueryRefId
|
||||
@ stub NdrFullPointerXlatFree
|
||||
@ stub NdrFullPointerXlatInit
|
||||
@ stdcall NdrFullPointerFree(ptr ptr)
|
||||
@ stdcall NdrFullPointerInsertRefId(ptr long ptr)
|
||||
@ stdcall NdrFullPointerQueryPointer(ptr ptr long ptr)
|
||||
@ stdcall NdrFullPointerQueryRefId(ptr long long ptr)
|
||||
@ stdcall NdrFullPointerXlatFree(ptr)
|
||||
@ stdcall NdrFullPointerXlatInit(long long)
|
||||
@ stdcall NdrGetBuffer(ptr long ptr)
|
||||
@ stub NdrGetDcomProtocolVersion
|
||||
@ stub NdrGetPartialBuffer
|
||||
@@ -294,7 +294,7 @@
|
||||
@ stdcall NdrProxyGetBuffer(ptr ptr)
|
||||
@ stdcall NdrProxyInitialize(ptr ptr ptr ptr long)
|
||||
@ stdcall NdrProxySendReceive(ptr ptr)
|
||||
@ stub NdrRangeUnmarshall
|
||||
@ stdcall NdrRangeUnmarshall(ptr ptr ptr long)
|
||||
@ stub NdrRpcSmClientAllocate
|
||||
@ stub NdrRpcSmClientFree
|
||||
@ stub NdrRpcSmSetClientToOsf
|
||||
@@ -377,25 +377,25 @@
|
||||
@ stub RpcBindingInqAuthClientExA
|
||||
@ stub RpcBindingInqAuthClientExW
|
||||
@ stub RpcBindingInqAuthClientW
|
||||
@ stub RpcBindingInqAuthInfoA
|
||||
@ stub RpcBindingInqAuthInfoExA
|
||||
@ stub RpcBindingInqAuthInfoExW
|
||||
@ stub RpcBindingInqAuthInfoW
|
||||
@ stdcall RpcBindingInqAuthInfoA(ptr ptr ptr ptr ptr ptr)
|
||||
@ stdcall RpcBindingInqAuthInfoExA(ptr ptr ptr ptr ptr ptr long ptr)
|
||||
@ stdcall RpcBindingInqAuthInfoExW(ptr ptr ptr ptr ptr ptr long ptr)
|
||||
@ stdcall RpcBindingInqAuthInfoW(ptr ptr ptr ptr ptr ptr)
|
||||
@ stdcall RpcBindingInqObject(ptr ptr)
|
||||
@ stub RpcBindingInqOption
|
||||
@ stub RpcBindingReset
|
||||
@ stub RpcBindingServerFromClient
|
||||
@ stub RpcBindingSetAuthInfoA
|
||||
@ stub RpcBindingSetAuthInfoExA
|
||||
@ stub RpcBindingSetAuthInfoExW
|
||||
@ stub RpcBindingSetAuthInfoW
|
||||
@ stdcall RpcBindingSetAuthInfoA(ptr str long long ptr long)
|
||||
@ stdcall RpcBindingSetAuthInfoExA(ptr str long long ptr long ptr)
|
||||
@ stdcall RpcBindingSetAuthInfoExW(ptr wstr long long ptr long ptr)
|
||||
@ stdcall RpcBindingSetAuthInfoW(ptr wstr long long ptr long)
|
||||
@ stdcall RpcBindingSetObject(ptr ptr)
|
||||
@ stub RpcBindingSetOption
|
||||
@ stdcall RpcBindingSetOption(ptr long long)
|
||||
@ stdcall RpcBindingToStringBindingA(ptr ptr)
|
||||
@ stdcall RpcBindingToStringBindingW(ptr ptr)
|
||||
@ stdcall RpcBindingVectorFree(ptr)
|
||||
@ stub RpcCancelAsyncCall
|
||||
@ stub RpcCancelThread
|
||||
@ stdcall RpcCancelThread(ptr)
|
||||
@ stub RpcCancelThreadEx
|
||||
@ stub RpcCertGeneratePrincipalNameA
|
||||
@ stub RpcCertGeneratePrincipalNameW
|
||||
@@ -414,7 +414,7 @@
|
||||
@ stub RpcErrorNumberOfRecords # wxp
|
||||
@ stub RpcErrorResetEnumeration # wxp
|
||||
@ stub RpcErrorSaveErrorInfo # wxp
|
||||
@ stub RpcErrorStartEnumeration # wxp
|
||||
@ stdcall RpcErrorStartEnumeration(ptr)
|
||||
@ stub RpcFreeAuthorizationContext # wxp
|
||||
@ stub RpcGetAsyncCallStatus
|
||||
@ stub RpcIfIdVectorFree
|
||||
@@ -423,25 +423,25 @@
|
||||
@ stub RpcInitializeAsyncHandle
|
||||
@ stub RpcMgmtBindingInqParameter # win9x
|
||||
@ stub RpcMgmtBindingSetParameter # win9x
|
||||
@ stub RpcMgmtEnableIdleCleanup
|
||||
@ stub RpcMgmtEpEltInqBegin
|
||||
@ stdcall RpcMgmtEnableIdleCleanup()
|
||||
@ stdcall RpcMgmtEpEltInqBegin(ptr long ptr long ptr ptr)
|
||||
@ stub RpcMgmtEpEltInqDone
|
||||
@ stub RpcMgmtEpEltInqNextA
|
||||
@ stub RpcMgmtEpEltInqNextW
|
||||
@ stub RpcMgmtEpUnregister
|
||||
@ stub RpcMgmtInqComTimeout
|
||||
@ stub RpcMgmtInqDefaultProtectLevel
|
||||
@ stub RpcMgmtInqIfIds
|
||||
@ stdcall RpcMgmtInqIfIds(ptr ptr)
|
||||
@ stub RpcMgmtInqParameter # win9x
|
||||
@ stub RpcMgmtInqServerPrincNameA
|
||||
@ stub RpcMgmtInqServerPrincNameW
|
||||
@ stub RpcMgmtInqStats
|
||||
@ stub RpcMgmtIsServerListening
|
||||
@ stdcall RpcMgmtIsServerListening(ptr)
|
||||
@ stub RpcMgmtSetAuthorizationFn
|
||||
@ stub RpcMgmtSetCancelTimeout
|
||||
@ stub RpcMgmtSetComTimeout
|
||||
@ stdcall RpcMgmtSetCancelTimeout(long)
|
||||
@ stdcall RpcMgmtSetComTimeout(ptr long)
|
||||
@ stub RpcMgmtSetParameter # win9x
|
||||
@ stub RpcMgmtSetServerStackSize
|
||||
@ stdcall RpcMgmtSetServerStackSize(long)
|
||||
@ stub RpcMgmtStatsVectorFree
|
||||
@ stdcall RpcMgmtStopServerListening(ptr)
|
||||
@ stdcall RpcMgmtWaitServerListen()
|
||||
@@ -494,7 +494,7 @@
|
||||
@ stub RpcServerYield
|
||||
@ stub RpcSmAllocate
|
||||
@ stub RpcSmClientFree
|
||||
@ stdcall RpcSmDestroyClientContext (ptr)
|
||||
@ stdcall RpcSmDestroyClientContext(ptr)
|
||||
@ stub RpcSmDisableAllocate
|
||||
@ stub RpcSmEnableAllocate
|
||||
@ stub RpcSmFree
|
||||
@@ -505,7 +505,7 @@
|
||||
@ stub RpcSsAllocate
|
||||
@ stub RpcSsContextLockExclusive # wxp
|
||||
@ stub RpcSsContextLockShared # wxp
|
||||
@ stdcall RpcSsDestroyClientContext (ptr)
|
||||
@ stdcall RpcSsDestroyClientContext(ptr)
|
||||
@ stub RpcSsDisableAllocate
|
||||
@ stub RpcSsDontSerializeContext
|
||||
@ stub RpcSsEnableAllocate
|
||||
@@ -527,8 +527,8 @@
|
||||
@ stub SimpleTypeBufferSize # wxp
|
||||
@ stub SimpleTypeMemorySize # wxp
|
||||
@ stub StartServiceIfNecessary # win9x
|
||||
@ stub TowerConstruct
|
||||
@ stub TowerExplode
|
||||
@ stdcall TowerConstruct(ptr ptr ptr ptr ptr ptr)
|
||||
@ stdcall TowerExplode(ptr ptr ptr ptr ptr ptr)
|
||||
@ stdcall UuidCompare(ptr ptr ptr)
|
||||
@ stdcall UuidCreate(ptr)
|
||||
@ stdcall UuidCreateNil(ptr)
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
* WINE RPC TODO's (and a few TODONT's)
|
||||
*
|
||||
* - Ove's decreasingly incomplete widl is an IDL compiler for wine. For widl
|
||||
@@ -45,11 +45,11 @@
|
||||
*
|
||||
* - Some transports are not yet implemented. The existing transport implementations
|
||||
* are incomplete and may be bug-infested.
|
||||
*
|
||||
*
|
||||
* - The various transports that we do support ought to be supported in a more
|
||||
* object-oriented manner, as in DCE's RPC implementation, instead of cluttering
|
||||
* up the code with conditionals like we do now.
|
||||
*
|
||||
*
|
||||
* - Data marshalling: So far, only the beginnings of a full implementation
|
||||
* exist in wine. NDR protocol itself is documented, but the MS API's to
|
||||
* convert data-types in memory into NDR are not. This is challenging work,
|
||||
@@ -59,7 +59,7 @@
|
||||
* use it to implement out-of-process OLE client/server communications.
|
||||
* ATM there is maybe a disconnect between the marshalling in the OLE DLLs
|
||||
* and the marshalling going on here [TODO: well, is there or not?]
|
||||
*
|
||||
*
|
||||
* - In-source API Documentation, at least for those functions which we have
|
||||
* implemented, but preferably for everything we can document, would be nice,
|
||||
* since some of this stuff is quite obscure.
|
||||
@@ -100,6 +100,8 @@
|
||||
#include "winerror.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "winnt.h"
|
||||
#include "winternl.h"
|
||||
#include "iptypes.h"
|
||||
#include "iphlpapi.h"
|
||||
#include "wine/unicode.h"
|
||||
@@ -133,6 +135,33 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
|
||||
};
|
||||
static CRITICAL_SECTION uuid_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
static CRITICAL_SECTION threaddata_cs;
|
||||
static CRITICAL_SECTION_DEBUG threaddata_cs_debug =
|
||||
{
|
||||
0, 0, &threaddata_cs,
|
||||
{ &threaddata_cs_debug.ProcessLocksList, &threaddata_cs_debug.ProcessLocksList },
|
||||
0, 0, { (DWORD_PTR)(__FILE__ ": threaddata_cs") }
|
||||
};
|
||||
static CRITICAL_SECTION threaddata_cs = { &threaddata_cs_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
struct list threaddata_list = LIST_INIT(threaddata_list);
|
||||
|
||||
struct context_handle_list
|
||||
{
|
||||
struct context_handle_list *next;
|
||||
NDR_SCONTEXT context_handle;
|
||||
};
|
||||
|
||||
struct threaddata
|
||||
{
|
||||
struct list entry;
|
||||
CRITICAL_SECTION cs;
|
||||
DWORD thread_id;
|
||||
RpcConnection *connection;
|
||||
RpcBinding *server_binding;
|
||||
struct context_handle_list *context_handle_list;
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* DllMain
|
||||
*
|
||||
@@ -148,10 +177,30 @@ static CRITICAL_SECTION uuid_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
struct threaddata *tdata;
|
||||
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
master_mutex = CreateMutexA( NULL, FALSE, RPCSS_MASTER_MUTEX_NAME);
|
||||
if (!master_mutex)
|
||||
ERR("Failed to create master mutex\n");
|
||||
break;
|
||||
|
||||
case DLL_THREAD_DETACH:
|
||||
tdata = NtCurrentTeb()->ReservedForNtRpc;
|
||||
if (tdata)
|
||||
{
|
||||
EnterCriticalSection(&threaddata_cs);
|
||||
list_remove(&tdata->entry);
|
||||
LeaveCriticalSection(&threaddata_cs);
|
||||
|
||||
DeleteCriticalSection(&tdata->cs);
|
||||
if (tdata->connection)
|
||||
ERR("tdata->connection should be NULL but is still set to %p\n", tdata->connection);
|
||||
if (tdata->server_binding)
|
||||
ERR("tdata->server_binding should be NULL but is still set to %p\n", tdata->server_binding);
|
||||
HeapFree(GetProcessHeap(), 0, tdata);
|
||||
}
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
@@ -172,7 +221,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
*
|
||||
* S_OK if successful.
|
||||
*/
|
||||
RPC_STATUS WINAPI RpcStringFreeA(unsigned char** String)
|
||||
RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR* String)
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, *String);
|
||||
|
||||
@@ -188,7 +237,7 @@ RPC_STATUS WINAPI RpcStringFreeA(unsigned char** String)
|
||||
*
|
||||
* S_OK if successful.
|
||||
*/
|
||||
RPC_STATUS WINAPI RpcStringFreeW(unsigned short** String)
|
||||
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR* String)
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, *String);
|
||||
|
||||
@@ -200,10 +249,12 @@ RPC_STATUS WINAPI RpcStringFreeW(unsigned short** String)
|
||||
*
|
||||
* Raises an exception.
|
||||
*/
|
||||
void WINAPI RpcRaiseException(RPC_STATUS exception)
|
||||
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
|
||||
{
|
||||
/* FIXME: translate exception? */
|
||||
/* shouldn't return */
|
||||
RaiseException(exception, 0, 0, NULL);
|
||||
ERR("handler continued execution\n");
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
@@ -213,7 +264,7 @@ void WINAPI RpcRaiseException(RPC_STATUS exception)
|
||||
* UUID *Uuid1 [I] Uuid to compare
|
||||
* UUID *Uuid2 [I] Uuid to compare
|
||||
* RPC_STATUS *Status [O] returns RPC_S_OK
|
||||
*
|
||||
*
|
||||
* RETURNS
|
||||
* -1 if Uuid1 is less than Uuid2
|
||||
* 0 if Uuid1 and Uuid2 are equal
|
||||
@@ -319,9 +370,7 @@ static void RPC_UuidGetSystemTime(ULONGLONG *time)
|
||||
*time += TICKS_15_OCT_1582_TO_1601;
|
||||
}
|
||||
|
||||
typedef DWORD WINAPI (*LPGETADAPTERSINFO)(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen);
|
||||
|
||||
/* Assume that a hardware address is at least 6 bytes long */
|
||||
/* Assume that a hardware address is at least 6 bytes long */
|
||||
#define ADDRESS_BYTES_NEEDED 6
|
||||
|
||||
static RPC_STATUS RPC_UuidGetNodeAddress(BYTE *address)
|
||||
@@ -331,46 +380,28 @@ static RPC_STATUS RPC_UuidGetNodeAddress(BYTE *address)
|
||||
|
||||
ULONG buflen = sizeof(IP_ADAPTER_INFO);
|
||||
PIP_ADAPTER_INFO adapter = HeapAlloc(GetProcessHeap(), 0, buflen);
|
||||
HANDLE hIpHlpApi;
|
||||
LPGETADAPTERSINFO pGetAdaptersInfo;
|
||||
|
||||
hIpHlpApi = LoadLibrary("iphlpapi.dll");
|
||||
if (hIpHlpApi)
|
||||
{
|
||||
pGetAdaptersInfo = (LPGETADAPTERSINFO)GetProcAddress(hIpHlpApi, "GetAdaptersInfo");
|
||||
if (pGetAdaptersInfo)
|
||||
{
|
||||
if (pGetAdaptersInfo(adapter, &buflen) == ERROR_BUFFER_OVERFLOW) {
|
||||
HeapFree(GetProcessHeap(), 0, adapter);
|
||||
adapter = HeapAlloc(GetProcessHeap(), 0, buflen);
|
||||
}
|
||||
if (GetAdaptersInfo(adapter, &buflen) == ERROR_BUFFER_OVERFLOW) {
|
||||
HeapFree(GetProcessHeap(), 0, adapter);
|
||||
adapter = HeapAlloc(GetProcessHeap(), 0, buflen);
|
||||
}
|
||||
|
||||
if (pGetAdaptersInfo(adapter, &buflen) == NO_ERROR) {
|
||||
for (i = 0; i < ADDRESS_BYTES_NEEDED; i++) {
|
||||
address[i] = adapter->Address[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
goto local;
|
||||
}
|
||||
if (GetAdaptersInfo(adapter, &buflen) == NO_ERROR) {
|
||||
for (i = 0; i < ADDRESS_BYTES_NEEDED; i++) {
|
||||
address[i] = adapter->Address[i];
|
||||
}
|
||||
}
|
||||
/* We can't get a hardware address, just use random numbers.
|
||||
Set the multicast bit to prevent conflicts with real cards. */
|
||||
else {
|
||||
for (i = 0; i < ADDRESS_BYTES_NEEDED; i++) {
|
||||
address[i] = rand() & 0xff;
|
||||
}
|
||||
|
||||
/* Free the Library */
|
||||
FreeLibrary(hIpHlpApi);
|
||||
goto exit;
|
||||
address[0] |= 0x01;
|
||||
status = RPC_S_UUID_LOCAL_ONLY;
|
||||
}
|
||||
|
||||
local:
|
||||
/* We can't get a hardware address, just use random numbers.
|
||||
Set the multicast bit to prevent conflicts with real cards. */
|
||||
for (i = 0; i < ADDRESS_BYTES_NEEDED; i++) {
|
||||
address[i] = rand() & 0xff;
|
||||
}
|
||||
address[0] |= 0x01;
|
||||
status = RPC_S_UUID_LOCAL_ONLY;
|
||||
|
||||
exit:
|
||||
HeapFree(GetProcessHeap(), 0, adapter);
|
||||
return status;
|
||||
}
|
||||
@@ -386,9 +417,9 @@ exit:
|
||||
* RPC_S_UUID_LOCAL_ONLY if UUID is only locally unique.
|
||||
*
|
||||
* FIXME: No compensation for changes across reloading
|
||||
* this dll or across reboots (e.g. clock going
|
||||
* this dll or across reboots (e.g. clock going
|
||||
* backwards and swapped network cards). The RFC
|
||||
* suggests using NVRAM for storing persistent
|
||||
* suggests using NVRAM for storing persistent
|
||||
* values.
|
||||
*/
|
||||
RPC_STATUS WINAPI UuidCreate(UUID *Uuid)
|
||||
@@ -525,9 +556,9 @@ unsigned short WINAPI UuidHash(UUID *uuid, RPC_STATUS *Status)
|
||||
* RETURNS
|
||||
*
|
||||
* S_OK if successful.
|
||||
* S_OUT_OF_MEMORY if unsucessful.
|
||||
* S_OUT_OF_MEMORY if unsuccessful.
|
||||
*/
|
||||
RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, unsigned char** StringUuid)
|
||||
RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, RPC_CSTR* StringUuid)
|
||||
{
|
||||
*StringUuid = HeapAlloc( GetProcessHeap(), 0, sizeof(char) * 37);
|
||||
|
||||
@@ -536,7 +567,7 @@ RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, unsigned char** StringUuid)
|
||||
|
||||
if (!Uuid) Uuid = &uuid_nil;
|
||||
|
||||
sprintf( (char*)*StringUuid, "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
sprintf( (char*)*StringUuid, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
Uuid->Data1, Uuid->Data2, Uuid->Data3,
|
||||
Uuid->Data4[0], Uuid->Data4[1], Uuid->Data4[2],
|
||||
Uuid->Data4[3], Uuid->Data4[4], Uuid->Data4[5],
|
||||
@@ -551,15 +582,15 @@ RPC_STATUS WINAPI UuidToStringA(UUID *Uuid, unsigned char** StringUuid)
|
||||
* Converts a UUID to a string.
|
||||
*
|
||||
* S_OK if successful.
|
||||
* S_OUT_OF_MEMORY if unsucessful.
|
||||
* S_OUT_OF_MEMORY if unsuccessful.
|
||||
*/
|
||||
RPC_STATUS WINAPI UuidToStringW(UUID *Uuid, unsigned short** StringUuid)
|
||||
RPC_STATUS WINAPI UuidToStringW(UUID *Uuid, RPC_WSTR* StringUuid)
|
||||
{
|
||||
char buf[37];
|
||||
|
||||
if (!Uuid) Uuid = &uuid_nil;
|
||||
|
||||
sprintf(buf, "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
sprintf(buf, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
Uuid->Data1, Uuid->Data2, Uuid->Data3,
|
||||
Uuid->Data4[0], Uuid->Data4[1], Uuid->Data4[2],
|
||||
Uuid->Data4[3], Uuid->Data4[4], Uuid->Data4[5],
|
||||
@@ -587,7 +618,7 @@ static const BYTE hex2bin[] =
|
||||
/***********************************************************************
|
||||
* UuidFromStringA (RPCRT4.@)
|
||||
*/
|
||||
RPC_STATUS WINAPI UuidFromStringA(unsigned char* s, UUID *uuid)
|
||||
RPC_STATUS WINAPI UuidFromStringA(RPC_CSTR s, UUID *uuid)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -627,7 +658,7 @@ RPC_STATUS WINAPI UuidFromStringA(unsigned char* s, UUID *uuid)
|
||||
/***********************************************************************
|
||||
* UuidFromStringW (RPCRT4.@)
|
||||
*/
|
||||
RPC_STATUS WINAPI UuidFromStringW(unsigned short* s, UUID *uuid)
|
||||
RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -673,7 +704,7 @@ HRESULT WINAPI DllRegisterServer( void )
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
BOOL RPCRT4_StartRPCSS(void)
|
||||
static BOOL RPCRT4_StartRPCSS(void)
|
||||
{
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFOA si;
|
||||
@@ -711,11 +742,11 @@ BOOL RPCRT4_StartRPCSS(void)
|
||||
|
||||
/***********************************************************************
|
||||
* RPCRT4_RPCSSOnDemandCall (internal)
|
||||
*
|
||||
*
|
||||
* Attempts to send a message to the RPCSS process
|
||||
* on the local machine, invoking it if necessary.
|
||||
* For remote RPCSS calls, use.... your imagination.
|
||||
*
|
||||
*
|
||||
* PARAMS
|
||||
* msg [I] pointer to the RPCSS message
|
||||
* vardata_payload [I] pointer vardata portion of the RPCSS message
|
||||
@@ -728,13 +759,14 @@ BOOL RPCRT4_StartRPCSS(void)
|
||||
BOOL RPCRT4_RPCSSOnDemandCall(PRPCSS_NP_MESSAGE msg, char *vardata_payload, PRPCSS_NP_REPLY reply)
|
||||
{
|
||||
HANDLE client_handle;
|
||||
BOOL ret;
|
||||
int i, j = 0;
|
||||
|
||||
TRACE("(msg == %p, vardata_payload == %p, reply == %p)\n", msg, vardata_payload, reply);
|
||||
|
||||
client_handle = RPCRT4_RpcssNPConnect();
|
||||
|
||||
while (!client_handle) {
|
||||
while (INVALID_HANDLE_VALUE == client_handle) {
|
||||
/* start the RPCSS process */
|
||||
if (!RPCRT4_StartRPCSS()) {
|
||||
ERR("Unable to start RPCSS process.\n");
|
||||
@@ -744,13 +776,13 @@ BOOL RPCRT4_RPCSSOnDemandCall(PRPCSS_NP_MESSAGE msg, char *vardata_payload, PRPC
|
||||
for (i = 0; i < 60; i++) {
|
||||
Sleep(200);
|
||||
client_handle = RPCRT4_RpcssNPConnect();
|
||||
if (client_handle) break;
|
||||
}
|
||||
if (INVALID_HANDLE_VALUE != client_handle) break;
|
||||
}
|
||||
/* we are only willing to try twice */
|
||||
if (j++ >= 1) break;
|
||||
}
|
||||
|
||||
if (!client_handle) {
|
||||
if (INVALID_HANDLE_VALUE == client_handle) {
|
||||
/* no dice! */
|
||||
ERR("Unable to connect to RPCSS process!\n");
|
||||
SetLastError(RPC_E_SERVER_DIED_DNE);
|
||||
@@ -758,12 +790,14 @@ BOOL RPCRT4_RPCSSOnDemandCall(PRPCSS_NP_MESSAGE msg, char *vardata_payload, PRPC
|
||||
}
|
||||
|
||||
/* great, we're connected. now send the message */
|
||||
ret = TRUE;
|
||||
if (!RPCRT4_SendReceiveNPMsg(client_handle, msg, vardata_payload, reply)) {
|
||||
ERR("Something is amiss: RPC_SendReceive failed.\n");
|
||||
return FALSE;
|
||||
ret = FALSE;
|
||||
}
|
||||
CloseHandle(client_handle);
|
||||
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define MAX_RPC_ERROR_TEXT 256
|
||||
@@ -780,7 +814,7 @@ BOOL RPCRT4_RPCSSOnDemandCall(PRPCSS_NP_MESSAGE msg, char *vardata_payload, PRPC
|
||||
* 4. The MSDN documentation currently declares that the second argument is
|
||||
* unsigned char *, even for the W version. I don't believe it.
|
||||
*/
|
||||
RPC_STATUS RPC_ENTRY DceErrorInqTextW (RPC_STATUS e, unsigned short *buffer)
|
||||
RPC_STATUS RPC_ENTRY DceErrorInqTextW (RPC_STATUS e, RPC_WSTR buffer)
|
||||
{
|
||||
DWORD count;
|
||||
count = FormatMessageW (FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
@@ -793,7 +827,7 @@ RPC_STATUS RPC_ENTRY DceErrorInqTextW (RPC_STATUS e, unsigned short *buffer)
|
||||
NULL, RPC_S_NOT_RPC_ERROR, 0, buffer, MAX_RPC_ERROR_TEXT, NULL);
|
||||
if (!count)
|
||||
{
|
||||
ERR ("Failed to translate error");
|
||||
ERR ("Failed to translate error\n");
|
||||
return RPC_S_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
@@ -803,7 +837,7 @@ RPC_STATUS RPC_ENTRY DceErrorInqTextW (RPC_STATUS e, unsigned short *buffer)
|
||||
/******************************************************************************
|
||||
* DceErrorInqTextA (rpcrt4.@)
|
||||
*/
|
||||
RPC_STATUS RPC_ENTRY DceErrorInqTextA (RPC_STATUS e, unsigned char *buffer)
|
||||
RPC_STATUS RPC_ENTRY DceErrorInqTextA (RPC_STATUS e, RPC_CSTR buffer)
|
||||
{
|
||||
RPC_STATUS status;
|
||||
WCHAR bufferW [MAX_RPC_ERROR_TEXT];
|
||||
@@ -812,9 +846,180 @@ RPC_STATUS RPC_ENTRY DceErrorInqTextA (RPC_STATUS e, unsigned char *buffer)
|
||||
if (!WideCharToMultiByte(CP_ACP, 0, bufferW, -1, (LPSTR)buffer, MAX_RPC_ERROR_TEXT,
|
||||
NULL, NULL))
|
||||
{
|
||||
ERR ("Failed to translate error");
|
||||
ERR ("Failed to translate error\n");
|
||||
status = RPC_S_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* I_RpcAllocate (rpcrt4.@)
|
||||
*/
|
||||
void * WINAPI I_RpcAllocate(unsigned int Size)
|
||||
{
|
||||
return HeapAlloc(GetProcessHeap(), 0, Size);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* I_RpcFree (rpcrt4.@)
|
||||
*/
|
||||
void WINAPI I_RpcFree(void *Object)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, Object);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* I_RpcMapWin32Status (rpcrt4.@)
|
||||
*/
|
||||
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
|
||||
{
|
||||
FIXME("(%ld): stub\n", status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* RpcErrorStartEnumeration (rpcrt4.@)
|
||||
*/
|
||||
RPC_STATUS RPC_ENTRY RpcErrorStartEnumeration(RPC_ERROR_ENUM_HANDLE* EnumHandle)
|
||||
{
|
||||
FIXME("(%p): stub\n", EnumHandle);
|
||||
return RPC_S_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* RpcMgmtSetCancelTimeout (rpcrt4.@)
|
||||
*/
|
||||
RPC_STATUS RPC_ENTRY RpcMgmtSetCancelTimeout(LONG Timeout)
|
||||
{
|
||||
FIXME("(%d): stub\n", Timeout);
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
static struct threaddata *get_or_create_threaddata(void)
|
||||
{
|
||||
struct threaddata *tdata = NtCurrentTeb()->ReservedForNtRpc;
|
||||
if (!tdata)
|
||||
{
|
||||
tdata = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*tdata));
|
||||
if (!tdata) return NULL;
|
||||
|
||||
InitializeCriticalSection(&tdata->cs);
|
||||
tdata->thread_id = GetCurrentThreadId();
|
||||
|
||||
EnterCriticalSection(&threaddata_cs);
|
||||
list_add_tail(&threaddata_list, &tdata->entry);
|
||||
LeaveCriticalSection(&threaddata_cs);
|
||||
|
||||
NtCurrentTeb()->ReservedForNtRpc = tdata;
|
||||
return tdata;
|
||||
}
|
||||
return tdata;
|
||||
}
|
||||
|
||||
void RPCRT4_SetThreadCurrentConnection(RpcConnection *Connection)
|
||||
{
|
||||
struct threaddata *tdata = get_or_create_threaddata();
|
||||
if (!tdata) return;
|
||||
|
||||
EnterCriticalSection(&tdata->cs);
|
||||
tdata->connection = Connection;
|
||||
LeaveCriticalSection(&tdata->cs);
|
||||
}
|
||||
|
||||
void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding)
|
||||
{
|
||||
struct threaddata *tdata = get_or_create_threaddata();
|
||||
if (!tdata) return;
|
||||
|
||||
tdata->server_binding = Binding;
|
||||
}
|
||||
|
||||
RpcBinding *RPCRT4_GetThreadCurrentCallHandle(void)
|
||||
{
|
||||
struct threaddata *tdata = get_or_create_threaddata();
|
||||
if (!tdata) return NULL;
|
||||
|
||||
return tdata->server_binding;
|
||||
}
|
||||
|
||||
void RPCRT4_PushThreadContextHandle(NDR_SCONTEXT SContext)
|
||||
{
|
||||
struct threaddata *tdata = get_or_create_threaddata();
|
||||
struct context_handle_list *context_handle_list;
|
||||
|
||||
if (!tdata) return;
|
||||
|
||||
context_handle_list = HeapAlloc(GetProcessHeap(), 0, sizeof(*context_handle_list));
|
||||
if (!context_handle_list) return;
|
||||
|
||||
context_handle_list->context_handle = SContext;
|
||||
context_handle_list->next = tdata->context_handle_list;
|
||||
tdata->context_handle_list = context_handle_list;
|
||||
}
|
||||
|
||||
void RPCRT4_RemoveThreadContextHandle(NDR_SCONTEXT SContext)
|
||||
{
|
||||
struct threaddata *tdata = get_or_create_threaddata();
|
||||
struct context_handle_list *current, *prev;
|
||||
|
||||
if (!tdata) return;
|
||||
|
||||
for (current = tdata->context_handle_list, prev = NULL; current; prev = current, current = current->next)
|
||||
{
|
||||
if (current->context_handle == SContext)
|
||||
{
|
||||
if (prev)
|
||||
prev->next = current->next;
|
||||
else
|
||||
tdata->context_handle_list = current->next;
|
||||
HeapFree(GetProcessHeap(), 0, current);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void)
|
||||
{
|
||||
struct threaddata *tdata = get_or_create_threaddata();
|
||||
struct context_handle_list *context_handle_list;
|
||||
NDR_SCONTEXT context_handle;
|
||||
|
||||
if (!tdata) return NULL;
|
||||
|
||||
context_handle_list = tdata->context_handle_list;
|
||||
if (!context_handle_list) return NULL;
|
||||
tdata->context_handle_list = context_handle_list->next;
|
||||
|
||||
context_handle = context_handle_list->context_handle;
|
||||
HeapFree(GetProcessHeap(), 0, context_handle_list);
|
||||
return context_handle;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* RpcCancelThread (rpcrt4.@)
|
||||
*/
|
||||
RPC_STATUS RPC_ENTRY RpcCancelThread(void* ThreadHandle)
|
||||
{
|
||||
DWORD target_tid;
|
||||
struct threaddata *tdata;
|
||||
|
||||
TRACE("(%p)\n", ThreadHandle);
|
||||
|
||||
target_tid = GetThreadId(ThreadHandle);
|
||||
if (!target_tid)
|
||||
return RPC_S_INVALID_ARG;
|
||||
|
||||
EnterCriticalSection(&threaddata_cs);
|
||||
LIST_FOR_EACH_ENTRY(tdata, &threaddata_list, struct threaddata, entry)
|
||||
if (tdata->thread_id == target_tid)
|
||||
{
|
||||
EnterCriticalSection(&tdata->cs);
|
||||
if (tdata->connection) rpcrt4_conn_cancel_call(tdata->connection);
|
||||
LeaveCriticalSection(&tdata->cs);
|
||||
break;
|
||||
}
|
||||
LeaveCriticalSection(&threaddata_cs);
|
||||
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
+4
-39
@@ -1,40 +1,5 @@
|
||||
--- rpc_server.c Tue Jan 01 13:09:34 2008
|
||||
+++ rpc_server.c Fri Jan 11 15:58:57 2008
|
||||
@@ -1017,22 +1017,30 @@
|
||||
/***********************************************************************
|
||||
* RpcMgmtServerWaitListen (RPCRT4.@)
|
||||
*/
|
||||
RPC_STATUS WINAPI RpcMgmtWaitServerListen( void )
|
||||
{
|
||||
- TRACE("()\n");
|
||||
+ RpcServerProtseq *cps;
|
||||
|
||||
EnterCriticalSection(&listen_cs);
|
||||
|
||||
if (!std_listen) {
|
||||
LeaveCriticalSection(&listen_cs);
|
||||
return RPC_S_NOT_LISTENING;
|
||||
}
|
||||
|
||||
+ do
|
||||
+ {
|
||||
LeaveCriticalSection(&listen_cs);
|
||||
|
||||
- FIXME("not waiting for server calls to finish\n");
|
||||
+ LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry)
|
||||
+ WaitForSingleObject(cps->server_ready_event, INFINITE);
|
||||
+
|
||||
+ EnterCriticalSection(&listen_cs);
|
||||
+ } while (!std_listen);
|
||||
+
|
||||
+ LeaveCriticalSection(&listen_cs);
|
||||
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
--- rpc_transport.c Sun Jan 06 19:27:38 2008
|
||||
+++ rpc_transport.c Fri Jan 11 15:59:32 2008
|
||||
--- H:\Working Copies\wine\dlls\rpcrt4\rpc_transport.c Sun Jan 06 19:27:38 2008
|
||||
+++ H:\Working Copies\ReactOS\trunk\reactos\dll\win32\rpcrt4\rpc_transport.c Mon Jan 07 16:02:15 2008
|
||||
@@ -54,10 +54,13 @@
|
||||
#endif
|
||||
#ifdef HAVE_SYS_POLL_H
|
||||
@@ -162,7 +127,7 @@
|
||||
break;
|
||||
+
|
||||
+ ret = GetOverlappedResult(npc->pipe, &npc->ovl[0], &bytes_read, TRUE);
|
||||
+ if (!ret && GetLastError() != ERROR_MORE_DATA)
|
||||
+ if (!ret /*&& GetLastError() != ERROR_MORE_DATA*/)
|
||||
+ break;
|
||||
+
|
||||
bytes_left -= bytes_read;
|
||||
@@ -183,7 +148,7 @@
|
||||
break;
|
||||
+
|
||||
+ ret = GetOverlappedResult(npc->pipe, &npc->ovl[1], &bytes_written, TRUE);
|
||||
+ if (!ret && GetLastError() != ERROR_MORE_DATA)
|
||||
+ if (!ret /*&& GetLastError() != ERROR_MORE_DATA*/)
|
||||
+ break;
|
||||
+
|
||||
bytes_left -= bytes_written;
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
@@ -32,22 +32,22 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
HANDLE RPCRT4_RpcssNPConnect(void)
|
||||
{
|
||||
HANDLE the_pipe = NULL;
|
||||
HANDLE the_pipe;
|
||||
DWORD dwmode, wait_result;
|
||||
HANDLE master_mutex = RPCRT4_GetMasterMutex();
|
||||
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
while (TRUE) {
|
||||
|
||||
wait_result = WaitForSingleObject(master_mutex, MASTER_MUTEX_TIMEOUT);
|
||||
switch (wait_result) {
|
||||
case WAIT_ABANDONED:
|
||||
case WAIT_ABANDONED:
|
||||
case WAIT_OBJECT_0:
|
||||
break;
|
||||
case WAIT_FAILED:
|
||||
case WAIT_TIMEOUT:
|
||||
default:
|
||||
default:
|
||||
ERR("This should never happen: couldn't enter mutex.\n");
|
||||
return NULL;
|
||||
}
|
||||
@@ -67,29 +67,27 @@ HANDLE RPCRT4_RpcssNPConnect(void)
|
||||
break;
|
||||
|
||||
if (GetLastError() != ERROR_PIPE_BUSY) {
|
||||
WARN("Unable to open named pipe %s (assuming unavailable).\n",
|
||||
WARN("Unable to open named pipe %s (assuming unavailable).\n",
|
||||
debugstr_a(NAME_RPCSS_NAMED_PIPE));
|
||||
the_pipe = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
WARN("Named pipe busy (will wait)\n");
|
||||
|
||||
|
||||
if (!ReleaseMutex(master_mutex))
|
||||
ERR("Failed to release master mutex. Expect deadlock.\n");
|
||||
|
||||
/* wait for the named pipe. We are only
|
||||
willing to wait only 5 seconds. It should be available /very/ soon. */
|
||||
/* wait for the named pipe. We are only willing to wait for 5 seconds.
|
||||
It should be available /very/ soon. */
|
||||
if (! WaitNamedPipeA(NAME_RPCSS_NAMED_PIPE, MASTER_MUTEX_WAITNAMEDPIPE_TIMEOUT))
|
||||
{
|
||||
ERR("Named pipe unavailable after waiting. Something is probably wrong.\n");
|
||||
the_pipe = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (the_pipe) {
|
||||
if (the_pipe != INVALID_HANDLE_VALUE) {
|
||||
dwmode = PIPE_READMODE_MESSAGE;
|
||||
/* SetNamedPipeHandleState not implemented ATM, but still seems to work somehow. */
|
||||
if (! SetNamedPipeHandleState(the_pipe, &dwmode, NULL, NULL))
|
||||
@@ -124,7 +122,7 @@ BOOL RPCRT4_SendReceiveNPMsg(HANDLE np, PRPCSS_NP_MESSAGE msg, char *vardata, PR
|
||||
/* process the vardata payload if necessary */
|
||||
vardata_payload_msg.message_type = RPCSS_NP_MESSAGE_TYPEID_VARDATAPAYLOADMSG;
|
||||
vardata_payload_msg.vardata_payload_size = 0; /* meaningless */
|
||||
for ( payload_offset = 0; payload_offset < msg->vardata_payload_size;
|
||||
for ( payload_offset = 0; payload_offset < msg->vardata_payload_size;
|
||||
payload_offset += VARDATA_PAYLOAD_BYTES ) {
|
||||
TRACE("sending vardata payload. vd=%p, po=%d, ps=%d\n", vardata,
|
||||
payload_offset, msg->vardata_payload_size);
|
||||
@@ -138,14 +136,14 @@ BOOL RPCRT4_SendReceiveNPMsg(HANDLE np, PRPCSS_NP_MESSAGE msg, char *vardata, PR
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! ReadFile(np, reply, sizeof(RPCSS_NP_REPLY), &count, NULL)) {
|
||||
ERR("read failed.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (count != sizeof(RPCSS_NP_REPLY)) {
|
||||
ERR("read count mismatch. got %ld, expected %u.\n", count, sizeof(RPCSS_NP_REPLY));
|
||||
ERR("read count mismatch. got %d.\n", count);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __WINE_RPCSS_NP_CLIENT_H
|
||||
|
||||
@@ -1,450 +0,0 @@
|
||||
/*
|
||||
* COM proxy implementation
|
||||
*
|
||||
* Copyright 2001 Ove Kåven, TransGaming Technologies
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* TODO: Handle non-i386 architectures
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
|
||||
#include "objbase.h"
|
||||
#include "rpcproxy.h"
|
||||
|
||||
#include "cpsf.h"
|
||||
#include "ndr_misc.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
struct StublessThunk;
|
||||
|
||||
/* I don't know what MS's std proxy structure looks like,
|
||||
so this probably doesn't match, but that shouldn't matter */
|
||||
typedef struct {
|
||||
const IRpcProxyBufferVtbl *lpVtbl;
|
||||
LPVOID *PVtbl;
|
||||
LONG RefCount;
|
||||
const MIDL_STUBLESS_PROXY_INFO *stubless;
|
||||
const IID* piid;
|
||||
LPUNKNOWN pUnkOuter;
|
||||
PCInterfaceName name;
|
||||
LPPSFACTORYBUFFER pPSFactory;
|
||||
LPRPCCHANNELBUFFER pChannel;
|
||||
struct StublessThunk *thunks;
|
||||
} StdProxyImpl;
|
||||
|
||||
static const IRpcProxyBufferVtbl StdProxy_Vtbl;
|
||||
|
||||
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
|
||||
|
||||
/* How the Windows stubless proxy thunks work is explained at
|
||||
* http://msdn.microsoft.com/library/en-us/dnmsj99/html/com0199.asp,
|
||||
* but I'll use a slightly different method, to make life easier */
|
||||
|
||||
#if defined(__i386__)
|
||||
|
||||
#include "pshpack1.h"
|
||||
|
||||
struct StublessThunk {
|
||||
BYTE push;
|
||||
DWORD index;
|
||||
BYTE call;
|
||||
LONG handler;
|
||||
BYTE ret;
|
||||
WORD bytes;
|
||||
BYTE pad[3];
|
||||
};
|
||||
|
||||
#include "poppack.h"
|
||||
|
||||
/* adjust the stack size since we don't use Windows's method */
|
||||
#define STACK_ADJUST sizeof(DWORD)
|
||||
|
||||
#define FILL_STUBLESS(x,idx,stk) \
|
||||
x->push = 0x68; /* pushl [immediate] */ \
|
||||
x->index = (idx); \
|
||||
x->call = 0xe8; /* call [near] */ \
|
||||
x->handler = (char*)ObjectStubless - (char*)&x->ret; \
|
||||
x->ret = 0xc2; /* ret [immediate] */ \
|
||||
x->bytes = stk; \
|
||||
x->pad[0] = 0x8d; /* leal (%esi),%esi */ \
|
||||
x->pad[1] = 0x76; \
|
||||
x->pad[2] = 0x00;
|
||||
|
||||
static HRESULT WINAPI ObjectStubless(DWORD index)
|
||||
{
|
||||
char *args = (char*)(&index + 2);
|
||||
LPVOID iface = *(LPVOID*)args;
|
||||
|
||||
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
|
||||
|
||||
PFORMAT_STRING fs = This->stubless->ProcFormatString + This->stubless->FormatStringOffset[index];
|
||||
unsigned bytes = *(const WORD*)(fs+8) - STACK_ADJUST;
|
||||
TRACE("(%p)->(%d)([%d bytes]) ret=%08x\n", iface, index, bytes, *(DWORD*)(args+bytes));
|
||||
|
||||
return NdrClientCall2(This->stubless->pStubDesc, fs, args);
|
||||
}
|
||||
|
||||
#else /* __i386__ */
|
||||
|
||||
/* can't do that on this arch */
|
||||
struct StublessThunk { int dummy; };
|
||||
#define FILL_STUBLESS(x,idx,stk) \
|
||||
ERR("stubless proxies are not supported on this architecture\n");
|
||||
#define STACK_ADJUST 0
|
||||
|
||||
#endif /* __i386__ */
|
||||
|
||||
HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
||||
LPUNKNOWN pUnkOuter,
|
||||
const ProxyFileInfo *ProxyInfo,
|
||||
int Index,
|
||||
LPPSFACTORYBUFFER pPSFactory,
|
||||
LPRPCPROXYBUFFER *ppProxy,
|
||||
LPVOID *ppvObj)
|
||||
{
|
||||
StdProxyImpl *This;
|
||||
const MIDL_STUBLESS_PROXY_INFO *stubless = NULL;
|
||||
PCInterfaceName name = ProxyInfo->pNamesArray[Index];
|
||||
CInterfaceProxyVtbl *vtbl = ProxyInfo->pProxyVtblList[Index];
|
||||
|
||||
TRACE("(%p,%p,%p,%p,%p) %s\n", pUnkOuter, vtbl, pPSFactory, ppProxy, ppvObj, name);
|
||||
|
||||
/* TableVersion = 2 means it is the stubless version of CInterfaceProxyVtbl */
|
||||
if (ProxyInfo->TableVersion > 1) {
|
||||
stubless = *(const void **)vtbl;
|
||||
vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1);
|
||||
TRACE("stubless=%p\n", stubless);
|
||||
}
|
||||
|
||||
TRACE("iid=%s\n", debugstr_guid(vtbl->header.piid));
|
||||
TRACE("vtbl=%p\n", vtbl->Vtbl);
|
||||
|
||||
if (!IsEqualGUID(vtbl->header.piid, riid)) {
|
||||
ERR("IID mismatch during proxy creation\n");
|
||||
return RPC_E_UNEXPECTED;
|
||||
}
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(StdProxyImpl));
|
||||
if (!This) return E_OUTOFMEMORY;
|
||||
|
||||
if (stubless) {
|
||||
CInterfaceStubVtbl *svtbl = ProxyInfo->pStubVtblList[Index];
|
||||
unsigned long i, count = svtbl->header.DispatchTableCount;
|
||||
/* Maybe the original vtbl is just modified directly to point at
|
||||
* ObjectStublessClientXXX thunks in real Windows, but I don't like it
|
||||
*/
|
||||
TRACE("stubless thunks: count=%ld\n", count);
|
||||
This->thunks = HeapAlloc(GetProcessHeap(),0,sizeof(struct StublessThunk)*count);
|
||||
This->PVtbl = HeapAlloc(GetProcessHeap(),0,sizeof(LPVOID)*count);
|
||||
for (i=0; i<count; i++) {
|
||||
struct StublessThunk *thunk = &This->thunks[i];
|
||||
if (vtbl->Vtbl[i] == (LPVOID)-1) {
|
||||
PFORMAT_STRING fs = stubless->ProcFormatString + stubless->FormatStringOffset[i];
|
||||
unsigned bytes = *(const WORD*)(fs+8) - STACK_ADJUST;
|
||||
TRACE("method %ld: stacksize=%d\n", i, bytes);
|
||||
FILL_STUBLESS(thunk, i, bytes)
|
||||
This->PVtbl[i] = thunk;
|
||||
}
|
||||
else {
|
||||
memset(thunk, 0, sizeof(struct StublessThunk));
|
||||
This->PVtbl[i] = vtbl->Vtbl[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
This->PVtbl = vtbl->Vtbl;
|
||||
|
||||
This->lpVtbl = &StdProxy_Vtbl;
|
||||
/* one reference for the proxy */
|
||||
This->RefCount = 1;
|
||||
This->stubless = stubless;
|
||||
This->piid = vtbl->header.piid;
|
||||
This->pUnkOuter = pUnkOuter;
|
||||
This->name = name;
|
||||
This->pPSFactory = pPSFactory;
|
||||
This->pChannel = NULL;
|
||||
*ppProxy = (LPRPCPROXYBUFFER)&This->lpVtbl;
|
||||
*ppvObj = &This->PVtbl;
|
||||
/* if there is no outer unknown then the caller will control the lifetime
|
||||
* of the proxy object through the proxy buffer, so no need to increment the
|
||||
* ref count of the proxy object */
|
||||
if (pUnkOuter)
|
||||
IUnknown_AddRef((IUnknown *)*ppvObj);
|
||||
IPSFactoryBuffer_AddRef(pPSFactory);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static void WINAPI StdProxy_Destruct(LPRPCPROXYBUFFER iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
|
||||
|
||||
if (This->pChannel)
|
||||
IRpcProxyBuffer_Disconnect(iface);
|
||||
|
||||
IPSFactoryBuffer_Release(This->pPSFactory);
|
||||
if (This->thunks) {
|
||||
HeapFree(GetProcessHeap(),0,This->PVtbl);
|
||||
HeapFree(GetProcessHeap(),0,This->thunks);
|
||||
}
|
||||
HeapFree(GetProcessHeap(),0,This);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI StdProxy_QueryInterface(LPRPCPROXYBUFFER iface,
|
||||
REFIID riid,
|
||||
LPVOID *obj)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
|
||||
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj);
|
||||
|
||||
if (IsEqualGUID(&IID_IUnknown,riid) ||
|
||||
IsEqualGUID(This->piid,riid)) {
|
||||
*obj = &This->PVtbl;
|
||||
InterlockedIncrement(&This->RefCount);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (IsEqualGUID(&IID_IRpcProxyBuffer,riid)) {
|
||||
*obj = &This->lpVtbl;
|
||||
InterlockedIncrement(&This->RefCount);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI StdProxy_AddRef(LPRPCPROXYBUFFER iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
|
||||
TRACE("(%p)->AddRef()\n",This);
|
||||
|
||||
return InterlockedIncrement(&This->RefCount);
|
||||
}
|
||||
|
||||
static ULONG WINAPI StdProxy_Release(LPRPCPROXYBUFFER iface)
|
||||
{
|
||||
ULONG refs;
|
||||
ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
|
||||
TRACE("(%p)->Release()\n",This);
|
||||
|
||||
refs = InterlockedDecrement(&This->RefCount);
|
||||
if (!refs)
|
||||
StdProxy_Destruct((LPRPCPROXYBUFFER)&This->lpVtbl);
|
||||
return refs;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI StdProxy_Connect(LPRPCPROXYBUFFER iface,
|
||||
LPRPCCHANNELBUFFER pChannel)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
|
||||
TRACE("(%p)->Connect(%p)\n",This,pChannel);
|
||||
|
||||
This->pChannel = pChannel;
|
||||
IRpcChannelBuffer_AddRef(pChannel);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static VOID WINAPI StdProxy_Disconnect(LPRPCPROXYBUFFER iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface);
|
||||
TRACE("(%p)->Disconnect()\n",This);
|
||||
|
||||
IRpcChannelBuffer_Release(This->pChannel);
|
||||
This->pChannel = NULL;
|
||||
}
|
||||
|
||||
static const IRpcProxyBufferVtbl StdProxy_Vtbl =
|
||||
{
|
||||
StdProxy_QueryInterface,
|
||||
StdProxy_AddRef,
|
||||
StdProxy_Release,
|
||||
StdProxy_Connect,
|
||||
StdProxy_Disconnect
|
||||
};
|
||||
|
||||
static void StdProxy_GetChannel(LPVOID iface,
|
||||
LPRPCCHANNELBUFFER *ppChannel)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
|
||||
TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name);
|
||||
|
||||
*ppChannel = This->pChannel;
|
||||
}
|
||||
|
||||
static void StdProxy_GetIID(LPVOID iface,
|
||||
const IID **ppiid)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
|
||||
TRACE("(%p)->GetIID(%p) %s\n",This,ppiid,This->name);
|
||||
|
||||
*ppiid = This->piid;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IUnknown_QueryInterface_Proxy(LPUNKNOWN iface,
|
||||
REFIID riid,
|
||||
LPVOID *ppvObj)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
|
||||
TRACE("(%p)->QueryInterface(%s,%p) %s\n",This,debugstr_guid(riid),ppvObj,This->name);
|
||||
return IUnknown_QueryInterface(This->pUnkOuter,riid,ppvObj);
|
||||
}
|
||||
|
||||
ULONG WINAPI IUnknown_AddRef_Proxy(LPUNKNOWN iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
|
||||
TRACE("(%p)->AddRef() %s\n",This,This->name);
|
||||
return IUnknown_AddRef(This->pUnkOuter);
|
||||
}
|
||||
|
||||
ULONG WINAPI IUnknown_Release_Proxy(LPUNKNOWN iface)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
|
||||
TRACE("(%p)->Release() %s\n",This,This->name);
|
||||
return IUnknown_Release(This->pUnkOuter);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyInitialize [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrProxyInitialize(void *This,
|
||||
PRPC_MESSAGE pRpcMsg,
|
||||
PMIDL_STUB_MESSAGE pStubMsg,
|
||||
PMIDL_STUB_DESC pStubDescriptor,
|
||||
unsigned int ProcNum)
|
||||
{
|
||||
TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
|
||||
NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
|
||||
StdProxy_GetChannel(This, &pStubMsg->pRpcChannelBuffer);
|
||||
IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
|
||||
&pStubMsg->dwDestContext,
|
||||
&pStubMsg->pvDestContext);
|
||||
TRACE("channel=%p\n", pStubMsg->pRpcChannelBuffer);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyGetBuffer [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrProxyGetBuffer(void *This,
|
||||
PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
HRESULT hr;
|
||||
const IID *riid = NULL;
|
||||
|
||||
TRACE("(%p,%p)\n", This, pStubMsg);
|
||||
pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
|
||||
pStubMsg->dwStubPhase = PROXY_GETBUFFER;
|
||||
StdProxy_GetIID(This, &riid);
|
||||
hr = IRpcChannelBuffer_GetBuffer(pStubMsg->pRpcChannelBuffer,
|
||||
(RPCOLEMESSAGE*)pStubMsg->RpcMsg,
|
||||
riid);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
RpcRaiseException(hr);
|
||||
return;
|
||||
}
|
||||
pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
|
||||
pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
|
||||
pStubMsg->Buffer = pStubMsg->BufferStart;
|
||||
pStubMsg->dwStubPhase = PROXY_MARSHAL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxySendReceive [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrProxySendReceive(void *This,
|
||||
PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
ULONG Status = 0;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%p)\n", This, pStubMsg);
|
||||
|
||||
if (!pStubMsg->pRpcChannelBuffer)
|
||||
{
|
||||
WARN("Trying to use disconnected proxy %p\n", This);
|
||||
RpcRaiseException(RPC_E_DISCONNECTED);
|
||||
}
|
||||
|
||||
pStubMsg->dwStubPhase = PROXY_SENDRECEIVE;
|
||||
hr = IRpcChannelBuffer_SendReceive(pStubMsg->pRpcChannelBuffer,
|
||||
(RPCOLEMESSAGE*)pStubMsg->RpcMsg,
|
||||
&Status);
|
||||
pStubMsg->dwStubPhase = PROXY_UNMARSHAL;
|
||||
pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength;
|
||||
pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
|
||||
pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
|
||||
pStubMsg->Buffer = pStubMsg->BufferStart;
|
||||
|
||||
/* raise exception if call failed */
|
||||
if (hr == RPC_S_CALL_FAILED) RpcRaiseException(*(DWORD*)pStubMsg->Buffer);
|
||||
else if (FAILED(hr)) RpcRaiseException(hr);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyFreeBuffer [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrProxyFreeBuffer(void *This,
|
||||
PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%p)\n", This, pStubMsg);
|
||||
hr = IRpcChannelBuffer_FreeBuffer(pStubMsg->pRpcChannelBuffer,
|
||||
(RPCOLEMESSAGE*)pStubMsg->RpcMsg);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyErrorHandler [RPCRT4.@]
|
||||
*/
|
||||
HRESULT WINAPI NdrProxyErrorHandler(DWORD dwExceptionCode)
|
||||
{
|
||||
WARN("(0x%08x): a proxy call failed\n", dwExceptionCode);
|
||||
|
||||
if (FAILED(dwExceptionCode))
|
||||
return dwExceptionCode;
|
||||
else
|
||||
return HRESULT_FROM_WIN32(dwExceptionCode);
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
|
||||
LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv )
|
||||
{
|
||||
typedef INT (WINAPI *MessageBoxA)(HWND,LPCSTR,LPCSTR,UINT);
|
||||
HMODULE hUser32 = LoadLibraryA("user32");
|
||||
MessageBoxA pMessageBoxA = (void *)GetProcAddress(hUser32, "MessageBoxA");
|
||||
|
||||
FIXME("%p %p %s %p %p\n", pTypeInfo, pUnkOuter, debugstr_guid(riid), ppProxy, ppv);
|
||||
if (pMessageBoxA)
|
||||
{
|
||||
pMessageBoxA(NULL,
|
||||
"The native implementation of OLEAUT32.DLL cannot be used "
|
||||
"with Wine's RPCRT4.DLL. Remove OLEAUT32.DLL and try again.\n",
|
||||
"Wine: Unimplemented CreateProxyFromTypeInfo",
|
||||
0x10);
|
||||
ExitProcess(1);
|
||||
}
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
@@ -1,307 +0,0 @@
|
||||
/*
|
||||
* COM proxy/stub factory (CStdPSFactory) implementation
|
||||
*
|
||||
* Copyright 2001 Ove Kåven, TransGaming Technologies
|
||||
*
|
||||
* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "winreg.h"
|
||||
|
||||
#include "objbase.h"
|
||||
|
||||
#include "rpcproxy.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "cpsf.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
static BOOL FindProxyInfo(const ProxyFileInfo **pProxyFileList, REFIID riid, const ProxyFileInfo **pProxyInfo, int *pIndex)
|
||||
{
|
||||
while (*pProxyFileList) {
|
||||
if ((*pProxyFileList)->pIIDLookupRtn(riid, pIndex)) {
|
||||
*pProxyInfo = *pProxyFileList;
|
||||
TRACE("found: ProxyInfo %p Index %d\n", *pProxyInfo, *pIndex);
|
||||
return TRUE;
|
||||
}
|
||||
pProxyFileList++;
|
||||
}
|
||||
TRACE("not found\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI CStdPSFactory_QueryInterface(LPPSFACTORYBUFFER iface,
|
||||
REFIID riid,
|
||||
LPVOID *obj)
|
||||
{
|
||||
CStdPSFactoryBuffer *This = (CStdPSFactoryBuffer *)iface;
|
||||
TRACE("(%p)->QueryInterface(%s,%p)\n",iface,debugstr_guid(riid),obj);
|
||||
if (IsEqualGUID(&IID_IUnknown,riid) ||
|
||||
IsEqualGUID(&IID_IPSFactoryBuffer,riid)) {
|
||||
*obj = This;
|
||||
This->RefCount++;
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI CStdPSFactory_AddRef(LPPSFACTORYBUFFER iface)
|
||||
{
|
||||
CStdPSFactoryBuffer *This = (CStdPSFactoryBuffer *)iface;
|
||||
TRACE("(%p)->AddRef()\n",iface);
|
||||
return ++(This->RefCount);
|
||||
}
|
||||
|
||||
static ULONG WINAPI CStdPSFactory_Release(LPPSFACTORYBUFFER iface)
|
||||
{
|
||||
CStdPSFactoryBuffer *This = (CStdPSFactoryBuffer *)iface;
|
||||
TRACE("(%p)->Release()\n",iface);
|
||||
return --(This->RefCount);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI CStdPSFactory_CreateProxy(LPPSFACTORYBUFFER iface,
|
||||
LPUNKNOWN pUnkOuter,
|
||||
REFIID riid,
|
||||
LPRPCPROXYBUFFER *ppProxy,
|
||||
LPVOID *ppv)
|
||||
{
|
||||
CStdPSFactoryBuffer *This = (CStdPSFactoryBuffer *)iface;
|
||||
const ProxyFileInfo *ProxyInfo;
|
||||
int Index;
|
||||
TRACE("(%p)->CreateProxy(%p,%s,%p,%p)\n",iface,pUnkOuter,
|
||||
debugstr_guid(riid),ppProxy,ppv);
|
||||
if (!FindProxyInfo(This->pProxyFileList,riid,&ProxyInfo,&Index))
|
||||
return E_NOINTERFACE;
|
||||
return StdProxy_Construct(riid, pUnkOuter, ProxyInfo, Index, iface, ppProxy, ppv);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI CStdPSFactory_CreateStub(LPPSFACTORYBUFFER iface,
|
||||
REFIID riid,
|
||||
LPUNKNOWN pUnkServer,
|
||||
LPRPCSTUBBUFFER *ppStub)
|
||||
{
|
||||
CStdPSFactoryBuffer *This = (CStdPSFactoryBuffer *)iface;
|
||||
const ProxyFileInfo *ProxyInfo;
|
||||
int Index;
|
||||
TRACE("(%p)->CreateStub(%s,%p,%p)\n",iface,debugstr_guid(riid),
|
||||
pUnkServer,ppStub);
|
||||
if (!FindProxyInfo(This->pProxyFileList,riid,&ProxyInfo,&Index))
|
||||
return E_NOINTERFACE;
|
||||
|
||||
if(ProxyInfo->pDelegatedIIDs && ProxyInfo->pDelegatedIIDs[Index])
|
||||
return CStdStubBuffer_Delegating_Construct(riid, pUnkServer, ProxyInfo->pNamesArray[Index],
|
||||
ProxyInfo->pStubVtblList[Index], ProxyInfo->pDelegatedIIDs[Index],
|
||||
iface, ppStub);
|
||||
|
||||
return CStdStubBuffer_Construct(riid, pUnkServer, ProxyInfo->pNamesArray[Index],
|
||||
ProxyInfo->pStubVtblList[Index], iface, ppStub);
|
||||
}
|
||||
|
||||
static const IPSFactoryBufferVtbl CStdPSFactory_Vtbl =
|
||||
{
|
||||
CStdPSFactory_QueryInterface,
|
||||
CStdPSFactory_AddRef,
|
||||
CStdPSFactory_Release,
|
||||
CStdPSFactory_CreateProxy,
|
||||
CStdPSFactory_CreateStub
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* NdrDllGetClassObject [RPCRT4.@]
|
||||
*/
|
||||
HRESULT WINAPI NdrDllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv,
|
||||
const ProxyFileInfo **pProxyFileList,
|
||||
const CLSID *pclsid,
|
||||
CStdPSFactoryBuffer *pPSFactoryBuffer)
|
||||
{
|
||||
TRACE("(%s, %s, %p, %p, %s, %p)\n", debugstr_guid(rclsid),
|
||||
debugstr_guid(iid), ppv, pProxyFileList, debugstr_guid(pclsid),
|
||||
pPSFactoryBuffer);
|
||||
|
||||
*ppv = NULL;
|
||||
if (!pPSFactoryBuffer->lpVtbl) {
|
||||
const ProxyFileInfo **pProxyFileList2;
|
||||
int max_delegating_vtbl_size = 0;
|
||||
pPSFactoryBuffer->lpVtbl = &CStdPSFactory_Vtbl;
|
||||
pPSFactoryBuffer->RefCount = 0;
|
||||
pPSFactoryBuffer->pProxyFileList = pProxyFileList;
|
||||
for (pProxyFileList2 = pProxyFileList; *pProxyFileList2; pProxyFileList2++) {
|
||||
int i;
|
||||
for (i = 0; i < (*pProxyFileList2)->TableSize; i++) {
|
||||
/* FIXME: i think that different vtables should be copied for
|
||||
* async interfaces */
|
||||
void * const *pSrcRpcStubVtbl = (void * const *)&CStdStubBuffer_Vtbl;
|
||||
void **pRpcStubVtbl = (void **)&(*pProxyFileList2)->pStubVtblList[i]->Vtbl;
|
||||
int j;
|
||||
|
||||
if ((*pProxyFileList2)->pDelegatedIIDs && (*pProxyFileList2)->pDelegatedIIDs[i]) {
|
||||
pSrcRpcStubVtbl = (void * const *)&CStdStubBuffer_Delegating_Vtbl;
|
||||
if ((*pProxyFileList2)->pStubVtblList[i]->header.DispatchTableCount > max_delegating_vtbl_size)
|
||||
max_delegating_vtbl_size = (*pProxyFileList2)->pStubVtblList[i]->header.DispatchTableCount;
|
||||
}
|
||||
|
||||
for (j = 0; j < sizeof(IRpcStubBufferVtbl)/sizeof(void *); j++)
|
||||
if (!pRpcStubVtbl[j])
|
||||
pRpcStubVtbl[j] = pSrcRpcStubVtbl[j];
|
||||
}
|
||||
}
|
||||
if(max_delegating_vtbl_size > 0)
|
||||
create_delegating_vtbl(max_delegating_vtbl_size);
|
||||
}
|
||||
if (IsEqualGUID(rclsid, pclsid))
|
||||
return IPSFactoryBuffer_QueryInterface((LPPSFACTORYBUFFER)pPSFactoryBuffer, iid, ppv);
|
||||
else {
|
||||
const ProxyFileInfo *info;
|
||||
int index;
|
||||
/* otherwise, the dll may be using the iid as the clsid, so
|
||||
* search for it in the proxy file list */
|
||||
if (FindProxyInfo(pProxyFileList, rclsid, &info, &index))
|
||||
return IPSFactoryBuffer_QueryInterface((LPPSFACTORYBUFFER)pPSFactoryBuffer, iid, ppv);
|
||||
|
||||
WARN("class %s not available\n", debugstr_guid(rclsid));
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrDllCanUnloadNow [RPCRT4.@]
|
||||
*/
|
||||
HRESULT WINAPI NdrDllCanUnloadNow(CStdPSFactoryBuffer *pPSFactoryBuffer)
|
||||
{
|
||||
return !(pPSFactoryBuffer->RefCount);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrDllRegisterProxy [RPCRT4.@]
|
||||
*/
|
||||
HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
|
||||
const ProxyFileInfo **pProxyFileList,
|
||||
const CLSID *pclsid)
|
||||
{
|
||||
LPSTR clsid;
|
||||
char keyname[120], module[MAX_PATH];
|
||||
HKEY key, subkey;
|
||||
DWORD len;
|
||||
|
||||
TRACE("(%p,%p,%s)\n", hDll, pProxyFileList, debugstr_guid(pclsid));
|
||||
UuidToStringA((UUID*)pclsid, (unsigned char**)&clsid);
|
||||
|
||||
/* register interfaces to point to clsid */
|
||||
while (*pProxyFileList) {
|
||||
unsigned u;
|
||||
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);
|
||||
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
RegCloseKey(key);
|
||||
}
|
||||
}
|
||||
pProxyFileList++;
|
||||
}
|
||||
|
||||
/* register clsid to point to module */
|
||||
snprintf(keyname, sizeof(keyname), "CLSID\\{%s}", clsid);
|
||||
len = GetModuleFileNameA(hDll, module, sizeof(module));
|
||||
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);
|
||||
}
|
||||
RegCloseKey(key);
|
||||
}
|
||||
}
|
||||
|
||||
/* done */
|
||||
RpcStringFreeA((unsigned char**)&clsid);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrDllUnregisterProxy [RPCRT4.@]
|
||||
*/
|
||||
HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
|
||||
const ProxyFileInfo **pProxyFileList,
|
||||
const CLSID *pclsid)
|
||||
{
|
||||
LPSTR clsid;
|
||||
char keyname[120], module[MAX_PATH];
|
||||
DWORD len;
|
||||
|
||||
TRACE("(%p,%p,%s)\n", hDll, pProxyFileList, debugstr_guid(pclsid));
|
||||
UuidToStringA((UUID*)pclsid, (unsigned char**)&clsid);
|
||||
|
||||
/* unregister interfaces */
|
||||
while (*pProxyFileList) {
|
||||
unsigned u;
|
||||
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);
|
||||
|
||||
UuidToStringA((UUID*)proxy->header.piid, (unsigned char**)&iid);
|
||||
snprintf(keyname, sizeof(keyname), "Interface\\{%s}", iid);
|
||||
RpcStringFreeA((unsigned char**)&iid);
|
||||
RegDeleteKeyA(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);
|
||||
}
|
||||
|
||||
/* done */
|
||||
RpcStringFreeA((unsigned char**)&clsid);
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* COM proxy definitions
|
||||
*
|
||||
* Copyright 2001 Ove Kåven, TransGaming Technologies
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __WINE_CPSF_H
|
||||
#define __WINE_CPSF_H
|
||||
|
||||
HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
||||
LPUNKNOWN pUnkOuter,
|
||||
const ProxyFileInfo *ProxyInfo,
|
||||
int Index,
|
||||
LPPSFACTORYBUFFER pPSFactory,
|
||||
LPRPCPROXYBUFFER *ppProxy,
|
||||
LPVOID *ppvObj);
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
|
||||
LPUNKNOWN pUnkServer,
|
||||
PCInterfaceName name,
|
||||
CInterfaceStubVtbl *vtbl,
|
||||
LPPSFACTORYBUFFER pPSFactory,
|
||||
LPRPCSTUBBUFFER *ppStub);
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_Delegating_Construct(REFIID riid,
|
||||
LPUNKNOWN pUnkServer,
|
||||
PCInterfaceName name,
|
||||
CInterfaceStubVtbl *vtbl,
|
||||
REFIID delegating_iid,
|
||||
LPPSFACTORYBUFFER pPSFactory,
|
||||
LPRPCSTUBBUFFER *ppStub);
|
||||
|
||||
const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface);
|
||||
|
||||
const IRpcStubBufferVtbl CStdStubBuffer_Vtbl;
|
||||
const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl;
|
||||
|
||||
void create_delegating_vtbl(DWORD num_methods);
|
||||
|
||||
HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub);
|
||||
|
||||
#endif /* __WINE_CPSF_H */
|
||||
@@ -1,599 +0,0 @@
|
||||
/*
|
||||
* COM stub (CStdStubBuffer) implementation
|
||||
*
|
||||
* Copyright 2001 Ove Kåven, TransGaming Technologies
|
||||
*
|
||||
* 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 "winerror.h"
|
||||
#include "excpt.h"
|
||||
|
||||
#include "objbase.h"
|
||||
#include "rpcproxy.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/exception.h"
|
||||
|
||||
#include "cpsf.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
#define STUB_HEADER(This) (((const CInterfaceStubHeader*)((This)->lpVtbl))[-1])
|
||||
|
||||
static WINE_EXCEPTION_FILTER(stub_filter)
|
||||
{
|
||||
if (GetExceptionInformation()->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
IUnknownVtbl *base_obj;
|
||||
IRpcStubBuffer *base_stub;
|
||||
CStdStubBuffer stub_buffer;
|
||||
} cstdstubbuffer_delegating_t;
|
||||
|
||||
static inline cstdstubbuffer_delegating_t *impl_from_delegating( IRpcStubBuffer *iface )
|
||||
{
|
||||
return (cstdstubbuffer_delegating_t*)((char *)iface - FIELD_OFFSET(cstdstubbuffer_delegating_t, stub_buffer));
|
||||
}
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
|
||||
LPUNKNOWN pUnkServer,
|
||||
PCInterfaceName name,
|
||||
CInterfaceStubVtbl *vtbl,
|
||||
LPPSFACTORYBUFFER pPSFactory,
|
||||
LPRPCSTUBBUFFER *ppStub)
|
||||
{
|
||||
CStdStubBuffer *This;
|
||||
IUnknown *pvServer;
|
||||
HRESULT r;
|
||||
TRACE("(%p,%p,%p,%p) %s\n", pUnkServer, vtbl, pPSFactory, ppStub, name);
|
||||
TRACE("iid=%s\n", debugstr_guid(vtbl->header.piid));
|
||||
TRACE("vtbl=%p\n", &vtbl->Vtbl);
|
||||
|
||||
if (!IsEqualGUID(vtbl->header.piid, riid)) {
|
||||
ERR("IID mismatch during stub creation\n");
|
||||
return RPC_E_UNEXPECTED;
|
||||
}
|
||||
|
||||
r = IUnknown_QueryInterface(pUnkServer, riid, (void**)&pvServer);
|
||||
if(FAILED(r))
|
||||
return r;
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(CStdStubBuffer));
|
||||
if (!This) {
|
||||
IUnknown_Release(pvServer);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
This->lpVtbl = &vtbl->Vtbl;
|
||||
This->RefCount = 1;
|
||||
This->pvServerObject = pvServer;
|
||||
This->pPSFactory = pPSFactory;
|
||||
*ppStub = (LPRPCSTUBBUFFER)This;
|
||||
|
||||
IPSFactoryBuffer_AddRef(pPSFactory);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static CRITICAL_SECTION delegating_vtbl_section;
|
||||
static CRITICAL_SECTION_DEBUG critsect_debug =
|
||||
{
|
||||
0, 0, &delegating_vtbl_section,
|
||||
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
|
||||
0, 0, { (DWORD_PTR)(__FILE__ ": delegating_vtbl_section") }
|
||||
};
|
||||
static CRITICAL_SECTION delegating_vtbl_section = { &critsect_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD ref;
|
||||
DWORD size;
|
||||
void **methods;
|
||||
IUnknownVtbl vtbl;
|
||||
/* remaining entries in vtbl */
|
||||
} ref_counted_vtbl;
|
||||
|
||||
static struct
|
||||
{
|
||||
ref_counted_vtbl *table;
|
||||
} current_vtbl;
|
||||
|
||||
|
||||
static HRESULT WINAPI delegating_QueryInterface(IUnknown *pUnk, REFIID iid, void **ppv)
|
||||
{
|
||||
*ppv = (void *)pUnk;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static ULONG WINAPI delegating_AddRef(IUnknown *pUnk)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static ULONG WINAPI delegating_Release(IUnknown *pUnk)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(__i386__)
|
||||
|
||||
/* The idea here is to replace the first param on the stack
|
||||
ie. This (which will point to cstdstubbuffer_delegating_t)
|
||||
with This->stub_buffer.pvServerObject and then jump to the
|
||||
relevant offset in This->stub_buffer.pvServerObject's vtbl.
|
||||
*/
|
||||
#include "pshpack1.h"
|
||||
typedef struct {
|
||||
DWORD mov1; /* mov 0x4(%esp), %eax 8b 44 24 04 */
|
||||
WORD mov2; /* mov 0x10(%eax), %eax 8b 40 */
|
||||
BYTE sixteen; /* 10 */
|
||||
DWORD mov3; /* mov %eax, 0x4(%esp) 89 44 24 04 */
|
||||
WORD mov4; /* mov (%eax), %eax 8b 00 */
|
||||
WORD mov5; /* mov offset(%eax), %eax 8b 80 */
|
||||
DWORD offset; /* xx xx xx xx */
|
||||
WORD jmp; /* jmp *%eax ff e0 */
|
||||
BYTE pad[3]; /* lea 0x0(%esi), %esi 8d 76 00 */
|
||||
} vtbl_method_t;
|
||||
#include "poppack.h"
|
||||
|
||||
static void fill_table(IUnknownVtbl *vtbl, void **methods, DWORD num)
|
||||
{
|
||||
vtbl_method_t *method;
|
||||
void **entry;
|
||||
DWORD i;
|
||||
|
||||
vtbl->QueryInterface = delegating_QueryInterface;
|
||||
vtbl->AddRef = delegating_AddRef;
|
||||
vtbl->Release = delegating_Release;
|
||||
|
||||
method = (vtbl_method_t*)methods;
|
||||
entry = (void**)(vtbl + 1);
|
||||
|
||||
for(i = 3; i < num; i++)
|
||||
{
|
||||
*entry = method;
|
||||
method->mov1 = 0x0424448b;
|
||||
method->mov2 = 0x408b;
|
||||
method->sixteen = 0x10;
|
||||
method->mov3 = 0x04244489;
|
||||
method->mov4 = 0x008b;
|
||||
method->mov5 = 0x808b;
|
||||
method->offset = i << 2;
|
||||
method->jmp = 0xe0ff;
|
||||
method->pad[0] = 0x8d;
|
||||
method->pad[1] = 0x76;
|
||||
method->pad[2] = 0x00;
|
||||
|
||||
method++;
|
||||
entry++;
|
||||
}
|
||||
}
|
||||
|
||||
#else /* __i386__ */
|
||||
|
||||
typedef struct {int dummy;} vtbl_method_t;
|
||||
static void fill_table(IUnknownVtbl *vtbl, DWORD num)
|
||||
{
|
||||
ERR("delegated stubs are not supported on this architecture\n");
|
||||
}
|
||||
|
||||
#endif /* __i386__ */
|
||||
|
||||
void create_delegating_vtbl(DWORD num_methods)
|
||||
{
|
||||
TRACE("%d\n", num_methods);
|
||||
if(num_methods <= 3)
|
||||
{
|
||||
ERR("should have more than %d methods\n", num_methods);
|
||||
return;
|
||||
}
|
||||
|
||||
EnterCriticalSection(&delegating_vtbl_section);
|
||||
if(!current_vtbl.table || num_methods > current_vtbl.table->size)
|
||||
{
|
||||
DWORD size;
|
||||
DWORD old_protect;
|
||||
if(current_vtbl.table && current_vtbl.table->ref == 0)
|
||||
{
|
||||
TRACE("freeing old table\n");
|
||||
VirtualFree(current_vtbl.table->methods,
|
||||
(current_vtbl.table->size - 3) * sizeof(vtbl_method_t),
|
||||
MEM_RELEASE);
|
||||
HeapFree(GetProcessHeap(), 0, current_vtbl.table);
|
||||
}
|
||||
size = (num_methods - 3) * sizeof(vtbl_method_t);
|
||||
current_vtbl.table = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(ref_counted_vtbl, vtbl) + num_methods * sizeof(void*));
|
||||
current_vtbl.table->ref = 0;
|
||||
current_vtbl.table->size = num_methods;
|
||||
current_vtbl.table->methods = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||
fill_table(¤t_vtbl.table->vtbl, current_vtbl.table->methods, num_methods);
|
||||
VirtualProtect(current_vtbl.table->methods, size, PAGE_EXECUTE_READ, &old_protect);
|
||||
}
|
||||
LeaveCriticalSection(&delegating_vtbl_section);
|
||||
}
|
||||
|
||||
static IUnknownVtbl *get_delegating_vtbl(void)
|
||||
{
|
||||
IUnknownVtbl *ret;
|
||||
|
||||
EnterCriticalSection(&delegating_vtbl_section);
|
||||
current_vtbl.table->ref++;
|
||||
ret = ¤t_vtbl.table->vtbl;
|
||||
LeaveCriticalSection(&delegating_vtbl_section);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void release_delegating_vtbl(IUnknownVtbl *vtbl)
|
||||
{
|
||||
ref_counted_vtbl *table = (ref_counted_vtbl*)((DWORD *)vtbl - 1);
|
||||
|
||||
EnterCriticalSection(&delegating_vtbl_section);
|
||||
table->ref--;
|
||||
TRACE("ref now %d\n", table->ref);
|
||||
if(table->ref == 0 && table != current_vtbl.table)
|
||||
{
|
||||
TRACE("... and we're not current so free'ing\n");
|
||||
VirtualFree(current_vtbl.table->methods,
|
||||
(current_vtbl.table->size - 3) * sizeof(vtbl_method_t),
|
||||
MEM_RELEASE);
|
||||
HeapFree(GetProcessHeap(), 0, table);
|
||||
}
|
||||
LeaveCriticalSection(&delegating_vtbl_section);
|
||||
}
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_Delegating_Construct(REFIID riid,
|
||||
LPUNKNOWN pUnkServer,
|
||||
PCInterfaceName name,
|
||||
CInterfaceStubVtbl *vtbl,
|
||||
REFIID delegating_iid,
|
||||
LPPSFACTORYBUFFER pPSFactory,
|
||||
LPRPCSTUBBUFFER *ppStub)
|
||||
{
|
||||
cstdstubbuffer_delegating_t *This;
|
||||
IUnknown *pvServer;
|
||||
HRESULT r;
|
||||
|
||||
TRACE("(%p,%p,%p,%p) %s\n", pUnkServer, vtbl, pPSFactory, ppStub, name);
|
||||
TRACE("iid=%s delegating to %s\n", debugstr_guid(vtbl->header.piid), debugstr_guid(delegating_iid));
|
||||
TRACE("vtbl=%p\n", &vtbl->Vtbl);
|
||||
|
||||
if (!IsEqualGUID(vtbl->header.piid, riid))
|
||||
{
|
||||
ERR("IID mismatch during stub creation\n");
|
||||
return RPC_E_UNEXPECTED;
|
||||
}
|
||||
|
||||
r = IUnknown_QueryInterface(pUnkServer, riid, (void**)&pvServer);
|
||||
if(FAILED(r)) return r;
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
|
||||
if (!This)
|
||||
{
|
||||
IUnknown_Release(pvServer);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
This->base_obj = get_delegating_vtbl();
|
||||
r = create_stub(delegating_iid, (IUnknown*)&This->base_obj, &This->base_stub);
|
||||
if(FAILED(r))
|
||||
{
|
||||
release_delegating_vtbl(This->base_obj);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
IUnknown_Release(pvServer);
|
||||
return r;
|
||||
}
|
||||
|
||||
This->stub_buffer.lpVtbl = &vtbl->Vtbl;
|
||||
This->stub_buffer.RefCount = 1;
|
||||
This->stub_buffer.pvServerObject = pvServer;
|
||||
This->stub_buffer.pPSFactory = pPSFactory;
|
||||
*ppStub = (LPRPCSTUBBUFFER)&This->stub_buffer;
|
||||
|
||||
IPSFactoryBuffer_AddRef(pPSFactory);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface,
|
||||
REFIID riid,
|
||||
LPVOID *obj)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj);
|
||||
|
||||
if (IsEqualIID(&IID_IUnknown, riid) ||
|
||||
IsEqualIID(&IID_IRpcStubBuffer, riid))
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
*obj = iface;
|
||||
return S_OK;
|
||||
}
|
||||
*obj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG WINAPI CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
TRACE("(%p)->AddRef()\n",This);
|
||||
return InterlockedIncrement(&This->RefCount);
|
||||
}
|
||||
|
||||
ULONG WINAPI NdrCStdStubBuffer_Release(LPRPCSTUBBUFFER iface,
|
||||
LPPSFACTORYBUFFER pPSF)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
ULONG refs;
|
||||
|
||||
TRACE("(%p)->Release()\n",This);
|
||||
|
||||
refs = InterlockedDecrement(&This->RefCount);
|
||||
if (!refs)
|
||||
{
|
||||
/* test_Release shows that native doesn't call Disconnect here.
|
||||
We'll leave it in for the time being. */
|
||||
IRpcStubBuffer_Disconnect(iface);
|
||||
|
||||
IPSFactoryBuffer_Release(pPSF);
|
||||
HeapFree(GetProcessHeap(),0,This);
|
||||
}
|
||||
return refs;
|
||||
}
|
||||
|
||||
ULONG WINAPI NdrCStdStubBuffer2_Release(LPRPCSTUBBUFFER iface,
|
||||
LPPSFACTORYBUFFER pPSF)
|
||||
{
|
||||
cstdstubbuffer_delegating_t *This = impl_from_delegating( iface );
|
||||
ULONG refs;
|
||||
|
||||
TRACE("(%p)->Release()\n", This);
|
||||
|
||||
refs = InterlockedDecrement(&This->stub_buffer.RefCount);
|
||||
if (!refs)
|
||||
{
|
||||
/* Just like NdrCStdStubBuffer_Release, we shouldn't call
|
||||
Disconnect here */
|
||||
IRpcStubBuffer_Disconnect((IRpcStubBuffer *)&This->stub_buffer);
|
||||
|
||||
IRpcStubBuffer_Release(This->base_stub);
|
||||
release_delegating_vtbl(This->base_obj);
|
||||
|
||||
IPSFactoryBuffer_Release(pPSF);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
return refs;
|
||||
}
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface,
|
||||
LPUNKNOWN lpUnkServer)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
HRESULT r;
|
||||
IUnknown *new = NULL;
|
||||
|
||||
TRACE("(%p)->Connect(%p)\n",This,lpUnkServer);
|
||||
|
||||
r = IUnknown_QueryInterface(lpUnkServer, STUB_HEADER(This).piid, (void**)&new);
|
||||
new = InterlockedExchangePointer((void**)&This->pvServerObject, new);
|
||||
if(new)
|
||||
IUnknown_Release(new);
|
||||
return r;
|
||||
}
|
||||
|
||||
void WINAPI CStdStubBuffer_Disconnect(LPRPCSTUBBUFFER iface)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
IUnknown *old;
|
||||
TRACE("(%p)->Disconnect()\n",This);
|
||||
|
||||
old = InterlockedExchangePointer((void**)&This->pvServerObject, NULL);
|
||||
|
||||
if(old)
|
||||
IUnknown_Release(old);
|
||||
}
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,
|
||||
PRPCOLEMESSAGE pMsg,
|
||||
LPRPCCHANNELBUFFER pChannel)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
DWORD dwPhase = STUB_UNMARSHAL;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("(%p)->Invoke(%p,%p)\n",This,pMsg,pChannel);
|
||||
|
||||
__TRY
|
||||
{
|
||||
if (STUB_HEADER(This).pDispatchTable)
|
||||
STUB_HEADER(This).pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
|
||||
else /* pure interpreted */
|
||||
NdrStubCall2(iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
|
||||
}
|
||||
__EXCEPT(stub_filter)
|
||||
{
|
||||
DWORD dwExceptionCode = GetExceptionCode();
|
||||
WARN("a stub call failed with exception 0x%08x (%d)\n", dwExceptionCode, dwExceptionCode);
|
||||
if (FAILED(dwExceptionCode))
|
||||
hr = dwExceptionCode;
|
||||
else
|
||||
hr = HRESULT_FROM_WIN32(dwExceptionCode);
|
||||
}
|
||||
__ENDTRY
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface,
|
||||
REFIID riid)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
TRACE("(%p)->IsIIDSupported(%s)\n",This,debugstr_guid(riid));
|
||||
return IsEqualGUID(STUB_HEADER(This).piid, riid) ? iface : NULL;
|
||||
}
|
||||
|
||||
ULONG WINAPI CStdStubBuffer_CountRefs(LPRPCSTUBBUFFER iface)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
TRACE("(%p)->CountRefs()\n",This);
|
||||
return This->RefCount;
|
||||
}
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface(LPRPCSTUBBUFFER iface,
|
||||
LPVOID *ppv)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
TRACE("(%p)->DebugServerQueryInterface(%p)\n",This,ppv);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void WINAPI CStdStubBuffer_DebugServerRelease(LPRPCSTUBBUFFER iface,
|
||||
LPVOID pv)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
TRACE("(%p)->DebugServerRelease(%p)\n",This,pv);
|
||||
}
|
||||
|
||||
const IRpcStubBufferVtbl CStdStubBuffer_Vtbl =
|
||||
{
|
||||
CStdStubBuffer_QueryInterface,
|
||||
CStdStubBuffer_AddRef,
|
||||
NULL,
|
||||
CStdStubBuffer_Connect,
|
||||
CStdStubBuffer_Disconnect,
|
||||
CStdStubBuffer_Invoke,
|
||||
CStdStubBuffer_IsIIDSupported,
|
||||
CStdStubBuffer_CountRefs,
|
||||
CStdStubBuffer_DebugServerQueryInterface,
|
||||
CStdStubBuffer_DebugServerRelease
|
||||
};
|
||||
|
||||
static HRESULT WINAPI CStdStubBuffer_Delegating_Connect(LPRPCSTUBBUFFER iface,
|
||||
LPUNKNOWN lpUnkServer)
|
||||
{
|
||||
cstdstubbuffer_delegating_t *This = impl_from_delegating(iface);
|
||||
HRESULT r;
|
||||
TRACE("(%p)->Connect(%p)\n", This, lpUnkServer);
|
||||
|
||||
r = CStdStubBuffer_Connect(iface, lpUnkServer);
|
||||
if(SUCCEEDED(r))
|
||||
r = IRpcStubBuffer_Connect(This->base_stub, (IUnknown*)&This->base_obj);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static void WINAPI CStdStubBuffer_Delegating_Disconnect(LPRPCSTUBBUFFER iface)
|
||||
{
|
||||
cstdstubbuffer_delegating_t *This = impl_from_delegating(iface);
|
||||
TRACE("(%p)->Disconnect()\n", This);
|
||||
|
||||
IRpcStubBuffer_Disconnect(This->base_stub);
|
||||
CStdStubBuffer_Disconnect(iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI CStdStubBuffer_Delegating_CountRefs(LPRPCSTUBBUFFER iface)
|
||||
{
|
||||
cstdstubbuffer_delegating_t *This = impl_from_delegating(iface);
|
||||
ULONG ret;
|
||||
TRACE("(%p)->CountRefs()\n", This);
|
||||
|
||||
ret = CStdStubBuffer_CountRefs(iface);
|
||||
ret += IRpcStubBuffer_CountRefs(This->base_stub);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl =
|
||||
{
|
||||
CStdStubBuffer_QueryInterface,
|
||||
CStdStubBuffer_AddRef,
|
||||
NULL,
|
||||
CStdStubBuffer_Delegating_Connect,
|
||||
CStdStubBuffer_Delegating_Disconnect,
|
||||
CStdStubBuffer_Invoke,
|
||||
CStdStubBuffer_IsIIDSupported,
|
||||
CStdStubBuffer_Delegating_CountRefs,
|
||||
CStdStubBuffer_DebugServerQueryInterface,
|
||||
CStdStubBuffer_DebugServerRelease
|
||||
};
|
||||
|
||||
const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
return STUB_HEADER(This).pServerInfo;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* NdrStubForwardingFunction [RPCRT4.@]
|
||||
*/
|
||||
void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *iface, IRpcChannelBuffer *pChannel,
|
||||
PRPC_MESSAGE pMsg, DWORD *pdwStubPhase )
|
||||
{
|
||||
/* Note pMsg is passed intact since RPCOLEMESSAGE is basically a RPC_MESSAGE. */
|
||||
|
||||
cstdstubbuffer_delegating_t *This = impl_from_delegating(iface);
|
||||
HRESULT r = IRpcStubBuffer_Invoke(This->base_stub, (RPCOLEMESSAGE*)pMsg, pChannel);
|
||||
if(FAILED(r)) RpcRaiseException(r);
|
||||
return;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrStubInitialize [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrStubInitialize(PRPC_MESSAGE pRpcMsg,
|
||||
PMIDL_STUB_MESSAGE pStubMsg,
|
||||
PMIDL_STUB_DESC pStubDescriptor,
|
||||
LPRPCCHANNELBUFFER pRpcChannelBuffer)
|
||||
{
|
||||
TRACE("(%p,%p,%p,%p)\n", pRpcMsg, pStubMsg, pStubDescriptor, pRpcChannelBuffer);
|
||||
NdrServerInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor);
|
||||
pStubMsg->pRpcChannelBuffer = pRpcChannelBuffer;
|
||||
IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
|
||||
&pStubMsg->dwDestContext,
|
||||
&pStubMsg->pvDestContext);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrStubGetBuffer [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrStubGetBuffer(LPRPCSTUBBUFFER iface,
|
||||
LPRPCCHANNELBUFFER pRpcChannelBuffer,
|
||||
PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
CStdStubBuffer *This = (CStdStubBuffer *)iface;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p, %p, %p)\n", This, pRpcChannelBuffer, pStubMsg);
|
||||
|
||||
pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
|
||||
hr = IRpcChannelBuffer_GetBuffer(pRpcChannelBuffer,
|
||||
(RPCOLEMESSAGE *)pStubMsg->RpcMsg, STUB_HEADER(This).piid);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
RpcRaiseException(hr);
|
||||
return;
|
||||
}
|
||||
|
||||
pStubMsg->Buffer = pStubMsg->RpcMsg->Buffer;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* NDR definitions
|
||||
*
|
||||
* Copyright 2001 Ove Kåven, TransGaming Technologies
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __WINE_NDR_MISC_H
|
||||
#define __WINE_NDR_MISC_H
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "rpc.h"
|
||||
#include "rpcndr.h"
|
||||
|
||||
struct IPSFactoryBuffer;
|
||||
|
||||
PFORMAT_STRING ComputeConformanceOrVariance(
|
||||
MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory,
|
||||
PFORMAT_STRING pFormat, ULONG_PTR def, ULONG_PTR *pCount);
|
||||
|
||||
static inline PFORMAT_STRING ComputeConformance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def)
|
||||
{
|
||||
return ComputeConformanceOrVariance(pStubMsg, pMemory, pFormat, def, &pStubMsg->MaxCount);
|
||||
}
|
||||
|
||||
static inline PFORMAT_STRING ComputeVariance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def)
|
||||
{
|
||||
PFORMAT_STRING ret;
|
||||
ULONG_PTR ActualCount = pStubMsg->ActualCount;
|
||||
|
||||
pStubMsg->Offset = 0;
|
||||
ret = ComputeConformanceOrVariance(pStubMsg, pMemory, pFormat, def, &ActualCount);
|
||||
pStubMsg->ActualCount = (ULONG)ActualCount;
|
||||
return ret;
|
||||
}
|
||||
|
||||
typedef unsigned char* (WINAPI *NDR_MARSHALL) (PMIDL_STUB_MESSAGE, unsigned char*, PFORMAT_STRING);
|
||||
typedef unsigned char* (WINAPI *NDR_UNMARSHALL)(PMIDL_STUB_MESSAGE, unsigned char**,PFORMAT_STRING, unsigned char);
|
||||
typedef void (WINAPI *NDR_BUFFERSIZE)(PMIDL_STUB_MESSAGE, unsigned char*, PFORMAT_STRING);
|
||||
typedef ULONG (WINAPI *NDR_MEMORYSIZE)(PMIDL_STUB_MESSAGE, PFORMAT_STRING);
|
||||
typedef void (WINAPI *NDR_FREE) (PMIDL_STUB_MESSAGE, unsigned char*, PFORMAT_STRING);
|
||||
|
||||
extern const NDR_MARSHALL NdrMarshaller[];
|
||||
extern const NDR_UNMARSHALL NdrUnmarshaller[];
|
||||
extern const NDR_BUFFERSIZE NdrBufferSizer[];
|
||||
extern const NDR_MEMORYSIZE NdrMemorySizer[];
|
||||
extern const NDR_FREE NdrFreer[];
|
||||
|
||||
#endif /* __WINE_NDR_MISC_H */
|
||||
@@ -1,393 +0,0 @@
|
||||
/*
|
||||
* OLE32 callouts, COM interface marshalling
|
||||
*
|
||||
* Copyright 2001 Ove Kåven, TransGaming Technologies
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* TODO:
|
||||
* - fix the wire-protocol to match MS/RPC
|
||||
* - finish RpcStream_Vtbl
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define COBJMACROS
|
||||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
|
||||
#include "objbase.h"
|
||||
|
||||
#include "ndr_misc.h"
|
||||
#include "rpcndr.h"
|
||||
#include "rpcproxy.h"
|
||||
#include "wine/rpcfc.h"
|
||||
#include "cpsf.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
static HMODULE hOLE;
|
||||
|
||||
static HRESULT (WINAPI *COM_GetMarshalSizeMax)(ULONG *,REFIID,LPUNKNOWN,DWORD,LPVOID,DWORD);
|
||||
static HRESULT (WINAPI *COM_MarshalInterface)(LPSTREAM,REFIID,LPUNKNOWN,DWORD,LPVOID,DWORD);
|
||||
static HRESULT (WINAPI *COM_UnmarshalInterface)(LPSTREAM,REFIID,LPVOID*);
|
||||
static HRESULT (WINAPI *COM_ReleaseMarshalData)(LPSTREAM);
|
||||
static HRESULT (WINAPI *COM_GetClassObject)(REFCLSID,DWORD,COSERVERINFO *,REFIID,LPVOID *);
|
||||
static HRESULT (WINAPI *COM_GetPSClsid)(REFIID,CLSID *);
|
||||
static LPVOID (WINAPI *COM_MemAlloc)(ULONG);
|
||||
static void (WINAPI *COM_MemFree)(LPVOID);
|
||||
|
||||
static HMODULE LoadCOM(void)
|
||||
{
|
||||
if (hOLE) return hOLE;
|
||||
hOLE = LoadLibraryA("OLE32.DLL");
|
||||
if (!hOLE) return 0;
|
||||
COM_GetMarshalSizeMax = (LPVOID)GetProcAddress(hOLE, "CoGetMarshalSizeMax");
|
||||
COM_MarshalInterface = (LPVOID)GetProcAddress(hOLE, "CoMarshalInterface");
|
||||
COM_UnmarshalInterface = (LPVOID)GetProcAddress(hOLE, "CoUnmarshalInterface");
|
||||
COM_ReleaseMarshalData = (LPVOID)GetProcAddress(hOLE, "CoReleaseMarshalData");
|
||||
COM_GetClassObject = (LPVOID)GetProcAddress(hOLE, "CoGetClassObject");
|
||||
COM_GetPSClsid = (LPVOID)GetProcAddress(hOLE, "CoGetPSClsid");
|
||||
COM_MemAlloc = (LPVOID)GetProcAddress(hOLE, "CoTaskMemAlloc");
|
||||
COM_MemFree = (LPVOID)GetProcAddress(hOLE, "CoTaskMemFree");
|
||||
return hOLE;
|
||||
}
|
||||
|
||||
/* CoMarshalInterface/CoUnmarshalInterface works on streams,
|
||||
* so implement a simple stream on top of the RPC buffer
|
||||
* (which also implements the MInterfacePointer structure) */
|
||||
typedef struct RpcStreamImpl
|
||||
{
|
||||
const IStreamVtbl *lpVtbl;
|
||||
DWORD RefCount;
|
||||
PMIDL_STUB_MESSAGE pMsg;
|
||||
LPDWORD size;
|
||||
unsigned char *data;
|
||||
DWORD pos;
|
||||
} RpcStreamImpl;
|
||||
|
||||
static HRESULT WINAPI RpcStream_QueryInterface(LPSTREAM iface,
|
||||
REFIID riid,
|
||||
LPVOID *obj)
|
||||
{
|
||||
RpcStreamImpl *This = (RpcStreamImpl *)iface;
|
||||
if (IsEqualGUID(&IID_IUnknown, riid) ||
|
||||
IsEqualGUID(&IID_ISequentialStream, riid) ||
|
||||
IsEqualGUID(&IID_IStream, riid)) {
|
||||
*obj = This;
|
||||
This->RefCount++;
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI RpcStream_AddRef(LPSTREAM iface)
|
||||
{
|
||||
RpcStreamImpl *This = (RpcStreamImpl *)iface;
|
||||
return ++(This->RefCount);
|
||||
}
|
||||
|
||||
static ULONG WINAPI RpcStream_Release(LPSTREAM iface)
|
||||
{
|
||||
RpcStreamImpl *This = (RpcStreamImpl *)iface;
|
||||
if (!--(This->RefCount)) {
|
||||
TRACE("size=%d\n", *This->size);
|
||||
This->pMsg->Buffer = (unsigned char*)This->data + *This->size;
|
||||
HeapFree(GetProcessHeap(),0,This);
|
||||
return 0;
|
||||
}
|
||||
return This->RefCount;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RpcStream_Read(LPSTREAM iface,
|
||||
void *pv,
|
||||
ULONG cb,
|
||||
ULONG *pcbRead)
|
||||
{
|
||||
RpcStreamImpl *This = (RpcStreamImpl *)iface;
|
||||
HRESULT hr = S_OK;
|
||||
if (This->pos + cb > *This->size)
|
||||
{
|
||||
cb = *This->size - This->pos;
|
||||
hr = S_FALSE;
|
||||
}
|
||||
if (cb) {
|
||||
memcpy(pv, This->data + This->pos, cb);
|
||||
This->pos += cb;
|
||||
}
|
||||
if (pcbRead) *pcbRead = cb;
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RpcStream_Write(LPSTREAM iface,
|
||||
const void *pv,
|
||||
ULONG cb,
|
||||
ULONG *pcbWritten)
|
||||
{
|
||||
RpcStreamImpl *This = (RpcStreamImpl *)iface;
|
||||
if (This->data + cb > (unsigned char *)This->pMsg->RpcMsg->Buffer + This->pMsg->BufferLength)
|
||||
return STG_E_MEDIUMFULL;
|
||||
memcpy(This->data + This->pos, pv, cb);
|
||||
This->pos += cb;
|
||||
if (This->pos > *This->size) *This->size = This->pos;
|
||||
if (pcbWritten) *pcbWritten = cb;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RpcStream_Seek(LPSTREAM iface,
|
||||
LARGE_INTEGER move,
|
||||
DWORD origin,
|
||||
ULARGE_INTEGER *newPos)
|
||||
{
|
||||
RpcStreamImpl *This = (RpcStreamImpl *)iface;
|
||||
switch (origin) {
|
||||
case STREAM_SEEK_SET:
|
||||
This->pos = move.u.LowPart;
|
||||
break;
|
||||
case STREAM_SEEK_CUR:
|
||||
This->pos = This->pos + move.u.LowPart;
|
||||
break;
|
||||
case STREAM_SEEK_END:
|
||||
This->pos = *This->size + move.u.LowPart;
|
||||
break;
|
||||
default:
|
||||
return STG_E_INVALIDFUNCTION;
|
||||
}
|
||||
if (newPos) {
|
||||
newPos->u.LowPart = This->pos;
|
||||
newPos->u.HighPart = 0;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI RpcStream_SetSize(LPSTREAM iface,
|
||||
ULARGE_INTEGER newSize)
|
||||
{
|
||||
RpcStreamImpl *This = (RpcStreamImpl *)iface;
|
||||
*This->size = newSize.u.LowPart;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IStreamVtbl RpcStream_Vtbl =
|
||||
{
|
||||
RpcStream_QueryInterface,
|
||||
RpcStream_AddRef,
|
||||
RpcStream_Release,
|
||||
RpcStream_Read,
|
||||
RpcStream_Write,
|
||||
RpcStream_Seek,
|
||||
RpcStream_SetSize,
|
||||
NULL, /* CopyTo */
|
||||
NULL, /* Commit */
|
||||
NULL, /* Revert */
|
||||
NULL, /* LockRegion */
|
||||
NULL, /* UnlockRegion */
|
||||
NULL, /* Stat */
|
||||
NULL /* Clone */
|
||||
};
|
||||
|
||||
static LPSTREAM RpcStream_Create(PMIDL_STUB_MESSAGE pStubMsg, BOOL init)
|
||||
{
|
||||
RpcStreamImpl *This;
|
||||
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(RpcStreamImpl));
|
||||
if (!This) return NULL;
|
||||
This->lpVtbl = &RpcStream_Vtbl;
|
||||
This->RefCount = 1;
|
||||
This->pMsg = pStubMsg;
|
||||
This->size = (LPDWORD)pStubMsg->Buffer;
|
||||
This->data = (unsigned char*)(This->size + 1);
|
||||
This->pos = 0;
|
||||
if (init) *This->size = 0;
|
||||
TRACE("init size=%d\n", *This->size);
|
||||
return (LPSTREAM)This;
|
||||
}
|
||||
|
||||
static const IID* get_ip_iid(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
const IID *riid;
|
||||
if (!pFormat) return &IID_IUnknown;
|
||||
TRACE("format=%02x %02x\n", pFormat[0], pFormat[1]);
|
||||
if (pFormat[0] != RPC_FC_IP) FIXME("format=%d\n", pFormat[0]);
|
||||
if (pFormat[1] == RPC_FC_CONSTANT_IID) {
|
||||
riid = (const IID *)&pFormat[2];
|
||||
} else {
|
||||
ComputeConformance(pStubMsg, pMemory, pFormat+2, 0);
|
||||
riid = (const IID *)pStubMsg->MaxCount;
|
||||
}
|
||||
if (!riid) riid = &IID_IUnknown;
|
||||
TRACE("got %s\n", debugstr_guid(riid));
|
||||
return riid;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrInterfacePointerMarshall [RPCRT4.@]
|
||||
*/
|
||||
unsigned char * WINAPI NdrInterfacePointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
unsigned char *pMemory,
|
||||
PFORMAT_STRING pFormat)
|
||||
{
|
||||
const IID *riid = get_ip_iid(pStubMsg, pMemory, pFormat);
|
||||
LPSTREAM stream;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
||||
pStubMsg->MaxCount = 0;
|
||||
if (!LoadCOM()) return NULL;
|
||||
if (pStubMsg->Buffer + sizeof(DWORD) <= (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) {
|
||||
stream = RpcStream_Create(pStubMsg, TRUE);
|
||||
if (stream) {
|
||||
if (pMemory)
|
||||
hr = COM_MarshalInterface(stream, riid, (LPUNKNOWN)pMemory,
|
||||
pStubMsg->dwDestContext, pStubMsg->pvDestContext,
|
||||
MSHLFLAGS_NORMAL);
|
||||
else
|
||||
hr = S_OK;
|
||||
|
||||
IStream_Release(stream);
|
||||
if (FAILED(hr))
|
||||
RpcRaiseException(hr);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrInterfacePointerUnmarshall [RPCRT4.@]
|
||||
*/
|
||||
unsigned char * WINAPI NdrInterfacePointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
unsigned char **ppMemory,
|
||||
PFORMAT_STRING pFormat,
|
||||
unsigned char fMustAlloc)
|
||||
{
|
||||
LPSTREAM stream;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
||||
if (!LoadCOM()) return NULL;
|
||||
*(LPVOID*)ppMemory = NULL;
|
||||
if (pStubMsg->Buffer + sizeof(DWORD) < (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) {
|
||||
stream = RpcStream_Create(pStubMsg, FALSE);
|
||||
if (!stream) RpcRaiseException(E_OUTOFMEMORY);
|
||||
if (*((RpcStreamImpl *)stream)->size != 0)
|
||||
hr = COM_UnmarshalInterface(stream, &IID_NULL, (LPVOID*)ppMemory);
|
||||
else
|
||||
hr = S_OK;
|
||||
IStream_Release(stream);
|
||||
if (FAILED(hr))
|
||||
RpcRaiseException(hr);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrInterfacePointerBufferSize [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrInterfacePointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
unsigned char *pMemory,
|
||||
PFORMAT_STRING pFormat)
|
||||
{
|
||||
const IID *riid = get_ip_iid(pStubMsg, pMemory, pFormat);
|
||||
ULONG size = 0;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
||||
if (!LoadCOM()) return;
|
||||
hr = COM_GetMarshalSizeMax(&size, riid, (LPUNKNOWN)pMemory,
|
||||
pStubMsg->dwDestContext, pStubMsg->pvDestContext,
|
||||
MSHLFLAGS_NORMAL);
|
||||
TRACE("size=%d\n", size);
|
||||
pStubMsg->BufferLength += sizeof(DWORD) + size;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrInterfacePointerMemorySize [RPCRT4.@]
|
||||
*/
|
||||
ULONG WINAPI NdrInterfacePointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
PFORMAT_STRING pFormat)
|
||||
{
|
||||
ULONG size;
|
||||
|
||||
TRACE("(%p,%p)\n", pStubMsg, pFormat);
|
||||
|
||||
size = *(ULONG *)pStubMsg->Buffer;
|
||||
pStubMsg->Buffer += 4;
|
||||
pStubMsg->MemorySize += 4;
|
||||
|
||||
pStubMsg->Buffer += size;
|
||||
|
||||
return pStubMsg->MemorySize;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrInterfacePointerFree [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrInterfacePointerFree(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
unsigned char *pMemory,
|
||||
PFORMAT_STRING pFormat)
|
||||
{
|
||||
LPUNKNOWN pUnk = (LPUNKNOWN)pMemory;
|
||||
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
||||
if (pUnk) IUnknown_Release(pUnk);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrOleAllocate [RPCRT4.@]
|
||||
*/
|
||||
void * WINAPI NdrOleAllocate(size_t Size)
|
||||
{
|
||||
if (!LoadCOM()) return NULL;
|
||||
return COM_MemAlloc(Size);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrOleFree [RPCRT4.@]
|
||||
*/
|
||||
void WINAPI NdrOleFree(void *NodeToFree)
|
||||
{
|
||||
if (!LoadCOM()) return;
|
||||
COM_MemFree(NodeToFree);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Helper function to create a stub.
|
||||
* This probably looks very much like NdrpCreateStub.
|
||||
*/
|
||||
HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub)
|
||||
{
|
||||
CLSID clsid;
|
||||
IPSFactoryBuffer *psfac;
|
||||
HRESULT r;
|
||||
|
||||
if(!LoadCOM()) return E_FAIL;
|
||||
|
||||
r = COM_GetPSClsid( iid, &clsid );
|
||||
if(FAILED(r)) return r;
|
||||
|
||||
r = COM_GetClassObject( &clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IPSFactoryBuffer, (void**)&psfac );
|
||||
if(FAILED(r)) return r;
|
||||
|
||||
r = IPSFactoryBuffer_CreateStub(psfac, iid, pUnk, ppstub);
|
||||
|
||||
IPSFactoryBuffer_Release(psfac);
|
||||
return r;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,197 +0,0 @@
|
||||
/*
|
||||
* RPC binding API
|
||||
*
|
||||
* Copyright 2001 Ove Kåven, TransGaming Technologies
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __WINE_RPC_BINDING_H
|
||||
#define __WINE_RPC_BINDING_H
|
||||
|
||||
#include "wine/rpcss_shared.h"
|
||||
#include "rpcndr.h"
|
||||
#include "security.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
|
||||
typedef struct _RpcAuthInfo
|
||||
{
|
||||
LONG refs;
|
||||
|
||||
ULONG AuthnLevel;
|
||||
ULONG AuthnSvc;
|
||||
CredHandle cred;
|
||||
TimeStamp exp;
|
||||
ULONG cbMaxToken;
|
||||
/* the auth identity pointer that the application passed us (freed by application) */
|
||||
RPC_AUTH_IDENTITY_HANDLE *identity;
|
||||
/* our copy of NT auth identity structure, if the authentication service
|
||||
* takes an NT auth identity */
|
||||
SEC_WINNT_AUTH_IDENTITY_W *nt_identity;
|
||||
} RpcAuthInfo;
|
||||
|
||||
typedef struct _RpcQualityOfService
|
||||
{
|
||||
LONG refs;
|
||||
|
||||
RPC_SECURITY_QOS_V2_W *qos;
|
||||
} RpcQualityOfService;
|
||||
|
||||
struct connection_ops;
|
||||
|
||||
typedef struct _RpcConnection
|
||||
{
|
||||
BOOL server;
|
||||
LPSTR NetworkAddr;
|
||||
LPSTR Endpoint;
|
||||
LPWSTR NetworkOptions;
|
||||
const struct connection_ops *ops;
|
||||
USHORT MaxTransmissionSize;
|
||||
|
||||
/* authentication */
|
||||
CtxtHandle ctx;
|
||||
TimeStamp exp;
|
||||
ULONG attr;
|
||||
RpcAuthInfo *AuthInfo;
|
||||
ULONG encryption_auth_len;
|
||||
ULONG signature_auth_len;
|
||||
RpcQualityOfService *QOS;
|
||||
|
||||
/* client-only */
|
||||
struct list conn_pool_entry;
|
||||
ULONG assoc_group_id; /* association group returned during binding */
|
||||
|
||||
/* server-only */
|
||||
/* The active interface bound to server. */
|
||||
RPC_SYNTAX_IDENTIFIER ActiveInterface;
|
||||
USHORT NextCallId;
|
||||
struct _RpcConnection* Next;
|
||||
struct _RpcBinding *server_binding;
|
||||
} RpcConnection;
|
||||
|
||||
struct connection_ops {
|
||||
const char *name;
|
||||
unsigned char epm_protocols[2]; /* only floors 3 and 4. see http://www.opengroup.org/onlinepubs/9629399/apdxl.htm */
|
||||
RpcConnection *(*alloc)(void);
|
||||
RPC_STATUS (*open_connection_client)(RpcConnection *conn);
|
||||
RPC_STATUS (*handoff)(RpcConnection *old_conn, RpcConnection *new_conn);
|
||||
int (*read)(RpcConnection *conn, void *buffer, unsigned int len);
|
||||
int (*write)(RpcConnection *conn, const void *buffer, unsigned int len);
|
||||
int (*close)(RpcConnection *conn);
|
||||
void (*cancel_call)(RpcConnection *conn);
|
||||
size_t (*get_top_of_tower)(unsigned char *tower_data, const char *networkaddr, const char *endpoint);
|
||||
RPC_STATUS (*parse_top_of_tower)(const unsigned char *tower_data, size_t tower_size, char **networkaddr, char **endpoint);
|
||||
};
|
||||
|
||||
/* don't know what MS's structure looks like */
|
||||
typedef struct _RpcBinding
|
||||
{
|
||||
LONG refs;
|
||||
struct _RpcBinding* Next;
|
||||
BOOL server;
|
||||
UUID ObjectUuid;
|
||||
LPSTR Protseq;
|
||||
LPSTR NetworkAddr;
|
||||
LPSTR Endpoint;
|
||||
LPWSTR NetworkOptions;
|
||||
RPC_BLOCKING_FN BlockingFn;
|
||||
ULONG ServerTid;
|
||||
RpcConnection* FromConn;
|
||||
struct _RpcAssoc *Assoc;
|
||||
|
||||
/* authentication */
|
||||
RpcAuthInfo *AuthInfo;
|
||||
RpcQualityOfService *QOS;
|
||||
} RpcBinding;
|
||||
|
||||
LPSTR RPCRT4_strndupA(LPCSTR src, INT len);
|
||||
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT len);
|
||||
LPSTR RPCRT4_strdupWtoA(LPCWSTR src);
|
||||
LPWSTR RPCRT4_strdupAtoW(LPCSTR src);
|
||||
void RPCRT4_strfree(LPSTR src);
|
||||
|
||||
#define RPCRT4_strdupA(x) RPCRT4_strndupA((x),-1)
|
||||
#define RPCRT4_strdupW(x) RPCRT4_strndupW((x),-1)
|
||||
|
||||
ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo);
|
||||
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo);
|
||||
BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2);
|
||||
ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos);
|
||||
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos);
|
||||
BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2);
|
||||
|
||||
RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS);
|
||||
RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection);
|
||||
RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection* Connection);
|
||||
RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection);
|
||||
RPC_STATUS RPCRT4_SpawnConnection(RpcConnection** Connection, RpcConnection* OldConnection);
|
||||
|
||||
RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPCSTR Endpoint);
|
||||
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, const UUID* ObjectUuid);
|
||||
RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection);
|
||||
RPC_STATUS RPCRT4_ExportBinding(RpcBinding** Binding, RpcBinding* OldBinding);
|
||||
RPC_STATUS RPCRT4_DestroyBinding(RpcBinding* Binding);
|
||||
RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
|
||||
const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RPC_SYNTAX_IDENTIFIER *InterfaceId);
|
||||
RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection);
|
||||
BOOL RPCRT4_RPCSSOnDemandCall(PRPCSS_NP_MESSAGE msg, char *vardata_payload, PRPCSS_NP_REPLY reply);
|
||||
HANDLE RPCRT4_GetMasterMutex(void);
|
||||
HANDLE RPCRT4_RpcssNPConnect(void);
|
||||
|
||||
static inline const char *rpcrt4_conn_get_name(const RpcConnection *Connection)
|
||||
{
|
||||
return Connection->ops->name;
|
||||
}
|
||||
|
||||
static inline int rpcrt4_conn_read(RpcConnection *Connection,
|
||||
void *buffer, unsigned int len)
|
||||
{
|
||||
return Connection->ops->read(Connection, buffer, len);
|
||||
}
|
||||
|
||||
static inline int rpcrt4_conn_write(RpcConnection *Connection,
|
||||
const void *buffer, unsigned int len)
|
||||
{
|
||||
return Connection->ops->write(Connection, buffer, len);
|
||||
}
|
||||
|
||||
static inline int rpcrt4_conn_close(RpcConnection *Connection)
|
||||
{
|
||||
return Connection->ops->close(Connection);
|
||||
}
|
||||
|
||||
static inline void rpcrt4_conn_cancel_call(RpcConnection *Connection)
|
||||
{
|
||||
Connection->ops->cancel_call(Connection);
|
||||
}
|
||||
|
||||
static inline RPC_STATUS rpcrt4_conn_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
|
||||
{
|
||||
return old_conn->ops->handoff(old_conn, new_conn);
|
||||
}
|
||||
|
||||
/* floors 3 and up */
|
||||
RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint);
|
||||
RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint);
|
||||
|
||||
void RPCRT4_SetThreadCurrentConnection(RpcConnection *Connection);
|
||||
void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding);
|
||||
RpcBinding *RPCRT4_GetThreadCurrentCallHandle(void);
|
||||
void RPCRT4_PushThreadContextHandle(NDR_SCONTEXT SContext);
|
||||
void RPCRT4_RemoveThreadContextHandle(NDR_SCONTEXT SContext);
|
||||
NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void);
|
||||
|
||||
#endif
|
||||
@@ -1,212 +0,0 @@
|
||||
/*
|
||||
* RPC definitions
|
||||
*
|
||||
* Copyright 2001-2002 Ove Kåven, TransGaming Technologies
|
||||
* Copyright 2004 Filip Navara
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __WINE_RPC_DEFS_H
|
||||
#define __WINE_RPC_DEFS_H
|
||||
|
||||
/* info from http://www.microsoft.com/msj/0398/dcomtextfigs.htm */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char rpc_ver; /* RPC major version (5) */
|
||||
unsigned char rpc_ver_minor; /* RPC minor version (0) */
|
||||
unsigned char ptype; /* Packet type (PKT_*) */
|
||||
unsigned char flags;
|
||||
unsigned char drep[4]; /* Data representation */
|
||||
unsigned short frag_len; /* Data size in bytes including header and tail. */
|
||||
unsigned short auth_len; /* Authentication length */
|
||||
unsigned long call_id; /* Call identifier. */
|
||||
} RpcPktCommonHdr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RpcPktCommonHdr common;
|
||||
unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */
|
||||
unsigned short context_id; /* Presentation context identifier */
|
||||
unsigned short opnum;
|
||||
} RpcPktRequestHdr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RpcPktCommonHdr common;
|
||||
unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */
|
||||
unsigned short context_id; /* Presentation context identifier */
|
||||
unsigned char cancel_count;
|
||||
unsigned char reserved;
|
||||
} RpcPktResponseHdr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RpcPktCommonHdr common;
|
||||
unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */
|
||||
unsigned short context_id; /* Presentation context identifier */
|
||||
unsigned char cancel_count; /* Received cancel count */
|
||||
unsigned char reserved; /* Force alignment! */
|
||||
unsigned long status; /* Runtime fault code (RPC_STATUS) */
|
||||
unsigned long reserved2;
|
||||
} RpcPktFaultHdr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RpcPktCommonHdr common;
|
||||
unsigned short max_tsize; /* Maximum transmission fragment size */
|
||||
unsigned short max_rsize; /* Maximum receive fragment size */
|
||||
unsigned long assoc_gid; /* Associated group id */
|
||||
unsigned char num_elements; /* Number of elements */
|
||||
unsigned char padding[3]; /* Force alignment! */
|
||||
unsigned short context_id; /* Presentation context identifier */
|
||||
unsigned char num_syntaxes; /* Number of syntaxes */
|
||||
RPC_SYNTAX_IDENTIFIER abstract;
|
||||
RPC_SYNTAX_IDENTIFIER transfer;
|
||||
} RpcPktBindHdr;
|
||||
|
||||
#include "pshpack1.h"
|
||||
typedef struct
|
||||
{
|
||||
unsigned short length; /* Length of the string including null terminator */
|
||||
char string[1]; /* String data in single byte, null terminated form */
|
||||
} RpcAddressString;
|
||||
#include "poppack.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char num_results; /* Number of results */
|
||||
unsigned char reserved[3]; /* Force alignment! */
|
||||
struct {
|
||||
unsigned short result;
|
||||
unsigned short reason;
|
||||
} results[1];
|
||||
} RpcResults;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RpcPktCommonHdr common;
|
||||
unsigned short max_tsize; /* Maximum transmission fragment size */
|
||||
unsigned short max_rsize; /* Maximum receive fragment size */
|
||||
unsigned long assoc_gid; /* Associated group id */
|
||||
/*
|
||||
* Following this header are these fields:
|
||||
* RpcAddressString server_address;
|
||||
* [0 - 3 bytes of padding so that results is 4-byte aligned]
|
||||
* RpcResults results;
|
||||
* RPC_SYNTAX_IDENTIFIER transfer;
|
||||
*/
|
||||
} RpcPktBindAckHdr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RpcPktCommonHdr common;
|
||||
unsigned short reject_reason;
|
||||
unsigned char protocols_count;
|
||||
struct {
|
||||
unsigned char rpc_ver;
|
||||
unsigned char rpc_ver_minor;
|
||||
} protocols[1];
|
||||
} RpcPktBindNAckHdr;
|
||||
|
||||
/* Union representing all possible packet headers */
|
||||
typedef union
|
||||
{
|
||||
RpcPktCommonHdr common;
|
||||
RpcPktRequestHdr request;
|
||||
RpcPktResponseHdr response;
|
||||
RpcPktFaultHdr fault;
|
||||
RpcPktBindHdr bind;
|
||||
RpcPktBindAckHdr bind_ack;
|
||||
RpcPktBindNAckHdr bind_nack;
|
||||
} RpcPktHdr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char auth_type; /* authentication scheme in use */
|
||||
unsigned char auth_level; /* RPC_C_AUTHN_LEVEL* */
|
||||
unsigned char auth_pad_length; /* length of padding to restore n % 4 alignment */
|
||||
unsigned char auth_reserved; /* reserved, must be zero */
|
||||
unsigned long auth_context_id; /* unique value for the authenticated connection */
|
||||
} RpcAuthVerifier;
|
||||
|
||||
#define RPC_AUTH_VERIFIER_LEN(common_hdr) \
|
||||
((common_hdr)->auth_len ? (common_hdr)->auth_len + sizeof(RpcAuthVerifier) : 0)
|
||||
|
||||
#define RPC_VER_MAJOR 5
|
||||
#define RPC_VER_MINOR 0
|
||||
|
||||
#define RPC_FLG_FIRST 1
|
||||
#define RPC_FLG_LAST 2
|
||||
#define RPC_FLG_OBJECT_UUID 0x80
|
||||
|
||||
#define RPC_MIN_PACKET_SIZE 0x1000
|
||||
#define RPC_MAX_PACKET_SIZE 0x16D0
|
||||
|
||||
#define PKT_REQUEST 0
|
||||
#define PKT_PING 1
|
||||
#define PKT_RESPONSE 2
|
||||
#define PKT_FAULT 3
|
||||
#define PKT_WORKING 4
|
||||
#define PKT_NOCALL 5
|
||||
#define PKT_REJECT 6
|
||||
#define PKT_ACK 7
|
||||
#define PKT_CL_CANCEL 8
|
||||
#define PKT_FACK 9
|
||||
#define PKT_CANCEL_ACK 10
|
||||
#define PKT_BIND 11
|
||||
#define PKT_BIND_ACK 12
|
||||
#define PKT_BIND_NACK 13
|
||||
#define PKT_ALTER_CONTEXT 14
|
||||
#define PKT_ALTER_CONTEXT_RESP 15
|
||||
#define PKT_AUTH3 16
|
||||
#define PKT_SHUTDOWN 17
|
||||
#define PKT_CO_CANCEL 18
|
||||
#define PKT_ORPHANED 19
|
||||
|
||||
#define RESULT_ACCEPT 0
|
||||
#define RESULT_USER_REJECTION 1
|
||||
#define RESULT_PROVIDER_REJECTION 2
|
||||
|
||||
#define REASON_NONE 0
|
||||
#define REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED 1
|
||||
#define REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED 2
|
||||
#define REASON_LOCAL_LIMIT_EXCEEDED 3
|
||||
|
||||
#define REJECT_REASON_NOT_SPECIFIED 0
|
||||
#define REJECT_TEMPORARY_CONGESTION 1
|
||||
#define REJECT_LOCAL_LIMIT_EXCEEDED 2
|
||||
#define REJECT_CALLED_PADDR_UNKNOWN 3 /* not used */
|
||||
#define REJECT_PROTOCOL_VERSION_NOT_SUPPORTED 4
|
||||
#define REJECT_DEFAULT_CONTEXT_NOT_SUPPORTED 5 /* not used */
|
||||
#define REJECT_USER_DATA_NOT_READABLE 6 /* not used */
|
||||
#define REJECT_NO_PSAP_AVAILABLE 7 /* not used */
|
||||
#define REJECT_UNKNOWN_AUTHN_SERVICE 8
|
||||
#define REJECT_INVALID_CHECKSUM 9
|
||||
|
||||
#define NCADG_IP_UDP 0x08
|
||||
#define NCACN_IP_TCP 0x07
|
||||
#define NCADG_IPX 0x0E
|
||||
#define NCACN_SPX 0x0C
|
||||
#define NCACN_NB_NB 0x12
|
||||
#define NCACN_NB_IPX 0x0D
|
||||
#define NCACN_DNET_NSP 0x04
|
||||
#define NCACN_HTTP 0x1F
|
||||
|
||||
/* FreeDCE: TWR_C_FLR_PROT_ID_IP */
|
||||
#define TWR_IP 0x09
|
||||
|
||||
#endif /* __WINE_RPC_DEFS_H */
|
||||
@@ -1,384 +0,0 @@
|
||||
/*
|
||||
* RPC endpoint mapper
|
||||
*
|
||||
* Copyright 2002 Greg Turner
|
||||
* Copyright 2001 Ove Kåven, TransGaming Technologies
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* TODO:
|
||||
* - actually do things right
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
|
||||
#include "rpc.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "rpc_binding.h"
|
||||
#include "epm_towers.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
/* The "real" RPC portmapper endpoints that I know of are:
|
||||
*
|
||||
* ncadg_ip_udp: 135
|
||||
* ncacn_ip_tcp: 135
|
||||
* ncacn_np: \\pipe\epmapper (?)
|
||||
* ncalrpc: epmapper
|
||||
*
|
||||
* If the user's machine ran a DCE RPC daemon, it would
|
||||
* probably be possible to connect to it, but there are many
|
||||
* reasons not to, like:
|
||||
* - the user probably does *not* run one, and probably
|
||||
* shouldn't be forced to run one just for local COM
|
||||
* - very few Unix systems use DCE RPC... if they run a RPC
|
||||
* daemon at all, it's usually Sun RPC
|
||||
* - DCE RPC registrations are persistent and saved on disk,
|
||||
* while MS-RPC registrations are documented as non-persistent
|
||||
* and stored only in RAM, and auto-destroyed when the process
|
||||
* dies (something DCE RPC can't do)
|
||||
*
|
||||
* Of course, if the user *did* want to run a DCE RPC daemon anyway,
|
||||
* there would be interoperability advantages, like the possibility
|
||||
* of running a fully functional DCOM server using Wine...
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
* RpcEpRegisterA (RPCRT4.@)
|
||||
*/
|
||||
RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector,
|
||||
UUID_VECTOR *UuidVector, RPC_CSTR Annotation )
|
||||
{
|
||||
RPCSS_NP_MESSAGE msg;
|
||||
RPCSS_NP_REPLY reply;
|
||||
char *vardata_payload, *vp;
|
||||
PRPC_SERVER_INTERFACE If = (PRPC_SERVER_INTERFACE)IfSpec;
|
||||
unsigned long c;
|
||||
RPC_STATUS rslt = RPC_S_OK;
|
||||
|
||||
TRACE("(%p,%p,%p,%s)\n", IfSpec, BindingVector, UuidVector, debugstr_a((char*)Annotation));
|
||||
TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID));
|
||||
for (c=0; c<BindingVector->Count; c++) {
|
||||
RpcBinding* bind = (RpcBinding*)(BindingVector->BindingH[c]);
|
||||
TRACE(" protseq[%ld]=%s\n", c, debugstr_a(bind->Protseq));
|
||||
TRACE(" endpoint[%ld]=%s\n", c, debugstr_a(bind->Endpoint));
|
||||
}
|
||||
if (UuidVector) {
|
||||
for (c=0; c<UuidVector->Count; c++)
|
||||
TRACE(" obj[%ld]=%s\n", c, debugstr_guid(UuidVector->Uuid[c]));
|
||||
}
|
||||
|
||||
/* FIXME: Do something with annotation. */
|
||||
|
||||
/* construct the message to rpcss */
|
||||
msg.message_type = RPCSS_NP_MESSAGE_TYPEID_REGISTEREPMSG;
|
||||
msg.message.registerepmsg.iface = If->InterfaceId;
|
||||
msg.message.registerepmsg.no_replace = 0;
|
||||
|
||||
msg.message.registerepmsg.object_count = (UuidVector) ? UuidVector->Count : 0;
|
||||
msg.message.registerepmsg.binding_count = BindingVector->Count;
|
||||
|
||||
/* calculate vardata payload size */
|
||||
msg.vardata_payload_size = msg.message.registerepmsg.object_count * sizeof(UUID);
|
||||
for (c=0; c < msg.message.registerepmsg.binding_count; c++) {
|
||||
RpcBinding *bind = (RpcBinding *)(BindingVector->BindingH[c]);
|
||||
msg.vardata_payload_size += strlen(bind->Protseq) + 1;
|
||||
msg.vardata_payload_size += strlen(bind->Endpoint) + 1;
|
||||
}
|
||||
|
||||
/* allocate the payload buffer */
|
||||
vp = vardata_payload = LocalAlloc(LPTR, msg.vardata_payload_size);
|
||||
if (!vardata_payload)
|
||||
return RPC_S_OUT_OF_MEMORY;
|
||||
|
||||
/* populate the payload data */
|
||||
for (c=0; c < msg.message.registerepmsg.object_count; c++) {
|
||||
CopyMemory(vp, UuidVector->Uuid[c], sizeof(UUID));
|
||||
vp += sizeof(UUID);
|
||||
}
|
||||
|
||||
for (c=0; c < msg.message.registerepmsg.binding_count; c++) {
|
||||
RpcBinding *bind = (RpcBinding*)(BindingVector->BindingH[c]);
|
||||
unsigned long pslen = strlen(bind->Protseq) + 1, eplen = strlen(bind->Endpoint) + 1;
|
||||
CopyMemory(vp, bind->Protseq, pslen);
|
||||
vp += pslen;
|
||||
CopyMemory(vp, bind->Endpoint, eplen);
|
||||
vp += eplen;
|
||||
}
|
||||
|
||||
/* send our request */
|
||||
if (!RPCRT4_RPCSSOnDemandCall(&msg, vardata_payload, &reply))
|
||||
rslt = RPC_S_OUT_OF_MEMORY;
|
||||
|
||||
/* free the payload buffer */
|
||||
LocalFree(vardata_payload);
|
||||
|
||||
return rslt;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* RpcEpUnregister (RPCRT4.@)
|
||||
*/
|
||||
RPC_STATUS WINAPI RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector,
|
||||
UUID_VECTOR *UuidVector )
|
||||
{
|
||||
RPCSS_NP_MESSAGE msg;
|
||||
RPCSS_NP_REPLY reply;
|
||||
char *vardata_payload, *vp;
|
||||
PRPC_SERVER_INTERFACE If = (PRPC_SERVER_INTERFACE)IfSpec;
|
||||
unsigned long c;
|
||||
RPC_STATUS rslt = RPC_S_OK;
|
||||
|
||||
TRACE("(%p,%p,%p)\n", IfSpec, BindingVector, UuidVector);
|
||||
TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID));
|
||||
for (c=0; c<BindingVector->Count; c++) {
|
||||
RpcBinding* bind = (RpcBinding*)(BindingVector->BindingH[c]);
|
||||
TRACE(" protseq[%ld]=%s\n", c, debugstr_a(bind->Protseq));
|
||||
TRACE(" endpoint[%ld]=%s\n", c, debugstr_a(bind->Endpoint));
|
||||
}
|
||||
if (UuidVector) {
|
||||
for (c=0; c<UuidVector->Count; c++)
|
||||
TRACE(" obj[%ld]=%s\n", c, debugstr_guid(UuidVector->Uuid[c]));
|
||||
}
|
||||
|
||||
/* construct the message to rpcss */
|
||||
msg.message_type = RPCSS_NP_MESSAGE_TYPEID_UNREGISTEREPMSG;
|
||||
msg.message.unregisterepmsg.iface = If->InterfaceId;
|
||||
|
||||
msg.message.unregisterepmsg.object_count = (UuidVector) ? UuidVector->Count : 0;
|
||||
msg.message.unregisterepmsg.binding_count = BindingVector->Count;
|
||||
|
||||
/* calculate vardata payload size */
|
||||
msg.vardata_payload_size = msg.message.unregisterepmsg.object_count * sizeof(UUID);
|
||||
for (c=0; c < msg.message.unregisterepmsg.binding_count; c++) {
|
||||
RpcBinding *bind = (RpcBinding *)(BindingVector->BindingH[c]);
|
||||
msg.vardata_payload_size += strlen(bind->Protseq) + 1;
|
||||
msg.vardata_payload_size += strlen(bind->Endpoint) + 1;
|
||||
}
|
||||
|
||||
/* allocate the payload buffer */
|
||||
vp = vardata_payload = LocalAlloc(LPTR, msg.vardata_payload_size);
|
||||
if (!vardata_payload)
|
||||
return RPC_S_OUT_OF_MEMORY;
|
||||
|
||||
/* populate the payload data */
|
||||
for (c=0; c < msg.message.unregisterepmsg.object_count; c++) {
|
||||
CopyMemory(vp, UuidVector->Uuid[c], sizeof(UUID));
|
||||
vp += sizeof(UUID);
|
||||
}
|
||||
|
||||
for (c=0; c < msg.message.unregisterepmsg.binding_count; c++) {
|
||||
RpcBinding *bind = (RpcBinding*)(BindingVector->BindingH[c]);
|
||||
unsigned long pslen = strlen(bind->Protseq) + 1, eplen = strlen(bind->Endpoint) + 1;
|
||||
CopyMemory(vp, bind->Protseq, pslen);
|
||||
vp += pslen;
|
||||
CopyMemory(vp, bind->Endpoint, eplen);
|
||||
vp += eplen;
|
||||
}
|
||||
|
||||
/* send our request */
|
||||
if (!RPCRT4_RPCSSOnDemandCall(&msg, vardata_payload, &reply))
|
||||
rslt = RPC_S_OUT_OF_MEMORY;
|
||||
|
||||
/* free the payload buffer */
|
||||
LocalFree(vardata_payload);
|
||||
|
||||
return rslt;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* RpcEpResolveBinding (RPCRT4.@)
|
||||
*/
|
||||
RPC_STATUS WINAPI RpcEpResolveBinding( RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE IfSpec )
|
||||
{
|
||||
RPCSS_NP_MESSAGE msg;
|
||||
RPCSS_NP_REPLY reply;
|
||||
PRPC_CLIENT_INTERFACE If = (PRPC_CLIENT_INTERFACE)IfSpec;
|
||||
RpcBinding* bind = (RpcBinding*)Binding;
|
||||
|
||||
TRACE("(%p,%p)\n", Binding, IfSpec);
|
||||
TRACE(" protseq=%s\n", debugstr_a(bind->Protseq));
|
||||
TRACE(" obj=%s\n", debugstr_guid(&bind->ObjectUuid));
|
||||
TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID));
|
||||
|
||||
/* FIXME: totally untested */
|
||||
|
||||
/* just return for fully bound handles */
|
||||
if (bind->Endpoint && (bind->Endpoint[0] != '\0'))
|
||||
return RPC_S_OK;
|
||||
|
||||
/* construct the message to rpcss */
|
||||
msg.message_type = RPCSS_NP_MESSAGE_TYPEID_RESOLVEEPMSG;
|
||||
msg.message.resolveepmsg.iface = If->InterfaceId;
|
||||
msg.message.resolveepmsg.object = bind->ObjectUuid;
|
||||
|
||||
msg.vardata_payload_size = strlen(bind->Protseq) + 1;
|
||||
|
||||
/* send the message */
|
||||
if (!RPCRT4_RPCSSOnDemandCall(&msg, bind->Protseq, &reply))
|
||||
return RPC_S_OUT_OF_MEMORY;
|
||||
|
||||
/* empty-string result means not registered */
|
||||
if (reply.as_string[0] == '\0')
|
||||
return EPT_S_NOT_REGISTERED;
|
||||
|
||||
/* otherwise we fully bind the handle & return RPC_S_OK */
|
||||
return RPCRT4_ResolveBinding(Binding, reply.as_string);
|
||||
}
|
||||
|
||||
typedef unsigned int unsigned32;
|
||||
typedef struct twr_t
|
||||
{
|
||||
unsigned32 tower_length;
|
||||
/* [size_is] */ BYTE tower_octet_string[ 1 ];
|
||||
} twr_t;
|
||||
|
||||
/***********************************************************************
|
||||
* TowerExplode (RPCRT4.@)
|
||||
*/
|
||||
RPC_STATUS WINAPI TowerExplode(
|
||||
const twr_t *tower, PRPC_SYNTAX_IDENTIFIER object, PRPC_SYNTAX_IDENTIFIER syntax,
|
||||
char **protseq, char **endpoint, char **address)
|
||||
{
|
||||
size_t tower_size;
|
||||
RPC_STATUS status;
|
||||
const unsigned char *p;
|
||||
u_int16 floor_count;
|
||||
const twr_uuid_floor_t *object_floor;
|
||||
const twr_uuid_floor_t *syntax_floor;
|
||||
|
||||
if (protseq)
|
||||
*protseq = NULL;
|
||||
if (endpoint)
|
||||
*endpoint = NULL;
|
||||
if (address)
|
||||
*address = NULL;
|
||||
|
||||
tower_size = tower->tower_length;
|
||||
|
||||
if (tower_size < sizeof(u_int16))
|
||||
return EPT_S_NOT_REGISTERED;
|
||||
|
||||
p = &tower->tower_octet_string[0];
|
||||
|
||||
floor_count = *(const u_int16 *)p;
|
||||
p += sizeof(u_int16);
|
||||
tower_size -= sizeof(u_int16);
|
||||
TRACE("floor_count: %d\n", floor_count);
|
||||
/* FIXME: should we do something with the floor count? at the moment we don't */
|
||||
|
||||
if (tower_size < sizeof(*object_floor) + sizeof(*syntax_floor))
|
||||
return EPT_S_NOT_REGISTERED;
|
||||
|
||||
object_floor = (const twr_uuid_floor_t *)p;
|
||||
p += sizeof(*object_floor);
|
||||
tower_size -= sizeof(*object_floor);
|
||||
syntax_floor = (const twr_uuid_floor_t *)p;
|
||||
p += sizeof(*syntax_floor);
|
||||
tower_size -= sizeof(*syntax_floor);
|
||||
|
||||
if ((object_floor->count_lhs != sizeof(object_floor->protid) +
|
||||
sizeof(object_floor->uuid) + sizeof(object_floor->major_version)) ||
|
||||
(object_floor->protid != EPM_PROTOCOL_UUID) ||
|
||||
(object_floor->count_rhs != sizeof(object_floor->minor_version)))
|
||||
return EPT_S_NOT_REGISTERED;
|
||||
|
||||
if ((syntax_floor->count_lhs != sizeof(syntax_floor->protid) +
|
||||
sizeof(syntax_floor->uuid) + sizeof(syntax_floor->major_version)) ||
|
||||
(syntax_floor->protid != EPM_PROTOCOL_UUID) ||
|
||||
(syntax_floor->count_rhs != sizeof(syntax_floor->minor_version)))
|
||||
return EPT_S_NOT_REGISTERED;
|
||||
|
||||
status = RpcTransport_ParseTopOfTower(p, tower_size, protseq, address, endpoint);
|
||||
if ((status == RPC_S_OK) && syntax && object)
|
||||
{
|
||||
syntax->SyntaxGUID = syntax_floor->uuid;
|
||||
syntax->SyntaxVersion.MajorVersion = syntax_floor->major_version;
|
||||
syntax->SyntaxVersion.MinorVersion = syntax_floor->minor_version;
|
||||
object->SyntaxGUID = object_floor->uuid;
|
||||
object->SyntaxVersion.MajorVersion = object_floor->major_version;
|
||||
object->SyntaxVersion.MinorVersion = object_floor->minor_version;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* TowerConstruct (RPCRT4.@)
|
||||
*/
|
||||
RPC_STATUS WINAPI TowerConstruct(
|
||||
const RPC_SYNTAX_IDENTIFIER *object, const RPC_SYNTAX_IDENTIFIER *syntax,
|
||||
const char *protseq, const char *endpoint, const char *address,
|
||||
twr_t **tower)
|
||||
{
|
||||
size_t tower_size;
|
||||
RPC_STATUS status;
|
||||
unsigned char *p;
|
||||
twr_uuid_floor_t *object_floor;
|
||||
twr_uuid_floor_t *syntax_floor;
|
||||
|
||||
*tower = NULL;
|
||||
|
||||
status = RpcTransport_GetTopOfTower(NULL, &tower_size, protseq, address, endpoint);
|
||||
|
||||
if (status != RPC_S_OK)
|
||||
return status;
|
||||
|
||||
tower_size += sizeof(u_int16) + sizeof(*object_floor) + sizeof(*syntax_floor);
|
||||
*tower = I_RpcAllocate(FIELD_OFFSET(twr_t, tower_octet_string[tower_size]));
|
||||
if (!*tower)
|
||||
return RPC_S_OUT_OF_RESOURCES;
|
||||
|
||||
(*tower)->tower_length = tower_size;
|
||||
p = &(*tower)->tower_octet_string[0];
|
||||
*(u_int16 *)p = 5; /* number of floors */
|
||||
p += sizeof(u_int16);
|
||||
object_floor = (twr_uuid_floor_t *)p;
|
||||
p += sizeof(*object_floor);
|
||||
syntax_floor = (twr_uuid_floor_t *)p;
|
||||
p += sizeof(*syntax_floor);
|
||||
|
||||
object_floor->count_lhs = sizeof(object_floor->protid) + sizeof(object_floor->uuid) +
|
||||
sizeof(object_floor->major_version);
|
||||
object_floor->protid = EPM_PROTOCOL_UUID;
|
||||
object_floor->count_rhs = sizeof(object_floor->minor_version);
|
||||
object_floor->uuid = object->SyntaxGUID;
|
||||
object_floor->major_version = object->SyntaxVersion.MajorVersion;
|
||||
object_floor->minor_version = object->SyntaxVersion.MinorVersion;
|
||||
|
||||
syntax_floor->count_lhs = sizeof(syntax_floor->protid) + sizeof(syntax_floor->uuid) +
|
||||
sizeof(syntax_floor->major_version);
|
||||
syntax_floor->protid = EPM_PROTOCOL_UUID;
|
||||
syntax_floor->count_rhs = sizeof(syntax_floor->minor_version);
|
||||
syntax_floor->uuid = syntax->SyntaxGUID;
|
||||
syntax_floor->major_version = syntax->SyntaxVersion.MajorVersion;
|
||||
syntax_floor->minor_version = syntax->SyntaxVersion.MinorVersion;
|
||||
|
||||
status = RpcTransport_GetTopOfTower(p, &tower_size, protseq, address, endpoint);
|
||||
if (status != RPC_S_OK)
|
||||
{
|
||||
I_RpcFree(*tower);
|
||||
*tower = NULL;
|
||||
return status;
|
||||
}
|
||||
return RPC_S_OK;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* RPC message API
|
||||
*
|
||||
* Copyright 2004 Filip Navara
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __WINE_RPC_MESSAGE_H
|
||||
#define __WINE_RPC_MESSAGE_H
|
||||
|
||||
#include "wine/rpcss_shared.h"
|
||||
#include "rpc_defs.h"
|
||||
|
||||
typedef unsigned int NCA_STATUS;
|
||||
|
||||
RpcPktHdr *RPCRT4_BuildFaultHeader(unsigned long DataRepresentation, RPC_STATUS Status);
|
||||
RpcPktHdr *RPCRT4_BuildResponseHeader(unsigned long DataRepresentation, unsigned long BufferLength);
|
||||
RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, unsigned long AssocGroupId, const RPC_SYNTAX_IDENTIFIER *AbstractId, const RPC_SYNTAX_IDENTIFIER *TransferId);
|
||||
RpcPktHdr *RPCRT4_BuildBindNackHeader(unsigned long DataRepresentation, unsigned char RpcVersion, unsigned char RpcVersionMinor);
|
||||
RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, unsigned long AssocGroupId, LPCSTR ServerAddress, unsigned long Result, unsigned long Reason, const RPC_SYNTAX_IDENTIFIER *TransferId);
|
||||
VOID RPCRT4_FreeHeader(RpcPktHdr *Header);
|
||||
RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength);
|
||||
RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg);
|
||||
NCA_STATUS RPC2NCA_STATUS(RPC_STATUS status);
|
||||
RPC_STATUS NCA2RPC_STATUS(NCA_STATUS status);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* RPC server API
|
||||
*
|
||||
* Copyright 2001 Ove Kåven, TransGaming Technologies
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __WINE_RPC_SERVER_H
|
||||
#define __WINE_RPC_SERVER_H
|
||||
|
||||
#include "rpc_binding.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
struct protseq_ops;
|
||||
|
||||
typedef struct _RpcServerProtseq
|
||||
{
|
||||
const struct protseq_ops *ops; /* RO */
|
||||
struct list entry; /* CS ::server_cs */
|
||||
LPSTR Protseq; /* RO */
|
||||
UINT MaxCalls; /* RO */
|
||||
/* list of listening connections */
|
||||
RpcConnection* conn; /* CS cs */
|
||||
CRITICAL_SECTION cs;
|
||||
|
||||
/* is the server currently listening? */
|
||||
BOOL is_listening; /* CS ::listen_cs */
|
||||
/* mutex for ensuring only one thread can change state at a time */
|
||||
HANDLE mgr_mutex;
|
||||
/* set when server thread has finished opening connections */
|
||||
HANDLE server_ready_event;
|
||||
} RpcServerProtseq;
|
||||
|
||||
struct protseq_ops
|
||||
{
|
||||
const char *name;
|
||||
RpcServerProtseq *(*alloc)(void);
|
||||
void (*signal_state_changed)(RpcServerProtseq *protseq);
|
||||
/* previous array is passed in to allow reuse of memory */
|
||||
void *(*get_wait_array)(RpcServerProtseq *protseq, void *prev_array, unsigned int *count);
|
||||
void (*free_wait_array)(RpcServerProtseq *protseq, void *array);
|
||||
/* returns -1 for failure, 0 for server state changed and 1 to indicate a
|
||||
* new connection was established */
|
||||
int (*wait_for_new_connection)(RpcServerProtseq *protseq, unsigned int count, void *wait_array);
|
||||
/* opens the endpoint and optionally begins listening */
|
||||
RPC_STATUS (*open_endpoint)(RpcServerProtseq *protseq, LPSTR endpoint);
|
||||
};
|
||||
|
||||
typedef struct _RpcServerInterface
|
||||
{
|
||||
struct list entry;
|
||||
RPC_SERVER_INTERFACE* If;
|
||||
UUID MgrTypeUuid;
|
||||
RPC_MGR_EPV* MgrEpv;
|
||||
UINT Flags;
|
||||
UINT MaxCalls;
|
||||
UINT MaxRpcSize;
|
||||
RPC_IF_CALLBACK_FN* IfCallbackFn;
|
||||
LONG CurrentCalls; /* number of calls currently executing */
|
||||
/* set when unregistering interface to let the caller of
|
||||
* RpcServerUnregisterIf* know that all calls have finished */
|
||||
HANDLE CallsCompletedEvent;
|
||||
} RpcServerInterface;
|
||||
|
||||
void RPCRT4_new_client(RpcConnection* conn);
|
||||
const struct protseq_ops *rpcrt4_get_protseq_ops(const char *protseq);
|
||||
|
||||
#endif /* __WINE_RPC_SERVER_H */
|
||||
@@ -1,43 +0,0 @@
|
||||
<module name="rpcrt4" type="win32dll" baseaddress="${BASEADDRESS_RPCRT4}" installbase="system32" installname="rpcrt4.dll" allowwarnings="true">
|
||||
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
|
||||
<importlibrary definition="rpcrt4.spec.def" />
|
||||
<include base="rpcrt4">.</include>
|
||||
<include base="ReactOS">include/reactos/wine</include>
|
||||
<define name="__REACTOS__" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_IE">0x600</define>
|
||||
<define name="_WIN32_WINNT">0x501</define>
|
||||
<define name="WINVER">0x501</define>
|
||||
<define name="_STDDEF_H" />
|
||||
<define name="_RPCRT4_" />
|
||||
<define name="COM_NO_WINDOWS_H" />
|
||||
<define name="MSWMSG" />
|
||||
<library>wine</library>
|
||||
<library>uuid</library>
|
||||
<library>ntdll</library>
|
||||
<library>kernel32</library>
|
||||
<library>advapi32</library>
|
||||
<library>secur32</library>
|
||||
<library>iphlpapi</library>
|
||||
<library>ws2_32</library>
|
||||
<file>cproxy.c</file>
|
||||
<file>cpsf.c</file>
|
||||
<file>cstub.c</file>
|
||||
<file>ndr_contexthandle.c</file>
|
||||
<file>ndr_clientserver.c</file>
|
||||
<file>ndr_fullpointer.c</file>
|
||||
<file>ndr_marshall.c</file>
|
||||
<file>ndr_ole.c</file>
|
||||
<file>ndr_stubless.c</file>
|
||||
<file>rpc_assoc.c</file>
|
||||
<file>rpc_binding.c</file>
|
||||
<file>rpc_epmap.c</file>
|
||||
<file>rpc_message.c</file>
|
||||
<file>rpc_server.c</file>
|
||||
<file>rpc_transport.c</file>
|
||||
<file>rpcrt4_main.c</file>
|
||||
<file>rpcss_np_client.c</file>
|
||||
<file>unix_func.c</file>
|
||||
<file>rpcrt4.rc</file>
|
||||
<file>rpcrt4.spec</file>
|
||||
</module>
|
||||
@@ -1,7 +0,0 @@
|
||||
#include <windows.h>
|
||||
|
||||
#define REACTOS_VERSION_DLL
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS RPC server API\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "rpcrt4\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "rpcrt4.dll\0"
|
||||
#include <reactos/version.rc>
|
||||
@@ -1,565 +0,0 @@
|
||||
@ stdcall CreateProxyFromTypeInfo(ptr ptr ptr ptr ptr)
|
||||
@ stub CreateStubFromTypeInfo
|
||||
@ stdcall CStdStubBuffer_AddRef(ptr)
|
||||
@ stdcall CStdStubBuffer_Connect(ptr ptr)
|
||||
@ stdcall CStdStubBuffer_CountRefs(ptr)
|
||||
@ stdcall CStdStubBuffer_DebugServerQueryInterface(ptr ptr)
|
||||
@ stdcall CStdStubBuffer_DebugServerRelease(ptr ptr)
|
||||
@ stdcall CStdStubBuffer_Disconnect(ptr)
|
||||
@ stdcall CStdStubBuffer_Invoke(ptr ptr ptr)
|
||||
@ stdcall CStdStubBuffer_IsIIDSupported(ptr ptr)
|
||||
@ stdcall CStdStubBuffer_QueryInterface(ptr ptr ptr)
|
||||
@ stub CreateServerInterfaceFromStub # wxp
|
||||
@ stdcall DceErrorInqTextA (long ptr)
|
||||
@ stdcall DceErrorInqTextW (long ptr)
|
||||
@ stdcall -private DllRegisterServer()
|
||||
@ stub GlobalMutexClearExternal
|
||||
@ stub GlobalMutexRequestExternal
|
||||
@ stdcall IUnknown_AddRef_Proxy(ptr)
|
||||
@ stdcall IUnknown_QueryInterface_Proxy(ptr ptr ptr)
|
||||
@ stdcall IUnknown_Release_Proxy(ptr)
|
||||
@ stub I_RpcAbortAsyncCall
|
||||
@ stdcall I_RpcAllocate(long)
|
||||
@ stub I_RpcAsyncAbortCall
|
||||
@ stub I_RpcAsyncSendReceive # NT4
|
||||
@ stub I_RpcAsyncSetHandle
|
||||
@ stub I_RpcBCacheAllocate
|
||||
@ stub I_RpcBCacheFree
|
||||
@ stub I_RpcBindingCopy
|
||||
@ stub I_RpcBindingInqConnId
|
||||
@ stub I_RpcBindingInqDynamicEndPoint
|
||||
@ stub I_RpcBindingInqDynamicEndPointA
|
||||
@ stub I_RpcBindingInqDynamicEndPointW
|
||||
@ stub I_RpcBindingInqLocalClientPID # wxp
|
||||
@ stub I_RpcBindingInqSecurityContext
|
||||
@ stub I_RpcBindingInqTransportType
|
||||
@ stub I_RpcBindingInqWireIdForSnego
|
||||
@ stub I_RpcBindingIsClientLocal
|
||||
# 9x version of I_RpcBindingSetAsync has 3 arguments, not 2
|
||||
@ stdcall I_RpcBindingSetAsync(ptr ptr)
|
||||
@ stub I_RpcBindingToStaticStringBindingW
|
||||
@ stub I_RpcClearMutex
|
||||
@ stub I_RpcConnectionInqSockBuffSize2
|
||||
@ stub I_RpcConnectionInqSockBuffSize
|
||||
@ stub I_RpcConnectionSetSockBuffSize
|
||||
@ stub I_RpcDeleteMutex
|
||||
@ stub I_RpcEnableWmiTrace # wxp
|
||||
@ stub I_RpcExceptionFilter # wxp
|
||||
@ stdcall I_RpcFree(ptr)
|
||||
@ stdcall I_RpcFreeBuffer(ptr)
|
||||
@ stub I_RpcFreePipeBuffer
|
||||
@ stub I_RpcGetAssociationContext
|
||||
@ stdcall I_RpcGetBuffer(ptr)
|
||||
@ stub I_RpcGetBufferWithObject
|
||||
@ stdcall I_RpcGetCurrentCallHandle()
|
||||
@ stub I_RpcGetExtendedError
|
||||
@ stub I_RpcGetServerContextList
|
||||
@ stub I_RpcGetThreadEvent # win9x
|
||||
@ stub I_RpcGetThreadWindowHandle # win9x
|
||||
@ stub I_RpcIfInqTransferSyntaxes
|
||||
@ stub I_RpcLaunchDatagramReceiveThread # win9x
|
||||
@ stub I_RpcLogEvent
|
||||
@ stdcall I_RpcMapWin32Status(long)
|
||||
@ stub I_RpcMonitorAssociation
|
||||
@ stub I_RpcNegotiateTransferSyntax # wxp
|
||||
@ stub I_RpcNsBindingSetEntryName
|
||||
@ stub I_RpcNsBindingSetEntryNameA
|
||||
@ stub I_RpcNsBindingSetEntryNameW
|
||||
@ stub I_RpcNsInterfaceExported
|
||||
@ stub I_RpcNsInterfaceUnexported
|
||||
@ stub I_RpcParseSecurity
|
||||
@ stub I_RpcPauseExecution
|
||||
@ stub I_RpcProxyNewConnection # wxp
|
||||
@ stub I_RpcReallocPipeBuffer
|
||||
@ stdcall I_RpcReceive(ptr)
|
||||
@ stub I_RpcRequestMutex
|
||||
@ stdcall I_RpcSend(ptr)
|
||||
@ stdcall I_RpcSendReceive(ptr)
|
||||
@ stub I_RpcServerAllocateIpPort
|
||||
@ stub I_RpcServerInqAddressChangeFn
|
||||
@ stub I_RpcServerInqLocalConnAddress # wxp
|
||||
@ stub I_RpcServerInqTransportType
|
||||
@ stub I_RpcServerRegisterForwardFunction
|
||||
@ stub I_RpcServerSetAddressChangeFn
|
||||
@ stdcall I_RpcServerStartListening(ptr) # win9x
|
||||
@ stdcall I_RpcServerStopListening() # win9x
|
||||
@ stub I_RpcServerUnregisterEndpointA # win9x
|
||||
@ stub I_RpcServerUnregisterEndpointW # win9x
|
||||
@ stub I_RpcServerUseProtseq2A
|
||||
@ stub I_RpcServerUseProtseq2W
|
||||
@ stub I_RpcServerUseProtseqEp2A
|
||||
@ stub I_RpcServerUseProtseqEp2W
|
||||
@ stub I_RpcSetAssociationContext # win9x
|
||||
@ stub I_RpcSetAsyncHandle
|
||||
@ stub I_RpcSetServerContextList
|
||||
@ stub I_RpcSetThreadParams # win9x
|
||||
@ stub I_RpcSetWMsgEndpoint # NT4
|
||||
@ stub I_RpcSsDontSerializeContext
|
||||
@ stub I_RpcStopMonitorAssociation
|
||||
@ stub I_RpcSystemFunction001 # wxp (oh, brother!)
|
||||
@ stub I_RpcTransCancelMigration # win9x
|
||||
@ stub I_RpcTransClientMaxFrag # win9x
|
||||
@ stub I_RpcTransClientReallocBuffer # win9x
|
||||
@ stub I_RpcTransConnectionAllocatePacket
|
||||
@ stub I_RpcTransConnectionFreePacket
|
||||
@ stub I_RpcTransConnectionReallocPacket
|
||||
@ stub I_RpcTransDatagramAllocate2
|
||||
@ stub I_RpcTransDatagramAllocate
|
||||
@ stub I_RpcTransDatagramFree
|
||||
@ stub I_RpcTransGetAddressList
|
||||
@ stub I_RpcTransGetThreadEvent
|
||||
@ stub I_RpcTransIoCancelled
|
||||
@ stub I_RpcTransMaybeMakeReceiveAny # win9x
|
||||
@ stub I_RpcTransMaybeMakeReceiveDirect # win9x
|
||||
@ stub I_RpcTransPingServer # win9x
|
||||
@ stub I_RpcTransServerFindConnection # win9x
|
||||
@ stub I_RpcTransServerFreeBuffer # win9x
|
||||
@ stub I_RpcTransServerMaxFrag # win9x
|
||||
@ stub I_RpcTransServerNewConnection
|
||||
@ stub I_RpcTransServerProtectThread # win9x
|
||||
@ stub I_RpcTransServerReallocBuffer # win9x
|
||||
@ stub I_RpcTransServerReceiveDirectReady # win9x
|
||||
@ stub I_RpcTransServerUnprotectThread # win9x
|
||||
@ stub I_RpcTurnOnEEInfoPropagation # wxp
|
||||
@ stdcall I_RpcWindowProc(ptr long long long) # win9x
|
||||
@ stub I_RpcltDebugSetPDUFilter
|
||||
@ stub I_UuidCreate
|
||||
@ stub MIDL_wchar_strcpy
|
||||
@ stub MIDL_wchar_strlen
|
||||
@ stub MesBufferHandleReset
|
||||
@ stub MesDecodeBufferHandleCreate
|
||||
@ stub MesDecodeIncrementalHandleCreate
|
||||
@ stub MesEncodeDynBufferHandleCreate
|
||||
@ stub MesEncodeFixedBufferHandleCreate
|
||||
@ stub MesEncodeIncrementalHandleCreate
|
||||
@ stub MesHandleFree
|
||||
@ stub MesIncrementalHandleReset
|
||||
@ stub MesInqProcEncodingId
|
||||
@ stub MqGetContext # win9x
|
||||
@ stub MqRegisterQueue # win9x
|
||||
@ stdcall NDRCContextBinding(ptr)
|
||||
@ stdcall NDRCContextMarshall(ptr ptr)
|
||||
@ stdcall NDRCContextUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NDRSContextMarshall2(ptr ptr ptr ptr ptr long)
|
||||
@ stdcall NDRSContextMarshall(ptr ptr ptr)
|
||||
@ stdcall NDRSContextMarshallEx(ptr ptr ptr ptr)
|
||||
@ stdcall NDRSContextUnmarshall2(ptr ptr ptr ptr long)
|
||||
@ stdcall NDRSContextUnmarshall(ptr ptr)
|
||||
@ stdcall NDRSContextUnmarshallEx(ptr ptr ptr)
|
||||
@ stub NDRcopy
|
||||
@ stdcall NdrAllocate(ptr long)
|
||||
@ stub NdrAsyncClientCall
|
||||
@ stub NdrAsyncServerCall
|
||||
@ stdcall NdrByteCountPointerBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrByteCountPointerFree(ptr ptr ptr)
|
||||
@ stdcall NdrByteCountPointerMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrByteCountPointerUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrCStdStubBuffer2_Release(ptr ptr)
|
||||
@ stdcall NdrCStdStubBuffer_Release(ptr ptr)
|
||||
@ stdcall NdrClearOutParameters(ptr ptr ptr)
|
||||
@ varargs NdrClientCall2(ptr ptr)
|
||||
@ varargs NdrClientCall(ptr ptr) NdrClientCall2
|
||||
@ stdcall NdrClientContextMarshall(ptr ptr long)
|
||||
@ stdcall NdrClientContextUnmarshall(ptr ptr ptr)
|
||||
@ stub NdrClientInitialize
|
||||
@ stdcall NdrClientInitializeNew(ptr ptr ptr long)
|
||||
@ stdcall NdrComplexArrayBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrComplexArrayFree(ptr ptr ptr)
|
||||
@ stdcall NdrComplexArrayMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrComplexArrayMemorySize(ptr ptr)
|
||||
@ stdcall NdrComplexArrayUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrComplexStructBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrComplexStructFree(ptr ptr ptr)
|
||||
@ stdcall NdrComplexStructMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrComplexStructMemorySize(ptr ptr)
|
||||
@ stdcall NdrComplexStructUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrConformantArrayBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrConformantArrayFree(ptr ptr ptr)
|
||||
@ stdcall NdrConformantArrayMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrConformantArrayMemorySize(ptr ptr)
|
||||
@ stdcall NdrConformantArrayUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrConformantStringBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrConformantStringMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrConformantStringMemorySize(ptr ptr)
|
||||
@ stdcall NdrConformantStringUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrConformantStructBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrConformantStructFree(ptr ptr ptr)
|
||||
@ stdcall NdrConformantStructMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrConformantStructMemorySize(ptr ptr)
|
||||
@ stdcall NdrConformantStructUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrConformantVaryingArrayBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrConformantVaryingArrayFree(ptr ptr ptr)
|
||||
@ stdcall NdrConformantVaryingArrayMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrConformantVaryingArrayMemorySize(ptr ptr)
|
||||
@ stdcall NdrConformantVaryingArrayUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrConformantVaryingStructBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrConformantVaryingStructFree(ptr ptr ptr)
|
||||
@ stdcall NdrConformantVaryingStructMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrConformantVaryingStructMemorySize(ptr ptr)
|
||||
@ stdcall NdrConformantVaryingStructUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrContextHandleInitialize(ptr ptr)
|
||||
@ stdcall NdrContextHandleSize(ptr ptr ptr)
|
||||
@ stdcall NdrConvert2(ptr ptr long)
|
||||
@ stdcall NdrConvert(ptr ptr)
|
||||
@ stub NdrCorrelationFree
|
||||
@ stub NdrCorrelationInitialize
|
||||
@ stub NdrCorrelationPass
|
||||
@ stub NdrDcomAsyncClientCall
|
||||
@ stub NdrDcomAsyncStubCall
|
||||
@ stdcall NdrDllCanUnloadNow(ptr)
|
||||
@ stdcall NdrDllGetClassObject(ptr ptr ptr ptr ptr ptr)
|
||||
@ stdcall NdrDllRegisterProxy(long ptr ptr)
|
||||
@ stdcall NdrDllUnregisterProxy(long ptr ptr)
|
||||
@ stdcall NdrEncapsulatedUnionBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrEncapsulatedUnionFree(ptr ptr ptr)
|
||||
@ stdcall NdrEncapsulatedUnionMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrEncapsulatedUnionMemorySize(ptr ptr)
|
||||
@ stdcall NdrEncapsulatedUnionUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrFixedArrayBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrFixedArrayFree(ptr ptr ptr)
|
||||
@ stdcall NdrFixedArrayMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrFixedArrayMemorySize(ptr ptr)
|
||||
@ stdcall NdrFixedArrayUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrFreeBuffer(ptr)
|
||||
@ stdcall NdrFullPointerFree(ptr ptr)
|
||||
@ stdcall NdrFullPointerInsertRefId(ptr long ptr)
|
||||
@ stdcall NdrFullPointerQueryPointer(ptr ptr long ptr)
|
||||
@ stdcall NdrFullPointerQueryRefId(ptr long long ptr)
|
||||
@ stdcall NdrFullPointerXlatFree(ptr)
|
||||
@ stdcall NdrFullPointerXlatInit(long long)
|
||||
@ stdcall NdrGetBuffer(ptr long ptr)
|
||||
@ stub NdrGetDcomProtocolVersion
|
||||
@ stub NdrGetPartialBuffer
|
||||
@ stub NdrGetPipeBuffer
|
||||
@ stub NdrGetSimpleTypeBufferAlignment # wxp
|
||||
@ stub NdrGetSimpleTypeBufferSize # wxp
|
||||
@ stub NdrGetSimpleTypeMemorySize # wxp
|
||||
@ stub NdrGetTypeFlags # wxp
|
||||
@ stub NdrGetUserMarshallInfo
|
||||
@ stub NdrHardStructBufferSize #(ptr ptr ptr)
|
||||
@ stub NdrHardStructFree #(ptr ptr ptr)
|
||||
@ stub NdrHardStructMarshall #(ptr ptr ptr)
|
||||
@ stub NdrHardStructMemorySize #(ptr ptr)
|
||||
@ stub NdrHardStructUnmarshall #(ptr ptr ptr long)
|
||||
@ stdcall NdrInterfacePointerBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrInterfacePointerFree(ptr ptr ptr)
|
||||
@ stdcall NdrInterfacePointerMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrInterfacePointerMemorySize(ptr ptr)
|
||||
@ stdcall NdrInterfacePointerUnmarshall(ptr ptr ptr long)
|
||||
@ stub NdrIsAppDoneWithPipes
|
||||
@ stdcall NdrMapCommAndFaultStatus(ptr ptr ptr long)
|
||||
@ stub NdrMarkNextActivePipe
|
||||
@ stub NdrMesProcEncodeDecode2
|
||||
@ stub NdrMesProcEncodeDecode
|
||||
@ stub NdrMesSimpleTypeAlignSize
|
||||
@ stub NdrMesSimpleTypeDecode
|
||||
@ stub NdrMesSimpleTypeEncode
|
||||
@ stub NdrMesTypeAlignSize2
|
||||
@ stub NdrMesTypeAlignSize
|
||||
@ stub NdrMesTypeDecode2
|
||||
@ stub NdrMesTypeDecode
|
||||
@ stub NdrMesTypeEncode2
|
||||
@ stub NdrMesTypeEncode
|
||||
@ stub NdrMesTypeFree2
|
||||
@ stdcall NdrNonConformantStringBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrNonConformantStringMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrNonConformantStringMemorySize(ptr ptr)
|
||||
@ stdcall NdrNonConformantStringUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrNonEncapsulatedUnionBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrNonEncapsulatedUnionFree(ptr ptr ptr)
|
||||
@ stdcall NdrNonEncapsulatedUnionMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrNonEncapsulatedUnionMemorySize(ptr ptr)
|
||||
@ stdcall NdrNonEncapsulatedUnionUnmarshall(ptr ptr ptr long)
|
||||
@ stub NdrNsGetBuffer
|
||||
@ stub NdrNsSendReceive
|
||||
@ stdcall NdrOleAllocate(long)
|
||||
@ stdcall NdrOleFree(ptr)
|
||||
@ stub NdrOutInit # wxp
|
||||
@ stub NdrPartialIgnoreClientBufferSize # wxp
|
||||
@ stub NdrPartialIgnoreClientMarshall # wxp
|
||||
@ stub NdrPartialIgnoreServerInitialize # wxp
|
||||
@ stub NdrPartialIgnoreServerUnmarshall # wxp
|
||||
@ stub NdrPipePull
|
||||
@ stub NdrPipePush
|
||||
@ stub NdrPipeSendReceive
|
||||
@ stub NdrPipesDone
|
||||
@ stub NdrPipesInitialize
|
||||
@ stdcall NdrPointerBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrPointerFree(ptr ptr ptr)
|
||||
@ stdcall NdrPointerMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrPointerMemorySize(ptr ptr)
|
||||
@ stdcall NdrPointerUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrProxyErrorHandler(long)
|
||||
@ stdcall NdrProxyFreeBuffer(ptr ptr)
|
||||
@ stdcall NdrProxyGetBuffer(ptr ptr)
|
||||
@ stdcall NdrProxyInitialize(ptr ptr ptr ptr long)
|
||||
@ stdcall NdrProxySendReceive(ptr ptr)
|
||||
@ stdcall NdrRangeUnmarshall(ptr ptr ptr long)
|
||||
@ stub NdrRpcSmClientAllocate
|
||||
@ stub NdrRpcSmClientFree
|
||||
@ stub NdrRpcSmSetClientToOsf
|
||||
@ stub NdrRpcSsDefaultAllocate
|
||||
@ stub NdrRpcSsDefaultFree
|
||||
@ stub NdrRpcSsDisableAllocate
|
||||
@ stub NdrRpcSsEnableAllocate
|
||||
@ stdcall NdrSendReceive(ptr ptr)
|
||||
@ stdcall NdrServerCall2(ptr)
|
||||
@ stub NdrServerCall
|
||||
@ stdcall NdrServerContextMarshall(ptr ptr long)
|
||||
@ stdcall NdrServerContextNewMarshall(ptr ptr ptr ptr) # wxp
|
||||
@ stdcall NdrServerContextNewUnmarshall(ptr ptr) # wxp
|
||||
@ stdcall NdrServerContextUnmarshall(ptr)
|
||||
@ stub NdrServerInitialize
|
||||
@ stub NdrServerInitializeMarshall
|
||||
@ stdcall NdrServerInitializeNew(ptr ptr ptr)
|
||||
@ stub NdrServerInitializePartial # wxp
|
||||
@ stub NdrServerInitializeUnmarshall
|
||||
@ stub NdrServerMarshall
|
||||
@ stub NdrServerUnmarshall
|
||||
@ stdcall NdrSimpleStructBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrSimpleStructFree(ptr ptr ptr)
|
||||
@ stdcall NdrSimpleStructMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrSimpleStructMemorySize(ptr ptr)
|
||||
@ stdcall NdrSimpleStructUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrSimpleTypeMarshall(ptr ptr long)
|
||||
@ stdcall NdrSimpleTypeUnmarshall(ptr ptr long)
|
||||
@ stdcall NdrStubCall2(ptr ptr ptr ptr)
|
||||
@ stub NdrStubCall
|
||||
@ stdcall NdrStubForwardingFunction(ptr ptr ptr ptr)
|
||||
@ stdcall NdrStubGetBuffer(ptr ptr ptr)
|
||||
@ stdcall NdrStubInitialize(ptr ptr ptr ptr)
|
||||
@ stub NdrStubInitializeMarshall
|
||||
@ stub NdrTypeFlags # wxp
|
||||
@ stub NdrTypeFree # wxp
|
||||
@ stub NdrTypeMarshall # wxp
|
||||
@ stub NdrTypeSize # wxp
|
||||
@ stub NdrTypeUnmarshall # wxp
|
||||
@ stub NdrUnmarshallBasetypeInline # wxp
|
||||
@ stdcall NdrUserMarshalBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrUserMarshalFree(ptr ptr ptr)
|
||||
@ stdcall NdrUserMarshalMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrUserMarshalMemorySize(ptr ptr)
|
||||
@ stub NdrUserMarshalSimpleTypeConvert
|
||||
@ stdcall NdrUserMarshalUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrVaryingArrayBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrVaryingArrayFree(ptr ptr ptr)
|
||||
@ stdcall NdrVaryingArrayMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrVaryingArrayMemorySize(ptr ptr)
|
||||
@ stdcall NdrVaryingArrayUnmarshall(ptr ptr ptr long)
|
||||
@ stdcall NdrXmitOrRepAsBufferSize(ptr ptr ptr)
|
||||
@ stdcall NdrXmitOrRepAsFree(ptr ptr ptr)
|
||||
@ stdcall NdrXmitOrRepAsMarshall(ptr ptr ptr)
|
||||
@ stdcall NdrXmitOrRepAsMemorySize(ptr ptr)
|
||||
@ stdcall NdrXmitOrRepAsUnmarshall(ptr ptr ptr long)
|
||||
@ stub NdrpCreateProxy # wxp
|
||||
@ stub NdrpCreateStub # wxp
|
||||
@ stub NdrpGetProcFormatString # wxp
|
||||
@ stub NdrpGetTypeFormatString # wxp
|
||||
@ stub NdrpGetTypeGenCookie # wxp
|
||||
@ stub NdrpMemoryIncrement # wxp
|
||||
@ stub NdrpReleaseTypeFormatString # wxp
|
||||
@ stub NdrpReleaseTypeGenCookie # wxp
|
||||
@ stub NdrpSetRpcSsDefaults
|
||||
@ stub NdrpVarVtOfTypeDesc # wxp
|
||||
@ stub PerformRpcInitialization
|
||||
@ stub RpcAbortAsyncCall
|
||||
@ stub RpcAsyncAbortCall
|
||||
@ stub RpcAsyncCancelCall
|
||||
@ stub RpcAsyncCompleteCall
|
||||
@ stub RpcAsyncGetCallStatus
|
||||
@ stub RpcAsyncInitializeHandle
|
||||
@ stub RpcAsyncRegisterInfo
|
||||
@ stdcall RpcBindingCopy(ptr ptr)
|
||||
@ stdcall RpcBindingFree(ptr)
|
||||
@ stdcall RpcBindingFromStringBindingA(str ptr)
|
||||
@ stdcall RpcBindingFromStringBindingW(wstr ptr)
|
||||
@ stub RpcBindingInqAuthClientA
|
||||
@ stub RpcBindingInqAuthClientExA
|
||||
@ stub RpcBindingInqAuthClientExW
|
||||
@ stub RpcBindingInqAuthClientW
|
||||
@ stdcall RpcBindingInqAuthInfoA(ptr ptr ptr ptr ptr ptr)
|
||||
@ stdcall RpcBindingInqAuthInfoExA(ptr ptr ptr ptr ptr ptr long ptr)
|
||||
@ stdcall RpcBindingInqAuthInfoExW(ptr ptr ptr ptr ptr ptr long ptr)
|
||||
@ stdcall RpcBindingInqAuthInfoW(ptr ptr ptr ptr ptr ptr)
|
||||
@ stdcall RpcBindingInqObject(ptr ptr)
|
||||
@ stub RpcBindingInqOption
|
||||
@ stub RpcBindingReset
|
||||
@ stub RpcBindingServerFromClient
|
||||
@ stdcall RpcBindingSetAuthInfoA(ptr str long long ptr long)
|
||||
@ stdcall RpcBindingSetAuthInfoExA(ptr str long long ptr long ptr)
|
||||
@ stdcall RpcBindingSetAuthInfoExW(ptr wstr long long ptr long ptr)
|
||||
@ stdcall RpcBindingSetAuthInfoW(ptr wstr long long ptr long)
|
||||
@ stdcall RpcBindingSetObject(ptr ptr)
|
||||
@ stdcall RpcBindingSetOption(ptr long long)
|
||||
@ stdcall RpcBindingToStringBindingA(ptr ptr)
|
||||
@ stdcall RpcBindingToStringBindingW(ptr ptr)
|
||||
@ stdcall RpcBindingVectorFree(ptr)
|
||||
@ stub RpcCancelAsyncCall
|
||||
@ stdcall RpcCancelThread(ptr)
|
||||
@ stub RpcCancelThreadEx
|
||||
@ stub RpcCertGeneratePrincipalNameA
|
||||
@ stub RpcCertGeneratePrincipalNameW
|
||||
@ stub RpcCompleteAsyncCall
|
||||
@ stdcall RpcEpRegisterA(ptr ptr ptr str)
|
||||
@ stub RpcEpRegisterNoReplaceA
|
||||
@ stub RpcEpRegisterNoReplaceW
|
||||
@ stub RpcEpRegisterW
|
||||
@ stdcall RpcEpResolveBinding(ptr ptr)
|
||||
@ stdcall RpcEpUnregister(ptr ptr ptr)
|
||||
@ stub RpcErrorAddRecord # wxp
|
||||
@ stub RpcErrorClearInformation # wxp
|
||||
@ stub RpcErrorEndEnumeration # wxp
|
||||
@ stub RpcErrorGetNextRecord # wxp
|
||||
@ stub RpcErrorLoadErrorInfo # wxp
|
||||
@ stub RpcErrorNumberOfRecords # wxp
|
||||
@ stub RpcErrorResetEnumeration # wxp
|
||||
@ stub RpcErrorSaveErrorInfo # wxp
|
||||
@ stdcall RpcErrorStartEnumeration(ptr)
|
||||
@ stub RpcFreeAuthorizationContext # wxp
|
||||
@ stub RpcGetAsyncCallStatus
|
||||
@ stub RpcIfIdVectorFree
|
||||
@ stub RpcIfInqId
|
||||
@ stdcall RpcImpersonateClient(ptr)
|
||||
@ stub RpcInitializeAsyncHandle
|
||||
@ stub RpcMgmtBindingInqParameter # win9x
|
||||
@ stub RpcMgmtBindingSetParameter # win9x
|
||||
@ stdcall RpcMgmtEnableIdleCleanup()
|
||||
@ stdcall RpcMgmtEpEltInqBegin(ptr long ptr long ptr ptr)
|
||||
@ stub RpcMgmtEpEltInqDone
|
||||
@ stub RpcMgmtEpEltInqNextA
|
||||
@ stub RpcMgmtEpEltInqNextW
|
||||
@ stub RpcMgmtEpUnregister
|
||||
@ stub RpcMgmtInqComTimeout
|
||||
@ stub RpcMgmtInqDefaultProtectLevel
|
||||
@ stdcall RpcMgmtInqIfIds(ptr ptr)
|
||||
@ stub RpcMgmtInqParameter # win9x
|
||||
@ stub RpcMgmtInqServerPrincNameA
|
||||
@ stub RpcMgmtInqServerPrincNameW
|
||||
@ stub RpcMgmtInqStats
|
||||
@ stdcall RpcMgmtIsServerListening(ptr)
|
||||
@ stub RpcMgmtSetAuthorizationFn
|
||||
@ stdcall RpcMgmtSetCancelTimeout(long)
|
||||
@ stdcall RpcMgmtSetComTimeout(ptr long)
|
||||
@ stub RpcMgmtSetParameter # win9x
|
||||
@ stdcall RpcMgmtSetServerStackSize(long)
|
||||
@ stub RpcMgmtStatsVectorFree
|
||||
@ stdcall RpcMgmtStopServerListening(ptr)
|
||||
@ stdcall RpcMgmtWaitServerListen()
|
||||
@ stub RpcNetworkInqProtseqsA
|
||||
@ stub RpcNetworkInqProtseqsW
|
||||
@ stdcall RpcNetworkIsProtseqValidA(ptr)
|
||||
@ stdcall RpcNetworkIsProtseqValidW(ptr)
|
||||
@ stub RpcNsBindingInqEntryNameA
|
||||
@ stub RpcNsBindingInqEntryNameW
|
||||
@ stub RpcObjectInqType
|
||||
@ stub RpcObjectSetInqFn
|
||||
@ stdcall RpcObjectSetType(ptr ptr)
|
||||
@ stub RpcProtseqVectorFreeA
|
||||
@ stub RpcProtseqVectorFreeW
|
||||
@ stdcall RpcRaiseException(long)
|
||||
@ stub RpcRegisterAsyncInfo
|
||||
@ stdcall RpcRevertToSelf()
|
||||
@ stdcall RpcRevertToSelfEx(ptr)
|
||||
@ stdcall RpcServerInqBindings(ptr)
|
||||
@ stub RpcServerInqCallAttributesA # wxp
|
||||
@ stub RpcServerInqCallAttributesW # wxp
|
||||
@ stub RpcServerInqDefaultPrincNameA
|
||||
@ stub RpcServerInqDefaultPrincNameW
|
||||
@ stub RpcServerInqIf
|
||||
@ stdcall RpcServerListen(long long long)
|
||||
@ stdcall RpcServerRegisterAuthInfoA(str long ptr ptr)
|
||||
@ stdcall RpcServerRegisterAuthInfoW(wstr long ptr ptr)
|
||||
@ stdcall RpcServerRegisterIf2(ptr ptr ptr long long long ptr)
|
||||
@ stdcall RpcServerRegisterIf(ptr ptr ptr)
|
||||
@ stdcall RpcServerRegisterIfEx(ptr ptr ptr long long ptr)
|
||||
@ stub RpcServerTestCancel
|
||||
@ stdcall RpcServerUnregisterIf(ptr ptr long)
|
||||
@ stdcall RpcServerUnregisterIfEx(ptr ptr long)
|
||||
@ stub RpcServerUseAllProtseqs
|
||||
@ stub RpcServerUseAllProtseqsEx
|
||||
@ stub RpcServerUseAllProtseqsIf
|
||||
@ stub RpcServerUseAllProtseqsIfEx
|
||||
@ stdcall RpcServerUseProtseqA(str long ptr)
|
||||
@ stdcall RpcServerUseProtseqEpA(str long str ptr)
|
||||
@ stdcall RpcServerUseProtseqEpExA(str long str ptr ptr)
|
||||
@ stdcall RpcServerUseProtseqEpExW(wstr long wstr ptr ptr)
|
||||
@ stdcall RpcServerUseProtseqEpW(wstr long wstr ptr)
|
||||
@ stub RpcServerUseProtseqExA
|
||||
@ stub RpcServerUseProtseqExW
|
||||
@ stub RpcServerUseProtseqIfA
|
||||
@ stub RpcServerUseProtseqIfExA
|
||||
@ stub RpcServerUseProtseqIfExW
|
||||
@ stub RpcServerUseProtseqIfW
|
||||
@ stdcall RpcServerUseProtseqW(wstr long ptr)
|
||||
@ stub RpcServerYield
|
||||
@ stub RpcSmAllocate
|
||||
@ stub RpcSmClientFree
|
||||
@ stdcall RpcSmDestroyClientContext(ptr)
|
||||
@ stub RpcSmDisableAllocate
|
||||
@ stub RpcSmEnableAllocate
|
||||
@ stub RpcSmFree
|
||||
@ stub RpcSmGetThreadHandle
|
||||
@ stub RpcSmSetClientAllocFree
|
||||
@ stub RpcSmSetThreadHandle
|
||||
@ stub RpcSmSwapClientAllocFree
|
||||
@ stub RpcSsAllocate
|
||||
@ stub RpcSsContextLockExclusive # wxp
|
||||
@ stub RpcSsContextLockShared # wxp
|
||||
@ stdcall RpcSsDestroyClientContext(ptr)
|
||||
@ stub RpcSsDisableAllocate
|
||||
@ stub RpcSsDontSerializeContext
|
||||
@ stub RpcSsEnableAllocate
|
||||
@ stub RpcSsFree
|
||||
@ stub RpcSsGetContextBinding
|
||||
@ stub RpcSsGetThreadHandle
|
||||
@ stub RpcSsSetClientAllocFree
|
||||
@ stub RpcSsSetThreadHandle
|
||||
@ stub RpcSsSwapClientAllocFree
|
||||
@ stdcall RpcStringBindingComposeA(str str str str str ptr)
|
||||
@ stdcall RpcStringBindingComposeW(wstr wstr wstr wstr wstr ptr)
|
||||
@ stdcall RpcStringBindingParseA(str ptr ptr ptr ptr ptr)
|
||||
@ stdcall RpcStringBindingParseW(wstr ptr ptr ptr ptr ptr)
|
||||
@ stdcall RpcStringFreeA(ptr)
|
||||
@ stdcall RpcStringFreeW(ptr)
|
||||
@ stub RpcTestCancel
|
||||
@ stub RpcUserFree # wxp
|
||||
@ stub SimpleTypeAlignment # wxp
|
||||
@ stub SimpleTypeBufferSize # wxp
|
||||
@ stub SimpleTypeMemorySize # wxp
|
||||
@ stub StartServiceIfNecessary # win9x
|
||||
@ stdcall TowerConstruct(ptr ptr ptr ptr ptr ptr)
|
||||
@ stdcall TowerExplode(ptr ptr ptr ptr ptr ptr)
|
||||
@ stdcall UuidCompare(ptr ptr ptr)
|
||||
@ stdcall UuidCreate(ptr)
|
||||
@ stdcall UuidCreateNil(ptr)
|
||||
@ stdcall UuidCreateSequential(ptr) # win 2000
|
||||
@ stdcall UuidEqual(ptr ptr ptr)
|
||||
@ stdcall UuidFromStringA(str ptr)
|
||||
@ stdcall UuidFromStringW(wstr ptr)
|
||||
@ stdcall UuidHash(ptr ptr)
|
||||
@ stdcall UuidIsNil(ptr ptr)
|
||||
@ stdcall UuidToStringA(ptr ptr)
|
||||
@ stdcall UuidToStringW(ptr ptr)
|
||||
@ stub char_array_from_ndr
|
||||
@ stub char_from_ndr
|
||||
@ stub data_from_ndr
|
||||
@ stub data_into_ndr
|
||||
@ stub data_size_ndr
|
||||
@ stub double_array_from_ndr
|
||||
@ stub double_from_ndr
|
||||
@ stub enum_from_ndr
|
||||
@ stub float_array_from_ndr
|
||||
@ stub float_from_ndr
|
||||
@ stub long_array_from_ndr
|
||||
@ stub long_from_ndr
|
||||
@ stub long_from_ndr_temp
|
||||
@ stub pfnFreeRoutines # wxp
|
||||
@ stub pfnMarshallRouteines # wxp
|
||||
@ stub pfnSizeRoutines # wxp
|
||||
@ stub pfnUnmarshallRouteines # wxp
|
||||
@ stub short_array_from_ndr
|
||||
@ stub short_from_ndr
|
||||
@ stub short_from_ndr_temp
|
||||
@ stub tree_into_ndr
|
||||
@ stub tree_peek_ndr
|
||||
@ stub tree_size_ndr
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,152 +0,0 @@
|
||||
/*
|
||||
* RPCSS named pipe client implementation
|
||||
*
|
||||
* Copyright (C) 2002 Greg Turner
|
||||
*
|
||||
* 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 <assert.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wine/rpcss_shared.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "rpc_binding.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
|
||||
HANDLE RPCRT4_RpcssNPConnect(void)
|
||||
{
|
||||
HANDLE the_pipe;
|
||||
DWORD dwmode, wait_result;
|
||||
HANDLE master_mutex = RPCRT4_GetMasterMutex();
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
while (TRUE) {
|
||||
|
||||
wait_result = WaitForSingleObject(master_mutex, MASTER_MUTEX_TIMEOUT);
|
||||
switch (wait_result) {
|
||||
case WAIT_ABANDONED:
|
||||
case WAIT_OBJECT_0:
|
||||
break;
|
||||
case WAIT_FAILED:
|
||||
case WAIT_TIMEOUT:
|
||||
default:
|
||||
ERR("This should never happen: couldn't enter mutex.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* try to open the client side of the named pipe. */
|
||||
the_pipe = CreateFileA(
|
||||
NAME_RPCSS_NAMED_PIPE, /* pipe name */
|
||||
GENERIC_READ | GENERIC_WRITE, /* r/w access */
|
||||
0, /* no sharing */
|
||||
NULL, /* no security attributes */
|
||||
OPEN_EXISTING, /* open an existing pipe */
|
||||
0, /* default attributes */
|
||||
NULL /* no template file */
|
||||
);
|
||||
|
||||
if (the_pipe != INVALID_HANDLE_VALUE)
|
||||
break;
|
||||
|
||||
if (GetLastError() != ERROR_PIPE_BUSY) {
|
||||
WARN("Unable to open named pipe %s (assuming unavailable).\n",
|
||||
debugstr_a(NAME_RPCSS_NAMED_PIPE));
|
||||
break;
|
||||
}
|
||||
|
||||
WARN("Named pipe busy (will wait)\n");
|
||||
|
||||
if (!ReleaseMutex(master_mutex))
|
||||
ERR("Failed to release master mutex. Expect deadlock.\n");
|
||||
|
||||
/* wait for the named pipe. We are only willing to wait for 5 seconds.
|
||||
It should be available /very/ soon. */
|
||||
if (! WaitNamedPipeA(NAME_RPCSS_NAMED_PIPE, MASTER_MUTEX_WAITNAMEDPIPE_TIMEOUT))
|
||||
{
|
||||
ERR("Named pipe unavailable after waiting. Something is probably wrong.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (the_pipe != INVALID_HANDLE_VALUE) {
|
||||
dwmode = PIPE_READMODE_MESSAGE;
|
||||
/* SetNamedPipeHandleState not implemented ATM, but still seems to work somehow. */
|
||||
if (! SetNamedPipeHandleState(the_pipe, &dwmode, NULL, NULL))
|
||||
WARN("Failed to set pipe handle state\n");
|
||||
}
|
||||
|
||||
if (!ReleaseMutex(master_mutex))
|
||||
ERR("Uh oh, failed to leave the RPC Master Mutex!\n");
|
||||
|
||||
return the_pipe;
|
||||
}
|
||||
|
||||
BOOL RPCRT4_SendReceiveNPMsg(HANDLE np, PRPCSS_NP_MESSAGE msg, char *vardata, PRPCSS_NP_REPLY reply)
|
||||
{
|
||||
DWORD count;
|
||||
UINT32 payload_offset;
|
||||
RPCSS_NP_MESSAGE vardata_payload_msg;
|
||||
|
||||
TRACE("(np == %p, msg == %p, vardata == %p, reply == %p)\n",
|
||||
np, msg, vardata, reply);
|
||||
|
||||
if (! WriteFile(np, msg, sizeof(RPCSS_NP_MESSAGE), &count, NULL)) {
|
||||
ERR("write failed.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (count != sizeof(RPCSS_NP_MESSAGE)) {
|
||||
ERR("write count mismatch.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* process the vardata payload if necessary */
|
||||
vardata_payload_msg.message_type = RPCSS_NP_MESSAGE_TYPEID_VARDATAPAYLOADMSG;
|
||||
vardata_payload_msg.vardata_payload_size = 0; /* meaningless */
|
||||
for ( payload_offset = 0; payload_offset < msg->vardata_payload_size;
|
||||
payload_offset += VARDATA_PAYLOAD_BYTES ) {
|
||||
TRACE("sending vardata payload. vd=%p, po=%d, ps=%d\n", vardata,
|
||||
payload_offset, msg->vardata_payload_size);
|
||||
ZeroMemory(vardata_payload_msg.message.vardatapayloadmsg.payload, VARDATA_PAYLOAD_BYTES);
|
||||
CopyMemory(vardata_payload_msg.message.vardatapayloadmsg.payload,
|
||||
vardata,
|
||||
min( VARDATA_PAYLOAD_BYTES, msg->vardata_payload_size - payload_offset ));
|
||||
vardata += VARDATA_PAYLOAD_BYTES;
|
||||
if (! WriteFile(np, &vardata_payload_msg, sizeof(RPCSS_NP_MESSAGE), &count, NULL)) {
|
||||
ERR("vardata write failed at %u bytes.\n", payload_offset);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (! ReadFile(np, reply, sizeof(RPCSS_NP_REPLY), &count, NULL)) {
|
||||
ERR("read failed.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (count != sizeof(RPCSS_NP_REPLY)) {
|
||||
ERR("read count mismatch. got %d.\n", count);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* message execution was successful */
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2002 Greg Turner
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __WINE_RPCSS_NP_CLIENT_H
|
||||
#define __WINE_RPCSS_NP_CLIENT_H
|
||||
|
||||
/* rpcss_np_client.c */
|
||||
HANDLE RPC_RpcssNPConnect(void);
|
||||
BOOL RPCRT4_SendReceiveNPMsg(HANDLE, PRPCSS_NP_MESSAGE, char *, PRPCSS_NP_REPLY);
|
||||
|
||||
#endif /* __RPCSS_NP_CLINET_H */
|
||||
@@ -61,7 +61,7 @@ extern HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid,
|
||||
|
||||
typedef struct ConnectionPoint ConnectionPoint;
|
||||
|
||||
typedef struct {
|
||||
struct WebBrowser {
|
||||
/* Interfaces available via WebBrowser object */
|
||||
|
||||
const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
|
||||
@@ -115,7 +115,7 @@ typedef struct {
|
||||
ConnectionPoint *cp_wbe2;
|
||||
ConnectionPoint *cp_wbe;
|
||||
ConnectionPoint *cp_pns;
|
||||
} WebBrowser;
|
||||
};
|
||||
|
||||
#define WEBBROWSER(x) ((IWebBrowser*) &(x)->lpWebBrowser2Vtbl)
|
||||
#define WEBBROWSER2(x) ((IWebBrowser2*) &(x)->lpWebBrowser2Vtbl)
|
||||
|
||||
@@ -1,298 +0,0 @@
|
||||
ChangeLog
|
||||
|
||||
2007-05-17 ekohl
|
||||
|
||||
tools/widl/lex.yy.c
|
||||
tools/widl/parser.l
|
||||
tools/widl/typelib.c
|
||||
|
||||
- Update wpp and fix the wpp_find_include issue!
|
||||
|
||||
|
||||
2006-07-30 ekohl
|
||||
|
||||
- Synchronized with WINE widl 20060729.
|
||||
|
||||
The only difference is one call to wpp_find_include in parser.l.
|
||||
We'll need to fix this issue!
|
||||
|
||||
|
||||
2006-02-27 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
- Dereference type declarations properly.
|
||||
|
||||
2006-02-27 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
- Move proc string offset calculation to a separate function.
|
||||
- Replace all __FUNCTION__ by __FILE__.
|
||||
|
||||
2006-01-01 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
- Generate static MIDL_PROC_FORMAT_STRING, MIDL_TYPE_FORMAT_STRING and
|
||||
MIDL_STUB_DESC variables.
|
||||
|
||||
2005-12-05 ekohl
|
||||
|
||||
tools/widl/widl.c
|
||||
tools/widl/widl.man
|
||||
|
||||
- Change oldnames option from '-o' to '--oldnames'.
|
||||
|
||||
2005-11-26 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
- Allocate another 4 bytes for unique pointers to simple types.
|
||||
|
||||
2005-10-16 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
- Fix [out, size_is, unique] parameter issues.
|
||||
|
||||
2005-10-09 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
- Support [out, unique] base type parameters.
|
||||
|
||||
2005-08-07 ekohl
|
||||
|
||||
tools/widl/server.c
|
||||
|
||||
- Support size_is(*Length) attributes for strings.
|
||||
|
||||
2005-07-30 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
- Support conformant arrays as in and out parameters.
|
||||
- Fix message buffer size calculation for client and server.
|
||||
|
||||
2005-07-25 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/lex.yy.c
|
||||
tools/widl/parser.y
|
||||
tools/widl/proxy.c
|
||||
tools/widl/server.c
|
||||
tools/widl/y.tab.c
|
||||
tools/widl/y.tab.h
|
||||
|
||||
- Fix grammar of the size_is attribute so that size_is(*Length) gets accepted.
|
||||
|
||||
2005-07-23 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
- Fix offset calculation bug in the ProcFormatString.
|
||||
- Fix offset calculation bug in the marshalling and unmarshalling code.
|
||||
- Fix typos in the TypeFormatString.
|
||||
This makes the [string, out, size_is()] parameters work properly.
|
||||
|
||||
2005-07-17 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
Fix bugs for in-string parameters.
|
||||
Implement out-string parameters (untested).
|
||||
|
||||
2005-05-08 weiden
|
||||
|
||||
tools/widl/server.c
|
||||
|
||||
Don't generate lvalue assignment code.
|
||||
|
||||
2005-05-08 weiden
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/proxy.c
|
||||
tools/widl/server.c
|
||||
|
||||
Generate code GCC4.x accepts.
|
||||
|
||||
2005-04-18 navaraf
|
||||
|
||||
tools/widl/parser.y
|
||||
|
||||
Don't use pointer to freed memory.
|
||||
|
||||
2005-04-17 ekohl
|
||||
|
||||
tools/widl/server.c
|
||||
|
||||
Support out-pointers to structs.
|
||||
|
||||
2005-04-15 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/parser.y
|
||||
tools/widl/server.c
|
||||
|
||||
Support in-pointers to structs.
|
||||
|
||||
2005-04-03 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/parser.l
|
||||
tools/widl/parser.y
|
||||
tools/widl/server.c
|
||||
tools/widl/widltypes.h
|
||||
|
||||
Support 'ref' and 'unique' attributes for pointers.
|
||||
|
||||
2005-03-27 Jacek Caban (from WINE)
|
||||
|
||||
tools/widl/parser.y
|
||||
tools/widl/y.tab.c
|
||||
|
||||
Added handling of unsigned type
|
||||
|
||||
2005-03-25 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
Generate code without L-value casts. Fix remaining issues.
|
||||
|
||||
2005-03-21 navaraf
|
||||
|
||||
tools/widl/client.c
|
||||
|
||||
Fix a typo in write_function_stubs.
|
||||
|
||||
2005-03-20 navaraf
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
Generate code without L-value casts.
|
||||
|
||||
2005-03-20 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
Improve error messages.
|
||||
Don't start counting the type_offset for each new fuction. It is a global offset.
|
||||
Use only basic types in type- and proc-strings (e.g. unsigned long -> long).
|
||||
|
||||
|
||||
2005-03-13 ekohl
|
||||
|
||||
tools/widl/server.c
|
||||
|
||||
Remove debug printf().
|
||||
|
||||
|
||||
2005-03-13 jimtabor
|
||||
|
||||
tools/widl/write_msft.c
|
||||
|
||||
Fixup *nix port, added include fcntl.h and unistd.h.
|
||||
|
||||
|
||||
2005-03-13 royce3
|
||||
|
||||
tools/widl/hash.c
|
||||
tools/widl/Makefile
|
||||
tools/widl/write_msft.c
|
||||
|
||||
-Wall -Werror and fix warnings
|
||||
|
||||
|
||||
2005-03-13 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
Implement [string] attribute for pointers to char and wchar_t.
|
||||
|
||||
|
||||
2005-03-12 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/server.c
|
||||
|
||||
Implement [in], [out] and [in, out] support for pointers to basic types.
|
||||
|
||||
|
||||
2005-03-10 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/header.c
|
||||
tools/widl/server.c
|
||||
tools/widl/widl.c
|
||||
tools/widl/widl.h
|
||||
|
||||
Implement '-o' option. This is equivalent to MIDLs '/oldnames' option.
|
||||
|
||||
|
||||
2005-03-06 ekohl
|
||||
|
||||
tools/widl/client.c
|
||||
tools/widl/header.c
|
||||
tools/widl/header.h
|
||||
tools/widl/server.c
|
||||
|
||||
Support pointers to simple types as input arguments.
|
||||
|
||||
|
||||
2005-02-27 sedwards
|
||||
|
||||
tools/widl/y.tab.c
|
||||
tools/widl/parser.y
|
||||
tools/widl/widl.c
|
||||
tools/widl/widl.h
|
||||
tools/widl/server.c
|
||||
tools/widl/typelib.c
|
||||
|
||||
Merge in Winehq changes to reduce noise.
|
||||
|
||||
tools/widl/server.h
|
||||
tools/widl/client.h
|
||||
tools/widl/proxy.h
|
||||
|
||||
Deleted unneeded headers.
|
||||
|
||||
2005-02-26 ekohl
|
||||
tools/widl/server.c
|
||||
|
||||
Server stubs are void functions.
|
||||
Fix a warning in the server stub descriptor.
|
||||
|
||||
|
||||
2005-02-25 ekohl
|
||||
tools/widl/client.c
|
||||
tools/widl/header.c
|
||||
tools/widl/header.h
|
||||
tools/widl/server.c
|
||||
|
||||
Support multiple interfaces per idl file.
|
||||
Support explicit binding handles.
|
||||
|
||||
|
||||
2005-02-24 ekohl
|
||||
include/wine/rpcfc.h
|
||||
tools/widl/client.c
|
||||
tools/widl/header.c
|
||||
tools/widl/parser.l
|
||||
tools/widl/parser.y
|
||||
tools/widl/server.c
|
||||
|
||||
Support remaining basic types (float, double, small, wchar_t and handle_t).
|
||||
@@ -1,53 +0,0 @@
|
||||
TOPSRCDIR = @top_srcdir@
|
||||
TOPOBJDIR = ../..
|
||||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
EXEEXT = @EXEEXT@
|
||||
|
||||
PROGRAMS = widl$(EXEEXT)
|
||||
MANPAGES = widl.man
|
||||
MODULE = none
|
||||
|
||||
C_SRCS = \
|
||||
client.c \
|
||||
hash.c \
|
||||
header.c \
|
||||
proxy.c \
|
||||
server.c \
|
||||
typegen.c \
|
||||
typelib.c \
|
||||
utils.c \
|
||||
widl.c \
|
||||
write_msft.c
|
||||
|
||||
EXTRA_SRCS = parser.y parser.l
|
||||
EXTRA_OBJS = parser.tab.o @[email protected]
|
||||
|
||||
all: $(PROGRAMS) $(MANPAGES)
|
||||
|
||||
@MAKE_RULES@
|
||||
|
||||
widl$(EXEEXT): $(OBJS) $(LIBWPP)
|
||||
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBWPP) $(LIBPORT) $(LEXLIB) $(LDFLAGS)
|
||||
|
||||
parser.tab.c parser.tab.h: parser.y
|
||||
$(BISON) -d -t $(SRCDIR)/parser.y -o parser.tab.c
|
||||
|
||||
# hack to allow parallel make
|
||||
parser.tab.h: parser.tab.c
|
||||
parser.tab.o: parser.tab.h
|
||||
|
||||
@[email protected]: parser.l
|
||||
$(LEX) $(SRCDIR)/parser.l
|
||||
|
||||
@[email protected]: parser.tab.h
|
||||
|
||||
install:: $(PROGRAMS) $(MANPAGES)
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man$(prog_manext)
|
||||
$(INSTALL_PROGRAM) widl$(EXEEXT) $(DESTDIR)$(bindir)/widl$(EXEEXT)
|
||||
$(INSTALL_DATA) widl.man $(DESTDIR)$(mandir)/man$(prog_manext)/widl.$(prog_manext)
|
||||
|
||||
uninstall::
|
||||
$(RM) $(DESTDIR)$(bindir)/widl$(EXEEXT) $(DESTDIR)$(mandir)/man$(prog_manext)/widl.$(prog_manext)
|
||||
|
||||
### Dependencies:
|
||||
+77
-154
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -34,98 +34,57 @@
|
||||
#include "parser.h"
|
||||
#include "header.h"
|
||||
|
||||
#include <host/typedefs.h>
|
||||
|
||||
#include "widltypes.h"
|
||||
#include "typelib.h"
|
||||
#include "typelib_struct.h"
|
||||
#include "typegen.h"
|
||||
|
||||
static FILE* client;
|
||||
static int indent = 0;
|
||||
|
||||
static int print_client( const char *format, ... )
|
||||
static void print_client( const char *format, ... )
|
||||
{
|
||||
va_list va;
|
||||
int i, r;
|
||||
|
||||
va_start(va, format);
|
||||
for (i = 0; i < indent; i++)
|
||||
fprintf(client, " ");
|
||||
r = vfprintf(client, format, va);
|
||||
print(client, indent, format, va);
|
||||
va_end(va);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
static void print_message_buffer_size(const func_t *func)
|
||||
{
|
||||
unsigned int total_size = 0;
|
||||
|
||||
if (func->args)
|
||||
{
|
||||
const var_t *var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
unsigned int alignment;
|
||||
|
||||
total_size += get_required_buffer_size(var, &alignment, PASS_IN);
|
||||
total_size += alignment;
|
||||
|
||||
var = PREV_LINK(var);
|
||||
}
|
||||
}
|
||||
fprintf(client, " %u", total_size);
|
||||
}
|
||||
|
||||
static void check_pointers(const func_t *func)
|
||||
{
|
||||
var_t *var;
|
||||
int pointer_type;
|
||||
const var_t *var;
|
||||
|
||||
if (!func->args)
|
||||
return;
|
||||
|
||||
var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||
{
|
||||
pointer_type = get_attrv(var->attrs, ATTR_POINTERTYPE);
|
||||
if (!pointer_type)
|
||||
pointer_type = RPC_FC_RP;
|
||||
|
||||
if (pointer_type == RPC_FC_RP)
|
||||
if (is_var_ptr(var) && cant_be_null(var))
|
||||
{
|
||||
if (var->ptr_level >= 1)
|
||||
{
|
||||
print_client("if (!%s)\n", var->name);
|
||||
print_client("{\n");
|
||||
indent++;
|
||||
print_client("RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
|
||||
indent--;
|
||||
print_client("}\n\n");
|
||||
}
|
||||
print_client("if (!%s)\n", var->name);
|
||||
print_client("{\n");
|
||||
indent++;
|
||||
print_client("RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
|
||||
indent--;
|
||||
print_client("}\n\n");
|
||||
}
|
||||
|
||||
var = PREV_LINK(var);
|
||||
}
|
||||
}
|
||||
|
||||
static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsigned int *type_offset)
|
||||
static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
||||
{
|
||||
const func_t *func = iface->funcs;
|
||||
const func_t *func;
|
||||
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
|
||||
var_t *var;
|
||||
const var_t *var;
|
||||
int method_count = 0;
|
||||
|
||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||
while (func)
|
||||
if (!implicit_handle)
|
||||
print_client("static RPC_BINDING_HANDLE %s__MIDL_AutoBindHandle;\n\n", iface->name);
|
||||
|
||||
if (iface->funcs) LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
|
||||
{
|
||||
const var_t *def = func->def;
|
||||
const var_t* explicit_handle_var;
|
||||
unsigned int type_offset_func;
|
||||
|
||||
/* check for a defined binding handle */
|
||||
explicit_handle_var = get_explicit_handle_var(func);
|
||||
@@ -146,9 +105,10 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
}
|
||||
}
|
||||
|
||||
write_type(client, def->type, def, def->tname);
|
||||
fprintf(client, " ");
|
||||
write_name(client, def);
|
||||
write_type_decl_left(client, def->type);
|
||||
if (needs_space_after(def->type))
|
||||
fprintf(client, " ");
|
||||
write_prefix_name(client, prefix_client, def);
|
||||
fprintf(client, "(\n");
|
||||
indent++;
|
||||
if (func->args)
|
||||
@@ -163,10 +123,10 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
indent++;
|
||||
|
||||
/* declare return value '_RetVal' */
|
||||
if (!is_void(def->type, NULL))
|
||||
if (!is_void(def->type))
|
||||
{
|
||||
print_client("");
|
||||
write_type(client, def->type, def, def->tname);
|
||||
write_type_decl_left(client, def->type);
|
||||
fprintf(client, " _RetVal;\n");
|
||||
}
|
||||
|
||||
@@ -175,6 +135,11 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
|
||||
print_client("RPC_MESSAGE _RpcMessage;\n");
|
||||
print_client("MIDL_STUB_MESSAGE _StubMsg;\n");
|
||||
if (!is_void(def->type) && decl_indirect(def->type))
|
||||
{
|
||||
print_client("void *_p_%s = &%s;\n",
|
||||
"_RetVal", "_RetVal");
|
||||
}
|
||||
fprintf(client, "\n");
|
||||
|
||||
/* check pointers */
|
||||
@@ -204,13 +169,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
|
||||
/* emit the message buffer size */
|
||||
print_client("_StubMsg.BufferLength =");
|
||||
print_message_buffer_size(func);
|
||||
fprintf(client, ";\n");
|
||||
|
||||
type_offset_func = *type_offset;
|
||||
write_remoting_arguments(client, indent, func, &type_offset_func, PASS_IN, PHASE_BUFFERSIZE);
|
||||
write_remoting_arguments(client, indent, func, PASS_IN, PHASE_BUFFERSIZE);
|
||||
|
||||
print_client("NdrGetBuffer(\n");
|
||||
indent++;
|
||||
@@ -223,12 +182,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
indent--;
|
||||
fprintf(client, "\n");
|
||||
|
||||
|
||||
/* make a copy so we don't increment the type offset twice */
|
||||
type_offset_func = *type_offset;
|
||||
|
||||
/* marshal arguments */
|
||||
write_remoting_arguments(client, indent, func, &type_offset_func, PASS_IN, PHASE_MARSHAL);
|
||||
write_remoting_arguments(client, indent, func, PASS_IN, PHASE_MARSHAL);
|
||||
|
||||
/* send/receive message */
|
||||
/* print_client("NdrNsSendReceive(\n"); */
|
||||
@@ -258,24 +213,25 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
|
||||
/* unmarshall arguments */
|
||||
fprintf(client, "\n");
|
||||
write_remoting_arguments(client, indent, func, type_offset, PASS_OUT, PHASE_UNMARSHAL);
|
||||
write_remoting_arguments(client, indent, func, PASS_OUT, PHASE_UNMARSHAL);
|
||||
|
||||
/* unmarshal return value */
|
||||
if (!is_void(def->type, NULL))
|
||||
print_phase_basetype(client, indent, PHASE_UNMARSHAL, PASS_RETURN, def, "_RetVal");
|
||||
if (!is_void(def->type))
|
||||
{
|
||||
if (decl_indirect(def->type))
|
||||
print_client("MIDL_memset(&%s, 0, sizeof(%s));\n", "_RetVal", "_RetVal");
|
||||
else if (is_ptr(def->type) || is_array(def->type))
|
||||
print_client("%s = 0;\n", "_RetVal");
|
||||
write_remoting_arguments(client, indent, func, PASS_RETURN, PHASE_UNMARSHAL);
|
||||
}
|
||||
|
||||
/* update proc_offset */
|
||||
if (func->args)
|
||||
{
|
||||
var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||
*proc_offset += get_size_procformatstring_var(var);
|
||||
var = PREV_LINK(var);
|
||||
}
|
||||
}
|
||||
if (!is_void(def->type, NULL))
|
||||
if (!is_void(def->type))
|
||||
*proc_offset += get_size_procformatstring_var(def);
|
||||
else
|
||||
*proc_offset += 2; /* FC_END and FC_PAD */
|
||||
@@ -297,7 +253,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
|
||||
|
||||
/* emit return code */
|
||||
if (!is_void(def->type, NULL))
|
||||
if (!is_void(def->type))
|
||||
{
|
||||
fprintf(client, "\n");
|
||||
print_client("return _RetVal;\n");
|
||||
@@ -308,18 +264,10 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
fprintf(client, "\n");
|
||||
|
||||
method_count++;
|
||||
func = PREV_LINK(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void write_bindinghandledecl(type_t *iface)
|
||||
{
|
||||
print_client("static RPC_BINDING_HANDLE %s__MIDL_AutoBindHandle;\n", iface->name);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
|
||||
|
||||
static void write_stubdescdecl(type_t *iface)
|
||||
{
|
||||
print_client("static const MIDL_STUB_DESC %s_StubDesc;\n", iface->name);
|
||||
@@ -358,7 +306,7 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines)
|
||||
print_client("0,\n");
|
||||
print_client("0x50100a4, /* MIDL Version 5.1.164 */\n");
|
||||
print_client("0,\n");
|
||||
print_client("0,\n");
|
||||
print_client("%s,\n", list_empty(&user_type_list) ? "0" : "UserMarshalRoutines");
|
||||
print_client("0, /* notify & notify_flag routine table */\n");
|
||||
print_client("1, /* Flags */\n");
|
||||
print_client("0, /* Reserved3 */\n");
|
||||
@@ -374,6 +322,9 @@ static void write_clientinterfacedecl(type_t *iface)
|
||||
{
|
||||
unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION);
|
||||
const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
|
||||
const str_list_t *endpoints = get_attrp(iface->attrs, ATTR_ENDPOINT);
|
||||
|
||||
if (endpoints) write_endpoints( client, iface->name, endpoints );
|
||||
|
||||
print_client("static const RPC_CLIENT_INTERFACE %s___RpcClientInterface =\n", iface->name );
|
||||
print_client("{\n");
|
||||
@@ -382,11 +333,19 @@ static void write_clientinterfacedecl(type_t *iface)
|
||||
print_client("{{0x%08lx,0x%04x,0x%04x,{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x}},{%d,%d}},\n",
|
||||
uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1],
|
||||
uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5], uuid->Data4[6],
|
||||
uuid->Data4[7], LOWORD(ver), HIWORD(ver));
|
||||
uuid->Data4[7], MAJORVERSION(ver), MINORVERSION(ver));
|
||||
print_client("{{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},\n"); /* FIXME */
|
||||
print_client("0,\n");
|
||||
print_client("0,\n");
|
||||
print_client("0,\n");
|
||||
if (endpoints)
|
||||
{
|
||||
print_client("%u,\n", list_count(endpoints));
|
||||
print_client("(PRPC_PROTSEQ_ENDPOINT)%s__RpcProtseqEndpoint,\n", iface->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_client("0,\n");
|
||||
print_client("0,\n");
|
||||
}
|
||||
print_client("0,\n");
|
||||
print_client("0,\n");
|
||||
print_client("0,\n");
|
||||
@@ -396,43 +355,12 @@ static void write_clientinterfacedecl(type_t *iface)
|
||||
print_client("RPC_IF_HANDLE %s_ClientIfHandle = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
|
||||
iface->name, iface->name);
|
||||
else
|
||||
print_client("RPC_IF_HANDLE %s_v%d_%d_c_ifspec = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
|
||||
iface->name, LOWORD(ver), HIWORD(ver), iface->name);
|
||||
print_client("RPC_IF_HANDLE %s%s_v%d_%d_c_ifspec = (RPC_IF_HANDLE)& %s___RpcClientInterface;\n",
|
||||
prefix_client, iface->name, MAJORVERSION(ver), MINORVERSION(ver), iface->name);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
|
||||
|
||||
static void write_formatdesc( const char *str )
|
||||
{
|
||||
print_client("typedef struct _MIDL_%s_FORMAT_STRING\n", str );
|
||||
print_client("{\n");
|
||||
indent++;
|
||||
print_client("short Pad;\n");
|
||||
print_client("unsigned char Format[%s_FORMAT_STRING_SIZE];\n", str);
|
||||
indent--;
|
||||
print_client("} MIDL_%s_FORMAT_STRING;\n", str);
|
||||
print_client("\n");
|
||||
}
|
||||
|
||||
|
||||
static void write_formatstringsdecl(ifref_t *ifaces)
|
||||
{
|
||||
print_client("#define TYPE_FORMAT_STRING_SIZE %d\n",
|
||||
get_size_typeformatstring(ifaces));
|
||||
|
||||
print_client("#define PROC_FORMAT_STRING_SIZE %d\n",
|
||||
get_size_procformatstring(ifaces));
|
||||
|
||||
fprintf(client, "\n");
|
||||
write_formatdesc("TYPE");
|
||||
write_formatdesc("PROC");
|
||||
fprintf(client, "\n");
|
||||
print_client("static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;\n");
|
||||
print_client("static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;\n");
|
||||
print_client("\n");
|
||||
}
|
||||
|
||||
|
||||
static void write_implicithandledecl(type_t *iface)
|
||||
{
|
||||
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||
@@ -451,7 +379,7 @@ static void init_client(void)
|
||||
if (!(client = fopen(client_name, "w")))
|
||||
error("Could not open %s for output\n", client_name);
|
||||
|
||||
print_client("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", WIDL_FULLVERSION, input_name);
|
||||
print_client("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
|
||||
print_client("#include <string.h>\n");
|
||||
print_client("#ifdef _ALPHA_\n");
|
||||
print_client("#include <stdarg.h>\n");
|
||||
@@ -462,27 +390,30 @@ static void init_client(void)
|
||||
}
|
||||
|
||||
|
||||
void write_client(ifref_t *ifaces)
|
||||
void write_client(ifref_list_t *ifaces)
|
||||
{
|
||||
unsigned int proc_offset = 0;
|
||||
unsigned int type_offset = 2;
|
||||
ifref_t *iface = ifaces;
|
||||
int expr_eval_routines;
|
||||
ifref_t *iface;
|
||||
|
||||
if (!do_client)
|
||||
return;
|
||||
if (!iface)
|
||||
if (do_everything && !need_stub_files(ifaces))
|
||||
return;
|
||||
END_OF_LIST(iface);
|
||||
|
||||
init_client();
|
||||
if (!client)
|
||||
return;
|
||||
|
||||
write_formatstringsdecl(ifaces);
|
||||
write_formatstringsdecl(client, indent, ifaces, need_stub);
|
||||
expr_eval_routines = write_expr_eval_routines(client, client_token);
|
||||
if (expr_eval_routines)
|
||||
write_expr_eval_routine_list(client, client_token);
|
||||
write_user_quad_list(client);
|
||||
|
||||
for (; iface; iface = PREV_LINK(iface))
|
||||
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, ifref_t, entry )
|
||||
{
|
||||
if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
|
||||
if (!need_stub(iface->iface))
|
||||
continue;
|
||||
|
||||
fprintf(client, "/*****************************************************************************\n");
|
||||
@@ -492,33 +423,25 @@ void write_client(ifref_t *ifaces)
|
||||
|
||||
if (iface->iface->funcs)
|
||||
{
|
||||
int expr_eval_routines;
|
||||
|
||||
write_implicithandledecl(iface->iface);
|
||||
|
||||
|
||||
write_clientinterfacedecl(iface->iface);
|
||||
write_stubdescdecl(iface->iface);
|
||||
write_bindinghandledecl(iface->iface);
|
||||
|
||||
write_function_stubs(iface->iface, &proc_offset, &type_offset);
|
||||
write_function_stubs(iface->iface, &proc_offset);
|
||||
|
||||
print_client("#if !defined(__RPC_WIN32__)\n");
|
||||
print_client("#error Invalid build platform for this stub.\n");
|
||||
print_client("#endif\n");
|
||||
|
||||
fprintf(client, "\n");
|
||||
|
||||
expr_eval_routines = write_expr_eval_routines(client, iface->iface->name);
|
||||
if (expr_eval_routines)
|
||||
write_expr_eval_routine_list(client, iface->iface->name);
|
||||
write_stubdescriptor(iface->iface, expr_eval_routines);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(client, "\n");
|
||||
|
||||
write_procformatstring(client, ifaces);
|
||||
write_typeformatstring(client, ifaces);
|
||||
write_procformatstring(client, ifaces, need_stub);
|
||||
write_typeformatstring(client, ifaces, need_stub);
|
||||
|
||||
fclose(client);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <host/nls.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
|
||||
#include "hash.h"
|
||||
|
||||
static const unsigned char Lookup_16[128 * 3] = {
|
||||
@@ -511,7 +514,7 @@ unsigned long lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr)
|
||||
switch (PRIMARYLANGID(LANGIDFROMLCID(lcid)))
|
||||
{
|
||||
default:
|
||||
fprintf(stderr, "Unknown lcid %lx, treating as latin-based, please report\n", lcid);
|
||||
fprintf(stderr, "Unknown lcid %x, treating as latin-based, please report\n", lcid);
|
||||
/* .. Fall Through .. */
|
||||
case LANG_AFRIKAANS: case LANG_ALBANIAN: case LANG_ARMENIAN:
|
||||
case LANG_ASSAMESE: case LANG_AZERI: case LANG_BASQUE:
|
||||
@@ -532,6 +535,7 @@ unsigned long lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr)
|
||||
case LANG_SWEDISH: case LANG_SYRIAC: case LANG_TAMIL:
|
||||
case LANG_TATAR: case LANG_TELUGU: case LANG_THAI:
|
||||
case LANG_UKRAINIAN: case LANG_URDU: case LANG_UZBEK:
|
||||
#ifndef __REACTOS__
|
||||
case LANG_VIETNAMESE: case LANG_GAELIC: case LANG_MALTESE:
|
||||
case LANG_TAJIK: case LANG_ROMANSH: case LANG_IRISH:
|
||||
case LANG_SAMI: case LANG_UPPER_SORBIAN: case LANG_SUTU:
|
||||
@@ -539,6 +543,12 @@ unsigned long lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr)
|
||||
case LANG_XHOSA: case LANG_ZULU: case LANG_ESPERANTO:
|
||||
case LANG_WALON: case LANG_CORNISH: case LANG_WELSH:
|
||||
case LANG_BRETON:
|
||||
#else
|
||||
case LANG_VIETNAMESE: case LANG_MALTESE: case LANG_IRISH:
|
||||
case LANG_SAMI: case LANG_UPPER_SORBIAN: case LANG_TSWANA:
|
||||
case LANG_XHOSA: case LANG_ZULU: case LANG_WELSH:
|
||||
case LANG_BRETON:
|
||||
#endif
|
||||
nOffset = 16;
|
||||
pnLookup = Lookup_16;
|
||||
break;
|
||||
@@ -602,13 +612,7 @@ unsigned long lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr)
|
||||
|
||||
while (*str)
|
||||
{
|
||||
ULONG newLoWord = 0, i;
|
||||
|
||||
/* Cumulative prime multiplication (*37) with modulo 2^32 wrap-around */
|
||||
for (i = 0; i < 37; i++)
|
||||
newLoWord += nLoWord;
|
||||
|
||||
nLoWord = newLoWord + pnLookup[*str > 0x7f && nMask ? *str + 0x80 : *str];
|
||||
nLoWord = 37 * nLoWord + pnLookup[*str > 0x7f && nMask ? *str + 0x80 : *str];
|
||||
str++;
|
||||
}
|
||||
/* Constrain to a prime modulo and sizeof(WORD) */
|
||||
|
||||
+365
-345
File diff suppressed because it is too large
Load Diff
+49
-18
@@ -21,42 +21,73 @@
|
||||
#ifndef __WIDL_HEADER_H
|
||||
#define __WIDL_HEADER_H
|
||||
|
||||
extern int is_attr(const attr_t *a, enum attr_type t);
|
||||
extern void *get_attrp(const attr_t *a, enum attr_type t);
|
||||
extern unsigned long get_attrv(const attr_t *a, enum attr_type t);
|
||||
extern int is_void(const type_t *t, const var_t *v);
|
||||
#include "widltypes.h"
|
||||
|
||||
extern int is_ptrchain_attr(const var_t *var, enum attr_type t);
|
||||
extern int is_attr(const attr_list_t *list, enum attr_type t);
|
||||
extern void *get_attrp(const attr_list_t *list, enum attr_type t);
|
||||
extern unsigned long get_attrv(const attr_list_t *list, enum attr_type t);
|
||||
extern int is_void(const type_t *t);
|
||||
extern int is_conformant_array(const type_t *t);
|
||||
extern int is_declptr(const type_t *t);
|
||||
extern void write_name(FILE *h, const var_t *v);
|
||||
extern void write_prefix_name(FILE *h, const char *prefix, const var_t *v);
|
||||
extern const char* get_name(const var_t *v);
|
||||
extern void write_type(FILE *h, type_t *t, const var_t *v, const char *n);
|
||||
extern int is_object(const attr_t *a);
|
||||
extern int is_local(const attr_t *a);
|
||||
extern const var_t *is_callas(const attr_t *a);
|
||||
extern void write_args(FILE *h, var_t *arg, const char *name, int obj, int do_indent);
|
||||
extern void write_array(FILE *h, const expr_t *v, int field);
|
||||
extern void write_type_left(FILE *h, type_t *t, int declonly);
|
||||
extern void write_type_right(FILE *h, type_t *t, int is_field);
|
||||
extern void write_type_def_or_decl(FILE *h, type_t *t, int is_field, const char *fmt, ...);
|
||||
extern void write_type_decl(FILE *f, type_t *t, const char *fmt, ...);
|
||||
extern void write_type_decl_left(FILE *f, type_t *t);
|
||||
extern int needs_space_after(type_t *t);
|
||||
extern int is_object(const attr_list_t *list);
|
||||
extern int is_local(const attr_list_t *list);
|
||||
extern int need_stub(const type_t *iface);
|
||||
extern int need_proxy(const type_t *iface);
|
||||
extern int need_stub_files(const ifref_list_t *ifaces);
|
||||
extern int need_proxy_file(const ifref_list_t *ifaces);
|
||||
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_forward(type_t *iface);
|
||||
extern void write_interface(type_t *iface);
|
||||
extern void write_dispinterface(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, const var_t *names);
|
||||
extern void write_typedef(type_t *type);
|
||||
extern void write_expr(FILE *h, const expr_t *e, int brackets);
|
||||
extern void write_constdef(const var_t *v);
|
||||
extern void write_externdef(const var_t *v);
|
||||
extern void write_library(const char *name, const attr_t *attr);
|
||||
extern void write_library(const char *name, const attr_list_t *attr);
|
||||
extern void write_user_types(void);
|
||||
extern void write_context_handle_rundowns(void);
|
||||
extern const var_t* get_explicit_handle_var(const func_t* func);
|
||||
extern int has_out_arg_or_return(const func_t *func);
|
||||
extern void write_guid(FILE *f, const char *guid_prefix, const char *name,
|
||||
const UUID *uuid);
|
||||
|
||||
static inline int is_string_type(const attr_t *attrs, int ptr_level, const expr_t *array)
|
||||
static inline int last_ptr(const type_t *type)
|
||||
{
|
||||
return (is_attr(attrs, ATTR_STRING) &&
|
||||
((ptr_level == 1 && !array) || (ptr_level == 0 && array)));
|
||||
return is_ptr(type) && !is_declptr(type->ref);
|
||||
}
|
||||
|
||||
static inline int is_array_type(const attr_t *attrs, int ptr_level, const expr_t *array)
|
||||
static inline int last_array(const type_t *type)
|
||||
{
|
||||
return ((ptr_level == 1 && !array && is_attr(attrs, ATTR_SIZEIS)) ||
|
||||
(ptr_level == 0 && array));
|
||||
return is_array(type) && !is_array(type->ref);
|
||||
}
|
||||
|
||||
static inline int is_string_type(const attr_list_t *attrs, const type_t *type)
|
||||
{
|
||||
return is_attr(attrs, ATTR_STRING) && (last_ptr(type) || last_array(type));
|
||||
}
|
||||
|
||||
static inline int is_context_handle(const type_t *type)
|
||||
{
|
||||
const type_t *t;
|
||||
for (t = type; is_ptr(t); t = t->ref)
|
||||
if (is_attr(t->attrs, ATTR_CONTEXTHANDLE))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -21,14 +21,20 @@
|
||||
#ifndef __WIDL_PARSER_H
|
||||
#define __WIDL_PARSER_H
|
||||
|
||||
int yyparse(void);
|
||||
typedef struct
|
||||
{
|
||||
type_t *interface;
|
||||
unsigned char old_pointer_default;
|
||||
} interface_info_t;
|
||||
|
||||
extern FILE *yyin;
|
||||
extern char *yytext;
|
||||
extern int yydebug;
|
||||
int parser_parse(void);
|
||||
|
||||
extern FILE *parser_in;
|
||||
extern char *parser_text;
|
||||
extern int parser_debug;
|
||||
extern int yy_flex_debug;
|
||||
|
||||
int yylex(void);
|
||||
int parser_lex(void);
|
||||
|
||||
extern int import_stack_ptr;
|
||||
int do_import(char *fname);
|
||||
|
||||
+135
-135
@@ -20,7 +20,7 @@
|
||||
|
||||
%option stack
|
||||
%option nounput noyy_top_state
|
||||
%option 8bit never-interactive
|
||||
%option 8bit never-interactive prefix="parser_"
|
||||
|
||||
nl \r?\n
|
||||
ws [ \f\t\r]
|
||||
@@ -29,9 +29,11 @@ int [0-9]+
|
||||
hexd [0-9a-fA-F]
|
||||
hex 0x{hexd}+
|
||||
uuid {hexd}{8}-{hexd}{4}-{hexd}{4}-{hexd}{4}-{hexd}{12}
|
||||
double [0-9]+\.[0-9]+([eE][+-]?[0-9]+)*
|
||||
|
||||
%x QUOTE
|
||||
%x pp_line
|
||||
%x ATTR
|
||||
%x PP_LINE
|
||||
|
||||
%{
|
||||
|
||||
@@ -63,6 +65,7 @@ static int cbufidx;
|
||||
static int cbufalloc = 0;
|
||||
|
||||
static int kw_token(const char *kw);
|
||||
static int attr_token(const char *kw);
|
||||
|
||||
#define MAX_IMPORT_DEPTH 10
|
||||
struct {
|
||||
@@ -75,7 +78,7 @@ int import_stack_ptr = 0;
|
||||
|
||||
static void pop_import(void);
|
||||
|
||||
static UUID* parse_uuid(const char*u)
|
||||
UUID *parse_uuid(const char *u)
|
||||
{
|
||||
UUID* uuid = xmalloc(sizeof(UUID));
|
||||
char b[3];
|
||||
@@ -103,55 +106,62 @@ static UUID* parse_uuid(const char*u)
|
||||
**************************************************************************
|
||||
*/
|
||||
%%
|
||||
<INITIAL>^{ws}*\#{ws}* yy_push_state(pp_line);
|
||||
<pp_line>[^\n]* {
|
||||
<INITIAL,ATTR>^{ws}*\#{ws}* yy_push_state(PP_LINE);
|
||||
<PP_LINE>[^\n]* {
|
||||
int lineno;
|
||||
char *cptr, *fname;
|
||||
yy_pop_state();
|
||||
lineno = (int)strtol(yytext, &cptr, 10);
|
||||
if(!lineno)
|
||||
yyerror("Malformed '#...' line-directive; invalid linenumber");
|
||||
error_loc("Malformed '#...' line-directive; invalid linenumber\n");
|
||||
fname = strchr(cptr, '"');
|
||||
if(!fname)
|
||||
yyerror("Malformed '#...' line-directive; missing filename");
|
||||
error_loc("Malformed '#...' line-directive; missing filename\n");
|
||||
fname++;
|
||||
cptr = strchr(fname, '"');
|
||||
if(!cptr)
|
||||
yyerror("Malformed '#...' line-directive; missing terminating \"");
|
||||
error_loc("Malformed '#...' line-directive; missing terminating \"\n");
|
||||
*cptr = '\0';
|
||||
line_number = lineno - 1; /* We didn't read the newline */
|
||||
free( input_name );
|
||||
input_name = xstrdup(fname);
|
||||
}
|
||||
\" yy_push_state(QUOTE); cbufidx = 0;
|
||||
<INITIAL,ATTR>\" yy_push_state(QUOTE); cbufidx = 0;
|
||||
<QUOTE>\" {
|
||||
yy_pop_state();
|
||||
yylval.str = get_buffered_cstring();
|
||||
parser_lval.str = get_buffered_cstring();
|
||||
return aSTRING;
|
||||
}
|
||||
<QUOTE>\\\\ |
|
||||
<QUOTE>\\\" addcchar(yytext[1]);
|
||||
<QUOTE>\\. addcchar('\\'); addcchar(yytext[1]);
|
||||
<QUOTE>. addcchar(yytext[0]);
|
||||
{uuid} {
|
||||
yylval.uuid = parse_uuid(yytext);
|
||||
<INITIAL,ATTR>\[ yy_push_state(ATTR); return '[';
|
||||
<ATTR>\] yy_pop_state(); return ']';
|
||||
<ATTR>{cident} return attr_token(yytext);
|
||||
<ATTR>{uuid} {
|
||||
parser_lval.uuid = parse_uuid(yytext);
|
||||
return aUUID;
|
||||
}
|
||||
{hex} {
|
||||
yylval.num = strtoul(yytext, NULL, 0);
|
||||
<INITIAL,ATTR>{hex} {
|
||||
parser_lval.num = strtoul(yytext, NULL, 0);
|
||||
return aHEXNUM;
|
||||
}
|
||||
{int} {
|
||||
yylval.num = strtoul(yytext, NULL, 0);
|
||||
<INITIAL,ATTR>{int} {
|
||||
parser_lval.num = strtoul(yytext, NULL, 0);
|
||||
return aNUM;
|
||||
}
|
||||
<INITIAL>{double} {
|
||||
parser_lval.dbl = strtod(yytext, NULL);
|
||||
return aDOUBLE;
|
||||
}
|
||||
SAFEARRAY{ws}*/\( return tSAFEARRAY;
|
||||
{cident} return kw_token(yytext);
|
||||
\n line_number++;
|
||||
{ws}
|
||||
\<\< return SHL;
|
||||
\>\> return SHR;
|
||||
. return yytext[0];
|
||||
<INITIAL,ATTR>\n line_number++;
|
||||
<INITIAL,ATTR>{ws}
|
||||
<INITIAL,ATTR>\<\< return SHL;
|
||||
<INITIAL,ATTR>\>\> return SHR;
|
||||
<INITIAL,ATTR>. return yytext[0];
|
||||
<<EOF>> {
|
||||
if (import_stack_ptr) {
|
||||
pop_import();
|
||||
@@ -161,36 +171,27 @@ SAFEARRAY{ws}*/\( return tSAFEARRAY;
|
||||
}
|
||||
%%
|
||||
|
||||
#ifndef yywrap
|
||||
int yywrap(void)
|
||||
#ifndef parser_wrap
|
||||
int parser_wrap(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct keyword {
|
||||
struct keyword {
|
||||
const char *kw;
|
||||
int token;
|
||||
int val;
|
||||
} keywords[] = {
|
||||
};
|
||||
|
||||
static const struct keyword keywords[] = {
|
||||
{"FALSE", tFALSE},
|
||||
{"TRUE", tTRUE},
|
||||
{"__cdecl", tCDECL},
|
||||
{"__int64", tINT64},
|
||||
{"__stdcall", tSTDCALL},
|
||||
{"_stdcall", tSTDCALL},
|
||||
{"aggregatable", tAGGREGATABLE},
|
||||
{"allocate", tALLOCATE},
|
||||
{"appobject", tAPPOBJECT},
|
||||
{"async", tASYNC},
|
||||
{"async_uuid", tASYNCUUID},
|
||||
{"auto_handle", tAUTOHANDLE},
|
||||
{"bindable", tBINDABLE},
|
||||
{"boolean", tBOOLEAN},
|
||||
{"broadcast", tBROADCAST},
|
||||
{"byte", tBYTE},
|
||||
{"byte_count", tBYTECOUNT},
|
||||
{"call_as", tCALLAS},
|
||||
{"callback", tCALLBACK},
|
||||
{"case", tCASE},
|
||||
{"char", tCHAR},
|
||||
@@ -198,121 +199,119 @@ static struct keyword {
|
||||
{"code", tCODE},
|
||||
{"comm_status", tCOMMSTATUS},
|
||||
{"const", tCONST},
|
||||
{"context_handle", tCONTEXTHANDLE},
|
||||
{"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE},
|
||||
{"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE},
|
||||
{"control", tCONTROL},
|
||||
{"cpp_quote", tCPPQUOTE},
|
||||
/* ... */
|
||||
{"default", tDEFAULT},
|
||||
{"defaultcollelem", tDEFAULTCOLLELEM},
|
||||
{"defaultvalue", tDEFAULTVALUE},
|
||||
{"defaultvtable", tDEFAULTVTABLE},
|
||||
{"dispinterface", tDISPINTERFACE},
|
||||
{"displaybind", tDISPLAYBIND},
|
||||
{"dllname", tDLLNAME},
|
||||
{"double", tDOUBLE},
|
||||
{"dual", tDUAL},
|
||||
{"endpoint", tENDPOINT},
|
||||
{"entry", tENTRY},
|
||||
{"enum", tENUM},
|
||||
{"error_status_t", tERRORSTATUST},
|
||||
{"explicit_handle", tEXPLICITHANDLE},
|
||||
{"extern", tEXTERN},
|
||||
{"float", tFLOAT},
|
||||
{"handle", tHANDLE},
|
||||
{"handle_t", tHANDLET},
|
||||
{"helpcontext", tHELPCONTEXT},
|
||||
{"helpfile", tHELPFILE},
|
||||
{"helpstring", tHELPSTRING},
|
||||
{"helpstringcontext", tHELPSTRINGCONTEXT},
|
||||
{"helpstringdll", tHELPSTRINGDLL},
|
||||
{"hidden", tHIDDEN},
|
||||
{"hyper", tHYPER},
|
||||
{"id", tID},
|
||||
{"idempotent", tIDEMPOTENT},
|
||||
/* ... */
|
||||
{"iid_is", tIIDIS},
|
||||
{"immediatebind", tIMMEDIATEBIND},
|
||||
{"implicit_handle", tIMPLICITHANDLE},
|
||||
{"import", tIMPORT},
|
||||
{"importlib", tIMPORTLIB},
|
||||
{"in", tIN},
|
||||
{"in_line", tINLINE},
|
||||
{"input_sync", tINPUTSYNC},
|
||||
{"int", tINT},
|
||||
/* ... */
|
||||
{"interface", tINTERFACE},
|
||||
{"lcid", tLCID},
|
||||
{"length_is", tLENGTHIS},
|
||||
{"library", tLIBRARY},
|
||||
/* ... */
|
||||
{"local", tLOCAL},
|
||||
{"long", tLONG},
|
||||
/* ... */
|
||||
{"methods", tMETHODS},
|
||||
/* ... */
|
||||
{"module", tMODULE},
|
||||
/* ... */
|
||||
{"nonbrowsable", tNONBROWSABLE},
|
||||
{"noncreatable", tNONCREATABLE},
|
||||
{"nonextensible", tNONEXTENSIBLE},
|
||||
{"object", tOBJECT},
|
||||
{"odl", tODL},
|
||||
{"oleautomation", tOLEAUTOMATION},
|
||||
/* ... */
|
||||
{"optional", tOPTIONAL},
|
||||
{"out", tOUT},
|
||||
/* ... */
|
||||
{"pointer_default", tPOINTERDEFAULT},
|
||||
/* ... */
|
||||
{"properties", tPROPERTIES},
|
||||
{"propget", tPROPGET},
|
||||
{"propput", tPROPPUT},
|
||||
{"propputref", tPROPPUTREF},
|
||||
{"ptr", tPTR},
|
||||
/* ... */
|
||||
{"public", tPUBLIC},
|
||||
{"range", tRANGE},
|
||||
/* ... */
|
||||
{"readonly", tREADONLY},
|
||||
{"ref", tREF},
|
||||
{"requestedit", tREQUESTEDIT},
|
||||
{"restricted", tRESTRICTED},
|
||||
{"retval", tRETVAL},
|
||||
/* ... */
|
||||
{"short", tSHORT},
|
||||
{"signed", tSIGNED},
|
||||
{"single", tSINGLE},
|
||||
{"size_is", tSIZEIS},
|
||||
{"sizeof", tSIZEOF},
|
||||
{"small", tSMALL},
|
||||
/* ... */
|
||||
{"source", tSOURCE},
|
||||
/* ... */
|
||||
{"string", tSTRING},
|
||||
{"struct", tSTRUCT},
|
||||
{"switch", tSWITCH},
|
||||
{"switch_is", tSWITCHIS},
|
||||
{"switch_type", tSWITCHTYPE},
|
||||
/* ... */
|
||||
{"transmit_as", tTRANSMITAS},
|
||||
{"typedef", tTYPEDEF},
|
||||
{"union", tUNION},
|
||||
/* ... */
|
||||
{"unique", tUNIQUE},
|
||||
{"unsigned", tUNSIGNED},
|
||||
/* ... */
|
||||
{"uuid", tUUID},
|
||||
{"v1_enum", tV1ENUM},
|
||||
/* ... */
|
||||
{"vararg", tVARARG},
|
||||
{"version", tVERSION},
|
||||
{"void", tVOID},
|
||||
{"wchar_t", tWCHAR},
|
||||
{"wire_marshal", tWIREMARSHAL},
|
||||
};
|
||||
#define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
|
||||
|
||||
/* keywords only recognized in attribute lists */
|
||||
static const struct keyword attr_keywords[] =
|
||||
{
|
||||
{"aggregatable", tAGGREGATABLE},
|
||||
{"allocate", tALLOCATE},
|
||||
{"appobject", tAPPOBJECT},
|
||||
{"async", tASYNC},
|
||||
{"async_uuid", tASYNCUUID},
|
||||
{"auto_handle", tAUTOHANDLE},
|
||||
{"bindable", tBINDABLE},
|
||||
{"broadcast", tBROADCAST},
|
||||
{"byte_count", tBYTECOUNT},
|
||||
{"call_as", tCALLAS},
|
||||
{"context_handle", tCONTEXTHANDLE},
|
||||
{"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE},
|
||||
{"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE},
|
||||
{"control", tCONTROL},
|
||||
{"defaultcollelem", tDEFAULTCOLLELEM},
|
||||
{"defaultvalue", tDEFAULTVALUE},
|
||||
{"defaultvtable", tDEFAULTVTABLE},
|
||||
{"displaybind", tDISPLAYBIND},
|
||||
{"dllname", tDLLNAME},
|
||||
{"dual", tDUAL},
|
||||
{"endpoint", tENDPOINT},
|
||||
{"entry", tENTRY},
|
||||
{"explicit_handle", tEXPLICITHANDLE},
|
||||
{"handle", tHANDLE},
|
||||
{"helpcontext", tHELPCONTEXT},
|
||||
{"helpfile", tHELPFILE},
|
||||
{"helpstring", tHELPSTRING},
|
||||
{"helpstringcontext", tHELPSTRINGCONTEXT},
|
||||
{"helpstringdll", tHELPSTRINGDLL},
|
||||
{"hidden", tHIDDEN},
|
||||
{"id", tID},
|
||||
{"idempotent", tIDEMPOTENT},
|
||||
{"iid_is", tIIDIS},
|
||||
{"immediatebind", tIMMEDIATEBIND},
|
||||
{"implicit_handle", tIMPLICITHANDLE},
|
||||
{"in", tIN},
|
||||
{"input_sync", tINPUTSYNC},
|
||||
{"lcid", tLCID},
|
||||
{"length_is", tLENGTHIS},
|
||||
{"local", tLOCAL},
|
||||
{"nonbrowsable", tNONBROWSABLE},
|
||||
{"noncreatable", tNONCREATABLE},
|
||||
{"nonextensible", tNONEXTENSIBLE},
|
||||
{"object", tOBJECT},
|
||||
{"odl", tODL},
|
||||
{"oleautomation", tOLEAUTOMATION},
|
||||
{"optional", tOPTIONAL},
|
||||
{"out", tOUT},
|
||||
{"pointer_default", tPOINTERDEFAULT},
|
||||
{"propget", tPROPGET},
|
||||
{"propput", tPROPPUT},
|
||||
{"propputref", tPROPPUTREF},
|
||||
{"ptr", tPTR},
|
||||
{"public", tPUBLIC},
|
||||
{"range", tRANGE},
|
||||
{"readonly", tREADONLY},
|
||||
{"ref", tREF},
|
||||
{"requestedit", tREQUESTEDIT},
|
||||
{"restricted", tRESTRICTED},
|
||||
{"retval", tRETVAL},
|
||||
{"single", tSINGLE},
|
||||
{"size_is", tSIZEIS},
|
||||
{"source", tSOURCE},
|
||||
{"string", tSTRING},
|
||||
{"switch_is", tSWITCHIS},
|
||||
{"switch_type", tSWITCHTYPE},
|
||||
{"transmit_as", tTRANSMITAS},
|
||||
{"unique", tUNIQUE},
|
||||
{"uuid", tUUID},
|
||||
{"v1_enum", tV1ENUM},
|
||||
{"vararg", tVARARG},
|
||||
{"version", tVERSION},
|
||||
{"wire_marshal", tWIREMARSHAL},
|
||||
};
|
||||
|
||||
|
||||
#define KWP(p) ((const struct keyword *)(p))
|
||||
|
||||
static int kw_cmp_func(const void *s1, const void *s2)
|
||||
@@ -320,31 +319,32 @@ static int kw_cmp_func(const void *s1, const void *s2)
|
||||
return strcmp(KWP(s1)->kw, KWP(s2)->kw);
|
||||
}
|
||||
|
||||
#define KW_BSEARCH
|
||||
static int kw_token(const char *kw)
|
||||
{
|
||||
struct keyword key, *kwp;
|
||||
key.kw = kw;
|
||||
#ifdef KW_BSEARCH
|
||||
kwp = bsearch(&key, keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func);
|
||||
#else
|
||||
{
|
||||
int i;
|
||||
for (kwp=NULL, i=0; i < NKEYWORDS; i++)
|
||||
if (!kw_cmp_func(&key, &keywords[i])) {
|
||||
kwp = &keywords[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (kwp) {
|
||||
yylval.str = (char*)kwp->kw;
|
||||
parser_lval.str = xstrdup(kwp->kw);
|
||||
return kwp->token;
|
||||
}
|
||||
yylval.str = xstrdup(kw);
|
||||
parser_lval.str = xstrdup(kw);
|
||||
return is_type(kw) ? aKNOWNTYPE : aIDENTIFIER;
|
||||
}
|
||||
|
||||
static int attr_token(const char *kw)
|
||||
{
|
||||
struct keyword key, *kwp;
|
||||
key.kw = kw;
|
||||
kwp = bsearch(&key, attr_keywords, sizeof(attr_keywords)/sizeof(attr_keywords[0]),
|
||||
sizeof(attr_keywords[0]), kw_cmp_func);
|
||||
if (kwp) {
|
||||
parser_lval.str = xstrdup(kwp->kw);
|
||||
return kwp->token;
|
||||
}
|
||||
return kw_token(kw);
|
||||
}
|
||||
|
||||
static void addcchar(char c)
|
||||
{
|
||||
if(cbufidx >= cbufalloc)
|
||||
@@ -352,7 +352,7 @@ static void addcchar(char c)
|
||||
cbufalloc += 1024;
|
||||
cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0]));
|
||||
if(cbufalloc > 65536)
|
||||
yywarning("Reallocating string buffer larger than 64kB");
|
||||
parser_warning("Reallocating string buffer larger than 64kB\n");
|
||||
}
|
||||
cbuffer[cbufidx++] = c;
|
||||
}
|
||||
@@ -414,7 +414,7 @@ int do_import(char *fname)
|
||||
first_import = import;
|
||||
|
||||
if (!(path = wpp_find_include( fname, input_name )))
|
||||
yyerror("Unable to open include file %s", fname);
|
||||
error_loc("Unable to open include file %s\n", fname);
|
||||
|
||||
import_stack[ptr].temp_name = temp_name;
|
||||
import_stack[ptr].input_name = input_name;
|
||||
@@ -427,7 +427,7 @@ int do_import(char *fname)
|
||||
if (ret) exit(1);
|
||||
|
||||
if((f = fopen(temp_name, "r")) == NULL)
|
||||
yyerror("Unable to open %s", temp_name);
|
||||
error_loc("Unable to open %s\n", temp_name);
|
||||
|
||||
import_stack[ptr].state = YY_CURRENT_BUFFER;
|
||||
yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE));
|
||||
|
||||
+3120
-2313
File diff suppressed because it is too large
Load Diff
+278
-263
@@ -1,7 +1,7 @@
|
||||
/* A Bison parser, made by GNU Bison 1.875. */
|
||||
/* A Bison parser, made by GNU Bison 2.1. */
|
||||
|
||||
/* Skeleton parser for Yacc-like parsing with Bison,
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -15,8 +15,8 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
@@ -33,292 +33,307 @@
|
||||
aKNOWNTYPE = 259,
|
||||
aNUM = 260,
|
||||
aHEXNUM = 261,
|
||||
aSTRING = 262,
|
||||
aUUID = 263,
|
||||
aEOF = 264,
|
||||
SHL = 265,
|
||||
SHR = 266,
|
||||
tAGGREGATABLE = 267,
|
||||
tALLOCATE = 268,
|
||||
tAPPOBJECT = 269,
|
||||
tASYNC = 270,
|
||||
tASYNCUUID = 271,
|
||||
tAUTOHANDLE = 272,
|
||||
tBINDABLE = 273,
|
||||
tBOOLEAN = 274,
|
||||
tBROADCAST = 275,
|
||||
tBYTE = 276,
|
||||
tBYTECOUNT = 277,
|
||||
tCALLAS = 278,
|
||||
tCALLBACK = 279,
|
||||
tCASE = 280,
|
||||
tCDECL = 281,
|
||||
tCHAR = 282,
|
||||
tCOCLASS = 283,
|
||||
tCODE = 284,
|
||||
tCOMMSTATUS = 285,
|
||||
tCONST = 286,
|
||||
tCONTEXTHANDLE = 287,
|
||||
tCONTEXTHANDLENOSERIALIZE = 288,
|
||||
tCONTEXTHANDLESERIALIZE = 289,
|
||||
tCONTROL = 290,
|
||||
tCPPQUOTE = 291,
|
||||
tDEFAULT = 292,
|
||||
tDEFAULTCOLLELEM = 293,
|
||||
tDEFAULTVALUE = 294,
|
||||
tDEFAULTVTABLE = 295,
|
||||
tDISPLAYBIND = 296,
|
||||
tDISPINTERFACE = 297,
|
||||
tDLLNAME = 298,
|
||||
tDOUBLE = 299,
|
||||
tDUAL = 300,
|
||||
tENDPOINT = 301,
|
||||
tENTRY = 302,
|
||||
tENUM = 303,
|
||||
tERRORSTATUST = 304,
|
||||
tEXPLICITHANDLE = 305,
|
||||
tEXTERN = 306,
|
||||
tFALSE = 307,
|
||||
tFLOAT = 308,
|
||||
tHANDLE = 309,
|
||||
tHANDLET = 310,
|
||||
tHELPCONTEXT = 311,
|
||||
tHELPFILE = 312,
|
||||
tHELPSTRING = 313,
|
||||
tHELPSTRINGCONTEXT = 314,
|
||||
tHELPSTRINGDLL = 315,
|
||||
tHIDDEN = 316,
|
||||
tHYPER = 317,
|
||||
tID = 318,
|
||||
tIDEMPOTENT = 319,
|
||||
tIIDIS = 320,
|
||||
tIMMEDIATEBIND = 321,
|
||||
tIMPLICITHANDLE = 322,
|
||||
tIMPORT = 323,
|
||||
tIMPORTLIB = 324,
|
||||
tIN = 325,
|
||||
tINLINE = 326,
|
||||
tINPUTSYNC = 327,
|
||||
tINT = 328,
|
||||
tINT64 = 329,
|
||||
tINTERFACE = 330,
|
||||
tLCID = 331,
|
||||
tLENGTHIS = 332,
|
||||
tLIBRARY = 333,
|
||||
tLOCAL = 334,
|
||||
tLONG = 335,
|
||||
tMETHODS = 336,
|
||||
tMODULE = 337,
|
||||
tNONBROWSABLE = 338,
|
||||
tNONCREATABLE = 339,
|
||||
tNONEXTENSIBLE = 340,
|
||||
tOBJECT = 341,
|
||||
tODL = 342,
|
||||
tOLEAUTOMATION = 343,
|
||||
tOPTIONAL = 344,
|
||||
tOUT = 345,
|
||||
tPOINTERDEFAULT = 346,
|
||||
tPROPERTIES = 347,
|
||||
tPROPGET = 348,
|
||||
tPROPPUT = 349,
|
||||
tPROPPUTREF = 350,
|
||||
tPTR = 351,
|
||||
tPUBLIC = 352,
|
||||
tRANGE = 353,
|
||||
tREADONLY = 354,
|
||||
tREF = 355,
|
||||
tREQUESTEDIT = 356,
|
||||
tRESTRICTED = 357,
|
||||
tRETVAL = 358,
|
||||
tSAFEARRAY = 359,
|
||||
tSHORT = 360,
|
||||
tSIGNED = 361,
|
||||
tSINGLE = 362,
|
||||
tSIZEIS = 363,
|
||||
tSIZEOF = 364,
|
||||
tSMALL = 365,
|
||||
tSOURCE = 366,
|
||||
tSTDCALL = 367,
|
||||
tSTRING = 368,
|
||||
tSTRUCT = 369,
|
||||
tSWITCH = 370,
|
||||
tSWITCHIS = 371,
|
||||
tSWITCHTYPE = 372,
|
||||
tTRANSMITAS = 373,
|
||||
tTRUE = 374,
|
||||
tTYPEDEF = 375,
|
||||
tUNION = 376,
|
||||
tUNIQUE = 377,
|
||||
tUNSIGNED = 378,
|
||||
tUUID = 379,
|
||||
tV1ENUM = 380,
|
||||
tVARARG = 381,
|
||||
tVERSION = 382,
|
||||
tVOID = 383,
|
||||
tWCHAR = 384,
|
||||
tWIREMARSHAL = 385,
|
||||
CAST = 386,
|
||||
PPTR = 387,
|
||||
NEG = 388
|
||||
aDOUBLE = 262,
|
||||
aSTRING = 263,
|
||||
aUUID = 264,
|
||||
aEOF = 265,
|
||||
SHL = 266,
|
||||
SHR = 267,
|
||||
tAGGREGATABLE = 268,
|
||||
tALLOCATE = 269,
|
||||
tAPPOBJECT = 270,
|
||||
tASYNC = 271,
|
||||
tASYNCUUID = 272,
|
||||
tAUTOHANDLE = 273,
|
||||
tBINDABLE = 274,
|
||||
tBOOLEAN = 275,
|
||||
tBROADCAST = 276,
|
||||
tBYTE = 277,
|
||||
tBYTECOUNT = 278,
|
||||
tCALLAS = 279,
|
||||
tCALLBACK = 280,
|
||||
tCASE = 281,
|
||||
tCDECL = 282,
|
||||
tCHAR = 283,
|
||||
tCOCLASS = 284,
|
||||
tCODE = 285,
|
||||
tCOMMSTATUS = 286,
|
||||
tCONST = 287,
|
||||
tCONTEXTHANDLE = 288,
|
||||
tCONTEXTHANDLENOSERIALIZE = 289,
|
||||
tCONTEXTHANDLESERIALIZE = 290,
|
||||
tCONTROL = 291,
|
||||
tCPPQUOTE = 292,
|
||||
tDEFAULT = 293,
|
||||
tDEFAULTCOLLELEM = 294,
|
||||
tDEFAULTVALUE = 295,
|
||||
tDEFAULTVTABLE = 296,
|
||||
tDISPLAYBIND = 297,
|
||||
tDISPINTERFACE = 298,
|
||||
tDLLNAME = 299,
|
||||
tDOUBLE = 300,
|
||||
tDUAL = 301,
|
||||
tENDPOINT = 302,
|
||||
tENTRY = 303,
|
||||
tENUM = 304,
|
||||
tERRORSTATUST = 305,
|
||||
tEXPLICITHANDLE = 306,
|
||||
tEXTERN = 307,
|
||||
tFALSE = 308,
|
||||
tFLOAT = 309,
|
||||
tHANDLE = 310,
|
||||
tHANDLET = 311,
|
||||
tHELPCONTEXT = 312,
|
||||
tHELPFILE = 313,
|
||||
tHELPSTRING = 314,
|
||||
tHELPSTRINGCONTEXT = 315,
|
||||
tHELPSTRINGDLL = 316,
|
||||
tHIDDEN = 317,
|
||||
tHYPER = 318,
|
||||
tID = 319,
|
||||
tIDEMPOTENT = 320,
|
||||
tIIDIS = 321,
|
||||
tIMMEDIATEBIND = 322,
|
||||
tIMPLICITHANDLE = 323,
|
||||
tIMPORT = 324,
|
||||
tIMPORTLIB = 325,
|
||||
tIN = 326,
|
||||
tINLINE = 327,
|
||||
tINPUTSYNC = 328,
|
||||
tINT = 329,
|
||||
tINT64 = 330,
|
||||
tINTERFACE = 331,
|
||||
tLCID = 332,
|
||||
tLENGTHIS = 333,
|
||||
tLIBRARY = 334,
|
||||
tLOCAL = 335,
|
||||
tLONG = 336,
|
||||
tMETHODS = 337,
|
||||
tMODULE = 338,
|
||||
tNONBROWSABLE = 339,
|
||||
tNONCREATABLE = 340,
|
||||
tNONEXTENSIBLE = 341,
|
||||
tOBJECT = 342,
|
||||
tODL = 343,
|
||||
tOLEAUTOMATION = 344,
|
||||
tOPTIONAL = 345,
|
||||
tOUT = 346,
|
||||
tPOINTERDEFAULT = 347,
|
||||
tPROPERTIES = 348,
|
||||
tPROPGET = 349,
|
||||
tPROPPUT = 350,
|
||||
tPROPPUTREF = 351,
|
||||
tPTR = 352,
|
||||
tPUBLIC = 353,
|
||||
tRANGE = 354,
|
||||
tREADONLY = 355,
|
||||
tREF = 356,
|
||||
tREQUESTEDIT = 357,
|
||||
tRESTRICTED = 358,
|
||||
tRETVAL = 359,
|
||||
tSAFEARRAY = 360,
|
||||
tSHORT = 361,
|
||||
tSIGNED = 362,
|
||||
tSINGLE = 363,
|
||||
tSIZEIS = 364,
|
||||
tSIZEOF = 365,
|
||||
tSMALL = 366,
|
||||
tSOURCE = 367,
|
||||
tSTDCALL = 368,
|
||||
tSTRING = 369,
|
||||
tSTRUCT = 370,
|
||||
tSWITCH = 371,
|
||||
tSWITCHIS = 372,
|
||||
tSWITCHTYPE = 373,
|
||||
tTRANSMITAS = 374,
|
||||
tTRUE = 375,
|
||||
tTYPEDEF = 376,
|
||||
tUNION = 377,
|
||||
tUNIQUE = 378,
|
||||
tUNSIGNED = 379,
|
||||
tUUID = 380,
|
||||
tV1ENUM = 381,
|
||||
tVARARG = 382,
|
||||
tVERSION = 383,
|
||||
tVOID = 384,
|
||||
tWCHAR = 385,
|
||||
tWIREMARSHAL = 386,
|
||||
CAST = 387,
|
||||
PPTR = 388,
|
||||
NEG = 389,
|
||||
ADDRESSOF = 390
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define aIDENTIFIER 258
|
||||
#define aKNOWNTYPE 259
|
||||
#define aNUM 260
|
||||
#define aHEXNUM 261
|
||||
#define aSTRING 262
|
||||
#define aUUID 263
|
||||
#define aEOF 264
|
||||
#define SHL 265
|
||||
#define SHR 266
|
||||
#define tAGGREGATABLE 267
|
||||
#define tALLOCATE 268
|
||||
#define tAPPOBJECT 269
|
||||
#define tASYNC 270
|
||||
#define tASYNCUUID 271
|
||||
#define tAUTOHANDLE 272
|
||||
#define tBINDABLE 273
|
||||
#define tBOOLEAN 274
|
||||
#define tBROADCAST 275
|
||||
#define tBYTE 276
|
||||
#define tBYTECOUNT 277
|
||||
#define tCALLAS 278
|
||||
#define tCALLBACK 279
|
||||
#define tCASE 280
|
||||
#define tCDECL 281
|
||||
#define tCHAR 282
|
||||
#define tCOCLASS 283
|
||||
#define tCODE 284
|
||||
#define tCOMMSTATUS 285
|
||||
#define tCONST 286
|
||||
#define tCONTEXTHANDLE 287
|
||||
#define tCONTEXTHANDLENOSERIALIZE 288
|
||||
#define tCONTEXTHANDLESERIALIZE 289
|
||||
#define tCONTROL 290
|
||||
#define tCPPQUOTE 291
|
||||
#define tDEFAULT 292
|
||||
#define tDEFAULTCOLLELEM 293
|
||||
#define tDEFAULTVALUE 294
|
||||
#define tDEFAULTVTABLE 295
|
||||
#define tDISPLAYBIND 296
|
||||
#define tDISPINTERFACE 297
|
||||
#define tDLLNAME 298
|
||||
#define tDOUBLE 299
|
||||
#define tDUAL 300
|
||||
#define tENDPOINT 301
|
||||
#define tENTRY 302
|
||||
#define tENUM 303
|
||||
#define tERRORSTATUST 304
|
||||
#define tEXPLICITHANDLE 305
|
||||
#define tEXTERN 306
|
||||
#define tFALSE 307
|
||||
#define tFLOAT 308
|
||||
#define tHANDLE 309
|
||||
#define tHANDLET 310
|
||||
#define tHELPCONTEXT 311
|
||||
#define tHELPFILE 312
|
||||
#define tHELPSTRING 313
|
||||
#define tHELPSTRINGCONTEXT 314
|
||||
#define tHELPSTRINGDLL 315
|
||||
#define tHIDDEN 316
|
||||
#define tHYPER 317
|
||||
#define tID 318
|
||||
#define tIDEMPOTENT 319
|
||||
#define tIIDIS 320
|
||||
#define tIMMEDIATEBIND 321
|
||||
#define tIMPLICITHANDLE 322
|
||||
#define tIMPORT 323
|
||||
#define tIMPORTLIB 324
|
||||
#define tIN 325
|
||||
#define tINLINE 326
|
||||
#define tINPUTSYNC 327
|
||||
#define tINT 328
|
||||
#define tINT64 329
|
||||
#define tINTERFACE 330
|
||||
#define tLCID 331
|
||||
#define tLENGTHIS 332
|
||||
#define tLIBRARY 333
|
||||
#define tLOCAL 334
|
||||
#define tLONG 335
|
||||
#define tMETHODS 336
|
||||
#define tMODULE 337
|
||||
#define tNONBROWSABLE 338
|
||||
#define tNONCREATABLE 339
|
||||
#define tNONEXTENSIBLE 340
|
||||
#define tOBJECT 341
|
||||
#define tODL 342
|
||||
#define tOLEAUTOMATION 343
|
||||
#define tOPTIONAL 344
|
||||
#define tOUT 345
|
||||
#define tPOINTERDEFAULT 346
|
||||
#define tPROPERTIES 347
|
||||
#define tPROPGET 348
|
||||
#define tPROPPUT 349
|
||||
#define tPROPPUTREF 350
|
||||
#define tPTR 351
|
||||
#define tPUBLIC 352
|
||||
#define tRANGE 353
|
||||
#define tREADONLY 354
|
||||
#define tREF 355
|
||||
#define tREQUESTEDIT 356
|
||||
#define tRESTRICTED 357
|
||||
#define tRETVAL 358
|
||||
#define tSAFEARRAY 359
|
||||
#define tSHORT 360
|
||||
#define tSIGNED 361
|
||||
#define tSINGLE 362
|
||||
#define tSIZEIS 363
|
||||
#define tSIZEOF 364
|
||||
#define tSMALL 365
|
||||
#define tSOURCE 366
|
||||
#define tSTDCALL 367
|
||||
#define tSTRING 368
|
||||
#define tSTRUCT 369
|
||||
#define tSWITCH 370
|
||||
#define tSWITCHIS 371
|
||||
#define tSWITCHTYPE 372
|
||||
#define tTRANSMITAS 373
|
||||
#define tTRUE 374
|
||||
#define tTYPEDEF 375
|
||||
#define tUNION 376
|
||||
#define tUNIQUE 377
|
||||
#define tUNSIGNED 378
|
||||
#define tUUID 379
|
||||
#define tV1ENUM 380
|
||||
#define tVARARG 381
|
||||
#define tVERSION 382
|
||||
#define tVOID 383
|
||||
#define tWCHAR 384
|
||||
#define tWIREMARSHAL 385
|
||||
#define CAST 386
|
||||
#define PPTR 387
|
||||
#define NEG 388
|
||||
#define aDOUBLE 262
|
||||
#define aSTRING 263
|
||||
#define aUUID 264
|
||||
#define aEOF 265
|
||||
#define SHL 266
|
||||
#define SHR 267
|
||||
#define tAGGREGATABLE 268
|
||||
#define tALLOCATE 269
|
||||
#define tAPPOBJECT 270
|
||||
#define tASYNC 271
|
||||
#define tASYNCUUID 272
|
||||
#define tAUTOHANDLE 273
|
||||
#define tBINDABLE 274
|
||||
#define tBOOLEAN 275
|
||||
#define tBROADCAST 276
|
||||
#define tBYTE 277
|
||||
#define tBYTECOUNT 278
|
||||
#define tCALLAS 279
|
||||
#define tCALLBACK 280
|
||||
#define tCASE 281
|
||||
#define tCDECL 282
|
||||
#define tCHAR 283
|
||||
#define tCOCLASS 284
|
||||
#define tCODE 285
|
||||
#define tCOMMSTATUS 286
|
||||
#define tCONST 287
|
||||
#define tCONTEXTHANDLE 288
|
||||
#define tCONTEXTHANDLENOSERIALIZE 289
|
||||
#define tCONTEXTHANDLESERIALIZE 290
|
||||
#define tCONTROL 291
|
||||
#define tCPPQUOTE 292
|
||||
#define tDEFAULT 293
|
||||
#define tDEFAULTCOLLELEM 294
|
||||
#define tDEFAULTVALUE 295
|
||||
#define tDEFAULTVTABLE 296
|
||||
#define tDISPLAYBIND 297
|
||||
#define tDISPINTERFACE 298
|
||||
#define tDLLNAME 299
|
||||
#define tDOUBLE 300
|
||||
#define tDUAL 301
|
||||
#define tENDPOINT 302
|
||||
#define tENTRY 303
|
||||
#define tENUM 304
|
||||
#define tERRORSTATUST 305
|
||||
#define tEXPLICITHANDLE 306
|
||||
#define tEXTERN 307
|
||||
#define tFALSE 308
|
||||
#define tFLOAT 309
|
||||
#define tHANDLE 310
|
||||
#define tHANDLET 311
|
||||
#define tHELPCONTEXT 312
|
||||
#define tHELPFILE 313
|
||||
#define tHELPSTRING 314
|
||||
#define tHELPSTRINGCONTEXT 315
|
||||
#define tHELPSTRINGDLL 316
|
||||
#define tHIDDEN 317
|
||||
#define tHYPER 318
|
||||
#define tID 319
|
||||
#define tIDEMPOTENT 320
|
||||
#define tIIDIS 321
|
||||
#define tIMMEDIATEBIND 322
|
||||
#define tIMPLICITHANDLE 323
|
||||
#define tIMPORT 324
|
||||
#define tIMPORTLIB 325
|
||||
#define tIN 326
|
||||
#define tINLINE 327
|
||||
#define tINPUTSYNC 328
|
||||
#define tINT 329
|
||||
#define tINT64 330
|
||||
#define tINTERFACE 331
|
||||
#define tLCID 332
|
||||
#define tLENGTHIS 333
|
||||
#define tLIBRARY 334
|
||||
#define tLOCAL 335
|
||||
#define tLONG 336
|
||||
#define tMETHODS 337
|
||||
#define tMODULE 338
|
||||
#define tNONBROWSABLE 339
|
||||
#define tNONCREATABLE 340
|
||||
#define tNONEXTENSIBLE 341
|
||||
#define tOBJECT 342
|
||||
#define tODL 343
|
||||
#define tOLEAUTOMATION 344
|
||||
#define tOPTIONAL 345
|
||||
#define tOUT 346
|
||||
#define tPOINTERDEFAULT 347
|
||||
#define tPROPERTIES 348
|
||||
#define tPROPGET 349
|
||||
#define tPROPPUT 350
|
||||
#define tPROPPUTREF 351
|
||||
#define tPTR 352
|
||||
#define tPUBLIC 353
|
||||
#define tRANGE 354
|
||||
#define tREADONLY 355
|
||||
#define tREF 356
|
||||
#define tREQUESTEDIT 357
|
||||
#define tRESTRICTED 358
|
||||
#define tRETVAL 359
|
||||
#define tSAFEARRAY 360
|
||||
#define tSHORT 361
|
||||
#define tSIGNED 362
|
||||
#define tSINGLE 363
|
||||
#define tSIZEIS 364
|
||||
#define tSIZEOF 365
|
||||
#define tSMALL 366
|
||||
#define tSOURCE 367
|
||||
#define tSTDCALL 368
|
||||
#define tSTRING 369
|
||||
#define tSTRUCT 370
|
||||
#define tSWITCH 371
|
||||
#define tSWITCHIS 372
|
||||
#define tSWITCHTYPE 373
|
||||
#define tTRANSMITAS 374
|
||||
#define tTRUE 375
|
||||
#define tTYPEDEF 376
|
||||
#define tUNION 377
|
||||
#define tUNIQUE 378
|
||||
#define tUNSIGNED 379
|
||||
#define tUUID 380
|
||||
#define tV1ENUM 381
|
||||
#define tVARARG 382
|
||||
#define tVERSION 383
|
||||
#define tVOID 384
|
||||
#define tWCHAR 385
|
||||
#define tWIREMARSHAL 386
|
||||
#define CAST 387
|
||||
#define PPTR 388
|
||||
#define NEG 389
|
||||
#define ADDRESSOF 390
|
||||
|
||||
|
||||
|
||||
|
||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||
#line 109 "parser.y"
|
||||
#line 136 "parser.y"
|
||||
typedef union YYSTYPE {
|
||||
attr_t *attr;
|
||||
attr_list_t *attr_list;
|
||||
str_list_t *str_list;
|
||||
expr_t *expr;
|
||||
expr_list_t *expr_list;
|
||||
array_dims_t *array_dims;
|
||||
type_t *type;
|
||||
typeref_t *tref;
|
||||
var_t *var;
|
||||
var_list_t *var_list;
|
||||
pident_t *pident;
|
||||
pident_list_t *pident_list;
|
||||
func_t *func;
|
||||
func_list_t *func_list;
|
||||
ifref_t *ifref;
|
||||
ifref_list_t *ifref_list;
|
||||
char *str;
|
||||
UUID *uuid;
|
||||
unsigned int num;
|
||||
double dbl;
|
||||
interface_info_t ifinfo;
|
||||
} YYSTYPE;
|
||||
/* Line 1248 of yacc.c. */
|
||||
#line 315 "parser.tab.h"
|
||||
/* Line 1447 of yacc.c. */
|
||||
#line 331 "parser.tab.h"
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
extern YYSTYPE parser_lval;
|
||||
|
||||
|
||||
|
||||
|
||||
+908
-314
File diff suppressed because it is too large
Load Diff
+271
-632
File diff suppressed because it is too large
Load Diff
+75
-277
@@ -36,166 +36,32 @@
|
||||
#include "parser.h"
|
||||
#include "header.h"
|
||||
|
||||
#include "widl.h"
|
||||
#include "typelib.h"
|
||||
#include "typelib_struct.h"
|
||||
#include "typegen.h"
|
||||
|
||||
static FILE* server;
|
||||
static int indent = 0;
|
||||
|
||||
|
||||
static int print_server(const char *format, ...)
|
||||
static void print_server(const char *format, ...)
|
||||
{
|
||||
va_list va;
|
||||
int i, r;
|
||||
|
||||
va_start(va, format);
|
||||
for (i = 0; i < indent; i++)
|
||||
fprintf(server, " ");
|
||||
r = vfprintf(server, format, va);
|
||||
print(server, indent, format, va);
|
||||
va_end(va);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
static void write_parameters_init(const func_t *func)
|
||||
{
|
||||
const var_t *var;
|
||||
|
||||
if (!func->args)
|
||||
return;
|
||||
|
||||
var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
if (var->type->type != RPC_FC_BIND_PRIMITIVE)
|
||||
print_server("%s = 0;\n", var->name);
|
||||
|
||||
var = PREV_LINK(var);
|
||||
}
|
||||
fprintf(server, "\n");
|
||||
}
|
||||
|
||||
|
||||
static void declare_args(const func_t *func)
|
||||
{
|
||||
int in_attr, out_attr;
|
||||
int i = 0;
|
||||
var_t *var;
|
||||
|
||||
if (!func->args)
|
||||
return;
|
||||
|
||||
var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
const expr_t *size_is = get_attrp(var->attrs, ATTR_SIZEIS);
|
||||
int has_size = size_is && (size_is->type != EXPR_VOID);
|
||||
int is_string = is_attr(var->attrs, ATTR_STRING);
|
||||
|
||||
in_attr = is_attr(var->attrs, ATTR_IN);
|
||||
out_attr = is_attr(var->attrs, ATTR_OUT);
|
||||
if (!out_attr && !in_attr)
|
||||
in_attr = 1;
|
||||
|
||||
if (!in_attr && !has_size && !is_string)
|
||||
{
|
||||
int indirection;
|
||||
print_server("");
|
||||
write_type(server, var->type, NULL, var->tname);
|
||||
for (indirection = 0; indirection < var->ptr_level - 1; indirection++)
|
||||
fprintf(server, "*");
|
||||
fprintf(server, " _W%u;\n", i++);
|
||||
}
|
||||
|
||||
print_server("");
|
||||
write_type(server, var->type, var, var->tname);
|
||||
fprintf(server, " ");
|
||||
write_name(server, var);
|
||||
write_array(server, var->array, 0);
|
||||
fprintf(server, ";\n");
|
||||
|
||||
var = PREV_LINK(var);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void assign_out_args(const func_t *func)
|
||||
{
|
||||
int in_attr, out_attr;
|
||||
int i = 0, sep = 0;
|
||||
var_t *var;
|
||||
const expr_t *size_is;
|
||||
int has_size;
|
||||
|
||||
if (!func->args)
|
||||
return;
|
||||
|
||||
var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
int is_string = is_attr(var->attrs, ATTR_STRING);
|
||||
size_is = get_attrp(var->attrs, ATTR_SIZEIS);
|
||||
has_size = size_is && (size_is->type != EXPR_VOID);
|
||||
in_attr = is_attr(var->attrs, ATTR_IN);
|
||||
out_attr = is_attr(var->attrs, ATTR_OUT);
|
||||
if (!out_attr && !in_attr)
|
||||
in_attr = 1;
|
||||
|
||||
if (!in_attr)
|
||||
{
|
||||
print_server("");
|
||||
write_name(server, var);
|
||||
|
||||
if (has_size)
|
||||
{
|
||||
unsigned int size;
|
||||
type_t *type = var->type;
|
||||
while (type->type == 0 && type->ref)
|
||||
type = type->ref;
|
||||
|
||||
fprintf(server, " = NdrAllocate(&_StubMsg, ");
|
||||
write_expr(server, size_is, 1);
|
||||
size = get_type_memsize(type);
|
||||
fprintf(server, " * %u);\n", size);
|
||||
}
|
||||
else if (!is_string)
|
||||
{
|
||||
fprintf(server, " = &_W%u;\n", i);
|
||||
if (var->ptr_level > 1)
|
||||
print_server("_W%u = 0;\n", i);
|
||||
i++;
|
||||
}
|
||||
|
||||
sep = 1;
|
||||
}
|
||||
|
||||
var = PREV_LINK(var);
|
||||
}
|
||||
|
||||
if (sep)
|
||||
fprintf(server, "\n");
|
||||
}
|
||||
|
||||
|
||||
static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsigned int *type_offset)
|
||||
static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
||||
{
|
||||
char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
|
||||
const func_t *func = iface->funcs;
|
||||
const func_t *func;
|
||||
const var_t *var;
|
||||
const var_t* explicit_handle_var;
|
||||
|
||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||
while (func)
|
||||
if (!iface->funcs) return;
|
||||
LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
|
||||
{
|
||||
const var_t *def = func->def;
|
||||
unsigned long buffer_size = 0;
|
||||
unsigned int type_offset_func;
|
||||
|
||||
/* check for a defined binding handle */
|
||||
explicit_handle_var = get_explicit_handle_var(func);
|
||||
@@ -228,16 +94,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
fprintf(server, "{\n");
|
||||
indent++;
|
||||
|
||||
/* declare return value '_RetVal' */
|
||||
if (!is_void(def->type, NULL))
|
||||
{
|
||||
print_server("");
|
||||
write_type(server, def->type, def, def->tname);
|
||||
fprintf(server, " _RetVal;\n");
|
||||
}
|
||||
|
||||
/* Declare arguments */
|
||||
declare_args(func);
|
||||
declare_stub_args(server, indent, func);
|
||||
|
||||
print_server("MIDL_STUB_MESSAGE _StubMsg;\n");
|
||||
print_server("RPC_STATUS _Status;\n");
|
||||
@@ -253,7 +111,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
indent--;
|
||||
fprintf(server, "\n");
|
||||
|
||||
write_parameters_init(func);
|
||||
write_parameters_init(server, indent, func);
|
||||
|
||||
if (explicit_handle_var)
|
||||
{
|
||||
@@ -279,11 +137,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
indent -= 2;
|
||||
fprintf(server, "\n");
|
||||
|
||||
/* make a copy so we don't increment the type offset twice */
|
||||
type_offset_func = *type_offset;
|
||||
|
||||
/* unmarshall arguments */
|
||||
write_remoting_arguments(server, indent, func, &type_offset_func, PASS_IN, PHASE_UNMARSHAL);
|
||||
write_remoting_arguments(server, indent, func, PASS_IN, PHASE_UNMARSHAL);
|
||||
}
|
||||
|
||||
print_server("if (_StubMsg.Buffer > _StubMsg.BufferEnd)\n");
|
||||
@@ -304,14 +159,14 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
fprintf(server, "\n");
|
||||
|
||||
/* Assign 'out' arguments */
|
||||
assign_out_args(func);
|
||||
assign_stub_out_args(server, indent, func);
|
||||
|
||||
/* Call the real server function */
|
||||
if (!is_void(def->type, NULL))
|
||||
if (!is_void(def->type))
|
||||
print_server("_RetVal = ");
|
||||
else
|
||||
print_server("");
|
||||
write_name(server, def);
|
||||
write_prefix_name(server, prefix_server, def);
|
||||
|
||||
if (func->args)
|
||||
{
|
||||
@@ -319,17 +174,25 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
|
||||
fprintf(server, "(\n");
|
||||
indent++;
|
||||
var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||
{
|
||||
if (first_arg)
|
||||
first_arg = 0;
|
||||
else
|
||||
fprintf(server, ",\n");
|
||||
print_server("");
|
||||
write_name(server, var);
|
||||
var = PREV_LINK(var);
|
||||
if (is_context_handle(var->type))
|
||||
{
|
||||
print_server("(");
|
||||
write_type_decl_left(server, var->type);
|
||||
fprintf(server, ")%sNDRSContextValue(%s)", is_ptr(var->type) ? "" : "*", var->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_server("");
|
||||
if (var->type->declarray)
|
||||
fprintf(server, "*");
|
||||
write_name(server, var);
|
||||
}
|
||||
}
|
||||
fprintf(server, ");\n");
|
||||
indent--;
|
||||
@@ -339,37 +202,12 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
fprintf(server, "();\n");
|
||||
}
|
||||
|
||||
if (func->args)
|
||||
{
|
||||
const var_t *var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
if (is_attr(var->attrs, ATTR_OUT))
|
||||
{
|
||||
unsigned int alignment;
|
||||
buffer_size += get_required_buffer_size(var, &alignment, PASS_OUT);
|
||||
buffer_size += alignment;
|
||||
}
|
||||
|
||||
var = PREV_LINK(var);
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_void(def->type, NULL))
|
||||
{
|
||||
unsigned int alignment;
|
||||
buffer_size += get_required_buffer_size(def, &alignment, PASS_RETURN);
|
||||
buffer_size += alignment;
|
||||
}
|
||||
|
||||
if (has_out_arg_or_return(func))
|
||||
{
|
||||
fprintf(server, "\n");
|
||||
print_server("_StubMsg.BufferLength = %u;\n", buffer_size);
|
||||
write_remoting_arguments(server, indent, func, PASS_OUT, PHASE_BUFFERSIZE);
|
||||
|
||||
type_offset_func = *type_offset;
|
||||
write_remoting_arguments(server, indent, func, &type_offset_func, PASS_OUT, PHASE_BUFFERSIZE);
|
||||
if (!is_void(def->type))
|
||||
write_remoting_arguments(server, indent, func, PASS_RETURN, PHASE_BUFFERSIZE);
|
||||
|
||||
print_server("_pRpcMessage->BufferLength = _StubMsg.BufferLength;\n");
|
||||
fprintf(server, "\n");
|
||||
@@ -383,14 +221,12 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
fprintf(server, "\n");
|
||||
}
|
||||
|
||||
type_offset_func = *type_offset;
|
||||
|
||||
/* marshall arguments */
|
||||
write_remoting_arguments(server, indent, func, type_offset, PASS_OUT, PHASE_MARSHAL);
|
||||
write_remoting_arguments(server, indent, func, PASS_OUT, PHASE_MARSHAL);
|
||||
|
||||
/* marshall the return value */
|
||||
if (!is_void(def->type, NULL))
|
||||
print_phase_basetype(server, indent, PHASE_MARSHAL, PASS_RETURN, def, "_RetVal");
|
||||
if (!is_void(def->type))
|
||||
write_remoting_arguments(server, indent, func, PASS_RETURN, PHASE_MARSHAL);
|
||||
|
||||
indent--;
|
||||
print_server("}\n");
|
||||
@@ -398,7 +234,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
print_server("{\n");
|
||||
indent++;
|
||||
|
||||
write_remoting_arguments(server, indent, func, &type_offset_func, PASS_OUT, PHASE_FREE);
|
||||
write_remoting_arguments(server, indent, func, PASS_OUT, PHASE_FREE);
|
||||
|
||||
indent--;
|
||||
print_server("}\n");
|
||||
@@ -415,22 +251,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
||||
fprintf(server, "\n");
|
||||
|
||||
/* update proc_offset */
|
||||
if (func->args)
|
||||
{
|
||||
var = func->args;
|
||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
||||
while (var)
|
||||
{
|
||||
*proc_offset += get_size_procformatstring_var(var);
|
||||
var = PREV_LINK(var);
|
||||
}
|
||||
}
|
||||
if (!is_void(def->type, NULL))
|
||||
*proc_offset += get_size_procformatstring_var(def);
|
||||
else
|
||||
*proc_offset += 2; /* FC_END and FC_PAD */
|
||||
|
||||
func = PREV_LINK(func);
|
||||
*proc_offset += get_size_procformatstring_func( func );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,13 +260,13 @@ static void write_dispatchtable(type_t *iface)
|
||||
{
|
||||
unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION);
|
||||
unsigned long method_count = 0;
|
||||
func_t *func = iface->funcs;
|
||||
const func_t *func;
|
||||
|
||||
print_server("static RPC_DISPATCH_FUNCTION %s_table[] =\n", iface->name);
|
||||
print_server("{\n");
|
||||
indent++;
|
||||
while (NEXT_LINK(func)) func = NEXT_LINK(func);
|
||||
while (func)
|
||||
|
||||
if (iface->funcs) LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
|
||||
{
|
||||
var_t *def = func->def;
|
||||
|
||||
@@ -454,12 +275,11 @@ static void write_dispatchtable(type_t *iface)
|
||||
fprintf(server, ",\n");
|
||||
|
||||
method_count++;
|
||||
func = PREV_LINK(func);
|
||||
}
|
||||
print_server("0\n");
|
||||
indent--;
|
||||
print_server("};\n");
|
||||
print_server("RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable =\n", iface->name, LOWORD(ver), HIWORD(ver));
|
||||
print_server("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);
|
||||
@@ -503,7 +323,7 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines)
|
||||
print_server("0,\n");
|
||||
print_server("0x50100a4, /* MIDL Version 5.1.164 */\n");
|
||||
print_server("0,\n");
|
||||
print_server("0,\n");
|
||||
print_server("%s,\n", list_empty(&user_type_list) ? "0" : "UserMarshalRoutines");
|
||||
print_server("0, /* notify & notify_flag routine table */\n");
|
||||
print_server("1, /* Flags */\n");
|
||||
print_server("0, /* Reserved3 */\n");
|
||||
@@ -519,8 +339,11 @@ static void write_serverinterfacedecl(type_t *iface)
|
||||
{
|
||||
unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION);
|
||||
UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
|
||||
const str_list_t *endpoints = get_attrp(iface->attrs, ATTR_ENDPOINT);
|
||||
|
||||
print_server("extern RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable;\n", iface->name, LOWORD(ver), HIWORD(ver));
|
||||
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));
|
||||
fprintf(server, "\n");
|
||||
print_server("static const RPC_SERVER_INTERFACE %s___RpcServerInterface =\n", iface->name );
|
||||
print_server("{\n");
|
||||
@@ -529,11 +352,19 @@ static void write_serverinterfacedecl(type_t *iface)
|
||||
print_server("{{0x%08lx,0x%04x,0x%04x,{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x}},{%d,%d}},\n",
|
||||
uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1],
|
||||
uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5], uuid->Data4[6],
|
||||
uuid->Data4[7], LOWORD(ver), HIWORD(ver));
|
||||
uuid->Data4[7], MAJORVERSION(ver), MINORVERSION(ver));
|
||||
print_server("{{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},\n"); /* FIXME */
|
||||
print_server("&%s_v%d_%d_DispatchTable,\n", iface->name, LOWORD(ver), HIWORD(ver));
|
||||
print_server("0,\n");
|
||||
print_server("0,\n");
|
||||
print_server("&%s_v%d_%d_DispatchTable,\n", iface->name, MAJORVERSION(ver), MINORVERSION(ver));
|
||||
if (endpoints)
|
||||
{
|
||||
print_server("%u,\n", list_count(endpoints));
|
||||
print_server("(PRPC_PROTSEQ_ENDPOINT)%s__RpcProtseqEndpoint,\n", iface->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_server("0,\n");
|
||||
print_server("0,\n");
|
||||
}
|
||||
print_server("0,\n");
|
||||
print_server("0,\n");
|
||||
print_server("0,\n");
|
||||
@@ -543,41 +374,11 @@ static void write_serverinterfacedecl(type_t *iface)
|
||||
print_server("RPC_IF_HANDLE %s_ServerIfHandle = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n",
|
||||
iface->name, iface->name);
|
||||
else
|
||||
print_server("RPC_IF_HANDLE %s_v%d_%d_s_ifspec = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n",
|
||||
iface->name, LOWORD(ver), HIWORD(ver), iface->name);
|
||||
print_server("RPC_IF_HANDLE %s%s_v%d_%d_s_ifspec = (RPC_IF_HANDLE)& %s___RpcServerInterface;\n",
|
||||
prefix_server, iface->name, MAJORVERSION(ver), MINORVERSION(ver), iface->name);
|
||||
fprintf(server, "\n");
|
||||
}
|
||||
|
||||
static void write_formatdesc( const char *str )
|
||||
{
|
||||
print_server("typedef struct _MIDL_%s_FORMAT_STRING\n", str );
|
||||
print_server("{\n");
|
||||
indent++;
|
||||
print_server("short Pad;\n");
|
||||
print_server("unsigned char Format[%s_FORMAT_STRING_SIZE];\n", str);
|
||||
indent--;
|
||||
print_server("} MIDL_%s_FORMAT_STRING;\n", str);
|
||||
print_server("\n");
|
||||
}
|
||||
|
||||
|
||||
static void write_formatstringsdecl(ifref_t *ifaces)
|
||||
{
|
||||
print_server("#define TYPE_FORMAT_STRING_SIZE %d\n",
|
||||
get_size_typeformatstring(ifaces));
|
||||
|
||||
print_server("#define PROC_FORMAT_STRING_SIZE %d\n",
|
||||
get_size_procformatstring(ifaces));
|
||||
|
||||
fprintf(server, "\n");
|
||||
write_formatdesc("TYPE");
|
||||
write_formatdesc("PROC");
|
||||
fprintf(server, "\n");
|
||||
print_server("static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;\n");
|
||||
print_server("static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;\n");
|
||||
print_server("\n");
|
||||
}
|
||||
|
||||
|
||||
static void init_server(void)
|
||||
{
|
||||
@@ -586,35 +387,39 @@ static void init_server(void)
|
||||
if (!(server = fopen(server_name, "w")))
|
||||
error("Could not open %s for output\n", server_name);
|
||||
|
||||
print_server("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", WIDL_FULLVERSION, input_name);
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
void write_server(ifref_t *ifaces)
|
||||
void write_server(ifref_list_t *ifaces)
|
||||
{
|
||||
unsigned int proc_offset = 0;
|
||||
unsigned int type_offset = 2;
|
||||
ifref_t *iface = ifaces;
|
||||
int expr_eval_routines;
|
||||
ifref_t *iface;
|
||||
|
||||
if (!do_server)
|
||||
return;
|
||||
if (!ifaces)
|
||||
if (do_everything && !need_stub_files(ifaces))
|
||||
return;
|
||||
END_OF_LIST(iface);
|
||||
|
||||
init_server();
|
||||
if (!server)
|
||||
return;
|
||||
|
||||
write_formatstringsdecl(ifaces);
|
||||
write_formatstringsdecl(server, indent, ifaces, need_stub);
|
||||
expr_eval_routines = write_expr_eval_routines(server, server_token);
|
||||
if (expr_eval_routines)
|
||||
write_expr_eval_routine_list(server, server_token);
|
||||
write_user_quad_list(server);
|
||||
|
||||
for (; iface; iface = PREV_LINK(iface))
|
||||
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, ifref_t, entry )
|
||||
{
|
||||
if (is_object(iface->iface->attrs) || is_local(iface->iface->attrs))
|
||||
if (!need_stub(iface->iface))
|
||||
continue;
|
||||
|
||||
fprintf(server, "/*****************************************************************************\n");
|
||||
@@ -624,23 +429,16 @@ void write_server(ifref_t *ifaces)
|
||||
|
||||
if (iface->iface->funcs)
|
||||
{
|
||||
int expr_eval_routines;
|
||||
|
||||
write_serverinterfacedecl(iface->iface);
|
||||
write_stubdescdecl(iface->iface);
|
||||
|
||||
write_function_stubs(iface->iface, &proc_offset, &type_offset);
|
||||
|
||||
|
||||
write_function_stubs(iface->iface, &proc_offset);
|
||||
|
||||
print_server("#if !defined(__RPC_WIN32__)\n");
|
||||
print_server("#error Invalid build platform for this stub.\n");
|
||||
print_server("#endif\n");
|
||||
|
||||
fprintf(server, "\n");
|
||||
|
||||
expr_eval_routines = write_expr_eval_routines(server, iface->iface->name);
|
||||
if (expr_eval_routines)
|
||||
write_expr_eval_routine_list(server, iface->iface->name);
|
||||
|
||||
write_stubdescriptor(iface->iface, expr_eval_routines);
|
||||
write_dispatchtable(iface->iface);
|
||||
}
|
||||
@@ -648,8 +446,8 @@ void write_server(ifref_t *ifaces)
|
||||
|
||||
fprintf(server, "\n");
|
||||
|
||||
write_procformatstring(server, ifaces);
|
||||
write_typeformatstring(server, ifaces);
|
||||
write_procformatstring(server, ifaces, need_stub);
|
||||
write_typeformatstring(server, ifaces, need_stub);
|
||||
|
||||
fclose(server);
|
||||
}
|
||||
|
||||
+2330
-1110
File diff suppressed because it is too large
Load Diff
@@ -19,6 +19,7 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
enum pass
|
||||
{
|
||||
@@ -35,15 +36,27 @@ enum remoting_phase
|
||||
PHASE_FREE
|
||||
};
|
||||
|
||||
void write_procformatstring(FILE *file, const ifref_t *ifaces);
|
||||
void write_typeformatstring(FILE *file, const ifref_t *ifaces);
|
||||
size_t get_type_memsize(const type_t *type);
|
||||
unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment, enum pass pass);
|
||||
typedef int (*type_pred_t)(const type_t *);
|
||||
|
||||
void write_formatstringsdecl(FILE *f, int indent, ifref_list_t *ifaces, type_pred_t pred);
|
||||
void write_procformatstring(FILE *file, const ifref_list_t *ifaces, type_pred_t pred);
|
||||
void write_typeformatstring(FILE *file, const ifref_list_t *ifaces, 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, unsigned int *type_offset, enum pass pass, enum remoting_phase phase);
|
||||
void write_remoting_arguments(FILE *file, int indent, const func_t *func, enum pass pass, enum remoting_phase phase);
|
||||
size_t get_size_procformatstring_var(const var_t *var);
|
||||
size_t get_size_typeformatstring_var(const var_t *var);
|
||||
size_t get_size_procformatstring(const ifref_t *ifaces);
|
||||
size_t get_size_typeformatstring(const ifref_t *ifaces);
|
||||
size_t get_size_procformatstring_func(const func_t *func);
|
||||
size_t get_size_procformatstring(const ifref_list_t *ifaces, type_pred_t pred);
|
||||
size_t get_size_typeformatstring(const ifref_list_t *ifaces, type_pred_t pred);
|
||||
void assign_stub_out_args( FILE *file, int indent, const func_t *func );
|
||||
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 );
|
||||
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 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);
|
||||
expr_t *get_size_is_expr(const type_t *t, const char *name);
|
||||
|
||||
+95
-106
@@ -35,6 +35,9 @@
|
||||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
||||
#include "widl.h"
|
||||
#include "utils.h"
|
||||
#include "parser.h"
|
||||
@@ -47,10 +50,60 @@ int in_typelib = 0;
|
||||
|
||||
static typelib_t *typelib;
|
||||
|
||||
type_t *duptype(type_t *t, int dupname)
|
||||
{
|
||||
type_t *d = alloc_type();
|
||||
|
||||
*d = *t;
|
||||
if (dupname && t->name)
|
||||
d->name = xstrdup(t->name);
|
||||
|
||||
d->orig = t;
|
||||
return d;
|
||||
}
|
||||
|
||||
type_t *alias(type_t *t, const char *name)
|
||||
{
|
||||
type_t *a = duptype(t, 0);
|
||||
|
||||
a->name = xstrdup(name);
|
||||
a->kind = TKIND_ALIAS;
|
||||
a->attrs = NULL;
|
||||
a->declarray = FALSE;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
int is_ptr(const type_t *t)
|
||||
{
|
||||
unsigned char c = t->type;
|
||||
return c == RPC_FC_RP
|
||||
|| c == RPC_FC_UP
|
||||
|| c == RPC_FC_FP
|
||||
|| c == RPC_FC_OP;
|
||||
}
|
||||
|
||||
int is_array(const type_t *t)
|
||||
{
|
||||
switch (t->type)
|
||||
{
|
||||
case RPC_FC_SMFARRAY:
|
||||
case RPC_FC_LGFARRAY:
|
||||
case RPC_FC_SMVARRAY:
|
||||
case RPC_FC_LGVARRAY:
|
||||
case RPC_FC_CARRAY:
|
||||
case RPC_FC_CVARRAY:
|
||||
case RPC_FC_BOGUS_ARRAY:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* List of oleauto types that should be recognized by name.
|
||||
* (most of) these seem to be intrinsic types in mktyplib. */
|
||||
|
||||
static struct oatype {
|
||||
static const struct oatype {
|
||||
const char *kw;
|
||||
unsigned short vt;
|
||||
} oatypes[] = {
|
||||
@@ -73,9 +126,11 @@ static int kw_cmp_func(const void *s1, const void *s2)
|
||||
return strcmp(KWP(s1)->kw, KWP(s2)->kw);
|
||||
}
|
||||
|
||||
static unsigned short builtin_vt(const char *kw)
|
||||
static unsigned short builtin_vt(const type_t *t)
|
||||
{
|
||||
struct oatype key, *kwp;
|
||||
const char *kw = t->name;
|
||||
struct oatype key;
|
||||
const struct oatype *kwp;
|
||||
key.kw = kw;
|
||||
#ifdef KW_BSEARCH
|
||||
kwp = bsearch(&key, oatypes, NTYPES, sizeof(oatypes[0]), kw_cmp_func);
|
||||
@@ -92,6 +147,13 @@ static unsigned short builtin_vt(const char *kw)
|
||||
if (kwp) {
|
||||
return kwp->vt;
|
||||
}
|
||||
if (is_string_type (t->attrs, t))
|
||||
switch (t->ref->type)
|
||||
{
|
||||
case RPC_FC_CHAR: return VT_LPSTR;
|
||||
case RPC_FC_WCHAR: return VT_LPWSTR;
|
||||
default: break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -107,10 +169,13 @@ unsigned short get_type_vt(type_t *t)
|
||||
|
||||
chat("get_type_vt: %p type->name %s\n", t, t->name);
|
||||
if (t->name) {
|
||||
vt = builtin_vt(t->name);
|
||||
vt = builtin_vt(t);
|
||||
if (vt) return vt;
|
||||
}
|
||||
|
||||
if (t->kind == TKIND_ALIAS && t->attrs)
|
||||
return VT_USERDEFINED;
|
||||
|
||||
switch (t->type) {
|
||||
case RPC_FC_BYTE:
|
||||
case RPC_FC_USMALL:
|
||||
@@ -125,14 +190,14 @@ unsigned short get_type_vt(type_t *t)
|
||||
case RPC_FC_USHORT:
|
||||
return VT_UI2;
|
||||
case RPC_FC_LONG:
|
||||
if (t->ref && match(t->ref->name, "int")) return VT_INT;
|
||||
if (match(t->name, "int")) return VT_INT;
|
||||
return VT_I4;
|
||||
case RPC_FC_ULONG:
|
||||
if (t->ref && match(t->ref->name, "int")) return VT_UINT;
|
||||
if (match(t->name, "int")) return VT_UINT;
|
||||
return VT_UI4;
|
||||
case RPC_FC_HYPER:
|
||||
if (t->sign < 0) return VT_UI8;
|
||||
if (t->ref && match(t->ref->name, "MIDL_uhyper")) return VT_UI8;
|
||||
if (match(t->name, "MIDL_uhyper")) return VT_UI8;
|
||||
return VT_I8;
|
||||
case RPC_FC_FLOAT:
|
||||
return VT_R4;
|
||||
@@ -142,8 +207,14 @@ unsigned short get_type_vt(type_t *t)
|
||||
case RPC_FC_UP:
|
||||
case RPC_FC_OP:
|
||||
case RPC_FC_FP:
|
||||
case RPC_FC_CARRAY:
|
||||
case RPC_FC_CVARRAY:
|
||||
if(t->ref)
|
||||
{
|
||||
if (match(t->ref->name, "SAFEARRAY"))
|
||||
return VT_SAFEARRAY;
|
||||
return VT_PTR;
|
||||
}
|
||||
|
||||
error("get_type_vt: unknown-deref-type: %d\n", t->ref->type);
|
||||
break;
|
||||
@@ -163,29 +234,14 @@ unsigned short get_type_vt(type_t *t)
|
||||
case RPC_FC_BOGUS_STRUCT:
|
||||
return VT_USERDEFINED;
|
||||
case 0:
|
||||
if(t->attrs)
|
||||
return VT_USERDEFINED;
|
||||
return 0;
|
||||
return t->kind == TKIND_PRIMITIVE ? VT_VOID : VT_USERDEFINED;
|
||||
default:
|
||||
error("get_type_vt: unknown type: 0x%02x\n", t->type);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned short get_var_vt(var_t *v)
|
||||
{
|
||||
unsigned short vt;
|
||||
|
||||
chat("get_var_vt: %p tname %s\n", v, v->tname);
|
||||
if (v->tname) {
|
||||
vt = builtin_vt(v->tname);
|
||||
if (vt) return vt;
|
||||
}
|
||||
|
||||
return get_type_vt(v->type);
|
||||
}
|
||||
|
||||
void start_typelib(char *name, attr_t *attrs)
|
||||
void start_typelib(char *name, attr_list_t *attrs)
|
||||
{
|
||||
in_typelib++;
|
||||
if (!do_typelib) return;
|
||||
@@ -194,6 +250,11 @@ void start_typelib(char *name, attr_t *attrs)
|
||||
typelib->name = xstrdup(name);
|
||||
typelib->filename = xstrdup(typelib_name);
|
||||
typelib->attrs = attrs;
|
||||
list_init( &typelib->entries );
|
||||
list_init( &typelib->importlibs );
|
||||
|
||||
if (is_attr(attrs, ATTR_POINTERDEFAULT))
|
||||
pointer_default = get_attrv(attrs, ATTR_POINTERDEFAULT);
|
||||
}
|
||||
|
||||
void end_typelib(void)
|
||||
@@ -202,93 +263,22 @@ void end_typelib(void)
|
||||
if (!typelib) return;
|
||||
|
||||
create_msft_typelib(typelib);
|
||||
pointer_default = RPC_FC_UP;
|
||||
return;
|
||||
}
|
||||
|
||||
void add_interface(type_t *iface)
|
||||
void add_typelib_entry(type_t *t)
|
||||
{
|
||||
typelib_entry_t *entry;
|
||||
if (!typelib) return;
|
||||
|
||||
chat("add interface: %s\n", iface->name);
|
||||
chat("add kind %i: %s\n", t->kind, t->name);
|
||||
entry = xmalloc(sizeof(*entry));
|
||||
entry->kind = TKIND_INTERFACE;
|
||||
entry->u.interface = iface;
|
||||
LINK(entry, typelib->entry);
|
||||
typelib->entry = entry;
|
||||
entry->type = t;
|
||||
list_add_tail( &typelib->entries, &entry->entry );
|
||||
}
|
||||
|
||||
void add_coclass(type_t *cls)
|
||||
{
|
||||
typelib_entry_t *entry;
|
||||
|
||||
if (!typelib) return;
|
||||
|
||||
chat("add coclass: %s\n", cls->name);
|
||||
|
||||
entry = xmalloc(sizeof(*entry));
|
||||
entry->kind = TKIND_COCLASS;
|
||||
entry->u.class = cls;
|
||||
LINK(entry, typelib->entry);
|
||||
typelib->entry = entry;
|
||||
}
|
||||
|
||||
void add_module(type_t *module)
|
||||
{
|
||||
typelib_entry_t *entry;
|
||||
if (!typelib) return;
|
||||
|
||||
chat("add module: %s\n", module->name);
|
||||
entry = xmalloc(sizeof(*entry));
|
||||
entry->kind = TKIND_MODULE;
|
||||
entry->u.module = module;
|
||||
LINK(entry, typelib->entry);
|
||||
typelib->entry = entry;
|
||||
}
|
||||
|
||||
void add_struct(type_t *structure)
|
||||
{
|
||||
typelib_entry_t *entry;
|
||||
if (!typelib) return;
|
||||
|
||||
chat("add struct: %s\n", structure->name);
|
||||
entry = xmalloc(sizeof(*entry));
|
||||
entry->kind = TKIND_RECORD;
|
||||
entry->u.structure = structure;
|
||||
LINK(entry, typelib->entry);
|
||||
typelib->entry = entry;
|
||||
}
|
||||
|
||||
void add_enum(type_t *enumeration)
|
||||
{
|
||||
typelib_entry_t *entry;
|
||||
if (!typelib) return;
|
||||
|
||||
chat("add enum: %s\n", enumeration->name);
|
||||
entry = xmalloc(sizeof(*entry));
|
||||
entry->kind = TKIND_ENUM;
|
||||
entry->u.enumeration = enumeration;
|
||||
LINK(entry, typelib->entry);
|
||||
typelib->entry = entry;
|
||||
}
|
||||
|
||||
void add_typedef(type_t *tdef, var_t *name)
|
||||
{
|
||||
typelib_entry_t *entry;
|
||||
if (!typelib) return;
|
||||
|
||||
chat("add typedef: %s\n", name->name);
|
||||
entry = xmalloc(sizeof(*entry));
|
||||
entry->kind = TKIND_ALIAS;
|
||||
entry->u.tdef = xmalloc(sizeof(*entry->u.tdef));
|
||||
memcpy(entry->u.tdef, name, sizeof(*name));
|
||||
entry->u.tdef->type = tdef;
|
||||
entry->u.tdef->name = xstrdup(name->name);
|
||||
LINK(entry, typelib->entry);
|
||||
typelib->entry = entry;
|
||||
}
|
||||
|
||||
static void tlb_read(int fd, void *buf, size_t count)
|
||||
static void tlb_read(int fd, void *buf, int count)
|
||||
{
|
||||
if(read(fd, buf, count) < count)
|
||||
error("error while reading importlib.\n");
|
||||
@@ -347,6 +337,7 @@ static void read_msft_importlib(importlib_t *importlib, int fd)
|
||||
importlib->importinfos[i].flags |= MSFT_IMPINFO_OFFSET_IS_GUID;
|
||||
msft_read_guid(fd, &segdir, base.posguid, &importlib->importinfos[i].guid);
|
||||
}
|
||||
else memset( &importlib->importinfos[i].guid, 0, sizeof(importlib->importinfos[i].guid));
|
||||
|
||||
tlb_lseek(fd, segdir.pNametab.offset + base.NameOffset);
|
||||
tlb_read(fd, &nameintro, sizeof(nameintro));
|
||||
@@ -397,18 +388,16 @@ void add_importlib(const char *name)
|
||||
|
||||
if(!typelib) return;
|
||||
|
||||
for(importlib = typelib->importlibs; importlib; importlib = NEXT_LINK(importlib)) {
|
||||
LIST_FOR_EACH_ENTRY( importlib, &typelib->importlibs, importlib_t, entry )
|
||||
if(!strcmp(name, importlib->name))
|
||||
return;
|
||||
}
|
||||
|
||||
chat("add_importlib: %s\n", name);
|
||||
|
||||
importlib = xmalloc(sizeof(*importlib));
|
||||
memset( importlib, 0, sizeof(*importlib) );
|
||||
importlib->name = xstrdup(name);
|
||||
|
||||
read_importlib(importlib);
|
||||
|
||||
LINK(importlib, typelib->importlibs);
|
||||
typelib->importlibs = importlib;
|
||||
list_add_head( &typelib->importlibs, &importlib->entry );
|
||||
}
|
||||
|
||||
@@ -22,14 +22,9 @@
|
||||
#define __WIDL_TYPELIB_H
|
||||
|
||||
extern int in_typelib;
|
||||
extern void start_typelib(char *name, attr_t *attrs);
|
||||
extern void start_typelib(char *name, attr_list_t *attrs);
|
||||
extern void end_typelib(void);
|
||||
extern void add_interface(type_t *iface);
|
||||
extern void add_coclass(type_t *cls);
|
||||
extern void add_module(type_t *module);
|
||||
extern void add_struct(type_t *structure);
|
||||
extern void add_enum(type_t *enumeration);
|
||||
extern void add_typedef(type_t *tdef, var_t *name);
|
||||
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
|
||||
@@ -87,7 +82,6 @@ enum VARENUM {
|
||||
VT_TYPEMASK = 0xfff
|
||||
};
|
||||
extern unsigned short get_type_vt(type_t *t);
|
||||
extern unsigned short get_var_vt(var_t *v);
|
||||
|
||||
extern int create_msft_typelib(typelib_t *typelib);
|
||||
#endif
|
||||
|
||||
@@ -148,7 +148,7 @@ typedef struct tagMSFT_TypeInfoBase {
|
||||
/*050*/ INT size; /* size in bytes, at least for structures */
|
||||
/* FIXME: name of this field */
|
||||
INT datatype1; /* position in type description table */
|
||||
/* or in base intefaces */
|
||||
/* or in base interfaces */
|
||||
/* if coclass: offset in reftable */
|
||||
/* if interface: reference to inherited if */
|
||||
INT datatype2; /* for interfaces: hiword is num of inherited funcs */
|
||||
@@ -286,7 +286,7 @@ typedef struct {
|
||||
/* 0x3800 if name is typeinfo name */
|
||||
/* upper 16 bits are hash code */
|
||||
} MSFT_NameIntro;
|
||||
/* the custom data table directory has enties like this */
|
||||
/* the custom data table directory has entries like this */
|
||||
typedef struct {
|
||||
INT GuidOffset;
|
||||
INT DataOffset;
|
||||
@@ -302,7 +302,7 @@ typedef struct {
|
||||
*
|
||||
*/
|
||||
|
||||
#include <host/pshpack1.h>
|
||||
#include "pshpack1.h"
|
||||
|
||||
typedef struct {
|
||||
/*00*/ DWORD SLTG_magic; /* 0x47544c53 == "SLTG" */
|
||||
@@ -599,7 +599,7 @@ WORD offset from start of block to SAFEARRAY
|
||||
WORD typeofarray
|
||||
*/
|
||||
|
||||
#include <host/poppack.h>
|
||||
#include "poppack.h"
|
||||
|
||||
/*---------------------------END--------------------------------------------*/
|
||||
#endif
|
||||
|
||||
+46
-25
@@ -27,17 +27,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "widl.h"
|
||||
#include "utils.h"
|
||||
#include "parser.h"
|
||||
|
||||
/* #define WANT_NEAR_INDICATION */
|
||||
static const int want_near_indication = 0;
|
||||
|
||||
#ifdef WANT_NEAR_INDICATION
|
||||
void make_print(char *str)
|
||||
static void make_print(char *str)
|
||||
{
|
||||
while(*str)
|
||||
{
|
||||
@@ -46,13 +44,13 @@ void make_print(char *str)
|
||||
str++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void generic_msg(const char *s, const char *t, const char *n, va_list ap)
|
||||
{
|
||||
fprintf(stderr, "%s:%d: %s: ", input_name ? input_name : "stdin", line_number, t);
|
||||
vfprintf(stderr, s, ap);
|
||||
#ifdef WANT_NEAR_INDICATION
|
||||
|
||||
if (want_near_indication)
|
||||
{
|
||||
char *cpy;
|
||||
if(n)
|
||||
@@ -63,38 +61,37 @@ static void generic_msg(const char *s, const char *t, const char *n, va_list ap)
|
||||
free(cpy);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
|
||||
int yyerror(const char *s, ...)
|
||||
/* yyerror: yacc assumes this is not newline terminated. */
|
||||
int parser_error(const char *s, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, s);
|
||||
generic_msg(s, "Error", yytext, ap);
|
||||
generic_msg(s, "Error", parser_text, ap);
|
||||
fprintf(stderr, "\n");
|
||||
va_end(ap);
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int yywarning(const char *s, ...)
|
||||
void error_loc(const char *s, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, s);
|
||||
generic_msg(s, "Warning", yytext, ap);
|
||||
generic_msg(s, "Error", parser_text, ap);
|
||||
va_end(ap);
|
||||
return 0;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void internal_error(const char *file, int line, const char *s, ...)
|
||||
int parser_warning(const char *s, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, s);
|
||||
fprintf(stderr, "Internal error (please report) %s %d: ", file, line);
|
||||
vfprintf(stderr, s, ap);
|
||||
generic_msg(s, "Warning", parser_text, ap);
|
||||
va_end(ap);
|
||||
exit(3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void error(const char *s, ...)
|
||||
@@ -145,7 +142,7 @@ char *dup_basename(const char *name, const char *ext)
|
||||
namelen = strlen(name);
|
||||
|
||||
/* +4 for later extension and +1 for '\0' */
|
||||
base = (char *)xmalloc(namelen +4 +1);
|
||||
base = xmalloc(namelen +4 +1);
|
||||
strcpy(base, name);
|
||||
if(!strcasecmp(name + namelen-extlen, ext))
|
||||
{
|
||||
@@ -154,6 +151,35 @@ char *dup_basename(const char *name, const char *ext)
|
||||
return base;
|
||||
}
|
||||
|
||||
size_t widl_getline(char **linep, size_t *lenp, FILE *fp)
|
||||
{
|
||||
char *line = *linep;
|
||||
size_t len = *lenp;
|
||||
size_t n = 0;
|
||||
|
||||
if (!line)
|
||||
{
|
||||
len = 64;
|
||||
line = xmalloc(len);
|
||||
}
|
||||
|
||||
while (fgets(&line[n], len - n, fp))
|
||||
{
|
||||
n += strlen(&line[n]);
|
||||
if (line[n - 1] == '\n')
|
||||
break;
|
||||
else if (n == len - 1)
|
||||
{
|
||||
len *= 2;
|
||||
line = xrealloc(line, len);
|
||||
}
|
||||
}
|
||||
|
||||
*linep = line;
|
||||
*lenp = len;
|
||||
return n;
|
||||
}
|
||||
|
||||
void *xmalloc(size_t size)
|
||||
{
|
||||
void *res;
|
||||
@@ -164,12 +190,7 @@ void *xmalloc(size_t size)
|
||||
{
|
||||
error("Virtual memory exhausted.\n");
|
||||
}
|
||||
/*
|
||||
* We set it to 0.
|
||||
* This is *paramount* because we depend on it
|
||||
* just about everywhere in the rest of the code.
|
||||
*/
|
||||
memset(res, 0, size);
|
||||
memset(res, 0x55, size);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -192,6 +213,6 @@ char *xstrdup(const char *str)
|
||||
char *s;
|
||||
|
||||
assert(str != NULL);
|
||||
s = (char *)xmalloc(strlen(str)+1);
|
||||
s = xmalloc(strlen(str)+1);
|
||||
return strcpy(s, str);
|
||||
}
|
||||
|
||||
@@ -33,13 +33,23 @@ char *xstrdup(const char *str);
|
||||
#define __attribute__(X)
|
||||
#endif
|
||||
|
||||
int yyerror(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
int yywarning(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
void internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4)));
|
||||
int parser_error(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
int parser_warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
void error_loc(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
void error(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
void chat(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
|
||||
char *dup_basename(const char *name, const char *ext);
|
||||
size_t widl_getline(char **linep, size_t *lenp, FILE *fp);
|
||||
|
||||
UUID *parse_uuid(const char *u);
|
||||
int is_valid_uuid(const char *s);
|
||||
|
||||
/* typelibs expect the minor version to be stored in the higher bits and
|
||||
* major to be stored in the lower bits */
|
||||
#define MAKEVERSION(major, minor) ((((minor) & 0xffff) << 16) | ((major) & 0xffff))
|
||||
#define MAJORVERSION(version) ((version) & 0xffff)
|
||||
#define MINORVERSION(version) (((version) >> 16) & 0xffff)
|
||||
|
||||
#endif
|
||||
|
||||
+308
-47
@@ -22,6 +22,8 @@
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
@@ -46,28 +48,34 @@
|
||||
/* A = ACF input filename */
|
||||
/* J = do not search standard include path */
|
||||
/* O = generate interpreted stubs */
|
||||
/* u = UUID file only? */
|
||||
/* U = UUID filename */
|
||||
/* w = select win16/win32 output (?) */
|
||||
|
||||
static char usage[] =
|
||||
static const char usage[] =
|
||||
"Usage: widl [options...] infile.idl\n"
|
||||
" or: widl [options...] --dlldata-only name1 [name2...]\n"
|
||||
" -c Generate client stub\n"
|
||||
" -C file Name of client stub file (default is infile_c.c)\n"
|
||||
" -d n Set debug level to 'n'\n"
|
||||
" -D id[=val] Define preprocessor identifier id=val\n"
|
||||
" --dlldata=file Name of the dlldata file (default is dlldata.c)\n"
|
||||
" -E Preprocess only\n"
|
||||
" -h Generate headers\n"
|
||||
" -H file Name of header file (default is infile.h)\n"
|
||||
" -I path Set include search dir to path (multiple -I allowed)\n"
|
||||
" --local-stubs=file Write empty stubs for call_as/local methods to file\n"
|
||||
" -N Do not preprocess input\n"
|
||||
" --oldnames Use old naming conventions\n"
|
||||
" -p Generate proxy\n"
|
||||
" -P file Name of proxy file (default is infile_p.c)\n"
|
||||
" --prefix-all=p Prefix names of client stubs / server functions with 'p'\n"
|
||||
" --prefix-client=p Prefix names of client stubs with 'p'\n"
|
||||
" --prefix-server=p Prefix names of server functions with 'p'\n"
|
||||
" -s Generate server stub\n"
|
||||
" -S file Name of server stub file (default is infile_s.c)\n"
|
||||
" -t Generate typelib\n"
|
||||
" -T file Name of typelib file (default is infile.tlb)\n"
|
||||
" -u Generate interface identifiers file\n"
|
||||
" -U file Name of interface identifiers file (default is infile_i.c)\n"
|
||||
" -V Print version and exit\n"
|
||||
" -W Enable pedantic warnings\n"
|
||||
"Debug level 'n' is a bitmask with following meaning:\n"
|
||||
@@ -84,47 +92,72 @@ static const char version_string[] = "Wine IDL Compiler version " PACKAGE_VERSIO
|
||||
|
||||
int win32 = 1;
|
||||
int debuglevel = DEBUGLEVEL_NONE;
|
||||
int yy_flex_debug;
|
||||
int parser_debug, yy_flex_debug;
|
||||
|
||||
int pedantic = 0;
|
||||
static int do_everything = 1;
|
||||
int do_everything = 1;
|
||||
int preprocess_only = 0;
|
||||
int do_header = 0;
|
||||
int do_typelib = 0;
|
||||
int do_proxies = 0;
|
||||
int do_client = 0;
|
||||
int do_server = 0;
|
||||
int do_idfile = 0;
|
||||
int do_dlldata = 0;
|
||||
int no_preprocess = 0;
|
||||
int old_names = 0;
|
||||
|
||||
char *input_name;
|
||||
char *header_name;
|
||||
char *local_stubs_name;
|
||||
char *header_token;
|
||||
char *typelib_name;
|
||||
char *dlldata_name;
|
||||
char *proxy_name;
|
||||
char *proxy_token;
|
||||
char *client_name;
|
||||
char *client_token;
|
||||
char *server_name;
|
||||
char *server_token;
|
||||
char *idfile_name;
|
||||
char *idfile_token;
|
||||
char *temp_name;
|
||||
const char *prefix_client = "";
|
||||
const char *prefix_server = "";
|
||||
|
||||
int line_number = 1;
|
||||
|
||||
FILE *header;
|
||||
FILE *local_stubs;
|
||||
FILE *proxy;
|
||||
FILE *idfile;
|
||||
|
||||
time_t now;
|
||||
|
||||
static const char *short_options =
|
||||
"cC:d:D:EhH:I:NpP:sS:tT:VW";
|
||||
static struct option long_options[] = {
|
||||
{ "oldnames", 0, 0, 1 },
|
||||
enum {
|
||||
OLDNAMES_OPTION = CHAR_MAX + 1,
|
||||
DLLDATA_OPTION,
|
||||
DLLDATA_ONLY_OPTION,
|
||||
LOCAL_STUBS_OPTION,
|
||||
PREFIX_ALL_OPTION,
|
||||
PREFIX_CLIENT_OPTION,
|
||||
PREFIX_SERVER_OPTION
|
||||
};
|
||||
|
||||
static const char short_options[] =
|
||||
"cC:d:D:EhH:I:NpP:sS:tT:uU:VW";
|
||||
static const struct option long_options[] = {
|
||||
{ "dlldata", required_argument, 0, DLLDATA_OPTION },
|
||||
{ "dlldata-only", no_argument, 0, DLLDATA_ONLY_OPTION },
|
||||
{ "local-stubs", required_argument, 0, LOCAL_STUBS_OPTION },
|
||||
{ "oldnames", no_argument, 0, OLDNAMES_OPTION },
|
||||
{ "prefix-all", required_argument, 0, PREFIX_ALL_OPTION },
|
||||
{ "prefix-client", required_argument, 0, PREFIX_CLIENT_OPTION },
|
||||
{ "prefix-server", required_argument, 0, PREFIX_SERVER_OPTION },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static void rm_tempfile(void);
|
||||
static void segvhandler(int sig);
|
||||
|
||||
static char *make_token(const char *name)
|
||||
{
|
||||
@@ -158,6 +191,145 @@ static void exit_on_signal( int sig )
|
||||
exit(1); /* this will call the atexit functions */
|
||||
}
|
||||
|
||||
static void set_everything(int x)
|
||||
{
|
||||
do_header = x;
|
||||
do_typelib = x;
|
||||
do_proxies = x;
|
||||
do_client = x;
|
||||
do_server = x;
|
||||
do_idfile = x;
|
||||
do_dlldata = x;
|
||||
}
|
||||
|
||||
static 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)
|
||||
{
|
||||
fprintf(fp, "#ifdef __cplusplus\n");
|
||||
fprintf(fp, "}\n");
|
||||
fprintf(fp, "#endif\n\n");
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *filename;
|
||||
struct list link;
|
||||
} filename_node_t;
|
||||
|
||||
static void add_filename_node(struct list *list, const char *name)
|
||||
{
|
||||
filename_node_t *node = xmalloc(sizeof *node);
|
||||
node->filename = dup_basename( name, ".idl" );
|
||||
list_add_tail(list, &node->link);
|
||||
}
|
||||
|
||||
static void free_filename_nodes(struct list *list)
|
||||
{
|
||||
filename_node_t *node, *next;
|
||||
LIST_FOR_EACH_ENTRY_SAFE(node, next, list, filename_node_t, link) {
|
||||
list_remove(&node->link);
|
||||
free(node->filename);
|
||||
free(node);
|
||||
}
|
||||
}
|
||||
|
||||
static void write_dlldata_list(struct list *filenames)
|
||||
{
|
||||
FILE *dlldata;
|
||||
filename_node_t *node;
|
||||
|
||||
dlldata = fopen(dlldata_name, "w");
|
||||
if (!dlldata)
|
||||
error("couldn't open %s: %s\n", dlldata_name, strerror(errno));
|
||||
|
||||
fprintf(dlldata, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
|
||||
fprintf(dlldata, "- Do not edit ***/\n\n");
|
||||
fprintf(dlldata, "#include <objbase.h>\n");
|
||||
fprintf(dlldata, "#include <rpcproxy.h>\n\n");
|
||||
start_cplusplus_guard(dlldata);
|
||||
|
||||
LIST_FOR_EACH_ENTRY(node, filenames, filename_node_t, link)
|
||||
fprintf(dlldata, "EXTERN_PROXY_FILE(%s)\n", node->filename);
|
||||
|
||||
fprintf(dlldata, "\nPROXYFILE_LIST_START\n");
|
||||
fprintf(dlldata, "/* Start of list */\n");
|
||||
LIST_FOR_EACH_ENTRY(node, filenames, filename_node_t, link)
|
||||
fprintf(dlldata, " REFERENCE_PROXY_FILE(%s),\n", node->filename);
|
||||
fprintf(dlldata, "/* End of list */\n");
|
||||
fprintf(dlldata, "PROXYFILE_LIST_END\n\n");
|
||||
|
||||
fprintf(dlldata, "DLLDATA_ROUTINES(aProxyFileList, GET_DLL_CLSID)\n\n");
|
||||
end_cplusplus_guard(dlldata);
|
||||
fclose(dlldata);
|
||||
}
|
||||
|
||||
static char *eat_space(char *s)
|
||||
{
|
||||
while (isspace((unsigned char) *s))
|
||||
++s;
|
||||
return s;
|
||||
}
|
||||
|
||||
void write_dlldata(ifref_list_t *ifaces)
|
||||
{
|
||||
struct list filenames = LIST_INIT(filenames);
|
||||
filename_node_t *node;
|
||||
FILE *dlldata;
|
||||
|
||||
if (!do_dlldata || !need_proxy_file(ifaces))
|
||||
return;
|
||||
|
||||
dlldata = fopen(dlldata_name, "r");
|
||||
if (dlldata) {
|
||||
static char marker[] = "REFERENCE_PROXY_FILE";
|
||||
char *line = NULL;
|
||||
size_t len = 0;
|
||||
|
||||
while (widl_getline(&line, &len, dlldata)) {
|
||||
char *start, *end;
|
||||
start = eat_space(line);
|
||||
if (strncmp(start, marker, sizeof marker - 1) == 0) {
|
||||
start = eat_space(start + sizeof marker - 1);
|
||||
if (*start != '(')
|
||||
continue;
|
||||
end = start = eat_space(start + 1);
|
||||
while (*end && *end != ')')
|
||||
++end;
|
||||
if (*end != ')')
|
||||
continue;
|
||||
while (isspace((unsigned char) end[-1]))
|
||||
--end;
|
||||
*end = '\0';
|
||||
if (start < end)
|
||||
add_filename_node(&filenames, start);
|
||||
}
|
||||
}
|
||||
|
||||
if (ferror(dlldata))
|
||||
error("couldn't read from %s: %s\n", dlldata_name, strerror(errno));
|
||||
|
||||
free(line);
|
||||
fclose(dlldata);
|
||||
}
|
||||
|
||||
LIST_FOR_EACH_ENTRY(node, &filenames, filename_node_t, link)
|
||||
if (strcmp(proxy_token, node->filename) == 0) {
|
||||
/* We're already in the list, no need to regenerate this file. */
|
||||
free_filename_nodes(&filenames);
|
||||
return;
|
||||
}
|
||||
|
||||
add_filename_node(&filenames, proxy_token);
|
||||
write_dlldata_list(&filenames);
|
||||
free_filename_nodes(&filenames);
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
extern char* optarg;
|
||||
@@ -166,7 +338,6 @@ int main(int argc,char *argv[])
|
||||
int ret = 0;
|
||||
int opti = 0;
|
||||
|
||||
signal(SIGSEGV, segvhandler);
|
||||
signal( SIGTERM, exit_on_signal );
|
||||
signal( SIGINT, exit_on_signal );
|
||||
#ifdef SIGHUP
|
||||
@@ -177,15 +348,36 @@ int main(int argc,char *argv[])
|
||||
|
||||
while((optc = getopt_long(argc, argv, short_options, long_options, &opti)) != EOF) {
|
||||
switch(optc) {
|
||||
case 1:
|
||||
case DLLDATA_OPTION:
|
||||
dlldata_name = xstrdup(optarg);
|
||||
break;
|
||||
case DLLDATA_ONLY_OPTION:
|
||||
do_everything = 0;
|
||||
do_dlldata = 1;
|
||||
break;
|
||||
case LOCAL_STUBS_OPTION:
|
||||
do_everything = 0;
|
||||
local_stubs_name = xstrdup(optarg);
|
||||
break;
|
||||
case OLDNAMES_OPTION:
|
||||
old_names = 1;
|
||||
break;
|
||||
case PREFIX_ALL_OPTION:
|
||||
prefix_client = xstrdup(optarg);
|
||||
prefix_server = xstrdup(optarg);
|
||||
break;
|
||||
case PREFIX_CLIENT_OPTION:
|
||||
prefix_client = xstrdup(optarg);
|
||||
break;
|
||||
case PREFIX_SERVER_OPTION:
|
||||
prefix_server = xstrdup(optarg);
|
||||
break;
|
||||
case 'c':
|
||||
do_everything = 0;
|
||||
do_client = 1;
|
||||
break;
|
||||
case 'C':
|
||||
client_name = strdup(optarg);
|
||||
client_name = xstrdup(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
debuglevel = strtol(optarg, NULL, 0);
|
||||
@@ -202,7 +394,7 @@ int main(int argc,char *argv[])
|
||||
do_header = 1;
|
||||
break;
|
||||
case 'H':
|
||||
header_name = strdup(optarg);
|
||||
header_name = xstrdup(optarg);
|
||||
break;
|
||||
case 'I':
|
||||
wpp_add_include_path(optarg);
|
||||
@@ -215,42 +407,67 @@ int main(int argc,char *argv[])
|
||||
do_proxies = 1;
|
||||
break;
|
||||
case 'P':
|
||||
proxy_name = strdup(optarg);
|
||||
proxy_name = xstrdup(optarg);
|
||||
break;
|
||||
case 's':
|
||||
do_everything = 0;
|
||||
do_server = 1;
|
||||
break;
|
||||
case 'S':
|
||||
server_name = strdup(optarg);
|
||||
server_name = xstrdup(optarg);
|
||||
break;
|
||||
case 't':
|
||||
do_everything = 0;
|
||||
do_typelib = 1;
|
||||
break;
|
||||
case 'T':
|
||||
typelib_name = strdup(optarg);
|
||||
typelib_name = xstrdup(optarg);
|
||||
break;
|
||||
case 'u':
|
||||
do_everything = 0;
|
||||
do_idfile = 1;
|
||||
break;
|
||||
case 'U':
|
||||
idfile_name = xstrdup(optarg);
|
||||
break;
|
||||
case 'V':
|
||||
printf(version_string);
|
||||
printf("%s", version_string);
|
||||
return 0;
|
||||
case 'W':
|
||||
pedantic = 1;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, usage);
|
||||
fprintf(stderr, "%s", usage);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(do_everything) {
|
||||
do_header = do_typelib = do_proxies = do_client = do_server = 1;
|
||||
set_everything(TRUE);
|
||||
}
|
||||
|
||||
if (!dlldata_name && do_dlldata)
|
||||
dlldata_name = xstrdup("dlldata.c");
|
||||
|
||||
if(optind < argc) {
|
||||
input_name = xstrdup(argv[optind]);
|
||||
if (do_dlldata && !do_everything) {
|
||||
struct list filenames = LIST_INIT(filenames);
|
||||
for ( ; optind < argc; ++optind)
|
||||
add_filename_node(&filenames, argv[optind]);
|
||||
|
||||
write_dlldata_list(&filenames);
|
||||
free_filename_nodes(&filenames);
|
||||
return 0;
|
||||
}
|
||||
else if (optind != argc - 1) {
|
||||
fprintf(stderr, "%s", usage);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
input_name = xstrdup(argv[optind]);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, usage);
|
||||
fprintf(stderr, "%s", usage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -260,7 +477,7 @@ int main(int argc,char *argv[])
|
||||
setbuf(stderr,0);
|
||||
}
|
||||
|
||||
yydebug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
|
||||
parser_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
|
||||
yy_flex_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
|
||||
|
||||
wpp_set_debug( (debuglevel & DEBUGLEVEL_PPLEX) != 0,
|
||||
@@ -292,6 +509,11 @@ int main(int argc,char *argv[])
|
||||
strcat(server_name, "_s.c");
|
||||
}
|
||||
|
||||
if (!idfile_name && do_idfile) {
|
||||
idfile_name = dup_basename(input_name, ".idl");
|
||||
strcat(idfile_name, "_i.c");
|
||||
}
|
||||
|
||||
if (do_proxies) proxy_token = dup_basename_token(proxy_name,"_p.c");
|
||||
if (do_client) client_token = dup_basename_token(client_name,"_c.c");
|
||||
if (do_server) server_token = dup_basename_token(server_name,"_s.c");
|
||||
@@ -314,13 +536,13 @@ int main(int argc,char *argv[])
|
||||
|
||||
if(ret) exit(1);
|
||||
if(preprocess_only) exit(0);
|
||||
if(!(yyin = fopen(temp_name, "r"))) {
|
||||
if(!(parser_in = fopen(temp_name, "r"))) {
|
||||
fprintf(stderr, "Could not open %s for input\n", temp_name);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!(yyin = fopen(input_name, "r"))) {
|
||||
if(!(parser_in = fopen(input_name, "r"))) {
|
||||
fprintf(stderr, "Could not open %s for input\n", input_name);
|
||||
return 1;
|
||||
}
|
||||
@@ -343,35 +565,74 @@ int main(int argc,char *argv[])
|
||||
fprintf(header, "#include <rpcndr.h>\n\n" );
|
||||
fprintf(header, "#ifndef __WIDL_%s\n", header_token);
|
||||
fprintf(header, "#define __WIDL_%s\n", header_token);
|
||||
fprintf(header, "#ifdef __cplusplus\n");
|
||||
fprintf(header, "extern \"C\" {\n");
|
||||
fprintf(header, "#endif\n");
|
||||
start_cplusplus_guard(header);
|
||||
}
|
||||
|
||||
ret = yyparse();
|
||||
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);
|
||||
}
|
||||
|
||||
init_types();
|
||||
ret = parser_parse();
|
||||
|
||||
if(do_header) {
|
||||
fprintf(header, "/* Begin additional prototypes for all interfaces */\n");
|
||||
fprintf(header, "\n");
|
||||
write_user_types();
|
||||
write_context_handle_rundowns();
|
||||
fprintf(header, "\n");
|
||||
fprintf(header, "/* End additional prototypes */\n");
|
||||
fprintf(header, "\n");
|
||||
fprintf(header, "#ifdef __cplusplus\n");
|
||||
fprintf(header, "}\n");
|
||||
fprintf(header, "#endif\n");
|
||||
end_cplusplus_guard(header);
|
||||
fprintf(header, "#endif /* __WIDL_%s */\n", header_token);
|
||||
fclose(header);
|
||||
}
|
||||
|
||||
fclose(yyin);
|
||||
if (local_stubs) {
|
||||
fclose(local_stubs);
|
||||
}
|
||||
|
||||
if (do_idfile) {
|
||||
fprintf(idfile, "\n");
|
||||
end_cplusplus_guard(idfile);
|
||||
|
||||
fclose(idfile);
|
||||
}
|
||||
|
||||
fclose(parser_in);
|
||||
|
||||
if(ret) {
|
||||
exit(1);
|
||||
}
|
||||
header_name = NULL;
|
||||
client_name = NULL;
|
||||
server_name = NULL;
|
||||
|
||||
/* Everything has been done successfully, don't delete any files. */
|
||||
set_everything(FALSE);
|
||||
local_stubs_name = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -380,18 +641,18 @@ static void rm_tempfile(void)
|
||||
abort_import();
|
||||
if(temp_name)
|
||||
unlink(temp_name);
|
||||
if (header_name)
|
||||
if (do_header)
|
||||
unlink(header_name);
|
||||
if (client_name)
|
||||
if (local_stubs_name)
|
||||
unlink(local_stubs_name);
|
||||
if (do_client)
|
||||
unlink(client_name);
|
||||
if (server_name)
|
||||
if (do_server)
|
||||
unlink(server_name);
|
||||
}
|
||||
|
||||
static void segvhandler(int sig)
|
||||
{
|
||||
fprintf(stderr, "\n%s:%d: Oops, segment violation\n", input_name, line_number);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
abort();
|
||||
if (do_idfile)
|
||||
unlink(idfile_name);
|
||||
if (do_proxies)
|
||||
unlink(proxy_name);
|
||||
if (do_typelib)
|
||||
unlink(typelib_name);
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#define WIDL_FULLVERSION "0.1"
|
||||
|
||||
extern int debuglevel;
|
||||
#define DEBUGLEVEL_NONE 0x0000
|
||||
#define DEBUGLEVEL_CHAT 0x0001
|
||||
@@ -38,31 +36,41 @@ extern int debuglevel;
|
||||
|
||||
extern int win32;
|
||||
extern int pedantic;
|
||||
extern int do_everything;
|
||||
extern int do_header;
|
||||
extern int do_typelib;
|
||||
extern int do_proxies;
|
||||
extern int do_client;
|
||||
extern int do_server;
|
||||
extern int do_idfile;
|
||||
extern int do_dlldata;
|
||||
extern int old_names;
|
||||
|
||||
extern char *input_name;
|
||||
extern char *header_name;
|
||||
extern char *local_stubs_name;
|
||||
extern char *typelib_name;
|
||||
extern char *dlldata_name;
|
||||
extern char *proxy_name;
|
||||
extern char *proxy_token;
|
||||
extern char *client_name;
|
||||
extern char *client_token;
|
||||
extern char *server_name;
|
||||
extern char *server_token;
|
||||
extern const char *prefix_client;
|
||||
extern const char *prefix_server;
|
||||
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_proxies(ifref_t *ifaces);
|
||||
extern void write_client(ifref_t *ifaces);
|
||||
extern void write_server(ifref_t *ifaces);
|
||||
extern void write_proxies(ifref_list_t *ifaces);
|
||||
extern void write_client(ifref_list_t *ifaces);
|
||||
extern void write_server(ifref_list_t *ifaces);
|
||||
extern void write_dlldata(ifref_list_t *ifaces);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,6 @@ WIDL_SOURCES = $(addprefix $(WIDL_BASE_), \
|
||||
client.c \
|
||||
hash.c \
|
||||
header.c \
|
||||
lex.yy.c \
|
||||
proxy.c \
|
||||
server.c \
|
||||
typegen.c \
|
||||
@@ -49,6 +48,7 @@ WIDL_SOURCES = $(addprefix $(WIDL_BASE_), \
|
||||
utils.c \
|
||||
widl.c \
|
||||
write_msft.c \
|
||||
parser.yy.c \
|
||||
parser.tab.c \
|
||||
port$(SEP)mkstemps.c \
|
||||
)
|
||||
@@ -56,11 +56,11 @@ WIDL_SOURCES = $(addprefix $(WIDL_BASE_), \
|
||||
WIDL_OBJECTS = \
|
||||
$(addprefix $(INTERMEDIATE_), $(WIDL_SOURCES:.c=.o))
|
||||
|
||||
WIDL_HOST_CFLAGS = \
|
||||
-DINT16=SHORT -DYYDEBUG=1 \
|
||||
WIDL_HOST_CFLAGS = $(TOOLS_CFLAGS) \
|
||||
-DINT16=SHORT -D__USE_W32API -DYYDEBUG=1 -D__REACTOS__=1 \
|
||||
-I$(WIDL_BASE) -I$(WPP_BASE) \
|
||||
-Iinclude/reactos/wine -Iinclude/reactos -Iinclude \
|
||||
-I$(INTERMEDIATE_)include $(TOOLS_CFLAGS)
|
||||
-Iinclude/reactos/wine -Iinclude/reactos -Iinclude -Iinclude/psdk \
|
||||
-I$(INTERMEDIATE_)include
|
||||
|
||||
WIDL_HOST_LFLAGS = $(TOOLS_LFLAGS)
|
||||
|
||||
@@ -85,10 +85,6 @@ $(WIDL_INT_)header.o: $(WIDL_BASE_)header.c $(WIDL_DEPENDS) | $(WIDL_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gcc} $(WIDL_HOST_CFLAGS) -c $< -o $@
|
||||
|
||||
$(WIDL_INT_)lex.yy.o: $(WIDL_BASE_)lex.yy.c $(WIDL_DEPENDS) | $(WIDL_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gcc} $(WIDL_HOST_CFLAGS) -c $< -o $@
|
||||
|
||||
$(WIDL_INT_)proxy.o: $(WIDL_BASE_)proxy.c $(WIDL_DEPENDS) | $(WIDL_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gcc} $(WIDL_HOST_CFLAGS) -c $< -o $@
|
||||
@@ -117,6 +113,10 @@ $(WIDL_INT_)write_msft.o: $(WIDL_BASE_)write_msft.c $(WIDL_DEPENDS) | $(WIDL_INT
|
||||
$(ECHO_CC)
|
||||
${host_gcc} $(WIDL_HOST_CFLAGS) -c $< -o $@
|
||||
|
||||
$(WIDL_INT_)parser.yy.o: $(WIDL_BASE_)parser.yy.c $(WIDL_DEPENDS) | $(WIDL_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gcc} $(WIDL_HOST_CFLAGS) -c $< -o $@
|
||||
|
||||
$(WIDL_INT_)parser.tab.o: $(WIDL_BASE_)parser.tab.c $(WIDL_DEPENDS) | $(WIDL_INT)
|
||||
$(ECHO_CC)
|
||||
${host_gcc} $(WIDL_HOST_CFLAGS) -c $< -o $@
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
.\" -*- nroff -*-
|
||||
.TH WIDL 1 "October 2005" "@PACKAGE_STRING@" "Wine Developers Manual"
|
||||
.SH NAME
|
||||
widl \- Wine Interface Definition Language Compiler
|
||||
.SH SYNOPSIS
|
||||
.BR "widl "\fI[options]\fR " \fIinfile.idl\fR"
|
||||
.SH DESCRIPTION
|
||||
.B widl
|
||||
is a Wine tool which purpose is to compile Interface Definition Language (IDL) files.
|
||||
.PP
|
||||
.SH OPTIONS
|
||||
.B Help mode:
|
||||
.nf
|
||||
No options are used.
|
||||
The program prints the help info and then exits.
|
||||
.PP
|
||||
.B General options:
|
||||
.IP "\fB-V\fR"
|
||||
Print version number and exits from the program.
|
||||
.PP
|
||||
.B Header options:
|
||||
.IP "\fB-h\fR"
|
||||
Generate header files.
|
||||
.IP "\fB-H \fIfile\fR"
|
||||
Name of header file to generate. The default header
|
||||
filename is infile.h.
|
||||
.IP "\fB--oldnames\fR"
|
||||
Use old naming conventions.
|
||||
.PP
|
||||
.B Type library options:
|
||||
.IP \fB-t\fR
|
||||
Generate a type library.
|
||||
.IP "\fB-T \fIfile\fR"
|
||||
Define the name of the type library to be generated.
|
||||
The default filename is infile.tlb.
|
||||
.PP
|
||||
.B Proxy/stub generation options:
|
||||
.IP "\fB-c\fR"
|
||||
Generate client stub.
|
||||
.IP "\fB-C \fIfile\fR"
|
||||
Name of client stub file (default is infile_c.c)
|
||||
.IP "\fB-p\fR"
|
||||
Generate proxy.
|
||||
.IP "\fB-P \fIfile\fR"
|
||||
Name of proxy file (default is infile_p.c)
|
||||
.IP "\fB-s\fR"
|
||||
Generate server stub.
|
||||
.IP "\fB-S \fIfile\fR"
|
||||
Name of server stub file (default is infile_s.c)
|
||||
.PP
|
||||
.B Preprocessor options:
|
||||
.IP "\fB-I \fIpath\fR"
|
||||
Add a header search dir to path. Multiple search
|
||||
dirs are allowed.
|
||||
.IP "\fB-D \fIid[=val]\fR"
|
||||
Define preprocessor identifier id value.
|
||||
.IP "\fB-E\fR"
|
||||
Preprocess only.
|
||||
.IP "\fB-N\fR"
|
||||
Do not preprocess input.
|
||||
.PP
|
||||
.B Debug options:
|
||||
.IP "\fB-W\fR"
|
||||
Enable pedantic warnings.
|
||||
.IP "\fB-d \fIn\fR"
|
||||
.nf
|
||||
Set debug level to n.
|
||||
n may be '0x01', '0x02', '0x04', '0x08', '0x10' or '0x20'.
|
||||
(See section \fBDebug\fR)
|
||||
.PP
|
||||
.SH Debug
|
||||
Debug level 'n' is a bitmask with the following meaning:
|
||||
* 0x01 Tell which resource is parsed (verbose mode)
|
||||
* 0x02 Dump internal structures
|
||||
* 0x04 Create a parser trace (yydebug=1)
|
||||
* 0x08 Preprocessor messages
|
||||
* 0x10 Preprocessor lex messages
|
||||
* 0x20 Preprocessor yacc trace
|
||||
.SH BUGS
|
||||
Typelib generation doesn't work at the moment. It is still under development.
|
||||
.SH AUTHORS
|
||||
.B widl
|
||||
was written by Ove Kaaven. This man page was written by Hannu
|
||||
Valtonen.
|
||||
.SH "SEE ALSO"
|
||||
The Winelib User Guide
|
||||
.nf
|
||||
The Wine Developers Guide
|
||||
@@ -21,53 +21,44 @@
|
||||
#ifndef __WIDL_WIDLTYPES_H
|
||||
#define __WIDL_WIDLTYPES_H
|
||||
|
||||
#include <host/typedefs.h>
|
||||
#define S_OK ((HRESULT)0x00000000L)
|
||||
#define S_FALSE ((HRESULT)0x00000001L)
|
||||
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
|
||||
#define TYPE_E_IOERROR ((HRESULT)0x80028CA2L)
|
||||
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define max(a,b) ((a) < (b) ? (b) : (a))
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "guiddef.h"
|
||||
#include "wine/rpcfc.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
#ifndef UUID_DEFINED
|
||||
#define UUID_DEFINED
|
||||
typedef GUID UUID;
|
||||
#endif
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
typedef struct _attr_t attr_t;
|
||||
typedef struct _expr_t expr_t;
|
||||
typedef struct _type_t type_t;
|
||||
typedef struct _typeref_t typeref_t;
|
||||
typedef struct _var_t var_t;
|
||||
typedef struct _pident_t pident_t;
|
||||
typedef struct _func_t func_t;
|
||||
typedef struct _ifref_t ifref_t;
|
||||
typedef struct _typelib_entry_t typelib_entry_t;
|
||||
typedef struct _importlib_t importlib_t;
|
||||
typedef struct _importinfo_t importinfo_t;
|
||||
typedef struct _typelib_t typelib_t;
|
||||
typedef struct _user_type_t user_type_t;
|
||||
typedef struct _user_type_t context_handle_t;
|
||||
|
||||
#define DECL_LINK(type) \
|
||||
type *l_next; \
|
||||
type *l_prev
|
||||
|
||||
#define LINK(x,y) do { x->l_next = y; if (y) y->l_prev = x; } while (0)
|
||||
|
||||
#define INIT_LINK(x) do { x->l_next = NULL; x->l_prev = NULL; } while (0)
|
||||
#define NEXT_LINK(x) ((x)->l_next)
|
||||
#define PREV_LINK(x) ((x)->l_prev)
|
||||
|
||||
#define END_OF_LIST(list) \
|
||||
do { \
|
||||
if (list) { \
|
||||
while (NEXT_LINK(list)) \
|
||||
list = NEXT_LINK(list); \
|
||||
} \
|
||||
} while(0)
|
||||
typedef struct list attr_list_t;
|
||||
typedef struct list str_list_t;
|
||||
typedef struct list func_list_t;
|
||||
typedef struct list expr_list_t;
|
||||
typedef struct list var_list_t;
|
||||
typedef struct list pident_list_t;
|
||||
typedef struct list ifref_list_t;
|
||||
typedef struct list array_dims_t;
|
||||
typedef struct list user_type_list_t;
|
||||
typedef struct list context_handle_list_t;
|
||||
|
||||
enum attr_type
|
||||
{
|
||||
@@ -146,6 +137,7 @@ enum expr_type
|
||||
EXPR_VOID,
|
||||
EXPR_NUM,
|
||||
EXPR_HEXNUM,
|
||||
EXPR_DOUBLE,
|
||||
EXPR_IDENTIFIER,
|
||||
EXPR_NEG,
|
||||
EXPR_NOT,
|
||||
@@ -162,6 +154,7 @@ enum expr_type
|
||||
EXPR_OR,
|
||||
EXPR_COND,
|
||||
EXPR_TRUEFALSE,
|
||||
EXPR_ADDRESSOF,
|
||||
};
|
||||
|
||||
enum type_kind
|
||||
@@ -178,6 +171,12 @@ enum type_kind
|
||||
TKIND_MAX
|
||||
};
|
||||
|
||||
struct str_list_entry_t
|
||||
{
|
||||
char *str;
|
||||
struct list entry;
|
||||
};
|
||||
|
||||
struct _attr_t {
|
||||
enum attr_type type;
|
||||
union {
|
||||
@@ -185,7 +184,7 @@ struct _attr_t {
|
||||
void *pval;
|
||||
} u;
|
||||
/* parser-internal */
|
||||
DECL_LINK(attr_t);
|
||||
struct list entry;
|
||||
};
|
||||
|
||||
struct _expr_t {
|
||||
@@ -193,15 +192,16 @@ struct _expr_t {
|
||||
const expr_t *ref;
|
||||
union {
|
||||
long lval;
|
||||
double dval;
|
||||
const char *sval;
|
||||
const expr_t *ext;
|
||||
const typeref_t *tref;
|
||||
type_t *tref;
|
||||
} u;
|
||||
const expr_t *ext2;
|
||||
int is_const;
|
||||
long cval;
|
||||
/* parser-internal */
|
||||
DECL_LINK(expr_t);
|
||||
struct list entry;
|
||||
};
|
||||
|
||||
struct _type_t {
|
||||
@@ -209,65 +209,65 @@ struct _type_t {
|
||||
enum type_kind kind;
|
||||
unsigned char type;
|
||||
struct _type_t *ref;
|
||||
const attr_t *attrs;
|
||||
func_t *funcs; /* interfaces and modules */
|
||||
var_t *fields; /* interfaces, structures and enumerations */
|
||||
ifref_t *ifaces; /* coclasses */
|
||||
int ignore, is_const, sign;
|
||||
int defined, written, user_types_registered;
|
||||
const attr_list_t *attrs;
|
||||
func_list_t *funcs; /* interfaces and modules */
|
||||
var_list_t *fields; /* interfaces, structures and enumerations */
|
||||
ifref_list_t *ifaces; /* coclasses */
|
||||
unsigned long dim; /* array dimension */
|
||||
expr_t *size_is, *length_is;
|
||||
type_t *orig; /* dup'd types */
|
||||
unsigned int typestring_offset;
|
||||
unsigned int ptrdesc; /* used for complex structs */
|
||||
int typelib_idx;
|
||||
/* parser-internal */
|
||||
DECL_LINK(type_t);
|
||||
};
|
||||
|
||||
struct _typeref_t {
|
||||
char *name;
|
||||
type_t *ref;
|
||||
int uniq;
|
||||
unsigned int declarray : 1; /* if declared as an array */
|
||||
unsigned int ignore : 1;
|
||||
unsigned int is_const : 1;
|
||||
unsigned int defined : 1;
|
||||
unsigned int written : 1;
|
||||
unsigned int user_types_registered : 1;
|
||||
unsigned int tfswrite : 1; /* if the type needs to be written to the TFS */
|
||||
int sign : 2;
|
||||
};
|
||||
|
||||
struct _var_t {
|
||||
char *name;
|
||||
int ptr_level;
|
||||
expr_t *array;
|
||||
type_t *type;
|
||||
var_t *args; /* for function pointers */
|
||||
const char *tname;
|
||||
attr_t *attrs;
|
||||
var_list_t *args; /* for function pointers */
|
||||
attr_list_t *attrs;
|
||||
expr_t *eval;
|
||||
|
||||
/* parser-internal */
|
||||
DECL_LINK(var_t);
|
||||
struct list entry;
|
||||
};
|
||||
|
||||
struct _pident_t {
|
||||
var_t *var;
|
||||
int ptr_level;
|
||||
|
||||
/* parser-internal */
|
||||
struct list entry;
|
||||
};
|
||||
|
||||
struct _func_t {
|
||||
var_t *def;
|
||||
var_t *args;
|
||||
var_list_t *args;
|
||||
int ignore, idx;
|
||||
|
||||
/* parser-internal */
|
||||
DECL_LINK(func_t);
|
||||
struct list entry;
|
||||
};
|
||||
|
||||
struct _ifref_t {
|
||||
type_t *iface;
|
||||
attr_t *attrs;
|
||||
attr_list_t *attrs;
|
||||
|
||||
/* parser-internal */
|
||||
DECL_LINK(ifref_t);
|
||||
struct list entry;
|
||||
};
|
||||
|
||||
struct _typelib_entry_t {
|
||||
enum type_kind kind;
|
||||
union {
|
||||
type_t *class;
|
||||
type_t *interface;
|
||||
type_t *module;
|
||||
type_t *structure;
|
||||
type_t *enumeration;
|
||||
var_t *tdef;
|
||||
} u;
|
||||
DECL_LINK(typelib_entry_t);
|
||||
type_t *type;
|
||||
struct list entry;
|
||||
};
|
||||
|
||||
struct _importinfo_t {
|
||||
@@ -292,15 +292,39 @@ struct _importlib_t {
|
||||
|
||||
int allocated;
|
||||
|
||||
DECL_LINK(importlib_t);
|
||||
struct list entry;
|
||||
};
|
||||
|
||||
struct _typelib_t {
|
||||
char *name;
|
||||
char *filename;
|
||||
attr_t *attrs;
|
||||
typelib_entry_t *entry;
|
||||
importlib_t *importlibs;
|
||||
attr_list_t *attrs;
|
||||
struct list entries;
|
||||
struct list importlibs;
|
||||
};
|
||||
|
||||
struct _user_type_t {
|
||||
struct list entry;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
extern unsigned char pointer_default;
|
||||
|
||||
extern user_type_list_t user_type_list;
|
||||
void check_for_user_types_and_context_handles(const var_list_t *list);
|
||||
|
||||
void init_types(void);
|
||||
type_t *alloc_type(void);
|
||||
void set_all_tfswrite(int val);
|
||||
|
||||
type_t *duptype(type_t *t, int dupname);
|
||||
type_t *alias(type_t *t, const char *name);
|
||||
|
||||
int is_ptr(const type_t *t);
|
||||
int is_array(const type_t *t);
|
||||
int is_var_ptr(const var_t *v);
|
||||
int cant_be_null(const var_t *v);
|
||||
int is_struct(unsigned char tc);
|
||||
int is_union(unsigned char tc);
|
||||
|
||||
#endif
|
||||
|
||||
+279
-323
File diff suppressed because it is too large
Load Diff
@@ -1,447 +0,0 @@
|
||||
/*
|
||||
* IDL Compiler
|
||||
*
|
||||
* Copyright 2005-2006 Eric Kohl
|
||||
*
|
||||
* 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 "wine/port.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "widl.h"
|
||||
#include "utils.h"
|
||||
#include "parser.h"
|
||||
#include "header.h"
|
||||
|
||||
#include "widltypes.h"
|
||||
#include "typegen.h"
|
||||
|
||||
static FILE* client;
|
||||
static int indent = 0;
|
||||
|
||||
static void print_client( const char *format, ... )
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
print(client, indent, format, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
|
||||
static void check_pointers(const func_t *func)
|
||||
{
|
||||
const var_t *var;
|
||||
|
||||
if (!func->args)
|
||||
return;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||
{
|
||||
if (is_var_ptr(var) && cant_be_null(var))
|
||||
{
|
||||
print_client("if (!%s)\n", var->name);
|
||||
print_client("{\n");
|
||||
indent++;
|
||||
print_client("RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
|
||||
indent--;
|
||||
print_client("}\n\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
|
||||
{
|
||||
const func_t *func;
|
||||
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
|
||||
const var_t *var;
|
||||
int method_count = 0;
|
||||
|
||||
if (!implicit_handle)
|
||||
print_client("static RPC_BINDING_HANDLE %s__MIDL_AutoBindHandle;\n\n", iface->name);
|
||||
|
||||
if (iface->funcs) LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
|
||||
{
|
||||
const var_t *def = func->def;
|
||||
const var_t* explicit_handle_var;
|
||||
|
||||
/* check for a defined binding handle */
|
||||
explicit_handle_var = get_explicit_handle_var(func);
|
||||
if (explicit_handle)
|
||||
{
|
||||
if (!explicit_handle_var)
|
||||
{
|
||||
error("%s() does not define an explicit binding handle!\n", def->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (implicit_handle)
|
||||
{
|
||||
if (explicit_handle_var)
|
||||
{
|
||||
error("%s() must not define a binding handle!\n", def->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
write_type_decl_left(client, def->type);
|
||||
if (needs_space_after(def->type))
|
||||
fprintf(client, " ");
|
||||
write_prefix_name(client, prefix_client, def);
|
||||
fprintf(client, "(\n");
|
||||
indent++;
|
||||
if (func->args)
|
||||
write_args(client, func->args, iface->name, 0, TRUE);
|
||||
else
|
||||
print_client("void");
|
||||
fprintf(client, ")\n");
|
||||
indent--;
|
||||
|
||||
/* write the functions body */
|
||||
fprintf(client, "{\n");
|
||||
indent++;
|
||||
|
||||
/* declare return value '_RetVal' */
|
||||
if (!is_void(def->type))
|
||||
{
|
||||
print_client("");
|
||||
write_type_decl_left(client, def->type);
|
||||
fprintf(client, " _RetVal;\n");
|
||||
}
|
||||
|
||||
if (implicit_handle || explicit_handle_var)
|
||||
print_client("RPC_BINDING_HANDLE _Handle = 0;\n");
|
||||
|
||||
print_client("RPC_MESSAGE _RpcMessage;\n");
|
||||
print_client("MIDL_STUB_MESSAGE _StubMsg;\n");
|
||||
if (!is_void(def->type) && decl_indirect(def->type))
|
||||
{
|
||||
print_client("void *_p_%s = &%s;\n",
|
||||
"_RetVal", "_RetVal");
|
||||
}
|
||||
fprintf(client, "\n");
|
||||
|
||||
/* check pointers */
|
||||
check_pointers(func);
|
||||
|
||||
print_client("RpcTryFinally\n");
|
||||
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");
|
||||
|
||||
if (implicit_handle)
|
||||
{
|
||||
print_client("_Handle = %s;\n", implicit_handle);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
else if (explicit_handle_var)
|
||||
{
|
||||
print_client("_Handle = %s;\n", explicit_handle_var->name);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
|
||||
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");
|
||||
if (implicit_handle || explicit_handle_var)
|
||||
print_client("_Handle);\n");
|
||||
else
|
||||
print_client("%s__MIDL_AutoBindHandle);\n", iface->name);
|
||||
indent--;
|
||||
fprintf(client, "\n");
|
||||
|
||||
/* marshal arguments */
|
||||
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("(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("_StubMsg.BufferStart = (unsigned char *)_RpcMessage.Buffer;\n");
|
||||
print_client("_StubMsg.BufferEnd = _StubMsg.BufferStart + _RpcMessage.BufferLength;\n");
|
||||
|
||||
if (has_out_arg_or_return(func))
|
||||
{
|
||||
fprintf(client, "\n");
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* unmarshall arguments */
|
||||
fprintf(client, "\n");
|
||||
write_remoting_arguments(client, indent, func, PASS_OUT, PHASE_UNMARSHAL);
|
||||
|
||||
/* unmarshal return value */
|
||||
if (!is_void(def->type))
|
||||
{
|
||||
if (decl_indirect(def->type))
|
||||
print_client("MIDL_memset(&%s, 0, sizeof(%s));\n", "_RetVal", "_RetVal");
|
||||
else if (is_ptr(def->type) || is_array(def->type))
|
||||
print_client("%s = 0;\n", "_RetVal");
|
||||
write_remoting_arguments(client, indent, func, PASS_RETURN, PHASE_UNMARSHAL);
|
||||
}
|
||||
|
||||
/* update proc_offset */
|
||||
if (func->args)
|
||||
{
|
||||
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||
*proc_offset += get_size_procformatstring_var(var);
|
||||
}
|
||||
if (!is_void(def->type))
|
||||
*proc_offset += get_size_procformatstring_var(def);
|
||||
else
|
||||
*proc_offset += 2; /* FC_END and FC_PAD */
|
||||
|
||||
indent--;
|
||||
print_client("}\n");
|
||||
print_client("RpcFinally\n");
|
||||
print_client("{\n");
|
||||
indent++;
|
||||
|
||||
|
||||
/* FIXME: emit client finally code */
|
||||
|
||||
print_client("NdrFreeBuffer((PMIDL_STUB_MESSAGE)&_StubMsg);\n");
|
||||
|
||||
indent--;
|
||||
print_client("}\n");
|
||||
print_client("RpcEndFinally\n");
|
||||
|
||||
|
||||
/* emit return code */
|
||||
if (!is_void(def->type))
|
||||
{
|
||||
fprintf(client, "\n");
|
||||
print_client("return _RetVal;\n");
|
||||
}
|
||||
|
||||
indent--;
|
||||
fprintf(client, "}\n");
|
||||
fprintf(client, "\n");
|
||||
|
||||
method_count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void write_stubdescdecl(type_t *iface)
|
||||
{
|
||||
print_client("static const MIDL_STUB_DESC %s_StubDesc;\n", iface->name);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
|
||||
|
||||
static void write_stubdescriptor(type_t *iface, int expr_eval_routines)
|
||||
{
|
||||
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||
|
||||
print_client("static const MIDL_STUB_DESC %s_StubDesc =\n", iface->name);
|
||||
print_client("{\n");
|
||||
indent++;
|
||||
print_client("(void *)& %s___RpcClientInterface,\n", iface->name);
|
||||
print_client("MIDL_user_allocate,\n");
|
||||
print_client("MIDL_user_free,\n");
|
||||
print_client("{\n");
|
||||
indent++;
|
||||
if (implicit_handle)
|
||||
print_client("&%s,\n", implicit_handle);
|
||||
else
|
||||
print_client("&%s__MIDL_AutoBindHandle,\n", iface->name);
|
||||
indent--;
|
||||
print_client("},\n");
|
||||
print_client("0,\n");
|
||||
print_client("0,\n");
|
||||
if (expr_eval_routines)
|
||||
print_client("ExprEvalRoutines,\n");
|
||||
else
|
||||
print_client("0,\n");
|
||||
print_client("0,\n");
|
||||
print_client("__MIDL_TypeFormatString.Format,\n");
|
||||
print_client("1, /* -error bounds_check flag */\n");
|
||||
print_client("0x10001, /* Ndr library version */\n");
|
||||
print_client("0,\n");
|
||||
print_client("0x50100a4, /* MIDL Version 5.1.164 */\n");
|
||||
print_client("0,\n");
|
||||
print_client("%s,\n", list_empty(&user_type_list) ? "0" : "UserMarshalRoutines");
|
||||
print_client("0, /* notify & notify_flag routine table */\n");
|
||||
print_client("1, /* Flags */\n");
|
||||
print_client("0, /* Reserved3 */\n");
|
||||
print_client("0, /* Reserved4 */\n");
|
||||
print_client("0 /* Reserved5 */\n");
|
||||
indent--;
|
||||
print_client("};\n");
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
|
||||
|
||||
static void write_clientinterfacedecl(type_t *iface)
|
||||
{
|
||||
unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION);
|
||||
const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
|
||||
const str_list_t *endpoints = get_attrp(iface->attrs, ATTR_ENDPOINT);
|
||||
|
||||
if (endpoints) write_endpoints( client, iface->name, endpoints );
|
||||
|
||||
print_client("static const RPC_CLIENT_INTERFACE %s___RpcClientInterface =\n", iface->name );
|
||||
print_client("{\n");
|
||||
indent++;
|
||||
print_client("sizeof(RPC_CLIENT_INTERFACE),\n");
|
||||
print_client("{{0x%08lx,0x%04x,0x%04x,{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x}},{%d,%d}},\n",
|
||||
uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1],
|
||||
uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5], uuid->Data4[6],
|
||||
uuid->Data4[7], MAJORVERSION(ver), MINORVERSION(ver));
|
||||
print_client("{{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},\n"); /* FIXME */
|
||||
print_client("0,\n");
|
||||
if (endpoints)
|
||||
{
|
||||
print_client("%u,\n", list_count(endpoints));
|
||||
print_client("(PRPC_PROTSEQ_ENDPOINT)%s__RpcProtseqEndpoint,\n", iface->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_client("0,\n");
|
||||
print_client("0,\n");
|
||||
}
|
||||
print_client("0,\n");
|
||||
print_client("0,\n");
|
||||
print_client("0,\n");
|
||||
indent--;
|
||||
print_client("};\n");
|
||||
if (old_names)
|
||||
print_client("RPC_IF_HANDLE %s_ClientIfHandle = (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",
|
||||
prefix_client, iface->name, MAJORVERSION(ver), MINORVERSION(ver), iface->name);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
|
||||
|
||||
static void write_implicithandledecl(type_t *iface)
|
||||
{
|
||||
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||
|
||||
if (implicit_handle)
|
||||
{
|
||||
fprintf(client, "handle_t %s;\n", implicit_handle);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void init_client(void)
|
||||
{
|
||||
if (client) return;
|
||||
if (!(client = fopen(client_name, "w")))
|
||||
error("Could not open %s for output\n", client_name);
|
||||
|
||||
print_client("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
|
||||
print_client("#include <string.h>\n");
|
||||
print_client("#ifdef _ALPHA_\n");
|
||||
print_client("#include <stdarg.h>\n");
|
||||
print_client("#endif\n");
|
||||
fprintf(client, "\n");
|
||||
print_client("#include \"%s\"\n", header_name);
|
||||
fprintf(client, "\n");
|
||||
}
|
||||
|
||||
|
||||
void write_client(ifref_list_t *ifaces)
|
||||
{
|
||||
unsigned int proc_offset = 0;
|
||||
int expr_eval_routines;
|
||||
ifref_t *iface;
|
||||
|
||||
if (!do_client)
|
||||
return;
|
||||
if (do_everything && !need_stub_files(ifaces))
|
||||
return;
|
||||
|
||||
init_client();
|
||||
if (!client)
|
||||
return;
|
||||
|
||||
write_formatstringsdecl(client, indent, ifaces, need_stub);
|
||||
expr_eval_routines = write_expr_eval_routines(client, client_token);
|
||||
if (expr_eval_routines)
|
||||
write_expr_eval_routine_list(client, client_token);
|
||||
write_user_quad_list(client);
|
||||
|
||||
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, ifref_t, entry )
|
||||
{
|
||||
if (!need_stub(iface->iface))
|
||||
continue;
|
||||
|
||||
fprintf(client, "/*****************************************************************************\n");
|
||||
fprintf(client, " * %s interface\n", iface->iface->name);
|
||||
fprintf(client, " */\n");
|
||||
fprintf(client, "\n");
|
||||
|
||||
if (iface->iface->funcs)
|
||||
{
|
||||
write_implicithandledecl(iface->iface);
|
||||
|
||||
write_clientinterfacedecl(iface->iface);
|
||||
write_stubdescdecl(iface->iface);
|
||||
write_function_stubs(iface->iface, &proc_offset);
|
||||
|
||||
print_client("#if !defined(__RPC_WIN32__)\n");
|
||||
print_client("#error Invalid build platform for this stub.\n");
|
||||
print_client("#endif\n");
|
||||
|
||||
fprintf(client, "\n");
|
||||
write_stubdescriptor(iface->iface, expr_eval_routines);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(client, "\n");
|
||||
|
||||
write_procformatstring(client, ifaces, need_stub);
|
||||
write_typeformatstring(client, ifaces, need_stub);
|
||||
|
||||
fclose(client);
|
||||
}
|
||||
@@ -1,622 +0,0 @@
|
||||
/*
|
||||
* Oleaut32 hash functions
|
||||
*
|
||||
* Copyright 1999 Corel Corporation
|
||||
* Copyright 2001-2003 Jon Griffiths
|
||||
*
|
||||
* 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 <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
|
||||
#include "hash.h"
|
||||
|
||||
static const unsigned char Lookup_16[128 * 3] = {
|
||||
/* Common */
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
|
||||
0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
|
||||
0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x00, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40,
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D,
|
||||
0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x56, 0x58, 0x55, 0x5A,
|
||||
0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
|
||||
0x55, 0x56, 0x56, 0x58, 0x55, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
|
||||
/* Windows */
|
||||
0x7F, 0x7F, 0x82, 0x46, 0x84, 0x85, 0x86, 0x87, 0x7F, 0x89, 0x53, 0x8B, 0x8C,
|
||||
0x7F, 0x7F, 0x7F, 0x7F, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x96, 0x98, 0x99,
|
||||
0x53, 0x9B, 0x8C, 0x7F, 0x7F, 0x55, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0x41, 0xAB, 0xAC, 0x96, 0xAE, 0xAF, 0xB0, 0xB1, 0x32, 0x33,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0x31, 0x4F, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0x41,
|
||||
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49,
|
||||
0x49, 0x49, 0x44, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0xD7, 0x4F, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0xDE, 0xDF, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43,
|
||||
0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49, 0x44, 0x4E, 0x4F, 0x4F, 0x4F,
|
||||
0x4F, 0x4F, 0xF7, 0x4F, 0x55, 0x55, 0x55, 0x55, 0x55, 0xDE, 0x55,
|
||||
|
||||
/* Mac */
|
||||
0x41, 0x41, 0x43, 0x45, 0x4E, 0x4F, 0x55, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
|
||||
0x43, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49, 0x4E, 0x4F, 0x4F, 0x4F,
|
||||
0x4F, 0x4F, 0x55, 0x55, 0x55, 0x55, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0x41, 0x4F, 0xB0, 0xB1, 0xB2, 0xB3,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0x41, 0x4F, 0xBD, 0x41, 0x4F, 0xC0,
|
||||
0xC1, 0xC2, 0xC3, 0x46, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0x41, 0x41, 0x4F,
|
||||
0xCE, 0xCE, 0xD0, 0xD0, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0x55, 0x55, 0xDA,
|
||||
0xDB, 0xDC, 0xDD, 0x3F, 0x3F, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0x41, 0x45, 0x41,
|
||||
0x45, 0x45, 0x49, 0x49, 0x49, 0x49, 0x4F, 0x4F, 0x3F, 0x4F, 0x55, 0x55, 0x55,
|
||||
0x49, 0x7F, 0xF7, 0x7F, 0xF9, 0xFA, 0xFB, 0x3F, 0xFD, 0xFE, 0x7F
|
||||
};
|
||||
|
||||
static const unsigned char Lookup_32[128 * 3] = {
|
||||
/* Common */
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
|
||||
0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
|
||||
0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x00, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40,
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D,
|
||||
0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A,
|
||||
0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
|
||||
0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
|
||||
/* Windows */
|
||||
0x7F, 0x7F, 0x82, 0x7F, 0x84, 0x85, 0x86, 0x87, 0x7F, 0x89, 0x53, 0x8B, 0x53,
|
||||
0x54, 0x5A, 0x5A, 0x7F, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x96, 0x7F, 0x99,
|
||||
0x53, 0x9B, 0x53, 0x54, 0x5A, 0x5A, 0xA0, 0x7F, 0xA2, 0x4C, 0xA4, 0x41, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0x53, 0xAB, 0xAC, 0x96, 0xAE, 0x5A, 0xB0, 0xB1, 0xB2, 0x4C,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0x41, 0x53, 0xBB, 0x4C, 0xBD, 0x4C, 0x5A, 0x52,
|
||||
0x41, 0x41, 0x41, 0x41, 0x4C, 0x43, 0x43, 0x43, 0x45, 0x45, 0x45, 0x45, 0x49,
|
||||
0x49, 0x44, 0xD0, 0x4E, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0xD7, 0x52, 0x55, 0x55,
|
||||
0x55, 0x55, 0x59, 0x54, 0xDF, 0x52, 0x41, 0x41, 0x41, 0x41, 0x4C, 0x43, 0x43,
|
||||
0x43, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x44, 0xD0, 0x4E, 0x4E, 0x4F, 0x4F,
|
||||
0x4F, 0x4F, 0xF7, 0x52, 0x55, 0x55, 0x55, 0x55, 0x59, 0x54, 0xFF,
|
||||
|
||||
/* Mac */
|
||||
0x41, 0x41, 0x41, 0x45, 0x41, 0x4F, 0x55, 0x41, 0x41, 0x43, 0x41, 0x43, 0x43,
|
||||
0x43, 0x45, 0x5A, 0x5A, 0x44, 0x49, 0x44, 0x45, 0x45, 0x45, 0x4F, 0x45, 0x4F,
|
||||
0x4F, 0x4F, 0x55, 0x45, 0x45, 0x55, 0xA0, 0xA1, 0x45, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0xAA, 0x45, 0xAC, 0xAD, 0x47, 0x49, 0x49, 0x49, 0xB2, 0xB3,
|
||||
0x49, 0x4B, 0xB6, 0xB7, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, 0x4E, 0x4E,
|
||||
0x4E, 0xC2, 0xC3, 0x4E, 0x4E, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0x4E, 0x4F, 0x4F,
|
||||
0x4F, 0x4F, 0xD0, 0xD0, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0x4F, 0x52, 0x52,
|
||||
0x52, 0xDC, 0xDD, 0x52, 0x52, 0x52, 0x53, 0xE2, 0xE3, 0x53, 0x53, 0x53, 0x41,
|
||||
0x54, 0x54, 0x49, 0x5A, 0x5A, 0x55, 0x4F, 0x4F, 0x55, 0x55, 0x55, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0x59, 0x59, 0x4B, 0x5A, 0x4C, 0x4C, 0x47, 0xFF
|
||||
};
|
||||
|
||||
static const unsigned char Lookup_48[128 * 3] = {
|
||||
/* Common */
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
|
||||
0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
|
||||
0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x00, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40,
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D,
|
||||
0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A,
|
||||
0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
|
||||
0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
|
||||
/* Windows */
|
||||
0x7F, 0x7F, 0x82, 0x46, 0x84, 0x85, 0x86, 0x87, 0x7F, 0x89, 0x53, 0x8B, 0x8C,
|
||||
0x7F, 0x7F, 0x7F, 0x7F, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x96, 0x98, 0x99,
|
||||
0x53, 0x9B, 0x8C, 0x7F, 0x7F, 0x59, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0x41, 0xAB, 0xAC, 0x96, 0xAE, 0xAF, 0xB0, 0xB1, 0x32, 0x33,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0x31, 0x4F, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0x41,
|
||||
0x41, 0x41, 0x41, 0x41, 0x41, 0xC6, 0x43, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49,
|
||||
0x49, 0x49, 0xD0, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0xD7, 0x4F, 0x55, 0x55,
|
||||
0x55, 0x55, 0x59, 0xDE, 0xDF, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0xC6, 0x43,
|
||||
0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49, 0xD0, 0x4E, 0x4F, 0x4F, 0x4F,
|
||||
0x4F, 0x4F, 0xF7, 0x4F, 0x55, 0x55, 0x55, 0x55, 0x59, 0xDE, 0x59,
|
||||
|
||||
/* Mac */
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C,
|
||||
0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
|
||||
0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAB, 0xAD, 0xAE, 0xAE, 0xB0, 0xB1, 0xB2, 0xB3,
|
||||
0xA7, 0xB5, 0xB6, 0xB7, 0xB8, 0xB8, 0xBA, 0xBA, 0xBC, 0xBC, 0xBE, 0xBE, 0xB7,
|
||||
0xC1, 0xC2, 0xC3, 0x46, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCB, 0xCD,
|
||||
0xCD, 0xC1, 0xD0, 0xD0, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD8, 0xDA,
|
||||
0xDA, 0xDC, 0xDD, 0xDD, 0x9F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94,
|
||||
0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F
|
||||
};
|
||||
|
||||
static const unsigned char Lookup_64[128 * 3] = {
|
||||
/* Common */
|
||||
0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
|
||||
0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x00, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40,
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D,
|
||||
0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x56, 0x58, 0x55, 0x5A,
|
||||
0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
|
||||
0x55, 0x56, 0x56, 0x58, 0x55, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
|
||||
/* Windows */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0x41, 0xAB, 0xAC, 0x96, 0xAE, 0xAF, 0xB0, 0xB1, 0x32, 0x33,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0x31, 0x4F, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0x41,
|
||||
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49,
|
||||
0x49, 0x49, 0x44, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0xD7, 0x4F, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0xDE, 0xDF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
/* Mac */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0x41, 0xAB, 0xAC, 0x96, 0xAE, 0xAF, 0xB0, 0xB1, 0x32, 0x33,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0x31, 0x4F, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0x41,
|
||||
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49,
|
||||
0x49, 0x49, 0x44, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0xD7, 0x4F, 0x55, 0x55,
|
||||
0x55, 0x55, 0x55, 0xDE, 0xDF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
static const unsigned char Lookup_80[128 * 3] = {
|
||||
/* Common */
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
|
||||
0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
|
||||
0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x00, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40,
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D,
|
||||
0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x56, 0x58, 0x55, 0x5A,
|
||||
0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
|
||||
0x55, 0x56, 0x56, 0x58, 0x55, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
|
||||
/* Windows */
|
||||
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55,
|
||||
|
||||
/* Mac */
|
||||
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55,
|
||||
};
|
||||
|
||||
static const unsigned char Lookup_112[128 * 3] = {
|
||||
/* Common */
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
|
||||
0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
|
||||
0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x00, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40,
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D,
|
||||
0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x56, 0x58, 0x55, 0x5A,
|
||||
0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
|
||||
0x55, 0x56, 0x56, 0x58, 0x55, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
|
||||
/* Windows */
|
||||
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55,
|
||||
|
||||
/* Mac */
|
||||
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55,
|
||||
};
|
||||
|
||||
static const unsigned char Lookup_128[128 * 3] = {
|
||||
/* Common */
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
|
||||
0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
|
||||
0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40,
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D,
|
||||
0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A,
|
||||
0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
|
||||
0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x00,
|
||||
|
||||
/* Windows */
|
||||
0x00, 0x00, 0x82, 0x46, 0x84, 0x85, 0x86, 0x87, 0x00, 0x89, 0x00, 0x8B, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x2D, 0x2D, 0x00, 0x99,
|
||||
0x00, 0x9B, 0x00, 0x00, 0x00, 0x00, 0x09, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0x00, 0xAB, 0xAC, 0x2D, 0xAE, 0x2D, 0xB0, 0xB1, 0x32, 0x33,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xBA,
|
||||
0xA2, 0xC2, 0xC3, 0xC4, 0xB8, 0xC6, 0xB9, 0xC8, 0xBA, 0xCA, 0xCB, 0xCC, 0xCD,
|
||||
0xCE, 0xBC, 0xD0, 0xD1, 0x00, 0xD3, 0xD4, 0xBE, 0xD6, 0xD7, 0xD8, 0xBF, 0xBA,
|
||||
0xBE, 0xA2, 0xB8, 0xB9, 0xBA, 0xBE, 0xA2, 0xC2, 0xC3, 0xC4, 0xB8, 0xC6, 0xB9,
|
||||
0xC8, 0xBA, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xBC, 0xD0, 0xD1, 0xD3, 0xD3, 0xD4,
|
||||
0xBE, 0xD6, 0xD7, 0xD8, 0xBF, 0xBA, 0xBE, 0xBC, 0xBE, 0xBF, 0x00,
|
||||
|
||||
/* Mac */
|
||||
0x41, 0x31, 0x32, 0x45, 0x33, 0x4F, 0x55, 0x87, 0x41, 0x41, 0x41, 0x00, 0x8C,
|
||||
0x43, 0x45, 0x45, 0x45, 0x45, 0x92, 0x93, 0x49, 0x49, 0x96, 0x97, 0x98, 0x4F,
|
||||
0x4F, 0x9B, 0x3F, 0x55, 0x55, 0x55, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xAB, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xB0,
|
||||
0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0x09, 0xBD, 0xCC, 0xB0,
|
||||
0xB6, 0xCF, 0x2D, 0x2D, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xB8, 0xAB, 0xC3, 0xBD,
|
||||
0xB6, 0xB8, 0xAB, 0xC3, 0xBF, 0xBD, 0xB0, 0xB5, 0xBE, 0xA2, 0xB6, 0xBC, 0xA1,
|
||||
0xB8, 0xAB, 0xA5, 0xBA, 0xA4, 0xBB, 0xC1, 0xC3, 0xA6, 0xBF, 0xC4, 0xAA, 0xC6,
|
||||
0xA3, 0xBF, 0xAA, 0xCC, 0xBD, 0xB7, 0xAB, 0xBD, 0xAB, 0xBD, 0x3F,
|
||||
};
|
||||
|
||||
static const unsigned char Lookup_144[128 * 3] = {
|
||||
/* Common */
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
|
||||
0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
|
||||
0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40,
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D,
|
||||
0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A,
|
||||
0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
|
||||
0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x00,
|
||||
|
||||
/* Windows */
|
||||
0x00, 0x00, 0x82, 0x46, 0x84, 0x85, 0x86, 0x87, 0x00, 0x89, 0x53, 0x8B, 0x8C,
|
||||
0x00, 0x00, 0x00, 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x2D, 0x2D, 0x98, 0x99,
|
||||
0x53, 0x9B, 0x8C, 0x00, 0x00, 0x59, 0x09, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0x41, 0xAB, 0xAC, 0x2D, 0xAE, 0xAF, 0xB0, 0xB1, 0x32, 0x33,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0x31, 0x4F, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0x41,
|
||||
0xC1, 0x41, 0x41, 0x41, 0x41, 0xC6, 0x43, 0x45, 0xC9, 0x45, 0x45, 0x49, 0xCD,
|
||||
0x49, 0x49, 0xD0, 0x4E, 0x4F, 0xD3, 0x4F, 0x4F, 0xD6, 0xD7, 0xD6, 0x55, 0xDA,
|
||||
0x55, 0x55, 0xDD, 0xDE, 0xDF, 0x41, 0xC1, 0x41, 0x41, 0x41, 0x41, 0xC6, 0x43,
|
||||
0x45, 0xC9, 0x45, 0x45, 0x49, 0xCD, 0x49, 0x49, 0xD0, 0x4E, 0x4F, 0xD3, 0x4F,
|
||||
0x4F, 0xD6, 0xF7, 0xD6, 0x55, 0xDA, 0x55, 0x55, 0xDD, 0xDE, 0x59,
|
||||
|
||||
/* Mac */
|
||||
0x00, 0x00, 0x82, 0x46, 0x84, 0x85, 0x86, 0x87, 0x00, 0x89, 0x53, 0x8B, 0x8C,
|
||||
0x00, 0x00, 0x00, 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x2D, 0x2D, 0x98, 0x99,
|
||||
0x53, 0x9B, 0x8C, 0x00, 0x00, 0x59, 0x09, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0x41, 0xAB, 0xAC, 0x2D, 0xAE, 0xAF, 0xB0, 0xB1, 0x32, 0x33,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0x31, 0x4F, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0x41,
|
||||
0xC1, 0x41, 0x41, 0x41, 0x41, 0xC6, 0x43, 0x45, 0xC9, 0x45, 0x45, 0x49, 0xCD,
|
||||
0x49, 0x49, 0xD0, 0x4E, 0x4F, 0xD3, 0x4F, 0x4F, 0xD6, 0xD7, 0xD6, 0x55, 0xDA,
|
||||
0x55, 0x55, 0xDD, 0xDE, 0xDF, 0x41, 0xC1, 0x41, 0x41, 0x41, 0x41, 0xC6, 0x43,
|
||||
0x45, 0xC9, 0x45, 0x45, 0x49, 0xCD, 0x49, 0x49, 0xD0, 0x4E, 0x4F, 0xD3, 0x4F,
|
||||
0x4F, 0xD6, 0xF7, 0xD6, 0x55, 0xDA, 0x55, 0x55, 0xDD, 0xDE, 0x59,
|
||||
};
|
||||
|
||||
static const unsigned char Lookup_160[128 * 3] = {
|
||||
/* Common */
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
|
||||
0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
|
||||
0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40,
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D,
|
||||
0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A,
|
||||
0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
|
||||
0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x00,
|
||||
|
||||
/* Windows */
|
||||
0x00, 0x00, 0x82, 0x46, 0x84, 0x85, 0x86, 0x87, 0x00, 0x89, 0x53, 0x8B, 0x8C,
|
||||
0x00, 0x00, 0x00, 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x2D, 0x2D, 0x98, 0x99,
|
||||
0x53, 0x9B, 0x8C, 0x00, 0x00, 0x59, 0x09, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0x41, 0xAB, 0xAC, 0x2D, 0xAE, 0xAF, 0xB0, 0xB1, 0x32, 0x33,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0x31, 0x4F, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0x41,
|
||||
0x41, 0x41, 0x41, 0x41, 0x41, 0xC6, 0xC7, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49,
|
||||
0x49, 0x49, 0xD0, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0xD6, 0xD7, 0x4F, 0x55, 0x55,
|
||||
0x55, 0xDC, 0xDD, 0xDE, 0xDF, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0xC6, 0xC7,
|
||||
0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49, 0xD0, 0x4E, 0x4F, 0x4F, 0x4F,
|
||||
0x4F, 0xD6, 0xF7, 0x4F, 0x55, 0x55, 0x55, 0xDC, 0xDD, 0xDE, 0x59,
|
||||
|
||||
/* Mac */
|
||||
0x00, 0x00, 0x82, 0x46, 0x84, 0x85, 0x86, 0x87, 0x00, 0x89, 0x53, 0x8B, 0x8C,
|
||||
0x00, 0x00, 0x00, 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x2D, 0x2D, 0x98, 0x99,
|
||||
0x53, 0x9B, 0x8C, 0x00, 0x00, 0x59, 0x09, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0x41, 0xAB, 0xAC, 0x2D, 0xAE, 0xAF, 0xB0, 0xB1, 0x32, 0x33,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0x31, 0x4F, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0x41,
|
||||
0x41, 0x41, 0x41, 0x41, 0x41, 0xC6, 0xC7, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49,
|
||||
0x49, 0x49, 0xD0, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0xD6, 0xD7, 0x4F, 0x55, 0x55,
|
||||
0x55, 0xDC, 0xDD, 0xDE, 0xDF, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0xC6, 0xC7,
|
||||
0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49, 0xD0, 0x4E, 0x4F, 0x4F, 0x4F,
|
||||
0x4F, 0xD6, 0xF7, 0x4F, 0x55, 0x55, 0x55, 0xDC, 0xDD, 0xDE, 0x59,
|
||||
};
|
||||
|
||||
static const unsigned char Lookup_176[128 * 3] = {
|
||||
/* Common */
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
|
||||
0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
|
||||
0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40,
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D,
|
||||
0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A,
|
||||
0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
|
||||
0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x00,
|
||||
|
||||
/* Windows */
|
||||
0x00, 0x00, 0x82, 0x46, 0x84, 0x85, 0x86, 0x87, 0x00, 0x89, 0x53, 0x8B, 0x8C,
|
||||
0x00, 0x00, 0x00, 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x2D, 0x2D, 0x98, 0x99,
|
||||
0x53, 0x9B, 0x8C, 0x00, 0x00, 0x59, 0x09, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0x41, 0xAB, 0xAC, 0x2D, 0xAE, 0xAF, 0xB0, 0xB1, 0x32, 0x33,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0x31, 0x4F, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0x41,
|
||||
0x41, 0x41, 0x41, 0xC4, 0xC5, 0xC4, 0x43, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49,
|
||||
0x49, 0x49, 0x44, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0xD6, 0xD7, 0xD6, 0x55, 0x55,
|
||||
0x55, 0x59, 0x59, 0xDE, 0xDF, 0x41, 0x41, 0x41, 0x41, 0xC4, 0xC5, 0xC4, 0x43,
|
||||
0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49, 0x44, 0x4E, 0x4F, 0x4F, 0x4F,
|
||||
0x4F, 0xD6, 0xF7, 0xD6, 0x55, 0x55, 0x55, 0x59, 0x59, 0xDE, 0x59,
|
||||
|
||||
/* Mac */
|
||||
0x80, 0x81, 0x43, 0x45, 0x4E, 0x85, 0x59, 0x41, 0x41, 0x41, 0x80, 0x41, 0x81,
|
||||
0x43, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49, 0x4E, 0x4F, 0x4F, 0x4F,
|
||||
0x85, 0x4F, 0x55, 0x55, 0x55, 0x59, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0x80, 0x85, 0xB0, 0xB1, 0xB2, 0xB3,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0x41, 0x4F, 0xBD, 0x80, 0x85, 0xC0,
|
||||
0xC1, 0xC2, 0xC3, 0x46, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0x09, 0x41, 0x41, 0x4F,
|
||||
0xCE, 0xCE, 0x2D, 0x2D, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0x59, 0x59, 0xDA,
|
||||
0xDB, 0xDC, 0xDD, 0x3F, 0x3F, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0x41, 0x45, 0x41,
|
||||
0x45, 0x45, 0x49, 0x49, 0x49, 0x49, 0x4F, 0x4F, 0x3F, 0x4F, 0x55, 0x55, 0x55,
|
||||
0x49, 0x00, 0xF7, 0x00, 0xF9, 0xFA, 0xFB, 0x3F, 0xFD, 0xFE, 0x00
|
||||
};
|
||||
|
||||
static const unsigned char Lookup_208[128 * 3] = {
|
||||
/* Common */
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
|
||||
0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
|
||||
0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40,
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D,
|
||||
0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A,
|
||||
0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
|
||||
0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
|
||||
/* Windows */
|
||||
0x80, 0x81, 0x82, 0x46, 0x84, 0x85, 0x86, 0x87, 0x5E, 0x89, 0x8A, 0x8B, 0x8C,
|
||||
0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
|
||||
0x9A, 0x9B, 0x8C, 0x9D, 0x00, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0x32, 0x33,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0x31, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0,
|
||||
0xC1, 0xC2, 0xC1, 0xC1, 0xC1, 0xC1, 0xC7, 0xC8, 0xC9, 0xC9, 0xCB, 0xCC, 0xCD,
|
||||
0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA,
|
||||
0xDB, 0x00, 0xDD, 0xDE, 0xDF, 0x41, 0xE1, 0x41, 0xE3, 0xE4, 0xE5, 0xE6, 0x43,
|
||||
0x45, 0x45, 0x45, 0x45, 0xEC, 0xEC, 0x49, 0x49, 0xF0, 0xF1, 0xF2, 0xF3, 0x4F,
|
||||
0xF5, 0xF6, 0xF7, 0xF8, 0x55, 0xFA, 0x55, 0x55, 0x00, 0x00, 0xFF,
|
||||
|
||||
/* Mac */
|
||||
0x41, 0x81, 0x43, 0x45, 0x4E, 0x4F, 0x55, 0x41, 0x41, 0x41, 0x41, 0x8B, 0x8C,
|
||||
0x43, 0x45, 0x45, 0x45, 0x45, 0x49, 0x93, 0x49, 0x49, 0x4E, 0x4F, 0x98, 0x4F,
|
||||
0x4F, 0x9B, 0x55, 0x55, 0x55, 0x55, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0,
|
||||
0xC1, 0xC2, 0xC1, 0xC1, 0xC1, 0xC1, 0xC7, 0xC8, 0xC9, 0xC9, 0xCB, 0xCC, 0xCD,
|
||||
0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA,
|
||||
0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0x00, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
|
||||
0xE8, 0xE9, 0xE9, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4,
|
||||
0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
};
|
||||
|
||||
static const unsigned char Lookup_224[128 * 3] = {
|
||||
/* Common */
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
|
||||
0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
|
||||
0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
|
||||
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40,
|
||||
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D,
|
||||
0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A,
|
||||
0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54,
|
||||
0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
|
||||
/* Windows */
|
||||
0x80, 0x81, 0x82, 0x46, 0x84, 0x85, 0x86, 0x87, 0x5E, 0x89, 0x8A, 0x8B, 0x8C,
|
||||
0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
|
||||
0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0x32, 0x33,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0x31, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0,
|
||||
0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD,
|
||||
0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA,
|
||||
0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
|
||||
0xE8, 0xE9, 0xEA, 0xEA, 0xEC, 0xED, 0xED, 0xEF, 0xEF, 0xF1, 0xF2, 0xF3, 0xF3,
|
||||
0xF5, 0xF5, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0x00, 0x00, 0xFF,
|
||||
|
||||
/* Mac */
|
||||
0x41, 0x41, 0x43, 0x45, 0x4E, 0x4F, 0x55, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
|
||||
0x43, 0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49, 0x4E, 0x4F, 0x4F, 0x4F,
|
||||
0x4F, 0x4F, 0x55, 0x55, 0x55, 0x55, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
|
||||
0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3,
|
||||
0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0,
|
||||
0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD,
|
||||
0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA,
|
||||
0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
|
||||
0xE8, 0xE9, 0xEA, 0xEA, 0xEC, 0xED, 0xED, 0xEF, 0xEF, 0xF1, 0xF2, 0xF3, 0xF3,
|
||||
0xF5, 0xF5, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* lhash_val_of_name_sys
|
||||
*
|
||||
* Copy of oleaut32.LHashValOfNameSysA
|
||||
* Produce a string hash value.
|
||||
*
|
||||
* PARAMS
|
||||
* skind [I] Type of the system.
|
||||
* lcid [I] Locale id for the hash.
|
||||
* lpStr [I] String to hash.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: The hash value of the string.
|
||||
* Failure: 0, if lpStr is NULL.
|
||||
*
|
||||
* NOTES
|
||||
* This function produces a two part hash: The high word is based on
|
||||
* skind and lcid, while the low word is based on a repeated string
|
||||
* hash of skind/str.
|
||||
*/
|
||||
unsigned long lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr)
|
||||
{
|
||||
ULONG nOffset, nMask = skind == SYS_MAC ? 1 : 0;
|
||||
ULONG nHiWord, nLoWord = 0x0deadbee;
|
||||
const unsigned char *str = (const unsigned char *)lpStr, *pnLookup = NULL;
|
||||
|
||||
if (!str)
|
||||
return 0;
|
||||
|
||||
switch (PRIMARYLANGID(LANGIDFROMLCID(lcid)))
|
||||
{
|
||||
default:
|
||||
fprintf(stderr, "Unknown lcid %x, treating as latin-based, please report\n", lcid);
|
||||
/* .. Fall Through .. */
|
||||
case LANG_AFRIKAANS: case LANG_ALBANIAN: case LANG_ARMENIAN:
|
||||
case LANG_ASSAMESE: case LANG_AZERI: case LANG_BASQUE:
|
||||
case LANG_BELARUSIAN: case LANG_BENGALI: case LANG_BULGARIAN:
|
||||
case LANG_CATALAN: case LANG_DANISH: case LANG_DIVEHI:
|
||||
case LANG_DUTCH: case LANG_ENGLISH: case LANG_ESTONIAN:
|
||||
case LANG_FAEROESE: case LANG_FINNISH: case LANG_FRENCH:
|
||||
case LANG_GALICIAN: case LANG_GEORGIAN: case LANG_GERMAN:
|
||||
case LANG_GUJARATI: case LANG_HINDI: case LANG_INDONESIAN:
|
||||
case LANG_ITALIAN: case LANG_KANNADA: case LANG_KASHMIRI:
|
||||
case LANG_KAZAK: case LANG_KONKANI: case LANG_KYRGYZ:
|
||||
case LANG_LATVIAN: case LANG_LITHUANIAN: case LANG_MACEDONIAN:
|
||||
case LANG_MALAY: case LANG_MALAYALAM: case LANG_MANIPURI:
|
||||
case LANG_MARATHI: case LANG_MONGOLIAN: case LANG_NEPALI:
|
||||
case LANG_ORIYA: case LANG_PORTUGUESE: case LANG_PUNJABI:
|
||||
case LANG_ROMANIAN: case LANG_SANSKRIT: case LANG_SERBIAN:
|
||||
case LANG_SINDHI: case LANG_SLOVENIAN: case LANG_SWAHILI:
|
||||
case LANG_SWEDISH: case LANG_SYRIAC: case LANG_TAMIL:
|
||||
case LANG_TATAR: case LANG_TELUGU: case LANG_THAI:
|
||||
case LANG_UKRAINIAN: case LANG_URDU: case LANG_UZBEK:
|
||||
#ifndef __REACTOS__
|
||||
case LANG_VIETNAMESE: case LANG_GAELIC: case LANG_MALTESE:
|
||||
case LANG_TAJIK: case LANG_ROMANSH: case LANG_IRISH:
|
||||
case LANG_SAMI: case LANG_UPPER_SORBIAN: case LANG_SUTU:
|
||||
case LANG_TSONGA: case LANG_TSWANA: case LANG_VENDA:
|
||||
case LANG_XHOSA: case LANG_ZULU: case LANG_ESPERANTO:
|
||||
case LANG_WALON: case LANG_CORNISH: case LANG_WELSH:
|
||||
case LANG_BRETON:
|
||||
#else
|
||||
case LANG_VIETNAMESE: case LANG_MALTESE: case LANG_IRISH:
|
||||
case LANG_SAMI: case LANG_UPPER_SORBIAN: case LANG_TSWANA:
|
||||
case LANG_XHOSA: case LANG_ZULU: case LANG_WELSH:
|
||||
case LANG_BRETON:
|
||||
#endif
|
||||
nOffset = 16;
|
||||
pnLookup = Lookup_16;
|
||||
break;
|
||||
case LANG_CZECH: case LANG_HUNGARIAN: case LANG_POLISH:
|
||||
case LANG_SLOVAK: case LANG_SPANISH:
|
||||
nOffset = 32;
|
||||
pnLookup = Lookup_32;
|
||||
break;
|
||||
case LANG_HEBREW:
|
||||
nOffset = 48;
|
||||
pnLookup = Lookup_48;
|
||||
break;
|
||||
case LANG_JAPANESE:
|
||||
nOffset = 64;
|
||||
pnLookup = Lookup_64;
|
||||
break;
|
||||
case LANG_KOREAN:
|
||||
nOffset = 80;
|
||||
pnLookup = Lookup_80;
|
||||
break;
|
||||
case LANG_CHINESE:
|
||||
nOffset = 112;
|
||||
pnLookup = Lookup_112;
|
||||
break;
|
||||
case LANG_GREEK:
|
||||
nOffset = 128;
|
||||
pnLookup = Lookup_128;
|
||||
break;
|
||||
case LANG_ICELANDIC:
|
||||
nOffset = 144;
|
||||
pnLookup = Lookup_144;
|
||||
break;
|
||||
case LANG_TURKISH:
|
||||
nOffset = 160;
|
||||
pnLookup = Lookup_160;
|
||||
break;
|
||||
case LANG_NORWEGIAN:
|
||||
if (SUBLANGID(LANGIDFROMLCID(lcid)) == SUBLANG_NORWEGIAN_NYNORSK)
|
||||
{
|
||||
nOffset = 176;
|
||||
pnLookup = Lookup_176;
|
||||
}
|
||||
else
|
||||
{
|
||||
nOffset = 16;
|
||||
pnLookup = Lookup_16;
|
||||
}
|
||||
break;
|
||||
case LANG_ARABIC:
|
||||
case LANG_FARSI:
|
||||
nOffset = 208;
|
||||
pnLookup = Lookup_208;
|
||||
break;
|
||||
case LANG_RUSSIAN:
|
||||
nOffset = 224;
|
||||
pnLookup = Lookup_224;
|
||||
break;
|
||||
}
|
||||
|
||||
nHiWord = (nOffset | nMask) << 16;
|
||||
|
||||
while (*str)
|
||||
{
|
||||
nLoWord = 37 * nLoWord + pnLookup[*str > 0x7f && nMask ? *str + 0x80 : *str];
|
||||
str++;
|
||||
}
|
||||
/* Constrain to a prime modulo and sizeof(WORD) */
|
||||
nLoWord = (nLoWord % 65599) & 0xffff;
|
||||
|
||||
return nHiWord | nLoWord;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Hash definitions
|
||||
*
|
||||
* Copyright 2005 Huw Davies
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __WIDL_HASH_H
|
||||
#define __WIDL_HASH_H
|
||||
|
||||
typedef enum tag_syskind_t {
|
||||
SYS_WIN16 = 0,
|
||||
SYS_WIN32,
|
||||
SYS_MAC
|
||||
} syskind_t;
|
||||
|
||||
extern unsigned long lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* IDL Compiler
|
||||
*
|
||||
* Copyright 2002 Ove Kaaven
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __WIDL_HEADER_H
|
||||
#define __WIDL_HEADER_H
|
||||
|
||||
#include "widltypes.h"
|
||||
|
||||
extern int is_ptrchain_attr(const var_t *var, enum attr_type t);
|
||||
extern int is_attr(const attr_list_t *list, enum attr_type t);
|
||||
extern void *get_attrp(const attr_list_t *list, enum attr_type t);
|
||||
extern unsigned long get_attrv(const attr_list_t *list, enum attr_type t);
|
||||
extern int is_void(const type_t *t);
|
||||
extern int is_conformant_array(const type_t *t);
|
||||
extern int is_declptr(const type_t *t);
|
||||
extern void write_name(FILE *h, const var_t *v);
|
||||
extern void write_prefix_name(FILE *h, const char *prefix, const var_t *v);
|
||||
extern const char* get_name(const var_t *v);
|
||||
extern void write_type_left(FILE *h, type_t *t, int declonly);
|
||||
extern void write_type_right(FILE *h, type_t *t, int is_field);
|
||||
extern void write_type_def_or_decl(FILE *h, type_t *t, int is_field, const char *fmt, ...);
|
||||
extern void write_type_decl(FILE *f, type_t *t, const char *fmt, ...);
|
||||
extern void write_type_decl_left(FILE *f, type_t *t);
|
||||
extern int needs_space_after(type_t *t);
|
||||
extern int is_object(const attr_list_t *list);
|
||||
extern int is_local(const attr_list_t *list);
|
||||
extern int need_stub(const type_t *iface);
|
||||
extern int need_proxy(const type_t *iface);
|
||||
extern int need_stub_files(const ifref_list_t *ifaces);
|
||||
extern int need_proxy_file(const ifref_list_t *ifaces);
|
||||
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_forward(type_t *iface);
|
||||
extern void write_interface(type_t *iface);
|
||||
extern void write_dispinterface(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_expr(FILE *h, const expr_t *e, int brackets);
|
||||
extern void write_constdef(const var_t *v);
|
||||
extern void write_externdef(const var_t *v);
|
||||
extern void write_library(const char *name, const attr_list_t *attr);
|
||||
extern void write_user_types(void);
|
||||
extern void write_context_handle_rundowns(void);
|
||||
extern const var_t* get_explicit_handle_var(const func_t* func);
|
||||
extern int has_out_arg_or_return(const func_t *func);
|
||||
extern void write_guid(FILE *f, const char *guid_prefix, const char *name,
|
||||
const UUID *uuid);
|
||||
|
||||
static inline int last_ptr(const type_t *type)
|
||||
{
|
||||
return is_ptr(type) && !is_declptr(type->ref);
|
||||
}
|
||||
|
||||
static inline int last_array(const type_t *type)
|
||||
{
|
||||
return is_array(type) && !is_array(type->ref);
|
||||
}
|
||||
|
||||
static inline int is_string_type(const attr_list_t *attrs, const type_t *type)
|
||||
{
|
||||
return is_attr(attrs, ATTR_STRING) && (last_ptr(type) || last_array(type));
|
||||
}
|
||||
|
||||
static inline int is_context_handle(const type_t *type)
|
||||
{
|
||||
const type_t *t;
|
||||
for (t = type; is_ptr(t); t = t->ref)
|
||||
if (is_attr(t->attrs, ATTR_CONTEXTHANDLE))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* IDL Compiler
|
||||
*
|
||||
* Copyright 2002 Ove Kaaven
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __WIDL_PARSER_H
|
||||
#define __WIDL_PARSER_H
|
||||
|
||||
typedef struct
|
||||
{
|
||||
type_t *interface;
|
||||
unsigned char old_pointer_default;
|
||||
} interface_info_t;
|
||||
|
||||
int parser_parse(void);
|
||||
|
||||
extern FILE *parser_in;
|
||||
extern char *parser_text;
|
||||
extern int parser_debug;
|
||||
extern int yy_flex_debug;
|
||||
|
||||
int parser_lex(void);
|
||||
|
||||
extern int import_stack_ptr;
|
||||
int do_import(char *fname);
|
||||
void abort_import(void);
|
||||
|
||||
#define parse_only import_stack_ptr
|
||||
|
||||
int is_type(const char *name);
|
||||
|
||||
#endif
|
||||
@@ -1,443 +0,0 @@
|
||||
/* -*-C-*-
|
||||
* IDL Compiler
|
||||
*
|
||||
* Copyright 2002 Ove Kaaven
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
%option stack
|
||||
%option nounput noyy_top_state
|
||||
%option 8bit never-interactive prefix="parser_"
|
||||
|
||||
nl \r?\n
|
||||
ws [ \f\t\r]
|
||||
cident [a-zA-Z_][0-9a-zA-Z_]*
|
||||
int [0-9]+
|
||||
hexd [0-9a-fA-F]
|
||||
hex 0x{hexd}+
|
||||
uuid {hexd}{8}-{hexd}{4}-{hexd}{4}-{hexd}{4}-{hexd}{12}
|
||||
double [0-9]+\.[0-9]+([eE][+-]?[0-9]+)*
|
||||
|
||||
%x QUOTE
|
||||
%x ATTR
|
||||
%x PP_LINE
|
||||
|
||||
%{
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "widl.h"
|
||||
#include "utils.h"
|
||||
#include "parser.h"
|
||||
#include "wine/wpp.h"
|
||||
|
||||
#include "parser.tab.h"
|
||||
|
||||
extern char *temp_name;
|
||||
|
||||
static void addcchar(char c);
|
||||
static char *get_buffered_cstring(void);
|
||||
|
||||
static char *cbuffer;
|
||||
static int cbufidx;
|
||||
static int cbufalloc = 0;
|
||||
|
||||
static int kw_token(const char *kw);
|
||||
static int attr_token(const char *kw);
|
||||
|
||||
#define MAX_IMPORT_DEPTH 10
|
||||
struct {
|
||||
YY_BUFFER_STATE state;
|
||||
char *input_name;
|
||||
int line_number;
|
||||
char *temp_name;
|
||||
} import_stack[MAX_IMPORT_DEPTH];
|
||||
int import_stack_ptr = 0;
|
||||
|
||||
static void pop_import(void);
|
||||
|
||||
UUID *parse_uuid(const char *u)
|
||||
{
|
||||
UUID* uuid = xmalloc(sizeof(UUID));
|
||||
char b[3];
|
||||
/* it would be nice to use UuidFromStringA */
|
||||
uuid->Data1 = strtoul(u, NULL, 16);
|
||||
uuid->Data2 = strtoul(u+9, NULL, 16);
|
||||
uuid->Data3 = strtoul(u+14, NULL, 16);
|
||||
b[2] = 0;
|
||||
memcpy(b, u+19, 2); uuid->Data4[0] = strtoul(b, NULL, 16);
|
||||
memcpy(b, u+21, 2); uuid->Data4[1] = strtoul(b, NULL, 16);
|
||||
memcpy(b, u+24, 2); uuid->Data4[2] = strtoul(b, NULL, 16);
|
||||
memcpy(b, u+26, 2); uuid->Data4[3] = strtoul(b, NULL, 16);
|
||||
memcpy(b, u+28, 2); uuid->Data4[4] = strtoul(b, NULL, 16);
|
||||
memcpy(b, u+30, 2); uuid->Data4[5] = strtoul(b, NULL, 16);
|
||||
memcpy(b, u+32, 2); uuid->Data4[6] = strtoul(b, NULL, 16);
|
||||
memcpy(b, u+34, 2); uuid->Data4[7] = strtoul(b, NULL, 16);
|
||||
return uuid;
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
* The flexer starts here
|
||||
**************************************************************************
|
||||
*/
|
||||
%%
|
||||
<INITIAL,ATTR>^{ws}*\#{ws}* yy_push_state(PP_LINE);
|
||||
<PP_LINE>[^\n]* {
|
||||
int lineno;
|
||||
char *cptr, *fname;
|
||||
yy_pop_state();
|
||||
lineno = (int)strtol(yytext, &cptr, 10);
|
||||
if(!lineno)
|
||||
error_loc("Malformed '#...' line-directive; invalid linenumber\n");
|
||||
fname = strchr(cptr, '"');
|
||||
if(!fname)
|
||||
error_loc("Malformed '#...' line-directive; missing filename\n");
|
||||
fname++;
|
||||
cptr = strchr(fname, '"');
|
||||
if(!cptr)
|
||||
error_loc("Malformed '#...' line-directive; missing terminating \"\n");
|
||||
*cptr = '\0';
|
||||
line_number = lineno - 1; /* We didn't read the newline */
|
||||
free( input_name );
|
||||
input_name = xstrdup(fname);
|
||||
}
|
||||
<INITIAL,ATTR>\" yy_push_state(QUOTE); cbufidx = 0;
|
||||
<QUOTE>\" {
|
||||
yy_pop_state();
|
||||
parser_lval.str = get_buffered_cstring();
|
||||
return aSTRING;
|
||||
}
|
||||
<QUOTE>\\\\ |
|
||||
<QUOTE>\\\" addcchar(yytext[1]);
|
||||
<QUOTE>\\. addcchar('\\'); addcchar(yytext[1]);
|
||||
<QUOTE>. addcchar(yytext[0]);
|
||||
<INITIAL,ATTR>\[ yy_push_state(ATTR); return '[';
|
||||
<ATTR>\] yy_pop_state(); return ']';
|
||||
<ATTR>{cident} return attr_token(yytext);
|
||||
<ATTR>{uuid} {
|
||||
parser_lval.uuid = parse_uuid(yytext);
|
||||
return aUUID;
|
||||
}
|
||||
<INITIAL,ATTR>{hex} {
|
||||
parser_lval.num = strtoul(yytext, NULL, 0);
|
||||
return aHEXNUM;
|
||||
}
|
||||
<INITIAL,ATTR>{int} {
|
||||
parser_lval.num = strtoul(yytext, NULL, 0);
|
||||
return aNUM;
|
||||
}
|
||||
<INITIAL>{double} {
|
||||
parser_lval.dbl = strtod(yytext, NULL);
|
||||
return aDOUBLE;
|
||||
}
|
||||
SAFEARRAY{ws}*/\( return tSAFEARRAY;
|
||||
{cident} return kw_token(yytext);
|
||||
<INITIAL,ATTR>\n line_number++;
|
||||
<INITIAL,ATTR>{ws}
|
||||
<INITIAL,ATTR>\<\< return SHL;
|
||||
<INITIAL,ATTR>\>\> return SHR;
|
||||
<INITIAL,ATTR>. return yytext[0];
|
||||
<<EOF>> {
|
||||
if (import_stack_ptr) {
|
||||
pop_import();
|
||||
return aEOF;
|
||||
}
|
||||
else yyterminate();
|
||||
}
|
||||
%%
|
||||
|
||||
#ifndef parser_wrap
|
||||
int parser_wrap(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct keyword {
|
||||
const char *kw;
|
||||
int token;
|
||||
};
|
||||
|
||||
static const struct keyword keywords[] = {
|
||||
{"FALSE", tFALSE},
|
||||
{"TRUE", tTRUE},
|
||||
{"__cdecl", tCDECL},
|
||||
{"__int64", tINT64},
|
||||
{"__stdcall", tSTDCALL},
|
||||
{"_stdcall", tSTDCALL},
|
||||
{"boolean", tBOOLEAN},
|
||||
{"byte", tBYTE},
|
||||
{"callback", tCALLBACK},
|
||||
{"case", tCASE},
|
||||
{"char", tCHAR},
|
||||
{"coclass", tCOCLASS},
|
||||
{"code", tCODE},
|
||||
{"comm_status", tCOMMSTATUS},
|
||||
{"const", tCONST},
|
||||
{"cpp_quote", tCPPQUOTE},
|
||||
{"default", tDEFAULT},
|
||||
{"dispinterface", tDISPINTERFACE},
|
||||
{"double", tDOUBLE},
|
||||
{"enum", tENUM},
|
||||
{"error_status_t", tERRORSTATUST},
|
||||
{"extern", tEXTERN},
|
||||
{"float", tFLOAT},
|
||||
{"handle_t", tHANDLET},
|
||||
{"hyper", tHYPER},
|
||||
{"import", tIMPORT},
|
||||
{"importlib", tIMPORTLIB},
|
||||
{"in_line", tINLINE},
|
||||
{"int", tINT},
|
||||
{"interface", tINTERFACE},
|
||||
{"library", tLIBRARY},
|
||||
{"long", tLONG},
|
||||
{"methods", tMETHODS},
|
||||
{"module", tMODULE},
|
||||
{"properties", tPROPERTIES},
|
||||
{"short", tSHORT},
|
||||
{"signed", tSIGNED},
|
||||
{"sizeof", tSIZEOF},
|
||||
{"small", tSMALL},
|
||||
{"struct", tSTRUCT},
|
||||
{"switch", tSWITCH},
|
||||
{"typedef", tTYPEDEF},
|
||||
{"union", tUNION},
|
||||
{"unsigned", tUNSIGNED},
|
||||
{"void", tVOID},
|
||||
{"wchar_t", tWCHAR},
|
||||
};
|
||||
#define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
|
||||
|
||||
/* keywords only recognized in attribute lists */
|
||||
static const struct keyword attr_keywords[] =
|
||||
{
|
||||
{"aggregatable", tAGGREGATABLE},
|
||||
{"allocate", tALLOCATE},
|
||||
{"appobject", tAPPOBJECT},
|
||||
{"async", tASYNC},
|
||||
{"async_uuid", tASYNCUUID},
|
||||
{"auto_handle", tAUTOHANDLE},
|
||||
{"bindable", tBINDABLE},
|
||||
{"broadcast", tBROADCAST},
|
||||
{"byte_count", tBYTECOUNT},
|
||||
{"call_as", tCALLAS},
|
||||
{"context_handle", tCONTEXTHANDLE},
|
||||
{"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE},
|
||||
{"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE},
|
||||
{"control", tCONTROL},
|
||||
{"defaultcollelem", tDEFAULTCOLLELEM},
|
||||
{"defaultvalue", tDEFAULTVALUE},
|
||||
{"defaultvtable", tDEFAULTVTABLE},
|
||||
{"displaybind", tDISPLAYBIND},
|
||||
{"dllname", tDLLNAME},
|
||||
{"dual", tDUAL},
|
||||
{"endpoint", tENDPOINT},
|
||||
{"entry", tENTRY},
|
||||
{"explicit_handle", tEXPLICITHANDLE},
|
||||
{"handle", tHANDLE},
|
||||
{"helpcontext", tHELPCONTEXT},
|
||||
{"helpfile", tHELPFILE},
|
||||
{"helpstring", tHELPSTRING},
|
||||
{"helpstringcontext", tHELPSTRINGCONTEXT},
|
||||
{"helpstringdll", tHELPSTRINGDLL},
|
||||
{"hidden", tHIDDEN},
|
||||
{"id", tID},
|
||||
{"idempotent", tIDEMPOTENT},
|
||||
{"iid_is", tIIDIS},
|
||||
{"immediatebind", tIMMEDIATEBIND},
|
||||
{"implicit_handle", tIMPLICITHANDLE},
|
||||
{"in", tIN},
|
||||
{"input_sync", tINPUTSYNC},
|
||||
{"lcid", tLCID},
|
||||
{"length_is", tLENGTHIS},
|
||||
{"local", tLOCAL},
|
||||
{"nonbrowsable", tNONBROWSABLE},
|
||||
{"noncreatable", tNONCREATABLE},
|
||||
{"nonextensible", tNONEXTENSIBLE},
|
||||
{"object", tOBJECT},
|
||||
{"odl", tODL},
|
||||
{"oleautomation", tOLEAUTOMATION},
|
||||
{"optional", tOPTIONAL},
|
||||
{"out", tOUT},
|
||||
{"pointer_default", tPOINTERDEFAULT},
|
||||
{"propget", tPROPGET},
|
||||
{"propput", tPROPPUT},
|
||||
{"propputref", tPROPPUTREF},
|
||||
{"ptr", tPTR},
|
||||
{"public", tPUBLIC},
|
||||
{"range", tRANGE},
|
||||
{"readonly", tREADONLY},
|
||||
{"ref", tREF},
|
||||
{"requestedit", tREQUESTEDIT},
|
||||
{"restricted", tRESTRICTED},
|
||||
{"retval", tRETVAL},
|
||||
{"single", tSINGLE},
|
||||
{"size_is", tSIZEIS},
|
||||
{"source", tSOURCE},
|
||||
{"string", tSTRING},
|
||||
{"switch_is", tSWITCHIS},
|
||||
{"switch_type", tSWITCHTYPE},
|
||||
{"transmit_as", tTRANSMITAS},
|
||||
{"unique", tUNIQUE},
|
||||
{"uuid", tUUID},
|
||||
{"v1_enum", tV1ENUM},
|
||||
{"vararg", tVARARG},
|
||||
{"version", tVERSION},
|
||||
{"wire_marshal", tWIREMARSHAL},
|
||||
};
|
||||
|
||||
|
||||
#define KWP(p) ((const struct keyword *)(p))
|
||||
|
||||
static int kw_cmp_func(const void *s1, const void *s2)
|
||||
{
|
||||
return strcmp(KWP(s1)->kw, KWP(s2)->kw);
|
||||
}
|
||||
|
||||
static int kw_token(const char *kw)
|
||||
{
|
||||
struct keyword key, *kwp;
|
||||
key.kw = kw;
|
||||
kwp = bsearch(&key, keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func);
|
||||
if (kwp) {
|
||||
parser_lval.str = xstrdup(kwp->kw);
|
||||
return kwp->token;
|
||||
}
|
||||
parser_lval.str = xstrdup(kw);
|
||||
return is_type(kw) ? aKNOWNTYPE : aIDENTIFIER;
|
||||
}
|
||||
|
||||
static int attr_token(const char *kw)
|
||||
{
|
||||
struct keyword key, *kwp;
|
||||
key.kw = kw;
|
||||
kwp = bsearch(&key, attr_keywords, sizeof(attr_keywords)/sizeof(attr_keywords[0]),
|
||||
sizeof(attr_keywords[0]), kw_cmp_func);
|
||||
if (kwp) {
|
||||
parser_lval.str = xstrdup(kwp->kw);
|
||||
return kwp->token;
|
||||
}
|
||||
return kw_token(kw);
|
||||
}
|
||||
|
||||
static void addcchar(char c)
|
||||
{
|
||||
if(cbufidx >= cbufalloc)
|
||||
{
|
||||
cbufalloc += 1024;
|
||||
cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0]));
|
||||
if(cbufalloc > 65536)
|
||||
parser_warning("Reallocating string buffer larger than 64kB\n");
|
||||
}
|
||||
cbuffer[cbufidx++] = c;
|
||||
}
|
||||
|
||||
static char *get_buffered_cstring(void)
|
||||
{
|
||||
addcchar(0);
|
||||
return xstrdup(cbuffer);
|
||||
}
|
||||
|
||||
static void pop_import(void)
|
||||
{
|
||||
int ptr = import_stack_ptr-1;
|
||||
|
||||
fclose(yyin);
|
||||
yy_delete_buffer( YY_CURRENT_BUFFER );
|
||||
yy_switch_to_buffer( import_stack[ptr].state );
|
||||
if (temp_name) {
|
||||
unlink(temp_name);
|
||||
free(temp_name);
|
||||
}
|
||||
temp_name = import_stack[ptr].temp_name;
|
||||
free( input_name );
|
||||
input_name = import_stack[ptr].input_name;
|
||||
line_number = import_stack[ptr].line_number;
|
||||
import_stack_ptr--;
|
||||
}
|
||||
|
||||
struct imports {
|
||||
char *name;
|
||||
struct imports *next;
|
||||
} *first_import;
|
||||
|
||||
int do_import(char *fname)
|
||||
{
|
||||
FILE *f;
|
||||
char *hname, *path, *p;
|
||||
struct imports *import;
|
||||
int ptr = import_stack_ptr;
|
||||
int ret;
|
||||
|
||||
if (!parse_only && do_header) {
|
||||
hname = dup_basename(fname, ".idl");
|
||||
p = hname + strlen(hname) - 2;
|
||||
if (p <= hname || strcmp( p, ".h" )) strcat(hname, ".h");
|
||||
|
||||
fprintf(header, "#include <%s>\n", hname);
|
||||
free(hname);
|
||||
}
|
||||
|
||||
import = first_import;
|
||||
while (import && strcmp(import->name, fname))
|
||||
import = import->next;
|
||||
if (import) return 0; /* already imported */
|
||||
|
||||
import = xmalloc(sizeof(struct imports));
|
||||
import->name = xstrdup(fname);
|
||||
import->next = first_import;
|
||||
first_import = import;
|
||||
|
||||
if (!(path = wpp_find_include( fname, input_name )))
|
||||
error_loc("Unable to open include file %s\n", fname);
|
||||
|
||||
import_stack[ptr].temp_name = temp_name;
|
||||
import_stack[ptr].input_name = input_name;
|
||||
import_stack[ptr].line_number = line_number;
|
||||
import_stack_ptr++;
|
||||
input_name = path;
|
||||
line_number = 1;
|
||||
|
||||
ret = wpp_parse_temp( path, NULL, &temp_name );
|
||||
if (ret) exit(1);
|
||||
|
||||
if((f = fopen(temp_name, "r")) == NULL)
|
||||
error_loc("Unable to open %s\n", temp_name);
|
||||
|
||||
import_stack[ptr].state = YY_CURRENT_BUFFER;
|
||||
yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE));
|
||||
return 1;
|
||||
}
|
||||
|
||||
void abort_import(void)
|
||||
{
|
||||
int ptr;
|
||||
|
||||
for (ptr=0; ptr<import_stack_ptr; ptr++)
|
||||
unlink(import_stack[ptr].temp_name);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,339 +0,0 @@
|
||||
/* A Bison parser, made by GNU Bison 2.1. */
|
||||
|
||||
/* Skeleton parser for Yacc-like parsing with Bison,
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
This special exception was added by the Free Software Foundation
|
||||
in version 1.24 of Bison. */
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
aIDENTIFIER = 258,
|
||||
aKNOWNTYPE = 259,
|
||||
aNUM = 260,
|
||||
aHEXNUM = 261,
|
||||
aDOUBLE = 262,
|
||||
aSTRING = 263,
|
||||
aUUID = 264,
|
||||
aEOF = 265,
|
||||
SHL = 266,
|
||||
SHR = 267,
|
||||
tAGGREGATABLE = 268,
|
||||
tALLOCATE = 269,
|
||||
tAPPOBJECT = 270,
|
||||
tASYNC = 271,
|
||||
tASYNCUUID = 272,
|
||||
tAUTOHANDLE = 273,
|
||||
tBINDABLE = 274,
|
||||
tBOOLEAN = 275,
|
||||
tBROADCAST = 276,
|
||||
tBYTE = 277,
|
||||
tBYTECOUNT = 278,
|
||||
tCALLAS = 279,
|
||||
tCALLBACK = 280,
|
||||
tCASE = 281,
|
||||
tCDECL = 282,
|
||||
tCHAR = 283,
|
||||
tCOCLASS = 284,
|
||||
tCODE = 285,
|
||||
tCOMMSTATUS = 286,
|
||||
tCONST = 287,
|
||||
tCONTEXTHANDLE = 288,
|
||||
tCONTEXTHANDLENOSERIALIZE = 289,
|
||||
tCONTEXTHANDLESERIALIZE = 290,
|
||||
tCONTROL = 291,
|
||||
tCPPQUOTE = 292,
|
||||
tDEFAULT = 293,
|
||||
tDEFAULTCOLLELEM = 294,
|
||||
tDEFAULTVALUE = 295,
|
||||
tDEFAULTVTABLE = 296,
|
||||
tDISPLAYBIND = 297,
|
||||
tDISPINTERFACE = 298,
|
||||
tDLLNAME = 299,
|
||||
tDOUBLE = 300,
|
||||
tDUAL = 301,
|
||||
tENDPOINT = 302,
|
||||
tENTRY = 303,
|
||||
tENUM = 304,
|
||||
tERRORSTATUST = 305,
|
||||
tEXPLICITHANDLE = 306,
|
||||
tEXTERN = 307,
|
||||
tFALSE = 308,
|
||||
tFLOAT = 309,
|
||||
tHANDLE = 310,
|
||||
tHANDLET = 311,
|
||||
tHELPCONTEXT = 312,
|
||||
tHELPFILE = 313,
|
||||
tHELPSTRING = 314,
|
||||
tHELPSTRINGCONTEXT = 315,
|
||||
tHELPSTRINGDLL = 316,
|
||||
tHIDDEN = 317,
|
||||
tHYPER = 318,
|
||||
tID = 319,
|
||||
tIDEMPOTENT = 320,
|
||||
tIIDIS = 321,
|
||||
tIMMEDIATEBIND = 322,
|
||||
tIMPLICITHANDLE = 323,
|
||||
tIMPORT = 324,
|
||||
tIMPORTLIB = 325,
|
||||
tIN = 326,
|
||||
tINLINE = 327,
|
||||
tINPUTSYNC = 328,
|
||||
tINT = 329,
|
||||
tINT64 = 330,
|
||||
tINTERFACE = 331,
|
||||
tLCID = 332,
|
||||
tLENGTHIS = 333,
|
||||
tLIBRARY = 334,
|
||||
tLOCAL = 335,
|
||||
tLONG = 336,
|
||||
tMETHODS = 337,
|
||||
tMODULE = 338,
|
||||
tNONBROWSABLE = 339,
|
||||
tNONCREATABLE = 340,
|
||||
tNONEXTENSIBLE = 341,
|
||||
tOBJECT = 342,
|
||||
tODL = 343,
|
||||
tOLEAUTOMATION = 344,
|
||||
tOPTIONAL = 345,
|
||||
tOUT = 346,
|
||||
tPOINTERDEFAULT = 347,
|
||||
tPROPERTIES = 348,
|
||||
tPROPGET = 349,
|
||||
tPROPPUT = 350,
|
||||
tPROPPUTREF = 351,
|
||||
tPTR = 352,
|
||||
tPUBLIC = 353,
|
||||
tRANGE = 354,
|
||||
tREADONLY = 355,
|
||||
tREF = 356,
|
||||
tREQUESTEDIT = 357,
|
||||
tRESTRICTED = 358,
|
||||
tRETVAL = 359,
|
||||
tSAFEARRAY = 360,
|
||||
tSHORT = 361,
|
||||
tSIGNED = 362,
|
||||
tSINGLE = 363,
|
||||
tSIZEIS = 364,
|
||||
tSIZEOF = 365,
|
||||
tSMALL = 366,
|
||||
tSOURCE = 367,
|
||||
tSTDCALL = 368,
|
||||
tSTRING = 369,
|
||||
tSTRUCT = 370,
|
||||
tSWITCH = 371,
|
||||
tSWITCHIS = 372,
|
||||
tSWITCHTYPE = 373,
|
||||
tTRANSMITAS = 374,
|
||||
tTRUE = 375,
|
||||
tTYPEDEF = 376,
|
||||
tUNION = 377,
|
||||
tUNIQUE = 378,
|
||||
tUNSIGNED = 379,
|
||||
tUUID = 380,
|
||||
tV1ENUM = 381,
|
||||
tVARARG = 382,
|
||||
tVERSION = 383,
|
||||
tVOID = 384,
|
||||
tWCHAR = 385,
|
||||
tWIREMARSHAL = 386,
|
||||
CAST = 387,
|
||||
PPTR = 388,
|
||||
NEG = 389,
|
||||
ADDRESSOF = 390
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define aIDENTIFIER 258
|
||||
#define aKNOWNTYPE 259
|
||||
#define aNUM 260
|
||||
#define aHEXNUM 261
|
||||
#define aDOUBLE 262
|
||||
#define aSTRING 263
|
||||
#define aUUID 264
|
||||
#define aEOF 265
|
||||
#define SHL 266
|
||||
#define SHR 267
|
||||
#define tAGGREGATABLE 268
|
||||
#define tALLOCATE 269
|
||||
#define tAPPOBJECT 270
|
||||
#define tASYNC 271
|
||||
#define tASYNCUUID 272
|
||||
#define tAUTOHANDLE 273
|
||||
#define tBINDABLE 274
|
||||
#define tBOOLEAN 275
|
||||
#define tBROADCAST 276
|
||||
#define tBYTE 277
|
||||
#define tBYTECOUNT 278
|
||||
#define tCALLAS 279
|
||||
#define tCALLBACK 280
|
||||
#define tCASE 281
|
||||
#define tCDECL 282
|
||||
#define tCHAR 283
|
||||
#define tCOCLASS 284
|
||||
#define tCODE 285
|
||||
#define tCOMMSTATUS 286
|
||||
#define tCONST 287
|
||||
#define tCONTEXTHANDLE 288
|
||||
#define tCONTEXTHANDLENOSERIALIZE 289
|
||||
#define tCONTEXTHANDLESERIALIZE 290
|
||||
#define tCONTROL 291
|
||||
#define tCPPQUOTE 292
|
||||
#define tDEFAULT 293
|
||||
#define tDEFAULTCOLLELEM 294
|
||||
#define tDEFAULTVALUE 295
|
||||
#define tDEFAULTVTABLE 296
|
||||
#define tDISPLAYBIND 297
|
||||
#define tDISPINTERFACE 298
|
||||
#define tDLLNAME 299
|
||||
#define tDOUBLE 300
|
||||
#define tDUAL 301
|
||||
#define tENDPOINT 302
|
||||
#define tENTRY 303
|
||||
#define tENUM 304
|
||||
#define tERRORSTATUST 305
|
||||
#define tEXPLICITHANDLE 306
|
||||
#define tEXTERN 307
|
||||
#define tFALSE 308
|
||||
#define tFLOAT 309
|
||||
#define tHANDLE 310
|
||||
#define tHANDLET 311
|
||||
#define tHELPCONTEXT 312
|
||||
#define tHELPFILE 313
|
||||
#define tHELPSTRING 314
|
||||
#define tHELPSTRINGCONTEXT 315
|
||||
#define tHELPSTRINGDLL 316
|
||||
#define tHIDDEN 317
|
||||
#define tHYPER 318
|
||||
#define tID 319
|
||||
#define tIDEMPOTENT 320
|
||||
#define tIIDIS 321
|
||||
#define tIMMEDIATEBIND 322
|
||||
#define tIMPLICITHANDLE 323
|
||||
#define tIMPORT 324
|
||||
#define tIMPORTLIB 325
|
||||
#define tIN 326
|
||||
#define tINLINE 327
|
||||
#define tINPUTSYNC 328
|
||||
#define tINT 329
|
||||
#define tINT64 330
|
||||
#define tINTERFACE 331
|
||||
#define tLCID 332
|
||||
#define tLENGTHIS 333
|
||||
#define tLIBRARY 334
|
||||
#define tLOCAL 335
|
||||
#define tLONG 336
|
||||
#define tMETHODS 337
|
||||
#define tMODULE 338
|
||||
#define tNONBROWSABLE 339
|
||||
#define tNONCREATABLE 340
|
||||
#define tNONEXTENSIBLE 341
|
||||
#define tOBJECT 342
|
||||
#define tODL 343
|
||||
#define tOLEAUTOMATION 344
|
||||
#define tOPTIONAL 345
|
||||
#define tOUT 346
|
||||
#define tPOINTERDEFAULT 347
|
||||
#define tPROPERTIES 348
|
||||
#define tPROPGET 349
|
||||
#define tPROPPUT 350
|
||||
#define tPROPPUTREF 351
|
||||
#define tPTR 352
|
||||
#define tPUBLIC 353
|
||||
#define tRANGE 354
|
||||
#define tREADONLY 355
|
||||
#define tREF 356
|
||||
#define tREQUESTEDIT 357
|
||||
#define tRESTRICTED 358
|
||||
#define tRETVAL 359
|
||||
#define tSAFEARRAY 360
|
||||
#define tSHORT 361
|
||||
#define tSIGNED 362
|
||||
#define tSINGLE 363
|
||||
#define tSIZEIS 364
|
||||
#define tSIZEOF 365
|
||||
#define tSMALL 366
|
||||
#define tSOURCE 367
|
||||
#define tSTDCALL 368
|
||||
#define tSTRING 369
|
||||
#define tSTRUCT 370
|
||||
#define tSWITCH 371
|
||||
#define tSWITCHIS 372
|
||||
#define tSWITCHTYPE 373
|
||||
#define tTRANSMITAS 374
|
||||
#define tTRUE 375
|
||||
#define tTYPEDEF 376
|
||||
#define tUNION 377
|
||||
#define tUNIQUE 378
|
||||
#define tUNSIGNED 379
|
||||
#define tUUID 380
|
||||
#define tV1ENUM 381
|
||||
#define tVARARG 382
|
||||
#define tVERSION 383
|
||||
#define tVOID 384
|
||||
#define tWCHAR 385
|
||||
#define tWIREMARSHAL 386
|
||||
#define CAST 387
|
||||
#define PPTR 388
|
||||
#define NEG 389
|
||||
#define ADDRESSOF 390
|
||||
|
||||
|
||||
|
||||
|
||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||
#line 136 "parser.y"
|
||||
typedef union YYSTYPE {
|
||||
attr_t *attr;
|
||||
attr_list_t *attr_list;
|
||||
str_list_t *str_list;
|
||||
expr_t *expr;
|
||||
expr_list_t *expr_list;
|
||||
array_dims_t *array_dims;
|
||||
type_t *type;
|
||||
var_t *var;
|
||||
var_list_t *var_list;
|
||||
pident_t *pident;
|
||||
pident_list_t *pident_list;
|
||||
func_t *func;
|
||||
func_list_t *func_list;
|
||||
ifref_t *ifref;
|
||||
ifref_list_t *ifref_list;
|
||||
char *str;
|
||||
UUID *uuid;
|
||||
unsigned int num;
|
||||
double dbl;
|
||||
interface_info_t ifinfo;
|
||||
} YYSTYPE;
|
||||
/* Line 1447 of yacc.c. */
|
||||
#line 331 "parser.tab.h"
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
extern YYSTYPE parser_lval;
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,138 +0,0 @@
|
||||
/* Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc.
|
||||
This file is derived from mkstemp.c from the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#ifdef HAVE_PROCESS_H
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
/* We need to provide a type for gcc_uint64_t. */
|
||||
#ifdef __GNUC__
|
||||
__extension__ typedef unsigned long long gcc_uint64_t;
|
||||
#else
|
||||
typedef unsigned long gcc_uint64_t;
|
||||
#endif
|
||||
|
||||
#ifndef TMP_MAX
|
||||
#define TMP_MAX 16384
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len})
|
||||
|
||||
Generate a unique temporary file name from @var{template}.
|
||||
@var{template} has the form:
|
||||
|
||||
@example
|
||||
@var{path}/ccXXXXXX@var{suffix}
|
||||
@end example
|
||||
|
||||
@var{suffix_len} tells us how long @var{suffix} is (it can be zero
|
||||
length). The last six characters of @var{template} before @var{suffix}
|
||||
must be @samp{XXXXXX}; they are replaced with a string that makes the
|
||||
filename unique. Returns a file descriptor open on the file for
|
||||
reading and writing.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
*/
|
||||
|
||||
int
|
||||
mkstemps (
|
||||
char *template,
|
||||
int suffix_len)
|
||||
{
|
||||
static const char letters[]
|
||||
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
static gcc_uint64_t value;
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
struct timeval tv;
|
||||
#endif
|
||||
char *XXXXXX;
|
||||
size_t len;
|
||||
int count;
|
||||
|
||||
len = strlen (template);
|
||||
|
||||
if ((int) len < 6 + suffix_len
|
||||
|| strncmp (&template[len - 6 - suffix_len], "XXXXXX", 6))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
XXXXXX = &template[len - 6 - suffix_len];
|
||||
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
/* Get some more or less random data. */
|
||||
gettimeofday (&tv, NULL);
|
||||
value += ((gcc_uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
|
||||
#else
|
||||
value += getpid ();
|
||||
#endif
|
||||
|
||||
for (count = 0; count < TMP_MAX; ++count)
|
||||
{
|
||||
gcc_uint64_t v = value;
|
||||
int fd;
|
||||
|
||||
/* Fill in the random bits. */
|
||||
XXXXXX[0] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[1] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[2] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[3] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[4] = letters[v % 62];
|
||||
v /= 62;
|
||||
XXXXXX[5] = letters[v % 62];
|
||||
|
||||
#ifdef VMS
|
||||
fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600, "fop=tmd");
|
||||
#else
|
||||
fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600);
|
||||
#endif
|
||||
if (fd >= 0)
|
||||
/* The file does not exist. */
|
||||
return fd;
|
||||
|
||||
/* This is a random value. It is only necessary that the next
|
||||
TMP_MAX values generated by adding 7777 to VALUE are different
|
||||
with (module 2^32). */
|
||||
value += 7777;
|
||||
}
|
||||
|
||||
/* We return the null string if we can't find a unique file name. */
|
||||
template[0] = '\0';
|
||||
return -1;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user