mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[misc] update to VS2015 and fix VS code analysis issues
* Also update Bled to latest, as well as build scripts * Note: Considering that Visual Studio 2015 is both freely and legally available for anyone who wants to use it to compile Rufus, starting with this commit, I will NOT be supporting any other version of Visual Studio but 2015.
This commit is contained in:
parent
b854f70bae
commit
5004374277
37 changed files with 199 additions and 141 deletions
|
@ -5,6 +5,7 @@ TARGET = rufus
|
|||
# NB: UPX v3.09 or later is needed for LZMA compression (http://upx.sourceforge.net/)
|
||||
release: all
|
||||
@mv src/$(TARGET)$(EXEEXT) .
|
||||
@sleep 1
|
||||
@$(STRIP) $(TARGET)$(EXEEXT)
|
||||
@upx --lzma $(TARGET)$(EXEEXT)
|
||||
@mv $(TARGET)$(EXEEXT) $(TARGET)-$(VERSION)$(SUFFIX)$(EXEEXT)
|
||||
|
|
|
@ -502,6 +502,7 @@ uninstall-am:
|
|||
# NB: UPX v3.09 or later is needed for LZMA compression (http://upx.sourceforge.net/)
|
||||
release: all
|
||||
@mv src/$(TARGET)$(EXEEXT) .
|
||||
@sleep 1
|
||||
@$(STRIP) $(TARGET)$(EXEEXT)
|
||||
@upx --lzma $(TARGET)$(EXEEXT)
|
||||
@mv $(TARGET)$(EXEEXT) $(TARGET)-$(VERSION)$(SUFFIX)$(EXEEXT)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
rm -f rufus*.exe
|
||||
./configure --disable-debug "$@"
|
||||
make -j4 clean
|
||||
make -j4 release
|
||||
make -j12 clean
|
||||
make -j12 release
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rufus", "src\.msvc\rufus.vcxproj", "{731858A7-0303-4988-877B-9C0DD6471864}"
|
||||
EndProject
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -29,23 +29,23 @@
|
|||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
@ -88,6 +88,7 @@
|
|||
<CompileAs>CompileAsC</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<DisableSpecificWarnings>4091;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>setupapi.lib;comctl32.lib;wininet.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
|
@ -115,6 +116,7 @@
|
|||
<CompileAs>CompileAsC</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<DisableSpecificWarnings>4091;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>setupapi.lib;comctl32.lib;wininet.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
|
@ -138,6 +140,7 @@
|
|||
<CompileAs>CompileAsC</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<DisableSpecificWarnings>4091;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>setupapi.lib;comctl32.lib;wininet.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
|
@ -164,6 +167,7 @@
|
|||
<CompileAs>CompileAsC</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<DisableSpecificWarnings>4091;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>setupapi.lib;comctl32.lib;wininet.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -65,22 +65,22 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
|
@ -264,14 +264,15 @@ unpack_lzma_stream(transformer_state_t *xstate)
|
|||
|
||||
while (global_pos + buffer_pos < header.dst_size) {
|
||||
int pos_state = (buffer_pos + global_pos) & pos_state_mask;
|
||||
uint16_t *prob = p + LZMA_IS_MATCH + (state << LZMA_NUM_POS_BITS_MAX) + pos_state;
|
||||
uintptr_t off1 = LZMA_IS_MATCH + (state << LZMA_NUM_POS_BITS_MAX) + pos_state;
|
||||
uint16_t *prob1 = p + off1;
|
||||
|
||||
if (!rc_is_bit_1(rc, prob)) {
|
||||
if (!rc_is_bit_1(rc, prob1)) {
|
||||
static const char next_state[LZMA_NUM_STATES] =
|
||||
{ 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5 };
|
||||
int mi = 1;
|
||||
|
||||
prob = (p + LZMA_LITERAL
|
||||
prob1 = (p + LZMA_LITERAL
|
||||
+ (LZMA_LIT_SIZE * ((((buffer_pos + global_pos) & literal_pos_mask) << lc)
|
||||
+ (previous_byte >> (8 - lc))
|
||||
)
|
||||
|
@ -290,13 +291,13 @@ unpack_lzma_stream(transformer_state_t *xstate)
|
|||
|
||||
match_byte <<= 1;
|
||||
bit = match_byte & 0x100;
|
||||
bit ^= (rc_get_bit(rc, prob + 0x100 + bit + mi, &mi) << 8); /* 0x100 or 0 */
|
||||
bit ^= (rc_get_bit(rc, prob1 + 0x100 + bit + mi, &mi) << 8); /* 0x100 or 0 */
|
||||
if (bit)
|
||||
break;
|
||||
} while (mi < 0x100);
|
||||
}
|
||||
while (mi < 0x100) {
|
||||
rc_get_bit(rc, prob + mi, &mi);
|
||||
rc_get_bit(rc, prob1 + mi, &mi);
|
||||
}
|
||||
|
||||
state = next_state[state];
|
||||
|
@ -333,10 +334,8 @@ unpack_lzma_stream(transformer_state_t *xstate)
|
|||
} else {
|
||||
prob2 += LZMA_IS_REP_G0 - LZMA_IS_REP;
|
||||
if (!rc_is_bit_1(rc, prob2)) {
|
||||
prob2 = (p + LZMA_IS_REP_0_LONG
|
||||
+ (state << LZMA_NUM_POS_BITS_MAX)
|
||||
+ pos_state
|
||||
);
|
||||
uintptr_t off2 = LZMA_IS_REP_0_LONG + (state << LZMA_NUM_POS_BITS_MAX) + pos_state;
|
||||
prob2 = p + off2;
|
||||
if (!rc_is_bit_1(rc, prob2)) {
|
||||
#if ENABLE_FEATURE_LZMA_FAST
|
||||
uint32_t pos = buffer_pos - rep0;
|
||||
|
@ -397,13 +396,13 @@ unpack_lzma_stream(transformer_state_t *xstate)
|
|||
|
||||
if (state < 4) {
|
||||
int pos_slot;
|
||||
uintptr_t off3 = LZMA_POS_SLOT +
|
||||
((len < LZMA_NUM_LEN_TO_POS_STATES ? len : LZMA_NUM_LEN_TO_POS_STATES - 1)
|
||||
<< LZMA_NUM_POS_SLOT_BITS);
|
||||
uint16_t *prob3;
|
||||
|
||||
state += LZMA_NUM_LIT_STATES;
|
||||
prob3 = p + LZMA_POS_SLOT +
|
||||
((len < LZMA_NUM_LEN_TO_POS_STATES ? len :
|
||||
LZMA_NUM_LEN_TO_POS_STATES - 1)
|
||||
<< LZMA_NUM_POS_SLOT_BITS);
|
||||
prob3 = p + off3;
|
||||
rc_bit_tree_decode(rc, prob3,
|
||||
LZMA_NUM_POS_SLOT_BITS, &pos_slot);
|
||||
rep0 = pos_slot;
|
||||
|
|
|
@ -541,7 +541,8 @@ INT_PTR CALLBACK ChecksumCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
|
|||
SetWindowTextA(GetDlgItem(hDlg, IDC_MD5), md5str);
|
||||
SetWindowTextA(GetDlgItem(hDlg, IDC_SHA1), sha1str);
|
||||
for (i=(int)safe_strlen(image_path); (i>0)&&(image_path[i]!='\\'); i--);
|
||||
SetWindowTextU(hDlg, &image_path[i+1]);
|
||||
if (image_path != NULL) // VS code analysis has a false positive on this one
|
||||
SetWindowTextU(hDlg, &image_path[i+1]);
|
||||
// Set focus on the OK button
|
||||
SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hDlg, IDOK), TRUE);
|
||||
CenterDialog(hDlg);
|
||||
|
|
|
@ -299,6 +299,9 @@ static BOOL ExtractMSDOS(const char* path)
|
|||
"KEYB COM", "KEYBOARDSYS", "KEYBRD2 SYS", "KEYBRD3 SYS", "KEYBRD4 SYS",
|
||||
"DISPLAY SYS", "EGA CPI", "EGA2 CPI", "EGA3 CPI" };
|
||||
|
||||
if (path == NULL)
|
||||
return FALSE;
|
||||
|
||||
// Reduce the visible mess by placing all the locale files into a subdir
|
||||
safe_strcpy(locale_path, sizeof(locale_path), path);
|
||||
safe_strcat(locale_path, sizeof(locale_path), "LOCALE\\");
|
||||
|
@ -386,7 +389,7 @@ BOOL ExtractFreeDOS(const char* path)
|
|||
|
||||
hFile = CreateFileA(filename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
|
||||
CREATE_ALWAYS, (i<2)?(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM):FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE) {
|
||||
if ((hFile == NULL) || (hFile == INVALID_HANDLE_VALUE)) {
|
||||
uprintf("Unable to create file '%s': %s.\n", filename, WindowsErrorString());
|
||||
return FALSE;
|
||||
}
|
||||
|
|
29
src/drive.c
29
src/drive.c
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "msapi_utf8.h"
|
||||
#include "rufus.h"
|
||||
#include "file.h"
|
||||
#include "drive.h"
|
||||
#include "resource.h"
|
||||
#include "sys_types.h"
|
||||
|
@ -585,21 +586,22 @@ const struct {int (*fn)(FILE *fp); char* str;} known_mbr[] = {
|
|||
BOOL AnalyzeMBR(HANDLE hPhysicalDrive, const char* TargetName)
|
||||
{
|
||||
const char* mbr_name = "Master Boot Record";
|
||||
FILE fake_fd = { 0 };
|
||||
FAKE_FD fake_fd = { 0 };
|
||||
FILE* fp = (FILE*)&fake_fd;
|
||||
int i;
|
||||
|
||||
fake_fd._ptr = (char*)hPhysicalDrive;
|
||||
fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector;
|
||||
fake_fd._handle = (char*)hPhysicalDrive;
|
||||
fake_fd._sector_size = SelectedDrive.Geometry.BytesPerSector;
|
||||
// Might need correction, as we use this method for images and we may not have a target UFD yet
|
||||
if (fake_fd._bufsiz < 512)
|
||||
fake_fd._bufsiz = 512;
|
||||
if (fake_fd._sector_size < 512)
|
||||
fake_fd._sector_size = 512;
|
||||
|
||||
if (!is_br(&fake_fd)) {
|
||||
if (!is_br(fp)) {
|
||||
uprintf("%s does not have an x86 %s\n", TargetName, mbr_name);
|
||||
return FALSE;
|
||||
}
|
||||
for (i=0; i<ARRAYSIZE(known_mbr); i++) {
|
||||
if (known_mbr[i].fn(&fake_fd)) {
|
||||
if (known_mbr[i].fn(fp)) {
|
||||
uprintf("%s has a %s %s\n", TargetName, known_mbr[i].str, mbr_name);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -623,20 +625,21 @@ const struct {int (*fn)(FILE *fp); char* str;} known_pbr[] = {
|
|||
BOOL AnalyzePBR(HANDLE hLogicalVolume)
|
||||
{
|
||||
const char* pbr_name = "Partition Boot Record";
|
||||
FILE fake_fd = { 0 };
|
||||
FAKE_FD fake_fd = { 0 };
|
||||
FILE* fp = (FILE*)&fake_fd;
|
||||
int i;
|
||||
|
||||
fake_fd._ptr = (char*)hLogicalVolume;
|
||||
fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector;
|
||||
fake_fd._handle = (char*)hLogicalVolume;
|
||||
fake_fd._sector_size = SelectedDrive.Geometry.BytesPerSector;
|
||||
|
||||
if (!is_br(&fake_fd)) {
|
||||
if (!is_br(fp)) {
|
||||
uprintf("Volume does not have an x86 %s\n", pbr_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (is_fat_16_br(&fake_fd) || is_fat_32_br(&fake_fd)) {
|
||||
if (is_fat_16_br(fp) || is_fat_32_br(fp)) {
|
||||
for (i=0; i<ARRAYSIZE(known_pbr); i++) {
|
||||
if (known_pbr[i].fn(&fake_fd)) {
|
||||
if (known_pbr[i].fn(fp)) {
|
||||
uprintf("Drive has a %s %s\n", known_pbr[i].str, pbr_name);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
67
src/format.c
67
src/format.c
|
@ -857,7 +857,8 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
|||
BOOL r = FALSE;
|
||||
DWORD size;
|
||||
unsigned char* buf = NULL;
|
||||
FILE fake_fd = { 0 };
|
||||
FAKE_FD fake_fd = { 0 };
|
||||
FILE* fp = (FILE*)&fake_fd;
|
||||
const char* using_msg = "Using %s MBR\n";
|
||||
int fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||
int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
||||
|
@ -911,8 +912,8 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
|||
goto out;
|
||||
}
|
||||
|
||||
fake_fd._ptr = (char*)hPhysicalDrive;
|
||||
fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector;
|
||||
fake_fd._handle = (char*)hPhysicalDrive;
|
||||
fake_fd._sector_size = SelectedDrive.Geometry.BytesPerSector;
|
||||
|
||||
// What follows is really a case statement with complex conditions listed
|
||||
// by order of preference
|
||||
|
@ -922,7 +923,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
|||
// Forced UEFI (by zeroing the MBR)
|
||||
if (tt == TT_UEFI) {
|
||||
uprintf(using_msg, "zeroed");
|
||||
r = write_zero_mbr(&fake_fd);
|
||||
r = write_zero_mbr(fp);
|
||||
goto notify;
|
||||
}
|
||||
|
||||
|
@ -930,35 +931,35 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
|||
if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) ||
|
||||
((bt == BT_ISO) && (HAS_SYSLINUX(iso_report)) && (IS_FAT(fs))) ) {
|
||||
uprintf(using_msg, "Syslinux");
|
||||
r = write_syslinux_mbr(&fake_fd);
|
||||
r = write_syslinux_mbr(fp);
|
||||
goto notify;
|
||||
}
|
||||
|
||||
// Grub 2.0
|
||||
if ( ((bt == BT_ISO) && (iso_report.has_grub2)) || (bt == BT_GRUB2) ) {
|
||||
uprintf(using_msg, "Grub 2.0");
|
||||
r = write_grub2_mbr(&fake_fd);
|
||||
r = write_grub2_mbr(fp);
|
||||
goto notify;
|
||||
}
|
||||
|
||||
// Grub4DOS
|
||||
if ( ((bt == BT_ISO) && (iso_report.has_grub4dos)) || (bt == BT_GRUB4DOS) ) {
|
||||
uprintf(using_msg, "Grub4DOS");
|
||||
r = write_grub_mbr(&fake_fd);
|
||||
r = write_grub_mbr(fp);
|
||||
goto notify;
|
||||
}
|
||||
|
||||
// ReactOS
|
||||
if (bt == BT_REACTOS) {
|
||||
uprintf(using_msg, "ReactOS");
|
||||
r = write_reactos_mbr(&fake_fd);
|
||||
r = write_reactos_mbr(fp);
|
||||
goto notify;
|
||||
}
|
||||
|
||||
// KolibriOS
|
||||
if ( (bt == BT_ISO) && (iso_report.has_kolibrios) && (IS_FAT(fs))) {
|
||||
uprintf(using_msg, "KolibriOS");
|
||||
r = write_kolibri_mbr(&fake_fd);
|
||||
r = write_kolibri_mbr(fp);
|
||||
goto notify;
|
||||
}
|
||||
|
||||
|
@ -966,10 +967,10 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
|||
windows_mbr:
|
||||
if ((IS_WINPE(iso_report.winpe) && !iso_report.uses_minint) || (IsChecked(IDC_RUFUS_MBR))) {
|
||||
uprintf(using_msg, APPLICATION_NAME);
|
||||
r = write_rufus_mbr(&fake_fd);
|
||||
r = write_rufus_mbr(fp);
|
||||
} else {
|
||||
uprintf(using_msg, "Windows 7");
|
||||
r = write_win7_mbr(&fake_fd);
|
||||
r = write_win7_mbr(fp);
|
||||
}
|
||||
|
||||
notify:
|
||||
|
@ -991,10 +992,11 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
|
|||
DWORD size, max_size, mbr_size = 0x200;
|
||||
int r, bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
||||
unsigned char* buf = NULL;
|
||||
FILE fake_fd = { 0 };
|
||||
FAKE_FD fake_fd = { 0 };
|
||||
FILE* fp = (FILE*)&fake_fd;
|
||||
|
||||
fake_fd._ptr = (char*)hPhysicalDrive;
|
||||
fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector;
|
||||
fake_fd._handle = (char*)hPhysicalDrive;
|
||||
fake_fd._sector_size = SelectedDrive.Geometry.BytesPerSector;
|
||||
// Ensure that we have sufficient space for the SBR
|
||||
max_size = IsChecked(IDC_EXTRA_PARTITION) ?
|
||||
(DWORD)(SelectedDrive.Geometry.BytesPerSector * SelectedDrive.Geometry.SectorsPerTrack) : 1024 * 1024;
|
||||
|
@ -1041,7 +1043,7 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
|
|||
uprintf(" SBR size is too large - You may need to uncheck 'Add fixes for old BIOSes'.");
|
||||
return FALSE;
|
||||
}
|
||||
r = write_data(&fake_fd, mbr_size, buf, (uint64_t)size);
|
||||
r = write_data(fp, mbr_size, buf, (uint64_t)size);
|
||||
safe_free(grub2_buf);
|
||||
return (r != 0);
|
||||
}
|
||||
|
@ -1060,66 +1062,67 @@ static __inline const char* bt_to_name(int bt) {
|
|||
static BOOL WritePBR(HANDLE hLogicalVolume)
|
||||
{
|
||||
int i;
|
||||
FILE fake_fd = { 0 };
|
||||
FAKE_FD fake_fd = { 0 };
|
||||
FILE* fp = (FILE*)&fake_fd;
|
||||
int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
||||
const char* using_msg = "Using %s %s partition boot record\n";
|
||||
|
||||
fake_fd._ptr = (char*)hLogicalVolume;
|
||||
fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector;
|
||||
fake_fd._handle = (char*)hLogicalVolume;
|
||||
fake_fd._sector_size = SelectedDrive.Geometry.BytesPerSector;
|
||||
|
||||
switch (ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))) {
|
||||
case FS_FAT16:
|
||||
uprintf(using_msg, bt_to_name(bt), "FAT16");
|
||||
if (!is_fat_16_fs(&fake_fd)) {
|
||||
if (!is_fat_16_fs(fp)) {
|
||||
uprintf("New volume does not have a FAT16 boot sector - aborting\n");
|
||||
break;
|
||||
}
|
||||
uprintf("Confirmed new volume has a FAT16 boot sector\n");
|
||||
if (bt == BT_FREEDOS) {
|
||||
if (!write_fat_16_fd_br(&fake_fd, 0)) break;
|
||||
if (!write_fat_16_fd_br(fp, 0)) break;
|
||||
} else if (bt == BT_REACTOS) {
|
||||
if (!write_fat_16_ros_br(&fake_fd, 0)) break;
|
||||
if (!write_fat_16_ros_br(fp, 0)) break;
|
||||
} else if ((bt == BT_ISO) && (iso_report.has_kolibrios)) {
|
||||
uprintf("FAT16 is not supported for KolibriOS\n"); break;
|
||||
} else {
|
||||
if (!write_fat_16_br(&fake_fd, 0)) break;
|
||||
if (!write_fat_16_br(fp, 0)) break;
|
||||
}
|
||||
// Disk Drive ID needs to be corrected on XP
|
||||
if (!write_partition_physical_disk_drive_id_fat16(&fake_fd))
|
||||
if (!write_partition_physical_disk_drive_id_fat16(fp))
|
||||
break;
|
||||
return TRUE;
|
||||
case FS_FAT32:
|
||||
uprintf(using_msg, bt_to_name(bt), "FAT32");
|
||||
for (i=0; i<2; i++) {
|
||||
if (!is_fat_32_fs(&fake_fd)) {
|
||||
if (!is_fat_32_fs(fp)) {
|
||||
uprintf("New volume does not have a %s FAT32 boot sector - aborting\n", i?"secondary":"primary");
|
||||
break;
|
||||
}
|
||||
uprintf("Confirmed new volume has a %s FAT32 boot sector\n", i?"secondary":"primary");
|
||||
uprintf("Setting %s FAT32 boot sector for boot...\n", i?"secondary":"primary");
|
||||
if (bt == BT_FREEDOS) {
|
||||
if (!write_fat_32_fd_br(&fake_fd, 0)) break;
|
||||
if (!write_fat_32_fd_br(fp, 0)) break;
|
||||
} else if (bt == BT_REACTOS) {
|
||||
if (!write_fat_32_ros_br(&fake_fd, 0)) break;
|
||||
if (!write_fat_32_ros_br(fp, 0)) break;
|
||||
} else if ((bt == BT_ISO) && (iso_report.has_kolibrios)) {
|
||||
if (!write_fat_32_kos_br(&fake_fd, 0)) break;
|
||||
if (!write_fat_32_kos_br(fp, 0)) break;
|
||||
} else {
|
||||
if (!write_fat_32_br(&fake_fd, 0)) break;
|
||||
if (!write_fat_32_br(fp, 0)) break;
|
||||
}
|
||||
// Disk Drive ID needs to be corrected on XP
|
||||
if (!write_partition_physical_disk_drive_id_fat32(&fake_fd))
|
||||
if (!write_partition_physical_disk_drive_id_fat32(fp))
|
||||
break;
|
||||
fake_fd._cnt += 6 * SelectedDrive.Geometry.BytesPerSector;
|
||||
fake_fd._offset += 6 * SelectedDrive.Geometry.BytesPerSector;
|
||||
}
|
||||
return TRUE;
|
||||
case FS_NTFS:
|
||||
uprintf(using_msg, bt_to_name(bt), "NTFS");
|
||||
if (!is_ntfs_fs(&fake_fd)) {
|
||||
if (!is_ntfs_fs(fp)) {
|
||||
uprintf("New volume does not have an NTFS boot sector - aborting\n");
|
||||
break;
|
||||
}
|
||||
uprintf("Confirmed new volume has an NTFS boot sector\n");
|
||||
if (!write_ntfs_br(&fake_fd)) break;
|
||||
if (!write_ntfs_br(fp)) break;
|
||||
// Note: NTFS requires a full remount after writing the PBR. We dismount when we lock
|
||||
// and also go through a forced remount, so that shouldn't be an issue.
|
||||
// But with NTFS, if you don't remount, you don't boot!
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -27,23 +27,23 @@
|
|||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
@ -79,6 +79,7 @@
|
|||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>28252;28253</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
|
@ -93,6 +94,7 @@
|
|||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>28252;28253</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
|
@ -104,6 +106,7 @@
|
|||
<PreprocessorDefinitions>HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DisableSpecificWarnings>28252;28253</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
|
@ -117,6 +120,7 @@
|
|||
<PreprocessorDefinitions>HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DisableSpecificWarnings>28252;28253</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
|
@ -129,6 +133,9 @@
|
|||
<ItemGroup>
|
||||
<ClInclude Include="..\getopt.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ClassDiagram.cd" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
|
|
@ -23,4 +23,7 @@
|
|||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ClassDiagram.cd" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -194,7 +194,7 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons
|
|||
}
|
||||
|
||||
// Check for "install.wim" or "install.swm" in "/sources"
|
||||
if (safe_stricmp(psz_dirname, install_wim_path) == 0) {
|
||||
if ((install_wim_path != NULL) && (safe_stricmp(psz_dirname, install_wim_path) == 0)) {
|
||||
for (i=0; i<ARRAYSIZE(install_wim_name); i++)
|
||||
if (safe_stricmp(psz_basename, install_wim_name[i]) == 0)
|
||||
static_sprintf(iso_report.install_wim_path, "?:\\%s\\%s", &install_wim_path[1], install_wim_name[i]);
|
||||
|
|
|
@ -111,9 +111,14 @@ static __inline int fseeko64(FILE *stream, __int64 offset, int origin) {
|
|||
/* #undef HAVE_SLEEP */
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1900)
|
||||
#define HAVE_SNPRINTF 1
|
||||
/* The equivalent of snprintf on MSVC is _snprintf */
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1900)
|
||||
#define HAVE_VSNPRINTF
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <stdarg.h> header file. */
|
||||
#define HAVE_STDARG_H 1
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -36,6 +36,7 @@
|
|||
<ClInclude Include="..\..\cdio\ds.h" />
|
||||
<ClInclude Include="..\..\cdio\logging.h" />
|
||||
<ClInclude Include="..\..\cdio\memory.h" />
|
||||
<ClInclude Include="..\..\cdio\portable.h" />
|
||||
<ClInclude Include="..\..\cdio\sector.h" />
|
||||
<ClInclude Include="..\..\cdio\types.h" />
|
||||
<ClInclude Include="..\..\cdio\util.h" />
|
||||
|
@ -44,7 +45,6 @@
|
|||
<ClInclude Include="..\cdio_assert.h" />
|
||||
<ClInclude Include="..\cdio_private.h" />
|
||||
<ClInclude Include="..\filemode.h" />
|
||||
<ClInclude Include="..\portable.h" />
|
||||
<ClInclude Include="..\_cdio_stdio.h" />
|
||||
<ClInclude Include="..\_cdio_stream.h" />
|
||||
</ItemGroup>
|
||||
|
@ -59,27 +59,27 @@
|
|||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
|
@ -79,9 +79,6 @@
|
|||
<ClInclude Include="..\..\config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\portable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\cdio\sector.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -91,5 +88,8 @@
|
|||
<ClInclude Include="..\..\cdio\memory.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\cdio\portable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -33,8 +33,8 @@
|
|||
#endif
|
||||
|
||||
#include <cdio/logging.h>
|
||||
#include <cdio/portable.h>
|
||||
#include "cdio_assert.h"
|
||||
#include "portable.h"
|
||||
|
||||
cdio_log_level_t cdio_loglevel_default = CDIO_LOG_WARN;
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include <cdio/sector.h>
|
||||
#include <cdio/util.h>
|
||||
#include <cdio/logging.h>
|
||||
#include <cdio/portable.h>
|
||||
#include "cdio_assert.h"
|
||||
#include "portable.h"
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -24,6 +24,7 @@
|
|||
<ClInclude Include="..\..\cdio\cdtext.h" />
|
||||
<ClInclude Include="..\..\cdio\iso9660.h" />
|
||||
<ClInclude Include="..\..\cdio\logging.h" />
|
||||
<ClInclude Include="..\..\cdio\portable.h" />
|
||||
<ClInclude Include="..\..\cdio\utf8.h" />
|
||||
<ClInclude Include="..\..\cdio\util.h" />
|
||||
<ClInclude Include="..\..\config.h" />
|
||||
|
@ -50,27 +51,27 @@
|
|||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
|
@ -50,6 +50,9 @@
|
|||
<ClInclude Include="..\..\cdio\cdtext.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\cdio\portable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\iso9660_fs.c">
|
||||
|
|
|
@ -31,6 +31,7 @@ const char ISO_STANDARD_ID[] = {'C', 'D', '0', '0', '1'};
|
|||
#include <cdio/bytesex.h>
|
||||
#include <cdio/iso9660.h>
|
||||
#include <cdio/util.h>
|
||||
#include <cdio/portable.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <cdio/iso9660.h>
|
||||
#include <cdio/util.h>
|
||||
#include <cdio/utf8.h>
|
||||
#include <cdio/portable.h>
|
||||
|
||||
/* Private headers */
|
||||
#include "cdio_assert.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -45,27 +45,27 @@
|
|||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -81,27 +81,27 @@
|
|||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
|
@ -174,10 +174,10 @@ int is_zero_mbr(FILE *fp)
|
|||
static int write_bootmark(FILE *fp)
|
||||
{
|
||||
unsigned char aucRef[] = {0x55, 0xAA};
|
||||
int pos = 0x1FE;
|
||||
uint32_t pos = 0x1FE;
|
||||
FAKE_FD* fd = (FAKE_FD*)fp;
|
||||
|
||||
/* We use fp->_bufsiz as our sector size indicator */
|
||||
for (pos = 0x1FE; pos < fp->_bufsiz; pos += 0x200) {
|
||||
for (pos = 0x1FE; pos < fd->_sector_size; pos += 0x200) {
|
||||
if (!write_data(fp, pos, aucRef, sizeof(aucRef)))
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -89,19 +89,20 @@ int64_t read_sectors(HANDLE hDrive, uint64_t SectorSize,
|
|||
}
|
||||
|
||||
/*
|
||||
* The following calls use a bastardized fp on Windows that contains:
|
||||
* fp->_ptr: a Windows handle
|
||||
* fp->_bufsiz: the sector size
|
||||
* fp->_cnt: a file offset
|
||||
* The following calls use a hijacked fp on Windows that contains:
|
||||
* fp->_handle: a Windows handle
|
||||
* fp->_sector_size: the sector size
|
||||
* fp->_offset: a file offset
|
||||
*/
|
||||
int contains_data(FILE *fp, uint64_t Position,
|
||||
const void *pData, uint64_t Len)
|
||||
{
|
||||
unsigned char aucBuf[MAX_DATA_LEN];
|
||||
HANDLE hDrive = (HANDLE)fp->_ptr;
|
||||
uint64_t SectorSize = (uint64_t)fp->_bufsiz;
|
||||
FAKE_FD* fd = (FAKE_FD*)fp;
|
||||
HANDLE hDrive = (HANDLE)fd->_handle;
|
||||
uint64_t SectorSize = (uint64_t)fd->_sector_size;
|
||||
uint64_t StartSector, EndSector, NumSectors;
|
||||
Position += (uint64_t)fp->_cnt;
|
||||
Position += fd->_offset;
|
||||
|
||||
StartSector = Position/SectorSize;
|
||||
EndSector = (Position+Len+SectorSize-1)/SectorSize;
|
||||
|
@ -133,10 +134,11 @@ int write_data(FILE *fp, uint64_t Position,
|
|||
const void *pData, uint64_t Len)
|
||||
{
|
||||
unsigned char aucBuf[MAX_DATA_LEN];
|
||||
HANDLE hDrive = (HANDLE)fp->_ptr;
|
||||
uint64_t SectorSize = (uint64_t)fp->_bufsiz;
|
||||
FAKE_FD* fd = (FAKE_FD*)fp;
|
||||
HANDLE hDrive = (HANDLE)fd->_handle;
|
||||
uint64_t SectorSize = (uint64_t)fd->_sector_size;
|
||||
uint64_t StartSector, EndSector, NumSectors;
|
||||
Position += (uint64_t)fp->_cnt;
|
||||
Position += fd->_offset;
|
||||
|
||||
StartSector = Position/SectorSize;
|
||||
EndSector = (Position+Len+SectorSize-1)/SectorSize;
|
||||
|
|
|
@ -6,6 +6,13 @@
|
|||
/* Max valid value of uiLen for contains_data */
|
||||
#define MAX_DATA_LEN 32768
|
||||
|
||||
/* We hijack the FILE structure for our own needs */
|
||||
typedef struct {
|
||||
void *_handle;
|
||||
uint64_t _offset;
|
||||
uint32_t _sector_size;
|
||||
} FAKE_FD;
|
||||
|
||||
/* Checks if a file contains a data pattern of length Len at position
|
||||
Position. The file pointer will change when calling this function! */
|
||||
int contains_data(FILE *fp, uint64_t Position,
|
||||
|
|
|
@ -270,6 +270,9 @@ DWORD DownloadFile(const char* url, const char* file, HWND hProgressDialog)
|
|||
SendMessage(hProgressDialog, UM_PROGRESS_INIT, 0, 0);
|
||||
}
|
||||
|
||||
if (file == NULL)
|
||||
goto out;
|
||||
|
||||
for (last_slash = safe_strlen(file); last_slash != 0; last_slash--) {
|
||||
if ((file[last_slash] == '/') || (file[last_slash] == '\\')) {
|
||||
last_slash++;
|
||||
|
|
|
@ -59,15 +59,20 @@ static __inline BOOL _GetRegistryKey(HKEY key_root, const char* key_name, DWORD
|
|||
LONG s;
|
||||
HKEY hSoftware = NULL, hApp = NULL;
|
||||
DWORD dwDisp, dwType = -1, dwSize = dest_size;
|
||||
char long_key_name[256] = "SOFTWARE\\";
|
||||
// VS Code Analysis complains if we don't break our initialization into chars
|
||||
char long_key_name[256] = { 0 };
|
||||
memset(dest, 0, dest_size);
|
||||
|
||||
if (key_name == NULL)
|
||||
return FALSE;
|
||||
|
||||
for (i=safe_strlen(key_name); i>0; i--) {
|
||||
if (key_name[i] == '\\')
|
||||
break;
|
||||
}
|
||||
|
||||
if (i != 0) {
|
||||
strcpy(long_key_name, "SOFTWARE\\");
|
||||
safe_strcat(long_key_name, sizeof(long_key_name), key_name);
|
||||
long_key_name[sizeof("SOFTWARE\\") + i-1] = 0;
|
||||
i++;
|
||||
|
|
|
@ -2918,14 +2918,14 @@ relaunch:
|
|||
continue;
|
||||
}
|
||||
// Alt-I => Toggle ISO support
|
||||
// This is useful if you have a dual ISO/DD image and you want to force Rufus to use
|
||||
// This is useful if you have an ISOHybrid image and you want to force Rufus to use
|
||||
// DD-mode when writing the data.
|
||||
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'I')) {
|
||||
enable_iso = !enable_iso;
|
||||
PrintStatus2000(lmprintf(MSG_262), enable_iso);
|
||||
if (image_path != NULL) {
|
||||
iso_provided = TRUE;
|
||||
PostMessage(hDlg, WM_COMMAND, IDC_SELECT_ISO, 0);
|
||||
SendMessage(hDlg, WM_COMMAND, IDC_SELECT_ISO, 0);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -32,7 +32,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
|
||||
CAPTION "Rufus 2.3.695"
|
||||
CAPTION "Rufus 2.3.696"
|
||||
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
||||
|
@ -298,8 +298,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,3,695,0
|
||||
PRODUCTVERSION 2,3,695,0
|
||||
FILEVERSION 2,3,696,0
|
||||
PRODUCTVERSION 2,3,696,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -316,13 +316,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "2.3.695"
|
||||
VALUE "FileVersion", "2.3.696"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "2.3.695"
|
||||
VALUE "ProductVersion", "2.3.696"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -41,27 +41,27 @@
|
|||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -43,27 +43,27 @@
|
|||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
|
@ -444,8 +444,12 @@ static BOOL WimExtractFile_7z(const char* image, int index, const char* src, con
|
|||
char tmpdst[MAX_PATH];
|
||||
|
||||
uprintf("Opening: %s:[%d] (7-Zip)", image, index);
|
||||
|
||||
if ((image == NULL) || (src == NULL) || (dst == NULL))
|
||||
return FALSE;
|
||||
|
||||
safe_strcpy(tmpdst, sizeof(tmpdst), dst);
|
||||
for (i=safe_strlen(tmpdst); i>0; i--) {
|
||||
for (i=strlen(tmpdst)-1; i>0; i--) {
|
||||
if (tmpdst[i] == '\\')
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
if Test%BUILD_ALT_DIR%==Test goto usage
|
||||
|
||||
::# /M 2 for multiple cores
|
||||
set BUILD_CMD=build -bcwgZ -M2
|
||||
set BUILD_CMD=build -bcwgZ -M12
|
||||
set PWD=%~dp0
|
||||
|
||||
::# Set target platform type
|
||||
|
|
Loading…
Reference in a new issue