I noticed that visual studio community 2015 sp3 strangely does not create code for a single line(shown in code)(both debug and release). I minimized project and put code here.
#include "stdafx.h"
enum AMINZIPCMD { AMINZIP_RELEASE = 0 };
enum AMINZIPRESULT { AMINZIP_SUCCESS = 0, AMINZIP_FAILURE };
struct AMINZIP {
unsigned __int32 m_cbSize;
unsigned __int32 m_dwType;
};
#define DLL_EXPORT __declspec(dllexport) __stdcall
extern "C" {
int DLL_EXPORT uAminZip(enum AMINZIPCMD iCmd, struct AMINZIP * pAminZip);
};
#define global_func
/*------------------------------------------------------------*/
global_func int DLL_EXPORT uAminZip(enum AMINZIPCMD iCmd, struct AMINZIP * pAminZip)
{
//No code generated for this line
if (pAminZip->m_cbSize != sizeof(*pAminZip)) AMINZIP_FAILURE;
if (pAminZip->m_dwType != 718624670) return AMINZIP_FAILURE;
return AMINZIP_SUCCESS;
}
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
struct AMINZIP aminzip;
return uAminZip(AMINZIP_RELEASE, &aminzip);
}
/*------------------------------------------------------------*/
and assembly window for uAminZip function here
global_func int DLL_EXPORT uAminZip(enum AMINZIPCMD iCmd, struct AMINZIP * pAminZip)
{
00F01690 55 push ebp
00F01691 8B EC mov ebp,esp
00F01693 81 EC C0 00 00 00 sub esp,0C0h
00F01699 53 push ebx
00F0169A 56 push esi
00F0169B 57 push edi
00F0169C 8D BD 40 FF FF FF lea edi,[ebp-0C0h]
00F016A2 B9 30 00 00 00 mov ecx,30h
00F016A7 B8 CC CC CC CC mov eax,0CCCCCCCCh
00F016AC F3 AB rep stos dword ptr es:[edi]
if (pAminZip->m_cbSize != sizeof(*pAminZip)) AMINZIP_FAILURE;
if (pAminZip->m_dwType != 718624670) return AMINZIP_FAILURE;
00F016AE 8B 45 0C mov eax,dword ptr [pAminZip]
00F016B1 81 78 04 9E 57 D5 2A cmp dword ptr [eax+4],2AD5579Eh
00F016B8 74 07 je uAminZip+31h (0F016C1h)
00F016BA B8 01 00 00 00 mov eax,1
00F016BF EB 02 jmp uAminZip+33h (0F016C3h)
return AMINZIP_SUCCESS;
00F016C1 33 C0 xor eax,eax
}
00F016C3 5F pop edi
00F016C4 5E pop esi
00F016C5 5B pop ebx
00F016C6 8B E5 mov esp,ebp
00F016C8 5D pop ebp
00F016C9 C2 08 00 ret 8
I created a fresh Win32 project and copied code to it, but the problem remains
mr.abzadeh
Should the line contain the "return" statement?