Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
fd65b0a1
Commit
fd65b0a1
authored
Dec 02, 2013
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 02, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Allow NULL return length argument in NtAdjustPrivilegesToken().
parent
e810a584
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
3 deletions
+40
-3
security.c
dlls/advapi32/security.c
+3
-2
security.c
dlls/advapi32/tests/security.c
+36
-0
nt.c
dlls/ntdll/nt.c
+1
-1
No files found.
dlls/advapi32/security.c
View file @
fd65b0a1
...
...
@@ -611,8 +611,9 @@ AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges,
{
NTSTATUS
status
;
TRACE
(
"
\n
"
);
TRACE
(
"(%p %d %p %d %p %p)
\n
"
,
TokenHandle
,
DisableAllPrivileges
,
NewState
,
BufferLength
,
PreviousState
,
ReturnLength
);
status
=
NtAdjustPrivilegesToken
(
TokenHandle
,
DisableAllPrivileges
,
NewState
,
BufferLength
,
PreviousState
,
ReturnLength
);
...
...
dlls/advapi32/tests/security.c
View file @
fd65b0a1
...
...
@@ -4760,6 +4760,41 @@ static void test_default_dacl_owner_sid(void)
CloseHandle
(
handle
);
}
static
void
test_AdjustTokenPrivileges
(
void
)
{
TOKEN_PRIVILEGES
tp
,
prev
;
HANDLE
token
;
DWORD
len
;
LUID
luid
;
BOOL
ret
;
if
(
!
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_ADJUST_PRIVILEGES
,
&
token
))
return
;
if
(
!
LookupPrivilegeValueA
(
NULL
,
SE_BACKUP_NAME
,
&
luid
))
{
CloseHandle
(
token
);
return
;
}
tp
.
PrivilegeCount
=
1
;
tp
.
Privileges
[
0
].
Luid
=
luid
;
tp
.
Privileges
[
0
].
Attributes
=
SE_PRIVILEGE_ENABLED
;
len
=
0xdeadbeef
;
ret
=
AdjustTokenPrivileges
(
token
,
FALSE
,
&
tp
,
sizeof
(
TOKEN_PRIVILEGES
),
NULL
,
&
len
);
ok
(
ret
,
"got %d
\n
"
,
ret
);
ok
(
len
==
0xdeadbeef
,
"got length %d
\n
"
,
len
);
/* revert */
tp
.
PrivilegeCount
=
1
;
tp
.
Privileges
[
0
].
Luid
=
luid
;
tp
.
Privileges
[
0
].
Attributes
=
0
;
AdjustTokenPrivileges
(
token
,
FALSE
,
&
tp
,
sizeof
(
TOKEN_PRIVILEGES
),
&
prev
,
NULL
);
CloseHandle
(
token
);
}
START_TEST
(
security
)
{
init
();
...
...
@@ -4800,4 +4835,5 @@ START_TEST(security)
test_CreateRestrictedToken
();
test_TokenIntegrityLevel
();
test_default_dacl_owner_sid
();
test_AdjustTokenPrivileges
();
}
dlls/ntdll/nt.c
View file @
fd65b0a1
...
...
@@ -223,7 +223,7 @@ NTSTATUS WINAPI NtAdjustPrivilegesToken(
ret
=
wine_server_call
(
req
);
if
(
PreviousState
)
{
*
ReturnLength
=
reply
->
len
+
FIELD_OFFSET
(
TOKEN_PRIVILEGES
,
Privileges
);
if
(
ReturnLength
)
*
ReturnLength
=
reply
->
len
+
FIELD_OFFSET
(
TOKEN_PRIVILEGES
,
Privileges
);
PreviousState
->
PrivilegeCount
=
reply
->
len
/
sizeof
(
LUID_AND_ATTRIBUTES
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment