Author: hbirr
Date: Mon Sep 30 23:01:32 2002
New Revision: 3586
URL:
http://svn.reactos.org/svn/reactos?rev=3586&view=rev
Log:
WideCharToMultiByte accept each code page like MultiByteToWideChar.
Wmc.exe will now produce correct header files (bugcode.h) on ros.
Modified:
trunk/reactos/lib/kernel32/misc/stubs.c
Modified: trunk/reactos/lib/kernel32/misc/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/kernel32/misc/stubs.c?…
==============================================================================
--- trunk/reactos/lib/kernel32/misc/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/lib/kernel32/misc/stubs.c [iso-8859-1] Mon Sep 30 23:01:32 2002
@@ -1,4 +1,4 @@
-/* $Id: stubs.c,v 1.34 2002/09/27 15:29:03 hbirr Exp $
+/* $Id: stubs.c,v 1.35 2002/09/30 21:01:32 hbirr Exp $
*
* KERNEL32.DLL stubs (unimplemented functions)
* Remove from this file, if you implement them.
@@ -1385,62 +1385,73 @@
{
int wi, di; // wide counter, dbcs byte count
+ /*
+ * Check the parameters.
+ */
+ if ( /* --- CODE PAGE --- */
+ ( (CP_ACP != CodePage)
+ && (CP_MACCP != CodePage)
+ && (CP_OEMCP != CodePage)
+ && (CP_SYMBOL != CodePage)
+ && (CP_THREAD_ACP != CodePage)
+ && (CP_UTF7 != CodePage)
+ && (CP_UTF8 != CodePage)
+ && (FALSE == IsInstalledCP (CodePage))
+ )
+ /* --- FLAGS --- */
+ || (dwFlags & ~(/*WC_NO_BEST_FIT_CHARS
+ |*/ WC_COMPOSITECHECK
+ | WC_DISCARDNS
+ | WC_SEPCHARS
+ | WC_DEFAULTCHAR
+ )
+ )
+ /* --- INPUT BUFFER --- */
+ || (NULL == lpWideCharStr)
+ )
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
+
// for now, make no difference but only convert cut the characters to 7Bit
- switch( CodePage )
+ if( cchWideChar == -1 ) // assume its a 0-terminated str
+ { // and determine its length
+ for( cchWideChar=0; lpWideCharStr[cchWideChar]!=0; cchWideChar++)
+ cchWideChar++;
+ }
+
+ // user wants to determine needed space
+ if( cchMultiByte == 0 )
{
- case CP_ACP: //ANSI code page
- case CP_MACCP: //Macintosh code page
- case CP_OEMCP: //OEM code page
- case CP_SYMBOL: //Symbol code page (42)
- case CP_THREAD_ACP: //ACP Current thread's ANSI code page
- case CP_UTF7: //Translate using UTF-7
- case CP_UTF8: //Translate using UTF-8
- if( cchWideChar == -1 ) // assume its a 0-terminated str
- { // and determine its length
- for( cchWideChar=0; lpWideCharStr[cchWideChar]!=0; )
- cchWideChar++;
- }
-
- // user wants to determine needed space
- if( cchMultiByte == 0 )
+ SetLastError(ERROR_SUCCESS);
+ return cchWideChar; // FIXME: determine correct.
+ }
+ // the lpWideCharStr is cchWideChar characters long.
+ for( wi=0, di=0; wi<cchWideChar && di<cchMultiByte; ++wi, ++di)
+ {
+ // Flag and a not displayable char FIXME
+ /*if( (dwFlags&WC_NO_BEST_FIT_CHARS) && (lpWideCharStr[wi] >127) )
{
- SetLastError(ERROR_SUCCESS);
- return cchWideChar; // FIXME: determine correct.
- }
- // the lpWideCharStr is cchWideChar characters long.
- for( wi=0, di=0; wi<cchWideChar && di<cchMultiByte; ++wi)
- {
- // Flag and a not displayable char FIXME
- /*if( (dwFlags&WC_NO_BEST_FIT_CHARS) && (lpWideCharStr[wi] >127) )
- {
- lpMultiByteStr[di]=
- *lpUsedDefaultChar = TRUE;
-
- }*/
- // FIXME
- // just cut off the upper 9 Bit, since vals>=128 mean LeadByte.
- lpMultiByteStr[di] = lpWideCharStr[wi] & 0x007F;
- ++di;
- }
- // has MultiByte exceeded but Wide is still in the string?
- if( wi < cchWideChar && di >= cchMultiByte)
- {
- SetLastError(ERROR_INSUFFICIENT_BUFFER);
- return di;
- }
- // else return # of bytes wirtten to MBCSbuffer (di)
- SetLastError(ERROR_SUCCESS);
- // FIXME: move that elsewhere
- if( lpUsedDefaultChar!=NULL ) *lpUsedDefaultChar=FALSE;
- return di;
- break;
- default:
- SetLastError(ERROR_INVALID_PARAMETER);
- return FALSE;
- break;
+ lpMultiByteStr[di]=
+ *lpUsedDefaultChar = TRUE;
+
+ }*/
+ // FIXME
+ // just cut off the upper 9 Bit, since vals>=128 mean LeadByte.
+ lpMultiByteStr[di] = lpWideCharStr[wi] & 0x007F;
}
- SetLastError(ERROR_INVALID_PARAMETER);
- return FALSE;
+ // has MultiByte exceeded but Wide is still in the string?
+ if( wi < cchWideChar && di >= cchMultiByte)
+ {
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+ return 0;
+ }
+ // else return # of bytes wirtten to MBCSbuffer (di)
+ SetLastError(ERROR_SUCCESS);
+ // FIXME: move that elsewhere
+ if( lpUsedDefaultChar!=NULL ) *lpUsedDefaultChar=FALSE;
+ return di;
}