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
3929ed55
Commit
3929ed55
authored
Feb 24, 2021
by
longpanda
Browse files
update disk sort compare
parent
fd6580be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c
+22
-3
No files found.
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c
View file @
3929ed55
...
@@ -316,21 +316,40 @@ PHY_DRIVE_INFO * GetPhyDriveInfoById(int Id)
...
@@ -316,21 +316,40 @@ PHY_DRIVE_INFO * GetPhyDriveInfoById(int Id)
int
SortPhysicalDrive
(
PHY_DRIVE_INFO
*
pDriveList
,
DWORD
DriveCount
)
int
SortPhysicalDrive
(
PHY_DRIVE_INFO
*
pDriveList
,
DWORD
DriveCount
)
{
{
DWORD
i
,
j
;
DWORD
i
,
j
;
BOOL
flag
;
PHY_DRIVE_INFO
TmpDriveInfo
;
PHY_DRIVE_INFO
TmpDriveInfo
;
for
(
i
=
0
;
i
<
DriveCount
;
i
++
)
for
(
i
=
0
;
i
<
DriveCount
;
i
++
)
{
{
for
(
j
=
i
+
1
;
j
<
DriveCount
;
j
++
)
for
(
j
=
i
+
1
;
j
<
DriveCount
;
j
++
)
{
{
flag
=
FALSE
;
if
(
pDriveList
[
i
].
BusType
==
BusTypeUsb
&&
pDriveList
[
j
].
BusType
==
BusTypeUsb
)
if
(
pDriveList
[
i
].
BusType
==
BusTypeUsb
&&
pDriveList
[
j
].
BusType
==
BusTypeUsb
)
{
{
if
(
pDriveList
[
i
].
RemovableMedia
==
FALSE
&&
pDriveList
[
j
].
RemovableMedia
==
TRUE
)
if
(
pDriveList
[
i
].
RemovableMedia
==
FALSE
&&
pDriveList
[
j
].
RemovableMedia
==
TRUE
)
{
{
memcpy
(
&
TmpDriveInfo
,
pDriveList
+
i
,
sizeof
(
PHY_DRIVE_INFO
));
flag
=
TRUE
;
memcpy
(
pDriveList
+
i
,
pDriveList
+
j
,
sizeof
(
PHY_DRIVE_INFO
));
}
memcpy
(
pDriveList
+
j
,
&
TmpDriveInfo
,
sizeof
(
PHY_DRIVE_INFO
));
}
else
if
(
pDriveList
[
j
].
BusType
==
BusTypeUsb
)
{
flag
=
TRUE
;
}
else
{
if
(
pDriveList
[
j
].
PhyDrive
<
pDriveList
[
i
].
PhyDrive
)
{
flag
=
TRUE
;
}
}
}
}
if
(
flag
)
{
memcpy
(
&
TmpDriveInfo
,
pDriveList
+
i
,
sizeof
(
PHY_DRIVE_INFO
));
memcpy
(
pDriveList
+
i
,
pDriveList
+
j
,
sizeof
(
PHY_DRIVE_INFO
));
memcpy
(
pDriveList
+
j
,
&
TmpDriveInfo
,
sizeof
(
PHY_DRIVE_INFO
));
}
}
}
}
}
...
...
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