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

[core] force elevation for unprivileged users

* Using "highestAvailable" elevation allows standard users to run Rufus
  without being prompted for elevations, which prevents them from both
  detecting and formatting USB drives
* Since non administrator access is useless, switch to "requireAdministrator"
* Closes #153
* Also fix small issues with saving log and syslinux detection report
This commit is contained in:
Pete Batard 2013-06-30 02:31:52 +01:00
parent bbab5a148d
commit e5da529eca
4 changed files with 17 additions and 18 deletions

View file

@ -21,7 +21,7 @@
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="highestAvailable"
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>

View file

@ -90,7 +90,7 @@ static wchar_t* get_token_data_line(const wchar_t* wtoken, wchar_t* wline)
return (wline[r] == 0)?NULL:&wline[r];
}
// Parse a file (ANSI or UTF-8 or UTF-16) and return the data for the first occurrence of 'token'
// Parse a file (ANSI or UTF-8 or UTF-16) and return the data for the first occurrence of 'token'
// The returned string is UTF-8 and MUST be freed by the caller
char* get_token_data_file(const char* token, const char* filename)
{
@ -135,7 +135,7 @@ out:
return ret;
}
// Parse a buffer (ANSI or UTF-8) and return the data for the 'n'th occurrence of 'token'
// Parse a buffer (ANSI or UTF-8) and return the data for the 'n'th occurrence of 'token'
// The returned string is UTF-8 and MUST be freed by the caller
char* get_token_data_buffer(const char* token, unsigned int n, const char* buffer, size_t buffer_size)
{
@ -345,7 +345,7 @@ out:
if (fd_in != NULL) fclose(fd_in);
if (fd_out != NULL) fclose(fd_out);
// If an insertion occurred, delete existing file and use the new one
// If an insertion occurred, delete existing file and use the new one
if (ret != NULL) {
// We're in Windows text mode => Remove CRs if requested
fd_in = _wfopen(wtmpname, L"rb");
@ -375,10 +375,10 @@ out:
return ret;
}
// Search for a specific 'src' substring data for all occurrences of 'token', and replace
// Search for a specific 'src' substring data for all occurrences of 'token', and replace
// it with 'rep'. File can be ANSI or UNICODE and is overwritten. Parameters are UTF-8.
// The parsed line is of the form: [ ]token[ ]data
// Returns a pointer to rep if replacement occurred, NULL otherwise
// Returns a pointer to rep if replacement occurred, NULL otherwise
char* replace_in_token_data(const char* filename, const char* token, const char* src, const char* rep, BOOL dos2unix)
{
const wchar_t* outmode[] = { L"w", L"w, ccs=UTF-8", L"w, ccs=UTF-16LE" };
@ -491,7 +491,7 @@ out:
if (fd_in != NULL) fclose(fd_in);
if (fd_out != NULL) fclose(fd_out);
// If a replacement occurred, delete existing file and use the new one
// If a replacement occurred, delete existing file and use the new one
if (ret != NULL) {
// We're in Windows text mode => Remove CRs if requested
fd_in = _wfopen(wtmpname, L"rb");

View file

@ -892,8 +892,9 @@ BOOL CALLBACK LogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
return TRUE;
case IDC_LOG_SAVE:
log_size = GetWindowTextLengthU(hLog);
if (log_size > 0)
log_buffer = (char*)malloc(log_size);
if (log_size <= 0)
break;
log_buffer = (char*)malloc(log_size);
if (log_buffer != NULL) {
log_size = GetDlgItemTextU(hDlg, IDC_LOG_EDIT, log_buffer, log_size);
if (log_size != 0) {
@ -905,8 +906,6 @@ BOOL CALLBACK LogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
safe_free(filepath);
}
safe_free(log_buffer);
} else {
uprintf("Could not allocate buffer to save log\n");
}
break;
}
@ -1027,11 +1026,11 @@ DWORD WINAPI ISOScanThread(LPVOID param)
safe_free(iso_path);
goto out;
}
uprintf("ISO label: '%s'\r\n Size: %lld bytes\r\n Has a >4GB file: %s\r\n Uses EFI: %s%s\r\n Uses Bootmgr: %s\r\n Uses WinPE: %s%s\r\n Uses isolinux: %s (v%s)\n",
uprintf("ISO label: '%s'\r\n Size: %lld bytes\r\n Has a >4GB file: %s\r\n Uses EFI: %s%s\r\n Uses Bootmgr: %s\r\n Uses WinPE: %s%s\r\n Uses isolinux: %s %s\n",
iso_report.label, iso_report.projected_size, iso_report.has_4GB_file?"Yes":"No", (iso_report.has_efi || iso_report.has_win7_efi)?"Yes":"No",
(iso_report.has_win7_efi && (!iso_report.has_efi))?" (win7_x64)":"", iso_report.has_bootmgr?"Yes":"No",
IS_WINPE(iso_report.winpe)?"Yes":"No", (iso_report.uses_minint)?" (with /minint)":"", iso_report.has_isolinux?"Yes":"No",
iso_report.has_syslinux_v5?"5.0 or later":"4.x or earlier");
iso_report.has_syslinux_v5?"(v5.0 or later)":iso_report.has_isolinux?"(v4.x or earlier)":"");
if (iso_report.has_isolinux && !iso_report.has_syslinux_v5) {
for (i=0; i<NB_OLD_C32; i++) {
uprintf(" With an old %s: %s\n", old_c32_name[i], iso_report.has_old_c32[i]?"Yes":"No");

View file

@ -30,7 +30,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 329
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.3.4.260"
CAPTION "Rufus v1.3.4.261"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -278,8 +278,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,4,260
PRODUCTVERSION 1,3,4,260
FILEVERSION 1,3,4,261
PRODUCTVERSION 1,3,4,261
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -296,13 +296,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.3.4.260"
VALUE "FileVersion", "1.3.4.261"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.3.4.260"
VALUE "ProductVersion", "1.3.4.261"
END
END
BLOCK "VarFileInfo"