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.

147 lines
2.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1999.
  5. //
  6. // File: L A N A M A P . H
  7. //
  8. // Contents: NetBios Lana map routines.
  9. //
  10. // Notes:
  11. //
  12. // Author: billbe 17 Feb 1999
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "nb30.h"
  17. #include "ncstring.h"
  18. #include "netcfg.h"
  19. #include "util.h"
  20. //
  21. // Structure of LANA MAP
  22. //
  23. // The Lana map is a simple structure that looks like this in memory:
  24. //
  25. // Entry #0 Entry #1 ..... Entry #n
  26. // |-----------|-----------| ..... |-----------|
  27. // | 0x01 0x00 | 0x00 0x01 | ..... | 0x01 0x03 |
  28. // |-----------|-----------| ..... |-----------|
  29. // EP0 LN0 EP1 LN1 EPn LNn
  30. //
  31. // EP is "ExportPref" - means that when someone asks for the list of
  32. // all Lana numbers, entries with a 0 here will not be returned.
  33. //
  34. // LN is the "Lana number" - see the IBM NetBIOS spec for details.
  35. // Basically, this describes a single, unique network route which
  36. // uses NetBIOS.
  37. //
  38. // Using the above example, Entry #0 has a lana number of 0 and WILL
  39. // be returned during enumeration. Entry #1 has a lana number of 1
  40. // and WILL NOT be returned.
  41. //
  42. struct REG_LANA_ENTRY
  43. {
  44. BYTE Exported;
  45. BYTE LanaNumber;
  46. };
  47. class CLanaEntry
  48. {
  49. public:
  50. PCWSTR pszBindPath;
  51. REG_LANA_ENTRY RegLanaEntry;
  52. };
  53. class CLanaMap : public vector<CLanaEntry>
  54. {
  55. public:
  56. CLanaMap()
  57. {
  58. ZeroMemory (this, sizeof (*this));
  59. m_RegistryLanaMap.SetGranularity (256);
  60. }
  61. ~CLanaMap()
  62. {
  63. MemFree ((VOID*)m_pszBindPathsBuffer);
  64. };
  65. VOID
  66. Clear()
  67. {
  68. clear();
  69. }
  70. UINT
  71. CountEntries() const
  72. {
  73. return size();
  74. }
  75. VOID
  76. Dump (
  77. CWideString* pstr) const;
  78. HRESULT
  79. HrReserveRoomForEntries (
  80. IN UINT cEntries);
  81. HRESULT
  82. HrAppendEntry (
  83. IN CLanaEntry* pEntry);
  84. BYTE
  85. GetExportValue (
  86. IN const CComponentList& Components,
  87. IN PCWSTR pszBindPath);
  88. HRESULT
  89. HrSetLanaNumber (
  90. IN BYTE OldLanaNumber,
  91. IN BYTE NewLanaNumber);
  92. HRESULT
  93. HrCreateRegistryMap();
  94. VOID
  95. GetLanaEntry (
  96. IN const CComponentList& Components,
  97. IN CLanaEntry* pEntry);
  98. HRESULT
  99. HrLoadLanaMap();
  100. BYTE
  101. GetMaxLana();
  102. HRESULT
  103. HrWriteLanaConfiguration (
  104. IN const CComponentList& Components);
  105. private:
  106. PCWSTR m_pszBindPathsBuffer;
  107. BYTE m_LanasInUse[MAX_LANA + 1];
  108. CDynamicBuffer m_RegistryLanaMap;
  109. HRESULT
  110. HrWriteLanaMapConfig();
  111. };
  112. HRESULT
  113. HrUpdateLanaConfig (
  114. IN const CComponentList& Components,
  115. IN PCWSTR pszBindPaths,
  116. IN UINT cPaths);
  117. VOID
  118. GetFirstComponentFromBindPath (
  119. IN PCWSTR pszBindPath,
  120. OUT PCWSTR* ppszComponentStart,
  121. OUT DWORD* pcchComponent);