ReactOS 0.4.15-dev-7958-gcd0bb1a
movefile.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS pending moves operations interactions tool
4 * FILE: cmdutils/movefile/movefile.c
5 * PURPOSE: Queue move operations for next reboot
6 * PROGRAMMERS: Pierre Schweitzer <pierre@reactos.org>
7 */
8
9#include <windows.h>
10#include <tchar.h>
11#include <stdio.h>
12
13int
15_tmain(int argc, const TCHAR *argv[])
16{
17 /* We need source + target */
18 if (argc < 3)
19 {
20 _ftprintf(stderr, _T("Missing arguments\nUsage: %s source target\nUse \"\" as target is you want deletion\n"), argv[0]);
21 return 1;
22 }
23
24 /* If target is empty, it means deletion, so provide null pointer */
25 if (!MoveFileEx(argv[1], (argv[2][0] == 0 ? NULL : argv[2]), MOVEFILE_DELAY_UNTIL_REBOOT))
26 {
27 _ftprintf(stderr, _T("Error: %d\n"), GetLastError());
28 return 1;
29 }
30
31 return 0;
32}
static int argc
Definition: ServiceArgs.c:12
#define __cdecl
Definition: accygwin.h:79
#define NULL
Definition: types.h:112
#define stderr
Definition: stdio.h:100
#define _tmain
Definition: tchar.h:497
#define _ftprintf
Definition: tchar.h:518
#define argv
Definition: mplay32.c:18
#define _T(x)
Definition: vfdio.h:22
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define MoveFileEx
Definition: winbase.h:3878
#define MOVEFILE_DELAY_UNTIL_REBOOT
Definition: winbase.h:400
char TCHAR
Definition: xmlstorage.h:189