Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/dlls/avrt/main.c
4389 views
1
/* Avrt dll implementation
2
*
3
* Copyright (C) 2009 Maarten Lankhorst
4
*
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.
9
*
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.
14
*
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
18
*/
19
20
#include <stdarg.h>
21
22
#include "windef.h"
23
#include "winbase.h"
24
#include "winnls.h"
25
#include "wine/debug.h"
26
#include "avrt.h"
27
28
WINE_DEFAULT_DEBUG_CHANNEL(avrt);
29
30
static inline WCHAR *strdupAW(const char *src)
31
{
32
int len;
33
WCHAR *dst;
34
if (!src) return NULL;
35
len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
36
if ((dst = malloc(len * sizeof(*dst)))) MultiByteToWideChar(CP_ACP, 0, src, -1, dst, len);
37
return dst;
38
}
39
40
HANDLE WINAPI AvSetMmThreadCharacteristicsA(const char *name, DWORD *index)
41
{
42
WCHAR *nameW = NULL;
43
HANDLE ret;
44
45
if (name && !(nameW = strdupAW(name)))
46
{
47
SetLastError(ERROR_OUTOFMEMORY);
48
return NULL;
49
}
50
51
ret = AvSetMmThreadCharacteristicsW(nameW, index);
52
53
free(nameW);
54
return ret;
55
}
56
57
HANDLE WINAPI AvSetMmThreadCharacteristicsW(const WCHAR *name, DWORD *index)
58
{
59
FIXME("(%s,%p): stub\n", debugstr_w(name), index);
60
61
if (!name)
62
{
63
SetLastError(ERROR_INVALID_TASK_NAME);
64
return NULL;
65
}
66
67
if (!index)
68
{
69
SetLastError(ERROR_INVALID_HANDLE);
70
return NULL;
71
}
72
73
return (HANDLE)0x12345678;
74
}
75
76
BOOL WINAPI AvQuerySystemResponsiveness(HANDLE AvrtHandle, ULONG *value)
77
{
78
FIXME("(%p, %p): stub\n", AvrtHandle, value);
79
return FALSE;
80
}
81
82
BOOL WINAPI AvRevertMmThreadCharacteristics(HANDLE AvrtHandle)
83
{
84
FIXME("(%p): stub\n", AvrtHandle);
85
return TRUE;
86
}
87
88
BOOL WINAPI AvSetMmThreadPriority(HANDLE AvrtHandle, AVRT_PRIORITY prio)
89
{
90
FIXME("(%p)->(%u) stub\n", AvrtHandle, prio);
91
return TRUE;
92
}
93
94
HANDLE WINAPI AvSetMmMaxThreadCharacteristicsA(const char *task1, const char *task2, DWORD *index)
95
{
96
WCHAR *task1W = NULL, *task2W = NULL;
97
HANDLE ret;
98
99
if (task1 && !(task1W = strdupAW(task1)))
100
{
101
SetLastError(ERROR_OUTOFMEMORY);
102
return NULL;
103
}
104
105
if (task2 && !(task2W = strdupAW(task2)))
106
{
107
SetLastError(ERROR_OUTOFMEMORY);
108
return NULL;
109
}
110
111
ret = AvSetMmMaxThreadCharacteristicsW(task1W, task2W, index);
112
113
free(task2W);
114
free(task1W);
115
return ret;
116
}
117
118
HANDLE WINAPI AvSetMmMaxThreadCharacteristicsW(const WCHAR *task1, const WCHAR *task2, DWORD *index)
119
{
120
FIXME("(%s,%s,%p): stub\n", debugstr_w(task1), debugstr_w(task2), index);
121
122
if (!task1 || task2)
123
{
124
SetLastError(ERROR_INVALID_TASK_NAME);
125
return NULL;
126
}
127
128
if (!index)
129
{
130
SetLastError(ERROR_INVALID_HANDLE);
131
return NULL;
132
}
133
134
return (HANDLE)0x12345678;
135
}
136
137