[CRT]
[reactos.git] / reactos / dll / win32 / user32 / misc / wsprintf.c
index 89933c6..6b70d8b 100644 (file)
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  *
  * NOTE:
  * This code is duplicated in shlwapi. If you change something here make sure
 
 #include <user32.h>
 
+#define WINE_NO_TRACE_MSGS
+#include <wine/debug.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(string);
+
+
 #define WPRINTF_LEFTALIGN   0x0001  /* Align output on the left ('-' prefix) */
 #define WPRINTF_PREFIX_HEX  0x0002  /* Prefix hex with 0x ('#' prefix) */
 #define WPRINTF_ZEROPAD     0x0004  /* Pad with zeros ('0' prefix) */
@@ -274,10 +280,11 @@ static UINT WPRINTF_GetLen( WPRINTF_FORMAT *format, WPRINTF_DATA *arg,
     return len;
 }
 
+
 /***********************************************************************
  *           wvsnprintfA   (internal)
  */
-static INT wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, va_list args )
+static INT wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, __ms_va_list args )
 {
     WPRINTF_FORMAT format;
     LPSTR p = buffer;
@@ -285,7 +292,7 @@ static INT wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, va_list args )
     CHAR number[20];
     WPRINTF_DATA argData;
 
-    //TRACE("%p %u %s\n", buffer, maxlen, debugstr_a(spec));
+    TRACE("%p %u %s\n", buffer, maxlen, debugstr_a(spec));
 
     while (*spec && (maxlen > 1))
     {
@@ -372,7 +379,7 @@ static INT wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, va_list args )
         maxlen -= len;
     }
     *p = 0;
-    //TRACE("%s\n",debugstr_a(buffer));
+    TRACE("%s\n",debugstr_a(buffer));
     return (maxlen > 1) ? (INT)(p - buffer) : -1;
 }
 
@@ -380,7 +387,7 @@ static INT wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, va_list args )
 /***********************************************************************
  *           wvsnprintfW   (internal)
  */
-static INT wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, va_list args )
+static INT wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, __ms_va_list args )
 {
     WPRINTF_FORMAT format;
     LPWSTR p = buffer;
@@ -388,7 +395,7 @@ static INT wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, va_list args )
     CHAR number[20];
     WPRINTF_DATA argData;
 
-    //TRACE("%p %u %s\n", buffer, maxlen, debugstr_w(spec));
+    TRACE("%p %u %s\n", buffer, maxlen, debugstr_w(spec));
 
     while (*spec && (maxlen > 1))
     {
@@ -474,15 +481,15 @@ static INT wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, va_list args )
         maxlen -= len;
     }
     *p = 0;
-    //TRACE("%s\n",debugstr_w(buffer));
+    TRACE("%s\n",debugstr_w(buffer));
     return (maxlen > 1) ? (INT)(p - buffer) : -1;
 }
 
+
 /***********************************************************************
  *           wvsprintfA   (USER32.@)
- * @implemented
  */
-INT STDCALL wvsprintfA( LPSTR buffer, LPCSTR spec, va_list args )
+INT WINAPI wvsprintfA( LPSTR buffer, LPCSTR spec, __ms_va_list args )
 {
     INT res = wvsnprintfA( buffer, 1024, spec, args );
     return ( res == -1 ) ? 1024 : res;
@@ -491,113 +498,39 @@ INT STDCALL wvsprintfA( LPSTR buffer, LPCSTR spec, va_list args )
 
 /***********************************************************************
  *           wvsprintfW   (USER32.@)
- * @implemented
  */
-INT STDCALL wvsprintfW( LPWSTR buffer, LPCWSTR spec, va_list args )
+INT WINAPI wvsprintfW( LPWSTR buffer, LPCWSTR spec, __ms_va_list args )
 {
     INT res = wvsnprintfW( buffer, 1024, spec, args );
     return ( res == -1 ) ? 1024 : res;
 }
 
+
 /***********************************************************************
  *           wsprintfA   (USER32.@)
- * @implemented
  */
-INT CDECL wsprintfA( LPSTR buffer, LPCSTR spec, ... )
+INT WINAPIV wsprintfA( LPSTR buffer, LPCSTR spec, ... )
 {
-    va_list valist;
+    __ms_va_list valist;
     INT res;
 
-    va_start( valist, spec );
+    __ms_va_start( valist, spec );
     res = wvsnprintfA( buffer, 1024, spec, valist );
-    va_end( valist );
+    __ms_va_end( valist );
     return ( res == -1 ) ? 1024 : res;
 }
 
+
 /***********************************************************************
  *           wsprintfW   (USER32.@)
- * @implemented
  */
-INT CDECL wsprintfW( LPWSTR buffer, LPCWSTR spec, ... )
+INT WINAPIV wsprintfW( LPWSTR buffer, LPCWSTR spec, ... )
 {
-    va_list valist;
+    __ms_va_list valist;
     INT res;
 
-    va_start( valist, spec );
+    __ms_va_start( valist, spec );
     res = wvsnprintfW( buffer, 1024, spec, valist );
-    va_end( valist );
+    __ms_va_end( valist );
     return ( res == -1 ) ? 1024 : res;
 }
-/*
- * @implemented
- */
-DWORD STDCALL WCSToMBEx(WORD CodePage,LPWSTR UnicodeString,LONG UnicodeSize,LPSTR *MBString,LONG MBSize,BOOL Allocate)
-{
-       DWORD Size;
-       if (UnicodeSize == -1)
-       {
-               UnicodeSize = wcslen(UnicodeString)+1;
-       }
-       if (MBSize == -1)
-       {
-               if (!Allocate)
-               {
-                       return 0;
-               }
-               MBSize = UnicodeSize * 2;
-       }
-       if (Allocate)
-       {
-               *MBString = RtlAllocateHeap(GetProcessHeap(), 0, MBSize);
-       }
-       if (CodePage == 0)
-       {
-               RtlUnicodeToMultiByteN(*MBString,MBSize,&Size,UnicodeString,UnicodeSize);
-       }
-       else
-       {
-               WideCharToMultiByte(CodePage,0,UnicodeString,UnicodeSize,*MBString,MBSize,0,0);
-       }
-       return UnicodeSize;
-}
-/*
- * @implemented
- */
-DWORD STDCALL MBToWCSEx(WORD CodePage,LPSTR MBString,LONG MBSize,LPWSTR *UnicodeString,LONG UnicodeSize,BOOL Allocate)
-{
-       DWORD Size;
-       if (MBSize == -1)
-       {
-               MBSize = strlen(MBString)+1;
-       }
-       if (UnicodeSize == -1)
-       {
-               if (!Allocate)
-               {
-                       return 0;
-               }
-               UnicodeSize = MBSize;
-       }
-       if (Allocate)
-       {
-               *UnicodeString = RtlAllocateHeap(GetProcessHeap(), 0, UnicodeSize);
-       }
-       UnicodeSize *= sizeof(WCHAR);
-       if (CodePage == 0)
-       {
-               RtlMultiByteToUnicodeN(*UnicodeString,UnicodeSize,&Size,MBString,MBSize);
-       }
-       else
-       {
-               Size = MultiByteToWideChar(CodePage,0,MBString,MBSize,*UnicodeString,UnicodeSize);
-       }
-       return Size;
-}
-const LPWSTR strings[14] = {L"OK",L"Cancel",L"&Abort",L"&Retry",L"&Ignore",L"&Yes",L"&No",L"&Close",L"Help",L"&Try Again",L"&Continue"};
-/*
- * @implemented
- */
-LPWSTR STDCALL MB_GetString(DWORD string)
-{
-       return heap_string_poolW(strings[string],wcslen(strings[string]));
-}