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
June 2022
----- 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
236 discussions
Start a n
N
ew thread
[reactos] 01/01: [DESK] Pass the list of all display modes to extensions
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=994e2f289e6cfaf94937f…
commit 994e2f289e6cfaf94937f83c9eee959dabc5c6f5 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Mon Jun 20 04:52:04 2022 +0300 Commit: Stanislav Motylkov <x86corez(a)gmail.com> CommitDate: Mon Jun 20 14:38:03 2022 +0300 [DESK] Pass the list of all display modes to extensions Also implement mode switching from adapter advanced settings. --- dll/cpl/desk/desk.h | 3 + dll/cpl/desk/devsett.c | 183 +++++++++++++++++++++++++++++--- dll/cpl/desk/settings.c | 120 ++++++++++++++------- sdk/include/reactos/dll/desk/deskcplx.h | 2 +- 4 files changed, 256 insertions(+), 52 deletions(-) diff --git a/dll/cpl/desk/desk.h b/dll/cpl/desk/desk.h index 3c479251cfe..36470ffe8a3 100644 --- a/dll/cpl/desk/desk.h +++ b/dll/cpl/desk/desk.h @@ -122,6 +122,9 @@ HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY,LPCWSTR,UINT,IDataObject*); INT_PTR CALLBACK AdvGeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +BOOL +SwitchDisplayMode(HWND hwndDlg, PWSTR DeviceName, PSETTINGS_ENTRY seInit, PSETTINGS_ENTRY seNew, OUT PLONG rc); + LONG RegLoadMUIStringW(IN HKEY hKey, IN LPCWSTR pszValue OPTIONAL, diff --git a/dll/cpl/desk/devsett.c b/dll/cpl/desk/devsett.c index dc801f4c624..d48c9493440 100644 --- a/dll/cpl/desk/devsett.c +++ b/dll/cpl/desk/devsett.c @@ -38,6 +38,10 @@ typedef struct _CDevSettings DESK_EXT_INTERFACE ExtInterface; + PDEVMODEW lpOrigDevMode; + PDEVMODEW lpCurDevMode; + PDEVMODEW * DevModes; + DWORD nDevModes; DWORD StateFlags; union @@ -285,28 +289,63 @@ PDEVMODEW DESK_EXT_CALLBACK CDevSettings_EnumAllModes(PVOID Context, DWORD Index) { - //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context); - /* FIXME: Implement */ + PCDevSettings This = impl_from_IDataObject((IDataObject *)Context); + DWORD i, idx = 0; + DPRINT1("CDevSettings::EnumAllModes(%u)\n", Index); + + if (!This->DevModes) + return NULL; + + for (i = 0; i < This->nDevModes; i++) + { + /* FIXME: Add more sanity checks */ + if (!This->DevModes[i]) + continue; + + if (idx == Index) + return This->DevModes[i]; + + idx++; + } + return NULL; } PDEVMODEW DESK_EXT_CALLBACK CDevSettings_GetCurrentMode(PVOID Context) { - //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context); - /* FIXME: Implement */ + PCDevSettings This = impl_from_IDataObject((IDataObject *)Context); + DPRINT1("CDevSettings::GetCurrentMode\n"); - return NULL; + return This->lpCurDevMode; } BOOL DESK_EXT_CALLBACK CDevSettings_SetCurrentMode(PVOID Context, - const DEVMODEW *pDevMode) + DEVMODEW *pDevMode) { - //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context); - /* FIXME: Implement */ + PCDevSettings This = impl_from_IDataObject((IDataObject *)Context); + DWORD i; + DPRINT1("CDevSettings::SetCurrentMode(0x%p)\n", pDevMode); + + if (!This->DevModes) + return FALSE; + + for (i = 0; i < This->nDevModes; i++) + { + /* FIXME: Add more sanity checks */ + if (!This->DevModes[i]) + continue; + + if (This->DevModes[i] == pDevMode) + { + This->lpCurDevMode = pDevMode; + return TRUE; + } + } + return FALSE; } @@ -455,7 +494,13 @@ pCDevSettings_Initialize(PCDevSettings This, PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo) { HKEY hKey; + DWORD i = 0, dwSize; + DEVMODEW devmode; + This->lpOrigDevMode = NULL; + This->lpCurDevMode = NULL; + This->DevModes = NULL; + This->nDevModes = 0; This->Flags = 0; This->StateFlags = DisplayDeviceInfo->DeviceStateFlags; DPRINT1("This->StateFlags: %x\n", This->StateFlags); @@ -498,7 +543,7 @@ pCDevSettings_Initialize(PCDevSettings This, if (hKey != NULL) { DWORD dw = 0; - DWORD dwType, dwSize; + DWORD dwType; dwSize = sizeof(dw); if (RegQueryValueEx(hKey, @@ -515,6 +560,80 @@ pCDevSettings_Initialize(PCDevSettings This, RegCloseKey(hKey); } + /* Initialize display modes */ + ZeroMemory(&devmode, sizeof(devmode)); + devmode.dmSize = (WORD)sizeof(devmode); + while (EnumDisplaySettingsExW(This->pDisplayDevice, i, &devmode, EDS_RAWMODE)) + { + dwSize = devmode.dmSize + devmode.dmDriverExtra; + PDEVMODEW pDevMode = LocalAlloc(LMEM_FIXED, dwSize); + PDEVMODEW * DevModesNew = NULL; + + if (pDevMode) + { + CopyMemory(pDevMode, + &devmode, + dwSize); + + dwSize = (This->nDevModes + 1) * sizeof(pDevMode); + DevModesNew = LocalAlloc(LMEM_FIXED, dwSize); + if (DevModesNew) + { + if (This->DevModes) + { + CopyMemory(DevModesNew, + This->DevModes, + This->nDevModes * sizeof(pDevMode)); + + LocalFree(This->DevModes); + } + + This->DevModes = DevModesNew; + This->DevModes[This->nDevModes++] = pDevMode; + } + else + { + DPRINT1("LocalAlloc failed to allocate %d bytes\n", dwSize); + return E_OUTOFMEMORY; + } + } + else + { + DPRINT1("LocalAlloc failed to allocate %d bytes\n", dwSize); + return E_OUTOFMEMORY; + } + + devmode.dmDriverExtra = 0; + i++; + } + + /* FIXME: Detect duplicated modes and mark them. + * Enumeration functions should check these marks + * and skip corresponding array entries. */ + + /* Get current display mode */ + ZeroMemory(&devmode, sizeof(devmode)); + devmode.dmSize = (WORD)sizeof(devmode); + if (EnumDisplaySettingsExW(This->pDisplayDevice, ENUM_CURRENT_SETTINGS, &devmode, 0)) + { + for (i = 0; i < This->nDevModes; i++) + { + PDEVMODEW CurMode = This->DevModes[i]; + + if (!CurMode) + continue; + + if (((CurMode->dmFields & DM_PELSWIDTH) && devmode.dmPelsWidth == CurMode->dmPelsWidth) && + ((CurMode->dmFields & DM_PELSHEIGHT) && devmode.dmPelsHeight == CurMode->dmPelsHeight) && + ((CurMode->dmFields & DM_BITSPERPEL) && devmode.dmBitsPerPel == CurMode->dmBitsPerPel) && + ((CurMode->dmFields & DM_DISPLAYFREQUENCY) && devmode.dmDisplayFrequency == CurMode->dmDisplayFrequency)) + { + This->lpOrigDevMode = This->lpCurDevMode = CurMode; + break; + } + } + } + /* Initialize the shell extension interface */ pCDevSettings_InitializeExtInterface(This); @@ -524,6 +643,15 @@ pCDevSettings_Initialize(PCDevSettings This, static VOID pCDevSettings_Free(PCDevSettings This) { + This->lpOrigDevMode = NULL; + This->lpCurDevMode = NULL; + while (This->nDevModes) + { + LocalFree(This->DevModes[--This->nDevModes]); + } + LocalFree(This->DevModes); + This->DevModes = NULL; + pCDevSettings_FreeString(&This->pDisplayDevice); pCDevSettings_FreeString(&This->pDisplayName); pCDevSettings_FreeString(&This->pDisplayKey); @@ -942,7 +1070,38 @@ LONG WINAPI DisplaySaveSettings(PVOID pContext, HWND hwndPropSheet) { - //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context); - DPRINT("DisplaySaveSettings() UNIMPLEMENTED!\n"); - return DISP_CHANGE_BADPARAM; + PCDevSettings This = impl_from_IDataObject((IDataObject *)pContext); + LONG rc = DISP_CHANGE_SUCCESSFUL; + + if (This->lpCurDevMode != This->lpOrigDevMode) + { + SETTINGS_ENTRY seOrig, seCur; + BOOL Ret; + + seOrig.dmPelsWidth = This->lpOrigDevMode->dmPelsWidth; + seOrig.dmPelsHeight = This->lpOrigDevMode->dmPelsHeight; + seOrig.dmBitsPerPel = This->lpOrigDevMode->dmBitsPerPel; + seOrig.dmDisplayFrequency = This->lpOrigDevMode->dmDisplayFrequency; + + seCur.dmPelsWidth = This->lpCurDevMode->dmPelsWidth; + seCur.dmPelsHeight = This->lpCurDevMode->dmPelsHeight; + seCur.dmBitsPerPel = This->lpCurDevMode->dmBitsPerPel; + seCur.dmDisplayFrequency = This->lpCurDevMode->dmDisplayFrequency; + + Ret = SwitchDisplayMode(hwndPropSheet, + This->pDisplayDevice, + &seOrig, + &seCur, + &rc); + + if (rc == DISP_CHANGE_SUCCESSFUL) + { + if (Ret) + This->lpOrigDevMode = This->lpCurDevMode; + else + This->lpCurDevMode = This->lpOrigDevMode; + } + } + + return rc; } diff --git a/dll/cpl/desk/settings.c b/dll/cpl/desk/settings.c index d0b8d12a06b..b161214fd69 100644 --- a/dll/cpl/desk/settings.c +++ b/dll/cpl/desk/settings.c @@ -727,27 +727,26 @@ ConfirmDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam return FALSE; } -static VOID -ApplyDisplaySettings(HWND hwndDlg, PSETTINGS_DATA pData) +BOOL +SwitchDisplayMode(HWND hwndDlg, PWSTR DeviceName, PSETTINGS_ENTRY seInit, PSETTINGS_ENTRY seNew, OUT PLONG rc) { TCHAR Message[1024], Title[256]; DEVMODE devmode; - LONG rc; RtlZeroMemory(&devmode, sizeof(devmode)); devmode.dmSize = (WORD)sizeof(devmode); - devmode.dmPelsWidth = pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth; - devmode.dmPelsHeight = pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight; - devmode.dmBitsPerPel = pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel; - devmode.dmDisplayFrequency = pData->CurrentDisplayDevice->CurrentSettings->dmDisplayFrequency; + devmode.dmPelsWidth = seNew->dmPelsWidth; + devmode.dmPelsHeight = seNew->dmPelsHeight; + devmode.dmBitsPerPel = seNew->dmBitsPerPel; + devmode.dmDisplayFrequency = seNew->dmDisplayFrequency; devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY; - rc = ChangeDisplaySettingsEx(pData->CurrentDisplayDevice->DeviceName, - &devmode, - NULL, - CDS_UPDATEREGISTRY, - NULL); - switch (rc) + *rc = ChangeDisplaySettingsEx(DeviceName, + &devmode, + NULL, + CDS_UPDATEREGISTRY, + NULL); + switch (*rc) { case DISP_CHANGE_SUCCESSFUL: break; @@ -756,61 +755,85 @@ ApplyDisplaySettings(HWND hwndDlg, PSETTINGS_DATA pData) LoadString(hApplet, IDS_DISPLAY_SETTINGS, Title, sizeof(Title) / sizeof(TCHAR)); LoadString(hApplet, IDS_APPLY_NEEDS_RESTART, Message, sizeof(Message) / sizeof (TCHAR)); MessageBox(hwndDlg, Message, Title, MB_OK | MB_ICONINFORMATION); - return; + return FALSE; case DISP_CHANGE_FAILED: default: LoadString(hApplet, IDS_DISPLAY_SETTINGS, Title, sizeof(Title) / sizeof(TCHAR)); LoadString(hApplet, IDS_APPLY_FAILED, Message, sizeof(Message) / sizeof (TCHAR)); MessageBox(hwndDlg, Message, Title, MB_OK | MB_ICONSTOP); - return; + return FALSE; } if (DialogBox(hApplet, MAKEINTRESOURCE(IDD_CONFIRMSETTINGS), hwndDlg, ConfirmDlgProc) == IDYES) { - pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth = pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth; - pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight = pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight; - pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel = pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel; - pData->CurrentDisplayDevice->InitialSettings.dmDisplayFrequency = pData->CurrentDisplayDevice->CurrentSettings->dmDisplayFrequency; + return TRUE; } else { - devmode.dmPelsWidth = pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth; - devmode.dmPelsHeight = pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight; - devmode.dmBitsPerPel = pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel; - devmode.dmDisplayFrequency = pData->CurrentDisplayDevice->InitialSettings.dmDisplayFrequency; - - rc = ChangeDisplaySettingsEx(pData->CurrentDisplayDevice->DeviceName, - &devmode, - NULL, - CDS_UPDATEREGISTRY, - NULL); - switch (rc) + devmode.dmPelsWidth = seInit->dmPelsWidth; + devmode.dmPelsHeight = seInit->dmPelsHeight; + devmode.dmBitsPerPel = seInit->dmBitsPerPel; + devmode.dmDisplayFrequency = seInit->dmDisplayFrequency; + + *rc = ChangeDisplaySettingsEx(DeviceName, + &devmode, + NULL, + CDS_UPDATEREGISTRY, + NULL); + switch (*rc) { case DISP_CHANGE_SUCCESSFUL: - pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth = pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth; - pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight = pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight; - pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel = pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel; - pData->CurrentDisplayDevice->CurrentSettings->dmDisplayFrequency = pData->CurrentDisplayDevice->InitialSettings.dmDisplayFrequency; - UpdateDisplay(hwndDlg, pData, TRUE); - break; + return FALSE; case DISP_CHANGE_RESTART: LoadString(hApplet, IDS_DISPLAY_SETTINGS, Title, sizeof(Title) / sizeof(TCHAR)); LoadString(hApplet, IDS_APPLY_NEEDS_RESTART, Message, sizeof(Message) / sizeof (TCHAR)); MessageBox(hwndDlg, Message, Title, MB_OK | MB_ICONINFORMATION); - return; + return FALSE; case DISP_CHANGE_FAILED: default: LoadString(hApplet, IDS_DISPLAY_SETTINGS, Title, sizeof(Title) / sizeof(TCHAR)); LoadString(hApplet, IDS_APPLY_FAILED, Message, sizeof(Message) / sizeof (TCHAR)); MessageBox(hwndDlg, Message, Title, MB_OK | MB_ICONSTOP); - return; + return FALSE; } } } +static VOID +ApplyDisplaySettings(HWND hwndDlg, PSETTINGS_DATA pData) +{ + BOOL Ret; + LONG rc; + + Ret = SwitchDisplayMode(hwndDlg, + pData->CurrentDisplayDevice->DeviceName, + &pData->CurrentDisplayDevice->InitialSettings, + pData->CurrentDisplayDevice->CurrentSettings, + &rc); + + if (rc != DISP_CHANGE_SUCCESSFUL) + return; + + if (Ret) + { + pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth = pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth; + pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight = pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight; + pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel = pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel; + pData->CurrentDisplayDevice->InitialSettings.dmDisplayFrequency = pData->CurrentDisplayDevice->CurrentSettings->dmDisplayFrequency; + } + else + { + pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth = pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth; + pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight = pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight; + pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel = pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel; + pData->CurrentDisplayDevice->CurrentSettings->dmDisplayFrequency = pData->CurrentDisplayDevice->InitialSettings.dmDisplayFrequency; + UpdateDisplay(hwndDlg, pData, TRUE); + } +} + /* Property page dialog callback */ INT_PTR CALLBACK SettingsPageProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam) @@ -841,7 +864,26 @@ SettingsPageProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lPar DWORD command = HIWORD(wParam); if (controlId == IDC_SETTINGS_ADVANCED && command == BN_CLICKED) - DisplayAdvancedSettings(hwndDlg, pData->CurrentDisplayDevice); + { + if (DisplayAdvancedSettings(hwndDlg, pData->CurrentDisplayDevice)) + { + DEVMODE devmode; + ZeroMemory(&devmode, sizeof(devmode)); + devmode.dmSize = (WORD)sizeof(devmode); + if (EnumDisplaySettingsExW(pData->CurrentDisplayDevice->DeviceName, ENUM_CURRENT_SETTINGS, &devmode, 0)) + { + pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth = devmode.dmPelsWidth; + pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight = devmode.dmPelsHeight; + pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel = devmode.dmBitsPerPel; + pData->CurrentDisplayDevice->InitialSettings.dmDisplayFrequency = devmode.dmDisplayFrequency; + pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth = pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth; + pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight = pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight; + pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel = pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel; + pData->CurrentDisplayDevice->CurrentSettings->dmDisplayFrequency = pData->CurrentDisplayDevice->InitialSettings.dmDisplayFrequency; + UpdateDisplay(hwndDlg, pData, TRUE); + } + } + } else if (controlId == IDC_SETTINGS_BPP && command == CBN_SELCHANGE) OnBPPChanged(hwndDlg, pData); break; diff --git a/sdk/include/reactos/dll/desk/deskcplx.h b/sdk/include/reactos/dll/desk/deskcplx.h index 8647191a966..1b773449121 100644 --- a/sdk/include/reactos/dll/desk/deskcplx.h +++ b/sdk/include/reactos/dll/desk/deskcplx.h @@ -15,7 +15,7 @@ typedef PDEVMODEW (DESK_EXT_CALLBACK *PDESK_EXT_ENUMALLMODES)(PVOID Context, DWORD Index); typedef PDEVMODEW (DESK_EXT_CALLBACK *PDESK_EXT_GETCURRENTMODE)(PVOID Context); -typedef BOOL (DESK_EXT_CALLBACK *PDESK_EXT_SETCURRENTMODE)(PVOID Context, const DEVMODEW *pDevMode); +typedef BOOL (DESK_EXT_CALLBACK *PDESK_EXT_SETCURRENTMODE)(PVOID Context, DEVMODEW *pDevMode); typedef VOID (DESK_EXT_CALLBACK *PDESK_EXT_GETPRUNINGMODE)(PVOID Context, PBOOL pbModesPruned, PBOOL pbKeyIsReadOnly, PBOOL pbPruningOn); typedef VOID (DESK_EXT_CALLBACK *PDESK_EXT_SETPRUNINGMODE)(PVOID Context, BOOL PruningOn);
2 years, 6 months
1
0
0
0
[reactos] 01/01: [DESKADP][DESKMON] Notify property sheet that DWLP_MSGRESULT is set
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fced1c11927553ab71a4a…
commit fced1c11927553ab71a4aa8bf1fd947b96079493 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Mon Jun 20 02:06:37 2022 +0300 Commit: Stanislav Motylkov <x86corez(a)gmail.com> CommitDate: Mon Jun 20 02:14:02 2022 +0300 [DESKADP][DESKMON] Notify property sheet that DWLP_MSGRESULT is set When FALSE is returned, Apply button ignores validation result and becomes disabled after clicking as if settings were applied. Fix it by setting the return value to TRUE. See
https://docs.microsoft.com/en-us/windows/win32/controls/psn-apply
--- dll/shellext/deskadp/deskadp.c | 1 + dll/shellext/deskmon/deskmon.c | 1 + 2 files changed, 2 insertions(+) diff --git a/dll/shellext/deskadp/deskadp.c b/dll/shellext/deskadp/deskadp.c index 3ec5460255d..a247f5e79a7 100644 --- a/dll/shellext/deskadp/deskadp.c +++ b/dll/shellext/deskadp/deskadp.c @@ -422,6 +422,7 @@ DisplayAdapterDlgProc(HWND hwndDlg, SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, ApplyDisplayAdapterChanges(This)); + Ret = TRUE; break; } diff --git a/dll/shellext/deskmon/deskmon.c b/dll/shellext/deskmon/deskmon.c index 21551a6ceb5..7cdcd560b13 100644 --- a/dll/shellext/deskmon/deskmon.c +++ b/dll/shellext/deskmon/deskmon.c @@ -666,6 +666,7 @@ MonitorDlgProc(HWND hwndDlg, SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, ApplyMonitorChanges(This)); + Ret = TRUE; break; }
2 years, 6 months
1
0
0
0
[reactos] 01/01: [REGEDIT] Fix issue at Find registry key (#4341)
by Jose Carlos Jesus
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=568383c9b91c2e529ae4a…
commit 568383c9b91c2e529ae4a3609e416ec8044cfc23 Author: Jose Carlos Jesus <zecarlos1957(a)hotmail.com> AuthorDate: Sun Jun 19 20:57:30 2022 +0100 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Jun 19 21:57:30 2022 +0200 [REGEDIT] Fix issue at Find registry key (#4341) - If we dont select a item as a starting point to search from, we need to set pszValueName to the first value name in current subkey. - Check pszSubKey length before calling RegFindRecurse. - Set focus to subkey when we search for it. --- base/applications/regedit/find.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/base/applications/regedit/find.c b/base/applications/regedit/find.c index 1fb5bbe45a0..17de9b9b147 100644 --- a/base/applications/regedit/find.c +++ b/base/applications/regedit/find.c @@ -160,9 +160,6 @@ BOOL RegFindRecurse( if (lResult != ERROR_SUCCESS) return FALSE; - if (pszValueName == NULL) - pszValueName = s_empty; - lResult = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL, NULL, NULL, &c, NULL, NULL, NULL, NULL); if (lResult != ERROR_SUCCESS) @@ -195,6 +192,9 @@ BOOL RegFindRecurse( qsort(ppszNames, c, sizeof(LPWSTR), compare); + if (pszValueName == NULL) + pszValueName = ppszNames[0]; + for(i = 0; i < c; i++) { if (DoEvents()) @@ -370,13 +370,14 @@ BOOL RegFindWalk( LPWSTR *ppszNames = NULL; hBaseKey = *phKey; + + if (wcslen(pszSubKey) >= _countof(szSubKey)) + return FALSE; + if (RegFindRecurse(hBaseKey, pszSubKey, pszValueName, ppszFoundSubKey, ppszFoundValueName)) return TRUE; - if (wcslen(pszSubKey) >= MAX_PATH) - return FALSE; - wcscpy(szSubKey, pszSubKey); while(szSubKey[0] != 0) { @@ -687,10 +688,18 @@ BOOL FindNext(HWND hWnd) { GetKeyName(szFullKey, COUNT_OF(szFullKey), hKeyRoot, pszFoundSubKey); SelectNode(g_pChildWnd->hTreeWnd, szFullKey); - SetValueName(g_pChildWnd->hListWnd, pszFoundValueName); free(pszFoundSubKey); - free(pszFoundValueName); - SetFocus(g_pChildWnd->hListWnd); + + if (pszFoundValueName != NULL) + { + SetValueName(g_pChildWnd->hListWnd, pszFoundValueName); + free(pszFoundValueName); + SetFocus(g_pChildWnd->hListWnd); + } + else + { + SetFocus(g_pChildWnd->hTreeWnd); + } } return fSuccess || s_bAbort; }
2 years, 6 months
1
0
0
0
[reactos] 01/01: [HHCTRL.OCX] Add help viewer window icon and default title (#4541)
by Thamatip Chitpong
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=65d7fb1a82e8a93bb51f5…
commit 65d7fb1a82e8a93bb51f5b3c244d58585f33ff61 Author: Thamatip Chitpong <tangaming123456(a)outlook.com> AuthorDate: Mon Jun 20 02:22:28 2022 +0700 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Jun 19 21:22:28 2022 +0200 [HHCTRL.OCX] Add help viewer window icon and default title (#4541) --- dll/win32/hhctrl.ocx/chm.c | 3 ++- dll/win32/hhctrl.ocx/help.c | 6 +++--- dll/win32/hhctrl.ocx/hhctrl.h | 1 + dll/win32/hhctrl.ocx/hhctrl.rc | 3 +++ dll/win32/hhctrl.ocx/lang/Cs.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Da.rc | 2 ++ dll/win32/hhctrl.ocx/lang/De.rc | 2 ++ dll/win32/hhctrl.ocx/lang/El.rc | 2 ++ dll/win32/hhctrl.ocx/lang/En.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Es.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Fi.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Fr.rc | 2 ++ dll/win32/hhctrl.ocx/lang/He.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Hu.rc | 2 ++ dll/win32/hhctrl.ocx/lang/It.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Ja.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Ko.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Lt.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Nl.rc | 2 ++ dll/win32/hhctrl.ocx/lang/No.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Pl.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Pt.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Ro.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Ru.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Si.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Sq.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Sv.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Tr.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Uk.rc | 2 ++ dll/win32/hhctrl.ocx/lang/Zh.rc | 2 ++ dll/win32/hhctrl.ocx/res/hh.ico | Bin 0 -> 22486 bytes dll/win32/hhctrl.ocx/resource.h | 3 +++ 32 files changed, 64 insertions(+), 4 deletions(-) diff --git a/dll/win32/hhctrl.ocx/chm.c b/dll/win32/hhctrl.ocx/chm.c index 07211f1dbd5..6336026b378 100644 --- a/dll/win32/hhctrl.ocx/chm.c +++ b/dll/win32/hhctrl.ocx/chm.c @@ -21,6 +21,7 @@ #include "hhctrl.h" #include "stream.h" +#include "resource.h" #include "winreg.h" #include "shlwapi.h" @@ -459,7 +460,7 @@ BOOL LoadWinTypeFromCHM(HHInfo *info) /* merge the new data with any pre-existing HH_WINTYPE structure */ MergeChmProperties(&wintype, info, FALSE); if (!info->WinType.pszCaption) - info->WinType.pszCaption = info->stringsW.pszCaption = strdupW(info->pCHMInfo->defTitle ? info->pCHMInfo->defTitle : empty); + info->WinType.pszCaption = info->stringsW.pszCaption = (info->pCHMInfo->defTitle ? strdupW(info->pCHMInfo->defTitle) : HH_LoadString(IDS_DEFTITLE)); if (!info->WinType.pszFile) info->WinType.pszFile = info->stringsW.pszFile = strdupW(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : empty); if (!info->WinType.pszToc) diff --git a/dll/win32/hhctrl.ocx/help.c b/dll/win32/hhctrl.ocx/help.c index 06f73358f44..de9dc086726 100644 --- a/dll/win32/hhctrl.ocx/help.c +++ b/dll/win32/hhctrl.ocx/help.c @@ -171,7 +171,7 @@ static inline BOOL navigation_visible(HHInfo *info) } /* Loads a string from the resource file */ -static LPWSTR HH_LoadString(DWORD dwID) +LPWSTR HH_LoadString(DWORD dwID) { LPWSTR string = NULL; LPCWSTR stringresource; @@ -1620,12 +1620,12 @@ static BOOL HH_CreateHelpWindow(HHInfo *info) wcex.cbClsExtra = 0; wcex.cbWndExtra = sizeof(LONG_PTR); wcex.hInstance = hhctrl_hinstance; - wcex.hIcon = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION); + wcex.hIcon = LoadIconW(hhctrl_hinstance, MAKEINTRESOURCEW(IDI_HHICON)); wcex.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_MENU + 1); wcex.lpszMenuName = NULL; wcex.lpszClassName = windowClassW; - wcex.hIconSm = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION); + wcex.hIconSm = NULL; RegisterClassExW(&wcex); diff --git a/dll/win32/hhctrl.ocx/hhctrl.h b/dll/win32/hhctrl.ocx/hhctrl.h index a03d09f5633..f302815b45d 100644 --- a/dll/win32/hhctrl.ocx/hhctrl.h +++ b/dll/win32/hhctrl.ocx/hhctrl.h @@ -229,6 +229,7 @@ WCHAR *GetDocumentTitle(CHMInfo*,LPCWSTR) DECLSPEC_HIDDEN; extern struct list window_list DECLSPEC_HIDDEN; HHInfo *CreateHelpViewer(HHInfo*,LPCWSTR,HWND) DECLSPEC_HIDDEN; void ReleaseHelpViewer(HHInfo*) DECLSPEC_HIDDEN; +LPWSTR HH_LoadString(DWORD dwID) DECLSPEC_HIDDEN; BOOL NavigateToUrl(HHInfo*,LPCWSTR) DECLSPEC_HIDDEN; BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR) DECLSPEC_HIDDEN; void MergeChmProperties(HH_WINTYPEW*,HHInfo*,BOOL) DECLSPEC_HIDDEN; diff --git a/dll/win32/hhctrl.ocx/hhctrl.rc b/dll/win32/hhctrl.ocx/hhctrl.rc index c270efa9374..f743a47239e 100644 --- a/dll/win32/hhctrl.ocx/hhctrl.rc +++ b/dll/win32/hhctrl.ocx/hhctrl.rc @@ -114,6 +114,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "wine/wine_common_ver.rc" +/* help viewer window icon */ +IDI_HHICON ICON "res/hh.ico" + /* @makedep: hhtoolbar.bmp */ IDB_HHTOOLBAR BITMAP "res/hhtoolbar.bmp" diff --git a/dll/win32/hhctrl.ocx/lang/Cs.rc b/dll/win32/hhctrl.ocx/lang/Cs.rc index 5d6bf545b4f..ab0e3a0ad87 100644 --- a/dll/win32/hhctrl.ocx/lang/Cs.rc +++ b/dll/win32/hhctrl.ocx/lang/Cs.rc @@ -27,6 +27,8 @@ LANGUAGE LANG_CZECH, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Obsah" IDS_INDEX "I&ndex" IDS_SEARCH "&Hledat" diff --git a/dll/win32/hhctrl.ocx/lang/Da.rc b/dll/win32/hhctrl.ocx/lang/Da.rc index c775b341250..a9a18b62117 100644 --- a/dll/win32/hhctrl.ocx/lang/Da.rc +++ b/dll/win32/hhctrl.ocx/lang/Da.rc @@ -23,6 +23,8 @@ LANGUAGE LANG_DANISH, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Indhold" IDS_INDEX "I&ndeks" IDS_SEARCH "&Søg" diff --git a/dll/win32/hhctrl.ocx/lang/De.rc b/dll/win32/hhctrl.ocx/lang/De.rc index e24593d1124..a5e73a8c487 100644 --- a/dll/win32/hhctrl.ocx/lang/De.rc +++ b/dll/win32/hhctrl.ocx/lang/De.rc @@ -25,6 +25,8 @@ LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Inhalt" IDS_INDEX "I&ndex" IDS_SEARCH "&Suche" diff --git a/dll/win32/hhctrl.ocx/lang/El.rc b/dll/win32/hhctrl.ocx/lang/El.rc index 08a441a8f56..ea2dba6a954 100644 --- a/dll/win32/hhctrl.ocx/lang/El.rc +++ b/dll/win32/hhctrl.ocx/lang/El.rc @@ -23,6 +23,8 @@ LANGUAGE LANG_GREEK, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Περιεχόμενα" IDS_INDEX "I&ndex" IDS_SEARCH "&Αναζήτηση" diff --git a/dll/win32/hhctrl.ocx/lang/En.rc b/dll/win32/hhctrl.ocx/lang/En.rc index bad46bdf247..9be92a1ea3f 100644 --- a/dll/win32/hhctrl.ocx/lang/En.rc +++ b/dll/win32/hhctrl.ocx/lang/En.rc @@ -24,6 +24,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Contents" IDS_INDEX "I&ndex" IDS_SEARCH "&Search" diff --git a/dll/win32/hhctrl.ocx/lang/Es.rc b/dll/win32/hhctrl.ocx/lang/Es.rc index 5d1417a1a95..d0f52c2ba2c 100644 --- a/dll/win32/hhctrl.ocx/lang/Es.rc +++ b/dll/win32/hhctrl.ocx/lang/Es.rc @@ -26,6 +26,8 @@ LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Contenido" IDS_INDEX "Í&ndice" IDS_SEARCH "&Buscar" diff --git a/dll/win32/hhctrl.ocx/lang/Fi.rc b/dll/win32/hhctrl.ocx/lang/Fi.rc index 606406bd880..01627043d66 100644 --- a/dll/win32/hhctrl.ocx/lang/Fi.rc +++ b/dll/win32/hhctrl.ocx/lang/Fi.rc @@ -23,6 +23,8 @@ LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Sisällys" IDS_INDEX "&Hakemisto" IDS_SEARCH "&Etsi" diff --git a/dll/win32/hhctrl.ocx/lang/Fr.rc b/dll/win32/hhctrl.ocx/lang/Fr.rc index e6f3f98f47a..a564492455b 100644 --- a/dll/win32/hhctrl.ocx/lang/Fr.rc +++ b/dll/win32/hhctrl.ocx/lang/Fr.rc @@ -26,6 +26,8 @@ LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL STRINGTABLE BEGIN + IDS_DEFTITLE "Aide HTML" + IDS_CONTENTS "Somm&aire" IDS_INDEX "I&ndex" IDS_SEARCH "&Recherche" diff --git a/dll/win32/hhctrl.ocx/lang/He.rc b/dll/win32/hhctrl.ocx/lang/He.rc index 4a537c52006..f5a3c16a581 100644 --- a/dll/win32/hhctrl.ocx/lang/He.rc +++ b/dll/win32/hhctrl.ocx/lang/He.rc @@ -25,6 +25,8 @@ LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "תוכ&ן" IDS_INDEX "&אינקס" IDS_SEARCH "&חפש" diff --git a/dll/win32/hhctrl.ocx/lang/Hu.rc b/dll/win32/hhctrl.ocx/lang/Hu.rc index 3d3a61309ee..cbb837489f3 100644 --- a/dll/win32/hhctrl.ocx/lang/Hu.rc +++ b/dll/win32/hhctrl.ocx/lang/Hu.rc @@ -23,6 +23,8 @@ LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Tartalom" IDS_INDEX "I&ndex" IDS_SEARCH "&Keresés" diff --git a/dll/win32/hhctrl.ocx/lang/It.rc b/dll/win32/hhctrl.ocx/lang/It.rc index 5db3638f9ae..a9522943bef 100644 --- a/dll/win32/hhctrl.ocx/lang/It.rc +++ b/dll/win32/hhctrl.ocx/lang/It.rc @@ -27,6 +27,8 @@ LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Contenuti" IDS_INDEX "&Indice" IDS_SEARCH "&Ricerca" diff --git a/dll/win32/hhctrl.ocx/lang/Ja.rc b/dll/win32/hhctrl.ocx/lang/Ja.rc index 15bee5d0c7b..9cb0943b319 100644 --- a/dll/win32/hhctrl.ocx/lang/Ja.rc +++ b/dll/win32/hhctrl.ocx/lang/Ja.rc @@ -27,6 +27,8 @@ LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "目次(&C)" IDS_INDEX "索引(&N)" IDS_SEARCH "検索(&S)" diff --git a/dll/win32/hhctrl.ocx/lang/Ko.rc b/dll/win32/hhctrl.ocx/lang/Ko.rc index 976cb126d43..cdf568f5674 100644 --- a/dll/win32/hhctrl.ocx/lang/Ko.rc +++ b/dll/win32/hhctrl.ocx/lang/Ko.rc @@ -24,6 +24,8 @@ LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "목록(&C)" IDS_INDEX "인덱스(&N)" IDS_SEARCH "찾기(&S)" diff --git a/dll/win32/hhctrl.ocx/lang/Lt.rc b/dll/win32/hhctrl.ocx/lang/Lt.rc index a296a587edd..b672bf3994a 100644 --- a/dll/win32/hhctrl.ocx/lang/Lt.rc +++ b/dll/win32/hhctrl.ocx/lang/Lt.rc @@ -26,6 +26,8 @@ LANGUAGE LANG_LITHUANIAN, SUBLANG_NEUTRAL STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Turinys" IDS_INDEX "&Rodyklė" IDS_SEARCH "&Paieška" diff --git a/dll/win32/hhctrl.ocx/lang/Nl.rc b/dll/win32/hhctrl.ocx/lang/Nl.rc index c9ae349d959..a0b78cf7dac 100644 --- a/dll/win32/hhctrl.ocx/lang/Nl.rc +++ b/dll/win32/hhctrl.ocx/lang/Nl.rc @@ -23,6 +23,8 @@ LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Inhoud" IDS_INDEX "I&ndex" IDS_SEARCH "&Zoeken" diff --git a/dll/win32/hhctrl.ocx/lang/No.rc b/dll/win32/hhctrl.ocx/lang/No.rc index 7530d27ee41..f645af26faf 100644 --- a/dll/win32/hhctrl.ocx/lang/No.rc +++ b/dll/win32/hhctrl.ocx/lang/No.rc @@ -23,6 +23,8 @@ LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Innhold" IDS_INDEX "I&ndeks" IDS_SEARCH "&Søk" diff --git a/dll/win32/hhctrl.ocx/lang/Pl.rc b/dll/win32/hhctrl.ocx/lang/Pl.rc index 1737398fcae..dc2dc2f7d37 100644 --- a/dll/win32/hhctrl.ocx/lang/Pl.rc +++ b/dll/win32/hhctrl.ocx/lang/Pl.rc @@ -24,6 +24,8 @@ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Spis treści" IDS_INDEX "&Indeks" IDS_SEARCH "&Wyszukaj" diff --git a/dll/win32/hhctrl.ocx/lang/Pt.rc b/dll/win32/hhctrl.ocx/lang/Pt.rc index bedaac0918e..c0ef9c87186 100644 --- a/dll/win32/hhctrl.ocx/lang/Pt.rc +++ b/dll/win32/hhctrl.ocx/lang/Pt.rc @@ -26,6 +26,8 @@ LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Conteúdos" IDS_INDEX "&Índice" IDS_SEARCH "&Pesquisar" diff --git a/dll/win32/hhctrl.ocx/lang/Ro.rc b/dll/win32/hhctrl.ocx/lang/Ro.rc index f7a7a58e489..e106ffeaf94 100644 --- a/dll/win32/hhctrl.ocx/lang/Ro.rc +++ b/dll/win32/hhctrl.ocx/lang/Ro.rc @@ -27,6 +27,8 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "C&uprins" IDS_INDEX "In&dex" IDS_SEARCH "&Caută" diff --git a/dll/win32/hhctrl.ocx/lang/Ru.rc b/dll/win32/hhctrl.ocx/lang/Ru.rc index acee6af8ebe..8e8e51413d2 100644 --- a/dll/win32/hhctrl.ocx/lang/Ru.rc +++ b/dll/win32/hhctrl.ocx/lang/Ru.rc @@ -26,6 +26,8 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Содержание" IDS_INDEX "&Оглавление" IDS_SEARCH "&Поиск" diff --git a/dll/win32/hhctrl.ocx/lang/Si.rc b/dll/win32/hhctrl.ocx/lang/Si.rc index a4959dd7a53..3961f17ca97 100644 --- a/dll/win32/hhctrl.ocx/lang/Si.rc +++ b/dll/win32/hhctrl.ocx/lang/Si.rc @@ -25,6 +25,8 @@ LANGUAGE LANG_SLOVENIAN, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Vsebina" IDS_INDEX "I&ndeks" IDS_SEARCH "&Iskanje" diff --git a/dll/win32/hhctrl.ocx/lang/Sq.rc b/dll/win32/hhctrl.ocx/lang/Sq.rc index 1eacfe2c2f9..5fca78c68ec 100644 --- a/dll/win32/hhctrl.ocx/lang/Sq.rc +++ b/dll/win32/hhctrl.ocx/lang/Sq.rc @@ -26,6 +26,8 @@ LANGUAGE LANG_ALBANIAN, SUBLANG_NEUTRAL STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "Përmbajtja" IDS_INDEX "I&ndex" IDS_SEARCH "Kerko" diff --git a/dll/win32/hhctrl.ocx/lang/Sv.rc b/dll/win32/hhctrl.ocx/lang/Sv.rc index 74f04bb6a2c..ccf488aeea9 100644 --- a/dll/win32/hhctrl.ocx/lang/Sv.rc +++ b/dll/win32/hhctrl.ocx/lang/Sv.rc @@ -23,6 +23,8 @@ LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Innehåll" IDS_INDEX "I&ndex" IDS_SEARCH "&Sök" diff --git a/dll/win32/hhctrl.ocx/lang/Tr.rc b/dll/win32/hhctrl.ocx/lang/Tr.rc index f2e8570b319..c1b4e3e1bb1 100644 --- a/dll/win32/hhctrl.ocx/lang/Tr.rc +++ b/dll/win32/hhctrl.ocx/lang/Tr.rc @@ -23,6 +23,8 @@ LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&İçindekiler" IDS_INDEX "&Dizin" IDS_SEARCH "&Ara" diff --git a/dll/win32/hhctrl.ocx/lang/Uk.rc b/dll/win32/hhctrl.ocx/lang/Uk.rc index 46414c469d5..017786967c8 100644 --- a/dll/win32/hhctrl.ocx/lang/Uk.rc +++ b/dll/win32/hhctrl.ocx/lang/Uk.rc @@ -28,6 +28,8 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "&Зміст" IDS_INDEX "&Вказівник" IDS_SEARCH "&Пошук" diff --git a/dll/win32/hhctrl.ocx/lang/Zh.rc b/dll/win32/hhctrl.ocx/lang/Zh.rc index 695ab1d155b..39036f99e09 100644 --- a/dll/win32/hhctrl.ocx/lang/Zh.rc +++ b/dll/win32/hhctrl.ocx/lang/Zh.rc @@ -26,6 +26,8 @@ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED STRINGTABLE BEGIN + IDS_DEFTITLE "HTML Help" + IDS_CONTENTS "内容(&C)" IDS_INDEX "索引(&N)" IDS_SEARCH "搜索(&S)" diff --git a/dll/win32/hhctrl.ocx/res/hh.ico b/dll/win32/hhctrl.ocx/res/hh.ico new file mode 100644 index 00000000000..90e3a9ef34a Binary files /dev/null and b/dll/win32/hhctrl.ocx/res/hh.ico differ diff --git a/dll/win32/hhctrl.ocx/resource.h b/dll/win32/hhctrl.ocx/resource.h index f2b4383493b..a47f3a4c2c5 100644 --- a/dll/win32/hhctrl.ocx/resource.h +++ b/dll/win32/hhctrl.ocx/resource.h @@ -25,6 +25,9 @@ #include <wingdi.h> #include <htmlhelp.h> +#define IDI_HHICON 100 + +#define IDS_DEFTITLE 0 #define IDS_CONTENTS 1 #define IDS_INDEX 2 #define IDS_SEARCH 3
2 years, 6 months
1
0
0
0
[reactos] 01/01: [TASKMGR] Process page: Fix DevicePathToDosPath (#4537)
by Thamatip Chitpong
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a50d309c4831a6bfb0312…
commit a50d309c4831a6bfb031269f499ceeae7f1475e4 Author: Thamatip Chitpong <tangaming123456(a)outlook.com> AuthorDate: Mon Jun 20 01:52:06 2022 +0700 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Jun 19 20:52:06 2022 +0200 [TASKMGR] Process page: Fix DevicePathToDosPath (#4537) - Fix DevicePathToDosPath, don't use the same in-out buffer. - Also simplify functions related to 59dcec1 Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> --- base/applications/taskmgr/procpage.c | 306 ++++++++++++++++++----------------- 1 file changed, 157 insertions(+), 149 deletions(-) diff --git a/base/applications/taskmgr/procpage.c b/base/applications/taskmgr/procpage.c index caa344860a6..6145a28dcfe 100644 --- a/base/applications/taskmgr/procpage.c +++ b/base/applications/taskmgr/procpage.c @@ -937,162 +937,211 @@ int CALLBACK ProcessPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPara return ret; } -static BOOL DevicePathToDosPath(LPWSTR lpPath, DWORD dwSize) +/** + * @brief + * Maps an NT "\Device\..." path to its Win32 "DOS" equivalent. + * + * @param[in] lpDevicePath + * The NT device path to convert. + * + * @param[out] lpDosPath + * Receives the converted Win32 path. + * + * @param[in] dwLength + * Size of the lpDosPath buffer in characters. + * + * @return + * The number of characters required (if lpDosPath == NULL or dwLength == 0), + * or actually written in the lpDosPath buffer, including the NULL terminator. + * Returns 0 in case of failure. + **/ +static DWORD +DevicePathToDosPath( + _In_ LPCWSTR lpDevicePath, + _Out_writes_to_opt_(dwLength, return) + LPWSTR lpDosPath, + _In_opt_ DWORD dwLength) { - WCHAR cDrive; + DWORD dwRet = 0; + WCHAR szDrive[3] = L"?:"; + WCHAR szDeviceName[MAX_PATH]; - /* Check if lpPath is a device path */ - if (_wcsnicmp(lpPath, L"\\Device\\", 8) != 0) + /* Check if lpDevicePath is a device path */ + if (_wcsnicmp(lpDevicePath, L"\\Device\\", _countof(L"\\Device\\")-1) != 0) { - return FALSE; + return 0; } - for (cDrive = L'A'; cDrive <= L'Z'; cDrive++) + for (szDrive[0] = L'A'; szDrive[0] <= L'`'; szDrive[0]++) { - WCHAR szDrive[3]; - WCHAR szDevPath[MAX_PATH]; - - szDrive[0] = cDrive; - szDrive[1] = L':'; - szDrive[2] = UNICODE_NULL; - - if (QueryDosDeviceW(szDrive, szDevPath, _countof(szDevPath)) != 0) + if (QueryDosDeviceW(szDrive, szDeviceName, _countof(szDeviceName)) != 0) { - size_t len = wcslen(szDevPath); + size_t len = wcslen(szDeviceName); - if (_wcsnicmp(lpPath, szDevPath, len) == 0) + if (_wcsnicmp(lpDevicePath, szDeviceName, len) == 0) { - StringCbPrintfW(lpPath, dwSize, L"%s%s", szDrive, lpPath + len); - - return TRUE; + /* Get the required length, including the NULL terminator */ + dwRet = _countof(szDrive) + wcslen(lpDevicePath + len); + + if (lpDosPath && (dwLength >= dwRet)) + { + StringCchPrintfW(lpDosPath, dwLength, L"%s%s", + szDrive, lpDevicePath + len); + } + + break; } } } - return FALSE; + return dwRet; } -static DWORD GetProcessExecutablePath(HANDLE hProcess, LPWSTR lpExePath, DWORD dwLength) +/** + * @brief + * Retrieves the Win32 path of an executable image, by handle. + * + * @param[in] hProcess + * Handle to the executable image; it should be opened with + * PROCESS_QUERY_INFORMATION access rights. + * + * @param[out] lpExePath + * Receives the Win32 image path. + * + * @param[in] dwLength + * Size of the lpExePath buffer in characters. + * + * @return + * The number of characters required (if lpExePath == NULL or dwLength == 0), + * or actually written in the lpExePath buffer, including the NULL terminator. + * Returns 0 in case of failure. + **/ +static DWORD +GetProcessExecutablePath( + _In_ HANDLE hProcess, + _Out_writes_to_opt_(dwLength, return) + LPWSTR lpExePath, + _In_opt_ DWORD dwLength) { + DWORD dwRet = 0; + NTSTATUS Status; BYTE StaticBuffer[sizeof(UNICODE_STRING) + (MAX_PATH * sizeof(WCHAR))]; PVOID DynamicBuffer = NULL; - PUNICODE_STRING ImagePath = NULL; - LPWSTR pszExePath = NULL; + PUNICODE_STRING ExePath; ULONG SizeNeeded; - NTSTATUS Status; - DWORD dwRet = 0; Status = NtQueryInformationProcess(hProcess, ProcessImageFileName, StaticBuffer, + /* Reserve a NULL terminator */ sizeof(StaticBuffer) - sizeof(WCHAR), &SizeNeeded); - - if (Status == STATUS_INFO_LENGTH_MISMATCH) + if (NT_SUCCESS(Status)) + { + ExePath = (PUNICODE_STRING)StaticBuffer; + } + else if (Status == STATUS_INFO_LENGTH_MISMATCH) { + /* Allocate the buffer, reserving space for a NULL terminator */ DynamicBuffer = HeapAlloc(GetProcessHeap(), 0, SizeNeeded + sizeof(WCHAR)); - if (!DynamicBuffer) - { return 0; - } Status = NtQueryInformationProcess(hProcess, ProcessImageFileName, DynamicBuffer, SizeNeeded, &SizeNeeded); + if (!NT_SUCCESS(Status)) + goto Cleanup; - ImagePath = (PUNICODE_STRING)DynamicBuffer; + ExePath = DynamicBuffer; } else { - ImagePath = (PUNICODE_STRING)StaticBuffer; - } - - if (!NT_SUCCESS(Status)) - { - goto Cleanup; - } - - pszExePath = HeapAlloc(GetProcessHeap(), 0, ImagePath->Length + sizeof(WCHAR)); - - if (!pszExePath) - { - goto Cleanup; - } - - StringCbCopyNW(pszExePath, ImagePath->Length + sizeof(WCHAR), ImagePath->Buffer, ImagePath->Length); - - if (!DevicePathToDosPath(pszExePath, ImagePath->Length + sizeof(WCHAR))) - { - goto Cleanup; + return 0; } - dwRet = wcslen(pszExePath) + 1; + /* Manually NULL-terminate */ + ExePath->Buffer[ExePath->Length / sizeof(WCHAR)] = UNICODE_NULL; - if (dwLength >= dwRet) - { - StringCchCopyW(lpExePath, dwLength, pszExePath); - - dwRet -= 1; - } + /* HACK: Convert device path format into Win32 path format. + * Use ProcessImageFileNameWin32 instead if the kernel supports it. */ + dwRet = DevicePathToDosPath(ExePath->Buffer, lpExePath, dwLength); Cleanup: - - if (pszExePath) - { - HeapFree(GetProcessHeap(), 0, pszExePath); - } - - if (DynamicBuffer) - { - HeapFree(GetProcessHeap(), 0, DynamicBuffer); - } + HeapFree(GetProcessHeap(), 0, DynamicBuffer); return dwRet; } -static DWORD GetProcessExecutablePathById(DWORD dwProcessId, LPWSTR lpExePath, DWORD dwLength) +/** + * @brief + * Retrieves the Win32 path of an executable image, by identifier. + * + * @param[in] dwProcessId + * Identifier of the running executable image. + * + * @param[out] lpExePath + * Receives the Win32 image path. + * + * @param[in] dwLength + * Size of the lpExePath buffer in characters. + * + * @return + * The number of characters required (if lpExePath == NULL or dwLength == 0), + * or actually written in the lpExePath buffer, including the NULL terminator. + * Returns 0 in case of failure. + **/ +static DWORD +GetProcessExecutablePathById( + _In_ DWORD dwProcessId, + _Out_writes_to_opt_(dwLength, return) + LPWSTR lpExePath, + _In_opt_ DWORD dwLength) { DWORD dwRet = 0; if (dwProcessId == 0) - { return 0; - } - - /* PID = 4 or "System" */ + + /* PID = 4 ("System") */ if (dwProcessId == 4) { static const WCHAR szKernelExe[] = L"\\ntoskrnl.exe"; - WCHAR szSystemDir[MAX_PATH]; + LPWSTR pszSystemDir; UINT uLength; - uLength = GetSystemDirectoryW(szSystemDir, _countof(szSystemDir)); + uLength = GetSystemDirectoryW(NULL, 0); + if (uLength == 0) + return 0; + + pszSystemDir = HeapAlloc(GetProcessHeap(), 0, uLength * sizeof(WCHAR)); + if (!pszSystemDir) + return 0; - if (uLength != 0) + if (GetSystemDirectoryW(pszSystemDir, uLength) != 0) { - dwRet = uLength + _countof(szKernelExe); + /* Get the required length, including the NULL terminator */ + dwRet = uLength + _countof(szKernelExe) - 1; - if (dwLength >= dwRet) + if (lpExePath && (dwLength >= dwRet)) { - StringCchPrintfW(lpExePath, dwLength, L"%s%s", szSystemDir, szKernelExe); - - dwRet -= 1; + StringCchPrintfW(lpExePath, dwLength, L"%s%s", + pszSystemDir, szKernelExe); } } + + HeapFree(GetProcessHeap(), 0, pszSystemDir); } else { HANDLE hProcess; hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dwProcessId); - if (hProcess) { dwRet = GetProcessExecutablePath(hProcess, lpExePath, dwLength); - CloseHandle(hProcess); } } @@ -1103,40 +1152,26 @@ static DWORD GetProcessExecutablePathById(DWORD dwProcessId, LPWSTR lpExePath, D void ProcessPage_OnProperties(void) { DWORD dwProcessId; - WCHAR szPath[MAX_PATH]; - LPWSTR pszPath = NULL; - LPWSTR pszExePath = NULL; DWORD dwLength; + LPWSTR pszExePath; SHELLEXECUTEINFOW info = { 0 }; dwProcessId = GetSelectedProcessId(); - dwLength = GetProcessExecutablePathById(dwProcessId, szPath, _countof(szPath)); + /* Retrieve the image path length */ + dwLength = GetProcessExecutablePathById(dwProcessId, NULL, 0); if (dwLength == 0) - { return; - } - else if (dwLength > _countof(szPath)) - { - pszPath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR)); - if (!pszPath) - { - return; - } - - if (GetProcessExecutablePathById(dwProcessId, pszPath, dwLength) == 0) - { - goto Cleanup; - } + /* Allocate and retrieve the image path */ + pszExePath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR)); + if (!pszExePath) + return; - pszExePath = pszPath; - } - else - { - pszExePath = szPath; - } + if (GetProcessExecutablePathById(dwProcessId, pszExePath, dwLength) == 0) + goto Cleanup; + /* Call the shell to display the file properties */ info.cbSize = sizeof(SHELLEXECUTEINFOW); info.fMask = SEE_MASK_INVOKEIDLIST; info.hwnd = NULL; @@ -1150,69 +1185,42 @@ void ProcessPage_OnProperties(void) ShellExecuteExW(&info); Cleanup: - - if (pszPath) - { - HeapFree(GetProcessHeap(), 0, pszPath); - } + HeapFree(GetProcessHeap(), 0, pszExePath); } void ProcessPage_OnOpenFileLocation(void) { DWORD dwProcessId; - WCHAR szPath[MAX_PATH]; - LPWSTR pszPath = NULL; - LPWSTR pszExePath = NULL; - LPWSTR pszCmdLine = NULL; DWORD dwLength; + LPWSTR pszExePath; + LPWSTR pszCmdLine = NULL; dwProcessId = GetSelectedProcessId(); - dwLength = GetProcessExecutablePathById(dwProcessId, szPath, _countof(szPath)); + /* Retrieve the image path length */ + dwLength = GetProcessExecutablePathById(dwProcessId, NULL, 0); if (dwLength == 0) - { return; - } - else if (dwLength > _countof(szPath)) - { - pszPath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR)); - - if (!pszPath) - { - return; - } - if (GetProcessExecutablePathById(dwProcessId, pszPath, dwLength) == 0) - { - goto Cleanup; - } + /* Allocate and retrieve the image path */ + pszExePath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR)); + if (!pszExePath) + return; - pszExePath = pszPath; - } - else - { - pszExePath = szPath; - dwLength += 1; - } + if (GetProcessExecutablePathById(dwProcessId, pszExePath, dwLength) == 0) + goto Cleanup; + /* Build the shell command line */ pszCmdLine = HeapAlloc(GetProcessHeap(), 0, (dwLength + 10) * sizeof(WCHAR)); - if (!pszCmdLine) - { goto Cleanup; - } StringCchPrintfW(pszCmdLine, dwLength + 10, L"/select,\"%s\"", pszExePath); - /* Open file explorer and select the exe file */ + /* Call the shell to open the file location and select it */ ShellExecuteW(NULL, L"open", L"explorer.exe", pszCmdLine, NULL, SW_SHOWNORMAL); - HeapFree(GetProcessHeap(), 0, pszCmdLine); - Cleanup: - - if (pszPath) - { - HeapFree(GetProcessHeap(), 0, pszPath); - } + HeapFree(GetProcessHeap(), 0, pszCmdLine); + HeapFree(GetProcessHeap(), 0, pszExePath); }
2 years, 6 months
1
0
0
0
[reactos] 02/02: [NTDLL_APITEST] NtQueryInformationToken: write tests for TokenGroupsAndPrivileges
by George Bișoc
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0c569e1ff37b41ace8b2a…
commit 0c569e1ff37b41ace8b2ae6aab8208b80f13e975 Author: George Bișoc <george.bisoc(a)reactos.org> AuthorDate: Sat Jun 18 21:41:50 2022 +0200 Commit: George Bișoc <george.bisoc(a)reactos.org> CommitDate: Sun Jun 19 17:22:04 2022 +0200 [NTDLL_APITEST] NtQueryInformationToken: write tests for TokenGroupsAndPrivileges --- .../apitests/ntdll/NtQueryInformationToken.c | 101 ++++++++++++++++++++- 1 file changed, 96 insertions(+), 5 deletions(-) diff --git a/modules/rostests/apitests/ntdll/NtQueryInformationToken.c b/modules/rostests/apitests/ntdll/NtQueryInformationToken.c index 0a017f30d1a..cdeca0f9d64 100644 --- a/modules/rostests/apitests/ntdll/NtQueryInformationToken.c +++ b/modules/rostests/apitests/ntdll/NtQueryInformationToken.c @@ -435,7 +435,7 @@ QueryTokenImpersonationTests( &BufferLength); ok_ntstatus(Status, STATUS_SUCCESS); ok(Level == SecurityAnonymous, "The current token impersonation level is not anonymous!\n"); - CloseHandle(DupToken); + NtClose(DupToken); } static @@ -463,7 +463,7 @@ QueryTokenStatisticsTests( Statistics = RtlAllocateHeap(RtlGetProcessHeap(), 0, BufferLength); if (!Statistics) { - skip("Failed to allocate heap for token statistics!\n"); + ok(FALSE, "Failed to allocate from heap for token statistics (required buffer length %lu)!\n", BufferLength); return; } @@ -486,6 +486,96 @@ QueryTokenStatisticsTests( RtlFreeHeap(RtlGetProcessHeap(), 0, Statistics); } +static +VOID +QueryTokenPrivilegesAndGroupsTests( + _In_ HANDLE Token) +{ + NTSTATUS Status; + PTOKEN_GROUPS_AND_PRIVILEGES PrivsAndGroups; + TOKEN_GROUPS SidToRestrict; + HANDLE FilteredToken; + PSID WorldSid; + ULONG BufferLength; + static SID_IDENTIFIER_AUTHORITY WorldAuthority = {SECURITY_WORLD_SID_AUTHORITY}; + + /* + * Create a World SID and filter the token + * by adding a restricted SID. + */ + Status = RtlAllocateAndInitializeSid(&WorldAuthority, + 1, + SECURITY_WORLD_RID, + 0, 0, 0, 0, 0, 0, 0, + &WorldSid); + if (!NT_SUCCESS(Status)) + { + ok(FALSE, "Failed to allocate World SID (Status code %lx)!\n", Status); + return; + } + + SidToRestrict.GroupCount = 1; + SidToRestrict.Groups[0].Attributes = 0; + SidToRestrict.Groups[0].Sid = WorldSid; + + Status = NtFilterToken(Token, + 0, + NULL, + NULL, + &SidToRestrict, + &FilteredToken); + if (!NT_SUCCESS(Status)) + { + ok(FALSE, "Failed to filter the current token (Status code %lx)!\n", Status); + RtlFreeHeap(RtlGetProcessHeap(), 0, WorldSid); + return; + } + + /* + * Query the exact buffer length to hold + * our stuff, STATUS_BUFFER_TOO_SMALL must + * be expected here. + */ + Status = NtQueryInformationToken(FilteredToken, + TokenGroupsAndPrivileges, + NULL, + 0, + &BufferLength); + ok_ntstatus(Status, STATUS_BUFFER_TOO_SMALL); + + /* Allocate the buffer based on the size we got */ + PrivsAndGroups = RtlAllocateHeap(RtlGetProcessHeap(), 0, BufferLength); + if (!PrivsAndGroups) + { + ok(FALSE, "Failed to allocate from heap for token privileges and groups (required buffer length %lu)!\n", BufferLength); + RtlFreeHeap(RtlGetProcessHeap(), 0, WorldSid); + NtClose(FilteredToken); + return; + } + + /* Do the actual query */ + Status = NtQueryInformationToken(FilteredToken, + TokenGroupsAndPrivileges, + PrivsAndGroups, + BufferLength, + &BufferLength); + ok_ntstatus(Status, STATUS_SUCCESS); + + trace("=============== TokenGroupsAndPrivileges ===============\n"); + trace("SID count: %lu\n", PrivsAndGroups->SidCount); + trace("SID length: %lu\n", PrivsAndGroups->SidLength); + trace("Restricted SID count: %lu\n", PrivsAndGroups->RestrictedSidCount); + trace("Restricted SID length: %lu\n", PrivsAndGroups->RestrictedSidLength); + trace("Privilege count: %lu\n", PrivsAndGroups->PrivilegeCount); + trace("Privilege length: %lu\n", PrivsAndGroups->PrivilegeLength); + trace("Authentication ID: %lu %lu\n", PrivsAndGroups->AuthenticationId.LowPart, PrivsAndGroups->AuthenticationId.HighPart); + trace("=========================================\n\n"); + + RtlFreeHeap(RtlGetProcessHeap(), 0, PrivsAndGroups); + RtlFreeHeap(RtlGetProcessHeap(), 0, WorldSid); + NtClose(FilteredToken); +} + static VOID QueryTokenRestrictedSidsTest( @@ -591,7 +681,7 @@ QueryTokenRestrictedSidsTest( RtlFreeHeap(RtlGetProcessHeap(), 0, RestrictedGroups); RtlFreeHeap(RtlGetProcessHeap(), 0, WorldSid); - CloseHandle(FilteredToken); + NtClose(FilteredToken); } static @@ -667,7 +757,7 @@ QueryTokenIsSandboxInert( ok_ntstatus(Status, STATUS_SUCCESS); ok(IsTokenInert == TRUE, "The token must be a sandbox inert one after filtering!\n"); - CloseHandle(FilteredToken); + NtClose(FilteredToken); } static @@ -744,10 +834,11 @@ START_TEST(NtQueryInformationToken) QueryTokenTypeTests(Token); QueryTokenImpersonationTests(Token); QueryTokenStatisticsTests(Token); + QueryTokenPrivilegesAndGroupsTests(Token); QueryTokenRestrictedSidsTest(Token); QueryTokenSessionIdTests(Token); QueryTokenIsSandboxInert(Token); QueryTokenOriginTests(Token); - CloseHandle(Token); + NtClose(Token); }
2 years, 6 months
1
0
0
0
[reactos] 01/02: [NTOS:SE] NtQueryInformationToken: implement TokenGroupsAndPrivileges
by George Bișoc
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9d2de519b2d2781f3a2bd…
commit 9d2de519b2d2781f3a2bddb54cb4a2bfdbb969a3 Author: George Bișoc <george.bisoc(a)reactos.org> AuthorDate: Sun Jun 19 12:39:23 2022 +0200 Commit: George Bișoc <george.bisoc(a)reactos.org> CommitDate: Sun Jun 19 17:22:04 2022 +0200 [NTOS:SE] NtQueryInformationToken: implement TokenGroupsAndPrivileges TokenGroupsAndPrivileges is the younger sister of two TokenGroups and TokenPrivileges classes. In its purpose there's no huge substantial differences apart that this class comes with its own structure, TOKEN_GROUPS_AND_PRIVILEGES, and that this structure comes with extra information. --- ntoskrnl/se/tokencls.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/ntoskrnl/se/tokencls.c b/ntoskrnl/se/tokencls.c index 24adad4f61c..8bb5598ce9e 100644 --- a/ntoskrnl/se/tokencls.c +++ b/ntoskrnl/se/tokencls.c @@ -905,9 +905,83 @@ NtQueryInformationToken( } case TokenGroupsAndPrivileges: - DPRINT1("NtQueryInformationToken(TokenGroupsAndPrivileges) not implemented\n"); - Status = STATUS_NOT_IMPLEMENTED; + { + PSID Sid, RestrictedSid; + ULONG SidLen, RestrictedSidLen; + ULONG UserGroupLength, RestrictedSidLength, PrivilegeLength; + PTOKEN_GROUPS_AND_PRIVILEGES GroupsAndPrivs = (PTOKEN_GROUPS_AND_PRIVILEGES)TokenInformation; + + DPRINT("NtQueryInformationToken(TokenGroupsAndPrivileges)\n"); + UserGroupLength = RtlLengthSidAndAttributes(Token->UserAndGroupCount, Token->UserAndGroups); + RestrictedSidLength = RtlLengthSidAndAttributes(Token->RestrictedSidCount, Token->RestrictedSids); + PrivilegeLength = Token->PrivilegeCount * sizeof(LUID_AND_ATTRIBUTES); + + RequiredLength = sizeof(TOKEN_GROUPS_AND_PRIVILEGES) + + UserGroupLength + RestrictedSidLength + PrivilegeLength; + + _SEH2_TRY + { + if (TokenInformationLength >= RequiredLength) + { + GroupsAndPrivs->SidCount = Token->UserAndGroupCount; + GroupsAndPrivs->SidLength = UserGroupLength; + GroupsAndPrivs->Sids = (PSID_AND_ATTRIBUTES)(GroupsAndPrivs + 1); + + Sid = (PSID)((ULONG_PTR)GroupsAndPrivs->Sids + (Token->UserAndGroupCount * sizeof(SID_AND_ATTRIBUTES))); + SidLen = UserGroupLength - (Token->UserAndGroupCount * sizeof(SID_AND_ATTRIBUTES)); + Status = RtlCopySidAndAttributesArray(Token->UserAndGroupCount, + Token->UserAndGroups, + SidLen, + GroupsAndPrivs->Sids, + Sid, + &Unused.PSid, + &Unused.Ulong); + NT_ASSERT(NT_SUCCESS(Status)); + + GroupsAndPrivs->RestrictedSidCount = Token->RestrictedSidCount; + GroupsAndPrivs->RestrictedSidLength = RestrictedSidLength; + GroupsAndPrivs->RestrictedSids = NULL; + if (SeTokenIsRestricted(Token)) + { + GroupsAndPrivs->RestrictedSids = (PSID_AND_ATTRIBUTES)((ULONG_PTR)GroupsAndPrivs->Sids + UserGroupLength); + + RestrictedSid = (PSID)((ULONG_PTR)GroupsAndPrivs->RestrictedSids + (Token->RestrictedSidCount * sizeof(SID_AND_ATTRIBUTES))); + RestrictedSidLen = RestrictedSidLength - (Token->RestrictedSidCount * sizeof(SID_AND_ATTRIBUTES)); + Status = RtlCopySidAndAttributesArray(Token->RestrictedSidCount, + Token->RestrictedSids, + RestrictedSidLen, + GroupsAndPrivs->RestrictedSids, + RestrictedSid, + &Unused.PSid, + &Unused.Ulong); + NT_ASSERT(NT_SUCCESS(Status)); + } + + GroupsAndPrivs->PrivilegeCount = Token->PrivilegeCount; + GroupsAndPrivs->PrivilegeLength = PrivilegeLength; + GroupsAndPrivs->Privileges = (PLUID_AND_ATTRIBUTES)((ULONG_PTR)(GroupsAndPrivs + 1) + + UserGroupLength + RestrictedSidLength); + RtlCopyLuidAndAttributesArray(Token->PrivilegeCount, + Token->Privileges, + GroupsAndPrivs->Privileges); + + GroupsAndPrivs->AuthenticationId = Token->AuthenticationId; + } + else + { + Status = STATUS_BUFFER_TOO_SMALL; + } + + *ReturnLength = RequiredLength; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + break; + } case TokenRestrictedSids: {
2 years, 6 months
1
0
0
0
[reactos] 01/01: [DISKPART] Print proper file system information for the FILESYSTEMS command
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f79ec61bdc43d8017ba40…
commit f79ec61bdc43d8017ba408aa817543bc65328c6c Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Jun 19 15:40:08 2022 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Jun 19 16:12:10 2022 +0200 [DISKPART] Print proper file system information for the FILESYSTEMS command --- base/system/diskpart/diskpart.h | 1 + base/system/diskpart/filesystems.c | 113 +++++++++++++++++++++++++++++++++++-- base/system/diskpart/lang/de-DE.rc | 3 +- base/system/diskpart/lang/en-US.rc | 3 +- base/system/diskpart/lang/pl-PL.rc | 3 +- base/system/diskpart/lang/pt-PT.rc | 3 +- base/system/diskpart/lang/ro-RO.rc | 3 +- base/system/diskpart/lang/ru-RU.rc | 3 +- base/system/diskpart/lang/sq-AL.rc | 3 +- base/system/diskpart/lang/tr-TR.rc | 3 +- base/system/diskpart/lang/zh-CN.rc | 3 +- base/system/diskpart/lang/zh-TW.rc | 3 +- base/system/diskpart/partlist.c | 9 ++- base/system/diskpart/resource.h | 1 + 14 files changed, 133 insertions(+), 21 deletions(-) diff --git a/base/system/diskpart/diskpart.h b/base/system/diskpart/diskpart.h index aa0e557e4e3..fbfb978f537 100644 --- a/base/system/diskpart/diskpart.h +++ b/base/system/diskpart/diskpart.h @@ -190,6 +190,7 @@ typedef struct _VOLENTRY ULONG VolumeNumber; WCHAR VolumeName[MAX_PATH]; + WCHAR DeviceName[MAX_PATH]; WCHAR DriveLetter; diff --git a/base/system/diskpart/filesystems.c b/base/system/diskpart/filesystems.c index 9257068746a..2a416693b4b 100644 --- a/base/system/diskpart/filesystems.c +++ b/base/system/diskpart/filesystems.c @@ -11,6 +11,104 @@ #define NDEBUG #include <debug.h> +static +BOOL +GetFileSystemInfo( + PVOLENTRY VolumeEntry) +{ + WCHAR VolumeNameBuffer[MAX_PATH]; + UNICODE_STRING VolumeName; + HANDLE VolumeHandle; + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + ULONG ulSize, ulClusterSize = 0; + FILE_FS_FULL_SIZE_INFORMATION SizeInfo; + FILE_FS_FULL_SIZE_INFORMATION FullSizeInfo; + PFILE_FS_ATTRIBUTE_INFORMATION pAttributeInfo = NULL; + NTSTATUS Status; + + wcscpy(VolumeNameBuffer, VolumeEntry->DeviceName); + wcscat(VolumeNameBuffer, L"\\"); + + RtlInitUnicodeString(&VolumeName, VolumeNameBuffer); + + InitializeObjectAttributes(&ObjectAttributes, + &VolumeName, + 0, + NULL, + NULL); + + Status = NtOpenFile(&VolumeHandle, + SYNCHRONIZE, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_BACKUP_INTENT); + if (!NT_SUCCESS(Status)) + { + if (Status == STATUS_NO_MEDIA_IN_DEVICE) + { + ConResPuts(StdOut, IDS_ERROR_NO_MEDIUM); + return FALSE; + } + else if (Status == STATUS_UNRECOGNIZED_VOLUME) + { + ConResPuts(StdOut, IDS_FILESYSTEMS_CURRENT); + ConPuts(StdOut, L"\n"); + ConResPrintf(StdOut, IDS_FILESYSTEMS_TYPE, L"RAW"); + ConResPrintf(StdOut, IDS_FILESYSTEMS_CLUSTERSIZE, 512); + } + + return TRUE; + } + + ulSize = sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 255 * sizeof(WCHAR); + pAttributeInfo = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + ulSize); + + Status = NtQueryVolumeInformationFile(VolumeHandle, + &IoStatusBlock, + pAttributeInfo, + ulSize, + FileFsAttributeInformation); + + Status = NtQueryVolumeInformationFile(VolumeHandle, + &IoStatusBlock, + &FullSizeInfo, + sizeof(FILE_FS_FULL_SIZE_INFORMATION), + FileFsFullSizeInformation); + if (NT_SUCCESS(Status)) + { + ulClusterSize = FullSizeInfo.BytesPerSector * FullSizeInfo.SectorsPerAllocationUnit; + } + else + { + Status = NtQueryVolumeInformationFile(VolumeHandle, + &IoStatusBlock, + &SizeInfo, + sizeof(FILE_FS_SIZE_INFORMATION), + FileFsSizeInformation); + if (NT_SUCCESS(Status)) + { + ulClusterSize = SizeInfo.BytesPerSector * SizeInfo.SectorsPerAllocationUnit; + } + } + + + ConResPuts(StdOut, IDS_FILESYSTEMS_CURRENT); + ConPuts(StdOut, L"\n"); + + ConResPrintf(StdOut, IDS_FILESYSTEMS_TYPE, pAttributeInfo->FileSystemName); + ConResPrintf(StdOut, IDS_FILESYSTEMS_CLUSTERSIZE, ulClusterSize); + + if (pAttributeInfo) + RtlFreeHeap(RtlGetProcessHeap(), 0, pAttributeInfo); + + NtClose(VolumeHandle); + + return TRUE; +} BOOL filesystems_main( @@ -24,13 +122,16 @@ filesystems_main( } ConPuts(StdOut, L"\n"); - ConResPuts(StdOut, IDS_FILESYSTEMS_CURRENT); - ConPuts(StdOut, L"\n"); - ConResPrintf(StdOut, IDS_FILESYSTEMS_TYPE, (CurrentVolume->pszFilesystem == NULL) ? L"RAW" : CurrentVolume->pszFilesystem); - ConResPrintf(StdOut, IDS_FILESYSTEMS_CLUSTERSIZE); - ConPuts(StdOut, L"\n"); - ConResPuts(StdOut, IDS_FILESYSTEMS_FORMATTING); + if (GetFileSystemInfo(CurrentVolume)) + { + ConPuts(StdOut, L"\n"); + ConResPuts(StdOut, IDS_FILESYSTEMS_FORMATTING); + + /* FIXME: List available file systems */ + + } + ConPuts(StdOut, L"\n"); return TRUE; diff --git a/base/system/diskpart/lang/de-DE.rc b/base/system/diskpart/lang/de-DE.rc index bf8345d9b6f..f66f0726f18 100644 --- a/base/system/diskpart/lang/de-DE.rc +++ b/base/system/diskpart/lang/de-DE.rc @@ -72,7 +72,7 @@ BEGIN IDS_FILESYSTEMS_CURRENT "Aktuelles Dateisystem\n" IDS_FILESYSTEMS_FORMATTING "Zur Formatierung unterstützte Dateisysteme\n" IDS_FILESYSTEMS_TYPE "Typ : %s\n" - IDS_FILESYSTEMS_CLUSTERSIZE "Größe der Zuordnungseinheit: \n" + IDS_FILESYSTEMS_CLUSTERSIZE "Größe der Zuordnungseinheit: %lu\n" END STRINGTABLE @@ -233,4 +233,5 @@ BEGIN IDS_ERROR_MSG_NO_SCRIPT "Error opening script: %s\n" IDS_ERROR_MSG_BAD_ARG "Error processing argument: %s\n" IDS_ERROR_INVALID_ARGS "Invalid arguments\n" + IDS_ERROR_NO_MEDIUM "Es befindet sich kein Medium im Gerät.\n" END diff --git a/base/system/diskpart/lang/en-US.rc b/base/system/diskpart/lang/en-US.rc index af0d2185b11..c3a00e406ec 100644 --- a/base/system/diskpart/lang/en-US.rc +++ b/base/system/diskpart/lang/en-US.rc @@ -72,7 +72,7 @@ BEGIN IDS_FILESYSTEMS_CURRENT "Current Filesystem\n" IDS_FILESYSTEMS_FORMATTING "Filesystems available for formatting\n" IDS_FILESYSTEMS_TYPE "Type : %s\n" - IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: \n" + IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: %lu\n" END STRINGTABLE @@ -233,4 +233,5 @@ BEGIN IDS_ERROR_MSG_NO_SCRIPT "Error opening script: %s\n" IDS_ERROR_MSG_BAD_ARG "Error processing argument: %s\n" IDS_ERROR_INVALID_ARGS "Invalid arguments\n" + IDS_ERROR_NO_MEDIUM "No medium in device.\n" END diff --git a/base/system/diskpart/lang/pl-PL.rc b/base/system/diskpart/lang/pl-PL.rc index f71ad8e1173..d67404e7812 100644 --- a/base/system/diskpart/lang/pl-PL.rc +++ b/base/system/diskpart/lang/pl-PL.rc @@ -72,7 +72,7 @@ BEGIN IDS_FILESYSTEMS_CURRENT "Current Filesystem\n" IDS_FILESYSTEMS_FORMATTING "Filesystems available for formatting\n" IDS_FILESYSTEMS_TYPE "Type : %s\n" - IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: \n" + IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: %lu\n" END STRINGTABLE @@ -233,4 +233,5 @@ BEGIN IDS_ERROR_MSG_NO_SCRIPT "Błąd podczas otwierania skryptu: %s\n" IDS_ERROR_MSG_BAD_ARG "Błąd przetwarzania argumentu: %s\n" IDS_ERROR_INVALID_ARGS "Nieprawidłowe argumenty\n" + IDS_ERROR_NO_MEDIUM "No medium in device.\n" END diff --git a/base/system/diskpart/lang/pt-PT.rc b/base/system/diskpart/lang/pt-PT.rc index a9d210aee03..5d0bfab3ad7 100644 --- a/base/system/diskpart/lang/pt-PT.rc +++ b/base/system/diskpart/lang/pt-PT.rc @@ -74,7 +74,7 @@ BEGIN IDS_FILESYSTEMS_CURRENT "Current Filesystem\n" IDS_FILESYSTEMS_FORMATTING "Filesystems available for formatting\n" IDS_FILESYSTEMS_TYPE "Type : %s\n" - IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: \n" + IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: %lu\n" END STRINGTABLE @@ -235,4 +235,5 @@ BEGIN IDS_ERROR_MSG_NO_SCRIPT "Erro ao abrir o script: %s\n" IDS_ERROR_MSG_BAD_ARG "Erro ao processar o argumento: %s\n" IDS_ERROR_INVALID_ARGS "Argumento inválido\n" + IDS_ERROR_NO_MEDIUM "No medium in device.\n" END diff --git a/base/system/diskpart/lang/ro-RO.rc b/base/system/diskpart/lang/ro-RO.rc index 7bfd771a786..81dc6afce99 100644 --- a/base/system/diskpart/lang/ro-RO.rc +++ b/base/system/diskpart/lang/ro-RO.rc @@ -74,7 +74,7 @@ BEGIN IDS_FILESYSTEMS_CURRENT "Current Filesystem\n" IDS_FILESYSTEMS_FORMATTING "Filesystems available for formatting\n" IDS_FILESYSTEMS_TYPE "Type : %s\n" - IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: \n" + IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: %lu\n" END STRINGTABLE @@ -235,4 +235,5 @@ BEGIN IDS_ERROR_MSG_NO_SCRIPT "Eroare la deschiderea fișierului script: %s\n" IDS_ERROR_MSG_BAD_ARG "Eroare la prelucrarea argumentului: %s\n" IDS_ERROR_INVALID_ARGS "Argumente nevalide\n" + IDS_ERROR_NO_MEDIUM "No medium in device.\n" END diff --git a/base/system/diskpart/lang/ru-RU.rc b/base/system/diskpart/lang/ru-RU.rc index 0dcb1fb3377..bf9f2182875 100644 --- a/base/system/diskpart/lang/ru-RU.rc +++ b/base/system/diskpart/lang/ru-RU.rc @@ -74,7 +74,7 @@ BEGIN IDS_FILESYSTEMS_CURRENT "Current Filesystem\n" IDS_FILESYSTEMS_FORMATTING "Filesystems available for formatting\n" IDS_FILESYSTEMS_TYPE "Type : %s\n" - IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: \n" + IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: %lu\n" END STRINGTABLE @@ -235,4 +235,5 @@ BEGIN IDS_ERROR_MSG_NO_SCRIPT "Ошибка открытия скрипта: %s\n" IDS_ERROR_MSG_BAD_ARG "Ошибка обработки параметров: %s\n" IDS_ERROR_INVALID_ARGS "Ошибка в указании параметров\n" + IDS_ERROR_NO_MEDIUM "No medium in device.\n" END diff --git a/base/system/diskpart/lang/sq-AL.rc b/base/system/diskpart/lang/sq-AL.rc index 26ca5044578..6e1ac5af471 100644 --- a/base/system/diskpart/lang/sq-AL.rc +++ b/base/system/diskpart/lang/sq-AL.rc @@ -76,7 +76,7 @@ BEGIN IDS_FILESYSTEMS_CURRENT "Current Filesystem\n" IDS_FILESYSTEMS_FORMATTING "Filesystems available for formatting\n" IDS_FILESYSTEMS_TYPE "Type : %s\n" - IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: \n" + IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: %lu\n" END STRINGTABLE @@ -237,4 +237,5 @@ BEGIN IDS_ERROR_MSG_NO_SCRIPT "Error në hapjen e skriptes: %s\n" IDS_ERROR_MSG_BAD_ARG "Error argumenti i procesimit: %s\n" IDS_ERROR_INVALID_ARGS "Invalid arguments\n" + IDS_ERROR_NO_MEDIUM "No medium in device.\n" END diff --git a/base/system/diskpart/lang/tr-TR.rc b/base/system/diskpart/lang/tr-TR.rc index f13e48ef803..a2be5d463ce 100644 --- a/base/system/diskpart/lang/tr-TR.rc +++ b/base/system/diskpart/lang/tr-TR.rc @@ -74,7 +74,7 @@ BEGIN IDS_FILESYSTEMS_CURRENT "Current Filesystem\n" IDS_FILESYSTEMS_FORMATTING "Filesystems available for formatting\n" IDS_FILESYSTEMS_TYPE "Type : %s\n" - IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: \n" + IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: %lu\n" END STRINGTABLE @@ -235,4 +235,5 @@ BEGIN IDS_ERROR_MSG_NO_SCRIPT "Betik açmada yanlışlık: %s\n" IDS_ERROR_MSG_BAD_ARG "Argüman işlemede yanlışlık: %s\n" IDS_ERROR_INVALID_ARGS "Geçersiz değiştirgenler\n" + IDS_ERROR_NO_MEDIUM "No medium in device.\n" END diff --git a/base/system/diskpart/lang/zh-CN.rc b/base/system/diskpart/lang/zh-CN.rc index 4f48fd8c7f2..6ede50da37e 100644 --- a/base/system/diskpart/lang/zh-CN.rc +++ b/base/system/diskpart/lang/zh-CN.rc @@ -81,7 +81,7 @@ BEGIN IDS_FILESYSTEMS_CURRENT "Current Filesystem\n" IDS_FILESYSTEMS_FORMATTING "Filesystems available for formatting\n" IDS_FILESYSTEMS_TYPE "Type : %s\n" - IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: \n" + IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: %lu\n" END STRINGTABLE @@ -242,4 +242,5 @@ BEGIN IDS_ERROR_MSG_NO_SCRIPT "打开脚本时出错:%s\n" IDS_ERROR_MSG_BAD_ARG "处理参数时出错:%s\n" IDS_ERROR_INVALID_ARGS "无效的参数\n" + IDS_ERROR_NO_MEDIUM "No medium in device.\n" END diff --git a/base/system/diskpart/lang/zh-TW.rc b/base/system/diskpart/lang/zh-TW.rc index 814cda7e40b..f0031305c8a 100644 --- a/base/system/diskpart/lang/zh-TW.rc +++ b/base/system/diskpart/lang/zh-TW.rc @@ -75,7 +75,7 @@ BEGIN IDS_FILESYSTEMS_CURRENT "Current Filesystem\n" IDS_FILESYSTEMS_FORMATTING "Filesystems available for formatting\n" IDS_FILESYSTEMS_TYPE "Type : %s\n" - IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: \n" + IDS_FILESYSTEMS_CLUSTERSIZE "Cluster size: %lu\n" END STRINGTABLE @@ -236,4 +236,5 @@ BEGIN IDS_ERROR_MSG_NO_SCRIPT "錯誤開始的指令碼: %s\n" IDS_ERROR_MSG_BAD_ARG "錯誤處理參數: %s\n" IDS_ERROR_INVALID_ARGS "無效的參數\n" + IDS_ERROR_NO_MEDIUM "No medium in device.\n" END diff --git a/base/system/diskpart/partlist.c b/base/system/diskpart/partlist.c index 713e54ca645..dbd0ef0e24a 100644 --- a/base/system/diskpart/partlist.c +++ b/base/system/diskpart/partlist.c @@ -1254,7 +1254,7 @@ GetVolumeExtents( static VOID GetVolumeType( - HANDLE VolumeHandle, + _In_ HANDLE VolumeHandle, _In_ PVOLENTRY VolumeEntry) { FILE_FS_DEVICE_INFORMATION DeviceInfo; @@ -1306,7 +1306,6 @@ AddVolumeToList( WCHAR szFilesystem[MAX_PATH + 1]; DWORD CharCount = 0; - WCHAR DeviceName[MAX_PATH] = L""; size_t Index = 0; OBJECT_ATTRIBUTES ObjectAttributes; @@ -1329,7 +1328,7 @@ AddVolumeToList( pszVolumeName[Index] = L'\0'; - CharCount = QueryDosDeviceW(&pszVolumeName[4], DeviceName, ARRAYSIZE(DeviceName)); + CharCount = QueryDosDeviceW(&pszVolumeName[4], VolumeEntry->DeviceName, ARRAYSIZE(VolumeEntry->DeviceName)); pszVolumeName[Index] = L'\\'; @@ -1339,9 +1338,9 @@ AddVolumeToList( return; } - DPRINT("DeviceName: %S\n", DeviceName); + DPRINT("DeviceName: %S\n", VolumeEntry->DeviceName); - RtlInitUnicodeString(&Name, DeviceName); + RtlInitUnicodeString(&Name, VolumeEntry->DeviceName); InitializeObjectAttributes(&ObjectAttributes, &Name, diff --git a/base/system/diskpart/resource.h b/base/system/diskpart/resource.h index ca9d401d3ff..5b776a324d5 100644 --- a/base/system/diskpart/resource.h +++ b/base/system/diskpart/resource.h @@ -185,3 +185,4 @@ #define IDS_ERROR_MSG_NO_SCRIPT 2000 #define IDS_ERROR_MSG_BAD_ARG 2001 #define IDS_ERROR_INVALID_ARGS 2002 +#define IDS_ERROR_NO_MEDIUM 2003
2 years, 6 months
1
0
0
0
[reactos] 02/02: Modified WINESYNC.txt to show individual tests for msxml3 and update for schema
by Doug Lyons
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b6d1d1fd7d33dd09a6c22…
commit b6d1d1fd7d33dd09a6c22d3bd202b9e6f513bbdf Author: Doug Lyons <douglyons(a)douglyons.com> AuthorDate: Fri Oct 15 10:36:21 2021 -0500 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Jun 19 15:48:42 2022 +0200 Modified WINESYNC.txt to show individual tests for msxml3 and update for schema --- media/doc/WINESYNC.txt | 8 +++++++- modules/rostests/winetests/msxml3/schema.c | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/media/doc/WINESYNC.txt b/media/doc/WINESYNC.txt index 8901c4ab1eb..07549edfc64 100644 --- a/media/doc/WINESYNC.txt +++ b/media/doc/WINESYNC.txt @@ -131,7 +131,13 @@ dll/win32/msvfw32 # Synced to WineStaging-4.18 dll/win32/msvidc32 # Synced to WineStaging-4.0 dll/win32/msxml # Synced to WineStaging-3.3 dll/win32/msxml2 # Synced to WineStaging-3.3 -dll/win32/msxml3 # Synced to WineStaging-4.18 +dll/win32/msxml3/domdoc # Synced to WineStaging-4.18 +dll/win32/msxml3/httpreq # Synced to WineStaging-4.18 +dll/win32/msxml3/saxreader # Synced to WineStaging-4.18 +dll/win32/msxml3/schema # Synced to Wine-6.14 +dll/win32/msxml3/xmldoc # Synced to WineStaging-4.18 +dll/win32/msxml3/xmlparser # Synced to WineStaging-4.18 +dll/win32/msxml3/xmlview # Synced to WineStaging-4.18 dll/win32/msxml4 # Synced to WineStaging-3.3 dll/win32/msxml6 # Synced to WineStaging-3.3 dll/win32/nddeapi # Synced to WineStaging-3.3 diff --git a/modules/rostests/winetests/msxml3/schema.c b/modules/rostests/winetests/msxml3/schema.c index 99b83849055..c7796e768d8 100644 --- a/modules/rostests/winetests/msxml3/schema.c +++ b/modules/rostests/winetests/msxml3/schema.c @@ -19,8 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -/* Synced to Wine-6.14 by Doug Lyons on September 21, 2021 */ - #include <stdio.h> #include <assert.h> #define COBJMACROS
2 years, 6 months
1
0
0
0
[reactos] 01/02: Fix winetests/msxml3/schema.c crashes and sync to Wine-6.14
by Doug Lyons
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=967db49174abc375f5fc1…
commit 967db49174abc375f5fc15467a72d30be6462713 Author: Doug Lyons <douglyons(a)douglyons.com> AuthorDate: Thu Oct 14 18:34:18 2021 -0500 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Jun 19 15:48:42 2022 +0200 Fix winetests/msxml3/schema.c crashes and sync to Wine-6.14 --- modules/rostests/winetests/msxml3/schema.c | 214 ++++++++++++++++++++++++++--- 1 file changed, 195 insertions(+), 19 deletions(-) diff --git a/modules/rostests/winetests/msxml3/schema.c b/modules/rostests/winetests/msxml3/schema.c index c615e859817..99b83849055 100644 --- a/modules/rostests/winetests/msxml3/schema.c +++ b/modules/rostests/winetests/msxml3/schema.c @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +/* Synced to Wine-6.14 by Doug Lyons on September 21, 2021 */ + #include <stdio.h> #include <assert.h> #define COBJMACROS @@ -30,24 +32,13 @@ #undef CLSID_DOMDocument #include "msxml2did.h" #include "dispex.h" +#include "cguid.h" #include "wine/test.h" -#ifdef __REACTOS__ -#include <cguid.h> -#endif - #define EXPECT_HR(hr,hr_exp) \ ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp) -static const WCHAR xdr_schema_uri[] = {'x','-','s','c','h','e','m','a',':','t','e','s','t','.','x','m','l',0}; - -static const WCHAR xdr_schema_xml[] = { - '<','S','c','h','e','m','a',' ','x','m','l','n','s','=','\"','u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','x','m','l','-','d','a','t','a','\"','\n', - 'x','m','l','n','s',':','d','t','=','\"','u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','d','a','t','a','t','y','p','e','s','\"','>','\n', - '<','/','S','c','h','e','m','a','>','\n',0 -}; - static const CHAR xdr_schema1_uri[] = "x-schema:test1.xdr"; static const CHAR xdr_schema1_xml[] = "<?xml version='1.0'?>" @@ -506,7 +497,8 @@ static void* _create_object(const GUID *clsid, const char *name, const IID *iid, static void test_schema_refs(void) { - static const WCHAR emptyW[] = {0}; + static const WCHAR xdr_schema_xml[] = + L"<Schema xmlns=\"urn:schemas-microsoft-com:xml-data\"\nxmlns:dt=\"urn:schemas-microsoft-com:datatypes\">\n</Schema>\n"; IXMLDOMDocument2 *doc; IXMLDOMNode *node; IXMLDOMSchemaCollection *cache; @@ -551,12 +543,18 @@ static void test_schema_refs(void) node = NULL; ole_check(IXMLDOMSchemaCollection_get(cache, NULL, &node)); ok(node != NULL, "%p\n", node); +#if __REACTOS__ + if (node) +#endif IXMLDOMNode_Release(node); node = NULL; - str = SysAllocString(emptyW); + str = SysAllocString(L""); ole_check(IXMLDOMSchemaCollection_get(cache, str, &node)); ok(node != NULL, "%p\n", node); +#if __REACTOS__ + if (node) +#endif IXMLDOMNode_Release(node); SysFreeString(str); @@ -584,7 +582,7 @@ static void test_schema_refs(void) ok(hr == S_OK, "got 0x%08x\n", hr); ok(len == 0, "got %d\n", len); - str = SysAllocString(xdr_schema_uri); + str = SysAllocString(L"x-schema:test.xml"); ole_check(IXMLDOMSchemaCollection_add(cache, str, _variantdoc_(doc))); /* IXMLDOMSchemaCollection_add doesn't add a ref on doc */ @@ -989,10 +987,20 @@ static void test_collection_content(void) bstr = NULL; ole_check(IXMLDOMSchemaCollection_get_namespaceURI(cache1, i, &bstr)); ok(bstr != NULL && *bstr, "expected non-empty string\n"); +#if __REACTOS__ + if (bstr != NULL && *bstr) + { + content[i] = bstr; + for (j = 0; j < i; ++j) + ok(wcscmp(content[j], bstr), "got duplicate entry\n"); + } +#else content[i] = bstr; for (j = 0; j < i; ++j) ok(winetest_strcmpW(content[j], bstr), "got duplicate entry\n"); +#endif + } for (i = 0; i < 3; ++i) @@ -1009,8 +1017,16 @@ static void test_collection_content(void) ole_check(IXMLDOMSchemaCollection_get_namespaceURI(cache2, i, &bstr)); ok(bstr != NULL && *bstr, "expected non-empty string\n"); +#if __REACTOS__ + if (bstr != NULL && *bstr) + { + for (j = 0; j < i; ++j) + ok(wcscmp(content[j], bstr), "got duplicate entry\n"); + } +#else for (j = 0; j < i; ++j) ok(winetest_strcmpW(content[j], bstr), "got duplicate entry\n"); +#endif content[i] = bstr; } @@ -1027,6 +1043,167 @@ static void test_collection_content(void) free_bstrs(); } +static HRESULT validate_regex_document(IXMLDOMDocument2 *doc, IXMLDOMDocument2 *schema, IXMLDOMSchemaCollection* cache, + const WCHAR *regex, const WCHAR *input) +{ + static const WCHAR regex_doc[] = +L"" +"<?xml version='1.0'?>" +"<root xmlns='urn:test'>%s</root>"; + + static const WCHAR regex_schema[] = +L"<?xml version='1.0'?>" +"<schema xmlns='
http://www.w3.org/2001/XMLSchema
'" +" targetNamespace='urn:test'>" +" <element name='root'>" +" <simpleType>" +" <restriction base='string'>" +" <pattern value='%s'/>" +" </restriction>" +" </simpleType>" +" </element>" +"</schema>"; + + WCHAR buffer[1024]; + IXMLDOMParseError* err; + VARIANT v; + VARIANT_BOOL b; + BSTR namespace; + BSTR bstr; + HRESULT hr; + + VariantInit(&v); + +#ifdef __REACTOS__ + swprintf(buffer, regex_doc, input); +#else + swprintf(buffer, ARRAY_SIZE(buffer), regex_doc, input); +#endif + bstr = SysAllocString(buffer); + ole_check(IXMLDOMDocument2_loadXML(doc, bstr, &b)); + ok(b == VARIANT_TRUE, "failed to load XML\n"); + SysFreeString(bstr); + +#ifdef __REACTOS__ + swprintf(buffer, regex_schema, regex); +#else + swprintf(buffer, ARRAY_SIZE(buffer), regex_schema, regex); +#endif + bstr = SysAllocString(buffer); + ole_check(IXMLDOMDocument2_loadXML(schema, bstr, &b)); + ok(b == VARIANT_TRUE, "failed to load XML\n"); + SysFreeString(bstr); + + /* add the schema to the cache */ + V_VT(&v) = VT_DISPATCH; + V_DISPATCH(&v) = NULL; + ole_check(IXMLDOMDocument2_QueryInterface(schema, &IID_IDispatch, (void**)&V_DISPATCH(&v))); + ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n"); + namespace = alloc_str_from_narrow("urn:test"); + hr = IXMLDOMSchemaCollection_add(cache, namespace, v); + SysFreeString(namespace); + VariantClear(&v); + if (FAILED(hr)) + return hr; + + /* associate the cache to the doc */ + V_VT(&v) = VT_DISPATCH; + V_DISPATCH(&v) = NULL; + ole_check(IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&v))); + ok(V_DISPATCH(&v) != NULL, "failed to get IDispatch interface\n"); + ole_check(IXMLDOMDocument2_putref_schemas(doc, v)); + VariantClear(&v); + + /* validate the doc + * only declared elements in the declared order + * this is fine */ + err = NULL; + bstr = NULL; + hr = IXMLDOMDocument2_validate(doc, &err); + ok(err != NULL, "domdoc_validate() should always set err\n"); + if (IXMLDOMParseError_get_reason(err, &bstr) != S_FALSE) + trace("got error: %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + IXMLDOMParseError_Release(err); + + return hr; +} + +static void test_regex(void) +{ + struct regex_test { + const WCHAR *regex; + const WCHAR *input; + BOOL todo; + }; + + struct regex_test tests[] = { + { L"\\!", L"!", TRUE }, + { L"\\\"", L"\"", TRUE }, + { L"\\#", L"#", TRUE }, + { L"\\$", L"$", TRUE }, + { L"\\%", L"%", TRUE }, + { L"\\,", L",", TRUE }, + { L"\\/", L"/", TRUE }, + { L"\\:", L":", TRUE }, + { L"\\;", L";", TRUE }, + { L"\\=", L"=", TRUE }, + { L"\\>", L">", TRUE }, + { L"\\@", L"@", TRUE }, + { L"\\`", L"`", TRUE }, + { L"\\~", L"~", TRUE }, + { L"\\uCAFE", L"\xCAFE", TRUE }, + /* non-BMP character in surrogate pairs: */ + { L"\\uD83D\\uDE00", L"\xD83D\xDE00", TRUE } + }; + + int i; + + for (i = 0; i < ARRAY_SIZE(tests); i++) + { + IXMLDOMDocument2 *doc40, *doc60; + IXMLDOMDocument2 *schema40, *schema60; + IXMLDOMSchemaCollection *cache40, *cache60; + + doc40 = create_document_version(40, &IID_IXMLDOMDocument2); + doc60 = create_document_version(60, &IID_IXMLDOMDocument2); + schema40 = create_document_version(40, &IID_IXMLDOMDocument2); + schema60 = create_document_version(60, &IID_IXMLDOMDocument2); + cache40 = create_cache_version(40, &IID_IXMLDOMSchemaCollection); + cache60 = create_cache_version(60, &IID_IXMLDOMSchemaCollection); + + if (doc60 && schema60 && cache60) + { + HRESULT hr = validate_regex_document(doc60, schema60, cache60, tests[i].regex, tests[i].input); + todo_wine_if(tests[i].todo) + ok(hr == S_OK, "got 0x%08x for version 60 regex %s input %s\n", + hr, wine_dbgstr_w(tests[i].regex), wine_dbgstr_w(tests[i].input)); + if (doc40 && schema40 && cache40) + { + hr = validate_regex_document(doc40, schema40, cache40, tests[i].regex, tests[i].input); + todo_wine_if(tests[i].todo) + ok(hr == S_OK, "got 0x%08x for version 40 regex %s input %s\n", + hr, wine_dbgstr_w(tests[i].regex), wine_dbgstr_w(tests[i].input)); + } + } + else + ok(0, "out of memory\n"); + + if (doc40) + IXMLDOMDocument2_Release(doc40); + if (doc60) + IXMLDOMDocument2_Release(doc60); + if (schema40) + IXMLDOMDocument2_Release(schema40); + if (schema60) + IXMLDOMDocument2_Release(schema60); + if (cache40) + IXMLDOMSchemaCollection_Release(cache40); + if (cache60) + IXMLDOMSchemaCollection_Release(cache60); + } +} + static void test_XDR_schemas(void) { IXMLDOMDocument2 *doc, *schema; @@ -1438,8 +1615,6 @@ static void test_validate_on_load(void) static void test_obj_dispex(IUnknown *obj) { - static const WCHAR testW[] = {'t','e','s','t','p','r','o','p',0}; - static const WCHAR starW[] = {'*',0}; DISPID dispid = DISPID_SAX_XMLREADER_GETFEATURE; IDispatchEx *dispex; IUnknown *unk; @@ -1457,7 +1632,7 @@ static void test_obj_dispex(IUnknown *obj) EXPECT_HR(hr, S_OK); ok(ticnt == 1, "ticnt=%u\n", ticnt); - name = SysAllocString(starW); + name = SysAllocString(L"*"); hr = IDispatchEx_DeleteMemberByName(dispex, name, fdexNameCaseSensitive); EXPECT_HR(hr, E_NOTIMPL); SysFreeString(name); @@ -1482,7 +1657,7 @@ static void test_obj_dispex(IUnknown *obj) EXPECT_HR(hr, E_NOTIMPL); ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk); - name = SysAllocString(testW); + name = SysAllocString(L"testprop"); hr = IDispatchEx_GetDispID(dispex, name, fdexNameEnsure, &dispid); ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08x\n", hr); SysFreeString(name); @@ -1686,6 +1861,7 @@ START_TEST(schema) test_collection_refs(); test_length(); test_collection_content(); + test_regex(); test_XDR_schemas(); test_XDR_datatypes(); test_validate_on_load();
2 years, 6 months
1
0
0
0
← Newer
1
2
3
4
5
6
...
24
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
Results per page:
10
25
50
100
200