-/*
- * mono-security-windows.c: Windows security support.
+/**
+ * \file
+ * Windows security support.
*
* Copyright 2016 Microsoft
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
}
gpointer
-ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (void)
+mono_security_principal_windows_identity_get_current_token (void)
{
gpointer token = NULL;
return token;
}
+gpointer
+ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (MonoError *error)
+{
+ error_init (error);
+ return mono_security_principal_windows_identity_get_current_token ();
+}
+
gint32
mono_security_win_get_token_name (gpointer token, gunichar2 ** uniname)
{
}
#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
-MonoString*
-ves_icall_System_Security_Principal_WindowsIdentity_GetTokenName (gpointer token)
+MonoStringHandle
+ves_icall_System_Security_Principal_WindowsIdentity_GetTokenName (gpointer token, MonoError *error)
{
- MonoError error;
- MonoString *result = NULL;
+ MonoStringHandle result;
gunichar2 *uniname = NULL;
gint32 size = 0;
- mono_error_init (&error);
+ error_init (error);
size = mono_security_win_get_token_name (token, &uniname);
if (size > 0) {
- result = mono_string_new_utf16_checked (mono_domain_get (), uniname, size, &error);
+ result = mono_string_new_utf16_handle (mono_domain_get (), uniname, size, error);
}
else
- result = mono_string_new (mono_domain_get (), "");
+ result = mono_string_new_handle (mono_domain_get (), "", error);
if (uniname)
g_free (uniname);
- mono_error_set_pending_exception (&error);
return result;
}
gpointer
-ves_icall_System_Security_Principal_WindowsIdentity_GetUserToken (MonoString *username)
+ves_icall_System_Security_Principal_WindowsIdentity_GetUserToken (MonoStringHandle username, MonoError *error)
{
+ error_init (error);
gpointer token = NULL;
/* TODO: MS has something like this working in Windows 2003 (client and
{
PSID sid = NULL;
guint32 size = 0;
- gpointer token = ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken ();
+ gpointer token = mono_security_principal_windows_identity_get_current_token ();
GetTokenInformation (token, TokenUser, NULL, size, (PDWORD)&size);
if (size > 0) {