Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Stop and delete a service

241 views
Skip to first unread message

SteM

unread,
Apr 24, 2009, 4:07:45 AM4/24/09
to
Hi all,
i'm able to install my driver and relative service (wdm WinXP).
But when i need to stop and delete the service (at the end of the
application) i receive:
- ControlService STOP -> 1052 Error Invalid Service Control
- DeleteService -> 1072 Service marked for delete (of course...)
So i need to reboot every time i compile the driver ....

Which is the cause of this error?
Thanks
--
SteM


Stefan Kuhr

unread,
Apr 24, 2009, 4:10:09 AM4/24/09
to
Hi SteM,

Just a vague idea: Do you stop the service using the services mmc
snap-in? this often keeps a handle open to services you otherwise delete
and those services are then marked for deletion. An alternative would be
to use the command line with net start/stop or sc.exe.

--
Stefan

SteM

unread,
Apr 24, 2009, 5:49:48 AM4/24/09
to

"Stefan Kuhr" <kust...@gmx.li> ha scritto nel messaggio
news:uXbNAbLx...@TK2MSFTNGP03.phx.gbl...

No, by C code recalling Windows APIs.
If i run 'net stop driver' i receive the same error.


Volodymyr Shcherbyna

unread,
Apr 24, 2009, 9:30:42 AM4/24/09
to
Does you driver registers Unload routine
(http://msdn.microsoft.com/en-us/library/ms795271.aspx) and is it called
when you do net stop?

--
Volodymyr M. Shcherbyna, blog: http://www.shcherbyna.com/
(This posting is provided "AS IS" with no warranties, and confers no
rights)
"SteM" <x...@yyy.zzz> wrote in message
news:upALDIM...@TK2MSFTNGP05.phx.gbl...

SteM

unread,
Apr 24, 2009, 11:59:36 AM4/24/09
to
Yes, i guess i installed the Unload function but it doesn't recalled ..

This is my code:

NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING
RegistryPath)
{
wchar_t *p;
KdPrint(("DriverEntry()\n"));

...
// Export other driver entry points...
DriverObject->DriverUnload = WdmUnload;
DriverObject->MajorFunction[IRP_MJ_CREATE] = WdmCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = WdmClose;
// DriverObject->MajorFunction[IRP_MJ_READ] = WdmRead;
// DriverObject->MajorFunction[IRP_MJ_WRITE] = WdmWrite;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = WdmDeviceControl;

WdmAddDevice(DriverObject);

return STATUS_SUCCESS;
}
#pragma code_seg() // end INIT section


#pragma code_seg("PAGE") // start PAGE section

VOID WdmUnload(IN PDRIVER_OBJECT DriverObject)
{
KdPrint(("WdmUnload\n"));
IoDeleteSymbolicLink( &uniWin32NameString);

ExFreePool(WdmRegistryPath.Buffer);
ExFreePool(uniWin32NameString.Buffer);
ExFreePool(uniNtNameString.Buffer);

// delete our fdo
if(DriverObject->DeviceObject)
IoDeleteDevice(DriverObject->DeviceObject);
DriverObject->DeviceObject=NULL;
}

Thanks.


"Volodymyr Shcherbyna" <v_sch...@online.mvps.org> ha scritto nel
messaggio news:OM$PjDOxJ...@TK2MSFTNGP03.phx.gbl...

SteM

unread,
May 5, 2009, 2:47:15 AM5/5/09
to
Is the directive '#pragma code_seg("PAGE")' correct for Unload() function ??


"SteM" <x...@yyy.zzz> ha scritto nel messaggio
news:um81rWPx...@TK2MSFTNGP03.phx.gbl...

Pavel A.

unread,
May 5, 2009, 7:43:49 AM5/5/09
to
SteM wrote:
> Is the directive '#pragma code_seg("PAGE")' correct for Unload() function ??

Yes - since unload is called at passive irql.

-- pa

0 new messages