develooper Front page | perl.perl5.porters | Postings from April 2000

[ID 20000420.003] win32.c get_regstr_from() read error onREG_EXPAND_SZ values

From:
John.Clayton
Date:
April 20, 2000 04:28
Subject:
[ID 20000420.003] win32.c get_regstr_from() read error onREG_EXPAND_SZ values
Message ID:
51A9FACC9BF1D21190D800805FFE61D9017B797E@exlpseu010.ldn.bzwint.com

This is a bug report for perl from john_clayton@usa.net,
generated with the help of perlbug 1.26 running under perl 5.00503.

The bug is on the 
	if (retval == ERROR_SUCCESS && type == REG_SZ) {

line of c:\perl\win32\win32.c (somewhere like line 144) , which should
really read: 
	if (retval == ERROR_SUCCESS && (type == REG_SZ || type ==
REG_EXPAND_SZ)) {


This is manifested by an embedded application failing to pick up modules
becase the perlcore.dll (using -DPERL_OBJECT) does not pick up and use the
INC values.

-- code excerpt , win32.c : 130 - 160ish --

/* *svp (if non-NULL) is expected to be POK (valid allocated SvPVX(*svp)) */
static char*
get_regstr_from(HKEY hkey, const char *valuename, SV **svp)
{
    /* Retrieve a REG_SZ or REG_EXPAND_SZ from the registry */
    HKEY handle;
    DWORD type;
    const char *subkey = "Software\\Perl";
    char *str = Nullch;
    long retval;

    retval = RegOpenKeyEx(hkey, subkey, 0, KEY_READ, &handle);
    if (retval == ERROR_SUCCESS) {
	DWORD datalen;
	retval = RegQueryValueEx(handle, valuename, 0, &type, NULL,
&datalen);
	if (retval == ERROR_SUCCESS && type == REG_SZ) {
	    if (!*svp)
		*svp = sv_2mortal(newSVpvn("",0));
	    SvGROW(*svp, datalen);
	    retval = RegQueryValueEx(handle, valuename, 0, NULL,
				     (PBYTE)SvPVX(*svp), &datalen);
	    if (retval == ERROR_SUCCESS) {
		str = SvPVX(*svp);
		SvCUR_set(*svp,datalen-1);
	    }
	}
	RegCloseKey(handle);
    }
    return str;
}

---

Site configuration information for perl 5.00503:

Summary of my perl5 (5.0 patchlevel 5 subversion 03) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-object
    uname=''
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cl.exe', optimize='-O2 -MD -DNDEBUG -TP -GX', gccversion=
    cppflags='-DWIN32'
    ccflags ='-O2 -MD -DNDEBUG -TP -GX -DWIN32 -D_CONSOLE -DNO_STRICT
-DHAVE_DES_FCRYPT -DPERL_OBJECT'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -release -machine:x86'
    libpth="C:\Apps\ActivePerl\lib\core" "C:\Program Files\Mts\Lib" 
    libs= oldnames.lib kernel32.lib user32.lib gdi32.lib  winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib  oleaut32.lib netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib
PerlCRT.lib
    libc=C:\Apps\ActivePerl\lib\CORE\PerlCRT.lib, so=dll, useshrplib=yes,
libperl=perlcore.lib
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release
-machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY

---
@INC for perl 5.00503:
    C:/APPS/ActivePerl/lib
    c:\Apps\ActivePerl\site\lib
    c:\Apps\ActivePerl\site
    c:\Apps\ActivePerl\lib
    C:/APPS/ActivePerl/site/lib
    .

---
Environment for perl 5.00503:
    HOME (unset)
    LANG=enu
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\Perl\bin;c:\dmi\win32\bin;C:\WINNT\system32;C:\WINNT;C:\Program
Files\Mts;C:\atria\bin;C:\Apps\ActivePerl\Bin;c:\program
files\orbix\bin;c:\program
files\fifes;c:\cygnus\cygwin~1\h-i586~1\bin;c:\jdk1.2.2\bin;c:\winnt\custom\
bin;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program
Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual
Studio\VC98\Bin;C:\APPS\SYBASE\DLL;C:\APPS\SYBASE\BIN;C:\APPS\sybtools\WIN32
;C:\APPS\sybtools\ASEP;C:\Program Files\MSSQL\BINN;C:\Program
Files\Iris\Bin;C:\Program Files\Fifes2\Bin;C:\Program Files\ORANT;C:\Program
Files\ORANT\bin
    PERL_BADLANG (unset)
    SHELL (unset)


--------------------------------------------------------------------------------------
For more information about Barclays Capital, please
visit our web site at http://www.barcap.com.

Internet communications are not secure and therefore the Barclays Group
does not accept legal responsibility for the contents of this message.
Any views or opinions presented are solely those of the author and do 
not necessarily represent those of the Barclays Group unless otherwise 
specifically stated.

--------------------------------------------------------------------------------------



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About