#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include <windows.h>
Go to the source code of this file.
◆ CheckTestFile()
Definition at line 92 of file copymove.c.
93{
99
102 0,
105 0,
106 0);
107
111 }
112
116 }
120 }
125 }
126 }
127
129
134 }
135 if (diskattr != attributes) {
136 fprintf(
stderr,
"Attribute mismatch, expected 0x%08lx found 0x%08lx\n", attributes, diskattr);
138 }
139}
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define INVALID_FILE_ATTRIBUTES
DWORD WINAPI GetLastError(void)
#define GetFileAttributes
Referenced by main().
◆ CreateTestDir()
Definition at line 83 of file copymove.c.
84{
88 }
89}
__cdecl __MINGW_NOTHROW char * dirname(char *)
Referenced by main().
◆ CreateTestFile()
Definition at line 41 of file copymove.c.
42{
47
51 0,
54 0,
55 0);
56
60 }
63 }
67 }
69
73 }
74}
static void DeleteTestFile(LPCTSTR filename)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
#define SetFileAttributes
Referenced by main().
◆ DeleteTestDir()
◆ DeleteTestFile()
◆ FindOtherDrive()
static TCHAR FindOtherDrive |
( |
| ) |
|
|
static |
Definition at line 12 of file copymove.c.
13{
19
22 if (0 != (drives & (1 << (
drive -
_T(
'A'))))&&
26 }
27 }
28 }
29
30 return found ?
drive - 1 :
_T(
' ' );
31}
DWORD WINAPI GetLogicalDrives(void)
#define GetCurrentDirectory
Referenced by main().
◆ main()
Definition at line 142 of file copymove.c.
143{
145 TCHAR otherfile[ ] =
_T(
"?:\\other.dat");
146
148
149 printf(
"Testing simple move\n");
155 }
158
159 printf(
"Testing move of non-existing file\n");
168 }
170
171
172#if 0
173 printf(
"Testing move to existing file\n");
182 }
185#endif
186
187
188#if 0
189 printf(
"Testing directory move\n");
196 }
200#endif
201
202 printf(
"Testing file move to different directory\n");
208 }
212
213 printf(
"Testing move of read-only file\n");
219 }
222
223 printf(
"Testing move to different drive\n");
224 if (
_T(
' ') != otherdrive) {
225 otherfile[0] = otherdrive;
231 }
234 } else {
235 printf(
" Test skipped, no other drive available\n");
236 }
237
238 printf(
"Testing move/overwrite of existing file\n");
244 }
247
248
249#if 0
250 printf(
"Testing move/overwrite of existing readonly file\n");
254 fprintf(
stderr,
"MoveFileEx succeeded but shouldn't have\n");
260 }
263#endif
264
265
266#if 0
267 printf(
"Testing move to different drive without COPY_ALLOWED\n");
268 if (
_T(
' ') != otherdrive) {
269 otherfile[0] = otherdrive;
273 fprintf(
stderr,
"MoveFileEx succeeded but shouldn't have\n");
278 }
280 } else {
281 printf(
" Test skipped, no other drive available\n");
282 }
283#endif
284
285 printf(
"Testing move to different drive with COPY_ALLOWED\n");
286 if (
_T(
' ') != otherdrive) {
287 otherfile[0] = otherdrive;
293 }
296 } else {
297 printf(
" Test skipped, no other drive available\n");
298 }
299
300 printf(
"All tests successfully completed\n");
301
302 return 0;
303}
static void CheckTestFile(LPCTSTR filename, DWORD attributes)
static void CreateTestFile(LPCTSTR filename, DWORD attributes)
static void CreateTestDir(LPCTSTR dirname)
static TCHAR FindOtherDrive()
static void DeleteTestDir(LPCTSTR dirname)
#define ERROR_ACCESS_DENIED
#define MOVEFILE_REPLACE_EXISTING
#define MOVEFILE_COPY_ALLOWED
#define ERROR_ALREADY_EXISTS
#define ERROR_FILE_NOT_FOUND
#define FILE_ATTRIBUTE_READONLY
#define FILE_ATTRIBUTE_ARCHIVE
#define ERROR_NOT_SAME_DEVICE