23.2.1 Resource Checking and Claiming Functions

The functions DetectCheckPortUsage and DetectCheckMemoryUsage check to see if a port/memory range is in use by some device in the system other than the driver. If the port or memory is available, the return value is STATUS_SUCCESS. Otherwise, either of the functions return an error code. The function prototypes are as follows:

NTSTATUS DetectCheckPortUsage(InterfaceType, BusNumber, Port, Length)

IN INTERFACE_TYPE InterfaceType;
IN ULONG BusNumber;
IN ULONG Port;
IN ULONG Length;

NTSTATUS DetectCheckMemoryUsage(InterfaceType, BusNumber,
BaseAddress, Length)

IN INTERFACE_TYPE InterfaceType;
IN ULONG BusNumber;
IN ULONG BaseAddress;
IN ULONG Length;

A successful return implies the I/O port or memory range is available for use.