Changeset 70f2d7b in nscp for NSClient++.cpp
- Timestamp:
- 03/29/06 22:19:32 (7 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- 76aafc4
- Parents:
- aabbd97
- File:
-
- 1 edited
-
NSClient++.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
NSClient++.cpp
rf42280d r70f2d7b 20 20 #include <Socket.h> 21 21 #include <b64/b64.h> 22 #include <config.h> 22 23 23 24 … … 65 66 g_bConsoleLog = true; 66 67 std::string password; 67 Settings::getInstance()->setFile(mainClient.getBasePath() + "NSC.ini"); 68 try { 69 Settings::getInstance()->setFile(mainClient.getBasePath() + "NSC.ini"); 70 } catch (SettingsException e) { 71 std::cout << "Could not find settings: " << e.getMessage() << std::endl;; 72 return 1; 73 } 68 74 std::cout << "Enter password to encrypt (has to be a single word): "; 69 75 std::cin >> password; … … 97 103 #endif 98 104 g_bConsoleLog = true; 99 mainClient.InitiateService(); 105 if (!mainClient.InitiateService()) { 106 LOG_ERROR_STD("Service *NOT* started!"); 107 return -1; 108 } 109 LOG_MESSAGE_STD("Using settings from: " + Settings::getInstance()->getActiveType()); 100 110 LOG_MESSAGE("Enter command to inject or exit to terminate..."); 101 111 std::string s = ""; … … 146 156 * When the program is started as a service this will be the entry point. 147 157 */ 148 void NSClientT::InitiateService(void) { 149 Settings::getInstance()->setFile(getBasePath() + "NSC.ini"); 150 158 bool NSClientT::InitiateService(void) { 159 try { 160 Settings::getInstance()->setFile(getBasePath() + "NSC.ini"); 161 } catch (SettingsException e) { 162 LOG_ERROR_STD("Could not find settings: " + e.getMessage()); 163 return false; 164 } 151 165 try { 152 166 simpleSocket::WSAStartup(); 153 167 } catch (simpleSocket::SocketException e) { 154 168 LOG_ERROR_STD("Uncaught exception: " + e.getMessage()); 169 return false; 155 170 } 156 171 … … 161 176 } catch(const NSPluginException& e) { 162 177 LOG_ERROR_STD("Exception raised: " + e.error_ + " in module: " + e.file_); 178 return false; 163 179 } 164 180 } 165 181 loadPlugins(); 182 return true; 166 183 } 167 184 /**
Note: See TracChangeset
for help on using the changeset viewer.








