Jump to content

DevHelp_RegisterDeviceClass

From EDM2

At initialization, the driver calls the DevHlp_RegisterDeviceClass to register its direct call command handler entry point with the kernel.

Syntax

C

 USHORT APIENTRY DevHlp_RegisterDeviceClass( NPSZ    DeviceString,
                                             PFN     DriverEP,
                                             USHORT DeviceFlags,
                                             USHORT  DeviceClass,
                                             PUSHORT DeviceHandle);

Assembler

LDS  SI, ADD_Name            ; DS:SI = Ptr device driver to ASCIIZ name
                             ;         maximum of 16 chars
MOV  AX,SEGMENT ADD_Function ; AX:BX = Ptr to driver's DirectCall
LEA  BX,ADD_Function         ;         Command Handler
MOV  DI,Device_Flags         ; Must be 0 for adapter device drivers
MOV  CX,Device_Class         ; Must be 1 for adapter device drivers
MOV  DL,DevHlp_RegisterADD
CALL [Device_Help]

Parameters

C

DeviceString(NPSZ)
ASCIIZ device driver name ( maximum 16 characters)
DriverEP (PFN)
Pointer to driver's direct call command handler.
DeviceFlags(USHORT)
DeviceClass specific flags (must be 0 for adapter device drivers)
DeviceClass(USHORT)
DeviceClass table number (must be 1 for adapter device drivers)
DeviceHandle(PUSHORT)
Returned Device Handle to the device driver

Assembler

LDS  SI, ADD_Name            ; DS:SI = Ptr device driver to ASCIIZ name
                             ;         maximum of 16 chars
MOV  AX,SEGMENT ADD_Function ; AX:BX = Ptr to driver's DirectCall
LEA  BX,ADD_Function         ;         Command Handler
MOV  DI,Device_Flags         ; Must be 0 for adapter device drivers
MOV  CX,Device_Class         ; Must be 1 for adapter device drivers

Return Code

Assembler

'C' Cleared if successful
AX = ADDHandle
'C' Set if error
AX = ERROR_NOT_ENOUGH_MEMORY
                 if CX out of range
                 if table is full