ReactOS.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
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
List overview
Download
Ros-diffs
July 2016
----- 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
ros-diffs@reactos.org
18 participants
358 discussions
Start a n
N
ew thread
[akhaldi] 71756: [PSDK] Update d3drm.h. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Jul 2 15:33:00 2016 New Revision: 71756 URL:
http://svn.reactos.org/svn/reactos?rev=71756&view=rev
Log: [PSDK] Update d3drm.h. CORE-11368 Modified: trunk/reactos/sdk/include/psdk/d3drm.h Modified: trunk/reactos/sdk/include/psdk/d3drm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/d3drm.h?r…
============================================================================== --- trunk/reactos/sdk/include/psdk/d3drm.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/d3drm.h [iso-8859-1] Sat Jul 2 15:33:00 2016 @@ -110,7 +110,7 @@ #define IDirect3DRM_AddRef(p) (p)->lpVtbl->AddRef(p) #define IDirect3DRM_Release(p) (p)->lpVtbl->Release(p) /*** IDirect3DRM methods ***/ -#define IDirect3DRM_CreateObject(p,a,b,c,d) (p)->lpVtbl->CreateObject(p,a,b,d) +#define IDirect3DRM_CreateObject(p,a,b,c,d) (p)->lpVtbl->CreateObject(p,a,b,c,d) #define IDirect3DRM_CreateFrame(p,a,b) (p)->lpVtbl->CreateFrame(p,a,b) #define IDirect3DRM_CreateMesh(p,a) (p)->lpVtbl->CreateMesh(p,a) #define IDirect3DRM_CreateMeshBuilder(p,a) (p)->lpVtbl->CreateMeshBuilder(p,a) @@ -148,7 +148,7 @@ #define IDirect3DRM_AddRef(p) (p)->AddRef() #define IDirect3DRM_Release(p) (p)->Release() /*** IDirect3DRM methods ***/ -#define IDirect3DRM_CreateObject(p,a,b,c,d) (p)->CreateObject(a,b,d) +#define IDirect3DRM_CreateObject(p,a,b,c,d) (p)->CreateObject(a,b,c,d) #define IDirect3DRM_CreateFrame(p,a,b) (p)->CreateFrame(a,b) #define IDirect3DRM_CreateMesh(p,a) (p)->CreateMesh(a) #define IDirect3DRM_CreateMeshBuilder(p,a) (p)->CreateMeshBuilder(a) @@ -251,7 +251,7 @@ #define IDirect3DRM2_AddRef(p) (p)->lpVtbl->AddRef(p) #define IDirect3DRM2_Release(p) (p)->lpVtbl->Release(p) /*** IDirect3DRM2 methods ***/ -#define IDirect3DRM2_CreateObject(p,a,b,c,d) (p)->lpVtbl->CreateObject(p,a,b,d) +#define IDirect3DRM2_CreateObject(p,a,b,c,d) (p)->lpVtbl->CreateObject(p,a,b,c,d) #define IDirect3DRM2_CreateFrame(p,a,b) (p)->lpVtbl->CreateFrame(p,a,b) #define IDirect3DRM2_CreateMesh(p,a) (p)->lpVtbl->CreateMesh(p,a) #define IDirect3DRM2_CreateMeshBuilder(p,a) (p)->lpVtbl->CreateMeshBuilder(p,a) @@ -290,7 +290,7 @@ #define IDirect3DRM2_AddRef(p) (p)->AddRef() #define IDirect3DRM2_Release(p) (p)->Release() /*** IDirect3DRM2 methods ***/ -#define IDirect3DRM2_CreateObject(p,a,b,c,d) (p)->CreateObject(a,b,d) +#define IDirect3DRM2_CreateObject(p,a,b,c,d) (p)->CreateObject(a,b,c,d) #define IDirect3DRM2_CreateFrame(p,a,b) (p)->CreateFrame(a,b) #define IDirect3DRM2_CreateMesh(p,a) (p)->CreateMesh(a) #define IDirect3DRM2_CreateMeshBuilder(p,a) (p)->CreateMeshBuilder(a) @@ -399,7 +399,7 @@ #define IDirect3DRM3_AddRef(p) (p)->lpVtbl->AddRef(p) #define IDirect3DRM3_Release(p) (p)->lpVtbl->Release(p) /*** IDirect3DRM3 methods ***/ -#define IDirect3DRM3_CreateObject(p,a,b,c,d) (p)->lpVtbl->CreateObject(p,a,b,d) +#define IDirect3DRM3_CreateObject(p,a,b,c,d) (p)->lpVtbl->CreateObject(p,a,b,c,d) #define IDirect3DRM3_CreateFrame(p,a,b) (p)->lpVtbl->CreateFrame(p,a,b) #define IDirect3DRM3_CreateMesh(p,a) (p)->lpVtbl->CreateMesh(p,a) #define IDirect3DRM3_CreateMeshBuilder(p,a) (p)->lpVtbl->CreateMeshBuilder(p,a) @@ -443,7 +443,7 @@ #define IDirect3DRM3_AddRef(p) (p)->AddRef() #define IDirect3DRM3_Release(p) (p)->Release() /*** IDirect3DRM3 methods ***/ -#define IDirect3DRM3_CreateObject(p,a,b,c,d) (p)->CreateObject(a,b,d) +#define IDirect3DRM3_CreateObject(p,a,b,c,d) (p)->CreateObject(a,b,c,d) #define IDirect3DRM3_CreateFrame(p,a,b) (p)->CreateFrame(a,b) #define IDirect3DRM3_CreateMesh(p,a) (p)->CreateMesh(a) #define IDirect3DRM3_CreateMeshBuilder(p,a) (p)->CreateMeshBuilder(a)
8 years, 5 months
1
0
0
0
[akhaldi] 71755: [WINDOWSCODECS_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Jul 2 15:29:06 2016 New Revision: 71755 URL:
http://svn.reactos.org/svn/reactos?rev=71755&view=rev
Log: [WINDOWSCODECS_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368 Modified: trunk/rostests/winetests/windowscodecs/bitmap.c trunk/rostests/winetests/windowscodecs/converter.c trunk/rostests/winetests/windowscodecs/metadata.c Modified: trunk/rostests/winetests/windowscodecs/bitmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/b…
============================================================================== --- trunk/rostests/winetests/windowscodecs/bitmap.c [iso-8859-1] (original) +++ trunk/rostests/winetests/windowscodecs/bitmap.c [iso-8859-1] Sat Jul 2 15:29:06 2016 @@ -829,13 +829,8 @@ hr = IWICBitmap_CopyPixels(bitmap, NULL, 4, sizeof(data), data); ok(hr == S_OK, "IWICBitmap_CopyPixels error %#x\n", hr); for (i = 0; i < sizeof(data); i++) - { - if (data[i] != data_8bpp_pal_wic[i]) -todo_wine + todo_wine_if (data[i] != data_8bpp_pal_wic[i]) ok(data[i] == data_8bpp_pal_wic[i], "%u: expected %#x, got %#x\n", i, data_8bpp_pal_wic[i], data[i]); - else - ok(data[i] == data_8bpp_pal_wic[i], "%u: expected %#x, got %#x\n", i, data_8bpp_pal_wic[i], data[i]); - } IWICBitmap_Release(bitmap); DeleteObject(hbmp); Modified: trunk/rostests/winetests/windowscodecs/converter.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/c…
============================================================================== --- trunk/rostests/winetests/windowscodecs/converter.c [iso-8859-1] (original) +++ trunk/rostests/winetests/windowscodecs/converter.c [iso-8859-1] Sat Jul 2 15:29:06 2016 @@ -48,6 +48,11 @@ const bitmap_data *data; } BitmapTestSrc; +static BOOL near_equal(float a, float b) +{ + return fabsf(a - b) < 0.001; +} + static inline BitmapTestSrc *impl_from_IWICBitmapSource(IWICBitmapSource *iface) { return CONTAINING_RECORD(iface, BitmapTestSrc, IWICBitmapSource_iface); @@ -201,6 +206,14 @@ HeapFree(GetProcessHeap(), 0, This); } +/* XP and 2003 use linear color conversion, later versions use sRGB gamma */ +static const float bits_32bppGrayFloat_xp[] = { + 0.114000f,0.587000f,0.299000f,0.000000f, + 0.886000f,0.413000f,0.701000f,1.000000f}; +static const BYTE bits_8bppGray_xp[] = { + 29,150,76,0, + 226,105,179,255}; + static void compare_bitmap_data(const struct bitmap_data *expect, IWICBitmapSource *source, const char *name) { BYTE *converted_bits; @@ -250,6 +263,33 @@ } ok(equal, "unexpected pixel data (%s)\n", name); } + else if (IsEqualGUID(expect->format, &GUID_WICPixelFormat32bppGrayFloat)) + { + BOOL equal=TRUE; + UINT i; + const float *a=(const float*)expect->bits, *b=(const float*)converted_bits; + for (i=0; i<(buffersize/4); i++) + if (!near_equal(a[i], b[i]) && !near_equal(bits_32bppGrayFloat_xp[i], b[i])) + { + equal = FALSE; + break; + } + + ok(equal, "unexpected pixel data (%s)\n", name); + } + else if (IsEqualGUID(expect->format, &GUID_WICPixelFormat8bppGray)) + { + UINT i; + BOOL equal=TRUE; + const BYTE *a=(const BYTE*)expect->bits, *b=(const BYTE*)converted_bits; + for (i=0; i<buffersize; i++) + if (a[i] != b[i] && bits_8bppGray_xp[i] != b[i]) + { + equal = FALSE; + break; + } + ok(equal, "unexpected pixel data (%s)\n", name); + } else ok(memcmp(expect->bits, converted_bits, buffersize) == 0, "unexpected pixel data (%s)\n", name); @@ -270,6 +310,33 @@ } ok(equal, "unexpected pixel data with rc=NULL (%s)\n", name); } + else if (IsEqualGUID(expect->format, &GUID_WICPixelFormat32bppGrayFloat)) + { + BOOL equal=TRUE; + UINT i; + const float *a=(const float*)expect->bits, *b=(const float*)converted_bits; + for (i=0; i<(buffersize/4); i++) + if (!near_equal(a[i], b[i]) && !near_equal(bits_32bppGrayFloat_xp[i], b[i])) + { + equal = FALSE; + break; + } + + ok(equal, "unexpected pixel data (%s)\n", name); + } + else if (IsEqualGUID(expect->format, &GUID_WICPixelFormat8bppGray)) + { + UINT i; + BOOL equal=TRUE; + const BYTE *a=(const BYTE*)expect->bits, *b=(const BYTE*)converted_bits; + for (i=0; i<buffersize; i++) + if (a[i] != b[i] && bits_8bppGray_xp[i] != b[i]) + { + equal = FALSE; + break; + } + ok(equal, "unexpected pixel data (%s)\n", name); + } else ok(memcmp(expect->bits, converted_bits, buffersize) == 0, "unexpected pixel data with rc=NULL (%s)\n", name); @@ -300,6 +367,24 @@ static const struct bitmap_data testdata_32bppBGRA = { &GUID_WICPixelFormat32bppBGRA, 32, bits_32bppBGRA, 4, 2, 96.0, 96.0}; +static const float bits_32bppGrayFloat[] = { + 0.072200f,0.715200f,0.212600f,0.000000f, + 0.927800f,0.284800f,0.787400f,1.000000f}; +static const struct bitmap_data testdata_32bppGrayFloat = { + &GUID_WICPixelFormat32bppGrayFloat, 32, (const BYTE *)bits_32bppGrayFloat, 4, 2, 96.0, 96.0}; + +static const BYTE bits_8bppGray[] = { + 76,220,127,0, + 247,145,230,255}; +static const struct bitmap_data testdata_8bppGray = { + &GUID_WICPixelFormat8bppGray, 8, bits_8bppGray, 4, 2, 96.0, 96.0}; + +static const BYTE bits_24bppBGR_gray[] = { + 76,76,76, 220,220,220, 127,127,127, 0,0,0, + 247,247,247, 145,145,145, 230,230,230, 255,255,255}; +static const struct bitmap_data testdata_24bppBGR_gray = { + &GUID_WICPixelFormat24bppBGR, 24, bits_24bppBGR_gray, 4, 2, 96.0, 96.0}; + static void test_conversion(const struct bitmap_data *src, const struct bitmap_data *dst, const char *name, BOOL todo) { BitmapTestSrc *src_obj; @@ -309,9 +394,7 @@ CreateTestBitmap(src, &src_obj); hr = WICConvertBitmapSource(dst->format, &src_obj->IWICBitmapSource_iface, &dst_bitmap); - if (todo) - todo_wine ok(SUCCEEDED(hr), "WICConvertBitmapSource(%s) failed, hr=%x\n", name, hr); - else + todo_wine_if (todo) ok(SUCCEEDED(hr), "WICConvertBitmapSource(%s) failed, hr=%x\n", name, hr); if (SUCCEEDED(hr)) @@ -500,7 +583,7 @@ if (FAILED(hr)) return; - ok(cProperties == cProperties2, "Missmatch of property count (IPropertyBag2::CountProperties=%i, IPropertyBag2::GetPropertyInfo=%i)\n", + ok(cProperties == cProperties2, "Mismatch of property count (IPropertyBag2::CountProperties=%i, IPropertyBag2::GetPropertyInfo=%i)\n", (int)cProperties, (int)cProperties2); } @@ -741,6 +824,14 @@ test_conversion(&testdata_32bppBGR, &testdata_24bppRGB, "32bppBGR -> 24bppRGB", FALSE); test_conversion(&testdata_24bppRGB, &testdata_32bppBGR, "24bppRGB -> 32bppBGR", FALSE); + test_conversion(&testdata_24bppRGB, &testdata_32bppGrayFloat, "24bppRGB -> 32bppGrayFloat", FALSE); + test_conversion(&testdata_32bppBGR, &testdata_32bppGrayFloat, "32bppBGR -> 32bppGrayFloat", FALSE); + + test_conversion(&testdata_24bppBGR, &testdata_8bppGray, "24bppBGR -> 8bppGray", FALSE); + test_conversion(&testdata_32bppBGR, &testdata_8bppGray, "32bppBGR -> 8bppGray", FALSE); + test_conversion(&testdata_32bppGrayFloat, &testdata_24bppBGR_gray, "32bppGrayFloat -> 24bppBGR gray", FALSE); + test_conversion(&testdata_32bppGrayFloat, &testdata_8bppGray, "32bppGrayFloat -> 8bppGray", FALSE); + test_invalid_conversion(); test_default_converter(); Modified: trunk/rostests/winetests/windowscodecs/metadata.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/windowscodecs/m…
============================================================================== --- trunk/rostests/winetests/windowscodecs/metadata.c [iso-8859-1] (original) +++ trunk/rostests/winetests/windowscodecs/metadata.c [iso-8859-1] Sat Jul 2 15:29:06 2016 @@ -969,6 +969,8 @@ IWICBitmapFrameDecode *frame; IWICMetadataBlockReader *blockreader; IWICMetadataReader *reader; + IWICMetadataQueryReader *queryreader; + IWICComponentFactory *factory; GUID containerformat; HRESULT hr; UINT count=0xdeadbeef; @@ -1039,7 +1041,32 @@ hr = IWICMetadataBlockReader_GetReaderByIndex(blockreader, 1, &reader); todo_wine ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "GetReaderByIndex failed, hr=%x\n", hr); + hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICComponentFactory, (void**)&factory); + ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr); + + hr = IWICComponentFactory_CreateQueryReaderFromBlockReader(factory, NULL, &queryreader); + ok(hr == E_INVALIDARG, "CreateQueryReaderFromBlockReader should have failed: %08x\n", hr); + + hr = IWICComponentFactory_CreateQueryReaderFromBlockReader(factory, blockreader, NULL); + ok(hr == E_INVALIDARG, "CreateQueryReaderFromBlockReader should have failed: %08x\n", hr); + + hr = IWICComponentFactory_CreateQueryReaderFromBlockReader(factory, blockreader, &queryreader); + ok(hr == S_OK, "CreateQueryReaderFromBlockReader failed: %08x\n", hr); + + IWICMetadataQueryReader_Release(queryreader); + + IWICComponentFactory_Release(factory); + IWICMetadataBlockReader_Release(blockreader); + } + + hr = IWICBitmapFrameDecode_GetMetadataQueryReader(frame, &queryreader); + ok(hr == S_OK, "GetMetadataQueryReader failed: %08x\n", hr); + + if (SUCCEEDED(hr)) + { + IWICMetadataQueryReader_Release(queryreader); } IWICBitmapFrameDecode_Release(frame); @@ -1131,6 +1158,7 @@ IWICBitmapFrameDecode *frame; IWICMetadataBlockReader *blockreader; IWICMetadataReader *reader; + IWICMetadataQueryReader *queryreader; GUID format; HRESULT hr; UINT count; @@ -1451,6 +1479,16 @@ ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); IWICMetadataBlockReader_Release(blockreader); + } + + hr = IWICBitmapFrameDecode_GetMetadataQueryReader(frame, &queryreader); + ok(hr == S_OK || + broken(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION) /* before Vista */, + "GetMetadataQueryReader failed: %08x\n", hr); + + if (SUCCEEDED(hr)) + { + IWICMetadataQueryReader_Release(queryreader); } IWICBitmapFrameDecode_Release(frame);
8 years, 5 months
1
0
0
0
[akhaldi] 71754: [WINDOWSCODECS] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Jul 2 15:28:24 2016 New Revision: 71754 URL:
http://svn.reactos.org/svn/reactos?rev=71754&view=rev
Log: [WINDOWSCODECS] Sync with Wine Staging 1.9.11. CORE-11368 Added: trunk/reactos/dll/win32/windowscodecs/metadataquery.c (with props) trunk/reactos/dll/win32/windowscodecs/msvc-thiscall.c (with props) trunk/reactos/dll/win32/windowscodecs/msvc.h (with props) Modified: trunk/reactos/dll/win32/windowscodecs/CMakeLists.txt trunk/reactos/dll/win32/windowscodecs/bitmap.c trunk/reactos/dll/win32/windowscodecs/converter.c trunk/reactos/dll/win32/windowscodecs/gifformat.c trunk/reactos/dll/win32/windowscodecs/guid.c trunk/reactos/dll/win32/windowscodecs/imgfactory.c trunk/reactos/dll/win32/windowscodecs/jpegformat.c trunk/reactos/dll/win32/windowscodecs/pngformat.c trunk/reactos/dll/win32/windowscodecs/regsvr.c trunk/reactos/dll/win32/windowscodecs/scaler.c trunk/reactos/dll/win32/windowscodecs/tiffformat.c trunk/reactos/dll/win32/windowscodecs/wincodecs_private.h trunk/reactos/dll/win32/windowscodecs/windowscodecs.spec trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/windowscodecs/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/CM…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/CMakeLists.txt [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -23,7 +23,6 @@ add_rpcproxy_files(windowscodecs_wincodec.idl) list(APPEND SOURCE - bitmap.c bmpdecode.c bmpencode.c clipper.c @@ -40,6 +39,7 @@ jpegformat.c main.c metadatahandler.c + metadataquery.c palette.c pngformat.c propertybag.c @@ -52,8 +52,17 @@ ungif.c wincodecs_private.h) -add_library(windowscodecs SHARED - ${SOURCE} +if(MSVC) + if(ARCH STREQUAL "i386") + list(APPEND SOURCE msvc-thiscall.c) + endif() + set_source_files_properties(bitmap.c PROPERTIES COMPILE_FLAGS "/FImsvc.h") + list(APPEND ADDITIONAL_SOURCE bitmap.c) +else() + list(APPEND SOURCE bitmap.c) +endif() + +list(APPEND ADDITIONAL_SOURCE guid.c version.rc ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c @@ -61,6 +70,10 @@ ${CMAKE_CURRENT_BINARY_DIR}/windowscodecs.def ${CMAKE_CURRENT_BINARY_DIR}/windowscodecs_wincodec_p.c) +add_library(windowscodecs SHARED + ${SOURCE} + ${ADDITIONAL_SOURCE}) + set_module_type(windowscodecs win32dll) target_link_libraries(windowscodecs wine uuid ${PSEH_LIB}) add_importlibs(windowscodecs ole32 oleaut32 rpcrt4 shlwapi user32 gdi32 advapi32 advapi32_vista msvcrt kernel32 ntdll) Modified: trunk/reactos/dll/win32/windowscodecs/bitmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/bi…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/bitmap.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/bitmap.c [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -31,6 +31,7 @@ int palette_set; LONG lock; /* 0 if not locked, -1 if locked for writing, count if locked for reading */ BYTE *data; + BOOL is_section; /* TRUE if data is a section created by an application */ UINT width, height; UINT stride; UINT bpp; @@ -121,6 +122,7 @@ } else { + FIXME("unknown interface %s\n", debugstr_guid(iid)); *ppv = NULL; return E_NOINTERFACE; } @@ -234,12 +236,14 @@ { *ppv = &This->IWICBitmap_iface; } - else if (IsEqualIID(&IID_IMILBitmapSource, iid)) + else if (IsEqualIID(&IID_IMILBitmap, iid) || + IsEqualIID(&IID_IMILBitmapSource, iid)) { *ppv = &This->IMILBitmapSource_iface; } else { + FIXME("unknown interface %s\n", debugstr_guid(iid)); *ppv = NULL; return E_NOINTERFACE; } @@ -270,7 +274,10 @@ if (This->palette) IWICPalette_Release(This->palette); This->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->cs); - HeapFree(GetProcessHeap(), 0, This->data); + if (This->is_section) + UnmapViewOfFile(This->data); + else + HeapFree(GetProcessHeap(), 0, This->data); HeapFree(GetProcessHeap(), 0, This); } @@ -465,13 +472,22 @@ if (!ppv) return E_INVALIDARG; if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_IMILBitmap, iid) || IsEqualIID(&IID_IMILBitmapSource, iid)) { IUnknown_AddRef(&This->IMILBitmapSource_iface); *ppv = &This->IMILBitmapSource_iface; return S_OK; } - + else if (IsEqualIID(&IID_IWICBitmap, iid) || + IsEqualIID(&IID_IWICBitmapSource, iid)) + { + IUnknown_AddRef(&This->IWICBitmap_iface); + *ppv = &This->IWICBitmap_iface; + return S_OK; + } + + FIXME("unknown interface %s\n", debugstr_guid(iid)); *ppv = NULL; return E_NOINTERFACE; } @@ -492,6 +508,7 @@ UINT *width, UINT *height) { BitmapImpl *This = impl_from_IMILBitmapSource(iface); + TRACE("(%p,%p,%p)\n", iface, width, height); return IWICBitmap_GetSize(&This->IWICBitmap_iface, width, height); } @@ -545,6 +562,7 @@ } } + TRACE("=> %u\n", *format); return S_OK; } @@ -552,6 +570,7 @@ double *dpix, double *dpiy) { BitmapImpl *This = impl_from_IMILBitmapSource(iface); + TRACE("(%p,%p,%p)\n", iface, dpix, dpiy); return IWICBitmap_GetResolution(&This->IWICBitmap_iface, dpix, dpiy); } @@ -559,6 +578,7 @@ IWICPalette *palette) { BitmapImpl *This = impl_from_IMILBitmapSource(iface); + TRACE("(%p,%p)\n", iface, palette); return IWICBitmap_CopyPalette(&This->IWICBitmap_iface, palette); } @@ -566,10 +586,11 @@ const WICRect *rc, UINT stride, UINT size, BYTE *buffer) { BitmapImpl *This = impl_from_IMILBitmapSource(iface); + TRACE("(%p,%p,%u,%u,%p)\n", iface, rc, stride, size, buffer); return IWICBitmap_CopyPixels(&This->IWICBitmap_iface, rc, stride, size, buffer); } -static HRESULT WINAPI IMILBitmapImpl_UnknownMethod1(IMILBitmapSource *iface, void **ppv) +static HRESULT WINAPI IMILBitmapImpl_unknown1(IMILBitmapSource *iface, void **ppv) { BitmapImpl *This = impl_from_IMILBitmapSource(iface); @@ -577,10 +598,44 @@ if (!ppv) return E_INVALIDARG; - IUnknown_AddRef(&This->IMILUnknown1_iface); + /* reference count is not incremented here */ *ppv = &This->IMILUnknown1_iface; return S_OK; +} + +static HRESULT WINAPI IMILBitmapImpl_Lock(IMILBitmapSource *iface, const WICRect *rc, DWORD flags, IWICBitmapLock **lock) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + TRACE("(%p,%p,%08x,%p)\n", iface, rc, flags, lock); + return IWICBitmap_Lock(&This->IWICBitmap_iface, rc, flags, lock); +} + +static HRESULT WINAPI IMILBitmapImpl_Unlock(IMILBitmapSource *iface, IWICBitmapLock *lock) +{ + TRACE("(%p,%p)\n", iface, lock); + IWICBitmapLock_Release(lock); + return S_OK; +} + +static HRESULT WINAPI IMILBitmapImpl_SetPalette(IMILBitmapSource *iface, IWICPalette *palette) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + TRACE("(%p,%p)\n", iface, palette); + return IWICBitmap_SetPalette(&This->IWICBitmap_iface, palette); +} + +static HRESULT WINAPI IMILBitmapImpl_SetResolution(IMILBitmapSource *iface, double dpix, double dpiy) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + TRACE("(%p,%f,%f)\n", iface, dpix, dpiy); + return IWICBitmap_SetResolution(&This->IWICBitmap_iface, dpix, dpiy); +} + +static HRESULT WINAPI IMILBitmapImpl_AddDirtyRect(IMILBitmapSource *iface, const WICRect *rc) +{ + FIXME("(%p,%p): stub\n", iface, rc); + return E_NOTIMPL; } static const IMILBitmapSourceVtbl IMILBitmapImpl_Vtbl = @@ -593,26 +648,20 @@ IMILBitmapImpl_GetResolution, IMILBitmapImpl_CopyPalette, IMILBitmapImpl_CopyPixels, - IMILBitmapImpl_UnknownMethod1, + IMILBitmapImpl_unknown1, + IMILBitmapImpl_Lock, + IMILBitmapImpl_Unlock, + IMILBitmapImpl_SetPalette, + IMILBitmapImpl_SetResolution, + IMILBitmapImpl_AddDirtyRect }; static HRESULT WINAPI IMILUnknown1Impl_QueryInterface(IMILUnknown1 *iface, REFIID iid, void **ppv) { - BitmapImpl *This = impl_from_IMILUnknown1(iface); - - TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); - - if (!ppv) return E_INVALIDARG; - - if (IsEqualIID(&IID_IUnknown, iid)) - { - IUnknown_AddRef(&This->IMILUnknown1_iface); - *ppv = iface; - return S_OK; - } - - return IWICBitmap_QueryInterface(&This->IWICBitmap_iface, iid, ppv); + FIXME("(%p,%s,%p): stub\n", iface, debugstr_guid(iid), ppv); + *ppv = NULL; + return E_NOINTERFACE; } static ULONG WINAPI IMILUnknown1Impl_AddRef(IMILUnknown1 *iface) @@ -626,48 +675,109 @@ BitmapImpl *This = impl_from_IMILUnknown1(iface); return IWICBitmap_Release(&This->IWICBitmap_iface); } + +DECLSPEC_HIDDEN void WINAPI IMILUnknown1Impl_unknown1(IMILUnknown1 *iface, void *arg) +{ + FIXME("(%p,%p): stub\n", iface, arg); +} + +static HRESULT WINAPI IMILUnknown1Impl_unknown2(IMILUnknown1 *iface, void *arg1, void *arg2) +{ + FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2); + return E_NOTIMPL; +} + +DECLSPEC_HIDDEN HRESULT WINAPI IMILUnknown1Impl_unknown3(IMILUnknown1 *iface, void *arg) +{ + FIXME("(%p,%p): stub\n", iface, arg); + return E_NOTIMPL; +} + +static HRESULT WINAPI IMILUnknown1Impl_unknown4(IMILUnknown1 *iface, void *arg) +{ + FIXME("(%p,%p): stub\n", iface, arg); + return E_NOTIMPL; +} + +static HRESULT WINAPI IMILUnknown1Impl_unknown5(IMILUnknown1 *iface, void *arg) +{ + FIXME("(%p,%p): stub\n", iface, arg); + return E_NOTIMPL; +} + +static HRESULT WINAPI IMILUnknown1Impl_unknown6(IMILUnknown1 *iface, DWORD64 arg) +{ + FIXME("(%p,%s): stub\n", iface, wine_dbgstr_longlong(arg)); + return E_NOTIMPL; +} + +static HRESULT WINAPI IMILUnknown1Impl_unknown7(IMILUnknown1 *iface, void *arg) +{ + FIXME("(%p,%p): stub\n", iface, arg); + return E_NOTIMPL; +} + +DECLSPEC_HIDDEN HRESULT WINAPI IMILUnknown1Impl_unknown8(IMILUnknown1 *iface) +{ + FIXME("(%p): stub\n", iface); + return E_NOTIMPL; +} + +DEFINE_THISCALL_WRAPPER(IMILUnknown1Impl_unknown1, 8) +DEFINE_THISCALL_WRAPPER(IMILUnknown1Impl_unknown3, 8) +DEFINE_THISCALL_WRAPPER(IMILUnknown1Impl_unknown8, 4) static const IMILUnknown1Vtbl IMILUnknown1Impl_Vtbl = { IMILUnknown1Impl_QueryInterface, IMILUnknown1Impl_AddRef, IMILUnknown1Impl_Release, + THISCALL(IMILUnknown1Impl_unknown1), + IMILUnknown1Impl_unknown2, + THISCALL(IMILUnknown1Impl_unknown3), + IMILUnknown1Impl_unknown4, + IMILUnknown1Impl_unknown5, + IMILUnknown1Impl_unknown6, + IMILUnknown1Impl_unknown7, + THISCALL(IMILUnknown1Impl_unknown8) }; static HRESULT WINAPI IMILUnknown2Impl_QueryInterface(IMILUnknown2 *iface, REFIID iid, void **ppv) { - BitmapImpl *This = impl_from_IMILUnknown2(iface); - - TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); - - if (!ppv) return E_INVALIDARG; - - if (IsEqualIID(&IID_IUnknown, iid)) - { - IUnknown_AddRef(&This->IMILUnknown2_iface); - *ppv = iface; - return S_OK; - } - - return IWICBitmap_QueryInterface(&This->IWICBitmap_iface, iid, ppv); + FIXME("(%p,%s,%p): stub\n", iface, debugstr_guid(iid), ppv); + *ppv = NULL; + return E_NOINTERFACE; } static ULONG WINAPI IMILUnknown2Impl_AddRef(IMILUnknown2 *iface) { - BitmapImpl *This = impl_from_IMILUnknown2(iface); - return IWICBitmap_AddRef(&This->IWICBitmap_iface); + FIXME("(%p): stub\n", iface); + return 0; } static ULONG WINAPI IMILUnknown2Impl_Release(IMILUnknown2 *iface) { - BitmapImpl *This = impl_from_IMILUnknown2(iface); - return IWICBitmap_Release(&This->IWICBitmap_iface); -} - -static HRESULT WINAPI IMILUnknown2Impl_UnknownMethod1(IMILUnknown2 *iface, void *arg1, void *arg2) + FIXME("(%p): stub\n", iface); + return 0; +} + +static HRESULT WINAPI IMILUnknown2Impl_unknown1(IMILUnknown2 *iface, void *arg1, void **arg2) { FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2); + if (arg2) *arg2 = NULL; + return E_NOTIMPL; +} + +static HRESULT WINAPI IMILUnknown2Impl_unknown2(IMILUnknown2 *iface, void *arg1, void *arg2) +{ + FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2); + return E_NOTIMPL; +} + +static HRESULT WINAPI IMILUnknown2Impl_unknown3(IMILUnknown2 *iface, void *arg1) +{ + FIXME("(%p,%p): stub\n", iface, arg1); return E_NOTIMPL; } @@ -676,17 +786,18 @@ IMILUnknown2Impl_QueryInterface, IMILUnknown2Impl_AddRef, IMILUnknown2Impl_Release, - IMILUnknown2Impl_UnknownMethod1, + IMILUnknown2Impl_unknown1, + IMILUnknown2Impl_unknown2, + IMILUnknown2Impl_unknown3 }; HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, - UINT stride, UINT datasize, BYTE *bits, + UINT stride, UINT datasize, BYTE *data, REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap) { HRESULT hr; BitmapImpl *This; - BYTE *data; UINT bpp; hr = get_pixelformat_bpp(pixelFormat, &bpp); @@ -699,14 +810,20 @@ if (stride < ((bpp*uiWidth)+7)/8) return E_INVALIDARG; This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapImpl)); - data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, datasize); - if (!This || !data) - { - HeapFree(GetProcessHeap(), 0, This); - HeapFree(GetProcessHeap(), 0, data); - return E_OUTOFMEMORY; - } - if (bits) memcpy(data, bits, datasize); + if (!This) return E_OUTOFMEMORY; + + if (!data) + { + data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, datasize); + if (!data) + { + HeapFree(GetProcessHeap(), 0, This); + return E_OUTOFMEMORY; + } + This->is_section = FALSE; + } + else + This->is_section = TRUE; This->IWICBitmap_iface.lpVtbl = &BitmapImpl_Vtbl; This->IMILBitmapSource_iface.lpVtbl = &IMILBitmapImpl_Vtbl; Modified: trunk/reactos/dll/win32/windowscodecs/converter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/co…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/converter.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/converter.c [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -1,5 +1,6 @@ /* * Copyright 2009 Vincent Povirk + * Copyright 2016 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,6 +19,8 @@ #include "wincodecs_private.h" +#include <math.h> + struct FormatConverter; enum pixelformat { @@ -35,6 +38,7 @@ format_16bppBGRA5551, format_24bppBGR, format_24bppRGB, + format_32bppGrayFloat, format_32bppBGR, format_32bppBGRA, format_32bppPBGRA, @@ -62,6 +66,55 @@ WICBitmapPaletteType palette_type; CRITICAL_SECTION lock; /* must be held when initialized */ } FormatConverter; + +/*
https://www.w3.org/Graphics/Color/srgb
*/ +static inline float from_sRGB_component(float f) +{ + if (f <= 0.04045f) return f / 12.92f; + return powf((f + 0.055f) / 1.055f, 2.4f); +} + +static inline float to_sRGB_component(float f) +{ + if (f <= 0.0031308f) return 12.92f * f; + return 1.055f * powf(f, 1.0f/2.4f) - 0.055f; +} + +#if 0 /* FIXME: enable once needed */ +static void from_sRGB(BYTE *bgr) +{ + float r, g, b; + + r = bgr[2] / 255.0f; + g = bgr[1] / 255.0f; + b = bgr[0] / 255.0f; + + r = from_sRGB_component(r); + g = from_sRGB_component(g); + g = from_sRGB_component(b); + + bgr[2] = (BYTE)(r * 255.0f); + bgr[1] = (BYTE)(g * 255.0f); + bgr[0] = (BYTE)(b * 255.0f); +} + +static void to_sRGB(BYTE *bgr) +{ + float r, g, b; + + r = bgr[2] / 255.0f; + g = bgr[1] / 255.0f; + b = bgr[0] / 255.0f; + + r = to_sRGB_component(r); + g = to_sRGB_component(g); + g = to_sRGB_component(b); + + bgr[2] = (BYTE)(r * 255.0f); + bgr[1] = (BYTE)(g * 255.0f); + bgr[0] = (BYTE)(b * 255.0f); +} +#endif static inline FormatConverter *impl_from_IWICFormatConverter(IWICFormatConverter *iface) { @@ -903,6 +956,49 @@ return res; } return S_OK; + + case format_32bppGrayFloat: + if (prc) + { + BYTE *srcdata; + UINT srcstride, srcdatasize; + + srcstride = 4 * prc->Width; + srcdatasize = srcstride * prc->Height; + + srcdata = HeapAlloc(GetProcessHeap(), 0, srcdatasize); + if (!srcdata) return E_OUTOFMEMORY; + + hr = IWICBitmapSource_CopyPixels(This->source, prc, srcstride, srcdatasize, srcdata); + + if (SUCCEEDED(hr)) + { + INT x, y; + BYTE *src = srcdata, *dst = pbBuffer; + + for (y = 0; y < prc->Height; y++) + { + float *gray_float = (float *)src; + BYTE *bgr = dst; + + for (x = 0; x < prc->Width; x++) + { + BYTE gray = (BYTE)floorf(to_sRGB_component(gray_float[x]) * 255.0f + 0.51f); + *bgr++ = gray; + *bgr++ = gray; + *bgr++ = gray; + } + src += srcstride; + dst += cbStride; + } + } + + HeapFree(GetProcessHeap(), 0, srcdata); + + return hr; + } + return S_OK; + default: FIXME("Unimplemented conversion path!\n"); return WINCODEC_ERR_UNSUPPORTEDOPERATION; @@ -979,6 +1075,102 @@ } } +static HRESULT copypixels_to_32bppGrayFloat(struct FormatConverter *This, const WICRect *prc, + UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format) +{ + HRESULT hr; + + switch (source_format) + { + case format_32bppBGR: + case format_32bppBGRA: + case format_32bppPBGRA: + case format_32bppGrayFloat: + if (prc) + { + hr = IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer); + break; + } + return S_OK; + + default: + hr = copypixels_to_32bppBGRA(This, prc, cbStride, cbBufferSize, pbBuffer, source_format); + break; + } + + if (SUCCEEDED(hr) && prc && source_format != format_32bppGrayFloat) + { + INT x, y; + BYTE *p = pbBuffer; + + for (y = 0; y < prc->Height; y++) + { + BYTE *bgr = p; + for (x = 0; x < prc->Width; x++) + { + float gray = (bgr[2] * 0.2126f + bgr[1] * 0.7152f + bgr[0] * 0.0722f) / 255.0f; + *(float *)bgr = gray; + bgr += 4; + } + p += cbStride; + } + } + return hr; +} + +static HRESULT copypixels_to_8bppGray(struct FormatConverter *This, const WICRect *prc, + UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format) +{ + HRESULT hr; + BYTE *srcdata; + UINT srcstride, srcdatasize; + + if (source_format == format_8bppGray) + { + if (prc) + return IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer); + + return S_OK; + } + + srcstride = 3 * prc->Width; + srcdatasize = srcstride * prc->Height; + + srcdata = HeapAlloc(GetProcessHeap(), 0, srcdatasize); + if (!srcdata) return E_OUTOFMEMORY; + + hr = copypixels_to_24bppBGR(This, prc, srcstride, srcdatasize, srcdata, source_format); + if (SUCCEEDED(hr) && prc) + { + INT x, y; + BYTE *src = srcdata, *dst = pbBuffer; + + for (y = 0; y < prc->Height; y++) + { + BYTE *bgr = src; + + for (x = 0; x < prc->Width; x++) + { + float gray = (bgr[2] * 0.2126f + bgr[1] * 0.7152f + bgr[0] * 0.0722f) / 255.0f; + + /* conversion from 32bppGrayFloat to 24bppBGR has already applied sRGB gamma */ + if (source_format == format_32bppGrayFloat) + gray *= 255.0f; + else + gray = to_sRGB_component(gray) * 255.0f; + + dst[x] = (BYTE)floorf(gray + 0.51f); + bgr += 3; + } + src += srcstride; + dst += cbStride; + } + } + + HeapFree(GetProcessHeap(), 0, srcdata); + return hr; +} + static const struct pixelformatinfo supported_formats[] = { {format_1bppIndexed, &GUID_WICPixelFormat1bppIndexed, NULL}, {format_2bppIndexed, &GUID_WICPixelFormat2bppIndexed, NULL}, @@ -987,13 +1179,14 @@ {format_BlackWhite, &GUID_WICPixelFormatBlackWhite, NULL}, {format_2bppGray, &GUID_WICPixelFormat2bppGray, NULL}, {format_4bppGray, &GUID_WICPixelFormat4bppGray, NULL}, - {format_8bppGray, &GUID_WICPixelFormat8bppGray, NULL}, + {format_8bppGray, &GUID_WICPixelFormat8bppGray, copypixels_to_8bppGray}, {format_16bppGray, &GUID_WICPixelFormat16bppGray, NULL}, {format_16bppBGR555, &GUID_WICPixelFormat16bppBGR555, NULL}, {format_16bppBGR565, &GUID_WICPixelFormat16bppBGR565, NULL}, {format_16bppBGRA5551, &GUID_WICPixelFormat16bppBGRA5551, NULL}, {format_24bppBGR, &GUID_WICPixelFormat24bppBGR, copypixels_to_24bppBGR}, {format_24bppRGB, &GUID_WICPixelFormat24bppRGB, copypixels_to_24bppRGB}, + {format_32bppGrayFloat, &GUID_WICPixelFormat32bppGrayFloat, copypixels_to_32bppGrayFloat}, {format_32bppBGR, &GUID_WICPixelFormat32bppBGR, copypixels_to_32bppBGR}, {format_32bppBGRA, &GUID_WICPixelFormat32bppBGRA, copypixels_to_32bppBGRA}, {format_32bppPBGRA, &GUID_WICPixelFormat32bppPBGRA, copypixels_to_32bppPBGRA}, Modified: trunk/reactos/dll/win32/windowscodecs/gifformat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/gi…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/gifformat.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/gifformat.c [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -236,7 +236,7 @@ MetadataItem **items, DWORD *count) { #include "pshpack1.h" - struct graphic_control_extenstion + struct graphic_control_extension { BYTE packed; /* reservred: 3; @@ -314,7 +314,7 @@ MetadataItem **items, DWORD *count) { #include "pshpack1.h" - struct application_extenstion + struct application_extension { BYTE extension_introducer; BYTE extension_label; @@ -421,7 +421,7 @@ MetadataItem **items, DWORD *count) { #include "pshpack1.h" - struct gif_extenstion + struct gif_extension { BYTE extension_introducer; BYTE extension_label; @@ -801,8 +801,14 @@ static HRESULT WINAPI GifFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode *iface, IWICMetadataQueryReader **ppIMetadataQueryReader) { + GifFrameDecode *This = impl_from_IWICBitmapFrameDecode(iface); + TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader); - return WINCODEC_ERR_UNSUPPORTEDOPERATION; + + if (!ppIMetadataQueryReader) + return E_INVALIDARG; + + return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader); } static HRESULT WINAPI GifFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface, Modified: trunk/reactos/dll/win32/windowscodecs/guid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/gu…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/guid.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/guid.c [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -16,6 +16,11 @@ DEFINE_GUID(CLSID_WICIcnsEncoder, 0x312fb6f1,0xb767,0x409d,0x8a,0x6d,0x0f,0xc1,0x54,0xd4,0xf0,0x5c); DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47,0x3f,0xc1,0x7c,0xd3,0x22); DEFINE_GUID(GUID_VendorWine, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a); -DEFINE_GUID(IID_IMILBitmapSource,0x7543696a,0xbc8d,0x46b0,0x5f,0x81,0x8d,0x95,0x72,0x89,0x72,0xbe); +DEFINE_GUID(IID_IMILBitmap, 0xb1784d3f,0x8115,0x4763,0x13,0xaa,0x32,0xed,0xdb,0x68,0x29,0x4a); +DEFINE_GUID(IID_IMILBitmapSource, 0x7543696a,0xbc8d,0x46b0,0x5f,0x81,0x8d,0x95,0x72,0x89,0x72,0xbe); +DEFINE_GUID(IID_IMILBitmapLock, 0xa67b2b53,0x8fa1,0x4155,0x8f,0x64,0x0c,0x24,0x7a,0x8f,0x84,0xcd); +DEFINE_GUID(IID_IMILBitmapScaler, 0xa767b0f0,0x1c8c,0x4aef,0x56,0x8f,0xad,0xf9,0x6d,0xcf,0xd5,0xcb); +DEFINE_GUID(IID_IMILFormatConverter, 0x7e2a746f,0x25c5,0x4851,0xb3,0xaf,0x44,0x3b,0x79,0x63,0x9e,0xc0); +DEFINE_GUID(IID_IMILPalette, 0xca8e206f,0xf22c,0x4af7,0x6f,0xba,0x7b,0xed,0x5e,0xb1,0xc9,0x2f); /* NO CODE HERE, THIS IS JUST REQUIRED FOR THE GUID DEFINITIONS */ Modified: trunk/reactos/dll/win32/windowscodecs/imgfactory.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/im…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/imgfactory.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/imgfactory.c [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -579,12 +579,36 @@ UINT width, UINT height, REFWICPixelFormatGUID format, UINT stride, UINT size, BYTE *buffer, IWICBitmap **bitmap) { + HRESULT hr; + TRACE("(%p,%u,%u,%s,%u,%u,%p,%p\n", iface, width, height, debugstr_guid(format), stride, size, buffer, bitmap); if (!stride || !size || !buffer || !bitmap) return E_INVALIDARG; - return BitmapImpl_Create(width, height, stride, size, buffer, format, WICBitmapCacheOnLoad, bitmap); + hr = BitmapImpl_Create(width, height, stride, size, NULL, format, WICBitmapCacheOnLoad, bitmap); + if (SUCCEEDED(hr)) + { + IWICBitmapLock *lock; + + hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock); + if (SUCCEEDED(hr)) + { + UINT buffersize; + BYTE *data; + + IWICBitmapLock_GetDataPointer(lock, &buffersize, &data); + memcpy(data, buffer, buffersize); + + IWICBitmapLock_Release(lock); + } + else + { + IWICBitmap_Release(*bitmap); + *bitmap = NULL; + } + } + return hr; } static BOOL get_16bpp_format(HBITMAP hbm, WICPixelFormatGUID *format) @@ -1080,8 +1104,12 @@ static HRESULT WINAPI ComponentFactory_CreateQueryReaderFromBlockReader(IWICComponentFactory *iface, IWICMetadataBlockReader *block_reader, IWICMetadataQueryReader **query_reader) { - FIXME("%p,%p,%p: stub\n", iface, block_reader, query_reader); - return E_NOTIMPL; + TRACE("%p,%p,%p\n", iface, block_reader, query_reader); + + if (!block_reader || !query_reader) + return E_INVALIDARG; + + return MetadataQueryReader_CreateInstance(block_reader, query_reader); } static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromBlockWriter(IWICComponentFactory *iface, @@ -1156,3 +1184,50 @@ return ret; } + +HRESULT WINAPI WICCreateBitmapFromSectionEx(UINT width, UINT height, + REFWICPixelFormatGUID format, HANDLE section, UINT stride, + UINT offset, WICSectionAccessLevel wicaccess, IWICBitmap **bitmap) +{ + DWORD access; + void *buffer; + HRESULT hr; + + TRACE("%u,%u,%s,%p,%u,%#x,%#x,%p\n", width, height, debugstr_guid(format), + section, stride, offset, wicaccess, bitmap); + + if (!width || !height || !section || !bitmap) return E_INVALIDARG; + + switch (wicaccess) + { + case WICSectionAccessLevelReadWrite: + access = FILE_MAP_READ | FILE_MAP_WRITE; + break; + + case WICSectionAccessLevelRead: + access = FILE_MAP_READ; + break; + + default: + FIXME("unsupported access %#x\n", wicaccess); + return E_INVALIDARG; + } + + buffer = MapViewOfFile(section, access, 0, offset, 0); + if (!buffer) return HRESULT_FROM_WIN32(GetLastError()); + + hr = BitmapImpl_Create(width, height, stride, 0, buffer, format, WICBitmapCacheOnLoad, bitmap); + if (FAILED(hr)) UnmapViewOfFile(buffer); + return hr; +} + +HRESULT WINAPI WICCreateBitmapFromSection(UINT width, UINT height, + REFWICPixelFormatGUID format, HANDLE section, + UINT stride, UINT offset, IWICBitmap **bitmap) +{ + TRACE("%u,%u,%s,%p,%u,%u,%p\n", width, height, debugstr_guid(format), + section, stride, offset, bitmap); + + return WICCreateBitmapFromSectionEx(width, height, format, section, + stride, offset, WICSectionAccessLevelRead, bitmap); +} Modified: trunk/reactos/dll/win32/windowscodecs/jpegformat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/jp…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/jpegformat.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/jpegformat.c [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -121,6 +121,7 @@ typedef struct { IWICBitmapDecoder IWICBitmapDecoder_iface; IWICBitmapFrameDecode IWICBitmapFrameDecode_iface; + IWICMetadataBlockReader IWICMetadataBlockReader_iface; LONG ref; BOOL initialized; BOOL cinfo_initialized; @@ -146,6 +147,11 @@ static inline JpegDecoder *decoder_from_decompress(j_decompress_ptr decompress) { return CONTAINING_RECORD(decompress, JpegDecoder, cinfo); +} + +static inline JpegDecoder *impl_from_IWICMetadataBlockReader(IWICMetadataBlockReader *iface) +{ + return CONTAINING_RECORD(iface, JpegDecoder, IWICMetadataBlockReader_iface); } static HRESULT WINAPI JpegDecoder_QueryInterface(IWICBitmapDecoder *iface, REFIID iid, @@ -664,8 +670,14 @@ static HRESULT WINAPI JpegDecoder_Frame_GetMetadataQueryReader(IWICBitmapFrameDecode *iface, IWICMetadataQueryReader **ppIMetadataQueryReader) { - FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader); - return WINCODEC_ERR_UNSUPPORTEDOPERATION; + JpegDecoder *This = impl_from_IWICBitmapFrameDecode(iface); + + TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader); + + if (!ppIMetadataQueryReader) + return E_INVALIDARG; + + return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader); } static HRESULT WINAPI JpegDecoder_Frame_GetColorContexts(IWICBitmapFrameDecode *iface, @@ -696,6 +708,73 @@ JpegDecoder_Frame_GetThumbnail }; +static HRESULT WINAPI JpegDecoder_Block_QueryInterface(IWICMetadataBlockReader *iface, REFIID iid, + void **ppv) +{ + JpegDecoder *This = impl_from_IWICMetadataBlockReader(iface); + return IWICBitmapFrameDecode_QueryInterface(&This->IWICBitmapFrameDecode_iface, iid, ppv); +} + +static ULONG WINAPI JpegDecoder_Block_AddRef(IWICMetadataBlockReader *iface) +{ + JpegDecoder *This = impl_from_IWICMetadataBlockReader(iface); + return IWICBitmapDecoder_AddRef(&This->IWICBitmapDecoder_iface); +} + +static ULONG WINAPI JpegDecoder_Block_Release(IWICMetadataBlockReader *iface) +{ + JpegDecoder *This = impl_from_IWICMetadataBlockReader(iface); + return IWICBitmapDecoder_Release(&This->IWICBitmapDecoder_iface); +} + +static HRESULT WINAPI JpegDecoder_Block_GetContainerFormat(IWICMetadataBlockReader *iface, + GUID *pguidContainerFormat) +{ + TRACE("%p,%p\n", iface, pguidContainerFormat); + + if (!pguidContainerFormat) return E_INVALIDARG; + + memcpy(pguidContainerFormat, &GUID_ContainerFormatJpeg, sizeof(GUID)); + + return S_OK; +} + +static HRESULT WINAPI JpegDecoder_Block_GetCount(IWICMetadataBlockReader *iface, + UINT *pcCount) +{ + FIXME("%p,%p\n", iface, pcCount); + + if (!pcCount) return E_INVALIDARG; + + *pcCount = 0; + + return S_OK; +} + +static HRESULT WINAPI JpegDecoder_Block_GetReaderByIndex(IWICMetadataBlockReader *iface, + UINT nIndex, IWICMetadataReader **ppIMetadataReader) +{ + FIXME("%p,%d,%p\n", iface, nIndex, ppIMetadataReader); + return E_INVALIDARG; +} + +static HRESULT WINAPI JpegDecoder_Block_GetEnumerator(IWICMetadataBlockReader *iface, + IEnumUnknown **ppIEnumMetadata) +{ + FIXME("%p,%p\n", iface, ppIEnumMetadata); + return E_NOTIMPL; +} + +static const IWICMetadataBlockReaderVtbl JpegDecoder_Block_Vtbl = { + JpegDecoder_Block_QueryInterface, + JpegDecoder_Block_AddRef, + JpegDecoder_Block_Release, + JpegDecoder_Block_GetContainerFormat, + JpegDecoder_Block_GetCount, + JpegDecoder_Block_GetReaderByIndex, + JpegDecoder_Block_GetEnumerator, +}; + HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv) { JpegDecoder *This; @@ -716,6 +795,7 @@ This->IWICBitmapDecoder_iface.lpVtbl = &JpegDecoder_Vtbl; This->IWICBitmapFrameDecode_iface.lpVtbl = &JpegDecoder_Frame_Vtbl; + This->IWICMetadataBlockReader_iface.lpVtbl = &JpegDecoder_Block_Vtbl; This->ref = 1; This->initialized = FALSE; This->cinfo_initialized = FALSE; Added: trunk/reactos/dll/win32/windowscodecs/metadataquery.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/me…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/metadataquery.c (added) +++ trunk/reactos/dll/win32/windowscodecs/metadataquery.c [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -0,0 +1,136 @@ +/* + * Copyright 2016 Andrew Eikum for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "wincodecs_private.h" + +typedef struct { + IWICMetadataQueryReader IWICMetadataQueryReader_iface; + + LONG ref; + + IWICMetadataBlockReader *block; +} QueryReader; + +static inline QueryReader *impl_from_IWICMetadataQueryReader(IWICMetadataQueryReader *iface) +{ + return CONTAINING_RECORD(iface, QueryReader, IWICMetadataQueryReader_iface); +} + +static HRESULT WINAPI mqr_QueryInterface(IWICMetadataQueryReader *iface, REFIID riid, + void **ppvObject) +{ + QueryReader *This = impl_from_IWICMetadataQueryReader(iface); + + TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppvObject); + + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IWICMetadataQueryReader)) + *ppvObject = &This->IWICMetadataQueryReader_iface; + else + *ppvObject = NULL; + + if (*ppvObject) + { + IUnknown_AddRef((IUnknown*)*ppvObject); + return S_OK; + } + + return E_NOINTERFACE; +} + +static ULONG WINAPI mqr_AddRef(IWICMetadataQueryReader *iface) +{ + QueryReader *This = impl_from_IWICMetadataQueryReader(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p) refcount=%u\n", This, ref); + return ref; +} + +static ULONG WINAPI mqr_Release(IWICMetadataQueryReader *iface) +{ + QueryReader *This = impl_from_IWICMetadataQueryReader(iface); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p) refcount=%u\n", This, ref); + if (!ref) + { + IWICMetadataBlockReader_Release(This->block); + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +static HRESULT WINAPI mqr_GetContainerFormat(IWICMetadataQueryReader *iface, + GUID *pguidContainerFormat) +{ + QueryReader *This = impl_from_IWICMetadataQueryReader(iface); + FIXME("(%p,%p)\n", This, pguidContainerFormat); + return E_NOTIMPL; +} + +static HRESULT WINAPI mqr_GetLocation(IWICMetadataQueryReader *iface, + UINT cchMaxLength, WCHAR *wzNamespace, UINT *pcchActualLength) +{ + QueryReader *This = impl_from_IWICMetadataQueryReader(iface); + FIXME("(%p,%u,%p,%p)\n", This, cchMaxLength, wzNamespace, pcchActualLength); + return E_NOTIMPL; +} + +static HRESULT WINAPI mqr_GetMetadataByName(IWICMetadataQueryReader *iface, + LPCWSTR wzName, PROPVARIANT *pvarValue) +{ + QueryReader *This = impl_from_IWICMetadataQueryReader(iface); + FIXME("(%p,%s,%p)\n", This, wine_dbgstr_w(wzName), pvarValue); + return E_NOTIMPL; +} + +static HRESULT WINAPI mqr_GetEnumerator(IWICMetadataQueryReader *iface, + IEnumString **ppIEnumString) +{ + QueryReader *This = impl_from_IWICMetadataQueryReader(iface); + FIXME("(%p,%p)\n", This, ppIEnumString); + return E_NOTIMPL; +} + +static IWICMetadataQueryReaderVtbl mqr_vtbl = { + mqr_QueryInterface, + mqr_AddRef, + mqr_Release, + mqr_GetContainerFormat, + mqr_GetLocation, + mqr_GetMetadataByName, + mqr_GetEnumerator +}; + +HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, IWICMetadataQueryReader **out) +{ + QueryReader *obj; + + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj)); + if (!obj) + return E_OUTOFMEMORY; + + obj->IWICMetadataQueryReader_iface.lpVtbl = &mqr_vtbl; + obj->ref = 1; + + IWICMetadataBlockReader_AddRef(mbr); + obj->block = mbr; + + *out = &obj->IWICMetadataQueryReader_iface; + + return S_OK; +} Propchange: trunk/reactos/dll/win32/windowscodecs/metadataquery.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/dll/win32/windowscodecs/msvc-thiscall.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/ms…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/msvc-thiscall.c (added) +++ trunk/reactos/dll/win32/windowscodecs/msvc-thiscall.c [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -0,0 +1,16 @@ +#include "wincodecs_private.h" + +#define DEFINE_THISCALL_WRAPPER(func,args) \ + typedef struct {int x[args/4];} _tag_##func; \ + void __stdcall func(_tag_##func p1); \ + __declspec(naked) void __stdcall __thiscall_##func(_tag_##func p1) \ + { \ + __asm pop eax \ + __asm push ecx \ + __asm push eax \ + __asm jmp func \ + } + +DEFINE_THISCALL_WRAPPER(IMILUnknown1Impl_unknown1, 8) +DEFINE_THISCALL_WRAPPER(IMILUnknown1Impl_unknown3, 8) +DEFINE_THISCALL_WRAPPER(IMILUnknown1Impl_unknown8, 4) Propchange: trunk/reactos/dll/win32/windowscodecs/msvc-thiscall.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/dll/win32/windowscodecs/msvc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/ms…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/msvc.h (added) +++ trunk/reactos/dll/win32/windowscodecs/msvc.h [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -0,0 +1,18 @@ + +#define __ASM_STDCALL_FUNC(name,args,code) + +#define typeof(X_) __typeof_ ## X_ + +struct IMILUnknown1; + +#define WINAPI __stdcall +#define HRESULT int +#define IMILUnknown1 struct IMILUnknown1 + +typedef void (WINAPI typeof(IMILUnknown1Impl_unknown1))(IMILUnknown1 *iface, void *arg); +typedef HRESULT (WINAPI typeof(IMILUnknown1Impl_unknown3))(IMILUnknown1 *iface, void *arg); +typedef HRESULT (WINAPI typeof(IMILUnknown1Impl_unknown8))(IMILUnknown1 *iface); + +#undef WINAPI +#undef HRESULT +#undef IMILUnknown1 Propchange: trunk/reactos/dll/win32/windowscodecs/msvc.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/windowscodecs/pngformat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/pn…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/pngformat.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/pngformat.c [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -515,7 +515,7 @@ } This->end_info = ppng_create_info_struct(This->png_ptr); - if (!This->info_ptr) + if (!This->end_info) { ppng_destroy_read_struct(&This->png_ptr, &This->info_ptr, NULL); This->png_ptr = NULL; @@ -647,7 +647,7 @@ /* read the image data */ This->width = ppng_get_image_width(This->png_ptr, This->info_ptr); This->height = ppng_get_image_height(This->png_ptr, This->info_ptr); - This->stride = This->width * This->bpp; + This->stride = (This->width * This->bpp + 7) / 8; image_size = This->stride * This->height; This->image_bits = HeapAlloc(GetProcessHeap(), 0, image_size); @@ -1001,8 +1001,14 @@ static HRESULT WINAPI PngDecoder_Frame_GetMetadataQueryReader(IWICBitmapFrameDecode *iface, IWICMetadataQueryReader **ppIMetadataQueryReader) { - FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader); - return E_NOTIMPL; + PngDecoder *This = impl_from_IWICBitmapFrameDecode(iface); + + TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader); + + if (!ppIMetadataQueryReader) + return E_INVALIDARG; + + return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader); } static HRESULT WINAPI PngDecoder_Frame_GetColorContexts(IWICBitmapFrameDecode *iface, Modified: trunk/reactos/dll/win32/windowscodecs/regsvr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/re…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/regsvr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/regsvr.c [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -1435,6 +1435,7 @@ &GUID_WICPixelFormat32bppBGR, &GUID_WICPixelFormat32bppBGRA, &GUID_WICPixelFormat32bppPBGRA, + &GUID_WICPixelFormat32bppGrayFloat, &GUID_WICPixelFormat48bppRGB, &GUID_WICPixelFormat64bppRGBA, &GUID_WICPixelFormat32bppCMYK, Modified: trunk/reactos/dll/win32/windowscodecs/scaler.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/sc…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/scaler.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/scaler.c [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -21,6 +21,7 @@ typedef struct BitmapScaler { IWICBitmapScaler IWICBitmapScaler_iface; LONG ref; + IMILBitmapScaler IMILBitmapScaler_iface; IWICBitmapSource *source; UINT width, height; UINT src_width, src_height; @@ -36,6 +37,11 @@ return CONTAINING_RECORD(iface, BitmapScaler, IWICBitmapScaler_iface); } +static inline BitmapScaler *impl_from_IMILBitmapScaler(IMILBitmapScaler *iface) +{ + return CONTAINING_RECORD(iface, BitmapScaler, IMILBitmapScaler_iface); +} + static HRESULT WINAPI BitmapScaler_QueryInterface(IWICBitmapScaler *iface, REFIID iid, void **ppv) { @@ -50,8 +56,13 @@ { *ppv = &This->IWICBitmapScaler_iface; } + else if (IsEqualIID(&IID_IMILBitmapScaler, iid)) + { + *ppv = &This->IMILBitmapScaler_iface; + } else { + FIXME("unknown interface %s\n", debugstr_guid(iid)); *ppv = NULL; return E_NOINTERFACE; } @@ -360,6 +371,163 @@ BitmapScaler_Initialize }; +static HRESULT WINAPI IMILBitmapScaler_QueryInterface(IMILBitmapScaler *iface, REFIID iid, + void **ppv) +{ + BitmapScaler *This = impl_from_IMILBitmapScaler(iface); + + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_IMILBitmapScaler, iid) || + IsEqualIID(&IID_IMILBitmapSource, iid)) + { + IUnknown_AddRef(&This->IMILBitmapScaler_iface); + *ppv = &This->IMILBitmapScaler_iface; + return S_OK; + } + else if (IsEqualIID(&IID_IWICBitmapScaler, iid) || + IsEqualIID(&IID_IWICBitmapSource, iid)) + { + IUnknown_AddRef(&This->IWICBitmapScaler_iface); + *ppv = &This->IWICBitmapScaler_iface; + return S_OK; + } + + FIXME("unknown interface %s\n", debugstr_guid(iid)); + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI IMILBitmapScaler_AddRef(IMILBitmapScaler *iface) +{ + BitmapScaler *This = impl_from_IMILBitmapScaler(iface); + return IWICBitmapScaler_AddRef(&This->IWICBitmapScaler_iface); +} + +static ULONG WINAPI IMILBitmapScaler_Release(IMILBitmapScaler *iface) +{ + BitmapScaler *This = impl_from_IMILBitmapScaler(iface); + return IWICBitmapScaler_Release(&This->IWICBitmapScaler_iface); +} + +static HRESULT WINAPI IMILBitmapScaler_GetSize(IMILBitmapScaler *iface, + UINT *width, UINT *height) +{ + BitmapScaler *This = impl_from_IMILBitmapScaler(iface); + + TRACE("(%p,%p,%p)\n", iface, width, height); + + if (!This->source) + return WINCODEC_ERR_NOTINITIALIZED; + + return IWICBitmapScaler_GetSize(&This->IWICBitmapScaler_iface, width, height); +} + +static HRESULT WINAPI IMILBitmapScaler_GetPixelFormat(IMILBitmapScaler *iface, + int *format) +{ + BitmapScaler *This = impl_from_IMILBitmapScaler(iface); + IMILBitmapSource *source; + HRESULT hr; + + TRACE("(%p,%p)\n", iface, format); + + if (!format) return E_INVALIDARG; + + if (!This->source) + return WINCODEC_ERR_NOTINITIALIZED; + + hr = IWICBitmapSource_QueryInterface(This->source, &IID_IMILBitmapSource, (void **)&source); + if (hr == S_OK) + { + hr = source->lpVtbl->GetPixelFormat(source, format); + source->lpVtbl->Release(source); + } + return hr; +} + +static HRESULT WINAPI IMILBitmapScaler_GetResolution(IMILBitmapScaler *iface, + double *dpix, double *dpiy) +{ + BitmapScaler *This = impl_from_IMILBitmapScaler(iface); + + TRACE("(%p,%p,%p)\n", iface, dpix, dpiy); + + if (!This->source) + return WINCODEC_ERR_NOTINITIALIZED; + + return IWICBitmapScaler_GetResolution(&This->IWICBitmapScaler_iface, dpix, dpiy); +} + +static HRESULT WINAPI IMILBitmapScaler_CopyPalette(IMILBitmapScaler *iface, + IWICPalette *palette) +{ + BitmapScaler *This = impl_from_IMILBitmapScaler(iface); + + TRACE("(%p,%p)\n", iface, palette); + + if (!This->source) + return WINCODEC_ERR_NOTINITIALIZED; + + return IWICBitmapScaler_CopyPalette(&This->IWICBitmapScaler_iface, palette); +} + +static HRESULT WINAPI IMILBitmapScaler_CopyPixels(IMILBitmapScaler *iface, + const WICRect *rc, UINT stride, UINT size, BYTE *buffer) +{ + BitmapScaler *This = impl_from_IMILBitmapScaler(iface); + + TRACE("(%p,%p,%u,%u,%p)\n", iface, rc, stride, size, buffer); + + if (!This->source) + return WINCODEC_ERR_NOTINITIALIZED; + + return IWICBitmapScaler_CopyPixels(&This->IWICBitmapScaler_iface, rc, stride, size, buffer); +} + +static HRESULT WINAPI IMILBitmapScaler_unknown1(IMILBitmapScaler *iface, void **ppv) +{ + TRACE("(%p,%p)\n", iface, ppv); + return E_NOINTERFACE; +} + +static HRESULT WINAPI IMILBitmapScaler_Initialize(IMILBitmapScaler *iface, + IMILBitmapSource *mil_source, UINT width, UINT height, + WICBitmapInterpolationMode mode) +{ + BitmapScaler *This = impl_from_IMILBitmapScaler(iface); + IWICBitmapSource *wic_source; + HRESULT hr; + + TRACE("(%p,%p,%u,%u,%u)\n", iface, mil_source, width, height, mode); + + if (!mil_source) return E_INVALIDARG; + + hr = mil_source->lpVtbl->QueryInterface(mil_source, &IID_IWICBitmapSource, (void **)&wic_source); + if (hr == S_OK) + { + hr = IWICBitmapScaler_Initialize(&This->IWICBitmapScaler_iface, wic_source, width, height, mode); + IWICBitmapSource_Release(wic_source); + } + return hr; +} + +static const IMILBitmapScalerVtbl IMILBitmapScaler_Vtbl = { + IMILBitmapScaler_QueryInterface, + IMILBitmapScaler_AddRef, + IMILBitmapScaler_Release, + IMILBitmapScaler_GetSize, + IMILBitmapScaler_GetPixelFormat, + IMILBitmapScaler_GetResolution, + IMILBitmapScaler_CopyPalette, + IMILBitmapScaler_CopyPixels, + IMILBitmapScaler_unknown1, + IMILBitmapScaler_Initialize +}; + HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler) { BitmapScaler *This; @@ -368,6 +536,7 @@ if (!This) return E_OUTOFMEMORY; This->IWICBitmapScaler_iface.lpVtbl = &BitmapScaler_Vtbl; + This->IMILBitmapScaler_iface.lpVtbl = &IMILBitmapScaler_Vtbl; This->ref = 1; This->source = NULL; This->width = 0; Modified: trunk/reactos/dll/win32/windowscodecs/tiffformat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/ti…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/tiffformat.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/tiffformat.c [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -1150,8 +1150,14 @@ static HRESULT WINAPI TiffFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode *iface, IWICMetadataQueryReader **ppIMetadataQueryReader) { - FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader); - return E_NOTIMPL; + TiffFrameDecode *This = impl_from_IWICBitmapFrameDecode(iface); + + TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader); + + if (!ppIMetadataQueryReader) + return E_INVALIDARG; + + return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader); } static HRESULT WINAPI TiffFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface, Modified: trunk/reactos/dll/win32/windowscodecs/wincodecs_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/wi…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/wincodecs_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/wincodecs_private.h [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -38,6 +38,7 @@ #include <winreg.h> #include <objbase.h> #include <oleauto.h> +#include <wincodec.h> #include <wincodecsdk.h> #include <wine/debug.h> @@ -54,7 +55,13 @@ DEFINE_GUID(GUID_VendorWine, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a); +DEFINE_GUID(IID_IMILBitmap,0xb1784d3f,0x8115,0x4763,0x13,0xaa,0x32,0xed,0xdb,0x68,0x29,0x4a); DEFINE_GUID(IID_IMILBitmapSource,0x7543696a,0xbc8d,0x46b0,0x5f,0x81,0x8d,0x95,0x72,0x89,0x72,0xbe); +DEFINE_GUID(IID_IMILBitmapLock,0xa67b2b53,0x8fa1,0x4155,0x8f,0x64,0x0c,0x24,0x7a,0x8f,0x84,0xcd); +DEFINE_GUID(IID_IMILBitmapScaler,0xa767b0f0,0x1c8c,0x4aef,0x56,0x8f,0xad,0xf9,0x6d,0xcf,0xd5,0xcb); +DEFINE_GUID(IID_IMILFormatConverter,0x7e2a746f,0x25c5,0x4851,0xb3,0xaf,0x44,0x3b,0x79,0x63,0x9e,0xc0); +DEFINE_GUID(IID_IMILPalette,0xca8e206f,0xf22c,0x4af7,0x6f,0xba,0x7b,0xed,0x5e,0xb1,0xc9,0x2f); + #define INTERFACE IMILBitmapSource DECLARE_INTERFACE_(IMILBitmapSource,IUnknown) { @@ -62,15 +69,57 @@ STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IWICBitmapSource methods ***/ + STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *) PURE; + STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *) PURE; + STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE; + STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE; + STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE; /*** IMILBitmapSource methods ***/ - STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *); - STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *); - STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *); - STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *); - STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *); - STDMETHOD_(HRESULT,UnknownMethod1)(THIS_ void **); -}; -#undef INTERFACE + STDMETHOD_(HRESULT,unknown1)(THIS_ void **) PURE; + STDMETHOD_(HRESULT,Lock)(THIS_ const WICRect *,DWORD,IWICBitmapLock **) PURE; + STDMETHOD_(HRESULT,Unlock)(THIS_ IWICBitmapLock *) PURE; + STDMETHOD_(HRESULT,SetPalette)(THIS_ IWICPalette *) PURE; + STDMETHOD_(HRESULT,SetResolution)(THIS_ double,double) PURE; + STDMETHOD_(HRESULT,AddDirtyRect)(THIS_ const WICRect *) PURE; +}; +#undef INTERFACE + +#define INTERFACE IMILBitmapScaler +DECLARE_INTERFACE_(IMILBitmapScaler,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IWICBitmapSource methods ***/ + STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *) PURE; + STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *) PURE; + STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE; + STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE; + STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE; + /*** IMILBitmapScaler methods ***/ + STDMETHOD_(HRESULT,unknown1)(THIS_ void **) PURE; + STDMETHOD_(HRESULT,Initialize)(THIS_ IMILBitmapSource *,UINT,UINT,WICBitmapInterpolationMode); +}; +#undef INTERFACE + +#ifdef __i386__ /* thiscall functions are i386-specific */ + +#define THISCALL(func) __thiscall_ ## func +#define DEFINE_THISCALL_WRAPPER(func,args) \ + extern typeof(func) THISCALL(func); \ + __ASM_STDCALL_FUNC(__thiscall_ ## func, args, \ + "popl %eax\n\t" \ + "pushl %ecx\n\t" \ + "pushl %eax\n\t" \ + "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) ) +#else /* __i386__ */ + +#define THISCALL(func) func +#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */ + +#endif /* __i386__ */ #define INTERFACE IMILUnknown1 DECLARE_INTERFACE_(IMILUnknown1,IUnknown) @@ -79,6 +128,19 @@ STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** thiscall method ***/ + STDMETHOD_(void,unknown1)(THIS_ void*) PURE; + /*** stdcall ***/ + STDMETHOD_(HRESULT,unknown2)(THIS_ void*, void*) PURE; + /*** thiscall method ***/ + STDMETHOD_(HRESULT,unknown3)(THIS_ void*) PURE; + /*** stdcall ***/ + STDMETHOD_(HRESULT,unknown4)(THIS_ void*) PURE; + STDMETHOD_(HRESULT,unknown5)(THIS_ void*) PURE; + STDMETHOD_(HRESULT,unknown6)(THIS_ DWORD64) PURE; + STDMETHOD_(HRESULT,unknown7)(THIS_ void*) PURE; + /*** thiscall method ***/ + STDMETHOD_(HRESULT,unknown8)(THIS) PURE; }; #undef INTERFACE @@ -90,7 +152,9 @@ STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** unknown methods ***/ - STDMETHOD_(HRESULT,UnknownMethod1)(THIS_ void *, void *) PURE; + STDMETHOD_(HRESULT,unknown1)(THIS_ void *,void **) PURE; + STDMETHOD_(HRESULT,unknown2)(THIS_ void *,void *) PURE; + STDMETHOD_(HRESULT,unknown3)(THIS_ void *) PURE; }; #undef INTERFACE @@ -186,6 +250,8 @@ extern HRESULT APEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; extern HRESULT GifCommentReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, IWICMetadataQueryReader **out) DECLSPEC_HIDDEN; + extern HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE hfile) DECLSPEC_HIDDEN; #endif /* WINCODECS_PRIVATE_H */ Modified: trunk/reactos/dll/win32/windowscodecs/windowscodecs.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/wi…
============================================================================== --- trunk/reactos/dll/win32/windowscodecs/windowscodecs.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/windowscodecs/windowscodecs.spec [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -105,7 +105,8 @@ @ stdcall IWICStream_InitializeFromIStream_Proxy(ptr ptr) IWICStream_InitializeFromIStream_Proxy_W @ stdcall IWICStream_InitializeFromMemory_Proxy(ptr ptr long) IWICStream_InitializeFromMemory_Proxy_W @ stdcall WICConvertBitmapSource(ptr ptr ptr) -@ stub WICCreateBitmapFromSection +@ stdcall WICCreateBitmapFromSection(long long ptr long long long ptr) +@ stdcall WICCreateBitmapFromSectionEx(long long ptr long long long long ptr) @ stdcall WICCreateColorContext_Proxy(ptr ptr) @ stdcall WICCreateImagingFactory_Proxy(long ptr) @ stub WICGetMetadataContentSize Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Jul 2 15:28:24 2016 @@ -200,7 +200,7 @@ reactos/dll/win32/vssapi # Synced to WineStaging-1.9.4 reactos/dll/win32/wbemdisp # Synced to WineStaging-1.9.4 reactos/dll/win32/wbemprox # Synced to WineStaging-1.9.11 -reactos/dll/win32/windowscodecs # Synced to WineStaging-1.9.4 +reactos/dll/win32/windowscodecs # Synced to WineStaging-1.9.11 reactos/dll/win32/windowscodecsext # Synced to WineStaging-1.9.4 reactos/dll/win32/winemp3.acm # Synced to WineStaging-1.9.4 reactos/dll/win32/wing32 # Synced to WineStaging-1.9.4
8 years, 5 months
1
0
0
0
[akhaldi] 71753: [DEVENUM] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Jul 2 15:24:22 2016 New Revision: 71753 URL:
http://svn.reactos.org/svn/reactos?rev=71753&view=rev
Log: [DEVENUM] Sync with Wine Staging 1.9.11. CORE-11368 Modified: trunk/reactos/dll/directx/wine/devenum/devenum_main.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/directx/wine/devenum/devenum_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/devenum/d…
============================================================================== --- trunk/reactos/dll/directx/wine/devenum/devenum_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/devenum/devenum_main.c [iso-8859-1] Sat Jul 2 15:24:22 2016 @@ -97,6 +97,8 @@ TRACE("\n"); res = __wine_register_resources( DEVENUM_hInstance ); + if (FAILED(res)) + return res; #ifdef __REACTOS__ /* Quartz is needed for IFilterMapper2 */ Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Jul 2 15:24:22 2016 @@ -29,7 +29,7 @@ reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-1.9.4 reactos/dll/directx/wine/d3dxof # Synced to WineStaging-1.9.4 reactos/dll/directx/wine/ddraw # Synced to WineStaging-1.9.4 -reactos/dll/directx/wine/devenum # Synced to WineStaging-1.9.4 +reactos/dll/directx/wine/devenum # Synced to WineStaging-1.9.11 reactos/dll/directx/wine/dinput # Synced to WineStaging-1.9.4 reactos/dll/directx/wine/dinput8 # Synced to WineStaging-1.9.4 reactos/dll/directx/wine/dmusic # Synced to WineStaging-1.9.4
8 years, 5 months
1
0
0
0
[akhaldi] 71752: [WININET_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Jul 2 15:23:55 2016 New Revision: 71752 URL:
http://svn.reactos.org/svn/reactos?rev=71752&view=rev
Log: [WININET_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368 Modified: trunk/rostests/winetests/wininet/http.c trunk/rostests/winetests/wininet/internet.c trunk/rostests/winetests/wininet/url.c Modified: trunk/rostests/winetests/wininet/http.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wininet/http.c?…
============================================================================== --- trunk/rostests/winetests/wininet/http.c [iso-8859-1] (original) +++ trunk/rostests/winetests/wininet/http.c [iso-8859-1] Sat Jul 2 15:23:55 2016 @@ -114,7 +114,7 @@ wine_allow[MAX_INTERNET_STATUS], notified[MAX_INTERNET_STATUS]; static const char *status_string[MAX_INTERNET_STATUS]; -static HANDLE hCompleteEvent, conn_close_event; +static HANDLE hCompleteEvent, conn_close_event, conn_wait_event, server_req_rec_event; static DWORD req_error; #define TESTF_REDIRECT 0x01 @@ -447,6 +447,51 @@ } } +typedef struct { + HINTERNET session; + HINTERNET connection; + HINTERNET request; +} test_request_t; + +#define open_simple_request(a,b,c,d,e) _open_simple_request(__LINE__,a,b,c,d,e) +static void _open_simple_request(unsigned line, test_request_t *req, const char *host, + int port, const char *verb, const char *url) +{ + req->session = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); + ok_(__FILE__,line)(req->session != NULL, "InternetOpenA failed: %u\n", GetLastError()); + + req->connection = InternetConnectA(req->session, host, port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); + ok_(__FILE__,line)(req->connection != NULL, "InternetConnectA failed: %u\n", GetLastError()); + + req->request = HttpOpenRequestA(req->connection, verb, url, NULL, NULL, NULL, 0, 0); + ok_(__FILE__,line)(req->request != NULL, "HttpOpenRequest failed: %u\n", GetLastError()); +} + +#define close_request(a) _close_request(__LINE__,a) +static void _close_request(unsigned line, test_request_t *req) +{ + BOOL ret; + + ret = InternetCloseHandle(req->request); + ok_(__FILE__,line)(ret, "InternetCloseHandle(request) failed: %u\n", GetLastError()); + ret = InternetCloseHandle(req->connection); + ok_(__FILE__,line)(ret, "InternetCloseHandle(connection) failed: %u\n", GetLastError()); + ret = InternetCloseHandle(req->session); + ok_(__FILE__,line)(ret, "InternetCloseHandle(session) failed: %u\n", GetLastError()); +} + +#define receive_simple_request(a,b,c) _receive_simple_request(__LINE__,a,b,c) +static DWORD _receive_simple_request(unsigned line, HINTERNET req, char *buf, size_t buf_size) +{ + DWORD read = 0; + BOOL ret; + + ret = InternetReadFile(req, buf, buf_size, &read); + ok_(__FILE__,line)(ret, "InternetReadFile failed: %u\n", GetLastError()); + + return read; +} + static void close_async_handle(HINTERNET handle, HANDLE complete_event, int handle_cnt) { BOOL res; @@ -525,7 +570,7 @@ length = sizeof(buffer); res = HttpQueryInfoA(hor, HTTP_QUERY_RAW_HEADERS, buffer, &length, 0x0); ok(res, "HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError()); - ok(length == 0, "HTTP_QUERY_RAW_HEADERS: expected length 0, but got %d\n", length); + ok(length == 0 || (length == 1 && !*buffer) /* win10 */, "HTTP_QUERY_RAW_HEADERS: expected length 0, but got %d\n", length); ok(!strcmp(buffer, ""), "HTTP_QUERY_RAW_HEADERS: expected string \"\", but got \"%s\"\n", buffer); CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED); @@ -1039,6 +1084,11 @@ CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER); CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER); + rc = InternetReadFileExW(hor, NULL, 0, 0xdeadcafe); + ok(!rc && (GetLastError() == ERROR_INVALID_PARAMETER), + "InternetReadFileEx should have failed with ERROR_INVALID_PARAMETER instead of %s, %u\n", + rc ? "TRUE" : "FALSE", GetLastError()); + /* tests invalid dwStructSize */ inetbuffers.dwStructSize = sizeof(inetbuffers)+1; inetbuffers.lpcszHeader = NULL; @@ -1104,7 +1154,7 @@ CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE); WaitForSingleObject(hCompleteEvent, INFINITE); CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE); - CHECK_NOT_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED); + CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED); ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error); } else @@ -1557,55 +1607,36 @@ static void InternetLockRequestFile_test(void) { - HINTERNET session, connect, request; char file_name[MAX_PATH]; + test_request_t req; HANDLE lock, lock2; DWORD size; BOOL ret; - static const char *types[] = { "*", "", NULL }; - - session = InternetOpenA("Wine Regression Test", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); - ok(session != NULL ,"Unable to open Internet session\n"); - - connect = InternetConnectA(session, "
test.winehq.org
", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, - INTERNET_SERVICE_HTTP, 0, 0); - ok(connect != NULL, "Unable to connect to
http://test.winehq.org
with error %d\n", GetLastError()); - - request = HttpOpenRequestA(connect, NULL, "/tests/hello.html", NULL, NULL, types, INTERNET_FLAG_NEED_FILE|INTERNET_FLAG_RELOAD, 0); - if (!request && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED) - { - skip( "Network unreachable, skipping test\n" ); - - ok(InternetCloseHandle(connect), "Close connect handle failed\n"); - ok(InternetCloseHandle(session), "Close session handle failed\n"); - - return; - } - ok(request != NULL, "Failed to open request handle err %u\n", GetLastError()); + open_simple_request(&req, "
test.winehq.org
", INTERNET_DEFAULT_HTTP_PORT, NULL, "/tests/hello.html"); size = sizeof(file_name); - ret = InternetQueryOptionA(request, INTERNET_OPTION_DATAFILE_NAME, file_name, &size); + ret = InternetQueryOptionA(req.request, INTERNET_OPTION_DATAFILE_NAME, file_name, &size); ok(!ret, "InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) succeeded\n"); ok(GetLastError() == ERROR_INTERNET_ITEM_NOT_FOUND, "GetLastError()=%u\n", GetLastError()); ok(!size, "size = %d\n", size); lock = NULL; - ret = InternetLockRequestFile(request, &lock); + ret = InternetLockRequestFile(req.request, &lock); ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError()); - ret = HttpSendRequestA(request, NULL, 0, NULL, 0); + ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed: %u\n", GetLastError()); size = sizeof(file_name); - ret = InternetQueryOptionA(request, INTERNET_OPTION_DATAFILE_NAME, file_name, &size); + ret = InternetQueryOptionA(req.request, INTERNET_OPTION_DATAFILE_NAME, file_name, &size); ok(ret, "InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) failed: %u\n", GetLastError()); - ret = InternetLockRequestFile(request, &lock); + ret = InternetLockRequestFile(req.request, &lock); ok(ret, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError()); ok(lock != NULL, "lock == NULL\n"); - ret = InternetLockRequestFile(request, &lock2); + ret = InternetLockRequestFile(req.request, &lock2); ok(ret, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError()); ok(lock == lock2, "lock != lock2\n"); @@ -1615,7 +1646,7 @@ ret = DeleteFileA(file_name); ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%u)\n", ret, GetLastError()); - ok(InternetCloseHandle(request), "Close request handle failed\n"); + ok(InternetCloseHandle(req.request), "Close request handle failed\n"); ret = DeleteFileA(file_name); ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%u)\n", ret, GetLastError()); @@ -1764,8 +1795,8 @@ memset(buffer, 'x', sizeof(buffer)); ok(HttpQueryInfoA(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF, buffer,&len,&index) == TRUE,"Query failed\n"); - ok(len == 2, "Expected 2, got %d\n", len); - ok(strcmp(buffer, "\r\n") == 0, "Expected CRLF, got '%s'\n", buffer); + ok(len == 2 || len == 4 /* win10 */, "Expected 2 or 4, got %d\n", len); + ok(memcmp(buffer, "\r\n\r\n", len) == 0, "Expected CRLF, got '%s'\n", buffer); ok(index == 0, "Index was incremented\n"); ok(HttpAddRequestHeadersA(hRequest,"Warning:test2",-1,HTTP_ADDREQ_FLAG_ADD), @@ -1967,8 +1998,7 @@ static const char expandcontmsg[] = "HTTP/1.1 100 Continue\r\n" "Server: winecontinue\r\n" -"Tag: something witty\r\n" -"\r\n"; +"Tag: something witty\r\n"; static const char okmsg[] = "HTTP/1.1 200 OK\r\n" @@ -2050,6 +2080,7 @@ static int test_cache_gzip; static const char *send_buffer; +static int server_socket; static DWORD CALLBACK server_thread(LPVOID param) { @@ -2057,12 +2088,12 @@ int r, c = -1, i, on, count = 0; SOCKET s; struct sockaddr_in sa; - char buffer[0x100]; + char *buffer; + size_t buffer_size; WSADATA wsaData; int last_request = 0; char host_header[22]; char host_header_override[30]; - static BOOL test_b = FALSE; static int test_no_cache = 0; WSAStartup(MAKEWORD(1,1), &wsaData); @@ -2089,16 +2120,20 @@ sprintf(host_header, "Host: localhost:%d", si->port); sprintf(host_header_override, "Host: test.local:%d\r\n", si->port); + buffer = HeapAlloc(GetProcessHeap(), 0, buffer_size = 1000); do { if(c == -1) c = accept(s, NULL, NULL); - memset(buffer, 0, sizeof buffer); - for(i=0; i<(sizeof buffer-1); i++) + memset(buffer, 0, buffer_size); + for(i=0;; i++) { - r = recv(c, &buffer[i], 1, 0); + if(i == buffer_size) + buffer = HeapReAlloc(GetProcessHeap(), 0, buffer, buffer_size *= 2); + + r = recv(c, buffer+i, 1, 0); if (r != 1) break; if (i<4) continue; @@ -2171,7 +2206,7 @@ if (strstr(buffer, "Content-Length: 100")) { if (strstr(buffer, "POST /test7b")) - recvfrom(c, buffer, sizeof buffer, 0, NULL, NULL); + recvfrom(c, buffer, buffer_size, 0, NULL, NULL); send(c, okmsg, sizeof okmsg-1, 0); send(c, page1, sizeof page1-1, 0); } @@ -2211,13 +2246,6 @@ else send(c, notokmsg, sizeof notokmsg-1, 0); } - if (!test_b && strstr(buffer, "/testB HTTP/1.1")) - { - test_b = TRUE; - send(c, okmsg, sizeof okmsg-1, 0); - recvfrom(c, buffer, sizeof buffer, 0, NULL, NULL); - send(c, okmsg, sizeof okmsg-1, 0); - } if (strstr(buffer, "/testC")) { if (strstr(buffer, "cookie=biscuit")) @@ -2269,7 +2297,7 @@ if (strstr(buffer, "GET /testH")) { send(c, ok_with_length2, sizeof(ok_with_length2)-1, 0); - recvfrom(c, buffer, sizeof(buffer), 0, NULL, NULL); + recvfrom(c, buffer, buffer_size, 0, NULL, NULL); send(c, ok_with_length, sizeof(ok_with_length)-1, 0); } @@ -2351,13 +2379,6 @@ } if (strstr(buffer, "GET /test_premature_disconnect")) trace("closing connection\n"); - if (strstr(buffer, "/test_accept_encoding_http10")) - { - if (strstr(buffer, "Accept-Encoding: gzip")) - send(c, okmsg, sizeof okmsg-1, 0); - else - send(c, notokmsg, sizeof notokmsg-1, 0); - } if (strstr(buffer, "HEAD /upload.txt")) { if (strstr(buffer, "Authorization: Basic dXNlcjpwd2Q=")) @@ -2424,6 +2445,26 @@ else send(c, notokmsg, sizeof notokmsg-1, 0); } + if (strstr(buffer, "/async_read")) + { + const char *page1_mid = page1 + (sizeof page1 - 1)/2; + const char *page1_end = page1 + sizeof page1 - 1; + send(c, okmsg, sizeof okmsg-1, 0); + send(c, page1, page1_mid - page1, 0); + WaitForSingleObject(conn_wait_event, INFINITE); + send(c, page1_mid, page1_end - page1_mid, 0); + } + if (strstr(buffer, "/socket")) + { + server_socket = c; + SetEvent(server_req_rec_event); + WaitForSingleObject(conn_wait_event, INFINITE); + } + if (strstr(buffer, "/echo_request")) + { + send(c, okmsg, sizeof(okmsg)-1, 0); + send(c, buffer, strlen(buffer), 0); + } if (strstr(buffer, "HEAD /test_auth_host1")) { if (strstr(buffer, "Authorization: Basic dGVzdDE6cGFzcw==")) @@ -2444,64 +2485,51 @@ } while (!last_request); closesocket(s); + HeapFree(GetProcessHeap(), 0, buffer); return 0; } static void test_basic_request(int port, const char *verb, const char *url) { - HINTERNET hi, hc, hr; + test_request_t req; DWORD r, count, error; char buffer[0x100]; - hi = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(hi != NULL, "open failed\n"); - - hc = InternetConnectA(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(hc != NULL, "connect failed\n"); - - hr = HttpOpenRequestA(hc, verb, url, NULL, NULL, NULL, 0, 0); - ok(hr != NULL, "HttpOpenRequest failed\n"); + trace("basic request %s %s\n", verb, url); + + open_simple_request(&req, "localhost", port, verb, url); SetLastError(0xdeadbeef); - r = HttpSendRequestA(hr, NULL, 0, NULL, 0); + r = HttpSendRequestA(req.request, NULL, 0, NULL, 0); error = GetLastError(); ok(error == ERROR_SUCCESS || broken(error != ERROR_SUCCESS), "expected ERROR_SUCCESS, got %u\n", error); - ok(r, "HttpSendRequest failed\n"); + ok(r, "HttpSendRequest failed: %u\n", GetLastError()); count = 0; memset(buffer, 0, sizeof buffer); SetLastError(0xdeadbeef); - r = InternetReadFile(hr, buffer, sizeof buffer, &count); + r = InternetReadFile(req.request, buffer, sizeof buffer, &count); ok(r, "InternetReadFile failed %u\n", GetLastError()); ok(count == sizeof page1 - 1, "count was wrong\n"); ok(!memcmp(buffer, page1, sizeof page1), "http data wrong, got: %s\n", buffer); - InternetCloseHandle(hr); - InternetCloseHandle(hc); - InternetCloseHandle(hi); + close_request(&req); } static void test_proxy_indirect(int port) { - HINTERNET hi, hc, hr; + test_request_t req; DWORD r, sz; char buffer[0x40]; - hi = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(hi != NULL, "open failed\n"); - - hc = InternetConnectA(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(hc != NULL, "connect failed\n"); - - hr = HttpOpenRequestA(hc, NULL, "/test2", NULL, NULL, NULL, 0, 0); - ok(hr != NULL, "HttpOpenRequest failed\n"); - - r = HttpSendRequestA(hr, NULL, 0, NULL, 0); + open_simple_request(&req, "localhost", port, NULL, "/test2"); + + r = HttpSendRequestA(req.request, NULL, 0, NULL, 0); ok(r, "HttpSendRequest failed %u\n", GetLastError()); sz = sizeof buffer; - r = HttpQueryInfoA(hr, HTTP_QUERY_PROXY_AUTHENTICATE, buffer, &sz, NULL); + r = HttpQueryInfoA(req.request, HTTP_QUERY_PROXY_AUTHENTICATE, buffer, &sz, NULL); ok(r || GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "HttpQueryInfo failed: %d\n", GetLastError()); if (!r) { @@ -2510,33 +2538,31 @@ } ok(!strcmp(buffer, "Basic realm=\"placebo\""), "proxy auth info wrong\n"); - test_status_code(hr, 407); - test_request_flags(hr, 0); + test_status_code(req.request, 407); + test_request_flags(req.request, 0); sz = sizeof buffer; - r = HttpQueryInfoA(hr, HTTP_QUERY_STATUS_TEXT, buffer, &sz, NULL); + r = HttpQueryInfoA(req.request, HTTP_QUERY_STATUS_TEXT, buffer, &sz, NULL); ok(r, "HttpQueryInfo failed\n"); ok(!strcmp(buffer, "Proxy Authentication Required"), "proxy text wrong\n"); sz = sizeof buffer; - r = HttpQueryInfoA(hr, HTTP_QUERY_VERSION, buffer, &sz, NULL); + r = HttpQueryInfoA(req.request, HTTP_QUERY_VERSION, buffer, &sz, NULL); ok(r, "HttpQueryInfo failed\n"); ok(!strcmp(buffer, "HTTP/1.1"), "http version wrong\n"); sz = sizeof buffer; - r = HttpQueryInfoA(hr, HTTP_QUERY_SERVER, buffer, &sz, NULL); + r = HttpQueryInfoA(req.request, HTTP_QUERY_SERVER, buffer, &sz, NULL); ok(r, "HttpQueryInfo failed\n"); ok(!strcmp(buffer, "winetest"), "http server wrong\n"); sz = sizeof buffer; - r = HttpQueryInfoA(hr, HTTP_QUERY_CONTENT_ENCODING, buffer, &sz, NULL); + r = HttpQueryInfoA(req.request, HTTP_QUERY_CONTENT_ENCODING, buffer, &sz, NULL); ok(GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "HttpQueryInfo should fail\n"); ok(r == FALSE, "HttpQueryInfo failed\n"); out: - InternetCloseHandle(hr); - InternetCloseHandle(hc); - InternetCloseHandle(hi); + close_request(&req); } static void test_proxy_direct(int port) @@ -3137,14 +3163,24 @@ ok(req != NULL, "HttpOpenRequest failed\n"); ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_REPLACE); - err = GetLastError(); - ok(!ret, "HttpAddRequestHeaders succeeded\n"); - ok(err == ERROR_HTTP_HEADER_NOT_FOUND, "Expected error ERROR_HTTP_HEADER_NOT_FOUND, got %d\n", err); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - ok(ret, "HttpSendRequest failed\n"); - - test_status_code(req, 400); + if(ret) { /* win10 returns success */ + trace("replacing host header is supported.\n"); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + + test_status_code(req, 200); + }else { + trace("replacing host header is not supported.\n"); + + err = GetLastError(); + ok(err == ERROR_HTTP_HEADER_NOT_FOUND, "Expected error ERROR_HTTP_HEADER_NOT_FOUND, got %d\n", err); + + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + + test_status_code(req, 400); + } InternetCloseHandle(req); InternetSetCookieA("
http://localhost
", "cookie", "biscuit"); @@ -3291,37 +3327,6 @@ ok(ret, "HttpSendRequestA failed %u\n", GetLastError()); test_status_code(req, 200); - - InternetCloseHandle(req); - InternetCloseHandle(con); - InternetCloseHandle(ses); -} - -static void test_http1_1(int port) -{ - HINTERNET ses, con, req; - BOOL ret; - - ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(ses != NULL, "InternetOpen failed\n"); - - con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(con != NULL, "InternetConnect failed\n"); - - req = HttpOpenRequestA(con, NULL, "/testB", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); - ok(req != NULL, "HttpOpenRequest failed\n"); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - if (ret) - { - InternetCloseHandle(req); - - req = HttpOpenRequestA(con, NULL, "/testB", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); - ok(req != NULL, "HttpOpenRequest failed\n"); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - ok(ret, "HttpSendRequest failed\n"); - } InternetCloseHandle(req); InternetCloseHandle(con); @@ -4041,278 +4046,225 @@ static void test_premature_disconnect(int port) { - HINTERNET session, connect, request; + test_request_t req; DWORD err; BOOL ret; - session = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(session != NULL, "InternetOpen failed\n"); - - connect = InternetConnectA(session, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(connect != NULL, "InternetConnect failed\n"); - - request = HttpOpenRequestA(connect, NULL, "/premature_disconnect", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); - ok(request != NULL, "HttpOpenRequest failed\n"); + open_simple_request(&req, "localhost", port, NULL, "/premature_disconnect"); SetLastError(0xdeadbeef); - ret = HttpSendRequestA(request, NULL, 0, NULL, 0); + ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0); err = GetLastError(); todo_wine ok(!ret, "HttpSendRequest succeeded\n"); todo_wine ok(err == ERROR_HTTP_INVALID_SERVER_RESPONSE, "got %u\n", err); - InternetCloseHandle(request); - InternetCloseHandle(connect); - InternetCloseHandle(session); + close_request(&req); } static void test_invalid_response_headers(int port) { - HINTERNET session, connect, request; + test_request_t req; DWORD size; BOOL ret; char buffer[256]; - session = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(session != NULL, "InternetOpen failed\n"); - - connect = InternetConnectA(session, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(connect != NULL, "InternetConnect failed\n"); - - request = HttpOpenRequestA(connect, NULL, "/testE", NULL, NULL, NULL, 0, 0); - ok(request != NULL, "HttpOpenRequest failed\n"); - - ret = HttpSendRequestA(request, NULL, 0, NULL, 0); + open_simple_request(&req, "localhost", port, NULL, "/testE"); + + ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed %u\n", GetLastError()); - test_status_code(request, 401); - test_request_flags(request, 0); + test_status_code(req.request, 401); + test_request_flags(req.request, 0); buffer[0] = 0; size = sizeof(buffer); - ret = HttpQueryInfoA( request, HTTP_QUERY_RAW_HEADERS, buffer, &size, NULL); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_RAW_HEADERS, buffer, &size, NULL); ok(ret, "HttpQueryInfo failed\n"); ok(!strcmp(buffer, "HTTP/1.0 401 Anonymous requests or requests on unsecure channel are not allowed"), "headers wrong \"%s\"\n", buffer); buffer[0] = 0; size = sizeof(buffer); - ret = HttpQueryInfoA( request, HTTP_QUERY_SERVER, buffer, &size, NULL); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_SERVER, buffer, &size, NULL); ok(ret, "HttpQueryInfo failed\n"); ok(!strcmp(buffer, "winetest"), "server wrong \"%s\"\n", buffer); - InternetCloseHandle(request); - InternetCloseHandle(connect); - InternetCloseHandle(session); + close_request(&req); } static void test_response_without_headers(int port) { - HINTERNET hi, hc, hr; + test_request_t req; DWORD r, count, size; char buffer[1024]; - SetLastError(0xdeadbeef); - hi = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(hi != NULL, "open failed %u\n", GetLastError()); - - SetLastError(0xdeadbeef); - hc = InternetConnectA(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(hc != NULL, "connect failed %u\n", GetLastError()); - - SetLastError(0xdeadbeef); - hr = HttpOpenRequestA(hc, NULL, "/testG", NULL, NULL, NULL, 0, 0); - ok(hr != NULL, "HttpOpenRequest failed %u\n", GetLastError()); - - test_request_flags(hr, INTERNET_REQFLAG_NO_HEADERS); - - SetLastError(0xdeadbeef); - r = HttpSendRequestA(hr, NULL, 0, NULL, 0); + open_simple_request(&req, "localhost", port, NULL, "/testG"); + + test_request_flags(req.request, INTERNET_REQFLAG_NO_HEADERS); + + r = HttpSendRequestA(req.request, NULL, 0, NULL, 0); ok(r, "HttpSendRequest failed %u\n", GetLastError()); - test_request_flags_todo(hr, INTERNET_REQFLAG_NO_HEADERS); + test_request_flags_todo(req.request, INTERNET_REQFLAG_NO_HEADERS); count = 0; memset(buffer, 0, sizeof buffer); - SetLastError(0xdeadbeef); - r = InternetReadFile(hr, buffer, sizeof buffer, &count); + r = InternetReadFile(req.request, buffer, sizeof buffer, &count); ok(r, "InternetReadFile failed %u\n", GetLastError()); todo_wine ok(count == sizeof page1 - 1, "count was wrong\n"); todo_wine ok(!memcmp(buffer, page1, sizeof page1), "http data wrong\n"); - test_status_code(hr, 200); - test_request_flags_todo(hr, INTERNET_REQFLAG_NO_HEADERS); + test_status_code(req.request, 200); + test_request_flags_todo(req.request, INTERNET_REQFLAG_NO_HEADERS); buffer[0] = 0; size = sizeof(buffer); - SetLastError(0xdeadbeef); - r = HttpQueryInfoA(hr, HTTP_QUERY_STATUS_TEXT, buffer, &size, NULL ); + r = HttpQueryInfoA(req.request, HTTP_QUERY_STATUS_TEXT, buffer, &size, NULL ); ok(r, "HttpQueryInfo failed %u\n", GetLastError()); ok(!strcmp(buffer, "OK"), "expected OK got: \"%s\"\n", buffer); buffer[0] = 0; size = sizeof(buffer); - SetLastError(0xdeadbeef); - r = HttpQueryInfoA(hr, HTTP_QUERY_VERSION, buffer, &size, NULL); + r = HttpQueryInfoA(req.request, HTTP_QUERY_VERSION, buffer, &size, NULL); ok(r, "HttpQueryInfo failed %u\n", GetLastError()); ok(!strcmp(buffer, "HTTP/1.0"), "expected HTTP/1.0 got: \"%s\"\n", buffer); buffer[0] = 0; size = sizeof(buffer); - SetLastError(0xdeadbeef); - r = HttpQueryInfoA(hr, HTTP_QUERY_RAW_HEADERS, buffer, &size, NULL); + r = HttpQueryInfoA(req.request, HTTP_QUERY_RAW_HEADERS, buffer, &size, NULL); ok(r, "HttpQueryInfo failed %u\n", GetLastError()); ok(!strcmp(buffer, "HTTP/1.0 200 OK"), "raw headers wrong: \"%s\"\n", buffer); - InternetCloseHandle(hr); - InternetCloseHandle(hc); - InternetCloseHandle(hi); + close_request(&req); } static void test_head_request(int port) { DWORD len, content_length; - HINTERNET ses, con, req; + test_request_t req; BYTE buf[100]; BOOL ret; - ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(ses != NULL, "InternetOpen failed\n"); - - con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(con != NULL, "InternetConnect failed\n"); - - req = HttpOpenRequestA(con, "HEAD", "/test_head", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); - ok(req != NULL, "HttpOpenRequest failed\n"); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + open_simple_request(&req, "localhost", port, "HEAD", "/test_head"); + + ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed: %u\n", GetLastError()); len = sizeof(content_length); content_length = -1; - ret = HttpQueryInfoA(req, HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_CONTENT_LENGTH, &content_length, &len, 0); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_CONTENT_LENGTH, &content_length, &len, 0); ok(ret, "HttpQueryInfo dailed: %u\n", GetLastError()); ok(len == sizeof(DWORD), "len = %u\n", len); ok(content_length == 100, "content_length = %u\n", content_length); len = -1; - ret = InternetReadFile(req, buf, sizeof(buf), &len); + ret = InternetReadFile(req.request, buf, sizeof(buf), &len); ok(ret, "InternetReadFile failed: %u\n", GetLastError()); len = -1; - ret = InternetReadFile(req, buf, sizeof(buf), &len); + ret = InternetReadFile(req.request, buf, sizeof(buf), &len); ok(ret, "InternetReadFile failed: %u\n", GetLastError()); - InternetCloseHandle(req); - InternetCloseHandle(con); - InternetCloseHandle(ses); + close_request(&req); } static void test_HttpQueryInfo(int port) { - HINTERNET hi, hc, hr; + test_request_t req; DWORD size, index, error; char buffer[1024]; BOOL ret; - hi = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(hi != NULL, "InternetOpen failed\n"); - - hc = InternetConnectA(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(hc != NULL, "InternetConnect failed\n"); - - hr = HttpOpenRequestA(hc, NULL, "/testD", NULL, NULL, NULL, 0, 0); - ok(hr != NULL, "HttpOpenRequest failed\n"); + open_simple_request(&req, "localhost", port, NULL, "/testD"); size = sizeof(buffer); - ret = HttpQueryInfoA(hr, HTTP_QUERY_STATUS_TEXT, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_STATUS_TEXT, buffer, &size, &index); error = GetLastError(); ok(!ret || broken(ret), "HttpQueryInfo succeeded\n"); if (!ret) ok(error == ERROR_HTTP_HEADER_NOT_FOUND, "got %u expected ERROR_HTTP_HEADER_NOT_FOUND\n", error); - ret = HttpSendRequestA(hr, NULL, 0, NULL, 0); + ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed\n"); index = 0; size = sizeof(buffer); - ret = HttpQueryInfoA(hr, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, &index); ok(ret, "HttpQueryInfo failed %u\n", GetLastError()); ok(index == 1, "expected 1 got %u\n", index); index = 0; size = sizeof(buffer); - ret = HttpQueryInfoA(hr, HTTP_QUERY_DATE | HTTP_QUERY_FLAG_SYSTEMTIME, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_DATE | HTTP_QUERY_FLAG_SYSTEMTIME, buffer, &size, &index); ok(ret, "HttpQueryInfo failed %u\n", GetLastError()); ok(index == 1, "expected 1 got %u\n", index); index = 0; size = sizeof(buffer); - ret = HttpQueryInfoA(hr, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index); ok(ret, "HttpQueryInfo failed %u\n", GetLastError()); ok(index == 0, "expected 0 got %u\n", index); size = sizeof(buffer); - ret = HttpQueryInfoA(hr, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index); ok(ret, "HttpQueryInfo failed %u\n", GetLastError()); ok(index == 0, "expected 0 got %u\n", index); index = 0xdeadbeef; /* invalid start index */ size = sizeof(buffer); - ret = HttpQueryInfoA(hr, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index); todo_wine ok(!ret, "HttpQueryInfo should have failed\n"); todo_wine ok(GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "Expected ERROR_HTTP_HEADER_NOT_FOUND, got %u\n", GetLastError()); index = 0; size = sizeof(buffer); - ret = HttpQueryInfoA(hr, HTTP_QUERY_RAW_HEADERS_CRLF, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_RAW_HEADERS_CRLF, buffer, &size, &index); ok(ret, "HttpQueryInfo failed %u\n", GetLastError()); ok(index == 0, "expected 0 got %u\n", index); size = sizeof(buffer); - ret = HttpQueryInfoA(hr, HTTP_QUERY_STATUS_TEXT, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_STATUS_TEXT, buffer, &size, &index); ok(ret, "HttpQueryInfo failed %u\n", GetLastError()); ok(index == 0, "expected 0 got %u\n", index); size = sizeof(buffer); - ret = HttpQueryInfoA(hr, HTTP_QUERY_VERSION, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_VERSION, buffer, &size, &index); ok(ret, "HttpQueryInfo failed %u\n", GetLastError()); ok(index == 0, "expected 0 got %u\n", index); - test_status_code(hr, 200); + test_status_code(req.request, 200); index = 0xdeadbeef; size = sizeof(buffer); - ret = HttpQueryInfoA(hr, HTTP_QUERY_FORWARDED, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_FORWARDED, buffer, &size, &index); ok(!ret, "HttpQueryInfo succeeded\n"); ok(index == 0xdeadbeef, "expected 0xdeadbeef got %u\n", index); index = 0; size = sizeof(buffer); - ret = HttpQueryInfoA(hr, HTTP_QUERY_SERVER, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_SERVER, buffer, &size, &index); ok(ret, "HttpQueryInfo failed %u\n", GetLastError()); ok(index == 1, "expected 1 got %u\n", index); index = 0; size = sizeof(buffer); strcpy(buffer, "Server"); - ret = HttpQueryInfoA(hr, HTTP_QUERY_CUSTOM, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_CUSTOM, buffer, &size, &index); ok(ret, "HttpQueryInfo failed %u\n", GetLastError()); ok(index == 1, "expected 1 got %u\n", index); index = 0; size = sizeof(buffer); - ret = HttpQueryInfoA(hr, HTTP_QUERY_SET_COOKIE, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_SET_COOKIE, buffer, &size, &index); ok(ret, "HttpQueryInfo failed %u\n", GetLastError()); ok(index == 1, "expected 1 got %u\n", index); size = sizeof(buffer); - ret = HttpQueryInfoA(hr, HTTP_QUERY_SET_COOKIE, buffer, &size, &index); + ret = HttpQueryInfoA(req.request, HTTP_QUERY_SET_COOKIE, buffer, &size, &index); ok(ret, "HttpQueryInfo failed %u\n", GetLastError()); ok(index == 2, "expected 2 got %u\n", index); - InternetCloseHandle(hr); - InternetCloseHandle(hc); - InternetCloseHandle(hi); + close_request(&req); } static void test_options(int port) @@ -4495,7 +4447,7 @@ static void test_http_status(int port) { - HINTERNET ses, con, req; + test_request_t req; char buf[1000]; DWORD i, size; BOOL res; @@ -4503,29 +4455,20 @@ for(i=0; i < sizeof(http_status_tests)/sizeof(*http_status_tests); i++) { send_buffer = http_status_tests[i].response_text; - ses = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(ses != NULL, "InternetOpen failed\n"); - - con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(con != NULL, "InternetConnect failed\n"); - - req = HttpOpenRequestA(con, NULL, "/send_from_buffer", NULL, NULL, NULL, 0, 0); - ok(req != NULL, "HttpOpenRequest failed\n"); - - res = HttpSendRequestA(req, NULL, 0, NULL, 0); + open_simple_request(&req, "localhost", port, NULL, "/send_from_buffer"); + + res = HttpSendRequestA(req.request, NULL, 0, NULL, 0); ok(res, "HttpSendRequest failed\n"); - test_status_code(req, http_status_tests[i].status_code); + test_status_code(req.request, http_status_tests[i].status_code); size = sizeof(buf); - res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_TEXT, buf, &size, NULL); + res = HttpQueryInfoA(req.request, HTTP_QUERY_STATUS_TEXT, buf, &size, NULL); ok(res, "HttpQueryInfo failed: %u\n", GetLastError()); ok(!strcmp(buf, http_status_tests[i].status_text), "[%u] Unexpected status text \"%s\", expected \"%s\"\n", i, buf, http_status_tests[i].status_text); - InternetCloseHandle(req); - InternetCloseHandle(con); - InternetCloseHandle(ses); + close_request(&req); } } @@ -4579,10 +4522,34 @@ static void test_request_content_length(int port) { char data[] = {'t','e','s','t'}; + test_request_t req; + BOOL ret; + + hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL); + + open_simple_request(&req, "localhost", port, "POST", "/test_request_content_length"); + + ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed %u\n", GetLastError()); + test_status_code(req.request, 200); + + SetEvent(hCompleteEvent); + + ret = HttpSendRequestA(req.request, NULL, 0, data, sizeof(data)); + ok(ret, "HttpSendRequest failed %u\n", GetLastError()); + test_status_code(req.request, 200); + + SetEvent(hCompleteEvent); + + close_request(&req); + CloseHandle(hCompleteEvent); +} + +static void test_accept_encoding(int port) +{ HINTERNET ses, con, req; + char buf[1000]; BOOL ret; - - hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL); ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); ok(ses != NULL, "InternetOpen failed\n"); @@ -4590,42 +4557,7 @@ con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); ok(con != NULL, "InternetConnect failed\n"); - /* On XP there is a weird bug that the following tests fail if certain cookies - * are set. We workaround this problem by passing INTERNET_FLAG_NO_COOKIES as flag. */ - req = HttpOpenRequestA(con, "POST", "/test_request_content_length", NULL, NULL, NULL, - INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_NO_COOKIES, 0); - ok(req != NULL, "HttpOpenRequest failed\n"); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - ok(ret, "HttpSendRequest failed %u\n", GetLastError()); - test_status_code(req, 200); - - SetEvent(hCompleteEvent); - - ret = HttpSendRequestA(req, NULL, 0, data, sizeof(data)); - ok(ret, "HttpSendRequest failed %u\n", GetLastError()); - test_status_code(req, 200); - - SetEvent(hCompleteEvent); - - InternetCloseHandle(req); - InternetCloseHandle(con); - InternetCloseHandle(ses); - CloseHandle(hCompleteEvent); -} - -static void test_accept_encoding(int port) -{ - HINTERNET ses, con, req; - BOOL ret; - - ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(ses != NULL, "InternetOpen failed\n"); - - con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(con != NULL, "InternetConnect failed\n"); - - req = HttpOpenRequestA(con, "GET", "/test_accept_encoding_http10", "HTTP/1.0", NULL, NULL, 0, 0); + req = HttpOpenRequestA(con, "GET", "/echo_request", "HTTP/1.0", NULL, NULL, 0, 0); ok(req != NULL, "HttpOpenRequest failed\n"); ret = HttpAddRequestHeadersA(req, "Accept-Encoding: gzip\r\n", ~0u, HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD); @@ -4635,16 +4567,20 @@ ok(ret, "HttpSendRequestA failed\n"); test_status_code(req, 200); + receive_simple_request(req, buf, sizeof(buf)); + ok(strstr(buf, "Accept-Encoding: gzip") != NULL, "Accept-Encoding header not found in %s\n", buf); InternetCloseHandle(req); - req = HttpOpenRequestA(con, "GET", "/test_accept_encoding_http10", "HTTP/1.0", NULL, NULL, 0, 0); + req = HttpOpenRequestA(con, "GET", "/echo_request", "HTTP/1.0", NULL, NULL, 0, 0); ok(req != NULL, "HttpOpenRequest failed\n"); ret = HttpSendRequestA(req, "Accept-Encoding: gzip", ~0u, NULL, 0); ok(ret, "HttpSendRequestA failed\n"); test_status_code(req, 200); + receive_simple_request(req, buf, sizeof(buf)); + ok(strstr(buf, "Accept-Encoding: gzip") != NULL, "Accept-Encoding header not found in %s\n", buf); InternetCloseHandle(req); InternetCloseHandle(con); @@ -4702,6 +4638,396 @@ InternetCloseHandle( req ); InternetCloseHandle( con ); InternetCloseHandle( ses ); +} + +static void test_async_read(int port) +{ + HINTERNET ses, con, req; + INTERNET_BUFFERSA ib; + char buffer[0x100]; + DWORD pending_reads; + DWORD res, count, bytes; + BOOL ret; + + hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL); + conn_wait_event = CreateEventW(NULL, FALSE, FALSE, NULL); + + /* test asynchronous InternetReadFileEx */ + ses = InternetOpenA( "winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC ); + ok( ses != NULL, "InternetOpenA failed\n" ); + pInternetSetStatusCallbackA( ses, &callback ); + + SET_EXPECT( INTERNET_STATUS_HANDLE_CREATED ); + con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0xdeadbeef ); + ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() ); + CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED ); + + SET_EXPECT( INTERNET_STATUS_HANDLE_CREATED ); + req = HttpOpenRequestA( con, "GET", "/async_read", NULL, NULL, NULL, INTERNET_FLAG_RELOAD, 0xdeadbeef ); + ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() ); + CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED ); + + SET_OPTIONAL( INTERNET_STATUS_COOKIE_SENT ); + SET_OPTIONAL( INTERNET_STATUS_DETECTING_PROXY ); + SET_EXPECT( INTERNET_STATUS_CONNECTING_TO_SERVER ); + SET_EXPECT( INTERNET_STATUS_CONNECTED_TO_SERVER ); + SET_EXPECT( INTERNET_STATUS_SENDING_REQUEST ); + SET_EXPECT( INTERNET_STATUS_REQUEST_SENT ); + SET_EXPECT( INTERNET_STATUS_RECEIVING_RESPONSE ); + SET_EXPECT( INTERNET_STATUS_RESPONSE_RECEIVED ); + SET_OPTIONAL( INTERNET_STATUS_CLOSING_CONNECTION ); + SET_OPTIONAL( INTERNET_STATUS_CONNECTION_CLOSED ); + SET_EXPECT( INTERNET_STATUS_REQUEST_COMPLETE ); + + SetLastError( 0xdeadbeef ); + ret = HttpSendRequestA( req, NULL, 0, NULL, 0 ); + ok( !ret, "HttpSendRequestA unexpectedly succeeded\n" ); + ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError() ); + WaitForSingleObject( hCompleteEvent, INFINITE ); + ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error ); + + CLEAR_NOTIFIED( INTERNET_STATUS_COOKIE_SENT ); + CLEAR_NOTIFIED( INTERNET_STATUS_DETECTING_PROXY ); + CHECK_NOTIFIED( INTERNET_STATUS_CONNECTING_TO_SERVER ); + CHECK_NOTIFIED( INTERNET_STATUS_CONNECTED_TO_SERVER ); + CHECK_NOTIFIED( INTERNET_STATUS_SENDING_REQUEST ); + CHECK_NOTIFIED( INTERNET_STATUS_REQUEST_SENT ); + CHECK_NOTIFIED( INTERNET_STATUS_RECEIVING_RESPONSE ); + CHECK_NOTIFIED( INTERNET_STATUS_RESPONSE_RECEIVED ); + CLEAR_NOTIFIED( INTERNET_STATUS_CLOSING_CONNECTION ); + CLEAR_NOTIFIED( INTERNET_STATUS_CONNECTION_CLOSED ); + CHECK_NOTIFIED( INTERNET_STATUS_REQUEST_COMPLETE ); + + pending_reads = 0; + memset( &ib, 0, sizeof(ib) ); + memset( buffer, 0, sizeof(buffer) ); + ib.dwStructSize = sizeof(ib); + for (count = 0; count < sizeof(buffer); count += ib.dwBufferLength) + { + ib.lpvBuffer = buffer + count; + ib.dwBufferLength = min(16, sizeof(buffer) - count); + + SET_EXPECT( INTERNET_STATUS_RECEIVING_RESPONSE ); + SET_EXPECT( INTERNET_STATUS_RESPONSE_RECEIVED ); + + ret = InternetReadFileExA( req, &ib, 0, 0xdeadbeef ); + if (!count) /* the first part should arrive immediately */ + ok( ret, "InternetReadFileExA failed %u\n", GetLastError() ); + if (!ret) + { + ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError() ); + CHECK_NOTIFIED( INTERNET_STATUS_RECEIVING_RESPONSE ); + SET_EXPECT( INTERNET_STATUS_REQUEST_COMPLETE ); + if (!pending_reads++) + { + res = WaitForSingleObject( hCompleteEvent, 0 ); + ok( res == WAIT_TIMEOUT, "expected WAIT_TIMEOUT, got %u\n", res ); + SetEvent( conn_wait_event ); + } + res = WaitForSingleObject( hCompleteEvent, INFINITE ); + ok( res == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", res ); + ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error ); + todo_wine_if( pending_reads > 1 ) + ok( ib.dwBufferLength != 0, "expected ib.dwBufferLength != 0\n" ); + CHECK_NOTIFIED( INTERNET_STATUS_RESPONSE_RECEIVED ); + CHECK_NOTIFIED( INTERNET_STATUS_REQUEST_COMPLETE ); + } + + CLEAR_NOTIFIED( INTERNET_STATUS_RECEIVING_RESPONSE ); + CLEAR_NOTIFIED( INTERNET_STATUS_RESPONSE_RECEIVED ); + if (!ib.dwBufferLength) break; + } + + todo_wine + ok( pending_reads == 1, "expected 1 pending read, got %u\n", pending_reads ); + ok( !strcmp(buffer, page1), "unexpected buffer content\n" ); + close_async_handle( ses, hCompleteEvent, 2 ); + ResetEvent( conn_wait_event ); + + /* test asynchronous InternetReadFile */ + ses = InternetOpenA( "winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC ); + ok( ses != NULL, "InternetOpenA failed\n" ); + pInternetSetStatusCallbackA( ses, &callback ); + + SET_EXPECT( INTERNET_STATUS_HANDLE_CREATED ); + con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0xdeadbeef ); + ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() ); + CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED ); + + SET_EXPECT( INTERNET_STATUS_HANDLE_CREATED ); + req = HttpOpenRequestA( con, "GET", "/async_read", NULL, NULL, NULL, INTERNET_FLAG_RELOAD, 0xdeadbeef ); + ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() ); + CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED ); + + SET_OPTIONAL( INTERNET_STATUS_COOKIE_SENT ); + SET_OPTIONAL( INTERNET_STATUS_DETECTING_PROXY ); + SET_EXPECT( INTERNET_STATUS_CONNECTING_TO_SERVER ); + SET_EXPECT( INTERNET_STATUS_CONNECTED_TO_SERVER ); + SET_EXPECT( INTERNET_STATUS_SENDING_REQUEST ); + SET_EXPECT( INTERNET_STATUS_REQUEST_SENT ); + SET_EXPECT( INTERNET_STATUS_RECEIVING_RESPONSE ); + SET_EXPECT( INTERNET_STATUS_RESPONSE_RECEIVED ); + SET_OPTIONAL( INTERNET_STATUS_CLOSING_CONNECTION ); + SET_OPTIONAL( INTERNET_STATUS_CONNECTION_CLOSED ); + SET_EXPECT( INTERNET_STATUS_REQUEST_COMPLETE ); + + SetLastError( 0xdeadbeef ); + ret = HttpSendRequestA( req, NULL, 0, NULL, 0 ); + ok( !ret, "HttpSendRequestA unexpectedly succeeded\n" ); + ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError() ); + WaitForSingleObject( hCompleteEvent, INFINITE ); + ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error ); + + CLEAR_NOTIFIED( INTERNET_STATUS_COOKIE_SENT ); + CLEAR_NOTIFIED( INTERNET_STATUS_DETECTING_PROXY ); + CHECK_NOTIFIED( INTERNET_STATUS_CONNECTING_TO_SERVER ); + CHECK_NOTIFIED( INTERNET_STATUS_CONNECTED_TO_SERVER ); + CHECK_NOTIFIED( INTERNET_STATUS_SENDING_REQUEST ); + CHECK_NOTIFIED( INTERNET_STATUS_REQUEST_SENT ); + CHECK_NOTIFIED( INTERNET_STATUS_RECEIVING_RESPONSE ); + CHECK_NOTIFIED( INTERNET_STATUS_RESPONSE_RECEIVED ); + CLEAR_NOTIFIED( INTERNET_STATUS_CLOSING_CONNECTION ); + CLEAR_NOTIFIED( INTERNET_STATUS_CONNECTION_CLOSED ); + CHECK_NOTIFIED( INTERNET_STATUS_REQUEST_COMPLETE ); + + pending_reads = 0; + memset( buffer, 0, sizeof(buffer) ); + for (count = 0; count < sizeof(buffer); count += bytes) + { + SET_EXPECT( INTERNET_STATUS_RECEIVING_RESPONSE ); + SET_EXPECT( INTERNET_STATUS_RESPONSE_RECEIVED ); + + bytes = 0xdeadbeef; + ret = InternetReadFile( req, buffer + count, min(16, sizeof(buffer) - count), &bytes ); + if (!count) /* the first part should arrive immediately */ + ok( ret, "InternetReadFile failed %u\n", GetLastError() ); + if (!ret) + { + ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError() ); + ok( bytes == 0, "expected 0, got %u\n", bytes ); + todo_wine + CHECK_NOTIFIED( INTERNET_STATUS_RECEIVING_RESPONSE ); + SET_EXPECT( INTERNET_STATUS_REQUEST_COMPLETE ); + if (!pending_reads++) + { + res = WaitForSingleObject( hCompleteEvent, 0 ); + ok( res == WAIT_TIMEOUT, "expected WAIT_TIMEOUT, got %u\n", res ); + SetEvent( conn_wait_event ); + } + res = WaitForSingleObject( hCompleteEvent, INFINITE ); + ok( res == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", res ); + ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error ); + todo_wine_if( pending_reads > 1 ) + ok( bytes != 0, "expected bytes != 0\n" ); + CHECK_NOTIFIED( INTERNET_STATUS_RESPONSE_RECEIVED ); + CHECK_NOTIFIED( INTERNET_STATUS_REQUEST_COMPLETE ); + } + + CLEAR_NOTIFIED( INTERNET_STATUS_RECEIVING_RESPONSE ); + CLEAR_NOTIFIED( INTERNET_STATUS_RESPONSE_RECEIVED ); + if (!bytes) break; + } + + todo_wine + ok( pending_reads == 1, "expected 1 pending read, got %u\n", pending_reads ); + ok( !strcmp(buffer, page1), "unexpected buffer content\n" ); + close_async_handle( ses, hCompleteEvent, 2 ); + + CloseHandle( hCompleteEvent ); + CloseHandle( conn_wait_event ); +} + +static void server_send_string(const char *msg) +{ + send(server_socket, msg, strlen(msg), 0); +} + +static void WINAPI readex_callback(HINTERNET handle, DWORD_PTR context, DWORD status, void *info, DWORD info_size) +{ + switch(status) { + case INTERNET_STATUS_RECEIVING_RESPONSE: + case INTERNET_STATUS_RESPONSE_RECEIVED: + break; + default: + callback(handle, context, status, info, info_size); + } +} + +static void open_read_test_request(int port, test_request_t *req, const char *response) +{ + BOOL ret; + + req->session = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC); + ok(req->session != NULL, "InternetOpenA failed\n"); + pInternetSetStatusCallbackA(req->session, readex_callback); + + SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED); + req->connection = InternetConnectA(req->session, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0xdeadbeef); + ok(req->connection != NULL, "InternetConnectA failed %u\n", GetLastError()); + CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED ); + + SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED); + req->request = HttpOpenRequestA(req->connection, "GET", "/socket", NULL, NULL, NULL, INTERNET_FLAG_RELOAD, 0xdeadbeef); + ok(req->request != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); + CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED ); + + SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT); + SET_OPTIONAL(INTERNET_STATUS_DETECTING_PROXY); + SET_EXPECT(INTERNET_STATUS_CONNECTING_TO_SERVER); + SET_EXPECT(INTERNET_STATUS_CONNECTED_TO_SERVER); + SET_EXPECT(INTERNET_STATUS_SENDING_REQUEST); + SET_EXPECT(INTERNET_STATUS_REQUEST_SENT); + + SetLastError(0xdeadbeef); + ret = HttpSendRequestA(req->request, NULL, 0, NULL, 0); + ok(!ret, "HttpSendRequestA unexpectedly succeeded\n"); + ok(GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError()); + ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error); + + WaitForSingleObject(server_req_rec_event, INFINITE); + + CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT); + CLEAR_NOTIFIED(INTERNET_STATUS_DETECTING_PROXY); + CHECK_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER); + CHECK_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER); + CHECK_NOTIFIED(INTERNET_STATUS_SENDING_REQUEST); + + SET_EXPECT(INTERNET_STATUS_REQUEST_COMPLETE); + + server_send_string(response); + WaitForSingleObject(hCompleteEvent, INFINITE); + + CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_SENT); + CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE); +} + +#define readex_expect_sync_data(a,b,c,d,e) _readex_expect_sync_data(__LINE__,a,b,c,d,e) +static void _readex_expect_sync_data(unsigned line, HINTERNET req, DWORD flags, INTERNET_BUFFERSW *buf, + DWORD buf_size, const char *exdata) +{ + DWORD len = strlen(exdata); + BOOL ret; + + SET_EXPECT(INTERNET_STATUS_REQUEST_COMPLETE); + + memset(buf->lpvBuffer, 0xff, buf_size); + buf->dwBufferLength = buf_size; + ret = InternetReadFileExW(req, buf, flags, 0xdeadbeef); + ok_(__FILE__,line)(ret, "InternetReadFileExW failed: %u\n", GetLastError()); + ok_(__FILE__,line)(buf->dwBufferLength == len, "dwBufferLength = %u, expected %u\n", buf->dwBufferLength, len); + if(len) + ok_(__FILE__,line)(!memcmp(buf->lpvBuffer, exdata, len), "Unexpected data\n"); + + CLEAR_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE); +} + +static void send_response_and_wait(const char *response, BOOL close_connection, INTERNET_BUFFERSW *buf) +{ + DWORD orig_size = buf->dwBufferLength; + + SET_EXPECT(INTERNET_STATUS_REQUEST_COMPLETE); + + if(response) + server_send_string(response); + + if(close_connection) { + char c; + SetEvent(conn_wait_event); + recv(server_socket, &c, 1, 0); + } + + WaitForSingleObject(hCompleteEvent, INFINITE); + + CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE); + + /* If IRF_NO_WAIT is used, buffer is not changed. */ + ok(buf->dwBufferLength == orig_size, "dwBufferLength = %u\n", buf->dwBufferLength); + ok(!*(int*)buf->lpvBuffer, "buffer data changed\n"); +} + +static void readex_expect_async(HINTERNET req, DWORD flags, INTERNET_BUFFERSW *buf, DWORD buf_size) +{ + BOOL ret; + + memset(buf->lpvBuffer, 0, buf_size); + buf->dwBufferLength = buf_size; + ret = InternetReadFileExW(req, buf, flags, 0xdeadbeef); + ok(!ret && GetLastError() == ERROR_IO_PENDING, "InternetReadFileExW returned %x (%u)\n", ret, GetLastError()); + ok(buf->dwBufferLength == buf_size, "dwBufferLength = %u, expected %u\n", buf->dwBufferLength, buf_size); + ok(!*(int*)buf->lpvBuffer, "buffer data changed\n"); +} + +static void test_http_read(int port) +{ + INTERNET_BUFFERSW ib; + test_request_t req; + char buf[4096]; + + hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL); + conn_wait_event = CreateEventW(NULL, FALSE, FALSE, NULL); + server_req_rec_event = CreateEventW(NULL, FALSE, FALSE, NULL); + + trace("Testing InternetReadFileExW with IRF_NO_WAIT flag...\n"); + + open_read_test_request(port, &req, + "HTTP/1.1 200 OK\r\n" + "Server: winetest\r\n" + "\r\n" + "xx"); + + memset(&ib, 0, sizeof(ib)); + ib.dwStructSize = sizeof(ib); + ib.lpvBuffer = buf; + + readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), "xx"); + + readex_expect_async(req.request, IRF_NO_WAIT, &ib, sizeof(buf)); + send_response_and_wait("1234567890", FALSE, &ib); + readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, 5, "12345"); + readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), "67890"); + + readex_expect_async(req.request, IRF_NO_WAIT, &ib, sizeof(buf)); + send_response_and_wait("12345", TRUE, &ib); + + readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), "12345"); + readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), ""); + + close_async_handle(req.session, hCompleteEvent, 2); + + CloseHandle(hCompleteEvent); + CloseHandle(conn_wait_event); + CloseHandle(server_req_rec_event); +} + +static void test_long_url(int port) +{ + char long_path[INTERNET_MAX_PATH_LENGTH*2] = "/echo_request?"; + char buf[sizeof(long_path)*2], url[sizeof(buf)]; + test_request_t req; + DWORD size, len; + BOOL ret; + + memset(long_path+strlen(long_path), 'x', sizeof(long_path)-strlen(long_path)); + long_path[sizeof(long_path)-1] = 0; + open_simple_request(&req, "localhost", port, NULL, long_path); + + ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed: %u\n", GetLastError()); + test_status_code(req.request, 200); + + receive_simple_request(req.request, buf, sizeof(buf)); + ok(strstr(buf, long_path) != NULL, "long pathnot found in %s\n", buf); + + sprintf(url, "
http://localhost:%u%s
", port, long_path); + + size = sizeof(buf); + ret = InternetQueryOptionA(req.request, INTERNET_OPTION_URL, buf, &size); + ok(ret, "InternetQueryOptionA(INTERNET_OPTION_URL) failed: %u\n", GetLastError()); + len = strlen(url); + ok(size == len, "size = %u, expected %u\n", size, len); + ok(!strcmp(buf, url), "Wrong URL %s, expected %s\n", buf, url); + + close_request(&req); } static void test_http_connection(void) @@ -4732,7 +5058,6 @@ test_basic_request(si.port, "GET", "/testF"); test_connection_header(si.port); test_header_override(si.port); - test_http1_1(si.port); test_cookie_header(si.port); test_basic_authentication(si.port); test_invalid_response_headers(si.port); @@ -4753,6 +5078,9 @@ test_request_content_length(si.port); test_accept_encoding(si.port); test_basic_auth_credentials_reuse(si.port); + test_async_read(si.port); + test_http_read(si.port); + test_long_url(si.port); /* send the basic request again to shutdown the server thread */ test_basic_request(si.port, "GET", "/quit"); @@ -4777,14 +5105,11 @@ } cert_struct_test_t; static const cert_struct_test_t test_winehq_org_cert = { - "GT98380011\r\n" - "See
www.rapidssl.com/resources/cps
(c)14\r\n" - "Domain Control Validated - RapidSSL(R)\r\n" "*.winehq.org", "US\r\n" "GeoTrust Inc.\r\n" - "RapidSSL SHA256 CA - G3" + "RapidSSL SHA256 CA" }; static const cert_struct_test_t test_winehq_com_cert = { @@ -5990,34 +6315,26 @@ static void test_connection_failure(void) { - HINTERNET session, connect, request; + test_request_t req; DWORD error; BOOL ret; - session = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(session != NULL, "failed to get session handle\n"); - - connect = InternetConnectA(session, "localhost", 1, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(connect != NULL, "failed to get connection handle\n"); - - request = HttpOpenRequestA(connect, NULL, "/", NULL, NULL, NULL, 0, 0); - ok(request != NULL, "failed to get request handle\n"); + open_simple_request(&req, "localhost", 1, NULL, "/"); SetLastError(0xdeadbeef); - ret = HttpSendRequestA(request, NULL, 0, NULL, 0); + ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0); error = GetLastError(); ok(!ret, "unexpected success\n"); ok(error == ERROR_INTERNET_CANNOT_CONNECT, "wrong error %u\n", error); - InternetCloseHandle(request); - InternetCloseHandle(connect); - InternetCloseHandle(session); + close_request(&req); } static void test_default_service_port(void) { HINTERNET session, connect, request; - DWORD error; + DWORD size, error; + char buffer[128]; BOOL ret; session = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); @@ -6036,6 +6353,50 @@ ok(!ret, "HttpSendRequest succeeded\n"); ok(error == ERROR_INTERNET_SECURITY_CHANNEL_ERROR || error == ERROR_INTERNET_CANNOT_CONNECT, "got %u\n", error); + + size = sizeof(buffer); + memset(buffer, 0, sizeof(buffer)); + ret = HttpQueryInfoA(request, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL); + ok(ret, "HttpQueryInfo failed with error %u\n", GetLastError()); + ok(!strcmp(buffer, "test.winehq.org:80"), "Expected test.winehg.org:80, got '%s'\n", buffer); + + InternetCloseHandle(request); + InternetCloseHandle(connect); + + connect = InternetConnectA(session, "
test.winehq.org
", INTERNET_INVALID_PORT_NUMBER, NULL, NULL, + INTERNET_SERVICE_HTTP, INTERNET_FLAG_SECURE, 0); + ok(connect != NULL, "InternetConnect failed\n"); + + request = HttpOpenRequestA(connect, NULL, "/", NULL, NULL, NULL, INTERNET_FLAG_SECURE, 0); + ok(request != NULL, "HttpOpenRequest failed\n"); + + ret = HttpSendRequestA(request, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed with error %u\n", GetLastError()); + + size = sizeof(buffer); + memset(buffer, 0, sizeof(buffer)); + ret = HttpQueryInfoA(request, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL); + ok(ret, "HttpQueryInfo failed with error %u\n", GetLastError()); + ok(!strcmp(buffer, "
test.winehq.org
"), "Expected
test.winehg.org
, got '%s'\n", buffer); + + InternetCloseHandle(request); + InternetCloseHandle(connect); + + connect = InternetConnectA(session, "
test.winehq.org
", INTERNET_INVALID_PORT_NUMBER, NULL, NULL, + INTERNET_SERVICE_HTTP, INTERNET_FLAG_SECURE, 0); + ok(connect != NULL, "InternetConnect failed\n"); + + request = HttpOpenRequestA(connect, NULL, "/", NULL, NULL, NULL, 0, 0); + ok(request != NULL, "HttpOpenRequest failed\n"); + + ret = HttpSendRequestA(request, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed with error %u\n", GetLastError()); + + size = sizeof(buffer); + memset(buffer, 0, sizeof(buffer)); + ret = HttpQueryInfoA(request, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL); + ok(ret, "HttpQueryInfo failed with error %u\n", GetLastError()); + ok(!strcmp(buffer, "test.winehq.org:443"), "Expected test.winehg.org:443, got '%s'\n", buffer); InternetCloseHandle(request); InternetCloseHandle(connect); Modified: trunk/rostests/winetests/wininet/internet.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wininet/interne…
============================================================================== --- trunk/rostests/winetests/wininet/internet.c [iso-8859-1] (original) +++ trunk/rostests/winetests/wininet/internet.c [iso-8859-1] Sat Jul 2 15:23:55 2016 @@ -615,6 +615,7 @@ static void test_cookie_url(void) { + char long_url[5000] = "
http://long.url.test.com/
", *p; WCHAR bufw[512]; char buf[512]; DWORD len; @@ -641,6 +642,23 @@ res = pInternetGetCookieExW(about_blankW, NULL, bufw, &len, 0, NULL); ok(!res && GetLastError() == ERROR_INVALID_PARAMETER, "InternetGetCookeExW failed: %u, expected ERROR_INVALID_PARAMETER\n", GetLastError()); + + p = long_url + strlen(long_url); + memset(p, 'x', long_url+sizeof(long_url)-p); + p += (long_url+sizeof(long_url)-p) - 3; + p[0] = '/'; + p[2] = 0; + res = InternetSetCookieA(long_url, NULL, "A=B"); + ok(res, "InternetSetCookieA failed: %u\n", GetLastError()); + + len = sizeof(buf); + res = InternetGetCookieA(long_url, NULL, buf, &len); + ok(res, "InternetGetCookieA failed: %u\n", GetLastError()); + ok(!strcmp(buf, "A=B"), "buf = %s\n", buf); + + len = sizeof(buf); + res = InternetGetCookieA("
http://long.url.test.com/
", NULL, buf, &len); + ok(!res && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookieA failed: %u\n", GetLastError()); } static void test_null(void) @@ -1515,6 +1533,10 @@ continue; } break; + case ERROR_INTERNET_CHG_POST_IS_NON_SECURE: + if(res == ERROR_SUCCESS) /* win10 returns ERROR_SUCCESS */ + expected = ERROR_SUCCESS; + break; default: break; } Modified: trunk/rostests/winetests/wininet/url.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wininet/url.c?r…
============================================================================== --- trunk/rostests/winetests/wininet/url.c [iso-8859-1] (original) +++ trunk/rostests/winetests/wininet/url.c [iso-8859-1] Sat Jul 2 15:23:55 2016 @@ -130,6 +130,9 @@ {"
HtTp://www.winehq.org/scheme
", 0, 4, INTERNET_SCHEME_HTTP, 7, 14, 23, 80, -1, 0, -1, 0, 21, 7, -1, 0, "HtTp", "
www.winehq.org
", "", "", "/scheme", ""}, + {"
http://www.winehq.org
", + 0, 4, INTERNET_SCHEME_HTTP, 7, 14, 23, 80, -1, 0, -1, 0, 21, 0, -1, 0, + "http", "
www.winehq.org
", "", "", "", ""}, {"file:///C:/Program%20Files/Atmel/AVR%20Tools/STK500/STK500.xml", 0, 4, INTERNET_SCHEME_FILE, -1, 0, -1, 0, -1, 0, -1, 0, 7, 55, -1, 0, "file", "", "", "", "C:\\Program Files\\Atmel\\AVR Tools\\STK500\\STK500.xml", ""}, @@ -168,20 +171,35 @@ "C", "", "", "", "\\file.txt", ""} }; -static const WCHAR *w_str_of(const char *str) +static WCHAR *a2w(const char *str) { - static WCHAR buf[512]; - MultiByteToWideChar(CP_ACP, 0, str, -1, buf, sizeof(buf)/sizeof(buf[0])); - return buf; + WCHAR *ret; + int len; + + len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + return ret; +} + +static int strcmp_wa(const WCHAR *str1, const char *str2) +{ + WCHAR *str2w = a2w(str2); + int ret = lstrcmpW(str1, str2w); + HeapFree(GetProcessHeap(), 0, str2w); + return ret; } static void test_crack_url(const crack_url_test_t *test) { - WCHAR buf[INTERNET_MAX_URL_LENGTH]; URL_COMPONENTSW urlw; URL_COMPONENTSA url; - char scheme[32], hostname[1024], username[1024]; - char password[1024], extrainfo[1024], urlpath[1024]; + char *scheme_a, *hostname_a, *username_a; + char *password_a, *extrainfo_a, *urlpath_a; + WCHAR *scheme_w, *hostname_w, *username_w; + WCHAR *password_w, *extrainfo_w, *urlpath_w; + size_t buf_len = strlen(test->url); + WCHAR *buf; BOOL b; /* test InternetCrackUrlA with NULL buffers */ @@ -231,9 +249,9 @@ test->url, url.dwPasswordLength, test->pass_len); if(test->path_off == -1) - ok(!url.lpszUrlPath, "[%s] url.lpszPath = %p, expected NULL\n", test->url, url.lpszUrlPath); + ok(!url.lpszUrlPath, "[%s] url.lpszUrlPath = %p, expected NULL\n", test->url, url.lpszUrlPath); else - ok(url.lpszUrlPath == test->url+test->path_off, "[%s] url.lpszPath = %p, expected %p\n", + ok(url.lpszUrlPath == test->url+test->path_off, "[%s] url.lpszUrlPath = %p, expected %p\n", test->url, url.lpszUrlPath, test->url+test->path_off); ok(url.dwUrlPathLength == test->path_len, "[%s] url.lpszUrlPathLength = %d, expected %d\n", test->url, url.dwUrlPathLength, test->path_len); @@ -256,10 +274,11 @@ urlw.dwUrlPathLength = 1; urlw.dwExtraInfoLength = 1; - MultiByteToWideChar(CP_ACP, 0, test->url, -1, buf, sizeof(buf)/sizeof(buf[0])); + buf = a2w(test->url); b = InternetCrackUrlW(buf, lstrlenW(buf), 0, &urlw); if(!b && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) { win_skip("InternetCrackUrlW is not implemented\n"); + HeapFree(GetProcessHeap(), 0, buf); return; } ok(b, "InternetCrackUrl failed with error %d\n", GetLastError()); @@ -310,9 +329,9 @@ } if(test->path_off == -1) - ok(!urlw.lpszUrlPath, "[%s] urlw.lpszPath = %p, expected NULL\n", test->url, urlw.lpszUrlPath); + ok(!urlw.lpszUrlPath, "[%s] urlw.lpszUrlPath = %p, expected NULL\n", test->url, urlw.lpszUrlPath); else - ok(urlw.lpszUrlPath == buf+test->path_off, "[%s] urlw.lpszPath = %p, expected %p\n", + ok(urlw.lpszUrlPath == buf+test->path_off, "[%s] urlw.lpszUrlPath = %p, expected %p\n", test->url, urlw.lpszUrlPath, buf+test->path_off); ok(urlw.dwUrlPathLength == test->path_len, "[%s] urlw.lpszUrlPathLength = %d, expected %d\n", test->url, urlw.dwUrlPathLength, test->path_len); @@ -329,114 +348,165 @@ } /* test InternetCrackUrlA with valid buffers */ + scheme_a = (char*)(scheme_w = HeapAlloc(GetProcessHeap(), 0, buf_len*sizeof(WCHAR))); + hostname_a = (char*)(hostname_w = HeapAlloc(GetProcessHeap(), 0, buf_len*sizeof(WCHAR))); + username_a = (char*)(username_w = HeapAlloc(GetProcessHeap(), 0, buf_len*sizeof(WCHAR))); + password_a = (char*)(password_w = HeapAlloc(GetProcessHeap(), 0, buf_len*sizeof(WCHAR))); + urlpath_a = (char*)(urlpath_w = HeapAlloc(GetProcessHeap(), 0, buf_len*sizeof(WCHAR))); + extrainfo_a = (char*)(extrainfo_w = HeapAlloc(GetProcessHeap(), 0, buf_len*sizeof(WCHAR))); memset(&url, 0, sizeof(URL_COMPONENTSA)); url.dwStructSize = sizeof(URL_COMPONENTSA); - url.lpszScheme = scheme; - url.dwSchemeLength = sizeof(scheme); - url.lpszHostName = hostname; - url.dwHostNameLength = sizeof(hostname); - url.lpszUserName = username; - url.dwUserNameLength = sizeof(username); - url.lpszPassword = password; - url.dwPasswordLength = sizeof(password); - url.lpszUrlPath = urlpath; - url.dwUrlPathLength = sizeof(urlpath); - url.lpszExtraInfo = extrainfo; - url.dwExtraInfoLength = sizeof(extrainfo); + url.lpszScheme = scheme_a; + url.dwSchemeLength = buf_len; + url.lpszHostName = hostname_a; + url.dwHostNameLength = buf_len; + url.lpszUserName = username_a; + url.dwUserNameLength = buf_len; + url.lpszPassword = password_a; + url.dwPasswordLength = buf_len; + url.lpszUrlPath = urlpath_a; + url.dwUrlPathLength = buf_len; + url.lpszExtraInfo = extrainfo_a; + url.dwExtraInfoLength = buf_len; b = InternetCrackUrlA(test->url, strlen(test->url), 0, &url); ok(b, "InternetCrackUrlA failed with error %d\n", GetLastError()); ok(url.dwSchemeLength == strlen(test->exp_scheme), "[%s] Got wrong scheme length: %d\n", - test->url, url.dwSchemeLength); - ok(!strcmp(scheme, test->exp_scheme), "[%s] Got wrong scheme, expected: %s, got: %s\n", - test->url, test->exp_scheme, scheme); + test->url, url.dwSchemeLength); + ok(!strcmp(scheme_a, test->exp_scheme), "[%s] Got wrong scheme, expected: %s, got: %s\n", + test->url, test->exp_scheme, scheme_a); ok(url.nScheme == test->scheme, "[%s] Got wrong nScheme, expected: %d, got: %d\n", - test->url, test->scheme, url.nScheme); + test->url, test->scheme, url.nScheme); ok(url.dwHostNameLength == strlen(test->exp_hostname), "[%s] Got wrong hostname length: %d\n", - test->url, url.dwHostNameLength); - ok(!strcmp(hostname, test->exp_hostname), "[%s] Got wrong hostname, expected: %s, got: %s\n", - test->url, test->exp_hostname, hostname); + test->url, url.dwHostNameLength); + ok(!strcmp(hostname_a, test->exp_hostname), "[%s] Got wrong hostname, expected: %s, got: %s\n", + test->url, test->exp_hostname, hostname_a); ok(url.nPort == test->port, "[%s] Got wrong port, expected: %d, got: %d\n", - test->url, test->port, url.nPort); + test->url, test->port, url.nPort); ok(url.dwUserNameLength == strlen(test->exp_username), "[%s] Got wrong username length: %d\n", - test->url, url.dwUserNameLength); - ok(!strcmp(username, test->exp_username), "[%s] Got wrong username, expected: %s, got: %s\n", - test->url, test->exp_username, username); + test->url, url.dwUserNameLength); + ok(!strcmp(username_a, test->exp_username), "[%s] Got wrong username, expected: %s, got: %s\n", + test->url, test->exp_username, username_a); ok(url.dwPasswordLength == strlen(test->exp_password), "[%s] Got wrong password length: %d\n", - test->url, url.dwPasswordLength); - ok(!strcmp(password, test->exp_password), "[%s] Got wrong password, expected: %s, got: %s\n", - test->url, test->exp_password, password); + test->url, url.dwPasswordLength); + ok(!strcmp(password_a, test->exp_password), "[%s] Got wrong password, expected: %s, got: %s\n", + test->url, test->exp_password, password_a); ok(url.dwUrlPathLength == strlen(test->exp_urlpath), "[%s] Got wrong urlpath length: %d\n", - test->url, url.dwUrlPathLength); - ok(!strcmp(urlpath, test->exp_urlpath), "[%s] Got wrong urlpath, expected: %s, got: %s\n", - test->url, test->exp_urlpath, urlpath); + test->url, url.dwUrlPathLength); + ok(!strcmp(urlpath_a, test->exp_urlpath), "[%s] Got wrong urlpath, expected: %s, got: %s\n", + test->url, test->exp_urlpath, urlpath_a); ok(url.dwExtraInfoLength == strlen(test->exp_extrainfo), "[%s] Got wrong extrainfo length: %d\n", - test->url, url.dwExtraInfoLength); - ok(!strcmp(extrainfo, test->exp_extrainfo), "[%s] Got wrong extrainfo, expected: %s, got: %s\n", - test->url, test->exp_extrainfo, extrainfo); + test->url, url.dwExtraInfoLength); + ok(!strcmp(extrainfo_a, test->exp_extrainfo), "[%s] Got wrong extrainfo, expected: %s, got: %s\n", + test->url, test->exp_extrainfo, extrainfo_a); /* test InternetCrackUrlW with valid buffers */ memset(&urlw, 0, sizeof(URL_COMPONENTSW)); urlw.dwStructSize = sizeof(URL_COMPONENTSW); - urlw.lpszScheme = (WCHAR*)scheme; - urlw.dwSchemeLength = sizeof(scheme) / sizeof(WCHAR); - urlw.lpszHostName = (WCHAR*)hostname; - urlw.dwHostNameLength = sizeof(hostname) / sizeof(WCHAR); - urlw.lpszUserName = (WCHAR*)username; - urlw.dwUserNameLength = sizeof(username) / sizeof(WCHAR); - urlw.lpszPassword = (WCHAR*)password; - urlw.dwPasswordLength = sizeof(password) / sizeof(WCHAR); - urlw.lpszUrlPath = (WCHAR*)urlpath; - urlw.dwUrlPathLength = sizeof(urlpath) / sizeof(WCHAR); - urlw.lpszExtraInfo = (WCHAR*)extrainfo; - urlw.dwExtraInfoLength = sizeof(extrainfo) / sizeof(WCHAR); + urlw.lpszScheme = scheme_w; + urlw.dwSchemeLength = buf_len; + urlw.lpszHostName = hostname_w; + urlw.dwHostNameLength = buf_len; + urlw.lpszUserName = username_w; + urlw.dwUserNameLength = buf_len; + urlw.lpszPassword = password_w; + urlw.dwPasswordLength = buf_len; + urlw.lpszUrlPath = urlpath_w; + urlw.dwUrlPathLength = buf_len; + urlw.lpszExtraInfo = extrainfo_w; + urlw.dwExtraInfoLength = buf_len; b = InternetCrackUrlW(buf, lstrlenW(buf), 0, &urlw); ok(b, "InternetCrackUrlW failed with error %d\n", GetLastError()); ok(urlw.dwSchemeLength == strlen(test->exp_scheme), "[%s] Got wrong scheme length: %d\n", - test->url, urlw.dwSchemeLength); - ok(!lstrcmpW((WCHAR*)scheme, w_str_of(test->exp_scheme)), "[%s] Got wrong scheme, expected: %s, got: %s\n", - test->url, test->exp_scheme, wine_dbgstr_w((WCHAR*)scheme)); + test->url, urlw.dwSchemeLength); + ok(!strcmp_wa(scheme_w, test->exp_scheme), "[%s] Got wrong scheme, expected: %s, got: %s\n", + test->url, test->exp_scheme, wine_dbgstr_w(scheme_w)); ok(urlw.nScheme == test->scheme, "[%s] Got wrong nScheme, expected: %d, got: %d\n", - test->url, test->scheme, urlw.nScheme); + test->url, test->scheme, urlw.nScheme); ok(urlw.dwHostNameLength == strlen(test->exp_hostname), "[%s] Got wrong hostname length: %d\n", - test->url, urlw.dwHostNameLength); - ok(!lstrcmpW((WCHAR*)hostname, w_str_of(test->exp_hostname)), "[%s] Got wrong hostname, expected: %s, got: %s\n", - test->url, test->exp_hostname, wine_dbgstr_w((WCHAR*)hostname)); + test->url, urlw.dwHostNameLength); + ok(!strcmp_wa(hostname_w, test->exp_hostname), "[%s] Got wrong hostname, expected: %s, got: %s\n", + test->url, test->exp_hostname, wine_dbgstr_w(hostname_w)); ok(urlw.nPort == test->port, "[%s] Got wrong port, expected: %d, got: %d\n", - test->url, test->port, urlw.nPort); + test->url, test->port, urlw.nPort); ok(urlw.dwUserNameLength == strlen(test->exp_username), "[%s] Got wrong username length: %d\n", - test->url, urlw.dwUserNameLength); - ok(!lstrcmpW((WCHAR*)username, w_str_of(test->exp_username)), "[%s] Got wrong username, expected: %s, got: %s\n", - test->url, test->exp_username, wine_dbgstr_w((WCHAR*)username)); + test->url, urlw.dwUserNameLength); + ok(!strcmp_wa(username_w, test->exp_username), "[%s] Got wrong username, expected: %s, got: %s\n", + test->url, test->exp_username, wine_dbgstr_w(username_w)); ok(urlw.dwPasswordLength == strlen(test->exp_password), "[%s] Got wrong password length: %d\n", - test->url, urlw.dwPasswordLength); - ok(!lstrcmpW((WCHAR*)password, w_str_of(test->exp_password)), "[%s] Got wrong password, expected: %s, got: %s\n", - test->url, test->exp_password, wine_dbgstr_w((WCHAR*)password)); + test->url, urlw.dwPasswordLength); + ok(!strcmp_wa(password_w, test->exp_password), "[%s] Got wrong password, expected: %s, got: %s\n", + test->url, test->exp_password, wine_dbgstr_w(password_w)); ok(urlw.dwUrlPathLength == strlen(test->exp_urlpath), "[%s] Got wrong urlpath length: %d\n", - test->url, urlw.dwUrlPathLength); - ok(!lstrcmpW((WCHAR*)urlpath, w_str_of(test->exp_urlpath)), "[%s] Got wrong urlpath, expected: %s, got: %s\n", - test->url, test->exp_urlpath, wine_dbgstr_w((WCHAR*)urlpath)); + test->url, urlw.dwUrlPathLength); + ok(!strcmp_wa(urlpath_w, test->exp_urlpath), "[%s] Got wrong urlpath, expected: %s, got: %s\n", + test->url, test->exp_urlpath, wine_dbgstr_w(urlpath_w)); ok(urlw.dwExtraInfoLength == strlen(test->exp_extrainfo), "[%s] Got wrong extrainfo length: %d\n", - test->url, urlw.dwExtraInfoLength); - ok(!lstrcmpW((WCHAR*)extrainfo, w_str_of(test->exp_extrainfo)), "[%s] Got wrong extrainfo, expected: %s, got: %s\n", - test->url, test->exp_extrainfo, wine_dbgstr_w((WCHAR*)extrainfo)); + test->url, urlw.dwExtraInfoLength); + ok(!strcmp_wa(extrainfo_w, test->exp_extrainfo), "[%s] Got wrong extrainfo, expected: %s, got: %s\n", + test->url, test->exp_extrainfo, wine_dbgstr_w(extrainfo_w)); + + HeapFree(GetProcessHeap(), 0, scheme_w); + HeapFree(GetProcessHeap(), 0, hostname_w); + HeapFree(GetProcessHeap(), 0, username_w); + HeapFree(GetProcessHeap(), 0, password_w); + HeapFree(GetProcessHeap(), 0, urlpath_w); + HeapFree(GetProcessHeap(), 0, extrainfo_w); + HeapFree(GetProcessHeap(), 0, buf); +} + +static void test_long_url(void) +{ + char long_buf[6000]; + char long_url[sizeof(long_buf) + 1000]; + crack_url_test_t test_long_path = + {long_url, 0, 4, INTERNET_SCHEME_HTTP, 7, 14, -1, 80, -1, 0, -1, 0, 21, sizeof(long_buf)-1, -1, 0, + "http", "
www.winehq.org
", "", "", long_buf, ""}; + crack_url_test_t test_long_extra = + {long_url, 0, 4, INTERNET_SCHEME_HTTP, 7, 14, -1, 80, -1, 0, -1, 0, 21, 6, 27, sizeof(long_buf)-1, + "http", "
www.winehq.org
", "", "", "/path/", long_buf}; + URL_COMPONENTSA url_comp; + BOOL b; + + memset(long_buf, 'x', sizeof(long_buf)); + long_buf[0] = '/'; + long_buf[sizeof(long_buf)-1] = 0; + + strcpy(long_url, "
http://www.winehq.org
"); + strcat(long_url, long_buf); + test_crack_url(&test_long_path); + + strcpy(long_url, "
http://www.winehq.org/path/
"); + long_buf[0] = '#'; + strcat(long_url, long_buf); + test_crack_url(&test_long_extra); + + zero_compsA(&url_comp, 0, 0, 0, 0, 0, 100); + url_comp.lpszExtraInfo = long_buf; + b = InternetCrackUrlA(long_url, strlen(long_url), 0, &url_comp); + ok(!b && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetCrackUrlA returned %x with error %d\n", b, GetLastError()); + + zero_compsA(&url_comp, 4, 0, 0, 0, 0, 0); + url_comp.lpszScheme = long_buf; + b = InternetCrackUrlA(long_url, strlen(long_url), 0, &url_comp); + ok(!b && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetCrackUrlA returned %x with error %d\n", b, GetLastError()); } static void InternetCrackUrl_test(void) @@ -1152,6 +1222,8 @@ for(i=0; i < sizeof(crack_url_tests)/sizeof(*crack_url_tests); i++) test_crack_url(crack_url_tests+i); + test_long_url(); + InternetCrackUrl_test(); InternetCrackUrlW_test(); InternetCreateUrlA_test();
8 years, 5 months
1
0
0
0
[akhaldi] 71751: [WININET] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Jul 2 15:23:01 2016 New Revision: 71751 URL:
http://svn.reactos.org/svn/reactos?rev=71751&view=rev
Log: [WININET] Sync with Wine Staging 1.9.11. CORE-11368 Modified: trunk/reactos/dll/win32/wininet/cookie.c trunk/reactos/dll/win32/wininet/http.c trunk/reactos/dll/win32/wininet/internet.c trunk/reactos/dll/win32/wininet/internet.h trunk/reactos/dll/win32/wininet/netconnection.c trunk/reactos/dll/win32/wininet/urlcache.c trunk/reactos/dll/win32/wininet/wininet_ros.diff trunk/reactos/media/doc/README.WINE [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/wininet/cookie.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/cookie.c…
Modified: trunk/reactos/dll/win32/wininet/http.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/http.c?r…
Modified: trunk/reactos/dll/win32/wininet/internet.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/internet…
Modified: trunk/reactos/dll/win32/wininet/internet.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/internet…
Modified: trunk/reactos/dll/win32/wininet/netconnection.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/netconne…
Modified: trunk/reactos/dll/win32/wininet/urlcache.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/urlcache…
Modified: trunk/reactos/dll/win32/wininet/wininet_ros.diff URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/wininet_…
Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
8 years, 5 months
1
0
0
0
[akhaldi] 71750: [PSDK] Update wincodec.idl. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Jul 2 15:16:32 2016 New Revision: 71750 URL:
http://svn.reactos.org/svn/reactos?rev=71750&view=rev
Log: [PSDK] Update wincodec.idl. CORE-11368 Modified: trunk/reactos/sdk/include/psdk/wincodec.idl Modified: trunk/reactos/sdk/include/psdk/wincodec.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/wincodec.…
============================================================================== --- trunk/reactos/sdk/include/psdk/wincodec.idl [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/wincodec.idl [iso-8859-1] Sat Jul 2 15:16:32 2016 @@ -168,6 +168,12 @@ WICTIFFCOMPRESSIONOPTION_FORCE_DWORD = CODEC_FORCE_DWORD } WICTiffCompressionOption; +typedef enum WICSectionAccessLevel { + WICSectionAccessLevelRead = 0x00000001, + WICSectionAccessLevelReadWrite = 0x00000003, + WICSectionAccessLevel_FORCE_DWORD = CODEC_FORCE_DWORD +} WICSectionAccessLevel; + typedef GUID WICPixelFormatGUID; typedef REFGUID REFWICPixelFormatGUID; @@ -196,6 +202,7 @@ cpp_quote("DEFINE_GUID(GUID_WICPixelFormat32bppRGB, 0xd98c6b95,0x3efe,0x47d6,0xbb,0x25,0xeb,0x17,0x48,0xab,0x0c,0xf1);") cpp_quote("DEFINE_GUID(GUID_WICPixelFormat32bppRGBA, 0xf5c7ad2d,0x6a8d,0x43dd,0xa7,0xa8,0xa2,0x99,0x35,0x26,0x1a,0xe9);") cpp_quote("DEFINE_GUID(GUID_WICPixelFormat32bppPRGBA, 0x3cc4a650,0xa527,0x4d37,0xa9,0x16,0x31,0x42,0xc7,0xeb,0xed,0xba);") +cpp_quote("DEFINE_GUID(GUID_WICPixelFormat32bppGrayFloat, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x11);") cpp_quote("DEFINE_GUID(GUID_WICPixelFormat48bppRGB, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x15);") cpp_quote("DEFINE_GUID(GUID_WICPixelFormat64bppRGBA, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x16);") @@ -999,6 +1006,8 @@ } cpp_quote("HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst);") +cpp_quote("HRESULT WINAPI WICCreateBitmapFromSection(UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, IWICBitmap **bitmap);") +cpp_quote("HRESULT WINAPI WICCreateBitmapFromSectionEx(UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, WICSectionAccessLevel access, IWICBitmap **bitmap);") cpp_quote("DEFINE_GUID(CLSID_WICBmpDecoder, 0x6b462062,0x7cbf,0x400d,0x9f,0xdb,0x81,0x3d,0xd1,0x0f,0x27,0x78);") cpp_quote("DEFINE_GUID(CLSID_WICPngDecoder, 0x389ea17b,0x5078,0x4cde,0xb6,0xef,0x25,0xc1,0x51,0x75,0xc7,0x51);")
8 years, 5 months
1
0
0
0
[akhaldi] 71749: [AMSTREAM_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Jul 2 15:15:26 2016 New Revision: 71749 URL:
http://svn.reactos.org/svn/reactos?rev=71749&view=rev
Log: [AMSTREAM_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368 Modified: trunk/rostests/winetests/amstream/amstream.c Modified: trunk/rostests/winetests/amstream/amstream.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/amstream/amstre…
============================================================================== --- trunk/rostests/winetests/amstream/amstream.c [iso-8859-1] (original) +++ trunk/rostests/winetests/amstream/amstream.c [iso-8859-1] Sat Jul 2 15:15:26 2016 @@ -36,9 +36,10 @@ #define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__) static void _expect_ref(IUnknown* obj, ULONG ref, int line) { - ULONG rc = IUnknown_AddRef(obj); - IUnknown_Release(obj); - ok_(__FILE__,line)(rc-1 == ref, "expected refcount %d, got %d\n", ref, rc-1); + ULONG rc; + IUnknown_AddRef(obj); + rc = IUnknown_Release(obj); + ok_(__FILE__,line)(rc == ref, "expected refcount %d, got %d\n", ref, rc); } static const WCHAR filenameW[] = {'t','e','s','t','.','a','v','i',0}; @@ -260,6 +261,7 @@ if (video_stream) { IAMMediaStream* am_media_stream; + IMultiMediaStream *multi_media_stream; IAudioMediaStream* audio_media_stream; IDirectDrawMediaStream *ddraw_stream = NULL; IDirectDrawStreamSample *ddraw_sample = NULL; @@ -267,8 +269,17 @@ hr = IMediaStream_QueryInterface(video_stream, &IID_IAMMediaStream, (LPVOID*)&am_media_stream); ok(hr == S_OK, "IMediaStream_QueryInterface returned: %x\n", hr); ok((void*)am_media_stream == (void*)video_stream, "Not same interface, got %p expected %p\n", am_media_stream, video_stream); - if (hr == S_OK) - IAMMediaStream_Release(am_media_stream); + + hr = IAMMediaStream_GetMultiMediaStream(am_media_stream, NULL); + ok(hr == E_POINTER, "Expected E_POINTER, got %x\n", hr); + + multi_media_stream = (void *)0xdeadbeef; + hr = IAMMediaStream_GetMultiMediaStream(am_media_stream, &multi_media_stream); + ok(hr == S_OK, "IAMMediaStream_GetMultiMediaStream returned: %x\n", hr); + ok((void *)multi_media_stream == (void *)pams, "Expected %p, got %p\n", pams, multi_media_stream); + IMultiMediaStream_Release(multi_media_stream); + + IAMMediaStream_Release(am_media_stream); hr = IMediaStream_QueryInterface(video_stream, &IID_IAudioMediaStream, (LPVOID*)&audio_media_stream); ok(hr == E_NOINTERFACE, "IMediaStream_QueryInterface returned: %x\n", hr); @@ -287,6 +298,15 @@ hr = IDirectDrawMediaStream_CreateSample(ddraw_stream, NULL, NULL, 0, &ddraw_sample); ok(hr == S_OK, "IDirectDrawMediaStream_CreateSample returned: %x\n", hr); + + hr = IDirectDrawMediaStream_GetMultiMediaStream(ddraw_stream, NULL); + ok(hr == E_POINTER, "Expected E_POINTER, got %x\n", hr); + + multi_media_stream = (void *)0xdeadbeef; + hr = IDirectDrawMediaStream_GetMultiMediaStream(ddraw_stream, &multi_media_stream); + ok(hr == S_OK, "IDirectDrawMediaStream_GetMultiMediaStream returned: %x\n", hr); + ok((void *)multi_media_stream == (void *)pams, "Expected %p, got %p\n", pams, multi_media_stream); + IMultiMediaStream_Release(multi_media_stream); } if (ddraw_sample) @@ -351,6 +371,7 @@ if (audio_stream) { IAMMediaStream* am_media_stream; + IMultiMediaStream *multi_media_stream; IDirectDrawMediaStream* ddraw_stream = NULL; IAudioMediaStream* audio_media_stream = NULL; IAudioStreamSample *audio_sample = NULL; @@ -358,8 +379,17 @@ hr = IMediaStream_QueryInterface(audio_stream, &IID_IAMMediaStream, (LPVOID*)&am_media_stream); ok(hr == S_OK, "IMediaStream_QueryInterface returned: %x\n", hr); ok((void*)am_media_stream == (void*)audio_stream, "Not same interface, got %p expected %p\n", am_media_stream, audio_stream); - if (hr == S_OK) - IAMMediaStream_Release(am_media_stream); + + hr = IAMMediaStream_GetMultiMediaStream(am_media_stream, NULL); + ok(hr == E_POINTER, "Expected E_POINTER, got %x\n", hr); + + multi_media_stream = (void *)0xdeadbeef; + hr = IAMMediaStream_GetMultiMediaStream(am_media_stream, &multi_media_stream); + ok(hr == S_OK, "IAMMediaStream_GetMultiMediaStream returned: %x\n", hr); + ok((void *)multi_media_stream == (void *)pams, "Expected %p, got %p\n", pams, multi_media_stream); + IMultiMediaStream_Release(multi_media_stream); + + IAMMediaStream_Release(am_media_stream); hr = IMediaStream_QueryInterface(audio_stream, &IID_IDirectDrawMediaStream, (LPVOID*)&ddraw_stream); ok(hr == E_NOINTERFACE, "IMediaStream_QueryInterface returned: %x\n", hr); @@ -384,6 +414,15 @@ ok(hr == E_POINTER, "IAudioMediaStream_CreateSample returned: %x\n", hr); hr = IAudioMediaStream_CreateSample(audio_media_stream, audio_data, 0, &audio_sample); ok(hr == S_OK, "IAudioMediaStream_CreateSample returned: %x\n", hr); + + hr = IAudioMediaStream_GetMultiMediaStream(audio_media_stream, NULL); + ok(hr == E_POINTER, "Expected E_POINTER, got %x\n", hr); + + multi_media_stream = (void *)0xdeadbeef; + hr = IAudioMediaStream_GetMultiMediaStream(audio_media_stream, &multi_media_stream); + ok(hr == S_OK, "IAudioMediaStream_GetMultiMediaStream returned: %x\n", hr); + ok((void *)multi_media_stream == (void *)pams, "Expected %p, got %p\n", pams, multi_media_stream); + IMultiMediaStream_Release(multi_media_stream); if (audio_data) IAudioData_Release(audio_data);
8 years, 5 months
1
0
0
0
[akhaldi] 71748: [PSDK] Update rpcdce.h. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Jul 2 15:04:47 2016 New Revision: 71748 URL:
http://svn.reactos.org/svn/reactos?rev=71748&view=rev
Log: [PSDK] Update rpcdce.h. CORE-11368 Modified: trunk/reactos/sdk/include/psdk/rpcdce.h Modified: trunk/reactos/sdk/include/psdk/rpcdce.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/rpcdce.h?…
============================================================================== --- trunk/reactos/sdk/include/psdk/rpcdce.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/rpcdce.h [iso-8859-1] Sat Jul 2 15:04:47 2016 @@ -453,6 +453,11 @@ unsigned int Flags, unsigned int MaxCalls, unsigned int MaxRpcSize, RPC_IF_CALLBACK_FN* IfCallbackFn ); RPCRTAPI RPC_STATUS RPC_ENTRY + RpcServerRegisterIf3( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv, + unsigned int Flags, unsigned int MaxCalls, unsigned int MaxRpcSize, + RPC_IF_CALLBACK_FN* IfCallbackFn, void* SecurityDescriptor ); + +RPCRTAPI RPC_STATUS RPC_ENTRY RpcServerUnregisterIf( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, unsigned int WaitForCallsToComplete ); RPCRTAPI RPC_STATUS RPC_ENTRY
8 years, 5 months
1
0
0
0
[akhaldi] 71747: [PSDK] Add missing MUI_MERGE_SYSTEM_FALLBACK, MUI_MERGE_USER_FALLBACK and MUI_UI_FALLBACK.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Jul 2 13:51:18 2016 New Revision: 71747 URL:
http://svn.reactos.org/svn/reactos?rev=71747&view=rev
Log: [PSDK] Add missing MUI_MERGE_SYSTEM_FALLBACK, MUI_MERGE_USER_FALLBACK and MUI_UI_FALLBACK. Modified: trunk/reactos/sdk/include/psdk/winnls.h Modified: trunk/reactos/sdk/include/psdk/winnls.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/winnls.h?…
============================================================================== --- trunk/reactos/sdk/include/psdk/winnls.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/winnls.h [iso-8859-1] Sat Jul 2 13:51:18 2016 @@ -495,6 +495,9 @@ #define MUI_FULL_LANGUAGE 0x01 #define MUI_LANGUAGE_ID 0x04 #define MUI_LANGUAGE_NAME 0x08 +#define MUI_MERGE_SYSTEM_FALLBACK 0x10 +#define MUI_MERGE_USER_FALLBACK 0x20 +#define MUI_UI_FALLBACK MUI_MERGE_SYSTEM_FALLBACK | MUI_MERGE_USER_FALLBACK #define MUI_MACHINE_LANGUAGE_SETTINGS 0x400 #endif /* (WINVER >= 0x0600) */
8 years, 5 months
1
0
0
0
← Newer
1
...
29
30
31
32
33
34
35
36
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
Results per page:
10
25
50
100
200