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
March 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
25 participants
156 discussions
Start a n
N
ew thread
[reactos] 07/07: [ISAPNP] Create requirements and resource lists when detecting a device
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=67141abef193080faa7a5…
commit 67141abef193080faa7a59ee096844a2f56f828d Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sun Mar 22 14:20:52 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Sun Mar 22 14:29:38 2020 +0100 [ISAPNP] Create requirements and resource lists when detecting a device --- drivers/bus/isapnp/isapnp.c | 200 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) diff --git a/drivers/bus/isapnp/isapnp.c b/drivers/bus/isapnp/isapnp.c index 5c5321b3308..e8862345cc0 100644 --- a/drivers/bus/isapnp/isapnp.c +++ b/drivers/bus/isapnp/isapnp.c @@ -3,6 +3,7 @@ * FILE: isapnp.c * PURPOSE: Driver entry * PROGRAMMERS: Cameron Gutman (cameron.gutman(a)reactos.org) + * Hervé Poussineau */ #include <isapnp.h> @@ -136,6 +137,198 @@ IsaFdoCreateDeviceIDs( return STATUS_SUCCESS; } +static +NTSTATUS +NTAPI +IsaFdoCreateRequirements( + IN PISAPNP_PDO_EXTENSION PdoExt) +{ + PISAPNP_LOGICAL_DEVICE LogDev = PdoExt->IsaPnpDevice; + RTL_BITMAP IrqBitmap[ARRAYSIZE(LogDev->Irq)]; + ULONG IrqData[ARRAYSIZE(LogDev->Irq)]; + ULONG ResourceCount = 0; + ULONG ListSize, i, j; + BOOLEAN FirstIrq = TRUE; + PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList; + PIO_RESOURCE_DESCRIPTOR Descriptor; + + /* Count number of requirements */ + for (i = 0; i < ARRAYSIZE(LogDev->Io); i++) + { + if (!LogDev->Io[i].Description.Length) + break; + ResourceCount++; + } + for (i = 0; i < ARRAYSIZE(LogDev->Irq); i++) + { + if (!LogDev->Irq[i].Description.Mask) + break; + IrqData[i] = LogDev->Irq[i].Description.Mask; + RtlInitializeBitMap(&IrqBitmap[i], &IrqData[i], 16); + ResourceCount += RtlNumberOfSetBits(&IrqBitmap[i]); + if (LogDev->Irq[i].Description.Information & 0x4) + { + /* Add room for level sensitive */ + ResourceCount += RtlNumberOfSetBits(&IrqBitmap[i]); + } + } + if (ResourceCount == 0) + return STATUS_SUCCESS; + + /* Allocate memory to store requirements */ + ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + + ResourceCount * sizeof(IO_RESOURCE_DESCRIPTOR); + RequirementsList = ExAllocatePool(PagedPool, ListSize); + if (!RequirementsList) + return STATUS_NO_MEMORY; + + RtlZeroMemory(RequirementsList, ListSize); + RequirementsList->ListSize = ListSize; + RequirementsList->InterfaceType = Isa; + RequirementsList->AlternativeLists = 1; + + RequirementsList->List[0].Version = 1; + RequirementsList->List[0].Revision = 1; + RequirementsList->List[0].Count = ResourceCount; + + /* Store requirements */ + Descriptor = RequirementsList->List[0].Descriptors; + for (i = 0; i < ARRAYSIZE(LogDev->Io); i++) + { + if (!LogDev->Io[i].Description.Length) + break; + DPRINT("Device.Io[%d].Information = 0x%02x\n", i, LogDev->Io[i].Description.Information); + DPRINT("Device.Io[%d].Minimum = 0x%02x\n", i, LogDev->Io[i].Description.Minimum); + DPRINT("Device.Io[%d].Maximum = 0x%02x\n", i, LogDev->Io[i].Description.Maximum); + DPRINT("Device.Io[%d].Alignment = 0x%02x\n", i, LogDev->Io[i].Description.Alignment); + DPRINT("Device.Io[%d].Length = 0x%02x\n", i, LogDev->Io[i].Description.Length); + Descriptor->Type = CmResourceTypePort; + Descriptor->ShareDisposition = CmResourceShareDeviceExclusive; + if (LogDev->Io[i].Description.Information & 0x1) + Descriptor->Flags = CM_RESOURCE_PORT_16_BIT_DECODE; + else + Descriptor->Flags = CM_RESOURCE_PORT_10_BIT_DECODE; + Descriptor->u.Port.Length = LogDev->Io[i].Description.Length; + Descriptor->u.Port.Alignment = LogDev->Io[i].Description.Alignment; + Descriptor->u.Port.MinimumAddress.LowPart = LogDev->Io[i].Description.Minimum; + Descriptor->u.Port.MaximumAddress.LowPart = LogDev->Io[i].Description.Maximum + LogDev->Io[i].Description.Length - 1; + Descriptor++; + } + for (i = 0; i < ARRAYSIZE(LogDev->Irq); i++) + { + if (!LogDev->Irq[i].Description.Mask) + break; + DPRINT("Device.Irq[%d].Mask = 0x%02x\n", i, LogDev->Irq[i].Description.Mask); + DPRINT("Device.Irq[%d].Information = 0x%02x\n", i, LogDev->Irq[i].Description.Information); + for (j = 0; j < 15; j++) + { + if (!RtlCheckBit(&IrqBitmap[i], j)) + continue; + if (FirstIrq) + FirstIrq = FALSE; + else + Descriptor->Option = IO_RESOURCE_ALTERNATIVE; + Descriptor->Type = CmResourceTypeInterrupt; + Descriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED; + Descriptor->u.Interrupt.MinimumVector = Descriptor->u.Interrupt.MaximumVector = j; + Descriptor++; + if (LogDev->Irq[i].Description.Information & 0x4) + { + /* Level interrupt */ + Descriptor->Option = IO_RESOURCE_ALTERNATIVE; + Descriptor->Type = CmResourceTypeInterrupt; + Descriptor->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE; + Descriptor->u.Interrupt.MinimumVector = Descriptor->u.Interrupt.MaximumVector = j; + Descriptor++; + } + } + } + + PdoExt->RequirementsList = RequirementsList; + return STATUS_SUCCESS; +} + +static +NTSTATUS +NTAPI +IsaFdoCreateResources( + IN PISAPNP_PDO_EXTENSION PdoExt) +{ + PISAPNP_LOGICAL_DEVICE LogDev = PdoExt->IsaPnpDevice; + ULONG ResourceCount = 0; + ULONG ListSize, i; + PCM_RESOURCE_LIST ResourceList; + PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor; + + /* Count number of required resources */ + for (i = 0; i < ARRAYSIZE(LogDev->Io); i++) + { + if (LogDev->Io[i].CurrentBase) + ResourceCount++; + else + break; + } + for (i = 0; i < ARRAYSIZE(LogDev->Irq); i++) + { + if (LogDev->Irq[i].CurrentNo) + ResourceCount++; + else + break; + } + if (ResourceCount == 0) + return STATUS_SUCCESS; + + /* Allocate memory to store resources */ + ListSize = sizeof(CM_RESOURCE_LIST) + + (ResourceCount - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); + ResourceList = ExAllocatePool(PagedPool, ListSize); + if (!ResourceList) + return STATUS_NO_MEMORY; + + RtlZeroMemory(ResourceList, ListSize); + ResourceList->Count = 1; + ResourceList->List[0].InterfaceType = Isa; + ResourceList->List[0].PartialResourceList.Version = 1; + ResourceList->List[0].PartialResourceList.Revision = 1; + ResourceList->List[0].PartialResourceList.Count = ResourceCount; + + /* Store resources */ + ResourceCount = 0; + for (i = 0; i < ARRAYSIZE(LogDev->Io); i++) + { + if (!LogDev->Io[i].CurrentBase) + continue; + Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[ResourceCount++]; + Descriptor->Type = CmResourceTypePort; + Descriptor->ShareDisposition = CmResourceShareDeviceExclusive; + if (LogDev->Io[i].Description.Information & 0x1) + Descriptor->Flags = CM_RESOURCE_PORT_16_BIT_DECODE; + else + Descriptor->Flags = CM_RESOURCE_PORT_10_BIT_DECODE; + Descriptor->u.Port.Length = LogDev->Io[i].Description.Length; + Descriptor->u.Port.Start.LowPart = LogDev->Io[i].CurrentBase; + } + for (i = 0; i < ARRAYSIZE(LogDev->Irq); i++) + { + if (!LogDev->Irq[i].CurrentNo) + continue; + Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[ResourceCount++]; + Descriptor->Type = CmResourceTypeInterrupt; + Descriptor->ShareDisposition = CmResourceShareDeviceExclusive; + if (LogDev->Irq[i].CurrentType & 0x01) + Descriptor->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE; + else + Descriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED; + Descriptor->u.Interrupt.Level = LogDev->Irq[i].CurrentNo; + Descriptor->u.Interrupt.Vector = LogDev->Irq[i].CurrentNo; + Descriptor->u.Interrupt.Affinity = -1; + } + + PdoExt->ResourceList = ResourceList; + PdoExt->ResourceListSize = ListSize; + return STATUS_SUCCESS; +} + NTSTATUS NTAPI IsaPnpFillDeviceRelations( @@ -197,6 +390,13 @@ IsaPnpFillDeviceRelations( PdoExt->FdoExt = FdoExt; Status = IsaFdoCreateDeviceIDs(PdoExt); + + if (NT_SUCCESS(Status)) + Status = IsaFdoCreateRequirements(PdoExt); + + if (NT_SUCCESS(Status)) + Status = IsaFdoCreateResources(PdoExt); + if (!NT_SUCCESS(Status)) { IoDeleteDevice(IsaDevice->Pdo);
4 years, 9 months
1
0
0
0
[reactos] 06/07: [ISAPNP] Read all tags when detecting devices, and keep interesting ones
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0ca55678941e6a6951ce1…
commit 0ca55678941e6a6951ce1bc78e2e749a6e97a2e1 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 21 23:08:00 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Sun Mar 22 14:29:38 2020 +0100 [ISAPNP] Read all tags when detecting devices, and keep interesting ones Currently, we only keep device identification, IO ports and IRQs. --- drivers/bus/isapnp/fdo.c | 1 + drivers/bus/isapnp/hardware.c | 117 +++++++++++++++++++++++++++--------------- drivers/bus/isapnp/isapnp.c | 1 - drivers/bus/isapnp/isapnp.h | 17 +++++- drivers/bus/isapnp/isapnphw.h | 17 ++++++ drivers/bus/isapnp/pdo.c | 1 + 6 files changed, 109 insertions(+), 45 deletions(-) diff --git a/drivers/bus/isapnp/fdo.c b/drivers/bus/isapnp/fdo.c index caa4b69c7e2..be044407f20 100644 --- a/drivers/bus/isapnp/fdo.c +++ b/drivers/bus/isapnp/fdo.c @@ -3,6 +3,7 @@ * FILE: fdo.c * PURPOSE: FDO-specific code * PROGRAMMERS: Cameron Gutman (cameron.gutman(a)reactos.org) + * Hervé Poussineau */ #include <isapnp.h> diff --git a/drivers/bus/isapnp/hardware.c b/drivers/bus/isapnp/hardware.c index 53b71b78abb..36638e0632d 100644 --- a/drivers/bus/isapnp/hardware.c +++ b/drivers/bus/isapnp/hardware.c @@ -3,10 +3,10 @@ * FILE: hardware.c * PURPOSE: Hardware support code * PROGRAMMERS: Cameron Gutman (cameron.gutman(a)reactos.org) + * Hervé Poussineau */ #include <isapnp.h> -#include <isapnphw.h> #define NDEBUG #include <debug.h> @@ -189,6 +189,16 @@ ReadIrqNo( return ReadByte(ReadDataPort, ISAPNP_IRQNO(Index)); } +static +inline +USHORT +ReadIrqType( + IN PUCHAR ReadDataPort, + IN USHORT Index) +{ + return ReadByte(ReadDataPort, ISAPNP_IRQTYPE(Index)); +} + static inline VOID @@ -287,15 +297,19 @@ IsaPnpChecksum( static BOOLEAN -FindTag( +ReadTags( IN PUCHAR ReadDataPort, - IN USHORT WantedTag, - IN OUT PVOID Buffer, - IN ULONG Length) + IN USHORT LogDev, + IN OUT PISAPNP_LOGICAL_DEVICE LogDevice) { - USHORT Tag, TagLen; + BOOLEAN res = FALSE; + PVOID Buffer; + USHORT Tag, TagLen, MaxLen; + ULONG NumberOfIo = 0, NumberOfIrq = 0; - do + LogDev += 1; + + while (TRUE) { Tag = PeekByte(ReadDataPort); if (ISAPNP_IS_SMALL_TAG(Tag)) @@ -308,41 +322,55 @@ FindTag( TagLen = PeekByte(ReadDataPort) + (PeekByte(ReadDataPort) << 8); Tag = ISAPNP_LARGE_TAG_NAME(Tag); } + if (Tag == ISAPNP_TAG_END) + break; - if (Tag == WantedTag) + Buffer = NULL; + if (Tag == ISAPNP_TAG_LOGDEVID) { - if (Length > TagLen) - Length = TagLen; - - Peek(ReadDataPort, Buffer, Length); + MaxLen = sizeof(LogDevice->LogDevId); + Buffer = &LogDevice->LogDevId; + LogDev--; + } + else if (Tag == ISAPNP_TAG_IRQ && NumberOfIrq < ARRAYSIZE(LogDevice->Irq)) + { + MaxLen = sizeof(LogDevice->Irq[NumberOfIrq].Description); + Buffer = &LogDevice->Irq[NumberOfIrq].Description; + NumberOfIrq++; + } + else if (Tag == ISAPNP_TAG_IOPORT && NumberOfIo < ARRAYSIZE(LogDevice->Io)) + { + MaxLen = sizeof(LogDevice->Io[NumberOfIo].Description); + Buffer = &LogDevice->Io[NumberOfIo].Description; + NumberOfIo++; + } + else if (LogDev == 0) + { + DPRINT1("Found unknown tag 0x%x (len %d)\n", Tag, TagLen); + } - return TRUE; + if (Buffer && LogDev == 0) + { + res = TRUE; + if (MaxLen > TagLen) + { + Peek(ReadDataPort, Buffer, TagLen); + } + else + { + Peek(ReadDataPort, Buffer, MaxLen); + Peek(ReadDataPort, NULL, TagLen - MaxLen); + } } else { + /* We don't want to read informations on this + * logical device, or we don't know the tag. */ Peek(ReadDataPort, NULL, TagLen); } - } while (Tag != ISAPNP_TAG_END); + }; - return FALSE; -} - -static -BOOLEAN -FindLogDevId( - IN PUCHAR ReadDataPort, - IN USHORT LogDev, - IN OUT PISAPNP_LOGDEVID LogDeviceId) -{ - USHORT i; - - for (i = 0; i <= LogDev; i++) - { - if (!FindTag(ReadDataPort, ISAPNP_TAG_LOGDEVID, LogDeviceId, sizeof(*LogDeviceId))) - return FALSE; - } - - return TRUE; + return res; } static @@ -476,9 +504,9 @@ ProbeIsaPnpBus( { PISAPNP_LOGICAL_DEVICE LogDevice; ISAPNP_IDENTIFIER Identifier; - ISAPNP_LOGDEVID LogDevId; USHORT Csn; USHORT LogDev; + ULONG i; ASSERT(FdoExt->ReadDataPort); @@ -507,21 +535,26 @@ ProbeIsaPnpBus( return STATUS_SUCCESS; } - if (!FindLogDevId(FdoExt->ReadDataPort, LogDev, &LogDevId)) + if (!ReadTags(FdoExt->ReadDataPort, LogDev, LogDevice)) break; WriteLogicalDeviceNumber(LogDev); - LogDevice->VendorId[0] = ((LogDevId.VendorId >> 2) & 0x1f) + 'A' - 1, - LogDevice->VendorId[1] = (((LogDevId.VendorId & 0x3) << 3) | ((LogDevId.VendorId >> 13) & 0x7)) + 'A' - 1, - LogDevice->VendorId[2] = ((LogDevId.VendorId >> 8) & 0x1f) + 'A' - 1, - LogDevice->ProdId = RtlUshortByteSwap(LogDevId.ProdId); + LogDevice->VendorId[0] = ((LogDevice->LogDevId.VendorId >> 2) & 0x1f) + 'A' - 1, + LogDevice->VendorId[1] = (((LogDevice->LogDevId.VendorId & 0x3) << 3) | ((LogDevice->LogDevId.VendorId >> 13) & 0x7)) + 'A' - 1, + LogDevice->VendorId[2] = ((LogDevice->LogDevId.VendorId >> 8) & 0x1f) + 'A' - 1, + LogDevice->ProdId = RtlUshortByteSwap(LogDevice->LogDevId.ProdId); LogDevice->SerialNumber = Identifier.Serial; - LogDevice->IoAddr = ReadIoBase(FdoExt->ReadDataPort, 0); - LogDevice->IrqNo = ReadIrqNo(FdoExt->ReadDataPort, 0); + for (i = 0; i < ARRAYSIZE(LogDevice->Io); i++) + LogDevice->Io[i].CurrentBase = ReadIoBase(FdoExt->ReadDataPort, i); + for (i = 0; i < ARRAYSIZE(LogDevice->Irq); i++) + { + LogDevice->Irq[i].CurrentNo = ReadIrqNo(FdoExt->ReadDataPort, i); + LogDevice->Irq[i].CurrentType = ReadIrqType(FdoExt->ReadDataPort, i); + } DPRINT1("Detected ISA PnP device - VID: '%3s' PID: 0x%x SN: 0x%08x IoBase: 0x%x IRQ:0x%x\n", - LogDevice->VendorId, LogDevice->ProdId, LogDevice->SerialNumber, LogDevice->IoAddr, LogDevice->IrqNo); + LogDevice->VendorId, LogDevice->ProdId, LogDevice->SerialNumber, LogDevice->Io[0].CurrentBase, LogDevice->Irq[0].CurrentNo); WaitForKey(); diff --git a/drivers/bus/isapnp/isapnp.c b/drivers/bus/isapnp/isapnp.c index 6f22efcd014..5c5321b3308 100644 --- a/drivers/bus/isapnp/isapnp.c +++ b/drivers/bus/isapnp/isapnp.c @@ -6,7 +6,6 @@ */ #include <isapnp.h> -#include <isapnphw.h> #define NDEBUG #include <debug.h> diff --git a/drivers/bus/isapnp/isapnp.h b/drivers/bus/isapnp/isapnp.h index 416ed2df55f..ea7fca25cb6 100644 --- a/drivers/bus/isapnp/isapnp.h +++ b/drivers/bus/isapnp/isapnp.h @@ -3,6 +3,7 @@ #include <wdm.h> #include <ntstrsafe.h> +#include <isapnphw.h> #ifdef __cplusplus extern "C" { @@ -15,13 +16,25 @@ typedef enum { dsStarted } ISAPNP_DEVICE_STATE; +typedef struct _ISAPNP_IO { + USHORT CurrentBase; + ISAPNP_IO_DESCRIPTION Description; +} ISAPNP_IO, PISAPNP_IO; + +typedef struct _ISAPNP_IRQ { + UCHAR CurrentNo; + UCHAR CurrentType; + ISAPNP_IRQ_DESCRIPTION Description; +} ISAPNP_IRQ, *PISAPNP_IRQ; + typedef struct _ISAPNP_LOGICAL_DEVICE { PDEVICE_OBJECT Pdo; + ISAPNP_LOGDEVID LogDevId; UCHAR VendorId[3]; USHORT ProdId; ULONG SerialNumber; - USHORT IoAddr; - UCHAR IrqNo; + ISAPNP_IO Io[8]; + ISAPNP_IRQ Irq[2]; UCHAR CSN; UCHAR LDN; LIST_ENTRY ListEntry; diff --git a/drivers/bus/isapnp/isapnphw.h b/drivers/bus/isapnp/isapnphw.h index eeef89951f0..86a55073615 100644 --- a/drivers/bus/isapnp/isapnphw.h +++ b/drivers/bus/isapnp/isapnphw.h @@ -101,6 +101,23 @@ typedef struct _ISAPNP_DEVICEID { USHORT ProdId; } ISAPNP_DEVICEID, *PISAPNP_DEVICEID; +#include <pshpack1.h> + +typedef struct _ISAPNP_IO_DESCRIPTION { + UCHAR Information; + USHORT Minimum; + USHORT Maximum; + UCHAR Alignment; + UCHAR Length; +} ISAPNP_IO_DESCRIPTION; + +typedef struct _ISAPNP_IRQ_DESCRIPTION { + USHORT Mask; + UCHAR Information; +} ISAPNP_IRQ_DESCRIPTION; + +#include <poppack.h> + #ifdef __cplusplus } #endif diff --git a/drivers/bus/isapnp/pdo.c b/drivers/bus/isapnp/pdo.c index d4a34cf78ec..7cd8c7d3812 100644 --- a/drivers/bus/isapnp/pdo.c +++ b/drivers/bus/isapnp/pdo.c @@ -3,6 +3,7 @@ * FILE: pdo.c * PURPOSE: PDO-specific code * PROGRAMMERS: Cameron Gutman (cameron.gutman(a)reactos.org) + * Hervé Poussineau */ #include <isapnp.h>
4 years, 9 months
1
0
0
0
[reactos] 05/07: [ISAPNP] Create resource list ahead of IRP_MN_QUERY_RESOURCES
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=61c1079a18ee2faaf5062…
commit 61c1079a18ee2faaf50621d8caae1ac7d1ddd561 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 21 17:37:45 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Sun Mar 22 14:29:38 2020 +0100 [ISAPNP] Create resource list ahead of IRP_MN_QUERY_RESOURCES --- drivers/bus/isapnp/isapnp.c | 43 +++++++++++++++++++++++++++++++++++++++++++ drivers/bus/isapnp/isapnp.h | 2 ++ drivers/bus/isapnp/pdo.c | 36 ++++++++---------------------------- 3 files changed, 53 insertions(+), 28 deletions(-) diff --git a/drivers/bus/isapnp/isapnp.c b/drivers/bus/isapnp/isapnp.c index c9025875ddc..6f22efcd014 100644 --- a/drivers/bus/isapnp/isapnp.c +++ b/drivers/bus/isapnp/isapnp.c @@ -379,6 +379,45 @@ IsaPnpCreateReadPortDORequirements( return STATUS_SUCCESS; } +static +NTSTATUS +NTAPI +IsaPnpCreateReadPortDOResources( + IN PISAPNP_PDO_EXTENSION PdoExt) +{ + USHORT Ports[] = { ISAPNP_WRITE_DATA, ISAPNP_ADDRESS }; + ULONG ListSize, i; + PCM_RESOURCE_LIST ResourceList; + PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor; + + ListSize = sizeof(CM_RESOURCE_LIST) + + (ARRAYSIZE(Ports) - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); + ResourceList = ExAllocatePool(PagedPool, ListSize); + if (!ResourceList) + return STATUS_NO_MEMORY; + + RtlZeroMemory(ResourceList, ListSize); + ResourceList->Count = 1; + ResourceList->List[0].InterfaceType = Internal; + ResourceList->List[0].PartialResourceList.Version = 1; + ResourceList->List[0].PartialResourceList.Revision = 1; + ResourceList->List[0].PartialResourceList.Count = 2; + + for (i = 0; i < ARRAYSIZE(Ports); i++) + { + Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[i]; + Descriptor->Type = CmResourceTypePort; + Descriptor->ShareDisposition = CmResourceShareDeviceExclusive; + Descriptor->Flags = CM_RESOURCE_PORT_16_BIT_DECODE; + Descriptor->u.Port.Length = 0x01; + Descriptor->u.Port.Start.LowPart = Ports[i]; + } + + PdoExt->ResourceList = ResourceList; + PdoExt->ResourceListSize = ListSize; + return STATUS_SUCCESS; +} + static NTSTATUS NTAPI @@ -435,6 +474,10 @@ IsaPnpCreateReadPortDO(PISAPNP_FDO_EXTENSION FdoExt) if (!NT_SUCCESS(Status)) return Status; + Status = IsaPnpCreateReadPortDOResources(PdoExt); + if (!NT_SUCCESS(Status)) + return Status; + return Status; } diff --git a/drivers/bus/isapnp/isapnp.h b/drivers/bus/isapnp/isapnp.h index 2d45ce6cac7..416ed2df55f 100644 --- a/drivers/bus/isapnp/isapnp.h +++ b/drivers/bus/isapnp/isapnp.h @@ -54,6 +54,8 @@ typedef struct _ISAPNP_PDO_EXTENSION { UNICODE_STRING CompatibleIDs; UNICODE_STRING InstanceID; PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList; + PCM_RESOURCE_LIST ResourceList; + ULONG ResourceListSize; } ISAPNP_PDO_EXTENSION, *PISAPNP_PDO_EXTENSION; /* isapnp.c */ diff --git a/drivers/bus/isapnp/pdo.c b/drivers/bus/isapnp/pdo.c index cecb3d2000f..d4a34cf78ec 100644 --- a/drivers/bus/isapnp/pdo.c +++ b/drivers/bus/isapnp/pdo.c @@ -6,7 +6,6 @@ */ #include <isapnp.h> -#include <isapnphw.h> #define NDEBUG #include <debug.h> @@ -144,34 +143,18 @@ IsaPdoQueryResources( IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp) { - USHORT Ports[] = { ISAPNP_WRITE_DATA, ISAPNP_ADDRESS }; - ULONG ListSize, i; + ULONG ListSize; PCM_RESOURCE_LIST ResourceList; - PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor; - ListSize = sizeof(CM_RESOURCE_LIST) - + (ARRAYSIZE(Ports) - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); - ResourceList = ExAllocatePool(NonPagedPool, ListSize); + if (!PdoExt->ResourceList) + return Irp->IoStatus.Status; + + ListSize = PdoExt->ResourceListSize; + ResourceList = ExAllocatePool(PagedPool, ListSize); if (!ResourceList) return STATUS_NO_MEMORY; - RtlZeroMemory(ResourceList, ListSize); - ResourceList->Count = 1; - ResourceList->List[0].InterfaceType = Internal; - ResourceList->List[0].PartialResourceList.Version = 1; - ResourceList->List[0].PartialResourceList.Revision = 1; - ResourceList->List[0].PartialResourceList.Count = 2; - - for (i = 0; i < ARRAYSIZE(Ports); i++) - { - Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[i]; - Descriptor->Type = CmResourceTypePort; - Descriptor->ShareDisposition = CmResourceShareDeviceExclusive; - Descriptor->Flags = CM_RESOURCE_PORT_16_BIT_DECODE; - Descriptor->u.Port.Length = 0x01; - Descriptor->u.Port.Start.LowPart = Ports[i]; - } - + RtlCopyMemory(ResourceList, PdoExt->ResourceList, ListSize); Irp->IoStatus.Information = (ULONG_PTR)ResourceList; return STATUS_SUCCESS; } @@ -348,10 +331,7 @@ IsaPdoPnp( break; case IRP_MN_QUERY_RESOURCES: - if (PdoExt->Common.Self == PdoExt->FdoExt->DataPortPdo) - Status = IsaPdoQueryResources(PdoExt, Irp, IrpSp); - else - DPRINT1("IRP_MN_QUERY_RESOURCES is UNIMPLEMENTED!\n"); + Status = IsaPdoQueryResources(PdoExt, Irp, IrpSp); break; case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
4 years, 9 months
1
0
0
0
[reactos] 04/07: [ISAPNP] Create resource requirements ahead of IRP_MN_QUERY_RESOURCE_REQUIREMENTS
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=debec8c96ee50336ff5b2…
commit debec8c96ee50336ff5b22ed24821e2c075b5729 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 21 16:58:21 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Sun Mar 22 14:29:38 2020 +0100 [ISAPNP] Create resource requirements ahead of IRP_MN_QUERY_RESOURCE_REQUIREMENTS --- drivers/bus/isapnp/isapnp.c | 55 +++++++++++++++++++++++++++++++++++++++++++++ drivers/bus/isapnp/isapnp.h | 1 + drivers/bus/isapnp/pdo.c | 47 +++++++------------------------------- 3 files changed, 64 insertions(+), 39 deletions(-) diff --git a/drivers/bus/isapnp/isapnp.c b/drivers/bus/isapnp/isapnp.c index 16fd14c489d..c9025875ddc 100644 --- a/drivers/bus/isapnp/isapnp.c +++ b/drivers/bus/isapnp/isapnp.c @@ -6,6 +6,7 @@ */ #include <isapnp.h> +#include <isapnphw.h> #define NDEBUG #include <debug.h> @@ -328,6 +329,56 @@ IsaReadWrite( return STATUS_NOT_SUPPORTED; } +static +NTSTATUS +NTAPI +IsaPnpCreateReadPortDORequirements( + IN PISAPNP_PDO_EXTENSION PdoExt) +{ + USHORT Ports[] = { ISAPNP_WRITE_DATA, ISAPNP_ADDRESS, 0x274, 0x3e4, 0x204, 0x2e4, 0x354, 0x2f4 }; + ULONG ListSize, i; + PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList; + PIO_RESOURCE_DESCRIPTOR Descriptor; + + ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + + 2 * ARRAYSIZE(Ports) * sizeof(IO_RESOURCE_DESCRIPTOR); + RequirementsList = ExAllocatePool(PagedPool, ListSize); + if (!RequirementsList) + return STATUS_NO_MEMORY; + + RtlZeroMemory(RequirementsList, ListSize); + RequirementsList->ListSize = ListSize; + RequirementsList->AlternativeLists = 1; + + RequirementsList->List[0].Version = 1; + RequirementsList->List[0].Revision = 1; + RequirementsList->List[0].Count = 2 * ARRAYSIZE(Ports); + + for (i = 0; i < 2 * ARRAYSIZE(Ports); i += 2) + { + Descriptor = &RequirementsList->List[0].Descriptors[i]; + + /* Expected port */ + Descriptor[0].Type = CmResourceTypePort; + Descriptor[0].ShareDisposition = CmResourceShareDeviceExclusive; + Descriptor[0].Flags = CM_RESOURCE_PORT_16_BIT_DECODE; + Descriptor[0].u.Port.Length = Ports[i / 2] & 1 ? 0x01 : 0x04; + Descriptor[0].u.Port.Alignment = 0x01; + Descriptor[0].u.Port.MinimumAddress.LowPart = Ports[i / 2]; + Descriptor[0].u.Port.MaximumAddress.LowPart = Ports[i / 2] + Descriptor[0].u.Port.Length - 1; + + /* ... but mark it as optional */ + Descriptor[1].Option = IO_RESOURCE_ALTERNATIVE; + Descriptor[1].Type = CmResourceTypePort; + Descriptor[1].ShareDisposition = CmResourceShareDeviceExclusive; + Descriptor[1].Flags = CM_RESOURCE_PORT_16_BIT_DECODE; + Descriptor[1].u.Port.Alignment = 0x01; + } + + PdoExt->RequirementsList = RequirementsList; + return STATUS_SUCCESS; +} + static NTSTATUS NTAPI @@ -380,6 +431,10 @@ IsaPnpCreateReadPortDO(PISAPNP_FDO_EXTENSION FdoExt) if (!NT_SUCCESS(Status)) return Status; + Status = IsaPnpCreateReadPortDORequirements(PdoExt); + if (!NT_SUCCESS(Status)) + return Status; + return Status; } diff --git a/drivers/bus/isapnp/isapnp.h b/drivers/bus/isapnp/isapnp.h index 8417687867b..2d45ce6cac7 100644 --- a/drivers/bus/isapnp/isapnp.h +++ b/drivers/bus/isapnp/isapnp.h @@ -53,6 +53,7 @@ typedef struct _ISAPNP_PDO_EXTENSION { UNICODE_STRING HardwareIDs; UNICODE_STRING CompatibleIDs; UNICODE_STRING InstanceID; + PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList; } ISAPNP_PDO_EXTENSION, *PISAPNP_PDO_EXTENSION; /* isapnp.c */ diff --git a/drivers/bus/isapnp/pdo.c b/drivers/bus/isapnp/pdo.c index 2add8d4a2b3..cecb3d2000f 100644 --- a/drivers/bus/isapnp/pdo.c +++ b/drivers/bus/isapnp/pdo.c @@ -183,46 +183,18 @@ IsaPdoQueryResourceRequirements( IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp) { - USHORT Ports[] = { ISAPNP_WRITE_DATA, ISAPNP_ADDRESS, 0x274, 0x3e4, 0x204, 0x2e4, 0x354, 0x2f4 }; - ULONG ListSize, i; + ULONG ListSize; PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList; - PIO_RESOURCE_DESCRIPTOR Descriptor; - ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) - + 2 * ARRAYSIZE(Ports) * sizeof(IO_RESOURCE_DESCRIPTOR); - RequirementsList = ExAllocatePool(NonPagedPool, ListSize); + if (!PdoExt->RequirementsList) + return Irp->IoStatus.Status; + + ListSize = PdoExt->RequirementsList->ListSize; + RequirementsList = ExAllocatePool(PagedPool, ListSize); if (!RequirementsList) return STATUS_NO_MEMORY; - RtlZeroMemory(RequirementsList, ListSize); - RequirementsList->ListSize = ListSize; - RequirementsList->AlternativeLists = 1; - - RequirementsList->List[0].Version = 1; - RequirementsList->List[0].Revision = 1; - RequirementsList->List[0].Count = 2 * ARRAYSIZE(Ports); - - for (i = 0; i < 2 * ARRAYSIZE(Ports); i += 2) - { - Descriptor = &RequirementsList->List[0].Descriptors[i]; - - /* Expected port */ - Descriptor[0].Type = CmResourceTypePort; - Descriptor[0].ShareDisposition = CmResourceShareDeviceExclusive; - Descriptor[0].Flags = CM_RESOURCE_PORT_16_BIT_DECODE; - Descriptor[0].u.Port.Length = Ports[i / 2] & 1 ? 0x01 : 0x04; - Descriptor[0].u.Port.Alignment = 0x01; - Descriptor[0].u.Port.MinimumAddress.LowPart = Ports[i / 2]; - Descriptor[0].u.Port.MaximumAddress.LowPart = Ports[i / 2] + Descriptor[0].u.Port.Length - 1; - - /* ... but mark it as optional */ - Descriptor[1].Option = IO_RESOURCE_ALTERNATIVE; - Descriptor[1].Type = CmResourceTypePort; - Descriptor[1].ShareDisposition = CmResourceShareDeviceExclusive; - Descriptor[1].Flags = CM_RESOURCE_PORT_16_BIT_DECODE; - Descriptor[1].u.Port.Alignment = 0x01; - } - + RtlCopyMemory(RequirementsList, PdoExt->RequirementsList, ListSize); Irp->IoStatus.Information = (ULONG_PTR)RequirementsList; return STATUS_SUCCESS; } @@ -383,10 +355,7 @@ IsaPdoPnp( break; case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: - if (PdoExt->Common.Self == PdoExt->FdoExt->DataPortPdo) - Status = IsaPdoQueryResourceRequirements(PdoExt, Irp, IrpSp); - else - DPRINT1("IRP_MN_QUERY_RESOURCE_REQUIREMENTS is UNIMPLEMENTED!\n"); + Status = IsaPdoQueryResourceRequirements(PdoExt, Irp, IrpSp); break; case IRP_MN_QUERY_ID:
4 years, 9 months
1
0
0
0
[reactos] 03/07: [ISAPNP] Fix capabilities for devices
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1dcc6f8b94779c52c4836…
commit 1dcc6f8b94779c52c48363ffc7f33ccb573ea599 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 21 14:59:02 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Sun Mar 22 14:29:38 2020 +0100 [ISAPNP] Fix capabilities for devices --- drivers/bus/isapnp/pdo.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/bus/isapnp/pdo.c b/drivers/bus/isapnp/pdo.c index 68e1714cd6f..2add8d4a2b3 100644 --- a/drivers/bus/isapnp/pdo.c +++ b/drivers/bus/isapnp/pdo.c @@ -65,13 +65,14 @@ IsaPdoQueryCapabilities( else { DeviceCapabilities->UniqueID = TRUE; - DeviceCapabilities->SilentInstall = TRUE; DeviceCapabilities->RawDeviceOK = TRUE; - for (i = 0; i < POWER_SYSTEM_MAXIMUM; i++) - DeviceCapabilities->DeviceState[i] = PowerDeviceD3; - DeviceCapabilities->DeviceState[PowerSystemWorking] = PowerDeviceD0; + DeviceCapabilities->SilentInstall = TRUE; } + for (i = 0; i < POWER_SYSTEM_MAXIMUM; i++) + DeviceCapabilities->DeviceState[i] = PowerDeviceD3; + DeviceCapabilities->DeviceState[PowerSystemWorking] = PowerDeviceD0; + return STATUS_SUCCESS; }
4 years, 9 months
1
0
0
0
[reactos] 02/07: [ISAPNP] Return a compatibleIDs only if defined
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=42724f47f841846a00eb5…
commit 42724f47f841846a00eb50a55345b4804e49a70a Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 21 14:58:36 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Sun Mar 22 14:29:38 2020 +0100 [ISAPNP] Return a compatibleIDs only if defined --- drivers/bus/isapnp/isapnp.c | 7 +++++++ drivers/bus/isapnp/isapnp.h | 1 + drivers/bus/isapnp/pdo.c | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/bus/isapnp/isapnp.c b/drivers/bus/isapnp/isapnp.c index 35f5041d904..16fd14c489d 100644 --- a/drivers/bus/isapnp/isapnp.c +++ b/drivers/bus/isapnp/isapnp.c @@ -335,6 +335,7 @@ IsaPnpCreateReadPortDO(PISAPNP_FDO_EXTENSION FdoExt) { UNICODE_STRING DeviceID = RTL_CONSTANT_STRING(L"ISAPNP\\ReadDataPort\0"); UNICODE_STRING HardwareIDs = RTL_CONSTANT_STRING(L"ISAPNP\\ReadDataPort\0\0"); + UNICODE_STRING CompatibleIDs = RTL_CONSTANT_STRING(L"\0\0"); UNICODE_STRING InstanceID = RTL_CONSTANT_STRING(L"0\0"); PISAPNP_PDO_EXTENSION PdoExt; @@ -367,6 +368,12 @@ IsaPnpCreateReadPortDO(PISAPNP_FDO_EXTENSION FdoExt) if (!NT_SUCCESS(Status)) return Status; + Status = IsaPnpDuplicateUnicodeString(0, + &CompatibleIDs, + &PdoExt->CompatibleIDs); + if (!NT_SUCCESS(Status)) + return Status; + Status = IsaPnpDuplicateUnicodeString(0, &InstanceID, &PdoExt->InstanceID); diff --git a/drivers/bus/isapnp/isapnp.h b/drivers/bus/isapnp/isapnp.h index 4a68b5ee11d..8417687867b 100644 --- a/drivers/bus/isapnp/isapnp.h +++ b/drivers/bus/isapnp/isapnp.h @@ -51,6 +51,7 @@ typedef struct _ISAPNP_PDO_EXTENSION { PISAPNP_FDO_EXTENSION FdoExt; UNICODE_STRING DeviceID; UNICODE_STRING HardwareIDs; + UNICODE_STRING CompatibleIDs; UNICODE_STRING InstanceID; } ISAPNP_PDO_EXTENSION, *PISAPNP_PDO_EXTENSION; diff --git a/drivers/bus/isapnp/pdo.c b/drivers/bus/isapnp/pdo.c index 5d601c985ee..68e1714cd6f 100644 --- a/drivers/bus/isapnp/pdo.c +++ b/drivers/bus/isapnp/pdo.c @@ -93,7 +93,6 @@ IsaPdoQueryId( IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp) { - UNICODE_STRING EmptyString = RTL_CONSTANT_STRING(L""); PUNICODE_STRING Source; PWCHAR Buffer; @@ -111,7 +110,7 @@ IsaPdoQueryId( case BusQueryCompatibleIDs: DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryCompatibleIDs\n"); - Source = &EmptyString; + Source = &PdoExt->CompatibleIDs; break; case BusQueryInstanceID: @@ -125,6 +124,9 @@ IsaPdoQueryId( return Irp->IoStatus.Status; } + if (!Source->Buffer) + return Irp->IoStatus.Status; + Buffer = ExAllocatePool(PagedPool, Source->MaximumLength); if (!Buffer) return STATUS_NO_MEMORY;
4 years, 9 months
1
0
0
0
[reactos] 01/07: [ISAPNP] Fix some indentation
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b905c40d2ec7b29119c9d…
commit b905c40d2ec7b29119c9d52086d0b14ac709a701 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Mar 21 13:39:20 2020 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Sun Mar 22 14:29:38 2020 +0100 [ISAPNP] Fix some indentation --- drivers/bus/isapnp/hardware.c | 10 ++--- drivers/bus/isapnp/isapnp.c | 90 +++++++++++++++++++++---------------------- drivers/bus/isapnp/pdo.c | 22 +++++------ 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/drivers/bus/isapnp/hardware.c b/drivers/bus/isapnp/hardware.c index 4a3d49bb1e7..53b71b78abb 100644 --- a/drivers/bus/isapnp/hardware.c +++ b/drivers/bus/isapnp/hardware.c @@ -536,7 +536,7 @@ ProbeIsaPnpBus( NTSTATUS NTAPI IsaHwTryReadDataPort( - IN PUCHAR ReadDataPort) + IN PUCHAR ReadDataPort) { return TryIsolate(ReadDataPort) > 0 ? STATUS_SUCCESS : STATUS_INSUFFICIENT_RESOURCES; } @@ -544,12 +544,12 @@ IsaHwTryReadDataPort( NTSTATUS NTAPI IsaHwActivateDevice( - IN PISAPNP_LOGICAL_DEVICE LogicalDevice) + IN PISAPNP_LOGICAL_DEVICE LogicalDevice) { - DeviceActivation(LogicalDevice, - TRUE); + DeviceActivation(LogicalDevice, + TRUE); - return STATUS_SUCCESS; + return STATUS_SUCCESS; } NTSTATUS diff --git a/drivers/bus/isapnp/isapnp.c b/drivers/bus/isapnp/isapnp.c index 69fbcbb9f3a..35f5041d904 100644 --- a/drivers/bus/isapnp/isapnp.c +++ b/drivers/bus/isapnp/isapnp.c @@ -61,7 +61,7 @@ static NTSTATUS NTAPI IsaFdoCreateDeviceIDs( - IN PISAPNP_PDO_EXTENSION PdoExt) + IN PISAPNP_PDO_EXTENSION PdoExt) { PISAPNP_LOGICAL_DEVICE LogDev = PdoExt->IsaPnpDevice; UNICODE_STRING TempString; @@ -139,9 +139,9 @@ IsaFdoCreateDeviceIDs( NTSTATUS NTAPI IsaPnpFillDeviceRelations( - IN PISAPNP_FDO_EXTENSION FdoExt, - IN PIRP Irp, - IN BOOLEAN IncludeDataPort) + IN PISAPNP_FDO_EXTENSION FdoExt, + IN PIRP Irp, + IN BOOLEAN IncludeDataPort) { PISAPNP_PDO_EXTENSION PdoExt; NTSTATUS Status = STATUS_SUCCESS; @@ -333,47 +333,47 @@ NTSTATUS NTAPI IsaPnpCreateReadPortDO(PISAPNP_FDO_EXTENSION FdoExt) { - UNICODE_STRING DeviceID = RTL_CONSTANT_STRING(L"ISAPNP\\ReadDataPort\0"); - UNICODE_STRING HardwareIDs = RTL_CONSTANT_STRING(L"ISAPNP\\ReadDataPort\0\0"); - UNICODE_STRING InstanceID = RTL_CONSTANT_STRING(L"0\0"); - PISAPNP_PDO_EXTENSION PdoExt; - - NTSTATUS Status; - Status = IoCreateDevice(FdoExt->DriverObject, - sizeof(ISAPNP_PDO_EXTENSION), - NULL, - FILE_DEVICE_CONTROLLER, - FILE_DEVICE_SECURE_OPEN, - FALSE, - &FdoExt->DataPortPdo); - if (!NT_SUCCESS(Status)) - return Status; - PdoExt = (PISAPNP_PDO_EXTENSION)FdoExt->DataPortPdo->DeviceExtension; - RtlZeroMemory(PdoExt, sizeof(ISAPNP_PDO_EXTENSION)); - PdoExt->Common.IsFdo = FALSE; - PdoExt->Common.Self = FdoExt->DataPortPdo; - PdoExt->Common.State = dsStopped; - PdoExt->FdoExt = FdoExt; - - Status = IsaPnpDuplicateUnicodeString(0, - &DeviceID, - &PdoExt->DeviceID); - if (!NT_SUCCESS(Status)) - return Status; - - Status = IsaPnpDuplicateUnicodeString(0, - &HardwareIDs, - &PdoExt->HardwareIDs); - if (!NT_SUCCESS(Status)) - return Status; - - Status = IsaPnpDuplicateUnicodeString(0, - &InstanceID, - &PdoExt->InstanceID); - if (!NT_SUCCESS(Status)) - return Status; - - return Status; + UNICODE_STRING DeviceID = RTL_CONSTANT_STRING(L"ISAPNP\\ReadDataPort\0"); + UNICODE_STRING HardwareIDs = RTL_CONSTANT_STRING(L"ISAPNP\\ReadDataPort\0\0"); + UNICODE_STRING InstanceID = RTL_CONSTANT_STRING(L"0\0"); + PISAPNP_PDO_EXTENSION PdoExt; + + NTSTATUS Status; + Status = IoCreateDevice(FdoExt->DriverObject, + sizeof(ISAPNP_PDO_EXTENSION), + NULL, + FILE_DEVICE_CONTROLLER, + FILE_DEVICE_SECURE_OPEN, + FALSE, + &FdoExt->DataPortPdo); + if (!NT_SUCCESS(Status)) + return Status; + PdoExt = (PISAPNP_PDO_EXTENSION)FdoExt->DataPortPdo->DeviceExtension; + RtlZeroMemory(PdoExt, sizeof(ISAPNP_PDO_EXTENSION)); + PdoExt->Common.IsFdo = FALSE; + PdoExt->Common.Self = FdoExt->DataPortPdo; + PdoExt->Common.State = dsStopped; + PdoExt->FdoExt = FdoExt; + + Status = IsaPnpDuplicateUnicodeString(0, + &DeviceID, + &PdoExt->DeviceID); + if (!NT_SUCCESS(Status)) + return Status; + + Status = IsaPnpDuplicateUnicodeString(0, + &HardwareIDs, + &PdoExt->HardwareIDs); + if (!NT_SUCCESS(Status)) + return Status; + + Status = IsaPnpDuplicateUnicodeString(0, + &InstanceID, + &PdoExt->InstanceID); + if (!NT_SUCCESS(Status)) + return Status; + + return Status; } static diff --git a/drivers/bus/isapnp/pdo.c b/drivers/bus/isapnp/pdo.c index 917ab4d626d..5d601c985ee 100644 --- a/drivers/bus/isapnp/pdo.c +++ b/drivers/bus/isapnp/pdo.c @@ -78,9 +78,9 @@ IsaPdoQueryCapabilities( NTSTATUS NTAPI IsaPdoQueryPnpDeviceState( - IN PISAPNP_PDO_EXTENSION PdoExt, - IN PIRP Irp, - IN PIO_STACK_LOCATION IrpSp) + IN PISAPNP_PDO_EXTENSION PdoExt, + IN PIRP Irp, + IN PIO_STACK_LOCATION IrpSp) { Irp->IoStatus.Information |= PNP_DEVICE_NOT_DISABLEABLE; return STATUS_SUCCESS; @@ -137,9 +137,9 @@ IsaPdoQueryId( NTSTATUS NTAPI IsaPdoQueryResources( - IN PISAPNP_PDO_EXTENSION PdoExt, - IN PIRP Irp, - IN PIO_STACK_LOCATION IrpSp) + IN PISAPNP_PDO_EXTENSION PdoExt, + IN PIRP Irp, + IN PIO_STACK_LOCATION IrpSp) { USHORT Ports[] = { ISAPNP_WRITE_DATA, ISAPNP_ADDRESS }; ULONG ListSize, i; @@ -176,9 +176,9 @@ IsaPdoQueryResources( NTSTATUS NTAPI IsaPdoQueryResourceRequirements( - IN PISAPNP_PDO_EXTENSION PdoExt, - IN PIRP Irp, - IN PIO_STACK_LOCATION IrpSp) + IN PISAPNP_PDO_EXTENSION PdoExt, + IN PIRP Irp, + IN PIO_STACK_LOCATION IrpSp) { USHORT Ports[] = { ISAPNP_WRITE_DATA, ISAPNP_ADDRESS, 0x274, 0x3e4, 0x204, 0x2e4, 0x354, 0x2f4 }; ULONG ListSize, i; @@ -228,8 +228,8 @@ static NTSTATUS NTAPI IsaPdoStartReadPort( - IN PISAPNP_FDO_EXTENSION FdoExt, - IN PIO_STACK_LOCATION IrpSp) + IN PISAPNP_FDO_EXTENSION FdoExt, + IN PIO_STACK_LOCATION IrpSp) { PCM_RESOURCE_LIST ResourceList = IrpSp->Parameters.StartDevice.AllocatedResources; NTSTATUS Status;
4 years, 9 months
1
0
0
0
[reactos] 01/01: [WINSRV] Use DIB section for frame buffer bitmap
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4860aa645ce956fcf8494…
commit 4860aa645ce956fcf8494c151fab6648cef785f2 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Sat Mar 14 18:45:51 2020 +0100 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Mar 22 12:05:05 2020 +0100 [WINSRV] Use DIB section for frame buffer bitmap --- win32ss/user/winsrv/consrv/frontends/gui/conwnd.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c index f79ad141b2c..8770eca88ab 100644 --- a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c +++ b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c @@ -250,7 +250,7 @@ CreateSysMenu(HWND hWnd) if (ptrTab) { *ptrTab = L'\0'; - mii.cch = wcslen(szMenuStringBack); + mii.cch = (UINT)wcslen(szMenuStringBack); SetMenuItemInfoW(hMenu, SC_CLOSE, FALSE, &mii); } @@ -2164,6 +2164,20 @@ GuiConsoleHandleScrollbarMenu(VOID) } */ +HBITMAP +CreateFrameBufferBitmap(HDC hDC, int width, int height) +{ + BITMAPINFO bmi; + ZeroMemory(&bmi, sizeof(BITMAPINFO)); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi.bmiHeader.biWidth = width; + bmi.bmiHeader.biHeight = height; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = GetDeviceCaps(hDC, BITSPIXEL); + bmi.bmiHeader.biCompression = BI_RGB; + return CreateDIBSection(NULL, &bmi, DIB_RGB_COLORS, NULL, NULL, 0); +} + static LRESULT CALLBACK ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -2505,7 +2519,7 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) /* Recreate the framebuffer */ hDC = GetDC(GuiData->hWindow); - hnew = CreateCompatibleBitmap(hDC, Width, Height); + hnew = CreateFrameBufferBitmap(hDC, Width, Height); ReleaseDC(GuiData->hWindow, hDC); hold = SelectObject(GuiData->hMemDC, hnew); if (GuiData->hBitmap)
4 years, 9 months
1
0
0
0
[reactos] 01/01: [STOBJECT] Remove obsolete code and use string resources instead of hard-coded strings
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=01fd69dfe2da6f1473f0b…
commit 01fd69dfe2da6f1473f0bfd9c11b6c74aceeacf1 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Mar 22 11:31:56 2020 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Mar 22 11:32:35 2020 +0100 [STOBJECT] Remove obsolete code and use string resources instead of hard-coded strings --- dll/shellext/stobject/hotplug.cpp | 55 +++++++++------------------------------ 1 file changed, 13 insertions(+), 42 deletions(-) diff --git a/dll/shellext/stobject/hotplug.cpp b/dll/shellext/stobject/hotplug.cpp index 5df143d8454..a57976a9c89 100644 --- a/dll/shellext/stobject/hotplug.cpp +++ b/dll/shellext/stobject/hotplug.cpp @@ -15,12 +15,9 @@ #define DISPLAY_NAME_LEN 40 -//BOOL WINAPI UnregisterDeviceNotification(HDEVNOTIFY Handle); - CSimpleArray<DEVINST> g_devList; -/*static HDEVNOTIFY g_hDevNotify = NULL;*/ +CString g_strHotplugTooltip; static HICON g_hIconHotplug = NULL; -static LPCWSTR g_strTooltip = L"Safely Remove Hardware and Eject Media"; static WCHAR g_strMenuSel[DISPLAY_NAME_LEN]; static BOOL g_IsRemoving = FALSE; @@ -48,14 +45,11 @@ HRESULT EnumHotpluggedDevices(CSimpleArray<DEVINST> &devList) for (int idev = 0; SetupDiEnumDeviceInfo(hdev, idev, &did); idev++) { DWORD dwCapabilities = 0, dwSize = sizeof(dwCapabilities); - WCHAR dispName[DISPLAY_NAME_LEN]; - ULONG ulStatus = 0, ulPnum = 0, ulLength = DISPLAY_NAME_LEN * sizeof(WCHAR); - CONFIGRET cr = CM_Get_DevNode_Status(&ulStatus, &ulPnum, did.DevInst, 0); - if (cr != CR_SUCCESS) - continue; - cr = CM_Get_DevNode_Registry_Property(did.DevInst, CM_DRP_DEVICEDESC, NULL, dispName, &ulLength, 0); + ULONG ulStatus = 0, ulProblem = 0; + CONFIGRET cr = CM_Get_DevNode_Status(&ulStatus, &ulProblem, did.DevInst, 0); if (cr != CR_SUCCESS) continue; + cr = CM_Get_DevNode_Registry_Property(did.DevInst, CM_DRP_CAPABILITIES, NULL, &dwCapabilities, &dwSize, 0); if (cr != CR_SUCCESS) continue; @@ -65,7 +59,7 @@ HRESULT EnumHotpluggedDevices(CSimpleArray<DEVINST> &devList) !(dwCapabilities & CM_DEVCAP_DOCKDEVICE) && !(dwCapabilities & CM_DEVCAP_SURPRISEREMOVALOK) && ((dwCapabilities & CM_DEVCAP_EJECTSUPPORTED) || (ulStatus & DN_DISABLEABLE)) && - !ulPnum) + !ulProblem) { devList.Add(did.DevInst); } @@ -132,13 +126,14 @@ HRESULT STDMETHODCALLTYPE Hotplug_Init(_In_ CSysTray * pSysTray) TRACE("Hotplug_Init\n"); g_hIconHotplug = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_HOTPLUG_OK)); + g_strHotplugTooltip.LoadStringW(IDS_HOTPLUG_REMOVE_1); EnumHotpluggedDevices(g_devList); if (g_devList.GetSize() > 0) - return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_HOTPLUG, g_hIconHotplug, g_strTooltip); + return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_HOTPLUG, g_hIconHotplug, g_strHotplugTooltip); else - return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_HOTPLUG, g_hIconHotplug, g_strTooltip, NIS_HIDDEN); + return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_HOTPLUG, g_hIconHotplug, g_strHotplugTooltip, NIS_HIDDEN); } HRESULT STDMETHODCALLTYPE Hotplug_Update(_In_ CSysTray * pSysTray) @@ -174,12 +169,13 @@ static void _ShowContextMenu(CSysTray * pSysTray) for (INT index = 0; index < g_devList.GetSize(); index++) { - WCHAR dispName[DISPLAY_NAME_LEN], menuName[DISPLAY_NAME_LEN + 10]; + WCHAR dispName[DISPLAY_NAME_LEN]; + CString menuName; CONFIGRET cr = CM_Get_DevNode_Registry_Property(g_devList[index], CM_DRP_DEVICEDESC, NULL, dispName, &ulLength, 0); if (cr != CR_SUCCESS) StrCpyW(dispName, L"Unknown Device"); - swprintf(menuName, L"Eject %wS", dispName); + menuName.Format(IDS_HOTPLUG_REMOVE_3, dispName); AppendMenuW(hPopup, MF_STRING, index+1, menuName); } @@ -253,9 +249,9 @@ HotplugDeviceTimer( EnumHotpluggedDevices(g_devList); if (g_devList.GetSize() > 0) - pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_HOTPLUG, g_hIconHotplug, g_strTooltip); + pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_HOTPLUG, g_hIconHotplug, g_strHotplugTooltip); else - pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_HOTPLUG, g_hIconHotplug, g_strTooltip, NIS_HIDDEN); + pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_HOTPLUG, g_hIconHotplug, g_strHotplugTooltip, NIS_HIDDEN); } @@ -265,22 +261,6 @@ HRESULT STDMETHODCALLTYPE Hotplug_Message(_In_ CSysTray * pSysTray, UINT uMsg, W switch (uMsg) { - /*case WM_CREATE: - TRACE("Hotplug_Message: WM_CREATE\n"); - DEV_BROADCAST_DEVICEINTERFACE NotificationFilter; - - ZeroMemory(&NotificationFilter, sizeof(NotificationFilter)); - NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE); - NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; - - g_hDevNotify = RegisterDeviceNotification(pSysTray->GetHWnd(), &NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES); - if (g_hDevNotify != NULL) - { - lResult = true; - return S_OK; - } - return S_FALSE;*/ - case WM_USER + 220: TRACE("Hotplug_Message: WM_USER+220\n"); if (wParam == HOTPLUG_SERVICE_FLAG) @@ -321,8 +301,6 @@ HRESULT STDMETHODCALLTYPE Hotplug_Message(_In_ CSysTray * pSysTray, UINT uMsg, W break; case ID_ICON_HOTPLUG: - Hotplug_Update(pSysTray); - switch (lParam) { case WM_LBUTTONDOWN: @@ -379,13 +357,6 @@ HRESULT STDMETHODCALLTYPE Hotplug_Message(_In_ CSysTray * pSysTray, UINT uMsg, W } return S_OK; - /*case WM_CLOSE: - if (!UnregisterDeviceNotification(hDeviceNotify)) - { - return S_FALSE; - } - return S_OK;*/ - default: TRACE("Hotplug_Message received for unknown ID %d, ignoring.\n"); return S_FALSE;
4 years, 9 months
1
0
0
0
[reactos] 01/01: [Explorer|Shell32] Fix Build
by jimtabor
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=78098f99e0838d78e9638…
commit 78098f99e0838d78e9638422fccfaaeb7e52a13e Author: jimtabor <james.tabor(a)reactos.org> AuthorDate: Sat Mar 21 19:18:15 2020 -0500 Commit: jimtabor <james.tabor(a)reactos.org> CommitDate: Sat Mar 21 19:18:15 2020 -0500 [Explorer|Shell32] Fix Build Missed a file. See CORE-14439. --- sdk/include/reactos/undocshell.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sdk/include/reactos/undocshell.h b/sdk/include/reactos/undocshell.h index 1927bf26015..3b7c5d6463c 100644 --- a/sdk/include/reactos/undocshell.h +++ b/sdk/include/reactos/undocshell.h @@ -690,6 +690,11 @@ BOOL WINAPI GUIDFromStringW( #define TRAYCMD_SEARCH_FILES 41093 #define TRAYCMD_SEARCH_COMPUTERS 41094 +// Explorer Tray Application Bar Data Message Commands +#define TABDMC_APPBAR 0 +#define TABDMC_NOTIFY 1 +#define TABDMC_LOADINPROC 2 + void WINAPI ShellDDEInit(BOOL bInit); DWORD WINAPI WinList_Init(void);
4 years, 9 months
1
0
0
0
← Newer
1
...
4
5
6
7
8
9
10
...
16
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Results per page:
10
25
50
100
200