kernel32/tests : added tests for copyfileex try4
Alexandre Julliard
julliard at winehq.org
Thu Jan 17 14:09:27 CST 2013
Patrick Rudolph <siro at 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.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list