-
-
[求助]一段加驱的代码,运行后老实弹错
-
发表于: 2010-4-27 20:54 4439
-
代码如下:
BOOL loaddriver()
{
BOOL st=1;
SC_HANDLE scm,scs;
char filepath[100]={0};
GetFullPathName((LPCWSTR)(L"mhf.sys"),100,(LPWSTR)filepath,NULL);
scm=OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS);
if(scm)
{
scs=CreateService(scm,
(LPCWSTR)(L"mmhf"),
(LPCWSTR)(L"mmhf"),
SERVICE_ALL_ACCESS,
SERVICE_KERNEL_DRIVER,
SERVICE_DEMAND_START,
SERVICE_ERROR_NORMAL,
(LPCTSTR)filepath,
NULL,
NULL,
NULL,
NULL,
NULL);
if(!scs&&GetLastError()==1073)
{
scs=OpenService(scm,(LPCWSTR)(L"mmhf"),SERVICE_ALL_ACCESS);
if(!scs)
{
GetLastError();
}
}
else if(!scs&&GetLastError()!=1073)
{
CloseServiceHandle(scm);
return 0;
}
st=StartService(scs,0,NULL);
if(st==0)
{
GetLastError();
}
CloseServiceHandle(scs);
CloseServiceHandle(scm);
}
else
{
st=0;
}
return st;
}
错误信息是Stack around variable "filepath" was corrupted
我该怎么修改,谢谢!
BOOL loaddriver()
{
BOOL st=1;
SC_HANDLE scm,scs;
char filepath[100]={0};
GetFullPathName((LPCWSTR)(L"mhf.sys"),100,(LPWSTR)filepath,NULL);
scm=OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS);
if(scm)
{
scs=CreateService(scm,
(LPCWSTR)(L"mmhf"),
(LPCWSTR)(L"mmhf"),
SERVICE_ALL_ACCESS,
SERVICE_KERNEL_DRIVER,
SERVICE_DEMAND_START,
SERVICE_ERROR_NORMAL,
(LPCTSTR)filepath,
NULL,
NULL,
NULL,
NULL,
NULL);
if(!scs&&GetLastError()==1073)
{
scs=OpenService(scm,(LPCWSTR)(L"mmhf"),SERVICE_ALL_ACCESS);
if(!scs)
{
GetLastError();
}
}
else if(!scs&&GetLastError()!=1073)
{
CloseServiceHandle(scm);
return 0;
}
st=StartService(scs,0,NULL);
if(st==0)
{
GetLastError();
}
CloseServiceHandle(scs);
CloseServiceHandle(scm);
}
else
{
st=0;
}
return st;
}
错误信息是Stack around variable "filepath" was corrupted
我该怎么修改,谢谢!
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
赞赏
他的文章
- [求助]ff15方式的call怎么计算地址 9376
- [讨论]金山独霸2011的ssdt hook 4248
- [讨论]关于NtCreateProcess 4331
- [求助]ObQueryNameString获取进程路径的问题 14413
- [求助]一段加驱的代码,运行后老实弹错 4440
看原图
赞赏
雪币:
留言: