mirror of
https://github.com/pbatard/rufus.git
synced 2025-06-04 00:29:00 -04:00
[loc] finalize translations for 3.5
* Also update for latest Fido and simplify SetLGP
This commit is contained in:
parent
688ccfad66
commit
0c368b4e69
10 changed files with 169 additions and 191 deletions
118
src/net.c
118
src/net.c
|
@ -234,7 +234,7 @@ static char* GetShortName(const char* url)
|
|||
if (len < 5)
|
||||
return NULL;
|
||||
|
||||
for (i = len - 1; i > 0; i--) {
|
||||
for (i = len - 2; i > 0; i--) {
|
||||
if (url[i] == '/') {
|
||||
i++;
|
||||
break;
|
||||
|
@ -306,8 +306,10 @@ out:
|
|||
* If hProgressDialog is not NULL, this function will send INIT and EXIT messages
|
||||
* to the dialog in question, with WPARAM being set to nonzero for EXIT on success
|
||||
* and also attempt to indicate progress using an IDC_PROGRESS control
|
||||
* Note that when a buffer is used, the actual size of the buffer is one more than its reported
|
||||
* size (with the extra byte set to 0) to accomodate for calls that need a NUL-terminated buffer.
|
||||
*/
|
||||
static uint64_t DownloadToFileOrBuffer(const char* url, const char* file, BYTE** buffer, HWND hProgressDialog, BOOL bTaskBarProgress)
|
||||
uint64_t DownloadToFileOrBuffer(const char* url, const char* file, BYTE** buffer, HWND hProgressDialog, BOOL bTaskBarProgress)
|
||||
{
|
||||
const char* accept_types[] = {"*/*\0", NULL};
|
||||
const char* short_name;
|
||||
|
@ -344,6 +346,7 @@ static uint64_t DownloadToFileOrBuffer(const char* url, const char* file, BYTE**
|
|||
// Use the progress control provided, if any
|
||||
hProgressBar = GetDlgItem(hProgressDialog, IDC_PROGRESS);
|
||||
if (hProgressBar != NULL) {
|
||||
SendMessage(hProgressBar, PBM_SETSTATE, (WPARAM)PBST_NORMAL, 0);
|
||||
SendMessage(hProgressBar, PBM_SETMARQUEE, FALSE, 0);
|
||||
SendMessage(hProgressBar, PBM_SETPOS, 0, 0);
|
||||
}
|
||||
|
@ -427,7 +430,8 @@ static uint64_t DownloadToFileOrBuffer(const char* url, const char* file, BYTE**
|
|||
uprintf("No buffer pointer provided for download");
|
||||
goto out;
|
||||
}
|
||||
*buffer = malloc((size_t)total_size);
|
||||
// Allocate one extra byte, so that caller can rely on NUL-terminated text if needed
|
||||
*buffer = calloc((size_t)total_size + 1, 1);
|
||||
if (*buffer == NULL) {
|
||||
uprintf("Could not allocate buffer for download");
|
||||
goto out;
|
||||
|
@ -526,6 +530,8 @@ DWORD DownloadSignedFile(const char* url, const char* file, HWND hProgressDialog
|
|||
uprintf("FATAL: Download signature is invalid ✗");
|
||||
DownloadStatus = 403; // Forbidden
|
||||
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_BAD_SIGNATURE);
|
||||
SendMessage(GetDlgItem(hProgressDialog, IDC_PROGRESS), PBM_SETSTATE, (WPARAM)PBST_ERROR, 0);
|
||||
SetTaskbarProgressState(TASKBAR_ERROR);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -866,7 +872,7 @@ BOOL CheckForUpdates(BOOL force)
|
|||
*/
|
||||
static DWORD WINAPI DownloadISOThread(LPVOID param)
|
||||
{
|
||||
char cmdline[512], locale_str[1024], pipe[64] = "\\\\.\\pipe\\";
|
||||
char locale_str[1024], cmdline[sizeof(locale_str) + 512], pipe[64] = "\\\\.\\pipe\\";
|
||||
char powershell_path[MAX_PATH], icon_path[MAX_PATH] = "", script_path[MAX_PATH] = "";
|
||||
char *url = NULL, sig_url[128];
|
||||
BYTE *sig = NULL;
|
||||
|
@ -879,7 +885,7 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
|
|||
// Use a GUID as random unique string, else ill-intentioned security "researchers"
|
||||
// may either spam our pipe or replace our script to fool antivirus solutions into
|
||||
// thinking that Rufus is doing something malicious...
|
||||
CoCreateGuid(&guid);
|
||||
IGNORE_RETVAL(CoCreateGuid(&guid));
|
||||
strcpy(&pipe[9], GuidToString(&guid));
|
||||
static_sprintf(icon_path, "%s%s.ico", temp_dir, APPLICATION_NAME);
|
||||
ExtractAppIcon(icon_path, TRUE);
|
||||
|
@ -892,7 +898,7 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
|
|||
static_strcpy(script_path, "D:\\Projects\\Fido\\Fido.ps1");
|
||||
#else
|
||||
// If we don't have the script, download it
|
||||
if (fido_len == 0) {
|
||||
if (fido_script == NULL) {
|
||||
fido_len = (DWORD)DownloadToFileOrBuffer(fido_url, NULL, &fido_script, hMainDialog, FALSE);
|
||||
if (fido_len == 0)
|
||||
goto out;
|
||||
|
@ -900,6 +906,10 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
|
|||
dwSize = (DWORD)DownloadToFileOrBuffer(sig_url, NULL, &sig, NULL, FALSE);
|
||||
if ((dwSize != RSA_SIGNATURE_SIZE) || (!ValidateOpensslSignature(fido_script, fido_len, sig, dwSize))) {
|
||||
uprintf("FATAL: Signature is invalid ✗");
|
||||
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_BAD_SIGNATURE);
|
||||
SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_ERROR, 0);
|
||||
SetTaskbarProgressState(TASKBAR_ERROR);
|
||||
safe_free(fido_script);
|
||||
free(sig);
|
||||
goto out;
|
||||
}
|
||||
|
@ -910,7 +920,7 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
|
|||
SetTaskbarProgressValue(0, MAX_PROGRESS);
|
||||
SendMessage(hProgress, PBM_SETPOS, 0, 0);
|
||||
}
|
||||
PrintInfo(0, MSG_149);
|
||||
PrintInfo(0, MSG_148);
|
||||
|
||||
assert((fido_script != NULL) && (fido_len != 0));
|
||||
|
||||
|
@ -928,11 +938,11 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
|
|||
safe_closehandle(hFile);
|
||||
#endif
|
||||
static_sprintf(powershell_path, "%s\\WindowsPowerShell\\v1.0\\powershell.exe", system_dir);
|
||||
static_sprintf(locale_str, "%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s",
|
||||
static_sprintf(locale_str, "%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s",
|
||||
selected_locale->txt[0], lmprintf(MSG_135), lmprintf(MSG_136), lmprintf(MSG_137),
|
||||
lmprintf(MSG_138), lmprintf(MSG_139), lmprintf(MSG_040), lmprintf(MSG_140),
|
||||
lmprintf(MSG_141), lmprintf(MSG_006), lmprintf(MSG_007), lmprintf(MSG_042),
|
||||
lmprintf(MSG_142), lmprintf(MSG_143));
|
||||
lmprintf(MSG_138), lmprintf(MSG_139), lmprintf(MSG_040), lmprintf(MSG_140), lmprintf(MSG_141),
|
||||
lmprintf(MSG_006), lmprintf(MSG_007), lmprintf(MSG_042), lmprintf(MSG_142), lmprintf(MSG_143),
|
||||
lmprintf(MSG_144), lmprintf(MSG_145), lmprintf(MSG_146));
|
||||
|
||||
hPipe = CreateNamedPipeA(pipe, PIPE_ACCESS_INBOUND,
|
||||
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES,
|
||||
|
@ -942,9 +952,9 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
|
|||
}
|
||||
|
||||
static_sprintf(cmdline, "%s -NonInteractive -Sta -NoProfile –ExecutionPolicy Bypass "
|
||||
"-File %s -PipeName %s -LocData \"%s\" -Icon %s -AppTitle \"%s\"",
|
||||
powershell_path, script_path, &pipe[9], locale_str, icon_path, lmprintf(MSG_143));
|
||||
// Signal our Windows alerts hook that it should close the IE cookie prompts from Fido
|
||||
"-File %s -DisableFirstRunCustomize -PipeName %s -LocData \"%s\" -Icon %s -AppTitle \"%s\"",
|
||||
powershell_path, script_path, &pipe[9], locale_str, icon_path, lmprintf(MSG_149));
|
||||
// Signal our Windows alert hook that it should close the IE cookie prompts from Fido
|
||||
close_fido_cookie_prompts = TRUE;
|
||||
FormatStatus = RunCommand(cmdline, app_dir, TRUE);
|
||||
close_fido_cookie_prompts = FALSE;
|
||||
|
@ -1008,8 +1018,6 @@ BOOL DownloadISO()
|
|||
SendMessage(hMainDialog, UM_ENABLE_CONTROLS, 0, 0);
|
||||
return FALSE;
|
||||
}
|
||||
// TODO: Can we locate our modal Window and position it/set it on top?
|
||||
// TODO: Send close message to Fido if the user closes Rufus
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1083,81 +1091,3 @@ out:
|
|||
|
||||
return (dwTotalSize > 0);
|
||||
}
|
||||
|
||||
// Resolve an HTTP 301/302 redirect (for a *SINGLE* level)
|
||||
// If no redirect is in effect, or if there is an error, the original URL is returned
|
||||
const char* ResolveRedirect(const char* url)
|
||||
{
|
||||
static char ret_url[128];
|
||||
const char* accept_types[] = { "*/*\0", NULL };
|
||||
char hostname[64], urlpath[128];
|
||||
BOOL r = FALSE;
|
||||
DWORD dwSize;
|
||||
HINTERNET hSession = NULL, hConnection = NULL, hRequest = NULL;
|
||||
URL_COMPONENTSA UrlParts = { sizeof(URL_COMPONENTSA), NULL, 1, (INTERNET_SCHEME)0,
|
||||
hostname, sizeof(hostname), 0, NULL, 1, urlpath, sizeof(urlpath), NULL, 1 };
|
||||
|
||||
PF_TYPE_DECL(WINAPI, BOOL, InternetCrackUrlA, (LPCSTR, DWORD, DWORD, LPURL_COMPONENTSA));
|
||||
PF_TYPE_DECL(WINAPI, HINTERNET, InternetConnectA, (HINTERNET, LPCSTR, INTERNET_PORT, LPCSTR, LPCSTR, DWORD, DWORD, DWORD_PTR));
|
||||
PF_TYPE_DECL(WINAPI, BOOL, InternetReadFile, (HINTERNET, LPVOID, DWORD, LPDWORD));
|
||||
PF_TYPE_DECL(WINAPI, BOOL, InternetCloseHandle, (HINTERNET));
|
||||
PF_TYPE_DECL(WINAPI, HINTERNET, HttpOpenRequestA, (HINTERNET, LPCSTR, LPCSTR, LPCSTR, LPCSTR, LPCSTR*, DWORD, DWORD_PTR));
|
||||
PF_TYPE_DECL(WINAPI, BOOL, HttpSendRequestA, (HINTERNET, LPCSTR, DWORD, LPVOID, DWORD));
|
||||
PF_TYPE_DECL(WINAPI, BOOL, HttpQueryInfoA, (HINTERNET, DWORD, LPVOID, LPDWORD, LPDWORD));
|
||||
PF_INIT_OR_OUT(InternetCrackUrlA, WinInet);
|
||||
PF_INIT_OR_OUT(InternetConnectA, WinInet);
|
||||
PF_INIT_OR_OUT(InternetReadFile, WinInet);
|
||||
PF_INIT_OR_OUT(InternetCloseHandle, WinInet);
|
||||
PF_INIT_OR_OUT(HttpOpenRequestA, WinInet);
|
||||
PF_INIT_OR_OUT(HttpSendRequestA, WinInet);
|
||||
PF_INIT_OR_OUT(HttpQueryInfoA, WinInet);
|
||||
|
||||
if (url == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((!pfInternetCrackUrlA(url, (DWORD)safe_strlen(url), 0, &UrlParts))
|
||||
|| (UrlParts.lpszHostName == NULL) || (UrlParts.lpszUrlPath == NULL))
|
||||
goto out;
|
||||
hostname[sizeof(hostname) - 1] = 0;
|
||||
|
||||
hSession = GetInternetSession(FALSE);
|
||||
if (hSession == NULL)
|
||||
goto out;
|
||||
|
||||
hConnection = pfInternetConnectA(hSession, UrlParts.lpszHostName, UrlParts.nPort, NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD_PTR)NULL);
|
||||
if (hConnection == NULL)
|
||||
goto out;
|
||||
|
||||
hRequest = pfHttpOpenRequestA(hConnection, "GET", UrlParts.lpszUrlPath, NULL, NULL, accept_types,
|
||||
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP | INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS | INTERNET_FLAG_NO_AUTO_REDIRECT |
|
||||
INTERNET_FLAG_NO_COOKIES | INTERNET_FLAG_NO_UI | INTERNET_FLAG_HYPERLINK |
|
||||
((UrlParts.nScheme == INTERNET_SCHEME_HTTPS) ? INTERNET_FLAG_SECURE : 0), (DWORD_PTR)NULL);
|
||||
if (hRequest == NULL)
|
||||
goto out;
|
||||
|
||||
if (!pfHttpSendRequestA(hRequest, NULL, 0, NULL, 0))
|
||||
goto out;
|
||||
|
||||
DownloadStatus = 404;
|
||||
dwSize = sizeof(DownloadStatus);
|
||||
pfHttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, (LPVOID)&DownloadStatus, &dwSize, NULL);
|
||||
switch (DownloadStatus) {
|
||||
case 301:
|
||||
case 302:
|
||||
dwSize = sizeof(ret_url);
|
||||
r = (pfHttpQueryInfoA(hRequest, HTTP_QUERY_LOCATION, (LPVOID)ret_url, &dwSize, NULL) && (dwSize > 0));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
out:
|
||||
if (hRequest)
|
||||
pfInternetCloseHandle(hRequest);
|
||||
if (hConnection)
|
||||
pfInternetCloseHandle(hConnection);
|
||||
if (hSession)
|
||||
pfInternetCloseHandle(hSession);
|
||||
|
||||
return r ? ret_url : url;
|
||||
}
|
||||
|
|
|
@ -907,7 +907,7 @@ void parse_update(char* buf, size_t len)
|
|||
char *arch_names[CPU_ARCH_MAX] = { "x86", "x64", "arm", "arm64", "none" };
|
||||
|
||||
// strchr includes the NUL terminator in the search, so take care of backslash before NUL
|
||||
if ((buf == NULL) || (len < 2) || (len > 65536) || (buf[len-1] != 0) || (buf[len-2] == '\\'))
|
||||
if ((buf == NULL) || (len < 2) || (len > 64 * KB) || (buf[len-1] != 0) || (buf[len-2] == '\\'))
|
||||
return;
|
||||
// Sanitize the data - Not a silver bullet, but it helps
|
||||
len = safe_strlen(buf)+1; // Someone may be inserting NULs
|
||||
|
|
16
src/rufus.c
16
src/rufus.c
|
@ -117,7 +117,7 @@ char embedded_sl_version_str[2][12] = { "?.??", "?.??" };
|
|||
char embedded_sl_version_ext[2][32];
|
||||
char ClusterSizeLabel[MAX_CLUSTER_SIZES][64];
|
||||
char msgbox[1024], msgbox_title[32], *ini_file = NULL, *image_path = NULL, *short_image_path;
|
||||
char image_option_txt[128], fido_url[128];
|
||||
char image_option_txt[128], *fido_url = NULL;
|
||||
StrArray DriveID, DriveLabel, DriveHub, BlockingProcess, ImageList;
|
||||
// Number of steps for each FS for FCC_STRUCTURE_PROGRESS
|
||||
const int nb_steps[FS_MAX] = { 5, 5, 12, 1, 10 };
|
||||
|
@ -1880,7 +1880,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
case WM_COMMAND:
|
||||
#ifdef RUFUS_TEST
|
||||
if (LOWORD(wParam) == IDC_TEST) {
|
||||
uprintf("%s -> %s", FIDO_BASE, ResolveRedirect(FIDO_BASE));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -2264,10 +2263,17 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
KillTimer(hMainDialog, TID_APP_TIMER);
|
||||
if (!IS_ERROR(FormatStatus))
|
||||
PrintInfo(0, MSG_210);
|
||||
else if (SCODE_CODE(FormatStatus))
|
||||
else switch (SCODE_CODE(FormatStatus)) {
|
||||
case ERROR_CANCELLED:
|
||||
PrintInfo(0, MSG_211);
|
||||
else
|
||||
break;
|
||||
case ERROR_BAD_SIGNATURE:
|
||||
PrintInfo(0, MSG_283);
|
||||
break;
|
||||
default:
|
||||
PrintInfo(0, MSG_212);
|
||||
break;
|
||||
}
|
||||
EnableControls(TRUE);
|
||||
break;
|
||||
case UM_TIMER_START:
|
||||
|
@ -3114,6 +3120,7 @@ relaunch:
|
|||
image_options = IMOP_WINTOGO;
|
||||
image_option_txt[0] = 0;
|
||||
select_index = 0;
|
||||
safe_free(fido_url);
|
||||
enable_fido = FALSE;
|
||||
SetProcessDefaultLayout(right_to_left_mode?LAYOUT_RTL:0);
|
||||
if (get_loc_data_file(loc_file, selected_locale))
|
||||
|
@ -3407,6 +3414,7 @@ out:
|
|||
safe_free(update.download_url);
|
||||
safe_free(update.release_notes);
|
||||
safe_free(grub2_buf);
|
||||
safe_free(fido_url);
|
||||
safe_free(fido_script);
|
||||
if (argv != NULL) {
|
||||
for (i=0; i<argc; i++) safe_free(argv[i]);
|
||||
|
|
|
@ -104,8 +104,7 @@
|
|||
#endif
|
||||
#define DOWNLOAD_URL RUFUS_URL "/downloads"
|
||||
#define FILES_URL RUFUS_URL "/files"
|
||||
#define FIDO_BASE "https://github.com/pbatard/Fido/releases/latest"
|
||||
#define FIDO_NAME "Fido.ps1"
|
||||
#define FIDO_VERSION "v1"
|
||||
#define SECURE_BOOT_MORE_INFO_URL "https://github.com/pbatard/rufus/wiki/FAQ#Why_do_I_need_to_disable_Secure_Boot_to_use_UEFINTFS"
|
||||
#define WPPRECORDER_MORE_INFO_URL "https://github.com/pbatard/rufus/wiki/FAQ#BSODs_with_Windows_To_Go_drives_created_from_Windows_10_1809_ISOs"
|
||||
#define SEVENZIP_URL "https://www.7-zip.org"
|
||||
|
@ -459,9 +458,8 @@ extern int nWindowsVersion, nWindowsBuildNumber, dialog_showing;
|
|||
extern int fs, bt, pt, tt;
|
||||
extern unsigned long syslinux_ldlinux_len[2];
|
||||
extern char WindowsVersionStr[128], ubuffer[UBUFFER_SIZE], embedded_sl_version_str[2][12];
|
||||
extern char szFolderPath[MAX_PATH], app_dir[MAX_PATH], temp_dir[MAX_PATH], system_dir[MAX_PATH];
|
||||
extern char sysnative_dir[MAX_PATH], fido_url[128];
|
||||
extern char* image_path;
|
||||
extern char szFolderPath[MAX_PATH], app_dir[MAX_PATH], temp_dir[MAX_PATH], system_dir[MAX_PATH], sysnative_dir[MAX_PATH];
|
||||
extern char *image_path, *fido_url;
|
||||
|
||||
/*
|
||||
* Shared prototypes
|
||||
|
@ -523,6 +521,7 @@ extern BOOL ResetDevice(int index);
|
|||
extern BOOL GetOpticalMedia(IMG_SAVE* img_save);
|
||||
extern BOOL SetLGP(BOOL bRestore, BOOL* bExistingKey, const char* szPath, const char* szPolicy, DWORD dwValue);
|
||||
extern LONG GetEntryWidth(HWND hDropDown, const char* entry);
|
||||
extern uint64_t DownloadToFileOrBuffer(const char* url, const char* file, BYTE** buffer, HWND hProgressDialog, BOOL bTaskBarProgress);
|
||||
extern DWORD DownloadSignedFile(const char* url, const char* file, HWND hProgressDialog, BOOL PromptOnError);
|
||||
extern HANDLE DownloadSignedFileThreaded(const char* url, const char* file, HWND hProgressDialog, BOOL bPromptOnError);
|
||||
extern INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "Rufus 3.5.1455"
|
||||
CAPTION "Rufus 3.5.1456"
|
||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||
|
@ -394,8 +394,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,5,1455,0
|
||||
PRODUCTVERSION 3,5,1455,0
|
||||
FILEVERSION 3,5,1456,0
|
||||
PRODUCTVERSION 3,5,1456,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -413,13 +413,13 @@ BEGIN
|
|||
VALUE "Comments", "https://akeo.ie"
|
||||
VALUE "CompanyName", "Akeo Consulting"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "3.5.1455"
|
||||
VALUE "FileVersion", "3.5.1456"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus-3.5.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "3.5.1455"
|
||||
VALUE "ProductVersion", "3.5.1456"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
39
src/stdfn.c
39
src/stdfn.c
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include <sddl.h>
|
||||
#include <gpedit.h>
|
||||
|
||||
#include "rufus.h"
|
||||
#include "missing.h"
|
||||
|
@ -685,40 +686,6 @@ BOOL IsFontAvailable(const char* font_name)
|
|||
/*
|
||||
* Set or restore a Local Group Policy DWORD key indexed by szPath/SzPolicy
|
||||
*/
|
||||
#pragma push_macro("INTERFACE")
|
||||
#undef INTERFACE
|
||||
#define INTERFACE IGroupPolicyObject
|
||||
#define REGISTRY_EXTENSION_GUID { 0x35378EACL, 0x683F, 0x11D2, {0xA8, 0x9A, 0x00, 0xC0, 0x4F, 0xBB, 0xCF, 0xA2} }
|
||||
#define GPO_OPEN_LOAD_REGISTRY 1
|
||||
#define GPO_SECTION_MACHINE 2
|
||||
typedef enum _GROUP_POLICY_OBJECT_TYPE {
|
||||
GPOTypeLocal = 0, GPOTypeRemote, GPOTypeDS
|
||||
} GROUP_POLICY_OBJECT_TYPE, *PGROUP_POLICY_OBJECT_TYPE;
|
||||
DECLARE_INTERFACE_(IGroupPolicyObject, IUnknown) {
|
||||
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE;
|
||||
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release) (THIS) PURE;
|
||||
STDMETHOD(New) (THIS_ LPOLESTR pszDomainName, LPOLESTR pszDisplayName, DWORD dwFlags) PURE;
|
||||
STDMETHOD(OpenDSGPO) (THIS_ LPOLESTR pszPath, DWORD dwFlags) PURE;
|
||||
STDMETHOD(OpenLocalMachineGPO) (THIS_ DWORD dwFlags) PURE;
|
||||
STDMETHOD(OpenRemoteMachineGPO) (THIS_ LPOLESTR pszComputerName, DWORD dwFlags) PURE;
|
||||
STDMETHOD(Save) (THIS_ BOOL bMachine, BOOL bAdd,GUID *pGuidExtension, GUID *pGuid) PURE;
|
||||
STDMETHOD(Delete) (THIS) PURE;
|
||||
STDMETHOD(GetName) (THIS_ LPOLESTR pszName, int cchMaxLength) PURE;
|
||||
STDMETHOD(GetDisplayName) (THIS_ LPOLESTR pszName, int cchMaxLength) PURE;
|
||||
STDMETHOD(SetDisplayName) (THIS_ LPOLESTR pszName) PURE;
|
||||
STDMETHOD(GetPath) (THIS_ LPOLESTR pszPath, int cchMaxPath) PURE;
|
||||
STDMETHOD(GetDSPath) (THIS_ DWORD dwSection, LPOLESTR pszPath ,int cchMaxPath) PURE;
|
||||
STDMETHOD(GetFileSysPath) (THIS_ DWORD dwSection, LPOLESTR pszPath, int cchMaxPath) PURE;
|
||||
STDMETHOD(GetRegistryKey) (THIS_ DWORD dwSection, HKEY *hKey) PURE;
|
||||
STDMETHOD(GetOptions) (THIS_ DWORD *dwOptions) PURE;
|
||||
STDMETHOD(SetOptions) (THIS_ DWORD dwOptions, DWORD dwMask) PURE;
|
||||
STDMETHOD(GetType) (THIS_ GROUP_POLICY_OBJECT_TYPE *gpoType) PURE;
|
||||
STDMETHOD(GetMachineName) (THIS_ LPOLESTR pszName, int cchMaxLength) PURE;
|
||||
STDMETHOD(GetPropertySheetPages) (THIS_ HPROPSHEETPAGE **hPages, UINT *uPageCount) PURE;
|
||||
};
|
||||
typedef IGroupPolicyObject *LPGROUPPOLICYOBJECT;
|
||||
|
||||
// I've seen rare cases where pLGPO->lpVtbl->Save(...) gets stuck, which prevents the
|
||||
// application from launching altogether. To alleviate this, use a thread that we can
|
||||
// terminate if needed...
|
||||
|
@ -740,7 +707,7 @@ DWORD WINAPI SetLGPThread(LPVOID param)
|
|||
// 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
|
||||
// MSVC is finicky about these ones even if you link against gpedit.lib => redefine them
|
||||
const IID my_IID_IGroupPolicyObject =
|
||||
{ 0xea502723L, 0xa23d, 0x11d1, { 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3 } };
|
||||
const IID my_CLSID_GroupPolicyObject =
|
||||
|
@ -771,7 +738,6 @@ DWORD WINAPI SetLGPThread(LPVOID param)
|
|||
goto error;
|
||||
}
|
||||
|
||||
// The DisableSystemRestore is set in Software\Policies\Microsoft\Windows\DeviceInstall\Settings
|
||||
r = RegCreateKeyExA(path_key, p->szPath, 0, NULL, 0, KEY_SET_VALUE | KEY_QUERY_VALUE,
|
||||
NULL, &policy_key, &disp);
|
||||
if (r != ERROR_SUCCESS) {
|
||||
|
@ -829,7 +795,6 @@ error:
|
|||
pLGPO->lpVtbl->Release(pLGPO);
|
||||
return FALSE;
|
||||
}
|
||||
#pragma pop_macro("INTERFACE")
|
||||
|
||||
BOOL SetLGP(BOOL bRestore, BOOL* bExistingKey, const char* szPath, const char* szPolicy, DWORD dwValue)
|
||||
{
|
||||
|
|
35
src/stdlg.c
35
src/stdlg.c
|
@ -1544,27 +1544,24 @@ BOOL SetUpdateCheck(void)
|
|||
WriteSetting32(SETTING_UPDATE_INTERVAL, 86400);
|
||||
}
|
||||
// Also detect if we can use Fido, which depends on:
|
||||
// - Powershell being installed
|
||||
// - Update check being enabled
|
||||
// - URL for the script being reachable
|
||||
if (ReadSetting32(SETTING_UPDATE_INTERVAL) > 0) {
|
||||
char *p, url[128];
|
||||
// Obviously, we could fetch https://api.github.com/repos/pbatard/Fido/releases/latest
|
||||
// and then parse 'browser_download_url' in the JSON data to get the direct link we
|
||||
// want. But that would force us to download an extra 5 KB of data, which we *really*
|
||||
// don't want to do when we need a superfast availability check.
|
||||
// Therefore, since we don't expect GitHub to change their scheme anytime soon, we
|
||||
// just hack the redirected URL we got back to replace '/tag/' with '/download/'...
|
||||
static_sprintf(url, "%s/%s", ResolveRedirect(FIDO_BASE), FIDO_NAME);
|
||||
p = strstr(url, "/tag/");
|
||||
if (p != NULL) {
|
||||
*p = 0;
|
||||
strcpy(fido_url, url);
|
||||
strcat(fido_url, "/download/");
|
||||
strcat(fido_url, &p[5]);
|
||||
} else {
|
||||
strcpy(fido_url, url);
|
||||
if (((ReadRegistryKey32(REGKEY_HKLM, "Microsoft\\PowerShell\\1\\Install") > 0) ||
|
||||
(ReadRegistryKey32(REGKEY_HKLM, "Microsoft\\PowerShell\\3\\Install") > 0)) &&
|
||||
(ReadSetting32(SETTING_UPDATE_INTERVAL) > 0)) {
|
||||
char *loc = NULL;
|
||||
// Get the Fido URL from parsing a 'Fido.ver' on our server. This enables the use of different
|
||||
// Fido versions from different versions of Rufus, if needed, as opposed to always downloading
|
||||
// the latest release from GitHub, which may contain incompatible changes...
|
||||
uint64_t loc_len = DownloadToFileOrBuffer(RUFUS_URL "/Fido.ver", NULL, (BYTE**)&loc, NULL, FALSE);
|
||||
if ((loc_len != 0) && (loc_len < 4 * KB)) {
|
||||
loc_len++; // DownloadToFileOrBuffer allocated an extra NUL character if needed
|
||||
fido_url = get_token_data_buffer(FIDO_VERSION, 1, loc, (size_t)loc_len);
|
||||
uprintf("Fido URL is %s", fido_url);
|
||||
enable_fido = IsDownloadable(fido_url);
|
||||
}
|
||||
enable_fido = IsDownloadable(fido_url);
|
||||
safe_free(loc);
|
||||
}
|
||||
if (!enable_fido)
|
||||
uprintf("Note: ISO download feature will be disabled");
|
||||
|
@ -2015,7 +2012,7 @@ BOOL SetAlertPromptHook(void)
|
|||
}
|
||||
FreeLibrary(mui_lib);
|
||||
}
|
||||
static_strcpy(title_str[2], lmprintf(MSG_143));
|
||||
static_strcpy(title_str[2], lmprintf(MSG_149));
|
||||
|
||||
ap_weh = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, NULL,
|
||||
AlertPromptHook, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue