Skip to content

Commit

Permalink
[ui] enable setting of icon and extended label
Browse files Browse the repository at this point in the history
* Creates an UTF-16 autoconf.inf with label, as well as autoconf.ico
* also fixed extended labels not displaying - closes #48
* also bumped version to rufus-next
* also factorized iso props analysis
* additional fixes
  • Loading branch information
pbatard committed Feb 21, 2012
1 parent f5939d1 commit 7e7c751
Show file tree
Hide file tree
Showing 17 changed files with 357 additions and 116 deletions.
20 changes: 10 additions & 10 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for rufus 1.1.1.
# Generated by GNU Autoconf 2.68 for rufus 1.1.2.
#
# Report bugs to <https://github.com/pbatard/rufus/issues>.
#
Expand Down Expand Up @@ -559,8 +559,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='rufus'
PACKAGE_TARNAME='rufus'
PACKAGE_VERSION='1.1.1'
PACKAGE_STRING='rufus 1.1.1'
PACKAGE_VERSION='1.1.2'
PACKAGE_STRING='rufus 1.1.2'
PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues'
PACKAGE_URL='http://rufus.akeo.ie'

Expand Down Expand Up @@ -1204,7 +1204,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures rufus 1.1.1 to adapt to many kinds of systems.
\`configure' configures rufus 1.1.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1270,7 +1270,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of rufus 1.1.1:";;
short | recursive ) echo "Configuration of rufus 1.1.2:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1363,7 +1363,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
rufus configure 1.1.1
rufus configure 1.1.2
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1418,7 +1418,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by rufus $as_me 1.1.1, which was
It was created by rufus $as_me 1.1.2, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
Expand Down Expand Up @@ -2233,7 +2233,7 @@ fi
# Define the identity of the package.
PACKAGE='rufus'
VERSION='1.1.1'
VERSION='1.1.2'
cat >>confdefs.h <<_ACEOF
Expand Down Expand Up @@ -4091,7 +4091,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by rufus $as_me 1.1.1, which was
This file was extended by rufus $as_me 1.1.2, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -4145,7 +4145,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
rufus config.status 1.1.1
rufus config.status 1.1.2
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([rufus], [1.1.1], [https://github.com/pbatard/rufus/issues], [rufus], [http://rufus.akeo.ie])
AC_INIT([rufus], [1.1.2], [https://github.com/pbatard/rufus/issues], [rufus], [http://rufus.akeo.ie])
AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies])
AC_CONFIG_SRCDIR([src/rufus.c])
AC_CONFIG_MACRO_DIR([m4])
Expand Down
3 changes: 2 additions & 1 deletion src/.msvc/rufus_2010.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
Expand Down Expand Up @@ -163,6 +163,7 @@
<ClCompile Include="..\drive.c" />
<ClCompile Include="..\format.c" />
<ClCompile Include="..\dos.c" />
<ClCompile Include="..\icon.c" />
<ClCompile Include="..\iso.c" />
<ClCompile Include="..\rufus.c" />
<ClCompile Include="..\stdio.c" />
Expand Down
5 changes: 4 additions & 1 deletion src/.msvc/rufus_2010.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
Expand Down Expand Up @@ -45,6 +45,9 @@
<ClCompile Include="..\iso.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\icon.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\rufus.h">
Expand Down
1 change: 1 addition & 0 deletions src/.msvc/rufus_sources
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ SOURCES=rufus.c \
format.c \
stdio.c \
stdlg.c \
icon.c \
iso.c \
dos.c \
dos_locale.c \
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pkg_v_rc_0 = @echo " RC $@";
%_rc.o: %.rc
$(pkg_v_rc)$(WINDRES) $(AM_RCFLAGS) -i $< -o $@

rufus_SOURCES = drive.c iso.c dos.c dos_locale.c badblocks.c syslinux.c format.c stdio.c stdlg.c rufus.c
rufus_SOURCES = drive.c icon.c iso.c dos.c dos_locale.c badblocks.c syslinux.c format.c stdio.c stdlg.c rufus.c
rufus_CFLAGS = -I./ms-sys/inc -I./syslinux/libfat -I./syslinux/libinstaller -I./libcdio $(AM_CFLAGS)
rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows
rufus_LDADD = rufus_rc.o ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a \
Expand Down
21 changes: 15 additions & 6 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am_rufus_OBJECTS = rufus-drive.$(OBJEXT) rufus-iso.$(OBJEXT) \
rufus-dos.$(OBJEXT) rufus-dos_locale.$(OBJEXT) \
rufus-badblocks.$(OBJEXT) rufus-syslinux.$(OBJEXT) \
rufus-format.$(OBJEXT) rufus-stdio.$(OBJEXT) \
rufus-stdlg.$(OBJEXT) rufus-rufus.$(OBJEXT)
am_rufus_OBJECTS = rufus-drive.$(OBJEXT) rufus-icon.$(OBJEXT) \
rufus-iso.$(OBJEXT) rufus-dos.$(OBJEXT) \
rufus-dos_locale.$(OBJEXT) rufus-badblocks.$(OBJEXT) \
rufus-syslinux.$(OBJEXT) rufus-format.$(OBJEXT) \
rufus-stdio.$(OBJEXT) rufus-stdlg.$(OBJEXT) \
rufus-rufus.$(OBJEXT)
rufus_OBJECTS = $(am_rufus_OBJECTS)
rufus_DEPENDENCIES = rufus_rc.o ms-sys/libmssys.a \
syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a \
Expand Down Expand Up @@ -184,7 +185,7 @@ SUBDIRS = ms-sys syslinux/libfat syslinux/libinstaller libcdio/iso9660 libcdio/u
pkg_v_rc = $(pkg_v_rc_$(V))
pkg_v_rc_ = $(pkg_v_rc_$(AM_DEFAULT_VERBOSITY))
pkg_v_rc_0 = @echo " RC $@";
rufus_SOURCES = drive.c iso.c dos.c dos_locale.c badblocks.c syslinux.c format.c stdio.c stdlg.c rufus.c
rufus_SOURCES = drive.c icon.c iso.c dos.c dos_locale.c badblocks.c syslinux.c format.c stdio.c stdlg.c rufus.c
rufus_CFLAGS = -I./ms-sys/inc -I./syslinux/libfat -I./syslinux/libinstaller -I./libcdio $(AM_CFLAGS)
rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows
rufus_LDADD = rufus_rc.o ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a \
Expand Down Expand Up @@ -253,6 +254,14 @@ rufus-drive.obj: drive.c
$(AM_V_CC) @AM_BACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-drive.obj `if test -f 'drive.c'; then $(CYGPATH_W) 'drive.c'; else $(CYGPATH_W) '$(srcdir)/drive.c'; fi`

rufus-icon.o: icon.c
$(AM_V_CC) @AM_BACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-icon.o `test -f 'icon.c' || echo '$(srcdir)/'`icon.c

rufus-icon.obj: icon.c
$(AM_V_CC) @AM_BACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-icon.obj `if test -f 'icon.c'; then $(CYGPATH_W) 'icon.c'; else $(CYGPATH_W) '$(srcdir)/icon.c'; fi`

rufus-iso.o: iso.c
$(AM_V_CC) @AM_BACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-iso.o `test -f 'iso.c' || echo '$(srcdir)/'`iso.c
Expand Down
16 changes: 9 additions & 7 deletions src/drive.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,22 @@ HANDLE GetDriveHandle(DWORD DriveIndex, char* DriveLetter, BOOL bWriteAccess, BO
BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label)
{
HANDLE hDrive;
char DrivePath[] = "#:\\";
static char volume_label[MAX_PATH+1];
wchar_t wDrivePath[] = L"#:\\";
wchar_t wVolumeLabel[MAX_PATH+1];
static char VolumeLabel[MAX_PATH+1];

*label = STR_NO_LABEL;

hDrive = GetDriveHandle(DriveIndex, DrivePath, FALSE, FALSE);
hDrive = GetDriveHandle(DriveIndex, letter, FALSE, FALSE);
if (hDrive == INVALID_HANDLE_VALUE)
return FALSE;
safe_closehandle(hDrive);
*letter = DrivePath[0];
wDrivePath[0] = *letter;

if (GetVolumeInformationA(DrivePath, volume_label, sizeof(volume_label),
NULL, NULL, NULL, NULL, 0) && *volume_label) {
*label = volume_label;
if (GetVolumeInformationW(wDrivePath, wVolumeLabel, sizeof(wVolumeLabel),
NULL, NULL, NULL, NULL, 0) && *wVolumeLabel) {
wchar_to_utf8_no_alloc(wVolumeLabel, VolumeLabel, sizeof(VolumeLabel));
*label = VolumeLabel;
}

return TRUE;
Expand Down
22 changes: 21 additions & 1 deletion src/format.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ static void ToValidLabel(WCHAR* name, BOOL bFAT)
found = TRUE; break;
}
}
// A FAT label that contains extended chars will be rejected
if (name[i] >= 0x80) {
name[k++] = '_';
found = TRUE;
}
if (found) continue;
}
found = FALSE;
Expand All @@ -173,10 +178,20 @@ static void ToValidLabel(WCHAR* name, BOOL bFAT)
name[k] = 0;
if (bFAT) {
name[11] = 0;
for (i=0, j=0; name[i]!=0; i++)
if (name[i] == '_') j++;
if (i<2*j) {
// If the final label is mostly underscore, use the proposed label
uprintf("FAT label is mostly undercores. Using '%s' label instead.\n", SelectedDrive.proposed_label);
for(i=0; SelectedDrive.proposed_label[i]!=0; i++)
name[i] = SelectedDrive.proposed_label[i];
name[i] = 0;
}
} else {
name[32] = 0;
}
/* Needed for disk by label isolinux.cfg workaround */

// Needed for disk by label isolinux.cfg workaround
wchar_to_utf8_no_alloc(name, iso_report.usb_label, sizeof(iso_report.usb_label));
}

Expand Down Expand Up @@ -616,6 +631,9 @@ DWORD WINAPI FormatThread(LPVOID param)
}
break;
}
} else {
if (IsChecked(IDC_SET_ICON))
SetAutorun(drive_name);
}

// We issue a complete remount of the filesystem at on account of:
Expand Down Expand Up @@ -648,6 +666,8 @@ DWORD WINAPI FormatThread(LPVOID param)
}
break;
}
if (IsChecked(IDC_SET_ICON))
SetAutorun(drive_name);
// Issue another complete remount before we exit, to ensure we're clean
RemountVolume(drive_name[0]);
}
Expand Down
Loading

0 comments on commit 7e7c751

Please sign in to comment.