This example uses DevQueryDeviceNames to return the names, descriptions, and data types of supported devices for a presentation driver. The first call to DevQueryDeviceNames determines the number of names, description, and data types available; after allocating the arrays, the second call actually returns the information in the arrays.
#define INCL_DEV /* Device Function definitions */
#define INCL_DOSMEMMGR /* DOS Memory Manager Functions */
#include <os2.h>
BOOL fSuccess; /* success indicator */
HAB hab; /* Anchor-block handle */
LONG pldn = 0L; /* number of device names/descriptions */
LONG pldt = 0L; /* number of data types */
PSTR32 aDeviceName; /* array of device names */
PSTR64 aDeviceDesc; /* array of device descriptions */
PSTR16 aDataType; /* array of data types */
/* query number of supported names/descriptions/data types
(pldn & pldt both 0) */
fSuccess = DevQueryDeviceNames(hab, "IBM4201.DRV", &pldn,
aDeviceName, aDeviceDesc, &pldt,
aDataType);
if (fSuccess)
{
/* allocate arrays */
DosAllocMem((VOID *)aDeviceName, (ULONG)pldn*sizeof(STR32),
PAG_COMMIT | PAG_WRITE);
DosAllocMem((VOID *)aDeviceDesc, (ULONG)pldn*sizeof(STR64),
PAG_COMMIT | PAG_WRITE);
DosAllocMem((VOID *)aDataType, (ULONG)pldt*sizeof(STR16),
PAG_COMMIT | PAG_WRITE);
/* query supported device information */
fSuccess = DevQueryDeviceNames(hab, "IBM4201.DRV", &pldn,
aDeviceName, aDeviceDesc, &pldt,
aDataType);
}