Commit a1c6fe2d authored by longpanda's avatar longpanda
Browse files

1.0.67 release

support to browse and boot files in local disk.
parent dbeb4023
menuentry Reboot --class=power_reboot { submenu "Power" --class=debug_power --class=F5tool {
menuentry Reboot --class=debug_reboot --class=debug_power --class=F5tool {
echo -e '\n\nSystem is rebooting ... \n' echo -e '\n\nSystem is rebooting ... \n'
sleep 1 sleep 1
reboot reboot
} }
menuentry Halt --class=power_halt { menuentry Halt --class=debug_halt --class=debug_power --class=F5tool {
echo -e '\n\nSystem is halting ... \n' echo -e '\n\nSystem is halting ... \n'
sleep 1 sleep 1
halt halt
} }
menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET { menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
echo 'Return ...' echo 'Return ...'
}
} }
...@@ -485,9 +485,7 @@ void ventoy_data_default_control(data_control *data) ...@@ -485,9 +485,7 @@ void ventoy_data_default_control(data_control *data)
{ {
memset(data, 0, sizeof(data_control)); memset(data, 0, sizeof(data_control));
data->default_menu_mode = 1;
data->filter_dot_underscore = 1; data->filter_dot_underscore = 1;
data->treeview_style = 1;
data->max_search_level = -1; data->max_search_level = -1;
data->menu_timeout = 0; data->menu_timeout = 0;
......
...@@ -1418,6 +1418,40 @@ End: ...@@ -1418,6 +1418,40 @@ End:
return Ret; return Ret;
} }
static BOOL CheckVentoyDisk(DWORD DiskNum)
{
DWORD dwSize = 0;
CHAR PhyPath[128];
UINT8 SectorBuf[512];
HANDLE Handle;
UINT8 check[8] = { 0x56, 0x54, 0x00, 0x47, 0x65, 0x00, 0x48, 0x44 };
sprintf_s(PhyPath, sizeof(PhyPath), "\\\\.\\PhysicalDrive%d", DiskNum);
Handle = CreateFileA(PhyPath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
if (Handle == INVALID_HANDLE_VALUE)
{
Log("Could not open the disk<%s>, error:%u", PhyPath, GetLastError());
return FALSE;
}
if (!ReadFile(Handle, SectorBuf, sizeof(SectorBuf), &dwSize, NULL))
{
Log("ReadFile failed, dwSize:%u error:%u", dwSize, GetLastError());
CloseHandle(Handle);
return FALSE;
}
CloseHandle(Handle);
if (memcmp(SectorBuf + 0x190, check, 8) == 0)
{
return TRUE;
}
return FALSE;
}
static int VentoyHook(ventoy_os_param *param) static int VentoyHook(ventoy_os_param *param)
{ {
int i; int i;
...@@ -1429,6 +1463,7 @@ static int VentoyHook(ventoy_os_param *param) ...@@ -1429,6 +1463,7 @@ static int VentoyHook(ventoy_os_param *param)
CHAR VtoyLetter; CHAR VtoyLetter;
DWORD Drives; DWORD Drives;
DWORD NewDrives; DWORD NewDrives;
DWORD VtoyDiskNum;
UINT32 DiskSig; UINT32 DiskSig;
UINT32 VtoySig; UINT32 VtoySig;
DISK_EXTENT DiskExtent; DISK_EXTENT DiskExtent;
...@@ -1457,6 +1492,8 @@ static int VentoyHook(ventoy_os_param *param) ...@@ -1457,6 +1492,8 @@ static int VentoyHook(ventoy_os_param *param)
if (IsFileExist("%s", IsoPath)) if (IsFileExist("%s", IsoPath))
{ {
Log("File exist under %C:", Letter); Log("File exist under %C:", Letter);
memset(UUID, 0, sizeof(UUID));
memset(&DiskExtent, 0, sizeof(DiskExtent));
if (GetPhyDiskUUID(Letter, UUID, NULL, &DiskExtent) == 0) if (GetPhyDiskUUID(Letter, UUID, NULL, &DiskExtent) == 0)
{ {
if (memcmp(UUID, param->vtoy_disk_guid, 16) == 0) if (memcmp(UUID, param->vtoy_disk_guid, 16) == 0)
...@@ -1510,6 +1547,9 @@ static int VentoyHook(ventoy_os_param *param) ...@@ -1510,6 +1547,9 @@ static int VentoyHook(ventoy_os_param *param)
{ {
if (Drives & 0x01) if (Drives & 0x01)
{ {
memset(UUID, 0, sizeof(UUID));
memset(&VtoyDiskExtent, 0, sizeof(VtoyDiskExtent));
DiskSig = 0;
if (GetPhyDiskUUID(VtoyLetter, UUID, &DiskSig, &VtoyDiskExtent) == 0) if (GetPhyDiskUUID(VtoyLetter, UUID, &DiskSig, &VtoyDiskExtent) == 0)
{ {
Log("DiskSig=%08X PartStart=%lld", DiskSig, VtoyDiskExtent.StartingOffset.QuadPart); Log("DiskSig=%08X PartStart=%lld", DiskSig, VtoyDiskExtent.StartingOffset.QuadPart);
...@@ -1543,11 +1583,25 @@ static int VentoyHook(ventoy_os_param *param) ...@@ -1543,11 +1583,25 @@ static int VentoyHook(ventoy_os_param *param)
Log("Failed to find ventoy disk"); Log("Failed to find ventoy disk");
return 1; return 1;
} }
VtoyDiskNum = VtoyDiskExtent.DiskNumber;
} }
else else
{ {
VtoyLetter = Letter; VtoyLetter = Letter;
Log("No vlnk mode %C", Letter); Log("No vlnk mode %C", Letter);
VtoyDiskNum = DiskExtent.DiskNumber;
}
if (CheckVentoyDisk(VtoyDiskNum))
{
Log("Disk check OK %C: %u", VtoyLetter, VtoyDiskNum);
}
else
{
Log("Failed to check ventoy disk %u", VtoyDiskNum);
return 1;
} }
Drives = GetLogicalDrives(); Drives = GetLogicalDrives();
...@@ -1588,7 +1642,7 @@ static int VentoyHook(ventoy_os_param *param) ...@@ -1588,7 +1642,7 @@ static int VentoyHook(ventoy_os_param *param)
} }
// for protect // for protect
rc = DeleteVentoyPart2MountPoint(VtoyDiskExtent.DiskNumber); rc = DeleteVentoyPart2MountPoint(VtoyDiskNum);
Log("Delete ventoy mountpoint: %s", rc == 0 ? "SUCCESS" : "NO NEED"); Log("Delete ventoy mountpoint: %s", rc == 0 ? "SUCCESS" : "NO NEED");
if (g_windows_data.auto_install_script[0]) if (g_windows_data.auto_install_script[0])
...@@ -1615,7 +1669,7 @@ static int VentoyHook(ventoy_os_param *param) ...@@ -1615,7 +1669,7 @@ static int VentoyHook(ventoy_os_param *param)
if (IsFileExist("%s", IsoPath)) if (IsFileExist("%s", IsoPath))
{ {
Log("decompress injection archive %s...", IsoPath); Log("decompress injection archive %s...", IsoPath);
DecompressInjectionArchive(IsoPath, VtoyDiskExtent.DiskNumber); DecompressInjectionArchive(IsoPath, VtoyDiskNum);
if (IsFileExist("%s", AUTO_RUN_BAT)) if (IsFileExist("%s", AUTO_RUN_BAT))
{ {
......
...@@ -62,7 +62,9 @@ typedef struct ventoy_os_param ...@@ -62,7 +62,9 @@ typedef struct ventoy_os_param
UINT64 vtoy_reserved[4]; // Internal use by ventoy UINT64 vtoy_reserved[4]; // Internal use by ventoy
UINT8 reserved[31]; UINT8 vtoy_disk_signature[4];
UINT8 reserved[27];
}ventoy_os_param; }ventoy_os_param;
typedef struct ventoy_windows_data typedef struct ventoy_windows_data
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment