> For the complete documentation index, see [llms.txt](https://malwaresourcecode.com/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://malwaresourcecode.com/home/error-handling/rtlntstatustodoserrorviaimport.md).

# RtlNtStatusToDosErrorViaImport

```
typedef ULONG(NTAPI* RTLNTSTATUSTODOSERROR)(NTSTATUS);

DWORD RtlNtStatusToDosErrorViaImport(_In_ NTSTATUS Status)
{
	RTLNTSTATUSTODOSERROR RtlNtStatusToDosError;
	HMODULE hModule = NULL;
	DWORD dwError = ERROR_SUCCESS;

	hModule = GetModuleHandleW(L"ntdll.dll");
	if (hModule == NULL)
		return -1;

	RtlNtStatusToDosError = (RTLNTSTATUSTODOSERROR)GetProcAddress(hModule, "RtlNtStatusToDosError");
	if (!RtlNtStatusToDosError)
		return -1;

	dwError = RtlNtStatusToDosError(Status);

	RtlNtStatusToDosError = NULL;

	return dwError;
}
```
