QueryServiceStatus(scm, SS);
if SS.dwCurrentState <> SERVICE_RUNNING then
Result:=StartService(scm,
0,
lpServiceArgVectors);
else Result:=True;
if scm > 0 then CloseServiceHandle(scm);
end;
function CloseSrv : boolean;
var
sch, scm : SC_HANDLE;
ss : TServiceStatus;
begin
sch := OpenSCManager(nil, 0, 0);
scm := OpenService(sch, 'PRMonitor', SERVICE_ALL_ACCESS);
if scm > 0 then
begin
ControlService(scm, SERVICE_CONTROL_STOP, ss);
DeleteService(scm);
CloseServiceHandle(scm);
end;
if sch > 0 then CloseServiceHandle(sch);
end;
procedure DisableEvent{(P : Pointer) : LongInt; stdcall};
var
A, X : DWORD;
msgbuff : array[0..511] of char;
pdest, name : pChar;
_result : Integer;
label skip;
{
VC++ 声明
DWORD a,x; char msgbuff[512];
char *pdest;
int result;
}
begin
while LoopWhile do
begin
MOVE(a, outputbuff[0],4); // memmove(&a,&outputbuff[0],4);
if (a=0) then // if(!a){Sleep(10);continue;}
begin
Sleep(10);
continue;
end;
name := pChar(@outputbuff[8]); // char*name=(char*)&outputbuff[8]; 一直未执行到这句
for x := 0 to stringcount - 1 do
begin
if BOOL(not(lstrcmpi(name,PChar(string(x))))) then
begin
a := 1;
Goto skip;
end;
end;
pdest := pChar(Integer(name) + pos('##',name));
if pdest <> nil then
begin
_result := Integer(DWORD(pdest) - DWORD(name));
lstrcpy(msgbuff,'是否允许');
lstrcat(msgbuff,pChar(copy(outputbuff,8,_result)));
lstrcat(msgbuff,'运行');
lstrcat(msgbuff,pChar(@outputbuff[10+_result]));
end else if pos('$$',name) <> 0 then
begin
{
pdest := pChar(DWORD(name) + pos('$$',name));
_result := Integer(DWORD(pdest) - DWORD(name));
lstrcpy(msgbuff,'是否允许');
lstrcat(msgbuff,pChar(copy(outputbuff,8,_result)));
lstrcat(msgbuff,'设置注册表');
lstrcat(msgbuff,pChar(@outputbuff[10+_result])); }
end else
begin
pdest := pChar(DWORD(name) + pos('&&',name));
_result := Integer(DWORD(pdest) - DWORD(name));
lstrcpy(msgbuff,'是否允许');
lstrcat(msgbuff,pChar(copy(outputbuff,8,_result)));
lstrcat(msgbuff,'加载驱动');
lstrcat(msgbuff,pChar(@outputbuff[10+_result]));
end;
if MessageBox(0, msgbuff,'WARNING',MB_YESNO or MB_ICONQUESTION or $00200000) = IDYES then
begin
a := 1;
string(stringcount) := pChar(copy(name,0,lstrlen(name)-1));
inc(stringcount);
end else
a := 0;
skip:
move(a,outputbuff[4],4);
a := 0;
move(a,outputbuff,4);
end;