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.

196 lines
5.5 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. MBCS.H
  5. Abstract:
  6. Contains mapping functions which transform Unicode strings
  7. (used by the NT Net APIs) into MBCS strings (used by the
  8. command-line interface program).
  9. Prototypes. See MBCS.C.
  10. Author:
  11. Ben Goetter (beng) 26-Aug-1991
  12. Environment:
  13. User Mode - Win32
  14. Revision History:
  15. 26-Aug-1991 beng
  16. Created
  17. --*/
  18. /*
  19. The SAVEARGS structure holds the client-supplied field values which
  20. the mapping layer has replaced, so that it may restore them before
  21. returning the buffer to the client. (The client may wish to reuse
  22. the buffer, and so may expect the previous contents to remain invariant
  23. across calls. In particular, clients may replace single parameters,
  24. such as passwords deemed incorrect, and try to call again with the
  25. remaining structure left alone.)
  26. An instance of SAVEARGS is accessed but twice in its lifetime: once
  27. when it is built and once when it is freed.
  28. */
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. typedef struct _MXSAVEARG // mxsav
  33. {
  34. UINT offThis; // offset of this arg within buffer, in bytes
  35. LPSTR pszOriginal; // original value of arg
  36. } MXSAVEARG;
  37. typedef struct _MXSAVELIST // mxsavlst
  38. {
  39. INT cmxsav; // number of elements in vector
  40. MXSAVEARG * pmxsav; // pointer to first element in vector
  41. } MXSAVELIST;
  42. // Function prototypes
  43. DLL_BASED
  44. UINT MxAllocUnicode( LPSTR pszAscii,
  45. LPWSTR * ppwszUnicode );
  46. DLL_BASED
  47. VOID MxFreeUnicode( LPWSTR pwszUnicodeAllocated );
  48. DLL_BASED
  49. UINT MxAllocUnicodeVector( LPSTR * ppszAscii,
  50. LPWSTR * ppwszUnicode,
  51. UINT c );
  52. DLL_BASED
  53. VOID MxFreeUnicodeVector( LPWSTR * ppwsz,
  54. UINT cpwsz );
  55. DLL_BASED
  56. UINT MxAllocUnicodeBuffer( LPBYTE pbAscii,
  57. LPWCH * ppwchUnicode,
  58. UINT cbAscii );
  59. #define MxFreeUnicodeBuffer(buf) (MxFreeUnicode((LPWSTR)(buf)))
  60. #define MxUnicodeBufferSize(size) (sizeof(WCHAR)/sizeof(CHAR)*(size))
  61. DLL_BASED
  62. UINT MxAsciifyInplace( LPWSTR pwszUnicode );
  63. DLL_BASED
  64. UINT MxAllocSaveargs( UINT cmxsav,
  65. MXSAVELIST ** ppmxsavlst );
  66. DLL_BASED
  67. VOID MxFreeSaveargs( MXSAVELIST * ppmxsavlst );
  68. DLL_BASED
  69. UINT MxJoinSaveargs( MXSAVELIST * pmxsavlstMain,
  70. MXSAVELIST * pmxsavlstAux,
  71. UINT dbAuxFixup,
  72. MXSAVELIST ** ppmxsavlstOut );
  73. DLL_BASED
  74. UINT MxMapParameters( UINT cParam,
  75. LPWSTR* ppwszUnicode,
  76. ... );
  77. DLL_BASED
  78. UINT MxMapClientBuffer( BYTE * pbInput,
  79. MXSAVELIST ** ppmxsavlst,
  80. UINT cRecords,
  81. CHAR * pszDesc );
  82. DLL_BASED
  83. UINT MxMapClientBufferAux( BYTE * pbInput,
  84. CHAR * pszDesc,
  85. BYTE * pbInputAux,
  86. UINT cRecordsAux,
  87. CHAR * pszDescAux,
  88. MXSAVELIST ** ppmxsavlst );
  89. DLL_BASED
  90. VOID MxRestoreClientBuffer(BYTE * pbBuffer,
  91. MXSAVELIST * pmxsavlst );
  92. DLL_BASED
  93. UINT MxMapSetinfoBuffer( BYTE * * ppbInput,
  94. MXSAVELIST ** ppmxsavlst,
  95. CHAR * pszDesc,
  96. CHAR * pszRealDesc,
  97. UINT nField );
  98. DLL_BASED
  99. UINT MxRestoreSetinfoBuffer( BYTE * * ppbBuffer,
  100. MXSAVELIST * pmxsavlst,
  101. CHAR * pszDesc,
  102. UINT nField );
  103. DLL_BASED
  104. UINT MxAsciifyRpcBuffer( BYTE * pbInput,
  105. DWORD cRecords,
  106. CHAR * pszDesc );
  107. DLL_BASED
  108. UINT MxAsciifyRpcBufferAux( BYTE * pbInput,
  109. CHAR * pszDesc,
  110. BYTE * pbInputAux,
  111. DWORD cRecordsAux,
  112. CHAR * pszDescAux );
  113. DLL_BASED
  114. UINT MxAsciifyRpcEnumBufferAux( BYTE * pbInput,
  115. DWORD cRecords,
  116. CHAR * pszDesc,
  117. CHAR * pszDescAux );
  118. DLL_BASED
  119. UINT MxCalcNewInfoFromOldParm( UINT nLevelOld,
  120. UINT nParmnumOld );
  121. // These macros are used by all the functions which use the canonicalization
  122. // routines. They are used to optionally translate Ascii to Unicode, without
  123. // asking for more memory if no conversion is necessary.
  124. #ifdef UNICODE
  125. #define MxAllocTString(pszAscii, pptszTString) \
  126. MxAllocUnicode((pszAscii), (pptszTString))
  127. #define MxFreeTString(ptszTString) \
  128. MxFreeUnicode((ptszTString))
  129. #else
  130. #define MxAllocTString(pszAscii, pptszTString) \
  131. ((*(pptszTString) = (pszAscii)), 0)
  132. #define MxFreeTString(ptszTString)
  133. #endif
  134. DLL_BASED
  135. UINT MxMapStringsToTStrings( UINT cStrings,
  136. ... );
  137. DLL_BASED
  138. UINT MxFreeTStrings( UINT cStrings,
  139. ... );
  140. #ifdef __cplusplus
  141. } // extern "C"
  142. #endif