apcupsd 3.14.10 is an excellent control software
used in conjunction with the uninterruptible power supplies
from American Power Conversion (APC), now available from
Schneider Electric.
apcupsd is supposed to run on Windows NT4, albeit without USB capability.
However, apcupsd can only be installed on NT4.
After installation, apcupsd fails to appear as a service.
Attempts to run it manually causes it to terminate immediately with unable to find SetupDiEnumDeviceInterface in setupapi.dll.
The API SetupDiEnumDeviceInterface first appeared only in Windows 2000. Understandably, apcupsd cannot run in NT4 out of the box.
SetupDiEnumDeviceInterface is associated with USB
support.
Since we do not have USB support on Windows NT4 in the first place,
the solution is to comment out the call to
SetupDiEnumDeviceInterface, and recompile.
Comment out lines 163 and 164 in src/win32/libusb-winusb-bridge.c, which is as follows, in red:
int usb_find_devices(void)
{
// Get the set of device interfaces that have been matched by our INF
HDEVINFO deviceInfo = SetupDiGetClassDevs(
&APCUPSD_DEVICE_GUID, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
if (!deviceInfo)
{
return 0;
}
// Iterate over all interfaces
int ndevs = 0;
int devidx = 0;
while (ndevs < MAX_USB_DEVICES)
{
// Get interface data for next interface and attempt to init it
SP_DEVICE_INTERFACE_DATA interfaceData;
interfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
/*
if (!SetupDiEnumDeviceInterfaces(
deviceInfo, NULL, &APCUPSD_DEVICE_GUID, devidx++, &interfaceData))
*/
{
break;
}
// Determine required size for interface detail data
Make the installable target winapcupsd.
apctray.exe program will not run on Windows NT4.
It fails with The procedure entry point GetWindowInfo could not be located in the dynamic link library USER32.dll.
This is due to the API introduced for the first time only in Windows 2000.
However, apctray.exe is not critical to apcupsd operation.