mirror of
				https://github.com/winfsp/winfsp.git
				synced 2025-10-30 19:48:38 -05:00 
			
		
		
		
	dll, sys: FSP_NEXT_EA
This commit is contained in:
		| @@ -1805,19 +1805,14 @@ FSP_API NTSTATUS FspFileSystemEnumerateEa(FSP_FILE_SYSTEM *FileSystem, | ||||
|     PVOID Context, | ||||
|     PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength) | ||||
| { | ||||
|     PFILE_FULL_EA_INFORMATION EaEnd = (PVOID)((PUINT8)Ea + EaLength); | ||||
|     NTSTATUS Result; | ||||
|  | ||||
|     Result = STATUS_SUCCESS; | ||||
|     for (; | ||||
|         EaEnd > Ea && 0 != Ea->NextEntryOffset; | ||||
|         Ea = (PVOID)((PUINT8)Ea + Ea->NextEntryOffset)) | ||||
|     NTSTATUS Result = STATUS_SUCCESS; | ||||
|     for (PFILE_FULL_EA_INFORMATION EaEnd = (PVOID)((PUINT8)Ea + EaLength); | ||||
|         EaEnd > Ea; FSP_NEXT_EA(Ea, EaEnd)) | ||||
|     { | ||||
|         Result = EnumerateEa(FileSystem, Context, Ea); | ||||
|         if (!NT_SUCCESS(Result)) | ||||
|             break; | ||||
|     } | ||||
|  | ||||
|     return Result; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -92,4 +92,7 @@ static inline BOOLEAN FspPathIsDrive(PWSTR FileName) | ||||
|         L':' == FileName[1] && L'\0' == FileName[2]; | ||||
| } | ||||
|  | ||||
| #define FSP_NEXT_EA(Ea, EaEnd)          \ | ||||
|     (0 != (Ea)->NextEntryOffset ? (PVOID)((PUINT8)(Ea) + (Ea)->NextEntryOffset) : (EaEnd)) | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -908,9 +908,10 @@ namespace Fsp.Interop | ||||
|             FullEaInformation *EndP = (FullEaInformation *)(Ea.ToInt64() + EaLength); | ||||
|             Int32 Result; | ||||
|             Result = 0/*STATUS_SUCCESS*/; | ||||
|             for (; | ||||
|                 EndP > P && 0 != P->NextEntryOffset; | ||||
|                 P = (FullEaInformation *)(((IntPtr)P).ToInt64() + P->NextEntryOffset)) | ||||
|             for (; EndP > P; | ||||
|                 P = 0 != P->NextEntryOffset ? | ||||
|                     (FullEaInformation *)(((IntPtr)P).ToInt64() + P->NextEntryOffset) : | ||||
|                     EndP) | ||||
|             { | ||||
|                 String EaName = Marshal.PtrToStringAnsi((IntPtr)P->EaName, P->EaNameLength); | ||||
|                 Byte[] EaValue = new Byte[P->EaValueLength]; | ||||
|   | ||||
| @@ -573,6 +573,8 @@ NTSTATUS FspOplockFsctrl( | ||||
|     FspNotifyFullChangeDirectory(NS, NL, FC, 0, 0, FALSE, 0, 0, 0, 0) | ||||
| #define FspNotifyReportChange(NS, NL, FN, FO, NP, F, A)\ | ||||
|     FspNotifyFullReportChange(NS, NL, (PSTRING)(FN), FO, 0, (PSTRING)(NP), F, A, 0) | ||||
| #define FSP_NEXT_EA(Ea, EaEnd)          \ | ||||
|     (0 != (Ea)->NextEntryOffset ? (PVOID)((PUINT8)(Ea) + (Ea)->NextEntryOffset) : (EaEnd)) | ||||
|  | ||||
| /* utility: synchronous work queue */ | ||||
| typedef struct | ||||
|   | ||||
							
								
								
									
										27
									
								
								src/sys/ea.c
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								src/sys/ea.c
									
									
									
									
									
								
							| @@ -97,17 +97,13 @@ static VOID FspFsvolQueryEaGetCopy( | ||||
|     IoStatus->Status = STATUS_SUCCESS; | ||||
|     IoStatus->Information = 0; | ||||
|     DstBuf = DstBufBgn, PrevDstBuf = 0; | ||||
|     for (GetBuf = GetBufBgn; | ||||
|         GetBufEnd > GetBuf && 0 != GetBuf->NextEntryOffset; | ||||
|         GetBuf = (PVOID)((PUINT8)GetBuf + GetBuf->NextEntryOffset)) | ||||
|     for (GetBuf = GetBufBgn; GetBufEnd > GetBuf; GetBuf = FSP_NEXT_EA(GetBuf, GetBufEnd)) | ||||
|     { | ||||
|         GetName.Length = GetName.MaximumLength = GetBuf->EaNameLength; | ||||
|         GetName.Buffer = GetBuf->EaName; | ||||
|  | ||||
|         /* ignore duplicate names */ | ||||
|         for (Get = GetBufBgn; | ||||
|             GetBuf > Get; | ||||
|             Get = (PVOID)((PUINT8)Get + Get->NextEntryOffset)) | ||||
|         for (Get = GetBufBgn; GetBuf > Get; Get = (PVOID)((PUINT8)Get + Get->NextEntryOffset)) | ||||
|         { | ||||
|             Name.Length = Name.MaximumLength = Get->EaNameLength; | ||||
|             Name.Buffer = Get->EaName; | ||||
| @@ -126,9 +122,7 @@ static VOID FspFsvolQueryEaGetCopy( | ||||
|         } | ||||
|  | ||||
|         Src = GetBuf; | ||||
|         for (SrcBuf = SrcBufBgn; | ||||
|             SrcBufEnd > SrcBuf && 0 != SrcBuf->NextEntryOffset; | ||||
|             SrcBuf = (PVOID)((PUINT8)SrcBuf + SrcBuf->NextEntryOffset)) | ||||
|         for (SrcBuf = SrcBufBgn; SrcBufEnd > SrcBuf; SrcBuf = FSP_NEXT_EA(SrcBuf, SrcBufEnd)) | ||||
|         { | ||||
|             Name.Length = Name.MaximumLength = SrcBuf->EaNameLength; | ||||
|             Name.Buffer = SrcBuf->EaName; | ||||
| @@ -201,18 +195,14 @@ static VOID FspFsvolQueryEaIndexCopy( | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     for (SrcBuf = SrcBufBgn; | ||||
|         EaIndex < *PEaIndex && | ||||
|         SrcBufEnd > SrcBuf && 0 != SrcBuf->NextEntryOffset; | ||||
|         SrcBuf = (PVOID)((PUINT8)SrcBuf + SrcBuf->NextEntryOffset), EaIndex++) | ||||
|     for (SrcBuf = SrcBufBgn; EaIndex < *PEaIndex && SrcBufEnd > SrcBuf; | ||||
|         SrcBuf = FSP_NEXT_EA(SrcBuf, SrcBufEnd), EaIndex++) | ||||
|         ; | ||||
|  | ||||
|     IoStatus->Status = STATUS_SUCCESS; | ||||
|     IoStatus->Information = 0; | ||||
|     DstBuf = DstBufBgn, PrevDstBuf = 0; | ||||
|     for (; | ||||
|         SrcBufEnd > SrcBuf && 0 != SrcBuf->NextEntryOffset; | ||||
|         SrcBuf = (PVOID)((PUINT8)SrcBuf + SrcBuf->NextEntryOffset), EaIndex++) | ||||
|     for (; SrcBufEnd > SrcBuf; SrcBuf = FSP_NEXT_EA(SrcBuf, SrcBufEnd), EaIndex++) | ||||
|     { | ||||
|         if ((PUINT8)DstBuf + FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) > (PUINT8)DstBufEnd) | ||||
|             break; | ||||
| @@ -256,7 +246,7 @@ static VOID FspFsvolQueryEaIndexCopy( | ||||
|         if (SrcBufBgn == SrcBuf) | ||||
|             IoStatus->Status = IndexSpecified ? | ||||
|                 STATUS_NONEXISTENT_EA_ENTRY : STATUS_NO_EAS_ON_FILE; | ||||
|         else if (SrcBufEnd > SrcBuf && 0 != SrcBuf->NextEntryOffset) | ||||
|         else if (SrcBufEnd > SrcBuf) | ||||
|             IoStatus->Status = STATUS_BUFFER_TOO_SMALL; | ||||
|         else | ||||
|             IoStatus->Status = IndexSpecified && *PEaIndex != EaIndex ? | ||||
| @@ -503,8 +493,7 @@ static NTSTATUS FspFsvolSetEa( | ||||
|         return Result; | ||||
|  | ||||
|     for (PFILE_FULL_EA_INFORMATION Ea = Buffer, EaEnd = (PVOID)((PUINT8)Ea + Length); | ||||
|         EaEnd > Ea && 0 != Ea->NextEntryOffset; | ||||
|         Ea = (PVOID)((PUINT8)Ea + Ea->NextEntryOffset)) | ||||
|         EaEnd > Ea; Ea = FSP_NEXT_EA(Ea, EaEnd)) | ||||
|     { | ||||
|         STRING Name; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user