avrt: Add AvSetMmMaxThreadCharacteristicsA/W stub.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50160 Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
773b97bb2b
commit
fed67d6edd
|
@ -7,8 +7,8 @@
|
|||
@ stub AvRtJoinThreadOrderingGroup
|
||||
@ stub AvRtLeaveThreadOrderingGroup
|
||||
@ stub AvRtWaitOnThreadOrderingGroup
|
||||
@ stub AvSetMmMaxThreadCharacteristicsA
|
||||
@ stub AvSetMmMaxThreadCharacteristicsW
|
||||
@ stdcall AvSetMmMaxThreadCharacteristicsA(str str ptr)
|
||||
@ stdcall AvSetMmMaxThreadCharacteristicsW(wstr wstr ptr)
|
||||
@ stdcall AvSetMmThreadCharacteristicsA(str ptr)
|
||||
@ stdcall AvSetMmThreadCharacteristicsW(wstr ptr)
|
||||
@ stdcall AvSetMmThreadPriority(ptr long)
|
||||
|
|
|
@ -23,10 +23,21 @@
|
|||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/heap.h"
|
||||
#include "avrt.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(avrt);
|
||||
|
||||
static inline WCHAR *heap_strdupAW(const char *src)
|
||||
{
|
||||
int len;
|
||||
WCHAR *dst;
|
||||
if (!src) return NULL;
|
||||
len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
|
||||
if ((dst = heap_alloc(len * sizeof(*dst)))) MultiByteToWideChar(CP_ACP, 0, src, -1, dst, len);
|
||||
return dst;
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
|
||||
|
@ -43,41 +54,39 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
HANDLE WINAPI AvSetMmThreadCharacteristicsA(LPCSTR TaskName, LPDWORD TaskIndex)
|
||||
HANDLE WINAPI AvSetMmThreadCharacteristicsA(const char *name, DWORD *index)
|
||||
{
|
||||
WCHAR *nameW = NULL;
|
||||
HANDLE ret;
|
||||
LPWSTR str = NULL;
|
||||
|
||||
if (TaskName)
|
||||
{
|
||||
DWORD len = (lstrlenA(TaskName)+1);
|
||||
str = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
||||
if (!str)
|
||||
if (name && !(nameW = heap_strdupAW(name)))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return NULL;
|
||||
}
|
||||
MultiByteToWideChar(CP_ACP, 0, TaskName, len, str, len);
|
||||
}
|
||||
ret = AvSetMmThreadCharacteristicsW(str, TaskIndex);
|
||||
HeapFree(GetProcessHeap(), 0, str);
|
||||
|
||||
ret = AvSetMmThreadCharacteristicsW(nameW, index);
|
||||
|
||||
heap_free(nameW);
|
||||
return ret;
|
||||
}
|
||||
|
||||
HANDLE WINAPI AvSetMmThreadCharacteristicsW(LPCWSTR TaskName, LPDWORD TaskIndex)
|
||||
HANDLE WINAPI AvSetMmThreadCharacteristicsW(const WCHAR *name, DWORD *index)
|
||||
{
|
||||
FIXME("(%s,%p): stub\n", debugstr_w(TaskName), TaskIndex);
|
||||
FIXME("(%s,%p): stub\n", debugstr_w(name), index);
|
||||
|
||||
if (!TaskName)
|
||||
if (!name)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_TASK_NAME);
|
||||
return NULL;
|
||||
}
|
||||
if (!TaskIndex)
|
||||
|
||||
if (!index)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (HANDLE)0x12345678;
|
||||
}
|
||||
|
||||
|
@ -98,3 +107,46 @@ BOOL WINAPI AvSetMmThreadPriority(HANDLE AvrtHandle, AVRT_PRIORITY prio)
|
|||
FIXME("(%p)->(%u) stub\n", AvrtHandle, prio);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HANDLE WINAPI AvSetMmMaxThreadCharacteristicsA(const char *task1, const char *task2, DWORD *index)
|
||||
{
|
||||
WCHAR *task1W = NULL, *task2W = NULL;
|
||||
HANDLE ret;
|
||||
|
||||
if (task1 && !(task1W = heap_strdupAW(task1)))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (task2 && !(task2W = heap_strdupAW(task2)))
|
||||
{
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = AvSetMmMaxThreadCharacteristicsW(task1W, task2W, index);
|
||||
|
||||
heap_free(task2W);
|
||||
heap_free(task1W);
|
||||
return ret;
|
||||
}
|
||||
|
||||
HANDLE WINAPI AvSetMmMaxThreadCharacteristicsW(const WCHAR *task1, const WCHAR *task2, DWORD *index)
|
||||
{
|
||||
FIXME("(%s,%s,%p): stub\n", debugstr_w(task1), debugstr_w(task2), index);
|
||||
|
||||
if (!task1 || task2)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_TASK_NAME);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!index)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (HANDLE)0x12345678;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ HANDLE WINAPI AvSetMmThreadCharacteristicsW(LPCWSTR TaskName, LPDWORD TaskIndex)
|
|||
#define AvSetMmThreadCharacteristics WINELIB_NAME_AW(AvSetMmThreadCharacteristics)
|
||||
|
||||
HANDLE WINAPI AvSetMmMaxThreadCharacteristicsA(LPCSTR FirstTask, LPCSTR SecondTask, LPDWORD TaskIndex);
|
||||
HANDLE WINAPI AvSetMmMaxThreadCharacteristicsW(LPCSTR FirstTask, LPCSTR SecondTask, LPDWORD TaskIndex);
|
||||
HANDLE WINAPI AvSetMmMaxThreadCharacteristicsW(LPCWSTR FirstTask, LPCWSTR SecondTask, LPDWORD TaskIndex);
|
||||
#define AvSetMmMaxThreadCharacteristics WINELIB_NAME_AW(AvSetMmMaxThreadCharacteristics)
|
||||
|
||||
BOOL WINAPI AvRevertMmThreadCharacteristics(HANDLE AvrtHandle);
|
||||
|
|
Loading…
Reference in New Issue