Skip to content

Commit

Permalink
add support for v8.3 ida pro plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
geocine committed Feb 11, 2024
1 parent baa5c8e commit 50c9efa
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 33 deletions.
2 changes: 1 addition & 1 deletion PluginGeneric/AttachDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extern HWND hwmain; // Handle of main OllyDbg window
#elif OLLY2
HWND hwmain = hwollymain;
#elif __IDP__
HWND hwmain = (HWND)callui(ui_get_hwnd).vptr;
HWND hwmain = GetForegroundWindow();
#elif X64DBG
extern HWND hwndDlg;
HWND hwmain;
Expand Down
11 changes: 6 additions & 5 deletions PluginGeneric/OptionsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,11 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
wstrNewProfileName.resize(lstrlenW(wstrNewProfileName.c_str()));

#elif defined(__IDP__)
auto szNewProfileName = askstr(0, "", "New profile name?");
if (!szNewProfileName)
qstring qNewProfileName;
bool success = ask_str(&qNewProfileName, 0, "New profile name?");
if (!success)
break;
wstrNewProfileName = scl::wstr_conv().from_bytes(szNewProfileName);
wstrNewProfileName = scl::wstr_conv().from_bytes(qNewProfileName.c_str());

#elif defined(X64DBG)
std::string strNewProfileName;
Expand Down Expand Up @@ -874,7 +875,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
break;

EndDialog(hDlg, NULL);
DialogBoxW(hinst, MAKEINTRESOURCE(IDD_ATTACH), (HWND)callui(ui_get_hwnd).vptr, &AttachProc);
DialogBoxW(hinst, MAKEINTRESOURCE(IDD_ATTACH), GetForegroundWindow(), &AttachProc);
break;
}

Expand All @@ -883,7 +884,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
if (HIWORD(wParam) != BN_CLICKED)
break;

scl::ShowAboutBox((HWND)callui(ui_get_hwnd).vptr);
scl::ShowAboutBox(GetForegroundWindow());
break;
}
#endif
Expand Down
10 changes: 6 additions & 4 deletions ScyllaHide.sln
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,12 @@ Global
{9EEA6D78-4E74-47B9-8746-B8754B15525D}.Release|Win32.ActiveCfg = Release|Win32
{9EEA6D78-4E74-47B9-8746-B8754B15525D}.Release|Win32.Build.0 = Release|Win32
{9EEA6D78-4E74-47B9-8746-B8754B15525D}.Release|x64.ActiveCfg = Release|Win32
{A94B6222-ABEF-41A0-BE48-06801157AAA5}.Debug|Win32.ActiveCfg = Debug|Win32
{A94B6222-ABEF-41A0-BE48-06801157AAA5}.Debug|x64.ActiveCfg = Debug|Win32
{A94B6222-ABEF-41A0-BE48-06801157AAA5}.Release|Win32.ActiveCfg = Release|Win32
{A94B6222-ABEF-41A0-BE48-06801157AAA5}.Release|x64.ActiveCfg = Release|Win32
{A94B6222-ABEF-41A0-BE48-06801157AAA5}.Debug|Win32.ActiveCfg = Debug|x64
{A94B6222-ABEF-41A0-BE48-06801157AAA5}.Debug|Win32.Build.0 = Debug|x64
{A94B6222-ABEF-41A0-BE48-06801157AAA5}.Debug|x64.ActiveCfg = Debug|x64
{A94B6222-ABEF-41A0-BE48-06801157AAA5}.Release|Win32.ActiveCfg = Release|x64
{A94B6222-ABEF-41A0-BE48-06801157AAA5}.Release|Win32.Build.0 = Release|x64
{A94B6222-ABEF-41A0-BE48-06801157AAA5}.Release|x64.ActiveCfg = Release|x64
{4506D672-19C3-439B-8E1B-F1BA8BE28844}.Debug|Win32.ActiveCfg = Debug|Win32
{4506D672-19C3-439B-8E1B-F1BA8BE28844}.Debug|x64.ActiveCfg = Debug|x64
{4506D672-19C3-439B-8E1B-F1BA8BE28844}.Release|Win32.ActiveCfg = Release|Win32
Expand Down
19 changes: 10 additions & 9 deletions ScyllaHideIDAProPlugin/ScyllaHideIDAProPlugin.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#define USE_STANDARD_FILE_FUNCTIONS
#pragma warning(disable : 4996 4512 4127 4201)


//for 64bit - p64
#ifdef BUILD_IDA_64BIT
#define __EA64__
#pragma comment(lib, "x86_win_vc_64/ida.lib")
#pragma comment(lib, "x64_win_vc_64_pro/ida.lib")
#else
//for 32bit - plw
#pragma comment(lib, "x86_win_vc_32/ida.lib")
#pragma comment(lib, "x64_win_vc_32_pro/ida.lib")
#endif


#include <Windows.h>
#include <ida.hpp>
#include <idp.hpp>
Expand Down Expand Up @@ -64,14 +64,14 @@ static void AttachProcess(DWORD dwPID)
switch (res) {
case -1:
{
MessageBoxA((HWND)callui(ui_get_hwnd).vptr,
MessageBoxA(GetForegroundWindow(),
"Can't attach to that process !",
"ScyllaHide Plugin", MB_OK | MB_ICONERROR);
break;
}
case -2:
{
MessageBoxA((HWND)callui(ui_get_hwnd).vptr,
MessageBoxA(GetForegroundWindow(),
"Can't find that PID !",
"ScyllaHide Plugin", MB_OK | MB_ICONERROR);
break;
Expand Down Expand Up @@ -102,7 +102,7 @@ static bool SetDebugPrivileges()
}

//callback for various debug events
static int idaapi debug_mainloop(void *user_data, int notif_code, va_list va)
static ssize_t idaapi debug_mainloop(void *user_data, int notif_code, va_list va)
{
switch (notif_code)
{
Expand Down Expand Up @@ -295,13 +295,14 @@ static void idaapi IDAP_term(void)
}

//called when user clicks in plugin menu or presses hotkey
static void idaapi IDAP_run(int arg)
static bool idaapi IDAP_run(size_t arg)
{
DialogBoxW(hinst, MAKEINTRESOURCE(IDD_OPTIONS), (HWND)callui(ui_get_hwnd).vptr, &OptionsDlgProc);
DialogBoxW(hinst, MAKEINTRESOURCE(IDD_OPTIONS), GetForegroundWindow(), &OptionsDlgProc);
return true;
}

//init the plugin
static int idaapi IDAP_init(void)
static plugmod_t* idaapi IDAP_init(void)
{
//ensure target is PE executable
if (inf.filetype != f_PE) return PLUGIN_SKIP;
Expand Down
40 changes: 26 additions & 14 deletions ScyllaHideIDAProPlugin/ScyllaHideIDAProPlugin.vcxproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
Expand All @@ -18,7 +18,7 @@
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
Expand All @@ -27,7 +27,7 @@
<VcpkgEnabled>false</VcpkgEnabled>
<VCToolsVersion Condition="'$(USE_XP_TOOLCHAIN)'!=''">14.27.29110</VCToolsVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
Expand All @@ -42,6 +42,16 @@
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(SolutionDir)Scylla\scylla.props" />
<Import Project="$(SolutionDir)Scylla\scylla.debug.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(SolutionDir)Scylla\scylla.props" />
<Import Project="$(SolutionDir)Scylla\scylla.release.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(SolutionDir)Scylla\scylla.props" />
Expand All @@ -53,25 +63,27 @@
<Import Project="$(SolutionDir)Scylla\scylla.release.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetExt>.plw</TargetExt>
<TargetExt>.dll</TargetExt>
<TargetName>$(TargetName)x64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetExt>.plw</TargetExt>
<TargetExt>.dll</TargetExt>
<TargetName>$(TargetName)x64</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;__NT__;__IDP__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN64;__X64__;_DEBUG;__VC__;_WINDOWS;__NT__;__IDP__;QT_NO_DEBUG;QT_NAMESPACE=QT;QT_NO_UNICODE_LITERAL;%(PreprocessorDefinitions);BUILD_IDA_64BIT;</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;__NT__;__IDP__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN64;__X64__;NDEBUG;__VC__;_WINDOWS;__NT__;__IDP__;%(PreprocessorDefinitions);BUILD_IDA_64BIT;</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down

0 comments on commit 50c9efa

Please sign in to comment.