I am tying to write a simple NT Application that will write a particular field in registry.
#include <windows.h>
#include <ntstatus.h>
#include "ntdll.h"
void NTAPI NtProcessStartup(PPEB Peb)
{
long nResult = 0;
wchar_t* commands = (wchar_t*)L"MyKey"Entry;
NTSTATUS status;
status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
L"TestCreated", L"MyKey", REG_MULTI_SZ,
commands, 5 * sizeof(wchar_t));
NtTerminateProcess(NtCurrentProcess(), nResult);
}
when I am compiling with “ntdll.h” RtlWriteRegistryValue is undefined error is coming.
When I am adding ntndk.h which contains definition for RtlWriteRegistryValue, it shows multiple redeclaration for may macros and functions with windows.h and ntdll.h
Since I am new to Native applications I couldn’t find any solution yet. What is actual issue.