@@ -70,35 +70,41 @@ static int LoadDirectory(HashTable *directories, HKEY key, char *path, int path_
70
70
char * name = (char * )emalloc (max_name + 1 );
71
71
char * value = (char * )emalloc (max_value + 1 );
72
72
DWORD name_len , type , value_len ;
73
- zval data ;
74
73
75
74
for (i = 0 ; i < values ; i ++ ) {
76
75
name_len = max_name + 1 ;
77
76
value_len = max_value + 1 ;
77
+
78
+ memset (name , '\0' , max_name + 1 );
79
+ memset (value , '\0' , max_value + 1 );
80
+
78
81
if (RegEnumValue (key , i , name , & name_len , NULL , & type , value , & value_len ) == ERROR_SUCCESS ) {
79
82
if ((type == REG_SZ ) || (type == REG_EXPAND_SZ )) {
83
+ zval data ;
84
+
80
85
if (!ht ) {
81
86
ht = (HashTable * )malloc (sizeof (HashTable ));
82
87
if (!ht ) {
83
88
return ret ;
84
89
}
85
90
zend_hash_init (ht , 0 , NULL , ZVAL_INTERNAL_PTR_DTOR , 1 );
86
91
}
92
+ ZVAL_PSTRINGL (& data , value , value_len - 1 );
87
93
zend_hash_str_update (ht , name , name_len , & data );
88
94
}
89
95
}
90
96
}
91
97
if (ht ) {
92
98
if (parent_ht ) {
93
99
zend_string * index ;
94
- ulong num ;
100
+ zend_ulong num ;
95
101
zval * tmpdata ;
96
102
97
103
ZEND_HASH_FOREACH_KEY_VAL (parent_ht , num , index , tmpdata ) {
98
104
zend_hash_add (ht , index , tmpdata );
99
105
} ZEND_HASH_FOREACH_END ();
100
106
}
101
- zend_hash_str_update_mem (directories , path , path_len + 1 , & ht , sizeof (HashTable * ));
107
+ zend_hash_str_update_mem (directories , path , path_len , ht , sizeof (HashTable ));
102
108
ret = 1 ;
103
109
}
104
110
@@ -148,9 +154,9 @@ static int LoadDirectory(HashTable *directories, HKEY key, char *path, int path_
148
154
149
155
static void delete_internal_hashtable (zval * zv )
150
156
{
151
- void * data = Z_PTR_P (zv );
152
- zend_hash_destroy (* ( HashTable * * ) data );
153
- free (* ( HashTable * * ) data );
157
+ HashTable * ht = ( HashTable * ) Z_PTR_P (zv );
158
+ zend_hash_destroy (ht );
159
+ free (ht );
154
160
}
155
161
156
162
#define RegNotifyFlags (REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_ATTRIBUTES | REG_NOTIFY_CHANGE_LAST_SET)
@@ -159,7 +165,6 @@ void UpdateIniFromRegistry(char *path)
159
165
{
160
166
char * p , * orig_path ;
161
167
int path_len ;
162
- HashTable * pht ;
163
168
164
169
if (!path ) {
165
170
return ;
@@ -234,15 +239,16 @@ void UpdateIniFromRegistry(char *path)
234
239
path_len ++ ;
235
240
}
236
241
zend_str_tolower (path , path_len );
242
+
237
243
while (path_len >= 0 ) {
238
- pht = (HashTable * )zend_hash_str_find_ptr (PW32G (registry_directories ), path , path_len + 1 );
239
- if ( pht != NULL ) {
240
- HashTable * ht = pht ;
244
+ HashTable * ht = (HashTable * )zend_hash_str_find_ptr (PW32G (registry_directories ), path , path_len );
245
+
246
+ if ( ht != NULL ) {
241
247
zend_string * index ;
242
248
zval * data ;
243
249
244
250
ZEND_HASH_FOREACH_STR_KEY_VAL (ht , index , data ) {
245
- zend_alter_ini_entry (index , Z_STR_P (data ), PHP_INI_SYSTEM , PHP_INI_STAGE_ACTIVATE );
251
+ zend_alter_ini_entry (index , Z_STR_P (data ), PHP_INI_USER , PHP_INI_STAGE_ACTIVATE );
246
252
} ZEND_HASH_FOREACH_END ();
247
253
}
248
254
0 commit comments