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)
15 #include "mono/metadata/mono-security-windows-internals.h"
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
);
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
);
34 ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (MonoError
*error
)
36 return mono_security_principal_windows_identity_get_current_token (error
);
40 ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token
, MonoError
*error
)
42 mono_security_win_not_supported ("GetTokenInformation", error
);
43 return NULL_HANDLE_ARRAY
;
47 ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token
, MonoError
*error
)
49 // FIXME This is now supported by UWP.
50 mono_security_win_not_supported ("DuplicateToken", error
);
55 ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token
, MonoError
*error
)
57 mono_security_win_not_supported ("ImpersonateLoggedOnUser", error
);
62 ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (MonoError
*error
)
64 mono_security_win_not_supported ("RevertToSelf", error
);
69 mono_security_win_get_token_name (gpointer token
, gunichar2
**uniname
, MonoError
*error
)
71 // FIXME This is now supported by UWP.
72 mono_security_win_not_supported ("GetTokenInformation", error
);
77 mono_security_win_is_machine_protected (const gunichar2
*path
, MonoError
*error
)
79 // FIXME This is now supported by UWP.
80 mono_security_win_not_supported ("GetNamedSecurityInfo, LocalFree", error
);
85 mono_security_win_is_user_protected (const gunichar2
*path
, MonoError
*error
)
87 // FIXME This is now supported by UWP.
88 mono_security_win_not_supported ("GetNamedSecurityInfo, LocalFree", error
);
93 mono_security_win_protect_machine (const gunichar2
*path
, MonoError
*error
)
95 // FIXME This is now supported by UWP. Except BuildTrusteeWithSid?
96 mono_security_win_not_supported ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid", error
);
101 mono_security_win_protect_user (const gunichar2
*path
, MonoError
*error
)
103 // FIXME This is now supported by UWP. Except BuildTrusteeWithSid?
104 mono_security_win_not_supported ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree", error
);
108 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
110 MONO_EMPTY_SOURCE_FILE (mono_security_windows_uwp
);
112 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */