Convert errno.h error values to Win32 GetLastError() equivalents

Viewed 5754

I'm writing a layer between a POSIX filesystem, and Windows using Dokan, and need to convert error values of the errno kind (EINVAL, ENOENT, etc.), to the Win32 equivalents you'd receive when calling GetLastError() (such as ERROR_INVALID_PARAMETER).

Is there an existing function, library, or reference I can use to perform these conversions?

I typically poke through the Python source for inspiration on these matters, but Python neatly avoids this need (at least as far as I can tell).

As an example, EINVAL (22) would convert to ERROR_INVALID_PARAMETER (87).

2 Answers
Related