Patrick Rudolph siro@das-labor.org writes:
- if(!GetTempPathA( MAX_PATH,tmppath ))
- {
win_skip("GetTempPathA failed\n");
return;
- }
- if(!GetTempFileNameA( tmppath,"CopyFileExAin",0,source_name ))
- {
win_skip("GetTempFileNameA failed\n");
return;
- }
- if(!GetTempFileNameA( tmppath,"CopyFileExAout",0,dest_name ))
- {
win_skip("GetTempFileNameA failed\n");
return;
- }
- source_handle = CreateFileA( source_name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 );
- if(!source_handle)
- {
win_skip("CreateFileA failed, no write permissions ?\n");
return;
- }
+#define COPYFILEEXFILESIZE 10000000
- /* create a dummy file for copy tests */
- buffer = malloc(COPYFILEEXFILESIZE);
- if(!WriteFile(source_handle,buffer,COPYFILEEXFILESIZE,&ret,NULL))
- {
free(buffer);
win_skip("WriteFile failed, enough free disk space ?\n");
return;
- }
- free(buffer);
- CloseHandle(source_handle);
There are better ways to create a test file than writing 10Mb of uninitialized data. Also you should check how GetTempFileName works.