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.

95 lines
2.3 KiB

  1. // sdoias.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To build a separate proxy/stub DLL,
  4. // run nmake -f sdoiasps.mk in the project directory.
  5. #include "stdafx.h"
  6. #include <ias.h>
  7. #include <initguid.h>
  8. #include <sdoiaspriv.h>
  9. #include "sdo.h"
  10. #include "sdomachine.h"
  11. #include "sdoservice.h"
  12. #include "newop.cpp"
  13. CComModule _Module;
  14. BEGIN_OBJECT_MAP(ObjectMap)
  15. OBJECT_ENTRY(CLSID_SdoMachine, CSdoMachine)
  16. OBJECT_ENTRY(CLSID_SdoService, CSdoService)
  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. }
  28. else if (dwReason == DLL_PROCESS_DETACH)
  29. {
  30. _Module.Term();
  31. }
  32. return TRUE; // ok
  33. }
  34. /////////////////////////////////////////////////////////////////////////////
  35. // Used to determine whether the DLL can be unloaded by OLE
  36. STDAPI DllCanUnloadNow(void)
  37. {
  38. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  39. }
  40. /////////////////////////////////////////////////////////////////////////////
  41. // Returns a class factory to create an object of the requested type
  42. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  43. {
  44. return _Module.GetClassObject(rclsid, riid, ppv);
  45. }
  46. /////////////////////////////////////////////////////////////////////////////
  47. // DllRegisterServer - Adds entries to the system registry
  48. STDAPI DllRegisterServer(void)
  49. {
  50. // registers object, typelib and all interfaces in typelib
  51. HRESULT hr = _Module.RegisterServer(TRUE);
  52. HRESULT hres = S_OK;
  53. if ( SUCCEEDED(hr) )
  54. {
  55. hr = _Module.RegisterTypeLib(L"\\1");
  56. if (FAILED(hr))
  57. {
  58. hres = hr;
  59. }
  60. hr = _Module.RegisterTypeLib(L"\\2");
  61. if (FAILED(hr))
  62. {
  63. hres = hr;
  64. }
  65. }
  66. else
  67. {
  68. hres = hr;
  69. }
  70. return hres;
  71. }
  72. /////////////////////////////////////////////////////////////////////////////
  73. // DllUnregisterServer - Removes entries from the system registry
  74. STDAPI DllUnregisterServer(void)
  75. {
  76. _Module.UnregisterServer();
  77. return S_OK;
  78. }