X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=src%2Fwin32%2Fread-registry.c;h=0949aa48c1ca6c04c3e3c99bc37e5392e8c79069;hb=3f728675941dc69d4e544d3a880a56240a6e394a;hp=b5f4d680a6e1165150d621317b324ee2fdd8d3e5;hpb=914feba5d54f979cd5d7e69c349c3d01f630042a;p=ossec-hids.git diff --git a/src/win32/read-registry.c b/src/win32/read-registry.c old mode 100755 new mode 100644 index b5f4d68..0949aa4 --- a/src/win32/read-registry.c +++ b/src/win32/read-registry.c @@ -3,23 +3,24 @@ #include "os_crypto/sha1/sha1_op.h" /* Default values */ -#define MAX_KEY_LENGTH 255 -#define MAX_KEY 2048 +#define MAX_KEY_LENGTH 255 +#define MAX_KEY 2048 #define MAX_VALUE_NAME 16383 - -char *(os_winreg_ignore_list[]) = {"SOFTWARE\\Classes","test123",NULL}; + +char *(os_winreg_ignore_list[]) = {"SOFTWARE\\Classes", "test123", NULL}; HKEY sub_tree; -int os_winreg_open_key(char *subkey); +void os_winreg_open_key(char *subkey); + -void os_winreg_querykey(HKEY hKey, char *p_key) +void os_winreg_querykey(HKEY hKey, char *p_key) { int i, rc; DWORD j; /* QueryInfo and EnumKey variables */ - TCHAR sub_key_name_b[MAX_KEY_LENGTH +1]; - TCHAR class_name_b[MAX_PATH +1]; + TCHAR sub_key_name_b[MAX_KEY_LENGTH + 1]; + TCHAR class_name_b[MAX_PATH + 1]; DWORD sub_key_name_s; DWORD class_name_s = MAX_PATH; @@ -30,174 +31,152 @@ void os_winreg_querykey(HKEY hKey, char *p_key) DWORD value_count; /* Variables for RegEnumValue */ - TCHAR value_buffer[MAX_VALUE_NAME +1]; - TCHAR data_buffer[MAX_VALUE_NAME +1]; + TCHAR value_buffer[MAX_VALUE_NAME + 1]; + TCHAR data_buffer[MAX_VALUE_NAME + 1]; DWORD value_size; DWORD data_size; /* Data type for RegEnumValue */ DWORD data_type = 0; - - /* Initializing the memory for some variables */ + /* Initialize the memory for some variables */ class_name_b[0] = '\0'; class_name_b[MAX_PATH] = '\0'; sub_key_name_b[0] = '\0'; sub_key_name_b[MAX_KEY_LENGTH] = '\0'; - - /* We use the class_name, subkey_count and the value count. */ + /* We only use the class_name, subkey_count and value count */ rc = RegQueryInfoKey(hKey, class_name_b, &class_name_s, NULL, - &subkey_count, NULL, NULL, &value_count, - NULL, NULL, NULL, NULL); + &subkey_count, NULL, NULL, &value_count, + NULL, NULL, NULL, NULL); /* Check return code of QueryInfo */ - if(rc != ERROR_SUCCESS) - { + if (rc != ERROR_SUCCESS) { return; } - - - /* Checking if we have sub keys */ - if(subkey_count) - { - /* We open each subkey and call open_key */ - for(i=0;i