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:
		
							parent
							
								
									7b37208820
								
							
						
					
					
						commit
						9950f5c088
					
				
					 5 changed files with 26 additions and 23 deletions
				
			
		
							
								
								
									
										3
									
								
								configure
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								configure
									
										
									
									
										vendored
									
									
								
							|  | @ -3816,7 +3816,8 @@ $as_echo "#define _GNU_SOURCE /**/" >>confdefs.h | ||||||
| # Clang needs an explicit WIN32_WINNT defined else it produces warnings | # Clang needs an explicit WIN32_WINNT defined else it produces warnings | ||||||
| # in msapi_utf8.h - including winver.h only doesn't work | # 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_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 | # Debug symbols | ||||||
| # Check whether --enable-debug was given. | # Check whether --enable-debug was given. | ||||||
|  |  | ||||||
|  | @ -20,7 +20,8 @@ AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions]) | ||||||
| # Clang needs an explicit WIN32_WINNT defined else it produces warnings | # Clang needs an explicit WIN32_WINNT defined else it produces warnings | ||||||
| # in msapi_utf8.h - including winver.h only doesn't work | # 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_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 | # Debug symbols | ||||||
| AC_ARG_ENABLE([debug], | AC_ARG_ENABLE([debug], | ||||||
|  |  | ||||||
|  | @ -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); | 			uprintf("\r\nNOTE: The following process(es) or service(s) are accessing %s:", HandleName); | ||||||
| 
 | 
 | ||||||
| 		if (!GetModuleFileNameExU(processHandle, 0, exe_path, MAX_PATH - 1)) | 		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: | out: | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 242, 376 | IDD_DIALOG DIALOGEX 12, 12, 242, 376 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_ACCEPTFILES | EXSTYLE WS_EX_ACCEPTFILES | ||||||
| CAPTION "Rufus 2.15.1101" | CAPTION "Rufus 2.15.1102" | ||||||
| FONT 8, "Segoe UI Symbol", 400, 0, 0x0 | FONT 8, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 |     LTEXT           "Device",IDS_DEVICE_TXT,9,6,200,8 | ||||||
|  | @ -334,8 +334,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 2,15,1101,0 |  FILEVERSION 2,15,1102,0 | ||||||
|  PRODUCTVERSION 2,15,1101,0 |  PRODUCTVERSION 2,15,1102,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -352,13 +352,13 @@ BEGIN | ||||||
|         BEGIN |         BEGIN | ||||||
|             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" |             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "2.15.1101" |             VALUE "FileVersion", "2.15.1102" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" |             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" | ||||||
|             VALUE "OriginalFilename", "rufus.exe" |             VALUE "OriginalFilename", "rufus.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "2.15.1101" |             VALUE "ProductVersion", "2.15.1102" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
							
								
								
									
										30
									
								
								src/stdlg.c
									
										
									
									
									
								
							
							
						
						
									
										30
									
								
								src/stdlg.c
									
										
									
									
									
								
							|  | @ -52,8 +52,8 @@ PF_TYPE_DECL(WINAPI, LPITEMIDLIST, SHSimpleIDListFromPath, (PCWSTR pszPath)); | ||||||
| static HICON hMessageIcon = (HICON)INVALID_HANDLE_VALUE; | static HICON hMessageIcon = (HICON)INVALID_HANDLE_VALUE; | ||||||
| static char* szMessageText = NULL; | static char* szMessageText = NULL; | ||||||
| static char* szMessageTitle = NULL; | static char* szMessageTitle = NULL; | ||||||
| static char **szChoice; | static char **szSelectionChoice; | ||||||
| static int nChoices; | static int nSelectionChoices; | ||||||
| static HWND hBrowseEdit; | static HWND hBrowseEdit; | ||||||
| extern HWND hUpdatesDlg; | extern HWND hUpdatesDlg; | ||||||
| static WNDPROC pOrgBrowseWndproc; | static WNDPROC pOrgBrowseWndproc; | ||||||
|  | @ -864,10 +864,10 @@ INT_PTR CALLBACK SelectionCallback(HWND hDlg, UINT message, WPARAM wParam, LPARA | ||||||
| 	switch (message) { | 	switch (message) { | ||||||
| 	case WM_INITDIALOG: | 	case WM_INITDIALOG: | ||||||
| 		// Don't overflow our max radio button
 | 		// 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)", | 			uprintf("Warning: Too many options requested for Selection (%d vs %d)", | ||||||
| 				nChoices, IDC_SELECTION_CHOICEMAX - IDC_SELECTION_CHOICE1); | 				nSelectionChoices, IDC_SELECTION_CHOICEMAX - IDC_SELECTION_CHOICE1); | ||||||
| 			nChoices = IDC_SELECTION_CHOICEMAX - IDC_SELECTION_CHOICE1; | 			nSelectionChoices = IDC_SELECTION_CHOICEMAX - IDC_SELECTION_CHOICE1; | ||||||
| 		} | 		} | ||||||
| 		// TODO: This shouldn't be needed when using DS_SHELLFONT
 | 		// TODO: This shouldn't be needed when using DS_SHELLFONT
 | ||||||
