2011-12-01 17:20:52 +00:00
|
|
|
/*
|
2011-12-05 11:36:02 +00:00
|
|
|
* Rufus: The Reliable USB Formatting Utility
|
2011-12-01 17:20:52 +00:00
|
|
|
* Formatting function calls
|
2020-02-10 13:04:50 +00:00
|
|
|
* Copyright © 2011-2020 Pete Batard <pete@akeo.ie>
|
2011-12-01 17:20:52 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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 License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2016-11-11 11:58:05 +00:00
|
|
|
#include <windows.h>
|
2019-05-02 15:03:15 +00:00
|
|
|
#include <winioctl.h> // for MEDIA_TYPE
|
2011-12-01 17:20:52 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/* Callback command types (some errorcode were filled from HPUSBFW V2.2.3 and their
|
|
|
|
designation from msdn.microsoft.com/en-us/library/windows/desktop/aa819439.aspx */
|
|
|
|
typedef enum {
|
|
|
|
FCC_PROGRESS,
|
|
|
|
FCC_DONE_WITH_STRUCTURE,
|
|
|
|
FCC_UNKNOWN2,
|
|
|
|
FCC_INCOMPATIBLE_FILE_SYSTEM,
|
|
|
|
FCC_UNKNOWN4,
|
|
|
|
FCC_UNKNOWN5,
|
|
|
|
FCC_ACCESS_DENIED,
|
|
|
|
FCC_MEDIA_WRITE_PROTECTED,
|
|
|
|
FCC_VOLUME_IN_USE,
|
|
|
|
FCC_CANT_QUICK_FORMAT,
|
|
|
|
FCC_UNKNOWNA,
|
|
|
|
FCC_DONE,
|
|
|
|
FCC_BAD_LABEL,
|
|
|
|
FCC_UNKNOWND,
|
|
|
|
FCC_OUTPUT,
|
|
|
|
FCC_STRUCTURE_PROGRESS,
|
|
|
|
FCC_CLUSTER_SIZE_TOO_SMALL,
|
|
|
|
FCC_CLUSTER_SIZE_TOO_BIG,
|
|
|
|
FCC_VOLUME_TOO_SMALL,
|
|
|
|
FCC_VOLUME_TOO_BIG,
|
|
|
|
FCC_NO_MEDIA_IN_DRIVE,
|
2012-03-09 01:38:52 +00:00
|
|
|
FCC_UNKNOWN15,
|
|
|
|
FCC_UNKNOWN16,
|
|
|
|
FCC_UNKNOWN17,
|
2014-03-29 00:17:41 +00:00
|
|
|
FCC_DEVICE_NOT_READY,
|
2012-03-09 01:38:52 +00:00
|
|
|
FCC_CHECKDISK_PROGRESS,
|
|
|
|
FCC_UNKNOWN1A,
|
|
|
|
FCC_UNKNOWN1B,
|
|
|
|
FCC_UNKNOWN1C,
|
|
|
|
FCC_UNKNOWN1D,
|
|
|
|
FCC_UNKNOWN1E,
|
|
|
|
FCC_UNKNOWN1F,
|
2012-12-13 23:50:23 +00:00
|
|
|
FCC_READ_ONLY_MODE,
|
2011-12-01 17:20:52 +00:00
|
|
|
} FILE_SYSTEM_CALLBACK_COMMAND;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
DWORD Lines;
|
|
|
|
CHAR* Output;
|
|
|
|
} TEXTOUTPUT, *PTEXTOUTPUT;
|
|
|
|
|
|
|
|
typedef BOOLEAN (__stdcall *FILE_SYSTEM_CALLBACK)(
|
|
|
|
FILE_SYSTEM_CALLBACK_COMMAND Command,
|
|
|
|
ULONG Action,
|
|
|
|
PVOID pData
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Parameter names aligned to
|
|
|
|
http://msdn.microsoft.com/en-us/library/windows/desktop/aa819439.aspx */
|
|
|
|
typedef VOID (WINAPI *FormatEx_t)(
|
|
|
|
WCHAR* DriveRoot,
|
|
|
|
MEDIA_TYPE MediaType, // See WinIoCtl.h
|
|
|
|
WCHAR* FileSystemTypeName,
|
|
|
|
WCHAR* Label,
|
|
|
|
BOOL QuickFormat,
|
|
|
|
ULONG DesiredUnitAllocationSize,
|
|
|
|
FILE_SYSTEM_CALLBACK Callback
|
|
|
|
);
|
|
|
|
|
2012-03-09 01:38:52 +00:00
|
|
|
/* Mostly from http://doxygen.reactos.org/df/d85/fmifs_8h_source.html */
|
|
|
|
typedef LONG (WINAPI *Chkdsk_t)(
|
|
|
|
WCHAR* DriveRoot,
|
|
|
|
WCHAR* FileSystemTypeName,
|
|
|
|
BOOL CorrectErrors,
|
|
|
|
BOOL Verbose,
|
|
|
|
BOOL CheckOnlyIfDirty,
|
|
|
|
BOOL ScanDrive,
|
|
|
|
VOID* Unused2,
|
|
|
|
VOID* Unused3,
|
|
|
|
FILE_SYSTEM_CALLBACK Callback);
|
|
|
|
|
2011-12-01 17:20:52 +00:00
|
|
|
/* http://msdn.microsoft.com/en-us/library/windows/desktop/aa383357.aspx */
|
|
|
|
typedef enum {
|
2014-01-31 02:51:28 +00:00
|
|
|
FPF_COMPRESSED = 0x01
|
2011-12-01 17:20:52 +00:00
|
|
|
} FILE_SYSTEM_PROP_FLAG;
|
|
|
|
|
|
|
|
typedef BOOLEAN (WINAPI* EnableVolumeCompression_t)(
|
2014-01-31 02:51:28 +00:00
|
|
|
WCHAR* DriveRoot,
|
|
|
|
ULONG CompressionFlags // FILE_SYSTEM_PROP_FLAG
|
2011-12-01 17:20:52 +00:00
|
|
|
);
|
2012-11-03 17:40:33 +00:00
|
|
|
|
2020-02-10 13:04:50 +00:00
|
|
|
BOOL WritePBR(HANDLE hLogicalDrive);
|
|
|
|
BOOL FormatLargeFAT32(DWORD DriveIndex, uint64_t PartitionOffset, DWORD ClusterSize, LPCSTR FSName, LPCSTR Label, DWORD Flags);
|
|
|
|
BOOL FormatExtFs(DWORD DriveIndex, uint64_t PartitionOffset, DWORD BlockSize, LPCSTR FSName, LPCSTR Label, DWORD Flags);
|