Refactor some win32-depend code