http://bugs.winehq.org/show_bug.cgi?id=36092
--- Comment #21 from Derek Atkins warlord@mit.edu --- Bruno, I'm looking more closely at your patch and either I'm confused or there's a bug. In particular, the SOCKADDR_IN6_PAIR is defined to be a structure of two PSOCKADDR_IN6 members, i.e., two pointers to SOCKADDR_IN6. You allocate the returned structure via:
retaddr=HeapAlloc(GetProcessHeap(),0,sizeof(SOCKADDR_IN6_PAIR)*destinationcount);
Which unless I'm confused will allocate the array of PAIR objects, but wont deep-allocate the SOCKADDR_IN6 pointers in each object. Assuming I'm correct that HeapAlloc() works like a Unix "malloc" then your bug is on the next line in the loop, where you memset into the (non-allocated) object:
memset(retaddr[i].SourceAddress,0,sizeof(SOCKADDR_IN6));
At this point retaddr[i].SourceAddress should, unless I'm confused, be a NULL pointer (or garbage).. I don't see where you ever allocate the pointer? For example I just added some code to your patch to output the Source and Dest address pointers and indeed they are garbage:
fixme:iphlpapi:CreateSortedAddressPairs source (nil), sourcecount 0, destination 0x511ba8, destcount 15, sortoptions 0, sortedaddr 0x32e684, sortedcount 0x32e66c fixme:iphlpapi:CreateSortedAddressPairs SourceAddress: 0x110118, DestAddress: 0x110108 fixme:iphlpapi:CreateSortedAddressPairs SourceAddress: 0x1, DestAddress: 0x6 wine: Unhandled page fault on write access to 0x00000001 at address 0x7e69bdff (thread 0009), starting debugger... err:seh:raise_exception Unhandled exception code c0000005 flags 0 addr 0x7bc50e20