EngCreateDriverObj

HDRVOBJ EngCreateDriverObj(

    PVOID  pvObj,
   FREEOBJPROC  pFreeObjProc,
   HDEV  hdev
  );

EngCreateDriverObj creates a DRIVEROBJ structure. This structure is used to track a driver-managed resource that must be released if the resource-allocating process terminates without first cleaning it up.

Parameters

pvObj

Points to the driver resource that will be tracked by the DRIVEROBJ. The resource is associated with the current client process.

pFreeObjProc

Points to a driver-supplied callback function that frees the resource pointed to by pvObj. The callback function should be defined as follows, where pDriverObj points to the DRIVEROBJ structure:

BOOL CALLBACK DrvobjFreeObjProc(DRIVEROBJ *pDriverObj);

 

hdev

The GDI handle of the physical device associated with the object.

Return Value

The return value is a handle that identifies the newly-created DRIVEROBJ structure if the function is successful. Otherwise, it is zero.

Comments

The driver can explicitly delete the DRIVEROBJ structure by calling EngDeleteDriverObj. Otherwise, the engine frees the resource by calling the function pointed to by pFreeObjProc when the process that created the DRIVEROBJ terminates.

See Also

DRIVEROBJ