diff --git a/Vlnk/src/main_windows.c b/Vlnk/src/main_windows.c index 34f75483..08951202 100644 --- a/Vlnk/src/main_windows.c +++ b/Vlnk/src/main_windows.c @@ -393,12 +393,12 @@ static BOOL IsSupportedVlnkSuffix(WCHAR *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) + if (lstrcmp(FileName + len - 9, L".vlnk.iso") == 0 || + lstrcmp(FileName + len - 9, L".vlnk.img") == 0 || + lstrcmp(FileName + len - 9, L".vlnk.wim") == 0 || + lstrcmp(FileName + len - 9, L".vlnk.vhd") == 0 || + lstrcmp(FileName + len - 9, L".vlnk.efi") == 0 || + lstrcmp(FileName + len - 9, L".vlnk.dat") == 0) { return TRUE; } @@ -407,8 +407,8 @@ static BOOL IsSupportedVlnkSuffix(WCHAR *FileName) if (len > 10) { - if (lstrcmp(FileName - 10, L".vlnk.vhdx") == 0 || - lstrcmp(FileName - 9, L".vlnk.vtoy") == 0) + if (lstrcmp(FileName + len - 10, L".vlnk.vhdx") == 0 || + lstrcmp(FileName + len - 10, L".vlnk.vtoy") == 0) { return TRUE; } @@ -879,6 +879,13 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi return 1; } + if (!IsSupportedVlnkSuffix(g_CmdOutFile)) + { + LogW(L"File <<%ls>> contains invalid vlnk suffix!\n", g_CmdOutFile); + VtoyMessageBox(NULL, g_msg_lang[MSGID_INVALID_SUFFIX], g_msg_lang[MSGID_ERROR], MB_OK | MB_ICONERROR); + return 1; + } + return CreateVlnk(NULL, g_CurDirW, g_CmdInFile, g_CmdOutFile); } else diff --git a/Vlnk/vs/VentoyVlnk/Release/VentoyVlnk.exe b/Vlnk/vs/VentoyVlnk/Release/VentoyVlnk.exe index ac8bfa3c..0f479e10 100644 Binary files a/Vlnk/vs/VentoyVlnk/Release/VentoyVlnk.exe and b/Vlnk/vs/VentoyVlnk/Release/VentoyVlnk.exe differ