Follow up@6dd08befa6064a652d0d98e7cb85f0e353992dd5

Signed-off-by: malufett <malufett.eat.my.binaries@gmail.com>
Fix possible memory overflows and underflows.
Add some missing null pointer checks after automatic checks.
Remove useless checks.
fix typo in inter.c in initerface initialisation.
Fix wrong useless cycle added in commit c47d8e4b8f9d63ab6b4e7e286e91cd50a5bdd151.
Fix checking result from function TryEnterCriticalSection.
fix wrong check.