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.

131 lines
3.3 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. XsUnicod.h
  5. Abstract:
  6. This module contains declarations for Unicode work done by XACTSRV.
  7. Author:
  8. Shanku Niyogi(w-shankn) 27-Sep-1991
  9. Revision History:
  10. --*/
  11. #ifndef _XSUNICOD_
  12. #define _XSUNICOD_
  13. //
  14. // Unicode macro/procedure definitions.
  15. //
  16. // !!UNICODE!! - Added these type-independent conversion routines.
  17. // These will probably last only as long as NetpDup isn't written.
  18. //
  19. // XsDupStrToTstr, XsDupTstrToStr - allocate memory and do a
  20. // NetpCopy. This memory is XACTSRV memory,
  21. // and can be freed with NetpMemoryFree.
  22. //
  23. LPWSTR
  24. XsDupStrToWStr(
  25. IN LPSTR Src
  26. );
  27. LPSTR
  28. XsDupWStrToStr(
  29. IN LPWSTR Src
  30. );
  31. #ifdef UNICODE
  32. #define XsDupStrToTStr( src ) ((LPTSTR)XsDupStrToWStr(( src )))
  33. #define XsDupTStrToStr( src ) (XsDupWStrToStr((LPWSTR)( src )))
  34. VOID
  35. XsCopyTBufToBuf(
  36. OUT LPBYTE Dest,
  37. IN LPBYTE Src,
  38. IN DWORD DestSize
  39. );
  40. VOID
  41. XsCopyBufToTBuf(
  42. OUT LPBYTE Dest,
  43. IN LPBYTE Src,
  44. IN DWORD SrcSize
  45. );
  46. #else
  47. //
  48. // XsDupStrToStr - used instead of strdup so that XsDupStrToTStr macros
  49. // end up allocating memory from the same place, which
  50. // can be freed with NetpMemoryFree.
  51. //
  52. LPSTR
  53. XsDupStrToStr(
  54. IN LPSTR Src
  55. );
  56. #define XsDupStrToTStr( src ) (LPTSTR)XsDupStrToStr( src )
  57. #define XsDupTStrToStr( src ) XsDupStrToStr( (LPSTR)src )
  58. #define XsCopyTBufToBuf( dest, src, size ) RtlCopyMemory( dest, src, size )
  59. #define XsCopyBufToTBuf( dest, src, size ) RtlCopyMemory( dest, src, size )
  60. #endif // def UNICODE
  61. //
  62. // VOID
  63. // XsConvertTextParameter(
  64. // OUT LPTSTR OutParam,
  65. // IN LPSTR InParam
  66. // )
  67. //
  68. // Convert InParam parameter to Unicode, allocating memory, and return the
  69. // address in OutParam. Free with NetpMemoryFree.
  70. //
  71. #define XsConvertTextParameter( OutParam, InParam ) \
  72. if (( InParam ) == NULL ) { \
  73. OutParam = NULL; \
  74. } else { \
  75. OutParam = XsDupStrToTStr( InParam ); \
  76. if (( OutParam ) == NULL ) { \
  77. Header->Status = (WORD)NERR_NoRoom; \
  78. status = NERR_NoRoom; \
  79. goto cleanup; \
  80. } \
  81. }
  82. //
  83. // VOID
  84. // XsConvertUnicodeTextParameter(
  85. // OUT LPWSTR OutParam,
  86. // IN LPSTR InParam
  87. // )
  88. //
  89. // Convert InParam parameter to Unicode, allocating memory, and return the
  90. // address in OutParam. Free with NetpMemoryFree.
  91. //
  92. #define XsConvertUnicodeTextParameter( OutParam, InParam ) \
  93. if (( InParam ) == NULL ) { \
  94. OutParam = NULL; \
  95. } else { \
  96. OutParam = XsDupStrToWStr( InParam ); \
  97. if (( OutParam ) == NULL ) { \
  98. Header->Status = (WORD)NERR_NoRoom; \
  99. status = NERR_NoRoom; \
  100. goto cleanup; \
  101. } \
  102. }
  103. #endif // ndef _XSUNICOD_