mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2026-06-16 15:59:24 +00:00
updates and moves
n/a
This commit is contained in:
@@ -0,0 +1,395 @@
|
||||
Attribution 4.0 International
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
||||
does not provide legal services or legal advice. Distribution of
|
||||
Creative Commons public licenses does not create a lawyer-client or
|
||||
other relationship. Creative Commons makes its licenses and related
|
||||
information available on an "as-is" basis. Creative Commons gives no
|
||||
warranties regarding its licenses, any material licensed under their
|
||||
terms and conditions, or any related information. Creative Commons
|
||||
disclaims all liability for damages resulting from their use to the
|
||||
fullest extent possible.
|
||||
|
||||
Using Creative Commons Public Licenses
|
||||
|
||||
Creative Commons public licenses provide a standard set of terms and
|
||||
conditions that creators and other rights holders may use to share
|
||||
original works of authorship and other material subject to copyright
|
||||
and certain other rights specified in the public license below. The
|
||||
following considerations are for informational purposes only, are not
|
||||
exhaustive, and do not form part of our licenses.
|
||||
|
||||
Considerations for licensors: Our public licenses are
|
||||
intended for use by those authorized to give the public
|
||||
permission to use material in ways otherwise restricted by
|
||||
copyright and certain other rights. Our licenses are
|
||||
irrevocable. Licensors should read and understand the terms
|
||||
and conditions of the license they choose before applying it.
|
||||
Licensors should also secure all rights necessary before
|
||||
applying our licenses so that the public can reuse the
|
||||
material as expected. Licensors should clearly mark any
|
||||
material not subject to the license. This includes other CC-
|
||||
licensed material, or material used under an exception or
|
||||
limitation to copyright. More considerations for licensors:
|
||||
wiki.creativecommons.org/Considerations_for_licensors
|
||||
|
||||
Considerations for the public: By using one of our public
|
||||
licenses, a licensor grants the public permission to use the
|
||||
licensed material under specified terms and conditions. If
|
||||
the licensor's permission is not necessary for any reason--for
|
||||
example, because of any applicable exception or limitation to
|
||||
copyright--then that use is not regulated by the license. Our
|
||||
licenses grant only permissions under copyright and certain
|
||||
other rights that a licensor has authority to grant. Use of
|
||||
the licensed material may still be restricted for other
|
||||
reasons, including because others have copyright or other
|
||||
rights in the material. A licensor may make special requests,
|
||||
such as asking that all changes be marked or described.
|
||||
Although not required by our licenses, you are encouraged to
|
||||
respect those requests where reasonable. More considerations
|
||||
for the public:
|
||||
wiki.creativecommons.org/Considerations_for_licensees
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons Attribution 4.0 International Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree
|
||||
to be bound by the terms and conditions of this Creative Commons
|
||||
Attribution 4.0 International Public License ("Public License"). To the
|
||||
extent this Public License may be interpreted as a contract, You are
|
||||
granted the Licensed Rights in consideration of Your acceptance of
|
||||
these terms and conditions, and the Licensor grants You such rights in
|
||||
consideration of benefits the Licensor receives from making the
|
||||
Licensed Material available under these terms and conditions.
|
||||
|
||||
|
||||
Section 1 -- Definitions.
|
||||
|
||||
a. Adapted Material means material subject to Copyright and Similar
|
||||
Rights that is derived from or based upon the Licensed Material
|
||||
and in which the Licensed Material is translated, altered,
|
||||
arranged, transformed, or otherwise modified in a manner requiring
|
||||
permission under the Copyright and Similar Rights held by the
|
||||
Licensor. For purposes of this Public License, where the Licensed
|
||||
Material is a musical work, performance, or sound recording,
|
||||
Adapted Material is always produced where the Licensed Material is
|
||||
synched in timed relation with a moving image.
|
||||
|
||||
b. Adapter's License means the license You apply to Your Copyright
|
||||
and Similar Rights in Your contributions to Adapted Material in
|
||||
accordance with the terms and conditions of this Public License.
|
||||
|
||||
c. Copyright and Similar Rights means copyright and/or similar rights
|
||||
closely related to copyright including, without limitation,
|
||||
performance, broadcast, sound recording, and Sui Generis Database
|
||||
Rights, without regard to how the rights are labeled or
|
||||
categorized. For purposes of this Public License, the rights
|
||||
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
||||
Rights.
|
||||
|
||||
d. Effective Technological Measures means those measures that, in the
|
||||
absence of proper authority, may not be circumvented under laws
|
||||
fulfilling obligations under Article 11 of the WIPO Copyright
|
||||
Treaty adopted on December 20, 1996, and/or similar international
|
||||
agreements.
|
||||
|
||||
e. Exceptions and Limitations means fair use, fair dealing, and/or
|
||||
any other exception or limitation to Copyright and Similar Rights
|
||||
that applies to Your use of the Licensed Material.
|
||||
|
||||
f. Licensed Material means the artistic or literary work, database,
|
||||
or other material to which the Licensor applied this Public
|
||||
License.
|
||||
|
||||
g. Licensed Rights means the rights granted to You subject to the
|
||||
terms and conditions of this Public License, which are limited to
|
||||
all Copyright and Similar Rights that apply to Your use of the
|
||||
Licensed Material and that the Licensor has authority to license.
|
||||
|
||||
h. Licensor means the individual(s) or entity(ies) granting rights
|
||||
under this Public License.
|
||||
|
||||
i. Share means to provide material to the public by any means or
|
||||
process that requires permission under the Licensed Rights, such
|
||||
as reproduction, public display, public performance, distribution,
|
||||
dissemination, communication, or importation, and to make material
|
||||
available to the public including in ways that members of the
|
||||
public may access the material from a place and at a time
|
||||
individually chosen by them.
|
||||
|
||||
j. Sui Generis Database Rights means rights other than copyright
|
||||
resulting from Directive 96/9/EC of the European Parliament and of
|
||||
the Council of 11 March 1996 on the legal protection of databases,
|
||||
as amended and/or succeeded, as well as other essentially
|
||||
equivalent rights anywhere in the world.
|
||||
|
||||
k. You means the individual or entity exercising the Licensed Rights
|
||||
under this Public License. Your has a corresponding meaning.
|
||||
|
||||
|
||||
Section 2 -- Scope.
|
||||
|
||||
a. License grant.
|
||||
|
||||
1. Subject to the terms and conditions of this Public License,
|
||||
the Licensor hereby grants You a worldwide, royalty-free,
|
||||
non-sublicensable, non-exclusive, irrevocable license to
|
||||
exercise the Licensed Rights in the Licensed Material to:
|
||||
|
||||
a. reproduce and Share the Licensed Material, in whole or
|
||||
in part; and
|
||||
|
||||
b. produce, reproduce, and Share Adapted Material.
|
||||
|
||||
2. Exceptions and Limitations. For the avoidance of doubt, where
|
||||
Exceptions and Limitations apply to Your use, this Public
|
||||
License does not apply, and You do not need to comply with
|
||||
its terms and conditions.
|
||||
|
||||
3. Term. The term of this Public License is specified in Section
|
||||
6(a).
|
||||
|
||||
4. Media and formats; technical modifications allowed. The
|
||||
Licensor authorizes You to exercise the Licensed Rights in
|
||||
all media and formats whether now known or hereafter created,
|
||||
and to make technical modifications necessary to do so. The
|
||||
Licensor waives and/or agrees not to assert any right or
|
||||
authority to forbid You from making technical modifications
|
||||
necessary to exercise the Licensed Rights, including
|
||||
technical modifications necessary to circumvent Effective
|
||||
Technological Measures. For purposes of this Public License,
|
||||
simply making modifications authorized by this Section 2(a)
|
||||
(4) never produces Adapted Material.
|
||||
|
||||
5. Downstream recipients.
|
||||
|
||||
a. Offer from the Licensor -- Licensed Material. Every
|
||||
recipient of the Licensed Material automatically
|
||||
receives an offer from the Licensor to exercise the
|
||||
Licensed Rights under the terms and conditions of this
|
||||
Public License.
|
||||
|
||||
b. No downstream restrictions. You may not offer or impose
|
||||
any additional or different terms or conditions on, or
|
||||
apply any Effective Technological Measures to, the
|
||||
Licensed Material if doing so restricts exercise of the
|
||||
Licensed Rights by any recipient of the Licensed
|
||||
Material.
|
||||
|
||||
6. No endorsement. Nothing in this Public License constitutes or
|
||||
may be construed as permission to assert or imply that You
|
||||
are, or that Your use of the Licensed Material is, connected
|
||||
with, or sponsored, endorsed, or granted official status by,
|
||||
the Licensor or others designated to receive attribution as
|
||||
provided in Section 3(a)(1)(A)(i).
|
||||
|
||||
b. Other rights.
|
||||
|
||||
1. Moral rights, such as the right of integrity, are not
|
||||
licensed under this Public License, nor are publicity,
|
||||
privacy, and/or other similar personality rights; however, to
|
||||
the extent possible, the Licensor waives and/or agrees not to
|
||||
assert any such rights held by the Licensor to the limited
|
||||
extent necessary to allow You to exercise the Licensed
|
||||
Rights, but not otherwise.
|
||||
|
||||
2. Patent and trademark rights are not licensed under this
|
||||
Public License.
|
||||
|
||||
3. To the extent possible, the Licensor waives any right to
|
||||
collect royalties from You for the exercise of the Licensed
|
||||
Rights, whether directly or through a collecting society
|
||||
under any voluntary or waivable statutory or compulsory
|
||||
licensing scheme. In all other cases the Licensor expressly
|
||||
reserves any right to collect such royalties.
|
||||
|
||||
|
||||
Section 3 -- License Conditions.
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the
|
||||
following conditions.
|
||||
|
||||
a. Attribution.
|
||||
|
||||
1. If You Share the Licensed Material (including in modified
|
||||
form), You must:
|
||||
|
||||
a. retain the following if it is supplied by the Licensor
|
||||
with the Licensed Material:
|
||||
|
||||
i. identification of the creator(s) of the Licensed
|
||||
Material and any others designated to receive
|
||||
attribution, in any reasonable manner requested by
|
||||
the Licensor (including by pseudonym if
|
||||
designated);
|
||||
|
||||
ii. a copyright notice;
|
||||
|
||||
iii. a notice that refers to this Public License;
|
||||
|
||||
iv. a notice that refers to the disclaimer of
|
||||
warranties;
|
||||
|
||||
v. a URI or hyperlink to the Licensed Material to the
|
||||
extent reasonably practicable;
|
||||
|
||||
b. indicate if You modified the Licensed Material and
|
||||
retain an indication of any previous modifications; and
|
||||
|
||||
c. indicate the Licensed Material is licensed under this
|
||||
Public License, and include the text of, or the URI or
|
||||
hyperlink to, this Public License.
|
||||
|
||||
2. You may satisfy the conditions in Section 3(a)(1) in any
|
||||
reasonable manner based on the medium, means, and context in
|
||||
which You Share the Licensed Material. For example, it may be
|
||||
reasonable to satisfy the conditions by providing a URI or
|
||||
hyperlink to a resource that includes the required
|
||||
information.
|
||||
|
||||
3. If requested by the Licensor, You must remove any of the
|
||||
information required by Section 3(a)(1)(A) to the extent
|
||||
reasonably practicable.
|
||||
|
||||
4. If You Share Adapted Material You produce, the Adapter's
|
||||
License You apply must not prevent recipients of the Adapted
|
||||
Material from complying with this Public License.
|
||||
|
||||
|
||||
Section 4 -- Sui Generis Database Rights.
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that
|
||||
apply to Your use of the Licensed Material:
|
||||
|
||||
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
||||
to extract, reuse, reproduce, and Share all or a substantial
|
||||
portion of the contents of the database;
|
||||
|
||||
b. if You include all or a substantial portion of the database
|
||||
contents in a database in which You have Sui Generis Database
|
||||
Rights, then the database in which You have Sui Generis Database
|
||||
Rights (but not its individual contents) is Adapted Material; and
|
||||
|
||||
c. You must comply with the conditions in Section 3(a) if You Share
|
||||
all or a substantial portion of the contents of the database.
|
||||
|
||||
For the avoidance of doubt, this Section 4 supplements and does not
|
||||
replace Your obligations under this Public License where the Licensed
|
||||
Rights include other Copyright and Similar Rights.
|
||||
|
||||
|
||||
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
||||
|
||||
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
||||
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
||||
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
||||
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
||||
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
||||
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
||||
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
||||
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
||||
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
||||
|
||||
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
||||
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
||||
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
||||
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
||||
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
||||
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
||||
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
||||
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
||||
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
||||
|
||||
c. The disclaimer of warranties and limitation of liability provided
|
||||
above shall be interpreted in a manner that, to the extent
|
||||
possible, most closely approximates an absolute disclaimer and
|
||||
waiver of all liability.
|
||||
|
||||
|
||||
Section 6 -- Term and Termination.
|
||||
|
||||
a. This Public License applies for the term of the Copyright and
|
||||
Similar Rights licensed here. However, if You fail to comply with
|
||||
this Public License, then Your rights under this Public License
|
||||
terminate automatically.
|
||||
|
||||
b. Where Your right to use the Licensed Material has terminated under
|
||||
Section 6(a), it reinstates:
|
||||
|
||||
1. automatically as of the date the violation is cured, provided
|
||||
it is cured within 30 days of Your discovery of the
|
||||
violation; or
|
||||
|
||||
2. upon express reinstatement by the Licensor.
|
||||
|
||||
For the avoidance of doubt, this Section 6(b) does not affect any
|
||||
right the Licensor may have to seek remedies for Your violations
|
||||
of this Public License.
|
||||
|
||||
c. For the avoidance of doubt, the Licensor may also offer the
|
||||
Licensed Material under separate terms or conditions or stop
|
||||
distributing the Licensed Material at any time; however, doing so
|
||||
will not terminate this Public License.
|
||||
|
||||
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
||||
License.
|
||||
|
||||
|
||||
Section 7 -- Other Terms and Conditions.
|
||||
|
||||
a. The Licensor shall not be bound by any additional or different
|
||||
terms or conditions communicated by You unless expressly agreed.
|
||||
|
||||
b. Any arrangements, understandings, or agreements regarding the
|
||||
Licensed Material not stated herein are separate from and
|
||||
independent of the terms and conditions of this Public License.
|
||||
|
||||
|
||||
Section 8 -- Interpretation.
|
||||
|
||||
a. For the avoidance of doubt, this Public License does not, and
|
||||
shall not be interpreted to, reduce, limit, restrict, or impose
|
||||
conditions on any use of the Licensed Material that could lawfully
|
||||
be made without permission under this Public License.
|
||||
|
||||
b. To the extent possible, if any provision of this Public License is
|
||||
deemed unenforceable, it shall be automatically reformed to the
|
||||
minimum extent necessary to make it enforceable. If the provision
|
||||
cannot be reformed, it shall be severed from this Public License
|
||||
without affecting the enforceability of the remaining terms and
|
||||
conditions.
|
||||
|
||||
c. No term or condition of this Public License will be waived and no
|
||||
failure to comply consented to unless expressly agreed to by the
|
||||
Licensor.
|
||||
|
||||
d. Nothing in this Public License constitutes or may be interpreted
|
||||
as a limitation upon, or waiver of, any privileges and immunities
|
||||
that apply to the Licensor or You, including from the legal
|
||||
processes of any jurisdiction or authority.
|
||||
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons is not a party to its public
|
||||
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
||||
its public licenses to material it publishes and in those instances
|
||||
will be considered the “Licensor.” The text of the Creative Commons
|
||||
public licenses is dedicated to the public domain under the CC0 Public
|
||||
Domain Dedication. Except for the limited purpose of indicating that
|
||||
material is shared under a Creative Commons public license or as
|
||||
otherwise permitted by the Creative Commons policies published at
|
||||
creativecommons.org/policies, Creative Commons does not authorize the
|
||||
use of the trademark "Creative Commons" or any other trademark or logo
|
||||
of Creative Commons without its prior written consent including,
|
||||
without limitation, in connection with any unauthorized modifications
|
||||
to any of its public licenses or any other arrangements,
|
||||
understandings, or agreements concerning use of licensed material. For
|
||||
the avoidance of doubt, this paragraph does not form part of the
|
||||
public licenses.
|
||||
|
||||
Creative Commons may be contacted at creativecommons.org.
|
||||
@@ -0,0 +1,24 @@
|
||||
This collection of Native API header files has been maintained since 2009 for the Process Hacker project, and is the most up-to-date set of Native API definitions that we know of. We have gathered these definitions from official Microsoft header files and symbol files, as well as a lot of reverse engineering and guessing. See `phnt.h` for more information.
|
||||
|
||||
## Usage
|
||||
|
||||
First make sure that your program is using the latest Windows SDK.
|
||||
|
||||
These header files are designed to be used by user-mode programs. Instead of `#include <windows.h>`, place
|
||||
|
||||
```
|
||||
#include <phnt_windows.h>
|
||||
#include <phnt.h>
|
||||
```
|
||||
|
||||
at the top of your program. The first line provides access to the Win32 API as well as the `NTSTATUS` values. The second line provides access to the entire Native API. By default, only definitions present in Windows XP are included into your program. To change this, use one of the following:
|
||||
|
||||
```
|
||||
#define PHNT_VERSION PHNT_WINXP // Windows XP
|
||||
#define PHNT_VERSION PHNT_WS03 // Windows Server 2003
|
||||
#define PHNT_VERSION PHNT_VISTA // Windows Vista
|
||||
#define PHNT_VERSION PHNT_WIN7 // Windows 7
|
||||
#define PHNT_VERSION PHNT_WIN8 // Windows 8
|
||||
#define PHNT_VERSION PHNT_WINBLUE // Windows 8.1
|
||||
#define PHNT_VERSION PHNT_THRESHOLD // Windows 10
|
||||
```
|
||||
@@ -0,0 +1,377 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTDBG_H
|
||||
#define _NTDBG_H
|
||||
|
||||
// Debugging
|
||||
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
DbgUserBreakPoint(
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
DbgBreakPoint(
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
DbgBreakPointWithStatus(
|
||||
_In_ ULONG Status
|
||||
);
|
||||
|
||||
#define DBG_STATUS_CONTROL_C 1
|
||||
#define DBG_STATUS_SYSRQ 2
|
||||
#define DBG_STATUS_BUGCHECK_FIRST 3
|
||||
#define DBG_STATUS_BUGCHECK_SECOND 4
|
||||
#define DBG_STATUS_FATAL 5
|
||||
#define DBG_STATUS_DEBUG_CONTROL 6
|
||||
#define DBG_STATUS_WORKER 7
|
||||
|
||||
NTSYSAPI
|
||||
ULONG
|
||||
STDAPIVCALLTYPE
|
||||
DbgPrint(
|
||||
_In_z_ _Printf_format_string_ PSTR Format,
|
||||
...
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
ULONG
|
||||
STDAPIVCALLTYPE
|
||||
DbgPrintEx(
|
||||
_In_ ULONG ComponentId,
|
||||
_In_ ULONG Level,
|
||||
_In_z_ _Printf_format_string_ PSTR Format,
|
||||
...
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
ULONG
|
||||
NTAPI
|
||||
vDbgPrintEx(
|
||||
_In_ ULONG ComponentId,
|
||||
_In_ ULONG Level,
|
||||
_In_z_ PCH Format,
|
||||
_In_ va_list arglist
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
ULONG
|
||||
NTAPI
|
||||
vDbgPrintExWithPrefix(
|
||||
_In_z_ PCH Prefix,
|
||||
_In_ ULONG ComponentId,
|
||||
_In_ ULONG Level,
|
||||
_In_z_ PCH Format,
|
||||
_In_ va_list arglist
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DbgQueryDebugFilterState(
|
||||
_In_ ULONG ComponentId,
|
||||
_In_ ULONG Level
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DbgSetDebugFilterState(
|
||||
_In_ ULONG ComponentId,
|
||||
_In_ ULONG Level,
|
||||
_In_ BOOLEAN State
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
ULONG
|
||||
NTAPI
|
||||
DbgPrompt(
|
||||
_In_ PCH Prompt,
|
||||
_Out_writes_bytes_(Length) PCH Response,
|
||||
_In_ ULONG Length
|
||||
);
|
||||
|
||||
// Definitions
|
||||
|
||||
typedef struct _DBGKM_EXCEPTION
|
||||
{
|
||||
EXCEPTION_RECORD ExceptionRecord;
|
||||
ULONG FirstChance;
|
||||
} DBGKM_EXCEPTION, *PDBGKM_EXCEPTION;
|
||||
|
||||
typedef struct _DBGKM_CREATE_THREAD
|
||||
{
|
||||
ULONG SubSystemKey;
|
||||
PVOID StartAddress;
|
||||
} DBGKM_CREATE_THREAD, *PDBGKM_CREATE_THREAD;
|
||||
|
||||
typedef struct _DBGKM_CREATE_PROCESS
|
||||
{
|
||||
ULONG SubSystemKey;
|
||||
HANDLE FileHandle;
|
||||
PVOID BaseOfImage;
|
||||
ULONG DebugInfoFileOffset;
|
||||
ULONG DebugInfoSize;
|
||||
DBGKM_CREATE_THREAD InitialThread;
|
||||
} DBGKM_CREATE_PROCESS, *PDBGKM_CREATE_PROCESS;
|
||||
|
||||
typedef struct _DBGKM_EXIT_THREAD
|
||||
{
|
||||
NTSTATUS ExitStatus;
|
||||
} DBGKM_EXIT_THREAD, *PDBGKM_EXIT_THREAD;
|
||||
|
||||
typedef struct _DBGKM_EXIT_PROCESS
|
||||
{
|
||||
NTSTATUS ExitStatus;
|
||||
} DBGKM_EXIT_PROCESS, *PDBGKM_EXIT_PROCESS;
|
||||
|
||||
typedef struct _DBGKM_LOAD_DLL
|
||||
{
|
||||
HANDLE FileHandle;
|
||||
PVOID BaseOfDll;
|
||||
ULONG DebugInfoFileOffset;
|
||||
ULONG DebugInfoSize;
|
||||
PVOID NamePointer;
|
||||
} DBGKM_LOAD_DLL, *PDBGKM_LOAD_DLL;
|
||||
|
||||
typedef struct _DBGKM_UNLOAD_DLL
|
||||
{
|
||||
PVOID BaseAddress;
|
||||
} DBGKM_UNLOAD_DLL, *PDBGKM_UNLOAD_DLL;
|
||||
|
||||
typedef enum _DBG_STATE
|
||||
{
|
||||
DbgIdle,
|
||||
DbgReplyPending,
|
||||
DbgCreateThreadStateChange,
|
||||
DbgCreateProcessStateChange,
|
||||
DbgExitThreadStateChange,
|
||||
DbgExitProcessStateChange,
|
||||
DbgExceptionStateChange,
|
||||
DbgBreakpointStateChange,
|
||||
DbgSingleStepStateChange,
|
||||
DbgLoadDllStateChange,
|
||||
DbgUnloadDllStateChange
|
||||
} DBG_STATE, *PDBG_STATE;
|
||||
|
||||
typedef struct _DBGUI_CREATE_THREAD
|
||||
{
|
||||
HANDLE HandleToThread;
|
||||
DBGKM_CREATE_THREAD NewThread;
|
||||
} DBGUI_CREATE_THREAD, *PDBGUI_CREATE_THREAD;
|
||||
|
||||
typedef struct _DBGUI_CREATE_PROCESS
|
||||
{
|
||||
HANDLE HandleToProcess;
|
||||
HANDLE HandleToThread;
|
||||
DBGKM_CREATE_PROCESS NewProcess;
|
||||
} DBGUI_CREATE_PROCESS, *PDBGUI_CREATE_PROCESS;
|
||||
|
||||
typedef struct _DBGUI_WAIT_STATE_CHANGE
|
||||
{
|
||||
DBG_STATE NewState;
|
||||
CLIENT_ID AppClientId;
|
||||
union
|
||||
{
|
||||
DBGKM_EXCEPTION Exception;
|
||||
DBGUI_CREATE_THREAD CreateThread;
|
||||
DBGUI_CREATE_PROCESS CreateProcessInfo;
|
||||
DBGKM_EXIT_THREAD ExitThread;
|
||||
DBGKM_EXIT_PROCESS ExitProcess;
|
||||
DBGKM_LOAD_DLL LoadDll;
|
||||
DBGKM_UNLOAD_DLL UnloadDll;
|
||||
} StateInfo;
|
||||
} DBGUI_WAIT_STATE_CHANGE, *PDBGUI_WAIT_STATE_CHANGE;
|
||||
|
||||
#define DEBUG_READ_EVENT 0x0001
|
||||
#define DEBUG_PROCESS_ASSIGN 0x0002
|
||||
#define DEBUG_SET_INFORMATION 0x0004
|
||||
#define DEBUG_QUERY_INFORMATION 0x0008
|
||||
#define DEBUG_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \
|
||||
DEBUG_READ_EVENT | DEBUG_PROCESS_ASSIGN | DEBUG_SET_INFORMATION | \
|
||||
DEBUG_QUERY_INFORMATION)
|
||||
|
||||
#define DEBUG_KILL_ON_CLOSE 0x1
|
||||
|
||||
typedef enum _DEBUGOBJECTINFOCLASS
|
||||
{
|
||||
DebugObjectUnusedInformation,
|
||||
DebugObjectKillProcessOnExitInformation,
|
||||
MaxDebugObjectInfoClass
|
||||
} DEBUGOBJECTINFOCLASS, *PDEBUGOBJECTINFOCLASS;
|
||||
|
||||
// System calls
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateDebugObject(
|
||||
_Out_ PHANDLE DebugObjectHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_ ULONG Flags
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtDebugActiveProcess(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
_In_ HANDLE DebugObjectHandle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtDebugContinue(
|
||||
_In_ HANDLE DebugObjectHandle,
|
||||
_In_ PCLIENT_ID ClientId,
|
||||
_In_ NTSTATUS ContinueStatus
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRemoveProcessDebug(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
_In_ HANDLE DebugObjectHandle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetInformationDebugObject(
|
||||
_In_ HANDLE DebugObjectHandle,
|
||||
_In_ DEBUGOBJECTINFOCLASS DebugObjectInformationClass,
|
||||
_In_ PVOID DebugInformation,
|
||||
_In_ ULONG DebugInformationLength,
|
||||
_Out_opt_ PULONG ReturnLength
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtWaitForDebugEvent(
|
||||
_In_ HANDLE DebugObjectHandle,
|
||||
_In_ BOOLEAN Alertable,
|
||||
_In_opt_ PLARGE_INTEGER Timeout,
|
||||
_Out_ PDBGUI_WAIT_STATE_CHANGE WaitStateChange
|
||||
);
|
||||
|
||||
// Debugging UI
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DbgUiConnectToDbg(
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
HANDLE
|
||||
NTAPI
|
||||
DbgUiGetThreadDebugObject(
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
DbgUiSetThreadDebugObject(
|
||||
_In_ HANDLE DebugObject
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DbgUiWaitStateChange(
|
||||
_Out_ PDBGUI_WAIT_STATE_CHANGE StateChange,
|
||||
_In_opt_ PLARGE_INTEGER Timeout
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DbgUiContinue(
|
||||
_In_ PCLIENT_ID AppClientId,
|
||||
_In_ NTSTATUS ContinueStatus
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DbgUiStopDebugging(
|
||||
_In_ HANDLE Process
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DbgUiDebugActiveProcess(
|
||||
_In_ HANDLE Process
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
DbgUiRemoteBreakin(
|
||||
_In_ PVOID Context
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DbgUiIssueRemoteBreakin(
|
||||
_In_ HANDLE Process
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DbgUiConvertStateChangeStructure(
|
||||
_In_ PDBGUI_WAIT_STATE_CHANGE StateChange,
|
||||
_Out_ LPDEBUG_EVENT DebugEvent
|
||||
);
|
||||
|
||||
struct _EVENT_FILTER_DESCRIPTOR;
|
||||
|
||||
typedef VOID (NTAPI *PENABLECALLBACK)(
|
||||
_In_ LPCGUID SourceId,
|
||||
_In_ ULONG IsEnabled,
|
||||
_In_ UCHAR Level,
|
||||
_In_ ULONGLONG MatchAnyKeyword,
|
||||
_In_ ULONGLONG MatchAllKeyword,
|
||||
_In_opt_ struct _EVENT_FILTER_DESCRIPTOR *FilterData,
|
||||
_Inout_opt_ PVOID CallbackContext
|
||||
);
|
||||
|
||||
typedef ULONGLONG REGHANDLE, *PREGHANDLE;
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
EtwEventRegister(
|
||||
_In_ LPCGUID ProviderId,
|
||||
_In_opt_ PENABLECALLBACK EnableCallback,
|
||||
_In_opt_ PVOID CallbackContext,
|
||||
_Out_ PREGHANDLE RegHandle
|
||||
);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTGDI_H
|
||||
#define _NTGDI_H
|
||||
|
||||
#define GDI_MAX_HANDLE_COUNT 0x4000
|
||||
|
||||
#define GDI_HANDLE_INDEX_SHIFT 0
|
||||
#define GDI_HANDLE_INDEX_BITS 16
|
||||
#define GDI_HANDLE_INDEX_MASK 0xffff
|
||||
|
||||
#define GDI_HANDLE_TYPE_SHIFT 16
|
||||
#define GDI_HANDLE_TYPE_BITS 5
|
||||
#define GDI_HANDLE_TYPE_MASK 0x1f
|
||||
|
||||
#define GDI_HANDLE_ALTTYPE_SHIFT 21
|
||||
#define GDI_HANDLE_ALTTYPE_BITS 2
|
||||
#define GDI_HANDLE_ALTTYPE_MASK 0x3
|
||||
|
||||
#define GDI_HANDLE_STOCK_SHIFT 23
|
||||
#define GDI_HANDLE_STOCK_BITS 1
|
||||
#define GDI_HANDLE_STOCK_MASK 0x1
|
||||
|
||||
#define GDI_HANDLE_UNIQUE_SHIFT 24
|
||||
#define GDI_HANDLE_UNIQUE_BITS 8
|
||||
#define GDI_HANDLE_UNIQUE_MASK 0xff
|
||||
|
||||
#define GDI_HANDLE_INDEX(Handle) ((ULONG)(Handle) & GDI_HANDLE_INDEX_MASK)
|
||||
#define GDI_HANDLE_TYPE(Handle) (((ULONG)(Handle) >> GDI_HANDLE_TYPE_SHIFT) & GDI_HANDLE_TYPE_MASK)
|
||||
#define GDI_HANDLE_ALTTYPE(Handle) (((ULONG)(Handle) >> GDI_HANDLE_ALTTYPE_SHIFT) & GDI_HANDLE_ALTTYPE_MASK)
|
||||
#define GDI_HANDLE_STOCK(Handle) (((ULONG)(Handle) >> GDI_HANDLE_STOCK_SHIFT)) & GDI_HANDLE_STOCK_MASK)
|
||||
|
||||
#define GDI_MAKE_HANDLE(Index, Unique) ((ULONG)(((ULONG)(Unique) << GDI_HANDLE_INDEX_BITS) | (ULONG)(Index)))
|
||||
|
||||
// GDI server-side types
|
||||
|
||||
#define GDI_DEF_TYPE 0 // invalid handle
|
||||
#define GDI_DC_TYPE 1
|
||||
#define GDI_DD_DIRECTDRAW_TYPE 2
|
||||
#define GDI_DD_SURFACE_TYPE 3
|
||||
#define GDI_RGN_TYPE 4
|
||||
#define GDI_SURF_TYPE 5
|
||||
#define GDI_CLIENTOBJ_TYPE 6
|
||||
#define GDI_PATH_TYPE 7
|
||||
#define GDI_PAL_TYPE 8
|
||||
#define GDI_ICMLCS_TYPE 9
|
||||
#define GDI_LFONT_TYPE 10
|
||||
#define GDI_RFONT_TYPE 11
|
||||
#define GDI_PFE_TYPE 12
|
||||
#define GDI_PFT_TYPE 13
|
||||
#define GDI_ICMCXF_TYPE 14
|
||||
#define GDI_ICMDLL_TYPE 15
|
||||
#define GDI_BRUSH_TYPE 16
|
||||
#define GDI_PFF_TYPE 17 // unused
|
||||
#define GDI_CACHE_TYPE 18 // unused
|
||||
#define GDI_SPACE_TYPE 19
|
||||
#define GDI_DBRUSH_TYPE 20 // unused
|
||||
#define GDI_META_TYPE 21
|
||||
#define GDI_EFSTATE_TYPE 22
|
||||
#define GDI_BMFD_TYPE 23 // unused
|
||||
#define GDI_VTFD_TYPE 24 // unused
|
||||
#define GDI_TTFD_TYPE 25 // unused
|
||||
#define GDI_RC_TYPE 26 // unused
|
||||
#define GDI_TEMP_TYPE 27 // unused
|
||||
#define GDI_DRVOBJ_TYPE 28
|
||||
#define GDI_DCIOBJ_TYPE 29 // unused
|
||||
#define GDI_SPOOL_TYPE 30
|
||||
|
||||
// GDI client-side types
|
||||
|
||||
#define GDI_CLIENT_TYPE_FROM_HANDLE(Handle) ((ULONG)(Handle) & ((GDI_HANDLE_ALTTYPE_MASK << GDI_HANDLE_ALTTYPE_SHIFT) | \
|
||||
(GDI_HANDLE_TYPE_MASK << GDI_HANDLE_TYPE_SHIFT)))
|
||||
#define GDI_CLIENT_TYPE_FROM_UNIQUE(Unique) GDI_CLIENT_TYPE_FROM_HANDLE((ULONG)(Unique) << 16)
|
||||
|
||||
#define GDI_ALTTYPE_1 (1 << GDI_HANDLE_ALTTYPE_SHIFT)
|
||||
#define GDI_ALTTYPE_2 (2 << GDI_HANDLE_ALTTYPE_SHIFT)
|
||||
#define GDI_ALTTYPE_3 (3 << GDI_HANDLE_ALTTYPE_SHIFT)
|
||||
|
||||
#define GDI_CLIENT_BITMAP_TYPE (GDI_SURF_TYPE << GDI_HANDLE_TYPE_SHIFT)
|
||||
#define GDI_CLIENT_BRUSH_TYPE (GDI_BRUSH_TYPE << GDI_HANDLE_TYPE_SHIFT)
|
||||
#define GDI_CLIENT_CLIENTOBJ_TYPE (GDI_CLIENTOBJ_TYPE << GDI_HANDLE_TYPE_SHIFT)
|
||||
#define GDI_CLIENT_DC_TYPE (GDI_DC_TYPE << GDI_HANDLE_TYPE_SHIFT)
|
||||
#define GDI_CLIENT_FONT_TYPE (GDI_LFONT_TYPE << GDI_HANDLE_TYPE_SHIFT)
|
||||
#define GDI_CLIENT_PALETTE_TYPE (GDI_PAL_TYPE << GDI_HANDLE_TYPE_SHIFT)
|
||||
#define GDI_CLIENT_REGION_TYPE (GDI_RGN_TYPE << GDI_HANDLE_TYPE_SHIFT)
|
||||
|
||||
#define GDI_CLIENT_ALTDC_TYPE (GDI_CLIENT_DC_TYPE | GDI_ALTTYPE_1)
|
||||
#define GDI_CLIENT_DIBSECTION_TYPE (GDI_CLIENT_BITMAP_TYPE | GDI_ALTTYPE_1)
|
||||
#define GDI_CLIENT_EXTPEN_TYPE (GDI_CLIENT_BRUSH_TYPE | GDI_ALTTYPE_2)
|
||||
#define GDI_CLIENT_METADC16_TYPE (GDI_CLIENT_CLIENTOBJ_TYPE | GDI_ALTTYPE_3)
|
||||
#define GDI_CLIENT_METAFILE_TYPE (GDI_CLIENT_CLIENTOBJ_TYPE | GDI_ALTTYPE_2)
|
||||
#define GDI_CLIENT_METAFILE16_TYPE (GDI_CLIENT_CLIENTOBJ_TYPE | GDI_ALTTYPE_1)
|
||||
#define GDI_CLIENT_PEN_TYPE (GDI_CLIENT_BRUSH_TYPE | GDI_ALTTYPE_1)
|
||||
|
||||
typedef struct _GDI_HANDLE_ENTRY
|
||||
{
|
||||
union
|
||||
{
|
||||
PVOID Object;
|
||||
PVOID NextFree;
|
||||
};
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
USHORT ProcessId;
|
||||
USHORT Lock : 1;
|
||||
USHORT Count : 15;
|
||||
};
|
||||
ULONG Value;
|
||||
} Owner;
|
||||
USHORT Unique;
|
||||
UCHAR Type;
|
||||
UCHAR Flags;
|
||||
PVOID UserPointer;
|
||||
} GDI_HANDLE_ENTRY, *PGDI_HANDLE_ENTRY;
|
||||
|
||||
typedef struct _GDI_SHARED_MEMORY
|
||||
{
|
||||
GDI_HANDLE_ENTRY Handles[GDI_MAX_HANDLE_COUNT];
|
||||
} GDI_SHARED_MEMORY, *PGDI_SHARED_MEMORY;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTKEAPI_H
|
||||
#define _NTKEAPI_H
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
#define LOW_PRIORITY 0 // Lowest thread priority level
|
||||
#define LOW_REALTIME_PRIORITY 16 // Lowest realtime priority level
|
||||
#define HIGH_PRIORITY 31 // Highest thread priority level
|
||||
#define MAXIMUM_PRIORITY 32 // Number of thread priority levels
|
||||
#endif
|
||||
|
||||
typedef enum _KTHREAD_STATE
|
||||
{
|
||||
Initialized,
|
||||
Ready,
|
||||
Running,
|
||||
Standby,
|
||||
Terminated,
|
||||
Waiting,
|
||||
Transition,
|
||||
DeferredReady,
|
||||
GateWaitObsolete,
|
||||
WaitingForProcessInSwap,
|
||||
MaximumThreadState
|
||||
} KTHREAD_STATE, *PKTHREAD_STATE;
|
||||
|
||||
// private
|
||||
typedef enum _KHETERO_CPU_POLICY
|
||||
{
|
||||
KHeteroCpuPolicyAll,
|
||||
KHeteroCpuPolicyLarge,
|
||||
KHeteroCpuPolicyLargeOrIdle,
|
||||
KHeteroCpuPolicySmall,
|
||||
KHeteroCpuPolicySmallOrIdle,
|
||||
KHeteroCpuPolicyDynamic,
|
||||
KHeteroCpuPolicyStaticMax,
|
||||
KHeteroCpuPolicyBiasedSmall,
|
||||
KHeteroCpuPolicyBiasedLarge,
|
||||
KHeteroCpuPolicyDefault,
|
||||
KHeteroCpuPolicyMax
|
||||
} KHETERO_CPU_POLICY, *PKHETERO_CPU_POLICY;
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
|
||||
typedef enum _KWAIT_REASON
|
||||
{
|
||||
Executive,
|
||||
FreePage,
|
||||
PageIn,
|
||||
PoolAllocation,
|
||||
DelayExecution,
|
||||
Suspended,
|
||||
UserRequest,
|
||||
WrExecutive,
|
||||
WrFreePage,
|
||||
WrPageIn,
|
||||
WrPoolAllocation,
|
||||
WrDelayExecution,
|
||||
WrSuspended,
|
||||
WrUserRequest,
|
||||
WrEventPair,
|
||||
WrQueue,
|
||||
WrLpcReceive,
|
||||
WrLpcReply,
|
||||
WrVirtualMemory,
|
||||
WrPageOut,
|
||||
WrRendezvous,
|
||||
WrKeyedEvent,
|
||||
WrTerminated,
|
||||
WrProcessInSwap,
|
||||
WrCpuRateControl,
|
||||
WrCalloutStack,
|
||||
WrKernel,
|
||||
WrResource,
|
||||
WrPushLock,
|
||||
WrMutex,
|
||||
WrQuantumEnd,
|
||||
WrDispatchInt,
|
||||
WrPreempted,
|
||||
WrYieldExecution,
|
||||
WrFastMutex,
|
||||
WrGuardedMutex,
|
||||
WrRundown,
|
||||
WrAlertByThreadId,
|
||||
WrDeferredPreempt,
|
||||
MaximumWaitReason
|
||||
} KWAIT_REASON, *PKWAIT_REASON;
|
||||
|
||||
typedef enum _KPROFILE_SOURCE
|
||||
{
|
||||
ProfileTime,
|
||||
ProfileAlignmentFixup,
|
||||
ProfileTotalIssues,
|
||||
ProfilePipelineDry,
|
||||
ProfileLoadInstructions,
|
||||
ProfilePipelineFrozen,
|
||||
ProfileBranchInstructions,
|
||||
ProfileTotalNonissues,
|
||||
ProfileDcacheMisses,
|
||||
ProfileIcacheMisses,
|
||||
ProfileCacheMisses,
|
||||
ProfileBranchMispredictions,
|
||||
ProfileStoreInstructions,
|
||||
ProfileFpInstructions,
|
||||
ProfileIntegerInstructions,
|
||||
Profile2Issue,
|
||||
Profile3Issue,
|
||||
Profile4Issue,
|
||||
ProfileSpecialInstructions,
|
||||
ProfileTotalCycles,
|
||||
ProfileIcacheIssues,
|
||||
ProfileDcacheAccesses,
|
||||
ProfileMemoryBarrierCycles,
|
||||
ProfileLoadLinkedIssues,
|
||||
ProfileMaximum
|
||||
} KPROFILE_SOURCE;
|
||||
|
||||
#endif
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCallbackReturn(
|
||||
_In_reads_bytes_opt_(OutputLength) PVOID OutputBuffer,
|
||||
_In_ ULONG OutputLength,
|
||||
_In_ NTSTATUS Status
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
VOID
|
||||
NTAPI
|
||||
NtFlushProcessWriteBuffers(
|
||||
VOID
|
||||
);
|
||||
#endif
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQueryDebugFilterState(
|
||||
_In_ ULONG ComponentId,
|
||||
_In_ ULONG Level
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetDebugFilterState(
|
||||
_In_ ULONG ComponentId,
|
||||
_In_ ULONG Level,
|
||||
_In_ BOOLEAN State
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtYieldExecution(
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,951 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTLDR_H
|
||||
#define _NTLDR_H
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
|
||||
// DLLs
|
||||
|
||||
typedef BOOLEAN (NTAPI *PLDR_INIT_ROUTINE)(
|
||||
_In_ PVOID DllHandle,
|
||||
_In_ ULONG Reason,
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
// symbols
|
||||
typedef struct _LDR_SERVICE_TAG_RECORD
|
||||
{
|
||||
struct _LDR_SERVICE_TAG_RECORD *Next;
|
||||
ULONG ServiceTag;
|
||||
} LDR_SERVICE_TAG_RECORD, *PLDR_SERVICE_TAG_RECORD;
|
||||
|
||||
// symbols
|
||||
typedef struct _LDRP_CSLIST
|
||||
{
|
||||
PSINGLE_LIST_ENTRY Tail;
|
||||
} LDRP_CSLIST, *PLDRP_CSLIST;
|
||||
|
||||
// symbols
|
||||
typedef enum _LDR_DDAG_STATE
|
||||
{
|
||||
LdrModulesMerged = -5,
|
||||
LdrModulesInitError = -4,
|
||||
LdrModulesSnapError = -3,
|
||||
LdrModulesUnloaded = -2,
|
||||
LdrModulesUnloading = -1,
|
||||
LdrModulesPlaceHolder = 0,
|
||||
LdrModulesMapping = 1,
|
||||
LdrModulesMapped = 2,
|
||||
LdrModulesWaitingForDependencies = 3,
|
||||
LdrModulesSnapping = 4,
|
||||
LdrModulesSnapped = 5,
|
||||
LdrModulesCondensed = 6,
|
||||
LdrModulesReadyToInit = 7,
|
||||
LdrModulesInitializing = 8,
|
||||
LdrModulesReadyToRun = 9
|
||||
} LDR_DDAG_STATE;
|
||||
|
||||
// symbols
|
||||
typedef struct _LDR_DDAG_NODE
|
||||
{
|
||||
LIST_ENTRY Modules;
|
||||
PLDR_SERVICE_TAG_RECORD ServiceTagList;
|
||||
ULONG LoadCount;
|
||||
ULONG LoadWhileUnloadingCount;
|
||||
ULONG LowestLink;
|
||||
union
|
||||
{
|
||||
LDRP_CSLIST Dependencies;
|
||||
SINGLE_LIST_ENTRY RemovalLink;
|
||||
};
|
||||
LDRP_CSLIST IncomingDependencies;
|
||||
LDR_DDAG_STATE State;
|
||||
SINGLE_LIST_ENTRY CondenseLink;
|
||||
ULONG PreorderNumber;
|
||||
} LDR_DDAG_NODE, *PLDR_DDAG_NODE;
|
||||
|
||||
// rev
|
||||
typedef struct _LDR_DEPENDENCY_RECORD
|
||||
{
|
||||
SINGLE_LIST_ENTRY DependencyLink;
|
||||
PLDR_DDAG_NODE DependencyNode;
|
||||
SINGLE_LIST_ENTRY IncomingDependencyLink;
|
||||
PLDR_DDAG_NODE IncomingDependencyNode;
|
||||
} LDR_DEPENDENCY_RECORD, *PLDR_DEPENDENCY_RECORD;
|
||||
|
||||
// symbols
|
||||
typedef enum _LDR_DLL_LOAD_REASON
|
||||
{
|
||||
LoadReasonStaticDependency,
|
||||
LoadReasonStaticForwarderDependency,
|
||||
LoadReasonDynamicForwarderDependency,
|
||||
LoadReasonDelayloadDependency,
|
||||
LoadReasonDynamicLoad,
|
||||
LoadReasonAsImageLoad,
|
||||
LoadReasonAsDataLoad,
|
||||
LoadReasonEnclavePrimary, // REDSTONE3
|
||||
LoadReasonEnclaveDependency,
|
||||
LoadReasonUnknown = -1
|
||||
} LDR_DLL_LOAD_REASON, *PLDR_DLL_LOAD_REASON;
|
||||
|
||||
#define LDRP_PACKAGED_BINARY 0x00000001
|
||||
#define LDRP_STATIC_LINK 0x00000002
|
||||
#define LDRP_IMAGE_DLL 0x00000004
|
||||
#define LDRP_LOAD_IN_PROGRESS 0x00001000
|
||||
#define LDRP_UNLOAD_IN_PROGRESS 0x00002000
|
||||
#define LDRP_ENTRY_PROCESSED 0x00004000
|
||||
#define LDRP_ENTRY_INSERTED 0x00008000
|
||||
#define LDRP_CURRENT_LOAD 0x00010000
|
||||
#define LDRP_FAILED_BUILTIN_LOAD 0x00020000
|
||||
#define LDRP_DONT_CALL_FOR_THREADS 0x00040000
|
||||
#define LDRP_PROCESS_ATTACH_CALLED 0x00080000
|
||||
#define LDRP_DEBUG_SYMBOLS_LOADED 0x00100000
|
||||
#define LDRP_IMAGE_NOT_AT_BASE 0x00200000 // Vista and below
|
||||
#define LDRP_COR_IMAGE 0x00400000
|
||||
#define LDRP_DONT_RELOCATE 0x00800000 // LDR_COR_OWNS_UNMAP
|
||||
#define LDRP_SYSTEM_MAPPED 0x01000000
|
||||
#define LDRP_IMAGE_VERIFYING 0x02000000
|
||||
#define LDRP_DRIVER_DEPENDENT_DLL 0x04000000
|
||||
#define LDRP_ENTRY_NATIVE 0x08000000
|
||||
#define LDRP_REDIRECTED 0x10000000
|
||||
#define LDRP_NON_PAGED_DEBUG_INFO 0x20000000
|
||||
#define LDRP_MM_LOADED 0x40000000
|
||||
#define LDRP_COMPAT_DATABASE_PROCESSED 0x80000000
|
||||
|
||||
#define LDR_DATA_TABLE_ENTRY_SIZE_WINXP FIELD_OFFSET(LDR_DATA_TABLE_ENTRY, DdagNode)
|
||||
#define LDR_DATA_TABLE_ENTRY_SIZE_WIN7 FIELD_OFFSET(LDR_DATA_TABLE_ENTRY, BaseNameHashValue)
|
||||
#define LDR_DATA_TABLE_ENTRY_SIZE_WIN8 FIELD_OFFSET(LDR_DATA_TABLE_ENTRY, ImplicitPathOptions)
|
||||
#define LDR_DATA_TABLE_ENTRY_SIZE_WIN10 sizeof(LDR_DATA_TABLE_ENTRY)
|
||||
|
||||
// symbols
|
||||
typedef struct _LDR_DATA_TABLE_ENTRY
|
||||
{
|
||||
LIST_ENTRY InLoadOrderLinks;
|
||||
LIST_ENTRY InMemoryOrderLinks;
|
||||
union
|
||||
{
|
||||
LIST_ENTRY InInitializationOrderLinks;
|
||||
LIST_ENTRY InProgressLinks;
|
||||
};
|
||||
PVOID DllBase;
|
||||
PLDR_INIT_ROUTINE EntryPoint;
|
||||
ULONG SizeOfImage;
|
||||
UNICODE_STRING FullDllName;
|
||||
UNICODE_STRING BaseDllName;
|
||||
union
|
||||
{
|
||||
UCHAR FlagGroup[4];
|
||||
ULONG Flags;
|
||||
struct
|
||||
{
|
||||
ULONG PackagedBinary : 1;
|
||||
ULONG MarkedForRemoval : 1;
|
||||
ULONG ImageDll : 1;
|
||||
ULONG LoadNotificationsSent : 1;
|
||||
ULONG TelemetryEntryProcessed : 1;
|
||||
ULONG ProcessStaticImport : 1;
|
||||
ULONG InLegacyLists : 1;
|
||||
ULONG InIndexes : 1;
|
||||
ULONG ShimDll : 1;
|
||||
ULONG InExceptionTable : 1;
|
||||
ULONG ReservedFlags1 : 2;
|
||||
ULONG LoadInProgress : 1;
|
||||
ULONG LoadConfigProcessed : 1;
|
||||
ULONG EntryProcessed : 1;
|
||||
ULONG ProtectDelayLoad : 1;
|
||||
ULONG ReservedFlags3 : 2;
|
||||
ULONG DontCallForThreads : 1;
|
||||
ULONG ProcessAttachCalled : 1;
|
||||
ULONG ProcessAttachFailed : 1;
|
||||
ULONG CorDeferredValidate : 1;
|
||||
ULONG CorImage : 1;
|
||||
ULONG DontRelocate : 1;
|
||||
ULONG CorILOnly : 1;
|
||||
ULONG ChpeImage : 1;
|
||||
ULONG ReservedFlags5 : 2;
|
||||
ULONG Redirected : 1;
|
||||
ULONG ReservedFlags6 : 2;
|
||||
ULONG CompatDatabaseProcessed : 1;
|
||||
};
|
||||
};
|
||||
USHORT ObsoleteLoadCount;
|
||||
USHORT TlsIndex;
|
||||
LIST_ENTRY HashLinks;
|
||||
ULONG TimeDateStamp;
|
||||
struct _ACTIVATION_CONTEXT *EntryPointActivationContext;
|
||||
PVOID Lock; // RtlAcquireSRWLockExclusive
|
||||
PLDR_DDAG_NODE DdagNode;
|
||||
LIST_ENTRY NodeModuleLink;
|
||||
struct _LDRP_LOAD_CONTEXT *LoadContext;
|
||||
PVOID ParentDllBase;
|
||||
PVOID SwitchBackContext;
|
||||
RTL_BALANCED_NODE BaseAddressIndexNode;
|
||||
RTL_BALANCED_NODE MappingInfoIndexNode;
|
||||
ULONG_PTR OriginalBase;
|
||||
LARGE_INTEGER LoadTime;
|
||||
ULONG BaseNameHashValue;
|
||||
LDR_DLL_LOAD_REASON LoadReason;
|
||||
ULONG ImplicitPathOptions;
|
||||
ULONG ReferenceCount;
|
||||
ULONG DependentLoadFlags;
|
||||
UCHAR SigningLevel; // since REDSTONE2
|
||||
} LDR_DATA_TABLE_ENTRY, *PLDR_DATA_TABLE_ENTRY;
|
||||
|
||||
#define LDR_IS_DATAFILE(DllHandle) (((ULONG_PTR)(DllHandle)) & (ULONG_PTR)1)
|
||||
#define LDR_IS_IMAGEMAPPING(DllHandle) (((ULONG_PTR)(DllHandle)) & (ULONG_PTR)2)
|
||||
#define LDR_IS_RESOURCE(DllHandle) (LDR_IS_IMAGEMAPPING(DllHandle) || LDR_IS_DATAFILE(DllHandle))
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrLoadDll(
|
||||
_In_opt_ PWSTR DllPath,
|
||||
_In_opt_ PULONG DllCharacteristics,
|
||||
_In_ PUNICODE_STRING DllName,
|
||||
_Out_ PVOID *DllHandle
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrUnloadDll(
|
||||
_In_ PVOID DllHandle
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrGetDllHandle(
|
||||
_In_opt_ PWSTR DllPath,
|
||||
_In_opt_ PULONG DllCharacteristics,
|
||||
_In_ PUNICODE_STRING DllName,
|
||||
_Out_ PVOID *DllHandle
|
||||
);
|
||||
|
||||
#define LDR_GET_DLL_HANDLE_EX_UNCHANGED_REFCOUNT 0x00000001
|
||||
#define LDR_GET_DLL_HANDLE_EX_PIN 0x00000002
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrGetDllHandleEx(
|
||||
_In_ ULONG Flags,
|
||||
_In_opt_ PWSTR DllPath,
|
||||
_In_opt_ PULONG DllCharacteristics,
|
||||
_In_ PUNICODE_STRING DllName,
|
||||
_Out_opt_ PVOID *DllHandle
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN7)
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrGetDllHandleByMapping(
|
||||
_In_ PVOID BaseAddress,
|
||||
_Out_ PVOID *DllHandle
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN7)
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrGetDllHandleByName(
|
||||
_In_opt_ PUNICODE_STRING BaseDllName,
|
||||
_In_opt_ PUNICODE_STRING FullDllName,
|
||||
_Out_ PVOID *DllHandle
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN8)
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrGetDllFullName(
|
||||
_In_ PVOID DllHandle,
|
||||
_Out_ PUNICODE_STRING FullDllName
|
||||
);
|
||||
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrGetDllDirectory(
|
||||
_Out_ PUNICODE_STRING DllDirectory
|
||||
);
|
||||
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrSetDllDirectory(
|
||||
_In_ PUNICODE_STRING DllDirectory
|
||||
);
|
||||
#endif
|
||||
|
||||
#define LDR_ADDREF_DLL_PIN 0x00000001
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrAddRefDll(
|
||||
_In_ ULONG Flags,
|
||||
_In_ PVOID DllHandle
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrGetProcedureAddress(
|
||||
_In_ PVOID DllHandle,
|
||||
_In_opt_ PANSI_STRING ProcedureName,
|
||||
_In_opt_ ULONG ProcedureNumber,
|
||||
_Out_ PVOID *ProcedureAddress
|
||||
);
|
||||
|
||||
// rev
|
||||
#define LDR_GET_PROCEDURE_ADDRESS_DONT_RECORD_FORWARDER 0x00000001
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
// private
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrGetProcedureAddressEx(
|
||||
_In_ PVOID DllHandle,
|
||||
_In_opt_ PANSI_STRING ProcedureName,
|
||||
_In_opt_ ULONG ProcedureNumber,
|
||||
_Out_ PVOID *ProcedureAddress,
|
||||
_In_ ULONG Flags
|
||||
);
|
||||
#endif
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrGetKnownDllSectionHandle(
|
||||
_In_ PCWSTR DllName,
|
||||
_In_ BOOLEAN KnownDlls32,
|
||||
_Out_ PHANDLE Section
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_THRESHOLD)
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrGetProcedureAddressForCaller(
|
||||
_In_ PVOID DllHandle,
|
||||
_In_opt_ PANSI_STRING ProcedureName,
|
||||
_In_opt_ ULONG ProcedureNumber,
|
||||
_Out_ PVOID *ProcedureAddress,
|
||||
_In_ ULONG Flags,
|
||||
_In_ PVOID *Callback
|
||||
);
|
||||
#endif
|
||||
|
||||
#define LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS 0x00000001
|
||||
#define LDR_LOCK_LOADER_LOCK_FLAG_TRY_ONLY 0x00000002
|
||||
|
||||
#define LDR_LOCK_LOADER_LOCK_DISPOSITION_INVALID 0
|
||||
#define LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_ACQUIRED 1
|
||||
#define LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_NOT_ACQUIRED 2
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrLockLoaderLock(
|
||||
_In_ ULONG Flags,
|
||||
_Out_opt_ ULONG *Disposition,
|
||||
_Out_ PVOID *Cookie
|
||||
);
|
||||
|
||||
#define LDR_UNLOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS 0x00000001
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrUnlockLoaderLock(
|
||||
_In_ ULONG Flags,
|
||||
_Inout_ PVOID Cookie
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrRelocateImage(
|
||||
_In_ PVOID NewBase,
|
||||
_In_ PSTR LoaderName,
|
||||
_In_ NTSTATUS Success,
|
||||
_In_ NTSTATUS Conflict,
|
||||
_In_ NTSTATUS Invalid
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrRelocateImageWithBias(
|
||||
_In_ PVOID NewBase,
|
||||
_In_ LONGLONG Bias,
|
||||
_In_ PSTR LoaderName,
|
||||
_In_ NTSTATUS Success,
|
||||
_In_ NTSTATUS Conflict,
|
||||
_In_ NTSTATUS Invalid
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
PIMAGE_BASE_RELOCATION
|
||||
NTAPI
|
||||
LdrProcessRelocationBlock(
|
||||
_In_ ULONG_PTR VA,
|
||||
_In_ ULONG SizeOfBlock,
|
||||
_In_ PUSHORT NextOffset,
|
||||
_In_ LONG_PTR Diff
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
LdrVerifyMappedImageMatchesChecksum(
|
||||
_In_ PVOID BaseAddress,
|
||||
_In_ SIZE_T NumberOfBytes,
|
||||
_In_ ULONG FileLength
|
||||
);
|
||||
|
||||
typedef VOID (NTAPI *PLDR_IMPORT_MODULE_CALLBACK)(
|
||||
_In_ PVOID Parameter,
|
||||
_In_ PSTR ModuleName
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrVerifyImageMatchesChecksum(
|
||||
_In_ HANDLE ImageFileHandle,
|
||||
_In_opt_ PLDR_IMPORT_MODULE_CALLBACK ImportCallbackRoutine,
|
||||
_In_ PVOID ImportCallbackParameter,
|
||||
_Out_opt_ PUSHORT ImageCharacteristics
|
||||
);
|
||||
|
||||
// private
|
||||
typedef struct _LDR_IMPORT_CALLBACK_INFO
|
||||
{
|
||||
PLDR_IMPORT_MODULE_CALLBACK ImportCallbackRoutine;
|
||||
PVOID ImportCallbackParameter;
|
||||
} LDR_IMPORT_CALLBACK_INFO, *PLDR_IMPORT_CALLBACK_INFO;
|
||||
|
||||
// private
|
||||
typedef struct _LDR_SECTION_INFO
|
||||
{
|
||||
HANDLE SectionHandle;
|
||||
ACCESS_MASK DesiredAccess;
|
||||
POBJECT_ATTRIBUTES ObjA;
|
||||
ULONG SectionPageProtection;
|
||||
ULONG AllocationAttributes;
|
||||
} LDR_SECTION_INFO, *PLDR_SECTION_INFO;
|
||||
|
||||
// private
|
||||
typedef struct _LDR_VERIFY_IMAGE_INFO
|
||||
{
|
||||
ULONG Size;
|
||||
ULONG Flags;
|
||||
LDR_IMPORT_CALLBACK_INFO CallbackInfo;
|
||||
LDR_SECTION_INFO SectionInfo;
|
||||
USHORT ImageCharacteristics;
|
||||
} LDR_VERIFY_IMAGE_INFO, *PLDR_VERIFY_IMAGE_INFO;
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
// private
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrVerifyImageMatchesChecksumEx(
|
||||
_In_ HANDLE ImageFileHandle,
|
||||
_Inout_ PLDR_VERIFY_IMAGE_INFO VerifyInfo
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
// private
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrQueryModuleServiceTags(
|
||||
_In_ PVOID DllHandle,
|
||||
_Out_writes_(*BufferSize) PULONG ServiceTagBuffer,
|
||||
_Inout_ PULONG BufferSize
|
||||
);
|
||||
#endif
|
||||
|
||||
// begin_msdn:"DLL Load Notification"
|
||||
|
||||
#define LDR_DLL_NOTIFICATION_REASON_LOADED 1
|
||||
#define LDR_DLL_NOTIFICATION_REASON_UNLOADED 2
|
||||
|
||||
typedef struct _LDR_DLL_LOADED_NOTIFICATION_DATA
|
||||
{
|
||||
ULONG Flags;
|
||||
PUNICODE_STRING FullDllName;
|
||||
PUNICODE_STRING BaseDllName;
|
||||
PVOID DllBase;
|
||||
ULONG SizeOfImage;
|
||||
} LDR_DLL_LOADED_NOTIFICATION_DATA, *PLDR_DLL_LOADED_NOTIFICATION_DATA;
|
||||
|
||||
typedef struct _LDR_DLL_UNLOADED_NOTIFICATION_DATA
|
||||
{
|
||||
ULONG Flags;
|
||||
PCUNICODE_STRING FullDllName;
|
||||
PCUNICODE_STRING BaseDllName;
|
||||
PVOID DllBase;
|
||||
ULONG SizeOfImage;
|
||||
} LDR_DLL_UNLOADED_NOTIFICATION_DATA, *PLDR_DLL_UNLOADED_NOTIFICATION_DATA;
|
||||
|
||||
typedef union _LDR_DLL_NOTIFICATION_DATA
|
||||
{
|
||||
LDR_DLL_LOADED_NOTIFICATION_DATA Loaded;
|
||||
LDR_DLL_UNLOADED_NOTIFICATION_DATA Unloaded;
|
||||
} LDR_DLL_NOTIFICATION_DATA, *PLDR_DLL_NOTIFICATION_DATA;
|
||||
|
||||
typedef VOID (NTAPI *PLDR_DLL_NOTIFICATION_FUNCTION)(
|
||||
_In_ ULONG NotificationReason,
|
||||
_In_ PLDR_DLL_NOTIFICATION_DATA NotificationData,
|
||||
_In_opt_ PVOID Context
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrRegisterDllNotification(
|
||||
_In_ ULONG Flags,
|
||||
_In_ PLDR_DLL_NOTIFICATION_FUNCTION NotificationFunction,
|
||||
_In_ PVOID Context,
|
||||
_Out_ PVOID *Cookie
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrUnregisterDllNotification(
|
||||
_In_ PVOID Cookie
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
// end_msdn
|
||||
|
||||
// rev
|
||||
NTSYSAPI
|
||||
PUNICODE_STRING
|
||||
NTAPI
|
||||
LdrStandardizeSystemPath(
|
||||
_In_ PUNICODE_STRING SystemPath
|
||||
);
|
||||
|
||||
// private
|
||||
typedef struct _PS_MITIGATION_OPTIONS_MAP
|
||||
{
|
||||
ULONG_PTR Map[2];
|
||||
} PS_MITIGATION_OPTIONS_MAP, *PPS_MITIGATION_OPTIONS_MAP;
|
||||
|
||||
// private
|
||||
typedef struct _PS_MITIGATION_AUDIT_OPTIONS_MAP
|
||||
{
|
||||
ULONG_PTR Map[2];
|
||||
} PS_MITIGATION_AUDIT_OPTIONS_MAP, *PPS_MITIGATION_AUDIT_OPTIONS_MAP;
|
||||
|
||||
// private
|
||||
typedef struct _PS_SYSTEM_DLL_INIT_BLOCK
|
||||
{
|
||||
ULONG Size;
|
||||
ULONG_PTR SystemDllWowRelocation;
|
||||
ULONG_PTR SystemDllNativeRelocation;
|
||||
ULONG_PTR Wow64SharedInformation[16];
|
||||
ULONG RngData;
|
||||
union
|
||||
{
|
||||
ULONG Flags;
|
||||
struct
|
||||
{
|
||||
ULONG CfgOverride : 1;
|
||||
ULONG Reserved : 31;
|
||||
};
|
||||
};
|
||||
PS_MITIGATION_OPTIONS_MAP MitigationOptionsMap;
|
||||
ULONG_PTR CfgBitMap;
|
||||
ULONG_PTR CfgBitMapSize;
|
||||
ULONG_PTR Wow64CfgBitMap;
|
||||
ULONG_PTR Wow64CfgBitMapSize;
|
||||
PS_MITIGATION_AUDIT_OPTIONS_MAP MitigationAuditOptionsMap; // REDSTONE3
|
||||
} PS_SYSTEM_DLL_INIT_BLOCK, *PPS_SYSTEM_DLL_INIT_BLOCK;
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_THRESHOLD)
|
||||
// rev
|
||||
NTSYSAPI
|
||||
PPS_SYSTEM_DLL_INIT_BLOCK
|
||||
NTAPI
|
||||
LdrSystemDllInitBlock(
|
||||
VOID
|
||||
);
|
||||
#endif
|
||||
|
||||
// Load as data table
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
|
||||
// private
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrAddLoadAsDataTable(
|
||||
_In_ PVOID Module,
|
||||
_In_ PWSTR FilePath,
|
||||
_In_ SIZE_T Size,
|
||||
_In_ HANDLE Handle
|
||||
);
|
||||
|
||||
// private
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrRemoveLoadAsDataTable(
|
||||
_In_ PVOID InitModule,
|
||||
_Out_opt_ PVOID *BaseModule,
|
||||
_Out_opt_ PSIZE_T Size,
|
||||
_In_ ULONG Flags
|
||||
);
|
||||
|
||||
// private
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrGetFileNameFromLoadAsDataTable(
|
||||
_In_ PVOID Module,
|
||||
_Out_ PVOID *pFileNamePrt
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrDisableThreadCalloutsForDll(
|
||||
_In_ PVOID DllImageBase
|
||||
);
|
||||
|
||||
// Resources
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrAccessResource(
|
||||
_In_ PVOID DllHandle,
|
||||
_In_ PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry,
|
||||
_Out_opt_ PVOID *ResourceBuffer,
|
||||
_Out_opt_ ULONG *ResourceLength
|
||||
);
|
||||
|
||||
typedef struct _LDR_RESOURCE_INFO
|
||||
{
|
||||
ULONG_PTR Type;
|
||||
ULONG_PTR Name;
|
||||
ULONG_PTR Language;
|
||||
} LDR_RESOURCE_INFO, *PLDR_RESOURCE_INFO;
|
||||
|
||||
#define RESOURCE_TYPE_LEVEL 0
|
||||
#define RESOURCE_NAME_LEVEL 1
|
||||
#define RESOURCE_LANGUAGE_LEVEL 2
|
||||
#define RESOURCE_DATA_LEVEL 3
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrFindResource_U(
|
||||
_In_ PVOID DllHandle,
|
||||
_In_ PLDR_RESOURCE_INFO ResourceInfo,
|
||||
_In_ ULONG Level,
|
||||
_Out_ PIMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrFindResourceDirectory_U(
|
||||
_In_ PVOID DllHandle,
|
||||
_In_ PLDR_RESOURCE_INFO ResourceInfo,
|
||||
_In_ ULONG Level,
|
||||
_Out_ PIMAGE_RESOURCE_DIRECTORY *ResourceDirectory
|
||||
);
|
||||
|
||||
// private
|
||||
typedef struct _LDR_ENUM_RESOURCE_ENTRY
|
||||
{
|
||||
union
|
||||
{
|
||||
ULONG_PTR NameOrId;
|
||||
PIMAGE_RESOURCE_DIRECTORY_STRING Name;
|
||||
struct
|
||||
{
|
||||
USHORT Id;
|
||||
USHORT NameIsPresent;
|
||||
};
|
||||
} Path[3];
|
||||
PVOID Data;
|
||||
ULONG Size;
|
||||
ULONG Reserved;
|
||||
} LDR_ENUM_RESOURCE_ENTRY, *PLDR_ENUM_RESOURCE_ENTRY;
|
||||
|
||||
#define NAME_FROM_RESOURCE_ENTRY(RootDirectory, Entry) \
|
||||
((Entry)->NameIsString ? (ULONG_PTR)PTR_ADD_OFFSET((RootDirectory), (Entry)->NameOffset) : (Entry)->Id)
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrEnumResources(
|
||||
_In_ PVOID DllHandle,
|
||||
_In_ PLDR_RESOURCE_INFO ResourceInfo,
|
||||
_In_ ULONG Level,
|
||||
_Inout_ ULONG *ResourceCount,
|
||||
_Out_writes_to_opt_(*ResourceCount, *ResourceCount) PLDR_ENUM_RESOURCE_ENTRY Resources
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrFindEntryForAddress(
|
||||
_In_ PVOID DllHandle,
|
||||
_Out_ PLDR_DATA_TABLE_ENTRY *Entry
|
||||
);
|
||||
|
||||
#endif // (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
|
||||
// Module information
|
||||
|
||||
typedef struct _RTL_PROCESS_MODULE_INFORMATION
|
||||
{
|
||||
HANDLE Section;
|
||||
PVOID MappedBase;
|
||||
PVOID ImageBase;
|
||||
ULONG ImageSize;
|
||||
ULONG Flags;
|
||||
USHORT LoadOrderIndex;
|
||||
USHORT InitOrderIndex;
|
||||
USHORT LoadCount;
|
||||
USHORT OffsetToFileName;
|
||||
UCHAR FullPathName[256];
|
||||
} RTL_PROCESS_MODULE_INFORMATION, *PRTL_PROCESS_MODULE_INFORMATION;
|
||||
|
||||
typedef struct _RTL_PROCESS_MODULES
|
||||
{
|
||||
ULONG NumberOfModules;
|
||||
RTL_PROCESS_MODULE_INFORMATION Modules[1];
|
||||
} RTL_PROCESS_MODULES, *PRTL_PROCESS_MODULES;
|
||||
|
||||
// private
|
||||
typedef struct _RTL_PROCESS_MODULE_INFORMATION_EX
|
||||
{
|
||||
USHORT NextOffset;
|
||||
RTL_PROCESS_MODULE_INFORMATION BaseInfo;
|
||||
ULONG ImageChecksum;
|
||||
ULONG TimeDateStamp;
|
||||
PVOID DefaultBase;
|
||||
} RTL_PROCESS_MODULE_INFORMATION_EX, *PRTL_PROCESS_MODULE_INFORMATION_EX;
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrQueryProcessModuleInformation(
|
||||
_In_opt_ PRTL_PROCESS_MODULES ModuleInformation,
|
||||
_In_opt_ ULONG Size,
|
||||
_Out_ PULONG ReturnedSize
|
||||
);
|
||||
|
||||
typedef VOID (NTAPI *PLDR_ENUM_CALLBACK)(
|
||||
_In_ PLDR_DATA_TABLE_ENTRY ModuleInformation,
|
||||
_In_ PVOID Parameter,
|
||||
_Out_ BOOLEAN *Stop
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrEnumerateLoadedModules(
|
||||
_In_ BOOLEAN ReservedFlag,
|
||||
_In_ PLDR_ENUM_CALLBACK EnumProc,
|
||||
_In_ PVOID Context
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrOpenImageFileOptionsKey(
|
||||
_In_ PUNICODE_STRING SubKey,
|
||||
_In_ BOOLEAN Wow64,
|
||||
_Out_ PHANDLE NewKeyHandle
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrQueryImageFileKeyOption(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ PCWSTR ValueName,
|
||||
_In_ ULONG Type,
|
||||
_Out_ PVOID Buffer,
|
||||
_In_ ULONG BufferSize,
|
||||
_Out_opt_ PULONG ReturnedLength
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrQueryImageFileExecutionOptions(
|
||||
_In_ PUNICODE_STRING SubKey,
|
||||
_In_ PCWSTR ValueName,
|
||||
_In_ ULONG ValueSize,
|
||||
_Out_ PVOID Buffer,
|
||||
_In_ ULONG BufferSize,
|
||||
_Out_opt_ PULONG ReturnedLength
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrQueryImageFileExecutionOptionsEx(
|
||||
_In_ PUNICODE_STRING SubKey,
|
||||
_In_ PCWSTR ValueName,
|
||||
_In_ ULONG Type,
|
||||
_Out_ PVOID Buffer,
|
||||
_In_ ULONG BufferSize,
|
||||
_Out_opt_ PULONG ReturnedLength,
|
||||
_In_ BOOLEAN Wow64
|
||||
);
|
||||
|
||||
// private
|
||||
typedef struct _DELAYLOAD_PROC_DESCRIPTOR
|
||||
{
|
||||
ULONG ImportDescribedByName;
|
||||
union
|
||||
{
|
||||
PCSTR Name;
|
||||
ULONG Ordinal;
|
||||
} Description;
|
||||
} DELAYLOAD_PROC_DESCRIPTOR, *PDELAYLOAD_PROC_DESCRIPTOR;
|
||||
|
||||
// private
|
||||
typedef struct _DELAYLOAD_INFO
|
||||
{
|
||||
ULONG Size;
|
||||
PCIMAGE_DELAYLOAD_DESCRIPTOR DelayloadDescriptor;
|
||||
PIMAGE_THUNK_DATA ThunkAddress;
|
||||
PCSTR TargetDllName;
|
||||
DELAYLOAD_PROC_DESCRIPTOR TargetApiDescriptor;
|
||||
PVOID TargetModuleBase;
|
||||
PVOID Unused;
|
||||
ULONG LastError;
|
||||
} DELAYLOAD_INFO, *PDELAYLOAD_INFO;
|
||||
|
||||
// private
|
||||
typedef PVOID (NTAPI *PDELAYLOAD_FAILURE_DLL_CALLBACK)(
|
||||
_In_ ULONG NotificationReason,
|
||||
_In_ PDELAYLOAD_INFO DelayloadInfo
|
||||
);
|
||||
|
||||
// rev
|
||||
typedef PVOID (NTAPI *PDELAYLOAD_FAILURE_SYSTEM_ROUTINE)(
|
||||
_In_ PCSTR DllName,
|
||||
_In_ PCSTR ProcName
|
||||
);
|
||||
|
||||
// rev
|
||||
NTSYSAPI
|
||||
PVOID
|
||||
NTAPI
|
||||
LdrResolveDelayLoadedAPI(
|
||||
_In_ PVOID ParentModuleBase,
|
||||
_In_ PCIMAGE_DELAYLOAD_DESCRIPTOR DelayloadDescriptor,
|
||||
_In_opt_ PDELAYLOAD_FAILURE_DLL_CALLBACK FailureDllHook,
|
||||
_In_opt_ PDELAYLOAD_FAILURE_SYSTEM_ROUTINE FailureSystemHook, // kernel32.DelayLoadFailureHook
|
||||
_Out_ PIMAGE_THUNK_DATA ThunkAddress,
|
||||
_Reserved_ ULONG Flags
|
||||
);
|
||||
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrResolveDelayLoadsFromDll(
|
||||
_In_ PVOID ParentBase,
|
||||
_In_ PCSTR TargetDllName,
|
||||
_Reserved_ ULONG Flags
|
||||
);
|
||||
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrSetDefaultDllDirectories(
|
||||
_In_ ULONG DirectoryFlags
|
||||
);
|
||||
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrShutdownProcess(
|
||||
VOID
|
||||
);
|
||||
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrShutdownThread(
|
||||
VOID
|
||||
);
|
||||
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
LdrSetImplicitPathOptions(
|
||||
_In_ ULONG ImplicitPathOptions
|
||||
);
|
||||
|
||||
// rev
|
||||
NTSYSAPI
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
LdrControlFlowGuardEnforced(
|
||||
VOID
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_19H1)
|
||||
// rev
|
||||
NTSYSAPI
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
LdrIsModuleSxsRedirected(
|
||||
_In_ PVOID DllHandle
|
||||
);
|
||||
#endif
|
||||
|
||||
#endif // (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTMISC_H
|
||||
#define _NTMISC_H
|
||||
|
||||
// Filter manager
|
||||
|
||||
#define FLT_PORT_CONNECT 0x0001
|
||||
#define FLT_PORT_ALL_ACCESS (FLT_PORT_CONNECT | STANDARD_RIGHTS_ALL)
|
||||
|
||||
// VDM
|
||||
|
||||
typedef enum _VDMSERVICECLASS
|
||||
{
|
||||
VdmStartExecution,
|
||||
VdmQueueInterrupt,
|
||||
VdmDelayInterrupt,
|
||||
VdmInitialize,
|
||||
VdmFeatures,
|
||||
VdmSetInt21Handler,
|
||||
VdmQueryDir,
|
||||
VdmPrinterDirectIoOpen,
|
||||
VdmPrinterDirectIoClose,
|
||||
VdmPrinterInitialize,
|
||||
VdmSetLdtEntries,
|
||||
VdmSetProcessLdtInfo,
|
||||
VdmAdlibEmulation,
|
||||
VdmPMCliControl,
|
||||
VdmQueryVdmProcess
|
||||
} VDMSERVICECLASS, *PVDMSERVICECLASS;
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtVdmControl(
|
||||
_In_ VDMSERVICECLASS Service,
|
||||
_Inout_ PVOID ServiceData
|
||||
);
|
||||
|
||||
// WMI/ETW
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtTraceEvent(
|
||||
_In_ HANDLE TraceHandle,
|
||||
_In_ ULONG Flags,
|
||||
_In_ ULONG FieldSize,
|
||||
_In_ PVOID Fields
|
||||
);
|
||||
|
||||
typedef enum _TRACE_CONTROL_INFORMATION_CLASS
|
||||
{
|
||||
TraceControlStartLogger = 1,
|
||||
TraceControlStopLogger = 2,
|
||||
TraceControlQueryLogger = 3,
|
||||
TraceControlUpdateLogger = 4,
|
||||
TraceControlFlushLogger = 5,
|
||||
TraceControlIncrementLoggerFile = 6,
|
||||
|
||||
TraceControlRealtimeConnect = 11,
|
||||
TraceControlWdiDispatchControl = 13,
|
||||
TraceControlRealtimeDisconnectConsumerByHandle = 14,
|
||||
|
||||
TraceControlReceiveNotification = 16,
|
||||
TraceControlEnableGuid = 17,
|
||||
TraceControlSendReplyDataBlock = 18,
|
||||
TraceControlReceiveReplyDataBlock = 19,
|
||||
TraceControlWdiUpdateSem = 20,
|
||||
TraceControlGetTraceGuidList = 21,
|
||||
TraceControlGetTraceGuidInfo = 22,
|
||||
TraceControlEnumerateTraceGuids = 23,
|
||||
|
||||
TraceControlQueryReferenceTime = 25,
|
||||
TraceControlTrackProviderBinary = 26,
|
||||
TraceControlAddNotificationEvent = 27,
|
||||
TraceControlUpdateDisallowList = 28,
|
||||
|
||||
TraceControlUseDescriptorTypeUm = 31,
|
||||
TraceControlGetTraceGroupList = 32,
|
||||
TraceControlGetTraceGroupInfo = 33,
|
||||
TraceControlTraceSetDisallowList= 34,
|
||||
TraceControlSetCompressionSettings = 35,
|
||||
TraceControlGetCompressionSettings= 36,
|
||||
TraceControlUpdatePeriodicCaptureState = 37,
|
||||
TraceControlGetPrivateSessionTraceHandle = 38,
|
||||
TraceControlRegisterPrivateSession = 39,
|
||||
TraceControlQuerySessionDemuxObject = 40,
|
||||
TraceControlSetProviderBinaryTracking = 41,
|
||||
TraceControlMaxLoggers = 42,
|
||||
TraceControlMaxPmcCounter = 43
|
||||
} TRACE_CONTROL_INFORMATION_CLASS;
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtTraceControl(
|
||||
_In_ TRACE_CONTROL_INFORMATION_CLASS TraceInformationClass,
|
||||
_In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer,
|
||||
_In_ ULONG InputBufferLength,
|
||||
_Out_writes_bytes_opt_(TraceInformationLength) PVOID TraceInformation,
|
||||
_In_ ULONG TraceInformationLength,
|
||||
_Out_ PULONG ReturnLength
|
||||
);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTNLS_H
|
||||
#define _NTNLS_H
|
||||
|
||||
#define MAXIMUM_LEADBYTES 12
|
||||
|
||||
typedef struct _CPTABLEINFO
|
||||
{
|
||||
USHORT CodePage;
|
||||
USHORT MaximumCharacterSize;
|
||||
USHORT DefaultChar;
|
||||
USHORT UniDefaultChar;
|
||||
USHORT TransDefaultChar;
|
||||
USHORT TransUniDefaultChar;
|
||||
USHORT DBCSCodePage;
|
||||
UCHAR LeadByte[MAXIMUM_LEADBYTES];
|
||||
PUSHORT MultiByteTable;
|
||||
PVOID WideCharTable;
|
||||
PUSHORT DBCSRanges;
|
||||
PUSHORT DBCSOffsets;
|
||||
} CPTABLEINFO, *PCPTABLEINFO;
|
||||
|
||||
typedef struct _NLSTABLEINFO
|
||||
{
|
||||
CPTABLEINFO OemTableInfo;
|
||||
CPTABLEINFO AnsiTableInfo;
|
||||
PUSHORT UpperCaseTable;
|
||||
PUSHORT LowerCaseTable;
|
||||
} NLSTABLEINFO, *PNLSTABLEINFO;
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
NTSYSAPI USHORT NlsAnsiCodePage;
|
||||
NTSYSAPI BOOLEAN NlsMbCodePageTag;
|
||||
NTSYSAPI BOOLEAN NlsMbOemCodePageTag;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,385 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTOBAPI_H
|
||||
#define _NTOBAPI_H
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
#define OBJECT_TYPE_CREATE 0x0001
|
||||
#define OBJECT_TYPE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
|
||||
#endif
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
#define DIRECTORY_QUERY 0x0001
|
||||
#define DIRECTORY_TRAVERSE 0x0002
|
||||
#define DIRECTORY_CREATE_OBJECT 0x0004
|
||||
#define DIRECTORY_CREATE_SUBDIRECTORY 0x0008
|
||||
#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xf)
|
||||
#endif
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
#define SYMBOLIC_LINK_QUERY 0x0001
|
||||
#define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
|
||||
#endif
|
||||
|
||||
#define OBJ_PROTECT_CLOSE 0x00000001
|
||||
#ifndef OBJ_INHERIT
|
||||
#define OBJ_INHERIT 0x00000002
|
||||
#endif
|
||||
#define OBJ_AUDIT_OBJECT_CLOSE 0x00000004
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
typedef enum _OBJECT_INFORMATION_CLASS
|
||||
{
|
||||
ObjectBasicInformation, // OBJECT_BASIC_INFORMATION
|
||||
ObjectNameInformation, // OBJECT_NAME_INFORMATION
|
||||
ObjectTypeInformation, // OBJECT_TYPE_INFORMATION
|
||||
ObjectTypesInformation, // OBJECT_TYPES_INFORMATION
|
||||
ObjectHandleFlagInformation, // OBJECT_HANDLE_FLAG_INFORMATION
|
||||
ObjectSessionInformation,
|
||||
ObjectSessionObjectInformation,
|
||||
MaxObjectInfoClass
|
||||
} OBJECT_INFORMATION_CLASS;
|
||||
#else
|
||||
#define ObjectBasicInformation 0
|
||||
#define ObjectNameInformation 1
|
||||
#define ObjectTypesInformation 3
|
||||
#define ObjectHandleFlagInformation 4
|
||||
#define ObjectSessionInformation 5
|
||||
#define ObjectSessionObjectInformation 6
|
||||
#endif
|
||||
|
||||
typedef struct _OBJECT_BASIC_INFORMATION
|
||||
{
|
||||
ULONG Attributes;
|
||||
ACCESS_MASK GrantedAccess;
|
||||
ULONG HandleCount;
|
||||
ULONG PointerCount;
|
||||
ULONG PagedPoolCharge;
|
||||
ULONG NonPagedPoolCharge;
|
||||
ULONG Reserved[3];
|
||||
ULONG NameInfoSize;
|
||||
ULONG TypeInfoSize;
|
||||
ULONG SecurityDescriptorSize;
|
||||
LARGE_INTEGER CreationTime;
|
||||
} OBJECT_BASIC_INFORMATION, *POBJECT_BASIC_INFORMATION;
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
typedef struct _OBJECT_NAME_INFORMATION
|
||||
{
|
||||
UNICODE_STRING Name;
|
||||
} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
|
||||
#endif
|
||||
|
||||
typedef struct _OBJECT_TYPE_INFORMATION
|
||||
{
|
||||
UNICODE_STRING TypeName;
|
||||
ULONG TotalNumberOfObjects;
|
||||
ULONG TotalNumberOfHandles;
|
||||
ULONG TotalPagedPoolUsage;
|
||||
ULONG TotalNonPagedPoolUsage;
|
||||
ULONG TotalNamePoolUsage;
|
||||
ULONG TotalHandleTableUsage;
|
||||
ULONG HighWaterNumberOfObjects;
|
||||
ULONG HighWaterNumberOfHandles;
|
||||
ULONG HighWaterPagedPoolUsage;
|
||||
ULONG HighWaterNonPagedPoolUsage;
|
||||
ULONG HighWaterNamePoolUsage;
|
||||
ULONG HighWaterHandleTableUsage;
|
||||
ULONG InvalidAttributes;
|
||||
GENERIC_MAPPING GenericMapping;
|
||||
ULONG ValidAccessMask;
|
||||
BOOLEAN SecurityRequired;
|
||||
BOOLEAN MaintainHandleCount;
|
||||
UCHAR TypeIndex; // since WINBLUE
|
||||
CHAR ReservedByte;
|
||||
ULONG PoolType;
|
||||
ULONG DefaultPagedPoolCharge;
|
||||
ULONG DefaultNonPagedPoolCharge;
|
||||
} OBJECT_TYPE_INFORMATION, *POBJECT_TYPE_INFORMATION;
|
||||
|
||||
typedef struct _OBJECT_TYPES_INFORMATION
|
||||
{
|
||||
ULONG NumberOfTypes;
|
||||
} OBJECT_TYPES_INFORMATION, *POBJECT_TYPES_INFORMATION;
|
||||
|
||||
typedef struct _OBJECT_HANDLE_FLAG_INFORMATION
|
||||
{
|
||||
BOOLEAN Inherit;
|
||||
BOOLEAN ProtectFromClose;
|
||||
} OBJECT_HANDLE_FLAG_INFORMATION, *POBJECT_HANDLE_FLAG_INFORMATION;
|
||||
|
||||
// Objects, handles
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQueryObject(
|
||||
_In_opt_ HANDLE Handle,
|
||||
_In_ OBJECT_INFORMATION_CLASS ObjectInformationClass,
|
||||
_Out_writes_bytes_opt_(ObjectInformationLength) PVOID ObjectInformation,
|
||||
_In_ ULONG ObjectInformationLength,
|
||||
_Out_opt_ PULONG ReturnLength
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetInformationObject(
|
||||
_In_ HANDLE Handle,
|
||||
_In_ OBJECT_INFORMATION_CLASS ObjectInformationClass,
|
||||
_In_reads_bytes_(ObjectInformationLength) PVOID ObjectInformation,
|
||||
_In_ ULONG ObjectInformationLength
|
||||
);
|
||||
|
||||
#define DUPLICATE_CLOSE_SOURCE 0x00000001
|
||||
#define DUPLICATE_SAME_ACCESS 0x00000002
|
||||
#define DUPLICATE_SAME_ATTRIBUTES 0x00000004
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtDuplicateObject(
|
||||
_In_ HANDLE SourceProcessHandle,
|
||||
_In_ HANDLE SourceHandle,
|
||||
_In_opt_ HANDLE TargetProcessHandle,
|
||||
_Out_opt_ PHANDLE TargetHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ ULONG HandleAttributes,
|
||||
_In_ ULONG Options
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtMakeTemporaryObject(
|
||||
_In_ HANDLE Handle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtMakePermanentObject(
|
||||
_In_ HANDLE Handle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSignalAndWaitForSingleObject(
|
||||
_In_ HANDLE SignalHandle,
|
||||
_In_ HANDLE WaitHandle,
|
||||
_In_ BOOLEAN Alertable,
|
||||
_In_opt_ PLARGE_INTEGER Timeout
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtWaitForSingleObject(
|
||||
_In_ HANDLE Handle,
|
||||
_In_ BOOLEAN Alertable,
|
||||
_In_opt_ PLARGE_INTEGER Timeout
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtWaitForMultipleObjects(
|
||||
_In_ ULONG Count,
|
||||
_In_reads_(Count) HANDLE Handles[],
|
||||
_In_ WAIT_TYPE WaitType,
|
||||
_In_ BOOLEAN Alertable,
|
||||
_In_opt_ PLARGE_INTEGER Timeout
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WS03)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtWaitForMultipleObjects32(
|
||||
_In_ ULONG Count,
|
||||
_In_reads_(Count) LONG Handles[],
|
||||
_In_ WAIT_TYPE WaitType,
|
||||
_In_ BOOLEAN Alertable,
|
||||
_In_opt_ PLARGE_INTEGER Timeout
|
||||
);
|
||||
#endif
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetSecurityObject(
|
||||
_In_ HANDLE Handle,
|
||||
_In_ SECURITY_INFORMATION SecurityInformation,
|
||||
_In_ PSECURITY_DESCRIPTOR SecurityDescriptor
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQuerySecurityObject(
|
||||
_In_ HANDLE Handle,
|
||||
_In_ SECURITY_INFORMATION SecurityInformation,
|
||||
_Out_writes_bytes_opt_(Length) PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
_In_ ULONG Length,
|
||||
_Out_ PULONG LengthNeeded
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtClose(
|
||||
_In_ HANDLE Handle
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_THRESHOLD)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCompareObjects(
|
||||
_In_ HANDLE FirstObjectHandle,
|
||||
_In_ HANDLE SecondObjectHandle
|
||||
);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// Directory objects
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateDirectoryObject(
|
||||
_Out_ PHANDLE DirectoryHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN8)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateDirectoryObjectEx(
|
||||
_Out_ PHANDLE DirectoryHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_ HANDLE ShadowDirectoryHandle,
|
||||
_In_ ULONG Flags
|
||||
);
|
||||
#endif
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenDirectoryObject(
|
||||
_Out_ PHANDLE DirectoryHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes
|
||||
);
|
||||
|
||||
typedef struct _OBJECT_DIRECTORY_INFORMATION
|
||||
{
|
||||
UNICODE_STRING Name;
|
||||
UNICODE_STRING TypeName;
|
||||
} OBJECT_DIRECTORY_INFORMATION, *POBJECT_DIRECTORY_INFORMATION;
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQueryDirectoryObject(
|
||||
_In_ HANDLE DirectoryHandle,
|
||||
_Out_writes_bytes_opt_(Length) PVOID Buffer,
|
||||
_In_ ULONG Length,
|
||||
_In_ BOOLEAN ReturnSingleEntry,
|
||||
_In_ BOOLEAN RestartScan,
|
||||
_Inout_ PULONG Context,
|
||||
_Out_opt_ PULONG ReturnLength
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
// Private namespaces
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreatePrivateNamespace(
|
||||
_Out_ PHANDLE NamespaceHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_ PVOID BoundaryDescriptor
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenPrivateNamespace(
|
||||
_Out_ PHANDLE NamespaceHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_ PVOID BoundaryDescriptor
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtDeletePrivateNamespace(
|
||||
_In_ HANDLE NamespaceHandle
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// Symbolic links
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateSymbolicLinkObject(
|
||||
_Out_ PHANDLE LinkHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_ PUNICODE_STRING LinkTarget
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenSymbolicLinkObject(
|
||||
_Out_ PHANDLE LinkHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQuerySymbolicLinkObject(
|
||||
_In_ HANDLE LinkHandle,
|
||||
_Inout_ PUNICODE_STRING LinkTarget,
|
||||
_Out_opt_ PULONG ReturnedLength
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,434 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTPEBTEB_H
|
||||
#define _NTPEBTEB_H
|
||||
|
||||
typedef struct _RTL_USER_PROCESS_PARAMETERS *PRTL_USER_PROCESS_PARAMETERS;
|
||||
typedef struct _RTL_CRITICAL_SECTION *PRTL_CRITICAL_SECTION;
|
||||
|
||||
// private
|
||||
typedef struct _ACTIVATION_CONTEXT_STACK
|
||||
{
|
||||
struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME* ActiveFrame;
|
||||
LIST_ENTRY FrameListCache;
|
||||
ULONG Flags;
|
||||
ULONG NextCookieSequenceNumber;
|
||||
ULONG StackId;
|
||||
} ACTIVATION_CONTEXT_STACK, *PACTIVATION_CONTEXT_STACK;
|
||||
|
||||
// private
|
||||
typedef struct _API_SET_NAMESPACE
|
||||
{
|
||||
ULONG Version;
|
||||
ULONG Size;
|
||||
ULONG Flags;
|
||||
ULONG Count;
|
||||
ULONG EntryOffset;
|
||||
ULONG HashOffset;
|
||||
ULONG HashFactor;
|
||||
} API_SET_NAMESPACE, *PAPI_SET_NAMESPACE;
|
||||
|
||||
// private
|
||||
typedef struct _API_SET_HASH_ENTRY
|
||||
{
|
||||
ULONG Hash;
|
||||
ULONG Index;
|
||||
} API_SET_HASH_ENTRY, *PAPI_SET_HASH_ENTRY;
|
||||
|
||||
// private
|
||||
typedef struct _API_SET_NAMESPACE_ENTRY
|
||||
{
|
||||
ULONG Flags;
|
||||
ULONG NameOffset;
|
||||
ULONG NameLength;
|
||||
ULONG HashedLength;
|
||||
ULONG ValueOffset;
|
||||
ULONG ValueCount;
|
||||
} API_SET_NAMESPACE_ENTRY, *PAPI_SET_NAMESPACE_ENTRY;
|
||||
|
||||
// private
|
||||
typedef struct _API_SET_VALUE_ENTRY
|
||||
{
|
||||
ULONG Flags;
|
||||
ULONG NameOffset;
|
||||
ULONG NameLength;
|
||||
ULONG ValueOffset;
|
||||
ULONG ValueLength;
|
||||
} API_SET_VALUE_ENTRY, *PAPI_SET_VALUE_ENTRY;
|
||||
|
||||
// symbols
|
||||
typedef struct _PEB
|
||||
{
|
||||
BOOLEAN InheritedAddressSpace;
|
||||
BOOLEAN ReadImageFileExecOptions;
|
||||
BOOLEAN BeingDebugged;
|
||||
union
|
||||
{
|
||||
BOOLEAN BitField;
|
||||
struct
|
||||
{
|
||||
BOOLEAN ImageUsesLargePages : 1;
|
||||
BOOLEAN IsProtectedProcess : 1;
|
||||
BOOLEAN IsImageDynamicallyRelocated : 1;
|
||||
BOOLEAN SkipPatchingUser32Forwarders : 1;
|
||||
BOOLEAN IsPackagedProcess : 1;
|
||||
BOOLEAN IsAppContainer : 1;
|
||||
BOOLEAN IsProtectedProcessLight : 1;
|
||||
BOOLEAN IsLongPathAwareProcess : 1;
|
||||
};
|
||||
};
|
||||
|
||||
HANDLE Mutant;
|
||||
|
||||
PVOID ImageBaseAddress;
|
||||
PPEB_LDR_DATA Ldr;
|
||||
PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
|
||||
PVOID SubSystemData;
|
||||
PVOID ProcessHeap;
|
||||
PRTL_CRITICAL_SECTION FastPebLock;
|
||||
PVOID IFEOKey;
|
||||
PSLIST_HEADER AtlThunkSListPtr;
|
||||
union
|
||||
{
|
||||
ULONG CrossProcessFlags;
|
||||
struct
|
||||
{
|
||||
ULONG ProcessInJob : 1;
|
||||
ULONG ProcessInitializing : 1;
|
||||
ULONG ProcessUsingVEH : 1;
|
||||
ULONG ProcessUsingVCH : 1;
|
||||
ULONG ProcessUsingFTH : 1;
|
||||
ULONG ProcessPreviouslyThrottled : 1;
|
||||
ULONG ProcessCurrentlyThrottled : 1;
|
||||
ULONG ProcessImagesHotPatched : 1; // REDSTONE5
|
||||
ULONG ReservedBits0 : 24;
|
||||
};
|
||||
};
|
||||
union
|
||||
{
|
||||
PVOID KernelCallbackTable;
|
||||
PVOID UserSharedInfoPtr;
|
||||
};
|
||||
ULONG SystemReserved;
|
||||
ULONG AtlThunkSListPtr32;
|
||||
PAPI_SET_NAMESPACE ApiSetMap;
|
||||
ULONG TlsExpansionCounter;
|
||||
PVOID TlsBitmap;
|
||||
ULONG TlsBitmapBits[2];
|
||||
|
||||
PVOID ReadOnlySharedMemoryBase;
|
||||
PVOID SharedData; // HotpatchInformation
|
||||
PVOID *ReadOnlyStaticServerData;
|
||||
|
||||
PVOID AnsiCodePageData; // PCPTABLEINFO
|
||||
PVOID OemCodePageData; // PCPTABLEINFO
|
||||
PVOID UnicodeCaseTableData; // PNLSTABLEINFO
|
||||
|
||||
ULONG NumberOfProcessors;
|
||||
ULONG NtGlobalFlag;
|
||||
|
||||
ULARGE_INTEGER CriticalSectionTimeout;
|
||||
SIZE_T HeapSegmentReserve;
|
||||
SIZE_T HeapSegmentCommit;
|
||||
SIZE_T HeapDeCommitTotalFreeThreshold;
|
||||
SIZE_T HeapDeCommitFreeBlockThreshold;
|
||||
|
||||
ULONG NumberOfHeaps;
|
||||
ULONG MaximumNumberOfHeaps;
|
||||
PVOID *ProcessHeaps; // PHEAP
|
||||
|
||||
PVOID GdiSharedHandleTable;
|
||||
PVOID ProcessStarterHelper;
|
||||
ULONG GdiDCAttributeList;
|
||||
|
||||
PRTL_CRITICAL_SECTION LoaderLock;
|
||||
|
||||
ULONG OSMajorVersion;
|
||||
ULONG OSMinorVersion;
|
||||
USHORT OSBuildNumber;
|
||||
USHORT OSCSDVersion;
|
||||
ULONG OSPlatformId;
|
||||
ULONG ImageSubsystem;
|
||||
ULONG ImageSubsystemMajorVersion;
|
||||
ULONG ImageSubsystemMinorVersion;
|
||||
ULONG_PTR ActiveProcessAffinityMask;
|
||||
GDI_HANDLE_BUFFER GdiHandleBuffer;
|
||||
PVOID PostProcessInitRoutine;
|
||||
|
||||
PVOID TlsExpansionBitmap;
|
||||
ULONG TlsExpansionBitmapBits[32];
|
||||
|
||||
ULONG SessionId;
|
||||
|
||||
ULARGE_INTEGER AppCompatFlags;
|
||||
ULARGE_INTEGER AppCompatFlagsUser;
|
||||
PVOID pShimData;
|
||||
PVOID AppCompatInfo; // APPCOMPAT_EXE_DATA
|
||||
|
||||
UNICODE_STRING CSDVersion;
|
||||
|
||||
PVOID ActivationContextData; // ACTIVATION_CONTEXT_DATA
|
||||
PVOID ProcessAssemblyStorageMap; // ASSEMBLY_STORAGE_MAP
|
||||
PVOID SystemDefaultActivationContextData; // ACTIVATION_CONTEXT_DATA
|
||||
PVOID SystemAssemblyStorageMap; // ASSEMBLY_STORAGE_MAP
|
||||
|
||||
SIZE_T MinimumStackCommit;
|
||||
|
||||
PVOID SparePointers[4]; // 19H1 (previously FlsCallback to FlsHighIndex)
|
||||
ULONG SpareUlongs[5]; // 19H1
|
||||
//PVOID* FlsCallback;
|
||||
//LIST_ENTRY FlsListHead;
|
||||
//PVOID FlsBitmap;
|
||||
//ULONG FlsBitmapBits[FLS_MAXIMUM_AVAILABLE / (sizeof(ULONG) * 8)];
|
||||
//ULONG FlsHighIndex;
|
||||
|
||||
PVOID WerRegistrationData;
|
||||
PVOID WerShipAssertPtr;
|
||||
PVOID pUnused; // pContextData
|
||||
PVOID pImageHeaderHash;
|
||||
union
|
||||
{
|
||||
ULONG TracingFlags;
|
||||
struct
|
||||
{
|
||||
ULONG HeapTracingEnabled : 1;
|
||||
ULONG CritSecTracingEnabled : 1;
|
||||
ULONG LibLoaderTracingEnabled : 1;
|
||||
ULONG SpareTracingBits : 29;
|
||||
};
|
||||
};
|
||||
ULONGLONG CsrServerReadOnlySharedMemoryBase;
|
||||
PRTL_CRITICAL_SECTION TppWorkerpListLock;
|
||||
LIST_ENTRY TppWorkerpList;
|
||||
PVOID WaitOnAddressHashTable[128];
|
||||
PVOID TelemetryCoverageHeader; // REDSTONE3
|
||||
ULONG CloudFileFlags;
|
||||
ULONG CloudFileDiagFlags; // REDSTONE4
|
||||
CHAR PlaceholderCompatibilityMode;
|
||||
CHAR PlaceholderCompatibilityModeReserved[7];
|
||||
struct _LEAP_SECOND_DATA *LeapSecondData; // REDSTONE5
|
||||
union
|
||||
{
|
||||
ULONG LeapSecondFlags;
|
||||
struct
|
||||
{
|
||||
ULONG SixtySecondEnabled : 1;
|
||||
ULONG Reserved : 31;
|
||||
};
|
||||
};
|
||||
ULONG NtGlobalFlag2;
|
||||
} PEB, *PPEB;
|
||||
|
||||
#ifdef _WIN64
|
||||
C_ASSERT(FIELD_OFFSET(PEB, SessionId) == 0x2C0);
|
||||
//C_ASSERT(sizeof(PEB) == 0x7B0); // REDSTONE3
|
||||
//C_ASSERT(sizeof(PEB) == 0x7B8); // REDSTONE4
|
||||
C_ASSERT(sizeof(PEB) == 0x7C8); // REDSTONE5 // 19H1
|
||||
#else
|
||||
C_ASSERT(FIELD_OFFSET(PEB, SessionId) == 0x1D4);
|
||||
//C_ASSERT(sizeof(PEB) == 0x468); // REDSTONE3
|
||||
//C_ASSERT(sizeof(PEB) == 0x470); // REDSTONE4
|
||||
C_ASSERT(sizeof(PEB) == 0x480); // REDSTONE5 // 19H1
|
||||
#endif
|
||||
|
||||
#define GDI_BATCH_BUFFER_SIZE 310
|
||||
|
||||
typedef struct _GDI_TEB_BATCH
|
||||
{
|
||||
ULONG Offset;
|
||||
ULONG_PTR HDC;
|
||||
ULONG Buffer[GDI_BATCH_BUFFER_SIZE];
|
||||
} GDI_TEB_BATCH, *PGDI_TEB_BATCH;
|
||||
|
||||
typedef struct _TEB_ACTIVE_FRAME_CONTEXT
|
||||
{
|
||||
ULONG Flags;
|
||||
PSTR FrameName;
|
||||
} TEB_ACTIVE_FRAME_CONTEXT, *PTEB_ACTIVE_FRAME_CONTEXT;
|
||||
|
||||
typedef struct _TEB_ACTIVE_FRAME
|
||||
{
|
||||
ULONG Flags;
|
||||
struct _TEB_ACTIVE_FRAME *Previous;
|
||||
PTEB_ACTIVE_FRAME_CONTEXT Context;
|
||||
} TEB_ACTIVE_FRAME, *PTEB_ACTIVE_FRAME;
|
||||
|
||||
typedef struct _TEB
|
||||
{
|
||||
NT_TIB NtTib;
|
||||
|
||||
PVOID EnvironmentPointer;
|
||||
CLIENT_ID ClientId;
|
||||
PVOID ActiveRpcHandle;
|
||||
PVOID ThreadLocalStoragePointer;
|
||||
PPEB ProcessEnvironmentBlock;
|
||||
|
||||
ULONG LastErrorValue;
|
||||
ULONG CountOfOwnedCriticalSections;
|
||||
PVOID CsrClientThread;
|
||||
PVOID Win32ThreadInfo;
|
||||
ULONG User32Reserved[26];
|
||||
ULONG UserReserved[5];
|
||||
PVOID WOW32Reserved;
|
||||
LCID CurrentLocale;
|
||||
ULONG FpSoftwareStatusRegister;
|
||||
PVOID ReservedForDebuggerInstrumentation[16];
|
||||
#ifdef _WIN64
|
||||
PVOID SystemReserved1[30];
|
||||
#else
|
||||
PVOID SystemReserved1[26];
|
||||
#endif
|
||||
|
||||
CHAR PlaceholderCompatibilityMode;
|
||||
CHAR PlaceholderReserved[11];
|
||||
ULONG ProxiedProcessId;
|
||||
ACTIVATION_CONTEXT_STACK ActivationStack;
|
||||
|
||||
UCHAR WorkingOnBehalfTicket[8];
|
||||
NTSTATUS ExceptionCode;
|
||||
|
||||
PACTIVATION_CONTEXT_STACK ActivationContextStackPointer;
|
||||
ULONG_PTR InstrumentationCallbackSp;
|
||||
ULONG_PTR InstrumentationCallbackPreviousPc;
|
||||
ULONG_PTR InstrumentationCallbackPreviousSp;
|
||||
#ifdef _WIN64
|
||||
ULONG TxFsContext;
|
||||
#endif
|
||||
|
||||
BOOLEAN InstrumentationCallbackDisabled;
|
||||
#ifndef _WIN64
|
||||
UCHAR SpareBytes[23];
|
||||
ULONG TxFsContext;
|
||||
#endif
|
||||
GDI_TEB_BATCH GdiTebBatch;
|
||||
CLIENT_ID RealClientId;
|
||||
HANDLE GdiCachedProcessHandle;
|
||||
ULONG GdiClientPID;
|
||||
ULONG GdiClientTID;
|
||||
PVOID GdiThreadLocalInfo;
|
||||
ULONG_PTR Win32ClientInfo[62];
|
||||
PVOID glDispatchTable[233];
|
||||
ULONG_PTR glReserved1[29];
|
||||
PVOID glReserved2;
|
||||
PVOID glSectionInfo;
|
||||
PVOID glSection;
|
||||
PVOID glTable;
|
||||
PVOID glCurrentRC;
|
||||
PVOID glContext;
|
||||
|
||||
NTSTATUS LastStatusValue;
|
||||
UNICODE_STRING StaticUnicodeString;
|
||||
WCHAR StaticUnicodeBuffer[261];
|
||||
|
||||
PVOID DeallocationStack;
|
||||
PVOID TlsSlots[64];
|
||||
LIST_ENTRY TlsLinks;
|
||||
|
||||
PVOID Vdm;
|
||||
PVOID ReservedForNtRpc;
|
||||
PVOID DbgSsReserved[2];
|
||||
|
||||
ULONG HardErrorMode;
|
||||
#ifdef _WIN64
|
||||
PVOID Instrumentation[11];
|
||||
#else
|
||||
PVOID Instrumentation[9];
|
||||
#endif
|
||||
GUID ActivityId;
|
||||
|
||||
PVOID SubProcessTag;
|
||||
PVOID PerflibData;
|
||||
PVOID EtwTraceData;
|
||||
PVOID WinSockData;
|
||||
ULONG GdiBatchCount;
|
||||
|
||||
union
|
||||
{
|
||||
PROCESSOR_NUMBER CurrentIdealProcessor;
|
||||
ULONG IdealProcessorValue;
|
||||
struct
|
||||
{
|
||||
UCHAR ReservedPad0;
|
||||
UCHAR ReservedPad1;
|
||||
UCHAR ReservedPad2;
|
||||
UCHAR IdealProcessor;
|
||||
};
|
||||
};
|
||||
|
||||
ULONG GuaranteedStackBytes;
|
||||
PVOID ReservedForPerf;
|
||||
PVOID ReservedForOle;
|
||||
ULONG WaitingOnLoaderLock;
|
||||
PVOID SavedPriorityState;
|
||||
ULONG_PTR ReservedForCodeCoverage;
|
||||
PVOID ThreadPoolData;
|
||||
PVOID *TlsExpansionSlots;
|
||||
#ifdef _WIN64
|
||||
PVOID DeallocationBStore;
|
||||
PVOID BStoreLimit;
|
||||
#endif
|
||||
ULONG MuiGeneration;
|
||||
ULONG IsImpersonating;
|
||||
PVOID NlsCache;
|
||||
PVOID pShimData;
|
||||
USHORT HeapVirtualAffinity;
|
||||
USHORT LowFragHeapDataSlot;
|
||||
HANDLE CurrentTransactionHandle;
|
||||
PTEB_ACTIVE_FRAME ActiveFrame;
|
||||
PVOID FlsData;
|
||||
|
||||
PVOID PreferredLanguages;
|
||||
PVOID UserPrefLanguages;
|
||||
PVOID MergedPrefLanguages;
|
||||
ULONG MuiImpersonation;
|
||||
|
||||
union
|
||||
{
|
||||
USHORT CrossTebFlags;
|
||||
USHORT SpareCrossTebBits : 16;
|
||||
};
|
||||
union
|
||||
{
|
||||
USHORT SameTebFlags;
|
||||
struct
|
||||
{
|
||||
USHORT SafeThunkCall : 1;
|
||||
USHORT InDebugPrint : 1;
|
||||
USHORT HasFiberData : 1;
|
||||
USHORT SkipThreadAttach : 1;
|
||||
USHORT WerInShipAssertCode : 1;
|
||||
USHORT RanProcessInit : 1;
|
||||
USHORT ClonedThread : 1;
|
||||
USHORT SuppressDebugMsg : 1;
|
||||
USHORT DisableUserStackWalk : 1;
|
||||
USHORT RtlExceptionAttached : 1;
|
||||
USHORT InitialThread : 1;
|
||||
USHORT SessionAware : 1;
|
||||
USHORT LoadOwner : 1;
|
||||
USHORT LoaderWorker : 1;
|
||||
USHORT SkipLoaderInit : 1;
|
||||
USHORT SpareSameTebBits : 1;
|
||||
};
|
||||
};
|
||||
|
||||
PVOID TxnScopeEnterCallback;
|
||||
PVOID TxnScopeExitCallback;
|
||||
PVOID TxnScopeContext;
|
||||
ULONG LockCount;
|
||||
LONG WowTebOffset;
|
||||
PVOID ResourceRetValue;
|
||||
PVOID ReservedForWdf;
|
||||
ULONGLONG ReservedForCrt;
|
||||
GUID EffectiveContainerId;
|
||||
} TEB, *PTEB;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,282 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTPFAPI_H
|
||||
#define _NTPFAPI_H
|
||||
|
||||
// begin_private
|
||||
|
||||
// Prefetch
|
||||
|
||||
typedef enum _PF_BOOT_PHASE_ID
|
||||
{
|
||||
PfKernelInitPhase = 0,
|
||||
PfBootDriverInitPhase = 90,
|
||||
PfSystemDriverInitPhase = 120,
|
||||
PfSessionManagerInitPhase = 150,
|
||||
PfSMRegistryInitPhase = 180,
|
||||
PfVideoInitPhase = 210,
|
||||
PfPostVideoInitPhase = 240,
|
||||
PfBootAcceptedRegistryInitPhase = 270,
|
||||
PfUserShellReadyPhase = 300,
|
||||
PfMaxBootPhaseId = 900
|
||||
} PF_BOOT_PHASE_ID;
|
||||
|
||||
typedef enum _PF_ENABLE_STATUS
|
||||
{
|
||||
PfSvNotSpecified,
|
||||
PfSvEnabled,
|
||||
PfSvDisabled,
|
||||
PfSvMaxEnableStatus
|
||||
} PF_ENABLE_STATUS;
|
||||
|
||||
typedef struct _PF_TRACE_LIMITS
|
||||
{
|
||||
ULONG MaxNumPages;
|
||||
ULONG MaxNumSections;
|
||||
LONGLONG TimerPeriod;
|
||||
} PF_TRACE_LIMITS, *PPF_TRACE_LIMITS;
|
||||
|
||||
typedef struct _PF_SYSTEM_PREFETCH_PARAMETERS
|
||||
{
|
||||
PF_ENABLE_STATUS EnableStatus[2];
|
||||
PF_TRACE_LIMITS TraceLimits[2];
|
||||
ULONG MaxNumActiveTraces;
|
||||
ULONG MaxNumSavedTraces;
|
||||
WCHAR RootDirPath[32];
|
||||
WCHAR HostingApplicationList[128];
|
||||
} PF_SYSTEM_PREFETCH_PARAMETERS, *PPF_SYSTEM_PREFETCH_PARAMETERS;
|
||||
|
||||
#define PF_BOOT_CONTROL_VERSION 1
|
||||
|
||||
typedef struct _PF_BOOT_CONTROL
|
||||
{
|
||||
ULONG Version;
|
||||
ULONG DisableBootPrefetching;
|
||||
} PF_BOOT_CONTROL, *PPF_BOOT_CONTROL;
|
||||
|
||||
typedef enum _PREFETCHER_INFORMATION_CLASS
|
||||
{
|
||||
PrefetcherRetrieveTrace = 1, // q: CHAR[]
|
||||
PrefetcherSystemParameters, // q: PF_SYSTEM_PREFETCH_PARAMETERS
|
||||
PrefetcherBootPhase, // s: PF_BOOT_PHASE_ID
|
||||
PrefetcherRetrieveBootLoaderTrace, // q: CHAR[]
|
||||
PrefetcherBootControl // s: PF_BOOT_CONTROL
|
||||
} PREFETCHER_INFORMATION_CLASS;
|
||||
|
||||
#define PREFETCHER_INFORMATION_VERSION 23 // rev
|
||||
#define PREFETCHER_INFORMATION_MAGIC ('kuhC') // rev
|
||||
|
||||
typedef struct _PREFETCHER_INFORMATION
|
||||
{
|
||||
ULONG Version;
|
||||
ULONG Magic;
|
||||
PREFETCHER_INFORMATION_CLASS PrefetcherInformationClass;
|
||||
PVOID PrefetcherInformation;
|
||||
ULONG PrefetcherInformationLength;
|
||||
} PREFETCHER_INFORMATION, *PPREFETCHER_INFORMATION;
|
||||
|
||||
// Superfetch
|
||||
|
||||
typedef struct _PF_SYSTEM_SUPERFETCH_PARAMETERS
|
||||
{
|
||||
ULONG EnabledComponents;
|
||||
ULONG BootID;
|
||||
ULONG SavedSectInfoTracesMax;
|
||||
ULONG SavedPageAccessTracesMax;
|
||||
ULONG ScenarioPrefetchTimeoutStandby;
|
||||
ULONG ScenarioPrefetchTimeoutHibernate;
|
||||
} PF_SYSTEM_SUPERFETCH_PARAMETERS, *PPF_SYSTEM_SUPERFETCH_PARAMETERS;
|
||||
|
||||
#define PF_PFN_PRIO_REQUEST_VERSION 1
|
||||
#define PF_PFN_PRIO_REQUEST_QUERY_MEMORY_LIST 0x1
|
||||
#define PF_PFN_PRIO_REQUEST_VALID_FLAGS 0x1
|
||||
|
||||
typedef struct _PF_PFN_PRIO_REQUEST
|
||||
{
|
||||
ULONG Version;
|
||||
ULONG RequestFlags;
|
||||
ULONG_PTR PfnCount;
|
||||
SYSTEM_MEMORY_LIST_INFORMATION MemInfo;
|
||||
MMPFN_IDENTITY PageData[256];
|
||||
} PF_PFN_PRIO_REQUEST, *PPF_PFN_PRIO_REQUEST;
|
||||
|
||||
typedef enum _PFS_PRIVATE_PAGE_SOURCE_TYPE
|
||||
{
|
||||
PfsPrivateSourceKernel,
|
||||
PfsPrivateSourceSession,
|
||||
PfsPrivateSourceProcess,
|
||||
PfsPrivateSourceMax
|
||||
} PFS_PRIVATE_PAGE_SOURCE_TYPE;
|
||||
|
||||
typedef struct _PFS_PRIVATE_PAGE_SOURCE
|
||||
{
|
||||
PFS_PRIVATE_PAGE_SOURCE_TYPE Type;
|
||||
union
|
||||
{
|
||||
ULONG SessionId;
|
||||
ULONG ProcessId;
|
||||
};
|
||||
ULONG ImagePathHash;
|
||||
ULONG_PTR UniqueProcessHash;
|
||||
} PFS_PRIVATE_PAGE_SOURCE, *PPFS_PRIVATE_PAGE_SOURCE;
|
||||
|
||||
typedef struct _PF_PRIVSOURCE_INFO
|
||||
{
|
||||
PFS_PRIVATE_PAGE_SOURCE DbInfo;
|
||||
PVOID EProcess;
|
||||
SIZE_T WsPrivatePages;
|
||||
SIZE_T TotalPrivatePages;
|
||||
ULONG SessionID;
|
||||
CHAR ImageName[16];
|
||||
union {
|
||||
ULONG_PTR WsSwapPages; // process only PF_PRIVSOURCE_QUERY_WS_SWAP_PAGES.
|
||||
ULONG_PTR SessionPagedPoolPages; // session only.
|
||||
ULONG_PTR StoreSizePages; // process only PF_PRIVSOURCE_QUERY_STORE_INFO.
|
||||
};
|
||||
ULONG_PTR WsTotalPages; // process/session only.
|
||||
ULONG DeepFreezeTimeMs; // process only.
|
||||
ULONG ModernApp : 1; // process only.
|
||||
ULONG DeepFrozen : 1; // process only. If set, DeepFreezeTimeMs contains the time at which the freeze occurred
|
||||
ULONG Foreground : 1; // process only.
|
||||
ULONG PerProcessStore : 1; // process only.
|
||||
ULONG Spare : 28;
|
||||
} PF_PRIVSOURCE_INFO, *PPF_PRIVSOURCE_INFO;
|
||||
|
||||
#define PF_PRIVSOURCE_QUERY_REQUEST_VERSION 8
|
||||
|
||||
typedef struct _PF_PRIVSOURCE_QUERY_REQUEST
|
||||
{
|
||||
ULONG Version;
|
||||
ULONG Flags;
|
||||
ULONG InfoCount;
|
||||
PF_PRIVSOURCE_INFO InfoArray[1];
|
||||
} PF_PRIVSOURCE_QUERY_REQUEST, *PPF_PRIVSOURCE_QUERY_REQUEST;
|
||||
|
||||
typedef enum _PF_PHASED_SCENARIO_TYPE
|
||||
{
|
||||
PfScenarioTypeNone,
|
||||
PfScenarioTypeStandby,
|
||||
PfScenarioTypeHibernate,
|
||||
PfScenarioTypeFUS,
|
||||
PfScenarioTypeMax
|
||||
} PF_PHASED_SCENARIO_TYPE;
|
||||
|
||||
#define PF_SCENARIO_PHASE_INFO_VERSION 4
|
||||
|
||||
typedef struct _PF_SCENARIO_PHASE_INFO
|
||||
{
|
||||
ULONG Version;
|
||||
PF_PHASED_SCENARIO_TYPE ScenType;
|
||||
ULONG PhaseId;
|
||||
ULONG SequenceNumber;
|
||||
ULONG Flags;
|
||||
ULONG FUSUserId;
|
||||
} PF_SCENARIO_PHASE_INFO, *PPF_SCENARIO_PHASE_INFO;
|
||||
|
||||
typedef struct _PF_MEMORY_LIST_NODE
|
||||
{
|
||||
ULONGLONG Node : 8;
|
||||
ULONGLONG Spare : 56;
|
||||
ULONGLONG StandbyLowPageCount;
|
||||
ULONGLONG StandbyMediumPageCount;
|
||||
ULONGLONG StandbyHighPageCount;
|
||||
ULONGLONG FreePageCount;
|
||||
ULONGLONG ModifiedPageCount;
|
||||
} PF_MEMORY_LIST_NODE, *PPF_MEMORY_LIST_NODE;
|
||||
|
||||
#define PF_MEMORY_LIST_INFO_VERSION 1
|
||||
|
||||
typedef struct _PF_MEMORY_LIST_INFO
|
||||
{
|
||||
ULONG Version;
|
||||
ULONG Size;
|
||||
ULONG NodeCount;
|
||||
PF_MEMORY_LIST_NODE Nodes[1];
|
||||
} PF_MEMORY_LIST_INFO, *PPF_MEMORY_LIST_INFO;
|
||||
|
||||
typedef struct _PF_PHYSICAL_MEMORY_RANGE
|
||||
{
|
||||
ULONG_PTR BasePfn;
|
||||
ULONG_PTR PageCount;
|
||||
} PF_PHYSICAL_MEMORY_RANGE, *PPF_PHYSICAL_MEMORY_RANGE;
|
||||
|
||||
#define PF_PHYSICAL_MEMORY_RANGE_INFO_V1_VERSION 1
|
||||
|
||||
typedef struct _PF_PHYSICAL_MEMORY_RANGE_INFO_V1
|
||||
{
|
||||
ULONG Version;
|
||||
ULONG RangeCount;
|
||||
PF_PHYSICAL_MEMORY_RANGE Ranges[1];
|
||||
} PF_PHYSICAL_MEMORY_RANGE_INFO_V1, *PPF_PHYSICAL_MEMORY_RANGE_INFO_V1;
|
||||
|
||||
#define PF_PHYSICAL_MEMORY_RANGE_INFO_V2_VERSION 2
|
||||
|
||||
typedef struct _PF_PHYSICAL_MEMORY_RANGE_INFO_V2
|
||||
{
|
||||
ULONG Version;
|
||||
ULONG Flags;
|
||||
ULONG RangeCount;
|
||||
PF_PHYSICAL_MEMORY_RANGE Ranges[ANYSIZE_ARRAY];
|
||||
} PF_PHYSICAL_MEMORY_RANGE_INFO_V2, *PPF_PHYSICAL_MEMORY_RANGE_INFO_V2;
|
||||
|
||||
// begin_rev
|
||||
|
||||
#define PF_REPURPOSED_BY_PREFETCH_INFO_VERSION 1
|
||||
|
||||
typedef struct _PF_REPURPOSED_BY_PREFETCH_INFO
|
||||
{
|
||||
ULONG Version;
|
||||
ULONG RepurposedByPrefetch;
|
||||
} PF_REPURPOSED_BY_PREFETCH_INFO, *PPF_REPURPOSED_BY_PREFETCH_INFO;
|
||||
|
||||
// end_rev
|
||||
|
||||
typedef enum _SUPERFETCH_INFORMATION_CLASS
|
||||
{
|
||||
SuperfetchRetrieveTrace = 1, // q: CHAR[]
|
||||
SuperfetchSystemParameters, // q: PF_SYSTEM_SUPERFETCH_PARAMETERS
|
||||
SuperfetchLogEvent,
|
||||
SuperfetchGenerateTrace,
|
||||
SuperfetchPrefetch,
|
||||
SuperfetchPfnQuery, // q: PF_PFN_PRIO_REQUEST
|
||||
SuperfetchPfnSetPriority,
|
||||
SuperfetchPrivSourceQuery, // q: PF_PRIVSOURCE_QUERY_REQUEST
|
||||
SuperfetchSequenceNumberQuery, // q: ULONG
|
||||
SuperfetchScenarioPhase, // 10
|
||||
SuperfetchWorkerPriority,
|
||||
SuperfetchScenarioQuery, // q: PF_SCENARIO_PHASE_INFO
|
||||
SuperfetchScenarioPrefetch,
|
||||
SuperfetchRobustnessControl,
|
||||
SuperfetchTimeControl,
|
||||
SuperfetchMemoryListQuery, // q: PF_MEMORY_LIST_INFO
|
||||
SuperfetchMemoryRangesQuery, // q: PF_PHYSICAL_MEMORY_RANGE_INFO
|
||||
SuperfetchTracingControl,
|
||||
SuperfetchTrimWhileAgingControl,
|
||||
SuperfetchRepurposedByPrefetch, // q: PF_REPURPOSED_BY_PREFETCH_INFO // rev
|
||||
SuperfetchInformationMax
|
||||
} SUPERFETCH_INFORMATION_CLASS;
|
||||
|
||||
#define SUPERFETCH_INFORMATION_VERSION 45 // rev
|
||||
#define SUPERFETCH_INFORMATION_MAGIC ('kuhC') // rev
|
||||
|
||||
typedef struct _SUPERFETCH_INFORMATION
|
||||
{
|
||||
_In_ ULONG Version;
|
||||
_In_ ULONG Magic;
|
||||
_In_ SUPERFETCH_INFORMATION_CLASS InfoClass;
|
||||
_Inout_ PVOID Data;
|
||||
_Inout_ ULONG Length;
|
||||
} SUPERFETCH_INFORMATION, *PSUPERFETCH_INFORMATION;
|
||||
|
||||
// end_private
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTPNPAPI_H
|
||||
#define _NTPNPAPI_H
|
||||
|
||||
typedef enum _PLUGPLAY_EVENT_CATEGORY
|
||||
{
|
||||
HardwareProfileChangeEvent,
|
||||
TargetDeviceChangeEvent,
|
||||
DeviceClassChangeEvent,
|
||||
CustomDeviceEvent,
|
||||
DeviceInstallEvent,
|
||||
DeviceArrivalEvent,
|
||||
PowerEvent,
|
||||
VetoEvent,
|
||||
BlockedDriverEvent,
|
||||
InvalidIDEvent,
|
||||
MaxPlugEventCategory
|
||||
} PLUGPLAY_EVENT_CATEGORY, *PPLUGPLAY_EVENT_CATEGORY;
|
||||
|
||||
typedef struct _PLUGPLAY_EVENT_BLOCK
|
||||
{
|
||||
GUID EventGuid;
|
||||
PLUGPLAY_EVENT_CATEGORY EventCategory;
|
||||
PULONG Result;
|
||||
ULONG Flags;
|
||||
ULONG TotalSize;
|
||||
PVOID DeviceObject;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
GUID ClassGuid;
|
||||
WCHAR SymbolicLinkName[1];
|
||||
} DeviceClass;
|
||||
struct
|
||||
{
|
||||
WCHAR DeviceIds[1];
|
||||
} TargetDevice;
|
||||
struct
|
||||
{
|
||||
WCHAR DeviceId[1];
|
||||
} InstallDevice;
|
||||
struct
|
||||
{
|
||||
PVOID NotificationStructure;
|
||||
WCHAR DeviceIds[1];
|
||||
} CustomNotification;
|
||||
struct
|
||||
{
|
||||
PVOID Notification;
|
||||
} ProfileNotification;
|
||||
struct
|
||||
{
|
||||
ULONG NotificationCode;
|
||||
ULONG NotificationData;
|
||||
} PowerNotification;
|
||||
struct
|
||||
{
|
||||
PNP_VETO_TYPE VetoType;
|
||||
WCHAR DeviceIdVetoNameBuffer[1]; // DeviceId<null>VetoName<null><null>
|
||||
} VetoNotification;
|
||||
struct
|
||||
{
|
||||
GUID BlockedDriverGuid;
|
||||
} BlockedDriverNotification;
|
||||
struct
|
||||
{
|
||||
WCHAR ParentId[1];
|
||||
} InvalidIDNotification;
|
||||
} u;
|
||||
} PLUGPLAY_EVENT_BLOCK, *PPLUGPLAY_EVENT_BLOCK;
|
||||
|
||||
typedef enum _PLUGPLAY_CONTROL_CLASS
|
||||
{
|
||||
PlugPlayControlEnumerateDevice,
|
||||
PlugPlayControlRegisterNewDevice,
|
||||
PlugPlayControlDeregisterDevice,
|
||||
PlugPlayControlInitializeDevice,
|
||||
PlugPlayControlStartDevice,
|
||||
PlugPlayControlUnlockDevice,
|
||||
PlugPlayControlQueryAndRemoveDevice,
|
||||
PlugPlayControlUserResponse,
|
||||
PlugPlayControlGenerateLegacyDevice,
|
||||
PlugPlayControlGetInterfaceDeviceList,
|
||||
PlugPlayControlProperty,
|
||||
PlugPlayControlDeviceClassAssociation,
|
||||
PlugPlayControlGetRelatedDevice,
|
||||
PlugPlayControlGetInterfaceDeviceAlias,
|
||||
PlugPlayControlDeviceStatus,
|
||||
PlugPlayControlGetDeviceDepth,
|
||||
PlugPlayControlQueryDeviceRelations,
|
||||
PlugPlayControlTargetDeviceRelation,
|
||||
PlugPlayControlQueryConflictList,
|
||||
PlugPlayControlRetrieveDock,
|
||||
PlugPlayControlResetDevice,
|
||||
PlugPlayControlHaltDevice,
|
||||
PlugPlayControlGetBlockedDriverList,
|
||||
PlugPlayControlGetDeviceInterfaceEnabled,
|
||||
MaxPlugPlayControl
|
||||
} PLUGPLAY_CONTROL_CLASS, *PPLUGPLAY_CONTROL_CLASS;
|
||||
|
||||
#if (PHNT_VERSION < PHNT_WIN8)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtGetPlugPlayEvent(
|
||||
_In_ HANDLE EventHandle,
|
||||
_In_opt_ PVOID Context,
|
||||
_Out_writes_bytes_(EventBufferSize) PPLUGPLAY_EVENT_BLOCK EventBlock,
|
||||
_In_ ULONG EventBufferSize
|
||||
);
|
||||
#endif
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtPlugPlayControl(
|
||||
_In_ PLUGPLAY_CONTROL_CLASS PnPControlClass,
|
||||
_Inout_updates_bytes_(PnPControlDataLength) PVOID PnPControlData,
|
||||
_In_ ULONG PnPControlDataLength
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN7)
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSerializeBoot(
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtEnableLastKnownGood(
|
||||
VOID
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtDisableLastKnownGood(
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtReplacePartitionUnit(
|
||||
_In_ PUNICODE_STRING TargetInstancePath,
|
||||
_In_ PUNICODE_STRING SpareInstancePath,
|
||||
_In_ ULONG Flags
|
||||
);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTPOAPI_H
|
||||
#define _NTPOAPI_H
|
||||
|
||||
typedef union _POWER_STATE
|
||||
{
|
||||
SYSTEM_POWER_STATE SystemState;
|
||||
DEVICE_POWER_STATE DeviceState;
|
||||
} POWER_STATE, *PPOWER_STATE;
|
||||
|
||||
typedef enum _POWER_STATE_TYPE
|
||||
{
|
||||
SystemPowerState = 0,
|
||||
DevicePowerState
|
||||
} POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
// wdm
|
||||
typedef struct _SYSTEM_POWER_STATE_CONTEXT
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
ULONG Reserved1 : 8;
|
||||
ULONG TargetSystemState : 4;
|
||||
ULONG EffectiveSystemState : 4;
|
||||
ULONG CurrentSystemState : 4;
|
||||
ULONG IgnoreHibernationPath : 1;
|
||||
ULONG PseudoTransition : 1;
|
||||
ULONG Reserved2 : 10;
|
||||
};
|
||||
ULONG ContextAsUlong;
|
||||
};
|
||||
} SYSTEM_POWER_STATE_CONTEXT, *PSYSTEM_POWER_STATE_CONTEXT;
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN7)
|
||||
/** \cond NEVER */ // disable doxygen warning
|
||||
// wdm
|
||||
typedef struct _COUNTED_REASON_CONTEXT
|
||||
{
|
||||
ULONG Version;
|
||||
ULONG Flags;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
UNICODE_STRING ResourceFileName;
|
||||
USHORT ResourceReasonId;
|
||||
ULONG StringCount;
|
||||
PUNICODE_STRING _Field_size_(StringCount) ReasonStrings;
|
||||
};
|
||||
UNICODE_STRING SimpleString;
|
||||
};
|
||||
} COUNTED_REASON_CONTEXT, *PCOUNTED_REASON_CONTEXT;
|
||||
/** \endcond */
|
||||
#endif
|
||||
|
||||
typedef enum _POWER_STATE_HANDLER_TYPE
|
||||
{
|
||||
PowerStateSleeping1 = 0,
|
||||
PowerStateSleeping2 = 1,
|
||||
PowerStateSleeping3 = 2,
|
||||
PowerStateSleeping4 = 3,
|
||||
PowerStateShutdownOff = 4,
|
||||
PowerStateShutdownReset = 5,
|
||||
PowerStateSleeping4Firmware = 6,
|
||||
PowerStateMaximum = 7
|
||||
} POWER_STATE_HANDLER_TYPE, *PPOWER_STATE_HANDLER_TYPE;
|
||||
|
||||
typedef NTSTATUS (NTAPI *PENTER_STATE_SYSTEM_HANDLER)(
|
||||
_In_ PVOID SystemContext
|
||||
);
|
||||
|
||||
typedef NTSTATUS (NTAPI *PENTER_STATE_HANDLER)(
|
||||
_In_ PVOID Context,
|
||||
_In_opt_ PENTER_STATE_SYSTEM_HANDLER SystemHandler,
|
||||
_In_ PVOID SystemContext,
|
||||
_In_ LONG NumberProcessors,
|
||||
_In_ volatile PLONG Number
|
||||
);
|
||||
|
||||
typedef struct _POWER_STATE_HANDLER
|
||||
{
|
||||
POWER_STATE_HANDLER_TYPE Type;
|
||||
BOOLEAN RtcWake;
|
||||
UCHAR Spare[3];
|
||||
PENTER_STATE_HANDLER Handler;
|
||||
PVOID Context;
|
||||
} POWER_STATE_HANDLER, *PPOWER_STATE_HANDLER;
|
||||
|
||||
typedef NTSTATUS (NTAPI *PENTER_STATE_NOTIFY_HANDLER)(
|
||||
_In_ POWER_STATE_HANDLER_TYPE State,
|
||||
_In_ PVOID Context,
|
||||
_In_ BOOLEAN Entering
|
||||
);
|
||||
|
||||
typedef struct _POWER_STATE_NOTIFY_HANDLER
|
||||
{
|
||||
PENTER_STATE_NOTIFY_HANDLER Handler;
|
||||
PVOID Context;
|
||||
} POWER_STATE_NOTIFY_HANDLER, *PPOWER_STATE_NOTIFY_HANDLER;
|
||||
|
||||
typedef struct _PROCESSOR_POWER_INFORMATION
|
||||
{
|
||||
ULONG Number;
|
||||
ULONG MaxMhz;
|
||||
ULONG CurrentMhz;
|
||||
ULONG MhzLimit;
|
||||
ULONG MaxIdleState;
|
||||
ULONG CurrentIdleState;
|
||||
} PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION;
|
||||
|
||||
typedef struct _SYSTEM_POWER_INFORMATION
|
||||
{
|
||||
ULONG MaxIdlenessAllowed;
|
||||
ULONG Idleness;
|
||||
ULONG TimeRemaining;
|
||||
UCHAR CoolingMode;
|
||||
} SYSTEM_POWER_INFORMATION, *PSYSTEM_POWER_INFORMATION;
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtPowerInformation(
|
||||
_In_ POWER_INFORMATION_LEVEL InformationLevel,
|
||||
_In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer,
|
||||
_In_ ULONG InputBufferLength,
|
||||
_Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer,
|
||||
_In_ ULONG OutputBufferLength
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetThreadExecutionState(
|
||||
_In_ EXECUTION_STATE NewFlags, // ES_* flags
|
||||
_Out_ EXECUTION_STATE *PreviousFlags
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRequestWakeupLatency(
|
||||
_In_ LATENCY_TIME latency
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtInitiatePowerAction(
|
||||
_In_ POWER_ACTION SystemAction,
|
||||
_In_ SYSTEM_POWER_STATE LightestSystemState,
|
||||
_In_ ULONG Flags, // POWER_ACTION_* flags
|
||||
_In_ BOOLEAN Asynchronous
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetSystemPowerState(
|
||||
_In_ POWER_ACTION SystemAction,
|
||||
_In_ SYSTEM_POWER_STATE LightestSystemState,
|
||||
_In_ ULONG Flags // POWER_ACTION_* flags
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtGetDevicePowerState(
|
||||
_In_ HANDLE Device,
|
||||
_Out_ PDEVICE_POWER_STATE State
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
NtIsSystemResumeAutomatic(
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,664 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTREGAPI_H
|
||||
#define _NTREGAPI_H
|
||||
|
||||
// Boot condition flags (NtInitializeRegistry)
|
||||
|
||||
#define REG_INIT_BOOT_SM 0x0000
|
||||
#define REG_INIT_BOOT_SETUP 0x0001
|
||||
#define REG_INIT_BOOT_ACCEPTED_BASE 0x0002
|
||||
#define REG_INIT_BOOT_ACCEPTED_MAX REG_INIT_BOOT_ACCEPTED_BASE + 999
|
||||
|
||||
#define REG_MAX_KEY_VALUE_NAME_LENGTH 32767
|
||||
#define REG_MAX_KEY_NAME_LENGTH 512
|
||||
|
||||
typedef enum _KEY_INFORMATION_CLASS
|
||||
{
|
||||
KeyBasicInformation, // KEY_BASIC_INFORMATION
|
||||
KeyNodeInformation, // KEY_NODE_INFORMATION
|
||||
KeyFullInformation, // KEY_FULL_INFORMATION
|
||||
KeyNameInformation, // KEY_NAME_INFORMATION
|
||||
KeyCachedInformation, // KEY_CACHED_INFORMATION
|
||||
KeyFlagsInformation, // KEY_FLAGS_INFORMATION
|
||||
KeyVirtualizationInformation, // KEY_VIRTUALIZATION_INFORMATION
|
||||
KeyHandleTagsInformation, // KEY_HANDLE_TAGS_INFORMATION
|
||||
KeyTrustInformation, // KEY_TRUST_INFORMATION
|
||||
KeyLayerInformation, // KEY_LAYER_INFORMATION
|
||||
MaxKeyInfoClass
|
||||
} KEY_INFORMATION_CLASS;
|
||||
|
||||
typedef struct _KEY_BASIC_INFORMATION
|
||||
{
|
||||
LARGE_INTEGER LastWriteTime;
|
||||
ULONG TitleIndex;
|
||||
ULONG NameLength;
|
||||
WCHAR Name[1];
|
||||
} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
|
||||
|
||||
typedef struct _KEY_NODE_INFORMATION
|
||||
{
|
||||
LARGE_INTEGER LastWriteTime;
|
||||
ULONG TitleIndex;
|
||||
ULONG ClassOffset;
|
||||
ULONG ClassLength;
|
||||
ULONG NameLength;
|
||||
WCHAR Name[1];
|
||||
// ...
|
||||
// WCHAR Class[1];
|
||||
} KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
|
||||
|
||||
typedef struct _KEY_FULL_INFORMATION
|
||||
{
|
||||
LARGE_INTEGER LastWriteTime;
|
||||
ULONG TitleIndex;
|
||||
ULONG ClassOffset;
|
||||
ULONG ClassLength;
|
||||
ULONG SubKeys;
|
||||
ULONG MaxNameLen;
|
||||
ULONG MaxClassLen;
|
||||
ULONG Values;
|
||||
ULONG MaxValueNameLen;
|
||||
ULONG MaxValueDataLen;
|
||||
WCHAR Class[1];
|
||||
} KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
|
||||
|
||||
typedef struct _KEY_NAME_INFORMATION
|
||||
{
|
||||
ULONG NameLength;
|
||||
WCHAR Name[1];
|
||||
} KEY_NAME_INFORMATION, *PKEY_NAME_INFORMATION;
|
||||
|
||||
typedef struct _KEY_CACHED_INFORMATION
|
||||
{
|
||||
LARGE_INTEGER LastWriteTime;
|
||||
ULONG TitleIndex;
|
||||
ULONG SubKeys;
|
||||
ULONG MaxNameLen;
|
||||
ULONG Values;
|
||||
ULONG MaxValueNameLen;
|
||||
ULONG MaxValueDataLen;
|
||||
ULONG NameLength;
|
||||
WCHAR Name[1];
|
||||
} KEY_CACHED_INFORMATION, *PKEY_CACHED_INFORMATION;
|
||||
|
||||
typedef struct _KEY_FLAGS_INFORMATION
|
||||
{
|
||||
ULONG UserFlags;
|
||||
} KEY_FLAGS_INFORMATION, *PKEY_FLAGS_INFORMATION;
|
||||
|
||||
typedef struct _KEY_VIRTUALIZATION_INFORMATION
|
||||
{
|
||||
ULONG VirtualizationCandidate : 1; // Tells whether the key is part of the virtualization namespace scope (only HKLM\Software for now).
|
||||
ULONG VirtualizationEnabled : 1; // Tells whether virtualization is enabled on this key. Can be 1 only if above flag is 1.
|
||||
ULONG VirtualTarget : 1; // Tells if the key is a virtual key. Can be 1 only if above 2 are 0. Valid only on the virtual store key handles.
|
||||
ULONG VirtualStore : 1; // Tells if the key is a part of the virtual store path. Valid only on the virtual store key handles.
|
||||
ULONG VirtualSource : 1; // Tells if the key has ever been virtualized, can be 1 only if VirtualizationCandidate is 1.
|
||||
ULONG Reserved : 27;
|
||||
} KEY_VIRTUALIZATION_INFORMATION, *PKEY_VIRTUALIZATION_INFORMATION;
|
||||
|
||||
// private
|
||||
typedef struct _KEY_TRUST_INFORMATION
|
||||
{
|
||||
ULONG TrustedKey : 1;
|
||||
ULONG Reserved : 31;
|
||||
} KEY_TRUST_INFORMATION, *PKEY_TRUST_INFORMATION;
|
||||
|
||||
// private
|
||||
typedef struct _KEY_LAYER_INFORMATION
|
||||
{
|
||||
ULONG IsTombstone;
|
||||
ULONG IsSupersedeLocal;
|
||||
ULONG IsSupersedeTree;
|
||||
ULONG ClassIsInherited;
|
||||
ULONG Reserved;
|
||||
} KEY_LAYER_INFORMATION, *PKEY_LAYER_INFORMATION;
|
||||
|
||||
typedef enum _KEY_SET_INFORMATION_CLASS
|
||||
{
|
||||
KeyWriteTimeInformation, // KEY_WRITE_TIME_INFORMATION
|
||||
KeyWow64FlagsInformation, // KEY_WOW64_FLAGS_INFORMATION
|
||||
KeyControlFlagsInformation, // KEY_CONTROL_FLAGS_INFORMATION
|
||||
KeySetVirtualizationInformation, // KEY_SET_VIRTUALIZATION_INFORMATION
|
||||
KeySetDebugInformation,
|
||||
KeySetHandleTagsInformation, // KEY_HANDLE_TAGS_INFORMATION
|
||||
KeySetLayerInformation, // KEY_SET_LAYER_INFORMATION
|
||||
MaxKeySetInfoClass
|
||||
} KEY_SET_INFORMATION_CLASS;
|
||||
|
||||
typedef struct _KEY_WRITE_TIME_INFORMATION
|
||||
{
|
||||
LARGE_INTEGER LastWriteTime;
|
||||
} KEY_WRITE_TIME_INFORMATION, *PKEY_WRITE_TIME_INFORMATION;
|
||||
|
||||
typedef struct _KEY_WOW64_FLAGS_INFORMATION
|
||||
{
|
||||
ULONG UserFlags;
|
||||
} KEY_WOW64_FLAGS_INFORMATION, *PKEY_WOW64_FLAGS_INFORMATION;
|
||||
|
||||
typedef struct _KEY_HANDLE_TAGS_INFORMATION
|
||||
{
|
||||
ULONG HandleTags;
|
||||
} KEY_HANDLE_TAGS_INFORMATION, *PKEY_HANDLE_TAGS_INFORMATION;
|
||||
|
||||
typedef struct _KEY_SET_LAYER_INFORMATION
|
||||
{
|
||||
ULONG IsTombstone : 1;
|
||||
ULONG IsSupersedeLocal : 1;
|
||||
ULONG IsSupersedeTree : 1;
|
||||
ULONG ClassIsInherited : 1;
|
||||
ULONG Reserved : 28;
|
||||
} KEY_SET_LAYER_INFORMATION, *PKEY_SET_LAYER_INFORMATION;
|
||||
|
||||
typedef struct _KEY_CONTROL_FLAGS_INFORMATION
|
||||
{
|
||||
ULONG ControlFlags;
|
||||
} KEY_CONTROL_FLAGS_INFORMATION, *PKEY_CONTROL_FLAGS_INFORMATION;
|
||||
|
||||
typedef struct _KEY_SET_VIRTUALIZATION_INFORMATION
|
||||
{
|
||||
ULONG VirtualTarget : 1;
|
||||
ULONG VirtualStore : 1;
|
||||
ULONG VirtualSource : 1; // true if key has been virtualized at least once
|
||||
ULONG Reserved : 29;
|
||||
} KEY_SET_VIRTUALIZATION_INFORMATION, *PKEY_SET_VIRTUALIZATION_INFORMATION;
|
||||
|
||||
typedef enum _KEY_VALUE_INFORMATION_CLASS
|
||||
{
|
||||
KeyValueBasicInformation, // KEY_VALUE_BASIC_INFORMATION
|
||||
KeyValueFullInformation, // KEY_VALUE_FULL_INFORMATION
|
||||
KeyValuePartialInformation, // KEY_VALUE_PARTIAL_INFORMATION
|
||||
KeyValueFullInformationAlign64,
|
||||
KeyValuePartialInformationAlign64, // KEY_VALUE_PARTIAL_INFORMATION_ALIGN64
|
||||
KeyValueLayerInformation, // KEY_VALUE_LAYER_INFORMATION
|
||||
MaxKeyValueInfoClass
|
||||
} KEY_VALUE_INFORMATION_CLASS;
|
||||
|
||||
typedef struct _KEY_VALUE_BASIC_INFORMATION
|
||||
{
|
||||
ULONG TitleIndex;
|
||||
ULONG Type;
|
||||
ULONG NameLength;
|
||||
WCHAR Name[1];
|
||||
} KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
|
||||
|
||||
typedef struct _KEY_VALUE_FULL_INFORMATION
|
||||
{
|
||||
ULONG TitleIndex;
|
||||
ULONG Type;
|
||||
ULONG DataOffset;
|
||||
ULONG DataLength;
|
||||
ULONG NameLength;
|
||||
WCHAR Name[1];
|
||||
// ...
|
||||
// UCHAR Data[1];
|
||||
} KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
|
||||
|
||||
typedef struct _KEY_VALUE_PARTIAL_INFORMATION
|
||||
{
|
||||
ULONG TitleIndex;
|
||||
ULONG Type;
|
||||
ULONG DataLength;
|
||||
UCHAR Data[1];
|
||||
} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
|
||||
|
||||
typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64
|
||||
{
|
||||
ULONG Type;
|
||||
ULONG DataLength;
|
||||
UCHAR Data[1];
|
||||
} KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64;
|
||||
|
||||
// private
|
||||
typedef struct _KEY_VALUE_LAYER_INFORMATION
|
||||
{
|
||||
ULONG IsTombstone;
|
||||
ULONG Reserved;
|
||||
} KEY_VALUE_LAYER_INFORMATION, *PKEY_VALUE_LAYER_INFORMATION;
|
||||
|
||||
typedef struct _KEY_VALUE_ENTRY
|
||||
{
|
||||
PUNICODE_STRING ValueName;
|
||||
ULONG DataLength;
|
||||
ULONG DataOffset;
|
||||
ULONG Type;
|
||||
} KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
|
||||
|
||||
typedef enum _REG_ACTION
|
||||
{
|
||||
KeyAdded,
|
||||
KeyRemoved,
|
||||
KeyModified
|
||||
} REG_ACTION;
|
||||
|
||||
typedef struct _REG_NOTIFY_INFORMATION
|
||||
{
|
||||
ULONG NextEntryOffset;
|
||||
REG_ACTION Action;
|
||||
ULONG KeyLength;
|
||||
WCHAR Key[1];
|
||||
} REG_NOTIFY_INFORMATION, *PREG_NOTIFY_INFORMATION;
|
||||
|
||||
typedef struct _KEY_PID_ARRAY
|
||||
{
|
||||
HANDLE ProcessId;
|
||||
UNICODE_STRING KeyName;
|
||||
} KEY_PID_ARRAY, *PKEY_PID_ARRAY;
|
||||
|
||||
typedef struct _KEY_OPEN_SUBKEYS_INFORMATION
|
||||
{
|
||||
ULONG Count;
|
||||
KEY_PID_ARRAY KeyArray[1];
|
||||
} KEY_OPEN_SUBKEYS_INFORMATION, *PKEY_OPEN_SUBKEYS_INFORMATION;
|
||||
|
||||
// System calls
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateKey(
|
||||
_Out_ PHANDLE KeyHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_Reserved_ ULONG TitleIndex,
|
||||
_In_opt_ PUNICODE_STRING Class,
|
||||
_In_ ULONG CreateOptions,
|
||||
_Out_opt_ PULONG Disposition
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateKeyTransacted(
|
||||
_Out_ PHANDLE KeyHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_Reserved_ ULONG TitleIndex,
|
||||
_In_opt_ PUNICODE_STRING Class,
|
||||
_In_ ULONG CreateOptions,
|
||||
_In_ HANDLE TransactionHandle,
|
||||
_Out_opt_ PULONG Disposition
|
||||
);
|
||||
#endif
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenKey(
|
||||
_Out_ PHANDLE KeyHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenKeyTransacted(
|
||||
_Out_ PHANDLE KeyHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_ HANDLE TransactionHandle
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN7)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenKeyEx(
|
||||
_Out_ PHANDLE KeyHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_ ULONG OpenOptions
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN7)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenKeyTransactedEx(
|
||||
_Out_ PHANDLE KeyHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_ ULONG OpenOptions,
|
||||
_In_ HANDLE TransactionHandle
|
||||
);
|
||||
#endif
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtDeleteKey(
|
||||
_In_ HANDLE KeyHandle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRenameKey(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ PUNICODE_STRING NewName
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtDeleteValueKey(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ PUNICODE_STRING ValueName
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQueryKey(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ KEY_INFORMATION_CLASS KeyInformationClass,
|
||||
_Out_writes_bytes_opt_(Length) PVOID KeyInformation,
|
||||
_In_ ULONG Length,
|
||||
_Out_ PULONG ResultLength
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetInformationKey(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ KEY_SET_INFORMATION_CLASS KeySetInformationClass,
|
||||
_In_reads_bytes_(KeySetInformationLength) PVOID KeySetInformation,
|
||||
_In_ ULONG KeySetInformationLength
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQueryValueKey(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ PUNICODE_STRING ValueName,
|
||||
_In_ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
|
||||
_Out_writes_bytes_opt_(Length) PVOID KeyValueInformation,
|
||||
_In_ ULONG Length,
|
||||
_Out_ PULONG ResultLength
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetValueKey(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ PUNICODE_STRING ValueName,
|
||||
_In_opt_ ULONG TitleIndex,
|
||||
_In_ ULONG Type,
|
||||
_In_reads_bytes_opt_(DataSize) PVOID Data,
|
||||
_In_ ULONG DataSize
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQueryMultipleValueKey(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_Inout_updates_(EntryCount) PKEY_VALUE_ENTRY ValueEntries,
|
||||
_In_ ULONG EntryCount,
|
||||
_Out_writes_bytes_(*BufferLength) PVOID ValueBuffer,
|
||||
_Inout_ PULONG BufferLength,
|
||||
_Out_opt_ PULONG RequiredBufferLength
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtEnumerateKey(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ ULONG Index,
|
||||
_In_ KEY_INFORMATION_CLASS KeyInformationClass,
|
||||
_Out_writes_bytes_opt_(Length) PVOID KeyInformation,
|
||||
_In_ ULONG Length,
|
||||
_Out_ PULONG ResultLength
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtEnumerateValueKey(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ ULONG Index,
|
||||
_In_ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
|
||||
_Out_writes_bytes_opt_(Length) PVOID KeyValueInformation,
|
||||
_In_ ULONG Length,
|
||||
_Out_ PULONG ResultLength
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtFlushKey(
|
||||
_In_ HANDLE KeyHandle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCompactKeys(
|
||||
_In_ ULONG Count,
|
||||
_In_reads_(Count) HANDLE KeyArray[]
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCompressKey(
|
||||
_In_ HANDLE Key
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtLoadKey(
|
||||
_In_ POBJECT_ATTRIBUTES TargetKey,
|
||||
_In_ POBJECT_ATTRIBUTES SourceFile
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtLoadKey2(
|
||||
_In_ POBJECT_ATTRIBUTES TargetKey,
|
||||
_In_ POBJECT_ATTRIBUTES SourceFile,
|
||||
_In_ ULONG Flags
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtLoadKeyEx(
|
||||
_In_ POBJECT_ATTRIBUTES TargetKey,
|
||||
_In_ POBJECT_ATTRIBUTES SourceFile,
|
||||
_In_ ULONG Flags,
|
||||
_In_opt_ HANDLE TrustClassKey,
|
||||
_In_opt_ HANDLE Event,
|
||||
_In_opt_ ACCESS_MASK DesiredAccess,
|
||||
_Out_opt_ PHANDLE RootHandle,
|
||||
_Out_opt_ PIO_STATUS_BLOCK IoStatus
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtReplaceKey(
|
||||
_In_ POBJECT_ATTRIBUTES NewFile,
|
||||
_In_ HANDLE TargetHandle,
|
||||
_In_ POBJECT_ATTRIBUTES OldFile
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSaveKey(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ HANDLE FileHandle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSaveKeyEx(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ HANDLE FileHandle,
|
||||
_In_ ULONG Format
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSaveMergedKeys(
|
||||
_In_ HANDLE HighPrecedenceKeyHandle,
|
||||
_In_ HANDLE LowPrecedenceKeyHandle,
|
||||
_In_ HANDLE FileHandle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRestoreKey(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_ HANDLE FileHandle,
|
||||
_In_ ULONG Flags
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtUnloadKey(
|
||||
_In_ POBJECT_ATTRIBUTES TargetKey
|
||||
);
|
||||
|
||||
//
|
||||
// NtUnloadKey2 Flags (from winnt.h)
|
||||
//
|
||||
//#define REG_FORCE_UNLOAD 1
|
||||
//#define REG_UNLOAD_LEGAL_FLAGS (REG_FORCE_UNLOAD)
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtUnloadKey2(
|
||||
_In_ POBJECT_ATTRIBUTES TargetKey,
|
||||
_In_ ULONG Flags
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtUnloadKeyEx(
|
||||
_In_ POBJECT_ATTRIBUTES TargetKey,
|
||||
_In_opt_ HANDLE Event
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtNotifyChangeKey(
|
||||
_In_ HANDLE KeyHandle,
|
||||
_In_opt_ HANDLE Event,
|
||||
_In_opt_ PIO_APC_ROUTINE ApcRoutine,
|
||||
_In_opt_ PVOID ApcContext,
|
||||
_Out_ PIO_STATUS_BLOCK IoStatusBlock,
|
||||
_In_ ULONG CompletionFilter,
|
||||
_In_ BOOLEAN WatchTree,
|
||||
_Out_writes_bytes_opt_(BufferSize) PVOID Buffer,
|
||||
_In_ ULONG BufferSize,
|
||||
_In_ BOOLEAN Asynchronous
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtNotifyChangeMultipleKeys(
|
||||
_In_ HANDLE MasterKeyHandle,
|
||||
_In_opt_ ULONG Count,
|
||||
_In_reads_opt_(Count) OBJECT_ATTRIBUTES SubordinateObjects[],
|
||||
_In_opt_ HANDLE Event,
|
||||
_In_opt_ PIO_APC_ROUTINE ApcRoutine,
|
||||
_In_opt_ PVOID ApcContext,
|
||||
_Out_ PIO_STATUS_BLOCK IoStatusBlock,
|
||||
_In_ ULONG CompletionFilter,
|
||||
_In_ BOOLEAN WatchTree,
|
||||
_Out_writes_bytes_opt_(BufferSize) PVOID Buffer,
|
||||
_In_ ULONG BufferSize,
|
||||
_In_ BOOLEAN Asynchronous
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQueryOpenSubKeys(
|
||||
_In_ POBJECT_ATTRIBUTES TargetKey,
|
||||
_Out_ PULONG HandleCount
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQueryOpenSubKeysEx(
|
||||
_In_ POBJECT_ATTRIBUTES TargetKey,
|
||||
_In_ ULONG BufferLength,
|
||||
_Out_writes_bytes_opt_(BufferLength) PVOID Buffer,
|
||||
_Out_ PULONG RequiredSize
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtInitializeRegistry(
|
||||
_In_ USHORT BootCondition
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtLockRegistryKey(
|
||||
_In_ HANDLE KeyHandle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtLockProductActivationKeys(
|
||||
_Inout_opt_ ULONG *pPrivateVer,
|
||||
_Out_opt_ ULONG *pSafeMode
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
// private
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtFreezeRegistry(
|
||||
_In_ ULONG TimeOutInSeconds
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
// private
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtThawRegistry(
|
||||
VOID
|
||||
);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,630 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTSEAPI_H
|
||||
#define _NTSEAPI_H
|
||||
|
||||
// Privileges
|
||||
|
||||
#define SE_MIN_WELL_KNOWN_PRIVILEGE (2L)
|
||||
#define SE_CREATE_TOKEN_PRIVILEGE (2L)
|
||||
#define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE (3L)
|
||||
#define SE_LOCK_MEMORY_PRIVILEGE (4L)
|
||||
#define SE_INCREASE_QUOTA_PRIVILEGE (5L)
|
||||
|
||||
#define SE_MACHINE_ACCOUNT_PRIVILEGE (6L)
|
||||
#define SE_TCB_PRIVILEGE (7L)
|
||||
#define SE_SECURITY_PRIVILEGE (8L)
|
||||
#define SE_TAKE_OWNERSHIP_PRIVILEGE (9L)
|
||||
#define SE_LOAD_DRIVER_PRIVILEGE (10L)
|
||||
#define SE_SYSTEM_PROFILE_PRIVILEGE (11L)
|
||||
#define SE_SYSTEMTIME_PRIVILEGE (12L)
|
||||
#define SE_PROF_SINGLE_PROCESS_PRIVILEGE (13L)
|
||||
#define SE_INC_BASE_PRIORITY_PRIVILEGE (14L)
|
||||
#define SE_CREATE_PAGEFILE_PRIVILEGE (15L)
|
||||
#define SE_CREATE_PERMANENT_PRIVILEGE (16L)
|
||||
#define SE_BACKUP_PRIVILEGE (17L)
|
||||
#define SE_RESTORE_PRIVILEGE (18L)
|
||||
#define SE_SHUTDOWN_PRIVILEGE (19L)
|
||||
#define SE_DEBUG_PRIVILEGE (20L)
|
||||
#define SE_AUDIT_PRIVILEGE (21L)
|
||||
#define SE_SYSTEM_ENVIRONMENT_PRIVILEGE (22L)
|
||||
#define SE_CHANGE_NOTIFY_PRIVILEGE (23L)
|
||||
#define SE_REMOTE_SHUTDOWN_PRIVILEGE (24L)
|
||||
#define SE_UNDOCK_PRIVILEGE (25L)
|
||||
#define SE_SYNC_AGENT_PRIVILEGE (26L)
|
||||
#define SE_ENABLE_DELEGATION_PRIVILEGE (27L)
|
||||
#define SE_MANAGE_VOLUME_PRIVILEGE (28L)
|
||||
#define SE_IMPERSONATE_PRIVILEGE (29L)
|
||||
#define SE_CREATE_GLOBAL_PRIVILEGE (30L)
|
||||
#define SE_TRUSTED_CREDMAN_ACCESS_PRIVILEGE (31L)
|
||||
#define SE_RELABEL_PRIVILEGE (32L)
|
||||
#define SE_INC_WORKING_SET_PRIVILEGE (33L)
|
||||
#define SE_TIME_ZONE_PRIVILEGE (34L)
|
||||
#define SE_CREATE_SYMBOLIC_LINK_PRIVILEGE (35L)
|
||||
#define SE_DELEGATE_SESSION_USER_IMPERSONATE_PRIVILEGE (36L)
|
||||
#define SE_MAX_WELL_KNOWN_PRIVILEGE SE_DELEGATE_SESSION_USER_IMPERSONATE_PRIVILEGE
|
||||
|
||||
// Authz
|
||||
|
||||
// begin_rev
|
||||
|
||||
// Types
|
||||
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_TYPE_INVALID 0x00
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_TYPE_INT64 0x01
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_TYPE_UINT64 0x02
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_TYPE_STRING 0x03
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_TYPE_FQBN 0x04
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_TYPE_SID 0x05
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_TYPE_BOOLEAN 0x06
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_TYPE_OCTET_STRING 0x10
|
||||
|
||||
// Flags
|
||||
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_NON_INHERITABLE 0x0001
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE 0x0002
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY 0x0004
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT 0x0008
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_DISABLED 0x0010
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_MANDATORY 0x0020
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_COMPARE_IGNORE 0x0040
|
||||
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_VALID_FLAGS ( \
|
||||
TOKEN_SECURITY_ATTRIBUTE_NON_INHERITABLE | \
|
||||
TOKEN_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE | \
|
||||
TOKEN_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY | \
|
||||
TOKEN_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT | \
|
||||
TOKEN_SECURITY_ATTRIBUTE_DISABLED | \
|
||||
TOKEN_SECURITY_ATTRIBUTE_MANDATORY)
|
||||
|
||||
#define TOKEN_SECURITY_ATTRIBUTE_CUSTOM_FLAGS 0xffff0000
|
||||
|
||||
// end_rev
|
||||
|
||||
// private
|
||||
typedef struct _TOKEN_SECURITY_ATTRIBUTE_FQBN_VALUE
|
||||
{
|
||||
ULONG64 Version;
|
||||
UNICODE_STRING Name;
|
||||
} TOKEN_SECURITY_ATTRIBUTE_FQBN_VALUE, *PTOKEN_SECURITY_ATTRIBUTE_FQBN_VALUE;
|
||||
|
||||
// private
|
||||
typedef struct _TOKEN_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE
|
||||
{
|
||||
PVOID pValue;
|
||||
ULONG ValueLength;
|
||||
} TOKEN_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE, *PTOKEN_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE;
|
||||
|
||||
// private
|
||||
typedef struct _TOKEN_SECURITY_ATTRIBUTE_V1
|
||||
{
|
||||
UNICODE_STRING Name;
|
||||
USHORT ValueType;
|
||||
USHORT Reserved;
|
||||
ULONG Flags;
|
||||
ULONG ValueCount;
|
||||
union
|
||||
{
|
||||
PLONG64 pInt64;
|
||||
PULONG64 pUint64;
|
||||
PUNICODE_STRING pString;
|
||||
PTOKEN_SECURITY_ATTRIBUTE_FQBN_VALUE pFqbn;
|
||||
PTOKEN_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE pOctetString;
|
||||
} Values;
|
||||
} TOKEN_SECURITY_ATTRIBUTE_V1, *PTOKEN_SECURITY_ATTRIBUTE_V1;
|
||||
|
||||
// rev
|
||||
#define TOKEN_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1 1
|
||||
// rev
|
||||
#define TOKEN_SECURITY_ATTRIBUTES_INFORMATION_VERSION TOKEN_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1
|
||||
|
||||
// private
|
||||
typedef struct _TOKEN_SECURITY_ATTRIBUTES_INFORMATION
|
||||
{
|
||||
USHORT Version;
|
||||
USHORT Reserved;
|
||||
ULONG AttributeCount;
|
||||
union
|
||||
{
|
||||
PTOKEN_SECURITY_ATTRIBUTE_V1 pAttributeV1;
|
||||
} Attribute;
|
||||
} TOKEN_SECURITY_ATTRIBUTES_INFORMATION, *PTOKEN_SECURITY_ATTRIBUTES_INFORMATION;
|
||||
|
||||
// rev
|
||||
typedef struct _TOKEN_PROCESS_TRUST_LEVEL
|
||||
{
|
||||
PSID TrustLevelSid;
|
||||
} TOKEN_PROCESS_TRUST_LEVEL, *PTOKEN_PROCESS_TRUST_LEVEL;
|
||||
|
||||
// Tokens
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateToken(
|
||||
_Out_ PHANDLE TokenHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_ TOKEN_TYPE TokenType,
|
||||
_In_ PLUID AuthenticationId,
|
||||
_In_ PLARGE_INTEGER ExpirationTime,
|
||||
_In_ PTOKEN_USER User,
|
||||
_In_ PTOKEN_GROUPS Groups,
|
||||
_In_ PTOKEN_PRIVILEGES Privileges,
|
||||
_In_opt_ PTOKEN_OWNER Owner,
|
||||
_In_ PTOKEN_PRIMARY_GROUP PrimaryGroup,
|
||||
_In_opt_ PTOKEN_DEFAULT_DACL DefaultDacl,
|
||||
_In_ PTOKEN_SOURCE TokenSource
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN8)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateLowBoxToken(
|
||||
_Out_ PHANDLE TokenHandle,
|
||||
_In_ HANDLE ExistingTokenHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_ PSID PackageSid,
|
||||
_In_ ULONG CapabilityCount,
|
||||
_In_reads_opt_(CapabilityCount) PSID_AND_ATTRIBUTES Capabilities,
|
||||
_In_ ULONG HandleCount,
|
||||
_In_reads_opt_(HandleCount) HANDLE *Handles
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN8)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateTokenEx(
|
||||
_Out_ PHANDLE TokenHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_ TOKEN_TYPE TokenType,
|
||||
_In_ PLUID AuthenticationId,
|
||||
_In_ PLARGE_INTEGER ExpirationTime,
|
||||
_In_ PTOKEN_USER User,
|
||||
_In_ PTOKEN_GROUPS Groups,
|
||||
_In_ PTOKEN_PRIVILEGES Privileges,
|
||||
_In_opt_ PTOKEN_SECURITY_ATTRIBUTES_INFORMATION UserAttributes,
|
||||
_In_opt_ PTOKEN_SECURITY_ATTRIBUTES_INFORMATION DeviceAttributes,
|
||||
_In_opt_ PTOKEN_GROUPS DeviceGroups,
|
||||
_In_opt_ PTOKEN_MANDATORY_POLICY TokenMandatoryPolicy,
|
||||
_In_opt_ PTOKEN_OWNER Owner,
|
||||
_In_ PTOKEN_PRIMARY_GROUP PrimaryGroup,
|
||||
_In_opt_ PTOKEN_DEFAULT_DACL DefaultDacl,
|
||||
_In_ PTOKEN_SOURCE TokenSource
|
||||
);
|
||||
#endif
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenProcessToken(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_Out_ PHANDLE TokenHandle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenProcessTokenEx(
|
||||
_In_ HANDLE ProcessHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ ULONG HandleAttributes,
|
||||
_Out_ PHANDLE TokenHandle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenThreadToken(
|
||||
_In_ HANDLE ThreadHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ BOOLEAN OpenAsSelf,
|
||||
_Out_ PHANDLE TokenHandle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenThreadTokenEx(
|
||||
_In_ HANDLE ThreadHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ BOOLEAN OpenAsSelf,
|
||||
_In_ ULONG HandleAttributes,
|
||||
_Out_ PHANDLE TokenHandle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtDuplicateToken(
|
||||
_In_ HANDLE ExistingTokenHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_ BOOLEAN EffectiveOnly,
|
||||
_In_ TOKEN_TYPE TokenType,
|
||||
_Out_ PHANDLE NewTokenHandle
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQueryInformationToken(
|
||||
_In_ HANDLE TokenHandle,
|
||||
_In_ TOKEN_INFORMATION_CLASS TokenInformationClass,
|
||||
_Out_writes_bytes_(TokenInformationLength) PVOID TokenInformation,
|
||||
_In_ ULONG TokenInformationLength,
|
||||
_Out_ PULONG ReturnLength
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetInformationToken(
|
||||
_In_ HANDLE TokenHandle,
|
||||
_In_ TOKEN_INFORMATION_CLASS TokenInformationClass,
|
||||
_In_reads_bytes_(TokenInformationLength) PVOID TokenInformation,
|
||||
_In_ ULONG TokenInformationLength
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtAdjustPrivilegesToken(
|
||||
_In_ HANDLE TokenHandle,
|
||||
_In_ BOOLEAN DisableAllPrivileges,
|
||||
_In_opt_ PTOKEN_PRIVILEGES NewState,
|
||||
_In_ ULONG BufferLength,
|
||||
_Out_writes_bytes_to_opt_(BufferLength, *ReturnLength) PTOKEN_PRIVILEGES PreviousState,
|
||||
_Out_opt_ PULONG ReturnLength
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtAdjustGroupsToken(
|
||||
_In_ HANDLE TokenHandle,
|
||||
_In_ BOOLEAN ResetToDefault,
|
||||
_In_opt_ PTOKEN_GROUPS NewState,
|
||||
_In_opt_ ULONG BufferLength,
|
||||
_Out_writes_bytes_to_opt_(BufferLength, *ReturnLength) PTOKEN_GROUPS PreviousState,
|
||||
_Out_opt_ PULONG ReturnLength
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN8)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtAdjustTokenClaimsAndDeviceGroups(
|
||||
_In_ HANDLE TokenHandle,
|
||||
_In_ BOOLEAN UserResetToDefault,
|
||||
_In_ BOOLEAN DeviceResetToDefault,
|
||||
_In_ BOOLEAN DeviceGroupsResetToDefault,
|
||||
_In_opt_ PTOKEN_SECURITY_ATTRIBUTES_INFORMATION NewUserState,
|
||||
_In_opt_ PTOKEN_SECURITY_ATTRIBUTES_INFORMATION NewDeviceState,
|
||||
_In_opt_ PTOKEN_GROUPS NewDeviceGroupsState,
|
||||
_In_ ULONG UserBufferLength,
|
||||
_Out_writes_bytes_to_opt_(UserBufferLength, *UserReturnLength) PTOKEN_SECURITY_ATTRIBUTES_INFORMATION PreviousUserState,
|
||||
_In_ ULONG DeviceBufferLength,
|
||||
_Out_writes_bytes_to_opt_(DeviceBufferLength, *DeviceReturnLength) PTOKEN_SECURITY_ATTRIBUTES_INFORMATION PreviousDeviceState,
|
||||
_In_ ULONG DeviceGroupsBufferLength,
|
||||
_Out_writes_bytes_to_opt_(DeviceGroupsBufferLength, *DeviceGroupsReturnBufferLength) PTOKEN_GROUPS PreviousDeviceGroups,
|
||||
_Out_opt_ PULONG UserReturnLength,
|
||||
_Out_opt_ PULONG DeviceReturnLength,
|
||||
_Out_opt_ PULONG DeviceGroupsReturnBufferLength
|
||||
);
|
||||
#endif
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtFilterToken(
|
||||
_In_ HANDLE ExistingTokenHandle,
|
||||
_In_ ULONG Flags,
|
||||
_In_opt_ PTOKEN_GROUPS SidsToDisable,
|
||||
_In_opt_ PTOKEN_PRIVILEGES PrivilegesToDelete,
|
||||
_In_opt_ PTOKEN_GROUPS RestrictedSids,
|
||||
_Out_ PHANDLE NewTokenHandle
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN8)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtFilterTokenEx(
|
||||
_In_ HANDLE ExistingTokenHandle,
|
||||
_In_ ULONG Flags,
|
||||
_In_opt_ PTOKEN_GROUPS SidsToDisable,
|
||||
_In_opt_ PTOKEN_PRIVILEGES PrivilegesToDelete,
|
||||
_In_opt_ PTOKEN_GROUPS RestrictedSids,
|
||||
_In_ ULONG DisableUserClaimsCount,
|
||||
_In_opt_ PUNICODE_STRING UserClaimsToDisable,
|
||||
_In_ ULONG DisableDeviceClaimsCount,
|
||||
_In_opt_ PUNICODE_STRING DeviceClaimsToDisable,
|
||||
_In_opt_ PTOKEN_GROUPS DeviceGroupsToDisable,
|
||||
_In_opt_ PTOKEN_SECURITY_ATTRIBUTES_INFORMATION RestrictedUserAttributes,
|
||||
_In_opt_ PTOKEN_SECURITY_ATTRIBUTES_INFORMATION RestrictedDeviceAttributes,
|
||||
_In_opt_ PTOKEN_GROUPS RestrictedDeviceGroups,
|
||||
_Out_ PHANDLE NewTokenHandle
|
||||
);
|
||||
#endif
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCompareTokens(
|
||||
_In_ HANDLE FirstTokenHandle,
|
||||
_In_ HANDLE SecondTokenHandle,
|
||||
_Out_ PBOOLEAN Equal
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtPrivilegeCheck(
|
||||
_In_ HANDLE ClientToken,
|
||||
_Inout_ PPRIVILEGE_SET RequiredPrivileges,
|
||||
_Out_ PBOOLEAN Result
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtImpersonateAnonymousToken(
|
||||
_In_ HANDLE ThreadHandle
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN7)
|
||||
// rev
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQuerySecurityAttributesToken(
|
||||
_In_ HANDLE TokenHandle,
|
||||
_In_reads_opt_(NumberOfAttributes) PUNICODE_STRING Attributes,
|
||||
_In_ ULONG NumberOfAttributes,
|
||||
_Out_writes_bytes_(Length) PVOID Buffer, // PTOKEN_SECURITY_ATTRIBUTES_INFORMATION
|
||||
_In_ ULONG Length,
|
||||
_Out_ PULONG ReturnLength
|
||||
);
|
||||
#endif
|
||||
|
||||
// Access checking
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtAccessCheck(
|
||||
_In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
_In_ HANDLE ClientToken,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ PGENERIC_MAPPING GenericMapping,
|
||||
_Out_writes_bytes_(*PrivilegeSetLength) PPRIVILEGE_SET PrivilegeSet,
|
||||
_Inout_ PULONG PrivilegeSetLength,
|
||||
_Out_ PACCESS_MASK GrantedAccess,
|
||||
_Out_ PNTSTATUS AccessStatus
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtAccessCheckByType(
|
||||
_In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
_In_opt_ PSID PrincipalSelfSid,
|
||||
_In_ HANDLE ClientToken,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_reads_(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList,
|
||||
_In_ ULONG ObjectTypeListLength,
|
||||
_In_ PGENERIC_MAPPING GenericMapping,
|
||||
_Out_writes_bytes_(*PrivilegeSetLength) PPRIVILEGE_SET PrivilegeSet,
|
||||
_Inout_ PULONG PrivilegeSetLength,
|
||||
_Out_ PACCESS_MASK GrantedAccess,
|
||||
_Out_ PNTSTATUS AccessStatus
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtAccessCheckByTypeResultList(
|
||||
_In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
_In_opt_ PSID PrincipalSelfSid,
|
||||
_In_ HANDLE ClientToken,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_reads_(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList,
|
||||
_In_ ULONG ObjectTypeListLength,
|
||||
_In_ PGENERIC_MAPPING GenericMapping,
|
||||
_Out_writes_bytes_(*PrivilegeSetLength) PPRIVILEGE_SET PrivilegeSet,
|
||||
_Inout_ PULONG PrivilegeSetLength,
|
||||
_Out_writes_(ObjectTypeListLength) PACCESS_MASK GrantedAccess,
|
||||
_Out_writes_(ObjectTypeListLength) PNTSTATUS AccessStatus
|
||||
);
|
||||
|
||||
// Signing
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_THRESHOLD)
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetCachedSigningLevel(
|
||||
_In_ ULONG Flags,
|
||||
_In_ SE_SIGNING_LEVEL InputSigningLevel,
|
||||
_In_reads_(SourceFileCount) PHANDLE SourceFiles,
|
||||
_In_ ULONG SourceFileCount,
|
||||
_In_opt_ HANDLE TargetFile
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtGetCachedSigningLevel(
|
||||
_In_ HANDLE File,
|
||||
_Out_ PULONG Flags,
|
||||
_Out_ PSE_SIGNING_LEVEL SigningLevel,
|
||||
_Out_writes_bytes_to_opt_(*ThumbprintSize, *ThumbprintSize) PUCHAR Thumbprint,
|
||||
_Inout_opt_ PULONG ThumbprintSize,
|
||||
_Out_opt_ PULONG ThumbprintAlgorithm
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
// Audit alarm
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtAccessCheckAndAuditAlarm(
|
||||
_In_ PUNICODE_STRING SubsystemName,
|
||||
_In_opt_ PVOID HandleId,
|
||||
_In_ PUNICODE_STRING ObjectTypeName,
|
||||
_In_ PUNICODE_STRING ObjectName,
|
||||
_In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ PGENERIC_MAPPING GenericMapping,
|
||||
_In_ BOOLEAN ObjectCreation,
|
||||
_Out_ PACCESS_MASK GrantedAccess,
|
||||
_Out_ PNTSTATUS AccessStatus,
|
||||
_Out_ PBOOLEAN GenerateOnClose
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtAccessCheckByTypeAndAuditAlarm(
|
||||
_In_ PUNICODE_STRING SubsystemName,
|
||||
_In_opt_ PVOID HandleId,
|
||||
_In_ PUNICODE_STRING ObjectTypeName,
|
||||
_In_ PUNICODE_STRING ObjectName,
|
||||
_In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
_In_opt_ PSID PrincipalSelfSid,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ AUDIT_EVENT_TYPE AuditType,
|
||||
_In_ ULONG Flags,
|
||||
_In_reads_opt_(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList,
|
||||
_In_ ULONG ObjectTypeListLength,
|
||||
_In_ PGENERIC_MAPPING GenericMapping,
|
||||
_In_ BOOLEAN ObjectCreation,
|
||||
_Out_ PACCESS_MASK GrantedAccess,
|
||||
_Out_ PNTSTATUS AccessStatus,
|
||||
_Out_ PBOOLEAN GenerateOnClose
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtAccessCheckByTypeResultListAndAuditAlarm(
|
||||
_In_ PUNICODE_STRING SubsystemName,
|
||||
_In_opt_ PVOID HandleId,
|
||||
_In_ PUNICODE_STRING ObjectTypeName,
|
||||
_In_ PUNICODE_STRING ObjectName,
|
||||
_In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
_In_opt_ PSID PrincipalSelfSid,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ AUDIT_EVENT_TYPE AuditType,
|
||||
_In_ ULONG Flags,
|
||||
_In_reads_opt_(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList,
|
||||
_In_ ULONG ObjectTypeListLength,
|
||||
_In_ PGENERIC_MAPPING GenericMapping,
|
||||
_In_ BOOLEAN ObjectCreation,
|
||||
_Out_writes_(ObjectTypeListLength) PACCESS_MASK GrantedAccess,
|
||||
_Out_writes_(ObjectTypeListLength) PNTSTATUS AccessStatus,
|
||||
_Out_ PBOOLEAN GenerateOnClose
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtAccessCheckByTypeResultListAndAuditAlarmByHandle(
|
||||
_In_ PUNICODE_STRING SubsystemName,
|
||||
_In_opt_ PVOID HandleId,
|
||||
_In_ HANDLE ClientToken,
|
||||
_In_ PUNICODE_STRING ObjectTypeName,
|
||||
_In_ PUNICODE_STRING ObjectName,
|
||||
_In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
_In_opt_ PSID PrincipalSelfSid,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ AUDIT_EVENT_TYPE AuditType,
|
||||
_In_ ULONG Flags,
|
||||
_In_reads_opt_(ObjectTypeListLength) POBJECT_TYPE_LIST ObjectTypeList,
|
||||
_In_ ULONG ObjectTypeListLength,
|
||||
_In_ PGENERIC_MAPPING GenericMapping,
|
||||
_In_ BOOLEAN ObjectCreation,
|
||||
_Out_writes_(ObjectTypeListLength) PACCESS_MASK GrantedAccess,
|
||||
_Out_writes_(ObjectTypeListLength) PNTSTATUS AccessStatus,
|
||||
_Out_ PBOOLEAN GenerateOnClose
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenObjectAuditAlarm(
|
||||
_In_ PUNICODE_STRING SubsystemName,
|
||||
_In_opt_ PVOID HandleId,
|
||||
_In_ PUNICODE_STRING ObjectTypeName,
|
||||
_In_ PUNICODE_STRING ObjectName,
|
||||
_In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
_In_ HANDLE ClientToken,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ ACCESS_MASK GrantedAccess,
|
||||
_In_opt_ PPRIVILEGE_SET Privileges,
|
||||
_In_ BOOLEAN ObjectCreation,
|
||||
_In_ BOOLEAN AccessGranted,
|
||||
_Out_ PBOOLEAN GenerateOnClose
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtPrivilegeObjectAuditAlarm(
|
||||
_In_ PUNICODE_STRING SubsystemName,
|
||||
_In_opt_ PVOID HandleId,
|
||||
_In_ HANDLE ClientToken,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ PPRIVILEGE_SET Privileges,
|
||||
_In_ BOOLEAN AccessGranted
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCloseObjectAuditAlarm(
|
||||
_In_ PUNICODE_STRING SubsystemName,
|
||||
_In_opt_ PVOID HandleId,
|
||||
_In_ BOOLEAN GenerateOnClose
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtDeleteObjectAuditAlarm(
|
||||
_In_ PUNICODE_STRING SubsystemName,
|
||||
_In_opt_ PVOID HandleId,
|
||||
_In_ BOOLEAN GenerateOnClose
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtPrivilegedServiceAuditAlarm(
|
||||
_In_ PUNICODE_STRING SubsystemName,
|
||||
_In_ PUNICODE_STRING ServiceName,
|
||||
_In_ HANDLE ClientToken,
|
||||
_In_ PPRIVILEGE_SET Privileges,
|
||||
_In_ BOOLEAN AccessGranted
|
||||
);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTSMSS_H
|
||||
#define _NTSMSS_H
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlConnectToSm(
|
||||
_In_ PUNICODE_STRING ApiPortName,
|
||||
_In_ HANDLE ApiPortHandle,
|
||||
_In_ DWORD ProcessImageType,
|
||||
_Out_ PHANDLE SmssConnection
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlSendMsgToSm(
|
||||
_In_ HANDLE ApiPortHandle,
|
||||
_In_ PPORT_MESSAGE MessageData
|
||||
);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,484 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTTMAPI_H
|
||||
#define _NTTMAPI_H
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateTransactionManager(
|
||||
_Out_ PHANDLE TmHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_opt_ PUNICODE_STRING LogFileName,
|
||||
_In_opt_ ULONG CreateOptions,
|
||||
_In_opt_ ULONG CommitStrength
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenTransactionManager(
|
||||
_Out_ PHANDLE TmHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_opt_ PUNICODE_STRING LogFileName,
|
||||
_In_opt_ LPGUID TmIdentity,
|
||||
_In_opt_ ULONG OpenOptions
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRenameTransactionManager(
|
||||
_In_ PUNICODE_STRING LogFileName,
|
||||
_In_ LPGUID ExistingTransactionManagerGuid
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRollforwardTransactionManager(
|
||||
_In_ HANDLE TransactionManagerHandle,
|
||||
_In_opt_ PLARGE_INTEGER TmVirtualClock
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRecoverTransactionManager(
|
||||
_In_ HANDLE TransactionManagerHandle
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQueryInformationTransactionManager(
|
||||
_In_ HANDLE TransactionManagerHandle,
|
||||
_In_ TRANSACTIONMANAGER_INFORMATION_CLASS TransactionManagerInformationClass,
|
||||
_Out_writes_bytes_(TransactionManagerInformationLength) PVOID TransactionManagerInformation,
|
||||
_In_ ULONG TransactionManagerInformationLength,
|
||||
_Out_opt_ PULONG ReturnLength
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetInformationTransactionManager(
|
||||
_In_opt_ HANDLE TmHandle,
|
||||
_In_ TRANSACTIONMANAGER_INFORMATION_CLASS TransactionManagerInformationClass,
|
||||
_In_reads_bytes_(TransactionManagerInformationLength) PVOID TransactionManagerInformation,
|
||||
_In_ ULONG TransactionManagerInformationLength
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtEnumerateTransactionObject(
|
||||
_In_opt_ HANDLE RootObjectHandle,
|
||||
_In_ KTMOBJECT_TYPE QueryType,
|
||||
_Inout_updates_bytes_(ObjectCursorLength) PKTMOBJECT_CURSOR ObjectCursor,
|
||||
_In_ ULONG ObjectCursorLength,
|
||||
_Out_ PULONG ReturnLength
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateTransaction(
|
||||
_Out_ PHANDLE TransactionHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_opt_ LPGUID Uow,
|
||||
_In_opt_ HANDLE TmHandle,
|
||||
_In_opt_ ULONG CreateOptions,
|
||||
_In_opt_ ULONG IsolationLevel,
|
||||
_In_opt_ ULONG IsolationFlags,
|
||||
_In_opt_ PLARGE_INTEGER Timeout,
|
||||
_In_opt_ PUNICODE_STRING Description
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenTransaction(
|
||||
_Out_ PHANDLE TransactionHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_ LPGUID Uow,
|
||||
_In_opt_ HANDLE TmHandle
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQueryInformationTransaction(
|
||||
_In_ HANDLE TransactionHandle,
|
||||
_In_ TRANSACTION_INFORMATION_CLASS TransactionInformationClass,
|
||||
_Out_writes_bytes_(TransactionInformationLength) PVOID TransactionInformation,
|
||||
_In_ ULONG TransactionInformationLength,
|
||||
_Out_opt_ PULONG ReturnLength
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetInformationTransaction(
|
||||
_In_ HANDLE TransactionHandle,
|
||||
_In_ TRANSACTION_INFORMATION_CLASS TransactionInformationClass,
|
||||
_In_reads_bytes_(TransactionInformationLength) PVOID TransactionInformation,
|
||||
_In_ ULONG TransactionInformationLength
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCommitTransaction(
|
||||
_In_ HANDLE TransactionHandle,
|
||||
_In_ BOOLEAN Wait
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRollbackTransaction(
|
||||
_In_ HANDLE TransactionHandle,
|
||||
_In_ BOOLEAN Wait
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateEnlistment(
|
||||
_Out_ PHANDLE EnlistmentHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ HANDLE ResourceManagerHandle,
|
||||
_In_ HANDLE TransactionHandle,
|
||||
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_opt_ ULONG CreateOptions,
|
||||
_In_ NOTIFICATION_MASK NotificationMask,
|
||||
_In_opt_ PVOID EnlistmentKey
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenEnlistment(
|
||||
_Out_ PHANDLE EnlistmentHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ HANDLE ResourceManagerHandle,
|
||||
_In_ LPGUID EnlistmentGuid,
|
||||
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQueryInformationEnlistment(
|
||||
_In_ HANDLE EnlistmentHandle,
|
||||
_In_ ENLISTMENT_INFORMATION_CLASS EnlistmentInformationClass,
|
||||
_Out_writes_bytes_(EnlistmentInformationLength) PVOID EnlistmentInformation,
|
||||
_In_ ULONG EnlistmentInformationLength,
|
||||
_Out_opt_ PULONG ReturnLength
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetInformationEnlistment(
|
||||
_In_opt_ HANDLE EnlistmentHandle,
|
||||
_In_ ENLISTMENT_INFORMATION_CLASS EnlistmentInformationClass,
|
||||
_In_reads_bytes_(EnlistmentInformationLength) PVOID EnlistmentInformation,
|
||||
_In_ ULONG EnlistmentInformationLength
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRecoverEnlistment(
|
||||
_In_ HANDLE EnlistmentHandle,
|
||||
_In_opt_ PVOID EnlistmentKey
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtPrePrepareEnlistment(
|
||||
_In_ HANDLE EnlistmentHandle,
|
||||
_In_opt_ PLARGE_INTEGER TmVirtualClock
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtPrepareEnlistment(
|
||||
_In_ HANDLE EnlistmentHandle,
|
||||
_In_opt_ PLARGE_INTEGER TmVirtualClock
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCommitEnlistment(
|
||||
_In_ HANDLE EnlistmentHandle,
|
||||
_In_opt_ PLARGE_INTEGER TmVirtualClock
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRollbackEnlistment(
|
||||
_In_ HANDLE EnlistmentHandle,
|
||||
_In_opt_ PLARGE_INTEGER TmVirtualClock
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtPrePrepareComplete(
|
||||
_In_ HANDLE EnlistmentHandle,
|
||||
_In_opt_ PLARGE_INTEGER TmVirtualClock
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtPrepareComplete(
|
||||
_In_ HANDLE EnlistmentHandle,
|
||||
_In_opt_ PLARGE_INTEGER TmVirtualClock
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCommitComplete(
|
||||
_In_ HANDLE EnlistmentHandle,
|
||||
_In_opt_ PLARGE_INTEGER TmVirtualClock
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtReadOnlyEnlistment(
|
||||
_In_ HANDLE EnlistmentHandle,
|
||||
_In_opt_ PLARGE_INTEGER TmVirtualClock
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRollbackComplete(
|
||||
_In_ HANDLE EnlistmentHandle,
|
||||
_In_opt_ PLARGE_INTEGER TmVirtualClock
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSinglePhaseReject(
|
||||
_In_ HANDLE EnlistmentHandle,
|
||||
_In_opt_ PLARGE_INTEGER TmVirtualClock
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateResourceManager(
|
||||
_Out_ PHANDLE ResourceManagerHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ HANDLE TmHandle,
|
||||
_In_ LPGUID RmGuid,
|
||||
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
_In_opt_ ULONG CreateOptions,
|
||||
_In_opt_ PUNICODE_STRING Description
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenResourceManager(
|
||||
_Out_ PHANDLE ResourceManagerHandle,
|
||||
_In_ ACCESS_MASK DesiredAccess,
|
||||
_In_ HANDLE TmHandle,
|
||||
_In_opt_ LPGUID ResourceManagerGuid,
|
||||
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRecoverResourceManager(
|
||||
_In_ HANDLE ResourceManagerHandle
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtGetNotificationResourceManager(
|
||||
_In_ HANDLE ResourceManagerHandle,
|
||||
_Out_ PTRANSACTION_NOTIFICATION TransactionNotification,
|
||||
_In_ ULONG NotificationLength,
|
||||
_In_opt_ PLARGE_INTEGER Timeout,
|
||||
_Out_opt_ PULONG ReturnLength,
|
||||
_In_ ULONG Asynchronous,
|
||||
_In_opt_ ULONG_PTR AsynchronousContext
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtQueryInformationResourceManager(
|
||||
_In_ HANDLE ResourceManagerHandle,
|
||||
_In_ RESOURCEMANAGER_INFORMATION_CLASS ResourceManagerInformationClass,
|
||||
_Out_writes_bytes_(ResourceManagerInformationLength) PVOID ResourceManagerInformation,
|
||||
_In_ ULONG ResourceManagerInformationLength,
|
||||
_Out_opt_ PULONG ReturnLength
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtSetInformationResourceManager(
|
||||
_In_ HANDLE ResourceManagerHandle,
|
||||
_In_ RESOURCEMANAGER_INFORMATION_CLASS ResourceManagerInformationClass,
|
||||
_In_reads_bytes_(ResourceManagerInformationLength) PVOID ResourceManagerInformation,
|
||||
_In_ ULONG ResourceManagerInformationLength
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRegisterProtocolAddressInformation(
|
||||
_In_ HANDLE ResourceManager,
|
||||
_In_ PCRM_PROTOCOL_ID ProtocolId,
|
||||
_In_ ULONG ProtocolInformationSize,
|
||||
_In_ PVOID ProtocolInformation,
|
||||
_In_opt_ ULONG CreateOptions
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtPropagationComplete(
|
||||
_In_ HANDLE ResourceManagerHandle,
|
||||
_In_ ULONG RequestCookie,
|
||||
_In_ ULONG BufferLength,
|
||||
_In_ PVOID Buffer
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtPropagationFailed(
|
||||
_In_ HANDLE ResourceManagerHandle,
|
||||
_In_ ULONG RequestCookie,
|
||||
_In_ NTSTATUS PropStatus
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
// private
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtFreezeTransactions(
|
||||
_In_ PLARGE_INTEGER FreezeTimeout,
|
||||
_In_ PLARGE_INTEGER ThawTimeout
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
// private
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtThawTransactions(
|
||||
VOID
|
||||
);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,467 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTTP_H
|
||||
#define _NTTP_H
|
||||
|
||||
// Some types are already defined in winnt.h.
|
||||
|
||||
typedef struct _TP_ALPC TP_ALPC, *PTP_ALPC;
|
||||
|
||||
// private
|
||||
typedef VOID (NTAPI *PTP_ALPC_CALLBACK)(
|
||||
_Inout_ PTP_CALLBACK_INSTANCE Instance,
|
||||
_Inout_opt_ PVOID Context,
|
||||
_In_ PTP_ALPC Alpc
|
||||
);
|
||||
|
||||
// rev
|
||||
typedef VOID (NTAPI *PTP_ALPC_CALLBACK_EX)(
|
||||
_Inout_ PTP_CALLBACK_INSTANCE Instance,
|
||||
_Inout_opt_ PVOID Context,
|
||||
_In_ PTP_ALPC Alpc,
|
||||
_In_ PVOID ApcContext
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_VISTA)
|
||||
|
||||
// private
|
||||
_Check_return_
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpAllocPool(
|
||||
_Out_ PTP_POOL *PoolReturn,
|
||||
_Reserved_ PVOID Reserved
|
||||
);
|
||||
|
||||
// winbase:CloseThreadpool
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpReleasePool(
|
||||
_Inout_ PTP_POOL Pool
|
||||
);
|
||||
|
||||
// winbase:SetThreadpoolThreadMaximum
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpSetPoolMaxThreads(
|
||||
_Inout_ PTP_POOL Pool,
|
||||
_In_ ULONG MaxThreads
|
||||
);
|
||||
|
||||
// private
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpSetPoolMinThreads(
|
||||
_Inout_ PTP_POOL Pool,
|
||||
_In_ ULONG MinThreads
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN7)
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpQueryPoolStackInformation(
|
||||
_In_ PTP_POOL Pool,
|
||||
_Out_ PTP_POOL_STACK_INFORMATION PoolStackInformation
|
||||
);
|
||||
#endif
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN7)
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpSetPoolStackInformation(
|
||||
_Inout_ PTP_POOL Pool,
|
||||
_In_ PTP_POOL_STACK_INFORMATION PoolStackInformation
|
||||
);
|
||||
#endif
|
||||
|
||||
// private
|
||||
_Check_return_
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpAllocCleanupGroup(
|
||||
_Out_ PTP_CLEANUP_GROUP *CleanupGroupReturn
|
||||
);
|
||||
|
||||
// winbase:CloseThreadpoolCleanupGroup
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpReleaseCleanupGroup(
|
||||
_Inout_ PTP_CLEANUP_GROUP CleanupGroup
|
||||
);
|
||||
|
||||
// winbase:CloseThreadpoolCleanupGroupMembers
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpReleaseCleanupGroupMembers(
|
||||
_Inout_ PTP_CLEANUP_GROUP CleanupGroup,
|
||||
_In_ LOGICAL CancelPendingCallbacks,
|
||||
_Inout_opt_ PVOID CleanupParameter
|
||||
);
|
||||
|
||||
// winbase:SetEventWhenCallbackReturns
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpCallbackSetEventOnCompletion(
|
||||
_Inout_ PTP_CALLBACK_INSTANCE Instance,
|
||||
_In_ HANDLE Event
|
||||
);
|
||||
|
||||
// winbase:ReleaseSemaphoreWhenCallbackReturns
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpCallbackReleaseSemaphoreOnCompletion(
|
||||
_Inout_ PTP_CALLBACK_INSTANCE Instance,
|
||||
_In_ HANDLE Semaphore,
|
||||
_In_ ULONG ReleaseCount
|
||||
);
|
||||
|
||||
// winbase:ReleaseMutexWhenCallbackReturns
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpCallbackReleaseMutexOnCompletion(
|
||||
_Inout_ PTP_CALLBACK_INSTANCE Instance,
|
||||
_In_ HANDLE Mutex
|
||||
);
|
||||
|
||||
// winbase:LeaveCriticalSectionWhenCallbackReturns
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpCallbackLeaveCriticalSectionOnCompletion(
|
||||
_Inout_ PTP_CALLBACK_INSTANCE Instance,
|
||||
_Inout_ PRTL_CRITICAL_SECTION CriticalSection
|
||||
);
|
||||
|
||||
// winbase:FreeLibraryWhenCallbackReturns
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpCallbackUnloadDllOnCompletion(
|
||||
_Inout_ PTP_CALLBACK_INSTANCE Instance,
|
||||
_In_ PVOID DllHandle
|
||||
);
|
||||
|
||||
// winbase:CallbackMayRunLong
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpCallbackMayRunLong(
|
||||
_Inout_ PTP_CALLBACK_INSTANCE Instance
|
||||
);
|
||||
|
||||
// winbase:DisassociateCurrentThreadFromCallback
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpDisassociateCallback(
|
||||
_Inout_ PTP_CALLBACK_INSTANCE Instance
|
||||
);
|
||||
|
||||
// winbase:TrySubmitThreadpoolCallback
|
||||
_Check_return_
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpSimpleTryPost(
|
||||
_In_ PTP_SIMPLE_CALLBACK Callback,
|
||||
_Inout_opt_ PVOID Context,
|
||||
_In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
|
||||
);
|
||||
|
||||
// private
|
||||
_Check_return_
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpAllocWork(
|
||||
_Out_ PTP_WORK *WorkReturn,
|
||||
_In_ PTP_WORK_CALLBACK Callback,
|
||||
_Inout_opt_ PVOID Context,
|
||||
_In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
|
||||
);
|
||||
|
||||
// winbase:CloseThreadpoolWork
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpReleaseWork(
|
||||
_Inout_ PTP_WORK Work
|
||||
);
|
||||
|
||||
// winbase:SubmitThreadpoolWork
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpPostWork(
|
||||
_Inout_ PTP_WORK Work
|
||||
);
|
||||
|
||||
// winbase:WaitForThreadpoolWorkCallbacks
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpWaitForWork(
|
||||
_Inout_ PTP_WORK Work,
|
||||
_In_ LOGICAL CancelPendingCallbacks
|
||||
);
|
||||
|
||||
// private
|
||||
_Check_return_
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpAllocTimer(
|
||||
_Out_ PTP_TIMER *Timer,
|
||||
_In_ PTP_TIMER_CALLBACK Callback,
|
||||
_Inout_opt_ PVOID Context,
|
||||
_In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
|
||||
);
|
||||
|
||||
// winbase:CloseThreadpoolTimer
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpReleaseTimer(
|
||||
_Inout_ PTP_TIMER Timer
|
||||
);
|
||||
|
||||
// winbase:SetThreadpoolTimer
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpSetTimer(
|
||||
_Inout_ PTP_TIMER Timer,
|
||||
_In_opt_ PLARGE_INTEGER DueTime,
|
||||
_In_ ULONG Period,
|
||||
_In_opt_ ULONG WindowLength
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN7)
|
||||
// winbase:SetThreadpoolTimerEx
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpSetTimerEx(
|
||||
_Inout_ PTP_TIMER Timer,
|
||||
_In_opt_ PLARGE_INTEGER DueTime,
|
||||
_In_ ULONG Period,
|
||||
_In_opt_ ULONG WindowLength
|
||||
);
|
||||
#endif
|
||||
|
||||
// winbase:IsThreadpoolTimerSet
|
||||
NTSYSAPI
|
||||
LOGICAL
|
||||
NTAPI
|
||||
TpIsTimerSet(
|
||||
_In_ PTP_TIMER Timer
|
||||
);
|
||||
|
||||
// winbase:WaitForThreadpoolTimerCallbacks
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpWaitForTimer(
|
||||
_Inout_ PTP_TIMER Timer,
|
||||
_In_ LOGICAL CancelPendingCallbacks
|
||||
);
|
||||
|
||||
// private
|
||||
_Check_return_
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpAllocWait(
|
||||
_Out_ PTP_WAIT *WaitReturn,
|
||||
_In_ PTP_WAIT_CALLBACK Callback,
|
||||
_Inout_opt_ PVOID Context,
|
||||
_In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
|
||||
);
|
||||
|
||||
// winbase:CloseThreadpoolWait
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpReleaseWait(
|
||||
_Inout_ PTP_WAIT Wait
|
||||
);
|
||||
|
||||
// winbase:SetThreadpoolWait
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpSetWait(
|
||||
_Inout_ PTP_WAIT Wait,
|
||||
_In_opt_ HANDLE Handle,
|
||||
_In_opt_ PLARGE_INTEGER Timeout
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN7)
|
||||
// winbase:SetThreadpoolWaitEx
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpSetWaitEx(
|
||||
_Inout_ PTP_WAIT Wait,
|
||||
_In_opt_ HANDLE Handle,
|
||||
_In_opt_ PLARGE_INTEGER Timeout,
|
||||
_In_opt_ PVOID Reserved
|
||||
);
|
||||
#endif
|
||||
|
||||
// winbase:WaitForThreadpoolWaitCallbacks
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpWaitForWait(
|
||||
_Inout_ PTP_WAIT Wait,
|
||||
_In_ LOGICAL CancelPendingCallbacks
|
||||
);
|
||||
|
||||
// private
|
||||
typedef VOID (NTAPI *PTP_IO_CALLBACK)(
|
||||
_Inout_ PTP_CALLBACK_INSTANCE Instance,
|
||||
_Inout_opt_ PVOID Context,
|
||||
_In_ PVOID ApcContext,
|
||||
_In_ PIO_STATUS_BLOCK IoSB,
|
||||
_In_ PTP_IO Io
|
||||
);
|
||||
|
||||
// private
|
||||
_Check_return_
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpAllocIoCompletion(
|
||||
_Out_ PTP_IO *IoReturn,
|
||||
_In_ HANDLE File,
|
||||
_In_ PTP_IO_CALLBACK Callback,
|
||||
_Inout_opt_ PVOID Context,
|
||||
_In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
|
||||
);
|
||||
|
||||
// winbase:CloseThreadpoolIo
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpReleaseIoCompletion(
|
||||
_Inout_ PTP_IO Io
|
||||
);
|
||||
|
||||
// winbase:StartThreadpoolIo
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpStartAsyncIoOperation(
|
||||
_Inout_ PTP_IO Io
|
||||
);
|
||||
|
||||
// winbase:CancelThreadpoolIo
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpCancelAsyncIoOperation(
|
||||
_Inout_ PTP_IO Io
|
||||
);
|
||||
|
||||
// winbase:WaitForThreadpoolIoCallbacks
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpWaitForIoCompletion(
|
||||
_Inout_ PTP_IO Io,
|
||||
_In_ LOGICAL CancelPendingCallbacks
|
||||
);
|
||||
|
||||
// private
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpAllocAlpcCompletion(
|
||||
_Out_ PTP_ALPC *AlpcReturn,
|
||||
_In_ HANDLE AlpcPort,
|
||||
_In_ PTP_ALPC_CALLBACK Callback,
|
||||
_Inout_opt_ PVOID Context,
|
||||
_In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
|
||||
);
|
||||
|
||||
#if (PHNT_VERSION >= PHNT_WIN7)
|
||||
// rev
|
||||
NTSYSAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
TpAllocAlpcCompletionEx(
|
||||
_Out_ PTP_ALPC *AlpcReturn,
|
||||
_In_ HANDLE AlpcPort,
|
||||
_In_ PTP_ALPC_CALLBACK_EX Callback,
|
||||
_Inout_opt_ PVOID Context,
|
||||
_In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
|
||||
);
|
||||
#endif
|
||||
|
||||
// private
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpReleaseAlpcCompletion(
|
||||
_Inout_ PTP_ALPC Alpc
|
||||
);
|
||||
|
||||
// private
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpWaitForAlpcCompletion(
|
||||
_Inout_ PTP_ALPC Alpc
|
||||
);
|
||||
|
||||
// private
|
||||
typedef enum _TP_TRACE_TYPE
|
||||
{
|
||||
TpTraceThreadPriority = 1,
|
||||
TpTraceThreadAffinity,
|
||||
MaxTpTraceType
|
||||
} TP_TRACE_TYPE;
|
||||
|
||||
// private
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpCaptureCaller(
|
||||
_In_ TP_TRACE_TYPE Type
|
||||
);
|
||||
|
||||
// private
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
TpCheckTerminateWorker(
|
||||
_In_ HANDLE Thread
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,593 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTWOW64_H
|
||||
#define _NTWOW64_H
|
||||
|
||||
#define WOW64_SYSTEM_DIRECTORY "SysWOW64"
|
||||
#define WOW64_SYSTEM_DIRECTORY_U L"SysWOW64"
|
||||
#define WOW64_X86_TAG " (x86)"
|
||||
#define WOW64_X86_TAG_U L" (x86)"
|
||||
|
||||
// In USER_SHARED_DATA
|
||||
typedef enum _WOW64_SHARED_INFORMATION
|
||||
{
|
||||
SharedNtdll32LdrInitializeThunk,
|
||||
SharedNtdll32KiUserExceptionDispatcher,
|
||||
SharedNtdll32KiUserApcDispatcher,
|
||||
SharedNtdll32KiUserCallbackDispatcher,
|
||||
SharedNtdll32ExpInterlockedPopEntrySListFault,
|
||||
SharedNtdll32ExpInterlockedPopEntrySListResume,
|
||||
SharedNtdll32ExpInterlockedPopEntrySListEnd,
|
||||
SharedNtdll32RtlUserThreadStart,
|
||||
SharedNtdll32pQueryProcessDebugInformationRemote,
|
||||
SharedNtdll32BaseAddress,
|
||||
SharedNtdll32LdrSystemDllInitBlock,
|
||||
Wow64SharedPageEntriesCount
|
||||
} WOW64_SHARED_INFORMATION;
|
||||
|
||||
// 32-bit definitions
|
||||
|
||||
#define WOW64_POINTER(Type) ULONG
|
||||
|
||||
typedef struct _RTL_BALANCED_NODE32
|
||||
{
|
||||
union
|
||||
{
|
||||
WOW64_POINTER(struct _RTL_BALANCED_NODE *) Children[2];
|
||||
struct
|
||||
{
|
||||
WOW64_POINTER(struct _RTL_BALANCED_NODE *) Left;
|
||||
WOW64_POINTER(struct _RTL_BALANCED_NODE *) Right;
|
||||
};
|
||||
};
|
||||
union
|
||||
{
|
||||
WOW64_POINTER(UCHAR) Red : 1;
|
||||
WOW64_POINTER(UCHAR) Balance : 2;
|
||||
WOW64_POINTER(ULONG_PTR) ParentValue;
|
||||
};
|
||||
} RTL_BALANCED_NODE32, *PRTL_BALANCED_NODE32;
|
||||
|
||||
typedef struct _RTL_RB_TREE32
|
||||
{
|
||||
WOW64_POINTER(PRTL_BALANCED_NODE) Root;
|
||||
WOW64_POINTER(PRTL_BALANCED_NODE) Min;
|
||||
} RTL_RB_TREE32, *PRTL_RB_TREE32;
|
||||
|
||||
typedef struct _PEB_LDR_DATA32
|
||||
{
|
||||
ULONG Length;
|
||||
BOOLEAN Initialized;
|
||||
WOW64_POINTER(HANDLE) SsHandle;
|
||||
LIST_ENTRY32 InLoadOrderModuleList;
|
||||
LIST_ENTRY32 InMemoryOrderModuleList;
|
||||
LIST_ENTRY32 InInitializationOrderModuleList;
|
||||
WOW64_POINTER(PVOID) EntryInProgress;
|
||||
BOOLEAN ShutdownInProgress;
|
||||
WOW64_POINTER(HANDLE) ShutdownThreadId;
|
||||
} PEB_LDR_DATA32, *PPEB_LDR_DATA32;
|
||||
|
||||
typedef struct _LDR_SERVICE_TAG_RECORD32
|
||||
{
|
||||
WOW64_POINTER(struct _LDR_SERVICE_TAG_RECORD *) Next;
|
||||
ULONG ServiceTag;
|
||||
} LDR_SERVICE_TAG_RECORD32, *PLDR_SERVICE_TAG_RECORD32;
|
||||
|
||||
typedef struct _LDRP_CSLIST32
|
||||
{
|
||||
WOW64_POINTER(PSINGLE_LIST_ENTRY) Tail;
|
||||
} LDRP_CSLIST32, *PLDRP_CSLIST32;
|
||||
|
||||
typedef struct _LDR_DDAG_NODE32
|
||||
{
|
||||
LIST_ENTRY32 Modules;
|
||||
WOW64_POINTER(PLDR_SERVICE_TAG_RECORD) ServiceTagList;
|
||||
ULONG LoadCount;
|
||||
ULONG LoadWhileUnloadingCount;
|
||||
ULONG LowestLink;
|
||||
union
|
||||
{
|
||||
LDRP_CSLIST32 Dependencies;
|
||||
SINGLE_LIST_ENTRY32 RemovalLink;
|
||||
};
|
||||
LDRP_CSLIST32 IncomingDependencies;
|
||||
LDR_DDAG_STATE State;
|
||||
SINGLE_LIST_ENTRY32 CondenseLink;
|
||||
ULONG PreorderNumber;
|
||||
} LDR_DDAG_NODE32, *PLDR_DDAG_NODE32;
|
||||
|
||||
#define LDR_DATA_TABLE_ENTRY_SIZE_WINXP_32 FIELD_OFFSET(LDR_DATA_TABLE_ENTRY32, DdagNode)
|
||||
#define LDR_DATA_TABLE_ENTRY_SIZE_WIN7_32 FIELD_OFFSET(LDR_DATA_TABLE_ENTRY32, BaseNameHashValue)
|
||||
#define LDR_DATA_TABLE_ENTRY_SIZE_WIN8_32 FIELD_OFFSET(LDR_DATA_TABLE_ENTRY32, ImplicitPathOptions)
|
||||
|
||||
typedef struct _LDR_DATA_TABLE_ENTRY32
|
||||
{
|
||||
LIST_ENTRY32 InLoadOrderLinks;
|
||||
LIST_ENTRY32 InMemoryOrderLinks;
|
||||
union
|
||||
{
|
||||
LIST_ENTRY32 InInitializationOrderLinks;
|
||||
LIST_ENTRY32 InProgressLinks;
|
||||
};
|
||||
WOW64_POINTER(PVOID) DllBase;
|
||||
WOW64_POINTER(PVOID) EntryPoint;
|
||||
ULONG SizeOfImage;
|
||||
UNICODE_STRING32 FullDllName;
|
||||
UNICODE_STRING32 BaseDllName;
|
||||
union
|
||||
{
|
||||
UCHAR FlagGroup[4];
|
||||
ULONG Flags;
|
||||
struct
|
||||
{
|
||||
ULONG PackagedBinary : 1;
|
||||
ULONG MarkedForRemoval : 1;
|
||||
ULONG ImageDll : 1;
|
||||
ULONG LoadNotificationsSent : 1;
|
||||
ULONG TelemetryEntryProcessed : 1;
|
||||
ULONG ProcessStaticImport : 1;
|
||||
ULONG InLegacyLists : 1;
|
||||
ULONG InIndexes : 1;
|
||||
ULONG ShimDll : 1;
|
||||
ULONG InExceptionTable : 1;
|
||||
ULONG ReservedFlags1 : 2;
|
||||
ULONG LoadInProgress : 1;
|
||||
ULONG LoadConfigProcessed : 1;
|
||||
ULONG EntryProcessed : 1;
|
||||
ULONG ProtectDelayLoad : 1;
|
||||
ULONG ReservedFlags3 : 2;
|
||||
ULONG DontCallForThreads : 1;
|
||||
ULONG ProcessAttachCalled : 1;
|
||||
ULONG ProcessAttachFailed : 1;
|
||||
ULONG CorDeferredValidate : 1;
|
||||
ULONG CorImage : 1;
|
||||
ULONG DontRelocate : 1;
|
||||
ULONG CorILOnly : 1;
|
||||
ULONG ChpeImage : 1;
|
||||
ULONG ReservedFlags5 : 2;
|
||||
ULONG Redirected : 1;
|
||||
ULONG ReservedFlags6 : 2;
|
||||
ULONG CompatDatabaseProcessed : 1;
|
||||
};
|
||||
};
|
||||
USHORT ObsoleteLoadCount;
|
||||
USHORT TlsIndex;
|
||||
LIST_ENTRY32 HashLinks;
|
||||
ULONG TimeDateStamp;
|
||||
WOW64_POINTER(struct _ACTIVATION_CONTEXT *) EntryPointActivationContext;
|
||||
WOW64_POINTER(PVOID) Lock;
|
||||
WOW64_POINTER(PLDR_DDAG_NODE) DdagNode;
|
||||
LIST_ENTRY32 NodeModuleLink;
|
||||
WOW64_POINTER(struct _LDRP_LOAD_CONTEXT *) LoadContext;
|
||||
WOW64_POINTER(PVOID) ParentDllBase;
|
||||
WOW64_POINTER(PVOID) SwitchBackContext;
|
||||
RTL_BALANCED_NODE32 BaseAddressIndexNode;
|
||||
RTL_BALANCED_NODE32 MappingInfoIndexNode;
|
||||
WOW64_POINTER(ULONG_PTR) OriginalBase;
|
||||
LARGE_INTEGER LoadTime;
|
||||
ULONG BaseNameHashValue;
|
||||
LDR_DLL_LOAD_REASON LoadReason;
|
||||
ULONG ImplicitPathOptions;
|
||||
ULONG ReferenceCount;
|
||||
ULONG DependentLoadFlags;
|
||||
UCHAR SigningLevel; // since REDSTONE2
|
||||
} LDR_DATA_TABLE_ENTRY32, *PLDR_DATA_TABLE_ENTRY32;
|
||||
|
||||
typedef struct _CURDIR32
|
||||
{
|
||||
UNICODE_STRING32 DosPath;
|
||||
WOW64_POINTER(HANDLE) Handle;
|
||||
} CURDIR32, *PCURDIR32;
|
||||
|
||||
typedef struct _RTL_DRIVE_LETTER_CURDIR32
|
||||
{
|
||||
USHORT Flags;
|
||||
USHORT Length;
|
||||
ULONG TimeStamp;
|
||||
STRING32 DosPath;
|
||||
} RTL_DRIVE_LETTER_CURDIR32, *PRTL_DRIVE_LETTER_CURDIR32;
|
||||
|
||||
typedef struct _RTL_USER_PROCESS_PARAMETERS32
|
||||
{
|
||||
ULONG MaximumLength;
|
||||
ULONG Length;
|
||||
|
||||
ULONG Flags;
|
||||
ULONG DebugFlags;
|
||||
|
||||
WOW64_POINTER(HANDLE) ConsoleHandle;
|
||||
ULONG ConsoleFlags;
|
||||
WOW64_POINTER(HANDLE) StandardInput;
|
||||
WOW64_POINTER(HANDLE) StandardOutput;
|
||||
WOW64_POINTER(HANDLE) StandardError;
|
||||
|
||||
CURDIR32 CurrentDirectory;
|
||||
UNICODE_STRING32 DllPath;
|
||||
UNICODE_STRING32 ImagePathName;
|
||||
UNICODE_STRING32 CommandLine;
|
||||
WOW64_POINTER(PVOID) Environment;
|
||||
|
||||
ULONG StartingX;
|
||||
ULONG StartingY;
|
||||
ULONG CountX;
|
||||
ULONG CountY;
|
||||
ULONG CountCharsX;
|
||||
ULONG CountCharsY;
|
||||
ULONG FillAttribute;
|
||||
|
||||
ULONG WindowFlags;
|
||||
ULONG ShowWindowFlags;
|
||||
UNICODE_STRING32 WindowTitle;
|
||||
UNICODE_STRING32 DesktopInfo;
|
||||
UNICODE_STRING32 ShellInfo;
|
||||
UNICODE_STRING32 RuntimeData;
|
||||
RTL_DRIVE_LETTER_CURDIR32 CurrentDirectories[RTL_MAX_DRIVE_LETTERS];
|
||||
|
||||
WOW64_POINTER(ULONG_PTR) EnvironmentSize;
|
||||
WOW64_POINTER(ULONG_PTR) EnvironmentVersion;
|
||||
WOW64_POINTER(PVOID) PackageDependencyData;
|
||||
ULONG ProcessGroupId;
|
||||
ULONG LoaderThreads;
|
||||
|
||||
UNICODE_STRING32 RedirectionDllName; // REDSTONE4
|
||||
UNICODE_STRING32 HeapPartitionName; // 19H1
|
||||
WOW64_POINTER(ULONG_PTR) DefaultThreadpoolCpuSetMasks;
|
||||
ULONG DefaultThreadpoolCpuSetMaskCount;
|
||||
} RTL_USER_PROCESS_PARAMETERS32, *PRTL_USER_PROCESS_PARAMETERS32;
|
||||
|
||||
typedef struct _PEB32
|
||||
{
|
||||
BOOLEAN InheritedAddressSpace;
|
||||
BOOLEAN ReadImageFileExecOptions;
|
||||
BOOLEAN BeingDebugged;
|
||||
union
|
||||
{
|
||||
BOOLEAN BitField;
|
||||
struct
|
||||
{
|
||||
BOOLEAN ImageUsesLargePages : 1;
|
||||
BOOLEAN IsProtectedProcess : 1;
|
||||
BOOLEAN IsImageDynamicallyRelocated : 1;
|
||||
BOOLEAN SkipPatchingUser32Forwarders : 1;
|
||||
BOOLEAN IsPackagedProcess : 1;
|
||||
BOOLEAN IsAppContainer : 1;
|
||||
BOOLEAN IsProtectedProcessLight : 1;
|
||||
BOOLEAN IsLongPathAwareProcess : 1;
|
||||
};
|
||||
};
|
||||
WOW64_POINTER(HANDLE) Mutant;
|
||||
|
||||
WOW64_POINTER(PVOID) ImageBaseAddress;
|
||||
WOW64_POINTER(PPEB_LDR_DATA) Ldr;
|
||||
WOW64_POINTER(PRTL_USER_PROCESS_PARAMETERS) ProcessParameters;
|
||||
WOW64_POINTER(PVOID) SubSystemData;
|
||||
WOW64_POINTER(PVOID) ProcessHeap;
|
||||
WOW64_POINTER(PRTL_CRITICAL_SECTION) FastPebLock;
|
||||
WOW64_POINTER(PVOID) AtlThunkSListPtr;
|
||||
WOW64_POINTER(PVOID) IFEOKey;
|
||||
union
|
||||
{
|
||||
ULONG CrossProcessFlags;
|
||||
struct
|
||||
{
|
||||
ULONG ProcessInJob : 1;
|
||||
ULONG ProcessInitializing : 1;
|
||||
ULONG ProcessUsingVEH : 1;
|
||||
ULONG ProcessUsingVCH : 1;
|
||||
ULONG ProcessUsingFTH : 1;
|
||||
ULONG ReservedBits0 : 27;
|
||||
};
|
||||
};
|
||||
union
|
||||
{
|
||||
WOW64_POINTER(PVOID) KernelCallbackTable;
|
||||
WOW64_POINTER(PVOID) UserSharedInfoPtr;
|
||||
};
|
||||
ULONG SystemReserved;
|
||||
ULONG AtlThunkSListPtr32;
|
||||
WOW64_POINTER(PVOID) ApiSetMap;
|
||||
ULONG TlsExpansionCounter;
|
||||
WOW64_POINTER(PVOID) TlsBitmap;
|
||||
ULONG TlsBitmapBits[2];
|
||||
WOW64_POINTER(PVOID) ReadOnlySharedMemoryBase;
|
||||
WOW64_POINTER(PVOID) HotpatchInformation;
|
||||
WOW64_POINTER(PVOID *) ReadOnlyStaticServerData;
|
||||
WOW64_POINTER(PVOID) AnsiCodePageData;
|
||||
WOW64_POINTER(PVOID) OemCodePageData;
|
||||
WOW64_POINTER(PVOID) UnicodeCaseTableData;
|
||||
|
||||
ULONG NumberOfProcessors;
|
||||
ULONG NtGlobalFlag;
|
||||
|
||||
LARGE_INTEGER CriticalSectionTimeout;
|
||||
WOW64_POINTER(SIZE_T) HeapSegmentReserve;
|
||||
WOW64_POINTER(SIZE_T) HeapSegmentCommit;
|
||||
WOW64_POINTER(SIZE_T) HeapDeCommitTotalFreeThreshold;
|
||||
WOW64_POINTER(SIZE_T) HeapDeCommitFreeBlockThreshold;
|
||||
|
||||
ULONG NumberOfHeaps;
|
||||
ULONG MaximumNumberOfHeaps;
|
||||
WOW64_POINTER(PVOID *) ProcessHeaps;
|
||||
|
||||
WOW64_POINTER(PVOID) GdiSharedHandleTable;
|
||||
WOW64_POINTER(PVOID) ProcessStarterHelper;
|
||||
ULONG GdiDCAttributeList;
|
||||
|
||||
WOW64_POINTER(PRTL_CRITICAL_SECTION) LoaderLock;
|
||||
|
||||
ULONG OSMajorVersion;
|
||||
ULONG OSMinorVersion;
|
||||
USHORT OSBuildNumber;
|
||||
USHORT OSCSDVersion;
|
||||
ULONG OSPlatformId;
|
||||
ULONG ImageSubsystem;
|
||||
ULONG ImageSubsystemMajorVersion;
|
||||
ULONG ImageSubsystemMinorVersion;
|
||||
WOW64_POINTER(ULONG_PTR) ActiveProcessAffinityMask;
|
||||
GDI_HANDLE_BUFFER32 GdiHandleBuffer;
|
||||
WOW64_POINTER(PVOID) PostProcessInitRoutine;
|
||||
|
||||
WOW64_POINTER(PVOID) TlsExpansionBitmap;
|
||||
ULONG TlsExpansionBitmapBits[32];
|
||||
|
||||
ULONG SessionId;
|
||||
|
||||
ULARGE_INTEGER AppCompatFlags;
|
||||
ULARGE_INTEGER AppCompatFlagsUser;
|
||||
WOW64_POINTER(PVOID) pShimData;
|
||||
WOW64_POINTER(PVOID) AppCompatInfo;
|
||||
|
||||
UNICODE_STRING32 CSDVersion;
|
||||
|
||||
WOW64_POINTER(PVOID) ActivationContextData;
|
||||
WOW64_POINTER(PVOID) ProcessAssemblyStorageMap;
|
||||
WOW64_POINTER(PVOID) SystemDefaultActivationContextData;
|
||||
WOW64_POINTER(PVOID) SystemAssemblyStorageMap;
|
||||
|
||||
WOW64_POINTER(SIZE_T) MinimumStackCommit;
|
||||
|
||||
WOW64_POINTER(PVOID) SparePointers[4];
|
||||
ULONG SpareUlongs[5];
|
||||
//WOW64_POINTER(PVOID *) FlsCallback;
|
||||
//LIST_ENTRY32 FlsListHead;
|
||||
//WOW64_POINTER(PVOID) FlsBitmap;
|
||||
//ULONG FlsBitmapBits[FLS_MAXIMUM_AVAILABLE / (sizeof(ULONG) * 8)];
|
||||
//ULONG FlsHighIndex;
|
||||
|
||||
WOW64_POINTER(PVOID) WerRegistrationData;
|
||||
WOW64_POINTER(PVOID) WerShipAssertPtr;
|
||||
WOW64_POINTER(PVOID) pContextData;
|
||||
WOW64_POINTER(PVOID) pImageHeaderHash;
|
||||
union
|
||||
{
|
||||
ULONG TracingFlags;
|
||||
struct
|
||||
{
|
||||
ULONG HeapTracingEnabled : 1;
|
||||
ULONG CritSecTracingEnabled : 1;
|
||||
ULONG LibLoaderTracingEnabled : 1;
|
||||
ULONG SpareTracingBits : 29;
|
||||
};
|
||||
};
|
||||
ULONGLONG CsrServerReadOnlySharedMemoryBase;
|
||||
WOW64_POINTER(PVOID) TppWorkerpListLock;
|
||||
LIST_ENTRY32 TppWorkerpList;
|
||||
WOW64_POINTER(PVOID) WaitOnAddressHashTable[128];
|
||||
WOW64_POINTER(PVOID) TelemetryCoverageHeader; // REDSTONE3
|
||||
ULONG CloudFileFlags;
|
||||
ULONG CloudFileDiagFlags; // REDSTONE4
|
||||
CHAR PlaceholderCompatibilityMode;
|
||||
CHAR PlaceholderCompatibilityModeReserved[7];
|
||||
} PEB32, *PPEB32;
|
||||
|
||||
C_ASSERT(FIELD_OFFSET(PEB32, IFEOKey) == 0x024);
|
||||
C_ASSERT(FIELD_OFFSET(PEB32, UnicodeCaseTableData) == 0x060);
|
||||
C_ASSERT(FIELD_OFFSET(PEB32, SystemAssemblyStorageMap) == 0x204);
|
||||
C_ASSERT(FIELD_OFFSET(PEB32, pImageHeaderHash) == 0x23c);
|
||||
C_ASSERT(FIELD_OFFSET(PEB32, WaitOnAddressHashTable) == 0x25c);
|
||||
//C_ASSERT(sizeof(PEB32) == 0x460); // REDSTONE3
|
||||
C_ASSERT(sizeof(PEB32) == 0x470);
|
||||
|
||||
#define GDI_BATCH_BUFFER_SIZE 310
|
||||
|
||||
typedef struct _GDI_TEB_BATCH32
|
||||
{
|
||||
ULONG Offset;
|
||||
WOW64_POINTER(ULONG_PTR) HDC;
|
||||
ULONG Buffer[GDI_BATCH_BUFFER_SIZE];
|
||||
} GDI_TEB_BATCH32, *PGDI_TEB_BATCH32;
|
||||
|
||||
typedef struct _TEB32
|
||||
{
|
||||
NT_TIB32 NtTib;
|
||||
|
||||
WOW64_POINTER(PVOID) EnvironmentPointer;
|
||||
CLIENT_ID32 ClientId;
|
||||
WOW64_POINTER(PVOID) ActiveRpcHandle;
|
||||
WOW64_POINTER(PVOID) ThreadLocalStoragePointer;
|
||||
WOW64_POINTER(PPEB) ProcessEnvironmentBlock;
|
||||
|
||||
ULONG LastErrorValue;
|
||||
ULONG CountOfOwnedCriticalSections;
|
||||
WOW64_POINTER(PVOID) CsrClientThread;
|
||||
WOW64_POINTER(PVOID) Win32ThreadInfo;
|
||||
ULONG User32Reserved[26];
|
||||
ULONG UserReserved[5];
|
||||
WOW64_POINTER(PVOID) WOW32Reserved;
|
||||
LCID CurrentLocale;
|
||||
ULONG FpSoftwareStatusRegister;
|
||||
WOW64_POINTER(PVOID) ReservedForDebuggerInstrumentation[16];
|
||||
WOW64_POINTER(PVOID) SystemReserved1[36];
|
||||
UCHAR WorkingOnBehalfTicket[8];
|
||||
NTSTATUS ExceptionCode;
|
||||
|
||||
WOW64_POINTER(PVOID) ActivationContextStackPointer;
|
||||
WOW64_POINTER(ULONG_PTR) InstrumentationCallbackSp;
|
||||
WOW64_POINTER(ULONG_PTR) InstrumentationCallbackPreviousPc;
|
||||
WOW64_POINTER(ULONG_PTR) InstrumentationCallbackPreviousSp;
|
||||
BOOLEAN InstrumentationCallbackDisabled;
|
||||
UCHAR SpareBytes[23];
|
||||
ULONG TxFsContext;
|
||||
|
||||
GDI_TEB_BATCH32 GdiTebBatch;
|
||||
CLIENT_ID32 RealClientId;
|
||||
WOW64_POINTER(HANDLE) GdiCachedProcessHandle;
|
||||
ULONG GdiClientPID;
|
||||
ULONG GdiClientTID;
|
||||
WOW64_POINTER(PVOID) GdiThreadLocalInfo;
|
||||
WOW64_POINTER(ULONG_PTR) Win32ClientInfo[62];
|
||||
WOW64_POINTER(PVOID) glDispatchTable[233];
|
||||
WOW64_POINTER(ULONG_PTR) glReserved1[29];
|
||||
WOW64_POINTER(PVOID) glReserved2;
|
||||
WOW64_POINTER(PVOID) glSectionInfo;
|
||||
WOW64_POINTER(PVOID) glSection;
|
||||
WOW64_POINTER(PVOID) glTable;
|
||||
WOW64_POINTER(PVOID) glCurrentRC;
|
||||
WOW64_POINTER(PVOID) glContext;
|
||||
|
||||
NTSTATUS LastStatusValue;
|
||||
UNICODE_STRING32 StaticUnicodeString;
|
||||
WCHAR StaticUnicodeBuffer[261];
|
||||
|
||||
WOW64_POINTER(PVOID) DeallocationStack;
|
||||
WOW64_POINTER(PVOID) TlsSlots[64];
|
||||
LIST_ENTRY32 TlsLinks;
|
||||
|
||||
WOW64_POINTER(PVOID) Vdm;
|
||||
WOW64_POINTER(PVOID) ReservedForNtRpc;
|
||||
WOW64_POINTER(PVOID) DbgSsReserved[2];
|
||||
|
||||
ULONG HardErrorMode;
|
||||
WOW64_POINTER(PVOID) Instrumentation[9];
|
||||
GUID ActivityId;
|
||||
|
||||
WOW64_POINTER(PVOID) SubProcessTag;
|
||||
WOW64_POINTER(PVOID) PerflibData;
|
||||
WOW64_POINTER(PVOID) EtwTraceData;
|
||||
WOW64_POINTER(PVOID) WinSockData;
|
||||
ULONG GdiBatchCount;
|
||||
|
||||
union
|
||||
{
|
||||
PROCESSOR_NUMBER CurrentIdealProcessor;
|
||||
ULONG IdealProcessorValue;
|
||||
struct
|
||||
{
|
||||
UCHAR ReservedPad0;
|
||||
UCHAR ReservedPad1;
|
||||
UCHAR ReservedPad2;
|
||||
UCHAR IdealProcessor;
|
||||
};
|
||||
};
|
||||
|
||||
ULONG GuaranteedStackBytes;
|
||||
WOW64_POINTER(PVOID) ReservedForPerf;
|
||||
WOW64_POINTER(PVOID) ReservedForOle;
|
||||
ULONG WaitingOnLoaderLock;
|
||||
WOW64_POINTER(PVOID) SavedPriorityState;
|
||||
WOW64_POINTER(ULONG_PTR) ReservedForCodeCoverage;
|
||||
WOW64_POINTER(PVOID) ThreadPoolData;
|
||||
WOW64_POINTER(PVOID *) TlsExpansionSlots;
|
||||
|
||||
ULONG MuiGeneration;
|
||||
ULONG IsImpersonating;
|
||||
WOW64_POINTER(PVOID) NlsCache;
|
||||
WOW64_POINTER(PVOID) pShimData;
|
||||
USHORT HeapVirtualAffinity;
|
||||
USHORT LowFragHeapDataSlot;
|
||||
WOW64_POINTER(HANDLE) CurrentTransactionHandle;
|
||||
WOW64_POINTER(PTEB_ACTIVE_FRAME) ActiveFrame;
|
||||
WOW64_POINTER(PVOID) FlsData;
|
||||
|
||||
WOW64_POINTER(PVOID) PreferredLanguages;
|
||||
WOW64_POINTER(PVOID) UserPrefLanguages;
|
||||
WOW64_POINTER(PVOID) MergedPrefLanguages;
|
||||
ULONG MuiImpersonation;
|
||||
|
||||
union
|
||||
{
|
||||
USHORT CrossTebFlags;
|
||||
USHORT SpareCrossTebBits : 16;
|
||||
};
|
||||
union
|
||||
{
|
||||
USHORT SameTebFlags;
|
||||
struct
|
||||
{
|
||||
USHORT SafeThunkCall : 1;
|
||||
USHORT InDebugPrint : 1;
|
||||
USHORT HasFiberData : 1;
|
||||
USHORT SkipThreadAttach : 1;
|
||||
USHORT WerInShipAssertCode : 1;
|
||||
USHORT RanProcessInit : 1;
|
||||
USHORT ClonedThread : 1;
|
||||
USHORT SuppressDebugMsg : 1;
|
||||
USHORT DisableUserStackWalk : 1;
|
||||
USHORT RtlExceptionAttached : 1;
|
||||
USHORT InitialThread : 1;
|
||||
USHORT SessionAware : 1;
|
||||
USHORT LoadOwner : 1;
|
||||
USHORT LoaderWorker : 1;
|
||||
USHORT SpareSameTebBits : 2;
|
||||
};
|
||||
};
|
||||
|
||||
WOW64_POINTER(PVOID) TxnScopeEnterCallback;
|
||||
WOW64_POINTER(PVOID) TxnScopeExitCallback;
|
||||
WOW64_POINTER(PVOID) TxnScopeContext;
|
||||
ULONG LockCount;
|
||||
LONG WowTebOffset;
|
||||
WOW64_POINTER(PVOID) ResourceRetValue;
|
||||
WOW64_POINTER(PVOID) ReservedForWdf;
|
||||
ULONGLONG ReservedForCrt;
|
||||
GUID EffectiveContainerId;
|
||||
} TEB32, *PTEB32;
|
||||
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, ProcessEnvironmentBlock) == 0x030);
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, ExceptionCode) == 0x1a4);
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, TxFsContext) == 0x1d0);
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, glContext) == 0xbf0);
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, StaticUnicodeBuffer) == 0xc00);
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, TlsLinks) == 0xf10);
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, DbgSsReserved) == 0xf20);
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, ActivityId) == 0xf50);
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, GdiBatchCount) == 0xf70);
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, TlsExpansionSlots) == 0xf94);
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, FlsData) == 0xfb4);
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, MuiImpersonation) == 0xfc4);
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, ReservedForCrt) == 0xfe8);
|
||||
C_ASSERT(FIELD_OFFSET(TEB32, EffectiveContainerId) == 0xff0);
|
||||
C_ASSERT(sizeof(TEB32) == 0x1000);
|
||||
|
||||
// Conversion
|
||||
|
||||
FORCEINLINE VOID UStr32ToUStr(
|
||||
_Out_ PUNICODE_STRING Destination,
|
||||
_In_ PUNICODE_STRING32 Source
|
||||
)
|
||||
{
|
||||
Destination->Length = Source->Length;
|
||||
Destination->MaximumLength = Source->MaximumLength;
|
||||
Destination->Buffer = (PWCH)UlongToPtr(Source->Buffer);
|
||||
}
|
||||
|
||||
FORCEINLINE VOID UStrToUStr32(
|
||||
_Out_ PUNICODE_STRING32 Destination,
|
||||
_In_ PUNICODE_STRING Source
|
||||
)
|
||||
{
|
||||
Destination->Length = Source->Length;
|
||||
Destination->MaximumLength = Source->MaximumLength;
|
||||
Destination->Buffer = PtrToUlong(Source->Buffer);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _NTXCAPI_H
|
||||
#define _NTXCAPI_H
|
||||
|
||||
NTSYSAPI
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
RtlDispatchException(
|
||||
_In_ PEXCEPTION_RECORD ExceptionRecord,
|
||||
_In_ PCONTEXT ContextRecord
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
DECLSPEC_NORETURN
|
||||
VOID
|
||||
NTAPI
|
||||
RtlRaiseStatus(
|
||||
_In_ NTSTATUS Status
|
||||
);
|
||||
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
RtlRaiseException(
|
||||
_In_ PEXCEPTION_RECORD ExceptionRecord
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtContinue(
|
||||
_In_ PCONTEXT ContextRecord,
|
||||
_In_ BOOLEAN TestAlert
|
||||
);
|
||||
|
||||
NTSYSCALLAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtRaiseException(
|
||||
_In_ PEXCEPTION_RECORD ExceptionRecord,
|
||||
_In_ PCONTEXT ContextRecord,
|
||||
_In_ BOOLEAN FirstChance
|
||||
);
|
||||
|
||||
__analysis_noreturn
|
||||
NTSYSCALLAPI
|
||||
VOID
|
||||
NTAPI
|
||||
RtlAssert(
|
||||
_In_ PVOID VoidFailedAssertion,
|
||||
_In_ PVOID VoidFileName,
|
||||
_In_ ULONG LineNumber,
|
||||
_In_opt_ PSTR MutableMessage
|
||||
);
|
||||
|
||||
#define RTL_ASSERT(exp) \
|
||||
((!(exp)) ? (RtlAssert((PVOID)#exp, (PVOID)__FILE__, __LINE__, NULL), FALSE) : TRUE)
|
||||
#define RTL_ASSERTMSG(msg, exp) \
|
||||
((!(exp)) ? (RtlAssert((PVOID)#exp, (PVOID)__FILE__, __LINE__, msg), FALSE) : TRUE)
|
||||
#define RTL_SOFT_ASSERT(_exp) \
|
||||
((!(_exp)) ? (DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n", __FILE__, __LINE__, #_exp), FALSE) : TRUE)
|
||||
#define RTL_SOFT_ASSERTMSG(_msg, _exp) \
|
||||
((!(_exp)) ? (DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n Message: %s\n", __FILE__, __LINE__, #_exp, (_msg)), FALSE) : TRUE)
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _PHNT_H
|
||||
#define _PHNT_H
|
||||
|
||||
// This header file provides access to NT APIs.
|
||||
|
||||
// Definitions are annotated to indicate their source. If a definition is not annotated, it has been
|
||||
// retrieved from an official Microsoft source (NT headers, DDK headers, winnt.h).
|
||||
|
||||
// * "winbase" indicates that a definition has been reconstructed from a Win32-ized NT definition in
|
||||
// winbase.h.
|
||||
// * "rev" indicates that a definition has been reverse-engineered.
|
||||
// * "dbg" indicates that a definition has been obtained from a debug message or assertion in a
|
||||
// checked build of the kernel or file.
|
||||
|
||||
// Reliability:
|
||||
// 1. No annotation.
|
||||
// 2. dbg.
|
||||
// 3. symbols, private. Types may be incorrect.
|
||||
// 4. winbase. Names and types may be incorrect.
|
||||
// 5. rev.
|
||||
|
||||
// Mode
|
||||
#define PHNT_MODE_KERNEL 0
|
||||
#define PHNT_MODE_USER 1
|
||||
|
||||
// Version
|
||||
#define PHNT_WIN2K 50
|
||||
#define PHNT_WINXP 51
|
||||
#define PHNT_WS03 52
|
||||
#define PHNT_VISTA 60
|
||||
#define PHNT_WIN7 61
|
||||
#define PHNT_WIN8 62
|
||||
#define PHNT_WINBLUE 63
|
||||
#define PHNT_THRESHOLD 100
|
||||
#define PHNT_THRESHOLD2 101
|
||||
#define PHNT_REDSTONE 102
|
||||
#define PHNT_REDSTONE2 103
|
||||
#define PHNT_REDSTONE3 104
|
||||
#define PHNT_REDSTONE4 105
|
||||
#define PHNT_REDSTONE5 106
|
||||
#define PHNT_19H1 107
|
||||
#define PHNT_19H2 108
|
||||
|
||||
#ifndef PHNT_MODE
|
||||
#define PHNT_MODE PHNT_MODE_USER
|
||||
#endif
|
||||
|
||||
#ifndef PHNT_VERSION
|
||||
#define PHNT_VERSION PHNT_WIN7
|
||||
#endif
|
||||
|
||||
// Options
|
||||
|
||||
//#define PHNT_NO_INLINE_INIT_STRING
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
#include <phnt_ntdef.h>
|
||||
#include <ntnls.h>
|
||||
#include <ntkeapi.h>
|
||||
#endif
|
||||
|
||||
#include <ntldr.h>
|
||||
#include <ntexapi.h>
|
||||
|
||||
#include <ntmmapi.h>
|
||||
#include <ntobapi.h>
|
||||
#include <ntpsapi.h>
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
#include <cfg.h>
|
||||
#include <ntdbg.h>
|
||||
#include <ntioapi.h>
|
||||
#include <ntlpcapi.h>
|
||||
#include <ntpfapi.h>
|
||||
#include <ntpnpapi.h>
|
||||
#include <ntpoapi.h>
|
||||
#include <ntregapi.h>
|
||||
#include <ntrtl.h>
|
||||
#endif
|
||||
|
||||
#if (PHNT_MODE != PHNT_MODE_KERNEL)
|
||||
|
||||
#include <ntseapi.h>
|
||||
#include <nttmapi.h>
|
||||
#include <nttp.h>
|
||||
#include <ntxcapi.h>
|
||||
|
||||
#include <ntwow64.h>
|
||||
|
||||
#include <ntlsa.h>
|
||||
#include <ntsam.h>
|
||||
|
||||
#include <ntmisc.h>
|
||||
|
||||
#include <ntzwapi.h>
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,319 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _PHNT_NTDEF_H
|
||||
#define _PHNT_NTDEF_H
|
||||
|
||||
#ifndef _NTDEF_
|
||||
#define _NTDEF_
|
||||
|
||||
// This header file provides basic NT types not included in Win32. If you have included winnt.h
|
||||
// (perhaps indirectly), you must use this file instead of ntdef.h.
|
||||
|
||||
#ifndef NOTHING
|
||||
#define NOTHING
|
||||
#endif
|
||||
|
||||
// Basic types
|
||||
|
||||
typedef struct _QUAD
|
||||
{
|
||||
union
|
||||
{
|
||||
__int64 UseThisFieldToCopy;
|
||||
double DoNotUseThisField;
|
||||
};
|
||||
} QUAD, *PQUAD;
|
||||
|
||||
// This isn't in NT, but it's useful.
|
||||
typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _QUAD_PTR
|
||||
{
|
||||
ULONG_PTR DoNotUseThisField1;
|
||||
ULONG_PTR DoNotUseThisField2;
|
||||
} QUAD_PTR, *PQUAD_PTR;
|
||||
|
||||
typedef ULONG LOGICAL;
|
||||
typedef ULONG *PLOGICAL;
|
||||
|
||||
typedef _Success_(return >= 0) LONG NTSTATUS;
|
||||
typedef NTSTATUS *PNTSTATUS;
|
||||
|
||||
// Cardinal types
|
||||
|
||||
typedef char CCHAR;
|
||||
typedef short CSHORT;
|
||||
typedef ULONG CLONG;
|
||||
|
||||
typedef CCHAR *PCCHAR;
|
||||
typedef CSHORT *PCSHORT;
|
||||
typedef CLONG *PCLONG;
|
||||
|
||||
typedef PCSTR PCSZ;
|
||||
|
||||
// Specific
|
||||
|
||||
typedef UCHAR KIRQL, *PKIRQL;
|
||||
typedef LONG KPRIORITY;
|
||||
typedef USHORT RTL_ATOM, *PRTL_ATOM;
|
||||
|
||||
typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
|
||||
|
||||
// NT status macros
|
||||
|
||||
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
|
||||
#define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
|
||||
#define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
|
||||
#define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
|
||||
|
||||
#define NT_FACILITY_MASK 0xfff
|
||||
#define NT_FACILITY_SHIFT 16
|
||||
#define NT_FACILITY(Status) ((((ULONG)(Status)) >> NT_FACILITY_SHIFT) & NT_FACILITY_MASK)
|
||||
|
||||
#define NT_NTWIN32(Status) (NT_FACILITY(Status) == FACILITY_NTWIN32)
|
||||
#define WIN32_FROM_NTSTATUS(Status) (((ULONG)(Status)) & 0xffff)
|
||||
|
||||
// Functions
|
||||
|
||||
#ifndef _WIN64
|
||||
#define FASTCALL __fastcall
|
||||
#else
|
||||
#define FASTCALL
|
||||
#endif
|
||||
|
||||
// Synchronization enumerations
|
||||
|
||||
typedef enum _EVENT_TYPE
|
||||
{
|
||||
NotificationEvent,
|
||||
SynchronizationEvent
|
||||
} EVENT_TYPE;
|
||||
|
||||
typedef enum _TIMER_TYPE
|
||||
{
|
||||
NotificationTimer,
|
||||
SynchronizationTimer
|
||||
} TIMER_TYPE;
|
||||
|
||||
typedef enum _WAIT_TYPE
|
||||
{
|
||||
WaitAll,
|
||||
WaitAny,
|
||||
WaitNotification
|
||||
} WAIT_TYPE;
|
||||
|
||||
// Strings
|
||||
|
||||
typedef struct _STRING
|
||||
{
|
||||
USHORT Length;
|
||||
USHORT MaximumLength;
|
||||
_Field_size_bytes_part_opt_(MaximumLength, Length) PCHAR Buffer;
|
||||
} STRING, *PSTRING, ANSI_STRING, *PANSI_STRING, OEM_STRING, *POEM_STRING;
|
||||
|
||||
typedef const STRING *PCSTRING;
|
||||
typedef const ANSI_STRING *PCANSI_STRING;
|
||||
typedef const OEM_STRING *PCOEM_STRING;
|
||||
|
||||
typedef struct _UNICODE_STRING
|
||||
{
|
||||
USHORT Length;
|
||||
USHORT MaximumLength;
|
||||
_Field_size_bytes_part_(MaximumLength, Length) PWCH Buffer;
|
||||
} UNICODE_STRING, *PUNICODE_STRING;
|
||||
|
||||
typedef const UNICODE_STRING *PCUNICODE_STRING;
|
||||
|
||||
#define RTL_CONSTANT_STRING(s) { sizeof(s) - sizeof((s)[0]), sizeof(s), s }
|
||||
|
||||
// Balanced tree node
|
||||
|
||||
#define RTL_BALANCED_NODE_RESERVED_PARENT_MASK 3
|
||||
|
||||
typedef struct _RTL_BALANCED_NODE
|
||||
{
|
||||
union
|
||||
{
|
||||
struct _RTL_BALANCED_NODE *Children[2];
|
||||
struct
|
||||
{
|
||||
struct _RTL_BALANCED_NODE *Left;
|
||||
struct _RTL_BALANCED_NODE *Right;
|
||||
};
|
||||
};
|
||||
union
|
||||
{
|
||||
UCHAR Red : 1;
|
||||
UCHAR Balance : 2;
|
||||
ULONG_PTR ParentValue;
|
||||
};
|
||||
} RTL_BALANCED_NODE, *PRTL_BALANCED_NODE;
|
||||
|
||||
#define RTL_BALANCED_NODE_GET_PARENT_POINTER(Node) \
|
||||
((PRTL_BALANCED_NODE)((Node)->ParentValue & ~RTL_BALANCED_NODE_RESERVED_PARENT_MASK))
|
||||
|
||||
// Portability
|
||||
|
||||
typedef struct _SINGLE_LIST_ENTRY32
|
||||
{
|
||||
ULONG Next;
|
||||
} SINGLE_LIST_ENTRY32, *PSINGLE_LIST_ENTRY32;
|
||||
|
||||
typedef struct _STRING32
|
||||
{
|
||||
USHORT Length;
|
||||
USHORT MaximumLength;
|
||||
ULONG Buffer;
|
||||
} STRING32, *PSTRING32;
|
||||
|
||||
typedef STRING32 UNICODE_STRING32, *PUNICODE_STRING32;
|
||||
typedef STRING32 ANSI_STRING32, *PANSI_STRING32;
|
||||
|
||||
typedef struct _STRING64
|
||||
{
|
||||
USHORT Length;
|
||||
USHORT MaximumLength;
|
||||
ULONGLONG Buffer;
|
||||
} STRING64, *PSTRING64;
|
||||
|
||||
typedef STRING64 UNICODE_STRING64, *PUNICODE_STRING64;
|
||||
typedef STRING64 ANSI_STRING64, *PANSI_STRING64;
|
||||
|
||||
// Object attributes
|
||||
|
||||
#define OBJ_INHERIT 0x00000002
|
||||
#define OBJ_PERMANENT 0x00000010
|
||||
#define OBJ_EXCLUSIVE 0x00000020
|
||||
#define OBJ_CASE_INSENSITIVE 0x00000040
|
||||
#define OBJ_OPENIF 0x00000080
|
||||
#define OBJ_OPENLINK 0x00000100
|
||||
#define OBJ_KERNEL_HANDLE 0x00000200
|
||||
#define OBJ_FORCE_ACCESS_CHECK 0x00000400
|
||||
#define OBJ_IGNORE_IMPERSONATED_DEVICEMAP 0x00000800
|
||||
#define OBJ_DONT_REPARSE 0x00001000
|
||||
#define OBJ_VALID_ATTRIBUTES 0x00001ff2
|
||||
|
||||
typedef struct _OBJECT_ATTRIBUTES
|
||||
{
|
||||
ULONG Length;
|
||||
HANDLE RootDirectory;
|
||||
PUNICODE_STRING ObjectName;
|
||||
ULONG Attributes;
|
||||
PVOID SecurityDescriptor; // PSECURITY_DESCRIPTOR;
|
||||
PVOID SecurityQualityOfService; // PSECURITY_QUALITY_OF_SERVICE
|
||||
} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
|
||||
|
||||
typedef const OBJECT_ATTRIBUTES *PCOBJECT_ATTRIBUTES;
|
||||
|
||||
#define InitializeObjectAttributes(p, n, a, r, s) { \
|
||||
(p)->Length = sizeof(OBJECT_ATTRIBUTES); \
|
||||
(p)->RootDirectory = r; \
|
||||
(p)->Attributes = a; \
|
||||
(p)->ObjectName = n; \
|
||||
(p)->SecurityDescriptor = s; \
|
||||
(p)->SecurityQualityOfService = NULL; \
|
||||
}
|
||||
|
||||
#define RTL_CONSTANT_OBJECT_ATTRIBUTES(n, a) { sizeof(OBJECT_ATTRIBUTES), NULL, n, a, NULL, NULL }
|
||||
#define RTL_INIT_OBJECT_ATTRIBUTES(n, a) RTL_CONSTANT_OBJECT_ATTRIBUTES(n, a)
|
||||
|
||||
#define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\')
|
||||
|
||||
// Portability
|
||||
|
||||
typedef struct _OBJECT_ATTRIBUTES64
|
||||
{
|
||||
ULONG Length;
|
||||
ULONG64 RootDirectory;
|
||||
ULONG64 ObjectName;
|
||||
ULONG Attributes;
|
||||
ULONG64 SecurityDescriptor;
|
||||
ULONG64 SecurityQualityOfService;
|
||||
} OBJECT_ATTRIBUTES64, *POBJECT_ATTRIBUTES64;
|
||||
|
||||
typedef const OBJECT_ATTRIBUTES64 *PCOBJECT_ATTRIBUTES64;
|
||||
|
||||
typedef struct _OBJECT_ATTRIBUTES32
|
||||
{
|
||||
ULONG Length;
|
||||
ULONG RootDirectory;
|
||||
ULONG ObjectName;
|
||||
ULONG Attributes;
|
||||
ULONG SecurityDescriptor;
|
||||
ULONG SecurityQualityOfService;
|
||||
} OBJECT_ATTRIBUTES32, *POBJECT_ATTRIBUTES32;
|
||||
|
||||
typedef const OBJECT_ATTRIBUTES32 *PCOBJECT_ATTRIBUTES32;
|
||||
|
||||
// Product types
|
||||
|
||||
typedef enum _NT_PRODUCT_TYPE
|
||||
{
|
||||
NtProductWinNt = 1,
|
||||
NtProductLanManNt,
|
||||
NtProductServer
|
||||
} NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
|
||||
|
||||
typedef enum _SUITE_TYPE
|
||||
{
|
||||
SmallBusiness,
|
||||
Enterprise,
|
||||
BackOffice,
|
||||
CommunicationServer,
|
||||
TerminalServer,
|
||||
SmallBusinessRestricted,
|
||||
EmbeddedNT,
|
||||
DataCenter,
|
||||
SingleUserTS,
|
||||
Personal,
|
||||
Blade,
|
||||
EmbeddedRestricted,
|
||||
SecurityAppliance,
|
||||
StorageServer,
|
||||
ComputeServer,
|
||||
WHServer,
|
||||
PhoneNT,
|
||||
MaxSuiteType
|
||||
} SUITE_TYPE;
|
||||
|
||||
// Specific
|
||||
|
||||
typedef struct _CLIENT_ID
|
||||
{
|
||||
HANDLE UniqueProcess;
|
||||
HANDLE UniqueThread;
|
||||
} CLIENT_ID, *PCLIENT_ID;
|
||||
|
||||
typedef struct _CLIENT_ID32
|
||||
{
|
||||
ULONG UniqueProcess;
|
||||
ULONG UniqueThread;
|
||||
} CLIENT_ID32, *PCLIENT_ID32;
|
||||
|
||||
typedef struct _CLIENT_ID64
|
||||
{
|
||||
ULONGLONG UniqueProcess;
|
||||
ULONGLONG UniqueThread;
|
||||
} CLIENT_ID64, *PCLIENT_ID64;
|
||||
|
||||
#include <pshpack4.h>
|
||||
|
||||
typedef struct _KSYSTEM_TIME
|
||||
{
|
||||
ULONG LowPart;
|
||||
LONG High1Time;
|
||||
LONG High2Time;
|
||||
} KSYSTEM_TIME, *PKSYSTEM_TIME;
|
||||
|
||||
#include <poppack.h>
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _PHNT_WINDOWS_H
|
||||
#define _PHNT_WINDOWS_H
|
||||
|
||||
// This header file provides access to Win32, plus NTSTATUS values and some access mask values.
|
||||
|
||||
#ifndef CINTERFACE
|
||||
#define CINTERFACE
|
||||
#endif
|
||||
|
||||
#ifndef COBJMACROS
|
||||
#define COBJMACROS
|
||||
#endif
|
||||
|
||||
#ifndef INITGUID
|
||||
#define INITGUID
|
||||
#endif
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#ifndef WIN32_NO_STATUS
|
||||
#define WIN32_NO_STATUS
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#undef WIN32_NO_STATUS
|
||||
#include <ntstatus.h>
|
||||
#include <winioctl.h>
|
||||
|
||||
typedef double DOUBLE;
|
||||
typedef GUID *PGUID;
|
||||
|
||||
// Desktop access rights
|
||||
#define DESKTOP_ALL_ACCESS \
|
||||
(DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_ENUMERATE | \
|
||||
DESKTOP_HOOKCONTROL | DESKTOP_JOURNALPLAYBACK | DESKTOP_JOURNALRECORD | \
|
||||
DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | DESKTOP_WRITEOBJECTS | \
|
||||
STANDARD_RIGHTS_REQUIRED)
|
||||
#define DESKTOP_GENERIC_READ \
|
||||
(DESKTOP_ENUMERATE | DESKTOP_READOBJECTS | STANDARD_RIGHTS_READ)
|
||||
#define DESKTOP_GENERIC_WRITE \
|
||||
(DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_HOOKCONTROL | \
|
||||
DESKTOP_JOURNALPLAYBACK | DESKTOP_JOURNALRECORD | DESKTOP_WRITEOBJECTS | \
|
||||
STANDARD_RIGHTS_WRITE)
|
||||
#define DESKTOP_GENERIC_EXECUTE \
|
||||
(DESKTOP_SWITCHDESKTOP | STANDARD_RIGHTS_EXECUTE)
|
||||
|
||||
// Window station access rights
|
||||
#define WINSTA_GENERIC_READ \
|
||||
(WINSTA_ENUMDESKTOPS | WINSTA_ENUMERATE | WINSTA_READATTRIBUTES | \
|
||||
WINSTA_READSCREEN | STANDARD_RIGHTS_READ)
|
||||
#define WINSTA_GENERIC_WRITE \
|
||||
(WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP | WINSTA_WRITEATTRIBUTES | \
|
||||
STANDARD_RIGHTS_WRITE)
|
||||
#define WINSTA_GENERIC_EXECUTE \
|
||||
(WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS | STANDARD_RIGHTS_EXECUTE)
|
||||
|
||||
// WMI access rights
|
||||
#define WMIGUID_GENERIC_READ \
|
||||
(WMIGUID_QUERY | WMIGUID_NOTIFICATION | WMIGUID_READ_DESCRIPTION | \
|
||||
STANDARD_RIGHTS_READ)
|
||||
#define WMIGUID_GENERIC_WRITE \
|
||||
(WMIGUID_SET | TRACELOG_CREATE_REALTIME | TRACELOG_CREATE_ONDISK | \
|
||||
STANDARD_RIGHTS_WRITE)
|
||||
#define WMIGUID_GENERIC_EXECUTE \
|
||||
(WMIGUID_EXECUTE | TRACELOG_GUID_ENABLE | TRACELOG_LOG_EVENT | \
|
||||
TRACELOG_ACCESS_REALTIME | TRACELOG_REGISTER_GUIDS | \
|
||||
STANDARD_RIGHTS_EXECUTE)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* This file is part of the Process Hacker project - https://processhacker.sourceforge.io/
|
||||
*
|
||||
* You can redistribute this file and/or modify it under the terms of the
|
||||
* Attribution 4.0 International (CC BY 4.0) license.
|
||||
*
|
||||
* You must give appropriate credit, provide a link to the license, and
|
||||
* indicate if changes were made. You may do so in any reasonable manner, but
|
||||
* not in any way that suggests the licensor endorses you or your use.
|
||||
*/
|
||||
|
||||
#ifndef _SUBPROCESSTAG_H
|
||||
#define _SUBPROCESSTAG_H
|
||||
|
||||
// Subprocess tag information
|
||||
|
||||
typedef enum _TAG_INFO_LEVEL
|
||||
{
|
||||
eTagInfoLevelNameFromTag = 1, // TAG_INFO_NAME_FROM_TAG
|
||||
eTagInfoLevelNamesReferencingModule, // TAG_INFO_NAMES_REFERENCING_MODULE
|
||||
eTagInfoLevelNameTagMapping, // TAG_INFO_NAME_TAG_MAPPING
|
||||
eTagInfoLevelMax
|
||||
} TAG_INFO_LEVEL;
|
||||
|
||||
typedef enum _TAG_TYPE
|
||||
{
|
||||
eTagTypeService = 1,
|
||||
eTagTypeMax
|
||||
} TAG_TYPE;
|
||||
|
||||
typedef struct _TAG_INFO_NAME_FROM_TAG_IN_PARAMS
|
||||
{
|
||||
DWORD dwPid;
|
||||
DWORD dwTag;
|
||||
} TAG_INFO_NAME_FROM_TAG_IN_PARAMS, *PTAG_INFO_NAME_FROM_TAG_IN_PARAMS;
|
||||
|
||||
typedef struct _TAG_INFO_NAME_FROM_TAG_OUT_PARAMS
|
||||
{
|
||||
DWORD eTagType;
|
||||
LPWSTR pszName;
|
||||
} TAG_INFO_NAME_FROM_TAG_OUT_PARAMS, *PTAG_INFO_NAME_FROM_TAG_OUT_PARAMS;
|
||||
|
||||
typedef struct _TAG_INFO_NAME_FROM_TAG
|
||||
{
|
||||
TAG_INFO_NAME_FROM_TAG_IN_PARAMS InParams;
|
||||
TAG_INFO_NAME_FROM_TAG_OUT_PARAMS OutParams;
|
||||
} TAG_INFO_NAME_FROM_TAG, *PTAG_INFO_NAME_FROM_TAG;
|
||||
|
||||
typedef struct _TAG_INFO_NAMES_REFERENCING_MODULE_IN_PARAMS
|
||||
{
|
||||
DWORD dwPid;
|
||||
LPWSTR pszModule;
|
||||
} TAG_INFO_NAMES_REFERENCING_MODULE_IN_PARAMS, *PTAG_INFO_NAMES_REFERENCING_MODULE_IN_PARAMS;
|
||||
|
||||
typedef struct _TAG_INFO_NAMES_REFERENCING_MODULE_OUT_PARAMS
|
||||
{
|
||||
DWORD eTagType;
|
||||
LPWSTR pmszNames;
|
||||
} TAG_INFO_NAMES_REFERENCING_MODULE_OUT_PARAMS, *PTAG_INFO_NAMES_REFERENCING_MODULE_OUT_PARAMS;
|
||||
|
||||
typedef struct _TAG_INFO_NAMES_REFERENCING_MODULE
|
||||
{
|
||||
TAG_INFO_NAMES_REFERENCING_MODULE_IN_PARAMS InParams;
|
||||
TAG_INFO_NAMES_REFERENCING_MODULE_OUT_PARAMS OutParams;
|
||||
} TAG_INFO_NAMES_REFERENCING_MODULE, *PTAG_INFO_NAMES_REFERENCING_MODULE;
|
||||
|
||||
typedef struct _TAG_INFO_NAME_TAG_MAPPING_IN_PARAMS
|
||||
{
|
||||
DWORD dwPid;
|
||||
} TAG_INFO_NAME_TAG_MAPPING_IN_PARAMS, *PTAG_INFO_NAME_TAG_MAPPING_IN_PARAMS;
|
||||
|
||||
typedef struct _TAG_INFO_NAME_TAG_MAPPING_ELEMENT
|
||||
{
|
||||
DWORD eTagType;
|
||||
DWORD dwTag;
|
||||
LPWSTR pszName;
|
||||
LPWSTR pszGroupName;
|
||||
} TAG_INFO_NAME_TAG_MAPPING_ELEMENT, *PTAG_INFO_NAME_TAG_MAPPING_ELEMENT;
|
||||
|
||||
typedef struct _TAG_INFO_NAME_TAG_MAPPING_OUT_PARAMS
|
||||
{
|
||||
DWORD cElements;
|
||||
PTAG_INFO_NAME_TAG_MAPPING_ELEMENT pNameTagMappingElements;
|
||||
} TAG_INFO_NAME_TAG_MAPPING_OUT_PARAMS, *PTAG_INFO_NAME_TAG_MAPPING_OUT_PARAMS;
|
||||
|
||||
typedef struct _TAG_INFO_NAME_TAG_MAPPING
|
||||
{
|
||||
TAG_INFO_NAME_TAG_MAPPING_IN_PARAMS InParams;
|
||||
PTAG_INFO_NAME_TAG_MAPPING_OUT_PARAMS pOutParams;
|
||||
} TAG_INFO_NAME_TAG_MAPPING, *PTAG_INFO_NAME_TAG_MAPPING;
|
||||
|
||||
_Must_inspect_result_
|
||||
DWORD
|
||||
WINAPI
|
||||
I_QueryTagInformation(
|
||||
_In_opt_ LPCWSTR pszMachineName,
|
||||
_In_ TAG_INFO_LEVEL eInfoLevel,
|
||||
_Inout_ PVOID pTagInfo
|
||||
);
|
||||
|
||||
typedef DWORD (WINAPI *PQUERY_TAG_INFORMATION)(
|
||||
_In_opt_ LPCWSTR pszMachineName,
|
||||
_In_ TAG_INFO_LEVEL eInfoLevel,
|
||||
_Inout_ PVOID pTagInfo
|
||||
);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user