Sign in to follow this  
sewar711

source code

Recommended Posts

sewar711    100
My question is What tools do I need to view source code of a game writen in C++ the exe file for the game is about 1.4 miga any nice person can help

Share this post


Link to post
Share on other sites
jpetrie    13138
If all you have is an executable, the best you can do is view the disassembly. You cannot transform an executable back into C++. Searching for a "disassembler" will yield some tools; one also comes with Visual Studio.

What exactly are you trying to do?

Share this post


Link to post
Share on other sites
Simian Man    1022
If you only have the .exe, there is no way to view the original C++ source. You can view the machine code with a hex editor (I use gvim), or you could search for a disassembler or decompiler.

A disassembler translates machine code into assembly, and a decompiler translates it into a higher level language (usually C). The code you get with these program will *not* look like the original code though. I have never used a decompiler, so I have no suggestions here.

But if you have the source code, then yeah Wordpad or Notepad will work just fine.

Share this post


Link to post
Share on other sites
sewar711    100
This reply is for all the nice people how answere my question
some of u asked what is it am trying to do.
well it is an idea but I don't know if it is possible without the source code of the game.
What it is I have this EXE file it is for a game. When you run the game and when you hit [ENTER] a dialog box pops up (in the middle of screen) to enter some chat. I would like to know where I can find this dialog box so I can edit its shape or it's location on the screen. I appreciate your respond. Note I used PE explorer but did not extarct dialog boxes only icon stupid and some scripts. I used Winspector and told me information about this dialog box.
such as it's class name, size, coordinates..etc.

Share this post


Link to post
Share on other sites
jpetrie    13138
It's possible, although it is very likely that it is going to be so difficult its not worth the trouble. You might be able to locate, if you spend a lot of time, the dialog's resource definition in memory someplace and edit it, but that won't actually "stick" unless the code doesn't ever modify the dialog, and you have to get sizes and offsets correct, and you have to be able to find the dialog in the first place (it may be totally generated on the fly, et cetera).

It's really not a viable operation.

Share this post


Link to post
Share on other sites
Ozymandias43    158
If you want to do it with a quick hack, it's not too troublesome to order the window around with another program and some window messages. Use spy++ to figure out the class of the dialog box, then write a program that looks for that dialog box and tells it to set its location. It's an ugly hack, but it's 1000x easier than changing the exe.

Share this post


Link to post
Share on other sites
sewar711    100
This reply is for all the nice people how answere my question
Ok let us take it a step by step.
1- When I hit the enter key on the keyboard then the message box appears
who calls this message box ..is it windows or some dll file or the game it self

Share this post


Link to post
Share on other sites
sewar711    100
It is not modifying what we trying to do. It is tweaking of the game
I do not like the message box in the center of the screen. Why can it be on top or at the bottom of screen. The integrity of the exe will remain unchanged.
thankx for your input anyway .

Share this post


Link to post
Share on other sites
oliii    2196
The window positioning is probably part of the exe, as part of the resources, compiled with the code. If it is a standard Microsoft Window (not some custon in-game window), Using a window spy could be the solution. I'm not sure if this will allow you to modify the binary itself.

It can also be that the window position is dynamic, and adapts to screen resolution, and the window placement is dynamically computed in the code. That way, you will have no way of changing that.

Share this post


Link to post
Share on other sites
owl    376
Quote:
Original post by sewar711
This reply is for all the nice people how answere my question


lol.

If you can program, take a look at msdn at the windows hooks api.

Share this post


Link to post
Share on other sites
ddyer    262
I usually find a barf bag to be a handy accessory when
viewing C++ code. Also a hammer to hit myself over the
head with.

Share this post


Link to post
Share on other sites
Palidine    1315
You're going to need to learn assembly and pick up a program like Soft iCE. But get a few years of programming experience under your belt before you try this.

What you want to do is _very_ hard.

-me

Share this post


Link to post
Share on other sites
TheAdmiral    1122
Quote:
Original post by Palidine
You're going to need to learn assembly and pick up a program like Soft iCE.

Using SoftICE (or any kernel debugger, for that matter) would be cracking this nut with an asteroid. A user-mode debugger such as OllyDbg would be better-suited.

