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
13int
16{
17 PUCHAR ptr;
18 WCHAR wc, wcUpper;
19 CHAR chrUpper[2];
20 ULONG mbSize;
21
22 ptr = (PUCHAR)&_C;
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}
#define __cdecl
Definition: accygwin.h:79
NTSYSAPI WCHAR WINAPI RtlAnsiCharToUnicodeChar(LPSTR *)
static PVOID ptr
Definition: dispmode.c:27
_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
WCHAR NTAPI RtlUpcaseUnicodeChar(_In_ WCHAR Source)
Definition: nlsboot.c:176
#define _Check_return_
Definition: no_sal2.h:60
#define _In_
Definition: no_sal2.h:158
_Check_return_ int __cdecl toupper_nt_mb(_In_ int _C)
Definition: toupper_nt_mb.c:15
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175