ReactOS 0.4.15-dev-8339-g4028de8
loader.c File Reference
#include <k32.h>
#include <debug.h>
Include dependency graph for loader.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS WINAPI BasepInitializeTermsrvFpns (VOID)
 
DWORD WINAPI BasepGetModuleHandleExParameterValidation (DWORD dwFlags, LPCWSTR lpwModuleName, HMODULE *phModule)
 
PVOID WINAPI BasepMapModuleHandle (HMODULE hModule, BOOLEAN AsDataFile)
 
BOOL WINAPI DisableThreadLibraryCalls (IN HMODULE hLibModule)
 
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA (LPCSTR lpLibFileName)
 
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExA (LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
 
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryW (LPCWSTR lpLibFileName)
 
static NTSTATUS BasepLoadLibraryAsDatafile (PWSTR Path, LPCWSTR Name, HMODULE *hModule)
 
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW (LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
 
FARPROC WINAPI GetProcAddress (HMODULE hModule, LPCSTR lpProcName)
 
BOOL WINAPI DECLSPEC_HOTPATCH FreeLibrary (HINSTANCE hLibModule)
 
VOID WINAPI FreeLibraryAndExitThread (HMODULE hLibModule, DWORD dwExitCode)
 
DWORD WINAPI GetModuleFileNameA (HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
 
DWORD WINAPI GetModuleFileNameW (HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
 
HMODULE WINAPI GetModuleHandleForUnicodeString (PUNICODE_STRING ModuleName)
 
BOOLEAN WINAPI BasepGetModuleHandleExW (BOOLEAN NoLock, DWORD dwPublicFlags, LPCWSTR lpwModuleName, HMODULE *phModule)
 
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA (LPCSTR lpModuleName)
 
HMODULE WINAPI GetModuleHandleW (LPCWSTR lpModuleName)
 
BOOL WINAPI GetModuleHandleExW (IN DWORD dwFlags, IN LPCWSTR lpwModuleName OPTIONAL, OUT HMODULE *phModule)
 
BOOL WINAPI GetModuleHandleExA (IN DWORD dwFlags, IN LPCSTR lpModuleName OPTIONAL, OUT HMODULE *phModule)
 
DWORD WINAPI LoadModule (LPCSTR lpModuleName, LPVOID lpParameterBlock)
 
FARPROC WINAPI DelayLoadFailureHook (LPCSTR pszDllName, LPCSTR pszProcName)
 
BOOL WINAPI UTRegister (HMODULE hModule, LPSTR lpsz16BITDLL, LPSTR lpszInitName, LPSTR lpszProcName, FARPROC *ppfn32Thunk, FARPROC pfnUT32CallBack, LPVOID lpBuff)
 
VOID WINAPI UTUnRegister (HMODULE hModule)
 
BOOL WINAPI BaseQueryModuleData (IN LPSTR ModuleName, IN LPSTR Unknown, IN PVOID Unknown2, IN PVOID Unknown3, IN PVOID Unknown4)
 
NTSTATUS WINAPI BaseProcessInitPostImport (VOID)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file loader.c.

Function Documentation

◆ BasepGetModuleHandleExParameterValidation()

DWORD WINAPI BasepGetModuleHandleExParameterValidation ( DWORD  dwFlags,
LPCWSTR  lpwModuleName,
HMODULE phModule 
)

Definition at line 26 of file loader.c.

29{
30 /* Set phModule to 0 if it's not a NULL pointer */
31 if (phModule) *phModule = 0;
32
33 /* Check for invalid flags combination */
34 if (dwFlags & ~(GET_MODULE_HANDLE_EX_FLAG_PIN |
35 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT |
36 GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS) ||
37 ((dwFlags & GET_MODULE_HANDLE_EX_FLAG_PIN) &&
38 (dwFlags & GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT)) ||
39 (!lpwModuleName && (dwFlags & GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS))
40 )
41 {
44 }
45
46 /* Check 2nd parameter */
47 if (!phModule)
48 {
51 }
52
53 /* Return what we have according to the module name */
54 if (lpwModuleName)
55 {
57 }
58
59 /* No name given, so put ImageBaseAddress there */
60 *phModule = (HMODULE)NtCurrentPeb()->ImageBaseAddress;
61
63}
#define NtCurrentPeb()
Definition: FLS.c:22
#define BASEP_GET_MODULE_HANDLE_EX_PARAMETER_VALIDATION_SUCCESS
Definition: kernel32.h:108
#define BASEP_GET_MODULE_HANDLE_EX_PARAMETER_VALIDATION_ERROR
Definition: kernel32.h:107
#define BASEP_GET_MODULE_HANDLE_EX_PARAMETER_VALIDATION_CONTINUE
Definition: kernel32.h:109
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:167
HANDLE HMODULE
Definition: typedefs.h:77
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by BasepGetModuleHandleExW(), GetModuleHandleExA(), and GetModuleHandleExW().

◆ BasepGetModuleHandleExW()

BOOLEAN WINAPI BasepGetModuleHandleExW ( BOOLEAN  NoLock,
DWORD  dwPublicFlags,
LPCWSTR  lpwModuleName,
HMODULE phModule 
)

Definition at line 716 of file loader.c.

717{
719 NTSTATUS Status = STATUS_SUCCESS, Status2;
721 UNICODE_STRING ModuleNameU;
722 DWORD dwValid;
723 BOOLEAN Redirected = FALSE; // FIXME
724
725 /* Validate parameters */
726 dwValid = BasepGetModuleHandleExParameterValidation(dwPublicFlags, lpwModuleName, phModule);
728
729 /* Acquire lock if necessary */
730 if (!NoLock)
731 {
733 if (!NT_SUCCESS(Status))
734 {
735 /* Fail */
737 if (phModule) *phModule = NULL;
738 return NT_SUCCESS(Status);
739 }
740 }
741
742 if (!(dwPublicFlags & GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS))
743 {
744 /* Create a unicode string out of module name */
745 RtlInitUnicodeString(&ModuleNameU, lpwModuleName);
746
747 // FIXME: Do some redirected DLL stuff?
748 if (Redirected)
749 {
751 }
752
753 if (!hModule)
754 {
756 if (!hModule)
757 {
758 /* Last error is already set, so just return failure by setting status */
760 goto quickie;
761 }
762 }
763 }
764 else
765 {
766 /* Perform Pc to file header to get module instance */
767 hModule = (HMODULE)RtlPcToFileHeader((PVOID)lpwModuleName,
768 (PVOID*)&hModule);
769
770 /* Check if it succeeded */
771 if (!hModule)
772 {
773 /* Set "dll not found" status and quit */
775 goto quickie;
776 }
777 }
778
779 /* Check if changing reference is not forbidden */
780 if (!(dwPublicFlags & GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT))
781 {
782 /* Add reference to this DLL */
783 Status = LdrAddRefDll((dwPublicFlags & GET_MODULE_HANDLE_EX_FLAG_PIN) ? LDR_ADDREF_DLL_PIN : 0,
784 hModule);
785 }
786
787quickie:
788 /* Set last error in case of failure */
789 if (!NT_SUCCESS(Status))
791
792 /* Unlock loader lock if it was acquired */
793 if (!NoLock)
794 {
795 Status2 = LdrUnlockLoaderLock(0, Cookie);
796 ASSERT(NT_SUCCESS(Status2));
797 }
798
799 /* Set the module handle to the caller */
800 if (phModule) *phModule = hModule;
801
802 /* Return TRUE on success and FALSE otherwise */
803 return NT_SUCCESS(Status);
804}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define UNIMPLEMENTED
Definition: debug.h:118
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
PVOID NTAPI RtlPcToFileHeader(IN PVOID PcValue, PVOID *BaseOfImage)
Definition: libsupp.c:658
HMODULE hModule
Definition: animate.c:44
DWORD WINAPI BasepGetModuleHandleExParameterValidation(DWORD dwFlags, LPCWSTR lpwModuleName, HMODULE *phModule)
Definition: loader.c:26
HMODULE WINAPI GetModuleHandleForUnicodeString(PUNICODE_STRING ModuleName)
Definition: loader.c:667
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
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
NTSTATUS NTAPI LdrAddRefDll(_In_ ULONG Flags, _In_ PVOID BaseAddress)
Definition: ldrapi.c:1205
#define LDR_ADDREF_DLL_PIN
Definition: ldrtypes.h:71
#define ASSERT(a)
Definition: mode.c:44
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STATUS_DLL_NOT_FOUND
Definition: ntstatus.h:545
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t ULONG_PTR
Definition: typedefs.h:65
_In_opt_ PVOID _Out_ PLARGE_INTEGER Cookie
Definition: cmfuncs.h:14

Referenced by GetModuleHandleExA(), GetModuleHandleExW(), and GetModuleHandleW().

◆ BasepInitializeTermsrvFpns()

NTSTATUS WINAPI BasepInitializeTermsrvFpns ( VOID  )

Definition at line 18 of file loader.c.

19{
22}
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239

Referenced by BaseProcessInitPostImport().

◆ BasepLoadLibraryAsDatafile()

static NTSTATUS BasepLoadLibraryAsDatafile ( PWSTR  Path,
LPCWSTR  Name,
HMODULE hModule 
)
static

Definition at line 188 of file loader.c.

189{
190 WCHAR FilenameW[MAX_PATH];
192 HANDLE hMapping;
194 PVOID lpBaseAddress = NULL;
195 SIZE_T ViewSize = 0;
196 //PUNICODE_STRING OriginalName;
197 //UNICODE_STRING dotDLL = RTL_CONSTANT_STRING(L".DLL");
198
199 /* Zero out handle value */
200 *hModule = 0;
201
202 DPRINT("BasepLoadLibraryAsDatafile(%S %S %p)\n", Path, Name, hModule);
203
204 /*Status = RtlDosApplyFileIsolationRedirection_Ustr(TRUE,
205 Name,
206 &dotDLL,
207 RedirName,
208 RedirName2,
209 &OriginalName2,
210 NULL,
211 NULL,
212 NULL);*/
213
214 /* Try to search for it */
215 if (!SearchPathW(Path,
216 Name,
217 L".DLL",
218 sizeof(FilenameW) / sizeof(FilenameW[0]),
219 FilenameW,
220 NULL))
221 {
222 /* Return last status value directly */
223 return NtCurrentTeb()->LastStatusValue;
224 }
225
226 /* Open this file we found */
227 hFile = CreateFileW(FilenameW,
230 NULL,
232 0,
233 0);
234
235 /* If opening failed - return last status value */
236 if (hFile == INVALID_HANDLE_VALUE) return NtCurrentTeb()->LastStatusValue;
237
238 /* Create file mapping */
239 hMapping = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
240
241 /* Close the file handle */
243
244 /* If creating file mapping failed - return last status value */
245 if (!hMapping) return NtCurrentTeb()->LastStatusValue;
246
247 /* Map view of section */
248 Status = NtMapViewOfSection(hMapping,
250 &lpBaseAddress,
251 0,
252 0,
253 0,
254 &ViewSize,
255 ViewShare,
256 0,
258
259 /* Close handle to the section */
260 CloseHandle(hMapping);
261
262 /* If mapping view of section failed - return last status value */
263 if (!NT_SUCCESS(Status)) return NtCurrentTeb()->LastStatusValue;
264
265 /* Make sure it's a valid PE file */
266 if (!RtlImageNtHeader(lpBaseAddress))
267 {
268 /* Unmap the view and return failure status */
269 UnmapViewOfFile(lpBaseAddress);
271 }
272
273 /* Set low bit of handle to indicate datafile module */
274 *hModule = (HMODULE)((ULONG_PTR)lpBaseAddress | 1);
275
276 /* Load alternate resource module */
277 //LdrLoadAlternateResourceModule(*hModule, FilenameW);
278
279 return STATUS_SUCCESS;
280}
NTSTATUS NTAPI NtMapViewOfSection(IN HANDLE SectionHandle, IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress, IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PSIZE_T ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Protect)
Definition: section.c:3255
PRTL_UNICODE_STRING_BUFFER Path
#define CloseHandle
Definition: compat.h:739
#define PAGE_READONLY
Definition: compat.h:138
#define UnmapViewOfFile
Definition: compat.h:746
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:744
#define GENERIC_READ
Definition: compat.h:135
#define RtlImageNtHeader
Definition: compat.h:806
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_SHARE_READ
Definition: compat.h:136
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1298
#define NtCurrentTeb
_In_ HANDLE hFile
Definition: mswsock.h:90
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:408
#define NtCurrentProcess()
Definition: nt_native.h:1657
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
@ ViewShare
Definition: nt_native.h:1278
#define STATUS_INVALID_IMAGE_FORMAT
Definition: ntstatus.h:359
#define L(x)
Definition: ntvdm.h:50
#define DPRINT
Definition: sndvol32.h:73
ULONG_PTR SIZE_T
Definition: typedefs.h:80
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by LoadLibraryExW().

◆ BasepMapModuleHandle()

PVOID WINAPI BasepMapModuleHandle ( HMODULE  hModule,
BOOLEAN  AsDataFile 
)

Definition at line 67 of file loader.c.

68{
69 /* If no handle is provided - use current image base address */
70 if (!hModule) return NtCurrentPeb()->ImageBaseAddress;
71
72 /* Check if it's a normal or a datafile one */
73 if (LDR_IS_DATAFILE(hModule) && !AsDataFile)
74 return NULL;
75
76 /* It's a normal DLL, just return its handle */
77 return hModule;
78}
#define LDR_IS_DATAFILE(handle)
Definition: ldrtypes.h:103

Referenced by GetModuleFileNameW(), and GetProcAddress().

◆ BaseProcessInitPostImport()

NTSTATUS WINAPI BaseProcessInitPostImport ( VOID  )

Definition at line 1134 of file loader.c.

1135{
1136 DPRINT("Post-init called\n");
1137
1138 /* Check if this is a terminal server */
1139 if (SharedUserData->SuiteMask & VER_SUITE_TERMINAL)
1140 {
1141 /* Initialize TS pointers */
1143 }
1144
1145 /* FIXME: Initialize TS pointers */
1146 return STATUS_SUCCESS;
1147}
NTSTATUS WINAPI BasepInitializeTermsrvFpns(VOID)
Definition: loader.c:18
#define VER_SUITE_TERMINAL
#define SharedUserData

◆ BaseQueryModuleData()

BOOL WINAPI BaseQueryModuleData ( IN LPSTR  ModuleName,
IN LPSTR  Unknown,
IN PVOID  Unknown2,
IN PVOID  Unknown3,
IN PVOID  Unknown4 
)

Definition at line 1114 of file loader.c.

1119{
1120 DPRINT1("BaseQueryModuleData called: %s %s %p %p %p\n",
1121 ModuleName,
1122 Unknown,
1123 Unknown2,
1124 Unknown3,
1125 Unknown4);
1126 return FALSE;
1127}
PRTL_UNICODE_STRING_BUFFER PULONG PULONG Unknown4
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1280
#define DPRINT1
Definition: precomp.h:8
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES IN DWORD Unknown3
Definition: conport.c:37
@ Unknown
Definition: i8042prt.h:114

◆ DelayLoadFailureHook()

FARPROC WINAPI DelayLoadFailureHook ( LPCSTR  pszDllName,
LPCSTR  pszProcName 
)

Definition at line 1083 of file loader.c.

1084{
1085 STUB;
1086 return NULL;
1087}
#define STUB
Definition: kernel32.h:27

◆ DisableThreadLibraryCalls()

BOOL WINAPI DisableThreadLibraryCalls ( IN HMODULE  hLibModule)

Definition at line 85 of file loader.c.

87{
89
90 /* Disable thread library calls */
92
93 /* If it wasn't success - set last error and return failure */
94 if (!NT_SUCCESS(Status))
95 {
97 return FALSE;
98 }
99
100 /* Return success */
101 return TRUE;
102}
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI LdrDisableThreadCalloutsForDll(_In_ PVOID BaseAddress)
Definition: ldrapi.c:1154
HINSTANCE hLibModule
Definition: sfc.c:23

Referenced by _CorDllMain(), DllMain(), if(), LpkDllInitialize(), ProcessAttach(), STRMBASE_DllMain(), WIC_DllMain(), and wined3d_dll_init().

◆ FreeLibrary()

BOOL WINAPI DECLSPEC_HOTPATCH FreeLibrary ( HINSTANCE  hLibModule)

Definition at line 460 of file loader.c.

461{
463 PIMAGE_NT_HEADERS NtHeaders;
464
466 {
467 /* This is a LOAD_LIBRARY_AS_DATAFILE module, check if it's a valid one */
468 NtHeaders = RtlImageNtHeader((PVOID)((ULONG_PTR)hLibModule & ~1));
469
470 if (NtHeaders)
471 {
472 /* Unmap view */
474
475 /* Unload alternate resource module */
477 }
478 else
480 }
481 else
482 {
483 /* Just unload it */
485 }
486
487 /* Check what kind of status we got */
488 if (!NT_SUCCESS(Status))
489 {
490 /* Set last error */
492
493 /* Return failure */
494 return FALSE;
495 }
496
497 /* Return success */
498 return TRUE;
499}
NTSTATUS NTAPI NtUnmapViewOfSection(IN HANDLE ProcessHandle, IN PVOID BaseAddress)
Definition: section.c:3481
NTSTATUS NTAPI LdrUnloadDll(_In_ PVOID BaseAddress)
Definition: ldrapi.c:1291
BOOLEAN NTAPI LdrUnloadAlternateResourceModule(_In_ PVOID BaseAddress)
Definition: ldrapi.c:1601

◆ FreeLibraryAndExitThread()

VOID WINAPI FreeLibraryAndExitThread ( HMODULE  hLibModule,
DWORD  dwExitCode 
)

Definition at line 507 of file loader.c.

509{
510
512 {
513 /* This is a LOAD_LIBRARY_AS_DATAFILE module */
515 {
516 /* Unmap view */
518
519 /* Unload alternate resource module */
521 }
522 }
523 else
524 {
525 /* Just unload it */
527 }
528
529 /* Exit thread */
530 ExitThread(dwExitCode);
531}
VOID WINAPI ExitThread(IN DWORD uExitCode)
Definition: thread.c:365

Referenced by collect_connections_proc(), connection_collector(), ExitThreadApc(), GPNotificationThreadProc(), hook_thread_proc(), LookupThreadProc(), CSysTray::SysTrayThreadProc(), wined3d_cs_run(), and WsAsyncThread().

◆ GetModuleFileNameA()

DWORD WINAPI GetModuleFileNameA ( HINSTANCE  hModule,
LPSTR  lpFilename,
DWORD  nSize 
)

Definition at line 539 of file loader.c.

542{
543 UNICODE_STRING FilenameW;
544 ANSI_STRING FilenameA;
546 DWORD Length = 0, LengthToCopy;
547
548 /* Allocate a unicode buffer */
549 FilenameW.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, nSize * sizeof(WCHAR));
550 if (!FilenameW.Buffer)
551 {
553 return 0;
554 }
555
556 /* Call unicode API */
557 FilenameW.Length = (USHORT)GetModuleFileNameW(hModule, FilenameW.Buffer, nSize) * sizeof(WCHAR);
558 FilenameW.MaximumLength = FilenameW.Length + sizeof(WCHAR);
559
560 if (FilenameW.Length)
561 {
562 /* Convert to ansi string */
563 Status = BasepUnicodeStringTo8BitString(&FilenameA, &FilenameW, TRUE);
564 if (!NT_SUCCESS(Status))
565 {
566 /* Set last error, free string and return failure */
568 RtlFreeUnicodeString(&FilenameW);
569 return 0;
570 }
571
572 /* Calculate size to copy */
573 Length = min(nSize, FilenameA.Length);
574
575 /* Include terminating zero */
576 if (nSize > Length)
577 LengthToCopy = Length + 1;
578 else
579 LengthToCopy = nSize;
580
581 /* Now copy back to the caller amount he asked */
582 RtlMoveMemory(lpFilename, FilenameA.Buffer, LengthToCopy);
583
584 /* Free ansi filename */
585 RtlFreeAnsiString(&FilenameA);
586 }
587
588 /* Free unicode filename */
589 RtlFreeHeap(RtlGetProcessHeap(), 0, FilenameW.Buffer);
590
591 /* Return length copied */
592 return Length;
593}
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
PRTL_CONVERT_STRINGA BasepUnicodeStringTo8BitString
Definition: utils.c:27
#define min(a, b)
Definition: monoChain.cc:55
NTSYSAPI VOID NTAPI RtlFreeAnsiString(PANSI_STRING AnsiString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
unsigned short USHORT
Definition: pedump.c:61
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2084

Referenced by __getmainargs(), _assert(), _module_name_from_addr(), AssertFail(), create_proc(), doChild(), FreeLibrary(), get_app_key(), GetWindowModuleFileNameA(), init_test(), InstallService(), MLLoadLibraryA(), rdp_send_logon_info(), register_current_module_typelib(), register_service(), register_service_exA(), run_child_process(), run_js_script(), setup_dsound_options(), START_TEST(), STRMBASE_DllGetClassObject(), test(), test_32bit_win(), test_ExitCode(), test_extra_block(), test_filenames(), test_GetMappedFileName(), test_GetModuleBaseName(), test_GetModuleFileNameEx(), test_GetSetConsoleInputExeName(), test_GetWindowModuleFileName(), test_IME(), test_info_size(), test_inheritance(), test_internet_features_registry(), test_load_save(), test_LoadImage_working_directory(), test_LoadLibraryEx_search_flags(), test_loadlibraryshim(), Test_LoadUnload(), test_LocalizedNames(), test_QueryFullProcessImageNameA(), test_VerQueryValueA(), testGetModuleFileName(), testGetModuleFileName_Wrong(), TestGetModuleFileNameA(), and wined3d_dll_init().

◆ GetModuleFileNameW()

DWORD WINAPI GetModuleFileNameW ( HINSTANCE  hModule,
LPWSTR  lpFilename,
DWORD  nSize 
)

Definition at line 600 of file loader.c.

603{
606 ULONG Length = 0;
608 PPEB Peb;
609
611
612 /* Upscale nSize from chars to bytes */
613 nSize *= sizeof(WCHAR);
614
616 {
617 /* We don't use per-thread cur dir now */
618 //PRTL_PERTHREAD_CURDIR PerThreadCurdir = (PRTL_PERTHREAD_CURDIR)teb->NtTib.SubSystemTib;
619
620 Peb = NtCurrentPeb ();
621
622 /* Acquire a loader lock */
624
625 /* Traverse the module list */
628 while (Entry != ModuleListHead)
629 {
630 Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
631
632 /* Check if this is the requested module */
633 if (Module->DllBase == (PVOID)hModule)
634 {
635 /* Calculate size to copy */
637
638 /* Copy contents */
639 RtlMoveMemory(lpFilename, Module->FullDllName.Buffer, Length);
640
641 /* Subtract a terminating zero */
642 if (Length == Module->FullDllName.MaximumLength)
643 Length -= sizeof(WCHAR);
644
645 /* Break out of the loop */
646 break;
647 }
648
649 /* Advance to the next entry */
650 Entry = Entry->Flink;
651 }
652 }
654 {
656 Length = 0;
657 } _SEH2_END
658
659 /* Release the loader lock */
661
662 return Length / sizeof(WCHAR);
663}
PPEB Peb
Definition: dllmain.c:27
PVOID WINAPI BasepMapModuleHandle(HMODULE hModule, BOOLEAN AsDataFile)
Definition: loader.c:67
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
LIST_ENTRY * ModuleListHead
Definition: kdpacket.c:23
#define LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS
Definition: ldrtypes.h:76
#define LDR_UNLOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS
Definition: ldrtypes.h:82
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
base of all file and directory entries
Definition: entries.h:83
Definition: btrfs_drv.h:1876
UNICODE_STRING FullDllName
Definition: btrfs_drv.h:1882
PVOID DllBase
Definition: btrfs_drv.h:1880
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
LIST_ENTRY InLoadOrderModuleList
Definition: ldrtypes.h:120
PPEB_LDR_DATA Ldr
Definition: btrfs_drv.h:1912
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59

Referenced by __report_error(), __wgetmainargs(), _CorExeMain(), _CreateActCtxFromFile(), _CreateV5ActCtx(), _DoDLLInjection(), _RunRemoteTest(), AMovieDllRegisterServer2(), AtlLoadTypeLib(), ATL::AtlLoadTypeLib(), AtlUpdateRegistryFromResourceD(), CommandLineToArgvW(), ATL::CAtlModule::CommonInitRegistrar(), create_registrar(), CURSORICON_LoadImageW(), BtrfsVolPropSheet::DeviceDlgProc(), DlgInitHandler(), DllRegisterServer(), DoTestEntry(), ExtractAssociatedIconW(), FILEDLG95_MRU_load_filename(), FILEDLG95_MRU_save_filename(), FindSubProgram(), get_mmioFromProfile(), CConfiguration::GetConfigurationFromFile(), CNetConUiObject::GetIconLocation(), CNtObjectFolderExtractIcon::GetIconLocation(), CRegistryFolderExtractIcon::GetIconLocation(), GetModuleFileNameA(), BtrfsIconOverlay::GetOverlayInfo(), GetWindowModuleFileNameW(), Host_get_FullName(), Host_get_Path(), if(), Imm32IsRunningInMsoobe(), init_dbghelp_version(), init_paths(), InitLogs(), InitTestData(), InstallEventSource(), InstallScreenSaverW(), IntSetWindowsHook(), BtrfsContextMenu::InvokeCommand(), load_process_feature(), load_typelib(), SEALED_::LoadTypeLibrary(), LPK_ApplyMirroring(), MLBuildResURLW(), MLLoadLibraryW(), NdrDllRegisterProxy(), BtrfsPropSheet::open_as_admin(), BtrfsBalance::PauseBalance(), ReallyFixupVTable(), register_clsid(), register_service(), register_service_exW(), RegisterComponent(), RegisterInShimCache(), BtrfsVolPropSheet::ResetStats(), ResProtocolInfo_ParseUrl(), RetrieveCurrentModuleNTDirectory(), RunApphelpCacheControlTests(), search_res_tlb(), set_firewall(), SetWinEventHook(), SHELL_InRunDllProcess(), BtrfsVolPropSheet::ShowChangeDriveLetter(), BtrfsVolPropSheet::ShowScrub(), ShowUsage(), START_TEST(), BtrfsBalance::StartBalance(), StartChild(), BtrfsBalance::StopBalance(), CSysTray::SysTrayThreadProc(), taskdialog_get_exe_name(), test_32bit_win(), Test_ApphelpCheckRunApp(), test_AttributesRegistration(), test_commandline2argv(), test_FakeDLL(), test_FileMapping(), Test_GetMatchingExe(), Test_ImageSection(), test_Load(), test_NetFwAuthorizedApplication(), test_properties(), test_QueryFullProcessImageNameW(), test_WTSEnumerateProcessesW(), TestDllStartup(), testGetModuleFileName(), testGetModuleFileName_Wrong(), TestGetModuleFileNameW(), TestPrivMoveFileIdentityW(), TestRedirection(), TestStaticDestruct(), CDownloadManager::ThreadFunc(), User32CallEventProcFromKernel(), validate_SDBQUERYRESULT_size(), wmain(), and write_predefined_strings().

◆ GetModuleHandleA()

HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA ( LPCSTR  lpModuleName)

Definition at line 812 of file loader.c.

813{
814 PUNICODE_STRING ModuleNameW;
815 PTEB pTeb = NtCurrentTeb();
816
817 /* Check if we have no name to convert */
818 if (!lpModuleName)
820
821 /* Convert module name to unicode */
822 ModuleNameW = Basep8BitStringToStaticUnicodeString(lpModuleName);
823
824 /* Call W version if conversion was successful */
825 if (ModuleNameW)
826 return GetModuleHandleW(ModuleNameW->Buffer);
827
828 /* Return failure */
829 return 0;
830}
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
PUNICODE_STRING WINAPI Basep8BitStringToStaticUnicodeString(IN LPCSTR String)
Definition: utils.c:188
PVOID ImageBaseAddress
Definition: ntddk_ex.h:245
Definition: compat.h:836
PPEB ProcessEnvironmentBlock
Definition: ntddk_ex.h:337

Referenced by __mingw_get_msvcrt_handle(), add_128x15_bitmap(), build_toolbar(), check_address(), check_class(), check_dialog_style(), check_z_order_debug(), child_process(), cleanup(), compat_catpath(), create_animate(), create_async_message_window(), create_custom_parent_window(), create_dde_server(), create_dde_window(), create_edit_control(), create_listview_control(), create_main_test_wnd(), create_monthcal_control(), create_pager_control(), create_parent(), create_parent_window(), create_progress(), create_rebar_control(), create_testfontfile(), create_trackbar(), create_trackbar2(), create_treeview_control(), create_updown_control(), createMainWnd(), createParentWindow(), CreateRemoteThread(), CreateTestWindow(), destroy_dde_window(), detect_locale(), DliHook(), dll_entry_point(), DllMain(), DllUnregisterServer(), do_child(), do_parent(), doChild(), DoTestEntry(), drop_window_therad(), dsm_RegisterWindowClasses(), dump_system_info(), EDIT_WM_ContextMenu(), empty_dlg_proc2(), EnumResourceLanguagesA(), EnumResourceNamesA(), EnumResourceTypesA(), ExceptionFilter(), extract_resource(), ExtractIconExW(), get_host_winver(), get_mono_path(), get_res_data(), GetDriverVersion(), GetEnvStatus(), hook_WaitForInputIdle(), include_pac_utils(), init(), Init(), init_aes_environment(), init_base_environment(), init_func_ptrs(), init_funcs(), init_function_pointers(), init_function_ptrs(), init_functionpointers(), init_functions(), init_pointers(), init_procs(), init_test(), init_tests(), init_threadpool(), InitFunctionPointers(), InitFunctionPtrs(), is_lang_english(), is_module_loaded(), is_process_limited(), load_it_up(), load_resource(), load_v6_module(), LoadCodePageData(), LoadResource(), loadShell32(), mdi_RegisterWindowClasses(), MSVCRT_locale_to_LCID(), MyWndProc(), NPSAuthenticationDialogA(), path_to_pidl(), print_version(), rebuild_toolbar(), register_child_wnd_class(), register_class(), register_classes(), register_dummy_class(), register_menu_check_class(), register_parent_class(), register_parent_wnd_class(), register_style_check_class(), register_test_notify_class(), register_testwindow_class(), register_window_class(), register_window_classes(), register_wmime_keydown_class(), RegisterClassHelper(), registerParentWindowClass(), RegisterWindowClasses(), running_under_wine(), scrollbar_test_init(), setup_pointers(), sheet_callback(), CZipExtract::ShowExtractError(), ShowUsage(), START_TEST(), subclass_button(), subclass_combobox(), subclass_edit(), subclass_static(), test_accelerators(), test_AccessCheck(), test_acmDriverAdd(), test_action_mapping(), test_add_bitmap(), test_add_string(), test_aligned(), test_arrange(), Test_atexit(), test_attach_input(), test_ax_win(), test_bad_control_class(), test_builtinproc(), test_buttons(), test_calloc(), test_capture_4(), test_change_focus(), test_CheckMenuRadioItem(), test_child_window_from_point(), test_clipboard_viewers(), test_comctl32_class(), Test_CompareIDs(), test_converttoemfplus(), test_cookie_attrs(), test_CoWaitForMultipleHandles(), test_crash_couninitialize(), test_create(), test_create_view_template(), test_CreateActCtx(), test_createeffect(), test_createtoolbarex(), test_CreateUpDownControl(), test_CreateWindow(), test_csparentdc(), test_custom_default_button(), test_customdraw(), test_data_cache(), test_dc_layout(), test_default_handler_run(), test_DeleteDC(), test_desktop_winproc(), test_dialog_messages(), test_dialog_parent(), test_DialogBoxParam(), test_dialogmode(), test_directory_filename(), test_disableowner(), test_dpi_mapping(), test_dpi_window(), test_drawimage(), test_EM_SETTEXTEX(), test_EN_LINK(), test_EndDialog(), test_EnumProcessModules(), test_eventMask(), test_events(), test_ExitCode(), test_ExtractIcon(), test_FakeDLL(), test_filenames(), test_fullscreen(), test_GdiConvertToDevmodeW(), test_gdiis(), test_GdipInitializePalette(), test_GetConsoleFontInfo(), test_GetConsoleFontSize(), test_GetConsoleScreenBufferInfoEx(), Test_GetDCEx_Cached(), Test_GetDCEx_CS_CLASSDC(), Test_GetDCEx_CS_Mixed(), Test_GetDCEx_CS_OWNDC(), Test_GetDCEx_CS_SwitchedStyle(), test_GetFileVersionInfoEx(), Test_GetKeyState(), test_GetLargestConsoleWindowSize(), test_GetLastActivePopup(), test_GetListBoxInfo(), test_GetMappedFileName(), test_GetModuleBaseName(), test_GetModuleFileNameEx(), test_GetModuleInformation(), test_GetPhysicallyInstalledSystemMemory(), test_GetProcAddress(), test_GetProcessImageFileName(), test_GetScrollBarInfo(), test_GetSetConsoleInputExeName(), test_getstring(), test_gettext(), test_GetUpdateRect(), test_GetWindowModuleFileName(), test_heap(), test_HeapQueryInformation(), test_hotkey(), test_I_UpdateStore(), test_IgnoreFreeLibrary(), test_IME(), test_ImmGetCompositionString(), test_ImmMessages(), test_import_resolution(), test_ImportDescriptors(), test_input_message_source(), test_Input_mouse(), test_Input_whitebox(), test_InSendMessage(), test_instances(), test_invisible_create(), test_iocp_callback(), test_IsWindowUnicode(), test_launch_app_registry(), test_layout(), test_ldap_parse_sort_control(), test_LdrAddRefDll(), test_listbox_dlgdir(), test_Loader(), test_LoadImage(), test_LoadStringA(), test_LoadStringW(), Test_LoadUnload(), test_longtextA(), test_LVM_GETCOUNTPERPAGE(), test_margins_default(), test_maximum_allowed(), test_MCIWndCreate(), test_md5_ctx(), test_mdi(), test_MDI_child_stack(), test_MDI_create(), test_mdi_messages(), test_menu_hilitemenuitem(), test_menu_input(), test_menu_messages(), test_message_from_hmodule(), test_messages(), test_mouse_keyboard(), test_mouse_ll_hook(), test_mru(), test_msidecomposedesc(), test_NdrDllGetClassObject(), test_NdrDllRegisterProxy(), test_nopage(), test_noresize(), test_normal_imports(), test_NtAreMappedFilesTheSame(), test_null_filename(), test_obsolete_flags(), test_ok(), test_ole_initialization(), test_ordinal_imports(), test_pager(), test_param_check(), test_pe_checksum(), test_PlaySound(), test_popup_zorder(), test_propertytovariant(), test_proxy_used_in_wrong_thread(), test_PSM_ADDPAGE(), test_PSM_INSERTPAGE(), test_queryvirtualmemory(), test_quit_message(), test_redraw(), test_redrawnow(), test_registrar(), test_resizable2(), test_resize(), test_RpcExceptionFilter(), test_save_settings(), test_set_clipboard_DRAWCLIPBOARD(), test_set_hook(), test_set_window_style(), test_SetConsoleFont(), Test_SetCursorPos(), test_setinfo(), test_sha_ctx(), test_SHChangeNotify(), test_SHCreateWorkerWindowA(), test_shell_window(), test_SHSetWindowBits(), test_Sign_Media(), test_SIPLoad(), test_sizes(), test_smresult(), test_sscanf(), test_sscanf_s(), test_stgcreatestorageex(), test_stillimage_aggregation(), test_strncpy(), test_subclass(), test_subitem_rect(), test_swscanf_s(), test_thick_child_size(), test_thread_start_address(), test_thumb_length(), test_timer(), test_title(), test_tooltip(), test_treeview_classinfo(), test_TTM_ADDTOOL(), test_ttm_gettoolinfo(), test_TTN_SHOW(), test_update_region(), test_updown_buddy(), test_updown_create(), test_UuidCreateSequential(), test_varianttoproperty(), test_verifyRevocation(), test_version_flag_versus_aw(), test_WaitForInputIdle(), test_winevents(), test_winproc_handles(), test_wiznavigation(), test_WM_NOTIFY(), test_wndproc(), testGetModuleFileName(), testK32GetModuleInformation(), testNestedLoadLibraryA(), wined3d_adapter_init(), WINMM_CheckForMMSystem(), wmain(), write_resource_file(), write_typelib(), and zipfldr_loaded().

◆ GetModuleHandleExA()

BOOL WINAPI GetModuleHandleExA ( IN DWORD  dwFlags,
IN LPCSTR lpModuleName  OPTIONAL,
OUT HMODULE phModule 
)

Definition at line 896 of file loader.c.

899{
900 PUNICODE_STRING lpModuleNameW;
901 DWORD dwValid;
902 BOOL Ret;
903
904 /* Validate parameters */
905 dwValid = BasepGetModuleHandleExParameterValidation(dwFlags, (LPCWSTR)lpModuleName, phModule);
906
907 /* If result is invalid parameter - return failure */
909
910 /* If result is 2, there is no need to do anything - return success. */
912
913 /* Check if we don't need to convert the name */
914 if (dwFlags & GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS)
915 {
916 /* Call the extended version of the API without conversion */
918 dwFlags,
919 (LPCWSTR)lpModuleName,
920 phModule);
921 }
922 else
923 {
924 /* Convert module name to unicode */
925 lpModuleNameW = Basep8BitStringToStaticUnicodeString(lpModuleName);
926
927 /* Return FALSE if conversion failed */
928 if (!lpModuleNameW) return FALSE;
929
930 /* Call the extended version of the API */
932 dwFlags,
933 lpModuleNameW->Buffer,
934 phModule);
935 }
936
937 /* Return result */
938 return Ret;
939}
BOOLEAN WINAPI BasepGetModuleHandleExW(BOOLEAN NoLock, DWORD dwPublicFlags, LPCWSTR lpwModuleName, HMODULE *phModule)
Definition: loader.c:716
unsigned int BOOL
Definition: ntddk_ex.h:94
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by testGetModuleHandleEx().

◆ GetModuleHandleExW()

BOOL WINAPI GetModuleHandleExW ( IN DWORD  dwFlags,
IN LPCWSTR lpwModuleName  OPTIONAL,
OUT HMODULE phModule 
)

Definition at line 866 of file loader.c.

869{
870 DWORD dwValid;
871 BOOL Ret;
872
873 /* Validate parameters */
874 dwValid = BasepGetModuleHandleExParameterValidation(dwFlags, lpwModuleName, phModule);
875
876 /* If result is invalid parameter - return failure */
878
879 /* If result is 2, there is no need to do anything - return success. */
881
882 /* Use common helper routine */
884 dwFlags,
885 lpwModuleName,
886 phModule);
887
888 return Ret;
889}

Referenced by cache_connection(), ATL::CAtlBaseModule::CAtlBaseModule(), ATL::CAtlComModule::CAtlComModule(), check_hook_thread(), DllMain(), GPNotificationThreadProc(), http_release_netconn(), LookupThreadProc(), testGetModuleHandleEx(), and wined3d_cs_create().

◆ GetModuleHandleForUnicodeString()

HMODULE WINAPI GetModuleHandleForUnicodeString ( PUNICODE_STRING  ModuleName)

Definition at line 667 of file loader.c.

668{
670 PVOID Module;
672
673 /* Try to get a handle with a magic value of 1 for DllPath */
675
676 /* If that succeeded - we're done */
677 if (NT_SUCCESS(Status)) return Module;
678
679 /* If not, then the path should be computed */
681 if (!DllPath)
682 {
684 }
685 else
686 {
688 {
690 }
692 {
693 /* Fail with the SEH error */
695 }
696 _SEH2_END;
697 }
698
699 /* Free the DllPath */
700 RtlFreeHeap(RtlGetProcessHeap(), 0, DllPath);
701
702 /* In case of error set last win32 error and return NULL */
703 if (!NT_SUCCESS(Status))
704 {
705 DPRINT("Failure acquiring DLL module '%wZ' handle, Status 0x%08X\n", ModuleName, Status);
707 Module = 0;
708 }
709
710 /* Return module */
711 return (HMODULE)Module;
712}
LPWSTR WINAPI BaseComputeProcessDllPath(IN LPWSTR FullPath, IN PVOID Environment)
Definition: path.c:420
NTSTATUS NTAPI LdrGetDllHandle(_In_opt_ PWSTR DllPath, _In_opt_ PULONG DllCharacteristics, _In_ PUNICODE_STRING DllName, _Out_ PVOID *DllHandle)
Definition: ldrapi.c:770
static const char const char * DllPath
Definition: image.c:34
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by BasepGetModuleHandleExW().

◆ GetModuleHandleW()

HMODULE WINAPI GetModuleHandleW ( LPCWSTR  lpModuleName)

Definition at line 838 of file loader.c.

839{
842
843 /* If current module is requested - return it right away */
844 if (!lpModuleName)
845 return ((HMODULE)NtCurrentPeb()->ImageBaseAddress);
846
847 /* Use common helper routine */
849 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
850 lpModuleName,
851 &hModule);
852
853 /* If it wasn't successful - return NULL */
854 if (!Success) hModule = NULL;
855
856 /* Return the handle */
857 return hModule;
858}
@ Success
Definition: eventcreate.c:712

Referenced by _CorExeMain(), CBandSiteMenu::_CreateMenuPart(), CBandSiteMenu::_CreateNewISFBand(), _DoDLLInjection(), CBandSiteBase::_OnContextMenu(), _SHCreateDesktop(), _SHDesktopMessageLoop(), _ShellDDEInit(), CBandSiteMenu::_ShowToolbarError(), AddCustomItem(), AddListViewItems(), AddTextButton(), AllocAndLoadString(), ApplicationPageOnNotify(), ask_confirm(), ask_overwrite_value(), AtlAxWinInit(), cleanup(), CMenuBand_CreateInstance(), Confirm(), ConSetThreadUILanguage(), CDeviceManager::Create(), create_clipbrd_window(), create_listview_controlW(), create_parent_window(), create_syslink(), create_test_windows(), device_tests(), dialog_about(), dialog_viewproperties(), DllMain(), DoCreateWindow(), DoEntry(), DoLoadStrings(), DoTest_BUTTON(), DoTest_EDIT(), DrawThemeText(), EnumerateConnectedDrives(), EnumJoysticks(), EnumProcessAndPrint(), EnumResourceLanguagesW(), EnumResourceNamesW(), EnumResourceTypesW(), EnumWindowsProc(), error_exit(), execute_test(), exit(), extract_resource(), fetch_shlwapi_ordinal(), FILEDLG95_MRU_load_filename(), FILEDLG95_MRU_save_filename(), CMenuSFToolbar::FillToolbar(), FindResourceExA(), FindResourceExW(), FinishDlgProc(), get_print_file_filter(), BtrfsContextMenu::get_uac_icon(), GetComCtl32Version(), GetLocalsplFuncs(), GetModuleHandleA(), GetOwnerModuleFromTagEntry(), GetProc(), GetResource(), GetSeconds(), GetSpoolssFunc(), GetSystemCPU(), CConfiguration::GetSystemInformation(), ie_dialog_about(), Imm32CheckAndApplyAppCompat(), Imm32CopyImeFile(), Imm32LoadImeVerInfo(), ImmGetContextThreadFunc(), init(), init_dbghelp_version(), init_preview(), InitializeAPI(), InitSystemUptime(), InitThreads(), InitTreeViewImageLists(), InnerWindowProc(), IntInitializeImmEntryTable(), IsWindowsVerifierOn(), IsWininetLoaded(), IsWinsockLoaded(), joystick_tests(), keyboard_tests(), LayoutShowGrip(), load_message(), LsapInitSids(), LsarpLookupPrivilegeDisplayName(), MCIWndCreateW(), MessageBoxWithResStringW(), mouse_tests(), msg_spy_init(), MyCreateEditCtrl(), MyCreateWindow(), newfile_proc(), OLEClipbrd_UnInitialize(), OnCommand(), OnCreate(), output_error(), output_message(), output_value(), paraformat_proc(), preview_exit(), preview_proc(), PrintMessage(), PrintMessageV(), PrintNetMessage(), PROPSHEET_DialogProc(), CISFBand::QueryContextMenu(), ReadString(), register_iewindow_class(), register_notifyformat_class(), register_parent_wnd_class(), RegisterClassExWOWW(), RegisterWindowClasses(), RichEditOleCallback_GetContextMenu(), run_test(), SampInitializeSAM(), ShowLastError(), START_TEST(), taskkill_message(), taskkill_message_printfW(), Test1(), test_actctx_classes(), test_ApplyButtonDisabled(), test_builtinproc(), test_default_ime_disabled_cb(), test_default_ime_window_cancel_cb(), test_default_ime_window_cb(), test_default_ime_with_message_only_window_cb(), test_directory_filename(), test_enum_feedback(), test_find_resource(), test_GetInterfaceName(), test_icons(), test_ime_processkey(), test_ImmDefaultHwnd(), TEST_Init(), test_Input_unicode(), test_LoadImage(), test_longtextW(), test_message_conversion(), test_null_filename(), test_rtti(), Test_SetCursorPos(), test_track(), test_wm_notifyformat(), test_write_watch(), TestManualInstantiation(), TestSoftModalMsgBox(), toggle_num_pages(), UnloadAppInitDlls(), update_preview_statusbar(), UpdatePerUserImmEnabling(), User32CallEventProcFromKernel(), User32CallHookProcFromKernel(), User32CreateWindowEx(), UserpFormatMessages(), WhoamiLoadRcString(), WinMain(), wWinMain(), and XCOPY_LoadMessage().

◆ GetProcAddress()

FARPROC WINAPI GetProcAddress ( HMODULE  hModule,
LPCSTR  lpProcName 
)

Definition at line 401 of file loader.c.

402{
403 ANSI_STRING ProcedureName, *ProcNamePtr = NULL;
404 FARPROC fnExp = NULL;
406 PVOID hMapped;
407 ULONG Ordinal = 0;
408
409 if ((ULONG_PTR)lpProcName > MAXUSHORT)
410 {
411 /* Look up by name */
412 RtlInitAnsiString(&ProcedureName, (LPSTR)lpProcName);
413 ProcNamePtr = &ProcedureName;
414 }
415 else
416 {
417 /* Look up by ordinal */
418 Ordinal = PtrToUlong(lpProcName);
419 }
420
421 /* Map provided handle */
423
424 /* Get the proc address */
426 ProcNamePtr,
427 Ordinal,
428 (PVOID*)&fnExp);
429
430 if (!NT_SUCCESS(Status))
431 {
433 return NULL;
434 }
435
436 /* Check for a special case when returned pointer is
437 the same as image's base address */
438 if (fnExp == hMapped)
439 {
440 /* Set correct error code */
441 if (HIWORD(lpProcName) != 0)
443 else
445
446 return NULL;
447 }
448
449 /* All good, return procedure pointer */
450 return fnExp;
451}
int(* FARPROC)()
Definition: compat.h:36
#define PtrToUlong(u)
Definition: config.h:107
NTSTATUS NTAPI LdrGetProcedureAddress(_In_ PVOID BaseAddress, _In_opt_ _When_(Ordinal==0, _Notnull_) PANSI_STRING Name, _In_opt_ _When_(Name==NULL, _In_range_(>, 0)) ULONG Ordinal, _Out_ PVOID *ProcedureAddress)
Definition: ldrapi.c:789
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define STATUS_ORDINAL_NOT_FOUND
Definition: ntstatus.h:548
#define STATUS_ENTRYPOINT_NOT_FOUND
Definition: ntstatus.h:549
#define MAXUSHORT
Definition: typedefs.h:83
#define HIWORD(l)
Definition: typedefs.h:247
char * LPSTR
Definition: xmlstorage.h:182

