Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 879 Vote(s) - 3.46 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MS Visual Studio 2010 how to use the .asm generated file

#1
I would like to ask about something I am thinking to try with Visual Studio 2010.

I am generating an .asm file from the.cpp file by setting the option to the "Assembler Output" in the project properties --> C/C++ --> Output Files (/FAs).

My question is, how can I on a next step use that .asm generated file to link again from that one without using anymore the .cpp file, in case I want to do some modifications inside the .asm file and then link again by keeping the modifications I did at assembly level.

It would be very helpful if you could provide the exact steps, including the correct configuration may needed in the project properties.


Reply

#2
Here is a tutorial

[To see links please register here]

Reply

#3
I did this recently. Here is a repeat of the answer I gave here [compile-assembly-output-generated-by-vc](

[To see links please register here]

). It turns out you can still do this in 32-bit mode in MSVC2012 but I think 64-bit mode is hopeless.

For 32-bit mode here is what you do.

Create an empty project and a source file *Source.cpp*

#include <stdio.h>
int main() {
printf("hello world\n");
return 0;
}

1. Right lick on your project and select "Build Customization" and
select masm as described here

[To see links please register here]

2. Under C++/OutputFiles select Assembly Output /FA
3. Comipile in 32-bit mode Release mode
4. Load the *Source.asm* file into MSVC so you can view it. It won't work yet. A few changes are still necessary.
5. Under C++/Optimization turn off Whole Program Optimization (removes `/GL`). This adds the line `INCLUDELIB MSVCRT`
6. In the Linker/Advanced set the last option "Image Has Safe Exception Handlers"to No (`/SAFESEH:NO`)
7. Now you should have a Source.asm file which will do the same thing that Source.cpp file did. Copy the Source.cpp from the Release directory to the same directory as Source.cpp (so it's not deleted when you build/clean).
8. Add *Source.asm* (as an existing file) to the Source Files and remove *Source.cpp* from the build.
9. **Rebuild and you should see "Hello World" without having to change any assembly lines by hand.**

I have used this for more complicated functions. I usually do it on a separate module and use `extern "C"` on the function name to remove the C++ name mangling.
Reply

#4
Simply drag the .obj files into the Project (Solution Explorer tree):

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through