c# API hook implementation