Changeset c1d545e in nscp
- Timestamp:
- 02/09/08 11:36:31 (5 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- 1a35b3f
- Parents:
- 047516e
- Files:
-
- 7 added
- 13 edited
-
AutoBuild.h (modified) (1 diff)
-
NSC.dist (modified) (1 diff)
-
NSCPlugin.cpp (modified) (11 diffs)
-
NSClient++-2005.sln (modified) (2 diffs)
-
NSClient++.cpp (modified) (1 diff)
-
changelog (modified) (5 diffs)
-
include/Mutex.h (modified) (3 diffs)
-
include/NSCHelper.cpp (modified) (2 diffs)
-
include/NSCHelper.h (modified) (1 diff)
-
include/config.h (modified) (1 diff)
-
include/thread.h (modified) (8 diffs)
-
modules/CheckExternalScripts/CheckExternalScripts-2005.vcproj (added)
-
modules/CheckExternalScripts/CheckExternalScripts-2008.vcproj (added)
-
modules/CheckExternalScripts/CheckExternalScripts.cpp (added)
-
modules/CheckExternalScripts/CheckExternalScripts.def (added)
-
modules/CheckExternalScripts/CheckExternalScripts.h (added)
-
modules/CheckExternalScripts/stdafx.cpp (added)
-
modules/CheckExternalScripts/stdafx.h (added)
-
modules/CheckSystem/PDHCollector.cpp (modified) (1 diff)
-
modules/SysTray/SysTray.aps (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
AutoBuild.h
rde8ef76 rc1d545e 3 3 // change the FALSE to TRUE for autoincrement of build number 4 4 #define INCREMENT_VERSION TRUE 5 #define FILEVER 0,3,0, 396 #define PRODUCTVER 0,3,0, 397 #define STRFILEVER _T("0.3.0. 39")8 #define STRPRODUCTVER _T("0.3.0. 39")9 #define STRPRODUCTDATE _T("2008-02-0 3")5 #define FILEVER 0,3,0,48 6 #define PRODUCTVER 0,3,0,48 7 #define STRFILEVER _T("0.3.0.48") 8 #define STRPRODUCTVER _T("0.3.0.48") 9 #define STRPRODUCTDATE _T("2008-02-08") 10 10 #endif // AUTOBUILD_H -
NSC.dist
r8b206ee rc1d545e 103 103 ;check_all_services[SERVICE_DEMAND_START]=ignored 104 104 ;check_all_services[SERVICE_DISABLED]=stopped 105 106 [External Script] 107 ;# COMMAND TIMEOUT 108 ; This specifies the maximum number of seconds that the NRPE daemon will allow plug-ins to finish executing before killing them off. 109 ;command_timeout=60 110 ; 111 ;# COMMAND ARGUMENT PROCESSING 112 ; This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed. 113 ;allow_arguments=0 114 ; 115 ;# COMMAND ALLOW NASTY META CHARS 116 ; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments. 117 ;allow_nasty_meta_chars=0 118 ; 119 ;# COMMAND ALLOW NASTY META CHARS 120 ; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments. 121 ;script_dir=c:\my\script\dir 122 123 [External Scripts] 124 ;check_es_long=scripts\long.bat 125 ;check_es_ok=scripts\ok.bat 126 ;check_es_nok=scripts\nok.bat 127 ;check_vbs_sample=cscript.exe //T:30 //NoLogo scripts\check_vb.vbs 128 129 [External Alias] 130 alias_cpu=checkCPU warn=80 crit=90 time=5m time=1m time=30s 131 alias_disk=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED 132 alias_service=checkServiceState CheckAll 133 alias_mem=checkMem MaxWarn=80% MaxCrit=90% ShowAll type=physical 105 134 106 135 -
NSCPlugin.cpp
r047516e rc1d545e 147 147 return fGetVersion(major, minor, revision)?true:false; 148 148 } catch (...) { 149 throw NSPluginException(file_, _T("Unhandled exception in getVersion in: ": ) + file_);149 throw NSPluginException(file_, _T("Unhandled exception in getVersion.")); 150 150 } 151 151 } … … 163 163 return false; 164 164 } catch (...) { 165 throw NSPluginException(file_, _T("Unhandled exception in hasCommandHandler in: ": ) + file_);165 throw NSPluginException(file_, _T("Unhandled exception in hasCommandHandler.")); 166 166 } 167 167 } … … 179 179 return false; 180 180 } catch (...) { 181 throw NSPluginException(file_, _T("Unhandled exception in hasMessageHandler in: ": ) + file_);181 throw NSPluginException(file_, _T("Unhandled exception in hasMessageHandler.")); 182 182 } 183 183 } … … 203 203 return fHandleCommand(command, argLen, arguments, returnMessageBuffer, returnMessageBufferLen, returnPerfBuffer, returnPerfBufferLen); 204 204 } catch (...) { 205 throw NSPluginException(file_, _T("Unhandled exception in handleCommand in: ": ) + file_);205 throw NSPluginException(file_, _T("Unhandled exception in handleCommand.")); 206 206 } 207 207 } … … 221 221 fHandleMessage(msgType, file, line, message); 222 222 } catch (...) { 223 throw NSPluginException(file_, _T("Unhandled exception in handleMessage in: ": ) + file_);223 throw NSPluginException(file_, _T("Unhandled exception in handleMessage.")); 224 224 } 225 225 } … … 236 236 fUnLoadModule(); 237 237 } catch (...) { 238 throw NSPluginException(file_, _T("Unhandled exception in handleMessage in: ": ) + file_);238 throw NSPluginException(file_, _T("Unhandled exception in handleMessage.")); 239 239 } 240 240 FreeLibrary(hModule_); … … 248 248 return fGetName(buf, buflen)?true:false; 249 249 } catch (...) { 250 throw NSPluginException(file_, _T("Unhandled exception in getName in: ": ) + file_);250 throw NSPluginException(file_, _T("Unhandled exception in getName.")); 251 251 } 252 252 } … … 257 257 return fGetDescription(buf, buflen)?true:false; 258 258 } catch (...) { 259 throw NSPluginException(file_, _T("Unhandled exception in getDescription in: ": ) + file_);259 throw NSPluginException(file_, _T("Unhandled exception in getDescription.")); 260 260 } 261 261 } … … 279 279 fModuleHelperInit(NSAPILoader); 280 280 } catch (...) { 281 throw NSPluginException(file_, _T("Unhandled exception in getDescription in: ": ) + file_);281 throw NSPluginException(file_, _T("Unhandled exception in getDescription.")); 282 282 } 283 283 … … 335 335 return fGetConfigurationMeta(buflen, buf)?true:false; 336 336 } catch (...) { 337 throw NSPluginException(file_, _T("Unhandled exception in getConfigurationMeta in: ": ) + file_);337 throw NSPluginException(file_, _T("Unhandled exception in getConfigurationMeta.")); 338 338 } 339 339 } … … 345 345 return fCommandLineExec(command, argLen, arguments); 346 346 } catch (...) { 347 throw NSPluginException(file_, _T("Unhandled exception in commandLineExec in: ": ) + file_);348 } 349 } 347 throw NSPluginException(file_, _T("Unhandled exception in commandLineExec.")); 348 } 349 } -
NSClient++-2005.sln
r3f69109 rc1d545e 45 45 EndProject 46 46 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LUA", "..\..\LUA\LUA\LUA.vcproj", "{B6D08289-B8AE-4391-9D07-93B22618BE58}" 47 EndProject 48 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CheckExternalScripts", "modules\CheckExternalScripts\CheckExternalScripts-2005.vcproj", "{0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}" 47 49 EndProject 48 50 Global … … 638 640 {B6D08289-B8AE-4391-9D07-93B22618BE58}.Release|Win32.Build.0 = Release|Win32 639 641 {B6D08289-B8AE-4391-9D07-93B22618BE58}.Release|x64.ActiveCfg = Release|Win32 642 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug|Any CPU.ActiveCfg = Debug|x64 643 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug|Itanium.ActiveCfg = Debug|x64 644 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 645 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug|Mixed Platforms.Build.0 = Debug|x64 646 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug|Win32.ActiveCfg = Debug|Win32 647 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug|Win32.Build.0 = Debug|Win32 648 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug|x64.ActiveCfg = Debug|x64 649 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug|x64.Build.0 = Debug|x64 650 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug-MemCheck|Any CPU.ActiveCfg = Debug-MemCheck|x64 651 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug-MemCheck|Itanium.ActiveCfg = Debug-MemCheck|x64 652 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug-MemCheck|Mixed Platforms.ActiveCfg = Debug-MemCheck|x64 653 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug-MemCheck|Mixed Platforms.Build.0 = Debug-MemCheck|x64 654 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug-MemCheck|Win32.ActiveCfg = Debug-MemCheck|Win32 655 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug-MemCheck|Win32.Build.0 = Debug-MemCheck|Win32 656 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug-MemCheck|x64.ActiveCfg = Debug-MemCheck|x64 657 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Debug-MemCheck|x64.Build.0 = Debug-MemCheck|x64 658 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Distribution|Any CPU.ActiveCfg = Distribution|x64 659 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Distribution|Itanium.ActiveCfg = Distribution|x64 660 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Distribution|Mixed Platforms.ActiveCfg = Distribution|x64 661 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Distribution|Mixed Platforms.Build.0 = Distribution|x64 662 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Distribution|Win32.ActiveCfg = Distribution|Win32 663 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Distribution|Win32.Build.0 = Distribution|Win32 664 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Distribution|x64.ActiveCfg = Distribution|x64 665 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Distribution|x64.Build.0 = Distribution|x64 666 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Nightly|Any CPU.ActiveCfg = Nightly|x64 667 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Nightly|Itanium.ActiveCfg = Nightly|x64 668 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Nightly|Mixed Platforms.ActiveCfg = Nightly|x64 669 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Nightly|Mixed Platforms.Build.0 = Nightly|x64 670 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Nightly|Win32.ActiveCfg = Nightly|Win32 671 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Nightly|Win32.Build.0 = Nightly|Win32 672 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Nightly|x64.ActiveCfg = Nightly|x64 673 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Nightly|x64.Build.0 = Nightly|x64 674 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Release|Any CPU.ActiveCfg = Release|x64 675 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Release|Itanium.ActiveCfg = Release|x64 676 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Release|Mixed Platforms.ActiveCfg = Release|x64 677 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Release|Mixed Platforms.Build.0 = Release|x64 678 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Release|Win32.ActiveCfg = Release|Win32 679 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Release|Win32.Build.0 = Release|Win32 680 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Release|x64.ActiveCfg = Release|x64 681 {0BEEC749-0E3E-4FB2-82DA-AC8D4730A129}.Release|x64.Build.0 = Release|x64 640 682 EndGlobalSection 641 683 GlobalSection(SolutionProperties) = preSolution -
NSClient++.cpp
rb5ef837 rc1d545e 242 242 try { 243 243 mainClient.unloadPlugins(); 244 } catch(NSPluginException *e) {245 std::wcout << _T("Exception raised: ") << e ->error_ << _T(" in module: ") << e->file_ << std::endl;;244 } catch(NSPluginException &e) { 245 std::wcout << _T("Exception raised: ") << e.error_ << _T(" in module: ") << e.file_ << std::endl;; 246 246 } 247 247 try { -
changelog
r047516e rc1d545e 6 6 * Add API for rehashing the daemon (or implement it the API is there but does nothing) 7 7 8 2008-02-09 MickeM 9 + New module CheckExternalScripts to handle 1, external script (similar to the old NRPE but in its own module) 10 - Can Check batch/vbs/programs/* 11 - Works with NSCA module (if you don't want to have NRPE at the same time) 12 - Simpler syntax (discarded old and added new section for alias) 13 - Started to add "sample alias" to ease initial setup and give some nice ideas (please provide me with feedback on them) 14 8 15 2008-02-08 MickeM 9 16 + Added some more default catch handlers (on the "core" side of plugin-calls). … … 20 27 21 28 2008-02-03 MickeM 22 + Added encryption subsystem to NSCA module (still no mcrypt support, but at least you have "xor" and passwords)29 + Added encryption subsystem to NSCA module (still no mcrypt support, but at least you have "xor" and passwords) 23 30 + Added API for scripts to register commands 24 31 + Added command descriptions (for some modules) 25 32 * Fixed issue in NRPE that displayed a console window when running commands 26 33 * New improved "inject" dialog from the system tray 27 Lists ava lible commands, and shows command descriptions and a lot of other improvments.28 + Added an internal log windows that displays log in real time.34 Lists available commands, and shows command descriptions and a lot of other improvements. 35 + Added an internal log windows that displays log in real-time. 29 36 + Fixed some issues with the dialog procs (should work smoother now, especially Termination) 30 37 31 38 2008-02-02 MickeM 32 39 * Might have fixed the "missing eventlog messages" problem. 33 + Added %count% parameter to syntax which (when used with unique) will display the numbe of hits for each message displayed.40 + Added %count% parameter to syntax which (when used with unique) will display the number of hits for each message displayed. 34 41 35 42 2008-01-27 MickeM 36 43 * Fixed a memory-leak in format_time 37 44 * Fixed so time/date is displayed in "local time" (not UTC) for the eventlog check 38 + Added %message% to even log check. Will display the "proper formated eventlog message" as in the eventlog viewer.45 + Added %message% to eventlog check. Will display the "proper formated eventlog message" as in the eventlog viewer. 39 46 For this to work you need to have the descriptions flag set 40 47 In short: /nrpe -H 192.168.0.147 -c checkEventLog -a truncate=1024 "syntax=%generated%: %message%" descriptions=true file=System MaxWarn=1 MaxCrit=1 filter+eventType==error filter+generated=\<12h filter=new filter=all filter=in … … 50 57 51 58 2007-12-10 MickeM 52 + Added in tial draft for LUA module59 + Added initial draft for LUA module 53 60 54 61 2007-12-09 MickeM … … 56 63 + Improved the socket thread with: 57 64 * a default-catch 58 * If the socket fail es to start we still wait for it to shut down (no error message)65 * If the socket fails to start we still wait for it to shut down (no error message) 59 66 + Added first version of the NSCA agent (NSCAgent.dll) 60 67 (no encryption support as of yet, but will come) … … 73 80 * Fixed some UNICODE issues with process-listings 74 81 + Added an error message if the "detected" process enumeration method is not available. 75 + Fixed some more unicode issues Password encrypt/decrypt: #10776 * Fixed unicode issues with "external programs" #10982 + Fixed some more Unicode issues Password encrypt/decrypt: #107 83 * Fixed Unicode issues with "external programs" #109 77 84 * Fixed so default string for check_nt:s FILEAGE command is "delta" is 5 minutes ago (and not absolute ie. 1970...), Issue #39 78 85 + added support for <date strings> to check_nt:s FILEAGE command, Issue #39 -
include/Mutex.h
r978bd31 rc1d545e 23 23 #include "Singleton.h" 24 24 #include "strEx.h" 25 #include <assert.h>26 25 #include <windows.h> 27 26 #include <iostream> … … 62 61 if ( GetLastError() == ERROR_ALREADY_EXISTS ) 63 62 hMutex = OpenMutex(MUTEX_ALL_ACCESS, FALSE, NULL); 64 assert(hMutex != NULL);63 std::wcout << _T("Error in mutex creation: ") << GetLastError() << std::endl; 65 64 } 66 65 /** … … 123 122 */ 124 123 MutexLock(HANDLE hMutex, DWORD timeout = 5000L) : bHasMutex(false), hMutex_(hMutex) { 125 if (hMutex_ == NULL) 126 std::wcout << "Whops..." << std::endl; 127 assert(hMutex_ != NULL); 124 if (hMutex_ == NULL) { 125 std::wcout << _T("Error in mutex lock: ") << std::endl; 126 bHasMutex = false; 127 return; 128 } 128 129 dwWaitResult = WaitForSingleObject(hMutex_, timeout); 129 130 switch (dwWaitResult) { -
include/NSCHelper.cpp
r6b690bf rc1d545e 268 268 * @return The result of the command 269 269 */ 270 NSCAPI::nagiosReturn NSCModuleHelper::InjectSplitAndCommand(const std::wstring command, const std::wstring buffer, TCHAR splitChar, std::wstring & message, std::wstring & perf )270 NSCAPI::nagiosReturn NSCModuleHelper::InjectSplitAndCommand(const std::wstring command, const std::wstring buffer, TCHAR splitChar, std::wstring & message, std::wstring & perf, bool escape) 271 271 { 272 272 if (!fNSAPIInject) … … 277 277 aBuffer= arrayBuffer::createEmptyArrayBuffer(argLen); 278 278 else 279 aBuffer= arrayBuffer::split2arrayBuffer(buffer, splitChar, argLen );279 aBuffer= arrayBuffer::split2arrayBuffer(buffer, splitChar, argLen, escape); 280 280 NSCAPI::nagiosReturn ret = InjectCommand(command.c_str(), argLen, aBuffer, message, perf); 281 281 arrayBuffer::destroyArrayBuffer(aBuffer, argLen); -
include/NSCHelper.h
r047516e rc1d545e 134 134 NSCAPI::nagiosReturn InjectCommand(const TCHAR* command, const unsigned int argLen, TCHAR **argument, std::wstring & message, std::wstring & perf); 135 135 NSCAPI::nagiosReturn InjectSplitAndCommand(const TCHAR* command, TCHAR* buffer, TCHAR splitChar, std::wstring & message, std::wstring & perf); 136 NSCAPI::nagiosReturn InjectSplitAndCommand(const std::wstring command, const std::wstring buffer, TCHAR splitChar, std::wstring & message, std::wstring & perf );136 NSCAPI::nagiosReturn InjectSplitAndCommand(const std::wstring command, const std::wstring buffer, TCHAR splitChar, std::wstring & message, std::wstring & perf, bool escape = false); 137 137 void StopService(void); 138 138 std::wstring getBasePath(); -
include/config.h
r035c51f rc1d545e 105 105 #define NRPE_SETTINGS_SCRIPTDIR_DEFAULT _T("") 106 106 107 // External Script Settings headlines 108 #define EXTSCRIPT_SECTION_TITLE _T("External Script") 109 #define EXTSCRIPT_SCRIPT_SECTION_TITLE _T("External Scripts") 110 #define EXTSCRIPT_ALIAS_SECTION_TITLE _T("External Alias") 111 #define EXTSCRIPT_SETTINGS_TIMEOUT _T("command_timeout") 112 #define EXTSCRIPT_SETTINGS_TIMEOUT_DEFAULT 60 113 #define EXTSCRIPT_SETTINGS_ALLOW_ARGUMENTS _T("allow_arguments") 114 #define EXTSCRIPT_SETTINGS_ALLOW_ARGUMENTS_DEFAULT 0 115 #define EXTSCRIPT_SETTINGS_ALLOW_NASTY_META _T("allow_nasty_meta_chars") 116 #define EXTSCRIPT_SETTINGS_ALLOW_NASTY_META_DEFAULT 0 117 #define EXTSCRIPT_SETTINGS_SCRIPTDIR _T("script_dir") 118 #define EXTSCRIPT_SETTINGS_SCRIPTDIR_DEFAULT _T("") 119 107 120 // Check System Settings 108 121 #define C_SYSTEM_SECTION_TITLE _T("Check System") -
include/thread.h
r047516e rc1d545e 68 68 bool bThreadHasBeenClosed; 69 69 70 70 #define THREAD_MAGIC_ID 123456 71 71 72 72 typedef struct thread_param { … … 74 74 LPVOID lpParam; // The optional argument to the thread 75 75 Thread *pCore; 76 unsigned int magic_id; 76 77 } thread_param; 77 78 … … 83 84 Thread(std::wstring threadid) : threadid_(threadid), hThread_(NULL), pObject_(NULL), uThreadID(-1), bThreadHasTerminated(false), bThreadHasBeenClosed(false) { 84 85 hMutex_ = CreateMutex(NULL, FALSE, NULL); 85 assert(hMutex_ != NULL); 86 if (hMutex_ == NULL) { 87 std::wcerr << _T("Failed to create thread mutec for thread: ") << threadid << _T(": ") << GetLastError() << std::endl; 88 } 86 89 } 87 90 /** … … 125 128 static unsigned __stdcall threadProc(void* lpParameter) { 126 129 thread_param* param = static_cast<thread_param*>(lpParameter); 130 if (param->magic_id != THREAD_MAGIC_ID) { 131 std::wcerr << _T("Thread magic ID check failed :(") << std::endl; 132 _endthreadex( 0 ); 133 return 0; 134 } 127 135 T* instance = param->instance; 128 136 LPVOID lpParam = param->lpParam; 129 137 Thread *pCore = param->pCore; 130 138 delete param; 131 132 unsigned returnCode = instance->threadProc(lpParam); 139 unsigned returnCode = 0; 140 try { 141 returnCode = instance->threadProc(lpParam); 142 } catch (...) { 143 std::wcerr << _T("Unhandled exception in thread a :(") << std::endl; 144 } 133 145 pCore->terminate(); 134 146 _endthreadex( 0 ); 135 147 return returnCode; 136 137 // _endthread();138 148 } 139 149 … … 149 159 */ 150 160 void createThread(LPVOID lpParam = NULL) { 161 if (hMutex_ == NULL) 162 throw ThreadException(_T("No mutex in createThread (") + threadid_ + _T(") not started...")); 151 163 thread_param* param = NULL; 152 164 { … … 158 170 throw ThreadException(_T("Thread already started, thread (") + threadid_ + _T(") not started...")); 159 171 } 160 // assert(hStopEvent_ == NULL);161 172 param = new thread_param; 173 if (param == NULL) 174 throw ThreadException(_T("Failed to allocate memory for new thread: ") + threadid_); 162 175 param->instance = pObject_ = new T; 163 // param->hStopEvent = hStopEvent_ = CreateEvent(NULL, TRUE, FALSE, NULL); 176 if (param->instance == NULL) 177 throw ThreadException(_T("Failed to allocate memory for new thread: ") + threadid_); 164 178 param->lpParam = lpParam; 165 179 param->pCore = this; 166 } 167 //hThread_ = reinterpret_cast<HANDLE>(::_beginthreadex(threadProc, 0, reinterpret_cast<VOID*>(param))); 168 //hThread = (HANDLE)_beginthreadex( NULL, 0, &SecondThreadFunc, NULL, 0, &threadID ); 180 param->magic_id = THREAD_MAGIC_ID; 181 } 169 182 uintptr_t thread_handle = ::_beginthreadex(NULL, 0, threadProc, reinterpret_cast<VOID*>(param), 0, &uThreadID); 170 183 if (thread_handle == 0 || thread_handle == 1 || thread_handle == -1) { … … 179 192 */ 180 193 bool exitThread(const unsigned int delay = 20000L) { 194 if (hMutex_ == NULL) 195 throw ThreadException(_T("No mutex in createThread (") + threadid_ + _T(") not started...")); 181 196 DWORD dwWaitResult = -1; 182 197 { … … 198 213 } 199 214 std::wcerr << _T("Failed to terminate thread: ") << threadid_ << _T("...") << std::endl; 200 //assert(false);201 215 return false; 202 216 } -
modules/CheckSystem/PDHCollector.cpp
r47b843a rc1d545e 47 47 bool bUseIndex = false; 48 48 49 // Investigate envi ornment and find out what to use49 // Investigate environment and find out what to use 50 50 try { 51 51 OSVERSIONINFO osVer = systemInfo::getOSVersion();
Note: See TracChangeset
for help on using the changeset viewer.








