ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
May 2020
----- 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
28 participants
193 discussions
Start a n
N
ew thread
[reactos] 03/04: [NTOS:PNP] Avoid an unnecessary stack buffer in PnpRootCreateDevice. CORE-15882
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2242ca6920d8c6f9734d1…
commit 2242ca6920d8c6f9734d118aa4698cbddf83da8f Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Sat May 2 17:42:40 2020 +0200 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Sun May 17 20:56:16 2020 +0200 [NTOS:PNP] Avoid an unnecessary stack buffer in PnpRootCreateDevice. CORE-15882 --- ntoskrnl/io/pnpmgr/pnproot.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/ntoskrnl/io/pnpmgr/pnproot.c b/ntoskrnl/io/pnpmgr/pnproot.c index 5e2ec7473a0..e89426acb00 100644 --- a/ntoskrnl/io/pnpmgr/pnproot.c +++ b/ntoskrnl/io/pnpmgr/pnproot.c @@ -191,7 +191,7 @@ PnpRootCreateDevice( { PPNPROOT_FDO_DEVICE_EXTENSION DeviceExtension; PPNPROOT_PDO_DEVICE_EXTENSION PdoDeviceExtension; - WCHAR DevicePath[MAX_PATH + 1]; + UNICODE_STRING DevicePath; WCHAR InstancePath[5]; PPNPROOT_DEVICE Device = NULL; NTSTATUS Status; @@ -207,7 +207,19 @@ PnpRootCreateDevice( DPRINT("Creating a PnP root device for service '%wZ'\n", ServiceName); - _snwprintf(DevicePath, sizeof(DevicePath) / sizeof(WCHAR), L"%s\\%wZ", REGSTR_KEY_ROOTENUM, ServiceName); + DevicePath.Length = 0; + DevicePath.MaximumLength = sizeof(REGSTR_KEY_ROOTENUM) + sizeof(L'\\') + ServiceName->Length; + DevicePath.Buffer = ExAllocatePoolWithTag(PagedPool, + DevicePath.MaximumLength, + TAG_PNP_ROOT); + if (DevicePath.Buffer == NULL) + { + DPRINT1("ExAllocatePoolWithTag() failed\n"); + Status = STATUS_NO_MEMORY; + goto cleanup; + } + RtlAppendUnicodeToString(&DevicePath, REGSTR_KEY_ROOTENUM L"\\"); + RtlAppendUnicodeStringToString(&DevicePath, ServiceName); /* Initialize a PNPROOT_DEVICE structure */ Device = ExAllocatePoolWithTag(PagedPool, sizeof(PNPROOT_DEVICE), TAG_PNP_ROOT); @@ -218,11 +230,8 @@ PnpRootCreateDevice( goto cleanup; } RtlZeroMemory(Device, sizeof(PNPROOT_DEVICE)); - if (!RtlCreateUnicodeString(&Device->DeviceID, DevicePath)) - { - Status = STATUS_NO_MEMORY; - goto cleanup; - } + Device->DeviceID = DevicePath; + RtlInitEmptyUnicodeString(&DevicePath, NULL, 0); Status = IopOpenRegistryKeyEx(&EnumHandle, NULL, &EnumKeyName, KEY_READ); if (NT_SUCCESS(Status)) @@ -258,7 +267,7 @@ tryagain: for (NextInstance = 0; NextInstance <= 9999; NextInstance++) { _snwprintf(InstancePath, sizeof(InstancePath) / sizeof(WCHAR), L"%04lu", NextInstance); - Status = LocateChildDevice(DeviceExtension, DevicePath, InstancePath, &Device); + Status = LocateChildDevice(DeviceExtension, Device->DeviceID.Buffer, InstancePath, &Device); if (Status == STATUS_NO_SUCH_DEVICE) break; } @@ -272,7 +281,7 @@ tryagain: } _snwprintf(InstancePath, sizeof(InstancePath) / sizeof(WCHAR), L"%04lu", NextInstance); - Status = LocateChildDevice(DeviceExtension, DevicePath, InstancePath, &Device); + Status = LocateChildDevice(DeviceExtension, Device->DeviceID.Buffer, InstancePath, &Device); if (Status != STATUS_NO_SUCH_DEVICE || NextInstance > 9999) { DPRINT1("NextInstance value is corrupt! (%lu)\n", NextInstance); @@ -377,6 +386,7 @@ cleanup: RtlFreeUnicodeString(&Device->InstanceID); ExFreePoolWithTag(Device, TAG_PNP_ROOT); } + RtlFreeUnicodeString(&DevicePath); if (DeviceKeyHandle != NULL) ObCloseHandle(DeviceKeyHandle, KernelMode); return Status;
4 years, 7 months
1
0
0
0
[reactos] 02/04: [NTOS:PNP] Avoid an unnecessary stack buffer in EnumerateDevices. CORE-15882
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1b0fe76d0d06f49428730…
commit 1b0fe76d0d06f49428730e8a0e8f41a4b4d6d3f3 Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Sat May 2 17:33:24 2020 +0200 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Sun May 17 20:56:16 2020 +0200 [NTOS:PNP] Avoid an unnecessary stack buffer in EnumerateDevices. CORE-15882 --- ntoskrnl/io/pnpmgr/pnproot.c | 45 +++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/ntoskrnl/io/pnpmgr/pnproot.c b/ntoskrnl/io/pnpmgr/pnproot.c index 46c78366282..5e2ec7473a0 100644 --- a/ntoskrnl/io/pnpmgr/pnproot.c +++ b/ntoskrnl/io/pnpmgr/pnproot.c @@ -439,7 +439,7 @@ static NTSTATUS CreateDeviceFromRegistry( _Inout_ PPNPROOT_FDO_DEVICE_EXTENSION DeviceExtension, - _In_ PCWSTR DevicePath, + _Inout_ PUNICODE_STRING DevicePath, _In_ PCWSTR InstanceId, _In_ HANDLE SubKeyHandle) { @@ -450,7 +450,8 @@ CreateDeviceFromRegistry( BUFFER Buffer1, Buffer2; /* If the device already exists, there's nothing to do */ - Status = LocateChildDevice(DeviceExtension, DevicePath, InstanceId, &Device); + NT_ASSERT(DevicePath->Buffer[DevicePath->Length / sizeof(WCHAR)] == UNICODE_NULL); + Status = LocateChildDevice(DeviceExtension, DevicePath->Buffer, InstanceId, &Device); if (Status != STATUS_NO_SUCH_DEVICE) { return STATUS_SUCCESS; @@ -467,13 +468,8 @@ CreateDeviceFromRegistry( RtlZeroMemory(Device, sizeof(PNPROOT_DEVICE)); /* Fill device ID and instance ID */ - if (!RtlCreateUnicodeString(&Device->DeviceID, DevicePath)) - { - DPRINT1("RtlCreateUnicodeString() failed\n"); - Status = STATUS_NO_MEMORY; - goto cleanup; - } - + Device->DeviceID = *DevicePath; + RtlInitEmptyUnicodeString(DevicePath, NULL, 0); if (!RtlCreateUnicodeString(&Device->InstanceID, InstanceId)) { DPRINT1("RtlCreateUnicodeString() failed\n"); @@ -526,7 +522,7 @@ CreateDeviceFromRegistry( NULL))) { /* Non-fatal error */ - DPRINT1("Failed to read the LogConf key for %S\\%S\n", DevicePath, InstanceId); + DPRINT1("Failed to read the LogConf key for %wZ\\%S\n", &Device->DeviceID, InstanceId); } /* Insert the newly created device into the list */ @@ -559,7 +555,7 @@ EnumerateDevices( UNICODE_STRING LegacyU = RTL_CONSTANT_STRING(L"LEGACY_"); UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\" REGSTR_PATH_SYSTEMENUM L"\\" REGSTR_KEY_ROOTENUM); UNICODE_STRING SubKeyName; - WCHAR DevicePath[MAX_PATH + 1]; + UNICODE_STRING DevicePath; HANDLE KeyHandle = NULL; HANDLE SubKeyHandle = NULL; ULONG KeyInfoSize, SubKeyInfoSize; @@ -705,13 +701,32 @@ EnumerateDevices( /* Terminate the string */ SubKeyInfo->Name[SubKeyInfo->NameLength / sizeof(WCHAR)] = 0; - _snwprintf(DevicePath, sizeof(DevicePath) / sizeof(WCHAR), - L"%s\\%s", REGSTR_KEY_ROOTENUM, KeyInfo->Name); - DPRINT("Found device %S\\%S!\n", DevicePath, SubKeyInfo->Name); + /* Compute device ID */ + DevicePath.Length = 0; + DevicePath.MaximumLength = sizeof(REGSTR_KEY_ROOTENUM) + sizeof(L'\\') + SubKeyName.Length; + DevicePath.Buffer = ExAllocatePoolWithTag(PagedPool, + DevicePath.MaximumLength, + TAG_PNP_ROOT); + if (DevicePath.Buffer == NULL) + { + DPRINT1("ExAllocatePoolWithTag() failed\n"); + Status = STATUS_NO_MEMORY; + goto cleanup; + } + + RtlAppendUnicodeToString(&DevicePath, REGSTR_KEY_ROOTENUM L"\\"); + RtlAppendUnicodeStringToString(&DevicePath, &SubKeyName); + DPRINT("Found device %wZ\\%S!\n", &DevicePath, SubKeyInfo->Name); Status = CreateDeviceFromRegistry(DeviceExtension, - DevicePath, + &DevicePath, SubKeyInfo->Name, SubKeyHandle); + + /* If CreateDeviceFromRegistry didn't take ownership and zero this, + * we need to free it + */ + RtlFreeUnicodeString(&DevicePath); + if (!NT_SUCCESS(Status)) { goto cleanup;
4 years, 7 months
1
0
0
0
[reactos] 01/04: [NTOS:PNP] Move child device creation into its own function
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ac52401d740065fc066f4…
commit ac52401d740065fc066f4db16069054a2c9e5df7 Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Sat May 2 17:08:12 2020 +0200 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Sun May 17 20:56:11 2020 +0200 [NTOS:PNP] Move child device creation into its own function Also fix some leaks and a DPRINT format string. --- ntoskrnl/io/pnpmgr/pnproot.c | 216 ++++++++++++++++++++++++------------------- 1 file changed, 122 insertions(+), 94 deletions(-) diff --git a/ntoskrnl/io/pnpmgr/pnproot.c b/ntoskrnl/io/pnpmgr/pnproot.c index 03ae98131d6..46c78366282 100644 --- a/ntoskrnl/io/pnpmgr/pnproot.c +++ b/ntoskrnl/io/pnpmgr/pnproot.c @@ -435,6 +435,121 @@ QueryBinaryValueCallback( return STATUS_SUCCESS; } +static +NTSTATUS +CreateDeviceFromRegistry( + _Inout_ PPNPROOT_FDO_DEVICE_EXTENSION DeviceExtension, + _In_ PCWSTR DevicePath, + _In_ PCWSTR InstanceId, + _In_ HANDLE SubKeyHandle) +{ + NTSTATUS Status; + PPNPROOT_DEVICE Device; + HANDLE DeviceKeyHandle = NULL; + RTL_QUERY_REGISTRY_TABLE QueryTable[4]; + BUFFER Buffer1, Buffer2; + + /* If the device already exists, there's nothing to do */ + Status = LocateChildDevice(DeviceExtension, DevicePath, InstanceId, &Device); + if (Status != STATUS_NO_SUCH_DEVICE) + { + return STATUS_SUCCESS; + } + + /* Create a PPNPROOT_DEVICE object, and add it to the list of known devices */ + Device = ExAllocatePoolWithTag(PagedPool, sizeof(PNPROOT_DEVICE), TAG_PNP_ROOT); + if (!Device) + { + DPRINT("ExAllocatePoolWithTag() failed\n"); + Status = STATUS_NO_MEMORY; + goto cleanup; + } + RtlZeroMemory(Device, sizeof(PNPROOT_DEVICE)); + + /* Fill device ID and instance ID */ + if (!RtlCreateUnicodeString(&Device->DeviceID, DevicePath)) + { + DPRINT1("RtlCreateUnicodeString() failed\n"); + Status = STATUS_NO_MEMORY; + goto cleanup; + } + + if (!RtlCreateUnicodeString(&Device->InstanceID, InstanceId)) + { + DPRINT1("RtlCreateUnicodeString() failed\n"); + Status = STATUS_NO_MEMORY; + goto cleanup; + } + + /* Open registry key to fill other informations */ + Status = IopOpenRegistryKeyEx(&DeviceKeyHandle, SubKeyHandle, &Device->InstanceID, KEY_READ); + if (!NT_SUCCESS(Status)) + { + /* If our key disappeared, let the caller go on */ + DPRINT1("IopOpenRegistryKeyEx() failed for '%wZ' with status 0x%lx\n", + &Device->InstanceID, Status); + Status = STATUS_SUCCESS; + goto cleanup; + } + + /* Fill information from the device instance key */ + RtlZeroMemory(QueryTable, sizeof(QueryTable)); + QueryTable[0].QueryRoutine = QueryStringCallback; + QueryTable[0].Name = L"DeviceDesc"; + QueryTable[0].EntryContext = &Device->DeviceDescription; + + RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PCWSTR)DeviceKeyHandle, + QueryTable, + NULL, + NULL); + + /* Fill information from the LogConf subkey */ + Buffer1.Data = (PVOID *)&Device->ResourceRequirementsList; + Buffer1.Length = NULL; + Buffer2.Data = (PVOID *)&Device->ResourceList; + Buffer2.Length = &Device->ResourceListSize; + RtlZeroMemory(QueryTable, sizeof(QueryTable)); + QueryTable[0].Flags = RTL_QUERY_REGISTRY_SUBKEY; + QueryTable[0].Name = L"LogConf"; + QueryTable[1].QueryRoutine = QueryBinaryValueCallback; + QueryTable[1].Name = L"BasicConfigVector"; + QueryTable[1].EntryContext = &Buffer1; + QueryTable[2].QueryRoutine = QueryBinaryValueCallback; + QueryTable[2].Name = L"BootConfig"; + QueryTable[2].EntryContext = &Buffer2; + + if (!NT_SUCCESS(RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PCWSTR)DeviceKeyHandle, + QueryTable, + NULL, + NULL))) + { + /* Non-fatal error */ + DPRINT1("Failed to read the LogConf key for %S\\%S\n", DevicePath, InstanceId); + } + + /* Insert the newly created device into the list */ + InsertTailList(&DeviceExtension->DeviceListHead, + &Device->ListEntry); + DeviceExtension->DeviceListCount++; + Device = NULL; + +cleanup: + if (DeviceKeyHandle != NULL) + { + ZwClose(DeviceKeyHandle); + } + if (Device != NULL) + { + /* We have a device that has not been added to device list. We need to clean it up */ + RtlFreeUnicodeString(&Device->DeviceID); + RtlFreeUnicodeString(&Device->InstanceID); + ExFreePoolWithTag(Device, TAG_PNP_ROOT); + } + return Status; +} + static NTSTATUS EnumerateDevices( IN PDEVICE_OBJECT DeviceObject) @@ -445,15 +560,11 @@ EnumerateDevices( UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\" REGSTR_PATH_SYSTEMENUM L"\\" REGSTR_KEY_ROOTENUM); UNICODE_STRING SubKeyName; WCHAR DevicePath[MAX_PATH + 1]; - RTL_QUERY_REGISTRY_TABLE QueryTable[4]; - PPNPROOT_DEVICE Device = NULL; HANDLE KeyHandle = NULL; HANDLE SubKeyHandle = NULL; - HANDLE DeviceKeyHandle = NULL; ULONG KeyInfoSize, SubKeyInfoSize; ULONG ResultSize; ULONG Index1, Index2; - BUFFER Buffer1, Buffer2; NTSTATUS Status = STATUS_UNSUCCESSFUL; DPRINT("EnumerateDevices(FDO %p)\n", DeviceObject); @@ -596,90 +707,15 @@ EnumerateDevices( _snwprintf(DevicePath, sizeof(DevicePath) / sizeof(WCHAR), L"%s\\%s", REGSTR_KEY_ROOTENUM, KeyInfo->Name); - DPRINT("Found device %S\\%s!\n", DevicePath, SubKeyInfo->Name); - if (LocateChildDevice(DeviceExtension, DevicePath, SubKeyInfo->Name, &Device) == STATUS_NO_SUCH_DEVICE) + DPRINT("Found device %S\\%S!\n", DevicePath, SubKeyInfo->Name); + Status = CreateDeviceFromRegistry(DeviceExtension, + DevicePath, + SubKeyInfo->Name, + SubKeyHandle); + if (!NT_SUCCESS(Status)) { - /* Create a PPNPROOT_DEVICE object, and add if in the list of known devices */ - Device = (PPNPROOT_DEVICE)ExAllocatePoolWithTag(PagedPool, sizeof(PNPROOT_DEVICE), TAG_PNP_ROOT); - if (!Device) - { - DPRINT("ExAllocatePoolWithTag() failed\n"); - Status = STATUS_NO_MEMORY; - goto cleanup; - } - RtlZeroMemory(Device, sizeof(PNPROOT_DEVICE)); - - /* Fill device ID and instance ID */ - if (!RtlCreateUnicodeString(&Device->DeviceID, DevicePath)) - { - DPRINT1("RtlCreateUnicodeString() failed\n"); - Status = STATUS_NO_MEMORY; - goto cleanup; - } - - if (!RtlCreateUnicodeString(&Device->InstanceID, SubKeyInfo->Name)) - { - DPRINT1("RtlCreateUnicodeString() failed\n"); - Status = STATUS_NO_MEMORY; - goto cleanup; - } - - /* Open registry key to fill other informations */ - Status = IopOpenRegistryKeyEx(&DeviceKeyHandle, SubKeyHandle, &Device->InstanceID, KEY_READ); - if (!NT_SUCCESS(Status)) - { - DPRINT1("IopOpenRegistryKeyEx() failed for '%wZ' with status 0x%lx\n", - &Device->InstanceID, Status); - break; - } - - /* Fill information from the device instance key */ - RtlZeroMemory(QueryTable, sizeof(QueryTable)); - QueryTable[0].QueryRoutine = QueryStringCallback; - QueryTable[0].Name = L"DeviceDesc"; - QueryTable[0].EntryContext = &Device->DeviceDescription; - - RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, - (PCWSTR)DeviceKeyHandle, - QueryTable, - NULL, - NULL); - - /* Fill information from the LogConf subkey */ - Buffer1.Data = (PVOID *)&Device->ResourceRequirementsList; - Buffer1.Length = NULL; - Buffer2.Data = (PVOID *)&Device->ResourceList; - Buffer2.Length = &Device->ResourceListSize; - RtlZeroMemory(QueryTable, sizeof(QueryTable)); - QueryTable[0].Flags = RTL_QUERY_REGISTRY_SUBKEY; - QueryTable[0].Name = L"LogConf"; - QueryTable[1].QueryRoutine = QueryBinaryValueCallback; - QueryTable[1].Name = L"BasicConfigVector"; - QueryTable[1].EntryContext = &Buffer1; - QueryTable[2].QueryRoutine = QueryBinaryValueCallback; - QueryTable[2].Name = L"BootConfig"; - QueryTable[2].EntryContext = &Buffer2; - - if (!NT_SUCCESS(RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, - (PCWSTR)DeviceKeyHandle, - QueryTable, - NULL, - NULL))) - { - /* Non-fatal error */ - DPRINT1("Failed to read the LogConf key for %S\\%S\n", DevicePath, SubKeyInfo->Name); - } - - ZwClose(DeviceKeyHandle); - DeviceKeyHandle = NULL; - - /* Insert the newly created device into the list */ - InsertTailList( - &DeviceExtension->DeviceListHead, - &Device->ListEntry); - DeviceExtension->DeviceListCount++; + goto cleanup; } - Device = NULL; Index2++; } @@ -690,14 +726,6 @@ EnumerateDevices( } cleanup: - if (Device) - { - /* We have a device that has not been added to device list. We need to clean it up */ - /* FIXME */ - ExFreePoolWithTag(Device, TAG_PNP_ROOT); - } - if (DeviceKeyHandle != NULL) - ZwClose(DeviceKeyHandle); if (SubKeyHandle != NULL) ZwClose(SubKeyHandle); if (KeyHandle != NULL)
4 years, 7 months
1
0
0
0
[reactos] 01/01: [SETUPAPI] Implement CM_Get_Next_Res_Des_Ex() partially (WIP)
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6efb3cbe03b346ad2f250…
commit 6efb3cbe03b346ad2f250b8a7de3c504ef6a6d41 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun May 17 19:37:49 2020 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun May 17 20:04:26 2020 +0200 [SETUPAPI] Implement CM_Get_Next_Res_Des_Ex() partially (WIP) --- dll/win32/setupapi/cfgmgr.c | 96 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 87 insertions(+), 9 deletions(-) diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c index 3b341c5c620..fdbcc8cfb1b 100644 --- a/dll/win32/setupapi/cfgmgr.c +++ b/dll/win32/setupapi/cfgmgr.c @@ -61,7 +61,7 @@ typedef struct _LOG_CONF_INFO { ULONG ulMagic; DEVINST dnDevInst; - ULONG ulFlags; + ULONG ulType; ULONG ulTag; } LOG_CONF_INFO, *PLOG_CONF_INFO; @@ -947,7 +947,7 @@ CM_Add_Empty_Log_Conf_Ex( { pLogConfInfo->ulMagic = LOG_CONF_MAGIC; pLogConfInfo->dnDevInst = dnDevInst; - pLogConfInfo->ulFlags = ulFlags; + pLogConfInfo->ulType = ulFlags; pLogConfInfo->ulTag = ulLogConfTag; *plcLogConf = (LOG_CONF)pLogConfInfo; @@ -2353,8 +2353,11 @@ CM_Free_Log_Conf_Ex( RpcTryExcept { - ret = PNP_FreeLogConf(BindingHandle, lpDevInst, pLogConfInfo->ulFlags, - pLogConfInfo->ulTag, 0); + ret = PNP_FreeLogConf(BindingHandle, + lpDevInst, + pLogConfInfo->ulType, + pLogConfInfo->ulTag, + 0); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) { @@ -4646,7 +4649,7 @@ CM_Get_First_Log_Conf_Ex( pLogConfInfo->ulMagic = LOG_CONF_MAGIC; pLogConfInfo->dnDevInst = dnDevInst; - pLogConfInfo->ulFlags = ulFlags; + pLogConfInfo->ulType = ulFlags; pLogConfInfo->ulTag = ulTag; *plcLogConf = (LOG_CONF)pLogConfInfo; @@ -5044,7 +5047,7 @@ CM_Get_Log_Conf_Priority_Ex( { ret = PNP_GetLogConfPriority(BindingHandle, lpDevInst, - pLogConfInfo->ulFlags, + pLogConfInfo->ulType, pLogConfInfo->ulTag, pPriority, 0); @@ -5132,7 +5135,7 @@ CM_Get_Next_Log_Conf_Ex( { ret = PNP_GetNextLogConf(BindingHandle, lpDevInst, - pLogConfInfo->ulFlags, + pLogConfInfo->ulType, pLogConfInfo->ulTag, &ulNewTag, 0); @@ -5154,7 +5157,7 @@ CM_Get_Next_Log_Conf_Ex( pNewLogConfInfo->ulMagic = LOG_CONF_MAGIC; pNewLogConfInfo->dnDevInst = pLogConfInfo->dnDevInst; - pNewLogConfInfo->ulFlags = pLogConfInfo->ulFlags; + pNewLogConfInfo->ulType = pLogConfInfo->ulType; pNewLogConfInfo->ulTag = ulNewTag; *plcLogConf = (LOG_CONF)pNewLogConfInfo; @@ -5197,10 +5200,85 @@ CM_Get_Next_Res_Des_Ex( _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine) { + RPC_BINDING_HANDLE BindingHandle = NULL; + HSTRING_TABLE StringTable = NULL; + ULONG ulInTag, ulOutTag = 0; + ULONG ulInType, ulOutType = 0; + LPWSTR lpDevInst; + DEVINST dnDevInst; + CONFIGRET ret; + FIXME("CM_Get_Next_Res_Des_Ex(%p %p %lu %p %lx %p)\n", prdResDes, rdResDes, ForResource, pResourceID, ulFlags, hMachine); - return CR_CALL_NOT_IMPLEMENTED; + if (prdResDes == NULL) + return CR_INVALID_POINTER; + + if (IsValidLogConf((PLOG_CONF_INFO)rdResDes)) + { + FIXME("LogConf found!\n"); + dnDevInst = ((PLOG_CONF_INFO)rdResDes)->dnDevInst; + ulInTag = ((PLOG_CONF_INFO)rdResDes)->ulTag; + ulInType = ((PLOG_CONF_INFO)rdResDes)->ulType; + } +#if 0 + else if (IsValidResDes((PRES_DES_INFO)rdResDes)) + { + FIXME("ResDes found!\n"); + dnDevInst = ((PRES_DES_INFO)rdResDes)->dnDevInst; + ulInTag = ((PRES_DES_INFO)rdResDes)->ulTag; + ulInType = ((PRES_DES_INFO)rdResDes)->ulType; + } +#endif + else + { + return CR_INVALID_RES_DES; + } + + if (hMachine != NULL) + { + BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle; + if (BindingHandle == NULL) + return CR_FAILURE; + + StringTable = ((PMACHINE_INFO)hMachine)->StringTable; + if (StringTable == 0) + return CR_FAILURE; + } + else + { + if (!PnpGetLocalHandles(&BindingHandle, &StringTable)) + return CR_FAILURE; + } + + lpDevInst = pSetupStringTableStringFromId(StringTable, dnDevInst); + if (lpDevInst == NULL) + return CR_INVALID_DEVNODE; + + RpcTryExcept + { + ret = PNP_GetNextResDes(BindingHandle, + lpDevInst, + ulInTag, + ulInType, + ForResource, + 0, /* unsigned long ulResourceTag, */ + &ulOutTag, + &ulOutType, + 0); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + ret = RpcStatusToCmStatus(RpcExceptionCode()); + } + RpcEndExcept; + + if (ret != CR_SUCCESS) + return ret; + + /* FIXME: Create the ResDes handle */ + + return CR_SUCCESS; }
4 years, 7 months
1
0
0
0
[reactos] 02/02: [CHARMAP_NEW] Remove non-existing entries.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=591f7ff5d73dccfb418c8…
commit 591f7ff5d73dccfb418c8a531aefd17ad9218371 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sun May 17 18:46:14 2020 +0200 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Sun May 17 18:46:42 2020 +0200 [CHARMAP_NEW] Remove non-existing entries. --- base/applications/charmap_new/charmap.rc | 60 -------------------------------- 1 file changed, 60 deletions(-) diff --git a/base/applications/charmap_new/charmap.rc b/base/applications/charmap_new/charmap.rc index 3d6e9a7b585..d788f2f21a4 100644 --- a/base/applications/charmap_new/charmap.rc +++ b/base/applications/charmap_new/charmap.rc @@ -18,24 +18,9 @@ IDI_ICON ICON "res/charmap.ico" /* UTF-8 */ #pragma code_page(65001) -#ifdef LANGUAGE_BG_BG - #include "lang/bg-BG.rc" -#endif -#ifdef LANGUAGE_CA_ES - #include "lang/ca-ES.rc" -#endif -#ifdef LANGUAGE_CS_CZ - #include "lang/cs-CZ.rc" -#endif -#ifdef LANGUAGE_DE_DE - #include "lang/de-DE.rc" -#endif #ifdef LANGUAGE_EN_US #include "lang/en-US.rc" #endif -#ifdef LANGUAGE_EL_GR - #include "lang/el-GR.rc" -#endif #ifdef LANGUAGE_ES_ES #include "lang/es-ES.rc" #endif @@ -45,63 +30,18 @@ IDI_ICON ICON "res/charmap.ico" #ifdef LANGUAGE_EU_ES #include "lang/eu-ES.rc" #endif -#ifdef LANGUAGE_FR_FR - #include "lang/fr-FR.rc" -#endif -#ifdef LANGUAGE_HE_IL - #include "lang/he-IL.rc" -#endif -#ifdef LANGUAGE_ID_ID - #include "lang/id-ID.rc" -#endif #ifdef LANGUAGE_IT_IT #include "lang/it-IT.rc" #endif -#ifdef LANGUAGE_JA_JP - #include "lang/ja-JP.rc" -#endif -#ifdef LANGUAGE_KO_KR - #include "lang/ko-KR.rc" -#endif -#ifdef LANGUAGE_LT_LT - #include "lang/lt-LT.rc" -#endif -#ifdef LANGUAGE_NL_NL - #include "lang/nl-NL.rc" -#endif -#ifdef LANGUAGE_NB_NO - #include "lang/no-NO.rc" -#endif #ifdef LANGUAGE_PL_PL #include "lang/pl-PL.rc" #endif -#ifdef LANGUAGE_PT_BR - #include "lang/pt-BR.rc" -#endif #ifdef LANGUAGE_RO_RO #include "lang/ro-RO.rc" #endif -#ifdef LANGUAGE_RU_RU - #include "lang/ru-RU.rc" -#endif -#ifdef LANGUAGE_SK_SK - #include "lang/sk-SK.rc" -#endif -#ifdef LANGUAGE_SQ_AL - #include "lang/sq-AL.rc" -#endif -#ifdef LANGUAGE_SV_SE - #include "lang/sv-SE.rc" -#endif #ifdef LANGUAGE_TR_TR #include "lang/tr-TR.rc" #endif -#ifdef LANGUAGE_UK_UA - #include "lang/uk-UA.rc" -#endif #ifdef LANGUAGE_ZH_CN #include "lang/zh-CN.rc" #endif -#ifdef LANGUAGE_ZH_TW - #include "lang/zh-TW.rc" -#endif
4 years, 7 months
1
0
0
0
[reactos] 01/01: [BOOTVID][HALXBOX] Implement boot video driver for Xbox (#2774)
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fa1ec0a2ed44fd4e5e05f…
commit fa1ec0a2ed44fd4e5e05fec85450940281481ce9 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Tue May 12 17:32:37 2020 +0300 Commit: Stanislav Motylkov <x86corez(a)gmail.com> CommitDate: Sun May 17 19:18:32 2020 +0300 [BOOTVID][HALXBOX] Implement boot video driver for Xbox (#2774) Also make HalpBiosDisplayReset() function always return FALSE, because we don't have a BIOS on Xbox. CORE-16216 CORE-16219 --- drivers/base/bootvid/CMakeLists.txt | 9 + drivers/base/bootvid/bootvid.rc | 2 + drivers/base/bootvid/i386/xbox/bootvid.c | 441 +++++++++++++++++++++++++++++++ drivers/base/bootvid/i386/xbox/nv2a.h | 63 +++++ drivers/base/bootvid/precomp.h | 2 + hal/halx86/generic/bios.c | 4 + 6 files changed, 521 insertions(+) diff --git a/drivers/base/bootvid/CMakeLists.txt b/drivers/base/bootvid/CMakeLists.txt index 033a37c53ef..d9f1819478b 100644 --- a/drivers/base/bootvid/CMakeLists.txt +++ b/drivers/base/bootvid/CMakeLists.txt @@ -4,15 +4,24 @@ spec2def(bootvid.dll bootvid.spec ADD_IMPORTLIB) if((ARCH STREQUAL "i386") OR (ARCH STREQUAL "amd64")) if(SARCH STREQUAL "pc98") list(APPEND SOURCE + i386/pc98/pc98.h i386/pc98/bootvid.c) + elseif(SARCH STREQUAL "xbox") + list(APPEND SOURCE + i386/xbox/nv2a.h + i386/xbox/bootvid.c) else() list(APPEND SOURCE + i386/pc/pc.h + i386/pc/cmdcnst.h i386/pc/bootvid.c i386/pc/bootdata.c + i386/pc/vga.h i386/pc/vga.c) endif() elseif(ARCH STREQUAL "arm") list(APPEND SOURCE + arm/arm.h arm/bootvid.c) endif() diff --git a/drivers/base/bootvid/bootvid.rc b/drivers/base/bootvid/bootvid.rc index 18d91d14650..8706fe26d69 100644 --- a/drivers/base/bootvid/bootvid.rc +++ b/drivers/base/bootvid/bootvid.rc @@ -2,6 +2,8 @@ #if defined(SARCH_PC98) #define REACTOS_STR_FILE_DESCRIPTION "NEC PC-98 Boot Video Driver" +#elif defined(SARCH_XBOX) +#define REACTOS_STR_FILE_DESCRIPTION "Original Xbox Boot Video Driver" #else #define REACTOS_STR_FILE_DESCRIPTION "VGA Boot Driver" #endif diff --git a/drivers/base/bootvid/i386/xbox/bootvid.c b/drivers/base/bootvid/i386/xbox/bootvid.c new file mode 100644 index 00000000000..5fddab54769 --- /dev/null +++ b/drivers/base/bootvid/i386/xbox/bootvid.c @@ -0,0 +1,441 @@ +/* + * PROJECT: ReactOS Boot Video Driver for Original Xbox + * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) + * PURPOSE: Main file + * COPYRIGHT: Copyright 2004 Gé van Geldorp (gvg(a)reactos.org) + * Copyright 2005 Filip Navara (navaraf(a)reactos.org) + * Copyright 2020 Stanislav Motylkov (x86corez(a)gmail.com) + */ + +#include "precomp.h" + +#include <debug.h> + +/* GLOBALS ********************************************************************/ + +static ULONG_PTR FrameBufferStart = 0; +static ULONG FrameBufferWidth, FrameBufferHeight, PanH, PanV; +static UCHAR BytesPerPixel; +static RGBQUAD CachedPalette[BV_MAX_COLORS]; +static PUCHAR BackBuffer = NULL; + +/* PRIVATE FUNCTIONS *********************************************************/ + +static UCHAR +NvGetCrtc( + ULONG Base, + UCHAR Index) +{ + WRITE_REGISTER_UCHAR((PUCHAR)(Base + NV2A_CRTC_REGISTER_INDEX), Index); + return READ_REGISTER_UCHAR((PUCHAR)(Base + NV2A_CRTC_REGISTER_VALUE)); +} + +static UCHAR +NvGetBytesPerPixel( + ULONG Base, + ULONG ScreenWidth) +{ + /* Get BPP directly from NV2A CRTC (magic constants are from Cromwell) */ + UCHAR BytesPerPixel = 8 * (((NvGetCrtc(Base, 0x19) & 0xE0) << 3) | (NvGetCrtc(Base, 0x13) & 0xFF)) / ScreenWidth; + + if (BytesPerPixel == 4) + { + ASSERT((NvGetCrtc(Base, 0x28) & 0xF) == BytesPerPixel - 1); + } + else + { + ASSERT((NvGetCrtc(Base, 0x28) & 0xF) == BytesPerPixel); + } + + return BytesPerPixel; +} + +static VOID +ApplyPalette(VOID) +{ + PULONG Frame = (PULONG)FrameBufferStart; + ULONG x, y; + + /* Top panning */ + for (x = 0; x < PanV * FrameBufferWidth; x++) + { + *Frame++ = CachedPalette[0]; + } + + /* Left panning */ + for (y = 0; y < SCREEN_HEIGHT; y++) + { + Frame = (PULONG)(FrameBufferStart + FB_OFFSET(-PanH, y)); + + for (x = 0; x < PanH; x++) + { + *Frame++ = CachedPalette[0]; + } + } + + /* Screen redraw */ + PUCHAR Back = BackBuffer; + for (y = 0; y < SCREEN_HEIGHT; y++) + { + Frame = (PULONG)(FrameBufferStart + FB_OFFSET(0, y)); + + for (x = 0; x < SCREEN_WIDTH; x++) + { + *Frame++ = CachedPalette[*Back++]; + } + } + + /* Right panning */ + for (y = 0; y < SCREEN_HEIGHT; y++) + { + Frame = (PULONG)(FrameBufferStart + FB_OFFSET(SCREEN_WIDTH, y)); + + for (x = 0; x < PanH; x++) + { + *Frame++ = CachedPalette[0]; + } + } + + /* Bottom panning */ + Frame = (PULONG)(FrameBufferStart + FB_OFFSET(-PanH, SCREEN_HEIGHT)); + for (x = 0; x < PanV * FrameBufferWidth; x++) + { + *Frame++ = CachedPalette[0]; + } +} + +/* PUBLIC FUNCTIONS **********************************************************/ + +BOOLEAN +NTAPI +VidInitialize( + _In_ BOOLEAN SetMode) +{ + BOOLEAN Result = FALSE; + + /* FIXME: Add platform check */ + /* 1. Access PCI device 1:0:0 */ + /* 2. Check if device ID is 10DE:02A0 */ + + /* FIXME: Get device MMIO ranges from PCI */ + PHYSICAL_ADDRESS PhysControlStart = {.QuadPart = 0xFD000000}; + PHYSICAL_ADDRESS PhysFrameBufferStart = {.QuadPart = 0xF0000000}; + ULONG ControlLength = 16 * 1024 * 1024; + + ULONG_PTR ControlStart = (ULONG_PTR)MmMapIoSpace(PhysControlStart, ControlLength, MmNonCached); + if (!ControlStart) + { + DPRINT1("Out of memory!\n"); + return FALSE; + } + + ULONG_PTR FrameBuffer = READ_REGISTER_ULONG((PULONG)(ControlStart + NV2A_CONTROL_FRAMEBUFFER_ADDRESS_OFFSET)); + FrameBufferWidth = READ_REGISTER_ULONG((PULONG)(ControlStart + NV2A_RAMDAC_FP_HVALID_END)) + 1; + FrameBufferHeight = READ_REGISTER_ULONG((PULONG)(ControlStart + NV2A_RAMDAC_FP_VVALID_END)) + 1; + + FrameBuffer &= 0x0FFFFFFF; + if (FrameBuffer != 0x3C00000 && FrameBuffer != 0x7C00000) + { + /* Check framebuffer address (high 4 MB of either 64 or 128 MB RAM) */ + DPRINT1("Non-standard framebuffer address 0x%p\n", FrameBuffer); + } + /* Verify that framebuffer address is page-aligned */ + ASSERT(FrameBuffer % PAGE_SIZE == 0); + + if (FrameBufferWidth < SCREEN_WIDTH || FrameBufferHeight < SCREEN_HEIGHT) + { + DPRINT1("Unsupported screen resolution!\n"); + goto cleanup; + } + + BytesPerPixel = NvGetBytesPerPixel(ControlStart, FrameBufferWidth); + ASSERT(BytesPerPixel >= 1 && BytesPerPixel <= 4); + + if (BytesPerPixel != 4) + { + DPRINT1("Unsupported BytesPerPixel = %d\n", BytesPerPixel); + goto cleanup; + } + + /* Calculate panning values */ + PanH = (FrameBufferWidth - SCREEN_WIDTH) / 2; + PanV = (FrameBufferHeight - SCREEN_HEIGHT) / 2; + + /* Verify that screen fits framebuffer size */ + ULONG FrameBufferSize = FrameBufferWidth * FrameBufferHeight * BytesPerPixel; + + /* FIXME: obtain fb size from firmware somehow (Cromwell reserves high 4 MB of RAM) */ + if (FrameBufferSize > NV2A_VIDEO_MEMORY_SIZE) + { + DPRINT1("Current screen resolution exceeds video memory bounds!\n"); + goto cleanup; + } + + /* + * Reserve off-screen area for the backbuffer that contains 8-bit indexed + * color screen image, plus preserved row data. + */ + ULONG BackBufferSize = SCREEN_WIDTH * (SCREEN_HEIGHT + BOOTCHAR_HEIGHT + 1); + + /* Make sure there is enough video memory for backbuffer */ + if (NV2A_VIDEO_MEMORY_SIZE - FrameBufferSize < BackBufferSize) + { + DPRINT1("Out of memory!\n"); + goto cleanup; + } + + /* Return the address back to GPU memory mapped I/O */ + PhysFrameBufferStart.QuadPart += FrameBuffer; + FrameBufferStart = (ULONG_PTR)MmMapIoSpace(PhysFrameBufferStart, NV2A_VIDEO_MEMORY_SIZE, MmNonCached); + if (!FrameBufferStart) + { + DPRINT1("Out of memory!\n"); + goto cleanup; + } + + Result = TRUE; + + /* Place backbuffer in the hidden part of framebuffer */ + BackBuffer = (PUCHAR)(FrameBufferStart + NV2A_VIDEO_MEMORY_SIZE - BackBufferSize); + + /* Now check if we have to set the mode */ + if (SetMode) + VidResetDisplay(TRUE); + +cleanup: + if (ControlStart) + MmUnmapIoSpace((PVOID)ControlStart, ControlLength); + + /* Video is ready */ + return Result; +} + +VOID +NTAPI +VidCleanUp(VOID) +{ + /* Just fill the screen black */ + VidSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, BV_COLOR_BLACK); +} + +VOID +NTAPI +VidResetDisplay( + _In_ BOOLEAN HalReset) +{ + /* Clear the current position */ + VidpCurrentX = 0; + VidpCurrentY = 0; + + /* Clear the screen with HAL if we were asked to */ + if (HalReset) + HalResetDisplay(); + + /* Re-initialize the palette and fill the screen black */ + RtlZeroMemory((PULONG)FrameBufferStart, NV2A_VIDEO_MEMORY_SIZE); + InitializePalette(); + VidSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, BV_COLOR_BLACK); +} + +VOID +NTAPI +InitPaletteWithTable( + _In_ PULONG Table, + _In_ ULONG Count) +{ + PULONG Entry = Table; + + for (ULONG i = 0; i < Count; i++, Entry++) + { + CachedPalette[i] = *Entry | 0xFF000000; + } + ApplyPalette(); +} + +VOID +PrepareForSetPixel(VOID) +{ + /* Nothing to prepare */ + NOTHING; +} + +VOID +SetPixel( + _In_ ULONG Left, + _In_ ULONG Top, + _In_ UCHAR Color) +{ + PUCHAR Back = BackBuffer + BB_OFFSET(Left, Top); + PULONG Frame = (PULONG)(FrameBufferStart + FB_OFFSET(Left, Top)); + + *Back = Color; + *Frame = CachedPalette[Color]; +} + +VOID +NTAPI +PreserveRow( + _In_ ULONG CurrentTop, + _In_ ULONG TopDelta, + _In_ BOOLEAN Restore) +{ + PUCHAR NewPosition, OldPosition; + + /* Calculate the position in memory for the row */ + if (Restore) + { + /* Restore the row by copying back the contents saved off-screen */ + NewPosition = BackBuffer + BB_OFFSET(0, CurrentTop); + OldPosition = BackBuffer + BB_OFFSET(0, SCREEN_HEIGHT); + } + else + { + /* Preserve the row by saving its contents off-screen */ + NewPosition = BackBuffer + BB_OFFSET(0, SCREEN_HEIGHT); + OldPosition = BackBuffer + BB_OFFSET(0, CurrentTop); + } + + /* Set the count and loop every pixel of backbuffer */ + ULONG Count = TopDelta * SCREEN_WIDTH; + + RtlCopyMemory(NewPosition, OldPosition, Count); + + if (Restore) + { + NewPosition = BackBuffer + BB_OFFSET(0, CurrentTop); + + /* Set the count and loop every pixel of framebuffer */ + for (ULONG y = 0; y < TopDelta; y++) + { + PULONG Frame = (PULONG)(FrameBufferStart + FB_OFFSET(0, CurrentTop + y)); + + Count = SCREEN_WIDTH; + while (Count--) + { + *Frame++ = CachedPalette[*NewPosition++]; + } + } + } +} + +VOID +NTAPI +DoScroll( + _In_ ULONG Scroll) +{ + ULONG RowSize = VidpScrollRegion[2] - VidpScrollRegion[0] + 1; + + /* Calculate the position in memory for the row */ + PUCHAR OldPosition = BackBuffer + BB_OFFSET(VidpScrollRegion[0], VidpScrollRegion[1] + Scroll); + PUCHAR NewPosition = BackBuffer + BB_OFFSET(VidpScrollRegion[0], VidpScrollRegion[1]); + + /* Start loop */ + for (ULONG Top = VidpScrollRegion[1]; Top <= VidpScrollRegion[3]; ++Top) + { + ULONG i; + + /* Scroll the row */ + RtlCopyMemory(NewPosition, OldPosition, RowSize); + + PULONG Frame = (PULONG)(FrameBufferStart + FB_OFFSET(VidpScrollRegion[0], Top)); + + for (i = 0; i < RowSize; ++i) + Frame[i] = CachedPalette[NewPosition[i]]; + + OldPosition += SCREEN_WIDTH; + NewPosition += SCREEN_WIDTH; + } +} + +VOID +NTAPI +DisplayCharacter( + _In_ CHAR Character, + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG TextColor, + _In_ ULONG BackColor) +{ + /* Get the font and pixel pointer */ + PUCHAR FontChar = GetFontPtr(Character); + + /* Loop each pixel height */ + for (ULONG y = Top; y < Top + BOOTCHAR_HEIGHT; y++, FontChar += FONT_PTR_DELTA) + { + /* Loop each pixel width */ + ULONG x = Left; + + for (UCHAR bit = 1 << (BOOTCHAR_WIDTH - 1); bit > 0; bit >>= 1, x++) + { + /* Check if we should draw this pixel */ + if (*FontChar & bit) + { + /* We do, use the given Text Color */ + SetPixel(x, y, (UCHAR)TextColor); + } + else if (BackColor < BV_COLOR_NONE) + { + /* + * This is a background pixel. We're drawing it + * unless it's transparent. + */ + SetPixel(x, y, (UCHAR)BackColor); + } + } + } +} + +VOID +NTAPI +VidSolidColorFill( + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG Right, + _In_ ULONG Bottom, + _In_ UCHAR Color) +{ + while (Top <= Bottom) + { + PUCHAR Back = BackBuffer + BB_OFFSET(Left, Top); + PULONG Frame = (PULONG)(FrameBufferStart + FB_OFFSET(Left, Top)); + ULONG L = Left; + + while (L++ <= Right) + { + *Back++ = Color; + *Frame++ = CachedPalette[Color]; + } + Top++; + } +} + +VOID +NTAPI +VidScreenToBufferBlt( + _Out_ PUCHAR Buffer, + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG Width, + _In_ ULONG Height, + _In_ ULONG Delta) +{ + /* Clear the destination buffer */ + RtlZeroMemory(Buffer, Delta * Height); + + /* Start the outer Y height loop */ + for (ULONG y = 0; y < Height; y++) + { + /* Set current scanline */ + PUCHAR Back = BackBuffer + BB_OFFSET(Left, Top + y); + PUCHAR Buf = Buffer + y * Delta; + + /* Start the X inner loop */ + for (ULONG x = 0; x < Width; x += 2) + { + /* Read the current value */ + *Buf = (*Back++ & 0xF) << 4; + *Buf |= *Back++ & 0xF; + Buf++; + } + } +} diff --git a/drivers/base/bootvid/i386/xbox/nv2a.h b/drivers/base/bootvid/i386/xbox/nv2a.h new file mode 100644 index 00000000000..e7581fee646 --- /dev/null +++ b/drivers/base/bootvid/i386/xbox/nv2a.h @@ -0,0 +1,63 @@ +/* + * PROJECT: ReactOS Boot Video Driver for Original Xbox + * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) + * PURPOSE: Arch-specific header file + * COPYRIGHT: Copyright 2004 Gé van Geldorp (gvg(a)reactos.org) + * Copyright 2005 Filip Navara (navaraf(a)reactos.org) + * Copyright 2020 Stanislav Motylkov (x86corez(a)gmail.com) + */ + +#ifndef _BOOTVID_NV2A_H_ +#define _BOOTVID_NV2A_H_ + +#pragma once + +/* FIXME: obtain fb size from firmware somehow (Cromwell reserves high 4 MB of RAM) */ +#define NV2A_VIDEO_MEMORY_SIZE (4 * 1024 * 1024) + +#define NV2A_CONTROL_FRAMEBUFFER_ADDRESS_OFFSET 0x600800 +#define NV2A_CRTC_REGISTER_INDEX 0x6013D4 +#define NV2A_CRTC_REGISTER_VALUE 0x6013D5 +#define NV2A_RAMDAC_FP_HVALID_END 0x680838 +#define NV2A_RAMDAC_FP_VVALID_END 0x680818 + +#define BB_OFFSET(x, y) ((y) * SCREEN_WIDTH + (x)) +#define FB_OFFSET(x, y) (((PanV + (y)) * FrameBufferWidth + PanH + (x)) * BytesPerPixel) + +VOID +NTAPI +InitPaletteWithTable( + _In_ PULONG Table, + _In_ ULONG Count); + +VOID +PrepareForSetPixel(VOID); + +VOID +SetPixel( + _In_ ULONG Left, + _In_ ULONG Top, + _In_ UCHAR Color); + +VOID +NTAPI +PreserveRow( + _In_ ULONG CurrentTop, + _In_ ULONG TopDelta, + _In_ BOOLEAN Restore); + +VOID +NTAPI +DoScroll( + _In_ ULONG Scroll); + +VOID +NTAPI +DisplayCharacter( + _In_ CHAR Character, + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG TextColor, + _In_ ULONG BackColor); + +#endif /* _BOOTVID_NV2A_H_ */ diff --git a/drivers/base/bootvid/precomp.h b/drivers/base/bootvid/precomp.h index a5a27f3ead2..bf11f82473b 100644 --- a/drivers/base/bootvid/precomp.h +++ b/drivers/base/bootvid/precomp.h @@ -9,6 +9,8 @@ #if defined(_M_IX86) || defined(_M_AMD64) #if defined(SARCH_PC98) #include "i386/pc98/pc98.h" +#elif defined(SARCH_XBOX) +#include "i386/xbox/nv2a.h" #else #include "i386/pc/vga.h" #include "i386/pc/pc.h" diff --git a/hal/halx86/generic/bios.c b/hal/halx86/generic/bios.c index 85a9d5b37d5..2fe73aa15e5 100644 --- a/hal/halx86/generic/bios.c +++ b/hal/halx86/generic/bios.c @@ -645,6 +645,9 @@ BOOLEAN NTAPI HalpBiosDisplayReset(VOID) { +#ifdef SARCH_XBOX + return FALSE; +#else ULONG Flags; PHARDWARE_PTE IdtPte; BOOLEAN RestoreWriteProtection = FALSE; @@ -709,6 +712,7 @@ HalpBiosDisplayReset(VOID) // __writeeflags(Flags); return TRUE; +#endif } #endif
4 years, 7 months
1
0
0
0
[reactos] 01/01: [ACPPAGE] Add Portuguese translation (#2802)
by Jose Carlos Jesus
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cd0c06bef33ccaa7bd4b2…
commit cd0c06bef33ccaa7bd4b21fcfe5e9763549586f9 Author: Jose Carlos Jesus <zecarlos1957(a)hotmail.com> AuthorDate: Sun May 17 17:12:11 2020 +0100 Commit: GitHub <noreply(a)github.com> CommitDate: Sun May 17 18:12:11 2020 +0200 [ACPPAGE] Add Portuguese translation (#2802) --- dll/shellext/acppage/ACPPage.rc | 3 +++ dll/shellext/acppage/lang/pt-PT.rc | 42 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/dll/shellext/acppage/ACPPage.rc b/dll/shellext/acppage/ACPPage.rc index 3c741cd5115..341ae29ee26 100644 --- a/dll/shellext/acppage/ACPPage.rc +++ b/dll/shellext/acppage/ACPPage.rc @@ -61,6 +61,9 @@ IDR_ACPPAGE REGISTRY "res/acppage.rgs" #ifdef LANGUAGE_PL_PL #include "lang/pl-PL.rc" #endif +#ifdef LANGUAGE_PT_PT + #include "lang/pt-PT.rc" +#endif #ifdef LANGUAGE_RO_RO #include "lang/ro-RO.rc" #endif diff --git a/dll/shellext/acppage/lang/pt-PT.rc b/dll/shellext/acppage/lang/pt-PT.rc new file mode 100644 index 00000000000..7d2fc5b9b90 --- /dev/null +++ b/dll/shellext/acppage/lang/pt-PT.rc @@ -0,0 +1,42 @@ +LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL + +IDD_ACPPAGESHEET DIALOGEX 0, 0, 224, 226 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Compatibilidade" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LTEXT "Se tiver problemas para executar este programa no ReactOS, seleccione o sistema operacional que o ReactOS deve reportar ao aplicativo.\nTenha em atenção que este é um trabalho em desenvolvimento.", IDC_EXPLANATION, 7, 7, 210, 31 + GROUPBOX "Mode de compatibilidade", IDC_COMPATGROUP, 7, 41, 210, 49 + CHECKBOX "Exec. este programa em modo de compatibilidade para:", IDC_CHKRUNCOMPATIBILITY, 18, 57, 188, 10, BS_AUTOCHECKBOX | WS_TABSTOP + COMBOBOX IDC_COMPATIBILITYMODE, 18, 70, 188, 85, CBS_HASSTRINGS | CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED + GROUPBOX "Definições de visualização", -1, 7, 99, 210, 61, BS_GROUPBOX + CHECKBOX "Executar em 256 cores", IDC_CHKRUNIN256COLORS, 18, 114, 188, 10, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "Executar na resolução de ecrã 640x480", IDC_CHKRUNIN640480RES, 18, 129, 188, 10, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "Desactivar temas visuais", IDC_CHKDISABLEVISUALTHEMES, 18, 144, 188, 10, BS_AUTOCHECKBOX | WS_TABSTOP + PUSHBUTTON "E&ditar modos de compatibilidade...", IDC_EDITCOMPATIBILITYMODES, 105, 167, 112, 15 + LTEXT "",IDC_ENABLED_LAYERS,7,185,210,21 + CONTROL "Aprenda mais acerca <A>compatibilidade de programas</A>.", IDC_INFOLINK, "SysLink", WS_CHILD | WS_TABSTOP | WS_VISIBLE, 7, 207, 210, 10, WS_EX_NOPARENTNOTIFY +END + +IDD_EDITCOMPATIBILITYMODES DIALOGEX 0, 0, 309, 134 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Editar modos de compatibilidade" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + LISTBOX IDC_NEWCOMPATIBILITYMODE,6,18,132,90,LBS_NOINTEGRALHEIGHT | WS_VSCROLL + LISTBOX IDC_COMPATIBILITYMODE,168,18,132,90,LBS_NOINTEGRALHEIGHT | WS_VSCROLL + PUSHBUTTON ">",IDC_ADD,144,42,18,14,WS_DISABLED + PUSHBUTTON "<<",IDC_REMOVEALL,144,78,18,14,WS_DISABLED + PUSHBUTTON "<",IDC_REMOVE,144,60,18,14,WS_DISABLED + PUSHBUTTON "&OK",IDOK,174,114,60,14 + PUSHBUTTON "&Cancelar",IDCANCEL,240,114,60,14 + LTEXT "Modos disponíveis",-1,6,6,52,8 + LTEXT "Modos seleccionados",-1,168,6,51,8 +END + +STRINGTABLE +BEGIN + IDS_COMPAT_TITLE "Compatibilidade" + IDS_FAILED_NETWORK "Os modos de compatibilidade não podem ser definidos neste programa porque ele está numa unidade de rede." + IDS_FAILED_PROTECTED "Os modos de compatibilidade não podem ser definidos neste programa porque faz parte do ReactOS." +END
4 years, 7 months
1
0
0
0
[reactos] 06/06: [COMDLG32] Differentiate between real and virtual folders, do not allow traversal inside virtual folders when selecting a file CORE-16908
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=332889b8d7b452df9bd89…
commit 332889b8d7b452df9bd899a5ed04d41dd22876de Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Wed May 6 22:04:11 2020 +0200 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun May 17 17:09:05 2020 +0200 [COMDLG32] Differentiate between real and virtual folders, do not allow traversal inside virtual folders when selecting a file CORE-16908 --- dll/win32/comdlg32/filedlg.c | 8 ++++---- dll/win32/comdlg32/filedlgbrowser.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dll/win32/comdlg32/filedlg.c b/dll/win32/comdlg32/filedlg.c index af3c5c4a3ac..6e5134f6ce3 100644 --- a/dll/win32/comdlg32/filedlg.c +++ b/dll/win32/comdlg32/filedlg.c @@ -2782,12 +2782,12 @@ int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf, PathAddBackslashW(lpwstrTemp); } - dwAttributes = SFGAO_FOLDER; + dwAttributes = SFGAO_FOLDER | SFGAO_FILESYSANCESTOR; if(SUCCEEDED(IShellFolder_ParseDisplayName(*ppsf, hwnd, NULL, lpwstrTemp, &dwEaten, &pidl, &dwAttributes))) { /* the path component is valid, we have a pidl of the next path component */ TRACE("parse OK attr=0x%08x pidl=%p\n", dwAttributes, pidl); - if(dwAttributes & SFGAO_FOLDER) + if((dwAttributes & (SFGAO_FOLDER | SFGAO_FILESYSANCESTOR)) == (SFGAO_FOLDER | SFGAO_FILESYSANCESTOR)) { if(FAILED(IShellFolder_BindToObject(*ppsf, pidl, 0, &IID_IShellFolder, (LPVOID*)&lpsfChild))) { @@ -4468,7 +4468,7 @@ static LPITEMIDLIST GetPidlFromName(IShellFolder *lpsf,LPWSTR lpcstrFileName) */ static BOOL IsPidlFolder (LPSHELLFOLDER psf, LPCITEMIDLIST pidl) { - ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; + ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR; HRESULT ret; TRACE("%p, %p\n", psf, pidl); @@ -4477,7 +4477,7 @@ static BOOL IsPidlFolder (LPSHELLFOLDER psf, LPCITEMIDLIST pidl) TRACE("-- 0x%08x 0x%08x\n", uAttr, ret); /* see documentation shell 4.1*/ - return uAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER); + return (uAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER)) && (uAttr & SFGAO_FILESYSANCESTOR); } /*********************************************************************** diff --git a/dll/win32/comdlg32/filedlgbrowser.c b/dll/win32/comdlg32/filedlgbrowser.c index 5b5323f4d22..83d5f5e9e09 100644 --- a/dll/win32/comdlg32/filedlgbrowser.c +++ b/dll/win32/comdlg32/filedlgbrowser.c @@ -774,9 +774,9 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDl { HRESULT hRes; - ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; + ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR; IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, (LPCITEMIDLIST *)&pidl, &ulAttr); - if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) ) + if ((ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER)) && (ulAttr & SFGAO_FILESYSANCESTOR)) { hRes = IShellBrowser_BrowseObject(&This->IShellBrowser_iface,pidl,SBSP_RELATIVE); if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
4 years, 7 months
1
0
0
0
[reactos] 05/06: [SHELLUTILS] Fix Win32DbgPrint's result
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=84513890412e309e25afe…
commit 84513890412e309e25afe9a703cd072625c49718 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Sun Oct 13 18:05:34 2019 +0200 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun May 17 17:09:05 2020 +0200 [SHELLUTILS] Fix Win32DbgPrint's result --- sdk/include/reactos/shellutils.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/include/reactos/shellutils.h b/sdk/include/reactos/shellutils.h index 8cc51f379d4..82f2f708eee 100644 --- a/sdk/include/reactos/shellutils.h +++ b/sdk/include/reactos/shellutils.h @@ -30,7 +30,6 @@ Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...) char *szMsgStart; const char *fname; va_list vl; - ULONG uRet; fname = strrchr(filename, '\\'); if (fname == NULL) @@ -48,12 +47,13 @@ Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...) szMsgStart = szMsg + sprintf(szMsg, "%s:%d: ", fname, line); va_start(vl, lpFormat); - uRet = (ULONG) vsprintf(szMsgStart, lpFormat, vl); + vsprintf(szMsgStart, lpFormat, vl); va_end(vl); OutputDebugStringA(szMsg); - return uRet; + /* Return STATUS_SUCCESS, since we are supposed to mimic DbgPrint */ + return 0; } #define DbgPrint(fmt, ...) \
4 years, 7 months
1
0
0
0
[reactos] 04/06: [SHELL32] Properly enumerate virtual shell folders (on files) as fake folders CORE-16908
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f379a29606aa03c74f521…
commit f379a29606aa03c74f521de5b9028eb623ed4055 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Mon Apr 27 20:43:16 2020 +0200 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun May 17 17:09:04 2020 +0200 [SHELL32] Properly enumerate virtual shell folders (on files) as fake folders CORE-16908 --- dll/win32/shell32/folders/CFSFolder.cpp | 100 +++++++++++++++++++++++++++++++- sdk/include/reactos/shlwapi_undoc.h | 1 + 2 files changed, 99 insertions(+), 2 deletions(-) diff --git a/dll/win32/shell32/folders/CFSFolder.cpp b/dll/win32/shell32/folders/CFSFolder.cpp index 266a7478367..a97ad5d4980 100644 --- a/dll/win32/shell32/folders/CFSFolder.cpp +++ b/dll/win32/shell32/folders/CFSFolder.cpp @@ -371,6 +371,52 @@ private: BOOL bDirectory = (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; + HRESULT hr; + if (bDirectory) + { + // Skip the current and parent directory nodes + if (!strcmpW(FindData.cFileName, L".") || !strcmpW(FindData.cFileName, L"..")) + return S_OK; + + // Does this directory need special handling? + if ((FindData.dwFileAttributes & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY)) != 0) + { + WCHAR Tmp[MAX_PATH]; + CLSID clsidFolder; + + PathCombineW(Tmp, sParentDir, FindData.cFileName); + + hr = SHELL32_GetCLSIDForDirectory(Tmp, L"CLSID", &clsidFolder); + if (SUCCEEDED(hr)) + { + ERR("SHOULD DO SOMETHING WITH CLSID?\n"); + } + } + } + else + { + CLSID clsidFile; + LPWSTR pExtension = PathFindExtensionW(FindData.cFileName); + if (pExtension) + { + // FIXME: Cache this? + hr = GetCLSIDForFileTypeFromExtension(pExtension, L"CLSID", &clsidFile); + if (hr == S_OK) + { + HKEY hkey; + hr = SHRegGetCLSIDKeyW(clsidFile, L"ShellFolder", FALSE, FALSE, &hkey); + if (SUCCEEDED(hr)) + { + ::RegCloseKey(hkey); + + // This should be presented as directory! + bDirectory = TRUE; + TRACE("Treating '%S' as directory!\n", FindData.cFileName); + } + } + } + } + LPITEMIDLIST pidl = NULL; if (bDirectory) { @@ -573,10 +619,60 @@ HRESULT SHELL32_GetFSItemAttributes(IShellFolder * psf, LPCITEMIDLIST pidl, LPDW dwShellAttributes = SFGAO_CANCOPY | SFGAO_CANMOVE | SFGAO_CANLINK | SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSTEM; - if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - dwShellAttributes |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR | SFGAO_STORAGE); + BOOL bDirectory = (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; + + if (!bDirectory) + { + //
https://git.reactos.org/?p=reactos.git;a=blob;f=dll/shellext/zipfldr/res/zi…
+ WCHAR szFileName[MAX_PATH]; + LPWSTR pExtension; + + if (_ILSimpleGetTextW(pidl, szFileName, _countof(szFileName)) && (pExtension = PathFindExtensionW(szFileName))) + { + CLSID clsidFile; + // FIXME: Cache this? + HRESULT hr = GetCLSIDForFileTypeFromExtension(pExtension, L"CLSID", &clsidFile); + if (hr == S_OK) + { + HKEY hkey; + hr = SHRegGetCLSIDKeyW(clsidFile, L"ShellFolder", FALSE, FALSE, &hkey); + if (SUCCEEDED(hr)) + { + DWORD dwAttributes = 0; + DWORD dwSize = sizeof(dwAttributes); + LSTATUS Status; + + Status = SHRegGetValueW(hkey, NULL, L"Attributes", RRF_RT_REG_DWORD, NULL, &dwAttributes, &dwSize); + if (Status == STATUS_SUCCESS) + { + ERR("Augmenting '%S' with dwAttributes=0x%x\n", szFileName, dwAttributes); + dwShellAttributes |= dwAttributes; + } + ::RegCloseKey(hkey); + + // This should be presented as directory! + bDirectory = TRUE; + ERR("Treating '%S' as directory!\n", szFileName); + } + } + } + } + + // This is a directory + if (bDirectory) + { + dwShellAttributes |= (SFGAO_FOLDER | /*SFGAO_HASSUBFOLDER |*/ SFGAO_STORAGE); + + // Is this a real directory? + if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + dwShellAttributes |= (SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR); + } + } else + { dwShellAttributes |= SFGAO_STREAM; + } if (dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) dwShellAttributes |= SFGAO_HIDDEN; diff --git a/sdk/include/reactos/shlwapi_undoc.h b/sdk/include/reactos/shlwapi_undoc.h index a90537fbd30..08af85972d7 100644 --- a/sdk/include/reactos/shlwapi_undoc.h +++ b/sdk/include/reactos/shlwapi_undoc.h @@ -53,6 +53,7 @@ HRESULT WINAPI IsQSForward(REFGUID pguidCmdGroup,ULONG cCmds, OLECMD *prgCmds); BOOL WINAPI SHIsChildOrSelf(HWND hParent, HWND hChild); HRESULT WINAPI SHForwardContextMenuMsg(IUnknown* pUnk, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* pResult, BOOL useIContextMenu2); +HRESULT WINAPI SHRegGetCLSIDKeyW(REFGUID guid, LPCWSTR lpszValue, BOOL bUseHKCU, BOOL bCreate, PHKEY phKey); BOOL WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewItem); BOOL WINAPI SHRemoveDataBlock(LPDBLIST* lppList, DWORD dwSignature);
4 years, 7 months
1
0
0
0
← Newer
1
...
4
5
6
7
8
9
10
...
20
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Results per page:
10
25
50
100
200