diff --git a/.gitignore b/.gitignore index 51b1137..4012e94 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ .vs -x64 \ No newline at end of file +Output \ No newline at end of file diff --git a/README.md b/README.md index 48a2319..eb16a03 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,7 @@ Please open new [issue](https://github.com/eliboa/TegraRcmGUI/issues) to report ## Development -Install the [libusbk dev kit](https://sourceforge.net/projects/libusbk/) using the setup program. -If not installed in the default `C:\libusbK-dev-kit` location, then create an encironment variable with the other path as the value. -The project seems to survive a target upgrade from the tools in Visual Studio 2017 to 2019. -Make sure with the library's include files path correct, the actual library name still exists in the Project Settings/Properties > Linker > Input > Additional Dependencies list as `libusbK.lib`. +Install the [libusbk dev kit](https://sourceforge.net/projects/libusbk/) using the setup program, then create an environment variable `LIBUSBK_DIR` with the installation path as the value. ## How to backup/restore your Nintendo Switch's NAND ? diff --git a/TegraRcmGUI/DialogTab02.cpp b/TegraRcmGUI/DialogTab02.cpp index 261060b..8e158b5 100644 --- a/TegraRcmGUI/DialogTab02.cpp +++ b/TegraRcmGUI/DialogTab02.cpp @@ -144,16 +144,16 @@ void DialogTab02::OnBnClickedMountSd() switch (pmyComboBox->GetCurSel()) { case 0: - _tcscpy(args, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_boot0.ini")); + _tcscpy_s(args, 255, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_boot0.ini")); break; case 1: - _tcscpy(args, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_boot1.ini")); + _tcscpy_s(args, 255, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_boot1.ini")); break; case 2: - _tcscpy(args, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_emmc.ini")); + _tcscpy_s(args, 255, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_emmc.ini")); break; default: - _tcscpy(args, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_sd.ini")); + _tcscpy_s(args, 255, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_sd.ini")); break; } diff --git a/TegraRcmGUI/TegraRcm.cpp b/TegraRcmGUI/TegraRcm.cpp index 99b1e07..8d2e913 100644 --- a/TegraRcmGUI/TegraRcm.cpp +++ b/TegraRcmGUI/TegraRcm.cpp @@ -869,10 +869,9 @@ int TegraRcm::Smasher(TCHAR args[4096], BOOL bInheritHandles) CString csPath2(csPath); csPath.Append(TEXT(".\\TegraRcmSmash.exe ")); TCHAR cmd[4096]; - _tcscpy_s(cmd, csPath); + _tcscpy_s(cmd, 4095, csPath); lstrcat(cmd, args); - SECURITY_ATTRIBUTES sa; sa.nLength = sizeof(sa); sa.lpSecurityDescriptor = NULL; @@ -1126,7 +1125,7 @@ char* TegraRcm::GetRelativeFilename(char *currentDirectory, char *absoluteFilena if (currentDirectory[0] != absoluteFilename[0]) { // not on the same drive, so only absolute filename will do - strcpy(relativeFilename, absoluteFilename); + strcpy_s(relativeFilename, MAX_FILENAME_LEN, absoluteFilename); return relativeFilename; } // they are on the same drive, find out how much of the current directory @@ -1147,7 +1146,7 @@ char* TegraRcm::GetRelativeFilename(char *currentDirectory, char *absoluteFilena // file name should not have a leading one... i++; } - strcpy(relativeFilename, &absoluteFilename[i]); + strcpy_s(relativeFilename, MAX_FILENAME_LEN, &absoluteFilename[i]); return relativeFilename; } // The file is not in a child directory of the current directory, so we @@ -1192,6 +1191,6 @@ char* TegraRcm::GetRelativeFilename(char *currentDirectory, char *absoluteFilena relativeFilename[rfMarker++] = SLASH; } // copy the rest of the filename into the result string - strcpy(&relativeFilename[rfMarker], &absoluteFilename[afMarker]); + strcpy_s(&relativeFilename[rfMarker], MAX_FILENAME_LEN, &absoluteFilename[afMarker]); return relativeFilename; } \ No newline at end of file diff --git a/TegraRcmGUI/TegraRcmGUI.vcxproj b/TegraRcmGUI/TegraRcmGUI.vcxproj index 648bb4e..d7f4de4 100644 --- a/TegraRcmGUI/TegraRcmGUI.vcxproj +++ b/TegraRcmGUI/TegraRcmGUI.vcxproj @@ -78,12 +78,15 @@ true + $(SolutionDir)\Output\$(Platform)\$(Configuration)\ + Output\$(Platform)\$(Configuration)\ false - false + $(SolutionDir)\Output\$(Platform)\$(Configuration)\ + Output\$(Platform)\$(Configuration)\ @@ -92,13 +95,13 @@ Disabled WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions) true - C:\libusbK-dev-kit\includes;$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories) + $(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories) Windows true - Version.lib;libusbK.lib - C:\libusbK-dev-kit\bin\lib\x86;$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories) + Version.lib;libusbK.lib;%(AdditionalDependencies) + $(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories) $(OutDir)$(TargetName)$(TargetExt) @@ -119,14 +122,13 @@ Disabled _WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true - C:\libusbK-dev-kit\includes\;$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories) + $(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories) Windows true - $(OutDir)$(TargetName)$(TargetExt) - C:\libusbK-dev-kit\bin\lib\amd64\;$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories) - libusbK.lib + $(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories) + Version.lib;libusbK.lib;%(AdditionalDependencies) false @@ -148,14 +150,14 @@ true WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) true - C:\libusbK-dev-kit\includes;$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories) + $(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories) Windows true true true - C:\libusbK-dev-kit\bin\lib\x86;$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories) + $(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories) Version.lib;libusbK.lib;%(AdditionalDependencies) AsInvoker true