Showing posts with label Delphi. Show all posts
Showing posts with label Delphi. Show all posts

7 Mar 2014

Delphi + Windows Dialogs

Even after all these years using Delphi 7 I still wish it had Windows Dialog designer rather than custom Form VCL.  I think Delphi would have been a more popular language if they had done this years ago.

I guess it would be possible to make a Delphi Expert to do this, but I cannot find one.

I never use VCL or Forms and have made my own libraries to do this, maybe harder for me but I make programs that are easy for user, not for coder, and smaller the better!

8 Aug 2011

WinMax plugin for OllyDbg v2.xx

Over on my site I have released my first plugin for OllyDbg v2.xx, Window Maximizer ..  As the name suggests, this plugin simply keeps all windows maximized automatically.
The new plugin-capable OllyDbg has been out for just a couple of days and is still alpha, so I haven't converted the full PDK yet, but full Delphi source is included.

Download

31 Mar 2011

Weird Delphi 7 compiler bugs (Part 1)

This one I came across only recently.  It is only affected in ASM blocks.


Function  BugTest : Cardinal;
Asm
    Jmp  @Start
  @L1:
    Nop
    Nop
    Nop
    Nop
  @L2:
    Jmp  @L1
    Nop
    Nop
  @L3:  
    DD  Offset L2    // Start address
    DD  Offset L3    // End address
  // Return the distance between labels @L2 and @L3
  @Start:
    Lea ECX, Offset @L3
    Mov EAX, [ECX]   // Get start address
    Mov ECX, [ECX+4] // Get end address
    Sub ECX, EAX     // Sub start from end to get len
    Mov @Result, ECX
End;
Running this code should give a result of 4 (2-byte Jmp and 2 nops) but it doesn't, the function returns 8!

What actually happens is that the start address is taken from the JMP instruction at the @L2 label, meaning that the start address value compiled in the table at @L3 points to @L1 instead of @L2 ..
This doesn't happen with any conditional JCC either, just JMP, and only when pointed to by a DWord table offset..  Very rare condition, but annoying if you don't know what is going on.

So how to stop this? Well, as I said you can alter the JMP to be a JCC or rearrange the instructions so that the first instruction is not a JMP (I added a NOP)