ReactOS
0.4.16-dev-1983-g1a17364
toupper_nt_mb.c
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS NT CRT library
3
* LICENSE: MIT (https://spdx.org/licenses/MIT)
4
* PURPOSE: Multibyte capable version of toupper
5
* COPYRIGHT: Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
6
*/
7
8
#define WIN32_NO_STATUS
9
#include <
windef.h
>
10
#include <
ndk/rtlfuncs.h
>
11
12
_Check_return_
13
int
14
__cdecl
15
toupper_nt_mb
(
_In_
int
_C)
16
{
17
PUCHAR
ptr
;
18
WCHAR
wc, wcUpper;
19
CHAR
chrUpper[2];
20
ULONG
mbSize;
21
22
ptr
= (
PUCHAR
)&_C;
23
wc =
RtlAnsiCharToUnicodeChar
(&
ptr
);
24
wcUpper =
RtlUpcaseUnicodeChar
(wc);
25
RtlUnicodeToMultiByteN
(chrUpper, 2, &mbSize, &wcUpper,
sizeof
(
WCHAR
));
26
27
if
(mbSize == 2)
28
return
(
UCHAR
)chrUpper[1] + ((
UCHAR
)chrUpper[0] << 8);
29
else
if
(mbSize == 1)
30
return
(
UCHAR
)chrUpper[0];
31
else
32
return
(
WCHAR
)_C;
33
}
__cdecl
#define __cdecl
Definition:
accygwin.h:79
RtlAnsiCharToUnicodeChar
NTSYSAPI WCHAR WINAPI RtlAnsiCharToUnicodeChar(LPSTR *)
ptr
static PVOID ptr
Definition:
dispmode.c:27
rtlfuncs.h
RtlUnicodeToMultiByteN
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteN(_Out_ PCHAR MbString, _In_ ULONG MbSize, _Out_opt_ PULONG ResultSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition:
nlsboot.c:107
RtlUpcaseUnicodeChar
WCHAR NTAPI RtlUpcaseUnicodeChar(_In_ WCHAR Source)
Definition:
nlsboot.c:176
_Check_return_
#define _Check_return_
Definition:
no_sal2.h:60
_In_
#define _In_
Definition:
no_sal2.h:158
toupper_nt_mb
_Check_return_ int __cdecl toupper_nt_mb(_In_ int _C)
Definition:
toupper_nt_mb.c:15
PUCHAR
unsigned char * PUCHAR
Definition:
typedefs.h:53
ULONG
uint32_t ULONG
Definition:
typedefs.h:59
windef.h
UCHAR
unsigned char UCHAR
Definition:
xmlstorage.h:181
WCHAR
__wchar_t WCHAR
Definition:
xmlstorage.h:180
CHAR
char CHAR
Definition:
xmlstorage.h:175
sdk
lib
crt
string
toupper_nt_mb.c
Generated on Sat Dec 13 2025 06:16:26 for ReactOS by
1.9.6