ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2018
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
25 participants
436 discussions
Start a n
N
ew thread
01/01: [WTSAPI32] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e88e8daabf6d1514d1337…
commit e88e8daabf6d1514d1337d796153208005c50715 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Mar 25 12:41:55 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Mar 25 12:41:55 2018 +0100 [WTSAPI32] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/wtsapi32/wtsapi32.c | 109 +++++++++++++++++++++++++++++++++++------- media/doc/README.WINE | 2 +- 2 files changed, 94 insertions(+), 17 deletions(-) diff --git a/dll/win32/wtsapi32/wtsapi32.c b/dll/win32/wtsapi32/wtsapi32.c index 92a7396f54..fad7aa8d7d 100644 --- a/dll/win32/wtsapi32/wtsapi32.c +++ b/dll/win32/wtsapi32/wtsapi32.c @@ -15,19 +15,22 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <config.h> +#include "config.h" #include <stdarg.h> -//#include <stdlib.h> -#include <ntstatus.h> +#include <stdlib.h> +#include "ntstatus.h" #define WIN32_NO_STATUS -#include <windef.h> -#include <winbase.h> -#include <wine/winternl.h> -#include <wtsapi32.h> -#include <wine/debug.h> +#include "windef.h" +#include "winbase.h" +#include "wine/winternl.h" +#include "wtsapi32.h" +#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(wtsapi); +#ifdef __REACTOS__ /* FIXME: Inspect */ +#define GetCurrentProcessToken() ((HANDLE)~(ULONG_PTR)3) +#endif /************************************************************ * WTSCloseServer (WTSAPI32.@) @@ -96,8 +99,13 @@ BOOL WINAPI WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount) { - FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version, - ppProcessInfo, pCount); + WTS_PROCESS_INFOW *processInfo; + SYSTEM_PROCESS_INFORMATION *spi; + ULONG size = 0x4000; + void *buf = NULL; + NTSTATUS status; + DWORD count; + WCHAR *name; if (!ppProcessInfo || !pCount || Reserved != 0 || Version != 1) { @@ -105,9 +113,71 @@ BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version return FALSE; } - *pCount = 0; - *ppProcessInfo = NULL; + if (hServer != WTS_CURRENT_SERVER_HANDLE) + { + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; + } + + do + { + size *= 2; + HeapFree(GetProcessHeap(), 0, buf); + buf = HeapAlloc(GetProcessHeap(), 0, size); + if (!buf) + { + SetLastError(ERROR_OUTOFMEMORY); + return FALSE; + } + status = NtQuerySystemInformation(SystemProcessInformation, buf, size, NULL); + } + while (status == STATUS_INFO_LENGTH_MISMATCH); + + if (status != STATUS_SUCCESS) + { + HeapFree(GetProcessHeap(), 0, buf); + SetLastError(RtlNtStatusToDosError(status)); + return FALSE; + } + + spi = buf; + count = size = 0; + for (;;) + { + size += sizeof(WTS_PROCESS_INFOW) + spi->ProcessName.Length + sizeof(WCHAR); + count++; + if (spi->NextEntryOffset == 0) break; + spi = (SYSTEM_PROCESS_INFORMATION *)(((PCHAR)spi) + spi->NextEntryOffset); + } + processInfo = HeapAlloc(GetProcessHeap(), 0, size); + if (!processInfo) + { + HeapFree(GetProcessHeap(), 0, buf); + SetLastError(ERROR_OUTOFMEMORY); + return FALSE; + } + name = (WCHAR *)&processInfo[count]; + + *ppProcessInfo = processInfo; + *pCount = count; + + spi = buf; + while (count--) + { + processInfo->SessionId = 0; + processInfo->ProcessId = HandleToUlong(spi->UniqueProcessId); + processInfo->pProcessName = name; + processInfo->pUserSid = NULL; + memcpy( name, spi->ProcessName.Buffer, spi->ProcessName.Length ); + name[ spi->ProcessName.Length/sizeof(WCHAR) ] = 0; + + processInfo++; + name += (spi->ProcessName.Length + sizeof(WCHAR))/sizeof(WCHAR); + spi = (SYSTEM_PROCESS_INFORMATION *)(((PCHAR)spi) + spi->NextEntryOffset); + } + + HeapFree(GetProcessHeap(), 0, buf); return TRUE; } @@ -171,9 +241,7 @@ BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version, */ void WINAPI WTSFreeMemory(PVOID pMemory) { - static int once; - - if (!once++) FIXME("Stub %p\n", pMemory); + HeapFree(GetProcessHeap(), 0, pMemory); } /************************************************************ @@ -246,7 +314,16 @@ BOOL WINAPI WTSQuerySessionInformationW( BOOL WINAPI WTSQueryUserToken(ULONG session_id, PHANDLE token) { FIXME("%u %p\n", session_id, token); - return FALSE; + + if (!token) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + return DuplicateHandle(GetCurrentProcess(), GetCurrentProcessToken(), + GetCurrentProcess(), token, + 0, FALSE, DUPLICATE_SAME_ACCESS); } /************************************************************ diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 0922d5ff44..4b31b28fcf 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -212,7 +212,7 @@ reactos/dll/win32/wmi # Synced to WineStaging-2.9 reactos/dll/win32/wmiutils # Synced to WineStaging-3.3 reactos/dll/win32/wmvcore # Synced to WineStaging-3.3 reactos/dll/win32/wshom.ocx # Synced to WineStaging-3.3 -reactos/dll/win32/wtsapi32 # Synced to Wine-3.0 +reactos/dll/win32/wtsapi32 # Synced to WineStaging-3.3 reactos/dll/win32/wuapi # Synced to WineStaging-2.9 reactos/dll/win32/xinput1_1 # Synced to WineStaging-2.9 reactos/dll/win32/xinput1_2 # Synced to WineStaging-2.9
6 years, 9 months
1
0
0
0
01/01: [WSHOM_WINETEST] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=96a173fcdfdf8712f8b96…
commit 96a173fcdfdf8712f8b963c95f66de0715306934 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Mar 25 12:41:06 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Mar 25 12:41:06 2018 +0100 [WSHOM_WINETEST] Sync with Wine Staging 3.3. CORE-14434 --- modules/rostests/winetests/wshom/wshom.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/rostests/winetests/wshom/wshom.c b/modules/rostests/winetests/wshom/wshom.c index 5a9662078a..18ff4d6228 100644 --- a/modules/rostests/winetests/wshom/wshom.c +++ b/modules/rostests/winetests/wshom/wshom.c @@ -16,18 +16,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS #define COBJMACROS #define CONST_VTABLE -#include <windef.h> -#include <winbase.h> -#include <winreg.h> #include <initguid.h> +#include <ole2.h> #include <dispex.h> -#include <wshom.h> -#include <wine/test.h> + +#include "wshom.h" +#include "wine/test.h" DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
6 years, 9 months
1
0
0
0
01/01: [WSHOM.OCX] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6a5af78c498cfe194b979…
commit 6a5af78c498cfe194b979cb5b013458b2701e831 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sun Mar 25 12:39:53 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Mar 25 12:40:20 2018 +0100 [WSHOM.OCX] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/wshom.ocx/CMakeLists.txt | 4 +-- dll/win32/wshom.ocx/precomp.h | 15 ++++++++++ dll/win32/wshom.ocx/shell.c | 56 ++++++++++++++++++++----------------- dll/win32/wshom.ocx/wshom.rc | 2 +- dll/win32/wshom.ocx/wshom_main.c | 10 +++++-- dll/win32/wshom.ocx/wshom_private.h | 20 ++++++------- media/doc/README.WINE | 2 +- 7 files changed, 65 insertions(+), 44 deletions(-) diff --git a/dll/win32/wshom.ocx/CMakeLists.txt b/dll/win32/wshom.ocx/CMakeLists.txt index 6c0381fc04..56c3d3f1aa 100644 --- a/dll/win32/wshom.ocx/CMakeLists.txt +++ b/dll/win32/wshom.ocx/CMakeLists.txt @@ -12,7 +12,7 @@ add_typelib(wshom.idl) list(APPEND SOURCE shell.c wshom_main.c - wshom_private.h) + precomp.h) add_library(wshom SHARED ${SOURCE} @@ -30,5 +30,5 @@ set_module_type(wshom win32ocx) target_link_libraries(wshom uuid wine) add_importlibs(wshom oleaut32 ole32 shell32 advapi32 advapi32_vista user32 msvcrt kernel32 ntdll) add_dependencies(wshom stdole2 wshom_idlheader) -add_pch(wshom wshom_private.h SOURCE) +add_pch(wshom precomp.h SOURCE) add_cd_file(TARGET wshom DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/wshom.ocx/precomp.h b/dll/win32/wshom.ocx/precomp.h new file mode 100644 index 0000000000..8bd9d4326e --- /dev/null +++ b/dll/win32/wshom.ocx/precomp.h @@ -0,0 +1,15 @@ + +#ifndef _WSHOM_PRECOMP_H_ +#define _WSHOM_PRECOMP_H_ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS + +#include "wshom_private.h" + +#include <wshom.h> +#include <ocidl.h> + +#include <wine/debug.h> + +#endif /* !_WSHOM_PRECOMP_H_ */ diff --git a/dll/win32/wshom.ocx/shell.c b/dll/win32/wshom.ocx/shell.c index bdae7d9fcd..1aa353a17a 100644 --- a/dll/win32/wshom.ocx/shell.c +++ b/dll/win32/wshom.ocx/shell.c @@ -17,13 +17,17 @@ */ #include "wshom_private.h" +#include "wshom.h" -#include <shellapi.h> -#include <shlobj.h> -#include <dispex.h> -#include <winreg.h> +#include "shellapi.h" +#include "shlobj.h" +#include "dispex.h" -#include <wine/unicode.h> +#include "wine/debug.h" +#include "wine/heap.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wshom); typedef struct { @@ -127,7 +131,7 @@ static ULONG WINAPI WshExec_Release(IWshExec *iface) if (!ref) { CloseHandle(This->info.hThread); CloseHandle(This->info.hProcess); - HeapFree(GetProcessHeap(), 0, This); + heap_free(This); } return ref; @@ -322,7 +326,7 @@ static HRESULT WshExec_create(BSTR command, IWshExec **ret) *ret = NULL; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + This = heap_alloc(sizeof(*This)); if (!This) return E_OUTOFMEMORY; @@ -330,7 +334,7 @@ static HRESULT WshExec_create(BSTR command, IWshExec **ret) This->ref = 1; if (!CreateProcessW(NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &This->info)) { - HeapFree(GetProcessHeap(), 0, This); + heap_free(This); return HRESULT_FROM_WIN32(GetLastError()); } @@ -380,7 +384,7 @@ static ULONG WINAPI WshEnvironment_Release(IWshEnvironment *iface) TRACE("(%p) ref = %d\n", This, ref); if (!ref) - HeapFree(GetProcessHeap(), 0, This); + heap_free(This); return ref; } @@ -516,7 +520,7 @@ static HRESULT WshEnvironment_Create(IWshEnvironment **env) { WshEnvironment *This; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + This = heap_alloc(sizeof(*This)); if (!This) return E_OUTOFMEMORY; This->IWshEnvironment_iface.lpVtbl = &WshEnvironmentVtbl; @@ -569,7 +573,7 @@ static ULONG WINAPI WshCollection_Release(IWshCollection *iface) TRACE("(%p) ref = %d\n", This, ref); if (!ref) - HeapFree(GetProcessHeap(), 0, This); + heap_free(This); return ref; } @@ -718,7 +722,7 @@ static HRESULT WshCollection_Create(IWshCollection **collection) { WshCollection *This; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + This = heap_alloc(sizeof(*This)); if (!This) return E_OUTOFMEMORY; This->IWshCollection_iface.lpVtbl = &WshCollectionVtbl; @@ -775,7 +779,7 @@ static ULONG WINAPI WshShortcut_Release(IWshShortcut *iface) { SysFreeString(This->path_link); IShellLinkW_Release(This->link); - HeapFree(GetProcessHeap(), 0, This); + heap_free(This); } return ref; @@ -856,7 +860,7 @@ static HRESULT WINAPI WshShortcut_get_Arguments(IWshShortcut *iface, BSTR *Argum *Arguments = NULL; - hr = IShellLinkW_GetArguments(This->link, buffW, sizeof(buffW)/sizeof(WCHAR)); + hr = IShellLinkW_GetArguments(This->link, buffW, ARRAY_SIZE(buffW)); if (FAILED(hr)) return hr; @@ -914,7 +918,7 @@ static HRESULT WINAPI WshShortcut_get_IconLocation(IWshShortcut *iface, BSTR *Ic if (!IconPath) return E_POINTER; - hr = IShellLinkW_GetIconLocation(This->link, buffW, sizeof(buffW)/sizeof(WCHAR), &icon); + hr = IShellLinkW_GetIconLocation(This->link, buffW, ARRAY_SIZE(buffW), &icon); if (FAILED(hr)) return hr; sprintfW(pathW, fmtW, buffW, icon); @@ -1003,7 +1007,7 @@ static HRESULT WINAPI WshShortcut_get_WorkingDirectory(IWshShortcut *iface, BSTR return E_POINTER; *WorkingDirectory = NULL; - hr = IShellLinkW_GetWorkingDirectory(This->link, buffW, sizeof(buffW)/sizeof(WCHAR)); + hr = IShellLinkW_GetWorkingDirectory(This->link, buffW, ARRAY_SIZE(buffW)); if (FAILED(hr)) return hr; *WorkingDirectory = SysAllocString(buffW); @@ -1074,7 +1078,7 @@ static HRESULT WshShortcut_Create(const WCHAR *path, IDispatch **shortcut) *shortcut = NULL; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + This = heap_alloc(sizeof(*This)); if (!This) return E_OUTOFMEMORY; This->IWshShortcut_iface.lpVtbl = &WshShortcutVtbl; @@ -1084,7 +1088,7 @@ static HRESULT WshShortcut_Create(const WCHAR *path, IDispatch **shortcut) &IID_IShellLinkW, (void**)&This->link); if (FAILED(hr)) { - HeapFree(GetProcessHeap(), 0, This); + heap_free(This); return hr; } @@ -1092,7 +1096,7 @@ static HRESULT WshShortcut_Create(const WCHAR *path, IDispatch **shortcut) if (!This->path_link) { IShellLinkW_Release(This->link); - HeapFree(GetProcessHeap(), 0, This); + heap_free(This); return E_OUTOFMEMORY; } @@ -1392,7 +1396,7 @@ static HKEY get_root_key(const WCHAR *path) }; int i; - for (i = 0; i < sizeof(rootkeys)/sizeof(rootkeys[0]); i++) { + for (i = 0; i < ARRAY_SIZE(rootkeys); i++) { if (!strncmpW(path, rootkeys[i].full, strlenW(rootkeys[i].full))) return rootkeys[i].hkey; if (rootkeys[i].abbrev[0] && !strncmpW(path, rootkeys[i].abbrev, strlenW(rootkeys[i].abbrev))) @@ -1423,7 +1427,7 @@ static HRESULT split_reg_path(const WCHAR *path, WCHAR **subkey, WCHAR **value) unsigned int len = *value - *subkey - 1; WCHAR *ret; - ret = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); + ret = heap_alloc((len + 1)*sizeof(WCHAR)); if (!ret) return E_OUTOFMEMORY; @@ -1463,7 +1467,7 @@ static HRESULT WINAPI WshShell3_RegRead(IWshShell3 *iface, BSTR name, VARIANT *v if (ret == ERROR_SUCCESS) { void *data; - data = HeapAlloc(GetProcessHeap(), 0, datalen); + data = heap_alloc(datalen); if (!data) { hr = E_OUTOFMEMORY; goto fail; @@ -1471,7 +1475,7 @@ static HRESULT WINAPI WshShell3_RegRead(IWshShell3 *iface, BSTR name, VARIANT *v ret = RegGetValueW(root, subkey, val, RRF_RT_ANY, &type, data, &datalen); if (ret) { - HeapFree(GetProcessHeap(), 0, data); + heap_free(data); hr = HRESULT_FROM_WIN32(ret); goto fail; } @@ -1561,7 +1565,7 @@ static HRESULT WINAPI WshShell3_RegRead(IWshShell3 *iface, BSTR name, VARIANT *v hr = E_FAIL; }; - HeapFree(GetProcessHeap(), 0, data); + heap_free(data); if (FAILED(hr)) VariantInit(value); } @@ -1570,7 +1574,7 @@ static HRESULT WINAPI WshShell3_RegRead(IWshShell3 *iface, BSTR name, VARIANT *v fail: if (val) - HeapFree(GetProcessHeap(), 0, subkey); + heap_free(subkey); return hr; } @@ -1658,7 +1662,7 @@ static HRESULT WINAPI WshShell3_RegWrite(IWshShell3 *iface, BSTR name, VARIANT * fail: VariantClear(&v); if (val) - HeapFree(GetProcessHeap(), 0, subkey); + heap_free(subkey); return hr; } diff --git a/dll/win32/wshom.ocx/wshom.rc b/dll/win32/wshom.ocx/wshom.rc index 806e788de5..5de4b9e8e0 100644 --- a/dll/win32/wshom.ocx/wshom.rc +++ b/dll/win32/wshom.ocx/wshom.rc @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <windef.h> +#include "windef.h" LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL diff --git a/dll/win32/wshom.ocx/wshom_main.c b/dll/win32/wshom.ocx/wshom_main.c index e199783f1d..a44b44ce8f 100644 --- a/dll/win32/wshom.ocx/wshom_main.c +++ b/dll/win32/wshom.ocx/wshom_main.c @@ -18,7 +18,13 @@ #include "wshom_private.h" -#include <rpcproxy.h> +#include "initguid.h" +#include "wshom.h" +#include "rpcproxy.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wshom); static HINSTANCE wshom_instance; @@ -101,7 +107,7 @@ void release_typelib(void) if(!typelib) return; - for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++) + for(i = 0; i < ARRAY_SIZE(typeinfos); i++) if(typeinfos[i]) ITypeInfo_Release(typeinfos[i]); diff --git a/dll/win32/wshom.ocx/wshom_private.h b/dll/win32/wshom.ocx/wshom_private.h index abe06d3d41..a3fa3b0f88 100644 --- a/dll/win32/wshom.ocx/wshom_private.h +++ b/dll/win32/wshom.ocx/wshom_private.h @@ -16,20 +16,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef _WSHOM_PRIVATE_H_ -#define _WSHOM_PRIVATE_H_ +#pragma once + +#include <stdarg.h> -#define WIN32_NO_STATUS -#define _INC_WINDOWS #define COBJMACROS -#include <windef.h> -#include <winbase.h> -#include <wshom.h> -#include <ocidl.h> +#include "windef.h" +#include "winbase.h" +#include "ole2.h" +#include "olectl.h" -#include <wine/debug.h> -WINE_DEFAULT_DEBUG_CHANNEL(wshom); +#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) /* typelibs */ typedef enum tid_t { @@ -53,5 +51,3 @@ struct provideclassinfo { extern void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo) DECLSPEC_HIDDEN; HRESULT WINAPI WshShellFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; - -#endif /* _WSHOM_PRIVATE_H_ */ diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 650765d74f..0922d5ff44 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -211,7 +211,7 @@ reactos/dll/win32/wldap32 # Synced to WineStaging-3.3 reactos/dll/win32/wmi # Synced to WineStaging-2.9 reactos/dll/win32/wmiutils # Synced to WineStaging-3.3 reactos/dll/win32/wmvcore # Synced to WineStaging-3.3 -reactos/dll/win32/wshom.ocx # Synced to Wine-3.0 +reactos/dll/win32/wshom.ocx # Synced to WineStaging-3.3 reactos/dll/win32/wtsapi32 # Synced to Wine-3.0 reactos/dll/win32/wuapi # Synced to WineStaging-2.9 reactos/dll/win32/xinput1_1 # Synced to WineStaging-2.9
6 years, 9 months
1
0
0
0
01/01: [ADVAPI32] Revert unnecessary changes, clarify comments and clean-up inconsistencies
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=94435b53d713e1df11751…
commit 94435b53d713e1df11751c1d8e83fde3adf82a76 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Mar 25 12:03:07 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Mar 25 12:03:07 2018 +0200 [ADVAPI32] Revert unnecessary changes, clarify comments and clean-up inconsistencies --- dll/win32/advapi32/service/eventlog.c | 73 +++++++++++++++-------------- dll/win32/advapi32/service/scm.c | 66 +++++++++++++------------- dll/win32/advapi32/service/sctrl.c | 87 +++++++++++++++++------------------ 3 files changed, 116 insertions(+), 110 deletions(-) diff --git a/dll/win32/advapi32/service/eventlog.c b/dll/win32/advapi32/service/eventlog.c index d3afa467ce..9a4617a5ab 100644 --- a/dll/win32/advapi32/service/eventlog.c +++ b/dll/win32/advapi32/service/eventlog.c @@ -41,34 +41,34 @@ EVENTLOG_HANDLE_A_bind(EVENTLOG_HANDLE_A UNCServerName) { handle_t hBinding = NULL; RPC_CSTR pszStringBinding; - RPC_STATUS Status; + RPC_STATUS status; TRACE("EVENTLOG_HANDLE_A_bind() called\n"); - Status = RpcStringBindingComposeA(NULL, + status = RpcStringBindingComposeA(NULL, (RPC_CSTR)"ncacn_np", (RPC_CSTR)UNCServerName, (RPC_CSTR)"\\pipe\\EventLog", NULL, &pszStringBinding); - if (Status) + if (status) { - ERR("RpcStringBindingCompose returned 0x%x\n", Status); + ERR("RpcStringBindingCompose returned 0x%x\n", status); return NULL; } /* Set the binding handle that will be used to bind to the server. */ - Status = RpcBindingFromStringBindingA(pszStringBinding, + status = RpcBindingFromStringBindingA(pszStringBinding, &hBinding); - if (Status != RPC_S_OK) + if (status != RPC_S_OK) { - ERR("RpcBindingFromStringBinding returned 0x%x\n", Status); + ERR("RpcBindingFromStringBinding returned 0x%x\n", status); } - Status = RpcStringFreeA(&pszStringBinding); - if (Status != RPC_S_OK) + status = RpcStringFreeA(&pszStringBinding); + if (status != RPC_S_OK) { - ERR("RpcStringFree returned 0x%x\n", Status); + ERR("RpcStringFree returned 0x%x\n", status); } return hBinding; @@ -79,14 +79,14 @@ void __RPC_USER EVENTLOG_HANDLE_A_unbind(EVENTLOG_HANDLE_A UNCServerName, handle_t hBinding) { - RPC_STATUS Status; + RPC_STATUS status; TRACE("EVENTLOG_HANDLE_A_unbind() called\n"); - Status = RpcBindingFree(&hBinding); - if (Status != RPC_S_OK) + status = RpcBindingFree(&hBinding); + if (status != RPC_S_OK) { - ERR("RpcBindingFree returned 0x%x\n", Status); + ERR("RpcBindingFree returned 0x%x\n", status); } } @@ -96,34 +96,34 @@ EVENTLOG_HANDLE_W_bind(EVENTLOG_HANDLE_W UNCServerName) { handle_t hBinding = NULL; RPC_WSTR pszStringBinding; - RPC_STATUS Status; + RPC_STATUS status; TRACE("EVENTLOG_HANDLE_W_bind() called\n"); - Status = RpcStringBindingComposeW(NULL, + status = RpcStringBindingComposeW(NULL, L"ncacn_np", UNCServerName, L"\\pipe\\EventLog", NULL, &pszStringBinding); - if (Status != RPC_S_OK) + if (status != RPC_S_OK) { - ERR("RpcStringBindingCompose returned 0x%x\n", Status); + ERR("RpcStringBindingCompose returned 0x%x\n", status); return NULL; } /* Set the binding handle that will be used to bind to the server. */ - Status = RpcBindingFromStringBindingW(pszStringBinding, + status = RpcBindingFromStringBindingW(pszStringBinding, &hBinding); - if (Status != RPC_S_OK) + if (status != RPC_S_OK) { - ERR("RpcBindingFromStringBinding returned 0x%x\n", Status); + ERR("RpcBindingFromStringBinding returned 0x%x\n", status); } - Status = RpcStringFreeW(&pszStringBinding); - if (Status != RPC_S_OK) + status = RpcStringFreeW(&pszStringBinding); + if (status != RPC_S_OK) { - ERR("RpcStringFree returned 0x%x\n", Status); + ERR("RpcStringFree returned 0x%x\n", status); } return hBinding; @@ -134,14 +134,14 @@ void __RPC_USER EVENTLOG_HANDLE_W_unbind(EVENTLOG_HANDLE_W UNCServerName, handle_t hBinding) { - RPC_STATUS Status; + RPC_STATUS status; TRACE("EVENTLOG_HANDLE_W_unbind() called\n"); - Status = RpcBindingFree(&hBinding); - if (Status != RPC_S_OK) + status = RpcBindingFree(&hBinding); + if (status != RPC_S_OK) { - ERR("RpcBindingFree returned 0x%x\n", Status); + ERR("RpcBindingFree returned 0x%x\n", status); } } @@ -813,7 +813,8 @@ ElfOpenBackupEventLogW(IN PUNICODE_STRING UNCServerNameU, { Status = ElfrOpenBELW(pUNCServerName, (PRPC_UNICODE_STRING)BackupFileNameU, - 1, 1, + 1, + 1, (IELF_HANDLE*)phEventLog); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) @@ -851,7 +852,7 @@ OpenBackupEventLogW(IN LPCWSTR lpUNCServerName, RtlInitUnicodeString(&UNCServerName, lpUNCServerName); Status = ElfOpenBackupEventLogW(&UNCServerName, &FileName, &hEventLog); - + if (FileName.Buffer != NULL) RtlFreeHeap(RtlGetProcessHeap(), 0, FileName.Buffer); @@ -901,7 +902,8 @@ ElfOpenEventLogA(IN PANSI_STRING UNCServerNameA, Status = ElfrOpenELA(pUNCServerName, (PRPC_STRING)SourceNameA, &EmptyStringA, - 1, 1, + 1, + 1, (IELF_HANDLE*)phEventLog); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) @@ -966,7 +968,8 @@ ElfOpenEventLogW(IN PUNICODE_STRING UNCServerNameU, Status = ElfrOpenELW(pUNCServerName, (PRPC_UNICODE_STRING)SourceNameU, &EmptyStringU, - 1, 1, + 1, + 1, (IELF_HANDLE*)phEventLog); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) @@ -1204,7 +1207,8 @@ ElfRegisterEventSourceA(IN PANSI_STRING UNCServerNameA, Status = ElfrRegisterEventSourceA(pUNCServerName, (PRPC_STRING)SourceNameA, &EmptyStringA, - 1, 1, + 1, + 1, (IELF_HANDLE*)phEventLog); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) @@ -1274,7 +1278,8 @@ ElfRegisterEventSourceW(IN PUNICODE_STRING UNCServerNameU, Status = ElfrRegisterEventSourceW(pUNCServerName, (PRPC_UNICODE_STRING)SourceNameU, &EmptyStringU, - 1, 1, + 1, + 1, (IELF_HANDLE*)phEventLog); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) diff --git a/dll/win32/advapi32/service/scm.c b/dll/win32/advapi32/service/scm.c index 7fa0b8880b..92661c9581 100644 --- a/dll/win32/advapi32/service/scm.c +++ b/dll/win32/advapi32/service/scm.c @@ -10,7 +10,7 @@ /* INCLUDES ******************************************************************/ #include <advapi32.h> -WINE_DEFAULT_DEBUG_CHANNEL(advapi_service); +WINE_DEFAULT_DEBUG_CHANNEL(advapi); /* FUNCTIONS *****************************************************************/ @@ -20,35 +20,35 @@ SVCCTL_HANDLEA_bind(SVCCTL_HANDLEA szMachineName) { handle_t hBinding = NULL; RPC_CSTR pszStringBinding; - RPC_STATUS Status; + RPC_STATUS status; TRACE("SVCCTL_HANDLEA_bind(%s)\n", debugstr_a(szMachineName)); - Status = RpcStringBindingComposeA(NULL, + status = RpcStringBindingComposeA(NULL, (RPC_CSTR)"ncacn_np", (RPC_CSTR)szMachineName, (RPC_CSTR)"\\pipe\\ntsvcs", NULL, &pszStringBinding); - if (Status != RPC_S_OK) + if (status != RPC_S_OK) { - ERR("RpcStringBindingCompose returned 0x%x\n", Status); + ERR("RpcStringBindingCompose returned 0x%x\n", status); return NULL; } /* Set the binding handle that will be used to bind to the server. */ - Status = RpcBindingFromStringBindingA(pszStringBinding, + status = RpcBindingFromStringBindingA(pszStringBinding, &hBinding); - if (Status != RPC_S_OK) + if (status != RPC_S_OK) { - ERR("RpcBindingFromStringBinding returned 0x%x\n", Status); + ERR("RpcBindingFromStringBinding returned 0x%x\n", status); } - Status = RpcStringFreeA(&pszStringBinding); - if (Status != RPC_S_OK) + status = RpcStringFreeA(&pszStringBinding); + if (status != RPC_S_OK) { - ERR("RpcStringFree returned 0x%x\n", Status); + ERR("RpcStringFree returned 0x%x\n", status); } return hBinding; @@ -59,15 +59,15 @@ void __RPC_USER SVCCTL_HANDLEA_unbind(SVCCTL_HANDLEA szMachineName, handle_t hBinding) { - RPC_STATUS Status; + RPC_STATUS status; TRACE("SVCCTL_HANDLEA_unbind(%s %p)\n", debugstr_a(szMachineName), hBinding); - Status = RpcBindingFree(&hBinding); - if (Status != RPC_S_OK) + status = RpcBindingFree(&hBinding); + if (status != RPC_S_OK) { - ERR("RpcBindingFree returned 0x%x\n", Status); + ERR("RpcBindingFree returned 0x%x\n", status); } } @@ -77,35 +77,35 @@ SVCCTL_HANDLEW_bind(SVCCTL_HANDLEW szMachineName) { handle_t hBinding = NULL; RPC_WSTR pszStringBinding; - RPC_STATUS Status; + RPC_STATUS status; TRACE("SVCCTL_HANDLEW_bind(%s)\n", debugstr_w(szMachineName)); - Status = RpcStringBindingComposeW(NULL, + status = RpcStringBindingComposeW(NULL, L"ncacn_np", szMachineName, L"\\pipe\\ntsvcs", NULL, &pszStringBinding); - if (Status != RPC_S_OK) + if (status != RPC_S_OK) { - ERR("RpcStringBindingCompose returned 0x%x\n", Status); + ERR("RpcStringBindingCompose returned 0x%x\n", status); return NULL; } /* Set the binding handle that will be used to bind to the server. */ - Status = RpcBindingFromStringBindingW(pszStringBinding, + status = RpcBindingFromStringBindingW(pszStringBinding, &hBinding); - if (Status != RPC_S_OK) + if (status != RPC_S_OK) { - ERR("RpcBindingFromStringBinding returned 0x%x\n", Status); + ERR("RpcBindingFromStringBinding returned 0x%x\n", status); } - Status = RpcStringFreeW(&pszStringBinding); - if (Status != RPC_S_OK) + status = RpcStringFreeW(&pszStringBinding); + if (status != RPC_S_OK) { - ERR("RpcStringFree returned 0x%x\n", Status); + ERR("RpcStringFree returned 0x%x\n", status); } return hBinding; @@ -116,20 +116,19 @@ void __RPC_USER SVCCTL_HANDLEW_unbind(SVCCTL_HANDLEW szMachineName, handle_t hBinding) { - RPC_STATUS Status; + RPC_STATUS status; TRACE("SVCCTL_HANDLEW_unbind(%s %p)\n", debugstr_w(szMachineName), hBinding); - Status = RpcBindingFree(&hBinding); - if (Status != RPC_S_OK) + status = RpcBindingFree(&hBinding); + if (status != RPC_S_OK) { - ERR("RpcBindingFree returned 0x%x\n", Status); + ERR("RpcBindingFree returned 0x%x\n", status); } } -/* HACK: because of a problem with rpcrt4, rpcserver is hacked to return 6 for ERROR_SERVICE_DOES_NOT_EXIST */ DWORD ScmRpcStatusToWinError(RPC_STATUS Status) { @@ -1638,6 +1637,7 @@ GetServiceKeyNameA(SC_HANDLE hSCManager, } RpcExcept(EXCEPTION_EXECUTE_HANDLER) { + /* HACK: because of a problem with rpcrt4, rpcserver is hacked to return 6 for ERROR_SERVICE_DOES_NOT_EXIST */ dwError = ScmRpcStatusToWinError(RpcExceptionCode()); } RpcEndExcept; @@ -1797,11 +1797,13 @@ WaitForSCManager(VOID) hEvent = OpenEventW(SYNCHRONIZE, FALSE, SCM_START_EVENT); if (hEvent == NULL) { - if (GetLastError() != ERROR_FILE_NOT_FOUND) return; + if (GetLastError() != ERROR_FILE_NOT_FOUND) + return; /* Try to create a new event */ hEvent = CreateEventW(NULL, TRUE, FALSE, SCM_START_EVENT); - if (hEvent == NULL) return; + if (hEvent == NULL) + return; } /* Wait for 3 minutes */ diff --git a/dll/win32/advapi32/service/sctrl.c b/dll/win32/advapi32/service/sctrl.c index c21540227d..40970f0811 100644 --- a/dll/win32/advapi32/service/sctrl.c +++ b/dll/win32/advapi32/service/sctrl.c @@ -12,7 +12,7 @@ /* INCLUDES ******************************************************************/ #include <advapi32.h> -WINE_DEFAULT_DEBUG_CHANNEL(advapi_service); +WINE_DEFAULT_DEBUG_CHANNEL(advapi); /* TYPES *********************************************************************/ @@ -135,9 +135,8 @@ ScDestroyStatusBinding(VOID) } -static DWORD -ScLookupServiceByServiceName(IN LPCWSTR lpServiceName, - OUT PACTIVE_SERVICE* pService) +static PACTIVE_SERVICE +ScLookupServiceByServiceName(LPCWSTR lpServiceName) { DWORD i; @@ -145,10 +144,7 @@ ScLookupServiceByServiceName(IN LPCWSTR lpServiceName, lpServiceName); if (lpActiveServices[0].bOwnProcess) - { - *pService = &lpActiveServices[0]; - return ERROR_SUCCESS; - } + return &lpActiveServices[0]; for (i = 0; i < dwActiveServiceCount; i++) { @@ -156,14 +152,12 @@ ScLookupServiceByServiceName(IN LPCWSTR lpServiceName, if (_wcsicmp(lpActiveServices[i].ServiceName.Buffer, lpServiceName) == 0) { TRACE("Found!\n"); - *pService = &lpActiveServices[i]; - return ERROR_SUCCESS; + return &lpActiveServices[i]; } } TRACE("No service found!\n"); - *pService = NULL; - return ERROR_SERVICE_NOT_IN_EXE; + return NULL; } @@ -600,8 +594,8 @@ ScServiceDispatcher(HANDLE hPipe, if (ControlPacket->dwControl == SERVICE_CONTROL_START_OWN) lpActiveServices[0].bOwnProcess = TRUE; - dwError = ScLookupServiceByServiceName(lpServiceName, &lpService); - if ((dwError == ERROR_SUCCESS) && (lpService != NULL)) + lpService = ScLookupServiceByServiceName(lpServiceName); + if (lpService != NULL) { /* Execute command */ switch (ControlPacket->dwControl) @@ -623,6 +617,10 @@ ScServiceDispatcher(HANDLE hPipe, break; } } + else + { + dwError = ERROR_SERVICE_NOT_IN_EXE; + } } ReplyPacket.dwError = dwError; @@ -685,16 +683,15 @@ SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION lpHandlerProc) { - DWORD dwError; PACTIVE_SERVICE Service; TRACE("RegisterServiceCtrlHandlerW(%s %p %p)\n", debugstr_w(lpServiceName), lpHandlerProc); - dwError = ScLookupServiceByServiceName(lpServiceName, &Service); - if ((dwError != ERROR_SUCCESS) || (Service == NULL)) + Service = ScLookupServiceByServiceName(lpServiceName); + if (Service == NULL) { - SetLastError(dwError); + SetLastError(ERROR_SERVICE_NOT_IN_EXE); return NULL; } @@ -704,7 +701,7 @@ RegisterServiceCtrlHandlerW(LPCWSTR lpServiceName, return NULL; } - Service->HandlerFunction = lpHandlerProc; + Service->HandlerFunction = lpHandlerProc; Service->HandlerFunctionEx = NULL; TRACE("RegisterServiceCtrlHandler returning %p\n", Service->hServiceStatus); @@ -757,16 +754,15 @@ RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext) { - DWORD dwError; PACTIVE_SERVICE Service; TRACE("RegisterServiceCtrlHandlerExW(%s %p %p)\n", debugstr_w(lpServiceName), lpHandlerProc, lpContext); - dwError = ScLookupServiceByServiceName(lpServiceName, &Service); - if ((dwError != ERROR_SUCCESS) || (Service == NULL)) + Service = ScLookupServiceByServiceName(lpServiceName); + if (Service == NULL) { - SetLastError(dwError); + SetLastError(ERROR_SERVICE_NOT_IN_EXE); return NULL; } @@ -776,11 +772,11 @@ RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, return NULL; } - Service->HandlerFunction = NULL; + Service->HandlerFunction = NULL; Service->HandlerFunctionEx = lpHandlerProc; - Service->HandlerContext = lpContext; + Service->HandlerContext = lpContext; - TRACE("RegisterServiceCtrlHandlerEx returning 0x%p\n", Service->hServiceStatus); + TRACE("RegisterServiceCtrlHandlerEx returning %p\n", Service->hServiceStatus); return Service->hServiceStatus; } @@ -996,7 +992,7 @@ StartServiceCtrlDispatcherA(const SERVICE_TABLE_ENTRYA *lpServiceStartTable) dwActiveServiceCount = i; - /* Initialize the service table */ + /* Allocate the service table */ lpActiveServices = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, dwActiveServiceCount * sizeof(ACTIVE_SERVICE)); @@ -1017,13 +1013,12 @@ StartServiceCtrlDispatcherA(const SERVICE_TABLE_ENTRYA *lpServiceStartTable) lpActiveServices[i].bOwnProcess = FALSE; } - /* Initialize the connection to the SCM */ - + /* Connect to the SCM */ dwError = ScConnectControlPipe(&hPipe); if (dwError != ERROR_SUCCESS) { bRet = FALSE; - goto Done; + goto done; } dwBufSize = sizeof(SCM_CONTROL_PACKET) + @@ -1036,22 +1031,24 @@ StartServiceCtrlDispatcherA(const SERVICE_TABLE_ENTRYA *lpServiceStartTable) { dwError = ERROR_NOT_ENOUGH_MEMORY; bRet = FALSE; - goto Done; + goto done; } ScCreateStatusBinding(); - /* Start the dispatcher loop */ + /* Call the dispatcher loop */ ScServiceDispatcher(hPipe, ControlPacket, dwBufSize); - /* Close the connection */ + ScDestroyStatusBinding(); + + /* Close the connection */ CloseHandle(hPipe); /* Free the control packet */ RtlFreeHeap(RtlGetProcessHeap(), 0, ControlPacket); -Done: +done: /* Free the service table */ for (i = 0; i < dwActiveServiceCount; i++) { @@ -1061,7 +1058,8 @@ Done: lpActiveServices = NULL; dwActiveServiceCount = 0; - if (!bRet) SetLastError(dwError); + if (!bRet) + SetLastError(dwError); return bRet; } @@ -1093,7 +1091,7 @@ StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable) dwActiveServiceCount = i; - /* Initialize the service table */ + /* Allocate the service table */ lpActiveServices = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, dwActiveServiceCount * sizeof(ACTIVE_SERVICE)); @@ -1114,13 +1112,12 @@ StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable) lpActiveServices[i].bOwnProcess = FALSE; } - /* Initialize the connection to the SCM */ - + /* Connect to the SCM */ dwError = ScConnectControlPipe(&hPipe); if (dwError != ERROR_SUCCESS) { bRet = FALSE; - goto Done; + goto done; } dwBufSize = sizeof(SCM_CONTROL_PACKET) + @@ -1133,22 +1130,23 @@ StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable) { dwError = ERROR_NOT_ENOUGH_MEMORY; bRet = FALSE; - goto Done; + goto done; } ScCreateStatusBinding(); - /* Start the dispatcher loop */ + /* Call the dispatcher loop */ ScServiceDispatcher(hPipe, ControlPacket, dwBufSize); - /* Close the connection */ ScDestroyStatusBinding(); + + /* Close the connection */ CloseHandle(hPipe); /* Free the control packet */ RtlFreeHeap(RtlGetProcessHeap(), 0, ControlPacket); -Done: +done: /* Free the service table */ for (i = 0; i < dwActiveServiceCount; i++) { @@ -1158,7 +1156,8 @@ Done: lpActiveServices = NULL; dwActiveServiceCount = 0; - if (!bRet) SetLastError(dwError); + if (!bRet) + SetLastError(dwError); return bRet; }
6 years, 9 months
1
0
0
0
01/01: [ADVAPI32] Improve remaining TRACE messages in service manager functions
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=32bb592e126c7f147e482…
commit 32bb592e126c7f147e482522cff44aecaf7fb45e Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Mar 25 11:30:10 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Mar 25 11:30:10 2018 +0200 [ADVAPI32] Improve remaining TRACE messages in service manager functions --- dll/win32/advapi32/service/scm.c | 76 ++++++++++++++++++++++++++++++---------- 1 file changed, 57 insertions(+), 19 deletions(-) diff --git a/dll/win32/advapi32/service/scm.c b/dll/win32/advapi32/service/scm.c index c859d25c66..7fa0b8880b 100644 --- a/dll/win32/advapi32/service/scm.c +++ b/dll/win32/advapi32/service/scm.c @@ -22,7 +22,8 @@ SVCCTL_HANDLEA_bind(SVCCTL_HANDLEA szMachineName) RPC_CSTR pszStringBinding; RPC_STATUS Status; - TRACE("SVCCTL_HANDLEA_bind()\n"); + TRACE("SVCCTL_HANDLEA_bind(%s)\n", + debugstr_a(szMachineName)); Status = RpcStringBindingComposeA(NULL, (RPC_CSTR)"ncacn_np", @@ -60,7 +61,8 @@ SVCCTL_HANDLEA_unbind(SVCCTL_HANDLEA szMachineName, { RPC_STATUS Status; - TRACE("SVCCTL_HANDLEA_unbind()\n"); + TRACE("SVCCTL_HANDLEA_unbind(%s %p)\n", + debugstr_a(szMachineName), hBinding); Status = RpcBindingFree(&hBinding); if (Status != RPC_S_OK) @@ -77,7 +79,8 @@ SVCCTL_HANDLEW_bind(SVCCTL_HANDLEW szMachineName) RPC_WSTR pszStringBinding; RPC_STATUS Status; - TRACE("SVCCTL_HANDLEW_bind()\n"); + TRACE("SVCCTL_HANDLEW_bind(%s)\n", + debugstr_w(szMachineName)); Status = RpcStringBindingComposeW(NULL, L"ncacn_np", @@ -115,7 +118,8 @@ SVCCTL_HANDLEW_unbind(SVCCTL_HANDLEW szMachineName, { RPC_STATUS Status; - TRACE("SVCCTL_HANDLEW_unbind()\n"); + TRACE("SVCCTL_HANDLEW_unbind(%s %p)\n", + debugstr_w(szMachineName), hBinding); Status = RpcBindingFree(&hBinding); if (Status != RPC_S_OK) @@ -129,6 +133,9 @@ SVCCTL_HANDLEW_unbind(SVCCTL_HANDLEW szMachineName, DWORD ScmRpcStatusToWinError(RPC_STATUS Status) { + TRACE("ScmRpcStatusToWinError(%lx)\n", + Status); + switch (Status) { case STATUS_ACCESS_VIOLATION: @@ -162,7 +169,8 @@ ChangeServiceConfig2A(SC_HANDLE hService, SC_RPC_CONFIG_INFOA Info; DWORD dwError; - TRACE("ChangeServiceConfig2A()\n"); + TRACE("ChangeServiceConfig2A(%p %lu %p)\n", + hService, dwInfoLevel, lpInfo); if (lpInfo == NULL) return TRUE; @@ -219,7 +227,8 @@ ChangeServiceConfig2W(SC_HANDLE hService, SC_RPC_CONFIG_INFOW Info; DWORD dwError; - TRACE("ChangeServiceConfig2W()\n"); + TRACE("ChangeServiceConfig2W(%p %lu %p)\n", + hService, dwInfoLevel, lpInfo); if (lpInfo == NULL) return TRUE; @@ -289,7 +298,10 @@ ChangeServiceConfigA(SC_HANDLE hService, LPWSTR lpPasswordW = NULL; LPBYTE lpEncryptedPassword = NULL; - TRACE("ChangeServiceConfigA()\n"); + TRACE("ChangeServiceConfigA(%p %lu %lu %lu %s %s %p %s %s %s %s)\n", + dwServiceType, dwStartType, dwErrorControl, debugstr_a(lpBinaryPathName), + debugstr_a(lpLoadOrderGroup), lpdwTagId, debugstr_a(lpDependencies), + debugstr_a(lpServiceStartName), debugstr_a(lpPassword), debugstr_a(lpDisplayName)); /* Calculate the Dependencies length*/ if (lpDependencies != NULL) @@ -389,7 +401,10 @@ ChangeServiceConfigW(SC_HANDLE hService, DWORD dwPasswordLength = 0; LPBYTE lpEncryptedPassword = NULL; - TRACE("ChangeServiceConfigW()\n"); + TRACE("ChangeServiceConfigW(%p %lu %lu %lu %s %s %p %s %s %s %s)\n", + dwServiceType, dwStartType, dwErrorControl, debugstr_w(lpBinaryPathName), + debugstr_w(lpLoadOrderGroup), lpdwTagId, debugstr_w(lpDependencies), + debugstr_w(lpServiceStartName), debugstr_w(lpPassword), debugstr_w(lpDisplayName)); /* Calculate the Dependencies length*/ if (lpDependencies != NULL) @@ -574,8 +589,11 @@ CreateServiceA(SC_HANDLE hSCManager, LPWSTR lpPasswordW = NULL; LPBYTE lpEncryptedPassword = NULL; - TRACE("CreateServiceA(%p %s %s)\n", - hSCManager, debugstr_a(lpServiceName), debugstr_a(lpDisplayName)); + TRACE("CreateServiceA(%p %s %s %lx %lu %lu %lu %s %s %p %s %s %s)\n", + hSCManager, debugstr_a(lpServiceName), debugstr_a(lpDisplayName), + dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl, + debugstr_a(lpBinaryPathName), debugstr_a(lpLoadOrderGroup), lpdwTagId, + debugstr_a(lpDependencies), debugstr_a(lpServiceStartName), debugstr_a(lpPassword)); if (!hSCManager) { @@ -687,8 +705,11 @@ CreateServiceW(SC_HANDLE hSCManager, DWORD dwPasswordLength = 0; LPBYTE lpEncryptedPassword = NULL; - TRACE("CreateServiceW(%p %s %s)\n", - hSCManager, debugstr_w(lpServiceName), debugstr_w(lpDisplayName)); + TRACE("CreateServiceW(%p %s %s %lx %lu %lu %lu %s %s %p %s %s %s)\n", + hSCManager, debugstr_w(lpServiceName), debugstr_w(lpDisplayName), + dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl, + debugstr_w(lpBinaryPathName), debugstr_w(lpLoadOrderGroup), lpdwTagId, + debugstr_w(lpDependencies), debugstr_w(lpServiceStartName), debugstr_w(lpPassword)); if (!hSCManager) { @@ -806,7 +827,9 @@ EnumDependentServicesA(SC_HANDLE hService, DWORD dwError; DWORD dwCount; - TRACE("EnumDependentServicesA()\n"); + TRACE("EnumDependentServicesA(%p %lu %p %lu %p %p)\n", + hService, dwServiceState, lpServices, cbBufSize, + pcbBytesNeeded, lpServicesReturned); if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSA)) { @@ -882,7 +905,9 @@ EnumDependentServicesW(SC_HANDLE hService, DWORD dwError; DWORD dwCount; - TRACE("EnumDependentServicesW()\n"); + TRACE("EnumDependentServicesW(%p %lu %p %lu %p %p)\n", + hService, dwServiceState, lpServices, cbBufSize, + pcbBytesNeeded, lpServicesReturned); if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSW)) { @@ -961,7 +986,10 @@ EnumServiceGroupW(SC_HANDLE hSCManager, DWORD dwError; DWORD dwCount; - TRACE("EnumServiceGroupW()\n"); + TRACE("EnumServiceGroupW(%p %lu %lu %p %lu %p %p %p %s)\n", + hSCManager, dwServiceType, dwServiceState, lpServices, + cbBufSize, pcbBytesNeeded, lpServicesReturned, + lpResumeHandle, debugstr_w(lpGroup)); if (!hSCManager) { @@ -1068,7 +1096,9 @@ EnumServicesStatusA(SC_HANDLE hSCManager, DWORD dwError; DWORD dwCount; - TRACE("EnumServicesStatusA()\n"); + TRACE("EnumServicesStatusA(%p %lu %lu %p %lu %p %p %p)\n", + hSCManager, dwServiceType, dwServiceState, lpServices, + cbBufSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle); if (!hSCManager) { @@ -1160,7 +1190,9 @@ EnumServicesStatusW(SC_HANDLE hSCManager, DWORD dwError; DWORD dwCount; - TRACE("EnumServicesStatusW()\n"); + TRACE("EnumServicesStatusW(%p %lu %lu %p %lu %p %p %p)\n", + hSCManager, dwServiceType, dwServiceState, lpServices, + cbBufSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle); if (!hSCManager) { @@ -1254,7 +1286,10 @@ EnumServicesStatusExA(SC_HANDLE hSCManager, DWORD dwError; DWORD dwCount; - TRACE("EnumServicesStatusExA()\n"); + TRACE("EnumServicesStatusExA(%p %lu %lu %p %lu %p %p %p %s)\n", + hSCManager, dwServiceType, dwServiceState, lpServices, + cbBufSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle, + debugstr_a(pszGroupName)); if (InfoLevel != SC_ENUM_PROCESS_INFO) { @@ -1359,7 +1394,10 @@ EnumServicesStatusExW(SC_HANDLE hSCManager, DWORD dwError; DWORD dwCount; - TRACE("EnumServicesStatusExW()\n"); + TRACE("EnumServicesStatusExW(%p %lu %lu %p %lu %p %p %p %s)\n", + hSCManager, dwServiceType, dwServiceState, lpServices, + cbBufSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle, + debugstr_w(pszGroupName)); if (InfoLevel != SC_ENUM_PROCESS_INFO) {
6 years, 9 months
1
0
0
0
01/01: [ADVAPI32] Add or improve TRACE messages in a lot of service manager functions
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d7e2b7a8e069de122297c…
commit d7e2b7a8e069de122297c7de964b694ac77e1c27 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Mar 25 03:58:53 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Mar 25 03:58:53 2018 +0200 [ADVAPI32] Add or improve TRACE messages in a lot of service manager functions --- dll/win32/advapi32/service/scm.c | 133 ++++++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 57 deletions(-) diff --git a/dll/win32/advapi32/service/scm.c b/dll/win32/advapi32/service/scm.c index 5a20508f69..c859d25c66 100644 --- a/dll/win32/advapi32/service/scm.c +++ b/dll/win32/advapi32/service/scm.c @@ -22,7 +22,7 @@ SVCCTL_HANDLEA_bind(SVCCTL_HANDLEA szMachineName) RPC_CSTR pszStringBinding; RPC_STATUS Status; - TRACE("SVCCTL_HANDLEA_bind() called\n"); + TRACE("SVCCTL_HANDLEA_bind()\n"); Status = RpcStringBindingComposeA(NULL, (RPC_CSTR)"ncacn_np", @@ -60,7 +60,7 @@ SVCCTL_HANDLEA_unbind(SVCCTL_HANDLEA szMachineName, { RPC_STATUS Status; - TRACE("SVCCTL_HANDLEA_unbind() called\n"); + TRACE("SVCCTL_HANDLEA_unbind()\n"); Status = RpcBindingFree(&hBinding); if (Status != RPC_S_OK) @@ -77,7 +77,7 @@ SVCCTL_HANDLEW_bind(SVCCTL_HANDLEW szMachineName) RPC_WSTR pszStringBinding; RPC_STATUS Status; - TRACE("SVCCTL_HANDLEW_bind() called\n"); + TRACE("SVCCTL_HANDLEW_bind()\n"); Status = RpcStringBindingComposeW(NULL, L"ncacn_np", @@ -115,7 +115,7 @@ SVCCTL_HANDLEW_unbind(SVCCTL_HANDLEW szMachineName, { RPC_STATUS Status; - TRACE("SVCCTL_HANDLEW_unbind() called\n"); + TRACE("SVCCTL_HANDLEW_unbind()\n"); Status = RpcBindingFree(&hBinding); if (Status != RPC_S_OK) @@ -162,7 +162,7 @@ ChangeServiceConfig2A(SC_HANDLE hService, SC_RPC_CONFIG_INFOA Info; DWORD dwError; - TRACE("ChangeServiceConfig2A() called\n"); + TRACE("ChangeServiceConfig2A()\n"); if (lpInfo == NULL) return TRUE; @@ -219,7 +219,7 @@ ChangeServiceConfig2W(SC_HANDLE hService, SC_RPC_CONFIG_INFOW Info; DWORD dwError; - TRACE("ChangeServiceConfig2W() called\n"); + TRACE("ChangeServiceConfig2W()\n"); if (lpInfo == NULL) return TRUE; @@ -289,7 +289,7 @@ ChangeServiceConfigA(SC_HANDLE hService, LPWSTR lpPasswordW = NULL; LPBYTE lpEncryptedPassword = NULL; - TRACE("ChangeServiceConfigA() called\n"); + TRACE("ChangeServiceConfigA()\n"); /* Calculate the Dependencies length*/ if (lpDependencies != NULL) @@ -389,7 +389,7 @@ ChangeServiceConfigW(SC_HANDLE hService, DWORD dwPasswordLength = 0; LPBYTE lpEncryptedPassword = NULL; - TRACE("ChangeServiceConfigW() called\n"); + TRACE("ChangeServiceConfigW()\n"); /* Calculate the Dependencies length*/ if (lpDependencies != NULL) @@ -455,7 +455,8 @@ CloseServiceHandle(SC_HANDLE hSCObject) { DWORD dwError; - TRACE("CloseServiceHandle() called\n"); + TRACE("CloseServiceHandle(%p)\n", + hSCObject); if (!hSCObject) { @@ -498,8 +499,8 @@ ControlService(SC_HANDLE hService, { DWORD dwError; - TRACE("ControlService(%x, %x, %p)\n", - hService, dwControl, lpServiceStatus); + TRACE("ControlService(%p %lu %p)\n", + hService, dwControl, lpServiceStatus); RpcTryExcept { @@ -537,8 +538,8 @@ ControlServiceEx(IN SC_HANDLE hService, IN DWORD dwInfoLevel, IN OUT PVOID pControlParams) { - FIXME("ControlServiceEx(0x%p, 0x%x, 0x%x, 0x%p) UNIMPLEMENTED!\n", - hService, dwControl, dwInfoLevel, pControlParams); + FIXME("ControlServiceEx(%p %lu %lu %p)\n", + hService, dwControl, dwInfoLevel, pControlParams); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } @@ -573,9 +574,8 @@ CreateServiceA(SC_HANDLE hSCManager, LPWSTR lpPasswordW = NULL; LPBYTE lpEncryptedPassword = NULL; - TRACE("CreateServiceA() called\n"); - TRACE("%p %s %s\n", hSCManager, - lpServiceName, lpDisplayName); + TRACE("CreateServiceA(%p %s %s)\n", + hSCManager, debugstr_a(lpServiceName), debugstr_a(lpDisplayName)); if (!hSCManager) { @@ -687,9 +687,8 @@ CreateServiceW(SC_HANDLE hSCManager, DWORD dwPasswordLength = 0; LPBYTE lpEncryptedPassword = NULL; - TRACE("CreateServiceW() called\n"); - TRACE("%p %S %S\n", hSCManager, - lpServiceName, lpDisplayName); + TRACE("CreateServiceW(%p %s %s)\n", + hSCManager, debugstr_w(lpServiceName), debugstr_w(lpDisplayName)); if (!hSCManager) { @@ -764,7 +763,8 @@ DeleteService(SC_HANDLE hService) { DWORD dwError; - TRACE("DeleteService(%x)\n", hService); + TRACE("DeleteService(%p)\n", + hService); RpcTryExcept { @@ -806,7 +806,7 @@ EnumDependentServicesA(SC_HANDLE hService, DWORD dwError; DWORD dwCount; - TRACE("EnumDependentServicesA() called\n"); + TRACE("EnumDependentServicesA()\n"); if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSA)) { @@ -882,7 +882,7 @@ EnumDependentServicesW(SC_HANDLE hService, DWORD dwError; DWORD dwCount; - TRACE("EnumDependentServicesW() called\n"); + TRACE("EnumDependentServicesW()\n"); if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSW)) { @@ -961,7 +961,7 @@ EnumServiceGroupW(SC_HANDLE hSCManager, DWORD dwError; DWORD dwCount; - TRACE("EnumServiceGroupW() called\n"); + TRACE("EnumServiceGroupW()\n"); if (!hSCManager) { @@ -1068,7 +1068,7 @@ EnumServicesStatusA(SC_HANDLE hSCManager, DWORD dwError; DWORD dwCount; - TRACE("EnumServicesStatusA() called\n"); + TRACE("EnumServicesStatusA()\n"); if (!hSCManager) { @@ -1160,7 +1160,7 @@ EnumServicesStatusW(SC_HANDLE hSCManager, DWORD dwError; DWORD dwCount; - TRACE("EnumServicesStatusW() called\n"); + TRACE("EnumServicesStatusW()\n"); if (!hSCManager) { @@ -1254,7 +1254,7 @@ EnumServicesStatusExA(SC_HANDLE hSCManager, DWORD dwError; DWORD dwCount; - TRACE("EnumServicesStatusExA() called\n"); + TRACE("EnumServicesStatusExA()\n"); if (InfoLevel != SC_ENUM_PROCESS_INFO) { @@ -1359,7 +1359,7 @@ EnumServicesStatusExW(SC_HANDLE hSCManager, DWORD dwError; DWORD dwCount; - TRACE("EnumServicesStatusExW() called\n"); + TRACE("EnumServicesStatusExW()\n"); if (InfoLevel != SC_ENUM_PROCESS_INFO) { @@ -1456,9 +1456,8 @@ GetServiceDisplayNameA(SC_HANDLE hSCManager, LPSTR lpNameBuffer; CHAR szEmptyName[] = ""; - TRACE("GetServiceDisplayNameA() called\n"); - TRACE("%p %s %p %p\n", hSCManager, - debugstr_a(lpServiceName), lpDisplayName, lpcchBuffer); + TRACE("GetServiceDisplayNameA(%p %s %p %p)\n", + hSCManager, debugstr_a(lpServiceName), lpDisplayName, lpcchBuffer); if (!hSCManager) { @@ -1515,7 +1514,8 @@ GetServiceDisplayNameW(SC_HANDLE hSCManager, LPWSTR lpNameBuffer; WCHAR szEmptyName[] = L""; - TRACE("GetServiceDisplayNameW() called\n"); + TRACE("GetServiceDisplayNameW(%p %s %p %p)\n", + hSCManager, debugstr_w(lpServiceName), lpDisplayName, lpcchBuffer); if (!hSCManager) { @@ -1572,7 +1572,8 @@ GetServiceKeyNameA(SC_HANDLE hSCManager, LPSTR lpNameBuffer; CHAR szEmptyName[] = ""; - TRACE("GetServiceKeyNameA() called\n"); + TRACE("GetServiceKeyNameA(%p %s %p %p)\n", + hSCManager, debugstr_a(lpDisplayName), lpServiceName, lpcchBuffer); if (!hSCManager) { @@ -1629,7 +1630,8 @@ GetServiceKeyNameW(SC_HANDLE hSCManager, LPWSTR lpNameBuffer; WCHAR szEmptyName[] = L""; - TRACE("GetServiceKeyNameW() called\n"); + TRACE("GetServiceKeyNameW(%p %s %p %p)\n", + hSCManager, debugstr_w(lpDisplayName), lpServiceName, lpcchBuffer); if (!hSCManager) { @@ -1683,7 +1685,8 @@ I_ScGetCurrentGroupStateW(SC_HANDLE hSCManager, { DWORD dwError; - TRACE("I_ScGetCurrentGroupStateW() called\n"); + TRACE("I_ScGetCurrentGroupStateW(%p %s %p)\n", + hSCManager, debugstr_w(pszGroupName), pdwGroupState); RpcTryExcept { @@ -1718,7 +1721,8 @@ LockServiceDatabase(SC_HANDLE hSCManager) SC_LOCK hLock; DWORD dwError; - TRACE("LockServiceDatabase(%x)\n", hSCManager); + TRACE("LockServiceDatabase(%p)\n", + hSCManager); RpcTryExcept { @@ -1749,7 +1753,7 @@ WaitForSCManager(VOID) { HANDLE hEvent; - TRACE("WaitForSCManager() called\n"); + TRACE("WaitForSCManager()\n"); /* Try to open the existing event */ hEvent = OpenEventW(SYNCHRONIZE, FALSE, SCM_START_EVENT); @@ -1783,8 +1787,8 @@ OpenSCManagerA(LPCSTR lpMachineName, SC_HANDLE hScm = NULL; DWORD dwError; - TRACE("OpenSCManagerA(%s, %s, %lx)\n", - lpMachineName, lpDatabaseName, dwDesiredAccess); + TRACE("OpenSCManagerA(%s %s %lx)\n", + debugstr_a(lpMachineName), debugstr_a(lpDatabaseName), dwDesiredAccess); WaitForSCManager(); @@ -1827,8 +1831,8 @@ OpenSCManagerW(LPCWSTR lpMachineName, SC_HANDLE hScm = NULL; DWORD dwError; - TRACE("OpenSCManagerW(%S, %S, %lx)\n", - lpMachineName, lpDatabaseName, dwDesiredAccess); + TRACE("OpenSCManagerW(%s %s %lx)\n", + debugstr_w(lpMachineName), debugstr_w(lpDatabaseName), dwDesiredAccess); WaitForSCManager(); @@ -1871,8 +1875,8 @@ OpenServiceA(SC_HANDLE hSCManager, SC_HANDLE hService = NULL; DWORD dwError; - TRACE("OpenServiceA(%p, %s, %lx)\n", - hSCManager, lpServiceName, dwDesiredAccess); + TRACE("OpenServiceA(%p %s %lx)\n", + hSCManager, debugstr_a(lpServiceName), dwDesiredAccess); if (!hSCManager) { @@ -1919,8 +1923,8 @@ OpenServiceW(SC_HANDLE hSCManager, SC_HANDLE hService = NULL; DWORD dwError; - TRACE("OpenServiceW(%p, %S, %lx)\n", - hSCManager, lpServiceName, dwDesiredAccess); + TRACE("OpenServiceW(%p %s %lx)\n", + hSCManager, debugstr_w(lpServiceName), dwDesiredAccess); if (!hSCManager) { @@ -1970,7 +1974,7 @@ QueryServiceConfigA(SC_HANDLE hService, DWORD dwBufferSize; DWORD dwError; - TRACE("QueryServiceConfigA(%p, %p, %lu, %p)\n", + TRACE("QueryServiceConfigA(%p %p %lu %p)\n", hService, lpServiceConfig, cbBufSize, pcbBytesNeeded); if (lpServiceConfig == NULL || @@ -2053,7 +2057,7 @@ QueryServiceConfigW(SC_HANDLE hService, DWORD dwBufferSize; DWORD dwError; - TRACE("QueryServiceConfigW(%p, %p, %lu, %p)\n", + TRACE("QueryServiceConfigW(%p %p %lu %p)\n", hService, lpServiceConfig, cbBufSize, pcbBytesNeeded); if (lpServiceConfig == NULL || @@ -2139,7 +2143,7 @@ QueryServiceConfig2A(SC_HANDLE hService, DWORD dwBufferSize; DWORD dwError; - TRACE("QueryServiceConfig2A(hService %p, dwInfoLevel %lu, lpBuffer %p, cbBufSize %lu, pcbBytesNeeded %p)\n", + TRACE("QueryServiceConfig2A(%p %lu %p %lu %p)\n", hService, dwInfoLevel, lpBuffer, cbBufSize, pcbBytesNeeded); lpTempBuffer = lpBuffer; @@ -2256,8 +2260,8 @@ QueryServiceConfig2W(SC_HANDLE hService, DWORD dwBufferSize; DWORD dwError; - TRACE("QueryServiceConfig2W(%p, %lu, %p, %lu, %p)\n", - hService, dwInfoLevel, lpBuffer, cbBufSize, pcbBytesNeeded); + TRACE("QueryServiceConfig2W(%p %lu %p %lu %p)\n", + hService, dwInfoLevel, lpBuffer, cbBufSize, pcbBytesNeeded); lpTempBuffer = lpBuffer; dwBufferSize = cbBufSize; @@ -2370,7 +2374,8 @@ QueryServiceLockStatusA(SC_HANDLE hSCManager, DWORD dwBufferSize; DWORD dwError; - TRACE("QueryServiceLockStatusA() called\n"); + TRACE("QueryServiceLockStatusA(%p %p %lu %p)\n", + hSCManager, lpLockStatus, cbBufSize, pcbBytesNeeded); if (lpLockStatus == NULL || cbBufSize < sizeof(QUERY_SERVICE_LOCK_STATUSA)) { @@ -2431,7 +2436,8 @@ QueryServiceLockStatusW(SC_HANDLE hSCManager, DWORD dwBufferSize; DWORD dwError; - TRACE("QueryServiceLockStatusW() called\n"); + TRACE("QueryServiceLockStatusW(%p %p %lu %p)\n", + hSCManager, lpLockStatus, cbBufSize, pcbBytesNeeded); if (lpLockStatus == NULL || cbBufSize < sizeof(QUERY_SERVICE_LOCK_STATUSW)) { @@ -2490,7 +2496,7 @@ QueryServiceObjectSecurity(SC_HANDLE hService, { DWORD dwError; - TRACE("QueryServiceObjectSecurity(%p, %lu, %p)\n", + TRACE("QueryServiceObjectSecurity(%p %lu %p)\n", hService, dwSecurityInformation, lpSecurityDescriptor); RpcTryExcept @@ -2517,6 +2523,7 @@ QueryServiceObjectSecurity(SC_HANDLE hService, return TRUE; } + /********************************************************************** * SetServiceObjectSecurity * @@ -2532,6 +2539,9 @@ SetServiceObjectSecurity(SC_HANDLE hService, NTSTATUS Status; DWORD dwError; + TRACE("SetServiceObjectSecurity(%p %lu %p)\n", + hService, dwSecurityInformation, lpSecurityDescriptor); + Length = 0; Status = RtlMakeSelfRelativeSD(lpSecurityDescriptor, SelfRelativeSD, @@ -2596,8 +2606,8 @@ QueryServiceStatus(SC_HANDLE hService, { DWORD dwError; - TRACE("QueryServiceStatus(%p, %p)\n", - hService, lpServiceStatus); + TRACE("QueryServiceStatus(%p %p)\n", + hService, lpServiceStatus); if (!hService) { @@ -2641,7 +2651,8 @@ QueryServiceStatusEx(SC_HANDLE hService, { DWORD dwError; - TRACE("QueryServiceStatusEx() called\n"); + TRACE("QueryServiceStatusEx(%p %lu %p %lu %p)\n", + hService, InfoLevel, lpBuffer, cbBufSize, pcbBytesNeeded); if (InfoLevel != SC_STATUS_PROCESS_INFO) { @@ -2693,6 +2704,9 @@ StartServiceA(SC_HANDLE hService, { DWORD dwError; + TRACE("StartServiceA(%p %lu %p)\n", + hService, dwNumServiceArgs, lpServiceArgVectors); + RpcTryExcept { dwError = RStartServiceA((SC_RPC_HANDLE)hService, @@ -2728,6 +2742,9 @@ StartServiceW(SC_HANDLE hService, { DWORD dwError; + TRACE("StartServiceW(%p %lu %p)\n", + hService, dwNumServiceArgs, lpServiceArgVectors); + RpcTryExcept { dwError = RStartServiceW((SC_RPC_HANDLE)hService, @@ -2761,7 +2778,8 @@ UnlockServiceDatabase(SC_LOCK ScLock) { DWORD dwError; - TRACE("UnlockServiceDatabase(%x)\n", ScLock); + TRACE("UnlockServiceDatabase(%x)\n", + ScLock); RpcTryExcept { @@ -2797,7 +2815,8 @@ NotifyBootConfigStatus(BOOL BootAcceptable) { DWORD dwError; - TRACE("NotifyBootConfigStatus()\n"); + TRACE("NotifyBootConfigStatus(%u)\n", + BootAcceptable); RpcTryExcept {
6 years, 9 months
1
0
0
0
01/01: [ADVAPI32] Add or improve TRACE messages in the service manager functions
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=51bbab834c4b5220d3b43…
commit 51bbab834c4b5220d3b436ba2ffb4b82174ff467 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Mar 25 03:20:34 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Mar 25 03:20:34 2018 +0200 [ADVAPI32] Add or improve TRACE messages in the service manager functions --- dll/win32/advapi32/service/sctrl.c | 75 +++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 18 deletions(-) diff --git a/dll/win32/advapi32/service/sctrl.c b/dll/win32/advapi32/service/sctrl.c index f0de114f40..c21540227d 100644 --- a/dll/win32/advapi32/service/sctrl.c +++ b/dll/win32/advapi32/service/sctrl.c @@ -79,7 +79,7 @@ ScCreateStatusBinding(VOID) LPWSTR pszStringBinding; RPC_STATUS status; - TRACE("ScCreateStatusBinding() called\n"); + TRACE("ScCreateStatusBinding()\n"); status = RpcStringBindingComposeW(NULL, L"ncacn_np", @@ -116,7 +116,7 @@ ScDestroyStatusBinding(VOID) { RPC_STATUS status; - TRACE("ScDestroyStatusBinding() called\n"); + TRACE("ScDestroyStatusBinding()\n"); if (hStatusBinding == NULL) return RPC_S_OK; @@ -141,7 +141,8 @@ ScLookupServiceByServiceName(IN LPCWSTR lpServiceName, { DWORD i; - TRACE("ScLookupServiceByServiceName(%S) called\n", lpServiceName); + TRACE("ScLookupServiceByServiceName(%S)\n", + lpServiceName); if (lpActiveServices[0].bOwnProcess) { @@ -171,7 +172,7 @@ ScServiceMainStubA(LPVOID Context) { PSERVICE_THREAD_PARAMSA ThreadParams = Context; - TRACE("ScServiceMainStubA() called\n"); + TRACE("ScServiceMainStubA(%p)\n", Context); /* Call the main service routine and free the arguments vector */ (ThreadParams->lpServiceMain)(ThreadParams->dwArgCount, @@ -192,7 +193,7 @@ ScServiceMainStubW(LPVOID Context) { PSERVICE_THREAD_PARAMSW ThreadParams = Context; - TRACE("ScServiceMainStubW() called\n"); + TRACE("ScServiceMainStubW(%p)\n", Context); /* Call the main service routine and free the arguments vector */ (ThreadParams->lpServiceMain)(ThreadParams->dwArgCount, @@ -219,6 +220,9 @@ ScConnectControlPipe(HANDLE *hPipe) RTL_QUERY_REGISTRY_TABLE QueryTable[2]; DWORD dwProcessId; + TRACE("ScConnectControlPipe(%p)\n", + hPipe); + /* Get the service number and create the named pipe */ RtlZeroMemory(&QueryTable, sizeof(QueryTable)); @@ -431,12 +435,14 @@ ScStartService(PACTIVE_SERVICE lpService, PSERVICE_THREAD_PARAMSA ThreadParamsA; PSERVICE_THREAD_PARAMSW ThreadParamsW; + TRACE("ScStartService(%p %p)\n", + lpService, ControlPacket); + if (lpService == NULL || ControlPacket == NULL) return ERROR_INVALID_PARAMETER; - TRACE("ScStartService(Size: %lu, Service: '%S') called\n", - ControlPacket->dwSize, - (PWSTR)((ULONG_PTR)ControlPacket + ControlPacket->dwServiceNameOffset)); + TRACE("Size: %lu\n", ControlPacket->dwSize); + TRACE("Service: %S\n", (PWSTR)((ULONG_PTR)ControlPacket + ControlPacket->dwServiceNameOffset)); /* Set the service status handle */ lpService->hServiceStatus = ControlPacket->hServiceStatus; @@ -519,12 +525,14 @@ ScControlService(PACTIVE_SERVICE lpService, { DWORD dwError; + TRACE("ScControlService(%p %p)\n", + lpService, ControlPacket); + if (lpService == NULL || ControlPacket == NULL) return ERROR_INVALID_PARAMETER; - TRACE("ScControlService(Size: %lu, Service: '%S') called\n", - ControlPacket->dwSize, - (PWSTR)((ULONG_PTR)ControlPacket + ControlPacket->dwServiceNameOffset)); + TRACE("Size: %lu\n", ControlPacket->dwSize); + TRACE("Service: %S\n", (PWSTR)((ULONG_PTR)ControlPacket + ControlPacket->dwServiceNameOffset)); if (lpService->HandlerFunction) { @@ -539,7 +547,7 @@ ScControlService(PACTIVE_SERVICE lpService, lpService->HandlerContext); } - TRACE("ScControlService() done (error %lu)\n", dwError); + TRACE("ScControlService() done (Error %lu)\n", dwError); return dwError; } @@ -558,7 +566,8 @@ ScServiceDispatcher(HANDLE hPipe, SCM_REPLY_PACKET ReplyPacket; DWORD dwError; - TRACE("ScDispatcherLoop() called\n"); + TRACE("ScServiceDispatcher(%p %p %lu)\n", + hPipe, ControlPacket, dwBufferSize); if (ControlPacket == NULL || dwBufferSize < sizeof(SCM_CONTROL_PACKET)) return FALSE; @@ -648,6 +657,9 @@ RegisterServiceCtrlHandlerA(LPCSTR lpServiceName, UNICODE_STRING ServiceNameU; SERVICE_STATUS_HANDLE hServiceStatus; + TRACE("RegisterServiceCtrlHandlerA(%s %p %p)\n", + debugstr_a(lpServiceName), lpHandlerProc); + RtlInitAnsiString(&ServiceNameA, lpServiceName); if (!NT_SUCCESS(RtlAnsiStringToUnicodeString(&ServiceNameU, &ServiceNameA, TRUE))) { @@ -676,6 +688,9 @@ RegisterServiceCtrlHandlerW(LPCWSTR lpServiceName, DWORD dwError; PACTIVE_SERVICE Service; + TRACE("RegisterServiceCtrlHandlerW(%s %p %p)\n", + debugstr_w(lpServiceName), lpHandlerProc); + dwError = ScLookupServiceByServiceName(lpServiceName, &Service); if ((dwError != ERROR_SUCCESS) || (Service == NULL)) { @@ -692,7 +707,7 @@ RegisterServiceCtrlHandlerW(LPCWSTR lpServiceName, Service->HandlerFunction = lpHandlerProc; Service->HandlerFunctionEx = NULL; - TRACE("RegisterServiceCtrlHandler returning 0x%p\n", Service->hServiceStatus); + TRACE("RegisterServiceCtrlHandler returning %p\n", Service->hServiceStatus); return Service->hServiceStatus; } @@ -712,6 +727,9 @@ RegisterServiceCtrlHandlerExA(LPCSTR lpServiceName, UNICODE_STRING ServiceNameU; SERVICE_STATUS_HANDLE hServiceStatus; + TRACE("RegisterServiceCtrlHandlerExA(%s %p %p)\n", + debugstr_a(lpServiceName), lpHandlerProc, lpContext); + RtlInitAnsiString(&ServiceNameA, lpServiceName); if (!NT_SUCCESS(RtlAnsiStringToUnicodeString(&ServiceNameU, &ServiceNameA, TRUE))) { @@ -742,6 +760,9 @@ RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, DWORD dwError; PACTIVE_SERVICE Service; + TRACE("RegisterServiceCtrlHandlerExW(%s %p %p)\n", + debugstr_w(lpServiceName), lpHandlerProc, lpContext); + dwError = ScLookupServiceByServiceName(lpServiceName, &Service); if ((dwError != ERROR_SUCCESS) || (Service == NULL)) { @@ -776,6 +797,7 @@ VOID WINAPI I_ScIsSecurityProcess(VOID) { + FIXME("I_ScIsSecurityProcess()\n"); } @@ -794,6 +816,9 @@ I_ScPnPGetServiceName(IN SERVICE_STATUS_HANDLE hServiceStatus, { DWORD i; + TRACE("I_ScPnPGetServiceName(%lu %p %lu)\n", + hServiceStatus, lpServiceName, cchServiceName); + for (i = 0; i < dwActiveServiceCount; i++) { if (lpActiveServices[i].hServiceStatus == hServiceStatus) @@ -823,6 +848,10 @@ I_ScSetServiceBitsA(SERVICE_STATUS_HANDLE hServiceStatus, { BOOL bResult; + TRACE("I_ScSetServiceBitsA(%lu %lx %u %u %s)\n", + hServiceStatus, dwServiceBits, bSetBitsOn, bUpdateImmediately, + debugstr_a(lpString)); + RpcTryExcept { bResult = RI_ScSetServiceBitsA((RPC_SERVICE_STATUS_HANDLE)hServiceStatus, @@ -858,6 +887,10 @@ I_ScSetServiceBitsW(SERVICE_STATUS_HANDLE hServiceStatus, { BOOL bResult; + TRACE("I_ScSetServiceBitsW(%lu %lx %u %u %s)\n", + hServiceStatus, dwServiceBits, bSetBitsOn, bUpdateImmediately, + debugstr_w(lpString)); + RpcTryExcept { bResult = RI_ScSetServiceBitsW((RPC_SERVICE_STATUS_HANDLE)hServiceStatus, @@ -888,6 +921,9 @@ SetServiceBits(SERVICE_STATUS_HANDLE hServiceStatus, BOOL bSetBitsOn, BOOL bUpdateImmediately) { + TRACE("SetServiceBits(%lu %lx %u %u)\n", + hServiceStatus, dwServiceBits, bSetBitsOn, bUpdateImmediately); + return I_ScSetServiceBitsW(hServiceStatus, dwServiceBits, bSetBitsOn, @@ -907,7 +943,8 @@ SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, { DWORD dwError; - TRACE("SetServiceStatus(hServiceStatus %lu) called\n", hServiceStatus); + TRACE("SetServiceStatus(%lu %p)\n", + hServiceStatus, lpServiceStatus); RpcTryExcept { @@ -927,7 +964,7 @@ SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, return FALSE; } - TRACE("SetServiceStatus() done (ret %lu)\n", dwError); + TRACE("SetServiceStatus() done\n"); return TRUE; } @@ -948,7 +985,8 @@ StartServiceCtrlDispatcherA(const SERVICE_TABLE_ENTRYA *lpServiceStartTable) DWORD dwBufSize; BOOL bRet = TRUE; - TRACE("StartServiceCtrlDispatcherA() called\n"); + TRACE("StartServiceCtrlDispatcherA(%p)\n", + lpServiceStartTable); i = 0; while (lpServiceStartTable[i].lpServiceProc != NULL) @@ -1044,7 +1082,8 @@ StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable) DWORD dwBufSize; BOOL bRet = TRUE; - TRACE("StartServiceCtrlDispatcherW() called\n"); + TRACE("StartServiceCtrlDispatcherW(%p)\n", + lpServiceStartTable); i = 0; while (lpServiceStartTable[i].lpServiceProc != NULL)
6 years, 9 months
1
0
0
0
01/01: [SDK] Add a header for the user-mode NT EventLog API. Addendum to commit dca4fd46 (SVN r71384).
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e4cd48813bd0962c067a6…
commit e4cd48813bd0962c067a62e0383d2274c060df63 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sun Mar 25 00:28:04 2018 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Sun Mar 25 00:28:04 2018 +0100 [SDK] Add a header for the user-mode NT EventLog API. Addendum to commit dca4fd46 (SVN r71384). --- sdk/include/reactos/undocelfapi.h | 193 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) diff --git a/sdk/include/reactos/undocelfapi.h b/sdk/include/reactos/undocelfapi.h new file mode 100644 index 0000000000..c24b9cc1c1 --- /dev/null +++ b/sdk/include/reactos/undocelfapi.h @@ -0,0 +1,193 @@ +/* + * PROJECT: ReactOS EventLog Service + * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+
) + * PURPOSE: Event logging NT client API. + * COPYRIGHT: Copyright 2016-2018 Hermes Belusca-Maito + */ + +#ifndef _UNDOCELFAPI_H +#define _UNDOCELFAPI_H + +#ifdef __cplusplus +extern "C" { +#endif + +NTSTATUS +NTAPI +ElfBackupEventLogFileA( + IN HANDLE hEventLog, + IN PANSI_STRING BackupFileNameA); + +NTSTATUS +NTAPI +ElfBackupEventLogFileW( + IN HANDLE hEventLog, + IN PUNICODE_STRING BackupFileNameU); + +NTSTATUS +NTAPI +ElfClearEventLogFileA( + IN HANDLE hEventLog, + IN PANSI_STRING BackupFileNameA); + +NTSTATUS +NTAPI +ElfClearEventLogFileW( + IN HANDLE hEventLog, + IN PUNICODE_STRING BackupFileNameU); + +NTSTATUS +NTAPI +ElfCloseEventLog( + IN HANDLE hEventLog); + +NTSTATUS +NTAPI +ElfDeregisterEventSource( + IN HANDLE hEventLog); + +NTSTATUS +NTAPI +ElfNumberOfRecords( + IN HANDLE hEventLog, + OUT PULONG NumberOfRecords); + +NTSTATUS +NTAPI +ElfOldestRecord( + IN HANDLE hEventLog, + OUT PULONG OldestRecordNumber); + +NTSTATUS +NTAPI +ElfChangeNotify( + IN HANDLE hEventLog, + IN HANDLE hEvent); + +NTSTATUS +NTAPI +ElfOpenBackupEventLogA( + IN PANSI_STRING UNCServerNameA, + IN PANSI_STRING BackupFileNameA, + OUT PHANDLE phEventLog); + +NTSTATUS +NTAPI +ElfOpenBackupEventLogW( + IN PUNICODE_STRING UNCServerNameU, + IN PUNICODE_STRING BackupFileNameU, + OUT PHANDLE phEventLog); + +NTSTATUS +NTAPI +ElfOpenEventLogA( + IN PANSI_STRING UNCServerNameA, + IN PANSI_STRING SourceNameA, + OUT PHANDLE phEventLog); + +NTSTATUS +NTAPI +ElfOpenEventLogW( + IN PUNICODE_STRING UNCServerNameU, + IN PUNICODE_STRING SourceNameU, + OUT PHANDLE phEventLog); + +NTSTATUS +NTAPI +ElfReadEventLogA( + IN HANDLE hEventLog, + IN ULONG ReadFlags, + IN ULONG RecordOffset, + OUT LPVOID Buffer, + IN ULONG NumberOfBytesToRead, + OUT PULONG NumberOfBytesRead, + OUT PULONG MinNumberOfBytesNeeded); + +NTSTATUS +NTAPI +ElfReadEventLogW( + IN HANDLE hEventLog, + IN ULONG ReadFlags, + IN ULONG RecordOffset, + OUT LPVOID Buffer, + IN ULONG NumberOfBytesToRead, + OUT PULONG NumberOfBytesRead, + OUT PULONG MinNumberOfBytesNeeded); + +NTSTATUS +NTAPI +ElfRegisterEventSourceA( + IN PANSI_STRING UNCServerNameA, + IN PANSI_STRING SourceNameA, + OUT PHANDLE phEventLog); + +NTSTATUS +NTAPI +ElfRegisterEventSourceW( + IN PUNICODE_STRING UNCServerNameU, + IN PUNICODE_STRING SourceNameU, + OUT PHANDLE phEventLog); + +NTSTATUS +NTAPI +ElfReportEventA( + IN HANDLE hEventLog, + IN USHORT EventType, + IN USHORT EventCategory, + IN ULONG EventID, + IN PSID UserSID, + IN USHORT NumStrings, + IN ULONG DataSize, + IN PANSI_STRING* Strings, + IN PVOID Data, + IN USHORT Flags, + IN OUT PULONG RecordNumber, + IN OUT PULONG TimeWritten); + +NTSTATUS +NTAPI +ElfReportEventW( + IN HANDLE hEventLog, + IN USHORT EventType, + IN USHORT EventCategory, + IN ULONG EventID, + IN PSID UserSID, + IN USHORT NumStrings, + IN ULONG DataSize, + IN PUNICODE_STRING* Strings, + IN PVOID Data, + IN USHORT Flags, + IN OUT PULONG RecordNumber, + IN OUT PULONG TimeWritten); + +NTSTATUS +NTAPI +ElfReportEventAndSourceW( + IN HANDLE hEventLog, + IN ULONG Time, + IN PUNICODE_STRING ComputerName, + IN USHORT EventType, + IN USHORT EventCategory, + IN ULONG EventID, + IN PSID UserSID, + IN PUNICODE_STRING SourceName, + IN USHORT NumStrings, + IN ULONG DataSize, + IN PUNICODE_STRING* Strings, + IN PVOID Data, + IN USHORT Flags, + IN OUT PULONG RecordNumber, + IN OUT PULONG TimeWritten); + +NTSTATUS +NTAPI +ElfFlushEventLog( + IN HANDLE hEventLog); + +#ifdef __cplusplus +} +#endif + +#endif /* _UNDOCELFAPI_H */ + +/* EOF */
6 years, 9 months
1
0
0
0
02/02: [NTOSKRNL] Use interlocked operations for VACB reference counting.
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=14b05e65ffaa11a286b37…
commit 14b05e65ffaa11a286b370e160c503fbffdc69b9 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Mar 24 19:15:16 2018 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Mar 24 19:15:58 2018 +0100 [NTOSKRNL] Use interlocked operations for VACB reference counting. CORE-14480 CORE-14285 --- ntoskrnl/cc/fs.c | 9 ++++--- ntoskrnl/cc/view.c | 56 +++++++++++++++++++++++++++++++----------- ntoskrnl/include/internal/cc.h | 18 ++++++++++---- 3 files changed, 60 insertions(+), 23 deletions(-) diff --git a/ntoskrnl/cc/fs.c b/ntoskrnl/cc/fs.c index 05a9a89475..2ab7b5f8ea 100644 --- a/ntoskrnl/cc/fs.c +++ b/ntoskrnl/cc/fs.c @@ -207,6 +207,8 @@ CcPurgeCacheSection ( ListEntry = SharedCacheMap->CacheMapVacbListHead.Flink; while (ListEntry != &SharedCacheMap->CacheMapVacbListHead) { + ULONG Refs; + Vacb = CONTAINING_RECORD(ListEntry, ROS_VACB, CacheMapVacbListEntry); ListEntry = ListEntry->Flink; @@ -225,15 +227,16 @@ CcPurgeCacheSection ( /* Still in use, it cannot be purged, fail * Allow one ref: VACB is supposed to be always 1-referenced */ - if ((Vacb->ReferenceCount > 1 && !Vacb->Dirty) || - (Vacb->ReferenceCount > 2 && Vacb->Dirty)) + Refs = CcRosVacbGetRefCount(Vacb); + if ((Refs > 1 && !Vacb->Dirty) || + (Refs > 2 && Vacb->Dirty)) { Success = FALSE; break; } /* This VACB is in range, so unlink it and mark for free */ - ASSERT(Vacb->ReferenceCount == 1 || Vacb->Dirty); + ASSERT(Refs == 1 || Vacb->Dirty); RemoveEntryList(&Vacb->VacbLruListEntry); if (Vacb->Dirty) { diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index 100e22bf9e..9cc45bdb3e 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -65,25 +65,45 @@ KSPIN_LOCK CcDeferredWriteSpinLock; LIST_ENTRY CcCleanSharedCacheMapList; #if DBG -VOID CcRosVacbIncRefCount_(PROS_VACB vacb, PCSTR file, INT line) +ULONG CcRosVacbIncRefCount_(PROS_VACB vacb, PCSTR file, INT line) { - ++vacb->ReferenceCount; + ULONG Refs; + + Refs = InterlockedIncrement((PLONG)&vacb->ReferenceCount); if (vacb->SharedCacheMap->Trace) { DbgPrint("(%s:%i) VACB %p ++RefCount=%lu, Dirty %u, PageOut %lu\n", - file, line, vacb, vacb->ReferenceCount, vacb->Dirty, vacb->PageOut); + file, line, vacb, Refs, vacb->Dirty, vacb->PageOut); } + + return Refs; } -VOID CcRosVacbDecRefCount_(PROS_VACB vacb, PCSTR file, INT line) +ULONG CcRosVacbDecRefCount_(PROS_VACB vacb, PCSTR file, INT line) { - ASSERT(vacb->ReferenceCount != 0); - --vacb->ReferenceCount; - ASSERT(!(vacb->ReferenceCount == 0 && vacb->Dirty)); + ULONG Refs; + + Refs = InterlockedDecrement((PLONG)&vacb->ReferenceCount); + ASSERT(!(Refs == 0 && vacb->Dirty)); if (vacb->SharedCacheMap->Trace) { DbgPrint("(%s:%i) VACB %p --RefCount=%lu, Dirty %u, PageOut %lu\n", - file, line, vacb, vacb->ReferenceCount, vacb->Dirty, vacb->PageOut); + file, line, vacb, Refs, vacb->Dirty, vacb->PageOut); } + + return Refs; +} +ULONG CcRosVacbGetRefCount_(PROS_VACB vacb, PCSTR file, INT line) +{ + ULONG Refs; + + Refs = InterlockedCompareExchange((PLONG)&vacb->ReferenceCount, 0, 0); + if (vacb->SharedCacheMap->Trace) + { + DbgPrint("(%s:%i) VACB %p ==RefCount=%lu, Dirty %u, PageOut %lu\n", + file, line, vacb, Refs, vacb->Dirty, vacb->PageOut); + } + + return Refs; } #endif @@ -221,7 +241,7 @@ CcRosFlushDirtyPages ( ASSERT(current->Dirty); /* One reference is added above */ - if (current->ReferenceCount > 2) + if (CcRosVacbGetRefCount(current) > 2) { CcRosReleaseVacbLock(current); current->SharedCacheMap->Callbacks->ReleaseFromLazyWrite( @@ -311,6 +331,8 @@ retry: current_entry = VacbLruListHead.Flink; while (current_entry != &VacbLruListHead) { + ULONG Refs; + current = CONTAINING_RECORD(current_entry, ROS_VACB, VacbLruListEntry); @@ -342,14 +364,14 @@ retry: } /* Dereference the VACB */ - CcRosVacbDecRefCount(current); + Refs = CcRosVacbDecRefCount(current); /* Check if we can free this entry now */ - if (current->ReferenceCount < 2) + if (Refs < 2) { ASSERT(!current->Dirty); ASSERT(!current->MappedCount); - ASSERT(current->ReferenceCount == 1); + ASSERT(Refs == 1); RemoveEntryList(¤t->CacheMapVacbListEntry); RemoveEntryList(¤t->VacbLruListEntry); @@ -409,6 +431,7 @@ CcRosReleaseVacb ( BOOLEAN Dirty, BOOLEAN Mapped) { + ULONG Refs; ASSERT(SharedCacheMap); DPRINT("CcRosReleaseVacb(SharedCacheMap 0x%p, Vacb 0x%p, Valid %u)\n", @@ -425,13 +448,13 @@ CcRosReleaseVacb ( { Vacb->MappedCount++; } - CcRosVacbDecRefCount(Vacb); + Refs = CcRosVacbDecRefCount(Vacb); if (Mapped && (Vacb->MappedCount == 1)) { CcRosVacbIncRefCount(Vacb); } - ASSERT(Vacb->ReferenceCount > 0); + ASSERT(Refs > 0); CcRosReleaseVacbLock(Vacb); @@ -835,6 +858,7 @@ CcRosGetVacb ( { PROS_VACB current; NTSTATUS Status; + ULONG Refs; ASSERT(SharedCacheMap); @@ -856,6 +880,8 @@ CcRosGetVacb ( } } + Refs = CcRosVacbGetRefCount(current); + KeAcquireGuardedMutex(&ViewLock); /* Move to the tail of the LRU list */ @@ -873,7 +899,7 @@ CcRosGetVacb ( *Vacb = current; *BaseOffset = current->FileOffset.QuadPart; - ASSERT(current->ReferenceCount > 1); + ASSERT(Refs > 1); return STATUS_SUCCESS; } diff --git a/ntoskrnl/include/internal/cc.h b/ntoskrnl/include/internal/cc.h index ad939a12a9..e3c279b6f8 100644 --- a/ntoskrnl/include/internal/cc.h +++ b/ntoskrnl/include/internal/cc.h @@ -220,7 +220,7 @@ typedef struct _ROS_VACB /* Mutex */ KMUTEX Mutex; /* Number of references. */ - ULONG ReferenceCount; + volatile ULONG ReferenceCount; /* How many times was it pinned? */ _Guarded_by_(Mutex) LONG PinCount; @@ -523,20 +523,28 @@ IsPointInRange( #if DBG #define CcRosVacbIncRefCount(vacb) CcRosVacbIncRefCount_(vacb,__FILE__,__LINE__) #define CcRosVacbDecRefCount(vacb) CcRosVacbDecRefCount_(vacb,__FILE__,__LINE__) +#define CcRosVacbGetRefCount(vacb) CcRosVacbGetRefCount_(vacb,__FILE__,__LINE__) -VOID +ULONG CcRosVacbIncRefCount_( PROS_VACB vacb, PCSTR file, INT line); -VOID +ULONG CcRosVacbDecRefCount_( PROS_VACB vacb, PCSTR file, INT line); +ULONG +CcRosVacbGetRefCount_( + PROS_VACB vacb, + PCSTR file, + INT line); + #else -#define CcRosVacbIncRefCount(vacb) (++((vacb)->ReferenceCount)) -#define CcRosVacbDecRefCount(vacb) (--((vacb)->ReferenceCount)) +#define CcRosVacbIncRefCount(vacb) InterlockedIncrement((PLONG)&(vacb)->ReferenceCount) +#define CcRosVacbDecRefCount(vacb) InterlockedDecrement((PLONG)&(vacb)->ReferenceCount) +#define CcRosVacbGetRefCount(vacb) InterlockedCompareExchange((PLONG)&(vacb)->ReferenceCount, 0, 0) #endif
6 years, 9 months
1
0
0
0
01/02: [NTOSKRNL] Add a few asserts when mapping a VACB in kernel space Also, reset VACB content when returning it to the lookaside list
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dea9c291abb77977eee92…
commit dea9c291abb77977eee9208d1b5be22d9f676a5d Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Mar 24 18:02:20 2018 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Mar 24 19:15:58 2018 +0100 [NTOSKRNL] Add a few asserts when mapping a VACB in kernel space Also, reset VACB content when returning it to the lookaside list CORE-14478 --- ntoskrnl/cc/view.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index f7e7f5f7c6..100e22bf9e 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -624,17 +624,20 @@ CcRosMapVacbInKernelSpace( ULONG i; NTSTATUS Status; ULONG_PTR NumberOfPages; + PVOID BaseAddress = NULL; /* Create a memory area. */ MmLockAddressSpace(MmGetKernelAddressSpace()); Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), 0, // nothing checks for VACB mareas, so set to 0 - &Vacb->BaseAddress, + &BaseAddress, VACB_MAPPING_GRANULARITY, PAGE_READWRITE, (PMEMORY_AREA*)&Vacb->MemoryArea, 0, PAGE_SIZE); + ASSERT(Vacb->BaseAddress == NULL); + Vacb->BaseAddress = BaseAddress; MmUnlockAddressSpace(MmGetKernelAddressSpace()); if (!NT_SUCCESS(Status)) { @@ -644,6 +647,7 @@ CcRosMapVacbInKernelSpace( ASSERT(((ULONG_PTR)Vacb->BaseAddress % PAGE_SIZE) == 0); ASSERT((ULONG_PTR)Vacb->BaseAddress > (ULONG_PTR)MmSystemRangeStart); + ASSERT((ULONG_PTR)Vacb->BaseAddress + VACB_MAPPING_GRANULARITY - 1 > (ULONG_PTR)MmSystemRangeStart); /* Create a virtual mapping for this memory area */ NumberOfPages = BYTES_TO_PAGES(VACB_MAPPING_GRANULARITY); @@ -659,6 +663,11 @@ CcRosMapVacbInKernelSpace( KeBugCheck(MEMORY_MANAGEMENT); } + ASSERT(BaseAddress == Vacb->BaseAddress); + ASSERT(i * PAGE_SIZE < VACB_MAPPING_GRANULARITY); + ASSERT((ULONG_PTR)Vacb->BaseAddress + (i * PAGE_SIZE) >= (ULONG_PTR)BaseAddress); + ASSERT((ULONG_PTR)Vacb->BaseAddress + (i * PAGE_SIZE) > (ULONG_PTR)MmSystemRangeStart); + Status = MmCreateVirtualMapping(NULL, (PVOID)((ULONG_PTR)Vacb->BaseAddress + (i * PAGE_SIZE)), PAGE_READWRITE, @@ -951,6 +960,7 @@ CcRosInternalFreeVacb ( ASSERT(Vacb->PinCount == 0); ASSERT(Vacb->ReferenceCount == 0); + RtlFillMemory(Vacb, sizeof(Vacb), 0xfd); ExFreeToNPagedLookasideList(&VacbLookasideList, Vacb); return STATUS_SUCCESS; }
6 years, 9 months
1
0
0
0
← Newer
1
...
10
11
12
13
14
15
16
...
44
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
Results per page:
10
25
50
100
200