1 #include <ndk/umtypes.h>
2 #include <ndk/rtlfuncs.h>
11 int mbtowc (wchar_t *wchar
, const char *mbchar
, size_t count
)
13 UCHAR mbarr
[MB_CUR_MAX
] = { 0 };
23 memcpy(mbarr
, mbchar
, min(count
, sizeof mbarr
));
25 wc
= RtlAnsiCharToUnicodeChar(&mbs
);
27 if (wc
== L
' ' && mbarr
[0] != ' ')
32 return (int)(mbs
- mbarr
);
38 size_t mbstowcs (wchar_t *wcstr
, const char *mbstr
, size_t count
)
44 Length
= (ULONG
)strlen (mbstr
);
48 RtlMultiByteToUnicodeSize (&Size
,
52 return (size_t)(Size
/ sizeof(wchar_t));
55 Status
= RtlMultiByteToUnicodeN (wcstr
,
56 (ULONG
)count
* sizeof(WCHAR
),
60 if (!NT_SUCCESS(Status
))
63 return (size_t)(Size
/ sizeof(wchar_t));