◆ LoadLibraryA()

HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA ( LPCSTR  lpLibFileName)

Definition at line 111 of file loader.c.

112{
113 static const CHAR TwainDllName[] = "twain_32.dll";
114 LPSTR PathBuffer;
115 UINT Len;
117
118 /* Treat twain_32.dll in a special way (what a surprise...) */
119 if (lpLibFileName && !_strcmpi(lpLibFileName, TwainDllName))
120 {
121 /* Allocate space for the buffer */
122 PathBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, MAX_PATH + sizeof(ANSI_NULL));
123 if (PathBuffer)
124 {
125 /* Get windows dir in this buffer */
126 Len = GetWindowsDirectoryA(PathBuffer, MAX_PATH);
127 if ((Len != 0) && (Len < (MAX_PATH - sizeof(TwainDllName) - sizeof('\\'))))
128 {
129 /* We successfully got windows directory. Concatenate twain_32.dll to it */
130 PathBuffer[Len] = '\\';
131 strcpy(&PathBuffer[Len + 1], TwainDllName);
132
133 /* And recursively call ourselves with a new string */
134 Result = LoadLibraryA(PathBuffer);
135
136 /* If it was successful - free memory and return result */
137 if (Result)
138 {
139 RtlFreeHeap(RtlGetProcessHeap(), 0, PathBuffer);
140 return Result;
141 }
142 }
143
144 /* Free allocated buffer */
145 RtlFreeHeap(RtlGetProcessHeap(), 0, PathBuffer);
146 }
147 }
148
149 /* Call the Ex version of the API */
150 return LoadLibraryExA(lpLibFileName, 0, 0);
151}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define Len
Definition: deflate.h:82
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:159
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2337
unsigned int UINT
Definition: ndis.h:50
#define ANSI_NULL
_Check_return_ _CRTIMP int __cdecl _strcmpi(_In_z_ const char *_Str1, _In_z_ const char *_Str2)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
char CHAR
Definition: xmlstorage.h:175

