[NDK][NTDLL][PSAPI] Correct the the names of two LDR_DATA_TABLE_ENTRY fields. Brought to you by Mike Nordell aka tamlin. CORE-9817

svn path=/trunk/; revision=68151
This commit is contained in:
Amine Khaldi 2015-06-15 18:38:57 +00:00
parent 7a3b665ba3
commit 820f01a764
6 changed files with 35 additions and 32 deletions

View file

@ -476,7 +476,7 @@ LdrFindEntryForAddress(PVOID Address,
while (NextEntry != ListHead) while (NextEntry != ListHead)
{ {
/* Get the entry and NT Headers */ /* Get the entry and NT Headers */
LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InMemoryOrderModuleList); LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks);
NtHeader = RtlImageNtHeader(LdrEntry->DllBase); NtHeader = RtlImageNtHeader(LdrEntry->DllBase);
if (NtHeader) if (NtHeader)
{ {
@ -1036,7 +1036,7 @@ LdrQueryProcessModuleInformationEx(IN ULONG ProcessId,
while (InitEntry != InitListHead) while (InitEntry != InitListHead)
{ {
InitModule = CONTAINING_RECORD(InitEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList); InitModule = CONTAINING_RECORD(InitEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderLinks);
/* Increase the index */ /* Increase the index */
ModulePtr->InitOrderIndex++; ModulePtr->InitOrderIndex++;
@ -1384,7 +1384,7 @@ LdrUnloadDll(IN PVOID BaseAddress)
/* Get the entry */ /* Get the entry */
LdrEntry = CONTAINING_RECORD(NextEntry, LdrEntry = CONTAINING_RECORD(NextEntry,
LDR_DATA_TABLE_ENTRY, LDR_DATA_TABLE_ENTRY,
InInitializationOrderModuleList); InInitializationOrderLinks);
NextEntry = NextEntry->Blink; NextEntry = NextEntry->Blink;
/* Remove flag */ /* Remove flag */
@ -1408,8 +1408,8 @@ LdrUnloadDll(IN PVOID BaseAddress)
/* Unlink it */ /* Unlink it */
CurrentEntry = LdrEntry; CurrentEntry = LdrEntry;
RemoveEntryList(&CurrentEntry->InInitializationOrderModuleList); RemoveEntryList(&CurrentEntry->InInitializationOrderLinks);
RemoveEntryList(&CurrentEntry->InMemoryOrderModuleList); RemoveEntryList(&CurrentEntry->InMemoryOrderLinks);
RemoveEntryList(&CurrentEntry->HashLinks); RemoveEntryList(&CurrentEntry->HashLinks);
/* If there's more then one active unload */ /* If there's more then one active unload */
@ -1417,7 +1417,7 @@ LdrUnloadDll(IN PVOID BaseAddress)
{ {
/* Flush the cached DLL handle and clear the list */ /* Flush the cached DLL handle and clear the list */
LdrpLoadedDllHandleCache = NULL; LdrpLoadedDllHandleCache = NULL;
CurrentEntry->InMemoryOrderModuleList.Flink = NULL; CurrentEntry->InMemoryOrderLinks.Flink = NULL;
} }
/* Add the entry on the unload list */ /* Add the entry on the unload list */
@ -1443,7 +1443,7 @@ LdrUnloadDll(IN PVOID BaseAddress)
/* Set the entry and clear it from the list */ /* Set the entry and clear it from the list */
CurrentEntry = LdrEntry; CurrentEntry = LdrEntry;
LdrpLoadedDllHandleCache = NULL; LdrpLoadedDllHandleCache = NULL;
CurrentEntry->InMemoryOrderModuleList.Flink = NULL; CurrentEntry->InMemoryOrderLinks.Flink = NULL;
/* Move it from the global to the local list */ /* Move it from the global to the local list */
RemoveEntryList(&CurrentEntry->HashLinks); RemoveEntryList(&CurrentEntry->HashLinks);

View file

@ -526,7 +526,7 @@ LdrpInitializeThread(IN PCONTEXT Context)
while (NextEntry != ListHead) while (NextEntry != ListHead)
{ {
/* Get the current entry */ /* Get the current entry */
LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InMemoryOrderModuleList); LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks);
/* Make sure it's not ourselves */ /* Make sure it's not ourselves */
if (Peb->ImageBaseAddress != LdrEntry->DllBase) if (Peb->ImageBaseAddress != LdrEntry->DllBase)
@ -674,7 +674,7 @@ LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL)
while (NextEntry != ListHead) while (NextEntry != ListHead)
{ {
/* Get the Data Entry */ /* Get the Data Entry */
LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList); LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderLinks);
/* Check if we have a Root Entry */ /* Check if we have a Root Entry */
if (LdrRootEntry) if (LdrRootEntry)
@ -840,7 +840,7 @@ LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL)
while (NextEntry != ListHead) while (NextEntry != ListHead)
{ {
/* Get the Data Entrry */ /* Get the Data Entrry */
LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList); LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderLinks);
/* FIXME: Verify NX Compat */ /* FIXME: Verify NX Compat */
// LdrpCheckNXCompatibility() // LdrpCheckNXCompatibility()
@ -932,7 +932,7 @@ LdrShutdownProcess(VOID)
while (NextEntry != ListHead) while (NextEntry != ListHead)
{ {
/* Get the current entry */ /* Get the current entry */
LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList); LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderLinks);
NextEntry = NextEntry->Blink; NextEntry = NextEntry->Blink;
/* Make sure it's not ourselves */ /* Make sure it's not ourselves */
@ -1037,7 +1037,7 @@ LdrShutdownThread(VOID)
while (NextEntry != ListHead) while (NextEntry != ListHead)
{ {
/* Get the current entry */ /* Get the current entry */
LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList); LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderLinks);
NextEntry = NextEntry->Blink; NextEntry = NextEntry->Blink;
/* Make sure it's not ourselves */ /* Make sure it's not ourselves */
@ -1927,7 +1927,7 @@ LdrpInitializeProcess(IN PCONTEXT Context,
/* Link the Init Order List */ /* Link the Init Order List */
InsertHeadList(&Peb->Ldr->InInitializationOrderModuleList, InsertHeadList(&Peb->Ldr->InInitializationOrderModuleList,
&LdrpNtDllDataTableEntry->InInitializationOrderModuleList); &LdrpNtDllDataTableEntry->InInitializationOrderLinks);
/* Initialize Wine's active context implementation for the current process */ /* Initialize Wine's active context implementation for the current process */
actctx_init(); actctx_init();

View file

@ -318,7 +318,7 @@ LdrpHandleOneNewFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL,
{ {
/* Add it to our list */ /* Add it to our list */
InsertTailList(&Peb->Ldr->InInitializationOrderModuleList, InsertTailList(&Peb->Ldr->InInitializationOrderModuleList,
&DllLdrEntry->InInitializationOrderModuleList); &DllLdrEntry->InInitializationOrderLinks);
} }
/* Check if the Bound Entry is now invalid */ /* Check if the Bound Entry is now invalid */
@ -381,7 +381,7 @@ LdrpHandleOneNewFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL,
{ {
/* Add it to our list */ /* Add it to our list */
InsertTailList(&Peb->Ldr->InInitializationOrderModuleList, InsertTailList(&Peb->Ldr->InInitializationOrderModuleList,
&ForwarderLdrEntry->InInitializationOrderModuleList); &ForwarderLdrEntry->InInitializationOrderLinks);
} }
} }
@ -590,7 +590,7 @@ LdrpHandleOneOldFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL,
{ {
/* Add the DLL to our list */ /* Add the DLL to our list */
InsertTailList(&Peb->Ldr->InInitializationOrderModuleList, InsertTailList(&Peb->Ldr->InInitializationOrderModuleList,
&DllLdrEntry->InInitializationOrderModuleList); &DllLdrEntry->InInitializationOrderLinks);
} }
/* Now snap the IAT Entry */ /* Now snap the IAT Entry */
@ -850,7 +850,7 @@ LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL,
{ {
/* Add it to the in-init-order list in case of failure */ /* Add it to the in-init-order list in case of failure */
InsertTailList(&Peb->Ldr->InInitializationOrderModuleList, InsertTailList(&Peb->Ldr->InInitializationOrderModuleList,
&(*DataTableEntry)->InInitializationOrderModuleList); &(*DataTableEntry)->InInitializationOrderLinks);
} }
return Status; return Status;

View file

@ -1273,7 +1273,7 @@ SkipCheck:
{ {
/* Remove the DLL from the lists */ /* Remove the DLL from the lists */
RemoveEntryList(&LdrEntry->InLoadOrderLinks); RemoveEntryList(&LdrEntry->InLoadOrderLinks);
RemoveEntryList(&LdrEntry->InMemoryOrderModuleList); RemoveEntryList(&LdrEntry->InMemoryOrderLinks);
RemoveEntryList(&LdrEntry->HashLinks); RemoveEntryList(&LdrEntry->HashLinks);
/* Remove the LDR Entry */ /* Remove the LDR Entry */
@ -1341,7 +1341,7 @@ SkipCheck:
CandidateEnd = CandidateBase + CandidateEntry->SizeOfImage; CandidateEnd = CandidateBase + CandidateEntry->SizeOfImage;
/* Make sure this entry isn't unloading */ /* Make sure this entry isn't unloading */
if (!CandidateEntry->InMemoryOrderModuleList.Flink) continue; if (!CandidateEntry->InMemoryOrderLinks.Flink) continue;
/* Check if our regions are colliding */ /* Check if our regions are colliding */
if ((ImageBase >= CandidateBase && ImageBase <= CandidateEnd) || if ((ImageBase >= CandidateBase && ImageBase <= CandidateEnd) ||
@ -1465,7 +1465,7 @@ SkipCheck:
{ {
/* Remove it from the lists */ /* Remove it from the lists */
RemoveEntryList(&LdrEntry->InLoadOrderLinks); RemoveEntryList(&LdrEntry->InLoadOrderLinks);
RemoveEntryList(&LdrEntry->InMemoryOrderModuleList); RemoveEntryList(&LdrEntry->InMemoryOrderLinks);
RemoveEntryList(&LdrEntry->HashLinks); RemoveEntryList(&LdrEntry->HashLinks);
/* Unmap it, clear the entry */ /* Unmap it, clear the entry */
@ -1576,7 +1576,7 @@ LdrpInsertMemoryTableEntry(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
/* Insert into other lists */ /* Insert into other lists */
InsertTailList(&PebData->InLoadOrderModuleList, &LdrEntry->InLoadOrderLinks); InsertTailList(&PebData->InLoadOrderModuleList, &LdrEntry->InLoadOrderLinks);
InsertTailList(&PebData->InMemoryOrderModuleList, &LdrEntry->InMemoryOrderModuleList); InsertTailList(&PebData->InMemoryOrderModuleList, &LdrEntry->InMemoryOrderLinks);
} }
VOID VOID
@ -1630,7 +1630,7 @@ LdrpCheckForLoadedDllHandle(IN PVOID Base,
InLoadOrderLinks); InLoadOrderLinks);
/* Make sure it's not unloading and check for a match */ /* Make sure it's not unloading and check for a match */
if ((Current->InMemoryOrderModuleList.Flink) && (Base == Current->DllBase)) if ((Current->InMemoryOrderLinks.Flink) && (Base == Current->DllBase))
{ {
/* Save in cache */ /* Save in cache */
LdrpLoadedDllHandleCache = Current; LdrpLoadedDllHandleCache = Current;
@ -2097,7 +2097,7 @@ lookinhash:
ListEntry = ListEntry->Flink; ListEntry = ListEntry->Flink;
/* Check if it's being unloaded */ /* Check if it's being unloaded */
if (!CurEntry->InMemoryOrderModuleList.Flink) continue; if (!CurEntry->InMemoryOrderLinks.Flink) continue;
/* Check if name matches */ /* Check if name matches */
if (RtlEqualUnicodeString(&FullDllName, if (RtlEqualUnicodeString(&FullDllName,
@ -2195,7 +2195,7 @@ lookinhash:
ListEntry = ListEntry->Flink; ListEntry = ListEntry->Flink;
/* Check if it's in the process of being unloaded */ /* Check if it's in the process of being unloaded */
if (!CurEntry->InMemoryOrderModuleList.Flink) continue; if (!CurEntry->InMemoryOrderLinks.Flink) continue;
/* The header is untrusted, use SEH */ /* The header is untrusted, use SEH */
_SEH2_TRY _SEH2_TRY
@ -2362,7 +2362,7 @@ LdrpGetProcedureAddress(IN PVOID BaseAddress,
Entry = NtCurrentPeb()->Ldr->InInitializationOrderModuleList.Blink; Entry = NtCurrentPeb()->Ldr->InInitializationOrderModuleList.Blink;
LdrEntry = CONTAINING_RECORD(Entry, LdrEntry = CONTAINING_RECORD(Entry,
LDR_DATA_TABLE_ENTRY, LDR_DATA_TABLE_ENTRY,
InInitializationOrderModuleList); InInitializationOrderLinks);
/* Make sure we didn't process it yet*/ /* Make sure we didn't process it yet*/
if (!(LdrEntry->Flags & LDRP_ENTRY_PROCESSED)) if (!(LdrEntry->Flags & LDRP_ENTRY_PROCESSED))
@ -2536,7 +2536,7 @@ LdrpLoadDll(IN BOOLEAN Redirected,
/* Clear entrypoint, and insert into list */ /* Clear entrypoint, and insert into list */
LdrEntry->EntryPoint = NULL; LdrEntry->EntryPoint = NULL;
InsertTailList(&Peb->Ldr->InInitializationOrderModuleList, InsertTailList(&Peb->Ldr->InInitializationOrderModuleList,
&LdrEntry->InInitializationOrderModuleList); &LdrEntry->InInitializationOrderLinks);
/* Cancel the load */ /* Cancel the load */
LdrpClearLoadInProgress(); LdrpClearLoadInProgress();
@ -2563,7 +2563,7 @@ LdrpLoadDll(IN BOOLEAN Redirected,
/* Insert it into the list */ /* Insert it into the list */
InsertTailList(&Peb->Ldr->InInitializationOrderModuleList, InsertTailList(&Peb->Ldr->InInitializationOrderModuleList,
&LdrEntry->InInitializationOrderModuleList); &LdrEntry->InInitializationOrderLinks);
/* If we have to run the entrypoint, make sure the DB is ready */ /* If we have to run the entrypoint, make sure the DB is ready */
if (CallInit && LdrpLdrDatabaseIsSetup) if (CallInit && LdrpLdrDatabaseIsSetup)
@ -2653,7 +2653,7 @@ LdrpClearLoadInProgress(VOID)
/* Get the loader entry */ /* Get the loader entry */
LdrEntry = CONTAINING_RECORD(Entry, LdrEntry = CONTAINING_RECORD(Entry,
LDR_DATA_TABLE_ENTRY, LDR_DATA_TABLE_ENTRY,
InInitializationOrderModuleList); InInitializationOrderLinks);
/* Clear load in progress flag */ /* Clear load in progress flag */
LdrEntry->Flags &= ~LDRP_LOAD_IN_PROGRESS; LdrEntry->Flags &= ~LDRP_LOAD_IN_PROGRESS;

View file

@ -187,7 +187,7 @@ FindModule(IN HANDLE hProcess,
{ {
/* Load module data */ /* Load module data */
if (!ReadProcessMemory(hProcess, if (!ReadProcessMemory(hProcess,
CONTAINING_RECORD(ListEntry, LDR_DATA_TABLE_ENTRY, InMemoryOrderModuleList), CONTAINING_RECORD(ListEntry, LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks),
Module, Module,
sizeof(*Module), sizeof(*Module),
NULL)) NULL))
@ -208,7 +208,7 @@ FindModule(IN HANDLE hProcess,
} }
/* Get to next listed module */ /* Get to next listed module */
ListEntry = Module->InMemoryOrderModuleList.Flink; ListEntry = Module->InMemoryOrderLinks.Flink;
} }
SetLastError(ERROR_INVALID_HANDLE); SetLastError(ERROR_INVALID_HANDLE);

View file

@ -128,11 +128,14 @@ typedef struct _PEB_LDR_DATA
// //
// Loader Data Table Entry // Loader Data Table Entry
// //
// NOTE: The field 'InMemoryOrderLinks' MUST have that name.
// It's hard-coded into WinDbg for PEB dumping!
//
typedef struct _LDR_DATA_TABLE_ENTRY typedef struct _LDR_DATA_TABLE_ENTRY
{ {
LIST_ENTRY InLoadOrderLinks; LIST_ENTRY InLoadOrderLinks;
LIST_ENTRY InMemoryOrderModuleList; LIST_ENTRY InMemoryOrderLinks;
LIST_ENTRY InInitializationOrderModuleList; LIST_ENTRY InInitializationOrderLinks;
PVOID DllBase; PVOID DllBase;
PVOID EntryPoint; PVOID EntryPoint;
ULONG SizeOfImage; ULONG SizeOfImage;