Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.6 KiB

  1. //==============================================================;
  2. //
  3. // This source code is only intended as a supplement to existing Microsoft documentation.
  4. //
  5. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  6. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  7. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  8. // PURPOSE.
  9. //
  10. // Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  11. //==============================================================;
  12. // ExtSnap.cpp : Implementation of DLL Exports.
  13. // Note: Proxy/Stub Information
  14. // To build a separate proxy/stub DLL,
  15. // run nmake -f ExtSnapps.mk in the project directory.
  16. #include "stdafx.h"
  17. #include "resource.h"
  18. #include <initguid.h>
  19. #include "ExtSnap.h"
  20. #include "ExtSnap_i.c"
  21. #include "About.h"
  22. #include "ClassExtSnap.h"
  23. // our globals
  24. HINSTANCE g_hinst;
  25. CComModule _Module;
  26. BEGIN_OBJECT_MAP(ObjectMap)
  27. OBJECT_ENTRY(CLSID_About, CAbout)
  28. OBJECT_ENTRY(CLSID_ClassExtSnap, CClassExtSnap)
  29. END_OBJECT_MAP()
  30. /////////////////////////////////////////////////////////////////////////////
  31. // DLL Entry Point
  32. extern "C"
  33. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  34. {
  35. if (dwReason == DLL_PROCESS_ATTACH)
  36. {
  37. g_hinst = hInstance;
  38. _Module.Init(ObjectMap, hInstance, &LIBID_EXTSNAPLib);
  39. DisableThreadLibraryCalls(hInstance);
  40. }
  41. else if (dwReason == DLL_PROCESS_DETACH)
  42. _Module.Term();
  43. return TRUE; // ok
  44. }
  45. /////////////////////////////////////////////////////////////////////////////
  46. // Used to determine whether the DLL can be unloaded by OLE
  47. STDAPI DllCanUnloadNow(void)
  48. {
  49. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  50. }
  51. /////////////////////////////////////////////////////////////////////////////
  52. // Returns a class factory to create an object of the requested type
  53. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  54. {
  55. return _Module.GetClassObject(rclsid, riid, ppv);
  56. }
  57. /////////////////////////////////////////////////////////////////////////////
  58. // DllRegisterServer - Adds entries to the system registry
  59. STDAPI DllRegisterServer(void)
  60. {
  61. // registers object, typelib and all interfaces in typelib
  62. return _Module.RegisterServer(FALSE);
  63. }
  64. /////////////////////////////////////////////////////////////////////////////
  65. // DllUnregisterServer - Removes entries from the system registry
  66. STDAPI DllUnregisterServer(void)
  67. {
  68. return _Module.UnregisterServer(FALSE);
  69. }