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.

95 lines
2.2 KiB

  1. #include <gptext.h>
  2. #include <initguid.h>
  3. #include <gpedit.h>
  4. //
  5. // Global variables for this DLL
  6. //
  7. LONG g_cRefThisDll = 0;
  8. HINSTANCE g_hInstance;
  9. TCHAR g_szSnapInLocation[] = TEXT("%SystemRoot%\\System32\\gptext.dll");
  10. CRITICAL_SECTION g_ADMCritSec;
  11. TCHAR g_szDisplayProperties[150] = {0};
  12. /////////////////////////////////////////////////////////////////////////////
  13. // DLL Entry Point
  14. extern "C"
  15. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  16. {
  17. if (dwReason == DLL_PROCESS_ATTACH)
  18. {
  19. g_hInstance = hInstance;
  20. DisableThreadLibraryCalls(hInstance);
  21. InitScriptsNameSpace();
  22. InitDebugSupport();
  23. InitializeCriticalSection (&g_ADMCritSec);
  24. LoadString (hInstance, IDS_DISPLAYPROPERTIES, g_szDisplayProperties, ARRAYSIZE(g_szDisplayProperties));
  25. }
  26. if (dwReason == DLL_PROCESS_DETACH)
  27. {
  28. DeleteCriticalSection (&g_ADMCritSec);
  29. }
  30. return TRUE; // ok
  31. }
  32. /////////////////////////////////////////////////////////////////////////////
  33. // Used to determine whether the DLL can be unloaded by OLE
  34. STDAPI DllCanUnloadNow(void)
  35. {
  36. return (g_cRefThisDll == 0 ? S_OK : S_FALSE);
  37. }
  38. /////////////////////////////////////////////////////////////////////////////
  39. // Returns a class factory to create an object of the requested type
  40. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  41. {
  42. HRESULT hr;
  43. hr = CreateScriptsComponentDataClassFactory (rclsid, riid, ppv);
  44. if (hr != CLASS_E_CLASSNOTAVAILABLE)
  45. return S_OK;
  46. hr = CreatePolicyComponentDataClassFactory (rclsid, riid, ppv);
  47. return hr;
  48. }
  49. /////////////////////////////////////////////////////////////////////////////
  50. // DllRegisterServer - Adds entries to the system registry
  51. STDAPI DllRegisterServer(void)
  52. {
  53. RegisterScripts();
  54. RegisterPolicy();
  55. RegisterIPSEC();
  56. RegisterWireless();
  57. RegisterPSCHED();
  58. return S_OK;
  59. }
  60. /////////////////////////////////////////////////////////////////////////////
  61. // DllUnregisterServer - Removes entries from the system registry
  62. STDAPI DllUnregisterServer(void)
  63. {
  64. UnregisterScripts();
  65. UnregisterPolicy();
  66. UnregisterIPSEC();
  67. UnregisterWireless();
  68. UnregisterPSCHED();
  69. return S_OK;
  70. }