How to import ZwDeleteKey in C#
See the question and my original answer on StackOverflowOfficial documentation for ZwDeleteKey does mention "NtosKrnl.exe" being the "DLL", but this is wrong, the import definition should be like this instead (plus there's no string involved, the entry point is not ambiguous and the function doesn't set last error):
[DllImport("ntdll")]
private static extern int ZwDeleteKey(SafeRegistryHandle hKey);