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