[Compuware Corporation] [Compuware NuMega home page]                [NuMega Lab]
[teal]

 [DriverStudio]    [Image][Image]
   Home
 [Driver Products]        Driver Technical Tips
   DriverStudio          Obtaining Plug and Play Hardware IDs in Windows 95
   DriverBundle          and WDM Drivers
   Previews
   Compatibility         In a Plug and Play environment, the operating system
 [Downloads]             detects the presence of a device and notifies the
                          driver responsible for controlling it. For Win32
 Wizards                  Driver Model (WDM) drivers, the operating system
   Utilities             notifies the driver by calling the driver's AddDevice
   NT source             entry point. For VxDs in Windows 95 and Windows 98,
 examples                 notification is in the form of a control message,
   VxD source            namely PNP_NEWDEVNODE.
 examples
   WDM source            If a driver supports more than one device, and it
 examples                 does not handle all devices in the same way, then it
 [Resources]             needs to determine which of the physical devices
 Technical papers         under its control corresponds to a notification sent
   Useful links          by the operating system. Since the operating system
   Technical tips        assigns a unique Hardware ID to each device, one way
 [Support]               for the driver to identify a device is by its
                          Hardware ID.
 Support
   Knowledge base        WDM
   Problem               A WDM driver can obtain the Hardware ID of a device
 submission               using the Physical Device Object (PDO) pointer that
   Product               the system passes as a parameter to AddDevice. A WDM
 registration             driver calls the system service IoGetDeviceProperty
   Release notes         as follows:
 [Shop NuMega]  
 Buy it!                      NTSTATUS status;
   Price list                ULONG ReqLen;
   How to buy                USHORT HardwareID[MAX_ID_SIZE];
   Sales offices             status =IoGetDeviceProperty(
                                  PDO,
                                  DevicePropertyHardwareID,
 [Y2K Compliance]                 sizeof(HardwareID),
                                  HardwareID,
                                  &ReqLen
 [More information]               );

                          IoGetDeviceProperty writes the device's hardware IDs
                          into the provided buffer. Compatible ID strings are
                          delimited by commas. If the provided buffer is too
                          small, the service returns STATUS_BUFFER_OVERFLOW.
                          Since the buffer may have to be quite large, it is a
                          good idea to allocate it temporarily from the paged
                          pool, and release it when no longer needed.

                          A WDM driver built with DriverWorks can just call
                          member GetHardwareID of class KPnpLowerDevice.

                          VxD
                          A VxD makes an analogous call to the Configuration
                          Manager, passing the DevNode rather than a PDO
                          (assuming VtoolsD):

                              CONFIGRET status;
                              ULONG ReqLen;
                              USHORT HardwareID[MAX_ID_SIZE];
                              status =CONFIGMG_Get_Device_ID(
                                  DevNode,
                                  HardwareID,
                                  sizeof(HardwareID),
                                  0
                                  );

                          Back to technical tip start page.

  DriverCentral  DriverStudio  Free downloads  Resources  Support and
                          Services  Shop NuMega
     Compuware NuMega  Tel: +1 603 578-8400  Updated: 9 August 1999 
                      Problems? Contact our webmaster.
