The Win32 API gives you `GetLastError()` which gives you a `DWORD` with the error code, which you can then query for a string, or compare against whatever Windows tells you when the particular error happens. You can see libgit2's `error.c` for some simple uses.