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
August 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
32 participants
304 discussions
Start a n
N
ew thread
02/02: [ADVAPI32_WINETEST] Restore service.c changes from 3c1b7834e1
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ab243b82b49ec8ed683f5…
commit ab243b82b49ec8ed683f5674273f0bc866f1151a Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr> AuthorDate: Sun Jul 22 01:08:55 2018 +0200 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 21 17:36:47 2018 +0200 [ADVAPI32_WINETEST] Restore service.c changes from 3c1b7834e1 This reverts commit a67df65c4f5337f14043709ae758361f0b0a3b31. New failure was fixed by previous SERVICES commit. Thus new timeout is avoided. CORE-14521 --- modules/rostests/winetests/advapi32/service.c | 205 +++++++++++++++++++++----- 1 file changed, 172 insertions(+), 33 deletions(-) diff --git a/modules/rostests/winetests/advapi32/service.c b/modules/rostests/winetests/advapi32/service.c index a85bdf8863..8c13fbb2c6 100644 --- a/modules/rostests/winetests/advapi32/service.c +++ b/modules/rostests/winetests/advapi32/service.c @@ -36,6 +36,7 @@ static const CHAR spooler[] = "Spooler"; /* Should be available on all platforms static CHAR selfname[MAX_PATH]; static BOOL (WINAPI *pChangeServiceConfig2A)(SC_HANDLE,DWORD,LPVOID); +static BOOL (WINAPI *pChangeServiceConfig2W)(SC_HANDLE,DWORD,LPVOID); static BOOL (WINAPI *pEnumServicesStatusExA)(SC_HANDLE, SC_ENUM_TYPE, DWORD, DWORD, LPBYTE, DWORD, LPDWORD, LPDWORD, LPDWORD, LPCSTR); @@ -57,6 +58,7 @@ static void init_function_pointers(void) HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll"); pChangeServiceConfig2A = (void*)GetProcAddress(hadvapi32, "ChangeServiceConfig2A"); + pChangeServiceConfig2W = (void*)GetProcAddress(hadvapi32, "ChangeServiceConfig2W"); pEnumServicesStatusExA= (void*)GetProcAddress(hadvapi32, "EnumServicesStatusExA"); pEnumServicesStatusExW= (void*)GetProcAddress(hadvapi32, "EnumServicesStatusExW"); pGetSecurityInfo = (void *)GetProcAddress(hadvapi32, "GetSecurityInfo"); @@ -1954,6 +1956,7 @@ static void test_queryconfig2(void) DWORD expected, needed; BYTE buffer[MAX_PATH]; LPSERVICE_DESCRIPTIONA pConfig = (LPSERVICE_DESCRIPTIONA)buffer; + LPSERVICE_DESCRIPTIONW pConfigW = (LPSERVICE_DESCRIPTIONW)buffer; SERVICE_PRESHUTDOWN_INFO preshutdown_info; static const CHAR servicename [] = "Winetest"; static const CHAR displayname [] = "Winetest dummy service"; @@ -1961,6 +1964,9 @@ static void test_queryconfig2(void) static const CHAR dependencies[] = "Master1\0Master2\0+MasterGroup1\0"; static const CHAR password [] = ""; static const CHAR description [] = "Description"; + static const CHAR description_empty[] = ""; + static const WCHAR descriptionW [] = {'D','e','s','c','r','i','p','t','i','o','n','W',0}; + static const WCHAR descriptionW_empty[] = {0}; if(!pQueryServiceConfig2A) { @@ -2121,6 +2127,66 @@ static void test_queryconfig2(void) ret = pQueryServiceConfig2W(svc_handle, SERVICE_CONFIG_DESCRIPTION,buffer, needed,&needed); ok(ret, "expected QueryServiceConfig2W to succeed\n"); + pConfig->lpDescription = (LPSTR)description; + ret = pChangeServiceConfig2A(svc_handle, SERVICE_CONFIG_DESCRIPTION, &buffer); + ok(ret, "expected ChangeServiceConfig2A to succeed\n"); + + pConfig->lpDescription = NULL; + ret = pQueryServiceConfig2A(svc_handle, SERVICE_CONFIG_DESCRIPTION, buffer, sizeof(buffer), &needed); + ok(ret, "expected QueryServiceConfig2A to succeed\n"); + ok(pConfig->lpDescription && !strcmp(description, pConfig->lpDescription), + "expected lpDescription to be %s, got %s\n", description, pConfig->lpDescription); + + pConfig->lpDescription = NULL; + ret = pChangeServiceConfig2A(svc_handle, SERVICE_CONFIG_DESCRIPTION, &buffer); + ok(ret, "expected ChangeServiceConfig2A to succeed\n"); + + pConfig->lpDescription = NULL; + ret = pQueryServiceConfig2A(svc_handle, SERVICE_CONFIG_DESCRIPTION, buffer, sizeof(buffer), &needed); + ok(ret, "expected QueryServiceConfig2A to succeed\n"); + ok(pConfig->lpDescription && !strcmp(description, pConfig->lpDescription), + "expected lpDescription to be %s, got %s\n", description, pConfig->lpDescription); + + pConfig->lpDescription = (LPSTR)description_empty; + ret = pChangeServiceConfig2A(svc_handle, SERVICE_CONFIG_DESCRIPTION, &buffer); + ok(ret, "expected ChangeServiceConfig2A to succeed\n"); + + pConfig->lpDescription = (void*)0xdeadbeef; + ret = pQueryServiceConfig2A(svc_handle, SERVICE_CONFIG_DESCRIPTION, buffer, sizeof(buffer), &needed); + ok(ret, "expected QueryServiceConfig2A to succeed\n"); + ok(!pConfig->lpDescription, + "expected lpDescription to be null, got %s\n", pConfig->lpDescription); + + pConfigW->lpDescription = (LPWSTR)descriptionW; + ret = pChangeServiceConfig2W(svc_handle, SERVICE_CONFIG_DESCRIPTION, &buffer); + ok(ret, "expected ChangeServiceConfig2W to succeed\n"); + + pConfigW->lpDescription = NULL; + ret = pQueryServiceConfig2W(svc_handle, SERVICE_CONFIG_DESCRIPTION, buffer, sizeof(buffer), &needed); + ok(ret, "expected QueryServiceConfig2A to succeed\n"); + ok(pConfigW->lpDescription && !lstrcmpW(descriptionW, pConfigW->lpDescription), + "expected lpDescription to be %s, got %s\n", wine_dbgstr_w(descriptionW), wine_dbgstr_w(pConfigW->lpDescription)); + + pConfigW->lpDescription = NULL; + ret = pChangeServiceConfig2W(svc_handle, SERVICE_CONFIG_DESCRIPTION, &buffer); + ok(ret, "expected ChangeServiceConfig2W to succeed\n"); + + pConfigW->lpDescription = NULL; + ret = pQueryServiceConfig2W(svc_handle, SERVICE_CONFIG_DESCRIPTION, buffer, sizeof(buffer), &needed); + ok(ret, "expected QueryServiceConfig2A to succeed\n"); + ok(pConfigW->lpDescription && !lstrcmpW(descriptionW, pConfigW->lpDescription), + "expected lpDescription to be %s, got %s\n", wine_dbgstr_w(descriptionW), wine_dbgstr_w(pConfigW->lpDescription)); + + pConfigW->lpDescription = (LPWSTR)descriptionW_empty; + ret = pChangeServiceConfig2W(svc_handle, SERVICE_CONFIG_DESCRIPTION, &buffer); + ok(ret, "expected ChangeServiceConfig2W to succeed\n"); + + pConfigW->lpDescription = (void*)0xdeadbeef; + ret = pQueryServiceConfig2W(svc_handle, SERVICE_CONFIG_DESCRIPTION, buffer, sizeof(buffer), &needed); + ok(ret, "expected QueryServiceConfig2A to succeed\n"); + ok(!pConfigW->lpDescription, + "expected lpDescription to be null, got %s\n", wine_dbgstr_w(pConfigW->lpDescription)); + SetLastError(0xdeadbeef); ret = pQueryServiceConfig2W(svc_handle, SERVICE_CONFIG_PRESHUTDOWN_INFO, (LPBYTE)&preshutdown_info, sizeof(preshutdown_info), &needed); @@ -2200,73 +2266,146 @@ static DWORD try_start_stop(SC_HANDLE svc_handle, const char* name, DWORD is_nt4 return le1; } +#define PHASE_STOPPED 1 +#define PHASE_RUNNING 2 + struct notify_data { SERVICE_NOTIFYW notify; SC_HANDLE svc; + BOOL was_called; + DWORD phase; }; -static void CALLBACK cb_stopped(void *user) +static void CALLBACK notify_cb(void *user) { struct notify_data *data = user; - BOOL br; + switch (data->phase) + { + case PHASE_STOPPED: + ok(data->notify.dwNotificationStatus == ERROR_SUCCESS, + "Got wrong notification status: %u\n", data->notify.dwNotificationStatus); + ok(data->notify.ServiceStatus.dwCurrentState == SERVICE_STOPPED, + "Got wrong service state: 0x%x\n", data->notify.ServiceStatus.dwCurrentState); + ok(data->notify.dwNotificationTriggered == SERVICE_NOTIFY_STOPPED, + "Got wrong notification triggered: 0x%x\n", data->notify.dwNotificationTriggered); + break; - ok(data->notify.dwNotificationStatus == ERROR_SUCCESS, - "Got wrong notification status: %u\n", data->notify.dwNotificationStatus); - ok(data->notify.ServiceStatus.dwCurrentState == SERVICE_STOPPED, - "Got wrong service state: 0x%x\n", data->notify.ServiceStatus.dwCurrentState); - ok(data->notify.dwNotificationTriggered == SERVICE_NOTIFY_STOPPED, - "Got wrong notification triggered: 0x%x\n", data->notify.dwNotificationTriggered); + case PHASE_RUNNING: + ok(data->notify.dwNotificationStatus == ERROR_SUCCESS, + "Got wrong notification status: %u\n", data->notify.dwNotificationStatus); + ok(data->notify.ServiceStatus.dwCurrentState == SERVICE_RUNNING, + "Got wrong service state: 0x%x\n", data->notify.ServiceStatus.dwCurrentState); + ok(data->notify.dwNotificationTriggered == SERVICE_NOTIFY_RUNNING, + "Got wrong notification triggered: 0x%x\n", data->notify.dwNotificationTriggered); + break; + } - br = StartServiceA(data->svc, 0, NULL); - ok(br, "StartService failed: %u\n", GetLastError()); + data->was_called = TRUE; } -static void CALLBACK cb_running(void *user) +static void test_servicenotify(SC_HANDLE scm_handle, const char *servicename) { - struct notify_data *data = user; + DWORD dr, dr2; + struct notify_data data; + struct notify_data data2; BOOL br; SERVICE_STATUS status; - - ok(data->notify.dwNotificationStatus == ERROR_SUCCESS, - "Got wrong notification status: %u\n", data->notify.dwNotificationStatus); - ok(data->notify.ServiceStatus.dwCurrentState == SERVICE_RUNNING, - "Got wrong service state: 0x%x\n", data->notify.ServiceStatus.dwCurrentState); - ok(data->notify.dwNotificationTriggered == SERVICE_NOTIFY_RUNNING, - "Got wrong notification triggered: 0x%x\n", data->notify.dwNotificationTriggered); - - br = ControlService(data->svc, SERVICE_CONTROL_STOP, &status); - ok(br, "ControlService failed: %u\n", GetLastError()); -} - -static void test_servicenotify(SC_HANDLE svc) -{ - DWORD dr; - struct notify_data data; + HANDLE svc, svc2; if(!pNotifyServiceStatusChangeW){ win_skip("No NotifyServiceStatusChangeW\n"); return; } + svc = OpenServiceA(scm_handle, servicename, GENERIC_ALL); + svc2 = OpenServiceA(scm_handle, servicename, GENERIC_ALL); + ok(svc != NULL && svc2 != NULL, "Failed to open service\n"); + if(!svc || !svc2) + return; + + /* receive stopped notification, then start service */ memset(&data.notify, 0, sizeof(data.notify)); data.notify.dwVersion = SERVICE_NOTIFY_STATUS_CHANGE; - data.notify.pfnNotifyCallback = &cb_stopped; + data.notify.pfnNotifyCallback = ¬ify_cb; data.notify.pContext = &data; data.svc = svc; + data.phase = PHASE_STOPPED; + data.was_called = FALSE; + + dr = pNotifyServiceStatusChangeW(svc, SERVICE_NOTIFY_STOPPED | SERVICE_NOTIFY_RUNNING, &data.notify); + ok(dr == ERROR_SUCCESS, "NotifyServiceStatusChangeW failed: %u\n", dr); + + dr = SleepEx(100, TRUE); + ok(dr == WAIT_IO_COMPLETION, "Got wrong SleepEx result: %u\n", dr); + ok(data.was_called == TRUE, "APC wasn't called\n"); + + br = StartServiceA(svc, 0, NULL); + ok(br, "StartService failed: %u\n", GetLastError()); + + /* receive running notification */ + data.phase = PHASE_RUNNING; + data.was_called = FALSE; + + dr = pNotifyServiceStatusChangeW(svc, SERVICE_NOTIFY_STOPPED | SERVICE_NOTIFY_RUNNING, &data.notify); + ok(dr == ERROR_SUCCESS, "NotifyServiceStatusChangeW failed: %u\n", dr); + + dr = SleepEx(100, TRUE); + ok(dr == WAIT_IO_COMPLETION, "Got wrong SleepEx result: %u\n", dr); + ok(data.was_called == TRUE, "APC wasn't called\n"); + + /* cannot register two notifications */ + data.phase = PHASE_STOPPED; + data.was_called = FALSE; dr = pNotifyServiceStatusChangeW(svc, SERVICE_NOTIFY_STOPPED | SERVICE_NOTIFY_RUNNING, &data.notify); ok(dr == ERROR_SUCCESS, "NotifyServiceStatusChangeW failed: %u\n", dr); + memset(&data2.notify, 0, sizeof(data2.notify)); + data2.notify.dwVersion = SERVICE_NOTIFY_STATUS_CHANGE; + data2.notify.pfnNotifyCallback = ¬ify_cb; + data2.notify.pContext = &data2; + + dr = pNotifyServiceStatusChangeW(svc, SERVICE_NOTIFY_STOPPED | SERVICE_NOTIFY_RUNNING, &data2.notify); + ok(dr == ERROR_SUCCESS || /* win8+ */ + dr == ERROR_ALREADY_REGISTERED, "NotifyServiceStatusChangeW gave wrong result: %u\n", dr); + + /* should receive no notification because status has not changed. + * on win8+, SleepEx quits early but the callback is still not invoked. */ + dr2 = SleepEx(100, TRUE); + ok((dr == ERROR_SUCCESS && dr2 == WAIT_IO_COMPLETION) || /* win8+ */ + (dr == ERROR_ALREADY_REGISTERED && dr2 == 0), "Got wrong SleepEx result: %u\n", dr); + ok(data.was_called == FALSE, "APC should not have been called\n"); + + /* stop service and receive notifiction */ + br = ControlService(svc, SERVICE_CONTROL_STOP, &status); + ok(br, "ControlService failed: %u\n", GetLastError()); + dr = SleepEx(100, TRUE); - ok(dr == WAIT_IO_COMPLETION, "APC wasn't called\n"); + ok(dr == WAIT_IO_COMPLETION, "Got wrong SleepEx result: %u\n", dr); + ok(data.was_called == TRUE, "APC wasn't called\n"); - data.notify.pfnNotifyCallback = &cb_running; + /* test cancelation: create notify on svc that will block until service + * start; close svc; start service on svc2; verify that notification does + * not happen */ + data.phase = PHASE_RUNNING; + data.was_called = FALSE; dr = pNotifyServiceStatusChangeW(svc, SERVICE_NOTIFY_STOPPED | SERVICE_NOTIFY_RUNNING, &data.notify); ok(dr == ERROR_SUCCESS, "NotifyServiceStatusChangeW failed: %u\n", dr); + CloseServiceHandle(svc); + + br = StartServiceA(svc2, 0, NULL); + ok(br, "StartService failed: %u\n", GetLastError()); + dr = SleepEx(100, TRUE); - ok(dr == WAIT_IO_COMPLETION, "APC wasn't called\n"); + ok(dr == 0, "Got wrong SleepEx result: %u\n", dr); + ok(data.was_called == FALSE, "APC should not have been called\n"); + + br = ControlService(svc2, SERVICE_CONTROL_STOP, &status); + ok(br, "ControlService failed: %u\n", GetLastError()); + + CloseServiceHandle(svc2); } static void test_start_stop(void) @@ -2352,7 +2491,7 @@ static void test_start_stop(void) displayname = "Winetest Service"; ret = ChangeServiceConfigA(svc_handle, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE, cmd, NULL, NULL, NULL, NULL, NULL, displayname); ok(ret, "ChangeServiceConfig() failed le=%u\n", GetLastError()); - test_servicenotify(svc_handle); + test_servicenotify(scm_handle, servicename); cleanup: if (svc_handle)
6 years, 4 months
1
0
0
0
01/02: [SERVICES] RChangeServiceConfig2A(): Zero-Initialize InfoW variable
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e3a1c2c81b2e1167552cb…
commit e3a1c2c81b2e1167552cbb8f8ca1d774e025ccd7 Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr> AuthorDate: Sat Jul 21 03:01:03 2018 +0200 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 21 17:36:46 2018 +0200 [SERVICES] RChangeServiceConfig2A(): Zero-Initialize InfoW variable This lets forward NULL Info.psd/Info.psd->lpDescription/Info.psfa, instead of an uninitialized value. CORE-14521 --- base/system/services/rpcserver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/system/services/rpcserver.c b/base/system/services/rpcserver.c index fcfb1115a3..351793736d 100644 --- a/base/system/services/rpcserver.c +++ b/base/system/services/rpcserver.c @@ -5103,7 +5103,7 @@ RChangeServiceConfig2A( SC_RPC_HANDLE hService, SC_RPC_CONFIG_INFOA Info) { - SC_RPC_CONFIG_INFOW InfoW; + SC_RPC_CONFIG_INFOW InfoW = { 0 }; DWORD dwRet, dwLength; PVOID ptr = NULL;
6 years, 4 months
1
0
0
0
01/01: [FONTS] Update Hebrew font subtitutions (#795)
by Baruch Rutman
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8a407b5c60eb53fee83a9…
commit 8a407b5c60eb53fee83a9d0a27dd836cfce962ff Author: Baruch Rutman <peterooch(a)gmail.com> AuthorDate: Tue Aug 21 18:21:21 2018 +0300 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Tue Aug 21 17:21:21 2018 +0200 [FONTS] Update Hebrew font subtitutions (#795) Updated the font substitutions to use the new Hebrew glyphs in the updated Tahoma font. Also added substitution for the Ubuntu font to make the Lautus and Modern themes legible with Hebrew UI elements. Follow up to PR #789 and #790 ; CORE-14880, CORE-14943 --- base/setup/usetup/muifonts.h | 13 +++++++------ media/inf/font.inf | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/base/setup/usetup/muifonts.h b/base/setup/usetup/muifonts.h index e20ef4b45a..1d8e656aa9 100644 --- a/base/setup/usetup/muifonts.h +++ b/base/setup/usetup/muifonts.h @@ -80,13 +80,13 @@ MUI_SUBFONT HebrewFonts[] = { L"Courier New", L"FreeMono" }, { L"Fixedsys", L"Fixedsys Excelsior 3.01-L2" }, { L"Franklin Gothic Medium", L"Libre Franklin" }, - { L"Helv", L"DejaVu Sans" }, - { L"Helvetica", L"DejaVu Sans" }, + { L"Helv", L"Tahoma" }, + { L"Helvetica", L"Tahoma" }, { L"Lucida Console", L"DejaVu Sans Mono" }, - { L"MS Sans Serif", L"DejaVu Sans" }, - { L"MS Shell Dlg", L"DejaVu Sans" }, - { L"MS Shell Dlg 2", L"DejaVu Sans" }, - { L"Tahoma", L"DejaVu Sans" }, + { L"MS Sans Serif", L"Tahoma" }, + { L"MS Shell Dlg", L"Tahoma" }, + { L"MS Shell Dlg 2", L"Tahoma" }, + { L"Tahoma", L"Tahoma" }, { L"Terminal", L"DejaVu Sans Mono" }, { L"Times New Roman", L"DejaVu Serif" }, { L"Trebuchet MS", L"Open Sans" }, @@ -94,6 +94,7 @@ MUI_SUBFONT HebrewFonts[] = { L"Comic Sans MS", L"Ubuntu" }, { L"Georgia", L"FreeSerif" }, { L"Palatino Linotype", L"DejaVu Serif" }, + { L"Ubuntu", L"Tahoma" }, { NULL, NULL } }; diff --git a/media/inf/font.inf b/media/inf/font.inf index c85eed194d..71feb23ef3 100644 --- a/media/inf/font.inf +++ b/media/inf/font.inf @@ -79,17 +79,18 @@ HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Arial",0x00 HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Courier",0x00000000,"FreeMono" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Courier New",0x00000000,"FreeMono" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Fixedsys",0x00000000,"Fixedsys Excelsior 3.01-L2" -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Helv",0x00000000,"DejaVu Sans" -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Helvetica",0x00000000,"DejaVu Sans" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Helv",0x00000000,"Tahoma" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Helvetica",0x00000000,"Tahoma" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Lucida Console",0x00000000,"DejaVu Sans Mono" -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS Sans Serif",0x00000000,"DejaVu Sans" -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS Shell Dlg",0x00000000,"DejaVu Sans" -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS Shell Dlg 2",0x00000000,"DejaVu Sans" -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Tahoma",0x00000000,"DejaVu Sans" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS Sans Serif",0x00000000,"Tahoma" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS Shell Dlg",0x00000000,"Tahoma" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","MS Shell Dlg 2",0x00000000,"Tahoma" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Tahoma",0x00000000,"Tahoma" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Terminal",0x00000000,"DejaVu Sans Mono" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Times",0x00000000,"DejaVu Serif" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Times New Roman",0x00000000,"DejaVu Serif" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Tms Rmn",0x00000000,"DejaVu Serif" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Ubuntu",0x00000000,"Tahoma" [Font.CJK.Reg] HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes","Arial",0x00000000,"Liberation Sans"
6 years, 4 months
1
0
0
0
01/01: [TRANSLATION][ZIPFLDR] Add Swedish translation (#794)
by Andreas Bjerkeholt
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5a2a0314a13088c03b288…
commit 5a2a0314a13088c03b288fc929baa45af94552b9 Author: Andreas Bjerkeholt <harteex(a)gmail.com> AuthorDate: Tue Aug 21 16:57:01 2018 +0200 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Tue Aug 21 16:57:01 2018 +0200 [TRANSLATION][ZIPFLDR] Add Swedish translation (#794) --- dll/shellext/zipfldr/lang/sv-SE.rc | 71 ++++++++++++++++++++++++++++++++++++++ dll/shellext/zipfldr/zipfldr.rc | 3 ++ 2 files changed, 74 insertions(+) diff --git a/dll/shellext/zipfldr/lang/sv-SE.rc b/dll/shellext/zipfldr/lang/sv-SE.rc new file mode 100644 index 0000000000..2b35afce03 --- /dev/null +++ b/dll/shellext/zipfldr/lang/sv-SE.rc @@ -0,0 +1,71 @@ +/* + * PROJECT: ReactOS Zip Shell Extension + * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+
) + * PURPOSE: Swedish resource translation + * COPYRIGHT: Copyright 2018 Andreas Bjerkeholt (andreas.bjerkeholt(a)reactos.org) + */ + +LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL + +IDD_PROPPAGEDESTINATION DIALOGEX 0, 0, 235, 156 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Välj ett mål" +FONT 8, "MS Shell Dlg", 400, 0, 0x0 +BEGIN + LTEXT "Välj målkatalog",IDC_STATIC,6,12,174,8 + EDITTEXT IDC_DIRECTORY,6,24,222,12,ES_AUTOHSCROLL + PUSHBUTTON "Bläddra...",IDC_BROWSE,174,42,54,14 + PUSHBUTTON "Lösenord",IDC_PASSWORD,174,66,54,14 + LTEXT "Extraherar...",IDC_STATIC,6,114,42,8 + CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,6,126,222,6 +END + +IDD_PROPPAGECOMPLETE DIALOGEX 0, 0, 235, 156 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Extraheringen är slutförd" +FONT 8, "MS Shell Dlg", 400, 0, 0x0 +BEGIN + LTEXT "Filerna har extraherats till följande katalog:",IDC_STATIC,6,12,222,18 + LTEXT "Målkatalog",IDC_DESTDIR,6,36,222,8 + CONTROL "Visa extraherade filer",IDC_SHOW_EXTRACTED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,66,81,10 + LTEXT "Tryck på slutför för att fortsätta.",IDC_STATIC,6,84,174,8 +END + +IDD_CONFIRM_FILE_REPLACE DIALOGEX 0, 0, 273, 56 +STYLE DS_MODALFRAME | DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Bekräfta filersättning" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "&Ja",IDYES,6,36,62,14 + PUSHBUTTON "Avbryt",IDCANCEL,204,36,62,14 + PUSHBUTTON "Ja &till alla",IDYESALL,72,36,62,14 + PUSHBUTTON "&Nej",IDNO,138,36,62,14 + ICON "",IDC_EXCLAMATION_ICON,6,6,24,22 + LTEXT "",IDC_MESSAGE,36,6,228,24 +END + +STRINGTABLE +BEGIN + IDS_COL_NAME "Namn" + IDS_COL_TYPE "Typ" + IDS_COL_COMPRSIZE "Komprimerad storlek" + IDS_COL_PASSWORD "Lösenord" + IDS_COL_SIZE "Storlek" + IDS_COL_RATIO "Kvot" + IDS_COL_DATE_MOD "Ändrad den" + IDS_YES "Ja" + IDS_NO "Nej" + + IDS_WIZ_TITLE "Extraheringsguiden" + IDS_WIZ_DEST_TITLE "Välj ett mål" + IDS_WIZ_DEST_SUBTITLE "Filerna från zip-arkivet kommer att extraheras till den valda platsen." + IDS_WIZ_COMPL_TITLE "Extraheringen är slutförd" + IDS_WIZ_COMPL_SUBTITLE "Filerna från zip-arkivet har extraherats." + IDS_WIZ_BROWSE_TITLE "Välj plats där du vill extrahera de valda objekten." + + IDS_OVERWRITEFILE_TEXT "Den här mappen innehåller redan en fil med namnet '%1'.\nVill du ersätta den?" + + IDS_MENUITEM "Extrahera &alla..." + IDS_HELPTEXT "Extraherar mappinnehållet" + IDS_FRIENDLYNAME "Komprimerad (zippad) mapp" +END diff --git a/dll/shellext/zipfldr/zipfldr.rc b/dll/shellext/zipfldr/zipfldr.rc index 21f2a4ed70..936c591d5f 100644 --- a/dll/shellext/zipfldr/zipfldr.rc +++ b/dll/shellext/zipfldr/zipfldr.rc @@ -43,6 +43,9 @@ IDR_ZIPFLDR REGISTRY "res/zipfldr.rgs" #ifdef LANGUAGE_RU_RU #include "lang/ru-RU.rc" #endif +#ifdef LANGUAGE_SV_SE + #include "lang/sv-SE.rc" +#endif #ifdef LANGUAGE_ZH_CN #include "lang/zh-CN.rc" #endif
6 years, 4 months
1
0
0
0
01/01: [USETUP] Implement CreateProgressBarEx() (#791)
by Bișoc George
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ee6bc66318a3da67b57f2…
commit ee6bc66318a3da67b57f2f42efd921aa9d938cdd Author: Bișoc George <fraizeraust99(a)gmail.com> AuthorDate: Tue Aug 21 15:49:54 2018 +0200 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Tue Aug 21 15:49:54 2018 +0200 [USETUP] Implement CreateProgressBarEx() (#791) Improve the progress bar functions: - Add a member in the struct, which will be used as a bar colour parameter for the new CreateProgressBarEx(). - CreateProgressBar() which will now invoke the Ex variant without the additional parameter. --- base/setup/usetup/progress.c | 25 +++++++++++++++++++++++-- base/setup/usetup/progress.h | 13 +++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/base/setup/usetup/progress.c b/base/setup/usetup/progress.c index 3aa9e2a99e..71f9ae99df 100644 --- a/base/setup/usetup/progress.c +++ b/base/setup/usetup/progress.c @@ -219,7 +219,7 @@ DrawProgressBar( for (coPos.Y = Bar->Top + 2; coPos.Y <= Bar->Bottom - 1; coPos.Y++) { FillConsoleOutputAttribute(StdOutput, - FOREGROUND_YELLOW | BACKGROUND_BLUE, + Bar->ProgressColour, Bar->Width - 2, coPos, &Written); @@ -234,7 +234,7 @@ DrawProgressBar( PPROGRESSBAR -CreateProgressBar( +CreateProgressBarEx( SHORT Left, SHORT Top, SHORT Right, @@ -242,6 +242,7 @@ CreateProgressBar( SHORT TextTop, SHORT TextRight, IN BOOLEAN DoubleEdge, + SHORT ProgressColour, CHAR *Text) { PPROGRESSBAR Bar; @@ -259,6 +260,7 @@ CreateProgressBar( Bar->TextTop = TextTop; Bar->TextRight = TextRight; Bar->Double = DoubleEdge; + Bar->ProgressColour = ProgressColour; Bar->Text = Text; Bar->Width = Bar->Right - Bar->Left + 1; @@ -274,6 +276,25 @@ CreateProgressBar( return Bar; } +PPROGRESSBAR +CreateProgressBar( + SHORT Left, + SHORT Top, + SHORT Right, + SHORT Bottom, + SHORT TextTop, + SHORT TextRight, + IN BOOLEAN DoubleEdge, + CHAR *Text) +{ + + /* Call the Ex variant of the function */ + return CreateProgressBarEx(Left, Top, Right, Bottom, + TextTop, TextRight, + DoubleEdge, + FOREGROUND_YELLOW | BACKGROUND_BLUE, + Text); +} VOID DestroyProgressBar( diff --git a/base/setup/usetup/progress.h b/base/setup/usetup/progress.h index 4799225e33..ee438e95c2 100644 --- a/base/setup/usetup/progress.h +++ b/base/setup/usetup/progress.h @@ -44,11 +44,24 @@ typedef struct _PROGRESS ULONG CurrentStep; BOOLEAN Double; + SHORT ProgressColour; CHAR *Text; } PROGRESSBAR, *PPROGRESSBAR; /* FUNCTIONS ****************************************************************/ +PPROGRESSBAR +CreateProgressBarEx( + SHORT Left, + SHORT Top, + SHORT Right, + SHORT Bottom, + SHORT TextTop, + SHORT TextRight, + IN BOOLEAN DoubleEdge, + SHORT ProgressColour, + CHAR *Text); + PPROGRESSBAR CreateProgressBar( SHORT Left,
6 years, 4 months
1
0
0
0
01/01: [CMAKE] MSVC_IDE: Enable 'unset(CMAKE_IMPORT_LIBRARY_SUFFIX)'
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=afe5ecb6b7e84a945553b…
commit afe5ecb6b7e84a945553be4430bea124ca39a78b Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr> AuthorDate: Fri May 25 12:59:47 2018 +0200 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 21 15:39:35 2018 +0200 [CMAKE] MSVC_IDE: Enable 'unset(CMAKE_IMPORT_LIBRARY_SUFFIX)' Resolve r67773 "# FIXME: Remove the MSVC_IDE condition when the upcoming RosBE lands.". --- CMakeLists.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44e85661c6..d2e8b861ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,11 +106,8 @@ if(NOT CMAKE_CROSSCOMPILING) endif() else() - # We don't need CMake importlib handling. - # FIXME: Remove the MSVC_IDE condition when the upcoming RosBE lands. - if(NOT MSVC_IDE) - unset(CMAKE_IMPORT_LIBRARY_SUFFIX) - endif() + # We don't need CMake importlib handling. + unset(CMAKE_IMPORT_LIBRARY_SUFFIX) if(NEW_STYLE_BUILD) include(sdk/cmake/host-tools.cmake)
6 years, 4 months
1
0
0
0
01/01: [FONTS] Add Hebrew vector glyphs to Tahoma Bold font (#790)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e58607eaba5955dff1e80…
commit e58607eaba5955dff1e8031289c4bad993aaf4b0 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Aug 21 22:35:52 2018 +0900 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Tue Aug 21 15:35:52 2018 +0200 [FONTS] Add Hebrew vector glyphs to Tahoma Bold font (#790) Bitmap glyphs are not added. CORE-14943 --- media/fonts/tahomabd.ttf | Bin 184696 -> 182136 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/media/fonts/tahomabd.ttf b/media/fonts/tahomabd.ttf index 651e09ce7a..5b059e9c35 100644 Binary files a/media/fonts/tahomabd.ttf and b/media/fonts/tahomabd.ttf differ
6 years, 4 months
1
0
0
0
01/01: [FONTS] Add Hebrew vector glyphs to Tahoma font (#789)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b80171e5d38022542fc93…
commit b80171e5d38022542fc93089f91b147e6f329d99 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Aug 21 22:35:18 2018 +0900 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Tue Aug 21 15:35:18 2018 +0200 [FONTS] Add Hebrew vector glyphs to Tahoma font (#789) Bitmap glyphs are not added. CORE-14943 --- media/fonts/tahoma.ttf | Bin 143884 -> 150204 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/media/fonts/tahoma.ttf b/media/fonts/tahoma.ttf index 8bee8ad35c..0645228943 100644 Binary files a/media/fonts/tahoma.ttf and b/media/fonts/tahoma.ttf differ
6 years, 4 months
1
0
0
0
01/01: [MSHTML] Fix 3 MSVC warnings about HTML*Element_handle_event()
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=990e7dfd1ac05ed1a2245…
commit 990e7dfd1ac05ed1a224578daf2f64508cbe0e10 Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr> AuthorDate: Wed Jul 18 15:00:22 2018 +0200 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 21 14:33:52 2018 +0200 [MSHTML] Fix 3 MSVC warnings about HTML*Element_handle_event() - "...\htmlanchor.c(769) : warning C4028: formal parameter 2 different from declaration" - "...\htmlarea.c(427) : warning C4028: formal parameter 2 different from declaration" - "...\htmlform.c(757) : warning C4028: formal parameter 2 different from declaration" Cherry-pick Jacek Caban
https://source.winehq.org/git/wine.git/commit/a660f673cb7d6d04e0f2a9a98cff4…
CORE-7538 --- dll/win32/mshtml/htmlanchor.c | 2 +- dll/win32/mshtml/htmlarea.c | 2 +- dll/win32/mshtml/htmlform.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dll/win32/mshtml/htmlanchor.c b/dll/win32/mshtml/htmlanchor.c index 32e57098b6..b2a66540c4 100644 --- a/dll/win32/mshtml/htmlanchor.c +++ b/dll/win32/mshtml/htmlanchor.c @@ -710,7 +710,7 @@ static HRESULT HTMLAnchorElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) return HTMLElement_QI(&This->element.node, riid, ppv); } -static HRESULT HTMLAnchorElement_handle_event(HTMLDOMNode *iface, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default) +static HRESULT HTMLAnchorElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default) { HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface); nsAString href_str, target_str; diff --git a/dll/win32/mshtml/htmlarea.c b/dll/win32/mshtml/htmlarea.c index a70c487450..968222e618 100644 --- a/dll/win32/mshtml/htmlarea.c +++ b/dll/win32/mshtml/htmlarea.c @@ -388,7 +388,7 @@ static HRESULT HTMLAreaElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) return S_OK; } -static HRESULT HTMLAreaElement_handle_event(HTMLDOMNode *iface, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default) +static HRESULT HTMLAreaElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default) { HTMLAreaElement *This = impl_from_HTMLDOMNode(iface); nsAString href_str, target_str; diff --git a/dll/win32/mshtml/htmlform.c b/dll/win32/mshtml/htmlform.c index 12062b0e73..21807d2e47 100644 --- a/dll/win32/mshtml/htmlform.c +++ b/dll/win32/mshtml/htmlform.c @@ -717,7 +717,7 @@ static HRESULT HTMLFormElement_invoke(HTMLDOMNode *iface, return S_OK; } -static HRESULT HTMLFormElement_handle_event(HTMLDOMNode *iface, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default) +static HRESULT HTMLFormElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default) { HTMLFormElement *This = impl_from_HTMLDOMNode(iface);
6 years, 4 months
1
0
0
0
01/01: [CMD] Add missing memory allocation NULL checks (#161). CORE-8304
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3f892a8d6be415cdc9ff4…
commit 3f892a8d6be415cdc9ff4fda29baae3dbf8d3790 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sun Dec 3 18:49:41 2017 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Tue Aug 21 14:02:24 2018 +0200 [CMD] Add missing memory allocation NULL checks (#161). CORE-8304 Adapted from a patch by Jacob S. Preciado. Bring also the code suggestions emitted during review. --- base/shell/cmd/alias.c | 4 ++ base/shell/cmd/assoc.c | 77 +++++++++++-------------- base/shell/cmd/batch.c | 19 ++++-- base/shell/cmd/batch.h | 10 ++-- base/shell/cmd/cmd.h | 4 +- base/shell/cmd/cmdinput.c | 8 +-- base/shell/cmd/dir.c | 8 +-- base/shell/cmd/dirstack.c | 3 +- base/shell/cmd/for.c | 8 ++- base/shell/cmd/history.c | 102 ++++++++++++++++++++++---------- base/shell/cmd/misc.c | 22 +++++-- base/shell/cmd/parser.c | 144 ++++++++++++++++++++++++++++++++-------------- base/shell/cmd/path.c | 9 ++- base/shell/cmd/setlocal.c | 1 + base/shell/cmd/start.c | 3 +- base/shell/cmd/where.c | 18 +++++- 16 files changed, 293 insertions(+), 147 deletions(-) diff --git a/base/shell/cmd/alias.c b/base/shell/cmd/alias.c index ac5129aef9..52783e5970 100644 --- a/base/shell/cmd/alias.c +++ b/base/shell/cmd/alias.c @@ -64,7 +64,10 @@ PrintAlias (VOID) /* allocate memory for an extra \0 char to make parsing easier */ ptr = cmd_alloc(len + sizeof(TCHAR)); if (!ptr) + { + WARN("Cannot allocate memory for ptr!\n"); return; + } Aliases = ptr; @@ -107,6 +110,7 @@ VOID ExpandAlias (LPTSTR cmd, INT maxlen) buffer = cmd_alloc(maxlen); if (!buffer) { + WARN("Cannot allocate memory for alias buffer!\n"); cmd_free(tmp); return; } diff --git a/base/shell/cmd/assoc.c b/base/shell/cmd/assoc.c index 8e3e5fc959..0e3d6f18f9 100644 --- a/base/shell/cmd/assoc.c +++ b/base/shell/cmd/assoc.c @@ -33,44 +33,40 @@ PrintAssociation(LPTSTR extension) return_val = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Classes"), 0, KEY_READ, &hKey); if (return_val != ERROR_SUCCESS) - { - RegCloseKey(hKey); return -1; - } return_val = RegOpenKeyEx(hKey, extension, 0, KEY_READ, &hInsideKey); + RegCloseKey(hKey); if (return_val != ERROR_SUCCESS) - { - RegCloseKey(hKey); - RegCloseKey(hInsideKey); return 0; - } /* obtain string length */ return_val = RegQueryValueEx(hInsideKey, NULL, NULL, NULL, NULL, &fileTypeLength); - if (return_val == ERROR_FILE_NOT_FOUND) /* no default value, don't display */ + if (return_val == ERROR_FILE_NOT_FOUND) /* no default value, don't display */ { RegCloseKey(hInsideKey); - RegCloseKey(hKey); return 0; } if (return_val != ERROR_SUCCESS) { RegCloseKey(hInsideKey); - RegCloseKey(hKey); return -2; } fileType = cmd_alloc(fileTypeLength * sizeof(TCHAR)); + if (!fileType) + { + WARN("Cannot allocate memory for fileType!\n"); + RegCloseKey(hInsideKey); + return -2; + } /* obtain actual file type */ - return_val = RegQueryValueEx(hInsideKey, NULL, NULL, NULL, (LPBYTE) fileType, &fileTypeLength); - + return_val = RegQueryValueEx(hInsideKey, NULL, NULL, NULL, (LPBYTE)fileType, &fileTypeLength); RegCloseKey(hInsideKey); - RegCloseKey(hKey); if (return_val != ERROR_SUCCESS) { @@ -78,19 +74,17 @@ PrintAssociation(LPTSTR extension) return -2; } - if (fileTypeLength != 0) /* if there is a default key, display relevant information */ + if (fileTypeLength != 0) /* if there is a default key, display relevant information */ { ConOutPrintf(_T("%s=%s\n"), extension, fileType); } - if (fileTypeLength) - cmd_free(fileType); - + cmd_free(fileType); return 1; } static INT -PrintAllAssociations() +PrintAllAssociations(VOID) { DWORD return_val = 0; HKEY hKey = NULL; @@ -103,10 +97,7 @@ PrintAllAssociations() return_val = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Classes"), 0, KEY_READ, &hKey); if (return_val != ERROR_SUCCESS) - { - RegCloseKey(hKey); return -1; - } return_val = RegQueryInfoKey(hKey, NULL, NULL, NULL, &numKeys, &extLength, NULL, NULL, NULL, NULL, NULL, NULL); @@ -118,8 +109,14 @@ PrintAllAssociations() extLength++; extName = cmd_alloc(extLength * sizeof(TCHAR)); + if (!extName) + { + WARN("Cannot allocate memory for extName!\n"); + RegCloseKey(hKey); + return -2; + } - for(keyCtr = 0; keyCtr < numKeys; keyCtr++) + for (keyCtr = 0; keyCtr < numKeys; keyCtr++) { DWORD buffer_size = extLength; return_val = RegEnumKeyEx(hKey, keyCtr, extName, &buffer_size, NULL, NULL, NULL, NULL); @@ -139,9 +136,7 @@ PrintAllAssociations() RegCloseKey(hKey); - if (extName) - cmd_free(extName); - + cmd_free(extName); return numKeys; } @@ -157,28 +152,20 @@ AddAssociation(LPTSTR extension, LPTSTR type) return -1; return_val = RegCreateKeyEx(hKey, extension, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &insideKey, NULL); + RegCloseKey(hKey); if (return_val != ERROR_SUCCESS) - { - RegCloseKey(hKey); return -1; - } return_val = RegSetValueEx(insideKey, NULL, 0, REG_SZ, (LPBYTE)type, (_tcslen(type) + 1) * sizeof(TCHAR)); + RegCloseKey(insideKey); if (return_val != ERROR_SUCCESS) - { - RegCloseKey(insideKey); - RegCloseKey(hKey); return -2; - } - RegCloseKey(insideKey); - RegCloseKey(hKey); return 0; } - static int RemoveAssociation(LPTSTR extension) { @@ -191,19 +178,15 @@ RemoveAssociation(LPTSTR extension) return -1; return_val = RegDeleteKey(hKey, extension); + RegCloseKey(hKey); if (return_val != ERROR_SUCCESS) - { - RegCloseKey(hKey); return -2; - } - RegCloseKey(hKey); return 0; } - INT CommandAssoc (LPTSTR param) { /* print help */ @@ -216,7 +199,9 @@ INT CommandAssoc (LPTSTR param) nErrorLevel = 0; if (_tcslen(param) == 0) + { PrintAllAssociations(); + } else { LPTSTR lpEqualSign = _tcschr(param, _T('=')); @@ -224,9 +209,15 @@ INT CommandAssoc (LPTSTR param) { LPTSTR fileType = lpEqualSign + 1; LPTSTR extension = cmd_alloc((lpEqualSign - param + 1) * sizeof(TCHAR)); + if (!extension) + { + WARN("Cannot allocate memory for extension!\n"); + error_out_of_memory(); + return 1; + } _tcsncpy(extension, param, lpEqualSign - param); - extension[lpEqualSign - param] = (TCHAR)0; + extension[lpEqualSign - param] = _T('\0'); if (_tcslen(fileType) == 0) /* if the equal sign is the last character @@ -237,7 +228,7 @@ INT CommandAssoc (LPTSTR param) else /* otherwise, add the key and print out the association*/ { - AddAssociation( extension, fileType); + AddAssociation(extension, fileType); PrintAssociation(extension); } @@ -248,7 +239,7 @@ INT CommandAssoc (LPTSTR param) /* no equal sign, print all associations */ INT retval = PrintAssociation(param); - if (retval == 0) /* if nothing printed out */ + if (retval == 0) /* if nothing printed out */ ConOutResPrintf(STRING_ASSOC_ERROR, param); } } diff --git a/base/shell/cmd/batch.c b/base/shell/cmd/batch.c index 148943a990..3c384e279a 100644 --- a/base/shell/cmd/batch.c +++ b/base/shell/cmd/batch.c @@ -110,13 +110,14 @@ LPTSTR FindArg(TCHAR Char, BOOL *IsParam0) * */ -LPTSTR BatchParams (LPTSTR s1, LPTSTR s2) +LPTSTR BatchParams(LPTSTR s1, LPTSTR s2) { LPTSTR dp = (LPTSTR)cmd_alloc ((_tcslen(s1) + _tcslen(s2) + 3) * sizeof (TCHAR)); /* JPP 20-Jul-1998 added error checking */ if (dp == NULL) { + WARN("Cannot allocate memory for dp!\n"); error_out_of_memory(); return NULL; } @@ -158,7 +159,7 @@ LPTSTR BatchParams (LPTSTR s1, LPTSTR s2) /* * free the allocated memory of a batch file */ -VOID ClearBatch() +VOID ClearBatch(VOID) { TRACE ("ClearBatch mem = %08x free = %d\n", bc->mem, bc->memfree); @@ -182,7 +183,7 @@ VOID ClearBatch() * message */ -VOID ExitBatch() +VOID ExitBatch(VOID) { ClearBatch(); @@ -234,7 +235,7 @@ void BatchFile2Mem(HANDLE hBatchFile) * The firstword parameter is the full filename of the batch file. * */ -INT Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param, PARSED_COMMAND *Cmd) +INT Batch(LPTSTR fullname, LPTSTR firstword, LPTSTR param, PARSED_COMMAND *Cmd) { BATCH_CONTEXT new; LPFOR_CONTEXT saved_fc; @@ -396,12 +397,18 @@ VOID AddBatchRedirection(REDIRECTION **RedirList) * Read a single line from the batch file from the current batch/memory position. * Almost a copy of FileGetString with same UNICODE handling */ -BOOL BatchGetString (LPTSTR lpBuffer, INT nBufferLength) +BOOL BatchGetString(LPTSTR lpBuffer, INT nBufferLength) { LPSTR lpString; INT len = 0; #ifdef _UNICODE lpString = cmd_alloc(nBufferLength); + if (!lpString) + { + WARN("Cannot allocate memory for lpString\n"); + error_out_of_memory(); + return FALSE; + } #else lpString = lpBuffer; #endif @@ -443,7 +450,7 @@ BOOL BatchGetString (LPTSTR lpBuffer, INT nBufferLength) * * Set eflag to 0 if line is not to be echoed else 1 */ -LPTSTR ReadBatchLine () +LPTSTR ReadBatchLine(VOID) { TRACE ("ReadBatchLine ()\n"); diff --git a/base/shell/cmd/batch.h b/base/shell/cmd/batch.h index 53d1903f4d..8315e4ca8e 100644 --- a/base/shell/cmd/batch.h +++ b/base/shell/cmd/batch.h @@ -45,10 +45,10 @@ extern BOOL bEcho; /* The echo flag */ extern TCHAR textline[BATCH_BUFFSIZE]; /* Buffer for reading Batch file lines */ -LPTSTR FindArg (TCHAR, BOOL *); -LPTSTR BatchParams (LPTSTR, LPTSTR); -VOID ExitBatch (VOID); -INT Batch (LPTSTR, LPTSTR, LPTSTR, PARSED_COMMAND *); -BOOL BatchGetString (LPTSTR lpBuffer, INT nBufferLength); +LPTSTR FindArg(TCHAR, BOOL *); +LPTSTR BatchParams(LPTSTR, LPTSTR); +VOID ExitBatch(VOID); +INT Batch(LPTSTR, LPTSTR, LPTSTR, PARSED_COMMAND *); +BOOL BatchGetString(LPTSTR lpBuffer, INT nBufferLength); LPTSTR ReadBatchLine(VOID); VOID AddBatchRedirection(REDIRECTION **); diff --git a/base/shell/cmd/cmd.h b/base/shell/cmd/cmd.h index 6a2f680a68..69a769ee7c 100644 --- a/base/shell/cmd/cmd.h +++ b/base/shell/cmd/cmd.h @@ -214,12 +214,12 @@ INT cmd_goto (LPTSTR); /* Prototypes for HISTORY.C */ #ifdef FEATURE_HISTORY LPCTSTR PeekHistory(INT); -VOID History (INT, LPTSTR);/*add entries browse history*/ +VOID History(INT, LPTSTR);/*add entries browse history*/ VOID History_move_to_bottom(VOID);/*F3*/ VOID InitHistory(VOID); VOID CleanHistory(VOID); VOID History_del_current_entry(LPTSTR str);/*CTRL-D*/ -INT CommandHistory (LPTSTR param); +INT CommandHistory(LPTSTR param); #endif /* Prototypes for IF.C */ diff --git a/base/shell/cmd/cmdinput.c b/base/shell/cmd/cmdinput.c index 481a04350d..061b910179 100644 --- a/base/shell/cmd/cmdinput.c +++ b/base/shell/cmd/cmdinput.c @@ -245,7 +245,7 @@ BOOL ReadCommand(LPTSTR str, INT maxlen) #ifdef FEATURE_HISTORY /* add to the history */ if (str[0]) - History (0, str); + History(0, str); #endif /*FEATURE_HISTORY*/ str[charcount++] = _T('\n'); str[charcount] = _T('\0'); @@ -479,7 +479,7 @@ BOOL ReadCommand(LPTSTR str, INT maxlen) #ifdef FEATURE_HISTORY /* add to the history */ if (str[0]) - History (0, str); + History(0, str); #endif str[charcount++] = _T('\n'); str[charcount] = _T('\0'); @@ -503,7 +503,7 @@ BOOL ReadCommand(LPTSTR str, INT maxlen) #ifdef FEATURE_HISTORY /* get previous command from buffer */ ClearCommandLine (str, maxlen, orgx, orgy); - History (-1, str); + History(-1, str); current = charcount = _tcslen (str); if (((charcount + orgx) / maxx) + orgy > maxy - 1) orgy += maxy - ((charcount + orgx) / maxx + orgy + 1); @@ -516,7 +516,7 @@ BOOL ReadCommand(LPTSTR str, INT maxlen) #ifdef FEATURE_HISTORY /* get next command from buffer */ ClearCommandLine (str, maxlen, orgx, orgy); - History (1, str); + History(1, str); current = charcount = _tcslen (str); if (((charcount + orgx) / maxx) + orgy > maxy - 1) orgy += maxy - ((charcount + orgx) / maxx + orgy + 1); diff --git a/base/shell/cmd/dir.c b/base/shell/cmd/dir.c index b59bf6c6c6..e6c2f86911 100644 --- a/base/shell/cmd/dir.c +++ b/base/shell/cmd/dir.c @@ -1390,7 +1390,7 @@ DirList(IN OUT LPTSTR szFullPath, /* [IN] The full path we are listing with tr ptrStartNode = cmd_alloc(sizeof(DIRFINDLISTNODE)); if (ptrStartNode == NULL) { - WARN("DEBUG: Cannot allocate memory for ptrStartNode!\n"); + WARN("Cannot allocate memory for ptrStartNode!\n"); return 1; /* Error cannot allocate memory for 1st object */ } ptrStartNode->stInfo.ptrHead = NULL; @@ -1408,7 +1408,7 @@ DirList(IN OUT LPTSTR szFullPath, /* [IN] The full path we are listing with tr ptrNextNode->ptrNext = cmd_alloc(sizeof(DIRFINDLISTNODE)); if (ptrNextNode->ptrNext == NULL) { - WARN("DEBUG: Cannot allocate memory for ptrNextNode->ptrNext!\n"); + WARN("Cannot allocate memory for ptrNextNode->ptrNext!\n"); DirNodeCleanup(ptrStartNode, &dwCount); FindClose(hSearch); return 1; @@ -1458,7 +1458,7 @@ DirList(IN OUT LPTSTR szFullPath, /* [IN] The full path we are listing with tr *ptrCurNode = cmd_alloc(sizeof(DIRFINDSTREAMNODE)); if (*ptrCurNode == NULL) { - WARN("DEBUG: Cannot allocate memory for *ptrCurNode!\n"); + WARN("Cannot allocate memory for *ptrCurNode!\n"); DirNodeCleanup(ptrStartNode, &dwCount); FindClose(hStreams); FindClose(hSearch); @@ -1512,7 +1512,7 @@ DirList(IN OUT LPTSTR szFullPath, /* [IN] The full path we are listing with tr ptrFileArray = cmd_alloc(sizeof(PDIRFINDINFO) * dwCount); if (ptrFileArray == NULL) { - WARN("DEBUG: Cannot allocate memory for ptrFileArray!\n"); + WARN("Cannot allocate memory for ptrFileArray!\n"); DirNodeCleanup(ptrStartNode, &dwCount); return 1; } diff --git a/base/shell/cmd/dirstack.c b/base/shell/cmd/dirstack.c index 9b749b62f0..c1820d87c7 100644 --- a/base/shell/cmd/dirstack.c +++ b/base/shell/cmd/dirstack.c @@ -37,7 +37,8 @@ PushDirectory (LPTSTR pszPath) LPDIRENTRY lpDir = cmd_alloc(FIELD_OFFSET(DIRENTRY, szPath[_tcslen(pszPath) + 1])); if (!lpDir) { - error_out_of_memory (); + WARN("Cannot allocate memory for lpDir\n"); + error_out_of_memory(); return -1; } diff --git a/base/shell/cmd/for.c b/base/shell/cmd/for.c index e410b23a0b..b8628145d4 100644 --- a/base/shell/cmd/for.c +++ b/base/shell/cmd/for.c @@ -96,9 +96,13 @@ static LPTSTR ReadFileContents(FILE *InputFile, TCHAR *Buffer) { SIZE_T Len = 0; SIZE_T AllocLen = 1000; + LPTSTR Contents = cmd_alloc(AllocLen * sizeof(TCHAR)); if (!Contents) + { + WARN("Cannot allocate memory for Contents!\n"); return NULL; + } while (_fgetts(Buffer, CMDLINE_LENGTH, InputFile)) { @@ -109,6 +113,7 @@ static LPTSTR ReadFileContents(FILE *InputFile, TCHAR *Buffer) Contents = cmd_realloc(Contents, (AllocLen *= 2) * sizeof(TCHAR)); if (!Contents) { + WARN("Cannot reallocate memory for Contents!\n"); cmd_free(OldContents); return NULL; } @@ -454,7 +459,7 @@ static INT ForRecursive(PARSED_COMMAND *Cmd, LPTSTR List, TCHAR *Buffer, TCHAR * return Ret; } -BOOL +INT ExecuteFor(PARSED_COMMAND *Cmd) { TCHAR Buffer[CMDLINE_LENGTH]; /* Buffer to hold the variable value */ @@ -470,6 +475,7 @@ ExecuteFor(PARSED_COMMAND *Cmd) lpNew = cmd_alloc(sizeof(FOR_CONTEXT)); if (!lpNew) { + WARN("Cannot allocate memory for lpNew!\n"); cmd_free(List); return 1; } diff --git a/base/shell/cmd/history.c b/base/shell/cmd/history.c index f9354c2296..e6676a7ffd 100644 --- a/base/shell/cmd/history.c +++ b/base/shell/cmd/history.c @@ -48,16 +48,16 @@ typedef struct tagHISTORY LPTSTR string; } HIST_ENTRY, * LPHIST_ENTRY; -static INT size, max_size=100; +static INT size, max_size = 100; -static LPHIST_ENTRY Top; -static LPHIST_ENTRY Bottom; +static LPHIST_ENTRY Top = NULL; +static LPHIST_ENTRY Bottom = NULL; -static LPHIST_ENTRY curr_ptr=0; +static LPHIST_ENTRY curr_ptr = NULL; VOID InitHistory(VOID); VOID History_move_to_bottom(VOID); -VOID History (INT dir, LPTSTR commandline); +VOID History(INT dir, LPTSTR commandline); VOID CleanHistory(VOID); VOID History_del_current_entry(LPTSTR str); @@ -68,7 +68,7 @@ static VOID add_at_bottom(LPTSTR string); VOID set_size(INT new_size); -INT CommandHistory (LPTSTR param) +INT CommandHistory(LPTSTR param) { LPTSTR tmp; INT tmp_int; @@ -120,6 +120,8 @@ INT CommandHistory (LPTSTR param) VOID set_size(INT new_size) { + ASSERT(Top && Bottom); + while (new_size<size) del(Top->prev); @@ -129,10 +131,22 @@ VOID set_size(INT new_size) VOID InitHistory(VOID) { - size=0; + size = 0; Top = cmd_alloc(sizeof(HIST_ENTRY)); + if (!Top) + { + WARN("Cannot allocate memory for Top!\n"); + return; + } Bottom = cmd_alloc(sizeof(HIST_ENTRY)); + if (!Bottom) + { + WARN("Cannot allocate memory for Bottom!\n"); + cmd_free(Top); + Top = NULL; + return; + } Top->prev = Bottom; Top->next = NULL; @@ -142,13 +156,15 @@ VOID InitHistory(VOID) Bottom->next = Top; Bottom->string = NULL; - curr_ptr=Bottom; + curr_ptr = Bottom; } VOID CleanHistory(VOID) { - while (Bottom->next!=Top) + ASSERT(Top && Bottom); + + while (Bottom->next != Top) del(Bottom->next); cmd_free(Top); @@ -160,14 +176,16 @@ VOID History_del_current_entry(LPTSTR str) { LPHIST_ENTRY tmp; + ASSERT(Top && Bottom); + if (size == 0) return; if (curr_ptr == Bottom) - curr_ptr=Bottom->next; + curr_ptr = Bottom->next; if (curr_ptr == Top) - curr_ptr=Top->prev; + curr_ptr = Top->prev; tmp = curr_ptr; @@ -180,6 +198,8 @@ VOID History_del_current_entry(LPTSTR str) static VOID del(LPHIST_ENTRY item) { + ASSERT(Top && Bottom); + if (item==NULL || item==Top || item==Bottom) { TRACE ("del in " __FILE__ ": returning\n" @@ -206,8 +226,10 @@ VOID add_at_bottom(LPTSTR string) { LPHIST_ENTRY tmp; + ASSERT(Top && Bottom); + /*delete first entry if maximum number of entries is reached*/ - while(size>=max_size) + while (size>=max_size) del(Top->prev); while (_istspace(*string)) @@ -218,23 +240,37 @@ VOID add_at_bottom(LPTSTR string) /*if new entry is the same than the last do not add it*/ if (size) + { if (_tcscmp(string,Bottom->next->string)==0) return; + } + + /*create new empty Bottom*/ + tmp = cmd_alloc(sizeof(HIST_ENTRY)); + if (!tmp) + { + WARN("Cannot allocate memory for new Bottom!\n"); + return; + } - /*fill bottom with string, it will become Bottom->next*/ - Bottom->string=cmd_alloc((_tcslen(string)+1)*sizeof(TCHAR)); + /*fill old bottom with string, it will become new Bottom->next*/ + Bottom->string = cmd_alloc((_tcslen(string)+1)*sizeof(TCHAR)); + if (!Bottom->string) + { + WARN("Cannot allocate memory for Bottom->string!\n"); + cmd_free(tmp); + return; + } _tcscpy(Bottom->string,string); - /*save Bottom value*/ - tmp=Bottom; + tmp->next = Bottom; + tmp->prev = NULL; + tmp->string = NULL; - /*create new void Bottom*/ - Bottom=cmd_alloc(sizeof(HIST_ENTRY)); - Bottom->next=tmp; - Bottom->prev=NULL; - Bottom->string=NULL; + Bottom->prev = tmp; - tmp->prev=Bottom; + /*save the new Bottom value*/ + Bottom = tmp; /*set new size*/ size++; @@ -243,13 +279,17 @@ VOID add_at_bottom(LPTSTR string) VOID History_move_to_bottom(VOID) { - curr_ptr=Bottom; + ASSERT(Top && Bottom); + + curr_ptr = Bottom; } LPCTSTR PeekHistory(INT dir) { LPHIST_ENTRY entry = curr_ptr; + ASSERT(Top && Bottom); + if (dir == 0) return NULL; @@ -283,12 +323,14 @@ LPCTSTR PeekHistory(INT dir) return entry->string; } -VOID History (INT dir, LPTSTR commandline) +VOID History(INT dir, LPTSTR commandline) { + ASSERT(Top && Bottom); + if (dir==0) { add_at_bottom(commandline); - curr_ptr=Bottom; + curr_ptr = Bottom; return; } @@ -303,9 +345,9 @@ VOID History (INT dir, LPTSTR commandline) if (curr_ptr->next==Top || curr_ptr==Top) { #ifdef WRAP_HISTORY - curr_ptr=Bottom; + curr_ptr = Bottom; #else - curr_ptr=Top; + curr_ptr = Top; commandline[0]=_T('\0'); return; #endif @@ -321,15 +363,15 @@ VOID History (INT dir, LPTSTR commandline) if (curr_ptr->prev==Bottom || curr_ptr==Bottom) { #ifdef WRAP_HISTORY - curr_ptr=Top; + curr_ptr = Top; #else - curr_ptr=Bottom; + curr_ptr = Bottom; commandline[0]=_T('\0'); return; #endif } - curr_ptr=curr_ptr->prev; + curr_ptr = curr_ptr->prev; if (curr_ptr->string) _tcscpy(commandline,curr_ptr->string); } diff --git a/base/shell/cmd/misc.c b/base/shell/cmd/misc.c index a6d2f54559..bcefe21500 100644 --- a/base/shell/cmd/misc.c +++ b/base/shell/cmd/misc.c @@ -188,18 +188,20 @@ BOOL add_entry (LPINT ac, LPTSTR **arg, LPCTSTR entry) LPTSTR *oldarg; q = cmd_alloc ((_tcslen(entry) + 1) * sizeof (TCHAR)); - if (NULL == q) + if (!q) { + WARN("Cannot allocate memory for q!\n"); return FALSE; } _tcscpy (q, entry); oldarg = *arg; *arg = cmd_realloc (oldarg, (*ac + 2) * sizeof (LPTSTR)); - if (NULL == *arg) + if (!*arg) { - cmd_free (q); + WARN("Cannot reallocate memory for arg!\n"); *arg = oldarg; + cmd_free (q); return FALSE; } @@ -222,8 +224,9 @@ static BOOL expand (LPINT ac, LPTSTR **arg, LPCTSTR pattern) if (NULL != pathend) { dirpart = cmd_alloc((pathend - pattern + 2) * sizeof(TCHAR)); - if (NULL == dirpart) + if (!dirpart) { + WARN("Cannot allocate memory for dirpart!\n"); return FALSE; } memcpy(dirpart, pattern, pathend - pattern + 1); @@ -241,8 +244,9 @@ static BOOL expand (LPINT ac, LPTSTR **arg, LPCTSTR pattern) if (NULL != dirpart) { fullname = cmd_alloc((_tcslen(dirpart) + _tcslen(FindData.cFileName) + 1) * sizeof(TCHAR)); - if (NULL == fullname) + if (!fullname) { + WARN("Cannot allocate memory for fullname!\n"); ok = FALSE; } else @@ -286,7 +290,10 @@ LPTSTR *split (LPTSTR s, LPINT args, BOOL expand_wildcards, BOOL handle_plus) arg = cmd_alloc (sizeof (LPTSTR)); if (!arg) + { + WARN("Cannot allocate memory for arg!\n"); return NULL; + } *arg = NULL; ac = 0; @@ -333,6 +340,7 @@ LPTSTR *split (LPTSTR s, LPINT args, BOOL expand_wildcards, BOOL handle_plus) q = cmd_alloc (((len = s - start) + 1) * sizeof (TCHAR)); if (!q) { + WARN("Cannot allocate memory for q!\n"); return NULL; } memcpy (q, start, len * sizeof (TCHAR)); @@ -381,7 +389,10 @@ LPTSTR *splitspace (LPTSTR s, LPINT args) arg = cmd_alloc (sizeof (LPTSTR)); if (!arg) + { + WARN("Cannot allocate memory for arg!\n"); return NULL; + } *arg = NULL; ac = 0; @@ -409,6 +420,7 @@ LPTSTR *splitspace (LPTSTR s, LPINT args) q = cmd_alloc (((len = s - start) + 1) * sizeof (TCHAR)); if (!q) { + WARN("Cannot allocate memory for q!\n"); return NULL; } memcpy (q, start, len * sizeof (TCHAR)); diff --git a/base/shell/cmd/parser.c b/base/shell/cmd/parser.c index 821ef78d71..cdea54a8f0 100644 --- a/base/shell/cmd/parser.c +++ b/base/shell/cmd/parser.c @@ -60,7 +60,7 @@ static TCHAR ParseChar(void) TCHAR Char; if (bParseError) - return CurChar = 0; + return (CurChar = 0); restart: /* @@ -90,7 +90,7 @@ restart: } } } - return CurChar = Char; + return (CurChar = Char); } static void ParseError(void) @@ -272,6 +272,11 @@ static BOOL ParseRedirection(REDIRECTION **List) } Redir = cmd_alloc(FIELD_OFFSET(REDIRECTION, Filename[_tcslen(Tok) + 1])); + if (!Redir) + { + WARN("Cannot allocate memory for Redir!\n"); + goto fail; + } Redir->Next = NULL; Redir->OldHandle = INVALID_HANDLE_VALUE; Redir->Number = Number; @@ -293,7 +298,15 @@ static PARSED_COMMAND *ParseCommandOp(int OpType); static PARSED_COMMAND *ParseBlock(REDIRECTION *RedirList) { PARSED_COMMAND *Cmd, *Sub, **NextPtr; + Cmd = cmd_alloc(sizeof(PARSED_COMMAND)); + if (!Cmd) + { + WARN("Cannot allocate memory for Cmd!\n"); + ParseError(); + FreeRedirection(RedirList); + return NULL; + } Cmd->Type = C_BLOCK; Cmd->Next = NULL; Cmd->Subcommands = NULL; @@ -340,8 +353,16 @@ static PARSED_COMMAND *ParseBlock(REDIRECTION *RedirList) /* Parse an IF statement */ static PARSED_COMMAND *ParseIf(void) { - PARSED_COMMAND *Cmd = cmd_alloc(sizeof(PARSED_COMMAND)); int Type; + PARSED_COMMAND *Cmd; + + Cmd = cmd_alloc(sizeof(PARSED_COMMAND)); + if (!Cmd) + { + WARN("Cannot allocate memory for Cmd!\n"); + ParseError(); + return NULL; + } memset(Cmd, 0, sizeof(PARSED_COMMAND)); Cmd->Type = C_IF; @@ -432,10 +453,17 @@ condition_done: */ static PARSED_COMMAND *ParseFor(void) { - PARSED_COMMAND *Cmd = cmd_alloc(sizeof(PARSED_COMMAND)); + PARSED_COMMAND *Cmd; TCHAR List[CMDLINE_LENGTH]; TCHAR *Pos = List; + Cmd = cmd_alloc(sizeof(PARSED_COMMAND)); + if (!Cmd) + { + WARN("Cannot allocate memory for Cmd!\n"); + ParseError(); + return NULL; + } memset(Cmd, 0, sizeof(PARSED_COMMAND)); Cmd->Type = C_FOR; @@ -609,6 +637,13 @@ static DECLSPEC_NOINLINE PARSED_COMMAND *ParseCommandPart(REDIRECTION *RedirList *Pos++ = _T('\0'); Cmd = cmd_alloc(FIELD_OFFSET(PARSED_COMMAND, Command.First[Pos - ParsedLine])); + if (!Cmd) + { + WARN("Cannot allocate memory for Cmd!\n"); + ParseError(); + FreeRedirection(RedirList); + return NULL; + } Cmd->Type = C_COMMAND; Cmd->Next = NULL; Cmd->Subcommands = NULL; @@ -647,6 +682,12 @@ static PARSED_COMMAND *ParsePrimary(void) PARSED_COMMAND *Cmd; ParseChar(); Cmd = cmd_alloc(sizeof(PARSED_COMMAND)); + if (!Cmd) + { + WARN("Cannot allocate memory for Cmd!\n"); + ParseError(); + return NULL; + } Cmd->Type = C_QUIET; Cmd->Next = NULL; /* @ acts like a unary operator with low precedence, @@ -702,6 +743,14 @@ static PARSED_COMMAND *ParseCommandOp(int OpType) } Cmd = cmd_alloc(sizeof(PARSED_COMMAND)); + if (!Cmd) + { + WARN("Cannot allocate memory for Cmd!\n"); + ParseError(); + FreeCommand(Left); + FreeCommand(Right); + return NULL; + } Cmd->Type = OpType; Cmd->Next = NULL; Cmd->Redirections = NULL; @@ -840,8 +889,10 @@ EchoCommand(PARSED_COMMAND *Cmd) for (Redir = Cmd->Redirections; Redir; Redir = Redir->Next) { if (SubstituteForVars(Redir->Filename, Buf)) + { ConOutPrintf(_T(" %c%s%s"), _T('0') + Redir->Number, - RedirString[Redir->Mode], Buf); + RedirString[Redir->Mode], Buf); + } } } @@ -862,19 +913,27 @@ Unparse(PARSED_COMMAND *Cmd, TCHAR *Out, TCHAR *OutEnd) * overflowing the supplied buffer, define some helper macros to make * this less painful. */ -#define CHAR(Char) { \ +#define CHAR(Char) \ +do { \ if (Out == OutEnd) return NULL; \ - *Out++ = Char; } -#define STRING(String) { \ + *Out++ = Char; \ +} while (0) +#define STRING(String) \ +do { \ if (Out + _tcslen(String) > OutEnd) return NULL; \ - Out = _stpcpy(Out, String); } -#define PRINTF(Format, ...) { \ + Out = _stpcpy(Out, String); \ +} while (0) +#define PRINTF(Format, ...) \ +do { \ UINT Len = _sntprintf(Out, OutEnd - Out, Format, __VA_ARGS__); \ if (Len > (UINT)(OutEnd - Out)) return NULL; \ - Out += Len; } -#define RECURSE(Subcommand) { \ + Out += Len; \ +} while (0) +#define RECURSE(Subcommand) \ +do { \ Out = Unparse(Subcommand, Out, OutEnd); \ - if (!Out) return NULL; } + if (!Out) return NULL; \ +} while (0) switch (Cmd->Type) { @@ -883,70 +942,71 @@ Unparse(PARSED_COMMAND *Cmd, TCHAR *Out, TCHAR *OutEnd) * Windows doesn't bother escaping them, so for compatibility * we probably shouldn't do it either */ if (!SubstituteForVars(Cmd->Command.First, Buf)) return NULL; - STRING(Buf) + STRING(Buf); if (!SubstituteForVars(Cmd->Command.Rest, Buf)) return NULL; - STRING(Buf) + STRING(Buf); break; case C_QUIET: - CHAR(_T('@')) - RECURSE(Cmd->Subcommands) + CHAR(_T('@')); + RECURSE(Cmd->Subcommands); break; case C_BLOCK: - CHAR(_T('(')) + CHAR(_T('(')); for (Sub = Cmd->Subcommands; Sub; Sub = Sub->Next) { - RECURSE(Sub) + RECURSE(Sub); if (Sub->Next) - CHAR(_T('&')) + CHAR(_T('&')); } - CHAR(_T(')')) + CHAR(_T(')')); break; case C_MULTI: case C_IFFAILURE: case C_IFSUCCESS: case C_PIPE: Sub = Cmd->Subcommands; - RECURSE(Sub) - PRINTF(_T(" %s "), OpString[Cmd->Type - C_OP_LOWEST]) - RECURSE(Sub->Next) + RECURSE(Sub); + PRINTF(_T(" %s "), OpString[Cmd->Type - C_OP_LOWEST]); + RECURSE(Sub->Next); break; case C_IF: - STRING(_T("if")) + STRING(_T("if")); if (Cmd->If.Flags & IFFLAG_IGNORECASE) - STRING(_T(" /I")) + STRING(_T(" /I")); if (Cmd->If.Flags & IFFLAG_NEGATE) - STRING(_T(" not")) + STRING(_T(" not")); if (Cmd->If.LeftArg && SubstituteForVars(Cmd->If.LeftArg, Buf)) - PRINTF(_T(" %s"), Buf) + PRINTF(_T(" %s"), Buf); PRINTF(_T(" %s"), IfOperatorString[Cmd->If.Operator]); if (!SubstituteForVars(Cmd->If.RightArg, Buf)) return NULL; - PRINTF(_T(" %s "), Buf) + PRINTF(_T(" %s "), Buf); Sub = Cmd->Subcommands; - RECURSE(Sub) + RECURSE(Sub); if (Sub->Next) { - STRING(_T(" else ")) - RECURSE(Sub->Next) + STRING(_T(" else ")); + RECURSE(Sub->Next); } break; case C_FOR: - STRING(_T("for")) - if (Cmd->For.Switches & FOR_DIRS) STRING(_T(" /D")) - if (Cmd->For.Switches & FOR_F) STRING(_T(" /F")) - if (Cmd->For.Switches & FOR_LOOP) STRING(_T(" /L")) - if (Cmd->For.Switches & FOR_RECURSIVE) STRING(_T(" /R")) + STRING(_T("for")); + if (Cmd->For.Switches & FOR_DIRS) STRING(_T(" /D")); + if (Cmd->For.Switches & FOR_F) STRING(_T(" /F")); + if (Cmd->For.Switches & FOR_LOOP) STRING(_T(" /L")); + if (Cmd->For.Switches & FOR_RECURSIVE) STRING(_T(" /R")); if (Cmd->For.Params) - PRINTF(_T(" %s"), Cmd->For.Params) - PRINTF(_T(" %%%c in (%s) do "), Cmd->For.Variable, Cmd->For.List) - RECURSE(Cmd->Subcommands) + PRINTF(_T(" %s"), Cmd->For.Params); + PRINTF(_T(" %%%c in (%s) do "), Cmd->For.Variable, Cmd->For.List); + RECURSE(Cmd->Subcommands); break; } for (Redir = Cmd->Redirections; Redir; Redir = Redir->Next) { - if (!SubstituteForVars(Redir->Filename, Buf)) return NULL; + if (!SubstituteForVars(Redir->Filename, Buf)) + return NULL; PRINTF(_T(" %c%s%s"), _T('0') + Redir->Number, - RedirString[Redir->Mode], Buf) + RedirString[Redir->Mode], Buf); } return Out; } diff --git a/base/shell/cmd/path.c b/base/shell/cmd/path.c index 3e58692860..c00851dae4 100644 --- a/base/shell/cmd/path.c +++ b/base/shell/cmd/path.c @@ -50,6 +50,12 @@ INT cmd_path (LPTSTR param) LPTSTR pszBuffer; pszBuffer = (LPTSTR)cmd_alloc (ENV_BUFFER_SIZE * sizeof(TCHAR)); + if (!pszBuffer) + { + WARN("Cannot allocate memory for pszBuffer!\n"); + return 1; + } + dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE); if (dwBuffer == 0) { @@ -61,8 +67,9 @@ INT cmd_path (LPTSTR param) { LPTSTR pszOldBuffer = pszBuffer; pszBuffer = (LPTSTR)cmd_realloc (pszBuffer, dwBuffer * sizeof (TCHAR)); - if (pszBuffer == NULL) + if (!pszBuffer) { + WARN("Cannot reallocate memory for pszBuffer!\n"); cmd_free(pszOldBuffer); return 1; } diff --git a/base/shell/cmd/setlocal.c b/base/shell/cmd/setlocal.c index ae60036c77..ca913dc2a6 100644 --- a/base/shell/cmd/setlocal.c +++ b/base/shell/cmd/setlocal.c @@ -49,6 +49,7 @@ INT cmd_setlocal(LPTSTR param) Saved = cmd_alloc(sizeof(SETLOCAL)); if (!Saved) { + WARN("Cannot allocate memory for Saved!\n"); error_out_of_memory(); return 1; } diff --git a/base/shell/cmd/start.c b/base/shell/cmd/start.c index 190ed39a6a..de07c3e0e7 100644 --- a/base/shell/cmd/start.c +++ b/base/shell/cmd/start.c @@ -178,8 +178,9 @@ INT cmd_start (LPTSTR Rest) /* get comspec */ comspec = cmd_alloc ( MAX_PATH * sizeof(TCHAR)); - if (comspec == NULL) + if (!comspec) { + WARN("Cannot allocate memory for start comspec!\n"); error_out_of_memory(); return 1; } diff --git a/base/shell/cmd/where.c b/base/shell/cmd/where.c index 0e64d2aa12..0ba4c08c5e 100644 --- a/base/shell/cmd/where.c +++ b/base/shell/cmd/where.c @@ -149,13 +149,20 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName) /* load environment variable PATHEXT */ pszPathExt = (LPTSTR)cmd_alloc (ENV_BUFFER_SIZE * sizeof(TCHAR)); + if (!pszPathExt) + { + WARN("Cannot allocate memory for pszPathExt!\n"); + return FALSE; + } + dwBuffer = GetEnvironmentVariable (_T("PATHEXT"), pszPathExt, ENV_BUFFER_SIZE); if (dwBuffer > ENV_BUFFER_SIZE) { LPTSTR pszOldPathExt = pszPathExt; pszPathExt = (LPTSTR)cmd_realloc (pszPathExt, dwBuffer * sizeof (TCHAR)); - if (pszPathExt == NULL) + if (!pszPathExt) { + WARN("Cannot reallocate memory for pszPathExt!\n"); cmd_free(pszOldPathExt); return FALSE; } @@ -187,13 +194,20 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName) /* load environment variable PATH into buffer */ pszPath = (LPTSTR)cmd_alloc (ENV_BUFFER_SIZE * sizeof(TCHAR)); + if (!pszPath) + { + WARN("Cannot allocate memory for pszPath!\n"); + return FALSE; + } + dwBuffer = GetEnvironmentVariable (_T("PATH"), pszPath, ENV_BUFFER_SIZE); if (dwBuffer > ENV_BUFFER_SIZE) { LPTSTR pszOldPath = pszPath; pszPath = (LPTSTR)cmd_realloc (pszPath, dwBuffer * sizeof (TCHAR)); - if (pszPath == NULL) + if (!pszPath) { + WARN("Cannot reallocate memory for pszPath!\n"); cmd_free(pszOldPath); cmd_free(pszPathExt); return FALSE;
6 years, 4 months
1
0
0
0
← Newer
1
...
4
5
6
7
8
9
10
...
31
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
Results per page:
10
25
50
100
200