Skip to content

Commit

Permalink
automatically find Python installation + x64dbg_python (and other pac…
Browse files Browse the repository at this point in the history
…kages) can be loaded from plugin directory (also unicode paths) + fail to load plugin if PythonHome was not found
  • Loading branch information
mrexodia committed Jun 26, 2016
1 parent 6c548cf commit 6d81260
Show file tree
Hide file tree
Showing 3 changed files with 846 additions and 767 deletions.
87 changes: 43 additions & 44 deletions pluginmain.cpp
@@ -1,44 +1,43 @@
#include "pluginmain.h"
#include "py.h"

int pluginHandle;
HWND hwndDlg;
int hMenu;
int hMenuDisasm;
int hMenuDump;
int hMenuStack;

DLL_EXPORT bool pluginit(PLUG_INITSTRUCT* initStruct)
{
initStruct->pluginVersion = plugin_version;
initStruct->sdkVersion = PLUG_SDKVERSION;
strcpy(initStruct->pluginName, plugin_name);
pluginHandle = initStruct->pluginHandle;
pyInit(initStruct);
return true;
}

DLL_EXPORT bool plugstop()
{
pyStop();
return true;
}

DLL_EXPORT void plugsetup(PLUG_SETUPSTRUCT* setupStruct)
{
hwndDlg = setupStruct->hwndDlg;
hMenu = setupStruct->hMenu;
hMenuDisasm = setupStruct->hMenuDisasm;
hMenuDump = setupStruct->hMenuDump;
hMenuStack = setupStruct->hMenuStack;
pySetup();
}

extern "C" DLL_EXPORT BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if(fdwReason == DLL_PROCESS_ATTACH)
{
hInst = hinstDLL;
}
return TRUE;
}
#include "pluginmain.h"
#include "py.h"

int pluginHandle;
HWND hwndDlg;
int hMenu;
int hMenuDisasm;
int hMenuDump;
int hMenuStack;

DLL_EXPORT bool pluginit(PLUG_INITSTRUCT* initStruct)
{
initStruct->pluginVersion = plugin_version;
initStruct->sdkVersion = PLUG_SDKVERSION;
strcpy(initStruct->pluginName, plugin_name);
pluginHandle = initStruct->pluginHandle;
return pyInit(initStruct);
}

DLL_EXPORT bool plugstop()
{
pyStop();
return true;
}

DLL_EXPORT void plugsetup(PLUG_SETUPSTRUCT* setupStruct)
{
hwndDlg = setupStruct->hwndDlg;
hMenu = setupStruct->hMenu;
hMenuDisasm = setupStruct->hMenuDisasm;
hMenuDump = setupStruct->hMenuDump;
hMenuStack = setupStruct->hMenuStack;
pySetup();
}

extern "C" DLL_EXPORT BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if(fdwReason == DLL_PROCESS_ATTACH)
{
hInst = hinstDLL;
}
return TRUE;
}

0 comments on commit 6d81260

Please sign in to comment.