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.

110 lines
2.7 KiB

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