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_,
443
443
return ret ;
444
444
}
445
445
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
+
446
466
int
447
467
main (int argc , char * * argv )
448
468
{
@@ -466,6 +486,9 @@ main(int argc, char **argv)
466
486
int devnum ;
467
487
#endif
468
488
int status ;
489
+
490
+ init_npcap_dll_path ();
491
+
469
492
#ifdef WIN32
470
493
u_int UserBufferSize = 1000000 ;
471
494
if (wsockinit () != 0 ) return 1 ;
Original file line number Diff line number Diff line change 135
135
<DataExecutionPrevention >
136
136
</DataExecutionPrevention >
137
137
<TargetMachine >MachineX86</TargetMachine >
138
+ <DelayLoadDLLs >wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs >
138
139
</Link >
139
140
<Bscmake >
140
141
<SuppressStartupBanner >true</SuppressStartupBanner >
176
177
<DataExecutionPrevention >
177
178
</DataExecutionPrevention >
178
179
<TargetMachine >MachineX86</TargetMachine >
180
+ <DelayLoadDLLs >wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs >
179
181
</Link >
180
182
<Bscmake >
181
183
<SuppressStartupBanner >true</SuppressStartupBanner >
221
223
<DataExecutionPrevention >
222
224
</DataExecutionPrevention >
223
225
<TargetMachine >MachineX64</TargetMachine >
226
+ <DelayLoadDLLs >wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs >
224
227
</Link >
225
228
<Bscmake >
226
229
<SuppressStartupBanner >true</SuppressStartupBanner >
263
266
<DataExecutionPrevention >
264
267
</DataExecutionPrevention >
265
268
<TargetMachine >MachineX64</TargetMachine >
269
+ <DelayLoadDLLs >wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs >
266
270
</Link >
267
271
<Bscmake >
268
272
<SuppressStartupBanner >true</SuppressStartupBanner >
You can’t perform that action at this time.
0 commit comments