VC_Init

PDEVICE_INFO
VC_Init(
    PDRIVER_OBJECT
pDriverObject,
    PUNICODE_STRING
szRegistryPathName,
    ULONG
HWInfoSize
   
);

The VC_Init function creates a device object and stores the device name in the registry.

Parameters
pDriverObject
The driver object pointer that was received as input to the driver’s DriverEntry function.
szRegistryPathName
Pointer to a string containing the registry path to the driver’s subkey. Use the path name that was received as the RegistryPathName argument to DriverEntry.
HWInfoSize
Size, in bytes, of a driver-defined structure used for storing device-specific context information. Can be zero.
Return Value

Returns a pointer to a DEVICE_INFO structure.

Comments

A kernel-mode video capture driver using VCKernel.lib must call VC_Init from within its DriverEntry function, before calling any other VCKernel.lib functions.

The DEVICE_INFO structure pointer returned by VC_Init is used as input to subsequent calls to other VCKernel.lib functions. Contents of the DEVICE_INFO structure are not available to the kernel-mode driver.

The driver uses the HWInfoSize parameter to specify the size of a driver-defined structure. The VC_Init function allocates nonpaged space for this structure within the device object’s device extension area. The driver can call VC_GetHWInfo to obtain the address of the area that was allocated for the structure. Drivers can use this structure to store device-specific context information. (For more information about device objects and device extensions, see the Kernel-Mode Drivers Design Guide.)

The VC_Init function calls IoCreateDevice to create a device object. The device’s name is “vidcap”, which is defined by DD_VIDCAP_DEVICE_NAME_U in ntddvidc.h, with an appended number (0, 1, 2, and so on). The function writes this device name into the registry, under the registry path HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DriverName\Parameters, where DriverName is the driver name that the user-mode driver specified as input to VC_OpenProfileAccess when it installed the kernel-mode driver.