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
May 2019
----- 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
17 participants
165 discussions
Start a n
N
ew thread
[reactos] 01/01: [BASESRV] Misc fixes: use BaseSrvHeap and silent a DPRINT
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e1e6cfd3120b64e93a5e8…
commit e1e6cfd3120b64e93a5e83b8795db24aab15bd76 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Thu May 9 08:56:29 2019 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Thu May 9 08:57:43 2019 +0200 [BASESRV] Misc fixes: use BaseSrvHeap and silent a DPRINT --- subsystems/win/basesrv/dosdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsystems/win/basesrv/dosdev.c b/subsystems/win/basesrv/dosdev.c index f683b46f53..d13edb4ac1 100644 --- a/subsystems/win/basesrv/dosdev.c +++ b/subsystems/win/basesrv/dosdev.c @@ -138,7 +138,7 @@ IsGlobalSymbolicLink(HANDLE LinkHandle, { if (PNameInfo != NULL) { - RtlFreeHeap(RtlGetProcessHeap(), 0, PNameInfo); + RtlFreeHeap(BaseSrvHeap, 0, PNameInfo); } } _SEH2_END; @@ -208,7 +208,7 @@ CSR_API(BaseSrvDefineDosDevice) } #endif - DPRINT1("BaseSrvDefineDosDevice entered, Flags:%d, DeviceName:%wZ (%d), TargetPath:%wZ (%d)\n", + DPRINT("BaseSrvDefineDosDevice entered, Flags:%d, DeviceName:%wZ (%d), TargetPath:%wZ (%d)\n", DefineDosDeviceRequest->Flags, &DefineDosDeviceRequest->DeviceName, DefineDosDeviceRequest->DeviceName.Length,
5 years, 7 months
1
0
0
0
[reactos] 01/01: [POWERCFG] Do not re-initialize all paged directly when the hibernate file setting changes. Re-initialize the pages on PSN_SETACTIVE instead.
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cc13842ad40d073b8b396…
commit cc13842ad40d073b8b3967013f57edc85cc6598d Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Wed May 8 22:56:55 2019 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Wed May 8 23:31:00 2019 +0200 [POWERCFG] Do not re-initialize all paged directly when the hibernate file setting changes. Re-initialize the pages on PSN_SETACTIVE instead. --- dll/cpl/powercfg/advanced.c | 55 +++++++++++++++++++++--------------------- dll/cpl/powercfg/hibernate.c | 13 ++-------- dll/cpl/powercfg/powershemes.c | 38 ++++++++++++++--------------- 3 files changed, 49 insertions(+), 57 deletions(-) diff --git a/dll/cpl/powercfg/advanced.c b/dll/cpl/powercfg/advanced.c index da43d67f82..914afdb6c6 100644 --- a/dll/cpl/powercfg/advanced.c +++ b/dll/cpl/powercfg/advanced.c @@ -11,8 +11,6 @@ #include "powercfg.h" -HWND hAdv = 0; - static POWER_ACTION g_SystemBatteries[3]; static POWER_ACTION g_PowerButton[5]; static POWER_ACTION g_SleepButton[5]; @@ -52,7 +50,7 @@ AddItem(HWND hDlgCtrl, INT ResourceId, LPARAM lParam, POWER_ACTION * lpAction) if (LoadString(hApplet, ResourceId, szBuffer, MAX_PATH) < MAX_PATH) { - Index = SendMessage(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)szBuffer); + Index = SendMessage(hDlgCtrl, CB_INSERTSTRING, -1, (LPARAM)szBuffer); if (Index != CB_ERR) { SendMessage(hDlgCtrl, CB_SETITEMDATA, (WPARAM)Index, lParam); @@ -298,7 +296,8 @@ ShowCurrentPowerActionPolicies(HWND hwndDlg) } VOID -Adv_InitDialog(VOID) +Adv_InitDialog( + HWND hwndDlg) { HWND hList1; HWND hList2; @@ -318,13 +317,13 @@ Adv_InitDialog(VOID) else gGPP.user.GlobalFlags &= ~EnableSysTrayBatteryMeter; - CheckDlgButton(hAdv, + CheckDlgButton(hwndDlg, IDC_SYSTRAYBATTERYMETER, bEnabled ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hAdv, + CheckDlgButton(hwndDlg, IDC_PASSWORDLOGON, gGPP.user.GlobalFlags & EnablePasswordLogon ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hAdv, + CheckDlgButton(hwndDlg, IDC_VIDEODIMDISPLAY, gGPP.user.GlobalFlags & EnableVideoDimDisplay ? BST_CHECKED : BST_UNCHECKED); @@ -336,7 +335,7 @@ Adv_InitDialog(VOID) bHibernate = spc.HiberFilePresent; bShutdown = spc.SystemS5; - hList1 = GetDlgItem(hAdv, IDC_LIDCLOSE); + hList1 = GetDlgItem(hwndDlg, IDC_LIDCLOSE); SendMessage(hList1, CB_RESETCONTENT, 0, 0); memset(g_SystemBatteries, 0x0, sizeof(g_SystemBatteries)); @@ -356,12 +355,12 @@ Adv_InitDialog(VOID) } else { - ShowWindow(GetDlgItem(hAdv, IDC_VIDEODIMDISPLAY), FALSE); - ShowWindow(GetDlgItem(hAdv, IDC_SLIDCLOSE), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_VIDEODIMDISPLAY), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_SLIDCLOSE), FALSE); ShowWindow(hList1, FALSE); } - hList2 = GetDlgItem(hAdv, IDC_POWERBUTTON); + hList2 = GetDlgItem(hwndDlg, IDC_POWERBUTTON); SendMessage(hList2, CB_RESETCONTENT, 0, 0); memset(g_PowerButton, 0x0, sizeof(g_PowerButton)); @@ -387,11 +386,11 @@ Adv_InitDialog(VOID) } else { - ShowWindow(GetDlgItem(hAdv, IDC_SPOWERBUTTON), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_SPOWERBUTTON), FALSE); ShowWindow(hList2, FALSE); } - hList3 = GetDlgItem(hAdv, IDC_SLEEPBUTTON); + hList3 = GetDlgItem(hwndDlg, IDC_SLEEPBUTTON); SendMessage(hList3, CB_RESETCONTENT, 0, 0); memset(g_SleepButton, 0x0, sizeof(g_SleepButton)); @@ -417,13 +416,13 @@ Adv_InitDialog(VOID) } else { - ShowWindow(GetDlgItem(hAdv, IDC_SSLEEPBUTTON), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_SSLEEPBUTTON), FALSE); ShowWindow(hList3, FALSE); } if (ReadGlobalPwrPolicy(&gGPP)) { - ShowCurrentPowerActionPolicies(hAdv); + ShowCurrentPowerActionPolicies(hwndDlg); } } @@ -490,17 +489,17 @@ Adv_SaveData(HWND hwndDlg) if (!IsBatteryUsed()) { - SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON), &gGPP.user.PowerButtonAc); #if 0 SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_LIDCLOSE), &gGPP.user.LidCloseAc); - SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON), &gGPP.user.SleepButtonAc); #endif + SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON), &gGPP.user.PowerButtonAc); + SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON), &gGPP.user.SleepButtonAc); } else { #if 0 - SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON), &gGPP.user.PowerButtonDc); SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_LIDCLOSE), &gGPP.user.LidCloseDc); + SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON), &gGPP.user.PowerButtonDc); SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON), &gGPP.user.SleepButtonDc); #endif } @@ -512,7 +511,7 @@ Adv_SaveData(HWND hwndDlg) SetSystrayPowerIconState(bSystrayBatteryMeter); - Adv_InitDialog(); +// Adv_InitDialog(hwndDlg); } /* Property page dialog callback */ @@ -525,8 +524,7 @@ AdvancedDlgProc(HWND hwndDlg, switch (uMsg) { case WM_INITDIALOG: - hAdv = hwndDlg; - Adv_InitDialog(); + Adv_InitDialog(hwndDlg); return TRUE; case WM_COMMAND: @@ -553,14 +551,17 @@ AdvancedDlgProc(HWND hwndDlg, break; case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - if (lpnm->code == (UINT)PSN_APPLY) + switch (((LPNMHDR)lParam)->code) { - Adv_SaveData(hwndDlg); + case PSN_APPLY: + Adv_SaveData(hwndDlg); + return TRUE; + + case PSN_SETACTIVE: + Adv_InitDialog(hwndDlg); + return TRUE; } - return TRUE; - } + break; } return FALSE; diff --git a/dll/cpl/powercfg/hibernate.c b/dll/cpl/powercfg/hibernate.c index b82cf09450..02e774e784 100644 --- a/dll/cpl/powercfg/hibernate.c +++ b/dll/cpl/powercfg/hibernate.c @@ -11,10 +11,6 @@ #include "powercfg.h" -//BOOLEAN Pos_InitData(); -//void Adv_InitDialog(); - - static VOID Hib_InitDialog(HWND hwndDlg) { @@ -75,9 +71,6 @@ Hib_SaveData(HWND hwndDlg) if (CallNtPowerInformation(SystemReserveHiberFile, &bHibernate, sizeof(bHibernate), NULL, 0) == STATUS_SUCCESS) { - // FIXME: Do not call these functions directly! Post a message to the other pages instead! - // Pos_InitData(); - // Adv_InitDialog(); Hib_InitDialog(hwndDlg); return TRUE; } @@ -111,13 +104,11 @@ HibernateDlgProc(HWND hwndDlg, break; case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - if (lpnm->code == (UINT)PSN_APPLY) + if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { return Hib_SaveData(hwndDlg); } - } + break; } return FALSE; diff --git a/dll/cpl/powercfg/powershemes.c b/dll/cpl/powercfg/powershemes.c index 56c9ae1f3f..1e164d9e85 100644 --- a/dll/cpl/powercfg/powershemes.c +++ b/dll/cpl/powercfg/powershemes.c @@ -276,23 +276,21 @@ Pos_InitData( ShowWindow(GetDlgItem(hwndDlg, IDC_SDC), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_MONITORDCLIST), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_DISKDCLIST), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYDCLIST), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEDCLIST), SW_HIDE); } - if (!(spc.SystemS1 || spc.SystemS2 || spc.SystemS3)) - { - ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBY), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYACLIST), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYDCLIST), SW_HIDE); - } + ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBY), + (spc.SystemS1 || spc.SystemS2 || spc.SystemS3) ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYACLIST), + (spc.SystemS1 || spc.SystemS2 || spc.SystemS3) ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYDCLIST), + ((spc.SystemS1 || spc.SystemS2 || spc.SystemS3) && spc.SystemBatteriesPresent) ? SW_SHOW : SW_HIDE); - if (!spc.HiberFilePresent) - { - ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATE), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEACLIST), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEDCLIST), SW_HIDE); - } + ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATE), + (spc.HiberFilePresent) ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEACLIST), + (spc.HiberFilePresent) ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEDCLIST), + (spc.HiberFilePresent && spc.SystemBatteriesPresent) ? SW_SHOW : SW_HIDE); return TRUE; } @@ -955,13 +953,15 @@ PowerSchemesDlgProc( break; case WM_NOTIFY: + switch (((LPNMHDR)lParam)->code) { - LPNMHDR lpnm = (LPNMHDR)lParam; - if (lpnm->code == (UINT)PSN_APPLY) - { + case PSN_APPLY: Pos_SaveData(hwndDlg, pPageData); - } - return TRUE; + return TRUE; + + case PSN_SETACTIVE: + Pos_InitData(hwndDlg); + return TRUE; } break; }
5 years, 7 months
1
0
0
0
[reactos] 02/02: [BASESRV] Make Buffer MAX_PATH big again
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bd7b0c96c6c00b51a423b…
commit bd7b0c96c6c00b51a423b5b1a82ff541a7eee5fa Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Wed May 8 20:39:57 2019 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Wed May 8 20:39:57 2019 +0200 [BASESRV] Make Buffer MAX_PATH big again --- subsystems/win/basesrv/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsystems/win/basesrv/init.c b/subsystems/win/basesrv/init.c index 84b24f38db..6b93f29f9c 100644 --- a/subsystems/win/basesrv/init.c +++ b/subsystems/win/basesrv/init.c @@ -291,7 +291,7 @@ BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll) NTSTATUS Status; BOOLEAN Success; WCHAR BnoBuffer[100]; - WCHAR Buffer[100]; + WCHAR Buffer[MAX_PATH]; PWCHAR HeapBuffer; UNICODE_STRING SystemRootString; UNICODE_STRING UnexpandedSystemRootString = RTL_CONSTANT_STRING(L"%SystemRoot%");
5 years, 7 months
1
0
0
0
[reactos] 01/02: [BASESVR] Take SessionId into account while creating BNO directory
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=20f57973866eb54d3c282…
commit 20f57973866eb54d3c2822a3b62a309a9983c196 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Wed May 8 20:35:31 2019 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Wed May 8 20:35:31 2019 +0200 [BASESVR] Take SessionId into account while creating BNO directory --- subsystems/win/basesrv/init.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/subsystems/win/basesrv/init.c b/subsystems/win/basesrv/init.c index ebfe937068..84b24f38db 100644 --- a/subsystems/win/basesrv/init.c +++ b/subsystems/win/basesrv/init.c @@ -353,8 +353,14 @@ BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll) SystemRootString.Buffer); ASSERT(Success); - /* FIXME: Check Session ID */ - wcscpy(BnoBuffer, L"\\BaseNamedObjects"); + if (SessionId != 0) + { + swprintf(BnoBuffer, L"\\Sessions\\%ld\\BaseNamedObjects", SessionId); + } + else + { + wcscpy(BnoBuffer, L"\\BaseNamedObjects"); + } RtlInitUnicodeString(&BnoString, BnoBuffer); /* Allocate the server data */ @@ -531,7 +537,7 @@ BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll) Status = NtCreateSymbolicLinkObject(&SymHandle, SYMBOLIC_LINK_ALL_ACCESS, &ObjectAttributes, - &SymlinkName); + &BnoString); if ((NT_SUCCESS(Status)) && SessionId == 0) NtClose(SymHandle); /* Make Session point back to BNOLINKS */
5 years, 7 months
1
0
0
0
[reactos] 01/01: [BASESRV] Fix the BNO string buffer usage
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a8027265772f608bcdf09…
commit a8027265772f608bcdf0918c5f4434852806ec1d Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Wed May 8 20:06:49 2019 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Wed May 8 20:08:13 2019 +0200 [BASESRV] Fix the BNO string buffer usage This avoids reinitializing it before use. --- subsystems/win/basesrv/init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subsystems/win/basesrv/init.c b/subsystems/win/basesrv/init.c index 87514d96b4..ebfe937068 100644 --- a/subsystems/win/basesrv/init.c +++ b/subsystems/win/basesrv/init.c @@ -290,7 +290,8 @@ BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll) { NTSTATUS Status; BOOLEAN Success; - WCHAR Buffer[MAX_PATH]; + WCHAR BnoBuffer[100]; + WCHAR Buffer[100]; PWCHAR HeapBuffer; UNICODE_STRING SystemRootString; UNICODE_STRING UnexpandedSystemRootString = RTL_CONSTANT_STRING(L"%SystemRoot%"); @@ -353,8 +354,8 @@ BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll) ASSERT(Success); /* FIXME: Check Session ID */ - wcscpy(Buffer, L"\\BaseNamedObjects"); - RtlInitUnicodeString(&BnoString, Buffer); + wcscpy(BnoBuffer, L"\\BaseNamedObjects"); + RtlInitUnicodeString(&BnoString, BnoBuffer); /* Allocate the server data */ BaseStaticServerData = RtlAllocateHeap(BaseSrvSharedHeap, @@ -474,7 +475,6 @@ BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll) ASSERT(NT_SUCCESS(Status)); /* Create the BNO directory */ - RtlInitUnicodeString(&BnoString, L"\\BaseNamedObjects"); InitializeObjectAttributes(&ObjectAttributes, &BnoString, OBJ_OPENIF | OBJ_PERMANENT | OBJ_CASE_INSENSITIVE,
5 years, 7 months
1
0
0
0
[reactos] 01/01: [Win32nt|ApiTests] Add ExtSelectClipRgn test
by jimtabor
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=25198d5cbd0213387c221…
commit 25198d5cbd0213387c221f7778f942cad70b980b Author: jimtabor <james.tabor(a)reactos.org> AuthorDate: Wed May 8 12:31:17 2019 -0500 Commit: jimtabor <james.tabor(a)reactos.org> CommitDate: Wed May 8 12:31:17 2019 -0500 [Win32nt|ApiTests] Add ExtSelectClipRgn test For CORE-13817 and CORE-15906 --- modules/rostests/apitests/win32nt/CMakeLists.txt | 2 +- .../apitests/win32nt/ntgdi/NtGdiExtSelectClipRgn.c | 57 ++++++++++++++++++++++ modules/rostests/apitests/win32nt/testlist.c | 4 +- 3 files changed, 60 insertions(+), 3 deletions(-) diff --git a/modules/rostests/apitests/win32nt/CMakeLists.txt b/modules/rostests/apitests/win32nt/CMakeLists.txt index 31e649e0c1..666f823a38 100644 --- a/modules/rostests/apitests/win32nt/CMakeLists.txt +++ b/modules/rostests/apitests/win32nt/CMakeLists.txt @@ -18,7 +18,7 @@ list(APPEND SOURCE ntgdi/NtGdiDoPalette.c ntgdi/NtGdiEngCreatePalette.c ntgdi/NtGdiEnumFontOpen.c - #ntgdi/NtGdiExtSelectClipRgn.c + ntgdi/NtGdiExtSelectClipRgn.c ntgdi/NtGdiExtTextOutW.c #ntgdi/NtGdiFlushUserBatch.c ntgdi/NtGdiGetBitmapBits.c diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtSelectClipRgn.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtSelectClipRgn.c new file mode 100644 index 0000000000..03cd12d161 --- /dev/null +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtSelectClipRgn.c @@ -0,0 +1,57 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPL - See COPYING in the top level directory + * PURPOSE: Test for NtGdiCombineRgn + * PROGRAMMERS: + */ + +#include <win32nt.h> + +START_TEST(NtGdiExtSelectClipRgn) +{ + HRGN hRgnDest, hRgn1, hRgn2; + HDC hdc; +// test what params are accepted for what operations +// 0? invalid? are params maybe ignored in some cases? +// LastError + + /* Preparation */ + hRgnDest = CreateRectRgn(100, 100, 100, 100); + hRgn1 = CreateRectRgn(1,1,4,4); + hRgn2 = CreateRectRgn(2,2,6,3); + + hdc = GetDC(NULL); + + /* RGN_AND = 1, RGN_OR = 2, RGN_XOR = 3, RGN_DIFF = 4, RGN_COPY = 5 */ + + SetLastError(0xDEADFACE); + ok_int(NtGdiExtSelectClipRgn(NULL, NULL, RGN_AND-1), ERROR); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + SetLastError(0xDEADFACE); + ok_int(NtGdiExtSelectClipRgn(NULL, NULL, RGN_COPY+1), ERROR); + ok_long(GetLastError(), ERROR_INVALID_PARAMETER); + SetLastError(0xDEADFACE); + ok_int(NtGdiExtSelectClipRgn(NULL, NULL, RGN_COPY), ERROR); + ok_long(GetLastError(), ERROR_INVALID_HANDLE); + ok_int(NtGdiExtSelectClipRgn(hdc, hRgnDest, RGN_COPY), NULLREGION); + ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION); + ok_int(NtGdiExtSelectClipRgn(hdc, hRgnDest, RGN_DIFF), SIMPLEREGION); + ok_int(NtGdiExtSelectClipRgn(hdc, hRgn1, RGN_COPY), SIMPLEREGION); + ok_int(NtGdiExtSelectClipRgn(hdc, hRgn2, RGN_DIFF), COMPLEXREGION); + ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION); + ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION); + ok_int(NtGdiExtSelectClipRgn(hdc, hRgnDest, RGN_COPY), NULLREGION); + ok_int(NtGdiExtSelectClipRgn(hdc, hRgn1, RGN_AND), NULLREGION); + ok_int(NtGdiExtSelectClipRgn(hdc, hRgn2, RGN_AND), NULLREGION); + ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION); + ok_int(NtGdiExtSelectClipRgn(hdc, hRgn1, RGN_OR), SIMPLEREGION); + ok_int(NtGdiExtSelectClipRgn(hdc, hRgn2, RGN_OR), SIMPLEREGION); + ok_int(NtGdiExtSelectClipRgn(hdc, hRgn1, RGN_XOR), COMPLEXREGION); + SetLastError(0xDEADFACE); + ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_DIFF), ERROR); + ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_OR), ERROR); + ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_XOR), ERROR); + ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_AND), ERROR); + ok_long(GetLastError(), 0xDEADFACE); + ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION); +} diff --git a/modules/rostests/apitests/win32nt/testlist.c b/modules/rostests/apitests/win32nt/testlist.c index 70f5611497..186fd03e6c 100644 --- a/modules/rostests/apitests/win32nt/testlist.c +++ b/modules/rostests/apitests/win32nt/testlist.c @@ -19,7 +19,7 @@ extern void func_NtGdiDeleteObjectApp(void); extern void func_NtGdiDoPalette(void); extern void func_NtGdiEngCreatePalette(void); extern void func_NtGdiEnumFontOpen(void); -//extern void func_NtGdiExtSelectClipRgn(void); +extern void func_NtGdiExtSelectClipRgn(void); extern void func_NtGdiExtTextOutW(void); //extern void func_NtGdiFlushUserBatch(void); extern void func_NtGdiGetBitmapBits(void); @@ -80,7 +80,7 @@ const struct test winetest_testlist[] = { "NtGdiDoPalette", func_NtGdiDoPalette }, { "NtGdiEngCreatePalette", func_NtGdiEngCreatePalette }, { "NtGdiEnumFontOpen", func_NtGdiEnumFontOpen }, - //{ "NtGdiExtSelectClipRgn", func_NtGdiExtSelectClipRgn }, + { "NtGdiExtSelectClipRgn", func_NtGdiExtSelectClipRgn }, { "NtGdiExtTextOutW", func_NtGdiExtTextOutW }, //{ "NtGdiFlushUserBatch", func_NtGdiFlushUserBatch }, { "NtGdiGetBitmapBits", func_NtGdiGetBitmapBits },
5 years, 7 months
1
0
0
0
[reactos] 04/04: [BASESRV] Rewrite DOS devices management
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0a392b188a1fcdabbab87…
commit 0a392b188a1fcdabbab87f16d121249888f62964 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Wed May 8 18:29:52 2019 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Wed May 8 18:34:28 2019 +0200 [BASESRV] Rewrite DOS devices management This will notably bring support for DOS mapping with LUID devices (not yet supported in the kernel, though). This also reduces complexity (and thus memory usage) with the "history" thing. Multiple targets are stored in the link target as MULTI_SZ string. This fixes regressions introduced with kernel32 fixes/rewrites. --- subsystems/win/basesrv/basesrv.h | 1 + subsystems/win/basesrv/dosdev.c | 983 +++++++++++++++++++++++---------------- 2 files changed, 595 insertions(+), 389 deletions(-) diff --git a/subsystems/win/basesrv/basesrv.h b/subsystems/win/basesrv/basesrv.h index 03ebb9c8e3..67b73a6da6 100644 --- a/subsystems/win/basesrv/basesrv.h +++ b/subsystems/win/basesrv/basesrv.h @@ -23,6 +23,7 @@ #include <ndk/exfuncs.h> #include <ndk/umfuncs.h> #include <ndk/cmfuncs.h> +#include <ndk/sefuncs.h> /* PSEH for SEH Support */ #include <pseh/pseh2.h> diff --git a/subsystems/win/basesrv/dosdev.c b/subsystems/win/basesrv/dosdev.c index bd803eb306..f683b46f53 100644 --- a/subsystems/win/basesrv/dosdev.c +++ b/subsystems/win/basesrv/dosdev.c @@ -15,60 +15,135 @@ /* GLOBALS ********************************************************************/ -typedef struct _BASE_DOS_DEVICE_HISTORY_ENTRY -{ - LIST_ENTRY Entry; - UNICODE_STRING Device; - UNICODE_STRING Target; -} BASE_DOS_DEVICE_HISTORY_ENTRY, *PBASE_DOS_DEVICE_HISTORY_ENTRY; - static RTL_CRITICAL_SECTION BaseDefineDosDeviceCritSec; -static LIST_ENTRY DosDeviceHistory; /* PRIVATE FUNCTIONS **********************************************************/ VOID BaseInitDefineDosDevice(VOID) { RtlInitializeCriticalSection(&BaseDefineDosDeviceCritSec); - InitializeListHead(&DosDeviceHistory); } VOID BaseCleanupDefineDosDevice(VOID) { - PLIST_ENTRY Entry, ListHead; - PBASE_DOS_DEVICE_HISTORY_ENTRY HistoryEntry; - RtlDeleteCriticalSection(&BaseDefineDosDeviceCritSec); +} - ListHead = &DosDeviceHistory; - Entry = ListHead->Flink; - while (Entry != ListHead) +NTSTATUS +GetCallerLuid(PLUID CallerLuid) +{ + NTSTATUS Status; + HANDLE TokenHandle; + ULONG ReturnLength; + TOKEN_STATISTICS TokenInformation; + + /* We need an output buffer */ + if (CallerLuid == NULL) { - HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY) - CONTAINING_RECORD(Entry, - BASE_DOS_DEVICE_HISTORY_ENTRY, - Entry); - Entry = Entry->Flink; + return STATUS_INVALID_PARAMETER; + } + + /* Open thread token */ + TokenHandle = 0; + ReturnLength = 0; + Status = NtOpenThreadToken(NtCurrentThread(), + READ_CONTROL | TOKEN_QUERY, + FALSE, &TokenHandle); + /* If we fail, open process token */ + if (Status == STATUS_NO_TOKEN) + { + Status = NtOpenProcessToken(NtCurrentProcess(), + READ_CONTROL | TOKEN_QUERY, + &TokenHandle); + } - if (HistoryEntry) + /* In case of a success get caller LUID and copy it back */ + if (NT_SUCCESS(Status)) + { + Status = NtQueryInformationToken(TokenHandle, + TokenStatistics, + &TokenInformation, + sizeof(TokenInformation), + &ReturnLength); + if (NT_SUCCESS(Status)) { - if (HistoryEntry->Target.Buffer) + RtlCopyLuid(CallerLuid, &TokenInformation.AuthenticationId); + } + } + + /* Close token handle */ + if (TokenHandle != 0) + { + NtClose(TokenHandle); + } + + return Status; +} + +NTSTATUS +IsGlobalSymbolicLink(HANDLE LinkHandle, + PBOOLEAN IsGlobal) +{ + NTSTATUS Status; + DWORD ReturnLength; + UNICODE_STRING GlobalString; + OBJECT_NAME_INFORMATION NameInfo, *PNameInfo; + + /* We need both parameters */ + if (LinkHandle == 0 || IsGlobal == NULL) + { + return STATUS_INVALID_PARAMETER; + } + + PNameInfo = NULL; + _SEH2_TRY + { + /* Query handle information */ + Status = NtQueryObject(LinkHandle, + ObjectNameInformation, + &NameInfo, + 0, + &ReturnLength); + /* Only failure we tolerate is length mismatch */ + if (NT_SUCCESS(Status) || Status == STATUS_INFO_LENGTH_MISMATCH) + { + /* Allocate big enough buffer */ + PNameInfo = RtlAllocateHeap(BaseSrvHeap, 0, ReturnLength); + if (PNameInfo == NULL) { - RtlFreeHeap(BaseSrvHeap, - 0, - HistoryEntry->Target.Buffer); + Status = STATUS_NO_MEMORY; + _SEH2_LEAVE; } - if (HistoryEntry->Device.Buffer) + + /* Query again handle information */ + Status = NtQueryObject(LinkHandle, + ObjectNameInformation, + PNameInfo, + ReturnLength, + &ReturnLength); + + /* + * If it succeed, check we have Global?? + * If so, return success + */ + if (NT_SUCCESS(Status)) { - RtlFreeHeap(BaseSrvHeap, - 0, - HistoryEntry->Device.Buffer); + RtlInitUnicodeString(&GlobalString, L"\\GLOBAL??"); + *IsGlobal = RtlPrefixUnicodeString(&GlobalString, &PNameInfo->Name, FALSE); + Status = STATUS_SUCCESS; } - RtlFreeHeap(BaseSrvHeap, - 0, - HistoryEntry); } } + _SEH2_FINALLY + { + if (PNameInfo != NULL) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, PNameInfo); + } + } + _SEH2_END; + + return Status; } /* PUBLIC SERVER APIS *********************************************************/ @@ -78,478 +153,608 @@ CSR_API(BaseSrvDefineDosDevice) NTSTATUS Status; PBASE_DEFINE_DOS_DEVICE DefineDosDeviceRequest = &((PBASE_API_MESSAGE)ApiMessage)->Data.DefineDosDeviceRequest; OBJECT_ATTRIBUTES ObjectAttributes; - HANDLE LinkHandle = NULL; + HANDLE LinkHandle; UNICODE_STRING DeviceName = {0}; - UNICODE_STRING RequestDeviceName = {0}; UNICODE_STRING LinkTarget = {0}; - PUNICODE_STRING RequestLinkTarget; ULONG Length; SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; SID_IDENTIFIER_AUTHORITY SystemAuthority = {SECURITY_NT_AUTHORITY}; - PSECURITY_DESCRIPTOR SecurityDescriptor; - PACL Dacl; - PSID AdminSid; PSID SystemSid; PSID WorldSid; - ULONG SidLength; - PBASE_DOS_DEVICE_HISTORY_ENTRY HistoryEntry; - PLIST_ENTRY Entry; - PLIST_ENTRY ListHead; - BOOLEAN Matched, AddHistory; - DWORD dwFlags; PWSTR lpBuffer; + WCHAR Letter; + SHORT AbsLetter; + BOOLEAN DriveLetter = FALSE; + BOOLEAN RemoveDefinition; + BOOLEAN HandleTarget; + BOOLEAN HandleSMB = FALSE; + BOOLEAN IsGlobal = FALSE; + ULONG CchLengthLeft; + ULONG CchLength; + ULONG TargetLength; + PWSTR TargetBuffer; + PWSTR CurrentBuffer; + /* We store them on the stack, they are known in advance */ + union { + SECURITY_DESCRIPTOR SecurityDescriptor; + UCHAR Buffer[20]; + } SecurityDescriptor; + union { + ACL Dacl; + UCHAR Buffer[256]; + } Dacl; + ACCESS_MASK AccessMask; + LUID CallerLuid; + WCHAR * CurrentPtr; + WCHAR CurrentChar; + PWSTR OrigPtr; + PWSTR InterPtr; + BOOLEAN RemoveFound; + +#if 0 + /* FIXME: Check why it fails.... */ + if (!CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&DefineDosDeviceRequest->DeviceName, + DefineDosDeviceRequest->DeviceName.Length, + 1) || + (DefineDosDeviceRequest->DeviceName.Length & 1) != 0 || + !CsrValidateMessageBuffer(ApiMessage, + (PVOID*)&DefineDosDeviceRequest->TargetPath, + (DefineDosDeviceRequest->TargetPath.Length != 0 ? sizeof(UNICODE_NULL) : 0) + DefineDosDeviceRequest->TargetPath.Length, + 1) || + (DefineDosDeviceRequest->TargetPath.Length & 1) != 0) + { + return STATUS_INVALID_PARAMETER; + } +#endif - DPRINT("BaseSrvDefineDosDevice entered, Flags:%d, DeviceName:%wZ, TargetPath:%wZ\n", + DPRINT1("BaseSrvDefineDosDevice entered, Flags:%d, DeviceName:%wZ (%d), TargetPath:%wZ (%d)\n", DefineDosDeviceRequest->Flags, &DefineDosDeviceRequest->DeviceName, - &DefineDosDeviceRequest->TargetPath); - - Matched = AddHistory = FALSE; - HistoryEntry = NULL; - AdminSid = SystemSid = WorldSid = NULL; - SecurityDescriptor = NULL; - ListHead = &DosDeviceHistory; - dwFlags = DefineDosDeviceRequest->Flags; - - /* Validate the flags */ - if ( (dwFlags & 0xFFFFFFF0) || - ((dwFlags & DDD_EXACT_MATCH_ON_REMOVE) && - !(dwFlags & DDD_REMOVE_DEFINITION)) ) + DefineDosDeviceRequest->DeviceName.Length, + &DefineDosDeviceRequest->TargetPath, + DefineDosDeviceRequest->TargetPath.Length); + + /* + * Allocate a buffer big enough to contain: + * - device name + * - targets + */ + lpBuffer = RtlAllocateHeap(BaseSrvHeap, 0, 0x2000); + if (lpBuffer == NULL) { - return STATUS_INVALID_PARAMETER; + return STATUS_NO_MEMORY; } + /* Enter our critical section */ Status = RtlEnterCriticalSection(&BaseDefineDosDeviceCritSec); if (!NT_SUCCESS(Status)) { DPRINT1("RtlEnterCriticalSection() failed (Status %lx)\n", Status); + RtlFreeHeap(BaseSrvHeap, 0, lpBuffer); return Status; } + LinkHandle = 0; + /* Does the caller wants to remove definition? */ + RemoveDefinition = !!(DefineDosDeviceRequest->Flags & DDD_REMOVE_DEFINITION); _SEH2_TRY { - Status = - RtlUpcaseUnicodeString(&RequestDeviceName, - &DefineDosDeviceRequest->DeviceName, - TRUE); - if (!NT_SUCCESS(Status)) - _SEH2_LEAVE; + /* First of all, check if that's a drive letter device amongst LUID mappings */ + if (BaseStaticServerData->LUIDDeviceMapsEnabled && !(DefineDosDeviceRequest->Flags & DDD_NO_BROADCAST_SYSTEM)) + { + if (DefineDosDeviceRequest->DeviceName.Buffer != NULL && + DefineDosDeviceRequest->DeviceName.Length == 2 * sizeof(WCHAR) && + DefineDosDeviceRequest->DeviceName.Buffer[1] == L':') + { + Letter = DefineDosDeviceRequest->DeviceName.Buffer[0]; + + /* Handle both lower cases and upper cases */ + AbsLetter = Letter - L'a'; + if (AbsLetter < 26 && AbsLetter >= 0) + { + Letter = RtlUpcaseUnicodeChar(Letter); + } - RequestLinkTarget = &DefineDosDeviceRequest->TargetPath; - lpBuffer = (PWSTR)RtlAllocateHeap(BaseSrvHeap, - HEAP_ZERO_MEMORY, - RequestDeviceName.MaximumLength + 5 * sizeof(WCHAR)); - if (!lpBuffer) + AbsLetter = Letter - L'A'; + if (AbsLetter < 26) + { + /* That's a letter! */ + DriveLetter = TRUE; + } + } + } + + /* We can only broadcast drive letters in case of LUID mappings */ + if (DefineDosDeviceRequest->Flags & DDD_LUID_BROADCAST_DRIVE && + !DriveLetter) { - DPRINT1("Failed to allocate memory\n"); - Status = STATUS_NO_MEMORY; + Status = STATUS_INVALID_PARAMETER; _SEH2_LEAVE; } - swprintf(lpBuffer, - L"\\??\\%wZ", - &RequestDeviceName); - RtlInitUnicodeString(&DeviceName, - lpBuffer); + /* First usage of our buffer: create device name */ + CchLength = _snwprintf(lpBuffer, 0x1000, L"\\??\\%wZ", &DefineDosDeviceRequest->DeviceName); + CchLengthLeft = 0x1000 - 1 - CchLength; /* UNICODE_NULL */ + CurrentBuffer = lpBuffer + CchLength + 1; /* UNICODE_NULL */ + RtlInitUnicodeString(&DeviceName, lpBuffer); + + /* And prepare to open it */ InitializeObjectAttributes(&ObjectAttributes, &DeviceName, OBJ_CASE_INSENSITIVE, NULL, NULL); + + /* Assume it's OK and has a target to deal with */ + HandleTarget = TRUE; + + /* Move to the client context if the mapping was local */ + if (!CsrImpersonateClient(NULL)) + { + Status = STATUS_BAD_IMPERSONATION_LEVEL; + _SEH2_LEAVE; + } + + /* While impersonating the caller, also get its LUID */ + if (DriveLetter) + { + Status = GetCallerLuid(&CallerLuid); + if (NT_SUCCESS(Status)) + { + HandleSMB = TRUE; + } + } + + /* Now, open the device */ Status = NtOpenSymbolicLinkObject(&LinkHandle, - DELETE | 0x1, + DELETE | SYMBOLIC_LINK_QUERY, &ObjectAttributes); - if (NT_SUCCESS(Status)) + + /* And get back to our context */ + CsrRevertToSelf(); + + /* In case of LUID broadcast, do nothing but return to trigger broadcast */ + if (DefineDosDeviceRequest->Flags & DDD_LUID_BROADCAST_DRIVE) { - Status = NtQuerySymbolicLinkObject(LinkHandle, - &LinkTarget, - &Length); - if (!NT_SUCCESS(Status) && - Status == STATUS_BUFFER_TOO_SMALL) + /* Zero handle in case of a failure */ + if (!NT_SUCCESS(Status)) { - LinkTarget.Length = 0; - LinkTarget.MaximumLength = Length; - LinkTarget.Buffer = (PWSTR) - RtlAllocateHeap(BaseSrvHeap, - HEAP_ZERO_MEMORY, - Length); - if (!LinkTarget.Buffer) + LinkHandle = 0; + } + + /* If removal was asked, and no object found: the remval was successful */ + if (RemoveDefinition && Status == STATUS_OBJECT_NAME_NOT_FOUND) + { + Status = STATUS_SUCCESS; + } + + /* We're done here, nothing more to do */ + _SEH2_LEAVE; + } + + /* If device was not found */ + if (Status == STATUS_OBJECT_NAME_NOT_FOUND) + { + /* No handle */ + LinkHandle = 0; + + /* If we were asked to remove... */ + if (RemoveDefinition) + { + /* + * If caller asked to pop first entry, nothing specific, + * then, we can consider this as a success + */ + if (DefineDosDeviceRequest->TargetPath.Length == 0) { - DPRINT1("Failed to allocate memory\n"); - Status = STATUS_NO_MEMORY; - _SEH2_LEAVE; + Status = STATUS_SUCCESS; } - Status = NtQuerySymbolicLinkObject(LinkHandle, - &LinkTarget, - &Length); + /* We're done, nothing to change */ + _SEH2_LEAVE; } + /* There's no target to handle */ + HandleTarget = FALSE; + + /* + * We'll consider, that's a success + * Failing to open the device doesn't prevent + * from creating it later on to create + * the linking. + */ + Status = STATUS_SUCCESS; + } + else + { + /* Unexpected failure, forward to caller */ if (!NT_SUCCESS(Status)) { - DPRINT1("NtQuerySymbolicLinkObject(%wZ) failed (Status %lx)\n", - &DeviceName, Status); _SEH2_LEAVE; } - if ((dwFlags & DDD_REMOVE_DEFINITION)) + /* If LUID mapping enabled */ + if (BaseStaticServerData->LUIDDeviceMapsEnabled) { - /* If no target name specified we remove the current symlink target */ - if (RequestLinkTarget->Length == 0) - Matched = TRUE; - else - { - if (dwFlags & DDD_EXACT_MATCH_ON_REMOVE) - Matched = !RtlCompareUnicodeString(RequestLinkTarget, - &LinkTarget, - TRUE); - else - Matched = RtlPrefixUnicodeString(RequestLinkTarget, - &LinkTarget, - TRUE); - } - - if (Matched && IsListEmpty(ListHead)) + /* Check if that's global link */ + Status = IsGlobalSymbolicLink(LinkHandle, &IsGlobal); + if (!NT_SUCCESS(Status)) { - /* Current symlink target macthed and there is nothing to revert to */ - RequestLinkTarget = NULL; + _SEH2_LEAVE; } - else if (Matched && !IsListEmpty(ListHead)) - { - /* - * Fetch the first history entry we come across for the device name. - * This will become the current symlink target for the device name. - */ - Matched = FALSE; - Entry = ListHead->Flink; - while (Entry != ListHead) - { - HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY) - CONTAINING_RECORD(Entry, - BASE_DOS_DEVICE_HISTORY_ENTRY, - Entry); - Matched = - !RtlCompareUnicodeString(&RequestDeviceName, - &HistoryEntry->Device, - FALSE); - if (Matched) - { - RemoveEntryList(&HistoryEntry->Entry); - RequestLinkTarget = &HistoryEntry->Target; - break; - } - Entry = Entry->Flink; - HistoryEntry = NULL; - } - /* Nothing to revert to so delete the symlink */ - if (!Matched) - RequestLinkTarget = NULL; - } - else if (!Matched) + /* If so, change our device name namespace to GLOBAL?? for link creation */ + if (IsGlobal) { - /* - * Locate a previous symlink target as we did not get - * a hit earlier. If we find one we need to remove it. - */ - Entry = ListHead->Flink; - while (Entry != ListHead) - { - HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY) - CONTAINING_RECORD(Entry, - BASE_DOS_DEVICE_HISTORY_ENTRY, - Entry); - Matched = - !RtlCompareUnicodeString(&RequestDeviceName, - &HistoryEntry->Device, - FALSE); - if (!Matched) - { - HistoryEntry = NULL; - Entry = Entry->Flink; - continue; - } - - Matched = FALSE; - if (dwFlags & DDD_EXACT_MATCH_ON_REMOVE) - { - if (!RtlCompareUnicodeString(RequestLinkTarget, - &HistoryEntry->Target, - TRUE)) - { - Matched = TRUE; - } - } - else if (RtlPrefixUnicodeString(RequestLinkTarget, - &HistoryEntry->Target, - TRUE)) - { - Matched = TRUE; - } - - if (Matched) - { - RemoveEntryList(&HistoryEntry->Entry); - break; - } - Entry = Entry->Flink; - HistoryEntry = NULL; - } + CchLength = _snwprintf(lpBuffer, 0x1000, L"\\GLOBAL??\\%wZ", &DefineDosDeviceRequest->DeviceName); + CchLengthLeft = 0x1000 - 1 - CchLength; /* UNICODE_NULL */ + CurrentBuffer = lpBuffer + CchLength + 1; /* UNICODE_NULL */ - /* Leave existing symlink as is */ - if (!Matched) - Status = STATUS_OBJECT_NAME_NOT_FOUND; - else - Status = STATUS_SUCCESS; - _SEH2_LEAVE; + DeviceName.Length = CchLength * sizeof(WCHAR); + DeviceName.MaximumLength = CchLength * sizeof(WCHAR) + sizeof(UNICODE_NULL); } } - else + } + + /* If caller provided a target */ + if (DefineDosDeviceRequest->TargetPath.Length != 0) + { + /* Make sure it's null terminated */ + DefineDosDeviceRequest->TargetPath.Buffer[DefineDosDeviceRequest->TargetPath.Length / sizeof(WCHAR)] = UNICODE_NULL; + + /* Compute its size */ + TargetLength = wcslen(DefineDosDeviceRequest->TargetPath.Buffer); + + /* And make sure it fits our buffer */ + if (TargetLength + 1 >= CchLengthLeft) { - AddHistory = TRUE; + Status = STATUS_INVALID_PARAMETER; + _SEH2_LEAVE; } - Status = NtMakeTemporaryObject(LinkHandle); + /* Copy it to our internal buffer */ + RtlMoveMemory(CurrentBuffer, DefineDosDeviceRequest->TargetPath.Buffer, TargetLength * sizeof(WCHAR) + sizeof(UNICODE_NULL)); + TargetBuffer = CurrentBuffer; + + /* Update our buffer status */ + CchLengthLeft -= (TargetLength + 1); + CurrentBuffer += (TargetLength + 1); + } + /* Otherwise, zero everything */ + else + { + TargetBuffer = NULL; + TargetLength = 0; + } + + /* If we opened the device, then, handle its current target */ + if (HandleTarget) + { + /* Query it with our internal buffer */ + LinkTarget.Length = 0; + LinkTarget.MaximumLength = CchLengthLeft * sizeof(WCHAR); + LinkTarget.Buffer = CurrentBuffer; + + Status = NtQuerySymbolicLinkObject(LinkHandle, + &LinkTarget, + &Length); + /* If we overflow, give up */ + if (Length == LinkTarget.MaximumLength) + { + Status = STATUS_BUFFER_OVERFLOW; + } + /* In case of a failure, bye bye */ if (!NT_SUCCESS(Status)) { - DPRINT1("NtMakeTemporaryObject(%wZ) failed (Status %lx)\n", - &DeviceName, Status); _SEH2_LEAVE; } - Status = NtClose(LinkHandle); - LinkHandle = NULL; - if (!NT_SUCCESS(Status)) + /* + * Properly null it for MULTI_SZ if needed + * Always update max length with + * the need size + * This is needed to hand relatively "small" + * strings to Ob and avoid killing ourselves + * on the next query + */ + CchLength = Length / sizeof(WCHAR); + if (CchLength < 2 || + CurrentBuffer[CchLength - 2] != UNICODE_NULL || + CurrentBuffer[CchLength - 1] != UNICODE_NULL) { - DPRINT1("NtClose(%wZ) failed (Status %lx)\n", - &DeviceName, Status); - _SEH2_LEAVE; + CurrentBuffer[CchLength] = UNICODE_NULL; + LinkTarget.MaximumLength = Length + sizeof(UNICODE_NULL); + } + else + { + LinkTarget.MaximumLength = Length; } } + /* There's no target, and we're asked to remove, so null target */ + else if (RemoveDefinition) + { + RtlInitUnicodeString(&LinkTarget, NULL); + } + /* There's a target provided - new device, update buffer */ + else + { + RtlInitUnicodeString(&LinkTarget, &CurrentBuffer[-TargetLength - 1]); + } + + /* + * We no longer need old symlink, just drop it, we'll recreate it now + * with updated target. + * The benefit of it is that if caller asked us to drop last target, then + * the device is removed and not dangling + */ + if (LinkHandle != 0) + { + Status = NtMakeTemporaryObject(LinkHandle); + NtClose(LinkHandle); + LinkHandle = 0; + } - /* Don't create symlink if we don't have a target */ - if (!RequestLinkTarget || RequestLinkTarget->Length == 0) + /* At this point, we must have no failure */ + if (!NT_SUCCESS(Status)) + { _SEH2_LEAVE; + } - if (AddHistory) + /* + * If we have to remove definition, let's start to browse our + * target to actually drop it. + */ + if (RemoveDefinition) { - HistoryEntry = (PBASE_DOS_DEVICE_HISTORY_ENTRY) - RtlAllocateHeap(BaseSrvHeap, - HEAP_ZERO_MEMORY, - sizeof(BASE_DOS_DEVICE_HISTORY_ENTRY)); - if (!HistoryEntry) + /* We'll browse our multi sz string */ + RemoveFound = FALSE; + CurrentPtr = LinkTarget.Buffer; + InterPtr = LinkTarget.Buffer; + while (*CurrentPtr != UNICODE_NULL) { - DPRINT1("Failed to allocate memory\n"); - Status = STATUS_NO_MEMORY; - _SEH2_LEAVE; - } + CchLength = 0; + OrigPtr = CurrentPtr; + /* First, find next string */ + while (TRUE) + { + CurrentChar = *CurrentPtr; + ++CurrentPtr; - HistoryEntry->Target.Buffer = - RtlAllocateHeap(BaseSrvHeap, - HEAP_ZERO_MEMORY, - LinkTarget.Length); - if (!HistoryEntry->Target.Buffer) - { - DPRINT1("Failed to allocate memory\n"); - Status = STATUS_NO_MEMORY; - _SEH2_LEAVE; + if (CurrentChar == UNICODE_NULL) + { + break; + } + + ++CchLength; + } + + /* This check is a bit tricky, but dead useful: + * If on the previous loop, we found the caller provided target + * in our list, then, we'll move current entry over the found one + * So that, it gets deleted. + * Also, if we don't find caller entry in our entries, then move + * current entry in the string if a previous one got deleted + */ + if (RemoveFound || + ((!(DefineDosDeviceRequest->Flags & DDD_EXACT_MATCH_ON_REMOVE) || + TargetLength != CchLength || _wcsicmp(OrigPtr, TargetBuffer) != 0) && + ((DefineDosDeviceRequest->Flags & DDD_EXACT_MATCH_ON_REMOVE) || + (TargetLength != 0 && _wcsnicmp(OrigPtr, TargetBuffer, TargetLength) != 0)))) + { + if (InterPtr != OrigPtr) + { + RtlMoveMemory(InterPtr, OrigPtr, sizeof(WCHAR) * CchLength + sizeof(UNICODE_NULL)); + } + + InterPtr += (CchLength + 1); + } + else + { + /* Match case! Remember for next loop turn and to delete it */ + RemoveFound = TRUE; + } } - HistoryEntry->Target.Length = - HistoryEntry->Target.MaximumLength = - LinkTarget.Length; - RtlCopyUnicodeString(&HistoryEntry->Target, - &LinkTarget); - - HistoryEntry->Device.Buffer = - RtlAllocateHeap(BaseSrvHeap, - HEAP_ZERO_MEMORY, - RequestDeviceName.Length); - if (!HistoryEntry->Device.Buffer) + + /* + * Drop last entry, as required (pop) + * If there was a match previously, everything + * is already moved, so we're just nulling + * the end of the string + * If there was no match, this is the pop + */ + *InterPtr = UNICODE_NULL; + ++InterPtr; + + /* Compute new target length */ + TargetLength = wcslen(LinkTarget.Buffer) * sizeof(WCHAR); + /* + * If it's empty, quit + * Beware, here, we quit with STATUS_SUCCESS, and that's expected! + * In case we dropped last target entry, then, it's empty + * and there's no need to recreate the device we deleted previously + */ + if (TargetLength == 0) { - DPRINT1("Failed to allocate memory\n"); - Status = STATUS_NO_MEMORY; _SEH2_LEAVE; } - HistoryEntry->Device.Length = - HistoryEntry->Device.MaximumLength = - RequestDeviceName.Length; - RtlCopyUnicodeString(&HistoryEntry->Device, - &RequestDeviceName); - - /* Remember previous symlink target for this device */ - InsertHeadList(ListHead, - &HistoryEntry->Entry); - HistoryEntry = NULL; - } - RtlAllocateAndInitializeSid(&WorldAuthority, - 1, - SECURITY_WORLD_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - &WorldSid); - - RtlAllocateAndInitializeSid(&SystemAuthority, - 1, - SECURITY_LOCAL_SYSTEM_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - &SystemSid); - - RtlAllocateAndInitializeSid(&SystemAuthority, - 2, - SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - SECURITY_NULL_RID, - &AdminSid); - - SidLength = RtlLengthSid(SystemSid) + - RtlLengthSid(AdminSid) + - RtlLengthSid(WorldSid); - Length = sizeof(ACL) + SidLength + 3 * sizeof(ACCESS_ALLOWED_ACE); - - SecurityDescriptor = RtlAllocateHeap(BaseSrvHeap, - 0, - SECURITY_DESCRIPTOR_MIN_LENGTH + Length); - if (!SecurityDescriptor) + /* Update our target string */ + LinkTarget.Length = TargetLength; + LinkTarget.MaximumLength = (ULONG_PTR)InterPtr - (ULONG_PTR)LinkTarget.Buffer; + } + /* If that's not a removal, just update the target to include new target */ + else if (HandleTarget) { - DPRINT1("Failed to allocate memory\n"); - Status = STATUS_NO_MEMORY; - _SEH2_LEAVE; + LinkTarget.Buffer = LinkTarget.Buffer - TargetLength - 1; + LinkTarget.Length = TargetLength * sizeof(WCHAR); + LinkTarget.MaximumLength += (TargetLength * sizeof(WCHAR) + sizeof(UNICODE_NULL)); + TargetLength *= sizeof(WCHAR); + } + /* No changes */ + else + { + TargetLength = LinkTarget.Length; } - Dacl = (PACL)((ULONG_PTR)SecurityDescriptor + SECURITY_DESCRIPTOR_MIN_LENGTH); - Status = RtlCreateSecurityDescriptor(SecurityDescriptor, - SECURITY_DESCRIPTOR_REVISION); - if (!NT_SUCCESS(Status)) + /* Make sure we don't create empty symlink */ + if (TargetLength == 0) { - DPRINT1("RtlCreateSecurityDescriptor() failed (Status %lx)\n", Status); _SEH2_LEAVE; } - Status = RtlCreateAcl(Dacl, - Length, - ACL_REVISION); + /* Initialize our SIDs for symlink ACLs */ + Status = RtlAllocateAndInitializeSid(&WorldAuthority, + 1, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + &WorldSid); if (!NT_SUCCESS(Status)) { - DPRINT1("RtlCreateAcl() failed (Status %lx)\n", Status); _SEH2_LEAVE; } - RtlAddAccessAllowedAce(Dacl, - ACL_REVISION, - GENERIC_ALL, - SystemSid); - RtlAddAccessAllowedAce(Dacl, - ACL_REVISION, - GENERIC_ALL, - AdminSid); - RtlAddAccessAllowedAce(Dacl, - ACL_REVISION, - STANDARD_RIGHTS_READ, - WorldSid); - - Status = RtlSetDaclSecurityDescriptor(SecurityDescriptor, - TRUE, - Dacl, - FALSE); + Status = RtlAllocateAndInitializeSid(&SystemAuthority, + 1, + SECURITY_RESTRICTED_CODE_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + SECURITY_NULL_RID, + &SystemSid); if (!NT_SUCCESS(Status)) { - DPRINT1("RtlSetDaclSecurityDescriptor() failed (Status %lx)\n", Status); + RtlFreeSid(WorldSid); _SEH2_LEAVE; } - InitializeObjectAttributes(&ObjectAttributes, - &DeviceName, - OBJ_CASE_INSENSITIVE, - NULL, - SecurityDescriptor); - Status = NtCreateSymbolicLinkObject(&LinkHandle, - SYMBOLIC_LINK_ALL_ACCESS, - &ObjectAttributes, - RequestLinkTarget); - if (NT_SUCCESS(Status)) + /* Initialize our SD (on stack) */ + RtlCreateSecurityDescriptor(&SecurityDescriptor, + SECURITY_DESCRIPTOR_REVISION); + + /* And our ACL (still on stack) */ + RtlCreateAcl(&Dacl.Dacl, sizeof(Dacl), ACL_REVISION); + + /* + * For access mask, if we have no session ID, or if + * protection mode is disabled, make them wide open + */ + if (SessionId == 0 || + (ProtectionMode & 3) == 0) { - Status = NtMakePermanentObject(LinkHandle); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtMakePermanentObject(%wZ) failed (Status %lx)\n", - &DeviceName, Status); - } + AccessMask = DELETE | SYMBOLIC_LINK_QUERY; } else { - DPRINT1("NtCreateSymbolicLinkObject(%wZ) failed (Status %lx)\n", - &DeviceName, Status); - } - } - _SEH2_FINALLY - { - RtlLeaveCriticalSection(&BaseDefineDosDeviceCritSec); - if (DeviceName.Buffer) - { - RtlFreeHeap(BaseSrvHeap, - 0, - DeviceName.Buffer); + AccessMask = SYMBOLIC_LINK_QUERY; } - if (LinkTarget.Buffer) + + /* Setup the ACL */ + RtlAddAccessAllowedAce(&Dacl.Dacl, ACL_REVISION2, AccessMask, WorldSid); + RtlAddAccessAllowedAce(&Dacl.Dacl, ACL_REVISION2, AccessMask, SystemSid); + + /* Drop SIDs */ + RtlFreeSid(WorldSid); + RtlFreeSid(SystemSid); + + /* Link DACL to the SD */ + RtlSetDaclSecurityDescriptor(&SecurityDescriptor, TRUE, &Dacl.Dacl, TRUE); + + /* And set it in the OA used for creation */ + ObjectAttributes.SecurityDescriptor = &SecurityDescriptor; + + /* + * If LUID and not global, we need to impersonate the caller + * to make it local. + */ + if (BaseStaticServerData->LUIDDeviceMapsEnabled) { - RtlFreeHeap(BaseSrvHeap, - 0, - LinkTarget.Buffer); + if (!IsGlobal) + { + if (!CsrImpersonateClient(NULL)) + { + Status = STATUS_BAD_IMPERSONATION_LEVEL; + _SEH2_LEAVE; + } + } } - if (SecurityDescriptor) + /* The object will be permanent */ + else { - RtlFreeHeap(BaseSrvHeap, - 0, - SecurityDescriptor); + ObjectAttributes.Attributes |= OBJ_PERMANENT; } - if (LinkHandle) NtClose(LinkHandle); - if (SystemSid) RtlFreeSid(SystemSid); - if (AdminSid) RtlFreeSid(AdminSid); - if (WorldSid) RtlFreeSid(WorldSid); + /* (Re)Create the symbolic link/device */ + Status = NtCreateSymbolicLinkObject(&LinkHandle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes, + &LinkTarget); - RtlFreeUnicodeString(&RequestDeviceName); + /* Revert to self if required */ + if (BaseStaticServerData->LUIDDeviceMapsEnabled && !IsGlobal) + { + CsrRevertToSelf(); + } - if (HistoryEntry) + /* In case of a success, make object permanent for LUID links */ + if (NT_SUCCESS(Status)) { - if (HistoryEntry->Target.Buffer) + if (BaseStaticServerData->LUIDDeviceMapsEnabled) { - RtlFreeHeap(BaseSrvHeap, - 0, - HistoryEntry->Target.Buffer); + Status = NtMakePermanentObject(LinkHandle); } - if (HistoryEntry->Device.Buffer) + + /* Close the link */ + NtClose(LinkHandle); + + /* + * Specific failure case here: + * We were asked to remove something + * but we didn't find the something + * (we recreated the symlink hence the fail here!) + * so fail with appropriate status + */ + if (RemoveDefinition && !RemoveFound) { - RtlFreeHeap(BaseSrvHeap, - 0, - HistoryEntry->Device.Buffer); + Status = STATUS_OBJECT_NAME_NOT_FOUND; } - RtlFreeHeap(BaseSrvHeap, - 0, - HistoryEntry); } + + /* We closed link, don't double close */ + LinkHandle = 0; + } + _SEH2_FINALLY + { + /* If we need to close the link, do it now */ + if (LinkHandle != 0) + { + NtClose(LinkHandle); + } + + /* Free our internal buffer */ + RtlFreeHeap(BaseSrvHeap, 0, lpBuffer); + + /* Handle SMB */ + if (DriveLetter && Status == STATUS_SUCCESS && HandleSMB) + { + UNIMPLEMENTED; + } + + /* Done! */ + RtlLeaveCriticalSection(&BaseDefineDosDeviceCritSec); } - _SEH2_END + _SEH2_END; - DPRINT("BaseSrvDefineDosDevice exit, Status: 0x%x\n", Status); return Status; }
5 years, 7 months
1
0
0
0
[reactos] 03/04: [KERNEL32] Drop unused line breaks
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ea7aca8bdd0f1aab0a2da…
commit ea7aca8bdd0f1aab0a2da9c27bc877aeb23de825 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Wed May 8 18:13:30 2019 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Wed May 8 18:34:28 2019 +0200 [KERNEL32] Drop unused line breaks --- dll/win32/kernel32/client/dosdev.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/dll/win32/kernel32/client/dosdev.c b/dll/win32/kernel32/client/dosdev.c index 3c569ec76e..c6045625de 100644 --- a/dll/win32/kernel32/client/dosdev.c +++ b/dll/win32/kernel32/client/dosdev.c @@ -76,8 +76,6 @@ IsGlobalDeviceMap( *IsGlobal = RtlEqualUnicodeString(&GlobalString, &PNameInfo->Name, FALSE); Status = STATUS_SUCCESS; } - - } } _SEH2_FINALLY
5 years, 7 months
1
0
0
0
[reactos] 02/04: [BASESRV] Enable the ProtectionMode query code And make it global
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=eea0beca35e54507f5261…
commit eea0beca35e54507f5261d85871b6bd70e4a5d1e Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Tue May 7 22:48:41 2019 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Wed May 8 18:34:28 2019 +0200 [BASESRV] Enable the ProtectionMode query code And make it global --- subsystems/win/basesrv/basesrv.h | 4 ++++ subsystems/win/basesrv/init.c | 6 +----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/subsystems/win/basesrv/basesrv.h b/subsystems/win/basesrv/basesrv.h index e9abac970d..03ebb9c8e3 100644 --- a/subsystems/win/basesrv/basesrv.h +++ b/subsystems/win/basesrv/basesrv.h @@ -65,5 +65,9 @@ extern HANDLE BaseSrvHeap; extern HANDLE BaseSrvSharedHeap; extern PBASE_STATIC_SERVER_DATA BaseStaticServerData; extern ULONG SessionId; +extern ULONG ProtectionMode; + +#define SM_REG_KEY \ + L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Session Manager" #endif /* __BASESRV_H__ */ diff --git a/subsystems/win/basesrv/init.c b/subsystems/win/basesrv/init.c index 00aa891734..87514d96b4 100644 --- a/subsystems/win/basesrv/init.c +++ b/subsystems/win/basesrv/init.c @@ -30,6 +30,7 @@ HANDLE BaseSrvSharedHeap = NULL; // Shared heap with CSR. (CsrSrvSharedSectio PBASE_STATIC_SERVER_DATA BaseStaticServerData = NULL; // Data that we can share amongst processes. Initialized inside BaseSrvSharedHeap. ULONG SessionId = 0; +ULONG ProtectionMode = 0; PINIFILE_MAPPING BaseSrvIniFileMapping; @@ -177,14 +178,10 @@ CreateBaseAcls(OUT PACL* Dacl, SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; NTSTATUS Status; -#if 0 // Unused code UCHAR KeyValueBuffer[0x40]; PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo; UNICODE_STRING KeyName; - ULONG ProtectionMode = 0; -#endif ULONG AclLength; -#if 0 // Unused code ULONG ResultLength; HANDLE hKey; OBJECT_ATTRIBUTES ObjectAttributes; @@ -220,7 +217,6 @@ CreateBaseAcls(OUT PACL* Dacl, /* Close the handle */ NtClose(hKey); } -#endif /* Allocate the System SID */ Status = RtlAllocateAndInitializeSid(&NtAuthority,
5 years, 7 months
1
0
0
0
[reactos] 01/04: [BASESRV] Make SessionId global
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6e4f0365e3878dea91ea2…
commit 6e4f0365e3878dea91ea21bf8c268803b9ad5ce6 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Tue May 7 22:41:30 2019 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Wed May 8 18:34:28 2019 +0200 [BASESRV] Make SessionId global --- subsystems/win/basesrv/basesrv.h | 1 + subsystems/win/basesrv/init.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/subsystems/win/basesrv/basesrv.h b/subsystems/win/basesrv/basesrv.h index 7e30f4a0ac..e9abac970d 100644 --- a/subsystems/win/basesrv/basesrv.h +++ b/subsystems/win/basesrv/basesrv.h @@ -64,5 +64,6 @@ typedef NTSTATUS (WINAPI *PCREATE_NLS_SECURTY_DESCRIPTOR)(IN PVOID Buffer, extern HANDLE BaseSrvHeap; extern HANDLE BaseSrvSharedHeap; extern PBASE_STATIC_SERVER_DATA BaseStaticServerData; +extern ULONG SessionId; #endif /* __BASESRV_H__ */ diff --git a/subsystems/win/basesrv/init.c b/subsystems/win/basesrv/init.c index d022988ad1..00aa891734 100644 --- a/subsystems/win/basesrv/init.c +++ b/subsystems/win/basesrv/init.c @@ -29,6 +29,8 @@ HANDLE BaseSrvHeap = NULL; // Our own heap. HANDLE BaseSrvSharedHeap = NULL; // Shared heap with CSR. (CsrSrvSharedSectionHeap) PBASE_STATIC_SERVER_DATA BaseStaticServerData = NULL; // Data that we can share amongst processes. Initialized inside BaseSrvSharedHeap. +ULONG SessionId = 0; + PINIFILE_MAPPING BaseSrvIniFileMapping; // Windows Server 2003 table from
http://j00ru.vexillium.org/csrss_list/api_list.html#Windows_2k3
@@ -301,7 +303,6 @@ BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll) UNICODE_STRING BaseSrvWindowsSystemDirectory; UNICODE_STRING BnoString; OBJECT_ATTRIBUTES ObjectAttributes; - ULONG SessionId; HANDLE BaseSrvNamedObjectDirectory; HANDLE BaseSrvRestrictedObjectDirectory; PACL BnoDacl, BnoRestrictedDacl;
5 years, 7 months
1
0
0
0
← Newer
1
...
8
9
10
11
12
13
14
...
17
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Results per page:
10
25
50
100
200