| 		// Get the system message box font. See http://stackoverflow.com/a/6057761
 | 		// 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
 | 		// Set the dialog to use the system message box font
 | ||||||
| 		SendMessage(hDlg, WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0)); | 		SendMessage(hDlg, WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0)); | ||||||
| 		SendMessage(GetDlgItem(hDlg, IDC_SELECTION_TEXT), 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, 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, IDYES), WM_SETFONT, (WPARAM)hDlgFont, MAKELPARAM(TRUE, 0)); | ||||||
| 		SendMessage(GetDlgItem(hDlg, IDNO), 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(hDlg, szMessageTitle); | ||||||
| 		SetWindowTextU(GetDlgItem(hDlg, IDCANCEL), lmprintf(MSG_007)); | 		SetWindowTextU(GetDlgItem(hDlg, IDCANCEL), lmprintf(MSG_007)); | ||||||
| 		SetWindowTextU(GetDlgItem(hDlg, IDC_SELECTION_TEXT), szMessageText); | 		SetWindowTextU(GetDlgItem(hDlg, IDC_SELECTION_TEXT), szMessageText); | ||||||
| 		for (i = 0; i < nChoices; i++) { | 		for (i = 0; i < nSelectionChoices; i++) { | ||||||
| 			SetWindowTextU(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i), szChoice[i]); | 			SetWindowTextU(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i), szSelectionChoice[i]); | ||||||
| 			ShowWindow(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i), SW_SHOW); | 			ShowWindow(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i), SW_SHOW); | ||||||
| 		} | 		} | ||||||
| 		// Move/Resize the controls as needed to fit our text
 | 		// 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) | 		if (hDC != NULL) | ||||||
| 			ReleaseDC(hCtrl, hDC); | 			ReleaseDC(hCtrl, hDC); | ||||||
| 		ResizeMoveCtrl(hDlg, hCtrl, 0, 0, 0, dh, 1.0f); | 		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); | 			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_CHOICE1), &rect); | ||||||
| 			GetWindowRect(GetDlgItem(hDlg, IDC_SELECTION_CHOICE2), &rect2); | 			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, hDlg, 0, 0, 0, dh, 1.0f); | ||||||
| 		ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, -1), 0, 0, 0, dh, 1.0f);	// IDC_STATIC = -1
 | 		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: | 	case WM_COMMAND: | ||||||
| 		switch (LOWORD(wParam)) { | 		switch (LOWORD(wParam)) { | ||||||
| 		case IDOK: | 		case IDOK: | ||||||
| 			for (i = 0; (i < nChoices) && | 			for (i = 0; (i < nSelectionChoices) && | ||||||
| 				(Button_GetCheck(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i)) != BST_CHECKED); i++); | 				(Button_GetCheck(GetDlgItem(hDlg, IDC_SELECTION_CHOICE1 + i)) != BST_CHECKED); i++); | ||||||
| 			if (i < nChoices) | 			if (i < nSelectionChoices) | ||||||
| 				r = i + 1; | 				r = i + 1; | ||||||
| 			// Fall through
 | 			// Fall through
 | ||||||
| 		case IDNO: | 		case IDNO: | ||||||
|  | @ -977,8 +977,8 @@ int Selection(char* title, char* message, char** choices, int size) | ||||||
| 	dialog_showing++; | 	dialog_showing++; | ||||||
| 	szMessageTitle = title; | 	szMessageTitle = title; | ||||||
| 	szMessageText = message; | 	szMessageText = message; | ||||||
| 	szChoice = choices; | 	szSelectionChoice = choices; | ||||||
| 	nChoices = size; | 	nSelectionChoices = size; | ||||||
| 	ret = (int)MyDialogBox(hMainInstance, IDD_SELECTION, hMainDialog, SelectionCallback); | 	ret = (int)MyDialogBox(hMainInstance, IDD_SELECTION, hMainDialog, SelectionCallback); | ||||||
| 	dialog_showing--; | 	dialog_showing--; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue