mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[loc] set log messages to use English locale
* This is done to ensure I can understand logs that are sent to me, even when a non English locale is used. * Closes #188.
This commit is contained in:
		
							parent
							
								
									f3cf32f8d8
								
							
						
					
					
						commit
						18c9df18b5
					
				
					 14 changed files with 225 additions and 120 deletions
				
			
		|  | @ -328,12 +328,12 @@ static void print_status(void) | ||||||
| 	percent = calc_percent((unsigned long) currently_testing, | 	percent = calc_percent((unsigned long) currently_testing, | ||||||
| 					(unsigned long) num_blocks); | 					(unsigned long) num_blocks); | ||||||
| 	percent = (percent/2.0f) + ((cur_op==OP_READ)? 50.0f : 0.0f); | 	percent = (percent/2.0f) + ((cur_op==OP_READ)? 50.0f : 0.0f); | ||||||
| 	PrintStatus(0, FALSE, lmprintf(MSG_235, | 	PrintStatus(0, FALSE, MSG_235, | ||||||
| 				cur_pattern, nr_pattern, | 				cur_pattern, nr_pattern, | ||||||
| 				percent, | 				percent, | ||||||
| 				num_read_errors, | 				num_read_errors, | ||||||
| 				num_write_errors, | 				num_write_errors, | ||||||
| 				num_corruption_errors)); | 				num_corruption_errors); | ||||||
| 	UpdateProgress(OP_BADBLOCKS, (((cur_pattern-1)*100.0f) + percent) / nr_pattern); | 	UpdateProgress(OP_BADBLOCKS, (((cur_pattern-1)*100.0f) + percent) / nr_pattern); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -359,7 +359,7 @@ static void pattern_fill(unsigned char *buffer, unsigned int pattern, | ||||||
| 		for (ptr = buffer; ptr < buffer + n; ptr++) { | 		for (ptr = buffer; ptr < buffer + n; ptr++) { | ||||||
| 			(*ptr) = rand() % (1 << (8 * sizeof(char))); | 			(*ptr) = rand() % (1 << (8 * sizeof(char))); | ||||||
| 		} | 		} | ||||||
| 		PrintStatus(3500, FALSE, lmprintf(MSG_236)); | 		PrintStatus(3500, FALSE, MSG_236); | ||||||
| 	} else { | 	} else { | ||||||
| 		bpattern[0] = 0; | 		bpattern[0] = 0; | ||||||
| 		for (i = 0; i < sizeof(bpattern); i++) { | 		for (i = 0; i < sizeof(bpattern); i++) { | ||||||
|  | @ -376,7 +376,7 @@ static void pattern_fill(unsigned char *buffer, unsigned int pattern, | ||||||
| 			else | 			else | ||||||
| 				i--; | 				i--; | ||||||
| 		} | 		} | ||||||
| 		PrintStatus(3500, FALSE, lmprintf(MSG_237, bpattern[i])); | 		PrintStatus(3500, FALSE, MSG_237, bpattern[i]); | ||||||
| 		cur_pattern++; | 		cur_pattern++; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -691,7 +691,7 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m | ||||||
| 	DWORD size; | 	DWORD size; | ||||||
| 	LONGLONG size_in_sectors; | 	LONGLONG size_in_sectors; | ||||||
| 
 | 
 | ||||||
| 	PrintStatus(0, TRUE, lmprintf(MSG_238, PartitionTypeName[partition_style])); | 	PrintStatus(0, TRUE, MSG_238, PartitionTypeName[partition_style]); | ||||||
| 
 | 
 | ||||||
| 	if ((partition_style == PARTITION_STYLE_GPT) || (!IsChecked(IDC_EXTRA_PARTITION))) { | 	if ((partition_style == PARTITION_STYLE_GPT) || (!IsChecked(IDC_EXTRA_PARTITION))) { | ||||||
| 		// Go with the MS 1 MB wastage at the beginning...
 | 		// Go with the MS 1 MB wastage at the beginning...
 | ||||||
|  | @ -838,7 +838,7 @@ BOOL DeletePartitions(HANDLE hDrive) | ||||||
| 	DWORD size; | 	DWORD size; | ||||||
| 	CREATE_DISK CreateDisk = {PARTITION_STYLE_RAW, {{0}}}; | 	CREATE_DISK CreateDisk = {PARTITION_STYLE_RAW, {{0}}}; | ||||||
| 
 | 
 | ||||||
| 	PrintStatus(0, TRUE, lmprintf(MSG_239)); | 	PrintStatus(0, TRUE, MSG_239); | ||||||
| 
 | 
 | ||||||
| 	size = sizeof(CreateDisk); | 	size = sizeof(CreateDisk); | ||||||
| 	r = DeviceIoControl(hDrive, IOCTL_DISK_CREATE_DISK, | 	r = DeviceIoControl(hDrive, IOCTL_DISK_CREATE_DISK, | ||||||
|  |  | ||||||
							
								
								
									
										44
									
								
								src/format.c
									
										
									
									
									
								
							
							
						
						
									
										44
									
								
								src/format.c
									
										
									
									
									
								
							|  | @ -70,16 +70,16 @@ static BOOLEAN __stdcall FormatExCallback(FILE_SYSTEM_CALLBACK_COMMAND Command, | ||||||
| 	switch(Command) { | 	switch(Command) { | ||||||
| 	case FCC_PROGRESS: | 	case FCC_PROGRESS: | ||||||
| 		percent = (DWORD*)pData; | 		percent = (DWORD*)pData; | ||||||
| 		PrintStatus(0, FALSE, lmprintf(MSG_217, *percent)); | 		PrintStatus(0, FALSE, MSG_217, *percent); | ||||||
| 		UpdateProgress(OP_FORMAT, 1.0f * (*percent)); | 		UpdateProgress(OP_FORMAT, 1.0f * (*percent)); | ||||||
| 		break; | 		break; | ||||||
| 	case FCC_STRUCTURE_PROGRESS:	// No progress on quick format
 | 	case FCC_STRUCTURE_PROGRESS:	// No progress on quick format
 | ||||||
| 		PrintStatus(0, TRUE, lmprintf(MSG_218, ++task_number, nb_steps[fs_index])); | 		PrintStatus(0, TRUE, MSG_218, ++task_number, nb_steps[fs_index]); | ||||||
| 		format_percent += 100.0f / (1.0f * nb_steps[fs_index]); | 		format_percent += 100.0f / (1.0f * nb_steps[fs_index]); | ||||||
| 		UpdateProgress(OP_CREATE_FS, format_percent); | 		UpdateProgress(OP_CREATE_FS, format_percent); | ||||||
| 		break; | 		break; | ||||||
| 	case FCC_DONE: | 	case FCC_DONE: | ||||||
| 		PrintStatus(0, TRUE, lmprintf(MSG_218, nb_steps[fs_index], nb_steps[fs_index])); | 		PrintStatus(0, TRUE, MSG_218, nb_steps[fs_index], nb_steps[fs_index]); | ||||||
| 		UpdateProgress(OP_CREATE_FS, 100.0f); | 		UpdateProgress(OP_CREATE_FS, 100.0f); | ||||||
| 		if(*(BOOLEAN*)pData == FALSE) { | 		if(*(BOOLEAN*)pData == FALSE) { | ||||||
| 			uprintf("Error while formatting.\n"); | 			uprintf("Error while formatting.\n"); | ||||||
|  | @ -154,7 +154,7 @@ static BOOLEAN __stdcall ChkdskCallback(FILE_SYSTEM_CALLBACK_COMMAND Command, DW | ||||||
| 	case FCC_PROGRESS: | 	case FCC_PROGRESS: | ||||||
| 	case FCC_CHECKDISK_PROGRESS: | 	case FCC_CHECKDISK_PROGRESS: | ||||||
| 		percent = (DWORD*)pData; | 		percent = (DWORD*)pData; | ||||||
| 		PrintStatus(0, FALSE, lmprintf(MSG_219, *percent)); | 		PrintStatus(0, FALSE, MSG_219, *percent); | ||||||
| 		break; | 		break; | ||||||
| 	case FCC_DONE: | 	case FCC_DONE: | ||||||
| 		if(*(BOOLEAN*)pData == FALSE) { | 		if(*(BOOLEAN*)pData == FALSE) { | ||||||
|  | @ -369,7 +369,7 @@ static BOOL FormatFAT32(DWORD DriveIndex) | ||||||
| 	// Debug temp vars
 | 	// Debug temp vars
 | ||||||
| 	ULONGLONG FatNeeded, ClusterCount; | 	ULONGLONG FatNeeded, ClusterCount; | ||||||
| 
 | 
 | ||||||
| 	PrintStatus(0, TRUE, lmprintf(MSG_222, "Large FAT32")); | 	PrintStatus(0, TRUE, MSG_222, "Large FAT32"); | ||||||
| 	VolumeId = GetVolumeID(); | 	VolumeId = GetVolumeID(); | ||||||
| 
 | 
 | ||||||
| 	// Open the drive and lock it
 | 	// Open the drive and lock it
 | ||||||
|  | @ -564,7 +564,7 @@ static BOOL FormatFAT32(DWORD DriveIndex) | ||||||
| 		if (GetTickCount() > LastRefresh + 25) { | 		if (GetTickCount() > LastRefresh + 25) { | ||||||
| 			LastRefresh = GetTickCount(); | 			LastRefresh = GetTickCount(); | ||||||
| 			format_percent = (100.0f*i)/(1.0f*(SystemAreaSize+BurstSize)); | 			format_percent = (100.0f*i)/(1.0f*(SystemAreaSize+BurstSize)); | ||||||
| 			PrintStatus(0, FALSE, lmprintf(MSG_217, format_percent)); | 			PrintStatus(0, FALSE, MSG_217, format_percent); | ||||||
| 			UpdateProgress(OP_FORMAT, format_percent); | 			UpdateProgress(OP_FORMAT, format_percent); | ||||||
| 		} | 		} | ||||||
| 		if (IS_ERROR(FormatStatus)) goto out;	// For cancellation
 | 		if (IS_ERROR(FormatStatus)) goto out;	// For cancellation
 | ||||||
|  | @ -589,7 +589,7 @@ static BOOL FormatFAT32(DWORD DriveIndex) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Must do it here, as have issues when trying to write the PBR after a remount
 | 	// Must do it here, as have issues when trying to write the PBR after a remount
 | ||||||
| 	PrintStatus(0, TRUE, lmprintf(MSG_229)); | 	PrintStatus(0, TRUE, MSG_229); | ||||||
| 	if (!WritePBR(hLogicalVolume)) { | 	if (!WritePBR(hLogicalVolume)) { | ||||||
| 		// Non fatal error, but the drive probably won't boot
 | 		// Non fatal error, but the drive probably won't boot
 | ||||||
| 		uprintf("Could not write partition boot record - drive may not boot...\n"); | 		uprintf("Could not write partition boot record - drive may not boot...\n"); | ||||||
|  | @ -598,7 +598,7 @@ static BOOL FormatFAT32(DWORD DriveIndex) | ||||||
| 	// Set the FAT32 volume label
 | 	// Set the FAT32 volume label
 | ||||||
| 	GetWindowTextW(hLabel, wLabel, ARRAYSIZE(wLabel)); | 	GetWindowTextW(hLabel, wLabel, ARRAYSIZE(wLabel)); | ||||||
| 	ToValidLabel(wLabel, TRUE); | 	ToValidLabel(wLabel, TRUE); | ||||||
| 	PrintStatus(0, TRUE, lmprintf(MSG_221)); | 	PrintStatus(0, TRUE, MSG_221); | ||||||
| 	// Handle must be closed for SetVolumeLabel to work
 | 	// Handle must be closed for SetVolumeLabel to work
 | ||||||
| 	safe_closehandle(hLogicalVolume); | 	safe_closehandle(hLogicalVolume); | ||||||
| 	VolumeName = GetLogicalName(DriveIndex, TRUE, TRUE); | 	VolumeName = GetLogicalName(DriveIndex, TRUE, TRUE); | ||||||
|  | @ -641,9 +641,9 @@ static BOOL FormatDrive(DWORD DriveIndex) | ||||||
| 	GetWindowTextU(hFileSystem, FSType, ARRAYSIZE(FSType)); | 	GetWindowTextU(hFileSystem, FSType, ARRAYSIZE(FSType)); | ||||||
| 	fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | 	fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | ||||||
| 	if ((fs == FS_UDF) && !((dur_mins == 0) && (dur_secs == 0))) { | 	if ((fs == FS_UDF) && !((dur_mins == 0) && (dur_secs == 0))) { | ||||||
| 		PrintStatus(0, TRUE, lmprintf(MSG_220, FSType, dur_mins, dur_secs)); | 		PrintStatus(0, TRUE, MSG_220, FSType, dur_mins, dur_secs); | ||||||
| 	} else { | 	} else { | ||||||
| 		PrintStatus(0, TRUE, lmprintf(MSG_222, FSType)); | 		PrintStatus(0, TRUE, MSG_222, FSType); | ||||||
| 	} | 	} | ||||||
| 	VolumeName = GetLogicalName(DriveIndex, FALSE, TRUE); | 	VolumeName = GetLogicalName(DriveIndex, FALSE, TRUE); | ||||||
| 	wVolumeName = utf8_to_wchar(VolumeName); | 	wVolumeName = utf8_to_wchar(VolumeName); | ||||||
|  | @ -706,7 +706,7 @@ static BOOL CheckDisk(char DriveLetter) | ||||||
| 	size_t i; | 	size_t i; | ||||||
| 
 | 
 | ||||||
| 	wDriveRoot[0] = (WCHAR)DriveLetter; | 	wDriveRoot[0] = (WCHAR)DriveLetter; | ||||||
| 	PrintStatus(0, TRUE, lmprintf(MSG_223)); | 	PrintStatus(0, TRUE, MSG_223); | ||||||
| 
 | 
 | ||||||
| 	PF_INIT_OR_OUT(Chkdsk, fmifs); | 	PF_INIT_OR_OUT(Chkdsk, fmifs); | ||||||
| 
 | 
 | ||||||
|  | @ -799,7 +799,7 @@ static BOOL ClearMBRGPT(HANDLE hPhysicalDrive, LONGLONG DiskSize, DWORD SectorSi | ||||||
| 	uint64_t i, last_sector = DiskSize/SectorSize; | 	uint64_t i, last_sector = DiskSize/SectorSize; | ||||||
| 	unsigned char* pBuf = (unsigned char*) calloc(SectorSize, 1); | 	unsigned char* pBuf = (unsigned char*) calloc(SectorSize, 1); | ||||||
| 
 | 
 | ||||||
| 	PrintStatus(0, TRUE, lmprintf(MSG_224)); | 	PrintStatus(0, TRUE, MSG_224); | ||||||
| 	if (pBuf == NULL) { | 	if (pBuf == NULL) { | ||||||
| 		FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_NOT_ENOUGH_MEMORY; | 		FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_NOT_ENOUGH_MEMORY; | ||||||
| 		goto out; | 		goto out; | ||||||
|  | @ -1199,7 +1199,7 @@ DWORD WINAPI FormatThread(LPVOID param) | ||||||
| 	bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | 	bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); | ||||||
| 	use_large_fat32 = (fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32)); | 	use_large_fat32 = (fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32)); | ||||||
| 
 | 
 | ||||||
| 	PrintStatus(0, TRUE, lmprintf(MSG_225)); | 	PrintStatus(0, TRUE, MSG_225); | ||||||
| 	hPhysicalDrive = GetPhysicalHandle(DriveIndex, TRUE, TRUE); | 	hPhysicalDrive = GetPhysicalHandle(DriveIndex, TRUE, TRUE); | ||||||
| 	if (hPhysicalDrive == INVALID_HANDLE_VALUE) { | 	if (hPhysicalDrive == INVALID_HANDLE_VALUE) { | ||||||
| 		FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_OPEN_FAILED; | 		FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_OPEN_FAILED; | ||||||
|  | @ -1240,7 +1240,7 @@ DWORD WINAPI FormatThread(LPVOID param) | ||||||
| 	} | 	} | ||||||
| 	CHECK_FOR_USER_CANCEL; | 	CHECK_FOR_USER_CANCEL; | ||||||
| 
 | 
 | ||||||
| 	PrintStatus(0, TRUE, lmprintf(MSG_226)); | 	PrintStatus(0, TRUE, MSG_226); | ||||||
| 	AnalyzeMBR(hPhysicalDrive); | 	AnalyzeMBR(hPhysicalDrive); | ||||||
| 	if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { | 	if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { | ||||||
| 		AnalyzePBR(hLogicalVolume); | 		AnalyzePBR(hLogicalVolume); | ||||||
|  | @ -1312,7 +1312,7 @@ DWORD WINAPI FormatThread(LPVOID param) | ||||||
| 	} | 	} | ||||||
| 	// Close the (unmounted) volume before formatting
 | 	// Close the (unmounted) volume before formatting
 | ||||||
| 	if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { | 	if ((hLogicalVolume != NULL) && (hLogicalVolume != INVALID_HANDLE_VALUE)) { | ||||||
| 		PrintStatus(0, TRUE, lmprintf(MSG_227)); | 		PrintStatus(0, TRUE, MSG_227); | ||||||
| 		if (!CloseHandle(hLogicalVolume)) { | 		if (!CloseHandle(hLogicalVolume)) { | ||||||
| 			uprintf("Could not close volume: %s\n", WindowsErrorString()); | 			uprintf("Could not close volume: %s\n", WindowsErrorString()); | ||||||
| 			FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_ACCESS_DENIED; | 			FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_ACCESS_DENIED; | ||||||
|  | @ -1352,13 +1352,13 @@ DWORD WINAPI FormatThread(LPVOID param) | ||||||
| 	ret = use_large_fat32?FormatFAT32(DriveIndex):FormatDrive(DriveIndex); | 	ret = use_large_fat32?FormatFAT32(DriveIndex):FormatDrive(DriveIndex); | ||||||
| 	if (!ret) { | 	if (!ret) { | ||||||
| 		// Error will be set by FormatDrive() in FormatStatus
 | 		// Error will be set by FormatDrive() in FormatStatus
 | ||||||
| 		uprintf("Format error: %s\n", StrError(FormatStatus)); | 		uprintf("Format error: %s\n", StrError(FormatStatus, TRUE)); | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Thanks to Microsoft, we must fix the MBR AFTER the drive has been formatted
 | 	// Thanks to Microsoft, we must fix the MBR AFTER the drive has been formatted
 | ||||||
| 	if (pt == PARTITION_STYLE_MBR) { | 	if (pt == PARTITION_STYLE_MBR) { | ||||||
| 		PrintStatus(0, TRUE, lmprintf(MSG_228)); | 		PrintStatus(0, TRUE, MSG_228); | ||||||
| 		if (!WriteMBR(hPhysicalDrive)) { | 		if (!WriteMBR(hPhysicalDrive)) { | ||||||
| 			if (!IS_ERROR(FormatStatus)) | 			if (!IS_ERROR(FormatStatus)) | ||||||
| 				FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; | 				FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; | ||||||
|  | @ -1405,7 +1405,7 @@ DWORD WINAPI FormatThread(LPVOID param) | ||||||
| 			} | 			} | ||||||
| 			// NB: if you unmount the logical volume here, XP will report error:
 | 			// NB: if you unmount the logical volume here, XP will report error:
 | ||||||
| 			// [0x00000456] The media in the drive may have changed
 | 			// [0x00000456] The media in the drive may have changed
 | ||||||
| 			PrintStatus(0, TRUE, lmprintf(MSG_229)); | 			PrintStatus(0, TRUE, MSG_229); | ||||||
| 			if (!WritePBR(hLogicalVolume)) { | 			if (!WritePBR(hLogicalVolume)) { | ||||||
| 				if (!IS_ERROR(FormatStatus)) | 				if (!IS_ERROR(FormatStatus)) | ||||||
| 					FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; | 					FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT; | ||||||
|  | @ -1434,7 +1434,7 @@ DWORD WINAPI FormatThread(LPVOID param) | ||||||
| 	if (IsChecked(IDC_BOOT)) { | 	if (IsChecked(IDC_BOOT)) { | ||||||
| 		if ((dt == DT_WINME) || (dt == DT_FREEDOS)) { | 		if ((dt == DT_WINME) || (dt == DT_FREEDOS)) { | ||||||
| 			UpdateProgress(OP_DOS, -1.0f); | 			UpdateProgress(OP_DOS, -1.0f); | ||||||
| 			PrintStatus(0, TRUE, lmprintf(MSG_230)); | 			PrintStatus(0, TRUE, MSG_230); | ||||||
| 			if (!ExtractDOS(drive_name)) { | 			if (!ExtractDOS(drive_name)) { | ||||||
| 				if (!IS_ERROR(FormatStatus)) | 				if (!IS_ERROR(FormatStatus)) | ||||||
| 					FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANNOT_COPY; | 					FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANNOT_COPY; | ||||||
|  | @ -1443,7 +1443,7 @@ DWORD WINAPI FormatThread(LPVOID param) | ||||||
| 		} else if (dt == DT_ISO) { | 		} else if (dt == DT_ISO) { | ||||||
| 			if (iso_path != NULL) { | 			if (iso_path != NULL) { | ||||||
| 				UpdateProgress(OP_DOS, 0.0f); | 				UpdateProgress(OP_DOS, 0.0f); | ||||||
| 				PrintStatus(0, TRUE, lmprintf(MSG_231)); | 				PrintStatus(0, TRUE, MSG_231); | ||||||
| 				drive_name[2] = 0; | 				drive_name[2] = 0; | ||||||
| 				if (!ExtractISO(iso_path, drive_name, FALSE)) { | 				if (!ExtractISO(iso_path, drive_name, FALSE)) { | ||||||
| 					if (!IS_ERROR(FormatStatus)) | 					if (!IS_ERROR(FormatStatus)) | ||||||
|  | @ -1452,7 +1452,7 @@ DWORD WINAPI FormatThread(LPVOID param) | ||||||
| 				} | 				} | ||||||
| 				if ((bt == BT_UEFI) && (!iso_report.has_efi) && (iso_report.has_win7_efi)) { | 				if ((bt == BT_UEFI) && (!iso_report.has_efi) && (iso_report.has_win7_efi)) { | ||||||
| 					// TODO: Check ISO with EFI only
 | 					// TODO: Check ISO with EFI only
 | ||||||
| 					PrintStatus(0, TRUE, lmprintf(MSG_232)); | 					PrintStatus(0, TRUE, MSG_232); | ||||||
| 					wim_image[0] = drive_name[0]; | 					wim_image[0] = drive_name[0]; | ||||||
| 					efi_dst[0] = drive_name[0]; | 					efi_dst[0] = drive_name[0]; | ||||||
| 					efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = 0; | 					efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = 0; | ||||||
|  | @ -1475,7 +1475,7 @@ DWORD WINAPI FormatThread(LPVOID param) | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		UpdateProgress(OP_FINALIZE, -1.0f); | 		UpdateProgress(OP_FINALIZE, -1.0f); | ||||||
| 		PrintStatus(0, TRUE, lmprintf(MSG_233)); | 		PrintStatus(0, TRUE, MSG_233); | ||||||
| 		if (IsChecked(IDC_SET_ICON)) | 		if (IsChecked(IDC_SET_ICON)) | ||||||
| 			SetAutorun(drive_name); | 			SetAutorun(drive_name); | ||||||
| 		// Issue another complete remount before we exit, to ensure we're clean
 | 		// Issue another complete remount before we exit, to ensure we're clean
 | ||||||
|  |  | ||||||
|  | @ -72,13 +72,17 @@ struct list_head locale_list = {NULL, NULL}; | ||||||
| char   *loc_filename = NULL, *embedded_loc_filename = "embedded.loc"; | char   *loc_filename = NULL, *embedded_loc_filename = "embedded.loc"; | ||||||
| 
 | 
 | ||||||
| /* Message table */ | /* Message table */ | ||||||
| char* msg_table[MSG_MAX-MSG_000] = {0}; | char* default_msg_table[MSG_MAX-MSG_000] = {0}; | ||||||
|  | char* current_msg_table[MSG_MAX-MSG_000] = {0}; | ||||||
|  | char** msg_table = NULL; | ||||||
| 
 | 
 | ||||||
| static void mtab_destroy(void) | static void mtab_destroy(BOOL reinit) | ||||||
| { | { | ||||||
| 	size_t j; | 	size_t j; | ||||||
| 	for (j=0; j<MSG_MAX-MSG_000; j++) { | 	for (j=0; j<MSG_MAX-MSG_000; j++) { | ||||||
| 		safe_free(msg_table[j]); | 		safe_free(current_msg_table[j]); | ||||||
|  | 		if (!reinit) | ||||||
|  | 			safe_free(default_msg_table[j]); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -345,10 +349,8 @@ void _init_localization(BOOL reinit) { | ||||||
| 	size_t i; | 	size_t i; | ||||||
| 	for (i=0; i<ARRAYSIZE(loc_dlg); i++) | 	for (i=0; i<ARRAYSIZE(loc_dlg); i++) | ||||||
| 		list_init(&loc_dlg[i].list); | 		list_init(&loc_dlg[i].list); | ||||||
| 	if (!reinit) { | 	if (!reinit) | ||||||
| 		list_init(&locale_list); | 		list_init(&locale_list); | ||||||
| 		mtab_destroy(); |  | ||||||
| 	} |  | ||||||
| 	htab_create(LOC_HTAB_SIZE); | 	htab_create(LOC_HTAB_SIZE); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -359,7 +361,7 @@ void _exit_localization(BOOL reinit) { | ||||||
| 			safe_free(loc_filename); | 			safe_free(loc_filename); | ||||||
| 	} | 	} | ||||||
| 	free_dialog_list(); | 	free_dialog_list(); | ||||||
| 	mtab_destroy(); | 	mtab_destroy(reinit); | ||||||
| 	htab_destroy(); | 	htab_destroy(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -380,7 +382,7 @@ BOOL dispatch_loc_cmd(loc_cmd* lcmd) | ||||||
| 		// Any command up to LC_TEXT takes a control ID in text[0]
 | 		// Any command up to LC_TEXT takes a control ID in text[0]
 | ||||||
| 		if (safe_strncmp(lcmd->txt[0], msg_prefix, 4) == 0) { | 		if (safe_strncmp(lcmd->txt[0], msg_prefix, 4) == 0) { | ||||||
| 			if (lcmd->command != LC_TEXT) { | 			if (lcmd->command != LC_TEXT) { | ||||||
| 				luprint("only the 't' command can be applied to a message (MSG_###)\n"); | 				luprint("only the [t]ext command can be applied to a message (MSG_###)\n"); | ||||||
| 				goto err; | 				goto err; | ||||||
| 			} | 			} | ||||||
| 			// Try to convert the numeric part of a MSG_#### to a numeric
 | 			// Try to convert the numeric part of a MSG_#### to a numeric
 | ||||||
|  | @ -406,6 +408,12 @@ BOOL dispatch_loc_cmd(loc_cmd* lcmd) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	// Don't process UI commands when we're dealing with the default
 | ||||||
|  | 	if (msg_table == default_msg_table) { | ||||||
|  | 		free_loc_cmd(lcmd); | ||||||
|  | 		return TRUE; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	switch(lcmd->command) { | 	switch(lcmd->command) { | ||||||
| 	// NB: For commands that take an ID, ctrl_id is always a valid index at this stage
 | 	// NB: For commands that take an ID, ctrl_id is always a valid index at this stage
 | ||||||
| 	case LC_TEXT: | 	case LC_TEXT: | ||||||
|  | @ -425,7 +433,7 @@ BOOL dispatch_loc_cmd(loc_cmd* lcmd) | ||||||
| 		base_locale = get_locale_from_name(lcmd->txt[0], FALSE); | 		base_locale = get_locale_from_name(lcmd->txt[0], FALSE); | ||||||
| 		if (base_locale != NULL) { | 		if (base_locale != NULL) { | ||||||
| 			uprintf("localization: using locale base '%s'\n", lcmd->txt[0]); | 			uprintf("localization: using locale base '%s'\n", lcmd->txt[0]); | ||||||
| 			get_loc_data_file(NULL, (long)base_locale->num[0], (long)base_locale->num[1], base_locale->line_nr); | 			get_loc_data_file(NULL, base_locale); | ||||||
| 		} else { | 		} else { | ||||||
| 			luprintf("locale base '%s' not found - ignoring", lcmd->txt[0]); | 			luprintf("locale base '%s' not found - ignoring", lcmd->txt[0]); | ||||||
| 		} | 		} | ||||||
|  | @ -558,6 +566,70 @@ char* lmprintf(int msg_id, ...) | ||||||
| 	return buf[buf_id++]; | 	return buf[buf_id++]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /*
 | ||||||
|  |  * Display a localized message on the status bar as well as its English counterpart in the | ||||||
|  |  * log (if debug is set). If duration is non zero, ensures that message is displayed for at | ||||||
|  |  * least duration ms, regardless of any other incoming message | ||||||
|  |  */ | ||||||
|  | static BOOL bStatusTimerArmed = FALSE; | ||||||
|  | char szStatusMessage[256] = { 0 }; | ||||||
|  | static void CALLBACK PrintStatusTimeout(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) | ||||||
|  | { | ||||||
|  | 	bStatusTimerArmed = FALSE; | ||||||
|  | 	// potentially display lower priority message that was overridden
 | ||||||
|  | 	SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); | ||||||
|  | 	KillTimer(hMainDialog, TID_MESSAGE); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void PrintStatus(unsigned int duration, BOOL debug, int msg_id, ...) | ||||||
|  | { | ||||||
|  | 	char *format = NULL, buf[sizeof(szStatusMessage)]; | ||||||
|  | 	va_list args; | ||||||
|  | 
 | ||||||
|  | 	if (msg_id < 0) { | ||||||
|  | 		//A negative msg_id clears the status
 | ||||||
|  | 		SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, ""); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if ((msg_id <= MSG_000) || (msg_id >= MSG_MAX)) { | ||||||
|  | 		uprintf("PrintStatus: invalid MSG_ID\n"); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	format = msg_table[msg_id - MSG_000]; | ||||||
|  | 	if (format == NULL) { | ||||||
|  | 		safe_sprintf(szStatusMessage, sizeof(szStatusMessage), "MSG_%03d UNTRANSLATED", msg_id - MSG_000); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	va_start(args, msg_id); | ||||||
|  | 	safe_vsnprintf(szStatusMessage, sizeof(szStatusMessage), format, args); | ||||||
|  | 	va_end(args); | ||||||
|  | 	szStatusMessage[sizeof(szStatusMessage)-1] = '\0'; | ||||||
|  | 
 | ||||||
|  | 	if ((duration) || (!bStatusTimerArmed)) { | ||||||
|  | 		SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if (duration) { | ||||||
|  | 		SetTimer(hMainDialog, TID_MESSAGE, duration, PrintStatusTimeout); | ||||||
|  | 		bStatusTimerArmed = TRUE; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if (debug) { | ||||||
|  | 		format = default_msg_table[msg_id - MSG_000]; | ||||||
|  | 		if (format == NULL) { | ||||||
|  | 			safe_sprintf(buf, sizeof(szStatusMessage), "(default) MSG_%03d UNTRANSLATED", msg_id - MSG_000); | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
|  | 		va_start(args, msg_id); | ||||||
|  | 		safe_vsnprintf(buf, sizeof(szStatusMessage)-1, format, args); | ||||||
|  | 		va_end(args); | ||||||
|  | 		uprintf(buf); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  * These 2 functions are used to set the current locale |  * These 2 functions are used to set the current locale | ||||||
|  * If fallback is true, the call will fall back to use the first |  * If fallback is true, the call will fall back to use the first | ||||||
|  | @ -611,3 +683,20 @@ loc_cmd* get_locale_from_name(char* locale_name, BOOL fallback) | ||||||
| 	uprintf("localization: could not find locale for name '%s'. Will default to '%s'\n", locale_name, lcmd->txt[0]); | 	uprintf("localization: could not find locale for name '%s'. Will default to '%s'\n", locale_name, lcmd->txt[0]); | ||||||
| 	return lcmd; | 	return lcmd; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | /* 
 | ||||||
|  |  * This call is used to toggle the issuing of messages with the default locale | ||||||
|  |  * (usually en-US) instead of the current (usually non en) one. | ||||||
|  |  */ | ||||||
|  | void toggle_default_locale(void) | ||||||
|  | { | ||||||
|  | 	static char** old_msg_table = NULL; | ||||||
|  | 
 | ||||||
|  | 	if (old_msg_table == NULL) { | ||||||
|  | 		old_msg_table = msg_table; | ||||||
|  | 		msg_table = default_msg_table; | ||||||
|  | 	} else { | ||||||
|  | 		msg_table = old_msg_table; | ||||||
|  | 		old_msg_table = NULL; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -146,8 +146,10 @@ typedef struct loc_dlg_list_struct { | ||||||
| 
 | 
 | ||||||
| extern const loc_parse parse_cmd[9]; | extern const loc_parse parse_cmd[9]; | ||||||
| extern struct list_head locale_list; | extern struct list_head locale_list; | ||||||
|  | extern char *default_msg_table[], *current_msg_table[], **msg_table; | ||||||
| int loc_line_nr; | int loc_line_nr; | ||||||
| char *loc_filename, *embedded_loc_filename; | char *loc_filename, *embedded_loc_filename; | ||||||
|  | BOOL en_msg_mode; | ||||||
| 
 | 
 | ||||||
| void free_loc_cmd(loc_cmd* lcmd); | void free_loc_cmd(loc_cmd* lcmd); | ||||||
| BOOL dispatch_loc_cmd(loc_cmd* lcmd); | BOOL dispatch_loc_cmd(loc_cmd* lcmd); | ||||||
|  | @ -161,7 +163,8 @@ void reset_localization(int dlg_id); | ||||||
| void free_dialog_list(void); | void free_dialog_list(void); | ||||||
| char* lmprintf(int msg_id, ...); | char* lmprintf(int msg_id, ...); | ||||||
| BOOL get_supported_locales(const char* filename); | BOOL get_supported_locales(const char* filename); | ||||||
| char* get_loc_data_file(const char* filename, long offset, long end_offset, int start_line); | BOOL get_loc_data_file(const char* filename, loc_cmd* lcmd); | ||||||
| void free_locale_list(void); | void free_locale_list(void); | ||||||
| loc_cmd* get_locale_from_lcid(int lcid, BOOL fallback); | loc_cmd* get_locale_from_lcid(int lcid, BOOL fallback); | ||||||
| loc_cmd* get_locale_from_name(char* locale_name, BOOL fallback); | loc_cmd* get_locale_from_name(char* locale_name, BOOL fallback); | ||||||
|  | void toggle_default_locale(void); | ||||||
|  |  | ||||||
							
								
								
									
										16
									
								
								src/net.c
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								src/net.c
									
										
									
									
									
								
							|  | @ -264,7 +264,7 @@ BOOL DownloadFile(const char* url, const char* file, HWND hProgressDialog) | ||||||
| 		SendMessage(hProgressDialog, UM_ISO_INIT, 0, 0); | 		SendMessage(hProgressDialog, UM_ISO_INIT, 0, 0); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	PrintStatus(0, FALSE, lmprintf(MSG_240, file)); | 	PrintStatus(0, FALSE, MSG_240, file); | ||||||
| 	uprintf("Downloading %s from %s\n", file, url); | 	uprintf("Downloading %s from %s\n", file, url); | ||||||
| 
 | 
 | ||||||
| 	if (!InternetCrackUrlA(url, (DWORD)safe_strlen(url), 0, &UrlParts)) { | 	if (!InternetCrackUrlA(url, (DWORD)safe_strlen(url), 0, &UrlParts)) { | ||||||
|  | @ -341,7 +341,7 @@ BOOL DownloadFile(const char* url, const char* file, HWND hProgressDialog) | ||||||
| 			break; | 			break; | ||||||
| 		dwSize += dwDownloaded; | 		dwSize += dwDownloaded; | ||||||
| 		SendMessage(hProgressBar, PBM_SETPOS, (WPARAM)(MAX_PROGRESS*((1.0f*dwSize)/(1.0f*dwTotalSize))), 0); | 		SendMessage(hProgressBar, PBM_SETPOS, (WPARAM)(MAX_PROGRESS*((1.0f*dwSize)/(1.0f*dwTotalSize))), 0); | ||||||
| 		PrintStatus(0, FALSE, lmprintf(MSG_241, (100.0f*dwSize)/(1.0f*dwTotalSize))); | 		PrintStatus(0, FALSE, MSG_241, (100.0f*dwSize)/(1.0f*dwTotalSize)); | ||||||
| 		if (fwrite(buf, 1, dwDownloaded, fd) != dwDownloaded) { | 		if (fwrite(buf, 1, dwDownloaded, fd) != dwDownloaded) { | ||||||
| 			uprintf("Error writing file '%s': %s\n", file, WinInetErrorString()); | 			uprintf("Error writing file '%s': %s\n", file, WinInetErrorString()); | ||||||
| 			goto out; | 			goto out; | ||||||
|  | @ -363,9 +363,9 @@ out: | ||||||
| 	if (fd != NULL) fclose(fd); | 	if (fd != NULL) fclose(fd); | ||||||
| 	if (!r) { | 	if (!r) { | ||||||
| 		_unlink(file); | 		_unlink(file); | ||||||
| 		PrintStatus(0, FALSE, lmprintf(MSG_242)); | 		PrintStatus(0, FALSE, MSG_242); | ||||||
| 		SetLastError(error_code); | 		SetLastError(error_code); | ||||||
| 		MessageBoxU(hMainDialog, IS_ERROR(FormatStatus)?StrError(FormatStatus):WinInetErrorString(), | 		MessageBoxU(hMainDialog, IS_ERROR(FormatStatus)?StrError(FormatStatus, FALSE):WinInetErrorString(), | ||||||
| 		lmprintf(MSG_044), MB_OK|MB_ICONERROR); | 		lmprintf(MSG_044), MB_OK|MB_ICONERROR); | ||||||
| 	} | 	} | ||||||
| 	if (hRequest) InternetCloseHandle(hRequest); | 	if (hRequest) InternetCloseHandle(hRequest); | ||||||
|  | @ -456,7 +456,7 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	PrintStatus(3000, TRUE, lmprintf(MSG_243)); | 	PrintStatus(3000, TRUE, MSG_243); | ||||||
| 	status++;	// 1
 | 	status++;	// 1
 | ||||||
| 
 | 
 | ||||||
| 	if (!GetVersionExA(&os_version)) { | 	if (!GetVersionExA(&os_version)) { | ||||||
|  | @ -588,14 +588,14 @@ out: | ||||||
| 	if (hSession) InternetCloseHandle(hSession); | 	if (hSession) InternetCloseHandle(hSession); | ||||||
| 	switch(status) { | 	switch(status) { | ||||||
| 	case 1: | 	case 1: | ||||||
| 		PrintStatus(3000, TRUE, lmprintf(MSG_244)); | 		PrintStatus(3000, TRUE, MSG_244); | ||||||
| 		break; | 		break; | ||||||
| 	case 2: | 	case 2: | ||||||
| 		PrintStatus(3000, TRUE, lmprintf(MSG_245)); | 		PrintStatus(3000, TRUE, MSG_245); | ||||||
| 		break; | 		break; | ||||||
| 	case 3: | 	case 3: | ||||||
| 	case 4: | 	case 4: | ||||||
| 		PrintStatus(3000, FALSE, lmprintf(found_new_version?MSG_246:MSG_247)); | 		PrintStatus(3000, FALSE, found_new_version?MSG_246:MSG_247); | ||||||
| 	default: | 	default: | ||||||
| 		break; | 		break; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
							
								
								
									
										54
									
								
								src/parser.c
									
										
									
									
									
								
							
							
						
						
									
										54
									
								
								src/parser.c
									
										
									
									
									
								
							|  | @ -353,31 +353,60 @@ out: | ||||||
|  * Parse a locale section in a localization file (UTF-8, no BOM) |  * Parse a locale section in a localization file (UTF-8, no BOM) | ||||||
|  * NB: this call is reentrant for the "base" command support |  * NB: this call is reentrant for the "base" command support | ||||||
|  */ |  */ | ||||||
| char* get_loc_data_file(const char* filename, long offset, long end_offset, int start_line) | BOOL get_loc_data_file(const char* filename, loc_cmd* lcmd) | ||||||
| { | { | ||||||
| 	size_t bufsize = 1024; | 	size_t bufsize = 1024; | ||||||
| 	static FILE* fd = NULL; | 	static FILE* fd = NULL; | ||||||
| 	char *ret = NULL, *buf = NULL; | 	char *buf = NULL; | ||||||
| 	size_t i = 0; | 	size_t i = 0; | ||||||
| 	int r = 0, line_nr_incr = 1; | 	int r = 0, line_nr_incr = 1; | ||||||
| 	int c = 0, eol_char = 0; | 	int c = 0, eol_char = 0; | ||||||
| 	int old_loc_line_nr; | 	int start_line, old_loc_line_nr; | ||||||
| 	BOOL eol = FALSE, escape_sequence = FALSE, reentrant = (fd != NULL); | 	BOOL ret = FALSE, eol = FALSE, escape_sequence = FALSE, reentrant = (fd != NULL); | ||||||
| 	long cur_offset = -1; | 	long offset, cur_offset = -1, end_offset; | ||||||
|  | 	// The default locale is always the first one
 | ||||||
|  | 	loc_cmd* default_locale = list_entry(locale_list.next, loc_cmd, list); | ||||||
| 
 | 
 | ||||||
| 	if (reentrant) { | 	// We keep a default message table populated with the en-US messages.
 | ||||||
| 		// Called, from a 'b' command - no need to reopen the file,
 | 	// Ensure that it got properly initialized first.
 | ||||||
| 		// just save the current offset and current line number
 | 	if ((msg_table == NULL) && (lcmd != NULL)) { | ||||||
| 		cur_offset = ftell(fd); | 		uprintf("localization: default message table has not been populated!"); | ||||||
| 		old_loc_line_nr = loc_line_nr; | 		return FALSE; | ||||||
| 	} else { | 	} else if ((msg_table != NULL) && (lcmd == NULL)) { | ||||||
|  | 		uprintf("localization: default message table has already been populated!"); | ||||||
|  | 		return FALSE; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if (!reentrant) { | ||||||
| 		if ((filename == NULL) || (filename[0] == 0)) | 		if ((filename == NULL) || (filename[0] == 0)) | ||||||
| 			return NULL; | 			return FALSE; | ||||||
|  | 		if (lcmd == default_locale) { | ||||||
|  | 			// The default locale has already been populated => nothing to do
 | ||||||
|  | 			msg_table = default_msg_table; | ||||||
|  | 			return TRUE; | ||||||
|  | 		} | ||||||
|  | 		if (lcmd == NULL) { | ||||||
|  | 			// Fill the default table
 | ||||||
|  | 			lcmd = default_locale; | ||||||
|  | 			msg_table = default_msg_table; | ||||||
|  | 		} else { | ||||||
|  | 			// Fill the current table
 | ||||||
|  | 			msg_table = current_msg_table; | ||||||
|  | 		} | ||||||
| 		free_dialog_list(); | 		free_dialog_list(); | ||||||
| 		fd = open_loc_file(filename); | 		fd = open_loc_file(filename); | ||||||
| 		if (fd == NULL) | 		if (fd == NULL) | ||||||
| 			goto out; | 			goto out; | ||||||
|  | 	} else { | ||||||
|  | 		// Called, from a 'b' command - no need to reopen the file,
 | ||||||
|  | 		// just save the current offset and current line number
 | ||||||
|  | 		cur_offset = ftell(fd); | ||||||
|  | 		old_loc_line_nr = loc_line_nr; | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	offset = (long)lcmd->num[0]; | ||||||
|  | 	end_offset = (long)lcmd->num[1]; | ||||||
|  | 	start_line = lcmd->line_nr; | ||||||
| 	loc_line_nr = start_line; | 	loc_line_nr = start_line; | ||||||
| 	buf = (char*) malloc(bufsize); | 	buf = (char*) malloc(bufsize); | ||||||
| 	if (buf == NULL) { | 	if (buf == NULL) { | ||||||
|  | @ -489,6 +518,7 @@ char* get_loc_data_file(const char* filename, long offset, long end_offset, int | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} while(1); | 	} while(1); | ||||||
|  | 	ret = TRUE; | ||||||
| 
 | 
 | ||||||
| out: | out: | ||||||
| 	// Don't close on a reentrant call
 | 	// Don't close on a reentrant call
 | ||||||
|  |  | ||||||
							
								
								
									
										40
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										40
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -144,6 +144,7 @@ static float slot_end[OP_MAX+1];	// shifted +1 so that we can substract 1 to OP | ||||||
| static float previous_end; | static float previous_end; | ||||||
| 
 | 
 | ||||||
| // TODO: Remember to update copyright year in both license.h and the RC when the year changes!
 | // TODO: Remember to update copyright year in both license.h and the RC when the year changes!
 | ||||||
|  | // Also localization_data.sh
 | ||||||
| 
 | 
 | ||||||
| #define KB          1024LL | #define KB          1024LL | ||||||
| #define MB       1048576LL | #define MB       1048576LL | ||||||
|  | @ -1074,7 +1075,7 @@ BOOL CALLBACK ISOProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||||
| 		switch (LOWORD(wParam)) { | 		switch (LOWORD(wParam)) { | ||||||
| 		case IDC_ISO_ABORT: | 		case IDC_ISO_ABORT: | ||||||
| 			FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED; | 			FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED; | ||||||
| 			PrintStatus(0, FALSE, lmprintf(MSG_201)); | 			PrintStatus(0, FALSE, MSG_201); | ||||||
| 			uprintf("Cancelling (from ISO proc.)\n"); | 			uprintf("Cancelling (from ISO proc.)\n"); | ||||||
| 			EnableWindow(GetDlgItem(hISOProgressDlg, IDC_ISO_ABORT), FALSE); | 			EnableWindow(GetDlgItem(hISOProgressDlg, IDC_ISO_ABORT), FALSE); | ||||||
| 			if (format_thid != NULL) | 			if (format_thid != NULL) | ||||||
|  | @ -1102,10 +1103,10 @@ DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| 
 | 
 | ||||||
| 	if (iso_path == NULL) | 	if (iso_path == NULL) | ||||||
| 		goto out; | 		goto out; | ||||||
| 	PrintStatus(0, TRUE, lmprintf(MSG_202)); | 	PrintStatus(0, TRUE, MSG_202); | ||||||
| 	if (!ExtractISO(iso_path, "", TRUE)) { | 	if (!ExtractISO(iso_path, "", TRUE)) { | ||||||
| 		SendMessage(hISOProgressDlg, UM_ISO_EXIT, 0, 0); | 		SendMessage(hISOProgressDlg, UM_ISO_EXIT, 0, 0); | ||||||
| 		PrintStatus(0, TRUE, lmprintf(MSG_203)); | 		PrintStatus(0, TRUE, MSG_203); | ||||||
| 		safe_free(iso_path); | 		safe_free(iso_path); | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
|  | @ -1136,7 +1137,7 @@ DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| 					fclose(fd); | 					fclose(fd); | ||||||
| 					use_own_c32[i] = TRUE; | 					use_own_c32[i] = TRUE; | ||||||
| 				} else { | 				} else { | ||||||
| 					PrintStatus(0, FALSE, lmprintf(MSG_204, old_c32_name[i])); | 					PrintStatus(0, FALSE, MSG_204, old_c32_name[i]); | ||||||
| 					if (MessageBoxU(hMainDialog, lmprintf(MSG_084, old_c32_name[i], old_c32_name[i]), | 					if (MessageBoxU(hMainDialog, lmprintf(MSG_084, old_c32_name[i], old_c32_name[i]), | ||||||
| 						 lmprintf(MSG_083, old_c32_name[i]), MB_YESNO|MB_ICONWARNING) == IDYES) { | 						 lmprintf(MSG_083, old_c32_name[i]), MB_YESNO|MB_ICONWARNING) == IDYES) { | ||||||
| 						SetWindowTextU(hISOProgressDlg, lmprintf(MSG_085, old_c32_name[i])); | 						SetWindowTextU(hISOProgressDlg, lmprintf(MSG_085, old_c32_name[i])); | ||||||
|  | @ -1153,7 +1154,7 @@ DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| 		SetFSFromISO(); | 		SetFSFromISO(); | ||||||
| 		SetMBRProps(); | 		SetMBRProps(); | ||||||
| 		for (i=(int)safe_strlen(iso_path); (i>0)&&(iso_path[i]!='\\'); i--); | 		for (i=(int)safe_strlen(iso_path); (i>0)&&(iso_path[i]!='\\'); i--); | ||||||
| 		PrintStatus(0, TRUE, lmprintf(MSG_205, &iso_path[i+1])); | 		PrintStatus(0, TRUE, MSG_205, &iso_path[i+1]); | ||||||
| 		// Some Linux distros, such as Arch Linux, require the USB drive to have
 | 		// Some Linux distros, such as Arch Linux, require the USB drive to have
 | ||||||
| 		// a specific label => copy the one we got from the ISO image
 | 		// a specific label => copy the one we got from the ISO image
 | ||||||
| 		if (iso_report.label[0] != 0) { | 		if (iso_report.label[0] != 0) { | ||||||
|  | @ -1297,7 +1298,7 @@ static BOOL BootCheck(void) | ||||||
| 			uprintf("Will reuse '%s' for Syslinux v5\n", ldlinux_name); | 			uprintf("Will reuse '%s' for Syslinux v5\n", ldlinux_name); | ||||||
| 			fclose(fd); | 			fclose(fd); | ||||||
| 		} else { | 		} else { | ||||||
| 			PrintStatus(0, FALSE, lmprintf(MSG_206, ldlinux_name)); | 			PrintStatus(0, FALSE, MSG_206, ldlinux_name); | ||||||
| 			// Syslinux v5.0 or later requires a '%s' file to be installed
 | 			// Syslinux v5.0 or later requires a '%s' file to be installed
 | ||||||
| 			r = MessageBoxU(hMainDialog, lmprintf(MSG_104, ldlinux_name, ldlinux_name), | 			r = MessageBoxU(hMainDialog, lmprintf(MSG_104, ldlinux_name, ldlinux_name), | ||||||
| 				lmprintf(MSG_103, ldlinux_name), MB_YESNOCANCEL|MB_ICONWARNING); | 				lmprintf(MSG_103, ldlinux_name), MB_YESNOCANCEL|MB_ICONWARNING); | ||||||
|  | @ -1477,7 +1478,7 @@ void InitDialog(HWND hDlg) | ||||||
| 
 | 
 | ||||||
| static void PrintStatus2000(const char* str, BOOL val) | static void PrintStatus2000(const char* str, BOOL val) | ||||||
| { | { | ||||||
| 	PrintStatus(2000, FALSE, (lmprintf((val)?MSG_250:MSG_251, str))); | 	PrintStatus(2000, FALSE, (val)?MSG_250:MSG_251, str); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ShowLanguageMenu(HWND hDlg) | void ShowLanguageMenu(HWND hDlg) | ||||||
|  | @ -1607,7 +1608,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 					// Operation may have completed in the meantime
 | 					// Operation may have completed in the meantime
 | ||||||
| 					if (format_thid != NULL) { | 					if (format_thid != NULL) { | ||||||
| 						FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED; | 						FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANCELLED; | ||||||
| 						PrintStatus(0, FALSE, lmprintf(MSG_201)); | 						PrintStatus(0, FALSE, MSG_201); | ||||||
| 						uprintf("Cancelling (from main app)\n"); | 						uprintf("Cancelling (from main app)\n"); | ||||||
| 						//  Start a timer to detect blocking operations during ISO file extraction
 | 						//  Start a timer to detect blocking operations during ISO file extraction
 | ||||||
| 						if (iso_blocking_status >= 0) { | 						if (iso_blocking_status >= 0) { | ||||||
|  | @ -1680,7 +1681,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 			if (HIWORD(wParam) != CBN_SELCHANGE) | 			if (HIWORD(wParam) != CBN_SELCHANGE) | ||||||
| 				break; | 				break; | ||||||
| 			nb_devices = ComboBox_GetCount(hDeviceList); | 			nb_devices = ComboBox_GetCount(hDeviceList); | ||||||
| 			PrintStatus(0, TRUE, lmprintf((nb_devices==1)?MSG_208:MSG_209, nb_devices)); | 			PrintStatus(0, TRUE, (nb_devices==1)?MSG_208:MSG_209, nb_devices); | ||||||
| 			PopulateProperties(ComboBox_GetCurSel(hDeviceList)); | 			PopulateProperties(ComboBox_GetCurSel(hDeviceList)); | ||||||
| 			SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM, | 			SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM, | ||||||
| 				ComboBox_GetCurSel(hFileSystem)); | 				ComboBox_GetCurSel(hFileSystem)); | ||||||
|  | @ -1879,7 +1880,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 					PostMessage(hMainDialog, UM_FORMAT_COMPLETED, 0, 0); | 					PostMessage(hMainDialog, UM_FORMAT_COMPLETED, 0, 0); | ||||||
| 				} | 				} | ||||||
| 				uprintf("\r\nFormat operation started"); | 				uprintf("\r\nFormat operation started"); | ||||||
| 				PrintStatus(0, FALSE, ""); | 				PrintStatus(0, FALSE, -1); | ||||||
| 				timer = 0; | 				timer = 0; | ||||||
| 				safe_sprintf(szTimer, sizeof(szTimer), "00:00:00"); | 				safe_sprintf(szTimer, sizeof(szTimer), "00:00:00"); | ||||||
| 				SendMessageA(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTA, | 				SendMessageA(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTA, | ||||||
|  | @ -1930,17 +1931,17 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 			SendMessage(hProgress, PBM_SETPOS, (MAX_PROGRESS+1), 0); | 			SendMessage(hProgress, PBM_SETPOS, (MAX_PROGRESS+1), 0); | ||||||
| 			SendMessage(hProgress, PBM_SETRANGE, 0, (MAX_PROGRESS<<16) & 0xFFFF0000); | 			SendMessage(hProgress, PBM_SETRANGE, 0, (MAX_PROGRESS<<16) & 0xFFFF0000); | ||||||
| 			SetTaskbarProgressState(TASKBAR_NOPROGRESS); | 			SetTaskbarProgressState(TASKBAR_NOPROGRESS); | ||||||
| 			PrintStatus(0, FALSE, lmprintf(MSG_210)); | 			PrintStatus(0, FALSE, MSG_210); | ||||||
| 		} else if (SCODE_CODE(FormatStatus) == ERROR_CANCELLED) { | 		} else if (SCODE_CODE(FormatStatus) == ERROR_CANCELLED) { | ||||||
| 			SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_PAUSED, 0); | 			SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_PAUSED, 0); | ||||||
| 			SetTaskbarProgressState(TASKBAR_PAUSED); | 			SetTaskbarProgressState(TASKBAR_PAUSED); | ||||||
| 			PrintStatus(0, FALSE, lmprintf(MSG_211)); | 			PrintStatus(0, FALSE, MSG_211); | ||||||
| 			Notification(MSG_INFO, NULL, lmprintf(MSG_211), lmprintf(MSG_041)); | 			Notification(MSG_INFO, NULL, lmprintf(MSG_211), lmprintf(MSG_041)); | ||||||
| 		} else { | 		} else { | ||||||
| 			SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_ERROR, 0); | 			SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_ERROR, 0); | ||||||
| 			SetTaskbarProgressState(TASKBAR_ERROR); | 			SetTaskbarProgressState(TASKBAR_ERROR); | ||||||
| 			PrintStatus(0, FALSE, lmprintf(MSG_212)); | 			PrintStatus(0, FALSE, MSG_212); | ||||||
| 			Notification(MSG_ERROR, NULL, lmprintf(MSG_042), lmprintf(MSG_043, StrError(FormatStatus)), StrError(FormatStatus)); | 			Notification(MSG_ERROR, NULL, lmprintf(MSG_042), lmprintf(MSG_043, StrError(FormatStatus, FALSE)), StrError(FormatStatus, FALSE)); | ||||||
| 		} | 		} | ||||||
| 		FormatStatus = 0; | 		FormatStatus = 0; | ||||||
| 		format_op_in_progress = FALSE; | 		format_op_in_progress = FALSE; | ||||||
|  | @ -2128,7 +2129,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | ||||||
| 	} | 	} | ||||||
| 	if ((mutex == NULL) || (GetLastError() == ERROR_ALREADY_EXISTS)) { | 	if ((mutex == NULL) || (GetLastError() == ERROR_ALREADY_EXISTS)) { | ||||||
| 		// Load the translation before we print the error
 | 		// Load the translation before we print the error
 | ||||||
| 		get_loc_data_file(loc_file, (long)selected_locale->num[0], (long)selected_locale->num[1], selected_locale->line_nr); | 		get_loc_data_file(loc_file, selected_locale); | ||||||
| 		MessageBoxU(NULL, lmprintf(MSG_002), lmprintf(MSG_001), MB_ICONSTOP); | 		MessageBoxU(NULL, lmprintf(MSG_002), lmprintf(MSG_001), MB_ICONSTOP); | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
|  | @ -2151,9 +2152,12 @@ 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); | ||||||
| 
 | 
 | ||||||
|  | 	// Populate the default locale (so that we can produce English messages in the log)
 | ||||||
|  | 	get_loc_data_file(loc_file, NULL); | ||||||
|  | 
 | ||||||
| relaunch: | relaunch: | ||||||
| 	uprintf("localization: using locale '%s'\n", selected_locale->txt[0]); | 	uprintf("localization: using locale '%s'\n", selected_locale->txt[0]); | ||||||
| 	get_loc_data_file(loc_file, (long)selected_locale->num[0], (long)selected_locale->num[1], selected_locale->line_nr); | 	get_loc_data_file(loc_file, selected_locale); | ||||||
| 
 | 
 | ||||||
| 	// Create the main Window
 | 	// Create the main Window
 | ||||||
| 	hDlg = CreateDialogW(hInstance, MAKEINTRESOURCEW(IDD_DIALOG), NULL, MainCallback); | 	hDlg = CreateDialogW(hInstance, MAKEINTRESOURCEW(IDD_DIALOG), NULL, MainCallback); | ||||||
|  | @ -2200,7 +2204,7 @@ relaunch: | ||||||
| 			// Alt-D => Delete the NoDriveTypeAutorun key on exit (useful if the app crashed)
 | 			// Alt-D => Delete the NoDriveTypeAutorun key on exit (useful if the app crashed)
 | ||||||
| 			// This key is used to disable Windows popup messages when an USB drive is plugged in.
 | 			// This key is used to disable Windows popup messages when an USB drive is plugged in.
 | ||||||
| 			if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'D')) { | 			if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'D')) { | ||||||
| 				PrintStatus(2000, FALSE, lmprintf(MSG_255)); | 				PrintStatus(2000, FALSE, MSG_255); | ||||||
| 				existing_key = FALSE; | 				existing_key = FALSE; | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
|  | @ -2231,7 +2235,7 @@ relaunch: | ||||||
| 			} | 			} | ||||||
| 			// Alt-R => Remove all the registry keys created by Rufus
 | 			// Alt-R => Remove all the registry keys created by Rufus
 | ||||||
| 			if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'R')) { | 			if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'R')) { | ||||||
| 				PrintStatus(2000, FALSE, lmprintf(DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME "\\" APPLICATION_NAME)?MSG_248:MSG_249)); | 				PrintStatus(2000, FALSE, DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME "\\" APPLICATION_NAME)?MSG_248:MSG_249); | ||||||
| 				// Also try to delete the upper key (company name) if it's empty (don't care about the result)
 | 				// Also try to delete the upper key (company name) if it's empty (don't care about the result)
 | ||||||
| 				DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME); | 				DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME); | ||||||
| 				continue; | 				continue; | ||||||
|  |  | ||||||
|  | @ -292,9 +292,9 @@ extern BOOL is_x64(void); | ||||||
| extern const char* PrintWindowsVersion(enum WindowsVersion version); | extern const char* PrintWindowsVersion(enum WindowsVersion version); | ||||||
| extern const char *WindowsErrorString(void); | extern const char *WindowsErrorString(void); | ||||||
| extern void DumpBufferHex(void *buf, size_t size); | extern void DumpBufferHex(void *buf, size_t size); | ||||||
| extern void PrintStatus(unsigned int duration, BOOL debug, const char* message); | extern void PrintStatus(unsigned int duration, BOOL debug, int msg_id, ...); | ||||||
| extern void UpdateProgress(int op, float percent); | extern void UpdateProgress(int op, float percent); | ||||||
| extern const char* StrError(DWORD error_code); | extern const char* StrError(DWORD error_code, BOOL use_default_locale); | ||||||
| extern char* GuidToString(const GUID* guid); | extern char* GuidToString(const GUID* guid); | ||||||
| extern char* SizeToHumanReadable(LARGE_INTEGER size); | extern char* SizeToHumanReadable(LARGE_INTEGER size); | ||||||
| extern void CenterDialog(HWND hDlg); | extern void CenterDialog(HWND hDlg); | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 206, 329 | IDD_DIALOG DIALOGEX 12, 12, 206, 329 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_APPWINDOW | EXSTYLE WS_EX_APPWINDOW | ||||||
| CAPTION "Rufus v1.4.2.357" | CAPTION "Rufus v1.4.2.358" | ||||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     DEFPUSHBUTTON   "Start",IDC_START,94,291,50,14 |     DEFPUSHBUTTON   "Start",IDC_START,94,291,50,14 | ||||||
|  | @ -288,8 +288,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 1,4,2,357 |  FILEVERSION 1,4,2,358 | ||||||
|  PRODUCTVERSION 1,4,2,357 |  PRODUCTVERSION 1,4,2,358 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -306,13 +306,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", "1.4.2.357" |             VALUE "FileVersion", "1.4.2.358" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2013 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", "1.4.2.357" |             VALUE "ProductVersion", "1.4.2.358" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
|  | @ -300,7 +300,7 @@ BOOL FileIO(BOOL save, char* path, char** buffer, DWORD* size) | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	PrintStatus(0, TRUE, save?lmprintf(MSG_216, path):lmprintf(MSG_215, path)); | 	PrintStatus(0, TRUE, save?MSG_216:MSG_215, path); | ||||||
| 	ret = TRUE; | 	ret = TRUE; | ||||||
| 
 | 
 | ||||||
| out: | out: | ||||||
|  |  | ||||||
							
								
								
									
										45
									
								
								src/stdio.c
									
										
									
									
									
								
							
							
						
						
									
										45
									
								
								src/stdio.c
									
										
									
									
									
								
							|  | @ -134,38 +134,6 @@ static char err_string[256] = {0}; | ||||||
| 	return err_string; | 	return err_string; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 |  | ||||||
|  * Display a message on the status bar. If duration is non zero, ensures that message |  | ||||||
|  * is displayed for at least duration ms, regardless of any other incoming message |  | ||||||
|  */ |  | ||||||
| static BOOL bStatusTimerArmed = FALSE; |  | ||||||
| char szStatusMessage[256] = { 0 }; |  | ||||||
| static void CALLBACK PrintStatusTimeout(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) |  | ||||||
| { |  | ||||||
| 	bStatusTimerArmed = FALSE; |  | ||||||
| 	// potentially display lower priority message that was overridden
 |  | ||||||
| 	SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); |  | ||||||
| 	KillTimer(hMainDialog, TID_MESSAGE); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void PrintStatus(unsigned int duration, BOOL debug, const char* message) |  | ||||||
| { |  | ||||||
| 	if (message == NULL) |  | ||||||
| 		return; |  | ||||||
| 	safe_strcpy(szStatusMessage, sizeof(szStatusMessage), message); |  | ||||||
| 	if (debug) |  | ||||||
| 		uprintf("%s\n", szStatusMessage); |  | ||||||
| 
 |  | ||||||
| 	if ((duration) || (!bStatusTimerArmed)) { |  | ||||||
| 		SendMessageLU(GetDlgItem(hMainDialog, IDC_STATUS), SB_SETTEXTW, SBT_OWNERDRAW, szStatusMessage); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if (duration) { |  | ||||||
| 		SetTimer(hMainDialog, TID_MESSAGE, duration, PrintStatusTimeout); |  | ||||||
| 		bStatusTimerArmed = TRUE; |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| char* GuidToString(const GUID* guid) | char* GuidToString(const GUID* guid) | ||||||
| { | { | ||||||
| 	static char guid_string[MAX_GUID_STRING_LENGTH]; | 	static char guid_string[MAX_GUID_STRING_LENGTH]; | ||||||
|  | @ -196,7 +164,7 @@ char* SizeToHumanReadable(LARGE_INTEGER size) | ||||||
| 	return str_size; | 	return str_size; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const char* StrError(DWORD error_code) | const char* _StrError(DWORD error_code) | ||||||
| { | { | ||||||
| 	if ( (!IS_ERROR(error_code)) || (SCODE_CODE(error_code) == ERROR_SUCCESS)) { | 	if ( (!IS_ERROR(error_code)) || (SCODE_CODE(error_code) == ERROR_SUCCESS)) { | ||||||
| 		return lmprintf(MSG_044); | 		return lmprintf(MSG_044); | ||||||
|  | @ -269,3 +237,14 @@ const char* StrError(DWORD error_code) | ||||||
| 		return WindowsErrorString(); | 		return WindowsErrorString(); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | const char* StrError(DWORD error_code, BOOL use_default_locale) | ||||||
|  | { | ||||||
|  | 	const char* ret; | ||||||
|  | 	if (use_default_locale) | ||||||
|  | 		toggle_default_locale(); | ||||||
|  | 	ret = _StrError(error_code); | ||||||
|  | 	if (use_default_locale) | ||||||
|  | 		toggle_default_locale(); | ||||||
|  | 	return ret; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -1206,11 +1206,11 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR | ||||||
| 				memset(&pi, 0, sizeof(pi)); | 				memset(&pi, 0, sizeof(pi)); | ||||||
| 				si.cb = sizeof(si); | 				si.cb = sizeof(si); | ||||||
| 				if (!CreateProcessU(filepath, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { | 				if (!CreateProcessU(filepath, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { | ||||||
| 					PrintStatus(0, FALSE, lmprintf(MSG_214)); | 					PrintStatus(0, FALSE, MSG_214); | ||||||
| 					// TODO: produce a message box and add a retry, as the file may be scanned by the Antivirus
 | 					// TODO: produce a message box and add a retry, as the file may be scanned by the Antivirus
 | ||||||
| 					uprintf("Failed to launch new application: %s\n", WindowsErrorString()); | 					uprintf("Failed to launch new application: %s\n", WindowsErrorString()); | ||||||
| 				} else { | 				} else { | ||||||
| 					PrintStatus(0, FALSE, lmprintf(MSG_213)); | 					PrintStatus(0, FALSE, MSG_213); | ||||||
| 					PostMessage(hDlg, WM_COMMAND, (WPARAM)IDCLOSE, 0); | 					PostMessage(hDlg, WM_COMMAND, (WPARAM)IDCLOSE, 0); | ||||||
| 					PostMessage(hMainDialog, WM_CLOSE, 0, 0); | 					PostMessage(hMainDialog, WM_CLOSE, 0, 0); | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
|  | @ -92,7 +92,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter) | ||||||
| 	int dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | 	int dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); | ||||||
| 	BOOL use_v5 = (dt == DT_SYSLINUX_V5) || ((dt == DT_ISO) && (iso_report.has_syslinux_v5)); | 	BOOL use_v5 = (dt == DT_SYSLINUX_V5) || ((dt == DT_ISO) && (iso_report.has_syslinux_v5)); | ||||||
| 
 | 
 | ||||||
| 	PrintStatus(0, TRUE, lmprintf(MSG_234, use_v5?5:4)); | 	PrintStatus(0, TRUE, MSG_234, use_v5?5:4); | ||||||
| 
 | 
 | ||||||
| 	ldlinux_path[0] = drive_letter; | 	ldlinux_path[0] = drive_letter; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue