#1 Burning Software

It is currently Fri Dec 20, 2024 10:14 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Total device space
PostPosted: Mon May 01, 2006 10:37 pm 
Offline

Joined: Fri Mar 31, 2006 10:55 pm
Posts: 15
Location: U.S.A.
I noticed that when I use DiscInfo.TotalSizeInLBs to retrieve the total disc space for DVD+R, it returns 2295104, which multiplies 2048 = 405405696 or 386 MB !!! The DVD capacity should be much more than that - should be 4,483 MB. The same code reports correct size of CD, but not for DVD.

What am I doing wrong here?


Top
 Profile  
 
 Post subject: Re: Total device space
PostPosted: Tue May 02, 2006 10:31 am 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
You don't handle 64-bit integers properly. Truncation to 32-bits results truncated size. Search forum archives - this topic was already discussed here.

perryv wrote:
I noticed that when I use DiscInfo.TotalSizeInLBs to retrieve the total disc space for DVD+R, it returns 2295104, which multiplies 2048 = 405405696 or 386 MB !!! The DVD capacity should be much more than that - should be 4,483 MB. The same code reports correct size of CD, but not for DVD.

What am I doing wrong here?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 02, 2006 4:37 pm 
Offline

Joined: Fri Mar 31, 2006 10:55 pm
Posts: 15
Location: U.S.A.
Anton, please correct me if I am wrong, but DiscInfo.TotalSizeInLBs returns a uint, not a ulong. So even if I do:

ulong retValue = DiscInfo.TotalSizeInLBs;

it still returns incorrect value for DVD+R size.

Please help.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 02, 2006 4:39 pm 
Offline

Joined: Fri Mar 31, 2006 10:55 pm
Posts: 15
Location: U.S.A.
I checked in the new Joliet OCX sample, the value of returned Free LBs is integer type (32-bit) and is not the true size of the DVD disc.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 02, 2006 7:16 pm 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
It's true size of the disc in the logical blocks (sectors). If you need size in bytes - multiply the value in logical blocks to 2048 (cooked sector size). At this point you you get overflow. So use __int64 instead of ulong in your code.

perryv wrote:
I checked in the new Joliet OCX sample, the value of returned Free LBs is integer type (32-bit) and is not the true size of the DVD disc.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 02, 2006 7:46 pm 
Offline

Joined: Fri Mar 31, 2006 10:55 pm
Posts: 15
Location: U.S.A.
I got it to work now... Thanks Anton


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 02, 2006 7:52 pm 
Offline
Site Admin

Joined: Fri Jun 18, 2004 12:03 am
Posts: 4089
Location: British Virgin Islands
Good :)

perryv wrote:
I got it to work now... Thanks Anton


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 17 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group