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)
|
||||
{
|
||||
for (auto extension : extensions)
|
||||
extension.second(sentence, miscInfo);
|
||||
return sentence;
|
||||
wchar_t* sentenceBuffer = new wchar_t[sentence.size() + 1];
|
||||
wcscpy(sentenceBuffer, sentence.c_str());
|
||||
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::wstring DispatchSentenceToExtensions(std::wstring sentence, std::unordered_map<std::string, int> miscInfo);
|
||||
|
||||
typedef void(*ExtensionFunction)(std::wstring&, std::unordered_map<std::string, int>&);
|
||||
struct InfoForExtension
|
||||
{
|
||||
char* propertyName;
|
||||
int propertyValue;
|
||||
InfoForExtension* nextProperty;
|
||||
};
|
||||
typedef wchar_t*(*ExtensionFunction)(wchar_t*, InfoForExtension*);
|
||||
extern QComboBox* ttCombo;
|
||||
|
||||
#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";
|
||||
FreeLibrary(GetModuleHandleW(extenFileName.toStdWString().c_str()));
|
||||
QString disabledFileName = extenFileName;
|
||||
disabledFileName.replace("extension", "disabled_extension");
|
||||
QFile::rename(extenFileName, disabledFileName);
|
||||
DeleteFileW(extenFileName.toStdWString().c_str());
|
||||
extenCombo->clear();
|
||||
std::map<int, QString> extensions = LoadExtensions();
|
||||
for (auto i : extensions) extenCombo->addItem(QString::number(i.first) + ":" + i.second);
|
||||
|
Loading…
Reference in New Issue
Block a user