From 8db7e1720a1750e707bd089cd6a6f28b34cbf88c Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Fri, 30 Dec 2011 17:58:18 +0000 Subject: [PATCH] [misc] added magic key to delete autorun LGP * Alt-D can be used to reset autorun policy * can be useful if app crashed --- src/rufus.c | 15 ++++++++++++--- src/rufus.rc | 12 ++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/rufus.c b/src/rufus.c index edf011cb..8758c5fa 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -44,6 +44,8 @@ static const char* FileSystemLabel[FS_MAX] = { "FAT", "FAT32", "NTFS", "exFAT" } static const char* ClusterSizeLabel[] = { "512 bytes", "1024 bytes","2048 bytes","4096 bytes","8192 bytes", "16 kilobytes", "32 kilobytes", "64 kilobytes", "128 kilobytes", "256 kilobytes", "512 kilobytes", "1024 kilobytes","2048 kilobytes","4096 kilobytes","8192 kilobytes","16 megabytes","32 megabytes" }; +// For LGP set/restore +static BOOL existing_key = FALSE; /* * Globals @@ -740,8 +742,7 @@ BOOL SetLGP(BOOL bRestore, const char* szPath, const char* szPolicy, DWORD dwVal DWORD disp, regtype, val, val_size=sizeof(DWORD); HRESULT hr; IGroupPolicyObject* pLGPO; - // These statuc values are used to restore initial state - static BOOL existing_key = FALSE; + // Along with global 'existing_key', this static value is used to restore initial state static DWORD original_val; HKEY path_key = NULL, policy_key = NULL; // MSVC is finicky about these ones => redefine them @@ -1130,8 +1131,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine ShowWindow(hDlg, SW_SHOWNORMAL); UpdateWindow(hDlg); - // Do our own event processing + // Do our own event processing and process "magic" commands while(GetMessage(&msg, NULL, 0, 0)) { +#ifdef DISABLE_AUTORUN + // Alt-D => Delete the NoDriveTypeAutorun key on exit (useful if the app crashed) + if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'D')) { + PrintStatus(0, "NoDriveTypeAutorun will be deleted on exit."); + existing_key = FALSE; + continue; + } +#endif TranslateMessage(&msg); DispatchMessage(&msg); } diff --git a/src/rufus.rc b/src/rufus.rc index c4df7da3..7fe7d395 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 206, 278 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION "Rufus v1.0.6.106" +CAPTION "Rufus v1.0.6.107" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,236,50,14 @@ -65,7 +65,7 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP CONTROL "http://rufus.akeo.ie",IDC_ABOUT_RUFUS_URL, "SysLink",WS_TABSTOP,46,47,114,9 - LTEXT "Version 1.0.6 (Build 106)",IDC_STATIC,46,19,78,8 + LTEXT "Version 1.0.6 (Build 107)",IDC_STATIC,46,19,78,8 PUSHBUTTON "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP EDITTEXT IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL LTEXT "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 @@ -170,8 +170,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,6,106 - PRODUCTVERSION 1,0,6,106 + FILEVERSION 1,0,6,107 + PRODUCTVERSION 1,0,6,107 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -188,13 +188,13 @@ BEGIN BEGIN VALUE "CompanyName", "akeo.ie" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.0.6.106" + VALUE "FileVersion", "1.0.6.107" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.0.6.106" + VALUE "ProductVersion", "1.0.6.107" END END BLOCK "VarFileInfo"