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.

68 lines
1.5 KiB

  1. //
  2. // NetMisc.cpp
  3. //
  4. // Networking APIs that don't fit into any of the other big buckets
  5. //
  6. // History:
  7. //
  8. // 10/21/1999 KenSh Created (adapted from JetNet source code)
  9. //
  10. #include "stdafx.h"
  11. #include "NetConn.h"
  12. #include "theapp.h"
  13. static const LPCTSTR c_rgUserLevelVxD[] = { _T("FILESEC"), _T("MSSP") };
  14. BOOL WINAPI IsAccessControlUserLevel()
  15. {
  16. CRegistry reg;
  17. for (int i = 0; i < _countof(c_rgUserLevelVxD); i++)
  18. {
  19. if (reg.OpenKey(HKEY_LOCAL_MACHINE, _T("System\\CurrentControlSet\\Services\\VxD"), KEY_READ))
  20. {
  21. if (reg.OpenSubKey(c_rgUserLevelVxD[i]))
  22. return TRUE;
  23. }
  24. }
  25. if (reg.OpenKey(HKEY_LOCAL_MACHINE, _T("Security\\Provider"), KEY_QUERY_VALUE))
  26. {
  27. DWORD dwPlatformType;
  28. if (reg.QueryDwordValue(_T("Platform_Type"), &dwPlatformType))
  29. {
  30. if (dwPlatformType != 0)
  31. return TRUE;
  32. }
  33. }
  34. return FALSE;
  35. }
  36. HRESULT WINAPI DisableUserLevelAccessControl()
  37. {
  38. HRESULT hr = NETCONN_SUCCESS;
  39. CRegistry reg;
  40. for (int i = 0; i < _countof(c_rgUserLevelVxD); i++)
  41. {
  42. reg.OpenKey(HKEY_LOCAL_MACHINE, _T("System\\CurrentControlSet\\Services\\VxD"));
  43. if (ERROR_SUCCESS == RegDeleteKeyAndSubKeys(reg.m_hKey, c_rgUserLevelVxD[i]))
  44. hr = NETCONN_NEED_RESTART;
  45. }
  46. reg.OpenKey(HKEY_LOCAL_MACHINE, _T("Security\\Provider"), KEY_SET_VALUE);
  47. DWORD dwPlatformType = 0;
  48. reg.SetBinaryValue(_T("Platform_Type"), &dwPlatformType, sizeof(DWORD));
  49. return hr;
  50. }
  51. HRESULT WINAPI IcsUninstall(void)
  52. {
  53. return IcsUninstall16();
  54. }