summaryrefslogtreecommitdiff
path: root/zen/IFileOperation/file_op.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:19:49 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:19:49 +0200
commitc8e0e909b4a8d18319fc65434a10dc446434817c (patch)
treeeee91e7d2ce229dd043811eae8f1e2bd78061916 /zen/IFileOperation/file_op.h
parent5.2 (diff)
downloadFreeFileSync-c8e0e909b4a8d18319fc65434a10dc446434817c.tar.gz
FreeFileSync-c8e0e909b4a8d18319fc65434a10dc446434817c.tar.bz2
FreeFileSync-c8e0e909b4a8d18319fc65434a10dc446434817c.zip
5.3
Diffstat (limited to 'zen/IFileOperation/file_op.h')
-rw-r--r--zen/IFileOperation/file_op.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/zen/IFileOperation/file_op.h b/zen/IFileOperation/file_op.h
new file mode 100644
index 00000000..fb157301
--- /dev/null
+++ b/zen/IFileOperation/file_op.h
@@ -0,0 +1,76 @@
+// **************************************************************************
+// * 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) ZenJu (zhnmju123 AT gmx DOT de) - All Rights Reserved *
+// **************************************************************************
+
+#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
+
+#include <zen/build_info.h>
+
+
+namespace fileop
+{
+/*--------------
+ |declarations|
+ --------------*/
+
+//COM needs to be initialized before calling any of these functions! CoInitializeEx/CoUninitialize
+//minimum OS: Windows Vista or later
+
+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);
+
+FILE_OP_DLL_API
+bool checkRecycler(const wchar_t* dirname, bool& isRecycler); //returns false on error
+
+FILE_OP_DLL_API
+bool getLockingProcesses(const wchar_t* filename, const wchar_t*& procList); //get list of processes as single string, call freeString(procList) after use!
+
+FILE_OP_DLL_API
+void freeString(const wchar_t* str);
+
+//get last error message if any of the functions above fail
+FILE_OP_DLL_API
+const wchar_t* getLastError(); //no nullptr check required!
+
+/*----------
+ |typedefs|
+ ----------*/
+typedef bool (*FunType_moveToRecycleBin)(const wchar_t* fileNames[], size_t fileNo);
+typedef bool (*FunType_copyFile)(const wchar_t* sourceFile, const wchar_t* targetFile);
+typedef bool (*FunType_checkRecycler)(const wchar_t* dirname, bool& isRecycler);
+typedef bool (*FunType_getLockingProcesses)(const wchar_t* filename, const wchar_t*& procList);
+typedef void (*FunType_freeString)(const wchar_t* str);
+typedef const wchar_t* (*FunType_getLastError)();
+
+/*--------------
+ |symbol names|
+ --------------*/
+//(use const pointers to ensure internal linkage)
+const char funName_moveToRecycleBin [] = "moveToRecycleBin";
+const char funName_copyFile [] = "copyFile";
+const char funName_checkRecycler [] = "checkRecycler";
+const char funName_getLockingProcesses[] = "getLockingProcesses";
+const char funName_freeString [] = "freeString";
+const char funName_getLastError [] = "getLastError";
+
+/*---------------
+ |library names|
+ ---------------*/
+inline const wchar_t* getDllName() { return zen::is64BitBuild ? L"FileOperation_x64.dll" : L"FileOperation_Win32.dll"; }
+}
+
+#endif //RECYCLER_DLL_H
bgstack15