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.

85 lines
2.7 KiB

  1. ; Copyright (C) 1992 Microsoft Corporation
  2. ; All rights reserved.
  3. ;
  4. ; This file should contained the default gateway IP address, adapter IP
  5. ; Addresses and subnet mask IP addresses. To change the default gateway,
  6. ; change the line:
  7. ; DefaultGateway = "xxx.xxx.xxx.xxx"
  8. ; where xxx.xxx.xxx.xxx is a valid IP address. If the default gateway is
  9. ; unknown, please change it to:
  10. ; DefaultGateway = ""
  11. ;
  12. ; To change the default IP addresses and subnet mask IP addresses. First,
  13. ; change the line:
  14. ; NumberOfIPAddress = X
  15. ; where X is the number of IP addresses which you want to specify for this
  16. ; machine.
  17. ;
  18. ; Then change or add the following lines for each IP address pair:
  19. ; IPAddress<Y> = "xxx.xxx.xxx.xxx"
  20. ; SubnetMask<Y> = "xxx.xxx.xxx.xxx"
  21. ; where Y is IP addresses pair number and xxx.xxx.xxx.xxx are valid IP
  22. ; addresses.
  23. ;
  24. ; Example:
  25. ;
  26. ;[DefaultIPInfo]
  27. ; DefaultGateway = "11.1.0.0"
  28. ; NumberOfIPAddress = 3
  29. ; IPAddress1 = "11.1.12.1"
  30. ; SubnetMask1 = "255.255.0.1"
  31. ; IPAddress2 = "11.1.12.2"
  32. ; SubnetMask2 = "255.255.0.2"
  33. ; IPAddress3 = "11.1.12.3"
  34. ; SubnetMask3 = "255.255.0.3"
  35. [DefaultIPInfo]
  36. DefaultGateway = ""
  37. NumberOfIPAddress = 1
  38. IPAddress1 = ""
  39. SubnetMask1 = "255.255.0.0"
  40. ;------------------------------------------------------------------------
  41. ; GetIPInfo: Returns the default gateway IP address, a list of default IP
  42. ; addresses and a list of default subnet mask IP addresses to the
  43. ; caller.
  44. ;------------------------------------------------------------------------
  45. [GetIPInfo]
  46. set DefaultGateway = ""
  47. set NumberOfIPAddress = 0
  48. set IPAddressList = ""
  49. set SubnetMaskList = ""
  50. read-syms DefaultIPInfo
  51. set Count = 1
  52. set UseHostFile = TRUE
  53. LoadLibrary "x" $(!STF_CWDDIR)\tcpcfg.dll !TCPCFG_HANDLE
  54. LibraryProcedure Result, $(!TCPCFG_HANDLE), CPlGetIPAddress
  55. freeLibrary $(!TCPCFG_HANDLE)
  56. ifint *($(Result),1) == 0
  57. set IPAddressList = {*($(Result),2)}
  58. else
  59. set UseHostFile = FALSE
  60. endif
  61. LOOP = +
  62. ifint $(Count) <= $(NumberOfIPAddress)
  63. ifstr(i) $(UseHostFile) == FALSE
  64. ifstr(i) $(IPAddressList) == ""
  65. set IPAddressList = $(IPAddress$(Count))
  66. else
  67. set IPAddressList = >($(IPAddressList),$(IPAddress$(Count))))
  68. endif
  69. endif
  70. ifstr(i) $(SubnetMaskList) == ""
  71. set SubnetMaskList = $(SubnetMask$(Count))
  72. else
  73. set SubnetMaskList = >($(SubnetMaskList),$(SubnetMask$(Count)))
  74. endif
  75. set-add Count = $(Count), 1
  76. goto LOOP
  77. endif
  78. return $(DefaultGateway), $(IPAddressList), $(SubnetMaskList)