summaryrefslogtreecommitdiff
path: root/shared/IFileOperation/fileOp.h
blob: 8fa6a75b40874ecc2570f2cc70113f71954339f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// **************************************************************************
// * This file is part of the FreeFileSync project. It is distributed under *
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html       *
// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de)                    *
// **************************************************************************
//
#ifndef RECYCLER_DLL_H
#define RECYCLER_DLL_H

#ifdef FILE_OP_DLL_EXPORTS
#define FILE_OP_DLL_API extern "C" __declspec(dllexport)
#else
#define FILE_OP_DLL_API extern "C" __declspec(dllimport)
#endif


namespace FileOp
{
//COM needs to be initialized before calling any of these functions! CoInitializeEx/CoUninitialize

FILE_OP_DLL_API
bool moveToRecycleBin(const wchar_t* fileNames[],
                      size_t         fileNo); //size of fileNames array

FILE_OP_DLL_API
bool copyFile(const wchar_t* sourceFile,
              const wchar_t* targetFile);

//if any of the functions above returns 'false', this message returns last error
FILE_OP_DLL_API
void getLastError(wchar_t* errorMessage, size_t errorBufferLen);


//function typedefs
typedef bool (*MoveToRecycleBinFct)(const wchar_t* fileNames[], size_t fileNo);									
typedef bool (*CopyFileFct)(const wchar_t* sourceFile, const wchar_t* targetFile);							
typedef void (*GetLastErrorFct)(wchar_t* errorMessage, size_t errorBufferLen);

//function names (use const pointers to ensure internal linkage)
const char* const moveToRecycleBinFctName = "moveToRecycleBin";
const char* const copyFileFctName         = "copyFile";
const char* const getLastErrorFctName     = "getLastError";
}



#endif //RECYCLER_DLL_H
bgstack15