Commit 5b971f00 authored by Alexandre Julliard's avatar Alexandre Julliard

Moved wsprintf functions to dlls/user.

parent cbbc7c3d
......@@ -326,7 +326,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
DEBUG_AddSymbol(prefix, &value, NULL, SYM_WIN32 | SYM_FUNC);
/* Add entry point */
wsnprintf(buffer, sizeof(buffer), "%s.EntryPoint", prefix);
snprintf(buffer, sizeof(buffer), "%s.EntryPoint", prefix);
value.addr.off = base + nth->OptionalHeader.AddressOfEntryPoint;
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
......@@ -337,7 +337,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
for (i = 0; i < nth->FileHeader.NumberOfSections; i++, pe_seg_ofs += sizeof(pe_seg)) {
if (!DEBUG_READ_MEM_VERBOSE((void*)(base + pe_seg_ofs), &pe_seg, sizeof(pe_seg)))
continue;
wsnprintf(buffer, sizeof(buffer), "%s.%s", prefix, pe_seg.Name);
snprintf(buffer, sizeof(buffer), "%s.%s", prefix, pe_seg.Name);
value.addr.off = base + pe_seg.VirtualAddress;
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
}
......@@ -373,7 +373,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
!DEBUG_READ_MEM_VERBOSE((void*)(base + names[i]), bufstr, sizeof(bufstr)))
continue;
bufstr[sizeof(bufstr) - 1] = 0;
wsnprintf(buffer, sizeof(buffer), "%s.%s", prefix, bufstr);
snprintf(buffer, sizeof(buffer), "%s.%s", prefix, bufstr);
value.addr.off = base + (DWORD)functions[ordinals[i]];
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
}
......@@ -384,7 +384,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
for (j = 0; j < exports.NumberOfNames; j++)
if ((ordinals[j] == i) && names[j]) break;
if (j < exports.NumberOfNames) continue;
wsnprintf(buffer, sizeof(buffer), "%s.%ld", prefix, i + exports.Base);
snprintf(buffer, sizeof(buffer), "%s.%ld", prefix, i + exports.Base);
value.addr.off = base + (DWORD)functions[i];
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
}
......
......@@ -770,7 +770,7 @@ HRESULT FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam
/* Prepend the current path */
COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,lpstrCurrentDir);
if ((LPSTR)lParam!=NULL)
wsnprintfA((LPSTR)lParam,(int)wParam,"%s\\%s",lpstrCurrentDir,lpstrPath);
snprintf((LPSTR)lParam,(int)wParam,"%s\\%s",lpstrCurrentDir,lpstrPath);
reqSize=strlen(lpstrCurrentDir)+1+strlen(lpstrPath)+1;
}
else
......
......@@ -4,7 +4,6 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = crtdll
EXTRALIBS = -lwine_unicode
IMPORTS = ntdll
LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o
......
......@@ -490,7 +490,7 @@ debug_channels (crtdll)
@ cdecl strtol(str ptr long) strtol
@ cdecl strtoul(str ptr long) strtoul
@ cdecl strxfrm(ptr str long) strxfrm
@ varargs swprintf(wstr wstr) wsprintfW
@ stub swprintf
@ stub swscanf
@ cdecl system(str) CRTDLL_system
@ cdecl tan(double) tan
......@@ -508,7 +508,7 @@ debug_channels (crtdll)
@ stub vfwprintf
@ stub vprintf
@ cdecl vsprintf(ptr str ptr) vsprintf
@ cdecl vswprintf(ptr wstr ptr) CRTDLL_vswprintf
@ stub vswprintf
@ stub vwprintf
@ forward wcscat ntdll.wcscat
@ forward wcschr ntdll.wcschr
......
......@@ -598,15 +598,6 @@ double __cdecl CRTDLL__scalb(double x, LONG y)
/*********************************************************************
* vswprintf (CRTDLL.501)
*/
INT __cdecl CRTDLL_vswprintf( LPWSTR buffer, LPCWSTR spec, va_list args )
{
return wvsprintfW( buffer, spec, args );
}
/*********************************************************************
* longjmp (CRTDLL.426)
*/
VOID __cdecl CRTDLL_longjmp(jmp_buf env, int val)
......
......@@ -4,10 +4,13 @@
* Copyright (C) 1999 Alexandre Julliard
*/
#include <stdio.h>
#include <string.h>
#include "winerror.h"
#include "wine/winbase16.h"
#include "server.h"
#include "stackframe.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(debugstr);
......@@ -229,3 +232,29 @@ BOOL WINAPI IsDebuggerPresent(void)
SERVER_END_REQ;
return ret;
}
/***********************************************************************
* _DebugOutput (KERNEL.328)
*/
void WINAPIV _DebugOutput( void )
{
VA_LIST16 valist;
WORD flags;
SEGPTR spec;
char caller[101];
/* Decode caller address */
if (!GetModuleName16( GetExePtr(CURRENT_STACK16->cs), caller, sizeof(caller) ))
sprintf( caller, "%04X:%04X", CURRENT_STACK16->cs, CURRENT_STACK16->ip );
/* Build debug message string */
VA_START16( valist );
flags = VA_ARG16( valist, WORD );
spec = VA_ARG16( valist, SEGPTR );
/* FIXME: cannot use wvsnprintf16 from kernel */
/* wvsnprintf16( temp, sizeof(temp), (LPCSTR)PTR_SEG_TO_LIN(spec), valist ); */
/* Output */
FIXME("%s %04x %s\n", caller, flags, debugstr_a(PTR_SEG_TO_LIN(spec)) );
}
......@@ -945,7 +945,7 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ cdecl -noimport strspn(str str) strspn
@ cdecl -noimport strstr(str str) strstr
@ cdecl -noimport strtol(str ptr long) strtol
@ varargs swprintf(wstr wstr) wsprintfW
@ stub swprintf
@ stub tan
@ cdecl tolower(long) tolower
@ cdecl toupper(long) toupper
......
......@@ -20,7 +20,8 @@ C_SRCS = \
resource.c \
text.c \
thunk.c \
user_main.c
user_main.c \
wsprintf.c
RC_SRCS = \
resources/display.rc \
......
......@@ -398,7 +398,7 @@ owner user32
416 pascal16 TrackPopupMenu(word word s_word s_word s_word word ptr) TrackPopupMenu16
417 pascal GetMenuCheckMarkDimensions() GetMenuCheckMarkDimensions
418 pascal16 SetMenuItemBitmaps(word word word word word) SetMenuItemBitmaps16
420 pascal16 _wsprintf() WIN16_wsprintf16
420 pascal16 _wsprintf() wsprintf16
421 pascal16 wvsprintf(ptr str ptr) wvsprintf16
422 pascal16 DlgDirSelectEx(word ptr word word) DlgDirSelectEx16
423 pascal16 DlgDirSelectComboBoxEx(word ptr word word) DlgDirSelectComboBoxEx16
......
......@@ -651,3 +651,9 @@ debug_channels (accel caret class clipboard combo cursor dc ddeml dialog driver
@ stdcall GetClipboardSequenceNumber () GetClipboardSequenceNumber
@ stdcall AllowSetForegroundWindow (long) AllowSetForegroundWindow
@ stdcall LockSetForegroundWindow (long) LockSetForegroundWindow
###################################################
# Extra useful functions not exported under Windows
#
@ stdcall wvsnprintfA(ptr long str ptr) wvsnprintfA
@ stdcall wvsnprintfW(ptr long wstr ptr) wvsnprintfW
......@@ -13,11 +13,10 @@
#include "winuser.h"
#include "ldt.h"
#include "stackframe.h"
#include "module.h"
#include "global.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(string)
DEFAULT_DEBUG_CHANNEL(string);
#define WPRINTF_LEFTALIGN 0x0001 /* Align output on the left ('-' prefix) */
......@@ -108,12 +107,10 @@ static INT WPRINTF_ParseFormatA( LPCSTR format, WPRINTF_FORMAT *res )
res->type = WPR_SIGNED;
break;
case 's':
res->type = (res->flags & (WPRINTF_LONG |WPRINTF_WIDE))
? WPR_WSTRING : WPR_STRING;
res->type = (res->flags & (WPRINTF_LONG |WPRINTF_WIDE)) ? WPR_WSTRING : WPR_STRING;
break;
case 'S':
res->type = (res->flags & (WPRINTF_SHORT|WPRINTF_WIDE))
? WPR_STRING : WPR_WSTRING;
res->type = (res->flags & (WPRINTF_SHORT|WPRINTF_WIDE)) ? WPR_STRING : WPR_WSTRING;
break;
case 'u':
res->type = WPR_UNSIGNED;
......@@ -256,7 +253,7 @@ static UINT WPRINTF_GetLen( WPRINTF_FORMAT *format, WPRINTF_DATA *arg,
}
/***********************************************************************
* WPRINTF_ExtractVAPtr (Not a Windows API)
* WPRINTF_ExtractVAPtr
*/
static WPRINTF_DATA WPRINTF_ExtractVAPtr( WPRINTF_FORMAT *format, va_list* args )
{
......@@ -284,7 +281,7 @@ static WPRINTF_DATA WPRINTF_ExtractVAPtr( WPRINTF_FORMAT *format, va_list* args
/***********************************************************************
* wvsnprintf16 (Not a Windows API)
*/
INT16 WINAPI wvsnprintf16( LPSTR buffer, UINT16 maxlen, LPCSTR spec,
static INT16 wvsnprintf16( LPSTR buffer, UINT16 maxlen, LPCSTR spec,
LPCVOID args )
{
WPRINTF_FORMAT format;
......@@ -337,7 +334,7 @@ INT16 WINAPI wvsnprintf16( LPSTR buffer, UINT16 maxlen, LPCSTR spec,
{
case WPR_WCHAR: /* No Unicode in Win16 */
case WPR_CHAR:
*p= cur_arg.char_view;
*p= cur_arg.char_view;
if (*p != '\0') p++;
else if (format.width > 1) *p++ = ' ';
else len = 0;
......@@ -376,10 +373,9 @@ INT16 WINAPI wvsnprintf16( LPSTR buffer, UINT16 maxlen, LPCSTR spec,
/***********************************************************************
* wvsnprintfA (Not a Windows API)
* wvsnprintfA (Not a Windows API, but we export it from USER32 anyway)
*/
INT WINAPI wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec,
va_list args )
INT WINAPI wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, va_list args )
{
WPRINTF_FORMAT format;
LPSTR p = buffer;
......@@ -387,6 +383,8 @@ INT WINAPI wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec,
CHAR number[20];
WPRINTF_DATA argData;
TRACE("%p %u %s\n", buffer, maxlen, debugstr_a(spec));
while (*spec && (maxlen > 1))
{
if (*spec != '%') { *p++ = *spec++; maxlen--; continue; }
......@@ -401,13 +399,13 @@ INT WINAPI wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec,
switch(format.type)
{
case WPR_WCHAR:
*p = argData.wchar_view;
*p = argData.wchar_view;
if (*p != '\0') p++;
else if (format.width > 1) *p++ = ' ';
else len = 0;
break;
case WPR_CHAR:
*p = argData.char_view;
*p = argData.char_view;
if (*p != '\0') p++;
else if (format.width > 1) *p++ = ' ';
else len = 0;
......@@ -446,16 +444,15 @@ INT WINAPI wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec,
maxlen -= len;
}
*p = 0;
TRACE("%s\n",buffer);
TRACE("%s\n",debugstr_a(buffer));
return (maxlen > 1) ? (INT)(p - buffer) : -1;
}
/***********************************************************************
* wvsnprintfW (Not a Windows API)
* wvsnprintfW (Not a Windows API, but we export it from USER32 anyway)
*/
INT WINAPI wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec,
va_list args )
INT WINAPI wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, va_list args )
{
WPRINTF_FORMAT format;
LPWSTR p = buffer;
......@@ -479,13 +476,13 @@ INT WINAPI wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec,
switch(format.type)
{
case WPR_WCHAR:
*p = argData.wchar_view;
*p = argData.wchar_view;
if (*p != '\0') p++;
else if (format.width > 1) *p++ = ' ';
else len = 0;
break;
case WPR_CHAR:
*p = argData.char_view;
*p = argData.char_view;
if (*p != '\0') p++;
else if (format.width > 1) *p++ = ' ';
else len = 0;
......@@ -523,6 +520,7 @@ INT WINAPI wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec,
maxlen -= len;
}
*p = 0;
TRACE("%s\n",debugstr_w(buffer));
return (maxlen > 1) ? (INT)(p - buffer) : -1;
}
......@@ -545,10 +543,7 @@ INT16 WINAPI wvsprintf16( LPSTR buffer, LPCSTR spec, LPCVOID args )
*/
INT WINAPI wvsprintfA( LPSTR buffer, LPCSTR spec, va_list args )
{
INT res;
TRACE("for %p got:\n",buffer);
res = wvsnprintfA( buffer, 1024, spec, args );
INT res = wvsnprintfA( buffer, 1024, spec, args );
return ( res == -1 ) ? 1024 : res;
}
......@@ -558,12 +553,7 @@ INT WINAPI wvsprintfA( LPSTR buffer, LPCSTR spec, va_list args )
*/
INT WINAPI wvsprintfW( LPWSTR buffer, LPCWSTR spec, va_list args )
{
INT res;
TRACE("for %p got:\n",buffer);
/* FIXME: in w*printfW, */
/* is maximum buffer size 1024-bytes? (or 1024-wchars?) */
res = wvsnprintfW( buffer, 1024, spec, args );
INT res = wvsnprintfW( buffer, 1024, spec, args );
return ( res == -1 ) ? 1024 : res;
}
......@@ -571,22 +561,7 @@ INT WINAPI wvsprintfW( LPWSTR buffer, LPCWSTR spec, va_list args )
/***********************************************************************
* wsprintf16 (USER.420)
*/
/* Winelib version */
INT16 WINAPIV wsprintf16( LPSTR buffer, LPCSTR spec, ... )
{
va_list valist;
INT16 res;
TRACE("for %p got:\n",buffer);
va_start( valist, spec );
/* Note: we call the 32-bit version, because the args are 32-bit */
res = (INT16)wvsnprintfA( buffer, 1024, spec, valist );
va_end( valist );
return ( res == -1 ) ? 1024 : res;
}
/* Emulator version */
INT16 WINAPIV WIN16_wsprintf16(void)
INT16 WINAPIV wsprintf16(void)
{
VA_LIST16 valist;
INT16 res;
......@@ -595,7 +570,6 @@ INT16 WINAPIV WIN16_wsprintf16(void)
VA_START16( valist );
buffer = VA_ARG16( valist, SEGPTR );
spec = VA_ARG16( valist, SEGPTR );
TRACE("got:\n");
res = wvsnprintf16( (LPSTR)PTR_SEG_TO_LIN(buffer), 1024,
(LPCSTR)PTR_SEG_TO_LIN(spec), valist );
VA_END16( valist );
......@@ -611,7 +585,6 @@ INT WINAPIV wsprintfA( LPSTR buffer, LPCSTR spec, ... )
va_list valist;
INT res;
TRACE("for %p got:\n",buffer);
va_start( valist, spec );
res = wvsnprintfA( buffer, 1024, spec, valist );
va_end( valist );
......@@ -627,81 +600,8 @@ INT WINAPIV wsprintfW( LPWSTR buffer, LPCWSTR spec, ... )
va_list valist;
INT res;
TRACE("wsprintfW for %p\n",buffer);
va_start( valist, spec );
res = wvsnprintfW( buffer, 1024, spec, valist );
va_end( valist );
return ( res == -1 ) ? 1024 : res;
}
/***********************************************************************
* wsnprintfA (Not a Windows API)
*/
INT WINAPIV wsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, ... )
{
va_list valist;
INT res;
va_start( valist, spec );
res = wvsnprintfA( buffer, maxlen, spec, valist );
va_end( valist );
return res;
}
/***********************************************************************
* wsnprintfW (Not a Windows API)
*/
INT WINAPIV wsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, ... )
{
va_list valist;
INT res;
va_start( valist, spec );
res = wvsnprintfW( buffer, maxlen, spec, valist );
va_end( valist );
return res;
}
/***********************************************************************
* _DebugOutput (KERNEL.328)
*/
void WINAPIV _DebugOutput( void )
{
VA_LIST16 valist;
WORD flags;
SEGPTR spec;
int i, nSeg = 0;
NE_MODULE *pModule;
char caller[101], temp[512];
/* Decode caller address */
pModule = NE_GetPtr( CURRENT_STACK16->cs );
if ( pModule )
{
SEGTABLEENTRY *pSeg = NE_SEG_TABLE( pModule );
for ( i = 0; i < pModule->seg_count; i++, pSeg++ )
if ( GlobalHandleToSel16( pSeg->hSeg ) == CURRENT_STACK16->cs )
{
nSeg = i+1;
break;
}
}
if ( nSeg )
sprintf( caller, "%s %02X:%04X", NE_MODULE_NAME( pModule ),
nSeg, CURRENT_STACK16->ip );
else
sprintf( caller, "%04X:%04X", CURRENT_STACK16->cs, CURRENT_STACK16->ip );
/* Build debug message string */
VA_START16( valist );
flags = VA_ARG16( valist, WORD );
spec = VA_ARG16( valist, SEGPTR );
wvsnprintf16( temp, sizeof(temp), (LPCSTR)PTR_SEG_TO_LIN(spec), valist );
/* Output */
DPRINTF( "_DebugOutput: %s %04X %s\n",
caller, flags, debugstr_an(temp, sizeof(temp)) );
}
......@@ -735,7 +735,7 @@ static DWORD MCI_HandleReturnValues(LPWINE_MM_IDATA iData, DWORD dwRet,
switch (dwRet & 0xFFFF0000ul) {
case 0:
case MCI_INTEGER_RETURNED:
wsnprintfA(lpstrRet, uRetLen, "%ld", data[1]);
snprintf(lpstrRet, uRetLen, "%ld", data[1]);
break;
case MCI_RESOURCE_RETURNED:
/* return string which ID is HIWORD(data[1]),
......@@ -749,12 +749,12 @@ static DWORD MCI_HandleReturnValues(LPWINE_MM_IDATA iData, DWORD dwRet,
LoadStringA(wmd->hDrv, HIWORD(data[1]), lpstrRet, uRetLen);
break;
case MCI_COLONIZED3_RETURN:
wsnprintfA(lpstrRet, uRetLen, "%d:%d:%d",
snprintf(lpstrRet, uRetLen, "%d:%d:%d",
LOBYTE(LOWORD(data[1])), HIBYTE(LOWORD(data[1])),
LOBYTE(HIWORD(data[1])));
break;
case MCI_COLONIZED4_RETURN:
wsnprintfA(lpstrRet, uRetLen, "%d:%d:%d:%d",
snprintf(lpstrRet, uRetLen, "%d:%d:%d:%d",
LOBYTE(LOWORD(data[1])), HIBYTE(LOWORD(data[1])),
LOBYTE(HIWORD(data[1])), HIBYTE(HIWORD(data[1])));
break;
......@@ -768,7 +768,7 @@ static DWORD MCI_HandleReturnValues(LPWINE_MM_IDATA iData, DWORD dwRet,
break;
case MCI_INTEGER_RETURNED:
data[1] = *(LPDWORD)lpstrRet;
wsnprintfA(lpstrRet, uRetLen, "%ld", data[1]);
snprintf(lpstrRet, uRetLen, "%ld", data[1]);
break;
default:
WARN("Oooch. MCI_STRING and HIWORD(dwRet)=%04x\n", HIWORD(dwRet));
......@@ -778,7 +778,7 @@ static DWORD MCI_HandleReturnValues(LPWINE_MM_IDATA iData, DWORD dwRet,
case MCI_RECT:
if (dwRet & 0xFFFF0000ul)
WARN("Oooch. MCI_STRING and HIWORD(dwRet)=%04x\n", HIWORD(dwRet));
wsnprintfA(lpstrRet, uRetLen, "%ld %ld %ld %ld",
snprintf(lpstrRet, uRetLen, "%ld %ld %ld %ld",
data[1], data[2], data[3], data[4]);
break;
default: ERR("oops\n");
......
......@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = winspool.drv
SOVERSION = 1.0
IMPORTS = gdi32 advapi32 kernel32 ntdll
IMPORTS = user32 gdi32 advapi32 kernel32 ntdll
C_SRCS = \
info.c \
......
......@@ -3,6 +3,7 @@ type win32
file winspool.drv
init WINSPOOL_EntryPoint
import user32.dll
import gdi32.dll
import advapi32.dll
import kernel32.dll
......
......@@ -590,8 +590,6 @@ FARPROC16 WINAPI SetWindowsHook16(INT16,HOOKPROC16);
HHOOK WINAPI SetWindowsHookEx16(INT16,HOOKPROC16,HINSTANCE16,HTASK16);
BOOL16 WINAPI UnhookWindowsHook16(INT16,HOOKPROC16);
BOOL16 WINAPI UnhookWindowsHookEx16(HHOOK);
INT16 WINAPIV wsnprintf16(LPSTR,UINT16,LPCSTR,...);
INT16 WINAPIV wsprintf16(LPSTR,LPCSTR,...);
INT16 WINAPI wvsnprintf16(LPSTR,UINT16,LPCSTR,LPCVOID);
VOID WINAPI CalcChildScroll16(HWND16,WORD);
VOID WINAPI CascadeChildWindows16(HWND16,WORD);
......
......@@ -3780,9 +3780,6 @@ HRESULT WINAPI PrivateExtractIconsW(LPCWSTR,INT,DWORD,DWORD,HICON*,DWORD,UIN
/* Extra functions that don't exist in the Windows API */
HPEN WINAPI GetSysColorPen(INT);
INT WINAPIV wsnprintfA(LPSTR,UINT,LPCSTR,...);
INT WINAPIV wsnprintfW(LPWSTR,UINT,LPCWSTR,...);
#define wsnprintf WINELIB_NAME_AW(wsnprintf)
INT WINAPI wvsnprintfA(LPSTR,UINT,LPCSTR,va_list);
INT WINAPI wvsnprintfW(LPWSTR,UINT,LPCWSTR,va_list);
#define wvsnprintf WINELIB_NAME_AW(wvsnprintf)
......
......@@ -17,8 +17,7 @@ C_SRCS = \
registry.c \
system.c \
tweak.c \
version.c \
wsprintf.c
version.c
all: $(MODULE).o
......
......@@ -2,6 +2,7 @@
* BIOS interrupt 11h handler
*/
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
......@@ -58,12 +59,12 @@ void WINAPI INT_Int11Handler( CONTEXT86 *context )
{
char temp[16],name[16];
wsprintfA(name,"COM%d",x+1);
sprintf(name,"COM%d",x+1);
PROFILE_GetWineIniString("serialports",name,"*",temp,sizeof temp);
if(strcmp(temp,"*"))
serialports++;
wsprintfA(name,"LPT%d",x+1);
sprintf(name,"LPT%d",x+1);
PROFILE_GetWineIniString("parallelports",name,"*",temp,sizeof temp);
if(strcmp(temp,"*"))
parallelports++;
......
......@@ -581,7 +581,7 @@ INT WINAPI GetLocaleInfoW(LCID lcid,LCTYPE LCType,LPWSTR wbuf,INT len)
wlen = GetLocaleInfoA(lcid, LCType, abuf, len);
if (wlen && len) /* if len=0 return only the length*/
lstrcpynAtoW(wbuf,abuf,len);
MultiByteToWideChar( CP_ACP, 0, abuf, -1, wbuf, len );
HeapFree(GetProcessHeap(),0,abuf);
return wlen;
......@@ -2799,6 +2799,7 @@ static INT OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
INT inpos, outpos;
int count, type=0, inquote;
int Overflow; /* loop check */
char tmp[16];
WCHAR buf[40];
int buflen=0;
WCHAR arg0[] = {0}, arg1[] = {'%','d',0};
......@@ -2862,8 +2863,10 @@ static INT OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
(count==2 && type =='m') ||
(count==2 && type =='s') ||
(count==2 && type =='t') ) ) {
if (type == 'd') {
if (count == 3) {
switch(type)
{
case 'd':
if (count == 4) {
GetLocaleInfoW(locale,
LOCALE_SDAYNAME1 + (xtime->wDayOfWeek +6)%7,
buf, sizeof(buf)/sizeof(WCHAR) );
......@@ -2873,9 +2876,12 @@ static INT OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
(xtime->wDayOfWeek +6)%7,
buf, sizeof(buf)/sizeof(WCHAR) );
} else {
wsnprintfW(buf, 5, argarr[count], xtime->wDay );
};
} else if (type == 'M') {
sprintf( tmp, "%.*d", count, xtime->wDay );
MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
}
break;
case 'M':
if (count == 4) {
GetLocaleInfoW(locale, LOCALE_SMONTHNAME1 +
xtime->wMonth -1, buf,
......@@ -2885,47 +2891,62 @@ static INT OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
xtime->wMonth -1, buf,
sizeof(buf)/sizeof(WCHAR) );
} else {
wsnprintfW(buf, 5, argarr[count], xtime->wMonth);
sprintf( tmp, "%.*d", count, xtime->wMonth );
MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
}
} else if (type == 'y') {
break;
case 'y':
if (count == 4) {
wsnprintfW(buf, 6, argarr[1] /* "%d" */,
xtime->wYear);
sprintf( tmp, "%d", xtime->wYear );
} else if (count == 3) {
lstrcpynAtoW(buf, "yyy", 5);
strcpy( tmp, "yyy" );
} else {
wsnprintfW(buf, 6, argarr[count],
xtime->wYear % 100);
sprintf( tmp, "%.*d", count, xtime->wYear % 100 );
}
} else if (type == 'g') {
MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
break;
case 'g':
if (count == 2) {
FIXME("LOCALE_ICALENDARTYPE unimplemented\n");
lstrcpynAtoW(buf, "AD", 5);
strcpy( tmp, "AD" );
} else {
/* Win API sez we copy it verbatim */
lstrcpynAtoW(buf, "g", 5);
strcpy( tmp, "g" );
}
} else if (type == 'h') {
/* hours 1:00-12:00 --- is this right? */
wsnprintfW(buf, 5, argarr[count],
(xtime->wHour-1)%12 +1);
} else if (type == 'H') {
wsnprintfW(buf, 5, argarr[count],
xtime->wHour);
} else if (type == 'm' ) {
wsnprintfW(buf, 5, argarr[count],
xtime->wMinute);
} else if (type == 's' ) {
wsnprintfW(buf, 5, argarr[count],
xtime->wSecond);
} else if (type == 't') {
MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
break;
case 'h':
/* hours 1:00-12:00 --- is this right? */
sprintf( tmp, "%.*d", count, (xtime->wHour-1)%12 +1);
MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
break;
case 'H':
sprintf( tmp, "%.*d", count, xtime->wHour );
MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
break;
case 'm':
sprintf( tmp, "%.*d", count, xtime->wMinute );
MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
break;
case 's':
sprintf( tmp, "%.*d", count, xtime->wSecond );
MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
break;
case 't':
GetLocaleInfoW(locale, (xtime->wHour < 12) ?
LOCALE_S1159 : LOCALE_S2359,
buf, sizeof(buf) );
if (count == 1) {
buf[1] = 0;
}
}
break;
}
/* no matter what happened, we need to check this next
character the next time we loop through */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment