Leaked source code of windows server 2003
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.

136 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 1991-1992 Microsoft Corporation
  3. Module Name:
  4. StrArray.h
  5. Abstract:
  6. This is the a header file of handy functions and macros for TCHAR
  7. string arrays.
  8. These arrays are in the following format (spaces added for clarity):
  9. one \0 two \0 three \0 \0
  10. where \0 is a null character in the appropriate format.
  11. These functions are useful for the NetServerDiskEnum and NetConfigGetAll
  12. APIs, and possibly others.
  13. Author:
  14. John Rogers (JohnRo) 03-Jan-1992
  15. Environment:
  16. Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
  17. Requires ANSI C extensions: slash-slash comments, long external names.
  18. Revision History:
  19. 03-Jan-1992 JohnRo
  20. Created this file from bits and pieces in RxCommon and NetLib.
  21. 01-Sep-1992 JohnRo
  22. RAID 5016: NetConfigGetAll heap trash.
  23. --*/
  24. #ifndef _STRARRAY_
  25. #define _STRARRAY_
  26. // These must be included first:
  27. #include <windef.h> // IN, LPTSTR, LPVOID, etc.
  28. // These may be included in any order:
  29. // (none)
  30. //
  31. //////////////////////////////// LPTSTR_ARRAY stuff //////////////////////////
  32. //
  33. typedef LPTSTR LPTSTR_ARRAY;
  34. VOID
  35. NetpAddTStrToTStrArray (
  36. IN OUT LPTSTR_ARRAY Dest,
  37. IN LPTSTR Src
  38. );
  39. VOID
  40. NetpCopyStrArrayToTStrArray (
  41. OUT LPTSTR_ARRAY Dest, // string array: TCHARs
  42. IN LPSTR Src // string array: 8-bit input in default codepage for LAN
  43. );
  44. #if DBG
  45. VOID
  46. NetpDisplayTStrArray (
  47. IN LPTSTR_ARRAY Array
  48. );
  49. #else // not DBG
  50. #define NetpDisplayTStrArray(Array) /* nothing */
  51. #endif // not DBG
  52. // BOOL
  53. // NetpIsTStrArrayEmpty (
  54. // IN LPTSTR_ARRAY Array
  55. // );
  56. #define NetpIsTStrArrayEmpty( Array ) \
  57. ( ( (*(Array)) == (TCHAR) '\0') ? TRUE : FALSE )
  58. // LPTSTR_ARRAY
  59. // NetpNextTStrArrayEntry (
  60. // IN LPTSTR_ARRAY Array
  61. // );
  62. #define NetpNextTStrArrayEntry(Array) \
  63. ( ((LPTSTR)(Array)) + (STRLEN(Array) + 1) )
  64. //
  65. // Return number of entries in this string array.
  66. //
  67. DWORD
  68. NetpTStrArrayEntryCount (
  69. IN LPTSTR_ARRAY Array
  70. );
  71. //
  72. // Return number of bytes to allocate for this string array.
  73. // This includes the "extra" trailing null char.
  74. //
  75. DWORD
  76. NetpTStrArraySize(
  77. IN LPTSTR_ARRAY Array
  78. );
  79. //
  80. //////////////////////////////// LPSTR_ARRAY stuff //////////////////////////
  81. //
  82. typedef LPSTR LPSTR_ARRAY;
  83. DWORD
  84. NetpStrArraySize(
  85. IN LPSTR_ARRAY Array
  86. );
  87. #endif // ndef _STRARRAY_