ReactOS  0.4.13-dev-247-g0f29b3f
nls.c File Reference
#include <rtl.h>
#include <debug.h>
Include dependency graph for nls.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI RtlCustomCPToUnicodeN (IN PCPTABLEINFO CustomCP, OUT PWCHAR UnicodeString, IN ULONG UnicodeSize, OUT PULONG ResultSize OPTIONAL, IN PCHAR CustomString, IN ULONG CustomSize)
 
WCHAR NTAPI RtlpDowncaseUnicodeChar (IN WCHAR Source)
 
WCHAR NTAPI RtlDowncaseUnicodeChar (IN WCHAR Source)
 
VOID NTAPI RtlGetDefaultCodePage (OUT PUSHORT AnsiCodePage, OUT PUSHORT OemCodePage)
 
VOID NTAPI RtlInitCodePageTable (IN PUSHORT TableBase, OUT PCPTABLEINFO CodePageTable)
 
VOID NTAPI RtlInitNlsTables (IN PUSHORT AnsiTableBase, IN PUSHORT OemTableBase, IN PUSHORT CaseTableBase, OUT PNLSTABLEINFO NlsTable)
 
NTSTATUS NTAPI RtlMultiByteToUnicodeN (OUT PWCHAR UnicodeString, IN ULONG UnicodeSize, OUT PULONG ResultSize, IN PCSTR MbString, IN ULONG MbSize)
 
NTSTATUS NTAPI RtlConsoleMultiByteToUnicodeN (OUT PWCHAR UnicodeString, IN ULONG UnicodeSize, OUT PULONG ResultSize, IN PCSTR MbString, IN ULONG MbSize, OUT PULONG Unknown)
 
NTSTATUS NTAPI RtlMultiByteToUnicodeSize (OUT PULONG UnicodeSize, IN PCSTR MbString, IN ULONG MbSize)
 
NTSTATUS NTAPI RtlOemToUnicodeN (OUT PWCHAR UnicodeString, IN ULONG UnicodeSize, OUT PULONG ResultSize OPTIONAL, IN PCCH OemString, IN ULONG OemSize)
 
VOID NTAPI RtlResetRtlTranslations (IN PNLSTABLEINFO NlsTable)
 
NTSTATUS NTAPI RtlUnicodeToCustomCPN (IN PCPTABLEINFO CustomCP, OUT PCHAR CustomString, IN ULONG CustomSize, OUT PULONG ResultSize OPTIONAL, IN PWCHAR UnicodeString, IN ULONG UnicodeSize)
 
NTSTATUS NTAPI RtlUnicodeToMultiByteN (OUT PCHAR MbString, IN ULONG MbSize, OUT PULONG ResultSize OPTIONAL, IN PCWCH UnicodeString, IN ULONG UnicodeSize)
 
NTSTATUS NTAPI RtlUnicodeToMultiByteSize (OUT PULONG MbSize, IN PCWCH UnicodeString, IN ULONG UnicodeSize)
 
NTSTATUS NTAPI RtlUnicodeToOemN (OUT PCHAR OemString, IN ULONG OemSize, OUT PULONG ResultSize OPTIONAL, IN PCWCH UnicodeString, IN ULONG UnicodeSize)
 
WCHAR NTAPI RtlpUpcaseUnicodeChar (IN WCHAR Source)
 
WCHAR NTAPI RtlUpcaseUnicodeChar (IN WCHAR Source)
 
NTSTATUS NTAPI RtlUpcaseUnicodeToCustomCPN (IN PCPTABLEINFO CustomCP, OUT PCHAR CustomString, IN ULONG CustomSize, OUT PULONG ResultSize OPTIONAL, IN PWCHAR UnicodeString, IN ULONG UnicodeSize)
 
NTSTATUS NTAPI RtlUpcaseUnicodeToMultiByteN (OUT PCHAR MbString, IN ULONG MbSize, OUT PULONG ResultSize OPTIONAL, IN PCWCH UnicodeString, IN ULONG UnicodeSize)
 
NTSTATUS NTAPI RtlUpcaseUnicodeToOemN (OUT PCHAR OemString, IN ULONG OemSize, OUT PULONG ResultSize OPTIONAL, IN PCWCH UnicodeString, IN ULONG UnicodeSize)
 
CHAR NTAPI RtlUpperChar (IN CHAR Source)
 

Variables

PUSHORT NlsUnicodeUpcaseTable = NULL
 
PUSHORT NlsUnicodeLowercaseTable = NULL
 
USHORT NlsAnsiCodePage = 0
 
BOOLEAN NlsMbCodePageTag = FALSE
 
PUSHORT NlsAnsiToUnicodeTable = NULL
 
PCHAR NlsUnicodeToAnsiTable = NULL
 
PUSHORT NlsUnicodeToMbAnsiTable = NULL
 
PUSHORT NlsLeadByteInfo = NULL
 
USHORT NlsOemCodePage = 0
 
BOOLEAN NlsMbOemCodePageTag = FALSE
 
PUSHORT NlsOemToUnicodeTable = NULL
 
PCHAR NlsUnicodeToOemTable = NULL
 
PUSHORT NlsUnicodeToMbOemTable = NULL
 
PUSHORT NlsOemLeadByteInfo = NULL
 
USHORT NlsOemDefaultChar = '\0'
 
USHORT NlsUnicodeDefaultChar = 0
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file nls.c.

Function Documentation

◆ RtlConsoleMultiByteToUnicodeN()

NTSTATUS NTAPI RtlConsoleMultiByteToUnicodeN ( OUT PWCHAR  UnicodeString,
IN ULONG  UnicodeSize,
OUT PULONG  ResultSize,
IN PCSTR  MbString,
IN ULONG  MbSize,
OUT PULONG  Unknown 
)

