2.4.2.4 Installer Function

Every installer exports an installer function. The default name for the function is ClassInstall. The device installer dynamically links to and calls this function whenever it needs the class installer to carry out a specific installation task.

The prototype for the installer function is as follows:

typedef DWORD  (CALLBACK* CLASS_INSTALL_PROC) (
    IN DI_FUNCTION       InstallFunction,
    IN HDEVINFO          DeviceInfoSet,
    IN PSP_DEVINFO_DATA  DeviceInfoData  /* optional */
    );
 

The installer function receives two or three arguments: InstallFunction which identifies the installation request to perform, a handle to the device information set, and, optionally, a pointer to an SP_DEVINFO_DATA structure that contains information about the device to install. The function either carries out the requested task or directs the class installer to carry out the task for it.

To direct the class installer to carry out the task, the installer function must return ERROR_DI_DO_DEFAULT. If the device installer performs its own tasks, it must return the value NO_ERROR to notify the class installer that the task completed successfully.