arpctl.cpp
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 2k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. // ARPCtl.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To build a separate proxy/stub DLL, 
  4. // run nmake -f ARPCtlps.mk in the project directory.
  5. #include "priv.h"
  6. // Define GUIDs
  7. const IID IID_IARPCtl = {0x0CB57B2B,0xD652,0x11D1,{0xB1,0xDE,0x00,0xC0,0x4F,0xC2,0xA1,0x18}};
  8. const IID LIBID_ARPCTLLib = {0x0CB57B1E,0xD652,0x11D1,{0xB1,0xDE,0x00,0xC0,0x4F,0xC2,0xA1,0x18}};
  9. const IID DIID__ARPCtlEvents = {0x0E5B1C7E,0xD87D,0x11d1,{0xB1,0xDE,0x00,0xC0,0x4F,0xC2,0xA1,0x18}};
  10. const CLSID CLSID_CARPCtl = {0x0CB57B2C,0xD652,0x11D1,{0xB1,0xDE,0x00,0xC0,0x4F,0xC2,0xA1,0x18}};
  11. // Globals
  12.     HINSTANCE g_hInst;
  13. // Root ATL stuff
  14. CComModule _Module;
  15. BEGIN_OBJECT_MAP(ObjectMap)
  16. OBJECT_ENTRY(CLSID_CARPCtl, CARPCtl)
  17. END_OBJECT_MAP()
  18. /////////////////////////////////////////////////////////////////////////////
  19. // DLL Entry Point
  20. extern "C"
  21. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  22. {
  23. if (dwReason == DLL_PROCESS_ATTACH)
  24. {
  25. _Module.Init(ObjectMap, hInstance);
  26. DisableThreadLibraryCalls(hInstance);
  27.         g_hInst = hInstance;
  28. #ifdef DEBUG
  29.     CcshellGetDebugFlags();
  30.        
  31.     if (g_dwBreakFlags & BF_ONDLLLOAD)
  32.         DebugBreak();
  33. #endif
  34. }
  35. else if (dwReason == DLL_PROCESS_DETACH)
  36. _Module.Term();
  37. return TRUE;    // ok
  38. }
  39. /////////////////////////////////////////////////////////////////////////////
  40. // Used to determine whether the DLL can be unloaded by OLE
  41. STDAPI DllCanUnloadNow(void)
  42. {
  43. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  44. }
  45. /////////////////////////////////////////////////////////////////////////////
  46. // Returns a class factory to create an object of the requested type
  47. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  48. {
  49. return _Module.GetClassObject(rclsid, riid, ppv);
  50. }
  51. /////////////////////////////////////////////////////////////////////////////
  52. // DllRegisterServer - Adds entries to the system registry
  53. STDAPI DllRegisterServer(void)
  54. {
  55. // registers object, typelib and all interfaces in typelib
  56. return _Module.RegisterServer(TRUE);
  57. }
  58. /////////////////////////////////////////////////////////////////////////////
  59. // DllUnregisterServer - Removes entries from the system registry
  60. STDAPI DllUnregisterServer(void)
  61. {
  62. _Module.UnregisterServer();
  63. return S_OK;
  64. }