1 / 15

Server Types

Local server process. Client Process. In-process server. In-process object. COM. Local server. Stub. Local object. RPC. COM. Remote Machine. Local object proxy. Remote server process. COM. Remote server. Stub. Remote object. Remote object proxy. RPC. Server Types.

Télécharger la présentation

Server Types

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Local server process Client Process In-process server In-process object COM Local server Stub Local object RPC COM Remote Machine Local object proxy Remote server process COM Remote server Stub Remote object Remote object proxy RPC Server Types Client

  2. Implementation can be independent of execution context. Object Class factory: Creates objects Implementation differs between DLL and EXE servers. The Generic Structure of a Server Module Object interfaces (as many as desired) IClassFactory(2) Registration Exposure for Class factory Unloading mechanism Sever module

  3. Registry Entries In-process servers: InprocServer32=<path to DLL> Object handlers: InprocHandler32=<path to DLL> Local servers: LocalServer32=<path to EXE>

  4. Self-Registration • DLL Servers • DllRegisterServer • DllUnregisterServer • EXE servers  Command arguments • /RegServer • /UnregServer

  5. Exposing the Class Factory In-Process Server • Implement DllGetClassObject • Implement DllCanUnloadNow STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv); STDAPI DllCanUnloadNow(void);

  6. Exposing the Class Factory Local Server • CoRegisterClassObject • CoRevokeClassObject STDAPI CoRegisterClassObject( REFCLSID rclsid, IUnknown * pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister ); HRESULT CoRevokeClassObject(DWORDdwRegister);

  7.          In-Process-Server Creation

  8.         Local-Server Creation

  9. Marshaling • There are three types of marshaling • Type library marshaling • Standard marshaling • Custom marshaling

  10. Type Library Marshaling • Uses the automation marshaler “oleaut32.dll” provided by COM • You must register the type library for the component • The type of the arguments has to be compatible with C++ Variant structure

  11. Standard Marshaling • The proxy-stub DLL for standard marshaling can be produced by the help of MIDL compiler

  12. Custom Marshaling • Quite involved and needed when the methods in an interface use user defined data types • Need to implement IMarshal

  13. Type Library Marshaling

  14. Standard Marshaling

  15. Exercises • Use standard marshaling to implement CalculatorMemory as a local server.

More Related