mirror of
https://github.com/ventoy/Ventoy.git
synced 2026-10-20 21:21:57 +00:00
VtoyTool add cmds.
This commit is contained in:
@@ -7,12 +7,12 @@
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
/* Volume Descriptor */
|
||||
#define BISO_VD_TYPE_BOOT 0
|
||||
#define BISO_VD_TYPE_PVD 1
|
||||
#define BISO_VD_TYPE_PVD 1
|
||||
#define BISO_VD_TYPE_SVD 2
|
||||
#define BISO_VD_TYPE_PART 3
|
||||
#define BISO_VD_TYPE_END 255
|
||||
@@ -82,6 +82,15 @@
|
||||
UINT32 uiData;\
|
||||
UINT32 uiData##Swap;
|
||||
|
||||
#define BISO_FILL_723(usData, usVal) \
|
||||
usData = (UINT16)usVal; \
|
||||
usData##Swap = __builtin_bswap16(usData)
|
||||
|
||||
#define BISO_FILL_733(uiData, uiVal) \
|
||||
uiData = (UINT32)uiVal; \
|
||||
uiData##Swap = __builtin_bswap32(uiData)
|
||||
|
||||
|
||||
#define BISO_PATHTBL_LOCATION(pstPVD) (pstPVD->uiTypeLPathTblLoc)
|
||||
|
||||
#elif (__BYTE_ORDER == __BIG_ENDIAN)
|
||||
@@ -105,12 +114,12 @@
|
||||
typedef struct tagBISO_DATE_915
|
||||
{
|
||||
UCHAR ucYear; /* 1900+ */
|
||||
UCHAR ucMonth;
|
||||
UCHAR ucDay;
|
||||
UCHAR ucHour;
|
||||
UCHAR ucMin;
|
||||
UCHAR ucSec;
|
||||
CHAR cTimeZone;
|
||||
UCHAR ucMonth;
|
||||
UCHAR ucDay;
|
||||
UCHAR ucHour;
|
||||
UCHAR ucMin;
|
||||
UCHAR ucSec;
|
||||
CHAR cTimeZone;
|
||||
}BISO_DATE_915_S;
|
||||
|
||||
typedef struct tagBISO_PATH_TABLE
|
||||
@@ -124,7 +133,7 @@ typedef struct tagBISO_PATH_TABLE
|
||||
UINT16 usParentDirNum;
|
||||
|
||||
CHAR szDirName[1];
|
||||
|
||||
|
||||
/* UCHAR ucPadding; */
|
||||
}BISO_PATH_TABLE_S;
|
||||
|
||||
@@ -140,7 +149,7 @@ typedef struct tagBISO_DIR_RECORD
|
||||
|
||||
BISO_DEF_733(uiSize)
|
||||
|
||||
BISO_DATE_915_S stDate;
|
||||
BISO_DATE_915_S stDate;
|
||||
|
||||
UCHAR ucFlags;
|
||||
|
||||
@@ -160,7 +169,7 @@ typedef struct tagBISO_DIR_RECORD
|
||||
#define BISO_DIR_RECORD_IS_PATH(pstDirRecord) \
|
||||
((1 == ((pstDirRecord->ucFlags >> 1) & 0x01)) ? BOOL_TRUE : BOOL_FALSE)
|
||||
|
||||
typedef struct tagBISO_VOLUME_DESC
|
||||
typedef struct tagBISO_VOLUME_DESC
|
||||
{
|
||||
UCHAR ucType;
|
||||
|
||||
@@ -183,8 +192,8 @@ typedef struct tagBISO_PRIMARY_VOLUME_DESC
|
||||
/* ucResv1: unused1 [ISODCL ( 8, 8)] */
|
||||
UCHAR ucResv1;
|
||||
|
||||
/*
|
||||
* szSystemId[32]: system_id [ISODCL ( 9, 40)]
|
||||
/*
|
||||
* szSystemId[32]: system_id [ISODCL ( 9, 40)]
|
||||
*/
|
||||
CHAR szSystemId[32];
|
||||
|
||||
@@ -201,18 +210,18 @@ typedef struct tagBISO_PRIMARY_VOLUME_DESC
|
||||
|
||||
BISO_DEF_723(usVolumeSet)
|
||||
|
||||
/*
|
||||
* usVolumeSeq: volume_sequence_number [ISODCL (125, 128)]
|
||||
/*
|
||||
* usVolumeSeq: volume_sequence_number [ISODCL (125, 128)]
|
||||
*/
|
||||
BISO_DEF_723(usVolumeSeq)
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* usBlockSize: logical_block_size [ISODCL (129, 132)]
|
||||
*/
|
||||
BISO_DEF_723(usBlockSize)
|
||||
|
||||
/*
|
||||
* uiPathTblSize: path_table_size [ISODCL (133, 140)]
|
||||
* uiPathTblSize: path_table_size [ISODCL (133, 140)]
|
||||
*/
|
||||
BISO_DEF_733(uiPathTblSize)
|
||||
|
||||
@@ -221,50 +230,50 @@ typedef struct tagBISO_PRIMARY_VOLUME_DESC
|
||||
UINT32 uiOptTypeLPathTblLoc;
|
||||
|
||||
UINT32 uiTypeMPathTblLoc;
|
||||
|
||||
|
||||
UINT32 uiOptTypeMPathTblLoc;
|
||||
|
||||
BISO_DIR_RECORD_S stRootDirRecord;
|
||||
|
||||
/* szVolumeSetId: volume_set_id [ISODCL (191, 318)] */
|
||||
CHAR szVolumeSetId[128];
|
||||
|
||||
|
||||
/* szPublisherId: publisher_id [ISODCL (319, 446)] */
|
||||
CHAR szPublisherId[128];
|
||||
|
||||
|
||||
/* szPreparerId: preparer_id [ISODCL (447, 574)] */
|
||||
CHAR szPreparerId[128];
|
||||
|
||||
|
||||
/* szApplicationId: application_id [ISODCL (575, 702)] */
|
||||
CHAR szApplicationId[128];
|
||||
|
||||
|
||||
/* szCopyrightFileId: copyright_file_id [ISODCL (703, 739)] [1] */
|
||||
CHAR szCopyrightFileId[37];
|
||||
|
||||
|
||||
/* szAbstractFileId: abstract_file_id [ISODCL (740, 776)] */
|
||||
CHAR szAbstractFileId[37];
|
||||
|
||||
|
||||
/* szBibliographicFileId: bibliographic_file_id [ISODCL (777, 813)] */
|
||||
CHAR szBibliographicFileId[37];
|
||||
|
||||
/* szCreationDate: creation_date [ISODCL (814, 830)] */
|
||||
CHAR szCreationDate[17];
|
||||
|
||||
|
||||
/* szModifyDate: modification_date [ISODCL (831, 847)] */
|
||||
CHAR szModifyDate[17];
|
||||
|
||||
|
||||
/* szExpirationDate: expiration_date [ISODCL (848, 864)] */
|
||||
CHAR szExpirationDate[17];
|
||||
|
||||
|
||||
/* szEffectiveDate: effective_date [ISODCL (865, 881)] */
|
||||
CHAR szEffectiveDate[17];
|
||||
|
||||
|
||||
/* ucFileStructVer: file_structure_version [ISODCL (882, 882)] */
|
||||
UCHAR ucFileStructVer;
|
||||
|
||||
|
||||
/* ucResv4: unused4 [ISODCL (883, 883)] */
|
||||
UCHAR ucResv4;
|
||||
|
||||
|
||||
/* aucApplicationData: application_data [ISODCL (884, 1395)] */
|
||||
UCHAR aucApplicationData[512];
|
||||
|
||||
@@ -276,21 +285,21 @@ typedef struct tagBISO_SUPPLEMENTARY_VOLUME_DESC
|
||||
{
|
||||
UCHAR ucType;
|
||||
|
||||
/*
|
||||
* szId[5]: id [ISODCL ( 2, 6)]
|
||||
/*
|
||||
* szId[5]: id [ISODCL ( 2, 6)]
|
||||
*/
|
||||
CHAR szId[5];
|
||||
|
||||
/* ucVersion: version [ISODCL ( 7, 7)] */
|
||||
UCHAR ucVersion;
|
||||
|
||||
/*
|
||||
* ucFlags: flags [ISODCL ( 8, 8)]
|
||||
/*
|
||||
* ucFlags: flags [ISODCL ( 8, 8)]
|
||||
*/
|
||||
UCHAR ucFlags;
|
||||
|
||||
/*
|
||||
* szSystemId[32]: system_id [ISODCL ( 9, 40)]
|
||||
/*
|
||||
* szSystemId[32]: system_id [ISODCL ( 9, 40)]
|
||||
*/
|
||||
CHAR szSystemId[32];
|
||||
|
||||
@@ -300,8 +309,8 @@ typedef struct tagBISO_SUPPLEMENTARY_VOLUME_DESC
|
||||
/* aucResv2[8]: unused2 [ISODCL ( 73, 80)] */
|
||||
UCHAR aucResv2[8];
|
||||
|
||||
/*
|
||||
* uiVolumeSpace: volume_space_size [ISODCL ( 81, 88)]
|
||||
/*
|
||||
* uiVolumeSpace: volume_space_size [ISODCL ( 81, 88)]
|
||||
*/
|
||||
BISO_DEF_733(uiVolumeSpace)
|
||||
|
||||
@@ -309,16 +318,16 @@ typedef struct tagBISO_SUPPLEMENTARY_VOLUME_DESC
|
||||
UCHAR aucEscape[32];
|
||||
|
||||
/*
|
||||
* usVolumeSet: volume_set_size [ISODCL (121, 124)]
|
||||
* usVolumeSet: volume_set_size [ISODCL (121, 124)]
|
||||
*/
|
||||
BISO_DEF_723(usVolumeSet)
|
||||
|
||||
/*
|
||||
* usVolumeSeq: volume_sequence_number [ISODCL (125, 128)]
|
||||
/*
|
||||
* usVolumeSeq: volume_sequence_number [ISODCL (125, 128)]
|
||||
*/
|
||||
BISO_DEF_723(usVolumeSeq)
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* usBlockSize: logical_block_size [ISODCL (129, 132)]
|
||||
*/
|
||||
BISO_DEF_723(usBlockSize)
|
||||
@@ -330,50 +339,50 @@ typedef struct tagBISO_SUPPLEMENTARY_VOLUME_DESC
|
||||
UINT32 uiOptTypeLPathTblLoc;
|
||||
|
||||
UINT32 uiTypeMPathTblLoc;
|
||||
|
||||
|
||||
UINT32 uiOptTypeMPathTblLoc;
|
||||
|
||||
BISO_DIR_RECORD_S stRootDirRecord;
|
||||
|
||||
/* szVolumeSetId: volume_set_id [ISODCL (191, 318)] */
|
||||
CHAR szVolumeSetId[128];
|
||||
|
||||
|
||||
/* szPublisherId: publisher_id [ISODCL (319, 446)] */
|
||||
CHAR szPublisherId[128];
|
||||
|
||||
|
||||
/* szPreparerId: preparer_id [ISODCL (447, 574)] */
|
||||
CHAR szPreparerId[128];
|
||||
|
||||
|
||||
/* szApplicationId: application_id [ISODCL (575, 702)] */
|
||||
CHAR szApplicationId[128];
|
||||
|
||||
|
||||
/* szCopyrightFileId: copyright_file_id [ISODCL (703, 739)] */
|
||||
CHAR szCopyrightFileId[37];
|
||||
|
||||
|
||||
/* szAbstractFileId: abstract_file_id [ISODCL (740, 776)]*/
|
||||
CHAR szAbstractFileId[37];
|
||||
|
||||
|
||||
/* szBibliographicFileId: bibliographic_file_id [ISODCL (777, 813)] */
|
||||
CHAR szBibliographicFileId[37];
|
||||
|
||||
/* szCreationDate: creation_date [ISODCL (814, 830)]*/
|
||||
CHAR szCreationDate[17];
|
||||
|
||||
|
||||
/* szModifyDate: modification_date [ISODCL (831, 847)] */
|
||||
CHAR szModifyDate[17];
|
||||
|
||||
|
||||
/* szExpirationDate: expiration_date [ISODCL (848, 864)] */
|
||||
CHAR szExpirationDate[17];
|
||||
|
||||
|
||||
/* szEffectiveDate: effective_date [ISODCL (865, 881)] */
|
||||
CHAR szEffectiveDate[17];
|
||||
|
||||
|
||||
/* ucFileStructVer: file_structure_version [ISODCL (882, 882)] */
|
||||
UCHAR ucFileStructVer;
|
||||
|
||||
|
||||
/* ucResv4: unused4 [ISODCL (883, 883)] */
|
||||
UCHAR ucResv4;
|
||||
|
||||
|
||||
/* aucApplicationData: application_data [ISODCL (884, 1395)] */
|
||||
UCHAR aucApplicationData[512];
|
||||
|
||||
@@ -384,8 +393,8 @@ typedef struct tagBISO_SUPPLEMENTARY_VOLUME_DESC
|
||||
typedef struct tagBISO_BOOT_DESC
|
||||
{
|
||||
UCHAR ucType;
|
||||
/*
|
||||
* szId[5]: id [ISODCL ( 2, 6)]
|
||||
/*
|
||||
* szId[5]: id [ISODCL ( 2, 6)]
|
||||
*/
|
||||
CHAR szId[5];
|
||||
|
||||
@@ -430,7 +439,7 @@ typedef struct tagBISO_EXTATTR_RECORD
|
||||
UCHAR aucResv[64];
|
||||
|
||||
BISO_DEF_723(usAppDataLen)
|
||||
|
||||
|
||||
/* UCHAR aucAppData[xxx]; */
|
||||
/* UCHAR aucEscape[xxx]; */
|
||||
}BISO_EXTATTR_RECORD_S;
|
||||
@@ -520,14 +529,14 @@ typedef struct tagBISO_PARSER
|
||||
UCHAR ucRRIPSkipLen;
|
||||
|
||||
BISO_DIR_TREE_S stDirTree;
|
||||
|
||||
|
||||
BISO_SVD_DIR_TREE_S stSVDDirTree;
|
||||
}BISO_PARSER_S;
|
||||
|
||||
ULONG BISO_9660_OpenImage
|
||||
(
|
||||
IN BOOL_T bParseSVDDirTree,
|
||||
IN CONST CHAR *pcFileName,
|
||||
IN CONST CHAR *pcFileName,
|
||||
OUT BISO_PARSER_S *pstParser
|
||||
);
|
||||
BISO_PARSER_S * BISO_9660_CreateParser(VOID);
|
||||
@@ -540,12 +549,12 @@ ULONG BISO_9660_ParseDate84261
|
||||
VOID BISO_9660_FmtDate84261(IN time_t ulTime, IN UINT uiBufSize, OUT CHAR *pcDate);
|
||||
VOID BISO_9660_FillDfsStack
|
||||
(
|
||||
IN BISO_DIR_TREE_S *pstTop,
|
||||
IN BISO_DIR_TREE_S *pstTop,
|
||||
INOUT BISO_QUEUE_S *pstQueue
|
||||
);
|
||||
ULONG BISO_9660_ExtractFile
|
||||
(
|
||||
IN BISO_FILE_S *pstFile,
|
||||
IN BISO_FILE_S *pstFile,
|
||||
IN CONST CHAR *pcDstFullPath,
|
||||
IN CONST BISO_DIR_TREE_S *pstFileNode,
|
||||
IN CONST BISO_EXTRACT_CTRL_S *pstCtrl
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
/******************************************************************************
|
||||
* vtoygpt.c ---- ventoy gpt
|
||||
*
|
||||
* Copyright (c) 2026, longpanda <admin@ventoy.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
static int verbose = 0;
|
||||
#define debug(fmt, ...) if(verbose) printf(fmt, ##__VA_ARGS__)
|
||||
|
||||
|
||||
#define VOID void
|
||||
#define CHAR char
|
||||
#define UINT64 unsigned long long
|
||||
#define UINT32 unsigned int
|
||||
#define UINT16 unsigned short
|
||||
#define CHAR16 unsigned short
|
||||
#define UINT8 unsigned char
|
||||
|
||||
UINT32 VtoyCrc32(VOID *Buffer, UINT32 Length);
|
||||
|
||||
#define COMPILE_ASSERT(expr) extern char __compile_assert[(expr) ? 1 : -1]
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct PART_TABLE
|
||||
{
|
||||
UINT8 Active;
|
||||
|
||||
UINT8 StartHead;
|
||||
UINT16 StartSector : 6;
|
||||
UINT16 StartCylinder : 10;
|
||||
|
||||
UINT8 FsFlag;
|
||||
|
||||
UINT8 EndHead;
|
||||
UINT16 EndSector : 6;
|
||||
UINT16 EndCylinder : 10;
|
||||
|
||||
UINT32 StartSectorId;
|
||||
UINT32 SectorCount;
|
||||
}PART_TABLE;
|
||||
|
||||
typedef struct MBR_HEAD
|
||||
{
|
||||
UINT8 BootCode[446];
|
||||
PART_TABLE PartTbl[4];
|
||||
UINT8 Byte55;
|
||||
UINT8 ByteAA;
|
||||
}MBR_HEAD;
|
||||
|
||||
typedef struct GUID
|
||||
{
|
||||
UINT32 data1;
|
||||
UINT16 data2;
|
||||
UINT16 data3;
|
||||
UINT8 data4[8];
|
||||
}GUID;
|
||||
|
||||
typedef struct VTOY_GPT_HDR
|
||||
{
|
||||
CHAR Signature[8]; /* EFI PART */
|
||||
UINT8 Version[4];
|
||||
UINT32 Length;
|
||||
UINT32 Crc;
|
||||
UINT8 Reserved1[4];
|
||||
UINT64 EfiStartLBA;
|
||||
UINT64 EfiBackupLBA;
|
||||
UINT64 PartAreaStartLBA;
|
||||
UINT64 PartAreaEndLBA;
|
||||
GUID DiskGuid;
|
||||
UINT64 PartTblStartLBA;
|
||||
UINT32 PartTblTotNum;
|
||||
UINT32 PartTblEntryLen;
|
||||
UINT32 PartTblCrc;
|
||||
UINT8 Reserved2[420];
|
||||
}VTOY_GPT_HDR;
|
||||
|
||||
COMPILE_ASSERT(sizeof(VTOY_GPT_HDR) == 512);
|
||||
|
||||
typedef struct VTOY_GPT_PART_TBL
|
||||
{
|
||||
GUID PartType;
|
||||
GUID PartGuid;
|
||||
UINT64 StartLBA;
|
||||
UINT64 LastLBA;
|
||||
UINT64 Attr;
|
||||
CHAR16 Name[36];
|
||||
}VTOY_GPT_PART_TBL;
|
||||
COMPILE_ASSERT(sizeof(VTOY_GPT_PART_TBL) == 128);
|
||||
|
||||
typedef struct VTOY_GPT_INFO
|
||||
{
|
||||
MBR_HEAD MBR;
|
||||
VTOY_GPT_HDR Head;
|
||||
VTOY_GPT_PART_TBL PartTbl[128];
|
||||
}VTOY_GPT_INFO;
|
||||
|
||||
typedef struct VTOY_BK_GPT_INFO
|
||||
{
|
||||
VTOY_GPT_PART_TBL PartTbl[128];
|
||||
VTOY_GPT_HDR Head;
|
||||
}VTOY_BK_GPT_INFO;
|
||||
|
||||
COMPILE_ASSERT(sizeof(VTOY_GPT_INFO) == 512 * 34);
|
||||
COMPILE_ASSERT(sizeof(VTOY_BK_GPT_INFO) == 512 * 33);
|
||||
|
||||
#pragma pack()
|
||||
|
||||
static void dump_gpt_partuuid(int fd, int part)
|
||||
{
|
||||
int i;
|
||||
int start, end;
|
||||
GUID *guid = NULL;
|
||||
VTOY_GPT_INFO *pInfo = NULL;
|
||||
|
||||
pInfo = (VTOY_GPT_INFO *)malloc(sizeof(VTOY_GPT_INFO));
|
||||
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
read(fd, pInfo, sizeof(VTOY_GPT_INFO));
|
||||
|
||||
if (part >= 1 && part <= 128)
|
||||
{
|
||||
start = end = part;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = 1;
|
||||
end = 128;
|
||||
}
|
||||
|
||||
for (i = start; i <= end; i++)
|
||||
{
|
||||
if (pInfo->PartTbl[i - 1].StartLBA == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
guid = &(pInfo->PartTbl[i - 1].PartGuid);
|
||||
|
||||
printf("%d %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", i,
|
||||
guid->data1, guid->data2, guid->data3,
|
||||
guid->data4[0], guid->data4[1], guid->data4[2], guid->data4[3],
|
||||
guid->data4[4], guid->data4[5], guid->data4[6], guid->data4[7]);
|
||||
}
|
||||
}
|
||||
|
||||
int vtoygpt_main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int part;
|
||||
int fd;
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
if (argv[i][0] == '-' && argv[i][1] == 'v')
|
||||
{
|
||||
verbose = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
part = (int)strtol(argv[2], NULL, 10);
|
||||
|
||||
fd = open(argv[1], O_RDONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
debug("Failed to open %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
dump_gpt_partuuid(fd, part);
|
||||
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// wrapper main
|
||||
#ifndef BUILD_VTOY_TOOL
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
return vtoygpt_main(argc, argv);
|
||||
}
|
||||
#endif
|
||||
|
||||
+8
-6
@@ -7,12 +7,12 @@
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
@@ -38,10 +38,11 @@ int vtoyloader_main(int argc, char **argv);
|
||||
int vtoyvine_main(int argc, char **argv);
|
||||
int vtoyksym_main(int argc, char **argv);
|
||||
int vtoykmod_main(int argc, char **argv);
|
||||
int vtoygpt_main(int argc, char **argv);
|
||||
int vtoyexpand_main(int argc, char **argv);
|
||||
|
||||
static char *g_vtoytool_name = NULL;
|
||||
static cmd_def g_cmd_list[] =
|
||||
static cmd_def g_cmd_list[] =
|
||||
{
|
||||
{ "vine_patch_loader", vtoyvine_main },
|
||||
{ "vtoydump", vtoydump_main },
|
||||
@@ -51,6 +52,7 @@ static cmd_def g_cmd_list[] =
|
||||
{ "vtoyksym", vtoyksym_main },
|
||||
{ "vtoykmod", vtoykmod_main },
|
||||
{ "vtoyexpand", vtoyexpand_main },
|
||||
{ "vtoygpt", vtoygpt_main },
|
||||
{ "--install", vtoytool_install },
|
||||
};
|
||||
|
||||
@@ -60,7 +62,7 @@ int vtoytool_install(int argc, char **argv)
|
||||
int i;
|
||||
char toolpath[128];
|
||||
char filepath[128];
|
||||
|
||||
|
||||
for (i = 0; i < sizeof(g_cmd_list) / sizeof(g_cmd_list[0]); i++)
|
||||
{
|
||||
if (g_cmd_list[i].cmd[0] != '-')
|
||||
@@ -70,14 +72,14 @@ int vtoytool_install(int argc, char **argv)
|
||||
link(toolpath, filepath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if ((g_vtoytool_name = strstr(argv[0], "vtoytool")) != NULL)
|
||||
{
|
||||
argc--;
|
||||
|
||||
Reference in New Issue
Block a user