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
9118d5fe
"tests/csrc/unittests/test_tensor.cu" did not exist on "53d2e42cbe70898f9b13969e896a8f555d2947aa"
Commit
9118d5fe
authored
Feb 17, 2022
by
longpanda
Browse files
Add check for vlnk file suffix in save as
parent
f130325a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
2 deletions
+47
-2
Vlnk/src/main_windows.c
Vlnk/src/main_windows.c
+47
-2
Vlnk/vs/VentoyVlnk/Release/VentoyVlnk.exe
Vlnk/vs/VentoyVlnk/Release/VentoyVlnk.exe
+0
-0
No files found.
Vlnk/src/main_windows.c
View file @
9118d5fe
...
...
@@ -37,6 +37,7 @@ typedef enum MSGID
MSGID_VLNK_POINT_TO
,
MSGID_VLNK_NO_DST
,
MSGID_FILE_NAME_TOO_LONG
,
MSGID_INVALID_SUFFIX
,
MSGID_BUTT
}
MSGID
;
...
...
@@ -61,6 +62,7 @@ const WCHAR *g_msg_cn[MSGID_BUTT] =
L"此 vlnk 文件指向 "
,
L"此 vlnk 指向的文件不存在!"
,
L"文件路径太长!"
,
L"非法的vlnk文件后缀名!"
,
};
const
WCHAR
*
g_msg_en
[
MSGID_BUTT
]
=
{
...
...
@@ -81,6 +83,7 @@ const WCHAR *g_msg_en[MSGID_BUTT] =
L"The vlnk file point to "
,
L"The file pointed by the vlnk does NOT exist!"
,
L"The file full path is too long!"
,
L"Invalid vlnk file suffix!"
,
};
const
WCHAR
**
g_msg_lang
=
NULL
;
...
...
@@ -382,6 +385,38 @@ static BOOL VentoyGetSaveFileName(HWND hWnd, WCHAR *szFile)
return
GetSaveFileName
(
&
ofn
);
}
static
BOOL
IsSupportedVlnkSuffix
(
WCHAR
*
FileName
)
{
int
len
;
len
=
lstrlen
(
FileName
);
if
(
len
>
9
)
{
if
(
lstrcmp
(
FileName
-
9
,
L".vlnk.iso"
)
==
0
||
lstrcmp
(
FileName
-
9
,
L".vlnk.img"
)
==
0
||
lstrcmp
(
FileName
-
9
,
L".vlnk.wim"
)
==
0
||
lstrcmp
(
FileName
-
9
,
L".vlnk.vhd"
)
==
0
||
lstrcmp
(
FileName
-
9
,
L".vlnk.efi"
)
==
0
||
lstrcmp
(
FileName
-
9
,
L".vlnk.dat"
)
==
0
)
{
return
TRUE
;
}
}
if
(
len
>
10
)
{
if
(
lstrcmp
(
FileName
-
10
,
L".vlnk.vhdx"
)
==
0
||
lstrcmp
(
FileName
-
9
,
L".vlnk.vtoy"
)
==
0
)
{
return
TRUE
;
}
}
return
FALSE
;
}
static
int
CreateVlnk
(
HWND
hWnd
,
WCHAR
*
Dir
,
WCHAR
*
InFile
,
WCHAR
*
OutFile
)
{
int
i
;
...
...
@@ -541,11 +576,20 @@ static int CreateVlnk(HWND hWnd, WCHAR *Dir, WCHAR *InFile, WCHAR *OutFile)
{
wcscpy_s
(
szFile
,
MAX_PATH
,
DstFullPath
);
if
(
VentoyGetSaveFileName
(
hWnd
,
szFile
))
{
if
(
IsSupportedVlnkSuffix
(
szFile
))
{
wcscpy_s
(
DstFullPath
,
MAX_PATH
,
szFile
);
SetOutFile
=
TRUE
;
}
else
{
VtoyMessageBox
(
hWnd
,
g_msg_lang
[
MSGID_INVALID_SUFFIX
],
g_msg_lang
[
MSGID_ERROR
],
MB_OK
|
MB_ICONERROR
);
LogA
(
"Invalid vlnk suffix
\n
"
);
goto
end
;
}
}
else
{
LogA
(
"User cancel the save as diaglog, use default name
\n
"
);
}
...
...
@@ -577,6 +621,7 @@ static int CreateVlnk(HWND hWnd, WCHAR *Dir, WCHAR *InFile, WCHAR *OutFile)
VtoyMessageBox
(
hWnd
,
g_msg_lang
[
MSGID_CREATE_FILE_ERR
],
g_msg_lang
[
MSGID_ERROR
],
MB_OK
|
MB_ICONERROR
);
}
end:
free
(
Buf
);
}
...
...
Vlnk/vs/VentoyVlnk/Release/VentoyVlnk.exe
View file @
9118d5fe
No preview for this file type
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