ReactOS 0.4.15-dev-7942-gd23573b
recyclebin.c File Reference
#include <windows.h>
#include "shellapi.h"
#include <stdio.h>
#include "wine/test.h"
Include dependency graph for recyclebin.c:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 

Functions

static int (WINAPI *pSHQueryRecycleBinA)(LPCSTR
 
static void setup_pointers (void)
 
static void test_query_recyclebin (void)
 
 START_TEST (recyclebin)
 

Variables

static LPSHQUERYRBINFO
 

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 21 of file recyclebin.c.

Function Documentation

◆ int()

static int ( WINAPI pSHQueryRecycleBinA)
static

◆ setup_pointers()

static void setup_pointers ( void  )
static

Definition at line 31 of file recyclebin.c.

32{
33 HMODULE hshell32 = GetModuleHandleA("shell32.dll");
34 pSHQueryRecycleBinA = (void*)GetProcAddress(hshell32, "SHQueryRecycleBinA");
35 pSHFileOperationA = (void*)GetProcAddress(hshell32, "SHFileOperationA");
36}
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( recyclebin  )

Definition at line 84 of file recyclebin.c.

85{
88}
static void test_query_recyclebin(void)
Definition: recyclebin.c:38
static void setup_pointers(void)
Definition: recyclebin.c:31

◆ test_query_recyclebin()

static void test_query_recyclebin ( void  )
static

Definition at line 38 of file recyclebin.c.

39{
40 SHQUERYRBINFO info1={sizeof(info1),0xdeadbeef,0xdeadbeef};
41 SHQUERYRBINFO info2={sizeof(info2),0xdeadbeef,0xdeadbeef};
42 UINT written;
43 HRESULT hr;
45 SHFILEOPSTRUCTA shfo;
47 if(!pSHQueryRecycleBinA)
48 {
49 skip("SHQueryRecycleBinA does not exist\n");
50 return;
51 }
52 if(!pSHFileOperationA)
53 {
54 skip("SHFileOperationA does not exist\n");
55 return;
56 }
57 ok(GetTempPathA(sizeof(temp_path), temp_path), "GetTempPath failed\n");
58 ok(GetTempFileNameA(temp_path, "trash", 0, buf), "GetTempFileName failed\n");
59 buf[strlen(buf) + 1] = '\0';
60 hr = pSHQueryRecycleBinA(buf,&info1);
61 ok(hr == S_OK, "SHQueryRecycleBinA failed with error 0x%x\n", hr);
62 ok(info1.i64Size!=0xdeadbeef,"i64Size not set\n");
63 ok(info1.i64NumItems!=0xdeadbeef,"i64NumItems not set\n");
64 /*create and send a file to the recycle bin*/
66 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n",buf);
67 WriteFile(file,buf,strlen(buf),&written,NULL);
69 shfo.hwnd = NULL;
70 shfo.wFunc = FO_DELETE;
71 shfo.pFrom = buf;
72 shfo.pTo = NULL;
74 shfo.hNameMappings = NULL;
76 ok(!pSHFileOperationA(&shfo), "Deletion was not successful\n");
77 hr = pSHQueryRecycleBinA(buf,&info2);
78 ok(hr == S_OK, "SHQueryRecycleBinA failed with error 0x%x\n", hr);
79 ok(info2.i64Size==info1.i64Size+written,"Expected recycle bin to have 0x%s bytes\n",wine_dbgstr_longlong(info1.i64Size+written));
80 ok(info2.i64NumItems==info1.i64NumItems+1,"Expected recycle bin to have 0x%s items\n",wine_dbgstr_longlong(info1.i64NumItems+1));
81}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define NULL
Definition: types.h:112
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2054
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define S_OK
Definition: intsafe.h:52
#define CREATE_ALWAYS
Definition: disk.h:72
char temp_path[MAX_PATH]
Definition: mspatcha.c:123
unsigned int UINT
Definition: ndis.h:50
#define GENERIC_WRITE
Definition: nt_native.h:90
#define FOF_ALLOWUNDO
Definition: shellapi.h:147
#define FO_DELETE
Definition: shellapi.h:138
#define FOF_FILESONLY
Definition: shellapi.h:148
#define FOF_NOCONFIRMATION
Definition: shellapi.h:145
#define FOF_SILENT
Definition: shellapi.h:143
HRESULT hr
Definition: shlfolder.c:183
PVOID hNameMappings
Definition: shellapi.h:351
LPCSTR lpszProgressTitle
Definition: shellapi.h:352
FILEOP_FLAGS fFlags
Definition: shellapi.h:349
__int64 i64Size
Definition: shellapi.h:380
__int64 i64NumItems
Definition: shellapi.h:381
Definition: fci.c:127
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().

Variable Documentation

◆ LPSHQUERYRBINFO

Definition at line 28 of file recyclebin.c.