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
November 2022
----- 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
1 participants
1171 discussions
Start a n
N
ew thread
Alex Henrie : schedsvc: Use standard C functions for memory allocation in schedsvc.c.
by Alexandre Julliard
18 Nov '22
18 Nov '22
Module: wine Branch: master Commit: baa8b11b4d563eb8e567ca9b5b8b4882aa96aeec URL:
https://gitlab.winehq.org/wine/wine/-/commit/baa8b11b4d563eb8e567ca9b5b8b48…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Thu Nov 17 21:57:09 2022 -0700 schedsvc: Use standard C functions for memory allocation in schedsvc.c. --- dlls/schedsvc/schedsvc.c | 60 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/dlls/schedsvc/schedsvc.c b/dlls/schedsvc/schedsvc.c index ba6da110fe5..c670c8b1cbb 100644 --- a/dlls/schedsvc/schedsvc.c +++ b/dlls/schedsvc/schedsvc.c @@ -58,7 +58,7 @@ static WCHAR *get_full_name(const WCHAR *path, WCHAR **relative_path) len = GetSystemDirectoryW(NULL, 0); len += lstrlenW(tasksW) + lstrlenW(path); - target = heap_alloc(len * sizeof(WCHAR)); + target = malloc(len * sizeof(WCHAR)); if (target) { GetSystemDirectoryW(target, len); @@ -80,7 +80,7 @@ static HRESULT create_directory(const WCHAR *path) WCHAR *new_path; int len; - new_path = heap_alloc((lstrlenW(path) + 1) * sizeof(WCHAR)); + new_path = malloc((lstrlenW(path) + 1) * sizeof(WCHAR)); if (!new_path) return E_OUTOFMEMORY; lstrcpyW(new_path, path); @@ -110,7 +110,7 @@ static HRESULT create_directory(const WCHAR *path) new_path[len] = '\\'; } - heap_free(new_path); + free(new_path); return hr; } @@ -132,7 +132,7 @@ static HRESULT write_xml_utf8(const WCHAR *name, DWORD disposition, const WCHAR } size = WideCharToMultiByte(CP_UTF8, 0, xmlW, -1, NULL, 0, NULL, NULL); - xml = heap_alloc(size); + xml = malloc(size); if (!xml) { CloseHandle(hfile); @@ -167,7 +167,7 @@ static HRESULT write_xml_utf8(const WCHAR *name, DWORD disposition, const WCHAR } failed: - heap_free(xml); + free(xml); CloseHandle(hfile); return hr; } @@ -202,7 +202,7 @@ HRESULT __cdecl SchRpcRegisterTask(const WCHAR *path, const WCHAR *xml, DWORD fl hr = create_directory(full_name); if (hr != S_OK && hr != HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS)) { - heap_free(full_name); + free(full_name); return hr; } *p = '\\'; @@ -241,11 +241,11 @@ HRESULT __cdecl SchRpcRegisterTask(const WCHAR *path, const WCHAR *xml, DWORD fl hr = write_xml_utf8(full_name, disposition, xml); if (hr == S_OK) { - *actual_path = heap_strdupW(relative_path); + *actual_path = wcsdup(relative_path); schedsvc_auto_start(); } - heap_free(full_name); + free(full_name); return hr; } @@ -286,7 +286,7 @@ static HRESULT read_xml(const WCHAR *name, WCHAR **xml) return HRESULT_FROM_WIN32(GetLastError()); size = GetFileSize(hfile, NULL); - buff = src = heap_alloc(size + 2); + buff = src = malloc(size + 2); if (!src) { CloseHandle(hfile); @@ -310,12 +310,12 @@ static HRESULT read_xml(const WCHAR *name, WCHAR **xml) src += sizeof(bom_utf8); size = MultiByteToWideChar(cp, 0, src, -1, NULL, 0); - *xml = heap_alloc(size * sizeof(WCHAR)); + *xml = malloc(size * sizeof(WCHAR)); if (*xml) MultiByteToWideChar(cp, 0, src, -1, *xml, size); else hr = E_OUTOFMEMORY; - heap_free(buff); + free(buff); return hr; } @@ -539,7 +539,7 @@ HRESULT __cdecl SchRpcRetrieveTask(const WCHAR *path, const WCHAR *languages, UL hr = read_xml(full_name, xml); if (hr != S_OK) *xml = NULL; - heap_free(full_name); + free(full_name); return hr; } @@ -557,7 +557,7 @@ HRESULT __cdecl SchRpcCreateFolder(const WCHAR *path, const WCHAR *sddl, DWORD f hr = create_directory(full_name); - heap_free(full_name); + free(full_name); return hr; } @@ -578,9 +578,9 @@ static void free_list(TASK_NAMES list, LONG count) LONG i; for (i = 0; i < count; i++) - heap_free(list[i]); + free(list[i]); - heap_free(list); + free(list); } static inline BOOL is_directory(const WIN32_FIND_DATAW *data) @@ -628,17 +628,17 @@ HRESULT __cdecl SchRpcEnumFolders(const WCHAR *path, DWORD flags, DWORD *start_i if (lstrlenW(full_name) + 2 > MAX_PATH) { - heap_free(full_name); + free(full_name); return HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE); } lstrcpyW(pathW, full_name); lstrcatW(pathW, allW); - heap_free(full_name); + free(full_name); allocated = 64; - list = heap_alloc(allocated * sizeof(list[0])); + list = malloc(allocated * sizeof(list[0])); if (!list) return E_OUTOFMEMORY; index = count = 0; @@ -646,7 +646,7 @@ HRESULT __cdecl SchRpcEnumFolders(const WCHAR *path, DWORD flags, DWORD *start_i handle = FindFirstFileW(pathW, &data); if (handle == INVALID_HANDLE_VALUE) { - heap_free(list); + free(list); if (GetLastError() == ERROR_PATH_NOT_FOUND) return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); return HRESULT_FROM_WIN32(GetLastError()); @@ -671,7 +671,7 @@ HRESULT __cdecl SchRpcEnumFolders(const WCHAR *path, DWORD flags, DWORD *start_i TRACE("adding %s\n", debugstr_w(data.cFileName)); - list[count] = heap_strdupW(data.cFileName); + list[count] = wcsdup(data.cFileName); if (!list[count]) { hr = E_OUTOFMEMORY; @@ -705,7 +705,7 @@ HRESULT __cdecl SchRpcEnumFolders(const WCHAR *path, DWORD flags, DWORD *start_i return hr; } - heap_free(list); + free(list); *names = NULL; return *start_index ? S_FALSE : S_OK; } @@ -736,17 +736,17 @@ HRESULT __cdecl SchRpcEnumTasks(const WCHAR *path, DWORD flags, DWORD *start_ind if (lstrlenW(full_name) + 2 > MAX_PATH) { - heap_free(full_name); + free(full_name); return HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE); } lstrcpyW(pathW, full_name); lstrcatW(pathW, allW); - heap_free(full_name); + free(full_name); allocated = 64; - list = heap_alloc(allocated * sizeof(list[0])); + list = malloc(allocated * sizeof(list[0])); if (!list) return E_OUTOFMEMORY; index = count = 0; @@ -754,7 +754,7 @@ HRESULT __cdecl SchRpcEnumTasks(const WCHAR *path, DWORD flags, DWORD *start_ind handle = FindFirstFileW(pathW, &data); if (handle == INVALID_HANDLE_VALUE) { - heap_free(list); + free(list); if (GetLastError() == ERROR_PATH_NOT_FOUND) return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); return HRESULT_FROM_WIN32(GetLastError()); @@ -779,7 +779,7 @@ HRESULT __cdecl SchRpcEnumTasks(const WCHAR *path, DWORD flags, DWORD *start_ind TRACE("adding %s\n", debugstr_w(data.cFileName)); - list[count] = heap_strdupW(data.cFileName); + list[count] = wcsdup(data.cFileName); if (!list[count]) { hr = E_OUTOFMEMORY; @@ -813,7 +813,7 @@ HRESULT __cdecl SchRpcEnumTasks(const WCHAR *path, DWORD flags, DWORD *start_ind return hr; } - heap_free(list); + free(list); *names = NULL; return *start_index ? S_FALSE : S_OK; } @@ -874,7 +874,7 @@ HRESULT __cdecl SchRpcDelete(const WCHAR *path, DWORD flags) hr = DeleteFileW(full_name) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); } - heap_free(full_name); + free(full_name); return hr; } @@ -910,10 +910,10 @@ HRESULT __cdecl SchRpcGetTaskInfo(const WCHAR *path, DWORD flags, DWORD *enabled if (!full_name) return E_OUTOFMEMORY; hr = read_xml(full_name, &xml); - heap_free(full_name); + free(full_name); if (hr != S_OK) return hr; hr = read_task_info_from_xml(xml, &info); - heap_free(xml); + free(xml); if (FAILED(hr)) return hr; *enabled = info.enabled;
1
0
0
0
Alex Henrie : schedsvc: Use standard C functions for memory allocation in atsvc.c.
by Alexandre Julliard
18 Nov '22
18 Nov '22
Module: wine Branch: master Commit: 4ee48f26bdaa9e466ad96c5f923027a6b7aca7fe URL:
https://gitlab.winehq.org/wine/wine/-/commit/4ee48f26bdaa9e466ad96c5f923027…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Thu Nov 17 21:56:01 2022 -0700 schedsvc: Use standard C functions for memory allocation in atsvc.c. --- dlls/schedsvc/atsvc.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/dlls/schedsvc/atsvc.c b/dlls/schedsvc/atsvc.c index e8ea1b25c6f..aa7881d39ba 100644 --- a/dlls/schedsvc/atsvc.c +++ b/dlls/schedsvc/atsvc.c @@ -354,15 +354,15 @@ static DWORD load_unicode_strings(const char *data, DWORD limit, struct job_t *j switch (i) { case 0: - job->info.Command = heap_strdupW((const WCHAR *)data); + job->info.Command = wcsdup((const WCHAR *)data); break; case 1: - job->params = heap_strdupW((const WCHAR *)data); + job->params = wcsdup((const WCHAR *)data); break; case 2: - job->curdir = heap_strdupW((const WCHAR *)data); + job->curdir = wcsdup((const WCHAR *)data); break; default: @@ -504,7 +504,7 @@ static BOOL load_job_data(const char *data, DWORD size, struct job_t *info) return FALSE; } - info->trigger = heap_alloc(info->trigger_count * sizeof(info->trigger[0])); + info->trigger = malloc(info->trigger_count * sizeof(info->trigger[0])); if (!info->trigger) { TRACE("not enough memory for trigger data\n"); @@ -596,24 +596,24 @@ static BOOL load_job(const WCHAR *name, struct job_t *info) static void free_job_info(AT_ENUM *info) { - heap_free(info->Command); + free(info->Command); } static void free_job(struct job_t *job) { free_job_info(&job->info); - heap_free(job->name); - heap_free(job->params); - heap_free(job->curdir); - heap_free(job->trigger); - heap_free(job); + free(job->name); + free(job->params); + free(job->curdir); + free(job->trigger); + free(job); } void add_job(const WCHAR *name) { struct job_t *job; - job = heap_alloc_zero(sizeof(*job)); + job = calloc(1, sizeof(*job)); if (!job) return; if (!load_job(name, job)) @@ -623,7 +623,7 @@ void add_job(const WCHAR *name) } EnterCriticalSection(&at_job_list_section); - job->name = heap_strdupW(name); + job->name = wcsdup(name); job->info.JobId = current_jobid++; list_add_tail(&at_job_list, &job->entry); LeaveCriticalSection(&at_job_list_section); @@ -920,7 +920,7 @@ void update_process_status(DWORD pid) { CloseHandle(runjob->process); list_remove(&runjob->entry); - heap_free(runjob); + free(runjob); job->data.exit_code = exit_code; job->data.status = SCHED_S_TASK_TERMINATED; @@ -969,7 +969,7 @@ void check_task_state(void) if (job->instance_count) FIXME("process %s is already running\n", debugstr_w(job->info.Command)); - runjob = heap_alloc(sizeof(*runjob)); + runjob = malloc(sizeof(*runjob)); if (runjob) { static WCHAR winsta0[] = { 'W','i','n','S','t','a','0',0 }; @@ -1179,9 +1179,9 @@ static void free_container(AT_ENUM_CONTAINER *container) DWORD i; for (i = 0; i < container->EntriesRead; i++) - heap_free(container->Buffer[i].Command); + free(container->Buffer[i].Command); - heap_free(container->Buffer); + free(container->Buffer); } DWORD __cdecl NetrJobEnum(ATSVC_HANDLE server_name, AT_ENUM_CONTAINER *container, @@ -1197,7 +1197,7 @@ DWORD __cdecl NetrJobEnum(ATSVC_HANDLE server_name, AT_ENUM_CONTAINER *container container->EntriesRead = 0; allocated = 64; - container->Buffer = heap_alloc(allocated * sizeof(AT_ENUM)); + container->Buffer = malloc(allocated * sizeof(AT_ENUM)); if (!container->Buffer) return ERROR_NOT_ENOUGH_MEMORY; EnterCriticalSection(&at_job_list_section); @@ -1215,7 +1215,7 @@ DWORD __cdecl NetrJobEnum(ATSVC_HANDLE server_name, AT_ENUM_CONTAINER *container AT_ENUM *new_buffer; allocated *= 2; - new_buffer = heap_realloc(container->Buffer, allocated * sizeof(AT_ENUM)); + new_buffer = realloc(container->Buffer, allocated * sizeof(AT_ENUM)); if (!new_buffer) { free_container(container); @@ -1226,7 +1226,7 @@ DWORD __cdecl NetrJobEnum(ATSVC_HANDLE server_name, AT_ENUM_CONTAINER *container } container->Buffer[container->EntriesRead] = job->info; - container->Buffer[container->EntriesRead].Command = heap_strdupW(job->info.Command); + container->Buffer[container->EntriesRead].Command = wcsdup(job->info.Command); container->EntriesRead++; } @@ -1249,7 +1249,7 @@ DWORD __cdecl NetrJobGetInfo(ATSVC_HANDLE server_name, DWORD jobid, AT_INFO **in job = find_job(jobid, NULL, NULL); if (job) { - AT_INFO *info_ret = heap_alloc(sizeof(*info_ret)); + AT_INFO *info_ret = malloc(sizeof(*info_ret)); if (!info_ret) ret = ERROR_NOT_ENOUGH_MEMORY; else @@ -1258,7 +1258,7 @@ DWORD __cdecl NetrJobGetInfo(ATSVC_HANDLE server_name, DWORD jobid, AT_INFO **in info_ret->DaysOfMonth = job->info.DaysOfMonth; info_ret->DaysOfWeek = job->info.DaysOfWeek; info_ret->Flags = job->info.Flags; - info_ret->Command = heap_strdupW(job->info.Command); + info_ret->Command = wcsdup(job->info.Command); *info = info_ret; ret = ERROR_SUCCESS; }
1
0
0
0
Alex Henrie : sapi: Use standard C functions for memory allocation in token.c.
by Alexandre Julliard
18 Nov '22
18 Nov '22
Module: wine Branch: master Commit: caf39cd12240ecd965027e7a29a5ed66d04a1a74 URL:
https://gitlab.winehq.org/wine/wine/-/commit/caf39cd12240ecd965027e7a29a5ed…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Thu Nov 17 19:39:25 2022 -0700 sapi: Use standard C functions for memory allocation in token.c. --- dlls/sapi/sapi_private.h | 15 --------------- dlls/sapi/token.c | 44 ++++++++++++++++++++++---------------------- 2 files changed, 22 insertions(+), 37 deletions(-) diff --git a/dlls/sapi/sapi_private.h b/dlls/sapi/sapi_private.h index 8a375cdb6c2..fcecafb450e 100644 --- a/dlls/sapi/sapi_private.h +++ b/dlls/sapi/sapi_private.h @@ -28,18 +28,3 @@ HRESULT speech_voice_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_ HRESULT token_category_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_HIDDEN; HRESULT token_enum_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_HIDDEN; HRESULT token_create( IUnknown *outer, REFIID iid, void **obj ) DECLSPEC_HIDDEN; - -static inline LPWSTR heap_strdupW(LPCWSTR str) -{ - LPWSTR ret = NULL; - DWORD size; - - if (str) - { - size = (lstrlenW( str ) + 1) * sizeof(WCHAR); - ret = heap_alloc( size ); - if (ret) memcpy( ret, str, size ); - } - - return ret; -} diff --git a/dlls/sapi/token.c b/dlls/sapi/token.c index 478a400f920..385555a4cef 100644 --- a/dlls/sapi/token.c +++ b/dlls/sapi/token.c @@ -101,7 +101,7 @@ static ULONG WINAPI data_key_Release( ISpRegDataKey *iface ) if (!ref) { if (This->key) RegCloseKey( This->key ); - heap_free( This ); + free( This ); } return ref; @@ -270,7 +270,7 @@ const struct ISpRegDataKeyVtbl data_key_vtbl = HRESULT data_key_create( IUnknown *outer, REFIID iid, void **obj ) { - struct data_key *This = heap_alloc( sizeof(*This) ); + struct data_key *This = malloc( sizeof(*This) ); HRESULT hr; if (!This) return E_OUTOFMEMORY; @@ -338,7 +338,7 @@ static ULONG WINAPI token_category_Release( ISpObjectTokenCategory *iface ) if (!ref) { if (This->data_key) ISpRegDataKey_Release( This->data_key ); - heap_free( This ); + free( This ); } return ref; } @@ -637,7 +637,7 @@ const struct ISpObjectTokenCategoryVtbl token_category_vtbl = HRESULT token_category_create( IUnknown *outer, REFIID iid, void **obj ) { - struct token_category *This = heap_alloc( sizeof(*This) ); + struct token_category *This = malloc( sizeof(*This) ); HRESULT hr; if (!This) return E_OUTOFMEMORY; @@ -692,9 +692,9 @@ static ULONG WINAPI token_enum_Release( ISpObjectTokenEnumBuilder *iface ) { if (This->key) RegCloseKey(This->key); - heap_free( This->req ); - heap_free( This->opt ); - heap_free( This ); + free( This->req ); + free( This->opt ); + free( This ); } return ref; @@ -721,14 +721,14 @@ static HRESULT WINAPI token_enum_Next( ISpObjectTokenEnumBuilder *iface, RegQueryInfoKeyW( This->key, NULL, NULL, NULL, NULL, &size, NULL, NULL, NULL, NULL, NULL, NULL ); size = (size+1) * sizeof(WCHAR); - subkey_name = heap_alloc(size); + subkey_name = malloc( size ); if (!subkey_name) return E_OUTOFMEMORY; retCode = RegEnumKeyExW( This->key, This->index, subkey_name, &size, NULL, NULL, NULL, NULL ); if (retCode != ERROR_SUCCESS) { - heap_free(subkey_name); + free( subkey_name ); return S_FALSE; } @@ -736,14 +736,14 @@ static HRESULT WINAPI token_enum_Next( ISpObjectTokenEnumBuilder *iface, if (RegOpenKeyExW( This->key, subkey_name, 0, KEY_READ, &sub_key ) != ERROR_SUCCESS) { - heap_free(subkey_name); + free( subkey_name ); return E_FAIL; } hr = token_create( NULL, &IID_ISpObjectToken, (void**)tokens ); if (FAILED(hr)) { - heap_free(subkey_name); + free( subkey_name ); return hr; } @@ -794,28 +794,28 @@ static HRESULT WINAPI token_enum_Item( ISpObjectTokenEnumBuilder *iface, RegQueryInfoKeyW(This->key, NULL, NULL, NULL, NULL, &size, NULL, NULL, NULL, NULL, NULL, NULL); size = (size+1) * sizeof(WCHAR); - subkey = heap_alloc(size); + subkey = malloc( size ); if (!subkey) return E_OUTOFMEMORY; ret = RegEnumKeyExW(This->key, index, subkey, &size, NULL, NULL, NULL, NULL); if (ret != ERROR_SUCCESS) { - heap_free(subkey); + free( subkey ); return HRESULT_FROM_WIN32(ret); } ret = RegOpenKeyExW (This->key, subkey, 0, KEY_READ, &key); if (ret != ERROR_SUCCESS) { - heap_free(subkey); + free( subkey ); return HRESULT_FROM_WIN32(ret); } hr = token_create( NULL, &IID_ISpObjectToken, (void**)&subtoken ); if (FAILED(hr)) { - heap_free(subkey); + free( subkey ); return hr; } @@ -852,13 +852,13 @@ static HRESULT WINAPI token_enum_SetAttribs( ISpObjectTokenEnumBuilder *iface, if (req) { - This->req = heap_strdupW( req ); + This->req = wcsdup( req ); if (!This->req) goto out_of_mem; } if (opt) { - This->opt = heap_strdupW( opt ); + This->opt = wcsdup( opt ); if (!This->opt) goto out_of_mem; } @@ -866,7 +866,7 @@ static HRESULT WINAPI token_enum_SetAttribs( ISpObjectTokenEnumBuilder *iface, return S_OK; out_of_mem: - heap_free( This->req ); + free( This->req ); return E_OUTOFMEMORY; } @@ -919,7 +919,7 @@ const struct ISpObjectTokenEnumBuilderVtbl token_enum_vtbl = HRESULT token_enum_create( IUnknown *outer, REFIID iid, void **obj ) { - struct token_enum *This = heap_alloc( sizeof(*This) ); + struct token_enum *This = malloc( sizeof(*This) ); HRESULT hr; if (!This) return E_OUTOFMEMORY; @@ -978,8 +978,8 @@ static ULONG WINAPI token_Release( ISpObjectToken *iface ) if (!ref) { if (This->token_key) RegCloseKey( This->token_key ); - free(This->token_id); - heap_free( This ); + free( This->token_id ); + free( This ); } return ref; @@ -1265,7 +1265,7 @@ const struct ISpObjectTokenVtbl token_vtbl = HRESULT token_create( IUnknown *outer, REFIID iid, void **obj ) { - struct object_token *This = heap_alloc( sizeof(*This) ); + struct object_token *This = malloc( sizeof(*This) ); HRESULT hr; if (!This) return E_OUTOFMEMORY;
1
0
0
0
Alex Henrie : oledb32: Use standard C functions for memory allocation in datainit.c.
by Alexandre Julliard
18 Nov '22
18 Nov '22
Module: wine Branch: master Commit: cce78c245d9455953f3dc7035e2c2f66d4dd7fe9 URL:
https://gitlab.winehq.org/wine/wine/-/commit/cce78c245d9455953f3dc7035e2c2f…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Thu Nov 17 19:31:15 2022 -0700 oledb32: Use standard C functions for memory allocation in datainit.c. --- dlls/oledb32/datainit.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/dlls/oledb32/datainit.c b/dlls/oledb32/datainit.c index 0438375202b..4281e5f9e1c 100644 --- a/dlls/oledb32/datainit.c +++ b/dlls/oledb32/datainit.c @@ -29,7 +29,6 @@ #include "oledb_private.h" #include "wine/debug.h" -#include "wine/heap.h" #include "wine/list.h" WINE_DEFAULT_DEBUG_CHANNEL(oledb); @@ -191,7 +190,7 @@ static ULONG WINAPI dbinit_Release(IDBInitialize *iface) ref = InterlockedDecrement(&This->ref); if(ref == 0) - heap_free(This); + free(This); return ref; } @@ -231,7 +230,7 @@ static HRESULT create_db_init(IUnknown **obj) *obj = NULL; - This = heap_alloc(sizeof(*This)); + This = malloc(sizeof(*This)); if(!This) return E_OUTOFMEMORY; This->IDBInitialize_iface.lpVtbl = &dbinit_vtbl; @@ -282,7 +281,7 @@ static ULONG WINAPI datainit_Release(IDataInitialize *iface) ref = InterlockedDecrement(&This->ref); if(ref == 0) - heap_free(This); + free(This); return ref; } @@ -400,7 +399,7 @@ static HRESULT add_dbprop_to_list(struct dbprops *props, BSTR name, BSTR value) { struct dbprop_pair *pair; - pair = heap_alloc(sizeof(*pair)); + pair = malloc(sizeof(*pair)); if (!pair) return E_OUTOFMEMORY; @@ -419,7 +418,7 @@ static void free_dbprop_list(struct dbprops *props) list_remove(&p->entry); SysFreeString(p->name); SysFreeString(p->value); - heap_free(p); + free(p); } } @@ -604,26 +603,16 @@ static void datasource_release(BOOL created, IUnknown **datasource) *datasource = NULL; } -static inline WCHAR *strdupW(const WCHAR *src) -{ - WCHAR *dest; - if (!src) return NULL; - dest = heap_alloc((lstrlenW(src)+1)*sizeof(WCHAR)); - if (dest) - lstrcpyW(dest, src); - return dest; -} - static WCHAR *strstriW(const WCHAR *str, const WCHAR *sub) { LPWSTR strlower, sublower, r; - strlower = CharLowerW(strdupW(str)); - sublower = CharLowerW(strdupW(sub)); + strlower = CharLowerW(wcsdup(str)); + sublower = CharLowerW(wcsdup(sub)); r = wcsstr(strlower, sublower); if (r) r = (LPWSTR)str + (r - strlower); - heap_free(strlower); - heap_free(sublower); + free(strlower); + free(sublower); return r; } @@ -1017,7 +1006,7 @@ HRESULT create_data_init(IUnknown *outer, void **obj) *obj = NULL; - This = heap_alloc(sizeof(*This)); + This = malloc(sizeof(*This)); if(!This) return E_OUTOFMEMORY; This->IDataInitialize_iface.lpVtbl = &datainit_vtbl;
1
0
0
0
Alex Henrie : oleaut32: Use standard C functions for memory allocation in olefont.c.
by Alexandre Julliard
18 Nov '22
18 Nov '22
Module: wine Branch: master Commit: 88e3c7323ad3ee7f7be17b1d8e51a589b7a0e836 URL:
https://gitlab.winehq.org/wine/wine/-/commit/88e3c7323ad3ee7f7be17b1d8e51a5…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Thu Nov 17 19:22:35 2022 -0700 oleaut32: Use standard C functions for memory allocation in olefont.c. --- dlls/oleaut32/olefont.c | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c index 28cfcdf933c..d08c26249b0 100644 --- a/dlls/oleaut32/olefont.c +++ b/dlls/oleaut32/olefont.c @@ -117,7 +117,7 @@ static void HFONTItem_Delete(PHFONTItem item) { DeleteObject(item->gdiFont); list_remove(&item->entry); - HeapFree(GetProcessHeap(), 0, item); + free(item); } /* Find hfont item entry in the list. Should be called while holding the crit sect */ @@ -136,7 +136,7 @@ static HFONTItem *find_hfontitem(HFONT hfont) /* Add an item to the list with one internal reference */ static HRESULT add_hfontitem(HFONT hfont) { - HFONTItem *new_item = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_item)); + HFONTItem *new_item = malloc(sizeof(*new_item)); if(!new_item) return E_OUTOFMEMORY; @@ -226,17 +226,6 @@ static HRESULT dec_ext_ref(HFONT hfont) return hr; } -static WCHAR *strdupW(const WCHAR* str) -{ - WCHAR *ret; - DWORD size = (lstrlenW(str) + 1) * sizeof(WCHAR); - - ret = HeapAlloc(GetProcessHeap(), 0, size); - if(ret) - memcpy(ret, str, size); - return ret; -} - /*********************************************************************** * Declaration of the implementation class for the IFont interface */ @@ -621,8 +610,8 @@ static void realize_font(OLEFontImpl *This) GetTextFaceW(hdc, ARRAY_SIZE(text_face), text_face); if(lstrcmpiW(text_face, This->description.lpstrName)) { - HeapFree(GetProcessHeap(), 0, This->description.lpstrName); - This->description.lpstrName = strdupW(text_face); + free(This->description.lpstrName); + This->description.lpstrName = wcsdup(text_face); } GetTextMetricsW(hdc, &tm); This->description.sCharset = tm.tmCharSet; @@ -669,8 +658,8 @@ static HRESULT WINAPI OLEFontImpl_put_Name( if (!name) return CTL_E_INVALIDPROPERTYVALUE; - HeapFree(GetProcessHeap(), 0, This->description.lpstrName); - This->description.lpstrName = strdupW(name); + free(This->description.lpstrName); + This->description.lpstrName = wcsdup(name); if (!This->description.lpstrName) return E_OUTOFMEMORY; TRACE("new name %s\n", debugstr_w(This->description.lpstrName)); @@ -960,13 +949,13 @@ static HRESULT WINAPI OLEFontImpl_Clone( *ppfont = NULL; - newObject = HeapAlloc(GetProcessHeap(), 0, sizeof(OLEFontImpl)); + newObject = malloc(sizeof(OLEFontImpl)); if (newObject==NULL) return E_OUTOFMEMORY; *newObject = *this; /* allocate separate buffer */ - newObject->description.lpstrName = strdupW(this->description.lpstrName); + newObject->description.lpstrName = wcsdup(this->description.lpstrName); /* Increment internal ref in hfont item list */ if(newObject->gdiFont) inc_int_ref(newObject->gdiFont); @@ -1623,10 +1612,10 @@ static HRESULT WINAPI OLEFontImpl_Load( IStream_Read(pLoadStream, readBuffer, string_size, &cbRead); if (cbRead != string_size) return E_FAIL; - HeapFree(GetProcessHeap(), 0, this->description.lpstrName); + free(this->description.lpstrName); len = MultiByteToWideChar( CP_ACP, 0, readBuffer, string_size, NULL, 0 ); - this->description.lpstrName = HeapAlloc( GetProcessHeap(), 0, (len+1) * sizeof(WCHAR) ); + this->description.lpstrName = malloc((len + 1) * sizeof(WCHAR)); MultiByteToWideChar( CP_ACP, 0, readBuffer, string_size, this->description.lpstrName, len ); this->description.lpstrName[len] = 0; @@ -1697,13 +1686,13 @@ static HRESULT WINAPI OLEFontImpl_Save( if (string_size) { - if (!(writeBuffer = HeapAlloc( GetProcessHeap(), 0, string_size ))) return E_OUTOFMEMORY; + if (!(writeBuffer = malloc(string_size))) return E_OUTOFMEMORY; WideCharToMultiByte( CP_ACP, 0, this->description.lpstrName, lstrlenW(this->description.lpstrName), writeBuffer, string_size, NULL, NULL ); IStream_Write(pOutStream, writeBuffer, string_size, &written); - HeapFree(GetProcessHeap(), 0, writeBuffer); + free(writeBuffer); if (written != string_size) return E_FAIL; } @@ -2024,7 +2013,7 @@ static OLEFontImpl* OLEFontImpl_Construct(const FONTDESC *fontDesc) { OLEFontImpl* newObject; - newObject = HeapAlloc(GetProcessHeap(), 0, sizeof(OLEFontImpl)); + newObject = malloc(sizeof(OLEFontImpl)); if (newObject==0) return newObject; @@ -2038,7 +2027,7 @@ static OLEFontImpl* OLEFontImpl_Construct(const FONTDESC *fontDesc) newObject->ref = 1; newObject->description.cbSizeofstruct = sizeof(FONTDESC); - newObject->description.lpstrName = strdupW(fontDesc->lpstrName); + newObject->description.lpstrName = wcsdup(fontDesc->lpstrName); newObject->description.cySize = fontDesc->cySize; newObject->description.sWeight = fontDesc->sWeight; newObject->description.sCharset = fontDesc->sCharset; @@ -2079,14 +2068,14 @@ static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc) { TRACE("(%p)\n", fontDesc); - HeapFree(GetProcessHeap(), 0, fontDesc->description.lpstrName); + free(fontDesc->description.lpstrName); if (fontDesc->pPropertyNotifyCP) IConnectionPoint_Release(fontDesc->pPropertyNotifyCP); if (fontDesc->pFontEventsCP) IConnectionPoint_Release(fontDesc->pFontEventsCP); - HeapFree(GetProcessHeap(), 0, fontDesc); + free(fontDesc); } /*******************************************************************************
1
0
0
0
Eric Pouech : ntdll/tests: Extend file tests about delete-on-close and disposition.
by Alexandre Julliard
18 Nov '22
18 Nov '22
Module: wine Branch: master Commit: 9ff426270c793f0ccbbb18d7de344f723d5ff097 URL:
https://gitlab.winehq.org/wine/wine/-/commit/9ff426270c793f0ccbbb18d7de344f…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Thu Nov 17 16:07:39 2022 +0100 ntdll/tests: Extend file tests about delete-on-close and disposition. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- dlls/ntdll/tests/file.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 2ec61f72aa9..6186afdfb63 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -3000,6 +3000,10 @@ static void test_file_disposition_information(void) fdi.DoDeleteFile = TRUE; res = pNtSetInformationFile( handle, &io, &fdi, sizeof fdi, FileDispositionInformation ); ok( res == STATUS_SUCCESS, "unexpected FileDispositionInformation result (expected STATUS_SUCCESS, got %lx)\n", res ); + res = NtQueryInformationFile(handle, &io, &fsi, sizeof(fsi), FileStandardInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + todo_wine + ok(fsi.DeletePending, "Handle should be marked for deletion\n"); CloseHandle( handle ); fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( fileDeleted, "File should have been deleted\n" ); @@ -3408,6 +3412,68 @@ static void test_file_disposition_information(void) res = DeleteFileA( buffer ); ok( !res, "expected failure\n" ); ok( GetLastError() == ERROR_FILE_NOT_FOUND, "got error %lu\n", GetLastError() ); + + /* pending delete flag is shared across handles */ + GetTempFileNameA( tmp_path, "dis", 0, buffer ); + handle = CreateFileA(buffer, GENERIC_WRITE | DELETE, FILE_SHARE_DELETE, NULL, CREATE_ALWAYS, 0, 0); + ok( handle != INVALID_HANDLE_VALUE, "failed to create temp file\n" ); + res = NtQueryInformationFile(handle, &io, &fsi, sizeof(fsi), FileStandardInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + ok(!fsi.DeletePending, "Handle shouldn't be marked for deletion\n"); + handle2 = CreateFileA(buffer, DELETE, FILE_SHARE_DELETE | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); + ok( handle2 != INVALID_HANDLE_VALUE, "failed to create temp file\n" ); + res = NtQueryInformationFile(handle2, &io, &fsi, sizeof(fsi), FileStandardInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + ok(!fsi.DeletePending, "Handle shouldn't be marked for deletion\n"); + fdi.DoDeleteFile = TRUE; + res = NtSetInformationFile(handle, &io, &fdi, sizeof(fdi), FileDispositionInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + res = NtQueryInformationFile(handle2, &io, &fsi, sizeof(fsi), FileStandardInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + todo_wine + ok(fsi.DeletePending, "Handle should be marked for deletion\n"); + fdi.DoDeleteFile = FALSE; + res = NtSetInformationFile(handle2, &io, &fdi, sizeof(fdi), FileDispositionInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + res = NtQueryInformationFile(handle, &io, &fsi, sizeof(fsi), FileStandardInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + ok(!fsi.DeletePending, "Handle shouldn't be marked for deletion\n"); + CloseHandle(handle); + CloseHandle(handle2); + res = GetFileAttributesA( buffer ); + todo_wine + ok( res != INVALID_FILE_ATTRIBUTES, "expected file to exist\n" ); + + /* pending delete flag is shared across handles (even after closing) */ + GetTempFileNameA( tmp_path, "dis", 0, buffer ); + handle = CreateFileA(buffer, GENERIC_WRITE | DELETE, FILE_SHARE_DELETE, NULL, CREATE_ALWAYS, 0, 0); + ok( handle != INVALID_HANDLE_VALUE, "failed to create temp file\n" ); + res = NtQueryInformationFile(handle, &io, &fsi, sizeof(fsi), FileStandardInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + ok(!fsi.DeletePending, "Handle shouldn't be marked for deletion\n"); + handle2 = CreateFileA(buffer, DELETE, FILE_SHARE_DELETE | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); + ok( handle2 != INVALID_HANDLE_VALUE, "failed to create temp file\n" ); + res = NtQueryInformationFile(handle2, &io, &fsi, sizeof(fsi), FileStandardInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + ok(!fsi.DeletePending, "Handle shouldn't be marked for deletion\n"); + fdi.DoDeleteFile = TRUE; + res = NtSetInformationFile(handle, &io, &fdi, sizeof(fdi), FileDispositionInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + res = NtQueryInformationFile(handle2, &io, &fsi, sizeof(fsi), FileStandardInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + todo_wine + ok(fsi.DeletePending, "Handle should be marked for deletion\n"); + fdi.DoDeleteFile = FALSE; + res = NtSetInformationFile(handle2, &io, &fdi, sizeof(fdi), FileDispositionInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + CloseHandle(handle2); + res = NtQueryInformationFile(handle, &io, &fsi, sizeof(fsi), FileStandardInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + ok(!fsi.DeletePending, "Handle shouldn't be marked for deletion\n"); + CloseHandle(handle); + res = GetFileAttributesA( buffer ); + todo_wine + ok( res != INVALID_FILE_ATTRIBUTES, "expected file to exist\n" ); } static void test_file_name_information(void)
1
0
0
0
Eric Pouech : ntdll/tests: Fix share mode for some delete-on-close/delete disposition tests.
by Alexandre Julliard
18 Nov '22
18 Nov '22
Module: wine Branch: master Commit: b9bf5abe5b2ccbc7ac194d553ea0a1e429c73014 URL:
https://gitlab.winehq.org/wine/wine/-/commit/b9bf5abe5b2ccbc7ac194d553ea0a1…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Thu Nov 17 16:07:37 2022 +0100 ntdll/tests: Fix share mode for some delete-on-close/delete disposition tests. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- dlls/ntdll/tests/file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 7b6cf704971..2ec61f72aa9 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -3155,10 +3155,13 @@ static void test_file_disposition_information(void) todo_wine ok( res == STATUS_OBJECT_NAME_NOT_FOUND || broken(res == STATUS_DELETE_PENDING), "got %#lx\n", res ); /* can't open the deleted file */ - handle2 = CreateFileA(buffer, DELETE, FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 0, 0); + handle2 = CreateFileA(buffer, DELETE, FILE_SHARE_DELETE | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); + todo_wine ok( handle2 == INVALID_HANDLE_VALUE, "CreateFile should fail\n" ); todo_wine ok( GetLastError() == ERROR_FILE_NOT_FOUND || broken(GetLastError() == ERROR_ACCESS_DENIED), "got %lu\n", GetLastError()); + if (handle2 != INVALID_HANDLE_VALUE) + CloseHandle( handle2); CloseHandle( handle ); fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( fileDeleted, "File should have been deleted\n" );
1
0
0
0
Eric Pouech : ntdll/tests: Adapt file tests on delete-on-close / delete disposition to Windows 10.
by Alexandre Julliard
18 Nov '22
18 Nov '22
Module: wine Branch: master Commit: 35ec92113fa643ad2fd0f526797e5392bdf8cf4f URL:
https://gitlab.winehq.org/wine/wine/-/commit/35ec92113fa643ad2fd0f526797e53…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Thu Nov 17 16:07:36 2022 +0100 ntdll/tests: Adapt file tests on delete-on-close / delete disposition to Windows 10. Fix a couple of failures on Windows 10: - it seems that attributes are no longer accessible by name after shared deletion - really looks like that shared deletion is now marked at object's name hierarchy level (see error codes have changed too) So, - replace tests based on GetFileAttribute with testing presence of pending deletion flag (FileStandardInformation) - add Win10 error codes (and mark the Win7/8 ones as broken) Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- dlls/ntdll/tests/file.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 98d9e6b3b0a..7b6cf704971 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -2957,6 +2957,7 @@ static void test_file_disposition_information(void) NTSTATUS res; IO_STATUS_BLOCK io; FILE_DISPOSITION_INFORMATION fdi; + FILE_STANDARD_INFORMATION fsi; BOOL fileDeleted; DWORD fdi2, size; void *view; @@ -3141,18 +3142,23 @@ static void test_file_disposition_information(void) GetTempFileNameA( tmp_path, "dis", 0, buffer ); handle = CreateFileA(buffer, GENERIC_WRITE | DELETE, FILE_SHARE_DELETE, NULL, CREATE_ALWAYS, 0, 0); ok( handle != INVALID_HANDLE_VALUE, "failed to create temp file\n" ); + res = NtQueryInformationFile(handle, &io, &fsi, sizeof(fsi), FileStandardInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + ok(!fsi.DeletePending, "Handle shouldn't be marked for deletion\n"); fileDeleted = DeleteFileA( buffer ); ok( fileDeleted, "File should have been deleted\n" ); - fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - ok( !fileDeleted, "File shouldn't have been deleted\n" ); + res = NtQueryInformationFile(handle, &io, &fsi, sizeof(fsi), FileStandardInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + todo_wine + ok(fsi.DeletePending, "Handle should be marked for deletion\n"); res = nt_get_file_attrs( buffer, &fdi2 ); todo_wine - ok( res == STATUS_DELETE_PENDING, "got %#lx\n", res ); + ok( res == STATUS_OBJECT_NAME_NOT_FOUND || broken(res == STATUS_DELETE_PENDING), "got %#lx\n", res ); /* can't open the deleted file */ handle2 = CreateFileA(buffer, DELETE, FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 0, 0); ok( handle2 == INVALID_HANDLE_VALUE, "CreateFile should fail\n" ); todo_wine - ok(GetLastError() == ERROR_ACCESS_DENIED, "got %lu\n", GetLastError()); + ok( GetLastError() == ERROR_FILE_NOT_FOUND || broken(GetLastError() == ERROR_ACCESS_DENIED), "got %lu\n", GetLastError()); CloseHandle( handle ); fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; ok( fileDeleted, "File should have been deleted\n" ); @@ -3190,19 +3196,24 @@ static void test_file_disposition_information(void) ok( CreateDirectoryA( buffer, NULL ), "CreateDirectory failed\n" ); handle = CreateFileA(buffer, DELETE, FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); ok( handle != INVALID_HANDLE_VALUE, "failed to open a directory\n" ); + res = NtQueryInformationFile(handle, &io, &fsi, sizeof(fsi), FileStandardInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + ok(!fsi.DeletePending, "Handle shouldn't be marked for deletion\n"); fileDeleted = RemoveDirectoryA( buffer ); ok( fileDeleted, "Directory should have been deleted\n" ); - fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; - ok( !fileDeleted, "Directory shouldn't have been deleted\n" ); + res = NtQueryInformationFile(handle, &io, &fsi, sizeof(fsi), FileStandardInformation); + ok(res == STATUS_SUCCESS, "NtQueryInformationFile failed %lx\n", res); + todo_wine + ok(fsi.DeletePending, "Handle should be marked for deletion\n"); res = nt_get_file_attrs( buffer, &fdi2 ); todo_wine - ok( res == STATUS_DELETE_PENDING, "got %#lx\n", res ); + ok( res == STATUS_OBJECT_NAME_NOT_FOUND || broken(res == STATUS_DELETE_PENDING), "got %#lx\n", res ); /* can't open the deleted directory */ handle2 = CreateFileA(buffer, DELETE, FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); todo_wine ok( handle2 == INVALID_HANDLE_VALUE, "CreateFile should fail\n" ); todo_wine - ok(GetLastError() == ERROR_ACCESS_DENIED, "got %lu\n", GetLastError()); + ok(GetLastError() == ERROR_FILE_NOT_FOUND || broken(GetLastError() == ERROR_ACCESS_DENIED), "got %lu\n", GetLastError()); if (handle2 != INVALID_HANDLE_VALUE) CloseHandle( handle2 ); CloseHandle( handle ); fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND;
1
0
0
0
Eric Pouech : dbghelp: Function static variables should be found by address.
by Alexandre Julliard
18 Nov '22
18 Nov '22
Module: wine Branch: master Commit: dcbb145658ccbadcb8e45401cc5dde26251c87d2 URL:
https://gitlab.winehq.org/wine/wine/-/commit/dcbb145658ccbadcb8e45401cc5dde…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Fri Nov 18 11:35:08 2022 +0100 dbghelp: Function static variables should be found by address. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- dlls/dbghelp/symbol.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index c82b5b3d4ef..18699e47984 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -150,11 +150,10 @@ static BOOL symt_grow_sorttab(struct module* module, unsigned sz) return TRUE; } -static void symt_add_module_ht(struct module* module, struct symt_ht* ht) +static void symt_add_module_addr(struct module* module, struct symt_ht* ht) { ULONG64 addr; - hash_table_add(&module->ht_symbols, &ht->hash_elt); /* Don't store in sorttab a symbol without address, they are of * no use here (e.g. constant values) */ @@ -166,6 +165,12 @@ static void symt_add_module_ht(struct module* module, struct symt_ht* ht) } } +static void symt_add_module_ht(struct module* module, struct symt_ht* ht) +{ + hash_table_add(&module->ht_symbols, &ht->hash_elt); + symt_add_module_addr(module, ht); +} + static WCHAR* file_regex(const char* srcfile) { WCHAR* mask; @@ -488,6 +493,8 @@ struct symt_data* symt_add_func_local(struct module* module, else p = vector_add(&func->vchildren, &module->pool); *p = &locsym->symt; + if (dt == DataIsStaticLocal) + symt_add_module_addr(module, (struct symt_ht*)locsym); return locsym; }
1
0
0
0
Eric Pouech : dbghelp: Create a single compiland instance by name in PDB.
by Alexandre Julliard
18 Nov '22
18 Nov '22
Module: wine Branch: master Commit: f763332b93e505d9f7b87269fe002e2437046e80 URL:
https://gitlab.winehq.org/wine/wine/-/commit/f763332b93e505d9f7b87269fe002e…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Thu Nov 17 10:50:50 2022 +0100 dbghelp: Create a single compiland instance by name in PDB. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- dlls/dbghelp/msc.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 65992e6ba28..6eceaa41422 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -2245,6 +2245,24 @@ static struct symt_function* codeview_create_inline_site(const struct msc_debug_ return inlined; } +static struct symt_compiland* codeview_new_compiland(const struct msc_debug_info* msc_dbg, const char* objname) +{ + unsigned int src_idx = source_new(msc_dbg->module, NULL, objname); + unsigned int i; + + /* In some cases MSVC generates several compiland entries with same pathname in PDB file. + * (for example: for an import library, one compiland entry per imported function is generated). + * But native dbghelp (in this case) merges in a single compiland instance. + */ + for (i = 0; i < msc_dbg->module->top->vchildren.num_elts; i++) + { + struct symt_compiland** p = vector_at(&msc_dbg->module->top->vchildren, i); + if (symt_check_tag(&(*p)->symt, SymTagCompiland) && (*p)->source == src_idx) + return *p; + } + return symt_new_compiland(msc_dbg->module, src_idx); +} + static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, const BYTE* root, unsigned offset, unsigned size, const struct cv_module_snarf* cvmod, @@ -2260,7 +2278,7 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, /* overwrite compiland name from outter context (if any) */ if (objname) - compiland = symt_new_compiland(msc_dbg->module, source_new(msc_dbg->module, NULL, objname)); + compiland = codeview_new_compiland(msc_dbg, objname); /* * Loop over the different types of records and whenever we * find something we are interested in, record it and move on. @@ -2522,17 +2540,13 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, case S_OBJNAME: TRACE("S-ObjName-V3 %s\n", sym->objname_v3.name); if (!compiland) - compiland = symt_new_compiland(msc_dbg->module, - source_new(msc_dbg->module, NULL, - sym->objname_v3.name)); + compiland = codeview_new_compiland(msc_dbg, sym->objname_v3.name); break; case S_OBJNAME_ST: TRACE("S-ObjName-V1 %s\n", terminate_string(&sym->objname_v1.p_name)); if (!compiland) - compiland = symt_new_compiland(msc_dbg->module, - source_new(msc_dbg->module, NULL, - terminate_string(&sym->objname_v1.p_name))); + compiland = codeview_new_compiland(msc_dbg, terminate_string(&sym->objname_v1.p_name)); break; case S_LABEL32_ST:
1
0
0
0
← Newer
1
...
47
48
49
50
51
52
53
...
118
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
Results per page:
10
25
50
100
200