I always used this following custom code to api hook (inline hook method), and is working fine in pratically all Windows versions x64, except in newest Windows 10 versions like