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");
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
int main(int argc, char *argv[])
#define MOVEFILE_REPLACE_EXISTING
#define MOVEFILE_COPY_ALLOWED
static void CheckTestFile(LPCTSTR filename, DWORD attributes)
__cdecl __MINGW_NOTHROW char * dirname(char *)
#define INVALID_HANDLE_VALUE
DWORD WINAPI GetLastError(VOID)
#define ERROR_ACCESS_DENIED
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define GetCurrentDirectory
#define ERROR_FILE_NOT_FOUND
static void DeleteTestDir(LPCTSTR dirname)
#define SetFileAttributes
#define FILE_ATTRIBUTE_READONLY
static void CreateTestFile(LPCTSTR filename, DWORD attributes)
#define INVALID_FILE_ATTRIBUTES
#define FILE_ATTRIBUTE_ARCHIVE
#define FILE_ATTRIBUTE_NORMAL
#define GetFileAttributes
DWORD WINAPI GetLogicalDrives(VOID)
IN OUT PVCB OUT PDIRENT OUT PBCB IN BOOLEAN CreateFile
static void CreateTestDir(LPCTSTR dirname)
#define ReadFile(a, b, c, d, e)
static TCHAR FindOtherDrive()
#define ERROR_NOT_SAME_DEVICE
static void DeleteTestFile(LPCTSTR filename)
#define ERROR_ALREADY_EXISTS
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)