Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mono-security-windows-uwp.c « metadata « mono - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5923fe0e99b4ab3c884a95ee0c94e35615ab751d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
 * \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 "mono/metadata/mono-security-windows-internals.h"

static void
mono_security_win_not_supported (const char *functions, MonoError *error)
{
	g_unsupported_api (functions);
	mono_error_set_not_supported (error, G_UNSUPPORTED_API, functions);
	SetLastError (ERROR_NOT_SUPPORTED);
}

gpointer
mono_security_principal_windows_identity_get_current_token (MonoError *error)
{
	// FIXME This is now supported by UWP.
	mono_security_win_not_supported ("OpenThreadToken, OpenProcessToken", error);
	return NULL;
}

gpointer
ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (MonoError *error)
{
	return mono_security_principal_windows_identity_get_current_token (error);
}

MonoArrayHandle
ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token, MonoError *error)
{
	mono_security_win_not_supported ("GetTokenInformation", error);
	return NULL_HANDLE_ARRAY;
}

gpointer
ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token, MonoError *error)
{
	// FIXME This is now supported by UWP.
	mono_security_win_not_supported ("DuplicateToken", error);
	return NULL;
}

MonoBoolean
ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token, MonoError *error)
{
	mono_security_win_not_supported ("ImpersonateLoggedOnUser", error);
	return FALSE;
}

MonoBoolean
ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (MonoError *error)
{
	mono_security_win_not_supported ("RevertToSelf", error);
	return FALSE;
}

gint32
mono_security_win_get_token_name (gpointer token, gunichar2 **uniname, MonoError *error)
{
	// FIXME This is now supported by UWP.
	mono_security_win_not_supported ("GetTokenInformation", error);
	return 0;
}

gboolean
mono_security_win_is_machine_protected (const gunichar2 *path, MonoError *error)
{
	// FIXME This is now supported by UWP.
	mono_security_win_not_supported ("GetNamedSecurityInfo, LocalFree", error);
	return FALSE;
}

gboolean
mono_security_win_is_user_protected (const gunichar2 *path, MonoError *error)
{
	// FIXME This is now supported by UWP.
	mono_security_win_not_supported ("GetNamedSecurityInfo, LocalFree", error);
	return FALSE;
}

gboolean
mono_security_win_protect_machine (const gunichar2 *path, MonoError *error)
{
	// FIXME This is now supported by UWP. Except BuildTrusteeWithSid?
	mono_security_win_not_supported ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid", error);
	return FALSE;
}

gboolean
mono_security_win_protect_user (const gunichar2 *path, MonoError *error)
{
	// FIXME This is now supported by UWP. Except BuildTrusteeWithSid?
	mono_security_win_not_supported ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree", error);
	return FALSE;
}

#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */

MONO_EMPTY_SOURCE_FILE (mono_security_windows_uwp);

#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */