intrepidcs / libicsneo

An open source solution to integrate Intrepid Control Systems vehicle networking hardware with your application.
Other
37 stars 32 forks source link

Bugs in PCAPDLL::PCAPDLL() disallows using Npcap wpcap.dll #63

Open vits71 opened 10 months ago

vits71 commented 10 months ago

PCAPDLL constructor has alternative path for Npcap libraries when libicneo is build with LIBICSNEO_NPCAP_INCLUDE_DIR. There are two bugs in this path:

  1. dllPath variable used for AddDllDirectory() is of type TCHAR [] but AddDllDirectory() expects LPWSTR so the string needs to be converted to wide string first.
  2. LoadLibraryEx() uses LOAD_LIBRARY_SEARCH_USER_DIRS so it is unable to load other dependent modules. Proper flag should be LOAD_LIBRARY_SEARCH_DEFAULT_DIRS which includes both user and system paths to search.