22 if (0 != (drives & (1 << (
drive -
_T(
'A'))))&&
30 return found ?
drive - 1 :
_T(
' ' );
135 if (diskattr != attributes) {
136 fprintf(
stderr,
"Attribute mismatch, expected 0x%08lx found 0x%08lx\n", attributes, diskattr);
145 TCHAR otherfile[ ] =
_T(
"?:\\other.dat");
149 printf(
"Testing simple move\n");
159 printf(
"Testing move of non-existing file\n");
173 printf(
"Testing move to existing file\n");
189 printf(
"Testing directory move\n");
202 printf(
"Testing file move to different directory\n");
213 printf(
"Testing move of read-only file\n");
223 printf(
"Testing move to different drive\n");
224 if (
_T(
' ') != otherdrive) {
225 otherfile[0] = otherdrive;
235 printf(
" Test skipped, no other drive available\n");
238 printf(
"Testing move/overwrite of existing file\n");
250 printf(
"Testing move/overwrite of existing readonly file\n");
254 fprintf(
stderr,
"MoveFileEx succeeded but shouldn't have\n");
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");
281 printf(
" Test skipped, no other drive available\n");
285 printf(
"Testing move to different drive with COPY_ALLOWED\n");
286 if (
_T(
' ') != otherdrive) {
287 otherfile[0] = otherdrive;
297 printf(
" Test skipped, no other drive available\n");
300 printf(
"All tests successfully completed\n");
static void DeleteTestFile(LPCTSTR filename)
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 ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define FILE_ATTRIBUTE_NORMAL
#define ERROR_ACCESS_DENIED
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
#define MOVEFILE_REPLACE_EXISTING
#define MOVEFILE_COPY_ALLOWED
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
__cdecl __MINGW_NOTHROW char * dirname(char *)
#define ERROR_ALREADY_EXISTS
#define ERROR_FILE_NOT_FOUND
#define FILE_ATTRIBUTE_READONLY
#define FILE_ATTRIBUTE_ARCHIVE
#define INVALID_FILE_ATTRIBUTES
DWORD WINAPI GetLastError(void)
#define GetFileAttributes
DWORD WINAPI GetLogicalDrives(void)
#define SetFileAttributes
#define GetCurrentDirectory
#define ERROR_NOT_SAME_DEVICE