Commit fed67d6e authored by Gijs Vermeulen's avatar Gijs Vermeulen Committed by Alexandre Julliard

avrt: Add AvSetMmMaxThreadCharacteristicsA/W stub.

parent 773b97bb
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
@ stub AvRtJoinThreadOrderingGroup @ stub AvRtJoinThreadOrderingGroup
@ stub AvRtLeaveThreadOrderingGroup @ stub AvRtLeaveThreadOrderingGroup
@ stub AvRtWaitOnThreadOrderingGroup @ stub AvRtWaitOnThreadOrderingGroup
@ stub AvSetMmMaxThreadCharacteristicsA @ stdcall AvSetMmMaxThreadCharacteristicsA(str str ptr)
@ stub AvSetMmMaxThreadCharacteristicsW @ stdcall AvSetMmMaxThreadCharacteristicsW(wstr wstr ptr)
@ stdcall AvSetMmThreadCharacteristicsA(str ptr) @ stdcall AvSetMmThreadCharacteristicsA(str ptr)
@ stdcall AvSetMmThreadCharacteristicsW(wstr ptr) @ stdcall AvSetMmThreadCharacteristicsW(wstr ptr)
@ stdcall AvSetMmThreadPriority(ptr long) @ stdcall AvSetMmThreadPriority(ptr long)
...@@ -23,10 +23,21 @@ ...@@ -23,10 +23,21 @@
#include "winbase.h" #include "winbase.h"
#include "winnls.h" #include "winnls.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "avrt.h" #include "avrt.h"
WINE_DEFAULT_DEBUG_CHANNEL(avrt); 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) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {
TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
...@@ -43,41 +54,39 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) ...@@ -43,41 +54,39 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE; return TRUE;
} }
HANDLE WINAPI AvSetMmThreadCharacteristicsA(LPCSTR TaskName, LPDWORD TaskIndex) HANDLE WINAPI AvSetMmThreadCharacteristicsA(const char *name, DWORD *index)
{ {
WCHAR *nameW = NULL;
HANDLE ret; HANDLE ret;
LPWSTR str = NULL;
if (TaskName) if (name && !(nameW = heap_strdupAW(name)))
{
DWORD len = (lstrlenA(TaskName)+1);
str = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
if (!str)
{ {
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return NULL; return NULL;
} }
MultiByteToWideChar(CP_ACP, 0, TaskName, len, str, len);
} ret = AvSetMmThreadCharacteristicsW(nameW, index);
ret = AvSetMmThreadCharacteristicsW(str, TaskIndex);
HeapFree(GetProcessHeap(), 0, str); heap_free(nameW);
return ret; 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); SetLastError(ERROR_INVALID_TASK_NAME);
return NULL; return NULL;
} }
if (!TaskIndex)
if (!index)
{ {
SetLastError(ERROR_INVALID_HANDLE); SetLastError(ERROR_INVALID_HANDLE);
return NULL; return NULL;
} }
return (HANDLE)0x12345678; return (HANDLE)0x12345678;
} }
...@@ -98,3 +107,46 @@ BOOL WINAPI AvSetMmThreadPriority(HANDLE AvrtHandle, AVRT_PRIORITY prio) ...@@ -98,3 +107,46 @@ BOOL WINAPI AvSetMmThreadPriority(HANDLE AvrtHandle, AVRT_PRIORITY prio)
FIXME("(%p)->(%u) stub\n", AvrtHandle, prio); FIXME("(%p)->(%u) stub\n", AvrtHandle, prio);
return TRUE; 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) ...@@ -43,7 +43,7 @@ HANDLE WINAPI AvSetMmThreadCharacteristicsW(LPCWSTR TaskName, LPDWORD TaskIndex)
#define AvSetMmThreadCharacteristics WINELIB_NAME_AW(AvSetMmThreadCharacteristics) #define AvSetMmThreadCharacteristics WINELIB_NAME_AW(AvSetMmThreadCharacteristics)
HANDLE WINAPI AvSetMmMaxThreadCharacteristicsA(LPCSTR FirstTask, LPCSTR SecondTask, LPDWORD TaskIndex); 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) #define AvSetMmMaxThreadCharacteristics WINELIB_NAME_AW(AvSetMmMaxThreadCharacteristics)
BOOL WINAPI AvRevertMmThreadCharacteristics(HANDLE AvrtHandle); BOOL WINAPI AvRevertMmThreadCharacteristics(HANDLE AvrtHandle);
......
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