Moved wsprintf functions to dlls/user.

This commit is contained in:
Alexandre Julliard 2000-11-26 22:39:50 +00:00
parent cbbc7c3d60
commit 5b971f009a
19 changed files with 130 additions and 187 deletions

View File

@ -326,7 +326,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
DEBUG_AddSymbol(prefix, &value, NULL, SYM_WIN32 | SYM_FUNC); DEBUG_AddSymbol(prefix, &value, NULL, SYM_WIN32 | SYM_FUNC);
/* Add entry point */ /* Add entry point */
wsnprintf(buffer, sizeof(buffer), "%s.EntryPoint", prefix); snprintf(buffer, sizeof(buffer), "%s.EntryPoint", prefix);
value.addr.off = base + nth->OptionalHeader.AddressOfEntryPoint; value.addr.off = base + nth->OptionalHeader.AddressOfEntryPoint;
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC); 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)) { 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))) if (!DEBUG_READ_MEM_VERBOSE((void*)(base + pe_seg_ofs), &pe_seg, sizeof(pe_seg)))
continue; 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; value.addr.off = base + pe_seg.VirtualAddress;
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC); 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))) !DEBUG_READ_MEM_VERBOSE((void*)(base + names[i]), bufstr, sizeof(bufstr)))
continue; continue;
bufstr[sizeof(bufstr) - 1] = 0; 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]]; value.addr.off = base + (DWORD)functions[ordinals[i]];
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC); 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++) for (j = 0; j < exports.NumberOfNames; j++)
if ((ordinals[j] == i) && names[j]) break; if ((ordinals[j] == i) && names[j]) break;
if (j < exports.NumberOfNames) continue; 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]; value.addr.off = base + (DWORD)functions[i];
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC); DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
} }

View File

@ -770,7 +770,7 @@ HRESULT FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam
/* Prepend the current path */ /* Prepend the current path */
COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,lpstrCurrentDir); COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,lpstrCurrentDir);
if ((LPSTR)lParam!=NULL) 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; reqSize=strlen(lpstrCurrentDir)+1+strlen(lpstrPath)+1;
} }
else else

View File

@ -4,7 +4,6 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = crtdll MODULE = crtdll
EXTRALIBS = -lwine_unicode EXTRALIBS = -lwine_unicode
IMPORTS = ntdll
LDDLLFLAGS = @LDDLLFLAGS@ LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o SYMBOLFILE = $(MODULE).tmp.o

View File

@ -490,7 +490,7 @@ debug_channels (crtdll)
@ cdecl strtol(str ptr long) strtol @ cdecl strtol(str ptr long) strtol
@ cdecl strtoul(str ptr long) strtoul @ cdecl strtoul(str ptr long) strtoul
@ cdecl strxfrm(ptr str long) strxfrm @ cdecl strxfrm(ptr str long) strxfrm
@ varargs swprintf(wstr wstr) wsprintfW @ stub swprintf
@ stub swscanf @ stub swscanf
@ cdecl system(str) CRTDLL_system @ cdecl system(str) CRTDLL_system
@ cdecl tan(double) tan @ cdecl tan(double) tan
@ -508,7 +508,7 @@ debug_channels (crtdll)
@ stub vfwprintf @ stub vfwprintf
@ stub vprintf @ stub vprintf
@ cdecl vsprintf(ptr str ptr) vsprintf @ cdecl vsprintf(ptr str ptr) vsprintf
@ cdecl vswprintf(ptr wstr ptr) CRTDLL_vswprintf @ stub vswprintf
@ stub vwprintf @ stub vwprintf
@ forward wcscat ntdll.wcscat @ forward wcscat ntdll.wcscat
@ forward wcschr ntdll.wcschr @ forward wcschr ntdll.wcschr

View File

@ -597,15 +597,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) * longjmp (CRTDLL.426)
*/ */

View File

@ -4,10 +4,13 @@
* Copyright (C) 1999 Alexandre Julliard * Copyright (C) 1999 Alexandre Julliard
*/ */
#include <stdio.h>
#include <string.h> #include <string.h>
#include "winerror.h" #include "winerror.h"
#include "wine/winbase16.h"
#include "server.h" #include "server.h"
#include "stackframe.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(debugstr); DEFAULT_DEBUG_CHANNEL(debugstr);
@ -229,3 +232,29 @@ BOOL WINAPI IsDebuggerPresent(void)
SERVER_END_REQ; SERVER_END_REQ;
return ret; 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)) );
}

