Add SetLastError to DllImport statements.

Implementations for issue #43.