-
Notifications
You must be signed in to change notification settings - Fork 574
Win32::GetLastError fails when first called #8896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From nobull@cpan.orgThis is a bug report for perl from nobull@cpan.org, The first time Win32::GetLastError is called it always returns 2 ("The Note: Win32::GetLastError is _core_ it's not part of the Win32 module, and #!perl Flags: Site configuration information for perl v5.8.8: Configured by SYSTEM at Tue Jan 23 15:57:26 2007. Summary of my perl5 (revision 5 version 8 subversion 8) configuration: -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib Locally applied patches: @INC for perl v5.8.8: Environment for perl v5.8.8: Kits\Tools\;C:\PROGRA system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;;C:\MSSQL\BINN;C:\Program Files\Gemplus\GemSafe Libraries User\BIN;C:\PROGRA~1\Gemplus\GAC;C:\Program SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Visual Studio 8\Common7\IDE\PrivateAssemblies\;R:\bin |
From @janduboisOn Fri, 11 May 2007, Brian McCauley (via RT) wrote:
Thank you for the bug report! All the Win32::* functions have been moved This forwarding stub doesn't preserve the value of the last error, which
I disagree with the comment above: There is nothing in the documentation 87 The parameter is incorrect. But that is just a side-note; Win32::GetLastError() should of course return
Cheers, Inline Patch--- ext/Win32CORE/Win32CORE.c.orig Thu Feb 22 02:12:25 2007
+++ ext/Win32CORE/Win32CORE.c Fri May 11 16:45:27 2007
@@ -15,7 +15,9 @@
forward(pTHX_ const char *function)
{
dXSARGS;
+ DWORD err = GetLastError();
Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT, newSVpvn("Win32",5), newSVnv(0.27));
+ SetLastError(err);
SPAGAIN;
PUSHMARK(SP-items);
call_pv(function, GIMME_V);
End of Patch. |
The RT System itself - Status changed from 'new' to 'open' |
From @steve-m-hayJan Dubois wrote:
Thanks, applied as #31214 (with a test also applied as #31215). -- |
From @janduboisOn Mon, 14 May 2007, Steve Hay wrote:
I would make sure that Win32 isn't already loaded when you call Cheers, Inline Patch--- ext/Win32CORE/t/win32core.t.orig Mon May 14 09:58:14 2007
+++ ext/Win32CORE/t/win32core.t Mon May 14 15:10:10 2007
@@ -10,11 +10,17 @@
}
}
- plan tests => 2;
+ plan tests => 4;
};
use_ok( "Win32CORE" );
+# Make sure the Win32 is not yet loaded
+ok(!defined &Win32::ExpandEnvironmentStrings);
+
# [perl #42925] - Loading Win32::GetLastError() via the forwarder function
# should not affect the last error being retrieved
$^E = 42;
is(Win32::GetLastError(), 42, 'GetLastError() works on the first call');
+
+# Now all Win32::* functions should be loaded
+ok(defined &Win32::ExpandEnvironmentStrings);
End of Patch |
From @steve-m-hayJan Dubois wrote:
Thanks, applied as #31219. -- |
From @steve-m-hayNow resolved in bleadperl by changes #31214, 31215 and 31219. |
@steve-m-hay - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#42925 (status was 'resolved')
Searchable as RT42925$
The text was updated successfully, but these errors were encountered: