Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / metadata / mono-security-windows-uwp.c
index 791e76c2f8ea7a210de4e5e203c7956bc9307244..72989994c1397eb9c775eb5a6aca8e909b5087c2 100644 (file)
@@ -1,37 +1,41 @@
-/*
- * mono-security-windows-uwp.c: UWP security support for Mono.
+/**
+ * \file
+ * UWP security support for Mono.
  *
  * Copyright 2016 Microsoft
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
 */
 #include <config.h>
 #include <glib.h>
+#include "mono/utils/mono-compiler.h"
 
 #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
+#include <windows.h>
 #include "mono/metadata/mono-security-windows-internals.h"
 
 gpointer
-ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (void)
+mono_security_principal_windows_identity_get_current_token ()
 {
-       MonoError mono_error;
-       mono_error_init (&mono_error);
-
        g_unsupported_api ("OpenThreadToken, OpenProcessToken");
 
-       mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "OpenThreadToken, OpenProcessToken");
-       mono_error_set_pending_exception (&mono_error);
-
        SetLastError (ERROR_NOT_SUPPORTED);
-
        return NULL;
 }
 
+gpointer
+ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (MonoError *error)
+{
+       error_init (error);
+
+       mono_error_set_not_supported (error, G_UNSUPPORTED_API, "OpenThreadToken, OpenProcessToken");
+       return mono_security_principal_windows_identity_get_current_token ();
+}
+
 MonoArray*
 ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetTokenInformation");
 
@@ -47,7 +51,7 @@ gpointer
 ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("DuplicateToken");
 
@@ -63,7 +67,7 @@ gboolean
 ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("ImpersonateLoggedOnUser");
 
@@ -79,7 +83,7 @@ gboolean
 ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (void)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("RevertToSelf");
 
@@ -95,7 +99,7 @@ gint32
 mono_security_win_get_token_name (gpointer token, gunichar2 ** uniname)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetTokenInformation");
 
@@ -111,7 +115,7 @@ gboolean
 mono_security_win_is_machine_protected (gunichar2 *path)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
 
@@ -127,7 +131,7 @@ gboolean
 mono_security_win_is_user_protected (gunichar2 *path)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
 
@@ -143,7 +147,7 @@ gboolean
 mono_security_win_protect_machine (gunichar2 *path)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
 
@@ -159,7 +163,7 @@ gboolean
 mono_security_win_protect_user (gunichar2 *path)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
 
@@ -172,8 +176,5 @@ mono_security_win_protect_user (gunichar2 *path)
 }
 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
 
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_mono_security_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (mono_security_windows_uwp);
 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */