Signed-off-by: Zebediah Figura z.figura12@gmail.com --- include/ntdef.h | 33 +++++++++++++++++++++++++++++++++ include/windef.h | 15 +++++++++++---- 2 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/include/ntdef.h b/include/ntdef.h index 014102ac74..d85aa6feb5 100644 --- a/include/ntdef.h +++ b/include/ntdef.h @@ -19,6 +19,8 @@ #ifndef _NTDEF_ #define _NTDEF_
+#include <basetsd.h> + #ifdef __cplusplus extern "C" { #endif @@ -48,4 +50,35 @@ typedef enum _WAIT_TYPE { #define NT_WARNING(status) ((((NTSTATUS)(status)) & 0xc0000000) == 0x80000000) #define NT_ERROR(status) ((((NTSTATUS)(status)) & 0xc0000000) == 0xc0000000)
+#define BASETYPES +typedef unsigned char UCHAR, *PUCHAR; +typedef unsigned short USHORT, *PUSHORT; +#ifdef _MSC_VER +typedef unsigned long ULONG, *PULONG; +#else +typedef unsigned int ULONG, *PULONG; +#endif + +typedef struct _RTL_BALANCED_NODE +{ + union + { + struct _RTL_BALANCED_NODE *Children[2]; + struct + { + struct _RTL_BALANCED_NODE *Left; + struct _RTL_BALANCED_NODE *Right; + } DUMMYSTRUCTNAME; + } DUMMYUNIONNAME; + + union + { + UCHAR Red : 1; + UCHAR Balance : 2; + ULONG_PTR ParentValue; + } DUMMYUNIONNAME2; +} RTL_BALANCED_NODE, *PRTL_BALANCED_NODE; + +#define RTL_BALANCED_NODE_RESERVED_PARENT_MASK 3 + #endif /* _NTDEF_ */ diff --git a/include/windef.h b/include/windef.h index 0074d5cf6c..3c61cad4c5 100644 --- a/include/windef.h +++ b/include/windef.h @@ -239,13 +239,22 @@ extern "C" {
/* Standard data types */
+#ifndef BASETYPES +#define BASETYPES +typedef unsigned char UCHAR, *PUCHAR; +typedef unsigned short USHORT, *PUSHORT; +#ifdef _MSC_VER +typedef unsigned long ULONG, *PULONG; +#else +typedef unsigned int ULONG, *PULONG; +#endif +#endif + typedef void *LPVOID; typedef const void *LPCVOID; typedef int BOOL, *PBOOL, *LPBOOL; typedef unsigned char BYTE, *PBYTE, *LPBYTE; -typedef unsigned char UCHAR, *PUCHAR; typedef unsigned short WORD, *PWORD, *LPWORD; -typedef unsigned short USHORT, *PUSHORT; typedef int INT, *PINT, *LPINT; typedef unsigned int UINT, *PUINT; typedef float FLOAT, *PFLOAT; @@ -253,11 +262,9 @@ typedef char *PSZ; #ifdef _MSC_VER typedef long *LPLONG; typedef unsigned long DWORD, *PDWORD, *LPDWORD; -typedef unsigned long ULONG, *PULONG; #else typedef int *LPLONG; typedef unsigned int DWORD, *PDWORD, *LPDWORD; -typedef unsigned int ULONG, *PULONG; #endif
/* Macros to map Winelib names to the correct implementation name */
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- Derived from https://processhacker.sourceforge.io/doc/ntldr_8h_source.html.
This is an attempt to supersede https://github.com/wine-staging/wine-staging/blob/master/patches/ntdll-LDR_MODULE/0002-include-Update-LDR_MODULE-to-more-recent-windows-ver.patch.
I was unable to locate any record of an application which is helped by that patch, but I imagine it's generally a good idea to supply zero rather than garbage data, in the instance that any application does try to access those fields.
include/winternl.h | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)
diff --git a/include/winternl.h b/include/winternl.h index ac045c1709..f36419da78 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2255,6 +2255,68 @@ typedef struct _NLSTABLEINFO * * Those are not part of standard Winternl.h */ + +typedef struct _LDR_SERVICE_TAG_RECORD +{ + struct _LDR_SERVICE_TAG_RECORD *Next; + ULONG ServiceTag; +} LDR_SERVICE_TAG_RECORD, *PLDR_SERVICE_TAG_RECORD; + +typedef struct _LDRP_CSLIST +{ + SINGLE_LIST_ENTRY *Tail; +} LDRP_CSLIST, *PLDRP_CSLIST; + +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; + +typedef struct _LDR_DDAG_NODE +{ + LIST_ENTRY Modules; + LDR_SERVICE_TAG_RECORD *ServiceTagList; + ULONG LoadCount; + ULONG ReferenceCount; + ULONG DependencyCount; + union + { + LDRP_CSLIST Dependencies; + SINGLE_LIST_ENTRY RemovalLink; + }; + LDRP_CSLIST IncomingDependencies; + LDR_DDAG_STATE State; + SINGLE_LIST_ENTRY CondenseLink; + ULONG PreorderNumber; + ULONG LowestLink; +} LDR_DDAG_NODE, *PLDR_DDAG_NODE; + +typedef enum _LDR_DLL_LOAD_REASON +{ + LoadReasonStaticDependency, + LoadReasonStaticForwarderDependency, + LoadReasonDynamicForwarderDependency, + LoadReasonDelayloadDependency, + LoadReasonDynamicLoad, + LoadReasonAsImageLoad, + LoadReasonAsDataLoad, + LoadReasonUnknown = -1 +} LDR_DLL_LOAD_REASON, *PLDR_DLL_LOAD_REASON; + typedef struct _LDR_MODULE { LIST_ENTRY InLoadOrderModuleList; @@ -2272,6 +2334,20 @@ typedef struct _LDR_MODULE ULONG CheckSum; ULONG TimeDateStamp; HANDLE ActivationContext; + void* Lock; + LDR_DDAG_NODE* DdagNode; + LIST_ENTRY NodeModuleLink; + struct _LDRP_LOAD_CONTEXT *LoadContext; + void* ParentDllBase; + void* 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; } LDR_MODULE, *PLDR_MODULE;
typedef struct _LDR_DLL_LOADED_NOTIFICATION_DATA