Referenced by __delayLoadHelper2(), _loaddll(), CallCommonPropertySheetUI(), child_process(), create_printer_dc(), CreatePrinterFriendlyName(), CRYPT_CreateKeyProv(), Direct3DCreate9(), DliFailHook(), DliHook(), dll_entry_point(), DP_LoadSP(), EnableDialogTheme(), ExceptionFilter(), Extract(), ExtractFilesA(), FGetComponentPath(), get_corversion(), GetFileNamePreview(), GetUIVersion(), init(), Init(), init_function_pointers(), init_function_ptrs(), init_functionpointers(), init_functions(), init_pointers(), init_test_functions(), init_tests(), InitFuncPtrs(), InitFunctionPtr(), InitFunctionPtrs(), load_d3dcompiler(), load_d3dcompiler_43(), load_d3dcompiler_47(), load_functions(), load_v6_module(), LoadCABINETDll(), LoadCOM(), loadIPHlpApi(), LoadLibraryA(), LoadLibraryList(), LoadShimDLL(), MACRO_RegisterRoutine(), MCICDA_drvOpen(), MLLoadLibraryA(), msi_dialog_scrolltext_control(), parse_url_from_outside(), prepare_test(), profile_items_callback(), propvar_changetype(), rand_s(), RegisterDeviceNotificationW(), SHDOCVW_LoadShell32(), START_TEST(), test_AdvInstallFile(), test_DeviceCapabilities(), test_filenames(), test_GetModuleInformation(), test_IgnoreFreeLibrary(), test_image_mapping(), test_import_resolution(), test_Input_unicode(), test_LdrAddRefDll(), test_Loader(), test_LoadIconWithScaleDown(), Test_LoadUnload(), test_onefile(), test_res_protocol(), test_ResolveDelayLoadedAPI(), test_section_access(), test_SetDefaultDllDirectories(), test_shell_imagelist(), test_typelib(), test_WICCreateBitmapFromSectionEx(), testGetModuleHandleEx(), testLoadLibraryA(), testLoadLibraryA_Wrong(), testNestedLoadLibraryA(), ThirdPartyVDDBop(), twain_add_onedriver(), TWAIN_OpenDS(), UIINSERTOBJECTDLG_AddControl(), UnregisterDeviceNotification(), use_common(), vmr_create(), WhichPlatform(), wine_dlopen(), WinMain(), WsNpInitialize(), and WspiapiLoad().

