ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

wcstombs_nt.c
Go to the documentation of this file.
00001 #define WIN32_NO_STATUS
00002 #include <windows.h>
00003 #include <ndk/umtypes.h>
00004 #include <ndk/rtlfuncs.h>
00005 
00006 /*
00007  * @implemented
00008  */
00009 int wctomb (char *mbchar, wchar_t wchar)
00010 {
00011     NTSTATUS Status;
00012     ULONG Size;
00013 
00014     if (mbchar == NULL)
00015         return 0;
00016 
00017     Status = RtlUnicodeToMultiByteN (mbchar,
00018                                      1,
00019                                      &Size,
00020                                      &wchar,
00021                                      sizeof(WCHAR));
00022     if (!NT_SUCCESS(Status))
00023         return -1;
00024 
00025     return (int)Size;
00026 }
00027 
00028 /*
00029  * @implemented
00030  */
00031 size_t wcstombs (char *mbstr, const wchar_t *wcstr, size_t count)
00032 {
00033     NTSTATUS Status;
00034     ULONG Size;
00035     ULONG Length;
00036 
00037     Length = (ULONG)wcslen (wcstr);
00038 
00039     if (mbstr == NULL)
00040     {
00041         RtlUnicodeToMultiByteSize (&Size,
00042                                    (wchar_t*)((size_t)wcstr),
00043                                    Length * sizeof(WCHAR));
00044 
00045         return (size_t)Size;
00046     }
00047 
00048     Status = RtlUnicodeToMultiByteN (mbstr,
00049                                      (ULONG)count,
00050                                      &Size,
00051                                      (wchar_t*)((size_t)wcstr),
00052                                      Length * sizeof(WCHAR));
00053     if (!NT_SUCCESS(Status))
00054         return -1;
00055 
00056     return (size_t)Size;
00057 }
00058 
00059 /* EOF */

Generated on Fri May 25 2012 04:35:10 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.