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.
10 #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
12 #include "mono/metadata/mono-security-windows-internals.h"
15 ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (void)
18 mono_error_init (&mono_error);
20 g_unsupported_api ("OpenThreadToken, OpenProcessToken");
22 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "OpenThreadToken, OpenProcessToken");
23 mono_error_set_pending_exception (&mono_error);
25 SetLastError (ERROR_NOT_SUPPORTED);
31 ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token)
34 mono_error_init (&mono_error);
36 g_unsupported_api ("GetTokenInformation");
38 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetTokenInformation");
39 mono_error_set_pending_exception (&mono_error);
41 SetLastError (ERROR_NOT_SUPPORTED);
47 ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token)
50 mono_error_init (&mono_error);
52 g_unsupported_api ("DuplicateToken");
54 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "DuplicateToken");
55 mono_error_set_pending_exception (&mono_error);
57 SetLastError (ERROR_NOT_SUPPORTED);
63 ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token)
66 mono_error_init (&mono_error);
68 g_unsupported_api ("ImpersonateLoggedOnUser");
70 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "ImpersonateLoggedOnUser");
71 mono_error_set_pending_exception (&mono_error);
73 SetLastError (ERROR_NOT_SUPPORTED);
79 ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (void)
82 mono_error_init (&mono_error);
84 g_unsupported_api ("RevertToSelf");
86 mono_error_set_not_supported(&mono_error, G_UNSUPPORTED_API, "RevertToSelf");
87 mono_error_set_pending_exception (&mono_error);
89 SetLastError (ERROR_NOT_SUPPORTED);
95 mono_security_win_get_token_name (gpointer token, gunichar2 ** uniname)
98 mono_error_init (&mono_error);
100 g_unsupported_api ("GetTokenInformation");
102 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetTokenInformation");
103 mono_error_set_pending_exception (&mono_error);
105 SetLastError (ERROR_NOT_SUPPORTED);
111 mono_security_win_is_machine_protected (gunichar2 *path)
113 MonoError mono_error;
114 mono_error_init (&mono_error);
116 g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
118 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetNamedSecurityInfo, LocalFree");
119 mono_error_set_pending_exception (&mono_error);
121 SetLastError (ERROR_NOT_SUPPORTED);
127 mono_security_win_is_user_protected (gunichar2 *path)
129 MonoError mono_error;
130 mono_error_init (&mono_error);
132 g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
134 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetNamedSecurityInfo, LocalFree");
135 mono_error_set_pending_exception (&mono_error);
137 SetLastError (ERROR_NOT_SUPPORTED);
143 mono_security_win_protect_machine (gunichar2 *path)
145 MonoError mono_error;
146 mono_error_init (&mono_error);
148 g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
150 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
151 mono_error_set_pending_exception (&mono_error);
153 SetLastError (ERROR_NOT_SUPPORTED);
159 mono_security_win_protect_user (gunichar2 *path)
161 MonoError mono_error;
162 mono_error_init (&mono_error);
164 g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
166 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
167 mono_error_set_pending_exception (&mono_error);
169 SetLastError (ERROR_NOT_SUPPORTED);
173 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
176 // Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
177 void __mono_win32_mono_security_windows_uwp_quiet_lnk4221(void) {}
179 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */