Rebase against a455ff61b40ff73b48d0ccc9c1f14679bb65ab8d.

This commit is contained in:
Zebediah Figura 2020-07-20 19:55:28 -05:00
parent 26d3815d8c
commit 4373a1011e
16 changed files with 278 additions and 368 deletions

View File

@ -1,31 +1,43 @@
From 8d80506ade85cac639a732280111226f65e0aac3 Mon Sep 17 00:00:00 2001
From 1b222275e7faf71ae1e5c94e297004055ec6f82f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 4 Aug 2017 02:33:14 +0200
Subject: [PATCH] ntdll: Implement NtFilterToken.
---
dlls/ntdll/nt.c | 59 ++++++++++++++++++++++++++++++
dlls/ntdll/ntdll.spec | 2 +-
include/winnt.h | 5 +++
include/winternl.h | 1 +
server/named_pipe.c | 2 +-
server/process.c | 2 +-
server/protocol.def | 10 ++++++
server/security.h | 4 ++-
server/token.c | 84 +++++++++++++++++++++++++++++++++++++++++--
9 files changed, 163 insertions(+), 6 deletions(-)
dlls/ntdll/ntdll.spec | 2 +-
dlls/ntdll/unix/security.c | 64 +++++++++++++++++++++++++++++
include/winnt.h | 5 +++
include/winternl.h | 1 +
server/named_pipe.c | 2 +-
server/process.c | 2 +-
server/protocol.def | 10 +++++
server/security.h | 4 +-
server/token.c | 84 +++++++++++++++++++++++++++++++++++++-
9 files changed, 168 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index cc13672b2b9..443d46c71c7 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -90,6 +90,65 @@ NTSTATUS WINAPI NtDuplicateToken(
return status;
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index a3bc57716da..f604c8a3c35 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -208,7 +208,7 @@
# @ stub NtEnumerateSystemEnvironmentValuesEx
@ stdcall -syscall NtEnumerateValueKey(long long long ptr long ptr)
@ stub NtExtendSection
-# @ stub NtFilterToken
+@ stdcall -syscall NtFilterToken(long long ptr ptr ptr ptr)
@ stdcall -syscall NtFindAtom(ptr long ptr)
@ stdcall -syscall NtFlushBuffersFile(long ptr)
@ stdcall -syscall NtFlushInstructionCache(long ptr long)
diff --git a/dlls/ntdll/unix/security.c b/dlls/ntdll/unix/security.c
index daecc5e0591..d063d43d6d4 100644
--- a/dlls/ntdll/unix/security.c
+++ b/dlls/ntdll/unix/security.c
@@ -604,6 +604,70 @@ NTSTATUS WINAPI NtAdjustPrivilegesToken( HANDLE token, BOOLEAN disable, TOKEN_PR
}
+/******************************************************************************
+ * NtFilterToken [NTDLL.@]
+ * ZwFilterToken [NTDLL.@]
+/***********************************************************************
+ * NtFilterToken (NTDLL.@)
+ */
+NTSTATUS WINAPI NtFilterToken( HANDLE token, ULONG flags, TOKEN_GROUPS *disable_sids,
+ TOKEN_PRIVILEGES *privileges, TOKEN_GROUPS *restrict_sids,
@ -54,14 +66,18 @@ index cc13672b2b9..443d46c71c7 100644
+ BYTE *tmp;
+
+ for (i = 0; i < disable_sids->GroupCount; i++)
+ sids_len += RtlLengthSid( disable_sids->Groups[i].Sid );
+ {
+ SID *sid = disable_sids->Groups[i].Sid;
+ sids_len += offsetof( SID, SubAuthority[sid->SubAuthorityCount] );
+ }
+
+ sids = RtlAllocateHeap( GetProcessHeap(), 0, sids_len );
+ sids = malloc( sids_len );
+ if (!sids) return STATUS_NO_MEMORY;
+
+ for (i = 0, tmp = (BYTE *)sids; i < disable_sids->GroupCount; i++, tmp += len)
+ {
+ len = RtlLengthSid( disable_sids->Groups[i].Sid );
+ SID *sid = disable_sids->Groups[i].Sid;
+ len = offsetof( SID, SubAuthority[sid->SubAuthorityCount] );
+ memcpy( tmp, disable_sids->Groups[i].Sid, len );
+ }
+ }
@ -78,26 +94,15 @@ index cc13672b2b9..443d46c71c7 100644
+ }
+ SERVER_END_REQ;
+
+ RtlFreeHeap( GetProcessHeap(), 0, sids );
+ free( sids );
+ return status;
+}
+
/******************************************************************************
* NtOpenProcessToken [NTDLL.@]
* ZwOpenProcessToken [NTDLL.@]
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 6293dc81ed4..36f7ddbda81 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -208,7 +208,7 @@
# @ stub NtEnumerateSystemEnvironmentValuesEx
@ stdcall -syscall NtEnumerateValueKey(long long long ptr long ptr)
@ stub NtExtendSection
-# @ stub NtFilterToken
+@ stdcall NtFilterToken(long long ptr ptr ptr ptr)
@ stdcall -syscall NtFindAtom(ptr long ptr)
@ stdcall -syscall NtFlushBuffersFile(long ptr)
@ stdcall -syscall NtFlushInstructionCache(long ptr long)
+
+
/***********************************************************************
* NtPrivilegeCheck (NTDLL.@)
*/
diff --git a/include/winnt.h b/include/winnt.h
index e1cf78420a6..da17fe3e330 100644
--- a/include/winnt.h

View File

@ -1,38 +1,39 @@
From c8dc0ec6406e8449b59c219ede2e9bd88d8a56fa Mon Sep 17 00:00:00 2001
From d2e98b2054a5af671fd81ded32f2cf60a062312c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 5 Aug 2017 00:26:03 +0200
Subject: [PATCH] server: Implement token elevation information.
---
dlls/ntdll/nt.c | 16 ++++++++++++----
server/protocol.def | 8 ++++++++
server/token.c | 22 +++++++++++++++++++---
dlls/ntdll/unix/security.c | 16 ++++++++++++----
server/protocol.def | 8 ++++++++
server/token.c | 22 +++++++++++++++++++---
3 files changed, 39 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index cd271fde9c..b1dd999cf5 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -625,18 +625,26 @@ NTSTATUS WINAPI NtQueryInformationToken(
SERVER_END_REQ;
diff --git a/dlls/ntdll/unix/security.c b/dlls/ntdll/unix/security.c
index d063d43d6d4..03a81afa46e 100644
--- a/dlls/ntdll/unix/security.c
+++ b/dlls/ntdll/unix/security.c
@@ -390,19 +390,27 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE token, TOKEN_INFORMATION_CLASS c
break;
case TokenElevationType:
+ SERVER_START_REQ( get_token_elevation_type )
{
TOKEN_ELEVATION_TYPE *elevation_type = tokeninfo;
TOKEN_ELEVATION_TYPE *type = info;
- FIXME("QueryInformationToken( ..., TokenElevationType, ...) semi-stub\n");
- *elevation_type = TokenElevationTypeFull;
- *type = TokenElevationTypeFull;
+ req->handle = wine_server_obj_handle( token );
+ status = wine_server_call( req );
+ if (status == STATUS_SUCCESS)
+ *elevation_type = reply->elevation;
+ *type = reply->elevation;
}
+ SERVER_END_REQ;
break;
case TokenElevation:
+ SERVER_START_REQ( get_token_elevation_type )
{
TOKEN_ELEVATION *elevation = tokeninfo;
TOKEN_ELEVATION *elevation = info;
- FIXME("QueryInformationToken( ..., TokenElevation, ...) semi-stub\n");
- elevation->TokenIsElevated = TRUE;
+ req->handle = wine_server_obj_handle( token );
@ -42,13 +43,13 @@ index cd271fde9c..b1dd999cf5 100644
}
+ SERVER_END_REQ;
break;
case TokenSessionId:
{
diff --git a/server/protocol.def b/server/protocol.def
index 90af9df7f4..93afaabca1 100644
index ee07b1eca14..84f0b577d72 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3643,6 +3643,14 @@ struct handle_info
@@ -3566,6 +3566,14 @@ struct handle_info
@END
@ -64,10 +65,10 @@ index 90af9df7f4..93afaabca1 100644
@REQ(create_completion)
unsigned int access; /* desired access to a port */
diff --git a/server/token.c b/server/token.c
index 6d193603b4..64f20e1b57 100644
index 38a4c203d54..14343637af5 100644
--- a/server/token.c
+++ b/server/token.c
@@ -112,6 +112,7 @@ struct token
@@ -110,6 +110,7 @@ struct token
ACL *default_dacl; /* the default DACL to assign to objects created by this user */
TOKEN_SOURCE source; /* source of the token */
int impersonation_level; /* impersonation level this token is capable of if non-primary token */
@ -75,7 +76,7 @@ index 6d193603b4..64f20e1b57 100644
};
struct privilege
@@ -545,7 +546,7 @@ static struct token *create_token( unsigned primary, const SID *user,
@@ -552,7 +553,7 @@ static struct token *create_token( unsigned primary, const SID *user,
const LUID_AND_ATTRIBUTES *privs, unsigned int priv_count,
const ACL *default_dacl, TOKEN_SOURCE source,
const luid_t *modified_id,
@ -84,7 +85,7 @@ index 6d193603b4..64f20e1b57 100644
{
struct token *token = alloc_object( &token_ops );
if (token)
@@ -567,6 +568,7 @@ static struct token *create_token( unsigned primary, const SID *user,
@@ -574,6 +575,7 @@ static struct token *create_token( unsigned primary, const SID *user,
token->impersonation_level = impersonation_level;
token->default_dacl = NULL;
token->primary_group = NULL;
@ -92,7 +93,7 @@ index 6d193603b4..64f20e1b57 100644
/* copy user */
token->user = memdup( user, security_sid_len( user ));
@@ -682,7 +684,8 @@ struct token *token_duplicate( struct token *src_token, unsigned primary,
@@ -689,7 +691,8 @@ struct token *token_duplicate( struct token *src_token, unsigned primary,
token = create_token( primary, src_token->user, NULL, 0,
NULL, 0, src_token->default_dacl,
src_token->source, modified_id,
@ -102,7 +103,7 @@ index 6d193603b4..64f20e1b57 100644
if (!token) return token;
/* copy groups */
@@ -888,7 +891,7 @@ struct token *token_create_admin( void )
@@ -895,7 +898,7 @@ struct token *token_create_admin( void )
static const TOKEN_SOURCE admin_source = {"SeMgr", {0, 0}};
token = create_token( TRUE, user_sid, admin_groups, ARRAY_SIZE( admin_groups ),
admin_privs, ARRAY_SIZE( admin_privs ), default_dacl,
@ -111,7 +112,7 @@ index 6d193603b4..64f20e1b57 100644
/* we really need a primary group */
assert( token->primary_group );
}
@@ -1627,6 +1630,19 @@ DECL_HANDLER(get_token_statistics)
@@ -1634,6 +1637,19 @@ DECL_HANDLER(get_token_statistics)
}
}
@ -132,5 +133,5 @@ index 6d193603b4..64f20e1b57 100644
{
struct token *token;
--
2.19.1
2.27.0

View File

@ -1,19 +1,19 @@
From ae503e8e7eb8f4fcb9bf3e642458c2a1bba6ccaa Mon Sep 17 00:00:00 2001
From 6dc1b7d9e533379133857629bb9c09e1045a9020 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 7 Aug 2017 02:28:35 +0200
Subject: [PATCH] server: Implement token integrity level.
---
dlls/ntdll/nt.c | 23 ++++++++++++++---------
server/protocol.def | 7 +++++++
server/token.c | 30 +++++++++++++++++++++++++++---
dlls/ntdll/unix/security.c | 23 ++++++++++++++---------
server/protocol.def | 7 +++++++
server/token.c | 30 +++++++++++++++++++++++++++---
3 files changed, 48 insertions(+), 12 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index ca26ab15..8aab0a48 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -400,7 +400,7 @@ NTSTATUS WINAPI NtQueryInformationToken(
diff --git a/dlls/ntdll/unix/security.c b/dlls/ntdll/unix/security.c
index 03a81afa46e..f0057116dee 100644
--- a/dlls/ntdll/unix/security.c
+++ b/dlls/ntdll/unix/security.c
@@ -172,7 +172,7 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE token, TOKEN_INFORMATION_CLASS c
0, /* TokenAccessInformation */
0, /* TokenVirtualizationAllowed */
sizeof(DWORD), /* TokenVirtualizationEnabled */
@ -22,9 +22,9 @@ index ca26ab15..8aab0a48 100644
0, /* TokenUIAccess */
0, /* TokenMandatoryPolicy */
0, /* TokenLogonSid */
@@ -659,18 +659,23 @@ NTSTATUS WINAPI NtQueryInformationToken(
}
@@ -428,18 +428,23 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE token, TOKEN_INFORMATION_CLASS c
break;
case TokenIntegrityLevel:
+ SERVER_START_REQ( get_token_integrity )
{
@ -32,14 +32,14 @@ index ca26ab15..8aab0a48 100644
- static const SID high_level = {SID_REVISION, 1, {SECURITY_MANDATORY_LABEL_AUTHORITY},
- {SECURITY_MANDATORY_HIGH_RID}};
-
TOKEN_MANDATORY_LABEL *tml = tokeninfo;
TOKEN_MANDATORY_LABEL *tml = info;
- PSID psid = tml + 1;
+ PSID sid = tml + 1;
+ DWORD sid_len = tokeninfolength < sizeof(*tml) ? 0 : tokeninfolength - sizeof(*tml);
+ DWORD sid_len = length < sizeof(*tml) ? 0 : length - sizeof(*tml);
- tml->Label.Sid = psid;
- tml->Label.Attributes = SE_GROUP_INTEGRITY | SE_GROUP_INTEGRITY_ENABLED;
- memcpy(psid, &high_level, sizeof(SID));
- memcpy( psid, &high_level, sizeof(SID) );
+ req->handle = wine_server_obj_handle( token );
+ wine_server_set_reply( req, sid, sid_len );
+ status = wine_server_call( req );
@ -52,13 +52,13 @@ index ca26ab15..8aab0a48 100644
}
+ SERVER_END_REQ;
break;
case TokenAppContainerSid:
{
diff --git a/server/protocol.def b/server/protocol.def
index 11221d7d..1bfe3234 100644
index 84f0b577d72..4d37a0df348 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3405,6 +3405,13 @@ enum caret_state
@@ -3296,6 +3296,13 @@ enum caret_state
VARARG(sid,SID); /* the sid specified by which_sid from the token */
@END
@ -73,10 +73,10 @@ index 11221d7d..1bfe3234 100644
obj_handle_t handle; /* handle to the token */
@REPLY
diff --git a/server/token.c b/server/token.c
index ccde0c2d..2d81118a 100644
index 7c510fbdad9..d267991f751 100644
--- a/server/token.c
+++ b/server/token.c
@@ -113,6 +113,7 @@ struct token
@@ -111,6 +111,7 @@ struct token
TOKEN_SOURCE source; /* source of the token */
int impersonation_level; /* impersonation level this token is capable of if non-primary token */
TOKEN_ELEVATION_TYPE elevation; /* elevation level */
@ -84,7 +84,7 @@ index ccde0c2d..2d81118a 100644
};
struct privilege
@@ -546,7 +547,8 @@ static struct token *create_token( unsigned primary, const SID *user,
@@ -553,7 +554,8 @@ static struct token *create_token( unsigned primary, const SID *user,
const LUID_AND_ATTRIBUTES *privs, unsigned int priv_count,
const ACL *default_dacl, TOKEN_SOURCE source,
const luid_t *modified_id,
@ -94,7 +94,7 @@ index ccde0c2d..2d81118a 100644
{
struct token *token = alloc_object( &token_ops );
if (token)
@@ -630,6 +632,7 @@ static struct token *create_token( unsigned primary, const SID *user,
@@ -637,6 +639,7 @@ static struct token *create_token( unsigned primary, const SID *user,
}
token->source = source;
@ -102,7 +102,7 @@ index ccde0c2d..2d81118a 100644
}
return token;
}
@@ -685,7 +688,8 @@ struct token *token_duplicate( struct token *src_token, unsigned primary,
@@ -692,7 +695,8 @@ struct token *token_duplicate( struct token *src_token, unsigned primary,
NULL, 0, src_token->default_dacl,
src_token->source, modified_id,
impersonation_level,
@ -112,7 +112,7 @@ index ccde0c2d..2d81118a 100644
if (!token) return token;
/* copy groups */
@@ -890,7 +894,7 @@ struct token *token_create_admin( void )
@@ -898,7 +902,7 @@ struct token *token_create_admin( void )
static const TOKEN_SOURCE admin_source = {"SeMgr", {0, 0}};
token = create_token( TRUE, user_sid, admin_groups, ARRAY_SIZE( admin_groups ),
admin_privs, ARRAY_SIZE( admin_privs ), default_dacl,
@ -121,7 +121,7 @@ index ccde0c2d..2d81118a 100644
/* we really need a primary group */
assert( token->primary_group );
}
@@ -1524,6 +1528,26 @@ DECL_HANDLER(get_token_sid)
@@ -1532,6 +1536,26 @@ DECL_HANDLER(get_token_sid)
}
}
@ -149,5 +149,5 @@ index ccde0c2d..2d81118a 100644
DECL_HANDLER(get_token_groups)
{
--
2.19.1
2.27.0

View File

@ -1,4 +1,4 @@
From 182f23825cd873fc2b4ee2ddb81b21d7194e60d2 Mon Sep 17 00:00:00 2001
From cdf1f84a65198df1ac4162f868f35971e5e1a2a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 5 Aug 2017 01:45:29 +0200
Subject: [PATCH] ntdll: Add function to create new tokens for elevation
@ -14,10 +14,10 @@ Subject: [PATCH] ntdll: Add function to create new tokens for elevation
6 files changed, 117 insertions(+)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 42ce9815489..401bdd61d21 100644
index f604c8a3c35..850a40412d0 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1598,6 +1598,9 @@
@@ -1599,6 +1599,9 @@
# Virtual memory
@ cdecl __wine_locked_recvmsg(long ptr long)
@ -28,10 +28,10 @@ index 42ce9815489..401bdd61d21 100644
@ cdecl wine_get_version()
@ cdecl wine_get_build_id()
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index c8fbc1ae09d..2603b57be38 100644
index 1f27cd100a7..769d6facc9f 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -69,6 +69,9 @@ extern void init_locale( HMODULE module ) DECLSPEC_HIDDEN;
@@ -68,6 +68,9 @@ extern void init_locale( HMODULE module ) DECLSPEC_HIDDEN;
extern void init_user_process_params(void) DECLSPEC_HIDDEN;
extern NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status ) DECLSPEC_HIDDEN;
@ -40,7 +40,7 @@ index c8fbc1ae09d..2603b57be38 100644
+
/* server support */
extern BOOL is_wow64 DECLSPEC_HIDDEN;
extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret,
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index 77ba5b371e2..3e91a1fa9c4 100644
--- a/dlls/ntdll/process.c
@ -71,10 +71,10 @@ index 77ba5b371e2..3e91a1fa9c4 100644
* restart_process
*/
diff --git a/server/protocol.def b/server/protocol.def
index 9da597e2773..abfc744c960 100644
index 4d37a0df348..56b52dd2231 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3583,6 +3583,14 @@ struct handle_info
@@ -3581,6 +3581,14 @@ struct handle_info
@END

View File

@ -1,17 +1,25 @@
From 6d4621ddba8139747345c05f6251bae9b3c68e39 Mon Sep 17 00:00:00 2001
From e34d019222909281390f83149be755a4145024c4 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 7 Aug 2017 15:28:33 +0200
Subject: ntdll: Add semi-stub for TokenLinkedToken info class.
Subject: [PATCH] ntdll: Add semi-stub for TokenLinkedToken info class.
---
dlls/ntdll/nt.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
dlls/ntdll/unix/security.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 6f2b24e6ba4..99dba58b426 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -366,7 +366,7 @@ NTSTATUS WINAPI NtQueryInformationToken(
diff --git a/dlls/ntdll/unix/security.c b/dlls/ntdll/unix/security.c
index f0057116dee..2769e5f6a7b 100644
--- a/dlls/ntdll/unix/security.c
+++ b/dlls/ntdll/unix/security.c
@@ -138,6 +138,7 @@ NTSTATUS WINAPI NtDuplicateToken( HANDLE token, ACCESS_MASK access, OBJECT_ATTRI
return status;
}
+extern HANDLE CDECL __wine_create_default_token(BOOL admin);
/***********************************************************************
* NtQueryInformationToken (NTDLL.@)
@@ -166,7 +167,7 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE token, TOKEN_INFORMATION_CLASS c
0, /* TokenAuditPolicy */
0, /* TokenOrigin */
sizeof(TOKEN_ELEVATION_TYPE), /* TokenElevationType */
@ -20,14 +28,14 @@ index 6f2b24e6ba4..99dba58b426 100644
sizeof(TOKEN_ELEVATION), /* TokenElevation */
0, /* TokenHasRestrictions */
0, /* TokenAccessInformation */
@@ -607,6 +607,32 @@ NTSTATUS WINAPI NtQueryInformationToken(
}
@@ -401,6 +402,33 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE token, TOKEN_INFORMATION_CLASS c
SERVER_END_REQ;
break;
+ case TokenLinkedToken:
+ SERVER_START_REQ( get_token_elevation_type )
+ {
+ TOKEN_LINKED_TOKEN *linked_token = tokeninfo;
+ TOKEN_LINKED_TOKEN *linked_token = info;
+ req->handle = wine_server_obj_handle( token );
+ status = wine_server_call( req );
+ if (status == STATUS_SUCCESS)
@ -50,9 +58,10 @@ index 6f2b24e6ba4..99dba58b426 100644
+ }
+ SERVER_END_REQ;
+ break;
+
case TokenElevation:
SERVER_START_REQ( get_token_elevation_type )
{
--
2.13.1
2.27.0

View File

@ -1,4 +1,4 @@
From a5c9b96c7b517d212260cb8567162425554ff613 Mon Sep 17 00:00:00 2001
From 2674bbd626b4a9e46e5ab729cb47c81950efefea Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Tue, 7 Jan 2020 14:22:49 -0600
Subject: [PATCH] bcrypt: Implement BCryptSecretAgreement with libgcrypt.
@ -7,17 +7,17 @@ Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
---
configure.ac | 14 ++
dlls/bcrypt/Makefile.in | 1 +
dlls/bcrypt/bcrypt_internal.h | 13 ++
dlls/bcrypt/bcrypt_main.c | 86 +++++++++--
dlls/bcrypt/bcrypt_internal.h | 6 +
dlls/bcrypt/bcrypt_main.c | 54 ++++++-
dlls/bcrypt/gcrypt.c | 264 ++++++++++++++++++++++++++++++++++
dlls/bcrypt/gnutls.c | 9 ++
dlls/bcrypt/macos.c | 6 +
dlls/bcrypt/tests/bcrypt.c | 2 +-
8 files changed, 384 insertions(+), 11 deletions(-)
8 files changed, 350 insertions(+), 6 deletions(-)
create mode 100644 dlls/bcrypt/gcrypt.c
diff --git a/configure.ac b/configure.ac
index e3d63ed7501..beb86c23b45 100644
index 928f8ebd1b1..f9db147e7d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,6 +47,7 @@ AC_ARG_WITH(faudio, AS_HELP_STRING([--without-faudio],[do not use FAudio (XAu
@ -61,7 +61,7 @@ index dd6d4a76640..ea3486a4002 100644
macos.c \
md2.c \
diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h
index 18343a6c749..27cd4950274 100644
index 43be170d77f..6c93ed78389 100644
--- a/dlls/bcrypt/bcrypt_internal.h
+++ b/dlls/bcrypt/bcrypt_internal.h
@@ -25,6 +25,9 @@
@ -74,20 +74,16 @@ index 18343a6c749..27cd4950274 100644
#elif HAVE_COMMONCRYPTO_COMMONCRYPTOR_H
#include <AvailabilityMacros.h>
#include <CommonCrypto/CommonCryptor.h>
@@ -161,6 +164,12 @@ struct algorithm
ULONG flags;
};
+struct secret
+{
@@ -243,6 +246,8 @@ struct key
struct secret
{
struct object hdr;
+ UCHAR *data;
+ ULONG len;
+};
+
#if defined(HAVE_GNUTLS_CIPHER_INIT)
struct key_symmetric
{
@@ -258,6 +267,7 @@ NTSTATUS key_export_dsa_capi( struct key *, UCHAR *, ULONG, ULONG * ) DECLSPEC_H
};
NTSTATUS get_alg_property( const struct algorithm *, const WCHAR *, UCHAR *, ULONG, ULONG * ) DECLSPEC_HIDDEN;
@@ -264,6 +269,7 @@ NTSTATUS key_export_dsa_capi( struct key *, UCHAR *, ULONG, ULONG * ) DECLSPEC_H
NTSTATUS key_export_ecc( struct key *, UCHAR *, ULONG, ULONG * ) DECLSPEC_HIDDEN;
NTSTATUS key_import_dsa_capi( struct key *, UCHAR *, ULONG ) DECLSPEC_HIDDEN;
NTSTATUS key_import_ecc( struct key *, UCHAR *, ULONG ) DECLSPEC_HIDDEN;
@ -95,16 +91,8 @@ index 18343a6c749..27cd4950274 100644
BOOL is_zero_vector( const UCHAR *, ULONG ) DECLSPEC_HIDDEN;
BOOL is_equal_vector( const UCHAR *, ULONG, const UCHAR *, ULONG ) DECLSPEC_HIDDEN;
@@ -265,4 +275,7 @@ BOOL is_equal_vector( const UCHAR *, ULONG, const UCHAR *, ULONG ) DECLSPEC_HIDD
BOOL gnutls_initialize(void) DECLSPEC_HIDDEN;
void gnutls_uninitialize(void) DECLSPEC_HIDDEN;
+BOOL gcrypt_initialize(void) DECLSPEC_HIDDEN;
+void gcrypt_uninitialize(void) DECLSPEC_HIDDEN;
+
#endif /* __BCRYPT_INTERNAL_H */
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index fee40ebe8d7..f254571bbc2 100644
index bea2001a677..65c28ca63e2 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -1421,6 +1421,12 @@ NTSTATUS key_import_ecc( struct key *key, UCHAR *input, ULONG len )
@ -120,74 +108,60 @@ index fee40ebe8d7..f254571bbc2 100644
#endif
NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HANDLE *handle,
@@ -1833,27 +1839,81 @@ NTSTATUS WINAPI BCryptDeriveKeyPBKDF2( BCRYPT_ALG_HANDLE handle, UCHAR *pwd, ULO
return STATUS_SUCCESS;
}
-NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE key, BCRYPT_SECRET_HANDLE *secret, ULONG flags)
+NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE hPrivKey, BCRYPT_KEY_HANDLE hPubKey, BCRYPT_SECRET_HANDLE *secret_out, ULONG flags)
{
- FIXME( "%p, %p, %p, %08x\n", handle, key, secret, flags );
+ struct key *privkey = hPrivKey;
+ struct key *pubkey = hPubKey;
+ struct secret *secret;
@@ -1838,8 +1844,9 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
struct key *privkey = privatekey;
struct key *pubkey = publickey;
struct secret *secret;
+ NTSTATUS status;
- if(secret)
- *secret = (BCRYPT_SECRET_HANDLE *)0xDEADFEED;
+ TRACE( "%p, %p, %p, %08x\n", hPrivKey, hPubKey, secret_out, flags );
- FIXME( "%p, %p, %p, %08x\n", privatekey, publickey, handle, flags );
+ TRACE( "%p, %p, %p, %08x\n", privatekey, publickey, handle, flags );
- return STATUS_SUCCESS;
+ secret = heap_alloc( sizeof(*secret) );
+
+ if ((status = compute_secret_ecc(privkey, pubkey, secret)))
if (!privkey || privkey->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
if (!pubkey || pubkey->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
@@ -1848,7 +1855,16 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
if (!(secret = heap_alloc_zero( sizeof(*secret) ))) return STATUS_NO_MEMORY;
secret->hdr.magic = MAGIC_SECRET;
- *handle = secret;
+ if ((status = compute_secret_ecc( privkey, pubkey, secret )))
+ {
+ heap_free(secret);
+ *secret_out = NULL;
+ heap_free( secret );
+ *handle = NULL;
+ }
+ else
+ {
+ *secret_out = secret;
+ *handle = secret;
+ }
+
+ return status;
}
-NTSTATUS WINAPI BCryptDestroySecret(BCRYPT_SECRET_HANDLE secret)
+NTSTATUS WINAPI BCryptDestroySecret(BCRYPT_SECRET_HANDLE hSecret)
{
- FIXME( "%p\n", secret );
+ struct secret *secret = hSecret;
+
+ TRACE( "%p\n", hSecret );
+
+ if (!hSecret)
+ {
+ return STATUS_INVALID_HANDLE;
+ }
+
+ heap_free(secret->data);
+ heap_free(secret);
+
return STATUS_SUCCESS;
}
-NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE secret, LPCWSTR kdf, BCryptBufferDesc *parameter,
+NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE hSecret, LPCWSTR deriv_func, BCryptBufferDesc *parameter,
PUCHAR derived, ULONG derived_size, ULONG *result, ULONG flags)
@@ -1856,10 +1872,11 @@ NTSTATUS WINAPI BCryptDestroySecret(BCRYPT_SECRET_HANDLE handle)
{
struct secret *secret = handle;
- FIXME( "%p\n", handle );
+ TRACE( "%p\n", handle );
if (!secret || secret->hdr.magic != MAGIC_SECRET) return STATUS_INVALID_HANDLE;
secret->hdr.magic = 0;
+ heap_free( secret->data );
heap_free( secret );
return STATUS_SUCCESS;
}
@@ -1869,12 +1886,33 @@ NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE handle, LPCWSTR kdf, BCrypt
{
struct secret *secret = handle;
- FIXME( "%p, %s, %p, %p, %d, %p, %08x\n", secret, debugstr_w(kdf), parameter, derived, derived_size, result, flags );
+ TRACE( "%p, %s, %p, %p, %d, %p, %08x\n", secret, debugstr_w(kdf), parameter, derived, derived_size, result, flags );
if (!secret || secret->hdr.magic != MAGIC_SECRET) return STATUS_INVALID_HANDLE;
if (!kdf) return STATUS_INVALID_PARAMETER;
- return STATUS_INTERNAL_ERROR;
+ struct secret *secret = hSecret;
+
+ TRACE( "%p, %s, %p, %p, %d, %p, %08x\n", secret, debugstr_w(deriv_func), parameter, derived, derived_size, result, flags );
+
+ if (!hSecret)
+ {
+ return STATUS_INVALID_HANDLE;
+ }
+
+ if (!(strcmpW(deriv_func, BCRYPT_KDF_RAW_SECRET)))
+ if (!(strcmpW( kdf, BCRYPT_KDF_RAW_SECRET )))
+ {
+ ULONG n;
+ ULONG secret_length = secret->len;
@ -207,12 +181,12 @@ index fee40ebe8d7..f254571bbc2 100644
+ *result = n;
+ return STATUS_SUCCESS;
+ }
+ FIXME( "Derivation function %s not supported.\n", debugstr_w(deriv_func) );
+ FIXME( "Derivation function %s not supported.\n", debugstr_w(kdf) );
+ return STATUS_NOT_IMPLEMENTED;
}
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
@@ -1865,6 +1925,9 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
@@ -1886,6 +1924,9 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
DisableThreadLibraryCalls( hinst );
#ifdef HAVE_GNUTLS_CIPHER_INIT
gnutls_initialize();
@ -222,7 +196,7 @@ index fee40ebe8d7..f254571bbc2 100644
#endif
break;
@@ -1872,6 +1935,9 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
@@ -1893,6 +1934,9 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
if (reserved) break;
#ifdef HAVE_GNUTLS_CIPHER_INIT
gnutls_uninitialize();
@ -503,10 +477,10 @@ index 00000000000..f882d61def8
+}
+#endif
diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c
index d447e90a11e..7828fa5c792 100644
index 19a00e2ee25..1e075fe9994 100644
--- a/dlls/bcrypt/gnutls.c
+++ b/dlls/bcrypt/gnutls.c
@@ -1580,4 +1580,13 @@ NTSTATUS key_destroy( struct key *key )
@@ -1585,4 +1585,13 @@ NTSTATUS key_destroy( struct key *key )
heap_free( key );
return STATUS_SUCCESS;
}
@ -521,10 +495,10 @@ index d447e90a11e..7828fa5c792 100644
+
#endif
diff --git a/dlls/bcrypt/macos.c b/dlls/bcrypt/macos.c
index f635ba4bc8e..50cd5d83d1f 100644
index 7f902535b8f..6c2a41a0725 100644
--- a/dlls/bcrypt/macos.c
+++ b/dlls/bcrypt/macos.c
@@ -267,4 +267,10 @@ NTSTATUS key_destroy( struct key *key )
@@ -279,4 +279,10 @@ NTSTATUS key_destroy( struct key *key )
heap_free( key );
return STATUS_SUCCESS;
}
@ -536,7 +510,7 @@ index f635ba4bc8e..50cd5d83d1f 100644
+}
#endif
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
index e4a99d63048..6ca26b3d6ba 100644
index eb7a72e0ff4..a351aacf1f5 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -2068,7 +2068,7 @@ static void test_ECDH(void)
@ -549,5 +523,5 @@ index e4a99d63048..6ca26b3d6ba 100644
if (status != STATUS_SUCCESS)
{
--
2.26.2
2.27.0

View File

@ -1,4 +1,4 @@
From d0c4ac467f5e85e29ae407b29b6a93c85f375fd3 Mon Sep 17 00:00:00 2001
From d232882c571a14f4da8a134071a2125805ebd41f Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Tue, 7 Jan 2020 14:22:49 -0600
Subject: [PATCH] bcrypt: Implement BCRYPT_KDF_HASH.
@ -6,24 +6,22 @@ Subject: [PATCH] bcrypt: Implement BCRYPT_KDF_HASH.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47699
Signed-off-by: Derek Lesho <dlesho at codeweavers.com>
---
dlls/bcrypt/bcrypt_main.c | 110 +++++++++++++++++++++++++++++++++++++
dlls/bcrypt/bcrypt_main.c | 108 ++++++++++++++++++++++++++++++++++++-
dlls/bcrypt/tests/bcrypt.c | 2 +-
2 files changed, 111 insertions(+), 1 deletion(-)
2 files changed, 108 insertions(+), 2 deletions(-)
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index 15b934247d..57d552a4c0 100644
index 65c28ca63e2..6e7b52e93b0 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -1773,6 +1773,116 @@ NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE hSecret, LPCWSTR deriv_func
return STATUS_INVALID_HANDLE;
}
@@ -1891,7 +1891,113 @@ NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE handle, LPCWSTR kdf, BCrypt
if (!secret || secret->hdr.magic != MAGIC_SECRET) return STATUS_INVALID_HANDLE;
if (!kdf) return STATUS_INVALID_PARAMETER;
+ if (flags)
+ {
+ FIXME("flags ignored: %08x\n", flags);
+ }
- if (!(strcmpW( kdf, BCRYPT_KDF_RAW_SECRET )))
+ if (flags) FIXME("flags ignored: %08x\n", flags);
+
+ if (!(strcmpW(deriv_func, BCRYPT_KDF_HASH)))
+ if (!(strcmpW( kdf, BCRYPT_KDF_HASH )))
+ {
+ unsigned int i;
+ BCryptBuffer *hash_algorithm = NULL;
@ -127,15 +125,15 @@ index 15b934247d..57d552a4c0 100644
+
+ return STATUS_SUCCESS;
+ }
+ else
if (!(strcmpW(deriv_func, BCRYPT_KDF_RAW_SECRET)))
+ else if (!(strcmpW( kdf, BCRYPT_KDF_RAW_SECRET )))
{
ULONG n;
ULONG secret_length = secret->len;
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
index d9509f2c49..edc59a8a97 100644
index a351aacf1f5..5333b879817 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -2084,7 +2084,7 @@ static void test_ECDH(void)
@@ -2085,7 +2085,7 @@ static void test_ECDH(void)
raw_secret_end:
status = pBCryptDeriveKey(secret, BCRYPT_KDF_HASH, &hash_params, NULL, 0, &size, 0);
@ -145,5 +143,5 @@ index d9509f2c49..edc59a8a97 100644
if (status != STATUS_SUCCESS)
{
--
2.24.1
2.27.0

View File

@ -1,19 +1,19 @@
From 77f149959058b5e45a2fd462b5077ae417bc5857 Mon Sep 17 00:00:00 2001
From 81bd9eaa0466b7adc763d4302ca70141f8aa3947 Mon Sep 17 00:00:00 2001
From: Qian Hong <qhong@codeweavers.com>
Date: Tue, 16 Feb 2016 04:53:12 +0800
Subject: ntdll: Improve invalid paramater handling in NtAccessCheck.
Subject: [PATCH] ntdll: Improve invalid paramater handling in NtAccessCheck.
Signed-off-by: Qian Hong <qhong@codeweavers.com>
---
dlls/advapi32/tests/security.c | 8 --------
dlls/ntdll/sec.c | 11 ++++++++++-
2 files changed, 10 insertions(+), 9 deletions(-)
dlls/advapi32/tests/security.c | 8 --------
dlls/ntdll/unix/security.c | 8 +++++++-
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 8b86d45..698a9aa 100644
index 825f8451904..ca6e735c1c6 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -1429,10 +1429,8 @@ static void test_AccessCheck(void)
@@ -1466,10 +1466,8 @@ static void test_AccessCheck(void)
ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping,
0, &PrivSetLen, &Access, &AccessStatus);
err = GetLastError();
@ -24,7 +24,7 @@ index 8b86d45..698a9aa 100644
ok(PrivSetLen == sizeof(PRIVILEGE_SET), "PrivSetLen returns %d\n", PrivSetLen);
ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed,
"Access and/or AccessStatus were changed!\n");
@@ -1483,12 +1481,9 @@ todo_wine
@@ -1520,12 +1518,9 @@ todo_wine
ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping,
PrivSet, &PrivSetLen, &Access, &AccessStatus);
err = GetLastError();
@ -37,7 +37,7 @@ index 8b86d45..698a9aa 100644
ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed,
"Access and/or AccessStatus were changed!\n");
@@ -1600,12 +1595,9 @@ todo_wine
@@ -1637,12 +1632,9 @@ todo_wine
ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping,
PrivSet, &PrivSetLen, &Access, &AccessStatus);
err = GetLastError();
@ -50,28 +50,25 @@ index 8b86d45..698a9aa 100644
ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed,
"Access and/or AccessStatus were changed!\n");
diff --git a/dlls/ntdll/sec.c b/dlls/ntdll/sec.c
index 125c86e..c32ae0c 100644
--- a/dlls/ntdll/sec.c
+++ b/dlls/ntdll/sec.c
@@ -1586,7 +1586,16 @@ NtAccessCheck(
SecurityDescriptor, ClientToken, DesiredAccess, GenericMapping,
PrivilegeSet, ReturnLength, GrantedAccess, AccessStatus);
diff --git a/dlls/ntdll/unix/security.c b/dlls/ntdll/unix/security.c
index daecc5e0591..c1237859784 100644
--- a/dlls/ntdll/unix/security.c
+++ b/dlls/ntdll/unix/security.c
@@ -650,7 +650,13 @@ NTSTATUS WINAPI NtAccessCheck( PSECURITY_DESCRIPTOR descr, HANDLE token, ACCESS_
TRACE( "(%p, %p, %08x, %p, %p, %p, %p, %p)\n",
descr, token, access, mapping, privs, retlen, access_granted, access_status );
- if (!PrivilegeSet || !ReturnLength)
+ if (!ReturnLength)
+ return STATUS_ACCESS_VIOLATION;
+
+ if (*ReturnLength == 0)
- if (!privs || !retlen) return STATUS_ACCESS_VIOLATION;
+ if (!retlen) return STATUS_ACCESS_VIOLATION;
+ if (!*retlen)
+ {
+ *ReturnLength = sizeof(PRIVILEGE_SET);
+ *retlen = sizeof(PRIVILEGE_SET);
+ return STATUS_BUFFER_TOO_SMALL;
+ }
+
+ if (!PrivilegeSet)
return STATUS_ACCESS_VIOLATION;
+ if (!privs) return STATUS_ACCESS_VIOLATION;
SERVER_START_REQ( access_check )
/* reuse the object attribute SD marshalling */
InitializeObjectAttributes( &attr, NULL, 0, 0, descr );
--
2.7.1
2.27.0

View File

@ -1,18 +1,18 @@
From a100b0b789c767230ef98eb2201e5ae5a272e907 Mon Sep 17 00:00:00 2001
From 8ea8ef48ce50b357f04664c70c3c86ea40c654ec Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 28 May 2017 10:30:43 +0200
Subject: [PATCH] ntdll/tests: Add tests for
NtQueryVirtualMemory(MemorySectionName).
---
dlls/ntdll/tests/info.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
dlls/ntdll/tests/info.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 7a641f8b84e..e335e758175 100644
index e5137ef5a45..e06a229e6cd 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -2182,6 +2182,8 @@ static void test_queryvirtualmemory(void)
@@ -2092,6 +2092,8 @@ static void test_queryvirtualmemory(void)
char stackbuf[42];
HMODULE module;
void *user_shared_data = (void *)0x7ffe0000;
@ -20,13 +20,12 @@ index 7a641f8b84e..e335e758175 100644
+ MEMORY_SECTION_NAME *msn = (MEMORY_SECTION_NAME *)buffer_name;
module = GetModuleHandleA( "ntdll.dll" );
trace("Check flags of the PE header of NTDLL.DLL at %p\n", module);
@@ -2274,6 +2276,39 @@ static void test_queryvirtualmemory(void)
status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
@@ -2174,6 +2176,34 @@ static void test_queryvirtualmemory(void)
/* check error code when len is less than MEMORY_BASIC_INFORMATION size */
status = pNtQueryVirtualMemory(NtCurrentProcess(), GetProcessHeap(), MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION) - 1, &readcount);
ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
+
+ trace("Check section name of NTDLL.DLL with invalid size\n");
+ module = GetModuleHandleA( "ntdll.dll" );
+ memset(msn, 0, sizeof(*msn));
+ readcount = 0;
@ -34,7 +33,6 @@ index 7a641f8b84e..e335e758175 100644
+ ok( status == STATUS_BUFFER_OVERFLOW, "Expected STATUS_BUFFER_OVERFLOW, got %08x\n", status);
+ ok( readcount > 0, "Expected readcount to be > 0\n");
+
+ trace("Check section name of NTDLL.DLL with invalid size\n");
+ module = GetModuleHandleA( "ntdll.dll" );
+ memset(msn, 0, sizeof(*msn));
+ readcount = 0;
@ -42,7 +40,6 @@ index 7a641f8b84e..e335e758175 100644
+ ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
+ ok( readcount > 0, "Expected readcount to be > 0\n");
+
+ trace("Check section name of NTDLL.DLL\n");
+ module = GetModuleHandleA( "ntdll.dll" );
+ memset(msn, 0x55, sizeof(*msn));
+ memset(buffer_name, 0x77, sizeof(buffer_name));
@ -50,9 +47,7 @@ index 7a641f8b84e..e335e758175 100644
+ status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemorySectionName, msn, sizeof(buffer_name), &readcount);
+ ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
+ ok( readcount > 0, "Expected readcount to be > 0\n");
+ trace ("Section Name: %s\n", wine_dbgstr_w(msn->SectionFileName.Buffer));
+
+ trace("Check section name of non mapped memory\n");
+ memset(msn, 0, sizeof(*msn));
+ readcount = 0;
+ status = pNtQueryVirtualMemory(NtCurrentProcess(), &buffer_name, MemorySectionName, msn, sizeof(buffer_name), &readcount);
@ -62,5 +57,5 @@ index 7a641f8b84e..e335e758175 100644
static void test_affinity(void)
--
2.26.2
2.27.0

View File

@ -1,4 +1,4 @@
From 951b3002db9c9277a01d965da4d0996a328ec9db Mon Sep 17 00:00:00 2001
From 451efee77500173d36ddd16f39cf3ee2df498a93 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 28 May 2017 10:33:40 +0200
Subject: [PATCH] ntdll/tests: Add test to ensure section name is full path.
@ -8,7 +8,7 @@ Subject: [PATCH] ntdll/tests: Add test to ensure section name is full path.
1 file changed, 9 insertions(+)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 766ca086c76..c953740d050 100644
index e06a229e6cd..02538e6f49a 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -22,6 +22,7 @@
@ -19,15 +19,15 @@ index 766ca086c76..c953740d050 100644
static NTSTATUS (WINAPI * pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
static NTSTATUS (WINAPI * pNtSetSystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG);
static NTSTATUS (WINAPI * pRtlGetNativeSystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
@@ -76,6 +77,7 @@ static BOOL InitFunctionPtrs(void)
return FALSE;
}
@@ -70,6 +71,7 @@ static BOOL InitFunctionPtrs(void)
HMODULE hntdll = GetModuleHandleA("ntdll");
HMODULE hkernel32 = GetModuleHandleA("kernel32");
+ NTDLL_GET_PROC(RtlDowncaseUnicodeString);
NTDLL_GET_PROC(NtQuerySystemInformation);
NTDLL_GET_PROC(NtSetSystemInformation);
NTDLL_GET_PROC(RtlGetNativeSystemInformation);
@@ -2211,6 +2213,7 @@ static void test_queryvirtualmemory(void)
@@ -2085,6 +2087,7 @@ static void test_queryvirtualmemory(void)
{
NTSTATUS status;
SIZE_T readcount;
@ -35,7 +35,7 @@ index 766ca086c76..c953740d050 100644
static const char teststring[] = "test string";
static char datatestbuf[42] = "abc";
static char rwtestbuf[42];
@@ -2220,6 +2223,8 @@ static void test_queryvirtualmemory(void)
@@ -2094,6 +2097,8 @@ static void test_queryvirtualmemory(void)
void *user_shared_data = (void *)0x7ffe0000;
char buffer_name[sizeof(MEMORY_SECTION_NAME) + MAX_PATH * sizeof(WCHAR)];
MEMORY_SECTION_NAME *msn = (MEMORY_SECTION_NAME *)buffer_name;
@ -43,18 +43,18 @@ index 766ca086c76..c953740d050 100644
+ int i;
module = GetModuleHandleA( "ntdll.dll" );
trace("Check flags of the PE header of NTDLL.DLL at %p\n", module);
@@ -2337,6 +2342,10 @@ static void test_queryvirtualmemory(void)
status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
@@ -2198,6 +2203,10 @@ static void test_queryvirtualmemory(void)
status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemorySectionName, msn, sizeof(buffer_name), &readcount);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
ok( readcount > 0, "Expected readcount to be > 0\n");
trace ("Section Name: %s\n", wine_dbgstr_w(msn->SectionFileName.Buffer));
+ pRtlDowncaseUnicodeString( &msn->SectionFileName, &msn->SectionFileName, FALSE );
+ for (found = FALSE, i = (msn->SectionFileName.Length - sizeof(windowsW)) / sizeof(WCHAR); i >= 0; i--)
+ found |= !memcmp( &msn->SectionFileName.Buffer[i], windowsW, sizeof(windowsW) );
+ ok( found, "Section name does not contain \"Windows\"\n");
trace("Check section name of non mapped memory\n");
memset(msn, 0, sizeof(*msn));
readcount = 0;
--
2.26.2
2.27.0

View File

@ -1,42 +0,0 @@
From 7e213371499499eac50f59e99ef42ec0e7b61da1 Mon Sep 17 00:00:00 2001
From: Gerald Pfeifer <gerald@pfeifer.com>
Date: Sat, 18 Jul 2020 12:02:58 +0300
Subject: [PATCH] ntdll: Include <signal.h> for sigset_t
commit 7053b7c615b44e7112ab8fb4c056206d32b6f1c9
Author: Alexandre Julliard <julliard@winehq.org>
Date: Fri Jul 17 11:46:15 2020 +0200
ntdll: Move the registry system calls to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
broke non-Linux platforms since sigset_t isn't necessarily defined
based on the #include statements in the new dlls/ntdll/unix/registry.c.
This fixes it.
Observed and tested on FreeBSD 11.4/i386.
Gerald
Signed-off-by: Gerald Pfeifer <gerald@pfeifer.com>
---
dlls/ntdll/unix/registry.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/ntdll/unix/registry.c b/dlls/ntdll/unix/registry.c
index f94c8ff98ee..6d583618180 100644
--- a/dlls/ntdll/unix/registry.c
+++ b/dlls/ntdll/unix/registry.c
@@ -25,6 +25,7 @@
#pragma makedep unix
#endif
+#include <signal.h>
#include <stdarg.h>
#include <string.h>
--
2.27.0

View File

@ -1,2 +0,0 @@
# From Mailing list
Fixes: Fixes compile on FreeBSD

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "536aec511612afd002808508d76bd5640f359f25"
echo "a455ff61b40ff73b48d0ccc9c1f14679bb65ab8d"
}
# Show version information
@ -199,7 +199,6 @@ patch_enable_all ()
enable_ntdll_Zero_mod_name="$1"
enable_ntdll_aarch_TEB="$1"
enable_ntdll_ext4_case_folder="$1"
enable_ntdll_freebsd_compile="$1"
enable_ntdll_set_full_cpu_context="$1"
enable_ntdll_x86_64_SegDs="$1"
enable_ntoskrnl_Stubs="$1"
@ -690,9 +689,6 @@ patch_enable ()
ntdll-ext4-case-folder)
enable_ntdll_ext4_case_folder="$2"
;;
ntdll-freebsd-compile)
enable_ntdll_freebsd_compile="$2"
;;
ntdll-set_full_cpu_context)
enable_ntdll_set_full_cpu_context="$2"
;;
@ -1860,7 +1856,7 @@ fi
# | * [#25834] Implement advapi32.CreateRestrictedToken
# |
# | Modified files:
# | * dlls/kernelbase/security.c, dlls/ntdll/nt.c, dlls/ntdll/ntdll.spec, include/winnt.h, include/winternl.h,
# | * dlls/kernelbase/security.c, dlls/ntdll/ntdll.spec, dlls/ntdll/unix/security.c, include/winnt.h, include/winternl.h,
# | server/named_pipe.c, server/process.c, server/protocol.def, server/security.h, server/token.c
# |
if test "$enable_advapi32_CreateRestrictedToken" -eq 1; then
@ -1897,8 +1893,8 @@ fi
# |
# | Modified files:
# | * configure.ac, dlls/advapi32/tests/Makefile.in, dlls/advapi32/tests/security.c, dlls/kernelbase/process.c,
# | dlls/ntdll/loader.c, dlls/ntdll/nt.c, dlls/ntdll/ntdll.spec, dlls/ntdll/ntdll_misc.h, dlls/ntdll/process.c,
# | dlls/ntdll/unix/process.c, dlls/shell32/shlexec.c, dlls/user32/win.c, programs/runas/Makefile.in,
# | dlls/ntdll/loader.c, dlls/ntdll/ntdll.spec, dlls/ntdll/ntdll_misc.h, dlls/ntdll/process.c, dlls/ntdll/unix/process.c,
# | dlls/ntdll/unix/security.c, dlls/shell32/shlexec.c, dlls/user32/win.c, programs/runas/Makefile.in,
# | programs/runas/runas.c, programs/runas/runas.h, programs/runas/runas.rc, server/named_pipe.c, server/process.c,
# | server/process.h, server/protocol.def, server/request.c, server/security.h, server/token.c
# |
@ -3763,7 +3759,7 @@ fi
# Patchset ntdll-NtAccessCheck
# |
# | Modified files:
# | * dlls/advapi32/tests/security.c, dlls/ntdll/sec.c
# | * dlls/advapi32/tests/security.c, dlls/ntdll/unix/security.c
# |
if test "$enable_ntdll_NtAccessCheck" -eq 1; then
patch_apply ntdll-NtAccessCheck/0001-ntdll-Improve-invalid-paramater-handling-in-NtAccess.patch
@ -4087,18 +4083,6 @@ if test "$enable_ntdll_ext4_case_folder" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntdll-freebsd-compile
# |
# | Modified files:
# | * dlls/ntdll/unix/registry.c
# |
if test "$enable_ntdll_freebsd_compile" -eq 1; then
patch_apply ntdll-freebsd-compile/0001-ntdll-Include-signal.h-for-sigset_t.patch
(
printf '%s\n' '+ { "Gerald Pfeifer", "ntdll: Include <signal.h> for sigset_t.", 1 },';
) >> "$patchlist"
fi
# Patchset ntdll-set_full_cpu_context
# |
# | Modified files:

View File

@ -1,20 +1,20 @@
From 04ab1c6e148411f43bea8d2c71fb1bfd5b90efab Mon Sep 17 00:00:00 2001
From 01c9f751698b45255b3a43f44ae656bf09646ddc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 7 Mar 2017 18:30:33 +0100
Subject: [PATCH] ntdll: Implement SystemExtendedHandleInformation in
NtQuerySystemInformation.
---
dlls/ntdll/tests/info.c | 60 ++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/unix/system.c | 52 ++++++++++++++++++++++++++++++++++
include/winternl.h | 21 ++++++++++++++
3 files changed, 133 insertions(+)
dlls/ntdll/tests/info.c | 51 +++++++++++++++++++++++++++++++++++++++
dlls/ntdll/unix/system.c | 52 ++++++++++++++++++++++++++++++++++++++++
include/winternl.h | 21 ++++++++++++++++
3 files changed, 124 insertions(+)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index e399757b85d..d27bb06c5fe 100644
index e5137ef5a45..04b8a6c454d 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -662,6 +662,62 @@ done:
@@ -570,6 +570,56 @@ done:
HeapFree( GetProcessHeap(), 0, shi);
}
@ -52,12 +52,6 @@ index e399757b85d..d27bb06c5fe 100644
+ ((HANDLE)(ULONG_PTR)shi->Handle[i].HandleValue == EventHandle);
+ ok( found, "Expected to find event handle %p (pid %x) in handle list\n", EventHandle, GetCurrentProcessId() );
+
+ if (!found)
+ {
+ for (i = 0; i < shi->Count; i++)
+ trace( "%d: handle %x pid %x\n", i, (DWORD)shi->Handle[i].HandleValue, (DWORD)shi->Handle[i].UniqueProcessId );
+ }
+
+ CloseHandle(EventHandle);
+
+ ReturnLength = 0xdeadbeef;
@ -77,19 +71,16 @@ index e399757b85d..d27bb06c5fe 100644
static void test_query_cache(void)
{
NTSTATUS status;
@@ -2783,6 +2839,10 @@ START_TEST(info)
trace("Starting test_query_handle()\n");
@@ -2593,6 +2643,7 @@ START_TEST(info)
test_query_procperf();
test_query_module();
test_query_handle();
+ /* 0x40 SystemHandleInformation */
+ trace("Starting test_query_handle_ex()\n");
+ test_query_handle_ex();
+
/* 0x15 SystemCacheInformation */
trace("Starting test_query_cache()\n");
test_query_cache();
test_query_interrupt();
test_time_adjustment();
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
index abec33bb289..c3774dcdef8 100644
index e34f6ab9384..4597a8d788e 100644
--- a/dlls/ntdll/unix/system.c
+++ b/dlls/ntdll/unix/system.c
@@ -2399,6 +2399,58 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,

View File

@ -1,4 +1,4 @@
From 5dc9d48bb56202065ebbf2888834f138505bb6a7 Mon Sep 17 00:00:00 2001
From 0413b624582ad1db0af0dbeddb41ef698a2d2504 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Wed, 8 Aug 2018 20:00:15 -0500
Subject: [PATCH] ntdll: Add a stub implementation of Wow64Transition.
@ -9,18 +9,18 @@ Subject: [PATCH] ntdll: Add a stub implementation of Wow64Transition.
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index c471755139f..57f1805bf18 100644
index 1a76be3f0a6..b6c55071a15 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3918,6 +3918,7 @@ NTSTATUS WINAPI NtLoadDriver( const UNICODE_STRING *DriverServiceName )
return STATUS_NOT_IMPLEMENTED;
@@ -3912,6 +3912,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
return TRUE;
}
+void *Wow64Transition;
/***********************************************************************
* NtUnloadDriver (NTDLL.@)
@@ -3949,13 +3950,16 @@ void __wine_process_init(void)
* __wine_process_init
@@ -3921,13 +3922,16 @@ void __wine_process_init(void)
static const WCHAR ntdllW[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
's','y','s','t','e','m','3','2','\\',
'n','t','d','l','l','.','d','l','l',0};
@ -38,7 +38,7 @@ index c471755139f..57f1805bf18 100644
NTSTATUS status;
ANSI_STRING func_name;
UNICODE_STRING nt_name;
@@ -4012,6 +4016,13 @@ void __wine_process_init(void)
@@ -3986,6 +3990,13 @@ void __wine_process_init(void)
MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
NtTerminateProcess( GetCurrentProcess(), status );
}
@ -53,7 +53,7 @@ index c471755139f..57f1805bf18 100644
if ((status = LdrGetProcedureAddress( wm->ldr.DllBase, &func_name,
0, (void **)&kernel32_start_process )) != STATUS_SUCCESS)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index f3e765e25a1..4d448dc8f37 100644
index 850a40412d0..2734099f11f 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1112,6 +1112,7 @@
@ -61,9 +61,9 @@ index f3e765e25a1..4d448dc8f37 100644
@ stdcall WinSqmSetDWORD(ptr long long)
@ stdcall WinSqmStartSession(ptr long long)
+@ extern Wow64Transition
@ stdcall -private ZwAcceptConnectPort(ptr long ptr long ptr ptr) NtAcceptConnectPort
@ stdcall -private ZwAccessCheck(ptr long long ptr ptr ptr ptr ptr) NtAccessCheck
@ stdcall -private ZwAccessCheckAndAuditAlarm(ptr long ptr ptr ptr long ptr long ptr ptr ptr) NtAccessCheckAndAuditAlarm
@ stdcall -private -syscall ZwAcceptConnectPort(ptr long ptr long ptr ptr) NtAcceptConnectPort
@ stdcall -private -syscall ZwAccessCheck(ptr long long ptr ptr ptr ptr ptr) NtAccessCheck
@ stdcall -private -syscall ZwAccessCheckAndAuditAlarm(ptr long ptr ptr ptr long ptr long ptr ptr ptr) NtAccessCheckAndAuditAlarm
--
2.27.0

View File

@ -1 +1 @@
536aec511612afd002808508d76bd5640f359f25
a455ff61b40ff73b48d0ccc9c1f14679bb65ab8d