More code refactoring: Moved most of the Win32 API dependencies into wrapper function...