mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	
							parent
							
								
									ed4297609e
								
							
						
					
					
						commit
						f72b298c03
					
				
					 12 changed files with 146 additions and 25 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								freedos/COMMAND.COM
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								freedos/COMMAND.COM
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								freedos/KERNEL.SYS
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								freedos/KERNEL.SYS
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										2
									
								
								freedos/readme.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								freedos/readme.txt
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | ||||||
|  | These files were extracted from the fd11tst3.img image available at: | ||||||
|  | http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.1-test3/ | ||||||
|  | @ -194,6 +194,7 @@ | ||||||
|     <ClInclude Include="..\inc\partition_info.h" /> |     <ClInclude Include="..\inc\partition_info.h" /> | ||||||
|     <ClInclude Include="..\msapi_utf8.h" /> |     <ClInclude Include="..\msapi_utf8.h" /> | ||||||
|     <ClInclude Include="..\msdos.h" /> |     <ClInclude Include="..\msdos.h" /> | ||||||
|  |     <ClInclude Include="..\resource.h" /> | ||||||
|     <ClInclude Include="..\rufus.h" /> |     <ClInclude Include="..\rufus.h" /> | ||||||
|     <ClInclude Include="..\license.h" /> |     <ClInclude Include="..\license.h" /> | ||||||
|     <ClInclude Include="..\sys_types.h" /> |     <ClInclude Include="..\sys_types.h" /> | ||||||
|  | @ -202,6 +203,8 @@ | ||||||
|     <Manifest Include="..\common_controls_and_elevation.manifest" /> |     <Manifest Include="..\common_controls_and_elevation.manifest" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|  |     <None Include="..\..\freedos\COMMAND.COM" /> | ||||||
|  |     <None Include="..\..\freedos\KERNEL.SYS" /> | ||||||
|     <None Include="..\rufus.ico" /> |     <None Include="..\rufus.ico" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|  |  | ||||||
|  | @ -16,6 +16,9 @@ | ||||||
|     <Filter Include="Header Files\ms-sys inc"> |     <Filter Include="Header Files\ms-sys inc"> | ||||||
|       <UniqueIdentifier>{ecff9fec-41c4-4ce8-b725-27ee39754cb7}</UniqueIdentifier> |       <UniqueIdentifier>{ecff9fec-41c4-4ce8-b725-27ee39754cb7}</UniqueIdentifier> | ||||||
|     </Filter> |     </Filter> | ||||||
|  |     <Filter Include="Resource Files\freedos"> | ||||||
|  |       <UniqueIdentifier>{340c377e-7530-411d-a367-49825f080d85}</UniqueIdentifier> | ||||||
|  |     </Filter> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <ClCompile Include="..\rufus.c"> |     <ClCompile Include="..\rufus.c"> | ||||||
|  | @ -167,11 +170,20 @@ | ||||||
|     <ClInclude Include="..\inc\partition_info.h"> |     <ClInclude Include="..\inc\partition_info.h"> | ||||||
|       <Filter>Header Files\ms-sys inc</Filter> |       <Filter>Header Files\ms-sys inc</Filter> | ||||||
|     </ClInclude> |     </ClInclude> | ||||||
|  |     <ClInclude Include="..\resource.h"> | ||||||
|  |       <Filter>Header Files</Filter> | ||||||
|  |     </ClInclude> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <None Include="..\rufus.ico"> |     <None Include="..\rufus.ico"> | ||||||
|       <Filter>Resource Files</Filter> |       <Filter>Resource Files</Filter> | ||||||
|     </None> |     </None> | ||||||
|  |     <None Include="..\..\freedos\COMMAND.COM"> | ||||||
|  |       <Filter>Resource Files\freedos</Filter> | ||||||
|  |     </None> | ||||||
|  |     <None Include="..\..\freedos\KERNEL.SYS"> | ||||||
|  |       <Filter>Resource Files\freedos</Filter> | ||||||
|  |     </None> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <Manifest Include="..\common_controls_and_elevation.manifest"> |     <Manifest Include="..\common_controls_and_elevation.manifest"> | ||||||
|  |  | ||||||
							
								
								
									
										20
									
								
								src/format.c
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								src/format.c
									
										
									
									
									
								
							|  | @ -318,7 +318,7 @@ out: | ||||||
