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.
9 #include "mono/utils/mono-compiler.h"
11 #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
13 #include "mono/metadata/mono-security-windows-internals.h"
16 ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (void)
19 mono_error_init (&mono_error
);
21 g_unsupported_api ("OpenThreadToken, OpenProcessToken");
23 mono_error_set_not_supported (&mono_error
, G_UNSUPPORTED_API
, "OpenThreadToken, OpenProcessToken");
24 mono_error_set_pending_exception (&mono_error
);
26 SetLastError (ERROR_NOT_SUPPORTED
);
32 ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token
)
35 mono_error_init (&mono_error
);
37 g_unsupported_api ("GetTokenInformation");
39 mono_error_set_not_supported (&mono_error
, G_UNSUPPORTED_API
, "GetTokenInformation");
40 mono_error_set_pending_exception (&mono_error
);
42 SetLastError (ERROR_NOT_SUPPORTED
);
48 ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token
)
51 mono_error_init (&mono_error
);
53 g_unsupported_api ("DuplicateToken");
55 mono_error_set_not_supported (&mono_error
, G_UNSUPPORTED_API
, "DuplicateToken");
56 mono_error_set_pending_exception (&mono_error
);
58 SetLastError (ERROR_NOT_SUPPORTED
);
64 ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token
)
67 mono_error_init (&mono_error
);
69 g_unsupported_api ("ImpersonateLoggedOnUser");
71 mono_error_set_not_supported (&mono_error
, G_UNSUPPORTED_API
, "ImpersonateLoggedOnUser");
72 mono_error_set_pending_exception (&mono_error
);
74 SetLastError (ERROR_NOT_SUPPORTED
);
80 ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (void)
83 mono_error_init (&mono_error
);
85 g_unsupported_api ("RevertToSelf");
87 mono_error_set_not_supported(&mono_error
, G_UNSUPPORTED_API
, "RevertToSelf");
88 mono_error_set_pending_exception (&mono_error
);
90 SetLastError (ERROR_NOT_SUPPORTED
);
96 mono_security_win_get_token_name (gpointer token
, gunichar2
** uniname
)
99 mono_error_init (&mono_error
);
101 g_unsupported_api ("GetTokenInformation");
103 mono_error_set_not_supported (&mono_error
, G_UNSUPPORTED_API
, "GetTokenInformation");
104 mono_error_set_pending_exception (&mono_error
);
106 SetLastError (ERROR_NOT_SUPPORTED
);
112 mono_security_win_is_machine_protected (gunichar2
*path
)
114 MonoError mono_error
;
115 mono_error_init (&mono_error
);
117 g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
119 mono_error_set_not_supported (&mono_error
, G_UNSUPPORTED_API
, "GetNamedSecurityInfo, LocalFree");
120 mono_error_set_pending_exception (&mono_error
);
122 SetLastError (ERROR_NOT_SUPPORTED
);
128 mono_security_win_is_user_protected (gunichar2
*path
)
130 MonoError mono_error
;
131 mono_error_init (&mono_error
);
133 g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
135 mono_error_set_not_supported (&mono_error
, G_UNSUPPORTED_API
, "GetNamedSecurityInfo, LocalFree");
136 mono_error_set_pending_exception (&mono_error
);
138 SetLastError (ERROR_NOT_SUPPORTED
);
144 mono_security_win_protect_machine (gunichar2
*path
)
146 MonoError mono_error
;
147 mono_error_init (&mono_error
);
149 g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
151 mono_error_set_not_supported (&mono_error
, G_UNSUPPORTED_API
, "BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
152 mono_error_set_pending_exception (&mono_error
);
154 SetLastError (ERROR_NOT_SUPPORTED
);
160 mono_security_win_protect_user (gunichar2
*path
)
162 MonoError mono_error
;
163 mono_error_init (&mono_error
);
165 g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
167 mono_error_set_not_supported (&mono_error
, G_UNSUPPORTED_API
, "BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
168 mono_error_set_pending_exception (&mono_error
);
170 SetLastError (ERROR_NOT_SUPPORTED
);
174 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
176 MONO_EMPTY_SOURCE_FILE (mono_security_windows_uwp
);
177 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */