ClassFactory_ps.cpp
上传用户:nvosite88
上传日期:2007-01-17
资源大小:4983k
文件大小:5k
- /* ClassFactory_ps.cpp - IClassFactory proxy/stubs */
- /* Copyright (c) 1999-2001 Wind River Systems, Inc. */
- /*
- modification history
- --------------------
- 01b,31jul01,dbs fix p/s autoreg mechanism
- 01a,13jul01,dbs added modhist, comments
- DESCRIPTION:
- This file was originally generated by WIDL, but now is maintained 'by
- hand' since the requirements for marshaling IClassFactory are
- difficult. It has [marshal_as] attributes which WIDL does not handle,
- and so it needs to be modified to work as it should. See
- comCoreType.idl for a better description of how this interface should
- be dealt with during marshaling of the CreateInstance() method.
- */
- #define __WIDL_PROXY_STUB 0x0200
- #include "dcomProxy.h"
- #include "comCoreTypes.h"
- #include <string.h>
- extern "C" int include_ClassFactory () {return 0;}
- NdrTypeDesc StructDesc__GUID(NDRTYPES&);
- HRESULT STDMETHODCALLTYPE IClassFactory_CreateInstance_vxproxy (IClassFactory* pThis, IUnknown* pUnkOuter, REFIID riid, void** ppvObject);
- HRESULT STDMETHODCALLTYPE IClassFactory_CreateInstance_vxstub (IClassFactory* pitf, RPC_STUB_MSG& msg);
- HRESULT STDMETHODCALLTYPE IClassFactory_LockServer_vxproxy (IClassFactory* pThis, BOOL fLock);
- HRESULT STDMETHODCALLTYPE IClassFactory_LockServer_vxstub (IClassFactory* pitf, RPC_STUB_MSG& msg);
- HRESULT STDMETHODCALLTYPE IClassFactory_CreateInstance_vxproxy (IClassFactory* pThis, IUnknown*, REFIID riid, void** ppvObject)
- {
- RPC_PROXY_MSG msg (IID_IClassFactory, RpcMode::OBJECT, 3, pThis);
- NDRTYPES ndrtypes;
- HRESULT hrMethod;
- HRESULT hr;
- NdrMarshalStream* pms = msg.marshalStreamGet ();
- /*hr=widlMarshal (&pUnkOuter, pms, ndrtypes.interfaceptr_t (IID_IUnknown)); if (FAILED(hr)) return hr;*/
- hr=widlMarshal (&riid, pms, StructDesc__GUID (ndrtypes)); if (FAILED(hr)) return hr;
- hr = msg.SendReceive (); if (FAILED (hr)) return hr;
- NdrUnmarshalStream* pus = msg.unmarshalStreamGet ();
- hr=widlUnmarshal (&ppvObject, pus, ndrtypes.refptr_t(ndrtypes.interfaceptr_t (riid))); if (FAILED(hr)) return hr;
- hr = widlUnmarshal (&hrMethod, pus, ndrtypes.hresult_t());
- if (FAILED(hr))
- return hr;
- return hrMethod;
- }
- HRESULT STDMETHODCALLTYPE IClassFactory_CreateInstance_vxstub (IClassFactory* pitf, RPC_STUB_MSG& msg)
- {
- NDRTYPES ndrtypes;
- HRESULT hr;
- HRESULT hrMethod;
- IID riid;
- void* ppvObject_tmp;
- void** ppvObject = &ppvObject_tmp;
- NdrUnmarshalStream* pus = msg.unmarshalStreamGet ();
- /*hr=widlUnmarshal (&pUnkOuter, pus, ndrtypes.interfaceptr_t (IID_IUnknown)); if (FAILED(hr)) return hr;*/
- hr=widlUnmarshal (&riid, pus, StructDesc__GUID (ndrtypes)); if (FAILED(hr)) return hr;
- hrMethod = pitf->CreateInstance (0, riid, ppvObject);
- NdrMarshalStream* pms = msg.marshalStreamGet ();
- hr=widlMarshal (&ppvObject, pms, ndrtypes.refptr_t(ndrtypes.interfaceptr_t (riid))); if (FAILED(hr)) return hr;
- hr = widlMarshal (&hrMethod, pms, ndrtypes.hresult_t());
- if (FAILED(hr))
- return hr;
- ((IUnknown*) (*ppvObject))->Release ();
- return hrMethod;
- }
- HRESULT STDMETHODCALLTYPE IClassFactory_LockServer_vxproxy (IClassFactory* pThis, BOOL fLock)
- {
- RPC_PROXY_MSG msg (IID_IClassFactory, RpcMode::OBJECT, 4, pThis);
- NDRTYPES ndrtypes;
- HRESULT hrMethod;
- HRESULT hr;
- NdrMarshalStream* pms = msg.marshalStreamGet ();
- hr=widlMarshal (&fLock, pms, ndrtypes.int_t ()); if (FAILED(hr)) return hr;
- hr = msg.SendReceive (); if (FAILED (hr)) return hr;
- NdrUnmarshalStream* pus = msg.unmarshalStreamGet ();
- hr = widlUnmarshal (&hrMethod, pus, ndrtypes.hresult_t());
- if (FAILED(hr))
- return hr;
- return hrMethod;
- }
- HRESULT STDMETHODCALLTYPE IClassFactory_LockServer_vxstub (IClassFactory* pitf, RPC_STUB_MSG& msg)
- {
- NDRTYPES ndrtypes;
- HRESULT hr;
- HRESULT hrMethod;
- BOOL fLock;
- NdrUnmarshalStream* pus = msg.unmarshalStreamGet ();
- hr=widlUnmarshal (&fLock, pus, ndrtypes.int_t ()); if (FAILED(hr)) return hr;
- hrMethod = pitf->LockServer (fLock);
- NdrMarshalStream* pms = msg.marshalStreamGet ();
- hr = widlMarshal (&hrMethod, pms, ndrtypes.hresult_t());
- if (FAILED(hr))
- return hr;
- return hrMethod;
- }
- COM_VTABLE(IClassFactory) IClassFactory_vxproxy_vtbl = {
- COM_VTBL_HEADER
- COM_VTBL_METHOD(&IUnknown_QueryInterface_vxproxy),
- COM_VTBL_METHOD(&IUnknown_AddRef_vxproxy),
- COM_VTBL_METHOD(&IUnknown_Release_vxproxy),
- COM_VTBL_METHOD(&IClassFactory_CreateInstance_vxproxy),
- COM_VTBL_METHOD(&IClassFactory_LockServer_vxproxy),
- };
- const PFN_ORPC_STUB stub_functbl_IClassFactory [] =
- {
- 0,0,0,
- (PFN_ORPC_STUB) IClassFactory_CreateInstance_vxstub,
- (PFN_ORPC_STUB) IClassFactory_LockServer_vxstub,
- };
- EXTERN_C const VXDCOM_STUB_DISPTBL IClassFactory_vxstub_disptbl =
- {
- 5,
- stub_functbl_IClassFactory
- };
- VXDCOM_PS_AUTOREGISTER(IClassFactory);