[misc] refactoring and cleanup - part 2

* add GetResource() function call to handle resource loading and
  revert 98ff7a931a
* add separate BootCheck() call
* better handling of passes tooltip
* remove superfluous backslashes
* fix standalone EFI support
* add GPL v3 license file and update README.txt
This commit is contained in:
Pete Batard 2013-01-25 01:38:10 +00:00
parent bba1772940
commit 647d9f18ad
12 changed files with 860 additions and 233 deletions

View file

@ -779,23 +779,12 @@ out:
*/
BOOL WriteRufusMBR(FILE *fp)
{
HGLOBAL res_handle;
HRSRC res;
DWORD size;
unsigned char aucRef[] = {0x55, 0xAA};
unsigned char* rufus_mbr;
// TODO: Will we need to edit the disk ID according to UI selection in the MBR as well?
res = FindResource(hMainInstance, MAKEINTRESOURCE(IDR_BR_MBR_BIN), RT_RCDATA);
if (res == NULL) {
uprintf("Unable to locate mbr.bin resource: %s\n", WindowsErrorString());
return FALSE;
}
res_handle = LoadResource(NULL, res);
if (res_handle == NULL) {
uprintf("Unable to load mbr.bin resource: %s\n", WindowsErrorString());
return FALSE;
}
rufus_mbr = (unsigned char*)LockResource(res_handle);
rufus_mbr = GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_BR_MBR_BIN), _RT_RCDATA, "mbr.bin", &size, FALSE);
return
write_data(fp, 0x0, rufus_mbr, 0x1b8) &&
@ -1089,9 +1078,9 @@ static BOOL RemountVolume(char drive_letter)
if (DeleteVolumeMountPointA(drive_name)) {
Sleep(200);
if (SetVolumeMountPointA(drive_name, drive_guid)) {
uprintf("Successfully remounted %s on %s\n", drive_guid, drive_name);
uprintf("Successfully remounted %s on %s\n", &drive_guid[4], drive_name);
} else {
uprintf("Failed to remount %s on %s\n", drive_guid, drive_name);
uprintf("Failed to remount %s on %s\n", &drive_guid[4], drive_name);
// This will leave the drive unaccessible and must be flagged as an error
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_REMOUNT_VOLUME);
return FALSE;