Windows CAN DLL driver sanity check.
--- a/drivers/can_peak_win32/can_peak_win32.c Fri Feb 03 21:42:48 2012 +0100
+++ b/drivers/can_peak_win32/can_peak_win32.c Fri Feb 03 22:13:25 2012 +0100
@@ -2,6 +2,7 @@
This file is part of CanFestival, a library implementing CanOpen Stack.
Copyright (C): Edouard TISSERANT and Francis DUPIN
+Modified by: Jaroslav Fojtik
See COPYING file for copyrights details.
--- a/drivers/win32/win32.c Fri Feb 03 21:42:48 2012 +0100
+++ b/drivers/win32/win32.c Fri Feb 03 22:13:25 2012 +0100
@@ -118,6 +118,17 @@
m_canOpen = (CANOPEN_DRIVER_PROC)GetProcAddress(handle, myTEXT("canOpen_driver"));
m_canClose = (CANCLOSE_DRIVER_PROC)GetProcAddress(handle, myTEXT("canClose_driver"));
m_canChangeBaudRate = (CANCHANGEBAUDRATE_DRIVER_PROC)GetProcAddress(handle, myTEXT("canChangeBaudRate_driver"));
+
+ if(m_canReceive==NULL || m_canSend==NULL || m_canOpen==NULL || m_canClose==NULL || m_canChangeBaudRate==NULL)
+ {
+ m_canReceive = NULL;
+ m_canSend = NULL;
+ m_canOpen = NULL;
+ m_canClose = NULL;
+ m_canChangeBaudRate = NULL;
+ FreeLibrary(handle);
+ handle = NULL;
+ }
#else
//compiled in...
handle = 1; //TODO: remove this hack
@@ -140,7 +151,7 @@
{
return m_canSend(((CANPort*)port)->fd, m);
}
- return 1;
+ return 1; /* NOT OK */
}
/***************************************************************************/