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 mono_security_principal_windows_identity_get_current_token ()
19 g_unsupported_api ("OpenThreadToken, OpenProcessToken");
21 SetLastError (ERROR_NOT_SUPPORTED);
26 ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (MonoError *error)
30 mono_error_set_not_supported (error, G_UNSUPPORTED_API, "OpenThreadToken, OpenProcessToken");
31 return mono_security_principal_windows_identity_get_current_token ();
35 ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token)
38 error_init (&mono_error);
40 g_unsupported_api ("GetTokenInformation");
42 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetTokenInformation");
43 mono_error_set_pending_exception (&mono_error);
45 SetLastError (ERROR_NOT_SUPPORTED);
51 ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token)
54 error_init (&mono_error);
56 g_unsupported_api ("DuplicateToken");
58 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "DuplicateToken");
59 mono_error_set_pending_exception (&mono_error);
61 SetLastError (ERROR_NOT_SUPPORTED);
67 ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token)
70 error_init (&mono_error);
72 g_unsupported_api ("ImpersonateLoggedOnUser");
74 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "ImpersonateLoggedOnUser");
75 mono_error_set_pending_exception (&mono_error);
77 SetLastError (ERROR_NOT_SUPPORTED);
83 ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (void)
86 error_init (&mono_error);
88 g_unsupported_api ("RevertToSelf");
90 mono_error_set_not_supported(&mono_error, G_UNSUPPORTED_API, "RevertToSelf");
91 mono_error_set_pending_exception (&mono_error);
93 SetLastError (ERROR_NOT_SUPPORTED);
99 mono_security_win_get_token_name (gpointer token, gunichar2 ** uniname)
101 MonoError mono_error;
102 error_init (&mono_error);
104 g_unsupported_api ("GetTokenInformation");
106 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetTokenInformation");
107 mono_error_set_pending_exception (&mono_error);
109 SetLastError (ERROR_NOT_SUPPORTED);
115 mono_security_win_is_machine_protected (gunichar2 *path)
117 MonoError mono_error;
118 error_init (&mono_error);
120 g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
122 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetNamedSecurityInfo, LocalFree");
123 mono_error_set_pending_exception (&mono_error);
125 SetLastError (ERROR_NOT_SUPPORTED);
131 mono_security_win_is_user_protected (gunichar2 *path)
133 MonoError mono_error;
134 error_init (&mono_error);
136 g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
138 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetNamedSecurityInfo, LocalFree");
139 mono_error_set_pending_exception (&mono_error);
141 SetLastError (ERROR_NOT_SUPPORTED);
147 mono_security_win_protect_machine (gunichar2 *path)
149 MonoError mono_error;
150 error_init (&mono_error);
152 g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
154 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
155 mono_error_set_pending_exception (&mono_error);
157 SetLastError (ERROR_NOT_SUPPORTED);
163 mono_security_win_protect_user (gunichar2 *path)
165 MonoError mono_error;
166 error_init (&mono_error);
168 g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
170 mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
171 mono_error_set_pending_exception (&mono_error);
173 SetLastError (ERROR_NOT_SUPPORTED);
177 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
179 MONO_EMPTY_SOURCE_FILE (mono_security_windows_uwp);
180 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */