在DOS命令下用 sc create wmdrive binpath= c:\windows\system32\drivers\wmdrive.sys type= kernel 可以启动服务,然后用 net start wmdrive 同样可以显示成功,为了在程序中实现,尝试用如下语句执行上面启动服务的功能:ShellExecute(0,'OPEN','cmd.exe', PChar(' /C '+'sc create wmdrive binpath= c:\windows\system32\drivers\mydevice.sys type= kernel'),'',SW_HIDE);WinExec(pChar('sc create wmdrive binpath= c:\windows\system32\drivers\mydevice.sys type= kernel'),SW_SHOW);
不管用哪种方法执行后,再用net start wmdrive 会提示:“发生系统错误2. 系统找不到指定的文件。”有没有朋友知道原因?或者能给一点解决问题的办法,在此万分感谢。
不管用哪种方法执行后,再用net start wmdrive 会提示:“发生系统错误2. 系统找不到指定的文件。”有没有朋友知道原因?或者能给一点解决问题的办法,在此万分感谢。
可以参考下我以前的一个帖子
http://topic.csdn.net/u/20090306/21/42440c64-a5de-4659-85ef-022ebc8b0017.html