Fix compilation errors and possible server crash from previous commits.
Update HPM hooks after commit 6dd08befa6064a652d0d98e7cb85f0e353992dd5.
Merge pull request #424 from 4144/hpmupdate

Fixes after commit 6dd08befa6064a652d0d98e7cb85f0e353992dd5.
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.
add comment about possible error.
Improve performance a bit by removing strlen(str) > 0.