加载驱动时 StartService 的 LastError 是 2 : 系统找不到指定文件

uryushinngo 2013-02-28 07:33:34
【系统环境】
Win 8 Pro 64位,禁用驱动强制签名

【这个驱动是:】
这是个 文件系统 微过滤(FltMgr) 驱动 挑片用的。

【sys的位置: 绝对路径】
LPCSTR ABSpath = "F:\\WaillerAnimanage2013\\WaillerAnimanage2013\\Resources\\WaillerAnimeWeaverold13b.sys" ;
用了绝对路径。保证路径正确。

【加载的代码】
hScm = OpenSCManager ( NULL , NULL , SC_MANAGER_ALL_ACCESS ) ;
hService = CreateService ( hScm , "WaillerAfter3winter" , "WaillerAfter3winter" , GENERIC_ALL , SERVICE_KERNEL_DRIVER , SERVICE_DEMAND_START , SERVICE_ERROR_NORMAL , ABSpath , NULL , NULL , NULL , NULL , NULL ) ;
hService = OpenService ( hScm , "WaillerAfter3winter" , SC_MANAGER_ALL_ACCESS ) ;
bEx = StartService ( hService , NULL , NULL ) ;

执行到最后一句时出现了错误 LastError = 2:系统找不到指定文件


在注册表中都有了,居然报系统找不到文件,邪恶的M$

各位大神如果以前遇到过 求赐教。 已经从年后困扰到现在,非伸手党!!!
好人一生平安。

...全文
1797 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
细粉条 2014-06-16
  • 打赏
  • 举报
回复
楼主问题怎么解决的?我也遇到startservice返回2
uryushinngo 2013-03-01
  • 打赏
  • 举报
回复
太狼兄,这个 DriverEntry 会出“系统找不到指定文件”的错误吗?
#pragma code_seg()
extern "C"
NTSTATUS
DriverEntry
( PDRIVER_OBJECT pDO , PUNICODE_STRING pRegPath )
{
	NTSTATUS status ;	
	PSECURITY_DESCRIPTOR sd ;
	OBJECT_ATTRIBUTES oa ;
	gpDo = pDO ;
	AlwaysFx = FALSE ;

	KeInitializeEvent ( &Fx , SynchronizationEvent , FALSE ) ;
	KeInitializeEvent ( &GraspR , SynchronizationEvent , FALSE ) ;
	KeInitializeEvent ( &GraspW , SynchronizationEvent , FALSE ) ;
	KeInitializeEvent ( &GraspS , SynchronizationEvent , FALSE ) ;
	KeInitializeEvent ( &CanInR , SynchronizationEvent , TRUE ) ;
	KeInitializeEvent ( &CanInW , SynchronizationEvent , TRUE ) ;
	KeInitializeEvent ( &CanInS , SynchronizationEvent , TRUE ) ;

	status = FltRegisterFilter ( gpDo , &FilterRegistration , &pFilta ) ;
	if ( !NT_SUCCESS (status) )
		return status ;

	status = FltBuildDefaultSecurityDescriptor (  &sd , FLT_PORT_ALL_ACCESS ) ;
	if ( !NT_SUCCESS (status) )
		return status ;
	RtlInitUnicodeString ( &usCp , L"WaillerWeaver13b" ) ;
	InitializeObjectAttributes ( &oa , &usCp , OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE , NULL , sd ) ;

	status = FltCreateCommunicationPort ( pFilta , &KernelServerPort , &oa , NULL , (PFLT_CONNECT_NOTIFY)WnpCpConnect , (PFLT_DISCONNECT_NOTIFY)WnpCpDisconnect , (PFLT_MESSAGE_NOTIFY)WnpMessageNotify , 1 ) ;

	if ( !NT_SUCCESS (status) )
		return status ;
	for ( short MediaInitial = 0 ; MediaInitial <= BeMd - 1 ; MediaInitial ++ )
	{
		RtlInitUnicodeString ( &(MediaExt[MediaInitial]) , BeMdExt[MediaInitial] ) ;
	}
	ReadOutA.Buffer = ReadOut ;
	WriteOutA.Buffer = WriteOut ;
	SetOutA.Buffer = SetOut ;
	return status ;
}
uryushinngo 2013-03-01
  • 打赏
  • 举报
回复
引用 1 楼 ydfivy 的回复:
把SERVICE_KERNEL_DRIVER换成SERVICE_FILE_SYSTEM_DRIVER试试。
这算是一个错误 多谢太狼兄 除了这个以外还有其他问题,他还是 LastError = 2.
uryushinngo 2013-02-28
  • 打赏
  • 举报
回复
引用 楼主 uryushinngo 的回复:
本帖最后由 uryushinngo 于 2013-02-28 19:36:47 编辑 【系统环境】 Win 8 Pro 64位,禁用驱动强制签名 【这个驱动是:】 这是个 文件系统 微过滤(FltMgr) 驱动 挑片用的。 【sys的位置: 绝对路径】 LPCSTR ABSpath = "F:\\WaillerAnima……
收到!明天回去试试
一个傻冒 2013-02-28
  • 打赏
  • 举报
回复
把SERVICE_KERNEL_DRIVER换成SERVICE_FILE_SYSTEM_DRIVER试试。

9,513

社区成员

发帖
与我相关
我的任务
社区描述
Windows专区 安全技术/病毒
社区管理员
  • 安全技术/病毒社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