From 9afe9c3b5ca7735e44f6349201360ac738ada377 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Mon, 10 Jul 2006 21:03:26 +0000 Subject: [PATCH] [FORMATTING] / [AUDIT] - Cleanup a big coding-style mess - Add UNIMPLEMENTED macro in empty functions (otherwise we will never know if they are being called by a 3rd-party driver) - Add proper debug headers inclusion in every file - Add documentation headers into almost every file (except mcb.c and context.c - will be added later) - Standardize per-file headers (some files still lack contributors names, they will be added later too) No code change except for adding UNIMPLEMENTED macros in the code. Name.c unlocked because the implementations of functions are trivial and in fact could be derived from their names. Not documented functions will be further reviewed. svn path=/trunk/; revision=23005 --- reactos/ntoskrnl/fs/context.c | 6 +- reactos/ntoskrnl/fs/mcb.c | 427 ++++---- reactos/ntoskrnl/fs/name.c | 495 ++++----- reactos/ntoskrnl/fs/notify.c | 1814 +++++++++++++++++++-------------- reactos/ntoskrnl/fs/oplock.c | 194 ++-- reactos/ntoskrnl/fs/pool.c | 248 ++--- reactos/ntoskrnl/fs/tunnel.c | 233 +++-- reactos/ntoskrnl/fs/unc.c | 68 +- reactos/ntoskrnl/fs/util.c | 29 +- 9 files changed, 1951 insertions(+), 1563 deletions(-) diff --git a/reactos/ntoskrnl/fs/context.c b/reactos/ntoskrnl/fs/context.c index dd52d237a2d..dc2d5b1d6de 100644 --- a/reactos/ntoskrnl/fs/context.c +++ b/reactos/ntoskrnl/fs/context.c @@ -1,6 +1,6 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/fs/context.c * PURPOSE: File and Stream Context Functions * @@ -10,6 +10,8 @@ /* INCLUDES *****************************************************************/ #include + +#define NDEBUG #include /* GLOBALS *******************************************************************/ diff --git a/reactos/ntoskrnl/fs/mcb.c b/reactos/ntoskrnl/fs/mcb.c index d5a9bd9accb..c5506e4e5ca 100644 --- a/reactos/ntoskrnl/fs/mcb.c +++ b/reactos/ntoskrnl/fs/mcb.c @@ -1,16 +1,22 @@ /* $Id$ * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/fs/mcb.c * PURPOSE: No purpose listed. * * PROGRAMMERS: No programmer listed. */ +/* INCLUDES ****************************************************************/ + #include + +#define NDEBUG #include +/* FUNCTIONS *****************************************************************/ + /********************************************************************** * NAME EXPORTED * @@ -24,14 +30,15 @@ * * @unimplemented */ -BOOLEAN STDCALL +BOOLEAN +NTAPI FsRtlAddLargeMcbEntry(IN PLARGE_MCB Mcb, - IN LONGLONG Vbn, - IN LONGLONG Lbn, - IN LONGLONG SectorCount) + IN LONGLONG Vbn, + IN LONGLONG Lbn, + IN LONGLONG SectorCount) { - UNIMPLEMENTED; - return(FALSE); + UNIMPLEMENTED; + return FALSE; } /* @@ -39,232 +46,234 @@ FsRtlAddLargeMcbEntry(IN PLARGE_MCB Mcb, * * @implemented */ -BOOLEAN STDCALL -FsRtlAddMcbEntry (IN PMCB Mcb, - IN VBN Vbn, - IN LBN Lbn, - IN ULONG SectorCount) +BOOLEAN +NTAPI +FsRtlAddMcbEntry(IN PMCB Mcb, + IN VBN Vbn, + IN LBN Lbn, + IN ULONG SectorCount) { - return FsRtlAddLargeMcbEntry(& Mcb->DummyFieldThatSizesThisStructureCorrectly, - (LONGLONG) Vbn, - (LONGLONG) Lbn, - (LONGLONG) SectorCount); -} - -/* - * @unimplemented - */ -BOOLEAN STDCALL -FsRtlGetNextLargeMcbEntry(IN PLARGE_MCB Mcb, - IN ULONG RunIndex, - OUT PLONGLONG Vbn, - OUT PLONGLONG Lbn, - OUT PLONGLONG SectorCount) -{ - UNIMPLEMENTED; - return(FALSE); -} - - -/* - * @implemented - */ -BOOLEAN STDCALL -FsRtlGetNextMcbEntry (IN PMCB Mcb, - IN ULONG RunIndex, - OUT PVBN Vbn, - OUT PLBN Lbn, - OUT PULONG SectorCount) -{ - BOOLEAN Return = FALSE; - LONGLONG llVbn; - LONGLONG llLbn; - LONGLONG llSectorCount; - - /* Call the Large version */ - Return = FsRtlGetNextLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly, - RunIndex, - &llVbn, - &llLbn, - &llSectorCount); - - /* Return everything typecasted */ - *Vbn = (ULONG)llVbn; - *Lbn = (ULONG)llLbn; - *SectorCount = (ULONG)llSectorCount; - - /* And return the original value */ - return(Return); -} - - -/* - * @unimplemented - */ -VOID STDCALL -FsRtlInitializeLargeMcb(IN PLARGE_MCB Mcb, - IN POOL_TYPE PoolType) -{ - UNIMPLEMENTED; - Mcb->PoolType = PoolType; -} - -/* - * FsRtlInitializeMcb: Obsolete - * @implemented - */ -VOID STDCALL -FsRtlInitializeMcb (IN PMCB Mcb, - IN POOL_TYPE PoolType) -{ - FsRtlInitializeLargeMcb(& Mcb->DummyFieldThatSizesThisStructureCorrectly, PoolType); -} - - -/* - * @unimplemented - */ -BOOLEAN STDCALL -FsRtlLookupLargeMcbEntry(IN PLARGE_MCB Mcb, - IN LONGLONG Vbn, - OUT PLONGLONG Lbn OPTIONAL, - OUT PLONGLONG SectorCountFromLbn OPTIONAL, - OUT PLONGLONG StartingLbn OPTIONAL, - OUT PLONGLONG SectorCountFromStartingLbn OPTIONAL, - OUT PULONG Index OPTIONAL) -{ - UNIMPLEMENTED; - return(FALSE); + return FsRtlAddLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly, + (LONGLONG)Vbn, + (LONGLONG)Lbn, + (LONGLONG)SectorCount); } /* * @unimplemented */ BOOLEAN -STDCALL -FsRtlLookupLastLargeMcbEntryAndIndex ( - IN PLARGE_MCB OpaqueMcb, - OUT PLONGLONG LargeVbn, - OUT PLONGLONG LargeLbn, - OUT PULONG Index - ) +NTAPI +FsRtlGetNextLargeMcbEntry(IN PLARGE_MCB Mcb, + IN ULONG RunIndex, + OUT PLONGLONG Vbn, + OUT PLONGLONG Lbn, + OUT PLONGLONG SectorCount) { - UNIMPLEMENTED; - return(FALSE); + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @implemented + */ +BOOLEAN +NTAPI +FsRtlGetNextMcbEntry(IN PMCB Mcb, + IN ULONG RunIndex, + OUT PVBN Vbn, + OUT PLBN Lbn, + OUT PULONG SectorCount) +{ + BOOLEAN Return = FALSE; + LONGLONG llVbn; + LONGLONG llLbn; + LONGLONG llSectorCount; + + /* Call the Large version */ + Return = FsRtlGetNextLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly, + RunIndex, + &llVbn, + &llLbn, + &llSectorCount); + + /* Return everything typecasted */ + *Vbn = (ULONG)llVbn; + *Lbn = (ULONG)llLbn; + *SectorCount = (ULONG)llSectorCount; + + /* And return the original value */ + return(Return); +} + + +/* + * @unimplemented + */ +VOID +NTAPI +FsRtlInitializeLargeMcb(IN PLARGE_MCB Mcb, + IN POOL_TYPE PoolType) +{ + UNIMPLEMENTED; + Mcb->PoolType = PoolType; +} + +/* + * FsRtlInitializeMcb: Obsolete + * @implemented + */ +VOID +NTAPI +FsRtlInitializeMcb (IN PMCB Mcb, + IN POOL_TYPE PoolType) +{ + FsRtlInitializeLargeMcb(& Mcb->DummyFieldThatSizesThisStructureCorrectly, PoolType); +} + +/* + * @unimplemented + */ +BOOLEAN +NTAPI +FsRtlLookupLargeMcbEntry(IN PLARGE_MCB Mcb, + IN LONGLONG Vbn, + OUT PLONGLONG Lbn OPTIONAL, + OUT PLONGLONG SectorCountFromLbn OPTIONAL, + OUT PLONGLONG StartingLbn OPTIONAL, + OUT PLONGLONG SectorCountFromStartingLbn OPTIONAL, + OUT PULONG Index OPTIONAL) +{ + UNIMPLEMENTED; + return FALSE; +} + +/* + * @unimplemented + */ +BOOLEAN +NTAPI +FsRtlLookupLastLargeMcbEntryAndIndex(IN PLARGE_MCB OpaqueMcb, + OUT PLONGLONG LargeVbn, + OUT PLONGLONG LargeLbn, + OUT PULONG Index) +{ + UNIMPLEMENTED; + return FALSE; } /* * @unimplemented */ PFSRTL_PER_STREAM_CONTEXT -STDCALL -FsRtlLookupPerStreamContextInternal ( - IN PFSRTL_ADVANCED_FCB_HEADER StreamContext, - IN PVOID OwnerId OPTIONAL, - IN PVOID InstanceId OPTIONAL - ) +NTAPI +FsRtlLookupPerStreamContextInternal(IN PFSRTL_ADVANCED_FCB_HEADER StreamContext, + IN PVOID OwnerId OPTIONAL, + IN PVOID InstanceId OPTIONAL) { - UNIMPLEMENTED; - return(FALSE); + UNIMPLEMENTED; + return FALSE; } /* * @unimplemented */ PVOID /* PFSRTL_PER_FILE_OBJECT_CONTEXT*/ -STDCALL -FsRtlLookupPerFileObjectContext ( - IN PFSRTL_ADVANCED_FCB_HEADER StreamContext, +NTAPI +FsRtlLookupPerFileObjectContext(IN PFSRTL_ADVANCED_FCB_HEADER StreamContext, IN PVOID OwnerId OPTIONAL, - IN PVOID InstanceId OPTIONAL - ) + IN PVOID InstanceId OPTIONAL) { - UNIMPLEMENTED; - return(FALSE); + UNIMPLEMENTED; + return FALSE; } /* * @unimplemented */ -BOOLEAN STDCALL +BOOLEAN +NTAPI FsRtlLookupLastLargeMcbEntry(IN PLARGE_MCB Mcb, - OUT PLONGLONG Vbn, - OUT PLONGLONG Lbn) + OUT PLONGLONG Vbn, + OUT PLONGLONG Lbn) { - UNIMPLEMENTED; - return(FALSE); + UNIMPLEMENTED; + return(FALSE); } - /* * @implemented */ -BOOLEAN STDCALL +BOOLEAN +NTAPI FsRtlLookupLastMcbEntry(IN PMCB Mcb, OUT PVBN Vbn, OUT PLBN Lbn) { - BOOLEAN Return = FALSE; - LONGLONG llVbn; - LONGLONG llLbn; + BOOLEAN Return = FALSE; + LONGLONG llVbn; + LONGLONG llLbn; - /* Call the Large version */ - Return = FsRtlLookupLastLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly, - &llVbn, - &llLbn); + /* Call the Large version */ + Return = FsRtlLookupLastLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly, + &llVbn, + &llLbn); - /* Return everything typecasted */ - *Vbn = (ULONG)llVbn; - *Lbn = (ULONG)llLbn; + /* Return everything typecasted */ + *Vbn = (ULONG)llVbn; + *Lbn = (ULONG)llLbn; - /* And return the original value */ - return(Return); + /* And return the original value */ + return(Return); } - /* * @implemented */ -BOOLEAN STDCALL +BOOLEAN +NTAPI FsRtlLookupMcbEntry(IN PMCB Mcb, IN VBN Vbn, OUT PLBN Lbn, OUT PULONG SectorCount OPTIONAL, OUT PULONG Index) { - BOOLEAN Return = FALSE; - LONGLONG llLbn; - LONGLONG llSectorCount; + BOOLEAN Return = FALSE; + LONGLONG llLbn; + LONGLONG llSectorCount; - /* Call the Large version */ - Return = FsRtlLookupLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly, - (LONGLONG)Vbn, - &llLbn, - &llSectorCount, - NULL, - NULL, - Index); + /* Call the Large version */ + Return = FsRtlLookupLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly, + (LONGLONG)Vbn, + &llLbn, + &llSectorCount, + NULL, + NULL, + Index); - /* Return everything typecasted */ - *Lbn = (ULONG)llLbn; - if (SectorCount) *SectorCount = (ULONG)llSectorCount; + /* Return everything typecasted */ + *Lbn = (ULONG)llLbn; + if (SectorCount) *SectorCount = (ULONG)llSectorCount; - /* And return the original value */ - return(Return); + /* And return the original value */ + return(Return); } - /* * @implemented */ -ULONG STDCALL +ULONG +NTAPI FsRtlNumberOfRunsInLargeMcb(IN PLARGE_MCB Mcb) { - ULONG NumberOfRuns; - ExAcquireFastMutex (Mcb->FastMutex); - NumberOfRuns = Mcb->PairCount; - ExReleaseFastMutex (Mcb->FastMutex); - return(NumberOfRuns); + ULONG NumberOfRuns; + + ExAcquireFastMutex(Mcb->FastMutex); + NumberOfRuns = Mcb->PairCount; + ExReleaseFastMutex(Mcb->FastMutex); + + return NumberOfRuns; } @@ -273,32 +282,34 @@ FsRtlNumberOfRunsInLargeMcb(IN PLARGE_MCB Mcb) * * @implemented */ -ULONG STDCALL +ULONG +NTAPI FsRtlNumberOfRunsInMcb (IN PMCB Mcb) { - return FsRtlNumberOfRunsInLargeMcb(& Mcb->DummyFieldThatSizesThisStructureCorrectly); + return FsRtlNumberOfRunsInLargeMcb(&Mcb->DummyFieldThatSizesThisStructureCorrectly); } /* * @unimplemented */ -VOID STDCALL +VOID +NTAPI FsRtlRemoveLargeMcbEntry(IN PLARGE_MCB Mcb, - IN LONGLONG Vbn, - IN LONGLONG SectorCount) + IN LONGLONG Vbn, + IN LONGLONG SectorCount) { - UNIMPLEMENTED; + UNIMPLEMENTED; } - /* * @implemented */ -VOID STDCALL -FsRtlRemoveMcbEntry (IN PMCB Mcb, - IN VBN Vbn, - IN ULONG SectorCount) +VOID +NTAPI +FsRtlRemoveMcbEntry(IN PMCB Mcb, + IN VBN Vbn, + IN ULONG SectorCount) { /* Call the large function */ return FsRtlRemoveLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly, @@ -311,59 +322,58 @@ FsRtlRemoveMcbEntry (IN PMCB Mcb, * @unimplemented */ VOID -STDCALL -FsRtlResetLargeMcb ( - IN PLARGE_MCB Mcb, - IN BOOLEAN SelfSynchronized - ) +NTAPI +FsRtlResetLargeMcb(IN PLARGE_MCB Mcb, + IN BOOLEAN SelfSynchronized) { - UNIMPLEMENTED; + UNIMPLEMENTED; } /* * @unimplemented */ -BOOLEAN STDCALL +BOOLEAN +NTAPI FsRtlSplitLargeMcb(IN PLARGE_MCB Mcb, - IN LONGLONG Vbn, - IN LONGLONG Amount) + IN LONGLONG Vbn, + IN LONGLONG Amount) { - UNIMPLEMENTED; - return(FALSE); + UNIMPLEMENTED; + return FALSE; } - /* * @unimplemented */ -VOID STDCALL +VOID +NTAPI FsRtlTruncateLargeMcb(IN PLARGE_MCB Mcb, - IN LONGLONG Vbn) + IN LONGLONG Vbn) { - UNIMPLEMENTED; + UNIMPLEMENTED; } - /* * FsRtlTruncateMcb: Obsolete * * @implemented */ -VOID STDCALL +VOID +NTAPI FsRtlTruncateMcb (IN PMCB Mcb, - IN VBN Vbn) + IN VBN Vbn) { - FsRtlTruncateLargeMcb (& Mcb->DummyFieldThatSizesThisStructureCorrectly, (LONGLONG) Vbn); + FsRtlTruncateLargeMcb(&Mcb->DummyFieldThatSizesThisStructureCorrectly, (LONGLONG)Vbn); } - /* * @unimplemented */ -VOID STDCALL +VOID +NTAPI FsRtlUninitializeLargeMcb(IN PLARGE_MCB Mcb) { - UNIMPLEMENTED; + UNIMPLEMENTED; } /* @@ -371,12 +381,11 @@ FsRtlUninitializeLargeMcb(IN PLARGE_MCB Mcb) * * @implemented */ -VOID STDCALL -FsRtlUninitializeMcb (IN PMCB Mcb) +VOID +NTAPI +FsRtlUninitializeMcb(IN PMCB Mcb) { - FsRtlUninitializeLargeMcb(& Mcb->DummyFieldThatSizesThisStructureCorrectly); + FsRtlUninitializeLargeMcb(& Mcb->DummyFieldThatSizesThisStructureCorrectly); } - /* EOF */ - diff --git a/reactos/ntoskrnl/fs/name.c b/reactos/ntoskrnl/fs/name.c index 31f54d13675..39bb5d1946b 100644 --- a/reactos/ntoskrnl/fs/name.c +++ b/reactos/ntoskrnl/fs/name.c @@ -1,6 +1,6 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/fs/name.c * PURPOSE: Name and DBCS Name Validation and Dissection Functions. * @@ -9,9 +9,10 @@ * Filip Navara */ - /* INCLUDES ****************************************************************/ +/* INCLUDES ****************************************************************/ #include + #define NDEBUG #include @@ -153,23 +154,31 @@ PUCHAR FsRtlLegalAnsiCharacterArray = LegalAnsiCharacterArray; /* FUNCTIONS *****************************************************************/ -/* - * NAME EXPORTED - * FsRtlAreNamesEqual@16 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * NOTE - * From Bo Branten's ntifs.h v25. - * +/*++ + * @name FsRtlAreNamesEqual * @implemented - */ + * + * FILLME + * + * @param Name1 + * FILLME + * + * @param Name2 + * FILLME + * + * @param IgnoreCase + * FILLME + * + * @param UpcaseTable + * FILLME + * + * @return None + * + * @remarks From Bo Branten's ntifs.h v25. + * + *--*/ BOOLEAN -STDCALL +NTAPI FsRtlAreNamesEqual(IN PUNICODE_STRING Name1, IN PUNICODE_STRING Name2, IN BOOLEAN IgnoreCase, @@ -233,36 +242,33 @@ ManualCase: } } -/* - * NAME EXPORTED - * FsRtlDissectDbcs@16 +/*++ + * @name FsRtlDissectDbcs + * @implemented * * Dissects a given path name into first and remaining part. * - * ARGUMENTS - * Name - * ANSI string to dissect. + * @param Name + * ANSI string to dissect. * - * FirstPart - * Pointer to user supplied ANSI_STRING, that will - * later point to the first part of the original name. + * @param FirstPart + * Pointer to user supplied ANSI_STRING, that will later point + * to the first part of the original name. * - * RemainingPart - * Pointer to user supplied ANSI_STRING, that will - * later point to the remaining part of the original name. + * @param RemainingPart + * Pointer to user supplied ANSI_STRING, that will later point + * to the remaining part of the original name. * - * RETURN VALUE - * None + * @return None * - * EXAMPLE - * Name: \test1\test2\test3 - * FirstPart: test1 - * RemainingPart: test2\test3 + * @remarks Example: + * Name: \test1\test2\test3 + * FirstPart: test1 + * RemainingPart: test2\test3 * - * @implemented - */ + *--*/ VOID -STDCALL +NTAPI FsRtlDissectDbcs(IN ANSI_STRING Name, OUT PANSI_STRING FirstPart, OUT PANSI_STRING RemainingPart) @@ -305,96 +311,94 @@ FsRtlDissectDbcs(IN ANSI_STRING Name, return; } -/* - * NAME EXPORTED - * FsRtlDissectName@16 - * - * DESCRIPTION - * Dissects a given path name into first and remaining part. - * - * ARGUMENTS - * Name - * Unicode string to dissect. - * - * FirstPart - * Pointer to user supplied UNICODE_STRING, that will - * later point to the first part of the original name. - * - * RemainingPart - * Pointer to user supplied UNICODE_STRING, that will - * later point to the remaining part of the original name. - * - * RETURN VALUE - * None - * - * EXAMPLE - * Name: \test1\test2\test3 - * FirstPart: test1 - * RemainingPart: test2\test3 - * +/*++ + * @name FsRtlDissectName * @implemented - */ + * + * Dissects a given path name into first and remaining part. + * + * @param Name + * Unicode string to dissect. + * + * @param FirstPart + * Pointer to user supplied UNICODE_STRING, that will later point + * to the first part of the original name. + * + * @param RemainingPart + * Pointer to user supplied UNICODE_STRING, that will later point + * to the remaining part of the original name. + * + * @return None + * + * @remarks Example: + * Name: \test1\test2\test3 + * FirstPart: test1 + * RemainingPart: test2\test3 + * + *--*/ VOID -STDCALL +NTAPI FsRtlDissectName(IN UNICODE_STRING Name, OUT PUNICODE_STRING FirstPart, OUT PUNICODE_STRING RemainingPart) { - USHORT NameOffset = 0; - USHORT NameLength = 0; - USHORT Length; + USHORT NameOffset = 0; + USHORT NameLength = 0; + USHORT Length; - FirstPart->Length = 0; - FirstPart->MaximumLength = 0; - FirstPart->Buffer = NULL; + FirstPart->Length = 0; + FirstPart->MaximumLength = 0; + FirstPart->Buffer = NULL; - RemainingPart->Length = 0; - RemainingPart->MaximumLength = 0; - RemainingPart->Buffer = NULL; + RemainingPart->Length = 0; + RemainingPart->MaximumLength = 0; + RemainingPart->Buffer = NULL; - if (Name.Length == 0) - return; + if (Name.Length == 0) + return; - /* Skip leading backslash */ - if (Name.Buffer[0] == L'\\') - NameOffset++; + /* Skip leading backslash */ + if (Name.Buffer[0] == L'\\') + NameOffset++; - Length = Name.Length / sizeof(WCHAR); + Length = Name.Length / sizeof(WCHAR); - /* Search for next backslash or end-of-string */ - while ((NameOffset + NameLength < Length) && - (Name.Buffer[NameOffset + NameLength] != L'\\')) - { - NameLength++; - } + /* Search for next backslash or end-of-string */ + while ((NameOffset + NameLength < Length) && + (Name.Buffer[NameOffset + NameLength] != L'\\')) + { + NameLength++; + } - FirstPart->Length = - FirstPart->MaximumLength = NameLength * sizeof(WCHAR); - FirstPart->Buffer = &Name.Buffer[NameOffset]; + FirstPart->Length = + FirstPart->MaximumLength = NameLength * sizeof(WCHAR); + FirstPart->Buffer = &Name.Buffer[NameOffset]; - NameOffset += NameLength + 1; - if (NameOffset < Length) - { - RemainingPart->Length = (Length - NameOffset) * sizeof(WCHAR); - RemainingPart->MaximumLength = (Length - NameOffset) * sizeof(WCHAR); - RemainingPart->Buffer = &Name.Buffer[NameOffset]; - } + NameOffset += NameLength + 1; + if (NameOffset < Length) + { + RemainingPart->Length = (Length - NameOffset) * sizeof(WCHAR); + RemainingPart->MaximumLength = (Length - NameOffset) * sizeof(WCHAR); + RemainingPart->Buffer = &Name.Buffer[NameOffset]; + } } -/* - * NAME EXPORTED - * FsRtlDoesDbcsContainWildCards@4 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlDoesDbcsContainWildCards * @implemented - */ + * + * FILLME + * + * @param Name + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ BOOLEAN -STDCALL +NTAPI FsRtlDoesDbcsContainWildCards(IN PANSI_STRING Name) { ULONG i; @@ -415,23 +419,22 @@ FsRtlDoesDbcsContainWildCards(IN PANSI_STRING Name) return FALSE; } -/* - * NAME EXPORTED - * FsRtlDoesNameContainWildCards@4 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * NOTE - * From Bo Branten's ntifs.h v12. - * +/*++ + * @name FsRtlDoesNameContainWildCards * @implemented - */ + * + * FILLME + * + * @param Name + * Pointer to a UNICODE_STRING containing Name to examine + * + * @return TRUE if Name contains wildcards, FALSE otherwise + * + * @remarks From Bo Branten's ntifs.h v12. + * + *--*/ BOOLEAN -STDCALL +NTAPI FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name) { PWCHAR Ptr; @@ -452,60 +455,89 @@ FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name) return FALSE; } -/* - * NAME EXPORTED - * FsRtlIsDbcsInExpression@8 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlIsDbcsInExpression * @unimplemented - */ + * + * FILLME + * + * @param Expression + * FILLME + * + * @param Name + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ BOOLEAN -STDCALL +NTAPI FsRtlIsDbcsInExpression(IN PANSI_STRING Expression, IN PANSI_STRING Name) { - return FALSE; + UNIMPLEMENTED; + return FALSE; } -/* - * NAME EXPORTED - * FsRtlIsFatDbcsLegal@20 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlIsFatDbcsLegal * @unimplemented - */ + * + * FILLME + * + * @param DbcsName + * FILLME + * + * @param WildCardsPermissible + * FILLME + * + * @param PathNamePermissible + * FILLME + * + * @param LeadingBackslashPermissible + * FILLME + * + * @return TRUE if the DbcsName is legal, FALSE otherwise + * + * @remarks None + * + *--*/ BOOLEAN -STDCALL +NTAPI FsRtlIsFatDbcsLegal(IN ANSI_STRING DbcsName, IN BOOLEAN WildCardsPermissible, IN BOOLEAN PathNamePermissible, IN BOOLEAN LeadingBackslashPermissible) { - return FALSE; + UNIMPLEMENTED; + return FALSE; } -/* - * NAME EXPORTED - * FsRtlIsHpfsDbcsLegal@20 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlIsHpfsDbcsLegal * @unimplemented - */ + * + * FILLME + * + * @param DbcsName + * FILLME + * + * @param WildCardsPermissible + * FILLME + * + * @param PathNamePermissible + * FILLME + * + * @param LeadingBackslashPermissible + * FILLME + * + * @return TRUE if the DbcsName is legal, FALSE otherwise + * + * @remarks None + * + *--*/ BOOLEAN STDCALL FsRtlIsHpfsDbcsLegal(IN ANSI_STRING DbcsName, @@ -513,108 +545,111 @@ FsRtlIsHpfsDbcsLegal(IN ANSI_STRING DbcsName, IN BOOLEAN PathNamePermissible, IN BOOLEAN LeadingBackslashPermissible) { - return FALSE; + UNIMPLEMENTED; + return FALSE; } -/* - * NAME EXPORTED - * FsRtlIsNameInExpression@16 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * NOTE - * From Bo Branten's ntifs.h v12. This function should be rewritten - * to avoid recursion and better wildcard handling should be - * implemented (see FsRtlDoesNameContainWildCards). - * +/*++ + * @name FsRtlIsNameInExpression * @implemented - */ + * + * FILLME + * + * @param DeviceObject + * FILLME + * + * @param Irp + * FILLME + * + * @return TRUE if Name is in Expression, FALSE otherwise + * + * @remarks From Bo Branten's ntifs.h v12. This function should be + * rewritten to avoid recursion and better wildcard handling + * should be implemented (see FsRtlDoesNameContainWildCards). + * + *--*/ BOOLEAN -STDCALL +NTAPI FsRtlIsNameInExpression(IN PUNICODE_STRING Expression, IN PUNICODE_STRING Name, IN BOOLEAN IgnoreCase, IN PWCHAR UpcaseTable OPTIONAL) { - USHORT ExpressionPosition, NamePosition; - UNICODE_STRING TempExpression, TempName; + USHORT ExpressionPosition, NamePosition; + UNICODE_STRING TempExpression, TempName; - ExpressionPosition = 0; - NamePosition = 0; - while (ExpressionPosition < (Expression->Length / sizeof(WCHAR)) && - NamePosition < (Name->Length / sizeof(WCHAR))) + ExpressionPosition = 0; + NamePosition = 0; + while (ExpressionPosition < (Expression->Length / sizeof(WCHAR)) && + NamePosition < (Name->Length / sizeof(WCHAR))) { - if (Expression->Buffer[ExpressionPosition] == L'*') + if (Expression->Buffer[ExpressionPosition] == L'*') { - ExpressionPosition++; - if (ExpressionPosition == (Expression->Length / sizeof(WCHAR))) + ExpressionPosition++; + if (ExpressionPosition == (Expression->Length / sizeof(WCHAR))) { - return TRUE; + return TRUE; } - while (NamePosition < (Name->Length / sizeof(WCHAR))) + while (NamePosition < (Name->Length / sizeof(WCHAR))) { - TempExpression.Length = - TempExpression.MaximumLength = - Expression->Length - (ExpressionPosition * sizeof(WCHAR)); - TempExpression.Buffer = Expression->Buffer + ExpressionPosition; - TempName.Length = - TempName.MaximumLength = - Name->Length - (NamePosition * sizeof(WCHAR)); - TempName.Buffer = Name->Buffer + NamePosition; - /* FIXME: Rewrite to get rid of recursion */ - if (FsRtlIsNameInExpression(&TempExpression, &TempName, - IgnoreCase, UpcaseTable)) + TempExpression.Length = + TempExpression.MaximumLength = + Expression->Length - (ExpressionPosition * sizeof(WCHAR)); + TempExpression.Buffer = Expression->Buffer + ExpressionPosition; + TempName.Length = + TempName.MaximumLength = + Name->Length - (NamePosition * sizeof(WCHAR)); + TempName.Buffer = Name->Buffer + NamePosition; + /* FIXME: Rewrite to get rid of recursion */ + if (FsRtlIsNameInExpression(&TempExpression, &TempName, + IgnoreCase, UpcaseTable)) { - return TRUE; + return TRUE; } - NamePosition++; + NamePosition++; } } - else + else { - /* FIXME: Take UpcaseTable into account! */ - if (Expression->Buffer[ExpressionPosition] == L'?' || - (IgnoreCase && - RtlUpcaseUnicodeChar(Expression->Buffer[ExpressionPosition]) == - RtlUpcaseUnicodeChar(Name->Buffer[NamePosition])) || - (!IgnoreCase && - Expression->Buffer[ExpressionPosition] == - Name->Buffer[NamePosition])) + /* FIXME: Take UpcaseTable into account! */ + if (Expression->Buffer[ExpressionPosition] == L'?' || + (IgnoreCase && + RtlUpcaseUnicodeChar(Expression->Buffer[ExpressionPosition]) == + RtlUpcaseUnicodeChar(Name->Buffer[NamePosition])) || + (!IgnoreCase && + Expression->Buffer[ExpressionPosition] == + Name->Buffer[NamePosition])) { - NamePosition++; - ExpressionPosition++; + NamePosition++; + ExpressionPosition++; } - else + else { - return FALSE; + return FALSE; } } } - /* Handle matching of "f0_*.*" expression to "f0_000" file name. */ - if (ExpressionPosition < (Expression->Length / sizeof(WCHAR)) && - Expression->Buffer[ExpressionPosition] == L'.') + /* Handle matching of "f0_*.*" expression to "f0_000" file name. */ + if (ExpressionPosition < (Expression->Length / sizeof(WCHAR)) && + Expression->Buffer[ExpressionPosition] == L'.') { - while (ExpressionPosition < (Expression->Length / sizeof(WCHAR)) && - (Expression->Buffer[ExpressionPosition] == L'.' || - Expression->Buffer[ExpressionPosition] == L'*' || - Expression->Buffer[ExpressionPosition] == L'?')) + while (ExpressionPosition < (Expression->Length / sizeof(WCHAR)) && + (Expression->Buffer[ExpressionPosition] == L'.' || + Expression->Buffer[ExpressionPosition] == L'*' || + Expression->Buffer[ExpressionPosition] == L'?')) { - ExpressionPosition++; + ExpressionPosition++; } } - if (ExpressionPosition == (Expression->Length / sizeof(WCHAR)) && - NamePosition == (Name->Length / sizeof(WCHAR))) + if (ExpressionPosition == (Expression->Length / sizeof(WCHAR)) && + NamePosition == (Name->Length / sizeof(WCHAR))) { - return TRUE; + return TRUE; } - return FALSE; + return FALSE; } /* EOF */ diff --git a/reactos/ntoskrnl/fs/notify.c b/reactos/ntoskrnl/fs/notify.c index f927cc9184e..759f0e7013c 100644 --- a/reactos/ntoskrnl/fs/notify.c +++ b/reactos/ntoskrnl/fs/notify.c @@ -1,98 +1,123 @@ /* $Id$ * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/fs/notify.c * PURPOSE: No purpose listed. * * PROGRAMMERS: Gunnar Dalsnes */ +/* INCLUDES *****************************************************************/ #include -//#define NDEBUG +#define NDEBUG #include #if defined (ALLOC_PRAGMA) #pragma alloc_text(INIT, FsRtlpInitNotifyImplementation) #endif +/* GLOBALS *******************************************************************/ PAGED_LOOKASIDE_LIST NotifyEntryLookaside; typedef struct _NOTIFY_ENTRY { - LIST_ENTRY ListEntry; - PSTRING FullDirectoryName; - BOOLEAN WatchTree; - BOOLEAN PendingChanges; - ULONG CompletionFilter; - LIST_ENTRY IrpQueue; - PVOID Fcb; - PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback; - PSECURITY_SUBJECT_CONTEXT SubjectContext; - PVOID FsContext; - BOOLEAN Unicode; - BOOLEAN BufferExhausted; - PVOID Buffer; /* Buffer == NULL equals IgnoreBuffer == TRUE */ - ULONG BufferSize; - ULONG NextEntryOffset; - PFILE_NOTIFY_INFORMATION PrevEntry; + LIST_ENTRY ListEntry; + PSTRING FullDirectoryName; + BOOLEAN WatchTree; + BOOLEAN PendingChanges; + ULONG CompletionFilter; + LIST_ENTRY IrpQueue; + PVOID Fcb; + PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback; + PSECURITY_SUBJECT_CONTEXT SubjectContext; + PVOID FsContext; + BOOLEAN Unicode; + BOOLEAN BufferExhausted; + PVOID Buffer; /* Buffer == NULL equals IgnoreBuffer == TRUE */ + ULONG BufferSize; + ULONG NextEntryOffset; + PFILE_NOTIFY_INFORMATION PrevEntry; } NOTIFY_ENTRY, *PNOTIFY_ENTRY; +/* FUNCTIONS *****************************************************************/ -/********************************************************************** - * NAME PRIVATE - * FsRtlpInitNotifyImplementation +/*++ + * @name FsRtlpInitNotifyImplementation + * @unimplemented * - */ + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ VOID -STDCALL INIT_FUNCTION +NTAPI INIT_FUNCTION FsRtlpInitNotifyImplementation(VOID) { - ExInitializePagedLookasideList( &NotifyEntryLookaside, - NULL, - NULL, - 0, - sizeof(NOTIFY_ENTRY), - FSRTL_NOTIFY_TAG, - 0 - ); - - + ExInitializePagedLookasideList(&NotifyEntryLookaside, + NULL, + NULL, + 0, + sizeof(NOTIFY_ENTRY), + FSRTL_NOTIFY_TAG, + 0); } - - +/*++ + * @name FsRtlpIsUnicodePath + * + * FILLME + * + * @param Path + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ static __inline BOOLEAN -FsRtlpIsUnicodePath( - PSTRING Path - ) +FsRtlpIsUnicodePath(PSTRING Path) { - ASSERT(Path->Length); + ASSERT(Path->Length); - if (Path->Length == 1) return FALSE; + if (Path->Length == 1) + return FALSE; - if (*(WCHAR*)Path->Buffer == '\\') return TRUE; + if (*(WCHAR*)Path->Buffer == '\\') + return TRUE; - return FALSE; + return FALSE; } - -/********************************************************************** - * NAME PRIVATE - * FsRtlpNotifyCancelRoutine +/*++ + * @name FsRtlpNotifyCancelRoutine * - */ + * FILLME + * + * @param DeviceObject + * FILLME + * + * @param Irp + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ static VOID -STDCALL -FsRtlpNotifyCancelRoutine( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ) +NTAPI +FsRtlpNotifyCancelRoutine(IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) { PFAST_MUTEX Lock; @@ -114,869 +139,1076 @@ FsRtlpNotifyCancelRoutine( } - - +/*++ + * @name FsRtlpFindNotifyEntry + * + * FILLME + * + * @param NotifyList + * FILLME + * + * @param FsContext + * FILLME + * + * @return FILLME + * + * @remarks None + * + *--*/ static PNOTIFY_ENTRY FASTCALL -FsRtlpFindNotifyEntry( - PLIST_ENTRY NotifyList, - PVOID FsContext - ) +FsRtlpFindNotifyEntry(PLIST_ENTRY NotifyList, + PVOID FsContext) { - PNOTIFY_ENTRY NotifyEntry; + PNOTIFY_ENTRY NotifyEntry; - LIST_FOR_EACH(NotifyEntry, NotifyList, NOTIFY_ENTRY, ListEntry) - { - if (NotifyEntry->FsContext == FsContext) - { - return NotifyEntry; - } - } + LIST_FOR_EACH(NotifyEntry, NotifyList, NOTIFY_ENTRY, ListEntry) + { + if (NotifyEntry->FsContext == FsContext) + { + return NotifyEntry; + } + } - return NULL; + return NULL; } -/********************************************************************** - * NAME EXPORTED - * FsRtlNotifyChangeDirectory@28 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlNotifyChangeDirectory * @implemented - */ + * + * FILLME + * + * @param NotifySync + * FILLME + * + * @param FsContext + * FILLME + * + * @param FullDirectoryName + * FILLME + * + * @param NotifyList + * FILLME + * + * @param WatchTree + * FILLME + * + * @param CompletionFilter + * FILLME + * + * @param NotifyIrp + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ VOID -STDCALL -FsRtlNotifyChangeDirectory ( - IN PNOTIFY_SYNC NotifySync, - IN PVOID FsContext, - IN PSTRING FullDirectoryName, - IN PLIST_ENTRY NotifyList, - IN BOOLEAN WatchTree, - IN ULONG CompletionFilter, - IN PIRP NotifyIrp - ) +NTAPI +FsRtlNotifyChangeDirectory(IN PNOTIFY_SYNC NotifySync, + IN PVOID FsContext, + IN PSTRING FullDirectoryName, + IN PLIST_ENTRY NotifyList, + IN BOOLEAN WatchTree, + IN ULONG CompletionFilter, + IN PIRP NotifyIrp) { - FsRtlNotifyFullChangeDirectory ( - NotifySync, - NotifyList, - FsContext, - FullDirectoryName, - WatchTree, - TRUE, /* IgnoreBuffer */ - CompletionFilter, - NotifyIrp, - NULL, - NULL - ); + FsRtlNotifyFullChangeDirectory(NotifySync, + NotifyList, + FsContext, + FullDirectoryName, + WatchTree, + TRUE, /* IgnoreBuffer */ + CompletionFilter, + NotifyIrp, + NULL, + NULL); } - - -/********************************************************************** - * NAME EXPORTED - * FsRtlNotifyCleanup@12 - * - * DESCRIPTION - * Called by FSD when all handles to FileObject (identified by FsContext) are closed - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlNotifyCleanup * @unimplemented - */ + * + * Called by FSD when all handles to FileObject (identified by FsContext) are closed + * + * @param NotifySync + * FILLME + * + * @param NotifyList + * FILLME + * + * @param FsContext + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ VOID -STDCALL -FsRtlNotifyCleanup ( - IN PNOTIFY_SYNC NotifySync, - IN PLIST_ENTRY NotifyList, - IN PVOID FsContext - ) +NTAPI +FsRtlNotifyCleanup(IN PNOTIFY_SYNC NotifySync, + IN PLIST_ENTRY NotifyList, + IN PVOID FsContext) { - PNOTIFY_ENTRY NotifyEntry; - LIST_ENTRY CompletedListHead; - PLIST_ENTRY TmpEntry; - PIRP Irp; + PNOTIFY_ENTRY NotifyEntry; + LIST_ENTRY CompletedListHead; + PLIST_ENTRY TmpEntry; + PIRP Irp; - InitializeListHead(&CompletedListHead); + InitializeListHead(&CompletedListHead); - ExAcquireFastMutex((PFAST_MUTEX)NotifySync); + ExAcquireFastMutex((PFAST_MUTEX)NotifySync); - NotifyEntry = FsRtlpFindNotifyEntry(NotifyList, FsContext); + NotifyEntry = FsRtlpFindNotifyEntry(NotifyList, FsContext); - if (NotifyEntry) - { - /* free buffered changes */ - if (NotifyEntry->Buffer) - { - ExFreePool(NotifyEntry->Buffer); - } - - /* cancel(?) pending irps */ - while (!IsListEmpty(&NotifyEntry->IrpQueue)) - { - TmpEntry = RemoveHeadList(&NotifyEntry->IrpQueue); - Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry); - - /* irp cancelation bolilerplate */ - if (!IoSetCancelRoutine(Irp, NULL)) - { - //The cancel routine will be called. When we release the lock it will complete the irp. - InitializeListHead(&Irp->Tail.Overlay.ListEntry); - continue; - } - - Irp->IoStatus.Status = STATUS_NOTIFY_CLEANUP; /* FIXME: correct status? */ - Irp->IoStatus.Information = 0; - - /* avoid holding lock while completing irp */ - InsertTailList(&CompletedListHead, &Irp->Tail.Overlay.ListEntry); - } - - /* Unlink and free the NotifyStruct */ - RemoveEntryList(&NotifyEntry->ListEntry); - ExFreeToPagedLookasideList(&NotifyEntryLookaside, NotifyEntry); - } - - ExReleaseFastMutex((PFAST_MUTEX)NotifySync); - - /* complete defered irps */ - while (!IsListEmpty(&CompletedListHead)) - { - TmpEntry = RemoveHeadList(&CompletedListHead); - Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry); - IoCompleteRequest(Irp, IO_NO_INCREMENT); - } - -} - - -/* - * @unimplemented - */ -VOID -STDCALL -FsRtlNotifyFilterChangeDirectory ( - IN PNOTIFY_SYNC NotifySync, - IN PLIST_ENTRY NotifyList, - IN PVOID FsContext, - IN PSTRING FullDirectoryName, - IN BOOLEAN WatchTree, - IN BOOLEAN IgnoreBuffer, - IN ULONG CompletionFilter, - IN PIRP NotifyIrp, - IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL, - IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL, - IN PFILTER_REPORT_CHANGE FilterCallback OPTIONAL - ) -{ - UNIMPLEMENTED; -} - -/* - * @unimplemented - */ -VOID -STDCALL -FsRtlNotifyFilterReportChange ( - IN PNOTIFY_SYNC NotifySync, - IN PLIST_ENTRY NotifyList, - IN PSTRING FullTargetName, - IN USHORT TargetNameOffset, - IN PSTRING StreamName OPTIONAL, - IN PSTRING NormalizedParentName OPTIONAL, - IN ULONG FilterMatch, - IN ULONG Action, - IN PVOID TargetContext, - IN PVOID FilterContext - ) -{ - UNIMPLEMENTED; -} - - - -static -VOID -FASTCALL -FsRtlpWatchedDirectoryWasDeleted( - IN PNOTIFY_SYNC NotifySync, - IN PLIST_ENTRY NotifyList, - IN PVOID Fcb - ) -{ - LIST_ENTRY CompletedListHead; - PLIST_ENTRY TmpEntry; - PNOTIFY_ENTRY NotifyEntry, tmp; - PIRP Irp; - - InitializeListHead(&CompletedListHead); - - ExAcquireFastMutex((PFAST_MUTEX)NotifySync); - - LIST_FOR_EACH_SAFE(NotifyEntry, tmp, NotifyList, NOTIFY_ENTRY, ListEntry ) - { - if (NotifyEntry->Fcb == Fcb) - { - RemoveEntryList(&NotifyEntry->ListEntry); - - /* free buffered changes */ - if (NotifyEntry->Buffer) - { + if (NotifyEntry) + { + /* free buffered changes */ + if (NotifyEntry->Buffer) + { ExFreePool(NotifyEntry->Buffer); - } + } - /* cleanup pending irps */ - while (!IsListEmpty(&NotifyEntry->IrpQueue)) - { + /* cancel(?) pending irps */ + while (!IsListEmpty(&NotifyEntry->IrpQueue)) + { TmpEntry = RemoveHeadList(&NotifyEntry->IrpQueue); Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry); /* irp cancelation bolilerplate */ if (!IoSetCancelRoutine(Irp, NULL)) { - //The cancel routine will be called. When we release the lock it will complete the irp. - InitializeListHead(&Irp->Tail.Overlay.ListEntry); - continue; + //The cancel routine will be called. When we release the lock it will complete the irp. + InitializeListHead(&Irp->Tail.Overlay.ListEntry); + continue; } - Irp->IoStatus.Status = STATUS_DELETE_PENDING; + Irp->IoStatus.Status = STATUS_NOTIFY_CLEANUP; /* FIXME: correct status? */ Irp->IoStatus.Information = 0; /* avoid holding lock while completing irp */ InsertTailList(&CompletedListHead, &Irp->Tail.Overlay.ListEntry); - } - } - } + } - ExReleaseFastMutex((PFAST_MUTEX)NotifySync); + /* Unlink and free the NotifyStruct */ + RemoveEntryList(&NotifyEntry->ListEntry); + ExFreeToPagedLookasideList(&NotifyEntryLookaside, NotifyEntry); + } - /* complete defered irps */ - while (!IsListEmpty(&CompletedListHead)) - { - TmpEntry = RemoveHeadList(&CompletedListHead); - Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry); - IoCompleteRequest(Irp, IO_NO_INCREMENT); - } + ExReleaseFastMutex((PFAST_MUTEX)NotifySync); + /* complete defered irps */ + while (!IsListEmpty(&CompletedListHead)) + { + TmpEntry = RemoveHeadList(&CompletedListHead); + Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry); + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } } - - - - - -/********************************************************************** - * NAME EXPORTED - * FsRtlNotifyFullChangeDirectory@40 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlNotifyFilterChangeDirectory * @unimplemented - */ + * + * FILLME + * + * @param NotifySync + * FILLME + * + * @param NotifyList + * FILLME + * + * @param FsContext + * FILLME + * + * @param FullDirectoryName + * FILLME + * + * @param WatchTree + * FILLME + * + * @param IgnoreBuffer + * FILLME + * + * @param CompletionFilter + * FILLME + * + * @param NotifyIrp + * FILLME + * + * @param TraverseCallback + * FILLME + * + * @param SubjectContext + * FILLME + * + * @param FilterCallback + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ VOID -STDCALL -FsRtlNotifyFullChangeDirectory ( - IN PNOTIFY_SYNC NotifySync, - IN PLIST_ENTRY NotifyList, - IN PVOID FsContext, - IN PSTRING FullDirectoryName, - IN BOOLEAN WatchTree, - IN BOOLEAN IgnoreBuffer, - IN ULONG CompletionFilter, - IN PIRP Irp, - IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL, - IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL - ) +NTAPI +FsRtlNotifyFilterChangeDirectory(IN PNOTIFY_SYNC NotifySync, + IN PLIST_ENTRY NotifyList, + IN PVOID FsContext, + IN PSTRING FullDirectoryName, + IN BOOLEAN WatchTree, + IN BOOLEAN IgnoreBuffer, + IN ULONG CompletionFilter, + IN PIRP NotifyIrp, + IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL, + IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL, + IN PFILTER_REPORT_CHANGE FilterCallback OPTIONAL) { - PIO_STACK_LOCATION IrpStack; - PNOTIFY_ENTRY NotifyEntry; - ULONG IrpBuffLen; - - if (!Irp) - { - /* all other params are ignored if NotifyIrp == NULL */ - FsRtlpWatchedDirectoryWasDeleted(NotifySync, NotifyList, FsContext); - return; - } - - DPRINT("FullDirectoryName: %wZ\n", FullDirectoryName); - - ExAcquireFastMutex((PFAST_MUTEX)NotifySync); - - IrpStack = IoGetCurrentIrpStackLocation(Irp); - if (IrpStack->FileObject->Flags & FO_CLEANUP_COMPLETE) - { - ExReleaseFastMutex((PFAST_MUTEX)NotifySync); - - Irp->IoStatus.Information = 0; - Irp->IoStatus.Status = STATUS_NOTIFY_CLEANUP; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return; - } - - IrpBuffLen = IrpStack->Parameters.NotifyDirectory.Length; - - NotifyEntry = FsRtlpFindNotifyEntry(NotifyList, FsContext); - - if (!NotifyEntry) - { - /* No NotifyStruct for this FileObject existed */ - - /* The first request for this FileObject set the standards. - * For subsequent requests, these params will be ignored. - * Ref: Windows NT File System Internals page 516 - */ - - NotifyEntry = ExAllocateFromPagedLookasideList(&NotifyEntryLookaside); - - RtlZeroMemory(NotifyEntry, sizeof(NOTIFY_ENTRY)); - - NotifyEntry->FsContext = FsContext; - NotifyEntry->FullDirectoryName = FullDirectoryName; - NotifyEntry->WatchTree = WatchTree; - NotifyEntry->CompletionFilter = CompletionFilter; - NotifyEntry->TraverseCallback = TraverseCallback; - NotifyEntry->SubjectContext = SubjectContext; - NotifyEntry->Fcb = IrpStack->FileObject->FsContext; - NotifyEntry->Unicode = FsRtlpIsUnicodePath(FullDirectoryName); - - /* Init. buffer */ - if (IrpBuffLen && !IgnoreBuffer) - { - _SEH_TRY - { - NotifyEntry->Buffer = ExAllocatePoolWithQuotaTag( - PagedPool, - IrpBuffLen, - FSRTL_NOTIFY_TAG - ); - - NotifyEntry->BufferSize = IrpBuffLen; - } - _SEH_HANDLE - { - /* ExAllocatePoolWithQuotaTag raised exception but we dont care. - The impl. doesnt require a buffer, so well continue as usual. - */ - } - _SEH_END; - } - - InitializeListHead(&NotifyEntry->IrpQueue); - - InsertTailList(NotifyList, &NotifyEntry->ListEntry); - } - - - - if (!NotifyEntry->PendingChanges) - { - /* No changes are pending. Queue the irp */ - - /* Irp cancelation boilerplate */ - - /* save NotifySych for use in the cancel routine */ - Irp->Tail.Overlay.DriverContext[3] = NotifySync; - - (void)IoSetCancelRoutine(Irp, FsRtlpNotifyCancelRoutine); - if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL)) - { - //irp was canceled - ExReleaseFastMutex((PFAST_MUTEX)NotifySync); - - Irp->IoStatus.Status = STATUS_CANCELLED; - Irp->IoStatus.Information = 0; - - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return; - } - - IoMarkIrpPending(Irp); - - //FIXME: any point in setting irp status/information before queueing? - Irp->IoStatus.Status = STATUS_PENDING; - - InsertTailList(&NotifyEntry->IrpQueue, &Irp->Tail.Overlay.ListEntry); - - ExReleaseFastMutex((PFAST_MUTEX)NotifySync); - return; - } - - - /* Pending changes exist */ - - if (NotifyEntry->Buffer == NULL || - NotifyEntry->BufferExhausted || - IrpBuffLen < NotifyEntry->NextEntryOffset) - { - /* - Can't return detailed changes to user cause: - -No buffer exist, OR - -Buffer were overflowed, OR - -Current irp buff was not large enough - */ - - Irp->IoStatus.Information = 0; - Irp->IoStatus.Status = STATUS_NOTIFY_ENUM_DIR; - - } - else - { - PVOID Adr = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, LowPagePriority); - - if (Adr) - { - memcpy(Adr, NotifyEntry->Buffer, NotifyEntry->NextEntryOffset); - Irp->IoStatus.Information = NotifyEntry->NextEntryOffset; - } - else - { - Irp->IoStatus.Information = 0; - } - - Irp->IoStatus.Status = STATUS_SUCCESS; - } - - /* reset buffer */ - NotifyEntry->PrevEntry = NULL; - NotifyEntry->NextEntryOffset = 0; - NotifyEntry->BufferExhausted = FALSE; - - NotifyEntry->PendingChanges = FALSE; - - ExReleaseFastMutex((PFAST_MUTEX)NotifySync); - - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - /* caller must return STATUS_PENDING */ + UNIMPLEMENTED; } +/*++ + * @name FsRtlNotifyFilterReportChange + * @unimplemented + * + * FILLME + * + * @param NotifySync + * FILLME + * + * @param NotifyList + * FILLME + * + * @param FullTargetName + * FILLME + * + * @param TargetNameOffset + * FILLME + * + * @param StreamName + * FILLME + * + * @param NormalizedParentName + * FILLME + * + * @param FilterMatch + * FILLME + * + * @param Action + * FILLME + * + * @param TargetContext + * FILLME + * + * @param FilterContext + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ +VOID +NTAPI +FsRtlNotifyFilterReportChange(IN PNOTIFY_SYNC NotifySync, + IN PLIST_ENTRY NotifyList, + IN PSTRING FullTargetName, + IN USHORT TargetNameOffset, + IN PSTRING StreamName OPTIONAL, + IN PSTRING NormalizedParentName OPTIONAL, + IN ULONG FilterMatch, + IN ULONG Action, + IN PVOID TargetContext, + IN PVOID FilterContext) +{ + UNIMPLEMENTED; +} + +/*++ + * @name FsRtlpWatchedDirectoryWasDeleted + * + * FILLME + * + * @param NotifySync + * FILLME + * + * @param NotifyList + * FILLME + * + * @param Fcb + * FILLME + * + * @return None + * + * @remarks Private function + * + *--*/ +static +VOID +FASTCALL +FsRtlpWatchedDirectoryWasDeleted(IN PNOTIFY_SYNC NotifySync, + IN PLIST_ENTRY NotifyList, + IN PVOID Fcb) +{ + LIST_ENTRY CompletedListHead; + PLIST_ENTRY TmpEntry; + PNOTIFY_ENTRY NotifyEntry, tmp; + PIRP Irp; + + InitializeListHead(&CompletedListHead); + + ExAcquireFastMutex((PFAST_MUTEX)NotifySync); + + LIST_FOR_EACH_SAFE(NotifyEntry, tmp, NotifyList, NOTIFY_ENTRY, ListEntry ) + { + if (NotifyEntry->Fcb == Fcb) + { + RemoveEntryList(&NotifyEntry->ListEntry); + + /* free buffered changes */ + if (NotifyEntry->Buffer) + { + ExFreePool(NotifyEntry->Buffer); + } + + /* cleanup pending irps */ + while (!IsListEmpty(&NotifyEntry->IrpQueue)) + { + TmpEntry = RemoveHeadList(&NotifyEntry->IrpQueue); + Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry); + + /* irp cancelation bolilerplate */ + if (!IoSetCancelRoutine(Irp, NULL)) + { + //The cancel routine will be called. When we release the lock it will complete the irp. + InitializeListHead(&Irp->Tail.Overlay.ListEntry); + continue; + } + + Irp->IoStatus.Status = STATUS_DELETE_PENDING; + Irp->IoStatus.Information = 0; + + /* avoid holding lock while completing irp */ + InsertTailList(&CompletedListHead, &Irp->Tail.Overlay.ListEntry); + } + } + } + + ExReleaseFastMutex((PFAST_MUTEX)NotifySync); + + /* complete defered irps */ + while (!IsListEmpty(&CompletedListHead)) + { + TmpEntry = RemoveHeadList(&CompletedListHead); + Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry); + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } +} + +/*++ + * @name FsRtlNotifyFullChangeDirectory + * @unimplemented + * + * FILLME + * + * @param NotifySync + * FILLME + * + * @param NotifyList + * FILLME + * + * @param FsContext + * FILLME + * + * @param FullDirectoryName + * FILLME + * + * @param WatchTree + * FILLME + * + * @param IgnoreBuffer + * FILLME + * + * @param CompletionFilter + * FILLME + * + * @param Irp + * FILLME + * + * @param TraverseCallback + * FILLME + * + * @param SubjectContext + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ +VOID +NTAPI +FsRtlNotifyFullChangeDirectory(IN PNOTIFY_SYNC NotifySync, + IN PLIST_ENTRY NotifyList, + IN PVOID FsContext, + IN PSTRING FullDirectoryName, + IN BOOLEAN WatchTree, + IN BOOLEAN IgnoreBuffer, + IN ULONG CompletionFilter, + IN PIRP Irp, + IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL, + IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL) +{ + PIO_STACK_LOCATION IrpStack; + PNOTIFY_ENTRY NotifyEntry; + ULONG IrpBuffLen; + + if (!Irp) + { + /* all other params are ignored if NotifyIrp == NULL */ + FsRtlpWatchedDirectoryWasDeleted(NotifySync, NotifyList, FsContext); + return; + } + + DPRINT("FullDirectoryName: %wZ\n", FullDirectoryName); + + ExAcquireFastMutex((PFAST_MUTEX)NotifySync); + + IrpStack = IoGetCurrentIrpStackLocation(Irp); + if (IrpStack->FileObject->Flags & FO_CLEANUP_COMPLETE) + { + ExReleaseFastMutex((PFAST_MUTEX)NotifySync); + + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_NOTIFY_CLEANUP; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return; + } + + IrpBuffLen = IrpStack->Parameters.NotifyDirectory.Length; + + NotifyEntry = FsRtlpFindNotifyEntry(NotifyList, FsContext); + + if (!NotifyEntry) + { + /* No NotifyStruct for this FileObject existed */ + + /* The first request for this FileObject set the standards. + * For subsequent requests, these params will be ignored. + * Ref: Windows NT File System Internals page 516 + */ + + NotifyEntry = ExAllocateFromPagedLookasideList(&NotifyEntryLookaside); + + RtlZeroMemory(NotifyEntry, sizeof(NOTIFY_ENTRY)); + + NotifyEntry->FsContext = FsContext; + NotifyEntry->FullDirectoryName = FullDirectoryName; + NotifyEntry->WatchTree = WatchTree; + NotifyEntry->CompletionFilter = CompletionFilter; + NotifyEntry->TraverseCallback = TraverseCallback; + NotifyEntry->SubjectContext = SubjectContext; + NotifyEntry->Fcb = IrpStack->FileObject->FsContext; + NotifyEntry->Unicode = FsRtlpIsUnicodePath(FullDirectoryName); + + /* Init. buffer */ + if (IrpBuffLen && !IgnoreBuffer) + { + _SEH_TRY + { + NotifyEntry->Buffer = ExAllocatePoolWithQuotaTag( + PagedPool, + IrpBuffLen, + FSRTL_NOTIFY_TAG + ); + + NotifyEntry->BufferSize = IrpBuffLen; + } + _SEH_HANDLE + { + /* ExAllocatePoolWithQuotaTag raised exception but we dont care. + The impl. doesnt require a buffer, so well continue as usual. + */ + } + _SEH_END; + } + + InitializeListHead(&NotifyEntry->IrpQueue); + + InsertTailList(NotifyList, &NotifyEntry->ListEntry); + } + if (!NotifyEntry->PendingChanges) + { + /* No changes are pending. Queue the irp */ + + /* Irp cancelation boilerplate */ + + /* save NotifySych for use in the cancel routine */ + Irp->Tail.Overlay.DriverContext[3] = NotifySync; + + (void)IoSetCancelRoutine(Irp, FsRtlpNotifyCancelRoutine); + if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL)) + { + //irp was canceled + ExReleaseFastMutex((PFAST_MUTEX)NotifySync); + + Irp->IoStatus.Status = STATUS_CANCELLED; + Irp->IoStatus.Information = 0; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return; + } + + IoMarkIrpPending(Irp); + + //FIXME: any point in setting irp status/information before queueing? + Irp->IoStatus.Status = STATUS_PENDING; + + InsertTailList(&NotifyEntry->IrpQueue, &Irp->Tail.Overlay.ListEntry); + + ExReleaseFastMutex((PFAST_MUTEX)NotifySync); + return; + } + + + /* Pending changes exist */ + + if (NotifyEntry->Buffer == NULL || + NotifyEntry->BufferExhausted || + IrpBuffLen < NotifyEntry->NextEntryOffset) + { + /* + Can't return detailed changes to user cause: + -No buffer exist, OR + -Buffer were overflowed, OR + -Current irp buff was not large enough + */ + + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_NOTIFY_ENUM_DIR; + + } + else + { + PVOID Adr = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, LowPagePriority); + + if (Adr) + { + memcpy(Adr, NotifyEntry->Buffer, NotifyEntry->NextEntryOffset); + Irp->IoStatus.Information = NotifyEntry->NextEntryOffset; + } + else + { + Irp->IoStatus.Information = 0; + } + + Irp->IoStatus.Status = STATUS_SUCCESS; + } + + /* reset buffer */ + NotifyEntry->PrevEntry = NULL; + NotifyEntry->NextEntryOffset = 0; + NotifyEntry->BufferExhausted = FALSE; + + NotifyEntry->PendingChanges = FALSE; + + ExReleaseFastMutex((PFAST_MUTEX)NotifySync); + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + /* caller must return STATUS_PENDING */ +} + +/*++ + * @name FsRtlpGetNextIrp + * + * FILLME + * + * @param NotifyEntry + * FILLME + * + * @return FILLME + * + * @remarks Private function + * + *--*/ static PIRP FASTCALL FsRtlpGetNextIrp(PNOTIFY_ENTRY NotifyEntry) { - PIRP Irp; - PLIST_ENTRY TmpEntry; + PIRP Irp; + PLIST_ENTRY TmpEntry; - /* Loop to get a non-canceled irp */ - while (!IsListEmpty(&NotifyEntry->IrpQueue)) - { - /* If we have queued irp(s) we can't possibly have pending changes too */ - ASSERT(!NotifyEntry->PendingChanges); + /* Loop to get a non-canceled irp */ + while (!IsListEmpty(&NotifyEntry->IrpQueue)) + { + /* If we have queued irp(s) we can't possibly have pending changes too */ + ASSERT(!NotifyEntry->PendingChanges); - TmpEntry = RemoveHeadList(&NotifyEntry->IrpQueue); - Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry); + TmpEntry = RemoveHeadList(&NotifyEntry->IrpQueue); + Irp = CONTAINING_RECORD(TmpEntry , IRP, Tail.Overlay.ListEntry); - /* irp cancelation bolilerplate */ - if (!IoSetCancelRoutine(Irp, NULL)) - { - //The cancel routine will be called. When we release the lock it will complete the irp. - InitializeListHead(&Irp->Tail.Overlay.ListEntry); - continue; - } + /* irp cancelation bolilerplate */ + if (!IoSetCancelRoutine(Irp, NULL)) + { + //The cancel routine will be called. When we release the lock it will complete the irp. + InitializeListHead(&Irp->Tail.Overlay.ListEntry); + continue; + } - /* Finally we got a non-canceled irp */ - return Irp; - } + /* Finally we got a non-canceled irp */ + return Irp; + } - return NULL; + return NULL; } - +/*++ + * @name FsRtlpCopyName + * + * FILLME + * + * @param CurrentEntry + * FILLME + * + * @param Unicode + * FILLME + * + * @param RelativeName + * FILLME + * + * @param StreamName + * FILLME + * + * @return None + * + * @remarks Private function + * + *--*/ static __inline VOID -FsRtlpCopyName( - PFILE_NOTIFY_INFORMATION CurrentEntry, - BOOLEAN Unicode, - PSTRING RelativeName, - PSTRING StreamName - ) +FsRtlpCopyName(PFILE_NOTIFY_INFORMATION CurrentEntry, + BOOLEAN Unicode, + PSTRING RelativeName, + PSTRING StreamName) { - /* Buffer size is allready probed, so just copy the data */ + /* Buffer size is allready probed, so just copy the data */ - if (Unicode) - { - memcpy(CurrentEntry->FileName, RelativeName->Buffer, RelativeName->Length); - if (StreamName) - { - CurrentEntry->FileName[RelativeName->Length/sizeof(WCHAR)] = ':'; - memcpy(&CurrentEntry->FileName[(RelativeName->Length/sizeof(WCHAR))+1], - StreamName->Buffer, - StreamName->Length); - } - } - else - { - //FIXME: convert to unicode etc. - DPRINT1("FIXME: ansi strings in notify impl. not supported yet\n"); - } + if (Unicode) + { + memcpy(CurrentEntry->FileName, RelativeName->Buffer, RelativeName->Length); + if (StreamName) + { + CurrentEntry->FileName[RelativeName->Length/sizeof(WCHAR)] = ':'; + memcpy(&CurrentEntry->FileName[(RelativeName->Length/sizeof(WCHAR))+1], + StreamName->Buffer, + StreamName->Length); + } + } + else + { + //FIXME: convert to unicode etc. + DPRINT1("FIXME: ansi strings in notify impl. not supported yet\n"); + } } - -/********************************************************************** - * NAME EXPORTED - * FsRtlNotifyFullReportChange@36 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlNotifyFullReportChange * @unimplemented - */ + * + * FILLME + * + * @param NotifySync + * FILLME + * + * @param NotifyList + * FILLME + * + * @param FullTargetName + * FILLME + * + * @param TargetNameOffset + * FILLME + * + * @param StreamName + * FILLME + * + * @param NormalizedParentName + * FILLME + * + * @param FilterMatch + * FILLME + * + * @param Action + * FILLME + * + * @param TargetContext + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ VOID -STDCALL -FsRtlNotifyFullReportChange ( - IN PNOTIFY_SYNC NotifySync, - IN PLIST_ENTRY NotifyList, - IN PSTRING FullTargetName, /* can include short names! */ - IN USHORT TargetNameOffset, /* in bytes */ - IN PSTRING StreamName OPTIONAL, - IN PSTRING NormalizedParentName OPTIONAL, /* same as FullTargetName, but with long names */ - IN ULONG FilterMatch, - IN ULONG Action, - IN PVOID TargetContext - ) +NTAPI +FsRtlNotifyFullReportChange(IN PNOTIFY_SYNC NotifySync, + IN PLIST_ENTRY NotifyList, + IN PSTRING FullTargetName, /* can include short names! */ + IN USHORT TargetNameOffset, /* in bytes */ + IN PSTRING StreamName OPTIONAL, + IN PSTRING NormalizedParentName OPTIONAL, /* same as FullTargetName, but with long names */ + IN ULONG FilterMatch, + IN ULONG Action, + IN PVOID TargetContext) { - USHORT FullDirLen; - STRING RelativeName; - PNOTIFY_ENTRY NotifyEntry, tmp; - PLIST_ENTRY EnumEntry; - PIRP Irp; - LIST_ENTRY CompletedListHead; - USHORT NameLenU; - ULONG RecordLen; - PFILE_NOTIFY_INFORMATION CurrentEntry; + USHORT FullDirLen; + STRING RelativeName; + PNOTIFY_ENTRY NotifyEntry, tmp; + PLIST_ENTRY EnumEntry; + PIRP Irp; + LIST_ENTRY CompletedListHead; + USHORT NameLenU; + ULONG RecordLen; + PFILE_NOTIFY_INFORMATION CurrentEntry; - InitializeListHead(&CompletedListHead); + InitializeListHead(&CompletedListHead); - DPRINT("FullTargetName: %wZ\n", FullTargetName); + DPRINT("FullTargetName: %wZ\n", FullTargetName); - /* - I think FullTargetName can include/be a short file name! What the heck do i do with this? - Dont think this apply to FsRtlNotifyFullChangeDirectory's FullDirectoryName. - */ + /* + I think FullTargetName can include/be a short file name! What the heck do i do with this? + Dont think this apply to FsRtlNotifyFullChangeDirectory's FullDirectoryName. + */ + ExAcquireFastMutex((PFAST_MUTEX)NotifySync); + LIST_FOR_EACH_SAFE(NotifyEntry, tmp, NotifyList, NOTIFY_ENTRY, ListEntry ) + { + ASSERT(NotifyEntry->Unicode == FsRtlpIsUnicodePath(FullTargetName)); + /* rule out some easy cases */ + /* FIXME: short vs. long names??? lower case/upper case/mixed case? */ + if (!(FilterMatch & NotifyEntry->CompletionFilter)) continue; - ExAcquireFastMutex((PFAST_MUTEX)NotifySync); + FullDirLen = TargetNameOffset - (NotifyEntry->Unicode ? sizeof(WCHAR) : sizeof(char)); + if (FullDirLen == 0) + { + /* special case for root dir */ + FullDirLen = (NotifyEntry->Unicode ? sizeof(WCHAR) : sizeof(char)); + } - LIST_FOR_EACH_SAFE(NotifyEntry, tmp, NotifyList, NOTIFY_ENTRY, ListEntry ) - { - ASSERT(NotifyEntry->Unicode == FsRtlpIsUnicodePath(FullTargetName)); + if (FullDirLen < NotifyEntry->FullDirectoryName->Length) continue; - /* rule out some easy cases */ - /* FIXME: short vs. long names??? lower case/upper case/mixed case? */ - if (!(FilterMatch & NotifyEntry->CompletionFilter)) continue; + if (!NotifyEntry->WatchTree && FullDirLen != NotifyEntry->FullDirectoryName->Length) continue; - FullDirLen = TargetNameOffset - (NotifyEntry->Unicode ? sizeof(WCHAR) : sizeof(char)); - if (FullDirLen == 0) - { - /* special case for root dir */ - FullDirLen = (NotifyEntry->Unicode ? sizeof(WCHAR) : sizeof(char)); - } + DPRINT("NotifyEntry->FullDirectoryName: %wZ\n", NotifyEntry->FullDirectoryName); - if (FullDirLen < NotifyEntry->FullDirectoryName->Length) continue; - - if (!NotifyEntry->WatchTree && FullDirLen != NotifyEntry->FullDirectoryName->Length) continue; - - DPRINT("NotifyEntry->FullDirectoryName: %wZ\n", NotifyEntry->FullDirectoryName); - - /* FIXME: short vs. long names??? lower case/upper case/mixed case? */ - if (memcmp(NotifyEntry->FullDirectoryName->Buffer, + /* FIXME: short vs. long names??? lower case/upper case/mixed case? */ + if (memcmp(NotifyEntry->FullDirectoryName->Buffer, FullTargetName->Buffer, NotifyEntry->FullDirectoryName->Length) != 0) continue; - if (NotifyEntry->WatchTree && - NotifyEntry->TraverseCallback && - FullDirLen != NotifyEntry->FullDirectoryName->Length) - { - /* change happend in a subdir. ask caller if we are allowed in here */ - NTSTATUS Status = NotifyEntry->TraverseCallback(NotifyEntry->FsContext, - TargetContext, - NotifyEntry->SubjectContext); + if (NotifyEntry->WatchTree && + NotifyEntry->TraverseCallback && + FullDirLen != NotifyEntry->FullDirectoryName->Length) + { + /* change happend in a subdir. ask caller if we are allowed in here */ + NTSTATUS Status = NotifyEntry->TraverseCallback(NotifyEntry->FsContext, + TargetContext, + NotifyEntry->SubjectContext); - if (!NT_SUCCESS(Status)) continue; + if (!NT_SUCCESS(Status)) continue; - /* - FIXME: notify-dir impl. should release and free the SubjectContext - */ - } + /* + FIXME: notify-dir impl. should release and free the SubjectContext + */ + } - DPRINT("Found match\n"); + DPRINT("Found match\n"); - /* Found a valid change */ + /* Found a valid change */ - RelativeName.Buffer = FullTargetName->Buffer + TargetNameOffset; - RelativeName.MaximumLength = - RelativeName.Length = - FullTargetName->Length - TargetNameOffset; + RelativeName.Buffer = FullTargetName->Buffer + TargetNameOffset; + RelativeName.MaximumLength = + RelativeName.Length = + FullTargetName->Length - TargetNameOffset; - DPRINT("RelativeName: %wZ\n",&RelativeName); + DPRINT("RelativeName: %wZ\n",&RelativeName); - /* calculate unicode bytes of relative-name + stream-name */ - if (NotifyEntry->Unicode) - { - NameLenU = RelativeName.Length + (StreamName ? (StreamName->Length + sizeof(WCHAR)) : 0); - } - else - { - NameLenU = RelativeName.Length * sizeof(WCHAR) + - (StreamName ? ((StreamName->Length * sizeof(WCHAR)) + sizeof(WCHAR)) : 0); - } + /* calculate unicode bytes of relative-name + stream-name */ + if (NotifyEntry->Unicode) + { + NameLenU = RelativeName.Length + (StreamName ? (StreamName->Length + sizeof(WCHAR)) : 0); + } + else + { + NameLenU = RelativeName.Length * sizeof(WCHAR) + + (StreamName ? ((StreamName->Length * sizeof(WCHAR)) + sizeof(WCHAR)) : 0); + } - RecordLen = FIELD_OFFSET(FILE_NOTIFY_INFORMATION, FileName) + NameLenU; + RecordLen = FIELD_OFFSET(FILE_NOTIFY_INFORMATION, FileName) + NameLenU; - if ((Irp = FsRtlpGetNextIrp(NotifyEntry))) - { - PIO_STACK_LOCATION IrpStack; - ULONG IrpBuffLen; + if ((Irp = FsRtlpGetNextIrp(NotifyEntry))) + { + PIO_STACK_LOCATION IrpStack; + ULONG IrpBuffLen; - IrpStack = IoGetCurrentIrpStackLocation(Irp); - IrpBuffLen = IrpStack->Parameters.NotifyDirectory.Length; + IrpStack = IoGetCurrentIrpStackLocation(Irp); + IrpBuffLen = IrpStack->Parameters.NotifyDirectory.Length; - DPRINT("Got pending irp\n"); + DPRINT("Got pending irp\n"); - ASSERT(!NotifyEntry->PendingChanges); + ASSERT(!NotifyEntry->PendingChanges); - if (NotifyEntry->Buffer == NULL || /* aka. IgnoreBuffer */ - RecordLen > IrpBuffLen) - { - /* ignore buffer / buffer not large enough */ - Irp->IoStatus.Status = STATUS_NOTIFY_ENUM_DIR; - Irp->IoStatus.Information = 0; - } - else - { - CurrentEntry = (PFILE_NOTIFY_INFORMATION) - MmGetSystemAddressForMdlSafe(Irp->MdlAddress, LowPagePriority); - - if (CurrentEntry) + if (NotifyEntry->Buffer == NULL || /* aka. IgnoreBuffer */ + RecordLen > IrpBuffLen) { - CurrentEntry->Action = Action; - CurrentEntry->FileNameLength = NameLenU; - CurrentEntry->NextEntryOffset = 0; - - FsRtlpCopyName( - CurrentEntry, - NotifyEntry->Unicode, - &RelativeName, - StreamName - ); - - Irp->IoStatus.Information = RecordLen; + /* ignore buffer / buffer not large enough */ + Irp->IoStatus.Status = STATUS_NOTIFY_ENUM_DIR; + Irp->IoStatus.Information = 0; } else { - Irp->IoStatus.Information = 0; + CurrentEntry = (PFILE_NOTIFY_INFORMATION) + MmGetSystemAddressForMdlSafe(Irp->MdlAddress, LowPagePriority); + + if (CurrentEntry) + { + CurrentEntry->Action = Action; + CurrentEntry->FileNameLength = NameLenU; + CurrentEntry->NextEntryOffset = 0; + + FsRtlpCopyName( + CurrentEntry, + NotifyEntry->Unicode, + &RelativeName, + StreamName + ); + + Irp->IoStatus.Information = RecordLen; + } + else + { + Irp->IoStatus.Information = 0; + } + + + Irp->IoStatus.Status = STATUS_SUCCESS; } + /* avoid holding lock while completing irp */ + InsertTailList(&CompletedListHead, &Irp->Tail.Overlay.ListEntry); + } + else + { + DPRINT("No irp\n"); - Irp->IoStatus.Status = STATUS_SUCCESS; - } + NotifyEntry->PendingChanges = TRUE; - /* avoid holding lock while completing irp */ - InsertTailList(&CompletedListHead, &Irp->Tail.Overlay.ListEntry); - } - else - { - DPRINT("No irp\n"); + if (NotifyEntry->Buffer == NULL || NotifyEntry->BufferExhausted) continue; - NotifyEntry->PendingChanges = TRUE; + if (RecordLen > NotifyEntry->BufferSize - NotifyEntry->NextEntryOffset) + { + /* overflow. drop these changes and stop buffering any other changes too */ + NotifyEntry->BufferExhausted = TRUE; + continue; + } - if (NotifyEntry->Buffer == NULL || NotifyEntry->BufferExhausted) continue; + /* The buffer has enough room for the changes. + * Copy data to buffer. + */ - if (RecordLen > NotifyEntry->BufferSize - NotifyEntry->NextEntryOffset) - { - /* overflow. drop these changes and stop buffering any other changes too */ - NotifyEntry->BufferExhausted = TRUE; - continue; - } + CurrentEntry = (PFILE_NOTIFY_INFORMATION)NotifyEntry->Buffer; - /* The buffer has enough room for the changes. - * Copy data to buffer. - */ + CurrentEntry->Action = Action; + CurrentEntry->FileNameLength = NameLenU; + CurrentEntry->NextEntryOffset = 0; - CurrentEntry = (PFILE_NOTIFY_INFORMATION)NotifyEntry->Buffer; + FsRtlpCopyName(CurrentEntry, + NotifyEntry->Unicode, + &RelativeName, + StreamName + ); - CurrentEntry->Action = Action; - CurrentEntry->FileNameLength = NameLenU; - CurrentEntry->NextEntryOffset = 0; + if (NotifyEntry->PrevEntry) + { + NotifyEntry->PrevEntry->NextEntryOffset = (char*)CurrentEntry - (char*)NotifyEntry->PrevEntry; + } + NotifyEntry->PrevEntry = CurrentEntry; + NotifyEntry->NextEntryOffset += RecordLen; - FsRtlpCopyName(CurrentEntry, - NotifyEntry->Unicode, - &RelativeName, - StreamName - ); + // { + // UNICODE_STRING TmpStr; + // TmpStr.Buffer = BufferedChange->RelativeName; + // TmpStr.MaximumLength = TmpStr.Length = BufferedChange->NameLen; + // DPRINT("BufferedChange->RelativeName: %wZ\n", &TmpStr); + // } - if (NotifyEntry->PrevEntry) - { - NotifyEntry->PrevEntry->NextEntryOffset = (char*)CurrentEntry - (char*)NotifyEntry->PrevEntry; - } - NotifyEntry->PrevEntry = CurrentEntry; - NotifyEntry->NextEntryOffset += RecordLen; + } + } + ExReleaseFastMutex((PFAST_MUTEX)NotifySync); -// { -// UNICODE_STRING TmpStr; -// TmpStr.Buffer = BufferedChange->RelativeName; -// TmpStr.MaximumLength = TmpStr.Length = BufferedChange->NameLen; -// DPRINT("BufferedChange->RelativeName: %wZ\n", &TmpStr); -// } - - - } - } - - ExReleaseFastMutex((PFAST_MUTEX)NotifySync); - - /* complete defered irps */ - while (!IsListEmpty(&CompletedListHead)) - { - EnumEntry = RemoveHeadList(&CompletedListHead); - Irp = CONTAINING_RECORD(EnumEntry, IRP, Tail.Overlay.ListEntry); - - IoCompleteRequest(Irp, IO_NO_INCREMENT); - } + /* complete defered irps */ + while (!IsListEmpty(&CompletedListHead)) + { + EnumEntry = RemoveHeadList(&CompletedListHead); + Irp = CONTAINING_RECORD(EnumEntry, IRP, Tail.Overlay.ListEntry); + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } } - -/********************************************************************** - * NAME EXPORTED - * FsRtlNotifyInitializeSync@4 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * @implemented - */ -VOID -STDCALL -FsRtlNotifyInitializeSync ( - IN PNOTIFY_SYNC *NotifySync - ) -{ - *NotifySync = ExAllocatePoolWithTag(NonPagedPool, sizeof(FAST_MUTEX), FSRTL_NOTIFY_TAG ); - ExInitializeFastMutex((PFAST_MUTEX)*NotifySync); -} - - -/********************************************************************** - * NAME EXPORTED - * FsRtlNotifyReportChange@20 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * @implemented - */ -VOID -STDCALL -FsRtlNotifyReportChange ( - IN PNOTIFY_SYNC NotifySync, - IN PLIST_ENTRY NotifyList, - IN PSTRING FullTargetName, - IN PUSHORT FileNamePartLength, - IN ULONG FilterMatch - ) -{ - FsRtlNotifyFullReportChange ( - NotifySync, - NotifyList, - FullTargetName, - (FullTargetName->Length - *FileNamePartLength), - NULL, - NULL, - FilterMatch, - 0, - NULL - ); -} - - -/********************************************************************** - * NAME EXPORTED - * FsRtlNotifyUninitializeSync@4 - * - * DESCRIPTION - * Uninitialize a NOTIFY_SYNC object. - * - * ARGUMENTS - * NotifySync is the address of a pointer - * to a PNOTIFY_SYNC object previously initialized by - * FsRtlNotifyInitializeSync(). - * - * RETURN VALUE - * None. - * - * @implemented - */ -VOID -STDCALL -FsRtlNotifyUninitializeSync ( - IN PNOTIFY_SYNC *NotifySync - ) -{ - ExFreePool (*NotifySync); -} - -/********************************************************************** - * NAME EXPORTED - * FsRtlNotifyVolumeEvent@8 - * - * DESCRIPTION - * NOTE: Only present in NT 5+. - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlNotifyInitializeSync * @unimplemented - */ -NTSTATUS -STDCALL -FsRtlNotifyVolumeEvent ( - IN PFILE_OBJECT FileObject, - IN ULONG EventCode - ) + * + * FILLME + * + * @param NotifySync + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ +VOID +NTAPI +FsRtlNotifyInitializeSync(IN PNOTIFY_SYNC *NotifySync) { - return STATUS_NOT_IMPLEMENTED; + *NotifySync = ExAllocatePoolWithTag(NonPagedPool, sizeof(FAST_MUTEX), FSRTL_NOTIFY_TAG ); + ExInitializeFastMutex((PFAST_MUTEX)*NotifySync); } -/* - * +/*++ + * @name FsRtlNotifyReportChange * @unimplemented - */ + * + * FILLME + * + * @param NotifySync + * FILLME + * + * @param NotifyList + * FILLME + * + * @param FullTargetName + * FILLME + * + * @param FileNamePartLength + * FILLME + * + * @param FilterMatch + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ +VOID +NTAPI +FsRtlNotifyReportChange(IN PNOTIFY_SYNC NotifySync, + IN PLIST_ENTRY NotifyList, + IN PSTRING FullTargetName, + IN PUSHORT FileNamePartLength, + IN ULONG FilterMatch) +{ + FsRtlNotifyFullReportChange( + NotifySync, + NotifyList, + FullTargetName, + (FullTargetName->Length - *FileNamePartLength), + NULL, + NULL, + FilterMatch, + 0, + NULL + ); +} + +/*++ + * @name FsRtlCurrentBatchOplock + * @implemented + * + * Uninitialize a NOTIFY_SYNC object + * + * @param NotifySync + * Address of a pointer to a PNOTIFY_SYNC object previously + * initialized by FsRtlNotifyInitializeSync() + * + * @return None + * + * @remarks None + * + *--*/ +VOID +NTAPI +FsRtlNotifyUninitializeSync(IN PNOTIFY_SYNC *NotifySync) +{ + ExFreePool(*NotifySync); +} + +/*++ + * @name FsRtlNotifyVolumeEvent + * @unimplemented + * + * FILLME + * + * @param FileObject + * FILLME + * + * @param EventCode + * FILLME + * + * @return None + * + * @remarks Only present in NT 5+. + * + *--*/ NTSTATUS -STDCALL +NTAPI +FsRtlNotifyVolumeEvent(IN PFILE_OBJECT FileObject, + IN ULONG EventCode) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/*++ + * @name FsRtlRegisterFileSystemFilterCallbacks + * @unimplemented + * + * FILLME + * + * @param FilterDriverObject + * FILLME + * + * @param Callbacks + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ +NTSTATUS +NTAPI FsRtlRegisterFileSystemFilterCallbacks(IN PDRIVER_OBJECT FilterDriverObject, IN PFS_FILTER_CALLBACKS Callbacks) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } /* EOF */ diff --git a/reactos/ntoskrnl/fs/oplock.c b/reactos/ntoskrnl/fs/oplock.c index 5eef0f37665..c83d437bae8 100644 --- a/reactos/ntoskrnl/fs/oplock.c +++ b/reactos/ntoskrnl/fs/oplock.c @@ -1,141 +1,175 @@ /* $Id$ * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/fs/oplock.c - * PURPOSE: No purpose listed. + * PURPOSE: Oplock-functions * * PROGRAMMERS: Emanuele Aliberti * Eric Kohl */ +/* INCLUDES *****************************************************************/ + #include +#define NDEBUG +#include -/********************************************************************** - * NAME EXPORTED - * FsRtlCheckOplock@20 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/* FUNCTIONS *****************************************************************/ + +/*++ + * @name FsRtlCheckOplock * @unimplemented - */ + * + * FILLME + * + * @param Oplock + * FILLME + * + * @param Irp + * FILLME + * + * @param Context + * FILLME + * + * @param CompletionRoutine + * FILLME + * + * @param PostIrpRoutine + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ NTSTATUS NTAPI FsRtlCheckOplock(IN POPLOCK Oplock, - IN PIRP Irp, - IN PVOID Context, - IN POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine OPTIONAL, - IN POPLOCK_FS_PREPOST_IRP PostIrpRoutine OPTIONAL) + IN PIRP Irp, + IN PVOID Context, + IN POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine OPTIONAL, + IN POPLOCK_FS_PREPOST_IRP PostIrpRoutine OPTIONAL) { - return(STATUS_NOT_IMPLEMENTED); + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } - -/********************************************************************** - * NAME EXPORTED - * FsRtlCurrentBatchOplock@4 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlCurrentBatchOplock * @unimplemented - */ + * + * FILLME + * + * @param Oplock + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ BOOLEAN NTAPI FsRtlCurrentBatchOplock(IN POPLOCK Oplock) { - return(FALSE); + UNIMPLEMENTED; + return FALSE; } - -/********************************************************************** - * NAME EXPORTED - * FsRtlInitializeOplock@4 +/*++ + * @name FsRtlInitializeOplock + * @unimplemented * - * DESCRIPTION + * FILLME * - * ARGUMENTS + * @param Oplock + * FILLME * - * RETURN VALUE + * @return None * - * NOTE - * Obsolete function. + * @remarks None * - * @implemented - */ + *--*/ VOID NTAPI FsRtlInitializeOplock(IN OUT POPLOCK Oplock) { + UNIMPLEMENTED; } - -/********************************************************************** - * NAME EXPORTED - * FsRtlOplockFsctrl@12 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlOplockFsctrl * @unimplemented - */ + * + * FILLME + * + * @param Oplock + * FILLME + * + * @param Irp + * FILLME + * + * @param OpenCount + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ NTSTATUS NTAPI FsRtlOplockFsctrl(IN POPLOCK Oplock, - IN PIRP Irp, - IN ULONG OpenCount) + IN PIRP Irp, + IN ULONG OpenCount) { - return(STATUS_NOT_IMPLEMENTED); + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } - -/********************************************************************** - * NAME EXPORTED - * FsRtlOplockIsFastIoPossible@4 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlOplockIsFastIoPossible * @unimplemented - */ + * + * FILLME + * + * @param Oplock + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ BOOLEAN NTAPI FsRtlOplockIsFastIoPossible(IN POPLOCK Oplock) { - return(FALSE); + UNIMPLEMENTED; + return FALSE; } - -/********************************************************************** - * NAME EXPORTED - * FsRtlUninitializeOplock@4 +/*++ + * @name FsRtlUninitializeOplock + * @unimplemented * - * DESCRIPTION + * FILLME * - * ARGUMENTS + * @param Oplock + * FILLME * - * RETURN VALUE + * @return None * - * @implemented - */ + * @remarks None + * + *--*/ VOID NTAPI FsRtlUninitializeOplock(IN POPLOCK Oplock) { + UNIMPLEMENTED; } /* EOF */ diff --git a/reactos/ntoskrnl/fs/pool.c b/reactos/ntoskrnl/fs/pool.c index 4833f7d50df..c4aaa7461fe 100644 --- a/reactos/ntoskrnl/fs/pool.c +++ b/reactos/ntoskrnl/fs/pool.c @@ -1,159 +1,171 @@ /* $Id$ * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/fs/pool.c * PURPOSE: No purpose listed. * * PROGRAMMERS: No programmer listed. */ +/* INCLUDES *****************************************************************/ + #include +#define NDEBUG +#include -/********************************************************************** - * NAME EXPORTED - * FsRtlAllocatePool@8 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * NOTE - * IFS_POOL_TAG is "FSrt" in mem view. - * +/* FUNCTIONS *****************************************************************/ + +/*++ + * @name FsRtlAllocatePool * @implemented - */ + * + * FILLME + * + * @param PoolType + * FILLME + * + * @param NumberOfBytes + * FILLME + * + * @return None + * + * @remarks IFS_POOL_TAG is "FSrt" in mem view. + * + *--*/ PVOID NTAPI -FsRtlAllocatePool ( - IN POOL_TYPE PoolType, - IN ULONG NumberOfBytes - ) +FsRtlAllocatePool(IN POOL_TYPE PoolType, + IN ULONG NumberOfBytes) { - PVOID Address; + PVOID Address; - Address = ExAllocatePoolWithTag ( - PoolType, - NumberOfBytes, - IFS_POOL_TAG - ); - if (NULL == Address) - { - ExRaiseStatus (STATUS_INSUFFICIENT_RESOURCES); - } - return Address; + Address = ExAllocatePoolWithTag(PoolType, + NumberOfBytes, + IFS_POOL_TAG); + + if (NULL == Address) + { + ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES); + } + + return Address; } - -/********************************************************************** - * NAME EXPORTED - * FsRtlAllocatePoolWithQuota@8 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * NOTE - * IFS_POOL_TAG is "FSrt" in mem view. - * +/*++ + * @name FsRtlAllocatePoolWithQuota * @implemented - */ + * + * FILLME + * + * @param PoolType + * FILLME + * + * @param NumberOfBytes + * FILLME + * + * @return None + * + * @remarks IFS_POOL_TAG is "FSrt" in mem view. + * + *--*/ PVOID NTAPI -FsRtlAllocatePoolWithQuota ( - IN POOL_TYPE PoolType, - IN ULONG NumberOfBytes - ) +FsRtlAllocatePoolWithQuota(IN POOL_TYPE PoolType, + IN ULONG NumberOfBytes) { - PVOID Address; + PVOID Address; - Address = ExAllocatePoolWithQuotaTag ( - PoolType, - NumberOfBytes, - IFS_POOL_TAG - ); - if (NULL == Address) - { - ExRaiseStatus (STATUS_INSUFFICIENT_RESOURCES); - } - return Address; + Address = ExAllocatePoolWithQuotaTag(PoolType, + NumberOfBytes, + IFS_POOL_TAG); + if (NULL == Address) + { + ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES); + } + return Address; } - -/********************************************************************** - * NAME EXPORTED - * FsRtlAllocatePoolWithQuotaTag@12 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlAllocatePoolWithQuotaTag * @implemented - */ + * + * FILLME + * + * @param PoolType + * FILLME + * + * @param NumberOfBytes + * FILLME + * + * @param Tag + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ PVOID NTAPI -FsRtlAllocatePoolWithQuotaTag ( - IN POOL_TYPE PoolType, - IN ULONG NumberOfBytes, - IN ULONG Tag - ) +FsRtlAllocatePoolWithQuotaTag (IN POOL_TYPE PoolType, + IN ULONG NumberOfBytes, + IN ULONG Tag) { - PVOID Address; + PVOID Address; - Address = ExAllocatePoolWithQuotaTag ( - PoolType, - NumberOfBytes, - Tag - ); - if (NULL == Address) - { - ExRaiseStatus (STATUS_INSUFFICIENT_RESOURCES); - } - return Address; + Address = ExAllocatePoolWithQuotaTag(PoolType, + NumberOfBytes, + Tag); + + if (NULL == Address) + { + ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES); + } + + return Address; } - -/********************************************************************** - * NAME EXPORTED - * FsRtlAllocatePoolWithTag@12 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlAllocatePoolWithTag * @implemented - */ + * + * FILLME + * + * @param PoolType + * FILLME + * + * @param NumberOfBytes + * FILLME + * + * @param Tag + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ PVOID NTAPI -FsRtlAllocatePoolWithTag ( - IN POOL_TYPE PoolType, - IN ULONG NumberOfBytes, - IN ULONG Tag - ) +FsRtlAllocatePoolWithTag(IN POOL_TYPE PoolType, + IN ULONG NumberOfBytes, + IN ULONG Tag) { - PVOID Address; + PVOID Address; - Address = ExAllocatePoolWithTag ( - PoolType, - NumberOfBytes, - Tag - ); - if (NULL == Address) - { - ExRaiseStatus (STATUS_INSUFFICIENT_RESOURCES); - } - return Address; + Address = ExAllocatePoolWithTag(PoolType, + NumberOfBytes, + Tag); + + if (NULL == Address) + { + ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES); + } + + return Address; } - /* EOF */ diff --git a/reactos/ntoskrnl/fs/tunnel.c b/reactos/ntoskrnl/fs/tunnel.c index 07765c93ed9..4922ea2d2fb 100644 --- a/reactos/ntoskrnl/fs/tunnel.c +++ b/reactos/ntoskrnl/fs/tunnel.c @@ -1,133 +1,178 @@ /* $Id$ * - * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/fs/tunnel.c * PURPOSE: No purpose listed. * * PROGRAMMERS: Emanuele Aliberti */ +/* INCLUDES ******************************************************************/ + #include +#define NDEBUG +#include -/********************************************************************** - * NAME EXPORTED - * FsRtlAddToTunnelCache@32 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/* FUNCTIONS *****************************************************************/ + +/*++ + * @name FsRtlAddToTunnelCache * @unimplemented - */ + * + * FILLME + * + * @param Cache + * FILLME + * + * @param DirectoryKey + * FILLME + * + * @param ShortName + * FILLME + * + * @param LongName + * FILLME + * + * @param KeyByShortName + * FILLME + * + * @param DataLength + * FILLME + * + * @param Data + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ VOID -STDCALL -FsRtlAddToTunnelCache ( - IN PTUNNEL Cache, - IN ULONGLONG DirectoryKey, - IN PUNICODE_STRING ShortName, - IN PUNICODE_STRING LongName, - IN BOOLEAN KeyByShortName, - IN ULONG DataLength, - IN PVOID Data - ) +NTAPI +FsRtlAddToTunnelCache(IN PTUNNEL Cache, + IN ULONGLONG DirectoryKey, + IN PUNICODE_STRING ShortName, + IN PUNICODE_STRING LongName, + IN BOOLEAN KeyByShortName, + IN ULONG DataLength, + IN PVOID Data) { + UNIMPLEMENTED; } - -/********************************************************************** - * NAME EXPORTED - * FsRtlDeleteKeyFromTunnelCache@12 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlDeleteKeyFromTunnelCache * @unimplemented - */ + * + * FILLME + * + * @param Cache + * FILLME + * + * @param DirectoryKey + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ VOID -STDCALL -FsRtlDeleteKeyFromTunnelCache ( - IN PTUNNEL Cache, - IN ULONGLONG DirectoryKey - ) +NTAPI +FsRtlDeleteKeyFromTunnelCache(IN PTUNNEL Cache, + IN ULONGLONG DirectoryKey) { + UNIMPLEMENTED; } - -/********************************************************************** - * NAME EXPORTED - * FsRtlDeleteTunnelCache@4 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlDeleteTunnelCache * @unimplemented - */ + * + * FILLME + * + * @param Cache + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ VOID -STDCALL -FsRtlDeleteTunnelCache ( - IN PTUNNEL Cache - ) +NTAPI +FsRtlDeleteTunnelCache(IN PTUNNEL Cache) { + UNIMPLEMENTED; } - -/********************************************************************** - * NAME EXPORTED - * FsRtlFindInTunnelCache@32 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlFindInTunnelCache * @unimplemented - */ + * + * FILLME + * + * @param Cache + * FILLME + * + * @param DirectoryKey + * FILLME + * + * @param ShortName + * FILLME + * + * @param LongName + * FILLME + * + * @param KeyByShortName + * FILLME + * + * @param DataLength + * FILLME + * + * @param Data + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ BOOLEAN -STDCALL -FsRtlFindInTunnelCache ( - IN PTUNNEL Cache, - IN ULONGLONG DirectoryKey, - IN PUNICODE_STRING Name, - OUT PUNICODE_STRING ShortName, - OUT PUNICODE_STRING LongName, - IN OUT PULONG DataLength, - OUT PVOID Data - ) +NTAPI +FsRtlFindInTunnelCache(IN PTUNNEL Cache, + IN ULONGLONG DirectoryKey, + IN PUNICODE_STRING Name, + OUT PUNICODE_STRING ShortName, + OUT PUNICODE_STRING LongName, + IN OUT PULONG DataLength, + OUT PVOID Data) { + UNIMPLEMENTED; return FALSE; } - -/********************************************************************** - * NAME EXPORTED - * FsRtlInitializeTunnelCache@4 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlDeleteTunnelCache * @unimplemented - */ + * + * FILLME + * + * @param Cache + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ VOID -STDCALL -FsRtlInitializeTunnelCache ( - IN PTUNNEL Cache - ) +NTAPI +FsRtlInitializeTunnelCache(IN PTUNNEL Cache) { + UNIMPLEMENTED; } - /* EOF */ diff --git a/reactos/ntoskrnl/fs/unc.c b/reactos/ntoskrnl/fs/unc.c index cac08ba56db..2c3d9244e41 100644 --- a/reactos/ntoskrnl/fs/unc.c +++ b/reactos/ntoskrnl/fs/unc.c @@ -1,54 +1,70 @@ /* $Id$ * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/fs/unc.c - * PURPOSE: No purpose listed. + * PURPOSE: Functions to work with UNC providers * * PROGRAMMERS: Emanuele Aliberti * Eric Kohl */ +/* INCLUDES *****************************************************************/ + #include +#define NDEBUG +#include -/********************************************************************** - * NAME EXPORTED - * FsRtlDeregisterUncProvider@4 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/* FUNCTIONS *****************************************************************/ + +/*++ + * @name FsRtlDeregisterUncProvider * @unimplemented - */ + * + * FILLME + * + * @param Handle + * FILLME + * + * @return None + * + * @remarks None + * + *--*/ VOID NTAPI FsRtlDeregisterUncProvider(IN HANDLE Handle) { + UNIMPLEMENTED; } - -/********************************************************************** - * NAME EXPORTED - * FsRtlRegisterUncProvider@12 - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * +/*++ + * @name FsRtlRegisterUncProvider * @unimplemented - */ + * + * FILLME + * + * @param Handle + * FILLME + * + * @param RedirectorDeviceName + * FILLME + * + * @param MailslotsSupported + * + * @return None + * + * @remarks None + * + *--*/ NTSTATUS NTAPI FsRtlRegisterUncProvider(IN OUT PHANDLE Handle, IN PUNICODE_STRING RedirectorDeviceName, IN BOOLEAN MailslotsSupported) { + UNIMPLEMENTED; return(STATUS_NOT_IMPLEMENTED); } diff --git a/reactos/ntoskrnl/fs/util.c b/reactos/ntoskrnl/fs/util.c index cdde522cb34..8b985547508 100644 --- a/reactos/ntoskrnl/fs/util.c +++ b/reactos/ntoskrnl/fs/util.c @@ -1,15 +1,18 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/fs/util.c * PURPOSE: Misc Utility Functions for File System Drivers * * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + Emanuele Aliberti */ /* INCLUDES *****************************************************************/ #include + +#define NDEBUG #include #define FSRTL_MAX_RESOURCES 16 @@ -21,7 +24,7 @@ /* GLOBALS *******************************************************************/ BOOLEAN STDCALL MmIsFileAPagingFile(PFILE_OBJECT FileObject); -VOID STDCALL INIT_FUNCTION RtlpInitializeResources(VOID); +VOID NTAPI INIT_FUNCTION RtlpInitializeResources(VOID); static ULONG FsRtlpAllocatedResources = 0; static PERESOURCE FsRtlpResources; @@ -32,7 +35,7 @@ static PERESOURCE FsRtlpResources; /* PRIVATE FUNCTIONS**********************************************************/ VOID -STDCALL +NTAPI INIT_FUNCTION RtlpInitializeResources(VOID) { @@ -67,7 +70,7 @@ RtlpInitializeResources(VOID) * *--*/ BOOLEAN -STDCALL +NTAPI FsRtlIsTotalDeviceFailure(IN NTSTATUS NtStatus) { return((NT_SUCCESS(NtStatus)) || @@ -91,7 +94,7 @@ FsRtlIsTotalDeviceFailure(IN NTSTATUS NtStatus) * *--*/ BOOLEAN -STDCALL +NTAPI FsRtlIsNtstatusExpected(IN NTSTATUS NtStatus) { return((STATUS_DATATYPE_MISALIGNMENT == NtStatus) || @@ -115,7 +118,7 @@ FsRtlIsNtstatusExpected(IN NTSTATUS NtStatus) * *--*/ BOOLEAN -STDCALL +NTAPI FsRtlIsPagingFile(IN PFILE_OBJECT FileObject) { return MmIsFileAPagingFile(FileObject); @@ -141,7 +144,7 @@ FsRtlIsPagingFile(IN PFILE_OBJECT FileObject) * *--*/ NTSTATUS -STDCALL +NTAPI FsRtlNormalizeNtstatus(IN NTSTATUS NtStatusToNormalize, IN NTSTATUS NormalizedNtStatus) { @@ -162,7 +165,7 @@ FsRtlNormalizeNtstatus(IN NTSTATUS NtStatusToNormalize, * *--*/ PERESOURCE -STDCALL +NTAPI FsRtlAllocateResource(VOID) { /* Return a pre-allocated ERESOURCE */ @@ -185,7 +188,7 @@ FsRtlAllocateResource(VOID) * *--*/ NTSTATUS -STDCALL +NTAPI FsRtlBalanceReads(PDEVICE_OBJECT TargetDevice) { PIRP Irp; @@ -243,7 +246,7 @@ FsRtlBalanceReads(PDEVICE_OBJECT TargetDevice) * *--*/ VOID -STDCALL +NTAPI FsRtlPostPagingFileStackOverflow(IN PVOID Context, IN PKEVENT Event, IN PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine) @@ -269,7 +272,7 @@ FsRtlPostPagingFileStackOverflow(IN PVOID Context, * *--*/ VOID -STDCALL +NTAPI FsRtlPostStackOverflow(IN PVOID Context, IN PKEVENT Event, IN PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine) @@ -289,7 +292,7 @@ FsRtlPostStackOverflow(IN PVOID Context, * *--*/ NTSTATUS -STDCALL +NTAPI FsRtlSyncVolumes(DWORD Unknown0, DWORD Unknown1, DWORD Unknown2)