3 * UWP security support for Mono.
5 * Copyright 2016 Microsoft
6 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
10 #include "mono/utils/mono-compiler.h"
12 #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
14 #include "mono/metadata/mono-security-windows-internals.h"
17 ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (void)
20 error_init (&mono_error);
22 g_unsupported_api ("OpenThreadToken, OpenProcessToken");
24 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "OpenThreadToken, OpenProcessToken");
25 mono_error_set_pending_exception (&mono_error);
27 SetLastError (ERROR_NOT_SUPPORTED);
33 ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token)
36 error_init (&mono_error);
38 g_unsupported_api ("GetTokenInformation");
40 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetTokenInformation");
41 mono_error_set_pending_exception (&mono_error);
43 SetLastError (ERROR_NOT_SUPPORTED);
49 ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token)
52 error_init (&mono_error);
54 g_unsupported_api ("DuplicateToken");
56 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "DuplicateToken");
57 mono_error_set_pending_exception (&mono_error);
59 SetLastError (ERROR_NOT_SUPPORTED);
65 ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token)
68 error_init (&mono_error);
70 g_unsupported_api ("ImpersonateLoggedOnUser");
72 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "ImpersonateLoggedOnUser");
73 mono_error_set_pending_exception (&mono_error);
75 SetLastError (ERROR_NOT_SUPPORTED);
81 ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (void)
84 error_init (&mono_error);
86 g_unsupported_api ("RevertToSelf");
88 mono_error_set_not_supported(&mono_error, G_UNSUPPORTED_API, "RevertToSelf");
89 mono_error_set_pending_exception (&mono_error);
91 SetLastError (ERROR_NOT_SUPPORTED);
97 mono_security_win_get_token_name (gpointer token, gunichar2 ** uniname)
100 error_init (&mono_error);
102 g_unsupported_api ("GetTokenInformation");
104 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetTokenInformation");
105 mono_error_set_pending_exception (&mono_error);
107 SetLastError (ERROR_NOT_SUPPORTED);
113 mono_security_win_is_machine_protected (gunichar2 *path)
115 MonoError mono_error;
116 error_init (&mono_error);
118 g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
120 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetNamedSecurityInfo, LocalFree");
121 mono_error_set_pending_exception (&mono_error);
123 SetLastError (ERROR_NOT_SUPPORTED);
129 mono_security_win_is_user_protected (gunichar2 *path)
131 MonoError mono_error;
132 error_init (&mono_error);
134 g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
136 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetNamedSecurityInfo, LocalFree");
137 mono_error_set_pending_exception (&mono_error);
139 SetLastError (ERROR_NOT_SUPPORTED);
145 mono_security_win_protect_machine (gunichar2 *path)
147 MonoError mono_error;
148 error_init (&mono_error);
150 g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
152 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
153 mono_error_set_pending_exception (&mono_error);
155 SetLastError (ERROR_NOT_SUPPORTED);
161 mono_security_win_protect_user (gunichar2 *path)
163 MonoError mono_error;
164 error_init (&mono_error);
166 g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
168 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
169 mono_error_set_pending_exception (&mono_error);
171 SetLastError (ERROR_NOT_SUPPORTED);
175 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
177 MONO_EMPTY_SOURCE_FILE (mono_security_windows_uwp);
178 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */