Exemplo n.º 1
0
/*
 * Add this source with appropriate configuration keys to the registry.
 */
void addRegistryInfo(wchar_t *source) {
  const wchar_t *prefix = L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\";
  DWORD disposition;
  HKEY hkey = 0;
  wchar_t subkey[256];
  
  wcscpy(subkey, prefix);
  wcscat(subkey, source);
  hkey = regGetKey(subkey, &disposition);
  if (disposition == REG_CREATED_NEW_KEY) {
    HMODULE hmodule = gModule;
    if (hmodule == NULL) {
        hmodule = GetModuleHandleW(L"NTEventLogAppender.dll");
    }
    if (hmodule != NULL) {
        wchar_t modpath[_MAX_PATH];
        DWORD modlen = GetModuleFileNameW(hmodule, modpath, _MAX_PATH - 1);
        if (modlen > 0) {
            modpath[modlen] = 0;
            regSetString(hkey, L"EventMessageFile", modpath);
            regSetString(hkey, L"CategoryMessageFile", modpath);
        }
    }
    regSetDword(hkey, L"TypesSupported", (DWORD)7);
    regSetDword(hkey, L"CategoryCount", (DWORD) 6);
  }
  RegCloseKey(hkey);
  return;
}
Exemplo n.º 2
0
    /*
     * Add this source with appropriate configuration keys to the registry.
     */
    void NTEventLogAppender::addRegistryInfo(const char *source) {
        const TCHAR *prefix = "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\";
        DWORD disposition;
        HKEY hkey = 0;
        TCHAR subkey[256];

        lstrcpy(subkey, prefix);
        lstrcat(subkey, source);
        hkey = regGetKey(subkey, &disposition);
        if (disposition == REG_CREATED_NEW_KEY) {
            regSetString(hkey, "EventMessageFile", "NTEventLogAppender.dll");
            regSetString(hkey, "CategoryMessageFile", "NTEventLogAppender.dll");
            regSetDword(hkey, "TypesSupported", (DWORD)7);
            regSetDword(hkey, "CategoryCount", (DWORD)8);
        }
        RegCloseKey(hkey);
        return;
    }
Exemplo n.º 3
0
/*
 * Add this source with appropriate configuration keys to the registry.
 */
void addRegistryInfo(char *source) {
  const TCHAR *prefix = "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\";
  DWORD disposition;
  HKEY hkey = 0;
  TCHAR subkey[256];
  
  lstrcpy(subkey, prefix);
  lstrcat(subkey, source);
  hkey = regGetKey(subkey, &disposition);
  if (disposition == REG_CREATED_NEW_KEY) {
    regSetString(hkey, "EventMessageFile", "NTEventLogAppender.dll");
    regSetString(hkey, "CategoryMessageFile", "NTEventLogAppender.dll");
    regSetDword(hkey, "TypesSupported", (DWORD)7);
    regSetDword(hkey, "CategoryCount", (DWORD)8);
  }
	//RegSetValueEx(hkey, "EventMessageFile", 0, REG_SZ, (LPBYTE)dllname, lstrlen(dllname));
	//RegSetValueEx(hkey, "CategoryMessageFile", 0, REG_SZ, (LPBYTE)dllname, lstrlen(dllname));
	//RegSetValueEx(hkey, "TypesSupported", 0, REG_DWORD, (LPBYTE)&whichTypes, sizeof(DWORD));
	//RegSetValueEx(hkey, "CategoryCount", 0, REG_DWORD, (LPBYTE)&numCategories, sizeof(DWORD));
  RegCloseKey(hkey);
  return;
}