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.

116 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 1991-92 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. Author:
  12. John Rogers (JohnRo) 03-Jan-1992
  13. Environment:
  14. Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
  15. Requires ANSI C extensions: slash-slash comments, long external names.
  16. Revision History:
  17. 03-Jan-1992 JohnRo
  18. Created this file from bits and pieces in RxCommon and NetLib.
  19. --*/
  20. #ifndef _STRARRAY_
  21. #define _STRARRAY_
  22. // These must be included first:
  23. #include <windef.h> // IN, LPTSTR, LPVOID, etc.
  24. // These may be included in any order:
  25. // (none)
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. VOID
  30. ScAddWStrToWStrArray (
  31. IN OUT LPWSTR Dest,
  32. IN LPWSTR Src
  33. );
  34. // BOOL
  35. // ScIsWStrArrayEmpty (
  36. // IN LPWSTR Array
  37. // );
  38. #define ScIsWStrArrayEmpty( Array ) \
  39. ( ( (*(Array)) == 0) ? TRUE : FALSE )
  40. #if DBG
  41. VOID
  42. ScDisplayWStrArray (
  43. IN LPWSTR Array
  44. );
  45. #else // not DBG
  46. #define ScDisplayWStrArray(Array) /* nothing */
  47. #endif // not DBG
  48. // LPWSTR
  49. // ScNextWStrArrayEntry (
  50. // IN LPWSTR Array
  51. // );
  52. #define ScNextWStrArrayEntry(Array) \
  53. ( ((LPWSTR)(Array)) + (wcslen(Array) + 1) )
  54. // LPSTR
  55. // ScNextAStrArrayEntry (
  56. // IN LPSTR Array
  57. // );
  58. #define ScNextAStrArrayEntry(Array) \
  59. ( ((LPSTR)(Array)) + (strlen(Array) + 1) )
  60. //
  61. // Return number of bytes to allocate for this string array.
  62. // This includes the "extra" trailing null char.
  63. //
  64. DWORD
  65. ScWStrArraySize(
  66. IN LPWSTR Array
  67. );
  68. DWORD
  69. ScAStrArraySize(
  70. IN LPSTR Array
  71. );
  72. #ifdef __cplusplus
  73. }
  74. #endif
  75. #endif // ndef _STRARRAY_