2005-06-21 02:11:45 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS System Libraries
|
2008-08-02 12:46:02 +00:00
|
|
|
* FILE: dll/ntdll/include/ntdllp.h
|
2015-08-29 01:56:11 +00:00
|
|
|
* PURPOSE: Native Library Internal Header
|
2005-06-21 02:11:45 +00:00
|
|
|
* PROGRAMMER: Alex Ionescu (alex@relsoft.net)
|
|
|
|
*/
|
|
|
|
|
2014-01-20 12:59:27 +00:00
|
|
|
#pragma once
|
2005-06-21 02:11:45 +00:00
|
|
|
|
2011-03-21 22:58:47 +00:00
|
|
|
#define LDR_HASH_TABLE_ENTRIES 32
|
2011-07-10 13:23:19 +00:00
|
|
|
#define LDR_GET_HASH_ENTRY(x) (RtlUpcaseUnicodeChar((x)) & (LDR_HASH_TABLE_ENTRIES - 1))
|
2011-03-14 22:06:25 +00:00
|
|
|
|
[NTDLL/LDR]
- The long awaited LDR rewrite, a commit for testing the new implementation. In case of serious problems it may be reverted (revert should be approved by me).
- Its features include:
* A proper ...everything. Process, thread initialization codes, DLL loading (including compatible path lookup, and compatible/proper loading order of the dependent DLLs, including their initialization) and mapping and section creation, reference counting, relocations, good and understandable PE code for walking import descriptor, snapping, etc etc. Hacks--; GoodCode++;
* Activation contexts operations are now being performed compatible to how Windows performs them (though the actual actctx implementation is still Wine's, it was modified to be compatible). Previously, actctx stuff was added to the ldr code like a pepper is added to the soup: in different places until it starts to work.
* Partial DLL redirection implementation.
* Possibility to support Shim engine and app compat stuff in future.
* More cool stuff, just browse the code.
- I fixed all regressions I could find but one (hang during shutdown of the 3rd stage). The purpose of this commit is to seek and destroy the regressions I couldn't find (if there are any).
- Some of the old rarely called ldr code still remains in startup.c and utils.c. They are subject to be rewritten/removed soon, and every remaining old function is marked with a respective DPRINT1 to see when it's being called.
svn path=/trunk/; revision=52446
2011-06-24 21:30:09 +00:00
|
|
|
/* LdrpUpdateLoadCount2 flags */
|
|
|
|
#define LDRP_UPDATE_REFCOUNT 0x01
|
|
|
|
#define LDRP_UPDATE_DEREFCOUNT 0x02
|
|
|
|
#define LDRP_UPDATE_PIN 0x03
|
|
|
|
|
2011-07-09 22:26:23 +00:00
|
|
|
/* Loader flags */
|
|
|
|
#define IMAGE_LOADER_FLAGS_COMPLUS 0x00000001
|
|
|
|
#define IMAGE_LOADER_FLAGS_SYSTEM_GLOBAL 0x01000000
|
|
|
|
|
2011-08-21 22:15:08 +00:00
|
|
|
/* Page heap flags */
|
|
|
|
#define DPH_FLAG_DLL_NOTIFY 0x40
|
|
|
|
|
2011-03-14 22:06:25 +00:00
|
|
|
typedef struct _LDRP_TLS_DATA
|
|
|
|
{
|
|
|
|
LIST_ENTRY TlsLinks;
|
|
|
|
IMAGE_TLS_DIRECTORY TlsDirectory;
|
|
|
|
} LDRP_TLS_DATA, *PLDRP_TLS_DATA;
|
|
|
|
|
2011-03-15 18:56:17 +00:00
|
|
|
/* Global data */
|
|
|
|
extern RTL_CRITICAL_SECTION LdrpLoaderLock;
|
2011-03-16 14:22:15 +00:00
|
|
|
extern BOOLEAN LdrpInLdrInit;
|
2018-10-14 21:16:36 +00:00
|
|
|
extern PVOID LdrpHeap;
|
2011-03-21 22:58:47 +00:00
|
|
|
extern LIST_ENTRY LdrpHashTable[LDR_HASH_TABLE_ENTRIES];
|
|
|
|
extern BOOLEAN ShowSnaps;
|
2011-03-22 12:41:52 +00:00
|
|
|
extern UNICODE_STRING LdrpDefaultPath;
|
[NTDLL/LDR]
- The long awaited LDR rewrite, a commit for testing the new implementation. In case of serious problems it may be reverted (revert should be approved by me).
- Its features include:
* A proper ...everything. Process, thread initialization codes, DLL loading (including compatible path lookup, and compatible/proper loading order of the dependent DLLs, including their initialization) and mapping and section creation, reference counting, relocations, good and understandable PE code for walking import descriptor, snapping, etc etc. Hacks--; GoodCode++;
* Activation contexts operations are now being performed compatible to how Windows performs them (though the actual actctx implementation is still Wine's, it was modified to be compatible). Previously, actctx stuff was added to the ldr code like a pepper is added to the soup: in different places until it starts to work.
* Partial DLL redirection implementation.
* Possibility to support Shim engine and app compat stuff in future.
* More cool stuff, just browse the code.
- I fixed all regressions I could find but one (hang during shutdown of the 3rd stage). The purpose of this commit is to seek and destroy the regressions I couldn't find (if there are any).
- Some of the old rarely called ldr code still remains in startup.c and utils.c. They are subject to be rewritten/removed soon, and every remaining old function is marked with a respective DPRINT1 to see when it's being called.
svn path=/trunk/; revision=52446
2011-06-24 21:30:09 +00:00
|
|
|
extern HANDLE LdrpKnownDllObjectDirectory;
|
|
|
|
extern ULONG LdrpNumberOfProcessors;
|
|
|
|
extern ULONG LdrpFatalHardErrorCount;
|
|
|
|
extern PUNICODE_STRING LdrpTopLevelDllBeingLoaded;
|
|
|
|
extern PLDR_DATA_TABLE_ENTRY LdrpCurrentDllInitializer;
|
|
|
|
extern UNICODE_STRING LdrApiDefaultExtension;
|
|
|
|
extern BOOLEAN LdrpLdrDatabaseIsSetup;
|
|
|
|
extern ULONG LdrpActiveUnloadCount;
|
|
|
|
extern BOOLEAN LdrpShutdownInProgress;
|
|
|
|
extern UNICODE_STRING LdrpKnownDllPath;
|
2011-07-10 13:23:19 +00:00
|
|
|
extern PLDR_DATA_TABLE_ENTRY LdrpGetModuleHandleCache, LdrpLoadedDllHandleCache;
|
2018-04-27 20:43:45 +00:00
|
|
|
extern BOOLEAN RtlpPageHeapEnabled;
|
2011-08-21 22:15:08 +00:00
|
|
|
extern ULONG RtlpDphGlobalFlags;
|
2017-03-04 20:34:36 +00:00
|
|
|
extern BOOLEAN g_ShimsEnabled;
|
|
|
|
extern PVOID g_pShimEngineModule;
|
|
|
|
extern PVOID g_pfnSE_DllLoaded;
|
|
|
|
extern PVOID g_pfnSE_DllUnloaded;
|
|
|
|
extern PVOID g_pfnSE_InstallBeforeInit;
|
|
|
|
extern PVOID g_pfnSE_InstallAfterInit;
|
|
|
|
extern PVOID g_pfnSE_ProcessDying;
|
2011-03-14 22:06:25 +00:00
|
|
|
|
|
|
|
/* ldrinit.c */
|
2011-03-16 14:22:15 +00:00
|
|
|
NTSTATUS NTAPI LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL);
|
[NTDLL/LDR]
- The long awaited LDR rewrite, a commit for testing the new implementation. In case of serious problems it may be reverted (revert should be approved by me).
- Its features include:
* A proper ...everything. Process, thread initialization codes, DLL loading (including compatible path lookup, and compatible/proper loading order of the dependent DLLs, including their initialization) and mapping and section creation, reference counting, relocations, good and understandable PE code for walking import descriptor, snapping, etc etc. Hacks--; GoodCode++;
* Activation contexts operations are now being performed compatible to how Windows performs them (though the actual actctx implementation is still Wine's, it was modified to be compatible). Previously, actctx stuff was added to the ldr code like a pepper is added to the soup: in different places until it starts to work.
* Partial DLL redirection implementation.
* Possibility to support Shim engine and app compat stuff in future.
* More cool stuff, just browse the code.
- I fixed all regressions I could find but one (hang during shutdown of the 3rd stage). The purpose of this commit is to seek and destroy the regressions I couldn't find (if there are any).
- Some of the old rarely called ldr code still remains in startup.c and utils.c. They are subject to be rewritten/removed soon, and every remaining old function is marked with a respective DPRINT1 to see when it's being called.
svn path=/trunk/; revision=52446
2011-06-24 21:30:09 +00:00
|
|
|
VOID NTAPI LdrpInitializeThread(IN PCONTEXT Context);
|
2011-03-14 22:06:25 +00:00
|
|
|
NTSTATUS NTAPI LdrpInitializeTls(VOID);
|
|
|
|
NTSTATUS NTAPI LdrpAllocateTls(VOID);
|
|
|
|
VOID NTAPI LdrpFreeTls(VOID);
|
2018-07-29 15:13:42 +00:00
|
|
|
VOID NTAPI LdrpCallTlsInitializers(IN PLDR_DATA_TABLE_ENTRY LdrEntry, IN ULONG Reason);
|
|
|
|
BOOLEAN NTAPI LdrpCallInitRoutine(IN PDLL_INIT_ROUTINE EntryPoint, IN PVOID BaseAddress, IN ULONG Reason, IN PVOID Context);
|
|
|
|
NTSTATUS NTAPI LdrpInitializeProcess(IN PCONTEXT Context, IN PVOID SystemArgument1);
|
2011-03-21 22:58:47 +00:00
|
|
|
VOID NTAPI LdrpInitFailure(NTSTATUS Status);
|
[NTDLL/LDR]
- The long awaited LDR rewrite, a commit for testing the new implementation. In case of serious problems it may be reverted (revert should be approved by me).
- Its features include:
* A proper ...everything. Process, thread initialization codes, DLL loading (including compatible path lookup, and compatible/proper loading order of the dependent DLLs, including their initialization) and mapping and section creation, reference counting, relocations, good and understandable PE code for walking import descriptor, snapping, etc etc. Hacks--; GoodCode++;
* Activation contexts operations are now being performed compatible to how Windows performs them (though the actual actctx implementation is still Wine's, it was modified to be compatible). Previously, actctx stuff was added to the ldr code like a pepper is added to the soup: in different places until it starts to work.
* Partial DLL redirection implementation.
* Possibility to support Shim engine and app compat stuff in future.
* More cool stuff, just browse the code.
- I fixed all regressions I could find but one (hang during shutdown of the 3rd stage). The purpose of this commit is to seek and destroy the regressions I couldn't find (if there are any).
- Some of the old rarely called ldr code still remains in startup.c and utils.c. They are subject to be rewritten/removed soon, and every remaining old function is marked with a respective DPRINT1 to see when it's being called.
svn path=/trunk/; revision=52446
2011-06-24 21:30:09 +00:00
|
|
|
VOID NTAPI LdrpValidateImageForMp(IN PLDR_DATA_TABLE_ENTRY LdrDataTableEntry);
|
2016-08-06 08:18:11 +00:00
|
|
|
VOID NTAPI LdrpEnsureLoaderLockIsHeld(VOID);
|
2011-03-14 22:06:25 +00:00
|
|
|
|
2011-03-16 14:22:15 +00:00
|
|
|
/* ldrpe.c */
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
LdrpSnapThunk(IN PVOID ExportBase,
|
|
|
|
IN PVOID ImportBase,
|
|
|
|
IN PIMAGE_THUNK_DATA OriginalThunk,
|
|
|
|
IN OUT PIMAGE_THUNK_DATA Thunk,
|
|
|
|
IN PIMAGE_EXPORT_DIRECTORY ExportEntry,
|
|
|
|
IN ULONG ExportSize,
|
|
|
|
IN BOOLEAN Static,
|
|
|
|
IN LPSTR DllName);
|
|
|
|
|
2011-03-21 22:58:47 +00:00
|
|
|
NTSTATUS NTAPI
|
|
|
|
LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
|
|
|
|
IN PLDR_DATA_TABLE_ENTRY LdrEntry);
|
|
|
|
|
|
|
|
|
2011-03-16 14:22:15 +00:00
|
|
|
/* ldrutils.c */
|
|
|
|
NTSTATUS NTAPI
|
|
|
|
LdrpGetProcedureAddress(IN PVOID BaseAddress,
|
|
|
|
IN PANSI_STRING Name,
|
|
|
|
IN ULONG Ordinal,
|
|
|
|
OUT PVOID *ProcedureAddress,
|
|
|
|
IN BOOLEAN ExecuteInit);
|
2011-03-21 22:58:47 +00:00
|
|
|
|
|
|
|
PLDR_DATA_TABLE_ENTRY NTAPI
|
|
|
|
LdrpAllocateDataTableEntry(IN PVOID BaseAddress);
|
|
|
|
|
|
|
|
VOID NTAPI
|
|
|
|
LdrpInsertMemoryTableEntry(IN PLDR_DATA_TABLE_ENTRY LdrEntry);
|
|
|
|
|
2011-03-16 14:22:15 +00:00
|
|
|
NTSTATUS NTAPI
|
|
|
|
LdrpLoadDll(IN BOOLEAN Redirected,
|
|
|
|
IN PWSTR DllPath OPTIONAL,
|
|
|
|
IN PULONG DllCharacteristics OPTIONAL,
|
|
|
|
IN PUNICODE_STRING DllName,
|
|
|
|
OUT PVOID *BaseAddress,
|
|
|
|
IN BOOLEAN CallInit);
|
2011-03-14 22:06:25 +00:00
|
|
|
|
[NTDLL/LDR]
- The long awaited LDR rewrite, a commit for testing the new implementation. In case of serious problems it may be reverted (revert should be approved by me).
- Its features include:
* A proper ...everything. Process, thread initialization codes, DLL loading (including compatible path lookup, and compatible/proper loading order of the dependent DLLs, including their initialization) and mapping and section creation, reference counting, relocations, good and understandable PE code for walking import descriptor, snapping, etc etc. Hacks--; GoodCode++;
* Activation contexts operations are now being performed compatible to how Windows performs them (though the actual actctx implementation is still Wine's, it was modified to be compatible). Previously, actctx stuff was added to the ldr code like a pepper is added to the soup: in different places until it starts to work.
* Partial DLL redirection implementation.
* Possibility to support Shim engine and app compat stuff in future.
* More cool stuff, just browse the code.
- I fixed all regressions I could find but one (hang during shutdown of the 3rd stage). The purpose of this commit is to seek and destroy the regressions I couldn't find (if there are any).
- Some of the old rarely called ldr code still remains in startup.c and utils.c. They are subject to be rewritten/removed soon, and every remaining old function is marked with a respective DPRINT1 to see when it's being called.
svn path=/trunk/; revision=52446
2011-06-24 21:30:09 +00:00
|
|
|
VOID NTAPI
|
|
|
|
LdrpUpdateLoadCount2(IN PLDR_DATA_TABLE_ENTRY LdrEntry,
|
|
|
|
IN ULONG Flags);
|
|
|
|
|
2011-03-17 11:20:16 +00:00
|
|
|
ULONG NTAPI
|
2016-08-06 08:18:11 +00:00
|
|
|
LdrpClearLoadInProgress(VOID);
|
2011-03-17 11:20:16 +00:00
|
|
|
|
2011-07-09 16:15:43 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
LdrpSetProtection(PVOID ViewBase,
|
|
|
|
BOOLEAN Restore);
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
LdrpCheckForLoadedDllHandle(IN PVOID Base,
|
|
|
|
OUT PLDR_DATA_TABLE_ENTRY *LdrEntry);
|
|
|
|
|
2011-03-21 22:58:47 +00:00
|
|
|
BOOLEAN NTAPI
|
|
|
|
LdrpCheckForLoadedDll(IN PWSTR DllPath,
|
|
|
|
IN PUNICODE_STRING DllName,
|
|
|
|
IN BOOLEAN Flag,
|
|
|
|
IN BOOLEAN RedirectedDll,
|
|
|
|
OUT PLDR_DATA_TABLE_ENTRY *LdrEntry);
|
|
|
|
|
|
|
|
NTSTATUS NTAPI
|
|
|
|
LdrpMapDll(IN PWSTR SearchPath OPTIONAL,
|
|
|
|
IN PWSTR DllPath2,
|
|
|
|
IN PWSTR DllName OPTIONAL,
|
|
|
|
IN PULONG DllCharacteristics,
|
|
|
|
IN BOOLEAN Static,
|
|
|
|
IN BOOLEAN Redirect,
|
|
|
|
OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry);
|
|
|
|
|
|
|
|
PVOID NTAPI
|
|
|
|
LdrpFetchAddressOfEntryPoint(PVOID ImageBase);
|
|
|
|
|
2011-07-10 01:34:19 +00:00
|
|
|
VOID NTAPI
|
[NTDLL/LDR]
- The long awaited LDR rewrite, a commit for testing the new implementation. In case of serious problems it may be reverted (revert should be approved by me).
- Its features include:
* A proper ...everything. Process, thread initialization codes, DLL loading (including compatible path lookup, and compatible/proper loading order of the dependent DLLs, including their initialization) and mapping and section creation, reference counting, relocations, good and understandable PE code for walking import descriptor, snapping, etc etc. Hacks--; GoodCode++;
* Activation contexts operations are now being performed compatible to how Windows performs them (though the actual actctx implementation is still Wine's, it was modified to be compatible). Previously, actctx stuff was added to the ldr code like a pepper is added to the soup: in different places until it starts to work.
* Partial DLL redirection implementation.
* Possibility to support Shim engine and app compat stuff in future.
* More cool stuff, just browse the code.
- I fixed all regressions I could find but one (hang during shutdown of the 3rd stage). The purpose of this commit is to seek and destroy the regressions I couldn't find (if there are any).
- Some of the old rarely called ldr code still remains in startup.c and utils.c. They are subject to be rewritten/removed soon, and every remaining old function is marked with a respective DPRINT1 to see when it's being called.
svn path=/trunk/; revision=52446
2011-06-24 21:30:09 +00:00
|
|
|
LdrpFreeUnicodeString(PUNICODE_STRING String);
|
|
|
|
|
2017-03-04 20:34:36 +00:00
|
|
|
VOID NTAPI
|
2017-10-28 12:46:11 +00:00
|
|
|
LdrpGetShimEngineInterface(VOID);
|
2017-03-04 20:34:36 +00:00
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
LdrpLoadShimEngine(IN PWSTR ImageName,
|
|
|
|
IN PUNICODE_STRING ProcessImage,
|
|
|
|
IN PVOID pShimData);
|
|
|
|
|
|
|
|
VOID NTAPI
|
2017-10-28 12:46:11 +00:00
|
|
|
LdrpUnloadShimEngine(VOID);
|
2017-03-04 20:34:36 +00:00
|
|
|
|
2018-04-27 20:43:45 +00:00
|
|
|
/* verifier.c */
|
|
|
|
|
|
|
|
NTSTATUS NTAPI
|
|
|
|
LdrpInitializeApplicationVerifierPackage(IN HANDLE KeyHandle,
|
|
|
|
IN PPEB Peb,
|
|
|
|
IN BOOLEAN SystemWide,
|
|
|
|
IN BOOLEAN ReadAdvancedOptions);
|
|
|
|
|
|
|
|
NTSTATUS NTAPI
|
|
|
|
AVrfInitializeVerifier(VOID);
|
|
|
|
|
|
|
|
VOID NTAPI
|
|
|
|
AVrfDllLoadNotification(IN PLDR_DATA_TABLE_ENTRY LdrEntry);
|
|
|
|
|
|
|
|
VOID NTAPI
|
|
|
|
AVrfDllUnloadNotification(IN PLDR_DATA_TABLE_ENTRY LdrEntry);
|
|
|
|
|
|
|
|
VOID NTAPI
|
|
|
|
AVrfPageHeapDllNotification(IN PLDR_DATA_TABLE_ENTRY LdrEntry);
|
|
|
|
|
2011-03-21 22:58:47 +00:00
|
|
|
|
2005-06-21 02:11:45 +00:00
|
|
|
/* FIXME: Cleanup this mess */
|
2005-10-19 23:08:12 +00:00
|
|
|
typedef NTSTATUS (NTAPI *PEPFUNC)(PPEB);
|
2005-06-21 02:11:45 +00:00
|
|
|
NTSTATUS LdrMapSections(HANDLE ProcessHandle,
|
2012-10-17 23:10:40 +00:00
|
|
|
PVOID ImageBase,
|
|
|
|
HANDLE SectionHandle,
|
|
|
|
PIMAGE_NT_HEADERS NTHeaders);
|
2005-06-21 02:11:45 +00:00
|
|
|
NTSTATUS LdrMapNTDllForProcess(HANDLE ProcessHandle,
|
2012-10-17 23:10:40 +00:00
|
|
|
PHANDLE NTDllSectionHandle);
|
2005-06-21 02:11:45 +00:00
|
|
|
ULONG
|
|
|
|
LdrpGetResidentSize(PIMAGE_NT_HEADERS NTHeaders);
|
2005-09-08 02:29:30 +00:00
|
|
|
|
2011-07-10 02:14:29 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL,
|
|
|
|
IN LPSTR ImportName,
|
|
|
|
OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry,
|
|
|
|
OUT PBOOLEAN Existing);
|
|
|
|
|
2011-07-10 13:23:19 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
LdrpFinalizeAndDeallocateDataTableEntry(IN PLDR_DATA_TABLE_ENTRY Entry);
|
2005-06-21 02:11:45 +00:00
|
|
|
|
2018-10-14 13:45:02 +00:00
|
|
|
|
|
|
|
/* path.c */
|
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
RtlDoesFileExists_UStr(
|
|
|
|
IN PUNICODE_STRING FileName
|
|
|
|
);
|
|
|
|
|
2005-06-21 02:11:45 +00:00
|
|
|
/* EOF */
|