ReactOS 0.4.16-dev-2528-g7139e57
implicit_tls.c File Reference
#include <ndk/ntndk.h>
#include <windows.h>
Include dependency graph for implicit_tls.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 

Functions

 _CRTALLOC (".tls")
 
BOOL WINAPI DllMain (IN HINSTANCE hDllHandle, IN DWORD dwReason, IN LPVOID lpvReserved)
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 9 of file implicit_tls.c.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 10 of file implicit_tls.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 8 of file implicit_tls.c.

Function Documentation

◆ _CRTALLOC()

_CRTALLOC ( ".tls"  )

Definition at line 38 of file implicit_tls.c.

43 {
44 (ULONG_PTR) &_tls_start, (ULONG_PTR) &_tls_end + 3,
46 (ULONG) 0, (ULONG) 0
47};
#define ULONG_PTR
Definition: config.h:101
ULONG _tls_index
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59

◆ DllMain()

BOOL WINAPI DllMain ( IN HINSTANCE  hDllHandle,
IN DWORD  dwReason,
IN LPVOID  lpvReserved 
)

@DllMain

Core routine of the Utility Manager's library.

Parameters
[in]hDllInstanceThe entry point instance of the library.
[in]fdwReasonThe reason argument to indicate the motive DllMain is being called.
[in]lpvReservedReserved.
Returns
Returns TRUE when main call initialization has succeeded, FALSE otherwise.

Definition at line 50 of file implicit_tls.c.

53{
54 PTEB Teb = NtCurrentTeb();
55 PVOID* TlsVector = Teb->ThreadLocalStoragePointer;
56 PULONG_PTR ModuleHandle = (PULONG_PTR)TlsVector[_tls_index];
58 {
59 #if defined(_MSC_VER)
60 #pragma warning( disable : 4311)
61 #endif
62 *ModuleHandle = (ULONG_PTR)GetModuleHandleA(NULL) + 1;
63 }
64 return TRUE;
65}
DWORD dwReason
Definition: misc.cpp:135
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define NtCurrentTeb
Definition: compat.h:836
PVOID ThreadLocalStoragePointer
Definition: compat.h:841
uint32_t * PULONG_PTR
Definition: typedefs.h:65