Git Product home page Git Product logo

idr's People

Contributors

bakasurarce avatar crypto2011 avatar iljavs avatar mrexodia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

idr's Issues

About const parameter

About constant (const) parameter, in current version of IDR, all treated as variable (var) parameters.
For example:
function CompareStr(const S1, S2: string): Integer;
In IDR, we get the follow result:
function CompareStr(var S1: AnsiString; var S2: AnsiString): Integer;

I have correct this problem.

Bug in TDecompiler::Decompile

In file Decompiler.cpp in function TDecompiler::Decompile there is a piece of code

if ((flags & (CF_FINALLY | CF_EXCEPT)))
{
  _curPos += _instrLen; _curAdr += _instrLen;
  continue;
}
if (DisInfo.Call)
{
  if (flags & cfExcept)
  {
    _recN = GetInfoRec(DisInfo.Immediate);
    if (_recN->SameName("@DoneExcept"))
    {
      _curPos += _instrLen; _curAdr += _instrLen;
      break;
    }
  }
} 

Are you sure that cfExcept is the right one to use - I think it should be CF_EXCEPT ?

Fuzzyscan AV

Getting AV (AccessViolation) error on latest idr.exe

steps
Load exe
goto CodeViewer page (F6)
Fuzzy scan KB

getting:


Idr

Access violation at address 00471F6B in module 'Idr.exe'. Read of address 056BFF44.

OK

target might be sent in private

Bug in TFMain_11011981::ShowUnitItems

In file TabUnits.cpp in function TFMain_11011981::ShowUnitItems there is a piece of code

//Skip calls, that are in the body of some asm-procs (for example, FloatToText from SysUtils)
if (kind >= ikRefine && kind <= ikFunc && recN->procInfo && (recN->procInfo->flags & cfEmbedded)) continue; 

Are you sure that cfEmbedded is the right one to use - I think it should be PF_EMBED ?

EAccessViolation

Hi crypto2011,

The issue occurs when i try disassemblers this target.

You can check link below: (DSR.exe)

RAR.zip

Regards,

Alternative development: CBuilder 10.2

I've been working to run the code on Embarcadero C ++ 10.2 Tokyo. Now I have a functional version with a lot of bugs to correct!

If you allow it, could you create a new branch (called cbuilder-10.2) in the repository to support this alternative development?

My branch.

Thanks for your consideration.

Suspicious extra FPop in decompiler

In file Decompiler.cpp, on line 7428 there is an FPop() call - but there is already another FPop() 2 lines above, replacing the previous FGet(0). Is not the second one superfluous ?

Bug in TFMain_11011981::AnalyzeProc2

In file Analyze2.cpp in function TFMain_11011981::AnalyzeProc2 there is the following piece of code