View File

@ -945,7 +945,7 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
@ cdecl -noimport strspn(str str) strspn @ cdecl -noimport strspn(str str) strspn
@ cdecl -noimport strstr(str str) strstr @ cdecl -noimport strstr(str str) strstr
@ cdecl -noimport strtol(str ptr long) strtol @ cdecl -noimport strtol(str ptr long) strtol
@ varargs swprintf(wstr wstr) wsprintfW @ stub swprintf
@ stub tan @ stub tan
@ cdecl tolower(long) tolower @ cdecl tolower(long) tolower
@ cdecl toupper(long) toupper @ cdecl toupper(long) toupper

View File

@ -20,7 +20,8 @@ C_SRCS = \
resource.c \ resource.c \
text.c \ text.c \
thunk.c \ thunk.c \
user_main.c user_main.c \
wsprintf.c
RC_SRCS = \ RC_SRCS = \
resources/display.rc \ resources/display.rc \

View File

@ -398,7 +398,7 @@ owner user32
416 pascal16 TrackPopupMenu(word word s_word s_word s_word word ptr) TrackPopupMenu16 416 pascal16 TrackPopupMenu(word word s_word s_word s_word word ptr) TrackPopupMenu16
417 pascal GetMenuCheckMarkDimensions() GetMenuCheckMarkDimensions 417 pascal GetMenuCheckMarkDimensions() GetMenuCheckMarkDimensions
418 pascal16 SetMenuItemBitmaps(word word word word word) SetMenuItemBitmaps16 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 421 pascal16 wvsprintf(ptr str ptr) wvsprintf16
422 pascal16 DlgDirSelectEx(word ptr word word) DlgDirSelectEx16 422 pascal16 DlgDirSelectEx(word ptr word word) DlgDirSelectEx16
423 pascal16 DlgDirSelectComboBoxEx(word ptr word word) DlgDirSelectComboBoxEx16 423 pascal16 DlgDirSelectComboBoxEx(word ptr word word) DlgDirSelectComboBoxEx16

View File