| /*
 | /*
 | ||||||
|  * Process the Partition Boot Record |  * Process the Partition Boot Record | ||||||
|  */ |  */ | ||||||
| static BOOL WritePBR(HANDLE hLogicalVolume) | static BOOL WritePBR(HANDLE hLogicalVolume, BOOL bFreeDOS) | ||||||
| { | { | ||||||
| 	int i; | 	int i; | ||||||
| 	FILE fake_fd = { 0 }; | 	FILE fake_fd = { 0 }; | ||||||
|  | @ -334,9 +334,11 @@ static BOOL WritePBR(HANDLE hLogicalVolume) | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 		uprintf("Confirmed new volume has a FAT16 boot sector\n"); | 		uprintf("Confirmed new volume has a FAT16 boot sector\n"); | ||||||
| 		if (!write_fat_16_br(&fake_fd, 0) || | 		if (bFreeDOS) { | ||||||
|  | 			if (!write_fat_16_fd_br(&fake_fd, 0)) break; | ||||||
|  | 		} else if (!write_fat_16_br(&fake_fd, 0)) break; | ||||||
| 		// Disk Drive ID needs to be corrected on XP
 | 		// Disk Drive ID needs to be corrected on XP
 | ||||||
| 			!write_partition_physical_disk_drive_id_fat16(&fake_fd)) | 		if (!write_partition_physical_disk_drive_id_fat16(&fake_fd)) | ||||||
| 			break; | 			break; | ||||||
| 		return TRUE; | 		return TRUE; | ||||||
| 	case FS_FAT32: | 	case FS_FAT32: | ||||||
|  | @ -347,9 +349,11 @@ static BOOL WritePBR(HANDLE hLogicalVolume) | ||||||
| 			} | 			} | ||||||
| 			uprintf("Confirmed new volume has a %s FAT32 boot sector\n", i?"secondary":"primary"); | 			uprintf("Confirmed new volume has a %s FAT32 boot sector\n", i?"secondary":"primary"); | ||||||
| 			uprintf("Setting %s FAT32 boot sector for DOS boot...\n", i?"secondary":"primary"); | 			uprintf("Setting %s FAT32 boot sector for DOS boot...\n", i?"secondary":"primary"); | ||||||
| 			if (!write_fat_32_br(&fake_fd, 0) || | 			if (bFreeDOS) { | ||||||
|  | 				if (!write_fat_32_fd_br(&fake_fd, 0)) break; | ||||||
|  | 			} else if (!write_fat_32_br(&fake_fd, 0)) break; | ||||||
| 			// Disk Drive ID needs to be corrected on XP
 | 			// Disk Drive ID needs to be corrected on XP
 | ||||||
| 				!write_partition_physical_disk_drive_id_fat32(&fake_fd)) | 			if (!write_partition_physical_disk_drive_id_fat32(&fake_fd)) | ||||||
| 				break; | 				break; | ||||||
| 			fake_fd._cnt += 6 * (int)SelectedDrive.Geometry.BytesPerSector; | 			fake_fd._cnt += 6 * (int)SelectedDrive.Geometry.BytesPerSector; | ||||||
| 		} | 		} | ||||||
|  | @ -469,15 +473,15 @@ void __cdecl FormatThread(void* param) | ||||||
| 			goto out; | 			goto out; | ||||||
| 		} | 		} | ||||||
| 		PrintStatus(0, "Writing partition boot record...\n"); | 		PrintStatus(0, "Writing partition boot record...\n"); | ||||||
| 		if (!WritePBR(hLogicalVolume)) { | 		if (!WritePBR(hLogicalVolume, ComboBox_GetCurSel(hDOSType) == DT_FREEDOS)) { | ||||||
| 			// Errorcode has already been set
 | 			// Errorcode has already been set
 | ||||||
| 			goto out; | 			goto out; | ||||||
| 		} | 		} | ||||||
| 		// ...but we must have relinquished that lock to write the MS-DOS files 
 | 		// ...but we must have relinquished that lock to write the MS-DOS files 
 | ||||||
