Fixed major crash when calling surface->unlock. Multithreaded calls to Rehook/Unhook causes memory corruption, so I protected the Unlock call with a global named mutex. Also cleaned up code.