winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
July
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
November 2011
----- 2025 -----
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
852 discussions
Start a n
N
ew thread
Bernhard Loos : mountmgr, ntoskrnl: METHOD_BUFFERED uses irp->AssociatedIrp .SystemBuffer for both input and output.
by Alexandre Julliard
08 Nov '11
08 Nov '11
Module: wine Branch: master Commit: a1377319bc6b4b7c7841c5410d252f48bba28c7e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a1377319bc6b4b7c7841c5410…
Author: Bernhard Loos <bernhardloos(a)googlemail.com> Date: Tue Nov 1 13:03:12 2011 +0100 mountmgr, ntoskrnl: METHOD_BUFFERED uses irp->AssociatedIrp.SystemBuffer for both input and output. --- dlls/mountmgr.sys/device.c | 8 ++++---- dlls/mountmgr.sys/mountmgr.c | 41 +++++++++++++++++++++++++---------------- dlls/ntoskrnl.exe/ntoskrnl.c | 14 +++++++++++++- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c index a3aa81c..3f393e7 100644 --- a/dlls/mountmgr.sys/device.c +++ b/dlls/mountmgr.sys/device.c @@ -890,7 +890,7 @@ static NTSTATUS WINAPI harddisk_ioctl( DEVICE_OBJECT *device, IRP *irp ) info.TracksPerCylinder = 255; info.SectorsPerTrack = 63; info.BytesPerSector = 512; - memcpy( irp->MdlAddress->StartVa, &info, len ); + memcpy( irp->AssociatedIrp.SystemBuffer, &info, len ); irp->IoStatus.Information = len; irp->IoStatus.u.Status = STATUS_SUCCESS; break; @@ -910,7 +910,7 @@ static NTSTATUS WINAPI harddisk_ioctl( DEVICE_OBJECT *device, IRP *irp ) info.DiskSize.QuadPart = info.Geometry.Cylinders.QuadPart * info.Geometry.TracksPerCylinder * info.Geometry.SectorsPerTrack * info.Geometry.BytesPerSector; info.Data[0] = 0; - memcpy( irp->MdlAddress->StartVa, &info, len ); + memcpy( irp->AssociatedIrp.SystemBuffer, &info, len ); irp->IoStatus.Information = len; irp->IoStatus.u.Status = STATUS_SUCCESS; break; @@ -919,7 +919,7 @@ static NTSTATUS WINAPI harddisk_ioctl( DEVICE_OBJECT *device, IRP *irp ) { DWORD len = min( sizeof(dev->devnum), irpsp->Parameters.DeviceIoControl.OutputBufferLength ); - memcpy( irp->MdlAddress->StartVa, &dev->devnum, len ); + memcpy( irp->AssociatedIrp.SystemBuffer, &dev->devnum, len ); irp->IoStatus.Information = len; irp->IoStatus.u.Status = STATUS_SUCCESS; break; @@ -932,7 +932,7 @@ static NTSTATUS WINAPI harddisk_ioctl( DEVICE_OBJECT *device, IRP *irp ) DWORD len = min( 32, irpsp->Parameters.DeviceIoControl.OutputBufferLength ); FIXME( "returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS\n" ); - memset( irp->MdlAddress->StartVa, 0, len ); + memset( irp->AssociatedIrp.SystemBuffer, 0, len ); irp->IoStatus.Information = len; irp->IoStatus.u.Status = STATUS_SUCCESS; break; diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c index 4e9900f..afb9d92 100644 --- a/dlls/mountmgr.sys/mountmgr.c +++ b/dlls/mountmgr.sys/mountmgr.c @@ -153,12 +153,12 @@ static BOOL matching_mount_point( const struct mount_point *mount, const MOUNTMG } /* implementation of IOCTL_MOUNTMGR_QUERY_POINTS */ -static NTSTATUS query_mount_points( const void *in_buff, SIZE_T insize, - void *out_buff, SIZE_T outsize, IO_STATUS_BLOCK *iosb ) +static NTSTATUS query_mount_points( void *buff, SIZE_T insize, + SIZE_T outsize, IO_STATUS_BLOCK *iosb ) { UINT count, pos, size; - const MOUNTMGR_MOUNT_POINT *input = in_buff; - MOUNTMGR_MOUNT_POINTS *info = out_buff; + MOUNTMGR_MOUNT_POINT *input = buff; + MOUNTMGR_MOUNT_POINTS *info; struct mount_point *mount; /* sanity checks */ @@ -185,11 +185,18 @@ static NTSTATUS query_mount_points( const void *in_buff, SIZE_T insize, if (size > outsize) { + info = buff; if (size >= sizeof(info->Size)) info->Size = size; iosb->Information = sizeof(info->Size); return STATUS_MORE_ENTRIES; } + input = HeapAlloc( GetProcessHeap(), 0, insize ); + if (!input) + return STATUS_NO_MEMORY; + memcpy( input, buff, insize ); + info = buff; + info->NumberOfMountPoints = count; count = 0; LIST_FOR_EACH_ENTRY( mount, &mount_points_list, struct mount_point, entry ) @@ -198,23 +205,24 @@ static NTSTATUS query_mount_points( const void *in_buff, SIZE_T insize, info->MountPoints[count].DeviceNameOffset = pos; info->MountPoints[count].DeviceNameLength = mount->name.Length; - memcpy( (char *)out_buff + pos, mount->name.Buffer, mount->name.Length ); + memcpy( (char *)buff + pos, mount->name.Buffer, mount->name.Length ); pos += mount->name.Length; info->MountPoints[count].SymbolicLinkNameOffset = pos; info->MountPoints[count].SymbolicLinkNameLength = mount->link.Length; - memcpy( (char *)out_buff + pos, mount->link.Buffer, mount->link.Length ); + memcpy( (char *)buff + pos, mount->link.Buffer, mount->link.Length ); pos += mount->link.Length; info->MountPoints[count].UniqueIdOffset = pos; info->MountPoints[count].UniqueIdLength = mount->id_len; - memcpy( (char *)out_buff + pos, mount->id, mount->id_len ); + memcpy( (char *)buff + pos, mount->id, mount->id_len ); pos += mount->id_len; pos = (pos + sizeof(WCHAR) - 1) & ~(sizeof(WCHAR) - 1); count++; } info->Size = pos; iosb->Information = pos; + HeapFree( GetProcessHeap(), 0, input ); return STATUS_SUCCESS; } @@ -271,11 +279,11 @@ static NTSTATUS define_unix_drive( const void *in_buff, SIZE_T insize ) } /* implementation of IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE */ -static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize, - void *out_buff, SIZE_T outsize, IO_STATUS_BLOCK *iosb ) +static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, + SIZE_T outsize, IO_STATUS_BLOCK *iosb ) { - const struct mountmgr_unix_drive *input = in_buff; - struct mountmgr_unix_drive *output = out_buff; + const struct mountmgr_unix_drive *input = buff; + struct mountmgr_unix_drive *output = NULL; char *device, *mount_point; int letter = tolowerW( input->letter ); NTSTATUS status; @@ -302,6 +310,9 @@ static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize, if (device) size += strlen(device) + 1; if (mount_point) size += strlen(mount_point) + 1; + input = NULL; + output = buff; + if (size > outsize) { iosb->Information = 0; @@ -364,9 +375,8 @@ static NTSTATUS WINAPI mountmgr_ioctl( DEVICE_OBJECT *device, IRP *irp ) case IOCTL_MOUNTMGR_QUERY_POINTS: if (irpsp->Parameters.DeviceIoControl.InputBufferLength < sizeof(MOUNTMGR_MOUNT_POINT)) return STATUS_INVALID_PARAMETER; - irp->IoStatus.u.Status = query_mount_points( irpsp->Parameters.DeviceIoControl.Type3InputBuffer, + irp->IoStatus.u.Status = query_mount_points( irp->AssociatedIrp.SystemBuffer, irpsp->Parameters.DeviceIoControl.InputBufferLength, - irp->MdlAddress->StartVa, irpsp->Parameters.DeviceIoControl.OutputBufferLength, &irp->IoStatus ); break; @@ -374,15 +384,14 @@ static NTSTATUS WINAPI mountmgr_ioctl( DEVICE_OBJECT *device, IRP *irp ) if (irpsp->Parameters.DeviceIoControl.InputBufferLength < sizeof(struct mountmgr_unix_drive)) return STATUS_INVALID_PARAMETER; irp->IoStatus.Information = 0; - irp->IoStatus.u.Status = define_unix_drive( irpsp->Parameters.DeviceIoControl.Type3InputBuffer, + irp->IoStatus.u.Status = define_unix_drive( irp->AssociatedIrp.SystemBuffer, irpsp->Parameters.DeviceIoControl.InputBufferLength ); break; case IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE: if (irpsp->Parameters.DeviceIoControl.InputBufferLength < sizeof(struct mountmgr_unix_drive)) return STATUS_INVALID_PARAMETER; - irp->IoStatus.u.Status = query_unix_drive( irpsp->Parameters.DeviceIoControl.Type3InputBuffer, + irp->IoStatus.u.Status = query_unix_drive( irp->AssociatedIrp.SystemBuffer, irpsp->Parameters.DeviceIoControl.InputBufferLength, - irp->MdlAddress->StartVa, irpsp->Parameters.DeviceIoControl.OutputBufferLength, &irp->IoStatus ); break; diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 9c7916e..b00c070 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -32,6 +32,7 @@ #include "windef.h" #include "winternl.h" #include "excpt.h" +#include "winioctl.h" #include "ddk/ntddk.h" #include "wine/unicode.h" #include "wine/server.h" @@ -151,7 +152,13 @@ static NTSTATUS process_ioctl( DEVICE_OBJECT *device, ULONG code, void *in_buff, memset( &mdl, 0x77, sizeof(mdl) ); irp.RequestorMode = UserMode; - irp.AssociatedIrp.SystemBuffer = in_buff; + if ((code & 3) == METHOD_BUFFERED) + { + irp.AssociatedIrp.SystemBuffer = HeapAlloc( GetProcessHeap(), 0, max( in_size, *out_size ) ); + if (!irp.AssociatedIrp.SystemBuffer) + return STATUS_NO_MEMORY; + memcpy( irp.AssociatedIrp.SystemBuffer, in_buff, in_size ); + } irp.UserBuffer = out_buff; irp.MdlAddress = &mdl; irp.Tail.Overlay.s.u2.CurrentStackLocation = &irpsp; @@ -186,6 +193,11 @@ static NTSTATUS process_ioctl( DEVICE_OBJECT *device, ULONG code, void *in_buff, GetCurrentThreadId(), dispatch, device, &irp, status ); *out_size = (irp.IoStatus.u.Status >= 0) ? irp.IoStatus.Information : 0; + if ((code & 3) == METHOD_BUFFERED) + { + memcpy( out_buff, irp.AssociatedIrp.SystemBuffer, *out_size ); + HeapFree( GetProcessHeap(), 0, irp.AssociatedIrp.SystemBuffer ); + } return irp.IoStatus.u.Status; }
1
0
0
0
Frédéric Delanoy : cmd: Avoid comparison between signed and unsigned values.
by Alexandre Julliard
08 Nov '11
08 Nov '11
Module: wine Branch: master Commit: 6221e300bcd1b1e457e90bdf34c1870d449a9300 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6221e300bcd1b1e457e90bdf3…
Author: Frédéric Delanoy <frederic.delanoy(a)gmail.com> Date: Mon Nov 7 10:52:22 2011 +0100 cmd: Avoid comparison between signed and unsigned values. --- programs/cmd/batch.c | 4 ++-- programs/cmd/builtins.c | 8 ++++---- programs/cmd/directory.c | 6 +++--- programs/cmd/wcmd.h | 2 +- programs/cmd/wcmdmain.c | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c index acab893..7edb8df 100644 --- a/programs/cmd/batch.c +++ b/programs/cmd/batch.c @@ -186,12 +186,12 @@ WCHAR *WCMD_parameter (WCHAR *s, int n, WCHAR **start, WCHAR **end) { * NULL on error or EOF */ -WCHAR *WCMD_fgets(WCHAR *buf, int noChars, HANDLE h) +WCHAR *WCMD_fgets(WCHAR *buf, DWORD noChars, HANDLE h) { DWORD charsRead; BOOL status; LARGE_INTEGER filepos; - int i; + DWORD i; /* We can't use the native f* functions because of the filename syntax differences between DOS and Unix. Also need to lose the LF (or CRLF) from the line. */ diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 22e0342..5272bfc 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -1323,9 +1323,9 @@ static void WCMD_part_execute(CMD_LIST **cmdList, const WCHAR *firstcmd, * Simple on-line help. Help text is stored in the resource file. */ -void WCMD_give_help (const WCHAR *command) { - - int i; +void WCMD_give_help (const WCHAR *command) +{ + size_t i; command = WCMD_skip_leading_spaces((WCHAR*) command); if (strlenW(command) == 0) { @@ -1630,7 +1630,7 @@ void WCMD_move (void) if (GetFileAttributesW(dest) != INVALID_FILE_ATTRIBUTES) { BOOL force = FALSE; WCHAR copycmd[MAXSTRING]; - int len; + DWORD len; /* /-Y has the highest priority, then /Y and finally the COPYCMD env. variable */ if (strstrW (quals, parmNoY)) diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c index 3c6bd06..3634ded 100644 --- a/programs/cmd/directory.c +++ b/programs/cmd/directory.c @@ -627,10 +627,10 @@ static void WCMD_dir_trailer(WCHAR drive) { * */ -void WCMD_directory (WCHAR *cmd) { - +void WCMD_directory (WCHAR *cmd) +{ WCHAR path[MAX_PATH], cwd[MAX_PATH]; - int status; + DWORD status; CONSOLE_SCREEN_BUFFER_INFO consoleInfo; WCHAR *p; WCHAR string[MAXSTRING]; diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h index 962fd52..205d31c 100644 --- a/programs/cmd/wcmd.h +++ b/programs/cmd/wcmd.h @@ -101,7 +101,7 @@ static inline BOOL WCMD_is_console_handle(HANDLE h) { return (((DWORD_PTR)h) & 3) == 3; } -WCHAR *WCMD_fgets (WCHAR *buf, int n, HANDLE stream); +WCHAR *WCMD_fgets (WCHAR *buf, DWORD n, HANDLE stream); WCHAR *WCMD_parameter (WCHAR *s, int n, WCHAR **start, WCHAR **end); WCHAR *WCMD_skip_leading_spaces (WCHAR *string); BOOL WCMD_keyword_ws_found(const WCHAR *keyword, int len, const WCHAR *ptr); diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 40ed145..b529672 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -123,8 +123,8 @@ static char *get_file_buffer(void) * and hence required WriteConsoleW to output it, however if file i/o is * redirected, it needs to be WriteFile'd using OEM (not ANSI) format */ -static void WCMD_output_asis_len(const WCHAR *message, int len, HANDLE device) { - +static void WCMD_output_asis_len(const WCHAR *message, DWORD len, HANDLE device) +{ DWORD nOut= 0; DWORD res = 0; @@ -169,7 +169,7 @@ void WCMD_output (const WCHAR *format, ...) { va_list ap; WCHAR string[1024]; - int ret; + DWORD ret; va_start(ap,format); ret = vsnprintfW(string, sizeof(string)/sizeof(WCHAR), format, ap); @@ -191,7 +191,7 @@ void WCMD_output_stderr (const WCHAR *format, ...) { va_list ap; WCHAR string[1024]; - int ret; + DWORD ret; va_start(ap,format); ret = vsnprintfW(string, sizeof(string)/sizeof(WCHAR), format, ap);
1
0
0
0
Stefan Dösinger : d3d8/tests: Port the block lock test to d3d8.
by Alexandre Julliard
08 Nov '11
08 Nov '11
Module: wine Branch: master Commit: a3ca9a8bff1dc7ddda03aa83e1a18d28ee665c84 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a3ca9a8bff1dc7ddda03aa83e…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Fri Oct 14 12:57:52 2011 +0200 d3d8/tests: Port the block lock test to d3d8. --- dlls/d3d8/tests/surface.c | 141 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 141 insertions(+), 0 deletions(-) diff --git a/dlls/d3d8/tests/surface.c b/dlls/d3d8/tests/surface.c index f544201..837e2d4 100644 --- a/dlls/d3d8/tests/surface.c +++ b/dlls/d3d8/tests/surface.c @@ -483,6 +483,146 @@ static void test_surface_double_unlock(IDirect3DDevice8 *device) IDirect3D8_Release(d3d); } +static void test_surface_lockrect_blocks(IDirect3DDevice8 *device) +{ + IDirect3DTexture8 *texture; + IDirect3DSurface8 *surface; + IDirect3D8 *d3d; + D3DLOCKED_RECT locked_rect; + unsigned int i, j; + HRESULT hr; + RECT rect; + + const struct + { + D3DFORMAT fmt; + const char *name; + unsigned int block_width; + unsigned int block_height; + BOOL broken; + } + formats[] = + { + {D3DFMT_DXT1, "D3DFMT_DXT1", 4, 4, FALSE}, + {D3DFMT_DXT2, "D3DFMT_DXT2", 4, 4, FALSE}, + {D3DFMT_DXT3, "D3DFMT_DXT3", 4, 4, FALSE}, + {D3DFMT_DXT4, "D3DFMT_DXT4", 4, 4, FALSE}, + {D3DFMT_DXT5, "D3DFMT_DXT5", 4, 4, FALSE}, + /* ATI2N has 2x2 blocks on all AMD cards and Geforce 7 cards, + * which doesn't match the format spec. On newer Nvidia cards + * it has the correct 4x4 block size */ + {MAKEFOURCC('A','T','I','2'), "ATI2N", 4, 4, TRUE}, + /* YUY2 and UYVY are not supported in d3d8, there is no way + * to use them with this API considering their restrictions */ + }; + const struct + { + D3DPOOL pool; + const char *name; + /* Don't check the return value, Nvidia returns D3DERR_INVALIDCALL for some formats + * and E_INVALIDARG/DDERR_INVALIDPARAMS for others. */ + BOOL success; + } + pools[] = + { + {D3DPOOL_DEFAULT, "D3DPOOL_DEFAULT", FALSE}, + {D3DPOOL_SCRATCH, "D3DPOOL_SCRATCH", TRUE}, + {D3DPOOL_SYSTEMMEM, "D3DPOOL_SYSTEMMEM",TRUE}, + {D3DPOOL_MANAGED, "D3DPOOL_MANAGED", TRUE}, + }; + + hr = IDirect3DDevice8_GetDirect3D(device, &d3d); + ok(SUCCEEDED(hr), "IDirect3DDevice8_GetDirect3D failed (%08x)\n", hr); + + for (i = 0; i < (sizeof(formats) / sizeof(*formats)); ++i) { + hr = IDirect3D8_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_DYNAMIC, + D3DRTYPE_TEXTURE, formats[i].fmt); + if (FAILED(hr)) + { + skip("Format %s not supported, skipping lockrect offset test\n", formats[i].name); + continue; + } + + for (j = 0; j < (sizeof(pools) / sizeof(*pools)); j++) + { + hr = IDirect3DDevice8_CreateTexture(device, 128, 128, 1, + pools[j].pool == D3DPOOL_DEFAULT ? D3DUSAGE_DYNAMIC : 0, + formats[i].fmt, pools[j].pool, &texture); + ok(SUCCEEDED(hr), "IDirect3DDevice8_CreateTexture failed (%08x)\n", hr); + hr = IDirect3DTexture8_GetSurfaceLevel(texture, 0, &surface); + ok(SUCCEEDED(hr), "IDirect3DTexture8_GetSurfaceLevel failed (%08x)\n", hr); + IDirect3DTexture8_Release(texture); + + if (formats[i].block_width > 1) + { + SetRect(&rect, formats[i].block_width >> 1, 0, formats[i].block_width, formats[i].block_height); + hr = IDirect3DSurface8_LockRect(surface, &locked_rect, &rect, 0); + ok(!SUCCEEDED(hr) == !pools[j].success || broken(formats[i].broken), + "Partial block lock %s, expected %s, format %s, pool %s.\n", + SUCCEEDED(hr) ? "succeeded" : "failed", + pools[j].success ? "success" : "failure", formats[i].name, pools[j].name); + if (SUCCEEDED(hr)) + { + hr = IDirect3DSurface8_UnlockRect(surface); + ok(SUCCEEDED(hr), "IDirect3DSurface8_UnlockRect failed (%08x)\n", hr); + } + + SetRect(&rect, 0, 0, formats[i].block_width >> 1, formats[i].block_height); + hr = IDirect3DSurface8_LockRect(surface, &locked_rect, &rect, 0); + ok(!SUCCEEDED(hr) == !pools[j].success || broken(formats[i].broken), + "Partial block lock %s, expected %s, format %s, pool %s.\n", + SUCCEEDED(hr) ? "succeeded" : "failed", + pools[j].success ? "success" : "failure", formats[i].name, pools[j].name); + if (SUCCEEDED(hr)) + { + hr = IDirect3DSurface8_UnlockRect(surface); + ok(SUCCEEDED(hr), "IDirect3DSurface8_UnlockRect failed (%08x)\n", hr); + } + } + + if (formats[i].block_height > 1) + { + SetRect(&rect, 0, formats[i].block_height >> 1, formats[i].block_width, formats[i].block_height); + hr = IDirect3DSurface8_LockRect(surface, &locked_rect, &rect, 0); + ok(!SUCCEEDED(hr) == !pools[j].success || broken(formats[i].broken), + "Partial block lock %s, expected %s, format %s, pool %s.\n", + SUCCEEDED(hr) ? "succeeded" : "failed", + pools[j].success ? "success" : "failure", formats[i].name, pools[j].name); + if (SUCCEEDED(hr)) + { + hr = IDirect3DSurface8_UnlockRect(surface); + ok(SUCCEEDED(hr), "IDirect3DSurface8_UnlockRect failed (%08x)\n", hr); + } + + SetRect(&rect, 0, 0, formats[i].block_width, formats[i].block_height >> 1); + hr = IDirect3DSurface8_LockRect(surface, &locked_rect, &rect, 0); + ok(!SUCCEEDED(hr) == !pools[j].success || broken(formats[i].broken), + "Partial block lock %s, expected %s, format %s, pool %s.\n", + SUCCEEDED(hr) ? "succeeded" : "failed", + pools[j].success ? "success" : "failure", formats[i].name, pools[j].name); + if (SUCCEEDED(hr)) + { + hr = IDirect3DSurface8_UnlockRect(surface); + ok(SUCCEEDED(hr), "IDirect3DSurface8_UnlockRect failed (%08x)\n", hr); + } + } + + SetRect(&rect, 0, 0, formats[i].block_width, formats[i].block_height); + hr = IDirect3DSurface8_LockRect(surface, &locked_rect, &rect, 0); + ok(hr == D3D_OK, "Full block lock returned %08x, expected %08x, format %s, pool %s\n", + hr, D3D_OK, formats[i].name, pools[j].name); + if (SUCCEEDED(hr)) + { + hr = IDirect3DSurface8_UnlockRect(surface); + ok(SUCCEEDED(hr), "IDirect3DSurface8_UnlockRect failed (%08x)\n", hr); + } + + IDirect3DSurface8_Release(surface); + } + } + IDirect3D8_Release(d3d); +} + START_TEST(surface) { HMODULE d3d8_handle; @@ -506,6 +646,7 @@ START_TEST(surface) test_surface_dimensions(device_ptr); test_surface_format_null(device_ptr); test_surface_double_unlock(device_ptr); + test_surface_lockrect_blocks(device_ptr); refcount = IDirect3DDevice8_Release(device_ptr); ok(!refcount, "Device has %u references left\n", refcount);
1
0
0
0
Stefan Dösinger : d3d8/tests: Port the double unlock test to d3d8.
by Alexandre Julliard
08 Nov '11
08 Nov '11
Module: wine Branch: master Commit: ecb403ee2a1d559ffcd8c90f4680e816cd6cd44c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ecb403ee2a1d559ffcd8c90f4…
Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Fri Oct 14 12:53:29 2011 +0200 d3d8/tests: Port the double unlock test to d3d8. --- dlls/d3d8/tests/surface.c | 73 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 0 deletions(-) diff --git a/dlls/d3d8/tests/surface.c b/dlls/d3d8/tests/surface.c index c3890d6..f544201 100644 --- a/dlls/d3d8/tests/surface.c +++ b/dlls/d3d8/tests/surface.c @@ -1,5 +1,6 @@ /* * Copyright 2006-2007 Henri Verbeet + * Copyright 2011 Stefan D�singer for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -411,6 +412,77 @@ static void test_surface_format_null(IDirect3DDevice8 *device) IDirect3DTexture8_Release(texture); } +static void test_surface_double_unlock(IDirect3DDevice8 *device) +{ + static struct + { + D3DPOOL pool; + const char *name; + } + pools[] = + { + { D3DPOOL_DEFAULT, "D3DPOOL_DEFAULT" }, + { D3DPOOL_SYSTEMMEM, "D3DPOOL_SYSTEMMEM" }, + }; + IDirect3DSurface8 *surface; + unsigned int i; + HRESULT hr; + D3DLOCKED_RECT lr; + IDirect3D8 *d3d; + + hr = IDirect3DDevice8_GetDirect3D(device, &d3d); + ok(SUCCEEDED(hr), "IDirect3DDevice8_GetDirect3D failed, hr = 0x%08x\n", hr); + + for (i = 0; i < (sizeof(pools) / sizeof(*pools)); i++) + { + switch (pools[i].pool) + { + case D3DPOOL_DEFAULT: + hr = IDirect3D8_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_RENDERTARGET, + D3DRTYPE_SURFACE, D3DFMT_X8R8G8B8); + if (FAILED(hr)) + { + skip("D3DFMT_X8R8G8B8 render targets not supported, skipping double unlock DEFAULT pool test\n"); + continue; + } + + hr = IDirect3DDevice8_CreateRenderTarget(device, 64, 64, D3DFMT_X8R8G8B8, + D3DMULTISAMPLE_NONE, TRUE, &surface); + ok(SUCCEEDED(hr), "IDirect3DDevice8_CreateRenderTarget failed, hr = 0x%08x, pool %s\n", + hr, pools[i].name); + break; + + case D3DPOOL_SYSTEMMEM: + hr = IDirect3DDevice8_CreateImageSurface(device, 64, 64, D3DFMT_X8R8G8B8, &surface); + ok(SUCCEEDED(hr), "IDirect3DDevice8_CreateImageSurface failed, hr = 0x%08x, pool %s\n", + hr, pools[i].name); + break; + + default: + break; + } + + hr = IDirect3DSurface8_UnlockRect(surface); + ok(hr == D3DERR_INVALIDCALL, "Unlock without lock returned 0x%08x, expected 0x%08x, pool %s\n", + hr, D3DERR_INVALIDCALL, pools[i].name); + + hr = IDirect3DSurface8_LockRect(surface, &lr, NULL, 0); + ok(SUCCEEDED(hr), "IDirect3DSurface8_LockRect failed, hr = 0x%08x, pool %s\n", + hr, pools[i].name); + hr = IDirect3DSurface8_UnlockRect(surface); + ok(SUCCEEDED(hr), "IDirect3DSurface8_UnlockRect failed, hr = 0x%08x, pool %s\n", + hr, pools[i].name); + + hr = IDirect3DSurface8_UnlockRect(surface); + ok(hr == D3DERR_INVALIDCALL, "Double unlock returned 0x%08x, expected 0x%08x, pool %s\n", + hr, D3DERR_INVALIDCALL, pools[i].name); + + IDirect3DSurface8_Release(surface); + } + + IDirect3D8_Release(d3d); +} + START_TEST(surface) { HMODULE d3d8_handle; @@ -433,6 +505,7 @@ START_TEST(surface) test_private_data(device_ptr); test_surface_dimensions(device_ptr); test_surface_format_null(device_ptr); + test_surface_double_unlock(device_ptr); refcount = IDirect3DDevice8_Release(device_ptr); ok(!refcount, "Device has %u references left\n", refcount);
1
0
0
0
Alexandre Julliard : gdi32: Avoid copying the brush pattern if the format matches the DC.
by Alexandre Julliard
08 Nov '11
08 Nov '11
Module: wine Branch: master Commit: 03496d6fba8d44a9113ccf5b5999746c756afc40 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=03496d6fba8d44a9113ccf5b5…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 8 13:32:36 2011 +0100 gdi32: Avoid copying the brush pattern if the format matches the DC. --- dlls/gdi32/dibdrv/objects.c | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c index cf714b5..ddd3563 100644 --- a/dlls/gdi32/dibdrv/objects.c +++ b/dlls/gdi32/dibdrv/objects.c @@ -1246,6 +1246,27 @@ static BOOL create_hatch_brush_bits(dibdrv_physdev *pdev) return ret; } +static BOOL matching_pattern_format( dib_info *dib, dib_info *pattern ) +{ + if (dib->bit_count != pattern->bit_count) return FALSE; + if (dib->stride != pattern->stride) return FALSE; + + switch (dib->bit_count) + { + case 1: + case 4: + case 8: + if (dib->color_table_size != pattern->color_table_size) return FALSE; + return !memcmp( dib->color_table, pattern->color_table, dib->color_table_size * sizeof(RGBQUAD) ); + case 16: + case 32: + return (dib->red_mask == pattern->red_mask && + dib->green_mask == pattern->green_mask && + dib->blue_mask == pattern->blue_mask); + } + return TRUE; +} + static void select_pattern_brush( dibdrv_physdev *pdev, dib_info *pattern ) { RECT rect; @@ -1257,7 +1278,14 @@ static void select_pattern_brush( dibdrv_physdev *pdev, dib_info *pattern ) pdev->brush_dib.width = pattern->width; pdev->brush_dib.stride = get_dib_stride( pdev->brush_dib.width, pdev->brush_dib.bit_count ); - pdev->brush_dib.bits.param = NULL; + if (matching_pattern_format( &pdev->brush_dib, pattern )) + { + pdev->brush_dib.bits.ptr = pattern->bits.ptr; + pdev->brush_dib.bits.is_copy = FALSE; + pdev->brush_dib.bits.free = NULL; + return; + } + pdev->brush_dib.bits.ptr = HeapAlloc( GetProcessHeap(), 0, pdev->brush_dib.height * pdev->brush_dib.stride ); pdev->brush_dib.bits.is_copy = TRUE;
1
0
0
0
Alexandre Julliard : gdi32: Reselect the pattern brush on every use if it' s mapped with DIB_PAL_COLORS.
by Alexandre Julliard
08 Nov '11
08 Nov '11
Module: wine Branch: master Commit: bb162ba4b4ebbe383745b095bb5f70f78b170745 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bb162ba4b4ebbe383745b095b…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 8 13:18:01 2011 +0100 gdi32: Reselect the pattern brush on every use if it's mapped with DIB_PAL_COLORS. --- dlls/gdi32/dibdrv/dibdrv.h | 3 + dlls/gdi32/dibdrv/objects.c | 86 +++++++++++++++++++++++++++++-------------- dlls/gdi32/tests/brush.c | 2 +- 3 files changed, 62 insertions(+), 29 deletions(-) diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index 0650e08..6ef0d94 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -90,6 +90,9 @@ typedef struct dibdrv_physdev DWORD brush_color, brush_and, brush_xor; dib_info brush_dib; void *brush_and_bits, *brush_xor_bits; + const BITMAPINFO *brush_pattern_info; + void *brush_pattern_bits; + UINT brush_pattern_usage; BOOL (* brush_rects)(struct dibdrv_physdev *pdev, dib_info *dib, int num, const RECT *rects, HRGN clip); /* background */ diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c index 3418dc8..cf714b5 100644 --- a/dlls/gdi32/dibdrv/objects.c +++ b/dlls/gdi32/dibdrv/objects.c @@ -1246,6 +1246,30 @@ static BOOL create_hatch_brush_bits(dibdrv_physdev *pdev) return ret; } +static void select_pattern_brush( dibdrv_physdev *pdev, dib_info *pattern ) +{ + RECT rect; + + free_pattern_brush( pdev ); + copy_dib_color_info(&pdev->brush_dib, &pdev->dib); + + pdev->brush_dib.height = pattern->height; + pdev->brush_dib.width = pattern->width; + pdev->brush_dib.stride = get_dib_stride( pdev->brush_dib.width, pdev->brush_dib.bit_count ); + + pdev->brush_dib.bits.param = NULL; + pdev->brush_dib.bits.ptr = HeapAlloc( GetProcessHeap(), 0, + pdev->brush_dib.height * pdev->brush_dib.stride ); + pdev->brush_dib.bits.is_copy = TRUE; + pdev->brush_dib.bits.free = free_heap_bits; + + rect.left = rect.top = 0; + rect.right = pattern->width; + rect.bottom = pattern->height; + + pdev->brush_dib.funcs->convert_to(&pdev->brush_dib, pattern, &rect); +} + /********************************************************************** * pattern_brush * @@ -1263,6 +1287,16 @@ static BOOL pattern_brush(dibdrv_physdev *pdev, dib_info *dib, int num, const RE switch(pdev->brush_style) { case BS_DIBPATTERN: + if (pdev->brush_pattern_usage == DIB_PAL_COLORS) + { + dib_info pattern; + HPALETTE pal = GetCurrentObject( pdev->dev.hdc, OBJ_PAL ); + if (!init_dib_info_from_brush( &pattern, pdev->brush_pattern_info, + pdev->brush_pattern_bits, DIB_PAL_COLORS, pal )) + return FALSE; + select_pattern_brush( pdev, &pattern ); + free_dib_info( &pattern ); + } if(!create_pattern_brush_bits(pdev)) return FALSE; break; @@ -1317,6 +1351,11 @@ static BOOL pattern_brush(dibdrv_physdev *pdev, dib_info *dib, int num, const RE } } release_wine_region( region ); + + /* we need to recompute the bits each time for DIB_PAL_COLORS */ + if (pdev->brush_style == BS_DIBPATTERN && pdev->brush_pattern_usage == DIB_PAL_COLORS) + free_pattern_brush_bits( pdev ); + return TRUE; } @@ -1347,9 +1386,7 @@ HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, if (bitmap || info) /* pattern brush */ { - dib_info orig_dib; - HPALETTE pal = (usage == DIB_PAL_COLORS) ? GetCurrentObject(dev->hdc, OBJ_PAL) : NULL; - RECT rect; + dib_info pattern; BOOL ret; if (!info) @@ -1357,37 +1394,30 @@ HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP ); if (!bmp) return 0; - ret = init_dib_info_from_bitmapobj( &orig_dib, bmp, 0 ); + ret = init_dib_info_from_bitmapobj( &pattern, bmp, 0 ); GDI_ReleaseObj( bitmap ); + if (!ret) return 0; + select_pattern_brush( pdev, &pattern ); + free_dib_info( &pattern ); + } + else if (usage != DIB_PAL_COLORS) + { + if (!init_dib_info_from_brush( &pattern, info, bits, DIB_RGB_COLORS, 0 )) return 0; + select_pattern_brush( pdev, &pattern ); + free_dib_info( &pattern ); + } + else + { + /* brush is actually selected only when it's used */ + free_pattern_brush( pdev ); } - else ret = init_dib_info_from_brush( &orig_dib, info, bits, usage, pal ); - - if (!ret) return 0; - - if (usage == DIB_PAL_COLORS) FIXME( "DIB_PAL_COLORS brush not handled correctly\n"); - - free_pattern_brush( pdev ); - copy_dib_color_info(&pdev->brush_dib, &pdev->dib); - - pdev->brush_dib.height = orig_dib.height; - pdev->brush_dib.width = orig_dib.width; - pdev->brush_dib.stride = get_dib_stride( pdev->brush_dib.width, pdev->brush_dib.bit_count ); - - pdev->brush_dib.bits.param = NULL; - pdev->brush_dib.bits.ptr = HeapAlloc( GetProcessHeap(), 0, - pdev->brush_dib.height * pdev->brush_dib.stride ); - pdev->brush_dib.bits.is_copy = TRUE; - pdev->brush_dib.bits.free = free_heap_bits; - - rect.left = rect.top = 0; - rect.right = orig_dib.width; - rect.bottom = orig_dib.height; - pdev->brush_dib.funcs->convert_to(&pdev->brush_dib, &orig_dib, &rect); pdev->brush_rects = pattern_brush; pdev->brush_style = BS_DIBPATTERN; + pdev->brush_pattern_info = info; + pdev->brush_pattern_bits = bits; + pdev->brush_pattern_usage = usage; pdev->defer &= ~DEFER_BRUSH; - free_dib_info(&orig_dib); return next->funcs->pSelectBrush( next, hbrush, bitmap, info, bits, usage ); } diff --git a/dlls/gdi32/tests/brush.c b/dlls/gdi32/tests/brush.c index f0ef2df..c6c7678 100644 --- a/dlls/gdi32/tests/brush.c +++ b/dlls/gdi32/tests/brush.c @@ -288,7 +288,7 @@ static void test_palette_brush(void) pal->palPalEntry[255 - i].peGreen << 8 | pal->palPalEntry[255 - i].peBlue); if (expect) - todo_wine ok( dib_bits[i] == expect, "wrong bits %x/%x at %u,%u\n", dib_bits[i], expect, i % 16, i / 16 ); + ok( dib_bits[i] == expect, "wrong bits %x/%x at %u,%u\n", dib_bits[i], expect, i % 16, i / 16 ); else ok( dib_bits[i] == expect, "wrong bits %x/%x at %u,%u\n", dib_bits[i], expect, i % 16, i / 16 ); }
1
0
0
0
Dmitry Timoshkov : kernel32: Add a bunch of tests for protections accepted by VirtualAlloc, make it pass under Wine.
by Alexandre Julliard
08 Nov '11
08 Nov '11
Module: wine Branch: master Commit: a93f86716f6a20de66c4c1bc3ef1fc513f3539c9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a93f86716f6a20de66c4c1bc3…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Tue Nov 8 17:10:05 2011 +0800 kernel32: Add a bunch of tests for protections accepted by VirtualAlloc, make it pass under Wine. --- dlls/kernel32/tests/virtual.c | 80 +++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/virtual.c | 1 + 2 files changed, 81 insertions(+), 0 deletions(-) diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index d0b9f4f..aefa9d0 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -1523,6 +1523,85 @@ static void test_VirtualProtect(void) VirtualFree(base, 0, MEM_FREE); } +static void test_VirtualAlloc_protection(void) +{ + static const struct test_data + { + DWORD prot; + BOOL success; + } td[] = + { + { 0, FALSE }, /* 0x00 */ + { PAGE_NOACCESS, TRUE }, /* 0x01 */ + { PAGE_READONLY, TRUE }, /* 0x02 */ + { PAGE_READONLY | PAGE_NOACCESS, FALSE }, /* 0x03 */ + { PAGE_READWRITE, TRUE }, /* 0x04 */ + { PAGE_READWRITE | PAGE_NOACCESS, FALSE }, /* 0x05 */ + { PAGE_READWRITE | PAGE_READONLY, FALSE }, /* 0x06 */ + { PAGE_READWRITE | PAGE_READONLY | PAGE_NOACCESS, FALSE }, /* 0x07 */ + { PAGE_WRITECOPY, FALSE }, /* 0x08 */ + { PAGE_WRITECOPY | PAGE_NOACCESS, FALSE }, /* 0x09 */ + { PAGE_WRITECOPY | PAGE_READONLY, FALSE }, /* 0x0a */ + { PAGE_WRITECOPY | PAGE_NOACCESS | PAGE_READONLY, FALSE }, /* 0x0b */ + { PAGE_WRITECOPY | PAGE_READWRITE, FALSE }, /* 0x0c */ + { PAGE_WRITECOPY | PAGE_READWRITE | PAGE_NOACCESS, FALSE }, /* 0x0d */ + { PAGE_WRITECOPY | PAGE_READWRITE | PAGE_READONLY, FALSE }, /* 0x0e */ + { PAGE_WRITECOPY | PAGE_READWRITE | PAGE_READONLY | PAGE_NOACCESS, FALSE }, /* 0x0f */ + + { PAGE_EXECUTE, TRUE }, /* 0x10 */ + { PAGE_EXECUTE_READ, TRUE }, /* 0x20 */ + { PAGE_EXECUTE_READ | PAGE_EXECUTE, FALSE }, /* 0x30 */ + { PAGE_EXECUTE_READWRITE, TRUE }, /* 0x40 */ + { PAGE_EXECUTE_READWRITE | PAGE_EXECUTE, FALSE }, /* 0x50 */ + { PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_READ, FALSE }, /* 0x60 */ + { PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_READ | PAGE_EXECUTE, FALSE }, /* 0x70 */ + { PAGE_EXECUTE_WRITECOPY, FALSE }, /* 0x80 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE, FALSE }, /* 0x90 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE_READ, FALSE }, /* 0xa0 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE_READ | PAGE_EXECUTE, FALSE }, /* 0xb0 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE_READWRITE, FALSE }, /* 0xc0 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE, FALSE }, /* 0xd0 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_READ, FALSE }, /* 0xe0 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_READ | PAGE_EXECUTE, FALSE } /* 0xf0 */ + }; + char *base; + DWORD ret, i; + MEMORY_BASIC_INFORMATION info; + SYSTEM_INFO si; + + GetSystemInfo(&si); + trace("system page size %#x\n", si.dwPageSize); + + for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + { + SetLastError(0xdeadbeef); + base = VirtualAlloc(0, si.dwPageSize, MEM_RESERVE | MEM_COMMIT, td[i].prot); + + if (td[i].success) + { + ok(base != NULL, "%d: VirtualAlloc failed %d\n", i, GetLastError()); + + SetLastError(0xdeadbeef); + ret = VirtualQuery(base, &info, sizeof(info)); + ok(ret, "VirtualQuery failed %d\n", GetLastError()); + ok(info.BaseAddress == base, "%d: got %p != expected %p\n", i, info.BaseAddress, base); + ok(info.RegionSize == si.dwPageSize, "%d: got %#lx != expected %#x\n", i, info.RegionSize, si.dwPageSize); + ok(info.Protect == td[i].prot, "%d: got %#x != expected %#x\n", i, info.Protect, td[i].prot); + ok(info.AllocationBase == base, "%d: %p != %p\n", i, info.AllocationBase, base); + ok(info.AllocationProtect == td[i].prot, "%d: %#x != %#x\n", i, info.AllocationProtect, td[i].prot); + ok(info.State == MEM_COMMIT, "%d: %#x != MEM_COMMIT\n", i, info.State); + ok(info.Type == MEM_PRIVATE, "%d: %#x != MEM_PRIVATE\n", i, info.Type); + + VirtualFree(base, 0, MEM_FREE); + } + else + { + ok(!base, "%d: VirtualAlloc should fail\n", i); + ok(GetLastError() == ERROR_INVALID_PARAMETER, "%d: expected ERROR_INVALID_PARAMETER, got %d\n", i, GetLastError()); + } + } +} + START_TEST(virtual) { int argc; @@ -1558,6 +1637,7 @@ START_TEST(virtual) pResetWriteWatch = (void *) GetProcAddress(hkernel32, "ResetWriteWatch"); pNtAreMappedFilesTheSame = (void *)GetProcAddress( GetModuleHandle("ntdll.dll"), "NtAreMappedFilesTheSame" ); + test_VirtualAlloc_protection(); test_VirtualProtect(); test_VirtualAllocEx(); test_VirtualAlloc(); diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index 8c5e773..fb8786f 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -1870,6 +1870,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG zero_ if (is_beyond_limit( 0, size, working_set_limit )) return STATUS_WORKING_SET_LIMIT_RANGE; if ((status = get_vprot_flags( protect, &vprot ))) return status; + if (vprot & VPROT_WRITECOPY) return STATUS_INVALID_PAGE_PROTECTION; vprot |= VPROT_VALLOC; if (type & MEM_COMMIT) vprot |= VPROT_COMMITTED;
1
0
0
0
Alexandre Julliard : spoolss: Remove an unused variable.
by Alexandre Julliard
08 Nov '11
08 Nov '11
Module: wine Branch: master Commit: deaae1f5624428abf3ed0f8d8069563089be793f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=deaae1f5624428abf3ed0f8d8…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 8 09:51:59 2011 +0100 spoolss: Remove an unused variable. --- dlls/spoolss/router.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/dlls/spoolss/router.c b/dlls/spoolss/router.c index 1fcf628..3d239b4 100644 --- a/dlls/spoolss/router.c +++ b/dlls/spoolss/router.c @@ -266,13 +266,12 @@ static backend_t * backend_load(LPWSTR dllname, LPWSTR name, LPWSTR regroot) BOOL backend_load_all(void) { static BOOL failed = FALSE; - backend_t * pb; EnterCriticalSection(&backend_cs); /* if we failed before, don't try again */ if (!failed && (used_backends == 0)) { - pb = backend_load(localsplW, NULL, NULL); + backend_load(localsplW, NULL, NULL); /* ToDo: parse the registry and load all other backends */
1
0
0
0
Dmitry Timoshkov : ntdll: Use PAGE_EXECUTE_READWRITE protection when allocating stubs.
by Alexandre Julliard
08 Nov '11
08 Nov '11
Module: wine Branch: master Commit: 26f4ff1a389a7f38fcd29c25cea297efa8315795 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=26f4ff1a389a7f38fcd29c25c…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Tue Nov 8 17:09:17 2011 +0800 ntdll: Use PAGE_EXECUTE_READWRITE protection when allocating stubs. --- dlls/ntdll/loader.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 314813f..311fd38 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -242,7 +242,7 @@ static ULONG_PTR allocate_stub( const char *dll, const char *name ) { SIZE_T size = MAX_SIZE; if (NtAllocateVirtualMemory( NtCurrentProcess(), (void **)&stubs, 0, &size, - MEM_COMMIT, PAGE_EXECUTE_WRITECOPY ) != STATUS_SUCCESS) + MEM_COMMIT, PAGE_EXECUTE_READWRITE ) != STATUS_SUCCESS) return 0xdeadbeef; } stub = &stubs[nb_stubs++];
1
0
0
0
Alexandre Julliard : setupapi: Add a trace for the install mode value.
by Alexandre Julliard
08 Nov '11
08 Nov '11
Module: wine Branch: master Commit: 721e73543e31cb62e6b9f8e374425a9eacddc6a3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=721e73543e31cb62e6b9f8e37…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 8 09:51:31 2011 +0100 setupapi: Add a trace for the install mode value. --- dlls/setupapi/install.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/dlls/setupapi/install.c b/dlls/setupapi/install.c index 6ecc288..e73b769 100644 --- a/dlls/setupapi/install.c +++ b/dlls/setupapi/install.c @@ -1248,6 +1248,7 @@ void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, I /* FIXME: should check the mode and maybe reboot */ /* there isn't much point in doing that since we */ /* don't yet handle deferred file copies anyway. */ + if (mode & 7) TRACE( "should consider reboot, mode %u\n", mode ); }
1
0
0
0
← Newer
1
...
62
63
64
65
66
67
68
...
86
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Results per page:
10
25
50
100
200