When loading a file with OD, it will not stay on the main function, how to determine main the location, which needs to have a knowledge of the program loading process.
Using IDA, you can precisely position main the starting position of a function.
void __cdecl Start () {DWORD V0;//eax@1 intv1;//eax@4V0= GetVersion (); DWORD_4101A4 = BYTE1 (v0); dword_4101a0= V0; dword_41019c = BYTE1 (v0) + (V0<<8); dword_410198 = V0>> -;if(!sub_4068ee (0)) Fast_error_exit (0x1Cu); _ioinit (); dword_411704 =*getcommandlinea*(); dword_41017c = __crtgetenvironmentstringsa (); _SETARGV (); _SETENVP (); _cinit (); Dword_4101b8 = ENVP; V1 = Main (argc, argv, ENVP);Exit(v1);}
As you can see, there is a lot of initialization work before the main function starts. OD is not fully recognized, the only function that can be recognized is GetCommandLine that after this function is executed, it is common to call 4 functions again __crtGetEnviromentStrings、setargv、setenvp、cinit before executing the main function.
Therefore, as long as you skip 4 functions after getcommandline, you can generally reach main the position of the function.
If you do not want to use the IDA loader to get the main function location, use this method to quickly find the main function. is not skipped 4, generally with the compiler has a great relationship, so, this method can only be counted as experience accumulation.
Disassembly c++/c determine the location of the main function