阅读:1302回复:6
为什么ControlService黑屏?
void DelSvr( char * szSvrName )
{ SC_HANDLE hServiceMgr, hServiceTwdm; SERVICE_STATUS SvrSta; hServiceMgr = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS ); if( hServiceMgr == NULL ) { MessageBox(NULL, \"DelSvr::OpenSCManager() Failed!\", \"Error\", MB_OK); return; } else { MessageBox(NULL, \"DelSvr::OpenSCManager() Succeed!\", \"Success\", MB_OK); } hServiceTwdm = OpenService( hServiceMgr, TEXT(szSvrName), SERVICE_ALL_ACCESS ); if( hServiceTwdm == NULL ) { CloseServiceHandle( hServiceMgr ); MessageBox(NULL, \"DelSvr::OpenService() Failed!\", \"Error\", MB_OK); return; } else { MessageBox(NULL, \"DelSvr::OpenService() Succeed!\", \"Success\", MB_OK); } if( !ControlService( hServiceTwdm, SERVICE_CONTROL_STOP , &SvrSta ) ) { MessageBox(NULL, \"DelSvr::ControlService() Failed!\", \"Error\", MB_OK); } else { MessageBox(NULL, \"DelSvr::ControlService() Succeed!\", \"Success\", MB_OK); } if( !DeleteService( hServiceTwdm ) ) { MessageBox(NULL, \"DelSvr::DeleteSrevice() Failed!\", \"Error\", MB_OK); } else { MessageBox(NULL, \"DelSvr::DeleteSrevice() Succeed!\", \"Success\", MB_OK); } CloseServiceHandle( hServiceTwdm ); CloseServiceHandle( hServiceMgr ); return; } 我调用以上函数卸载驱动,为何程序执行到ControlService时黑屏,这可能是什么原因造成的呢? |
|
沙发#
发布于:2005-03-22 18:05
void DelSvr( char * szSvrName ) 也不一定是上述代码的问题,也可能是驱动在unload时导致的蓝屏, 驱动导致的可能性比较大,检查一下吧 |
|
|
板凳#
发布于:2005-03-22 21:06
肯定是驱动的问题,在驱动里下断点看看.
|
|
|
地板#
发布于:2005-03-23 08:36
是驱动卸载时出现的问题,“DRIVER UNLOADED WITHOUT CANCELLING PENDING OPERATION”。
我写的是Native API的hook程序,该如何处理呢? |
|
地下室#
发布于:2005-03-23 08:42
黑屏不是蓝屏,所以不好断定
|
|
|
5楼#
发布于:2005-03-23 08:43
把你的驱动代码贴出来看看.
|
|
|
6楼#
发布于:2005-03-23 10:20
代码分了几个文件,太长,给我个邮箱我发给你帮我看看吧。
|
|