diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
| commit | d29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (patch) | |
| tree | b38e2e5c6974b9a15f103e5cf884cba9fff90ef4 /win32 | |
| parent | a88a88d0986a4a32288c102cdbfebd78d7e91d99 (diff) | |
| download | php-upstream/5.2.0.tar.gz | |
Imported Upstream version 5.2.0upstream/5.2.0
Diffstat (limited to 'win32')
| -rw-r--r-- | win32/build/config.w32 | 8 | ||||
| -rw-r--r-- | win32/build/confutils.js | 16 | ||||
| -rw-r--r-- | win32/crypt_win32.c | 833 | ||||
| -rw-r--r-- | win32/crypt_win32.h | 35 | ||||
| -rw-r--r-- | win32/install.txt | 52 | ||||
| -rw-r--r-- | win32/installer/README | 93 | ||||
| -rw-r--r-- | win32/installer/gen-nsis.php | 446 | ||||
| -rw-r--r-- | win32/installer/setini.php | 87 | ||||
| -rw-r--r-- | win32/php5dllts.dsp | 530 | ||||
| -rw-r--r-- | win32/php5ts.dsp | 4 | ||||
| -rw-r--r-- | win32/registry.c | 59 |
11 files changed, 927 insertions, 1236 deletions
diff --git a/win32/build/config.w32 b/win32/build/config.w32 index bc865cbce..db6ef8fbe 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -1,5 +1,5 @@ // vim:ft=javascript -// $Id: config.w32,v 1.40.2.8 2006/04/29 14:33:46 fmk Exp $ +// $Id: config.w32,v 1.40.2.8.2.1 2006/07/18 09:06:33 dmitry Exp $ // "Master" config file; think of it as a configure.in // equivalent. @@ -293,8 +293,10 @@ ADD_FLAG("CFLAGS", "/D FD_SETSIZE=" + parseInt(PHP_FD_SETSIZE)); ARG_ENABLE("memory-limit", "Enable memory limit checking code", "no"); AC_DEFINE('MEMORY_LIMIT', PHP_MEMORY_LIMIT == "yes" ? 1 : 0); -ARG_ENABLE("memory-manager", "Enable Zend memory manager", "yes"); -AC_DEFINE('USE_ZEND_ALLOC', PHP_MEMORY_MANAGER == "yes" ? 1 : 0); +ARG_ENABLE("malloc-mm", "Use environment variable for run-time malloc/emalloc selection", ""); +if (PHP_MALLOC_MM.length) { + AC_DEFINE('ZEND_USE_MALLOC_MM', PHP_MALLOC_MM == "yes" ? 1 : 0); +} ARG_ENABLE("zend-multibyte", "Enable Zend multibyte encoding support", "no"); if (PHP_ZEND_MULTIBYTE == "yes") { diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 762c049bb..c01a0ae97 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -// $Id: confutils.js,v 1.60.2.1 2006/01/01 12:50:20 sniper Exp $ +// $Id: confutils.js,v 1.60.2.1.2.1 2006/05/07 00:04:56 edink Exp $ var STDOUT = WScript.StdOut; var STDERR = WScript.StdErr; @@ -871,14 +871,20 @@ function generate_version_info_resource(makefiletarget, creditspath) return resname; } -function SAPI(sapiname, file_list, makefiletarget, cflags) +function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir) { var SAPI = sapiname.toUpperCase(); var ldflags; var resname; var ld = "@$(LD)"; - STDOUT.WriteLine("Enabling SAPI " + configure_module_dirname); + if (typeof(obj_dir) == "undefined") { + sapiname_for_printing = configure_module_dirname; + } else { + sapiname_for_printing = configure_module_dirname + " (via " + obj_dir + ")"; + } + + STDOUT.WriteLine("Enabling SAPI " + sapiname_for_printing); MFO.WriteBlankLines(1); MFO.WriteLine("# objects for SAPI " + sapiname); @@ -888,7 +894,7 @@ function SAPI(sapiname, file_list, makefiletarget, cflags) ADD_FLAG('CFLAGS_' + SAPI, cflags); } - ADD_SOURCES(configure_module_dirname, file_list, sapiname); + ADD_SOURCES(configure_module_dirname, file_list, sapiname, obj_dir); MFO.WriteBlankLines(1); MFO.WriteLine("# SAPI " + sapiname); MFO.WriteBlankLines(1); @@ -897,7 +903,7 @@ function SAPI(sapiname, file_list, makefiletarget, cflags) resname = generate_version_info_resource(makefiletarget, configure_module_dirname); MFO.WriteLine(makefiletarget + ": $(BUILD_DIR)\\" + makefiletarget); - MFO.WriteLine("\t@echo SAPI " + configure_module_dirname + " build complete"); + MFO.WriteLine("\t@echo SAPI " + sapiname_for_printing + " build complete"); MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname); if (makefiletarget.match(new RegExp("\\.dll$"))) { diff --git a/win32/crypt_win32.c b/win32/crypt_win32.c index 047acb322..1e5d2e422 100644 --- a/win32/crypt_win32.c +++ b/win32/crypt_win32.c @@ -1,350 +1,557 @@ /* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2006 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: | - +----------------------------------------------------------------------+ + * UFC-crypt: ultra fast crypt(3) implementation + * + * Copyright (C) 1991, Michael Glad, email: glad@daimi.aau.dk + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * @(#)crypt.c 2.2 10/04/91 + * + * Semiportable C version + * */ -/* $Id: crypt_win32.c,v 1.8.2.1 2006/01/01 12:50:19 sniper Exp $ */ - -/* This code is distributed under the PHP license with permission from - the author Jochen Obalek <jochen.obalek@bigfoot.de> */ - -/* encrypt.c - providing 56 bit DES encryption - Copyright (C) 1991 Jochen Obalek +#include <string.h> - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. +#define bzero(addr, cnt) memset(addr, 0, cnt) +#define bcopy(from, to, len) memcpy(to, from, len) + +/* Permutation done once on the 56 bit + key derived from the original 8 byte ASCII key. +*/ +static unsigned long pc1[56] = + { 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, + 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, + 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, + 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 + }; + +/* How much to rotate each 28 bit half of the pc1 permutated + 56 bit key before using pc2 to give the i' key +*/ +static unsigned long totrot[16] = + { 1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28 }; + +/* Permutation giving the key of the i' DES round */ +static unsigned long pc2[48] = + { 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, + 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, + 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, + 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32 + }; + +/* Reference copy of the expansion table which selects + bits from the 32 bit intermediate result. +*/ +static unsigned long eref[48] = + { 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, + 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, + 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25, + 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1 + }; +static unsigned long disturbed_e[48]; +static unsigned long e_inverse[64]; + +/* Permutation done on the result of sbox lookups */ +static unsigned long perm32[32] = + { 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, + 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25 + }; + +/* The sboxes */ +static unsigned long sbox[8][4][16]= + { { { 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7 }, + { 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8 }, + { 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0 }, + { 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13 } + }, + + { { 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10 }, + { 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5 }, + { 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15 }, + { 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9 } + }, + + { { 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8 }, + { 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1 }, + { 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7 }, + { 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12 } + }, + + { { 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15 }, + { 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9 }, + { 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4 }, + { 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14 } + }, + + { { 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9 }, + { 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6 }, + { 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14 }, + { 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3 } + }, + + { { 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11 }, + { 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8 }, + { 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6 }, + { 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13 } + }, + + { { 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1 }, + { 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6 }, + { 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2 }, + { 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12 } + }, + + { { 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7 }, + { 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2 }, + { 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8 }, + { 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 } + } + }; + +#ifdef notdef + +/* This is the initial permutation matrix -- we have no + use for it, but it is needed if you will develop + this module into a general DES package. +*/ +static unsigned char inital_perm[64] = + { 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, + 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, + 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, + 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7 + }; + +#endif + +/* Final permutation matrix -- not used directly */ +static unsigned char final_perm[64] = + { 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31, + 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29, + 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27, + 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25 + }; + +/* The 16 DES keys in BITMASK format */ +unsigned long keytab[16][2]; + +#define ascii_to_bin(c) ((c)>='a'?(c-59):(c)>='A'?((c)-53):(c)-'.') +#define bin_to_ascii(c) ((c)>=38?((c)-38+'a'):(c)>=12?((c)-12+'A'):(c)+'.') + +/* Macro to set a bit (0..23) */ +#define BITMASK(i) ( (1<<(11-(i)%12+3)) << ((i)<12?16:0) ) + +/* sb arrays: + + Workhorses of the inner loop of the DES implementation. + They do sbox lookup, shifting of this value, 32 bit + permutation and E permutation for the next round. + + Kept in 'BITMASK' format. + +*/ + +unsigned long sb0[8192],sb1[8192],sb2[8192],sb3[8192]; +static unsigned long *sb[4] = {sb0,sb1,sb2,sb3}; + +/* eperm32tab: do 32 bit permutation and E selection + + The first index is the byte number in the 32 bit value to be permuted + - second - is the value of this byte + - third - selects the two 32 bit values + + The table is used and generated internally in init_des to speed it up + +*/ +static unsigned long eperm32tab[4][256][2]; - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +/* mk_keytab_table: fast way of generating keytab from ASCII key + + The first index is the byte number in the 8 byte ASCII key + - second - - - current DES round i.e. the key number + - third - distinguishes between the two 24 bit halfs of + the selected key + - fourth - selects the 7 bits actually used of each byte + + The table is kept in the format generated by the BITMASK macro + +*/ +static unsigned long mk_keytab_table[8][16][2][128]; + + +/* efp: undo an extra e selection and do final + permutation giving the DES result. + + Invoked 6 bit a time on two 48 bit values + giving two 32 bit longs. +*/ +static unsigned long efp[16][64][2]; + + +static unsigned char bytemask[8] = + { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; + + +static unsigned long longmask[32] = + { 0x80000000, 0x40000000, 0x20000000, 0x10000000, + 0x08000000, 0x04000000, 0x02000000, 0x01000000, + 0x00800000, 0x00400000, 0x00200000, 0x00100000, + 0x00080000, 0x00040000, 0x00020000, 0x00010000, + 0x00008000, 0x00004000, 0x00002000, 0x00001000, + 0x00000800, 0x00000400, 0x00000200, 0x00000100, + 0x00000080, 0x00000040, 0x00000020, 0x00000010, + 0x00000008, 0x00000004, 0x00000002, 0x00000001 + }; + +static unsigned long initialized = 0; + +/* lookup a 6 bit value in sbox */ + +#define s_lookup(i,s) sbox[(i)][(((s)>>4) & 0x2)|((s) & 0x1)][((s)>>1) & 0xf]; + +/* Generate the mk_keytab_table once in a program execution */ + +void init_des() + { unsigned long tbl_long,bit_within_long,comes_from_bit; + unsigned long bit,sg,j; + unsigned long bit_within_byte,key_byte,byte_value; + unsigned long round,mask; + + bzero((char*)mk_keytab_table,sizeof mk_keytab_table); + + for(round=0; round<16; round++) + for(bit=0; bit<48; bit++) + { tbl_long = bit / 24; + bit_within_long = bit % 24; + + /* from which bit in the key halves does it origin? */ + comes_from_bit = pc2[bit] - 1; + + /* undo the rotation done before pc2 */ + if(comes_from_bit>=28) + comes_from_bit = 28 + (comes_from_bit + totrot[round]) % 28; + else + comes_from_bit = (comes_from_bit + totrot[round]) % 28; + + /* undo the initial key half forming permutation */ + comes_from_bit = pc1[comes_from_bit] - 1; + + /* Now 'comes_from_bit' is the correct number (0..55) + of the keybit from which the bit being traced + in key 'round' comes from + */ + + key_byte = comes_from_bit / 8; + bit_within_byte = (comes_from_bit % 8)+1; + + mask = bytemask[bit_within_byte]; + + for(byte_value=0; byte_value<128; byte_value++) + if(byte_value & mask) + mk_keytab_table[key_byte][round][tbl_long][byte_value] |= + BITMASK(bit_within_long); + } + + /* Now generate the table used to do an combined + 32 bit permutation and e expansion + + We use it because we have to permute 16384 32 bit + longs into 48 bit in order to initialize sb. + + Looping 48 rounds per permutation becomes + just too slow... + + */ + + bzero((char*)eperm32tab,sizeof eperm32tab); + for(bit=0; bit<48; bit++) + { unsigned long mask1,comes_from; + + comes_from = perm32[eref[bit]-1]-1; + mask1 = bytemask[comes_from % 8]; + + for(j=256; j--;) + if(j & mask1) + eperm32tab[comes_from/8][j][bit/24] |= BITMASK(bit % 24); + } + + /* Create the sb tables: + + For each 12 bit segment of an 48 bit intermediate + result, the sb table precomputes the two 4 bit + values of the sbox lookups done with the two 6 + bit halves, shifts them to their proper place, + sends them through perm32 and finally E expands + them so that they are ready for the next + DES round. + + The value looked up is to be xored onto the + two 48 bit right halves. + */ + + for(sg=0; sg<4; sg++) + { unsigned long j1,j2; + unsigned long s1,s2; + + for(j1=0; j1<64; j1++) + { s1 = s_lookup(2*sg,j1); + for(j2=0; j2<64; j2++) + { unsigned long to_permute,inx; + + s2 = s_lookup(2*sg+1,j2); + to_permute = ((s1<<4) | s2) << (24-8*sg); + inx = ((j1<<6) | j2) << 1; + + sb[sg][inx ] = eperm32tab[0][(to_permute >> 24) & 0xff][0]; + sb[sg][inx+1] = eperm32tab[0][(to_permute >> 24) & 0xff][1]; + + sb[sg][inx ] |= eperm32tab[1][(to_permute >> 16) & 0xff][0]; + sb[sg][inx+1] |= eperm32tab[1][(to_permute >> 16) & 0xff][1]; + + sb[sg][inx ] |= eperm32tab[2][(to_permute >> 8) & 0xff][0]; + sb[sg][inx+1] |= eperm32tab[2][(to_permute >> 8) & 0xff][1]; + + sb[sg][inx ] |= eperm32tab[3][(to_permute) & 0xff][0]; + sb[sg][inx+1] |= eperm32tab[3][(to_permute) & 0xff][1]; + } + } + } + initialized++; + } - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* Process the elements of the sb table permuting the + bits swapped in the expansion by the current salt. +*/ + +void shuffle_sb(k, saltbits) + unsigned long *k, saltbits; + { int j, x; + for(j=4096; j--;) { + x = (k[0] ^ k[1]) & saltbits; + *k++ ^= x; + *k++ ^= x; + } + } -#include <time.h> -#include <string.h> -#include <stdlib.h> -#include "md5crypt.h" +/* Setup the unit for a new salt + Hopefully we'll not see a new salt in each crypt call. +*/ + +static unsigned char current_salt[3]="&&"; /* invalid value */ +static unsigned long oldsaltbits = 0; + +void setup_salt(s) + char *s; + { unsigned long i,j,saltbits; + + if(!initialized) + init_des(); + + if(s[0]==current_salt[0] && s[1]==current_salt[1]) + return; + current_salt[0]=s[0]; current_salt[1]=s[1]; + + /* This is the only crypt change to DES: + entries are swapped in the expansion table + according to the bits set in the salt. + */ + + saltbits=0; + bcopy((char*)eref,(char*)disturbed_e,sizeof eref); + for(i=0; i<2; i++) + { long c=ascii_to_bin(s[i]); + if(c<0 || c>63) + c=0; + for(j=0; j<6; j++) + if((c>>j) & 0x1) + { disturbed_e[6*i+j ]=eref[6*i+j+24]; + disturbed_e[6*i+j+24]=eref[6*i+j ]; + saltbits |= BITMASK(6*i+j); + } + } + + /* Permute the sb table values + to reflect the changed e + selection table + */ + + shuffle_sb(sb0, oldsaltbits ^ saltbits); + shuffle_sb(sb1, oldsaltbits ^ saltbits); + shuffle_sb(sb2, oldsaltbits ^ saltbits); + shuffle_sb(sb3, oldsaltbits ^ saltbits); + + oldsaltbits = saltbits; + + /* Create an inverse matrix for disturbed_e telling + where to plug out bits if undoing disturbed_e + */ + + for(i=48; i--;) + { e_inverse[disturbed_e[i]-1 ] = i; + e_inverse[disturbed_e[i]-1+32] = i+48; + } + + /* create efp: the matrix used to + undo the E expansion and effect final permutation + */ + + bzero((char*)efp,sizeof efp); + for(i=0; i<64; i++) + { unsigned long o_bit,o_long; + unsigned long word_value,mask1,mask2,comes_from_f_bit,comes_from_e_bit; + unsigned long comes_from_word,bit_within_word; + + /* See where bit i belongs in the two 32 bit long's */ + o_long = i / 32; /* 0..1 */ + o_bit = i % 32; /* 0..31 */ + + /* And find a bit in the e permutated value setting this bit. + + Note: the e selection may have selected the same bit several + times. By the initialization of e_inverse, we only look + for one specific instance. + */ + comes_from_f_bit = final_perm[i]-1; /* 0..63 */ + comes_from_e_bit = e_inverse[comes_from_f_bit]; /* 0..95 */ + comes_from_word = comes_from_e_bit / 6; /* 0..15 */ + bit_within_word = comes_from_e_bit % 6; /* 0..5 */ + + mask1 = longmask[bit_within_word+26]; + mask2 = longmask[o_bit]; + + for(word_value=64; word_value--;) + if(word_value & mask1) + efp[comes_from_word][word_value][o_long] |= mask2; + + } -#define BS 64 -#define BS2 32 -#define KS 48 -#define KS2 24 -#define IS 56 -#define IS2 28 + } -static char schluessel[16][KS]; +/* Generate the key table before running the 25 DES rounds */ + +void mk_keytab(key) + char *key; + { unsigned long i,j; + unsigned long *k,*mkt; + char t; + + bzero((char*)keytab, sizeof keytab); + mkt = &mk_keytab_table[0][0][0][0]; + + for(i=0; (t=(*key++) & 0x7f) && i<8; i++) + for(j=0,k = &keytab[0][0]; j<16; j++) + { *k++ |= mkt[t]; mkt += 128; + *k++ |= mkt[t]; mkt += 128; + } + for(; i<8; i++) + for(j=0,k = &keytab[0][0]; j<16; j++) + { *k++ |= mkt[0]; mkt += 128; + *k++ |= mkt[0]; mkt += 128; + } + } +/* Do final permutations and convert to ASCII */ -static char PC1[] = -{ - 56, 48, 40, 32, 24, 16, 8, 0, - 57, 49, 41, 33, 25, 17, 9, 1, - 58, 50, 42, 34, 26, 18, 10, 2, - 59, 51, 43, 35, - 62, 54, 46, 38, 30, 22, 14, 6, - 61, 53, 45, 37, 29, 21, 13, 5, - 60, 52, 44, 36, 28, 20, 12, 4, - 27, 19, 11, 3 -}; - - -static char PC2[] = -{ - 13, 16, 10, 23, 0, 4, 2, 27, - 14, 5, 20, 9, 22, 18, 11, 3, - 25, 7, 15, 6, 26, 19, 12, 1, - 40, 51, 30, 36, 46, 54, 29, 39, - 50, 44, 32, 47, 43, 48, 38, 55, - 33, 52, 45, 41, 49, 35, 28, 31 -}; +char *output_conversion(l1,l2,r1,r2,salt) + unsigned long l1,l2,r1,r2; + char *salt; + { static char outbuf[14]; + unsigned long i; + unsigned long s,v1,v2; + /* Unfortunately we've done an extra E + expansion -- undo it at the same time. + */ -static char IP[] = -{ - 57, 49, 41, 33, 25, 17, 9, 1, - 59, 51, 43, 35, 27, 19, 11, 3, - 61, 53, 45, 37, 29, 21, 13, 5, - 63, 55, 47, 39, 31, 23, 15, 7, - 56, 48, 40, 32, 24, 16, 8, 0, - 58, 50, 42, 34, 26, 18, 10, 2, - 60, 52, 44, 36, 28, 20, 12, 4, - 62, 54, 46, 38, 30, 22, 14, 6 -}; - - -static char EP[] = -{ - 7, 39, 15, 47, 23, 55, 31, 63, - 6, 38, 14, 46, 22, 54, 30, 62, - 5, 37, 13, 45, 21, 53, 29, 61, - 4, 36, 12, 44, 20, 52, 28, 60, - 3, 35, 11, 43, 19, 51, 27, 59, - 2, 34, 10, 42, 18, 50, 26, 58, - 1, 33, 9, 41, 17, 49, 25, 57, - 0, 32, 8, 40, 16, 48, 24, 56 -}; - - -static char E0[] = -{ - 31, 0, 1, 2, 3, 4, 3, 4, - 5, 6, 7, 8, 7, 8, 9, 10, - 11, 12, 11, 12, 13, 14, 15, 16, - 15, 16, 17, 18, 19, 20, 19, 20, - 21, 22, 23, 24, 23, 24, 25, 26, - 27, 28, 27, 28, 29, 30, 31, 0 -}; + v1=v2=0; l1 >>= 3; l2 >>= 3; r1 >>= 3; r2 >>= 3; + v1 |= efp[ 3][ l1 & 0x3f][0]; v2 |= efp[ 3][ l1 & 0x3f][1]; + v1 |= efp[ 2][(l1>>=6) & 0x3f][0]; v2 |= efp[ 2][ l1 & 0x3f][1]; + v1 |= efp[ 1][(l1>>=10) & 0x3f][0]; v2 |= efp[ 1][ l1 & 0x3f][1]; + v1 |= efp[ 0][(l1>>=6) & 0x3f][0]; v2 |= efp[ 0][ l1 & 0x3f][1]; -static char E[KS]; + v1 |= efp[ 7][ l2 & 0x3f][0]; v2 |= efp[ 7][ l2 & 0x3f][1]; + v1 |= efp[ 6][(l2>>=6) & 0x3f][0]; v2 |= efp[ 6][ l2 & 0x3f][1]; + v1 |= efp[ 5][(l2>>=10) & 0x3f][0]; v2 |= efp[ 5][ l2 & 0x3f][1]; + v1 |= efp[ 4][(l2>>=6) & 0x3f][0]; v2 |= efp[ 4][ l2 & 0x3f][1]; + v1 |= efp[11][ r1 & 0x3f][0]; v2 |= efp[11][ r1 & 0x3f][1]; + v1 |= efp[10][(r1>>=6) & 0x3f][0]; v2 |= efp[10][ r1 & 0x3f][1]; + v1 |= efp[ 9][(r1>>=10) & 0x3f][0]; v2 |= efp[ 9][ r1 & 0x3f][1]; + v1 |= efp[ 8][(r1>>=6) & 0x3f][0]; v2 |= efp[ 8][ r1 & 0x3f][1]; -static char PERM[] = -{ - 15, 6, 19, 20, 28, 11, 27, 16, - 0, 14, 22, 25, 4, 17, 30, 9, - 1, 7, 23, 13, 31, 26, 2, 8, - 18, 12, 29, 5, 21, 10, 3, 24 -}; + v1 |= efp[15][ r2 & 0x3f][0]; v2 |= efp[15][ r2 & 0x3f][1]; + v1 |= efp[14][(r2>>=6) & 0x3f][0]; v2 |= efp[14][ r2 & 0x3f][1]; + v1 |= efp[13][(r2>>=10) & 0x3f][0]; v2 |= efp[13][ r2 & 0x3f][1]; + v1 |= efp[12][(r2>>=6) & 0x3f][0]; v2 |= efp[12][ r2 & 0x3f][1]; + + outbuf[0] = salt[0]; + outbuf[1] = salt[1] ? salt[1] : salt[0]; + for(i=0; i<5; i++) + outbuf[i+2] = bin_to_ascii((v1>>(26-6*i)) & 0x3f); -static char S_BOX[][64] = -{ - { - 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, - 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, - 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, - 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13 - }, - { - 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, - 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, - 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, - 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9 - }, - { - 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, - 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, - 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, - 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12 - }, - { - 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, - 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, - 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, - 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14 - }, - { - 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, - 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, - 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, - 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3 - }, - { - 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, - 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, - 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, - 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13 - }, - { - 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, - 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, - 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, - 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12 - }, - { - 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, - 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, - 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, - 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11 - } -}; + s = (v2 & 0xf) << 2; /* Save the rightmost 4 bit a moment */ + v2 = (v2>>2) | ((v1 & 0x3)<<30); /* Shift two bits of v1 onto v2 */ -static void -perm (a, e, pc, n) - register char *a, *e; - register char *pc; - int n; -{ - for (; n--; pc++, a++) - *a = e[*pc]; -} + for(i=5; i<10; i++) + outbuf[i+2] = bin_to_ascii((v2>>(56-6*i)) & 0x3f); -static void -crypt_main (nachr_l, nachr_r, schl) - register char *nachr_l, *nachr_r; - register char *schl; -{ - char tmp[KS]; - register int sbval; - register char *tp = tmp; - register char *e = E; - register int i, j; - - for (i = 0; i < 8; i++) - { - for (j = 0, sbval = 0; j < 6; j++) - sbval = (sbval << 1) | (nachr_r[*e++] ^ *schl++); - sbval = S_BOX[i][sbval]; - for (tp += 4, j = 4; j--; sbval >>= 1) - *--tp = sbval & 1; - tp += 4; - } + outbuf[12] = bin_to_ascii(s); + outbuf[13] = 0; - e = PERM; - for (i = 0; i < BS2; i++) - *nachr_l++ ^= tmp[*e++]; -} + return outbuf; + } -void -encrypt (char *nachr, int decr) -{ - char (*schl)[KS] = decr ? schluessel + 15 : schluessel; - char tmp[BS]; - int i; - - perm (tmp, nachr, IP, BS); - - for (i = 8; i--;) - { - crypt_main (tmp, tmp + BS2, *schl); - if (decr) - schl--; - else - schl++; - crypt_main (tmp + BS2, tmp, *schl); - if (decr) - schl--; - else - schl++; - } +#define SBA(sb, v) (*(unsigned long*)((char*)(sb)+(v))) - perm (nachr, tmp, EP, BS); -} +#define F(I, O1, O2, SBX, SBY) \ + s = *k++ ^ I; \ + O1 ^= SBA(SBX, (s & 0xffff)); O2 ^= SBA(SBX, ((s & 0xffff) + 4)); \ + O1 ^= SBA(SBY, (s >>= 16)); O2 ^= SBA(SBY, ((s) + 4)); -void -setkey (char *schl) -{ - char tmp1[IS]; - register unsigned int ls = 0x7efc; - register int i, j, k; - register int shval = 0; - register char *akt_schl; - - memcpy (E, E0, KS); - perm (tmp1, schl, PC1, IS); - - for (i = 0; i < 16; i++) - { - shval += 1 + (ls & 1); - akt_schl = schluessel[i]; - for (j = 0; j < KS; j++) - { - if ((k = PC2[j]) >= IS2) - { - if ((k += shval) >= IS) - k = (k - IS2) % IS2 + IS2; - } - else if ((k += shval) >= IS2) - k %= IS2; - *akt_schl++ = tmp1[k]; - } - ls >>= 1; - } -} +#define G(I1, I2, O1, O2) \ + F(I1, O1, O2, sb1, sb0) F(I2, O1, O2, sb3, sb2) -char * -des_crypt (const char *wort, const char *salt) -{ - static char retkey[14]; - char key[BS + 2]; - char *k; - int tmp, keybyte; - int i, j; - - memset (key, 0, BS + 2); - - for (k = key, i = 0; i < BS; i++) - { - if (!(keybyte = *wort++)) - break; - k += 7; - for (j = 0; j < 7; j++, i++) - { - *--k = keybyte & 1; - keybyte >>= 1; - } - k += 8; - } +#define H G(r1, r2, l1, l2) ; G(l1, l2, r1, r2) - setkey (key); - memset (key, 0, BS + 2); - - for (k = E, i = 0; i < 2; i++) - { - retkey[i] = keybyte = *salt++; - if (keybyte > 'Z') - keybyte -= 'a' - 'Z' - 1; - if (keybyte > '9') - keybyte -= 'A' - '9' - 1; - keybyte -= '.'; - - for (j = 0; j < 6; j++, keybyte >>= 1, k++) - { - if (!(keybyte & 1)) - continue; - tmp = *k; - *k = k[24]; - k[24] = tmp; - } - } +char *des_crypt(key, salt) + char *key; + char *salt; + { unsigned long l1, l2, r1, r2, i, j, s, *k; - for (i = 0; i < 25; i++) - encrypt (key, 0); + setup_salt(salt); + mk_keytab(key); - for (k = key, i = 0; i < 11; i++) - { - for (j = keybyte = 0; j < 6; j++) - { - keybyte <<= 1; - keybyte |= *k++; - } + l1=l2=r1=r2=0; - keybyte += '.'; - if (keybyte > '9') - keybyte += 'A' - '9' - 1; - if (keybyte > 'Z') - keybyte += 'a' - 'Z' - 1; - retkey[i + 2] = keybyte; + for(j=0; j<25; j++) { + k = &keytab[0][0]; + for(i=8; i--; ) { + H; + } + s=l1; l1=r1; r1=s; s=l2; l2=r2; r2=s; } - retkey[i + 2] = 0; - - if (!retkey[1]) - retkey[1] = *retkey; + return output_conversion(l1, l2, r1, r2, salt); + } - return retkey; -} +#include "php.h" +#include "md5crypt.h" -char * +PHPAPI char * crypt (const char *pw, const char *salt) { if (strlen(salt)>MD5_MAGIC_LEN && strncmp(salt, MD5_MAGIC, MD5_MAGIC_LEN)==0) { diff --git a/win32/crypt_win32.h b/win32/crypt_win32.h index cd5a484c1..c728273e2 100644 --- a/win32/crypt_win32.h +++ b/win32/crypt_win32.h @@ -16,45 +16,18 @@ +----------------------------------------------------------------------+ */ -/* $Id: crypt_win32.h,v 1.7.2.1 2006/01/01 12:50:19 sniper Exp $ */ - -/* This code is distributed under the PHP license with permission from - the author Jochen Obalek <jochen.obalek@bigfoot.de> */ - -/* encrypt.h - API to 56 bit DES encryption via calls - encrypt(3), setkey(3) and crypt(3) - Copyright (C) 1991 Jochen Obalek - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef _ENCRYPT_H_ -#define _ENCRYPT_H_ +#ifndef _CRYPT_WIHN32_H_ +#define _CRYPT_WIHN32_H_ #ifdef __cplusplus extern "C" { #endif -#include <_ansi.h> - -void _EXFUN(encrypt, (char *block, int edflag)); -void _EXFUN(setkey, (char *key)); -char * _EXFUN(crypt, (const char *key, const char *salt)); +PHPAPI char* crypt(const char *key, const char *salt); #ifdef __cplusplus } #endif -#endif /* _ENCRYPT_H_ */ +#endif /* _CRYPT_WIHN32_H_ */ diff --git a/win32/install.txt b/win32/install.txt index 8d57c7ac6..ab9f1d02b 100644 --- a/win32/install.txt +++ b/win32/install.txt @@ -54,9 +54,9 @@ Chapter 1. General Installation Considerations want to use PHP for. There are three main fields you can use PHP, as described in the What can PHP do? section: - * Server-side scripting + * Websites and web applications (server-side scripting) * Command line scripting - * Client-side GUI applications + * Desktop (GUI) applications For the first and most common form, you need three things: PHP itself, a web server and a web browser. You probably already have a web @@ -66,15 +66,15 @@ Chapter 1. General Installation Considerations set up anything on your own, only write your PHP scripts, upload it to the server you rent, and see the results in your browser. - While setting up the server and PHP on your own, you have two choices - for the method of connecting PHP to the server. For many servers PHP - has a direct module interface (also called SAPI). These servers - include Apache, Microsoft Internet Information Server, Netscape and - iPlanet servers. Many other servers have support for ISAPI, the - Microsoft module interface (OmniHTTPd for example). If PHP has no - module support for your web server, you can always use it as a CGI or - FastCGI processor. This means you set up your server to use the CGI - executable of PHP to process all PHP file requests on the server. + In case of setting up the server and PHP on your own, you have two + choices for the method of connecting PHP to the server. For many + servers PHP has a direct module interface (also called SAPI). These + servers include Apache, Microsoft Internet Information Server, + Netscape and iPlanet servers. Many other servers have support for + ISAPI, the Microsoft module interface (OmniHTTPd for example). If PHP + has no module support for your web server, you can always use it as a + CGI or FastCGI processor. This means you set up your server to use the + CGI executable of PHP to process all PHP file requests on the server. If you are also interested to use PHP for command line scripting (e.g. write scripts autogenerating some images for you offline, or @@ -486,7 +486,7 @@ Microsoft IIS / PWS yourself from those attacks. _________________________________________________________________ -General considerations for all installations of PHP with IIS +General considerations for all installations of PHP with IIS or PWS * First, read the Manual Installation Instructions. Do not skip this step as it provides crucial information for installing PHP on @@ -697,7 +697,8 @@ Apache 1.3.x on Microsoft Windows Note: Remember that when adding path values in the Apache configuration files on Windows, all backslashes such as c:\directory\file.ext must be converted to forward slashes, as - c:/directory/file.ext. + c:/directory/file.ext. A trailing slash may also be necessary for + directories. _________________________________________________________________ Installing as an Apache module @@ -777,6 +778,11 @@ Apache 2.0.x on Microsoft Windows Note: You should read the manual installation steps first! + Apache 2.2.x Support: Users of Apache 2.2.x may use the + documentation below except the appropriate DLL file is named + php5apache2_2.dll and it only exists as of PHP 5.2.0. See also + http://snaps.php.net/ + Warning We do not recommend using a threaded MPM in production with Apache2. @@ -825,7 +831,8 @@ Apache 2.0.x on Microsoft Windows Note: Remember that when adding path values in the Apache configuration files on Windows, all backslashes such as c:\directory\file.ext must be converted to forward slashes, as - c:/directory/file.ext. + c:/directory/file.ext. A trailing slash may also be necessary for + directories. _________________________________________________________________ Installing as a CGI binary @@ -1365,7 +1372,7 @@ $ cvs -d:pserver:cvsread@cvs.php.net:/repository co pecl/extname Windows users may find compiled PECL binaries by downloading the Collection of PECL modules from the PHP Downloads page, and by retrieving a PECL Snapshot. To compile PHP under Windows, read the - Win32 Build README. + appropriate chapter. _________________________________________________________________ PECL for Windows users @@ -1424,6 +1431,14 @@ $ make A successful install will have created extname.so and put it into the PHP extensions directory. You'll need to and adjust php.ini and add an extension=extname.so line before you can use the extension. + + If the system is missing the phpize command, and precompiled packages + (like RPM's) are used, be sure to also install the appropriate devel + version of the PHP package as they often include the phpize command + along with the appropriate header files to build PHP and its + extensions. + + Execute phpize --help to display additional usage information. _________________________________________________________________ Compiling PECL extensions statically into PHP @@ -1518,9 +1533,10 @@ The configuration file * SAPI module specific location (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in NSAPI, PHP_INI_PATH environment variable in THTTPD) + * The PHPRC environment variable. Before PHP 5.2.0 this was checked + after the registry key mentioned below. * HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath (Windows Registry location) - * The PHPRC environment variable * Current working directory (for CLI) * The web server's directory (for SAPI modules), or directory of PHP (otherwise in Windows) @@ -1664,9 +1680,7 @@ Chapter 6. Installation FAQ is available for almost any OS (except maybe for MacOS before OSX), and almost any web server. - To install PHP, follow the instructions in the INSTALL file located in - the distribution. Windows users should also read the install.txt file. - There are also some helpful hints for Windows users here. + To install PHP, follow the instructions in Installing PHP. 1. Why shouldn't I use Apache2 with a threaded MPM in a production environment? diff --git a/win32/installer/README b/win32/installer/README deleted file mode 100644 index e72534c99..000000000 --- a/win32/installer/README +++ /dev/null @@ -1,93 +0,0 @@ -PHP Installer for Win32, by Wez Furlong <wez@thebrainroom.com> -============================================================== -$Id: README,v 1.3 2004/01/17 13:00:24 sniper Exp $ - -Here are the supporting scripts for building the win32 PHP installer. - -Requirements: - - MSI-2-XML from http://msi2xml.sourceforge.net/#Installation - - -Installer Layout: - -We have the following features: - - o PHP Core - Always installed. - Includes php5ts.dll, php.ini + common dlls - and config files - - o SAPI - Contains a node for each stable SAPI - - o Extensions - Contains a node for each stable extension - - o Experimental - o SAPI Experimental SAPIs - o Extensions Experimental Extensions - - - - - - - - -You need to have the Super-Pimp Installer from Nullsoft (Open Source). -It is available here: - http://nsis.sourceforge.net/ - -To build an installer, you need: - - o A Source Tree - o A win32 snapshot (extracted from the .zip) - - (The source tree and snapshot should have matching versions!) - -A Script/Batch file. -I'm using this (in a .bat file): - ----------------------------------------------------------------- -cd <snapshot_root> -cli\php <source_root>\win32\installer\gen-nsis.php > php.nsi -"C:\Program Files\NSIS\makensis" /pause /nocd php.nsi ----------------------------------------------------------------- - - ** It is a good idea to examine the php.nsi file for WARNING - ** comments. These indicate inconsistencies about your source - ** tree structure. - -This will generate InstallPHP<Version>.exe, where <Version> is the version of -the php in the snapshot. The Installer will be placed in the snapshot root. - -Installer Concept -================= - -Maintaining installers is a real chore, so we use PHP to generate as much as -possible. - -The gen-nsis.php script will examine the extensions dir from the snapshot and -then attempt to extract information about the extensions from the source code. -The sapi dir is subjected to similar treatment. - -Throughout the installation, values for php.ini settings are decided; these are -appended to a temporary file. After everything has been installed, the -iniset.php script is run and merges the values from the temporary file into the -"official" php.ini. - -These scripts take advantage of features found in PHP 4.3.0 and later, so you -can't build a PHP 4.2.x distro with it. - -Hacking -======= - -While hacking, it's a good idea to comment out the SetCompressor line; it will -speed up your installer builds... -Also, switch the logic for the $SYSDIR define at the top to install vital DLLs -to a fake system dir. - - - -vim:et:tw=78 - diff --git a/win32/installer/gen-nsis.php b/win32/installer/gen-nsis.php deleted file mode 100644 index 50092bac1..000000000 --- a/win32/installer/gen-nsis.php +++ /dev/null @@ -1,446 +0,0 @@ -; PHP Installer for NSIS -; Based on Welcome/Finish Page Example Script (Written by Joost Verburg) -; Author: Wez Furlong <wez@thebrainroom.com> -; $Id: gen-nsis.php,v 1.4 2004/01/17 13:00:24 sniper Exp $ -<?php - -define('PHPVERSION', phpversion()); -define('SOURCEDIR', dirname(__FILE__) . "\\..\\..\\"); -define('DISTDIR', getcwd()); - -/* for testing, install system files in a safe dir */ - -if (false) { - $SYSDIR = "\$INSTDIR\\system"; -} else { - $SYSDIR = "\$SYSDIR"; -} - -$sections = array( - "core" => array( - "label" => "-PHP Core (Required)", - "files" => array( - "$SYSDIR" => array( - "dlls\\*.dll", - "php5ts.dll", - ), - "\$INSTDIR" => array( - "*.txt", - "php.gif", - "php.ini-*", - ), - ), - "extras" => "Call CopyPHPIni\nWriteUninstaller \"\$INSTDIR\\Uninstall.exe\"" - ), - - "cgi" => array( - "group" => "SAPI", - "label" => "CGI", - "description" => "CGI Interface - should work with most web servers", - "files" => array( - "\$INSTDIR" => array( - "php.exe" - ), - "\$INSTDIR\\sapi" => array( - "sapi\\pws-php5cgi.reg" - ), - ), - ), - - /* CLI is required by the installer */ - "cli" => array( - "group" => "SAPI", - "label" => "-CLI", - "description" => "Command Line Interface for running PHP scripts as batch files", - "files" => array( - "\$INSTDIR\\cli" => array( - "cli\\php.exe" - ), - ), - ), - - "embed" => array( - "group" => "SAPI", - "label" => "Embed", - "description" => "Libraries for embedding PHP into your own projects", - "files" => array( - "\$INSTDIR" => array( - "*.lib" - ), - ), - ), - - "mibs" => array( - "group" => "Extras", - "label" => "MIBS for SNMP", - "description" => "MIB information for the SNMP extension", - "files" => array( - "\$INSTDIR\\mibs" => array( - "mibs\\*" - ), - ), - ), - - "pdfstuff" => array( - "group" => "Extras", - "label" => "PDF support files", - "description" => "Fonts and codepage data files for the PDF extensions", - "files" => array( - "\$INSTDIR\\pdf-related" => array( - "pdf-related\\*" - ), - ), - ), - - "mimemagic" => array( - "group" => "Extras", - "label" => "Mime Magic", - "description" => "The magic information file for the mimemagic extension", - "files" => array( - "\$INSTDIR" => array( - "magic.mime" - ), - ), - ), - - "openssl" => array( - "group" => "Extras", - "label" => "OpenSSL", - "description" => "OpenSSL configuration information which you must read if you plan to use PHP as a Certificate Authority", - "files" => array( - "\$INSTDIR\\openssl" => array( - "openssl\\*" - ), - ), - ), - - - -); - -$groups = array( - 'SAPI' => array("SAPI", "Select which Server API's to install."), - 'EXT' => array("Extensions", "Select which extensions to install."), - 'XSAPI' => array("Experimental SAPI", "Experimental Server API's - use at your own risk!"), - 'XEXT' => array("Experimental Extensions", "Experimental Extensions - use at your own risk!"), - 'Extras' => array("Extras", "Supplemental Files"), - ); - -function xglob($pattern) -{ - if (strpos($pattern, '*') === false) { - return array($pattern); - } - $dir = dirname($pattern); - $pattern = basename($pattern); - - $pattern = str_replace(array('*', '.'), array('.*', '\.'), $pattern); - - $files = array(); - - $d = opendir($dir); - while ($f = readdir($d)) { - if ($f == '.' || $f == '..' || preg_match('/^\..*\.swp$/', $f)) - continue; - if (preg_match('@' . $pattern . '@i', $f)) { - $files[] = $dir . '\\' . $f; - } - } - - return $files; -} - -/* Look for extensions and determine their info based on the source tree. - * We can determine the name and author from the CREDITS file. - * We can determine experimental status from the EXPERIMENTAL file. - * It would be nice to have a standard description line in the CREDITS too. - */ -$extension_abbreviations = array( - 'ifx' => 'informix', - 'gd2' => 'gd', - ); - -$sapi_abbreviations = array( - 'apache2' => 'apache2filter', - 'srvlt' => 'servlet', -); - -function add_sections($pattern, $groupname, $abbrev, &$sections, $sourcedirs, $instdir) -{ - $avail = xglob($pattern); - - foreach ($avail as $extname) { - /* mangle name */ - if (preg_match('/(php_|php5|php)([^_].*)\.dll/', basename($extname), $matches)) { - $ext = $matches[2]; - } else { - $ext = basename($extname); - } - - if (isset($abbrev[$ext])) { - $ext = $abbrev[$ext]; - } - - $extdir = null; - - foreach ($sourcedirs as $sourcedir) { - // Allow absolute path for separate PECL checkout - if ($sourcedir{0} == '\\' || $sourcedir{1} == ':') - $extdir = $sourcedir; - else - $extdir = SOURCEDIR . $sourcedir . '/' . $ext . '/'; - - if (is_dir($extdir)) - break; - - $extdir = null; - } - - if ($extdir === null || !is_dir($extdir)) { - echo "; WARNING: could not find source dir for extension $extname -> $extdir ($ext)\n"; - } - - $exp = file_exists($extdir . 'EXPERIMENTAL'); - if (file_exists($extdir . 'CREDITS')) { - list($title, $authors, $description) = file($extdir . 'CREDITS'); - $title = trim($title); - $authors = trim($authors); - $description = trim($description); - - if (strlen($title) == 0) - $title = $ext; - - } else { - $title = $ext; - $authors = "Unknown, or uncredited"; - $description = ""; - } - - /* build list of support files. - * in theory, only needed for the srvlt sapi, but useful to keep this - * generic */ - $filepat = preg_replace('/\.[^\.]+$/', '.*', $extname); - - if ($groupname == 'EXT') { - } - - $sections['ext_' . $ext] = array( - 'group' => ($exp ? 'X' : '') . $groupname, - 'label' => $title, - 'description' => $title . ".\$\\nAuthors: $authors", - 'files' => array( - "\$INSTDIR\\" . $instdir => array( - $filepat - ), - ), -/* 'extras' => $groupname == 'EXT' ? "Push \"extension=" . basename($extname) . "\"\nCall AddIniSetting\n\n" : "" */ - ); - - } - - -} - -add_sections('extensions\\*.dll', 'EXT', $extension_abbreviations, $sections, array('ext'), 'extensions'); -add_sections('sapi\\*.dll', 'SAPI', $sapi_abbreviations, $sections, array('sapi'), 'sapi'); - - - - - -$SECTIONS = ""; -$sections_stage1 = array(); - -/* list of files to uninstall */ -$uninstall = array(); -$rmdirs = array(); -/* description texts */ -$descriptions = array(); - -$dirs_no_delete = array("\$SYSDIR", "\$INSTDIR"); - -foreach ($sections as $sectionid => $sectiondata) { - $descriptions[] = "\t!insertmacro MUI_DESCRIPTION_TEXT \${Sec$sectionid} \"" . $sectiondata['description'] . "\""; - - if (isset($sectiondata['group'])) { - $sub = "Sub"; - $group = $sectiondata['group']; - } else { - $sub = ""; - $group = '_top_'; - } - - $body = "Section \"" . $sectiondata['label'] . "\" Sec$sectionid\n"; - - foreach ($sectiondata['files'] as $outputdir => $filelist) { - $body .= "\tSetOutPath \"$outputdir\"\n"; - foreach ($filelist as $pattern) { - $files = xglob($pattern); - foreach ($files as $filename) { - $uninstall[] = "\tDelete \"$outputdir\\" . basename($filename) . "\""; - - $body .= "\tFile \"$filename\"\n"; - } - } - if (!in_array($outputdir, $dirs_no_delete) && !isset($rmdirs[$outputdir])) { - $rmdirs[$outputdir] = "\tRMDir \"$outputdir\""; - } - } - - $body .= $sectiondata['extras']; - - $body .= "\nSectionEnd\n"; - - $sections_stage1[$group] .= $body . "\n\n"; -} - -foreach ($sections_stage1 as $group => $data) -{ - if ($group == '_top_') { - $SECTIONS .= $data . "\n"; - } else { - $descriptions[] = "\t!insertmacro MUI_DESCRIPTION_TEXT \${SecGroup$group} \"" . $groups[$group][1] . "\""; - $SECTIONS .= "SubSection /e \"" . $groups[$group][0] . "\" SecGroup$group\n$data\nSubSectionEnd\n\n"; - } -} - -/* Now build descriptions */ -$DESCRIPTIONS = implode("\n", $descriptions) . "\n"; - -/* And the uninstallation section */ -$UNINSTALL = implode("\n", $uninstall) . "\n" . implode("\n", $rmdirs) . "\n"; - -?> - -!define MUI_PRODUCT "PHP - Hypertext Preprocessor" -!define MUI_VERSION "<?= PHPVERSION ?>" -; The second UI has a wider area for the component names -!define MUI_UI "${NSISDIR}\Contrib\UIs\modern2.exe" - -!include "${NSISDIR}\Contrib\Modern UI\System.nsh" - -;-------------------------------- -;Configuration - -!define MUI_WELCOMEPAGE -!define MUI_LICENSEPAGE -!define MUI_COMPONENTSPAGE -!define MUI_DIRECTORYPAGE - -!define MUI_FINISHPAGE -;!define MUI_FINISHPAGE_RUN "$INSTDIR\modern.exe" - -!define MUI_ABORTWARNING - -!define MUI_UNINSTALLER -!define MUI_UNCONFIRMPAGE - -;Language -!insertmacro MUI_LANGUAGE "English" - -;General -OutFile "InstallPHP<?= PHPVERSION ?>.exe" - -SetCompressor bzip2 -ShowInstDetails show -;License page -LicenseData "license.txt" - -;Folder-selection page -InstallDir "C:\PHP-<?= PHPVERSION ?>" -;define NSIS_CONFIG_LOG "install.log" -;LogSet on - -!cd <?= SOURCEDIR ?>win32\installer - -;Things that need to be extracted on startup (keep these lines before any File command!) -;Only useful for BZIP2 compression -;Use ReserveFile for your own Install Options ini files too! -!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS -!insertmacro MUI_RESERVEFILE_SPECIALINI -!insertmacro MUI_RESERVEFILE_SPECIALBITMAP - -!cd <?= DISTDIR ?> - -!insertmacro MUI_SYSTEM - - -;-------------------------------- -;Installer Sections - -Function AddIniSetting - Pop $R0 - - FileOpen $R2 "$INSTDIR\.ini-add" "a" - FileSeek $R2 0 END - FileWrite $R2 "$R0$\n" - FileClose $R2 - -FunctionEnd - -Function CopyPHPIni - ; Ensure that we have a working php.ini to reflect the - ; installation options. - ; Extensions will call a function to activate their entry - ; in the ini file as they are installed. - - Rename "$WINDIR\php.ini" "$WINDIR\php.ini.old" - CopyFiles "$INSTDIR\php.ini-dist" "$WINDIR\php.ini" - -; These files will be deleted during post-installation - CopyFiles "<?= $SYSDIR ?>\php5ts.dll" "$INSTDIR\php5ts.dll" - File "<?= dirname(__FILE__) ?>\setini.php" - -; Set the extension_dir setting in the php.ini - Push "extension_dir=$\"$INSTDIR\extensions$\"" - Call AddIniSetting - -FunctionEnd - -; Generated Section Info -<?= $SECTIONS ?> -; --------- - -; Perform final actions after everything has been installed -Section -post - ; Merge ini settings - - Sleep 1000 - - ExecWait "$\"$INSTDIR\cli\php.exe$\" $\"-n$\" $\"$INSTDIR\setini.php$\" $\"$WINDIR\php.ini$\" $\"$INSTDIR\.ini-add$\"" - - Delete "$INSTDIR\.ini-add" ; Created by the AddIniSetting function - Delete "$INSTDIR\setini.php" - Delete "$INSTDIR\php5ts.dll" - - ; Add to Add/Remove programs list - WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PHP-<?= PHPVERSION ?>" "UninstallString" "$INSTDIR\Uninstall.exe" - WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PHP-<?= PHPVERSION ?>" "DisplayName" "PHP-<?= PHPVERSION ?> (Uninstall only)" - - -SectionEnd - -;-------------------------------- -;Descriptions - -!insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN -<?= $DESCRIPTIONS ?> -!insertmacro MUI_FUNCTIONS_DESCRIPTION_END - -;-------------------------------- -;Uninstaller Section - -Section "Uninstall" -<?= $UNINSTALL ?> - - Delete "$INSTDIR\Uninstall.exe" - Delete "$WINDIR\php.ini" - RMDir "$INSTDIR" - ; Remove from Add/Remove programs list - DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PHP-<?= PHPVERSION ?>" - - !insertmacro MUI_UNFINISHHEADER - -SectionEnd -; vim:sw=4:ts=4: -; vim600:sw=4:ts=4:noet:fdm=marker diff --git a/win32/installer/setini.php b/win32/installer/setini.php deleted file mode 100644 index b443a50ec..000000000 --- a/win32/installer/setini.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php -/* $Id: setini.php,v 1.3 2003/02/16 23:46:45 wez Exp $ - * Wez Furlong <wez@thebrainroom.com> - * - * Set options in a php.ini file. - * This is a support script for the installer. - * - * $argv[1] is the path to the ini file - * $argv[2] is the path to the option file - */ - -echo "Running post-installation script to configure php.ini\n"; - -function fatal($msg) -{ - echo $msg; - sleep(5); - exit(1); -} - -$ini_name = $argv[1]; -$option_file = $argv[2]; - -if (!file_exists($option_file)) { - fatal("Option file $option_file does not exist"); -} - -if (!file_exists($ini_name)) { - fatal("inifile $ini_name does not exist"); -} - -$options = explode("\n", file_get_contents($option_file)); -$opts = array(); - -/* Parse the options */ -foreach ($options as $line) { - if (strlen(trim($line)) == 0) - continue; - - list($name, $value) = explode("=", $line); - - if ($name == "extension") { - $pat = "/^;?extension\s*=\s*" . preg_quote($value, '/') . "/i"; - } else { - $pat = "/^;?" . preg_quote($name, '/') . "\s*=\s*/i"; - } - - $opts[] = array('pat' => $pat, 'name' => $name, 'value' => $value); -} - -$new_name = $ini_name . "~"; -$dest = fopen($new_name, "w"); - -if (!$dest) { - echo "Could not create temporary file! $new_name\n"; - flush(); - sleep(10); - die("Cannot create temporary file!"); -} - -$lines = file($ini_name); - -foreach ($lines as $line) { - - foreach ($opts as $k => $optdata) { - extract($optdata); - - if (preg_match($pat, $line)) { - echo "Found $pat ; setting $name to $value\n"; - $line = "$name=$value\r\n"; - // No need to match again - unset($opts[$k]); - break; - } - } - - fwrite($dest, $line); -} - -fclose($dest); - -unlink($ini_name); -rename($new_name, $ini_name); - -echo "All done!\n"; -sleep(1); -?> diff --git a/win32/php5dllts.dsp b/win32/php5dllts.dsp index ccb8def8e..3a2c194c6 100644 --- a/win32/php5dllts.dsp +++ b/win32/php5dllts.dsp @@ -393,82 +393,82 @@ SOURCE=..\main\win95nt.h # Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_chartables.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_compile.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_exec.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_fullinfo.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_get.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_globals.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_info.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_maketables.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_ord2utf8.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_study.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_tables.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_try_flipped.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_ucp_searchfuncs.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_valid_utf8.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_version.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# Begin Source File
SOURCE=..\ext\pcre\pcrelib\pcre_xclass.c
-# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP"
+# ADD CPP /D "SUPPORT_UTF8" /D LINK_SIZE=2 /D MATCH_LIMIT=10000000 /D MATCH_LIMIT_RECURSION=10000000 /D NEWLINE=10 /D "SUPPORT_UCP" /D MAX_NAME_SIZE=32 /D MAX_NAME_COUNT=10000 /D MAX_DUPLENGTH=30000 /D "NO_RECURSE"
# End Source File
# End Group
# Begin Group "Header Files No. 3"
@@ -764,6 +764,231 @@ SOURCE=..\ext\ftp\php_ftp.h # End Source File
# End Group
# End Group
+# Begin Group "Calendar"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 7"
+
+# PROP Default_Filter ".c"
+# Begin Source File
+
+SOURCE=..\ext\calendar\cal_unix.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\calendar.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\dow.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\easter.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\french.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\gregor.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\jewish.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\julian.c
+# PROP Intermediate_Dir "calendar"
+# End Source File
+# End Group
+# Begin Group "Header Files No. 7"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=..\ext\calendar\php_calendar.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\calendar\sdncal.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "SPL"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 11"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\spl\php_spl.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_array.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_directory.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_engine.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_exceptions.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_functions.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_iterators.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_observer.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_sxe.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 12"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\spl\php_spl.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_array.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_directory.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_engine.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_exceptions.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_functions.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_iterators.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_observer.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\ext\spl\spl_sxe.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "Reflection"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 12"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\reflection\php_reflection.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 13"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\reflection\php_reflection.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "XMLReader"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 13"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\xmlreader\php_xmlreader.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 14"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\xmlreader\php_xmlreader.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "XMLwriter"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 14"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\xmlwriter\php_xmlwriter.c
+# End Source File
+# End Group
+# Begin Group "Header Files No. 15"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\xmlwriter\php_xmlwriter.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "IConv"
+
+# PROP Default_Filter ""
+# Begin Group "Source Files No. 15"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\iconv\iconv.c
+# ADD CPP /D "PHP_ICONV_EXPORTS"
+# End Source File
+# End Group
+# Begin Group "Header Files No. 16"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ext\iconv\php_iconv.h
+# End Source File
+# End Group
+# End Group
# Begin Group "bcmath"
# PROP Default_Filter ""
@@ -2058,267 +2283,90 @@ SOURCE=..\ext\date\lib\timelib.c # End Source File
# Begin Source File
-SOURCE=..\ext\date\lib\tm2unixtime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\unixtime2tm.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 7"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\date\lib\astro.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\fallbackmap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\php_date.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\timelib_config.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\timelib_structs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\timezonedb.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\date\lib\timezonemap.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Calendar"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 7"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\calendar\cal_unix.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\calendar.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\dow.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\easter.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\french.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\gregor.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\jewish.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\julian.c
-# PROP Intermediate_Dir "calendar"
-# End Source File
-# End Group
-# Begin Group "Header Files No. 11"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\calendar\php_calendar.h
-# End Source File
-# Begin Source File
+SOURCE=..\ext\date\lib\timelib_config.h.win32
-SOURCE=..\ext\calendar\sdncal.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "SPL"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 11"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\spl\php_spl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\spl\spl_array.c
-# End Source File
-# Begin Source File
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-SOURCE=..\ext\spl\spl_directory.c
-# End Source File
-# Begin Source File
+# Begin Custom Build
+InputDir=\Projects\php-5.2\ext\date\lib
+InputPath=..\ext\date\lib\timelib_config.h.win32
-SOURCE=..\ext\spl\spl_engine.c
-# End Source File
-# Begin Source File
+"..\ext\date\lib\timelib_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy $(InputPath) $(InputDir)\timelib_config.h
-SOURCE=..\ext\spl\spl_exceptions.c
-# End Source File
-# Begin Source File
+# End Custom Build
-SOURCE=..\ext\spl\spl_functions.c
-# End Source File
-# Begin Source File
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-SOURCE=..\ext\spl\spl_iterators.c
-# End Source File
-# Begin Source File
+# Begin Custom Build
+InputDir=\Projects\php-5.2\ext\date\lib
+InputPath=..\ext\date\lib\timelib_config.h.win32
-SOURCE=..\ext\spl\spl_observer.c
-# End Source File
-# Begin Source File
+"..\ext\date\lib\timelib_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy $(InputPath) $(InputDir)\timelib_config.h
-SOURCE=..\ext\spl\spl_sxe.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 12"
+# End Custom Build
-# PROP Default_Filter ""
-# Begin Source File
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-SOURCE=..\ext\spl\php_spl.h
-# End Source File
-# Begin Source File
+# Begin Custom Build
+InputDir=\Projects\php-5.2\ext\date\lib
+InputPath=..\ext\date\lib\timelib_config.h.win32
-SOURCE=..\ext\spl\spl_array.h
-# End Source File
-# Begin Source File
+"..\ext\date\lib\timelib_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy $(InputPath) $(InputDir)\timelib_config.h
-SOURCE=..\ext\spl\spl_directory.h
-# End Source File
-# Begin Source File
+# End Custom Build
-SOURCE=..\ext\spl\spl_engine.h
-# End Source File
-# Begin Source File
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-SOURCE=..\ext\spl\spl_exceptions.h
-# End Source File
-# Begin Source File
+# Begin Custom Build
+InputDir=\Projects\php-5.2\ext\date\lib
+InputPath=..\ext\date\lib\timelib_config.h.win32
-SOURCE=..\ext\spl\spl_functions.h
-# End Source File
-# Begin Source File
+"..\ext\date\lib\timelib_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ copy $(InputPath) $(InputDir)\timelib_config.h
-SOURCE=..\ext\spl\spl_iterators.h
-# End Source File
-# Begin Source File
+# End Custom Build
-SOURCE=..\ext\spl\spl_observer.h
-# End Source File
-# Begin Source File
+!ENDIF
-SOURCE=..\ext\spl\spl_sxe.h
# End Source File
-# End Group
-# End Group
-# Begin Group "Reflection"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 12"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\ext\reflection\php_reflection.c
+SOURCE=..\ext\date\lib\tm2unixtime.c
# End Source File
-# End Group
-# Begin Group "Header Files No. 13"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\ext\reflection\php_reflection.h
+SOURCE=..\ext\date\lib\unixtime2tm.c
# End Source File
# End Group
-# End Group
-# Begin Group "XMLReader"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 13"
+# Begin Group "Header Files No. 11"
# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\ext\xmlreader\php_xmlreader.c
+SOURCE=..\ext\date\lib\astro.h
# End Source File
-# End Group
-# Begin Group "Header Files No. 14"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\ext\xmlreader\php_xmlreader.h
+SOURCE=..\ext\date\lib\fallbackmap.h
# End Source File
-# End Group
-# End Group
-# Begin Group "XMLwriter"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 14"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\ext\xmlwriter\php_xmlwriter.c
+SOURCE=..\ext\date\php_date.h
# End Source File
-# End Group
-# Begin Group "Header Files No. 15"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\ext\xmlwriter\php_xmlwriter.h
+SOURCE=..\ext\date\lib\timelib.h
# End Source File
-# End Group
-# End Group
-# Begin Group "IConv"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 15"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\ext\iconv\iconv.c
-# ADD CPP /D "PHP_ICONV_EXPORTS"
+SOURCE=..\ext\date\lib\timezonedb.h
# End Source File
-# End Group
-# Begin Group "Header Files No. 16"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\ext\iconv\php_iconv.h
+SOURCE=..\ext\date\lib\timezonemap.h
# End Source File
# End Group
# End Group
@@ -2385,6 +2433,14 @@ SOURCE=..\win32\wsyslog.c SOURCE=.\build\wsyslog.mc
+!IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
+
+!ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
+
# Begin Custom Build
InputDir=.\build
IntDir=.\Release_TSDbg
@@ -2395,6 +2451,8 @@ InputPath=.\build\wsyslog.mc # End Custom Build
+!ENDIF
+
# End Source File
# End Group
# Begin Group "Header Files No. 2"
@@ -2648,7 +2706,7 @@ SOURCE=.\phpts.def !IF "$(CFG)" == "php5dllts - Win32 Debug_TS"
-USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def"
+USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def" "..\ext\libxml\php_libxml2.def"
# Begin Custom Build - Generating $(InputPath)
InputPath=.\phpts.def
@@ -2659,7 +2717,7 @@ InputPath=.\phpts.def !ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS"
-USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def"
+USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def" "..\ext\libxml\php_libxml2.def"
# Begin Custom Build - Generating $(InputPath)
InputPath=.\phpts.def
@@ -2670,7 +2728,7 @@ InputPath=.\phpts.def !ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TS_inline"
-USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def"
+USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def" "..\ext\libxml\php_libxml2.def"
# Begin Custom Build - Generating $(InputPath)
InputPath=.\phpts.def
@@ -2681,7 +2739,7 @@ InputPath=.\phpts.def !ELSEIF "$(CFG)" == "php5dllts - Win32 Release_TSDbg"
-USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def"
+USERDEP__PHPTS="..\ext\sqlite\php_sqlite.def" "..\ext\libxml\php_libxml2.def"
# Begin Custom Build - Generating $(InputPath)
InputPath=.\phpts.def
diff --git a/win32/php5ts.dsp b/win32/php5ts.dsp index 3922904e6..373681512 100644 --- a/win32/php5ts.dsp +++ b/win32/php5ts.dsp @@ -152,6 +152,10 @@ SOURCE=..\sapi\cgi\cgi_main.c # End Source File
# Begin Source File
+SOURCE=..\sapi\cgi\fastcgi.c
+# End Source File
+# Begin Source File
+
SOURCE=..\sapi\cgi\getopt.c
# End Source File
# End Group
diff --git a/win32/registry.c b/win32/registry.c index 95d142cfa..2e7a07409 100644 --- a/win32/registry.c +++ b/win32/registry.c @@ -1,7 +1,60 @@ #include "php.h" #include "php_ini.h" -#define PHP_REGISTRY_KEY "SOFTWARE\\PHP" +#define PHP_REGISTRY_KEY "SOFTWARE\\PHP" + +#define PHP_VER1(V1) #V1 +#define PHP_VER2(V1,V2) #V1"."#V2 +#define PHP_VER3(V1,V2,V3) #V1"."#V2"."#V3 + +#define PHP_REGISTRY_KEYV(VER) PHP_REGISTRY_KEY"\\"VER +#define PHP_REGISTRY_KEY1(V1) PHP_REGISTRY_KEY"\\"PHP_VER1(V1) +#define PHP_REGISTRY_KEY2(V1,V2) PHP_REGISTRY_KEY"\\"PHP_VER2(V1,V2) +#define PHP_REGISTRY_KEY3(V1,V2,V3) PHP_REGISTRY_KEY"\\"PHP_VER3(V1,V2,V3) + +static const char* registry_keys[] = { + PHP_REGISTRY_KEYV(PHP_VERSION), + PHP_REGISTRY_KEY3(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION), + PHP_REGISTRY_KEY2(PHP_MAJOR_VERSION, PHP_MINOR_VERSION), + PHP_REGISTRY_KEY1(PHP_MAJOR_VERSION), + PHP_REGISTRY_KEY, + NULL +}; + +static int OpenPhpRegistryKey(char* sub_key, HKEY *hKey) +{ + const char **key_name = registry_keys; + + if (sub_key) { + int main_key_len; + int sub_key_len = strlen(sub_key); + char *reg_key; + + while (*key_name) { + LONG ret; + + main_key_len = strlen(*key_name); + reg_key = emalloc(main_key_len + sub_key_len + 1); + memcpy(reg_key, *key_name, main_key_len); + memcpy(reg_key + main_key_len, sub_key, sub_key_len + 1); + ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_key, 0, KEY_READ, hKey); + efree(reg_key); + + if (ret == ERROR_SUCCESS) { + return 1; + } + ++key_name; + } + } else { + while (*key_name) { + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, *key_name, 0, KEY_READ, hKey) == ERROR_SUCCESS) { + return 1; + } + ++key_name; + } + } + return 0; +} void UpdateIniFromRegistry(char *path TSRMLS_DC) { @@ -9,7 +62,7 @@ void UpdateIniFromRegistry(char *path TSRMLS_DC) HKEY MainKey; char *strtok_buf = NULL; - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, PHP_REGISTRY_KEY "\\Per Directory Values", 0, KEY_READ, &MainKey)!=ERROR_SUCCESS) { + if (!OpenPhpRegistryKey("\\Per Directory Values", &MainKey)) { return; } @@ -100,7 +153,7 @@ char *GetIniPathFromRegistry() char *reg_location = NULL; HKEY hKey; - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, PHP_REGISTRY_KEY, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { + if (OpenPhpRegistryKey(NULL, &hKey)) { DWORD buflen = MAXPATHLEN; reg_location = emalloc(MAXPATHLEN+1); if(RegQueryValueEx(hKey, PHPRC_REGISTRY_NAME, 0, NULL, reg_location, &buflen) != ERROR_SUCCESS) { |
