summaryrefslogtreecommitdiff
path: root/plugins/PluginLoader
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2013-01-04 14:50:19 +0100
committerThomas Preud'homme <robotux@celest.fr>2013-01-04 14:50:19 +0100
commit8f9f382e1c97cab2e72e97495650c73ac4b97314 (patch)
tree78510a0d81368c09b56f444fb19bb132c8bc3009 /plugins/PluginLoader
Imported Upstream version 0.3.0.5
Diffstat (limited to 'plugins/PluginLoader')
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/DebugEngineMacro.h25
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Environment.h11
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/PlatformMacro.h1
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/StructEnumDefinition.h1
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Variable.h16
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/documentation.dox34
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/informations.xml27
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/pluginLoader.cpp464
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/pluginLoader.h50
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/pluginLoader.pro17
10 files changed, 646 insertions, 0 deletions
diff --git a/plugins/PluginLoader/catchcopy-v0002/DebugEngineMacro.h b/plugins/PluginLoader/catchcopy-v0002/DebugEngineMacro.h
new file mode 100755
index 0000000..ad08d4f
--- /dev/null
+++ b/plugins/PluginLoader/catchcopy-v0002/DebugEngineMacro.h
@@ -0,0 +1,25 @@
+/** \file DebugEngineMacro.h
+\brief Define the macro for the debug
+\author alpha_one_x86
+\version 0.3
+\date 2010 */
+
+#ifndef DEBUGENGINEMACRO_H
+#define DEBUGENGINEMACRO_H
+
+/// \brief Macro for the debug log
+#ifdef ULTRACOPIER_PLUGIN_DEBUG
+ #if defined (__FILE__) && defined (__LINE__)
+ #define ULTRACOPIER_DEBUGCONSOLE(a,b) emit debugInformation(a,__func__,b,__FILE__,__LINE__)
+ #else
+ #define ULTRACOPIER_DEBUGCONSOLE(a,b) emit debugInformation(a,__func__,b)
+ #endif
+#else // ULTRACOPIER_PLUGIN_DEBUG
+ #define ULTRACOPIER_DEBUGCONSOLE(a,b) void()
+#endif // ULTRACOPIER_PLUGIN_DEBUG
+
+#endif // DEBUGENGINEMACRO_H
+
+
+
+
diff --git a/plugins/PluginLoader/catchcopy-v0002/Environment.h b/plugins/PluginLoader/catchcopy-v0002/Environment.h
new file mode 100755
index 0000000..94fd104
--- /dev/null
+++ b/plugins/PluginLoader/catchcopy-v0002/Environment.h
@@ -0,0 +1,11 @@
+/** \file Environment.h
+\brief Define the environment variable and global function
+\author alpha_one_x86
+\version 0.3
+\date 2010 */
+
+#include "Variable.h"
+/// \brief The global include
+#include "StructEnumDefinition.h"
+#include "DebugEngineMacro.h"
+
diff --git a/plugins/PluginLoader/catchcopy-v0002/PlatformMacro.h b/plugins/PluginLoader/catchcopy-v0002/PlatformMacro.h
new file mode 100644
index 0000000..f7586b0
--- /dev/null
+++ b/plugins/PluginLoader/catchcopy-v0002/PlatformMacro.h
@@ -0,0 +1 @@
+#include "../../../PlatformMacro.h"
diff --git a/plugins/PluginLoader/catchcopy-v0002/StructEnumDefinition.h b/plugins/PluginLoader/catchcopy-v0002/StructEnumDefinition.h
new file mode 100644
index 0000000..c1758f4
--- /dev/null
+++ b/plugins/PluginLoader/catchcopy-v0002/StructEnumDefinition.h
@@ -0,0 +1 @@
+#include "../../../StructEnumDefinition.h"
diff --git a/plugins/PluginLoader/catchcopy-v0002/Variable.h b/plugins/PluginLoader/catchcopy-v0002/Variable.h
new file mode 100755
index 0000000..8179c93
--- /dev/null
+++ b/plugins/PluginLoader/catchcopy-v0002/Variable.h
@@ -0,0 +1,16 @@
+/** \file Variable.h
+\brief Define the environment variable
+\author alpha_one_x86
+\version 0.3
+\date 2010 */
+
+#ifndef VARIABLE_H
+#define VARIABLE_H
+
+//Un-comment this next line to put ultracopier plugin in debug mode
+#define ULTRACOPIER_PLUGIN_DEBUG
+
+#endif // VARIABLE_H
+
+
+
diff --git a/plugins/PluginLoader/catchcopy-v0002/documentation.dox b/plugins/PluginLoader/catchcopy-v0002/documentation.dox
new file mode 100755
index 0000000..e8aaaa7
--- /dev/null
+++ b/plugins/PluginLoader/catchcopy-v0002/documentation.dox
@@ -0,0 +1,34 @@
+/* -*- mode: C++ ; c-file-style: "stroustrup" -*- **/
+
+/*
+ This file contains NO source code, just some documentation for doxygen to
+ parse.
+*/
+
+/*!
+ \mainpage catchcopy-v0002
+
+ \section mainpage_overview Overview
+
+ Is the plugin to load the catchcopy plugin into the windows file manager.\n
+ More informations on <a href="http://ultracopier-wiki.first-world.info/">the wiki of ultracopier</a>. Is part of Ultracopier 0.3 project.
+
+ \section mainpage_platforms Platforms
+
+ This plugin might be usable in all environments where you find Qt 4.\n
+ To be compatible with the official Ultracopier plugins, you need compil it with Gcc, Qt4.8, and same env as Ultracopier have been compiled, see the documentation.
+
+ \section mainpage_downloads Downloads
+
+ You can found link on <a href="http://ultracopier.first-world.info/">Ultracopier (Supercopier/Teracopy)</a> project page, via git, snapshot sources, ...
+
+ \section mainpage_algorithm Requirements
+
+ You can see the documentation on <a href="http://catchcopy.first-world.info/">Catchcopy web site</a>. It use catchcopy32.dll/catchcopy64.dll as explorer plugin for the windows's file manager. Need it into the plugins.\n
+ In function if Ultracopier is compiled by portable version, try load the dll by other way.
+
+ \section license GPL Version 3
+ The code source is under GPL3. The image is extacted from Oxygen icon pack of KDE4.
+
+*/
+
diff --git a/plugins/PluginLoader/catchcopy-v0002/informations.xml b/plugins/PluginLoader/catchcopy-v0002/informations.xml
new file mode 100755
index 0000000..fb92607
--- /dev/null
+++ b/plugins/PluginLoader/catchcopy-v0002/informations.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package>
+ <title xml:lang="en"><![CDATA[Plugin loader for catchcopy v0002]]></title><!-- english is required -->
+ <title xml:lang="fr"><![CDATA[Chargeur de plugin pour catchcopy v0002]]></title>
+ <!-- What kind of plugin this is -->
+ <category>PluginLoader</category>
+ <!-- Who wrote this plugin -->
+ <author><![CDATA[BRULE Herman, alpha_one_x86 (alpha_one_x86@first-world.info)]]></author>
+ <!-- URL of page or site for this plugin (may provide additional information, bug reports, feature requests). -->
+ <website xml:lang="en"><![CDATA[http://ultracopier.first-world.info/]]></website><!-- not required -->
+ <website xml:lang="fr"><![CDATA[http://ultracopier-fr.first-world.info/]]></website><!-- not required -->
+ <!-- the date-time format should be in timestamps format -->
+ <pubDate>1287496800</pubDate>
+ <!-- the architecture code of this plugin, found PlatformMacro.h into ultracopier source -->
+ <architecture>linux-x86_64-pc</architecture>
+ <!-- Detailed description -->
+ <description xml:lang="en"><![CDATA[Plugin loader for catchcopy v0002. Allow to receive copy list from plugin/explorer compatible with catchcopy.]]></description>
+ <description xml:lang="fr"><![CDATA[Chargeur de plugin pour catchcopy v0002. Permet de recevoir un liste de copie venant d'un plugin/explorateur avec catchcopy.]]></description>
+ <!-- Version of this release of this plugin, need be like that's: A.B.C.D, where A, B, C and D is number -->
+ <version>0.3.0.5</version>
+ <!-- This internal name should never change, because it is used to detect when a particular plugin is updated. It must comprise only lower case ASCII characters (a-z), numerical digits (0-9), "-", "." or "_", and it must be be unique within the category. And have size lower than 64 char. -->
+ <name>catchcopy-v0002</name>
+ <!-- Dependency checking. This is used to check when a plugin may not be compatible with an updated version of either Ultracopier or another plugin. This example only checks Ultracopier. -->
+ <dependencies><![CDATA[
+ >=ultracopier-0.3.0.5
+ ]]></dependencies>
+</package> \ No newline at end of file
diff --git a/plugins/PluginLoader/catchcopy-v0002/pluginLoader.cpp b/plugins/PluginLoader/catchcopy-v0002/pluginLoader.cpp
new file mode 100755
index 0000000..f4d5b01
--- /dev/null
+++ b/plugins/PluginLoader/catchcopy-v0002/pluginLoader.cpp
@@ -0,0 +1,464 @@
+/** \file session-loader.cpp
+\brief Define the session plugin loader test
+\author alpha_one_x86
+\version 0.3
+\date 2010 */
+
+#include "pluginLoader.h"
+#include "PlatformMacro.h"
+
+#ifdef ULTRACOPIER_PLUGIN_DEBUG
+ #define CATCHCOPY_DLL_32 "catchcopy32d.dll"
+ #define CATCHCOPY_DLL_64 "catchcopy64d.dll"
+#else
+ #define CATCHCOPY_DLL_32 "catchcopy32.dll"
+ #define CATCHCOPY_DLL_64 "catchcopy64.dll"
+#endif
+
+PluginLoader::PluginLoader()
+{
+ //set the startup value into the variable
+ dllChecked=false;
+
+ needBeRegistred=false;
+}
+
+PluginLoader::~PluginLoader()
+{
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"destructor");
+ setEnabled(false);
+}
+
+void PluginLoader::setEnabled(bool needBeRegistred)
+{
+ if(!checkExistsDll())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("No dll exists"));
+ emit newState(Uncaught);
+ return;
+ }
+ if(this->needBeRegistred==needBeRegistred)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("Double event dropped"));
+ return;
+ }
+ this->needBeRegistred=needBeRegistred;
+ int index=0;
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, needBeRegistred: "+QString::number(needBeRegistred));
+
+ bool oneHaveFound=false;
+ index=0;
+ while(index<importantDll.size())
+ {
+ if(QFile::exists(pluginPath+importantDll.at(index)))
+ {
+ oneHaveFound=true;
+ break;
+ }
+ index++;
+ }
+ if(!oneHaveFound)
+ {
+ index=0;
+ while(index<secondDll.size())
+ {
+ if(QFile::exists(pluginPath+secondDll.at(index)))
+ {
+ oneHaveFound=true;
+ break;
+ }
+ index++;
+ }
+ }
+ if(!oneHaveFound)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("No dll have found"));
+ emit newState(Uncaught);
+ return;
+ }
+
+ index=0;
+ bool importantDll_is_loaded=false,secondDll_is_loaded=false;
+ bool importantDll_have_bug=false,secondDll_have_bug=false;
+ int importantDll_count=0,secondDll_count=0;
+ while(index<importantDll.size())
+ {
+ if(!RegisterShellExtDll(pluginPath+importantDll.at(index),needBeRegistred,false))
+ {
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"the important dll have failed: "+importantDll.at(index));
+ importantDll_have_bug=true;
+ }
+ else
+ {
+ importantDll_is_loaded=true;
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"the important dll have been loaded: "+importantDll.at(index));
+ }
+ importantDll_count++;
+ index++;
+ }
+ index=0;
+ while(index<secondDll.size())
+ {
+ if(!RegisterShellExtDll(pluginPath+secondDll.at(index),needBeRegistred,true))
+ {
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"the second dll have failed: "+secondDll.at(index));
+ secondDll_have_bug=true;
+ }
+ else
+ {
+ secondDll_is_loaded=true;
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"the second dll have been loaded: "+secondDll.at(index));
+ }
+ secondDll_count++;
+ index++;
+ }
+
+ CatchState importantDll_state,secondDll_state;
+ if(importantDll_count==0)
+ {
+ if(needBeRegistred)
+ importantDll_state=Caught;
+ else
+ importantDll_state=Uncaught;
+ }
+ else
+ {
+ if(importantDll_is_loaded)
+ {
+ if(!importantDll_have_bug)
+ importantDll_state=Caught;
+ else
+ importantDll_state=Semiuncaught;
+ }
+ else
+ importantDll_state=Uncaught;
+ }
+ if(secondDll_count==0)
+ if(needBeRegistred)
+ secondDll_state=Caught;
+ else
+ secondDll_state=Uncaught;
+ else
+ {
+ if(secondDll_is_loaded)
+ {
+ if(!secondDll_have_bug)
+ secondDll_state=Caught;
+ else
+ secondDll_state=Semiuncaught;
+ }
+ else
+ secondDll_state=Uncaught;
+ }
+
+ if((importantDll_state==Uncaught && secondDll_state==Uncaught) || !needBeRegistred || (importantDll_count==0 && secondDll_count==0))
+ emit newState(Uncaught);
+ else if(importantDll_state==Caught)
+ emit newState(Caught);
+ else
+ emit newState(Semiuncaught);
+}
+
+bool PluginLoader::checkExistsDll()
+{
+ if(dllChecked)
+ {
+ if(importantDll.size()>0 || secondDll.size()>0)
+ return true;
+ else
+ return false;
+ }
+ dllChecked=true;
+
+ #if defined(ULTRACOPIER_VERSION_PORTABLE) || ! defined(_M_X64)
+ bool is64Bits=false;
+ char *arch=getenv("windir");
+ if(arch!=NULL)
+ {
+ QDir dir;
+ if(dir.exists(QString(arch)+"\\SysWOW64\\"))
+ {
+ is64Bits=true;
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,"OS seam 64Bits, "+QString(arch)+"\\SysWOW64\\");
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,"OS seam not 64Bits, "+QString(arch)+"\\SysWOW64\\");
+ /// \note commented because it do a crash at the startup
+ //delete arch;
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"unable to get env var");
+
+ if(!is64Bits)
+ {
+ if((importantDll.size()+secondDll.size())>1)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,"Not load 64Bits dll");
+ importantDll.removeOne(CATCHCOPY_DLL_64);
+ secondDll.removeOne(CATCHCOPY_DLL_64);
+ }
+ }
+ else
+ {
+ QStringList tempList=importantDll;
+ importantDll=secondDll;
+ secondDll=tempList;
+ }
+ #endif
+
+ int index=0;
+ while(index<importantDll.size())
+ {
+ if(!QFile::exists(pluginPath+importantDll.at(index)))
+ {
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"file not found, drop to the list: "+importantDll.at(index));
+ importantDll.removeAt(index);
+ index--;
+ }
+ index++;
+ }
+ index=0;
+ while(index<secondDll.size())
+ {
+ if(!QFile::exists(pluginPath+secondDll.at(index)))
+ {
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"file not found, drop to the list: "+secondDll.at(index));
+ secondDll.removeAt(index);
+ index--;
+ }
+ index++;
+ }
+ if(importantDll.size()>0 || secondDll.size()>0)
+ return true;
+ else
+ return false;
+}
+
+void PluginLoader::setResources(OptionInterface * options,QString writePath,QString pluginPath,bool portableVersion)
+{
+ Q_UNUSED(options);
+ this->pluginPath=pluginPath;
+ if(portableVersion)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("version portable detected"));
+ secondDll << CATCHCOPY_DLL_32 << CATCHCOPY_DLL_64;
+ }
+ else
+ {
+ #if defined(_M_X64)//64Bits
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("64Bits version detected"));
+ importantDll << CATCHCOPY_DLL_64;
+ secondDll << CATCHCOPY_DLL_32;
+ #else//32Bits
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("32Bits version detected"));
+ importantDll << CATCHCOPY_DLL_32;
+ secondDll << CATCHCOPY_DLL_64;
+ #endif
+ }
+}
+
+bool PluginLoader::RegisterShellExtDll(QString dllPath, bool bRegister,bool quiet)
+{
+ ////////////////////////////// First way to load //////////////////////////////
+
+ wchar_t arrayArg[65535];
+ int size_lenght;
+ // first try - load dll and register it manually.
+ HRESULT hResult = S_OK;
+ // if failed - try by loading extension manually (would fail on vista when running as user)
+ hResult = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ if(SUCCEEDED(hResult))
+ {
+ HRESULT (STDAPICALLTYPE *pfn)(void);
+ size_lenght=dllPath.toWCharArray(arrayArg);
+ HINSTANCE hMod = LoadLibrary(arrayArg); // load the dll
+ if(hMod == NULL)
+ hResult = HRESULT_FROM_WIN32(GetLastError());
+ if(SUCCEEDED(hResult) && !hMod)
+ hResult = E_FAIL;
+ if(SUCCEEDED(hResult))
+ {
+ (FARPROC&)pfn = GetProcAddress(hMod, (bRegister ? "DllRegisterServer" : "DllUnregisterServer"));
+ if(pfn == NULL)
+ hResult = E_FAIL;
+ if(SUCCEEDED(hResult))
+ hResult = (*pfn)();
+
+ CoFreeLibrary(hMod);
+ }
+ CoUninitialize();
+ if(SUCCEEDED(hResult) && SCODE_CODE(hResult) != ERROR_ACCESS_DENIED)
+ return true;
+ else
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("fail by LoadLibrary: %1, error code: %2").arg(dllPath).arg((quint32)hResult));
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("fail by CoInitializeEx: %1, error code: %2").arg(dllPath).arg((quint32)hResult));
+
+ ////////////////////////////// Second way to load //////////////////////////////
+ QStringList arguments;
+ arguments.append("/s");
+ if(!bRegister)
+ arguments.append("/u");
+ arguments.append(dllPath);
+ QString argumentsString;
+ for (int i = 0; i < arguments.size(); ++i) {
+ if(argumentsString.isEmpty())
+ argumentsString+=arguments.at(i);
+ else
+ if(i == arguments.size())
+ argumentsString+=" \""+arguments.at(i)+"\"";
+ else
+ argumentsString+=' '+arguments.at(i);
+ }
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start: regsvr32 "+argumentsString);
+ int result=QProcess::execute("regsvr32",arguments);
+ bool ok=false;
+ if(result==0)
+ ok=true;
+ if(result==5)
+ {
+ if(!quiet)
+ {
+ ////////////////////////////// Last way to load //////////////////////////////
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"try it in win32");
+ // try with regsvr32, win32 because for admin dialog
+
+ size_lenght=argumentsString.toWCharArray(arrayArg);
+ //size_lenght*sizeof(wchar_t)
+ wcscpy(arrayArg+size_lenght*sizeof(wchar_t),TEXT("\0"));
+ SHELLEXECUTEINFO sei;
+ memset(&sei, 0, sizeof(sei));
+ sei.cbSize = sizeof(sei);
+ sei.fMask = SEE_MASK_UNICODE;
+ sei.lpVerb = TEXT("runas");
+ sei.lpFile = TEXT("regsvr32.exe");
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"in win32 mode: arrayArg: "+QString::fromWCharArray(arrayArg,size_lenght));
+ sei.lpParameters = arrayArg;
+ sei.nShow = SW_SHOW;
+ ok=ShellExecuteEx(&sei);
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"not try because need be quiet: "+dllPath);
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("regsvr32 terminated with: %1").arg(result));
+ if(!bRegister)
+ HardUnloadDLL(dllPath);
+ return ok;
+}
+
+Q_EXPORT_PLUGIN2(pluginLoader, PluginLoader);
+
+bool WINAPI PluginLoader::DLLEjecteurW(DWORD dwPid,PWSTR szDLLPath)
+{
+ /* Search address of module */
+ MODULEENTRY32W meModule;
+ meModule.dwSize = sizeof(meModule);
+ HANDLE hSnapshot = NULL;
+
+ hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwPid);
+ if(hSnapshot == NULL)
+ return false;
+
+ /* Search the right modules of the process */
+ Module32FirstW(hSnapshot, &meModule);
+ do{
+ if((lstrcmpiW(meModule.szModule,szDLLPath) == 0) || (lstrcmpiW(meModule.szExePath,szDLLPath) == 0))break;
+ }while(Module32NextW(hSnapshot, &meModule));
+
+ /* Get handle of the process */
+ HANDLE hProcess;
+
+ hProcess = OpenProcess(PROCESS_ALL_ACCESS, false,dwPid);
+ if(hProcess == NULL)
+ {
+ CloseHandle(hSnapshot);
+ return false;
+ }
+
+ LPTHREAD_START_ROUTINE lpthThreadFunction;
+ /* Get addresse of FreeLibrary in kernel32.dll */
+ lpthThreadFunction = (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle(L"kernel32.dll"), "FreeLibrary");
+ if(lpthThreadFunction == NULL)
+ {
+ CloseHandle(hProcess);
+ CloseHandle(hSnapshot);
+ return false;
+ }
+
+ /* Creation the remote thread */
+ DWORD dwThreadID = 0;
+ HANDLE hThread = NULL;
+ hThread = CreateRemoteThread(hProcess, NULL, 0, lpthThreadFunction,meModule.modBaseAddr, 0, &dwThreadID);
+ if(hThread == NULL)
+ {
+ CloseHandle(hSnapshot);
+ CloseHandle(hProcess);
+ return false;
+ }
+
+ WaitForSingleObject(hThread,INFINITE);
+
+ CloseHandle(hProcess);
+ CloseHandle(hThread);
+
+ return true;
+}
+
+void PluginLoader::HardUnloadDLL(QString myDllName)
+{
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start: "+myDllName);
+ HANDLE hSnapShot1;
+ PROCESSENTRY32 uProcess;
+ HANDLE hSnapShot2;
+ MODULEENTRY32 me32;
+ QString DllLoaded = "";
+ QString DllLoadedName = "";
+ QString DllLoadedPath = "";
+ bool bResult;
+ bool r;
+ short NbProcess;
+ NbProcess=0;
+
+ hSnapShot1 = CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);
+
+ uProcess.dwSize = (DWORD) sizeof(PROCESSENTRY32);
+
+ r = Process32First(hSnapShot1, &uProcess);
+
+ while ( r )
+ {
+ r = Process32Next(hSnapShot1, &uProcess);
+ QString myProcessName;
+ myProcessName=QString::fromWCharArray(uProcess.szExeFile);
+ if (uProcess.th32ProcessID < 99999)
+ {
+ hSnapShot2 = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, uProcess.th32ProcessID );
+ if (hSnapShot2 != INVALID_HANDLE_VALUE)
+ {
+ me32.dwSize = sizeof(me32);
+ bResult = Module32First( hSnapShot2, &me32 );
+ while( bResult )
+ {
+ DllLoaded=QString::fromWCharArray(me32.szExePath);
+ DllLoadedName=QString::fromWCharArray(me32.szModule);
+ if (DllLoaded == myDllName)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"The path: "+DllLoaded);
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,myProcessName+" ("+QString::number(uProcess.th32ProcessID)+")");
+ DLLEjecteurW(uProcess.th32ProcessID,me32.szExePath);
+ }
+ bResult = Module32Next( hSnapShot2, &me32 );
+ }
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"(int)hSnapShot2 != -1 for "+myProcessName+" ("+QString::number(uProcess.th32ProcessID)+")");
+ if(hSnapShot2)
+ CloseHandle(hSnapShot2);
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"uProcess.th32ProcessID > 99999 for "+myProcessName+" ("+QString::number(uProcess.th32ProcessID)+")");
+ }
+ CloseHandle(hSnapShot1);
+}
diff --git a/plugins/PluginLoader/catchcopy-v0002/pluginLoader.h b/plugins/PluginLoader/catchcopy-v0002/pluginLoader.h
new file mode 100755
index 0000000..9a913e3
--- /dev/null
+++ b/plugins/PluginLoader/catchcopy-v0002/pluginLoader.h
@@ -0,0 +1,50 @@
+/** \file pluginLoader.h
+\brief Define the plugin loader
+\author alpha_one_x86
+\version 0.3
+\date 2010 */
+
+#ifndef PLUGIN_LOADER_TEST_H
+#define PLUGIN_LOADER_TEST_H
+
+#include <QObject>
+#include <QtCore>
+#include <QMessageBox>
+
+#include <QString>
+#include <QStringList>
+#include <QProcess>
+#include <windows.h>
+#include <tlhelp32.h>
+
+#include "../../../interface/PluginInterface_PluginLoader.h"
+#include "Environment.h"
+
+/// \brief \brief Define the plugin loader
+class PluginLoader : public PluginInterface_PluginLoader
+{
+ Q_OBJECT
+ Q_INTERFACES(PluginInterface_PluginLoader)
+public:
+ PluginLoader();
+ ~PluginLoader();
+ void setEnabled(bool);
+ void setResources(OptionInterface * options,QString writePath,QString pluginPath,bool portableVersion);
+private:
+ QString pluginPath;
+ QStringList importantDll,secondDll;
+ bool RegisterShellExtDll(QString dllPath, bool bRegister,bool quiet);
+ bool checkExistsDll();
+ bool dllChecked;
+ bool needBeRegistred;
+ bool WINAPI DLLEjecteurW(DWORD dwPid,PWSTR szDLLPath);
+ void HardUnloadDLL(QString myDllName);
+signals:
+ void newState(CatchState);
+ #ifdef ULTRACOPIER_PLUGIN_DEBUG
+ /// \brief To debug source
+ void debugInformation(DebugLevel level,QString fonction,QString text,QString file,int ligne);
+ #endif
+};
+
+#endif // PLUGIN_LOADER_TEST_H
diff --git a/plugins/PluginLoader/catchcopy-v0002/pluginLoader.pro b/plugins/PluginLoader/catchcopy-v0002/pluginLoader.pro
new file mode 100755
index 0000000..f593fff
--- /dev/null
+++ b/plugins/PluginLoader/catchcopy-v0002/pluginLoader.pro
@@ -0,0 +1,17 @@
+TEMPLATE = lib
+CONFIG += plugin
+HEADERS = \
+ StructEnumDefinition.h \
+ pluginLoader.h \
+ DebugEngineMacro.h \
+ Environment.h \
+ Variable.h \
+ PlatformMacro.h \
+ ../../../interface/PluginInterface_PluginLoader.h
+SOURCES = \
+ pluginLoader.cpp
+TARGET = $$qtLibraryTarget(pluginLoader)
+TRANSLATIONS += Languages/fr/translation.ts
+
+LIBS += -lole32
+