mirror of https://github.com/Icinga/icinga2.git
parent
e187f405d9
commit
8557293ac4
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "thresholds.h"
|
#include "thresholds.h"
|
||||||
|
|
||||||
#include "boost\program_options.hpp"
|
#include "boost/program_options.hpp"
|
||||||
|
|
||||||
#define VERSION 1.0
|
#define VERSION 1.0
|
||||||
|
|
||||||
|
@ -240,9 +240,8 @@ int countProcs(const wstring user)
|
||||||
|
|
||||||
pe32.dwSize = sizeof(PROCESSENTRY32);
|
pe32.dwSize = sizeof(PROCESSENTRY32);
|
||||||
|
|
||||||
if (!Process32First(hProcessSnap, &pe32)) {
|
if (!Process32First(hProcessSnap, &pe32))
|
||||||
goto die;
|
goto die;
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
//get ProcessToken
|
//get ProcessToken
|
||||||
|
@ -251,15 +250,12 @@ int countProcs(const wstring user)
|
||||||
//Won't count pid 0 (system idle) and 4/8 (Sytem)
|
//Won't count pid 0 (system idle) and 4/8 (Sytem)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Get dwReturnLength in first call
|
//Get dwReturnLength in first call
|
||||||
dwReturnLength = 1;
|
dwReturnLength = 1;
|
||||||
if (!GetTokenInformation(hToken, TokenUser, NULL, 0, &dwReturnLength)
|
if (!GetTokenInformation(hToken, TokenUser, NULL, 0, &dwReturnLength)
|
||||||
&& GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
&& GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
pSIDTokenUser = (PTOKEN_USER)new BYTE[dwReturnLength];
|
pSIDTokenUser = (PTOKEN_USER)new BYTE[dwReturnLength];
|
||||||
memset(pSIDTokenUser, 0, dwReturnLength);
|
memset(pSIDTokenUser, 0, dwReturnLength);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue