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
Hugh McMaster : regedit: Use the heap_*() functions in childwnd.c where possible.
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: c193bffb3e1210e5575544f5f045b95560fbf950 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c193bffb3e1210e5575544f5f…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Thu Jul 27 12:25:17 2017 +0000 regedit: Use the heap_*() functions in childwnd.c where possible. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/childwnd.c | 26 +++++++++++++------------- programs/regedit/regproc.c | 4 ++-- programs/regedit/regproc.h | 8 +++++--- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/programs/regedit/childwnd.c b/programs/regedit/childwnd.c index f2359c4..d6a7d51 100644 --- a/programs/regedit/childwnd.c +++ b/programs/regedit/childwnd.c @@ -109,7 +109,7 @@ static LPWSTR CombinePaths(LPCWSTR pPaths[], int nPaths) { len += lstrlenW(pPaths[i])+1; } } - combined = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + combined = heap_xalloc(len * sizeof(WCHAR)); *combined = '\0'; for (i=0, pos=0; i<nPaths; i++) { if (pPaths[i] && *pPaths[i]) { @@ -132,7 +132,7 @@ static LPWSTR GetPathRoot(HWND hwndTV, HTREEITEM hItem, BOOL bFull) { HKEY hRootKey = NULL; if (!hItem) hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_CARET, 0); - HeapFree(GetProcessHeap(), 0, GetItemPath(hwndTV, hItem, &hRootKey)); + heap_free(GetItemPath(hwndTV, hItem, &hRootKey)); if (!bFull && !hRootKey) return NULL; if (hRootKey) @@ -153,8 +153,8 @@ LPWSTR GetItemFullPath(HWND hwndTV, HTREEITEM hItem, BOOL bFull) { parts[0] = GetPathRoot(hwndTV, hItem, bFull); parts[1] = GetItemPath(hwndTV, hItem, &hRootKey); ret = CombinePaths((LPCWSTR *)parts, 2); - HeapFree(GetProcessHeap(), 0, parts[0]); - HeapFree(GetProcessHeap(), 0, parts[1]); + heap_free(parts[0]); + heap_free(parts[1]); return ret; } @@ -175,7 +175,7 @@ static void OnTreeSelectionChanged(HWND hwndTV, HWND hwndLV, HTREEITEM hItem, BO keyPath = GetItemPath(hwndTV, hItem, &hRootKey); RefreshListView(hwndLV, hRootKey, keyPath, NULL); - HeapFree(GetProcessHeap(), 0, keyPath); + heap_free(keyPath); } UpdateStatusBar(); } @@ -277,7 +277,7 @@ static void set_last_key(HWND hwndTV) value = GetItemFullPath(g_pChildWnd->hTreeWnd, selection, FALSE); RegSetValueExW(hkey, wszLastKey, 0, REG_SZ, (LPBYTE)value, (lstrlenW(value) + 1) * sizeof(WCHAR)); if (selection != root) - HeapFree(GetProcessHeap(), 0, value); + heap_free(value); RegCloseKey(hkey); } } @@ -309,7 +309,7 @@ static int treeview_notify(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam WCHAR *path = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey); BOOL res = RenameKey(hWnd, hRootKey, path, dispInfo->item.pszText); - HeapFree(GetProcessHeap(), 0, path); + heap_free(path); if (res) { @@ -322,7 +322,7 @@ static int treeview_notify(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam path = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey); update_listview_path(path); - HeapFree(GetProcessHeap(), 0, path); + heap_free(path); UpdateStatusBar(); } @@ -396,8 +396,8 @@ static int listview_notify(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; LINE_INFO *info = (LINE_INFO *)nmlv->lParam; - HeapFree(GetProcessHeap(), 0, info->name); - HeapFree(GetProcessHeap(), 0, info); + heap_free(info->name); + heap_free(info); break; } case LVN_ENDLABELEDITW: @@ -416,7 +416,7 @@ static int listview_notify(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam dispInfo->item.iItem, (LPARAM)&dispInfo->item); } - HeapFree(GetProcessHeap(), 0, oldName); + heap_free(oldName); return 0; } case LVN_GETDISPINFOW: @@ -444,7 +444,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa { switch (message) { case WM_CREATE: - g_pChildWnd = HeapAlloc(GetProcessHeap(), 0, sizeof(ChildWnd)); + g_pChildWnd = heap_xalloc(sizeof(ChildWnd)); if (!g_pChildWnd) return 0; LoadStringW(hInst, IDS_REGISTRY_ROOT_NAME, g_pChildWnd->szPath, MAX_PATH); g_pChildWnd->nSplitPos = 250; @@ -476,7 +476,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa goto def; case WM_DESTROY: set_last_key(g_pChildWnd->hTreeWnd); - HeapFree(GetProcessHeap(), 0, g_pChildWnd); + heap_free(g_pChildWnd); g_pChildWnd = NULL; PostQuitMessage(0); break; diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index 6f94c0f..aae7738 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -44,7 +44,7 @@ static HKEY reg_class_keys[] = { #define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A)) -static void *heap_xalloc(size_t size) +void *heap_xalloc(size_t size) { void *buf = HeapAlloc(GetProcessHeap(), 0, size); if (!buf) @@ -73,7 +73,7 @@ static void *heap_xrealloc(void *buf, size_t size) return new_buf; } -static BOOL heap_free(void *buf) +BOOL heap_free(void *buf) { return HeapFree(GetProcessHeap(), 0, buf); } diff --git a/programs/regedit/regproc.h b/programs/regedit/regproc.h index 81ac3e3..a0ed438 100644 --- a/programs/regedit/regproc.h +++ b/programs/regedit/regproc.h @@ -36,7 +36,9 @@ if (!(p)) \ void __cdecl output_message(unsigned int id, ...); void __cdecl error_exit(unsigned int id, ...); -BOOL export_registry_key(WCHAR *file_name, WCHAR *reg_key_name, DWORD format); -BOOL import_registry_file(FILE *in); +char *GetMultiByteString(const WCHAR *strW); +void *heap_xalloc(size_t size); +BOOL heap_free(void *buf); +BOOL import_registry_file(FILE *reg_file); void delete_registry_key(WCHAR *reg_key_name); -CHAR* GetMultiByteString(const WCHAR* strW); +BOOL export_registry_key(WCHAR *file_name, WCHAR *path, DWORD format);
1
0
0
0
Hugh McMaster : regedit: Use heap_xrealloc() for consistency.
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: 1b3afb27c72c2c5ba21a7b334187a0c8f4e604ab URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1b3afb27c72c2c5ba21a7b334…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Thu Jul 27 12:25:07 2017 +0000 regedit: Use heap_xrealloc() for consistency. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/regproc.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index b686714..6f94c0f 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -55,6 +55,24 @@ static void *heap_xalloc(size_t size) return buf; } +static void *heap_xrealloc(void *buf, size_t size) +{ + void *new_buf; + + if (buf) + new_buf = HeapReAlloc(GetProcessHeap(), 0, buf, size); + else + new_buf = HeapAlloc(GetProcessHeap(), 0, size); + + if (!new_buf) + { + ERR("Out of memory!\n"); + exit(1); + } + + return new_buf; +} + static BOOL heap_free(void *buf) { return HeapFree(GetProcessHeap(), 0, buf); @@ -226,19 +244,6 @@ static inline enum parser_state set_state(struct parser *parser, enum parser_sta return ret; } -static void *resize_buffer(void *buf, size_t count) -{ - void *new_buf; - - if (buf) - new_buf = HeapReAlloc(GetProcessHeap(), 0, buf, count); - else - new_buf = HeapAlloc(GetProcessHeap(), 0, count); - - CHECK_ENOUGH_MEMORY(new_buf); - return new_buf; -} - /****************************************************************************** * Converts a hex representation of a DWORD into a DWORD. */ @@ -286,7 +291,7 @@ static BOOL convert_hex_csv_to_hex(struct parser *parser, WCHAR **str) /* The worst case is 1 digit + 1 comma per byte */ size = ((lstrlenW(*str) + 1) / 2) + parser->data_size; - parser->data = resize_buffer(parser->data, size); + parser->data = heap_xrealloc(parser->data, size); s = *str; d = (BYTE *)parser->data + parser->data_size; @@ -985,10 +990,8 @@ static WCHAR *get_lineA(FILE *fp) memmove(buf, next, len + 1); if (size - len < 3) { - char *new_buf = HeapReAlloc(GetProcessHeap(), 0, buf, size * 2); - CHECK_ENOUGH_MEMORY(new_buf); - buf = new_buf; size *= 2; + buf = heap_xrealloc(buf, size); } if (!(count = fread(buf + len, 1, size - len - 1, fp))) { @@ -1043,10 +1046,8 @@ static WCHAR *get_lineW(FILE *fp) memmove(buf, next, (len + 1) * sizeof(WCHAR)); if (size - len < 3) { - WCHAR *new_buf = HeapReAlloc(GetProcessHeap(), 0, buf, (size * 2) * sizeof(WCHAR)); - CHECK_ENOUGH_MEMORY(new_buf); - buf = new_buf; size *= 2; + buf = heap_xrealloc(buf, size * sizeof(WCHAR)); } if (!(count = fread(buf + len, sizeof(WCHAR), size - len - 1, fp))) { @@ -1396,12 +1397,12 @@ static int export_registry_data(FILE *fp, HKEY key, WCHAR *path, BOOL unicode) if (data_size > max_data_bytes) { max_data_bytes = data_size; - data = resize_buffer(data, max_data_bytes); + data = heap_xrealloc(data, max_data_bytes); } else { max_value_len *= 2; - value_name = resize_buffer(value_name, max_value_len * sizeof(WCHAR)); + value_name = heap_xrealloc(value_name, max_value_len * sizeof(WCHAR)); } } else break;
1
0
0
0
Hugh McMaster : regedit: Use a helper function to free allocated memory.
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: f7bdf34029a7f316ea8040ea2da78e38d7e31056 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f7bdf34029a7f316ea8040ea2…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Thu Jul 27 12:24:58 2017 +0000 regedit: Use a helper function to free allocated memory. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/regproc.c | 49 +++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index 4b21478..b686714 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -55,6 +55,11 @@ static void *heap_xalloc(size_t size) return buf; } +static BOOL heap_free(void *buf) +{ + return HeapFree(GetProcessHeap(), 0, buf); +} + /****************************************************************************** * Allocates memory and converts input from multibyte to wide chars * Returned string must be freed by the caller @@ -457,7 +462,7 @@ static void close_key(struct parser *parser) { if (parser->hkey) { - HeapFree(GetProcessHeap(), 0, parser->key_name); + heap_free(parser->key_name); parser->key_name = NULL; RegCloseKey(parser->hkey); @@ -498,7 +503,7 @@ static LONG open_key(struct parser *parser, WCHAR *path) static void free_parser_data(struct parser *parser) { if (parser->parse_type == REG_DWORD || parser->parse_type == REG_BINARY) - HeapFree(GetProcessHeap(), 0, parser->data); + heap_free(parser->data); parser->data = NULL; parser->data_size = 0; @@ -520,7 +525,7 @@ static void prepare_hex_string_data(struct parser *parser) { parser->data = GetWideStringN(parser->data, parser->data_size, &parser->data_size); parser->data_size *= sizeof(WCHAR); - HeapFree(GetProcessHeap(), 0, data); + heap_free(data); } } } @@ -578,7 +583,7 @@ static WCHAR *header_state(struct parser *parser, WCHAR *pos) header[1] = parser->two_wchars[1]; lstrcpyW(header + 2, line); parser->reg_version = parse_file_header(header); - HeapFree(GetProcessHeap(), 0, header); + heap_free(header); } else parser->reg_version = parse_file_header(line); @@ -708,7 +713,7 @@ static WCHAR *delete_key_state(struct parser *parser, WCHAR *pos) /* handler for parser DEFAULT_VALUE_NAME state */ static WCHAR *default_value_name_state(struct parser *parser, WCHAR *pos) { - HeapFree(GetProcessHeap(), 0, parser->value_name); + heap_free(parser->value_name); parser->value_name = NULL; set_state(parser, DATA_START); @@ -722,7 +727,7 @@ static WCHAR *quoted_value_name_state(struct parser *parser, WCHAR *pos) if (parser->value_name) { - HeapFree(GetProcessHeap(), 0, parser->value_name); + heap_free(parser->value_name); parser->value_name = NULL; } @@ -957,7 +962,7 @@ static WCHAR *get_lineA(FILE *fp) static char *buf, *next; char *line; - HeapFree(GetProcessHeap(), 0, lineW); + heap_free(lineW); if (!fp) goto cleanup; @@ -1005,7 +1010,7 @@ static WCHAR *get_lineA(FILE *fp) cleanup: lineW = NULL; - if (size) HeapFree(GetProcessHeap(), 0, buf); + if (size) heap_free(buf); size = 0; return NULL; } @@ -1060,7 +1065,7 @@ static WCHAR *get_lineW(FILE *fp) } cleanup: - if (size) HeapFree(GetProcessHeap(), 0, buf); + if (size) heap_free(buf); size = 0; return NULL; } @@ -1103,7 +1108,7 @@ BOOL import_registry_file(FILE *reg_file) if (parser.reg_version == REG_VERSION_FUZZY || parser.reg_version == REG_VERSION_INVALID) return parser.reg_version == REG_VERSION_FUZZY; - HeapFree(GetProcessHeap(), 0, parser.value_name); + heap_free(parser.value_name); close_key(&parser); return TRUE; @@ -1144,7 +1149,7 @@ static void REGPROC_write_line(FILE *fp, const WCHAR *str, BOOL unicode) { char *strA = GetMultiByteString(str); fputs(strA, fp); - HeapFree(GetProcessHeap(), 0, strA); + heap_free(strA); } } @@ -1210,8 +1215,8 @@ static size_t export_value_name(FILE *fp, WCHAR *name, size_t len, BOOL unicode) WCHAR *buf = heap_xalloc((line_len + 4) * sizeof(WCHAR)); line_len = sprintfW(buf, quoted_fmt, str); REGPROC_write_line(fp, buf, unicode); - HeapFree(GetProcessHeap(), 0, buf); - HeapFree(GetProcessHeap(), 0, str); + heap_free(buf); + heap_free(str); } else { @@ -1232,7 +1237,7 @@ static void export_string_data(WCHAR **buf, WCHAR *data, size_t size) str = REGPROC_escape_string(data, len, &line_len); *buf = heap_xalloc((line_len + 3) * sizeof(WCHAR)); sprintfW(*buf, fmt, str); - HeapFree(GetProcessHeap(), 0, str); + heap_free(str); } static void export_dword_data(WCHAR **buf, DWORD *data) @@ -1259,7 +1264,7 @@ static size_t export_hex_data_type(FILE *fp, DWORD type, BOOL unicode) WCHAR *buf = heap_xalloc(15 * sizeof(WCHAR)); line_len = sprintfW(buf, hexp_fmt, type); REGPROC_write_line(fp, buf, unicode); - HeapFree(GetProcessHeap(), 0, buf); + heap_free(buf); } return line_len; @@ -1331,7 +1336,7 @@ static void export_data(FILE *fp, WCHAR *value_name, DWORD value_len, DWORD type } REGPROC_write_line(fp, buf, unicode); - HeapFree(GetProcessHeap(), 0, buf); + heap_free(buf); export_newline(fp, unicode); } @@ -1354,7 +1359,7 @@ static void export_key_name(FILE *fp, WCHAR *name, BOOL unicode) buf = heap_xalloc((lstrlenW(name) + 7) * sizeof(WCHAR)); sprintfW(buf, fmt, name); REGPROC_write_line(fp, buf, unicode); - HeapFree(GetProcessHeap(), 0, buf); + heap_free(buf); } #define MAX_SUBKEY_LEN 257 @@ -1402,8 +1407,8 @@ static int export_registry_data(FILE *fp, HKEY key, WCHAR *path, BOOL unicode) else break; } - HeapFree(GetProcessHeap(), 0, data); - HeapFree(GetProcessHeap(), 0, value_name); + heap_free(data); + heap_free(value_name); subkey_name = heap_xalloc(MAX_SUBKEY_LEN * sizeof(WCHAR)); @@ -1422,13 +1427,13 @@ static int export_registry_data(FILE *fp, HKEY key, WCHAR *path, BOOL unicode) export_registry_data(fp, subkey, subkey_path, unicode); RegCloseKey(subkey); } - HeapFree(GetProcessHeap(), 0, subkey_path); + heap_free(subkey_path); i++; } else break; } - HeapFree(GetProcessHeap(), 0, subkey_name); + heap_free(subkey_name); return 0; } @@ -1530,7 +1535,7 @@ static BOOL export_all(WCHAR *file_name, WCHAR *path, BOOL unicode) export_registry_data(fp, classes[i], class_name, unicode); - HeapFree(GetProcessHeap(), 0, class_name); + heap_free(class_name); RegCloseKey(key); }
1
0
0
0
Hugh McMaster : regedit: Use a helper function to allocate memory and check for a valid pointer.
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: 79ff4148c2691e579ab17ce912a97d7f57627343 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=79ff4148c2691e579ab17ce91…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Thu Jul 27 12:24:49 2017 +0000 regedit: Use a helper function to allocate memory and check for a valid pointer. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/regproc.c | 68 ++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index e0393cc..4b21478 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -28,8 +28,11 @@ #include <io.h> #include <windows.h> #include <wine/unicode.h> +#include <wine/debug.h> #include "regproc.h" +WINE_DEFAULT_DEBUG_CHANNEL(regedit); + #define REG_VAL_BUF_SIZE 4096 extern const WCHAR* reg_class_namesW[]; @@ -41,6 +44,17 @@ static HKEY reg_class_keys[] = { #define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A)) +static void *heap_xalloc(size_t size) +{ + void *buf = HeapAlloc(GetProcessHeap(), 0, size); + if (!buf) + { + ERR("Out of memory!\n"); + exit(1); + } + return buf; +} + /****************************************************************************** * Allocates memory and converts input from multibyte to wide chars * Returned string must be freed by the caller @@ -52,8 +66,7 @@ static WCHAR* GetWideString(const char* strA) WCHAR* strW; int len = MultiByteToWideChar(CP_ACP, 0, strA, -1, NULL, 0); - strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - CHECK_ENOUGH_MEMORY(strW); + strW = heap_xalloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, strA, -1, strW, len); return strW; } @@ -71,8 +84,7 @@ static WCHAR* GetWideStringN(const char* strA, int chars, DWORD *len) WCHAR* strW; *len = MultiByteToWideChar(CP_ACP, 0, strA, chars, NULL, 0); - strW = HeapAlloc(GetProcessHeap(), 0, *len * sizeof(WCHAR)); - CHECK_ENOUGH_MEMORY(strW); + strW = heap_xalloc(*len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, strA, chars, strW, *len); return strW; } @@ -91,8 +103,7 @@ char* GetMultiByteString(const WCHAR* strW) char* strA; int len = WideCharToMultiByte(CP_ACP, 0, strW, -1, NULL, 0, NULL, NULL); - strA = HeapAlloc(GetProcessHeap(), 0, len); - CHECK_ENOUGH_MEMORY(strA); + strA = heap_xalloc(len); WideCharToMultiByte(CP_ACP, 0, strW, -1, strA, len, NULL, NULL); return strA; } @@ -110,8 +121,7 @@ static char* GetMultiByteStringN(const WCHAR* strW, int chars, DWORD* len) char* strA; *len = WideCharToMultiByte(CP_ACP, 0, strW, chars, NULL, 0, NULL, NULL); - strA = HeapAlloc(GetProcessHeap(), 0, *len); - CHECK_ENOUGH_MEMORY(strA); + strA = heap_xalloc(*len); WideCharToMultiByte(CP_ACP, 0, strW, chars, strA, *len, NULL, NULL); return strA; } @@ -476,8 +486,7 @@ static LONG open_key(struct parser *parser, WCHAR *path) if (res == ERROR_SUCCESS) { - parser->key_name = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(path) + 1) * sizeof(WCHAR)); - CHECK_ENOUGH_MEMORY(parser->key_name); + parser->key_name = heap_xalloc((lstrlenW(path) + 1) * sizeof(WCHAR)); lstrcpyW(parser->key_name, path); } else @@ -564,8 +573,7 @@ static WCHAR *header_state(struct parser *parser, WCHAR *pos) if (!parser->is_unicode) { - header = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(line) + 3) * sizeof(WCHAR)); - CHECK_ENOUGH_MEMORY(header); + header = heap_xalloc((lstrlenW(line) + 3) * sizeof(WCHAR)); header[0] = parser->two_wchars[0]; header[1] = parser->two_wchars[1]; lstrcpyW(header + 2, line); @@ -722,8 +730,7 @@ static WCHAR *quoted_value_name_state(struct parser *parser, WCHAR *pos) goto invalid; /* copy the value name in case we need to parse multiple lines and the buffer is overwritten */ - parser->value_name = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(val_name) + 1) * sizeof(WCHAR)); - CHECK_ENOUGH_MEMORY(parser->value_name); + parser->value_name = heap_xalloc((lstrlenW(val_name) + 1) * sizeof(WCHAR)); lstrcpyW(parser->value_name, val_name); set_state(parser, DATA_START); @@ -834,8 +841,7 @@ static WCHAR *dword_data_state(struct parser *parser, WCHAR *pos) { WCHAR *line = pos; - parser->data = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)); - CHECK_ENOUGH_MEMORY(parser->data); + parser->data = heap_xalloc(sizeof(DWORD)); if (!convert_hex_to_dword(line, parser->data)) goto invalid; @@ -958,8 +964,7 @@ static WCHAR *get_lineA(FILE *fp) if (!size) { size = REG_VAL_BUF_SIZE; - buf = HeapAlloc(GetProcessHeap(), 0, size); - CHECK_ENOUGH_MEMORY(buf); + buf = heap_xalloc(size); *buf = 0; next = buf; } @@ -1016,8 +1021,7 @@ static WCHAR *get_lineW(FILE *fp) if (!size) { size = REG_VAL_BUF_SIZE; - buf = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR)); - CHECK_ENOUGH_MEMORY(buf); + buf = heap_xalloc(size * sizeof(WCHAR)); *buf = 0; next = buf; } @@ -1156,7 +1160,7 @@ static WCHAR *REGPROC_escape_string(WCHAR *str, size_t str_len, size_t *line_len escape_count++; } - buf = resize_buffer(NULL, (str_len + escape_count + 1) * sizeof(WCHAR)); + buf = heap_xalloc((str_len + escape_count + 1) * sizeof(WCHAR)); for (i = 0, pos = 0; i < str_len; i++, pos++) { @@ -1203,7 +1207,7 @@ static size_t export_value_name(FILE *fp, WCHAR *name, size_t len, BOOL unicode) if (name && *name) { WCHAR *str = REGPROC_escape_string(name, len, &line_len); - WCHAR *buf = resize_buffer(NULL, (line_len + 4) * sizeof(WCHAR)); + WCHAR *buf = heap_xalloc((line_len + 4) * sizeof(WCHAR)); line_len = sprintfW(buf, quoted_fmt, str); REGPROC_write_line(fp, buf, unicode); HeapFree(GetProcessHeap(), 0, buf); @@ -1226,7 +1230,7 @@ static void export_string_data(WCHAR **buf, WCHAR *data, size_t size) len = size / sizeof(WCHAR) - 1; str = REGPROC_escape_string(data, len, &line_len); - *buf = resize_buffer(NULL, (line_len + 3) * sizeof(WCHAR)); + *buf = heap_xalloc((line_len + 3) * sizeof(WCHAR)); sprintfW(*buf, fmt, str); HeapFree(GetProcessHeap(), 0, str); } @@ -1235,7 +1239,7 @@ static void export_dword_data(WCHAR **buf, DWORD *data) { static const WCHAR fmt[] = {'d','w','o','r','d',':','%','0','8','x',0}; - *buf = resize_buffer(NULL, 15 * sizeof(WCHAR)); + *buf = heap_xalloc(15 * sizeof(WCHAR)); sprintfW(*buf, fmt, *data); } @@ -1252,7 +1256,7 @@ static size_t export_hex_data_type(FILE *fp, DWORD type, BOOL unicode) } else { - WCHAR *buf = resize_buffer(NULL, 15 * sizeof(WCHAR)); + WCHAR *buf = heap_xalloc(15 * sizeof(WCHAR)); line_len = sprintfW(buf, hexp_fmt, type); REGPROC_write_line(fp, buf, unicode); HeapFree(GetProcessHeap(), 0, buf); @@ -1276,7 +1280,7 @@ static void export_hex_data(FILE *fp, WCHAR **buf, DWORD type, DWORD line_len, data = GetMultiByteStringN(data, size / sizeof(WCHAR), &size); num_commas = size - 1; - *buf = resize_buffer(NULL, (size * 3) * sizeof(WCHAR)); + *buf = heap_xalloc(size * 3 * sizeof(WCHAR)); for (i = 0, pos = 0; i < size; i++) { @@ -1336,7 +1340,7 @@ static WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, WCHAR *subkey_path; static const WCHAR fmt[] = {'%','s','\\','%','s',0}; - subkey_path = resize_buffer(NULL, (path_len + subkey_len + 2) * sizeof(WCHAR)); + subkey_path = heap_xalloc((path_len + subkey_len + 2) * sizeof(WCHAR)); sprintfW(subkey_path, fmt, path, subkey_name); return subkey_path; @@ -1347,7 +1351,7 @@ static void export_key_name(FILE *fp, WCHAR *name, BOOL unicode) static const WCHAR fmt[] = {'\r','\n','[','%','s',']','\r','\n',0}; WCHAR *buf; - buf = resize_buffer(NULL, (lstrlenW(name) + 7) * sizeof(WCHAR)); + buf = heap_xalloc((lstrlenW(name) + 7) * sizeof(WCHAR)); sprintfW(buf, fmt, name); REGPROC_write_line(fp, buf, unicode); HeapFree(GetProcessHeap(), 0, buf); @@ -1368,8 +1372,8 @@ static int export_registry_data(FILE *fp, HKEY key, WCHAR *path, BOOL unicode) export_key_name(fp, path, unicode); - value_name = resize_buffer(NULL, max_value_len * sizeof(WCHAR)); - data = resize_buffer(NULL, max_data_bytes); + value_name = heap_xalloc(max_value_len * sizeof(WCHAR)); + data = heap_xalloc(max_data_bytes); i = 0; for (;;) @@ -1401,7 +1405,7 @@ static int export_registry_data(FILE *fp, HKEY key, WCHAR *path, BOOL unicode) HeapFree(GetProcessHeap(), 0, data); HeapFree(GetProcessHeap(), 0, value_name); - subkey_name = resize_buffer(NULL, MAX_SUBKEY_LEN * sizeof(WCHAR)); + subkey_name = heap_xalloc(MAX_SUBKEY_LEN * sizeof(WCHAR)); path_len = lstrlenW(path); @@ -1521,7 +1525,7 @@ static BOOL export_all(WCHAR *file_name, WCHAR *path, BOOL unicode) return FALSE; } - class_name = resize_buffer(NULL, (lstrlenW(reg_class_namesW[i]) + 1) * sizeof(WCHAR)); + class_name = heap_xalloc((lstrlenW(reg_class_namesW[i]) + 1) * sizeof(WCHAR)); lstrcpyW(class_name, reg_class_namesW[i]); export_registry_data(fp, classes[i], class_name, unicode);
1
0
0
0
Alexandre Julliard : server: Initialize debug registers in new threads if necessary.
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: abe0b1c57bbe9a952e55d4f821073b0a5197d746 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=abe0b1c57bbe9a952e55d4f82…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Jul 27 10:55:30 2017 +0200 server: Initialize debug registers in new threads if necessary. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/exception.c | 10 +++++----- server/ptrace.c | 34 +++++++++++++++++++++++++++++++--- server/thread.c | 2 ++ server/thread.h | 1 + 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 7cb704c..2308472 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -904,7 +904,7 @@ static void test_exceptions(void) res = pNtGetContextThread( h, &ctx ); ok( res == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", res ); ok( ctx.Dr0 == 0, "dr0 %x\n", ctx.Dr0 ); - todo_wine ok( ctx.Dr7 == 0, "dr7 %x\n", ctx.Dr7 ); + ok( ctx.Dr7 == 0, "dr7 %x\n", ctx.Dr7 ); ctx.Dr0 = (DWORD)code_mem; ctx.Dr7 = 3; res = pNtSetContextThread( h, &ctx ); @@ -2168,8 +2168,8 @@ static DWORD WINAPI register_check_thread(void *arg) ok(!ctx.Dr1, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr1); ok(!ctx.Dr2, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr2); ok(!ctx.Dr3, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr3); - todo_wine ok(!ctx.Dr6, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr6); - todo_wine ok(!ctx.Dr7, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr7); + ok(!ctx.Dr6, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr6); + ok(!ctx.Dr7, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr7); return 0; } @@ -2238,8 +2238,8 @@ static void test_debug_registers(void) ok(!ctx.Dr1, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr1); ok(!ctx.Dr2, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr2); ok(!ctx.Dr3, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr3); - todo_wine ok(!ctx.Dr6, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr6); - todo_wine ok(!ctx.Dr7, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr7); + ok(!ctx.Dr6, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr6); + ok(!ctx.Dr7, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr7); ResumeThread(thread); WaitForSingleObject(thread, 10000); diff --git a/server/ptrace.c b/server/ptrace.c index 7de506b..a647df9 100644 --- a/server/ptrace.c +++ b/server/ptrace.c @@ -545,6 +545,8 @@ void get_selector_entry( struct thread *thread, int entry, unsigned int *base, /* initialize registers in new thread if necessary */ void init_thread_context( struct thread *thread ) { + /* Linux doesn't clear all registers, but hopefully enough to avoid spurious breakpoints */ + thread->system_regs = 0; } /* retrieve the thread x86 registers */ @@ -558,6 +560,13 @@ void get_thread_context( struct thread *thread, context_t *context, unsigned int if (!suspend_for_ptrace( thread )) return; + if (!(thread->system_regs & SERVER_CTX_DEBUG_REGISTERS)) + { + /* caller has initialized everything to 0 already, just return */ + context->flags |= SERVER_CTX_DEBUG_REGISTERS; + goto done; + } + for (i = 0; i < 8; i++) { if (i == 4 || i == 5) continue; @@ -625,6 +634,7 @@ void set_thread_context( struct thread *thread, const context_t *context, unsign ptrace( PTRACE_POKEUSER, pid, DR_OFFSET(7), context->debug.i386_regs.dr7 | 0x55 ); if (ptrace( PTRACE_POKEUSER, pid, DR_OFFSET(7), context->debug.i386_regs.dr7 ) == -1) goto error; if (thread->context) thread->context->debug.i386_regs.dr7 = context->debug.i386_regs.dr7; + thread->system_regs |= SERVER_CTX_DEBUG_REGISTERS; break; case CPU_x86_64: if (ptrace( PTRACE_POKEUSER, pid, DR_OFFSET(7), context->debug.x86_64_regs.dr7 & 0xffff0000 ) == -1) goto error; @@ -641,6 +651,7 @@ void set_thread_context( struct thread *thread, const context_t *context, unsign ptrace( PTRACE_POKEUSER, pid, DR_OFFSET(7), context->debug.x86_64_regs.dr7 | 0x55 ); if (ptrace( PTRACE_POKEUSER, pid, DR_OFFSET(7), context->debug.x86_64_regs.dr7 ) == -1) goto error; if (thread->context) thread->context->debug.x86_64_regs.dr7 = context->debug.x86_64_regs.dr7; + thread->system_regs |= SERVER_CTX_DEBUG_REGISTERS; break; default: set_error( STATUS_INVALID_PARAMETER ); @@ -660,6 +671,18 @@ void set_thread_context( struct thread *thread, const context_t *context, unsign /* initialize registers in new thread if necessary */ void init_thread_context( struct thread *thread ) { + if (!(thread->system_regs & SERVER_CTX_DEBUG_REGISTERS)) return; + + /* FreeBSD doesn't clear the debug registers in new threads */ + if (suspend_for_ptrace( thread )) + { + struct dbreg dbregs; + + memset( &dbregs, 0, sizeof(dbregs) ); + ptrace( PTRACE_SETDBREGS, get_ptrace_tid( thread ), (caddr_t)&dbregs, 0 ); + resume_after_ptrace( thread ); + } + thread->system_regs = 0; } /* retrieve the thread x86 registers */ @@ -728,9 +751,14 @@ void set_thread_context( struct thread *thread, const context_t *context, unsign dbregs.dr6 = context->debug.i386_regs.dr6; dbregs.dr7 = context->debug.i386_regs.dr7; #endif - if (ptrace( PTRACE_SETDBREGS, pid, (caddr_t) &dbregs, 0 ) == -1) file_set_error(); - else if (thread->context) - thread->context->debug.i386_regs = context->debug.i386_regs; /* update the cached values */ + if (ptrace( PTRACE_SETDBREGS, pid, (caddr_t)&dbregs, 0 ) != -1) + { + if (thread->context) + thread->context->debug.i386_regs = context->debug.i386_regs; /* update the cached values */ + thread->system_regs |= SERVER_CTX_DEBUG_REGISTERS; + } + else file_set_error(); + resume_after_ptrace( thread ); } diff --git a/server/thread.c b/server/thread.c index 24e9af5..903420b 100644 --- a/server/thread.c +++ b/server/thread.c @@ -182,6 +182,7 @@ static inline void init_thread_structure( struct thread *thread ) thread->debug_ctx = NULL; thread->debug_event = NULL; thread->debug_break = 0; + thread->system_regs = 0; thread->queue = NULL; thread->wait = NULL; thread->error = 0; @@ -1245,6 +1246,7 @@ DECL_HANDLER(new_thread) if ((thread = create_thread( request_fd, current->process ))) { + thread->system_regs = current->system_regs; if (req->suspend) thread->suspend++; reply->tid = get_thread_id( thread ); if ((reply->handle = alloc_handle( current->process, thread, req->access, req->attributes ))) diff --git a/server/thread.h b/server/thread.h index 2fdfd66..1d81d61 100644 --- a/server/thread.h +++ b/server/thread.h @@ -57,6 +57,7 @@ struct thread struct debug_ctx *debug_ctx; /* debugger context if this thread is a debugger */ struct debug_event *debug_event; /* debug event being sent to debugger */ int debug_break; /* debug breakpoint pending? */ + unsigned int system_regs; /* which system regs have been set */ struct msg_queue *queue; /* message queue */ struct thread_wait *wait; /* current wait condition if sleeping */ struct list system_apc; /* queue of system async procedure calls */
1
0
0
0
Alexandre Julliard : server: Add a platform-specific entry point to initialize registers of a new thread.
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: 9a07d210f135c91dda89d888dcedac864ff36781 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9a07d210f135c91dda89d888d…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Jul 27 10:50:41 2017 +0200 server: Add a platform-specific entry point to initialize registers of a new thread. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/mach.c | 5 +++++ server/procfs.c | 5 +++++ server/ptrace.c | 15 +++++++++++++++ server/thread.c | 1 + server/thread.h | 1 + 5 files changed, 27 insertions(+) diff --git a/server/mach.c b/server/mach.c index 2ef6e59..9d8d911 100644 --- a/server/mach.c +++ b/server/mach.c @@ -148,6 +148,11 @@ void finish_process_tracing( struct process *process ) } } +/* initialize registers in new thread if necessary */ +void init_thread_context( struct thread *thread ) +{ +} + /* retrieve the thread x86 registers */ void get_thread_context( struct thread *thread, context_t *context, unsigned int flags ) { diff --git a/server/procfs.c b/server/procfs.c index 5caa02b..7b61b2a 100644 --- a/server/procfs.c +++ b/server/procfs.c @@ -202,6 +202,11 @@ error: close( fd ); } +/* initialize registers in new thread if necessary */ +void init_thread_context( struct thread *thread ) +{ +} + /* retrieve the thread registers */ void get_thread_context( struct thread *thread, context_t *context, unsigned int flags ) { diff --git a/server/ptrace.c b/server/ptrace.c index cb436b6..7de506b 100644 --- a/server/ptrace.c +++ b/server/ptrace.c @@ -542,6 +542,11 @@ void get_selector_entry( struct thread *thread, int entry, unsigned int *base, /* debug register offset in struct user */ #define DR_OFFSET(dr) ((((struct user *)0)->u_debugreg) + (dr)) +/* initialize registers in new thread if necessary */ +void init_thread_context( struct thread *thread ) +{ +} + /* retrieve the thread x86 registers */ void get_thread_context( struct thread *thread, context_t *context, unsigned int flags ) { @@ -652,6 +657,11 @@ void set_thread_context( struct thread *thread, const context_t *context, unsign #include <machine/reg.h> +/* initialize registers in new thread if necessary */ +void init_thread_context( struct thread *thread ) +{ +} + /* retrieve the thread x86 registers */ void get_thread_context( struct thread *thread, context_t *context, unsigned int flags ) { @@ -726,6 +736,11 @@ void set_thread_context( struct thread *thread, const context_t *context, unsign #else /* linux || __FreeBSD__ */ +/* initialize registers in new thread if necessary */ +void init_thread_context( struct thread *thread ) +{ +} + /* retrieve the thread x86 registers */ void get_thread_context( struct thread *thread, context_t *context, unsigned int flags ) { diff --git a/server/thread.c b/server/thread.c index 70f5f28..24e9af5 100644 --- a/server/thread.c +++ b/server/thread.c @@ -1317,6 +1317,7 @@ DECL_HANDLER(init_thread) } if (process->unix_pid != current->unix_pid) process->unix_pid = -1; /* can happen with linuxthreads */ + init_thread_context( current ); stop_thread_if_suspended( current ); generate_debug_event( current, CREATE_THREAD_DEBUG_EVENT, &req->entry ); set_thread_affinity( current, current->affinity ); diff --git a/server/thread.h b/server/thread.h index 2821991..2fdfd66 100644 --- a/server/thread.h +++ b/server/thread.h @@ -131,6 +131,7 @@ extern int is_cpu_supported( enum cpu_type cpu ); /* ptrace functions */ extern void sigchld_callback(void); +extern void init_thread_context( struct thread *thread ); extern void get_thread_context( struct thread *thread, context_t *context, unsigned int flags ); extern void set_thread_context( struct thread *thread, const context_t *context, unsigned int flags ); extern int send_thread_signal( struct thread *thread, int sig );
1
0
0
0
Alistair Leslie-Hughes : ucrtbase/tests: Use standard wine_dbgstr_longlong.
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: 56998d567edef8a354273b7c78cbd71917215694 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=56998d567edef8a354273b7c7…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Thu Jul 27 04:45:08 2017 +0000 ucrtbase/tests: Use standard wine_dbgstr_longlong. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ucrtbase/tests/misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c index 213700f..c70e4b6 100644 --- a/dlls/ucrtbase/tests/misc.c +++ b/dlls/ucrtbase/tests/misc.c @@ -468,8 +468,8 @@ static void test_lldiv(void) MSVCRT_lldiv_t r; r = p_lldiv((LONGLONG)0x111 << 32 | 0x222, (LONGLONG)1 << 32); - ok(r.quot == 0x111, "quot = %x%08x\n", (INT32)(r.quot >> 32), (UINT32)r.quot); - ok(r.rem == 0x222, "rem = %x%08x\n", (INT32)(r.rem >> 32), (UINT32)r.rem); + ok(r.quot == 0x111, "quot = %s\n", wine_dbgstr_longlong(r.quot)); + ok(r.rem == 0x222, "rem = %s\n", wine_dbgstr_longlong(r.rem)); } static void test_isblank(void)
1
0
0
0
Alistair Leslie-Hughes : rpcrt4/tests: Use standard wine_dbgstr_longlong.
by Alexandre Julliard
27 Jul '17
27 Jul '17
Module: wine Branch: master Commit: a5767fc1f37d12b3413d5993f294ed4a413f4158 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a5767fc1f37d12b3413d5993f…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Thu Jul 27 04:44:59 2017 +0000 rpcrt4/tests: Use standard wine_dbgstr_longlong. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/rpcrt4/tests/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index 01a61ae..31f5c4d 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -912,7 +912,7 @@ basic_tests(void) x = sum_double_int(-78, 148.46); ok(x == 70, "RPC sum_double_int got %d\n", x); y = sum_hyper((hyper)0x12345678 << 16, (hyper)0x33557799 << 16); - ok(y == (hyper)0x4589ce11 << 16, "RPC hyper got %x%08x\n", (DWORD)(y >> 32), (DWORD)y); + ok(y == (hyper)0x4589ce11 << 16, "RPC hyper got %s\n", wine_dbgstr_longlong(y)); x = sum_hyper_int((hyper)0x24242424 << 16, -((hyper)0x24241212 << 16)); ok(x == 0x12120000, "RPC hyper_int got 0x%x\n", x); x = sum_char_hyper( 12, ((hyper)0x42424242 << 32) | 0x33334444 );
1
0
0
0
Hugh McMaster : regedit: Prevent out-of-bounds reads when unescaping a string (Valgrind).
by Alexandre Julliard
26 Jul '17
26 Jul '17
Module: wine Branch: master Commit: 976c2aa649a526188afd9c0647869ccc82068341 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=976c2aa649a526188afd9c064…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Wed Jul 26 13:15:57 2017 +0000 regedit: Prevent out-of-bounds reads when unescaping a string (Valgrind). Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/regproc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index 7e44e37..e0393cc 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -403,6 +403,7 @@ static BOOL REGPROC_unescape_string(WCHAR *str, WCHAR **unparsed) str[val_idx] = str[str_idx]; break; default: + if (!str[str_idx]) return FALSE; output_message(STRING_ESCAPE_SEQUENCE, str[str_idx]); str[val_idx] = str[str_idx]; break;
1
0
0
0
Alex Henrie : msvcrt: Set ERANGE in exp functions on finite input and infinite output.
by Alexandre Julliard
26 Jul '17
26 Jul '17
Module: wine Branch: master Commit: 79c3b610c4a6d2d57d34d609e5cf92e930548dd5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=79c3b610c4a6d2d57d34d609e…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Tue Jul 25 00:52:27 2017 -0600 msvcrt: Set ERANGE in exp functions on finite input and infinite output. 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 | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 0249493..079446d 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -209,8 +209,10 @@ float CDECL MSVCRT_coshf( float x ) */ float CDECL MSVCRT_expf( float x ) { - if (!finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM; - return expf(x); + float ret = expf(x); + if (isnanf(x)) *MSVCRT__errno() = MSVCRT_EDOM; + else if (finitef(x) && !finitef(ret)) *MSVCRT__errno() = MSVCRT_ERANGE; + return ret; } /********************************************************************* @@ -404,8 +406,10 @@ double CDECL MSVCRT_cosh( double x ) */ double CDECL MSVCRT_exp( double x ) { + double ret = exp(x); if (isnan(x)) *MSVCRT__errno() = MSVCRT_EDOM; - return exp(x); + else if (isfinite(x) && !isfinite(ret)) *MSVCRT__errno() = MSVCRT_ERANGE; + return ret; } /********************************************************************* @@ -984,7 +988,7 @@ double CDECL MSVCRT_ldexp(double num, MSVCRT_long exp) { double z = ldexp(num,exp); - if (!isfinite(z)) + if (isfinite(num) && !isfinite(z)) *MSVCRT__errno() = MSVCRT_ERANGE; else if (z == 0 && signbit(z)) z = 0.0; /* Convert -0 -> +0 */ @@ -2385,10 +2389,12 @@ LDOUBLE CDECL MSVCR120_cbrtl(LDOUBLE x) double CDECL MSVCR120_exp2(double x) { #ifdef HAVE_EXP2 - return exp2(x); + double ret = exp2(x); #else - return pow(2, x); + double ret = pow(2, x); #endif + if (isfinite(x) && !isfinite(ret)) *MSVCRT__errno() = MSVCRT_ERANGE; + return ret; } /********************************************************************* @@ -2397,7 +2403,9 @@ double CDECL MSVCR120_exp2(double x) float CDECL MSVCR120_exp2f(float x) { #ifdef HAVE_EXP2F - return exp2f(x); + float ret = exp2f(x); + if (finitef(x) && !finitef(ret)) *MSVCRT__errno() = MSVCRT_ERANGE; + return ret; #else return MSVCR120_exp2(x); #endif @@ -2421,7 +2429,7 @@ double CDECL MSVCR120_expm1(double x) #else double ret = exp(x) - 1; #endif - if (!isfinite(ret)) *MSVCRT__errno() = MSVCRT_ERANGE; + if (isfinite(x) && !isfinite(ret)) *MSVCRT__errno() = MSVCRT_ERANGE; return ret; } @@ -2435,7 +2443,7 @@ float CDECL MSVCR120_expm1f(float x) #else float ret = exp(x) - 1; #endif - if (!finitef(ret)) *MSVCRT__errno() = MSVCRT_ERANGE; + if (finitef(x) && !finitef(ret)) *MSVCRT__errno() = MSVCRT_ERANGE; return ret; } @@ -3124,8 +3132,7 @@ LDOUBLE CDECL MSVCR120_atanhl(LDOUBLE x) */ double CDECL MSVCRT__scalb(double num, MSVCRT_long power) { - if (!isfinite(num)) *MSVCRT__errno() = MSVCRT_EDOM; - return ldexp(num, power); + return MSVCRT_ldexp(num, power); } /********************************************************************* @@ -3135,8 +3142,7 @@ double CDECL MSVCRT__scalb(double num, MSVCRT_long power) */ float CDECL MSVCRT__scalbf(float num, MSVCRT_long power) { - if (!finitef(num)) *MSVCRT__errno() = MSVCRT_EDOM; - return ldexpf(num, power); + return MSVCRT_ldexp(num, power); } /*********************************************************************
1
0
0
0
← Newer
1
2
3
4
5
6
...
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