intrepidcs / libicsneo

Intrepid Control Systems device communication library
Other
36 stars 32 forks source link

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

Open vits71 opened 11 months ago

vits71 commented 11 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.