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.

150 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1989-91 Microsoft Corporation
  3. Module Name:
  4. MapSupp.h
  5. Abstract:
  6. These are support routines used by the 16/32 mapping layer for the LanMan
  7. API.
  8. Author:
  9. Dan Hinsley (DanHi) 10-Apr-1991
  10. Environment:
  11. These routines are statically linked in the caller's executable and
  12. are callable from user mode.
  13. Revision History:
  14. 10-Apr-1991 DanHi
  15. Created.
  16. 18-Aug-1991 JohnRo
  17. Implement downlevel NetWksta APIs. (Moved to NetLib, etc.)
  18. --*/
  19. #ifndef _MAPSUPP_
  20. #define _MAPSUPP_
  21. //
  22. // Structure used by the NetpMoveStrings function
  23. //
  24. typedef struct _MOVESTRING_ {
  25. DWORD Source; // May be MOVESTRING_END_MARKER.
  26. DWORD Destination; // May be MOVESTRING_END_MARKER.
  27. } MOVESTRING, *PMOVESTRING, *LPMOVESTRING;
  28. #define MOVESTRING_END_MARKER ( (DWORD) -1 )
  29. //
  30. // macro, This for loop is used lots of places, so I've
  31. // centralized it here. The idea is that is builds the Levelxxx names
  32. // based on the Dest and Src parameters (destination level, source level)
  33. // using token pasting. So the macro looks like bad, but once you see
  34. // what it's doing, the invocation in the code is easier reading.
  35. //
  36. // example:
  37. //
  38. // BUILD_LENGTH_ARRAY(BytesRequired, 10, 101, Wksta)
  39. //
  40. // expands to
  41. //
  42. // for (i = 0; NetpWksta10_101[i].Source != MOVESTRING_END_MARKER; i++) {
  43. // if (*((PCHAR) pLevel101 + NetpWksta10_101[i].Source)) {
  44. // Level10_101_Length[i] =
  45. // STRLEN(*((PCHAR *) ((PCHAR) pLevel101 +
  46. // NetpWksta10_101[i].Source))) + 1;
  47. // BytesRequired += Level10_101_Length[i];
  48. // }
  49. // else {
  50. // Level10_101_Length[i] = 0;
  51. // }
  52. // }
  53. //
  54. // The construct *((PCHAR *) ((PCHAR) pLevel101 + NetpWksta10_101[i].Source))
  55. // takes a pointer to a lanman structure (pLevel101) and an offset into
  56. // that structure (NetpWksta10_101[i].Source) that points to an LPSTR in the
  57. // structure, and creates the LPSTR that can be used by strxxx functions.
  58. //
  59. #define BUILD_LENGTH_ARRAY(BytesRequired, Dest, Src, Kind) \
  60. \
  61. for (i = 0; Netp##Kind##Dest##_##Src##[i].Source != MOVESTRING_END_MARKER; i++) { \
  62. if ( * ( LPTSTR* ) ( (LPBYTE) pLevel##Src + Netp##Kind##Dest##_##Src##[i].Source ) ) {\
  63. Level##Dest##_##Src##_Length[i] = \
  64. STRLEN(*( LPTSTR* )( (LPBYTE) pLevel##Src + Netp##Kind##Dest##_##Src##[i].Source )) + 1;\
  65. BytesRequired += Level##Dest##_##Src##_##Length[i] * sizeof( TCHAR ); \
  66. } else { \
  67. Level##Dest##_##Src##_Length[i] = 0; \
  68. } \
  69. }
  70. BOOL
  71. NetpMoveStrings(
  72. IN OUT LPTSTR * Floor,
  73. IN LPTSTR pInputBuffer,
  74. OUT LPTSTR pOutputBuffer,
  75. IN LPMOVESTRING MoveStringArray,
  76. IN DWORD * MoveStringLenght
  77. );
  78. /////////////////////////////////////////////////
  79. // Data structures for use by NetpMoveStrings: //
  80. /////////////////////////////////////////////////
  81. extern MOVESTRING NetpServer2_102[];
  82. extern MOVESTRING NetpServer2_402[];
  83. extern MOVESTRING NetpServer3_403[];
  84. //
  85. // Enhancement: These are the same as NetpServer2_102, except the two fields are
  86. // reversed, ie source<->destination. Should I bother with
  87. // making NetpMoveStrings be able to work with a single structure
  88. // and a switch?
  89. //
  90. extern MOVESTRING NetpServer102_2[];
  91. extern MOVESTRING NetpServer402_2[];
  92. extern MOVESTRING NetpServer403_3[];
  93. extern MOVESTRING NetpWksta10_101[];
  94. extern MOVESTRING NetpWksta10_User_1[];
  95. // To build wksta_info_0
  96. extern MOVESTRING NetpWksta0_101[];
  97. extern MOVESTRING NetpWksta0_User_1[];
  98. extern MOVESTRING NetpWksta0_402[];
  99. // To build wksta_info_1 (incremental over wksta_info_0)
  100. extern MOVESTRING NetpWksta1_User_1[];
  101. // To build wksta_info_101/302/402 from wksta_info_0
  102. extern MOVESTRING NetpWksta101_0[];
  103. extern MOVESTRING NetpWksta402_0[];
  104. #endif /* _MAPSUPP_ */