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

[localization] revert back to testing mode

* Also update embedded loc file and fix a WDK warning
This commit is contained in:
Pete Batard 2013-07-21 21:26:50 +01:00
parent 3d3d05a052
commit 116b82bbbb
5 changed files with 17 additions and 10 deletions

View file

@ -1,6 +1,5 @@
l "Chinese (Simplified)" 0x0804, 0x1004, 0x0404, 0x0c04, 0x1404 # This file should be saved as UTF-8 no-BOM
t IDC_START "开始" l "Chinese (Simplified)" 0x0804, 0x1004, 0x0404, 0x0c04, 0x1404
t IDC_STOP "关闭"
t IDS_DEVICE_TXT "设备" t IDS_DEVICE_TXT "设备"
t IDS_PARTITION_TYPE_TXT "分区计划和目标系统类型" t IDS_PARTITION_TYPE_TXT "分区计划和目标系统类型"
t IDS_FILESYSTEM_TXT "文件系统" t IDS_FILESYSTEM_TXT "文件系统"

View file

@ -1,6 +1,7 @@
/* /*
* MSAPI_UTF8: Common API calls using UTF-8 strings * MSAPI_UTF8: Common API calls using UTF-8 strings
* Compensating for what Microsoft should have done a long long time ago. * Compensating for what Microsoft should have done a long long time ago.
* Also see http://utf8everywhere.org/
* *
* Copyright © 2010-2013 Pete Batard <pete@akeo.ie> * Copyright © 2010-2013 Pete Batard <pete@akeo.ie>
* *

View file

@ -60,7 +60,7 @@ static loc_cmd* get_loc_cmd(wchar_t wc, wchar_t* wline) {
} }
lcmd->ctrl_id = -1; lcmd->ctrl_id = -1;
lcmd->command = parse_cmd[j].cmd; lcmd->command = parse_cmd[j].cmd;
lcmd->line_nr = loc_line_nr; lcmd->line_nr = (uint16_t)loc_line_nr;
i = 0; i = 0;
for (k = 0; parse_cmd[j].arg_type[k] != 0; k++) { for (k = 0; parse_cmd[j].arg_type[k] != 0; k++) {

View file

@ -1915,16 +1915,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
#endif #endif
{ {
const char* old_wait_option = "/W"; const char* old_wait_option = "/W";
const char* loc_name = "rufus.loc";
int i, opt, option_index = 0, argc = 0, si = 0; int i, opt, option_index = 0, argc = 0, si = 0;
BOOL attached_console = FALSE; BOOL attached_console = FALSE;
BYTE* loc_data;
DWORD loc_size, Size;
char loc_path[MAX_PATH];
char** argv = NULL; char** argv = NULL;
wchar_t **wenv, **wargv; wchar_t **wenv, **wargv;
PF_DECL(__wgetmainargs); PF_DECL(__wgetmainargs);
HANDLE hFile = NULL, mutex = NULL; HANDLE mutex = NULL;
HWND hDlg = NULL; HWND hDlg = NULL;
MSG msg; MSG msg;
int wait_for_mutex = 0; int wait_for_mutex = 0;
@ -1934,6 +1930,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
{"wait", required_argument, NULL, 'w'}, {"wait", required_argument, NULL, 'w'},
{0, 0, NULL, 0} {0, 0, NULL, 0}
}; };
#ifndef RUFUS_TEST
const char* loc_name = "rufus.loc";
BYTE* loc_data;
char loc_path[MAX_PATH];
DWORD loc_size, Size;
HANDLE hFile = NULL;
#endif
uprintf("*** " APPLICATION_NAME " init ***\n"); uprintf("*** " APPLICATION_NAME " init ***\n");
@ -2026,11 +2029,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// 0x9e disables removable and fixed drive notifications // 0x9e disables removable and fixed drive notifications
SetLGP(FALSE, &existing_key, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", "NoDriveTypeAutorun", 0x9e); SetLGP(FALSE, &existing_key, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", "NoDriveTypeAutorun", 0x9e);
#ifndef RUFUS_TEST
// Extract the embedded localization data into the user's temp dir // Extract the embedded localization data into the user's temp dir
loc_data = (BYTE*)GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_LC_RUFUS_LOC), _RT_RCDATA, loc_name, &loc_size, FALSE); loc_data = (BYTE*)GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_LC_RUFUS_LOC), _RT_RCDATA, loc_name, &loc_size, FALSE);
GetTempPathU(sizeof(loc_path), loc_path); GetTempPathU(sizeof(loc_path), loc_path);
safe_strcat(loc_path, sizeof(loc_name), loc_name); safe_strcat(loc_path, sizeof(loc_name), loc_name);
// Force Chinese localization from embedded rufus.loc file
// TODO: REMOVE ME!
hFile = CreateFileU(loc_path, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, hFile = CreateFileU(loc_path, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, CREATE_ALWAYS, 0, 0); NULL, CREATE_ALWAYS, 0, 0);
if ((hFile == INVALID_HANDLE_VALUE)|| (!WriteFile(hFile, loc_data, loc_size, &Size, 0)) || (loc_size != Size)) { if ((hFile == INVALID_HANDLE_VALUE)|| (!WriteFile(hFile, loc_data, loc_size, &Size, 0)) || (loc_size != Size)) {
@ -2040,6 +2046,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
get_loc_data_file(loc_path); get_loc_data_file(loc_path);
} }
safe_closehandle(hFile); safe_closehandle(hFile);
#endif
// Create the main Window // Create the main Window
hDlg = CreateDialogW(hInstance, MAKEINTRESOURCEW(IDD_DIALOG), NULL, MainCallback); hDlg = CreateDialogW(hInstance, MAKEINTRESOURCEW(IDD_DIALOG), NULL, MainCallback);

View file

@ -29,7 +29,7 @@
/* Program options */ /* Program options */
#define RUFUS_DEBUG // print debug info to Debug facility #define RUFUS_DEBUG // print debug info to Debug facility
/* Features not ready for prime time and that may *DESTROY* your data - USE AT YOUR OWN RISKS! */ /* Features not ready for prime time and that may *DESTROY* your data - USE AT YOUR OWN RISKS! */
// #define RUFUS_TEST #define RUFUS_TEST
#define APPLICATION_NAME "Rufus" #define APPLICATION_NAME "Rufus"
#define COMPANY_NAME "Akeo Consulting" #define COMPANY_NAME "Akeo Consulting"