File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -443,6 +443,26 @@ static int tcpdump_printf(netdissect_options *ndo _U_,
443443 return ret ;
444444}
445445
446+ static void init_npcap_dll_path ()
447+ {
448+ BOOL (WINAPI * SetDllDirectory )(LPCTSTR );
449+ char sysdir_name [512 ];
450+ int len ;
451+
452+ SetDllDirectory = (BOOL (WINAPI * )(LPCTSTR )) GetProcAddress (GetModuleHandle ("kernel32.dll" ), "SetDllDirectoryA" );
453+ if (SetDllDirectory == NULL ) {
454+ error ("Error in SetDllDirectory" );
455+ }
456+ else {
457+ len = GetSystemDirectory (sysdir_name , 480 ); // be safe
458+ if (!len )
459+ error ("Error in GetSystemDirectory (%d)" , GetLastError ());
460+ strcat (sysdir_name , "\\Npcap" );
461+ if (SetDllDirectory (sysdir_name ) == 0 )
462+ error ("Error in SetDllDirectory(\"System32\\Npcap\")" );
463+ }
464+ }
465+
446466int
447467main (int argc , char * * argv )
448468{
@@ -466,6 +486,9 @@ main(int argc, char **argv)
466486 int devnum ;
467487#endif
468488 int status ;
489+
490+ init_npcap_dll_path ();
491+
469492#ifdef WIN32
470493 u_int UserBufferSize = 1000000 ;
471494 if (wsockinit () != 0 ) return 1 ;
Original file line number Diff line number Diff line change 135135 <DataExecutionPrevention >
136136 </DataExecutionPrevention >
137137 <TargetMachine >MachineX86</TargetMachine >
138+ <DelayLoadDLLs >wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs >
138139 </Link >
139140 <Bscmake >
140141 <SuppressStartupBanner >true</SuppressStartupBanner >
176177 <DataExecutionPrevention >
177178 </DataExecutionPrevention >
178179 <TargetMachine >MachineX86</TargetMachine >
180+ <DelayLoadDLLs >wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs >
179181 </Link >
180182 <Bscmake >
181183 <SuppressStartupBanner >true</SuppressStartupBanner >
221223 <DataExecutionPrevention >
222224 </DataExecutionPrevention >
223225 <TargetMachine >MachineX64</TargetMachine >
226+ <DelayLoadDLLs >wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs >
224227 </Link >
225228 <Bscmake >
226229 <SuppressStartupBanner >true</SuppressStartupBanner >
263266 <DataExecutionPrevention >
264267 </DataExecutionPrevention >
265268 <TargetMachine >MachineX64</TargetMachine >
269+ <DelayLoadDLLs >wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs >
266270 </Link >
267271 <Bscmake >
268272 <SuppressStartupBanner >true</SuppressStartupBanner >
You can’t perform that action at this time.
0 commit comments