mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 22:33:00 +00:00
Create a branch for network fixes.
svn path=/branches/aicom-network-fixes/; revision=34994
This commit is contained in:
parent
0e213bbc00
commit
c501d8112c
18148 changed files with 0 additions and 860488 deletions
60
lib/sdk/crt/string/mbstowcs_nt.c
Normal file
60
lib/sdk/crt/string/mbstowcs_nt.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
#define WIN32_NO_STATUS
|
||||
#include <windows.h>
|
||||
#include <ndk/umtypes.h>
|
||||
#include <ndk/rtlfuncs.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int mbtowc (wchar_t *wchar, const char *mbchar, size_t count)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONG Size;
|
||||
|
||||
if (wchar == NULL)
|
||||
return 0;
|
||||
|
||||
Status = RtlMultiByteToUnicodeN (wchar,
|
||||
sizeof(WCHAR),
|
||||
&Size,
|
||||
mbchar,
|
||||
count);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return -1;
|
||||
|
||||
return (int)Size;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
size_t mbstowcs (wchar_t *wcstr, const char *mbstr, size_t count)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONG Size;
|
||||
ULONG Length;
|
||||
|
||||
Length = strlen (mbstr);
|
||||
|
||||
if (wcstr == NULL)
|
||||
{
|
||||
RtlMultiByteToUnicodeSize (&Size,
|
||||
mbstr,
|
||||
Length);
|
||||
|
||||
return (size_t)Size;
|
||||
}
|
||||
|
||||
Status = RtlMultiByteToUnicodeN (wcstr,
|
||||
count,
|
||||
&Size,
|
||||
mbstr,
|
||||
Length);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return -1;
|
||||
|
||||
return (size_t)Size;
|
||||
}
|
||||
|
||||
/* EOF */
|
Loading…
Add table
Add a link
Reference in a new issue