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.

88 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. SecMan.cpp
  5. Abstract:
  6. Implementation of DLL Exports.
  7. Author:
  8. Steven Chan (t-schan) July 2002
  9. --*/
  10. // Note: Proxy/Stub Information
  11. // To build a separate proxy/stub DLL,
  12. // run nmake -f SecManps.mk in the project directory.
  13. #include "stdafx.h"
  14. #include "resource.h"
  15. #include <initguid.h>
  16. #include "SecMan.h"
  17. #include "SecMan_i.c"
  18. #include "SecurityDatabase.h"
  19. CComModule _Module;
  20. BEGIN_OBJECT_MAP(ObjectMap)
  21. OBJECT_ENTRY(CLSID_SecurityDatabase, CSecurityDatabase)
  22. END_OBJECT_MAP()
  23. /////////////////////////////////////////////////////////////////////////////
  24. // DLL Entry Point
  25. extern "C"
  26. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  27. {
  28. if (dwReason == DLL_PROCESS_ATTACH)
  29. {
  30. _Module.Init(ObjectMap, hInstance, &LIBID_SECMANLib);
  31. DisableThreadLibraryCalls(hInstance);
  32. }
  33. else if (dwReason == DLL_PROCESS_DETACH)
  34. _Module.Term();
  35. return TRUE; // ok
  36. }
  37. /////////////////////////////////////////////////////////////////////////////
  38. // Used to determine whether the DLL can be unloaded by OLE
  39. STDAPI DllCanUnloadNow(void)
  40. {
  41. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  42. }
  43. /////////////////////////////////////////////////////////////////////////////
  44. // Returns a class factory to create an object of the requested type
  45. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  46. {
  47. return _Module.GetClassObject(rclsid, riid, ppv);
  48. }
  49. /////////////////////////////////////////////////////////////////////////////
  50. // DllRegisterServer - Adds entries to the system registry
  51. STDAPI DllRegisterServer(void)
  52. {
  53. // registers object, typelib and all interfaces in typelib
  54. return _Module.RegisterServer(TRUE);
  55. }
  56. /////////////////////////////////////////////////////////////////////////////
  57. // DllUnregisterServer - Removes entries from the system registry
  58. STDAPI DllUnregisterServer(void)
  59. {
  60. return _Module.UnregisterServer(TRUE);
  61. }