把api在脚本中申明一下,然后直接调就行了,这是我的脚本中的一段
申明:
// ----- DLL function prototypes -----
prototype HWND ADVAPI32.OpenSCManagerA(LPSTR,LPSTR,INT);
prototype HWND ADVAPI32.OpenServiceA(HWND,STRING,INT);
prototype HWND ADVAPI32.QueryServiceStatus(HWND,pointer);
prototype HWND ADVAPI32.StartServiceA (HWND,INT,pointer);
prototype BOOL ADVAPI32.ControlService(HWND,INT,pointer);
prototype BOOL ADVAPI32.CloseServiceHandle(HWND);
// your DLL function prototypes
调用:
SC_SH=OpenServiceA(SC_MH,"MSSQLSERVER",983551);