shell32: Create trash test file in temp directory.
This commit is contained in:
parent
a872c21a48
commit
814ab9ee46
|
@ -55,8 +55,7 @@ static void test_query_recyclebin(void)
|
|||
HRESULT hr;
|
||||
HANDLE file;
|
||||
SHFILEOPSTRUCTA shfo;
|
||||
const CHAR name[] = "test.txt";
|
||||
CHAR buf[MAX_PATH + sizeof(name) + 1];
|
||||
CHAR temp_path[MAX_PATH-14], buf[MAX_PATH+1];
|
||||
if(!pSHQueryRecycleBinA)
|
||||
{
|
||||
skip("SHQueryRecycleBinA does not exist\n");
|
||||
|
@ -67,18 +66,17 @@ static void test_query_recyclebin(void)
|
|||
skip("SHFileOperationA does not exist\n");
|
||||
return;
|
||||
}
|
||||
GetCurrentDirectoryA(MAX_PATH, buf);
|
||||
strcat(buf,"\\");
|
||||
strcat(buf,name);
|
||||
ok(GetTempPathA(sizeof(temp_path), temp_path), "GetTempPath failed\n");
|
||||
ok(GetTempFileNameA(temp_path, "trash", 0, buf), "GetTempFileName failed\n");
|
||||
buf[strlen(buf) + 1] = '\0';
|
||||
hr = pSHQueryRecycleBinA(buf,&info1);
|
||||
ok(hr == S_OK, "SHQueryRecycleBinA failed with error 0x%x\n", hr);
|
||||
ok(info1.i64Size!=0xdeadbeef,"i64Size not set\n");
|
||||
ok(info1.i64NumItems!=0xdeadbeef,"i64NumItems not set\n");
|
||||
/*create and send a file to the recycle bin*/
|
||||
file = CreateFileA(name,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
|
||||
ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n",name);
|
||||
WriteFile(file,name,strlen(name),&written,NULL);
|
||||
file = CreateFileA(buf,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
|
||||
ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n",buf);
|
||||
WriteFile(file,buf,strlen(buf),&written,NULL);
|
||||
CloseHandle(file);
|
||||
shfo.hwnd = NULL;
|
||||
shfo.wFunc = FO_DELETE;
|
||||
|
|
Loading…
Reference in New Issue