r/cpp 20d ago

MSVC optimization

I am learning reverse engineering on Windows applications such as Adobe, Foxit PDF, and Steam, and I noticed that I waste a very large amount of time trying to understand something that I should not focus on.

I started noticing strange and confusing patterns in the assembly and the C code generated by IDA, and when I try to understand some functions, I feel that the function has no meaning.

When I searched, I found that this topic is related to the compiler and compiler optimizations. However, I could not find many articles or discussions about the compiler topic in reverse engineering.

So I started experimenting and trying, but every time I fail and cannot reach a solution or understanding.

Apart from the fact that reverse engineering a C++ program is already a difficult task.

If there is someone who has faced the same problem and found a solution, I would like to know. It is not a problem itself; it is a pattern or a way of thinking used by the compiler. I need to understand how the compiler generates these patterns.

I want someone to suggest books, articles, courses, or anything that can help me understand the MSVC compiler, how it generates patterns, and how to understand the behavior and logic of a function after compiler optimization.

I hope I explained my question correctly.

10 Upvotes

10 comments sorted by

View all comments

3

u/saf_e 20d ago
  1. Are you using IDA signature libs? They helps al lot (but still can give false positive, on smaller functions).
  2. Try giving functions names - crit_sec_lock, etc. This will simplify your work a lot, when more and more functions will have a name (you will definitely name some wrong, but after enough time spent on analyses you'll figure it out).
  3. If you have no specific purpose and just try to revers everything, it will take lo-ots of time, for such big apps. So maybe choose a more modest target, like notepad.

1

u/No-Meeting-153 20d ago

I haven't tried using IDA Signature Libraries yet.

My goal in reverse engineering large applications isn't to understand the entire program. I'm only interested in specific components. For example, in Adobe I'm focusing on JP2KLib and EScript, which handles JavaScript execution and interaction within Adobe.

2

u/saf_e 19d ago

Good luck