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.

93 lines
2.4 KiB

  1. //
  2. // MODULE: TSHOOT.cpp
  3. //
  4. // PURPOSE: Implementation of DLL Exports
  5. //
  6. // PROJECT: Troubleshooter 99
  7. //
  8. // COMPANY: Saltmine Creative, Inc. (206)-284-7511 [email protected]
  9. //
  10. // AUTHOR: Oleg Kalosha
  11. //
  12. // ORIGINAL DATE: 12.23.98
  13. //
  14. // NOTES:
  15. // Proxy/Stub Information
  16. // To build a separate proxy/stub DLL,
  17. // run nmake -f TSHOOTps.mk in the project directory.
  18. //
  19. // Version Date By Comments
  20. //--------------------------------------------------------------------
  21. // V0.1 12/23/98 OK
  22. #include "stdafx.h"
  23. #include "resource.h"
  24. #include <initguid.h>
  25. #include "TSHOOT.h"
  26. #include "TSHOOT_i.c"
  27. #include "TSHOOTCtrl.h"
  28. CComModule _Module;
  29. BEGIN_OBJECT_MAP(ObjectMap)
  30. OBJECT_ENTRY(CLSID_TSHOOTCtrl, CTSHOOTCtrl)
  31. END_OBJECT_MAP()
  32. HANDLE ghModule = INVALID_HANDLE_VALUE;
  33. //
  34. //
  35. /////////////////////////////////////////////////////////////////////////////
  36. // DLL Entry Point
  37. extern "C"
  38. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  39. {
  40. if (INVALID_HANDLE_VALUE == ghModule)
  41. ghModule = hInstance;
  42. if (dwReason == DLL_PROCESS_ATTACH)
  43. {
  44. _Module.Init(ObjectMap, hInstance, &LIBID_TSHOOTLib);
  45. DisableThreadLibraryCalls(hInstance);
  46. }
  47. else if (dwReason == DLL_PROCESS_DETACH)
  48. _Module.Term();
  49. return TRUE; // ok
  50. }
  51. /////////////////////////////////////////////////////////////////////////////
  52. // Used to determine whether the DLL can be unloaded by OLE
  53. STDAPI DllCanUnloadNow(void)
  54. {
  55. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  56. }
  57. /////////////////////////////////////////////////////////////////////////////
  58. // Returns a class factory to create an object of the requested type
  59. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  60. {
  61. return _Module.GetClassObject(rclsid, riid, ppv);
  62. }
  63. /////////////////////////////////////////////////////////////////////////////
  64. // DllRegisterServer - Adds entries to the system registry
  65. STDAPI DllRegisterServer(void)
  66. {
  67. // registers object, typelib and all interfaces in typelib
  68. return _Module.RegisterServer(TRUE);
  69. }
  70. /////////////////////////////////////////////////////////////////////////////
  71. // DllUnregisterServer - Removes entries from the system registry
  72. STDAPI DllUnregisterServer(void)
  73. {
  74. return _Module.UnregisterServer(TRUE);
  75. }