Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
b976923f
Commit
b976923f
authored
Jun 19, 2022
by
longpanda
Browse files
1.0.77 release
parent
8db8e07b
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
644 additions
and
131 deletions
+644
-131
VtoyTool/vtoytool/00/vtoytool_m64e
VtoyTool/vtoytool/00/vtoytool_m64e
+0
-0
vtoyjump/vtoyjump/vtoyjump.c
vtoyjump/vtoyjump/vtoyjump.c
+500
-5
vtoyjump/vtoyjump/vtoyjump.h
vtoyjump/vtoyjump/vtoyjump.h
+144
-126
No files found.
VtoyTool/vtoytool/00/vtoytool_m64e
View file @
b976923f
No preview for this file type
vtoyjump/vtoyjump/vtoyjump.c
View file @
b976923f
...
@@ -36,6 +36,8 @@ static ventoy_guid g_ventoy_guid = VENTOY_GUID;
...
@@ -36,6 +36,8 @@ static ventoy_guid g_ventoy_guid = VENTOY_GUID;
static
HANDLE
g_vtoylog_mutex
=
NULL
;
static
HANDLE
g_vtoylog_mutex
=
NULL
;
static
HANDLE
g_vtoyins_mutex
=
NULL
;
static
HANDLE
g_vtoyins_mutex
=
NULL
;
static
DWORD
g_vtoy_disk_drive
;
static
CHAR
g_prog_full_path
[
MAX_PATH
];
static
CHAR
g_prog_full_path
[
MAX_PATH
];
static
CHAR
g_prog_dir
[
MAX_PATH
];
static
CHAR
g_prog_dir
[
MAX_PATH
];
static
CHAR
g_prog_name
[
MAX_PATH
];
static
CHAR
g_prog_name
[
MAX_PATH
];
...
@@ -760,7 +762,7 @@ static int VentoyFatDiskRead(uint32 Sector, uint8 *Buffer, uint32 SectorCount)
...
@@ -760,7 +762,7 @@ static int VentoyFatDiskRead(uint32 Sector, uint8 *Buffer, uint32 SectorCount)
bRet
=
ReadFile
(
g_FatPhyDrive
,
Buffer
,
ReadSize
,
&
dwSize
,
NULL
);
bRet
=
ReadFile
(
g_FatPhyDrive
,
Buffer
,
ReadSize
,
&
dwSize
,
NULL
);
if
(
bRet
==
FALSE
||
dwSize
!=
ReadSize
)
if
(
bRet
==
FALSE
||
dwSize
!=
ReadSize
)
{
{
Log
(
"ReadFile error bRet:%u WriteSize:%u dwSize:%u ErrCode:%u
\n
"
,
bRet
,
ReadSize
,
dwSize
,
GetLastError
());
Log
(
"ReadFile error bRet:%u WriteSize:%u dwSize:%u ErrCode:%u"
,
bRet
,
ReadSize
,
dwSize
,
GetLastError
());
}
}
return
1
;
return
1
;
...
@@ -1291,12 +1293,485 @@ End:
...
@@ -1291,12 +1293,485 @@ End:
return
rc
;
return
rc
;
}
}
static
int
UnattendNeedVarExpand
(
const
char
*
script
)
{
FILE
*
fp
=
NULL
;
char
szLine
[
4096
];
fopen_s
(
&
fp
,
script
,
"r"
);
if
(
!
fp
)
{
return
0
;
}
szLine
[
0
]
=
szLine
[
4095
]
=
0
;
while
(
fgets
(
szLine
,
sizeof
(
szLine
)
-
1
,
fp
))
{
if
(
strstr
(
szLine
,
"$$VT_"
))
{
fclose
(
fp
);
return
1
;
}
szLine
[
0
]
=
szLine
[
4095
]
=
0
;
}
fclose
(
fp
);
return
0
;
}
static
int
ExpandSingleVar
(
VarDiskInfo
*
pDiskInfo
,
int
DiskNum
,
const
char
*
var
,
char
*
value
,
int
len
)
{
int
i
;
int
index
=
-
1
;
UINT64
uiDst
=
0
;
UINT64
uiDelta
=
0
;
UINT64
uiMaxSize
=
0
;
UINT64
uiMaxDelta
=
ULLONG_MAX
;
value
[
0
]
=
0
;
if
(
strcmp
(
var
,
"VT_WINDOWS_DISK_1ST_NONVTOY"
)
==
0
)
{
for
(
i
=
0
;
i
<
DiskNum
;
i
++
)
{
if
(
pDiskInfo
[
i
].
Capacity
>
0
&&
i
!=
g_vtoy_disk_drive
)
{
Log
(
"%s=<PhyDrive%d>"
,
var
,
i
);
sprintf_s
(
value
,
len
,
"%d"
,
i
);
return
0
;
}
}
}
else
if
(
strcmp
(
var
,
"VT_WINDOWS_DISK_1ST_NONUSB"
)
==
0
)
{
for
(
i
=
0
;
i
<
DiskNum
;
i
++
)
{
if
(
pDiskInfo
[
i
].
Capacity
>
0
&&
pDiskInfo
[
i
].
BusType
!=
BusTypeUsb
)
{
Log
(
"%s=<PhyDrive%d>"
,
var
,
i
);
sprintf_s
(
value
,
len
,
"%d"
,
i
);
return
0
;
}
}
}
else
if
(
strcmp
(
var
,
"VT_WINDOWS_DISK_MAX_SIZE"
)
==
0
)
{
for
(
i
=
0
;
i
<
DiskNum
;
i
++
)
{
if
(
pDiskInfo
[
i
].
Capacity
>
0
&&
pDiskInfo
[
i
].
Capacity
>
uiMaxSize
)
{
index
=
i
;
uiMaxSize
=
pDiskInfo
[
i
].
Capacity
;
}
}
Log
(
"%s=<PhyDrive%d>"
,
var
,
index
);
sprintf_s
(
value
,
len
,
"%d"
,
index
);
}
else
if
(
strncmp
(
var
,
"VT_WINDOWS_DISK_CLOSEST_"
,
24
)
==
0
)
{
uiDst
=
strtoul
(
var
+
24
,
NULL
,
10
);
uiDst
=
uiDst
*
(
1024ULL
*
1024ULL
*
1024ULL
);
for
(
i
=
0
;
i
<
DiskNum
;
i
++
)
{
if
(
pDiskInfo
[
i
].
Capacity
==
0
)
{
continue
;
}
if
(
pDiskInfo
[
i
].
Capacity
>
uiDst
)
{
uiDelta
=
pDiskInfo
[
i
].
Capacity
-
uiDst
;
}
else
{
uiDelta
=
uiDst
-
pDiskInfo
[
i
].
Capacity
;
}
if
(
uiDelta
<
uiMaxDelta
)
{
uiMaxDelta
=
uiDelta
;
index
=
i
;
}
}
Log
(
"%s=<PhyDrive%d>"
,
var
,
index
);
sprintf_s
(
value
,
len
,
"%d"
,
index
);
}
else
{
Log
(
"Invalid var name <%s>"
,
var
);
sprintf_s
(
value
,
len
,
"$$%s$$"
,
var
);
}
if
(
value
[
0
]
==
0
)
{
sprintf_s
(
value
,
len
,
"$$%s$$"
,
var
);
}
return
0
;
}
static
void
TrimString
(
CHAR
*
String
)
{
CHAR
*
Pos1
=
String
;
CHAR
*
Pos2
=
String
;
size_t
Len
=
strlen
(
String
);
while
(
Len
>
0
)
{
if
(
String
[
Len
-
1
]
!=
' '
&&
String
[
Len
-
1
]
!=
'\t'
)
{
break
;
}
String
[
Len
-
1
]
=
0
;
Len
--
;
}
while
(
*
Pos1
==
' '
||
*
Pos1
==
'\t'
)
{
Pos1
++
;
}
while
(
*
Pos1
)
{
*
Pos2
++
=
*
Pos1
++
;
}
*
Pos2
++
=
0
;
return
;
}
static
int
GetRegDwordValue
(
HKEY
Key
,
LPCSTR
SubKey
,
LPCSTR
ValueName
,
DWORD
*
pValue
)
{
HKEY
hKey
;
DWORD
Type
;
DWORD
Size
;
LSTATUS
lRet
;
DWORD
Value
;
lRet
=
RegOpenKeyExA
(
Key
,
SubKey
,
0
,
KEY_QUERY_VALUE
,
&
hKey
);
Log
(
"RegOpenKeyExA <%s> Ret:%ld"
,
SubKey
,
lRet
);
if
(
ERROR_SUCCESS
==
lRet
)
{
Size
=
sizeof
(
Value
);
lRet
=
RegQueryValueExA
(
hKey
,
ValueName
,
NULL
,
&
Type
,
(
LPBYTE
)
&
Value
,
&
Size
);
Log
(
"RegQueryValueExA <%s> ret:%u Size:%u Value:%u"
,
ValueName
,
lRet
,
Size
,
Value
);
*
pValue
=
Value
;
RegCloseKey
(
hKey
);
return
0
;
}
else
{
return
1
;
}
}
static
const
CHAR
*
GetBusTypeString
(
int
Type
)
{
switch
(
Type
)
{
case
BusTypeUnknown
:
return
"unknown"
;
case
BusTypeScsi
:
return
"SCSI"
;
case
BusTypeAtapi
:
return
"Atapi"
;
case
BusTypeAta
:
return
"ATA"
;
case
BusType1394
:
return
"1394"
;
case
BusTypeSsa
:
return
"SSA"
;
case
BusTypeFibre
:
return
"Fibre"
;
case
BusTypeUsb
:
return
"USB"
;
case
BusTypeRAID
:
return
"RAID"
;
case
BusTypeiScsi
:
return
"iSCSI"
;
case
BusTypeSas
:
return
"SAS"
;
case
BusTypeSata
:
return
"SATA"
;
case
BusTypeSd
:
return
"SD"
;
case
BusTypeMmc
:
return
"MMC"
;
case
BusTypeVirtual
:
return
"Virtual"
;
case
BusTypeFileBackedVirtual
:
return
"FileBackedVirtual"
;
case
BusTypeSpaces
:
return
"Spaces"
;
case
BusTypeNvme
:
return
"Nvme"
;
}
return
"unknown"
;
}
static
int
GetHumanReadableGBSize
(
UINT64
SizeBytes
)
{
int
i
;
int
Pow2
=
1
;
double
Delta
;
double
GB
=
SizeBytes
*
1
.
0
/
1000
/
1000
/
1000
;
if
((
SizeBytes
%
1073741824
)
==
0
)
{
return
(
int
)(
SizeBytes
/
1073741824
);
}
for
(
i
=
0
;
i
<
12
;
i
++
)
{
if
(
Pow2
>
GB
)
{
Delta
=
(
Pow2
-
GB
)
/
Pow2
;
}
else
{
Delta
=
(
GB
-
Pow2
)
/
Pow2
;
}
if
(
Delta
<
0
.
05
)
{
return
Pow2
;
}
Pow2
<<=
1
;
}
return
(
int
)
GB
;
}
static
int
EnumerateAllDisk
(
VarDiskInfo
**
ppDiskInfo
,
int
*
pDiskNum
)
{
int
i
;
DWORD
Value
;
int
DiskNum
=
0
;
BOOL
bRet
;
DWORD
dwBytes
;
VarDiskInfo
*
pDiskInfo
=
NULL
;
HANDLE
Handle
=
INVALID_HANDLE_VALUE
;
CHAR
PhyDrive
[
128
];
GET_LENGTH_INFORMATION
LengthInfo
;
STORAGE_PROPERTY_QUERY
Query
;
STORAGE_DESCRIPTOR_HEADER
DevDescHeader
;
STORAGE_DEVICE_DESCRIPTOR
*
pDevDesc
;
if
(
GetRegDwordValue
(
HKEY_LOCAL_MACHINE
,
"SYSTEM
\\
CurrentControlSet
\\
Services
\\
disk
\\
Enum"
,
"Count"
,
&
Value
)
==
0
)
{
DiskNum
=
(
int
)
Value
;
}
else
{
Log
(
"Failed to read disk count"
);
return
1
;
}
Log
(
"Current phy disk count:%d"
,
DiskNum
);
if
(
DiskNum
<=
0
)
{
return
1
;
}
pDiskInfo
=
malloc
(
DiskNum
*
sizeof
(
VarDiskInfo
));
if
(
!
pDiskInfo
)
{
Log
(
"Failed to alloc"
);
return
1
;
}
memset
(
pDiskInfo
,
0
,
DiskNum
*
sizeof
(
VarDiskInfo
));
for
(
i
=
0
;
i
<
DiskNum
;
i
++
)
{
SAFE_CLOSE_HANDLE
(
Handle
);
safe_sprintf
(
PhyDrive
,
"
\\\\
.
\\
PhysicalDrive%d"
,
i
);
Handle
=
CreateFileA
(
PhyDrive
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
Log
(
"Create file Handle:%p %s status:%u"
,
Handle
,
PhyDrive
,
LASTERR
);
if
(
Handle
==
INVALID_HANDLE_VALUE
)
{
continue
;
}
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
);
continue
;
}
Log
(
"PHYSICALDRIVE%d size %llu bytes"
,
i
,
(
ULONGLONG
)
LengthInfo
.
Length
.
QuadPart
);
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
);
continue
;
}
if
(
DevDescHeader
.
Size
<
sizeof
(
STORAGE_DEVICE_DESCRIPTOR
))
{
Log
(
"Invalid DevDescHeader.Size:%u"
,
DevDescHeader
.
Size
);
continue
;
}
pDevDesc
=
(
STORAGE_DEVICE_DESCRIPTOR
*
)
malloc
(
DevDescHeader
.
Size
);
if
(
!
pDevDesc
)
{
Log
(
"failed to malloc error:%u len:%u"
,
LASTERR
,
DevDescHeader
.
Size
);
continue
;
}
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
);
continue
;
}
pDiskInfo
[
i
].
RemovableMedia
=
pDevDesc
->
RemovableMedia
;
pDiskInfo
[
i
].
BusType
=
pDevDesc
->
BusType
;
pDiskInfo
[
i
].
DeviceType
=
pDevDesc
->
DeviceType
;
pDiskInfo
[
i
].
Capacity
=
LengthInfo
.
Length
.
QuadPart
;
if
(
pDevDesc
->
VendorIdOffset
)
{
safe_strcpy
(
pDiskInfo
[
i
].
VendorId
,
(
char
*
)
pDevDesc
+
pDevDesc
->
VendorIdOffset
);
TrimString
(
pDiskInfo
[
i
].
VendorId
);
}
if
(
pDevDesc
->
ProductIdOffset
)
{
safe_strcpy
(
pDiskInfo
[
i
].
ProductId
,
(
char
*
)
pDevDesc
+
pDevDesc
->
ProductIdOffset
);
TrimString
(
pDiskInfo
[
i
].
ProductId
);
}
if
(
pDevDesc
->
ProductRevisionOffset
)
{
safe_strcpy
(
pDiskInfo
[
i
].
ProductRev
,
(
char
*
)
pDevDesc
+
pDevDesc
->
ProductRevisionOffset
);
TrimString
(
pDiskInfo
[
i
].
ProductRev
);
}
if
(
pDevDesc
->
SerialNumberOffset
)
{
safe_strcpy
(
pDiskInfo
[
i
].
SerialNumber
,
(
char
*
)
pDevDesc
+
pDevDesc
->
SerialNumberOffset
);
TrimString
(
pDiskInfo
[
i
].
SerialNumber
);
}
free
(
pDevDesc
);
SAFE_CLOSE_HANDLE
(
Handle
);
}
Log
(
"########## DUMP DISK BEGIN ##########"
);
for
(
i
=
0
;
i
<
DiskNum
;
i
++
)
{
Log
(
"PhyDrv:%d BusType:%-4s Removable:%u Size:%dGB(%llu) Name:%s %s"
,
i
,
GetBusTypeString
(
pDiskInfo
[
i
].
BusType
),
pDiskInfo
[
i
].
RemovableMedia
,
GetHumanReadableGBSize
(
pDiskInfo
[
i
].
Capacity
),
pDiskInfo
[
i
].
Capacity
,
pDiskInfo
[
i
].
VendorId
,
pDiskInfo
[
i
].
ProductId
);
}
Log
(
"Ventoy disk is PhyDvr%d"
,
g_vtoy_disk_drive
);
Log
(
"########## DUMP DISK END ##########"
);
*
ppDiskInfo
=
pDiskInfo
;
*
pDiskNum
=
DiskNum
;
return
0
;
}
static
int
UnattendVarExpand
(
const
char
*
script
,
const
char
*
tmpfile
)
{
FILE
*
fp
=
NULL
;
FILE
*
fout
=
NULL
;
char
*
start
=
NULL
;
char
*
end
=
NULL
;
char
szLine
[
4096
];
char
szValue
[
256
];
int
DiskNum
=
0
;
VarDiskInfo
*
pDiskInfo
=
NULL
;
Log
(
"UnattendVarExpand ..."
);
if
(
EnumerateAllDisk
(
&
pDiskInfo
,
&
DiskNum
))
{
Log
(
"Failed to EnumerateAllDisk"
);
return
1
;
}
fopen_s
(
&
fp
,
script
,
"r"
);
if
(
!
fp
)
{
free
(
pDiskInfo
);
return
0
;
}
fopen_s
(
&
fout
,
tmpfile
,
"w+"
);
if
(
!
fout
)
{
fclose
(
fp
);
free
(
pDiskInfo
);
return
0
;
}
szLine
[
0
]
=
szLine
[
4095
]
=
0
;
while
(
fgets
(
szLine
,
sizeof
(
szLine
)
-
1
,
fp
))
{
start
=
strstr
(
szLine
,
"$$VT_"
);
if
(
start
)
{
end
=
strstr
(
start
+
5
,
"$$"
);
}
if
(
start
&&
end
)
{
*
start
=
0
;
fprintf
(
fout
,
"%s"
,
szLine
);
*
end
=
0
;
ExpandSingleVar
(
pDiskInfo
,
DiskNum
,
start
+
2
,
szValue
,
sizeof
(
szValue
)
-
1
);
fprintf
(
fout
,
"%s"
,
szValue
);
fprintf
(
fout
,
"%s"
,
end
+
2
);
}
else
{
fprintf
(
fout
,
"%s"
,
szLine
);
}
szLine
[
0
]
=
szLine
[
4095
]
=
0
;
}
fclose
(
fp
);
fclose
(
fout
);
free
(
pDiskInfo
);
return
0
;
}
//#define VAR_DEBUG 1
static
int
ProcessUnattendedInstallation
(
const
char
*
script
)
static
int
ProcessUnattendedInstallation
(
const
char
*
script
)
{
{
DWORD
dw
;
DWORD
dw
;
HKEY
hKey
;
HKEY
hKey
;
LSTATUS
Ret
;
LSTATUS
Ret
;
CHAR
Letter
;
CHAR
Letter
;
CHAR
TmpFile
[
MAX_PATH
];
CHAR
CurDir
[
MAX_PATH
];
CHAR
CurDir
[
MAX_PATH
];
Log
(
"Copy unattended XML ..."
);
Log
(
"Copy unattended XML ..."
);
...
@@ -1312,15 +1787,33 @@ static int ProcessUnattendedInstallation(const char *script)
...
@@ -1312,15 +1787,33 @@ static int ProcessUnattendedInstallation(const char *script)
Letter
=
'X'
;
Letter
=
'X'
;
}
}
#ifdef VAR_DEBUG
sprintf_s
(
CurDir
,
sizeof
(
CurDir
),
"%C:
\\
AutounattendXXX.xml"
,
Letter
);
#else
sprintf_s
(
CurDir
,
sizeof
(
CurDir
),
"%C:
\\
Autounattend.xml"
,
Letter
);
sprintf_s
(
CurDir
,
sizeof
(
CurDir
),
"%C:
\\
Autounattend.xml"
,
Letter
);
Log
(
"Copy file <%s> --> <%s>"
,
script
,
CurDir
);
#endif
if
(
UnattendNeedVarExpand
(
script
))
{
sprintf_s
(
TmpFile
,
sizeof
(
TmpFile
),
"%C:
\\
__Autounattend"
,
Letter
);
UnattendVarExpand
(
script
,
TmpFile
);
Log
(
"Expand Copy file <%s> --> <%s>"
,
script
,
CurDir
);
CopyFile
(
TmpFile
,
CurDir
,
FALSE
);
}
else
{
Log
(
"No var expand copy file <%s> --> <%s>"
,
script
,
CurDir
);
CopyFile
(
script
,
CurDir
,
FALSE
);
CopyFile
(
script
,
CurDir
,
FALSE
);
}
#ifndef VAR_DEBUG
Ret
=
RegCreateKeyEx
(
HKEY_LOCAL_MACHINE
,
"System
\\
Setup"
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_ALL_ACCESS
,
NULL
,
&
hKey
,
&
dw
);
Ret
=
RegCreateKeyEx
(
HKEY_LOCAL_MACHINE
,
"System
\\
Setup"
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_ALL_ACCESS
,
NULL
,
&
hKey
,
&
dw
);
if
(
ERROR_SUCCESS
==
Ret
)
if
(
ERROR_SUCCESS
==
Ret
)
{
{
Ret
=
RegSetValueEx
(
hKey
,
"UnattendFile"
,
0
,
REG_SZ
,
CurDir
,
(
DWORD
)(
strlen
(
CurDir
)
+
1
));
Ret
=
RegSetValueEx
(
hKey
,
"UnattendFile"
,
0
,
REG_SZ
,
CurDir
,
(
DWORD
)(
strlen
(
CurDir
)
+
1
));
}
}
#endif
return
0
;
return
0
;
}
}
...
@@ -1493,7 +1986,7 @@ static int VentoyHook(ventoy_os_param *param)
...
@@ -1493,7 +1986,7 @@ static int VentoyHook(ventoy_os_param *param)
if
(
IsUTF8Encode
(
param
->
vtoy_img_path
))
if
(
IsUTF8Encode
(
param
->
vtoy_img_path
))
{
{
Log
(
"This file is UTF8 encoding
\n
"
);
Log
(
"This file is UTF8 encoding"
);
}
}
for
(
i
=
0
;
i
<
5
;
i
++
)
for
(
i
=
0
;
i
<
5
;
i
++
)
...
@@ -1622,6 +2115,8 @@ static int VentoyHook(ventoy_os_param *param)
...
@@ -1622,6 +2115,8 @@ static int VentoyHook(ventoy_os_param *param)
return
1
;
return
1
;
}
}
g_vtoy_disk_drive
=
VtoyDiskNum
;
Drives
=
GetLogicalDrives
();
Drives
=
GetLogicalDrives
();
Log
(
"Drives before mount: 0x%x"
,
Drives
);
Log
(
"Drives before mount: 0x%x"
,
Drives
);
...
...
vtoyjump/vtoyjump/vtoyjump.h
View file @
b976923f
...
@@ -152,6 +152,20 @@ typedef struct VTOY_GPT_INFO
...
@@ -152,6 +152,20 @@ typedef struct VTOY_GPT_INFO
#pragma pack()
#pragma pack()
typedef
struct
VarDiskInfo
{
UINT64
Capacity
;
int
BusType
;
BOOL
RemovableMedia
;
BYTE
DeviceType
;
CHAR
VendorId
[
128
];
CHAR
ProductId
[
128
];
CHAR
ProductRev
[
128
];
CHAR
SerialNumber
[
128
];
}
VarDiskInfo
;
#define SAFE_CLOSE_HANDLE(handle) \
#define SAFE_CLOSE_HANDLE(handle) \
{
\
{
\
if
(
handle
!=
INVALID_HANDLE_VALUE
)
\
if
(
handle
!=
INVALID_HANDLE_VALUE
)
\
...
@@ -161,6 +175,10 @@ typedef struct VTOY_GPT_INFO
...
@@ -161,6 +175,10 @@ typedef struct VTOY_GPT_INFO
}
\
}
\
}
}
#define safe_sprintf(dst, fmt, ...) sprintf_s(dst, sizeof(dst), fmt, __VA_ARGS__)
#define safe_strcpy(dst, src) strcpy_s(dst, sizeof(dst), src)
#define LASTERR GetLastError()
#define LASTERR GetLastError()
int
unxz
(
unsigned
char
*
in
,
int
in_size
,
int
unxz
(
unsigned
char
*
in
,
int
in_size
,
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment