Update driver problem inside WiX Setup

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;
}

> The second call to SetupInstallServicesFromInfSection() returns 0x430

Hi, Michael.
If ‘0x430’ is the value returned by ‘GetLastError()’ then it means ‘The specified service has been marked for deletion.’
It’s probable that someone keeps the reference to your service preventing it from a stopping and deletion.

On 2/12/2014 1:45 PM, xxxxx@seznam.cz wrote:

If ‘0x430’ is the value returned by ‘GetLastError()’ then it means ‘The specified service has been marked for deletion.’
It’s probable that someone keeps the reference to your service preventing it from a stopping and deletion.

If it’s a driver service, that’ll be Windows itself.

This causes a problem with uninstall rollback, because you can’t
reinstall a service that’s been marked for deletion. I don’t think
there’s a solution.


Bruce

> UINT __stdcall DoDeleteSvc(TCHAR* szSvcName)

May be it worths to invoke the ‘ControlService(SERVICE_CONTROL_STOP)’ before ‘DeleteService()’ ?

Friends,
thank you for answer!

We know that ‘0x430’ is “The specified service has been marked for deletion.”.
And it is really so - the old driver will be deleted only on reboot (both sys and from registry).
But in this case we can’t setup driver from new version!!!

Probably there is exist other way to update driver from WiX?
Or get out this problem? For example, delay executing INF file and do it after reboot too.

On 13-Feb-2014 09:55, michaelg wrote:

Friends,
thank you for answer!

We know that ‘0x430’ is “The specified service has been marked for deletion.”.
And it is really so - the old driver will be deleted only on reboot (both sys and from registry).
But in this case we can’t setup driver from new version!!!

Probably there is exist other way to update driver from WiX?
Or get out this problem? For example, delay executing INF file and do it after reboot too.

Hi Misha,

Your driver looks like a non-PnP driver.
So can you install it without the INF?
For example, the MS Security Essentials creates a new
service name for every update. You can do this too.
– pa

Pasha,
thank you!

We have to check this way.
We have file mini filter.
I’m not sure it’s good idea to setup it as service…:frowning:

Regards,
MG.

OP, you mentioned using WiX, but you didn’t include any WiX code. Have you tried using the difx:Driver extension in WiX? Also, assuming you are using WiX, the ServiceControl component should have the attribute Remove=“uninstall” which will NOT try to remove the service on install (i.e. upgrade).

~kenny

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@saferpoint.com
Sent: Friday, February 14, 2014 6:19 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Update driver problem inside WiX Setup

Pasha,
thank you!

We have to check this way.
We have file mini filter.
I’m not sure it’s good idea to setup it as service…:frowning:

Regards,
MG.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer