1 /******************************************************************************
4 * Copyright (c) 2021, longpanda <admin@ventoy.net>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
26 #include "Ventoy2Disk.h"
27 #include "DiskService.h"
29 BOOL
DISK_CleanDisk(int DriveIndex
)
33 ret
= VDS_CleanDisk(DriveIndex
);
36 ret
= PSHELL_CleanDisk(DriveIndex
);
43 BOOL
DISK_DeleteVtoyEFIPartition(int DriveIndex
, UINT64 EfiPartOffset
)
47 ret
= VDS_DeleteVtoyEFIPartition(DriveIndex
, EfiPartOffset
);
50 ret
= PSHELL_DeleteVtoyEFIPartition(DriveIndex
, EfiPartOffset
);
56 BOOL
DISK_ChangeVtoyEFI2ESP(int DriveIndex
, UINT64 Offset
)
60 ret
= VDS_ChangeVtoyEFI2ESP(DriveIndex
, Offset
);
63 ret
= PSHELL_ChangeVtoyEFI2ESP(DriveIndex
, Offset
);
70 BOOL
DISK_ChangeVtoyEFI2Basic(int DriveIndex
, UINT64 Offset
)
74 ret
= VDS_ChangeVtoyEFI2Basic(DriveIndex
, Offset
);
77 ret
= PSHELL_ChangeVtoyEFI2Basic(DriveIndex
, Offset
);
83 BOOL
DISK_ChangeVtoyEFIAttr(int DriveIndex
, UINT64 Offset
, UINT64 Attr
)
87 ret
= VDS_ChangeVtoyEFIAttr(DriveIndex
, Offset
, Attr
);
92 BOOL
DISK_ShrinkVolume(int DriveIndex
, const char* VolumeGuid
, CHAR DriveLetter
, UINT64 OldBytes
, UINT64 ReduceBytes
)
96 ret
= VDS_ShrinkVolume(DriveIndex
, VolumeGuid
, DriveLetter
, OldBytes
, ReduceBytes
);
99 if (LASTERR
== VDS_E_SHRINK_DIRTY_VOLUME
)
101 Log("VDS shrink return dirty, no need to run powershell.");
105 ret
= PSHELL_ShrinkVolume(DriveIndex
, VolumeGuid
, DriveLetter
, OldBytes
, ReduceBytes
);