Support drag resize dialog window width.

pull/2526/head
longpanda 8 months ago
parent d0e10f8e48
commit 2fee243a56

@ -40,13 +40,13 @@ ventoy_os_install_dmsetup_by_unsquashfs() {
dmModPath="/usr/lib/modules/$vtKerVer/kernel/drivers/md/dm-mod.$vtKoPo"
echo $dmModPath > $VTOY_PATH/fsextract
vtoy_unsquashfs -d $VTOY_PATH/sqfs -n -q -e $VTOY_PATH/fsextract $VTOY_PATH/fsdisk
vtoy_unsquashfs -d $VTOY_PATH/sqfs -n -q -e $VTOY_PATH/fsextract $VTOY_PATH/fsdisk 2>>$VTLOG
if ! [ -e $VTOY_PATH/sqfs${dmModPath} ]; then
rm -rf $VTOY_PATH/sqfs
dmModPath="/lib/modules/$vtKerVer/kernel/drivers/md/dm-mod.$vtKoPo"
echo $dmModPath > $VTOY_PATH/fsextract
vtoy_unsquashfs -d $VTOY_PATH/sqfs -n -q -e $VTOY_PATH/fsextract $VTOY_PATH/fsdisk
vtoy_unsquashfs -d $VTOY_PATH/sqfs -n -q -e $VTOY_PATH/fsextract $VTOY_PATH/fsdisk 2>>$VTLOG
fi
if [ -e $VTOY_PATH/sqfs${dmModPath} ]; then

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -544,6 +544,199 @@ int GetAllPhysicalDriveInfo(PHY_DRIVE_INFO *pDriveList, DWORD *pDriveCount)
return 0;
}
BOOL VentoyPhydriveMatch(PHY_DRIVE_INFO* pPhyDrive)
{
BOOL bRet = FALSE;
DWORD dwBytes;
HANDLE Handle = INVALID_HANDLE_VALUE;
CHAR PhyDrive[128];
GET_LENGTH_INFORMATION LengthInfo;
STORAGE_PROPERTY_QUERY Query;
STORAGE_DESCRIPTOR_HEADER DevDescHeader;
STORAGE_DEVICE_DESCRIPTOR* pDevDesc = NULL;
STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR diskAlignment;
CHAR VendorId[128] = { 0 };
CHAR ProductId[128] = { 0 };
CHAR ProductRev[128] = { 0 };
CHAR SerialNumber[128] = { 0 };
safe_sprintf(PhyDrive, "\\\\.\\PhysicalDrive%d", pPhyDrive->PhyDrive);
Handle = CreateFileA(PhyDrive, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (Handle == INVALID_HANDLE_VALUE)
{
Log("Create file Handle:%p %s status:%u", Handle, PhyDrive, LASTERR);
return FALSE;
}
bRet = DeviceIoControl(Handle,
IOCTL_DISK_GET_LENGTH_INFO, NULL,
0,
&LengthInfo,
sizeof(LengthInfo),
&dwBytes,
NULL);
if (!bRet)
{
Log("DeviceIoControl IOCTL_DISK_GET_LENGTH_INFO failed error:%u", LASTERR);
return FALSE;
}
if (pPhyDrive->SizeInBytes != (ULONGLONG)LengthInfo.Length.QuadPart)
{
Log("PHYSICALDRIVE%d size not match %llu %llu", pPhyDrive->PhyDrive, (ULONGLONG)LengthInfo.Length.QuadPart,
(ULONGLONG)pPhyDrive->SizeInBytes);
CHECK_CLOSE_HANDLE(Handle);
return FALSE;
}
Query.PropertyId = StorageDeviceProperty;
Query.QueryType = PropertyStandardQuery;
bRet = DeviceIoControl(Handle,
IOCTL_STORAGE_QUERY_PROPERTY,
&Query,
sizeof(Query),
&DevDescHeader,
sizeof(STORAGE_DESCRIPTOR_HEADER),
&dwBytes,
NULL);
if (!bRet)
{
Log("DeviceIoControl1 error:%u dwBytes:%u", LASTERR, dwBytes);
CHECK_CLOSE_HANDLE(Handle);
return FALSE;
}
if (DevDescHeader.Size < sizeof(STORAGE_DEVICE_DESCRIPTOR))
{
Log("Invalid DevDescHeader.Size:%u", DevDescHeader.Size);
CHECK_CLOSE_HANDLE(Handle);
return FALSE;
}
pDevDesc = (STORAGE_DEVICE_DESCRIPTOR*)malloc(DevDescHeader.Size);
if (!pDevDesc)
{
Log("failed to malloc error:%u len:%u", LASTERR, DevDescHeader.Size);
CHECK_CLOSE_HANDLE(Handle);
return FALSE;
}
bRet = DeviceIoControl(Handle,
IOCTL_STORAGE_QUERY_PROPERTY,
&Query,
sizeof(Query),
pDevDesc,
DevDescHeader.Size,
&dwBytes,
NULL);
if (!bRet)
{
Log("DeviceIoControl2 error:%u dwBytes:%u", LASTERR, dwBytes);
free(pDevDesc);
goto out;
}
memset(&Query, 0, sizeof(STORAGE_PROPERTY_QUERY));
Query.PropertyId = StorageAccessAlignmentProperty;
Query.QueryType = PropertyStandardQuery;
memset(&diskAlignment, 0, sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR));
bRet = DeviceIoControl(Handle,
IOCTL_STORAGE_QUERY_PROPERTY,
&Query,
sizeof(STORAGE_PROPERTY_QUERY),
&diskAlignment,
sizeof(STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR),
&dwBytes,
NULL);
if (!bRet)
{
Log("DeviceIoControl3 error:%u dwBytes:%u", LASTERR, dwBytes);
}
if (pPhyDrive->DeviceType != pDevDesc->DeviceType ||
pPhyDrive->RemovableMedia != pDevDesc->RemovableMedia ||
pPhyDrive->BusType != pDevDesc->BusType ||
pPhyDrive->BytesPerLogicalSector != diskAlignment.BytesPerLogicalSector ||
pPhyDrive->BytesPerPhysicalSector != diskAlignment.BytesPerPhysicalSector
)
{
Log("Some properties not match DeviceType[%u %u] Removable[%u %u] BusType[%u %u] LogSec[%u %u] PhySec[%u %u]",
pPhyDrive->DeviceType, pDevDesc->DeviceType,
pPhyDrive->RemovableMedia, pDevDesc->RemovableMedia,
pPhyDrive->BusType, pDevDesc->BusType,
pPhyDrive->BytesPerLogicalSector, diskAlignment.BytesPerLogicalSector,
pPhyDrive->BytesPerPhysicalSector, diskAlignment.BytesPerPhysicalSector
);
goto out;
}
if (pDevDesc->VendorIdOffset)
{
safe_strcpy(VendorId, (char*)pDevDesc + pDevDesc->VendorIdOffset);
TrimString(VendorId);
if (strcmp(pPhyDrive->VendorId, VendorId))
{
Log("VendorId not match <%s %s>", pPhyDrive->VendorId, VendorId);
goto out;
}
}
if (pDevDesc->ProductIdOffset)
{
safe_strcpy(ProductId, (char*)pDevDesc + pDevDesc->ProductIdOffset);
TrimString(ProductId);
if (strcmp(pPhyDrive->ProductId, ProductId))
{
Log("ProductId not match <%s %s>", pPhyDrive->ProductId, ProductId);
goto out;
}
}
if (pDevDesc->ProductRevisionOffset)
{
safe_strcpy(ProductRev, (char*)pDevDesc + pDevDesc->ProductRevisionOffset);
TrimString(ProductRev);
if (strcmp(pPhyDrive->ProductRev, ProductRev))
{
Log("ProductRev not match <%s %s>", pPhyDrive->ProductRev, ProductRev);
goto out;
}
}
if (pDevDesc->SerialNumberOffset)
{
safe_strcpy(SerialNumber, (char*)pDevDesc + pDevDesc->SerialNumberOffset);
TrimString(SerialNumber);
if (strcmp(pPhyDrive->SerialNumber, SerialNumber))
{
Log("ProductRev not match <%s %s>", pPhyDrive->SerialNumber, SerialNumber);
goto out;
}
}
Log("PhyDrive%d ALL match, now continue", pPhyDrive->PhyDrive);
bRet = TRUE;
out:
if (pDevDesc)
{
free(pDevDesc);
}
CHECK_CLOSE_HANDLE(Handle);
return bRet;
}
static HANDLE g_FatPhyDrive;
static UINT64 g_Part2StartSec;

