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.

123 lines
2.7 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2001.
  5. //
  6. // File: Connui.c
  7. //
  8. // Contents: Wifi Policy management Snapin
  9. //
  10. //
  11. // History: TaroonM
  12. // 10/30/01
  13. //
  14. // This file is not used in the wireless snapin. However, these calls may be useful.
  15. //
  16. //----------------------------------------------------------------------------
  17. #include "precomp.h"
  18. LPWSTR gpszWirelessDSPolicyKey = L"SOFTWARE\\Policies\\Microsoft\\Windows\\WiFi\\GPTWiFiPolicy";
  19. DWORD
  20. WirelessIsDomainPolicyAssigned(
  21. PBOOL pbIsDomainPolicyAssigned
  22. )
  23. {
  24. DWORD dwError = 0;
  25. BOOL bIsDomainPolicyAssigned = FALSE;
  26. HKEY hRegistryKey = NULL;
  27. DWORD dwType = 0;
  28. DWORD dwDSPolicyPathLength = 0;
  29. dwError = RegOpenKeyExW(
  30. HKEY_LOCAL_MACHINE,
  31. (LPCWSTR) gpszWirelessDSPolicyKey,
  32. 0,
  33. KEY_ALL_ACCESS,
  34. &hRegistryKey
  35. );
  36. BAIL_ON_WIN32_ERROR(dwError);
  37. dwError = RegQueryValueExW(
  38. hRegistryKey,
  39. L"DSWiFiPolicyPath",
  40. NULL,
  41. &dwType,
  42. NULL,
  43. &dwDSPolicyPathLength
  44. );
  45. BAIL_ON_WIN32_ERROR(dwError);
  46. if (dwDSPolicyPathLength > 0) {
  47. bIsDomainPolicyAssigned = TRUE;
  48. }
  49. *pbIsDomainPolicyAssigned = bIsDomainPolicyAssigned;
  50. cleanup:
  51. if (hRegistryKey) {
  52. RegCloseKey(hRegistryKey);
  53. }
  54. return (dwError);
  55. error:
  56. *pbIsDomainPolicyAssigned = FALSE;
  57. goto cleanup;
  58. }
  59. DWORD
  60. WirelessGetAssignedDomainPolicyName(
  61. LPWSTR * ppszAssignedDomainPolicyName
  62. )
  63. {
  64. DWORD dwError = 0;
  65. LPWSTR pszAssignedDomainPolicyName = NULL;
  66. HKEY hRegistryKey = NULL;
  67. DWORD dwType = 0;
  68. DWORD dwSize = 0;
  69. dwError = RegOpenKeyExW(
  70. HKEY_LOCAL_MACHINE,
  71. (LPCWSTR) gpszWirelessDSPolicyKey,
  72. 0,
  73. KEY_ALL_ACCESS,
  74. &hRegistryKey
  75. );
  76. BAIL_ON_WIN32_ERROR(dwError);
  77. dwError = RegstoreQueryValue(
  78. hRegistryKey,
  79. L"DSWiFiPolicyName",
  80. REG_SZ,
  81. (LPBYTE *)&pszAssignedDomainPolicyName,
  82. &dwSize
  83. );
  84. BAIL_ON_WIN32_ERROR(dwError);
  85. *ppszAssignedDomainPolicyName = pszAssignedDomainPolicyName;
  86. cleanup:
  87. if (hRegistryKey) {
  88. RegCloseKey(hRegistryKey);
  89. }
  90. return (dwError);
  91. error:
  92. *ppszAssignedDomainPolicyName = NULL;
  93. goto cleanup;
  94. }