Sunday, July 31, 2011

Unusual way to learn Compiler Design

Compiler design is probably a rather boring subject without a real-life example. However, it's a very important subject in the field of reverse code engineering. How to learn it in an entertaining way? well, if you haven't read The Art of Disassembly, then you should read it now. You can download it from many places on the net, for example:The Art of Disasembly

Chapter 2 in the book specifically explains about compiler design for x86 architecture. The book is a bit old. However, the knowledge contained in it is very fundamental.

Sunday, July 24, 2011

_CRT_SECURE_NO_WARNINGS Error Message in Visual Studio 2010 (VC++)

Using "legacy"/"unsecure" I/O functions in Visual Studio 2010 would trigger error similar to this:

1>emufuncs.cpp(672): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(234) : see declaration of 'fopen'

which results in this error:

1>peutils.cpp(64): error C3861: 'dont_use_fgetc': identifier not found
1>peutils.cpp(224): error C3861: 'dont_use_fseek': identifier not found
1>peutils.cpp(229): error C3861: 'dont_use_fread': identifier not found
1>peutils.cpp(247): error C3861: 'dont_use_ftell': identifier not found

If you insist on using the "legacy" code, the solution is to define the following preprocessor definitions in your Visual Studio 2010 project properties:


The preprocessor definition can be accessed in this menu: Project|Properties(Alt+F7)|Configuration Properties|C/C++|Preprocessor|Preprocessor Definitions.

After defining USE_STANDARD_FILE_FUNCTIONS;_CRT_SECURE_NO_WARNINGS; in your Visual C++ project, you should be good to go.

Happy coding.