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);



RegCloseKey RegOpenKey RegConnectRegistry RegOpenKeyEx
RegCreateKey RegQueryInfoKey RegCreateKeyEx RegQueryMultipleValues
RegDeleteKey RegQueryValue RegDeleteValue RegQueryValueEx
RegEnumKey RegReplaceKey RegEnumKeyEx RegRestoreKey
RegEnumValue RegSaveKey RegFlushKey RegSetKeySecurity
RegGetKeySecurity RegSetValue RegLoadKey RegSetValueEx
RegNotifyChangeKeyValue RegUnLoadKey

댓글 없음:

댓글 쓰기