SoftEtherVPN / Win10Pcap

Win10Pcap: WinPcap for Windows 10 (NDIS 6.x driver model)
Other
337 stars 122 forks source link

Ms.c crash with -RTCs #4

Open gvanem opened 9 years ago

gvanem commented 9 years ago

Compiling the Packet_dll sources in debug-mode and with the switch -RTCs and using them in a simple program, I get a crash as show here: enum_adapters_crash_report

Seems the definition of bool is to blame. Looking at the CPP output, I see

 typedef _Bool __crt_bool;
 ...
_Bool IsWow64()
{
       _Bool b = 0;

       if (Is64BitCode())
       {
              return 0;
      }
      if (IsWow64Process(GetCurrentProcess(), &b) == 0)
      {
              return 0;
      }

I had to build using WIN32COM_CPP with the latest WindowsKit. Bottom line seems to be, sizeof(bool) != sizeof(BOOL). I suggest you rewrite that since IsWow64Process() clearly should take a PBOOL.

-RTCs is Stack Frame runtime checking, a real handy switch in MSVC.

BTW, here is the stack backtrace:


enum_adapters!failwithmessage(void * retaddr = 0x012de50e, int crttype = 0n1, int errnum = 0n2, char * msg = 0x00b9f910 "Stack around the variable 'b' was corrupted.")+0x1ec
enum_adapters!_RTC_StackFailure(void * retaddr = 0x012de50e, char * varname = 0x00000002 "--- memory read error at address 0x00000002 ---")+0xee
enum_adapters!_RTC_CheckStackVars(void * frame = 0x00b9fd58, struct _RTC_framedesc * v = 0x012de520)+0x46
enum_adapters!IsWow64(void)+0x6e
...