Definition at line 299 of file nls.c.

305 {
306  PAGED_CODE_RTL();
307 
309  DPRINT1("RtlConsoleMultiByteToUnicodeN calling RtlMultiByteToUnicodeN\n");
310  *Unknown = 1;
312  UnicodeSize,
313  ResultSize,
314  MbString,
315  MbSize);
316 }
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
NTSTATUS NTAPI RtlMultiByteToUnicodeN(OUT PWCHAR UnicodeString, IN ULONG UnicodeSize, OUT PULONG ResultSize, IN PCSTR MbString, IN ULONG MbSize)
Definition: nls.c:231
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ RtlCustomCPToUnicodeN()

NTSTATUS NTAPI RtlCustomCPToUnicodeN ( IN PCPTABLEINFO  CustomCP,
OUT PWCHAR  UnicodeString,
IN ULONG  UnicodeSize,
OUT PULONG ResultSize  OPTIONAL,
IN PCHAR  CustomString,
IN ULONG  CustomSize 
)

Definition at line 45 of file nls.c.

51 {
52  ULONG Size = 0;
53  ULONG i;
54 
56 
57  if (!CustomCP->DBCSCodePage)
58  {
59  /* single-byte code page */
60  if (CustomSize > (UnicodeSize / sizeof(WCHAR)))
61  Size = UnicodeSize / sizeof(WCHAR);
62  else
63  Size = CustomSize;
64 
65  if (ResultSize)
66  *ResultSize = Size * sizeof(WCHAR);
67 
68  for (i = 0; i < Size; i++)
69  {
70  *UnicodeString = CustomCP->MultiByteTable[(UCHAR)*CustomString];
71  UnicodeString++;
72  CustomString++;
73  }
74  }
75  else
76  {
77  /* multi-byte code page */
78  /* FIXME */
79  ASSERT(FALSE);
80  }
81 
82  return STATUS_SUCCESS;
83 }
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
__wchar_t WCHAR
Definition: xmlstorage.h:180
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
unsigned char UCHAR
Definition: xmlstorage.h:181
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ RtlDowncaseUnicodeChar()

WCHAR NTAPI RtlDowncaseUnicodeChar ( IN WCHAR  Source)

Definition at line 131 of file nls.c.

132 {
133  PAGED_CODE_RTL();
134 
136 }
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
WCHAR NTAPI RtlpDowncaseUnicodeChar(IN WCHAR Source)
Definition: nls.c:89

◆ RtlGetDefaultCodePage()

VOID NTAPI RtlGetDefaultCodePage ( OUT PUSHORT  AnsiCodePage,
OUT PUSHORT  OemCodePage 
)

Definition at line 142 of file nls.c.

144 {
145  PAGED_CODE_RTL();
146 
149 }
static CODEPAGE_ENTRY AnsiCodePage
Definition: nls.c:46
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
static CODEPAGE_ENTRY OemCodePage
Definition: nls.c:47
USHORT NlsAnsiCodePage
Definition: nls.c:21
USHORT NlsOemCodePage
Definition: nls.c:28

◆ RtlInitCodePageTable()

VOID NTAPI RtlInitCodePageTable ( IN PUSHORT  TableBase,
OUT PCPTABLEINFO  CodePageTable 
)

Definition at line 155 of file nls.c.

