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
September 2009
----- 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
16 participants
270 discussions
Start a n
N
ew thread
[janderwald] 43226: - Italian & english translation of ks.inf - Patch by Gabriel Ilardi (gabriel_it)
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Sep 29 20:03:41 2009 New Revision: 43226 URL:
http://svn.reactos.org/svn/reactos?rev=43226&view=rev
Log: - Italian & english translation of ks.inf - Patch by Gabriel Ilardi (gabriel_it) Modified: trunk/reactos/media/inf/ks.inf Modified: trunk/reactos/media/inf/ks.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/ks.inf?rev=43226…
============================================================================== Binary files - no diff available.
15 years, 2 months
1
0
0
0
[fireball] 43225: [fastfat_new] - Add directory path parsing which tries to find existing FCBs for path names. - Add a framework for creating DCBs during path dissection. Currently just prints out path names. - Cleanup fcb.c, Alexey Vlasov's version was great, but it is a bit different from what I want to implement now.
by fireball@svn.reactos.org
Author: fireball Date: Tue Sep 29 15:09:16 2009 New Revision: 43225 URL:
http://svn.reactos.org/svn/reactos?rev=43225&view=rev
Log: [fastfat_new] - Add directory path parsing which tries to find existing FCBs for path names. - Add a framework for creating DCBs during path dissection. Currently just prints out path names. - Cleanup fcb.c, Alexey Vlasov's version was great, but it is a bit different from what I want to implement now. Modified: trunk/reactos/drivers/filesystems/fastfat_new/create.c trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h trunk/reactos/drivers/filesystems/fastfat_new/fcb.c Modified: trunk/reactos/drivers/filesystems/fastfat_new/create.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/create.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/create.c [iso-8859-1] Tue Sep 29 15:09:16 2009 @@ -10,6 +10,16 @@ #define NDEBUG #include "fastfat.h" + +NTSYSAPI +NTSTATUS +NTAPI +RtlUpcaseUnicodeStringToCountedOemString( + IN OUT POEM_STRING DestinationString, + IN PCUNICODE_STRING SourceString, + IN BOOLEAN AllocateDestinationString +); + /* FUNCTIONS *****************************************************************/ @@ -52,7 +62,7 @@ /* Control blocks */ PVCB Vcb, DecodedVcb; - PFCB Fcb; + PFCB Fcb, NextFcb; PCCB Ccb; PFCB ParentDcb; @@ -72,6 +82,11 @@ NTSTATUS Status; IO_STATUS_BLOCK Iosb; PIO_STACK_LOCATION IrpSp; + BOOLEAN EndBackslash = FALSE, OpenedAsDos; + UNICODE_STRING RemainingPart, FirstName, NextName; + OEM_STRING AnsiFirstName; + + Iosb.Status = STATUS_SUCCESS; /* Get current IRP stack location */ IrpSp = IoGetCurrentIrpStackLocation(Irp); @@ -266,10 +281,178 @@ ParentDcb = Vcb->RootDcb; DPRINT1("ParentDcb %p\n", ParentDcb); } - } - - //return Iosb.Status; - return STATUS_SUCCESS; + + /* Check for backslash at the end */ + if (FileName.Length && + FileName.Buffer[FileName.Length / sizeof(WCHAR) - 1] == L'\\') + { + /* Cut it out */ + FileName.Length -= sizeof(WCHAR); + + /* Remember we cut it */ + EndBackslash = TRUE; + } + + /* Ensure the name is set */ + if (!ParentDcb->FullFileName.Buffer) + { + DPRINT1("ParentDcb->FullFileName.Buffer is NULL\n"); + } + + /* Check max path length */ + if (ParentDcb->FullFileName.Length + FileName.Length + sizeof(WCHAR) <= FileName.Length) + { + DPRINT1("Max length is way off\n"); + Iosb.Status = STATUS_OBJECT_NAME_INVALID; + ASSERT(FALSE); + } + + /* Loop through FCBs to find a good one */ + while (TRUE) + { + Fcb = ParentDcb; + + /* Dissect the name */ + RemainingPart = FileName; + while (RemainingPart.Length) + { + FsRtlDissectName(RemainingPart, &FirstName, &NextName); + + /* Check for validity */ + if ((NextName.Length && NextName.Buffer[0] == L'\\') || + (NextName.Length > 255 * sizeof(WCHAR))) + { + /* The name is invalid */ + DPRINT1("Invalid name found\n"); + Iosb.Status = STATUS_OBJECT_NAME_INVALID; + ASSERT(FALSE); + } + + /* Convert the name to ANSI */ + AnsiFirstName.Buffer = ExAllocatePool(PagedPool, FirstName.Length); + AnsiFirstName.Length = 0; + AnsiFirstName.MaximumLength = FirstName.Length; + Status = RtlUpcaseUnicodeStringToCountedOemString(&AnsiFirstName, &FirstName, FALSE); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlUpcaseUnicodeStringToCountedOemString() failed with 0x%08x\n", Status); + ASSERT(FALSE); + NextFcb = NULL; + AnsiFirstName.Length = 0; + } + else + { + /* Find the coresponding FCB */ + NextFcb = FatFindFcb(IrpContext, + &Fcb->Dcb.SplayLinksAnsi, + (PSTRING)&AnsiFirstName, + &OpenedAsDos); + } + + /* Check if we found anything */ + if (!NextFcb && Fcb->Dcb.SplayLinksUnicode) + { + ASSERT(FALSE); + } + + /* Move to the next FCB */ + if (NextFcb) + { + Fcb = NextFcb; + RemainingPart = NextName; + } + + /* Break out of this loop if nothing can be found */ + if (!NextFcb || + NextName.Length == 0 || + FatNodeType(NextFcb) == FAT_NTC_FCB) + { + break; + } + } + + /* Ensure remaining name doesn't start from a backslash */ + if (RemainingPart.Length && + RemainingPart.Buffer[0] == L'\\') + { + /* Cut it */ + RemainingPart.Buffer++; + RemainingPart.Length -= sizeof(WCHAR); + } + + if (Fcb->Condition == FcbGood) + { + /* Good FCB, break out of the loop */ + break; + } + else + { + ASSERT(FALSE); + } + } + + /* We have a valid FCB now */ + if (!RemainingPart.Length) + { + DPRINT1("It's possible to open an existing FCB\n"); + ASSERT(FALSE); + } + + /* During parsing we encountered a part which has no attached FCB/DCB. + Check that the parent is really DCB and not FCB */ + if (FatNodeType(Fcb) != FAT_NTC_ROOT_DCB && + FatNodeType(Fcb) != FAT_NTC_DCB) + { + DPRINT1("Weird FCB node type %x, expected DCB or root DCB\n", FatNodeType(Fcb)); + ASSERT(FALSE); + } + + /* Create additional DCBs for all path items */ + ParentDcb = Fcb; + while (TRUE) + { + FsRtlDissectName(RemainingPart, &FirstName, &RemainingPart); + + /* Check for validity */ + if ((RemainingPart.Length && RemainingPart.Buffer[0] == L'\\') || + (NextName.Length > 255 * sizeof(WCHAR))) + { + /* The name is invalid */ + DPRINT1("Invalid name found\n"); + Iosb.Status = STATUS_OBJECT_NAME_INVALID; + ASSERT(FALSE); + } + + /* Convert the name to ANSI */ + AnsiFirstName.Buffer = ExAllocatePool(PagedPool, FirstName.Length); + AnsiFirstName.Length = 0; + AnsiFirstName.MaximumLength = FirstName.Length; + Status = RtlUpcaseUnicodeStringToCountedOemString(&AnsiFirstName, &FirstName, FALSE); + + if (!NT_SUCCESS(Status)) + { + ASSERT(FALSE); + } + + DPRINT1("FirstName %wZ, RemainingPart %wZ\n", &FirstName, &RemainingPart); + + /* Break if came to the end */ + if (!RemainingPart.Length) break; + + // TODO: Create a DCB for this entry + } + + // Simulate that we opened the file + //Iosb.Information = FILE_OPENED; + Irp->IoStatus.Information = FILE_OPENED; + FileObject->SectionObjectPointer = (PSECTION_OBJECT_POINTERS)0x1; + } + + /* Complete the request */ + FatCompleteRequest(IrpContext, Irp, Iosb.Status); + + return Iosb.Status; } NTSTATUS Modified: trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] Tue Sep 29 15:09:16 2009 @@ -152,6 +152,14 @@ OUT PVCB *Vcb, OUT PFCB *FcbOrDcb, OUT PCCB *Ccb); + +/* --------------------------------------------------------- fcb.c */ + +PFCB NTAPI +FatFindFcb(PFAT_IRP_CONTEXT IrpContext, + PRTL_SPLAY_LINKS *RootNode, + PSTRING AnsiName, + PBOOLEAN IsDosName); /* --------------------------------------------------------- fullfat.c */ Modified: trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h [iso-8859-1] Tue Sep 29 15:09:16 2009 @@ -221,13 +221,14 @@ } FCB_NAME_TYPE; typedef struct _FCB_NAME_LINK { + struct _FCB *Fcb; RTL_SPLAY_LINKS Links; union { OEM_STRING Ansi; UNICODE_STRING String; } Name; - UCHAR Type; + BOOLEAN IsDosName; } FCB_NAME_LINK, *PFCB_NAME_LINK; typedef enum _FCB_CONDITION @@ -287,7 +288,9 @@ PFILE_OBJECT StreamFileObject; /* Bitmap to search for free dirents. */ RTL_BITMAP FreeBitmap; - PRTL_SPLAY_LINKS SplayLinks; + /* Names */ + PRTL_SPLAY_LINKS SplayLinksAnsi; + PRTL_SPLAY_LINKS SplayLinksUnicode; } Dcb; }; } FCB, *PFCB; Modified: trunk/reactos/drivers/filesystems/fastfat_new/fcb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fcb.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fcb.c [iso-8859-1] Tue Sep 29 15:09:16 2009 @@ -3,7 +3,7 @@ * LICENSE: GPL - See COPYING in the top level directory * FILE: drivers/filesystems/fastfat/fcb.c * PURPOSE: FCB manipulation routines. - * PROGRAMMERS: Alexey Vlasov + * PROGRAMMERS: Aleksey Bragin <aleksey(a)reactos.org> */ /* INCLUDES *****************************************************************/ @@ -12,318 +12,98 @@ #include "fastfat.h" /* FUNCTIONS ****************************************************************/ -#if 0 -/** - * Locates FCB by the supplied name in the cache trie of fcbs. - * - * @param ParentFcb - * Supplies a pointer to the parent FCB - * - * @param Name - * Supplied a name of the FCB to be located in cache. - * - * @return - * Pointer to the found FCB or NULL. - */ + +FSRTL_COMPARISON_RESULT +NTAPI +FatiCompareNames(PSTRING NameA, + PSTRING NameB) +{ + ULONG MinimumLen, i; + + /* Calc the minimum length */ + MinimumLen = NameA->Length < NameB->Length ? NameA->Length : + NameB->Length; + + /* Actually compare them */ + i = (ULONG)RtlCompareMemory( NameA->Buffer, NameB->Buffer, MinimumLen ); + + if (i < MinimumLen) + { + /* Compare prefixes */ + if (NameA->Buffer[i] < NameB->Buffer[i]) + return LessThan; + else + return GreaterThan; + } + + /* Final comparison */ + if (NameA->Length < NameB->Length) + return LessThan; + else if (NameA->Length > NameB->Length) + return GreaterThan; + else + return EqualTo; +} + PFCB -FatLookupFcbByName( - IN PFCB ParentFcb, - IN PUNICODE_STRING Name) +NTAPI +FatFindFcb(PFAT_IRP_CONTEXT IrpContext, + PRTL_SPLAY_LINKS *RootNode, + PSTRING AnsiName, + PBOOLEAN IsDosName) { PFCB_NAME_LINK Node; - PRTL_SPLAY_LINKS Links; + FSRTL_COMPARISON_RESULT Comparison; + PRTL_SPLAY_LINKS Links; - /* Get sub-trie root node from the parent FCB */ - Links = ParentFcb->Dcb.SplayLinks; - while (Links != NULL) - { - LONG Comparison; + Links = *RootNode; - Node = CONTAINING_RECORD(Links, FCB_NAME_LINK, Links); + while (Links) + { + Node = CONTAINING_RECORD(Links, FCB_NAME_LINK, Links); - /* - * Compare the name stored in the node - * and determine the direction to walk. - */ - Comparison = RtlCompareUnicodeString(&Node->String, Name, TRUE); - if (Comparison > 0) { - /* Left child */ - Links = RtlLeftChild(&Node->Links); - } - else if (Comparison < 0) - { - /* Right child */ - Links = RtlRightChild(&Node->Links); - } - else - { - /* Strings are equal, we have found the node! */ - break; - } - } + /* Compare the prefix */ + if (*(PUCHAR)Node->Name.Ansi.Buffer != *(PUCHAR)AnsiName->Buffer) + { + if (*(PUCHAR)Node->Name.Ansi.Buffer < *(PUCHAR)AnsiName->Buffer) + Comparison = LessThan; + else + Comparison = GreaterThan; + } + else + { + /* Perform real comparison */ + Comparison = FatiCompareNames(&Node->Name.Ansi, AnsiName); + } - /* The case when nothing was found. */ - if (Links == NULL) - return NULL; + /* Do they match? */ + if (Comparison == GreaterThan) + { + /* No, it's greater, go to the left child */ + Links = RtlLeftChild(Links); + } + else if (Comparison == LessThan) + { + /* No, it's lesser, go to the right child */ + Links = RtlRightChild(Links); + } + else + { + /* Exact match, balance the tree */ + *RootNode = RtlSplay(Links); - /* Cast node to the FCB structure. */ - return CONTAINING_RECORD(Links, FCB, FileName[Node->Type]); + /* Save type of the name, if needed */ + if (IsDosName) + *IsDosName = Node->IsDosName; + + /* Return the found fcb */ + return Node->Fcb; + } + } + + /* Nothing found */ + return NULL; } -/** - * Inserts FCB into FCBs cache trie. - * - * @param ParentFcb - * Supplies a pointer to the parent FCB - * - * @param Fcb - * Supplied a pointer to the being inserted FCB. - * - * @return - * TRUE if the FCB was successfully inserted, - * FASLE in the case of name collision. - */ -BOOLEAN -FatLinkFcbNames( - IN PFCB ParentFcb, - IN PFCB Fcb) -{ - PFCB_NAME_LINK Name; - PRTL_SPLAY_LINKS Links; - - /* None of the parameters can be NULL */ - ASSERT(ParentFcb != NULL && Fcb != NULL); - /* Get root links of the parent FCB. */ - Links = ParentFcb->Dcb.SplayLinks; - - /* - * Get first file name - * (short name for FAT because it's always there. - */ - Name = Fcb->FileName; - - /* - * Check if ParentDcb links are initialized, - * at least one child FCB is cached. - */ - if (Links == NULL) - { - ParentFcb->Dcb.SplayLinks = Links = &Name->Links; - RtlInitializeSplayLinks(Links); - - /* Check if we have more names to cache. */ - if ((++Name)->String.Length == 0) - return TRUE; - } - /* Lookup for the insertion point in the trie. */ - do - { - LONG Comparison; - PFCB_NAME_LINK Node; - PRTL_SPLAY_LINKS PrevLinks; - - PrevLinks = Links; - Node = CONTAINING_RECORD(Links, FCB_NAME_LINK, Links); - Comparison = RtlCompareUnicodeString(&Node->String, &Name->String, TRUE); - if (Comparison > 0) { - Links = RtlLeftChild(&Node->Links); - if (Links == NULL) - { - RtlInsertAsLeftChild(PrevLinks, &Name->Links); - break; - } - } - else if (Comparison < 0) - { - Links = RtlRightChild(&Node->Links); - if (Links == NULL) - { - RtlInsertAsRightChild(PrevLinks, &Name->Links); - break; - } - } - else - { - return FALSE; - } - - /* Possibly switch to the second (lfn) name and cache that. */ - } while (Name == Fcb->FileName && (++Name)->String.Length > 0); - return TRUE; -} - -/** - * Unlinks FCB from the FCBs cache trie. - * - * @param ParentFcb - * Supplies a pointer to the parent FCB - * - * @param Fcb - * Supplied a pointer to the being unlinked FCB. - * - * @return - * VOID - */ -VOID -FatUnlinkFcbNames( - IN PFCB ParentFcb, - IN PFCB Fcb) -{ - /* See if there is an lfn and unlink that. */ - if (Fcb->FileName[FcbLongName].String.Length > 0) - ParentFcb->Dcb.SplayLinks = - RtlDelete(&Fcb->FileName[FcbLongName].Links); - - /* See if there is a short name and unlink that. */ - if (Fcb->FileName[FcbShortName].String.Length > 0) - ParentFcb->Dcb.SplayLinks = - RtlDelete(&Fcb->FileName[FcbShortName].Links); -} - -NTSTATUS -FatCreateFcb( - OUT PFCB* CreatedFcb, - IN PFAT_IRP_CONTEXT IrpContext, - IN PFCB ParentFcb, - IN PDIR_ENTRY Dirent, - IN PUNICODE_STRING FileName, - IN PUNICODE_STRING LongFileName OPTIONAL) -{ - NTSTATUS Status; - PFCB Fcb; - - /* Allocate FCB structure. */ - Fcb = (PFCB) ExAllocateFromNPagedLookasideList(&FatGlobalData.NonPagedFcbList); - if (Fcb == NULL) - return STATUS_INSUFFICIENT_RESOURCES; - RtlZeroMemory(Fcb, sizeof(FCB)); - - /* Setup FCB Advanced Header. */ - Fcb->Header.NodeTypeCode = FAT_NTC_FCB; - Fcb->Header.NodeByteSize = sizeof(*Fcb); - ExInitializeResourceLite(&Fcb->Resource); - Fcb->Header.Resource = &Fcb->Resource; - ExInitializeResourceLite(&Fcb->PagingIoResource); - Fcb->Header.PagingIoResource = &Fcb->PagingIoResource; - ExInitializeFastMutex(&Fcb->HeaderMutex); - FsRtlSetupAdvancedHeader(&Fcb->Header, &Fcb->HeaderMutex); - Fcb->Header.FileSize.QuadPart = Dirent->FileSize; - Fcb->Header.ValidDataLength.QuadPart = Dirent->FileSize; - Fcb->Header.IsFastIoPossible = FastIoIsNotPossible; - - /* Setup main fields. */ - FsRtlInitializeFileLock(&Fcb->Lock, NULL, NULL); - FsRtlInitializeLargeMcb(&Fcb->Mcb, PagedPool); - Fcb->Vcb = IrpContext->Vcb; - Fcb->ParentFcb = ParentFcb; - Fcb->FirstCluster = Dirent->FirstCluster - | (Dirent->FirstClusterOfFileHi << 0x10); - - /* Setup basic info. */ - Fcb->BasicInfo.FileAttributes = Dirent->Attributes; - FatQueryFileTimes(&Fcb->BasicInfo.CreationTime, Dirent); - - /* Setup short name since always present in FAT. */ - Fcb->FileName[FcbShortName].Type = FcbShortName; - Fcb->FileName[FcbShortName].String.Buffer = Fcb->ShortNameBuffer; - Fcb->FileName[FcbShortName].String.MaximumLength = 0x0c; - Fcb->FileName[FcbShortName].String.Length = FileName->Length; - RtlCopyMemory(Fcb->ShortNameBuffer, FileName->Buffer, FileName->Length); - - /* Just swap optional lfn. */ - if (ARGUMENT_PRESENT(LongFileName) && LongFileName->Length > 0) - { - Fcb->FileName[FcbLongName].Type = FcbLongName; - Fcb->FileName[FcbLongName].String = *LongFileName; - RtlZeroMemory(LongFileName, sizeof(UNICODE_STRING)); - } - - /* Put FCB into cache trie. */ - if (!FatLinkFcbNames(ParentFcb, Fcb)) - { - Status = STATUS_OBJECT_NAME_COLLISION; - goto FsdFatCreateFcbCleanup; - } - *CreatedFcb = Fcb; - - /* We are done! */ - return STATUS_SUCCESS; - -FsdFatCreateFcbCleanup: - if (ARGUMENT_PRESENT(LongFileName) && - Fcb->FileName[FcbLongName].String.Buffer != NULL) - { - /* Swap lfn back to the input parameter */ - *LongFileName = Fcb->FileName[FcbLongName].String; - } - ExFreeToNPagedLookasideList(&FatGlobalData.NonPagedFcbList, Fcb); - return Status; -} - -NTSTATUS -FatOpenFcb( - OUT PFCB* Fcb, - IN PFAT_IRP_CONTEXT IrpContext, - IN PFCB ParentFcb, - IN PUNICODE_STRING FileName) -{ - FAT_FIND_DIRENT_CONTEXT Context; - UNICODE_STRING LongFileName; - PDIR_ENTRY Dirent; - NTSTATUS Status; - - // TODO: _SEH_TRY { - if (ParentFcb->Dcb.StreamFileObject == NULL) - { - PFILE_OBJECT FileObject; - PVPB Vpb; - - Vpb = IrpContext->Vcb->Vpb; - - /* Create stream file object */ - FileObject = IoCreateStreamFileObject(NULL, Vpb->RealDevice); - FileObject->Vpb = Vpb; - FileObject->SectionObjectPointer = &ParentFcb->SectionObjectPointers; - FileObject->FsContext = ParentFcb; - FileObject->FsContext2 = NULL; - - /* Store it in parent fcb */ - ParentFcb->Dcb.StreamFileObject = FileObject; - - } - - /* Check if cache is initialized. */ - if (ParentFcb->Dcb.StreamFileObject->PrivateCacheMap == NULL ) - { - CcInitializeCacheMap(ParentFcb->Dcb.StreamFileObject, - (PCC_FILE_SIZES) &ParentFcb->Header.AllocationSize, - TRUE, - &FatGlobalData.CacheMgrNoopCallbacks, - ParentFcb); - } - - /* Page context */ - Context.Page.FileObject = ParentFcb->Dcb.StreamFileObject; - Context.Page.EndOfData = ParentFcb->Header.FileSize; - Context.Page.Offset.QuadPart = -1LL; - Context.Page.Bcb = NULL; - Context.Page.CanWait = BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT); - Context.Page.EndOfData = ParentFcb->Header.FileSize; - - /* Search context */ - Context.ShortName.Length = 0; - Context.ShortName.Buffer = Context.ShortNameBuffer; - Context.ShortName.MaximumLength = sizeof(Context.ShortNameBuffer); - Context.FileName = FileName; - Context.Valid8dot3Name = RtlIsNameLegalDOS8Dot3(FileName, NULL, NULL); - - /* Locate the dirent */ - FatFindDirent(&Context, &Dirent, &LongFileName); - - Status = FatCreateFcb(Fcb, IrpContext, ParentFcb, Dirent, - &Context.ShortName, &LongFileName); - return Status; -} -#endif /* EOF */
15 years, 2 months
1
0
0
0
[janderwald] 43224: - Implement enumerating mixer source and destination lines
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Sep 29 14:26:48 2009 New Revision: 43224 URL:
http://svn.reactos.org/svn/reactos?rev=43224&view=rev
Log: - Implement enumerating mixer source and destination lines Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c trunk/reactos/drivers/wdm/audio/legacy/wdmaud/entry.c trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
============================================================================== --- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] Tue Sep 29 14:26:48 2009 @@ -319,9 +319,11 @@ KSPIN_DATAFLOW DataFlow; PWDMAUD_DEVICE_EXTENSION DeviceExtension; + DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + if (DeviceInfo->DeviceType == MIXER_DEVICE_TYPE) { - DeviceInfo->DeviceCount = GetNumOfMixerDevices(DeviceObject); + DeviceInfo->DeviceCount = DeviceExtension->MixerInfoCount; return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO)); } @@ -336,7 +338,7 @@ Pin.Property.Id = KSPROPERTY_SYSAUDIO_DEVICE_COUNT; Pin.Property.Flags = KSPROPERTY_TYPE_GET; - DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + Status = KsSynchronousIoControlDevice(DeviceExtension->FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSPROPERTY), (PVOID)&Count, sizeof(ULONG), &BytesReturned); if (!NT_SUCCESS(Status)) { @@ -706,9 +708,11 @@ DPRINT("WdmAudCapabilities entered\n"); + DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + if (DeviceInfo->DeviceType == MIXER_DEVICE_TYPE) { - Status = WdmAudMixerCapabilities(DeviceObject, DeviceInfo, ClientInfo); + Status = WdmAudMixerCapabilities(DeviceObject, DeviceInfo, ClientInfo, DeviceExtension); return SetIrpIoStatus(Irp, Status, sizeof(WDMAUD_DEVICE_INFO)); } @@ -727,7 +731,7 @@ RtlZeroMemory(&ComponentId, sizeof(KSCOMPONENTID)); - DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + Status = KsSynchronousIoControlDevice(DeviceExtension->FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&PinProperty, sizeof(KSP_PIN), (PVOID)&ComponentId, sizeof(KSCOMPONENTID), &BytesReturned); if (NT_SUCCESS(Status)) { Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/entry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
============================================================================== --- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/entry.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/entry.c [iso-8859-1] Tue Sep 29 14:26:48 2009 @@ -76,6 +76,9 @@ return Status; } + Status = WdmAudMixerInitialize(DeviceObject); + DPRINT("WdmAudMixerInitialize Status %x\n", Status); + DeviceObject->Flags |= DO_DIRECT_IO | DO_POWER_PAGABLE; DeviceObject->Flags &= ~ DO_DEVICE_INITIALIZING; Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
============================================================================== --- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c [iso-8859-1] Tue Sep 29 14:26:48 2009 @@ -10,6 +10,88 @@ const GUID KSNODETYPE_DAC = {0x507AE360L, 0xC554, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; const GUID KSNODETYPE_ADC = {0x4D837FE0L, 0xC555, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_AGC = {0xE88C9BA0L, 0xC557, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_LOUDNESS = {0x41887440L, 0xC558, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_MUTE = {0x02B223C0L, 0xC557, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_TONE = {0x7607E580L, 0xC557, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_VOLUME = {0x3A5ACC00L, 0xC557, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_PEAKMETER = {0xa085651e, 0x5f0d, 0x4b36, {0xa8, 0x69, 0xd1, 0x95, 0xd6, 0xab, 0x4b, 0x9e}}; +const GUID KSNODETYPE_MUX = {0x2CEAF780, 0xC556, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_STEREO_WIDE = {0xA9E69800L, 0xC558, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_CHORUS = {0x20173F20L, 0xC559, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_REVERB = {0xEF0328E0L, 0xC558, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; +const GUID KSNODETYPE_SUPERMIX = {0xE573ADC0L, 0xC555, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; + + +LPMIXERLINE_SOURCE +GetSourceMixerLine( + LPMIXER_INFO MixerInfo, + DWORD dwSource) +{ + PLIST_ENTRY Entry; + LPMIXERLINE_SOURCE MixerLineSrc; + + /* get first entry */ + Entry = MixerInfo->SourceLineList.Flink; + + while(Entry != &MixerInfo->SourceLineList) + { + MixerLineSrc = (LPMIXERLINE_SOURCE)CONTAINING_RECORD(Entry, MIXERLINE_SOURCE, Entry); + DPRINT("dwSource %x dwSource %x\n", MixerLineSrc->Line.dwSource, dwSource); + if (MixerLineSrc->Line.dwSource == dwSource) + return MixerLineSrc; + + Entry = Entry->Flink; + } + + return NULL; +} + +LPMIXERLINE_SOURCE +GetSourceMixerLineByLineId( + LPMIXER_INFO MixerInfo, + DWORD dwLineID) +{ + PLIST_ENTRY Entry; + LPMIXERLINE_SOURCE MixerLineSrc; + + /* get first entry */ + Entry = MixerInfo->SourceLineList.Flink; + + while(Entry != &MixerInfo->SourceLineList) + { + MixerLineSrc = (LPMIXERLINE_SOURCE)CONTAINING_RECORD(Entry, MIXERLINE_SOURCE, Entry); + DPRINT("dwLineID %x dwLineID %x\n", MixerLineSrc->Line.dwLineID, dwLineID); + if (MixerLineSrc->Line.dwLineID == dwLineID) + return MixerLineSrc; + + Entry = Entry->Flink; + } + + return NULL; +} + + + +ULONG +GetPinCount( + IN PFILE_OBJECT FileObject) +{ + KSPROPERTY Pin; + NTSTATUS Status; + ULONG NumPins, BytesReturned; + + Pin.Flags = KSPROPERTY_TYPE_GET; + Pin.Set = KSPROPSETID_Pin; + Pin.Id = KSPROPERTY_PIN_CTYPES; + + Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSPROPERTY), (PVOID)&NumPins, sizeof(ULONG), &BytesReturned); + if (!NT_SUCCESS(Status)) + return 0; + + return NumPins; +} + ULONG GetSysAudioDeviceCount( @@ -84,6 +166,40 @@ } NTSTATUS +OpenDevice( + IN LPWSTR Device, + OUT PHANDLE DeviceHandle, + OUT PFILE_OBJECT * FileObject) +{ + NTSTATUS Status; + HANDLE hDevice; + + /* now open the device */ + Status = WdmAudOpenSysAudioDevice(Device, &hDevice); + + if (!NT_SUCCESS(Status)) + { + return Status; + } + + *DeviceHandle = hDevice; + + if (FileObject) + { + Status = ObReferenceObjectByHandle(hDevice, FILE_READ_DATA | FILE_WRITE_DATA, IoFileObjectType, KernelMode, (PVOID*)FileObject, NULL); + + if (!NT_SUCCESS(Status)) + { + ZwClose(hDevice); + } + } + + return Status; + +} + + +NTSTATUS OpenSysAudioDeviceByIndex( IN PDEVICE_OBJECT DeviceObject, IN ULONG DeviceIndex, @@ -92,41 +208,23 @@ { LPWSTR Device = NULL; NTSTATUS Status; - HANDLE hDevice; Status = GetSysAudioDevicePnpName(DeviceObject, DeviceIndex, &Device); if (!NT_SUCCESS(Status)) return Status; - /* now open the device */ - Status = WdmAudOpenSysAudioDevice(Device, &hDevice); + Status = OpenDevice(Device, DeviceHandle, FileObject); /* free device buffer */ ExFreePool(Device); - if (!NT_SUCCESS(Status)) - { - return Status; - } - - *DeviceHandle = hDevice; - - if (FileObject) - { - Status = ObReferenceObjectByHandle(hDevice, FILE_READ_DATA | FILE_WRITE_DATA, IoFileObjectType, KernelMode, (PVOID*)FileObject, NULL); - - if (!NT_SUCCESS(Status)) - { - ZwClose(hDevice); - } - } - return Status; } NTSTATUS -GetFilterNodeTypes( - PFILE_OBJECT FileObject, +GetFilterNodeProperty( + IN PFILE_OBJECT FileObject, + IN ULONG PropertyId, PKSMULTIPLE_ITEM * Item) { NTSTATUS Status; @@ -135,7 +233,7 @@ KSPROPERTY Property; /* setup query request */ - Property.Id = KSPROPERTY_TOPOLOGY_NODES; + Property.Id = PropertyId; Property.Flags = KSPROPERTY_TYPE_GET; Property.Set = KSPROPSETID_Topology; @@ -214,20 +312,803 @@ } ULONG -GetNumOfMixerDevices( - IN PDEVICE_OBJECT DeviceObject) -{ - ULONG DeviceCount, Index, Count; +GetControlTypeFromTopologyNode( + IN LPGUID NodeType) +{ + if (IsEqualGUIDAligned(NodeType, (LPGUID)&KSNODETYPE_AGC)) + { + // automatic gain control + return MIXERCONTROL_CONTROLTYPE_ONOFF; + } + else if (IsEqualGUIDAligned(NodeType, (LPGUID)&KSNODETYPE_LOUDNESS)) + { + // loudness control + return MIXERCONTROL_CONTROLTYPE_LOUDNESS; + } + else if (IsEqualGUIDAligned(NodeType, (LPGUID)&KSNODETYPE_MUTE )) + { + // mute control + return MIXERCONTROL_CONTROLTYPE_MUTE; + } + else if (IsEqualGUIDAligned(NodeType, (LPGUID)&KSNODETYPE_TONE)) + { + // tpne control + //FIXME + // MIXERCONTROL_CONTROLTYPE_ONOFF if KSPROPERTY_AUDIO_BASS_BOOST is supported + // MIXERCONTROL_CONTROLTYPE_BASS if KSPROPERTY_AUDIO_BASS is supported + // MIXERCONTROL_CONTROLTYPE_TREBLE if KSPROPERTY_AUDIO_TREBLE is supported + UNIMPLEMENTED; + return MIXERCONTROL_CONTROLTYPE_ONOFF; + } + else if (IsEqualGUIDAligned(NodeType, (LPGUID)&KSNODETYPE_VOLUME)) + { + // volume control + return MIXERCONTROL_CONTROLTYPE_VOLUME; + } + else if (IsEqualGUIDAligned(NodeType, (LPGUID)&KSNODETYPE_PEAKMETER)) + { + // peakmeter control + return MIXERCONTROL_CONTROLTYPE_PEAKMETER; + } + else if (IsEqualGUIDAligned(NodeType, (LPGUID)&KSNODETYPE_MUX)) + { + // mux control + return MIXERCONTROL_CONTROLTYPE_MUX; + } + else if (IsEqualGUIDAligned(NodeType, (LPGUID)&KSNODETYPE_MUX)) + { + // mux control + return MIXERCONTROL_CONTROLTYPE_MUX; + } + else if (IsEqualGUIDAligned(NodeType, (LPGUID)&KSNODETYPE_STEREO_WIDE)) + { + // stero wide control + return MIXERCONTROL_CONTROLTYPE_FADER; + } + else if (IsEqualGUIDAligned(NodeType, (LPGUID)&KSNODETYPE_CHORUS)) + { + // chorus control + return MIXERCONTROL_CONTROLTYPE_FADER; + } + else if (IsEqualGUIDAligned(NodeType, (LPGUID)&KSNODETYPE_REVERB)) + { + // reverb control + return MIXERCONTROL_CONTROLTYPE_FADER; + } + else if (IsEqualGUIDAligned(NodeType, (LPGUID)&KSNODETYPE_SUPERMIX)) + { + // supermix control + // MIXERCONTROL_CONTROLTYPE_MUTE if KSPROPERTY_AUDIO_MUTE is supported + UNIMPLEMENTED; + return MIXERCONTROL_CONTROLTYPE_VOLUME; + } + UNIMPLEMENTED + return 0; +} + +NTSTATUS +GetPhysicalConnection( + IN PFILE_OBJECT FileObject, + IN ULONG PinId, + OUT PKSPIN_PHYSICALCONNECTION *OutConnection) +{ + KSP_PIN Pin; + NTSTATUS Status; + ULONG BytesReturned; + PKSPIN_PHYSICALCONNECTION Connection; + + /* setup the request */ + Pin.Property.Flags = KSPROPERTY_TYPE_GET; + Pin.Property.Id = KSPROPERTY_PIN_PHYSICALCONNECTION; + Pin.Property.Set = KSPROPSETID_Pin; + Pin.PinId = PinId; + + /* query the pin for the physical connection */ + Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSP_PIN), NULL, 0, &BytesReturned); + + if (Status == STATUS_NOT_FOUND) + { + /* pin does not have a physical connection */ + return Status; + } + + Connection = ExAllocatePool(NonPagedPool, BytesReturned); + if (!Connection) + { + /* not enough memory */ + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* query the pin for the physical connection */ + Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSP_PIN), (PVOID)Connection, BytesReturned, &BytesReturned); + if (!NT_SUCCESS(Status)) + { + /* failed to query the physical connection */ + ExFreePool(Connection); + return Status; + } + + /* store connection */ + *OutConnection = Connection; + return Status; +} + +NTSTATUS +GetNodeIndexes( + IN PKSMULTIPLE_ITEM MultipleItem, + IN ULONG NodeIndex, + IN ULONG bNode, + IN ULONG bFrom, + OUT PULONG NodeReferenceCount, + OUT PULONG *NodeReference) +{ + ULONG Index, Count = 0; + PKSTOPOLOGY_CONNECTION Connection; + PULONG Refs; + + /* KSMULTIPLE_ITEM is followed by several KSTOPOLOGY_CONNECTION */ + Connection = (PKSTOPOLOGY_CONNECTION)(MultipleItem + 1); + + /* first count all referenced nodes */ + for(Index = 0; Index < MultipleItem->Count; Index++) + { + //DPRINT1("FromPin %u FromNode %u ToPin %u ToNode %u\n", Connection->FromNodePin, Connection->FromNode, Connection->ToNodePin, Connection->ToNode); + if (bNode) + { + if (bFrom) + { + if (Connection->FromNode == NodeIndex) + { + /* node id has a connection */ + Count++; + } + } + else + { + if (Connection->ToNode == NodeIndex) + { + /* node id has a connection */ + Count++; + } + } + } + else + { + if (bFrom) + { + if (Connection->FromNodePin == NodeIndex) + { + /* node id has a connection */ + Count++; + } + } + else + { + if (Connection->ToNodePin == NodeIndex) + { + /* node id has a connection */ + Count++; + } + } + } + + + /* move to next connection */ + Connection++; + } + + ASSERT(Count != 0); + + /* now allocate node index array */ + Refs = ExAllocatePool(NonPagedPool, sizeof(ULONG) * Count); + if (!Refs) + { + /* not enough memory */ + return STATUS_INSUFFICIENT_RESOURCES; + } + + Count = 0; + Connection = (PKSTOPOLOGY_CONNECTION)(MultipleItem + 1); + for(Index = 0; Index < MultipleItem->Count; Index++) + { + if (bNode) + { + if (bFrom) + { + if (Connection->FromNode == NodeIndex) + { + /* node id has a connection */ + Refs[Count] = Index; + Count++; + } + } + else + { + if (Connection->ToNode == NodeIndex) + { + /* node id has a connection */ + Refs[Count] = Index; + Count++; + } + } + } + else + { + if (bFrom) + { + if (Connection->FromNodePin == NodeIndex) + { + /* node id has a connection */ + Refs[Count] = Index; + Count++; + } + } + else + { + if (Connection->ToNodePin == NodeIndex) + { + /* node id has a connection */ + Refs[Count] = Index; + Count++; + } + } + } + + /* move to next connection */ + Connection++; + } + + /* store result */ + *NodeReference = Refs; + *NodeReferenceCount = Count; + + return STATUS_SUCCESS; +} + + +NTSTATUS +GetTargetPinsByNodeConnectionIndex( + IN PKSMULTIPLE_ITEM NodeConnections, + IN PKSMULTIPLE_ITEM NodeTypes, + IN ULONG bUpDirection, + IN ULONG NodeConnectionIndex, + OUT PULONG Pins) +{ + PKSTOPOLOGY_CONNECTION Connection; + ULONG PinId, NodeConnectionCount, Index; + PULONG NodeConnection; + NTSTATUS Status; + + + /* sanity check */ + ASSERT(NodeConnectionIndex < NodeConnections->Count); + + Connection = (PKSTOPOLOGY_CONNECTION)(NodeConnections + 1); + + DPRINT("FromNode %u FromNodePin %u -> ToNode %u ToNodePin %u\n", Connection[NodeConnectionIndex].FromNode, Connection[NodeConnectionIndex].FromNodePin, Connection[NodeConnectionIndex].ToNode, Connection[NodeConnectionIndex].ToNodePin ); + + if ((Connection[NodeConnectionIndex].ToNode == KSFILTER_NODE && bUpDirection == FALSE) || + (Connection[NodeConnectionIndex].FromNode == KSFILTER_NODE && bUpDirection == TRUE)) + { + /* iteration stops here */ + if (bUpDirection) + PinId = Connection[NodeConnectionIndex].FromNodePin; + else + PinId = Connection[NodeConnectionIndex].ToNodePin; + + DPRINT("GetTargetPinsByNodeIndex FOUND Target Pin %u Parsed %u\n", PinId, Pins[PinId]); + + /* mark pin index as a target pin */ + Pins[PinId] = TRUE; + return STATUS_SUCCESS; + } + + /* get all node indexes referenced by that node */ + if (bUpDirection) + { + Status = GetNodeIndexes(NodeConnections, Connection[NodeConnectionIndex].FromNode, TRUE, FALSE, &NodeConnectionCount, &NodeConnection); + } + else + { + Status = GetNodeIndexes(NodeConnections, Connection[NodeConnectionIndex].ToNode, TRUE, TRUE, &NodeConnectionCount, &NodeConnection); + } + + if (NT_SUCCESS(Status)) + { + for(Index = 0; Index < NodeConnectionCount; Index++) + { + /* iterate recursively into the nodes */ + Status = GetTargetPinsByNodeConnectionIndex(NodeConnections, NodeTypes, bUpDirection, NodeConnection[Index], Pins); + ASSERT(Status == STATUS_SUCCESS); + } + /* free node connection indexes */ + ExFreePool(NodeConnection); + } + + return Status; +} + + + +NTSTATUS +GetTargetPins( + PKSMULTIPLE_ITEM NodeTypes, + PKSMULTIPLE_ITEM NodeConnections, + IN ULONG NodeIndex, + IN ULONG bUpDirection, + PULONG Pins, + ULONG PinCount) +{ + ULONG NodeConnectionCount, Index; + NTSTATUS Status; + PULONG NodeConnection; + + /* sanity check */ + ASSERT(NodeIndex != (ULONG)-1); + + /* get all node indexes referenced by that pin */ + if (bUpDirection) + Status = GetNodeIndexes(NodeConnections, NodeIndex, TRUE, FALSE, &NodeConnectionCount, &NodeConnection); + else + Status = GetNodeIndexes(NodeConnections, NodeIndex, TRUE, TRUE, &NodeConnectionCount, &NodeConnection); + + DPRINT("NodeIndex %u Status %x Count %u\n", NodeIndex, Status, NodeConnectionCount); + + if (NT_SUCCESS(Status)) + { + for(Index = 0; Index < NodeConnectionCount; Index++) + { + Status = GetTargetPinsByNodeConnectionIndex(NodeConnections, NodeTypes, bUpDirection, NodeConnection[Index], Pins); + ASSERT(Status == STATUS_SUCCESS); + } + ExFreePool(NodeConnection); + } + + return Status; +} + +PULONG +AllocatePinArray( + ULONG PinCount) +{ + PULONG Pins = ExAllocatePool(NonPagedPool, PinCount * sizeof(ULONG)); + if (!Pins) + return NULL; + + RtlZeroMemory(Pins, sizeof(ULONG) * PinCount); + + return Pins; +} + +NTSTATUS +AddMixerSourceLine( + IN OUT LPMIXER_INFO MixerInfo, + IN PFILE_OBJECT FileObject, + IN ULONG PinId) +{ + LPMIXERLINE_SOURCE SrcLine; + NTSTATUS Status; + KSP_PIN Pin; + LPWSTR PinName; + GUID NodeType; + ULONG BytesReturned; + + /* allocate src mixer line */ + SrcLine = (LPMIXERLINE_SOURCE)ExAllocatePool(NonPagedPool, sizeof(MIXERLINE_SOURCE)); + if (!SrcLine) + return STATUS_INSUFFICIENT_RESOURCES; + + /* zero struct */ + RtlZeroMemory(SrcLine, sizeof(MIXERLINE_SOURCE)); + + /* initialize mixer src line */ + SrcLine->FileObject = FileObject; + SrcLine->PinId = PinId; + SrcLine->Line.cbStruct = sizeof(MIXERLINEW); + + /* initialize mixer destination line */ + SrcLine->Line.cbStruct = sizeof(MIXERLINEW); + SrcLine->Line.dwDestination = 0; + SrcLine->Line.dwSource = MixerInfo->DestinationLine.cConnections; + SrcLine->Line.dwLineID = (MixerInfo->DestinationLine.cConnections * 0x10000); + SrcLine->Line.fdwLine = MIXERLINE_LINEF_ACTIVE | MIXERLINE_LINEF_SOURCE; + SrcLine->Line.dwUser = 0; + SrcLine->Line.cChannels = MixerInfo->DestinationLine.cChannels; + SrcLine->Line.cConnections = 0; + SrcLine->Line.cControls = 1; //FIXME + + //HACK + SrcLine->LineControls = ExAllocatePool(NonPagedPool, SrcLine->Line.cControls * sizeof(MIXERCONTROLW)); + if (!SrcLine->LineControls) + { + /* not enough memory */ + ExFreePool(SrcLine); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* clear line controls */ + RtlZeroMemory(SrcLine->LineControls, sizeof(MIXERCONTROLW)); + + /* fill in pseudo mixer control */ + SrcLine->LineControls->dwControlID = 1; //FIXME + SrcLine->LineControls->cbStruct = sizeof(MIXERCONTROLW); + SrcLine->LineControls->fdwControl = 0; + SrcLine->LineControls->cMultipleItems = 0; + wcscpy(SrcLine->LineControls->szName, L"test"); + wcscpy(SrcLine->LineControls->szShortName, L"test"); + + + /* get pin category */ + Pin.PinId = PinId; + Pin.Reserved = 0; + Pin.Property.Flags = KSPROPERTY_TYPE_GET; + Pin.Property.Set = KSPROPSETID_Pin; + Pin.Property.Id = KSPROPERTY_PIN_CATEGORY; + + /* try get pin category */ + Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSP_PIN), (LPVOID)&NodeType, sizeof(GUID), &BytesReturned); + if (NT_SUCCESS(Status)) + { + //FIXME + //map component type + } + + /* retrieve pin name */ + Pin.PinId = PinId; + Pin.Reserved = 0; + Pin.Property.Flags = KSPROPERTY_TYPE_GET; + Pin.Property.Set = KSPROPSETID_Pin; + Pin.Property.Id = KSPROPERTY_PIN_NAME; + + /* try get pin name size */ + Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSP_PIN), NULL, 0, &BytesReturned); + + if (Status != STATUS_MORE_ENTRIES) + { + SrcLine->Line.szShortName[0] = L'\0'; + SrcLine->Line.szName[0] = L'\0'; + } + else + { + PinName = (LPWSTR)ExAllocatePool(NonPagedPool, BytesReturned); + if (PinName) + { + /* try get pin name */ + Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSP_PIN), (LPVOID)PinName, BytesReturned, &BytesReturned); + + if (NT_SUCCESS(Status)) + { + RtlMoveMemory(SrcLine->Line.szShortName, PinName, (min(MIXER_SHORT_NAME_CHARS, wcslen(PinName)+1)) * sizeof(WCHAR)); + SrcLine->Line.szShortName[MIXER_SHORT_NAME_CHARS-1] = L'\0'; + + RtlMoveMemory(SrcLine->Line.szName, PinName, (min(MIXER_LONG_NAME_CHARS, wcslen(PinName)+1)) * sizeof(WCHAR)); + SrcLine->Line.szName[MIXER_LONG_NAME_CHARS-1] = L'\0'; + } + ExFreePool(PinName); + } + } + + SrcLine->Line.Target.dwType = 1; + SrcLine->Line.Target.dwDeviceID = MixerInfo->DestinationLine.Target.dwDeviceID; + SrcLine->Line.Target.wMid = MixerInfo->MixCaps.wMid; + SrcLine->Line.Target.wPid = MixerInfo->MixCaps.wPid; + SrcLine->Line.Target.vDriverVersion = MixerInfo->MixCaps.vDriverVersion; + wcscpy(SrcLine->Line.Target.szPname, MixerInfo->MixCaps.szPname); + + + /* insert src line */ + InsertTailList(&MixerInfo->SourceLineList, &SrcLine->Entry); + MixerInfo->DestinationLine.cConnections++; + + return STATUS_SUCCESS; +} + + +NTSTATUS +AddMixerSourceLines( + IN OUT LPMIXER_INFO MixerInfo, + IN PFILE_OBJECT FileObject, + IN ULONG PinsCount, + IN PULONG Pins) +{ + ULONG Index; + NTSTATUS Status = STATUS_SUCCESS; + + for(Index = PinsCount; Index > 0; Index--) + { + if (Pins[Index-1]) + { + AddMixerSourceLine(MixerInfo, FileObject, Index-1); + } + } + return Status; +} + + + +NTSTATUS +HandlePhysicalConnection( + IN OUT LPMIXER_INFO MixerInfo, + IN ULONG bInput, + IN PKSPIN_PHYSICALCONNECTION OutConnection) +{ + PULONG PinsRef = NULL, PinConnectionIndex = NULL, PinsSrcRef; + ULONG PinsRefCount, Index, PinConnectionIndexCount; + NTSTATUS Status; + HANDLE hDevice = NULL; + PFILE_OBJECT FileObject = NULL; + PKSMULTIPLE_ITEM NodeTypes = NULL; + PKSMULTIPLE_ITEM NodeConnections = NULL; + PULONG MixerControls; + ULONG MixerControlsCount; + + + /* open the connected filter */ + Status = OpenDevice(OutConnection->SymbolicLinkName, &hDevice, &FileObject); + if (!NT_SUCCESS(Status)) + { + DPRINT1("OpenDevice failed with %x\n", Status); + return Status; + } + + /* get connected filter pin count */ + PinsRefCount = GetPinCount(FileObject); + ASSERT(PinsRefCount); + + PinsRef = AllocatePinArray(PinsRefCount); + if (!PinsRef) + { + /* no memory */ + Status = STATUS_INSUFFICIENT_RESOURCES; + goto cleanup; + } + + /* get topology node types */ + Status = GetFilterNodeProperty(FileObject, KSPROPERTY_TOPOLOGY_NODES, &NodeTypes); + if (!NT_SUCCESS(Status)) + { + DPRINT1("GetFilterNodeProperty failed with %x\n", Status); + goto cleanup; + } + + /* get topology connections */ + Status = GetFilterNodeProperty(FileObject, KSPROPERTY_TOPOLOGY_CONNECTIONS, &NodeConnections); + if (!NT_SUCCESS(Status)) + { + DPRINT1("GetFilterNodeProperty failed with %x\n", Status); + goto cleanup; + } + /* gets connection index of the bridge pin which connects to a node */ + DPRINT("Pin %u\n", OutConnection->Pin); + Status = GetNodeIndexes(NodeConnections, OutConnection->Pin, FALSE, !bInput, &PinConnectionIndexCount, &PinConnectionIndex); + if (!NT_SUCCESS(Status)) + { + DPRINT1("GetNodeIndexes failed with %x\n", Status); + goto cleanup; + } + + /* there should be no split in the bride pin */ + ASSERT(PinConnectionIndexCount == 1); + + /* find all target pins of this connection */ + Status = GetTargetPinsByNodeConnectionIndex(NodeConnections, NodeTypes, FALSE, PinConnectionIndex[0], PinsRef); + if (!NT_SUCCESS(Status)) + { + DPRINT1("GetTargetPinsByNodeConnectionIndex failed with %x\n", Status); + goto cleanup; + } + + for(Index = 0; Index < PinsRefCount; Index++) + { + if (PinsRef[Index]) + { + + /* found a target pin, now get all references */ + Status = GetNodeIndexes(NodeConnections, Index, FALSE, FALSE, &MixerControlsCount, &MixerControls); + if (!NT_SUCCESS(Status)) + break; + + /* sanity check */ + ASSERT(MixerControlsCount == 1); + + + PinsSrcRef = AllocatePinArray(PinsRefCount); + if (!PinsSrcRef) + { + /* no memory */ + ExFreePool(MixerControls); + Status = STATUS_INSUFFICIENT_RESOURCES; + goto cleanup; + } + /* now get all connected source pins */ + Status = GetTargetPinsByNodeConnectionIndex(NodeConnections, NodeTypes, TRUE, MixerControls[0], PinsSrcRef); + if (!NT_SUCCESS(Status)) + { + /* no memory */ + ExFreePool(MixerControls); + ExFreePool(PinsSrcRef); + Status = STATUS_INSUFFICIENT_RESOURCES; + goto cleanup; + } + + /* add pins from target line */ + if (!bInput) + { + // dont add bridge pin for input mixers + PinsSrcRef[Index] = TRUE; + PinsSrcRef[OutConnection->Pin] = TRUE; + } + + Status = AddMixerSourceLines(MixerInfo, FileObject, PinsRefCount, PinsSrcRef); + + ExFreePool(MixerControls); + ExFreePool(PinsSrcRef); + } + } + +cleanup: + + if (PinsRef) + ExFreePool(PinsRef); + + if (NodeConnections) + ExFreePool(NodeConnections); + + if (NodeTypes) + ExFreePool(NodeTypes); + + if (FileObject) + ObDereferenceObject(FileObject); + + if (hDevice) + ZwClose(hDevice); + + if (PinConnectionIndex) + ExFreePool(PinConnectionIndex); + + + return Status; +} + + + +NTSTATUS +InitializeMixer( + IN PDEVICE_OBJECT DeviceObject, + IN ULONG DeviceIndex, + IN OUT LPMIXER_INFO MixerInfo, + IN HANDLE hDevice, + IN PFILE_OBJECT FileObject, + IN ULONG PinCount, + IN PKSMULTIPLE_ITEM NodeTypes, + IN PKSMULTIPLE_ITEM NodeConnections, + IN ULONG NodeIndex, + IN ULONG bInput) +{ + WCHAR Buffer[100]; + LPWSTR Device; + NTSTATUS Status; + PULONG Pins; + ULONG Index; + PKSPIN_PHYSICALCONNECTION OutConnection; + + /* initialize mixer info */ + MixerInfo->hMixer = hDevice; + MixerInfo->MixerFileObject = FileObject; + + /* intialize mixer caps */ + MixerInfo->MixCaps.wMid = MM_MICROSOFT; //FIXME + MixerInfo->MixCaps.wPid = MM_PID_UNMAPPED; //FIXME + MixerInfo->MixCaps.vDriverVersion = 1; //FIXME + MixerInfo->MixCaps.fdwSupport = 0; + MixerInfo->MixCaps.cDestinations = 1; + + /* get target pnp name */ + Status = GetSysAudioDevicePnpName(DeviceObject, DeviceIndex, &Device); + if (NT_SUCCESS(Status)) + { + /* find product name */ + Status = FindProductName(Device, sizeof(Buffer) / sizeof(WCHAR), Buffer); + if (NT_SUCCESS(Status)) + { + if (bInput) + wcscat(Buffer, L" Input"); + else + wcscat(Buffer, L" output"); + RtlMoveMemory(MixerInfo->MixCaps.szPname, Buffer, min(MAXPNAMELEN, wcslen(Buffer)+1) * sizeof(WCHAR)); + MixerInfo->MixCaps.szPname[MAXPNAMELEN-1] = L'\0'; + } + ExFreePool(Device); + } + + /* initialize mixer destination line */ + MixerInfo->DestinationLine.cbStruct = sizeof(MIXERLINEW); + MixerInfo->DestinationLine.dwSource = MAXULONG; + MixerInfo->DestinationLine.dwLineID = 0xFFFF0000; + MixerInfo->DestinationLine.fdwLine = MIXERLINE_LINEF_ACTIVE; + MixerInfo->DestinationLine.dwUser = 0; + MixerInfo->DestinationLine.dwComponentType = (bInput == 0 ? MIXERLINE_COMPONENTTYPE_DST_SPEAKERS : MIXERLINE_COMPONENTTYPE_DST_WAVEIN); + MixerInfo->DestinationLine.cChannels = 2; //FIXME + MixerInfo->DestinationLine.cControls = 0; //FIXME + wcscpy(MixerInfo->DestinationLine.szShortName, L"Summe"); //FIXME + wcscpy(MixerInfo->DestinationLine.szName, L"Summe"); //FIXME + MixerInfo->DestinationLine.Target.dwType = (bInput == 0 ? MIXERLINE_TARGETTYPE_WAVEOUT : MIXERLINE_TARGETTYPE_WAVEIN); + MixerInfo->DestinationLine.Target.dwDeviceID = !bInput; + MixerInfo->DestinationLine.Target.wMid = MixerInfo->MixCaps.wMid; + MixerInfo->DestinationLine.Target.wPid = MixerInfo->MixCaps.wPid; + MixerInfo->DestinationLine.Target.vDriverVersion = MixerInfo->MixCaps.vDriverVersion; + wcscpy(MixerInfo->DestinationLine.Target.szPname, MixerInfo->MixCaps.szPname); + + + /* initialize source line list */ + InitializeListHead(&MixerInfo->SourceLineList); + + Pins = AllocatePinArray(PinCount); + if (!Pins) + return STATUS_INSUFFICIENT_RESOURCES; + + if (bInput) + { + Status = GetTargetPins(NodeTypes, NodeConnections, NodeIndex, TRUE, Pins, PinCount); + } + else + { + Status = GetTargetPins(NodeTypes, NodeConnections, NodeIndex, FALSE, Pins, PinCount); + } + + for(Index = 0; Index < PinCount; Index++) + { + if (Pins[Index]) + { + Status = GetPhysicalConnection(FileObject, Index, &OutConnection); + if (NT_SUCCESS(Status)) + { + Status = HandlePhysicalConnection(MixerInfo, bInput, OutConnection); + } + } + } + ExFreePool(Pins); + + return STATUS_SUCCESS; +} + +NTSTATUS +WdmAudMixerInitialize( + IN PDEVICE_OBJECT DeviceObject) +{ + ULONG DeviceCount, Index, Count, NodeIndex, PinCount; NTSTATUS Status; HANDLE hDevice; PFILE_OBJECT FileObject; - PKSMULTIPLE_ITEM MultipleItem; + PKSMULTIPLE_ITEM NodeTypes, NodeConnections; + BOOL bCloseHandle; + PWDMAUD_DEVICE_EXTENSION DeviceExtension; + + /* get device extension */ + DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + /* get number of devices */ DeviceCount = GetSysAudioDeviceCount(DeviceObject); if (!DeviceCount) - return 0; + { + /* no audio devices available atm */ + DeviceExtension->MixerInfoCount = 0; + DeviceExtension->MixerInfo = NULL; + return STATUS_SUCCESS; + } + + /* each virtual audio device can at most have an input + output mixer */ + DeviceExtension->MixerInfo = ExAllocatePool(NonPagedPool, sizeof(MIXER_INFO) * DeviceCount * 2); + if (!DeviceExtension->MixerInfo) + { + /* not enough memory */ + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* clear mixer info */ + RtlZeroMemory(DeviceExtension->MixerInfo, sizeof(MIXER_INFO) * DeviceCount * 2); Index = 0; Count = 0; @@ -239,102 +1120,72 @@ if (NT_SUCCESS(Status)) { /* retrieve all available node types */ - Status = GetFilterNodeTypes(FileObject, &MultipleItem); - if (NT_SUCCESS(Status)) - { - if (CountNodeType(MultipleItem, (LPGUID)&KSNODETYPE_DAC)) + Status = GetFilterNodeProperty(FileObject, KSPROPERTY_TOPOLOGY_NODES, &NodeTypes); + if (!NT_SUCCESS(Status)) + { + ObDereferenceObject(FileObject); + ZwClose(hDevice); + break; + } + + Status = GetFilterNodeProperty(FileObject, KSPROPERTY_TOPOLOGY_CONNECTIONS, &NodeConnections); + if (!NT_SUCCESS(Status)) + { + ObDereferenceObject(FileObject); + ZwClose(hDevice); + ExFreePool(NodeTypes); + break; + } + + /* get num of pins */ + PinCount = GetPinCount(FileObject); + bCloseHandle = TRUE; + /* get the first available dac node index */ + NodeIndex = GetNodeTypeIndex(NodeTypes, (LPGUID)&KSNODETYPE_DAC); + if (NodeIndex != (ULONG)-1) + { + Status = InitializeMixer(DeviceObject, Index, &DeviceExtension->MixerInfo[Count], hDevice, FileObject, PinCount, NodeTypes, NodeConnections, NodeIndex, FALSE); + if (NT_SUCCESS(Status)) { - /* increment (output) mixer count */ + /* increment mixer offset */ Count++; + bCloseHandle = FALSE; } - - if (CountNodeType(MultipleItem, (LPGUID)&KSNODETYPE_ADC)) + } + + /* get the first available adc node index */ + NodeIndex = GetNodeTypeIndex(NodeTypes, (LPGUID)&KSNODETYPE_ADC); + if (NodeIndex != (ULONG)-1) + { + Status = InitializeMixer(DeviceObject, Index, &DeviceExtension->MixerInfo[Count], hDevice, FileObject, PinCount, NodeTypes, NodeConnections, NodeIndex, TRUE); + if (NT_SUCCESS(Status)) { - /* increment (input) mixer count */ + /* increment mixer offset */ Count++; + bCloseHandle = FALSE; } - ExFreePool(MultipleItem); - } - ObDereferenceObject(FileObject); - ZwClose(hDevice); - } - + } + + /* free node connections array */ + ExFreePool(NodeTypes); + ExFreePool(NodeConnections); + + if (bCloseHandle) + { + /* close virtual audio device */ + ObDereferenceObject(FileObject); + ZwClose(hDevice); + } + } + /* increment virtual audio device index */ Index++; }while(Index < DeviceCount); - return Count; -} - -ULONG -IsOutputMixer( - IN PDEVICE_OBJECT DeviceObject, - IN ULONG DeviceIndex) -{ - ULONG DeviceCount, Index, Count; - NTSTATUS Status; - HANDLE hDevice; - PFILE_OBJECT FileObject; - PKSMULTIPLE_ITEM MultipleItem; - - /* get number of devices */ - DeviceCount = GetSysAudioDeviceCount(DeviceObject); - - if (!DeviceCount) - return 0; - - Index = 0; - Count = 0; - do - { - /* open the virtual audio device */ - Status = OpenSysAudioDeviceByIndex(DeviceObject, Index, &hDevice, &FileObject); - - if (NT_SUCCESS(Status)) - { - /* retrieve all available node types */ - Status = GetFilterNodeTypes(FileObject, &MultipleItem); - if (NT_SUCCESS(Status)) - { - if (CountNodeType(MultipleItem, (LPGUID)&KSNODETYPE_DAC)) - { - /* increment (output) mixer count */ - if (DeviceIndex == Count) - { - ExFreePool(MultipleItem); - ObDereferenceObject(FileObject); - ZwClose(hDevice); - return TRUE; - } - - Count++; - } - - if (CountNodeType(MultipleItem, (LPGUID)&KSNODETYPE_ADC)) - { - /* increment (input) mixer count */ - if (DeviceIndex == Count) - { - ExFreePool(MultipleItem); - ObDereferenceObject(FileObject); - ZwClose(hDevice); - return FALSE; - } - Count++; - } - ExFreePool(MultipleItem); - } - ObDereferenceObject(FileObject); - ZwClose(hDevice); - } - - Index++; - }while(Index < DeviceCount); - - ASSERT(0); - return FALSE; -} - - + /* store mixer count */ + DeviceExtension->MixerInfoCount = Count; + + return Status; +} @@ -342,43 +1193,19 @@ WdmAudMixerCapabilities( IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_DEVICE_INFO DeviceInfo, - IN PWDMAUD_CLIENT ClientInfo) -{ - NTSTATUS Status; - LPWSTR Device; - WCHAR Buffer[100]; - - Status = GetSysAudioDevicePnpName(DeviceObject, DeviceInfo->DeviceIndex,&Device); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to get device name %x\n", Status); - return Status; - } - - DeviceInfo->u.MixCaps.cDestinations = 1; //FIXME - - Status = FindProductName(Device, sizeof(Buffer) / sizeof(WCHAR), Buffer); - - /* check for success */ - if (!NT_SUCCESS(Status)) - { - DeviceInfo->u.MixCaps.szPname[0] = L'\0'; - } - else - { - if (IsOutputMixer(DeviceObject, DeviceInfo->DeviceIndex)) - { - wcscat(Buffer, L" output"); - } - else - { - wcscat(Buffer, L" Input"); - } - RtlMoveMemory(DeviceInfo->u.MixCaps.szPname, Buffer, min(MAXPNAMELEN, wcslen(Buffer)+1) * sizeof(WCHAR)); - DeviceInfo->u.MixCaps.szPname[MAXPNAMELEN-1] = L'\0'; - } - - return Status; + IN PWDMAUD_CLIENT ClientInfo, + IN PWDMAUD_DEVICE_EXTENSION DeviceExtension) +{ + if ((ULONG)DeviceInfo->hDevice >= DeviceExtension->MixerInfoCount) + { + /* invalid parameter */ + return STATUS_INVALID_PARAMETER; + } + + /* copy cached mixer caps */ + RtlMoveMemory(&DeviceInfo->u.MixCaps, &DeviceExtension->MixerInfo[(ULONG)DeviceInfo->hDevice].MixCaps, sizeof(MIXERCAPSW)); + + return STATUS_SUCCESS; } @@ -391,10 +1218,14 @@ { ULONG Index; PWDMAUD_HANDLE Handels; + PWDMAUD_DEVICE_EXTENSION DeviceExtension; DPRINT("WdmAudControlOpenMixer\n"); - if (DeviceInfo->DeviceIndex >= GetNumOfMixerDevices(DeviceObject)) + DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + + + if (DeviceInfo->DeviceIndex >= DeviceExtension->MixerInfoCount) { /* mixer index doesnt exist */ return SetIrpIoStatus(Irp, STATUS_UNSUCCESSFUL, 0); @@ -442,7 +1273,57 @@ IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo) { + PWDMAUD_DEVICE_EXTENSION DeviceExtension; + LPMIXERLINE_SOURCE MixerLineSrc; + + /* get device extension */ + DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + + if (DeviceInfo->Flags == MIXER_GETLINEINFOF_DESTINATION) + { + if ((ULONG)DeviceInfo->hDevice >= DeviceExtension->MixerInfoCount) + { + /* invalid parameter */ + return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER, 0); + } + + if (DeviceInfo->u.MixLine.dwDestination != 0) + { + /* invalid parameter */ + return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER, 0); + } + + /* copy cached data */ + RtlCopyMemory(&DeviceInfo->u.MixLine, &DeviceExtension->MixerInfo[(ULONG)DeviceInfo->hDevice].DestinationLine, sizeof(MIXERLINEW)); + return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO)); + } + else if (DeviceInfo->Flags == MIXER_GETLINEINFOF_SOURCE) + { + if ((ULONG)DeviceInfo->hDevice >= DeviceExtension->MixerInfoCount) + { + /* invalid parameter */ + return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER, 0); + } + + if (DeviceInfo->u.MixLine.dwSource >= DeviceExtension->MixerInfo[(ULONG)DeviceInfo->hDevice].DestinationLine.cConnections) + { + DPRINT1("dwSource %u Destinations %u\n", DeviceInfo->u.MixLine.dwSource, DeviceExtension->MixerInfo[(ULONG)DeviceInfo->hDevice].DestinationLine.cConnections); + /* invalid parameter */ + return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER, 0); + } + + MixerLineSrc = GetSourceMixerLine(&DeviceExtension->MixerInfo[(ULONG)DeviceInfo->hDevice], DeviceInfo->u.MixLine.dwSource); + if (MixerLineSrc) + { + DPRINT("Line %u Name %S\n", MixerLineSrc->Line.dwSource, MixerLineSrc->Line.szName); + RtlCopyMemory(&DeviceInfo->u.MixLine, &MixerLineSrc->Line, sizeof(MIXERLINEW)); + } + return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO)); + } + + DPRINT1("Flags %x\n", DeviceInfo->Flags); UNIMPLEMENTED; + //DbgBreakPoint(); return SetIrpIoStatus(Irp, STATUS_NOT_IMPLEMENTED, 0); @@ -456,6 +1337,32 @@ IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo) { + LPMIXERLINE_SOURCE MixerLineSrc; + PWDMAUD_DEVICE_EXTENSION DeviceExtension; + + /* get device extension */ + DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + + if (DeviceInfo->Flags == MIXER_GETLINECONTROLSF_ALL) + { + if ((ULONG)DeviceInfo->hDevice >= DeviceExtension->MixerInfoCount) + { + /* invalid parameter */ + return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER, 0); + } + + MixerLineSrc = GetSourceMixerLineByLineId(&DeviceExtension->MixerInfo[(ULONG)DeviceInfo->hDevice], DeviceInfo->u.MixControls.dwLineID); + ASSERT(MixerLineSrc); + if (MixerLineSrc) + { + RtlMoveMemory(DeviceInfo->u.MixControls.pamxctrl, MixerLineSrc->LineControls, min(MixerLineSrc->Line.cControls, DeviceInfo->u.MixControls.cControls) * sizeof(MIXERLINECONTROLSW)); + } + return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO)); + + + + } + UNIMPLEMENTED; //DbgBreakPoint(); return SetIrpIoStatus(Irp, STATUS_NOT_IMPLEMENTED, 0); Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
============================================================================== --- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h [iso-8859-1] Tue Sep 29 14:26:48 2009 @@ -8,6 +8,7 @@ #define NDEBUG #include <debug.h> #include <ksmedia.h> +#include <mmreg.h> #include <mmsystem.h> #include <stdlib.h> #include <stdio.h> @@ -35,6 +36,29 @@ typedef struct { LIST_ENTRY Entry; + ULONG PinId; + PFILE_OBJECT FileObject; + MIXERLINEW Line; + LPMIXERCONTROLW LineControls; +}MIXERLINE_SOURCE, *LPMIXERLINE_SOURCE; + + +typedef struct +{ + HANDLE hMixer; + PFILE_OBJECT MixerFileObject; + + MIXERCAPSW MixCaps; + MIXERLINEW DestinationLine; + + LIST_ENTRY SourceLineList; + +}MIXER_INFO, *LPMIXER_INFO; + + +typedef struct +{ + LIST_ENTRY Entry; UNICODE_STRING SymbolicLink; }SYSAUDIO_ENTRY, *PSYSAUDIO_ENTRY; @@ -50,6 +74,10 @@ LIST_ENTRY SysAudioDeviceList; HANDLE hSysAudio; PFILE_OBJECT FileObject; + + ULONG MixerInfoCount; + LPMIXER_INFO MixerInfo; + }WDMAUD_DEVICE_EXTENSION, *PWDMAUD_DEVICE_EXTENSION; @@ -118,7 +146,8 @@ WdmAudMixerCapabilities( IN PDEVICE_OBJECT DeviceObject, IN PWDMAUD_DEVICE_INFO DeviceInfo, - IN PWDMAUD_CLIENT ClientInfo); + IN PWDMAUD_CLIENT ClientInfo, + IN PWDMAUD_DEVICE_EXTENSION DeviceExtension); NTSTATUS NTAPI @@ -160,6 +189,9 @@ IN PWDMAUD_DEVICE_INFO DeviceInfo, IN PWDMAUD_CLIENT ClientInfo); +NTSTATUS +WdmAudMixerInitialize( + IN PDEVICE_OBJECT DeviceObject); #endif
15 years, 2 months
1
0
0
0
[janderwald] 43223: - Implement PcHandlePropertyWithTable - Use PcHandlePropertyWithTable to handle IOCTL_KS_PROPERTY requests - Remove dead code
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Sep 29 12:46:30 2009 New Revision: 43223 URL:
http://svn.reactos.org/svn/reactos?rev=43223&view=rev
Log: - Implement PcHandlePropertyWithTable - Use PcHandlePropertyWithTable to handle IOCTL_KS_PROPERTY requests - Remove dead code Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_dmus.cpp trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_topology.cpp trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.cpp trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavepci.cpp trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavert.cpp trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.hpp trunk/reactos/drivers/wdm/audio/backpln/portcls/private.hpp trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.cpp trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.cpp Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_dmus.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_dmus.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_dmus.cpp [iso-8859-1] Tue Sep 29 12:46:30 2009 @@ -131,7 +131,29 @@ IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { - return PcPropertyHandler(Irp, m_Descriptor); + PIO_STACK_LOCATION IoStack; + NTSTATUS Status; + + IoStack = IoGetCurrentIrpStackLocation(Irp); + + if (IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_PROPERTY) + { + DPRINT1("Unhandled function %lx Length %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode, IoStack->Parameters.DeviceIoControl.InputBufferLength); + + Irp->IoStatus.Status = STATUS_SUCCESS; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; + } + + Status = PcHandlePropertyWithTable(Irp, m_Descriptor->FilterPropertySetCount, m_Descriptor->FilterPropertySet, m_Descriptor); + if (Status != STATUS_PENDING) + { + Irp->IoStatus.Status = Status; + DPRINT("Result %x Length %u\n", Status, Irp->IoStatus.Information); + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + return Status; } NTSTATUS Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_topology.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_topology.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_topology.cpp [iso-8859-1] Tue Sep 29 12:46:30 2009 @@ -89,6 +89,7 @@ IN PIRP Irp) { PIO_STACK_LOCATION IoStack; + NTSTATUS Status; IoStack = IoGetCurrentIrpStackLocation(Irp); @@ -102,9 +103,15 @@ return STATUS_SUCCESS; } - PC_ASSERT(IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY); - - return PcPropertyHandler(Irp, m_Descriptor); + Status = PcHandlePropertyWithTable(Irp, m_Descriptor->FilterPropertySetCount, m_Descriptor->FilterPropertySet, m_Descriptor); + if (Status != STATUS_PENDING) + { + Irp->IoStatus.Status = Status; + DPRINT("Result %x Length %u\n", Status, Irp->IoStatus.Information); + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + return Status; + } NTSTATUS Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.cpp [iso-8859-1] Tue Sep 29 12:46:30 2009 @@ -135,6 +135,7 @@ IN PIRP Irp) { PIO_STACK_LOCATION IoStack; + NTSTATUS Status; IoStack = IoGetCurrentIrpStackLocation(Irp); @@ -148,9 +149,14 @@ return STATUS_SUCCESS; } - PC_ASSERT(IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY); - - return PcPropertyHandler(Irp, m_Descriptor); + Status = PcHandlePropertyWithTable(Irp, m_Descriptor->FilterPropertySetCount, m_Descriptor->FilterPropertySet, m_Descriptor); + if (Status != STATUS_PENDING) + { + Irp->IoStatus.Status = Status; + DPRINT("Result %x Length %u\n", Status, Irp->IoStatus.Information); + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + return Status; } NTSTATUS Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavepci.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavepci.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavepci.cpp [iso-8859-1] Tue Sep 29 12:46:30 2009 @@ -136,7 +136,29 @@ IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { - return PcPropertyHandler(Irp, m_Descriptor); + PIO_STACK_LOCATION IoStack; + NTSTATUS Status; + + IoStack = IoGetCurrentIrpStackLocation(Irp); + + if (IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_PROPERTY) + { + DPRINT1("Unhandled function %lx Length %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode, IoStack->Parameters.DeviceIoControl.InputBufferLength); + + Irp->IoStatus.Status = STATUS_SUCCESS; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; + } + + Status = PcHandlePropertyWithTable(Irp, m_Descriptor->FilterPropertySetCount, m_Descriptor->FilterPropertySet, m_Descriptor); + if (Status != STATUS_PENDING) + { + Irp->IoStatus.Status = Status; + DPRINT("Result %x Length %u\n", Status, Irp->IoStatus.Information); + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + return Status; } NTSTATUS Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavert.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavert.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavert.cpp [iso-8859-1] Tue Sep 29 12:46:30 2009 @@ -140,7 +140,29 @@ IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { - return PcPropertyHandler(Irp, m_Descriptor); + PIO_STACK_LOCATION IoStack; + NTSTATUS Status; + + IoStack = IoGetCurrentIrpStackLocation(Irp); + + if (IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_PROPERTY) + { + DPRINT1("Unhandled function %lx Length %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode, IoStack->Parameters.DeviceIoControl.InputBufferLength); + + Irp->IoStatus.Status = STATUS_SUCCESS; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; + } + + Status = PcHandlePropertyWithTable(Irp, m_Descriptor->FilterPropertySetCount, m_Descriptor->FilterPropertySet, m_Descriptor); + if (Status != STATUS_PENDING) + { + Irp->IoStatus.Status = Status; + DPRINT("Result %x Length %u\n", Status, Irp->IoStatus.Information); + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + return Status; } NTSTATUS Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.hpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.hpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.hpp [iso-8859-1] Tue Sep 29 12:46:30 2009 @@ -201,17 +201,11 @@ typedef struct { - ULONG MaxKsPropertySetCount; - ULONG FreeKsPropertySetOffset; - PKSPROPERTY_SET Properties; -}KSPROPERTY_SET_LIST; - -typedef struct -{ ULONG InterfaceCount; GUID *Interfaces; KSPIN_FACTORY Factory; - KSPROPERTY_SET_LIST FilterPropertySet; + ULONG FilterPropertySetCount; + PKSPROPERTY_SET FilterPropertySet; PPCFILTER_DESCRIPTOR DeviceDescriptor; KSTOPOLOGY* Topology; Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/private.hpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/private.hpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/private.hpp [iso-8859-1] Tue Sep 29 12:46:30 2009 @@ -286,26 +286,6 @@ IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp); -NTSTATUS -NTAPI -PcPropertyHandler( - IN PIRP Irp, - IN PSUBDEVICE_DESCRIPTOR Descriptor); - -NTSTATUS -NTAPI -FastPropertyHandler( - IN PFILE_OBJECT FileObject, - IN PKSPROPERTY UNALIGNED Property, - IN ULONG PropertyLength, - IN OUT PVOID UNALIGNED Data, - IN ULONG DataLength, - OUT PIO_STATUS_BLOCK IoStatus, - IN ULONG PropertySetsCount, - IN const KSPROPERTY_SET *PropertySet, - IN PSUBDEVICE_DESCRIPTOR Descriptor, - IN ISubdevice *SubDevice); - PDEVICE_OBJECT GetDeviceObject( IPortWaveCyclic* iface); @@ -325,6 +305,14 @@ NTAPI NewIUnregisterPhysicalConnection( OUT PUNREGISTERPHYSICALCONNECTION *OutConnection); + +NTSTATUS +NTAPI +PcHandlePropertyWithTable( + IN PIRP Irp, + IN ULONG PropertySetCount, + IN PKSPROPERTY_SET PropertySet, + IN PSUBDEVICE_DESCRIPTOR Descriptor); #define DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT(PinSet,\ PropGeneral, PropInstances, PropIntersection)\ Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.cpp [iso-8859-1] Tue Sep 29 12:46:30 2009 @@ -9,16 +9,6 @@ #include "private.hpp" NTSTATUS -FindPropertyHandler( - IN PIO_STATUS_BLOCK IoStatus, - IN PSUBDEVICE_DESCRIPTOR Descriptor, - IN PKSPROPERTY Property, - IN ULONG InputBufferLength, - IN ULONG OutputBufferLength, - OUT PVOID OutputBuffer, - OUT PFNKSHANDLER *PropertyHandler); - -NTSTATUS HandlePropertyInstances( IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, @@ -205,6 +195,8 @@ // Get the IrpTarget IrpTarget = (IIrpTarget*)IoStack->FileObject->FsContext; + PC_ASSERT(IrpTarget); + // Get the parent Status = IrpTarget->QueryInterface(IID_IPort, (PVOID*)&Port); if (!NT_SUCCESS(Status)) @@ -275,148 +267,6 @@ NTSTATUS NTAPI -FastPropertyHandler( - IN PFILE_OBJECT FileObject, - IN PKSPROPERTY UNALIGNED Property, - IN ULONG PropertyLength, - IN OUT PVOID UNALIGNED Data, - IN ULONG DataLength, - OUT PIO_STATUS_BLOCK IoStatus, - IN ULONG PropertySetsCount, - IN const KSPROPERTY_SET *PropertySet, - IN PSUBDEVICE_DESCRIPTOR Descriptor, - IN ISubdevice *SubDevice) -{ - PFNKSHANDLER PropertyHandler = NULL; - NTSTATUS Status; - KSP_PIN * Pin; - ULONG Size, Index; - PKSMULTIPLE_ITEM Item; - - PC_ASSERT(Descriptor); - - if (!IsEqualGUIDAligned(Property->Set, KSPROPSETID_Pin)) - { - // the fast handler only supports pin properties atm*/ - DPRINT("Only KSPROPSETID_Pin is supported\n"); - IoStatus->Status = Status = STATUS_NOT_IMPLEMENTED; - IoStatus->Information = 0; - return Status; - } - - // property handler is used to verify input parameters - Status = FindPropertyHandler(IoStatus, Descriptor, Property, PropertyLength, DataLength, Data, &PropertyHandler); - if (!NT_SUCCESS(Status)) - { - DPRINT("FindPropertyHandler failed with %x\n", Status); - IoStatus->Status = Status = Status; - IoStatus->Information = 0; - return Status; - } - - switch(Property->Id) - { - case KSPROPERTY_PIN_CTYPES: - (*(PULONG)Data) = Descriptor->Factory.PinDescriptorCount; - IoStatus->Information = sizeof(ULONG); - IoStatus->Status = Status = STATUS_SUCCESS; - break; - case KSPROPERTY_PIN_DATAFLOW: - Pin = (KSP_PIN*)Property; - if (Pin->PinId >= Descriptor->Factory.PinDescriptorCount) - { - IoStatus->Status = Status = STATUS_INVALID_PARAMETER; - IoStatus->Information = 0; - break; - } - - *((KSPIN_DATAFLOW*)Data) = Descriptor->Factory.KsPinDescriptor[Pin->PinId].DataFlow; - IoStatus->Information = sizeof(KSPIN_DATAFLOW); - IoStatus->Status = Status = STATUS_SUCCESS; - break; - case KSPROPERTY_PIN_COMMUNICATION: - Pin = (KSP_PIN*)Property; - if (Pin->PinId >= Descriptor->Factory.PinDescriptorCount) - { - IoStatus->Status = Status = STATUS_INVALID_PARAMETER; - IoStatus->Information = 0; - break; - } - - *((KSPIN_COMMUNICATION*)Data) = Descriptor->Factory.KsPinDescriptor[Pin->PinId].Communication; - IoStatus->Status = Status = STATUS_SUCCESS; - IoStatus->Information = sizeof(KSPIN_COMMUNICATION); - break; - case KSPROPERTY_PIN_DATARANGES: - Pin = (KSP_PIN*)Property; - if (Pin->PinId >= Descriptor->Factory.PinDescriptorCount) - { - IoStatus->Status = Status = STATUS_INVALID_PARAMETER; - IoStatus->Information = 0; - break; - } - Size = sizeof(KSMULTIPLE_ITEM); - for (Index = 0; Index < Descriptor->Factory.KsPinDescriptor[Pin->PinId].DataRangesCount; Index++) - { - Size += Descriptor->Factory.KsPinDescriptor[Pin->PinId].DataRanges[Index]->FormatSize; - } - - if (DataLength < Size) - { - IoStatus->Information = Size; - IoStatus->Status = STATUS_BUFFER_TOO_SMALL; - break; - } - - Item = (KSMULTIPLE_ITEM*)Data; - Item->Size = Size; - Item->Count = Descriptor->Factory.KsPinDescriptor[Pin->PinId].DataRangesCount; - - Data = (PUCHAR)(Item +1); - for (Index = 0; Index < Descriptor->Factory.KsPinDescriptor[Pin->PinId].DataRangesCount; Index++) - { - RtlMoveMemory(Data, Descriptor->Factory.KsPinDescriptor[Pin->PinId].DataRanges[Index], Descriptor->Factory.KsPinDescriptor[Pin->PinId].DataRanges[Index]->FormatSize); - Data = ((PUCHAR)Data + Descriptor->Factory.KsPinDescriptor[Pin->PinId].DataRanges[Index]->FormatSize); - } - - IoStatus->Status = Status = STATUS_SUCCESS; - IoStatus->Information = Size; - break; - - case KSPROPERTY_PIN_GLOBALCINSTANCES: - Status = HandlePropertyInstances(IoStatus, Property, Data, Descriptor, TRUE); - break; - case KSPROPERTY_PIN_CINSTANCES: - Status = HandlePropertyInstances(IoStatus, Property, Data, Descriptor, FALSE); - break; - case KSPROPERTY_PIN_NECESSARYINSTANCES: - Status = HandleNecessaryPropertyInstances(IoStatus, Property, Data, Descriptor); - break; - - case KSPROPERTY_PIN_DATAINTERSECTION: - Status = HandleDataIntersection(IoStatus, Property, Data, DataLength, Descriptor, SubDevice); - break; - case KSPROPERTY_PIN_PHYSICALCONNECTION: - case KSPROPERTY_PIN_CONSTRAINEDDATARANGES: - case KSPROPERTY_PIN_INTERFACES: - case KSPROPERTY_PIN_MEDIUMS: - case KSPROPERTY_PIN_CATEGORY: - case KSPROPERTY_PIN_NAME: - case KSPROPERTY_PIN_PROPOSEDATAFORMAT: - UNIMPLEMENTED - IoStatus->Status = Status = STATUS_NOT_IMPLEMENTED; - IoStatus->Information = 0; - break; - default: - UNIMPLEMENTED - IoStatus->Status = Status = STATUS_NOT_IMPLEMENTED; - IoStatus->Information = 0; - } - return Status; -} - -NTSTATUS -NTAPI TopologyPropertyHandler( IN PIRP Irp, IN PKSIDENTIFIER Request, @@ -428,245 +278,3 @@ return KsTopologyPropertyHandler(Irp, Request, Data, Descriptor->Topology); } - -NTSTATUS -FindPropertyHandler( - IN PIO_STATUS_BLOCK IoStatus, - IN PSUBDEVICE_DESCRIPTOR Descriptor, - IN PKSPROPERTY Property, - IN ULONG InputBufferLength, - IN ULONG OutputBufferLength, - OUT PVOID OutputBuffer, - OUT PFNKSHANDLER *PropertyHandler) -{ - ULONG Index, ItemIndex; - PULONG Flags; - PKSPROPERTY_DESCRIPTION Description; - - for(Index = 0; Index < Descriptor->FilterPropertySet.FreeKsPropertySetOffset; Index++) - { - if (IsEqualGUIDAligned(Property->Set, *Descriptor->FilterPropertySet.Properties[Index].Set)) - { - for(ItemIndex = 0; ItemIndex < Descriptor->FilterPropertySet.Properties[Index].PropertiesCount; ItemIndex++) - { - if (Descriptor->FilterPropertySet.Properties[Index].PropertyItem[ItemIndex].PropertyId == Property->Id) - { - if (Property->Flags & KSPROPERTY_TYPE_SET) - *PropertyHandler = Descriptor->FilterPropertySet.Properties[Index].PropertyItem[ItemIndex].SetPropertyHandler; - - if (Property->Flags & KSPROPERTY_TYPE_GET) - *PropertyHandler = Descriptor->FilterPropertySet.Properties[Index].PropertyItem[ItemIndex].GetPropertyHandler; - - if (Property->Flags & KSPROPERTY_TYPE_BASICSUPPORT) - { - if (sizeof(ULONG) > OutputBufferLength) - { - // too small buffer - return STATUS_INVALID_PARAMETER; - } - - // get output buffer - Flags = (PULONG)OutputBuffer; - - // clear flags - *Flags = KSPROPERTY_TYPE_BASICSUPPORT; - - if (Descriptor->FilterPropertySet.Properties[Index].PropertyItem[ItemIndex].GetSupported) - *Flags |= KSPROPERTY_TYPE_GET; - - if (Descriptor->FilterPropertySet.Properties[Index].PropertyItem[ItemIndex].SetSupported) - *Flags |= KSPROPERTY_TYPE_SET; - - IoStatus->Information = sizeof(ULONG); - - if (OutputBufferLength >= sizeof(KSPROPERTY_DESCRIPTION)) - { - // get output buffer - Description = (PKSPROPERTY_DESCRIPTION)OutputBuffer; - - // store result - Description->DescriptionSize = sizeof(KSPROPERTY_DESCRIPTION); - Description->PropTypeSet.Set = KSPROPTYPESETID_General; - Description->PropTypeSet.Id = 0; - Description->PropTypeSet.Flags = 0; - Description->MembersListCount = 0; - Description->Reserved = 0; - - IoStatus->Information = sizeof(KSPROPERTY_DESCRIPTION); - } - - return STATUS_SUCCESS; - } - - - if (Descriptor->FilterPropertySet.Properties[Index].PropertyItem[ItemIndex].MinProperty > InputBufferLength) - { - // too small input buffer - IoStatus->Information = Descriptor->FilterPropertySet.Properties[Index].PropertyItem[ItemIndex].MinProperty; - IoStatus->Status = STATUS_BUFFER_TOO_SMALL; - return STATUS_BUFFER_TOO_SMALL; - } - - if (Descriptor->FilterPropertySet.Properties[Index].PropertyItem[ItemIndex].MinData > OutputBufferLength) - { - // too small output buffer - IoStatus->Information = Descriptor->FilterPropertySet.Properties[Index].PropertyItem[ItemIndex].MinData; - IoStatus->Status = STATUS_BUFFER_TOO_SMALL; - return STATUS_BUFFER_TOO_SMALL; - } - return STATUS_SUCCESS; - } - } - } - } - return STATUS_UNSUCCESSFUL; -} - -NTSTATUS -PcCountProperties( - IN PIRP Irp, - IN PSUBDEVICE_DESCRIPTOR Descriptor) -{ - ULONG Properties; - ULONG Index, Offset; - PIO_STACK_LOCATION IoStack; - LPGUID Guid; - - // count property items - Properties = Descriptor->FilterPropertySet.FreeKsPropertySetOffset; - - if (Descriptor->DeviceDescriptor->AutomationTable) - { - Properties = Descriptor->DeviceDescriptor->AutomationTable->PropertyCount; - } - - // get current irp stack - IoStack = IoGetCurrentIrpStackLocation(Irp); - - // store output size - Irp->IoStatus.Information = sizeof(GUID) * Properties; - - if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(GUID) * Properties) - { - // buffer too small - Irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return STATUS_BUFFER_OVERFLOW; - } - - // get output buffer - Guid = (LPGUID)Irp->UserBuffer; - - - // copy property guids from filter - Offset = 0; - for(Index = 0; Index < Descriptor->FilterPropertySet.FreeKsPropertySetOffset; Index++) - { - RtlMoveMemory(&Guid[Offset], Descriptor->FilterPropertySet.Properties[Index].Set, sizeof(GUID)); - Offset++; - } - - if (Descriptor->DeviceDescriptor->AutomationTable) - { - // copy property guids from driver - for(Index = 0; Index < Descriptor->DeviceDescriptor->AutomationTable->PropertyCount; Index++) - { - RtlMoveMemory(&Guid[Offset], Descriptor->DeviceDescriptor->AutomationTable->Properties[Index].Set, sizeof(GUID)); - Offset++; - } - } - - // done - Irp->IoStatus.Status = STATUS_SUCCESS; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return STATUS_SUCCESS; -} - - -NTSTATUS -NTAPI -PcPropertyHandler( - IN PIRP Irp, - IN PSUBDEVICE_DESCRIPTOR Descriptor) -{ - ULONG Index; - PIO_STACK_LOCATION IoStack; - PKSPROPERTY Property; - PFNKSHANDLER PropertyHandler = NULL; - UNICODE_STRING GuidString; - NTSTATUS Status = STATUS_UNSUCCESSFUL; - PPCPROPERTY_REQUEST PropertyRequest; - - IoStack = IoGetCurrentIrpStackLocation(Irp); - - Property = (PKSPROPERTY)IoStack->Parameters.DeviceIoControl.Type3InputBuffer; - PC_ASSERT(Property); - - if (IsEqualGUIDAligned(Property->Set, GUID_NULL) && Property->Id == 0 && Property->Flags == KSPROPERTY_TYPE_SETSUPPORT) - { - return PcCountProperties(Irp, Descriptor); - } - - - // check properties provided by the driver - if (Descriptor->DeviceDescriptor->AutomationTable) - { - for(Index = 0; Index < Descriptor->DeviceDescriptor->AutomationTable->PropertyCount; Index++) - { - if (IsEqualGUID(*Descriptor->DeviceDescriptor->AutomationTable->Properties[Index].Set, Property->Set)) - { - if (Descriptor->DeviceDescriptor->AutomationTable->Properties[Index].Id == Property->Id) - { - if(Descriptor->DeviceDescriptor->AutomationTable->Properties[Index].Flags & Property->Flags) - { - PropertyRequest = (PPCPROPERTY_REQUEST)ExAllocatePool(NonPagedPool, sizeof(PCPROPERTY_REQUEST)); - if (!PropertyRequest) - { - // no memory - Irp->IoStatus.Information = 0; - Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_INSUFFICIENT_RESOURCES; - } - RtlZeroMemory(PropertyRequest, sizeof(PCPROPERTY_REQUEST)); - PropertyRequest->PropertyItem = &Descriptor->DeviceDescriptor->AutomationTable->Properties[Index]; - PropertyRequest->Verb = Property->Flags; - PropertyRequest->Value = Irp->UserBuffer; - PropertyRequest->ValueSize = IoStack->Parameters.DeviceIoControl.OutputBufferLength; - PropertyRequest->Irp = Irp; - - DPRINT("Calling handler %p\n", Descriptor->DeviceDescriptor->AutomationTable->Properties[Index].Handler); - Status = Descriptor->DeviceDescriptor->AutomationTable->Properties[Index].Handler(PropertyRequest); - - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return Status; - } - } - } - } - } - - Status = FindPropertyHandler(&Irp->IoStatus, Descriptor, Property, IoStack->Parameters.DeviceIoControl.InputBufferLength, IoStack->Parameters.DeviceIoControl.OutputBufferLength, Irp->UserBuffer, &PropertyHandler); - if (NT_SUCCESS(Status) && PropertyHandler) - { - // HACK - KSPROPERTY_ITEM_IRP_STORAGE(Irp) = (const KSPROPERTY_ITEM*)Descriptor; - DPRINT("Calling property handler %p\n", PropertyHandler); - Status = PropertyHandler(Irp, Property, Irp->UserBuffer); - } - else if (!NT_SUCCESS(Status)) - { - RtlStringFromGUID(Property->Set, &GuidString); - DPRINT1("Unhandeled property: Set %S Id %u Flags %x InputLength %u OutputLength %u\n", GuidString.Buffer, Property->Id, Property->Flags, IoStack->Parameters.DeviceIoControl.InputBufferLength, IoStack->Parameters.DeviceIoControl.OutputBufferLength); - RtlFreeUnicodeString(&GuidString); - } - - // the information member is set by the handler - Irp->IoStatus.Status = Status; - DPRINT("Result %x Length %u\n", Status, Irp->IoStatus.Information); - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return Status; -} Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.cpp [iso-8859-1] Tue Sep 29 12:46:30 2009 @@ -43,6 +43,18 @@ return (IIrpTarget*)CreateItem->Context; } +NTSTATUS +NTAPI +PcHandlePropertyWithTable( + IN PIRP Irp, + IN ULONG PropertySetCount, + IN PKSPROPERTY_SET PropertySet, + IN PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor) +{ + KSPROPERTY_ITEM_IRP_STORAGE(Irp) = (PKSPROPERTY_ITEM)SubDeviceDescriptor; + return KsPropertyHandler(Irp, PropertySetCount, PropertySet); +} + VOID NTAPI PcAcquireFormatResources( @@ -90,52 +102,6 @@ { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; -} - -NTSTATUS -AddToPropertyTable( - IN OUT SUBDEVICE_DESCRIPTOR * Descriptor, - IN KSPROPERTY_SET * FilterProperty) -{ - if (Descriptor->FilterPropertySet.FreeKsPropertySetOffset >= Descriptor->FilterPropertySet.MaxKsPropertySetCount) - { - DPRINT1("FIXME\n"); - return STATUS_UNSUCCESSFUL; - } - - RtlMoveMemory(&Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset], - FilterProperty, - sizeof(KSPROPERTY_SET)); - - if (FilterProperty->PropertiesCount) - { - Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset].PropertyItem = (const KSPROPERTY_ITEM*)AllocateItem(NonPagedPool, - sizeof(KSPROPERTY_ITEM) * FilterProperty->PropertiesCount, - TAG_PORTCLASS); - - if (!Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset].PropertyItem) - { - Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset].PropertiesCount = 0; - return STATUS_INSUFFICIENT_RESOURCES; - } - RtlMoveMemory((PVOID)Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset].PropertyItem, - FilterProperty->PropertyItem, - sizeof(KSPROPERTY_ITEM) * FilterProperty->PropertiesCount); - - } - Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset].Set = (const GUID *)AllocateItem(NonPagedPool, sizeof(GUID), TAG_PORTCLASS); - if (!Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset].Set) - return STATUS_INSUFFICIENT_RESOURCES; - - RtlCopyMemory((PVOID)Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset].Set, FilterProperty->Set, sizeof(GUID)); - - // ignore fast io table for now - Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset].FastIoCount = 0; - Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset].FastIoTable = NULL; - - Descriptor->FilterPropertySet.FreeKsPropertySetOffset++; - - return STATUS_SUCCESS; } NTSTATUS @@ -157,8 +123,7 @@ IN PPCFILTER_DESCRIPTOR FilterDescription) { SUBDEVICE_DESCRIPTOR * Descriptor; - ULONG Index, SubIndex; - PKSDATARANGE DataRange; + ULONG Index; NTSTATUS Status = STATUS_INSUFFICIENT_RESOURCES; PPCPIN_DESCRIPTOR SrcDescriptor; @@ -182,16 +147,14 @@ { /// FIXME /// handle driver properties - Descriptor->FilterPropertySet.Properties = (PKSPROPERTY_SET)AllocateItem(NonPagedPool, sizeof(KSPROPERTY_SET) * FilterPropertiesCount, TAG_PORTCLASS); - if (! Descriptor->FilterPropertySet.Properties) + Descriptor->FilterPropertySet = (PKSPROPERTY_SET)AllocateItem(NonPagedPool, sizeof(KSPROPERTY_SET) * FilterPropertiesCount, TAG_PORTCLASS); + if (! Descriptor->FilterPropertySet) goto cleanup; - Descriptor->FilterPropertySet.MaxKsPropertySetCount = FilterPropertiesCount; + Descriptor->FilterPropertySetCount = FilterPropertiesCount; for(Index = 0; Index < FilterPropertiesCount; Index++) { - Status = AddToPropertyTable(Descriptor, &FilterProperties[Index]); - if (!NT_SUCCESS(Status)) - goto cleanup; + RtlMoveMemory(&Descriptor->FilterPropertySet[Index], &FilterProperties[Index], sizeof(KSPROPERTY_SET)); } } @@ -254,29 +217,6 @@ { RtlMoveMemory(&Descriptor->Factory.KsPinDescriptor[Index], &SrcDescriptor->KsPinDescriptor, sizeof(KSPIN_DESCRIPTOR)); - if (SrcDescriptor->KsPinDescriptor.DataRangesCount) - { - Descriptor->Factory.KsPinDescriptor[Index].DataRanges = (const PKSDATARANGE*)AllocateItem(NonPagedPool, SrcDescriptor->KsPinDescriptor.DataRangesCount * sizeof(PKSDATARANGE), TAG_PORTCLASS); - if(!Descriptor->Factory.KsPinDescriptor[Index].DataRanges) - goto cleanup; - - for (SubIndex = 0; SubIndex < FilterDescription->Pins[Index].KsPinDescriptor.DataRangesCount; SubIndex++) - { - DataRange = (PKSDATARANGE)AllocateItem(NonPagedPool, SrcDescriptor->KsPinDescriptor.DataRanges[SubIndex]->FormatSize, TAG_PORTCLASS); - if (!DataRange) - goto cleanup; - - RtlMoveMemory(DataRange, - SrcDescriptor->KsPinDescriptor.DataRanges[SubIndex], - SrcDescriptor->KsPinDescriptor.DataRanges[SubIndex]->FormatSize); - - ((PKSDATAFORMAT*)Descriptor->Factory.KsPinDescriptor[Index].DataRanges)[SubIndex] = DataRange; - - } - - Descriptor->Factory.KsPinDescriptor[Index].DataRangesCount = SrcDescriptor->KsPinDescriptor.DataRangesCount; - } - Descriptor->Factory.Instances[Index].CurrentPinInstanceCount = 0; Descriptor->Factory.Instances[Index].MaxFilterInstanceCount = FilterDescription->Pins[Index].MaxFilterInstanceCount; Descriptor->Factory.Instances[Index].MaxGlobalInstanceCount = FilterDescription->Pins[Index].MaxGlobalInstanceCount;
15 years, 2 months
1
0
0
0
[fireball] 43222: [fastfat_new] - Start integrating FullFAT library. - Current state is that it's able to mount a FAT volume.
by fireball@svn.reactos.org
Author: fireball Date: Tue Sep 29 12:08:43 2009 New Revision: 43222 URL:
http://svn.reactos.org/svn/reactos?rev=43222&view=rev
Log: [fastfat_new] - Start integrating FullFAT library. - Current state is that it's able to mount a FAT volume. Added: trunk/reactos/drivers/filesystems/fastfat_new/fullfat.c (with props) Modified: trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h trunk/reactos/drivers/filesystems/fastfat_new/fastfat.rbuild trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h trunk/reactos/drivers/filesystems/fastfat_new/fcb.c trunk/reactos/drivers/filesystems/fastfat_new/fsctl.c Modified: trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] Tue Sep 29 12:08:43 2009 @@ -2,6 +2,8 @@ #include <ntdddisk.h> #include <debug.h> #include <pseh/pseh2.h> + +#include "fullfat.h" #include <fat.h> #include <fatstruc.h> @@ -150,6 +152,14 @@ OUT PVCB *Vcb, OUT PFCB *FcbOrDcb, OUT PCCB *Ccb); + +/* --------------------------------------------------------- fullfat.c */ + +FF_T_SINT32 +FatWriteBlocks(FF_T_UINT8 *pBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Count, void *pParam); + +FF_T_SINT32 +FatReadBlocks(FF_T_UINT8 *pBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Count, void *pParam); /* --------------------------------------------------------- lock.c */ Modified: trunk/reactos/drivers/filesystems/fastfat_new/fastfat.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fastfat.rbuild [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fastfat.rbuild [iso-8859-1] Tue Sep 29 12:08:43 2009 @@ -3,9 +3,11 @@ <module name="fastfatn" type="kernelmodedriver" installbase="system32/drivers" installname="fastfatn.sys"> <bootstrap installbase="$(CDOUTPUT)" /> <include base="fastfatn">.</include> + <include base="ReactOS">include/reactos/libs/fullfat</include> <library>ntoskrnl</library> <library>hal</library> <library>pseh</library> + <library>fullfat</library> <file>blockdev.c</file> <file>cleanup.c</file> <file>close.c</file> @@ -21,6 +23,7 @@ <file>finfo.c</file> <file>flush.c</file> <file>fsctl.c</file> + <file>fullfat.c</file> <file>lock.c</file> <file>rw.c</file> <file>shutdown.c</file> Modified: trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h [iso-8859-1] Tue Sep 29 12:08:43 2009 @@ -35,6 +35,10 @@ BOOLEAN Win31FileSystem; /* Jan 1, 1980 System Time */ LARGE_INTEGER DefaultFileTime; + + /* FullFAT integration */ + FF_IOMAN *Ioman; + FF_ERROR FF_Error; } FAT_GLOBAL_DATA; typedef struct _FAT_PAGE_CONTEXT @@ -175,6 +179,9 @@ struct _FCB *RootDcb; ULONG MediaChangeCount; + + /* FullFAT integration */ + FF_IOMAN *Ioman; } VCB, *PVCB; #define VcbToVolumeDeviceObject(xVcb) \ Modified: trunk/reactos/drivers/filesystems/fastfat_new/fcb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fcb.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fcb.c [iso-8859-1] Tue Sep 29 12:08:43 2009 @@ -12,7 +12,7 @@ #include "fastfat.h" /* FUNCTIONS ****************************************************************/ - +#if 0 /** * Locates FCB by the supplied name in the cache trie of fcbs. * @@ -325,4 +325,5 @@ &Context.ShortName, &LongFileName); return Status; } +#endif /* EOF */ Modified: trunk/reactos/drivers/filesystems/fastfat_new/fsctl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fsctl.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fsctl.c [iso-8859-1] Tue Sep 29 12:08:43 2009 @@ -58,6 +58,8 @@ DISK_GEOMETRY DiskGeometry; ULONG MediaChangeCount = 0; PVOLUME_DEVICE_OBJECT VolumeDevice; + VCB *Vcb; + FF_ERROR Error; DPRINT1("FatMountVolume()\n"); @@ -81,6 +83,9 @@ /* Remove unmounted VCBs */ FatiCleanVcbs(IrpContext); + /* Acquire the global exclusive lock */ + FatAcquireExclusiveGlobal(IrpContext); + /* Create a new volume device object */ Status = IoCreateDevice(FatGlobalData.DriverObject, sizeof(VOLUME_DEVICE_OBJECT) - sizeof(DEVICE_OBJECT), @@ -90,7 +95,13 @@ FALSE, (PDEVICE_OBJECT *)&VolumeDevice); - if (!NT_SUCCESS(Status)) return Status; + if (!NT_SUCCESS(Status)) + { + /* Release the global lock */ + FatReleaseGlobal(IrpContext); + + return Status; + } /* Match alignment requirements */ if (TargetDeviceObject->AlignmentRequirement > VolumeDevice->DeviceObject.AlignmentRequirement) @@ -124,14 +135,53 @@ Status = FatInitializeVcb(IrpContext, &VolumeDevice->Vcb, TargetDeviceObject, Vpb); if (!NT_SUCCESS(Status)) goto FatMountVolumeCleanup; + Vcb = &VolumeDevice->Vcb; + + /* Initialize FullFAT library */ + Vcb->Ioman = FF_CreateIOMAN(NULL, + 8192, + VolumeDevice->DeviceObject.SectorSize, + &Error); + + ASSERT(Vcb->Ioman); + + /* Register block device read/write functions */ + Error = FF_RegisterBlkDevice(Vcb->Ioman, + VolumeDevice->DeviceObject.SectorSize, + (FF_WRITE_BLOCKS)FatWriteBlocks, + (FF_READ_BLOCKS)FatReadBlocks, + Vcb); + + if (Error) + { + DPRINT1("Registering block device with FullFAT failed with error %d\n", Error); + FF_DestroyIOMAN(Vcb->Ioman); + goto FatMountVolumeCleanup; + } + + /* Mount the volume using FullFAT */ + if(FF_MountPartition(Vcb->Ioman, 0)) + { + DPRINT1("Partition mounting failed\n"); + FF_DestroyIOMAN(Vcb->Ioman); + goto FatMountVolumeCleanup; + } + + // TODO: Read BPB and store it in Vcb->Bpb + /* Create root DCB for it */ FatCreateRootDcb(IrpContext, &VolumeDevice->Vcb); /* Keep trace of media changes */ VolumeDevice->Vcb.MediaChangeCount = MediaChangeCount; + //ObDereferenceObject(TargetDeviceObject); + + /* Release the global lock */ + FatReleaseGlobal(IrpContext); + /* Notify about volume mount */ - FsRtlNotifyVolumeEvent(VolumeDevice->Vcb.StreamFileObject, FSRTL_VOLUME_MOUNT); + //FsRtlNotifyVolumeEvent(VolumeDevice->Vcb.StreamFileObject, FSRTL_VOLUME_MOUNT); /* Return success */ return STATUS_SUCCESS; @@ -141,6 +191,10 @@ /* Unwind the routine actions */ IoDeleteDevice((PDEVICE_OBJECT)VolumeDevice); + + /* Release the global lock */ + FatReleaseGlobal(IrpContext); + return Status; } Added: trunk/reactos/drivers/filesystems/fastfat_new/fullfat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fullfat.c (added) +++ trunk/reactos/drivers/filesystems/fastfat_new/fullfat.c [iso-8859-1] Tue Sep 29 12:08:43 2009 @@ -1,0 +1,75 @@ +/* + * PROJECT: ReactOS FAT file system driver + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/filesystems/fastfat/fullfat.c + * PURPOSE: FullFAT integration routines + * PROGRAMMERS: Aleksey Bragin (aleksey(a)reactos.org) + */ + +/* INCLUDES *****************************************************************/ + +#define NDEBUG +#include "fastfat.h" + +/* GLOBALS ******************************************************************/ + +#define TAG_FULLFAT 'FLUF' + +/* FUNCTIONS ****************************************************************/ + +VOID * +FF_Malloc(FF_T_UINT32 allocSize) +{ + return ExAllocatePoolWithTag(PagedPool, allocSize, TAG_FULLFAT); +} + +VOID +FF_Free(VOID *pBuffer) +{ + return ExFreePoolWithTag(pBuffer, TAG_FULLFAT); +} + +FF_T_SINT32 +FatWriteBlocks(FF_T_UINT8 *pBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Count, void *pParam) +{ + DPRINT1("FatWriteBlocks %p %d %d %p\n", pBuffer, SectorAddress, Count, pParam); + + return 0; +} + +FF_T_SINT32 +FatReadBlocks(FF_T_UINT8 *DestBuffer, FF_T_UINT32 SectorAddress, FF_T_UINT32 Count, void *pParam) +{ + LARGE_INTEGER Offset; + PVOID Buffer; + PVCB Vcb = (PVCB)pParam; + PBCB Bcb; + ULONG SectorSize = 512; // FIXME: hardcoding 512 is bad + + DPRINT1("FatReadBlocks %p %d %d %p\n", DestBuffer, SectorAddress, Count, pParam); + + /* Calculate the offset */ + Offset.QuadPart = Int32x32To64(SectorAddress, SectorSize); + + if (!CcMapData(Vcb->StreamFileObject, + &Offset, + Count * SectorSize, + TRUE, + &Bcb, + &Buffer)) + { + /* Mapping failed */ + return 0; + } + + /* Copy data to the buffer */ + RtlCopyMemory(DestBuffer, Buffer, Count * SectorSize); + + /* Unpin unneeded data */ + CcUnpinData(Bcb); + + /* Return amount of read data in sectors */ + return Count; +} + +/* EOF */ Propchange: trunk/reactos/drivers/filesystems/fastfat_new/fullfat.c ------------------------------------------------------------------------------ svn:eol-style = native
15 years, 2 months
1
0
0
0
[fireball] 43221: [fullfat] - Remove all malloc/free usage in the library and substitute them by user-provided FF_Malloc and FF_Free functions. - Cleanup fullfat.rbuild.
by fireball@svn.reactos.org
Author: fireball Date: Tue Sep 29 11:14:08 2009 New Revision: 43221 URL:
http://svn.reactos.org/svn/reactos?rev=43221&view=rev
Log: [fullfat] - Remove all malloc/free usage in the library and substitute them by user-provided FF_Malloc and FF_Free functions. - Cleanup fullfat.rbuild. Modified: trunk/reactos/include/reactos/libs/fullfat/ff_memory.h trunk/reactos/lib/3rdparty/fullfat/ff_file.c trunk/reactos/lib/3rdparty/fullfat/ff_hash.c trunk/reactos/lib/3rdparty/fullfat/ff_ioman.c trunk/reactos/lib/3rdparty/fullfat/fullfat.rbuild Modified: trunk/reactos/include/reactos/libs/fullfat/ff_memory.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/fullf…
============================================================================== --- trunk/reactos/include/reactos/libs/fullfat/ff_memory.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/libs/fullfat/ff_memory.h [iso-8859-1] Tue Sep 29 11:14:08 2009 @@ -52,5 +52,8 @@ void FF_putShort (FF_T_UINT8 *pBuffer, FF_T_UINT16 offset, FF_T_UINT16 Value); void FF_putLong (FF_T_UINT8 *pBuffer, FF_T_UINT16 offset, FF_T_UINT32 Value); +void *FF_Malloc(FF_T_UINT32 allocSize); +void FF_Free(void *pBuffer); + #endif Modified: trunk/reactos/lib/3rdparty/fullfat/ff_file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/fullfat/ff_fi…
============================================================================== --- trunk/reactos/lib/3rdparty/fullfat/ff_file.c [iso-8859-1] (original) +++ trunk/reactos/lib/3rdparty/fullfat/ff_file.c [iso-8859-1] Tue Sep 29 11:14:08 2009 @@ -163,7 +163,7 @@ } return (FF_FILE *)NULL; } - pFile = malloc(sizeof(FF_FILE)); + pFile = FF_Malloc(sizeof(FF_FILE)); if(!pFile) { if(pError) { *pError = FF_ERR_NOT_ENOUGH_MEMORY; Modified: trunk/reactos/lib/3rdparty/fullfat/ff_hash.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/fullfat/ff_ha…
============================================================================== --- trunk/reactos/lib/3rdparty/fullfat/ff_hash.c [iso-8859-1] (original) +++ trunk/reactos/lib/3rdparty/fullfat/ff_hash.c [iso-8859-1] Tue Sep 29 11:14:08 2009 @@ -53,7 +53,7 @@ * **/ FF_HASH_TABLE FF_CreateHashTable() { - FF_HASH_TABLE pHash = (FF_HASH_TABLE) malloc(sizeof(struct _FF_HASH_TABLE)); + FF_HASH_TABLE pHash = (FF_HASH_TABLE) FF_Malloc(sizeof(struct _FF_HASH_TABLE)); if(pHash) { FF_ClearHashTable(pHash); Modified: trunk/reactos/lib/3rdparty/fullfat/ff_ioman.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/fullfat/ff_io…
============================================================================== --- trunk/reactos/lib/3rdparty/fullfat/ff_ioman.c [iso-8859-1] (original) +++ trunk/reactos/lib/3rdparty/fullfat/ff_ioman.c [iso-8859-1] Tue Sep 29 11:14:08 2009 @@ -89,7 +89,7 @@ return NULL; // Memory Size not a multiple of BlkSize > 0 } - pIoman = (FF_IOMAN *) malloc(sizeof(FF_IOMAN)); + pIoman = (FF_IOMAN *) FF_Malloc(sizeof(FF_IOMAN)); if(!pIoman) { // Ensure malloc() succeeded. if(pError) { @@ -106,7 +106,7 @@ pIoman->pPartition = NULL; pIoman->pSemaphore = NULL; - pIoman->pPartition = (FF_PARTITION *) malloc(sizeof(FF_PARTITION)); + pIoman->pPartition = (FF_PARTITION *) FF_Malloc(sizeof(FF_PARTITION)); if(pIoman->pPartition) { // If succeeded, flag that allocation. pIoman->MemAllocation |= FF_IOMAN_ALLOC_PART; pIoman->pPartition->LastFreeCluster = 0; @@ -127,7 +127,7 @@ return NULL; } - pIoman->pBlkDevice = (FF_BLK_DEVICE *) malloc(sizeof(FF_BLK_DEVICE)); + pIoman->pBlkDevice = (FF_BLK_DEVICE *) FF_Malloc(sizeof(FF_BLK_DEVICE)); if(pIoman->pBlkDevice) { // If succeeded, flag that allocation. pIoman->MemAllocation |= FF_IOMAN_ALLOC_BLKDEV; @@ -145,7 +145,7 @@ if(pCacheMem) { pIoman->pCacheMem = pCacheMem; }else { // No-Cache buffer provided (malloc) - pLong = (FF_T_UINT32 *) malloc(Size); + pLong = (FF_T_UINT32 *) FF_Malloc(Size); pIoman->pCacheMem = (FF_T_UINT8 *) pLong; if(!pIoman->pCacheMem) { pIoman->MemAllocation |= FF_IOMAN_ALLOC_BUFFERS; @@ -163,7 +163,7 @@ /* Malloc() memory for buffer objects. (FullFAT never refers to a buffer directly but uses buffer objects instead. Allows us to provide thread safety. */ - pIoman->pBuffers = (FF_BUFFER *) malloc(sizeof(FF_BUFFER) * pIoman->CacheSize); + pIoman->pBuffers = (FF_BUFFER *) FF_Malloc(sizeof(FF_BUFFER) * pIoman->CacheSize); if(pIoman->pBuffers) { pIoman->MemAllocation |= FF_IOMAN_ALLOC_BUFDESCR; @@ -196,22 +196,22 @@ // Ensure pPartition pointer was allocated. if((pIoman->MemAllocation & FF_IOMAN_ALLOC_PART)) { - free(pIoman->pPartition); + FF_Free(pIoman->pPartition); } // Ensure pBlkDevice pointer was allocated. if((pIoman->MemAllocation & FF_IOMAN_ALLOC_BLKDEV)) { - free(pIoman->pBlkDevice); + FF_Free(pIoman->pBlkDevice); } // Ensure pBuffers pointer was allocated. if((pIoman->MemAllocation & FF_IOMAN_ALLOC_BUFDESCR)) { - free(pIoman->pBuffers); + FF_Free(pIoman->pBuffers); } // Ensure pCacheMem pointer was allocated. if((pIoman->MemAllocation & FF_IOMAN_ALLOC_BUFFERS)) { - free(pIoman->pCacheMem); + FF_Free(pIoman->pCacheMem); } // Destroy any Semaphore that was created. @@ -220,7 +220,7 @@ } // Finally free the FF_IOMAN object. - free(pIoman); + FF_Free(pIoman); return FF_ERR_NONE; } Modified: trunk/reactos/lib/3rdparty/fullfat/fullfat.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/fullfat/fullf…
============================================================================== --- trunk/reactos/lib/3rdparty/fullfat/fullfat.rbuild [iso-8859-1] (original) +++ trunk/reactos/lib/3rdparty/fullfat/fullfat.rbuild [iso-8859-1] Tue Sep 29 11:14:08 2009 @@ -1,8 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> -<module name="fullfat" type="staticlibrary" allowwarnings="true"> +<module name="fullfat" type="staticlibrary"> <include base="ReactOS">include/reactos/libs/fullfat</include> - <define name="_DISABLE_TIDENTS" /> <define name="__NTDRIVER__" /> <define name="__NO_CTYPE_INLINES" />
15 years, 2 months
1
0
0
0
[jimtabor] 43220: - Add GraphApp, Ext2 and X to the list of acknowledged projects.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Tue Sep 29 06:01:30 2009 New Revision: 43220 URL:
http://svn.reactos.org/svn/reactos?rev=43220&view=rev
Log: - Add GraphApp, Ext2 and X to the list of acknowledged projects. Modified: trunk/reactos/dll/win32/syssetup/syssetup.rc Modified: trunk/reactos/dll/win32/syssetup/syssetup.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/syssetu…
============================================================================== --- trunk/reactos/dll/win32/syssetup/syssetup.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/syssetup/syssetup.rc [iso-8859-1] Tue Sep 29 06:01:30 2009 @@ -37,6 +37,9 @@ "FreeBSD -
http://www.freebsd.org\n
"\ "adns -
http://adns.jgaa.com\n
"\ "ICU -
http://www.icu-project.org/\n
"\ + "GraphApp -
http://enchantia.com/software/graphapp/\n
"\ + "Ext2 -
http://winext2fsd.sourceforge.net/\n
"\ + "X -
http://www.x.org/\n
"\ "" END
15 years, 2 months
1
0
0
0
[janderwald] 43219: - Retrieve the correct pin name
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Sep 29 02:25:05 2009 New Revision: 43219 URL:
http://svn.reactos.org/svn/reactos?rev=43219&view=rev
Log: - Retrieve the correct pin name Modified: trunk/reactos/drivers/ksfilter/ks/connectivity.c Modified: trunk/reactos/drivers/ksfilter/ks/connectivity.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/connec…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/connectivity.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/connectivity.c [iso-8859-1] Tue Sep 29 02:25:05 2009 @@ -487,14 +487,14 @@ break; } - if (!Descriptor[Pin->PinId].Category) + if (!Descriptor[Pin->PinId].Name) { Irp->IoStatus.Information = 0; Status = STATUS_SUCCESS; break; } - Status = KspReadMediaCategory((LPGUID)Descriptor[Pin->PinId].Category, &KeyInfo); + Status = KspReadMediaCategory((LPGUID)Descriptor[Pin->PinId].Name, &KeyInfo); if (!NT_SUCCESS(Status)) { Irp->IoStatus.Information = 0;
15 years, 2 months
1
0
0
0
[dgorbachev] 43218: Add 1152x864, 1280x1024, and 1600x1200 modes.
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Mon Sep 28 22:46:44 2009 New Revision: 43218 URL:
http://svn.reactos.org/svn/reactos?rev=43218&view=rev
Log: Add 1152x864, 1280x1024, and 1600x1200 modes. Modified: trunk/reactos/boot/bootdata/txtsetup.sif Modified: trunk/reactos/boot/bootdata/txtsetup.sif URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/txtsetup.sif…
============================================================================== --- trunk/reactos/boot/bootdata/txtsetup.sif [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/txtsetup.sif [iso-8859-1] Mon Sep 28 22:46:44 2009 @@ -93,6 +93,18 @@ vbe_1024x768x16 = "VESA Display (1024x768x16)",,VBE,1024,768,16 vbe_1024x768x24 = "VESA Display (1024x768x24)",,VBE,1024,768,24 vbe_1024x768x32 = "VESA Display (1024x768x32)",,VBE,1024,768,32 +vbe_1152x864x8 = "VESA Display (1152x864x8)",,VBE,1152,864,8 +vbe_1152x864x16 = "VESA Display (1152x864x16)",,VBE,1152,864,16 +vbe_1152x864x24 = "VESA Display (1152x864x24)",,VBE,1152,864,24 +vbe_1152x864x32 = "VESA Display (1152x864x32)",,VBE,1152,864,32 +vbe_1280x1024x8 = "VESA Display (1280x1024x8)",,VBE,1280,1024,8 +vbe_1280x1024x16 = "VESA Display (1280x1024x16)",,VBE,1280,1024,16 +vbe_1280x1024x24 = "VESA Display (1280x1024x24)",,VBE,1280,1024,24 +vbe_1280x1024x32 = "VESA Display (1280x1024x32)",,VBE,1280,1024,32 +vbe_1600x1200x8 = "VESA Display (1600x1200x8)",,VBE,1600,1200,8 +vbe_1600x1200x16 = "VESA Display (1600x1200x16)",,VBE,1600,1200,16 +vbe_1600x1200x24 = "VESA Display (1600x1200x24)",,VBE,1600,1200,24 +vbe_1600x1200x32 = "VESA Display (1600x1200x32)",,VBE,1600,1200,32 [Map.Display] ;<id> = <pnp id string>
15 years, 2 months
1
0
0
0
[dgorbachev] 43217: Fix some bugs.
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Mon Sep 28 22:46:30 2009 New Revision: 43217 URL:
http://svn.reactos.org/svn/reactos?rev=43217&view=rev
Log: Fix some bugs. Modified: trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c trunk/reactos/ntoskrnl/kdbg/kdb_keyboard.c Modified: trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/wrappers/gdbst…
============================================================================== --- trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c [iso-8859-1] Mon Sep 28 22:46:30 2009 @@ -1327,6 +1327,7 @@ strcpy(GspOutBuffer, "E03"); DPRINT1("Fault during memory read\n"); } + ptr = NULL; } if (NULL != ptr) Modified: trunk/reactos/ntoskrnl/kdbg/kdb_keyboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb_keyboard…
============================================================================== --- trunk/reactos/ntoskrnl/kdbg/kdb_keyboard.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kdbg/kdb_keyboard.c [iso-8859-1] Mon Sep 28 22:46:30 2009 @@ -112,9 +112,7 @@ while (KeepRetrying || Retry-- > 0) { - unsigned char status = kbd_read_status(); - - while (status & KBD_STAT_OBF) + while (kbd_read_status() & KBD_STAT_OBF) { byte_t scancode;
15 years, 2 months
1
0
0
0
← Newer
1
2
3
4
5
6
...
27
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
Results per page:
10
25
50
100
200