能力值:
( LV2,RANK:10 )
|
-
-
2 楼
|
能力值:
(RANK:1060 )
|
-
-
3 楼
cmd /k sc /?
|
能力值:
( LV12,RANK:240 )
|
-
-
4 楼
http://www.sysersoft.com/ 安装下 可以把里面的驱动加载工具拿出来用 有加载卸载功能
|
能力值:
( LV3,RANK:25 )
|
-
-
5 楼
KmdManager.exe
|
能力值:
( LV2,RANK:10 )
|
-
-
6 楼
.....................
int loadDriver(IN LPCSTR filePath,IN LPCSTR serviceName,IN LPCSTR serviceDiscription)
{
SC_HANDLE hSCManager =OpenSCManagerA(NULL,NULL,SC_MANAGER_CREATE_SERVICE);
SC_HANDLE hService =CreateServiceA\
(hSCManager,\
serviceName,\
serviceDiscription,\
SERVICE_START|DELETE|SERVICE_STOP,\
SERVICE_KERNEL_DRIVER,\
SERVICE_DEMAND_START,\
SERVICE_ERROR_IGNORE,\
filePath,\
NULL,
NULL,
NULL,
NULL,
NULL);
if(hService==NULL)
{
printError("创建服务");
return -1;
}
StartService(hService,NULL,NULL);
DeleteService(hService);
CloseServiceHandle(hSCManager);
printf("创建服务成功\n");
return 0;
}
int unloadDriver(LPCSTR svrName)
{
SC_HANDLE hSCManager =OpenSCManagerA(NULL,NULL,SC_MANAGER_CREATE_SERVICE);
SC_HANDLE hService =OpenServiceA(hSCManager,svrName,DELETE | SERVICE_STOP);
SERVICE_STATUS ssts;
if(!ControlService(hService,SERVICE_CONTROL_STOP,&ssts) && !DeleteService(hService))
{
printError("卸载驱动");
return -1;
}
printf("卸载驱动成功\n");
CloseServiceHandle(hService);
CloseServiceHandle(hSCManager);
}
void printError(LPCSTR msg)
{
LPVOID lpMsgBuf;
FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
0,
(LPSTR) &lpMsgBuf,
0,
NULL
);
printf("%s,完成状态:%s\n",msg,(char*)lpMsgBuf);
LocalFree( lpMsgBuf );
}
|
能力值:
( LV2,RANK:10 )
|
-
-
7 楼
谢谢几位大侠。
|
|
|