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
December 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
810 discussions
Start a n
N
ew thread
Alexandre Julliard : oleaut32: Fix IPicture:: SelectPicture to not try to select a bitmap into two DCs at the same time.
by Alexandre Julliard
16 Dec '11
16 Dec '11
Module: wine Branch: master Commit: 1e0ab160697ddf8162c82854904adf293d581431 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1e0ab160697ddf8162c828549…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Dec 16 16:29:12 2011 +0100 oleaut32: Fix IPicture::SelectPicture to not try to select a bitmap into two DCs at the same time. --- dlls/oleaut32/olepicture.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c index 8081785..2195ba5 100644 --- a/dlls/oleaut32/olepicture.c +++ b/dlls/oleaut32/olepicture.c @@ -141,6 +141,7 @@ typedef struct OLEPictureImpl { BOOL keepOrigFormat; HDC hDCCur; + HBITMAP stock_bitmap; /* Bitmap transparency mask */ HBITMAP hbmMask; @@ -219,6 +220,7 @@ static void OLEPictureImpl_SetBitmap(OLEPictureImpl *This) This->himetricWidth = xpixels_to_himetric(bm.bmWidth, hdcRef); This->himetricHeight = ypixels_to_himetric(bm.bmHeight, hdcRef); + This->stock_bitmap = GetCurrentObject( hdcRef, OBJ_BITMAP ); DeleteDC(hdcRef); } @@ -769,10 +771,10 @@ static HRESULT WINAPI OLEPictureImpl_SelectPicture(IPicture *iface, OLEPictureImpl *This = impl_from_IPicture(iface); TRACE("(%p)->(%p, %p, %p)\n", This, hdcIn, phdcOut, phbmpOut); if (This->desc.picType == PICTYPE_BITMAP) { - SelectObject(hdcIn,This->desc.u.bmp.hbitmap); - if (phdcOut) *phdcOut = This->hDCCur; + if (This->hDCCur) SelectObject(This->hDCCur,This->stock_bitmap); + if (hdcIn) SelectObject(hdcIn,This->desc.u.bmp.hbitmap); This->hDCCur = hdcIn; if (phbmpOut) *phbmpOut = HandleToUlong(This->desc.u.bmp.hbitmap);
1
0
0
0
Alexandre Julliard : user32: Don' t try to alpha blend icons on low color bitmaps.
by Alexandre Julliard
16 Dec '11
16 Dec '11
Module: wine Branch: master Commit: 430c8aa9101317777e99a15c4d2c2b97329136e9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=430c8aa9101317777e99a15c4…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Dec 16 14:20:56 2011 +0100 user32: Don't try to alpha blend icons on low color bitmaps. --- dlls/user32/cursoricon.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 4ae7098..d8068d8 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -2288,15 +2288,15 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon, if (frame->alpha && (flags & DI_IMAGE)) { - BOOL is_mono = FALSE; + BOOL alpha_blend = TRUE; if (GetObjectType( hdc_dest ) == OBJ_MEMDC) { BITMAP bm; HBITMAP bmp = GetCurrentObject( hdc_dest, OBJ_BITMAP ); - is_mono = GetObjectW( bmp, sizeof(bm), &bm ) && bm.bmBitsPixel == 1; + alpha_blend = GetObjectW( bmp, sizeof(bm), &bm ) && bm.bmBitsPixel > 8; } - if (!is_mono) + if (alpha_blend) { BLENDFUNCTION pixelblend = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; SelectObject( hMemDC, frame->alpha );
1
0
0
0
Alexandre Julliard : comctl32: Use GetDIBits to retrieve the default color map for an imagelist DIB section .
by Alexandre Julliard
16 Dec '11
16 Dec '11
Module: wine Branch: master Commit: e0fc985f32b7f97f51cd662edb0ef4e695eeac91 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e0fc985f32b7f97f51cd662ed…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Dec 16 14:20:05 2011 +0100 comctl32: Use GetDIBits to retrieve the default color map for an imagelist DIB section. --- dlls/comctl32/imagelist.c | 48 ++++++++++---------------------------------- 1 files changed, 11 insertions(+), 37 deletions(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 4e71795..c1edbdf 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -3093,54 +3093,28 @@ static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count) if ((ilc >= ILC_COLOR4 && ilc <= ILC_COLOR32) || ilc == ILC_COLOR) { - VOID* bits; - BITMAPINFO *bmi; + char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; + BITMAPINFO *bmi = (BITMAPINFO *)buffer; TRACE("Creating DIBSection %d x %d, %d Bits per Pixel\n", sz.cx, sz.cy, himl->uBitsPixel); - if (himl->uBitsPixel <= ILC_COLOR8) - { - LPPALETTEENTRY pal; - ULONG i, colors; - BYTE temp; - - colors = 1 << himl->uBitsPixel; - bmi = Alloc(sizeof(BITMAPINFOHEADER) + - sizeof(PALETTEENTRY) * colors); - - pal = (LPPALETTEENTRY)bmi->bmiColors; - GetPaletteEntries(GetStockObject(DEFAULT_PALETTE), 0, colors, pal); - - /* Swap colors returned by GetPaletteEntries so we can use them for - * CreateDIBSection call. */ - for (i = 0; i < colors; i++) - { - temp = pal[i].peBlue; - bmi->bmiColors[i].rgbRed = pal[i].peRed; - bmi->bmiColors[i].rgbBlue = temp; - } - } - else - { - bmi = Alloc(sizeof(BITMAPINFOHEADER)); - } - + memset( buffer, 0, sizeof(buffer) ); bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi->bmiHeader.biWidth = sz.cx; bmi->bmiHeader.biHeight = sz.cy; bmi->bmiHeader.biPlanes = 1; bmi->bmiHeader.biBitCount = himl->uBitsPixel; bmi->bmiHeader.biCompression = BI_RGB; - bmi->bmiHeader.biSizeImage = 0; - bmi->bmiHeader.biXPelsPerMeter = 0; - bmi->bmiHeader.biYPelsPerMeter = 0; - bmi->bmiHeader.biClrUsed = 0; - bmi->bmiHeader.biClrImportant = 0; - - hbmNewBitmap = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, &bits, 0, 0); - Free (bmi); + if (himl->uBitsPixel <= ILC_COLOR8) + { + /* retrieve the default color map */ + HBITMAP tmp = CreateBitmap( 1, 1, 1, 1, NULL ); + GetDIBits( hdc, tmp, 0, 0, NULL, bmi, DIB_RGB_COLORS ); + DeleteObject( tmp ); + } + hbmNewBitmap = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, NULL, 0, 0); } else /*if (ilc == ILC_COLORDDB)*/ {
1
0
0
0
Alexandre Julliard : comctl32: Use DrawIconEx to copy icon bits and use the correct background color.
by Alexandre Julliard
16 Dec '11
16 Dec '11
Module: wine Branch: master Commit: 40cf298c7524f4475b4636301798263aed1d437c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=40cf298c7524f4475b4636301…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Dec 16 14:19:38 2011 +0100 comctl32: Use DrawIconEx to copy icon bits and use the correct background color. --- dlls/comctl32/imagelist.c | 76 +++++++++++++------------------------------- 1 files changed, 23 insertions(+), 53 deletions(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 81ee655..4e71795 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -2531,7 +2531,6 @@ done: INT WINAPI ImageList_ReplaceIcon (HIMAGELIST himl, INT nIndex, HICON hIcon) { - HDC hdcImage; HICON hBestFitIcon; ICONINFO ii; BITMAP bmp; @@ -2563,23 +2562,6 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT nIndex, HICON hIcon) if (!hBestFitIcon) return -1; - ret = GetIconInfo (hBestFitIcon, &ii); - if (!ret) { - DestroyIcon(hBestFitIcon); - return -1; - } - - ret = GetObjectW (ii.hbmMask, sizeof(BITMAP), &bmp); - if (!ret) { - ERR("couldn't get mask bitmap info\n"); - if (ii.hbmColor) - DeleteObject (ii.hbmColor); - if (ii.hbmMask) - DeleteObject (ii.hbmMask); - DestroyIcon(hBestFitIcon); - return -1; - } - if (nIndex == -1) { if (himl->cCurImage + 1 > himl->cMaxImage) IMAGELIST_InternalExpandBitmaps(himl, 1); @@ -2588,13 +2570,11 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT nIndex, HICON hIcon) himl->cCurImage++; } - hdcImage = CreateCompatibleDC (0); - TRACE("hdcImage=%p\n", hdcImage); - if (hdcImage == 0) - ERR("invalid hdcImage!\n"); - - if (himl->has_alpha) + if (himl->has_alpha && GetIconInfo (hBestFitIcon, &ii)) { + HDC hdcImage = CreateCompatibleDC( 0 ); + GetObjectW (ii.hbmMask, sizeof(BITMAP), &bmp); + if (!ii.hbmColor) { UINT height = bmp.bmHeight / 2; @@ -2606,48 +2586,38 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT nIndex, HICON hIcon) ret = add_with_alpha( himl, hdcImage, nIndex, 1, bmp.bmWidth, height, color, ii.hbmMask ); DeleteDC( hdcMask ); DeleteObject( color ); - if (ret) goto done; } - else if (add_with_alpha( himl, hdcImage, nIndex, 1, bmp.bmWidth, bmp.bmHeight, - ii.hbmColor, ii.hbmMask )) goto done; + else ret = add_with_alpha( himl, hdcImage, nIndex, 1, bmp.bmWidth, bmp.bmHeight, + ii.hbmColor, ii.hbmMask ); + + DeleteDC( hdcImage ); + DeleteObject (ii.hbmMask); + if (ii.hbmColor) DeleteObject (ii.hbmColor); + if (ret) goto done; } imagelist_point_from_index(himl, nIndex, &pt); - SetTextColor(himl->hdcImage, RGB(0,0,0)); - SetBkColor (himl->hdcImage, RGB(255,255,255)); - - if (ii.hbmColor) + if (himl->hbmMask) { - SelectObject (hdcImage, ii.hbmColor); - StretchBlt (himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy, - hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); - if (himl->hbmMask) - { - SelectObject (hdcImage, ii.hbmMask); - StretchBlt (himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy, - hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); - } + DrawIconEx( himl->hdcImage, pt.x, pt.y, hBestFitIcon, himl->cx, himl->cy, 0, 0, DI_IMAGE ); + PatBlt( himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy, WHITENESS ); + DrawIconEx( himl->hdcMask, pt.x, pt.y, hBestFitIcon, himl->cx, himl->cy, 0, 0, DI_MASK ); } else { - UINT height = bmp.bmHeight / 2; - SelectObject (hdcImage, ii.hbmMask); - StretchBlt (himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy, - hdcImage, 0, height, bmp.bmWidth, height, SRCCOPY); - if (himl->hbmMask) - StretchBlt (himl->hdcMask, pt.x, pt.y, himl->cx, himl->cy, - hdcImage, 0, 0, bmp.bmWidth, height, SRCCOPY); + COLORREF color = himl->clrBk != CLR_NONE ? himl->clrBk : comctl32_color.clrWindow; + HBRUSH brush = CreateSolidBrush( GetNearestColor( himl->hdcImage, color )); + + SelectObject( himl->hdcImage, brush ); + PatBlt( himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy, PATCOPY ); + SelectObject( himl->hdcImage, GetStockObject(BLACK_BRUSH) ); + DeleteObject( brush ); + DrawIconEx( himl->hdcImage, pt.x, pt.y, hBestFitIcon, himl->cx, himl->cy, 0, 0, DI_NORMAL ); } done: DestroyIcon(hBestFitIcon); - if (hdcImage) - DeleteDC (hdcImage); - if (ii.hbmColor) - DeleteObject (ii.hbmColor); - if (ii.hbmMask) - DeleteObject (ii.hbmMask); TRACE("Insert index = %d, himl->cCurImage = %d\n", nIndex, himl->cCurImage); return nIndex;
1
0
0
0
Alexandre Julliard : comctl32/tests: Add some more tests for ImageList_Write.
by Alexandre Julliard
16 Dec '11
16 Dec '11
Module: wine Branch: master Commit: 65b7eb26359110959692db7c0c3cebd263fe21ab URL:
http://source.winehq.org/git/wine.git/?a=commit;h=65b7eb26359110959692db7c0…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Dec 16 13:07:45 2011 +0100 comctl32/tests: Add some more tests for ImageList_Write. --- dlls/comctl32/imagelist.c | 14 ++--- dlls/comctl32/tests/imagelist.c | 130 +++++++++++++++++++++++++++++---------- 2 files changed, 102 insertions(+), 42 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=65b7eb26359110959692d…
1
0
0
0
Dmitry Timoshkov : ntdll: Replace WRITE by WRITECOPY protection on an image section as Windows does.
by Alexandre Julliard
16 Dec '11
16 Dec '11
Module: wine Branch: master Commit: 332eee40530f698c74f16d27c9833ccccb25bfa2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=332eee40530f698c74f16d27c…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri Dec 16 14:45:23 2011 +0800 ntdll: Replace WRITE by WRITECOPY protection on an image section as Windows does. --- dlls/kernel32/tests/loader.c | 8 -------- dlls/ntdll/virtual.c | 20 +++++++++++++------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 536bda9..398e5f5 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -647,9 +647,6 @@ static void test_VirtualProtect(void *base, void *section) ok(ret, "VirtualQuery failed %d\n", GetLastError()); ok(info.BaseAddress == section, "%d: got %p != expected %p\n", i, info.BaseAddress, section); ok(info.RegionSize == si.dwPageSize, "%d: got %#lx != expected %#x\n", i, info.RegionSize, si.dwPageSize); - if (info.Protect != td[i].prot_get) - todo_wine ok(info.Protect == td[i].prot_get, "%d: got %#x != expected %#x\n", i, info.Protect, td[i].prot_get); - else ok(info.Protect == td[i].prot_get, "%d: got %#x != expected %#x\n", i, info.Protect, td[i].prot_get); ok(info.AllocationBase == base, "%d: %p != %p\n", i, info.AllocationBase, base); ok(info.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "%d: %#x != PAGE_EXECUTE_WRITECOPY\n", i, info.AllocationProtect); @@ -667,12 +664,7 @@ static void test_VirtualProtect(void *base, void *section) ret = VirtualProtect(section, si.dwPageSize, PAGE_NOACCESS, &old_prot); ok(ret, "%d: VirtualProtect error %d\n", i, GetLastError()); if (td[i].prot_get) - { - if (old_prot != td[i].prot_get) - todo_wine ok(old_prot == td[i].prot_get, "%d: got %#x != expected %#x\n", i, old_prot, td[i].prot_get); - else ok(old_prot == td[i].prot_get, "%d: got %#x != expected %#x\n", i, old_prot, td[i].prot_get); - } else ok(old_prot == PAGE_NOACCESS, "%d: got %#x != expected PAGE_NOACCESS\n", i, old_prot); } diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index ee56e71..6ee3444 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -552,7 +552,7 @@ static DWORD VIRTUAL_GetWin32Prot( BYTE vprot ) * RETURNS * Value of page protection flags */ -static NTSTATUS get_vprot_flags( DWORD protect, unsigned int *vprot ) +static NTSTATUS get_vprot_flags( DWORD protect, unsigned int *vprot, BOOL image ) { switch(protect & 0xff) { @@ -560,7 +560,10 @@ static NTSTATUS get_vprot_flags( DWORD protect, unsigned int *vprot ) *vprot = VPROT_READ; break; case PAGE_READWRITE: - *vprot = VPROT_READ | VPROT_WRITE; + if (image) + *vprot = VPROT_READ | VPROT_WRITECOPY; + else + *vprot = VPROT_READ | VPROT_WRITE; break; case PAGE_WRITECOPY: *vprot = VPROT_READ | VPROT_WRITECOPY; @@ -572,7 +575,10 @@ static NTSTATUS get_vprot_flags( DWORD protect, unsigned int *vprot ) *vprot = VPROT_EXEC | VPROT_READ; break; case PAGE_EXECUTE_READWRITE: - *vprot = VPROT_EXEC | VPROT_READ | VPROT_WRITE; + if (image) + *vprot = VPROT_EXEC | VPROT_READ | VPROT_WRITECOPY; + else + *vprot = VPROT_EXEC | VPROT_READ | VPROT_WRITE; break; case PAGE_EXECUTE_WRITECOPY: *vprot = VPROT_EXEC | VPROT_READ | VPROT_WRITECOPY; @@ -1860,7 +1866,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 ((status = get_vprot_flags( protect, &vprot, FALSE ))) return status; if (vprot & VPROT_WRITECOPY) return STATUS_INVALID_PAGE_PROTECTION; vprot |= VPROT_VALLOC; if (type & MEM_COMMIT) vprot |= VPROT_COMMITTED; @@ -2087,7 +2093,7 @@ NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T /* Make sure all the pages are committed */ if (get_committed_size( view, base, &vprot ) >= size && (vprot & VPROT_COMMITTED)) { - if (!(status = get_vprot_flags( new_prot, &new_vprot ))) + if (!(status = get_vprot_flags( new_prot, &new_vprot, view->protect & VPROT_IMAGE ))) { if ((new_vprot & VPROT_WRITECOPY) && (view->protect & VPROT_VALLOC)) status = STATUS_INVALID_PAGE_PROTECTION; @@ -2392,7 +2398,7 @@ NTSTATUS WINAPI NtCreateSection( HANDLE *handle, ACCESS_MASK access, const OBJEC if (len > MAX_PATH*sizeof(WCHAR)) return STATUS_NAME_TOO_LONG; - if ((ret = get_vprot_flags( protect, &vprot ))) return ret; + if ((ret = get_vprot_flags( protect, &vprot, sec_flags & SEC_IMAGE ))) return ret; objattr.rootdir = wine_server_obj_handle( attr ? attr->RootDirectory : 0 ); objattr.sd_len = 0; @@ -2602,7 +2608,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p server_enter_uninterrupted_section( &csVirtual, &sigset ); - get_vprot_flags( protect, &vprot ); + get_vprot_flags( protect, &vprot, map_vprot & VPROT_IMAGE ); vprot |= (map_vprot & VPROT_COMMITTED); res = map_view( &view, *addr_ptr, size, mask, FALSE, vprot ); if (res)
1
0
0
0
Dmitry Timoshkov : kernel32: Add a bunch of VirtualProtect tests on an image section.
by Alexandre Julliard
16 Dec '11
16 Dec '11
Module: wine Branch: master Commit: bb8d47bd30db5d64e632d0a2becd56532dcd4156 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bb8d47bd30db5d64e632d0a2b…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri Dec 16 14:45:01 2011 +0800 kernel32: Add a bunch of VirtualProtect tests on an image section. --- dlls/kernel32/tests/loader.c | 142 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 142 insertions(+), 0 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 2af7cc5..536bda9 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -568,6 +568,146 @@ static BOOL is_mem_writable(DWORD prot) } } +static void test_VirtualProtect(void *base, void *section) +{ + static const struct test_data + { + DWORD prot_set, prot_get; + } td[] = + { + { 0, 0 }, /* 0x00 */ + { PAGE_NOACCESS, PAGE_NOACCESS }, /* 0x01 */ + { PAGE_READONLY, PAGE_READONLY }, /* 0x02 */ + { PAGE_READONLY | PAGE_NOACCESS, 0 }, /* 0x03 */ + { PAGE_READWRITE, PAGE_WRITECOPY }, /* 0x04 */ + { PAGE_READWRITE | PAGE_NOACCESS, 0 }, /* 0x05 */ + { PAGE_READWRITE | PAGE_READONLY, 0 }, /* 0x06 */ + { PAGE_READWRITE | PAGE_READONLY | PAGE_NOACCESS, 0 }, /* 0x07 */ + { PAGE_WRITECOPY, PAGE_WRITECOPY }, /* 0x08 */ + { PAGE_WRITECOPY | PAGE_NOACCESS, 0 }, /* 0x09 */ + { PAGE_WRITECOPY | PAGE_READONLY, 0 }, /* 0x0a */ + { PAGE_WRITECOPY | PAGE_NOACCESS | PAGE_READONLY, 0 }, /* 0x0b */ + { PAGE_WRITECOPY | PAGE_READWRITE, 0 }, /* 0x0c */ + { PAGE_WRITECOPY | PAGE_READWRITE | PAGE_NOACCESS, 0 }, /* 0x0d */ + { PAGE_WRITECOPY | PAGE_READWRITE | PAGE_READONLY, 0 }, /* 0x0e */ + { PAGE_WRITECOPY | PAGE_READWRITE | PAGE_READONLY | PAGE_NOACCESS, 0 }, /* 0x0f */ + + { PAGE_EXECUTE, PAGE_EXECUTE }, /* 0x10 */ + { PAGE_EXECUTE_READ, PAGE_EXECUTE_READ }, /* 0x20 */ + { PAGE_EXECUTE_READ | PAGE_EXECUTE, 0 }, /* 0x30 */ + { PAGE_EXECUTE_READWRITE, PAGE_EXECUTE_WRITECOPY }, /* 0x40 */ + { PAGE_EXECUTE_READWRITE | PAGE_EXECUTE, 0 }, /* 0x50 */ + { PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_READ, 0 }, /* 0x60 */ + { PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_READ | PAGE_EXECUTE, 0 }, /* 0x70 */ + { PAGE_EXECUTE_WRITECOPY, PAGE_EXECUTE_WRITECOPY }, /* 0x80 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE, 0 }, /* 0x90 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE_READ, 0 }, /* 0xa0 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE_READ | PAGE_EXECUTE, 0 }, /* 0xb0 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE_READWRITE, 0 }, /* 0xc0 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE, 0 }, /* 0xd0 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_READ, 0 }, /* 0xe0 */ + { PAGE_EXECUTE_WRITECOPY | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_READ | PAGE_EXECUTE, 0 } /* 0xf0 */ + }; + DWORD ret, orig_prot, old_prot, rw_prot, exec_prot, i, j; + MEMORY_BASIC_INFORMATION info; + SYSTEM_INFO si; + + GetSystemInfo(&si); + trace("system page size %#x\n", si.dwPageSize); + + SetLastError(0xdeadbeef); + ret = VirtualProtect(section, si.dwPageSize, PAGE_NOACCESS, &old_prot); + ok(ret, "VirtualProtect error %d\n", GetLastError()); + + orig_prot = old_prot; + + for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) + { + SetLastError(0xdeadbeef); + ret = VirtualQuery(section, &info, sizeof(info)); + ok(ret, "VirtualQuery failed %d\n", GetLastError()); + ok(info.BaseAddress == section, "%d: got %p != expected %p\n", i, info.BaseAddress, section); + ok(info.RegionSize == si.dwPageSize, "%d: got %#lx != expected %#x\n", i, info.RegionSize, si.dwPageSize); + ok(info.Protect == PAGE_NOACCESS, "%d: got %#x != expected PAGE_NOACCESS\n", i, info.Protect); + ok(info.AllocationBase == base, "%d: %p != %p\n", i, info.AllocationBase, base); + ok(info.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "%d: %#x != PAGE_EXECUTE_WRITECOPY\n", i, info.AllocationProtect); + ok(info.State == MEM_COMMIT, "%d: %#x != MEM_COMMIT\n", i, info.State); + ok(info.Type == SEC_IMAGE, "%d: %#x != SEC_IMAGE\n", i, info.Type); + + old_prot = 0xdeadbeef; + SetLastError(0xdeadbeef); + ret = VirtualProtect(section, si.dwPageSize, td[i].prot_set, &old_prot); + if (td[i].prot_get) + { + ok(ret, "%d: VirtualProtect error %d\n", i, GetLastError()); + ok(old_prot == PAGE_NOACCESS, "%d: got %#x != expected PAGE_NOACCESS\n", i, old_prot); + + SetLastError(0xdeadbeef); + ret = VirtualQuery(section, &info, sizeof(info)); + ok(ret, "VirtualQuery failed %d\n", GetLastError()); + ok(info.BaseAddress == section, "%d: got %p != expected %p\n", i, info.BaseAddress, section); + ok(info.RegionSize == si.dwPageSize, "%d: got %#lx != expected %#x\n", i, info.RegionSize, si.dwPageSize); + if (info.Protect != td[i].prot_get) + todo_wine ok(info.Protect == td[i].prot_get, "%d: got %#x != expected %#x\n", i, info.Protect, td[i].prot_get); + else + ok(info.Protect == td[i].prot_get, "%d: got %#x != expected %#x\n", i, info.Protect, td[i].prot_get); + ok(info.AllocationBase == base, "%d: %p != %p\n", i, info.AllocationBase, base); + ok(info.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "%d: %#x != PAGE_EXECUTE_WRITECOPY\n", i, info.AllocationProtect); + ok(info.State == MEM_COMMIT, "%d: %#x != MEM_COMMIT\n", i, info.State); + ok(info.Type == SEC_IMAGE, "%d: %#x != SEC_IMAGE\n", i, info.Type); + } + else + { + ok(!ret, "%d: VirtualProtect should fail\n", i); + ok(GetLastError() == ERROR_INVALID_PARAMETER, "%d: expected ERROR_INVALID_PARAMETER, got %d\n", i, GetLastError()); + } + + old_prot = 0xdeadbeef; + SetLastError(0xdeadbeef); + ret = VirtualProtect(section, si.dwPageSize, PAGE_NOACCESS, &old_prot); + ok(ret, "%d: VirtualProtect error %d\n", i, GetLastError()); + if (td[i].prot_get) + { + if (old_prot != td[i].prot_get) + todo_wine ok(old_prot == td[i].prot_get, "%d: got %#x != expected %#x\n", i, old_prot, td[i].prot_get); + else + ok(old_prot == td[i].prot_get, "%d: got %#x != expected %#x\n", i, old_prot, td[i].prot_get); + } + else + ok(old_prot == PAGE_NOACCESS, "%d: got %#x != expected PAGE_NOACCESS\n", i, old_prot); + } + + exec_prot = 0; + + for (i = 0; i <= 4; i++) + { + rw_prot = 0; + + for (j = 0; j <= 4; j++) + { + DWORD prot = exec_prot | rw_prot; + + SetLastError(0xdeadbeef); + ret = VirtualProtect(section, si.dwPageSize, prot, &old_prot); + if ((rw_prot && exec_prot) || (!rw_prot && !exec_prot)) + { + ok(!ret, "VirtualProtect(%02x) should fail\n", prot); + ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); + } + else + ok(ret, "VirtualProtect(%02x) error %d\n", prot, GetLastError()); + + rw_prot = 1 << j; + } + + exec_prot = 1 << (i + 4); + } + + SetLastError(0xdeadbeef); + ret = VirtualProtect(section, si.dwPageSize, orig_prot, &old_prot); + ok(ret, "VirtualProtect error %d\n", GetLastError()); +} + static void test_section_access(void) { static const struct test_data @@ -699,6 +839,8 @@ static void test_section_access(void) if (info.Protect != PAGE_NOACCESS) ok(!memcmp((const char *)info.BaseAddress, section_data, section.SizeOfRawData), "wrong section data\n"); + test_VirtualProtect(hlib, (char *)hlib + section.VirtualAddress); + /* Windows changes the WRITECOPY to WRITE protection on an image section write (for a changed page only) */ if (is_mem_writable(info.Protect)) {
1
0
0
0
Dmitry Timoshkov : ntdll: Setting WRITECOPY protection on a memory-mapped file is allowed.
by Alexandre Julliard
16 Dec '11
16 Dec '11
Module: wine Branch: master Commit: eed406e028102e40a8d33cfd319884015c4496f1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=eed406e028102e40a8d33cfd3…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri Dec 16 14:44:35 2011 +0800 ntdll: Setting WRITECOPY protection on a memory-mapped file is allowed. --- dlls/kernel32/tests/virtual.c | 21 +++++---------------- dlls/ntdll/virtual.c | 24 ++++++++++++++---------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index 3812cb2..336fd87 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -1787,13 +1787,6 @@ static void test_CreateFileMapping_protection(void) { if (!ret) { - /* FIXME: completely remove the condition below once Wine is fixed */ - if (td[i].prot == PAGE_WRITECOPY) - { - todo_wine - ok(ret, "%d: VirtualProtect error %d\n", i, GetLastError()); - continue; - } /* win2k and XP don't support EXEC on file mappings */ if (td[i].prot == PAGE_EXECUTE) { @@ -1809,7 +1802,6 @@ static void test_CreateFileMapping_protection(void) /* Vista+ supports PAGE_EXECUTE_WRITECOPY, earlier versions don't */ if (td[i].prot == PAGE_EXECUTE_WRITECOPY) { - todo_wine ok(broken(!ret), "%d: VirtualProtect doesn't support PAGE_EXECUTE_WRITECOPY\n", i); continue; } @@ -1827,7 +1819,11 @@ static void test_CreateFileMapping_protection(void) 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 == prot, "%d: got %#x != expected %#x\n", i, info.Protect, prot); + /* FIXME: remove the condition below once Wine is fixed */ + if (td[i].prot == PAGE_EXECUTE_WRITECOPY) + todo_wine ok(info.Protect == prot, "%d: got %#x != expected %#x\n", i, info.Protect, prot); + else + ok(info.Protect == prot, "%d: got %#x != expected %#x\n", i, info.Protect, prot); ok(info.AllocationBase == base, "%d: %p != %p\n", i, info.AllocationBase, base); ok(info.AllocationProtect == alloc_prot, "%d: %#x != %#x\n", i, info.AllocationProtect, alloc_prot); ok(info.State == MEM_COMMIT, "%d: %#x != MEM_COMMIT\n", i, info.State); @@ -2122,13 +2118,6 @@ static void test_mapping(void) ok(broken(!ret), "VirtualProtect doesn't support PAGE_EXECUTE_WRITECOPY view properly\n"); continue; } - /* FIXME: completely remove the condition below once Wine is fixed */ - if (!ret && page_prot[k] == PAGE_WRITECOPY) - { - todo_wine - ok(ret, "VirtualProtect error %d\n", GetLastError()); - continue; - } ok(ret, "VirtualProtect error %d, map %#x, view %#x, requested prot %#x\n", GetLastError(), page_prot[i], view[j].prot, page_prot[k]); ok(old_prot == prev_prot, "got %#x, expected %#x\n", old_prot, prev_prot); diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index e6ca21a..ee56e71 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -2079,26 +2079,30 @@ NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T size = ROUND_SIZE( addr, size ); base = ROUND_ADDR( addr, page_mask ); - if ((status = get_vprot_flags( new_prot, &new_vprot ))) return status; - if (new_vprot & VPROT_WRITECOPY) return STATUS_INVALID_PAGE_PROTECTION; - new_vprot |= VPROT_COMMITTED; server_enter_uninterrupted_section( &csVirtual, &sigset ); - if (!(view = VIRTUAL_FindView( base, size ))) - { - status = STATUS_INVALID_PARAMETER; - } - else + if ((view = VIRTUAL_FindView( base, size ))) { /* Make sure all the pages are committed */ if (get_committed_size( view, base, &vprot ) >= size && (vprot & VPROT_COMMITTED)) { - if (old_prot) *old_prot = VIRTUAL_GetWin32Prot( vprot ); - if (!VIRTUAL_SetProt( view, base, size, new_vprot )) status = STATUS_ACCESS_DENIED; + if (!(status = get_vprot_flags( new_prot, &new_vprot ))) + { + if ((new_vprot & VPROT_WRITECOPY) && (view->protect & VPROT_VALLOC)) + status = STATUS_INVALID_PAGE_PROTECTION; + else + { + new_vprot |= VPROT_COMMITTED; + if (old_prot) *old_prot = VIRTUAL_GetWin32Prot( vprot ); + if (!VIRTUAL_SetProt( view, base, size, new_vprot )) status = STATUS_ACCESS_DENIED; + } + } } else status = STATUS_NOT_COMMITTED; } + else status = STATUS_INVALID_PARAMETER; + server_leave_uninterrupted_section( &csVirtual, &sigset ); if (status == STATUS_SUCCESS)
1
0
0
0
Jacek Caban : jscript: Return VARIANT directly from expr_eval.
by Alexandre Julliard
16 Dec '11
16 Dec '11
Module: wine Branch: master Commit: 47fa932ac05ac32c7028e292d732593faa821835 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=47fa932ac05ac32c7028e292d…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Dec 16 11:45:37 2011 +0100 jscript: Return VARIANT directly from expr_eval. --- dlls/jscript/engine.c | 165 ++++++++++-------------------------------------- 1 files changed, 35 insertions(+), 130 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=47fa932ac05ac32c7028e…
1
0
0
0
Jacek Caban : jscript: Invoke bytecode directly from expr_eval.
by Alexandre Julliard
16 Dec '11
16 Dec '11
Module: wine Branch: master Commit: 6b1077e2cbf4462f7b3e721993db9411f77a22b6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6b1077e2cbf4462f7b3e72199…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Dec 16 11:44:27 2011 +0100 jscript: Invoke bytecode directly from expr_eval. --- dlls/jscript/engine.c | 28 ++++++++-------------------- dlls/jscript/engine.h | 2 -- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 424659f..00035f9 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -54,10 +54,7 @@ static inline HRESULT stat_eval(script_ctx_t *ctx, statement_t *stat, return_typ return stat->eval(ctx, stat, rt, ret); } -static inline HRESULT expr_eval(script_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) -{ - return compiled_expression_eval(ctx, expr, flags, ei, ret); -} +static HRESULT expr_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*); static HRESULT stack_push(exec_ctx_t *ctx, VARIANT *v) { @@ -3122,7 +3119,7 @@ OP_LIST #undef X }; -static HRESULT interp_expression_eval(script_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) +static HRESULT expr_eval(script_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) { exec_ctx_t *exec_ctx = ctx->exec_ctx; unsigned prev_ip, prev_top; @@ -3131,6 +3128,12 @@ static HRESULT interp_expression_eval(script_ctx_t *ctx, expression_t *expr, DWO TRACE("\n"); + if(expr->instr_off == -1) { + hres = compile_subscript(ctx->exec_ctx->parser, expr, !(flags & EXPR_NOVAL), &expr->instr_off); + if(FAILED(hres)) + return hres; + } + prev_top = exec_ctx->top; prev_ip = exec_ctx->ip; exec_ctx->ip = expr->instr_off; @@ -3161,18 +3164,3 @@ static HRESULT interp_expression_eval(script_ctx_t *ctx, expression_t *expr, DWO ret->u.var = *stack_pop(exec_ctx); return S_OK; } - -HRESULT compiled_expression_eval(script_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) -{ - HRESULT hres; - - TRACE("\n"); - - if(expr->instr_off == -1) { - hres = compile_subscript(ctx->exec_ctx->parser, expr, !(flags & EXPR_NOVAL), &expr->instr_off); - if(FAILED(hres)) - return hres; - } - - return interp_expression_eval(ctx, expr, flags, ei, ret); -} diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h index 323e9e3..5ff5933 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -567,6 +567,4 @@ typedef struct { prop_val_t *property_list; } property_value_expression_t; -HRESULT compiled_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; - HRESULT compile_subscript(parser_ctx_t*,expression_t*,BOOL,unsigned*) DECLSPEC_HIDDEN;
1
0
0
0
← Newer
1
...
33
34
35
36
37
38
39
...
81
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
Results per page:
10
25
50
100
200