| 		safe_unlockclose(hLogicalVolume); | 		safe_unlockclose(hLogicalVolume); | ||||||
| 		UpdateProgress(OP_DOS, -1.0f); | 		UpdateProgress(OP_DOS, -1.0f); | ||||||
| 		PrintStatus(0, "Copying MS-DOS files...\n"); | 		PrintStatus(0, "Copying DOS files...\n"); | ||||||
| 		if (!ExtractMSDOS(drive_name)) { | 		if (!ExtractDOS(drive_name, ComboBox_GetCurSel(hDOSType))) { | ||||||
| 			FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANNOT_COPY; | 			FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANNOT_COPY; | ||||||
| 			goto out; | 			goto out; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -26,7 +26,7 @@ const char* additional_copyrights = | ||||||
| "http://ms-sys.sourceforge.net\r\n" | "http://ms-sys.sourceforge.net\r\n" | ||||||
| "GNU General Public License (GPL) v2 or later\r\n" | "GNU General Public License (GPL) v2 or later\r\n" | ||||||
| "\r\n" | "\r\n" | ||||||
| "Bad blocks testing from e2fsprogs by Theodore T'so and al:\r\n" | "Bad blocks testing from e2fsprogs by Theodore T'so et al:\r\n" | ||||||
| "http://e2fsprogs.sourceforge.net\r\n" | "http://e2fsprogs.sourceforge.net\r\n" | ||||||
| "GNU General Public License (GPL) v3 compatible\r\n" | "GNU General Public License (GPL) v3 compatible\r\n" | ||||||
| "\r\n" | "\r\n" | ||||||
|  |  | ||||||
							
								
								
									
										76
									
								
								src/msdos.c
									
										
									
									
									
								
							
							
						
						
									
										76
									
								
								src/msdos.c
									
										
									
									
									
								
							|  | @ -29,6 +29,7 @@ | ||||||
| 
 | 
 | ||||||
| #include "rufus.h" | #include "rufus.h" | ||||||
| #include "msdos.h" | #include "msdos.h" | ||||||
|  | #include "resource.h" | ||||||
| 
 | 
 | ||||||
| static BYTE* DiskImage; | static BYTE* DiskImage; | ||||||
| static size_t DiskImageSize; | static size_t DiskImageSize; | ||||||
|  | @ -257,7 +258,7 @@ static BOOL ExtractFAT(int entry, const char* path) | ||||||
| 	if ((!WriteFile(hFile, &DiskImage[filestart], (DWORD)filesize, &Size, 0)) || (filesize != Size)) { | 	if ((!WriteFile(hFile, &DiskImage[filestart], (DWORD)filesize, &Size, 0)) || (filesize != Size)) { | ||||||
| 		uprintf("Couldn't write file '%s': %s.\n", filename, WindowsErrorString()); | 		uprintf("Couldn't write file '%s': %s.\n", filename, WindowsErrorString()); | ||||||
| 		safe_closehandle(hFile); | 		safe_closehandle(hFile); | ||||||
| 		return FALSE;		safe_closehandle(hFile); | 		return FALSE; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* Restore timestamps from FAT */ | 	/* Restore timestamps from FAT */ | ||||||
|  | @ -284,7 +285,7 @@ static BOOL ExtractFAT(int entry, const char* path) | ||||||
| 
 | 
 | ||||||
| /* Extract the MS-DOS files contained in the FAT12 1.4MB floppy
 | /* Extract the MS-DOS files contained in the FAT12 1.4MB floppy
 | ||||||
|    image included as resource "BINFILE" in diskcopy.dll */ |    image included as resource "BINFILE" in diskcopy.dll */ | ||||||
| BOOL ExtractMSDOS(const char* path) | static BOOL ExtractMSDOS(const char* path) | ||||||
| { | { | ||||||
| 	char dllname[MAX_PATH] = "C:\\Windows\\System32"; | 	char dllname[MAX_PATH] = "C:\\Windows\\System32"; | ||||||
| 	int i, j; | 	int i, j; | ||||||
|  | @ -337,3 +338,74 @@ BOOL ExtractMSDOS(const char* path) | ||||||
| 
 | 
 | ||||||
| 	return r; | 	return r; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | /* Extract the FreeDOS files embedded in the app */ | ||||||
|  | BOOL ExtractFreeDOS(const char* path) | ||||||
|  | { | ||||||
|  | 	const char* res_name[2] = { "COMMAND.COM", "KERNEL.SYS" }; | ||||||
|  | 	const int res_id[2] = { IDR_FD_COMMAND_COM, IDR_FD_KERNEL_SYS }; | ||||||
|  | 	char filename[MAX_PATH]; | ||||||
|  | 	HGLOBAL res_handle[2]; | ||||||
|  | 	HRSRC res[2]; | ||||||
|  | 	BYTE* res_data[2]; | ||||||
|  | 	DWORD res_size[2], Size; | ||||||
|  | 	HANDLE hFile; | ||||||
|  | 	size_t pos; | ||||||
|  | 	int i; | ||||||
|  | 
 | ||||||
|  | 	if ((path == NULL) || ((safe_strlen(path) + 14) > sizeof(filename))) { | ||||||
|  | 		uprintf("invalid path supplied for FreeDOS extraction\n"); | ||||||
|  | 		return FALSE; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	for (i=0; i<2; i++) { | ||||||
|  | 		res[i] = FindResource(hMainInstance, MAKEINTRESOURCE(res_id[i]), RT_RCDATA); | ||||||
|  | 		if (res[i] == NULL) { | ||||||
|  | 			uprintf("Unable to locate FreeDOS resource %s: %s\n", res_name[i], WindowsErrorString()); | ||||||
|  | 			return FALSE; | ||||||
|  | 		} | ||||||
|  | 		res_handle[i] = LoadResource(NULL, res[i]); | ||||||
|  | 		if (res_handle[i] == NULL) { | ||||||
|  | 			uprintf("Unable to load FreeDOS resource %s: %s\n", res_name[i], WindowsErrorString()); | ||||||
|  | 			return FALSE; | ||||||
|  | 		} | ||||||
|  | 		res_data[i] = (BYTE*)LockResource(res_handle[i]); | ||||||
|  | 		res_size[i] = SizeofResource(NULL, res[i]); | ||||||
|  | 
 | ||||||
|  | 		strcpy(filename, path); | ||||||
|  | 		pos = strlen(path); | ||||||
|  | 		filename[pos++] = '\\'; | ||||||
|  | 		filename[pos] = 0; | ||||||
|  | 		safe_strcat(filename, sizeof(filename), res_name[i]); | ||||||
|  | 
 | ||||||
|  | 		// TODO: set attributes
 | ||||||
|  | 		hFile = CreateFileA(filename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, | ||||||
|  | 			NULL, CREATE_ALWAYS, 0, 0); | ||||||
|  | 		if (hFile == INVALID_HANDLE_VALUE) { | ||||||
|  | 			uprintf("Unable to create file '%s': %s.\n", filename, WindowsErrorString()); | ||||||
|  | 			return FALSE; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		if ((!WriteFile(hFile, res_data[i], res_size[i], &Size, 0)) || (res_size[i] != Size)) { | ||||||
|  | 			uprintf("Couldn't write file '%s': %s.\n", filename, WindowsErrorString()); | ||||||
|  | 			safe_closehandle(hFile); | ||||||
|  | 			return FALSE; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		// TODO: Restore timestamps from resource
 | ||||||
|  | //		if (!SetFileTime(hFile, &ftCreationTime, &ftLastAccessTime, &ftLastWriteTime)) {
 | ||||||
|  | //			uprintf("Could not set timestamps: %s\n", WindowsErrorString());
 | ||||||
|  | //		}
 | ||||||
|  | 
 | ||||||
|  | 		safe_closehandle(hFile); | ||||||
|  | 		uprintf("Succesfully wrote '%s' (%d bytes)\n", filename, res_size[i]); | ||||||
|  | 	} | ||||||
|  | 	return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | BOOL ExtractDOS(const char* path, int dos_type) | ||||||
|  | { | ||||||
|  | 	if (dos_type == DT_WINME) | ||||||
|  | 		return ExtractMSDOS(path); | ||||||
|  | 	return ExtractFreeDOS(path); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -8,6 +8,8 @@ | ||||||
| #define IDD_NOTIFICATION                104 | #define IDD_NOTIFICATION                104 | ||||||
| #define IDD_LICENSE                     105 | #define IDD_LICENSE                     105 | ||||||
| #define IDS_VERSION                     106 | #define IDS_VERSION                     106 | ||||||
|  | #define IDR_FD_COMMAND_COM              300 | ||||||
|  | #define IDR_FD_KERNEL_SYS               301 | ||||||
| #define IDC_DEVICE                      1001 | #define IDC_DEVICE                      1001 | ||||||
| #define IDC_FILESYSTEM                  1002 | #define IDC_FILESYSTEM                  1002 | ||||||
| #define IDC_START                       1003 | #define IDC_START                       1003 | ||||||
|  | @ -30,6 +32,7 @@ | ||||||
| #define IDC_NOTIFICATION_ICON           1040 | #define IDC_NOTIFICATION_ICON           1040 | ||||||
| #define IDC_NOTIFICATION_TEXT           1041 | #define IDC_NOTIFICATION_TEXT           1041 | ||||||
| #define IDC_NOTIFICATION_LINE           1042 | #define IDC_NOTIFICATION_LINE           1042 | ||||||
|  | #define IDC_DOSTYPE                     1043 | ||||||
| 
 | 
 | ||||||
| // Next default values for new objects
 | // Next default values for new objects
 | ||||||
| // 
 | // 
 | ||||||
|  | @ -38,7 +41,7 @@ | ||||||
| #define _APS_NO_MFC                     1 | #define _APS_NO_MFC                     1 | ||||||
| #define _APS_NEXT_RESOURCE_VALUE        107 | #define _APS_NEXT_RESOURCE_VALUE        107 | ||||||
| #define _APS_NEXT_COMMAND_VALUE         40001 | #define _APS_NEXT_COMMAND_VALUE         40001 | ||||||
| #define _APS_NEXT_CONTROL_VALUE         1043 | #define _APS_NEXT_CONTROL_VALUE         1044 | ||||||
| #define _APS_NEXT_SYMED_VALUE           101 | #define _APS_NEXT_SYMED_VALUE           101 | ||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
							
								
								
									
										14
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -53,7 +53,7 @@ HWND hMainDialog; | ||||||
| char szFolderPath[MAX_PATH]; | char szFolderPath[MAX_PATH]; | ||||||
| float fScale = 1.0f; | float fScale = 1.0f; | ||||||
| int default_fs; | int default_fs; | ||||||
| HWND hDeviceList, hCapacity, hFileSystem, hClusterSize, hLabel; | HWND hDeviceList, hCapacity, hFileSystem, hClusterSize, hLabel, hDOSType; | ||||||
| 
 | 
 | ||||||
| static HWND hDeviceTooltip = NULL, hFSTooltip = NULL, hProgress = NULL; | static HWND hDeviceTooltip = NULL, hFSTooltip = NULL, hProgress = NULL; | ||||||
| static StrArray DriveID, DriveLabel; | static StrArray DriveID, DriveLabel; | ||||||
|  | @ -234,7 +234,6 @@ static BOOL SetClusterSizes(int FSType) | ||||||
| 	IGNORE_RETVAL(ComboBox_ResetContent(hClusterSize)); | 	IGNORE_RETVAL(ComboBox_ResetContent(hClusterSize)); | ||||||
| 
 | 
 | ||||||
| 	if ((FSType < 0) || (FSType >= FS_MAX)) { | 	if ((FSType < 0) || (FSType >= FS_MAX)) { | ||||||
| 		uprintf("Invalid FS value passed to SetClusterSizes\n"); |  | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -846,8 +845,10 @@ static void EnableControls(BOOL bEnable) | ||||||
| 	if (bEnable) { | 	if (bEnable) { | ||||||
| 		fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | 		fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | ||||||
| 		EnableWindow(GetDlgItem(hMainDialog, IDC_DOS), (fs == FS_FAT16) || (fs == FS_FAT32)); | 		EnableWindow(GetDlgItem(hMainDialog, IDC_DOS), (fs == FS_FAT16) || (fs == FS_FAT32)); | ||||||
|  | 		EnableWindow(GetDlgItem(hMainDialog, IDC_DOSTYPE), (fs == FS_FAT16) || (fs == FS_FAT32)); | ||||||
| 	} else { | 	} else { | ||||||
| 		EnableWindow(GetDlgItem(hMainDialog, IDC_DOS), FALSE); | 		EnableWindow(GetDlgItem(hMainDialog, IDC_DOS), FALSE); | ||||||
|  | 		EnableWindow(GetDlgItem(hMainDialog, IDC_DOSTYPE), FALSE); | ||||||
| 	} | 	} | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_BADBLOCKS), bEnable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_BADBLOCKS), bEnable); | ||||||
| 	EnableWindow(GetDlgItem(hMainDialog, IDC_ABOUT), bEnable); | 	EnableWindow(GetDlgItem(hMainDialog, IDC_ABOUT), bEnable); | ||||||
|  | @ -900,6 +901,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 		hLabel = GetDlgItem(hDlg, IDC_LABEL); | 		hLabel = GetDlgItem(hDlg, IDC_LABEL); | ||||||
| 		hProgress = GetDlgItem(hDlg, IDC_PROGRESS); | 		hProgress = GetDlgItem(hDlg, IDC_PROGRESS); | ||||||
| 		hDOS = GetDlgItem(hDlg, IDC_DOS); | 		hDOS = GetDlgItem(hDlg, IDC_DOS); | ||||||
|  | 		hDOSType = GetDlgItem(hDlg, IDC_DOSTYPE); | ||||||
| 		// High DPI scaling
 | 		// High DPI scaling
 | ||||||
| 		hDC = GetDC(hDlg); | 		hDC = GetDC(hDlg); | ||||||
| 		fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f; | 		fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f; | ||||||
|  | @ -913,6 +915,12 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 		CreateStatusBar(); | 		CreateStatusBar(); | ||||||
| 		// Use maximum granularity for the progress bar
 | 		// Use maximum granularity for the progress bar
 | ||||||
| 		SendMessage(hProgress, PBM_SETRANGE, 0, MAX_PROGRESS<<16); | 		SendMessage(hProgress, PBM_SETRANGE, 0, MAX_PROGRESS<<16); | ||||||
|  | 		// Fill up the DOS type dropdown
 | ||||||
|  | 		IGNORE_RETVAL(ComboBox_AddStringU(hDOSType, "FreeDOS")); | ||||||
|  | 		IGNORE_RETVAL(ComboBox_AddStringU(hDOSType, "WinMe")); | ||||||
|  | 		// TODO: enable folder selection
 | ||||||
|  | 		// IGNORE_RETVAL(ComboBox_AddStringU(hDOSType, "Custom"));
 | ||||||
|  | 		IGNORE_RETVAL(ComboBox_SetCurSel(hDOSType, 0)); | ||||||
| 		// Create the string array
 | 		// Create the string array
 | ||||||
| 		StrArrayCreate(&DriveID, MAX_DRIVES); | 		StrArrayCreate(&DriveID, MAX_DRIVES); | ||||||
| 		StrArrayCreate(&DriveLabel, MAX_DRIVES); | 		StrArrayCreate(&DriveLabel, MAX_DRIVES); | ||||||
|  | @ -978,6 +986,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 				if ((fs == FS_FAT16) || (fs == FS_FAT32)) { | 				if ((fs == FS_FAT16) || (fs == FS_FAT32)) { | ||||||
| 					if (!IsWindowEnabled(hDOS)) { | 					if (!IsWindowEnabled(hDOS)) { | ||||||
| 						EnableWindow(hDOS, TRUE); | 						EnableWindow(hDOS, TRUE); | ||||||
|  | 						EnableWindow(hDOSType, TRUE); | ||||||
| 						CheckDlgButton(hDlg, IDC_DOS, uDOSChecked); | 						CheckDlgButton(hDlg, IDC_DOS, uDOSChecked); | ||||||
| 					} | 					} | ||||||
| 				} else { | 				} else { | ||||||
|  | @ -985,6 +994,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 						uDOSChecked = IsDlgButtonChecked(hMainDialog, IDC_DOS); | 						uDOSChecked = IsDlgButtonChecked(hMainDialog, IDC_DOS); | ||||||
| 						CheckDlgButton(hDlg, IDC_DOS, BST_UNCHECKED); | 						CheckDlgButton(hDlg, IDC_DOS, BST_UNCHECKED); | ||||||
| 						EnableWindow(hDOS, FALSE); | 						EnableWindow(hDOS, FALSE); | ||||||
|  | 						EnableWindow(hDOSType, FALSE); | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.h
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.h
									
										
									
									
									
								
							|  | @ -116,6 +116,12 @@ enum { | ||||||
| 	FS_MAX | 	FS_MAX | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | enum dos_type { | ||||||
|  | 	DT_FREEDOS = 0, | ||||||
|  | 	DT_WINME, | ||||||
|  | 	DT_MAX | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| /* Current drive info */ | /* Current drive info */ | ||||||
| typedef struct { | typedef struct { | ||||||
| 	DWORD DeviceNumber; | 	DWORD DeviceNumber; | ||||||
|  | @ -134,7 +140,7 @@ typedef struct { | ||||||
|  */ |  */ | ||||||
| extern HINSTANCE hMainInstance; | extern HINSTANCE hMainInstance; | ||||||
| extern HWND hMainDialog, hStatus, hDeviceList, hCapacity; | extern HWND hMainDialog, hStatus, hDeviceList, hCapacity; | ||||||
| extern HWND hFileSystem, hClusterSize, hLabel;  | extern HWND hFileSystem, hClusterSize, hLabel, hDOSType;  | ||||||
| extern float fScale; | extern float fScale; | ||||||
| extern char szFolderPath[MAX_PATH]; | extern char szFolderPath[MAX_PATH]; | ||||||
| extern DWORD FormatStatus; | extern DWORD FormatStatus; | ||||||
|  | @ -156,7 +162,7 @@ extern HWND CreateTooltip(HWND hControl, const char* message, int duration); | ||||||
| extern void DestroyTooltip(HWND hWnd); | extern void DestroyTooltip(HWND hWnd); | ||||||
| extern void DestroyAllTooltips(void); | extern void DestroyAllTooltips(void); | ||||||
| extern BOOL Notification(int type, char* title, char* format, ...); | extern BOOL Notification(int type, char* title, char* format, ...); | ||||||
| extern BOOL ExtractMSDOS(const char* path); | extern BOOL ExtractDOS(const char* path, int dos_type); | ||||||
| extern void __cdecl FormatThread(void* param); | extern void __cdecl FormatThread(void* param); | ||||||
| extern BOOL CreatePartition(HANDLE hDrive); | extern BOOL CreatePartition(HANDLE hDrive); | ||||||
| extern HANDLE GetDriveHandle(DWORD DriveIndex, char* DriveLetter, BOOL bWriteAccess, BOOL bLockDrive); | extern HANDLE GetDriveHandle(DWORD DriveIndex, char* DriveLetter, BOOL bWriteAccess, BOOL bLockDrive); | ||||||
|  |  | ||||||
							
								
								
									
										23
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										23
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 206, 278 | IDD_DIALOG DIALOGEX 12, 12, 206, 278 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_APPWINDOW | EXSTYLE WS_EX_APPWINDOW | ||||||
| CAPTION "Rufus v1.0.3.95" | CAPTION "Rufus v1.0.3.96" | ||||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     DEFPUSHBUTTON   "Start",IDC_START,94,236,50,14 |     DEFPUSHBUTTON   "Start",IDC_START,94,236,50,14 | ||||||
|  | @ -48,9 +48,10 @@ BEGIN | ||||||
|     EDITTEXT        IDC_LABEL,7,131,190,13,ES_AUTOHSCROLL |     EDITTEXT        IDC_LABEL,7,131,190,13,ES_AUTOHSCROLL | ||||||
|     CONTROL         "Check device for bad blocks",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,171,10 |     CONTROL         "Check device for bad blocks",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,171,10 | ||||||
|     CONTROL         "Quick Format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,173,58,10 |     CONTROL         "Quick Format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,173,58,10 | ||||||
|     CONTROL         "Create a DOS bootable disk",IDC_DOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,185,115,10 |     CONTROL         "Create a DOS bootable disk:",IDC_DOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,185,101,10 | ||||||
|     LTEXT           "New volume label",IDC_STATIC,9,121,105,10 |     LTEXT           "New volume label",IDC_STATIC,9,121,105,10 | ||||||
|     CONTROL         "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,210,189,9 |     CONTROL         "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,210,189,9 | ||||||
|  |     COMBOBOX        IDC_DOSTYPE,116,183,45,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | ||||||
| END | END | ||||||
| 
 | 
 | ||||||
| IDD_ABOUTBOX DIALOGEX 0, 0, 287, 195 | IDD_ABOUTBOX DIALOGEX 0, 0, 287, 195 | ||||||
|  | @ -64,7 +65,7 @@ BEGIN | ||||||
|     DEFPUSHBUTTON   "OK",IDOK,231,175,50,14,WS_GROUP |     DEFPUSHBUTTON   "OK",IDOK,231,175,50,14,WS_GROUP | ||||||
|     CONTROL         "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL, |     CONTROL         "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL, | ||||||
|                     "SysLink",WS_TABSTOP,46,47,114,9 |                     "SysLink",WS_TABSTOP,46,47,114,9 | ||||||
|     LTEXT           "Version 1.0.3 (Build 95)",IDC_STATIC,46,19,78,8 |     LTEXT           "Version 1.0.3 (Build 96)",IDC_STATIC,46,19,78,8 | ||||||
|     PUSHBUTTON      "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP |     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 |     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 |     LTEXT           "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 | ||||||
|  | @ -163,8 +164,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 1,0,3,95 |  FILEVERSION 1,0,3,96 | ||||||
|  PRODUCTVERSION 1,0,3,95 |  PRODUCTVERSION 1,0,3,96 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -181,13 +182,13 @@ BEGIN | ||||||
|         BEGIN |         BEGIN | ||||||
|             VALUE "CompanyName", "akeo.ie" |             VALUE "CompanyName", "akeo.ie" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "1.0.3.95" |             VALUE "FileVersion", "1.0.3.96" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011 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.0.3.95" |             VALUE "ProductVersion", "1.0.3.96" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  | @ -205,6 +206,14 @@ END | ||||||
| // Icon with lowest ID value placed first to ensure application icon | // Icon with lowest ID value placed first to ensure application icon | ||||||
| // remains consistent on all systems. | // remains consistent on all systems. | ||||||
| IDI_ICON                ICON                    "rufus.ico" | IDI_ICON                ICON                    "rufus.ico" | ||||||
|  | 
 | ||||||
|  | ///////////////////////////////////////////////////////////////////////////// | ||||||
|  | // | ||||||
|  | // RCDATA | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | IDR_FD_COMMAND_COM      RCDATA                  "../freedos/COMMAND.COM" | ||||||
|  | IDR_FD_KERNEL_SYS       RCDATA                  "../freedos/KERNEL.SYS" | ||||||
| #endif    // English resources | #endif    // English resources | ||||||
| ///////////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////////// | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue