ReactOS 0.4.16-dev-1946-g52006dd
library.c File Reference
#include "wdfloader.h"
Include dependency graph for library.c:

Go to the source code of this file.

Functions

VOID LibraryFree (_In_ PLIBRARY_MODULE LibModule)
 
 _Requires_exclusive_lock_held_ (WdfLdrGlobals.LoadedModulesListLock) NTSTATUS LibraryCreate(_In_opt_ PWDF_LIBRARY_INFO LibraryInfo
 Creates a new KMDF library (wdf01000)
 
 DPRINT_TRACE_ENTRY ()
 
 if (!ServicePath||!OutLibraryModule)
 
 if (LibModule==NULL)
 
 if (!NT_SUCCESS(status))
 
 if (LibraryInfo)
 
 if (!LibModule->ServicePath.Buffer)
 
 RtlCopyMemory (LibModule->ServicePath.Buffer, ServicePath->Buffer, ServicePath->Length)
 
 if (NT_SUCCESS(status))
 
 DPRINT_ERROR (("GetImageInfo failed with status 0x%x\n", status))
 
 DPRINT_TRACE_EXIT ()
 
NTSTATUS LibraryOpen (_Inout_ PLIBRARY_MODULE LibModule, _In_ PCUNICODE_STRING ObjectName)
 Opens KMDF library's driver object by its name and fills some library structure data.
 
VOID LibraryClose (_Inout_ PLIBRARY_MODULE LibModule)
 Dereferences KMDF library's device object.
 
NTSTATUS LibraryFindOrLoad (_In_ PCUNICODE_STRING ServicePath, _Out_ PLIBRARY_MODULE *LibModule)
 
VOID LibraryReference (_In_ PLIBRARY_MODULE LibModule)
 
VOID NTAPI LibraryReleaseReference (_In_ PLIBRARY_MODULE LibModule)
 Release a reference to a library module.
 
VOID LibraryDereference (_In_ PLIBRARY_MODULE LibModule)
 
VOID LibraryUnload (_In_ PLIBRARY_MODULE LibModule)
 
BOOLEAN LibraryAcquireClientLock (_In_ PLIBRARY_MODULE LibModule)
 
VOID LibraryReleaseClientLock (_In_ PLIBRARY_MODULE LibModule)
 
static VOID ClientFree (_In_ PCLIENT_MODULE ClientModule)
 
NTSTATUS LibraryLinkInClient (_In_ PLIBRARY_MODULE LibModule, _In_ PUNICODE_STRING ServicePath, _In_ PWDF_BIND_INFO BindInfo, _In_ PVOID Context, _Out_ PCLIENT_MODULE *OutClientModule)
 Create client module and add it to library client list.
 
static VOID LibraryClientDereference (_In_ PLIBRARY_MODULE LibModule)
 
BOOLEAN LibraryUnlinkClient (_In_ PLIBRARY_MODULE LibModule, _In_ PWDF_BIND_INFO BindInfo)
 
 _Requires_lock_held_ (WdfLdrGlobals.LoadedModulesListLock) PLIBRARY_MODULE FindLibraryByServicePathLocked(_In_ PCUNICODE_STRING ServicePath)
 
 if (!RegistryPath||!Library)
 
 for (PLIST_ENTRY entry=WdfLdrGlobals.LoadedModulesList.Flink;entry !=&WdfLdrGlobals.LoadedModulesList;entry=entry->Flink)
 

Variables

_In_ PCUNICODE_STRING ServicePath
 
_In_ PCUNICODE_STRING _Out_ PLIBRARY_MODULEOutLibraryModule
 
PLIBRARY_MODULE LibModule = NULL
 
LibModule LibraryRefCount = 1
 
LibModule ImplicitlyLoaded = (LibraryInfo == NULL)
 
LibModule IsBootDriver = ServiceCheckBootStart((PUNICODE_STRING)ServicePath)
 
LibModule LoaderThread = KeGetCurrentThread()
 
 status = ExInitializeResourceLite(&LibModule->ClientsListLock)
 
LibModule ServicePath Buffer
 
LibModule ServicePath MaximumLength = ServicePath->MaximumLength
 
LibModule ServicePath Length = ServicePath->Length
 
Failure __pad0__
 
_Out_ PLIBRARY_MODULELibrary
 
UNICODE_STRING imageName = { 0 }
 
PLIBRARY_MODULE foundModule = NULL
 
Exit __pad1__
 

Function Documentation

◆ _Requires_exclusive_lock_held_()

_Requires_exclusive_lock_held_ ( WdfLdrGlobals.  LoadedModulesListLock)

Creates a new KMDF library (wdf01000)

Parameters
[in]LibraryInfoThe library information (version and functons)
[in]ServicePathThe registry path for the KMDF driver
Returns
The Pointer to the created library or NULL.

◆ _Requires_lock_held_()

_Requires_lock_held_ ( WdfLdrGlobals.  LoadedModulesListLock)

Definition at line 515 of file library.c.

519{
521 UNICODE_STRING needleName;
522
523 GetNameFromPath(ServicePath, &needleName);
524
527 entry = entry->Flink)
528 {
529 UNICODE_STRING haystackName;
530 PLIBRARY_MODULE currentLib = CONTAINING_RECORD(entry, LIBRARY_MODULE, LibraryListEntry);
531 GetNameFromPath(&currentLib->ServicePath, &haystackName);
532
533 if (RtlEqualUnicodeString(&needleName, &haystackName, TRUE))
534 {
535 foundModule = currentLib;
536 break;
537 }
538 }
539
540 return foundModule;
541}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
VOID GetNameFromPath(_In_ PCUNICODE_STRING Path, _Out_ PUNICODE_STRING Name)
Definition: fxtelemetry.cpp:54
uint32_t entry
Definition: isohybrid.c:63
PLIBRARY_MODULE foundModule
Definition: library.c:552
_In_ PCUNICODE_STRING ServicePath
Definition: library.c:55
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
UNICODE_STRING ServicePath
Definition: wdfloader.h:113
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
LIST_ENTRY LoadedModulesList
Definition: wdfloader.h:73
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
WDF_LDR_GLOBALS WdfLdrGlobals
Definition: wdfldr.c:28

