windows: add DLLError.Unwrap function

Because we're expecting for future functions to be unavailable, we
should add an Unwrap() function to the DLLError struct, so that people
can test for this situation easily via:

    if errors.Is(err, windows.ERROR_PROC_NOT_FOUND) { ... }

DLLError already was wrapping the underlying Errno error, but never got
the Go 1.13 helper method.

Update golang/go#42584

Change-Id: Ib916ddd55a2de29f988edaaf82f2ae0ce1b18e3b
Trust: Jason A. Donenfeld <>
Run-TryBot: Jason A. Donenfeld <>
TryBot-Result: Go Bot <>
Reviewed-by: Brad Fitzpatrick <>
diff --git a/windows/dll_windows.go b/windows/dll_windows.go
index 82076fb..9cd147b 100644
--- a/windows/dll_windows.go
+++ b/windows/dll_windows.go
@@ -32,6 +32,8 @@
 func (e *DLLError) Error() string { return e.Msg }
+func (e *DLLError) Unwrap() error { return e.Err }
 // A DLL implements access to a single DLL.
 type DLL struct {
 	Name   string