We have WiX program which (beside other components) setups the driver.
Install/Uninstall are success and realized via custom DLL with functions bellow.
The problem with Update driver. The second call to SetupInstallServicesFromInfSection() returns 0x430.
How it may be fixed?
Thanks,
Michael.
UINT DriverInstall(TCHAR * driverpath,UINT flags)
{
HINF hInf;
PVOID pvContext;
BOOL bResult;
UINT Retcode=ERROR_SUCCESS;
hInf = SetupOpenInfFile(driverpath, NULL, INF_STYLE_WIN4, NULL);
if( hInf == INVALID_HANDLE_VALUE ) {
return ERROR_INSTALL_FAILURE;
}
pvContext = SetupInitDefaultQueueCallback(NULL);
if ( pvContext == NULL ) {
SetupCloseInfFile(hInf);
return ERROR_INSTALL_FAILURE;
}
bResult = SetupInstallFromInfSection(NULL, hInf, L"DefaultInstall", flags, NULL, NULL, SP_COPY_NEWER, SetupDefaultQueueCallback, pvContext,NULL,NULL);
if (!bResult) {
Retcode=ERROR_INSTALL_FAILURE;
}
else {
bResult = SetupInstallServicesFromInfSection(hInf, L"DefaultInstall.Services", 0);
if (!bResult)
Retcode=ERROR_INSTALL_FAILURE;
}
SetupTermDefaultQueueCallback(pvContext);
SetupCloseInfFile(hInf);
return Retcode;
}
UINT __stdcall DoDeleteSvc(TCHAR* szSvcName)
{
SC_HANDLE schSCManager;
SC_HANDLE schService;
// Get a handle to the SCM database.
schSCManager = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS); // full access rights
if (NULL == schSCManager)
return ERROR_INSTALL_FAILURE;
// Get a handle to the service.
schService = OpenService( schSCManager, szSvcName, DELETE); // need delete access
if (schService == NULL)
{
CloseServiceHandle(schSCManager);
return ERROR_INSTALL_FAILURE;
}
// Delete the service.
BOOL ret=DeleteService(schService);
CloseServiceHandle(schService);
CloseServiceHandle(schSCManager);
return ret ? ERROR_SUCCESS:ERROR_INSTALL_FAILURE;
}