Rob Shearman : ntdll: Ignore the hole in the FILE_PIPE_WAIT_FOR_BUFFER structure passed into NtFsControlFile before writing the structure to the server .
Alexandre Julliard
julliard at winehq.org
Mon Dec 14 09:51:26 CST 2009
Module: wine
Branch: master
Commit: 052873350df26c5add3a36a010b5910131bd0917
URL: http://source.winehq.org/git/wine.git/?a=commit;h=052873350df26c5add3a36a010b5910131bd0917
Author: Rob Shearman <robertshearman at gmail.com>
Date: Mon Dec 14 14:32:50 2009 +0000
ntdll: Ignore the hole in the FILE_PIPE_WAIT_FOR_BUFFER structure passed into NtFsControlFile before writing the structure to the server.
---
dlls/ntdll/file.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 00c54c2..b81d38c 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -69,6 +69,9 @@
#ifdef HAVE_SYS_STATFS_H
# include <sys/statfs.h>
#endif
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+# include <valgrind/memcheck.h>
+#endif
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
@@ -1257,6 +1260,30 @@ static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event,
return status;
}
+/* Tell Valgrind to ignore any holes in structs we will be passing to the
+ * server */
+static void ignore_server_ioctl_struct_holes (ULONG code, const void *in_buffer,
+ ULONG in_size)
+{
+#ifdef VALGRIND_MAKE_MEM_DEFINED
+# define IGNORE_STRUCT_HOLE(buf, size, t, f1, f2) \
+ do { \
+ if ((size) >= FIELD_OFFSET(t, f2) && \
+ FIELD_OFFSET(t, f1) + sizeof(((t *)0)->f1) < FIELD_OFFSET(t, f2)) \
+ VALGRIND_MAKE_MEM_DEFINED( \
+ (const char *)(buf) + FIELD_OFFSET(t, f1) + sizeof(((t *)0)->f1), \
+ FIELD_OFFSET(t, f2) - FIELD_OFFSET(t, f1) + sizeof(((t *)0)->f1)); \
+ } while (0)
+
+ switch (code)
+ {
+ case FSCTL_PIPE_WAIT:
+ IGNORE_STRUCT_HOLE(in_buffer, in_size, FILE_PIPE_WAIT_FOR_BUFFER, TimeoutSpecified, Name);
+ break;
+ }
+#endif
+}
+
/**************************************************************************
* NtDeviceIoControlFile [NTDLL.@]
@@ -1356,6 +1383,8 @@ NTSTATUS WINAPI NtFsControlFile(HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc
if (!io) return STATUS_INVALID_PARAMETER;
+ ignore_server_ioctl_struct_holes( code, in_buffer, in_size );
+
switch(code)
{
case FSCTL_DISMOUNT_VOLUME:
More information about the wine-cvs
mailing list