Fixed issues found by winapi_test.