ReactOS 0.4.15-dev-8131-g4988de4
nlsboot.c File Reference
#include <rtl.h>
Include dependency graph for nlsboot.c:

Go to the source code of this file.

Functions

WCHAR NTAPI RtlpDowncaseUnicodeChar (_In_ WCHAR Source)
 
WCHAR NTAPI RtlDowncaseUnicodeChar (_In_ WCHAR Source)
 
_Use_decl_annotations_ NTSTATUS NTAPI RtlMultiByteToUnicodeN (_Out_ PWCH UnicodeString, _In_ ULONG UnicodeSize, _Out_opt_ PULONG ResultSize, _In_ PCCH MbString, _In_ ULONG MbSize)
 
_Use_decl_annotations_ NTSTATUS NTAPI RtlMultiByteToUnicodeSize (_Out_ PULONG UnicodeSize, _In_ PCCH MbString, _In_ ULONG MbSize)
 
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteN (_Out_ PCHAR MbString, _In_ ULONG MbSize, _Out_opt_ PULONG ResultSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
 
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteSize (_Out_ PULONG MbSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
 
WCHAR NTAPI RtlpUpcaseUnicodeChar (_In_ WCHAR Source)
 
WCHAR NTAPI RtlUpcaseUnicodeChar (_In_ WCHAR Source)
 
_Use_decl_annotations_ NTSTATUS NTAPI RtlUpcaseUnicodeToMultiByteN (_Out_ PCHAR MbString, _In_ ULONG MbSize, _Out_opt_ PULONG ResultSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
 
CHAR NTAPI RtlUpperChar (_In_ CHAR Source)
 
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToOemN (_Out_ PCHAR OemString, _In_ ULONG OemSize, _Out_opt_ PULONG ResultSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
 
_Use_decl_annotations_ NTSTATUS NTAPI RtlOemToUnicodeN (_Out_ PWCHAR UnicodeString, _In_ ULONG UnicodeSize, _Out_opt_ PULONG ResultSize, _In_ PCCH OemString, _In_ ULONG OemSize)
 
_Use_decl_annotations_ NTSTATUS NTAPI RtlUpcaseUnicodeToOemN (_Out_ PCHAR OemString, _In_ ULONG OemSize, _Out_opt_ PULONG ResultSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
 

Variables

BOOLEAN NlsMbCodePageTag = FALSE
 
BOOLEAN NlsMbOemCodePageTag = FALSE
 
PUSHORT NlsOemToUnicodeTable = NULL
 
PCHAR NlsUnicodeToOemTable = NULL
 
PUSHORT NlsUnicodeToMbOemTable = NULL
 
PUSHORT NlsOemLeadByteInfo = NULL
 
USHORT NlsOemDefaultChar = '\0'
 
USHORT NlsUnicodeDefaultChar = 0
 

Function Documentation

◆ RtlDowncaseUnicodeChar()

WCHAR NTAPI RtlDowncaseUnicodeChar ( _In_ WCHAR  Source)

Definition at line 53 of file nlsboot.c.

55{
57}
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
WCHAR NTAPI RtlpDowncaseUnicodeChar(_In_ WCHAR Source)
Definition: nlsboot.c:32

◆ RtlMultiByteToUnicodeN()

_Use_decl_annotations_ NTSTATUS NTAPI RtlMultiByteToUnicodeN ( _Out_ PWCH  UnicodeString,
_In_ ULONG  UnicodeSize,
_Out_opt_ PULONG  ResultSize,
_In_ PCCH  MbString,
_In_ ULONG  MbSize 
)

Definition at line 62 of file nlsboot.c.

68{
69 ULONG Size = 0;
70 ULONG i;
71
72 /* single-byte code page */
73 if (MbSize > (UnicodeSize / sizeof(WCHAR)))
74 Size = UnicodeSize / sizeof(WCHAR);
75 else
76 Size = MbSize;
77
78 if (ResultSize)
79 *ResultSize = Size * sizeof(WCHAR);
80
81 for (i = 0; i < Size; i++)
82 {
83 /* Trivially zero-extend */
84 UnicodeString[i] = (WCHAR)MbString[i];
85 }
86
87 return STATUS_SUCCESS;
88}
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 STATUS_SUCCESS
Definition: shellext.h:65
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CreateAcceleratorTableA(), CreateColorSpaceA(), FilenameA2W_N(), HEAP_strdupA2W(), InfHostOpenBufferedFile(), InfHostOpenFile(), InfOpenBufferedFile(), InfOpenFile(), map_wparam_AtoW(), mbstowcs(), MBToWCSEx(), MsgiUnicodeToAnsiReply(), NtUserCreateAcceleratorTable(), parse_manifest(), RtlAnsiCharToUnicodeChar(), RtlAnsiStringToUnicodeString(), and User32CreateWindowEx().

◆ RtlMultiByteToUnicodeSize()

_Use_decl_annotations_ NTSTATUS NTAPI RtlMultiByteToUnicodeSize ( _Out_ PULONG  UnicodeSize,
_In_ PCCH  MbString,
_In_ ULONG  MbSize 
)

Definition at line 93 of file nlsboot.c.

97{
98 /* single-byte code page */
99 *UnicodeSize = MbSize * sizeof(WCHAR);
100
101 return STATUS_SUCCESS;
102}

Referenced by mbstowcs(), parse_manifest(), RtlxAnsiStringToUnicodeSize(), and RtlxOemStringToUnicodeSize().

◆ RtlOemToUnicodeN()

_Use_decl_annotations_ NTSTATUS NTAPI RtlOemToUnicodeN ( _Out_ PWCHAR  UnicodeString,
_In_ ULONG  UnicodeSize,
_Out_opt_ PULONG  ResultSize,
_In_ PCCH  OemString,
_In_ ULONG  OemSize 
)

Definition at line 282 of file nlsboot.c.

288{
289 if (UnicodeString)
291
292 if (ResultSize)
293 *ResultSize = 0;
294
296}
#define UNICODE_NULL
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239

Referenced by CdFindActiveVolDescriptor(), CdUpdateDirentName(), CdUpdatePathEntryName(), FilenameA2W_N(), FsRtlNotifyUpdateBuffer(), RtlOemStringToCountedUnicodeString(), and RtlOemStringToUnicodeString().

◆ RtlpDowncaseUnicodeChar()

WCHAR NTAPI RtlpDowncaseUnicodeChar ( _In_ WCHAR  Source)

Definition at line 32 of file nlsboot.c.

34{
35 USHORT Offset = 0;
36
37 if (Source < L'A')
38 return Source;
39
40 if (Source <= L'Z')
41 return Source + (L'a' - L'A');
42
43#if 0
44 if (Source < 0x80)
45 return Source;
46#endif
47
48 return Source + (SHORT)Offset;
49}
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define L(x)
Definition: ntvdm.h:50
short SHORT
Definition: pedump.c:59
unsigned short USHORT
Definition: pedump.c:61

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

◆ RtlpUpcaseUnicodeChar()

WCHAR NTAPI RtlpUpcaseUnicodeChar ( _In_ WCHAR  Source)

◆ RtlUnicodeToMultiByteN()

_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteN ( _Out_ PCHAR  MbString,
_In_ ULONG  MbSize,
_Out_opt_ PULONG  ResultSize,
_In_ PCWCH  UnicodeString,
_In_ ULONG  UnicodeSize 
)

Definition at line 107 of file nlsboot.c.

113{
114 ULONG Size = 0;
115 ULONG i;
116
117 /* single-byte code page */
118 Size = (UnicodeSize > (MbSize * sizeof(WCHAR)))
119 ? MbSize : (UnicodeSize / sizeof(WCHAR));
120
121 if (ResultSize)
122 *ResultSize = Size;
123
124 for (i = 0; i < Size; i++)
125 {
126 /* Check for characters that cannot be trivially demoted to ANSI */
127 if (*((PCHAR)UnicodeString + 1) == 0)
128 {
129 *MbString++ = (CHAR)*UnicodeString++;
130 }
131 else
132 {
133 /* Invalid character, use default */
134 *MbString++ = NlsOemDefaultChar;
136 }
137 }
138
139 return STATUS_SUCCESS;
140}
#define CHAR(Char)
USHORT NlsOemDefaultChar
Definition: nlsboot.c:25
char * PCHAR
Definition: typedefs.h:51

Referenced by CopyAcceleratorTableA(), FilenameW2A_N(), GetClassNameA(), GetInterfaceName(), LoadStringA(), MsgiAnsiToUnicodeReply(), PARSER_string_substA(), PathCreateFromUrlA(), pSetupDebugPrint(), RealGetWindowClassA(), RegEnumKeyExA(), RegEnumValueA(), RegQueryValueExA(), RtlIpv6AddressToStringA(), RtlIpv6AddressToStringExA(), RtlUnicodeStringToAnsiString(), SearchPathA(), UrlCreateFromPathA(), UrlEscapeA(), WCSToMBEx(), wcstombs(), and wctomb().

◆ RtlUnicodeToMultiByteSize()

◆ RtlUnicodeToOemN()

_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToOemN ( _Out_ PCHAR  OemString,
_In_ ULONG  OemSize,
_Out_opt_ PULONG  ResultSize,
_In_ PCWCH  UnicodeString,
_In_ ULONG  UnicodeSize 
)

Stubbed OEM helpers that should not be used in the OS boot loader, but are necessary for linking with the rest of the RTL unicode.c.

Definition at line 263 of file nlsboot.c.

269{
270 if (OemSize)
272
273 if (ResultSize)
274 *ResultSize = 0;
275
277}
#define ANSI_NULL
*BytesInOemString PCHAR OemString
Definition: rtlfuncs.h:1560

Referenced by _IRQL_requires_max_(), FilenameW2A_N(), GetEnvironmentStringsA(), RtlUnicodeStringToOemString(), and START_TEST().

◆ RtlUpcaseUnicodeChar()

◆ RtlUpcaseUnicodeToMultiByteN()

_Use_decl_annotations_ NTSTATUS NTAPI RtlUpcaseUnicodeToMultiByteN ( _Out_ PCHAR  MbString,
_In_ ULONG  MbSize,
_Out_opt_ PULONG  ResultSize,
_In_ PCWCH  UnicodeString,
_In_ ULONG  UnicodeSize 
)

Definition at line 185 of file nlsboot.c.

191{
192 WCHAR UpcaseChar;
193 ULONG Size = 0;
194 ULONG i;
195
196 /* single-byte code page */
197 if (UnicodeSize > (MbSize * sizeof(WCHAR)))
198 Size = MbSize;
199 else
200 Size = UnicodeSize / sizeof(WCHAR);
201
202 if (ResultSize)
203 *ResultSize = Size;
204
205 for (i = 0; i < Size; i++)
206 {
208
209 /* Check for characters that cannot be trivially demoted to ANSI */
210 if (*((PCHAR)&UpcaseChar + 1) == 0)
211 {
212 *MbString = (CHAR)UpcaseChar;
213 }
214 else
215 {
216 /* Invalid character, use default */
217 *MbString = NlsOemDefaultChar;
218 }
219
220 MbString++;
222 }
223
224 return STATUS_SUCCESS;
225}

Referenced by RtlUpcaseUnicodeStringToAnsiString().

◆ RtlUpcaseUnicodeToOemN()

_Use_decl_annotations_ NTSTATUS NTAPI RtlUpcaseUnicodeToOemN ( _Out_ PCHAR  OemString,
_In_ ULONG  OemSize,
_Out_opt_ PULONG  ResultSize,
_In_ PCWCH  UnicodeString,
_In_ ULONG  UnicodeSize 
)

Definition at line 301 of file nlsboot.c.

307{
308 if (OemSize)
310
311 if (ResultSize)
312 *ResultSize = 0;
313
315}

Referenced by RtlDnsHostNameToComputerName(), RtlUpcaseUnicodeStringToCountedOemString(), and RtlUpcaseUnicodeStringToOemString().

◆ RtlUpperChar()

CHAR NTAPI RtlUpperChar ( _In_ CHAR  Source)

Definition at line 229 of file nlsboot.c.

231{
232 /* Check for simple ANSI case */
233 if (Source <= 'z')
234 {
235 /* Check for simple downcase a-z case */
236 if (Source >= 'a')
237 {
238 /* Just XOR with the difference */
239 return Source ^ ('a' - 'A');
240 }
241 else
242 {
243 /* Otherwise return the same char, it's already upcase */
244 return Source;
245 }
246 }
247 else
248 {
249 /* single-byte code page */
251 }
252}
char CHAR
Definition: xmlstorage.h:175

Referenced by DosChangeDirectory(), DosInitPsp(), DosInt21h(), DosKRNLInitialize(), RtlCompareString(), RtlPrefixString(), and RtlUpperString().

Variable Documentation

◆ NlsMbCodePageTag

BOOLEAN NlsMbCodePageTag = FALSE

Definition at line 17 of file nlsboot.c.

◆ NlsMbOemCodePageTag

BOOLEAN NlsMbOemCodePageTag = FALSE

Definition at line 19 of file nlsboot.c.

Referenced by FsRtlIsDbcsInExpression(), and RtlGenerate8dot3Name().

◆ NlsOemDefaultChar

USHORT NlsOemDefaultChar = '\0'

Definition at line 25 of file nlsboot.c.

Referenced by RtlUnicodeToMultiByteN(), and RtlUpcaseUnicodeToMultiByteN().

◆ NlsOemLeadByteInfo

PUSHORT NlsOemLeadByteInfo = NULL

Definition at line 23 of file nlsboot.c.

◆ NlsOemToUnicodeTable

PUSHORT NlsOemToUnicodeTable = NULL

Definition at line 20 of file nlsboot.c.

◆ NlsUnicodeDefaultChar

USHORT NlsUnicodeDefaultChar = 0

Definition at line 26 of file nlsboot.c.

◆ NlsUnicodeToMbOemTable

PUSHORT NlsUnicodeToMbOemTable = NULL

Definition at line 22 of file nlsboot.c.

◆ NlsUnicodeToOemTable

PCHAR NlsUnicodeToOemTable = NULL

Definition at line 21 of file nlsboot.c.