Skip to content

Commit

Permalink
1. When click install button, if the USB stick already installed with…
Browse files Browse the repository at this point in the history
… Ventoy, then popup a dialog to require a YES text input to confirm.

2. Prevent DLL search order hijacking
  • Loading branch information
ventoy committed Apr 5, 2022
1 parent 2f95139 commit 04828df
Show file tree
Hide file tree
Showing 35 changed files with 129 additions and 11 deletions.
Binary file modified INSTALL/Ventoy2Disk.exe
Binary file not shown.
Binary file modified INSTALL/Ventoy2Disk_ARM.exe
Binary file not shown.
Binary file modified INSTALL/Ventoy2Disk_ARM64.exe
Binary file not shown.
Binary file modified INSTALL/Ventoy2Disk_X64.exe
Binary file not shown.
Binary file modified INSTALL/grub/arm64-efi/moddep.lst
Binary file not shown.
Binary file added INSTALL/grub/arm64-efi/mouse.mod
Binary file not shown.
Binary file modified INSTALL/grub/arm64-efi/normal.mod
Binary file not shown.
Binary file modified INSTALL/grub/arm64-efi/terminal.lst
Binary file not shown.
Binary file removed INSTALL/grub/i386-efi/gfxterm_menu.mod
Binary file not shown.
3 changes: 2 additions & 1 deletion INSTALL/grub/i386-efi/moddep.lst
Expand Up @@ -26,7 +26,7 @@ sfs: fshelp
reiserfs: fshelp
part_sunpc:
zstd:
gfxmenu: trig video_colors gfxterm bitmap_scale font normal video bitmap
gfxmenu: video_colors trig gfxterm bitmap_scale font normal video bitmap
backtrace:
jfs:
help: extcmd normal
Expand Down Expand Up @@ -226,6 +226,7 @@ gcry_sha256: crypto
ls: extcmd normal
usbserial_common: serial usb
ntfscomp: ntfs
mouse:
lzopio: crypto
video_cirrus: video video_fb
hello: extcmd
Expand Down
Binary file added INSTALL/grub/i386-efi/mouse.mod
Binary file not shown.
Binary file modified INSTALL/grub/i386-efi/normal.mod
Binary file not shown.
1 change: 1 addition & 0 deletions INSTALL/grub/i386-efi/terminal.lst
@@ -1,4 +1,5 @@
iat_keyboard: at_keyboard
imouse: mouse
iserial: serial
iserial_*: serial
oaudio: morse
Expand Down
Binary file modified INSTALL/grub/i386-pc/core.img
Binary file not shown.
2 changes: 1 addition & 1 deletion INSTALL/grub/i386-pc/moddep.lst
Expand Up @@ -26,7 +26,7 @@ sfs: fshelp
reiserfs: fshelp
part_sunpc:
zstd:
gfxmenu: trig video_colors gfxterm bitmap_scale font normal video bitmap
gfxmenu: video_colors trig gfxterm bitmap_scale font normal video bitmap
backtrace:
jfs:
help: extcmd normal
Expand Down
Binary file modified INSTALL/grub/mips64el-efi/moddep.lst
Binary file not shown.
Binary file added INSTALL/grub/mips64el-efi/mouse.mod
Binary file not shown.
Binary file modified INSTALL/grub/mips64el-efi/normal.mod
Binary file not shown.
Binary file modified INSTALL/grub/mips64el-efi/terminal.lst
Binary file not shown.
Binary file removed INSTALL/grub/x86_64-efi/gfxterm_menu.mod
Binary file not shown.
3 changes: 2 additions & 1 deletion INSTALL/grub/x86_64-efi/moddep.lst
Expand Up @@ -26,7 +26,7 @@ sfs: fshelp
reiserfs: fshelp
part_sunpc:
zstd:
gfxmenu: trig video_colors gfxterm bitmap_scale font normal video bitmap
gfxmenu: video_colors trig gfxterm bitmap_scale font normal video bitmap
backtrace:
jfs:
help: extcmd normal
Expand Down Expand Up @@ -227,6 +227,7 @@ gcry_sha256: crypto
ls: extcmd normal
usbserial_common: serial usb
ntfscomp: ntfs
mouse:
lzopio: crypto
video_cirrus: video video_fb
hello: extcmd
Expand Down
Binary file added INSTALL/grub/x86_64-efi/mouse.mod
Binary file not shown.
Binary file modified INSTALL/grub/x86_64-efi/normal.mod
Binary file not shown.
1 change: 1 addition & 0 deletions INSTALL/grub/x86_64-efi/terminal.lst
@@ -1,4 +1,5 @@
iat_keyboard: at_keyboard
imouse: mouse
iserial: serial
iserial_*: serial
oaudio: morse
Expand Down
90 changes: 90 additions & 0 deletions LANGUAGES/languages.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Ventoy2Disk/Ventoy2Disk/Language.h
Expand Up @@ -83,6 +83,9 @@ typedef enum STR_ID
STR_PART_RESIZE_FAILED,//46
STR_PART_RESIZE_UNSUPPORTED,//47

