misc.h 497 B

12345678910111213141516171819
  1. #include <tchar.h>
  2. #include <stdio.h>
  3. BOOL LoadNpcapDlls()
  4. {
  5. _TCHAR npcap_dir[512];
  6. UINT len;
  7. len = GetSystemDirectory(npcap_dir, 480);
  8. if (!len) {
  9. fprintf(stderr, "Error in GetSystemDirectory: %x", GetLastError());
  10. return FALSE;
  11. }
  12. _tcscat_s(npcap_dir, 512, _T("\\Npcap"));
  13. if (SetDllDirectory(npcap_dir) == 0) {
  14. fprintf(stderr, "Error in SetDllDirectory: %x", GetLastError());
  15. return FALSE;
  16. }
  17. return TRUE;
  18. }