advapi32/tests: Expand tests for performance keys.
[wine.git] / dlls / avrt / main.c
blobabcf0ab68abba049889b431bcec823b3da3ac320
1 /* Avrt dll implementation
3 * Copyright (C) 2009 Maarten Lankhorst
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include <stdarg.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winnls.h"
25 #include "wine/debug.h"
26 #include "wine/heap.h"
27 #include "avrt.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(avrt);
31 static inline WCHAR *heap_strdupAW(const char *src)
33 int len;
34 WCHAR *dst;
35 if (!src) return NULL;
36 len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
37 if ((dst = heap_alloc(len * sizeof(*dst)))) MultiByteToWideChar(CP_ACP, 0, src, -1, dst, len);
38 return dst;
41 HANDLE WINAPI AvSetMmThreadCharacteristicsA(const char *name, DWORD *index)
43 WCHAR *nameW = NULL;
44 HANDLE ret;
46 if (name && !(nameW = heap_strdupAW(name)))
48 SetLastError(ERROR_OUTOFMEMORY);
49 return NULL;
52 ret = AvSetMmThreadCharacteristicsW(nameW, index);
54 heap_free(nameW);
55 return ret;
58 HANDLE WINAPI AvSetMmThreadCharacteristicsW(const WCHAR *name, DWORD *index)
60 FIXME("(%s,%p): stub\n", debugstr_w(name), index);
62 if (!name)
64 SetLastError(ERROR_INVALID_TASK_NAME);
65 return NULL;
68 if (!index)
70 SetLastError(ERROR_INVALID_HANDLE);
71 return NULL;
74 return (HANDLE)0x12345678;
77 BOOL WINAPI AvQuerySystemResponsiveness(HANDLE AvrtHandle, ULONG *value)
79 FIXME("(%p, %p): stub\n", AvrtHandle, value);
80 return FALSE;
83 BOOL WINAPI AvRevertMmThreadCharacteristics(HANDLE AvrtHandle)
85 FIXME("(%p): stub\n", AvrtHandle);
86 return TRUE;
89 BOOL WINAPI AvSetMmThreadPriority(HANDLE AvrtHandle, AVRT_PRIORITY prio)
91 FIXME("(%p)->(%u) stub\n", AvrtHandle, prio);
92 return TRUE;
95 HANDLE WINAPI AvSetMmMaxThreadCharacteristicsA(const char *task1, const char *task2, DWORD *index)
97 WCHAR *task1W = NULL, *task2W = NULL;
98 HANDLE ret;
100 if (task1 && !(task1W = heap_strdupAW(task1)))
102 SetLastError(ERROR_OUTOFMEMORY);
103 return NULL;
106 if (task2 && !(task2W = heap_strdupAW(task2)))
108 SetLastError(ERROR_OUTOFMEMORY);
109 return NULL;
112 ret = AvSetMmMaxThreadCharacteristicsW(task1W, task2W, index);
114 heap_free(task2W);
115 heap_free(task1W);
116 return ret;
119 HANDLE WINAPI AvSetMmMaxThreadCharacteristicsW(const WCHAR *task1, const WCHAR *task2, DWORD *index)
121 FIXME("(%s,%s,%p): stub\n", debugstr_w(task1), debugstr_w(task2), index);
123 if (!task1 || task2)
125 SetLastError(ERROR_INVALID_TASK_NAME);
126 return NULL;
129 if (!index)
131 SetLastError(ERROR_INVALID_HANDLE);
132 return NULL;
135 return (HANDLE)0x12345678;