Commit 65bc1599 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Move the k32 kernel32->user32 helpers to thunk.c.

parent e0ce6dc3
...@@ -17,13 +17,13 @@ ...@@ -17,13 +17,13 @@
7 stdcall -noname -i386 -register VxDCall6(long) VxDCall 7 stdcall -noname -i386 -register VxDCall6(long) VxDCall
8 stdcall -noname -i386 -register VxDCall7(long) VxDCall 8 stdcall -noname -i386 -register VxDCall7(long) VxDCall
9 stdcall -noname -i386 -register VxDCall8(long) VxDCall 9 stdcall -noname -i386 -register VxDCall8(long) VxDCall
10 stdcall -noname k32CharToOemA(str ptr) 10 stdcall -noname -i386 k32CharToOemA(str ptr)
11 stdcall -noname k32CharToOemBuffA(str ptr long) 11 stdcall -noname -i386 k32CharToOemBuffA(str ptr long)
12 stdcall -noname k32OemToCharA(ptr ptr) 12 stdcall -noname -i386 k32OemToCharA(ptr ptr)
13 stdcall -noname k32OemToCharBuffA(ptr ptr long) 13 stdcall -noname -i386 k32OemToCharBuffA(ptr ptr long)
14 stdcall -noname k32LoadStringA(long long ptr long) 14 stdcall -noname -i386 k32LoadStringA(long long ptr long)
15 varargs -noname k32wsprintfA(str str) 15 varargs -noname -i386 k32wsprintfA(str str)
16 stdcall -noname k32wvsprintfA(ptr str ptr) 16 stdcall -noname -i386 k32wvsprintfA(ptr str ptr)
17 stdcall -noname -i386 -register CommonUnimpStub() 17 stdcall -noname -i386 -register CommonUnimpStub()
18 stdcall -noname GetProcessDword(long long) 18 stdcall -noname GetProcessDword(long long)
19 stub -noname ThunkTheTemplateHandle 19 stub -noname ThunkTheTemplateHandle
......
...@@ -30,116 +30,10 @@ ...@@ -30,116 +30,10 @@
#define WINE_NO_INLINE_STRING #define WINE_NO_INLINE_STRING
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "wine/winbase16.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/exception.h" #include "wine/exception.h"
static INT (WINAPI *pLoadStringA)(HINSTANCE, UINT, LPSTR, INT);
static INT (WINAPI *pwvsprintfA)(LPSTR, LPCSTR, __ms_va_list);
/***********************************************************************
* Helper for k32 family functions
*/
static void *user32_proc_address(const char *proc_name)
{
static HMODULE hUser32;
if(!hUser32) hUser32 = LoadLibraryA("user32.dll");
return GetProcAddress(hUser32, proc_name);
}
/***********************************************************************
* k32CharToOemBuffA (KERNEL32.11)
*/
BOOL WINAPI k32CharToOemBuffA(LPCSTR s, LPSTR d, DWORD len)
{
WCHAR *bufW;
if ((bufW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
{
MultiByteToWideChar( CP_ACP, 0, s, len, bufW, len );
WideCharToMultiByte( CP_OEMCP, 0, bufW, len, d, len, NULL, NULL );
HeapFree( GetProcessHeap(), 0, bufW );
}
return TRUE;
}
/***********************************************************************
* k32CharToOemA (KERNEL32.10)
*/
BOOL WINAPI k32CharToOemA(LPCSTR s, LPSTR d)
{
if (!s || !d) return TRUE;
return k32CharToOemBuffA( s, d, strlen(s) + 1 );
}
/***********************************************************************
* k32OemToCharBuffA (KERNEL32.13)
*/
BOOL WINAPI k32OemToCharBuffA(LPCSTR s, LPSTR d, DWORD len)
{
WCHAR *bufW;
if ((bufW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
{
MultiByteToWideChar( CP_OEMCP, 0, s, len, bufW, len );
WideCharToMultiByte( CP_ACP, 0, bufW, len, d, len, NULL, NULL );
HeapFree( GetProcessHeap(), 0, bufW );
}
return TRUE;
}
/***********************************************************************
* k32OemToCharA (KERNEL32.12)
*/
BOOL WINAPI k32OemToCharA(LPCSTR s, LPSTR d)
{
return k32OemToCharBuffA( s, d, strlen(s) + 1 );
}
/**********************************************************************
* k32LoadStringA (KERNEL32.14)
*/
INT WINAPI k32LoadStringA(HINSTANCE instance, UINT resource_id,
LPSTR buffer, INT buflen)
{
if(!pLoadStringA) pLoadStringA = user32_proc_address("LoadStringA");
return pLoadStringA(instance, resource_id, buffer, buflen);
}
/***********************************************************************
* k32wvsprintfA (KERNEL32.16)
*/
INT WINAPI k32wvsprintfA(LPSTR buffer, LPCSTR spec, __ms_va_list args)
{
if(!pwvsprintfA) pwvsprintfA = user32_proc_address("wvsprintfA");
return (*pwvsprintfA)(buffer, spec, args);
}
/***********************************************************************
* k32wsprintfA (KERNEL32.15)
*/
INT WINAPIV k32wsprintfA(LPSTR buffer, LPCSTR spec, ...)
{
__ms_va_list args;
INT res;
__ms_va_start(args, spec);
res = k32wvsprintfA(buffer, spec, args);
__ms_va_end(args);
return res;
}
/*********************************************************************** /***********************************************************************
* lstrcatA (KERNEL32.@) * lstrcatA (KERNEL32.@)
* lstrcat (KERNEL32.@) * lstrcat (KERNEL32.@)
......
...@@ -2176,6 +2176,103 @@ DWORD WINAPI _KERNEL32_99(DWORD x) ...@@ -2176,6 +2176,103 @@ DWORD WINAPI _KERNEL32_99(DWORD x)
} }
/***********************************************************************
* Helper for k32 family functions
*/
static void *user32_proc_address(const char *proc_name)
{
static HMODULE hUser32;
if(!hUser32) hUser32 = LoadLibraryA("user32.dll");
return GetProcAddress(hUser32, proc_name);
}
/***********************************************************************
* k32CharToOemBuffA (KERNEL32.11)
*/
BOOL WINAPI k32CharToOemBuffA(LPCSTR s, LPSTR d, DWORD len)
{
WCHAR *bufW;
if ((bufW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
{
MultiByteToWideChar( CP_ACP, 0, s, len, bufW, len );
WideCharToMultiByte( CP_OEMCP, 0, bufW, len, d, len, NULL, NULL );
HeapFree( GetProcessHeap(), 0, bufW );
}
return TRUE;
}
/***********************************************************************
* k32CharToOemA (KERNEL32.10)
*/
BOOL WINAPI k32CharToOemA(LPCSTR s, LPSTR d)
{
if (!s || !d) return TRUE;
return k32CharToOemBuffA( s, d, strlen(s) + 1 );
}
/***********************************************************************
* k32OemToCharBuffA (KERNEL32.13)
*/
BOOL WINAPI k32OemToCharBuffA(LPCSTR s, LPSTR d, DWORD len)
{
WCHAR *bufW;
if ((bufW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
{
MultiByteToWideChar( CP_OEMCP, 0, s, len, bufW, len );
WideCharToMultiByte( CP_ACP, 0, bufW, len, d, len, NULL, NULL );
HeapFree( GetProcessHeap(), 0, bufW );
}
return TRUE;
}
/***********************************************************************
* k32OemToCharA (KERNEL32.12)
*/
BOOL WINAPI k32OemToCharA(LPCSTR s, LPSTR d)
{
return k32OemToCharBuffA( s, d, strlen(s) + 1 );
}
/**********************************************************************
* k32LoadStringA (KERNEL32.14)
*/
INT WINAPI k32LoadStringA(HINSTANCE instance, UINT resource_id,
LPSTR buffer, INT buflen)
{
static INT (WINAPI *pLoadStringA)(HINSTANCE, UINT, LPSTR, INT);
if(!pLoadStringA) pLoadStringA = user32_proc_address("LoadStringA");
return pLoadStringA(instance, resource_id, buffer, buflen);
}
/***********************************************************************
* k32wvsprintfA (KERNEL32.16)
*/
INT WINAPI k32wvsprintfA(LPSTR buffer, LPCSTR spec, __ms_va_list args)
{
static INT (WINAPI *pwvsprintfA)(LPSTR, LPCSTR, __ms_va_list);
if(!pwvsprintfA) pwvsprintfA = user32_proc_address("wvsprintfA");
return (*pwvsprintfA)(buffer, spec, args);
}
/***********************************************************************
* k32wsprintfA (KERNEL32.15)
*/
INT WINAPIV k32wsprintfA(LPSTR buffer, LPCSTR spec, ...)
{
__ms_va_list args;
INT res;
__ms_va_start(args, spec);
res = k32wvsprintfA(buffer, spec, args);
__ms_va_end(args);
return res;
}
/********************************************************************** /**********************************************************************
* Catch (KERNEL.55) * Catch (KERNEL.55)
* *
......
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