| 273 | } |
| 274 | |
| 275 | USHORT CLIENT_remove(const TEXT* rootdir, USHORT client, bool sw_force, err_handler_t err_handler) |
| 276 | { |
| 277 | /************************************** |
| 278 | * |
| 279 | * C L I E N T _ r e m o v e |
| 280 | * |
| 281 | ************************************** |
| 282 | * |
| 283 | * Functional description |
| 284 | * Depending on the USHORT client parameter, remove FBCLIENT.DLL or GDS32.DLL |
| 285 | * from the Windows System directory. |
| 286 | * |
| 287 | * when removing and -force is NOT used |
| 288 | * |
| 289 | * test for existence of client library |
| 290 | * if version matches then decrement shared library count |
| 291 | * if count=0 then delete library, remove entry from shared library |
| 292 | * if version doesn't match then do nothing. It is not ours. |
| 293 | * |
| 294 | * when removing and -force IS used |
| 295 | * |
| 296 | * test for existence of client library |
| 297 | * if version matches then delete library, remove entry for shared library |
| 298 | * if version doesn't match then do nothing. It is not ours. |
| 299 | * |
| 300 | **************************************/ |
| 301 | |
| 302 | // Get Windows System Directory |
| 303 | TEXT sysdir[MAXPATHLEN]; |
| 304 | int len = GetSystemDirectory(sysdir, sizeof(sysdir)); |
| 305 | if (len == 0) |
| 306 | return (*err_handler) (GetLastError(), "GetSystemDirectory()"); |
| 307 | |
| 308 | // Compute ourverMS and ourverLS. They will contain the full client version |
| 309 | // number that we could have installed to WinSysDir. |
| 310 | TEXT fbdll[MAXPATHLEN]; |
| 311 | lstrcpy(fbdll, rootdir); |
| 312 | // lstrcat(fbdll, "\\bin\\"); |
| 313 | lstrcat(fbdll, "\\"); |
| 314 | lstrcat(fbdll, FBCLIENT_NAME); |
| 315 | |
| 316 | DWORD ourverMS = 0, ourverLS = 0; |
| 317 | USHORT status = GetVersion(fbdll, ourverMS, ourverLS, err_handler); |
| 318 | if (status != FB_SUCCESS) |
| 319 | return status; |
| 320 | |
| 321 | if (client == CLIENT_GDS) |
| 322 | { |
| 323 | // For the GDS32.DLL, the major/minor version is hardcoded |
| 324 | ourverMS = (GDSVER_MAJOR << 16) | GDSVER_MINOR; |
| 325 | } |
| 326 | |
| 327 | // Check for existence and version of current installed client |
| 328 | TEXT target[MAXPATHLEN]; |
| 329 | lstrcpy(target, sysdir); |
| 330 | lstrcat(target, "\\"); |
| 331 | lstrcat(target, client == CLIENT_GDS ? GDS32_NAME : FBCLIENT_NAME); |
| 332 |
no test coverage detected