Merge pull request #3766 from BrzVlad/feature-default-conc
[mono.git] / mono / metadata / icall-windows-uwp.c
1 /*
2  * icall-windows-uwp.c: UWP icall support for Mono.
3  *
4  * Copyright 2016 Microsoft
5  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
6 */
7 #include <config.h>
8 #include <glib.h>
9
10 #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
11 #include <Windows.h>
12 #include "mono/metadata/icall-windows-internals.h"
13
14 MonoString *
15 mono_icall_get_machine_name (void)
16 {
17         g_unsupported_api ("GetComputerName");
18         return mono_string_new (mono_domain_get (), "mono");
19 }
20
21 MonoString *
22 mono_icall_get_windows_folder_path (int folder)
23 {
24         g_unsupported_api ("SHGetFolderPath");
25         return mono_string_new (mono_domain_get (), "");
26 }
27
28 MonoArray *
29 mono_icall_get_logical_drives (void)
30 {
31         MonoError mono_error;
32         mono_error_init (&mono_error);
33
34         g_unsupported_api ("GetLogicalDriveStrings");
35
36         mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetLogicalDriveStrings");
37         mono_error_set_pending_exception (&mono_error);
38
39         SetLastError (ERROR_NOT_SUPPORTED);
40
41         return NULL;
42 }
43
44 void
45 mono_icall_broadcast_setting_change (void)
46 {
47         MonoError mono_error;
48         mono_error_init (&mono_error);
49
50         g_unsupported_api ("SendMessageTimeout");
51
52         mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "SendMessageTimeout");
53         mono_error_set_pending_exception (&mono_error);
54
55         SetLastError (ERROR_NOT_SUPPORTED);
56
57         return;
58 }
59
60 guint32
61 mono_icall_drive_info_get_drive_type (MonoString *root_path_name)
62 {
63         MonoError mono_error;
64         mono_error_init (&mono_error);
65
66         g_unsupported_api ("GetDriveType");
67
68         mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetDriveType");
69         mono_error_set_pending_exception (&mono_error);
70
71         return DRIVE_UNKNOWN;
72 }
73
74 gint32
75 mono_icall_wait_for_input_idle (gpointer handle, gint32 milliseconds)
76 {
77         MonoError mono_error;
78         mono_error_init (&mono_error);
79
80         g_unsupported_api ("WaitForInputIdle");
81
82         mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "WaitForInputIdle");
83         mono_error_set_pending_exception (&mono_error);
84
85         return WAIT_TIMEOUT;
86 }
87
88 MonoBoolean
89 mono_icall_get_process_working_set_size (gpointer handle, gsize *min, gsize *max)
90 {
91         MonoError mono_error;
92         mono_error_init (&mono_error);
93
94         g_unsupported_api ("GetProcessWorkingSetSize");
95
96         mono_error_set_not_supported(&mono_error, G_UNSUPPORTED_API, "GetProcessWorkingSetSize");
97         mono_error_set_pending_exception (&mono_error);
98
99         SetLastError (ERROR_NOT_SUPPORTED);
100
101         return FALSE;
102 }
103
104 MonoBoolean
105 mono_icall_set_process_working_set_size (gpointer handle, gsize min, gsize max)
106 {
107         MonoError mono_error;
108         mono_error_init (&mono_error);
109
110         g_unsupported_api ("SetProcessWorkingSetSize");
111
112         mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "SetProcessWorkingSetSize");
113         mono_error_set_pending_exception (&mono_error);
114
115         SetLastError (ERROR_NOT_SUPPORTED);
116
117         return FALSE;
118 }
119
120 gint32
121 mono_icall_get_priority_class (gpointer handle)
122 {
123         MonoError mono_error;
124         mono_error_init (&mono_error);
125
126         g_unsupported_api ("GetPriorityClass");
127
128         mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetPriorityClass");
129         mono_error_set_pending_exception (&mono_error);
130
131         SetLastError (ERROR_NOT_SUPPORTED);
132
133         return FALSE;
134 }
135
136 MonoBoolean
137 mono_icall_set_priority_class (gpointer handle, gint32 priorityClass)
138 {
139         MonoError mono_error;
140         mono_error_init (&mono_error);
141
142         g_unsupported_api ("SetPriorityClass");
143
144         mono_error_set_not_supported(&mono_error, G_UNSUPPORTED_API, "SetPriorityClass");
145         mono_error_set_pending_exception (&mono_error);
146
147         SetLastError (ERROR_NOT_SUPPORTED);
148
149         return FALSE;
150 }
151
152 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
153
154 #ifdef _MSC_VER
155 // Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
156 void __mono_win32_icall_windows_uwp_quiet_lnk4221(void) {}
157 #endif
158 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */