From dcd247e55f377f925d030139a47a7becc6693908 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 14 Aug 2000 17:39:15 +0000 Subject: [PATCH] Moved CharUpper* and CharLower* functions to dlls/user. --- dlls/Makefile.in | 2 +- dlls/commdlg/filedlg95.c | 3 +- dlls/user/lstr.c | 113 +++++++++++++++++++++++++++++++ dlls/wininet/Makefile.in | 2 +- dlls/wininet/wininet.spec | 1 + files/dos_fs.c | 7 +- files/profile.c | 6 +- include/ntddk.h | 4 ++ loader/ne/module.c | 2 +- misc/lstr.c | 137 -------------------------------------- misc/main.c | 14 ++-- msdos/int21.c | 10 ++- 12 files changed, 141 insertions(+), 160 deletions(-) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index e37941fd751..2dc8dacaace 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -410,7 +410,7 @@ version/libversion.so: liblz32.so libkernel32.so win32s/libw32skrnl.so: libkernel32.so winaspi/libwnaspi32.so: libkernel32.so wineps/libwineps.so: libgdi32.so libkernel32.so -wininet/libwininet.so: libkernel32.so +wininet/libwininet.so: libuser32.so libkernel32.so winmm/joystick/libjoystick.drv.so: libwinmm.so libuser32.so winmm/libwinmm.so: libuser32.so libkernel32.so winmm/mcianim/libmcianim.drv.so: libwinmm.so libuser32.so libkernel32.so diff --git a/dlls/commdlg/filedlg95.c b/dlls/commdlg/filedlg95.c index d541b61b711..b50b7b66629 100644 --- a/dlls/commdlg/filedlg95.c +++ b/dlls/commdlg/filedlg95.c @@ -25,6 +25,7 @@ #include #include "winbase.h" +#include "ntddk.h" #include "ldt.h" #include "heap.h" #include "commdlg.h" @@ -178,8 +179,6 @@ HRESULT FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPSTR lpstrFileList, UINT nFileCount, UINT sizeUsed); static BOOL BrowseSelectedFolder(HWND hwnd); -extern LPSTR _strlwr( LPSTR str ); - /*********************************************************************** * GetFileName95 * diff --git a/dlls/user/lstr.c b/dlls/user/lstr.c index 757ca8c36d7..07325a85778 100644 --- a/dlls/user/lstr.c +++ b/dlls/user/lstr.c @@ -319,6 +319,119 @@ BOOL WINAPI OemToCharW( LPCSTR s, LPWSTR d ) } +/*********************************************************************** + * CharLowerA (USER32.25) + * FIXME: handle current locale + */ +LPSTR WINAPI CharLowerA(LPSTR x) +{ + LPSTR s; + + if (HIWORD(x)) + { + s=x; + while (*s) + { + *s=tolower(*s); + s++; + } + return x; + } + else return (LPSTR)tolower((char)(int)x); +} + + +/*********************************************************************** + * CharUpperA (USER32.@) + * FIXME: handle current locale + */ +LPSTR WINAPI CharUpperA(LPSTR x) +{ + if (HIWORD(x)) + { + LPSTR s = x; + while (*s) + { + *s=toupper(*s); + s++; + } + return x; + } + return (LPSTR)toupper((char)(int)x); +} + + +/*********************************************************************** + * CharLowerW (USER32.@) + */ +LPWSTR WINAPI CharLowerW(LPWSTR x) +{ + if (HIWORD(x)) return strlwrW(x); + else return (LPWSTR)((UINT)tolowerW(LOWORD(x))); +} + + +/*********************************************************************** + * CharUpperW (USER32.@) + * FIXME: handle current locale + */ +LPWSTR WINAPI CharUpperW(LPWSTR x) +{ + if (HIWORD(x)) return struprW(x); + else return (LPWSTR)((UINT)toupperW(LOWORD(x))); +} + + +/*********************************************************************** + * CharLowerBuffA (USER32.@) + * FIXME: handle current locale + */ +DWORD WINAPI CharLowerBuffA( LPSTR str, DWORD len ) +{ + DWORD ret = len; + if (!str) return 0; /* YES */ + for (; len; len--, str++) *str = tolower(*str); + return ret; +} + + +/*********************************************************************** + * CharLowerBuffW (USER32.@) + */ +DWORD WINAPI CharLowerBuffW( LPWSTR str, DWORD len ) +{ + DWORD ret = len; + if (!str) return 0; /* YES */ + for (; len; len--, str++) *str = tolowerW(*str); + return ret; +} + + +/*********************************************************************** + * CharUpperBuffA (USER32.@) + * FIXME: handle current locale + */ +DWORD WINAPI CharUpperBuffA( LPSTR str, DWORD len ) +{ + DWORD ret = len; + if (!str) return 0; /* YES */ + for (; len; len--, str++) *str = toupper(*str); + return ret; +} + + +/*********************************************************************** + * CharUpperBuffW (USER32.@) + */ +DWORD WINAPI CharUpperBuffW( LPWSTR str, DWORD len ) +{ + DWORD ret = len; + if (!str) return 0; /* YES */ + for (; len; len--, str++) *str = toupperW(*str); + return ret; +} + + /*********************************************************************** * IsCharLowerA (USER.436) (USER32.@) * FIXME: handle current locale diff --git a/dlls/wininet/Makefile.in b/dlls/wininet/Makefile.in index cb1e1f7f0b0..4b56a259183 100644 --- a/dlls/wininet/Makefile.in +++ b/dlls/wininet/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = wininet SOVERSION = 1.0 -IMPORTS = kernel32 +IMPORTS = user32 kernel32 C_SRCS = \ http.c \ diff --git a/dlls/wininet/wininet.spec b/dlls/wininet/wininet.spec index d6442f92435..c726ddaf577 100644 --- a/dlls/wininet/wininet.spec +++ b/dlls/wininet/wininet.spec @@ -2,6 +2,7 @@ name wininet type win32 init WININET_LibMain +import user32.dll import kernel32.dll @ stub InternetInitializeAutoProxyDll diff --git a/files/dos_fs.c b/files/dos_fs.c index e6e76cd2145..95add12d1de 100644 --- a/files/dos_fs.c +++ b/files/dos_fs.c @@ -22,8 +22,7 @@ #include #include "windef.h" -#include "wingdi.h" -#include "winuser.h" +#include "ntddk.h" #include "wine/winbase16.h" #include "wine/unicode.h" #include "winerror.h" @@ -1191,7 +1190,7 @@ static DWORD DOSFS_DoGetFullPathName( LPCSTR name, DWORD len, LPSTR result, memmove(p+1,p+3,strlen(p+3)+1); } if (!(DRIVE_GetFlags(drive) & DRIVE_CASE_PRESERVING)) - CharUpperA( full_name.short_name ); + _strupr( full_name.short_name ); namelen=strlen(full_name.short_name); if (!strcmp(full_name.short_name+namelen-3,"\\..")) { @@ -1373,7 +1372,7 @@ static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAA *entry ) !(flags & DRIVE_CASE_SENSITIVE) ); lstrcpynA( entry->cFileName, long_name, sizeof(entry->cFileName) ); - if (!(flags & DRIVE_CASE_PRESERVING)) CharLowerA( entry->cFileName ); + if (!(flags & DRIVE_CASE_PRESERVING)) _strlwr( entry->cFileName ); TRACE("returning %s (%s) %02lx %ld\n", entry->cFileName, entry->cAlternateFileName, entry->dwFileAttributes, entry->nFileSizeLow ); diff --git a/files/profile.c b/files/profile.c index afbf8b0b18f..6ac5db73aef 100644 --- a/files/profile.c +++ b/files/profile.c @@ -18,8 +18,6 @@ #include "winerror.h" #include "wine/winbase16.h" #include "windef.h" -#include "wingdi.h" -#include "winuser.h" #include "winnls.h" #include "winreg.h" #include "file.h" @@ -511,7 +509,7 @@ static BOOL PROFILE_FlushFile(void) p = buffer + strlen(buffer); *p++ = '/'; strcpy( p, strrchr( CurProfile->dos_name, '\\' ) + 1 ); - CharLowerA( p ); + _strlwr( p ); file = fopen( buffer, "w" ); unix_name = buffer; } @@ -646,7 +644,7 @@ static BOOL PROFILE_Open( LPCSTR filename ) p = buffer + strlen(buffer); *p++ = '/'; strcpy( p, strrchr( newdos_name, '\\' ) + 1 ); - CharLowerA( p ); + _strlwr( p ); if ((file = fopen( buffer, "r" ))) { TRACE("(%s): found it in %s\n", diff --git a/include/ntddk.h b/include/ntddk.h index db69c7eb31a..f73b1ef5385 100644 --- a/include/ntddk.h +++ b/include/ntddk.h @@ -974,6 +974,10 @@ NTSTATUS WINAPI NtReleaseSemaphore( IN HANDLE SemaphoreHandle, IN PULONG PreviousCount); +/* string functions */ +extern LPSTR _strlwr( LPSTR str ); +extern LPSTR _strupr( LPSTR str ); + /* misc */ #if defined(__i386__) && defined(__GNUC__) diff --git a/loader/ne/module.c b/loader/ne/module.c index 46e26055b39..565db3b5e7f 100644 --- a/loader/ne/module.c +++ b/loader/ne/module.c @@ -244,7 +244,7 @@ WORD NE_GetOrdinal( HMODULE16 hModule, const char *name ) /* Now copy and uppercase the string */ strcpy( buffer, name ); - CharUpperA( buffer ); + _strupr( buffer ); len = strlen( buffer ); /* First search the resident names */ diff --git a/misc/lstr.c b/misc/lstr.c index 5e717014cfa..5e2e87d2483 100644 --- a/misc/lstr.c +++ b/misc/lstr.c @@ -29,143 +29,6 @@ DEFAULT_DEBUG_CHANNEL(resource); extern const WORD OLE2NLS_CT_CType3_LUT[]; /* FIXME: does not belong here */ -/*********************************************************************** - * CharLowerA (USER32.25) - * FIXME: handle current locale - */ -LPSTR WINAPI CharLowerA(LPSTR x) -{ - LPSTR s; - - if (HIWORD(x)) - { - s=x; - while (*s) - { - *s=tolower(*s); - s++; - } - return x; - } - else return (LPSTR)tolower((char)(int)x); -} - -/*********************************************************************** - * CharLowerBuffA (USER32.26) - * FIXME: handle current locale - */ -DWORD WINAPI CharLowerBuffA(LPSTR x,DWORD buflen) -{ - DWORD done=0; - - if (!x) return 0; /* YES */ - while (*x && (buflen--)) - { - *x=tolower(*x); - x++; - done++; - } - return done; -} - -/*********************************************************************** - * CharLowerBuffW (USER32.27) - */ -DWORD WINAPI CharLowerBuffW(LPWSTR x,DWORD buflen) -{ - DWORD done=0; - - if (!x) return 0; /* YES */ - while (*x && (buflen--)) - { - *x=tolowerW(*x); - x++; - done++; - } - return done; -} - -/*********************************************************************** - * CharLowerW (USER32.28) - * FIXME: handle current locale - */ -LPWSTR WINAPI CharLowerW(LPWSTR x) -{ - if (HIWORD(x)) - { - LPWSTR s = x; - while (*s) - { - *s = tolowerW(*s); - s++; - } - return x; - } - else return (LPWSTR)((UINT)tolowerW(LOWORD(x))); -} - -/*********************************************************************** - * CharUpperA (USER32.41) - * FIXME: handle current locale - */ -LPSTR WINAPI CharUpperA(LPSTR x) -{ - if (HIWORD(x)) - { - LPSTR s = x; - while (*s) - { - *s=toupper(*s); - s++; - } - return x; - } - return (LPSTR)toupper((char)(int)x); -} - -/*********************************************************************** - * CharUpperBuffA (USER32.42) - * FIXME: handle current locale - */ -DWORD WINAPI CharUpperBuffA( LPSTR str, DWORD len ) -{ - DWORD ret = len; - if (!str) return 0; /* YES */ - for (; len; len--, str++) *str = toupper(*str); - return ret; -} - -/*********************************************************************** - * CharUpperBuffW (USER32.43) - * FIXME: handle current locale - */ -DWORD WINAPI CharUpperBuffW( LPWSTR str, DWORD len ) -{ - DWORD ret = len; - if (!str) return 0; /* YES */ - for (; len; len--, str++) *str = toupperW(*str); - return ret; -} - -/*********************************************************************** - * CharUpperW (USER32.44) - * FIXME: handle current locale - */ -LPWSTR WINAPI CharUpperW(LPWSTR x) -{ - if (HIWORD(x)) - { - LPWSTR s = x; - while (*s) - { - *s = toupperW(*s); - s++; - } - return x; - } - else return (LPWSTR)((UINT)toupperW(LOWORD(x))); -} - /*********************************************************************** * IsCharAlphaA (USER.433) (USER32.331) * FIXME: handle current locale diff --git a/misc/main.c b/misc/main.c index 1ba0d836abc..21fe4bad2e7 100644 --- a/misc/main.c +++ b/misc/main.c @@ -16,7 +16,12 @@ # include #endif +#include "windef.h" #include "winbase.h" +#include "ntddk.h" +#include "winnls.h" +#include "winerror.h" + #include "winsock.h" #include "heap.h" #include "msdos.h" @@ -24,12 +29,7 @@ #include "debugtools.h" #include "debugdefs.h" #include "module.h" -#include "winnls.h" -#include "windef.h" -#include "wingdi.h" -#include "wine/winuser16.h" #include "tweak.h" -#include "winerror.h" /*********************************************************************** @@ -121,14 +121,14 @@ void MAIN_ParseDebugOptions( const char *arg ) while((s2 = strchr(s, ':'))) { c = *s2; *s2 = '\0'; - *((*output)+i) = CharUpperA(strdup(s)); + *((*output)+i) = _strupr(strdup(s)); *s2 = c; s = s2 + 1; i++; } c = *(options + l); *(options + l) = '\0'; - *((*output)+i) = CharUpperA(strdup(s)); + *((*output)+i) = _strupr(strdup(s)); *(options + l) = c; *((*output)+i+1) = NULL; } diff --git a/msdos/int21.c b/msdos/int21.c index ed31d7eaff0..5094487a600 100644 --- a/msdos/int21.c +++ b/msdos/int21.c @@ -20,6 +20,7 @@ #include #include "windef.h" #include "winbase.h" +#include "ntddk.h" #include "wingdi.h" #include "winuser.h" /* SW_NORMAL */ #include "wine/winbase16.h" @@ -2049,12 +2050,15 @@ void WINAPI DOS3Call( CONTEXT86 *context ) break; case 0x21: TRACE("\tconvert string to uppercase with length\n"); - CharUpperBuffA( (LPSTR)CTX_SEG_OFF_TO_LIN(context,DS_reg(context),EDX_reg(context)), - CX_reg(context) ); + { + char *ptr = (char *)CTX_SEG_OFF_TO_LIN(context,DS_reg(context),EDX_reg(context)); + WORD len = CX_reg(context); + while (len--) { *ptr = toupper(*ptr); ptr++; } + } break; case 0x22: TRACE("\tConvert ASCIIZ string to uppercase\n"); - CharUpperA( (LPSTR)CTX_SEG_OFF_TO_LIN(context,DS_reg(context),EDX_reg(context)) ); + _strupr( (LPSTR)CTX_SEG_OFF_TO_LIN(context,DS_reg(context),EDX_reg(context)) ); break; default: TRACE("\tunimplemented function %d\n",AL_reg(context));