Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[rt.cpan.org #48006] Warnings from Win32::API::Struct

2 views
Skip to first unread message

Cosimo Streppone via RT

unread,
Jul 19, 2009, 10:43:12 AM7/19/09
to libw...@perl.org
Sun Jul 19 10:43:11 2009: Request 48006 was acted upon.
Transaction: Ticket created by COSIMO
Queue: Win32-API
Subject: Warnings from Win32::API::Struct
Broken in: (no value)
Severity: Normal
Owner: COSIMO
Requestors: kil...@multiplay.co.uk
Status: new
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=48006 >


loads of warnings when using the module:

return $self->{align} unless $self->{align} eq 'auto';

Should it be:

return $self->{align} unless ! defined $self->{align} || $self->
{align} eq 'auto';

But not 100% sure?

In addition there are a number of debug lines which also cause loads
of warnings:

Struct.pm:221 DEBUG "(PM)Struct::getPack: $self->{__typedef__}
(buffer) = pack($packing, @items)\n";
Struct.pm:229 DEBUG "(PM)Struct::Pack: $self->{__typedef__}(buffer)
= pack($packing, @$items)\n";

Hope this helps.

Regards
Steve

Bill Luebkert

unread,
Jul 19, 2009, 4:07:14 PM7/19/09
to bug-Wi...@rt.cpan.org, libw...@perl.org

I think there are some bugs in there too. Does sizeof work properly
in the current version ? There might be alignment issues too.
I'm using 0.50.

Here's a test case that should show the sizeof problem:

use strict;
use warnings;
use Win32::API::Struct;

typedef Win32::API::Struct PROCESSENTRY32 => qw(
DWORD dwSize;
DWORD cntUsage;
DWORD th32ProcessID;
DWORD th32DefaultHeapID;
DWORD th32ModuleID;
DWORD cntThreads;
DWORD th32ParentProcessID;
LONG pcPriClassBase;
DWORD dwFlags;
char szExeFile[260];
); # 9*4=36+260=296
my $pe32 = new Win32::API::Struct ('PROCESSENTRY32');
my $size = $pe32->sizeof;
print "size=$size should be 296\n";

__END__

This produces:
size=40 should be 296

I changed my version of Struct.pm to alleviate the symptom, but
not sure if it's the correct change (my changes on the right >):

143,147c144,148
< if(defined $align and $align > 0) {
< return scalar(@{ $self->{typedef} }) * $align;
< } else {
< return $size;
< }
---
> # if(defined $align and $align > 0) { $Bill - comment out this align test
> # return scalar(@{ $self->{typedef} }) * $align; $Bill
> # } else { $Bill
> # return $size; $Bill
> # } $Bill
189c190
< ($name, $type, my $orig) = @$member; # $Bill - just a strict issue
---
> ($name, $type, $orig) = @$member;
246c247
< ($name, $type, $orig) = @$member;
---
> ($name, $type, my $orig) = @$member; # $Bill - just a strict issue

There may be other issues.

Bill Luebkert via RT

unread,
Jul 19, 2009, 4:07:38 PM7/19/09
to libw...@perl.org
Sun Jul 19 16:07:36 2009: Request 48006 was acted upon.
Transaction: Correspondence added by dbe...@roadrunner.com
Queue: Win32-API
Subject: Re: [rt.cpan.org #48006] Warnings from Win32::API::Struct

Broken in: (no value)
Severity: Normal
Owner: COSIMO
Requestors: kil...@multiplay.co.uk
Status: new
Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=48006 >

Cosimo Streppone via RT

unread,
Jul 26, 2009, 8:29:14 AM7/26/09
to libw...@perl.org
Sun Jul 26 08:29:12 2009: Request 48006 was acted upon.
Transaction: Correspondence added by COSIMO

Queue: Win32-API
Subject: Warnings from Win32::API::Struct
Broken in: (no value)
Severity: Normal
Owner: COSIMO
Requestors: kil...@multiplay.co.uk
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=48006 >


Thanks Bill,

this is now a test case, so I can track progress.

Cosimo Streppone via RT

unread,
Aug 20, 2009, 11:07:44 AM8/20/09
to libw...@perl.org
Thu Aug 20 11:07:43 2009: Request 48006 was acted upon.

Transaction: Correspondence added by COSIMO
Queue: Win32-API
Subject: Warnings from Win32::API::Struct
Broken in: (no value)
Severity: Normal
Owner: COSIMO
Requestors: kil...@multiplay.co.uk
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=48006 >


Here's two useful articles on structs and packing. Thanks Bill for the
pointer.

Data alignment considerations
http://msdn.microsoft.com/en-us/library/aa505951(loband).aspx

Data alignment examples
http://msdn.microsoft.com/en-us/library/aa505952.aspx

Bill Luebkert via RT

unread,
Aug 20, 2009, 8:58:15 PM8/20/09
to libw...@perl.org
Thu Aug 20 20:58:14 2009: Request 48006 was acted upon.

Transaction: Correspondence added by dbe...@roadrunner.com
Queue: Win32-API
Subject: Re: [rt.cpan.org #48006] Warnings from Win32::API::Struct

Broken in: (no value)
Severity: Normal
Owner: COSIMO
Requestors: kil...@multiplay.co.uk
Status: open
Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=48006 >


Cosimo Streppone via RT wrote:
>

> Here's two useful articles on structs and packing. Thanks Bill for the
> pointer.
>
> Data alignment considerations
> http://msdn.microsoft.com/en-us/library/aa505951(loband).aspx
>
> Data alignment examples
> http://msdn.microsoft.com/en-us/library/aa505952.aspx

Wouldn't it be nice if they could just concisely state the rules
in an ordered bullet list instead of forcing you to guess and test ? :)

Cosimo Streppone via RT

unread,
Apr 1, 2010, 8:57:49 AM4/1/10
to libw...@perl.org, dbe...@roadrunner.com
<URL: https://rt.cpan.org/Ticket/Display.html?id=48006 >

This bug should be fixed in HEAD.
I'm rolling out a new release soon,
but would be nice if you guys could confirm it works for you.

http://github.com/cosimo/perl5-win32-api/

This is going to be 0.60_dev.

Cosimo Streppone via RT

unread,
Apr 1, 2010, 8:57:49 AM4/1/10
to libw...@perl.org
Thu Apr 01 08:57:47 2010: Request 48006 was acted upon.
Transaction: Correspondence added by COSIMO
Queue: Win32-API
Subject: Warnings from Win32::API::Struct
Broken in: 0.46, 0.47, 0.48, 0.49, 0.50, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59

Severity: Normal
Owner: COSIMO
Requestors: kil...@multiplay.co.uk
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=48006 >

Daniel Dragan via RT

unread,
Oct 19, 2012, 5:07:31 AM10/19/12
to libw...@perl.org, dbe...@roadrunner.com
<URL: https://rt.cpan.org/Ticket/Display.html?id=48006 >

On Thu Apr 01 08:57:47 2010, COSIMO wrote:
> This bug should be fixed in HEAD.
> I'm rolling out a new release soon,
> but would be nice if you guys could confirm it works for you.
>
> http://github.com/cosimo/perl5-win32-api/
>
> This is going to be 0.60_dev.

The process modules struct test became test file 06_rt_74578.t and does
pass right now. Is there any remaining issues in this ticket?

Daniel Dragan via RT

unread,
Oct 19, 2012, 5:07:32 AM10/19/12
to libw...@perl.org
Fri Oct 19 05:07:30 2012: Request 48006 was acted upon.
Transaction: Correspondence added by BULKDD
Queue: Win32-API
Subject: Warnings from Win32::API::Struct
Broken in: 0.46, 0.47, 0.48, 0.49, 0.50, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59
Severity: Normal
Owner: COSIMO
Requestors: kil...@multiplay.co.uk
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=48006 >

Daniel Dragan via RT

unread,
Nov 21, 2012, 2:21:38 AM11/21/12
to libw...@perl.org, dbe...@roadrunner.com
<URL: https://rt.cpan.org/Ticket/Display.html?id=48006 >

On Fri Oct 19 05:07:30 2012, BULKDD wrote:
> On Thu Apr 01 08:57:47 2010, COSIMO wrote:
> > This bug should be fixed in HEAD.
> > I'm rolling out a new release soon,
> > but would be nice if you guys could confirm it works for you.
> >
> > http://github.com/cosimo/perl5-win32-api/
> >
> > This is going to be 0.60_dev.
>
> The process modules struct test became test file 06_rt_74578.t and does
> pass right now. Is there any remaining issues in this ticket?

30 days no response, closing.

Daniel Dragan via RT

unread,
Nov 21, 2012, 2:21:39 AM11/21/12
to libw...@perl.org
Wed Nov 21 02:21:38 2012: Request 48006 was acted upon.
Transaction: Correspondence added by BULKDD
Queue: Win32-API
Subject: Warnings from Win32::API::Struct
Broken in: 0.46, 0.47, 0.48, 0.49, 0.50, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59
Severity: Normal
Owner: BULKDD
Requestors: kil...@multiplay.co.uk
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=48006 >
0 new messages