In reply to @jviega "On my phone but": I made triple sure, recompiled with additional debug output in places where the code arrives and the result (NTSTATUS) is. There was indeed a mistake. However not the one you expected nor did a fix change the Nim outcome. In the Nim code i posted i used winim widestring. Which probably called CreateFileW. It worked somehow but status was bad parameter. After changing that the debug now results in a 0, so everything works. However, all of this still crashes with SIGSEV in debug versions