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.

104 lines
2.9 KiB

  1. //
  2. // T C P U T I L . H
  3. //
  4. // Header of utility functions
  5. //
  6. #pragma once
  7. #include "netcfgx.h"
  8. #include "tcpip.h"
  9. #include "ipctrl.h"
  10. inline BOOL FHrFailed(HRESULT hr)
  11. {
  12. return FAILED(hr);
  13. }
  14. #define CORg(hResult) \
  15. do\
  16. {\
  17. hr = (hResult);\
  18. if (FHrFailed(hr))\
  19. {\
  20. goto Error;\
  21. }\
  22. }\
  23. while (FALSE)
  24. HRESULT HrLoadSubkeysFromRegistry(const HKEY hkeyParam,
  25. OUT VSTR * const pvstrAdapters);
  26. HRESULT HrIsComponentInstalled(INetCfg * pnc,
  27. const GUID& rguidClass,
  28. PCWSTR szInfId,
  29. OUT BOOL * const pfInstalled);
  30. // Get the four numbers from an Ip Address
  31. VOID GetNodeNum(PCWSTR szIpAddress, DWORD ardw[4]);
  32. BOOL IsContiguousSubnet(PCWSTR pszSubnet);
  33. VOID ReplaceFirstAddress(VSTR * pvstr, PCWSTR szIpAddress);
  34. VOID ReplaceSecondAddress(VSTR * pvstr, PCWSTR szIpAddress);
  35. BOOL GenerateSubnetMask(IpControl & ipAddress,
  36. tstring * pstrSubnetMask);
  37. BOOL FRegQueryBool(const HKEY hkey, PCWSTR szName, BOOL fDefaultValue);
  38. VOID ResetLmhostsFile();
  39. int IPAlertPrintf(HWND hwndParent, UINT ids,
  40. int iCurrent, int iLow, int iHigh);
  41. VOID IpCheckRange(LPNMIPADDRESS lpnmipa, HWND hWnd,
  42. int iLow, int iHigh, BOOL fCheckLoopback = FALSE);
  43. VOID SetButtons(HANDLES& h, const int nNumLimit = -1);
  44. BOOL ListBoxRemoveAt(HWND hListBox, int idx, tstring * pstrRemovedItem);
  45. BOOL ListBoxInsertAfter(HWND hListBox, int idx, PCWSTR szItem);
  46. HRESULT HrRegRenameTree(HKEY hkeyRoot, PCWSTR szOldName, PCWSTR szNewName);
  47. HRESULT HrRegCopyKeyTree(HKEY hkeyDest, HKEY hkeySrc );
  48. BOOL fQueryFirstAddress(const VSTR & vstr, tstring * const pstr);
  49. BOOL fQuerySecondAddress(const VSTR & vstr, tstring * const pstr);
  50. BOOL FIsIpInRange(PCWSTR szIp);
  51. VOID ShowContextHelp(HWND hDlg, UINT uCommand, const DWORD* pdwHelpIDs);
  52. VOID AddInterfacesToAdapterInfo(
  53. ADAPTER_INFO* pAdapter,
  54. DWORD dwNumInterfaces);
  55. HRESULT GetGuidArrayFromIfaceColWithCoTaskMemAlloc(
  56. const IFACECOL& IfaceIds,
  57. GUID** ppdw,
  58. DWORD* pdwSize);
  59. VOID GetInterfaceName(
  60. PCWSTR pszAdapterName,
  61. const GUID& guidIfaceId,
  62. tstring* pstrIfaceName);
  63. HRESULT RetrieveStringFromOptionList(PCWSTR pszOption,
  64. PCWSTR szIdentifier,
  65. tstring & str);
  66. VOID ConstructOptionListString(ADAPTER_INFO* pAdapter,
  67. tstring & strOptionList);
  68. HRESULT HrParseOptionList(PCWSTR pszOption,
  69. ADAPTER_INFO* pAdapter);
  70. HRESULT HrGetPrimaryDnsDomain(tstring *pstr);
  71. VOID WriteTcpSetupErrorLog(UINT nIdErrorFormat, ...);
  72. DWORD IPStringToDword(LPCTSTR strIP);
  73. void DwordToIPString(DWORD dwIP, tstring & strIP);
  74. int SearchListViewItem(HWND hListView, int iSubItem, LPCWSTR psz);