Win API 를 이용한 레지스트리 등록(Add Registry / WINAPI)

Win API 를 이용한 레지스트리 등록

Add Registry(Startup Program / HKEY_LOCAL_MACHINE) LONG lResult; char buffer[100]; HKEY hKey; DWORD dwDesc; char *path = “c:\winnt\system32\notepad.exe”;

RegOpenKeyEx(HKEY_LOCAL_MACHINE, “SOFTWARE\Microsoft\Windows\CurrentVersion\Run”, 0, KEY_ALL_ACCESS, &hKey);

lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, “SOFTWARE\Microsoft\Windows\CurrentVersion\Run”, 0, buffer, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,&hKey, &dwDesc); if(lResult == ERROR_SUCCESS) { RegSetValueEx(hKey, “abc”, 0, REG_SZ, (BYTE*)path, strlen(path)); } RegCloseKey(hKey);

RegCloseKeyRegOpenKeyRegConnectRegistryRegOpenKeyEx RegCreateKeyRegQueryInfoKeyRegCreateKeyExRegQueryMultipleValues RegDeleteKeyRegQueryValueRegDeleteValueRegQueryValueEx RegEnumKeyRegReplaceKeyRegEnumKeyExRegRestoreKey RegEnumValueRegSaveKeyRegFlushKeyRegSetKeySecurity RegGetKeySecurityRegSetValueRegLoadKeyRegSetValueEx RegNotifyChangeKeyValueRegUnLoadKey

Licensed under CC BY-NC-SA 4.0
Last updated on Jul 10, 2021 01:05 +0900