◆ LoadLibraryExA()

HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExA ( LPCSTR  lpLibFileName,
HANDLE  hFile,
DWORD  dwFlags 
)

Definition at line 159 of file loader.c.

162{
163 PUNICODE_STRING FileNameW;
164
165 /* Convert file name to unicode */
166 if (!(FileNameW = Basep8BitStringToStaticUnicodeString(lpLibFileName)))
167 return NULL;
168
169 /* And call W version of the API */
170 return LoadLibraryExW(FileNameW->Buffer, hFile, dwFlags);
171}
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288

Referenced by extract_test_proc(), LoadLibraryA(), LoadModuleWithSymbolsFullPath(), map_image_section(), SHPinDllOfCLSID(), START_TEST(), test_import_resolution(), test_Loader(), test_LoadLibraryEx_search_flags(), test_SetDefaultDllDirectories(), and testLoadLibraryEx().

◆ LoadLibraryExW()

HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW ( LPCWSTR  lpLibFileName,
HANDLE  hFile,
DWORD  dwFlags 
)

Definition at line 288 of file loader.c.

291{
292 UNICODE_STRING DllName;
296 ULONG DllCharacteristics = 0;
297 BOOL FreeString = FALSE;
298
299 /* Check for any flags LdrLoadDll might be interested in */
301 {
302 /* Tell LDR to treat it as an EXE */
303 DllCharacteristics = IMAGE_FILE_EXECUTABLE_IMAGE;
304 }
305
306 /* Build up a unicode dll name from null-terminated string */
307 RtlInitUnicodeString(&DllName, (LPWSTR)lpLibFileName);
308
309 /* Lazy-initialize BasepExeLdrEntry */
310 if (!BasepExeLdrEntry)
312
313 /* Check if that module is our exe*/
316 {
317 /* Lengths match and it's not a datafile, so perform name comparison */
319 {
320 /* That's us! */
322 }
323 }
324
325 /* Check for trailing spaces and remove them if necessary */
326 if (DllName.Buffer[DllName.Length/sizeof(WCHAR) - 1] == L' ')
327 {
328 RtlCreateUnicodeString(&DllName, (LPWSTR)lpLibFileName);
329 while (DllName.Length > sizeof(WCHAR) &&
330 DllName.Buffer[DllName.Length/sizeof(WCHAR) - 1] == L' ')
331 {
332 DllName.Length -= sizeof(WCHAR);
333 }
334 DllName.Buffer[DllName.Length/sizeof(WCHAR)] = UNICODE_NULL;
335 FreeString = TRUE;
336 }
337
338 /* Compute the load path */
340 DllName.Buffer : NULL,
341 NULL);
342 if (!SearchPath)
343 {
344 /* Getting DLL path failed, so set last error, free mem and return */
346 if (FreeString) RtlFreeUnicodeString(&DllName);
347 return NULL;
348 }
349
351 {
353 {
354 /* If the image is loaded as a datafile, try to get its handle */
355 Status = LdrGetDllHandleEx(0, SearchPath, NULL, &DllName, (PVOID*)&hInst);
356 if (!NT_SUCCESS(Status))
357 {
358 /* It's not loaded yet - so load it up */
360 }
361 _SEH2_YIELD(goto done;)
362 }
363
364 /* Call the API Properly */
366 &DllCharacteristics,
367 &DllName,
368 (PVOID*)&hInst);
369 }
371 {
373 } _SEH2_END;
374
375
376done:
377 /* Free SearchPath buffer */
378 RtlFreeHeap(RtlGetProcessHeap(), 0, SearchPath);
379
380 /* Free DllName string if it was dynamically allocated */
381 if (FreeString) RtlFreeUnicodeString(&DllName);
382
383 /* Set last error in failure case */
384 if (!NT_SUCCESS(Status))
385 {
386 DPRINT1("LoadLibraryExW(%ls) failing with status %lx\n", lpLibFileName, Status);
388 return NULL;
389 }
390
391 /* Return loaded module handle */
392 return hInst;
393}
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static NTSTATUS BasepLoadLibraryAsDatafile(PWSTR Path, LPCWSTR Name, HMODULE *hModule)
Definition: loader.c:188
PLDR_DATA_TABLE_ENTRY BasepExeLdrEntry
Definition: proc.c:25
VOID NTAPI BasepLocateExeLdrEntry(IN PLDR_DATA_TABLE_ENTRY Entry, IN PVOID Context, OUT BOOLEAN *StopEnumeration)
Definition: utils.c:156
HINSTANCE hInst
Definition: dxdiag.c:13
NTSTATUS NTAPI LdrGetDllHandleEx(_In_ ULONG Flags, _In_opt_ PWSTR DllPath, _In_opt_ PULONG DllCharacteristics, _In_ PUNICODE_STRING DllName, _Out_opt_ PVOID *DllHandle)
Definition: ldrapi.c:505
NTSTATUS NTAPI DECLSPEC_HOTPATCH LdrLoadDll(_In_opt_ PWSTR SearchPath, _In_opt_ PULONG DllCharacteristics, _In_ PUNICODE_STRING DllName, _Out_ PVOID *BaseAddress)
Definition: ldrapi.c:312
NTSTATUS NTAPI LdrEnumerateLoadedModules(_Reserved_ ULONG ReservedFlag, _In_ PLDR_ENUM_CALLBACK EnumProc, _In_opt_ PVOID Context)
Definition: ldrapi.c:1090
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define UNICODE_NULL
#define IMAGE_FILE_EXECUTABLE_IMAGE
Definition: pedump.c:160
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
uint16_t * PWSTR
Definition: typedefs.h:56
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:342
#define LOAD_WITH_ALTERED_SEARCH_PATH
Definition: winbase.h:344
#define SearchPath
Definition: winbase.h:3900
#define DONT_RESOLVE_DLL_REFERENCES
Definition: winbase.h:341

