Hello Everybody

Is there a tool that can tranlate Delphi codes to ASM code. If so could you give me some pointers on how to use it. ( Any ideas would be helpfull )

or could you direct me to the person or Web sites that can teach me how to Tranlate Codes.

Delphi can produce .obj file

I remember reading a few Posts on the Board about a file that come with masm32 Package but no information on how to use it. I think it for tranlating C++ code but off the top of my head Delphi can produce .obj file do this has anything to do with it.

or do anyone specialize in tranlating. If so I have full two pages of Delphi code that need to be tranlated. From there I would be able to follow your code to tranlate nearly any Delphi code.
Posted on 2001-10-06 20:00:15 by cmax
I thought for sure delphi has some sort of asm output!

If you can't find it, lemme know, and I can call my "l33t d3|phi hax0r friend" :grin:
Posted on 2001-10-06 20:05:05 by Kenny
I tried to use the Delphi Output screen ( if i was doing it right... ) but it only show up if you click view ASM from the drop down list ( and only show 1/2 the codes ) and it don't seem that you can edit it or work with it in anyway kind of way.

I can see it but I don't know how to edit it or pull it out and add it to my ASM program for re-coding and optimizing.

Could you check with your Delphi friend and Thanks a lot for being here. In the mean time I will re-check the ASM out-put thing.
Posted on 2001-10-06 20:33:46 by cmax
Delphi asm output will NOT be very useful. First of all, they use API
as little as possible. Not even their messagebox is an api call. This will
make code very hard to follow. The optimizer isn't very nice either...
So you're best off doing a manual translation. If you REALLY want to
look at output, get a OMF capable disassembler. IDA springs to mind.
Posted on 2001-10-06 20:59:28 by f0dder
cmax,

You will find that Delphi and ASM are two different animals. There have been questions here in the past about converting C to asm which can be done with no big deal but the output needs a lot of work before it is useful. In Delphi with its component library you would be looking at a lot of assembler that does not directly reflect on what you need. You will have some success with an assembler dump with the main code areas but the mountain of extra stuff in a Delphi file takes the fun out of it.

I would be inclined to write your own front end code for assembler ads you have the most control of what is happening.

Regards,

hutch@pbq.com.au
Posted on 2001-10-06 22:03:40 by hutch--
Here is where my problem is. Most Delphi Procedure has these types of lines. if I knew what to do with Shared^ and case StartType of I can move on to more important things. Could someone please tranlate this to ASM. I cannot figure it out, but I know it's very close to ASM.

It took me only a few days to drop Delphi when I first learned about masm32 but Delphi is nice to know about. It can help you to build a quick model of what you want have in mind.

Hey Hutch Thanks for the help about combinding strings sometime back... I learned everything else I needed to know behind that. But Front End, Disemble, and PE I yet have to learn.

........................................................................
type

TShared = record
end;
PShared=^TShared;

var
Shared: PShared;

procedure Start(StartType:TStartType); stdcall;
begin
with Shared^ do
case StartType of
wtMOUSE:
begin
MouseHook:=SetWindowsHookEx(WH_MOUSE, @GetMouseHook, HInstance , 0);

end;
end;
end;
.....................................................................

if I can find out what ^ and case mean may be enough. Any ideas or steatchs would be helpfull.
Posted on 2001-10-07 05:19:35 by cmax
The ^ (Caret) is a pointer. It's the same as a * in C/C++.



Thanks,
_Shawn
Posted on 2001-10-08 11:09:44 by _Shawn
Thanks _Shawn

So I figure that case is the same as invoke or an .if statement.

Time to go to work.

Delphi tutes got some of the greatest fuctions we will ever see, and masm32 in my mine still new because it took a real schooled educated programmer to tackle masm back in the day so everyone took the easy way out or what ever Big Bill said. Now that we got masm32 ( and growing ) it's will be great to tranlate what Boland and $M has done to masm32 code.

Time to have some fun. Thanks to Boland and M$ The map is out there for us slowbeeeee and better.

masm32 Forever
Posted on 2001-10-08 18:06:08 by cmax
case is the same as a C switch statement, which can be emulated
in masm with nested .IF/.ELSEIF ... or you can use bitrakes switch macro.
Posted on 2001-10-08 18:10:28 by f0dder
Wait, I'm confused! You're saying that Delpi doesn't call the API? They actually make their own message boxes? I don't get it...
Posted on 2001-10-08 23:49:42 by Kenny
They use API where they *have* to... but try using a delphi messagebox,
and set a softice breakpoint on MessageBoxA and MessageBoxW...
neither will trigger.
Posted on 2001-10-09 07:32:52 by f0dder
hmmm ok :) So, they probably have their own memory copy functions and their own string parsing functions, and ect ect??

Just like C has a library of Windows API calls, Pascal has the simmilar, but of their own stuff? All in all, it sounds cool to me :)
Posted on 2001-10-09 09:11:07 by Kenny
Try setting a breakpoint on MessageBoxA and MessageBoxW for the MessageBox function in .NET and it won't trigger, either. Even Microsoft has it's own class dependant implementation of that. However, call MsgBox and it'll trigger.

The VCL actually does use quite a few api's. They also wrap the API in such a way. I also know that in some places the imlement their own versions of the API. That's even more important now that the VCL is meant to be line for line compatible in the end result with Windows and Linux so that when you compile on one, you compile on the other. Obviously, the plumbing won't work that way, but when you use the classes and methods and properties and events and such, it does work that way for the most part. The VCL is a monster. I enjoy it, but it's dififcult to pinpoint exact lines of code sometimes.

Nonetheless, ... if you want to interface it to assembly, go for it...


Thanks,
_Shawn
Posted on 2001-10-09 10:57:35 by _Shawn
i dont know what you realy want but there is
a tool kalled DEDE and you get all the asm from
the *.exe made in delphi know they suport delphi6

well the DEDE just make the source of a exe to

*.dpr *.dfm *.pas with source code in ASM !

http://www.balbaro.com/dede/index.html


just search the web .. but a messagebox is
a macro window...

extern MessageBoxA
extern ExitProcess
extern FindWindowA
extern SendMessageA
extern ShellExecuteA
%include '\lab\vasm\inc\win32n.inc'
%include '\lab\vasm\inc\nagoa.inc'



ClassName db '#32770',0 ; <--messagebox?s



..start:
enter 0,0

call FindWindowA,ClassName,0
call SendMessageA,eax,WM_CLOSE,0,0

exit:
call ExitProcess ,0
xor eax,eax
leave
ret 16
Posted on 2001-10-10 20:06:03 by Nguga