Source code of Windows XP (NT5)
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.

94 lines
2.2 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. CComModule _Module;
  13. BEGIN_OBJECT_MAP(ObjectMap)
  14. OBJECT_ENTRY(CLSID_SdoMachine, CSdoMachine)
  15. OBJECT_ENTRY(CLSID_SdoService, CSdoService)
  16. END_OBJECT_MAP()
  17. /////////////////////////////////////////////////////////////////////////////
  18. // DLL Entry Point
  19. extern "C"
  20. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  21. {
  22. if (dwReason == DLL_PROCESS_ATTACH)
  23. {
  24. _Module.Init(ObjectMap, hInstance);
  25. DisableThreadLibraryCalls(hInstance);
  26. }
  27. else if (dwReason == DLL_PROCESS_DETACH)
  28. {
  29. _Module.Term();
  30. }
  31. return TRUE; // ok
  32. }
  33. /////////////////////////////////////////////////////////////////////////////
  34. // Used to determine whether the DLL can be unloaded by OLE
  35. STDAPI DllCanUnloadNow(void)
  36. {
  37. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  38. }
  39. /////////////////////////////////////////////////////////////////////////////
  40. // Returns a class factory to create an object of the requested type
  41. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  42. {
  43. return _Module.GetClassObject(rclsid, riid, ppv);
  44. }
  45. /////////////////////////////////////////////////////////////////////////////
  46. // DllRegisterServer - Adds entries to the system registry
  47. STDAPI DllRegisterServer(void)
  48. {
  49. // registers object, typelib and all interfaces in typelib
  50. HRESULT hr = _Module.RegisterServer(TRUE);
  51. HRESULT hres = S_OK;
  52. if ( SUCCEEDED(hr) )
  53. {
  54. hr = _Module.RegisterTypeLib(L"\\1");
  55. if (FAILED(hr))
  56. {
  57. hres = hr;
  58. }
  59. hr = _Module.RegisterTypeLib(L"\\2");
  60. if (FAILED(hr))
  61. {
  62. hres = hr;
  63. }
  64. }
  65. else
  66. {
  67. hres = hr;
  68. }
  69. return hres;
  70. }
  71. /////////////////////////////////////////////////////////////////////////////
  72. // DllUnregisterServer - Removes entries from the system registry
  73. STDAPI DllUnregisterServer(void)
  74. {
  75. _Module.UnregisterServer();
  76. return S_OK;
  77. }