Bring back registry stub :(

This commit is contained in:
Andrew Schwartzmeyer
2015-12-16 12:59:07 -08:00
parent 7d0b89733e
commit 5111cf77d0
3 changed files with 28 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
api-ms-win-core-registry-l1-1-0.dll: api-ms-win-core-registry-l1-1-0.c
gcc -o $@ -fPIC -shared -Wall $^
+20
View File
@@ -0,0 +1,20 @@
This stubs the `RegCloseKey` function provided on Windows by
`api-ms-win-core-registry-l1-1-0.dll`.
Without this DLL in the library path, the following exception is
thrown upon shutdown of PowerShell. While I do not like hiding this
error, it is neccesary for the rest of PowerShell to shutdown
properly, and release its file descriptors. Otherwise the shell will
mess up Bash, and it needs to be reset.
This must be removed as soon as it can be addressed in a better way.
```
Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'api-ms-win-core-registry-l1-1-0.dll': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
at Interop.mincore.RegCloseKey(IntPtr hKey)
at Microsoft.Win32.SafeHandles.SafeRegistryHandle.ReleaseHandle()
at System.Runtime.InteropServices.SafeHandle.InternalFinalize()
at System.Runtime.InteropServices.SafeHandle.Dispose(Boolean disposing)
at System.Runtime.InteropServices.SafeHandle.Finalize()
```
@@ -0,0 +1,6 @@
#include <stdint.h>
int32_t RegCloseKey(void* handle)
{
return 0;
}