As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is there any way to disassemble my .dll file again into machine code?
What applications do I need for this and how much could be recovered?
Check PE File Explorer, this tool is amazing, is built with Delphi, and has special support for Delphi applications.
You can analyze, disassemble, edit the resources
PE Explorer is the most feature-packed
program for inspecting the inner
workings of your own software, and
more importantly, third party Windows
applications and libraries for which
you do not have source code. Once you
have selected the file you wish to
examine, PE Explorer will analyze the
file and display a summary of the PE
header information, and all of the
resources contained in the PE file.
From here, the tool allows you to
explore the specific elements within
an executable file.
(source: pe-explorer.com)
You need a disassembler, like IDA Pro. They have a free edition too. You'll get back machine code (assembly), and you should be able to pick out the function calls made to the Windows API.
If you lost the source file and you really only need to "get your work back", then you might as well start re-coding it because you're not going to get anything useful out of decompiler. I haven't been able to get anything re-compilable out of a decompiler since the days of Ms-DOS COM files (not to be confused with Windows COM!).
A modern file, written in an high level language, ran throw an optimizing compiler simply doesn't include everything that's needed to reconstruct the source code.
Examples, and it's just the top of the iceberg:
Delphi's optimizing linker will SKIP code that's not used. Ever noticed when you want to place an brakepoint on a line of code and when the program starts the brakepoint is ignored because the code has been optimized-out?
Delphi's optimizing compiler has the option of doing all sorts of things with your code:
It can inline procedures (so they're no longer where you wrote them, they're where the call is made).
It can unwind "for" loops (so where you had an "for i:=1 to 10 do something" you now have "something; something; something;...".
Local variables get optimized, addresses get reused.
Data structures are aligned to whatever the rule of the day is. So your one word + 1 byte structures might have 4 or 8 bytes in memory, not 3 as you might expect.
Code gets imported from other libraries. An DLL is not an DCU. A 3 lines DLL might actually import thousands of lines of code from those "uses" clauses.
You won't be able to get more than assembly code, because Delphi is native unlike Java or .Net Languages, where you can get a whole bunch more of information.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is there any online, editable, code base that can also compile the code?
This is more of an "I wish" than a question, since I've tried to find one with no success. It seems to me that there are a number of open-source, very popular systems which could be integrated for a great benefit to the open-source community.
An online collaborative tool, basically a wiki. Needs to have some versioning.
An IDE/SDK type tool - at a minimum just a syntax checker and compiler
If these two are combined, you would have an open source project that anyone contribute to. The way I see it working is like this:
Every wiki page is a single class
To update a class you must pass a syntax check, including not breaking any other classes that depend on this class
There are two kinds of users - administrators and contributors (who can be anonymous).
Administrators have to approve updates to classes before they can be included in a compile-able release. They also rate the changes that they "approve", which is a sort-of ranking system for the contributors. If security is a concern, you could say that every approved change is randomly assigned to another admin for approval, and if that person detects malicious code then the first approver is now suspect and may be removed from being an admin.
Contributors can download any approved release, and can optionally download a version that includes all of their own revisions that have not been approved yet. This is normally for their own testing, but maybe they just want to change a behavior, even if no one else likes that change.
Any class (that meets certain requirements) can be marked as a "root" class, which means it can be compiled with its dependencies.
The advantages with this system seem huge to me!
Participation with almost no effort. The work of joining an open-source project is normally at a minimum an hour or more. That is in addition to initially downloading and installing a compatible SDK tool.
Learning about open-source with much reduced effort. I see many more people joining in with a friendly, wikipedia style site that they can just browse through as a way of learning the code base
Better code base (refactoring) All those people who tweak wikipedia will be free to tweak source code too. Cleaner code will in turn be easier to read and maintain.
Easy customization If I want to add a feature to my favorite open-source software, I can just make a change and download the compiled version. No need to
This could be a build process for web servers. Plug this into updating a web-site, and it can replace your current build server. When a version is approved, it just deploys the update (presumably on a schedule so it is during low-usage hours)
I see a few down-sides, the same as those that already exist in wiki sites and open-source projects, somewhat amplified. But I think these all have somewhat standard
Public/anonymous contributions could be bad or malicious
Blocking "spam" contributions
Bandwidth of downloads (all those executable files)
CPU to compile all the versions
Does any such thing exists? If not, how feasible would it be for a team to put this together? Are there any other major problems that could kill this idea?
This idea just occurred to me one day, and I can't find it. I'm putting this "out there" partially to "establish prior art". This idea is free to be taken and used, just not free to be patented :p.
Perhaps you're looking for Cloud9 IDE?
From their website:
Cloud9 IDE is an online development environment for Javascript and Node.js applications as well as HTML, CSS, PHP, Java, Ruby and 23 other languages... Teams can collaborate on projects and run them within the browser. When you're finished, deploy it—and you're done!
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
At one point I had a nice little compression utility that smashed my Delphi compiled EXE's to a smaller download size, but now I can't find it. Any recommendations?
Also, are there any downsides to using these kinds of utilities? (I mainly use them to shorten download times for rural / dial-up users).
Related question: Are there any downsides to using UPX to compress a Windows executable?
Years ago I looked into compressing my executable to make the download smaller.
What I ended up doing, and what I recommend for you, is to use an installer program like Inno Setup instead. Not only does it create a single EXE that will install/uninstall your program, but it also compresses that EXE practically as much as a separate compressor would do to your executable alone.
When the program is installed it gets decompressed, so it never appears to be a virus and does not increase load times.
So I get the benefits of smaller download size, and a professional-looking installation script at the same time.
p.s. Inno Setup is free.
The recommendation is that you not:
EXE compressors can make your application seem like a virus (self-modifying)
gzip/zip are just as effective at compressing and don't tinker with your app
EXE compressors make the load times of your app increase (unless you're just talking about the setup program which is a different matter
This crazy looking site brings up an argument I had heard in the distant past (whether it's true or not still today, I'm not sure, modern packers probably have a different strategy today) This article references Win32! :)
http://topic.csdn.net/t/20000408/08/6785.html
Modern multitasking OSes such as
Windows 95/98 and NT use what is
called a "virtual memory" system. When
programs start, all of their code is
not loaded into memory immediately
upon startup, as was the case with DOS
programs. Instead, only portions of
the code being actively executed are
stored into memory. For example, say
your program has a Print option on its
menu, and code behind it that handles
the printing. This code will only be
loaded into memory once the Print
feature is first selected by the user.
And if after the code is loaded into
memory the Print feature is not used
for a while the system will "discard"
the code, freeing the memory it
occupied, if another application
desperately needs memory. This is part
of a process called "paging" and is
completely transparent to the program.
Another way paging under Win32
conserves memory is it causes multiple
instances of a program (or DLL) to
share the same memory for code. In
other words, under normal
circumstances there is no real
difference in the amount of physical
memory allocated for code between
starting 100 instances of a program
and starting one instance.
If all Win32 programs behaved like
DOS programs, loading everything into
memory and keeping it there until the
program terminated and also not
sharing any memory between multiple
instances, you can probably imagine
how quickly physical memory could run
out on systems with a limited amount,
causing disk swapping to start.
Yet this is precisely what current
Win32 EXE compressors do to your
EXE's/DLL's! They completely go
against the OS's paging system by
decompressing all code into memory and
keeping it there until termination.
And because code isn't stored in a
"raw" format in the EXE file (i.e. the
same way it is stored in memory), the
OS is unable to share code between
multiple instances.
I don't know of any that are specifically for Delphi, but UPX is very popular for this sort of thing. The only downside is that the executable has to be decompressed when it's launched, and that can eat some time. It seems to be very fast for sanely sized executables, though.
The one you are probably thinking of is ASPack - it is a EXE compressor written in Delphi, but will compress any EXE. It might do extra well on Delphi EXE's though. I would agree with the other answers that you should not use an EXE compressor just to save on download times. There may be specific situations where an EXE compress is a good idea, but generally it is not.
Instead use a good installation builder, especially if you can find one that uses 7zip compression. I know InstallAware uses 7zip internally for maximum compression. Depending on which versions of Delphi you own you may have an InstallAware license too.
If nothing else you can build a self extracting archive with basic install behavior with 7zip for free. It is a separate download for SFXs for installers.
Use UPX with lzma option for max compression.
upx --lzma yourfile.exe
The main inconvenience of a compressed EXE or DLL is that the OS cannot share the code amongst multiple instances.
So you're wasting memory, have to decompress each time you start an instance, exhibit a virus-like behavior without even an download advantage over a compressed install.
Only positive case is when launching directly from a network drive.
I believe Terminal servers (Like Citrix) will use the same memory for you're application binary if it is uncompressed. Meaning a compressed exe could smell a small disaster in a Citrix environment.
UPX should work, although it's not Delphi specific.
I use PEtite: http://un4seen.com/petite/
I would also vote for upx. Beside the downsides which were mentioned it also protects from basic reverse engineering and those lame "resource hacker" tools. Which by the way are plenty, and most of them fail to open a compressed executable.
I asked a question about the con's of using UPX on Delphi executables here on SO a while back, and I got some great responses.
Are there any downsides to using UPX to compress a Windows executable?
You can use PECompact since people can't decrypt it easily, and as test showed (showed on main page, just scroll down a bit) it's better than ASPack or UPX, i've using it on my previous Delphi projects
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
As I'm switching from Windows to Ubuntu/Gnome, I'm looking for an alternative to UltraEdit.
I tried a few tools, but they often lack some really useful features, such as:
Syntax coloration
FTP editing of files (access files on a FTP without using an external application)
Character set management.
Which one do you use? And what are their major features?
I just use plain old gedit. It has syntax highlighting and handles charsets.
For handling files on FTP shares I just mount them using the Places->"Connect to Server" functionality and then the remote files are easily accessible from gedit (or any other Gnome program for that matter).
Ultraedit is now available for Ubuntu. It's commercial, but fairly cheap and there is a free trial.
http://www.ultraedit.com/company/blog/products/ultraedit-for-linux-released.html
In the spirit of cross-platform editors, I'd like to point to Scintilla and SciTE. Implementations are used in many IDEs and editors, available for Windows and Linux.
SciTE is a SCIntilla based Text Editor. Originally built to demonstrate Scintilla, it has grown to be a generally useful editor with facilities for building and running programs. It is best used for jobs with simple configurations - I use it for building test and demonstration programs as well as SciTE and Scintilla, themselves.
SciTE is currently available for Intel Win32 and Linux compatible operating systems with GTK+. It has been run on Windows XP and on Fedora 8 and Ubuntu 7.10 with GTK+ 2.12
Scintilla is a free source code editing component. It comes with complete source code and a license that permits use in any free project or commercial product.
As well as features found in standard text editing components, Scintilla includes features especially useful when editing and debugging source code. These include support for syntax styling, error indicators, code completion and call tips. The selection margin can contain markers like those used in debuggers to indicate breakpoints and the current line. Styling choices are more open than with many editors, allowing the use of proportional fonts, bold and italics, multiple foreground and background colours and multiple fonts.
Kate supports syntax coloring and lots of charsets. I'm not sure what you mean by "ftp edition of files", but kate also includes a console, so you could use ftp from there.
geany is a lovely editor, but it uses GTK+ and not GNOME, so it doesn't have gnome-vfs/gvfs integration. bluefish has the gnome-vfs/gvfs integration, but is a bit on the buggy side. gvim is a bit harder to use and doesn't support FTP directly, but is very extensible. In the worst case you could use FUSE to mount the FTP directory onto your system.
Do not look for FTP support in applications. This stuff is better handled by the system, using FUSE file systems or Gnome VFS, etc.
If you want to be hardcore, and want to pick up a semi-useful skill, look into learning vim (or a variant such as ultra-hardcore vi, GUI gvim, etc.); vi and its siblings are the most widespread installed editors on *nix boxes- you might find yourself in a situation where the only editor available is vi.
Otherwise, I would suggest using something that supports the language you use- i.e. I'd rather not program Java without Eclipse.
For other stuff, I use joe, which is a very small and nice command-line editor with Wordstar key bindings.
Just tried Jedit on ubuntu 8.1 and it is the closest to ultraedit with some additional powerful features.. quite happy for now..
Antoher wonderful editor is Screem. It's not very mature, but it's full of useful features.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have many small files containing code fragments, pseudo-code algorithms, classes, templates, SQL-samples, etc., and I obviously cannot put all these into libraries. I need a practical method to index all of them, and to be able to make this index available to others.
What must such an index contain to
make searching easiest?
Are there any such repositories
available on the web? (So I can test
the techniques they use.)
Are there any applications already
written that implement this that I
can have a look at?
Possible duplicate: https://stackoverflow.com/q/90300/15161
If you're working with .NET / Visual Studio, you could look at adding them as code snippets
Code Keep is a pretty good online repo for CodeSnippets and has plugins for VS2008
What we've done at work is created a common account for the dev to use, so everyone submits to codekeep under a common login and then can retrieve everyone elses snippets.
Also it might be worth your while creating a developer wiki on your dev network. Somewhere that the old hands can leave documentation on your regularly used patterns & snippets and new team members can check for help. We use TRAC in house as an all in one WIKI / Issue Management / SVN Integration and it does the job nicely
Another similar result from searching StackOverflow: Best Application For Storing Code Snippets
You might want to try refactormycode.com or set up your own wiki for it. A wiki actually sounds like a good application here.
I find the only way to manage source code is in the source control repository. This includes templates and pseudo code algorithms.
How it's different from the rest of your code ?
I'm familiar with cvs that can be hosted for example here (setting up cvs server is not to complex task either) you can search the repository using cvsearch and browse it using cvs web client.
I'm not saying cvs is a best option just another one that fulfill all your need.
Code snippets is a not a good option, IMHO.
You can do a full-text index of your hard drive using a tool like Copernic, Windows Live Search, or Google Desktop. Then whenever you want a code snippet that does a specific thing, just search for the relevant keywords and there it goes.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I was wondering; which logging libraries for Delphi do you prefer?
CodeSite
SmartInspect
Log4Delphi
TraceFormat
Please try to add a reasoning why you prefer one over the other if you've used more than one.
I'll add suggestions to this question to keep things readable.
I've used Codesite and it has been fantastic. On one project, a word-processor, I could easily output a million debug lines, all structured, and Codesite helped greatly with its auto-collapsing indented output. For any task where you have to know what really is happening "underneath" a process that can't be interrupted by user interaction, Codesite is really good. I recommend it heartily.
SmartInspect is really useful. It is the only one I have used. The logging library is good, but the console and the remote TCP/IP logging takes it over the top. I think CodeSite has some similar features.
Take a look at the features of this Open Source unit:
http://blog.synopse.info/post/2011/04/14/Enhanced-logging-in-SynCommons
logging with a set of levels (not only a hierarchy of levels);
fast, low execution overhead;
can load .map file symbols to be used in logging;
compression of .map into binary .mab (900 KB -> 70 KB);
optional inclusion of the .map/.mab into the .exe;
handle libraries (.ocx/.dll);
exception logging (Delphi or low-level exceptions) with unit names and line numbers;
optional stack trace with units and line numbers;
methods or procedure recursive tracing, with Enter and auto-Leave;
high resolution time stamps, for customer-side profiling of the application execution;
set / enumerates / TList / TPersistent / TObjectList / dynamic array JSON serialization;
per-thread, rotating or global logging;
multiple log files on the same process;
optional colored console display;
optional redirected logging (e.g. to third party library, or to a remote server);
log viewer GUI application, with per event or per thread filters, and method execution profiler;
Open Source, works from Delphi 5 up to XE6 (Win32 and Win64).
Your feedback is welcome!
And don't forget the free open source TraceTool
I have just updated Log4Delphi 0.8 on the Sourceforge page and it rolls up patches and bug fixes from the last 4 years.
Sourceforge Log4Delphi Downloads
Log4net/ports of Log4xxx to other languages. It's open-source, pretty wide-spread, popular, has a good community behind, and isused widel (for example, in Hibernate/nHibernate).
An important value behind CodeSite is Ray Kanopka's support. He personally answers emails and newsgroup posts, and has done so for many years. His answers often contain code that illustrates excellent coding habits.
I didn't use CodeSite probably because I'm completely happy with SmartInspect. Highly recommended.
I am looking into Codesite as well. I built my own in the past but I really like the featrues in Codesite. The Raize componenets are very well written and always quality stuff.
Log4D is another implementation which is based on Log4J and easy to extend and configure.