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
October 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
23 participants
162 discussions
Start a n
N
ew thread
[reactos] 01/01: [FREELDR] Partially implement docking station detection (#4751)
by Dmitry Borisov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9d06e79373bdc39ee69b7…
commit 9d06e79373bdc39ee69b70bba2b3293341874b27 Author: Dmitry Borisov <di.sean(a)protonmail.com> AuthorDate: Wed Oct 19 20:48:27 2022 +0600 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Oct 19 16:48:27 2022 +0200 [FREELDR] Partially implement docking station detection (#4751) --- boot/freeldr/freeldr/arch/amd64/pnpbios.S | 55 +++++++++++++++------- boot/freeldr/freeldr/arch/i386/pc/machpc.c | 59 ++++++++++++++++++++++++ boot/freeldr/freeldr/arch/i386/pnpbios.S | 57 ++++++++++++++++------- boot/freeldr/freeldr/arch/realmode/amd64.S | 2 + boot/freeldr/freeldr/arch/realmode/i386.S | 2 + boot/freeldr/freeldr/arch/realmode/pnp.inc | 25 ++++++++++ boot/freeldr/freeldr/include/arch/pc/hardware.h | 1 + boot/freeldr/freeldr/include/arch/pc/pcbios.h | 6 +++ boot/freeldr/freeldr/include/arch/pc/x86common.h | 1 + 9 files changed, 175 insertions(+), 33 deletions(-) diff --git a/boot/freeldr/freeldr/arch/amd64/pnpbios.S b/boot/freeldr/freeldr/arch/amd64/pnpbios.S index 8dd44e933ca..4651f3bb0b0 100644 --- a/boot/freeldr/freeldr/arch/amd64/pnpbios.S +++ b/boot/freeldr/freeldr/arch/amd64/pnpbios.S @@ -1,21 +1,9 @@ /* - * FreeLoader - * Copyright (C) 2003 Eric Kohl - * Copyright (C) 2011 Timo Kreuzer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * PROJECT: FreeLoader + * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) + * PURPOSE: PnP BIOS helper functions + * COPYRIGHT: Copyright 2003 Eric Kohl <eric.kohl(a)reactos.org> + * Copyright 2011 Timo Kreuzer <timo.kreuzer(a)reactos.org> */ #include <asm.inc> @@ -170,5 +158,38 @@ PnpBiosGetDeviceNode: ret + +/* + * U32 PnpBiosGetDockStationInformation(U8 *DockingStationInfo<rcx>); + * + * RETURNS: + */ +PUBLIC PnpBiosGetDockStationInformation +PnpBiosGetDockStationInformation: + + /* Convert pointer to info structure to segment/offset */ + mov rax, rcx + shr eax, 4 + mov word ptr [BSS_PnpBiosBufferSegment], ax + mov rax, rcx + and eax, HEX(0f) + mov word ptr [BSS_PnpBiosBufferOffset], ax + + /* Save registers */ + push rcx + push rbx + + /* Call the real mode function */ + mov bx, FNID_PnpBiosGetDockStationInformation + call CallRealMode + + /* Restore registers */ + pop rbx + pop rcx + + mov eax, dword ptr [BSS_PnpResult] + + ret + END /* EOF */ diff --git a/boot/freeldr/freeldr/arch/i386/pc/machpc.c b/boot/freeldr/freeldr/arch/i386/pc/machpc.c index 8ac4139442a..43baec3b491 100644 --- a/boot/freeldr/freeldr/arch/i386/pc/machpc.c +++ b/boot/freeldr/freeldr/arch/i386/pc/machpc.c @@ -177,6 +177,63 @@ PcGetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize) return PartialResourceList; } +static +VOID +DetectDockingStation( + _Inout_ PCONFIGURATION_COMPONENT_DATA BusKey) +{ + PCM_PARTIAL_RESOURCE_LIST PartialResourceList; + PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor; + PCONFIGURATION_COMPONENT_DATA PeripheralKey; + PDOCKING_STATE_INFORMATION DockingState; + ULONG Size, Result; + + Result = PnpBiosGetDockStationInformation(DiskReadBuffer); + + /* Build full device descriptor */ + Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + + sizeof(DOCKING_STATE_INFORMATION); + PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST); + if (PartialResourceList == NULL) + { + ERR("Failed to allocate resource descriptor\n"); + return; + } + + /* Initialize resource descriptor */ + RtlZeroMemory(PartialResourceList, Size); + PartialResourceList->Version = 0; + PartialResourceList->Revision = 0; + PartialResourceList->Count = 1; + + /* Set device specific data */ + PartialDescriptor = &PartialResourceList->PartialDescriptors[0]; + PartialDescriptor->Type = CmResourceTypeDeviceSpecific; + PartialDescriptor->ShareDisposition = CmResourceShareUndetermined; + PartialDescriptor->Flags = 0; + PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(DOCKING_STATE_INFORMATION); + + DockingState = (PDOCKING_STATE_INFORMATION)&PartialResourceList->PartialDescriptors[1]; + DockingState->ReturnCode = Result; + if (Result == 0) + { + /* FIXME: Add more device specific data */ + ERR("FIXME: System docked\n"); + } + + /* Create controller key */ + FldrCreateComponentKey(BusKey, + PeripheralClass, + DockingInformation, + 0, + 0, + 0xFFFFFFFF, + "Docking State Information", + PartialResourceList, + Size, + &PeripheralKey); +} + static VOID DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) @@ -308,6 +365,8 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) Size, &BusKey); + DetectDockingStation(BusKey); + (*BusNumber)++; } diff --git a/boot/freeldr/freeldr/arch/i386/pnpbios.S b/boot/freeldr/freeldr/arch/i386/pnpbios.S index e77b43fb201..018af55ca86 100644 --- a/boot/freeldr/freeldr/arch/i386/pnpbios.S +++ b/boot/freeldr/freeldr/arch/i386/pnpbios.S @@ -1,20 +1,8 @@ /* - * FreeLoader - * Copyright (C) 2003 Eric Kohl - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * PROJECT: FreeLoader + * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) + * PURPOSE: PnP BIOS helper functions + * COPYRIGHT: Copyright 2003 Eric Kohl <eric.kohl(a)reactos.org> */ #include <asm.inc> @@ -179,6 +167,43 @@ _PnpBiosGetDeviceNode: ret + +/* + * U32 PnpBiosGetDockStationInformation(U8 *DockingStationInfo); + * + * RETURNS: + */ +PUBLIC _PnpBiosGetDockStationInformation +_PnpBiosGetDockStationInformation: + + push ebp + mov ebp, esp + + pusha + push es + + /* Convert pointer to info structure to segment/offset */ + mov eax, [ebp + 8] + shr eax, 4 + and eax, HEX(0f000) + mov word ptr ds:[BSS_PnpBiosBufferSegment], ax + mov eax, [ebp + 8] + and eax, HEX(0ffff) + mov word ptr ds:[BSS_PnpBiosBufferOffset], ax + + mov bx, FNID_PnpBiosGetDockStationInformation + call i386CallRealMode + + pop es + popa + + mov esp, ebp + pop ebp + + mov eax, [BSS_PnpResult] + + ret + END /* EOF */ diff --git a/boot/freeldr/freeldr/arch/realmode/amd64.S b/boot/freeldr/freeldr/arch/realmode/amd64.S index d948df6eead..28ade6be943 100644 --- a/boot/freeldr/freeldr/arch/realmode/amd64.S +++ b/boot/freeldr/freeldr/arch/realmode/amd64.S @@ -360,6 +360,7 @@ LongModeEntryPoint: int HEX(16) jmp Reboot +/* FNID_* functions */ CallbackTable: .word Int386 .word Reboot @@ -367,6 +368,7 @@ CallbackTable: .word PxeCallApi .word PnpBiosGetDeviceNodeCount .word PnpBiosGetDeviceNode + .word PnpBiosGetDockStationInformation /* 16-bit stack pointer */ stack16: diff --git a/boot/freeldr/freeldr/arch/realmode/i386.S b/boot/freeldr/freeldr/arch/realmode/i386.S index 5f4d35f70db..d2bcd7b9288 100644 --- a/boot/freeldr/freeldr/arch/realmode/i386.S +++ b/boot/freeldr/freeldr/arch/realmode/i386.S @@ -140,6 +140,7 @@ pm_entrypoint: .long 0 // receives address of PE entry point nop +/* FNID_* functions */ CallbackTable: .word Int386 .word Reboot @@ -147,6 +148,7 @@ CallbackTable: .word PxeCallApi .word PnpBiosGetDeviceNodeCount .word PnpBiosGetDeviceNode + .word PnpBiosGetDockStationInformation /* 16-bit stack pointer */ diff --git a/boot/freeldr/freeldr/arch/realmode/pnp.inc b/boot/freeldr/freeldr/arch/realmode/pnp.inc index dde53fcbf00..610bd1fba79 100644 --- a/boot/freeldr/freeldr/arch/realmode/pnp.inc +++ b/boot/freeldr/freeldr/arch/realmode/pnp.inc @@ -54,3 +54,28 @@ PnpBiosGetDeviceNode: mov dword ptr ds:[BSS_PnpResult], ecx ret + + +PnpBiosGetDockStationInformation: + + /* push bios segment */ + mov ax, word ptr ds:[BSS_PnpBiosDataSegment] + push ax + + /* push pointer to info structure (segment/offset) */ + mov ax, word ptr ds:[BSS_PnpBiosBufferSegment] + push ax + mov ax, word ptr ds:[BSS_PnpBiosBufferOffset] + push ax + + /* push function number */ + push 5 + + /* call entry point */ + call dword ptr ds:[BSS_PnpBiosEntryPoint] + add sp, 8 + + movzx ecx, ax + mov dword ptr ds:[BSS_PnpResult], ecx + + ret diff --git a/boot/freeldr/freeldr/include/arch/pc/hardware.h b/boot/freeldr/freeldr/include/arch/pc/hardware.h index fb547212ea8..de408b74cd9 100644 --- a/boot/freeldr/freeldr/include/arch/pc/hardware.h +++ b/boot/freeldr/freeldr/include/arch/pc/hardware.h @@ -87,6 +87,7 @@ ULONG __cdecl PnpBiosGetDeviceNodeCount(ULONG *NodeSize, ULONG *NodeCount); ULONG __cdecl PnpBiosGetDeviceNode(UCHAR *NodeId, UCHAR *NodeBuffer); +ULONG __cdecl PnpBiosGetDockStationInformation(UCHAR *DockingStationInfo); /* i386pxe.S */ USHORT __cdecl PxeCallApi(USHORT Segment, USHORT Offset, USHORT Service, VOID* Parameter); diff --git a/boot/freeldr/freeldr/include/arch/pc/pcbios.h b/boot/freeldr/freeldr/include/arch/pc/pcbios.h index 3b03a32dbc7..f3539d21426 100644 --- a/boot/freeldr/freeldr/include/arch/pc/pcbios.h +++ b/boot/freeldr/freeldr/include/arch/pc/pcbios.h @@ -79,6 +79,12 @@ typedef struct _ACPI_BIOS_DATA BIOS_MEMORY_MAP MemoryMap[1]; /* Count of BIOS memory map entries */ } ACPI_BIOS_DATA, *PACPI_BIOS_DATA; +typedef struct _DOCKING_STATE_INFORMATION +{ + USHORT Unused[5]; + USHORT ReturnCode; +} DOCKING_STATE_INFORMATION, *PDOCKING_STATE_INFORMATION; + #include <pshpack1.h> typedef struct { diff --git a/boot/freeldr/freeldr/include/arch/pc/x86common.h b/boot/freeldr/freeldr/include/arch/pc/x86common.h index e4c304bb38c..27c377039d5 100644 --- a/boot/freeldr/freeldr/include/arch/pc/x86common.h +++ b/boot/freeldr/freeldr/include/arch/pc/x86common.h @@ -58,6 +58,7 @@ #define FNID_PxeCallApi 3 #define FNID_PnpBiosGetDeviceNodeCount 4 #define FNID_PnpBiosGetDeviceNode 5 +#define FNID_PnpBiosGetDockStationInformation 6 /* Flag Masks */ #define CR0_PE_SET HEX(00000001) /* OR this value with CR0 to enable pmode */
2 years, 2 months
1
0
0
0
[reactos] 01/01: [USER32] CliGetPreloadKeyboardLayouts: Use _ultow
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=774c3b3c9226cebd00302…
commit 774c3b3c9226cebd00302926db2ac8fa6665ecd2 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Oct 19 17:50:47 2022 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Wed Oct 19 17:52:31 2022 +0900 [USER32] CliGetPreloadKeyboardLayouts: Use _ultow CORE-11700 --- win32ss/user/user32/windows/input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win32ss/user/user32/windows/input.c b/win32ss/user/user32/windows/input.c index 7c2a3992278..d3b7e114ba9 100644 --- a/win32ss/user/user32/windows/input.c +++ b/win32ss/user/user32/windows/input.c @@ -369,7 +369,7 @@ BOOL FASTCALL CliGetImeHotKeysFromRegistry(VOID) VOID APIENTRY CliGetPreloadKeyboardLayouts(PBYTE pbFlags) { - WCHAR szValueName[12], szValue[16]; + WCHAR szValueName[33], szValue[16]; UNICODE_STRING ustrValue; DWORD dwKL, cbValue, dwType; UINT iNumber; @@ -382,7 +382,7 @@ VOID APIENTRY CliGetPreloadKeyboardLayouts(PBYTE pbFlags) for (iNumber = 1; iNumber < 1000; ++iNumber) { - StringCchPrintfW(szValueName, _countof(szValueName), L"%u", iNumber); + _ultow(iNumber, szValueName, 10); cbValue = sizeof(szValue); error = RegQueryValueExW(hKey, szValueName, NULL, &dwType, (LPBYTE)szValue, &cbValue);
2 years, 2 months
1
0
0
0
[reactos] 01/01: [USER32] Fix build; Appendum to 21feb52
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7523bf84a58f8ff808185…
commit 7523bf84a58f8ff808185ba2110cf7f07055c3a7 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Oct 19 17:40:34 2022 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Wed Oct 19 17:40:40 2022 +0900 [USER32] Fix build; Appendum to 21feb52 CORE-11700 --- win32ss/user/user32/windows/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32ss/user/user32/windows/input.c b/win32ss/user/user32/windows/input.c index af6500dfee5..7c2a3992278 100644 --- a/win32ss/user/user32/windows/input.c +++ b/win32ss/user/user32/windows/input.c @@ -382,7 +382,7 @@ VOID APIENTRY CliGetPreloadKeyboardLayouts(PBYTE pbFlags) for (iNumber = 1; iNumber < 1000; ++iNumber) { - RtlIntegerToUnicode(iNumber, 10, sizeof(szValueName), szValueName); + StringCchPrintfW(szValueName, _countof(szValueName), L"%u", iNumber); cbValue = sizeof(szValue); error = RegQueryValueExW(hKey, szValueName, NULL, &dwType, (LPBYTE)szValue, &cbValue);
2 years, 2 months
1
0
0
0
[reactos] 01/01: [USER32] Improve CliGetPreloadKeyboardLayouts
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=21feb529fe59943fe061e…
commit 21feb529fe59943fe061ef294cf03662fa966d8e Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Oct 19 17:34:43 2022 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Wed Oct 19 17:36:04 2022 +0900 [USER32] Improve CliGetPreloadKeyboardLayouts CORE-11700 --- win32ss/user/user32/windows/input.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/win32ss/user/user32/windows/input.c b/win32ss/user/user32/windows/input.c index aac99382113..af6500dfee5 100644 --- a/win32ss/user/user32/windows/input.c +++ b/win32ss/user/user32/windows/input.c @@ -369,7 +369,7 @@ BOOL FASTCALL CliGetImeHotKeysFromRegistry(VOID) VOID APIENTRY CliGetPreloadKeyboardLayouts(PBYTE pbFlags) { - WCHAR szValueName[8], szValue[16]; + WCHAR szValueName[12], szValue[16]; UNICODE_STRING ustrValue; DWORD dwKL, cbValue, dwType; UINT iNumber; @@ -382,14 +382,17 @@ VOID APIENTRY CliGetPreloadKeyboardLayouts(PBYTE pbFlags) for (iNumber = 1; iNumber < 1000; ++iNumber) { - StringCchPrintfW(szValueName, _countof(szValueName), L"%u", iNumber); + RtlIntegerToUnicode(iNumber, 10, sizeof(szValueName), szValueName); cbValue = sizeof(szValue); error = RegQueryValueExW(hKey, szValueName, NULL, &dwType, (LPBYTE)szValue, &cbValue); - if (error != ERROR_SUCCESS || dwType != REG_SZ) + if (error != ERROR_SUCCESS) break; - szValue[_countof(szValue) - 1] = 0; + if (dwType != REG_SZ) + continue; + + szValue[_countof(szValue) - 1] = 0; /* Avoid stack overrun */ RtlInitUnicodeString(&ustrValue, szValue); RtlUnicodeStringToInteger(&ustrValue, 16, &dwKL);
2 years, 2 months
1
0
0
0
[reactos] 01/01: [USER32] Improve CliGetImeHotKeysFromRegistry
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=10acb335fa670e2b3865d…
commit 10acb335fa670e2b3865d0c2a9b97d8f8c6df7cc Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Oct 19 17:01:20 2022 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Wed Oct 19 17:03:54 2022 +0900 [USER32] Improve CliGetImeHotKeysFromRegistry CORE-11700 --- win32ss/user/user32/windows/input.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/win32ss/user/user32/windows/input.c b/win32ss/user/user32/windows/input.c index 220dd4c3cfe..aac99382113 100644 --- a/win32ss/user/user32/windows/input.c +++ b/win32ss/user/user32/windows/input.c @@ -345,19 +345,19 @@ BOOL FASTCALL CliGetImeHotKeysFromRegistry(VOID) error = RegOpenKeyExW(HKEY_CURRENT_USER, L"Control Panel\\Input Method\\Hot Keys", 0, - KEY_ALL_ACCESS, + KEY_READ, &hKey); if (error != ERROR_SUCCESS) return ret; - for (dwIndex = 0; ; ++dwIndex) + for (dwIndex = 0; dwIndex < 1000; ++dwIndex) { cchKeyName = _countof(szKeyName); error = RegEnumKeyExW(hKey, dwIndex, szKeyName, &cchKeyName, NULL, NULL, NULL, NULL); - if (error == ERROR_NO_MORE_ITEMS || error != ERROR_SUCCESS) + if (error != ERROR_SUCCESS) break; - szKeyName[_countof(szKeyName) - 1] = 0; + szKeyName[_countof(szKeyName) - 1] = 0; /* Avoid stack overrun */ if (CliSetSingleHotKey(szKeyName, hKey)) ret = TRUE;
2 years, 2 months
1
0
0
0
[reactos] 01/01: [NTUSER][USER32][INCLUDE] s/SETIMEHOTKEY_DELETEALL/SETIMEHOTKEY_INITIALIZE/
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dff4579bd6f4f107ef1c1…
commit dff4579bd6f4f107ef1c121b841112bdbfa01f2b Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Oct 19 12:15:11 2022 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Wed Oct 19 12:15:11 2022 +0900 [NTUSER][USER32][INCLUDE] s/SETIMEHOTKEY_DELETEALL/SETIMEHOTKEY_INITIALIZE/ CORE-11700 --- sdk/include/reactos/undocuser.h | 2 +- win32ss/user/ntuser/ime.c | 2 +- win32ss/user/user32/misc/logon.c | 4 ++-- win32ss/user/user32/windows/input.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/include/reactos/undocuser.h b/sdk/include/reactos/undocuser.h index f396c58a7ba..d742e3a541c 100644 --- a/sdk/include/reactos/undocuser.h +++ b/sdk/include/reactos/undocuser.h @@ -399,7 +399,7 @@ typedef enum tagSETIMEHOTKEY_ACTION { SETIMEHOTKEY_DELETE = 1, SETIMEHOTKEY_ADD, - SETIMEHOTKEY_DELETEALL + SETIMEHOTKEY_INITIALIZE } SETIMEHOTKEY_ACTION; #ifdef __cplusplus diff --git a/win32ss/user/ntuser/ime.c b/win32ss/user/ntuser/ime.c index 35d8b66bda5..7f252e36af9 100644 --- a/win32ss/user/ntuser/ime.c +++ b/win32ss/user/ntuser/ime.c @@ -403,7 +403,7 @@ IntSetImeHotKey(DWORD dwHotKeyId, UINT uModifiers, UINT uVirtualKey, HKL hKL, DW IntAddImeHotKey(&gpImeHotKeyList, pNode); return TRUE; - case SETIMEHOTKEY_DELETEALL: + case SETIMEHOTKEY_INITIALIZE: IntFreeImeHotKeys(); return TRUE; diff --git a/win32ss/user/user32/misc/logon.c b/win32ss/user/user32/misc/logon.c index a763e24e370..69580735fb9 100644 --- a/win32ss/user/user32/misc/logon.c +++ b/win32ss/user/user32/misc/logon.c @@ -104,8 +104,8 @@ UpdatePerUserSystemParameters(DWORD dwReserved, // Update Imm support and load Imm32.dll. UpdatePerUserImmEnabling(); - /* Delete all the IME hotkeys */ - CliImmInitializeHotKeys(SETIMEHOTKEY_DELETEALL, NULL); + /* Initialize the IME hotkeys */ + CliImmInitializeHotKeys(SETIMEHOTKEY_INITIALIZE, NULL); /* Load Preload keyboard layouts */ IntLoadPreloadKeyboardLayouts(); diff --git a/win32ss/user/user32/windows/input.c b/win32ss/user/user32/windows/input.c index a15e9b57810..220dd4c3cfe 100644 --- a/win32ss/user/user32/windows/input.c +++ b/win32ss/user/user32/windows/input.c @@ -428,11 +428,11 @@ VOID APIENTRY CliImmInitializeHotKeys(DWORD dwAction, HKL hKL) BYTE bFlags = 0; BOOL bCheck; - NtUserSetImeHotKey(0, 0, 0, NULL, SETIMEHOTKEY_DELETEALL); + NtUserSetImeHotKey(0, 0, 0, NULL, SETIMEHOTKEY_INITIALIZE); bCheck = CliGetImeHotKeysFromRegistry(); - if (dwAction == SETIMEHOTKEY_DELETEALL) + if (dwAction == SETIMEHOTKEY_INITIALIZE) { LangID = LANGIDFROMLCID(GetUserDefaultLCID()); IntSetFeKeyboardFlags(LangID, &bFlags);
2 years, 2 months
1
0
0
0
[reactos] 01/01: [SETUPLIB] Add NTFS boot support. (#3778)
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2580889cfa3c8620999e8…
commit 2580889cfa3c8620999e8579eab91a5c8ebb317a Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Wed Oct 19 03:02:24 2022 +0300 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Oct 19 02:02:24 2022 +0200 [SETUPLIB] Add NTFS boot support. (#3778) --- base/setup/lib/bootsup.c | 108 +++++++++++++++++++++++++++++++++++++++++++++-- base/setup/lib/fsutil.c | 89 ++++++++++++++++++++++++++++++++++++++ base/setup/lib/fsutil.h | 7 +++ 3 files changed, 200 insertions(+), 4 deletions(-) diff --git a/base/setup/lib/bootsup.c b/base/setup/lib/bootsup.c index 58c17e79bed..c34950cc3e3 100644 --- a/base/setup/lib/bootsup.c +++ b/base/setup/lib/bootsup.c @@ -1227,6 +1227,107 @@ InstallBtrfsBootcodeToPartition( return STATUS_SUCCESS; } +static +NTSTATUS +InstallNtfsBootcodeToPartition( + IN PUNICODE_STRING SystemRootPath, + IN PUNICODE_STRING SourceRootPath, + IN PUNICODE_STRING DestinationArcPath) +{ + NTSTATUS Status; + BOOLEAN DoesFreeLdrExist; + WCHAR SrcPath[MAX_PATH]; + WCHAR DstPath[MAX_PATH]; + + /* NTFS partition */ + DPRINT("System path: '%wZ'\n", SystemRootPath); + + /* Copy FreeLoader to the system partition, always overwriting the older version */ + CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 2, SourceRootPath->Buffer, L"\\loader\\freeldr.sys"); + CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"freeldr.sys"); + + DPRINT1("Copy: %S ==> %S\n", SrcPath, DstPath); + Status = SetupCopyFile(SrcPath, DstPath, FALSE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("SetupCopyFile() failed (Status %lx)\n", Status); + return Status; + } + + /* Prepare for possibly updating 'freeldr.ini' */ + DoesFreeLdrExist = DoesFileExist_2(SystemRootPath->Buffer, L"freeldr.ini"); + if (DoesFreeLdrExist) + { + /* Update existing 'freeldr.ini' */ + DPRINT1("Update existing 'freeldr.ini'\n"); + Status = UpdateFreeLoaderIni(SystemRootPath->Buffer, DestinationArcPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("UpdateFreeLoaderIni() failed (Status %lx)\n", Status); + return Status; + } + + return STATUS_SUCCESS; + } + + /* Check for *nix bootloaders */ + + DPRINT1("Create new 'freeldr.ini'\n"); + + /* Certainly SysLinux, GRUB, LILO... or an unknown boot loader */ + DPRINT1("*nix or unknown boot loader found\n"); + + if (IsThereAValidBootSector(SystemRootPath->Buffer)) + { + PCWSTR BootSector = L"BOOTSECT.OLD"; + + Status = CreateFreeLoaderIniForReactOSAndBootSector( + SystemRootPath->Buffer, DestinationArcPath->Buffer, + L"Linux", L"\"Linux\"", + L"hd0", L"1", BootSector); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CreateFreeLoaderIniForReactOSAndBootSector() failed (Status %lx)\n", Status); + return Status; + } + + /* Save current bootsector */ + CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, BootSector); + + DPRINT1("Save bootsector: %S ==> %S\n", SystemRootPath->Buffer, DstPath); + Status = SaveBootSector(SystemRootPath->Buffer, DstPath, NTFS_BOOTSECTOR_SIZE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("SaveBootSector() failed (Status %lx)\n", Status); + return Status; + } + } + else + { + Status = CreateFreeLoaderIniForReactOS(SystemRootPath->Buffer, DestinationArcPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CreateFreeLoaderIniForReactOS() failed (Status %lx)\n", Status); + return Status; + } + } + + /* Install new bootsector on the disk */ + + /* Install NTFS bootcode */ + CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 2, SourceRootPath->Buffer, L"\\loader\\ntfs.bin"); + + DPRINT1("Install NTFS bootcode: %S ==> %S\n", SrcPath, SystemRootPath->Buffer); + Status = InstallBootCodeToDisk(SrcPath, SystemRootPath->Buffer, InstallNtfsBootCode); + if (!NT_SUCCESS(Status)) + { + DPRINT1("InstallBootCodeToDisk(NTFS) failed (Status %lx)\n", Status); + return Status; + } + + return STATUS_SUCCESS; +} + NTSTATUS InstallVBRToPartition( @@ -1243,13 +1344,12 @@ InstallVBRToPartition( DestinationArcPath, FileSystemName); } - /* else if (wcsicmp(FileSystemName, L"NTFS") == 0) { - DPRINT1("Partitions of type NTFS or HPFS are not supported yet!\n"); - return STATUS_NOT_SUPPORTED; + return InstallNtfsBootcodeToPartition(SystemRootPath, + SourceRootPath, + DestinationArcPath); } - */ else if (wcsicmp(FileSystemName, L"BTRFS") == 0) { return InstallBtrfsBootcodeToPartition(SystemRootPath, diff --git a/base/setup/lib/fsutil.c b/base/setup/lib/fsutil.c index 8ef241ece05..b58633e2df2 100644 --- a/base/setup/lib/fsutil.c +++ b/base/setup/lib/fsutil.c @@ -111,6 +111,35 @@ typedef struct _BTRFS_BOOTSECTOR } BTRFS_BOOTSECTOR, *PBTRFS_BOOTSECTOR; C_ASSERT(sizeof(BTRFS_BOOTSECTOR) == BTRFS_BOOTSECTOR_SIZE); +typedef struct _NTFS_BOOTSECTOR +{ + UCHAR Jump[3]; + UCHAR OEMID[8]; + USHORT BytesPerSector; + UCHAR SectorsPerCluster; + UCHAR Unused0[7]; + UCHAR MediaId; + UCHAR Unused1[2]; + USHORT SectorsPerTrack; + USHORT Heads; + UCHAR Unused2[4]; + UCHAR Unused3[4]; + USHORT Unknown[2]; + ULONGLONG SectorCount; + ULONGLONG MftLocation; + ULONGLONG MftMirrLocation; + CHAR ClustersPerMftRecord; + UCHAR Unused4[3]; + CHAR ClustersPerIndexRecord; + UCHAR Unused5[3]; + ULONGLONG SerialNumber; + UCHAR Checksum[4]; + UCHAR BootStrap[426]; + USHORT EndSector; + UCHAR BootCodeAndData[7680]; // The remainder of the boot sector (8192 - 512) +} NTFS_BOOTSECTOR, *PNTFS_BOOTSECTOR; +C_ASSERT(sizeof(NTFS_BOOTSECTOR) == NTFS_BOOTSECTOR_SIZE); + // TODO: Add more bootsector structures! #include <poppack.h> @@ -659,6 +688,66 @@ Quit: return Status; } +NTSTATUS +InstallNtfsBootCode( + IN PCWSTR SrcPath, // NTFS bootsector source file (on the installation medium) + IN HANDLE DstPath, // Where to save the bootsector built from the source + partition information + IN HANDLE RootPartition) // Partition holding the (old) NTFS information +{ + NTSTATUS Status; + UNICODE_STRING Name; + IO_STATUS_BLOCK IoStatusBlock; + LARGE_INTEGER FileOffset; + BOOTCODE OrigBootSector = {0}; + BOOTCODE NewBootSector = {0}; + + /* Allocate and read the current original partition bootsector */ + Status = ReadBootCodeByHandle(&OrigBootSector, RootPartition, NTFS_BOOTSECTOR_SIZE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("InstallNtfsBootCode: Status %lx\n", Status); + return Status; + } + + /* Allocate and read the new bootsector (16 sectors) from SrcPath */ + RtlInitUnicodeString(&Name, SrcPath); + Status = ReadBootCodeFromFile(&NewBootSector, &Name, NTFS_BOOTSECTOR_SIZE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("InstallNtfsBootCode: Status %lx\n", Status); + FreeBootCode(&OrigBootSector); + return Status; + } + + /* Adjust the bootsector (copy a part of the NTFS BPB) */ + RtlCopyMemory(&((PNTFS_BOOTSECTOR)NewBootSector.BootCode)->OEMID, + &((PNTFS_BOOTSECTOR)OrigBootSector.BootCode)->OEMID, + FIELD_OFFSET(NTFS_BOOTSECTOR, BootStrap) - FIELD_OFFSET(NTFS_BOOTSECTOR, OEMID)); + + /* Write sector 0 */ + FileOffset.QuadPart = 0ULL; + Status = NtWriteFile(DstPath, + NULL, + NULL, + NULL, + &IoStatusBlock, + NewBootSector.BootCode, + NewBootSector.Length, + &FileOffset, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtWriteFile() failed (Status %lx)\n", Status); + goto Quit; + } + +Quit: + /* Free the new bootsector */ + FreeBootCode(&NewBootSector); + + return Status; +} + // // Formatting routines diff --git a/base/setup/lib/fsutil.h b/base/setup/lib/fsutil.h index 1056cfb658d..51877faa0fd 100644 --- a/base/setup/lib/fsutil.h +++ b/base/setup/lib/fsutil.h @@ -68,6 +68,7 @@ FormatFileSystem( #define FAT_BOOTSECTOR_SIZE (1 * SECTORSIZE) #define FAT32_BOOTSECTOR_SIZE (1 * SECTORSIZE) // Counts only the primary sector. #define BTRFS_BOOTSECTOR_SIZE (3 * SECTORSIZE) +#define NTFS_BOOTSECTOR_SIZE (16 * SECTORSIZE) typedef NTSTATUS (/*NTAPI*/ *PFS_INSTALL_BOOTCODE)( @@ -96,6 +97,12 @@ InstallBtrfsBootCode( IN HANDLE DstPath, IN HANDLE RootPartition); +NTSTATUS +InstallNtfsBootCode( + IN PCWSTR SrcPath, + IN HANDLE DstPath, + IN HANDLE RootPartition); + // // Formatting routines
2 years, 2 months
1
0
0
0
[reactos] 01/01: [BOCHSMP] Add driver for QEMU and Bochs graphic card
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a33719500c71638da03e8…
commit a33719500c71638da03e83e0c9914ec9c9fe3c27 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Mon Oct 17 12:00:00 2022 +0200 Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com> CommitDate: Mon Oct 17 18:20:22 2022 +0200 [BOCHSMP] Add driver for QEMU and Bochs graphic card --- boot/bootdata/hivesys.inf | 3 + win32ss/drivers/miniport/CMakeLists.txt | 1 + win32ss/drivers/miniport/bochs/CMakeLists.txt | 12 + win32ss/drivers/miniport/bochs/bochsmp.c | 766 +++++++++++++++++++++++++ win32ss/drivers/miniport/bochs/bochsmp.h | 69 +++ win32ss/drivers/miniport/bochs/bochsmp.inf | 62 ++ win32ss/drivers/miniport/bochs/bochsmp.rc | 5 + win32ss/drivers/miniport/bochs/bochsmp_reg.inf | 13 + 8 files changed, 931 insertions(+) diff --git a/boot/bootdata/hivesys.inf b/boot/bootdata/hivesys.inf index 45c3d6e6446..3bc5eb62c63 100644 --- a/boot/bootdata/hivesys.inf +++ b/boot/bootdata/hivesys.inf @@ -83,6 +83,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\HID_DEVICE_SYSTEM_ HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\HID_DEVICE_SYSTEM_MOUSE","Service",0x00000000,"mouhid" HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\HID_DEVICE_SYSTEM_MOUSE","ClassGUID",0x00000000,"{4D36E96F-E325-11CE-BFC1-08002BE10318}" +HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\PCI#VEN_1234&DEV_1111","Service",0x00000000,"bochsmp" +HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\PCI#VEN_1234&DEV_1111","ClassGUID",0x00000000,"{4D36E968-E325-11CE-BFC1-08002BE10318}" + HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\PCI#CC_0000","Service",0x00000000,"vga" HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\PCI#CC_0000","ClassGUID",0x00000000,"{4D36E968-E325-11CE-BFC1-08002BE10318}" diff --git a/win32ss/drivers/miniport/CMakeLists.txt b/win32ss/drivers/miniport/CMakeLists.txt index 4e6d357051d..e5996f9b2e7 100644 --- a/win32ss/drivers/miniport/CMakeLists.txt +++ b/win32ss/drivers/miniport/CMakeLists.txt @@ -1,4 +1,5 @@ +add_subdirectory(bochs) add_subdirectory(vbe) add_subdirectory(vga) #add_subdirectory(vga_new) diff --git a/win32ss/drivers/miniport/bochs/CMakeLists.txt b/win32ss/drivers/miniport/bochs/CMakeLists.txt new file mode 100644 index 00000000000..aff939aa26e --- /dev/null +++ b/win32ss/drivers/miniport/bochs/CMakeLists.txt @@ -0,0 +1,12 @@ +list(APPEND SOURCE + bochsmp.c + bochsmp.h) + +add_library(bochsmp MODULE ${SOURCE} bochsmp.rc) +set_module_type(bochsmp kernelmodedriver) +add_importlibs(bochsmp videoprt) +target_link_libraries(bochsmp libcntpr) +add_pch(bochsmp bochsmp.h SOURCE) +add_cd_file(TARGET bochsmp DESTINATION reactos/system32/drivers FOR all) +add_registry_inf(bochsmp_reg.inf) +add_driver_inf(bochsmp bochsmp.inf) diff --git a/win32ss/drivers/miniport/bochs/bochsmp.c b/win32ss/drivers/miniport/bochs/bochsmp.c new file mode 100644 index 00000000000..220c15336f3 --- /dev/null +++ b/win32ss/drivers/miniport/bochs/bochsmp.c @@ -0,0 +1,766 @@ +/* + * PROJECT: ReactOS Bochs graphics card driver + * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) + * PURPOSE: Bochs graphics card driver + * COPYRIGHT: Copyright 2022 Hervé Poussineau <hpoussin(a)reactos.org> + */ + +#include "bochsmp.h" + +static const BOCHS_SIZE BochsAvailableResolutions[] = { + { 640, 480 }, // VGA + { 800, 600 }, // SVGA + { 1024, 600 }, // WSVGA + { 1024, 768 }, // XGA + { 1152, 864 }, // XGA+ + { 1280, 720 }, // WXGA-H + { 1280, 768 }, // WXGA + { 1280, 960 }, // SXGA- + { 1280, 1024 }, // SXGA + { 1368, 768 }, // HD ready + { 1400, 1050 }, // SXGA+ + { 1440, 900 }, // WSXGA + { 1600, 900 }, // HD+ + { 1600, 1200 }, // UXGA + { 1680, 1050 }, // WSXGA+ + { 1920, 1080 }, // FHD + { 2048, 1536 }, // QXGA + { 2560, 1440 }, // WQHD + { 2560, 1600 }, // WQXGA + { 2560, 2048 }, // QSXGA + { 2800, 2100 }, // QSXGA+ + { 3200, 2400 }, // QUXGA + { 3840, 2160 }, // 4K UHD-1 +}; + +CODE_SEG("PAGE") +static VOID +BochsFreeResources( + _Inout_ PBOCHS_DEVICE_EXTENSION DeviceExtension) +{ + if (DeviceExtension->AvailableModeInfo) + { + VideoPortFreePool(DeviceExtension, DeviceExtension->AvailableModeInfo); + DeviceExtension->AvailableModeInfo = NULL; + } +} + +CODE_SEG("PAGE") +static VOID +BochsWriteDispI( + _In_ PBOCHS_DEVICE_EXTENSION DeviceExtension, + _In_ ULONG Index, + _In_ USHORT Value) +{ + if (DeviceExtension->IoPorts.RangeInIoSpace) + { + VideoPortWritePortUshort((PUSHORT)(DeviceExtension->IoPorts.Mapped - VBE_DISPI_IOPORT_INDEX + VBE_DISPI_IOPORT_INDEX), Index); + VideoPortWritePortUshort((PUSHORT)(DeviceExtension->IoPorts.Mapped - VBE_DISPI_IOPORT_INDEX + VBE_DISPI_IOPORT_DATA), Value); + } + else + { + VideoPortWriteRegisterUshort((PUSHORT)(DeviceExtension->IoPorts.Mapped + 0x500 + Index * 2), Value); + } +} + +CODE_SEG("PAGE") +static USHORT +BochsReadDispI( + _In_ PBOCHS_DEVICE_EXTENSION DeviceExtension, + _In_ ULONG Index) +{ + if (DeviceExtension->IoPorts.RangeInIoSpace) + { + VideoPortWritePortUshort((PUSHORT)(DeviceExtension->IoPorts.Mapped - VBE_DISPI_IOPORT_INDEX + VBE_DISPI_IOPORT_INDEX), Index); + return VideoPortReadPortUshort((PUSHORT)(DeviceExtension->IoPorts.Mapped - VBE_DISPI_IOPORT_INDEX + VBE_DISPI_IOPORT_DATA)); + } + else + { + return VideoPortReadRegisterUshort((PUSHORT)(DeviceExtension->IoPorts.Mapped + 0x500 + Index * 2)); + } +} + +CODE_SEG("PAGE") +static BOOLEAN +BochsWriteDispIAndCheck( + _In_ PBOCHS_DEVICE_EXTENSION DeviceExtension, + _In_ ULONG Index, + _In_ USHORT Value) +{ + BochsWriteDispI(DeviceExtension, Index, Value); + return BochsReadDispI(DeviceExtension, Index) == Value; +} + +CODE_SEG("PAGE") +static BOOLEAN +BochsInitializeSuitableModeInfo( + _In_ PBOCHS_DEVICE_EXTENSION DeviceExtension, + _In_ ULONG PotentialModeCount) +{ + ULONG i, ModeCount = 0; + + for (i = 0; i < ARRAYSIZE(BochsAvailableResolutions) && ModeCount < PotentialModeCount; i++) + { + if (BochsAvailableResolutions[i].XResolution > DeviceExtension->MaxXResolution) + continue; + if (BochsAvailableResolutions[i].YResolution > DeviceExtension->MaxYResolution) + continue; + if (BochsAvailableResolutions[i].XResolution * BochsAvailableResolutions[i].YResolution * 4 > DeviceExtension->VramSize64K * 64 * 1024) + continue; + DeviceExtension->AvailableModeInfo[ModeCount++] = BochsAvailableResolutions[i]; + } + + if (ModeCount == 0) + { + VideoDebugPrint((Error, "Bochs: no suitable modes available!\n")); + return FALSE; + } + + DeviceExtension->AvailableModeCount = ModeCount; + return TRUE; +} + +CODE_SEG("PAGE") +static BOOLEAN +BochsGetControllerInfo( + _Inout_ PBOCHS_DEVICE_EXTENSION DeviceExtension) +{ + USHORT Version; + WCHAR ChipType[5]; + ULONG SizeInBytes; + + /* Detect DISPI version */ + for (Version = VBE_DISPI_ID5; Version >= VBE_DISPI_ID0; Version--) + { + if (BochsWriteDispIAndCheck(DeviceExtension, VBE_DISPI_INDEX_ID, Version)) + break; + } + if (Version < VBE_DISPI_ID0) + { + VideoDebugPrint((Error, "Bochs: VBE extension signature incorrect\n")); + return FALSE; + } + VideoDebugPrint((Error, "Bochs: detected version 0x%04x\n", Version)); + if (Version < VBE_DISPI_ID2) + { + /* Too old (no 32 bpp support, no linear frame buffer) */ + VideoDebugPrint((Error, "Bochs: VBE extension too old (0x%04x)\n", Version)); + return FALSE; + } + + if (Version <= VBE_DISPI_ID2) + { + DeviceExtension->MaxXResolution = 1024; + DeviceExtension->MaxYResolution = 768; + } + else + { + BochsWriteDispI(DeviceExtension, VBE_DISPI_INDEX_ENABLE, VBE_DISPI_GETCAPS); + DeviceExtension->MaxXResolution = BochsReadDispI(DeviceExtension, VBE_DISPI_INDEX_XRES); + DeviceExtension->MaxYResolution = BochsReadDispI(DeviceExtension, VBE_DISPI_INDEX_YRES); + BochsWriteDispI(DeviceExtension, VBE_DISPI_INDEX_ENABLE, VBE_DISPI_DISABLED); + /* Workaround bug in QEMU bochs-display */ + if (DeviceExtension->MaxXResolution == 0 && DeviceExtension->MaxYResolution == 0) + { + DeviceExtension->MaxXResolution = 1024; + DeviceExtension->MaxYResolution = 768; + } + } + if (Version < VBE_DISPI_ID4) + { + DeviceExtension->VramSize64K = 4 * 1024 / 64; /* 4 MB */ + } + else if (Version == VBE_DISPI_ID4) + { + DeviceExtension->VramSize64K = 8 * 1024 / 64; /* 8 MB */ + } + else + { + DeviceExtension->VramSize64K = BochsReadDispI(DeviceExtension, VBE_DISPI_INDEX_VIDEO_MEMORY_64K); + } + VideoDebugPrint((Info, "Bochs: capabilities %dx%d (%d MB)\n", + DeviceExtension->MaxXResolution, + DeviceExtension->MaxYResolution, + DeviceExtension->VramSize64K * 64 / 1024)); + + /* Store information in registry */ +#define HEX(c) (((c) >= 0 && (c) <= 9) ? (c) + L'0' : (c) - 10 + L'A') + ChipType[0] = HEX((Version >> 12) & 0xf); + ChipType[1] = HEX((Version >> 8) & 0xf); + ChipType[2] = HEX((Version >> 4) & 0xf); + ChipType[3] = HEX(Version & 0xf); + ChipType[4] = UNICODE_NULL; + VideoPortSetRegistryParameters(DeviceExtension, L"HardwareInformation.ChipType", ChipType, sizeof(ChipType)); + SizeInBytes = DeviceExtension->VramSize64K * 64 * 1024; + VideoPortSetRegistryParameters(DeviceExtension, L"HardwareInformation.MemorySize", &SizeInBytes, sizeof(SizeInBytes)); + return TRUE; +} + +CODE_SEG("PAGE") +static VOID +BochsGetModeInfo( + _In_ PBOCHS_SIZE AvailableModeInfo, + _Out_ PVIDEO_MODE_INFORMATION ModeInfo, + _In_ ULONG Index) +{ + VideoDebugPrint((Info, "Bochs: Filling details of mode #%d\n", Index)); + + ModeInfo->Length = sizeof(*ModeInfo); + ModeInfo->ModeIndex = Index; + ModeInfo->VisScreenWidth = AvailableModeInfo->XResolution; + ModeInfo->VisScreenHeight = AvailableModeInfo->YResolution; + ModeInfo->ScreenStride = AvailableModeInfo->XResolution * 4; + ModeInfo->NumberOfPlanes = 1; + ModeInfo->BitsPerPlane = 32; + ModeInfo->Frequency = 60; + + /* 960 DPI appears to be common */ + ModeInfo->XMillimeter = AvailableModeInfo->XResolution * 254 / 960; + ModeInfo->YMillimeter = AvailableModeInfo->YResolution * 254 / 960; + ModeInfo->NumberRedBits = 8; + ModeInfo->NumberGreenBits = 8; + ModeInfo->NumberBlueBits = 8; + ModeInfo->RedMask = 0xff0000; + ModeInfo->GreenMask = 0x00ff00; + ModeInfo->BlueMask = 0x0000ff; + + ModeInfo->AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | VIDEO_MODE_NO_OFF_SCREEN; + ModeInfo->VideoMemoryBitmapWidth = AvailableModeInfo->XResolution; + ModeInfo->VideoMemoryBitmapHeight = AvailableModeInfo->YResolution; +} + +CODE_SEG("PAGE") +static BOOLEAN +BochsMapVideoMemory( + _In_ PBOCHS_DEVICE_EXTENSION DeviceExtension, + _In_ PVIDEO_MEMORY RequestedAddress, + _Out_ PVIDEO_MEMORY_INFORMATION MapInformation, + _Out_ PSTATUS_BLOCK StatusBlock) +{ + VP_STATUS Status; + PHYSICAL_ADDRESS VideoMemory; + ULONG MemSpace = VIDEO_MEMORY_SPACE_MEMORY; + + VideoDebugPrint((Info, "Bochs: BochsMapVideoMemory Entry\n")); + + VideoMemory = DeviceExtension->FrameBuffer.RangeStart; + MapInformation->VideoRamBase = RequestedAddress->RequestedVirtualAddress; + MapInformation->VideoRamLength = 4 * + DeviceExtension->AvailableModeInfo[DeviceExtension->CurrentMode].XResolution * + DeviceExtension->AvailableModeInfo[DeviceExtension->CurrentMode].YResolution; + + Status = VideoPortMapMemory(DeviceExtension, + VideoMemory, + &MapInformation->VideoRamLength, + &MemSpace, + &MapInformation->VideoRamBase); + if (Status != NO_ERROR) + { + VideoDebugPrint((Error, "BochsMapVideoMemory - VideoPortMapMemory failed status:%x\n", Status)); + StatusBlock->Status = Status; + return FALSE; + } + + MapInformation->FrameBufferBase = MapInformation->VideoRamBase; + MapInformation->FrameBufferLength = MapInformation->VideoRamLength; + StatusBlock->Information = sizeof(*MapInformation); + StatusBlock->Status = NO_ERROR; + + VideoDebugPrint((Info, "Bochs:BochsMapVideoMemory Exit VideoRamBase: %p VideoRamLength: 0x%x PhysBasePtr: 0x%x\n", + MapInformation->VideoRamBase, MapInformation->VideoRamLength, (ULONG)VideoMemory.QuadPart)); + return TRUE; +} + +CODE_SEG("PAGE") +static BOOLEAN NTAPI +BochsUnmapVideoMemory( + _In_ PBOCHS_DEVICE_EXTENSION DeviceExtension, + _In_ PVIDEO_MEMORY VideoMemory, + _Out_ PSTATUS_BLOCK StatusBlock) +{ + VP_STATUS Status; + + VideoDebugPrint((Info, "Bochs: BochsUnmapVideoMemory Entry VideoRamBase:%p\n", VideoMemory->RequestedVirtualAddress)); + + Status = VideoPortUnmapMemory(DeviceExtension, VideoMemory->RequestedVirtualAddress, NULL); + if (Status != NO_ERROR) + { + VideoDebugPrint((Error, "Bochs: BochsUnmapVideoMemory Failed to unmap memory:%p Status:%x\n", + VideoMemory->RequestedVirtualAddress, + Status)); + } + + StatusBlock->Status = Status; + + VideoDebugPrint((Info, "Bochs: BochsUnmapVideoMemory Exit status:%x\n", Status)); + return (Status == NO_ERROR); +} + +CODE_SEG("PAGE") +static BOOLEAN +BochsQueryNumAvailableModes( + _In_ PBOCHS_DEVICE_EXTENSION DeviceExtension, + _Out_ PVIDEO_NUM_MODES AvailableModes, + _Out_ PSTATUS_BLOCK StatusBlock) +{ + AvailableModes->NumModes = DeviceExtension->AvailableModeCount; + AvailableModes->ModeInformationLength = sizeof(VIDEO_MODE_INFORMATION); + + StatusBlock->Information = sizeof(*AvailableModes); + StatusBlock->Status = NO_ERROR; + return TRUE; +} + +CODE_SEG("PAGE") +static BOOLEAN +BochsQueryAvailableModes( + _In_ PBOCHS_DEVICE_EXTENSION DeviceExtension, + _Out_ PVIDEO_MODE_INFORMATION ReturnedModes, + _Out_ PSTATUS_BLOCK StatusBlock) +{ + ULONG Count; + PBOCHS_SIZE AvailableModeInfo; + PVIDEO_MODE_INFORMATION ModeInfo; + + for (Count = 0, AvailableModeInfo = DeviceExtension->AvailableModeInfo, ModeInfo = ReturnedModes; + Count < DeviceExtension->AvailableModeCount; + Count++, AvailableModeInfo++, ModeInfo++) + { + VideoPortZeroMemory(ModeInfo, sizeof(*ModeInfo)); + BochsGetModeInfo(AvailableModeInfo, ModeInfo, Count); + } + + StatusBlock->Information = sizeof(VIDEO_MODE_INFORMATION) * DeviceExtension->AvailableModeCount; + StatusBlock->Status = NO_ERROR; + + return TRUE; +} + +CODE_SEG("PAGE") +static BOOLEAN +BochsSetCurrentMode( + _In_ PBOCHS_DEVICE_EXTENSION DeviceExtension, + _In_ PVIDEO_MODE RequestedMode, + _Out_ PSTATUS_BLOCK StatusBlock) +{ + PBOCHS_SIZE AvailableModeInfo; + /* Mask the two high-order bits, which can be set to request special behavior */ + ULONG ModeRequested = RequestedMode->RequestedMode & 0x3fffffff; + BOOLEAN Ret; + + VideoDebugPrint((Info, "Bochs:BochsSetCurrentMode Entry\n")); + + if (ModeRequested >= DeviceExtension->AvailableModeCount) + { + VideoDebugPrint((Error, "Bochs: set current mode - invalid parameter\n")); + StatusBlock->Status = ERROR_INVALID_PARAMETER; + return FALSE; + } + + AvailableModeInfo = &DeviceExtension->AvailableModeInfo[ModeRequested]; + + /* Set the mode characteristics */ + BochsWriteDispI(DeviceExtension, VBE_DISPI_INDEX_ENABLE, VBE_DISPI_DISABLED); + Ret = BochsWriteDispIAndCheck(DeviceExtension, VBE_DISPI_INDEX_XRES, AvailableModeInfo->XResolution) && + BochsWriteDispIAndCheck(DeviceExtension, VBE_DISPI_INDEX_YRES, AvailableModeInfo->YResolution) && + BochsWriteDispIAndCheck(DeviceExtension, VBE_DISPI_INDEX_BPP, 32); + /* Always enable screen, even if display settings change failed */ + BochsWriteDispI(DeviceExtension, VBE_DISPI_INDEX_ENABLE, VBE_DISPI_LFB_ENABLED | VBE_DISPI_ENABLED); + if (!Ret) + { + VideoDebugPrint((Error, "Bochs: failed to change mode\n")); + return FALSE; + } + + /* Enable VGA (QEMU secondary-vga disables it by default) */ + if (!DeviceExtension->IoPorts.RangeInIoSpace) + { + /* Discard AR flip-flip */ + (VOID)VideoPortReadRegisterUshort((PUSHORT)(DeviceExtension->IoPorts.Mapped + 0x41A)); + /* Enable display */ + VideoPortWriteRegisterUshort((PUSHORT)(DeviceExtension->IoPorts.Mapped + 0x400), 0x20); + } + + DeviceExtension->CurrentMode = (USHORT)ModeRequested; + StatusBlock->Status = NO_ERROR; + + VideoDebugPrint((Info, "Bochs:BochsSetCurrentMode Exit Mode:%d\n", ModeRequested)); + return TRUE; +} + +CODE_SEG("PAGE") +static BOOLEAN +BochsQueryCurrentMode( + _In_ PBOCHS_DEVICE_EXTENSION DeviceExtension, + _Out_ PVIDEO_MODE_INFORMATION VideoModeInfo, + _Out_ PSTATUS_BLOCK StatusBlock) +{ + PBOCHS_SIZE AvailableModeInfo; + + if (DeviceExtension->CurrentMode > DeviceExtension->AvailableModeCount) + { + StatusBlock->Status = ERROR_INVALID_PARAMETER; + return FALSE; + } + + AvailableModeInfo = &DeviceExtension->AvailableModeInfo[DeviceExtension->CurrentMode]; + VideoPortZeroMemory(VideoModeInfo, sizeof(*VideoModeInfo)); + BochsGetModeInfo(AvailableModeInfo, VideoModeInfo, DeviceExtension->CurrentMode); + + StatusBlock->Information = sizeof(*VideoModeInfo); + StatusBlock->Status = NO_ERROR; + return TRUE; +} + +CODE_SEG("PAGE") +static BOOLEAN +BochsResetDevice( + _In_ PBOCHS_DEVICE_EXTENSION DeviceExtension, + _Out_ PSTATUS_BLOCK StatusBlock) +{ + VideoDebugPrint((Info, "Bochs:BochsResetDevice Entry\n")); + + StatusBlock->Status = NO_ERROR; + + VideoDebugPrint((Info, "Bochs:BochsResetDevice Exit\n")); + return TRUE; +} + +CODE_SEG("PAGE") +static BOOLEAN +BochsGetChildState( + _In_ PBOCHS_DEVICE_EXTENSION DeviceExtension, + _Out_ PULONG pChildState, + _Out_ PSTATUS_BLOCK StatusBlock) +{ + *pChildState = VIDEO_CHILD_ACTIVE; + + StatusBlock->Information = sizeof(*pChildState); + StatusBlock->Status = NO_ERROR; + return TRUE; +} + +CODE_SEG("PAGE") +VP_STATUS NTAPI +BochsFindAdapter( + _In_ PVOID HwDeviceExtension, + _In_ PVOID HwContext, + _In_ PWSTR ArgumentString, + _In_ PVIDEO_PORT_CONFIG_INFO ConfigInfo, + _In_ PUCHAR Again) +{ + PBOCHS_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension; + VIDEO_ACCESS_RANGE AccessRanges[2] = {0}; + + if (ConfigInfo->Length < sizeof(*ConfigInfo)) + return ERROR_INVALID_PARAMETER; + + if (VideoPortGetAccessRanges(DeviceExtension, 0, NULL, ARRAYSIZE(AccessRanges), AccessRanges, NULL, NULL, NULL) != NO_ERROR) + { + VideoDebugPrint((Error, "Bochs: failed to get access ranges\n")); + return ERROR_DEV_NOT_EXIST; + } + + /* Framebuffer */ + DeviceExtension->FrameBuffer.RangeStart = AccessRanges[0].RangeStart; + DeviceExtension->FrameBuffer.RangeLength = AccessRanges[0].RangeLength; + DeviceExtension->FrameBuffer.RangeInIoSpace = AccessRanges[0].RangeInIoSpace; + + /* I/O ports */ + if (AccessRanges[1].RangeLength == 0) + { + /* Set default values */ + AccessRanges[1].RangeStart.LowPart = VBE_DISPI_IOPORT_INDEX; + AccessRanges[1].RangeLength = 2; + AccessRanges[1].RangeInIoSpace = TRUE; + if (VideoPortVerifyAccessRanges(DeviceExtension, 1, &AccessRanges[1]) != NO_ERROR) + { + VideoDebugPrint((Error, "Bochs: failed to claim I/O range 0x%x-0x%x\n", + VBE_DISPI_IOPORT_INDEX, + VBE_DISPI_IOPORT_INDEX + 1)); + return ERROR_DEV_NOT_EXIST; + } + } + else if (AccessRanges[1].RangeLength != 0x1000) + { + VideoDebugPrint((Error, "Bochs: invalid access ranges (size 0x%x)\n", AccessRanges[1].RangeLength)); + return ERROR_DEV_NOT_EXIST; + } + DeviceExtension->IoPorts.RangeStart = AccessRanges[1].RangeStart; + DeviceExtension->IoPorts.RangeLength = AccessRanges[1].RangeLength; + DeviceExtension->IoPorts.RangeInIoSpace = AccessRanges[1].RangeInIoSpace; + + DeviceExtension->IoPorts.Mapped = VideoPortGetDeviceBase(DeviceExtension, + DeviceExtension->IoPorts.RangeStart, + DeviceExtension->IoPorts.RangeLength, + DeviceExtension->IoPorts.RangeInIoSpace + ? VIDEO_MEMORY_SPACE_IO + : VIDEO_MEMORY_SPACE_MEMORY); + if (!DeviceExtension->IoPorts.Mapped) + { + VideoDebugPrint((Error, "Bochs: failed to map dispi interface\n")); + return ERROR_DEV_NOT_EXIST; + } + VideoDebugPrint((Info, "Bochs: address 0x%x mapped to 0x%p\n", + DeviceExtension->IoPorts.RangeStart.LowPart, + DeviceExtension->IoPorts.Mapped)); + + return NO_ERROR; +} + +CODE_SEG("PAGE") +BOOLEAN NTAPI +BochsInitialize( + _In_ PVOID HwDeviceExtension) +{ + ULONG PotentialModeCount = 0; + PBOCHS_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension; + + VideoDebugPrint((Info, "Bochs: BochsInitialize\n")); + + if (!BochsGetControllerInfo(DeviceExtension)) + { + BochsFreeResources(DeviceExtension); + return FALSE; + } + + PotentialModeCount = ARRAYSIZE(BochsAvailableResolutions); + DeviceExtension->AvailableModeInfo = VideoPortAllocatePool(HwDeviceExtension, + VpPagedPool, + PotentialModeCount * sizeof(BOCHS_SIZE), + BOCHS_TAG); + if (!DeviceExtension->AvailableModeInfo) + { + VideoDebugPrint((Error, "Bochs: insufficient resources\n")); + BochsFreeResources(DeviceExtension); + return FALSE; + } + + if (!BochsInitializeSuitableModeInfo(DeviceExtension, PotentialModeCount)) + { + BochsFreeResources(DeviceExtension); + return FALSE; + } + + return TRUE; +} + +CODE_SEG("PAGE") +BOOLEAN NTAPI +BochsStartIO( + _In_ PVOID HwDeviceExtension, + _Inout_ PVIDEO_REQUEST_PACKET RequestPacket) +{ + PBOCHS_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension; + + VideoDebugPrint((Info, "Bochs: BochsStartIO\n")); + RequestPacket->StatusBlock->Status = ERROR_INVALID_FUNCTION; + + switch (RequestPacket->IoControlCode) + { + case IOCTL_VIDEO_MAP_VIDEO_MEMORY: + { + VideoDebugPrint((Info, "BochsStartIO - Map video memory\n")); + if (RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY)) + { + VideoDebugPrint((Error, "BochsStartIO - invalid input parameter\n")); + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return FALSE; + } + if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MEMORY_INFORMATION)) + { + VideoDebugPrint((Error, "BochsStartIO - Insufficent output buffer\n")); + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return FALSE; + } + return BochsMapVideoMemory(DeviceExtension, + (PVIDEO_MEMORY)RequestPacket->InputBuffer, + (PVIDEO_MEMORY_INFORMATION)RequestPacket->OutputBuffer, + RequestPacket->StatusBlock); + } + + case IOCTL_VIDEO_UNMAP_VIDEO_MEMORY: + { + VideoDebugPrint((Info, "BochsStartIO - Unmap video memory\n")); + if (RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return FALSE; + } + return BochsUnmapVideoMemory(DeviceExtension, + (PVIDEO_MEMORY)RequestPacket->InputBuffer, + RequestPacket->StatusBlock); + } + + case IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES: + { + VideoDebugPrint((Info, "BochsStartIO - Query num available modes\n")); + if (RequestPacket->OutputBufferLength < sizeof(VIDEO_NUM_MODES)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return FALSE; + } + return BochsQueryNumAvailableModes(DeviceExtension, + (PVIDEO_NUM_MODES)RequestPacket->OutputBuffer, + RequestPacket->StatusBlock); + } + + case IOCTL_VIDEO_QUERY_AVAIL_MODES: + { + VideoDebugPrint((Info, "BochsStartIO - Query available modes\n")); + if (RequestPacket->OutputBufferLength < DeviceExtension->AvailableModeCount * sizeof(VIDEO_MODE_INFORMATION)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return FALSE; + } + return BochsQueryAvailableModes(DeviceExtension, + (PVIDEO_MODE_INFORMATION)RequestPacket->OutputBuffer, + RequestPacket->StatusBlock); + } + + case IOCTL_VIDEO_SET_CURRENT_MODE: + { + VideoDebugPrint((Info, "BochsStartIO - Set current mode\n")); + if (RequestPacket->InputBufferLength < sizeof(VIDEO_MODE)) + { + VideoDebugPrint((Error, "Bochs: set current mode - invalid parameter\n")); + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return FALSE; + } + return BochsSetCurrentMode(DeviceExtension, + (PVIDEO_MODE)RequestPacket->InputBuffer, + RequestPacket->StatusBlock); + } + + case IOCTL_VIDEO_QUERY_CURRENT_MODE: + { + VideoDebugPrint((Info, "BochsStartIO - Query current mode\n")); + if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MODE_INFORMATION)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return FALSE; + } + return BochsQueryCurrentMode(DeviceExtension, + (PVIDEO_MODE_INFORMATION)RequestPacket->OutputBuffer, + RequestPacket->StatusBlock); + } + + case IOCTL_VIDEO_RESET_DEVICE: + { + VideoDebugPrint((Info, "BochsStartIO - Reset device\n")); + return BochsResetDevice(DeviceExtension, + RequestPacket->StatusBlock); + } + + case IOCTL_VIDEO_GET_CHILD_STATE: + { + VideoDebugPrint((Info, "BochsStartIO - Get child state\n")); + if (RequestPacket->OutputBufferLength < sizeof(ULONG)) + { + RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER; + return FALSE; + } + return BochsGetChildState(DeviceExtension, + (PULONG)RequestPacket->OutputBuffer, + RequestPacket->StatusBlock); + } + + default: + { + VideoDebugPrint((Warn, "BochsStartIO - Unknown IOCTL - 0x%08x\n", + RequestPacket->IoControlCode)); + break; + } + } + + return FALSE; +} + +CODE_SEG("PAGE") +VP_STATUS NTAPI +BochsSetPowerState( + _In_ PVOID HwDeviceExtension, + _In_ ULONG HwId, + _In_ PVIDEO_POWER_MANAGEMENT VideoPowerControl) +{ + return NO_ERROR; +} + +CODE_SEG("PAGE") +VP_STATUS NTAPI +BochsGetPowerState( + _In_ PVOID HwDeviceExtension, + _In_ ULONG HwId, + _Out_ PVIDEO_POWER_MANAGEMENT VideoPowerControl) +{ + return ERROR_DEVICE_REINITIALIZATION_NEEDED; +} + +CODE_SEG("PAGE") +VP_STATUS NTAPI +BochsGetVideoChildDescriptor( + _In_ PVOID HwDeviceExtension, + _In_ PVIDEO_CHILD_ENUM_INFO ChildEnumInfo, + _Out_ PVIDEO_CHILD_TYPE VideoChildType, + _Out_ PUCHAR pChildDescriptor, + _Out_ PULONG UId, + _Out_ PULONG pUnused) +{ + PBOCHS_DEVICE_EXTENSION DeviceExtension = HwDeviceExtension; + + VideoDebugPrint((Info, "Bochs: BochsGetVideoChildDescriptor Entry\n")); + + if (ChildEnumInfo->Size < sizeof(*VideoChildType)) + return VIDEO_ENUM_NO_MORE_DEVICES; + + if (ChildEnumInfo->ChildIndex == 0) + { + /* Ignore ACPI enumerations */ + return VIDEO_ENUM_INVALID_DEVICE; + } + + *pUnused = 0; + if (ChildEnumInfo->ChildIndex == DISPLAY_ADAPTER_HW_ID) + { + *VideoChildType = VideoChip; + return VIDEO_ENUM_MORE_DEVICES; + } + + if (ChildEnumInfo->ChildIndex != 1) + return VIDEO_ENUM_NO_MORE_DEVICES; + + *UId = 0; + *VideoChildType = Monitor; + + if (pChildDescriptor && + ChildEnumInfo->ChildDescriptorSize >= VBE_EDID_SIZE && + !DeviceExtension->IoPorts.RangeInIoSpace) + { + memcpy(pChildDescriptor, + DeviceExtension->IoPorts.Mapped, + VBE_EDID_SIZE); + } + + VideoDebugPrint((Info, "Bochs: BochsGetVideoChildDescriptor Exit Uid:%d\n", ChildEnumInfo->ChildIndex)); + + return VIDEO_ENUM_MORE_DEVICES; +} + +ULONG NTAPI +DriverEntry(PVOID Context1, PVOID Context2) +{ + VIDEO_HW_INITIALIZATION_DATA VideoInitData; + + VideoDebugPrint((Info, "Bochs: DriverEntry\n")); + VideoPortZeroMemory(&VideoInitData, sizeof(VideoInitData)); + VideoInitData.HwInitDataSize = sizeof(VideoInitData); + VideoInitData.HwFindAdapter = BochsFindAdapter; + VideoInitData.HwInitialize = BochsInitialize; + VideoInitData.HwStartIO = BochsStartIO; + VideoInitData.HwDeviceExtensionSize = sizeof(BOCHS_DEVICE_EXTENSION); + VideoInitData.HwSetPowerState = BochsSetPowerState; + VideoInitData.HwGetPowerState = BochsGetPowerState; + VideoInitData.HwGetVideoChildDescriptor = BochsGetVideoChildDescriptor; + + return VideoPortInitialize(Context1, Context2, &VideoInitData, NULL); +} diff --git a/win32ss/drivers/miniport/bochs/bochsmp.h b/win32ss/drivers/miniport/bochs/bochsmp.h new file mode 100644 index 00000000000..b9d8cb242b7 --- /dev/null +++ b/win32ss/drivers/miniport/bochs/bochsmp.h @@ -0,0 +1,69 @@ +/* + * PROJECT: ReactOS Bochs graphics card driver + * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) + * PURPOSE: Bochs graphics card driver + * COPYRIGHT: Copyright 2022 Hervé Poussineau <hpoussin(a)reactos.org> + */ + +#ifndef BOCHS_H +#define BOCHS_H + +#include <ntdef.h> +#include <dderror.h> +#include <miniport.h> +#include <video.h> +#include <devioctl.h> +#include <section_attribs.h> + +#define VBE_EDID_SIZE 0x80 + +#define VBE_DISPI_IOPORT_INDEX 0x01CE +#define VBE_DISPI_IOPORT_DATA 0x01CF +#define VBE_DISPI_INDEX_ID 0x00 + #define VBE_DISPI_ID0 0xB0C0 + #define VBE_DISPI_ID1 0xB0C1 + #define VBE_DISPI_ID2 0xB0C2 + #define VBE_DISPI_ID3 0xB0C3 + #define VBE_DISPI_ID4 0xB0C4 + #define VBE_DISPI_ID5 0xB0C5 +#define VBE_DISPI_INDEX_XRES 0x01 +#define VBE_DISPI_INDEX_YRES 0x02 +#define VBE_DISPI_INDEX_BPP 0x03 +#define VBE_DISPI_INDEX_ENABLE 0x04 + #define VBE_DISPI_DISABLED 0x00 + #define VBE_DISPI_ENABLED 0x01 + #define VBE_DISPI_GETCAPS 0x02 + #define VBE_DISPI_LFB_ENABLED 0x40 +#define VBE_DISPI_INDEX_VIDEO_MEMORY_64K 0x0A + +#define BOCHS_TAG 'BCHS' + +typedef struct +{ + USHORT XResolution; + USHORT YResolution; +} BOCHS_SIZE, *PBOCHS_SIZE; + +typedef struct +{ + PUCHAR Mapped; + PHYSICAL_ADDRESS RangeStart; + ULONG RangeLength; + UCHAR RangeInIoSpace; +} BOCHS_ADDRESS_RANGE; + +typedef struct +{ + PBOCHS_SIZE AvailableModeInfo; + ULONG AvailableModeCount; + USHORT CurrentMode; + + BOCHS_ADDRESS_RANGE FrameBuffer; + BOCHS_ADDRESS_RANGE IoPorts; + + ULONG MaxXResolution; + ULONG MaxYResolution; + ULONG VramSize64K; +} BOCHS_DEVICE_EXTENSION, *PBOCHS_DEVICE_EXTENSION; + +#endif //BOCHS_H diff --git a/win32ss/drivers/miniport/bochs/bochsmp.inf b/win32ss/drivers/miniport/bochs/bochsmp.inf new file mode 100644 index 00000000000..5b7ee4d56d7 --- /dev/null +++ b/win32ss/drivers/miniport/bochs/bochsmp.inf @@ -0,0 +1,62 @@ +; bochsmp.inf +; +; Installation file for the Bochs display adapter +; +[Version] +Signature = "$Windows NT$" +LayoutFile = layout.inf +Class = Display +ClassGUID = {4D36E968-E325-11CE-BFC1-08002BE10318} +Provider = %ReactOS% +DriverVer = 10/17/2022,1.00 + +[DestinationDirs] +DefaultDestDir = 12 +Bochs.Display_CopyFiles = 11 + +[Manufacturer] +%Bochs% = Bochs + +[Bochs] +%Bochs.DeviceDesc% = Bochs,PCI\VEN_1234&DEV_1111 + +;---------------------------- BOCHS DRIVER ---------------------------- + +[Bochs] +CopyFiles = Bochs.Miniport_CopyFiles, Bochs.Display_CopyFiles + +[Bochs.Miniport_CopyFiles] +bochsmp.sys + +[Bochs.Display_CopyFiles] +framebuf.dll + +[Bochs.SoftwareSettings] +AddReg = Bochs_SoftwareSettings + +[Bochs_SoftwareSettings] +HKR,, InstalledDisplayDrivers, %REG_MULTI_SZ%, framebuf +HKR,, VgaCompatible, %REG_DWORD%, 0 + +[Bochs.Services] +AddService = bochsmp, 0x00000002, Bochs_Service + +[Bochs_Service] +ServiceType = 1 +StartType = 3 +ErrorControl = 0 +ServiceBinary = %12%\bochsmp.sys +LoadOrderGroup = Video + +;-------------------------------- STRINGS ------------------------------- + +[Strings] +; Non-localizable +ReactOS = "ReactOS Project" +Bochs = "Bochs" + +REG_MULTI_SZ = 0x00010000 +REG_DWORD = 0x00010001 + +; Localizable +Bochs.DeviceDesc = "Bochs Graphics Adapter" diff --git a/win32ss/drivers/miniport/bochs/bochsmp.rc b/win32ss/drivers/miniport/bochs/bochsmp.rc new file mode 100644 index 00000000000..6524e2b64e8 --- /dev/null +++ b/win32ss/drivers/miniport/bochs/bochsmp.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "Bochs graphics adapter miniport" +#define REACTOS_STR_INTERNAL_NAME "bochsmp.sys" +#define REACTOS_STR_ORIGINAL_FILENAME "bochsmp.sys" +#include <reactos/version.rc> diff --git a/win32ss/drivers/miniport/bochs/bochsmp_reg.inf b/win32ss/drivers/miniport/bochs/bochsmp_reg.inf new file mode 100644 index 00000000000..740132606fb --- /dev/null +++ b/win32ss/drivers/miniport/bochs/bochsmp_reg.inf @@ -0,0 +1,13 @@ +[AddReg] +HKLM,"SYSTEM\CurrentControlSet\Services\bochsmp","ErrorControl",0x00010001,0x00000000 +HKLM,"SYSTEM\CurrentControlSet\Services\bochsmp","Group",0x00000000,"Video" +HKLM,"SYSTEM\CurrentControlSet\Services\bochsmp","ImagePath",0x00020000,"system32\drivers\bochsmp.sys" +HKLM,"SYSTEM\CurrentControlSet\Services\bochsmp","Start",0x00010001,0x00000003 +HKLM,"SYSTEM\CurrentControlSet\Services\bochsmp","Type",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\bochsmp\Video","Service",0x00000000,"bochsmp" + +HKLM,"SYSTEM\CurrentControlSet\Services\bochsmp\Device0","Device Description",0x00000000,"Bochs Graphics Adapter" +HKLM,"SYSTEM\CurrentControlSet\Services\bochsmp\Device0","InstalledDisplayDrivers",0x00010000,"framebuf" +HKLM,"SYSTEM\CurrentControlSet\Services\bochsmp\Device0","VgaCompatible",0x00010001,0 +HKLM,"SYSTEM\CurrentControlSet\Services\bochsmp\Device0","DefaultSettings.XResolution",0x00010001,800 +HKLM,"SYSTEM\CurrentControlSet\Services\bochsmp\Device0","DefaultSettings.YResolution",0x00010001,600
2 years, 2 months
1
0
0
0
[reactos] 01/01: [NTUSER][USER32] Improve DrawFrameControl:DFC_MENU and DFC_BUTTON (#4783)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ac0a0adc5144e5ce8683b…
commit ac0a0adc5144e5ce8683b8428d74adba317cc80a Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Mon Oct 17 13:28:56 2022 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Mon Oct 17 13:28:56 2022 +0900 [NTUSER][USER32] Improve DrawFrameControl:DFC_MENU and DFC_BUTTON (#4783) A retrial of 13868ee (#4779). - Fill the background if necessary, and set the text color and the back mode in DrawFrameControl:DFC_MENU. - Use UITOOLS95_DrawFrameMenu in menu drawing instead of DrawFrameControl. CORE-18515, CORE-18417 --- win32ss/user/ntuser/draw.c | 34 ++++++++++++++++++++++++++++++---- win32ss/user/ntuser/menu.c | 16 +++++++++------- win32ss/user/user32/windows/draw.c | 37 +++++++++++++++++++++++++++++++------ 3 files changed, 70 insertions(+), 17 deletions(-) diff --git a/win32ss/user/ntuser/draw.c b/win32ss/user/ntuser/draw.c index dd4a0ff4a62..9e382b50290 100644 --- a/win32ss/user/ntuser/draw.c +++ b/win32ss/user/ntuser/draw.c @@ -769,13 +769,18 @@ BOOL FASTCALL UITOOLS95_DrawFrameButton(HDC hdc, LPRECT rc, UINT uState) case DFCS_BUTTONRADIOIMAGE: case DFCS_BUTTONRADIOMASK: - case DFCS_BUTTONRADIO: + if (uState & DFCS_BUTTONRADIOIMAGE) + FillRect(hdc, rc, (HBRUSH)NtGdiGetStockObject(BLACK_BRUSH)); /* Fill by black */ + else + FillRect(hdc, rc, (HBRUSH)NtGdiGetStockObject(WHITE_BRUSH)); /* Fill by white */ + return UITOOLS95_DFC_ButtonCheckRadio(hdc, rc, uState, TRUE); + case DFCS_BUTTONRADIO: + return UITOOLS95_DFC_ButtonCheckRadio(hdc, rc, uState, TRUE); default: ERR("Invalid button state=0x%04x\n", uState); - } return FALSE; } @@ -953,7 +958,6 @@ BOOL FASTCALL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags) BOOL FASTCALL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags) { - // TODO: DFCS_TRANSPARENT upon DFCS_MENUARROWUP or DFCS_MENUARROWDOWN LOGFONTW lf; HFONT hFont, hOldFont; WCHAR Symbol; @@ -983,6 +987,7 @@ BOOL FASTCALL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags) break; case DFCS_MENUCHECK: + case DFCS_MENUCHECK | DFCS_MENUBULLET: Symbol = 'a'; break; @@ -1098,7 +1103,28 @@ DrawFrameControl(HDC hDC, LPRECT rc, UINT uType, UINT uState) case DFC_CAPTION: return UITOOLS95_DrawFrameCaption(hDC, rc, uState); case DFC_MENU: - return UITOOLS95_DrawFrameMenu(hDC, rc, uState); + { + BOOL ret; + COLORREF rgbOldText; + INT iOldBackMode; + + if (uState & (DFCS_MENUARROWUP | DFCS_MENUARROWDOWN)) + { + if (!(uState & DFCS_TRANSPARENT)) + FillRect(hDC, rc, IntGetSysColorBrush(COLOR_MENU)); /* Fill by menu color */ + } + else + { + FillRect(hDC, rc, (HBRUSH)NtGdiGetStockObject(WHITE_BRUSH)); /* Fill by white */ + } + + rgbOldText = IntGdiSetTextColor(hDC, RGB(0, 0, 0)); /* Draw by black */ + iOldBackMode = IntGdiSetBkMode(hDC, TRANSPARENT); + ret = UITOOLS95_DrawFrameMenu(hDC, rc, uState); + IntGdiSetBkMode(hDC, iOldBackMode); + IntGdiSetTextColor(hDC, rgbOldText); + return ret; + } #if 0 case DFC_POPUPMENU: UNIMPLEMENTED; diff --git a/win32ss/user/ntuser/menu.c b/win32ss/user/ntuser/menu.c index fb169b6e472..01740c9c23e 100644 --- a/win32ss/user/ntuser/menu.c +++ b/win32ss/user/ntuser/menu.c @@ -11,6 +11,8 @@ DBG_DEFAULT_CHANNEL(UserMenu); /* INTERNAL ******************************************************************/ +BOOL FASTCALL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags); /* draw.c */ + HFONT ghMenuFont = NULL; HFONT ghMenuFontBold = NULL; static SIZE MenuCharSize; @@ -2186,14 +2188,14 @@ static void MENU_DrawScrollArrows(PMENU lppop, HDC hdc) rect.right = lppop->cxMenu; rect.bottom = arrow_bitmap_height; FillRect(hdc, &rect, IntGetSysColorBrush(COLOR_MENU)); - DrawFrameControl(hdc, &rect, DFC_MENU, (lppop->iTop ? 0 : DFCS_INACTIVE)|DFCS_MENUARROWUP); + UITOOLS95_DrawFrameMenu(hdc, &rect, (lppop->iTop ? 0 : DFCS_INACTIVE) | DFCS_MENUARROWUP); rect.top = lppop->cyMenu - arrow_bitmap_height; rect.bottom = lppop->cyMenu; FillRect(hdc, &rect, IntGetSysColorBrush(COLOR_MENU)); if (!(lppop->iTop < lppop->iMaxTop - (MENU_GetMaxPopupHeight(lppop) - 2 * arrow_bitmap_height))) Flags = DFCS_INACTIVE; - DrawFrameControl(hdc, &rect, DFC_MENU, Flags|DFCS_MENUARROWDOWN); + UITOOLS95_DrawFrameMenu(hdc, &rect, Flags | DFCS_MENUARROWDOWN); } /*********************************************************************** @@ -2308,7 +2310,7 @@ static void FASTCALL MENU_DrawMenuItem(PWND Wnd, PMENU Menu, PWND WndOwner, HDC RECT rectTemp; RtlCopyMemory(&rectTemp, &rect, sizeof(RECT)); rectTemp.left = rectTemp.right - UserGetSystemMetrics(SM_CXMENUCHECK); - DrawFrameControl(hdc, &rectTemp, DFC_MENU, DFCS_MENUARROW); + UITOOLS95_DrawFrameMenu(hdc, &rectTemp, DFCS_MENUARROW); } return; } @@ -2452,9 +2454,9 @@ static void FASTCALL MENU_DrawMenuItem(PWND Wnd, PMENU Menu, PWND WndOwner, HDC RECT r; r = rect; r.right = r.left + check_bitmap_width; - DrawFrameControl( hdc, &r, DFC_MENU, - (lpitem->fType & MFT_RADIOCHECK) ? - DFCS_MENUBULLET : DFCS_MENUCHECK); + UITOOLS95_DrawFrameMenu(hdc, &r, + (lpitem->fType & MFT_RADIOCHECK) ? + DFCS_MENUBULLET : DFCS_MENUCHECK); checked = TRUE; } } @@ -2475,7 +2477,7 @@ static void FASTCALL MENU_DrawMenuItem(PWND Wnd, PMENU Menu, PWND WndOwner, HDC RECT rectTemp; RtlCopyMemory(&rectTemp, &rect, sizeof(RECT)); rectTemp.left = rectTemp.right - check_bitmap_width; - DrawFrameControl(hdc, &rectTemp, DFC_MENU, DFCS_MENUARROW); + UITOOLS95_DrawFrameMenu(hdc, &rectTemp, DFCS_MENUARROW); } rect.left += 4; if( !((Menu->fFlags & MNS_STYLE_MASK) & MNS_NOCHECK)) diff --git a/win32ss/user/user32/windows/draw.c b/win32ss/user/user32/windows/draw.c index ff0fb72bff4..310f31493e5 100644 --- a/win32ss/user/user32/windows/draw.c +++ b/win32ss/user/user32/windows/draw.c @@ -6,7 +6,7 @@ * Copyright 2003 Andrew Greenwood * Copyright 2003 Filip Navara * Copyright 2009 Matthias Kupfer - * Copyright 2017 Katayama Hirofumi MZ + * Copyright 2017-2022 Katayama Hirofumi MZ * * Based on Wine code. * @@ -704,7 +704,6 @@ static BOOL UITOOLS95_DFC_ButtonCheckRadio(HDC dc, LPRECT r, UINT uFlags, BOOL R // FIXME: improve font rendering RECT Rect; HGDIOBJ hbrOld, hpenOld; - FillRect(dc, r, (HBRUSH)GetStockObject(WHITE_BRUSH)); SetRect(&Rect, X, Y, X + Shorter, Y + Shorter); InflateRect(&Rect, -(Shorter * 8) / 54, -(Shorter * 8) / 54); hbrOld = SelectObject(dc, GetStockObject(BLACK_BRUSH)); @@ -788,13 +787,18 @@ static BOOL UITOOLS95_DrawFrameButton(HDC hdc, LPRECT rc, UINT uState) case DFCS_BUTTONRADIOIMAGE: case DFCS_BUTTONRADIOMASK: - case DFCS_BUTTONRADIO: + if (uState & DFCS_BUTTONRADIOIMAGE) + FillRect(hdc, rc, (HBRUSH)GetStockObject(BLACK_BRUSH)); /* Fill by black */ + else + FillRect(hdc, rc, (HBRUSH)GetStockObject(WHITE_BRUSH)); /* Fill by white */ + return UITOOLS95_DFC_ButtonCheckRadio(hdc, rc, uState, TRUE); + case DFCS_BUTTONRADIO: + return UITOOLS95_DFC_ButtonCheckRadio(hdc, rc, uState, TRUE); default: ERR("Invalid button state=0x%04x\n", uState); - } return FALSE; @@ -972,7 +976,6 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags) static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags) { - // TODO: DFCS_TRANSPARENT upon DFCS_MENUARROWUP or DFCS_MENUARROWDOWN LOGFONTW lf; HFONT hFont, hOldFont; TCHAR Symbol; @@ -1002,6 +1005,7 @@ static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags) break; case DFCS_MENUCHECK: + case DFCS_MENUCHECK | DFCS_MENUBULLET: Symbol = 'a'; break; @@ -1428,7 +1432,28 @@ RealDrawFrameControl(HDC hDC, LPRECT rc, UINT uType, UINT uState) case DFC_CAPTION: return UITOOLS95_DrawFrameCaption(hDC, rc, uState); case DFC_MENU: - return UITOOLS95_DrawFrameMenu(hDC, rc, uState); + { + BOOL ret; + COLORREF rgbOldText; + INT iOldBackMode; + + if (uState & (DFCS_MENUARROWUP | DFCS_MENUARROWDOWN)) + { + if (!(uState & DFCS_TRANSPARENT)) + FillRect(hDC, rc, (HBRUSH)(COLOR_MENU + 1)); /* Fill by menu color */ + } + else + { + FillRect(hDC, rc, (HBRUSH)GetStockObject(WHITE_BRUSH)); /* Fill by white */ + } + + rgbOldText = SetTextColor(hDC, RGB(0, 0, 0)); /* Draw by black */ + iOldBackMode = SetBkMode(hDC, TRANSPARENT); + ret = UITOOLS95_DrawFrameMenu(hDC, rc, uState); + SetBkMode(hDC, iOldBackMode); + SetTextColor(hDC, rgbOldText); + return ret; + } #if 0 case DFC_POPUPMENU: UNIMPLEMENTED;
2 years, 2 months
1
0
0
0
[reactos] 01/01: Revert "[USER32][NTUSER] Fill by white in DrawFrameControl:DFC_MENU (#4779)" (#4784)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=227e596f687adaa45672a…
commit 227e596f687adaa45672a74ecd1968c0252d7fc5 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Oct 16 00:18:50 2022 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Oct 16 00:18:50 2022 +0900 Revert "[USER32][NTUSER] Fill by white in DrawFrameControl:DFC_MENU (#4779)" (#4784) This reverts commit 13868ee0e85c5b778d5f2d136205fbf10ffacf0c. CORE-18515 --- win32ss/user/ntuser/draw.c | 1 - win32ss/user/user32/windows/draw.c | 1 - 2 files changed, 2 deletions(-) diff --git a/win32ss/user/ntuser/draw.c b/win32ss/user/ntuser/draw.c index 77be7370e2e..dd4a0ff4a62 100644 --- a/win32ss/user/ntuser/draw.c +++ b/win32ss/user/ntuser/draw.c @@ -959,7 +959,6 @@ BOOL FASTCALL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags) WCHAR Symbol; RECT myr; INT cxy; - FillRect(dc, r, (HBRUSH)NtGdiGetStockObject(WHITE_BRUSH)); cxy = UITOOLS_MakeSquareRect(r, &myr); switch(uFlags & 0x1f) { diff --git a/win32ss/user/user32/windows/draw.c b/win32ss/user/user32/windows/draw.c index 1789be8ecd5..ff0fb72bff4 100644 --- a/win32ss/user/user32/windows/draw.c +++ b/win32ss/user/user32/windows/draw.c @@ -978,7 +978,6 @@ static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags) TCHAR Symbol; RECT myr; INT cxy; - FillRect(dc, r, (HBRUSH)GetStockObject(WHITE_BRUSH)); cxy = UITOOLS_MakeSquareRect(r, &myr); switch(uFlags & 0x1f) {
2 years, 2 months
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
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