MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / CLIENT_query

Function CLIENT_query

src/utilities/install/install.cpp:355–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353}
354
355USHORT CLIENT_query(USHORT client, ULONG& verMS, ULONG& verLS, ULONG& sharedCount,
356 err_handler_t err_handler)
357{
358/**************************************
359 *
360 * C L I E N T _ q u e r y
361 *
362 **************************************
363 *
364 * Functional description
365 * Depending on the USHORT client parameter, returns version info and
366 * shared dll count of the currently installed GDS32.DLL or FBCLIENT.DLL.
367 * Eventually return FB_INSTALL_FILE_NOT_FOUND.
368 *
369 **************************************/
370
371 // Get Windows System Directory
372 TEXT sysdir[MAXPATHLEN];
373 int len = GetSystemDirectory(sysdir, sizeof(sysdir));
374 if (len == 0)
375 return (*err_handler) (GetLastError(), "GetSystemDirectory()");
376
377 TEXT target[MAXPATHLEN];
378 lstrcpy(target, sysdir);
379 lstrcat(target, "\\");
380 lstrcat(target, client == CLIENT_GDS ? GDS32_NAME : FBCLIENT_NAME);
381
382 verMS = verLS = sharedCount = 0;
383 USHORT status = GetVersion(target, verMS, verLS, err_handler);
384 if (status != FB_SUCCESS)
385 return status; // FB_FAILURE or FB_INSTALL_FILE_NOT_FOUND
386
387 HKEY hkey;
388 LONG keystatus = RegOpenKeyEx(HKEY_LOCAL_MACHINE, SHARED_KEY, 0,
389 KEY_READ, &hkey);
390 if (keystatus != ERROR_SUCCESS)
391 return (*err_handler) (keystatus, "RegOpenKeyEx");
392
393 DWORD type, size = sizeof(sharedCount);
394 sharedCount = 0;
395 RegQueryValueEx(hkey, target, NULL, &type, reinterpret_cast<BYTE*>(&sharedCount), &size);
396 RegCloseKey(hkey);
397
398 return FB_SUCCESS;
399}
400
401//
402// --- Local Functions ---

Callers 1

CLIB_ROUTINE mainFunction · 0.85

Calls 1

GetVersionFunction · 0.85

Tested by

no test coverage detected