winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
July 2017
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
632 discussions
Start a n
N
ew thread
Zebediah Figura : wincodecs: Add encoder options for JPEG.
by Alexandre Julliard
31 Jul '17
31 Jul '17
Module: wine Branch: master Commit: 8648aaf86d6417950e8e0501e53edacfbb6461a2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8648aaf86d6417950e8e0501e…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Fri Jul 28 14:41:13 2017 -0500 wincodecs: Add encoder options for JPEG. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windowscodecs/jpegformat.c | 29 ++++++++++++++++++++++++++++- dlls/windowscodecs/tests/converter.c | 28 ++++++++++++++++++++++++++++ include/wincodec.idl | 8 ++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c index acc262e..014620f 100644 --- a/dlls/windowscodecs/jpegformat.c +++ b/dlls/windowscodecs/jpegformat.c @@ -60,6 +60,13 @@ WINE_DECLARE_DEBUG_CHANNEL(jpeg); static void *libjpeg_handle; +static const WCHAR wszImageQuality[] = {'I','m','a','g','e','Q','u','a','l','i','t','y',0}; +static const WCHAR wszBitmapTransform[] = {'B','i','t','m','a','p','T','r','a','n','s','f','o','r','m',0}; +static const WCHAR wszLuminance[] = {'L','u','m','i','n','a','n','c','e',0}; +static const WCHAR wszChrominance[] = {'C','h','r','o','m','i','n','a','n','c','e',0}; +static const WCHAR wszJpegYCrCbSubsampling[] = {'J','p','e','g','Y','C','r','C','b','S','u','b','s','a','m','p','l','i','n','g',0}; +static const WCHAR wszSuppressApp0[] = {'S','u','p','p','r','e','s','s','A','p','p','0',0}; + #define MAKE_FUNCPTR(f) static typeof(f) * p##f MAKE_FUNCPTR(jpeg_CreateCompress); MAKE_FUNCPTR(jpeg_CreateDecompress); @@ -1407,6 +1414,7 @@ static HRESULT WINAPI JpegEncoder_CreateNewFrame(IWICBitmapEncoder *iface, { JpegEncoder *This = impl_from_IWICBitmapEncoder(iface); HRESULT hr; + PROPBAG2 opts[6] = {{0}}; TRACE("(%p,%p,%p)\n", iface, ppIFrameEncode, ppIEncoderOptions); @@ -1424,7 +1432,26 @@ static HRESULT WINAPI JpegEncoder_CreateNewFrame(IWICBitmapEncoder *iface, return WINCODEC_ERR_NOTINITIALIZED; } - hr = CreatePropertyBag2(NULL, 0, ppIEncoderOptions); + opts[0].pstrName = (LPOLESTR)wszImageQuality; + opts[0].vt = VT_R4; + opts[0].dwType = PROPBAG2_TYPE_DATA; + opts[1].pstrName = (LPOLESTR)wszBitmapTransform; + opts[1].vt = VT_UI1; + opts[1].dwType = PROPBAG2_TYPE_DATA; + opts[2].pstrName = (LPOLESTR)wszLuminance; + opts[2].vt = VT_I4|VT_ARRAY; + opts[2].dwType = PROPBAG2_TYPE_DATA; + opts[3].pstrName = (LPOLESTR)wszChrominance; + opts[3].vt = VT_I4|VT_ARRAY; + opts[3].dwType = PROPBAG2_TYPE_DATA; + opts[4].pstrName = (LPOLESTR)wszJpegYCrCbSubsampling; + opts[4].vt = VT_UI1; + opts[4].dwType = PROPBAG2_TYPE_DATA; + opts[5].pstrName = (LPOLESTR)wszSuppressApp0; + opts[5].vt = VT_BOOL; + opts[5].dwType = PROPBAG2_TYPE_DATA; + + hr = CreatePropertyBag2(opts, 6, ppIEncoderOptions); if (FAILED(hr)) { LeaveCriticalSection(&This->lock); diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c index fba7fc7..041ca96 100644 --- a/dlls/windowscodecs/tests/converter.c +++ b/dlls/windowscodecs/tests/converter.c @@ -429,6 +429,12 @@ static const WCHAR wszTiffCompressionMethod[] = {'T','i','f','f','C','o','m','p' static const WCHAR wszCompressionQuality[] = {'C','o','m','p','r','e','s','s','i','o','n','Q','u','a','l','i','t','y',0}; static const WCHAR wszInterlaceOption[] = {'I','n','t','e','r','l','a','c','e','O','p','t','i','o','n',0}; static const WCHAR wszFilterOption[] = {'F','i','l','t','e','r','O','p','t','i','o','n',0}; +static const WCHAR wszImageQuality[] = {'I','m','a','g','e','Q','u','a','l','i','t','y',0}; +static const WCHAR wszBitmapTransform[] = {'B','i','t','m','a','p','T','r','a','n','s','f','o','r','m',0}; +static const WCHAR wszLuminance[] = {'L','u','m','i','n','a','n','c','e',0}; +static const WCHAR wszChrominance[] = {'C','h','r','o','m','i','n','a','n','c','e',0}; +static const WCHAR wszJpegYCrCbSubsampling[] = {'J','p','e','g','Y','C','r','C','b','S','u','b','s','a','m','p','l','i','n','g',0}; +static const WCHAR wszSuppressApp0[] = {'S','u','p','p','r','e','s','s','A','p','p','0',0}; static const struct property_opt_test_data testdata_tiff_props[] = { { wszTiffCompressionMethod, VT_UI1, VT_UI1, WICTiffCompressionDontCare }, @@ -442,6 +448,16 @@ static const struct property_opt_test_data testdata_png_props[] = { { NULL } }; +static const struct property_opt_test_data testdata_jpeg_props[] = { + { wszImageQuality, VT_R4, VT_EMPTY }, + { wszBitmapTransform, VT_UI1, VT_UI1, WICBitmapTransformRotate0 }, + { wszLuminance, VT_I4|VT_ARRAY, VT_EMPTY }, + { wszChrominance, VT_I4|VT_ARRAY, VT_EMPTY }, + { wszJpegYCrCbSubsampling, VT_UI1, VT_UI1, WICJpegYCrCbSubsamplingDefault, 0.0f, TRUE }, /* not supported on XP/2k3 */ + { wszSuppressApp0, VT_BOOL, VT_BOOL, FALSE }, + { NULL } +}; + static int find_property_index(const WCHAR* name, PROPBAG2* all_props, int all_prop_cnt) { int i; @@ -566,6 +582,8 @@ static void test_encoder_properties(const CLSID* clsid_encoder, IPropertyBag2 *o test_specific_encoder_properties(options, testdata_tiff_props, all_props, cProperties2); else if (IsEqualCLSID(clsid_encoder, &CLSID_WICPngEncoder)) test_specific_encoder_properties(options, testdata_png_props, all_props, cProperties2); + else if (IsEqualCLSID(clsid_encoder, &CLSID_WICJpegEncoder)) + test_specific_encoder_properties(options, testdata_jpeg_props, all_props, cProperties2); for (i=0; i < cProperties2; i++) { @@ -727,6 +745,13 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls i++; } + if (clsid_decoder == NULL) + { + IStream_Release(stream); + IWICBitmapEncoder_Release(encoder); + return; + } + if (SUCCEEDED(hr)) { hr = IWICBitmapEncoder_Commit(encoder); @@ -868,6 +893,9 @@ START_TEST(converter) test_encoder(&testdata_24bppBGR, &CLSID_WICTiffEncoder, &testdata_24bppBGR, &CLSID_WICTiffDecoder, "TIFF encoder 24bppBGR"); + test_encoder(&testdata_24bppBGR, &CLSID_WICJpegEncoder, + &testdata_24bppBGR, NULL, "JPEG encoder 24bppBGR"); + test_multi_encoder(multiple_frames, &CLSID_WICTiffEncoder, multiple_frames, &CLSID_WICTiffDecoder, NULL, NULL, "TIFF encoder multi-frame"); diff --git a/include/wincodec.idl b/include/wincodec.idl index 1bbdab9..e727cbd 100644 --- a/include/wincodec.idl +++ b/include/wincodec.idl @@ -148,6 +148,14 @@ typedef enum WICComponentEnumerateOptions { WICComponentEnumerateDisabled = 0x80000000 } WICComponentEnumerateOptions; +typedef enum WICJpegYCrCbSubsamplingOption { + WICJpegYCrCbSubsamplingDefault = 0x00000000, + WICJpegYCrCbSubsampling420 = 0x00000001, + WICJpegYCrCbSubsampling422 = 0x00000002, + WICJpegYCrCbSubsampling444 = 0x00000003, + WICJpegYCrCbSubsampling440 = 0x00000004 +} WICJpegYCrCbSubsamplingOption; + typedef enum WICPixelFormatNumericRepresentation { WICPixelFormatNumericRepresentationUnspecified = 0x00000000, WICPixelFormatNumericRepresentationIndexed = 0x00000001,
1
0
0
0
Hugh McMaster : regedit: Store the data from a listview subitem in a valid memory address.
by Alexandre Julliard
28 Jul '17
28 Jul '17
Module: wine Branch: master Commit: 5d9a4c4dbd85cd97acae0d9f0191415bf4b30673 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5d9a4c4dbd85cd97acae0d9f0…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Fri Jul 28 13:22:27 2017 +0000 regedit: Store the data from a listview subitem in a valid memory address. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/childwnd.c | 1 + programs/regedit/listview.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/programs/regedit/childwnd.c b/programs/regedit/childwnd.c index d6a7d51..7a5633f 100644 --- a/programs/regedit/childwnd.c +++ b/programs/regedit/childwnd.c @@ -397,6 +397,7 @@ static int listview_notify(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam LINE_INFO *info = (LINE_INFO *)nmlv->lParam; heap_free(info->name); + heap_free(info->val); heap_free(info); break; } diff --git a/programs/regedit/listview.c b/programs/regedit/listview.c index 238a2c7..e1e8c7f 100644 --- a/programs/regedit/listview.c +++ b/programs/regedit/listview.c @@ -152,23 +152,27 @@ void format_value_data(HWND hwndLV, int index, DWORD type, void *data, DWORD siz int AddEntryToList(HWND hwndLV, WCHAR *Name, DWORD dwValType, void *ValBuf, DWORD dwCount, int pos) { + LINE_INFO *linfo; LVITEMW item = { 0 }; - LINE_INFO* linfo; int index; - linfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LINE_INFO) + dwCount); + linfo = heap_xalloc(sizeof(LINE_INFO)); linfo->dwValType = dwValType; linfo->val_len = dwCount; - CopyMemory(&linfo[1], ValBuf, dwCount); - + if (Name) { linfo->name = heap_xalloc((lstrlenW(Name) + 1) * sizeof(WCHAR)); lstrcpyW(linfo->name, Name); - } else + } + else linfo->name = NULL; + + if (ValBuf && dwCount) { - linfo->name = NULL; + linfo->val = heap_xalloc(dwCount); + memcpy(&linfo->val, ValBuf, dwCount); } + else linfo->val = NULL; item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE; item.iItem = (pos == -1) ? SendMessageW(hwndLV, LVM_GETITEMCOUNT, 0, 0) : pos;
1
0
0
0
Hugh McMaster : regedit: Use the heap_*() functions in treeview.c where possible.
by Alexandre Julliard
28 Jul '17
28 Jul '17
Module: wine Branch: master Commit: 793ddc992ce494f96631dc8bc21398d995dd04e7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=793ddc992ce494f96631dc8bc…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Fri Jul 28 13:22:18 2017 +0000 regedit: Use the heap_*() functions in treeview.c where possible. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/treeview.c | 70 ++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 39 deletions(-) diff --git a/programs/regedit/treeview.c b/programs/regedit/treeview.c index d11793c..77befb5 100644 --- a/programs/regedit/treeview.c +++ b/programs/regedit/treeview.c @@ -51,7 +51,6 @@ static BOOL get_item_path(HWND hwndTV, HTREEITEM hItem, HKEY* phKey, LPWSTR* pKe { TVITEMW item; int maxChars, chars; - LPWSTR newStr; HTREEITEM hParent; item.mask = TVIF_PARAM; @@ -82,10 +81,9 @@ static BOOL get_item_path(HWND hwndTV, HTREEITEM hItem, HKEY* phKey, LPWSTR* pKe *pPathLen += chars; break; } - newStr = HeapReAlloc(GetProcessHeap(), 0, *pKeyPath, *pMaxChars * 2); - if (!newStr) return FALSE; - *pKeyPath = newStr; + *pMaxChars *= 2; + *pKeyPath = heap_xrealloc(*pKeyPath, *pMaxChars); } while(TRUE); return TRUE; @@ -101,7 +99,7 @@ LPWSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey) if (!hItem) return NULL; } - pathBuffer = HeapAlloc(GetProcessHeap(), 0, maxLen*sizeof(WCHAR)); + pathBuffer = heap_xalloc(maxLen * sizeof(WCHAR)); if (!pathBuffer) return NULL; *pathBuffer = 0; if (!get_item_path(hwndTV, hItem, phRootKey, &pathBuffer, &pathLen, &maxLen)) return NULL; @@ -118,10 +116,10 @@ static LPWSTR get_path_component(LPCWSTR *lplpKeyName) { lpPos++; if (*lpPos && lpPos == *lplpKeyName) return NULL; + len = lpPos+1-(*lplpKeyName); - lpResult = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - if (!lpResult) /* that would be very odd */ - return NULL; + lpResult = heap_xalloc(len * sizeof(WCHAR)); + lstrcpynW(lpResult, *lplpKeyName, len); *lplpKeyName = *lpPos ? lpPos+1 : NULL; return lpResult; @@ -155,7 +153,7 @@ HTREEITEM FindPathInTree(HWND hwndTV, LPCWSTR lpKeyName) { SendMessageW(hwndTV, TVM_EXPAND, TVE_EXPAND, (LPARAM)hItem ); if (!lpKeyName) { - HeapFree(GetProcessHeap(), 0, lpItemName); + heap_free(lpItemName); return hItem; } hOldItem = hItem; @@ -164,7 +162,7 @@ HTREEITEM FindPathInTree(HWND hwndTV, LPCWSTR lpKeyName) { } hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); } - HeapFree(GetProcessHeap(), 0, lpItemName); + heap_free(lpItemName); if (!hItem) return valid_path ? hOldItem : hRoot; } @@ -239,20 +237,20 @@ static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mode, return FALSE; if (RegOpenKeyExW(hRoot, KeyPath, 0, KEY_READ, &hKey) != ERROR_SUCCESS) { - HeapFree(GetProcessHeap(), 0, KeyPath); + heap_free(KeyPath); return FALSE; } - HeapFree(GetProcessHeap(), 0, KeyPath); + heap_free(KeyPath); if (ERROR_SUCCESS != RegQueryInfoKeyW(hKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &lenNameMax, &lenValueMax, NULL, NULL)) return FALSE; lenName = ++lenNameMax; - if (!(valName = HeapAlloc(GetProcessHeap(), 0, lenName * sizeof(valName[0]) ))) - return FALSE; + valName = heap_xalloc(lenName * sizeof(WCHAR)); adjust = 0; + /* RegEnumValue won't return empty default value, so fake it when dealing with *row, which corresponds to list view rows, not value ids */ if (ERROR_SUCCESS == RegEnumValueW(hKey, 0, valName, &lenName, NULL, NULL, NULL, NULL) && *valName) @@ -270,8 +268,8 @@ static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mode, if (mode & SEARCH_VALUES) { if (match_string(valName, sstring, mode)) { - HeapFree(GetProcessHeap(), 0, valName); - HeapFree(GetProcessHeap(), 0, buffer); + heap_free(valName); + heap_free(buffer); RegCloseKey(hKey); *row = i+adjust; return TRUE; @@ -280,16 +278,15 @@ static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mode, if ((mode & SEARCH_CONTENT) && (type == REG_EXPAND_SZ || type == REG_SZ)) { if (!buffer) - buffer = HeapAlloc(GetProcessHeap(), 0, lenValueMax); - if (!buffer) - break; + buffer = heap_xalloc(lenValueMax); + lenName = lenNameMax; lenValue = lenValueMax; if (ERROR_SUCCESS != RegEnumValueW(hKey, i, valName, &lenName, NULL, &type, (LPBYTE)buffer, &lenValue)) break; if (match_string(buffer, sstring, mode)) { - HeapFree(GetProcessHeap(), 0, valName); - HeapFree(GetProcessHeap(), 0, buffer); + heap_free(valName); + heap_free(buffer); RegCloseKey(hKey); *row = i+adjust; return TRUE; @@ -298,8 +295,8 @@ static BOOL match_item(HWND hwndTV, HTREEITEM hItem, LPCWSTR sstring, int mode, i++; } - HeapFree(GetProcessHeap(), 0, valName); - HeapFree(GetProcessHeap(), 0, buffer); + heap_free(valName); + heap_free(buffer); RegCloseKey(hKey); } return FALSE; @@ -375,7 +372,7 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem) } else { hKey = hRoot; } - HeapFree(GetProcessHeap(), 0, KeyPath); + heap_free(KeyPath); if (RegQueryInfoKeyW(hKey, 0, 0, 0, &dwCount, &dwMaxSubKeyLen, 0, 0, 0, 0, 0, 0) != ERROR_SUCCESS) { return FALSE; @@ -396,14 +393,10 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem) } dwMaxSubKeyLen++; /* account for the \0 terminator */ - if (!(Name = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(WCHAR)))) { - return FALSE; - } + Name = heap_xalloc(dwMaxSubKeyLen * sizeof(WCHAR)); + tvItem.cchTextMax = dwMaxSubKeyLen; - if (!(tvItem.pszText = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(WCHAR)))) { - HeapFree(GetProcessHeap(), 0, Name); - return FALSE; - } + tvItem.pszText = heap_xalloc(dwMaxSubKeyLen * sizeof(WCHAR)); /* Now go through all the children in the registry, and check if any have to be added. */ for (dwIndex = 0; dwIndex < dwCount; dwIndex++) { @@ -430,8 +423,8 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem) tvItem.mask = TVIF_TEXT; tvItem.hItem = childItem; if (!TreeView_GetItemW(hwndTV, &tvItem)) { - HeapFree(GetProcessHeap(), 0, Name); - HeapFree(GetProcessHeap(), 0, tvItem.pszText); + heap_free(Name); + heap_free(tvItem.pszText); return FALSE; } @@ -446,8 +439,8 @@ static BOOL RefreshTreeItem(HWND hwndTV, HTREEITEM hItem) AddEntryToTree(hwndTV, hItem, Name, NULL, dwSubCount); } } - HeapFree(GetProcessHeap(), 0, Name); - HeapFree(GetProcessHeap(), 0, tvItem.pszText); + heap_free(Name); + heap_free(tvItem.pszText); RegCloseKey(hKey); /* Now go through all the children in the tree, and check if any have to be removed. */ @@ -658,8 +651,7 @@ BOOL UpdateExpandingTree(HWND hwndTV, HTREEITEM hItem, int state) errCode = RegQueryInfoKeyW(hNewKey, 0, 0, 0, &dwCount, &dwMaxSubKeyLen, 0, 0, 0, 0, 0, 0); if (errCode != ERROR_SUCCESS) goto done; dwMaxSubKeyLen++; /* account for the \0 terminator */ - Name = HeapAlloc(GetProcessHeap(), 0, dwMaxSubKeyLen * sizeof(WCHAR)); - if (!Name) goto done; + Name = heap_xalloc(dwMaxSubKeyLen * sizeof(WCHAR)); for (dwIndex = 0; dwIndex < dwCount; dwIndex++) { DWORD cName = dwMaxSubKeyLen, dwSubCount; @@ -675,7 +667,7 @@ BOOL UpdateExpandingTree(HWND hwndTV, HTREEITEM hItem, int state) AddEntryToTree(hwndTV, hItem, Name, NULL, dwSubCount); } RegCloseKey(hNewKey); - HeapFree(GetProcessHeap(), 0, Name); + heap_free(Name); done: item.mask = TVIF_STATE; @@ -686,7 +678,7 @@ done: SendMessageW(hwndTV, WM_SETREDRAW, TRUE, 0); SetCursor(hcursorOld); expanding = FALSE; - HeapFree(GetProcessHeap(), 0, keyPath); + heap_free(keyPath); return TRUE; }
1
0
0
0
Hugh McMaster : regedit: Use the heap_*() functions in listview.c where possible.
by Alexandre Julliard
28 Jul '17
28 Jul '17
Module: wine Branch: master Commit: e0a527ab43e02596ad17be2407aa7232ceadbd2f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e0a527ab43e02596ad17be240…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Fri Jul 28 13:22:10 2017 +0000 regedit: Use the heap_*() functions in listview.c where possible. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/listview.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/programs/regedit/listview.c b/programs/regedit/listview.c index 72ab464..238a2c7 100644 --- a/programs/regedit/listview.c +++ b/programs/regedit/listview.c @@ -26,6 +26,7 @@ #include <stdio.h> #include "main.h" +#include "regproc.h" #include "wine/unicode.h" static INT Image_String; @@ -48,21 +49,18 @@ static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCF LPWSTR GetItemText(HWND hwndLV, UINT item) { - LPWSTR newStr, curStr; + WCHAR *curStr; unsigned int maxLen = 128; if (item == 0) return NULL; /* first item is ALWAYS a default */ - curStr = HeapAlloc(GetProcessHeap(), 0, maxLen * sizeof(WCHAR)); - if (!curStr) return NULL; + curStr = heap_xalloc(maxLen * sizeof(WCHAR)); do { ListView_GetItemTextW(hwndLV, item, 0, curStr, maxLen); if (lstrlenW(curStr) < maxLen - 1) return curStr; maxLen *= 2; - newStr = HeapReAlloc(GetProcessHeap(), 0, curStr, maxLen * sizeof(WCHAR)); - if (!newStr) break; - curStr = newStr; + curStr = heap_xrealloc(curStr, maxLen * sizeof(WCHAR)); } while (TRUE); - HeapFree(GetProcessHeap(), 0, curStr); + heap_free(curStr); return NULL; } @@ -71,7 +69,7 @@ LPCWSTR GetValueName(HWND hwndLV) INT item; if (g_valueName != LPSTR_TEXTCALLBACKW) - HeapFree(GetProcessHeap(), 0, g_valueName); + heap_free(g_valueName); g_valueName = NULL; item = SendMessageW(hwndLV, LVM_GETNEXTITEM, -1, MAKELPARAM(LVNI_FOCUSED, 0)); @@ -84,10 +82,9 @@ LPCWSTR GetValueName(HWND hwndLV) BOOL update_listview_path(const WCHAR *path) { - HeapFree(GetProcessHeap(), 0, g_currentPath); + heap_free(g_currentPath); - g_currentPath = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(path) + 1) * sizeof(WCHAR)); - if (!g_currentPath) return FALSE; + g_currentPath = heap_xalloc((lstrlenW(path) + 1) * sizeof(WCHAR)); lstrcpyW(g_currentPath, path); return TRUE; @@ -141,13 +138,13 @@ void format_value_data(HWND hwndLV, int index, DWORD type, void *data, DWORD siz { unsigned int i; BYTE *pData = data; - WCHAR *strBinary = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR) * 3 + sizeof(WCHAR)); + WCHAR *strBinary = heap_xalloc(size * sizeof(WCHAR) * 3 + sizeof(WCHAR)); WCHAR format[] = {'%','0','2','X',' ',0}; for (i = 0; i < size; i++) wsprintfW( strBinary + i*3, format, pData[i] ); strBinary[size * 3] = 0; ListView_SetItemTextW(hwndLV, index, 2, strBinary); - HeapFree(GetProcessHeap(), 0, strBinary); + heap_free(strBinary); break; } } @@ -166,7 +163,7 @@ int AddEntryToList(HWND hwndLV, WCHAR *Name, DWORD dwValType, void *ValBuf, DWOR if (Name) { - linfo->name = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(Name) + 1) * sizeof(WCHAR)); + linfo->name = heap_xalloc((lstrlenW(Name) + 1) * sizeof(WCHAR)); lstrcpyW(linfo->name, Name); } else { @@ -412,12 +409,8 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR highli max_val_name_len++; max_val_size++; - valName = HeapAlloc(GetProcessHeap(), 0, max_val_name_len * sizeof(WCHAR)); - if (!valName) - goto done; - valBuf = HeapAlloc(GetProcessHeap(), 0, max_val_size); - if (!valBuf) - goto done; + valName = heap_xalloc(max_val_name_len * sizeof(WCHAR)); + valBuf = heap_xalloc(max_val_size); valSize = max_val_size; if (RegQueryValueExW(hKey, NULL, NULL, &valType, valBuf, &valSize) == ERROR_FILE_NOT_FOUND) { @@ -449,8 +442,8 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR highli result = TRUE; done: - HeapFree(GetProcessHeap(), 0, valBuf); - HeapFree(GetProcessHeap(), 0, valName); + heap_free(valBuf); + heap_free(valName); SendMessageW(hwndLV, WM_SETREDRAW, TRUE, 0); if (hKey) RegCloseKey(hKey);
1
0
0
0
Andrew Eikum : gdiplus: Implement stub for GdipGraphicsSetAbort.
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: 1744277bee3c3c77ae657f42d8fac466cfac7924 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1744277bee3c3c77ae657f42d…
Author: Andrew Eikum <aeikum(a)codeweavers.com> Date: Thu Jul 27 08:35:33 2017 -0500 gdiplus: Implement stub for GdipGraphicsSetAbort. Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/graphics.c | 13 +++++++++++++ dlls/gdiplus/tests/graphics.c | 34 ++++++++++++++++++++++++++++++++++ include/gdiplusflat.h | 1 + 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index dd8d909..25b27e7 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -622,7 +622,7 @@ 622 stdcall GdipBitmapGetHistogramSize(long ptr) 623 stdcall GdipBitmapConvertFormat(ptr long long long ptr float) 624 stdcall GdipImageSetAbort(ptr ptr) -625 stub GdipGraphicsSetAbort +625 stdcall GdipGraphicsSetAbort(ptr ptr) 626 stub GdipDrawImageFX 627 stdcall GdipConvertToEmfPlus(ptr ptr ptr long ptr ptr) 628 stdcall GdipConvertToEmfPlusToFile(ptr ptr ptr ptr long ptr ptr) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 543593e..4b2ae49 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -7147,3 +7147,16 @@ GpStatus WINGDIPAPI GdipResetPageTransform(GpGraphics *graphics) return NotImplemented; } + +GpStatus WINGDIPAPI GdipGraphicsSetAbort(GpGraphics *graphics, GdiplusAbort *pabort) +{ + TRACE("(%p, %p)\n", graphics, pabort); + + if (!graphics) + return InvalidParameter; + + if (pabort) + FIXME("Abort callback is not supported.\n"); + + return Ok; +} diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 4dcfac8..6802184 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -29,6 +29,8 @@ #define expectf_(expected, got, precision) ok(fabs((expected) - (got)) <= (precision), "Expected %f, got %f\n", (expected), (got)) #define expectf(expected, got) expectf_((expected), (got), 0.001) +static GpStatus (WINAPI *pGdipGraphicsSetAbort)(GpGraphics*,GdiplusAbort*); + static const REAL mm_per_inch = 25.4; static const REAL point_per_inch = 72.0; static HWND hwnd; @@ -6149,11 +6151,40 @@ static void test_container_rects(void) ReleaseDC(hwnd, hdc); } +static void test_GdipGraphicsSetAbort(void) +{ + HDC hdc; + GpStatus status; + GpGraphics *graphics; + + if (!pGdipGraphicsSetAbort) + { + win_skip("GdipGraphicsSetAbort() is not supported.\n"); + return; + } + + hdc = GetDC(hwnd); + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + + status = pGdipGraphicsSetAbort(NULL, NULL); + expect(InvalidParameter, status); + + status = pGdipGraphicsSetAbort(graphics, NULL); + expect(Ok, status); + + GdipDeleteGraphics(graphics); + + ReleaseDC(hwnd, hdc); +} + START_TEST(graphics) { struct GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; WNDCLASSA class; + HMODULE gdiplus_mod = GetModuleHandleA("gdiplus.dll"); HMODULE hmsvcrt; int (CDECL * _controlfp_s)(unsigned int *cur, unsigned int newval, unsigned int mask); @@ -6162,6 +6193,8 @@ START_TEST(graphics) _controlfp_s = (void*)GetProcAddress(hmsvcrt, "_controlfp_s"); if (_controlfp_s) _controlfp_s(0, 0, 0x0008001e); + pGdipGraphicsSetAbort = (void*)GetProcAddress(gdiplus_mod, "GdipGraphicsSetAbort"); + memset( &class, 0, sizeof(class) ); class.lpszClassName = "gdiplus_test"; class.style = CS_HREDRAW | CS_VREDRAW; @@ -6230,6 +6263,7 @@ START_TEST(graphics) test_GdipFillRectangles(); test_GdipGetVisibleClipBounds_memoryDC(); test_container_rects(); + test_GdipGraphicsSetAbort(); GdiplusShutdown(gdiplusToken); DestroyWindow( hwnd ); diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 6e5b23f..10d537a 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -263,6 +263,7 @@ GpStatus WINGDIPAPI GdipGetTextContrast(GpGraphics*,UINT*); GpStatus WINGDIPAPI GdipGetTextRenderingHint(GpGraphics*,TextRenderingHint*); GpStatus WINGDIPAPI GdipGetWorldTransform(GpGraphics*,GpMatrix*); GpStatus WINGDIPAPI GdipGraphicsClear(GpGraphics*,ARGB); +GpStatus WINGDIPAPI GdipGraphicsSetAbort(GpGraphics*,GdiplusAbort*); GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics*,GpRectF*); GpStatus WINGDIPAPI GdipGetVisibleClipBoundsI(GpGraphics*,GpRect*); GpStatus WINGDIPAPI GdipIsClipEmpty(GpGraphics*, BOOL*);
1
0
0
0
Alex Henrie : msvcr120: Don't double-check error conditions in log2f.
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: 417b2a4f52ff1d416621c41fd21f52c505ea245a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=417b2a4f52ff1d416621c41fd…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Thu Jul 27 02:26:22 2017 -0600 msvcr120: Don't double-check error conditions in log2f. Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/math.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 079446d..1d61396 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -2510,9 +2510,9 @@ double CDECL MSVCR120_log2(double x) */ float CDECL MSVCR120_log2f(float x) { +#ifdef HAVE_LOG2F if (x < 0) *MSVCRT__errno() = MSVCRT_EDOM; else if (x == 0) *MSVCRT__errno() = MSVCRT_ERANGE; -#ifdef HAVE_LOG2F return log2f(x); #else return MSVCR120_log2(x);
1
0
0
0
Hugh McMaster : regedit: Remove commented code from resize_frame_rect().
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: 792e7046a6e9e1507abd947010fe1976a9765cf4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=792e7046a6e9e1507abd94701…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Thu Jul 27 12:26:09 2017 +0000 regedit: Remove commented code from resize_frame_rect(). Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/framewnd.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/programs/regedit/framewnd.c b/programs/regedit/framewnd.c index c3cc996..b82eb10 100644 --- a/programs/regedit/framewnd.c +++ b/programs/regedit/framewnd.c @@ -57,16 +57,9 @@ static WCHAR modifyW[32], modify_binaryW[64]; static void resize_frame_rect(HWND hWnd, PRECT prect) { - RECT rt; - /* - if (IsWindowVisible(hToolBar)) { - SendMessageW(hToolBar, WM_SIZE, 0, 0); - GetClientRect(hToolBar, &rt); - prect->top = rt.bottom+3; - prect->bottom -= rt.bottom+3; - } - */ if (IsWindowVisible(hStatusBar)) { + RECT rt; + SetupStatusBar(hWnd, TRUE); GetClientRect(hStatusBar, &rt); prect->bottom -= rt.bottom;
1
0
0
0
Hugh McMaster : regedit: Use the heap_*() functions in regedit.c where possible.
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: 9be3c537011c9edbfd5182c13cb440a0234355bf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9be3c537011c9edbfd5182c13…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Thu Jul 27 12:25:53 2017 +0000 regedit: Use the heap_*() functions in regedit.c where possible. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/regedit.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/programs/regedit/regedit.c b/programs/regedit/regedit.c index c563628..4dd889b 100644 --- a/programs/regedit/regedit.c +++ b/programs/regedit/regedit.c @@ -42,12 +42,11 @@ static void output_writeconsole(const WCHAR *str, DWORD wlen) * we should call WriteFile() and assume the console encoding is still correct. */ len = WideCharToMultiByte(GetConsoleOutputCP(), 0, str, wlen, NULL, 0, NULL, NULL); - msgA = HeapAlloc(GetProcessHeap(), 0, len); - if (!msgA) return; + msgA = heap_xalloc(len); WideCharToMultiByte(GetConsoleOutputCP(), 0, str, wlen, msgA, len, NULL, NULL); WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), msgA, len, &count, FALSE); - HeapFree(GetProcessHeap(), 0, msgA); + heap_free(msgA); } } @@ -123,13 +122,13 @@ static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i) size = SearchPathW(NULL, filename, NULL, 0, NULL, NULL); if (size > 0) { - realname = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR)); + realname = heap_xalloc(size * sizeof(WCHAR)); size = SearchPathW(NULL, filename, NULL, size, realname, NULL); } if (size == 0) { output_message(STRING_FILE_NOT_FOUND, filename); - HeapFree(GetProcessHeap(), 0, realname); + heap_free(realname); return; } reg_file = _wfopen(realname, rb_mode); @@ -138,14 +137,14 @@ static void PerformRegAction(REGEDIT_ACTION action, WCHAR **argv, int *i) WCHAR regedit[] = {'r','e','g','e','d','i','t',0}; _wperror(regedit); output_message(STRING_CANNOT_OPEN_FILE, filename); - HeapFree(GetProcessHeap(), 0, realname); + heap_free(realname); return; } } import_registry_file(reg_file); if (realname) { - HeapFree(GetProcessHeap(), 0, realname); + heap_free(realname); fclose(reg_file); } break;
1
0
0
0
Hugh McMaster : regedit: Use the heap_*() functions in framewnd.c where possible.
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: a3e043b82e53b525bf171689d3a3497b8184cab1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a3e043b82e53b525bf171689d…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Thu Jul 27 12:25:35 2017 +0000 regedit: Use the heap_*() functions in framewnd.c where possible. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/framewnd.c | 41 ++++++++++++++++++++--------------------- programs/regedit/regproc.h | 9 --------- 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/programs/regedit/framewnd.c b/programs/regedit/framewnd.c index 361da7e..c3cc996 100644 --- a/programs/regedit/framewnd.c +++ b/programs/regedit/framewnd.c @@ -197,7 +197,7 @@ static void UpdateMenuItems(HMENU hMenu) { EnableMenuItem(hMenu, ID_FAVORITES_REMOVEFAVORITE, (GetMenuItemCount(hMenu)>2 ? MF_ENABLED : MF_GRAYED) | MF_BYCOMMAND); - HeapFree(GetProcessHeap(), 0, keyName); + heap_free(keyName); } static void add_remove_modify_menu_items(HMENU hMenu) @@ -236,8 +236,7 @@ static int add_favourite_key_items(HMENU hMenu, HWND hList) if (!num_values) goto exit; max_value_len++; - value_name = HeapAlloc(GetProcessHeap(), 0, max_value_len * sizeof(WCHAR)); - CHECK_ENOUGH_MEMORY(value_name); + value_name = heap_xalloc(max_value_len * sizeof(WCHAR)); if (hMenu) AppendMenuW(hMenu, MF_SEPARATOR, 0, 0); @@ -254,7 +253,7 @@ static int add_favourite_key_items(HMENU hMenu, HWND hList) } } - HeapFree(GetProcessHeap(), 0, value_name); + heap_free(value_name); exit: RegCloseKey(hkey); return i; @@ -313,7 +312,7 @@ void UpdateStatusBar(void) { LPWSTR fullPath = GetItemFullPath(g_pChildWnd->hTreeWnd, NULL, TRUE); SendMessageW(hStatusBar, SB_SETTEXTW, 0, (LPARAM)fullPath); - HeapFree(GetProcessHeap(), 0, fullPath); + heap_free(fullPath); } static void toggle_child(HWND hWnd, UINT cmd, HWND hchild) @@ -371,7 +370,7 @@ static void ExportRegistryFile_StoreSelection(HWND hdlg, OPENFILENAMEW *pOpenFil if (IsDlgButtonChecked(hdlg, IDC_EXPORT_SELECTED)) { INT len = SendDlgItemMessageW(hdlg, IDC_EXPORT_PATH, WM_GETTEXTLENGTH, 0, 0); - pOpenFileName->lCustData = (LPARAM)HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); + pOpenFileName->lCustData = (LPARAM)heap_xalloc((len + 1) * sizeof(WCHAR)); SendDlgItemMessageW(hdlg, IDC_EXPORT_PATH, WM_GETTEXT, len+1, pOpenFileName->lCustData); } else @@ -402,7 +401,7 @@ static UINT_PTR CALLBACK ExportRegistryFile_OFNHookProc(HWND hdlg, UINT uiMsg, W SendDlgItemMessageW(hdlg, IDC_EXPORT_PATH, WM_SETTEXT, 0, (LPARAM)path); if (path && path[0]) export_branch = TRUE; - HeapFree(GetProcessHeap(), 0, path); + heap_free(path); CheckRadioButton(hdlg, IDC_EXPORT_ALL, IDC_EXPORT_SELECTED, export_branch ? IDC_EXPORT_SELECTED : IDC_EXPORT_ALL); break; } @@ -490,7 +489,7 @@ static BOOL ImportRegistryFile(HWND hWnd) key_path = GetItemPath(g_pChildWnd->hTreeWnd, 0, &root_key); RefreshListView(g_pChildWnd->hListWnd, root_key, key_path, NULL); - HeapFree(GetProcessHeap(), 0, key_path); + heap_free(key_path); return TRUE; } @@ -733,13 +732,13 @@ static INT_PTR CALLBACK removefavorite_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w int pos = SendMessageW(hwndList, LB_GETCURSEL, 0, 0); int len = SendMessageW(hwndList, LB_GETTEXTLEN, pos, 0); if (len>0) { - LPWSTR lpName = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(len+1)); + WCHAR *lpName = heap_xalloc((len + 1) * sizeof(WCHAR)); SendMessageW(hwndList, LB_GETTEXT, pos, (LPARAM)lpName); if (len>127) lpName[127] = '\0'; lstrcpyW(favoriteName, lpName); EndDialog(hwndDlg, IDOK); - HeapFree(GetProcessHeap(), 0, lpName); + heap_free(lpName); } return TRUE; } @@ -804,7 +803,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } else if (DeleteKey(hWnd, hKeyRoot, keyPath)) { DeleteNode(g_pChildWnd->hTreeWnd, 0); } - HeapFree(GetProcessHeap(), 0, keyPath); + heap_free(keyPath); } else if (hWndDelete == g_pChildWnd->hListWnd) { unsigned int num_selected, index, focus_idx; WCHAR *keyPath; @@ -829,10 +828,10 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) WCHAR *valueName = GetItemText(g_pChildWnd->hListWnd, index); if (!DeleteValue(hWnd, hKeyRoot, keyPath, valueName, num_selected == 1)) { - HeapFree(GetProcessHeap(), 0, valueName); + heap_free(valueName); break; } - HeapFree(GetProcessHeap(), 0, valueName); + heap_free(valueName); SendMessageW(g_pChildWnd->hListWnd, LVM_DELETEITEM, index, 0L); /* the default value item is always visible, so add it back in */ if (!index) @@ -847,7 +846,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } index = SendMessageW(g_pChildWnd->hListWnd, LVM_GETNEXTITEM, -1, MAKELPARAM(LVNI_SELECTED, 0)); } - HeapFree(GetProcessHeap(), 0, keyPath); + heap_free(keyPath); } else if (IsChild(g_pChildWnd->hTreeWnd, hWndDelete) || IsChild(g_pChildWnd->hListWnd, hWndDelete)) { SendMessageW(hWndDelete, WM_KEYDOWN, VK_DELETE, 0); @@ -860,7 +859,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LPCWSTR valueName = GetValueName(g_pChildWnd->hListWnd); WCHAR* keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot); ModifyValue(hWnd, hKeyRoot, keyPath, valueName); - HeapFree(GetProcessHeap(), 0, keyPath); + heap_free(keyPath); break; } case ID_EDIT_FIND: @@ -907,7 +906,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LPWSTR fullPath = GetItemFullPath(g_pChildWnd->hTreeWnd, NULL, FALSE); if (fullPath) { CopyKeyName(hWnd, fullPath); - HeapFree(GetProcessHeap(), 0, fullPath); + heap_free(fullPath); } break; } @@ -919,7 +918,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if (InsertNode(g_pChildWnd->hTreeWnd, 0, newKeyW)) StartKeyRename(g_pChildWnd->hTreeWnd); } - HeapFree(GetProcessHeap(), 0, keyPath); + heap_free(keyPath); } break; case ID_EDIT_NEW_STRINGVALUE: @@ -943,7 +942,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) WCHAR newKey[MAX_NEW_KEY_LEN]; if (CreateValue(hWnd, hKeyRoot, keyPath, valueType, newKey)) StartValueRename(g_pChildWnd->hListWnd); - HeapFree(GetProcessHeap(), 0, keyPath); + heap_free(keyPath); } break; case ID_EDIT_RENAME: @@ -956,7 +955,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } else if (GetFocus() == g_pChildWnd->hListWnd) { StartValueRename(g_pChildWnd->hListWnd); } - HeapFree(GetProcessHeap(), 0, keyPath); + heap_free(keyPath); break; } case ID_TREE_EXPAND_COLLAPSE: @@ -989,7 +988,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) RegCloseKey(hKey); } } - HeapFree(GetProcessHeap(), 0, lpKeyPath); + heap_free(lpKeyPath); } break; } @@ -1010,7 +1009,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) WCHAR* keyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot); RefreshTreeView(g_pChildWnd->hTreeWnd); RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, NULL); - HeapFree(GetProcessHeap(), 0, keyPath); + heap_free(keyPath); } break; /*case ID_OPTIONS_TOOLBAR:*/ diff --git a/programs/regedit/regproc.h b/programs/regedit/regproc.h index 469e988..4031255 100644 --- a/programs/regedit/regproc.h +++ b/programs/regedit/regproc.h @@ -24,15 +24,6 @@ #define REG_FORMAT_5 1 #define REG_FORMAT_4 2 -#define NOT_ENOUGH_MEMORY 1 - -#define CHECK_ENOUGH_MEMORY(p) \ -if (!(p)) \ -{ \ - output_message(STRING_OUT_OF_MEMORY, __FILE__, __LINE__); \ - exit(NOT_ENOUGH_MEMORY); \ -} - void __cdecl output_message(unsigned int id, ...); void __cdecl error_exit(unsigned int id, ...);
1
0
0
0
Hugh McMaster : regedit: Use the heap_*() functions in edit.c where possible.
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: 6238cd46f21c99a95825240b693565c6a7d63b53 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6238cd46f21c99a95825240b6…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Thu Jul 27 12:25:26 2017 +0000 regedit: Use the heap_*() functions in edit.c where possible. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/edit.c | 44 ++++++++++++++++++-------------------------- programs/regedit/regproc.c | 2 +- programs/regedit/regproc.h | 1 + 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/programs/regedit/edit.c b/programs/regedit/edit.c index 038a37a..c72f39d 100644 --- a/programs/regedit/edit.c +++ b/programs/regedit/edit.c @@ -101,7 +101,6 @@ static BOOL change_dword_base(HWND hwndDlg, BOOL toHex) static INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - WCHAR* valueData; HWND hwndValue; int len; @@ -122,12 +121,10 @@ static INT_PTR CALLBACK modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case IDOK: if ((hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA))) { len = GetWindowTextLengthW(hwndValue); - if ((valueData = HeapReAlloc(GetProcessHeap(), 0, stringValueData, (len + 1) * sizeof(WCHAR)))) { - stringValueData = valueData; - if (!GetWindowTextW(hwndValue, stringValueData, len + 1)) - *stringValueData = 0; + stringValueData = heap_xrealloc(stringValueData, (len + 1) * sizeof(WCHAR)); + if (!GetWindowTextW(hwndValue, stringValueData, len + 1)) + *stringValueData = 0; } - } /* Fall through */ case IDCANCEL: EndDialog(hwndDlg, wParam); @@ -159,13 +156,13 @@ static INT_PTR CALLBACK bin_modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wPara case IDOK: params = (struct edit_params *)GetWindowLongPtrW(hwndDlg, DWLP_USER); cbData = SendDlgItemMessageW(hwndDlg, IDC_VALUE_DATA, HEM_GETDATA, 0, 0); - pData = HeapAlloc(GetProcessHeap(), 0, cbData); + pData = heap_xalloc(cbData); if (pData) { SendDlgItemMessageW(hwndDlg, IDC_VALUE_DATA, HEM_GETDATA, (WPARAM)cbData, (LPARAM)pData); lRet = RegSetValueExW(params->hKey, params->lpszValueName, 0, REG_BINARY, pData, cbData); - HeapFree(GetProcessHeap(), 0, pData); + heap_free(pData); } else lRet = ERROR_OUTOFMEMORY; @@ -206,7 +203,7 @@ static LPWSTR read_value(HWND hwnd, HKEY hKey, LPCWSTR valueName, DWORD *lpType, if (lRet == ERROR_FILE_NOT_FOUND && !valueName) { /* no default value here, make it up */ if (len) *len = 1; if (lpType) *lpType = REG_SZ; - buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)); + buffer = heap_xalloc(sizeof(WCHAR)); *buffer = '\0'; return buffer; } @@ -214,10 +211,7 @@ static LPWSTR read_value(HWND hwnd, HKEY hKey, LPCWSTR valueName, DWORD *lpType, goto done; } if ( *lpType == REG_DWORD ) valueDataLen = sizeof(DWORD); - if (!(buffer = HeapAlloc(GetProcessHeap(), 0, valueDataLen+sizeof(WCHAR)))) { - error_code_messagebox(hwnd, IDS_TOO_BIG_VALUE, valueDataLen); - goto done; - } + buffer = heap_xalloc(valueDataLen + sizeof(WCHAR)); lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)buffer, &valueDataLen); if (lRet != ERROR_SUCCESS) { error_code_messagebox(hwnd, IDS_BAD_VALUE, valueName); @@ -229,7 +223,7 @@ static LPWSTR read_value(HWND hwnd, HKEY hKey, LPCWSTR valueName, DWORD *lpType, return buffer; done: - HeapFree(GetProcessHeap(), 0, buffer); + heap_free(buffer); return NULL; } @@ -307,7 +301,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName) if (lRet == ERROR_SUCCESS) result = TRUE; else error_code_messagebox(hwnd, IDS_SET_VALUE_FAILED); } - HeapFree(GetProcessHeap(), 0, valueA); + heap_free(valueA); } } else if ( type == REG_BINARY ) { struct edit_params params; @@ -325,8 +319,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName) for ( i = 0, count = 0; i < len - 1; i++) if ( !stringValueData[i] && stringValueData[i + 1] ) count++; - tmpValueData = HeapAlloc( GetProcessHeap(), 0, ( len + count ) * sizeof(WCHAR)); - if ( !tmpValueData ) goto done; + tmpValueData = heap_xalloc((len + count) * sizeof(WCHAR)); for ( i = 0, j = 0; i < len - 1; i++) { @@ -339,15 +332,14 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName) tmpValueData[j++] = stringValueData[i]; } tmpValueData[j] = stringValueData[i]; - HeapFree( GetProcessHeap(), 0, stringValueData); + heap_free(stringValueData); stringValueData = tmpValueData; tmpValueData = NULL; if (DialogBoxW(0, MAKEINTRESOURCEW(IDD_EDIT_MULTI_STRING), hwnd, modify_dlgproc) == IDOK) { len = lstrlenW( stringValueData ); - tmpValueData = HeapAlloc( GetProcessHeap(), 0, (len + 2) * sizeof(WCHAR)); - if ( !tmpValueData ) goto done; + tmpValueData = heap_xalloc((len + 2) * sizeof(WCHAR)); for ( i = 0, j = 0; i < len - 1; i++) { @@ -363,7 +355,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName) tmpValueData[j++] = stringValueData[i]; tmpValueData[j++] = 0; tmpValueData[j++] = 0; - HeapFree( GetProcessHeap(), 0, stringValueData); + heap_free(stringValueData); stringValueData = tmpValueData; lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)stringValueData, j * sizeof(WCHAR)); @@ -379,13 +371,13 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName) { int index = SendMessageW(g_pChildWnd->hListWnd, LVM_GETNEXTITEM, -1, MAKELPARAM(LVNI_FOCUSED | LVNI_SELECTED, 0)); - HeapFree(GetProcessHeap(), 0, stringValueData); + heap_free(stringValueData); stringValueData = read_value(hwnd, hKey, valueName, &type, &len); format_value_data(g_pChildWnd->hListWnd, index, type, stringValueData, len); } done: - HeapFree(GetProcessHeap(), 0, stringValueData); + heap_free(stringValueData); stringValueData = NULL; RegCloseKey(hKey); return result; @@ -535,7 +527,7 @@ BOOL RenameValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR oldName, LPC result = TRUE; done: - HeapFree(GetProcessHeap(), 0, value); + heap_free(value); RegCloseKey(hKey); return result; } @@ -559,7 +551,7 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName) } else { LPWSTR srcSubKey_copy; - parentPath = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(keyPath)+1)*sizeof(WCHAR)); + parentPath = heap_xalloc((lstrlenW(keyPath) + 1) * sizeof(WCHAR)); lstrcpyW(parentPath, keyPath); srcSubKey_copy = strrchrW(parentPath, '\\'); *srcSubKey_copy = 0; @@ -604,7 +596,7 @@ done: RegCloseKey(destKey); if (parentKey) { RegCloseKey(parentKey); - HeapFree(GetProcessHeap(), 0, parentPath); + heap_free(parentPath); } return result; } diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index aae7738..3f055b6 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -55,7 +55,7 @@ void *heap_xalloc(size_t size) return buf; } -static void *heap_xrealloc(void *buf, size_t size) +void *heap_xrealloc(void *buf, size_t size) { void *new_buf; diff --git a/programs/regedit/regproc.h b/programs/regedit/regproc.h index a0ed438..469e988 100644 --- a/programs/regedit/regproc.h +++ b/programs/regedit/regproc.h @@ -38,6 +38,7 @@ void __cdecl error_exit(unsigned int id, ...); char *GetMultiByteString(const WCHAR *strW); void *heap_xalloc(size_t size); +void *heap_xrealloc(void *buf, size_t size); BOOL heap_free(void *buf); BOOL import_registry_file(FILE *reg_file); void delete_registry_key(WCHAR *reg_key_name);
1
0
0
0
← Newer
1
2
3
4
5
...
64
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Results per page:
10
25
50
100
200