◆ ClientFree()

static VOID ClientFree ( _In_ PCLIENT_MODULE  ClientModule)
static

Definition at line 382 of file library.c.

384{
385 if (ClientModule->ImageName.Buffer)
386 {
387 RtlFreeUnicodeString(&ClientModule->ImageName);
388 }
389
390 ExFreePoolWithTag(ClientModule, WDFLDR_TAG);
391}
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define WDFLDR_TAG
Definition: wdfloader.h:17

Referenced by LibraryLinkInClient(), and LibraryUnlinkClient().

◆ DPRINT_ERROR()

DPRINT_ERROR ( ("GetImageInfo failed with status 0x%x\n", status )

◆ DPRINT_TRACE_ENTRY()

DPRINT_TRACE_ENTRY ( )

◆ DPRINT_TRACE_EXIT()

DPRINT_TRACE_EXIT ( )

◆ for()

for ( PLIST_ENTRY  entry = WdfLdrGlobals.LoadedModulesList.Flink; entry != &WdfLdrGlobals.LoadedModulesList; entry = entry->Flink)

Definition at line 575 of file library.c.

578 {
579 PLIBRARY_MODULE currentLib = CONTAINING_RECORD(entry, LIBRARY_MODULE, LibraryListEntry);
580
581 if (RtlEqualUnicodeString(&imageName, &currentLib->ImageName, TRUE))
582 {
583 foundModule = currentLib;
584 break;
585 }
586 }
UNICODE_STRING imageName
Definition: library.c:551
UNICODE_STRING ImageName
Definition: wdfloader.h:114

◆ if() [1/7]

if ( !LibModule->ServicePath.  Buffer)

Definition at line 109 of file library.c.

110 {
111 DPRINT_ERROR(("Failed to allocate service path buffer\n"));
113 goto Failure;
114 }
Definition: ps.c:97
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define DPRINT_ERROR(_x_)
Definition: wdfloader.h:39

◆ if() [2/7]

if ( NT_SUCCESSstatus)

Definition at line 87 of file library.c.

88 {
89 DPRINT_ERROR(("ExInitializeResourceLite failed with status 0x%x\n", status));
90 goto Failure;
91 }

◆ if() [3/7]

if ( !RegistryPath||!  Library)

Definition at line 556 of file library.c.

557 {
559 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

◆ if() [4/7]

if ( !ServicePath||!  OutLibraryModule)

Definition at line 62 of file library.c.

63 {
64 DPRINT_ERROR(("Invalid parameters: ServicePath=%p, OutLibraryModule=%p\n",
67 }
_In_ PCUNICODE_STRING _Out_ PLIBRARY_MODULE * OutLibraryModule
Definition: library.c:57

◆ if() [5/7]

if ( LibModule  = NULL)

Definition at line 72 of file library.c.

73 {
74 DPRINT_ERROR(("Failed to allocate library module structure\n"));
76 }

◆ if() [6/7]

if ( LibraryInfo  )

Definition at line 96 of file library.c.

97 {
98 LibModule->LibraryInfo = LibraryInfo;
99 LibModule->Version = LibraryInfo->Version;
100 DPRINT_VERBOSE(("Library info provided: Version %d.%d.%d\n",
101 LibraryInfo->Version.Major,
102 LibraryInfo->Version.Minor,
103 LibraryInfo->Version.Build));
104 }
PLIBRARY_MODULE LibModule
Definition: library.c:59
PWDF_LIBRARY_INFO LibraryInfo
Definition: wdfloader.h:119
WDF_VERSION Version
Definition: wdfloader.h:122
#define DPRINT_VERBOSE(_x_)
Definition: wdfloader.h:31

◆ if() [7/7]

if ( NT_SUCCESS(status )

Definition at line 130 of file library.c.

131 {
132 // Insert into loaded modules list. The LoadedModulesListLock is held here
134
136
137 DPRINT_VERBOSE(("Successfully created library module %wZ (Image: %wZ, Base: %p, Size: 0x%x)\n",
142
144 return STATUS_SUCCESS;
145 }
#define InsertHeadList(ListHead, Entry)
DPRINT_TRACE_EXIT()
#define STATUS_SUCCESS
Definition: shellext.h:65
PVOID ImageAddress
Definition: wdfloader.h:115
LIST_ENTRY LibraryListEntry
Definition: wdfloader.h:109

◆ LibraryAcquireClientLock()

BOOLEAN LibraryAcquireClientLock ( _In_ PLIBRARY_MODULE  LibModule)

Definition at line 365 of file library.c.

367{
370}
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
ERESOURCE ClientsListLock
Definition: wdfloader.h:121

Referenced by ClassLinkInClient(), ClassUnlinkClient(), LibraryLinkInClient(), and LibraryUnlinkClient().

◆ LibraryClientDereference()

static VOID LibraryClientDereference ( _In_ PLIBRARY_MODULE  LibModule)
static

Definition at line 461 of file library.c.

463{
465
466 __DBGPRINT(("Dereference module %wZ, %d references left\n", &LibModule->ServicePath, refs));
467
468 if (refs <= 0)
469 {
471 }
472}
#define InterlockedDecrement
Definition: armddk.h:52
long LONG
Definition: pedump.c:60
LONG ClientRefCount
Definition: wdfloader.h:110
VOID LibraryUnload()
#define __DBGPRINT(_x_)
Definition: wdfloader.h:62

Referenced by LibraryUnlinkClient().

◆ LibraryClose()

VOID LibraryClose ( _Inout_ PLIBRARY_MODULE  LibModule)

Dereferences KMDF library's device object.

Definition at line 195 of file library.c.

197{
199 {
202 }
203}
PFILE_OBJECT LibraryFileObject
Definition: wdfloader.h:117
#define ObDereferenceObject
Definition: obfuncs.h:203

Referenced by DllUnload(), LibraryDereference(), and LibraryUnload().

◆ LibraryDereference()

VOID LibraryDereference ( _In_ PLIBRARY_MODULE  LibModule)

Definition at line 300 of file library.c.

302{
303 BOOLEAN cleanupNeeded = FALSE;
304
307 {
309 {
311 InitializeListHead(&LibModule->LibraryListEntry); // Indicate removal process
312 cleanupNeeded = TRUE;
313 }
314 }
316
317 if (cleanupNeeded)
318 {
321 else
324 }
325}
unsigned char BOOLEAN
#define FALSE
Definition: types.h:117
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
VOID LibraryClose(_Inout_ PLIBRARY_MODULE LibModule)
Dereferences KMDF library's device object.
Definition: library.c:195
VOID LibraryFree(_In_ PLIBRARY_MODULE LibModule)
Definition: library.c:13
VOID FxLdrAcquireLoadedModuleLock(VOID)
Definition: common.c:13
VOID FxLdrReleaseLoadedModuleLock(VOID)
Definition: common.c:20
LONG LibraryRefCount
Definition: wdfloader.h:108

Referenced by LibraryFindOrLoad(), WdfRegisterLibrary(), WdfVersionBind(), and WdfVersionUnbind().

◆ LibraryFindOrLoad()

NTSTATUS LibraryFindOrLoad ( _In_ PCUNICODE_STRING  ServicePath,
_Out_ PLIBRARY_MODULE LibModule 
)

Definition at line 206 of file library.c.

209{
210 BOOLEAN loadNeeded = FALSE;
212
215
216 if (pLibModule == NULL)
217 {
218 // Client driver is loaded before the library, we need to create it here
219 status = LibraryCreate(NULL, ServicePath, &pLibModule);
220 if (NT_SUCCESS(status))
221 {
222 loadNeeded = TRUE;
223 }
224 }
225 else
226 {
228 }
229
230 // Reference the library
231 if (pLibModule)
233
235
236 // We've just created a library, time to load the actual driver
237 if (loadNeeded)
238 {
239 // This will call WdfRegisterLibrary (as part of KMDF's DriverEntry)
240 status = ZwLoadDriver((PUNICODE_STRING)ServicePath);
241 if (NT_SUCCESS(status) && !pLibModule->LibraryInfo)
242 {
243 __DBGPRINT(("ZwLoadDriver(%wZ) succeeded but Libray information was returned\n",
244 ServicePath));
246 }
247 else if (!NT_SUCCESS(status))
248 {
249 __DBGPRINT(("ZwLoadDriver(%wZ) failed with status %x\n", ServicePath, status));
250 }
251
252 if (!NT_SUCCESS(status))
253 {
254 LibraryDereference(pLibModule);
255 // Cleanup created library
256 ASSERT(pLibModule->LibraryInfo == NULL);
257 LibraryDereference(pLibModule);
258 pLibModule = NULL;
259 }
260 }
261
262 *LibModule = pLibModule;
263 return status;
264}
#define InterlockedIncrement
Definition: armddk.h:53
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
VOID LibraryDereference(_In_ PLIBRARY_MODULE LibModule)
Definition: library.c:300
status
Definition: library.c:86
#define ASSERT(a)
Definition: mode.c:44
#define STATUS_NOT_SAFE_MODE_DRIVER
Definition: ntstatus.h:1034
NTSTATUS LibraryCreate(_In_opt_ PWDF_LIBRARY_INFO LibraryInfo, _In_ PCUNICODE_STRING ServicePath, _Out_ PLIBRARY_MODULE *OutLibraryModule)
PLIBRARY_MODULE FindLibraryByServicePathLocked(_In_ PCUNICODE_STRING ServicePath)

Referenced by ReferenceVersion().

◆ LibraryFree()

VOID LibraryFree ( _In_ PLIBRARY_MODULE  LibModule)

Definition at line 13 of file library.c.

15{
17
18 if (!LibModule)
19 {
20 DPRINT_ERROR(("LibModule is NULL\n"));
21 return;
22 }
23
25 {
28 }
29
31 {
34 }
35
39
41}
#define ExDeleteResourceLite(res)
Definition: env_spec_w32.h:647
DPRINT_TRACE_ENTRY()
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by DllUnload(), LibraryDereference(), and LibraryUnload().

◆ LibraryLinkInClient()

NTSTATUS LibraryLinkInClient ( _In_ PLIBRARY_MODULE  LibModule,
_In_ PUNICODE_STRING  ServicePath,
_In_ PWDF_BIND_INFO  BindInfo,
_In_ PVOID  Context,
_Out_ PCLIENT_MODULE OutClientModule 
)

Create client module and add it to library client list.

Parameters
LibModuleLibrary that client is being added to
ServicePathClient driver service registry path
BindInfoBind information
ContextClient context
OutClientModuleCreated client module added to library clients list
Returns
STATUS_SUCCESS on success, error code otherwise

Definition at line 404 of file library.c.

410{
411 PCLIENT_MODULE clientModule;
413
414 clientModule = ExAllocatePoolWithTag(NonPagedPool, sizeof(*clientModule), WDFLDR_TAG);
415
416 if (clientModule == NULL)
417 {
418 __DBGPRINT(("ERROR: ExAllocatePoolWithTag failed\n"));
419 __DBGPRINT(("ERROR: Client module NOT linked\n"));
420
422 }
423
424 *clientModule = (CLIENT_MODULE){
425 .Context = Context,
426 .Info = BindInfo
427 };
428
429 InitializeListHead(&clientModule->ClassListHead);
430 InitializeListHead(&clientModule->LibListEntry);
431
432 status = GetImageName(ServicePath, &clientModule->ImageName);
433 if (NT_SUCCESS(status))
434 {
435 __DBGPRINT(("Client Image Name: %wZ\n", &clientModule->ImageName));
436
437 status = GetImageInfo(&clientModule->ImageName,
438 &clientModule->ImageAddr,
439 &clientModule->ImageSize);
440 if (!NT_SUCCESS(status))
441 {
442 __DBGPRINT(("GetImageInfo failed with status 0x%x\n", status));
443 __DBGPRINT(("ERROR: Client module NOT linked\n"));
444 ClientFree(clientModule);
445
446 return status;
447 }
448 }
449
454
455 *OutClientModule = clientModule;
456 return STATUS_SUCCESS;
457}
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
_Must_inspect_result_ NTSTATUS GetImageName(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _Out_ PUNICODE_STRING ImageName)
VOID LibraryReleaseClientLock(_In_ PLIBRARY_MODULE LibModule)
Definition: library.c:373
static VOID ClientFree(_In_ PCLIENT_MODULE ClientModule)
Definition: library.c:382
BOOLEAN LibraryAcquireClientLock(_In_ PLIBRARY_MODULE LibModule)
Definition: library.c:365
NTSTATUS GetImageInfo(_In_ PCUNICODE_STRING ImageName, _Out_ PVOID *ImageBase, _Out_ PULONG ImageSize)
Definition: common.c:182
PVOID ImageAddr
Definition: wdfloader.h:160
LIST_ENTRY LibListEntry
Definition: wdfloader.h:157
UNICODE_STRING ImageName
Definition: wdfloader.h:162
ULONG ImageSize
Definition: wdfloader.h:161
LIST_ENTRY ClassListHead
Definition: wdfloader.h:164
LIST_ENTRY ClientsListHead
Definition: wdfloader.h:120
WDF_BIND_INFO BindInfo
struct _CLIENT_MODULE CLIENT_MODULE

Referenced by WdfVersionBind().

◆ LibraryOpen()

NTSTATUS LibraryOpen ( _Inout_ PLIBRARY_MODULE  LibModule,
_In_ PCUNICODE_STRING  ObjectName 
)

Opens KMDF library's driver object by its name and fills some library structure data.

Parameters
LibModuleLibrary module to update
ObjectNameDevice object name
Returns
STATUS_SUCCESS on success, error code otherwise

Definition at line 167 of file library.c.

170{
172
173 if (ObjectName == NULL)
174 {
175 return STATUS_SUCCESS;
176 }
177
181 &deviceObject);
182
183 if (NT_SUCCESS(status))
184 {
186 }
187
188 return status;
189}
MxDeviceObject deviceObject
#define FILE_READ_DATA
Definition: nt_native.h:628
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1435
PDRIVER_OBJECT LibraryDriverObject
Definition: wdfloader.h:118
_In_ PVOID _Out_opt_ PULONG_PTR _Outptr_opt_ PCUNICODE_STRING * ObjectName
Definition: cmfuncs.h:64

Referenced by WdfRegisterLibrary().

◆ LibraryReference()

VOID LibraryReference ( _In_ PLIBRARY_MODULE  LibModule)

◆ LibraryReleaseClientLock()

VOID LibraryReleaseClientLock ( _In_ PLIBRARY_MODULE  LibModule)

Definition at line 373 of file library.c.

375{
378}
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822

Referenced by ClassLinkInClient(), ClassUnlinkClient(), LibraryLinkInClient(), and LibraryUnlinkClient().

◆ LibraryReleaseReference()

VOID NTAPI LibraryReleaseReference ( _In_ PLIBRARY_MODULE  LibModule)

Release a reference to a library module.

Definition at line 280 of file library.c.

282{
283 LONG refCount;
285
287 DPRINT_VERBOSE(("Released reference to library %wZ, RefCount=%d\n",
288 &LibModule->ServicePath, refCount));
289
290 if (refCount <= 0)
291 {
292 DPRINT(("Library %wZ reference count reached zero, unloading\n", &LibModule->ServicePath));
294 }
295
297}
#define DPRINT
Definition: sndvol32.h:73

Referenced by DereferenceVersion().

◆ LibraryUnlinkClient()

BOOLEAN LibraryUnlinkClient ( _In_ PLIBRARY_MODULE  LibModule,
_In_ PWDF_BIND_INFO  BindInfo 
)

Definition at line 475 of file library.c.

478{
480
481 // search in library clients entry to remove
482 BOOLEAN found = FALSE;
483 PCLIENT_MODULE clientModule;
486 entry = entry->Flink)
487 {
488 clientModule = CONTAINING_RECORD(entry, CLIENT_MODULE, LibListEntry);
489 if (clientModule->Info == BindInfo)
490 {
491 found = TRUE;
492 break;
493 }
494 }
495
496 if (found)
497 {
498 RemoveEntryList(&clientModule->LibListEntry);
500 }
501
503
504 if (found)
505 {
506 InitializeListHead(&clientModule->LibListEntry);
507 ClientFree(clientModule);
508 return TRUE;
509 }
510
511 __DBGPRINT(("ERROR: Client module %p, bind %p NOT found\n", LibModule, BindInfo));
512 return FALSE;
513}
static VOID LibraryClientDereference(_In_ PLIBRARY_MODULE LibModule)
Definition: library.c:461
PWDF_BIND_INFO Info
Definition: wdfloader.h:163

Referenced by DereferenceVersion(), and WdfVersionUnbind().

◆ LibraryUnload()

VOID LibraryUnload ( _In_ PLIBRARY_MODULE  LibModule)

Definition at line 328 of file library.c.

330{
332
333 /* This occurs because of how WDF ClassDrivers behave. */
335 return;
336
338
340 if (!NT_SUCCESS(status))
341 {
342 __DBGPRINT(("LibraryDecommission failed %X\n", status));
343 }
344
346
347 __DBGPRINT(("Unloading library %wZ\n", &LibModule->ServicePath));
348
350
352 if (!NT_SUCCESS(status))
353 {
354 __DBGPRINT(("unload of %wZ returned 0x%x (this may not be a true error if someone else attempted to stop"
355 " the service first)\n",
357 status));
358 }
359
360 // Free the library module directly - caller handles the cleanup sequence
362}
NTSYSAPI NTSTATUS NTAPI ZwUnloadDriver(_In_ PUNICODE_STRING DriverServiceName)
BOOLEAN IsBootDriver
Definition: wdfloader.h:111
PFNLIBRARYDECOMMISSION LibraryDecommission
Definition: fxldr.h:142

◆ RtlCopyMemory()

RtlCopyMemory ( LibModule->ServicePath.  Buffer,
ServicePath->  Buffer,
ServicePath->  Length 
)

Variable Documentation

◆ __pad0__

Failure __pad0__

Definition at line 149 of file library.c.

◆ __pad1__

Exit __pad1__

Definition at line 591 of file library.c.

◆ Buffer

Initial value:

Definition at line 106 of file library.c.

◆ foundModule

PLIBRARY_MODULE foundModule = NULL

Definition at line 552 of file library.c.

Referenced by _Requires_lock_held_(), and for().

◆ imageName

UNICODE_STRING imageName = { 0 }

Definition at line 551 of file library.c.

Referenced by _CorExeMain2(), _CorValidateImage(), for(), GetImageName(), and if().

◆ ImplicitlyLoaded

LibModule ImplicitlyLoaded = (LibraryInfo == NULL)

Definition at line 79 of file library.c.

◆ IsBootDriver

Definition at line 80 of file library.c.

◆ Length

Definition at line 117 of file library.c.

◆ LibModule

◆ Library

Initial value:

Definition at line 548 of file library.c.

◆ LibraryRefCount

LibModule LibraryRefCount = 1

Definition at line 78 of file library.c.

◆ LoaderThread

LibModule LoaderThread = KeGetCurrentThread()

Definition at line 81 of file library.c.

◆ MaximumLength

◆ OutLibraryModule

* OutLibraryModule
Initial value:

Definition at line 56 of file library.c.

Referenced by if().

◆ ServicePath

◆ status