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.

114 lines
2.2 KiB

  1. /*++
  2. Copyright (c) 2000, Microsoft Corporation
  3. Module Name:
  4. dnsfile.h
  5. Abstract:
  6. This module contains declarations for the DNS proxy's file
  7. management.
  8. Author:
  9. Raghu Gatta (rgatta) 21-Nov-2000
  10. Revision History:
  11. --*/
  12. #ifndef _NATHLP_DNSFILE_H_
  13. #define _NATHLP_DNSFILE_H_
  14. //
  15. // Sockets hosts.ics file stuff
  16. // NOTE: The hosts.ics file will reside in the same directory as the hosts file
  17. //
  18. #define HOSTS_FILE_DIRECTORY L"\\drivers\\etc"
  19. #define HOSTDB_SIZE (MAX_PATH + 12) // 12 == strlen("\\hosts.ics") + 1
  20. #define HOSTSICSFILE "hosts.ics"
  21. #define HOSTSICSFILE_HEADER \
  22. "# Copyright (c) 1993-2001 Microsoft Corp.\n" \
  23. "#\n" \
  24. "# This file has been automatically generated for use by Microsoft Internet\n" \
  25. "# Connection Sharing. It contains the mappings of IP addresses to host names\n"\
  26. "# for the home network. Please do not make changes to the HOSTS.ICS file.\n" \
  27. "# Any changes may result in a loss of connectivity between machines on the\n" \
  28. "# local network.\n" \
  29. "#\n" \
  30. "\n"
  31. typedef struct _IP_DNS_PROXY_FILE_INFO
  32. {
  33. CRITICAL_SECTION Lock;
  34. FILE *HostFile;
  35. CHAR HostFileName[HOSTDB_SIZE];
  36. CHAR HostLineBuf[BUFSIZ + 1];
  37. // temp values in the context of current file processing
  38. SYSTEMTIME HostTime;
  39. PCHAR pHostName;
  40. ULONG Ip4Address;
  41. } IP_DNS_PROXY_FILE_INFO, *PIP_DNS_PROXY_FILE_INFO;
  42. //
  43. // FUNCTION DECLARATIONS
  44. //
  45. ULONG
  46. DnsInitializeFileManagement(
  47. VOID
  48. );
  49. VOID
  50. DnsShutdownFileManagement(
  51. VOID
  52. );
  53. BOOL
  54. DnsEndHostsIcsFile(
  55. VOID
  56. );
  57. BOOL
  58. DnsSetHostsIcsFile(
  59. BOOL fOverwrite
  60. );
  61. BOOL
  62. GetHostFromHostsIcsFile(
  63. BOOL fStartup
  64. );
  65. VOID
  66. LoadHostsIcsFile(
  67. BOOL fStartup
  68. );
  69. VOID
  70. SaveHostsIcsFile(
  71. BOOL fShutdown
  72. );
  73. BOOL
  74. IsFileTimeExpired(
  75. FILETIME *ftTime
  76. );
  77. BOOL
  78. IsSuffixValid(
  79. WCHAR *pszName,
  80. WCHAR *pszSuffix
  81. );
  82. #endif // _NATHLP_DNSFILE_H_