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.

174 lines
3.9 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. init.h
  5. Abstract:
  6. This module contains all of the code to
  7. initialize the variables for the WirelessPOl Service.
  8. Author:
  9. abhisheV 30-September-1999
  10. taroonM 11/17/01
  11. Environment
  12. User Level: Win32
  13. Revision History:
  14. --*/
  15. #include "precomp.h"
  16. DWORD
  17. InitSPDThruRegistry(
  18. )
  19. {
  20. DWORD dwError = 0;
  21. HKEY hKey = NULL;
  22. DWORD dwtype = REG_DWORD;
  23. DWORD dwsize = sizeof(DWORD);
  24. dwError = RegOpenKey(
  25. HKEY_LOCAL_MACHINE,
  26. gpszLocPolicyAgent,
  27. &hKey
  28. );
  29. if (dwError) {
  30. gdwDSConnectivityCheck = DEFAULT_DS_CONNECTIVITY_CHECK;
  31. dwError = ERROR_SUCCESS;
  32. BAIL_ON_WIN32_SUCCESS(dwError);
  33. }
  34. //
  35. // Get DS connectivity check polling interval in minutes.
  36. //
  37. dwError = RegQueryValueEx(
  38. hKey,
  39. L"DSConnectivityCheck",
  40. 0,
  41. &dwtype,
  42. (unsigned char *) &gdwDSConnectivityCheck,
  43. &dwsize
  44. );
  45. if (dwError || !gdwDSConnectivityCheck) {
  46. gdwDSConnectivityCheck = DEFAULT_DS_CONNECTIVITY_CHECK;
  47. dwError = ERROR_SUCCESS;
  48. }
  49. success:
  50. if (hKey) {
  51. RegCloseKey(hKey);
  52. }
  53. return (dwError);
  54. }
  55. DWORD
  56. InitSPDGlobals(
  57. )
  58. {
  59. DWORD dwError = 0;
  60. SECURITY_ATTRIBUTES SecurityAttributes;
  61. LPWSTR pszLogFileName = L"WLogFile.txt";
  62. //dwError = InitializeSPDSecurity(&gpSPDSD);
  63. //BAIL_ON_WIN32_ERROR(dwError);
  64. //InitializeCriticalSection(&gcSPDAuditSection);
  65. //gbSPDAuditSection = TRUE;
  66. gdwPolicyLoopStarted = 0;
  67. gdwWirelessPolicyEngineInited = 0;
  68. memset(&SecurityAttributes, 0, sizeof(SECURITY_ATTRIBUTES));
  69. SecurityAttributes.nLength = sizeof(SecurityAttributes);
  70. SecurityAttributes.lpSecurityDescriptor = NULL;
  71. SecurityAttributes.bInheritHandle = TRUE;
  72. ghNewDSPolicyEvent = CreateEvent(
  73. &SecurityAttributes,
  74. TRUE,
  75. FALSE,
  76. WIRELESS_NEW_DS_POLICY_EVENT
  77. );
  78. if (!ghNewDSPolicyEvent) {
  79. dwError = GetLastError();
  80. _WirelessDbg(TRC_ERR, "%d In ghNewDSPolicyEvent check ",dwError);
  81. BAIL_ON_WIN32_ERROR(dwError);
  82. }
  83. //Taroon define POLICY RELOAD and CHANGE NOTIFY in some global location -- ipsec does it in ipsec.h
  84. ghForcedPolicyReloadEvent = CreateEvent(
  85. &SecurityAttributes,
  86. TRUE,
  87. FALSE,
  88. NULL
  89. );
  90. if (!ghForcedPolicyReloadEvent) {
  91. dwError = GetLastError();
  92. BAIL_ON_WIN32_ERROR(dwError);
  93. }
  94. ghPolicyChangeNotifyEvent = CreateEvent(
  95. NULL,
  96. TRUE,
  97. FALSE,
  98. NULL
  99. );
  100. if (!ghPolicyChangeNotifyEvent) {
  101. dwError = GetLastError();
  102. BAIL_ON_WIN32_ERROR(dwError);
  103. }
  104. ghPolicyEngineStopEvent = CreateEvent(
  105. &SecurityAttributes,
  106. TRUE,
  107. FALSE,
  108. NULL
  109. );
  110. if (!ghPolicyEngineStopEvent) {
  111. dwError = GetLastError();
  112. BAIL_ON_WIN32_ERROR(dwError);
  113. }
  114. ghReApplyPolicy8021x = CreateEvent(
  115. &SecurityAttributes,
  116. TRUE,
  117. FALSE,
  118. NULL
  119. );
  120. if (!ghReApplyPolicy8021x) {
  121. dwError = GetLastError();
  122. BAIL_ON_WIN32_ERROR(dwError);
  123. }
  124. error:
  125. return (dwError);
  126. }