Skip to content

Commit

Permalink
Code rewritten
Browse files Browse the repository at this point in the history
Remove regex

Shrink metadata
  • Loading branch information
0xbadfca11 committed Nov 19, 2018
1 parent f329f0b commit 2d7b9fe
Show file tree
Hide file tree
Showing 7 changed files with 483 additions and 384 deletions.
132 changes: 123 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@

# Created by https://www.gitignore.io/api/windows,visualstudio
# Edit at https://www.gitignore.io/?templates=windows,visualstudio

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

### VisualStudio ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
Expand All @@ -22,11 +55,14 @@ bld/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# Visual Studio 2017 auto generated files
Generated\ Files/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
Expand All @@ -40,18 +76,28 @@ TestResult.xml
[Rr]eleasePS/
dlldata.c

# DNX
# Benchmark Results
BenchmarkDotNet.Artifacts/

# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/

# StyleCop
StyleCopReport.xml

# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
Expand All @@ -61,6 +107,7 @@ artifacts/
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
Expand Down Expand Up @@ -89,6 +136,9 @@ ipch/
*.vspx
*.sap

# Visual Studio Trace Files
*.e2e

# TFS 2012 Local Workspace
$tf/

Expand All @@ -109,6 +159,14 @@ _TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover

# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json

# Visual Studio code coverage results
*.coverage
*.coveragexml

# NCrunch
_NCrunch_*
.*crunch*.local.xml
Expand Down Expand Up @@ -140,7 +198,7 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
Expand All @@ -153,12 +211,12 @@ PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets

Expand All @@ -175,6 +233,7 @@ AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx

# Visual Studio cache files
# files ending in .cache can be ignored
Expand All @@ -188,11 +247,15 @@ ClientBin/
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs

# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
Expand All @@ -207,15 +270,19 @@ _UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak

# SQL Server files
*.mdf
*.ldf
*.ndf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser

# Microsoft Fakes
FakesAssemblies/
Expand All @@ -225,13 +292,17 @@ FakesAssemblies/

# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
Expand All @@ -250,3 +321,46 @@ paket-files/
# JetBrains Rider
.idea/
*.sln.iml

# CodeRush personal settings
.cr/personal

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config

# Tabs Studio
*.tss

# Telerik's JustMock configuration file
*.jmconfig

# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs

# OpenCover UI analysis results
OpenCover/

# Azure Stream Analytics local run output
ASALocalRun/

# MSBuild Binary and Structured Log
*.binlog

# NVidia Nsight GPU debugger configuration file
*.nvuser

# MFractors (Xamarin productivity tool) working folder
.mfractor/

# Local History for Visual Studio
.localhistory/

# End of https://www.gitignore.io/api/windows,visualstudio
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CXX = clang-cl
CXXFLAGS += -utf-8 -std:c++latest -EHsc -GR- -W4 -Werror=gnu -Wmicrosoft -Wno-missing-field-initializers -Wpedantic

fat32format: fat32format.cpp
clean:
rm fat32format.exe
26 changes: 10 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# fat32format
```
Usage Fat32Format [-cN] [-lLABEL] [-p] [-y] X:
Erase all data on disk X:, format it for FAT32
Usage Fat32Format [-cN] [-lLABEL] [-p] [-y] { C: | \\.\C: | \\?\Volume{GUID} }
Erase all data on specified volume, format it for FAT32
-c Specify a cluster size by sector count.
Accepts 1, 2, 4, 8, 16, 32, 64, 128
Expand All @@ -10,7 +10,6 @@ Erase all data on disk X:, format it for FAT32
If exceeds 11-bytes, truncate label.
-p Make immutable AUTORUN.INF on root directory.
This file cannot do anything on Windows.
-y Does not confirm before format.
Modified Version see https://github.com/0xbadfca11/fat32format
Expand All @@ -24,10 +23,17 @@ Use with care - Ridgecrop are not liable for data lost using this tool
### Alignment awareness
Original fat32format allocates only necessary size to metadata.
This isn't always aligned cluster.
Modified fat32format always round up 1MiB.
Modified fat32format always round up 1 MiB.

NOTE: FAT32 is different from NTFS, metadata exists between start of the partition and first cluster.

### Immutable AUTORUN.INF
You can not open, read, write, rename, move or delete this on Windows OS.
Only re-format can delete this. (or delete from non-Windows OS)

NOTE: This behavior is undocumented.
It does not guarantee also be the same behavior in the future.

### Strict drive letter
Original fat32format accepts

Expand All @@ -42,18 +48,6 @@ Only accepts
fat32format.exe \\?\Volume{GUID}

### Support volume label at format
use -l.

### Without confirm
use -y.

### Immutable AUTORUN.INF
use -p.
You can not open, read, write, rename, move or delete on Windows OS.
Only re-format can delete this. (or delete from non-Windows OS)

NOTE: This behavior is undocumented.
It does not guarantee also be the same behavior in the future.

## LICENSE
GPL
Loading

0 comments on commit 2d7b9fe

Please sign in to comment.