| 50 | // |
| 51 | |
| 52 | USHORT CLIENT_install(const TEXT * rootdir, USHORT client, bool sw_force, err_handler_t err_handler) |
| 53 | { |
| 54 | /************************************** |
| 55 | * |
| 56 | * C L I E N T _ i n s t a l l |
| 57 | * |
| 58 | ************************************** |
| 59 | * |
| 60 | * Functional description |
| 61 | * Depending on the USHORT client parameter, installs FBCLIENT.DLL or |
| 62 | * GDS32.DLL in the Windows System directory. |
| 63 | * |
| 64 | * When installing and -force is NOT used then |
| 65 | * |
| 66 | * test for existence of client library |
| 67 | * if earlier version then copy, increment shared library count |
| 68 | * if same version then do nothing |
| 69 | * if later version then do nothing |
| 70 | * |
| 71 | * If -force is supplied then |
| 72 | * |
| 73 | * test for existence of client library |
| 74 | * if the version doesn't match then copy, increment shared library count |
| 75 | * else do nothing |
| 76 | * |
| 77 | **************************************/ |
| 78 | |
| 79 | // Get Windows System Directory |
| 80 | TEXT sysdir[MAXPATHLEN]; |
| 81 | int len = GetSystemDirectory(sysdir, sizeof(sysdir)); |
| 82 | if (len == 0) |
| 83 | return (*err_handler) (GetLastError(), "GetSystemDirectory()"); |
| 84 | |
| 85 | // Compute newverMS and newverLS. They will contain the full client version |
| 86 | // number that we intend to install to WinSysDir. |
| 87 | TEXT fbdll[MAXPATHLEN]; |
| 88 | lstrcpy(fbdll, rootdir); |
| 89 | // lstrcat(fbdll, "\\bin\\"); |
| 90 | lstrcat(fbdll, "\\"); |
| 91 | lstrcat(fbdll, FBCLIENT_NAME); |
| 92 | |
| 93 | DWORD newverMS = 0, newverLS = 0; |
| 94 | USHORT status = GetVersion(fbdll, newverMS, newverLS, err_handler); |
| 95 | if (status != FB_SUCCESS) |
| 96 | return status; |
| 97 | |
| 98 | if (client == CLIENT_GDS) |
| 99 | { |
| 100 | // For the GDS32.DLL installation, the major/minor version is hardcoded |
| 101 | newverMS = (GDSVER_MAJOR << 16) | GDSVER_MINOR; |
| 102 | } |
| 103 | |
| 104 | // Check for existence and version of current installed DLL |
| 105 | TEXT target[MAXPATHLEN]; |
| 106 | lstrcpy(target, sysdir); |
| 107 | lstrcat(target, "\\"); |
| 108 | lstrcat(target, client == CLIENT_GDS ? GDS32_NAME : FBCLIENT_NAME); |
| 109 |
no test coverage detected