, ORPC . , . ORPC- , , IUnknown, ORPC. CoMarshalInterface , . QueryInterface IMarshal. IMarshal QueryInterface, , ORPC. , IMarshal, , ORPC . IMarshal, . . IMarshal, . , .
CoMarshalInterface , , - (stub manager). , .
(Object Identifier OID), . - . - . - , , . , . . , - . , , , . , . , , . , . .
, ORPC- , 1. ORPC- , , . (interface stub). [in], ORPC- , HRESULT [out] ORPC. (Interface Pointer Identifiers - IPIDs), . , . , IUnknown. . 5.3 , . , , , .
CoUnmarshalInterface , (proxy manager). , , . , IUnknown. AddRef Release ORPC. Release , . QueryInterface . , . , , . ORPC. , , . , - . . 5.4 , .
. 5.4, , . RPC . IRpcChannelBuffer
[ uuid(D5F56B60-593B-101A-B569-08002B2DBF7A), local, object ] interface IRpcChannelBuffer : IUnknown { // programmatic representation of ORPC message // ORPC typedef struct tagRPCOLEMESSAGE { void *reserved1; unsigned long dataRepresentation; // endian/ebcdic // endian / - // void *Buffer; // payload goes here // ULONG cbBuffer; // length of payload // ULONG iMethod; // which method? // ? void *reserved2[5]; ULONG rpcFlags; } RPCOLEMESSAGE; // allocate a transmission buffer // HRESULT GetBuffer([inl RPCOLEMESSAGE *pMessage, [in] REFIID riid); // send an ORPC request and receive an ORPC response // ORPC- ORPC- HRESULT SendReceive([in,out] RPCOLEMESSAGE *pMessage, [out] ULONG *pStatus); // deallocate a transmission buffer // HRESULT FreeBuffer([in] RPCOLEMESSAGE *pMessage); // get distance to destination for CoMarshalInterface // CoMarshalInterface HRESULT GetDestCtx([out] DWORD *pdwDestCtx, [out] void **ppvDestCtx); // check for explicit disconnects // HRESULT IsConnected(void); }
SendReceive , ORPC ORPC.
, - . IRpcStubBuffer:
[ uuid(D5F56AFC-593B-101A-B569-08002B2DBF7A), local, object ] interface IRpcStubBuffer : IUnknown { // called to connect stub to object // HRESULT Connect([in] IUnknown *pUnkServer), // called to inform stub to release object // void Disconnect(void); // called when ORPC request arrives // , ORPC HRESULT Invoke ([in] RPCOLEMESSAGE *pmsg, [in] IRpcChannelBuffer *pChannel); // used to support multiple itf types per stub // // IRpcStubBuffer *IsIIDSupported([in] REFIID riid); // used to support multiple itf types per stub // // ULONG CountRefs(vold); // used by ORPC debugger to find pointer to object // ORPC HRESULT DebugServerQueryInterface(void **ppv); // used by ORPC debugger to release pointer to object // ORPC void DebugServerRelease(void *pv); }
Invoke , ORPC . [in]- RPCOLEMESSAGE, HRESULT [out]- , ORPC.
( ), , IRpcProxyBuffer:
[ uuid(D5F56A34-593B-101A-B569-08002B2DBF7A), local, object ] interface IRpcProxyBuffer : IUnknown { HRESULT Connect([in] IRpcChannelBuffer *pChannelBuffer); void Disconnect(void); }
IRpcP ox Buffer IUnknown . , , IUnknown. ORPC Invoke, .
CLSID , . (interface marshaler). IPSFactoryBuffer:
[ uuid(D5F569DO-593B-101A-B569-08002B2DBF7A), local, object ] interface IPSFactoryBuffer : IUnknown { HRESULT CreateProxy( [in] IUnknown *pUnkOuter, // ptr to proxy manager // [in] REFIID riid, // the requested itf to remote // [out] IRpcProxyBuffer **ppProxy, // ptr. to proxy itf. // [out] void **ppv // ptr to remoting interface // ); HRESULT CreateStub( [in] REFIID riid, // the requested itf to remote // [in] IUnknown *pUnkServer, // ptr to actual object // [out] IRpcStubBuffer **ppStub // ptr to stub on output // ); }
CreateProxy . CreateStub .
, IID CLSID . Windows NT 5.0 NT, - . IID CLSID
HKEY_CLASSES_ROOT\Interface
HKEY_CURRENT_USER\Software\Classes\Interface
. Windows NT 4.0 HKEY_CLASSES_ROOT\Interface.
, (ProxyStubClsid32). CLSID . :
[HKCR\Interface\{1A3A29F0-D87E-11d0-8C4F-0080C73925BA}] @="IRacer" [HKCR\Interface\{1A3A29F0-D87E-11d0-8C4F-OB80C73925BA}\ProxyStubClsid32] @="{1A3A29F3-D87E-lld0-8C4F-0080C73925BA}"
, CLSID, {1A3A29F3-D87E-11d0-8C4F-0080C73925BA}, IRacer ({1A3A29F0-D87E-11d0-8C4F-0080C73925BA}). , HKCR\CLSID , CLSID DLL. Windows NT 5.0 , . , , ( ) ThreadingModel="Both" , .
1 IUnknown. , , , IRemUnknown.