157 {
158  PNLS_FILE_HEADER NlsFileHeader;
159 
160  PAGED_CODE_RTL();
161 
162  DPRINT("RtlInitCodePageTable() called\n");
163 
164  NlsFileHeader = (PNLS_FILE_HEADER)TableBase;
165 
166  /* Copy header fields first */
167  CodePageTable->CodePage = NlsFileHeader->CodePage;
169  CodePageTable->DefaultChar = NlsFileHeader->DefaultChar;
170  CodePageTable->UniDefaultChar = NlsFileHeader->UniDefaultChar;
173 
175  &NlsFileHeader->LeadByte,
177 
178  /* Offset to wide char table is after the header */
180  TableBase + NlsFileHeader->HeaderSize + 1 + TableBase[NlsFileHeader->HeaderSize];
181 
182  /* Then multibyte table (256 wchars) follows */
183  CodePageTable->MultiByteTable = TableBase + NlsFileHeader->HeaderSize + 1;
184 
185  /* Check the presence of glyph table (256 wchars) */
186  if (!CodePageTable->MultiByteTable[256])
188  else
190 
191  /* Is this double-byte code page? */
193  {
196  }
197  else
198  {
201  }
202 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
USHORT UniDefaultChar
Definition: precomp.h:35
USHORT CodePage
Definition: precomp.h:21
PUSHORT DBCSOffsets
Definition: precomp.h:43
USHORT UniDefaultChar
Definition: precomp.h:24
PUSHORT MultiByteTable
Definition: precomp.h:40
PUSHORT DBCSRanges
Definition: precomp.h:42
USHORT HeaderSize
Definition: precomp.h:20
struct _NLS_FILE_HEADER * PNLS_FILE_HEADER
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
PVOID WideCharTable
Definition: precomp.h:41
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
USHORT TransDefaultChar
Definition: precomp.h:36
USHORT TransDefaultChar
Definition: precomp.h:25
UCHAR LeadByte[MAXIMUM_LEADBYTES]
Definition: precomp.h:39
USHORT DBCSCodePage
Definition: precomp.h:38
USHORT TransUniDefaultChar
Definition: precomp.h:37
USHORT DefaultChar
Definition: precomp.h:23
USHORT MaximumCharacterSize
Definition: precomp.h:33
UCHAR LeadByte[MAXIMUM_LEADBYTES]
Definition: precomp.h:27
USHORT CodePage
Definition: precomp.h:32
#define MAXIMUM_LEADBYTES
Definition: precomp.h:16
USHORT DefaultChar
Definition: precomp.h:34
_Out_ PCPTABLEINFO CodePageTable
Definition: rtlfuncs.h:4097
USHORT MaximumCharacterSize
Definition: precomp.h:22
USHORT TransUniDefaultChar
Definition: precomp.h:26

Referenced by IntGetCodePageEntry(), NlsInit(), and RtlInitNlsTables().

◆ RtlInitNlsTables()

VOID NTAPI RtlInitNlsTables ( IN PUSHORT  AnsiTableBase,
IN PUSHORT  OemTableBase,
IN PUSHORT  CaseTableBase,
OUT PNLSTABLEINFO  NlsTable 
)

Definition at line 208 of file nls.c.

212 {
213  PAGED_CODE_RTL();
214 
215  DPRINT("RtlInitNlsTables()called\n");
216 
217  if (AnsiTableBase && OemTableBase && CaseTableBase)
218  {
219  RtlInitCodePageTable(AnsiTableBase, &NlsTable->AnsiTableInfo);
220  RtlInitCodePageTable(OemTableBase, &NlsTable->OemTableInfo);
221 
222  NlsTable->UpperCaseTable = (PUSHORT)CaseTableBase + 2;
223  NlsTable->LowerCaseTable = (PUSHORT)CaseTableBase + *((PUSHORT)CaseTableBase + 1) + 2;
224  }
225 }
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI RtlInitCodePageTable(IN PUSHORT TableBase, OUT PCPTABLEINFO CodePageTable)
Definition: nls.c:155
unsigned short * PUSHORT
Definition: retypes.h:2

◆ RtlMultiByteToUnicodeN()

NTSTATUS NTAPI RtlMultiByteToUnicodeN ( OUT PWCHAR  UnicodeString,
IN ULONG  UnicodeSize,
OUT PULONG  ResultSize,
IN PCSTR  MbString,
IN ULONG  MbSize 
)

Definition at line 231 of file nls.c.

236 {
237  ULONG Size = 0;
238  ULONG i;
239 
240  PAGED_CODE_RTL();
241 
242  if (!NlsMbCodePageTag)
243  {
244  /* single-byte code page */
245  if (MbSize > (UnicodeSize / sizeof(WCHAR)))
246  Size = UnicodeSize / sizeof(WCHAR);
247  else
248  Size = MbSize;
249 
250  if (ResultSize)
251  *ResultSize = Size * sizeof(WCHAR);
252 
253  for (i = 0; i < Size; i++)
255  }
256  else
257  {
258  /* multi-byte code page */
259  /* FIXME */
260 
261  UCHAR Char;
262  USHORT LeadByteInfo;
263  PCSTR MbEnd = MbString + MbSize;
264 
265  for (i = 0; i < UnicodeSize / sizeof(WCHAR) && MbString < MbEnd; i++)
266  {
267  Char = *(PUCHAR)MbString++;
268 
269  if (Char < 0x80)
270  {
271  *UnicodeString++ = Char;
272  continue;
273  }
274 
275  LeadByteInfo = NlsLeadByteInfo[Char];
276 
277  if (!LeadByteInfo)
278  {
280  continue;
281  }
282 
283  if (MbString < MbEnd)
284  *UnicodeString++ = NlsLeadByteInfo[LeadByteInfo + *(PUCHAR)MbString++];
285  }
286 
287  if (ResultSize)
288  *ResultSize = i * sizeof(WCHAR);
289  }
290 
291  return STATUS_SUCCESS;
292 }
unsigned char * PUCHAR
Definition: retypes.h:3
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
char Char
Definition: bzip2.c:161
__wchar_t WCHAR
Definition: xmlstorage.h:180
PUSHORT NlsAnsiToUnicodeTable
Definition: nls.c:23
unsigned char UCHAR
Definition: xmlstorage.h:181
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
BOOLEAN NlsMbCodePageTag
Definition: nls.c:22
unsigned short USHORT
Definition: pedump.c:61
PUSHORT NlsLeadByteInfo
Definition: nls.c:26
unsigned int ULONG
Definition: retypes.h:1
const char * PCSTR
Definition: typedefs.h:51
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by RtlConsoleMultiByteToUnicodeN().

◆ RtlMultiByteToUnicodeSize()

NTSTATUS NTAPI RtlMultiByteToUnicodeSize ( OUT PULONG  UnicodeSize,
IN PCSTR  MbString,
IN ULONG  MbSize 
)

Definition at line 323 of file nls.c.

326 {
327  ULONG Length = 0;
328 
329  PAGED_CODE_RTL();
330 
331  if (!NlsMbCodePageTag)
332  {
333  /* single-byte code page */
334  *UnicodeSize = MbSize * sizeof (WCHAR);
335  }
336  else
337  {
338  /* multi-byte code page */
339  /* FIXME */
340 
341  while (MbSize--)
342  {
343  UCHAR Char = *(PUCHAR)MbString++;
344 
345  if (Char >= 0x80 && NlsLeadByteInfo[Char])
346  {
347  if (MbSize)
348  {
349  /* Move on */
350  MbSize--;
351  MbString++;
352  }
353  }
354 
355  /* Increase returned size */
356  Length++;
357  }
358 
359  /* Return final size */
360  *UnicodeSize = Length * sizeof(WCHAR);
361  }
362 
363  /* Success */
364  return STATUS_SUCCESS;
365 }
unsigned char * PUCHAR
Definition: retypes.h:3
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
char Char
Definition: bzip2.c:161
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
unsigned char UCHAR
Definition: xmlstorage.h:181
BOOLEAN NlsMbCodePageTag
Definition: nls.c:22
PUSHORT NlsLeadByteInfo
Definition: nls.c:26
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ RtlOemToUnicodeN()

NTSTATUS NTAPI RtlOemToUnicodeN ( OUT PWCHAR  UnicodeString,
IN ULONG  UnicodeSize,
OUT PULONG ResultSize  OPTIONAL,
IN PCCH  OemString,
IN ULONG  OemSize 
)

Definition at line 371 of file nls.c.

376 {
377  ULONG Size = 0;
378  ULONG i;
379 
380  PAGED_CODE_RTL();
381 
382  if (!NlsMbOemCodePageTag)
383  {
384  /* single-byte code page */
385  if (OemSize > (UnicodeSize / sizeof(WCHAR)))
386  Size = UnicodeSize / sizeof(WCHAR);
387  else
388  Size = OemSize;
389 
390  if (ResultSize)
391  *ResultSize = Size * sizeof(WCHAR);
392 
393  for (i = 0; i < Size; i++)
394  {
396  UnicodeString++;
397  OemString++;
398  }
399  }
400  else
401  {
402  /* multi-byte code page */
403  /* FIXME */
404 
405  UCHAR Char;
406  USHORT OemLeadByteInfo;
407  PCCH OemEnd = OemString + OemSize;
408 
409  for (i = 0; i < UnicodeSize / sizeof(WCHAR) && OemString < OemEnd; i++)
410  {
411  Char = *(PUCHAR)OemString++;
412 
413  if (Char < 0x80)
414  {
415  *UnicodeString++ = Char;
416  continue;
417  }
418 
419  OemLeadByteInfo = NlsOemLeadByteInfo[Char];
420 
421  if (!OemLeadByteInfo)
422  {
424  continue;
425  }
426 
427  if (OemString < OemEnd)
428  *UnicodeString++ =
429  NlsOemLeadByteInfo[OemLeadByteInfo + *(PUCHAR)OemString++];
430  }
431 
432  if (ResultSize)
433  *ResultSize = i * sizeof(WCHAR);
434  }
435 
436  return STATUS_SUCCESS;
437 }
*BytesInOemString PCHAR OemString
Definition: rtlfuncs.h:1561
unsigned char * PUCHAR
Definition: retypes.h:3
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
char Char
Definition: bzip2.c:161
PUSHORT NlsOemToUnicodeTable
Definition: nls.c:30
CONST CHAR * PCCH
Definition: ntbasedef.h:399
__wchar_t WCHAR
Definition: xmlstorage.h:180
PUSHORT NlsOemLeadByteInfo
Definition: nls.c:33
unsigned char UCHAR
Definition: xmlstorage.h:181
BOOLEAN NlsMbOemCodePageTag
Definition: nls.c:29
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ RtlpDowncaseUnicodeChar()

WCHAR NTAPI RtlpDowncaseUnicodeChar ( IN WCHAR  Source)

Definition at line 89 of file nls.c.

90 {
91  USHORT Offset;
92 
94 
95  if (Source < L'A')
96  return Source;
97 
98  if (Source <= L'Z')
99  return Source + (L'a' - L'A');
100 
101  if (Source < 0x80)
102  return Source;
103 
104  Offset = ((USHORT)Source >> 8);
105  DPRINT("Offset: %hx\n", Offset);
106 
108  DPRINT("Offset: %hx\n", Offset);
109 
110  Offset += (((USHORT)Source & 0x00F0) >> 4);
111  DPRINT("Offset: %hx\n", Offset);
112 
114  DPRINT("Offset: %hx\n", Offset);
115 
116  Offset += ((USHORT)Source & 0x000F);
117  DPRINT("Offset: %hx\n", Offset);
118 
120  DPRINT("Offset: %hx\n", Offset);
121 
122  DPRINT("Result: %hx\n", Source + (SHORT)Offset);
123 
124  return Source + (SHORT)Offset;
125 }
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
PUSHORT NlsUnicodeLowercaseTable
Definition: nls.c:19
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
short SHORT
Definition: pedump.c:59
void DPRINT(...)
Definition: polytest.cpp:61
static const WCHAR L[]
Definition: oid.c:1250
unsigned short USHORT
Definition: pedump.c:61
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167

Referenced by RtlDowncaseUnicodeChar(), RtlDowncaseUnicodeString(), and RtlIsDosDeviceName_Ustr().

◆ RtlpUpcaseUnicodeChar()

WCHAR NTAPI RtlpUpcaseUnicodeChar ( IN WCHAR  Source)

Definition at line 715 of file nls.c.

716 {
717  USHORT Offset;
718 
719  if (Source < 'a')
720  return Source;
721 
722  if (Source <= 'z')
723  return (Source - ('a' - 'A'));
724 
725  Offset = ((USHORT)Source >> 8) & 0xFF;
727 
728  Offset += ((USHORT)Source >> 4) & 0xF;
730 
731  Offset += ((USHORT)Source & 0xF);
733 
734  return Source + (SHORT)Offset;
735 }
PUSHORT NlsUnicodeUpcaseTable
Definition: nls.c:18
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
short SHORT
Definition: pedump.c:59
unsigned short USHORT
Definition: pedump.c:61
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167

Referenced by CompareUnicodeStrings(), RtlCompareUnicodeString(), RtlGenerate8dot3Name(), RtlGetFullPathName_Ustr(), RtlIsValidOemCharacter(), RtlpIsCharInUnicodeString(), RtlPrefixUnicodeString(), RtlUpcaseUnicodeChar(), RtlUpcaseUnicodeString(), RtlUpcaseUnicodeToCustomCPN(), RtlUpcaseUnicodeToMultiByteN(), RtlUpcaseUnicodeToOemN(), and RtlUpperChar().

◆ RtlResetRtlTranslations()

VOID NTAPI RtlResetRtlTranslations ( IN PNLSTABLEINFO  NlsTable)

Definition at line 443 of file nls.c.

444 {
445  PAGED_CODE_RTL();
446 
447  DPRINT("RtlResetRtlTranslations() called\n");
448 
449  /* Set ANSI data */
450  NlsAnsiToUnicodeTable = (PUSHORT)NlsTable->AnsiTableInfo.MultiByteTable;
451  NlsUnicodeToAnsiTable = NlsTable->AnsiTableInfo.WideCharTable;
452  NlsUnicodeToMbAnsiTable = (PUSHORT)NlsTable->AnsiTableInfo.WideCharTable;
453  NlsMbCodePageTag = (NlsTable->AnsiTableInfo.DBCSCodePage != 0);
454  NlsLeadByteInfo = NlsTable->AnsiTableInfo.DBCSOffsets;
455  NlsAnsiCodePage = NlsTable->AnsiTableInfo.CodePage;
456  DPRINT("Ansi codepage %hu\n", NlsAnsiCodePage);
457 
458  /* Set OEM data */
459  NlsOemToUnicodeTable = (PUSHORT)NlsTable->OemTableInfo.MultiByteTable;
460  NlsUnicodeToOemTable = NlsTable->OemTableInfo.WideCharTable;
461  NlsUnicodeToMbOemTable = (PUSHORT)NlsTable->OemTableInfo.WideCharTable;
462  NlsMbOemCodePageTag = (NlsTable->OemTableInfo.DBCSCodePage != 0);
463  NlsOemLeadByteInfo = NlsTable->OemTableInfo.DBCSOffsets;
464  NlsOemCodePage = NlsTable->OemTableInfo.CodePage;
465  DPRINT("Oem codepage %hu\n", NlsOemCodePage);
466 
467  /* Set Unicode case map data */
468  NlsUnicodeUpcaseTable = NlsTable->UpperCaseTable;
469  NlsUnicodeLowercaseTable = NlsTable->LowerCaseTable;
470 
471  /* set the default characters for RtlpDidUnicodeToOemWork */
472  NlsOemDefaultChar = NlsTable->OemTableInfo.DefaultChar;
473  NlsUnicodeDefaultChar = NlsTable->OemTableInfo.TransDefaultChar;
474 }
PCHAR NlsUnicodeToAnsiTable
Definition: nls.c:24
PUSHORT NlsUnicodeToMbAnsiTable
Definition: nls.c:25
USHORT NlsOemDefaultChar
Definition: nls.c:35
PUSHORT NlsUnicodeUpcaseTable
Definition: nls.c:18
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
PUSHORT NlsUnicodeLowercaseTable
Definition: nls.c:19
PUSHORT NlsOemToUnicodeTable
Definition: nls.c:30
void DPRINT(...)
Definition: polytest.cpp:61
PCHAR NlsUnicodeToOemTable
Definition: nls.c:31
PUSHORT NlsAnsiToUnicodeTable
Definition: nls.c:23
PUSHORT NlsOemLeadByteInfo
Definition: nls.c:33
BOOLEAN NlsMbOemCodePageTag
Definition: nls.c:29
USHORT NlsAnsiCodePage
Definition: nls.c:21
BOOLEAN NlsMbCodePageTag
Definition: nls.c:22
PUSHORT NlsLeadByteInfo
Definition: nls.c:26
PUSHORT NlsUnicodeToMbOemTable
Definition: nls.c:32
USHORT NlsOemCodePage
Definition: nls.c:28
unsigned short * PUSHORT
Definition: retypes.h:2
USHORT NlsUnicodeDefaultChar
Definition: nls.c:36

◆ RtlUnicodeToCustomCPN()

NTSTATUS NTAPI RtlUnicodeToCustomCPN ( IN PCPTABLEINFO  CustomCP,
OUT PCHAR  CustomString,
IN ULONG  CustomSize,
OUT PULONG ResultSize  OPTIONAL,
IN PWCHAR  UnicodeString,
IN ULONG  UnicodeSize 
)

Definition at line 480 of file nls.c.

486 {
487  ULONG Size = 0;
488  ULONG i;
489 
490  PAGED_CODE_RTL();
491 
492  if (!CustomCP->DBCSCodePage)
493  {
494  /* single-byte code page */
495  if (UnicodeSize > (CustomSize * sizeof(WCHAR)))
496  Size = CustomSize;
497  else
498  Size = UnicodeSize / sizeof(WCHAR);
499 
500  if (ResultSize)
501  *ResultSize = Size;
502 
503  for (i = 0; i < Size; i++)
504  {
505  *CustomString = ((PCHAR)CustomCP->WideCharTable)[*UnicodeString];
506  CustomString++;
507  UnicodeString++;
508  }
509  }
510  else
511  {
512  /* multi-byte code page */
513  /* FIXME */
514  ASSERT(FALSE);
515  }
516 
517  return STATUS_SUCCESS;
518 }
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define PCHAR
Definition: match.c:90
__wchar_t WCHAR
Definition: xmlstorage.h:180
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ RtlUnicodeToMultiByteN()

NTSTATUS NTAPI RtlUnicodeToMultiByteN ( OUT PCHAR  MbString,
IN ULONG  MbSize,
OUT PULONG ResultSize  OPTIONAL,
IN PCWCH  UnicodeString,
IN ULONG  UnicodeSize 
)

Definition at line 524 of file nls.c.

529 {
530  ULONG Size = 0;
531  ULONG i;
532 
533  PAGED_CODE_RTL();
534 
535  if (!NlsMbCodePageTag)
536  {
537  /* single-byte code page */
538  Size = (UnicodeSize > (MbSize * sizeof (WCHAR)))
539  ? MbSize : (UnicodeSize / sizeof (WCHAR));
540 
541  if (ResultSize)
542  *ResultSize = Size;
543 
544  for (i = 0; i < Size; i++)
545  {
546  *MbString++ = NlsUnicodeToAnsiTable[*UnicodeString++];
547  }
548  }
549  else
550  {
551  /* multi-byte code page */
552  /* FIXME */
553 
554  USHORT WideChar;
555  USHORT MbChar;
556 
557  for (i = MbSize, Size = UnicodeSize / sizeof(WCHAR); i && Size; i--, Size--)
558  {
559  WideChar = *UnicodeString++;
560 
561  if (WideChar < 0x80)
562  {
563  *MbString++ = LOBYTE(WideChar);
564  continue;
565  }
566 
567  MbChar = NlsUnicodeToMbAnsiTable[WideChar];
568 
569  if (!HIBYTE(MbChar))
570  {
571  *MbString++ = LOBYTE(MbChar);
572  continue;
573  }
574 
575  if (i >= 2)
576  {
577  *MbString++ = HIBYTE(MbChar);
578  *MbString++ = LOBYTE(MbChar);
579  i--;
580  }
581  else break;
582  }
583 
584  if (ResultSize)
585  *ResultSize = MbSize - i;
586  }
587 
588  return STATUS_SUCCESS;
589 }
PCHAR NlsUnicodeToAnsiTable
Definition: nls.c:24
#define LOBYTE(W)
Definition: jmemdos.c:487
PUSHORT NlsUnicodeToMbAnsiTable
Definition: nls.c:25
#define HIBYTE(W)
Definition: jmemdos.c:486
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
__wchar_t WCHAR
Definition: xmlstorage.h:180
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
BOOLEAN NlsMbCodePageTag
Definition: nls.c:22
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ RtlUnicodeToMultiByteSize()

NTSTATUS NTAPI RtlUnicodeToMultiByteSize ( OUT PULONG  MbSize,
IN PCWCH  UnicodeString,
IN ULONG  UnicodeSize 
)

Definition at line 596 of file nls.c.

599 {
600  ULONG UnicodeLength = UnicodeSize / sizeof(WCHAR);
601  ULONG MbLength = 0;
602 
603  PAGED_CODE_RTL();
604 
605  if (!NlsMbCodePageTag)
606  {
607  /* single-byte code page */
608  *MbSize = UnicodeLength;
609  }
610  else
611  {
612  /* multi-byte code page */
613  /* FIXME */
614 
615  while (UnicodeLength--)
616  {
617  USHORT WideChar = *UnicodeString++;
618 
619  if (WideChar >= 0x80 && HIBYTE(NlsUnicodeToMbAnsiTable[WideChar]))
620  {
621  MbLength += sizeof(WCHAR);
622  }
623  else
624  {
625  MbLength++;
626  }
627  }
628 
629  *MbSize = MbLength;
630  }
631 
632  /* Success */
633  return STATUS_SUCCESS;
634 }
PUSHORT NlsUnicodeToMbAnsiTable
Definition: nls.c:25
#define HIBYTE(W)
Definition: jmemdos.c:486
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOLEAN NlsMbCodePageTag
Definition: nls.c:22
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ RtlUnicodeToOemN()

NTSTATUS NTAPI RtlUnicodeToOemN ( OUT PCHAR  OemString,
IN ULONG  OemSize,
OUT PULONG ResultSize  OPTIONAL,
IN PCWCH  UnicodeString,
IN ULONG  UnicodeSize 
)

Definition at line 640 of file nls.c.

645 {
646  ULONG Size = 0;
647  ULONG i;
648 
649  PAGED_CODE_RTL();
650 
651  if (!NlsMbOemCodePageTag)
652  {
653  /* single-byte code page */
654  if (UnicodeSize > (OemSize * sizeof(WCHAR)))
655  Size = OemSize;
656  else
657  Size = UnicodeSize / sizeof(WCHAR);
658 
659  if (ResultSize)
660  *ResultSize = Size;
661 
662  for (i = 0; i < Size; i++)
663  {
665  OemString++;
666  UnicodeString++;
667  }
668  }
669  else
670  {
671  /* multi-byte code page */
672  /* FIXME */
673 
674  USHORT WideChar;
675  USHORT OemChar;
676 
677  for (i = OemSize, Size = UnicodeSize / sizeof(WCHAR); i && Size; i--, Size--)
678  {
679  WideChar = *UnicodeString++;
680 
681  if (WideChar < 0x80)
682  {
683  *OemString++ = LOBYTE(WideChar);
684  continue;
685  }
686 
687  OemChar = NlsUnicodeToMbOemTable[WideChar];
688 
689  if (!HIBYTE(OemChar))
690  {
691  *OemString++ = LOBYTE(OemChar);
692  continue;
693  }
694 
695  if (i >= 2)
696  {
697  *OemString++ = HIBYTE(OemChar);
698  *OemString++ = LOBYTE(OemChar);
699  i--;
700  }
701  else break;
702  }
703 
704  if (ResultSize)
705  *ResultSize = OemSize - i;
706  }
707 
708  return STATUS_SUCCESS;
709 }
*BytesInOemString PCHAR OemString
Definition: rtlfuncs.h:1561
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PCHAR NlsUnicodeToOemTable
Definition: nls.c:31
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOLEAN NlsMbOemCodePageTag
Definition: nls.c:29
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
unsigned short USHORT
Definition: pedump.c:61
PUSHORT NlsUnicodeToMbOemTable
Definition: nls.c:32
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ RtlUpcaseUnicodeChar()

WCHAR NTAPI RtlUpcaseUnicodeChar ( IN WCHAR  Source)

Definition at line 741 of file nls.c.

742 {
743  PAGED_CODE_RTL();
744 
746 }
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
WCHAR NTAPI RtlpUpcaseUnicodeChar(IN WCHAR Source)
Definition: nls.c:715
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167

◆ RtlUpcaseUnicodeToCustomCPN()

NTSTATUS NTAPI RtlUpcaseUnicodeToCustomCPN ( IN PCPTABLEINFO  CustomCP,
OUT PCHAR  CustomString,
IN ULONG  CustomSize,
OUT PULONG ResultSize  OPTIONAL,
IN PWCHAR  UnicodeString,
IN ULONG  UnicodeSize 
)

Definition at line 752 of file nls.c.

758 {
759  WCHAR UpcaseChar;
760  ULONG Size = 0;
761  ULONG i;
762 
763  PAGED_CODE_RTL();
764 
765  if (!CustomCP->DBCSCodePage)
766  {
767  /* single-byte code page */
768  if (UnicodeSize > (CustomSize * sizeof(WCHAR)))
769  Size = CustomSize;
770  else
771  Size = UnicodeSize / sizeof(WCHAR);
772 
773  if (ResultSize)
774  *ResultSize = Size;
775 
776  for (i = 0; i < Size; i++)
777  {
778  UpcaseChar = RtlpUpcaseUnicodeChar(*UnicodeString);
779  *CustomString = ((PCHAR)CustomCP->WideCharTable)[UpcaseChar];
780  ++CustomString;
781  ++UnicodeString;
782  }
783  }
784  else
785  {
786  /* multi-byte code page */
787  /* FIXME */
788  ASSERT(FALSE);
789  }
790 
791  return STATUS_SUCCESS;
792 }
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define PCHAR
Definition: match.c:90
__wchar_t WCHAR
Definition: xmlstorage.h:180
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
WCHAR NTAPI RtlpUpcaseUnicodeChar(IN WCHAR Source)
Definition: nls.c:715
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ RtlUpcaseUnicodeToMultiByteN()

NTSTATUS NTAPI RtlUpcaseUnicodeToMultiByteN ( OUT PCHAR  MbString,
IN ULONG  MbSize,
OUT PULONG ResultSize  OPTIONAL,
IN PCWCH  UnicodeString,
IN ULONG  UnicodeSize 
)

Definition at line 798 of file nls.c.

803 {
804  WCHAR UpcaseChar;
805  ULONG Size = 0;
806  ULONG i;
807 
808  PAGED_CODE_RTL();
809 
810  if (!NlsMbCodePageTag)
811  {
812  /* single-byte code page */
813  if (UnicodeSize > (MbSize * sizeof(WCHAR)))
814  Size = MbSize;
815  else
816  Size = UnicodeSize / sizeof(WCHAR);
817 
818  if (ResultSize)
819  *ResultSize = Size;
820 
821  for (i = 0; i < Size; i++)
822  {
823  UpcaseChar = RtlpUpcaseUnicodeChar(*UnicodeString);
824  *MbString = NlsUnicodeToAnsiTable[UpcaseChar];
825  MbString++;
826  UnicodeString++;
827  }
828  }
829  else
830  {
831  /* multi-byte code page */
832  /* FIXME */
833  ASSERT(FALSE);
834  }
835 
836  return STATUS_SUCCESS;
837 }
PCHAR NlsUnicodeToAnsiTable
Definition: nls.c:24
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
__wchar_t WCHAR
Definition: xmlstorage.h:180
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
BOOLEAN NlsMbCodePageTag
Definition: nls.c:22
WCHAR NTAPI RtlpUpcaseUnicodeChar(IN WCHAR Source)
Definition: nls.c:715
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ RtlUpcaseUnicodeToOemN()

NTSTATUS NTAPI RtlUpcaseUnicodeToOemN ( OUT PCHAR  OemString,
IN ULONG  OemSize,
OUT PULONG ResultSize  OPTIONAL,
IN PCWCH  UnicodeString,
IN ULONG  UnicodeSize 
)

Definition at line 843 of file nls.c.

848 {
849  WCHAR UpcaseChar;
850  ULONG Size = 0;
851  ULONG i;
852 
853  PAGED_CODE_RTL();
854 
856 
857  if (!NlsMbOemCodePageTag)
858  {
859  /* single-byte code page */
860  if (UnicodeSize > (OemSize * sizeof(WCHAR)))
861  Size = OemSize;
862  else
863  Size = UnicodeSize / sizeof(WCHAR);
864 
865  if (ResultSize)
866  *ResultSize = Size;
867 
868  for (i = 0; i < Size; i++)
869  {
870  UpcaseChar = RtlpUpcaseUnicodeChar(*UnicodeString);
871  *OemString = NlsUnicodeToOemTable[UpcaseChar];
872  OemString++;
873  UnicodeString++;
874  }
875  }
876  else
877  {
878  /* multi-byte code page */
879  /* FIXME */
880 
881  USHORT WideChar;
882  USHORT OemChar;
883 
884  for (i = OemSize, Size = UnicodeSize / sizeof(WCHAR); i && Size; i--, Size--)
885  {
886  WideChar = RtlpUpcaseUnicodeChar(*UnicodeString++);
887 
888  if (WideChar < 0x80)
889  {
890  *OemString++ = LOBYTE(WideChar);
891  continue;
892  }
893 
894  OemChar = NlsUnicodeToMbOemTable[WideChar];
895 
896  if (!HIBYTE(OemChar))
897  {
898  *OemString++ = LOBYTE(OemChar);
899  continue;
900  }
901 
902  if (i >= 2)
903  {
904  *OemString++ = HIBYTE(OemChar);
905  *OemString++ = LOBYTE(OemChar);
906  i--;
907  }
908  else break;
909  }
910 
911  if (ResultSize)
912  *ResultSize = OemSize - i;
913  }
914 
915  return STATUS_SUCCESS;
916 }
*BytesInOemString PCHAR OemString
Definition: rtlfuncs.h:1561
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
PCHAR NlsUnicodeToOemTable
Definition: nls.c:31
__wchar_t WCHAR
Definition: xmlstorage.h:180
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
BOOLEAN NlsMbOemCodePageTag
Definition: nls.c:29
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
unsigned short USHORT
Definition: pedump.c:61
WCHAR NTAPI RtlpUpcaseUnicodeChar(IN WCHAR Source)
Definition: nls.c:715
PUSHORT NlsUnicodeToMbOemTable
Definition: nls.c:32
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2745

◆ RtlUpperChar()

CHAR NTAPI RtlUpperChar ( IN CHAR  Source)

Definition at line 922 of file nls.c.

923 {
924  WCHAR Unicode;
926 
927  PAGED_CODE_RTL();
928 
929  /* Check for simple ANSI case */
930  if (Source <= 'z')
931  {
932  /* Check for simple downcase a-z case */
933  if (Source >= 'a')
934  {
935  /* Just XOR with the difference */
936  return Source ^ ('a' - 'A');
937  }
938  else
939  {
940  /* Otherwise return the same char, it's already upcase */
941  return Source;
942  }
943  }
944  else
945  {
946  if (!NlsMbCodePageTag)
947  {
948  /* single-byte code page */
949 
950  /* ansi->unicode */
951  Unicode = NlsAnsiToUnicodeTable[(UCHAR)Source];
952 
953  /* upcase conversion */
954  Unicode = RtlpUpcaseUnicodeChar (Unicode);
955 
956  /* unicode -> ansi */
958  }
959  else
960  {
961  /* multi-byte code page */
962  /* FIXME */
964  }
965  }
966 
967  return Destination;
968 }
PCHAR NlsUnicodeToAnsiTable
Definition: nls.c:24
char CHAR
Definition: xmlstorage.h:175
#define PAGED_CODE_RTL()
Definition: rtlp.h:16
__wchar_t WCHAR
Definition: xmlstorage.h:180
PUSHORT NlsAnsiToUnicodeTable
Definition: nls.c:23
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2875
unsigned char UCHAR
Definition: xmlstorage.h:181
BOOLEAN NlsMbCodePageTag
Definition: nls.c:22
unsigned short USHORT
Definition: pedump.c:61
WCHAR NTAPI RtlpUpcaseUnicodeChar(IN WCHAR Source)
Definition: nls.c:715
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167

Variable Documentation

◆ NlsAnsiCodePage

USHORT NlsAnsiCodePage = 0

Definition at line 21 of file nls.c.

Referenced by RtlGetDefaultCodePage(), and RtlResetRtlTranslations().

◆ NlsAnsiToUnicodeTable

PUSHORT NlsAnsiToUnicodeTable = NULL

Definition at line 23 of file nls.c.

Referenced by RtlMultiByteToUnicodeN(), RtlResetRtlTranslations(), and RtlUpperChar().

◆ NlsLeadByteInfo

◆ NlsMbCodePageTag

◆ NlsMbOemCodePageTag

◆ NlsOemCodePage

USHORT NlsOemCodePage = 0

Definition at line 28 of file nls.c.

Referenced by RtlGetDefaultCodePage(), and RtlResetRtlTranslations().

◆ NlsOemDefaultChar

USHORT NlsOemDefaultChar = '\0'

Definition at line 35 of file nls.c.

Referenced by RtlIsValidOemCharacter(), RtlpDidUnicodeToOemWork(), and RtlResetRtlTranslations().

◆ NlsOemLeadByteInfo

PUSHORT NlsOemLeadByteInfo = NULL

Definition at line 33 of file nls.c.

Referenced by RtlIsValidOemCharacter(), RtlOemToUnicodeN(), and RtlResetRtlTranslations().

◆ NlsOemToUnicodeTable

PUSHORT NlsOemToUnicodeTable = NULL

Definition at line 30 of file nls.c.

Referenced by RtlIsValidOemCharacter(), RtlOemToUnicodeN(), and RtlResetRtlTranslations().

◆ NlsUnicodeDefaultChar

USHORT NlsUnicodeDefaultChar = 0

Definition at line 36 of file nls.c.

Referenced by RtlpDidUnicodeToOemWork(), and RtlResetRtlTranslations().

◆ NlsUnicodeLowercaseTable

PUSHORT NlsUnicodeLowercaseTable = NULL

Definition at line 19 of file nls.c.

Referenced by RtlpDowncaseUnicodeChar(), and RtlResetRtlTranslations().

◆ NlsUnicodeToAnsiTable

PCHAR NlsUnicodeToAnsiTable = NULL

◆ NlsUnicodeToMbAnsiTable

PUSHORT NlsUnicodeToMbAnsiTable = NULL

◆ NlsUnicodeToMbOemTable

PUSHORT NlsUnicodeToMbOemTable = NULL

◆ NlsUnicodeToOemTable

PCHAR NlsUnicodeToOemTable = NULL

◆ NlsUnicodeUpcaseTable

PUSHORT NlsUnicodeUpcaseTable = NULL

Definition at line 18 of file nls.c.

Referenced by RtlpUpcaseUnicodeChar(), and RtlResetRtlTranslations().