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
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
June 2013
----- 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
14 participants
274 discussions
Start a n
N
ew thread
[hbelusca] 59364: [MUP] Return STATUS_OBJECT_NAME_INVALID instead of STATUS_BAD_NETWORK_PATH, fixes some tests (kernel32:FindFiles in particular).
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat Jun 29 14:03:04 2013 New Revision: 59364 URL:
http://svn.reactos.org/svn/reactos?rev=59364&view=rev
Log: [MUP] Return STATUS_OBJECT_NAME_INVALID instead of STATUS_BAD_NETWORK_PATH, fixes some tests (kernel32:FindFiles in particular). Modified: trunk/reactos/drivers/filesystems/mup/create.c Modified: trunk/reactos/drivers/filesystems/mup/create.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/mup/cr…
============================================================================== --- trunk/reactos/drivers/filesystems/mup/create.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/mup/create.c [iso-8859-1] Sat Jun 29 14:03:04 2013 @@ -51,9 +51,8 @@ FileObject = Stack->FileObject; - DPRINT("FileName: '%wZ'\n", &FileObject->FileName); - - Status = STATUS_BAD_NETWORK_PATH; + DPRINT1("MUP - Unimplemented (FileName: '%wZ')\n", &FileObject->FileName); + Status = STATUS_OBJECT_NAME_INVALID; // STATUS_BAD_NETWORK_PATH; Irp->IoStatus.Information = (NT_SUCCESS(Status)) ? FILE_OPENED : 0; Irp->IoStatus.Status = Status;
11 years, 2 months
1
0
0
0
[tfaber] 59363: [GETUNAME] - Implement GetUName. Patch by Baruch Rutman. CORE-7264 #resolve #comment Awesome, thanks! Committed in r59363.
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Jun 29 13:44:17 2013 New Revision: 59363 URL:
http://svn.reactos.org/svn/reactos?rev=59363&view=rev
Log: [GETUNAME] - Implement GetUName. Patch by Baruch Rutman. CORE-7264 #resolve #comment Awesome, thanks! Committed in r59363. Added: trunk/reactos/dll/win32/getuname/lang/ trunk/reactos/dll/win32/getuname/lang/en-US.rc (with props) Modified: trunk/reactos/dll/win32/getuname/CMakeLists.txt trunk/reactos/dll/win32/getuname/getuname.c trunk/reactos/dll/win32/getuname/getuname.rc [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/getuname/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/getuname/CMakeLi…
Modified: trunk/reactos/dll/win32/getuname/getuname.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/getuname/getunam…
Modified: trunk/reactos/dll/win32/getuname/getuname.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/getuname/getunam…
Added: trunk/reactos/dll/win32/getuname/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/getuname/lang/en…
11 years, 2 months
1
0
0
0
[tfaber] 59362: [KMTESTS:MM] - Gracefully handle file open failure in ZwCreateSection test. Patch by Aleksandar Andrejevic. ROSTESTS-115 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Jun 29 13:10:30 2013 New Revision: 59362 URL:
http://svn.reactos.org/svn/reactos?rev=59362&view=rev
Log: [KMTESTS:MM] - Gracefully handle file open failure in ZwCreateSection test. Patch by Aleksandar Andrejevic. ROSTESTS-115 #resolve Modified: trunk/rostests/kmtests/ntos_mm/ZwCreateSection.c Modified: trunk/rostests/kmtests/ntos_mm/ZwCreateSection.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/ZwCreateS…
============================================================================== --- trunk/rostests/kmtests/ntos_mm/ZwCreateSection.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_mm/ZwCreateSection.c [iso-8859-1] Sat Jun 29 13:10:30 2013 @@ -507,9 +507,12 @@ KmtInitTestFiles(&FileHandleReadOnly, &FileHandleWriteOnly, &FileHandleExecuteOnly); - FileSectionViewPermissionCheck(FileHandleReadOnly, FileHandleWriteOnly, FileHandleExecuteOnly); - SimpleErrorChecks(FileHandleReadOnly, FileHandleWriteOnly, FileHandleExecuteOnly); - BasicBehaviorChecks(FileHandleWriteOnly); + if (FileHandleReadOnly && FileHandleWriteOnly && FileHandleExecuteOnly) + { + FileSectionViewPermissionCheck(FileHandleReadOnly, FileHandleWriteOnly, FileHandleExecuteOnly); + SimpleErrorChecks(FileHandleReadOnly, FileHandleWriteOnly, FileHandleExecuteOnly); + BasicBehaviorChecks(FileHandleWriteOnly); + } if (FileHandleReadOnly) ZwClose(FileHandleReadOnly);
11 years, 2 months
1
0
0
0
[tfaber] 59361: [DESK.CPL] - Fix wrong buffer usage CORE-7300 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Jun 29 13:05:52 2013 New Revision: 59361 URL:
http://svn.reactos.org/svn/reactos?rev=59361&view=rev
Log: [DESK.CPL] - Fix wrong buffer usage CORE-7300 #resolve Modified: trunk/reactos/dll/cpl/desk/general.c Modified: trunk/reactos/dll/cpl/desk/general.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/general.c?rev…
============================================================================== --- trunk/reactos/dll/cpl/desk/general.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/desk/general.c [iso-8859-1] Sat Jun 29 13:05:52 2013 @@ -30,12 +30,13 @@ 0, KEY_READ, &hKey) == ERROR_SUCCESS) for (;;) { + TCHAR Buffer[LINE_LEN]; TCHAR Desc[LINE_LEN]; - if (SetupGetStringField(&Context, 0, Desc, sizeof(Desc), NULL) && + if (SetupGetStringField(&Context, 0, Buffer, sizeof(Buffer), NULL) && SetupGetIntField(&Context, 1, &ci)) { - _stprintf(Desc, _T("%s (%d DPI)"), Desc, ci); + _stprintf(Desc, _T("%s (%d DPI)"), Buffer, ci); i = SendMessage(hFontSize, CB_ADDSTRING, 0, (LPARAM)Desc); if (i != CB_ERR) SendMessage(hFontSize, CB_SETITEMDATA, (WPARAM)i, (LPARAM)ci);
11 years, 2 months
1
0
0
0
[tfaber] 59360: [SVCHOST] - Fix various incorrect buffer size calculations - Don't expand environment variables in REG_SZ values - Repair all DPRINTs - Other misc fixes CORE-7296 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Jun 29 13:01:35 2013 New Revision: 59360 URL:
http://svn.reactos.org/svn/reactos?rev=59360&view=rev
Log: [SVCHOST] - Fix various incorrect buffer size calculations - Don't expand environment variables in REG_SZ values - Repair all DPRINTs - Other misc fixes CORE-7296 #resolve Modified: trunk/reactos/base/services/svchost/svchost.c trunk/reactos/base/services/svchost/svchost.h Modified: trunk/reactos/base/services/svchost/svchost.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/svchost/svch…
============================================================================== --- trunk/reactos/base/services/svchost/svchost.c [iso-8859-1] (original) +++ trunk/reactos/base/services/svchost/svchost.c [iso-8859-1] Sat Jun 29 13:01:35 2013 @@ -19,7 +19,6 @@ static PCWSTR SERVICE_KEY = L"SYSTEM\\CurrentControlSet\\Services\\"; static PCWSTR PARAMETERS_KEY = L"\\Parameters"; -#define SERVICE_KEY_LENGTH wcslen(SERVICE_KEY); #define REG_MAX_DATA_SIZE 2048 static PSERVICE FirstService = NULL; @@ -29,104 +28,143 @@ BOOL PrepareService(PCWSTR ServiceName) { HKEY hServiceKey; - WCHAR ServiceKeyBuffer[MAX_PATH + 1]; - DWORD LeftOfBuffer = sizeof(ServiceKeyBuffer) / sizeof(ServiceKeyBuffer[0]); - DWORD KeyType; - PWSTR Buffer = NULL; - DWORD BufferSize = MAX_PATH + 1; + WCHAR ServiceKeyBuffer[512]; + HRESULT Result; + DWORD ValueType; + PWSTR Buffer; + DWORD BufferSize; LONG RetVal; HINSTANCE hServiceDll; - WCHAR DllPath[MAX_PATH + 2]; /* See MSDN on ExpandEnvironmentStrings() for ANSI strings for more details on + 2 */ + PWSTR DllPath; + DWORD DllPathSize; LPSERVICE_MAIN_FUNCTION ServiceMainFunc; PSERVICE Service; + DWORD ServiceNameSize; /* Compose the registry path to the service's "Parameter" key */ - wcsncpy(ServiceKeyBuffer, SERVICE_KEY, LeftOfBuffer); - LeftOfBuffer -= wcslen(SERVICE_KEY); - wcsncat(ServiceKeyBuffer, ServiceName, LeftOfBuffer); - LeftOfBuffer -= wcslen(ServiceName); - wcsncat(ServiceKeyBuffer, PARAMETERS_KEY, LeftOfBuffer); - LeftOfBuffer -= wcslen(PARAMETERS_KEY); - - if (LeftOfBuffer < 0) - { - DPRINT1("Buffer overflow for service name: '%s'\n", ServiceName); + Result = StringCbCopy(ServiceKeyBuffer, sizeof(ServiceKeyBuffer), SERVICE_KEY); + if (FAILED(Result)) + { + DPRINT1("Buffer overflow for service name: '%ls'\n", ServiceName); + return FALSE; + } + Result = StringCbCat(ServiceKeyBuffer, sizeof(ServiceKeyBuffer), ServiceName); + if (FAILED(Result)) + { + DPRINT1("Buffer overflow for service name: '%ls'\n", ServiceName); + return FALSE; + } + Result = StringCbCat(ServiceKeyBuffer, sizeof(ServiceKeyBuffer), PARAMETERS_KEY); + if (FAILED(Result)) + { + DPRINT1("Buffer overflow for service name: '%ls'\n", ServiceName); return FALSE; } /* Open the service registry key to find the dll name */ - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, ServiceKeyBuffer, 0, KEY_READ, &hServiceKey) != ERROR_SUCCESS) - { - DPRINT1("Could not open service key (%s)\n", ServiceKeyBuffer); - return FALSE; - } - - do - { - if (Buffer) + RetVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ServiceKeyBuffer, 0, KEY_READ, &hServiceKey); + if (RetVal != ERROR_SUCCESS) + { + DPRINT1("Could not open service key (%ls)\n", ServiceKeyBuffer); + return FALSE; + } + + BufferSize = 0; + RetVal = RegQueryValueEx(hServiceKey, L"ServiceDll", NULL, &ValueType, NULL, &BufferSize); + if (RetVal != ERROR_SUCCESS) + { + RegCloseKey(hServiceKey); + return FALSE; + } + + Buffer = HeapAlloc(GetProcessHeap(), 0, BufferSize); + if (Buffer == NULL) + { + DPRINT1("Not enough memory for service: %ls\n", ServiceName); + RegCloseKey(hServiceKey); + return FALSE; + } + + RetVal = RegQueryValueEx(hServiceKey, L"ServiceDll", NULL, &ValueType, (LPBYTE)Buffer, &BufferSize); + if (RetVal != ERROR_SUCCESS || BufferSize == 0) + { + DPRINT1("Could not read 'ServiceDll' value from service: %ls, ErrorCode: 0x%lx\n", ServiceName, RetVal); + RegCloseKey(hServiceKey); + HeapFree(GetProcessHeap(), 0, Buffer); + return FALSE; + } + RegCloseKey(hServiceKey); + + if (ValueType == REG_EXPAND_SZ) + { + /* Convert possible %SystemRoot% to a real path */ + DllPathSize = ExpandEnvironmentStrings(Buffer, NULL, 0); + if (DllPathSize == 0) + { + DPRINT1("Invalid ServiceDll path: %ls, ErrorCode: %lu\n", Buffer, GetLastError()); HeapFree(GetProcessHeap(), 0, Buffer); - - Buffer = HeapAlloc(GetProcessHeap(), 0, BufferSize); - if (Buffer == NULL) - { - DPRINT1("Not enough memory for service: %s\n", ServiceName); return FALSE; } - - RetVal = RegQueryValueEx(hServiceKey, L"ServiceDll", NULL, &KeyType, (LPBYTE)Buffer, &BufferSize); - - } while (RetVal == ERROR_MORE_DATA); - - - RegCloseKey(hServiceKey); - - if (RetVal != ERROR_SUCCESS || BufferSize == 0) - { - DPRINT1("Could not read 'ServiceDll' value from service: %s, ErrorCode: 0x%x\n", ServiceName, RetVal); + DllPath = HeapAlloc(GetProcessHeap(), 0, DllPathSize * sizeof(WCHAR)); + if (DllPath == NULL) + { + DPRINT1("Not enough memory for service: %ls\n", ServiceName); + HeapFree(GetProcessHeap(), 0, Buffer); + return FALSE; + } + if (ExpandEnvironmentStrings(Buffer, DllPath, DllPathSize) != DllPathSize) + { + DPRINT1("Invalid ServiceDll path: %ls, ErrorCode: %lu\n", Buffer, GetLastError()); + HeapFree(GetProcessHeap(), 0, DllPath); + HeapFree(GetProcessHeap(), 0, Buffer); + return FALSE; + } + HeapFree(GetProcessHeap(), 0, Buffer); - return FALSE; - } - - /* Convert possible %SystemRoot% to a real path */ - BufferSize = ExpandEnvironmentStrings(Buffer, DllPath, _countof(DllPath)); - if (BufferSize == 0) - { - DPRINT1("Invalid ServiceDll path: %s\n", Buffer); + } + else if (ValueType == REG_SZ) + { + DllPath = Buffer; + } + else + { + DPRINT1("Invalid ServiceDll value type %lu for service: %ls, ErrorCode: %lu\n", ValueType, ServiceName, GetLastError()); HeapFree(GetProcessHeap(), 0, Buffer); return FALSE; } - - HeapFree(GetProcessHeap(), 0, Buffer); /* Load the service dll */ DPRINT("Trying to load dll\n"); hServiceDll = LoadLibrary(DllPath); - if (hServiceDll == NULL) { - DPRINT1("Unable to load ServiceDll: %s, ErrorCode: %u\n", DllPath, GetLastError()); - return FALSE; - } + DPRINT1("Unable to load ServiceDll: %ls, ErrorCode: %lu\n", DllPath, GetLastError()); + HeapFree(GetProcessHeap(), 0, DllPath); + return FALSE; + } + HeapFree(GetProcessHeap(), 0, DllPath); ServiceMainFunc = (LPSERVICE_MAIN_FUNCTION)GetProcAddress(hServiceDll, "ServiceMain"); /* Allocate a service node in the linked list */ - Service = HeapAlloc(GetProcessHeap(), 0, sizeof(SERVICE)); + Service = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SERVICE)); if (Service == NULL) { - DPRINT1("Not enough memory for service: %s\n", ServiceName); - return FALSE; - } - - memset(Service, 0, sizeof(SERVICE)); - Service->Name = HeapAlloc(GetProcessHeap(), 0, (wcslen(ServiceName)+1) * sizeof(WCHAR)); + DPRINT1("Not enough memory for service: %ls\n", ServiceName); + return FALSE; + } + + ServiceNameSize = (wcslen(ServiceName) + 1) * sizeof(WCHAR); + Service->Name = HeapAlloc(GetProcessHeap(), 0, ServiceNameSize); if (Service->Name == NULL) { - DPRINT1("Not enough memory for service: %s\n", ServiceName); + DPRINT1("Not enough memory for service: %ls\n", ServiceName); HeapFree(GetProcessHeap(), 0, Service); return FALSE; } - wcscpy(Service->Name, ServiceName); + Result = StringCbCopy(Service->Name, ServiceNameSize, ServiceName); + ASSERT(SUCCEEDED(Result)); + (VOID)Result; Service->hServiceDll = hServiceDll; Service->ServiceMainFunc = ServiceMainFunc; @@ -157,23 +195,26 @@ DWORD LoadServiceCategory(PCWSTR ServiceCategory) { HKEY hServicesKey; - DWORD KeyType; - DWORD BufferSize = REG_MAX_DATA_SIZE; + DWORD ValueType; WCHAR Buffer[REG_MAX_DATA_SIZE]; + DWORD BufferSize = sizeof(Buffer); PCWSTR ServiceName; DWORD BufferIndex = 0; DWORD NrOfServices = 0; + LONG RetVal; /* Get all the services in this category */ - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, SVCHOST_REG_KEY, 0, KEY_READ, &hServicesKey) != ERROR_SUCCESS) - { - DPRINT1("Could not open service category: %s\n", ServiceCategory); - return 0; - } - - if (RegQueryValueEx(hServicesKey, ServiceCategory, NULL, &KeyType, (LPBYTE)Buffer, &BufferSize) != ERROR_SUCCESS) - { - DPRINT1("Could not open service category (2): %s\n", ServiceCategory); + RetVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, SVCHOST_REG_KEY, 0, KEY_READ, &hServicesKey); + if (RetVal != ERROR_SUCCESS) + { + DPRINT1("Could not open service category: %ls\n", ServiceCategory); + return 0; + } + + RetVal = RegQueryValueEx(hServicesKey, ServiceCategory, NULL, &ValueType, (LPBYTE)Buffer, &BufferSize); + if (RetVal != ERROR_SUCCESS) + { + DPRINT1("Could not open service category (2): %ls\n", ServiceCategory); RegCloseKey(hServicesKey); return 0; } @@ -191,7 +232,7 @@ if (Length == 0) break; - if (PrepareService(ServiceName) == TRUE) + if (PrepareService(ServiceName)) ++NrOfServices; BufferIndex += Length + 1; @@ -213,7 +254,7 @@ return 0; } - if (wcscmp(argv[1], L"-k") != 0) + if (wcscmp(argv[1], L"-k")) { /* For now, we only handle "-k" */ return 0; @@ -226,7 +267,6 @@ return 0; ServiceTable = HeapAlloc(GetProcessHeap(), 0, sizeof(SERVICE_TABLE_ENTRY) * (NrOfServices + 1)); - if (ServiceTable != NULL) { DWORD i; @@ -235,17 +275,18 @@ /* Fill the service table */ for (i = 0; i < NrOfServices; i++) { - DPRINT("Loading service: %s\n", Service->Name); + DPRINT("Loading service: %ls\n", Service->Name); ServiceTable[i].lpServiceName = Service->Name; ServiceTable[i].lpServiceProc = Service->ServiceMainFunc; Service = Service->Next; } + ASSERT(Service == NULL); /* Set a NULL entry to end the service table */ ServiceTable[i].lpServiceName = NULL; ServiceTable[i].lpServiceProc = NULL; - if (StartServiceCtrlDispatcher(ServiceTable) == FALSE) + if (!StartServiceCtrlDispatcher(ServiceTable)) DPRINT1("Failed to start service control dispatcher, ErrorCode: %lu\n", GetLastError()); HeapFree(GetProcessHeap(), 0, ServiceTable); Modified: trunk/reactos/base/services/svchost/svchost.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/svchost/svch…
============================================================================== --- trunk/reactos/base/services/svchost/svchost.h [iso-8859-1] (original) +++ trunk/reactos/base/services/svchost/svchost.h [iso-8859-1] Sat Jun 29 13:01:35 2013 @@ -10,20 +10,15 @@ /* INCLUDES ******************************************************************/ -#if 0 -#define _CRT_SECURE_NO_DEPRECATE 1 -#endif - #include <stdlib.h> #include <stdarg.h> #include <windef.h> #include <winbase.h> #include <winreg.h> #include <winsvc.h> +#include <strsafe.h> /* DEFINES *******************************************************************/ - -#define CS_TIMEOUT 1000 typedef struct _SERVICE { PWSTR Name;
11 years, 2 months
1
0
0
0
[tfaber] 59359: [SVCHOST] - Make WCHARs explicit
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Jun 29 11:46:13 2013 New Revision: 59359 URL:
http://svn.reactos.org/svn/reactos?rev=59359&view=rev
Log: [SVCHOST] - Make WCHARs explicit Modified: trunk/reactos/base/services/svchost/svchost.c trunk/reactos/base/services/svchost/svchost.h Modified: trunk/reactos/base/services/svchost/svchost.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/svchost/svch…
============================================================================== --- trunk/reactos/base/services/svchost/svchost.c [iso-8859-1] (original) +++ trunk/reactos/base/services/svchost/svchost.c [iso-8859-1] Sat Jun 29 11:46:13 2013 @@ -15,38 +15,38 @@ /* DEFINES *******************************************************************/ -static LPCTSTR SVCHOST_REG_KEY = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SvcHost"); -static LPCTSTR SERVICE_KEY = _T("SYSTEM\\CurrentControlSet\\Services\\"); -static LPCTSTR PARAMETERS_KEY = _T("\\Parameters"); - -#define SERVICE_KEY_LENGTH _tcslen(SERVICE_KEY); +static PCWSTR SVCHOST_REG_KEY = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SvcHost"; +static PCWSTR SERVICE_KEY = L"SYSTEM\\CurrentControlSet\\Services\\"; +static PCWSTR PARAMETERS_KEY = L"\\Parameters"; + +#define SERVICE_KEY_LENGTH wcslen(SERVICE_KEY); #define REG_MAX_DATA_SIZE 2048 static PSERVICE FirstService = NULL; /* FUNCTIONS *****************************************************************/ -BOOL PrepareService(LPCTSTR ServiceName) +BOOL PrepareService(PCWSTR ServiceName) { HKEY hServiceKey; - TCHAR ServiceKeyBuffer[MAX_PATH + 1]; + WCHAR ServiceKeyBuffer[MAX_PATH + 1]; DWORD LeftOfBuffer = sizeof(ServiceKeyBuffer) / sizeof(ServiceKeyBuffer[0]); DWORD KeyType; - PTSTR Buffer = NULL; + PWSTR Buffer = NULL; DWORD BufferSize = MAX_PATH + 1; LONG RetVal; HINSTANCE hServiceDll; - TCHAR DllPath[MAX_PATH + 2]; /* See MSDN on ExpandEnvironmentStrings() for ANSI strings for more details on + 2 */ + WCHAR DllPath[MAX_PATH + 2]; /* See MSDN on ExpandEnvironmentStrings() for ANSI strings for more details on + 2 */ LPSERVICE_MAIN_FUNCTION ServiceMainFunc; PSERVICE Service; /* Compose the registry path to the service's "Parameter" key */ - _tcsncpy(ServiceKeyBuffer, SERVICE_KEY, LeftOfBuffer); - LeftOfBuffer -= _tcslen(SERVICE_KEY); - _tcsncat(ServiceKeyBuffer, ServiceName, LeftOfBuffer); - LeftOfBuffer -= _tcslen(ServiceName); - _tcsncat(ServiceKeyBuffer, PARAMETERS_KEY, LeftOfBuffer); - LeftOfBuffer -= _tcslen(PARAMETERS_KEY); + wcsncpy(ServiceKeyBuffer, SERVICE_KEY, LeftOfBuffer); + LeftOfBuffer -= wcslen(SERVICE_KEY); + wcsncat(ServiceKeyBuffer, ServiceName, LeftOfBuffer); + LeftOfBuffer -= wcslen(ServiceName); + wcsncat(ServiceKeyBuffer, PARAMETERS_KEY, LeftOfBuffer); + LeftOfBuffer -= wcslen(PARAMETERS_KEY); if (LeftOfBuffer < 0) { @@ -73,7 +73,7 @@ return FALSE; } - RetVal = RegQueryValueEx(hServiceKey, _T("ServiceDll"), NULL, &KeyType, (LPBYTE)Buffer, &BufferSize); + RetVal = RegQueryValueEx(hServiceKey, L"ServiceDll", NULL, &KeyType, (LPBYTE)Buffer, &BufferSize); } while (RetVal == ERROR_MORE_DATA); @@ -119,14 +119,14 @@ } memset(Service, 0, sizeof(SERVICE)); - Service->Name = HeapAlloc(GetProcessHeap(), 0, (_tcslen(ServiceName)+1) * sizeof(TCHAR)); + Service->Name = HeapAlloc(GetProcessHeap(), 0, (wcslen(ServiceName)+1) * sizeof(WCHAR)); if (Service->Name == NULL) { DPRINT1("Not enough memory for service: %s\n", ServiceName); HeapFree(GetProcessHeap(), 0, Service); return FALSE; } - _tcscpy(Service->Name, ServiceName); + wcscpy(Service->Name, ServiceName); Service->hServiceDll = hServiceDll; Service->ServiceMainFunc = ServiceMainFunc; @@ -154,13 +154,13 @@ /* * Returns the number of services successfully loaded from the category */ -DWORD LoadServiceCategory(LPCTSTR ServiceCategory) +DWORD LoadServiceCategory(PCWSTR ServiceCategory) { HKEY hServicesKey; DWORD KeyType; DWORD BufferSize = REG_MAX_DATA_SIZE; - TCHAR Buffer[REG_MAX_DATA_SIZE]; - LPCTSTR ServiceName; + WCHAR Buffer[REG_MAX_DATA_SIZE]; + PCWSTR ServiceName; DWORD BufferIndex = 0; DWORD NrOfServices = 0; @@ -183,11 +183,11 @@ /* Load services in the category */ ServiceName = Buffer; - while (ServiceName[0] != _T('\0')) + while (ServiceName[0] != UNICODE_NULL) { size_t Length; - - Length = _tcslen(ServiceName); + + Length = wcslen(ServiceName); if (Length == 0) break; @@ -202,7 +202,7 @@ return NrOfServices; } -int _tmain (int argc, LPTSTR argv []) +int wmain(int argc, wchar_t **argv) { DWORD NrOfServices; LPSERVICE_TABLE_ENTRY ServiceTable; @@ -213,7 +213,7 @@ return 0; } - if (_tcscmp(argv[1], _T("-k")) != 0) + if (wcscmp(argv[1], L"-k") != 0) { /* For now, we only handle "-k" */ return 0; Modified: trunk/reactos/base/services/svchost/svchost.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/svchost/svch…
============================================================================== --- trunk/reactos/base/services/svchost/svchost.h [iso-8859-1] (original) +++ trunk/reactos/base/services/svchost/svchost.h [iso-8859-1] Sat Jun 29 11:46:13 2013 @@ -20,14 +20,13 @@ #include <winbase.h> #include <winreg.h> #include <winsvc.h> -#include <tchar.h> /* DEFINES *******************************************************************/ #define CS_TIMEOUT 1000 typedef struct _SERVICE { - PTSTR Name; + PWSTR Name; HINSTANCE hServiceDll; LPSERVICE_MAIN_FUNCTION ServiceMainFunc; struct _SERVICE *Next;
11 years, 2 months
1
0
0
0
[tfaber] 59358: [SVCHOST] - Yoda logic fix you must. No functional changes.
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Jun 29 11:41:05 2013 New Revision: 59358 URL:
http://svn.reactos.org/svn/reactos?rev=59358&view=rev
Log: [SVCHOST] - Yoda logic fix you must. No functional changes. Modified: trunk/reactos/base/services/svchost/svchost.c Modified: trunk/reactos/base/services/svchost/svchost.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/svchost/svch…
============================================================================== --- trunk/reactos/base/services/svchost/svchost.c [iso-8859-1] (original) +++ trunk/reactos/base/services/svchost/svchost.c [iso-8859-1] Sat Jun 29 11:41:05 2013 @@ -55,7 +55,7 @@ } /* Open the service registry key to find the dll name */ - if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE, ServiceKeyBuffer, 0, KEY_READ, &hServiceKey)) + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, ServiceKeyBuffer, 0, KEY_READ, &hServiceKey) != ERROR_SUCCESS) { DPRINT1("Could not open service key (%s)\n", ServiceKeyBuffer); return FALSE; @@ -67,7 +67,7 @@ HeapFree(GetProcessHeap(), 0, Buffer); Buffer = HeapAlloc(GetProcessHeap(), 0, BufferSize); - if (NULL == Buffer) + if (Buffer == NULL) { DPRINT1("Not enough memory for service: %s\n", ServiceName); return FALSE; @@ -75,12 +75,12 @@ RetVal = RegQueryValueEx(hServiceKey, _T("ServiceDll"), NULL, &KeyType, (LPBYTE)Buffer, &BufferSize); - } while (ERROR_MORE_DATA == RetVal); + } while (RetVal == ERROR_MORE_DATA); RegCloseKey(hServiceKey); - if (ERROR_SUCCESS != RetVal || 0 == BufferSize) + if (RetVal != ERROR_SUCCESS || BufferSize == 0) { DPRINT1("Could not read 'ServiceDll' value from service: %s, ErrorCode: 0x%x\n", ServiceName, RetVal); HeapFree(GetProcessHeap(), 0, Buffer); @@ -89,7 +89,7 @@ /* Convert possible %SystemRoot% to a real path */ BufferSize = ExpandEnvironmentStrings(Buffer, DllPath, _countof(DllPath)); - if (0 == BufferSize) + if (BufferSize == 0) { DPRINT1("Invalid ServiceDll path: %s\n", Buffer); HeapFree(GetProcessHeap(), 0, Buffer); @@ -102,7 +102,7 @@ DPRINT("Trying to load dll\n"); hServiceDll = LoadLibrary(DllPath); - if (NULL == hServiceDll) + if (hServiceDll == NULL) { DPRINT1("Unable to load ServiceDll: %s, ErrorCode: %u\n", DllPath, GetLastError()); return FALSE; @@ -112,7 +112,7 @@ /* Allocate a service node in the linked list */ Service = HeapAlloc(GetProcessHeap(), 0, sizeof(SERVICE)); - if (NULL == Service) + if (Service == NULL) { DPRINT1("Not enough memory for service: %s\n", ServiceName); return FALSE; @@ -120,7 +120,7 @@ memset(Service, 0, sizeof(SERVICE)); Service->Name = HeapAlloc(GetProcessHeap(), 0, (_tcslen(ServiceName)+1) * sizeof(TCHAR)); - if (NULL == Service->Name) + if (Service->Name == NULL) { DPRINT1("Not enough memory for service: %s\n", ServiceName); HeapFree(GetProcessHeap(), 0, Service); @@ -165,13 +165,13 @@ DWORD NrOfServices = 0; /* Get all the services in this category */ - if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE, SVCHOST_REG_KEY, 0, KEY_READ, &hServicesKey)) + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, SVCHOST_REG_KEY, 0, KEY_READ, &hServicesKey) != ERROR_SUCCESS) { DPRINT1("Could not open service category: %s\n", ServiceCategory); return 0; } - if (ERROR_SUCCESS != RegQueryValueEx(hServicesKey, ServiceCategory, NULL, &KeyType, (LPBYTE)Buffer, &BufferSize)) + if (RegQueryValueEx(hServicesKey, ServiceCategory, NULL, &KeyType, (LPBYTE)Buffer, &BufferSize) != ERROR_SUCCESS) { DPRINT1("Could not open service category (2): %s\n", ServiceCategory); RegCloseKey(hServicesKey); @@ -183,15 +183,15 @@ /* Load services in the category */ ServiceName = Buffer; - while (_T('\0') != ServiceName[0]) + while (ServiceName[0] != _T('\0')) { size_t Length; Length = _tcslen(ServiceName); - if (0 == Length) + if (Length == 0) break; - if (TRUE == PrepareService(ServiceName)) + if (PrepareService(ServiceName) == TRUE) ++NrOfServices; BufferIndex += Length + 1; @@ -222,12 +222,12 @@ NrOfServices = LoadServiceCategory(argv[2]); DPRINT("NrOfServices: %lu\n", NrOfServices); - if (0 == NrOfServices) + if (NrOfServices == 0) return 0; ServiceTable = HeapAlloc(GetProcessHeap(), 0, sizeof(SERVICE_TABLE_ENTRY) * (NrOfServices + 1)); - if (NULL != ServiceTable) + if (ServiceTable != NULL) { DWORD i; PSERVICE Service = FirstService; @@ -245,7 +245,7 @@ ServiceTable[i].lpServiceName = NULL; ServiceTable[i].lpServiceProc = NULL; - if (FALSE == StartServiceCtrlDispatcher(ServiceTable)) + if (StartServiceCtrlDispatcher(ServiceTable) == FALSE) DPRINT1("Failed to start service control dispatcher, ErrorCode: %lu\n", GetLastError()); HeapFree(GetProcessHeap(), 0, ServiceTable);
11 years, 2 months
1
0
0
0
[tfaber] 59357: [SVCHOST] - Convert tabs to spaces. No code changes.
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Jun 29 11:10:28 2013 New Revision: 59357 URL:
http://svn.reactos.org/svn/reactos?rev=59357&view=rev
Log: [SVCHOST] - Convert tabs to spaces. No code changes. Modified: trunk/reactos/base/services/svchost/svchost.c trunk/reactos/base/services/svchost/svchost.h Modified: trunk/reactos/base/services/svchost/svchost.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/svchost/svch…
============================================================================== --- trunk/reactos/base/services/svchost/svchost.c [iso-8859-1] (original) +++ trunk/reactos/base/services/svchost/svchost.c [iso-8859-1] Sat Jun 29 11:10:28 2013 @@ -1,9 +1,9 @@ /* - * PROJECT: ReactOS SvcHost - * LICENSE: GPL - See COPYING in the top level directory - * FILE: /base/services/svchost/svchost.c - * PURPOSE: Provide dll service loader - * PROGRAMMERS: Gregor Brunmar (gregor.brunmar(a)home.se) + * PROJECT: ReactOS SvcHost + * LICENSE: GPL - See COPYING in the top level directory + * FILE: /base/services/svchost/svchost.c + * PURPOSE: Provide dll service loader + * PROGRAMMERS: Gregor Brunmar (gregor.brunmar(a)home.se) */ /* INCLUDES ******************************************************************/ @@ -15,12 +15,12 @@ /* DEFINES *******************************************************************/ -static LPCTSTR SVCHOST_REG_KEY = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SvcHost"); -static LPCTSTR SERVICE_KEY = _T("SYSTEM\\CurrentControlSet\\Services\\"); -static LPCTSTR PARAMETERS_KEY = _T("\\Parameters"); - -#define SERVICE_KEY_LENGTH _tcslen(SERVICE_KEY); -#define REG_MAX_DATA_SIZE 2048 +static LPCTSTR SVCHOST_REG_KEY = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SvcHost"); +static LPCTSTR SERVICE_KEY = _T("SYSTEM\\CurrentControlSet\\Services\\"); +static LPCTSTR PARAMETERS_KEY = _T("\\Parameters"); + +#define SERVICE_KEY_LENGTH _tcslen(SERVICE_KEY); +#define REG_MAX_DATA_SIZE 2048 static PSERVICE FirstService = NULL; @@ -28,127 +28,127 @@ BOOL PrepareService(LPCTSTR ServiceName) { - HKEY hServiceKey; - TCHAR ServiceKeyBuffer[MAX_PATH + 1]; - DWORD LeftOfBuffer = sizeof(ServiceKeyBuffer) / sizeof(ServiceKeyBuffer[0]); - DWORD KeyType; - PTSTR Buffer = NULL; - DWORD BufferSize = MAX_PATH + 1; - LONG RetVal; - HINSTANCE hServiceDll; - TCHAR DllPath[MAX_PATH + 2]; /* See MSDN on ExpandEnvironmentStrings() for ANSI strings for more details on + 2 */ - LPSERVICE_MAIN_FUNCTION ServiceMainFunc; - PSERVICE Service; - - /* Compose the registry path to the service's "Parameter" key */ - _tcsncpy(ServiceKeyBuffer, SERVICE_KEY, LeftOfBuffer); - LeftOfBuffer -= _tcslen(SERVICE_KEY); - _tcsncat(ServiceKeyBuffer, ServiceName, LeftOfBuffer); - LeftOfBuffer -= _tcslen(ServiceName); - _tcsncat(ServiceKeyBuffer, PARAMETERS_KEY, LeftOfBuffer); - LeftOfBuffer -= _tcslen(PARAMETERS_KEY); - - if (LeftOfBuffer < 0) - { - DPRINT1("Buffer overflow for service name: '%s'\n", ServiceName); - return FALSE; - } - - /* Open the service registry key to find the dll name */ - if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE, ServiceKeyBuffer, 0, KEY_READ, &hServiceKey)) - { - DPRINT1("Could not open service key (%s)\n", ServiceKeyBuffer); - return FALSE; - } - - do - { - if (Buffer) - HeapFree(GetProcessHeap(), 0, Buffer); - - Buffer = HeapAlloc(GetProcessHeap(), 0, BufferSize); - if (NULL == Buffer) - { - DPRINT1("Not enough memory for service: %s\n", ServiceName); - return FALSE; - } - - RetVal = RegQueryValueEx(hServiceKey, _T("ServiceDll"), NULL, &KeyType, (LPBYTE)Buffer, &BufferSize); - - } while (ERROR_MORE_DATA == RetVal); - - - RegCloseKey(hServiceKey); - - if (ERROR_SUCCESS != RetVal || 0 == BufferSize) - { - DPRINT1("Could not read 'ServiceDll' value from service: %s, ErrorCode: 0x%x\n", ServiceName, RetVal); - HeapFree(GetProcessHeap(), 0, Buffer); - return FALSE; - } - - /* Convert possible %SystemRoot% to a real path */ - BufferSize = ExpandEnvironmentStrings(Buffer, DllPath, _countof(DllPath)); - if (0 == BufferSize) - { - DPRINT1("Invalid ServiceDll path: %s\n", Buffer); - HeapFree(GetProcessHeap(), 0, Buffer); - return FALSE; - } - - HeapFree(GetProcessHeap(), 0, Buffer); - - /* Load the service dll */ - DPRINT("Trying to load dll\n"); - hServiceDll = LoadLibrary(DllPath); - - if (NULL == hServiceDll) - { - DPRINT1("Unable to load ServiceDll: %s, ErrorCode: %u\n", DllPath, GetLastError()); - return FALSE; - } - - ServiceMainFunc = (LPSERVICE_MAIN_FUNCTION)GetProcAddress(hServiceDll, "ServiceMain"); - - /* Allocate a service node in the linked list */ - Service = HeapAlloc(GetProcessHeap(), 0, sizeof(SERVICE)); - if (NULL == Service) - { - DPRINT1("Not enough memory for service: %s\n", ServiceName); - return FALSE; - } - - memset(Service, 0, sizeof(SERVICE)); - Service->Name = HeapAlloc(GetProcessHeap(), 0, (_tcslen(ServiceName)+1) * sizeof(TCHAR)); - if (NULL == Service->Name) - { - DPRINT1("Not enough memory for service: %s\n", ServiceName); - HeapFree(GetProcessHeap(), 0, Service); - return FALSE; - } - _tcscpy(Service->Name, ServiceName); - - Service->hServiceDll = hServiceDll; - Service->ServiceMainFunc = ServiceMainFunc; - - Service->Next = FirstService; - FirstService = Service; - - return TRUE; + HKEY hServiceKey; + TCHAR ServiceKeyBuffer[MAX_PATH + 1]; + DWORD LeftOfBuffer = sizeof(ServiceKeyBuffer) / sizeof(ServiceKeyBuffer[0]); + DWORD KeyType; + PTSTR Buffer = NULL; + DWORD BufferSize = MAX_PATH + 1; + LONG RetVal; + HINSTANCE hServiceDll; + TCHAR DllPath[MAX_PATH + 2]; /* See MSDN on ExpandEnvironmentStrings() for ANSI strings for more details on + 2 */ + LPSERVICE_MAIN_FUNCTION ServiceMainFunc; + PSERVICE Service; + + /* Compose the registry path to the service's "Parameter" key */ + _tcsncpy(ServiceKeyBuffer, SERVICE_KEY, LeftOfBuffer); + LeftOfBuffer -= _tcslen(SERVICE_KEY); + _tcsncat(ServiceKeyBuffer, ServiceName, LeftOfBuffer); + LeftOfBuffer -= _tcslen(ServiceName); + _tcsncat(ServiceKeyBuffer, PARAMETERS_KEY, LeftOfBuffer); + LeftOfBuffer -= _tcslen(PARAMETERS_KEY); + + if (LeftOfBuffer < 0) + { + DPRINT1("Buffer overflow for service name: '%s'\n", ServiceName); + return FALSE; + } + + /* Open the service registry key to find the dll name */ + if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE, ServiceKeyBuffer, 0, KEY_READ, &hServiceKey)) + { + DPRINT1("Could not open service key (%s)\n", ServiceKeyBuffer); + return FALSE; + } + + do + { + if (Buffer) + HeapFree(GetProcessHeap(), 0, Buffer); + + Buffer = HeapAlloc(GetProcessHeap(), 0, BufferSize); + if (NULL == Buffer) + { + DPRINT1("Not enough memory for service: %s\n", ServiceName); + return FALSE; + } + + RetVal = RegQueryValueEx(hServiceKey, _T("ServiceDll"), NULL, &KeyType, (LPBYTE)Buffer, &BufferSize); + + } while (ERROR_MORE_DATA == RetVal); + + + RegCloseKey(hServiceKey); + + if (ERROR_SUCCESS != RetVal || 0 == BufferSize) + { + DPRINT1("Could not read 'ServiceDll' value from service: %s, ErrorCode: 0x%x\n", ServiceName, RetVal); + HeapFree(GetProcessHeap(), 0, Buffer); + return FALSE; + } + + /* Convert possible %SystemRoot% to a real path */ + BufferSize = ExpandEnvironmentStrings(Buffer, DllPath, _countof(DllPath)); + if (0 == BufferSize) + { + DPRINT1("Invalid ServiceDll path: %s\n", Buffer); + HeapFree(GetProcessHeap(), 0, Buffer); + return FALSE; + } + + HeapFree(GetProcessHeap(), 0, Buffer); + + /* Load the service dll */ + DPRINT("Trying to load dll\n"); + hServiceDll = LoadLibrary(DllPath); + + if (NULL == hServiceDll) + { + DPRINT1("Unable to load ServiceDll: %s, ErrorCode: %u\n", DllPath, GetLastError()); + return FALSE; + } + + ServiceMainFunc = (LPSERVICE_MAIN_FUNCTION)GetProcAddress(hServiceDll, "ServiceMain"); + + /* Allocate a service node in the linked list */ + Service = HeapAlloc(GetProcessHeap(), 0, sizeof(SERVICE)); + if (NULL == Service) + { + DPRINT1("Not enough memory for service: %s\n", ServiceName); + return FALSE; + } + + memset(Service, 0, sizeof(SERVICE)); + Service->Name = HeapAlloc(GetProcessHeap(), 0, (_tcslen(ServiceName)+1) * sizeof(TCHAR)); + if (NULL == Service->Name) + { + DPRINT1("Not enough memory for service: %s\n", ServiceName); + HeapFree(GetProcessHeap(), 0, Service); + return FALSE; + } + _tcscpy(Service->Name, ServiceName); + + Service->hServiceDll = hServiceDll; + Service->ServiceMainFunc = ServiceMainFunc; + + Service->Next = FirstService; + FirstService = Service; + + return TRUE; } VOID FreeServices(VOID) { - while (FirstService) - { - PSERVICE Service = FirstService; - FirstService = Service->Next; - - FreeLibrary(Service->hServiceDll); - - HeapFree(GetProcessHeap(), 0, Service->Name); - HeapFree(GetProcessHeap(), 0, Service); - } + while (FirstService) + { + PSERVICE Service = FirstService; + FirstService = Service->Next; + + FreeLibrary(Service->hServiceDll); + + HeapFree(GetProcessHeap(), 0, Service->Name); + HeapFree(GetProcessHeap(), 0, Service); + } } /* @@ -156,107 +156,107 @@ */ DWORD LoadServiceCategory(LPCTSTR ServiceCategory) { - HKEY hServicesKey; - DWORD KeyType; - DWORD BufferSize = REG_MAX_DATA_SIZE; - TCHAR Buffer[REG_MAX_DATA_SIZE]; - LPCTSTR ServiceName; - DWORD BufferIndex = 0; - DWORD NrOfServices = 0; - - /* Get all the services in this category */ - if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE, SVCHOST_REG_KEY, 0, KEY_READ, &hServicesKey)) - { - DPRINT1("Could not open service category: %s\n", ServiceCategory); - return 0; - } - - if (ERROR_SUCCESS != RegQueryValueEx(hServicesKey, ServiceCategory, NULL, &KeyType, (LPBYTE)Buffer, &BufferSize)) - { - DPRINT1("Could not open service category (2): %s\n", ServiceCategory); - RegCloseKey(hServicesKey); - return 0; - } - - /* Clean up */ - RegCloseKey(hServicesKey); - - /* Load services in the category */ - ServiceName = Buffer; - while (_T('\0') != ServiceName[0]) - { - size_t Length; - - Length = _tcslen(ServiceName); - if (0 == Length) - break; - - if (TRUE == PrepareService(ServiceName)) - ++NrOfServices; - - BufferIndex += Length + 1; - - ServiceName = &Buffer[BufferIndex]; - } - - return NrOfServices; + HKEY hServicesKey; + DWORD KeyType; + DWORD BufferSize = REG_MAX_DATA_SIZE; + TCHAR Buffer[REG_MAX_DATA_SIZE]; + LPCTSTR ServiceName; + DWORD BufferIndex = 0; + DWORD NrOfServices = 0; + + /* Get all the services in this category */ + if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MACHINE, SVCHOST_REG_KEY, 0, KEY_READ, &hServicesKey)) + { + DPRINT1("Could not open service category: %s\n", ServiceCategory); + return 0; + } + + if (ERROR_SUCCESS != RegQueryValueEx(hServicesKey, ServiceCategory, NULL, &KeyType, (LPBYTE)Buffer, &BufferSize)) + { + DPRINT1("Could not open service category (2): %s\n", ServiceCategory); + RegCloseKey(hServicesKey); + return 0; + } + + /* Clean up */ + RegCloseKey(hServicesKey); + + /* Load services in the category */ + ServiceName = Buffer; + while (_T('\0') != ServiceName[0]) + { + size_t Length; + + Length = _tcslen(ServiceName); + if (0 == Length) + break; + + if (TRUE == PrepareService(ServiceName)) + ++NrOfServices; + + BufferIndex += Length + 1; + + ServiceName = &Buffer[BufferIndex]; + } + + return NrOfServices; } int _tmain (int argc, LPTSTR argv []) { - DWORD NrOfServices; - LPSERVICE_TABLE_ENTRY ServiceTable; - - if (argc < 3) - { - /* MS svchost.exe doesn't seem to print help, should we? */ - return 0; - } - - if (_tcscmp(argv[1], _T("-k")) != 0) - { - /* For now, we only handle "-k" */ - return 0; - } - - NrOfServices = LoadServiceCategory(argv[2]); - - DPRINT("NrOfServices: %lu\n", NrOfServices); - if (0 == NrOfServices) - return 0; - - ServiceTable = HeapAlloc(GetProcessHeap(), 0, sizeof(SERVICE_TABLE_ENTRY) * (NrOfServices + 1)); - - if (NULL != ServiceTable) - { - DWORD i; - PSERVICE Service = FirstService; - - /* Fill the service table */ - for (i = 0; i < NrOfServices; i++) - { - DPRINT("Loading service: %s\n", Service->Name); - ServiceTable[i].lpServiceName = Service->Name; - ServiceTable[i].lpServiceProc = Service->ServiceMainFunc; - Service = Service->Next; - } - - /* Set a NULL entry to end the service table */ - ServiceTable[i].lpServiceName = NULL; - ServiceTable[i].lpServiceProc = NULL; - - if (FALSE == StartServiceCtrlDispatcher(ServiceTable)) - DPRINT1("Failed to start service control dispatcher, ErrorCode: %lu\n", GetLastError()); - - HeapFree(GetProcessHeap(), 0, ServiceTable); - } - else - { - DPRINT1("Not enough memory for the service table, trying to allocate %u bytes\n", sizeof(SERVICE_TABLE_ENTRY) * (NrOfServices + 1)); - } - - DPRINT("Freeing services...\n"); - FreeServices(); + DWORD NrOfServices; + LPSERVICE_TABLE_ENTRY ServiceTable; + + if (argc < 3) + { + /* MS svchost.exe doesn't seem to print help, should we? */ + return 0; + } + + if (_tcscmp(argv[1], _T("-k")) != 0) + { + /* For now, we only handle "-k" */ + return 0; + } + + NrOfServices = LoadServiceCategory(argv[2]); + + DPRINT("NrOfServices: %lu\n", NrOfServices); + if (0 == NrOfServices) + return 0; + + ServiceTable = HeapAlloc(GetProcessHeap(), 0, sizeof(SERVICE_TABLE_ENTRY) * (NrOfServices + 1)); + + if (NULL != ServiceTable) + { + DWORD i; + PSERVICE Service = FirstService; + + /* Fill the service table */ + for (i = 0; i < NrOfServices; i++) + { + DPRINT("Loading service: %s\n", Service->Name); + ServiceTable[i].lpServiceName = Service->Name; + ServiceTable[i].lpServiceProc = Service->ServiceMainFunc; + Service = Service->Next; + } + + /* Set a NULL entry to end the service table */ + ServiceTable[i].lpServiceName = NULL; + ServiceTable[i].lpServiceProc = NULL; + + if (FALSE == StartServiceCtrlDispatcher(ServiceTable)) + DPRINT1("Failed to start service control dispatcher, ErrorCode: %lu\n", GetLastError()); + + HeapFree(GetProcessHeap(), 0, ServiceTable); + } + else + { + DPRINT1("Not enough memory for the service table, trying to allocate %u bytes\n", sizeof(SERVICE_TABLE_ENTRY) * (NrOfServices + 1)); + } + + DPRINT("Freeing services...\n"); + FreeServices(); return 0; } Modified: trunk/reactos/base/services/svchost/svchost.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/svchost/svch…
============================================================================== --- trunk/reactos/base/services/svchost/svchost.h [iso-8859-1] (original) +++ trunk/reactos/base/services/svchost/svchost.h [iso-8859-1] Sat Jun 29 11:10:28 2013 @@ -1,9 +1,9 @@ /* - * PROJECT: ReactOS SvcHost - * LICENSE: GPL - See COPYING in the top level directory - * FILE: /base/services/svchost/svchost.h - * PURPOSE: Provide dll service loader - * PROGRAMMERS: Gregor Brunmar (gregor.brunmar(a)home.se) + * PROJECT: ReactOS SvcHost + * LICENSE: GPL - See COPYING in the top level directory + * FILE: /base/services/svchost/svchost.h + * PURPOSE: Provide dll service loader + * PROGRAMMERS: Gregor Brunmar (gregor.brunmar(a)home.se) */ #pragma once @@ -24,15 +24,14 @@ /* DEFINES *******************************************************************/ -#define CS_TIMEOUT 1000 +#define CS_TIMEOUT 1000 typedef struct _SERVICE { - PTSTR Name; - HINSTANCE hServiceDll; - LPSERVICE_MAIN_FUNCTION ServiceMainFunc; - struct _SERVICE *Next; + PTSTR Name; + HINSTANCE hServiceDll; + LPSERVICE_MAIN_FUNCTION ServiceMainFunc; + struct _SERVICE *Next; } SERVICE, *PSERVICE; - /* FUNCTIONS *****************************************************************/
11 years, 2 months
1
0
0
0
[tfaber] 59356: [QUARTZ_WINETEST] - Skip dsoundrender, filtergraph, misc, videorenderer tests because they cause testbot timeouts. ROSTESTS-116
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Jun 29 08:36:39 2013 New Revision: 59356 URL:
http://svn.reactos.org/svn/reactos?rev=59356&view=rev
Log: [QUARTZ_WINETEST] - Skip dsoundrender, filtergraph, misc, videorenderer tests because they cause testbot timeouts. ROSTESTS-116 Modified: trunk/rostests/winetests/quartz/testlist.c Modified: trunk/rostests/winetests/quartz/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/quartz/testlist…
============================================================================== --- trunk/rostests/winetests/quartz/testlist.c [iso-8859-1] (original) +++ trunk/rostests/winetests/quartz/testlist.c [iso-8859-1] Sat Jun 29 08:36:39 2013 @@ -18,12 +18,16 @@ const struct test winetest_testlist[] = { { "avisplitter", func_avisplitter }, - { "dsoundrender", func_dsoundrender }, - { "filtergraph", func_filtergraph }, - { "filtermapper", func_filtermapper }, - { "memallocator", func_memallocator }, - { "misc", func_misc }, - { "videorenderer", func_videorenderer }, - { "referenceclock", func_referenceclock }, +#ifdef ROSTESTS_116_FIXED + { "dsoundrender", func_dsoundrender }, + { "filtergraph", func_filtergraph }, +#endif /* ROSTESTS_116_FIXED */ + { "filtermapper", func_filtermapper }, + { "memallocator", func_memallocator }, +#ifdef ROSTESTS_116_FIXED + { "misc", func_misc }, + { "videorenderer", func_videorenderer }, +#endif /* ROSTESTS_116_FIXED */ + { "referenceclock", func_referenceclock }, { 0, 0 } };
11 years, 2 months
1
0
0
0
[tfaber] 59355: [KERNEL32] - Fix use of uninitialized variables in failure case. Patch by Samuel Serapión CORE-7302 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Jun 29 06:08:57 2013 New Revision: 59355 URL:
http://svn.reactos.org/svn/reactos?rev=59355&view=rev
Log: [KERNEL32] - Fix use of uninitialized variables in failure case. Patch by Samuel Serapión CORE-7302 #resolve Modified: trunk/reactos/dll/win32/kernel32/client/path.c trunk/reactos/dll/win32/kernel32/client/vdm.c Modified: trunk/reactos/dll/win32/kernel32/client/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/path.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/path.c [iso-8859-1] Sat Jun 29 06:08:57 2013 @@ -990,7 +990,7 @@ OUT LPSTR *lpFilePart) { NTSTATUS Status; - PWCHAR Buffer; + PWCHAR Buffer = NULL; ULONG PathSize, FilePartSize; ANSI_STRING AnsiString; UNICODE_STRING FileNameString, UniString; Modified: trunk/reactos/dll/win32/kernel32/client/vdm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/vdm.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/vdm.c [iso-8859-1] Sat Jun 29 06:08:57 2013 @@ -309,7 +309,7 @@ { BOOL Result; ULONG RegionSize, EnvironmentSize = 0; - PWCHAR p, Environment, NewEnvironment; + PWCHAR p, Environment, NewEnvironment = NULL; NTSTATUS Status; /* Make sure we have both strings */
11 years, 2 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
...
28
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
Results per page:
10
25
50
100
200