From 7b7fefcad182fadbb47cf52533247ae97685dc4c Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Tue, 26 Sep 2023 19:35:12 +0200 Subject: [PATCH] create registry key if it doesn't exist --- src/dllmain.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/dllmain.c b/src/dllmain.c index 945ee6b..42e4f46 100644 --- a/src/dllmain.c +++ b/src/dllmain.c @@ -75,8 +75,16 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved) HKEY hkey; LONG status = - RegOpenKeyExA( - HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32", 0L, KEY_WRITE, &hkey); + RegCreateKeyExA( + HKEY_CURRENT_USER, + "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_WRITE | KEY_QUERY_VALUE, + NULL, + &hkey, + NULL); if (status == ERROR_SUCCESS) {