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.

118 lines
2.7 KiB

  1. // SlayerXP.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To build a separate proxy/stub DLL,
  4. // run nmake -f SlayerUIps.mk in the project directory.
  5. #include "stdafx.h"
  6. #include "resource.h"
  7. #include <initguid.h>
  8. #include "shlobjp.h"
  9. #include "SlayerXP.h"
  10. #include <stdio.h>
  11. #include <stdarg.h>
  12. #include "SlayerXP_i.c"
  13. #include "ShellExtensions.h"
  14. // {513d916f-2a8e-4f51-aeab-0cbc76fb1af8}
  15. static const CLSID CLSID_ShimLayerPropertyPage =
  16. { 0x513d916f, 0x2a8e, 0x4f51, { 0xae, 0xab, 0x0c, 0xbc, 0x76, 0xfb, 0x1a, 0xf8 } };
  17. HINSTANCE g_hInstance;
  18. CLayerUIModule _Module;
  19. BEGIN_OBJECT_MAP(ObjectMap)
  20. OBJECT_ENTRY(CLSID_ShimLayerPropertyPage, CLayerUIPropPage)
  21. END_OBJECT_MAP()
  22. #if DBG
  23. /////////////////////////////////////////////////////////////////////////////
  24. // LogMsgDbg
  25. void LogMsgDbg(
  26. LPTSTR pwszFmt,
  27. ... )
  28. {
  29. WCHAR gwszT[1024];
  30. va_list arglist;
  31. va_start(arglist, pwszFmt);
  32. _vsnwprintf(gwszT, 1023, pwszFmt, arglist);
  33. gwszT[1023] = 0;
  34. va_end(arglist);
  35. OutputDebugStringW(gwszT);
  36. }
  37. #endif // DBG
  38. /////////////////////////////////////////////////////////////////////////////
  39. // DLL Entry Point
  40. extern "C"
  41. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  42. {
  43. if (dwReason == DLL_PROCESS_ATTACH)
  44. {
  45. g_hInstance = hInstance;
  46. _Module.Init(ObjectMap, hInstance, &LIBID_SLAYERUILib);
  47. SHFusionInitializeFromModuleID(hInstance, SXS_MANIFEST_RESOURCE_ID);
  48. LinkWindow_RegisterClass();
  49. DisableThreadLibraryCalls(hInstance);
  50. }
  51. else if (dwReason == DLL_PROCESS_DETACH) {
  52. SHFusionUninitialize();
  53. _Module.Term();
  54. }
  55. return TRUE; // ok
  56. }
  57. /////////////////////////////////////////////////////////////////////////////
  58. // Used to determine whether the DLL can be unloaded by OLE
  59. STDAPI DllCanUnloadNow(void)
  60. {
  61. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  62. }
  63. /////////////////////////////////////////////////////////////////////////////
  64. // Returns a class factory to create an object of the requested type
  65. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  66. {
  67. return _Module.GetClassObject(rclsid, riid, ppv);
  68. }
  69. /////////////////////////////////////////////////////////////////////////////
  70. // DllRegisterServer - Adds entries to the system registry
  71. STDAPI DllRegisterServer(void)
  72. {
  73. // registers object, typelib and all interfaces in typelib
  74. return _Module.RegisterServer(TRUE);
  75. }
  76. /////////////////////////////////////////////////////////////////////////////
  77. // DllUnregisterServer - Removes entries from the system registry
  78. STDAPI DllUnregisterServer(void)
  79. {
  80. return _Module.UnregisterServer(TRUE);
  81. }