diff options
author | Matt Wu <matt@ext2fsd.com> | 2016-12-01 07:05:10 +0300 |
---|---|---|
committer | Matt Wu <matt@ext2fsd.com> | 2016-12-01 07:05:10 +0300 |
commit | 0b5a9b0c8844847191d48dcd3c9a4af84a5790fb (patch) | |
tree | b6f38d1863ba0c57bc9233aa1b1f0a888a482e3a /Ext3Fsd | |
parent | 18272566776b5cdfb47877f5c8b2f54820000b8a (diff) | |
parent | 406ead063a0d8b8c415f1f4b7203276a8fbafbac (diff) |
Merge remote-tracking branch 'remotes/ngkaho/ea'
Diffstat (limited to 'Ext3Fsd')
-rw-r--r-- | Ext3Fsd/DIRS | 1 | ||||
-rw-r--r-- | Ext3Fsd/Ext3Fsd.inf | 90 | ||||
-rw-r--r-- | Ext3Fsd/Ext3Fsd.vcxproj | 399 | ||||
-rw-r--r-- | Ext3Fsd/Ext3Fsd.vcxproj.filters | 449 | ||||
-rw-r--r-- | Ext3Fsd/Ext3Fsd.vcxproj.user | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/block.c | 0 | ||||
-rw-r--r-- | Ext3Fsd/clean.bat | 16 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/cleanup.c | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/create.c | 161 | ||||
-rw-r--r-- | Ext3Fsd/ddkbuild.bat | 1268 | ||||
-rw-r--r-- | Ext3Fsd/dispatch.c | 6 | ||||
-rw-r--r-- | Ext3Fsd/ea.c | 603 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/ext3/generic.c | 77 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/ext3/htree.c | 0 | ||||
-rw-r--r-- | Ext3Fsd/ext3fsd.dsp | 701 | ||||
-rw-r--r-- | Ext3Fsd/ext3fsd.dsw | 33 | ||||
-rwxr-xr-x | Ext3Fsd/ext3fsd.sln | 28 | ||||
-rw-r--r-- | Ext3Fsd/ext3fsd.vcproj | 693 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/ext4/MAKEFILE | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/ext4/SOURCES (renamed from Ext3Fsd/ext4/Sources) | 57 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/ext4/ext4_bh.c | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/ext4/ext4_extents.c | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/ext4/ext4_jbd2.c | 0 | ||||
-rw-r--r-- | Ext3Fsd/ext4/ext4_xattr.c | 1295 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/ext4/extents.c | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/fastio.c | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/fileinfo.c | 26 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/include/ext2fs.h | 36 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/include/linux/ext4.h | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/include/linux/ext4_ext.h | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/include/linux/ext4_jbd2.h | 0 | ||||
-rw-r--r-- | Ext3Fsd/include/linux/ext4_xattr.h | 205 | ||||
-rw-r--r-- | Ext3Fsd/include/linux/fs.h | 19 | ||||
-rwxr-xr-x | Ext3Fsd/include/linux/module.h | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/init.c | 3 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/linux.c | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/memory.c | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/notes.txt | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/read.c | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/readme.txt | 0 | ||||
-rw-r--r-- | Ext3Fsd/sys/SOURCES (renamed from Ext3Fsd/sys/sources) | 3 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/volinfo.c | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | Ext3Fsd/write.c | 0 |
43 files changed, 3385 insertions, 2795 deletions
diff --git a/Ext3Fsd/DIRS b/Ext3Fsd/DIRS deleted file mode 100644 index f31292f..0000000 --- a/Ext3Fsd/DIRS +++ /dev/null @@ -1 +0,0 @@ -DIRS = nls ext3 ext4 jbd sys diff --git a/Ext3Fsd/Ext3Fsd.inf b/Ext3Fsd/Ext3Fsd.inf new file mode 100644 index 0000000..7786ebb --- /dev/null +++ b/Ext3Fsd/Ext3Fsd.inf @@ -0,0 +1,90 @@ +;
+; Ext3Fsd.inf
+;
+
+[Version]
+Signature="$WINDOWS NT$"
+Class=Sample ; TODO: edit Class
+ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171} ; TODO: edit ClassGuid
+Provider=%ManufacturerName%
+CatalogFile=Ext3Fsd.cat
+DriverVer=; TODO: set DriverVer in stampinf property pages
+
+[DestinationDirs]
+DefaultDestDir = 12
+
+; ================= Class section =====================
+
+[ClassInstall32]
+Addreg=SampleClassReg
+
+[SampleClassReg]
+HKR,,,0,%ClassName%
+HKR,,Icon,,-5
+
+[SourceDisksNames]
+1 = %DiskName%,,,""
+
+[SourceDisksFiles]
+Ext3Fsd.sys = 1,,
+
+;*****************************************
+; Install Section
+;*****************************************
+
+[Manufacturer]
+%ManufacturerName%=Standard,NT$ARCH$
+
+[Standard.NT$ARCH$]
+%Ext3Fsd.DeviceDesc%=Ext3Fsd_Device, Root\Ext3Fsd ; TODO: edit hw-id
+
+[Ext3Fsd_Device.NT]
+CopyFiles=Drivers_Dir
+
+[Drivers_Dir]
+Ext3Fsd.sys
+
+;-------------- Service installation
+[Ext3Fsd_Device.NT.Services]
+AddService = Ext3Fsd,%SPSVCINST_ASSOCSERVICE%, Ext3Fsd_Service_Inst
+
+; -------------- Ext3Fsd driver install sections
+[Ext3Fsd_Service_Inst]
+DisplayName = %Ext3Fsd.SVCDESC%
+ServiceType = 1 ; SERVICE_KERNEL_DRIVER
+StartType = 3 ; SERVICE_DEMAND_START
+ErrorControl = 1 ; SERVICE_ERROR_NORMAL
+ServiceBinary = %12%\Ext3Fsd.sys
+
+;
+;--- Ext3Fsd_Device Coinstaller installation ------
+;
+
+[DestinationDirs]
+Ext3Fsd_Device_CoInstaller_CopyFiles = 11
+
+[Ext3Fsd_Device.NT.CoInstallers]
+AddReg=Ext3Fsd_Device_CoInstaller_AddReg
+CopyFiles=Ext3Fsd_Device_CoInstaller_CopyFiles
+
+[Ext3Fsd_Device_CoInstaller_AddReg]
+HKR,,CoInstallers32,0x00010000, "WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller"
+
+[Ext3Fsd_Device_CoInstaller_CopyFiles]
+WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll
+
+[SourceDisksFiles]
+WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with SourceDisksNames
+
+[Ext3Fsd_Device.NT.Wdf]
+KmdfService = Ext3Fsd, Ext3Fsd_wdfsect
+[Ext3Fsd_wdfsect]
+KmdfLibraryVersion = $KMDFVERSION$
+
+[Strings]
+SPSVCINST_ASSOCSERVICE= 0x00000002
+ManufacturerName="<Your manufacturer name>" ;TODO: Replace with your manufacturer name
+ClassName="Samples" ; TODO: edit ClassName
+DiskName = "Ext3Fsd Installation Disk"
+Ext3Fsd.DeviceDesc = "Ext3Fsd Device"
+Ext3Fsd.SVCDESC = "Ext3Fsd Service"
diff --git a/Ext3Fsd/Ext3Fsd.vcxproj b/Ext3Fsd/Ext3Fsd.vcxproj new file mode 100644 index 0000000..8efbbe6 --- /dev/null +++ b/Ext3Fsd/Ext3Fsd.vcxproj @@ -0,0 +1,399 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|ARM">
+ <Configuration>Debug</Configuration>
+ <Platform>ARM</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|ARM">
+ <Configuration>Release</Configuration>
+ <Platform>ARM</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|ARM64">
+ <Configuration>Debug</Configuration>
+ <Platform>ARM64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|ARM64">
+ <Configuration>Release</Configuration>
+ <Platform>ARM64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <Inf Include="Ext3Fsd.inf" />
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{4464AB83-2112-4BDC-9458-34942BC49748}</ProjectGuid>
+ <TemplateGuid>{497e31cb-056b-4f31-abb8-447fd55ee5a5}</TemplateGuid>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
+ <Configuration>Debug</Configuration>
+ <Platform Condition="'$(Platform)' == ''">Win32</Platform>
+ <RootNamespace>Ext3Fsd</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
+ <ConfigurationType>Driver</ConfigurationType>
+ <DriverType>KMDF</DriverType>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
+ <ConfigurationType>Driver</ConfigurationType>
+ <DriverType>KMDF</DriverType>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
+ <ConfigurationType>Driver</ConfigurationType>
+ <DriverType>KMDF</DriverType>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
+ <ConfigurationType>Driver</ConfigurationType>
+ <DriverType>KMDF</DriverType>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
+ <ConfigurationType>Driver</ConfigurationType>
+ <DriverType>KMDF</DriverType>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
+ <ConfigurationType>Driver</ConfigurationType>
+ <DriverType>KMDF</DriverType>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
+ <ConfigurationType>Driver</ConfigurationType>
+ <DriverType>KMDF</DriverType>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
+ <ConfigurationType>Driver</ConfigurationType>
+ <DriverType>KMDF</DriverType>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
+ <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
+ <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
+ <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+ <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
+ <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WppEnabled>true</WppEnabled>
+ <WppRecorderEnabled>true</WppRecorderEnabled>
+ <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
+ <WppKernelMode>true</WppKernelMode>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories);$(ProjectDir)\include</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>__KERNEL__;_X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <TreatWarningAsError>false</TreatWarningAsError>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WppEnabled>true</WppEnabled>
+ <WppRecorderEnabled>true</WppRecorderEnabled>
+ <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
+ <WppKernelMode>true</WppKernelMode>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories);$(ProjectDir)\include</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>__KERNEL__;_X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <TreatWarningAsError>false</TreatWarningAsError>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WppEnabled>false</WppEnabled>
+ <WppRecorderEnabled>true</WppRecorderEnabled>
+ <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
+ <WppKernelMode>true</WppKernelMode>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories);$(ProjectDir)\include</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>__KERNEL__;_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <TreatWarningAsError>false</TreatWarningAsError>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WppEnabled>true</WppEnabled>
+ <WppRecorderEnabled>true</WppRecorderEnabled>
+ <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
+ <WppKernelMode>true</WppKernelMode>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories);$(ProjectDir)\include</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>__KERNEL__;_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <TreatWarningAsError>false</TreatWarningAsError>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
+ <ClCompile>
+ <WppEnabled>true</WppEnabled>
+ <WppRecorderEnabled>true</WppRecorderEnabled>
+ <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
+ <WppKernelMode>true</WppKernelMode>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories);$(ProjectDir)\include</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>__KERNEL__;_ARM_;ARM;_USE_DECLSPECS_FOR_SAL=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <TreatWarningAsError>false</TreatWarningAsError>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
+ <ClCompile>
+ <WppEnabled>true</WppEnabled>
+ <WppRecorderEnabled>true</WppRecorderEnabled>
+ <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
+ <WppKernelMode>true</WppKernelMode>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories);$(ProjectDir)\include</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>__KERNEL__;_ARM_;ARM;_USE_DECLSPECS_FOR_SAL=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <TreatWarningAsError>false</TreatWarningAsError>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+ <ClCompile>
+ <WppEnabled>true</WppEnabled>
+ <WppRecorderEnabled>true</WppRecorderEnabled>
+ <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
+ <WppKernelMode>true</WppKernelMode>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories);$(ProjectDir)\include</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>__KERNEL__;_ARM64_;ARM64;_USE_DECLSPECS_FOR_SAL=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <TreatWarningAsError>false</TreatWarningAsError>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
+ <ClCompile>
+ <WppEnabled>true</WppEnabled>
+ <WppRecorderEnabled>true</WppRecorderEnabled>
+ <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
+ <WppKernelMode>true</WppKernelMode>
+ <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories);$(ProjectDir)\include</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>__KERNEL__;_ARM64_;ARM64;_USE_DECLSPECS_FOR_SAL=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <TreatWarningAsError>false</TreatWarningAsError>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <FilesToPackage Include="$(TargetPath)" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="Ext3fsd.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="access.c" />
+ <ClCompile Include="block.c" />
+ <ClCompile Include="cleanup.c" />
+ <ClCompile Include="close.c" />
+ <ClCompile Include="cmcb.c" />
+ <ClCompile Include="create.c" />
+ <ClCompile Include="debug.c" />
+ <ClCompile Include="devctl.c" />
+ <ClCompile Include="dirctl.c" />
+ <ClCompile Include="dispatch.c" />
+ <ClCompile Include="ea.c" />
+ <ClCompile Include="except.c" />
+ <ClCompile Include="ext3\generic.c" />
+ <ClCompile Include="ext3\htree.c" />
+ <ClCompile Include="ext3\indirect.c" />
+ <ClCompile Include="ext3\recover.c" />
+ <ClCompile Include="ext4\ext4_bh.c" />
+ <ClCompile Include="ext4\ext4_extents.c" />
+ <ClCompile Include="ext4\ext4_jbd2.c" />
+ <ClCompile Include="ext4\ext4_xattr.c" />
+ <ClCompile Include="ext4\extents.c" />
+ <ClCompile Include="fastio.c" />
+ <ClCompile Include="fileinfo.c" />
+ <ClCompile Include="flush.c" />
+ <ClCompile Include="fsctl.c" />
+ <ClCompile Include="init.c" />
+ <ClCompile Include="jbd\recovery.c" />
+ <ClCompile Include="jbd\replay.c" />
+ <ClCompile Include="jbd\revoke.c" />
+ <ClCompile Include="linux.c" />
+ <ClCompile Include="lock.c" />
+ <ClCompile Include="memory.c" />
+ <ClCompile Include="misc.c" />
+ <ClCompile Include="nls.c" />
+ <ClCompile Include="nls\nls_ascii.c" />
+ <ClCompile Include="nls\nls_base.c" />
+ <ClCompile Include="nls\nls_cp1250.c" />
+ <ClCompile Include="nls\nls_cp1251.c" />
+ <ClCompile Include="nls\nls_cp1255.c" />
+ <ClCompile Include="nls\nls_cp437.c" />
+ <ClCompile Include="nls\nls_cp737.c" />
+ <ClCompile Include="nls\nls_cp775.c" />
+ <ClCompile Include="nls\nls_cp850.c" />
+ <ClCompile Include="nls\nls_cp852.c" />
+ <ClCompile Include="nls\nls_cp855.c" />
+ <ClCompile Include="nls\nls_cp857.c" />
+ <ClCompile Include="nls\nls_cp860.c" />
+ <ClCompile Include="nls\nls_cp861.c" />
+ <ClCompile Include="nls\nls_cp862.c" />
+ <ClCompile Include="nls\nls_cp863.c" />
+ <ClCompile Include="nls\nls_cp864.c" />
+ <ClCompile Include="nls\nls_cp865.c" />
+ <ClCompile Include="nls\nls_cp866.c" />
+ <ClCompile Include="nls\nls_cp869.c" />
+ <ClCompile Include="nls\nls_cp874.c" />
+ <ClCompile Include="nls\nls_cp932.c" />
+ <ClCompile Include="nls\nls_cp936.c" />
+ <ClCompile Include="nls\nls_cp949.c" />
+ <ClCompile Include="nls\nls_cp950.c" />
+ <ClCompile Include="nls\nls_euc-jp.c" />
+ <ClCompile Include="nls\nls_iso8859-1.c" />
+ <ClCompile Include="nls\nls_iso8859-13.c" />
+ <ClCompile Include="nls\nls_iso8859-14.c" />
+ <ClCompile Include="nls\nls_iso8859-15.c" />
+ <ClCompile Include="nls\nls_iso8859-2.c" />
+ <ClCompile Include="nls\nls_iso8859-3.c" />
+ <ClCompile Include="nls\nls_iso8859-4.c" />
+ <ClCompile Include="nls\nls_iso8859-5.c" />
+ <ClCompile Include="nls\nls_iso8859-6.c" />
+ <ClCompile Include="nls\nls_iso8859-7.c" />
+ <ClCompile Include="nls\nls_iso8859-9.c" />
+ <ClCompile Include="nls\nls_koi8-r.c" />
+ <ClCompile Include="nls\nls_koi8-ru.c" />
+ <ClCompile Include="nls\nls_koi8-u.c" />
+ <ClCompile Include="nls\nls_utf8.c" />
+ <ClCompile Include="pnp.c" />
+ <ClCompile Include="rbtree.c" />
+ <ClCompile Include="read.c" />
+ <ClCompile Include="shutdown.c" />
+ <ClCompile Include="volinfo.c" />
+ <ClCompile Include="write.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="include\asm\page.h" />
+ <ClInclude Include="include\asm\semaphore.h" />
+ <ClInclude Include="include\asm\uaccess.h" />
+ <ClInclude Include="include\common.h" />
+ <ClInclude Include="include\ext2fs.h" />
+ <ClInclude Include="include\linux\atomic.h" />
+ <ClInclude Include="include\linux\bitops.h" />
+ <ClInclude Include="include\linux\bit_spinlock.h" />
+ <ClInclude Include="include\linux\buffer_head.h" />
+ <ClInclude Include="include\linux\config.h" />
+ <ClInclude Include="include\linux\debugfs.h" />
+ <ClInclude Include="include\linux\errno.h" />
+ <ClInclude Include="include\linux\Ext2_fs.h" />
+ <ClInclude Include="include\linux\ext3_fs.h" />
+ <ClInclude Include="include\linux\ext3_fs_i.h" />
+ <ClInclude Include="include\linux\ext3_fs_sb.h" />
+ <ClInclude Include="include\linux\ext3_jbd.h" />
+ <ClInclude Include="include\linux\ext4.h" />
+ <ClInclude Include="include\linux\ext4_ext.h" />
+ <ClInclude Include="include\linux\ext4_jbd2.h" />
+ <ClInclude Include="include\linux\ext4_xattr.h" />
+ <ClInclude Include="include\linux\freezer.h" />
+ <ClInclude Include="include\linux\fs.h" />
+ <ClInclude Include="include\linux\group.h" />
+ <ClInclude Include="include\linux\highmem.h" />
+ <ClInclude Include="include\linux\init.h" />
+ <ClInclude Include="include\linux\jbd.h" />
+ <ClInclude Include="include\linux\journal-head.h" />
+ <ClInclude Include="include\linux\kernel.h" />
+ <ClInclude Include="include\linux\kthread.h" />
+ <ClInclude Include="include\linux\list.h" />
+ <ClInclude Include="include\linux\lockdep.h" />
+ <ClInclude Include="include\linux\log2.h" />
+ <ClInclude Include="include\linux\magic.h" />
+ <ClInclude Include="include\linux\mm.h" />
+ <ClInclude Include="include\linux\module.h" />
+ <ClInclude Include="include\linux\mutex.h" />
+ <ClInclude Include="include\linux\nls.h" />
+ <ClInclude Include="include\linux\pagemap.h" />
+ <ClInclude Include="include\linux\poison.h" />
+ <ClInclude Include="include\linux\proc_fs.h" />
+ <ClInclude Include="include\linux\rbtree.h" />
+ <ClInclude Include="include\linux\sched.h" />
+ <ClInclude Include="include\linux\slab.h" />
+ <ClInclude Include="include\linux\spinlock.h" />
+ <ClInclude Include="include\linux\stddef.h" />
+ <ClInclude Include="include\linux\string.h" />
+ <ClInclude Include="include\linux\time.h" />
+ <ClInclude Include="include\linux\timer.h" />
+ <ClInclude Include="include\linux\tree.h" />
+ <ClInclude Include="include\linux\types.h" />
+ <ClInclude Include="include\linux\version.h" />
+ <ClInclude Include="include\ntifs.gnu.h" />
+ <ClInclude Include="include\resource.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <Text Include="COPYRIGHT.TXT" />
+ <Text Include="FAQ.txt" />
+ <Text Include="notes.txt" />
+ <Text Include="TODO.txt" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/Ext3Fsd/Ext3Fsd.vcxproj.filters b/Ext3Fsd/Ext3Fsd.vcxproj.filters new file mode 100644 index 0000000..f3330cc --- /dev/null +++ b/Ext3Fsd/Ext3Fsd.vcxproj.filters @@ -0,0 +1,449 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ <Filter Include="Driver Files">
+ <UniqueIdentifier>{8E41214B-6785-4CFE-B992-037D68949A14}</UniqueIdentifier>
+ <Extensions>inf;inv;inx;mof;mc;</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <Inf Include="Ext3Fsd.inf">
+ <Filter>Driver Files</Filter>
+ </Inf>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="Ext3fsd.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="ext3\generic.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ext3\htree.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ext3\indirect.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ext3\recover.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ext4\ext4_bh.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ext4\ext4_extents.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ext4\ext4_jbd2.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ext4\extents.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_ascii.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_base.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp437.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp737.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp775.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp850.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp852.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp855.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp857.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp860.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp861.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp862.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp863.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp864.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp865.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp866.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp869.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp874.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp932.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp936.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp949.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp950.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp1250.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp1251.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_cp1255.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_euc-jp.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_iso8859-1.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_iso8859-2.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_iso8859-3.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_iso8859-4.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_iso8859-5.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_iso8859-6.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_iso8859-7.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_iso8859-9.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_iso8859-13.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_iso8859-14.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_iso8859-15.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_koi8-r.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_koi8-ru.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_koi8-u.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls\nls_utf8.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="jbd\recovery.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="jbd\replay.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="jbd\revoke.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="block.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="access.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="close.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cmcb.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="cleanup.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="create.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="debug.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dispatch.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="except.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="dirctl.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="devctl.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="fastio.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="linux.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="memory.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="fileinfo.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="flush.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="fsctl.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="init.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="lock.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="nls.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="rbtree.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="read.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="pnp.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="misc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="shutdown.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="volinfo.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="write.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ext4\ext4_xattr.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ea.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="include\asm\page.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\asm\semaphore.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\asm\uaccess.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\atomic.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\bit_spinlock.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\bitops.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\buffer_head.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\config.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\debugfs.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\errno.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\Ext2_fs.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\ext3_fs.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\ext3_fs_i.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\ext3_fs_sb.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\ext3_jbd.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\ext4.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\ext4_ext.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\ext4_jbd2.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\freezer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\fs.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\group.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\highmem.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\init.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\jbd.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\journal-head.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\kernel.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\kthread.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\lockdep.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\log2.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\magic.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\mm.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\module.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\mutex.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\nls.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\pagemap.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\poison.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\proc_fs.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\rbtree.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\sched.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\slab.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\spinlock.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\stddef.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\string.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\time.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\timer.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\types.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\version.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\common.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\ext2fs.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\ntifs.gnu.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\ext4_xattr.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\linux\tree.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Text Include="COPYRIGHT.TXT" />
+ <Text Include="FAQ.txt" />
+ <Text Include="notes.txt" />
+ <Text Include="TODO.txt" />
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/Ext3Fsd/Ext3Fsd.vcxproj.user b/Ext3Fsd/Ext3Fsd.vcxproj.user new file mode 100644 index 0000000..fc8dae5 --- /dev/null +++ b/Ext3Fsd/Ext3Fsd.vcxproj.user @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ShowAllFiles>false</ShowAllFiles>
+ </PropertyGroup>
+</Project>
\ No newline at end of file diff --git a/Ext3Fsd/block.c b/Ext3Fsd/block.c index b5666a6..b5666a6 100755..100644 --- a/Ext3Fsd/block.c +++ b/Ext3Fsd/block.c diff --git a/Ext3Fsd/clean.bat b/Ext3Fsd/clean.bat deleted file mode 100644 index f44dc6d..0000000 --- a/Ext3Fsd/clean.bat +++ /dev/null @@ -1,16 +0,0 @@ -del /s *.log
-del /s *.wrn
-del /s *.err
-del /s *.obj
-del /s *.sbr
-del /s *.sys
-del /s *.exp
-del /s *.idb
-del /s *.ilk
-del /s BuildLog.htm
-del /s *.mac
-REM to avoid pthreads lib deletion
-del /s *.lib
-del /s *.pdb
-c:\cygwin\bin\find . -name objchk* -exec rm -rf {} +
-c:\cygwin\bin\find . -name objfre* -exec rm -rf {} +
diff --git a/Ext3Fsd/cleanup.c b/Ext3Fsd/cleanup.c index 1d49d58..1d49d58 100755..100644 --- a/Ext3Fsd/cleanup.c +++ b/Ext3Fsd/cleanup.c diff --git a/Ext3Fsd/create.c b/Ext3Fsd/create.c index 752be64..67ecd19 100755..100644 --- a/Ext3Fsd/create.c +++ b/Ext3Fsd/create.c @@ -10,6 +10,7 @@ /* INCLUDES *****************************************************************/ #include "ext2fs.h" +#include <linux/ext4_xattr.h> /* GLOBALS *****************************************************************/ @@ -671,6 +672,154 @@ errorout: return Ext2WinntError(rc); } +// +// Any call to this routine must have Fcb's MainResource and FcbLock acquired. +// + +NTSTATUS +Ext2OverwriteEa( + PEXT2_IRP_CONTEXT IrpContext, + PEXT2_VCB Vcb, + PEXT2_FCB Fcb, + PIO_STATUS_BLOCK Iosb +) +{ + PEXT2_MCB Mcb = NULL; + PIRP Irp; + PIO_STACK_LOCATION IrpSp; + + struct ext4_xattr_ref xattr_ref; + BOOLEAN XattrRefAcquired = FALSE; + NTSTATUS Status = STATUS_UNSUCCESSFUL; + + PFILE_FULL_EA_INFORMATION FullEa; + PCHAR EaBuffer; + ULONG EaBufferLength; + + __try { + + Irp = IrpContext->Irp; + IrpSp = IoGetCurrentIrpStackLocation(Irp); + Mcb = Fcb->Mcb; + + EaBuffer = Irp->AssociatedIrp.SystemBuffer; + EaBufferLength = IrpSp->Parameters.Create.EaLength; + + if (!Mcb) + __leave; + + // + // Return peacefully if there is no EaBuffer provided. + // + if (!EaBuffer) { + Status = STATUS_SUCCESS; + __leave; + } + + // + // If the caller specifies an EaBuffer, but has no knowledge about Ea, + // we reject the request. + // + if (EaBuffer != NULL && + FlagOn(IrpSp->Parameters.Create.Options, FILE_NO_EA_KNOWLEDGE)) { + Status = STATUS_ACCESS_DENIED; + __leave; + } + + // + // Check Ea Buffer validity. + // + Status = IoCheckEaBufferValidity(EaBuffer, EaBufferLength, &Iosb->Information); + if (!NT_SUCCESS(Status)) + __leave; + + Status = Ext2WinntError(ext4_fs_get_xattr_ref(IrpContext, Vcb, Fcb->Mcb, &xattr_ref)); + if (!NT_SUCCESS(Status)) { + DbgPrint("ext4_fs_get_xattr_ref() failed!\n"); + __leave; + } + + XattrRefAcquired = TRUE; + + // + // Remove all existing EA entries. + // + ext4_xattr_purge_items(&xattr_ref); + xattr_ref.dirty = TRUE; + Status = STATUS_SUCCESS; + + // Iterate the whole EA buffer to do inspection + for (FullEa = (PFILE_FULL_EA_INFORMATION)EaBuffer; + FullEa < (PFILE_FULL_EA_INFORMATION)&EaBuffer[EaBufferLength]; + FullEa = (PFILE_FULL_EA_INFORMATION)(FullEa->NextEntryOffset == 0 ? + &EaBuffer[EaBufferLength] : + (PCHAR)FullEa + FullEa->NextEntryOffset)) { + + OEM_STRING EaName; + + EaName.MaximumLength = EaName.Length = FullEa->EaNameLength; + EaName.Buffer = &FullEa->EaName[0]; + + // Check if EA's name is valid + if (!Ext2IsEaNameValid(EaName)) { + Status = STATUS_INVALID_EA_NAME; + __leave; + } + } + + // Now add EA entries to the inode + for (FullEa = (PFILE_FULL_EA_INFORMATION)EaBuffer; + FullEa < (PFILE_FULL_EA_INFORMATION)&EaBuffer[EaBufferLength]; + FullEa = (PFILE_FULL_EA_INFORMATION)(FullEa->NextEntryOffset == 0 ? + &EaBuffer[EaBufferLength] : + (PCHAR)FullEa + FullEa->NextEntryOffset)) { + + int ret; + OEM_STRING EaName; + + EaName.MaximumLength = EaName.Length = FullEa->EaNameLength; + EaName.Buffer = &FullEa->EaName[0]; + + Status = Ext2WinntError(ret = + ext4_fs_set_xattr(&xattr_ref, + EXT4_XATTR_INDEX_USER, + EaName.Buffer, + EaName.Length, + &FullEa->EaName[0] + FullEa->EaNameLength + 1, + FullEa->EaValueLength, + TRUE)); + if (!NT_SUCCESS(Status) && ret != -ENODATA) + __leave; + + if (ret == -ENODATA) { + Status = Ext2WinntError( + ext4_fs_set_xattr(&xattr_ref, + EXT4_XATTR_INDEX_USER, + EaName.Buffer, + EaName.Length, + &FullEa->EaName[0] + FullEa->EaNameLength + 1, + FullEa->EaValueLength, + FALSE)); + if (!NT_SUCCESS(Status)) + __leave; + + } + } + } + __finally { + + if (XattrRefAcquired) { + if (!NT_SUCCESS(Status)) { + xattr_ref.dirty = FALSE; + ext4_fs_put_xattr_ref(&xattr_ref); + } else { + Status = Ext2WinntError(ext4_fs_put_xattr_ref(&xattr_ref)); + } + } + } + return Status; +} + NTSTATUS Ext2CreateFile( PEXT2_IRP_CONTEXT IrpContext, @@ -1294,6 +1443,12 @@ Openit: // This file is just created. // + Status = Ext2OverwriteEa(IrpContext, Vcb, Fcb, &Irp->IoStatus); + if (!NT_SUCCESS(Status)) { + Ext2DeleteFile(IrpContext, Vcb, Fcb, Mcb); + __leave; + } + if (DirectoryFile) { Status = Ext2AddDotEntries(IrpContext, &ParentMcb->Inode, &Mcb->Inode); @@ -1888,6 +2043,7 @@ Ext2CreateInode( ULONG iNo; struct inode Inode = { 0 }; struct dentry *Dentry = NULL; + struct ext3_super_block *es = EXT3_SB(&Vcb->sb)->s_es; LARGE_INTEGER SysTime; @@ -1927,6 +2083,8 @@ Ext2CreateInode( } else { DbgBreak(); } + if (le16_to_cpu(es->s_want_extra_isize)) + Inode.i_extra_isize = le16_to_cpu(es->s_want_extra_isize); /* Force using extent */ if (IsFlagOn(SUPER_BLOCK->s_feature_incompat, EXT4_FEATURE_INCOMPAT_EXTENTS)) { @@ -2022,5 +2180,6 @@ Ext2SupersedeOrOverWriteFile( Fcb->Inode->i_mtime = Ext2LinuxTime(CurrentTime); Ext2SaveInode(IrpContext, Vcb, Fcb->Inode); - return STATUS_SUCCESS; + // See if we need to overwrite EA of the file + return Ext2OverwriteEa(IrpContext, Vcb, Fcb, &IrpContext->Irp->IoStatus); } diff --git a/Ext3Fsd/ddkbuild.bat b/Ext3Fsd/ddkbuild.bat deleted file mode 100644 index 50f1d9d..0000000 --- a/Ext3Fsd/ddkbuild.bat +++ /dev/null @@ -1,1268 +0,0 @@ -@echo off
-@set VERSION=V7.4
-@set OSR_DEBUG=off
-
-set W7BASE=C:\WINDDK\7600.16385.1
-
-@if "%OS%"=="Windows_NT" goto :Prerequisites
-@echo This script requires Windows NT 4.0 or later to run properly!
-goto :EOF
-:Prerequisites
-:: Check whether FINDSTR is available. It's used to show warnings etc.
-findstr /? > NUL 2>&1 || echo "FINDSTR is a prerequisite but wasn't found!" && goto :EOF
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-::
-:: $Id: ddkbuild.cmd 43 2009-11-12 03:46:08Z oliver $
-::
-:: This software is supplied for instructional purposes only.
-::
-:: OSR Open Systems Resources, Inc. (OSR) expressly disclaims any warranty
-:: for this software. THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY
-:: OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION,
-:: THE IMPLIED WARRANTIES OF MECHANTABILITY OR FITNESS FOR A PARTICULAR
-:: PURPOSE. THE ENTIRE RISK ARISING FROM THE USE OF THIS SOFTWARE REMAINS
-:: WITH YOU. OSR's entire liability and your exclusive remedy shall not
-:: exceed the price paid for this material. In no event shall OSR or its
-:: suppliers be liable for any damages whatsoever (including, without
-:: limitation, damages for loss of business profit, business interruption,
-:: loss of business information, or any other pecuniary loss) arising out
-:: of the use or inability to use this software, even if OSR has been
-:: advised of the possibility of such damages. Because some states/
-:: jurisdictions do not allow the exclusion or limitation of liability for
-:: consequential or incidental damages, the above limitation may not apply
-:: to you.
-::
-:: OSR Open Systems Resources, Inc.
-:: 105 Route 101A Suite 19
-:: Amherst, NH 03031 (603) 595-6500 FAX: (603) 595-6503
-:: report bugs to <bugs@osr.com>
-:: alternatively report them via <http://assarbad.net/contact/>
-::
-::
-:: MODULE:
-::
-:: ddkbuild.cmd
-::
-:: ABSTRACT:
-::
-:: This script allows drivers to be built with Visual Studio 2002 through
-:: Visual Studio 2008 and possibly future versions. It will also work fine
-:: from the command line.
-:: If you are interested in a project wizard that makes use of this script,
-:: try DDKWizard from <http://ddkwizard.assarbad.net>.
-::
-:: AUTHOR(S):
-::
-:: - OSR Open Systems Resources, Inc.
-:: - Oliver Schneider (ddkwizard.assarbad.net)
-::
-:: REQUIREMENTS:
-::
-:: Environment variables that must be set.
-:: %NT4BASE% - Set this up for "-NT4" builds (legacy, support not tested)
-:: %W2KBASE% - Set this up for "-W2K*" builds (legacy, support not tested)
-:: %WXPBASE% - Set this up for "-WXP*" builds
-:: %WNETBASE% - Set this up for "-WNET*" builds
-:: %WLHBASE% - Set this up for "-WLH*" builds
-:: %W7BASE% - Set this up for "-W7*" builds
-:: %WDF_ROOT% - Must be set if attempting to do a WDF Build.
-::
-:: Examples:
-:: NT4BASE : could be "D:\NT4DDK"
-:: W2KBASE : could be "D:\Nt50DDK"
-:: WXPBASE : could be "D:\WINDDK\2600"
-:: WNETBASE: could be "D:\WINDDK\3790.1830" or "C:\WINDDK\3790"
-:: W7BASE : could be "C:\WINDDK\7600.16385.0"
-::
-:: COMMAND FORMAT:
-::
-:: Run the script without any parameters to get the whole help content!
-:: Note: "-WDF" has been tested with the 01.00.5054 version of the framework
-::
-:: RETURN CODES AND THEIR MEANING:
-::
-:: 001 == Unknown type of build. Please recheck parameters.
-:: 002 == WDF_ROOT is not defined, are you using 00.01.5054 or later?
-:: 003 == To build using type <target> you need to set the <basedir>
-:: environment variable to point to the <basediros> DDK base
-:: directory!
-:: 004 == NT4BASE, W2KBASE, WXPBASE, WNETBASE and/or W7BASE environment
-:: variable(s) not set. Environment variable(s) must be set by user
-:: according to DDK version(s) installed.
-:: 005 == <build type> must be 'checked', 'free', 'chk' or 'fre'
-:: (case-insensitive).
-:: 006 == No DIR or SOURCES file found in the given target directory.
-:: 007 == Target directory must have a SOURCES+MAKEFILE or DIRS file.
-:: 008 == The <directory> parameter must be a valid directory.
-:: 009 == The SETENV script failed.
-::
-:: Note: If %OSR_ERRCODE% and %ERRORLEVEL% are equal, the return code stems
-:: from one of the tools being called during the build process.
-::
-:: BROWSE FILES:
-::
-:: This procedure supports the building of BROWSE files to be used by
-:: Visual Studio 6 and by Visual Studio.NET However, the BSCfiles created
-:: by bscmake for the two are not compatible. When this command procedure
-:: runs, it selects the first bscmake.exe found in the path. So, make sure
-:: that the correct bscmake.exe is in the path ...
-::
-:: Note that if using Visual Studio.NET the .BSC must be added to the project
-:: in order for the project to be browsed.
-:: Another alternative is the VS addon named "Visual Assist X" which will
-:: parse the header files - no more need for browse files.
-::
-:: COMPILERS:
-::
-:: If you are building NT4 you should really be using the VC6 compiler.
-:: Later versions of the DDK now contain the compiler and the linker. This
-:: procedure should use the correct compiler.
-::
-:: GENERAL COMMENTS:
-::
-:: This procedure has been cleaned up to be modular and easy to understand.
-::
-:: As of the Server 2003 SP1 DDK DDKBUILD now clears the NO_BROWSE_FILE and
-:: NO_BINPLACE environment variables so that users can use these features.
-::
-:: Starting with the Vista WDK, the output in the respective tool window
-:: in VS is in Unicode by default. This garbles the output from DDKBUILD
-:: and we therefore clear the environment variable VS_UNICODE_OUTPUT.
-::
-:: To modify the default behavior of this script with the newest WDKs,
-:: set the variable SETTING_OACR in the ddkbldenv.cmd hook script to turn
-:: OACR back on (NB: no OACR tools exist for Itanium in the WDK).
-::
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: / MAIN function of the script
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:MAIN
-:: Building "stack frame"
-setlocal ENABLEEXTENSIONS & pushd .
-:: Check whether the REG utility is available
-reg /? > NUL 2>&1 && set OSR_REGAVAILABLE=1
-
-:: This is set by client-side keyword substitution
-set SVN_REVISION=$Revision: 43 $
-:: Extract the revision number from the revision keyword
-set SVN_REVISION=%SVN_REVISION:~0,-2%
-set SVN_REVISION=%SVN_REVISION:~11%
-:: This is set by client-side keyword substitution
-set SVN_REVDATE=$Date: 2009-11-12 03:46:08 +0000 (Thu, 12 Nov 2009) $
-:: Extract the date from the Date keyword
-set SVN_REVDATE=%SVN_REVDATE:~7,10%
-set VERSION=%VERSION%/r%SVN_REVISION%
-
-:: Init some special variables
-set OSR_VERSTR=OSR DDKBUILD.CMD %VERSION% (%SVN_REVDATE%) - OSR, Open Systems Resources, Inc.
-set OSR_PREBUILD_SCRIPT=ddkprebld.cmd
-set OSR_POSTBUILD_SCRIPT=ddkpostbld.cmd
-set OSR_SETENV_SCRIPT=ddkbldenv.cmd
-set OSR_ECHO=@echo DDKBLD:
-set OSR_RANDEXT=%RANDOM%%RANDOM%
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: Set error messages
-:: Possible codes: 1
-set ERR_UnknownBuildType=Unknown type of build. Please recheck parameters.
-:: Possible codes: 2
-set ERR_NoWdfRoot=WDF_ROOT is not defined, are you using 00.01.5054 or later?
-:: Possible codes: 3
-set ERR_BaseDirNotSet=To build using type %%OSR_TARGET%% you need to set the %%%%%%BASEDIRVAR%%%%%% environment variable to point to the %%BASEDIROS%% DDK base directory!
-:: Possible codes: 4
-set ERR_NoBASEDIR=NT4BASE, W2KBASE, WXPBASE, WNETBASE and/or W7BASE environment variable(s) not set. Environment variable(s) must be set by user according to DDK version(s) installed.
-:: Possible codes: 5
-set ERR_BadMode=^<build type^> must be 'checked', 'free', 'chk' or 'fre' (case-insensitive).
-:: Possible codes: 6
-set ERR_NoTarget=Target directory must have a SOURCES+MAKEFILE or DIRS file.
-:: Possible codes: 7, 8
-set ERR_NoDir=The ^<directory^> parameter must be a valid directory.
-:: Possible codes: 9
-set ERR_SetEnvFailed=The SETENV script failed.
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: Clear the error code variable
-set OSR_ERRCODE=0
-set PREFAST_BUILD=0
-
-:: Turn on tracing, use %OSR_TRACE% instead of ECHO
-if /i "%OSR_DEBUG%" == "on" (set OSR_TRACE=%OSR_ECHO% [TRACE]) else (set OSR_TRACE=rem)
-:: Turn on echoing of current line if %OSR_DEBUG% is set to "on"
-@echo %OSR_DEBUG%
-
-:: Output version string
-@echo %OSR_VERSTR%
-%OSR_TRACE% ^(Current module: ^"%~f0^"^)
-@echo.
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: Set the target platform variable
-set OSR_TARGET=%~1
-:: Remove any dashes in the variable
-if not "%OSR_TARGET%" == "" set OSR_TARGET=%OSR_TARGET:-=%
-:: Show help if the target parameter is empty after removal of the dashes
-if "%OSR_TARGET%" == "" goto :USAGE
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: In the build directory check for this script and call it if it exists.
-:: This allows to override any global system variable setting, if desired.
-if not "%3" == "" call :GetCustomEnvironment "%~f3"
-if not "%OSR_ERRCODE%" == "0" goto :USAGE
-:: Additional error handling for better usability
-:: These subroutines will also attempt to locate the requested DDK!!!
-set OSR_ERRCODE=3
-%OSR_TRACE% Checking whether the environment variable for the build type was set
-:: Calling as a subroutine has 2 advantages:
-:: 1. the script does not quit if the label was not found
-:: 2. we return to the line after the call and can check variables there
-call :%OSR_TARGET%Check > NUL 2>&1
-:: If the BASEDIROS/BASEDIRVAR variable is not defined, it means the subroutine did not exist!
-if not DEFINED BASEDIROS call :ShowErrorMsg 1 "%ERR_UnknownBuildType% (BASEDIROS)" & goto :USAGE
-if not DEFINED BASEDIRVAR call :ShowErrorMsg 1 "%ERR_UnknownBuildType% (BASEDIRVAR)" & goto :USAGE
-if not "%OSR_ERRCODE%" == "0" call :ShowErrorMsg %OSR_ERRCODE% "%ERR_BaseDirNotSet%" & goto :USAGE
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-set BASEDIR=%%%BASEDIRVAR%%%
-call :ResolveVar BASEDIR
-call :MakeShort BASEDIR "%BASEDIR%"
-:: Check for existing %BASEDIR%
-if "%BASEDIR%" == "" call :ShowErrorMsg 4 "%ERR_NoBASEDIR%" & goto :USAGE
-set PATH=%BASEDIR%\bin;%PATH%
-%OSR_TRACE% Now jump to the initialization of the commandline
-:: Calling as a subroutine has 2 advantages:
-:: 1. the script does not quit if the label was not found
-:: 2. we return to the line after the call and can check variables there
-call :%OSR_TARGET%Build
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-%OSR_TRACE% We returned from the variable initialization
-if not DEFINED OSR_CMDLINE call :ShowErrorMsg 1 "%ERR_UnknownBuildType% (OSR_CMDLINE)" & goto :USAGE
-
-%OSR_TRACE% Hurrah, all the variables have been initialized, continuing
-:: Proceed with common build steps
-goto :CommonBuild
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: Check whether the parameter makes sense and try to
-:: correct it if possible
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: These labels are for compatibility with the respective
-:: modes supported by another flavor of DDKBUILD.
-:WIN7Check
-:WIN764Check
-:WIN7A64Check
-:WIN7WLHCheck
-:WIN7WLH64Check
-:WIN7WLHA64Check
-:WIN7NETCheck
-:WIN7NET64Check
-:WIN7NETA64Check
-:WIN7XPCheck
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:W7Check
-:W7I64Check
-:W7X64Check
-:W7LHCheck
-:W7LHI64Check
-:W7LHX64Check
-:W7NETCheck
-:W7NETI64Check
-:W7NETX64Check
-:W7XPCheck
-set BASEDIROS=Windows 7/Windows 2008 Server R2
-set BASEDIRVAR=W7BASE
-:: The default for OACR is off ("no_oacr" appended)
-if not DEFINED SETTING_OACR set SETTING_OACR=no_oacr
-:: The default for "separate_object_root" is to not pass it to setenv.bat
-if not DEFINED SETTING_SEP_OBJ_ROOT set SETTING_SEPARATE_OBJ_ROOT=
-:: Other flavor of DDKBUILD
-if not DEFINED W7BASE if DEFINED WIN7BASE set BASEDIRVAR=WIN7BASE
-:: Compatibility between BUILD and VS ... prevent pipes from being used
-%OSR_ECHO% Clearing %%VS_UNICODE_OUTPUT%% ...
-set VS_UNICODE_OUTPUT=
-:: Return to caller if the BASEDIR is already defined (either customized or global)
-if DEFINED %BASEDIRVAR% goto :CommonCheckNoErrorWithReturn
-call :DetectBaseDirTemp "7600.16385.0"
-if DEFINED BASEDIRTEMP if exist "%BASEDIRTEMP%" goto :CommonCheckSetVarWithReturn
-goto :CommonCheckErrorNotSupportedWithReturn
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: These labels are for compatibility with the respective
-:: modes supported by another flavor of DDKBUILD.
-:WLH64Check
-:WLHA64Check
-:WLHXP64Check
-:WLHNET64Check
-:WLHNETA64Check
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:WLHCheck
-:WLHX64Check
-:WLHI64Check
-:WLHNETX64Check
-:WLHNETI64Check
-:WLHXPCheck
-:WLH2KCheck
-:WLHNETCheck
-set BASEDIROS=Windows Vista/Windows 2008 Server
-set BASEDIRVAR=WLHBASE
-:: Compatibility between BUILD and VS ... prevent pipes from being used
-%OSR_ECHO% Clearing %%VS_UNICODE_OUTPUT%% ...
-set VS_UNICODE_OUTPUT=
-:: Return to caller if the BASEDIR is already defined (either customized or global)
-if DEFINED %BASEDIRVAR% goto :CommonCheckNoErrorWithReturn
-call :DetectBaseDirTemp "6001.18002 6001.18001 6001.18000 6000"
-if DEFINED BASEDIRTEMP if exist "%BASEDIRTEMP%" goto :CommonCheckSetVarWithReturn
-goto :CommonCheckErrorNotSupportedWithReturn
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: These labels are for compatibility with the respective
-:: modes supported by another flavor of DDKBUILD.
-:WNETW2KCheck
-:WNETA64Check
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:WNET2KCheck
-:WNETXPCheck
-:WNETXP64Check
-:WNET64Check
-:WNETI64Check
-:WNETAMD64Check
-:WNETX64Check
-:WNETCheck
-set BASEDIROS=Windows 2003 Server
-set BASEDIRVAR=WNETBASE
-:: Return to caller if the BASEDIR is already defined (either customized or global)
-if DEFINED %BASEDIRVAR% goto :CommonCheckNoErrorWithReturn
-call :DetectBaseDirTemp "3790.1830 3790.1218 3790"
-if DEFINED BASEDIRTEMP if exist "%BASEDIRTEMP%" goto :CommonCheckSetVarWithReturn
-goto :CommonCheckErrorNotDetectedWithReturn
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: These labels are for compatibility with the respective
-:: modes supported by another flavor of DDKBUILD.
-:XPCheck
-:XP64Check
-:XPW2KCheck
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:WXP64Check
-:WXPI64Check
-:WXPCheck
-:WXP2KCheck
-set BASEDIROS=Windows XP
-set BASEDIRVAR=WXPBASE
-:: Other flavor of DDKBUILD
-if not DEFINED WXPBASE if DEFINED XPBASE set BASEDIRVAR=XPBASE
-:: Return to caller if the BASEDIR is already defined (either customized or global)
-if DEFINED %BASEDIRVAR% goto :CommonCheckNoErrorWithReturn
-call :DetectBaseDirTemp "2600.1106 2600"
-if DEFINED BASEDIRTEMP if exist "%BASEDIRTEMP%" goto :CommonCheckSetVarWithReturn
-goto :CommonCheckErrorNotDetectedWithReturn
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:W2K64Check
-:W2KI64Check
-:W2KCheck
-set BASEDIROS=Windows 2000
-set BASEDIRVAR=W2KBASE
-:: Return to caller
-if DEFINED %BASEDIRVAR% goto :CommonCheckNoErrorWithReturn
-call :CommonCheckMsg2
-goto :CommonCheckErrorNotSupportedWithReturn
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:NT4Check
-set BASEDIROS=Windows NT4
-set BASEDIRVAR=NT4BASE
-:: Return to caller
-if DEFINED %BASEDIRVAR% goto :CommonCheckNoErrorWithReturn
-call :CommonCheckMsg2
-goto :CommonCheckErrorNotSupportedWithReturn
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:CommonCheckMsg1
-echo.
-%OSR_ECHO% WARNING: %%%BASEDIRVAR%%% NOT SET!
-%OSR_ECHO% Attempting to auto-detect the installation folder and set %%%BASEDIRVAR%%%.
-%OSR_ECHO% (If this fails *you* will have to set it!)
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:CommonCheckMsg2
-echo.
-%OSR_ECHO% WARNING:
-%OSR_ECHO% Auto-detection of the folder settings is not supported for the requested DDK.
-%OSR_ECHO% Please set %%%BASEDIRVAR%%% yourself!
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:CommonCheckSetVarWithReturn
-%OSR_ECHO% Found!
-echo.
-set %BASEDIRVAR%=%BASEDIRTEMP%
-set BASEDIRTEMP=
-:: Tell the caller it was successful
-:CommonCheckNoErrorWithReturn
-set OSR_ERRCODE=0
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:CommonCheckErrorNotDetectedWithReturn
-echo.
-%OSR_ECHO% None of the usual default paths works. Set %%%BASEDIRVAR%%% manually!
-:CommonCheckErrorNotSupportedWithReturn
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: Initialize variables specific to the respective platform
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-::
-:: Valid parameters for setenv in different DDKs/WDKs:
-::
-:: 2600 - "setenv <directory> [fre|chk] [64] [hal]"
-:: 2600.1106 - "setenv <directory> [fre|chk] [64] [hal] [WXP|W2K]"
-:: 3790 - "setenv <directory> [fre|chk] [64|AMD64] [hal] [WXP|WNET|W2K]"
-:: 3790.1830 - "setenv <directory> [fre|chk] [64|AMD64] [hal] [WXP|WNET|W2K] [no_prefast] [bscmake]"
-:: 6000 - "setenv <directory> [fre|chk] [64|AMD64] [hal] [WLH|WXP|WNET|W2K] [bscmake]"
-:: 6001.18000 - "setenv <directory> [fre|chk] [64|x64] [hal] [WLH|WXP|WNET|W2K] [bscmake]"
-:: 6001.18001 - "setenv <directory> [fre|chk] [64|x64] [hal] [WLH|WXP|WNET|W2K] [bscmake]"
-:: 6001.18002 - "setenv <directory> [fre|chk] [64|x64] [hal] [WLH|WXP|WNET|W2K] [bscmake]"
-:: 7600.16385 - "setenv <directory> [fre|chk] [64|x64] [WIN7|WLH|WXP|WNET] [bscmake] [no_oacr] [separate_object_root]"
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: NT 4.0 build using NT4 DDK
-:NT4Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% "%%MSDEVDIR%%"
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: W2K build for 32bit using WXP DDK
-:XPW2KBuild
-:WXP2KBuild
-set OSR_CMDLINE="%%BASEDIR%%\bin\w2k\set2k.bat" %%BASEDIR%% %%BuildMode%%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: W2K build for 64bit (Itanium) using W2K DDK
-:W2K64Build
-:W2KI64Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv64.bat" %%BASEDIR%% %%BuildMode%%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: W2K build for 32bit using W2K DDK
-:W2KBuild
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WXP build for 64bit (Itanium) using WXP DDK
-:XP64Build
-:WXP64Build
-:WXPI64Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% 64
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WXP build for 32bit using WXP DDK
-:XPBuild
-:WXPBuild
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: W2K build for 32bit using WNET DDK
-:WNETW2KBuild
-:WNET2KBuild
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% W2K %%BuildMode%%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WXP build for 32bit using WNET DDK
-:WNETXPBuild
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% WXP
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WXP build for 64bit using WNET DDK
-:WNETXP64Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% 64 WXP
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WNET build for 64bit (Itanium) using WNET DDK
-:WNET64Build
-:WNETI64Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% 64 WNET
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WNET build for 64bit (x64) using WNET DDK
-:WNETA64Build
-:WNETAMD64Build
-:WNETX64Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% AMD64 WNET
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WNET build for 32bit using WNET DDK
-:WNETBuild
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WLH build for 32bit using WLH WDK
-:WLHBuild
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% WLH
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WLH build for 64bit (x64) using WLH WDK
-:WLHA64Build
-:WLHX64Build
-call :DetectVistaWDK
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% %OSR_AMD64FLAG% WLH
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WLH build for 64bit (Itanium) using WLH WDK
-:WLH64Build
-:WLHI64Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% 64 WLH
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WNET build for 64bit (x64) using WLH WDK
-:WLHNETA64Build
-:WLHNETX64Build
-call :DetectVistaWDK
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% %OSR_AMD64FLAG% WNET
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WNET build for 64bit (Itanium) using WLH WDK
-:WLHNET64Build
-:WLHNETI64Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% 64 WNET
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WXP build for 32bit using WLH WDK
-:WLHXPBuild
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% WXP
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WXP build for 64bit (Itanium) using WLH WDK
-:WLHXP64Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% 64 WXP
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: W2K build for 32bit using WLH WDK
-:WLH2KBuild
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% W2K
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WNET build for 32bit using WLH WDK
-:WLHNETBuild
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% WNET
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: W7 build for 32bit using W7/2008 WDK
-:W7Build
-:WIN7Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% x86 WIN7 %SETTING_OACR% %SETTING_SEPARATE_OBJ_ROOT%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: W7 build for 64bit (x64) using W7/2008 WDK
-:W7X64Build
-:WIN7A64Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% x64 WIN7 %SETTING_OACR% %SETTING_SEPARATE_OBJ_ROOT%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: W7 build for 64bit (Itanium) using W7/2008 WDK
-:W7I64Build
-:WIN764Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% ia64 WIN7 no_oacr %SETTING_SEPARATE_OBJ_ROOT%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WLH build for 32bit using W7/2008 WDK
-:W7LHBuild
-:WIN7WLHBuild
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% x86 WLH %SETTING_OACR% %SETTING_SEPARATE_OBJ_ROOT%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WLH build for 64bit (x64) using W7/2008 WDK
-:W7LHX64Build
-:WIN7WLHA64Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% x64 WLH %SETTING_OACR% %SETTING_SEPARATE_OBJ_ROOT%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WLH build for 64bit (Itanium) using W7/2008 WDK
-:W7LHI64Build
-:WIN7WLH64Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% ia64 WLH no_oacr %SETTING_SEPARATE_OBJ_ROOT%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WNET build for 32bit using W7/2008 WDK
-:W7NETBuild
-:WIN7NETBuild
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% x86 WNET %SETTING_OACR% %SETTING_SEPARATE_OBJ_ROOT%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WNET build for 64bit (x64) using W7/2008 WDK
-:W7NETX64Build
-:WIN7NETA64Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% x64 WNET %SETTING_OACR% %SETTING_SEPARATE_OBJ_ROOT%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WNET build for 64bit (Itanium) using W7/2008 WDK
-:W7NETI64Build
-:WIN7NET64Build
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% ia64 WNET no_oacr %SETTING_SEPARATE_OBJ_ROOT%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: WXP build for 32bit using W7/2008 WDK
-:W7XPBuild
-:WIN7XPBuild
-set OSR_CMDLINE="%%BASEDIR%%\bin\setenv.bat" %%BASEDIR%% %%BuildMode%% x86 WXP %SETTING_OACR% %SETTING_SEPARATE_OBJ_ROOT%
-goto :EOF
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: All builds go here for the rest of the procedure. Now,
-:: we are getting ready to call build. The big problem
-:: here is to figure our the name of the buildxxx files
-:: being generated for the different platforms.
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:CommonBuild
-:: Remove first command line arg
-shift
-call :SetMode %1
-if not "%OSR_ERRCODE%" == "0" call :ShowErrorMsg %OSR_ERRCODE% "%ERR_BadMode%" & goto :USAGE
-set OSR_BUILDNAME=%OSR_TARGET% (%BuildMode%) using the %BASEDIROS% DDK and %%%BASEDIRVAR%%%
-
-call :CheckTargets %2
-if "%OSR_ERRCODE%" == "6" call :ShowErrorMsg %OSR_ERRCODE% "%ERR_NoTarget%" & goto :USAGE
-if not "%OSR_ERRCODE%" == "0" call :ShowErrorMsg %OSR_ERRCODE% "%ERR_NoDir%" & goto :USAGE
-
-:: Resolve any variables in the command line string
-call :ResolveVar OSR_CMDLINE
-
-pushd .
-set ERRORLEVEL=0
-:: This external script prepares the build environment (e.g. setenv.bat)
-call %OSR_CMDLINE%
-:: Will only work with newer SETENV.BAT versions, but will be helpful in this case.
-if not "%ERRORLEVEL%" == "0" call :ShowErrorMsg 9 "%ERR_SetEnvFailed%" & goto :USAGE
-popd
-
-:: ----------------------------------------------------------------------------
-:: Setting global variables for the scope of this CMD session
-set NO_BROWSER_FILE=
-set NO_BINPLACE=
-set buildDirectory=%~fs2
-call :MakeShort buildDirectory "%buildDirectory%"
-set buildDirectory_raw=%2
-set buildDirectory_fname=%~n2
-%OSR_TRACE% buildDirectory == %buildDirectory%
-%OSR_TRACE% buildDirectory_raw == %buildDirectory_raw%
-%OSR_TRACE% buildDirectory_fname == %buildDirectory_fname%
-
-set mpFlag=-M
-if "%BUILD_ALT_DIR%" == "" goto :NT4
-
-:: W2K sets this!
-set OSR_EXT=%BUILD_ALT_DIR%
-set mpFlag=-MI
-
-:NT4
-if "%NUMBER_OF_PROCESSORS%" == "" set mpFlag=
-if "%NUMBER_OF_PROCESSORS%" == "1" set mpFlag=
-
-:: Set additional variables at this point or do whatever you please
-@if exist "%buildDirectory%\%OSR_PREBUILD_SCRIPT%" @(
- %OSR_ECHO% ^>^> Performing pre-build steps [%OSR_PREBUILD_SCRIPT%] ...
- pushd "%buildDirectory%"
- call "%OSR_PREBUILD_SCRIPT%" > "%TEMP%\%OSR_PREBUILD_SCRIPT%_%OSR_RANDEXT%.tmp"
- for /f "tokens=*" %%x in ('type "%TEMP%\%OSR_PREBUILD_SCRIPT%_%OSR_RANDEXT%.tmp"') do @(
- %OSR_ECHO% %%x
- )
- if exist "%TEMP%\%OSR_PREBUILD_SCRIPT%_%OSR_RANDEXT%.tmp" del /f /q "%TEMP%\%OSR_PREBUILD_SCRIPT%_%OSR_RANDEXT%.tmp"
- popd
- %OSR_ECHO% ^<^< Finished pre-build steps [%OSR_PREBUILD_SCRIPT%] ...
-)
-:: Save the current directory (before changing into the build directory!)
-:: AFTERPREBUILD
-pushd .
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: Determine the settings of flags, WDF and PREFAST in
-:: other words what was set for %3 and beyond....
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-%OSR_ECHO% %OSR_BUILDNAME%
-set OSR_ARGS= + argument(s):
-if not "%3" == "" set OSR_ARGS=%OSR_ARGS% %3
-if not "%4" == "" set OSR_ARGS=%OSR_ARGS% %4
-if not "%5" == "" set OSR_ARGS=%OSR_ARGS% %5
-if /i "%OSR_ARGS%" == " + argument(s):" set OSR_ARGS=
-%OSR_ECHO% Directory: %buildDirectory%%OSR_ARGS%
-%OSR_ECHO% %BASEDIRVAR%: %BASEDIR%
-
-cd /D %~s2
-set bFlags=-Ze
-set bscFlags=
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:ContinueParsing
-if "%3" == "" goto :DONE
-if "%3" == "/a" goto :RebuildallFound
-if /i "%3" == "-WDF" goto :WDFFound
-if /i "%3" == "-PREFAST" goto :PrefastFound
-if /i "%3" == "-CUV" goto :CallUsageVerifier
-set bscFlags=/n
-set bFlags=%bFlags% %3
-:: Remove next arg
-shift
-goto :ContinueParsing
-
-:WDFFound
-shift
-:: Note, that the setwdf.bat is called from setenv.bat in the WDK,
-:: therefore we skip it.
-if /i "%BASEDIRVAR%" == "WLHBASE" goto :WDFOkay
-if /i "%BASEDIRVAR%" == "W7BASE" goto :WDFOkay
-if /i "%BASEDIRVAR%" == "WIN7BASE" goto :WDFOkay
-if "%WDF_ROOT%" == "" call :ShowErrorMsg 2 "%ERR_NoWdfRoot%" & goto :USAGE
-pushd .
-if exist "%WDF_ROOT%\set_wdf_env.cmd" call "%WDF_ROOT%\set_wdf_env.cmd"
-popd
-:WDFOkay
-goto :ContinueParsing
-
-:PrefastFound
-shift
-set PREFAST_BUILD=1
-goto :ContinueParsing
-
-:CallUsageVerifier
-shift
-set VERIFIER_DDK_EXTENSIONS=1
-set PREFAST_BUILD=1
-goto :ContinueParsing
-
-:RebuildallFound
-shift
-set bscFlags=/n
-set bFlags=%bFlags:-Ze=-cfeZ%
-set bFlags=%bFlags: -cZ=%
-goto :ContinueParsing
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:DONE
-for %%x in (build%OSR_EXT%.err build%OSR_EXT%.wrn build%OSR_EXT%.log prefast%OSR_EXT%.log) do @(
- if exist "%%x" del /f /q "%%x"
-)
-
-if not "%PREFAST_BUILD%" == "0" goto :RunPrefastBuild
-%OSR_ECHO% Run build %mpFlag% %bFlags% for %BuildMode% version in %buildDirectory_raw%
-pushd .
-build %mpFlag% %bFlags%
-popd
-goto :BuildComplete
-
-:RunPrefastBuild
-%OSR_ECHO% Run prefast build %mpFlag% %bFlags% for %BuildMode% version in %buildDirectory_raw%
-setlocal ENABLEEXTENSIONS & pushd .
-set PREFASTLOG=PREfast_defects_%OSR_EXT%.xml
-prefast /log=%PREFASTLOG% /reset build %mpFlag% %bFlags% > NUL 2>&1
-if "%errorlevel%" GTR "0" set OSR_ERRCODE=%errorlevel%
-prefast /log=%PREFASTLOG% list > prefast%OSR_EXT%.log
-%OSR_ECHO% The PREfast logfile is ^"%prefastlog%^"!
-popd & endlocal
-
-:BuildComplete
-if not "%errorlevel%" == "0" set OSR_ERRCODE=%errorlevel%
-
-@echo %OSR_DEBUG%
-:: Assume that the onscreen errors are complete!
-setlocal
-set WARNING_FILE_COUNT=0
-if exist "build%OSR_EXT%.log" for /f "tokens=*" %%x in ('findstr "warning[^.][CDMRU][0-9][0-9]* warning[^.][BRP][KCWG][0-9][0-9]* warning[^.][ACLPS][DNRTVX][JKLTX][0-9][0-9]* error[^.][CDMRU][0-9][0-9]* error[^.][BRP][KCWG][0-9][0-9]* error[^.][ACLPS][DNRTVX][JKLTX][0-9][0-9]*" "build%OSR_EXT%.log"') do @(
- set /a WARNING_FILE_COUNT=%WARNING_FILE_COUNT%+1
-)
-if not "%WARNING_FILE_COUNT%" == "0" (
- %OSR_ECHO% ================ Build warnings =======================
- if exist "build%OSR_EXT%.log" for /f "tokens=*" %%x in ('findstr "warning[^.][CDMRU][0-9][0-9]* warning[^.][BRP][KCWG][0-9][0-9]* warning[^.][ACLPS][DNRTVX][JKLTX][0-9][0-9]* error[^.][CDMRU][0-9][0-9]* error[^.][BRP][KCWG][0-9][0-9]* error[^.][ACLPS][DNRTVX][JKLTX][0-9][0-9]*" "build%OSR_EXT%.log"') do @(
- @echo %%x
- )
-)
-set WARNING_FILE_COUNT_PRE=0
-if exist "prefast%OSR_EXT%.log" for /f "tokens=*" %%x in ('findstr "warning[^.][CDMRU][0-9][0-9]* warning[^.][BRP][KCWG][0-9][0-9]* warning[^.][ACLPS][DNRTVX][JKLTX][0-9][0-9]*" "prefast%OSR_EXT%.log"') do @(
- set /a WARNING_FILE_COUNT_PRE=%WARNING_FILE_COUNT_PRE%+1
-)
-:: Reset if this is no PREfast build
-if "%PREFAST_BUILD%" == "0" set WARNING_FILE_COUNT_PRE=0
-if not "%WARNING_FILE_COUNT_PRE%" == "0" (
- %OSR_ECHO% =============== PREfast warnings ======================
- if exist "prefast%OSR_EXT%.log" for /f "tokens=*" %%x in ('findstr "warning[^.][CDMRU][0-9][0-9]* warning[^.][BRP][KCWG][0-9][0-9]* warning[^.][ACLPS][DNRTVX][JKLTX][0-9][0-9]*" "prefast%OSR_EXT%.log"') do @(
- @echo %%x
- )
-)
-set /a WARNING_FILE_COUNT=%WARNING_FILE_COUNT%+%WARNING_FILE_COUNT_PRE%
-if not "%WARNING_FILE_COUNT%" == "0" (
- %OSR_ECHO% =======================================================
-)
-endlocal
-@echo.
-%OSR_ECHO% Build complete
-%OSR_ECHO% Building browse information files
-if exist "buildbrowse.cmd" call "buildbrowse.cmd" & goto :postBuildSteps
-set sbrlist=sbrList.txt
-if not exist sbrList%CPU%.txt goto :sbrDefault
-set sbrlist=sbrList%CPU%.txt
-
-:sbrDefault
-if not exist %sbrlist% goto :postBuildSteps
-:: Prepend blank space
-if not "%bscFlags%" == "" set bscFlags= %bscFlags%
-:: bscmake%bscFlags% prevents a double blank space ...
-bscmake%bscFlags% @%sbrlist%
-
-:: Perform whatever post-build steps
-:postBuildSteps
-:: Restore the current directory (after changing into the build directory!)
-:: Search upwards for "AFTERPREBUILD" to find the corresponding PUSHD
-popd
-@if exist "%buildDirectory%\%OSR_POSTBUILD_SCRIPT%" @(
- %OSR_ECHO% ^>^> Performing post-build steps [%OSR_POSTBUILD_SCRIPT%] ...
- pushd "%buildDirectory%"
- call "%OSR_POSTBUILD_SCRIPT%" > "%TEMP%\%OSR_POSTBUILD_SCRIPT%_%OSR_RANDEXT%.tmp"
- for /f "tokens=*" %%x in ('type "%TEMP%\%OSR_POSTBUILD_SCRIPT%_%OSR_RANDEXT%.tmp"') do @(
- %OSR_ECHO% %%x
- )
- if exist "%TEMP%\%OSR_POSTBUILD_SCRIPT%_%OSR_RANDEXT%.tmp" del /f /q "%TEMP%\%OSR_POSTBUILD_SCRIPT%_%OSR_RANDEXT%.tmp"
- popd
- %OSR_ECHO% ^<^< Finished post-build steps [%OSR_POSTBUILD_SCRIPT%] ...
-)
-goto :END
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: \ MAIN function of the script
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: / GetCustomEnvironment
-:: First parameter is the "directory" that supposedly contains the SOURCES
-:: or DIRS file (and the build scripts)
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:GetCustomEnvironment
-pushd .
-call :CheckTargets "%~f1"
-@if not "%OSR_ERRCODE%" == "0" @(
- echo.
- %OSR_ECHO% The target directory seemed to not contain a DIRS or SOURCES file
- %OSR_ECHO% when trying to set a custom environment! Quitting. ^(ERROR #%OSR_ERRCODE%^)
- set buildDirectory=%~f1
- if "%OSR_ERRCODE%" == "6" call :ShowErrorMsg %OSR_ERRCODE% "%ERR_NoTarget%" & goto :GetCustomEnvironment_ret
- call :ShowErrorMsg %OSR_ERRCODE% "%ERR_NoDir%" & goto :GetCustomEnvironment_ret
- goto :GetCustomEnvironment_ret
-)
-:: If the user provided a script to customize the environment, execute it.
-@if exist "%~f1\%OSR_SETENV_SCRIPT%" @(
- %OSR_ECHO% ^>^> Setting custom environment variables [%OSR_SETENV_SCRIPT%] ...
- pushd "%~f1"
- call "%OSR_SETENV_SCRIPT%" > "%TEMP%\%OSR_SETENV_SCRIPT%_%OSR_RANDEXT%.tmp"
- for /f "tokens=*" %%x in ('type "%TEMP%\%OSR_SETENV_SCRIPT%_%OSR_RANDEXT%.tmp"') do @(
- %OSR_ECHO% %%x
- )
- if exist "%TEMP%\%OSR_SETENV_SCRIPT%_%OSR_RANDEXT%.tmp" del /f /q "%TEMP%\%OSR_SETENV_SCRIPT%_%OSR_RANDEXT%.tmp"
- popd
- %OSR_ECHO% ^<^< Finished setting custom environment variables [%OSR_SETENV_SCRIPT%] ...
-)
-:GetCustomEnvironment_ret
-popd
-goto :EOF
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: \ GetCustomEnvironment
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: / SetMode
-:: Subroutine to validate the mode of the build passed in. It must be free,
-:: FREE, fre, FRE or checked, CHECKED, chk, CHK. Anything else is an error.
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:SetMode
-set BuildMode=
-if /i "%OSR_TARGET%" == "WLH2K" goto :SetModeWLH2K
-for %%f in (free fre) do if /i "%%f" == "%1" set BuildMode=free
-for %%f in (checked chk) do if /i "%%f" == "%1" set BuildMode=checked
-goto :SetModeCommonEnd
-:SetModeWLH2K
-for %%f in (free fre) do if /i "%%f" == "%1" set BuildMode=f
-for %%f in (checked chk) do if /i "%%f" == "%1" set BuildMode=c
-:SetModeCommonEnd
-%OSR_TRACE% Mode set to ^"%BuildMode%^"
-if "%BuildMode%" == "" set OSR_ERRCODE=5
-goto :EOF
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: \ SetMode
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: / CheckTargets subroutine
-:: Subroutine to validate that the target directory exists and that there is
-:: either a DIRS or SOURCES and MakeFile in it.
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:CheckTargets
-:: Building "stack frame"
-setlocal & pushd . & set OSR_ERRCODE=0
-set lTarget=%~1
-if not "%lTarget%" == "" goto :CheckTargets1
-set OSR_ERRCODE=7
-goto :CheckTargets_ret
-:CheckTargets1
-if exist "%lTarget%" goto :CheckTargets2
-set OSR_ERRCODE=8
-goto :CheckTargets_ret
-:CheckTargets2
-if not exist "%lTarget%\DIRS" goto :CheckTargets3
-set OSR_ERRCODE=0
-goto :CheckTargets_ret
-:CheckTargets3
-if exist "%lTarget%\SOURCES" goto :CheckTargets4
-set OSR_ERRCODE=6
-goto :CheckTargets_ret
-:CheckTargets4
-if exist "%lTarget%\MAKEFILE" goto :CheckTargets5
-set OSR_ERRCODE=6
-goto :CheckTargets_ret
-:CheckTargets5
-set OSR_ERRCODE=0
-:CheckTargets_ret
-:: Cleaning "stack frame" and returning error code into global scope
-popd & endlocal & set OSR_ERRCODE=%OSR_ERRCODE%
-goto :EOF
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: \ CheckTargets subroutine
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: / ResolveVar subroutine
-:: There is only one parameter, the name of the variable to be resolved!
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:ResolveVar
-:: Get the name of the variable we are working with
-setlocal ENABLEEXTENSIONS & set VAR_NAME=%1
-set VAR_TEMPRET2=%%%VAR_NAME%%%
-:ResolveVarLoop
-set VAR_TEMPRET1=%VAR_TEMPRET2%
-set VAR_TEMPRET2=%VAR_TEMPRET1%
-for /f "tokens=*" %%i in ('echo %VAR_TEMPRET1%') do (
- set VAR_TEMPRET2=%%i
-)
-if not "%VAR_TEMPRET1%" == "%VAR_TEMPRET2%" goto :ResolveVarLoop
-:: Re-export the variable out of the local scope
-endlocal & set %VAR_NAME%=%VAR_TEMPRET1%
-goto :EOF
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: \ ResolveVar subroutine
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: / MakeShort subroutine
-:: Two parameters. First parameter is the variable name, second is the path
-:: to convert into a short filename.
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:MakeShort
-setlocal ENABLEEXTENSIONS
-:: Get the name of the variable we are working with and the path to convert
-set VAR_NAME=%~1
-set PATH_SHORT=%~dpns2
-set PATH_EXTSHORT=%~xs2
-if not "" == "%PATH_EXTSHORT%" set PATH_EXTSHORT=%PATH_EXTSHORT:~0,4%
-set PATH_SHORT=%PATH_SHORT%%PATH_EXTSHORT%
-endlocal & set %VAR_NAME%=%PATH_SHORT%
-goto :EOF
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: \ MakeShort subroutine
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: / ErrorWithUsage subroutine
-:: This one will take the passed in parameters and build a nice error
-:: message which is returned to the user along with the usage hints.
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:ShowErrorMsg
-@set OSR_ERRCODE=%~1
-@set OSR_ERRMSG=%~2
-@set OSR_ERRMSG=%OSR_ERRMSG:'="%
-@set OSR_ERRMSG=ERROR #%OSR_ERRCODE%: %OSR_ERRMSG%
-@echo.
-%OSR_ECHO% %OSR_ERRMSG%
-if DEFINED buildDirectory %OSR_ECHO% -^> Target directory: %buildDirectory%
-goto :EOF
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: \ ErrorWithUsage subroutine
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: / SetVar subroutine
-:: Param1 == name of the variable, Param2 == value to be set for the variable
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:SetVar
-:: Get the name of the variable we are working with
-setlocal ENABLEEXTENSIONS & set VAR_NAME=%1
-endlocal & set %VAR_NAME%=%~2
-goto :EOF
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: \ SetVar subroutine
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: / DetectVistaWDK subroutine
-:: No parameters expected
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:DetectVistaWDK
-setlocal ENABLEEXTENSIONS
-:: Newer flag (starting with W2K8) is default
-set OSR_AMD64FLAG=x64
-:: The Vista WDK accepted *only* "AMD64", the newer W2K8 WDK accepts only "x64"
-:: We detect the older one by checking the setenv.bat for a certain string
-findstr /C:"Windows Server Longhorn" "%BASEDIR%\bin\setenv.bat" > NUL 2>&1 && set OSR_AMD64FLAG=AMD64
-endlocal & set OSR_AMD64FLAG=%OSR_AMD64FLAG%
-goto :EOF
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: \ DetectVistaWDK subroutine
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: / DetectBaseDirTemp subroutine
-:: The first parameter is the list of directory names to check, separated by
-:: blank spaces.
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:DetectBaseDirTemp
-:: Get the name of the variable we are working with
-if "%~1" == "" goto :EOF
-setlocal ENABLEEXTENSIONS
-call :CommonCheckMsg1
-:: Try to find an installed DDK/WDK from the registry keys
-if DEFINED OSR_REGAVAILABLE if not "%OSR_REGAVAILABLE%" == "0" (
- for %%i in (%~1) do @(
- call :RegTryBaseDirTemp "%%i"
- )
-)
-:: Try all the "default" locations
-if not DEFINED BASEDIRTEMP (
- for %%i in (%~1) do @(
- for %%a in (WINDDK DDK) do @(
- call :BruteTryBaseDirTemp "%SystemDrive%\%%a\%%i"
- call :BruteTryBaseDirTemp "%ProgramFiles%\%%a\%%i"
- )
- )
-)
-endlocal & set BASEDIRTEMP=%BASEDIRTEMP%
-goto :EOF
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: \ DetectBaseDirTemp subroutine
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: / RegTryBaseDirTemp subroutine
-:: Attempt to find the install key in the registry.
-:: This functions tests old-style DDKs and new-style WDKs.
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:RegTryBaseDirTemp
-if DEFINED BASEDIRTEMP if exist "%BASEDIRTEMP%" goto :EOF
-setlocal ENABLEEXTENSIONS
-call :RegTryBaseDirTempSingle "%~1" "LFNDirectory" BASEDIRTEMP
-if DEFINED BASEDIRTEMP if exist "%BASEDIRTEMP%" goto :RegTryBaseDirTemp_EOF
-call :RegTryBaseDirTempSingle "%~1\Setup" "BUILD" BASEDIRTEMP
-if DEFINED BASEDIRTEMP if exist "%BASEDIRTEMP%" goto :RegTryBaseDirTemp_EOF
-if not DEFINED BASEDIRTEMP (endlocal & goto :EOF)
-:RegTryBaseDirTemp_EOF
-%OSR_ECHO% Found directory (%BASEDIRTEMP%) from install key
-endlocal & set BASEDIRTEMP=%BASEDIRTEMP% & goto :EOF
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: \ RegTryBaseDirTemp subroutine
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: / RegTryBaseDirTempSingle subroutine
-:: Attempt to find the install key in the registry.
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:RegTryBaseDirTempSingle
-setlocal ENABLEEXTENSIONS
-set REGSUBKEY=%~1
-set REGVALUE=%~2
-set VARIABLETOSET=%~3
-set REGMAINKEY=HKLM\SOFTWARE\Microsoft\WINDDK
-:: Test whether we can read the value below this key
-reg query "%REGMAINKEY%\%REGSUBKEY%" /v "%REGVALUE%" > NUL 2>&1 || goto :RegTryBaseDirTempSingle_WOW64
-for /f "tokens=2*" %%i in ('reg query "%REGMAINKEY%\%REGSUBKEY%" /v "%REGVALUE%"^|findstr /C:"%REGVALUE%"') do @(
- call :SetVar _SETVARIABLE "%%j"
-)
-endlocal & set %VARIABLETOSET%=%_SETVARIABLE%
-:RegTryBaseDirTempSingle_WOW64
-set REGMAINKEY=HKLM\SOFTWARE\Wow6432Node\Microsoft\WINDDK
-:: Test whether we can read the value below this key
-reg query "%REGMAINKEY%\%REGSUBKEY%" /v "%REGVALUE%" > NUL 2>&1 || goto :RegTryBaseDirTempSingle_EOF
-for /f "tokens=2*" %%i in ('reg query "%REGMAINKEY%\%REGSUBKEY%" /v "%REGVALUE%"^|findstr /C:"%REGVALUE%"') do @(
- call :SetVar _SETVARIABLE "%%j"
-)
-endlocal & set %VARIABLETOSET%=%_SETVARIABLE%
-:RegTryBaseDirTempSingle_EOF
-endlocal
-goto :EOF
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: \ RegTryBaseDirTempSingle subroutine
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: / BruteTryBaseDirTemp subroutine
-:: Brute-force test the given directory.
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:BruteTryBaseDirTemp
-if DEFINED BASEDIRTEMP if exist "%BASEDIRTEMP%" goto :EOF
-setlocal ENABLEEXTENSIONS
-:: We will not overwrite BASETEMPDIR if it has been set and is valid
-:: Just try
-set BASEDIRTEMP=%~1
-%OSR_ECHO% Trying %BASEDIRTEMP% ...
-if not exist "%BASEDIRTEMP%" (endlocal & goto :EOF)
-endlocal & set BASEDIRTEMP=%BASEDIRTEMP% & goto :EOF
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: \ BruteTryBaseDirTemp subroutine
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:: Usage output
-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-:USAGE
-@echo.
-@echo USAGE:
-@echo ======
-@echo %~n0 ^<target^> ^<build type^> ^<directory^> [flags] [-WDF] [-PREFAST] [-CUV]
-@echo.
-@echo Values for ^<target^>:
-@echo ---------------------------------------------------------------------------
-@echo Target OS version and architecture ^| Miscellaneous
-@echo -------------------------------------^|-------------------------------------
-@echo ^<target^> ^| Windows ^| CPU ^| Base directory ^| ^<target^> alias(es)
-@echo -------------^|-------------^|---------^|----------------^|--------------------
-@echo -NT4 ^| NT 4.0 ^| x86 ^| %%NT4BASE%% ^|
-@echo -W2K ^| 2000 ^| x86 ^| %%W2KBASE%% ^|
-@echo -W2K64 ^| 2000 ^| Itanium ^| %%W2KBASE%% ^| -W2KI64
-@echo -WXP ^| XP ^| x86 ^| %%WXPBASE%% ^| -XP
-@echo -WXP64 ^| XP ^| Itanium ^| %%WXPBASE%% ^| -WXPI64, -XP64
-@echo -WXP2K ^| 2000 ^| x86 ^| %%WXPBASE%% ^| -XPW2K
-@echo -WNET ^| 2003 ^| x86 ^| %%WNETBASE%% ^|
-@echo -WNET64 ^| 2003 ^| Itanium ^| %%WNETBASE%% ^| -WNETI64
-@echo -WNETXP ^| XP ^| x86 ^| %%WNETBASE%% ^|
-@echo -WNETXP64 ^| XP ^| Itanium ^| %%WNETBASE%% ^|
-@echo -WNETAMD64 ^| 2003/XP x64 ^| x64 ^| %%WNETBASE%% ^| -WNETX64, -WNETA64
-@echo -WNET2K ^| 2000 SP3 ^| x86 ^| %%WNETBASE%% ^| -WNETW2K
-@echo -WLH ^| Vista/2008 ^| x86 ^| %%WLHBASE%% ^|
-@echo -WLH2K ^| 2000 SP4 ^| x86 ^| %%WLHBASE%% ^|
-@echo -WLHXP ^| XP ^| x86 ^| %%WLHBASE%% ^|
-@echo -WLHXP64 ^| XP ^| Itanium ^| %%WLHBASE%% ^|
-@echo -WLHNET ^| 2003 ^| x86 ^| %%WLHBASE%% ^|
-@echo -WLHNETI64 ^| 2003 ^| Itanium ^| %%WLHBASE%% ^| -WLHNET64
-@echo -WLHNETX64 ^| 2003/XP x64 ^| x64 ^| %%WLHBASE%% ^| -WLHNETA64
-@echo -WLHI64 ^| Vista/2008 ^| Itanium ^| %%WLHBASE%% ^| -WLH64
-@echo -WLHX64 ^| Vista/2008 ^| x64 ^| %%WLHBASE%% ^| -WLHA64
-@echo -W7 ^| 7/2008 R2 ^| x86 ^| %%W7BASE%% ^| -WIN7
-@echo -W7I64 ^| 7/2008 R2 ^| Itanium ^| %%W7BASE%% ^| -WIN764
-@echo -W7X64 ^| 7/2008 R2 ^| x64 ^| %%W7BASE%% ^| -WIN7A64
-@echo -W7LH ^| Vista/2008 ^| x86 ^| %%W7BASE%% ^| -WIN7WLH
-@echo -W7LHI64 ^| Vista/2008 ^| Itanium ^| %%W7BASE%% ^| -WIN7WLH64
-@echo -W7LHX64 ^| Vista/2008 ^| x64 ^| %%W7BASE%% ^| -WIN7WLHA64
-@echo -W7NET ^| 2003 ^| x86 ^| %%W7BASE%% ^| -WIN7NET
-@echo -W7NETI64 ^| 2003 ^| Itanium ^| %%W7BASE%% ^| -WIN7NET64
-@echo -W7NETX64 ^| 2003/XP x64 ^| x64 ^| %%W7BASE%% ^| -WIN7NETA64
-@echo -W7XP ^| XP ^| x86 ^| %%W7BASE%% ^| -WIN7XP
-@echo ---------------------------------------------------------------------------
-@echo Support for NT4 and W2K DDKs is deprecated and not checked anymore
-@echo in new versions. It may or may not work properly.
-@echo ---------------------------------------------------------------------------
-@echo.
-@echo Values for ^<build type^>:
-@echo checked, chk indicates a checked build
-@echo free, fre indicates a free build
-@echo.
-@echo Remaining parameters (all optional):
-@echo ^<directory^> path to build directory, try . (current directory)
-@echo [flags] any flags you think should be passed to build (try /a
-@echo for clean)
-@echo -WDF performs a WDF build
-@echo -PREFAST performs a PREFAST build
-@echo -CUV uses the Call Usage Verifier, implies a PREFAST build
-@echo.
-@echo Special files:
-@echo The build target directory (where the DIRS or SOURCES file resides) can
-@echo contain the following files:
-@echo - %OSR_PREBUILD_SCRIPT%
-@echo Allows to include a step before the BUILD tool from the DDK is called
-@echo but after the environment for the respective DDK has been set!
-@echo - %OSR_POSTBUILD_SCRIPT%
-@echo Allows to include a step after the BUILD tool from the DDK is called,
-@echo so the environment is still available to the script.
-@echo - %OSR_SETENV_SCRIPT%
-@echo Allows to set (or override) _any_ environment variables that may exist
-@echo in the global environment. Thus you can set the base directory for the
-@echo DDK from inside this script, making your project more self-contained.
-@echo.
-@echo DDKBUILD will only handle those files which exist, so you may choose to
-@echo use none, one or multiple of these script files.
-@echo (All scripts execute inside their current directory. Consider this!)
-@echo.
-@echo Examples:
-@echo ^"%~n0 -NT4 checked .^" (for NT4 BUILD)
-@echo ^"%~n0 -WXP64 chk .^"
-@echo ^"%~n0 -WXP chk c:\projects\myproject^"
-@echo ^"%~n0 -WNET64 chk .^" (IA64 build)
-@echo ^"%~n0 -WNETAMD64 chk .^" (AMD64/EM64T build)
-@echo ^"%~n0 -WNETXP chk . -cZ -WDF^"
-@echo ^"%~n0 -WNETXP chk . -cZ -PREFAST^"
-@echo.
-@echo In order for this procedure to work correctly for each platform, it
-@echo requires an environment variable to be set up for certain platforms.
-@echo There is an auto-detection mechanism in this script, which will work best
-@echo if the DDK/WDK was installed using the normal installer (i.e. not just
-@echo copied). The auto-detection is based on the DDK/WDK for which you request
-@echo a build. Whenever you set the variable explicitly, this will take
-@echo precedence over the auto-detected path!
-@echo The environment variables are as follows:
-@echo.
-@echo %%NT4BASE%% - Set this up for ^"-NT4^" builds
-@echo %%W2KBASE%% - Set this up for ^"-W2K^" and ^"-W2K64^" builds
-@echo %%WXPBASE%% - Set this up for ^"-WXP^", ^"-WXP64^", ^"-WXP2K^" builds
-@echo %%WNETBASE%% - Set this up for ^"-WNET*^" builds
-@echo %%WLHBASE%% - Set this up for ^"-WLH*^" builds
-@echo %%W7BASE%% - Set this up for ^"-W7*^" builds
-@echo.
-@echo %%WDF_ROOT%% must be set if attempting to do a WDF Build previous to the
-@echo Vista WDK (in later DDKs there is no need to set WDF_ROOT).
-@echo.
-@echo Path to this script:
-@echo %~f0
-@echo.
-@echo %OSR_VERSTR%
-@echo -^> report any problems to ^<info@osr.com^> or ^<http://assarbad.net/contact/^>
-@echo.
-
-:END
-popd & endlocal & exit /b %OSR_ERRCODE%
diff --git a/Ext3Fsd/dispatch.c b/Ext3Fsd/dispatch.c index d540b0e..59054de 100644 --- a/Ext3Fsd/dispatch.c +++ b/Ext3Fsd/dispatch.c @@ -267,6 +267,12 @@ Ext2DispatchRequest (IN PEXT2_IRP_CONTEXT IrpContext) case IRP_MJ_SHUTDOWN: return Ext2ShutDown(IrpContext); + case IRP_MJ_QUERY_EA: + return Ext2QueryEa(IrpContext); + + case IRP_MJ_SET_EA: + return Ext2SetEa(IrpContext); + #if (_WIN32_WINNT >= 0x0500) case IRP_MJ_PNP: return Ext2Pnp(IrpContext); diff --git a/Ext3Fsd/ea.c b/Ext3Fsd/ea.c new file mode 100644 index 0000000..e498b92 --- /dev/null +++ b/Ext3Fsd/ea.c @@ -0,0 +1,603 @@ +/* +* COPYRIGHT: See COPYRIGHT.TXT +* PROJECT: Ext2 File System Driver for Windows >= NT +* FILE: ea.c +* PROGRAMMER: Matt Wu <mattwu@163.com> Kaho Ng <ngkaho1234@gmail.com> +* HOMEPAGE: http://www.ext2fsd.com +* UPDATE HISTORY: +*/ + +/* INCLUDES *****************************************************************/ + +#include "ext2fs.h" +#include <linux/ext4_xattr.h> + +#ifdef ALLOC_PRAGMA +#pragma alloc_text(PAGE, Ext2QueryEa) +#pragma alloc_text(PAGE, Ext2SetEa) +#pragma alloc_text(PAGE, Ext2IsEaNameValid) +#endif + +// Ea iterator +struct EaIterator { + // Return only an entry + BOOLEAN ReturnSingleEntry; + + // Is the buffer overflowing? + BOOL OverFlow; + + // FILE_FULL_EA_INFORMATION output buffer + PFILE_FULL_EA_INFORMATION FullEa; + PFILE_FULL_EA_INFORMATION LastFullEa; + + // UserBuffer's size + ULONG UserBufferLength; + + // Remaining UserBuffer's size + ULONG RemainingUserBufferLength; + + // Start scanning from this EA + ULONG EaIndex; + + // Next EA index returned by Ext2IterateAllEa + ULONG EaIndexCounter; +}; + +static int Ext2IterateAllEa(struct ext4_xattr_ref *xattr_ref, struct ext4_xattr_item *item, BOOL is_last) +{ + struct EaIterator *pEaIterator = xattr_ref->iter_arg; + ULONG EaEntrySize = 4 + 1 + 1 + 2 + item->name_len + 1 + item->data_size; + ASSERT(pEaIterator); + if (!is_last && !pEaIterator->ReturnSingleEntry) + EaEntrySize = ALIGN_UP(EaEntrySize, ULONG); + + // Start iteration from index specified + if (pEaIterator->EaIndexCounter < pEaIterator->EaIndex) { + pEaIterator->EaIndexCounter++; + return EXT4_XATTR_ITERATE_CONT; + } + pEaIterator->EaIndexCounter++; + + if (EaEntrySize > pEaIterator->RemainingUserBufferLength) { + pEaIterator->OverFlow = TRUE; + return EXT4_XATTR_ITERATE_STOP; + } + pEaIterator->FullEa->NextEntryOffset = 0; + pEaIterator->FullEa->Flags = 0; + pEaIterator->FullEa->EaNameLength = item->name_len; + pEaIterator->FullEa->EaValueLength = item->data_size; + RtlCopyMemory(&pEaIterator->FullEa->EaName[0], + item->name, + item->name_len); + RtlCopyMemory(&pEaIterator->FullEa->EaName[0] + item->name_len + 1, + item->data, + item->data_size); + + // Link FullEa and LastFullEa together + if (pEaIterator->LastFullEa) { + pEaIterator->LastFullEa->NextEntryOffset = + (PCHAR)pEaIterator->FullEa - (PCHAR)pEaIterator->LastFullEa; + } + + pEaIterator->LastFullEa = pEaIterator->FullEa; + pEaIterator->FullEa = (PFILE_FULL_EA_INFORMATION) + ((PCHAR)pEaIterator->FullEa + EaEntrySize); + pEaIterator->RemainingUserBufferLength -= EaEntrySize; + + if (pEaIterator->ReturnSingleEntry) + return EXT4_XATTR_ITERATE_STOP; + + return EXT4_XATTR_ITERATE_CONT; +} + +NTSTATUS +Ext2QueryEa ( + IN PEXT2_IRP_CONTEXT IrpContext +) +{ + PIRP Irp = NULL; + PIO_STACK_LOCATION IrpSp; + + PDEVICE_OBJECT DeviceObject; + + PEXT2_VCB Vcb = NULL; + PEXT2_FCB Fcb = NULL; + PEXT2_CCB Ccb = NULL; + PEXT2_MCB Mcb = NULL; + + PUCHAR UserEaList; + ULONG UserEaListLength; + ULONG UserEaIndex; + + BOOLEAN RestartScan; + BOOLEAN ReturnSingleEntry; + BOOLEAN IndexSpecified; + + BOOLEAN MainResourceAcquired = FALSE; + BOOLEAN XattrRefAcquired = FALSE; + + NTSTATUS Status = STATUS_UNSUCCESSFUL; + + struct ext4_xattr_ref xattr_ref; + PCHAR UserBuffer; + + ULONG UserBufferLength = 0; + ULONG RemainingUserBufferLength = 0; + + PFILE_FULL_EA_INFORMATION FullEa, LastFullEa = NULL; + + __try { + + Ccb = IrpContext->Ccb; + ASSERT(Ccb != NULL); + ASSERT((Ccb->Identifier.Type == EXT2CCB) && + (Ccb->Identifier.Size == sizeof(EXT2_CCB))); + DeviceObject = IrpContext->DeviceObject; + Vcb = (PEXT2_VCB)DeviceObject->DeviceExtension; + Fcb = IrpContext->Fcb; + Mcb = Fcb->Mcb; + Irp = IrpContext->Irp; + IrpSp = IoGetCurrentIrpStackLocation(Irp); + + Irp->IoStatus.Information = 0; + + // + // Receive input parameter from caller + // + UserBuffer = Ext2GetUserBuffer(Irp); + if (!UserBuffer) { + Status = STATUS_INSUFFICIENT_RESOURCES; + __leave; + } + UserBufferLength = IrpSp->Parameters.QueryEa.Length; + RemainingUserBufferLength = UserBufferLength; + UserEaList = IrpSp->Parameters.QueryEa.EaList; + UserEaListLength = IrpSp->Parameters.QueryEa.EaListLength; + UserEaIndex = IrpSp->Parameters.QueryEa.EaIndex; + RestartScan = BooleanFlagOn(IrpSp->Flags, SL_RESTART_SCAN); + ReturnSingleEntry = BooleanFlagOn(IrpSp->Flags, SL_RETURN_SINGLE_ENTRY); + IndexSpecified = BooleanFlagOn(IrpSp->Flags, SL_INDEX_SPECIFIED); + + if (!Mcb) + __leave; + + // + // We do not allow multiple instance gaining EA access to the same file + // + if (!ExAcquireResourceExclusiveLite( + &Fcb->MainResource, + IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT))) { + Status = STATUS_PENDING; + __leave; + } + MainResourceAcquired = TRUE; + + Status = Ext2WinntError(ext4_fs_get_xattr_ref(IrpContext, Vcb, Fcb->Mcb, &xattr_ref)); + if (!NT_SUCCESS(Status)) { + DbgPrint("ext4_fs_get_xattr_ref() failed!\n"); + __leave; + } + + FullEa = (PFILE_FULL_EA_INFORMATION)UserBuffer; + + XattrRefAcquired = TRUE; + + if (RemainingUserBufferLength) + RtlZeroMemory(FullEa, RemainingUserBufferLength); + + if (UserEaList != NULL) { + int i = 0; + PFILE_GET_EA_INFORMATION GetEa; + for (GetEa = (PFILE_GET_EA_INFORMATION)&UserEaList[0]; + GetEa < (PFILE_GET_EA_INFORMATION)((PUCHAR)UserEaList + + UserEaListLength); + GetEa = (GetEa->NextEntryOffset == 0 + ? (PFILE_GET_EA_INFORMATION)MAXUINT_PTR + : (PFILE_GET_EA_INFORMATION)((PUCHAR)GetEa + + GetEa->NextEntryOffset))) { + + size_t ItemSize; + OEM_STRING Str; + ULONG EaEntrySize; + BOOL is_last = !GetEa->NextEntryOffset; + + Str.MaximumLength = Str.Length = GetEa->EaNameLength; + Str.Buffer = &GetEa->EaName[0]; + + // + // At the moment we only need to know whether the item exists + // and its size. + // + Status = Ext2WinntError(ext4_fs_get_xattr(&xattr_ref, + EXT4_XATTR_INDEX_USER, + Str.Buffer, + Str.Length, + NULL, + 0, + &ItemSize)); + if (!NT_SUCCESS(Status)) + continue; + + // + // We were not able to locate the name therefore we must + // dummy up a entry for the query. The needed Ea size is + // the size of the name + 4 (next entry offset) + 1 (flags) + // + 1 (name length) + 2 (value length) + the name length + + // 1 (null byte) + Data Size. + // + EaEntrySize = 4 + 1 + 1 + 2 + GetEa->EaNameLength + 1 + ItemSize; + if (!is_last) + EaEntrySize = ALIGN_UP(EaEntrySize, ULONG); + + if (EaEntrySize > RemainingUserBufferLength) { + + Status = i ? STATUS_BUFFER_OVERFLOW : STATUS_BUFFER_TOO_SMALL; + __leave; + } + FullEa->NextEntryOffset = 0; + FullEa->Flags = 0; + FullEa->EaNameLength = GetEa->EaNameLength; + FullEa->EaValueLength = ItemSize; + RtlCopyMemory(&FullEa->EaName[0], + &GetEa->EaName[0], + GetEa->EaNameLength); + + // + // This query must succeed, or is guarenteed to succeed + // since we are only looking up + // an EA entry in a in-memory tree structure. + // Otherwise that means someone might be operating on + // the xattr_ref without acquiring Inode lock. + // + ASSERT(NT_SUCCESS(Ext2WinntError( + ext4_fs_get_xattr(&xattr_ref, + EXT4_XATTR_INDEX_USER, + Str.Buffer, + Str.Length, + &FullEa->EaName[0] + FullEa->EaNameLength + 1, + ItemSize, + &ItemSize + )))); + FullEa->EaValueLength = ItemSize; + + // Link FullEa and LastFullEa together + if (LastFullEa) + LastFullEa->NextEntryOffset = (PCHAR)FullEa - (PCHAR)LastFullEa; + + LastFullEa = FullEa; + FullEa = (PFILE_FULL_EA_INFORMATION) + ((PCHAR)FullEa + EaEntrySize); + RemainingUserBufferLength -= EaEntrySize; + i++; + } + } else if (IndexSpecified) { + struct EaIterator EaIterator; + // + // The user supplied an index into the Ea list. + // + if (RemainingUserBufferLength) + RtlZeroMemory(FullEa, RemainingUserBufferLength); + + EaIterator.OverFlow = FALSE; + EaIterator.RemainingUserBufferLength = UserBufferLength; + // In this case, return only an entry. + EaIterator.ReturnSingleEntry = TRUE; + EaIterator.FullEa = (PFILE_FULL_EA_INFORMATION)UserBuffer; + EaIterator.LastFullEa = NULL; + EaIterator.UserBufferLength = UserBufferLength; + EaIterator.EaIndex = UserEaIndex; + EaIterator.EaIndexCounter = 1; + + xattr_ref.iter_arg = &EaIterator; + ext4_fs_xattr_iterate(&xattr_ref, Ext2IterateAllEa); + + RemainingUserBufferLength = EaIterator.RemainingUserBufferLength; + + Status = STATUS_SUCCESS; + + // It seems that the item isn't found + if (RemainingUserBufferLength == UserBufferLength) + Status = STATUS_OBJECTID_NOT_FOUND; + + if (EaIterator.OverFlow) { + if (RemainingUserBufferLength == UserBufferLength) + Status = STATUS_BUFFER_TOO_SMALL; + else + Status = STATUS_BUFFER_OVERFLOW; + } + + } else { + struct EaIterator EaIterator; + // + // Else perform a simple scan, taking into account the restart + // flag and the position of the next Ea stored in the Ccb. + // + if (RestartScan) + Ccb->EaIndex = 1; + + if (RemainingUserBufferLength) + RtlZeroMemory(FullEa, RemainingUserBufferLength); + + EaIterator.OverFlow = FALSE; + EaIterator.RemainingUserBufferLength = UserBufferLength; + EaIterator.ReturnSingleEntry = ReturnSingleEntry; + EaIterator.FullEa = (PFILE_FULL_EA_INFORMATION)UserBuffer; + EaIterator.LastFullEa = NULL; + EaIterator.UserBufferLength = UserBufferLength; + EaIterator.EaIndex = Ccb->EaIndex; + EaIterator.EaIndexCounter = 1; + + xattr_ref.iter_arg = &EaIterator; + ext4_fs_xattr_iterate(&xattr_ref, Ext2IterateAllEa); + + RemainingUserBufferLength = EaIterator.RemainingUserBufferLength; + + if (Ccb->EaIndex < EaIterator.EaIndexCounter) + Ccb->EaIndex = EaIterator.EaIndexCounter; + + Status = STATUS_SUCCESS; + + if (EaIterator.OverFlow) { + if (RemainingUserBufferLength == UserBufferLength) + Status = STATUS_BUFFER_TOO_SMALL; + else + Status = STATUS_BUFFER_OVERFLOW; + } + + } + } + __finally { + + if (XattrRefAcquired) { + if (!NT_SUCCESS(Status)) { + xattr_ref.dirty = FALSE; + ext4_fs_put_xattr_ref(&xattr_ref); + } + else + Status = Ext2WinntError(ext4_fs_put_xattr_ref(&xattr_ref)); + } + + if (MainResourceAcquired) { + ExReleaseResourceLite(&Fcb->MainResource); + } + + if (NT_SUCCESS(Status)) { + Ext2NotifyReportChange( + IrpContext, + Vcb, + Mcb, + FILE_NOTIFY_CHANGE_EA, + FILE_ACTION_MODIFIED); + Irp->IoStatus.Information = UserBufferLength - RemainingUserBufferLength; + } + + if (!AbnormalTermination()) { + if (Status == STATUS_PENDING || Status == STATUS_CANT_WAIT) { + Status = Ext2QueueRequest(IrpContext); + } + else { + Ext2CompleteIrpContext(IrpContext, Status); + } + } + } + + return Status; +} + +BOOLEAN +Ext2IsEaNameValid( + IN OEM_STRING Name +) +{ + ULONG Index; + UCHAR Char; + + // + // Empty names are not valid + // + + if (Name.Length == 0) + return FALSE; + + // + // Do not allow EA name longer than 255 bytes + // + if (Name.Length > 255) + return FALSE; + + for (Index = 0; Index < (ULONG)Name.Length; Index += 1) { + + Char = Name.Buffer[Index]; + + // + // Skip over and Dbcs chacters + // + if (FsRtlIsLeadDbcsCharacter(Char)) { + + ASSERT(Index != (ULONG)(Name.Length - 1)); + Index += 1; + continue; + } + + // + // Make sure this character is legal, and if a wild card, that + // wild cards are permissible. + // + if (!FsRtlIsAnsiCharacterLegalFat(Char, FALSE)) + return FALSE; + + } + + return TRUE; +} + +NTSTATUS +Ext2SetEa ( + IN PEXT2_IRP_CONTEXT IrpContext +) +{ + PIRP Irp = NULL; + PIO_STACK_LOCATION IrpSp; + + PDEVICE_OBJECT DeviceObject; + + PEXT2_VCB Vcb = NULL; + PEXT2_FCB Fcb = NULL; + PEXT2_CCB Ccb = NULL; + PEXT2_MCB Mcb = NULL; + + BOOLEAN MainResourceAcquired = FALSE; + BOOLEAN FcbLockAcquired = FALSE; + BOOLEAN XattrRefAcquired = FALSE; + + NTSTATUS Status = STATUS_UNSUCCESSFUL; + + struct ext4_xattr_ref xattr_ref; + PCHAR UserBuffer; + ULONG UserBufferLength; + + PFILE_FULL_EA_INFORMATION FullEa; + + __try { + + Ccb = IrpContext->Ccb; + ASSERT(Ccb != NULL); + ASSERT((Ccb->Identifier.Type == EXT2CCB) && + (Ccb->Identifier.Size == sizeof(EXT2_CCB))); + DeviceObject = IrpContext->DeviceObject; + Vcb = (PEXT2_VCB)DeviceObject->DeviceExtension; + Fcb = IrpContext->Fcb; + Mcb = Fcb->Mcb; + Irp = IrpContext->Irp; + IrpSp = IoGetCurrentIrpStackLocation(Irp); + + Irp->IoStatus.Information = 0; + + // + // Receive input parameter from caller + // + UserBufferLength = IrpSp->Parameters.SetEa.Length; + UserBuffer = Irp->UserBuffer; + + // Check if the EA buffer provided is valid + Status = IoCheckEaBufferValidity((PFILE_FULL_EA_INFORMATION)UserBuffer, + UserBufferLength, + (PULONG)&Irp->IoStatus.Information); + if (!NT_SUCCESS(Status)) + __leave; + + ExAcquireResourceExclusiveLite(&Vcb->FcbLock, TRUE); + FcbLockAcquired = TRUE; + + if (!Mcb) + __leave; + + // + // We do not allow multiple instance gaining EA access to the same file + // + if (!ExAcquireResourceExclusiveLite( + &Fcb->MainResource, + IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT))) { + Status = STATUS_PENDING; + __leave; + } + MainResourceAcquired = TRUE; + + Status = Ext2WinntError(ext4_fs_get_xattr_ref(IrpContext, Vcb, Fcb->Mcb, &xattr_ref)); + if (!NT_SUCCESS(Status)) { + DbgPrint("ext4_fs_get_xattr_ref() failed!\n"); + __leave; + } + + XattrRefAcquired = TRUE; + + // + // Remove all existing EA entries. + // + ext4_xattr_purge_items(&xattr_ref); + xattr_ref.dirty = TRUE; + Status = STATUS_SUCCESS; + + // Iterate the whole EA buffer to do inspection + for (FullEa = (PFILE_FULL_EA_INFORMATION)UserBuffer; + FullEa < (PFILE_FULL_EA_INFORMATION)&UserBuffer[UserBufferLength]; + FullEa = (PFILE_FULL_EA_INFORMATION)(FullEa->NextEntryOffset == 0 ? + &UserBuffer[UserBufferLength] : + (PCHAR)FullEa + FullEa->NextEntryOffset)) { + + OEM_STRING EaName; + + EaName.MaximumLength = EaName.Length = FullEa->EaNameLength; + EaName.Buffer = &FullEa->EaName[0]; + + // Check if EA's name is valid + if (!Ext2IsEaNameValid(EaName)) { + Irp->IoStatus.Information = (PCHAR)FullEa - UserBuffer; + Status = STATUS_INVALID_EA_NAME; + __leave; + } + } + + // Now add EA entries to the inode + for (FullEa = (PFILE_FULL_EA_INFORMATION)UserBuffer; + FullEa < (PFILE_FULL_EA_INFORMATION)&UserBuffer[UserBufferLength]; + FullEa = (PFILE_FULL_EA_INFORMATION)(FullEa->NextEntryOffset == 0 ? + &UserBuffer[UserBufferLength] : + (PCHAR)FullEa + FullEa->NextEntryOffset)) { + + int ret; + OEM_STRING EaName; + + EaName.MaximumLength = EaName.Length = FullEa->EaNameLength; + EaName.Buffer = &FullEa->EaName[0]; + + Status = Ext2WinntError(ret = + ext4_fs_set_xattr_ordered(&xattr_ref, + EXT4_XATTR_INDEX_USER, + EaName.Buffer, + EaName.Length, + &FullEa->EaName[0] + FullEa->EaNameLength + 1, + FullEa->EaValueLength)); + if (!NT_SUCCESS(Status)) + __leave; + + } + } __finally { + + if (XattrRefAcquired) { + if (!NT_SUCCESS(Status)) { + xattr_ref.dirty = FALSE; + ext4_fs_put_xattr_ref(&xattr_ref); + } else + Status = Ext2WinntError(ext4_fs_put_xattr_ref(&xattr_ref)); + } + + if (FcbLockAcquired) { + ExReleaseResourceLite(&Vcb->FcbLock); + FcbLockAcquired = FALSE; + } + + if (MainResourceAcquired) { + ExReleaseResourceLite(&Fcb->MainResource); + } + + if (NT_SUCCESS(Status)) { + Ext2NotifyReportChange( + IrpContext, + Vcb, + Mcb, + FILE_NOTIFY_CHANGE_EA, + FILE_ACTION_MODIFIED); + } + + if (!AbnormalTermination()) { + if (Status == STATUS_PENDING || Status == STATUS_CANT_WAIT) { + Status = Ext2QueueRequest(IrpContext); + } + else { + Ext2CompleteIrpContext(IrpContext, Status); + } + } + } + return Status; +} diff --git a/Ext3Fsd/ext3/generic.c b/Ext3Fsd/ext3/generic.c index c9fbf6b..b1bbe71 100755..100644 --- a/Ext3Fsd/ext3/generic.c +++ b/Ext3Fsd/ext3/generic.c @@ -464,8 +464,12 @@ void Ext2DecodeInode(struct inode *dst, struct ext3_inode *src) dst->i_mtime = src->i_mtime; dst->i_dtime = src->i_dtime; dst->i_blocks = ext3_inode_blocks(src, dst); - dst->i_extra_isize = src->i_extra_isize; memcpy(&dst->i_block[0], &src->i_block[0], sizeof(__u32) * 15); + if (EXT3_HAS_RO_COMPAT_FEATURE(dst->i_sb, + EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)) + dst->i_extra_isize = src->i_extra_isize; + else + dst->i_extra_isize = 0; } void Ext2EncodeInode(struct ext3_inode *dst, struct inode *src) @@ -490,6 +494,9 @@ void Ext2EncodeInode(struct ext3_inode *dst, struct inode *src) ASSERT(src->i_sb); ext3_inode_blocks_set(dst, src); memcpy(&dst->i_block[0], &src->i_block[0], sizeof(__u32) * 15); + if (EXT3_HAS_RO_COMPAT_FEATURE(src->i_sb, + EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)) + dst->i_extra_isize = src->i_extra_isize; } @@ -575,6 +582,74 @@ errorout: return rc; } +BOOLEAN +Ext2LoadInodeXattr(IN PEXT2_VCB Vcb, + IN struct inode *Inode, + IN PEXT2_INODE InodeXattr) +{ + IO_STATUS_BLOCK IoStatus; + LONGLONG Offset; + + if (!Ext2GetInodeLba(Vcb, Inode->i_ino, &Offset)) { + DEBUG(DL_ERR, ("Ext2LoadRawInode: error get inode(%xh)'s addr.\n", Inode->i_ino)); + return FALSE; + } + + if (!CcCopyRead( + Vcb->Volume, + (PLARGE_INTEGER)&Offset, + Vcb->InodeSize, + PIN_WAIT, + (PVOID)InodeXattr, + &IoStatus)) { + return FALSE; + } + + if (!NT_SUCCESS(IoStatus.Status)) { + return FALSE; + } + + Ext2EncodeInode(InodeXattr, Inode); + return TRUE; +} + +BOOLEAN +Ext2SaveInodeXattr(IN PEXT2_IRP_CONTEXT IrpContext, + IN PEXT2_VCB Vcb, + IN struct inode *Inode, + IN PEXT2_INODE InodeXattr) +{ + IO_STATUS_BLOCK IoStatus; + LONGLONG Offset = 0; + ULONG InodeSize = Vcb->InodeSize; + BOOLEAN rc = 0; + + /* There is no way to put EA information in such a small inode */ + if (InodeSize == EXT2_GOOD_OLD_INODE_SIZE) + return FALSE; + + DEBUG(DL_INF, ("Ext2SaveInodeXattr: Saving Inode %xh: Mode=%xh Size=%xh\n", + Inode->i_ino, Inode->i_mode, Inode->i_size)); + rc = Ext2GetInodeLba(Vcb, Inode->i_ino, &Offset); + if (!rc) { + DEBUG(DL_ERR, ("Ext2SaveInodeXattr: error get inode(%xh)'s addr.\n", Inode->i_ino)); + goto errorout; + } + + rc = Ext2SaveBuffer(IrpContext, + Vcb, + Offset + EXT2_GOOD_OLD_INODE_SIZE + Inode->i_extra_isize, + InodeSize - EXT2_GOOD_OLD_INODE_SIZE - Inode->i_extra_isize, + (char *)InodeXattr + EXT2_GOOD_OLD_INODE_SIZE + Inode->i_extra_isize); + + if (rc && IsFlagOn(Vcb->Flags, VCB_FLOPPY_DISK)) { + Ext2StartFloppyFlushDpc(Vcb, NULL, NULL); + } + +errorout: + return rc; +} + BOOLEAN Ext2LoadBlock (IN PEXT2_VCB Vcb, diff --git a/Ext3Fsd/ext3/htree.c b/Ext3Fsd/ext3/htree.c index 709f394..709f394 100755..100644 --- a/Ext3Fsd/ext3/htree.c +++ b/Ext3Fsd/ext3/htree.c diff --git a/Ext3Fsd/ext3fsd.dsp b/Ext3Fsd/ext3fsd.dsp deleted file mode 100644 index 36569c8..0000000 --- a/Ext3Fsd/ext3fsd.dsp +++ /dev/null @@ -1,701 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Ext3Fsd" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) External Target" 0x0106
-
-CFG=Ext3Fsd - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Ext3Fsd.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Ext3Fsd.mak" CFG="Ext3Fsd - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Ext3Fsd - Win32 Release" (based on "Win32 (x86) External Target")
-!MESSAGE "Ext3Fsd - Win32 Debug" (based on "Win32 (x86) External Target")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName "Ext3Fsd"
-# PROP Scc_LocalPath "."
-
-!IF "$(CFG)" == "Ext3Fsd - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "fre"
-# PROP BASE Intermediate_Dir "fre"
-# PROP BASE Cmd_Line "NMAKE /f Ext3Fsd.mak"
-# PROP BASE Rebuild_Opt "/a"
-# PROP BASE Target_File "Ext3Fsd.exe"
-# PROP BASE Bsc_Name "Ext2Fsd.bsc"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "fre"
-# PROP Intermediate_Dir "fre"
-# PROP Cmd_Line ".\DDKBuild.bat -W7XP fre ."
-# PROP Rebuild_Opt "-cZ"
-# PROP Target_File "Ext3Fsd.sys"
-# PROP Bsc_Name ".\winnet\chk\i386\Ext3Fsd.bsc"
-# PROP Target_Dir ""
-
-!ELSEIF "$(CFG)" == "Ext3Fsd - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "chk"
-# PROP BASE Intermediate_Dir "chk"
-# PROP BASE Cmd_Line "NMAKE /f Ext3Fsd.mak"
-# PROP BASE Rebuild_Opt "/a"
-# PROP BASE Target_File "Ext3Fsd.exe"
-# PROP BASE Bsc_Name "Ext2Fsd.bsc"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "chk"
-# PROP Intermediate_Dir "chk"
-# PROP Cmd_Line ".\DDKBuild.bat -W7XP chk ."
-# PROP Rebuild_Opt "-ceZ"
-# PROP Target_File "Ext2Fsd.sys"
-# PROP Bsc_Name ".\winnet\chk\i386\Ext3Fsd.bsc"
-# PROP Target_Dir ""
-
-!ENDIF
-
-# Begin Target
-
-# Name "Ext3Fsd - Win32 Release"
-# Name "Ext3Fsd - Win32 Debug"
-
-!IF "$(CFG)" == "Ext3Fsd - Win32 Release"
-
-!ELSEIF "$(CFG)" == "Ext3Fsd - Win32 Debug"
-
-!ENDIF
-
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Group "nls"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\nls\MAKEFILE
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_ascii.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_base.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp1250.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp1251.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp1255.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp437.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp737.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp775.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp850.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp852.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp855.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp857.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp860.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp861.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp862.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp863.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp864.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp865.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp866.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp869.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp874.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp932.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp936.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp949.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_cp950.c
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_euc-jp.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_iso8859-1.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_iso8859-13.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_iso8859-14.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_iso8859-15.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_iso8859-2.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_iso8859-3.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_iso8859-4.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_iso8859-5.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_iso8859-6.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_iso8859-7.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_iso8859-9.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_koi8-r.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_koi8-ru.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\nls\nls_koi8-u.c"
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\nls_utf8.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls\sources
-# End Source File
-# End Group
-# Begin Group "ext3"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\ext3\generic.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext3\htree.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext3\indirect.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext3\MAKEFILE
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext3\recover.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext3\sources
-# End Source File
-# End Group
-# Begin Group "ext4"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\ext4\ext4_bh.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext4\ext4_extents.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext4\ext4_jbd2.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext4\extents.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext4\MAKEFILE
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext4\Sources
-# End Source File
-# End Group
-# Begin Group "jbd"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\jbd\recovery.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\jbd\replay.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\jbd\revoke.c
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\access.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\block.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\cleanup.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\close.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\cmcb.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\create.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\debug.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\devctl.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dirctl.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dispatch.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\except.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\fastio.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\fileinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\flush.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\fsctl.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\init.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\linux.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\lock.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\memory.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\misc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\nls.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\pnp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\rbtree.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\read.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\shutdown.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\volinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\write.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Group "Linux"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\include\linux\atomic.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\bit_spinlock.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\bitops.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\buffer_head.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\config.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\debugfs.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\errno.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\Ext2_fs.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\ext3_fs.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\ext3_fs_i.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\ext3_fs_sb.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\ext3_jbd.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\ext4_ext.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\freezer.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\fs.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\group.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\highmem.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\init.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\jbd.h
-# End Source File
-# Begin Source File
-
-SOURCE=".\include\linux\journal-head.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\kernel.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\kthread.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\list.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\lockdep.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\log2.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\magic.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\mm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\module.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\mutex.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\nls.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\pagemap.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\poison.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\proc_fs.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\rbtree.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\sched.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\slab.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\spinlock.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\stddef.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\string.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\time.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\timer.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\types.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\linux\version.h
-# End Source File
-# End Group
-# Begin Group "asm"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\include\asm\page.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\asm\semaphore.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\asm\uaccess.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\include\common.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\ext2fs.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\ntifs.gnu.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\resource.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# Begin Source File
-
-SOURCE=.\DIRS
-# End Source File
-# Begin Source File
-
-SOURCE=.\Ext3Fsd.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\sys\MAKEFILE
-# End Source File
-# Begin Source File
-
-SOURCE=.\sys\sources
-# End Source File
-# End Group
-# Begin Group "Douments"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\COPYRIGHT.TXT
-# End Source File
-# Begin Source File
-
-SOURCE=.\FAQ.txt
-# End Source File
-# Begin Source File
-
-SOURCE=.\notes.txt
-# End Source File
-# Begin Source File
-
-SOURCE=.\readme.txt
-# End Source File
-# Begin Source File
-
-SOURCE=.\TODO.txt
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/Ext3Fsd/ext3fsd.dsw b/Ext3Fsd/ext3fsd.dsw deleted file mode 100644 index 199bc7b..0000000 --- a/Ext3Fsd/ext3fsd.dsw +++ /dev/null @@ -1,33 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "Ext3Fsd"=.\Ext3Fsd.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
- begin source code control
- Perforce Project
- .
- end source code control
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/Ext3Fsd/ext3fsd.sln b/Ext3Fsd/ext3fsd.sln deleted file mode 100755 index e42c622..0000000 --- a/Ext3Fsd/ext3fsd.sln +++ /dev/null @@ -1,28 +0,0 @@ -
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ext3Fsd", "ext3fsd.vcproj", "{2328F787-71B4-408B-8E10-B7A95BF9A110}"
-EndProject
-Global
- GlobalSection(SourceCodeControl) = preSolution
- SccNumberOfProjects = 1
- SccProjectUniqueName0 = ext3fsd.vcproj
- SccProjectName0 = Ext3Fsd
- SccLocalPath0 = .
- SccProvider0 = MSSCCI:Perforce\u0020P4\u0020SCM
- CanCheckoutShared = true
- EndGlobalSection
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {2328F787-71B4-408B-8E10-B7A95BF9A110}.Debug|Win32.ActiveCfg = Debug|Win32
- {2328F787-71B4-408B-8E10-B7A95BF9A110}.Debug|Win32.Build.0 = Debug|Win32
- {2328F787-71B4-408B-8E10-B7A95BF9A110}.Release|Win32.ActiveCfg = Release|Win32
- {2328F787-71B4-408B-8E10-B7A95BF9A110}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/Ext3Fsd/ext3fsd.vcproj b/Ext3Fsd/ext3fsd.vcproj deleted file mode 100644 index d5208d4..0000000 --- a/Ext3Fsd/ext3fsd.vcproj +++ /dev/null @@ -1,693 +0,0 @@ -<?xml version="1.0" encoding="gb2312"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="Ext3Fsd"
- ProjectGUID="{2328F787-71B4-408B-8E10-B7A95BF9A110}"
- SccProjectName="Ext3Fsd"
- SccLocalPath="."
- SccProvider="MSSCCI:Perforce P4 SCM"
- Keyword="MakeFileProj"
- TargetFrameworkVersion="0"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory=".\chk"
- IntermediateDirectory=".\chk"
- ConfigurationType="0"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCNMakeTool"
- BuildCommandLine=".\DDKBuild.bat -W7XP chk ."
- ReBuildCommandLine=".\DDKBuild.bat -W7XP chk . -ceZ"
- CleanCommandLine=""
- Output="Ext2Fsd.sys"
- PreprocessorDefinitions=""
- IncludeSearchPath=""
- ForcedIncludes=""
- AssemblySearchPath=""
- ForcedUsingAssemblies=""
- CompileAsManaged=""
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory=".\fre"
- IntermediateDirectory=".\fre"
- ConfigurationType="0"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- >
- <Tool
- Name="VCNMakeTool"
- BuildCommandLine=".\DDKBuild.bat -W7XP fre ."
- ReBuildCommandLine=".\DDKBuild.bat -W7XP fre . -cZ"
- CleanCommandLine=""
- Output="Ext3Fsd.sys"
- PreprocessorDefinitions=""
- IncludeSearchPath=""
- ForcedIncludes=""
- AssemblySearchPath=""
- ForcedUsingAssemblies=""
- CompileAsManaged=""
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
- >
- <File
- RelativePath="access.c"
- >
- </File>
- <File
- RelativePath="block.c"
- >
- </File>
- <File
- RelativePath="cleanup.c"
- >
- </File>
- <File
- RelativePath="close.c"
- >
- </File>
- <File
- RelativePath="cmcb.c"
- >
- </File>
- <File
- RelativePath="create.c"
- >
- </File>
- <File
- RelativePath="debug.c"
- >
- </File>
- <File
- RelativePath="devctl.c"
- >
- </File>
- <File
- RelativePath="dirctl.c"
- >
- </File>
- <File
- RelativePath="dispatch.c"
- >
- </File>
- <File
- RelativePath="except.c"
- >
- </File>
- <File
- RelativePath="fastio.c"
- >
- </File>
- <File
- RelativePath="fileinfo.c"
- >
- </File>
- <File
- RelativePath="flush.c"
- >
- </File>
- <File
- RelativePath="fsctl.c"
- >
- </File>
- <File
- RelativePath="init.c"
- >
- </File>
- <File
- RelativePath="linux.c"
- >
- </File>
- <File
- RelativePath="lock.c"
- >
- </File>
- <File
- RelativePath="memory.c"
- >
- </File>
- <File
- RelativePath="misc.c"
- >
- </File>
- <File
- RelativePath="nls.c"
- >
- </File>
- <File
- RelativePath="pnp.c"
- >
- </File>
- <File
- RelativePath="rbtree.c"
- >
- </File>
- <File
- RelativePath="read.c"
- >
- </File>
- <File
- RelativePath="shutdown.c"
- >
- </File>
- <File
- RelativePath="volinfo.c"
- >
- </File>
- <File
- RelativePath="write.c"
- >
- </File>
- <Filter
- Name="nls"
- >
- <File
- RelativePath="nls\MAKEFILE"
- >
- </File>
- <File
- RelativePath="nls\nls_ascii.c"
- >
- </File>
- <File
- RelativePath="nls\nls_base.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp1250.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp1251.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp1255.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp437.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp737.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp775.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp850.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp852.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp855.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp857.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp860.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp861.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp862.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp863.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp864.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp865.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp866.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp869.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp874.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp932.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp936.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp949.c"
- >
- </File>
- <File
- RelativePath="nls\nls_cp950.c"
- >
- </File>
- <File
- RelativePath="nls\nls_euc-jp.c"
- >
- </File>
- <File
- RelativePath="nls\nls_iso8859-1.c"
- >
- </File>
- <File
- RelativePath="nls\nls_iso8859-13.c"
- >
- </File>
- <File
- RelativePath="nls\nls_iso8859-14.c"
- >
- </File>
- <File
- RelativePath="nls\nls_iso8859-15.c"
- >
- </File>
- <File
- RelativePath="nls\nls_iso8859-2.c"
- >
- </File>
- <File
- RelativePath="nls\nls_iso8859-3.c"
- >
- </File>
- <File
- RelativePath="nls\nls_iso8859-4.c"
- >
- </File>
- <File
- RelativePath="nls\nls_iso8859-5.c"
- >
- </File>
- <File
- RelativePath="nls\nls_iso8859-6.c"
- >
- </File>
- <File
- RelativePath="nls\nls_iso8859-7.c"
- >
- </File>
- <File
- RelativePath="nls\nls_iso8859-9.c"
- >
- </File>
- <File
- RelativePath="nls\nls_koi8-r.c"
- >
- </File>
- <File
- RelativePath="nls\nls_koi8-ru.c"
- >
- </File>
- <File
- RelativePath="nls\nls_koi8-u.c"
- >
- </File>
- <File
- RelativePath="nls\nls_utf8.c"
- >
- </File>
- <File
- RelativePath="nls\sources"
- >
- </File>
- </Filter>
- <Filter
- Name="ext3"
- >
- <File
- RelativePath="ext3\generic.c"
- >
- </File>
- <File
- RelativePath="ext3\htree.c"
- >
- </File>
- <File
- RelativePath="ext3\indirect.c"
- >
- </File>
- <File
- RelativePath="ext3\MAKEFILE"
- >
- </File>
- <File
- RelativePath="ext3\recover.c"
- >
- </File>
- <File
- RelativePath="ext3\sources"
- >
- </File>
- </Filter>
- <Filter
- Name="ext4"
- >
- <File
- RelativePath="ext4\ext4_bh.c"
- >
- </File>
- <File
- RelativePath="ext4\ext4_extents.c"
- >
- </File>
- <File
- RelativePath="ext4\ext4_jbd2.c"
- >
- </File>
- <File
- RelativePath="ext4\extents.c"
- >
- </File>
- <File
- RelativePath="ext4\MAKEFILE"
- >
- </File>
- <File
- RelativePath="ext4\Sources"
- >
- </File>
- </Filter>
- <Filter
- Name="jbd"
- >
- <File
- RelativePath="jbd\recovery.c"
- >
- </File>
- <File
- RelativePath="jbd\replay.c"
- >
- </File>
- <File
- RelativePath="jbd\revoke.c"
- >
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl"
- >
- <File
- RelativePath="include\common.h"
- >
- </File>
- <File
- RelativePath="include\ext2fs.h"
- >
- </File>
- <File
- RelativePath="include\ntifs.gnu.h"
- >
- </File>
- <File
- RelativePath="include\resource.h"
- >
- </File>
- <Filter
- Name="Linux"
- >
- <File
- RelativePath="include\linux\atomic.h"
- >
- </File>
- <File
- RelativePath="include\linux\bit_spinlock.h"
- >
- </File>
- <File
- RelativePath="include\linux\bitops.h"
- >
- </File>
- <File
- RelativePath="include\linux\buffer_head.h"
- >
- </File>
- <File
- RelativePath="include\linux\config.h"
- >
- </File>
- <File
- RelativePath="include\linux\debugfs.h"
- >
- </File>
- <File
- RelativePath="include\linux\errno.h"
- >
- </File>
- <File
- RelativePath="include\linux\Ext2_fs.h"
- >
- </File>
- <File
- RelativePath="include\linux\ext3_fs.h"
- >
- </File>
- <File
- RelativePath="include\linux\ext3_fs_i.h"
- >
- </File>
- <File
- RelativePath="include\linux\ext3_fs_sb.h"
- >
- </File>
- <File
- RelativePath="include\linux\ext3_jbd.h"
- >
- </File>
- <File
- RelativePath="include\linux\ext4_ext.h"
- >
- </File>
- <File
- RelativePath="include\linux\freezer.h"
- >
- </File>
- <File
- RelativePath="include\linux\fs.h"
- >
- </File>
- <File
- RelativePath="include\linux\group.h"
- >
- </File>
- <File
- RelativePath="include\linux\highmem.h"
- >
- </File>
- <File
- RelativePath="include\linux\init.h"
- >
- </File>
- <File
- RelativePath="include\linux\jbd.h"
- >
- </File>
- <File
- RelativePath="include\linux\journal-head.h"
- >
- </File>
- <File
- RelativePath="include\linux\kernel.h"
- >
- </File>
- <File
- RelativePath="include\linux\kthread.h"
- >
- </File>
- <File
- RelativePath="include\linux\list.h"
- >
- </File>
- <File
- RelativePath="include\linux\lockdep.h"
- >
- </File>
- <File
- RelativePath="include\linux\log2.h"
- >
- </File>
- <File
- RelativePath="include\linux\magic.h"
- >
- </File>
- <File
- RelativePath="include\linux\mm.h"
- >
- </File>
- <File
- RelativePath="include\linux\module.h"
- >
- </File>
- <File
- RelativePath="include\linux\mutex.h"
- >
- </File>
- <File
- RelativePath="include\linux\nls.h"
- >
- </File>
- <File
- RelativePath="include\linux\pagemap.h"
- >
- </File>
- <File
- RelativePath="include\linux\poison.h"
- >
- </File>
- <File
- RelativePath="include\linux\proc_fs.h"
- >
- </File>
- <File
- RelativePath="include\linux\rbtree.h"
- >
- </File>
- <File
- RelativePath="include\linux\sched.h"
- >
- </File>
- <File
- RelativePath="include\linux\slab.h"
- >
- </File>
- <File
- RelativePath="include\linux\spinlock.h"
- >
- </File>
- <File
- RelativePath="include\linux\stddef.h"
- >
- </File>
- <File
- RelativePath="include\linux\string.h"
- >
- </File>
- <File
- RelativePath="include\linux\time.h"
- >
- </File>
- <File
- RelativePath="include\linux\timer.h"
- >
- </File>
- <File
- RelativePath="include\linux\types.h"
- >
- </File>
- <File
- RelativePath="include\linux\version.h"
- >
- </File>
- </Filter>
- <Filter
- Name="asm"
- >
- <File
- RelativePath="include\asm\page.h"
- >
- </File>
- <File
- RelativePath="include\asm\semaphore.h"
- >
- </File>
- <File
- RelativePath="include\asm\uaccess.h"
- >
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
- >
- <File
- RelativePath="DIRS"
- >
- </File>
- <File
- RelativePath="Ext3Fsd.rc"
- >
- </File>
- <File
- RelativePath="sys\MAKEFILE"
- >
- </File>
- <File
- RelativePath="sys\sources"
- >
- </File>
- </Filter>
- <Filter
- Name="Douments"
- >
- <File
- RelativePath="COPYRIGHT.TXT"
- >
- </File>
- <File
- RelativePath="FAQ.txt"
- >
- </File>
- <File
- RelativePath="notes.txt"
- >
- </File>
- <File
- RelativePath="readme.txt"
- >
- </File>
- <File
- RelativePath="TODO.txt"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/Ext3Fsd/ext4/MAKEFILE b/Ext3Fsd/ext4/MAKEFILE index 9c985f5..9c985f5 100755..100644 --- a/Ext3Fsd/ext4/MAKEFILE +++ b/Ext3Fsd/ext4/MAKEFILE diff --git a/Ext3Fsd/ext4/Sources b/Ext3Fsd/ext4/SOURCES index 7becdaf..4655235 100755..100644 --- a/Ext3Fsd/ext4/Sources +++ b/Ext3Fsd/ext4/SOURCES @@ -1,28 +1,29 @@ -#
-# Sources for Ext2 file system driver for windows
-# mattwu@163.com - http://www.ext2fsd.com
-#
-
-# Name and type of the output file:
-MAJORCOMP=ext2fsd
-MINORCOMP=ext4
-
-TARGETNAME=ext4
-TARGETTYPE=LIBRARY
-TARGETPATH=..\$(DDK_TARGET_OS)\$(DDKBUILDENV)\
-
-#
-# Visual Studio 6.0 BSC support
-# VS6.0 doesn't support new-type BSC generated by WDK
-#
-!IFDEF BROWSER_INFO_SUPPORTED
-USER_C_FLAGS = $(USER_C_FLAGS) /D__KERNEL__ /FR
-!ELSE
-USER_C_FLAGS = $(USER_C_FLAGS) /D__KERNEL__
-!ENDIF
-DRIVERTYPE=FS
-
-INCLUDES=.;..;..\include;$(DRIVER_INC_PATH);
-
-# The source code:
-SOURCES= ext4_bh.c ext4_extents.c ext4_jbd2.c extents.c
+# +# Sources for Ext2 file system driver for windows +# mattwu@163.com - http://www.ext2fsd.com +# + +# Name and type of the output file: +MAJORCOMP=ext2fsd +MINORCOMP=ext4 + +TARGETNAME=ext4 +TARGETTYPE=LIBRARY +TARGETPATH=..\$(DDK_TARGET_OS)\$(DDKBUILDENV)\ + +# +# Visual Studio 6.0 BSC support +# VS6.0 doesn't support new-type BSC generated by WDK +# +!IFDEF BROWSER_INFO_SUPPORTED +USER_C_FLAGS = $(USER_C_FLAGS) /D__KERNEL__ /FR +!ELSE +USER_C_FLAGS = $(USER_C_FLAGS) /D__KERNEL__ +!ENDIF +DRIVERTYPE=FS + +INCLUDES=.;..;..\include;$(DRIVER_INC_PATH); + +# The source code: +SOURCES= ext4_bh.c ext4_extents.c ext4_jbd2.c extents.c \ + ext4_xattr.c diff --git a/Ext3Fsd/ext4/ext4_bh.c b/Ext3Fsd/ext4/ext4_bh.c index a874bbd..a874bbd 100755..100644 --- a/Ext3Fsd/ext4/ext4_bh.c +++ b/Ext3Fsd/ext4/ext4_bh.c diff --git a/Ext3Fsd/ext4/ext4_extents.c b/Ext3Fsd/ext4/ext4_extents.c index e54fd01..e54fd01 100755..100644 --- a/Ext3Fsd/ext4/ext4_extents.c +++ b/Ext3Fsd/ext4/ext4_extents.c diff --git a/Ext3Fsd/ext4/ext4_jbd2.c b/Ext3Fsd/ext4/ext4_jbd2.c index 9f1d2a4..9f1d2a4 100755..100644 --- a/Ext3Fsd/ext4/ext4_jbd2.c +++ b/Ext3Fsd/ext4/ext4_jbd2.c diff --git a/Ext3Fsd/ext4/ext4_xattr.c b/Ext3Fsd/ext4/ext4_xattr.c new file mode 100644 index 0000000..0cf333a --- /dev/null +++ b/Ext3Fsd/ext4/ext4_xattr.c @@ -0,0 +1,1295 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public Licens + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111- + */ + +#include <ext2fs.h> +#include <linux/module.h> +#include <linux/ext4_xattr.h> + +static ext4_fsblk_t ext4_new_meta_blocks(void *icb, struct inode *inode, + ext4_fsblk_t goal, + unsigned int flags, + unsigned long *count, int *errp) +{ + NTSTATUS status; + ULONG blockcnt = (count) ? *count : 1; + ULONG block = 0; + + status = Ext2NewBlock((PEXT2_IRP_CONTEXT)icb, + inode->i_sb->s_priv, + 0, goal, + &block, + &blockcnt); + if (count) + *count = blockcnt; + + if (!NT_SUCCESS(status)) { + *errp = Ext2LinuxError(status); + return 0; + } + inode->i_blocks += (blockcnt * (inode->i_sb->s_blocksize >> 9)); + return block; +} + +static void ext4_free_blocks(void *icb, struct inode *inode, + ext4_fsblk_t block, int count, int flags) +{ + Ext2FreeBlock((PEXT2_IRP_CONTEXT)icb, inode->i_sb->s_priv, block, count); + inode->i_blocks -= count * (inode->i_sb->s_blocksize >> 9); + return; +} + +static inline ext4_fsblk_t ext4_inode_to_goal_block(struct inode *inode) +{ + PEXT2_VCB Vcb; + Vcb = inode->i_sb->s_priv; + return (inode->i_ino - 1) / BLOCKS_PER_GROUP; +} + +#define NAME_HASH_SHIFT 5 +#define VALUE_HASH_SHIFT 16 + +static inline void ext4_xattr_compute_hash(struct ext4_xattr_header *header, + struct ext4_xattr_entry *entry) +{ + __u32 hash = 0; + char *name = EXT4_XATTR_NAME(entry); + int n; + + for (n = 0; n < entry->e_name_len; n++) { + hash = (hash << NAME_HASH_SHIFT) ^ + (hash >> (8 * sizeof(hash) - NAME_HASH_SHIFT)) ^ *name++; + } + + if (entry->e_value_block == 0 && entry->e_value_size != 0) { + __le32 *value = + (__le32 *)((char *)header + le16_to_cpu(entry->e_value_offs)); + for (n = (le32_to_cpu(entry->e_value_size) + EXT4_XATTR_ROUND) >> + EXT4_XATTR_PAD_BITS; + n; n--) { + hash = (hash << VALUE_HASH_SHIFT) ^ + (hash >> (8 * sizeof(hash) - VALUE_HASH_SHIFT)) ^ + le32_to_cpu(*value++); + } + } + entry->e_hash = cpu_to_le32(hash); +} + +#define BLOCK_HASH_SHIFT 16 + +/* + * ext4_xattr_rehash() + * + * Re-compute the extended attribute hash value after an entry has changed. + */ +static void ext4_xattr_rehash(struct ext4_xattr_header *header, + struct ext4_xattr_entry *entry) +{ + struct ext4_xattr_entry *here; + __u32 hash = 0; + + ext4_xattr_compute_hash(header, entry); + here = EXT4_XATTR_ENTRY(header + 1); + while (!EXT4_XATTR_IS_LAST_ENTRY(here)) { + if (!here->e_hash) { + /* Block is not shared if an entry's hash value == 0 */ + hash = 0; + break; + } + hash = (hash << BLOCK_HASH_SHIFT) ^ + (hash >> (8 * sizeof(hash) - BLOCK_HASH_SHIFT)) ^ + le32_to_cpu(here->e_hash); + here = EXT4_XATTR_NEXT(here); + } + header->h_hash = cpu_to_le32(hash); +} + +#if CONFIG_META_CSUM_ENABLE +static __u32 +ext4_xattr_block_checksum(PEXT2_MCB inode_ref, + ext4_fsblk_t blocknr, + struct ext4_xattr_header *header) +{ + __u32 checksum = 0; + __u64 le64_blocknr = blocknr; + struct ext4_sblock *sb = &inode_ref->fs->sb; + + if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) { + __u32 orig_checksum; + + /* Preparation: temporarily set bg checksum to 0 */ + orig_checksum = header->h_checksum; + header->h_checksum = 0; + /* First calculate crc32 checksum against fs uuid */ + checksum = ext4_crc32c(EXT4_CRC32_INIT, sb->uuid, + sizeof(sb->uuid)); + /* Then calculate crc32 checksum block number */ + checksum = ext4_crc32c(checksum, &le64_blocknr, + sizeof(le64_blocknr)); + /* Finally calculate crc32 checksum against + * the entire xattr block */ + checksum = ext4_crc32c(checksum, header, + ext4_sb_get_block_size(sb)); + header->h_checksum = orig_checksum; + } + return checksum; +} +#else +#define ext4_xattr_block_checksum(...) 0 +#endif + +static void +ext4_xattr_set_block_checksum(PEXT2_MCB inode_ref, + ext4_fsblk_t blocknr, + struct ext4_xattr_header *header) +{ + /* TODO: Need METADATA_CSUM supports. */ + header->h_checksum = 0; +} + +static int ext4_xattr_item_cmp(struct rb_node *_a, + struct rb_node *_b) +{ + int result; + struct ext4_xattr_item *a, *b; + a = container_of(_a, struct ext4_xattr_item, node); + a = container_of(_a, struct ext4_xattr_item, node); + b = container_of(_b, struct ext4_xattr_item, node); + + if (a->is_data && !b->is_data) + return -1; + + if (!a->is_data && b->is_data) + return 1; + + result = a->name_index - b->name_index; + if (result) + return result; + + if (a->name_len < b->name_len) + return -1; + + if (a->name_len > b->name_len) + return 1; + + return memcmp(a->name, b->name, a->name_len); +} + +// +// Red-black tree insert routine. +// + +static struct ext4_xattr_item * +ext4_xattr_item_search(struct ext4_xattr_ref *xattr_ref, + struct ext4_xattr_item *name) +{ + struct rb_node *new = xattr_ref->root.rb_node; + + while (new) { + struct ext4_xattr_item *node = + container_of(new, struct ext4_xattr_item, node); + int result = ext4_xattr_item_cmp(&name->node, new); + + if (result < 0) + new = new->rb_left; + else if (result > 0) + new = new->rb_right; + else + return node; + + } + + return NULL; +} + +static void ext4_xattr_item_insert(struct ext4_xattr_ref *xattr_ref, + struct ext4_xattr_item *item) +{ + rb_insert(&xattr_ref->root, &item->node, + ext4_xattr_item_cmp); + list_add_tail(&item->list_node, &xattr_ref->ordered_list); +} + +static void ext4_xattr_item_remove(struct ext4_xattr_ref *xattr_ref, + struct ext4_xattr_item *item) +{ + rb_erase(&item->node, &xattr_ref->root); + list_del_init(&item->list_node); +} + +static struct ext4_xattr_item * +ext4_xattr_item_alloc(__u8 name_index, const char *name, size_t name_len) +{ + struct ext4_xattr_item *item; + item = kzalloc(sizeof(struct ext4_xattr_item) + name_len, GFP_NOFS); + if (!item) + return NULL; + + item->name_index = name_index; + item->name = (char *)(item + 1); + item->name_len = name_len; + item->data = NULL; + item->data_size = 0; + INIT_LIST_HEAD(&item->list_node); + + memcpy(item->name, name, name_len); + + if (name_index == EXT4_XATTR_INDEX_SYSTEM && + name_len == 4 && + !memcmp(name, "data", 4)) + item->is_data = TRUE; + else + item->is_data = FALSE; + + return item; +} + +static int ext4_xattr_item_alloc_data(struct ext4_xattr_item *item, + const void *orig_data, size_t data_size) +{ + void *data = NULL; + ASSERT(!item->data); + data = kmalloc(data_size, GFP_NOFS); + if (!data) + return -ENOMEM; + + if (orig_data) + memcpy(data, orig_data, data_size); + + item->data = data; + item->data_size = data_size; + return 0; +} + +static void ext4_xattr_item_free_data(struct ext4_xattr_item *item) +{ + ASSERT(item->data); + kfree(item->data); + item->data = NULL; + item->data_size = 0; +} + +static int ext4_xattr_item_resize_data(struct ext4_xattr_item *item, + size_t new_data_size) +{ + if (new_data_size != item->data_size) { + void *new_data; + new_data = kmalloc(new_data_size, GFP_NOFS); + if (!new_data) + return -ENOMEM; + + memcpy(new_data, item->data, item->data_size); + kfree(item->data); + + item->data = new_data; + item->data_size = new_data_size; + } + return 0; +} + +static void ext4_xattr_item_free(struct ext4_xattr_item *item) +{ + if (item->data) + ext4_xattr_item_free_data(item); + + kfree(item); +} + +static void *ext4_xattr_entry_data(struct ext4_xattr_ref *xattr_ref, + struct ext4_xattr_entry *entry, + BOOL in_inode) +{ + char *ret; + int block_size; + if (in_inode) { + struct ext4_xattr_ibody_header *header; + struct ext4_xattr_entry *first_entry; + int inode_size = xattr_ref->fs->InodeSize; + header = EXT4_XATTR_IHDR(xattr_ref->OnDiskInode); + first_entry = EXT4_XATTR_IFIRST(header); + + ret = ((char *)first_entry + le16_to_cpu(entry->e_value_offs)); + if (ret + EXT4_XATTR_SIZE(le32_to_cpu(entry->e_value_size)) - + (char *)xattr_ref->OnDiskInode > inode_size) + ret = NULL; + + return ret; + + } + block_size = xattr_ref->fs->BlockSize; + ret = ((char *)xattr_ref->block_bh->b_data + le16_to_cpu(entry->e_value_offs)); + if (ret + EXT4_XATTR_SIZE(le32_to_cpu(entry->e_value_size)) - + (char *)xattr_ref->block_bh->b_data > block_size) + ret = NULL; + return ret; +} + +static int ext4_xattr_block_fetch(struct ext4_xattr_ref *xattr_ref) +{ + int ret = 0; + size_t size_rem; + void *data; + struct ext4_xattr_entry *entry = NULL; + + ASSERT(xattr_ref->block_bh->b_data); + entry = EXT4_XATTR_BFIRST(xattr_ref->block_bh); + + size_rem = xattr_ref->fs->BlockSize; + for (; size_rem > 0 && !EXT4_XATTR_IS_LAST_ENTRY(entry); + entry = EXT4_XATTR_NEXT(entry), + size_rem -= EXT4_XATTR_LEN(entry->e_name_len)) { + struct ext4_xattr_item *item; + char *e_name = EXT4_XATTR_NAME(entry); + + data = ext4_xattr_entry_data(xattr_ref, entry, FALSE); + if (!data) { + ret = -EIO; + goto Finish; + } + + item = ext4_xattr_item_alloc(entry->e_name_index, e_name, + (size_t)entry->e_name_len); + if (!item) { + ret = -ENOMEM; + goto Finish; + } + if (ext4_xattr_item_alloc_data( + item, data, le32_to_cpu(entry->e_value_size)) != 0) { + ext4_xattr_item_free(item); + ret = -ENOMEM; + goto Finish; + } + ext4_xattr_item_insert(xattr_ref, item); + xattr_ref->block_size_rem -= + EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len); + xattr_ref->ea_size += EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len); + } + +Finish: + return ret; +} + +static int ext4_xattr_inode_fetch(struct ext4_xattr_ref *xattr_ref) +{ + void *data; + size_t size_rem; + int ret = 0; + struct ext4_xattr_ibody_header *header = NULL; + struct ext4_xattr_entry *entry = NULL; + int inode_size = xattr_ref->fs->InodeSize; + + header = EXT4_XATTR_IHDR(xattr_ref->OnDiskInode); + entry = EXT4_XATTR_IFIRST(header); + + size_rem = inode_size - EXT4_GOOD_OLD_INODE_SIZE - + xattr_ref->OnDiskInode->i_extra_isize; + for (; size_rem > 0 && !EXT4_XATTR_IS_LAST_ENTRY(entry); + entry = EXT4_XATTR_NEXT(entry), + size_rem -= EXT4_XATTR_LEN(entry->e_name_len)) { + struct ext4_xattr_item *item; + char *e_name = EXT4_XATTR_NAME(entry); + + data = ext4_xattr_entry_data(xattr_ref, entry, TRUE); + if (!data) { + ret = -EIO; + goto Finish; + } + + item = ext4_xattr_item_alloc(entry->e_name_index, e_name, + (size_t)entry->e_name_len); + if (!item) { + ret = -ENOMEM; + goto Finish; + } + if (ext4_xattr_item_alloc_data( + item, data, le32_to_cpu(entry->e_value_size)) != 0) { + ext4_xattr_item_free(item); + ret = -ENOMEM; + goto Finish; + } + item->in_inode = TRUE; + ext4_xattr_item_insert(xattr_ref, item); + xattr_ref->inode_size_rem -= + EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len); + xattr_ref->ea_size += EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len); + } + +Finish: + return ret; +} + +static __s32 ext4_xattr_inode_space(struct ext4_xattr_ref *xattr_ref) +{ + int inode_size = xattr_ref->fs->InodeSize; + int size_rem = inode_size - EXT4_GOOD_OLD_INODE_SIZE - + xattr_ref->OnDiskInode->i_extra_isize; + return size_rem; +} + +static __s32 ext4_xattr_block_space(struct ext4_xattr_ref *xattr_ref) +{ + return xattr_ref->fs->BlockSize; +} + +static int ext4_xattr_fetch(struct ext4_xattr_ref *xattr_ref) +{ + int ret = 0; + int inode_size = xattr_ref->fs->InodeSize; + if (inode_size > EXT4_GOOD_OLD_INODE_SIZE) { + ret = ext4_xattr_inode_fetch(xattr_ref); + if (ret != 0) + return ret; + } + + if (xattr_ref->block_loaded) + ret = ext4_xattr_block_fetch(xattr_ref); + + xattr_ref->dirty = FALSE; + return ret; +} + +static struct ext4_xattr_item * +ext4_xattr_lookup_item(struct ext4_xattr_ref *xattr_ref, __u8 name_index, + const char *name, size_t name_len) +{ + struct ext4_xattr_item tmp = { + FALSE, + FALSE, + name_index, + (char *)name, /*won't touch this string*/ + name_len, + }; + if (name_index == EXT4_XATTR_INDEX_SYSTEM && + name_len == 4 && + !memcmp(name, "data", 4)) + tmp.is_data = TRUE; + + return ext4_xattr_item_search(xattr_ref, &tmp); +} + +static struct ext4_xattr_item * +ext4_xattr_insert_item(struct ext4_xattr_ref *xattr_ref, __u8 name_index, + const char *name, size_t name_len, const void *data, + size_t data_size, + int *err) +{ + struct ext4_xattr_item *item; + item = ext4_xattr_item_alloc(name_index, name, name_len); + if (!item) { + if (err) + *err = -ENOMEM; + + return NULL; + } + + item->in_inode = TRUE; + if (xattr_ref->inode_size_rem < + EXT4_XATTR_SIZE(data_size) + + EXT4_XATTR_LEN(item->name_len)) { + if (xattr_ref->block_size_rem < + EXT4_XATTR_SIZE(data_size) + + EXT4_XATTR_LEN(item->name_len)) { + if (err) + *err = -ENOSPC; + + return NULL; + } + + item->in_inode = FALSE; + } + if (ext4_xattr_item_alloc_data(item, data, data_size) != 0) { + ext4_xattr_item_free(item); + if (err) + *err = -ENOMEM; + + return NULL; + } + ext4_xattr_item_insert(xattr_ref, item); + xattr_ref->ea_size += + EXT4_XATTR_SIZE(item->data_size) + EXT4_XATTR_LEN(item->name_len); + if (item->in_inode) { + xattr_ref->inode_size_rem -= + EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len); + } else { + xattr_ref->block_size_rem -= + EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len); + } + xattr_ref->dirty = TRUE; + if (err) + *err = 0; + + return item; +} + +static struct ext4_xattr_item * +ext4_xattr_insert_item_ordered(struct ext4_xattr_ref *xattr_ref, __u8 name_index, + const char *name, size_t name_len, const void *data, + size_t data_size, + int *err) +{ + struct ext4_xattr_item *item, *last_item = NULL; + item = ext4_xattr_item_alloc(name_index, name, name_len); + if (!item) { + if (err) + *err = -ENOMEM; + + return NULL; + } + + if (!list_empty(&xattr_ref->ordered_list)) + last_item = list_entry(xattr_ref->ordered_list.prev, + struct ext4_xattr_item, + list_node); + + item->in_inode = TRUE; + if ((xattr_ref->inode_size_rem < + EXT4_XATTR_SIZE(data_size) + + EXT4_XATTR_LEN(item->name_len)) + || + (last_item && !last_item->in_inode)) { + if (xattr_ref->block_size_rem < + EXT4_XATTR_SIZE(data_size) + + EXT4_XATTR_LEN(item->name_len)) { + if (err) + *err = -ENOSPC; + + return NULL; + } + + item->in_inode = FALSE; + } + if (ext4_xattr_item_alloc_data(item, data, data_size) != 0) { + ext4_xattr_item_free(item); + if (err) + *err = -ENOMEM; + + return NULL; + } + ext4_xattr_item_insert(xattr_ref, item); + xattr_ref->ea_size += + EXT4_XATTR_SIZE(item->data_size) + EXT4_XATTR_LEN(item->name_len); + if (item->in_inode) { + xattr_ref->inode_size_rem -= + EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len); + } + else { + xattr_ref->block_size_rem -= + EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len); + } + xattr_ref->dirty = TRUE; + if (err) + *err = 0; + + return item; +} + +static int ext4_xattr_remove_item(struct ext4_xattr_ref *xattr_ref, + __u8 name_index, const char *name, + size_t name_len) +{ + int ret = -ENOENT; + struct ext4_xattr_item *item = + ext4_xattr_lookup_item(xattr_ref, name_index, name, name_len); + if (item) { + if (item == xattr_ref->iter_from) { + struct rb_node *next_node; + next_node = rb_next(&item->node); + if (next_node) + xattr_ref->iter_from = + container_of(next_node, + struct ext4_xattr_item, + node); + else + xattr_ref->iter_from = NULL; + } + + xattr_ref->ea_size -= EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len); + + if (item->in_inode) { + xattr_ref->inode_size_rem += + EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len); + } else { + xattr_ref->block_size_rem += + EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len); + } + + ext4_xattr_item_remove(xattr_ref, item); + ext4_xattr_item_free(item); + xattr_ref->dirty = TRUE; + ret = 0; + } + return ret; +} + +static int ext4_xattr_resize_item(struct ext4_xattr_ref *xattr_ref, + struct ext4_xattr_item *item, + size_t new_data_size) +{ + int ret = 0; + BOOL to_inode = FALSE, to_block = FALSE; + size_t old_data_size = item->data_size; + size_t orig_room_size = item->in_inode ? + xattr_ref->inode_size_rem : + xattr_ref->block_size_rem; + + /* + * Check if we can hold this entry in both in-inode and + * on-block form + * + * More complicated case: we do not allow entries stucking in + * the middle between in-inode space and on-block space, so + * the entry has to stay in either inode space or block space. + */ + if (item->in_inode) { + if (xattr_ref->inode_size_rem + + EXT4_XATTR_SIZE(old_data_size) < + EXT4_XATTR_SIZE(new_data_size)) { + if (xattr_ref->block_size_rem < + EXT4_XATTR_SIZE(new_data_size) + + EXT4_XATTR_LEN(item->name_len)) + return -ENOSPC; + + to_block = TRUE; + } + } else { + if (xattr_ref->block_size_rem + + EXT4_XATTR_SIZE(old_data_size) < + EXT4_XATTR_SIZE(new_data_size)) { + if (xattr_ref->inode_size_rem < + EXT4_XATTR_SIZE(new_data_size) + + EXT4_XATTR_LEN(item->name_len)) + return -ENOSPC; + + to_inode = TRUE; + } + } + ret = ext4_xattr_item_resize_data(item, new_data_size); + if (ret) + return ret; + + xattr_ref->ea_size = + xattr_ref->ea_size - + EXT4_XATTR_SIZE(old_data_size) + + EXT4_XATTR_SIZE(new_data_size); + + /* + * This entry may originally lie in inode space or block space, + * and it is going to be transferred to another place. + */ + if (to_block) { + xattr_ref->inode_size_rem += + EXT4_XATTR_SIZE(old_data_size) + + EXT4_XATTR_LEN(item->name_len); + xattr_ref->block_size_rem -= + EXT4_XATTR_SIZE(new_data_size) + + EXT4_XATTR_LEN(item->name_len); + item->in_inode = FALSE; + } else if (to_inode) { + xattr_ref->block_size_rem += + EXT4_XATTR_SIZE(old_data_size) + + EXT4_XATTR_LEN(item->name_len); + xattr_ref->inode_size_rem -= + EXT4_XATTR_SIZE(new_data_size) + + EXT4_XATTR_LEN(item->name_len); + item->in_inode = TRUE; + } else { + /* + * No need to transfer as there is enough space for the entry + * to stay in inode space or block space it used to be. + */ + orig_room_size += + EXT4_XATTR_SIZE(old_data_size); + orig_room_size -= + EXT4_XATTR_SIZE(new_data_size); + if (item->in_inode) + xattr_ref->inode_size_rem = orig_room_size; + else + xattr_ref->block_size_rem = orig_room_size; + + } + xattr_ref->dirty = TRUE; + return ret; +} + +void ext4_xattr_purge_items(struct ext4_xattr_ref *xattr_ref) +{ + struct rb_node *first_node; + struct ext4_xattr_item *item = NULL; + first_node = rb_first(&xattr_ref->root); + if (first_node) + item = container_of(first_node, struct ext4_xattr_item, + node); + + while (item) { + struct rb_node *next_node; + struct ext4_xattr_item *next_item = NULL; + next_node = rb_next(&item->node); + if (next_node) + next_item = container_of(next_node, struct ext4_xattr_item, + node); + else + next_item = NULL; + + ext4_xattr_item_remove(xattr_ref, item); + ext4_xattr_item_free(item); + + item = next_item; + } + xattr_ref->ea_size = 0; + if (ext4_xattr_inode_space(xattr_ref) < + sizeof(struct ext4_xattr_ibody_header)) + xattr_ref->inode_size_rem = 0; + else + xattr_ref->inode_size_rem = + ext4_xattr_inode_space(xattr_ref) - + sizeof(struct ext4_xattr_ibody_header); + + xattr_ref->block_size_rem = + ext4_xattr_block_space(xattr_ref) - + sizeof(struct ext4_xattr_header); +} + +static int ext4_xattr_try_alloc_block(struct ext4_xattr_ref *xattr_ref) +{ + int ret = 0; + + ext4_fsblk_t xattr_block = 0; + xattr_block = xattr_ref->inode_ref->Inode.i_file_acl; + if (!xattr_block) { + ext4_fsblk_t goal = + ext4_inode_to_goal_block(&xattr_ref->inode_ref->Inode); + + xattr_block = ext4_new_meta_blocks(xattr_ref->IrpContext, + &xattr_ref->inode_ref->Inode, + goal, 0, NULL, + &ret); + if (ret != 0) + goto Finish; + + xattr_ref->block_bh = extents_bwrite(&xattr_ref->fs->sb, xattr_block); + if (!xattr_ref->block_bh) { + ext4_free_blocks(xattr_ref->IrpContext, &xattr_ref->inode_ref->Inode, + xattr_block, 1, 0); + ret = -ENOMEM; + goto Finish; + } + + xattr_ref->inode_ref->Inode.i_file_acl = xattr_block; + xattr_ref->IsOnDiskInodeDirty = TRUE; + xattr_ref->block_loaded = TRUE; + } + +Finish: + return ret; +} + +static void ext4_xattr_try_free_block(struct ext4_xattr_ref *xattr_ref) +{ + ext4_fsblk_t xattr_block; + xattr_block = xattr_ref->inode_ref->Inode.i_file_acl; + xattr_ref->inode_ref->Inode.i_file_acl = 0; + extents_brelse(xattr_ref->block_bh); + xattr_ref->block_bh = NULL; + ext4_free_blocks(xattr_ref->IrpContext, &xattr_ref->inode_ref->Inode, + xattr_block, 1, 0); + xattr_ref->IsOnDiskInodeDirty = TRUE; + xattr_ref->block_loaded = FALSE; +} + +static void ext4_xattr_set_block_header(struct ext4_xattr_ref *xattr_ref) +{ + struct ext4_xattr_header *block_header = NULL; + block_header = EXT4_XATTR_BHDR(xattr_ref->block_bh); + + memset(block_header, 0, sizeof(struct ext4_xattr_header)); + block_header->h_magic = EXT4_XATTR_MAGIC; + block_header->h_refcount = cpu_to_le32(1); + block_header->h_blocks = cpu_to_le32(1); +} + +static void +ext4_xattr_set_inode_entry(struct ext4_xattr_item *item, + struct ext4_xattr_ibody_header *ibody_header, + struct ext4_xattr_entry *entry, void *ibody_data_ptr) +{ + entry->e_name_len = (__u8)item->name_len; + entry->e_name_index = item->name_index; + entry->e_value_offs = + cpu_to_le16((char *)ibody_data_ptr - (char *)EXT4_XATTR_IFIRST(ibody_header)); + entry->e_value_block = 0; + entry->e_value_size = cpu_to_le32(item->data_size); +} + +static void ext4_xattr_set_block_entry(struct ext4_xattr_item *item, + struct ext4_xattr_header *block_header, + struct ext4_xattr_entry *block_entry, + void *block_data_ptr) +{ + block_entry->e_name_len = (__u8)item->name_len; + block_entry->e_name_index = item->name_index; + block_entry->e_value_offs = + cpu_to_le16((char *)block_data_ptr - (char *)block_header); + block_entry->e_value_block = 0; + block_entry->e_value_size = cpu_to_le32(item->data_size); +} + +static int ext4_xattr_write_to_disk(struct ext4_xattr_ref *xattr_ref) +{ + int ret = 0; + BOOL block_modified = FALSE; + void *ibody_data = NULL; + void *block_data = NULL; + __s32 inode_size_rem, block_size_rem; + struct ext4_xattr_ibody_header *ibody_header = NULL; + struct ext4_xattr_header *block_header = NULL; + struct ext4_xattr_entry *entry = NULL; + struct ext4_xattr_entry *block_entry = NULL; + struct ext4_xattr_item *item = NULL; + + inode_size_rem = ext4_xattr_inode_space(xattr_ref); + block_size_rem = ext4_xattr_block_space(xattr_ref); + if (inode_size_rem > sizeof(struct ext4_xattr_ibody_header)) { + ibody_header = EXT4_XATTR_IHDR(xattr_ref->OnDiskInode); + entry = EXT4_XATTR_IFIRST(ibody_header); + } + + if (!xattr_ref->dirty) + goto Finish; + /* If there are enough spaces in the ibody EA table.*/ + if (inode_size_rem > sizeof(struct ext4_xattr_ibody_header)) { + memset(ibody_header, 0, inode_size_rem); + ibody_header->h_magic = EXT4_XATTR_MAGIC; + ibody_data = (char *)ibody_header + inode_size_rem; + inode_size_rem -= sizeof(struct ext4_xattr_ibody_header); + + xattr_ref->IsOnDiskInodeDirty = TRUE; + } + /* If we need an extra block to hold the EA entries*/ + if (xattr_ref->ea_size > inode_size_rem) { + if (!xattr_ref->block_loaded) { + ret = ext4_xattr_try_alloc_block(xattr_ref); + if (ret != 0) + goto Finish; + } + memset(xattr_ref->block_bh->b_data, 0, xattr_ref->fs->BlockSize); + block_header = EXT4_XATTR_BHDR(xattr_ref->block_bh); + block_entry = EXT4_XATTR_BFIRST(xattr_ref->block_bh); + ext4_xattr_set_block_header(xattr_ref); + block_data = (char *)block_header + block_size_rem; + block_size_rem -= sizeof(struct ext4_xattr_header); + + extents_mark_buffer_dirty(xattr_ref->block_bh); + } else { + /* We don't need an extra block.*/ + if (xattr_ref->block_loaded) { + block_header = EXT4_XATTR_BHDR(xattr_ref->block_bh); + le32_add_cpu(&block_header->h_refcount, -1); + if (!block_header->h_refcount) { + ext4_xattr_try_free_block(xattr_ref); + block_header = NULL; + } else { + block_entry = + EXT4_XATTR_BFIRST(xattr_ref->block_bh); + block_data = + (char *)block_header + block_size_rem; + block_size_rem -= + sizeof(struct ext4_xattr_header); + xattr_ref->inode_ref->Inode.i_file_acl = 0; + + xattr_ref->IsOnDiskInodeDirty = TRUE; + extents_mark_buffer_dirty(xattr_ref->block_bh); + } + } + } + + list_for_each_entry(item, &xattr_ref->ordered_list, struct ext4_xattr_item, list_node) { + if (item->in_inode) { + ibody_data = (char *)ibody_data - + EXT4_XATTR_SIZE(item->data_size); + ext4_xattr_set_inode_entry(item, ibody_header, entry, + ibody_data); + memcpy(EXT4_XATTR_NAME(entry), item->name, + item->name_len); + memcpy(ibody_data, item->data, item->data_size); + entry = EXT4_XATTR_NEXT(entry); + inode_size_rem -= EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len); + + xattr_ref->IsOnDiskInodeDirty = TRUE; + continue; + } + if (EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len) > + block_size_rem) { + ret = -ENOSPC; + DbgPrint("ext4_xattr.c: IMPOSSIBLE -ENOSPC AS WE DID INSPECTION!\n"); + ASSERT(0); + } + block_data = + (char *)block_data - EXT4_XATTR_SIZE(item->data_size); + ext4_xattr_set_block_entry(item, block_header, block_entry, + block_data); + memcpy(EXT4_XATTR_NAME(block_entry), item->name, + item->name_len); + memcpy(block_data, item->data, item->data_size); + ext4_xattr_compute_hash(block_header, block_entry); + block_entry = EXT4_XATTR_NEXT(block_entry); + block_size_rem -= EXT4_XATTR_SIZE(item->data_size) + + EXT4_XATTR_LEN(item->name_len); + + block_modified = TRUE; + } + xattr_ref->dirty = FALSE; + if (block_modified) { + ext4_xattr_rehash(block_header, + EXT4_XATTR_BFIRST(xattr_ref->block_bh)); + ext4_xattr_set_block_checksum(xattr_ref->inode_ref, + xattr_ref->block_bh->b_blocknr, + block_header); + extents_mark_buffer_dirty(xattr_ref->block_bh); + } + +Finish: + return ret; +} + +void ext4_fs_xattr_iterate(struct ext4_xattr_ref *ref, + int (*iter)(struct ext4_xattr_ref *ref, + struct ext4_xattr_item *item, + BOOL is_last)) +{ + struct ext4_xattr_item *item; + if (!ref->iter_from) { + struct list_head *first_node; + first_node = ref->ordered_list.next; + if (first_node && first_node != &ref->ordered_list) { + ref->iter_from = + list_entry(first_node, + struct ext4_xattr_item, + list_node); + } + } + + item = ref->iter_from; + while (item) { + struct list_head *next_node; + struct ext4_xattr_item *next_item; + int ret = EXT4_XATTR_ITERATE_CONT; + next_node = item->list_node.next; + if (next_node && next_node != &ref->ordered_list) + next_item = list_entry(next_node, struct ext4_xattr_item, + list_node); + else + next_item = NULL; + if (iter) + ret = iter(ref, item, !next_item); + + if (ret != EXT4_XATTR_ITERATE_CONT) { + if (ret == EXT4_XATTR_ITERATE_STOP) + ref->iter_from = NULL; + + break; + } + item = next_item; + } +} + +void ext4_fs_xattr_iterate_reset(struct ext4_xattr_ref *ref) +{ + ref->iter_from = NULL; +} + +int ext4_fs_set_xattr(struct ext4_xattr_ref *ref, __u8 name_index, + const char *name, size_t name_len, const void *data, + size_t data_size, BOOL replace) +{ + int ret = 0; + struct ext4_xattr_item *item = + ext4_xattr_lookup_item(ref, name_index, name, name_len); + if (replace) { + if (!item) { + ret = -ENODATA; + goto Finish; + } + if (item->data_size != data_size) + ret = ext4_xattr_resize_item(ref, item, data_size); + + if (ret != 0) { + goto Finish; + } + memcpy(item->data, data, data_size); + } else { + if (item) { + ret = -EEXIST; + goto Finish; + } + item = ext4_xattr_insert_item(ref, name_index, name, name_len, + data, data_size, &ret); + } +Finish: + return ret; +} + +int ext4_fs_set_xattr_ordered(struct ext4_xattr_ref *ref, __u8 name_index, + const char *name, size_t name_len, const void *data, + size_t data_size) +{ + int ret = 0; + struct ext4_xattr_item *item = + ext4_xattr_lookup_item(ref, name_index, name, name_len); + if (item) { + ret = -EEXIST; + goto Finish; + } + item = ext4_xattr_insert_item_ordered(ref, name_index, name, name_len, + data, data_size, &ret); +Finish: + return ret; +} + +int ext4_fs_remove_xattr(struct ext4_xattr_ref *ref, __u8 name_index, + const char *name, size_t name_len) +{ + return ext4_xattr_remove_item(ref, name_index, name, name_len); +} + +int ext4_fs_get_xattr(struct ext4_xattr_ref *ref, __u8 name_index, + const char *name, size_t name_len, void *buf, + size_t buf_size, size_t *data_size) +{ + int ret = 0; + size_t item_size = 0; + struct ext4_xattr_item *item = + ext4_xattr_lookup_item(ref, name_index, name, name_len); + + if (!item) { + ret = -ENODATA; + goto Finish; + } + item_size = item->data_size; + if (buf_size > item_size) + buf_size = item_size; + + if (buf) + memcpy(buf, item->data, buf_size); + +Finish: + if (data_size) + *data_size = item_size; + + return ret; +} + +int ext4_fs_get_xattr_ref(PEXT2_IRP_CONTEXT IrpContext, PEXT2_VCB fs, PEXT2_MCB inode_ref, + struct ext4_xattr_ref *ref) +{ + int rc; + ext4_fsblk_t xattr_block; + xattr_block = inode_ref->Inode.i_file_acl; + memset(&ref->root, 0, sizeof(struct rb_root)); + ref->ea_size = 0; + ref->iter_from = NULL; + if (xattr_block) { + ref->block_bh = extents_bread(&fs->sb, xattr_block); + if (!ref->block_bh) + return -EIO; + + ref->block_loaded = TRUE; + } else + ref->block_loaded = FALSE; + + ref->inode_ref = inode_ref; + ref->fs = fs; + INIT_LIST_HEAD(&ref->ordered_list); + + ref->OnDiskInode = Ext2AllocateInode(fs); + if (!ref->OnDiskInode) { + if (xattr_block) { + extents_brelse(ref->block_bh); + ref->block_bh = NULL; + } + return -ENOMEM; + } + if (!Ext2LoadInodeXattr(fs, &inode_ref->Inode, ref->OnDiskInode)) { + if (xattr_block) { + extents_brelse(ref->block_bh); + ref->block_bh = NULL; + } + + Ext2DestroyInode(fs, ref->OnDiskInode); + return -EIO; + } + ref->IsOnDiskInodeDirty = FALSE; + + if (ext4_xattr_inode_space(ref) < + sizeof(struct ext4_xattr_ibody_header) + + sizeof(__u32)) + ref->inode_size_rem = 0; + else { + ref->inode_size_rem = + ext4_xattr_inode_space(ref) - + sizeof(struct ext4_xattr_ibody_header); + } + + ref->block_size_rem = + ext4_xattr_block_space(ref) - + sizeof(struct ext4_xattr_header) - + sizeof(__u32); + + rc = ext4_xattr_fetch(ref); + if (rc != 0) { + ext4_xattr_purge_items(ref); + if (xattr_block) { + extents_brelse(ref->block_bh); + ref->block_bh = NULL; + } + + Ext2DestroyInode(fs, ref->OnDiskInode); + return rc; + } + ref->IrpContext = IrpContext; + return 0; +} + +int ext4_fs_put_xattr_ref(struct ext4_xattr_ref *ref) +{ + int ret; + sector_t orig_file_acl = ref->inode_ref->Inode.i_file_acl; + ret = ext4_xattr_write_to_disk(ref); + if (ref->IsOnDiskInodeDirty) { + ASSERT(ref->fs->InodeSize > EXT4_GOOD_OLD_INODE_SIZE); + + /* As we may do block allocation in ext4_xattr_write_to_disk */ + if (ret) + ref->inode_ref->Inode.i_file_acl = orig_file_acl; + + if (!ret) { + ret = Ext2SaveInode(ref->IrpContext, ref->fs, &ref->inode_ref->Inode) + ? 0 : -EIO; + if (!ret) { + ret = Ext2SaveInodeXattr(ref->IrpContext, + ref->fs, + &ref->inode_ref->Inode, + ref->OnDiskInode) + ? 0 : -EIO; + } + } + ref->IsOnDiskInodeDirty = FALSE; + } + if (ref->block_loaded) { + if (!ret) + extents_brelse(ref->block_bh); + else + extents_bforget(ref->block_bh); + + ref->block_bh = NULL; + ref->block_loaded = FALSE; + } + ext4_xattr_purge_items(ref); + Ext2DestroyInode(ref->fs, ref->OnDiskInode); + ref->OnDiskInode = NULL; + ref->inode_ref = NULL; + ref->fs = NULL; + return ret; +} + +struct xattr_prefix { + const char *prefix; + __u8 name_index; +}; + +static const struct xattr_prefix prefix_tbl[] = { + {"user.", EXT4_XATTR_INDEX_USER}, + {"system.posix_acl_access", EXT4_XATTR_INDEX_POSIX_ACL_ACCESS}, + {"system.posix_acl_default", EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT}, + {"trusted.", EXT4_XATTR_INDEX_TRUSTED}, + {"security.", EXT4_XATTR_INDEX_SECURITY}, + {"system.", EXT4_XATTR_INDEX_SYSTEM}, + {"system.richacl", EXT4_XATTR_INDEX_RICHACL}, + {NULL, 0}, +}; + +const char *ext4_extract_xattr_name(const char *full_name, size_t full_name_len, + __u8 *name_index, size_t *name_len, + BOOL *found) +{ + int i; + ASSERT(name_index); + ASSERT(found); + + *found = FALSE; + + if (!full_name_len) { + if (name_len) + *name_len = 0; + + return NULL; + } + + for (i = 0; prefix_tbl[i].prefix; i++) { + size_t prefix_len = strlen(prefix_tbl[i].prefix); + if (full_name_len >= prefix_len && + !memcmp(full_name, prefix_tbl[i].prefix, prefix_len)) { + BOOL require_name = + prefix_tbl[i].prefix[prefix_len - 1] == '.'; + *name_index = prefix_tbl[i].name_index; + if (name_len) + *name_len = full_name_len - prefix_len; + + if (!(full_name_len - prefix_len) && require_name) + return NULL; + + *found = TRUE; + if (require_name) + return full_name + prefix_len; + + return NULL; + } + } + if (name_len) + *name_len = 0; + + return NULL; +} + +const char *ext4_get_xattr_name_prefix(__u8 name_index, + size_t *ret_prefix_len) +{ + int i; + + for (i = 0; prefix_tbl[i].prefix; i++) { + size_t prefix_len = strlen(prefix_tbl[i].prefix); + if (prefix_tbl[i].name_index == name_index) { + if (ret_prefix_len) + *ret_prefix_len = prefix_len; + + return prefix_tbl[i].prefix; + } + } + if (ret_prefix_len) + *ret_prefix_len = 0; + + return NULL; +} diff --git a/Ext3Fsd/ext4/extents.c b/Ext3Fsd/ext4/extents.c index c132911..c132911 100755..100644 --- a/Ext3Fsd/ext4/extents.c +++ b/Ext3Fsd/ext4/extents.c diff --git a/Ext3Fsd/fastio.c b/Ext3Fsd/fastio.c index ca0d765..ca0d765 100755..100644 --- a/Ext3Fsd/fastio.c +++ b/Ext3Fsd/fastio.c diff --git a/Ext3Fsd/fileinfo.c b/Ext3Fsd/fileinfo.c index 6c663a4..996186b 100755..100644 --- a/Ext3Fsd/fileinfo.c +++ b/Ext3Fsd/fileinfo.c @@ -11,6 +11,7 @@ #include "ext2fs.h" #include "linux\ext4.h" +#include "linux\ext4_xattr.h" /* GLOBALS ***************************************************************/ @@ -29,6 +30,15 @@ extern PEXT2_GLOBAL Ext2Global; #pragma alloc_text(PAGE, Ext2DeleteFile) #endif +static int Ext2IterateAllEa(struct ext4_xattr_ref *xattr_ref, struct ext4_xattr_item *item, BOOL is_last) +{ + PULONG EaSize = xattr_ref->iter_arg; + ULONG EaEntrySize = 4 + 1 + 1 + 2 + item->name_len + 1 + item->data_size; + + *EaSize += EaEntrySize - 4; + return EXT4_XATTR_ITERATE_CONT; +} + NTSTATUS Ext2QueryFileInformation (IN PEXT2_IRP_CONTEXT IrpContext) { @@ -205,6 +215,7 @@ Ext2QueryFileInformation (IN PEXT2_IRP_CONTEXT IrpContext) case FileEaInformation: { + struct ext4_xattr_ref xattr_ref; PFILE_EA_INFORMATION FileEaInformation; if (Length < sizeof(FILE_EA_INFORMATION)) { @@ -213,10 +224,19 @@ Ext2QueryFileInformation (IN PEXT2_IRP_CONTEXT IrpContext) } FileEaInformation = (PFILE_EA_INFORMATION) Buffer; - - // Romfs doesn't have any extended attributes FileEaInformation->EaSize = 0; + Status = Ext2WinntError(ext4_fs_get_xattr_ref(IrpContext, Vcb, Fcb->Mcb, &xattr_ref)); + if (!NT_SUCCESS(Status)) + __leave; + + xattr_ref.iter_arg = &FileEaInformation->EaSize; + ext4_fs_xattr_iterate(&xattr_ref, Ext2IterateAllEa); + ext4_fs_put_xattr_ref(&xattr_ref); + + if (FileEaInformation->EaSize) + FileEaInformation->EaSize += 4; + Irp->IoStatus.Information = sizeof(FILE_EA_INFORMATION); Status = STATUS_SUCCESS; } @@ -2071,4 +2091,4 @@ Ext2DeleteFile( &Mcb->FullName, ext3_free_blocks_count(SUPER_BLOCK))); return Status; -}
\ No newline at end of file +} diff --git a/Ext3Fsd/include/ext2fs.h b/Ext3Fsd/include/ext2fs.h index 6ab4cbc..73bc0c1 100755..100644 --- a/Ext3Fsd/include/ext2fs.h +++ b/Ext3Fsd/include/ext2fs.h @@ -916,6 +916,8 @@ struct _EXT2_MCB { // List Link to Vcb->McbList LIST_ENTRY Link; + + struct inode Inode; struct dentry *de; }; @@ -990,6 +992,9 @@ typedef struct _EXT2_CCB { /* Open handle control block */ struct file filp; + /* The EA index we are on */ + ULONG EaIndex; + } EXT2_CCB, *PEXT2_CCB; // @@ -1585,6 +1590,26 @@ Ext2BuildRequest ( ); // +// ea.c +// + +NTSTATUS +Ext2QueryEa( + IN PEXT2_IRP_CONTEXT IrpContext +); + +BOOLEAN +Ext2IsEaNameValid( + IN OEM_STRING Name +); + +NTSTATUS +Ext2SetEa( + IN PEXT2_IRP_CONTEXT IrpContext +); + + +// // Except.c // @@ -1803,6 +1828,17 @@ Ext2SaveInode ( ); BOOLEAN +Ext2LoadInodeXattr(IN PEXT2_VCB Vcb, + IN struct inode *Inode, + IN PEXT2_INODE InodeXattr); + +BOOLEAN +Ext2SaveInodeXattr(IN PEXT2_IRP_CONTEXT IrpContext, + IN PEXT2_VCB Vcb, + IN struct inode *Inode, + IN PEXT2_INODE InodeXattr); + +BOOLEAN Ext2LoadBlock ( IN PEXT2_VCB Vcb, IN ULONG dwBlk, diff --git a/Ext3Fsd/include/linux/ext4.h b/Ext3Fsd/include/linux/ext4.h index 2aa4a39..2aa4a39 100755..100644 --- a/Ext3Fsd/include/linux/ext4.h +++ b/Ext3Fsd/include/linux/ext4.h diff --git a/Ext3Fsd/include/linux/ext4_ext.h b/Ext3Fsd/include/linux/ext4_ext.h index fedf491..fedf491 100755..100644 --- a/Ext3Fsd/include/linux/ext4_ext.h +++ b/Ext3Fsd/include/linux/ext4_ext.h diff --git a/Ext3Fsd/include/linux/ext4_jbd2.h b/Ext3Fsd/include/linux/ext4_jbd2.h index d6c6fea..d6c6fea 100755..100644 --- a/Ext3Fsd/include/linux/ext4_jbd2.h +++ b/Ext3Fsd/include/linux/ext4_jbd2.h diff --git a/Ext3Fsd/include/linux/ext4_xattr.h b/Ext3Fsd/include/linux/ext4_xattr.h new file mode 100644 index 0000000..d57949c --- /dev/null +++ b/Ext3Fsd/include/linux/ext4_xattr.h @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2015 Grzegorz Kostka (kostka.grzegorz@gmail.com) + * Copyright (c) 2015 Kaho Ng (ngkaho1234@gmail.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * - The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** @addtogroup lwext4 + * @{ + */ +/** + * @file ext4_xattr.h + * @brief Extended Attribute manipulation. + */ + +#ifndef EXT4_XATTR_H_ +#define EXT4_XATTR_H_ + +#include <ext2fs.h> +#include <linux/rbtree.h> + +/* Extended Attribute(EA) */ + +/* Magic value in attribute blocks */ +#define EXT4_XATTR_MAGIC 0xEA020000 + +/* Maximum number of references to one attribute block */ +#define EXT4_XATTR_REFCOUNT_MAX 1024 + +/* Name indexes */ +#define EXT4_XATTR_INDEX_USER 1 +#define EXT4_XATTR_INDEX_POSIX_ACL_ACCESS 2 +#define EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT 3 +#define EXT4_XATTR_INDEX_TRUSTED 4 +#define EXT4_XATTR_INDEX_LUSTRE 5 +#define EXT4_XATTR_INDEX_SECURITY 6 +#define EXT4_XATTR_INDEX_SYSTEM 7 +#define EXT4_XATTR_INDEX_RICHACL 8 +#define EXT4_XATTR_INDEX_ENCRYPTION 9 + +#pragma pack(push, 1) + +struct ext4_xattr_header { + __le32 h_magic; /* magic number for identification */ + __le32 h_refcount; /* reference count */ + __le32 h_blocks; /* number of disk blocks used */ + __le32 h_hash; /* hash value of all attributes */ + __le32 h_checksum; /* crc32c(uuid+id+xattrblock) */ + /* id = inum if refcount=1, blknum otherwise */ + __le32 h_reserved[3]; /* zero right now */ +}; + +struct ext4_xattr_ibody_header { + __le32 h_magic; /* magic number for identification */ +}; + +struct ext4_xattr_entry { + __u8 e_name_len; /* length of name */ + __u8 e_name_index; /* attribute name index */ + __le16 e_value_offs; /* offset in disk block of value */ + __le32 e_value_block; /* disk block attribute is stored on (n/i) */ + __le32 e_value_size; /* size of attribute value */ + __le32 e_hash; /* hash value of name and value */ +}; + +#pragma pack(pop) + +#define EXT4_GOOD_OLD_INODE_SIZE EXT2_GOOD_OLD_INODE_SIZE + +#define EXT4_XATTR_PAD_BITS 2 +#define EXT4_XATTR_PAD (1<<EXT4_XATTR_PAD_BITS) +#define EXT4_XATTR_ROUND (EXT4_XATTR_PAD-1) +#define EXT4_XATTR_LEN(name_len) \ + (((name_len) + EXT4_XATTR_ROUND + \ + sizeof(struct ext4_xattr_entry)) & ~EXT4_XATTR_ROUND) +#define EXT4_XATTR_NEXT(entry) \ + ((struct ext4_xattr_entry *)( \ + (char *)(entry) + EXT4_XATTR_LEN((entry)->e_name_len))) +#define EXT4_XATTR_SIZE(size) \ + (((size) + EXT4_XATTR_ROUND) & ~EXT4_XATTR_ROUND) +#define EXT4_XATTR_NAME(entry) \ + ((char *)((entry) + 1)) + +#define EXT4_XATTR_IHDR(raw_inode) \ + ((struct ext4_xattr_ibody_header *) \ + ((char *)raw_inode + \ + EXT4_GOOD_OLD_INODE_SIZE + \ + (raw_inode)->i_extra_isize)) +#define EXT4_XATTR_IFIRST(hdr) \ + ((struct ext4_xattr_entry *)((hdr)+1)) + +#define EXT4_XATTR_BHDR(block) \ + ((struct ext4_xattr_header *)((block)->b_data)) +#define EXT4_XATTR_ENTRY(ptr) \ + ((struct ext4_xattr_entry *)(ptr)) +#define EXT4_XATTR_BFIRST(block) \ + EXT4_XATTR_ENTRY(EXT4_XATTR_BHDR(block)+1) +#define EXT4_XATTR_IS_LAST_ENTRY(entry) \ + (*(__le32 *)(entry) == 0) + +#define EXT4_ZERO_XATTR_VALUE ((void *)-1) + + +struct ext4_xattr_item { + /* This attribute should be stored in inode body */ + BOOL in_inode; + BOOL is_data; + + __u8 name_index; + char *name; + size_t name_len; + void *data; + size_t data_size; + + struct rb_node node; + struct list_head list_node; +}; + +struct ext4_xattr_ref { + PEXT2_IRP_CONTEXT IrpContext; + BOOL block_loaded; + struct buffer_head *block_bh; + PEXT2_MCB inode_ref; + + PEXT2_INODE OnDiskInode; + BOOL IsOnDiskInodeDirty; + + BOOL dirty; + size_t ea_size; + size_t inode_size_rem; + size_t block_size_rem; + PEXT2_VCB fs; + + void *iter_arg; + struct ext4_xattr_item *iter_from; + + struct rb_root root; + struct list_head ordered_list; +}; + +#define EXT4_XATTR_ITERATE_CONT 0 +#define EXT4_XATTR_ITERATE_STOP 1 +#define EXT4_XATTR_ITERATE_PAUSE 2 + +int ext4_fs_get_xattr_ref(PEXT2_IRP_CONTEXT IrpContext, PEXT2_VCB fs, PEXT2_MCB inode_ref, + struct ext4_xattr_ref *ref); + +int ext4_fs_put_xattr_ref(struct ext4_xattr_ref *ref); + +int ext4_fs_set_xattr(struct ext4_xattr_ref *ref, __u8 name_index, + const char *name, size_t name_len, const void *data, + size_t data_size, BOOL replace); + +int ext4_fs_set_xattr_ordered(struct ext4_xattr_ref *ref, __u8 name_index, + const char *name, size_t name_len, const void *data, + size_t data_size); + +int ext4_fs_remove_xattr(struct ext4_xattr_ref *ref, __u8 name_index, + const char *name, size_t name_len); + +int ext4_fs_get_xattr(struct ext4_xattr_ref *ref, __u8 name_index, + const char *name, size_t name_len, void *buf, + size_t buf_size, size_t *data_size); + +void ext4_fs_xattr_iterate(struct ext4_xattr_ref *ref, + int(*iter)(struct ext4_xattr_ref *ref, + struct ext4_xattr_item *item, + BOOL is_last)); + +void ext4_fs_xattr_iterate_reset(struct ext4_xattr_ref *ref); + +const char *ext4_extract_xattr_name(const char *full_name, size_t full_name_len, + __u8 *name_index, size_t *name_len, + BOOL *found); + +const char *ext4_get_xattr_name_prefix(__u8 name_index, + size_t *ret_prefix_len); + +void ext4_xattr_purge_items(struct ext4_xattr_ref *xattr_ref); + +#endif +/** + * @} + */ diff --git a/Ext3Fsd/include/linux/fs.h b/Ext3Fsd/include/linux/fs.h index 52a8b3d..5da58f9 100644 --- a/Ext3Fsd/include/linux/fs.h +++ b/Ext3Fsd/include/linux/fs.h @@ -75,25 +75,6 @@ struct super_block { void *s_fs_info; }; -struct xattr_entry { - char xe_name_index; - char *xe_name; - char xe_name_len; - char *xe_value; - int xe_value_size; - int xe_value_buf_size; - struct rb_node xe_node; -}; - -#define XATTR_FLAG_DIRTY 0x1 -#define XATTR_FLAG_LOADED 0x2 - -struct xattr_handle { - int xh_flags; - int xh_total_size; - struct rb_root xh_root; -}; - struct inode { __u32 i_ino; /* inode number */ loff_t i_size; /* size */ diff --git a/Ext3Fsd/include/linux/module.h b/Ext3Fsd/include/linux/module.h index 738dd5b..7385c03 100755 --- a/Ext3Fsd/include/linux/module.h +++ b/Ext3Fsd/include/linux/module.h @@ -857,6 +857,7 @@ struct buffer_head *extents_bread(struct super_block *sb, sector_t block); struct buffer_head *extents_bwrite(struct super_block *sb, sector_t block); void extents_mark_buffer_dirty(struct buffer_head *bh); void extents_brelse(struct buffer_head *bh); +void extents_bforget(struct buffer_head *bh); void buffer_head_remove(struct block_device *bdev, struct buffer_head *bh); extern int buffer_heads_over_limit; diff --git a/Ext3Fsd/init.c b/Ext3Fsd/init.c index 1b5b420..44c9fb5 100755..100644 --- a/Ext3Fsd/init.c +++ b/Ext3Fsd/init.c @@ -607,6 +607,9 @@ DriverEntry ( DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = Ext2BuildRequest; DriverObject->MajorFunction[IRP_MJ_LOCK_CONTROL] = Ext2BuildRequest; + DriverObject->MajorFunction[IRP_MJ_QUERY_EA] = Ext2BuildRequest; + DriverObject->MajorFunction[IRP_MJ_SET_EA] = Ext2BuildRequest; + DriverObject->MajorFunction[IRP_MJ_CLEANUP] = Ext2BuildRequest; #if (_WIN32_WINNT >= 0x0500) diff --git a/Ext3Fsd/linux.c b/Ext3Fsd/linux.c index acc0f58..acc0f58 100755..100644 --- a/Ext3Fsd/linux.c +++ b/Ext3Fsd/linux.c diff --git a/Ext3Fsd/memory.c b/Ext3Fsd/memory.c index 2721bdf..afd4129 100755..100644 --- a/Ext3Fsd/memory.c +++ b/Ext3Fsd/memory.c @@ -2387,7 +2387,7 @@ Ext2InitializeVcb( IN PEXT2_IRP_CONTEXT IrpContext, /* initialize inode lookaside list */ ExInitializeNPagedLookasideList(&(Vcb->InodeLookasideList), - NULL, NULL, 0, sizeof(EXT2_INODE), + NULL, NULL, 0, Vcb->InodeSize, 'SNIE', 0); InodeLookasideInitialized = TRUE; diff --git a/Ext3Fsd/notes.txt b/Ext3Fsd/notes.txt index 743e439..743e439 100755..100644 --- a/Ext3Fsd/notes.txt +++ b/Ext3Fsd/notes.txt diff --git a/Ext3Fsd/read.c b/Ext3Fsd/read.c index 16b6c2f..16b6c2f 100755..100644 --- a/Ext3Fsd/read.c +++ b/Ext3Fsd/read.c diff --git a/Ext3Fsd/readme.txt b/Ext3Fsd/readme.txt index 13b2230..13b2230 100755..100644 --- a/Ext3Fsd/readme.txt +++ b/Ext3Fsd/readme.txt diff --git a/Ext3Fsd/sys/sources b/Ext3Fsd/sys/SOURCES index 95def4b..6e54a12 100644 --- a/Ext3Fsd/sys/sources +++ b/Ext3Fsd/sys/SOURCES @@ -59,4 +59,5 @@ SOURCES= ..\Ext3fsd.rc \ ..\flush.c \ ..\shutdown.c \ ..\nls.c \ - ..\linux.c + ..\linux.c \ + ..\ea.c diff --git a/Ext3Fsd/volinfo.c b/Ext3Fsd/volinfo.c index 65ed938..483d9c9 100755..100644 --- a/Ext3Fsd/volinfo.c +++ b/Ext3Fsd/volinfo.c @@ -188,7 +188,7 @@ Ext2QueryVolumeInformation (IN PEXT2_IRP_CONTEXT IrpContext) (PFILE_FS_ATTRIBUTE_INFORMATION) Buffer; FsAttrInfo->FileSystemAttributes = FILE_SUPPORTS_HARD_LINKS | FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES | - FILE_SUPPORTS_REPARSE_POINTS; + FILE_SUPPORTS_REPARSE_POINTS | FILE_SUPPORTS_EXTENDED_ATTRIBUTES; if (IsVcbReadOnly(Vcb)) { FsAttrInfo->FileSystemAttributes |= FILE_READ_ONLY_VOLUME; } diff --git a/Ext3Fsd/write.c b/Ext3Fsd/write.c index f3331ce..f3331ce 100755..100644 --- a/Ext3Fsd/write.c +++ b/Ext3Fsd/write.c |