📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

 Forums >>  IDA Pro  >>  revised version of Paul Kraszewski's "create psp segment" script

Topic created on: April 20, 2009 12:06 CDT by SamB .

This is based on the script at http://www.openrce.org/downloads/details/67/create_PSP_segment.

This version creates a struct type. I use it with the IDA Pro 4.9 Freeware version. It is written for EXE files, but getting it to support COM files should only involve changes to main.


// -*- C -*- (Use C mode in emacs)

#include <idc.idc>


static CW(x,off,name,cmt) {
    AddStrucMember(x, name, off, FF_WORD, -1, 2);
    SetMemberComment(x, off, cmt, 1);
}

//-------------------------------------------------------------------------
static CD(x,off,name,cmt) {
    AddStrucMember(x, name, off, FF_DWRD, -1, 4);
    SetMemberComment(x, off, cmt, 1);
}

//-------------------------------------------------------------------------
static CB(x,off,name,cmt) {
    AddStrucMember(x, name, off, FF_BYTE, -1, 1);
    SetMemberComment(x, off, cmt, 1);
}

//-------------------------------------------------------------------------
static CA(x,off,siz,name,cmt) {
    AddStrucMember(x, name, off, FF_ASCI, -1, siz);
    SetMemberComment(x, off, cmt, 1);
}

//-------------------------------------------------------------------------
static CmtBdata(x) {
    CW(x,0x000,      "Exit","Process exit entry point");
    CW(x,0x002,      "Memory","First free segment");
    CB(x,0x004,      "Reserved1","Reserved");
    CA(x,0x005,0x005,"SysCall","System call entry point");
    CD(x,0x00A,      "Int22","Int 22 entry point");
    CD(x,0x00E,      "Int23","Int 23 entry point");
    CD(x,0x012,      "Int24","Int 24 entry point");
    CA(x,0x016,0x016,"Reserved2","Reserved for DOS");
    CW(x,0x02C,      "Env","Environment segment");
    CA(x,0x02E,0x02E,"Reserved3","Reserved for DOS");
    CA(x,0x05C,0x010,"FCB1","FCB block of the first prog arg");
    CA(x,0x06C,0x014,"FCB2","FCB block of the second prog arg");
    CB(x,0x080,      "ArgLen","Arguments length");
    CA(x,0x081,0x07F,"Arguments","Arguments area");
}

//-------------------------------------------------------------------------

static main() {
    auto PSP_struct, x;

    PSP_struct = AddStruc(0, "PSP");
    CmtBdata(PSP_struct);

    SegCreate(0x800, 0x900, 0x80, 0, saAbs, scPub);
    SegRename(0x800, "PSP_DATA");
    SegClass(0x800, "PSPSEG");
    SetSegmentType(0x800, 0);
    SetReg(BeginEA(),"ds",0x80);

    MakeStruct(0x800, "PSP");
    MakeName(0x800, "my_psp");
}

  SamB   April 21, 2009 19:02.24 CDT
I would have uploaded it to the scripts section, but I don't have enough points :-(.

  SamB   January 1, 2010 17:18.41 CST
Hmm, now I see that, when this page is rendered, all the double quotes in the code get inappropriately escaped with backslashes...

Note: Registration is required to post to the forums.

There are 31,328 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit