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.

96 lines
2.4 KiB

  1. // CompatUI.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To build a separate proxy/stub DLL,
  4. // run nmake -f CompatUIps.mk in the project directory.
  5. #include "stdafx.h"
  6. #include "resource.h"
  7. #include <initguid.h>
  8. #include <commctrl.h>
  9. #include "CompatUI.h"
  10. #include "CompatUI_i.c"
  11. #include "ProgView.h"
  12. #include "util.h"
  13. #include "SelectFile.h"
  14. #include "shfusion.h"
  15. #include "Upload.h"
  16. CComModule _Module;
  17. BEGIN_OBJECT_MAP(ObjectMap)
  18. OBJECT_ENTRY(CLSID_ProgView, CProgView)
  19. OBJECT_ENTRY(CLSID_Util, CUtil)
  20. OBJECT_ENTRY(CLSID_SelectFile, CSelectFile)
  21. OBJECT_ENTRY(CLSID_Upload, CUpload)
  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. #ifndef NO_FUSION
  31. BOOL bFusionInit;
  32. bFusionInit = SHFusionInitializeFromModuleID(hInstance,124);
  33. ATLTRACE(TEXT("Fusion init 0x%lx\n"), bFusionInit);
  34. #endif
  35. _Module.Init(ObjectMap, hInstance, &LIBID_COMPATUILib);
  36. DisableThreadLibraryCalls(hInstance);
  37. }
  38. else if (dwReason == DLL_PROCESS_DETACH) {
  39. _Module.Term();
  40. #ifndef NO_FUSION
  41. SHFusionUninitialize();
  42. #endif
  43. }
  44. return TRUE; // ok
  45. }
  46. /////////////////////////////////////////////////////////////////////////////
  47. // Used to determine whether the DLL can be unloaded by OLE
  48. STDAPI DllCanUnloadNow(void)
  49. {
  50. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  51. }
  52. /////////////////////////////////////////////////////////////////////////////
  53. // Returns a class factory to create an object of the requested type
  54. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  55. {
  56. return _Module.GetClassObject(rclsid, riid, ppv);
  57. }
  58. /////////////////////////////////////////////////////////////////////////////
  59. // DllRegisterServer - Adds entries to the system registry
  60. STDAPI DllRegisterServer(void)
  61. {
  62. // registers object, typelib and all interfaces in typelib
  63. return _Module.RegisterServer(TRUE);
  64. }
  65. /////////////////////////////////////////////////////////////////////////////
  66. // DllUnregisterServer - Removes entries from the system registry
  67. STDAPI DllUnregisterServer(void)
  68. {
  69. return _Module.UnregisterServer(TRUE);
  70. }