diff options
Diffstat (limited to 'plugins/PluginLoader')
25 files changed, 533 insertions, 85 deletions
diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/ar/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/ar/translation.ts new file mode 100644 index 0000000..c87f684 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/ar/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/de/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/de/translation.ts new file mode 100644 index 0000000..b27aefe --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/de/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="de" sourcelanguage="en"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation>Alle DLLs sind importants</translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/el/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/el/translation.ts new file mode 100644 index 0000000..c87f684 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/el/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/es/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/es/translation.ts new file mode 100644 index 0000000..4629456 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/es/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="es" sourcelanguage="en"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation>Todas las dlls son importantes</translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/fr/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/fr/translation.ts new file mode 100644 index 0000000..40efc6d --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/fr/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="fr" sourcelanguage="en"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation>Toutes les dlls sont importantes</translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/hi/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/hi/translation.ts new file mode 100644 index 0000000..c87f684 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/hi/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/id/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/id/translation.ts new file mode 100644 index 0000000..c87f684 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/id/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/it/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/it/translation.ts new file mode 100644 index 0000000..c87f684 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/it/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/ja/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/ja/translation.ts new file mode 100644 index 0000000..c87f684 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/ja/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/ko/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/ko/translation.ts new file mode 100644 index 0000000..9d16334 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/ko/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="ko_KR"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="+17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/nl/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/nl/translation.ts new file mode 100644 index 0000000..c87f684 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/nl/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/no/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/no/translation.ts new file mode 100644 index 0000000..c87f684 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/no/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/pl/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/pl/translation.ts new file mode 100644 index 0000000..c87f684 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/pl/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/pt/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/pt/translation.ts new file mode 100644 index 0000000..c87f684 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/pt/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/ru/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/ru/translation.ts new file mode 100644 index 0000000..480851d --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/ru/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="ru" sourcelanguage="en"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation>Все библиотеки являются важным</translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/th/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/th/translation.ts new file mode 100644 index 0000000..c87f684 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/th/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/tr/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/tr/translation.ts new file mode 100644 index 0000000..c87f684 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/tr/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/Languages/zh/translation.ts b/plugins/PluginLoader/catchcopy-v0002/Languages/zh/translation.ts new file mode 100644 index 0000000..c87f684 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/Languages/zh/translation.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>OptionsWidget</name> + <message> + <location filename="../../OptionsWidget.ui" line="17"/> + <source>All the dlls are importants</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/plugins/PluginLoader/catchcopy-v0002/OptionsWidget.cpp b/plugins/PluginLoader/catchcopy-v0002/OptionsWidget.cpp new file mode 100755 index 0000000..4d616e4 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/OptionsWidget.cpp @@ -0,0 +1,39 @@ +#include "OptionsWidget.h"
+#include "ui_OptionsWidget.h"
+
+OptionsWidget::OptionsWidget(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::OptionsWidget)
+{
+ ui->setupUi(this);
+}
+
+OptionsWidget::~OptionsWidget()
+{
+ delete ui;
+}
+
+void OptionsWidget::setAllDllIsImportant(bool allDllIsImportant)
+{
+ ui->allDllIsImportant->setChecked(allDllIsImportant);
+}
+
+void OptionsWidget::setDebug(bool Debug)
+{
+ ui->Debug->setChecked(Debug);
+}
+
+void OptionsWidget::on_allDllIsImportant_toggled(bool checked)
+{
+ emit sendAllDllIsImportant(ui->allDllIsImportant->isChecked());
+}
+
+void OptionsWidget::retranslate()
+{
+ ui->retranslateUi(this);
+}
+
+void OptionsWidget::on_Debug_toggled(bool checked)
+{
+ emit sendDebug(ui->Debug->isChecked());
+}
diff --git a/plugins/PluginLoader/catchcopy-v0002/OptionsWidget.h b/plugins/PluginLoader/catchcopy-v0002/OptionsWidget.h new file mode 100755 index 0000000..cbbf61c --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/OptionsWidget.h @@ -0,0 +1,30 @@ +#ifndef OptionsWidget_H
+#define OptionsWidget_H
+
+#include <QWidget>
+
+namespace Ui {
+class OptionsWidget;
+}
+
+class OptionsWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit OptionsWidget(QWidget *parent = 0);
+ ~OptionsWidget();
+ void setAllDllIsImportant(bool allDllIsImportant);
+ void setDebug(bool Debug);
+ void retranslate();
+private:
+ Ui::OptionsWidget *ui;
+signals:
+ void sendAllDllIsImportant(bool allDllIsImportant);
+ void sendDebug(bool Debug);
+private slots:
+ void on_allDllIsImportant_toggled(bool checked);
+ void on_Debug_toggled(bool checked);
+};
+
+#endif // OptionsWidget_H
diff --git a/plugins/PluginLoader/catchcopy-v0002/OptionsWidget.ui b/plugins/PluginLoader/catchcopy-v0002/OptionsWidget.ui new file mode 100755 index 0000000..4fc0727 --- /dev/null +++ b/plugins/PluginLoader/catchcopy-v0002/OptionsWidget.ui @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>OptionsWidget</class>
+ <widget class="QWidget" name="OptionsWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>195</width>
+ <height>58</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout">
+ <item>
+ <widget class="QCheckBox" name="allDllIsImportant">
+ <property name="text">
+ <string>All the dlls are importants</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="Debug">
+ <property name="text">
+ <string notr="true">Debug</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/plugins/PluginLoader/catchcopy-v0002/informations.xml b/plugins/PluginLoader/catchcopy-v0002/informations.xml index fb92607..568ad06 100755 --- a/plugins/PluginLoader/catchcopy-v0002/informations.xml +++ b/plugins/PluginLoader/catchcopy-v0002/informations.xml @@ -12,16 +12,16 @@ <!-- 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> + <architecture>windows-x86</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> + <version>0.3.1.0</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 + >=ultracopier-0.3.1.0 ]]></dependencies> </package>
\ No newline at end of file diff --git a/plugins/PluginLoader/catchcopy-v0002/pluginLoader.cpp b/plugins/PluginLoader/catchcopy-v0002/pluginLoader.cpp index f4d5b01..d69cf91 100755 --- a/plugins/PluginLoader/catchcopy-v0002/pluginLoader.cpp +++ b/plugins/PluginLoader/catchcopy-v0002/pluginLoader.cpp @@ -1,4 +1,4 @@ -/** \file session-loader.cpp +/** \file pluginLoader.cpp \brief Define the session plugin loader test \author alpha_one_x86 \version 0.3 @@ -8,19 +8,41 @@ #include "PlatformMacro.h" #ifdef ULTRACOPIER_PLUGIN_DEBUG - #define CATCHCOPY_DLL_32 "catchcopy32d.dll" - #define CATCHCOPY_DLL_64 "catchcopy64d.dll" + #define NORMAL_EXT "d.dll" + #define SECOND_EXT ".dll" #else - #define CATCHCOPY_DLL_32 "catchcopy32.dll" - #define CATCHCOPY_DLL_64 "catchcopy64.dll" + #define NORMAL_EXT ".dll" + #define SECOND_EXT "d.dll" #endif +#define CATCHCOPY_DLL_32 "catchcopy32" +#define CATCHCOPY_DLL_64 "catchcopy64" PluginLoader::PluginLoader() { //set the startup value into the variable dllChecked=false; - + optionsEngine=NULL; + allDllIsImportant=false; + Debug=false; needBeRegistred=false; + changeOfArchDetected=false; + is64Bits=false; + connect(&optionsWidget,SIGNAL(sendAllDllIsImportant(bool)),this,SLOT(setAllDllIsImportant(bool))); + connect(&optionsWidget,SIGNAL(sendDebug(bool)),this,SLOT(setDebug(bool))); + +#if defined(_M_X64)//64Bits + is64Bits=true; +#else//32Bits + char *arch=getenv("windir"); + if(arch!=NULL) + { + QDir dir; + if(dir.exists(QString(arch)+"\\SysWOW64\\")) + is64Bits=true; + /// \note commented because it do a crash at the startup, and useless, because is global variable, it should be removed only by the OS + //delete arch; + } +#endif } PluginLoader::~PluginLoader() @@ -35,6 +57,8 @@ void PluginLoader::setEnabled(bool needBeRegistred) { ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("No dll exists")); emit newState(Uncaught); + if(!needBeRegistred) + correctlyLoaded.clear(); return; } if(this->needBeRegistred==needBeRegistred) @@ -44,7 +68,7 @@ void PluginLoader::setEnabled(bool needBeRegistred) } this->needBeRegistred=needBeRegistred; int index=0; - ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, needBeRegistred: "+QString::number(needBeRegistred)); + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("start, needBeRegistred: %1, allDllIsImportant: %2").arg(needBeRegistred).arg(allDllIsImportant)); bool oneHaveFound=false; index=0; @@ -74,6 +98,8 @@ void PluginLoader::setEnabled(bool needBeRegistred) { ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("No dll have found")); emit newState(Uncaught); + if(!needBeRegistred) + correctlyLoaded.clear(); return; } @@ -85,11 +111,18 @@ void PluginLoader::setEnabled(bool needBeRegistred) { if(!RegisterShellExtDll(pluginPath+importantDll.at(index),needBeRegistred,false)) { + if(changeOfArchDetected) + { + setEnabled(needBeRegistred); + return; + } ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"the important dll have failed: "+importantDll.at(index)); importantDll_have_bug=true; } else { + if(needBeRegistred) + correctlyLoaded << importantDll.at(index); importantDll_is_loaded=true; ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"the important dll have been loaded: "+importantDll.at(index)); } @@ -99,13 +132,21 @@ void PluginLoader::setEnabled(bool needBeRegistred) index=0; while(index<secondDll.size()) { - if(!RegisterShellExtDll(pluginPath+secondDll.at(index),needBeRegistred,true)) + if(!RegisterShellExtDll(pluginPath+secondDll.at(index),needBeRegistred, + !( + (needBeRegistred && allDllIsImportant) + || + (!needBeRegistred && correctlyLoaded.contains(secondDll.at(index))) + ) + )) { ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"the second dll have failed: "+secondDll.at(index)); secondDll_have_bug=true; } else { + if(needBeRegistred) + correctlyLoaded << secondDll.at(index); secondDll_is_loaded=true; ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"the second dll have been loaded: "+secondDll.at(index)); } @@ -157,6 +198,9 @@ void PluginLoader::setEnabled(bool needBeRegistred) emit newState(Caught); else emit newState(Semiuncaught); + + if(!needBeRegistred) + correctlyLoaded.clear(); } bool PluginLoader::checkExistsDll() @@ -169,63 +213,54 @@ bool PluginLoader::checkExistsDll() 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(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); - } + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,"64Bits is important"); + importantDll << CATCHCOPY_DLL_64; + secondDll << CATCHCOPY_DLL_32; } else { - QStringList tempList=importantDll; - importantDll=secondDll; - secondDll=tempList; + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,"32Bits is important"); + importantDll << CATCHCOPY_DLL_32; + secondDll << CATCHCOPY_DLL_64; } - #endif int index=0; while(index<importantDll.size()) { - if(!QFile::exists(pluginPath+importantDll.at(index))) + if(!QFile::exists(pluginPath+importantDll.at(index)+NORMAL_EXT)) { - ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"file not found, drop to the list: "+importantDll.at(index)); - importantDll.removeAt(index); - index--; + if(!QFile::exists(pluginPath+importantDll.at(index)+SECOND_EXT)) + { + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"file not found, drop to the list: "+importantDll.at(index)); + importantDll.removeAt(index); + index--; + } + else + importantDll[index]+=SECOND_EXT; } + else + importantDll[index]+=NORMAL_EXT; index++; } index=0; while(index<secondDll.size()) { - if(!QFile::exists(pluginPath+secondDll.at(index))) + if(!QFile::exists(pluginPath+secondDll.at(index)+NORMAL_EXT)) { - ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"file not found, drop to the list: "+secondDll.at(index)); - secondDll.removeAt(index); - index--; + if(!QFile::exists(pluginPath+secondDll.at(index)+SECOND_EXT)) + { + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"file not found, drop to the list: "+secondDll.at(index)); + secondDll.removeAt(index); + index--; + } + else + secondDll[index]+=SECOND_EXT; } + else + secondDll[index]+=NORMAL_EXT; index++; } if(importantDll.size()>0 || secondDll.size()>0) @@ -238,27 +273,35 @@ void PluginLoader::setResources(OptionInterface * options,QString writePath,QStr { Q_UNUSED(options); this->pluginPath=pluginPath; - if(portableVersion) + this->optionsEngine=options; + if(optionsEngine!=NULL) { - 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 + QList<QPair<QString, QVariant> > KeysList; + KeysList.append(qMakePair(QString("allDllIsImportant"),QVariant(false))); + KeysList.append(qMakePair(QString("Debug"),QVariant(false))); + optionsEngine->addOptionGroup(KeysList); + allDllIsImportant=optionsEngine->getOptionValue("allDllIsImportant").toBool(); + Debug=optionsEngine->getOptionValue("Debug").toBool(); + optionsWidget.setAllDllIsImportant(allDllIsImportant); + optionsWidget.setDebug(Debug); } } bool PluginLoader::RegisterShellExtDll(QString dllPath, bool bRegister,bool quiet) { + if(Debug) + { + QString message; + if(bRegister) + message+=QString("Try load the dll: %1, and ").arg(dllPath); + else + message+=QString("Try unload the dll: %1, and ").arg(dllPath); + if(quiet) + message+=QString("don't open the UAC"); + else + message+=QString("open the UAC if needed"); + QMessageBox::information(NULL,"Debug",message); + } ////////////////////////////// First way to load ////////////////////////////// wchar_t arrayArg[65535]; @@ -297,7 +340,8 @@ bool PluginLoader::RegisterShellExtDll(QString dllPath, bool bRegister,bool quie ////////////////////////////// Second way to load ////////////////////////////// QStringList arguments; - arguments.append("/s"); + if(!Debug) + arguments.append("/s"); if(!bRegister) arguments.append("/u"); arguments.append(dllPath); @@ -316,9 +360,20 @@ bool PluginLoader::RegisterShellExtDll(QString dllPath, bool bRegister,bool quie bool ok=false; if(result==0) ok=true; + #if ! defined(_M_X64) + if(result==999 && !changeOfArchDetected)//code of wrong arch for the dll + { + changeOfArchDetected=true; + QStringList temp; + temp = importantDll; + secondDll = importantDll; + importantDll = temp; + return false; + } + #endif if(result==5) { - if(!quiet) + if(!quiet || (!bRegister && correctlyLoaded.contains(dllPath))) { ////////////////////////////// Last way to load ////////////////////////////// ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"try it in win32"); @@ -343,6 +398,7 @@ bool PluginLoader::RegisterShellExtDll(QString dllPath, bool bRegister,bool quie } else ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QString("regsvr32 terminated with: %1").arg(result)); + correctlyLoaded.remove(dllPath); if(!bRegister) HardUnloadDLL(dllPath); return ok; @@ -462,3 +518,26 @@ void PluginLoader::HardUnloadDLL(QString myDllName) } CloseHandle(hSnapShot1); } + +/// \brief to get the options widget, NULL if not have +QWidget * PluginLoader::options() +{ + return &optionsWidget; +} + +void PluginLoader::newLanguageLoaded() +{ + optionsWidget.retranslate(); +} + +void PluginLoader::setAllDllIsImportant(bool allDllIsImportant) +{ + this->allDllIsImportant=allDllIsImportant; + optionsEngine->setOptionValue("allDllIsImportant",allDllIsImportant); +} + +void PluginLoader::setDebug(bool Debug) +{ + this->Debug=Debug; + optionsEngine->setOptionValue("Debug",Debug); +} diff --git a/plugins/PluginLoader/catchcopy-v0002/pluginLoader.h b/plugins/PluginLoader/catchcopy-v0002/pluginLoader.h index 9a913e3..79ba305 100755 --- a/plugins/PluginLoader/catchcopy-v0002/pluginLoader.h +++ b/plugins/PluginLoader/catchcopy-v0002/pluginLoader.h @@ -14,11 +14,13 @@ #include <QString> #include <QStringList> #include <QProcess> +#include <QSet> #include <windows.h> #include <tlhelp32.h> #include "../../../interface/PluginInterface_PluginLoader.h" #include "Environment.h" +#include "OptionsWidget.h" /// \brief \brief Define the plugin loader class PluginLoader : public PluginInterface_PluginLoader @@ -28,23 +30,38 @@ class PluginLoader : public PluginInterface_PluginLoader public: PluginLoader(); ~PluginLoader(); - void setEnabled(bool); + /// \brief try enable/disable the catching + void setEnabled(bool); + /// \brief to set resources, writePath can be empty if read only mode void setResources(OptionInterface * options,QString writePath,QString pluginPath,bool portableVersion); + /// \brief to get the options widget, NULL if not have + QWidget * options(); +public slots: + /// \brief to reload the translation, because the new language have been loaded + void newLanguageLoaded(); private: QString pluginPath; QStringList importantDll,secondDll; + QSet<QString> correctlyLoaded; 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); + OptionInterface * optionsEngine; + OptionsWidget optionsWidget; + bool allDllIsImportant,Debug; + bool changeOfArchDetected,is64Bits; 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 +private slots: + void setAllDllIsImportant(bool allDllIsImportant); + void setDebug(bool Debug); }; #endif // PLUGIN_LOADER_TEST_H diff --git a/plugins/PluginLoader/catchcopy-v0002/pluginLoader.pro b/plugins/PluginLoader/catchcopy-v0002/pluginLoader.pro index f593fff..f383793 100755 --- a/plugins/PluginLoader/catchcopy-v0002/pluginLoader.pro +++ b/plugins/PluginLoader/catchcopy-v0002/pluginLoader.pro @@ -1,17 +1,39 @@ -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 - +TEMPLATE = lib
+CONFIG += plugin
+HEADERS = \
+ StructEnumDefinition.h \
+ pluginLoader.h \
+ DebugEngineMacro.h \
+ Environment.h \
+ Variable.h \
+ PlatformMacro.h \
+ ../../../interface/PluginInterface_PluginLoader.h \
+ OptionsWidget.h
+SOURCES = \
+ pluginLoader.cpp \
+ OptionsWidget.cpp
+TARGET = $$qtLibraryTarget(pluginLoader)
+TRANSLATIONS += Languages/fr/translation.ts \
+ Languages/ar/translation.ts \
+ Languages/zh/translation.ts \
+ Languages/es/translation.ts \
+ Languages/de/translation.ts \
+ Languages/el/translation.ts \
+ Languages/it/translation.ts \
+ Languages/ja/translation.ts \
+ Languages/id/translation.ts \
+ Languages/pl/translation.ts \
+ Languages/ru/translation.ts \
+ Languages/tr/translation.ts \
+ Languages/th/translation.ts \
+ Languages/hi/translation.ts \
+ Languages/nl/translation.ts \
+ Languages/no/translation.ts \
+ Languages/pt/translation.ts \
+ Languages/ko/translation.ts
+
+LIBS += -lole32
+
+FORMS += \
+ OptionsWidget.ui
+
|