diff --git a/dlls/user32/Makefile.in b/dlls/user32/Makefile.in index d420dcb45aa..2bb60140d32 100644 --- a/dlls/user32/Makefile.in +++ b/dlls/user32/Makefile.in @@ -1,7 +1,7 @@ EXTRADEFS = -D_USER32_ -D_WINABLE_ MODULE = user32.dll IMPORTLIB = user32 -IMPORTS = gdi32 version advapi32 +IMPORTS = gdi32 version advapi32 kernelbase EXTRAINCL = $(PNG_CFLAGS) DELAYIMPORTS = hid imm32 setupapi usp10 diff --git a/dlls/user32/lstr.c b/dlls/user32/lstr.c index 145a5c020d6..be5a28105b7 100644 --- a/dlls/user32/lstr.c +++ b/dlls/user32/lstr.c @@ -38,28 +38,6 @@ #include "wine/exception.h" -/*********************************************************************** - * CharNextA (USER32.@) - */ -LPSTR WINAPI CharNextA( LPCSTR ptr ) -{ - if (!*ptr) return (LPSTR)ptr; - if (IsDBCSLeadByte( ptr[0] ) && ptr[1]) return (LPSTR)(ptr + 2); - return (LPSTR)(ptr + 1); -} - - -/*********************************************************************** - * CharNextExA (USER32.@) - */ -LPSTR WINAPI CharNextExA( WORD codepage, LPCSTR ptr, DWORD flags ) -{ - if (!*ptr) return (LPSTR)ptr; - if (IsDBCSLeadByteEx( codepage, ptr[0] ) && ptr[1]) return (LPSTR)(ptr + 2); - return (LPSTR)(ptr + 1); -} - - /*********************************************************************** * CharNextExW (USER32.@) */ @@ -70,47 +48,6 @@ LPWSTR WINAPI CharNextExW( WORD codepage, LPCWSTR ptr, DWORD flags ) } -/*********************************************************************** - * CharNextW (USER32.@) - */ -LPWSTR WINAPI CharNextW(LPCWSTR x) -{ - if (*x) x++; - - return (LPWSTR)x; -} - - -/*********************************************************************** - * CharPrevA (USER32.@) - */ -LPSTR WINAPI CharPrevA( LPCSTR start, LPCSTR ptr ) -{ - while (*start && (start < ptr)) - { - LPCSTR next = CharNextA( start ); - if (next >= ptr) break; - start = next; - } - return (LPSTR)start; -} - - -/*********************************************************************** - * CharPrevExA (USER32.@) - */ -LPSTR WINAPI CharPrevExA( WORD codepage, LPCSTR start, LPCSTR ptr, DWORD flags ) -{ - while (*start && (start < ptr)) - { - LPCSTR next = CharNextExA( codepage, start, flags ); - if (next >= ptr) break; - start = next; - } - return (LPSTR)start; -} - - /*********************************************************************** * CharPrevExW (USER32.@) */ @@ -121,16 +58,6 @@ LPSTR WINAPI CharPrevExW( WORD codepage, LPCWSTR start, LPCWSTR ptr, DWORD flags } -/*********************************************************************** - * CharPrevW (USER32.@) - */ -LPWSTR WINAPI CharPrevW(LPCWSTR start,LPCWSTR x) -{ - if (x>start) return (LPWSTR)(x-1); - else return (LPWSTR)x; -} - - /*********************************************************************** * CharToOemA (USER32.@) */ @@ -231,251 +158,3 @@ BOOL WINAPI OemToCharW( LPCSTR s, LPWSTR d ) if (!s || !d) return FALSE; return OemToCharBuffW( s, d, strlen( s ) + 1 ); } - - -/*********************************************************************** - * CharLowerA (USER32.@) - */ -LPSTR WINAPI CharLowerA(LPSTR str) -{ - if (IS_INTRESOURCE(str)) - { - char ch = LOWORD(str); - CharLowerBuffA( &ch, 1 ); - return (LPSTR)(UINT_PTR)(BYTE)ch; - } - - __TRY - { - CharLowerBuffA( str, strlen(str) ); - } - __EXCEPT_PAGE_FAULT - { - SetLastError( ERROR_INVALID_PARAMETER ); - return NULL; - } - __ENDTRY - return str; -} - - -/*********************************************************************** - * CharUpperA (USER32.@) - */ -LPSTR WINAPI CharUpperA(LPSTR str) -{ - if (IS_INTRESOURCE(str)) - { - char ch = LOWORD(str); - CharUpperBuffA( &ch, 1 ); - return (LPSTR)(UINT_PTR)(BYTE)ch; - } - - __TRY - { - CharUpperBuffA( str, strlen(str) ); - } - __EXCEPT_PAGE_FAULT - { - SetLastError( ERROR_INVALID_PARAMETER ); - return NULL; - } - __ENDTRY - return str; -} - - -/*********************************************************************** - * CharLowerW (USER32.@) - */ -LPWSTR WINAPI CharLowerW( LPWSTR str ) -{ - if (!IS_INTRESOURCE( str )) - { - CharLowerBuffW( str, lstrlenW( str )); - return str; - } - else - { - WCHAR ch = LOWORD( str ); - CharLowerBuffW( &ch, 1 ); - return (LPWSTR)(UINT_PTR)ch; - } -} - - -/*********************************************************************** - * CharUpperW (USER32.@) - */ -LPWSTR WINAPI CharUpperW( LPWSTR str ) -{ - if (!IS_INTRESOURCE( str )) - { - CharUpperBuffW( str, lstrlenW( str )); - return str; - } - else - { - WCHAR ch = LOWORD( str ); - CharUpperBuffW( &ch, 1 ); - return (LPWSTR)(UINT_PTR)ch; - } -} - - -/*********************************************************************** - * CharLowerBuffA (USER32.@) - */ -DWORD WINAPI CharLowerBuffA( LPSTR str, DWORD len ) -{ - DWORD lenW; - WCHAR buffer[32]; - WCHAR *strW = buffer; - - if (!str) return 0; /* YES */ - - lenW = MultiByteToWideChar(CP_ACP, 0, str, len, NULL, 0); - if (lenW > ARRAY_SIZE(buffer)) - { - strW = HeapAlloc(GetProcessHeap(), 0, lenW * sizeof(WCHAR)); - if (!strW) return 0; - } - MultiByteToWideChar(CP_ACP, 0, str, len, strW, lenW); - CharLowerBuffW(strW, lenW); - len = WideCharToMultiByte(CP_ACP, 0, strW, lenW, str, len, NULL, NULL); - if (strW != buffer) HeapFree(GetProcessHeap(), 0, strW); - return len; -} - - -/*********************************************************************** - * CharLowerBuffW (USER32.@) - */ -DWORD WINAPI CharLowerBuffW( LPWSTR str, DWORD len ) -{ - if (!str) return 0; /* YES */ - return LCMapStringW( LOCALE_USER_DEFAULT, LCMAP_LOWERCASE, str, len, str, len ); -} - - -/*********************************************************************** - * CharUpperBuffA (USER32.@) - */ -DWORD WINAPI CharUpperBuffA( LPSTR str, DWORD len ) -{ - DWORD lenW; - WCHAR buffer[32]; - WCHAR *strW = buffer; - - if (!str) return 0; /* YES */ - - lenW = MultiByteToWideChar(CP_ACP, 0, str, len, NULL, 0); - if (lenW > ARRAY_SIZE(buffer)) - { - strW = HeapAlloc(GetProcessHeap(), 0, lenW * sizeof(WCHAR)); - if (!strW) return 0; - } - MultiByteToWideChar(CP_ACP, 0, str, len, strW, lenW); - CharUpperBuffW(strW, lenW); - len = WideCharToMultiByte(CP_ACP, 0, strW, lenW, str, len, NULL, NULL); - if (strW != buffer) HeapFree(GetProcessHeap(), 0, strW); - return len; -} - - -/*********************************************************************** - * CharUpperBuffW (USER32.@) - */ -DWORD WINAPI CharUpperBuffW( LPWSTR str, DWORD len ) -{ - if (!str) return 0; /* YES */ - return LCMapStringW( LOCALE_USER_DEFAULT, LCMAP_UPPERCASE, str, len, str, len ); -} - - -/*********************************************************************** - * IsCharLower (USER.436) - * IsCharLowerA (USER32.@) - */ -BOOL WINAPI IsCharLowerA(CHAR x) -{ - WCHAR wch; - MultiByteToWideChar(CP_ACP, 0, &x, 1, &wch, 1); - return IsCharLowerW(wch); -} - - -/*********************************************************************** - * IsCharLowerW (USER32.@) - */ -BOOL WINAPI IsCharLowerW( WCHAR ch ) -{ - WORD type; - return GetStringTypeW( CT_CTYPE1, &ch, 1, &type ) && (type & C1_LOWER); -} - - -/*********************************************************************** - * IsCharUpper (USER.435) - * IsCharUpperA (USER32.@) - */ -BOOL WINAPI IsCharUpperA(CHAR x) -{ - WCHAR wch; - MultiByteToWideChar(CP_ACP, 0, &x, 1, &wch, 1); - return IsCharUpperW(wch); -} - - -/*********************************************************************** - * IsCharUpperW (USER32.@) - */ -BOOL WINAPI IsCharUpperW( WCHAR ch ) -{ - WORD type; - return GetStringTypeW( CT_CTYPE1, &ch, 1, &type ) && (type & C1_UPPER); -} - - -/*********************************************************************** - * IsCharAlphaNumeric (USER.434) - * IsCharAlphaNumericA (USER32.@) - */ -BOOL WINAPI IsCharAlphaNumericA(CHAR x) -{ - WCHAR wch; - MultiByteToWideChar(CP_ACP, 0, &x, 1, &wch, 1); - return IsCharAlphaNumericW(wch); -} - - -/*********************************************************************** - * IsCharAlphaNumericW (USER32.@) - */ -BOOL WINAPI IsCharAlphaNumericW( WCHAR ch ) -{ - WORD type; - return GetStringTypeW( CT_CTYPE1, &ch, 1, &type ) && (type & (C1_ALPHA|C1_DIGIT)); -} - - -/*********************************************************************** - * IsCharAlpha (USER.433) - * IsCharAlphaA (USER32.@) - */ -BOOL WINAPI IsCharAlphaA(CHAR x) -{ - WCHAR wch; - MultiByteToWideChar(CP_ACP, 0, &x, 1, &wch, 1); - return IsCharAlphaW(wch); -} - - -/*********************************************************************** - * IsCharAlphaW (USER32.@) - */ -BOOL WINAPI IsCharAlphaW( WCHAR ch ) -{ - WORD type; - return GetStringTypeW( CT_CTYPE1, &ch, 1, &type ) && (type & C1_ALPHA); -} diff --git a/dlls/user32/resource.c b/dlls/user32/resource.c index 8dad3d53d57..b487f1e424e 100644 --- a/dlls/user32/resource.c +++ b/dlls/user32/resource.c @@ -312,8 +312,7 @@ INT WINAPI DECLSPEC_HOTPATCH LoadStringA( HINSTANCE instance, UINT resource_id, while (id--) p += *p + 1; - if (buflen != 1) - RtlUnicodeToMultiByteN( buffer, buflen - 1, &retval, p + 1, *p * sizeof(WCHAR) ); + RtlUnicodeToMultiByteN( buffer, buflen - 1, &retval, p + 1, *p * sizeof(WCHAR) ); } buffer[retval] = 0; TRACE("returning %s\n", debugstr_a(buffer)); diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index f9a4ae26df4..0ecceb3adf2 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -42,26 +42,26 @@ @ stdcall ChangeMenuW(long long ptr long long) @ stdcall ChangeWindowMessageFilter(long long) @ stdcall ChangeWindowMessageFilterEx(long long long ptr) -@ stdcall CharLowerA(str) -@ stdcall CharLowerBuffA(str long) -@ stdcall CharLowerBuffW(wstr long) -@ stdcall CharLowerW(wstr) -@ stdcall CharNextA(str) -@ stdcall CharNextExA(long str long) +@ stdcall -import CharLowerA(str) +@ stdcall -import CharLowerBuffA(str long) +@ stdcall -import CharLowerBuffW(wstr long) +@ stdcall -import CharLowerW(wstr) +@ stdcall -import CharNextA(str) +@ stdcall -import CharNextExA(long str long) @ stdcall CharNextExW(long wstr long) -@ stdcall CharNextW(wstr) -@ stdcall CharPrevA(str str) -@ stdcall CharPrevExA(long str str long) +@ stdcall -import CharNextW(wstr) +@ stdcall -import CharPrevA(str str) +@ stdcall -import CharPrevExA(long str str long) @ stdcall CharPrevExW(long wstr wstr long) -@ stdcall CharPrevW(wstr wstr) +@ stdcall -import CharPrevW(wstr wstr) @ stdcall CharToOemA(str ptr) @ stdcall CharToOemBuffA(str ptr long) @ stdcall CharToOemBuffW(wstr ptr long) @ stdcall CharToOemW(wstr ptr) -@ stdcall CharUpperA(str) -@ stdcall CharUpperBuffA(str long) -@ stdcall CharUpperBuffW(wstr long) -@ stdcall CharUpperW(wstr) +@ stdcall -import CharUpperA(str) +@ stdcall -import CharUpperBuffA(str long) +@ stdcall -import CharUpperBuffW(wstr long) +@ stdcall -import CharUpperW(wstr) @ stdcall CheckDlgButton(long long long) @ stdcall CheckMenuItem(long long long) @ stdcall CheckMenuRadioItem(long long long long long) @@ -449,14 +449,14 @@ @ stdcall InvalidateRect(long ptr long) @ stdcall InvalidateRgn(long long long) @ stdcall InvertRect(long ptr) -@ stdcall IsCharAlphaA(long) -@ stdcall IsCharAlphaNumericA(long) -@ stdcall IsCharAlphaNumericW(long) -@ stdcall IsCharAlphaW(long) -@ stdcall IsCharLowerA(long) -@ stdcall IsCharLowerW(long) -@ stdcall IsCharUpperA(long) -@ stdcall IsCharUpperW(long) +@ stdcall -import IsCharAlphaA(long) +@ stdcall -import IsCharAlphaNumericA(long) +@ stdcall -import IsCharAlphaNumericW(long) +@ stdcall -import IsCharAlphaW(long) +@ stdcall -import IsCharLowerA(long) +@ stdcall -import IsCharLowerW(long) +@ stdcall -import IsCharUpperA(long) +@ stdcall -import IsCharUpperW(long) @ stdcall IsChild(long long) @ stdcall IsClipboardFormatAvailable(long) @ stdcall IsDialogMessage(long ptr) IsDialogMessageA