From 2c10bd6a9853ad41bbf42561cf39db340baf70a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Tue, 30 Jul 2013 11:31:56 +0200 Subject: [PATCH] Fixed struct formats for running on 64-bit Windows Added a few paddings for field alignment in structs whose layout has to match 64-bit Windows internals. --- libntfs-3g/win32_io.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libntfs-3g/win32_io.c b/libntfs-3g/win32_io.c index 9b7cbc3d..1e5b2bc4 100644 --- a/libntfs-3g/win32_io.c +++ b/libntfs-3g/win32_io.c @@ -156,7 +156,11 @@ enum { /* see http://msdn.microsoft.com/en-us/library/cc704588(v=prot.10).aspx * } ; typedef u32 NTSTATUS; /* do not let the compiler choose the size */ -typedef unsigned long ULONG_PTR; +#ifdef __x86_64__ +typedef unsigned long long ULONG_PTR; /* an integer the same size as a pointer */ +#else +typedef unsigned long ULONG_PTR; /* an integer the same size as a pointer */ +#endif HANDLE get_osfhandle(int); /* from msvcrt.dll */ @@ -175,14 +179,25 @@ typedef struct _IO_STATUS_BLOCK { typedef struct _UNICODE_STRING { USHORT Length; USHORT MaximumLength; +#ifdef __x86_64__ + u32 padding; +#endif PWSTR Buffer; } UNICODE_STRING, *PUNICODE_STRING; typedef struct _OBJECT_ATTRIBUTES { ULONG Length; +#ifdef __x86_64__ + u32 padding1; HANDLE RootDirectory; PUNICODE_STRING ObjectName; ULONG Attributes; + u32 padding2; +#else + HANDLE RootDirectory; + PUNICODE_STRING ObjectName; + ULONG Attributes; +#endif PVOID SecurityDescriptor; PVOID SecurityQualityOfService; } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;