Use LDR_DATA_TABLE_ENTRY instead of LDR_MODULE. the former is the actual
structure. would be wise to fix the defs too.
Modified: trunk/reactos/apps/utils/pice/module/symbols.c
Modified: trunk/reactos/apps/utils/sdkparse/test.h
Modified: trunk/reactos/include/epsapi.h
Modified: trunk/reactos/include/napi/types.h
Modified: trunk/reactos/include/ndk/ldrtypes.h
Modified: trunk/reactos/include/ntdll/ldr.h
Modified: trunk/reactos/lib/epsapi/enum/modules.c
Modified: trunk/reactos/lib/kernel32/misc/ldr.c
Modified: trunk/reactos/lib/ntdll/inc/ntdllp.h
Modified: trunk/reactos/lib/ntdll/ldr/startup.c
Modified: trunk/reactos/lib/ntdll/ldr/utils.c
Modified: trunk/reactos/lib/ntdll/rtl/dbgbuffer.c
Modified: trunk/reactos/lib/psapi/psapi.c
Modified: trunk/reactos/ntoskrnl/ex/dbgctrl.c
Modified: trunk/reactos/ntoskrnl/include/internal/kd.h
Modified: trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c
Modified: trunk/reactos/ntoskrnl/ke/i386/usertrap.c
Modified: trunk/reactos/subsys/smss/smss.h
_____
Modified: trunk/reactos/apps/utils/pice/module/symbols.c
--- trunk/reactos/apps/utils/pice/module/symbols.c 2005-06-21
02:58:22 UTC (rev 16202)
+++ trunk/reactos/apps/utils/pice/module/symbols.c 2005-06-21
04:10:45 UTC (rev 16203)
@@ -167,7 +167,7 @@
{
PLIST_ENTRY UserModuleListHead;
PLIST_ENTRY Entry;
- PLDR_MODULE Module;
+ PLDR_DATA_TABLE_ENTRY Module;
PPEB_LDR_DATA Ldr;
ENTER_FUNC();
@@ -179,7 +179,7 @@
Entry = UserModuleListHead->Flink;
while (Entry != UserModuleListHead)
{
- Module = CONTAINING_RECORD(Entry, LDR_MODULE,
InLoadOrderModuleList);
+ Module = CONTAINING_RECORD(Entry,
LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
//DbgPrint("Module: %x, BaseAddress: %x\n",
Module, Module->BaseAddress);
DPRINT((0,"FullName: %S, BaseName: %S, Length:
%ld, EntryPoint: %x, BaseAddress: %x\n", Module->FullDllName.Buffer,
_____
Modified: trunk/reactos/apps/utils/sdkparse/test.h
--- trunk/reactos/apps/utils/sdkparse/test.h 2005-06-21 02:58:22 UTC
(rev 16202)
+++ trunk/reactos/apps/utils/sdkparse/test.h 2005-06-21 04:10:45 UTC
(rev 16203)
@@ -89,7 +89,7 @@
typedef NTSTATUS NTAPI (*PPROCMOD_ENUM_ROUTINE)
(
IN HANDLE ProcessHandle,
- IN PLDR_MODULE CurrentModule,
+ IN PLDR_DATA_TABLE_ENTRY CurrentModule,
IN OUT PVOID CallbackContext
);
_____
Modified: trunk/reactos/include/epsapi.h
--- trunk/reactos/include/epsapi.h 2005-06-21 02:58:22 UTC (rev
16202)
+++ trunk/reactos/include/epsapi.h 2005-06-21 04:10:45 UTC (rev
16203)
@@ -25,11 +25,9 @@
#ifndef __EPSAPI_H_INCLUDED__
#define __EPSAPI_H_INCLUDED__
-/* INCLUDES */
-#include <ntdll/ldr.h> /* FIXME: USE LDR_DATA_TABLE_ENTRY */
+/* Remove soon */
+#include <ntdll/ldr.h>
-/* OBJECTS */
-
/* TYPES */
typedef NTSTATUS (NTAPI *PPROC_ENUM_ROUTINE)(IN
PSYSTEM_PROCESS_INFORMATION CurrentProcess,
IN OUT PVOID
CallbackContext);
@@ -41,7 +39,7 @@
IN OUT PVOID
CallbackContext);
typedef NTSTATUS (NTAPI *PPROCMOD_ENUM_ROUTINE)(IN HANDLE
ProcessHandle,
- IN PLDR_MODULE
CurrentModule,
+ IN
PLDR_DATA_TABLE_ENTRY CurrentModule,
IN OUT PVOID
CallbackContext);
/* CONSTANTS */
_____
Modified: trunk/reactos/include/napi/types.h
--- trunk/reactos/include/napi/types.h 2005-06-21 02:58:22 UTC (rev
16202)
+++ trunk/reactos/include/napi/types.h 2005-06-21 04:10:45 UTC (rev
16203)
@@ -6,7 +6,7 @@
/*
* General type for status information
*/
-
+#ifndef __USE_W32API
typedef enum _NT_PRODUCT_TYPE
{
NtProductWinNt = 1,
_____
Modified: trunk/reactos/include/ndk/ldrtypes.h
--- trunk/reactos/include/ndk/ldrtypes.h 2005-06-21 02:58:22 UTC
(rev 16202)
+++ trunk/reactos/include/ndk/ldrtypes.h 2005-06-21 04:10:45 UTC
(rev 16203)
@@ -43,6 +43,7 @@
PVOID EntryInProgress;
} PEB_LDR_DATA, *PPEB_LDR_DATA;
+#if 0
typedef struct _LDR_DATA_TABLE_ENTRY
{
LIST_ENTRY InLoadOrderModuleList;
@@ -63,6 +64,7 @@
PVOID LoadedImports;
PVOID EntryPointActivationContext;
} LDR_DATA_TABLE_ENTRY, *PLDR_DATA_TABLE_ENTRY;
+#endif
typedef struct _LDR_RESOURCE_INFO
{
_____
Modified: trunk/reactos/include/ntdll/ldr.h
--- trunk/reactos/include/ntdll/ldr.h 2005-06-21 02:58:22 UTC (rev
16202)
+++ trunk/reactos/include/ntdll/ldr.h 2005-06-21 04:10:45 UTC (rev
16203)
@@ -54,29 +54,32 @@
#define PROCESS_ATTACH_CALLED 0x00080000
#define IMAGE_NOT_AT_BASE 0x00200000
-typedef struct _LDR_MODULE
+typedef struct _LDR_DATA_TABLE_ENTRY
{
- LIST_ENTRY InLoadOrderModuleList;
- LIST_ENTRY InMemoryOrderModuleList; /* not used */
- LIST_ENTRY InInitializationOrderModuleList; /* not used */
- PVOID BaseAddress;
- ULONG EntryPoint;
- ULONG ResidentSize;
- UNICODE_STRING FullDllName;
- UNICODE_STRING BaseDllName;
- ULONG Flags;
- SHORT LoadCount;
- SHORT TlsIndex;
- HANDLE SectionHandle;
- ULONG CheckSum;
- ULONG TimeDateStamp;
+ LIST_ENTRY InLoadOrderModuleList;
+ LIST_ENTRY InMemoryOrderModuleList;
+ LIST_ENTRY InInitializationOrderModuleList;
+ PVOID DllBase;
+ PVOID EntryPoint;
+ ULONG SizeOfImage;
+ UNICODE_STRING FullDllName;
+ UNICODE_STRING BaseDllName;
+ ULONG Flags;
+ SHORT LoadCount; /* FIXME: HACK!!! FIX ASAP */
+ SHORT TlsIndex; /* FIXME: HACK!!! FIX ASAP */
+ LIST_ENTRY HashLinks;
+ PVOID SectionPointer;
+ ULONG CheckSum;
+ ULONG TimeDateStamp;
+ PVOID LoadedImports;
+ PVOID EntryPointActivationContext;
#if defined(DBG) || defined(KDBG)
- PROSSYM_INFO RosSymInfo;
+ PROSSYM_INFO RosSymInfo; /* FIXME: THIS _REALLY_ NEEDS TO GO
(TLS?)!!! */
#endif /* KDBG */
-} LDR_MODULE, *PLDR_MODULE;
+} LDR_DATA_TABLE_ENTRY, *PLDR_DATA_TABLE_ENTRY;
typedef struct _LDR_SYMBOL_INFO {
- PLDR_MODULE ModuleObject;
+ PLDR_DATA_TABLE_ENTRY ModuleObject;
ULONG_PTR ImageBase;
PVOID SymbolsBuffer;
ULONG SymbolsBufferLength;
@@ -90,7 +93,7 @@
#if defined(KDBG) || defined(DBG)
VOID
-LdrpLoadUserModuleSymbols(PLDR_MODULE LdrModule);
+LdrpLoadUserModuleSymbols(PLDR_DATA_TABLE_ENTRY LdrModule);
#endif
@@ -99,7 +102,7 @@
PEPFUNC LdrPEStartup (PVOID ImageBase,
HANDLE SectionHandle,
- PLDR_MODULE* Module,
+ PLDR_DATA_TABLE_ENTRY* Module,
PWSTR FullDosName);
NTSTATUS LdrMapSections(HANDLE ProcessHandle,
PVOID ImageBase,
@@ -120,7 +123,7 @@
NTSTATUS STDCALL
LdrFindEntryForAddress(IN PVOID Address,
- OUT PLDR_MODULE *Module);
+ OUT PLDR_DATA_TABLE_ENTRY *Module);
NTSTATUS STDCALL
LdrGetProcedureAddress(IN PVOID BaseAddress,
_____
Modified: trunk/reactos/lib/epsapi/enum/modules.c
--- trunk/reactos/lib/epsapi/enum/modules.c 2005-06-21 02:58:22 UTC
(rev 16202)
+++ trunk/reactos/lib/epsapi/enum/modules.c 2005-06-21 04:10:45 UTC
(rev 16203)
@@ -49,7 +49,7 @@
while(Current != ListHead)
{
- PLDR_MODULE LoaderModule = CONTAINING_RECORD(Current,
LDR_MODULE, InLoadOrderModuleList);
+ PLDR_DATA_TABLE_ENTRY LoaderModule = CONTAINING_RECORD(Current,
LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
/* return the current module to the callback */
Status = Callback(ProcessHandle, LoaderModule,
CallbackContext);
@@ -73,7 +73,7 @@
{
PROCESS_BASIC_INFORMATION BasicInformation;
PPEB_LDR_DATA LoaderData;
- LDR_MODULE LoaderModule;
+ LDR_DATA_TABLE_ENTRY LoaderModule;
PLIST_ENTRY ListHead, Current;
/* query the process basic information (includes the PEB address)
*/
@@ -116,7 +116,7 @@
{
/* read the current module */
Status = NtReadVirtualMemory(ProcessHandle,
- CONTAINING_RECORD(Current,
LDR_MODULE, InLoadOrderModuleList),
+ CONTAINING_RECORD(Current,
LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList),
&LoaderModule,
sizeof(LoaderModule),
NULL);
_____
Modified: trunk/reactos/lib/kernel32/misc/ldr.c
--- trunk/reactos/lib/kernel32/misc/ldr.c 2005-06-21 02:58:22 UTC
(rev 16202)
+++ trunk/reactos/lib/kernel32/misc/ldr.c 2005-06-21 04:10:45 UTC
(rev 16203)
@@ -268,7 +268,7 @@
ANSI_STRING FileName;
PLIST_ENTRY ModuleListHead;
PLIST_ENTRY Entry;
- PLDR_MODULE Module;
+ PLDR_DATA_TABLE_ENTRY Module;
PPEB Peb;
ULONG Length = 0;
@@ -283,8 +283,8 @@
while (Entry != ModuleListHead)
{
- Module = CONTAINING_RECORD(Entry, LDR_MODULE,
InLoadOrderModuleList);
- if (Module->BaseAddress == (PVOID)hModule)
+ Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY,
InLoadOrderModuleList);
+ if (Module->DllBase == (PVOID)hModule)
{
if (nSize * sizeof(WCHAR) <
Module->FullDllName.Length)
{
@@ -336,7 +336,7 @@
UNICODE_STRING FileName;
PLIST_ENTRY ModuleListHead;
PLIST_ENTRY Entry;
- PLDR_MODULE Module;
+ PLDR_DATA_TABLE_ENTRY Module;
PPEB Peb;
ULONG Length = 0;
@@ -350,9 +350,9 @@
Entry = ModuleListHead->Flink;
while (Entry != ModuleListHead)
{
- Module = CONTAINING_RECORD(Entry, LDR_MODULE,
InLoadOrderModuleList);
+ Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY,
InLoadOrderModuleList);
- if (Module->BaseAddress == (PVOID)hModule)
+ if (Module->DllBase == (PVOID)hModule)
{
if (nSize * sizeof(WCHAR) <
Module->FullDllName.Length)
{
_____
Modified: trunk/reactos/lib/ntdll/inc/ntdllp.h
--- trunk/reactos/lib/ntdll/inc/ntdllp.h 2005-06-21 02:58:22 UTC
(rev 16202)
+++ trunk/reactos/lib/ntdll/inc/ntdllp.h 2005-06-21 04:10:45 UTC
(rev 16203)
@@ -21,7 +21,7 @@
LdrpGetResidentSize(PIMAGE_NT_HEADERS NTHeaders);
PEPFUNC LdrPEStartup (PVOID ImageBase,
HANDLE SectionHandle,
- PLDR_MODULE* Module,
+ PLDR_DATA_TABLE_ENTRY* Module,
PWSTR FullDosName);
#if 0
typedef BOOL
@@ -36,7 +36,7 @@
);
#if defined(KDBG) || defined(DBG)
VOID
-LdrpLoadUserModuleSymbols(PLDR_MODULE LdrModule);
+LdrpLoadUserModuleSymbols(PLDR_DATA_TABLE_ENTRY LdrModule);
#endif
extern HANDLE WindowsApiPort;
_____
Modified: trunk/reactos/lib/ntdll/ldr/startup.c
--- trunk/reactos/lib/ntdll/ldr/startup.c 2005-06-21 02:58:22 UTC
(rev 16202)
+++ trunk/reactos/lib/ntdll/ldr/startup.c 2005-06-21 04:10:45 UTC
(rev 16203)
@@ -26,7 +26,7 @@
static RTL_CRITICAL_SECTION PebLock;
static RTL_CRITICAL_SECTION LoaderLock;
static RTL_BITMAP TlsBitMap;
-PLDR_MODULE ExeModule;
+PLDR_DATA_TABLE_ENTRY ExeModule;
NTSTATUS LdrpAttachThread (VOID);
@@ -225,7 +225,7 @@
PIMAGE_DOS_HEADER PEDosHeader;
PVOID ImageBase;
PPEB Peb;
- PLDR_MODULE NtModule; // ntdll
+ PLDR_DATA_TABLE_ENTRY NtModule; // ntdll
NLSTABLEINFO NlsTable;
WCHAR FullNtDllPath[MAX_PATH];
SYSTEM_BASIC_INFORMATION SystemInformation;
@@ -350,17 +350,17 @@
wcscat (FullNtDllPath, L"\\system32\\ntdll.dll");
/* add entry for ntdll */
- NtModule = (PLDR_MODULE)RtlAllocateHeap (Peb->ProcessHeap,
+ NtModule = (PLDR_DATA_TABLE_ENTRY)RtlAllocateHeap
(Peb->ProcessHeap,
0,
- sizeof(LDR_MODULE));
+
sizeof(LDR_DATA_TABLE_ENTRY));
if (NtModule == NULL)
{
DPRINT1("Failed to create loader module entry (NTDLL)\n");
ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL);
}
- memset(NtModule, 0, sizeof(LDR_MODULE));
+ memset(NtModule, 0, sizeof(LDR_DATA_TABLE_ENTRY));
- NtModule->BaseAddress = (PVOID)&_image_base__;
+ NtModule->DllBase = (PVOID)&_image_base__;
NtModule->EntryPoint = 0; /* no entry point */
RtlCreateUnicodeString (&NtModule->FullDllName,
FullNtDllPath);
@@ -370,11 +370,11 @@
NtModule->LoadCount = -1; /* don't unload */
NtModule->TlsIndex = -1;
- NtModule->SectionHandle = NULL;
+ NtModule->SectionPointer = NULL;
NtModule->CheckSum = 0;
- NTHeaders = RtlImageNtHeader (NtModule->BaseAddress);
- NtModule->ResidentSize = LdrpGetResidentSize(NTHeaders);
+ NTHeaders = RtlImageNtHeader (NtModule->DllBase);
+ NtModule->SizeOfImage = LdrpGetResidentSize(NTHeaders);
NtModule->TimeDateStamp = NTHeaders->FileHeader.TimeDateStamp;
InsertTailList(&Peb->Ldr->InLoadOrderModuleList,
@@ -389,15 +389,15 @@
#endif /* DBG || KDBG */
/* add entry for executable (becomes first list entry) */
- ExeModule = (PLDR_MODULE)RtlAllocateHeap (Peb->ProcessHeap,
+ ExeModule = (PLDR_DATA_TABLE_ENTRY)RtlAllocateHeap
(Peb->ProcessHeap,
0,
- sizeof(LDR_MODULE));
+
sizeof(LDR_DATA_TABLE_ENTRY));
if (ExeModule == NULL)
{
DPRINT1("Failed to create loader module infomation\n");
ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL);
}
- ExeModule->BaseAddress = Peb->ImageBaseAddress;
+ ExeModule->DllBase = Peb->ImageBaseAddress;
if ((Peb->ProcessParameters == NULL) ||
(Peb->ProcessParameters->ImagePathName.Length == 0))
@@ -418,11 +418,11 @@
ExeModule->Flags = ENTRY_PROCESSED;
ExeModule->LoadCount = -1; /* don't unload */
ExeModule->TlsIndex = -1;
- ExeModule->SectionHandle = NULL;
+ ExeModule->SectionPointer = NULL;
ExeModule->CheckSum = 0;
- NTHeaders = RtlImageNtHeader (ExeModule->BaseAddress);
- ExeModule->ResidentSize = LdrpGetResidentSize(NTHeaders);
+ NTHeaders = RtlImageNtHeader (ExeModule->DllBase);
+ ExeModule->SizeOfImage = LdrpGetResidentSize(NTHeaders);
ExeModule->TimeDateStamp = NTHeaders->FileHeader.TimeDateStamp;
InsertHeadList(&Peb->Ldr->InLoadOrderModuleList,
@@ -437,7 +437,7 @@
#endif /* DBG || KDBG */
EntryPoint = LdrPEStartup((PVOID)ImageBase, NULL, NULL, NULL);
- ExeModule->EntryPoint = (ULONG)EntryPoint;
+ ExeModule->EntryPoint = EntryPoint;
/* all required dlls are loaded now */
Peb->Ldr->Initialized = TRUE;
_____
Modified: trunk/reactos/lib/ntdll/ldr/utils.c
--- trunk/reactos/lib/ntdll/ldr/utils.c 2005-06-21 02:58:22 UTC (rev
16202)
+++ trunk/reactos/lib/ntdll/ldr/utils.c 2005-06-21 04:10:45 UTC (rev
16203)
@@ -42,7 +42,7 @@
DWORD TlsDataSize;
DWORD TlsZeroSize;
PIMAGE_TLS_CALLBACK TlsAddressOfCallBacks;
- PLDR_MODULE Module;
+ PLDR_DATA_TABLE_ENTRY Module;
} TLS_DATA, *PTLS_DATA;
static PTLS_DATA LdrpTlsArray = NULL;
@@ -50,18 +50,18 @@
static ULONG LdrpTlsSize = 0;
static HANDLE LdrpKnownDllsDirHandle = NULL;
static UNICODE_STRING LdrpKnownDllPath = {0, 0, NULL};
-static PLDR_MODULE LdrpLastModule = NULL;
-extern PLDR_MODULE ExeModule;
+static PLDR_DATA_TABLE_ENTRY LdrpLastModule = NULL;
+extern PLDR_DATA_TABLE_ENTRY ExeModule;
/* PROTOTYPES
****************************************************************/
-static NTSTATUS LdrFindEntryForName(PUNICODE_STRING Name, PLDR_MODULE
*Module, BOOLEAN Ref);
+static NTSTATUS LdrFindEntryForName(PUNICODE_STRING Name,
PLDR_DATA_TABLE_ENTRY *Module, BOOLEAN Ref);
static PVOID LdrFixupForward(PCHAR ForwardName);
static PVOID LdrGetExportByName(PVOID BaseAddress, PUCHAR SymbolName,
USHORT Hint);
static NTSTATUS LdrpLoadModule(IN PWSTR SearchPath OPTIONAL,
IN ULONG LoadFlags,
IN PUNICODE_STRING Name,
- OUT PLDR_MODULE *Module,
+ OUT PLDR_DATA_TABLE_ENTRY *Module,
OUT PVOID *BaseAddress OPTIONAL);
static NTSTATUS LdrpAttachProcess(VOID);
static VOID LdrpDetachProcess(BOOLEAN UnloadAll);
@@ -71,7 +71,7 @@
#if defined(DBG) || defined(KDBG)
VOID
-LdrpLoadUserModuleSymbols(PLDR_MODULE LdrModule)
+LdrpLoadUserModuleSymbols(PLDR_DATA_TABLE_ENTRY LdrModule)
{
NtSystemDebugControl(
DebugDbgLoadSymbols,
@@ -96,7 +96,7 @@
return FALSE;
}
-static inline LONG LdrpDecrementLoadCount(PLDR_MODULE Module, BOOLEAN
Locked)
+static inline LONG LdrpDecrementLoadCount(PLDR_DATA_TABLE_ENTRY Module,
BOOLEAN Locked)
{
LONG LoadCount;
if (!Locked)
@@ -115,7 +115,7 @@
return LoadCount;
}
-static inline LONG LdrpIncrementLoadCount(PLDR_MODULE Module, BOOLEAN
Locked)
+static inline LONG LdrpIncrementLoadCount(PLDR_DATA_TABLE_ENTRY Module,
BOOLEAN Locked)
{
LONG LoadCount;
if (!Locked)
@@ -134,7 +134,7 @@
return LoadCount;
}
-static inline VOID LdrpAcquireTlsSlot(PLDR_MODULE Module, ULONG Size,
BOOLEAN Locked)
+static inline VOID LdrpAcquireTlsSlot(PLDR_DATA_TABLE_ENTRY Module,
ULONG Size, BOOLEAN Locked)
{
if (!Locked)
{
@@ -149,7 +149,7 @@
}
}
-static inline VOID LdrpTlsCallback(PLDR_MODULE Module, ULONG dwReason)
+static inline VOID LdrpTlsCallback(PLDR_DATA_TABLE_ENTRY Module, ULONG
dwReason)
{
PIMAGE_TLS_CALLBACK TlsCallback;
if (Module->TlsIndex >= 0 && Module->LoadCount == -1)
@@ -161,14 +161,14 @@
{
TRACE_LDR("%wZ - Calling tls callback at %x\n",
&Module->BaseDllName, TlsCallback);
- TlsCallback(Module->BaseAddress, dwReason, NULL);
+ TlsCallback(Module->DllBase, dwReason, NULL);
TlsCallback++;
}
}
}
}
-static BOOLEAN LdrpCallDllEntry(PLDR_MODULE Module, DWORD dwReason,
PVOID lpReserved)
+static BOOLEAN LdrpCallDllEntry(PLDR_DATA_TABLE_ENTRY Module, DWORD
dwReason, PVOID lpReserved)
{
if (!(Module->Flags & IMAGE_DLL) ||
Module->EntryPoint == 0)
@@ -176,7 +176,7 @@
return TRUE;
}
LdrpTlsCallback(Module, dwReason);
- return ((PDLLMAIN_FUNC)Module->EntryPoint)(Module->BaseAddress,
dwReason, lpReserved);
+ return ((PDLLMAIN_FUNC)Module->EntryPoint)(Module->DllBase,
dwReason, lpReserved);
}
static NTSTATUS
@@ -234,7 +234,7 @@
{
PLIST_ENTRY ModuleListHead;
PLIST_ENTRY Entry;
- PLDR_MODULE Module;
+ PLDR_DATA_TABLE_ENTRY Module;
PIMAGE_TLS_DIRECTORY TlsDirectory;
PTLS_DATA TlsData;
@@ -255,12 +255,12 @@
Entry = ModuleListHead->Flink;
while (Entry != ModuleListHead)
{
- Module = CONTAINING_RECORD(Entry, LDR_MODULE,
InLoadOrderModuleList);
+ Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY,
InLoadOrderModuleList);
if (Module->LoadCount == -1 &&
Module->TlsIndex >= 0)
{
TlsDirectory = (PIMAGE_TLS_DIRECTORY)
-
RtlImageDirectoryEntryToData(Module->BaseAddress,
+
RtlImageDirectoryEntryToData(Module->DllBase,
TRUE,
IMAGE_DIRECTORY_ENTRY_TLS,
NULL);
@@ -458,21 +458,21 @@
RtlCreateUnicodeString(FullDllName, Buffer);
}
-PLDR_MODULE
+PLDR_DATA_TABLE_ENTRY
LdrAddModuleEntry(PVOID ImageBase,
PIMAGE_NT_HEADERS NTHeaders,
PWSTR FullDosName)
{
- PLDR_MODULE Module;
+ PLDR_DATA_TABLE_ENTRY Module;
- Module = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof
(LDR_MODULE));
+ Module = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof
(LDR_DATA_TABLE_ENTRY));
ASSERT(Module);
- memset(Module, 0, sizeof(LDR_MODULE));
- Module->BaseAddress = (PVOID)ImageBase;
- Module->EntryPoint = NTHeaders->OptionalHeader.AddressOfEntryPoint;
+ memset(Module, 0, sizeof(LDR_DATA_TABLE_ENTRY));
+ Module->DllBase = (PVOID)ImageBase;
+ Module->EntryPoint =
(PVOID)NTHeaders->OptionalHeader.AddressOfEntryPoint;
if (Module->EntryPoint != 0)
- Module->EntryPoint += (ULONG)Module->BaseAddress;
- Module->ResidentSize = LdrpGetResidentSize(NTHeaders);
+ Module->EntryPoint += (ULONG)Module->DllBase;
+ Module->SizeOfImage = LdrpGetResidentSize(NTHeaders);
if (NtCurrentPeb()->Ldr->Initialized == TRUE)
{
/* loading while app is running */
@@ -728,7 +728,7 @@
OUT PVOID *BaseAddress OPTIONAL)
{
NTSTATUS Status;
- PLDR_MODULE Module;
+ PLDR_DATA_TABLE_ENTRY Module;
TRACE_LDR("LdrLoadDll, loading %wZ%s%S\n",
Name,
@@ -751,7 +751,7 @@
RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock);
if (NT_SUCCESS(Status))
{
- *BaseAddress = Module->BaseAddress;
+ *BaseAddress = Module->DllBase;
}
}
return Status;
@@ -776,11 +776,11 @@
*/
NTSTATUS STDCALL
LdrFindEntryForAddress(PVOID Address,
- PLDR_MODULE *Module)
+ PLDR_DATA_TABLE_ENTRY *Module)
{
PLIST_ENTRY ModuleListHead;
PLIST_ENTRY Entry;
- PLDR_MODULE ModulePtr;
+ PLDR_DATA_TABLE_ENTRY ModulePtr;
DPRINT("LdrFindEntryForAddress(Address %p)\n", Address);
@@ -798,12 +798,12 @@
while (Entry != ModuleListHead)
{
- ModulePtr = CONTAINING_RECORD(Entry, LDR_MODULE,
InLoadOrderModuleList);
+ ModulePtr = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY,
InLoadOrderModuleList);
- DPRINT("Scanning %wZ at %p\n", &ModulePtr->BaseDllName,
ModulePtr->BaseAddress);
+ DPRINT("Scanning %wZ at %p\n", &ModulePtr->BaseDllName,
ModulePtr->DllBase);
- if ((Address >= ModulePtr->BaseAddress) &&
- (Address <= (ModulePtr->BaseAddress +
ModulePtr->ResidentSize)))
+ if ((Address >= ModulePtr->DllBase) &&
+ (Address <= (ModulePtr->DllBase + ModulePtr->SizeOfImage)))
{
*Module = ModulePtr;
RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock);
@@ -837,12 +837,12 @@
*/
static NTSTATUS
LdrFindEntryForName(PUNICODE_STRING Name,
- PLDR_MODULE *Module,
+ PLDR_DATA_TABLE_ENTRY *Module,
BOOLEAN Ref)
{
PLIST_ENTRY ModuleListHead;
PLIST_ENTRY Entry;
- PLDR_MODULE ModulePtr;
+ PLDR_DATA_TABLE_ENTRY ModulePtr;
BOOLEAN ContainsPath;
UNICODE_STRING AdjustedName;
unsigned i;
@@ -897,7 +897,7 @@
}
while (Entry != ModuleListHead)
{
- ModulePtr = CONTAINING_RECORD(Entry, LDR_MODULE,
InLoadOrderModuleList);
+ ModulePtr = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY,
InLoadOrderModuleList);
DPRINT("Scanning %wZ %wZ\n", &ModulePtr->BaseDllName,
&AdjustedName);
@@ -947,7 +947,7 @@
UNICODE_STRING DllName;
NTSTATUS Status;
PCHAR p;
- PLDR_MODULE Module;
+ PLDR_DATA_TABLE_ENTRY Module;
PVOID BaseAddress;
strcpy(NameBuffer, ForwardName);
@@ -982,9 +982,9 @@
return NULL;
}
- DPRINT("BaseAddress: %p\n", Module->BaseAddress);
+ DPRINT("BaseAddress: %p\n", Module->DllBase);
- return LdrGetExportByName(Module->BaseAddress, (PUCHAR)(p+1),
-1);
+ return LdrGetExportByName(Module->DllBase, (PUCHAR)(p+1), -1);
}
return NULL;
@@ -1341,7 +1341,7 @@
static NTSTATUS
LdrpGetOrLoadModule(PWCHAR SerachPath,
PCHAR Name,
- PLDR_MODULE* Module,
+ PLDR_DATA_TABLE_ENTRY* Module,
BOOLEAN Load)
{
UNICODE_STRING DllName;
@@ -1373,8 +1373,8 @@
}
static NTSTATUS
-LdrpProcessImportDirectoryEntry(PLDR_MODULE Module,
- PLDR_MODULE ImportedModule,
+LdrpProcessImportDirectoryEntry(PLDR_DATA_TABLE_ENTRY Module,
+ PLDR_DATA_TABLE_ENTRY ImportedModule,
PIMAGE_IMPORT_DESCRIPTOR
ImportModuleDirectory)
{
NTSTATUS Status;
@@ -1391,16 +1391,16 @@
}
/* Get the import address list. */
- ImportAddressList = (PVOID *)(Module->BaseAddress +
(ULONG_PTR)ImportModuleDirectory->FirstThunk);
+ ImportAddressList = (PVOID *)(Module->DllBase +
(ULONG_PTR)ImportModuleDirectory->FirstThunk);
/* Get the list of functions to import. */
if (ImportModuleDirectory->OriginalFirstThunk != 0)
{
- FunctionNameList = (PULONG) (Module->BaseAddress +
(ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk);
+ FunctionNameList = (PULONG) (Module->DllBase +
(ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk);
}
else
{
- FunctionNameList = (PULONG)(Module->BaseAddress +
(ULONG_PTR)ImportModuleDirectory->FirstThunk);
+ FunctionNameList = (PULONG)(Module->DllBase +
(ULONG_PTR)ImportModuleDirectory->FirstThunk);
}
/* Get the size of IAT. */
@@ -1430,7 +1430,7 @@
if ((*FunctionNameList) & 0x80000000)
{
Ordinal = (*FunctionNameList) & 0x7fffffff;
- *ImportAddressList =
LdrGetExportByOrdinal(ImportedModule->BaseAddress, Ordinal);
+ *ImportAddressList =
LdrGetExportByOrdinal(ImportedModule->DllBase, Ordinal);
if ((*ImportAddressList) == NULL)
{
DPRINT1("Failed to import #%ld from %wZ\n", Ordinal,
&ImportedModule->FullDllName);
@@ -1440,8 +1440,8 @@
else
{
IMAGE_IMPORT_BY_NAME *pe_name;
- pe_name = RVA(Module->BaseAddress, *FunctionNameList);
- *ImportAddressList =
LdrGetExportByName(ImportedModule->BaseAddress, pe_name->Name,
pe_name->Hint);
+ pe_name = RVA(Module->DllBase, *FunctionNameList);
+ *ImportAddressList =
LdrGetExportByName(ImportedModule->DllBase, pe_name->Name,
pe_name->Hint);
if ((*ImportAddressList) == NULL)
{
DPRINT1("Failed to import %s from %wZ\n", pe_name->Name,
&ImportedModule->FullDllName);
@@ -1469,8 +1469,8 @@
static NTSTATUS
LdrpProcessImportDirectory(
- PLDR_MODULE Module,
- PLDR_MODULE ImportedModule,
+ PLDR_DATA_TABLE_ENTRY Module,
+ PLDR_DATA_TABLE_ENTRY ImportedModule,
PCHAR ImportedName)
{
NTSTATUS Status;
@@ -1482,7 +1482,7 @@
ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR)
-
RtlImageDirectoryEntryToData(Module->BaseAddress,
+
RtlImageDirectoryEntryToData(Module->DllBase,
TRUE,
IMAGE_DIRECTORY_ENTRY_IMPORT,
NULL);
@@ -1493,7 +1493,7 @@
while (ImportModuleDirectory->Name)
{
- Name = (PCHAR)Module->BaseAddress + ImportModuleDirectory->Name;
+ Name = (PCHAR)Module->DllBase + ImportModuleDirectory->Name;
if (0 == _stricmp(Name, ImportedName))
{
Status = LdrpProcessImportDirectoryEntry(Module,
@@ -1513,8 +1513,8 @@
static NTSTATUS
-LdrpAdjustImportDirectory(PLDR_MODULE Module,
- PLDR_MODULE ImportedModule,
+LdrpAdjustImportDirectory(PLDR_DATA_TABLE_ENTRY Module,
+ PLDR_DATA_TABLE_ENTRY ImportedModule,
PCHAR ImportedName)
{
PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory;
@@ -1534,7 +1534,7 @@
Module, &Module->BaseDllName, ImportedModule,
&ImportedModule->BaseDllName, ImportedName);
ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR)
-
RtlImageDirectoryEntryToData(Module->BaseAddress,
+
RtlImageDirectoryEntryToData(Module->DllBase,
TRUE,
IMAGE_DIRECTORY_ENTRY_IMPORT,
NULL);
@@ -1545,21 +1545,21 @@
while (ImportModuleDirectory->Name)
{
- Name = (PCHAR)Module->BaseAddress + ImportModuleDirectory->Name;
+ Name = (PCHAR)Module->DllBase + ImportModuleDirectory->Name;
if (0 == _stricmp(Name, (PCHAR)ImportedName))
{
/* Get the import address list. */
- ImportAddressList = (PVOID *)(Module->BaseAddress +
(ULONG_PTR)ImportModuleDirectory->FirstThunk);
+ ImportAddressList = (PVOID *)(Module->DllBase +
(ULONG_PTR)ImportModuleDirectory->FirstThunk);
/* Get the list of functions to import. */
if (ImportModuleDirectory->OriginalFirstThunk != 0)
{
- FunctionNameList = (PULONG) (Module->BaseAddress +
(ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk);
+ FunctionNameList = (PULONG) (Module->DllBase +
(ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk);
}
else
{
- FunctionNameList = (PULONG)(Module->BaseAddress +
(ULONG_PTR)ImportModuleDirectory->FirstThunk);
+ FunctionNameList = (PULONG)(Module->DllBase +
(ULONG_PTR)ImportModuleDirectory->FirstThunk);
}
/* Get the size of IAT. */
@@ -1583,10 +1583,10 @@
return(Status);
}
- NTHeaders = RtlImageNtHeader (ImportedModule->BaseAddress);
+ NTHeaders = RtlImageNtHeader (ImportedModule->DllBase);
Start = (PVOID)NTHeaders->OptionalHeader.ImageBase;
- End = Start + ImportedModule->ResidentSize;
- Offset = ImportedModule->BaseAddress - Start;
+ End = Start + ImportedModule->SizeOfImage;
+ Offset = ImportedModule->DllBase - Start;
/* Walk through function list and fixup addresses. */
while (*FunctionNameList != 0L)
@@ -1636,7 +1636,7 @@
*/
static NTSTATUS
LdrFixupImports(IN PWSTR SearchPath OPTIONAL,
- IN PLDR_MODULE Module)
+ IN PLDR_DATA_TABLE_ENTRY Module)
{
PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory;
PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectoryCurrent;
@@ -1645,14 +1645,14 @@
PIMAGE_TLS_DIRECTORY TlsDirectory;
ULONG TlsSize = 0;
NTSTATUS Status;
- PLDR_MODULE ImportedModule;
+ PLDR_DATA_TABLE_ENTRY ImportedModule;
PCHAR ImportedName;
DPRINT("LdrFixupImports(SearchPath %x, Module %x)\n", SearchPath,
Module);
/* Check for tls data */
TlsDirectory = (PIMAGE_TLS_DIRECTORY)
- RtlImageDirectoryEntryToData(Module->BaseAddress,
+ RtlImageDirectoryEntryToData(Module->DllBase,
TRUE,
IMAGE_DIRECTORY_ENTRY_TLS,
NULL);
@@ -1673,13 +1673,13 @@
* Process each import module.
*/
ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR)
-
RtlImageDirectoryEntryToData(Module->BaseAddress,
+
RtlImageDirectoryEntryToData(Module->DllBase,
TRUE,
IMAGE_DIRECTORY_ENTRY_IMPORT,
NULL);
BoundImportDescriptor = (PIMAGE_BOUND_IMPORT_DESCRIPTOR)
-
RtlImageDirectoryEntryToData(Module->BaseAddress,
+
RtlImageDirectoryEntryToData(Module->DllBase,
TRUE,
IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT,
NULL);
@@ -1737,7 +1737,7 @@
{
PIMAGE_BOUND_FORWARDER_REF BoundForwarderRef;
ULONG i;
- PLDR_MODULE ForwarderModule;
+ PLDR_DATA_TABLE_ENTRY ForwarderModule;
PCHAR ForwarderName;
BoundForwarderRef =
(PIMAGE_BOUND_FORWARDER_REF)(BoundImportDescriptorCurrent + 1);
@@ -1821,7 +1821,7 @@
ImportModuleDirectoryCurrent = ImportModuleDirectory;
while (ImportModuleDirectoryCurrent->Name)
{
- ImportedName = (PCHAR)Module->BaseAddress +
ImportModuleDirectoryCurrent->Name;
+ ImportedName = (PCHAR)Module->DllBase +
ImportModuleDirectoryCurrent->Name;
TRACE_LDR("%wZ imports functions from %s\n",
&Module->BaseDllName, ImportedName);
Status = LdrpGetOrLoadModule(SearchPath, ImportedName,
&ImportedModule, TRUE);
@@ -1886,14 +1886,14 @@
*/
PEPFUNC LdrPEStartup (PVOID ImageBase,
HANDLE SectionHandle,
- PLDR_MODULE* Module,
+ PLDR_DATA_TABLE_ENTRY* Module,
PWSTR FullDosName)
{
NTSTATUS Status;
PEPFUNC EntryPoint = NULL;
PIMAGE_DOS_HEADER DosHeader;
PIMAGE_NT_HEADERS NTHeaders;
- PLDR_MODULE tmpModule;
+ PLDR_DATA_TABLE_ENTRY tmpModule;
DPRINT("LdrPEStartup(ImageBase %x SectionHandle %x)\n",
ImageBase, (ULONG)SectionHandle);
@@ -1924,7 +1924,7 @@
if (Module != NULL)
{
*Module = LdrAddModuleEntry(ImageBase, NTHeaders, FullDosName);
- (*Module)->SectionHandle = SectionHandle;
+ (*Module)->SectionPointer = SectionHandle;
}
else
{
@@ -1989,13 +1989,13 @@
LdrpLoadModule(IN PWSTR SearchPath OPTIONAL,
IN ULONG LoadFlags,
IN PUNICODE_STRING Name,
- PLDR_MODULE *Module,
+ PLDR_DATA_TABLE_ENTRY *Module,
PVOID *BaseAddress OPTIONAL)
{
UNICODE_STRING AdjustedName;
UNICODE_STRING FullDosName;
NTSTATUS Status;
- PLDR_MODULE tmpModule;
+ PLDR_DATA_TABLE_ENTRY tmpModule;
HANDLE SectionHandle;
ULONG ViewSize;
PVOID ImageBase;
@@ -2019,7 +2019,7 @@
RtlFreeUnicodeString(&AdjustedName);
if (NULL != BaseAddress)
{
- *BaseAddress = (*Module)->BaseAddress;
+ *BaseAddress = (*Module)->DllBase;
}
}
else
@@ -2104,7 +2104,7 @@
}
}
*Module = LdrAddModuleEntry(ImageBase, NtHeaders,
FullDosName.Buffer);
- (*Module)->SectionHandle = SectionHandle;
+ (*Module)->SectionPointer = SectionHandle;
if (ImageBase != (PVOID) NtHeaders->OptionalHeader.ImageBase)
{
(*Module)->Flags |= IMAGE_NOT_AT_BASE;
@@ -2132,14 +2132,14 @@
}
static NTSTATUS
-LdrpUnloadModule(PLDR_MODULE Module,
+LdrpUnloadModule(PLDR_DATA_TABLE_ENTRY Module,
BOOLEAN Unload)
{
PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory;
PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptor;
PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptorCurrent;
PCHAR ImportedName;
- PLDR_MODULE ImportedModule;
+ PLDR_DATA_TABLE_ENTRY ImportedModule;
NTSTATUS Status;
LONG LoadCount;
@@ -2160,7 +2160,7 @@
else if (LoadCount == 1)
{
BoundImportDescriptor = (PIMAGE_BOUND_IMPORT_DESCRIPTOR)
-
RtlImageDirectoryEntryToData(Module->BaseAddress,
+
RtlImageDirectoryEntryToData(Module->DllBase,
TRUE,
IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT,
NULL);
@@ -2194,7 +2194,7 @@
else
{
ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR)
-
RtlImageDirectoryEntryToData(Module->BaseAddress,
+
RtlImageDirectoryEntryToData(Module->DllBase,
TRUE,
IMAGE_DIRECTORY_ENTRY_IMPORT,
NULL);
@@ -2203,7 +2203,7 @@
/* dereferencing all imported modules, use the import
descriptor */
while (ImportModuleDirectory->Name)
{
- ImportedName = (PCHAR)Module->BaseAddress +
ImportModuleDirectory->Name;
+ ImportedName = (PCHAR)Module->DllBase +
ImportModuleDirectory->Name;
TRACE_LDR("%wZ trys to unload %s\n",
&Module->BaseDllName, ImportedName);
Status = LdrpGetOrLoadModule(NULL, ImportedName,
&ImportedModule, FALSE);
if (!NT_SUCCESS(Status))
@@ -2242,7 +2242,7 @@
NTSTATUS STDCALL
LdrUnloadDll (IN PVOID BaseAddress)
{
- PLDR_MODULE Module;
+ PLDR_DATA_TABLE_ENTRY Module;
NTSTATUS Status;
if (BaseAddress == NULL)
@@ -2273,7 +2273,7 @@
{
PLIST_ENTRY ModuleListHead;
PLIST_ENTRY Entry;
- PLDR_MODULE Module;
+ PLDR_DATA_TABLE_ENTRY Module;
NTSTATUS Status;
DPRINT("LdrDisableThreadCalloutsForDll (BaseAddress %x)\n",
BaseAddress);
@@ -2284,11 +2284,11 @@
Entry = ModuleListHead->Flink;
while (Entry != ModuleListHead)
{
- Module = CONTAINING_RECORD(Entry, LDR_MODULE,
InLoadOrderModuleList);
+ Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY,
InLoadOrderModuleList);
- DPRINT("BaseDllName %wZ BaseAddress %x\n",
&Module->BaseDllName, Module->BaseAddress);
+ DPRINT("BaseDllName %wZ BaseAddress %x\n",
&Module->BaseDllName, Module->DllBase);
- if (Module->BaseAddress == BaseAddress)
+ if (Module->DllBase == BaseAddress)
{
if (Module->TlsIndex == -1)
{
@@ -2312,7 +2312,7 @@
IN PUNICODE_STRING DllName,
OUT PVOID* BaseAddress)
{
- PLDR_MODULE Module;
+ PLDR_DATA_TABLE_ENTRY Module;
NTSTATUS Status;
TRACE_LDR("LdrGetDllHandle, searching for %wZ from %S\n", DllName,
Path ? Path : L"");
@@ -2320,7 +2320,7 @@
/* NULL is the current executable */
if (DllName == NULL)
{
- *BaseAddress = ExeModule->BaseAddress;
+ *BaseAddress = ExeModule->DllBase;
DPRINT("BaseAddress %x\n", *BaseAddress);
return STATUS_SUCCESS;
}
@@ -2328,7 +2328,7 @@
Status = LdrFindEntryForName(DllName, &Module, FALSE);
if (NT_SUCCESS(Status))
{
[truncated at 1000 lines; 367 more skipped]