I like FORCEINLINE

For kernel mode code, if I have choice between using a #define or a FORCEINLINE function, the FORCEINLINE function wins every time.  #defines have their place, especially for quotifying (the # operator) or concatenating (the ## operator), but they have no place in my heart for constants or pseudo functions. FORCEINLINEs have type checking.  On…

14

How are WMI instance IDs guaranteed to be unique?

This is related to today’s previous topic of how the manager makes device interface GUIDs unique.  Let’s now look at how the kernel implementation of WMI (or IRP_MJ_SYSTEM_CONTROL if you are dealing with PIRPs or WBEM to you user mode folks) works.  When you register an instance of a WMI provider, the instance must have…

2

How are device interface strings guaranteed to be unique?

When you register a device interface GUID, you get back a symbolic link name which is the link representing the instance of the device interface.  The symbolic link that is returned has to be unique to your device, otherwise 2 devices sharing the same link would be quite confusing!  For instance, if we had the…

1

Why am I not seeing any new device notifications when calling RegisterDeviceNotification?

Let’s define this simple worker function which registers for device interface arrival notifications for a given handle (either an HWND or service HANDLE): HDEVNOTIFYRegisterInterfaceNotificationWorker(    HANDLE Recipient,    LPCGUID Guid,     DWORD Flags    ){    DEV_BROADCAST_DEVICEINTERFACE dbh;     ZeroMemory(&dbh, sizeof(dbh));     dbh.dbcc_size = sizeof(dbh);    dbh.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;    CopyMemory(&dbh.dbcc_classguid, Guid, sizeof(GUID));     return RegisterDeviceNotification(Recipient, &dbh, Flags);} I have seen…

3

Glossary

This is meant to be an organic document that grows over time.  If the term you are looking for is not in this a list, you should look at the DDK docs Class Driver:  A driver, usually written by Microsoft, which generically controls devices of a certain class.  For instance, cdrom.sys controls all CD ROM…

3

PDOs, part 1

Definition:  A PDO is a Physical Device Object. This entry is not going into how to enumerate a PDO or the rules involved in PDO enumeration and management. There are two types of PDOs.  A raw PDO and a PDO which is not raw (e.g. cooked).  Assume that the term “PDO” always refers to a…

1