Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a9983c8d
Commit
a9983c8d
authored
Jun 12, 2005
by
Eric Kohl
Committed by
Alexandre Julliard
Jun 12, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement RtlAdjustPrivilege.
parent
b44c2a3d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
5 deletions
+83
-5
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-1
sec.c
dlls/ntdll/sec.c
+81
-3
winternl.h
include/winternl.h
+1
-1
No files found.
dlls/ntdll/ntdll.spec
View file @
a9983c8d
...
...
@@ -300,7 +300,7 @@
@ stub RtlAddAttributeActionToRXact
@ stub RtlAddAuditAccessAce
@ stdcall RtlAddVectoredExceptionHandler(long ptr)
@ stdcall RtlAdjustPrivilege(long long long
long
)
@ stdcall RtlAdjustPrivilege(long long long
ptr
)
@ stdcall RtlAllocateAndInitializeSid (ptr long long long long long long long long long ptr)
@ stdcall RtlAllocateHandle(ptr ptr)
@ stdcall RtlAllocateHeap(long long long)
...
...
dlls/ntdll/sec.c
View file @
a9983c8d
...
...
@@ -1154,11 +1154,89 @@ NTSTATUS WINAPI RtlGetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce )
/******************************************************************************
* RtlAdjustPrivilege [NTDLL.@]
*
* Enables or disables a privilege from the calling thread or process.
*
* PARAMS
* Privilege [I] Privilege index to change.
* Enable [I] If TRUE, then enable the privilege otherwise disable.
* CurrentThread [I] If TRUE, then enable in calling thread, otherwise process.
* Enabled [O] Whether privilege was previously enabled or disabled.
*
* RETURNS
* Success: STATUS_SUCCESS.
* Failure: NTSTATUS code.
*
* SEE ALSO
* NtAdjustPrivilegesToken, NtOpenThreadToken, NtOpenProcessToken.
*
*/
DWORD
WINAPI
RtlAdjustPrivilege
(
DWORD
x1
,
DWORD
x2
,
DWORD
x3
,
DWORD
x4
)
NTSTATUS
WINAPI
RtlAdjustPrivilege
(
ULONG
Privilege
,
BOOLEAN
Enable
,
BOOLEAN
CurrentThread
,
PBOOLEAN
Enabled
)
{
FIXME
(
"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!
\n
"
,
x1
,
x2
,
x3
,
x4
);
return
0
;
TOKEN_PRIVILEGES
NewState
;
TOKEN_PRIVILEGES
OldState
;
ULONG
ReturnLength
;
HANDLE
TokenHandle
;
NTSTATUS
Status
;
TRACE
(
"(%ld, %s, %s, %p)
\n
"
,
Privilege
,
Enable
?
"TRUE"
:
"FALSE"
,
CurrentThread
?
"TRUE"
:
"FALSE"
,
Enabled
);
if
(
CurrentThread
)
{
Status
=
NtOpenThreadToken
(
GetCurrentThread
(),
TOKEN_ADJUST_PRIVILEGES
|
TOKEN_QUERY
,
FALSE
,
&
TokenHandle
);
}
else
{
Status
=
NtOpenProcessToken
(
GetCurrentProcess
(),
TOKEN_ADJUST_PRIVILEGES
|
TOKEN_QUERY
,
&
TokenHandle
);
}
if
(
!
NT_SUCCESS
(
Status
))
{
WARN
(
"Retrieving token handle failed (Status %lx)
\n
"
,
Status
);
return
Status
;
}
OldState
.
PrivilegeCount
=
1
;
NewState
.
PrivilegeCount
=
1
;
NewState
.
Privileges
[
0
].
Luid
.
LowPart
=
Privilege
;
NewState
.
Privileges
[
0
].
Luid
.
HighPart
=
0
;
NewState
.
Privileges
[
0
].
Attributes
=
(
Enable
)
?
SE_PRIVILEGE_ENABLED
:
0
;
Status
=
NtAdjustPrivilegesToken
(
TokenHandle
,
FALSE
,
&
NewState
,
sizeof
(
TOKEN_PRIVILEGES
),
&
OldState
,
&
ReturnLength
);
NtClose
(
TokenHandle
);
if
(
Status
==
STATUS_NOT_ALL_ASSIGNED
)
{
TRACE
(
"Failed to assign all privileges
\n
"
);
return
STATUS_PRIVILEGE_NOT_HELD
;
}
if
(
!
NT_SUCCESS
(
Status
))
{
WARN
(
"NtAdjustPrivilegesToken() failed (Status %lx)
\n
"
,
Status
);
return
Status
;
}
if
(
OldState
.
PrivilegeCount
==
0
)
*
Enabled
=
Enable
;
else
*
Enabled
=
(
OldState
.
Privileges
[
0
].
Attributes
&
SE_PRIVILEGE_ENABLED
);
return
STATUS_SUCCESS
;
}
/******************************************************************************
...
...
include/winternl.h
View file @
a9983c8d
...
...
@@ -1613,7 +1613,7 @@ NTSTATUS WINAPI RtlAddAccessDeniedAce(PACL,DWORD,DWORD,PSID);
NTSTATUS
WINAPI
RtlAddAccessDeniedAceEx
(
PACL
,
DWORD
,
DWORD
,
DWORD
,
PSID
);
NTSTATUS
WINAPI
RtlAddAtomToAtomTable
(
RTL_ATOM_TABLE
,
const
WCHAR
*
,
RTL_ATOM
*
);
PVOID
WINAPI
RtlAddVectoredExceptionHandler
(
ULONG
,
PVECTORED_EXCEPTION_HANDLER
);
DWORD
WINAPI
RtlAdjustPrivilege
(
DWORD
,
DWORD
,
DWORD
,
DWORD
);
NTSTATUS
WINAPI
RtlAdjustPrivilege
(
ULONG
,
BOOLEAN
,
BOOLEAN
,
PBOOLEAN
);
NTSTATUS
WINAPI
RtlAllocateAndInitializeSid
(
PSID_IDENTIFIER_AUTHORITY
,
BYTE
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
PSID
*
);
RTL_HANDLE
*
WINAPI
RtlAllocateHandle
(
RTL_HANDLE_TABLE
*
,
ULONG
*
);
PVOID
WINAPI
RtlAllocateHeap
(
HANDLE
,
ULONG
,
ULONG
);
...
...
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