1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[misc] more headers cleanup

This commit is contained in:
Pete Batard 2016-02-25 18:21:31 +00:00
parent 250d46e401
commit ade5639c00
3 changed files with 33 additions and 33 deletions

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Drive access function calls
* Copyright © 2011-2014 Pete Batard <pete@akeo.ie>
* Copyright © 2011-2016 Pete Batard <pete@akeo.ie>
*
* 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
@ -19,6 +19,7 @@
#include <windows.h>
#include <stdint.h>
#include <winioctl.h> // for DISK_GEOMETRY
#pragma once
@ -26,7 +27,7 @@
#define MOUNTMGRCONTROLTYPE ((ULONG)'m')
#define MOUNTMGR_DOS_DEVICE_NAME "\\\\.\\MountPointManager"
#define IOCTL_MOUNTMGR_QUERY_AUTO_MOUNT \
CTL_CODE(MOUNTMGRCONTROLTYPE, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
CTL_CODE(MOUNTMGRCONTROLTYPE, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_MOUNTMGR_SET_AUTO_MOUNT \
CTL_CODE(MOUNTMGRCONTROLTYPE, 16, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
@ -48,6 +49,31 @@ typedef struct {
DISK_EXTENT Extents[8];
} VOLUME_DISK_EXTENTS_REDEF;
static __inline BOOL UnlockDrive(HANDLE hDrive) {
DWORD size;
return DeviceIoControl(hDrive, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &size, NULL);
}
#define safe_unlockclose(h) do {if ((h != INVALID_HANDLE_VALUE) && (h != NULL)) {UnlockDrive(h); CloseHandle(h); h = INVALID_HANDLE_VALUE;}} while(0)
/* Current drive info */
typedef struct {
DWORD DeviceNumber;
LONGLONG DiskSize;
DISK_GEOMETRY Geometry;
DWORD FirstSector;
char proposed_label[16];
int PartitionType;
int nPartitions; // number of partitions we actually care about
int FSType;
BOOL has_protective_mbr;
BOOL has_mbr_uefi_marker;
struct {
ULONG Allowed;
ULONG Default;
} ClusterSize[FS_MAX];
} RUFUS_DRIVE_INFO;
extern RUFUS_DRIVE_INFO SelectedDrive;
BOOL SetAutoMount(BOOL enable);
BOOL GetAutoMount(BOOL* enabled);
char* GetPhysicalName(DWORD DriveIndex);

View file

@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <windows.h>
#include <winioctl.h> // for DISK_GEOMETRY
#include <malloc.h>
#include <inttypes.h>
@ -99,7 +98,6 @@
#define safe_strncmp(str1, str2, count) strncmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2), count)
#define safe_strnicmp(str1, str2, count) _strnicmp(((str1==NULL)?"<NULL>":str1), ((str2==NULL)?"<NULL>":str2), count)
#define safe_closehandle(h) do {if ((h != INVALID_HANDLE_VALUE) && (h != NULL)) {CloseHandle(h); h = INVALID_HANDLE_VALUE;}} while(0)
#define safe_unlockclose(h) do {if ((h != INVALID_HANDLE_VALUE) && (h != NULL)) {UnlockDrive(h); CloseHandle(h); h = INVALID_HANDLE_VALUE;}} while(0)
#define safe_release_dc(hDlg, hDC) do {if ((hDC != INVALID_HANDLE_VALUE) && (hDC != NULL)) {ReleaseDC(hDlg, hDC); hDC = NULL;}} while(0)
#define safe_sprintf(dst, count, ...) do {_snprintf(dst, count, __VA_ARGS__); (dst)[(count)-1] = 0; } while(0)
#define static_sprintf(dst, ...) safe_sprintf(dst, sizeof(dst), __VA_ARGS__)
@ -225,24 +223,6 @@ enum target_type {
#define GETTARGETTYPE(x) (((x)>0)?(((x) >> 16) & 0xFFFF):0)
#define GETPARTTYPE(x) (((x)>0)?((x) & 0xFFFF):0);
/* Current drive info */
typedef struct {
DWORD DeviceNumber;
LONGLONG DiskSize;
DISK_GEOMETRY Geometry;
DWORD FirstSector;
char proposed_label[16];
int PartitionType;
int nPartitions; // number of partitions we actually care about
int FSType;
BOOL has_protective_mbr;
BOOL has_mbr_uefi_marker;
struct {
ULONG Allowed;
ULONG Default;
} ClusterSize[FS_MAX];
} RUFUS_DRIVE_INFO;
/* Special handling for old .c32 files we need to replace */
#define NB_OLD_C32 2
#define OLD_C32_NAMES { "menu.c32", "vesamenu.c32" }
@ -372,7 +352,6 @@ extern char* image_path;
extern DWORD FormatStatus, DownloadStatus;
extern BOOL PromptOnError;
extern unsigned long syslinux_ldlinux_len[2];
extern RUFUS_DRIVE_INFO SelectedDrive;
extern const int nb_steps[FS_MAX];
extern BOOL use_own_c32[NB_OLD_C32], detect_fakes, iso_op_in_progress, format_op_in_progress, right_to_left_mode;
extern BOOL allow_dual_uefi_bios, togo_mode;
@ -466,11 +445,6 @@ DWORD WINAPI FormatThread(void* param);
DWORD WINAPI SaveImageThread(void* param);
DWORD WINAPI SumThread(void* param);
static __inline BOOL UnlockDrive(HANDLE hDrive) {
DWORD size;
return DeviceIoControl(hDrive, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &size, NULL);
}
/* Hash tables */
typedef struct htab_entry {
uint32_t used;

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.8.867"
CAPTION "Rufus 2.8.868"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -320,8 +320,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,8,867,0
PRODUCTVERSION 2,8,867,0
FILEVERSION 2,8,868,0
PRODUCTVERSION 2,8,868,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -338,13 +338,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.8.867"
VALUE "FileVersion", "2.8.868"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.8.867"
VALUE "ProductVersion", "2.8.868"
END
END
BLOCK "VarFileInfo"