Skip to content

Commit 0f3290a

Browse files
committed
Add additional search path for vciapi.dll, which might be necessary when the target application is installed sandboxed, e.g. trough the Microsoft Store.
1 parent 337dad9 commit 0f3290a

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

src/CANvenient.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,26 @@ CANVENIENT_API int can_find_interfaces_mask(u32 vendor_mask)
4444
// https://github.com/CANopenTerm/CANopenTerm/issues/109#issuecomment-4320171025
4545
if (! once_checked_vciapi_dll)
4646
{
47-
if (GetFileAttributesA("vciapi.dll") != INVALID_FILE_ATTRIBUTES)
47+
static const char* vciapi_search_paths[] = {
48+
"vciapi.dll",
49+
"C:\\Program Files\\HMS\\Ixxat VCI\\sdk\\vci\\bin\\x64\\release\\vciapi.dll",
50+
NULL
51+
};
52+
53+
for (int p = 0; vciapi_search_paths[p] != NULL; p++)
4854
{
49-
vciapi_dll_handle = LoadLibraryA("vciapi.dll");
50-
if (! vciapi_dll_handle)
51-
{
52-
puts("vciapi.dll not found. Ixxat interfaces will be ignored.");
53-
is_vciapi_dll_available = false;
54-
}
55-
else
55+
if (GetFileAttributesA(vciapi_search_paths[p]) != INVALID_FILE_ATTRIBUTES)
5656
{
57-
is_vciapi_dll_available = true;
57+
vciapi_dll_handle = LoadLibraryA(vciapi_search_paths[p]);
58+
if (vciapi_dll_handle)
59+
{
60+
is_vciapi_dll_available = true;
61+
break;
62+
}
5863
}
5964
}
60-
else
65+
66+
if (! is_vciapi_dll_available)
6167
{
6268
puts("vciapi.dll not found. Ixxat interfaces will be ignored.");
6369
}

0 commit comments

Comments
 (0)