-
-
[求助]一段加驱的代码,运行后老实弹错
-
发表于: 2010-4-27 20:54 4427
-
代码如下:
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
我该怎么修改,谢谢!
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)
赞赏
他的文章
- [求助]ff15方式的call怎么计算地址 9340
- [讨论]金山独霸2011的ssdt hook 4233
- [讨论]关于NtCreateProcess 4313
- [求助]ObQueryNameString获取进程路径的问题 14373
- [求助]一段加驱的代码,运行后老实弹错 4428
看原图
赞赏
雪币:
留言: