tested on Wine and NetBSD