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.

67 lines
1.7 KiB

  1. #include "stdafx.h"
  2. #include "resource.h"
  3. #include <initguid.h>
  4. #include "shutdowntask.h"
  5. #include "appliancetask.h"
  6. #include "taskctx.h"
  7. #include "shutdowntask_i.c"
  8. #include "worker.h"
  9. CComModule _Module;
  10. BEGIN_OBJECT_MAP(ObjectMap)
  11. OBJECT_ENTRY(CLSID_SAShutdownTask, CWorker)
  12. END_OBJECT_MAP()
  13. /////////////////////////////////////////////////////////////////////////////
  14. // DLL Entry Point
  15. extern "C"
  16. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  17. {
  18. if (dwReason == DLL_PROCESS_ATTACH)
  19. {
  20. _Module.Init(ObjectMap, hInstance);
  21. DisableThreadLibraryCalls(hInstance);
  22. }
  23. else if (dwReason == DLL_PROCESS_DETACH)
  24. _Module.Term();
  25. return TRUE; // ok
  26. }
  27. /////////////////////////////////////////////////////////////////////////////
  28. // Used to determine whether the DLL can be unloaded by OLE
  29. STDAPI DllCanUnloadNow(void)
  30. {
  31. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  32. }
  33. /////////////////////////////////////////////////////////////////////////////
  34. // Returns a class factory to create an object of the requested type
  35. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  36. {
  37. return _Module.GetClassObject(rclsid, riid, ppv);
  38. }
  39. /////////////////////////////////////////////////////////////////////////////
  40. // DllRegisterServer - Adds entries to the system registry
  41. STDAPI DllRegisterServer(void)
  42. {
  43. // registers object but not type library
  44. return _Module.RegisterServer(FALSE);
  45. }
  46. /////////////////////////////////////////////////////////////////////////////
  47. // DllUnregisterServer - Removes entries from the system registry
  48. STDAPI DllUnregisterServer(void)
  49. {
  50. return _Module.UnregisterServer();
  51. }