Referenced by _CrtGetUser32(), add_zone_to_listview(), CoLoadLibrary(), COMPOBJ_DllList_Add(), CClassNode::ConvertResourceDescriptorToString(), CURSORICON_CopyImage(), DIALOG_SYMBOL_DlgProc(), do_register_dll(), DoExtractIcon(), DoLoadIcons(), EngLoadModule(), get_shdoclc(), GetFileVersionInfoExW(), GetFileVersionInfoSizeExW(), GetMessageStringFromDll(), GetServiceDllFunction(), Imm32GetFn(), load_xul(), LoadIMEIcon(), LoadLibraryExA(), LoadLibraryW(), LoadProc(), msi_load_library(), MSSTYLES_OpenThemeFile(), register_ocxs_callback(), RegisterOCX(), RegLoadMUIStringW(), ATL::CRegObject::resource_register(), resource_register(), ResProtocol_Start(), ResProtocolInfo_ParseUrl(), RunDlgProc(), SHCoCreateInstance(), SHGetShellStyleHInstance(), SHLoadIndirectString(), START_TEST(), test_LoadImage_DataFile(), TestDllRedirection(), TLB_PEFile_Open(), User32CallEventProcFromKernel(), User32CallHookProcFromKernel(), and WndProc().

◆ LoadLibraryW()

HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryW ( LPCWSTR  lpLibFileName)

Definition at line 179 of file loader.c.

180{
181 /* Call Ex version of the API */
182 return LoadLibraryExW(lpLibFileName, 0, 0);
183}

◆ LoadModule()

DWORD WINAPI LoadModule ( LPCSTR  lpModuleName,
LPVOID  lpParameterBlock 
)

Definition at line 947 of file loader.c.

949{
950 STARTUPINFOA StartupInfo;
951 PROCESS_INFORMATION ProcessInformation;
952 LOADPARMS32 *LoadParams;
953 char FileName[MAX_PATH];
954 LPSTR CommandLine;
956 BOOL ProcessStatus;
957 ANSI_STRING AnsiStr;
958 UNICODE_STRING UnicStr;
961
962 LoadParams = (LOADPARMS32*)lpParameterBlock;
963
964 /* Check load parameters */
965 if (LoadParams->dwReserved || LoadParams->wMagicValue != 2)
966 {
967 /* Fail with invalid param error */
969 return 0;
970 }
971
972 /* Search path */
973 Length = SearchPathA(NULL, lpModuleName, ".exe", MAX_PATH, FileName, NULL);
974
975 /* Check if path was found */
976 if (Length && Length < MAX_PATH)
977 {
978 /* Build StartupInfo */
979 RtlZeroMemory(&StartupInfo, sizeof(StartupInfo));
980
981 StartupInfo.cb = sizeof(STARTUPINFOA);
982 StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
983 StartupInfo.wShowWindow = LoadParams->wCmdShow;
984
985 /* Allocate command line buffer */
986 CommandLine = RtlAllocateHeap(RtlGetProcessHeap(),
988 (ULONG)LoadParams->lpCmdLine[0] + Length + 2);
989
990 /* Put module name there, then a space, and then copy provided command line,
991 and null-terminate it */
992 RtlCopyMemory(CommandLine, FileName, Length);
993 CommandLine[Length] = ' ';
994 RtlCopyMemory(&CommandLine[Length + 1], &LoadParams->lpCmdLine[1], (ULONG)LoadParams->lpCmdLine[0]);
995 CommandLine[Length + 1 + (ULONG)LoadParams->lpCmdLine[0]] = 0;
996
997 /* Create the process */
998 ProcessStatus = CreateProcessA(FileName,
999 CommandLine,
1000 NULL,
1001 NULL,
1002 FALSE,
1003 0,
1004 LoadParams->lpEnvAddress,
1005 NULL,
1006 &StartupInfo,
1007 &ProcessInformation);
1008
1009 /* Free the command line buffer */
1010 RtlFreeHeap(RtlGetProcessHeap(), 0, CommandLine);
1011
1012 if (!ProcessStatus)
1013 {
1014 /* Creating process failed, return right error code */
1015 Error = GetLastError();
1016 switch(Error)
1017 {
1019 return ERROR_BAD_FORMAT;
1020
1023 return Error;
1024 }
1025
1026 /* Return 0 otherwise */
1027 return 0;
1028 }
1029
1030 /* Wait up to 30 seconds for the process to become idle */
1032 {
1033 UserWaitForInputIdleRoutine(ProcessInformation.hProcess, 30000);
1034 }
1035
1036 /* Close handles */
1037 NtClose(ProcessInformation.hThread);
1038 NtClose(ProcessInformation.hProcess);
1039
1040 /* Return magic success value (33) */
1041 return 33;
1042 }
1043
1044 /* The path was not found, create an ansi string from
1045 the module name and convert it to unicode */
1046 RtlInitAnsiString(&AnsiStr, lpModuleName);
1047 if (!NT_SUCCESS(RtlAnsiStringToUnicodeString(&UnicStr,&AnsiStr,TRUE)))
1048 return ERROR_FILE_NOT_FOUND;
1049
1050 /* Determine path type */
1052
1053 /* Free the unicode module name */
1054 RtlFreeUnicodeString(&UnicStr);
1055
1056 /* If it's a relative path, return file not found */
1058 return ERROR_FILE_NOT_FOUND;
1059
1060 /* If not, try to open it */
1061 Handle = CreateFile(lpModuleName,
1064 NULL,
1067 NULL);
1068
1070 {
1071 /* Opening file succeeded for some reason, close the handle and return file not found anyway */
1073 return ERROR_FILE_NOT_FOUND;
1074 }
1075
1076 /* Return last error which CreateFile set during an attempt to open it */
1077 return GetLastError();
1078}
static IN ULONG IN PWSTR OUT PCWSTR OUT PBOOLEAN OUT PATH_TYPE_AND_UNKNOWN * PathType
BOOL Error
Definition: chkdsk.c:66
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
DWORD WINAPI SearchPathA(IN LPCSTR lpPath OPTIONAL, IN LPCSTR lpFileName, IN LPCSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart OPTIONAL)
Definition: path.c:1123
WaitForInputIdleType UserWaitForInputIdleRoutine
Definition: proc.c:20
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4741
ULONG Handle
Definition: gdb_input.c:15
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
NTSYSAPI RTL_PATH_TYPE NTAPI RtlDetermineDosPathNameType_U(_In_ PCWSTR Path)
@ RtlPathTypeRelative
Definition: rtltypes.h:476
enum _RTL_PATH_TYPE RTL_PATH_TYPE
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
DWORD dwFlags
Definition: winbase.h:842
DWORD cb
Definition: winbase.h:831
WORD wShowWindow
Definition: winbase.h:843
LPSTR lpEnvAddress
Definition: kernel32.h:73
DWORD dwReserved
Definition: kernel32.h:77
WORD wCmdShow
Definition: kernel32.h:76
LPSTR lpCmdLine
Definition: kernel32.h:74
WORD wMagicValue
Definition: kernel32.h:75
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _STARTUPINFOA STARTUPINFOA
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define STARTF_USESHOWWINDOW
Definition: winbase.h:491
#define CreateFile
Definition: winbase.h:3749
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define ERROR_BAD_EXE_FORMAT
Definition: winerror.h:251
#define ERROR_BAD_FORMAT
Definition: winerror.h:114

◆ UTRegister()

BOOL WINAPI UTRegister ( HMODULE  hModule,
LPSTR  lpsz16BITDLL,
LPSTR  lpszInitName,
LPSTR  lpszProcName,
FARPROC ppfn32Thunk,
FARPROC  pfnUT32CallBack,
LPVOID  lpBuff 
)

Definition at line 1092 of file loader.c.

1096{
1097 STUB;
1098 return 0;
1099}

◆ UTUnRegister()

VOID WINAPI UTUnRegister ( HMODULE  hModule)

Definition at line 1104 of file loader.c.

1105{
1106 STUB;
1107}