X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;ds=sidebyside;f=src%2Fwin32%2Fread-registry.c;h=0949aa48c1ca6c04c3e3c99bc37e5392e8c79069;hb=3f728675941dc69d4e544d3a880a56240a6e394a;hp=f4763407d48b82312b547c01f75dac9b733e2511;hpb=927951d1c1ad45ba9e7325f07d996154a91c911b;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 f476340..0949aa4 --- a/src/win32/read-registry.c +++ b/src/win32/read-registry.c @@ -3,14 +3,15 @@ #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) { @@ -18,8 +19,8 @@ void os_winreg_querykey(HKEY hKey, char *p_key) 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,81 +31,67 @@ 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