ReactOS 0.4.17-dev-116-ga4b6fe9
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 NlsLeadByteInfo = NULL
 
PUSHORT NlsOemLeadByteInfo = NULL
 
USHORT NlsOemDefaultChar = '\0'
 
USHORT NlsUnicodeDefaultChar = 0
 

Function Documentation

◆ RtlDowncaseUnicodeChar()

WCHAR NTAPI RtlDowncaseUnicodeChar ( _In_ WCHAR  Source)

Definition at line 54 of file nlsboot.c.

56{
58}
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
WCHAR NTAPI RtlpDowncaseUnicodeChar(_In_ WCHAR Source)
Definition: nlsboot.c:33

Referenced by UrlCombineW().

◆ 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 63 of file nlsboot.c.

69{
70 ULONG Size = 0;
71 ULONG i;
72
73 /* single-byte code page */
74 if (MbSize > (UnicodeSize / sizeof(WCHAR)))
75 Size = UnicodeSize / sizeof(WCHAR);
76 else
77 Size = MbSize;
78
79 if (ResultSize)
80 *ResultSize = Size * sizeof(WCHAR);
81
82 for (i = 0; i < Size; i++)
83 {
84 /* Trivially zero-extend */
85 UnicodeString[i] = (WCHAR)MbString[i];
86 }
87
88 return STATUS_SUCCESS;
89}
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
short WCHAR
Definition: pedump.c:58
#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:4539
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_opt_ PCUNICODE_STRING UnicodeString
Definition: wdfstring.h:64

Referenced by compare_RtlIpv6StringToAddressExW(), compare_RtlIpv6StringToAddressW(), CreateAcceleratorTableA(), CreateColorSpaceA(), FilenameA2W_N(), HEAP_strdupA2W(), HEAP_strdupA2W_buf(), InfHostOpenBufferedFile(), InfHostOpenFile(), InfOpenBufferedFile(), InfOpenFile(), IntHandleAltNumpad(), IsCharAlphaA(), IsCharAlphaNumericA(), IsCharLowerA(), IsCharSpaceA(), IsCharUpperA(), map_wparam_AtoW(), mbstowcs(), MBToWCSEx(), MsgiUnicodeToAnsiReply(), NtUserCreateAcceleratorTable(), RegSetValueExA(), RtlAnsiCharToUnicodeChar(), RtlAnsiStringToUnicodeString(), and User32CreateWindowEx().

◆ RtlMultiByteToUnicodeSize()

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

Definition at line 94 of file nlsboot.c.

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

Referenced by mbstowcs(), RegSetValueExA(), 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 283 of file nlsboot.c.

289{
290 if (UnicodeString)
292
293 if (ResultSize)
294 *ResultSize = 0;
295
297}
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
#define UNICODE_NULL

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

◆ RtlpDowncaseUnicodeChar()

WCHAR NTAPI RtlpDowncaseUnicodeChar ( _In_ WCHAR  Source)

Definition at line 33 of file nlsboot.c.

35{
36 USHORT Offset = 0;
37
38 if (Source < L'A')
39 return Source;
40
41 if (Source <= L'Z')
42 return Source + (L'a' - L'A');
43
44#if 0
45 if (Source < 0x80)
46 return Source;
47#endif
48
49 return Source + (SHORT)Offset;
50}
#define L(x)
Definition: resources.c:13
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
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 108 of file nlsboot.c.

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

Referenced by CopyAcceleratorTableA(), file_name_WtoA(), FilenameW2A_N(), GetClassNameA(), GetInterfaceName(), LoadStringA(), MsgiAnsiToUnicodeReply(), PARSER_string_substA(), PathCreateFromUrlA(), pSetupDebugPrint(), query_perf_help(), query_perf_names(), RealGetWindowClassA(), RegEnumKeyExA(), RegEnumValueA(), RegQueryInfoKeyA(), RegQueryValueExA(), RtlIpv6AddressToStringA(), RtlIpv6AddressToStringExA(), RtlUnicodeStringToAnsiString(), SearchPathA(), toupper_nt_mb(), 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 264 of file nlsboot.c.

270{
271 if (OemSize)
273
274 if (ResultSize)
275 *ResultSize = 0;
276
278}
#define ANSI_NULL
*BytesInOemString PCHAR OemString
Definition: rtlfuncs.h:1577

Referenced by _IRQL_requires_max_(), file_name_WtoA(), 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 186 of file nlsboot.c.

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

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 302 of file nlsboot.c.

308{
309 if (OemSize)
311
312 if (ResultSize)
313 *ResultSize = 0;
314
316}

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

◆ RtlUpperChar()

CHAR NTAPI RtlUpperChar ( _In_ CHAR  Source)

Definition at line 230 of file nlsboot.c.

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

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

Variable Documentation

◆ NlsLeadByteInfo

PUSHORT NlsLeadByteInfo = NULL

Definition at line 23 of file nlsboot.c.

◆ 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 26 of file nlsboot.c.

Referenced by RtlUnicodeToMultiByteN(), and RtlUpcaseUnicodeToMultiByteN().

◆ NlsOemLeadByteInfo

PUSHORT NlsOemLeadByteInfo = NULL

Definition at line 24 of file nlsboot.c.

◆ NlsOemToUnicodeTable

PUSHORT NlsOemToUnicodeTable = NULL

Definition at line 20 of file nlsboot.c.

◆ NlsUnicodeDefaultChar

USHORT NlsUnicodeDefaultChar = 0

Definition at line 27 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.