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.

59 lines
1.6 KiB

  1. //-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: A T M U T I L . H
  7. //
  8. // Contents: Utility function declaration
  9. //
  10. // Notes:
  11. //
  12. // Author: tongl 12 Mar 1997
  13. //
  14. //-----------------------------------------------------------------------
  15. #pragma once
  16. #include "ncxbase.h"
  17. typedef vector<tstring *> VECSTR;
  18. static const WCHAR c_chSeparator = L'-';
  19. enum AdapterBindingState
  20. {
  21. BIND_ENABLE,
  22. BIND_DISABLE,
  23. BIND_UNSET
  24. };
  25. HRESULT HrLoadSubkeysFromRegistry(const HKEY hkeyParam,
  26. OUT VECSTR * const pvstrAdapters);
  27. VOID GetNodeNum(PCWSTR pszIpAddress, DWORD ardw[4]);
  28. void GetLowerIp(tstring& strIpRange, tstring * pstrLowerIp);
  29. void GetUpperIp(tstring& strIpRange, tstring * pstrUpperIp);
  30. BOOL IsValidIpRange(tstring& strIpLower, tstring& strIpUpper);
  31. void MakeIpRange(tstring& strIpLower, tstring& strIpUpper, tstring * pstrNewIpRange);
  32. void ConvertBinaryToHexString(BYTE * pbData, DWORD cbData, tstring * pstrData);
  33. void ConvertByteToSz(BYTE * pbData, PWSTR pszByte);
  34. void ConvertHexStringToBinaryWithAlloc(PCWSTR pszParamInHex, LPBYTE * ppbData, LPDWORD pcbData);
  35. template<class T>
  36. void CopyColString(T * colDest, const T & colSrc)
  37. {
  38. FreeCollectionAndItem(*colDest);
  39. colDest->reserve(colSrc.size());
  40. for(T::const_iterator iter = colSrc.begin(); iter != colSrc.end(); ++iter)
  41. {
  42. colDest->push_back(new tstring(**iter));
  43. }
  44. }