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
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
July 2006
----- 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
19 participants
662 discussions
Start a n
N
ew thread
[ion] 22855: - The FO's lock is a Synch event, not a notification event!
by ion@svn.reactos.org
Author: ion Date: Wed Jul 5 04:22:09 2006 New Revision: 22855 URL:
http://svn.reactos.org/svn/reactos?rev=22855&view=rev
Log: - The FO's lock is a Synch event, not a notification event! Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/file.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/file.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/file.c Wed Jul 5 04:22:09 2006 @@ -986,7 +986,7 @@ SecurityContext.DesiredAccess = DesiredAccess; SecurityContext.FullCreateOptions = 0; /* ?? */ - KeInitializeEvent(&FileObject->Lock, SynchronizationEvent, TRUE); + KeInitializeEvent(&FileObject->Lock, SynchronizationEvent, FALSE); KeInitializeEvent(&FileObject->Event, NotificationEvent, FALSE); DPRINT("FileObject 0x%p\n", FileObject);
18 years, 4 months
1
0
0
0
[ion] 22854: - Finally fix IoCreateStreamFileObject. I had fixed it a long time ago but back then it was causing regressions. It now properly creates a handle for the FO and sets the right flags.
by ion@svn.reactos.org
Author: ion Date: Wed Jul 5 04:17:34 2006 New Revision: 22854 URL:
http://svn.reactos.org/svn/reactos?rev=22854&view=rev
Log: - Finally fix IoCreateStreamFileObject. I had fixed it a long time ago but back then it was causing regressions. It now properly creates a handle for the FO and sets the right flags. Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/file.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/file.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/file.c Wed Jul 5 04:17:34 2006 @@ -24,7 +24,7 @@ PSECURITY_DESCRIPTOR SecurityDescriptor, PULONG BufferLength); -/* INTERNAL FUNCTIONS ********************************************************/ +/* PRIVATE FUNCTIONS *********************************************************/ NTSTATUS NTAPI @@ -619,6 +619,118 @@ IoFreeIrp(Irp); } +NTSTATUS +NTAPI +IopQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, + IN FILE_INFORMATION_CLASS FileInformationClass, + OUT PVOID FileInformation) +{ + IO_STATUS_BLOCK IoStatusBlock; + HANDLE FileHandle; + NTSTATUS Status; + KPROCESSOR_MODE AccessMode; + UNICODE_STRING ObjectName; + OBJECT_CREATE_INFORMATION ObjectCreateInfo; + OBJECT_ATTRIBUTES LocalObjectAttributes; + ULONG BufferSize; + union + { + FILE_BASIC_INFORMATION BasicInformation; + FILE_NETWORK_OPEN_INFORMATION NetworkOpenInformation; + }LocalFileInformation; + + if (FileInformationClass == FileBasicInformation) + { + BufferSize = sizeof(FILE_BASIC_INFORMATION); + } + else if (FileInformationClass == FileNetworkOpenInformation) + { + BufferSize = sizeof(FILE_NETWORK_OPEN_INFORMATION); + } + else + { + return STATUS_INVALID_PARAMETER; + } + + AccessMode = ExGetPreviousMode(); + + if (AccessMode != KernelMode) + { + Status = STATUS_SUCCESS; + _SEH_TRY + { + ProbeForWrite(FileInformation, + BufferSize, + sizeof(ULONG)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + if (NT_SUCCESS(Status)) + { + Status = ObpCaptureObjectAttributes(ObjectAttributes, + AccessMode, + FALSE, + &ObjectCreateInfo, + &ObjectName); + } + if (!NT_SUCCESS(Status)) + { + return Status; + } + InitializeObjectAttributes(&LocalObjectAttributes, + &ObjectName, + ObjectCreateInfo.Attributes, + ObjectCreateInfo.RootDirectory, + ObjectCreateInfo.SecurityDescriptor); + } + + /* Open the file */ + Status = ZwOpenFile(&FileHandle, + SYNCHRONIZE | FILE_READ_ATTRIBUTES, + AccessMode == KernelMode ? ObjectAttributes : &LocalObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (AccessMode != KernelMode) + { + ObpReleaseCapturedAttributes(&ObjectCreateInfo); + if (ObjectName.Buffer) ObpReleaseCapturedName(&ObjectName); + } + if (!NT_SUCCESS (Status)) + { + DPRINT ("ZwOpenFile() failed (Status %lx)\n", Status); + return Status; + } + + /* Get file attributes */ + Status = ZwQueryInformationFile(FileHandle, + &IoStatusBlock, + AccessMode == KernelMode ? FileInformation : &LocalFileInformation, + BufferSize, + FileInformationClass); + if (!NT_SUCCESS (Status)) + { + DPRINT ("ZwQueryInformationFile() failed (Status %lx)\n", Status); + } + ZwClose(FileHandle); + + if (NT_SUCCESS(Status) && AccessMode != KernelMode) + { + _SEH_TRY + { + memcpy(FileInformation, &LocalFileInformation, BufferSize); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + return Status; +} /* FUNCTIONS *****************************************************************/ @@ -1022,41 +1134,16 @@ } /* - * NAME EXPORTED - * IoCreateStreamFileObject@8 - * - * DESCRIPTION - * - * ARGUMENTS - * FileObject - * ? - * - * DeviceObject - * ? - * - * RETURN VALUE - * - * NOTE - * - * REVISIONS - * * @implemented */ -PFILE_OBJECT -STDCALL -IoCreateStreamFileObject(PFILE_OBJECT FileObject, - PDEVICE_OBJECT DeviceObject) +PFILE_OBJECT +NTAPI +IoCreateStreamFileObject(IN PFILE_OBJECT FileObject, + IN PDEVICE_OBJECT DeviceObject) { PFILE_OBJECT CreatedFileObject; NTSTATUS Status; - - /* FIXME: This function should call ObInsertObject. The "Lite" version - doesnt. This function is also called from IoCreateFile for some - reason. These hacks need to be removed. - */ - - DPRINT("IoCreateStreamFileObject(FileObject 0x%p, DeviceObject 0x%p)\n", - FileObject, DeviceObject); + HANDLE FileHandle; PAGED_CODE(); /* Create the File Object */ @@ -1066,33 +1153,35 @@ KernelMode, NULL, sizeof(FILE_OBJECT), - 0, + sizeof(FILE_OBJECT), 0, (PVOID*)&CreatedFileObject); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Could not create FileObject\n"); - return (NULL); - } + if (!NT_SUCCESS(Status)) return (NULL); /* Choose Device Object */ if (FileObject) DeviceObject = FileObject->DeviceObject; - DPRINT("DeviceObject 0x%p\n", DeviceObject); - - /* HACK */ - DeviceObject = IoGetAttachedDevice(DeviceObject); - + /* Set File Object Data */ + RtlZeroMemory(CreatedFileObject, sizeof(FILE_OBJECT)); CreatedFileObject->DeviceObject = DeviceObject; - CreatedFileObject->Vpb = DeviceObject->Vpb; CreatedFileObject->Type = IO_TYPE_FILE; - CreatedFileObject->Flags |= FO_STREAM_FILE; - - /* Initialize Lock and Event */ - KeInitializeEvent(&CreatedFileObject->Event, NotificationEvent, FALSE); - KeInitializeEvent(&CreatedFileObject->Lock, SynchronizationEvent, TRUE); - - /* Return file */ + CreatedFileObject->Size = sizeof(FILE_OBJECT); + CreatedFileObject->Flags = FO_STREAM_FILE; + + /* Initialize the wait event */ + KeInitializeEvent(&CreatedFileObject->Event, SynchronizationEvent, FALSE); + + /* Insert it to create a handle for it */ + Status = ObInsertObject(CreatedFileObject, + NULL, + FILE_READ_DATA, + 1, + (PVOID*)&CreatedFileObject, + &FileHandle); + CreatedFileObject->Flags |= FO_HANDLE_CREATED; + + /* Close the extra handle and return file */ + NtClose(FileHandle); return CreatedFileObject; } @@ -1441,118 +1530,6 @@ } NTSTATUS -IopQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, - IN FILE_INFORMATION_CLASS FileInformationClass, - OUT PVOID FileInformation) -{ - IO_STATUS_BLOCK IoStatusBlock; - HANDLE FileHandle; - NTSTATUS Status; - KPROCESSOR_MODE AccessMode; - UNICODE_STRING ObjectName; - OBJECT_CREATE_INFORMATION ObjectCreateInfo; - OBJECT_ATTRIBUTES LocalObjectAttributes; - ULONG BufferSize; - union - { - FILE_BASIC_INFORMATION BasicInformation; - FILE_NETWORK_OPEN_INFORMATION NetworkOpenInformation; - }LocalFileInformation; - - if (FileInformationClass == FileBasicInformation) - { - BufferSize = sizeof(FILE_BASIC_INFORMATION); - } - else if (FileInformationClass == FileNetworkOpenInformation) - { - BufferSize = sizeof(FILE_NETWORK_OPEN_INFORMATION); - } - else - { - return STATUS_INVALID_PARAMETER; - } - - AccessMode = ExGetPreviousMode(); - - if (AccessMode != KernelMode) - { - Status = STATUS_SUCCESS; - _SEH_TRY - { - ProbeForWrite(FileInformation, - BufferSize, - sizeof(ULONG)); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - if (NT_SUCCESS(Status)) - { - Status = ObpCaptureObjectAttributes(ObjectAttributes, - AccessMode, - FALSE, - &ObjectCreateInfo, - &ObjectName); - } - if (!NT_SUCCESS(Status)) - { - return Status; - } - InitializeObjectAttributes(&LocalObjectAttributes, - &ObjectName, - ObjectCreateInfo.Attributes, - ObjectCreateInfo.RootDirectory, - ObjectCreateInfo.SecurityDescriptor); - } - - /* Open the file */ - Status = ZwOpenFile(&FileHandle, - SYNCHRONIZE | FILE_READ_ATTRIBUTES, - AccessMode == KernelMode ? ObjectAttributes : &LocalObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (AccessMode != KernelMode) - { - ObpReleaseCapturedAttributes(&ObjectCreateInfo); - if (ObjectName.Buffer) ObpReleaseCapturedName(&ObjectName); - } - if (!NT_SUCCESS (Status)) - { - DPRINT ("ZwOpenFile() failed (Status %lx)\n", Status); - return Status; - } - - /* Get file attributes */ - Status = ZwQueryInformationFile(FileHandle, - &IoStatusBlock, - AccessMode == KernelMode ? FileInformation : &LocalFileInformation, - BufferSize, - FileInformationClass); - if (!NT_SUCCESS (Status)) - { - DPRINT ("ZwQueryInformationFile() failed (Status %lx)\n", Status); - } - ZwClose(FileHandle); - - if (NT_SUCCESS(Status) && AccessMode != KernelMode) - { - _SEH_TRY - { - memcpy(FileInformation, &LocalFileInformation, BufferSize); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - } - return Status; -} - -NTSTATUS STDCALL NtQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PFILE_BASIC_INFORMATION FileInformation)
18 years, 4 months
1
0
0
0
[ion] 22853: - Fix IopQueryNameFile to properly validate and calculate lengths at each step of the way and to support incomplete buffers. Previously, dangerous assumptions were made about the buffers and the actual required length was never returned.
by ion@svn.reactos.org
Author: ion Date: Wed Jul 5 03:31:42 2006 New Revision: 22853 URL:
http://svn.reactos.org/svn/reactos?rev=22853&view=rev
Log: - Fix IopQueryNameFile to properly validate and calculate lengths at each step of the way and to support incomplete buffers. Previously, dangerous assumptions were made about the buffers and the actual required length was never returned. Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/file.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/file.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/file.c Wed Jul 5 03:31:42 2006 @@ -463,61 +463,97 @@ } NTSTATUS -STDCALL -IopQueryNameFile(PVOID ObjectBody, +NTAPI +IopQueryNameFile(IN PVOID ObjectBody, IN BOOLEAN HasName, - POBJECT_NAME_INFORMATION ObjectNameInfo, - ULONG Length, - PULONG ReturnLength, + OUT POBJECT_NAME_INFORMATION ObjectNameInfo, + IN ULONG Length, + OUT PULONG ReturnLength, IN KPROCESSOR_MODE PreviousMode) { POBJECT_NAME_INFORMATION LocalInfo; - PFILE_OBJECT FileObject; - ULONG LocalReturnLength; + PFILE_NAME_INFORMATION LocalFileInfo; + PFILE_OBJECT FileObject = (PFILE_OBJECT)ObjectBody; + ULONG LocalReturnLength, FileLength; NTSTATUS Status; - - DPRINT1("IopQueryNameFile() called\n"); - - FileObject = (PFILE_OBJECT)ObjectBody; + PWCHAR p; + + /* Validate length */ + if (Length < sizeof(OBJECT_NAME_INFORMATION)) + { + /* Wrong length, fail */ + return STATUS_INFO_LENGTH_MISMATCH; + } /* Allocate Buffer */ - LocalInfo = ExAllocatePool(PagedPool, - sizeof(OBJECT_NAME_INFORMATION) + - MAX_PATH * sizeof(WCHAR)); - if (LocalInfo == NULL) return STATUS_INSUFFICIENT_RESOURCES; + LocalInfo = ExAllocatePoolWithTag(PagedPool, Length, TAG_IO); + if (!LocalInfo) return STATUS_INSUFFICIENT_RESOURCES; /* Query the name */ Status = ObQueryNameString(FileObject->DeviceObject, LocalInfo, - MAX_PATH * sizeof(WCHAR), + Length, &LocalReturnLength); if (!NT_SUCCESS (Status)) { - ExFreePool (LocalInfo); + /* Free the buffer and fail */ + ExFreePool(LocalInfo); return Status; } - DPRINT ("Device path: %wZ\n", &LocalInfo->Name); - - /* Write Device Path */ - Status = RtlAppendUnicodeStringToString(&ObjectNameInfo->Name, - &(LocalInfo)->Name); + + /* Copy the information */ + RtlCopyMemory(ObjectNameInfo, + LocalInfo, + LocalReturnLength > Length ? + Length : LocalReturnLength); + + /* Set buffer pointer */ + p = (PWCHAR)(ObjectNameInfo + 1); + ObjectNameInfo->Name.Buffer = p; + + /* Advance in buffer */ + p += (LocalInfo->Name.Length / sizeof(WCHAR)); + + /* Now get the file name buffer and check the length needed */ + LocalFileInfo = (PFILE_NAME_INFORMATION)LocalInfo; + FileLength = Length - + LocalReturnLength + + FIELD_OFFSET(FILE_NAME_INFORMATION, FileName); /* Query the File name */ Status = IoQueryFileInformation(FileObject, FileNameInformation, - LocalReturnLength, - LocalInfo, - NULL); - if (Status != STATUS_SUCCESS) - { + Length, + LocalFileInfo, + &LocalReturnLength); + if (NT_ERROR(Status)) + { + /* Fail on errors only, allow warnings */ ExFreePool(LocalInfo); return Status; } - /* Write the Name */ - Status = RtlAppendUnicodeToString(&ObjectNameInfo->Name, - ((PFILE_NAME_INFORMATION)LocalInfo)->FileName); - DPRINT ("Total path: %wZ\n", &ObjectNameInfo->Name); + /* Now calculate the new lenghts left */ + FileLength = LocalReturnLength - + FIELD_OFFSET(FILE_NAME_INFORMATION, FileName); + LocalReturnLength = (ULONG_PTR)p - + (ULONG_PTR)ObjectNameInfo + + LocalFileInfo->FileNameLength; + + /* Write the Name and null-terminate it */ + RtlMoveMemory(p, LocalFileInfo->FileName, FileLength); + p += (FileLength / sizeof(WCHAR)); + *p = UNICODE_NULL; + LocalReturnLength += sizeof(UNICODE_NULL); + + /* Return the length needed */ + *ReturnLength = LocalReturnLength; + + /* Setup the length and maximum length */ + FileLength = (ULONG_PTR)p - (ULONG_PTR)ObjectNameInfo; + ObjectNameInfo->Name.Length = Length - sizeof(OBJECT_NAME_INFORMATION); + ObjectNameInfo->Name.MaximumLength = ObjectNameInfo->Name.Length + + sizeof(UNICODE_NULL); /* Free buffer and return */ ExFreePool(LocalInfo);
18 years, 4 months
1
0
0
0
[ion] 22852: - Fix and combine the creation of I/O Object Types, it was a complete mess with missing attributes and dangerous bugs (Adapters and Controllers had IopParseDevice as a parse routine and the same pool charge as a deivice object, etc.)
by ion@svn.reactos.org
Author: ion Date: Wed Jul 5 02:41:47 2006 New Revision: 22852 URL:
http://svn.reactos.org/svn/reactos?rev=22852&view=rev
Log: - Fix and combine the creation of I/O Object Types, it was a complete mess with missing attributes and dangerous bugs (Adapters and Controllers had IopParseDevice as a parse routine and the same pool charge as a deivice object, etc.) Modified: trunk/reactos/ntoskrnl/include/internal/io.h trunk/reactos/ntoskrnl/io/iomgr/driver.c trunk/reactos/ntoskrnl/io/iomgr/iocomp.c trunk/reactos/ntoskrnl/io/iomgr/iomgr.c Modified: trunk/reactos/ntoskrnl/include/internal/io.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/io.h (original) +++ trunk/reactos/ntoskrnl/include/internal/io.h Wed Jul 5 02:41:47 2006 @@ -772,6 +772,12 @@ VOID ); +VOID +NTAPI +IopDeleteDriver( + IN PVOID ObjectBody +); + NTSTATUS FASTCALL IopCreateDriverObject( @@ -925,9 +931,9 @@ // I/O Completion Routines // VOID -FASTCALL -IopInitIoCompletionImplementation( - VOID +NTAPI +IopDeleteIoCompletion( + PVOID ObjectBody ); // @@ -994,6 +1000,7 @@ extern PDEVICE_NODE IopRootDeviceNode; extern ULONG IopTraceLevel; extern NPAGED_LOOKASIDE_LIST IopMdlLookasideList; +extern GENERIC_MAPPING IopCompletionMapping; // // Inlined Functions Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/driver.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/driver.c Wed Jul 5 02:41:47 2006 @@ -115,22 +115,6 @@ INIT_FUNCTION IopInitDriverImplementation(VOID) { - OBJECT_TYPE_INITIALIZER ObjectTypeInitializer; - UNICODE_STRING Name; - - DPRINT("Creating Registry Object Type\n"); - - /* Initialize the Driver object type */ - RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); - RtlInitUnicodeString(&Name, L"Driver"); - ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); - ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(DRIVER_OBJECT); - ObjectTypeInitializer.PoolType = NonPagedPool; - ObjectTypeInitializer.UseDefaultObject = TRUE; - ObjectTypeInitializer.DeleteProcedure = IopDeleteDriver; - - ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &IoDriverObjectType); - InitializeListHead(&DriverReinitListHead); KeInitializeSpinLock(&DriverReinitListLock); DriverReinitTailEntry = NULL; Modified: trunk/reactos/ntoskrnl/io/iomgr/iocomp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iocomp.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/iocomp.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/iocomp.c Wed Jul 5 02:41:47 2006 @@ -109,26 +109,6 @@ } } while (FirstEntry != CurrentEntry); } -} - -VOID -FASTCALL -IopInitIoCompletionImplementation(VOID) -{ - OBJECT_TYPE_INITIALIZER ObjectTypeInitializer; - UNICODE_STRING Name; - - /* Initialize the Driver object type */ - RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); - RtlInitUnicodeString(&Name, L"IoCompletion"); - ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); - ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KQUEUE); - ObjectTypeInitializer.PoolType = NonPagedPool; - ObjectTypeInitializer.ValidAccessMask = IO_COMPLETION_ALL_ACCESS; - ObjectTypeInitializer.UseDefaultObject = TRUE; - ObjectTypeInitializer.GenericMapping = IopCompletionMapping; - ObjectTypeInitializer.DeleteProcedure = IopDeleteIoCompletion; - ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &IoCompletionType); } /* PUBLIC FUNCTIONS **********************************************************/ Modified: trunk/reactos/ntoskrnl/io/iomgr/iomgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iomgr.c?…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/iomgr.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c Wed Jul 5 02:41:47 2006 @@ -232,21 +232,14 @@ UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"\\DosDevices"); HANDLE Handle; - IopInitDriverImplementation(); - - DPRINT("Creating Device Object Type\n"); - - /* Initialize the Driver object type */ + /* Initialize default settings */ RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); - RtlInitUnicodeString(&Name, L"Device"); ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); - ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(DEVICE_OBJECT); ObjectTypeInitializer.PoolType = NonPagedPool; + ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK; ObjectTypeInitializer.ValidAccessMask = FILE_ALL_ACCESS; ObjectTypeInitializer.UseDefaultObject = TRUE; ObjectTypeInitializer.GenericMapping = IopFileMapping; - ObjectTypeInitializer.ParseProcedure = IopParseDevice; - ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &IoDeviceObjectType); /* Do the Adapter Type */ RtlInitUnicodeString(&Name, L"Adapter"); @@ -257,10 +250,37 @@ ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(CONTROLLER_OBJECT); ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &IoControllerObjectType); + /* Do the Device Type */ + RtlInitUnicodeString(&Name, L"Device"); + ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(DEVICE_OBJECT); + ObjectTypeInitializer.ParseProcedure = IopParseDevice; + ObjectTypeInitializer.SecurityProcedure = IopSecurityFile; + ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &IoDeviceObjectType); + + /* Initialize the Driver object type */ + RtlInitUnicodeString(&Name, L"Driver"); + ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(DRIVER_OBJECT); + ObjectTypeInitializer.DeleteProcedure = IopDeleteDriver; + ObjectTypeInitializer.ParseProcedure = NULL; + ObjectTypeInitializer.SecurityProcedure = NULL; + ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &IoDriverObjectType); + + /* Initialize the I/O Completion object type */ + RtlInitUnicodeString(&Name, L"IoCompletion"); + ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KQUEUE); + ObjectTypeInitializer.ValidAccessMask = IO_COMPLETION_ALL_ACCESS; + ObjectTypeInitializer.InvalidAttributes |= OBJ_PERMANENT; + ObjectTypeInitializer.GenericMapping = IopCompletionMapping; + ObjectTypeInitializer.DeleteProcedure = IopDeleteIoCompletion; + ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &IoCompletionType); + /* Initialize the File object type */ RtlInitUnicodeString(&Name, L"File"); - ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(FILE_OBJECT); + ObjectTypeInitializer.InvalidAttributes |= OBJ_EXCLUSIVE; + ObjectTypeInitializer.MaintainHandleCount = TRUE; + ObjectTypeInitializer.ValidAccessMask = FILE_ALL_ACCESS; + ObjectTypeInitializer.GenericMapping = IopFileMapping; ObjectTypeInitializer.CloseProcedure = IopCloseFile; ObjectTypeInitializer.DeleteProcedure = IopDeleteFile; ObjectTypeInitializer.SecurityProcedure = IopSecurityFile; @@ -341,6 +361,7 @@ /* * Initialize remaining subsubsystem */ + IopInitDriverImplementation(); IoInitCancelHandling(); IoInitFileSystemImplementation(); IoInitVpbImplementation(); @@ -348,7 +369,6 @@ IopInitPnpNotificationImplementation(); IopInitErrorLog(); IopInitTimerImplementation(); - IopInitIoCompletionImplementation(); IopInitLookasideLists(); /*
18 years, 4 months
1
0
0
0
[ion] 22851: - Add locking in IopDeleteFile, and only check for completion context or name if the file has a DO, otherwise those shouldn't exist. - Added support for device objects as well in IopSecurityFile, since the code is similar. Also fixed sync semantics for file objects, and made other little small fixes.
by ion@svn.reactos.org
Author: ion Date: Wed Jul 5 02:28:23 2006 New Revision: 22851 URL:
http://svn.reactos.org/svn/reactos?rev=22851&view=rev
Log: - Add locking in IopDeleteFile, and only check for completion context or name if the file has a DO, otherwise those shouldn't exist. - Added support for device objects as well in IopSecurityFile, since the code is similar. Also fixed sync semantics for file objects, and made other little small fixes. Modified: trunk/reactos/ntoskrnl/include/internal/io.h trunk/reactos/ntoskrnl/io/iomgr/file.c trunk/reactos/ntoskrnl/io/iomgr/iofunc.c trunk/reactos/ntoskrnl/io/iomgr/irp.c Modified: trunk/reactos/ntoskrnl/include/internal/io.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/io.h (original) +++ trunk/reactos/ntoskrnl/include/internal/io.h Wed Jul 5 02:28:23 2006 @@ -620,6 +620,23 @@ ); // +// IRP Routines +// +NTSTATUS +NTAPI +IopCleanupFailedIrp( + IN PFILE_OBJECT FileObject, + IN PKEVENT EventObject +); + +VOID +NTAPI +IopAbortInterruptedIrp( + IN PKEVENT EventObject, + IN PIRP Irp +); + +// // Shutdown routines // VOID Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/file.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/file.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/file.c Wed Jul 5 02:28:23 2006 @@ -163,8 +163,8 @@ } VOID -STDCALL -IopDeleteFile(PVOID ObjectBody) +NTAPI +IopDeleteFile(IN PVOID ObjectBody) { PFILE_OBJECT FileObject = (PFILE_OBJECT)ObjectBody; PIRP Irp; @@ -173,18 +173,26 @@ KEVENT Event; PDEVICE_OBJECT DeviceObject; - DPRINT("IopDeleteFile()\n"); - + /* Check if the file has a device object */ if (FileObject->DeviceObject) { /* Check if this is a direct open or not */ if (FileObject->Flags & FO_DIRECT_DEVICE_OPEN) { + /* Get the attached device */ DeviceObject = IoGetAttachedDevice(FileObject->DeviceObject); } else { + /* Use the file object's device object */ DeviceObject = IoGetRelatedDeviceObject(FileObject); + } + + /* Check if this file was opened for Synch I/O */ + if (FileObject->Flags & FO_SYNCHRONOUS_IO) + { + /* Lock it */ + IopLockFileObject(FileObject); } /* Clear and set up Events */ @@ -193,6 +201,7 @@ /* Allocate an IRP */ Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE); + if (!Irp) return; /* Set it up */ Irp->UserEvent = &Event; @@ -207,104 +216,129 @@ StackPtr->DeviceObject = DeviceObject; StackPtr->FileObject = FileObject; + /* Queue the IRP */ + //IopQueueIrpToThread(Irp); + /* Call the FS Driver */ Status = IoCallDriver(DeviceObject, Irp); - - /* Wait for completion */ if (Status == STATUS_PENDING) { + /* Wait for completion */ KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); } + + /* Free the IRP */ IoFreeIrp(Irp); - } - - /* Clear the file name */ - if (FileObject->FileName.Buffer) - { - ExFreePool(FileObject->FileName.Buffer); - FileObject->FileName.Buffer = NULL; - } - - /* Free the completion context */ - if (FileObject->CompletionContext) - { - ObDereferenceObject(FileObject->CompletionContext->Port); - ExFreePool(FileObject->CompletionContext); - } -} - -NTSTATUS -STDCALL -IopSecurityFile(PVOID ObjectBody, - SECURITY_OPERATION_CODE OperationCode, - SECURITY_INFORMATION SecurityInformation, - PSECURITY_DESCRIPTOR SecurityDescriptor, - PULONG BufferLength, - PSECURITY_DESCRIPTOR *OldSecurityDescriptor, - POOL_TYPE PoolType, - PGENERIC_MAPPING GenericMapping) + /* Clear the file name */ + if (FileObject->FileName.Buffer) + { + ExFreePool(FileObject->FileName.Buffer); + FileObject->FileName.Buffer = NULL; + } + + /* Check if the FO had a completion port */ + if (FileObject->CompletionContext) + { + /* Free it */ + ObDereferenceObject(FileObject->CompletionContext->Port); + ExFreePool(FileObject->CompletionContext); + } + } +} + +NTSTATUS +NTAPI +IopSecurityFile(IN PVOID ObjectBody, + IN SECURITY_OPERATION_CODE OperationCode, + IN SECURITY_INFORMATION SecurityInformation, + IN PSECURITY_DESCRIPTOR SecurityDescriptor, + IN OUT PULONG BufferLength, + IN OUT PSECURITY_DESCRIPTOR *OldSecurityDescriptor, + IN POOL_TYPE PoolType, + IN OUT PGENERIC_MAPPING GenericMapping) { IO_STATUS_BLOCK IoStatusBlock; PIO_STACK_LOCATION StackPtr; PFILE_OBJECT FileObject; PDEVICE_OBJECT DeviceObject; - ULONG MajorFunction; PIRP Irp; BOOLEAN LocalEvent = FALSE; KEVENT Event; NTSTATUS Status = STATUS_SUCCESS; - - DPRINT("IopSecurityFile() called\n"); - - FileObject = (PFILE_OBJECT)ObjectBody; - - if (OperationCode == QuerySecurityDescriptor) - { - MajorFunction = IRP_MJ_QUERY_SECURITY; - DPRINT("Query security descriptor\n"); + PAGED_CODE(); + + /* Check if this is a device or file */ + if (((PFILE_OBJECT)ObjectBody)->Type == IO_TYPE_DEVICE) + { + /* It's a device */ + DeviceObject = (PDEVICE_OBJECT)ObjectBody; + FileObject = NULL; + } + else + { + /* It's a file */ + FileObject = (PFILE_OBJECT)ObjectBody; + + /* Check if this is a direct open */ + if (FileObject->Flags & FO_DIRECT_DEVICE_OPEN) + { + /* Get the Device Object */ + DeviceObject = IoGetAttachedDevice(FileObject->DeviceObject); + } + else + { + /* Otherwise, use the direct device*/ + DeviceObject = FileObject->DeviceObject; + } + } + + /* Check if the request was for a device object */ + if (!(FileObject) || (FileObject->Flags & FO_DIRECT_DEVICE_OPEN)) + { + /* Check what kind of request this was */ + if (OperationCode == QuerySecurityDescriptor) + { + DPRINT1("FIXME: Device Query security descriptor UNHANDLED\n"); + return STATUS_SUCCESS; + } + else if (OperationCode == DeleteSecurityDescriptor) + { + /* Simply return success */ + return STATUS_SUCCESS; + } + else if (OperationCode == AssignSecurityDescriptor) + { + /* Make absolutely sure this is a device object */ + if (!(FileObject) || !(FileObject->Flags & FO_STREAM_FILE)) + { + /* Assign the Security Descriptor */ + DeviceObject->SecurityDescriptor = SecurityDescriptor; + } + + /* Return success */ + return STATUS_SUCCESS; + } + else + { + DPRINT1("FIXME: Set SD unimplemented for Devices\n"); + return STATUS_SUCCESS; + } } else if (OperationCode == DeleteSecurityDescriptor) { - DPRINT("Delete\n"); + /* Same as for devices, do nothing */ return STATUS_SUCCESS; } - else if (OperationCode == AssignSecurityDescriptor) - { - /* If this is a direct open, we can assign it */ - if (FileObject->Flags & FO_DIRECT_DEVICE_OPEN) - { - /* Get the Device Object */ - DPRINT("here\n"); - DeviceObject = IoGetAttachedDevice(FileObject->DeviceObject); - - /* Assign the Security Descriptor */ - DeviceObject->SecurityDescriptor = SecurityDescriptor; - } - return STATUS_SUCCESS; - } - else - { - MajorFunction = IRP_MJ_SET_SECURITY; - DPRINT("Set security descriptor\n"); - - /* If this is a direct open, we can set it */ - if (FileObject->Flags & FO_DIRECT_DEVICE_OPEN) - { - DPRINT1("Set SD unimplemented for Devices\n"); - return STATUS_SUCCESS; - } - } - - /* Get the Device Object */ - DPRINT1("FileObject: %p\n", FileObject); - DeviceObject = IoGetRelatedDeviceObject(FileObject); + + /* At this point, we know we're a file. Reference it */ + ObReferenceObject(FileObject); /* Check if we should use Sync IO or not */ if (FileObject->Flags & FO_SYNCHRONOUS_IO) { - /* Use File Object event */ - KeClearEvent(&FileObject->Event); + /* Lock the file object */ + IopLockFileObject(FileObject); } else { @@ -313,65 +347,95 @@ LocalEvent = TRUE; } + /* Clear the File Object event */ + KeClearEvent(&FileObject->Event); + + /* Get the device object */ + DeviceObject = IoGetRelatedDeviceObject(FileObject); + /* Allocate the IRP */ Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE); + if (!Irp) return IopCleanupFailedIrp(FileObject, NULL); /* Set the IRP */ Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); Irp->RequestorMode = ExGetPreviousMode(); Irp->UserIosb = &IoStatusBlock; Irp->UserEvent = (LocalEvent) ? &Event : NULL; Irp->Flags = (LocalEvent) ? IRP_SYNCHRONOUS_API : 0; - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + Irp->Overlay.AsynchronousParameters.UserApcRoutine = NULL; /* Set Stack Parameters */ StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->MajorFunction = MajorFunction; StackPtr->FileObject = FileObject; - /* Set Parameters */ + /* Check if this is a query or set */ if (OperationCode == QuerySecurityDescriptor) { - StackPtr->Parameters.QuerySecurity.SecurityInformation = SecurityInformation; + /* Set the major function and parameters */ + StackPtr->MajorFunction = IRP_MJ_QUERY_SECURITY; + StackPtr->Parameters.QuerySecurity.SecurityInformation = + SecurityInformation; StackPtr->Parameters.QuerySecurity.Length = *BufferLength; Irp->UserBuffer = SecurityDescriptor; } else { - StackPtr->Parameters.SetSecurity.SecurityInformation = SecurityInformation; - StackPtr->Parameters.SetSecurity.SecurityDescriptor = SecurityDescriptor; - } - - ObReferenceObject(FileObject); + /* Set the major function and parameters for a set */ + StackPtr->MajorFunction = IRP_MJ_SET_SECURITY; + StackPtr->Parameters.SetSecurity.SecurityInformation = + SecurityInformation; + StackPtr->Parameters.SetSecurity.SecurityDescriptor = + SecurityDescriptor; + } + + /* Queue the IRP */ + //IopQueueIrpToThread(Irp); + + /* Update operation counts */ + IopUpdateOperationCount(IopOtherTransfer); /* Call the Driver */ Status = IoCallDriver(FileObject->DeviceObject, Irp); - if (Status == STATUS_PENDING) - { - if (LocalEvent) - { + /* Check if this was async I/O */ + if (LocalEvent) + { + /* Check if the IRP is pending completion */ + if (Status == STATUS_PENDING) + { + /* Wait on the local event */ KeWaitForSingleObject(&Event, Executive, KernelMode, - FileObject->Flags & FO_ALERTABLE_IO, + FALSE, NULL); Status = IoStatusBlock.Status; } - else - { + } + else + { + /* Check if the IRP is pending completion */ + if (Status == STATUS_PENDING) + { + /* Wait on the file obejct */ KeWaitForSingleObject(&FileObject->Event, Executive, KernelMode, - FileObject->Flags & FO_ALERTABLE_IO, + FALSE, NULL); Status = FileObject->FinalStatus; } + + /* Release the lock */ + IopUnlockFileObject(FileObject); } /* This Driver doesn't implement Security, so try to give it a default */ if (Status == STATUS_INVALID_DEVICE_REQUEST) { + /* Was this a query? */ if (OperationCode == QuerySecurityDescriptor) { /* Set a World Security Descriptor */ @@ -387,6 +451,9 @@ } else if (OperationCode == QuerySecurityDescriptor) { + /* Callers usually expect the normalized form */ + if (Status == STATUS_BUFFER_OVERFLOW) Status = STATUS_BUFFER_TOO_SMALL; + /* Return length */ *BufferLength = IoStatusBlock.Information; } Modified: trunk/reactos/ntoskrnl/io/iomgr/iofunc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iofunc.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/iofunc.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/iofunc.c Wed Jul 5 02:28:23 2006 @@ -34,74 +34,6 @@ /// /* PRIVATE FUNCTIONS *********************************************************/ - -/* DON'T inline this: it's a failure case */ -NTSTATUS -NTAPI -IopCleanupFailedIrp(IN PFILE_OBJECT FileObject, - IN PKEVENT EventObject) -{ - PAGED_CODE(); - - /* Dereference the event */ - if (EventObject) ObDereferenceObject(EventObject); - - /* If this was a file opened for synch I/O, then unlock it */ - if (FileObject->Flags & FO_SYNCHRONOUS_IO) IopUnlockFileObject(FileObject); - - /* Now dereference it and return */ - ObDereferenceObject(FileObject); - return STATUS_INSUFFICIENT_RESOURCES; -} - -/* DON'T inline this: it's a failure case */ -VOID -NTAPI -IopAbortInterruptedIrp(IN PKEVENT EventObject, - IN PIRP Irp) -{ - KIRQL OldIrql; - BOOLEAN CancelResult; - LARGE_INTEGER Wait; - PAGED_CODE(); - - /* Raise IRQL to APC */ - KeRaiseIrql(APC_LEVEL, &OldIrql); - - /* Check if nobody completed it yet */ - if (!KeReadStateEvent(EventObject)) - { - /* First, cancel it */ - CancelResult = IoCancelIrp(Irp); - KeLowerIrql(OldIrql); - - /* Check if we cancelled it */ - if (CancelResult) - { - /* Wait for the IRP to be cancelled */ - Wait.QuadPart = -100000; - while (!KeReadStateEvent(EventObject)) - { - /* Delay indefintely */ - KeDelayExecutionThread(KernelMode, FALSE, &Wait); - } - } - else - { - /* No cancellation done, so wait for the I/O system to kill it */ - KeWaitForSingleObject(EventObject, - Executive, - KernelMode, - FALSE, - NULL); - } - } - else - { - /* We got preempted, so give up */ - KeLowerIrql(OldIrql); - } -} NTSTATUS NTAPI Modified: trunk/reactos/ntoskrnl/io/iomgr/irp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/irp.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/irp.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/irp.c Wed Jul 5 02:28:23 2006 @@ -38,6 +38,72 @@ { /* Free the IRP */ IoFreeIrp(CONTAINING_RECORD(Apc, IRP, Tail.Apc)); +} + +NTSTATUS +NTAPI +IopCleanupFailedIrp(IN PFILE_OBJECT FileObject, + IN PKEVENT EventObject) +{ + PAGED_CODE(); + + /* Dereference the event */ + if (EventObject) ObDereferenceObject(EventObject); + + /* If this was a file opened for synch I/O, then unlock it */ + if (FileObject->Flags & FO_SYNCHRONOUS_IO) IopUnlockFileObject(FileObject); + + /* Now dereference it and return */ + ObDereferenceObject(FileObject); + return STATUS_INSUFFICIENT_RESOURCES; +} + +VOID +NTAPI +IopAbortInterruptedIrp(IN PKEVENT EventObject, + IN PIRP Irp) +{ + KIRQL OldIrql; + BOOLEAN CancelResult; + LARGE_INTEGER Wait; + PAGED_CODE(); + + /* Raise IRQL to APC */ + KeRaiseIrql(APC_LEVEL, &OldIrql); + + /* Check if nobody completed it yet */ + if (!KeReadStateEvent(EventObject)) + { + /* First, cancel it */ + CancelResult = IoCancelIrp(Irp); + KeLowerIrql(OldIrql); + + /* Check if we cancelled it */ + if (CancelResult) + { + /* Wait for the IRP to be cancelled */ + Wait.QuadPart = -100000; + while (!KeReadStateEvent(EventObject)) + { + /* Delay indefintely */ + KeDelayExecutionThread(KernelMode, FALSE, &Wait); + } + } + else + { + /* No cancellation done, so wait for the I/O system to kill it */ + KeWaitForSingleObject(EventObject, + Executive, + KernelMode, + FALSE, + NULL); + } + } + else + { + /* We got preempted, so give up */ + KeLowerIrql(OldIrql); + } } VOID
18 years, 4 months
1
0
0
0
[gedmurphy] 22850: update Wine doc
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Wed Jul 5 01:45:05 2006 New Revision: 22850 URL:
http://svn.reactos.org/svn/reactos?rev=22850&view=rev
Log: update Wine doc Modified: trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE (original) +++ trunk/reactos/media/doc/README.WINE Wed Jul 5 01:45:05 2006 @@ -39,7 +39,7 @@ reactos/dll/win32/avifil32 # Synced to Wine-0_9_5 reactos/dll/win32/cabinet # Synced to Wine-0_9_10 -reactos/dll/win32/comctl32 # Synced to Wine-20060328 +reactos/dll/win32/comctl32 # Synced to Wine-0_9_16 reactos/dll/win32/comdlg32 # Synced to Wine-0_9_5 reactos/dll/win32/crypt32 # Synced to Wine-0_9_10 reactos/dll/win32/dbghelp #
18 years, 4 months
1
0
0
0
[gedmurphy] 22849: Sync to Wine-0_9_16: Alexandre Julliard <julliard@winehq.org> - comctl32: Don't use sizeof in traces to avoid printf format warnings. Dmitry Timoshkov <dmitry@codeweavers.com> - comctl32: Return FALSE in the WM_CLOSE PROPSHEET_DialogProc handler. Mike McCormack <mike@codeweavers.com> - comctl32: Use the listview's background colour when drawing with imagelist. - comctl32: Arrange the listview after deleting all items so we will place iconsat the top again.
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Wed Jul 5 01:33:34 2006 New Revision: 22849 URL:
http://svn.reactos.org/svn/reactos?rev=22849&view=rev
Log: Sync to Wine-0_9_16: Alexandre Julliard <julliard(a)winehq.org> - comctl32: Don't use sizeof in traces to avoid printf format warnings. Dmitry Timoshkov <dmitry(a)codeweavers.com> - comctl32: Return FALSE in the WM_CLOSE PROPSHEET_DialogProc handler. Mike McCormack <mike(a)codeweavers.com> - comctl32: Use the listview's background colour when drawing with imagelist. - comctl32: Arrange the listview after deleting all items so we will place iconsat the top again. Modified: trunk/reactos/dll/win32/comctl32/comctl_Cn.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_Cs.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_De.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_En.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_Eo.rc (props changed) trunk/reactos/dll/win32/comctl32/comctl_Es.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_Fr.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_Hu.rc (props changed) trunk/reactos/dll/win32/comctl32/comctl_It.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_Ja.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_Ko.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_Nl.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_Pl.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_Pt.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_Ru.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_Si.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_Th.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/comctl_Tr.rc (props changed) trunk/reactos/dll/win32/comctl32/comctl_Uk.rc (contents, props changed) trunk/reactos/dll/win32/comctl32/listview.c trunk/reactos/dll/win32/comctl32/propsheet.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/comctl32/comctl_Cn.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_Cs.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_De.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_En.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_Es.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_Fr.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_It.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_Ja.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_Ko.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_Nl.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_Pl.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_Pt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_Ru.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_Si.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_Th.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/comctl_Uk.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl_…
Modified: trunk/reactos/dll/win32/comctl32/listview.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/listvie…
Modified: trunk/reactos/dll/win32/comctl32/propsheet.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/propshe…
18 years, 4 months
1
0
0
0
[gedmurphy] 22848: update ROS code to call new tests
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Wed Jul 5 01:05:16 2006 New Revision: 22848 URL:
http://svn.reactos.org/svn/reactos?rev=22848&view=rev
Log: update ROS code to call new tests Modified: trunk/reactos/regtests/winetests/comctl32/testlist.c Modified: trunk/reactos/regtests/winetests/comctl32/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/regtests/winetests/comctl3…
============================================================================== --- trunk/reactos/regtests/winetests/comctl32/testlist.c (original) +++ trunk/reactos/regtests/winetests/comctl32/testlist.c Wed Jul 5 01:05:16 2006 @@ -1,5 +1,3 @@ -/* Automatically generated file; DO NOT EDIT!! */ - #define WIN32_LEAN_AND_MEAN #include <windows.h> @@ -10,6 +8,7 @@ extern void func_dpa(void); extern void func_header(void); extern void func_imagelist(void); +extern void func_listview(void); extern void func_monthcal(void); extern void func_mru(void); extern void func_progress(void); @@ -27,6 +26,7 @@ { "dpa", func_dpa }, { "header", func_header }, { "imagelist", func_imagelist }, + { "listview", func_listview }, { "monthcal", func_monthcal }, { "mru", func_mru }, { "progress", func_progress },
18 years, 4 months
1
0
0
0
[gedmurphy] 22847: update comctl32 regression tests to Wine-0_9_16, which now includes listview testing
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Wed Jul 5 00:58:29 2006 New Revision: 22847 URL:
http://svn.reactos.org/svn/reactos?rev=22847&view=rev
Log: update comctl32 regression tests to Wine-0_9_16, which now includes listview testing Added: trunk/reactos/regtests/winetests/comctl32/listview.c Modified: trunk/reactos/regtests/winetests/comctl32/comctl32.rbuild trunk/reactos/regtests/winetests/comctl32/header.c trunk/reactos/regtests/winetests/comctl32/mru.c Modified: trunk/reactos/regtests/winetests/comctl32/comctl32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/regtests/winetests/comctl3…
============================================================================== --- trunk/reactos/regtests/winetests/comctl32/comctl32.rbuild (original) +++ trunk/reactos/regtests/winetests/comctl32/comctl32.rbuild Wed Jul 5 00:58:29 2006 @@ -10,6 +10,7 @@ <file>dpa.c</file> <file>header.c</file> <file>imagelist.c</file> + <file>listview.c</file> <file>monthcal.c</file> <file>mru.c</file> <file>progress.c</file> Modified: trunk/reactos/regtests/winetests/comctl32/header.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/regtests/winetests/comctl3…
============================================================================== --- trunk/reactos/regtests/winetests/comctl32/header.c (original) +++ trunk/reactos/regtests/winetests/comctl32/header.c Wed Jul 5 00:58:29 2006 @@ -225,7 +225,7 @@ /* Windows implicitly sets some format bits in INSERTITEM */ - /* HDF_STRING is automaticaly set and cleared for no text */ + /* HDF_STRING is automatically set and cleared for no text */ hdiCreate.mask = HDI_TEXT|HDI_WIDTH|HDI_FORMAT; hdiCreate.pszText = text; hdiCreate.cxy = 100; Added: trunk/reactos/regtests/winetests/comctl32/listview.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/regtests/winetests/comctl3…
============================================================================== --- trunk/reactos/regtests/winetests/comctl32/listview.c (added) +++ trunk/reactos/regtests/winetests/comctl32/listview.c Wed Jul 5 00:58:29 2006 @@ -1,0 +1,97 @@ +/* + * ListView tests + * + * Copyright 2006 Mike McCormack for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdio.h> +#include <windows.h> +#include <commctrl.h> + +#include "wine/test.h" + +START_TEST(listview) +{ + HWND hwnd, hwndparent = 0; + INITCOMMONCONTROLSEX icc; + DWORD r; + LVITEM item; + HIMAGELIST himl; + HBITMAP hbmp; + RECT r1, r2; + + icc.dwICC = 0; + icc.dwSize = sizeof icc; + InitCommonControlsEx(&icc); + + himl = ImageList_Create(40, 40, 0, 4, 4); + ok(himl != NULL, "failed to create imagelist\n"); + + hbmp = CreateBitmap(40, 40, 1, 1, NULL); + ok(hbmp != NULL, "failed to create bitmap\n"); + + r = ImageList_Add(himl, hbmp, 0); + ok(r == 0, "should be zero\n"); + + hwnd = CreateWindowEx(0, "SysListView32", "foo", LVS_OWNERDRAWFIXED, + 10, 10, 100, 200, hwndparent, NULL, NULL, NULL); + ok(hwnd != NULL, "failed to create listview window\n"); + + r = SendMessage(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, 0x940); + ok(r == 0, "should return zero\n"); + + r = SendMessage(hwnd, LVM_SETIMAGELIST, 0, (LPARAM)himl); + ok(r == 0, "should return zero\n"); + + r = SendMessage(hwnd, LVM_SETICONSPACING, 0, MAKELONG(100,50)); + /* returns dimensions */ + + r = SendMessage(hwnd, LVM_GETITEMCOUNT, 0, 0); + ok(r == 0, "should be zero items\n"); + + item.mask = LVIF_IMAGE | LVIF_TEXT; + item.iItem = 0; + item.iSubItem = 1; + item.iImage = 0; + r = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM) &item); + ok(r == -1, "should fail\n"); + + item.iSubItem = 0; + item.pszText = "hello"; + r = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM) &item); + ok(r == 0, "should not fail\n"); + + memset(&r1, 0, sizeof r1); + r1.left = LVIR_ICON; + r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM) &r1); + + r = SendMessage(hwnd, LVM_DELETEALLITEMS, 0, 0); + ok(r == TRUE, "should not fail\n"); + + item.iSubItem = 0; + item.pszText = "hello"; + r = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM) &item); + ok(r == 0, "should not fail\n"); + + memset(&r2, 0, sizeof r2); + r2.left = LVIR_ICON; + r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM) &r2); + + ok(!memcmp(&r1, &r2, sizeof r1), "rectangle should be the same\n"); + + DestroyWindow(hwnd); +} Modified: trunk/reactos/regtests/winetests/comctl32/mru.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/regtests/winetests/comctl3…
============================================================================== --- trunk/reactos/regtests/winetests/comctl32/mru.c (original) +++ trunk/reactos/regtests/winetests/comctl32/mru.c Wed Jul 5 00:58:29 2006 @@ -100,7 +100,7 @@ char buff[128]; HKEY hKey = NULL; DWORD type, size, ret; - size_t i; + unsigned int i; ok(!RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_FULLKEY, &hKey), "Couldn't open test key \"%s\"\n", REG_TEST_FULLKEY);
18 years, 4 months
1
0
0
0
[gedmurphy] 22846: delete previous tag
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Wed Jul 5 00:46:09 2006 New Revision: 22846 URL:
http://svn.reactos.org/svn/reactos?rev=22846&view=rev
Log: delete previous tag Removed: vendor/wine/dlls/comctl32/wine-0_9_15/
18 years, 4 months
1
0
0
0
← Newer
1
...
52
53
54
55
56
57
58
...
67
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Results per page:
10
25
50
100
200