Fix roslyn install with AOT disabled.
[mono-project.git] / mono / metadata / mono-security-windows-uwp.c
blob01549b8d3fc91347f8070f9c15c87bb2f7be990b
1 /*
2 * mono-security-windows-uwp.c: UWP security support for Mono.
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 #include "mono/utils/mono-compiler.h"
11 #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
12 #include <windows.h>
13 #include "mono/metadata/mono-security-windows-internals.h"
15 gpointer
16 ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (void)
18 MonoError mono_error;
19 mono_error_init (&mono_error);
21 g_unsupported_api ("OpenThreadToken, OpenProcessToken");
23 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "OpenThreadToken, OpenProcessToken");
24 mono_error_set_pending_exception (&mono_error);
26 SetLastError (ERROR_NOT_SUPPORTED);
28 return NULL;
31 MonoArray*
32 ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token)
34 MonoError mono_error;
35 mono_error_init (&mono_error);
37 g_unsupported_api ("GetTokenInformation");
39 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetTokenInformation");
40 mono_error_set_pending_exception (&mono_error);
42 SetLastError (ERROR_NOT_SUPPORTED);
44 return NULL;
47 gpointer
48 ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token)
50 MonoError mono_error;
51 mono_error_init (&mono_error);
53 g_unsupported_api ("DuplicateToken");
55 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "DuplicateToken");
56 mono_error_set_pending_exception (&mono_error);
58 SetLastError (ERROR_NOT_SUPPORTED);
60 return NULL;
63 gboolean
64 ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token)
66 MonoError mono_error;
67 mono_error_init (&mono_error);
69 g_unsupported_api ("ImpersonateLoggedOnUser");
71 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "ImpersonateLoggedOnUser");
72 mono_error_set_pending_exception (&mono_error);
74 SetLastError (ERROR_NOT_SUPPORTED);
76 return FALSE;
79 gboolean
80 ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (void)
82 MonoError mono_error;
83 mono_error_init (&mono_error);
85 g_unsupported_api ("RevertToSelf");
87 mono_error_set_not_supported(&mono_error, G_UNSUPPORTED_API, "RevertToSelf");
88 mono_error_set_pending_exception (&mono_error);
90 SetLastError (ERROR_NOT_SUPPORTED);
92 return FALSE;
95 gint32
96 mono_security_win_get_token_name (gpointer token, gunichar2 ** uniname)
98 MonoError mono_error;
99 mono_error_init (&mono_error);
101 g_unsupported_api ("GetTokenInformation");
103 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetTokenInformation");
104 mono_error_set_pending_exception (&mono_error);
106 SetLastError (ERROR_NOT_SUPPORTED);
108 return 0;
111 gboolean
112 mono_security_win_is_machine_protected (gunichar2 *path)
114 MonoError mono_error;
115 mono_error_init (&mono_error);
117 g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
119 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetNamedSecurityInfo, LocalFree");
120 mono_error_set_pending_exception (&mono_error);
122 SetLastError (ERROR_NOT_SUPPORTED);
124 return FALSE;
127 gboolean
128 mono_security_win_is_user_protected (gunichar2 *path)
130 MonoError mono_error;
131 mono_error_init (&mono_error);
133 g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
135 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetNamedSecurityInfo, LocalFree");
136 mono_error_set_pending_exception (&mono_error);
138 SetLastError (ERROR_NOT_SUPPORTED);
140 return FALSE;
143 gboolean
144 mono_security_win_protect_machine (gunichar2 *path)
146 MonoError mono_error;
147 mono_error_init (&mono_error);
149 g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
151 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
152 mono_error_set_pending_exception (&mono_error);
154 SetLastError (ERROR_NOT_SUPPORTED);
156 return FALSE;
159 gboolean
160 mono_security_win_protect_user (gunichar2 *path)
162 MonoError mono_error;
163 mono_error_init (&mono_error);
165 g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
167 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
168 mono_error_set_pending_exception (&mono_error);
170 SetLastError (ERROR_NOT_SUPPORTED);
172 return FALSE;
174 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
176 MONO_EMPTY_SOURCE_FILE (mono_security_windows_uwp);
177 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */