User forums > Using Code::Blocks
How to build the .plw plug-in
Дмитро:
File(s)
Contains
funcs.hpp
func_t
class and basically everything function related.
ida.hpp
idainfo
struct, which holds mostly meta information about the file
being disassembled.
kernwin.hpp
Functions and classes for interacting with the IDA user interface.
lines.hpp
Functions and definitions that deal with disassembled text, colour
coding, etc.
loader.hpp
Mostly functions for loading files into and manipulating the IDB.
name.hpp
Functions and definitions for getting and setting names of bytes
(variable names, function names, etc.)
pro.h
Contains a whole range of misc. definitions and functions.
search.hpp
Various functions and definitions for searching the disassembled
file for text, data, code and more.
segment.hpp
segment_t
class and everything for dealing with binary segments/
sections.
strlist.hpp
string_info_t
structure and related functions for representing
each string in IDA's string list.
ua.hpp
insn_t
,
op_t
and
optype_t
classes representing assembly
instructions, operands and operand types respectively as well as
functions for working with the IDA analyser.
xref.hpp
Functions for dealing with cross referencing code and data
references.
2.4 Using the SDK
Generally speaking, any function within a header file that is prefixed with
ida_export
is
available for your use, as well as global variables prefixed with
ida_export_data
. The rule of
thumb is to stay away from lower level functions (these are indicated in the header files) and stick
to using the higher level interfaces provided. Any defined class, struct and enum is available for
your use.
Дмитро:
3. Setting up a Build Environment
Note for Borland users:
The only compiler supported by the IDA SDK that isn't covered in this
section is Borland's. You should read the
install_cb.txt
and
makeenv_br.mak
in the root
of the SDK directory to determine the compiler and linker flags necessary.
Before you start coding away, it's best to have a proper environment set up to facilitate the
development process. The more popular environments have been covered, so apologies if yours
isn't. If you're already set up, feel free to skip to the next section.
3.1 Windows, Using Visual Studio
The version of Visual Studio used for this example is Visual C++ 2008 Express Edition, but
almost everything should be applicable to older versions.
Once you have Visual Studio running, close any other solutions and/or projects you might have
open; we want a totally clean slate.
1
Go to
File->New->Project...
(Ctrl-Shift-N)
2
Expand the
Visual C++
folder, followed by the
Win32
sub-folder, and then select the
Win32 Project
icon. Name the project whatever you like and click
OK
.
3
The Win32 Application Wizard should then appear, click the
Application Settings
link on the left and make sure
Windows Application
is selected, and then tick the
Empty Project
checkbox. Click
Finish
.
4
In the
Solutions Explorer
on the right hand side, right click on the
Source Files
folder and go to
Add->New Item...
5
Select
C++ File (.cpp
)
under the
Templates
section and name the file appropriately.
Click
Add
. Repeat this step for any other files you want to add to the project.
6
Go to
Project->
projectname
Properties...
7
Change the following settings (some have been put there to reduce the size of the
resulting plug-in, as VS seems to bloat the output file massively):
Configuration
drop down in the top left: Select
Release
Configuration Properties->General
: Change
Configuration Type
to
Dynamic Library (.dll)
C/C++->General
: Set
Detect 64-bit Portability Issues
checks to
No
C/C++->General
: Set
Debug Information Format
to
Disabled
C/C++->General
: Add the SDK include path to the
Additional Include
Directories
field. e.g.
C:\IDA\SDK\Include
C/C++->Preprocessor
: Add
__NT__;__IDP__
to
Preprocessor Definitions
C/C++->Code Generation
: Turn off
Buffer Security Check
, set
Basic
Runtime Checks
to
Default
and set
Runtime Library
to
Multi-threaded
C/C++->Advanced
:
Calling Convention
is
__stdcall
Linker->General
: Change
Output File
from a .
exe
to a .
plw
in the IDA
plugins
directory
Linker->General
: Add the path to your
libvc.wXX
to
Additional Library
Directories
.
e.g.
C:\IDA\SDK\libvc.w32
Linker->Input
: Add
ida.lib
to
Aditional Dependencies
Linker->Debugging
:
No
to
Generate Debug Info
Linker->Command Line
: Add
/EXPORT:PLUGIN
Build Events->Post-Build Event
: Set
Command-line
to your
idag.exe
to start
IDA after each successful build (Optional)
Click
OK
8
Go to
Build->Configuration Manager...
and change the drop-down in the
Configuration
column for your plug-in project from
Debug
to
Release
.
Click
OK
9
Move on to section 3.5
Дмитро:
3.2 Windows, Using Dev-C++ with GCC and MinGW
You can obtain a copy of Dev-C++, GCC and MinGW as one package from
http://www.bloodshed.net/dev/devcpp.html
. Installing and setting it up is beyond the scope of this
tutorial, so from here on, it'll be assumed that it's all in working order.
As before, start up Dev-C++ and ensure no project or other files are open; we want a clean slate.
1
Go to
File->New Project
, choose
Empty Project
, make sure
C++ Project
is
selected and give it any name you wish, click
OK
2
Choose a directory to save the project file, this can be anywhere you wish.
3
Go to
Project->New File
, this will hold the source code to your plug-in. Repeat this
step for any other files you want to add to the project.
4
Go to
Project->Project Options
, click on the
Parameters
tab.
5
Under
C++ compiler
, add:
-DWIN32 -D__NT__ -D__IDP__ -v -mrtd
6
Under
Linker
, add:
../path/to/your/sdk/libgcc.wXX/ida.a -Wl,--dll -shared
Just a note here - it's usually best to start with
../
, because msys seems to get confused
with just
/
, and tries to reference it from the root of the msys directory.
7
Click on the
Directories
tab, and
Include Directories
sub-tab. Add the path to
your IDA SDK
include
directory to the list.
8
Click on the
Build Options
tab, set the
Executable
output directory
to your
IDA
plugins
directory, and Override the
o
utput filename
to be a
.plw
file. Click
OK
.
9
Move on to section 3.5
Дмитро:
I do not know how Under
C ++ compiler
, add:
-DWIN32 -D__NT__ -D__IDP__ -v -mrtd
How to properly add this? How is this more correct?
Дмитро:
Also Project-> Project Options I do not see, I will not find it for a long time.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version