If somebody is interested, for now problem with anti-virus is fixed via comparing my C++ code with similar ASM program, that doesn't have such problems. Looks like anti-viruses hate GetModuleHandle("KERNEL32.DLL"). It's better to use LoadLibrary/FreeLibrary instead.
Another question - why it's necessary to install 32bit gcc in order to compile for 32bit target (i.e. -m32)? Why there is no cross-compile option? According to error messages 64bit compiler can't find 32bit libraries when using -m32. So may be there is some way to configure paths instead of using 32bit compiler?