Revert some changes which don't have proper dependencies.
[mono-project.git] / mono / metadata / mono-security-windows-uwp.c
blobd6e175114fc0e4ef0b24a89ebc9588ab9abfd20b
1 /**
2 * \file
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.
7 */
8 #include <config.h>
9 #include <glib.h>
10 #include "mono/utils/mono-compiler.h"
12 #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
14 #include <windows.h>
15 #include "mono/metadata/mono-security-windows-internals.h"
17 static void
18 mono_security_win_not_supported (const char *functions, MonoError *error)
20 g_unsupported_api (functions);
21 mono_error_set_not_supported (error, G_UNSUPPORTED_API, functions);
22 SetLastError (ERROR_NOT_SUPPORTED);
25 gpointer
26 mono_security_principal_windows_identity_get_current_token (MonoError *error)
28 // FIXME This is now supported by UWP.
29 mono_security_win_not_supported ("OpenThreadToken, OpenProcessToken", error);
30 return NULL;
33 gpointer
34 ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (MonoError *error)
36 return mono_security_principal_windows_identity_get_current_token (error);
39 MonoArray*
40 ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token)
42 // FIXME This is now supported by UWP.
43 ERROR_DECL (error); // FIXMEcoop
44 mono_security_win_not_supported ("GetTokenInformation", error);
45 mono_error_set_pending_exception (error); // FIXMEcoop
46 return NULL;
49 gpointer
50 ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token, MonoError *error)
52 // FIXME This is now supported by UWP.
53 mono_security_win_not_supported ("DuplicateToken", error);
54 return NULL;
57 MonoBoolean
58 ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token, MonoError *error)
60 mono_security_win_not_supported ("ImpersonateLoggedOnUser", error);
61 return FALSE;
64 MonoBoolean
65 ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (MonoError *error)
67 mono_security_win_not_supported ("RevertToSelf", error);
68 return FALSE;
71 gint32
72 mono_security_win_get_token_name (gpointer token, gunichar2 **uniname, MonoError *error)
74 // FIXME This is now supported by UWP.
75 mono_security_win_not_supported ("GetTokenInformation", error);
76 return 0;
79 gboolean
80 mono_security_win_is_machine_protected (const gunichar2 *path, MonoError *error)
82 // FIXME This is now supported by UWP.
83 mono_security_win_not_supported ("GetNamedSecurityInfo, LocalFree", error);
84 return FALSE;
87 gboolean
88 mono_security_win_is_user_protected (const gunichar2 *path, MonoError *error)
90 // FIXME This is now supported by UWP.
91 mono_security_win_not_supported ("GetNamedSecurityInfo, LocalFree", error);
92 return FALSE;
95 gboolean
96 mono_security_win_protect_machine (const gunichar2 *path, MonoError *error)
98 // FIXME This is now supported by UWP. Except BuildTrusteeWithSid?
99 mono_security_win_not_supported ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid", error);
100 return FALSE;
103 gboolean
104 mono_security_win_protect_user (const gunichar2 *path, MonoError *error)
106 // FIXME This is now supported by UWP. Except BuildTrusteeWithSid?
107 mono_security_win_not_supported ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree", error);
108 return FALSE;
111 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
113 MONO_EMPTY_SOURCE_FILE (mono_security_windows_uwp);
115 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */