Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for v8.3 ida pro plugin #162

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty/README.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
To build the IDA plugin, extract the contents of idasdk695.zip in the directory "idasdk"
To build the IDA plugin, extract the contents of idasdk83_pro.zip in the directory "idasdk"
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
8 changes: 4 additions & 4 deletions ScyllaHide.sln
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ 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|x64.ActiveCfg = Debug|x64
{A94B6222-ABEF-41A0-BE48-06801157AAA5}.Release|Win32.ActiveCfg = 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
25 changes: 14 additions & 11 deletions ScyllaHideIDAProPlugin/ScyllaHideIDAProPlugin.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
#define USE_STANDARD_FILE_FUNCTIONS
#pragma warning(disable : 4996 4512 4127 4201)
#include <Windows.h>

#define USE_STANDARD_FILE_FUNCTIONS

//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>
#pragma warning(push, 0)
#include <ida.hpp>
#include <idp.hpp>
#include <dbg.hpp>
#include <loader.hpp>
#include <kernwin.hpp>
#pragma warning(pop)

#include <Scylla/Logger.h>
#include <Scylla/Settings.h>
#include <Scylla/Version.h>
Expand Down Expand Up @@ -64,14 +66,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 +104,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)
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 204-214 will disable loading ScyllaHide for local debuggers on x64 binaries. I think this is a significant issue and it may be a good idea to investigate why this condition was needed in the first place.

switch (notif_code)
{
Expand Down Expand Up @@ -295,13 +297,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
38 changes: 24 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,25 @@
<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>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetExt>.plw</TargetExt>
<TargetExt>.dll</TargetExt>
</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__;%(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
6 changes: 3 additions & 3 deletions release.bat
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ mkdir Release\Olly1
mkdir Release\Olly2
mkdir Release\TitanEngine
mkdir Release\Generic
mkdir Release\IDA
mkdir Release\IDA\plugins

copy /y /b build\Release\Win32\ScyllaHideGenericPluginx86.dll Release\Generic\
copy /y /b build\Release\x64\ScyllaHideGenericPluginx64.dll Release\Generic\
Expand All @@ -109,7 +109,7 @@ copy /y /b build\Release\Win32\ScyllaHideTEPluginx86.dll Release\TitanEngine\
copy /y /b build\Release\x64\ScyllaHideTEPluginx64.dll Release\TitanEngine\
copy /y /b build\Release\Win32\ScyllaHideX64DBGPlugin.dp32 Release\x64dbg\x32\plugins\
copy /y /b build\Release\x64\ScyllaHideX64DBGPlugin.dp64 Release\x64dbg\x64\plugins\
copy /y /b build\Release\Win32\ScyllaHideIDAProPlugin.plw Release\IDA\
copy /y /b build\Release\x64\ScyllaHideIDAProPlugin.dll Release\IDA\plugins\

xcopy /S /Y build\Release\Win32\*.exe Release\
xcopy /S /Y build\Release\x64\*.exe Release\
Expand Down Expand Up @@ -140,4 +140,4 @@ copy /y /b Release\HookLibraryx64.dll Release\IDA\
copy /y /b Release\HookLibraryx86.dll Release\IDA\
move Release\ScyllaHideIDAServer* Release\IDA\

exit 0
exit /b 0
Loading