if (DisInfo.Ret)
{
  //End of proc
  if (!lastAdr || curAdr == lastAdr)
  {
    if (AnalyzeRetType)
    {
      //Если тип регистра eax не пустой, находим ближайшую сверху инструкцию его инциализации
      if (registers[16].type != "")
      {
        for (Pos = curPos - 1; Pos >= fromPos; Pos--)
        {
          b = Flags[Pos];
          if ((b & cfInstruction) & !(b & cfSkip)) 

On the last row, I think it should be if ((b & cfInstruction) && !(b & cfSkip)) - otherwise, according to the generated code it seems that cfSkip check is effectively ignored
shot-1
It is obvious, that compiled code actually resembles other logic.

However, if I change the second & with && - the kind of many InfoRec`s becomes ikFunc instead of ikProc - this is clearly visible on event handlers for visual controls (usually TNotifyEvent)
I am not sure whether these are bugs, or not ....
shot-2
shot-3
shot-4
shot-5
shot-6
shot-7
shot-8
shot-9
shot-10

The controls position will CHANGE when each execut

After Windows 7, each execut the IDR, we find the controls position will changed.

Reason:

After Windows 7, has a display setting under the Desktop popup menu -> Display Settings:
"Change the size of text, apps and other items"
This can select: Smaller (100%), Medium (125%), Larger (150%), and so on.

Solve:

Modify the ScaleForm function in Misc.cpp

void __fastcall ScaleForm(TForm* AForm)
{
HDC _hdc = GetDC(0);
if (_hdc)
{
//Modified by ZGL
int LogicalScreenHeight = GetDeviceCaps(_hdc, VERTRES);
int PhysicalScreenHeight = GetDeviceCaps(_hdc, DESKTOPVERTRES);
AForm->ScaleBy(PhysicalScreenHeight, LogicalScreenHeight);
//Modified end
ReleaseDC(0, _hdc);
}
}

Bug in MKnowledgeBase::GetTypeInfo

There is a bug when GetTypeInfo from KBver = 1 sometime. Fixed follow:

MTypeInfo* __fastcall MKnowledgeBase::GetTypeInfo(int ATypeIdx, DWORD AFlags, MTypeInfo *tInfo)
{
if (!Inited) return 0;

if (ATypeIdx == -1) return 0;

const BYTE* p = GetKBCachePtr(TypeOffsets[ATypeIdx].Offset, TypeOffsets[ATypeIdx].Size);

//Modified by ZGL
if (Version == 1)
    tInfo->Size = TypeOffsets[ATypeIdx].Size;
else
{
    tInfo->Size = *((DWORD*)p); p += 4;
}
//---------------

Unit renaming inconsistency

An old name is still displayed in CodeViewer tab after unit renaming (of course, if there was opened some method from renamed unit).
1

Bug in Decompiler

In file Decompiler.cpp, around row 7334 there is the following piece of code

        if (_item2.Flags & IF_STACK_PTR)
        {
            Env->Stack[_item2.IntValue].Type = "Variant";
            _item2 = Env->Stack[_item1.IntValue];
        }

Why there is _item1.IntValue ?

Add support for Delphi 8?

How much effort would be needed to add support for Delphi 8? How can I be sure that my DLL to be decompiled is, in fact, Delphi 8? There is a static string 'Delphi%.8X' in the disassembly. Any tips or suggestions would be greatly appreciated.

Built executables

Now kpnc doesn't work (RIP Kris), so how can I download built binaries?

Knowledge DB files on release page

Hi,
i would like it if the latest knowledge db files were hosted for example on the releases page or linked in the readme.md since your old website seems to be down.

KB Builder

Hi,

Is there any way to build KB for the latest versions of Delphi embarcadero (XE10 or 11 ?)

Cheers,

Allow IDR to allocate more memory

When big executable is analyzed (over 150MB), IDR tries to use more than 2GB of RAM and causes Out of memory exception. Using 4GB_patch from NTcore (https://ntcore.com/?page_id=371) allows to allocate up to 4GBs and disassembly can continue, but IDR becomes unstable.
Can IDR be compiled as an x64 app (thus allowing it to natively use more memory)?

Fixed bug for TFMain_11011981::IniFileRead

   pos = str.LastDelimiter(",");
    if (pos)
    {
        filename = str.SubString(2, pos - 3);   //Modified by ZGL
        version = str.SubString(pos + 1, str.Length() - pos).ToInt();
    }
    else

Bug for getting event parameters

In IDR, There is a problem that getting the event parameters from KnowledgeBase.
If KnowledgeBase version 2 is correct:
TForm1.FormKeyDown(Sender:TObject; var Key:Word; Shift:TShiftState);

But, if KnowledgeBase version 1, the event parameters can't get:
TForm1.FormKeyDown(?:?; ?:?; ?:?);

Missing update of tab Arguments after editing a function prototype

In file EditFunctionDlg.cpp, in function TFEditFunctionDlg_11011981::bApplyTypeClick, on row 305 there is a call to FillType() - but there is no call to FillArgs(). As a result, when you modify a prototype, you have to close the form and reopen it in order to see the changes on tab Arguments.

Working logic IDR

Hello,

I have a Delphi program without source code.
I have downloaded your program and it ran for a long time (no errors) But then what do i need to do to save all .pas and form files.

Can you explain please

Thanks
Wheel

Suspicious code in Decompiler

In file Decompiler.cpp, around line 7381 there is the following piece of code

        if (_item1.Flags & IF_STACK_PTR)
        {
            Env->Stack[_item1.IntValue].Type = "Variant";
            _item1 = Env->Stack[_item1.IntValue];
        }
        CmpInfo.L = _item1.Name;

        GetRegItem(18, &_item2);//edx - Right argument
        if (_item2.Flags & IF_STACK_PTR)
        {
            Env->Stack[_item2.IntValue].Type = "Variant";
            _item2 = Env->Stack[_item2.IntValue];
            CmpInfo.R = _item2.Name;
        }

Why CmpInfo.L is outside of the if() and CmpInfo.R is inside the if() - should not they be both either inside or outside ?

Knowledge base for delphi 10.1 and later

Hello,
I have a file compiled with Embarcadero Delphi(10.1 Berlin) and while trying to process it with IDR it autodetects it as kb2014 which is obviously wrong.

I the processed file, I get a lot of "prototype of ... is not complete" and "prototype is not complete" and only get the source code for a few functions.

I was wondering how can I obtain the BINs for this version?

This project has been by far the best I could find at decompiling Delphi files. great job!

Bug in TFMain::IsValidCode

In function TFMain_11011981::IsValidCode there is a piece of code

        if (!memcmp(DisInfo.Mnem, "arpl", 4) || 
            !memcmp(DisInfo.Mnem, "out", 3)  || 
            !memcmp(DisInfo.Mnem, "in", 2)) 
        { 
            return -1; 
        }  

It returns -1 even if DisInfo.Mnem contains INC - seems like a bug ?

Add var section to Source Code

Decompiler result look like this:

procedure TForm1.Button4Click(Sender: TObject);
var
  TmpS: AnsiString;
begin//0
  //0044FF6C
  EBX := Self;
  try
    //0044FF83
    ESI := $FF7FFFFF{-8388609};
    EDX := 8;
    EAX := ESI;
    TmpS := IntToHex(ESI, {8});
    EDX := TmpS;
    EAX := Memo1;
    EAX := Memo1.FLines;
    EAX := Memo1.FLines.Add(TmpS);
  finally//1
    //0044FFB8
    TmpS := '';
  end;//1
end;//0

Bug in InfoProcInfo::AddArg

In file Infos.cpp, function InfoProcInfo::AddArg(BYTE Tag, int Ofs, int Size, String Name, String TypeDef) does not initialize argInfo->Register - seems like a bug ?

How idr and IDA PRO connected ?

I disassemble the library in IDR, and debug in IDA pro. How do the results of disassembling from IDR are inserted into ida pro? I make the script, but it breaks the whole code analysis into the IDA.

Bug in TFMain_11011981::miSearchStringClick

In file TabStrings.cpp in function TFMain_11011981::miSearchStringClick there is the following piece of code

if (lbRTTIs->ItemIndex < 0)
  StringsSearchFrom = 0;
else
  StringsSearchFrom = lbStrings->ItemIndex; 

It is obvious that lbRTTIs should be actually lbStrings.

can not open knowledge base file

Hi, first of all, thank you for your great work.
I have a malware analysis homework and I'm trying to get the source code of the malware
when I used PEiD it told me that the malware is using Delphi 6 -7 (screenshot)
image
image
when I'm trying to use IDR I'm getting the following message, I went to the directory and didn't find the file kb2007.bin but found syskb2007.bin
what can I do to fix the problem
best regards

Bug in TFMain_11011981::lbFormsClick

In file Main.cpp in function TFMain_11011981::lbFormsClick instead of

    RTTIsSearchFrom = lbRTTIs->ItemIndex;
    WhereSearch = SEARCH_FORMS; 

it should be

    FormsSearchFrom = lbForms->ItemIndex;
    WhereSearch = SEARCH_FORMS; 

Cannot initialize Disasm

When I start it on Windows 10 or Windows 7. It shows "Cannot initialize Disasm".
image

image

What should I do?

IDC script with type applying

There are the following methods in idc:

  • idc.GetType(ea);
  • idc.SetType(ea, type_string);

They're used the same way as pressing Y button at function header. Is it possible to add types definitions in this script?

Cannot recognize Move function.

2016-07-27_105350
Even if it fully identical, IDR cannot recognize Move function, and I have to use Fuzzy scan KB.
File is TF3Compression.dll

Suspicious code in TFMain_11011981::FindText

In file Main.cpp in function TFMain_11011981::FindText in case SEARCH_NAMES there are
pos = line.Pos("'");
But lines in lbNames are composed from address, item name, colon and item type - there are no quotes, if this is ResourceString; and there are multiple quotes, if this is AnsiString and contains non-latin characters. It seems that the piece of code is copy-pasted from case SEARCH_STRINGS - but here there is no need for Pos() and Substring(), this even seems wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.