Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

GetDeviceDriverBaseName function

Retrieves the base name of the specified device driver.

Syntax


DWORD WINAPI GetDeviceDriverBaseName(
  _In_   LPVOID ImageBase,
  _Out_  LPTSTR lpBaseName,
  _In_   DWORD nSize
);

Parameters

ImageBase [in]

The load address of the device driver. This value can be retrieved using the EnumDeviceDrivers function.

lpBaseName [out]

A pointer to the buffer that receives the base name of the device driver.

nSize [in]

The size of the lpBaseName buffer, in characters. If the buffer is not large enough to store the base name plus the terminating null character, the string is truncated.

Return value

If the function succeeds, the return value specifies the length of the string copied to the buffer, not including any terminating null character.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Starting with Windows 7 and Windows Server 2008 R2, Psapi.h establishes version numbers for the PSAPI functions. The PSAPI version number affects the name used to call the function and the library that a program must load.

If PSAPI_VERSION is 2 or greater, this function is defined as K32GetDeviceDriverBaseName in Psapi.h and exported in Kernel32.lib and Kernel32.dll. If PSAPI_VERSION is 1, this function is defined as GetDeviceDriverBaseName in Psapi.h and exported in Psapi.lib and Psapi.dll as a wrapper that calls K32GetDeviceDriverBaseName.

Programs that must run on earlier versions of Windows as well as Windows 7 and later versions should always call this function as GetDeviceDriverBaseName. To ensure correct resolution of symbols, add Psapi.lib to the TARGETLIBS macro and compile the program with –DPSAPI_VERSION=1. To use run-time dynamic linking, load Psapi.dll.

Examples

For an example, see Enumerating all Device Drivers in the System.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Psapi.h

Library

Kernel32.lib on Windows 7 and Windows Server 2008 R2;
Psapi.lib (if PSAPI_VERSION=1) on Windows 7 and Windows Server 2008 R2;
Psapi.lib on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP

DLL

Kernel32.dll on Windows 7 and Windows Server 2008 R2;
Psapi.dll (if PSAPI_VERSION=1) on Windows 7 and Windows Server 2008 R2;
Psapi.dll on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP

Unicode and ANSI names

GetDeviceDriverBaseNameW (Unicode) and GetDeviceDriverBaseNameA (ANSI)

See also

Device Driver Information
EnumDeviceDrivers
PSAPI Functions

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.