ReactOS 0.4.15-dev-8236-g99f0937
wcstombs_nt.c
Go to the documentation of this file.
1#include <ndk/umtypes.h>
2#include <ndk/rtlfuncs.h>
3
4/*
5 * @implemented
6 */
7int wctomb (char *mbchar, wchar_t wchar)
8{
10 ULONG Size;
11
12 if (mbchar == NULL)
13 return 0;
14
16 1,
17 &Size,
18 &wchar,
19 sizeof(WCHAR));
20 if (!NT_SUCCESS(Status))
21 return -1;
22
23 return (int)Size;
24}
25
26/*
27 * @implemented
28 */
29size_t wcstombs (char *mbstr, const wchar_t *wcstr, size_t count)
30{
32 ULONG Size;
34
35 Length = (ULONG)wcslen (wcstr);
36
37 if (mbstr == NULL)
38 {
40 (wchar_t*)((size_t)wcstr),
41 Length * sizeof(WCHAR));
42
43 return (size_t)(Size / sizeof(char));
44 }
45
47 (ULONG)count,
48 &Size,
49 (wchar_t*)((size_t)wcstr),
50 Length * sizeof(WCHAR));
51 if (!NT_SUCCESS(Status))
52 return -1;
53
54 return (size_t)(Size / sizeof(char));
55}
56
57/* EOF */
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned char
Definition: typeof.h:29
Status
Definition: gdiplustypes.h:25
GLuint GLuint GLsizei count
Definition: gl.h:1545
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_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
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteSize(_Out_ PULONG MbSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:145
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define wctomb(cp, wc)
Definition: wchar.h:161
uint32_t ULONG
Definition: typedefs.h:59
size_t wcstombs(char *mbstr, const wchar_t *wcstr, size_t count)
Definition: wcstombs_nt.c:29
_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