https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8983adf967a696d054ccca4e118df27e1b5ffa13

commit 8983adf967a696d054ccca4e118df27e1b5ffa13
Author:     Serge Gautherie <[email protected]>
AuthorDate: Fri Jun 26 19:03:01 2020 +0200
Commit:     GitHub <[email protected]>
CommitDate: Fri Jun 26 20:03:01 2020 +0300

    [FASTFAT_NEW] Sync to upstream 16022c5 (#2938)
---
 drivers/filesystems/fastfat_new/README.md  | 53 +++++++++++++++---------------
 drivers/filesystems/fastfat_new/close.c    | 10 +++---
 drivers/filesystems/fastfat_new/devctrl.c  |  2 +-
 drivers/filesystems/fastfat_new/deviosup.c |  2 +-
 drivers/filesystems/fastfat_new/fatinit.c  |  4 +--
 drivers/filesystems/fastfat_new/fsctrl.c   | 44 +++++++++++++++++++------
 drivers/filesystems/fastfat_new/volinfo.c  | 41 ++++++++++++++---------
 media/doc/README.FSD                       |  2 +-
 8 files changed, 96 insertions(+), 62 deletions(-)

diff --git a/drivers/filesystems/fastfat_new/README.md 
b/drivers/filesystems/fastfat_new/README.md
index 801e3f73657..1c409ac7b6d 100644
--- a/drivers/filesystems/fastfat_new/README.md
+++ b/drivers/filesystems/fastfat_new/README.md
@@ -1,26 +1,24 @@
-<!---
-    name: fastfat File System Driver
-    platform: WDM
-    language: cpp
-    category: FileSystem
-    description: A file system driver based on the Windows inbox FastFAT file 
system used as a model for new file systems.
-    samplefwlink: http://go.microsoft.com/fwlink/p/?LinkId=620305
---->
-
-
-
-fastfat File System Driver
-==========================
+---
+page_type: sample
+description: "A file system driver based on the Windows inbox FastFAT file 
system used as a model for new file systems."
+languages:
+- cpp
+products:
+- windows
+- windows-wdk
+---
+
+# fastfat File System Driver
 
 The *fastfat* sample is file system driver that you can use as a model to 
write new file systems.
 
 *fastfat* is a complete file system that addresses various issues such as 
storing data on disk, interacting with the cache manager, and handling various 
I/O operations such as file creation, performing read/writes on a file, setting 
information on a file, and performing control operations on the file system.
 
 ## Universal Windows Driver Compliant
+
 This sample builds a Universal Windows Driver. It uses only APIs and DDIs that 
are included in OneCoreUAP.
 
-Build the sample
-----------------
+## Build the sample
 
 You can build the sample in two ways: using Microsoft Visual Studio or the 
command line (*MSBuild*).
 
@@ -30,25 +28,28 @@ You build a driver the same way you build any project or 
solution in Visual Stud
 
 The default Solution build configuration is **Debug** and **Win32**.
 
-**To select a configuration and build a driver**
+#### To select a configuration and build a driver
 
-1.  Open the driver project or solution in Visual Studio (find fastfat.sln or 
fastfat.vcxproj).
-2.  Right-click the solution in the **Solutions Explorer** and select 
**Configuration Manager**.
-3.  From the **Configuration Manager**, select the **Active Solution 
Configuration** (for example, Debug or Release) and the **Active Solution 
Platform** (for example, Win32) that correspond to the type of build you are 
interested in.
-4.  From the Build menu, click **Build Solution** (Ctrl+Shift+B).
+1. Open the driver project or solution in Visual Studio (find fastfat.sln or 
fastfat.vcxproj).
+
+1. Right-click the solution in the **Solutions Explorer** and select 
**Configuration Manager**.
+
+1. From the **Configuration Manager**, select the **Active Solution 
Configuration** (for example, Debug or Release) and the **Active Solution 
Platform** (for example, Win32) that correspond to the type of build you are 
interested in.
+
+1. From the Build menu, click **Build Solution** (Ctrl+Shift+B).
 
 ### Building a Driver Using the Command Line (MSBuild)
 
 You can build a driver from the command line using the Visual Studio Command 
Prompt window and the Microsoft Build Engine (MSBuild.exe) Previous versions of 
the WDK used the Windows Build utility (Build.exe) and provided separate build 
environment windows for each of the supported build configurations. You can now 
use the Visual Studio Command Prompt window for all build configurations.
 
-**To select a configuration and build a driver or an application**
+#### To select a configuration and build a driver or an application
+
+1. Open a Visual Studio Command Prompt window at the **Start** screen. From 
this window you can use MsBuild.exe to build any Visual Studio project by 
specifying the project (.VcxProj) or solutions (.Sln) file.
 
-1.  Open a Visual Studio Command Prompt window at the **Start** screen. From 
this window you can use MsBuild.exe to build any Visual Studio project by 
specifying the project (.VcxProj) or solutions (.Sln) file.
-2.  Navigate to the project directory and enter the **MSbuild** command for 
your target. For example, to perform a clean build of a Visual Studio driver 
project called *filtername*.vcxproj, navigate to the project directory and 
enter the following MSBuild command: 
+1. Navigate to the project directory and enter the **MSbuild** command for 
your target. For example, to perform a clean build of a Visual Studio driver 
project called *filtername*.vcxproj, navigate to the project directory and 
enter the following MSBuild command:
 
-    **msbuild /t:clean /t:build .\\fastfat.vcxproj**.
+`msbuild /t:clean /t:build .\\fastfat.vcxproj`
 
-Installation
-------------
+## Installation
 
 No INF file is provided with this sample because the *fastfat* file system 
driver (fastfat.sys) is already part of the Windows operating system. You can 
build a private version of this file system and use it as a replacement for the 
native driver.
diff --git a/drivers/filesystems/fastfat_new/close.c 
b/drivers/filesystems/fastfat_new/close.c
index 7e9ac2d4ad3..e92aad02285 100644
--- a/drivers/filesystems/fastfat_new/close.c
+++ b/drivers/filesystems/fastfat_new/close.c
@@ -299,7 +299,7 @@ Return Value:
         //
         //  We had some trouble trying to perform the requested
         //  operation, so we'll abort the I/O request with the 
-        //  error status that we get back from the execption code.
+        //  error status that we get back from the exception code.
         //
 
         Status = FatProcessException( NULL, Irp, _SEH2_GetExceptionCode() );
@@ -669,7 +669,7 @@ Return Value:
 
     //
     //  If the queues are above the limits by a significant amount, we have
-    //  to try hard to pull them down.  To do this, we will aggresively try
+    //  to try hard to pull them down.  To do this, we will aggressively try
     //  to find closes for the last volume the caller looked at.  This will
     //  make sure we fully utilize the acquisition of the volume, which can
     //  be a hugely expensive resource to get (create/close/cleanup use it
@@ -884,7 +884,7 @@ Return Value:
     DebugTrace(+1, Dbg, "FatCommonClose...\n", 0);
 
     //
-    //  Initailize the callers variable, if needed.
+    //  Initialize the callers variable, if needed.
     //
 
     LocalVcbDeleted = FALSE;
@@ -1082,7 +1082,7 @@ Return Value:
 
                 //
                 //  Dereference the directory file.  This may cause a close
-                //  Irp to be processed, so we need to do this before we 
destory
+                //  Irp to be processed, so we need to do this before we 
destroy
                 //  the Fcb.
                 //
 
@@ -1210,7 +1210,7 @@ Return Value:
                 //
                 //  We need the global lock, which must be acquired before the
                 //  VCB.  Since we already have the VCB, we have to drop and
-                //  reaquire here.  Note that we always want to wait from this
+                //  reacquire here.  Note that we always want to wait from this
                 //  point on.  Note that the VCB cannot go away, since we have
                 //  biased the open file count.
                 //
diff --git a/drivers/filesystems/fastfat_new/devctrl.c 
b/drivers/filesystems/fastfat_new/devctrl.c
index 7cfa954440e..0abbcec6764 100644
--- a/drivers/filesystems/fastfat_new/devctrl.c
+++ b/drivers/filesystems/fastfat_new/devctrl.c
@@ -99,7 +99,7 @@ Return Value:
         //  We had some trouble trying to perform the requested
         //  operation, so we'll abort the I/O request with
         //  the error status that we get back from the
-        //  execption code
+        //  exception code
         //
 
         Status = FatProcessException( IrpContext, Irp, 
_SEH2_GetExceptionCode() );
diff --git a/drivers/filesystems/fastfat_new/deviosup.c 
b/drivers/filesystems/fastfat_new/deviosup.c
index 17462d8704b..a1712a396a6 100644
--- a/drivers/filesystems/fastfat_new/deviosup.c
+++ b/drivers/filesystems/fastfat_new/deviosup.c
@@ -3814,7 +3814,7 @@ Return Value:
     //
     //  It would be nice if Mm exported a way for us to not have
     //  to pull the Mdl apart and rebuild it ourselves, but this
-    //  is so bizzare a purpose as to be tolerable.
+    //  is so bizarre a purpose as to be tolerable.
     //
 
     SavedByteCount = ZeroMdl->ByteCount;
diff --git a/drivers/filesystems/fastfat_new/fatinit.c 
b/drivers/filesystems/fastfat_new/fatinit.c
index b09339640d5..09df201769f 100644
--- a/drivers/filesystems/fastfat_new/fatinit.c
+++ b/drivers/filesystems/fastfat_new/fatinit.c
@@ -632,14 +632,14 @@ FatIsFujitsuFMR (
 
 Routine Description:
 
-    This routine tells if is we running on a FujitsuFMR machine.
+    This routine tells us if we are running on a FujitsuFMR machine.
 
 Arguments:
 
 
 Return Value:
 
-    BOOLEAN - TRUE is we are and FALSE otherwise
+    BOOLEAN - TRUE if we are and FALSE otherwise
 
 --*/
 
diff --git a/drivers/filesystems/fastfat_new/fsctrl.c 
b/drivers/filesystems/fastfat_new/fsctrl.c
index 0938dcc63e9..d5ec06b3155 100644
--- a/drivers/filesystems/fastfat_new/fsctrl.c
+++ b/drivers/filesystems/fastfat_new/fsctrl.c
@@ -1422,22 +1422,34 @@ Return Value:
 
         if (Dirent != NULL) {
 
+            UCHAR OemBuffer[11];
             OEM_STRING OemString;
             UNICODE_STRING UnicodeString;
 
+            OemString.Buffer = (PCHAR)&OemBuffer[0];
+            OemString.MaximumLength = 11;
+
+            RtlCopyMemory( OemString.Buffer, Dirent->FileName, 11 );
+
             //
-            //  Compute the length of the volume name
+            //  Translate the first character from 0x5 to 0xe5.
             //
 
-            OemString.Buffer = (PCHAR)&Dirent->FileName[0];
-            OemString.MaximumLength = 11;
+            if (OemString.Buffer[0] == FAT_DIRENT_REALLY_0E5) {
+
+                OemString.Buffer[0] = 0xe5;
+            }
+
+            //
+            //  Compute the length of the volume name
+            //
 
             for ( OemString.Length = 11;
                   OemString.Length > 0;
                   OemString.Length -= 1) {
 
-                if ( (Dirent->FileName[OemString.Length-1] != 0x00) &&
-                     (Dirent->FileName[OemString.Length-1] != 0x20) ) { break; 
}
+                if ( (OemString.Buffer[OemString.Length-1] != 0x00) &&
+                     (OemString.Buffer[OemString.Length-1] != 0x20) ) { break; 
}
             }
 
             UnicodeString.MaximumLength = MAXIMUM_VOLUME_LABEL_LENGTH;
@@ -7849,6 +7861,7 @@ Return Value:
     PDIRENT Dirent;
     PDIRENT TerminationDirent;
     ULONG VolumeLabelLength;
+    UCHAR OemBuffer[11];
     OEM_STRING OemString;
     UNICODE_STRING UnicodeString;
 
@@ -7895,19 +7908,30 @@ Return Value:
     }
 
 
+    OemString.Buffer = (PCHAR)&OemBuffer[0];
+    OemString.MaximumLength = 11;
+
+    RtlCopyMemory( OemString.Buffer, Dirent->FileName, 11 );
+
     //
-    //  Compute the length of the volume name
+    //  Translate the first character from 0x5 to 0xe5.
     //
 
-    OemString.Buffer = (PCHAR)&Dirent->FileName[0];
-    OemString.MaximumLength = 11;
+    if (OemString.Buffer[0] == FAT_DIRENT_REALLY_0E5) {
+
+        OemString.Buffer[0] = 0xe5;
+    }
+
+    //
+    //  Compute the length of the volume name
+    //
 
     for ( OemString.Length = 11;
           OemString.Length > 0;
           OemString.Length -= 1) {
 
-        if ( (Dirent->FileName[OemString.Length-1] != 0x00) &&
-             (Dirent->FileName[OemString.Length-1] != 0x20) ) { break; }
+        if ( (OemString.Buffer[OemString.Length-1] != 0x00) &&
+             (OemString.Buffer[OemString.Length-1] != 0x20) ) { break; }
     }
 
     UnicodeString.MaximumLength = sizeof( UnicodeBuffer );
diff --git a/drivers/filesystems/fastfat_new/volinfo.c 
b/drivers/filesystems/fastfat_new/volinfo.c
index be38ac9aa94..c9f76aa7625 100644
--- a/drivers/filesystems/fastfat_new/volinfo.c
+++ b/drivers/filesystems/fastfat_new/volinfo.c
@@ -155,7 +155,7 @@ Return Value:
         //  We had some trouble trying to perform the requested
         //  operation, so we'll abort the I/O request with
         //  the error status that we get back from the
-        //  execption code
+        //  exception code
         //
 
         Status = FatProcessException( IrpContext, Irp, 
_SEH2_GetExceptionCode() );
@@ -236,7 +236,7 @@ Return Value:
         //  We had some trouble trying to perform the requested
         //  operation, so we'll abort the I/O request with
         //  the error status that we get back from the
-        //  execption code
+        //  exception code
         //
 
         Status = FatProcessException( IrpContext, Irp, 
_SEH2_GetExceptionCode() );
@@ -331,7 +331,7 @@ Return Value:
 
         //
         //  Make sure the vcb is in a usable condition.  This will raise
-        //  and error condition if the volume is unusable
+        //  an error condition if the volume is unusable
         //
         //  Also verify the Root Dcb since we need info from there.
         //
@@ -526,7 +526,7 @@ Return Value:
 
         //
         //  Make sure the vcb is in a usable condition.  This will raise
-        //  and error condition if the volume is unusable
+        //  an error condition if the volume is unusable
         //
         //  Also verify the Root Dcb since we need info from there.
         //
@@ -598,8 +598,8 @@ Arguments:
     Buffer - Supplies a pointer to the output buffer where the information
         is to be returned
 
-    Length - Supplies the length of the buffer in byte.  This variable
-        upon return recieves the remaining bytes free in the buffer
+    Length - Supplies the length of the buffer in bytes.  This variable
+        upon return receives the remaining bytes free in the buffer
 
 Return Value:
 
@@ -692,8 +692,8 @@ Arguments:
     Buffer - Supplies a pointer to the output buffer where the information
         is to be returned
 
-    Length - Supplies the length of the buffer in byte.  This variable
-        upon return recieves the remaining bytes free in the buffer
+    Length - Supplies the length of the buffer in bytes.  This variable
+        upon return receives the remaining bytes free in the buffer
 
 Return Value:
 
@@ -761,8 +761,8 @@ Arguments:
     Buffer - Supplies a pointer to the output buffer where the information
         is to be returned
 
-    Length - Supplies the length of the buffer in byte.  This variable
-        upon return recieves the remaining bytes free in the buffer
+    Length - Supplies the length of the buffer in bytes.  This variable
+        upon return receives the remaining bytes free in the buffer
 
 Return Value:
 
@@ -826,8 +826,8 @@ Arguments:
     Buffer - Supplies a pointer to the output buffer where the information
         is to be returned
 
-    Length - Supplies the length of the buffer in byte.  This variable
-        upon return recieves the remaining bytes free in the buffer
+    Length - Supplies the length of the buffer in bytes.  This variable
+        upon return receives the remaining bytes free in the buffer
 
 Return Value:
 
@@ -949,8 +949,8 @@ Arguments:
     Buffer - Supplies a pointer to the output buffer where the information
         is to be returned
 
-    Length - Supplies the length of the buffer in byte.  This variable
-        upon return recieves the remaining bytes free in the buffer
+    Length - Supplies the length of the buffer in bytes.  This variable
+        upon return receives the remaining bytes free in the buffer
 
 Return Value:
 
@@ -1067,7 +1067,7 @@ Return Value:
 
     //
     //  Volume label that fits in 11 unicode character length limit
-    //  is not necessary within 11 characters in OEM character set.
+    //  is not necessarily within 11 characters in OEM character set.
     //
 
     if (!NT_SUCCESS( Status )) {
@@ -1159,6 +1159,15 @@ Return Value:
 
         if (OemLabel.Length > 0) {
 
+            //
+            //  Translate the first character from 0xe5 to 0x5.
+            //
+
+            if ((UCHAR)OemLabel.Buffer[0] == 0xe5) {
+
+                OemLabel.Buffer[0] = FAT_DIRENT_REALLY_0E5;
+            }
+
             //
             //  Locate the volume label if there already is one
             //
@@ -1326,7 +1335,7 @@ Arguments:
     Buffer - Supplies a pointer to the output buffer where the information
         is to be returned
 
-    Length - Supplies the length of the buffer in byte.  This variable
+    Length - Supplies the length of the buffer in bytes.  This variable
         upon return receives the remaining bytes free in the buffer
 
 Return Value:
diff --git a/media/doc/README.FSD b/media/doc/README.FSD
index 5071e3cc1f5..83137d81a5c 100644
--- a/media/doc/README.FSD
+++ b/media/doc/README.FSD
@@ -19,7 +19,7 @@ drivers/filesystems/reiserfs        # Synced to 0.26
 The following FSD are shared with: 
https://github.com/Microsoft/Windows-driver-samples
 
 drivers/filesystems/cdfs            # Synced to f73e552
-drivers/filesystems/fastfat_new     # Synced to 2817004
+drivers/filesystems/fastfat_new     # Synced to 16022c5
 drivers/storage/class/disk_new      # Forked. (Imported on 2012.01.26 (r55211, 
from Windows XP DDK), merged to trunk on 2012.02.12 (r55555).)
 drivers/storage/floppy_new          # Synced to 8fb512a
 

Reply via email to