-----
Description
-----

This is a security patch for the x86 curl library for AKCP APS v16.

The curl library in APS is responsible for the following software functionalities:
- ProbeManager device firmware upgrading and restoring to default configuration
- ProbeManager's detection of device type, preventing firmware upgrade with an incompatible file, e.g., SP+F7 on an H7 device
- ProbeManager device configuration (backup file) get/set
- ProbeManager's device password login when WebUI password checking is enabled
- ProbeManager admin password management (for SP+ devices)
- Scan for devices on the network

Although curl receives periodic security updates, the official packages no longer include a 32-bit x86 version.
Therefore, we provide this security patch package for customers who do not wish to compile the curl libraries themselves, but still want to use an updated curl version.

Note: This patch must be applied to each APS installation, and you must redo the patch whenever you reinstall APS.

-----
Usage
-----

We've prepared a patcher script (aps-curl-patcher.cmd) to do the update automatically. It must be run with elevated rights.

IMPORTANT: The script assumes APS is installed in the default location: C:\Program Files (x86)\AKCP\AKCPro Server
           If you have installed APS to another location, either modify the script or do the patching manually (see below).

How to use the patcher script (aps-curl-patcher.cmd):

1. Extract all files from the ZIP file to a writeable location, e.g., under the Downloads or Documents folder.
2. Right-click and select "Run as Administrator" on the patcher script (aps-curl-patcher.cmd).

 The script will do the update automatically as follows:
  1. Stop the running APS service
  2. Make a backup of existing curl files into the CurlBackup subdirectory
  3. Overwrite and copy the new curl files to the APS directory without prompting:
     C:\Program Files (x86)\AKCP\AKCPro Server\bin\utilities\curl.exe
     C:\Program Files (x86)\AKCP\AKCPro Server\bin\libcurl.dll
     C:\Program Files (x86)\AKCP\AKCPro Server\bin\zlib1.dll
  4. Restart the previously running APS service again

 Backup of the original curl files: You can find the older version curl libraries (curl.exe, libcurl.dll) under the current directory in the CurlBackup subdirectory.

 The APS service will be stopped and restarted during the patch.
  Note: If your system has a large number of devices and sensors, it might take a long time to restart the service.
  You should monitor the service restarting with the AKCPro Server Manager.
  If it seems to be stuck in a restart loop:
  Manually stop the service from AKCPro Server Manager's menu (you might need to click "stop service" multiple times), wait until it fully stops, then start it again.

If you do not want to use the provided script, or your APS location is non-default then you could manually replace and update the curl library as follows:

    1) Use AKCPro Server Manager => Stop Service to stop the APS.
    2) Make a backup of these files, then replace the curl.exe and libcurl.dll from this patch package to the following directories in APS:
        curl.exe => C:\Program Files (x86)\AKCP\AKCPro Server\bin\utilities
        libcurl.dll => C:\Program Files (x86)\AKCP\AKCPro Server\bin
    3) Copy the additional zlib1.dll from this patch package to the following directory in APS:
        zlib1.dll => C:\Program Files (x86)\AKCP\AKCPro Server\bin
    4) Use AKCPro Server Manager => Start Service to start the APS.
