winapi implementation (unfinished)