forked from Public-Mirror/Textractor
change abi to be C compatible
This commit is contained in:
parent
5d297404f6
commit
ff2fc74c5a
@ -29,7 +29,32 @@ std::map<int, QString> LoadExtensions()
|
|||||||
|
|
||||||
std::wstring DispatchSentenceToExtensions(std::wstring sentence, std::unordered_map<std::string, int> miscInfo)
|
std::wstring DispatchSentenceToExtensions(std::wstring sentence, std::unordered_map<std::string, int> miscInfo)
|
||||||
{
|
{
|
||||||
for (auto extension : extensions)
|
wchar_t* sentenceBuffer = new wchar_t[sentence.size() + 1];
|
||||||
extension.second(sentence, miscInfo);
|
wcscpy(sentenceBuffer, sentence.c_str());
|
||||||
return sentence;
|
InfoForExtension* miscInfoLinkedList = new InfoForExtension;
|
||||||
|
InfoForExtension* miscInfoTraverser = miscInfoLinkedList;
|
||||||
|
for (auto i : miscInfo)
|
||||||
|
{
|
||||||
|
miscInfoTraverser->propertyName = new char[i.first.size() + 1];
|
||||||
|
strcpy(miscInfoTraverser->propertyName, i.first.c_str());
|
||||||
|
miscInfoTraverser->propertyValue = i.second;
|
||||||
|
miscInfoTraverser->nextProperty = new InfoForExtension;
|
||||||
|
miscInfoTraverser = miscInfoTraverser->nextProperty;
|
||||||
|
}
|
||||||
|
miscInfoTraverser->propertyName = new char[sizeof("END")];
|
||||||
|
strcpy(miscInfoTraverser->propertyName, "END");
|
||||||
|
miscInfoTraverser->nextProperty = nullptr;
|
||||||
|
for (auto i : extensions)
|
||||||
|
sentenceBuffer = i.second(sentenceBuffer, miscInfoLinkedList);
|
||||||
|
miscInfoTraverser = miscInfoLinkedList;
|
||||||
|
while (miscInfoTraverser != nullptr)
|
||||||
|
{
|
||||||
|
InfoForExtension* nextNode = miscInfoTraverser->nextProperty;
|
||||||
|
delete[] miscInfoTraverser->propertyName;
|
||||||
|
delete miscInfoTraverser;
|
||||||
|
miscInfoTraverser = nextNode;
|
||||||
|
}
|
||||||
|
std::wstring newSentence = std::wstring(sentenceBuffer);
|
||||||
|
delete[] sentenceBuffer;
|
||||||
|
return newSentence;
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,13 @@
|
|||||||
|
|
||||||
std::map<int, QString> LoadExtensions();
|
std::map<int, QString> LoadExtensions();
|
||||||
std::wstring DispatchSentenceToExtensions(std::wstring sentence, std::unordered_map<std::string, int> miscInfo);
|
std::wstring DispatchSentenceToExtensions(std::wstring sentence, std::unordered_map<std::string, int> miscInfo);
|
||||||
|
struct InfoForExtension
|
||||||
typedef void(*ExtensionFunction)(std::wstring&, std::unordered_map<std::string, int>&);
|
{
|
||||||
|
char* propertyName;
|
||||||
|
int propertyValue;
|
||||||
|
InfoForExtension* nextProperty;
|
||||||
|
};
|
||||||
|
typedef wchar_t*(*ExtensionFunction)(wchar_t*, InfoForExtension*);
|
||||||
extern QComboBox* ttCombo;
|
extern QComboBox* ttCombo;
|
||||||
|
|
||||||
#endif // EXTENSIONS_H
|
#endif // EXTENSIONS_H
|
||||||
|
@ -214,9 +214,7 @@ void MainWindow::on_rmvExtenButton_clicked()
|
|||||||
{
|
{
|
||||||
QString extenFileName = extenCombo->currentText().split(":")[0] + "_" + extenCombo->currentText().split(":")[1] + "_nexthooker_extension.dll";
|
QString extenFileName = extenCombo->currentText().split(":")[0] + "_" + extenCombo->currentText().split(":")[1] + "_nexthooker_extension.dll";
|
||||||
FreeLibrary(GetModuleHandleW(extenFileName.toStdWString().c_str()));
|
FreeLibrary(GetModuleHandleW(extenFileName.toStdWString().c_str()));
|
||||||
QString disabledFileName = extenFileName;
|
DeleteFileW(extenFileName.toStdWString().c_str());
|
||||||
disabledFileName.replace("extension", "disabled_extension");
|
|
||||||
QFile::rename(extenFileName, disabledFileName);
|
|
||||||
extenCombo->clear();
|
extenCombo->clear();
|
||||||
std::map<int, QString> extensions = LoadExtensions();
|
std::map<int, QString> extensions = LoadExtensions();
|
||||||
for (auto i : extensions) extenCombo->addItem(QString::number(i.first) + ":" + i.second);
|
for (auto i : extensions) extenCombo->addItem(QString::number(i.first) + ":" + i.second);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user