Skip Menu |

This queue is for tickets about the Win32-Env CPAN distribution.

Report information
The Basics
Id: 99487
Status: open
Priority: 0/
Queue: Win32-Env

People
Owner: Nobody in particular
Requestors: bill_chatfield [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: ENV_SYSTEM is Undefined
Date: Tue, 14 Oct 2014 12:16:22 -0700
To: bug-Win32-Env [...] rt.cpan.org
From: Bill Chatfield <bill_chatfield [...] yahoo.com>
If you have not "Run as Adiministrator", any usage of ENV_SYSTEM fails with an undefined value. If you do "Run as Administrator", it works fine. Two issues: 1. In the case of SetEnv, it should say "Access Denied" or something similar if it is really true that system variables cannot be set unless you "Run as Administrator". But I don't think it is true. 2. In the case of GetEnv or ListEnv, it should work. You should be able to look at the system environment variables if you are not an Administrator. Demonstration: C:\Users\bill.chatfield\Documents\bin>type Win32EnvDefect.pl use Win32::Env; eval {GetEnv(ENV_SYSTEM, "Path")}; warn $@ if $@; eval {PutEnv(ENV_SYSTEM, "HOUSE", "Lannister")}; warn $@ if $@; eval {ListEnv(ENV_SYSTEM)}; warn $@ if $@; C:\Users\bill.chatfield\Documents\bin>Win32EnvDefect.pl Can't call method "GetValue" on an undefined value at C:/strawberry/perl/site/li b/Win32/Env.pm line 159. Undefined subroutine &main::PutEnv called at C:\Users\bill.chatfield\Documents\b in\Win32EnvDefect.pl line 3. Can't call method "ValueNames" on an undefined value at C:/strawberry/perl/site/ lib/Win32/Env.pm line 191. C:\Users\bill.chatfield\Documents\bin>perldoc -m Win32::Env package Win32::Env; our $VERSION='0.03'; ----- C:\Users\bill.chatfield\Documents\bin>systeminfo | more Host Name: LOH001NU2030P2W OS Name: Microsoft Windows 7 Professional OS Version: 6.1.7601 Service Pack 1 Build 7601 OS Manufacturer: Microsoft Corporation OS Configuration: Member Workstation OS Build Type: Multiprocessor Free Registered Owner: Cardinal User Registered Organization: Cardinal Health, Inc. Product ID: 00371-868-0000007-85344 Original Install Date: 4/19/2013, 2:17:42 PM System Boot Time: 10/14/2014, 10:40:10 AM System Manufacturer: Hewlett-Packard System Model: HP EliteBook 8460p System Type: x64-based PC Processor(s): 1 Processor(s) Installed. [01]: Intel64 Family 6 Model 42 Stepping 7 GenuineInt el ~2501 Mhz BIOS Version: Hewlett-Packard 68SCF Ver. F.29, 1/4/2013 Windows Directory: C:\Windows System Directory: C:\Windows\system32 ----- C:\Users\bill.chatfield\Documents\bin>perl -V Summary of my perl5 (revision 5 version 18 subversion 2) configuration: Platform: osname=MSWin32, osvers=6.2, archname=MSWin32-x64-multi-thread uname='Win32 strawberry-perl 5.18.2.1 #1 Tue Jan 7 22:32:35 2014 x64' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_ SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fno-strict-ali asing -mms-bitfields', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='4.7.3', gccosandvers='' intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long long', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\li b"' libpth=C:\strawberry\c\lib C:\strawberry\c\x86_64-w64-mingw32\lib C:\strawbe rry\c\lib\gcc\x86_64-w64-mingw32\4.7.3 libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladva pi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lver sion -lodbc32 -lodbccp32 -lcomctl32 libc=, so=dll, useshrplib=true, libperl=libperl518.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"C:\strawberry\perl\lib\CORE" -L"C:\st rawberry\c\lib"' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF Built under MSWin32 Compiled at Jan 7 2014 22:40:30 @INC: C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib .
Hit the same problem, using GetEnv on Win32::Env 0.03 I fixed the module with the changes below. This fixes both GetEnv and ListEnv; not bothered about SetEnv. 35c35 < use Win32::TieRegistry(FixSzNulls=>1); --- Show quoted text
> use Win32::TieRegistry(FixSzNulls=>1, qw(KEY_READ));
159c159 < my($value, $type)=Win32::TieRegistry->new($sysusr)->GetValue($var); --- Show quoted text
> my($value, $type)=Win32::TieRegistry->new($sysusr, {Access=>KEY_READ})->GetValue($var);
191c191 < return Win32::TieRegistry->new($sysusr)->ValueNames; --- Show quoted text
> return Win32::TieRegistry->new($sysusr, {Access=>KEY_READ})->ValueNames;
On Tue Oct 14 15:16:34 2014, bill_chatfield@yahoo.com wrote: Show quoted text
> If you have not "Run as Adiministrator", any usage of ENV_SYSTEM fails > with an undefined value. If you do "Run as Administrator", it works > fine. > > Two issues: > 1. In the case of SetEnv, it should say "Access Denied" or something > similar if it is really true that system variables cannot be set > unless you "Run as Administrator". But I don't think it is true. > 2. In the case of GetEnv or ListEnv, it should work. You should be > able to look at the system environment variables if you are not an > Administrator. > > Demonstration: > > C:\Users\bill.chatfield\Documents\bin>type Win32EnvDefect.pl > use Win32::Env; > eval {GetEnv(ENV_SYSTEM, "Path")}; warn $@ if $@; > eval {PutEnv(ENV_SYSTEM, "HOUSE", "Lannister")}; warn $@ if $@; > eval {ListEnv(ENV_SYSTEM)}; warn $@ if $@; > > C:\Users\bill.chatfield\Documents\bin>Win32EnvDefect.pl > Can't call method "GetValue" on an undefined value at > C:/strawberry/perl/site/li > b/Win32/Env.pm line 159. > Undefined subroutine &main::PutEnv called at > C:\Users\bill.chatfield\Documents\b > in\Win32EnvDefect.pl line 3. > Can't call method "ValueNames" on an undefined value at > C:/strawberry/perl/site/ > lib/Win32/Env.pm line 191. > > C:\Users\bill.chatfield\Documents\bin>perldoc -m Win32::Env > package Win32::Env; > our $VERSION='0.03'; > ----- > > C:\Users\bill.chatfield\Documents\bin>systeminfo | more > > Host Name: LOH001NU2030P2W > OS Name: Microsoft Windows 7 Professional > OS Version: 6.1.7601 Service Pack 1 Build 7601 > OS Manufacturer: Microsoft Corporation > OS Configuration: Member Workstation > OS Build Type: Multiprocessor Free > Registered Owner: Cardinal User > Registered Organization: Cardinal Health, Inc. > Product ID: 00371-868-0000007-85344 > Original Install Date: 4/19/2013, 2:17:42 PM > System Boot Time: 10/14/2014, 10:40:10 AM > System Manufacturer: Hewlett-Packard > System Model: HP EliteBook 8460p > System Type: x64-based PC > Processor(s): 1 Processor(s) Installed. > [01]: Intel64 Family 6 Model 42 Stepping 7 > GenuineInt > el ~2501 Mhz > BIOS Version: Hewlett-Packard 68SCF Ver. F.29, 1/4/2013 > Windows Directory: C:\Windows > System Directory: C:\Windows\system32 > ----- > > C:\Users\bill.chatfield\Documents\bin>perl -V > Summary of my perl5 (revision 5 version 18 subversion 2) > configuration: > > Platform: > osname=MSWin32, osvers=6.2, archname=MSWin32-x64-multi-thread > uname='Win32 strawberry-perl 5.18.2.1 #1 Tue Jan 7 22:32:35 2014 > x64' > config_args='undef' > hint=recommended, useposix=true, d_sigaction=undef > useithreads=define, usemultiplicity=define > useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef > use64bitint=define, use64bitall=undef, uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='gcc', ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE > -DPERL_TEXTMODE_ > SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fno- > strict-ali > asing -mms-bitfields', > optimize='-s -O2', > cppflags='-DWIN32' > ccversion='', gccversion='4.7.3', gccosandvers='' > intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678 > d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 > ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long > long', > lseeksize=8 > alignbytes=8, prototype=define > Linker and Libraries: > ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE" > -L"C:\strawberry\c\li > b"' > libpth=C:\strawberry\c\lib C:\strawberry\c\x86_64-w64-mingw32\lib > C:\strawbe > rry\c\lib\gcc\x86_64-w64-mingw32\4.7.3 > libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 > -ladvapi32 > -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm > -lversion > -lodbc32 -lodbccp32 -lcomctl32 > perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool > -lcomdlg32 -ladva > pi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr > -lwinmm -lver > sion -lodbc32 -lodbccp32 -lcomctl32 > libc=, so=dll, useshrplib=true, libperl=libperl518.a > gnulibc_version='' > Dynamic Linking: > dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' > cccdlflags=' ', lddlflags='-mdll -s -L"C:\strawberry\perl\lib\CORE" > -L"C:\st > rawberry\c\lib"' > > > Characteristics of this binary (from libperl): > Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY > PERLIO_LAYERS PERL_DONT_CREATE_GVSV > PERL_HASH_FUNC_ONE_AT_A_TIME_HARD > PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS > PERL_MALLOC_WRAP PERL_PRESERVE_IVUV > PERL_SAWAMPERSAND > USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES > USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE > USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF > Built under MSWin32 > Compiled at Jan 7 2014 22:40:30 > @INC: > C:/strawberry/perl/site/lib > C:/strawberry/perl/vendor/lib > C:/strawberry/perl/lib > .
Subject: Re: [rt.cpan.org #99487] ENV_SYSTEM is Undefined
Date: Thu, 11 Oct 2018 03:12:42 +0000 (UTC)
To: Ludovico Stevens via RT <bug-Win32-Env [...] rt.cpan.org>
From: Bill Chatfield <bill_chatfield [...] yahoo.com>
That's great! Nice work. On Tuesday, October 9, 2018, 4:17:06 PM EDT, Ludovico Stevens via RT <bug-Win32-Env@rt.cpan.org> wrote: <URL: https://rt.cpan.org/Ticket/Display.html?id=99487 > Hit the same problem, using GetEnv on Win32::Env 0.03 I fixed the module with the changes below. This fixes both GetEnv and ListEnv; not bothered about SetEnv. 35c35 < use Win32::TieRegistry(FixSzNulls=>1); --- Show quoted text
> use Win32::TieRegistry(FixSzNulls=>1, qw(KEY_READ));
159c159 <  my($value, $type)=Win32::TieRegistry->new($sysusr)->GetValue($var); --- Show quoted text
>  my($value, $type)=Win32::TieRegistry->new($sysusr, {Access=>KEY_READ})->GetValue($var);
191c191 <  return Win32::TieRegistry->new($sysusr)->ValueNames; --- Show quoted text
>  return Win32::TieRegistry->new($sysusr, {Access=>KEY_READ})->ValueNames;
On Tue Oct 14 15:16:34 2014, bill_chatfield@yahoo.com wrote: Show quoted text
> If you have not "Run as Adiministrator", any usage of ENV_SYSTEM fails > with an undefined value. If you do "Run as Administrator", it works > fine. > > Two issues: > 1. In the case of SetEnv, it should say "Access Denied" or something > similar if it is really true that system variables cannot be set > unless you "Run as Administrator". But I don't think it is true. > 2. In the case of GetEnv or ListEnv, it should work. You should be > able to look at the system environment variables if you are not an > Administrator. > > Demonstration: > > C:\Users\bill.chatfield\Documents\bin>type Win32EnvDefect.pl > use Win32::Env; > eval {GetEnv(ENV_SYSTEM, "Path")}; warn $@ if $@; > eval {PutEnv(ENV_SYSTEM, "HOUSE", "Lannister")}; warn $@ if $@; > eval {ListEnv(ENV_SYSTEM)}; warn $@ if $@; > > C:\Users\bill.chatfield\Documents\bin>Win32EnvDefect.pl > Can't call method "GetValue" on an undefined value at > C:/strawberry/perl/site/li > b/Win32/Env.pm line 159. > Undefined subroutine &main::PutEnv called at > C:\Users\bill.chatfield\Documents\b > in\Win32EnvDefect.pl line 3. > Can't call method "ValueNames" on an undefined value at > C:/strawberry/perl/site/ > lib/Win32/Env.pm line 191. > > C:\Users\bill.chatfield\Documents\bin>perldoc -m Win32::Env > package Win32::Env; > our $VERSION='0.03'; > ----- > > C:\Users\bill.chatfield\Documents\bin>systeminfo | more > > Host Name:                LOH001NU2030P2W > OS Name:                  Microsoft Windows 7 Professional > OS Version:                6.1.7601 Service Pack 1 Build 7601 > OS Manufacturer:          Microsoft Corporation > OS Configuration:          Member Workstation > OS Build Type:            Multiprocessor Free > Registered Owner:          Cardinal User > Registered Organization:  Cardinal Health, Inc. > Product ID:                00371-868-0000007-85344 > Original Install Date:    4/19/2013, 2:17:42 PM > System Boot Time:          10/14/2014, 10:40:10 AM > System Manufacturer:      Hewlett-Packard > System Model:              HP EliteBook 8460p > System Type:              x64-based PC > Processor(s):              1 Processor(s) Installed. >                            [01]: Intel64 Family 6 Model 42 Stepping 7 > GenuineInt > el ~2501 Mhz > BIOS Version:              Hewlett-Packard 68SCF Ver. F.29, 1/4/2013 > Windows Directory:        C:\Windows > System Directory:          C:\Windows\system32 > ----- > > C:\Users\bill.chatfield\Documents\bin>perl -V > Summary of my perl5 (revision 5 version 18 subversion 2) > configuration: > > Platform: >  osname=MSWin32, osvers=6.2, archname=MSWin32-x64-multi-thread >  uname='Win32 strawberry-perl 5.18.2.1 #1 Tue Jan  7 22:32:35 2014 > x64' >  config_args='undef' >  hint=recommended, useposix=true, d_sigaction=undef >  useithreads=define, usemultiplicity=define >  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef >  use64bitint=define, use64bitall=undef, uselongdouble=undef >  usemymalloc=n, bincompat5005=undef > Compiler: >  cc='gcc', ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE > -DPERL_TEXTMODE_ > SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fno- > strict-ali > asing -mms-bitfields', >  optimize='-s -O2', >  cppflags='-DWIN32' >  ccversion='', gccversion='4.7.3', gccosandvers='' >  intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678 >  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 >  ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long > long', > lseeksize=8 >  alignbytes=8, prototype=define > Linker and Libraries: >  ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE" > -L"C:\strawberry\c\li > b"' >  libpth=C:\strawberry\c\lib C:\strawberry\c\x86_64-w64-mingw32\lib > C:\strawbe > rry\c\lib\gcc\x86_64-w64-mingw32\4.7.3 >  libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 > -ladvapi32 > -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm > -lversion > -lodbc32 -lodbccp32 -lcomctl32 >  perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool > -lcomdlg32 -ladva > pi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr > -lwinmm -lver > sion -lodbc32 -lodbccp32 -lcomctl32 >  libc=, so=dll, useshrplib=true, libperl=libperl518.a >  gnulibc_version='' > Dynamic Linking: >  dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' >  cccdlflags=' ', lddlflags='-mdll -s -L"C:\strawberry\perl\lib\CORE" > -L"C:\st > rawberry\c\lib"' > > > Characteristics of this binary (from libperl): >  Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY >                        PERLIO_LAYERS PERL_DONT_CREATE_GVSV >                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD >                        PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS >                        PERL_MALLOC_WRAP PERL_PRESERVE_IVUV > PERL_SAWAMPERSAND >                        USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES >                        USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE >                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF >  Built under MSWin32 >  Compiled at Jan  7 2014 22:40:30 >  @INC: >    C:/strawberry/perl/site/lib >    C:/strawberry/perl/vendor/lib >    C:/strawberry/perl/lib >    .

Message body is not shown because it is too large.