CVS update: php31/os/nt

From: Date: Tue, 15 Sep 1998 21:58:17 +0000
Subject: CVS update: php31/os/nt
Groups: php.dev 
Request: Send a blank email to php-dev+get-1141@lists.php.net to get a copy of this message
Date: Tuesday September 15, 1998 @ 17:58 Author: shane Update of /repository/php31/os/nt In directory asf:/u2/tmp/cvs-serv8626/os/nt Modified Files: registry.c registry.h Log Message: created a somewhat dynamic config for extensions integrated custom build steps for bison and flex. mtparser.bat is not necessary now. Index: php31/os/nt/registry.c diff -c php31/os/nt/registry.c:1.7 php31/os/nt/registry.c:1.8 *** php31/os/nt/registry.c:1.7 Mon Sep 14 21:34:26 1998 --- php31/os/nt/registry.c Tue Sep 15 17:58:16 1998 *************** *** 9,14 **** --- 9,35 ---- void *reg_mutex; + #define PHP_REG_KEY "HKEY_LOCAL_MACHINE\\Software\\PHP\\" + extern HashTable configuration_hash; + + struct _reg_entry{ + BYTE *name; + BYTE *value; + struct _reg_entry *next; + }; + + struct _reg_cache{ + char *directory; + long updated; + char *include_path; + struct _reg_entry *vars; + struct _reg_cache *next; + }; + + + struct _reg_cache *_reg_head; /* ok for thread safe */ + + static struct { char * name; HKEY hkey; *************** *** 19,39 **** { "HKEY_USERS", HKEY_USERS } }; - function_entry php3_registry_functions[] = { - {"registry_open", php3_win32_reg_open, NULL}, - {"registry_read", php3_win32_reg_read, NULL}, - {"registry_read_key", php3_win32_reg_read_key, NULL}, - {"registry_read_value", php3_win32_reg_read_value, NULL}, - {"registry_rewind", php3_win32_reg_rewind, NULL}, - {"registry_close", php3_win32_reg_close, NULL}, - {NULL, NULL, NULL} - }; - - - php3_module_entry php3_win32_reg_module_entry = { - "Win32 Registry (Read Only)", php3_registry_functions, NULL, NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES - }; - int _php3_win32_reg_init(INLINE_TLS_VOID) { --- 40,45 ---- *************** *** 250,474 **** } - void php3_win32_reg_read(INTERNAL_FUNCTION_PARAMETERS) - { - pval *arg; - int arg_count = ARG_COUNT(ht); - DWORD dwType, dwBufSize, dwValue; - BYTE * pbuffer, dummybuf[1]; - char *p, *value_name; - TLS_VARS; - if(GLOBAL(php3_ini)->safe_mode){ - php3_error(E_WARNING, "Registry unavailable, safe mode in effect!"); - RETURN_FALSE; - } - - if (arg_count != 1 || getParameters(ht, arg_count, &arg) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(arg); - - value_name = arg->value.str.val; - - if (!strchr(value_name, '\\')) { - php3_error(E_WARNING, "invalid registry key name '%s'", value_name); - RETURN_FALSE; - } - - pbuffer=_php3_win32_reg_read(value_name,&dwType); - - switch (dwType) - { - case REG_DWORD: - dwValue = *((DWORD *) pbuffer); - efree(pbuffer); - RETURN_LONG(dwValue); - case REG_SZ: - RETURN_STRING(pbuffer, 0); - case REG_EXPAND_SZ: - /* First determine necessary size of buffer */ - dwBufSize = ExpandEnvironmentStrings(pbuffer, dummybuf, 1); - if (dwBufSize < 1) - dwBufSize = 1; - p = emalloc(dwBufSize); - /* Now expand environment strings */ - if (!ExpandEnvironmentStrings(pbuffer, p, dwBufSize)) { - php3_error(E_WARNING, "Failed to expand environment strings, Windows error %d", (int) GetLastError()); - RETURN_FALSE; - } - efree(pbuffer); - RETURN_STRING(p, 0); - case REG_BINARY: - RETURN_STRINGL(pbuffer, dwBufSize, 0); - default: - php3_error(E_WARNING, "Registry value type %d not supported %d", dwType, REG_DWORD); - RETURN_FALSE; - } - } - - - void php3_win32_reg_open(INTERNAL_FUNCTION_PARAMETERS) - { - pval *arg; - int arg_count = ARG_COUNT(ht); - char *value_name; - RegKey *pRegKey; - int ret=0; - TLS_VARS; - - if(GLOBAL(php3_ini)->safe_mode){ - php3_error(E_WARNING, "Registry unavailable, safe mode in effect!"); - RETURN_FALSE; - } - - if (arg_count != 1 || getParameters(ht, arg_count, &arg) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(arg); - - value_name = arg->value.str.val; - - if (!strchr(value_name, '\\')) { - php3_error(E_WARNING, "invalid registry key name '%s'", value_name); - RETURN_FALSE; - } - - if(pRegKey=_php3_win32_reg_open(value_name _INLINE_TLS)) { - ret = php3_list_do_insert(list, (void *) pRegKey, GLOBAL(registry_le_hkey)); - } - RETURN_LONG(ret); - } - - - void php3_win32_reg_read_key(INTERNAL_FUNCTION_PARAMETERS) - { - pval *arg; - int arg_count = ARG_COUNT(ht), type; - BYTE *buffer; - RegKey *pRegKey; - TLS_VARS; - - if(GLOBAL(php3_ini)->safe_mode){ - php3_error(E_WARNING, "Registry unavailable, safe mode in effect!"); - RETURN_FALSE; - } - - if (arg_count != 1 || getParameters(ht, arg_count, &arg) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg); - - pRegKey = php3_list_do_find(list, arg->value.lval, &type); - if (type != GLOBAL(registry_le_hkey)) { - php3_error(E_WARNING,"resource index %d has the wrong type", arg->value.lval); - } - - buffer=_php3_win32_reg_read_key(pRegKey _INLINE_TLS); - - RETURN_STRING(buffer, 1); - } - - - - void php3_win32_reg_read_value(INTERNAL_FUNCTION_PARAMETERS) - { - pval *arg; - int arg_count = ARG_COUNT(ht), type; - BYTE *buffer, *data; - RegKey *pRegKey; - DWORD dwType, dwbSize, dwSize; - TLS_VARS; - - if(GLOBAL(php3_ini)->safe_mode){ - php3_error(E_WARNING, "Registry unavailable, safe mode in effect!"); - RETURN_FALSE; - } - - if (arg_count != 1 || getParameters(ht, arg_count, &arg) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg); - - pRegKey = php3_list_do_find((list), arg->value.lval, &type); - if (type != GLOBAL(registry_le_hkey)) { - php3_error(E_WARNING, "resource index %d has the wrong type", arg->value.lval); - } - - dwbSize=(pRegKey->dwcMaxValueName+1); - buffer=emalloc(dwbSize); - dwSize=(pRegKey->dwcMaxValueData+1); - data=emalloc(dwSize); - - _php3_win32_reg_read_value(pRegKey, buffer, &dwbSize, &dwType, data, &dwSize _INLINE_TLS); - - RETURN_STRING(buffer, 1); - /*FIXME how do we return data?*/ - } - - - void php3_win32_reg_rewind(INTERNAL_FUNCTION_PARAMETERS) - { - pval *id; - int arg_count = ARG_COUNT(ht), type; - RegKey *pRegKey; - TLS_VARS; - - if(GLOBAL(php3_ini)->safe_mode){ - php3_error(E_WARNING, "Registry unavailable, safe mode in effect!"); - RETURN_FALSE; - } - - if (arg_count != 1 || getParameters(ht, arg_count, &id) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(id); - - pRegKey = php3_list_do_find((list), id->value.lval, &type); - if (type != GLOBAL(registry_le_hkey)) { - php3_error(E_WARNING,"resource index %d has the wrong type", id->value.lval); - RETURN_FALSE; - } - - _php3_win32_reg_rewind(pRegKey _INLINE_TLS); - RETURN_TRUE; - } - - - void php3_win32_reg_close(INTERNAL_FUNCTION_PARAMETERS) - { - pval *id; - int arg_count = ARG_COUNT(ht), type; - RegKey *pRegKey; - TLS_VARS; - - if(GLOBAL(php3_ini)->safe_mode){ - php3_error(E_WARNING, "Registry unavailable, safe mode in effect!"); - RETURN_FALSE; - } - - if (arg_count != 1 || getParameters(ht, arg_count, &id) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(id); - - pRegKey = php3_list_do_find((list), id->value.lval, &type); - if (type != GLOBAL(registry_le_hkey)) { - php3_error(E_WARNING,"resource index %d has the wrong type", id->value.lval); - RETURN_FALSE; - } - php3_list_do_delete((list),id->value.lval); - - - if (_php3_win32_reg_close(pRegKey _INLINE_TLS) == FAILURE) { - php3_error(E_WARNING, "Failed to close registry handle!"); - RETURN_FALSE; - } - RETURN_TRUE - } - /*******************************************************************\ * Registry per-server and per-directory configuration functions * \*******************************************************************/ --- 256,261 ---- *************** *** 478,485 **** HKEY_LOCAL_MACHINE\Software\PHP\default and creates the hash normaly created in the configuration parser. */ - #define PHP_REG_KEY "HKEY_LOCAL_MACHINE\\Software\\PHP\\" - extern HashTable configuration_hash; int _reg_get_default_config(INLINE_TLS_VOID){ TCHAR regkey[1024]; --- 265,270 ---- *************** *** 606,627 **** * The following functions handle per server direcive * cacheing \*******************************************************/ - struct _reg_entry{ - BYTE *name; - BYTE *value; - struct _reg_entry *next; - }; - - struct _reg_cache{ - char *directory; - long updated; - char *include_path; - struct _reg_entry *vars; - struct _reg_cache *next; - }; - - struct _reg_cache *_reg_head; - int _reg_cache_dir_config(struct _reg_cache *regentry){ RegKey *pRegKey; --- 391,396 ---- Index: php31/os/nt/registry.h diff -c php31/os/nt/registry.h:1.4 php31/os/nt/registry.h:1.5 *** php31/os/nt/registry.h:1.4 Thu Sep 3 03:11:21 1998 --- php31/os/nt/registry.h Tue Sep 15 17:58:17 1998 *************** *** 5,13 **** #define WIN32_REG_BUFSIZE 1024 - extern php3_module_entry php3_win32_reg_module_entry; - #define php3_win32_reg_module_ptr &php3_win32_reg_module_entry - typedef struct { HKEY hkey; DWORD iSubKey; --- 5,10 ---- *************** *** 49,66 **** extern void _reg_get_server_config(char *server_name INLINE_TLS); extern void _reg_get_directory_config(INLINE_TLS_VOID); extern void _reg_free_server_config(INLINE_TLS_VOID); - - /* Win32 functions */ - extern void php3_win32_reg_read(INTERNAL_FUNCTION_PARAMETERS); - extern void php3_win32_reg_read_key(INTERNAL_FUNCTION_PARAMETERS); - extern void php3_win32_reg_read_value(INTERNAL_FUNCTION_PARAMETERS); - extern void php3_win32_reg_open(INTERNAL_FUNCTION_PARAMETERS); - extern void php3_win32_reg_close(INTERNAL_FUNCTION_PARAMETERS); - extern void php3_win32_reg_rewind(INTERNAL_FUNCTION_PARAMETERS); - - #else /* WIN32|WINNT */ - - #define php3_win32_reg_module_ptr NULL #endif /* WIN32|WINNT */ --- 46,51 ---- -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#1141) next »