diff --git a/rosapps/applications/rosinternals/CMakeLists.txt b/rosapps/applications/rosinternals/CMakeLists.txt index 5aa7fbe8733..1932f92bf53 100644 --- a/rosapps/applications/rosinternals/CMakeLists.txt +++ b/rosapps/applications/rosinternals/CMakeLists.txt @@ -1,2 +1,3 @@ +add_subdirectory(movefile) add_subdirectory(ntfsinfo) add_subdirectory(pendmoves) diff --git a/rosapps/applications/rosinternals/movefile/CMakeLists.txt b/rosapps/applications/rosinternals/movefile/CMakeLists.txt new file mode 100644 index 00000000000..ccf0999eb1f --- /dev/null +++ b/rosapps/applications/rosinternals/movefile/CMakeLists.txt @@ -0,0 +1,5 @@ +list(APPEND SOURCE movefile.c movefile.rc) +add_executable(movefile ${SOURCE}) +set_module_type(movefile win32cui UNICODE) +add_importlibs(movefile msvcrt kernel32 ntdll) +add_cd_file(TARGET movefile DESTINATION reactos/system32 FOR all) diff --git a/rosapps/applications/rosinternals/movefile/movefile.c b/rosapps/applications/rosinternals/movefile/movefile.c new file mode 100644 index 00000000000..2559e709ade --- /dev/null +++ b/rosapps/applications/rosinternals/movefile/movefile.c @@ -0,0 +1,32 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS pending moves operations interactions tool + * FILE: cmdutils/movefile/movefile.c + * PURPOSE: Queue move operations for next reboot + * PROGRAMMERS: Pierre Schweitzer + */ + +#include +#include +#include + +int +__cdecl +_tmain(int argc, const TCHAR *argv[]) +{ + /* We need source + target */ + if (argc < 3) + { + _ftprintf(stderr, _T("Missing arguments\nUsage: %s source target\nUse \"\" as target is you want deletion\n"), argv[0]); + return 1; + } + + /* If target is empty, it means deletion, so provide null pointer */ + if (!MoveFileEx(argv[1], (argv[2][0] == 0 ? NULL : argv[2]), MOVEFILE_DELAY_UNTIL_REBOOT)) + { + _ftprintf(stderr, _T("Error: %d\n"), GetLastError()); + return 1; + } + + return 0; +} diff --git a/rosapps/applications/rosinternals/movefile/movefile.rc b/rosapps/applications/rosinternals/movefile/movefile.rc new file mode 100644 index 00000000000..b22d7cbdb17 --- /dev/null +++ b/rosapps/applications/rosinternals/movefile/movefile.rc @@ -0,0 +1,4 @@ +#define REACTOS_STR_FILE_DESCRIPTION "Queue move operations for next reboot\0" +#define REACTOS_STR_INTERNAL_NAME "movefile\0" +#define REACTOS_STR_ORIGINAL_FILENAME "movefile.exe\0" +#include