But before you get into disassembling anything, try to find out what language or tool compiler and linker the program was created with. If it's something mainstream, then there will probably be a tool already out there that's capable of extracting and modifying the resource script/tree.

I'd recommend you get hold of a copy of PeID. It's free, and it has a huge database of PE fingerprints that can tell you what assembler, compiler or other was used to build the executable. From here, you'll be far better-equipped to mess around with the dialog parameters. Report back with your findings and anything else you know about the target, and we can direct you further.

Edit: I just realised we're talking C++.

Admiral

Share this post


Link to post
Share on other sites
sewar711    100
I downloaded the Peid..It was nice
And when I loaded the exe (empiresx.exe) I got the following info.
Microsoft Visual C++ 6.0
Entrypoint: 00128F78
File Offset:00128F78
First Bytes: 55,8B,EC,6A
Linker Info: 6.0
Subsystem :Win32 GUI
Now where do I go from here?

Share this post


Link to post
Share on other sites
sewar711    100
Quote:
Original post by Palidine
You're going to need to learn assembly and pick up a program like Soft iCE. But get a few years of programming experience under your belt before you try this.

What you want to do is _very_ hard.

-me


Any link to download softice for xp
Regards

Share this post


Link to post
Share on other sites
TheAdmiral    1122
If it was linked using Visual Studio 6, then the dialogs may well use standard ActiveX scripts. Have a look at Resource Hacker. It's a freeware .rsrc viewer and editor, capable of modifying such scripts. Fire it up with the target executable and have a look in the Dialogs branch. If the dialog you're looking for is in there, changing it to your liking should be childsplay.

If Resource Hacker is no help, then it's likely that the dialogs are created dynamically in code. In this case you will have to get your hands dirty with a debugger.

Edit:
Quote:
Original post by sewar711
Any link to download softice for xp?

First, see my comment regarding SoftICE earlier. It's difficult enough to learn to use a friendly debugger such as OllyDbg, let alone a car-crash of a kernel debugger*.

Second, note that SoftICE isn't free. In fact, it is part of a very expensive driver development suite.

Third, understand that SoftICE is barely compatible with Windows XP, and simply having it installed causes many applications to refuse to run. I regularly have nightmares about installing SoftICE.

Admiral

* Perhaps that's not fair. SoftICE is very good in the light of its competition. It's the best of a bad bunch, I guess.

Share this post


Link to post
Share on other sites
LessBread    1415
Quote:
Original post by TheAdmiral
If it was linked using Visual Studio 6, then the dialogs may well use standard ActiveX scripts. Have a look at Resource Hacker. It's a freeware .rsrc viewer and editor, capable of modifying such scripts. Fire it up with the target executable and have a look in the Dialogs branch. If the dialog you're looking for is in there, changing it to your liking should be childsplay.

If Resource Hacker is no help, then it's likely that the dialogs are created dynamically in code. In this case you will have to get your hands dirty with a debugger.


The Resource tools of PE Explorer are top notch. That tool also identifies the compiler used to build the exe.

@sewar711, if you weren't able to find the dialog resource using PE Explorer, it could be that window that pops up isn't a dialog window at all but a ordinary window with child windows etc. If that's the case, you'll probably need to hook that window in order to move it. To do that you need to identify the window class using a window spy tool, like WinSpy++. In fact, WinSpy++ will let you move any window, so you won't need to write a hook program at all. That tool won't permanently move the window. It will reappear in the same place the next time you run the program. If it turns out that the window isn't a window at all but simply a message box (ie the results of a call to MessageBox), WinSpy++ will be able to move that too, because message boxes are windows too.


Share this post


Link to post
Share on other sites
ToohrVyk    1596
Quote:
Original post by sewar711
how can I send an attachment in thid topic
I want to u to see how the message box looks like
Regards


Upload the file to another website (google for free file or image hosting). Then, provide us with a link (preferably with <a> tags, so it's clickable).

Share this post


Link to post
Share on other sites
sewar711    100
Quote:
Original post by ToohrVyk
Quote:
Original post by sewar711
how can I send an attachment in thid topic
I want to u to see how the message box looks like
Regards


Upload the file to another website (google for free file or image hosting). Then, provide us with a link (preferably with <a> tags, so it's clickable).


you mean that the forum has on such attachment procedure...
google upload file need to register first is that true?
Regards

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this