STR_INSTALL_YES_TIP1,//48
STR_INSTALL_YES_TIP2,//49

STR_ID_MAX
}STR_ID;

Expand Down
Binary file modified Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.aps
Binary file not shown.
5 changes: 5 additions & 0 deletions Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c
Expand Up @@ -28,6 +28,7 @@ DWORD g_PhyDriveCount = 0;
static int g_FilterRemovable = 0;
int g_FilterUSB = 1;
int g_ForceOperation = 1;
int g_NoNeedInputYes = 0;
int g_WriteImage = 0;

int ParseCmdLineOption(LPSTR lpCmdLine)
Expand All @@ -51,6 +52,10 @@ int ParseCmdLineOption(LPSTR lpCmdLine)
{
g_ForceOperation = 1;
}
else if (strncmp(__argv[i], "-Y", 2) == 0 || strncmp(__argv[i], "-y", 2) == 0)
{
g_NoNeedInputYes = 1;
}
}

GetCurrentDirectoryA(sizeof(cfgfile), cfgfile);
Expand Down
4 changes: 4 additions & 0 deletions Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.h
Expand Up @@ -201,6 +201,7 @@ typedef enum PROGRESS_POINT
extern PHY_DRIVE_INFO *g_PhyDriveList;
extern DWORD g_PhyDriveCount;
extern int g_ForceOperation;
extern int g_NoNeedInputYes;
extern HWND g_ProgressBarHwnd;
extern HFONT g_language_normal_font;
extern HFONT g_language_bold_font;
Expand Down Expand Up @@ -246,6 +247,9 @@ int INIT unxz(unsigned char *in, int in_size,
unsigned char *out, int *in_used,
void(*error)(char *x));
void disk_io_set_param(HANDLE Handle, UINT64 SectorCount);

extern BOOL g_InputYes;
INT_PTR CALLBACK YesDialogProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK PartDialogProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam);
int GetReservedSpaceInMB(void);
int IsPartNeed4KBAlign(void);
Expand Down
Binary file modified Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.rc
Binary file not shown.
25 changes: 17 additions & 8 deletions Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.vcxproj
Expand Up @@ -178,7 +178,8 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<AdditionalDependencies>version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>gdi32.dll;winspool.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;uuid.dll;odbc32.dll;odbccp32.dll</DelayLoadDLLs>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)\Res\Ventoy2Disk32.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
Expand All @@ -197,7 +198,8 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<AdditionalDependencies>version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>gdi32.dll;winspool.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;uuid.dll;odbc32.dll;odbccp32.dll</DelayLoadDLLs>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)\Res\Ventoy2DiskArm.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
Expand All @@ -216,7 +218,8 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<AdditionalDependencies>version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>gdi32.dll;winspool.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;uuid.dll;odbc32.dll;odbccp32.dll</DelayLoadDLLs>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)\Res\Ventoy2DiskArm64.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
Expand All @@ -235,7 +238,8 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<AdditionalDependencies>version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>gdi32.dll;winspool.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;uuid.dll;odbc32.dll;odbccp32.dll</DelayLoadDLLs>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)\Res\Ventoy2Disk64.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
Expand All @@ -258,7 +262,8 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<AdditionalDependencies>version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>gdi32.dll;winspool.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;uuid.dll;odbc32.dll;odbccp32.dll</DelayLoadDLLs>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)\Res\Ventoy2Disk32.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
Expand All @@ -281,7 +286,8 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<AdditionalDependencies>version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>gdi32.dll;winspool.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;uuid.dll;odbc32.dll;odbccp32.dll</DelayLoadDLLs>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)\Res\Ventoy2DiskArm.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
Expand All @@ -304,7 +310,8 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<AdditionalDependencies>version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>gdi32.dll;winspool.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;uuid.dll;odbc32.dll;odbccp32.dll</DelayLoadDLLs>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)\Res\Ventoy2DiskArm64.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
Expand All @@ -327,7 +334,8 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<AdditionalDependencies>version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>gdi32.dll;winspool.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;uuid.dll;odbc32.dll;odbccp32.dll</DelayLoadDLLs>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)\Res\Ventoy2Disk64.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
Expand Down Expand Up @@ -360,6 +368,7 @@
<ClCompile Include="VentoyJson.c" />
<ClCompile Include="WinDialog.c" />
<ClCompile Include="xz-embedded-20130513\linux\lib\decompress_unxz.c" />
<ClCompile Include="YesDialog.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="DiskService.h" />
Expand Down
3 changes: 3 additions & 0 deletions Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.vcxproj.filters
Expand Up @@ -93,6 +93,9 @@
<ClCompile Include="DiskService.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="YesDialog.c">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Ventoy2Disk.h">
Expand Down
Binary file modified Ventoy2Disk/Ventoy2Disk/WinDialog.c
Binary file not shown.
Binary file added Ventoy2Disk/Ventoy2Disk/YesDialog.c
Binary file not shown.
Binary file modified Ventoy2Disk/Ventoy2Disk/resource.h
Binary file not shown.

0 comments on commit 04828df

Please sign in to comment.