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

[misc] enable DEP (Data Execution Prevention) on MinGW

* Also fix minor warnings
This commit is contained in:
Pete Batard 2017-05-01 23:55:58 +01:00
parent 7b37208820
commit 9950f5c088
5 changed files with 26 additions and 23 deletions

3
configure vendored
View file

@ -3816,7 +3816,8 @@ $as_echo "#define _GNU_SOURCE /**/" >>confdefs.h
# Clang needs an explicit WIN32_WINNT defined else it produces warnings
# in msapi_utf8.h - including winver.h only doesn't work
AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x501 -D_WIN32_IE=0x501 -D_WIN32_WINNT=0x501"
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined"
# "-Wl,--nxcompat" to enable DEP (Data Execution Prevention)
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat"
# Debug symbols
# Check whether --enable-debug was given.

View file

@ -20,7 +20,8 @@ AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions])
# Clang needs an explicit WIN32_WINNT defined else it produces warnings
# in msapi_utf8.h - including winver.h only doesn't work
AM_CFLAGS="${AM_CFLAGS} -DWINVER=0x501 -D_WIN32_IE=0x501 -D_WIN32_WINNT=0x501"
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined"
# "-Wl,--nxcompat" to enable DEP (Data Execution Prevention)
AM_LDFLAGS="${AM_LDFLAGS} -Wl,-no-undefined -Wl,--nxcompat"
# Debug symbols
AC_ARG_ENABLE([debug],

View file

@ -532,7 +532,8 @@ BOOL SearchProcess(char* HandleName, BOOL bPartialMatch, BOOL bIgnoreSelf)
uprintf("\r\nNOTE: The following process(es) or service(s) are accessing %s:", HandleName);
if (!GetModuleFileNameExU(processHandle, 0, exe_path, MAX_PATH - 1))
safe_sprintf(exe_path, MAX_PATH, "Unknown_Process_%ld", handleInfo->UniqueProcessId);
safe_sprintf(exe_path, MAX_PATH, "Unknown_Process_%" PRIu64,
(ULONGLONG) handleInfo->UniqueProcessId);
}
out:

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.15.1101"
CAPTION "Rufus 2.15.1102"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -334,8 +334,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,15,1101,0
PRODUCTVERSION 2,15,1101,0
FILEVERSION 2,15,1102,0
PRODUCTVERSION 2,15,1102,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -352,13 +352,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.15.1101"
VALUE "FileVersion", "2.15.1102"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.15.1101"
VALUE "ProductVersion", "2.15.1102"
END
END
BLOCK "VarFileInfo"

View file

@ -52,8 +52,8 @@ PF_TYPE_DECL(WINAPI, LPITEMIDLIST, SHSimpleIDListFromPath, (PCWSTR pszPath));
static HICON hMessageIcon = (HICON)INVALID_HANDLE_VALUE;
static char* szMessageText = NULL;
static char* szMessageTitle = NULL;
static char **szChoice;
static int nChoices;
static char **szSelectionChoice;
static int nSelectionChoices;
static HWND hBrowseEdit;
extern HWND hUpdatesDlg;
static WNDPROC pOrgBrowseWndproc;
@ -864,10 +864,10 @@ INT_PTR CALLBACK SelectionCallback(HWND hDlg, UINT message, WPARAM wParam, LPARA
switch (message) {
case WM_INITDIALOG:
// Don't overflow our max radio button
if (nChoices > (IDC_SELECTION_CHOICEMAX - IDC_SELECTION_CHOICE1 + 1)) {
if (nSelectionChoices > (IDC_SELECTION_CHOICEMAX - IDC_SELECTION_CHOICE1 + 1)) {
uprintf("Warning: Too many options requested for Selection (%d vs %d)",
nChoices, IDC_SELECTION_CHOICEMAX - IDC_SELECTION_CHOICE1);
nChoices = IDC_SELECTION_CHOICEMAX - IDC_SELECTION_CHOICE1;
nSelectionChoices, IDC_SELECTION_CHOICEMAX - IDC_SELECTION_CHOICE1);
nSelectionChoices = IDC_SELECTION_CHOICEMAX - IDC_SELECTION_CHOICE1;
}
// TODO: This shouldn't be needed when using DS_SHELLFONT
// Get the system message box font. See http://stackoverflow.com/a/6057761
@ -886,7 +886,7 @@ INT_PTR CALLBACK SelectionCallback(HWND hDlg, UINT message, WPARAM wParam, LPARA
// Set the dialog to use the system message box font
SendMessage(hDlg, WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0));
SendMessage(GetDlgItem(hDlg, IDC_SELECTION_TEXT), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0));
for (i = 0; i < nChoices; i++)
for (i = 0; i < nSelectionChoices; i++)
SendMessage(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0));
SendMessage(GetDlgItem(hDlg, IDYES), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0));
SendMessage(GetDlgItem(hDlg, IDNO), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0));
@ -901,8 +901,8 @@ INT_PTR CALLBACK SelectionCallback(HWND hDlg, UINT message, WPARAM wParam, LPARA
SetWindowTextU(hDlg, szMessageTitle);
SetWindowTextU(GetDlgItem(hDlg, IDCANCEL), lmprintf(MSG_007));
SetWindowTextU(GetDlgItem(hDlg, IDC_SELECTION_TEXT), szMessageText);
for (i = 0; i < nChoices; i++) {
SetWindowTextU(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i), szChoice[i]);
for (i = 0; i < nSelectionChoices; i++) {
SetWindowTextU(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i), szSelectionChoice[i]);
ShowWindow(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i), SW_SHOW);
}
// Move/Resize the controls as needed to fit our text
@ -916,12 +916,12 @@ INT_PTR CALLBACK SelectionCallback(HWND hDlg, UINT message, WPARAM wParam, LPARA
if (hDC != NULL)
ReleaseDC(hCtrl, hDC);
ResizeMoveCtrl(hDlg, hCtrl, 0, 0, 0, dh, 1.0f);
for (i = 0; i < nChoices; i++)
for (i = 0; i < nSelectionChoices; i++)
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i), 0, dh, 0, 0, 1.0f);
if (nChoices > 2) {
if (nSelectionChoices > 2) {
GetWindowRect(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1), &rect);
GetWindowRect(GetDlgItem(hDlg, IDC_SELECTION_CHOICE2), &rect2);
dh += (nChoices - 2) * (rect2.top - rect.top) + 5;
dh += (nSelectionChoices - 2) * (rect2.top - rect.top) + 5;
}
ResizeMoveCtrl(hDlg, hDlg, 0, 0, 0, dh, 1.0f);
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, -1), 0, 0, 0, dh, 1.0f); // IDC_STATIC = -1
@ -952,9 +952,9 @@ INT_PTR CALLBACK SelectionCallback(HWND hDlg, UINT message, WPARAM wParam, LPARA
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
for (i = 0; (i < nChoices) &&
for (i = 0; (i < nSelectionChoices) &&
(Button_GetCheck(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i)) != BST_CHECKED); i++);
if (i < nChoices)
if (i < nSelectionChoices)
r = i + 1;
// Fall through
case IDNO:
@ -977,8 +977,8 @@ int Selection(char* title, char* message, char** choices, int size)
dialog_showing++;
szMessageTitle = title;
szMessageText = message;
szChoice = choices;
nChoices = size;
szSelectionChoice = choices;
nSelectionChoices = size;
ret = (int)MyDialogBox(hMainInstance, IDD_SELECTION, hMainDialog, SelectionCallback);
dialog_showing--;