2009-11-10 20:40:03 +01:00
|
|
|
/* Avrt dll implementation
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Maarten Lankhorst
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2009-11-10 21:13:23 +01:00
|
|
|
#include "winnls.h"
|
2009-11-10 20:40:03 +01:00
|
|
|
#include "wine/debug.h"
|
2020-11-22 15:45:14 +01:00
|
|
|
#include "wine/heap.h"
|
2009-11-10 20:40:03 +01:00
|
|
|
#include "avrt.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(avrt);
|
|
|
|
|
2020-11-22 15:45:14 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE WINAPI AvSetMmThreadCharacteristicsA(const char *name, DWORD *index)
|
2009-11-10 21:13:23 +01:00
|
|
|
{
|
2020-11-22 15:45:14 +01:00
|
|
|
WCHAR *nameW = NULL;
|
2009-11-10 21:13:23 +01:00
|
|
|
HANDLE ret;
|
|
|
|
|
2020-11-22 15:45:14 +01:00
|
|
|
if (name && !(nameW = heap_strdupAW(name)))
|
2009-11-10 21:13:23 +01:00
|
|
|
{
|
2020-11-22 15:45:14 +01:00
|
|
|
SetLastError(ERROR_OUTOFMEMORY);
|
|
|
|
return NULL;
|
2009-11-10 21:13:23 +01:00
|
|
|
}
|
2020-11-22 15:45:14 +01:00
|
|
|
|
|
|
|
ret = AvSetMmThreadCharacteristicsW(nameW, index);
|
|
|
|
|
|
|
|
heap_free(nameW);
|
2009-11-10 21:13:23 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-11-22 15:45:14 +01:00
|
|
|
HANDLE WINAPI AvSetMmThreadCharacteristicsW(const WCHAR *name, DWORD *index)
|
2009-11-10 21:13:23 +01:00
|
|
|
{
|
2020-11-22 15:45:14 +01:00
|
|
|
FIXME("(%s,%p): stub\n", debugstr_w(name), index);
|
2009-11-10 21:13:23 +01:00
|
|
|
|
2020-11-22 15:45:14 +01:00
|
|
|
if (!name)
|
2009-11-10 21:13:23 +01:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_TASK_NAME);
|
|
|
|
return NULL;
|
|
|
|
}
|
2020-11-22 15:45:14 +01:00
|
|
|
|
|
|
|
if (!index)
|
2009-11-10 21:13:23 +01:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_HANDLE);
|
|
|
|
return NULL;
|
|
|
|
}
|
2020-11-22 15:45:14 +01:00
|
|
|
|
2009-11-10 21:13:23 +01:00
|
|
|
return (HANDLE)0x12345678;
|
|
|
|
}
|
|
|
|
|
2017-08-28 14:48:20 +02:00
|
|
|
BOOL WINAPI AvQuerySystemResponsiveness(HANDLE AvrtHandle, ULONG *value)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p): stub\n", AvrtHandle, value);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-11-10 21:13:23 +01:00
|
|
|
BOOL WINAPI AvRevertMmThreadCharacteristics(HANDLE AvrtHandle)
|
|
|
|
{
|
|
|
|
FIXME("(%p): stub\n", AvrtHandle);
|
2013-11-05 22:59:06 +01:00
|
|
|
return TRUE;
|
2009-11-10 21:13:23 +01:00
|
|
|
}
|
2010-02-04 13:27:09 +01:00
|
|
|
|
|
|
|
BOOL WINAPI AvSetMmThreadPriority(HANDLE AvrtHandle, AVRT_PRIORITY prio)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%u) stub\n", AvrtHandle, prio);
|
2013-11-05 22:59:06 +01:00
|
|
|
return TRUE;
|
2010-02-04 13:27:09 +01:00
|
|
|
}
|
2020-11-22 15:45:14 +01:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|