@ -253,6 +253,7 @@ int VentoyFillGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo);
BOOL IsVentoyLogicalDrive(CHAR DriveLetter);
int GetRegDwordValue(HKEY Key, LPCSTR SubKey, LPCSTR ValueName, DWORD *pValue);
int GetPhysicalDriveCount(void);
BOOL VentoyPhydriveMatch(PHY_DRIVE_INFO* pPhyDrive);
int GetAllPhysicalDriveInfo(PHY_DRIVE_INFO *pDriveList, DWORD *pDriveCount);
int GetPhyDriveByLogicalDrive(int DriveLetter, UINT64*Offset);
int GetVentoyVerInPhyDrive(const PHY_DRIVE_INFO *pDriveInfo, UINT64 Part2StartSector, CHAR *VerBuf, size_t BufLen, BOOL *pSecureBoot);
@ -388,4 +389,11 @@ PHY_DRIVE_INFO* CLI_PhyDrvInfo(void);
#define VTSI_SUPPORT 1
#define WM_OFFSET (WM_USER + 40)
#define WM_WIDTH_CHANGE (WM_OFFSET + 1)
int ExpandDlg(HWND hParent, UINT uiID, int WidthDelta);
int MoveDlg(HWND hParent, UINT uiID, int WidthDelta);
#endif

Loading…
Cancel
Save