137 lines
3.3 KiB
C
137 lines
3.3 KiB
C
/* 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"
|
|
#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;
|
|
}
|
|
|
|
HANDLE WINAPI AvSetMmThreadCharacteristicsA(const char *name, DWORD *index)
|
|
{
|
|
WCHAR *nameW = NULL;
|
|
HANDLE ret;
|
|
|
|
if (name && !(nameW = heap_strdupAW(name)))
|
|
{
|
|
SetLastError(ERROR_OUTOFMEMORY);
|
|
return NULL;
|
|
}
|
|
|
|
ret = AvSetMmThreadCharacteristicsW(nameW, index);
|
|
|
|
heap_free(nameW);
|
|
return ret;
|
|
}
|
|
|
|
HANDLE WINAPI AvSetMmThreadCharacteristicsW(const WCHAR *name, DWORD *index)
|
|
{
|
|
FIXME("(%s,%p): stub\n", debugstr_w(name), index);
|
|
|
|
if (!name)
|
|
{
|
|
SetLastError(ERROR_INVALID_TASK_NAME);
|
|
return NULL;
|
|
}
|
|
|
|
if (!index)
|
|
{
|
|
SetLastError(ERROR_INVALID_HANDLE);
|
|
return NULL;
|
|
}
|
|
|
|
return (HANDLE)0x12345678;
|
|
}
|
|
|
|
BOOL WINAPI AvQuerySystemResponsiveness(HANDLE AvrtHandle, ULONG *value)
|
|
{
|
|
FIXME("(%p, %p): stub\n", AvrtHandle, value);
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL WINAPI AvRevertMmThreadCharacteristics(HANDLE AvrtHandle)
|
|
{
|
|
FIXME("(%p): stub\n", AvrtHandle);
|
|
return TRUE;
|
|
}
|
|
|
|
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;
|
|
}
|