Module: wine
Branch: master
Commit: 1bae6b12e5a3544bafc7fcd642afeb96a27de1c4
URL: https://source.winehq.org/git/wine.git/?a=commit;h=1bae6b12e5a3544bafc7fcd6…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
Date: Mon Nov 23 15:47:45 2020 +0200
iphlpapi: Store an IO_STATUS_BLOCK at the end of the reply buffer if there's enough space available.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
dlls/iphlpapi/icmp.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/dlls/iphlpapi/icmp.c b/dlls/iphlpapi/icmp.c
index d59bb4ba77f..8ef03219e52 100644
--- a/dlls/iphlpapi/icmp.c
+++ b/dlls/iphlpapi/icmp.c
@@ -325,6 +325,20 @@ done:
if (ier->Options.OptionsData)
ier->Options.OptionsData -= gap_size;
}
+
+ /* According to MSDN, the reply buffer needs to hold space for a IO_STATUS_BLOCK,
+ found at the very end of the reply. This is confirmed on Windows XP, but Vista
+ and later do not store it anywhere and in fact don't even require it at all.
+
+ However, in case old apps analyze this IO_STATUS_BLOCK and expect it, we mimic
+ it and write it out if there's enough space available in the buffer. */
+ if (gap_size >= sizeof(IO_STATUS_BLOCK))
+ {
+ IO_STATUS_BLOCK *io = (IO_STATUS_BLOCK*)((char*)reply_buf + reply_size - sizeof(IO_STATUS_BLOCK));
+
+ io->Pointer = NULL; /* Always NULL or STATUS_SUCCESS */
+ io->Information = reply_size - gap_size;
+ }
}
}
Module: wine
Branch: master
Commit: 9ef55abc9fbd597904e8144eb7e5a53904662b4c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9ef55abc9fbd597904e8144e…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
Date: Mon Nov 23 15:47:43 2020 +0200
iphlpapi: Fix adjusting data pointer after an ICMP reply.
The code above it already sets endbuf to the beginning of the last data
added. On a new reply, endbuf is decremented to make space for the new
data. There's no reason to adjust it again for the old data after it has
already been set.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
dlls/iphlpapi/icmp.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/dlls/iphlpapi/icmp.c b/dlls/iphlpapi/icmp.c
index b6d2ffdbc13..79fd35f524c 100644
--- a/dlls/iphlpapi/icmp.c
+++ b/dlls/iphlpapi/icmp.c
@@ -299,7 +299,6 @@ static DWORD icmp_get_reply(int sid, unsigned char *buffer, DWORD send_time, voi
}
/* Prepare for the next packet */
- endbuf-=ier->DataSize;
ier++;
/* Check out whether there is more but don't wait this time */