MCPcopy Create free account
hub / github.com/MonaSolutions/MonaServer / config

Method config

MonaBase/sources/WinService.cpp:237–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235
236
237LPQUERY_SERVICE_CONFIGA WinService::config(Exception& ex) const {
238 if (!open(ex))
239 return NULL;
240 int size = 4096;
241 DWORD bytesNeeded;
242 LPQUERY_SERVICE_CONFIGA pSvcConfig = (LPQUERY_SERVICE_CONFIGA)LocalAlloc(LPTR, size);
243 if (!pSvcConfig) {
244 ex.set(Exception::SERVICE, "Cannot allocate service config buffer");
245 return NULL;
246 }
247 while (!QueryServiceConfigA(_svcHandle, pSvcConfig, size, &bytesNeeded)) {
248 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
249 LocalFree(pSvcConfig);
250 size = bytesNeeded;
251 pSvcConfig = (LPQUERY_SERVICE_CONFIGA)LocalAlloc(LPTR, size);
252 } else {
253 LocalFree(pSvcConfig);
254 ex.set(Exception::SERVICE, "Cannot query service ", _name, " configuration");
255 return NULL;
256 }
257 }
258 return pSvcConfig;
259}
260
261
262} // namespace Mona

Callers

nothing calls this directly

Calls 1

setMethod · 0.45

Tested by

no test coverage detected