Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / arch / all-mingw32 / battclock / battclock_init.c
blobcb2e0a5299e4c1c3c3379d29b6ca7b5cf7dec8cd
1 #define DEBUG 0
3 #include <aros/debug.h>
4 #include <aros/libcall.h>
5 #include <aros/symbolsets.h>
6 #include <proto/exec.h>
7 #include <proto/hostlib.h>
8 #include "battclock_intern.h"
10 static const char *Symbols[] = {
11 "GetLocalTime",
12 "SetLocalTime",
13 NULL
16 /* auto init */
17 static int BattClock_Init(struct BattClockBase *BattClockBase)
19 APTR HostLibBase;
20 ULONG r;
22 HostLibBase = OpenResource("hostlib.resource");
23 D(bug("[battclock] HostLibBase = 0x%08lX\n", HostLibBase));
24 if (HostLibBase) {
25 BattClockBase->Lib = HostLib_Open("kernel32.dll", NULL);
26 if (BattClockBase->Lib) {
27 BattClockBase->KernelIFace = (struct KernelInterface *)HostLib_GetInterface(BattClockBase->Lib, Symbols, &r);
28 D(bug("[battclock] KernelIFace = 0x%08lX\n", BattClockBase->KernelIFace));
29 if (BattClockBase->KernelIFace) {
30 if (!r)
31 return 1;
32 HostLib_DropInterface((APTR)BattClockBase->KernelIFace);
34 HostLib_Close(BattClockBase->Lib, NULL);
37 return 0;
40 ADD2INITLIB(BattClock_Init, 0)