Hardware Dev Center

DllInitialize routine

The system calls a kernel-mode DLL's DllInitialize routine immediately after the DLL is loaded.

Syntax


NTSTATUS DllInitialize(
  _In_ PUNICODE_STRING RegistryPath
);

Parameters

RegistryPath [in]

Pointer to a counted Unicode string specifying the path to the DLL's registry key, HKEY_LOCAL_MACHINE\CurrentControlSet\Services\DllName. DLL routines can use this key to store DLL-specific information. The buffer pointed to by RegistryPath is freed once DllInitialize exits. Therefore, if the DLL makes use of the key, DllInitialize must duplicate the key name.

Return value

The routine should return STATUS_SUCCESS if the DLL is successfully initialized, or the appropriate error code on failure. If the routine does not return STATUS_SUCCESS, the DLL is not loaded.

Remarks

Export drivers must provide DllInitialize routines. You can use the DllInitialize routine to acquire or initialize resources required by other routines in the DLL. For more information about export drivers, see Creating Export Drivers.

Requirements

Target platform

Desktop

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

See also

DllUnload

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft