ReactOS 0.4.17-dev-357-ga8f14ff
main.c File Reference
#include <windef.h>
#include <winbase.h>
#include <ndk/rtlfuncs.h>
Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define NTOS_MODE_USER
 

Functions

NTSTATUS NTAPI LdrDisableThreadCalloutsForDll (_In_ PVOID BaseAddress)
 
BOOL NTAPI DllMain (_In_ HINSTANCE hDll, _In_ ULONG dwReason, _In_opt_ PVOID pReserved)
 

Variables

HANDLE ProcessHeap
 

Macro Definition Documentation

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 15 of file main.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 11 of file main.c.

Function Documentation

◆ DllMain()

BOOL NTAPI DllMain ( _In_ HINSTANCE  hDll,
_In_ ULONG  dwReason,
_In_opt_ PVOID  pReserved 
)

Definition at line 33 of file main.c.

37{
39
41 {
43 ProcessHeap = RtlGetProcessHeap();
44 }
45
46 return TRUE;
47}
HANDLE ProcessHeap
Definition: servman.c:15
NTSTATUS NTAPI LdrDisableThreadCalloutsForDll(_In_ PVOID BaseAddress)
Definition: ldrapi.c:1168
DWORD dwReason
Definition: misc.cpp:135
#define TRUE
Definition: types.h:120
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
_Out_ PVOID pReserved
Definition: netsh.h:77
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329

◆ LdrDisableThreadCalloutsForDll()

NTSTATUS NTAPI LdrDisableThreadCalloutsForDll ( _In_ PVOID  BaseAddress)

Definition at line 1168 of file ldrapi.c.

1170{
1171 PLDR_DATA_TABLE_ENTRY LdrEntry;
1173 BOOLEAN LockHeld;
1175 DPRINT("LdrDisableThreadCalloutsForDll (BaseAddress %p)\n", BaseAddress);
1176
1177 /* Don't do it during shutdown */
1179
1180 /* Check if we should grab the lock */
1181 LockHeld = FALSE;
1182 if (!LdrpInLdrInit)
1183 {
1184 /* Grab the lock */
1186 if (!NT_SUCCESS(Status)) return Status;
1187 LockHeld = TRUE;
1188 }
1189
1190 /* Make sure the DLL is valid and get its entry */
1193 {
1194 /* Get if it has a TLS slot */
1195 if (!LdrEntry->TlsIndex)
1196 {
1197 /* It doesn't, so you're allowed to call this */
1198 LdrEntry->Flags |= LDRP_DONT_CALL_FOR_THREADS;
1200 }
1201 }
1202
1203 /* Check if the lock was held */
1204 if (LockHeld)
1205 {
1206 /* Release it */
1208 }
1209
1210 /* Return the status */
1211 return Status;
1212}
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI LdrUnlockLoaderLock(_In_ ULONG Flags, _In_opt_ ULONG_PTR Cookie)
Definition: ldrapi.c:101
NTSTATUS NTAPI LdrLockLoaderLock(_In_ ULONG Flags, _Out_opt_ PULONG Disposition, _Out_opt_ PULONG_PTR Cookie)
Definition: ldrapi.c:174
#define LDRP_DONT_CALL_FOR_THREADS
Definition: ldrtypes.h:52
#define LDR_UNLOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS
Definition: ldrtypes.h:86
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize _Pre_valid_ PVOID * BaseAddress
Definition: mmfuncs.h:404
BOOLEAN LdrpInLdrInit
Definition: ldrinit.c:30
BOOLEAN LdrpShutdownInProgress
Definition: ldrinit.c:34
BOOLEAN NTAPI LdrpCheckForLoadedDllHandle(IN PVOID Base, OUT PLDR_DATA_TABLE_ENTRY *LdrEntry)
Definition: ldrutils.c:1600
#define STATUS_DLL_NOT_FOUND
Definition: ntstatus.h:639
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
Definition: btrfs_drv.h:1876
USHORT TlsIndex
Definition: ntddk_ex.h:209
ULONG Flags
Definition: ntddk_ex.h:207
uint32_t ULONG_PTR
Definition: typedefs.h:65
_In_opt_ PVOID _Out_ PLARGE_INTEGER Cookie
Definition: cmfuncs.h:14

Referenced by DisableThreadLibraryCalls(), and DllMain().

Variable Documentation

◆ ProcessHeap

HANDLE ProcessHeap
extern

Definition at line 15 of file servman.c.

Referenced by DllMain().