@ -651,3 +651,9 @@ debug_channels (accel caret class clipboard combo cursor dc ddeml dialog driver
@ stdcall GetClipboardSequenceNumber () GetClipboardSequenceNumber @ stdcall GetClipboardSequenceNumber () GetClipboardSequenceNumber
@ stdcall AllowSetForegroundWindow (long) AllowSetForegroundWindow @ stdcall AllowSetForegroundWindow (long) AllowSetForegroundWindow
@ stdcall LockSetForegroundWindow (long) LockSetForegroundWindow @ 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

View File

@ -13,11 +13,10 @@
#include "winuser.h" #include "winuser.h"
#include "ldt.h" #include "ldt.h"
#include "stackframe.h" #include "stackframe.h"
#include "module.h"
#include "global.h" #include "global.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(string) DEFAULT_DEBUG_CHANNEL(string);
#define WPRINTF_LEFTALIGN 0x0001 /* Align output on the left ('-' prefix) */ #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; res->type = WPR_SIGNED;
break; break;
case 's': case 's':
res->type = (res->flags & (WPRINTF_LONG |WPRINTF_WIDE)) res->type = (res->flags & (WPRINTF_LONG |WPRINTF_WIDE)) ? WPR_WSTRING : WPR_STRING;
? WPR_WSTRING : WPR_STRING;
break; break;
case 'S': case 'S':
res->type = (res->flags & (WPRINTF_SHORT|WPRINTF_WIDE)) res->type = (res->flags & (WPRINTF_SHORT|WPRINTF_WIDE)) ? WPR_STRING : WPR_WSTRING;
? WPR_STRING : WPR_WSTRING;
break; break;
case 'u': case 'u':
res->type = WPR_UNSIGNED; 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 ) 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) * 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 ) LPCVOID args )
{ {
WPRINTF_FORMAT format; 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_WCHAR: /* No Unicode in Win16 */
case WPR_CHAR: case WPR_CHAR:
*p= cur_arg.char_view; *p= cur_arg.char_view;
if (*p != '\0') p++; if (*p != '\0') p++;
else if (format.width > 1) *p++ = ' '; else if (format.width > 1) *p++ = ' ';
else len = 0; 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, INT WINAPI wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, va_list args )
va_list args )
{ {
WPRINTF_FORMAT format; WPRINTF_FORMAT format;
LPSTR p = buffer; LPSTR p = buffer;
@ -387,6 +383,8 @@ INT WINAPI wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec,
CHAR number[20]; CHAR number[20];
WPRINTF_DATA argData; WPRINTF_DATA argData;
TRACE("%p %u %s\n", buffer, maxlen, debugstr_a(spec));
while (*spec && (maxlen > 1)) while (*spec && (maxlen > 1))
{ {
if (*spec != '%') { *p++ = *spec++; maxlen--; continue; } if (*spec != '%') { *p++ = *spec++; maxlen--; continue; }
@ -401,13 +399,13 @@ INT WINAPI wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec,
switch(format.type) switch(format.type)
{ {
case WPR_WCHAR: case WPR_WCHAR:
*p = argData.wchar_view; *p = argData.wchar_view;
if (*p != '\0') p++; if (*p != '\0') p++;
else if (format.width > 1) *p++ = ' '; else if (format.width > 1) *p++ = ' ';
else len = 0; else len = 0;
break; break;
case WPR_CHAR: case WPR_CHAR:
*p = argData.char_view; *p = argData.char_view;
if (*p != '\0') p++; if (*p != '\0') p++;
else if (format.width > 1) *p++ = ' '; else if (format.width > 1) *p++ = ' ';
else len = 0; else len = 0;
@ -446,16 +444,15 @@ INT WINAPI wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec,
maxlen -= len; maxlen -= len;
} }
*p = 0; *p = 0;
TRACE("%s\n",buffer); TRACE("%s\n",debugstr_a(buffer));
return (maxlen > 1) ? (INT)(p - buffer) : -1; 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, INT WINAPI wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, va_list args )
va_list args )
{ {
WPRINTF_FORMAT format; WPRINTF_FORMAT format;
LPWSTR p = buffer; LPWSTR p = buffer;
@ -479,13 +476,13 @@ INT WINAPI wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec,
switch(format.type) switch(format.type)
{ {
case WPR_WCHAR: case WPR_WCHAR:
*p = argData.wchar_view; *p = argData.wchar_view;
if (*p != '\0') p++; if (*p != '\0') p++;
else if (format.width > 1) *p++ = ' '; else if (format.width > 1) *p++ = ' ';
else len = 0; else len = 0;
break; break;
case WPR_CHAR: case WPR_CHAR:
*p = argData.char_view; *p = argData.char_view;
if (*p != '\0') p++; if (*p != '\0') p++;
else if (format.width > 1) *p++ = ' '; else if (format.width > 1) *p++ = ' ';
else len = 0; else len = 0;
@ -523,6 +520,7 @@ INT WINAPI wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec,
maxlen -= len; maxlen -= len;
} }
*p = 0; *p = 0;
TRACE("%s\n",debugstr_w(buffer));
return (maxlen > 1) ? (INT)(p - buffer) : -1; 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 WINAPI wvsprintfA( LPSTR buffer, LPCSTR spec, va_list args )
{ {
INT res; INT res = wvsnprintfA( buffer, 1024, spec, args );
TRACE("for %p got:\n",buffer);
res = wvsnprintfA( buffer, 1024, spec, args );
return ( res == -1 ) ? 1024 : res; 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 WINAPI wvsprintfW( LPWSTR buffer, LPCWSTR spec, va_list args )
{ {
INT res; INT res = wvsnprintfW( buffer, 1024, spec, args );
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 );
return ( res == -1 ) ? 1024 : res; return ( res == -1 ) ? 1024 : res;
} }
@ -571,22 +561,7 @@ INT WINAPI wvsprintfW( LPWSTR buffer, LPCWSTR spec, va_list args )
/*********************************************************************** /***********************************************************************
* wsprintf16 (USER.420) * wsprintf16 (USER.420)
*/ */
/* Winelib version */ INT16 WINAPIV wsprintf16(void)
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)
{ {
VA_LIST16 valist; VA_LIST16 valist;
INT16 res; INT16 res;
@ -595,7 +570,6 @@ INT16 WINAPIV WIN16_wsprintf16(void)
VA_START16( valist ); VA_START16( valist );
buffer = VA_ARG16( valist, SEGPTR ); buffer = VA_ARG16( valist, SEGPTR );
spec = VA_ARG16( valist, SEGPTR ); spec = VA_ARG16( valist, SEGPTR );
TRACE("got:\n");
res = wvsnprintf16( (LPSTR)PTR_SEG_TO_LIN(buffer), 1024, res = wvsnprintf16( (LPSTR)PTR_SEG_TO_LIN(buffer), 1024,
(LPCSTR)PTR_SEG_TO_LIN(spec), valist ); (LPCSTR)PTR_SEG_TO_LIN(spec), valist );
VA_END16( valist ); VA_END16( valist );
@ -611,7 +585,6 @@ INT WINAPIV wsprintfA( LPSTR buffer, LPCSTR spec, ... )
va_list valist; va_list valist;
INT res; INT res;
TRACE("for %p got:\n",buffer);
va_start( valist, spec ); va_start( valist, spec );
res = wvsnprintfA( buffer, 1024, spec, valist ); res = wvsnprintfA( buffer, 1024, spec, valist );
va_end( valist ); va_end( valist );
@ -627,81 +600,8 @@ INT WINAPIV wsprintfW( LPWSTR buffer, LPCWSTR spec, ... )
va_list valist; va_list valist;
INT res; INT res;
TRACE("wsprintfW for %p\n",buffer);
va_start( valist, spec ); va_start( valist, spec );
res = wvsnprintfW( buffer, 1024, spec, valist ); res = wvsnprintfW( buffer, 1024, spec, valist );
va_end( valist ); va_end( valist );
return ( res == -1 ) ? 1024 : res; 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)) );
}

View File

@ -735,7 +735,7 @@ static DWORD MCI_HandleReturnValues(LPWINE_MM_IDATA iData, DWORD dwRet,
switch (dwRet & 0xFFFF0000ul) { switch (dwRet & 0xFFFF0000ul) {
case 0: case 0:
case MCI_INTEGER_RETURNED: case MCI_INTEGER_RETURNED:
wsnprintfA(lpstrRet, uRetLen, "%ld", data[1]); snprintf(lpstrRet, uRetLen, "%ld", data[1]);
break; break;
case MCI_RESOURCE_RETURNED: case MCI_RESOURCE_RETURNED:
/* return string which ID is HIWORD(data[1]), /* 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); LoadStringA(wmd->hDrv, HIWORD(data[1]), lpstrRet, uRetLen);
break; break;
case MCI_COLONIZED3_RETURN: 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(LOWORD(data[1])), HIBYTE(LOWORD(data[1])),
LOBYTE(HIWORD(data[1]))); LOBYTE(HIWORD(data[1])));
break; break;
case MCI_COLONIZED4_RETURN: 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(LOWORD(data[1])), HIBYTE(LOWORD(data[1])),
LOBYTE(HIWORD(data[1])), HIBYTE(HIWORD(data[1]))); LOBYTE(HIWORD(data[1])), HIBYTE(HIWORD(data[1])));
break; break;
@ -768,7 +768,7 @@ static DWORD MCI_HandleReturnValues(LPWINE_MM_IDATA iData, DWORD dwRet,
break; break;
case MCI_INTEGER_RETURNED: case MCI_INTEGER_RETURNED:
data[1] = *(LPDWORD)lpstrRet; data[1] = *(LPDWORD)lpstrRet;
wsnprintfA(lpstrRet, uRetLen, "%ld", data[1]); snprintf(lpstrRet, uRetLen, "%ld", data[1]);
break; break;
default: default:
WARN("Oooch. MCI_STRING and HIWORD(dwRet)=%04x\n", HIWORD(dwRet)); 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: case MCI_RECT:
if (dwRet & 0xFFFF0000ul) if (dwRet & 0xFFFF0000ul)
WARN("Oooch. MCI_STRING and HIWORD(dwRet)=%04x\n", HIWORD(dwRet)); 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]); data[1], data[2], data[3], data[4]);
break; break;
default: ERR("oops\n"); default: ERR("oops\n");

View File

@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = winspool.drv MODULE = winspool.drv
SOVERSION = 1.0 SOVERSION = 1.0
IMPORTS = gdi32 advapi32 kernel32 ntdll IMPORTS = user32 gdi32 advapi32 kernel32 ntdll
C_SRCS = \ C_SRCS = \
info.c \ info.c \

View File

@ -3,6 +3,7 @@ type win32
file winspool.drv file winspool.drv
init WINSPOOL_EntryPoint init WINSPOOL_EntryPoint
import user32.dll
import gdi32.dll import gdi32.dll
import advapi32.dll import advapi32.dll
import kernel32.dll import kernel32.dll

View File

@ -590,8 +590,6 @@ FARPROC16 WINAPI SetWindowsHook16(INT16,HOOKPROC16);
HHOOK WINAPI SetWindowsHookEx16(INT16,HOOKPROC16,HINSTANCE16,HTASK16); HHOOK WINAPI SetWindowsHookEx16(INT16,HOOKPROC16,HINSTANCE16,HTASK16);
BOOL16 WINAPI UnhookWindowsHook16(INT16,HOOKPROC16); BOOL16 WINAPI UnhookWindowsHook16(INT16,HOOKPROC16);
BOOL16 WINAPI UnhookWindowsHookEx16(HHOOK); BOOL16 WINAPI UnhookWindowsHookEx16(HHOOK);
INT16 WINAPIV wsnprintf16(LPSTR,UINT16,LPCSTR,...);
INT16 WINAPIV wsprintf16(LPSTR,LPCSTR,...);
INT16 WINAPI wvsnprintf16(LPSTR,UINT16,LPCSTR,LPCVOID); INT16 WINAPI wvsnprintf16(LPSTR,UINT16,LPCSTR,LPCVOID);
VOID WINAPI CalcChildScroll16(HWND16,WORD); VOID WINAPI CalcChildScroll16(HWND16,WORD);
VOID WINAPI CascadeChildWindows16(HWND16,WORD); VOID WINAPI CascadeChildWindows16(HWND16,WORD);

View File

@ -3780,9 +3780,6 @@ HRESULT WINAPI PrivateExtractIconsW(LPCWSTR,INT,DWORD,DWORD,HICON*,DWORD,UIN
/* Extra functions that don't exist in the Windows API */ /* Extra functions that don't exist in the Windows API */
HPEN WINAPI GetSysColorPen(INT); 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 wvsnprintfA(LPSTR,UINT,LPCSTR,va_list);
INT WINAPI wvsnprintfW(LPWSTR,UINT,LPCWSTR,va_list); INT WINAPI wvsnprintfW(LPWSTR,UINT,LPCWSTR,va_list);
#define wvsnprintf WINELIB_NAME_AW(wvsnprintf) #define wvsnprintf WINELIB_NAME_AW(wvsnprintf)

View File

@ -17,8 +17,7 @@ C_SRCS = \
registry.c \ registry.c \
system.c \ system.c \
tweak.c \ tweak.c \
version.c \ version.c
wsprintf.c
all: $(MODULE).o all: $(MODULE).o

View File

@ -2,6 +2,7 @@
* BIOS interrupt 11h handler * BIOS interrupt 11h handler
*/ */
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "config.h" #include "config.h"
@ -58,12 +59,12 @@ void WINAPI INT_Int11Handler( CONTEXT86 *context )
{ {
char temp[16],name[16]; char temp[16],name[16];
wsprintfA(name,"COM%d",x+1); sprintf(name,"COM%d",x+1);
PROFILE_GetWineIniString("serialports",name,"*",temp,sizeof temp); PROFILE_GetWineIniString("serialports",name,"*",temp,sizeof temp);
if(strcmp(temp,"*")) if(strcmp(temp,"*"))
serialports++; serialports++;
wsprintfA(name,"LPT%d",x+1); sprintf(name,"LPT%d",x+1);
PROFILE_GetWineIniString("parallelports",name,"*",temp,sizeof temp); PROFILE_GetWineIniString("parallelports",name,"*",temp,sizeof temp);
if(strcmp(temp,"*")) if(strcmp(temp,"*"))
parallelports++; parallelports++;

View File

@ -581,7 +581,7 @@ INT WINAPI GetLocaleInfoW(LCID lcid,LCTYPE LCType,LPWSTR wbuf,INT len)
wlen = GetLocaleInfoA(lcid, LCType, abuf, len); wlen = GetLocaleInfoA(lcid, LCType, abuf, len);
if (wlen && len) /* if len=0 return only the length*/ 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); HeapFree(GetProcessHeap(),0,abuf);
return wlen; return wlen;
@ -2799,6 +2799,7 @@ static INT OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
INT inpos, outpos; INT inpos, outpos;
int count, type=0, inquote; int count, type=0, inquote;
int Overflow; /* loop check */ int Overflow; /* loop check */
char tmp[16];
WCHAR buf[40]; WCHAR buf[40];
int buflen=0; int buflen=0;
WCHAR arg0[] = {0}, arg1[] = {'%','d',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 =='m') ||
(count==2 && type =='s') || (count==2 && type =='s') ||
(count==2 && type =='t') ) ) { (count==2 && type =='t') ) ) {
if (type == 'd') { switch(type)
if (count == 3) { {
case 'd':
if (count == 4) {
GetLocaleInfoW(locale, GetLocaleInfoW(locale,
LOCALE_SDAYNAME1 + (xtime->wDayOfWeek +6)%7, LOCALE_SDAYNAME1 + (xtime->wDayOfWeek +6)%7,
buf, sizeof(buf)/sizeof(WCHAR) ); buf, sizeof(buf)/sizeof(WCHAR) );
@ -2873,9 +2876,12 @@ static INT OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
(xtime->wDayOfWeek +6)%7, (xtime->wDayOfWeek +6)%7,
buf, sizeof(buf)/sizeof(WCHAR) ); buf, sizeof(buf)/sizeof(WCHAR) );
} else { } else {
wsnprintfW(buf, 5, argarr[count], xtime->wDay ); sprintf( tmp, "%.*d", count, xtime->wDay );
}; MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
} else if (type == 'M') { }
break;
case 'M':
if (count == 4) { if (count == 4) {
GetLocaleInfoW(locale, LOCALE_SMONTHNAME1 + GetLocaleInfoW(locale, LOCALE_SMONTHNAME1 +
xtime->wMonth -1, buf, xtime->wMonth -1, buf,
@ -2885,47 +2891,62 @@ static INT OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
xtime->wMonth -1, buf, xtime->wMonth -1, buf,
sizeof(buf)/sizeof(WCHAR) ); sizeof(buf)/sizeof(WCHAR) );
} else { } 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) { if (count == 4) {
wsnprintfW(buf, 6, argarr[1] /* "%d" */, sprintf( tmp, "%d", xtime->wYear );
xtime->wYear);
} else if (count == 3) { } else if (count == 3) {
lstrcpynAtoW(buf, "yyy", 5); strcpy( tmp, "yyy" );
} else { } else {
wsnprintfW(buf, 6, argarr[count], sprintf( tmp, "%.*d", count, xtime->wYear % 100 );
xtime->wYear % 100);
} }
} else if (type == 'g') { MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
break;
case 'g':
if (count == 2) { if (count == 2) {
FIXME("LOCALE_ICALENDARTYPE unimplemented\n"); FIXME("LOCALE_ICALENDARTYPE unimplemented\n");
lstrcpynAtoW(buf, "AD", 5); strcpy( tmp, "AD" );
} else { } else {
/* Win API sez we copy it verbatim */ /* Win API sez we copy it verbatim */
lstrcpynAtoW(buf, "g", 5); strcpy( tmp, "g" );
} }
} else if (type == 'h') { MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
/* hours 1:00-12:00 --- is this right? */ break;
wsnprintfW(buf, 5, argarr[count],
(xtime->wHour-1)%12 +1); case 'h':
} else if (type == 'H') { /* hours 1:00-12:00 --- is this right? */
wsnprintfW(buf, 5, argarr[count], sprintf( tmp, "%.*d", count, (xtime->wHour-1)%12 +1);
xtime->wHour); MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
} else if (type == 'm' ) { break;
wsnprintfW(buf, 5, argarr[count],
xtime->wMinute); case 'H':
} else if (type == 's' ) { sprintf( tmp, "%.*d", count, xtime->wHour );
wsnprintfW(buf, 5, argarr[count], MultiByteToWideChar( CP_ACP, 0, tmp, -1, buf, sizeof(buf)/sizeof(WCHAR) );
xtime->wSecond); break;
} else if (type == 't') {
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) ? GetLocaleInfoW(locale, (xtime->wHour < 12) ?
LOCALE_S1159 : LOCALE_S2359, LOCALE_S1159 : LOCALE_S2359,
buf, sizeof(buf) ); buf, sizeof(buf) );
if (count == 1) { if (count == 1) {
buf[1] = 0; buf[1] = 0;
} }
} break;
}
/* no matter what happened, we need to check this next /* no matter what happened, we need to check this next
character the next time we loop through */ character the next time we loop through */