RMCreateDriver
This service is supported by both rminfo.dll and rmcalls.lib. It obtains a driver handle. It also registers basic information about calling the device driver with the Resource Manager. A driver handle (HDRIVER) is returned by this service and is required by other Resource Manager services to identify the requestor.
The first call to this service causes the Resource Manager interface code (the part that is linked to your driver) to initialize. Therefore, this function is the first Resource Manager call a driver usually makes.
Information about the driver registering with the Resource Manager is passed in a DRIVERSTRUCT.
Syntax
RMCreateDriver(DriverStruct, hDriver);
Parameters
- DriverStruct (PDRIVERSTRUCT) - output
- Pointer to the DRIVERSTRUCT structure.
- hDriver (PHDRIVER) - output
- Pointer to a variable to receive the returned driver handle.
Return Code
- rc (APIRET) - returns
- On systems where the Resource Manager driver is not installed, the library interface code will return RMRC_SUCCESS and a driver handle of -1L.
- RMRC_IRQ_ENTRY_ILLEGAL
- A Resource Manager service was issued at interrupt time. The Resource Manager service request can be issued only at task time or INIT time.
- RMRC_NULL_POINTER
- A Resource Manager service received a NULL value for a pointer that was expected to contain a valid 16:16 address.
- RMRC_NULL_STRINGS
- A descriptive text pointer in a DRIVERSTRUCT, ADAPTERSTRUCT, or DEVICESTRUCT datatype was found to be NULL rather than pointing to the expected ASCIIZ text data.
- RMRC_BAD_VERSION
- The Resource Manager level indicated on the RMCreateDriver service is not supported by the Resource Management driver currently installed because it is a a downlevel version of the Resource Management driver (RESOURCE.SYS), or the MajorVer/MinorVer fields of DRIVERSTRUCT were not properly initialized.
Remarks
The first call to this service causes the Resource Manager interface code (the part that is linked to your device driver) to initialize. Therefore, this function is the first Resource Manager call a driver usually makes.
Information about the driver registering with the Resource Manager is passed in a DRIVERSTRUCT.
Example Code
C
#include <os2.h> #include <rmcalls.h> PDRIVERSTRUCT DriverStruct; PHDRIVER hDriver; APIRET rc; rc = RMCreateDriver(DriverStruct, hDriver);