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 2017
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
288 discussions
Start a n
N
ew thread
[hbelusca] 74594: [SCSIPORT]: Code formatting in the functions I'm going to touch next (in addition, add few "continue; " inside some loops so that I can reduce the indent level of code blocks).
by hbelusca@svn.reactos.org
Author: hbelusca Date: Fri May 19 14:49:23 2017 New Revision: 74594 URL:
http://svn.reactos.org/svn/reactos?rev=74594&view=rev
Log: [SCSIPORT]: Code formatting in the functions I'm going to touch next (in addition, add few "continue;" inside some loops so that I can reduce the indent level of code blocks). Modified: trunk/reactos/drivers/storage/scsiport/scsiport.c Modified: trunk/reactos/drivers/storage/scsiport/scsiport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/scsiport/s…
============================================================================== --- trunk/reactos/drivers/storage/scsiport/scsiport.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/scsiport/scsiport.c [iso-8859-1] Fri May 19 14:49:23 2017 @@ -3548,7 +3548,7 @@ static NTSTATUS SpiSendInquiry (IN PDEVICE_OBJECT DeviceObject, - IN PSCSI_LUN_INFO LunInfo) + IN PSCSI_LUN_INFO LunInfo) { IO_STATUS_BLOCK IoStatusBlock; PIO_STACK_LOCATION IrpStack; @@ -3569,11 +3569,11 @@ DeviceExtension = (PSCSI_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension; - InquiryBuffer = ExAllocatePoolWithTag (NonPagedPool, INQUIRYDATABUFFERSIZE, TAG_SCSIPORT); + InquiryBuffer = ExAllocatePoolWithTag(NonPagedPool, INQUIRYDATABUFFERSIZE, TAG_SCSIPORT); if (InquiryBuffer == NULL) return STATUS_INSUFFICIENT_RESOURCES; - SenseBuffer = ExAllocatePoolWithTag (NonPagedPool, SENSE_BUFFER_SIZE, TAG_SCSIPORT); + SenseBuffer = ExAllocatePoolWithTag(NonPagedPool, SENSE_BUFFER_SIZE, TAG_SCSIPORT); if (SenseBuffer == NULL) { ExFreePool(InquiryBuffer); @@ -3589,14 +3589,14 @@ /* Create an IRP */ Irp = IoBuildDeviceIoControlRequest(IOCTL_SCSI_EXECUTE_IN, - DeviceObject, - NULL, - 0, - InquiryBuffer, - INQUIRYDATABUFFERSIZE, - TRUE, - &Event, - &IoStatusBlock); + DeviceObject, + NULL, + 0, + InquiryBuffer, + INQUIRYDATABUFFERSIZE, + TRUE, + &Event, + &IoStatusBlock); if (Irp == NULL) { DPRINT("IoBuildDeviceIoControlRequest() failed\n"); @@ -3640,10 +3640,10 @@ { DPRINT("SpiSendInquiry(): Waiting for the driver to process request...\n"); KeWaitForSingleObject(&Event, - Executive, - KernelMode, - FALSE, - NULL); + Executive, + KernelMode, + FALSE, + NULL); Status = IoStatusBlock.Status; } @@ -3658,84 +3658,85 @@ Status = STATUS_SUCCESS; KeepTrying = FALSE; + continue; + } + + DPRINT("Inquiry SRB failed with SrbStatus 0x%08X\n", Srb.SrbStatus); + + /* Check if the queue is frozen */ + if (Srb.SrbStatus & SRB_STATUS_QUEUE_FROZEN) + { + /* Something weird happened, deal with it (unfreeze the queue) */ + KeepTrying = FALSE; + + DPRINT("SpiSendInquiry(): the queue is frozen at TargetId %d\n", Srb.TargetId); + + LunExtension = SpiGetLunExtension(DeviceExtension, + LunInfo->PathId, + LunInfo->TargetId, + LunInfo->Lun); + + /* Clear frozen flag */ + LunExtension->Flags &= ~LUNEX_FROZEN_QUEUE; + + /* Acquire the spinlock */ + KeAcquireSpinLock(&DeviceExtension->SpinLock, &Irql); + + /* Process the request */ + SpiGetNextRequestFromLun(DeviceObject->DeviceExtension, LunExtension); + + /* SpiGetNextRequestFromLun() releases the spinlock, + so we just lower irql back to what it was before */ + KeLowerIrql(Irql); + } + + /* Check if data overrun happened */ + if (SRB_STATUS(Srb.SrbStatus) == SRB_STATUS_DATA_OVERRUN) + { + DPRINT("Data overrun at TargetId %d\n", LunInfo->TargetId); + + /* Nothing dramatic, just copy data, but limiting the size */ + RtlCopyMemory(LunInfo->InquiryData, + InquiryBuffer, + (Srb.DataTransferLength > INQUIRYDATABUFFERSIZE) ? + INQUIRYDATABUFFERSIZE : Srb.DataTransferLength); + + Status = STATUS_SUCCESS; + KeepTrying = FALSE; + } + else if ((Srb.SrbStatus & SRB_STATUS_AUTOSENSE_VALID) && + SenseBuffer->SenseKey == SCSI_SENSE_ILLEGAL_REQUEST) + { + /* LUN is not valid, but some device responds there. + Mark it as invalid anyway */ + + Status = STATUS_INVALID_DEVICE_REQUEST; + KeepTrying = FALSE; } else { - DPRINT("Inquiry SRB failed with SrbStatus 0x%08X\n", Srb.SrbStatus); - /* Check if the queue is frozen */ - if (Srb.SrbStatus & SRB_STATUS_QUEUE_FROZEN) + /* Retry a couple of times if no timeout happened */ + if ((RetryCount < 2) && + (SRB_STATUS(Srb.SrbStatus) != SRB_STATUS_NO_DEVICE) && + (SRB_STATUS(Srb.SrbStatus) != SRB_STATUS_SELECTION_TIMEOUT)) { - /* Something weird happened, deal with it (unfreeze the queue) */ - KeepTrying = FALSE; - - DPRINT("SpiSendInquiry(): the queue is frozen at TargetId %d\n", Srb.TargetId); - - LunExtension = SpiGetLunExtension(DeviceExtension, - LunInfo->PathId, - LunInfo->TargetId, - LunInfo->Lun); - - /* Clear frozen flag */ - LunExtension->Flags &= ~LUNEX_FROZEN_QUEUE; - - /* Acquire the spinlock */ - KeAcquireSpinLock(&DeviceExtension->SpinLock, &Irql); - - /* Process the request */ - SpiGetNextRequestFromLun(DeviceObject->DeviceExtension, LunExtension); - - /* SpiGetNextRequestFromLun() releases the spinlock, - so we just lower irql back to what it was before */ - KeLowerIrql(Irql); - } - - /* Check if data overrun happened */ - if (SRB_STATUS(Srb.SrbStatus) == SRB_STATUS_DATA_OVERRUN) - { - DPRINT("Data overrun at TargetId %d\n", LunInfo->TargetId); - /* Nothing dramatic, just copy data, but limiting the size */ - RtlCopyMemory(LunInfo->InquiryData, - InquiryBuffer, - (Srb.DataTransferLength > INQUIRYDATABUFFERSIZE) ? - INQUIRYDATABUFFERSIZE : Srb.DataTransferLength); - - Status = STATUS_SUCCESS; - KeepTrying = FALSE; - } - else if ((Srb.SrbStatus & SRB_STATUS_AUTOSENSE_VALID) && - SenseBuffer->SenseKey == SCSI_SENSE_ILLEGAL_REQUEST) - { - /* LUN is not valid, but some device responds there. - Mark it as invalid anyway */ - - Status = STATUS_INVALID_DEVICE_REQUEST; - KeepTrying = FALSE; + RetryCount++; + KeepTrying = TRUE; } else { - /* Retry a couple of times if no timeout happened */ - if ((RetryCount < 2) && - (SRB_STATUS(Srb.SrbStatus) != SRB_STATUS_NO_DEVICE) && - (SRB_STATUS(Srb.SrbStatus) != SRB_STATUS_SELECTION_TIMEOUT)) + /* That's all, go to exit */ + KeepTrying = FALSE; + + /* Set status according to SRB status */ + if (SRB_STATUS(Srb.SrbStatus) == SRB_STATUS_BAD_FUNCTION || + SRB_STATUS(Srb.SrbStatus) == SRB_STATUS_BAD_SRB_BLOCK_LENGTH) { - RetryCount++; - KeepTrying = TRUE; + Status = STATUS_INVALID_DEVICE_REQUEST; } else { - /* That's all, go to exit */ - KeepTrying = FALSE; - - /* Set status according to SRB status */ - if (SRB_STATUS(Srb.SrbStatus) == SRB_STATUS_BAD_FUNCTION || - SRB_STATUS(Srb.SrbStatus) == SRB_STATUS_BAD_SRB_BLOCK_LENGTH) - { - Status = STATUS_INVALID_DEVICE_REQUEST; - } - else - { - Status = STATUS_IO_DEVICE_ERROR; - } + Status = STATUS_IO_DEVICE_ERROR; } } } @@ -3968,7 +3969,7 @@ static NTSTATUS SpiGetInquiryData(IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, - PIRP Irp) + IN PIRP Irp) { ULONG InquiryDataSize; PSCSI_LUN_INFO LunInfo; @@ -5247,426 +5248,414 @@ } /********************************************************************** - * NAME INTERNAL - * SpiBuildDeviceMap + * NAME INTERNAL + * SpiBuildDeviceMap * * DESCRIPTION - * Builds the registry device map of all device which are attached - * to the given SCSI HBA port. The device map is located at: - * \Registry\Machine\DeviceMap\Scsi + * Builds the registry device map of all device which are attached + * to the given SCSI HBA port. The device map is located at: + * \Registry\Machine\DeviceMap\Scsi * * RUN LEVEL - * PASSIVE_LEVEL + * PASSIVE_LEVEL * * ARGUMENTS - * DeviceExtension - * ... + * DeviceExtension + * ... * - * RegistryPath - * Name of registry driver service key. + * RegistryPath + * Name of registry driver service key. * * RETURNS - * NTSTATUS + * NTSTATUS */ static NTSTATUS -SpiBuildDeviceMap (PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, - PUNICODE_STRING RegistryPath) +SpiBuildDeviceMap(IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, + IN PUNICODE_STRING RegistryPath) { - PSCSI_PORT_LUN_EXTENSION LunExtension; - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING KeyName; - UNICODE_STRING ValueName; - WCHAR NameBuffer[64]; - ULONG Disposition; - HANDLE ScsiKey; - HANDLE ScsiPortKey = NULL; - HANDLE ScsiBusKey = NULL; - HANDLE ScsiInitiatorKey = NULL; - HANDLE ScsiTargetKey = NULL; - HANDLE ScsiLunKey = NULL; - ULONG BusNumber; - ULONG Target; - ULONG CurrentTarget; - ULONG Lun; - PWCHAR DriverName; - ULONG UlongData; - PWCHAR TypeName; - NTSTATUS Status; - - DPRINT("SpiBuildDeviceMap() called\n"); - - if (DeviceExtension == NULL || RegistryPath == NULL) - { - DPRINT1("Invalid parameter\n"); - return(STATUS_INVALID_PARAMETER); - } - - /* Open or create the 'Scsi' subkey */ - RtlInitUnicodeString(&KeyName, - L"\\Registry\\Machine\\Hardware\\DeviceMap\\Scsi"); - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_KERNEL_HANDLE, - 0, - NULL); - Status = ZwCreateKey(&ScsiKey, - KEY_ALL_ACCESS, - &ObjectAttributes, - 0, - NULL, - REG_OPTION_VOLATILE, - &Disposition); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwCreateKey() failed (Status %lx)\n", Status); - return(Status); - } - - /* Create new 'Scsi Port X' subkey */ - DPRINT("Scsi Port %lu\n", - DeviceExtension->PortNumber); - - swprintf(NameBuffer, - L"Scsi Port %lu", - DeviceExtension->PortNumber); - RtlInitUnicodeString(&KeyName, - NameBuffer); - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - OBJ_KERNEL_HANDLE, - ScsiKey, - NULL); - Status = ZwCreateKey(&ScsiPortKey, - KEY_ALL_ACCESS, - &ObjectAttributes, - 0, - NULL, - REG_OPTION_VOLATILE, - &Disposition); - ZwClose(ScsiKey); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwCreateKey() failed (Status %lx)\n", Status); - return(Status); - } - - /* - * Create port-specific values - */ - - /* Set 'DMA Enabled' (REG_DWORD) value */ - UlongData = (ULONG)!DeviceExtension->PortCapabilities.AdapterUsesPio; - DPRINT(" DMA Enabled = %s\n", (UlongData) ? "TRUE" : "FALSE"); - RtlInitUnicodeString(&ValueName, - L"DMA Enabled"); - Status = ZwSetValueKey(ScsiPortKey, - &ValueName, - 0, - REG_DWORD, - &UlongData, - sizeof(ULONG)); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwSetValueKey('DMA Enabled') failed (Status %lx)\n", Status); - ZwClose(ScsiPortKey); - return(Status); - } - - /* Set 'Driver' (REG_SZ) value */ - DriverName = wcsrchr(RegistryPath->Buffer, L'\\') + 1; - RtlInitUnicodeString(&ValueName, - L"Driver"); - Status = ZwSetValueKey(ScsiPortKey, - &ValueName, - 0, - REG_SZ, - DriverName, - (ULONG)((wcslen(DriverName) + 1) * sizeof(WCHAR))); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwSetValueKey('Driver') failed (Status %lx)\n", Status); - ZwClose(ScsiPortKey); - return(Status); - } - - /* Set 'Interrupt' (REG_DWORD) value (NT4 only) */ - UlongData = (ULONG)DeviceExtension->PortConfig->BusInterruptLevel; - DPRINT(" Interrupt = %lu\n", UlongData); - RtlInitUnicodeString(&ValueName, - L"Interrupt"); - Status = ZwSetValueKey(ScsiPortKey, - &ValueName, - 0, - REG_DWORD, - &UlongData, - sizeof(ULONG)); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwSetValueKey('Interrupt') failed (Status %lx)\n", Status); - ZwClose(ScsiPortKey); - return(Status); - } - - /* Set 'IOAddress' (REG_DWORD) value (NT4 only) */ - UlongData = ScsiPortConvertPhysicalAddressToUlong((*DeviceExtension->PortConfig->AccessRanges)[0].RangeStart); - DPRINT(" IOAddress = %lx\n", UlongData); - RtlInitUnicodeString(&ValueName, - L"IOAddress"); - Status = ZwSetValueKey(ScsiPortKey, - &ValueName, - 0, - REG_DWORD, - &UlongData, - sizeof(ULONG)); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwSetValueKey('IOAddress') failed (Status %lx)\n", Status); - ZwClose(ScsiPortKey); - return(Status); - } - - /* Enumerate buses */ - for (BusNumber = 0; BusNumber < DeviceExtension->PortConfig->NumberOfBuses; BusNumber++) - { - /* Create 'Scsi Bus X' key */ - DPRINT(" Scsi Bus %lu\n", BusNumber); - swprintf(NameBuffer, - L"Scsi Bus %lu", - BusNumber); - RtlInitUnicodeString(&KeyName, - NameBuffer); - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - 0, - ScsiPortKey, - NULL); - Status = ZwCreateKey(&ScsiBusKey, - KEY_ALL_ACCESS, - &ObjectAttributes, - 0, - NULL, - REG_OPTION_VOLATILE, - &Disposition); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwCreateKey() failed (Status %lx)\n", Status); - goto ByeBye; - } - - /* Create 'Initiator Id X' key */ - DPRINT(" Initiator Id %u\n", - DeviceExtension->PortConfig->InitiatorBusId[BusNumber]); - swprintf(NameBuffer, - L"Initiator Id %u", - (unsigned int)(UCHAR)DeviceExtension->PortConfig->InitiatorBusId[BusNumber]); - RtlInitUnicodeString(&KeyName, - NameBuffer); - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - 0, - ScsiBusKey, - NULL); - Status = ZwCreateKey(&ScsiInitiatorKey, - KEY_ALL_ACCESS, - &ObjectAttributes, - 0, - NULL, - REG_OPTION_VOLATILE, - &Disposition); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwCreateKey() failed (Status %lx)\n", Status); - goto ByeBye; - } - - /* FIXME: Are there any initiator values (??) */ - - ZwClose(ScsiInitiatorKey); - ScsiInitiatorKey = NULL; - - - /* Enumerate targets */ - CurrentTarget = (ULONG)-1; - ScsiTargetKey = NULL; - for (Target = 0; Target < DeviceExtension->PortConfig->MaximumNumberOfTargets; Target++) - { - for (Lun = 0; Lun < SCSI_MAXIMUM_LOGICAL_UNITS; Lun++) - { - LunExtension = SpiGetLunExtension(DeviceExtension, - (UCHAR)BusNumber, - (UCHAR)Target, - (UCHAR)Lun); - if (LunExtension != NULL) - { - if (Target != CurrentTarget) - { - /* Close old target key */ - if (ScsiTargetKey != NULL) - { - ZwClose(ScsiTargetKey); - ScsiTargetKey = NULL; - } - - /* Create 'Target Id X' key */ - DPRINT(" Target Id %lu\n", Target); - swprintf(NameBuffer, - L"Target Id %lu", - Target); - RtlInitUnicodeString(&KeyName, - NameBuffer); - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - 0, - ScsiBusKey, - NULL); - Status = ZwCreateKey(&ScsiTargetKey, - KEY_ALL_ACCESS, - &ObjectAttributes, - 0, - NULL, - REG_OPTION_VOLATILE, - &Disposition); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwCreateKey() failed (Status %lx)\n", Status); - goto ByeBye; - } - - CurrentTarget = Target; - } - - /* Create 'Logical Unit Id X' key */ - DPRINT(" Logical Unit Id %lu\n", Lun); - swprintf(NameBuffer, - L"Logical Unit Id %lu", - Lun); - RtlInitUnicodeString(&KeyName, - NameBuffer); - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - 0, - ScsiTargetKey, - NULL); - Status = ZwCreateKey(&ScsiLunKey, - KEY_ALL_ACCESS, - &ObjectAttributes, - 0, - NULL, - REG_OPTION_VOLATILE, - &Disposition); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwCreateKey() failed (Status %lx)\n", Status); - goto ByeBye; - } - - /* Set 'Identifier' (REG_SZ) value */ - swprintf(NameBuffer, - L"%.8S%.16S%.4S", - LunExtension->InquiryData.VendorId, - LunExtension->InquiryData.ProductId, - LunExtension->InquiryData.ProductRevisionLevel); - DPRINT(" Identifier = '%S'\n", NameBuffer); - RtlInitUnicodeString(&ValueName, - L"Identifier"); - Status = ZwSetValueKey(ScsiLunKey, - &ValueName, - 0, - REG_SZ, - NameBuffer, - (ULONG)((wcslen(NameBuffer) + 1) * sizeof(WCHAR))); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwSetValueKey('Identifier') failed (Status %lx)\n", Status); - goto ByeBye; - } - - /* Set 'Type' (REG_SZ) value */ - switch (LunExtension->InquiryData.DeviceType) - { - case 0: - TypeName = L"DiskPeripheral"; - break; - case 1: - TypeName = L"TapePeripheral"; - break; - case 2: - TypeName = L"PrinterPeripheral"; - break; - case 4: - TypeName = L"WormPeripheral"; - break; - case 5: - TypeName = L"CdRomPeripheral"; - break; - case 6: - TypeName = L"ScannerPeripheral"; - break; - case 7: - TypeName = L"OpticalDiskPeripheral"; - break; - case 8: - TypeName = L"MediumChangerPeripheral"; - break; - case 9: - TypeName = L"CommunicationPeripheral"; - break; - default: - TypeName = L"OtherPeripheral"; - break; - } - DPRINT(" Type = '%S'\n", TypeName); - RtlInitUnicodeString(&ValueName, - L"Type"); - Status = ZwSetValueKey(ScsiLunKey, - &ValueName, - 0, - REG_SZ, - TypeName, - (ULONG)((wcslen(TypeName) + 1) * sizeof(WCHAR))); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwSetValueKey('Type') failed (Status %lx)\n", Status); - goto ByeBye; - } - - ZwClose(ScsiLunKey); - ScsiLunKey = NULL; - } - } - - /* Close old target key */ - if (ScsiTargetKey != NULL) - { - ZwClose(ScsiTargetKey); - ScsiTargetKey = NULL; - } - } - - ZwClose(ScsiBusKey); - ScsiBusKey = NULL; + PSCSI_PORT_LUN_EXTENSION LunExtension; + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING KeyName; + UNICODE_STRING ValueName; + WCHAR NameBuffer[64]; + ULONG Disposition; + HANDLE ScsiKey; + HANDLE ScsiPortKey = NULL; + HANDLE ScsiBusKey = NULL; + HANDLE ScsiInitiatorKey = NULL; + HANDLE ScsiTargetKey = NULL; + HANDLE ScsiLunKey = NULL; + ULONG BusNumber; + ULONG Target; + ULONG CurrentTarget; + ULONG Lun; + PWCHAR DriverName; + ULONG UlongData; + PWCHAR TypeName; + NTSTATUS Status; + + DPRINT("SpiBuildDeviceMap() called\n"); + + if (DeviceExtension == NULL || RegistryPath == NULL) + { + DPRINT1("Invalid parameter\n"); + return STATUS_INVALID_PARAMETER; + } + + /* Open or create the 'Scsi' subkey */ + RtlInitUnicodeString(&KeyName, + L"\\Registry\\Machine\\Hardware\\DeviceMap\\Scsi"); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_KERNEL_HANDLE, + 0, + NULL); + Status = ZwCreateKey(&ScsiKey, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + REG_OPTION_VOLATILE, + &Disposition); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwCreateKey() failed (Status %lx)\n", Status); + return Status; + } + + /* Create new 'Scsi Port X' subkey */ + DPRINT("Scsi Port %lu\n", DeviceExtension->PortNumber); + + swprintf(NameBuffer, + L"Scsi Port %lu", + DeviceExtension->PortNumber); + RtlInitUnicodeString(&KeyName, NameBuffer); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_KERNEL_HANDLE, + ScsiKey, + NULL); + Status = ZwCreateKey(&ScsiPortKey, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + REG_OPTION_VOLATILE, + &Disposition); + ZwClose(ScsiKey); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwCreateKey() failed (Status %lx)\n", Status); + return Status; + } + + /* + * Create port-specific values + */ + + /* Set 'DMA Enabled' (REG_DWORD) value */ + UlongData = (ULONG)!DeviceExtension->PortCapabilities.AdapterUsesPio; + DPRINT(" DMA Enabled = %s\n", UlongData ? "TRUE" : "FALSE"); + RtlInitUnicodeString(&ValueName, L"DMA Enabled"); + Status = ZwSetValueKey(ScsiPortKey, + &ValueName, + 0, + REG_DWORD, + &UlongData, + sizeof(UlongData)); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwSetValueKey('DMA Enabled') failed (Status %lx)\n", Status); + ZwClose(ScsiPortKey); + return Status; + } + + /* Set 'Driver' (REG_SZ) value */ + DriverName = wcsrchr(RegistryPath->Buffer, L'\\') + 1; + RtlInitUnicodeString(&ValueName, L"Driver"); + Status = ZwSetValueKey(ScsiPortKey, + &ValueName, + 0, + REG_SZ, + DriverName, + (ULONG)((wcslen(DriverName) + 1) * sizeof(WCHAR))); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwSetValueKey('Driver') failed (Status %lx)\n", Status); + ZwClose(ScsiPortKey); + return Status; + } + + /* Set 'Interrupt' (REG_DWORD) value (NT4 only) */ + UlongData = (ULONG)DeviceExtension->PortConfig->BusInterruptLevel; + DPRINT(" Interrupt = %lu\n", UlongData); + RtlInitUnicodeString(&ValueName, L"Interrupt"); + Status = ZwSetValueKey(ScsiPortKey, + &ValueName, + 0, + REG_DWORD, + &UlongData, + sizeof(UlongData)); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwSetValueKey('Interrupt') failed (Status %lx)\n", Status); + ZwClose(ScsiPortKey); + return Status; + } + + /* Set 'IOAddress' (REG_DWORD) value (NT4 only) */ + UlongData = ScsiPortConvertPhysicalAddressToUlong((*DeviceExtension->PortConfig->AccessRanges)[0].RangeStart); + DPRINT(" IOAddress = %lx\n", UlongData); + RtlInitUnicodeString(&ValueName, L"IOAddress"); + Status = ZwSetValueKey(ScsiPortKey, + &ValueName, + 0, + REG_DWORD, + &UlongData, + sizeof(UlongData)); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwSetValueKey('IOAddress') failed (Status %lx)\n", Status); + ZwClose(ScsiPortKey); + return Status; + } + + /* Enumerate buses */ + for (BusNumber = 0; BusNumber < DeviceExtension->PortConfig->NumberOfBuses; BusNumber++) + { + /* Create 'Scsi Bus X' key */ + DPRINT(" Scsi Bus %lu\n", BusNumber); + swprintf(NameBuffer, + L"Scsi Bus %lu", + BusNumber); + RtlInitUnicodeString(&KeyName, NameBuffer); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + 0, + ScsiPortKey, + NULL); + Status = ZwCreateKey(&ScsiBusKey, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + REG_OPTION_VOLATILE, + &Disposition); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwCreateKey() failed (Status %lx)\n", Status); + goto ByeBye; + } + + /* Create 'Initiator Id X' key */ + DPRINT(" Initiator Id %lu\n", + DeviceExtension->PortConfig->InitiatorBusId[BusNumber]); + swprintf(NameBuffer, + L"Initiator Id %lu", + (ULONG)(UCHAR)DeviceExtension->PortConfig->InitiatorBusId[BusNumber]); + RtlInitUnicodeString(&KeyName, NameBuffer); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + 0, + ScsiBusKey, + NULL); + Status = ZwCreateKey(&ScsiInitiatorKey, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + REG_OPTION_VOLATILE, + &Disposition); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwCreateKey() failed (Status %lx)\n", Status); + goto ByeBye; + } + + /* FIXME: Are there any initiator values (??) */ + + ZwClose(ScsiInitiatorKey); + ScsiInitiatorKey = NULL; + + + /* Enumerate targets */ + CurrentTarget = (ULONG)-1; + ScsiTargetKey = NULL; + for (Target = 0; Target < DeviceExtension->PortConfig->MaximumNumberOfTargets; Target++) + { + for (Lun = 0; Lun < SCSI_MAXIMUM_LOGICAL_UNITS; Lun++) + { + LunExtension = SpiGetLunExtension(DeviceExtension, + (UCHAR)BusNumber, + (UCHAR)Target, + (UCHAR)Lun); + if (LunExtension == NULL) + continue; + + if (Target != CurrentTarget) + { + /* Close old target key */ + if (ScsiTargetKey != NULL) + { + ZwClose(ScsiTargetKey); + ScsiTargetKey = NULL; + } + + /* Create 'Target Id X' key */ + DPRINT(" Target Id %lu\n", Target); + swprintf(NameBuffer, + L"Target Id %lu", + Target); + RtlInitUnicodeString(&KeyName, NameBuffer); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + 0, + ScsiBusKey, + NULL); + Status = ZwCreateKey(&ScsiTargetKey, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + REG_OPTION_VOLATILE, + &Disposition); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwCreateKey() failed (Status %lx)\n", Status); + goto ByeBye; + } + + CurrentTarget = Target; + } + + /* Create 'Logical Unit Id X' key */ + DPRINT(" Logical Unit Id %lu\n", Lun); + swprintf(NameBuffer, + L"Logical Unit Id %lu", + Lun); + RtlInitUnicodeString(&KeyName, NameBuffer); + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + 0, + ScsiTargetKey, + NULL); + Status = ZwCreateKey(&ScsiLunKey, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + REG_OPTION_VOLATILE, + &Disposition); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwCreateKey() failed (Status %lx)\n", Status); + goto ByeBye; + } + + /* Set 'Identifier' (REG_SZ) value */ + swprintf(NameBuffer, + L"%.8S%.16S%.4S", + LunExtension->InquiryData.VendorId, + LunExtension->InquiryData.ProductId, + LunExtension->InquiryData.ProductRevisionLevel); + DPRINT(" Identifier = '%S'\n", NameBuffer); + RtlInitUnicodeString(&ValueName, L"Identifier"); + Status = ZwSetValueKey(ScsiLunKey, + &ValueName, + 0, + REG_SZ, + NameBuffer, + (ULONG)((wcslen(NameBuffer) + 1) * sizeof(WCHAR))); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwSetValueKey('Identifier') failed (Status %lx)\n", Status); + goto ByeBye; + } + + /* Set 'Type' (REG_SZ) value */ + switch (LunExtension->InquiryData.DeviceType) + { + case 0: + TypeName = L"DiskPeripheral"; + break; + case 1: + TypeName = L"TapePeripheral"; + break; + case 2: + TypeName = L"PrinterPeripheral"; + break; + case 4: + TypeName = L"WormPeripheral"; + break; + case 5: + TypeName = L"CdRomPeripheral"; + break; + case 6: + TypeName = L"ScannerPeripheral"; + break; + case 7: + TypeName = L"OpticalDiskPeripheral"; + break; + case 8: + TypeName = L"MediumChangerPeripheral"; + break; + case 9: + TypeName = L"CommunicationPeripheral"; + break; + default: + TypeName = L"OtherPeripheral"; + break; + } + DPRINT(" Type = '%S'\n", TypeName); + RtlInitUnicodeString(&ValueName, L"Type"); + Status = ZwSetValueKey(ScsiLunKey, + &ValueName, + 0, + REG_SZ, + TypeName, + (ULONG)((wcslen(TypeName) + 1) * sizeof(WCHAR))); + if (!NT_SUCCESS(Status)) + { + DPRINT("ZwSetValueKey('Type') failed (Status %lx)\n", Status); + goto ByeBye; + } + + ZwClose(ScsiLunKey); + ScsiLunKey = NULL; + } + + /* Close old target key */ + if (ScsiTargetKey != NULL) + { + ZwClose(ScsiTargetKey); + ScsiTargetKey = NULL; + } + } + + ZwClose(ScsiBusKey); + ScsiBusKey = NULL; } ByeBye: - if (ScsiLunKey != NULL) - ZwClose (ScsiLunKey); - - if (ScsiInitiatorKey != NULL) - ZwClose (ScsiInitiatorKey); - - if (ScsiTargetKey != NULL) - ZwClose (ScsiTargetKey); - - if (ScsiBusKey != NULL) - ZwClose (ScsiBusKey); - - if (ScsiPortKey != NULL) - ZwClose (ScsiPortKey); - - DPRINT("SpiBuildDeviceMap() done\n"); - - return Status; + if (ScsiLunKey != NULL) + ZwClose(ScsiLunKey); + + if (ScsiInitiatorKey != NULL) + ZwClose(ScsiInitiatorKey); + + if (ScsiTargetKey != NULL) + ZwClose(ScsiTargetKey); + + if (ScsiBusKey != NULL) + ZwClose(ScsiBusKey); + + if (ScsiPortKey != NULL) + ZwClose(ScsiPortKey); + + DPRINT("SpiBuildDeviceMap() done\n"); + + return Status; } VOID
7 years, 7 months
1
0
0
0
[gadamopoulos] 74593: [UXTHEME] -Use and RTL handle table for HTHEME handles. In this way we can ensure that a value we take is valid even if it is non NULL. We can also detect leaks.
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri May 19 11:02:44 2017 New Revision: 74593 URL:
http://svn.reactos.org/svn/reactos?rev=74593&view=rev
Log: [UXTHEME] -Use and RTL handle table for HTHEME handles. In this way we can ensure that a value we take is valid even if it is non NULL. We can also detect leaks. Modified: trunk/reactos/dll/win32/uxtheme/draw.c trunk/reactos/dll/win32/uxtheme/metric.c trunk/reactos/dll/win32/uxtheme/msstyles.c trunk/reactos/dll/win32/uxtheme/property.c trunk/reactos/dll/win32/uxtheme/system.c trunk/reactos/dll/win32/uxtheme/uxthemep.h Modified: trunk/reactos/dll/win32/uxtheme/draw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/draw.c?r…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/draw.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/draw.c [iso-8859-1] Fri May 19 11:02:44 2017 @@ -146,16 +146,19 @@ */ static PTHEME_PROPERTY UXTHEME_SelectImage(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, BOOL glyph) { + PTHEME_CLASS pClass; PTHEME_PROPERTY tp; int imageselecttype = IST_NONE; int i; int image; + if(glyph) image = TMT_GLYPHIMAGEFILE; else image = TMT_IMAGEFILE; - if((tp=MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, image))) + pClass = ValidateHandle(hTheme); + if((tp=MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_FILENAME, image))) return tp; GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_IMAGESELECTTYPE, &imageselecttype); @@ -167,19 +170,19 @@ if(SUCCEEDED(GetThemeInt(hTheme, iPartId, iStateId, i + TMT_MINDPI1, &reqdpi))) { if(reqdpi != 0 && screendpi >= reqdpi) { TRACE("Using %d DPI, image %d\n", reqdpi, i + TMT_IMAGEFILE1); - return MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, i + TMT_IMAGEFILE1); + return MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_FILENAME, i + TMT_IMAGEFILE1); } } } /* If an image couldn't be selected, choose the first one */ - return MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE1); + return MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE1); } else if(imageselecttype == IST_SIZE) { POINT size = {pRect->right-pRect->left, pRect->bottom-pRect->top}; POINT reqsize; for(i=4; i>=0; i--) { PTHEME_PROPERTY fileProp = - MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, i + TMT_IMAGEFILE1); + MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_FILENAME, i + TMT_IMAGEFILE1); if (!fileProp) continue; if(FAILED(GetThemePosition(hTheme, iPartId, iStateId, i + TMT_MINSIZE1, &reqsize))) { /* fall back to size of Nth image */ @@ -192,7 +195,7 @@ lstrcpynW(szPath, fileProp->lpValue, min(fileProp->dwValueLen+1, sizeof(szPath)/sizeof(szPath[0]))); - hBmp = MSSTYLES_LoadBitmap(hTheme, szPath, &hasAlpha); + hBmp = MSSTYLES_LoadBitmap(pClass, szPath, &hasAlpha); if(!hBmp) continue; GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_IMAGELAYOUT, &imagelayout); @@ -214,7 +217,7 @@ } } /* If an image couldn't be selected, choose the smallest one */ - return MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE1); + return MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE1); } return NULL; } @@ -232,13 +235,20 @@ int imagenum; BITMAP bmp; WCHAR szPath[MAX_PATH]; - PTHEME_PROPERTY tp = UXTHEME_SelectImage(hTheme, hdc, iPartId, iStateId, pRect, glyph); + PTHEME_PROPERTY tp; + PTHEME_CLASS pClass; + + pClass = ValidateHandle(hTheme); + if (!pClass) + return E_HANDLE; + + tp = UXTHEME_SelectImage(hTheme, hdc, iPartId, iStateId, pRect, glyph); if(!tp) { FIXME("Couldn't determine image for part/state %d/%d, invalid theme?\n", iPartId, iStateId); return E_PROP_ID_UNSUPPORTED; } lstrcpynW(szPath, tp->lpValue, min(tp->dwValueLen+1, sizeof(szPath)/sizeof(szPath[0]))); - *hBmp = MSSTYLES_LoadBitmap(hTheme, szPath, hasImageAlpha); + *hBmp = MSSTYLES_LoadBitmap(pClass, szPath, hasImageAlpha); if(!*hBmp) { TRACE("Failed to load bitmap %s\n", debugstr_w(szPath)); return HRESULT_FROM_WIN32(GetLastError()); Modified: trunk/reactos/dll/win32/uxtheme/metric.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/metric.c…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/metric.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/metric.c [iso-8859-1] Fri May 19 11:02:44 2017 @@ -28,12 +28,11 @@ HRESULT hr; PTHEME_PROPERTY tp; BOOL ret; + PTHEME_CLASS ptc = ValidateHandle(hTheme); TRACE("(%p, %d)\n", hTheme, iBoolID); SetLastError(0); - if(hTheme) { - PTHEME_CLASS ptc = (PTHEME_CLASS) hTheme; - + if(ptc) { if((tp = MSSTYLES_FindMetric(ptc->tf, TMT_BOOL, iBoolID))) { hr = MSSTYLES_GetPropertyBool(tp, &ret); if(SUCCEEDED(hr)) @@ -60,11 +59,11 @@ { HRESULT hr; PTHEME_PROPERTY tp; + PTHEME_CLASS ptc = ValidateHandle(hTheme); TRACE("(%p, %d)\n", hTheme, iColorID); SetLastError(0); - if(hTheme) { - PTHEME_CLASS ptc = (PTHEME_CLASS) hTheme; + if(ptc) { if((tp = MSSTYLES_FindMetric(ptc->tf, TMT_COLOR, iColorID + TMT_FIRSTCOLOR))) { COLORREF color; hr = MSSTYLES_GetPropertyColor(tp, &color); @@ -93,10 +92,10 @@ { HRESULT hr = S_OK; PTHEME_PROPERTY tp; + PTHEME_CLASS ptc = ValidateHandle(hTheme); TRACE("(%p, %d)\n", hTheme, iFontID); - if(hTheme) { - PTHEME_CLASS ptc = (PTHEME_CLASS) hTheme; + if(ptc) { if((tp = MSSTYLES_FindMetric(ptc->tf, TMT_FONT, iFontID))) { HDC hdc = GetDC(NULL); hr = MSSTYLES_GetPropertyFont(tp, hdc, plf); @@ -135,10 +134,10 @@ HRESULT WINAPI GetThemeSysInt(HTHEME hTheme, int iIntID, int *piValue) { PTHEME_PROPERTY tp; - PTHEME_CLASS ptc = (PTHEME_CLASS) hTheme; + PTHEME_CLASS ptc = ValidateHandle(hTheme); TRACE("(%p, %d)\n", hTheme, iIntID); - if(!hTheme) + if(!ptc) return E_HANDLE; if(iIntID < TMT_FIRSTINT || iIntID > TMT_LASTINT) { WARN("Unknown IntID: %d\n", iIntID); @@ -168,10 +167,9 @@ SM_CXMENUSIZE, TMT_MENUBARWIDTH, SM_CYMENUSIZE, TMT_MENUBARHEIGHT }; - - if(hTheme) { - PTHEME_CLASS ptc = (PTHEME_CLASS) hTheme; - + PTHEME_CLASS ptc = ValidateHandle(hTheme); + + if(ptc) { for(i=0; i<sizeof(metricMap)/sizeof(metricMap[0]); i+=2) { if(metricMap[i] == iSizeID) { id = metricMap[i+1]; @@ -208,10 +206,10 @@ LPWSTR pszStringBuff, int cchMaxStringChars) { PTHEME_PROPERTY tp; - PTHEME_CLASS ptc = (PTHEME_CLASS) hTheme; + PTHEME_CLASS ptc = ValidateHandle(hTheme); TRACE("(%p, %d)\n", hTheme, iStringID); - if(!hTheme) + if(!ptc) return E_HANDLE; if(iStringID < TMT_FIRSTSTRING || iStringID > TMT_LASTSTRING) { WARN("Unknown StringID: %d\n", iStringID); Modified: trunk/reactos/dll/win32/uxtheme/msstyles.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/msstyles…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/msstyles.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/msstyles.c [iso-8859-1] Fri May 19 11:02:44 2017 @@ -77,9 +77,6 @@ LPWSTR pszSizes; LPWSTR pszSelectedSize = NULL; LPWSTR tmp; - - if (!gbThemeHooksActive) - return E_FAIL; TRACE("Opening %s\n", debugstr_w(lpThemeFile)); Modified: trunk/reactos/dll/win32/uxtheme/property.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/property…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/property.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/property.c [iso-8859-1] Fri May 19 11:02:44 2017 @@ -27,12 +27,14 @@ int iPropId, BOOL *pfVal) { PTHEME_PROPERTY tp; - - TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); - if(!hTheme) - return E_HANDLE; - - if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_BOOL, iPropId))) + PTHEME_CLASS pClass = ValidateHandle(hTheme); + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + + if(!pClass) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_BOOL, iPropId))) return E_PROP_ID_UNSUPPORTED; return MSSTYLES_GetPropertyBool(tp, pfVal); } @@ -44,12 +46,13 @@ int iPropId, COLORREF *pColor) { PTHEME_PROPERTY tp; - - TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); - if(!hTheme) - return E_HANDLE; - - if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_COLOR, iPropId))) + PTHEME_CLASS pClass = ValidateHandle(hTheme); + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!pClass) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_COLOR, iPropId))) return E_PROP_ID_UNSUPPORTED; return MSSTYLES_GetPropertyColor(tp, pColor); } @@ -63,12 +66,13 @@ HRESULT hr; WCHAR val[60]; PTHEME_PROPERTY tp; - - TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); - if(!hTheme) - return E_HANDLE; - - if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_ENUM, iPropId))) + PTHEME_CLASS pClass = ValidateHandle(hTheme); + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!pClass) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_ENUM, iPropId))) return E_PROP_ID_UNSUPPORTED; hr = MSSTYLES_GetPropertyString(tp, val, sizeof(val)/sizeof(val[0])); @@ -87,12 +91,13 @@ int cchMaxBuffChars) { PTHEME_PROPERTY tp; - - TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); - if(!hTheme) - return E_HANDLE; - - if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId))) + PTHEME_CLASS pClass = ValidateHandle(hTheme); + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!pClass) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_FILENAME, iPropId))) return E_PROP_ID_UNSUPPORTED; return MSSTYLES_GetPropertyString(tp, pszThemeFilename, cchMaxBuffChars); } @@ -104,12 +109,13 @@ int iStateId, int iPropId, LOGFONTW *pFont) { PTHEME_PROPERTY tp; - - TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); - if(!hTheme) - return E_HANDLE; - - if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FONT, iPropId))) + PTHEME_CLASS pClass = ValidateHandle(hTheme); + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!pClass) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_FONT, iPropId))) return E_PROP_ID_UNSUPPORTED; return MSSTYLES_GetPropertyFont(tp, hdc, pFont); } @@ -121,12 +127,13 @@ int iPropId, int *piVal) { PTHEME_PROPERTY tp; - - TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); - if(!hTheme) - return E_HANDLE; - - if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INT, iPropId))) + PTHEME_CLASS pClass = ValidateHandle(hTheme); + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!pClass) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_INT, iPropId))) return E_PROP_ID_UNSUPPORTED; return MSSTYLES_GetPropertyInt(tp, piVal); } @@ -138,12 +145,13 @@ int iPropId, INTLIST *pIntList) { PTHEME_PROPERTY tp; - - TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); - if(!hTheme) - return E_HANDLE; - - if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INTLIST, iPropId))) + PTHEME_CLASS pClass = ValidateHandle(hTheme); + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!pClass) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_INTLIST, iPropId))) return E_PROP_ID_UNSUPPORTED; return MSSTYLES_GetPropertyIntList(tp, pIntList); } @@ -155,12 +163,13 @@ int iPropId, POINT *pPoint) { PTHEME_PROPERTY tp; - - TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); - if(!hTheme) - return E_HANDLE; - - if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_POSITION, iPropId))) + PTHEME_CLASS pClass = ValidateHandle(hTheme); + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!pClass) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_POSITION, iPropId))) return E_PROP_ID_UNSUPPORTED; return MSSTYLES_GetPropertyPosition(tp, pPoint); } @@ -172,12 +181,13 @@ int iPropId, RECT *pRect) { PTHEME_PROPERTY tp; - - TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); - if(!hTheme) - return E_HANDLE; - - if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_RECT, iPropId))) + PTHEME_CLASS pClass = ValidateHandle(hTheme); + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!pClass) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_RECT, iPropId))) return E_PROP_ID_UNSUPPORTED; return MSSTYLES_GetPropertyRect(tp, pRect); } @@ -189,12 +199,13 @@ int iPropId, LPWSTR pszBuff, int cchMaxBuffChars) { PTHEME_PROPERTY tp; - - TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); - if(!hTheme) - return E_HANDLE; - - if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_STRING, iPropId))) + PTHEME_CLASS pClass = ValidateHandle(hTheme); + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!pClass) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_STRING, iPropId))) return E_PROP_ID_UNSUPPORTED; return MSSTYLES_GetPropertyString(tp, pszBuff, cchMaxBuffChars); } @@ -207,13 +218,14 @@ MARGINS *pMargins) { PTHEME_PROPERTY tp; + PTHEME_CLASS pClass = ValidateHandle(hTheme); TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); memset (pMargins, 0, sizeof (MARGINS)); - if(!hTheme) - return E_HANDLE; - - if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_MARGINS, iPropId))) + if(!pClass) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_MARGINS, iPropId))) return E_PROP_ID_UNSUPPORTED; return MSSTYLES_GetPropertyMargins(tp, prc, pMargins); } @@ -227,13 +239,15 @@ PTHEME_PROPERTY tp; WCHAR val[60]; HRESULT hr; - - TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); - if(!hTheme) - return E_HANDLE; - - if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId))) - return E_PROP_ID_UNSUPPORTED; + PTHEME_CLASS pClass = ValidateHandle(hTheme); + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!pClass) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(pClass, iPartId, iStateId, 0, iPropId))) + return E_PROP_ID_UNSUPPORTED; + switch(tp->iPrimitiveType) { case TMT_POSITION: /* Only the X coord is retrieved */ case TMT_MARGINS: /* Only the cxLeftWidth member is retrieved */ @@ -267,12 +281,13 @@ int iPropId, PROPERTYORIGIN *pOrigin) { PTHEME_PROPERTY tp; - - TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); - if(!hTheme) - return E_HANDLE; - - if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId))) { + PTHEME_CLASS pClass = ValidateHandle(hTheme); + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!pClass) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(pClass, iPartId, iStateId, 0, iPropId))) { *pOrigin = PO_NOTFOUND; return S_OK; } Modified: trunk/reactos/dll/win32/uxtheme/system.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/system.c…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/system.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/system.c [iso-8859-1] Fri May 19 11:02:44 2017 @@ -53,6 +53,9 @@ PTHEME_FILE ActiveThemeFile; +RTL_HANDLE_TABLE g_UxThemeHandleTable; +int g_cHandles; + /***********************************************************************/ static BOOL CALLBACK UXTHEME_broadcast_msg_enumchild (HWND hWnd, LPARAM msg) @@ -189,7 +192,7 @@ WCHAR szCurrentSize[64]; BOOL bThemeActive = FALSE; - if(bLoad == TRUE) + if(bLoad == TRUE && gbThemeHooksActive) { /* Get current theme configuration */ if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) { @@ -582,6 +585,9 @@ atSubIdList = GlobalAddAtomW(szSubIdList); atDialogThemeEnabled = GlobalAddAtomW(szDialogThemeEnabled); atWndContext = GlobalAddAtomW(L"ux_WndContext"); + + RtlInitializeHandleTable(0xFFF, sizeof(UXTHEME_HANDLE), &g_UxThemeHandleTable); + g_cHandles = 0; } /*********************************************************************** @@ -708,6 +714,23 @@ return NULL; } +PTHEME_CLASS ValidateHandle(HTHEME hTheme) +{ + PUXTHEME_HANDLE pHandle; + + if (!gbThemeHooksActive || !hTheme || hTheme == INVALID_HANDLE_VALUE) + return NULL; + + if (!RtlIsValidHandle(&g_UxThemeHandleTable, (PRTL_HANDLE_TABLE_ENTRY)hTheme)) + { + ERR("Invalid handle 0x%x!\n", hTheme); + return NULL; + } + + pHandle = hTheme; + return pHandle->pClass; +} + static HTHEME WINAPI OpenThemeDataInternal(PTHEME_FILE ThemeFile, HWND hwnd, LPCWSTR pszClassList, DWORD flags) { @@ -732,11 +755,31 @@ if(!pszUseClassList) pszUseClassList = pszClassList; - if (pszUseClassList) - { - if (!ThemeFile->classes) - MSSTYLES_ParseThemeIni(ThemeFile); - hTheme = MSSTYLES_OpenThemeClass(ThemeFile, pszAppName, pszUseClassList); + if (pszUseClassList) + { + PTHEME_CLASS pClass; + PUXTHEME_HANDLE pHandle; + + if (!ThemeFile->classes) + MSSTYLES_ParseThemeIni(ThemeFile); + pClass = MSSTYLES_OpenThemeClass(ThemeFile, pszAppName, pszUseClassList); + + if (pClass) + { + pHandle = (PUXTHEME_HANDLE)RtlAllocateHandle(&g_UxThemeHandleTable, NULL); + if (pHandle) + { + g_cHandles++; + TRACE("Created handle 0x%x for class 0x%x, app %S, class %S. Count: %d\n", pHandle, pClass, pszAppName, pszUseClassList, g_cHandles); + pHandle->pClass = pClass; + pHandle->Handle.Flags = RTL_HANDLE_VALID; + hTheme = pHandle; + } + else + { + MSSTYLES_CloseThemeClass(pClass); + } + } } } @@ -894,12 +937,22 @@ */ HRESULT WINAPI CloseThemeData(HTHEME hTheme) { + PUXTHEME_HANDLE pHandle = hTheme; + HRESULT hr; + TRACE("(%p)\n", hTheme); - if(!hTheme || hTheme == INVALID_HANDLE_VALUE) + + if (!RtlIsValidHandle(&g_UxThemeHandleTable, (PRTL_HANDLE_TABLE_ENTRY)hTheme)) return E_HANDLE; - if(IsBadReadPtr (hTheme, sizeof(THEME_CLASS))) /* This check is a hack! */ - return E_HANDLE; - return MSSTYLES_CloseThemeClass(hTheme); + + hr = MSSTYLES_CloseThemeClass(pHandle->pClass); + if (SUCCEEDED(hr)) + { + RtlFreeHandle(&g_UxThemeHandleTable, (PRTL_HANDLE_TABLE_ENTRY)pHandle); + g_cHandles--; + TRACE("Destroying handle 0x%x for class 0x%x. Count: %d\n", pHandle, pHandle->pClass, g_cHandles); + } + return hr; } /*********************************************************************** @@ -911,7 +964,7 @@ POINT ptTest, WORD *pwHitTestCode) { FIXME("%d %d 0x%08x: stub\n", iPartId, iStateId, dwOptions); - if(!hTheme) + if (!ValidateHandle(hTheme)) return E_HANDLE; return E_NOTIMPL; } @@ -921,12 +974,17 @@ */ BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId) { + PTHEME_CLASS pClass; + TRACE("(%p,%d,%d)\n", hTheme, iPartId, iStateId); - if(!hTheme) { + + pClass = ValidateHandle(hTheme); + if (!pClass) + { SetLastError(E_HANDLE); return FALSE; } - if(MSSTYLES_FindPartState(hTheme, iPartId, iStateId, NULL)) + if(MSSTYLES_FindPartState(pClass, iPartId, iStateId, NULL)) return TRUE; return FALSE; } @@ -960,6 +1018,9 @@ TRACE("(%s,%s,%p,%d)\n", debugstr_w(pszThemeName), debugstr_w(pszPropertyName), pszValueBuff, cchMaxValChars); + if (!gbThemeHooksActive) + return E_FAIL; + hr = MSSTYLES_OpenThemeFile(pszThemeName, NULL, NULL, &pt); if(FAILED(hr)) return hr; @@ -1032,6 +1093,10 @@ TRACE("(%s,%s,%s,%p,%d)\n", debugstr_w(pszThemeFileName), debugstr_w(pszColorName), debugstr_w(pszSizeName), hThemeFile, unknown); + + if (!gbThemeHooksActive) + return E_FAIL; + return MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, pszSizeName, (PTHEME_FILE*)hThemeFile); } @@ -1112,6 +1177,9 @@ TRACE("(%s,%p,%d,%p,%d)\n", debugstr_w(pszThemeFileName), pszColorName, dwColorNameLen, pszSizeName, dwSizeNameLen); + + if (!gbThemeHooksActive) + return E_FAIL; hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt); if(FAILED(hr)) return hr; @@ -1231,6 +1299,9 @@ TRACE("(%s,%s,%d)\n", debugstr_w(pszThemeFileName), debugstr_w(pszSizeName), dwColorNum); + if (!gbThemeHooksActive) + return E_FAIL; + hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, pszSizeName, &pt); if(FAILED(hr)) return hr; @@ -1291,6 +1362,9 @@ TRACE("(%s,%s,%d)\n", debugstr_w(pszThemeFileName), debugstr_w(pszColorName), dwSizeNum); + if (!gbThemeHooksActive) + return E_FAIL; + hr = MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, NULL, &pt); if(FAILED(hr)) return hr; @@ -1359,6 +1433,10 @@ PTHEME_FILE pt; HRESULT hr; TRACE("(%s)\n", debugstr_w(pszThemeFileName)); + + if (!gbThemeHooksActive) + return E_FAIL; + hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt); if(FAILED(hr)) return hr; Modified: trunk/reactos/dll/win32/uxtheme/uxthemep.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/uxthemep…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/uxthemep.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/uxthemep.h [iso-8859-1] Fri May 19 11:02:44 2017 @@ -20,6 +20,10 @@ #include <vfwmsgs.h> #include <tmschema.h> +#define NTOS_MODE_USER +#include <ndk/ntndk.h> +#include <ndk/rtltypes.h> + #include <wine/debug.h> WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); @@ -85,6 +89,14 @@ } THEME_FILE, *PTHEME_FILE; typedef struct _UXINI_FILE *PUXINI_FILE; + +typedef struct _UXTHEME_HANDLE +{ + RTL_HANDLE_TABLE_ENTRY Handle; + PTHEME_CLASS pClass; +} UXTHEME_HANDLE, *PUXTHEME_HANDLE; + +PTHEME_CLASS ValidateHandle(HTHEME hTheme); HRESULT UXTHEME_LoadImage(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, BOOL glyph, HBITMAP *hBmp, RECT *bmpRect, BOOL* hasImageAlpha);
7 years, 7 months
1
0
0
0
[gadamopoulos] 74592: [UXTHEME] Greatly reduce the number of times we open the theme data for the non client area. - Implement OTD_NONCLIENT for OpenThemeDataEx and OpenThemeDataFromFile. - Open th...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri May 19 10:01:50 2017 New Revision: 74592 URL:
http://svn.reactos.org/svn/reactos?rev=74592&view=rev
Log: [UXTHEME] Greatly reduce the number of times we open the theme data for the non client area. - Implement OTD_NONCLIENT for OpenThemeDataEx and OpenThemeDataFromFile. - Open the WINDOW or the SCROLLBAR theme classes only when needed. Use OpenThemeDataEx instead of the internal MSSTYLES_OpenThemeClass. Cache the open theme in the WND_DATA for later use. Modified: trunk/reactos/dll/win32/uxtheme/nonclient.c trunk/reactos/dll/win32/uxtheme/system.c trunk/reactos/dll/win32/uxtheme/themehooks.c trunk/reactos/dll/win32/uxtheme/uxthemep.h Modified: trunk/reactos/dll/win32/uxtheme/nonclient.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/nonclien…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/nonclient.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/nonclient.c [iso-8859-1] Fri May 19 10:01:50 2017 @@ -173,8 +173,8 @@ GetWindowInfo(hWnd, &pcontext->wi); pcontext->hWnd = hWnd; pcontext->Active = IsWindowActive(hWnd, pcontext->wi.dwExStyle); - pcontext->theme = MSSTYLES_OpenThemeClass(ActiveThemeFile, NULL, L"WINDOW"); - pcontext->scrolltheme = MSSTYLES_OpenThemeClass(ActiveThemeFile, NULL, L"SCROLLBAR"); + pcontext->theme = GetNCCaptionTheme(hWnd, pcontext->wi.dwStyle); + pcontext->scrolltheme = GetNCScrollbarTheme(hWnd, pcontext->wi.dwStyle); pcontext->CaptionHeight = pcontext->wi.cyWindowBorders; pcontext->CaptionHeight += GetSystemMetrics(pcontext->wi.dwExStyle & WS_EX_TOOLWINDOW ? SM_CYSMCAPTION : SM_CYCAPTION ); @@ -192,9 +192,6 @@ ThemeCleanupDrawContext(PDRAW_CONTEXT pcontext) { ReleaseDC(pcontext->hWnd ,pcontext->hDC); - - CloseThemeData (pcontext->theme); - CloseThemeData (pcontext->scrolltheme); if(pcontext->hRgn != NULL) { @@ -1115,7 +1112,10 @@ /* Paint the window on the preview hDC */ rcCurrent = context.wi.rcWindow; ThemePaintWindow(&context, &rcCurrent, FALSE); + context.hDC = NULL; + CloseThemeData (context.theme); + CloseThemeData (context.scrolltheme); ThemeCleanupDrawContext(&context); /* Cleanup */ Modified: trunk/reactos/dll/win32/uxtheme/system.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/system.c…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/system.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/system.c [iso-8859-1] Fri May 19 10:01:50 2017 @@ -724,9 +724,6 @@ return NULL; } - if(flags) - FIXME("unhandled flags: %x\n", flags); - if (ThemeFile) { pszAppName = UXTHEME_GetWindowProperty(hwnd, atSubAppName, szAppBuff, sizeof(szAppBuff)/sizeof(szAppBuff[0])); @@ -745,7 +742,10 @@ if(IsWindow(hwnd)) { - SetPropW(hwnd, (LPCWSTR)MAKEINTATOM(atWindowTheme), hTheme); + if ((flags & OTD_NONCLIENT) == 0) + { + SetPropW(hwnd, (LPCWSTR)MAKEINTATOM(atWindowTheme), hTheme); + } } else { Modified: trunk/reactos/dll/win32/uxtheme/themehooks.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/themehoo…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/themehooks.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/themehooks.c [iso-8859-1] Fri May 19 10:01:50 2017 @@ -63,18 +63,66 @@ CloseThemeData(GetWindowTheme(hWnd)); DeleteObject(pwndData->hTabBackgroundBrush); - pwndData->hTabBackgroundBrush = NULL; } if (pwndData->hTabBackgroundBmp != NULL) { DeleteObject(pwndData->hTabBackgroundBmp); - pwndData->hTabBackgroundBmp = NULL; + } + + if (pwndData->hthemeWindow) + { + CloseThemeData(pwndData->hthemeWindow); + } + + if (pwndData->hthemeScrollbar) + { + CloseThemeData(pwndData->hthemeScrollbar); } HeapFree(GetProcessHeap(), 0, pwndData); SetPropW( hWnd, (LPCWSTR)MAKEINTATOM(atWndContext), NULL); +} + +HTHEME GetNCCaptionTheme(HWND hWnd, DWORD style) +{ + PWND_DATA pwndData; + + /* We only get the theme for the window class if the window has a caption */ + if((style & WS_CAPTION) != WS_CAPTION) + return NULL; + + /* Get theme data for this window */ + pwndData = ThemeGetWndData(hWnd); + if (pwndData == NULL) + return NULL; + + /* If the theme data was not cached, open it now */ + if (!pwndData->hthemeWindow) + pwndData->hthemeWindow = OpenThemeDataEx(hWnd, L"WINDOW", OTD_NONCLIENT); + + return pwndData->hthemeWindow; +} + +HTHEME GetNCScrollbarTheme(HWND hWnd, DWORD style) +{ + PWND_DATA pwndData; + + /* We only get the theme for the scrollbar class if the window has a scrollbar */ + if((style & (WS_HSCROLL|WS_VSCROLL)) == 0) + return NULL; + + /* Get theme data for this window */ + pwndData = ThemeGetWndData(hWnd); + if (pwndData == NULL) + return NULL; + + /* If the theme data was not cached, open it now */ + if (!pwndData->hthemeScrollbar) + pwndData->hthemeScrollbar = OpenThemeDataEx(hWnd, L"SCROLLBAR", OTD_NONCLIENT); + + return pwndData->hthemeScrollbar; } static BOOL CALLBACK ThemeCleanupChildWndContext (HWND hWnd, LPARAM msg) @@ -130,9 +178,8 @@ rcWindow.top = 0; rcWindow.left = 0; - hTheme = MSSTYLES_OpenThemeClass(ActiveThemeFile, NULL, L"WINDOW"); + hTheme = GetNCCaptionTheme(hWnd, wi.dwStyle); GetThemeBackgroundRegion(hTheme, 0, iPart, FS_ACTIVE, &rcWindow, &hrgn); - CloseThemeData(hTheme); GetWindowRect(hWnd, &rcWindow); rcWindow.right -= rcWindow.left; @@ -259,6 +306,18 @@ { DeleteObject(pwndData->hTabBackgroundBmp); pwndData->hTabBackgroundBmp = NULL; + } + + if (pwndData->hthemeWindow) + { + CloseThemeData(pwndData->hthemeWindow); + pwndData->hthemeWindow = NULL; + } + + if (pwndData->hthemeScrollbar) + { + CloseThemeData(pwndData->hthemeScrollbar); + pwndData->hthemeScrollbar = NULL; } } case WM_NCCREATE: @@ -306,8 +365,12 @@ HBITMAP hbmp; RECT dummy, bmpRect; BOOL hasImageAlpha; - - UXTHEME_LoadImage(theme, 0, TABP_BODY, 0, &dummy, FALSE, &hbmp, &bmpRect, &hasImageAlpha); + HRESULT hr; + + hr = UXTHEME_LoadImage(theme, 0, TABP_BODY, 0, &dummy, FALSE, &hbmp, &bmpRect, &hasImageAlpha); + if (FAILED(hr)) + return hr; + if (changeOrigin) { /* Unfortunately SetBrushOrgEx doesn't work at all */ Modified: trunk/reactos/dll/win32/uxtheme/uxthemep.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/uxthemep…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/uxthemep.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/uxthemep.h [iso-8859-1] Fri May 19 10:01:50 2017 @@ -136,6 +136,9 @@ /* The window context stores data for the window needed through the life of the window */ typedef struct _WND_DATA { + HTHEME hthemeWindow; + HTHEME hthemeScrollbar; + UINT lastHitTest; BOOL HasAppDefinedRgn; BOOL HasThemeRgn; @@ -229,6 +232,8 @@ void ThemeInitDrawContext(PDRAW_CONTEXT pcontext, HWND hWnd, HRGN hRgn); void ThemeCleanupDrawContext(PDRAW_CONTEXT pcontext); PWND_DATA ThemeGetWndData(HWND hWnd); +HTHEME GetNCCaptionTheme(HWND hWnd, DWORD style); +HTHEME GetNCScrollbarTheme(HWND hWnd, DWORD style); extern HINSTANCE hDllInst; extern ATOM atWindowTheme;
7 years, 7 months
1
0
0
0
[gedmurphy] 74591: Forgot to add the cmake changes
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Fri May 19 09:46:41 2017 New Revision: 74591 URL:
http://svn.reactos.org/svn/reactos?rev=74591&view=rev
Log: Forgot to add the cmake changes Modified: trunk/reactos/drivers/filters/fltmgr/CMakeLists.txt Modified: trunk/reactos/drivers/filters/fltmgr/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filters/fltmgr/CMa…
============================================================================== --- trunk/reactos/drivers/filters/fltmgr/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/filters/fltmgr/CMakeLists.txt [iso-8859-1] Fri May 19 09:46:41 2017 @@ -1,10 +1,10 @@ - list(APPEND SOURCE Context.c Dispatch.c Filter.c Interface.c Lib.c + Messaging.c Object.c ${CMAKE_CURRENT_BINARY_DIR}/fltmgr.def fltmgr.h) @@ -22,5 +22,6 @@ set_module_type(fltmgr kernelmodedriver) target_link_libraries(fltmgr ${PSEH_LIB}) add_importlibs(fltmgr ntoskrnl hal) +add_target_compile_definitions(fltmgr NTDDI_VERSION=NTDDI_WS03SP1) add_pch(fltmgr fltmgr.h SOURCE) add_cd_file(TARGET fltmgr DESTINATION reactos/system32/drivers NO_CAB FOR all)
7 years, 7 months
1
0
0
0
[gedmurphy] 74590: [FLTMGR] - Add a rather messy header that I've been slowly building as I'm starting to understand the internals. - Mostly taken from the MS PDBs and info gained from OSR and Alex...
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Fri May 19 09:42:00 2017 New Revision: 74590 URL:
http://svn.reactos.org/svn/reactos?rev=74590&view=rev
Log: [FLTMGR] - Add a rather messy header that I've been slowly building as I'm starting to understand the internals. - Mostly taken from the MS PDBs and info gained from OSR and Alex Carp's blog. (
https://fsfilters.blogspot.co.uk
) Added: trunk/reactos/drivers/filters/fltmgr/fltmgrint.h (with props) Added: trunk/reactos/drivers/filters/fltmgr/fltmgrint.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filters/fltmgr/flt…
============================================================================== --- trunk/reactos/drivers/filters/fltmgr/fltmgrint.h (added) +++ trunk/reactos/drivers/filters/fltmgr/fltmgrint.h [iso-8859-1] Fri May 19 09:42:00 2017 @@ -0,0 +1,284 @@ +#ifndef _FLTMGR_INTERNAL_H +#define _FLTMGR_INTERNAL_H + + +#define MAX_CONTEXT_TYPES 6 + + +typedef enum _FLT_OBJECT_FLAGS +{ + FLT_OBFL_DRAINING = 1, + FLT_OBFL_ZOMBIED = 2, + FLT_OBFL_TYPE_INSTANCE = 0x1000000, + FLT_OBFL_TYPE_FILTER = 0x2000000, + FLT_OBFL_TYPE_VOLUME = 0x4000000 + +} FLT_OBJECT_FLAGS, *PFLT_OBJECT_FLAGS; + +typedef enum _FLT_FILTER_FLAGS +{ + FLTFL_MANDATORY_UNLOAD_IN_PROGRESS = 1, + FLTFL_FILTERING_INITIATED = 2 + +} FLT_FILTER_FLAGS, *PFLT_FILTER_FLAGS; + +typedef struct _FLT_OBJECT // size = 0x14 +{ + volatile FLT_OBJECT_FLAGS Flags; + ULONG PointerCount; + EX_RUNDOWN_REF RundownRef; + LIST_ENTRY PrimaryLink; + +} FLT_OBJECT, *PFLT_OBJECT; + +typedef struct _ALLOCATE_CONTEXT_HEADER +{ + PFLT_FILTER Filter; + PFLT_CONTEXT_CLEANUP_CALLBACK ContextCleanupCallback; + struct _ALLOCATE_CONTEXT_HEADER *Next; + FLT_CONTEXT_TYPE ContextType; + char Flags; + char AllocationType; + +} ALLOCATE_CONTEXT_HEADER, *PALLOCATE_CONTEXT_HEADER; + +typedef struct _FLT_RESOURCE_LIST_HEAD +{ + ERESOURCE rLock; + LIST_ENTRY rList; + ULONG rCount; + +} FLT_RESOURCE_LIST_HEAD, *PFLT_RESOURCE_LIST_HEAD; + +typedef struct _FLT_MUTEX_LIST_HEAD +{ + FAST_MUTEX mLock; + LIST_ENTRY mList; + ULONG mCount; + +} FLT_MUTEX_LIST_HEAD, *PFLT_MUTEX_LIST_HEAD; + +typedef struct _FLT_FILTER // size = 0x120 +{ + FLT_OBJECT Base; + PVOID Frame; //FLTP_FRAME + UNICODE_STRING Name; + UNICODE_STRING DefaultAltitude; + FLT_FILTER_FLAGS Flags; + PDRIVER_OBJECT DriverObject; + FLT_RESOURCE_LIST_HEAD InstanceList; + PVOID VerifierExtension; + PFLT_FILTER_UNLOAD_CALLBACK FilterUnload; + PFLT_INSTANCE_SETUP_CALLBACK InstanceSetup; + PFLT_INSTANCE_QUERY_TEARDOWN_CALLBACK InstanceQueryTeardown; + PFLT_INSTANCE_TEARDOWN_CALLBACK InstanceTeardownStart; + PFLT_INSTANCE_TEARDOWN_CALLBACK InstanceTeardownComplete; + PALLOCATE_CONTEXT_HEADER SupportedContextsListHead; + PALLOCATE_CONTEXT_HEADER SupportedContexts[MAX_CONTEXT_TYPES]; + PVOID PreVolumeMount; + PVOID PostVolumeMount; + PFLT_GENERATE_FILE_NAME GenerateFileName; + PFLT_NORMALIZE_NAME_COMPONENT NormalizeNameComponent; + PFLT_NORMALIZE_CONTEXT_CLEANUP NormalizeContextCleanup; + PFLT_OPERATION_REGISTRATION Operations; + PFLT_FILTER_UNLOAD_CALLBACK OldDriverUnload; + FLT_MUTEX_LIST_HEAD ActiveOpens; + FLT_MUTEX_LIST_HEAD ConnectionList; + FLT_MUTEX_LIST_HEAD PortList; + EX_PUSH_LOCK PortLock; + +} FLT_FILTER, *PFLT_FILTER; + +typedef enum _FLT_yINSTANCE_FLAGS +{ + INSFL_CAN_BE_DETACHED = 0x01, + INSFL_DELETING = 0x02, + INSFL_INITING = 0x04 + +} FLT_INSTANCE_FLAGS, *PFLT_INSTANCE_FLAGS; + +typedef struct _FLT_TYPE +{ + USHORT Signature; + USHORT Size; + +} FLT_TYPE, *PFLT_TYPE; + +typedef struct _FLT_INSTANCE // size = 0x144 (324) +{ + FLT_OBJECT Base; + ULONG OperationRundownRef; + PVOID Volume; //PFLT_VOLUME + PFLT_FILTER Filter; + FLT_INSTANCE_FLAGS Flags; + UNICODE_STRING Altitude; + UNICODE_STRING Name; + LIST_ENTRY FilterLink; + ERESOURCE ContextLock; + PVOID Context; //PCONTEXT_NODE + PVOID TrackCompletionNodes; //PRACK_COMPLETION_NODES + PVOID CallbackNodes[50]; //PCALLBACK_NODE + +} FLT_INSTANCE, *PFLT_INSTANCE; + +//
http://fsfilters.blogspot.co.uk/2010/02/filter-manager-concepts-part-1.html
+typedef struct _FLTP_FRAME +{ + FLT_TYPE Type; + LIST_ENTRY Links; + unsigned int FrameID; + ERESOURCE AltitudeLock; + UNICODE_STRING AltitudeIntervalLow; + UNICODE_STRING AltitudeIntervalHigh; + char LargeIrpCtrlStackSize; + char SmallIrpCtrlStackSize; + FLT_RESOURCE_LIST_HEAD RegisteredFilters; + FLT_RESOURCE_LIST_HEAD AttachedVolumes; + LIST_ENTRY MountingVolumes; + FLT_MUTEX_LIST_HEAD AttachedFileSystems; + FLT_MUTEX_LIST_HEAD ZombiedFltObjectContexts; + ERESOURCE FilterUnloadLock; + FAST_MUTEX DeviceObjectAttachLock; + //FLT_PRCB *Prcb; + void *PrcbPoolToFree; + void *LookasidePoolToFree; + //FLTP_IRPCTRL_STACK_PROFILER IrpCtrlStackProfiler; + NPAGED_LOOKASIDE_LIST SmallIrpCtrlLookasideList; + NPAGED_LOOKASIDE_LIST LargeIrpCtrlLookasideList; + //STATIC_IRP_CONTROL GlobalSIC; + +} FLTP_FRAME, *PFLTP_FRAME; + + +//
http://fsfilters.blogspot.co.uk/2010/02/filter-manager-concepts-part-6.html
+typedef struct _STREAM_LIST_CTRL // size = 0xC8 (200) +{ + FLT_TYPE Type; + FSRTL_PER_STREAM_CONTEXT ContextCtrl; + LIST_ENTRY VolumeLink; + //STREAM_LIST_CTRL_FLAGS Flags; + int UseCount; + ERESOURCE ContextLock; + //CONTEXT_LIST_CTRL StreamContexts; + //CONTEXT_LIST_CTRL StreamHandleContexts; + ERESOURCE NameCacheLock; + LARGE_INTEGER LastRenameCompleted; + //NAME_CACHE_LIST_CTRL NormalizedNameCache; + // NAME_CACHE_LIST_CTRL ShortNameCache; + // NAME_CACHE_LIST_CTRL OpenedNameCache; + int AllNameContextsTemporary; + +} STREAM_LIST_CTRL, *PSTREAM_LIST_CTRL; + + +typedef struct _FLT_SERVER_PORT_OBJECT +{ + LIST_ENTRY FilterLink; + PFLT_CONNECT_NOTIFY ConnectNotify; + PFLT_DISCONNECT_NOTIFY DisconnectNotify; + PFLT_MESSAGE_NOTIFY MessageNotify; + PFLT_FILTER Filter; + PVOID Cookie; + ULONG Flags; + LONG NumberOfConnections; + LONG MaxConnections; + +} FLT_SERVER_PORT_OBJECT, *PFLT_SERVER_PORT_OBJECT; + + +typedef struct _FLT_PORT_OBJECT +{ + LIST_ENTRY FilterLink; + PFLT_SERVER_PORT_OBJECT ServerPort; + PVOID Cookie; + EX_RUNDOWN_REF MsgNotifRundownRef; + FAST_MUTEX Lock; + PVOID MsgQ; // FLT_MESSAGE_WAITER_QUEUE MsgQ; + ULONGLONG MessageId; + KEVENT DisconnectEvent; + BOOLEAN Disconnected; + +} FLT_PORT_OBJECT, *PFLT_PORT_OBJECT; + + + + + +VOID +FltpExInitializeRundownProtection( + _Out_ PEX_RUNDOWN_REF RundownRef +); + +BOOLEAN +FltpExAcquireRundownProtection( + _Inout_ PEX_RUNDOWN_REF RundownRef +); + +BOOLEAN +FltpExReleaseRundownProtection( + _Inout_ PEX_RUNDOWN_REF RundownRef +); + +NTSTATUS +NTAPI +FltpObjectRundownWait( + _Inout_ PEX_RUNDOWN_REF RundownRef +); + +BOOLEAN +FltpExRundownCompleted( + _Inout_ PEX_RUNDOWN_REF RundownRef +); + + +NTSTATUS +FltpGetBaseDeviceObjectName( + _In_ PDEVICE_OBJECT DeviceObject, + _Inout_ PUNICODE_STRING ObjectName +); + +NTSTATUS +FltpGetObjectName( + _In_ PVOID Object, + _Inout_ PUNICODE_STRING ObjectName +); + +ULONG +FltpObjectPointerReference( + _In_ PFLT_OBJECT Object +); + +VOID +FltpObjectPointerDereference( + _In_ PFLT_OBJECT Object +); + +NTSTATUS +FltpReallocateUnicodeString( + _In_ PUNICODE_STRING String, + _In_ SIZE_T NewLength, + _In_ BOOLEAN CopyExisting +); + +VOID +FltpFreeUnicodeString( + _In_ PUNICODE_STRING String +); + + + +NTSTATUS +FltpDeviceControlHandler( + _In_ PDEVICE_OBJECT DeviceObject, + _Inout_ PIRP Irp +); + +NTSTATUS +FltpDispatchHandler( + _In_ PDEVICE_OBJECT DeviceObject, + _Inout_ PIRP Irp +); + + + +#endif /* _FLTMGR_INTERNAL_H */ Propchange: trunk/reactos/drivers/filters/fltmgr/fltmgrint.h ------------------------------------------------------------------------------ svn:eol-style = native
7 years, 7 months
1
0
0
0
[gedmurphy] 74589: [FLTMGR] - Implement FltCreateCommunicationPort, FltCloseCommunicationPort, FltCloseClientPort, and stub FltSendMessage - Add two new object types for the server port and client ...
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Fri May 19 09:37:38 2017 New Revision: 74589 URL:
http://svn.reactos.org/svn/reactos?rev=74589&view=rev
Log: [FLTMGR] - Implement FltCreateCommunicationPort, FltCloseCommunicationPort, FltCloseClientPort, and stub FltSendMessage - Add two new object types for the server port and client ports - Implement object type callbacks for closing and deleting these new ports - Create the comms object and create the symbolic link (FltMgrMsg) to allow usermode to open a handle to the comms layer (aka FilterConnectCommunicationPort) - Although untested, the comms layer objects should be mostly setup, and we should be able to open a connection from usermode. Added: trunk/reactos/drivers/filters/fltmgr/Messaging.c (with props) Modified: trunk/reactos/drivers/filters/fltmgr/fltmgr.h trunk/reactos/drivers/filters/fltmgr/fltmgr.spec Added: trunk/reactos/drivers/filters/fltmgr/Messaging.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filters/fltmgr/Mes…
============================================================================== --- trunk/reactos/drivers/filters/fltmgr/Messaging.c (added) +++ trunk/reactos/drivers/filters/fltmgr/Messaging.c [iso-8859-1] Fri May 19 09:37:38 2017 @@ -0,0 +1,373 @@ +/* +* PROJECT: Filesystem Filter Manager +* LICENSE: GPL - See COPYING in the top level directory +* FILE: drivers/filters/fltmgr/Messaging.c +* PURPOSE: Contains the routines to handle the comms layer +* PROGRAMMERS: Ged Murphy (gedmurphy(a)reactos.org) +*/ + +/* INCLUDES ******************************************************************/ + +#include "fltmgr.h" +#include "fltmgrint.h" + +#define NDEBUG +#include <debug.h> + + +/* DATA *********************************************************************/ + +UNICODE_STRING CommsDeviceName = RTL_CONSTANT_STRING(L"\\FileSystem\\Filters\\FltMgrMsg"); +PDEVICE_OBJECT CommsDeviceObject; + +POBJECT_TYPE ServerPortObjectType; +POBJECT_TYPE ClientPortObjectType; + +static +BOOLEAN +FltpDisconnectPort( + _In_ PFLT_PORT_OBJECT PortObject +); + + + +/* EXPORTED FUNCTIONS ******************************************************/ + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +FLTAPI +FltCreateCommunicationPort(_In_ PFLT_FILTER Filter, + _Outptr_ PFLT_PORT *ServerPort, + _In_ POBJECT_ATTRIBUTES ObjectAttributes, + _In_opt_ PVOID ServerPortCookie, + _In_ PFLT_CONNECT_NOTIFY ConnectNotifyCallback, + _In_ PFLT_DISCONNECT_NOTIFY DisconnectNotifyCallback, + _In_opt_ PFLT_MESSAGE_NOTIFY MessageNotifyCallback, + _In_ LONG MaxConnections) +{ + PFLT_SERVER_PORT_OBJECT PortObject; + NTSTATUS Status; + + /* The caller must allow at least one connection */ + if (MaxConnections == 0) + { + return STATUS_INVALID_PARAMETER; + } + + /* The request must be for a kernel handle */ + if (!(ObjectAttributes->Attributes & OBJ_KERNEL_HANDLE)) + { + return STATUS_INVALID_PARAMETER; + } + + /* + * Get rundown protection on the target to stop the owner + * from unloading whilst this port object is open. It gets + * removed in the FltpServerPortClose callback + */ + Status = FltObjectReference(Filter); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + /* Create our new server port object */ + Status = ObCreateObject(0, + ServerPortObjectType, + ObjectAttributes, + KernelMode, + NULL, + sizeof(FLT_SERVER_PORT_OBJECT), + 0, + 0, + (PVOID *)&PortObject); + if (NT_SUCCESS(Status)) + { + /* Zero out the struct */ + RtlZeroMemory(PortObject, sizeof(FLT_SERVER_PORT_OBJECT)); + + /* Increment the ref count on the target filter */ + FltpObjectPointerReference((PFLT_OBJECT)Filter); + + /* Setup the filter port object */ + PortObject->Filter = Filter; + PortObject->ConnectNotify = ConnectNotifyCallback; + PortObject->DisconnectNotify = DisconnectNotifyCallback; + PortObject->MessageNotify = MessageNotifyCallback; + PortObject->Cookie = ServerPortCookie; + PortObject->MaxConnections = MaxConnections; + + /* Insert the object */ + Status = ObInsertObject(PortObject, + NULL, + STANDARD_RIGHTS_ALL | FILE_READ_DATA, + 0, + NULL, + (PHANDLE)ServerPort); + if (NT_SUCCESS(Status)) + { + /* Lock the connection list */ + ExAcquireFastMutex(&Filter->ConnectionList.mLock); + + /* Add the new port object to the connection list and increment the count */ + InsertTailList(&Filter->ConnectionList.mList, &PortObject->FilterLink); + Filter->ConnectionList.mCount++; + + /* Unlock the connection list*/ + ExReleaseFastMutex(&Filter->ConnectionList.mLock); + } + } + + if (!NT_SUCCESS(Status)) + { + /* Allow the filter to be cleaned up */ + FltObjectDereference(Filter); + } + + return STATUS_NOT_IMPLEMENTED; +} + +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +FLTAPI +FltCloseCommunicationPort(_In_ PFLT_PORT ServerPort) +{ + /* Just close the handle to initiate the cleanup callbacks */ + ZwClose(ServerPort); +} + +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +FLTAPI +FltCloseClientPort(_In_ PFLT_FILTER Filter, + _Inout_ PFLT_PORT *ClientPort) +{ + PFLT_PORT Port; + + /* Protect against the handle being used whilst we're closing it */ + FltAcquirePushLockShared(&Filter->PortLock); + + /* Store the port handle while we have the lock held */ + Port = *ClientPort; + + if (*ClientPort) + { + /* Set the hadle to null */ + *ClientPort = NULL; + } + + /* Unlock the port */ + FltReleasePushLock(&Filter->PortLock); + + if (Port) + { + /* Close the safe handle */ + ZwClose(Port); + } +} + +_Must_inspect_result_ +_IRQL_requires_max_(APC_LEVEL) +NTSTATUS +FLTAPI +FltSendMessage(_In_ PFLT_FILTER Filter, + _In_ PFLT_PORT *ClientPort, + _In_reads_bytes_(SenderBufferLength) PVOID SenderBuffer, + _In_ ULONG SenderBufferLength, + _Out_writes_bytes_opt_(*ReplyLength) PVOID ReplyBuffer, + _Inout_opt_ PULONG ReplyLength, + _In_opt_ PLARGE_INTEGER Timeout) +{ + UNREFERENCED_PARAMETER(Filter); + UNREFERENCED_PARAMETER(ClientPort); + UNREFERENCED_PARAMETER(SenderBuffer); + UNREFERENCED_PARAMETER(SenderBufferLength); + UNREFERENCED_PARAMETER(ReplyBuffer); + UNREFERENCED_PARAMETER(ReplyLength); + UNREFERENCED_PARAMETER(Timeout); + return STATUS_NOT_IMPLEMENTED; +} + +/* INTERNAL FUNCTIONS ******************************************************/ + +VOID +NTAPI +FltpServerPortClose(_In_opt_ PEPROCESS Process, + _In_ PVOID Object, + _In_ ACCESS_MASK GrantedAccess, + _In_ ULONG ProcessHandleCount, + _In_ ULONG SystemHandleCount) +{ + PFLT_SERVER_PORT_OBJECT PortObject; + PFAST_MUTEX Lock; + + /* Cast the object to a server port object */ + PortObject = (PFLT_SERVER_PORT_OBJECT)Object; + + /* Lock the connection list */ + Lock = &PortObject->Filter->ConnectionList.mLock; + ExAcquireFastMutex(Lock); + + /* Remove the server port object from the list */ + RemoveEntryList(&PortObject->FilterLink); + + /* Unlock the connection list */ + ExReleaseFastMutex(Lock); + + /* Remove the rundown protection we added to stop the owner from tearing us down */ + FltObjectDereference(PortObject->Filter); +} + +VOID +NTAPI +FltpServerPortDelete(PVOID Object) +{ + /* Decrement the filter count we added in the create routine */ + PFLT_SERVER_PORT_OBJECT PortObject = (PFLT_SERVER_PORT_OBJECT)Object; + FltpObjectPointerDereference((PFLT_OBJECT)PortObject->Filter); + +} + +VOID +NTAPI +FltpClientPortClose(_In_opt_ PEPROCESS Process, + _In_ PVOID Object, + _In_ ACCESS_MASK GrantedAccess, + _In_ ULONG ProcessHandleCount, + _In_ ULONG SystemHandleCount) +{ + PFLT_PORT_OBJECT PortObject = (PFLT_PORT_OBJECT)Object; + + if (FltpDisconnectPort(PortObject)) + { + InterlockedDecrement(&PortObject->ServerPort->NumberOfConnections); + } +} + +BOOLEAN +FltpDisconnectPort(_In_ PFLT_PORT_OBJECT PortObject) +{ + BOOLEAN Disconnected = FALSE; + + /* Lock the port object while we disconnect it */ + ExAcquireFastMutex(&PortObject->Lock); + + /* Make sure we have a valid connection */ + if (PortObject->Disconnected == FALSE) + { + /* Let any waiters know we're dusconnecing */ + KeSetEvent(&PortObject->DisconnectEvent, 0, 0); + + // cleanup everything in the message queue (PortObject->MsgQ.Csq) + + /* Set the disconnected state to true */ + PortObject->Disconnected = TRUE; + Disconnected = TRUE; + } + + /* Unlock and exit*/ + ExReleaseFastMutex(&PortObject->Lock); + return Disconnected; +} + +VOID +NTAPI +FltpClientPortDelete(PVOID Object) +{ + PFLT_PORT_OBJECT PortObject = (PFLT_PORT_OBJECT)Object; + ObfDereferenceObject(PortObject->ServerPort); +} + + +NTSTATUS +FltpSetupCommunicationObjects(_In_ PDRIVER_OBJECT DriverObject) +{ + OBJECT_TYPE_INITIALIZER ObjectTypeInitializer; + UNICODE_STRING SymLinkName; + UNICODE_STRING Name; + NTSTATUS Status; + + GENERIC_MAPPING Mapping = + { + STANDARD_RIGHTS_READ, + STANDARD_RIGHTS_WRITE, + STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE, + FLT_PORT_ALL_ACCESS + }; + + /* Create the server comms object type */ + RtlZeroMemory(&ObjectTypeInitializer, sizeof(OBJECT_TYPE_INITIALIZER)); + RtlInitUnicodeString(&Name, L"FilterConnectionPort"); + ObjectTypeInitializer.Length = sizeof(OBJECT_TYPE_INITIALIZER); + ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK; + ObjectTypeInitializer.GenericMapping = Mapping; + ObjectTypeInitializer.PoolType = NonPagedPool; + ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(FLT_SERVER_PORT_OBJECT); + ObjectTypeInitializer.ValidAccessMask = GENERIC_ALL; + ObjectTypeInitializer.CloseProcedure = FltpServerPortClose; + ObjectTypeInitializer.DeleteProcedure = FltpServerPortDelete; + Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ServerPortObjectType); + if (!NT_SUCCESS(Status)) return Status; + + /* Create the client comms object type */ + RtlZeroMemory(&ObjectTypeInitializer, sizeof(OBJECT_TYPE_INITIALIZER)); + RtlInitUnicodeString(&Name, L"FilterCommunicationPort"); + ObjectTypeInitializer.Length = sizeof(OBJECT_TYPE_INITIALIZER); + ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK; + ObjectTypeInitializer.GenericMapping = Mapping; + ObjectTypeInitializer.PoolType = NonPagedPool; + ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(FLT_PORT_OBJECT); + ObjectTypeInitializer.ValidAccessMask = GENERIC_ALL; + ObjectTypeInitializer.CloseProcedure = FltpClientPortClose; + ObjectTypeInitializer.DeleteProcedure = FltpClientPortDelete; + Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ClientPortObjectType); + if (!NT_SUCCESS(Status)) + { + goto Quit; + } + + /* Create the device object */ + Status = IoCreateDevice(DriverObject, + 0, + &CommsDeviceName, + FILE_DEVICE_WPD, + 0, + 0, + &CommsDeviceObject); + if (NT_SUCCESS(Status)) + { + /* Setup a symbolic link for the device */ + RtlInitUnicodeString(&SymLinkName, L"\\DosDevices\\FltMgrMsg"); + Status = IoCreateSymbolicLink(&SymLinkName, &CommsDeviceName); + } + +Quit: + if (!NT_SUCCESS(Status)) + { + /* Something went wrong, undo */ + if (CommsDeviceObject) + { + IoDeleteDevice(CommsDeviceObject); + CommsDeviceObject = NULL; + } + if (ClientPortObjectType) + { + ObMakeTemporaryObject(ClientPortObjectType); + ObfDereferenceObject(ClientPortObjectType); + ClientPortObjectType = NULL; + } + + if (ServerPortObjectType) + { + ObMakeTemporaryObject(ServerPortObjectType); + ObfDereferenceObject(ServerPortObjectType); + ServerPortObjectType = NULL; + } + } + + return Status; +} + +/* PRIVATE FUNCTIONS ******************************************************/ + Propchange: trunk/reactos/drivers/filters/fltmgr/Messaging.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/drivers/filters/fltmgr/fltmgr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filters/fltmgr/flt…
============================================================================== --- trunk/reactos/drivers/filters/fltmgr/fltmgr.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filters/fltmgr/fltmgr.h [iso-8859-1] Fri May 19 09:37:38 2017 @@ -1,11 +1,9 @@ #ifndef _FLTMGR_H #define _FLTMGR_H -// Hack - our SDK reports NTDDI_VERSION as 0x05020100 (from _WIN32_WINNT 0x502) -// which doesn't pass the FLT_MGR_BASELINE check in fltkernel.h -#define NTDDI_VERSION NTDDI_WS03SP1 - #include <ntifs.h> +#include <ndk/obfuncs.h> +#include <ndk/exfuncs.h> #include <fltkernel.h> #include <pseh/pseh2.h> Modified: trunk/reactos/drivers/filters/fltmgr/fltmgr.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filters/fltmgr/flt…
============================================================================== --- trunk/reactos/drivers/filters/fltmgr/fltmgr.spec [iso-8859-1] (original) +++ trunk/reactos/drivers/filters/fltmgr/fltmgr.spec [iso-8859-1] Fri May 19 09:37:38 2017 @@ -1,4 +1,5 @@ @ stdcall FltRegisterFilter(ptr ptr ptr) @ stdcall FltUnregisterFilter(ptr) + @ stdcall FltCloseCommunicationPort(ptr)
7 years, 7 months
1
0
0
0
[gedmurphy] 74588: [FLTMGR} - Implement FltAcquirePushLockExclusive, FltAcquirePushLockShared and FltReleasePushLock. Lifted from ntos' internal pushlock routines. - Implement FltpObjectPointerRefe...
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Fri May 19 09:15:35 2017 New Revision: 74588 URL:
http://svn.reactos.org/svn/reactos?rev=74588&view=rev
Log: [FLTMGR} - Implement FltAcquirePushLockExclusive, FltAcquirePushLockShared and FltReleasePushLock. Lifted from ntos' internal pushlock routines. - Implement FltpObjectPointerReference and partially implement FltpObjectPointerDerference Modified: trunk/reactos/drivers/filters/fltmgr/Object.c Modified: trunk/reactos/drivers/filters/fltmgr/Object.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filters/fltmgr/Obj…
============================================================================== --- trunk/reactos/drivers/filters/fltmgr/Object.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filters/fltmgr/Object.c [iso-8859-1] Fri May 19 09:15:35 2017 @@ -20,7 +20,18 @@ /* DATA *********************************************************************/ - +#define ExpChangePushlock(x, y, z) InterlockedCompareExchangePointer((PVOID*)x, (PVOID)y, (PVOID)z) + +// +// Pushlock bits +// +#define EX_PUSH_LOCK_LOCK_V ((ULONG_PTR)0x0) +#define EX_PUSH_LOCK_LOCK ((ULONG_PTR)0x1) +#define EX_PUSH_LOCK_WAITING ((ULONG_PTR)0x2) +#define EX_PUSH_LOCK_WAKING ((ULONG_PTR)0x4) +#define EX_PUSH_LOCK_MULTIPLE_SHARED ((ULONG_PTR)0x8) +#define EX_PUSH_LOCK_SHARE_INC ((ULONG_PTR)0x10) +#define EX_PUSH_LOCK_PTR_BITS ((ULONG_PTR)0xf) /* EXPORTED FUNCTIONS ******************************************************/ @@ -42,6 +53,85 @@ FltObjectDereference(_Inout_ PVOID Object) { FltpExReleaseRundownProtection(&((PFLT_OBJECT)Object)->RundownRef); +} + + +_Acquires_lock_(_Global_critical_region_) +_IRQL_requires_max_(APC_LEVEL) +VOID +FLTAPI +FltAcquirePushLockExclusive(_Inout_ _Requires_lock_not_held_(*_Curr_) _Acquires_lock_(*_Curr_) PEX_PUSH_LOCK PushLock) +{ + KeEnterCriticalRegion(); + + /* Try acquiring the lock */ + if (InterlockedBitTestAndSet((PLONG)PushLock, EX_PUSH_LOCK_LOCK_V)) + { + /* Someone changed it, use the slow path */ + ExfAcquirePushLockExclusive(PushLock); + } + + /* Sanity check */ + FLT_ASSERT(PushLock->Locked); +} + + +_Acquires_lock_(_Global_critical_region_) +_IRQL_requires_max_(APC_LEVEL) +VOID +FLTAPI +FltAcquirePushLockShared(_Inout_ _Requires_lock_not_held_(*_Curr_) _Acquires_lock_(*_Curr_) PEX_PUSH_LOCK PushLock) +{ + EX_PUSH_LOCK NewValue; + + KeEnterCriticalRegion(); + + /* Try acquiring the lock */ + NewValue.Value = EX_PUSH_LOCK_LOCK | EX_PUSH_LOCK_SHARE_INC; + if (ExpChangePushlock(PushLock, NewValue.Ptr, 0)) + { + /* Someone changed it, use the slow path */ + ExfAcquirePushLockShared(PushLock); + } + + /* Sanity checks */ + ASSERT(PushLock->Locked); +} + +_Releases_lock_(_Global_critical_region_) +_IRQL_requires_max_(APC_LEVEL) +VOID +FLTAPI +FltReleasePushLock(_Inout_ _Requires_lock_held_(*_Curr_) _Releases_lock_(*_Curr_) PEX_PUSH_LOCK PushLock) +{ + EX_PUSH_LOCK OldValue = *PushLock; + EX_PUSH_LOCK NewValue; + + /* Sanity checks */ + FLT_ASSERT(OldValue.Locked); + + /* Check if the pushlock is shared */ + if (OldValue.Shared > 1) + { + /* Decrease the share count */ + NewValue.Value = OldValue.Value - EX_PUSH_LOCK_SHARE_INC; + } + else + { + /* Clear the pushlock entirely */ + NewValue.Value = 0; + } + + /* Check if nobody is waiting on us and try clearing the lock here */ + if ((OldValue.Waiting) || + (ExpChangePushlock(PushLock, NewValue.Ptr, OldValue.Ptr) != + OldValue.Ptr)) + { + /* We have waiters, use the long path */ + ExfReleasePushLock(PushLock); + } + + KeLeaveCriticalRegion(); } @@ -157,3 +247,26 @@ return Status; } + +ULONG +FltpObjectPointerReference(_In_ PFLT_OBJECT Object) +{ + PULONG Result; + + /* Store the old count and increment */ + Result = &Object->PointerCount; + InterlockedIncrement((PLONG)&Object->PointerCount); + + /* Return the initial value */ + return *Result; +} + +VOID +FltpObjectPointerDereference(_In_ PFLT_OBJECT Object) +{ + if (!InterlockedDecrement((PLONG)Object->PointerCount)) + { + // Cleanup + FLT_ASSERT(FALSE); + } +}
7 years, 7 months
1
0
0
0
[gadamopoulos] 74587: [UXTHEME] -Rename WND_CONTEXT to WND_DATA to avoid confusion with the DRAW_CONTEXT. The WND_DATA is information valid throughout the life of a window and DRAW_CONTEXT is infor...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri May 19 08:45:49 2017 New Revision: 74587 URL:
http://svn.reactos.org/svn/reactos?rev=74587&view=rev
Log: [UXTHEME] -Rename WND_CONTEXT to WND_DATA to avoid confusion with the DRAW_CONTEXT. The WND_DATA is information valid throughout the life of a window and DRAW_CONTEXT is information throughout a draw operation in the non client area of the window. Modified: trunk/reactos/dll/win32/uxtheme/ncscrollbar.c trunk/reactos/dll/win32/uxtheme/nonclient.c trunk/reactos/dll/win32/uxtheme/themehooks.c trunk/reactos/dll/win32/uxtheme/uxthemep.h Modified: trunk/reactos/dll/win32/uxtheme/ncscrollbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/ncscroll…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/ncscrollbar.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/ncscrollbar.c [iso-8859-1] Fri May 19 08:45:49 2017 @@ -239,9 +239,9 @@ } } -static void SCROLL_DrawMovingThumb(PWND_CONTEXT pwndContext, PDRAW_CONTEXT pcontext, SCROLLBARINFO* psbi, BOOL vertical) -{ - INT pos = pwndContext->SCROLL_TrackingPos; +static void SCROLL_DrawMovingThumb(PWND_DATA pwndData, PDRAW_CONTEXT pcontext, SCROLLBARINFO* psbi, BOOL vertical) +{ + INT pos = pwndData->SCROLL_TrackingPos; INT max_size; if( vertical ) @@ -258,7 +258,7 @@ SCROLL_DrawInterior(pcontext, psbi, pos, vertical, SCROLL_THUMB, 0); - pwndContext->SCROLL_MovingThumb = !pwndContext->SCROLL_MovingThumb; + pwndData->SCROLL_MovingThumb = !pwndData->SCROLL_MovingThumb; } @@ -269,15 +269,15 @@ SCROLLBARINFO sbi; BOOL vertical; enum SCROLL_HITTEST htHot = SCROLL_NOWHERE; - PWND_CONTEXT pwndContext; + PWND_DATA pwndData; if (((nBar == SB_VERT) && !(pcontext->wi.dwStyle & WS_VSCROLL)) || ((nBar == SB_HORZ) && !(pcontext->wi.dwStyle & WS_HSCROLL))) return; - if (!(pwndContext = ThemeGetWndContext(pcontext->hWnd))) + if (!(pwndData = ThemeGetWndData(pcontext->hWnd))) return; - if (pwndContext->SCROLL_TrackingWin) + if (pwndData->SCROLL_TrackingWin) return; /* Retrieve scrollbar info */ @@ -371,7 +371,7 @@ } static void -SCROLL_HandleScrollEvent(PWND_CONTEXT pwndContext, HWND hwnd, INT nBar, UINT msg, POINT pt) +SCROLL_HandleScrollEvent(PWND_DATA pwndData, HWND hwnd, INT nBar, UINT msg, POINT pt) { /* Previous mouse position for timer events */ static POINT prevPt; @@ -401,7 +401,7 @@ return; } - if ((pwndContext->SCROLL_trackHitTest == SCROLL_NOWHERE) && (msg != WM_LBUTTONDOWN)) + if ((pwndData->SCROLL_trackHitTest == SCROLL_NOWHERE) && (msg != WM_LBUTTONDOWN)) return; ThemeInitDrawContext(&context, hwnd, 0); @@ -416,8 +416,8 @@ { case WM_LBUTTONDOWN: /* Initialise mouse tracking */ HideCaret(hwnd); /* hide caret while holding down LBUTTON */ - pwndContext->SCROLL_trackVertical = vertical; - pwndContext->SCROLL_trackHitTest = hittest = SCROLL_HitTest( hwnd, &sbi, vertical, pt, FALSE ); + pwndData->SCROLL_trackVertical = vertical; + pwndData->SCROLL_trackHitTest = hittest = SCROLL_HitTest( hwnd, &sbi, vertical, pt, FALSE ); lastClickPos = vertical ? (pt.y - sbi.rcScrollBar.top) : (pt.x - sbi.rcScrollBar.left); lastMousePos = lastClickPos; trackThumbPos = sbi.xyThumbTop; @@ -450,15 +450,15 @@ //TRACE("Event: hwnd=%p bar=%d msg=%s pt=%d,%d hit=%d\n", // hwnd, nBar, SPY_GetMsgName(msg,hwnd), pt.x, pt.y, hittest ); - switch(pwndContext->SCROLL_trackHitTest) + switch(pwndData->SCROLL_trackHitTest) { case SCROLL_NOWHERE: /* No tracking in progress */ break; case SCROLL_TOP_ARROW: - if (hittest == pwndContext->SCROLL_trackHitTest) - { - SCROLL_DrawArrows( &context, &sbi, vertical, pwndContext->SCROLL_trackHitTest, 0 ); + if (hittest == pwndData->SCROLL_trackHitTest) + { + SCROLL_DrawArrows( &context, &sbi, vertical, pwndData->SCROLL_trackHitTest, 0 ); if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER)) { SendMessageW( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, @@ -477,8 +477,8 @@ break; case SCROLL_TOP_RECT: - SCROLL_DrawInterior( &context, &sbi, sbi.xyThumbTop, vertical, pwndContext->SCROLL_trackHitTest, 0); - if (hittest == pwndContext->SCROLL_trackHitTest) + SCROLL_DrawInterior( &context, &sbi, sbi.xyThumbTop, vertical, pwndData->SCROLL_trackHitTest, 0); + if (hittest == pwndData->SCROLL_trackHitTest) { if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER)) { @@ -494,20 +494,20 @@ case SCROLL_THUMB: if (msg == WM_LBUTTONDOWN) { - pwndContext->SCROLL_TrackingWin = hwnd; - pwndContext->SCROLL_TrackingBar = nBar; - pwndContext->SCROLL_TrackingPos = trackThumbPos + lastMousePos - lastClickPos; - pwndContext->SCROLL_TrackingVal = SCROLL_GetThumbVal( &si, &sbi.rcScrollBar, - vertical, pwndContext->SCROLL_TrackingPos ); - if (!pwndContext->SCROLL_MovingThumb) - SCROLL_DrawMovingThumb(pwndContext, &context, &sbi, vertical); + pwndData->SCROLL_TrackingWin = hwnd; + pwndData->SCROLL_TrackingBar = nBar; + pwndData->SCROLL_TrackingPos = trackThumbPos + lastMousePos - lastClickPos; + pwndData->SCROLL_TrackingVal = SCROLL_GetThumbVal( &si, &sbi.rcScrollBar, + vertical, pwndData->SCROLL_TrackingPos ); + if (!pwndData->SCROLL_MovingThumb) + SCROLL_DrawMovingThumb(pwndData, &context, &sbi, vertical); } else if (msg == WM_LBUTTONUP) { - if (pwndContext->SCROLL_MovingThumb) - SCROLL_DrawMovingThumb(pwndContext, &context, &sbi, vertical); - - SCROLL_DrawInterior( &context, &sbi, sbi.xyThumbTop, vertical, 0, pwndContext->SCROLL_trackHitTest ); + if (pwndData->SCROLL_MovingThumb) + SCROLL_DrawMovingThumb(pwndData, &context, &sbi, vertical); + + SCROLL_DrawInterior( &context, &sbi, sbi.xyThumbTop, vertical, 0, pwndData->SCROLL_trackHitTest ); } else /* WM_MOUSEMOVE */ { @@ -520,28 +520,28 @@ pt = SCROLL_ClipPos( &sbi.rcScrollBar, pt ); pos = vertical ? (pt.y - sbi.rcScrollBar.top) : (pt.x - sbi.rcScrollBar.left); } - if ( (pos != lastMousePos) || (!pwndContext->SCROLL_MovingThumb) ) + if ( (pos != lastMousePos) || (!pwndData->SCROLL_MovingThumb) ) { - if (pwndContext->SCROLL_MovingThumb) - SCROLL_DrawMovingThumb(pwndContext, &context, &sbi, vertical); + if (pwndData->SCROLL_MovingThumb) + SCROLL_DrawMovingThumb(pwndData, &context, &sbi, vertical); lastMousePos = pos; - pwndContext->SCROLL_TrackingPos = trackThumbPos + pos - lastClickPos; - pwndContext->SCROLL_TrackingVal = SCROLL_GetThumbVal( &si, &sbi.rcScrollBar, + pwndData->SCROLL_TrackingPos = trackThumbPos + pos - lastClickPos; + pwndData->SCROLL_TrackingVal = SCROLL_GetThumbVal( &si, &sbi.rcScrollBar, vertical, - pwndContext->SCROLL_TrackingPos ); + pwndData->SCROLL_TrackingPos ); SendMessageW( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, - MAKEWPARAM( SB_THUMBTRACK, pwndContext->SCROLL_TrackingVal), + MAKEWPARAM( SB_THUMBTRACK, pwndData->SCROLL_TrackingVal), (LPARAM)hwndCtl ); - if (!pwndContext->SCROLL_MovingThumb) - SCROLL_DrawMovingThumb(pwndContext, &context, &sbi, vertical); + if (!pwndData->SCROLL_MovingThumb) + SCROLL_DrawMovingThumb(pwndData, &context, &sbi, vertical); } } break; case SCROLL_BOTTOM_RECT: - if (hittest == pwndContext->SCROLL_trackHitTest) - { - SCROLL_DrawInterior( &context, &sbi, sbi.xyThumbTop, vertical, pwndContext->SCROLL_trackHitTest, 0 ); + if (hittest == pwndData->SCROLL_trackHitTest) + { + SCROLL_DrawInterior( &context, &sbi, sbi.xyThumbTop, vertical, pwndData->SCROLL_trackHitTest, 0 ); if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER)) { SendMessageW( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, @@ -558,9 +558,9 @@ break; case SCROLL_BOTTOM_ARROW: - if (hittest == pwndContext->SCROLL_trackHitTest) - { - SCROLL_DrawArrows( &context, &sbi, vertical, pwndContext->SCROLL_trackHitTest, 0 ); + if (hittest == pwndData->SCROLL_trackHitTest) + { + SCROLL_DrawArrows( &context, &sbi, vertical, pwndData->SCROLL_trackHitTest, 0 ); if ((msg == WM_LBUTTONDOWN) || (msg == WM_SYSTIMER)) { SendMessageW( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, @@ -592,8 +592,8 @@ if (msg == WM_LBUTTONUP) { - hittest = pwndContext->SCROLL_trackHitTest; - pwndContext->SCROLL_trackHitTest = SCROLL_NOWHERE; /* Terminate tracking */ + hittest = pwndData->SCROLL_trackHitTest; + pwndData->SCROLL_trackHitTest = SCROLL_NOWHERE; /* Terminate tracking */ if (hittest == SCROLL_THUMB) { @@ -607,7 +607,7 @@ SB_ENDSCROLL, (LPARAM)hwndCtl ); /* Terminate tracking */ - pwndContext->SCROLL_TrackingWin = 0; + pwndData->SCROLL_TrackingWin = 0; } ThemeCleanupDrawContext(&context); @@ -617,13 +617,13 @@ SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt ) { MSG msg; - PWND_CONTEXT pwndContext = ThemeGetWndContext(hwnd); - if(!pwndContext) + PWND_DATA pwndData = ThemeGetWndData(hwnd); + if(!pwndData) return; ScreenToWindow(hwnd, &pt); - SCROLL_HandleScrollEvent(pwndContext, hwnd, scrollbar, WM_LBUTTONDOWN, pt ); + SCROLL_HandleScrollEvent(pwndData, hwnd, scrollbar, WM_LBUTTONDOWN, pt ); do { @@ -637,7 +637,7 @@ pt.y = GET_Y_LPARAM(msg.lParam); ClientToScreen(hwnd, &pt); ScreenToWindow(hwnd, &pt); - SCROLL_HandleScrollEvent(pwndContext, hwnd, scrollbar, msg.message, pt ); + SCROLL_HandleScrollEvent(pwndData, hwnd, scrollbar, msg.message, pt ); } else { Modified: trunk/reactos/dll/win32/uxtheme/nonclient.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/nonclien…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/nonclient.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/nonclient.c [iso-8859-1] Fri May 19 08:45:49 2017 @@ -596,7 +596,7 @@ DRAW_CONTEXT context; TRACKMOUSEEVENT tme; DWORD style; - PWND_CONTEXT pcontext; + PWND_DATA pwndData; /* First of all check if we have something to do here */ style = GetWindowLongW(hWnd, GWL_STYLE); @@ -604,8 +604,8 @@ return 0; /* Get theme data for this window */ - pcontext = ThemeGetWndContext(hWnd); - if (pcontext == NULL) + pwndData = ThemeGetWndData(hWnd); + if (pwndData == NULL) return 0; /* Begin tracking in the non client area if we are not tracking yet */ @@ -623,24 +623,24 @@ ThemeInitDrawContext(&context, hWnd, 0); if (context.wi.dwStyle & WS_SYSMENU) { - if (HT_ISBUTTON(ht) || HT_ISBUTTON(pcontext->lastHitTest)) + if (HT_ISBUTTON(ht) || HT_ISBUTTON(pwndData->lastHitTest)) ThemeDrawCaptionButtons(&context, ht, 0); } if (context.wi.dwStyle & WS_HSCROLL) { - if (ht == HTHSCROLL || pcontext->lastHitTest == HTHSCROLL) + if (ht == HTHSCROLL || pwndData->lastHitTest == HTHSCROLL) ThemeDrawScrollBar(&context, SB_HORZ , ht == HTHSCROLL ? pt : NULL); } if (context.wi.dwStyle & WS_VSCROLL) { - if (ht == HTVSCROLL || pcontext->lastHitTest == HTVSCROLL) + if (ht == HTVSCROLL || pwndData->lastHitTest == HTVSCROLL) ThemeDrawScrollBar(&context, SB_VERT, ht == HTVSCROLL ? pt : NULL); } ThemeCleanupDrawContext(&context); - pcontext->lastHitTest = ht; + pwndData->lastHitTest = ht; return 0; } @@ -650,7 +650,7 @@ { DRAW_CONTEXT context; DWORD style; - PWND_CONTEXT pWndContext; + PWND_DATA pwndData; /* First of all check if we have something to do here */ style = GetWindowLongW(hWnd, GWL_STYLE); @@ -658,23 +658,23 @@ return 0; /* Get theme data for this window */ - pWndContext = ThemeGetWndContext(hWnd); - if (pWndContext == NULL) + pwndData = ThemeGetWndData(hWnd); + if (pwndData == NULL) return 0; ThemeInitDrawContext(&context, hWnd, 0); - if (context.wi.dwStyle & WS_SYSMENU && HT_ISBUTTON(pWndContext->lastHitTest)) + if (context.wi.dwStyle & WS_SYSMENU && HT_ISBUTTON(pwndData->lastHitTest)) ThemeDrawCaptionButtons(&context, 0, 0); - if (context.wi.dwStyle & WS_HSCROLL && pWndContext->lastHitTest == HTHSCROLL) + if (context.wi.dwStyle & WS_HSCROLL && pwndData->lastHitTest == HTHSCROLL) ThemeDrawScrollBar(&context, SB_HORZ, NULL); - if (context.wi.dwStyle & WS_VSCROLL && pWndContext->lastHitTest == HTVSCROLL) + if (context.wi.dwStyle & WS_VSCROLL && pwndData->lastHitTest == HTVSCROLL) ThemeDrawScrollBar(&context, SB_VERT, NULL); ThemeCleanupDrawContext(&context); - pWndContext->lastHitTest = HTNOWHERE; + pwndData->lastHitTest = HTNOWHERE; return 0; } @@ -687,7 +687,7 @@ WPARAM SCMsg, ht; ULONG Style; DRAW_CONTEXT context; - PWND_CONTEXT pWndContext; + PWND_DATA pwndData; Style = GetWindowLongW(hWnd, GWL_STYLE); if (!((Style & WS_CAPTION) && (Style & WS_SYSMENU))) @@ -713,13 +713,13 @@ } /* Get theme data for this window */ - pWndContext = ThemeGetWndContext(hWnd); - if (pWndContext == NULL) + pwndData = ThemeGetWndData(hWnd); + if (pwndData == NULL) return; ThemeInitDrawContext(&context, hWnd, 0); ThemeDrawCaptionButtons(&context, 0, wParam); - pWndContext->lastHitTest = wParam; + pwndData->lastHitTest = wParam; SetCapture(hWnd); @@ -740,11 +740,11 @@ Pressed = (ht == wParam); /* Only draw the buttons if the hit test changed */ - if (ht != pWndContext->lastHitTest && - (HT_ISBUTTON(ht) || HT_ISBUTTON(pWndContext->lastHitTest))) + if (ht != pwndData->lastHitTest && + (HT_ISBUTTON(ht) || HT_ISBUTTON(pwndData->lastHitTest))) { ThemeDrawCaptionButtons(&context, 0, Pressed ? wParam: 0); - pWndContext->lastHitTest = ht; + pwndData->lastHitTest = ht; } } Modified: trunk/reactos/dll/win32/uxtheme/themehooks.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/themehoo…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/themehooks.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/themehooks.c [iso-8859-1] Fri May 19 08:45:49 2017 @@ -14,72 +14,72 @@ BYTE gabDLGPmessages[UAHOWP_MAX_SIZE]; BOOL gbThemeHooksActive = FALSE; -PWND_CONTEXT ThemeGetWndContext(HWND hWnd) -{ - PWND_CONTEXT pcontext; - - pcontext = (PWND_CONTEXT)GetPropW(hWnd, (LPCWSTR)MAKEINTATOM(atWndContext)); - if(pcontext == NULL) - { - pcontext = HeapAlloc(GetProcessHeap(), +PWND_DATA ThemeGetWndData(HWND hWnd) +{ + PWND_DATA pwndData; + + pwndData = (PWND_DATA)GetPropW(hWnd, (LPCWSTR)MAKEINTATOM(atWndContext)); + if(pwndData == NULL) + { + pwndData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(WND_CONTEXT)); - if(pcontext == NULL) + sizeof(WND_DATA)); + if(pwndData == NULL) { return NULL; } - SetPropW( hWnd, (LPCWSTR)MAKEINTATOM(atWndContext), pcontext); - } - - return pcontext; -} - -void ThemeDestroyWndContext(HWND hWnd) -{ - PWND_CONTEXT pContext; + SetPropW( hWnd, (LPCWSTR)MAKEINTATOM(atWndContext), pwndData); + } + + return pwndData; +} + +void ThemeDestroyWndData(HWND hWnd) +{ + PWND_DATA pwndData; DWORD ProcessId; - /*Do not destroy WND_CONTEXT of a window that belong to another process */ + /*Do not destroy WND_DATA of a window that belong to another process */ GetWindowThreadProcessId(hWnd, &ProcessId); if(ProcessId != GetCurrentProcessId()) { return; } - pContext = (PWND_CONTEXT)GetPropW(hWnd, (LPCWSTR)MAKEINTATOM(atWndContext)); - if(pContext == NULL) + pwndData = (PWND_DATA)GetPropW(hWnd, (LPCWSTR)MAKEINTATOM(atWndContext)); + if(pwndData == NULL) { return; } - if(pContext->HasThemeRgn) + if(pwndData->HasThemeRgn) { user32ApiHook.SetWindowRgn(hWnd, 0, TRUE); } - if (pContext->hTabBackgroundBrush != NULL) + if (pwndData->hTabBackgroundBrush != NULL) { CloseThemeData(GetWindowTheme(hWnd)); - DeleteObject(pContext->hTabBackgroundBrush); - pContext->hTabBackgroundBrush = NULL; - } - - if (pContext->hTabBackgroundBmp != NULL) - { - DeleteObject(pContext->hTabBackgroundBmp); - pContext->hTabBackgroundBmp = NULL; - } - - HeapFree(GetProcessHeap(), 0, pContext); + DeleteObject(pwndData->hTabBackgroundBrush); + pwndData->hTabBackgroundBrush = NULL; + } + + if (pwndData->hTabBackgroundBmp != NULL) + { + DeleteObject(pwndData->hTabBackgroundBmp); + pwndData->hTabBackgroundBmp = NULL; + } + + HeapFree(GetProcessHeap(), 0, pwndData); SetPropW( hWnd, (LPCWSTR)MAKEINTATOM(atWndContext), NULL); } static BOOL CALLBACK ThemeCleanupChildWndContext (HWND hWnd, LPARAM msg) { - ThemeDestroyWndContext(hWnd); + ThemeDestroyWndData(hWnd); return TRUE; } @@ -91,7 +91,7 @@ } else { - ThemeDestroyWndContext(hWnd); + ThemeDestroyWndData(hWnd); EnumChildWindows (hWnd, ThemeCleanupChildWndContext, 0); } @@ -150,7 +150,7 @@ int OnPostWinPosChanged(HWND hWnd, WINDOWPOS* pWinPos) { - PWND_CONTEXT pcontext; + PWND_DATA pwndData; DWORD style; /* We only proceed to change the window shape if it has a caption */ @@ -159,37 +159,37 @@ return 0; /* Get theme data for this window */ - pcontext = ThemeGetWndContext(hWnd); - if (pcontext == NULL) + pwndData = ThemeGetWndData(hWnd); + if (pwndData == NULL) return 0; /* Do not change the region of the window if its size wasn't changed */ - if ((pWinPos->flags & SWP_NOSIZE) != 0 && pcontext->DirtyThemeRegion == FALSE) + if ((pWinPos->flags & SWP_NOSIZE) != 0 && pwndData->DirtyThemeRegion == FALSE) return 0; /* We don't touch the shape of the window if the application sets it on its own */ - if (pcontext->HasAppDefinedRgn == TRUE) + if (pwndData->HasAppDefinedRgn == TRUE) return 0; /* Calling SetWindowRgn will call SetWindowPos again so we need to avoid this recursion */ - if (pcontext->UpdatingRgn == TRUE) + if (pwndData->UpdatingRgn == TRUE) return 0; if(!IsAppThemed()) { - if(pcontext->HasThemeRgn) - { - pcontext->HasThemeRgn = FALSE; + if(pwndData->HasThemeRgn) + { + pwndData->HasThemeRgn = FALSE; user32ApiHook.SetWindowRgn(hWnd, 0, TRUE); } return 0; } - pcontext->DirtyThemeRegion = FALSE; - pcontext->HasThemeRgn = TRUE; - pcontext->UpdatingRgn = TRUE; + pwndData->DirtyThemeRegion = FALSE; + pwndData->HasThemeRgn = TRUE; + pwndData->UpdatingRgn = TRUE; SetThemeRegion(hWnd); - pcontext->UpdatingRgn = FALSE; + pwndData->UpdatingRgn = FALSE; return 0; } @@ -241,32 +241,32 @@ { case WM_THEMECHANGED: { - PWND_CONTEXT pcontext = ThemeGetWndContext(hWnd); + PWND_DATA pwndData = ThemeGetWndData(hWnd); if (GetAncestor(hWnd, GA_PARENT) == GetDesktopWindow()) UXTHEME_LoadTheme(TRUE); - if (pcontext == NULL) + if (pwndData == NULL) return 0; - if (pcontext->hTabBackgroundBrush != NULL) + if (pwndData->hTabBackgroundBrush != NULL) { - DeleteObject(pcontext->hTabBackgroundBrush); - pcontext->hTabBackgroundBrush = NULL; + DeleteObject(pwndData->hTabBackgroundBrush); + pwndData->hTabBackgroundBrush = NULL; } - if (pcontext->hTabBackgroundBmp != NULL) + if (pwndData->hTabBackgroundBmp != NULL) { - DeleteObject(pcontext->hTabBackgroundBmp); - pcontext->hTabBackgroundBmp = NULL; + DeleteObject(pwndData->hTabBackgroundBmp); + pwndData->hTabBackgroundBmp = NULL; } } case WM_NCCREATE: { - PWND_CONTEXT pcontext = ThemeGetWndContext(hWnd); - if (pcontext == NULL) + PWND_DATA pwndData = ThemeGetWndData(hWnd); + if (pwndData == NULL) return 0; - pcontext->DirtyThemeRegion = TRUE; + pwndData->DirtyThemeRegion = TRUE; } } @@ -285,7 +285,7 @@ } case WM_NCDESTROY: { - ThemeDestroyWndContext(hWnd); + ThemeDestroyWndData(hWnd); return 0; } } @@ -295,13 +295,13 @@ HRESULT GetDiaogTextureBrush(HTHEME theme, HWND hwnd, HDC hdc, HBRUSH* result, BOOL changeOrigin) { - PWND_CONTEXT pcontext; - - pcontext = ThemeGetWndContext(hwnd); - if (pcontext == NULL) + PWND_DATA pwndData; + + pwndData = ThemeGetWndData(hwnd); + if (pwndData == NULL) return E_FAIL; - if (pcontext->hTabBackgroundBrush == NULL) + if (pwndData->hTabBackgroundBrush == NULL) { HBITMAP hbmp; RECT dummy, bmpRect; @@ -337,18 +337,18 @@ DeleteDC(hdcHackPattern); /* Keep the handle of the bitmap we created so that it can be used later */ - pcontext->hTabBackgroundBmp = hbmpHack; + pwndData->hTabBackgroundBmp = hbmpHack; hbmp = hbmpHack; } /* hbmp is cached so there is no need to free it */ - pcontext->hTabBackgroundBrush = CreatePatternBrush(hbmp); - } - - if (!pcontext->hTabBackgroundBrush) + pwndData->hTabBackgroundBrush = CreatePatternBrush(hbmp); + } + + if (!pwndData->hTabBackgroundBrush) return E_FAIL; - *result = pcontext->hTabBackgroundBrush; + *result = pwndData->hTabBackgroundBrush; return S_OK; } @@ -417,11 +417,11 @@ int WINAPI ThemeSetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw) { - PWND_CONTEXT pcontext = ThemeGetWndContext(hWnd); - if(pcontext) - { - pcontext->HasAppDefinedRgn = TRUE; - pcontext->HasThemeRgn = FALSE; + PWND_DATA pwndData = ThemeGetWndData(hWnd); + if(pwndData) + { + pwndData->HasAppDefinedRgn = TRUE; + pwndData->HasThemeRgn = FALSE; } return user32ApiHook.SetWindowRgn(hWnd, hRgn, bRedraw); @@ -429,7 +429,7 @@ BOOL WINAPI ThemeGetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi) { - PWND_CONTEXT pwndContext; + PWND_DATA pwndData; DWORD style; BOOL ret; @@ -441,8 +441,8 @@ if((style & (WS_HSCROLL|WS_VSCROLL))==0) goto dodefault; - pwndContext = ThemeGetWndContext(hwnd); - if (pwndContext == NULL) + pwndData = ThemeGetWndData(hwnd); + if (pwndData == NULL) goto dodefault; /* @@ -454,10 +454,10 @@ ret = user32ApiHook.GetScrollInfo(hwnd, fnBar, lpsi); if ( lpsi && (lpsi->fMask & SIF_TRACKPOS) && - pwndContext->SCROLL_TrackingWin == hwnd && - pwndContext->SCROLL_TrackingBar == fnBar) - { - lpsi->nTrackPos = pwndContext->SCROLL_TrackingVal; + pwndData->SCROLL_TrackingWin == hwnd && + pwndData->SCROLL_TrackingBar == fnBar) + { + lpsi->nTrackPos = pwndData->SCROLL_TrackingVal; } return ret; Modified: trunk/reactos/dll/win32/uxtheme/uxthemep.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/uxthemep…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/uxthemep.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/uxthemep.h [iso-8859-1] Fri May 19 08:45:49 2017 @@ -134,7 +134,7 @@ }; /* The window context stores data for the window needed through the life of the window */ -typedef struct _WND_CONTEXT +typedef struct _WND_DATA { UINT lastHitTest; BOOL HasAppDefinedRgn; @@ -151,7 +151,7 @@ INT SCROLL_TrackingBar; INT SCROLL_TrackingPos; INT SCROLL_TrackingVal; -} WND_CONTEXT, *PWND_CONTEXT; +} WND_DATA, *PWND_DATA; /* The draw context stores data that are needed by the drawing operations in the non client area of the window */ typedef struct _DRAW_CONTEXT @@ -228,7 +228,7 @@ VOID NC_TrackScrollBar(HWND Wnd, WPARAM wParam, POINT Pt); void ThemeInitDrawContext(PDRAW_CONTEXT pcontext, HWND hWnd, HRGN hRgn); void ThemeCleanupDrawContext(PDRAW_CONTEXT pcontext); -PWND_CONTEXT ThemeGetWndContext(HWND hWnd); +PWND_DATA ThemeGetWndData(HWND hWnd); extern HINSTANCE hDllInst; extern ATOM atWindowTheme;
7 years, 7 months
1
0
0
0
[gedmurphy] 74586: [FLTMGR] - Add the missing IOCTLs that were added to fltlib
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Fri May 19 08:21:41 2017 New Revision: 74586 URL:
http://svn.reactos.org/svn/reactos?rev=74586&view=rev
Log: [FLTMGR] - Add the missing IOCTLs that were added to fltlib Modified: trunk/reactos/drivers/filters/fltmgr/Dispatch.c Modified: trunk/reactos/drivers/filters/fltmgr/Dispatch.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filters/fltmgr/Dis…
============================================================================== --- trunk/reactos/drivers/filters/fltmgr/Dispatch.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filters/fltmgr/Dispatch.c [iso-8859-1] Fri May 19 08:21:41 2017 @@ -47,16 +47,48 @@ ControlCode = StackPtr->Parameters.DeviceIoControl.IoControlCode; switch (ControlCode) { - case IOCTL_LOAD_FILTER: + case IOCTL_FILTER_LOAD: Status = HandleLoadUnloadIoctl(DeviceObject, Irp); break; - case IOCTL_UNLOAD_FILTER: + case IOCTL_FILTER_UNLOAD: Status = HandleLoadUnloadIoctl(DeviceObject, Irp); break; - case IOCTL_FIND_FIRST_FILTER: - Status = HandleFindFirstIoctl(DeviceObject, Irp); + case IOCTL_FILTER_CREATE: + Status = STATUS_NOT_SUPPORTED; + break; + + case IOCTL_FILTER_ATTATCH: + Status = STATUS_NOT_SUPPORTED; + break; + + case IOCTL_FILTER_DETATCH: + Status = STATUS_NOT_SUPPORTED; + break; + + case IOCTL_FILTER_SEND_MESSAGE: + Status = STATUS_NOT_SUPPORTED; + break; + + case IOCTL_FILTER_GET_MESSAGE: + Status = STATUS_NOT_SUPPORTED; + break; + + case IOCTL_FILTER_REPLY_MESSAGE: + Status = STATUS_NOT_SUPPORTED; + break; + + case IOCTL_FILTER_FIND_FIRST: + Status = STATUS_NOT_SUPPORTED; + break; + + case IOCTL_FILTER_FIND_NEXT: + Status = STATUS_NOT_SUPPORTED; + break; + + case IOCTL_FILTER_GET_INFO: + Status = STATUS_NOT_SUPPORTED; break; default: @@ -92,13 +124,14 @@ PFILTER_NAME FilterName; ULONG BufferLength; ULONG ControlCode; + NTSTATUS Status; /* Get the IOCTL data from the stack pointer */ StackPtr = IoGetCurrentIrpStackLocation(Irp); BufferLength = StackPtr->Parameters.DeviceIoControl.InputBufferLength; ControlCode = StackPtr->Parameters.DeviceIoControl.IoControlCode; - FLT_ASSERT(ControlCode == IOCTL_LOAD_FILTER || ControlCode == IOCTL_UNLOAD_FILTER); + FLT_ASSERT(ControlCode == IOCTL_FILTER_LOAD || ControlCode == IOCTL_FILTER_UNLOAD); /* Make sure the buffer is valid */ if (BufferLength < sizeof(FILTER_NAME)) @@ -111,19 +144,14 @@ Name.Buffer = (PWCH)((PCHAR)FilterName + FIELD_OFFSET(FILTER_NAME, FilterName[0])); /* Forward the request to our Flt routines */ - if (ControlCode == IOCTL_LOAD_FILTER) + if (ControlCode == IOCTL_FILTER_LOAD) { - return FltLoadFilter(&Name); + Status = FltLoadFilter(&Name); } else { - return FltUnloadFilter(&Name); + Status = FltUnloadFilter(&Name); } + + return Status; } - -NTSTATUS -HandleFindFirstIoctl(_In_ PDEVICE_OBJECT DeviceObject, - _Inout_ PIRP Irp) -{ - return STATUS_NOT_SUPPORTED; -}
7 years, 7 months
1
0
0
0
[hbelusca] 74585: [NTOS]: Use the correct access rights for ZwOpenDirectoryObject call.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu May 18 23:46:44 2017 New Revision: 74585 URL:
http://svn.reactos.org/svn/reactos?rev=74585&view=rev
Log: [NTOS]: Use the correct access rights for ZwOpenDirectoryObject call. Modified: trunk/reactos/ntoskrnl/fstub/disksup.c Modified: trunk/reactos/ntoskrnl/fstub/disksup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fstub/disksup.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] Thu May 18 23:46:44 2017 @@ -173,7 +173,7 @@ NULL); Status = ZwOpenDirectoryObject (&DirectoryHandle, - SYMBOLIC_LINK_ALL_ACCESS, + DIRECTORY_ALL_ACCESS, &ObjectAttributes); if (!NT_SUCCESS(Status)) {
7 years, 7 months
1
0
0
0
← Newer
1
...
11
12
13
14
15
16
17
...
29
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Results per page:
10
25
50
100
200