X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=process.cpp;h=ee88af3fb85a7b1dfee63c709ca32a87bfc475b8;hb=e42e6900a5dad50b952d92c57344fdea2e13646e;hp=4c00e64266431c1acb554df9755e2c07e6ea9ce7;hpb=ce9eb5d4646a0e279eae2909a18fccb1197e15fb;p=nssm.git diff --git a/process.cpp b/process.cpp index 4c00e64..ee88af3 100644 --- a/process.cpp +++ b/process.cpp @@ -1,5 +1,7 @@ #include "nssm.h" +extern imports_t imports; + int get_process_creation_time(HANDLE process_handle, FILETIME *ft) { FILETIME creation_time, exit_time, kernel_time, user_time; @@ -186,8 +188,11 @@ int kill_process(char *service_name, unsigned long stop_method, HANDLE process_h int kill_console(char *service_name, HANDLE process_handle, unsigned long pid) { unsigned long ret; + /* Check we loaded AttachConsole(). */ + if (! imports.AttachConsole) return 4; + /* Try to attach to the process's console. */ - if (! AttachConsole(pid)) { + if (! imports.AttachConsole(pid)) { ret = GetLastError(); switch (ret) {