FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

bug in win32.winnt

 
Post new topic   Reply to topic     Forum Index -> Core32
View previous topic :: View next topic  
Author Message
Carlos



Joined: 19 Mar 2004
Posts: 396
Location: Canyon, TX

PostPosted: Thu Jul 22, 2004 6:40 pm    Post subject: bug in win32.winnt Reply with quote

The following code doesn't compile:

Code:

import win32.winnt;

void main()
{
    TOKEN_PRIVILEGES tkp;       // pointer to token structure
    tkp.Privileges.length = 1;
}


dmd reports: "core32\win32\winnt.d(31): *(#tkp + 4).length is not an lvalue".

I'm using a somewhat old version which requires -d to compile (C casts).

With the most recent version of Y Tomino's headers, I get the same but on line 24.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Sat Jul 24, 2004 7:05 pm    Post subject: Reply with quote

I've isolated the problem and I think I even understand it: You're not allowed to change the length of the array of struct LUID_AND_ATTRIBUTES. The compiler just says you can't do that.

I don't think there's anything wrong with Core32 and I think the only problem with DMD is an unclear error message. Maybe we should ask Walter for a message like this "you can't adjust the length of an element within a struct."

Code:
struct LUID_AND_ATTRIBUTES {
    int Attributes;
}

struct TOKEN_PRIVILEGES {
    int PrivilegeCount;
    LUID_AND_ATTRIBUTES Privileges[1000];
}

void main()
{
    TOKEN_PRIVILEGES tkp;       // pointer to token structure
    tkp.Privileges.length = 1;
}
(I changed things around to make the error easier to duplicate, but the concept should be the same.)
Back to top
View user's profile Send private message AIM Address
Carlos



Joined: 19 Mar 2004
Posts: 396
Location: Canyon, TX

PostPosted: Sun Jul 25, 2004 8:30 am    Post subject: Reply with quote

The thing is that the code should work: I took it from a MSDN docs example. I was manually adding to my file the declarations I needed, but I decided I could use one of those two, but both fail... I'll have to go back to manual instead of auto.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Sun Jul 25, 2004 10:06 am    Post subject: Reply with quote

Carlos wrote:
The thing is that the code should work: I took it from a MSDN docs example. I was manually adding to my file the declarations I needed, but I decided I could use one of those two, but both fail... I'll have to go back to manual instead of auto.
Well, I don't know what to tell you. Assuming Mike shows up and agrees to change Core32, what exactly would you have him change? Turn the rectangular array into a dynamic array? That sounds dangerous.

I don't know what MSDN example you're referring to, but I'd suggest that maybe you're misinterpreting it. Or maybe C++ allows squirrelly behavior here, but D doesn't. Maybe dm.D.bugs bug report is needed.
Back to top
View user's profile Send private message AIM Address
Carlos



Joined: 19 Mar 2004
Posts: 396
Location: Canyon, TX

PostPosted: Sun Jul 25, 2004 4:42 pm    Post subject: Reply with quote

Carlos wrote:
The thing is that the code should work: I took it from a MSDN docs example. I was manually adding to my file the declarations I needed, but I decided I could use one of those two, but both fail... I'll have to go back to manual instead of auto.


My mistake there: the MSDN example doesn't have the length assignment.

jcc7 wrote:
Well, I don't know what to tell you. Assuming Mike shows up and agrees to change Core32, what exactly would you have him change? Turn the rectangular array into a dynamic array? That sounds dangerous.


That wouldn't be needed: the length of the array is 1, which works great for what I needed.

jcc7 wrote:
I don't know what MSDN example you're referring to, but I'd suggest that maybe you're misinterpreting it. Or maybe C++ allows squirrelly behavior here, but D doesn't. Maybe dm.D.bugs bug report is needed.


Misinterpretation. 100?.
Bug report posted, btw.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Sun Jul 25, 2004 5:15 pm    Post subject: Reply with quote

Carlos wrote:
Misinterpretation. 100?.
Bug report posted, btw.
Yeah, I already noticed the bug report in dm.D.bugs. Hopefully, it helps out Walter.
Back to top
View user's profile Send private message AIM Address
l8night



Joined: 03 May 2004
Posts: 32
Location: UK

PostPosted: Sun May 10, 2009 10:28 am    Post subject: Reply with quote

if this is still important, post here, I'm about to get Core32 D 2.0 ready ....
so might look at this if I can, I think that you are missing the underlying C-ness of the Win32 API. and a simple wrapper class is what you need to give you the illusion of what you seem to want ....
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Core32 All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group