RE: retrieving the cluster size on xp
"Carsten Orthbandt" <[email protected]>
| Newsgroups | gmane.games.devel.windows |
|---|---|
| Message-ID | <[email protected]> |
Your assumption about every FS using clusters is just plain wrong. I never had real problems with GetDiskFreeSpaceEx(). It may prove to be imprecise on 9x, but I've never seen it fail. If you're dealing with those values, be prepared to handle 1-sector clusters. Because there's such stuff as virtual filesystems. I think you're confusing clusters and sectors. And even sectors do not have to be bigger than 1 byte. There are plenty of schemes that handle allocations on 1-byte boundaries pretty well. And most filesystems do _not_ use linked lists of sectors. If you dig through some of the very fine literature on filesystem design, you'll see that the whole concept of clusters is arbitrary and a clear sign of a design that doesn't fit the amount of data it is trying to handle. Best regards, Carsten Orthbandt Founder + Development Director SEK SpieleEntwicklungsKombinat GmbH http://www.sek-ost.de Wenn ich Visionen habe, gehe ich zum Arzt. - Helmut Schmidt > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On > Behalf Of tweety > Sent: Monday, March 15, 2004 4:28 AM > To: [email protected] > Subject: RE: [GD-Windows] retrieving the cluster size on xp > > > EVERY filesystem is divided in clusters, even CDFS/UDF and linux' > filesystems (reiserfs and... Whatever the normal one is > called, I forgot :) > ), even if they're as small as 1 byte (I personally never > heard of one). > That's because, when adding new parts to a file surrounded by > 2 other files, > you need a way to tell the os where to look for the next part, and you > really can't add a LONGLONG (int64) after every byte... Even > a rle-based > approach would be slow when updating. So they just stuff a > "next pointer" > for each cluster (since most fss store the next pointer at > the beginning, > the macimum number of files/folders/objects etc is limited). > I know deviceiocontrol works differently on w200x/xp, but I > haven't been > able to find out anything but bytes/sector, and I still need > sectors/cluster > or something. > So, now tell me why is it so wrong to expect a function that > receives a path > within the system (on windows it could be an itemidlist) (the path is > required because of the mounting points in wnt+ and linux > etc) and retrieve > the cluster size of that folder (or return false when it > cannot)? I'm not > talking about an os-independent function, I'm talking about a > wrapper of the > different methods to get the cluster size (that's now; if > they would have > thaught of that sooner, they could have written a propper > getclusersize from > the beginning). > > About the null pointer: the first write of a function as > esoteric as my > w9x-compatible getclustersize that uses vxds and > deviceiocontrol really > isn't that centered at handling internally errors, I just > step through it > with the debugger. And I just used the disk in "readonly" > mode, I love my > hard disk too :)) > > ---------------------------------- > Peace and love, > Tweety > [email protected] - [email protected] > YahooID: tweety_04_01 > > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of > Carsten Orthbandt > Sent: March 14, 2004 6:43 PM > To: [email protected] > Subject: RE: [GD-Windows] retrieving the cluster size on xp > > Erm... Show me _one_ *.vxd on a NT based OS. There ain't none. > DeviceIoControl is _documented_ to be different on NT and 9x. > If you rely on specific behaviour for portable code, you're > doomed. OTOH, > given the wide variety of filesystems on Win32 systems, why > do you expect to > find something like a cluster size at all? Why should it matter? > You either write portable application code and shouldn't have > to resort to > native OS constants. Or you write OS specific code and then > you'll have to > face the differences. And you better know about them. > 9x and NT/2K/XP _are_ different platforms. System information > easily tells > you that. Having nearly the same API on both of them is a > mere convenience, > not a guarantee. > > And: Your code crashes because CreateFile() returned NULL??? > You'd better learn proper error handling before messing with > my hard disk... > > Carsten Orthbandt > Founder + Development Director > SEK SpieleEntwicklungsKombinat GmbH > http://www.sek-ost.de > > Wenn ich Visionen habe, gehe ich zum Arzt. - Helmut Schmidt > > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]] > On Behalf Of > > tweety > > Sent: Sunday, March 14, 2004 10:37 PM > > To: [email protected] > > Subject: RE: [GD-Windows] retrieving the cluster size on xp > > > > > > I didn't explain myself properly... I wrote some > deviceiocontrol code > > for wme/w98 and it craches because createfile on vmm32.vxd (or > > whatever) returns null. > > Getdiskfreespace works properly on my machine (then again, > I have 32k > > and 4k clusters...). Still, there should be a function that > works on > > ALL windowses and that returns the cluster size. > > > > ---------------------------------- > > Peace and love, > > Tweety > > [email protected] - [email protected] > > YahooID: tweety_04_01 > > > > > > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]] > On Behalf Of > > Carsten Orthbandt > > Sent: March 14, 2004 3:58 AM > > To: [email protected] > > Subject: RE: [GD-Windows] retrieving the cluster size on xp > > > > I'd bet some money on your source being the reason for > crashing. The > > GetDiskFreeSpace API works fine for me on all flavours of Win32. I > > don't think you'll crash XP calling this function, it's your app. > > Generally, Win9x is much more forgiving when it comes to invalid > > memory accesses than the WinNT siblings. Wich is actually a good > > thing. > > > > Carsten Orthbandt > > Founder + Development Director > > SEK SpieleEntwicklungsKombinat GmbH > > http://www.sek-ost.de > > > > Wenn ich Visionen habe, gehe ich zum Arzt. - Helmut Schmidt > > > > > > > -----Original Message----- > > > From: [email protected] > > > [mailto:[email protected]] > > On Behalf Of > > > tweety > > > Sent: Sunday, March 14, 2004 5:02 AM > > > To: [email protected] > > > Subject: RE: [GD-Windows] retrieving the cluster size on xp > > > > > > > > > Ok, I'll try it. Thanks. By the way, I did it in w98/me a > long time > > > ago, it just crashes on xp... :) You know, I find really sad that > > > there's a function in *foxpro* to find the cluster size of > > a drive and > > > there's not ONE thing in the whole windows 32 api to return the > > > cluster size reliably in all operating systems... Maybe > longhorn?... > > > > > > ---------------------------------- > > > Peace and love, > > > Tweety > > > [email protected] - [email protected] > > > YahooID: tweety_04_01 > > > > > > > > > > > > -----Original Message----- > > > From: [email protected] > > > [mailto:[email protected]] > > On Behalf Of > > > Simon O'Connor > > > Sent: March 13, 2004 5:06 PM > > > To: [email protected] > > > Subject: RE: [GD-Windows] retrieving the cluster size on xp > > > > > > > > > Hi Tweety, > > > > > > > > > GetDiskFreeSpace() is supported on Windows XP, Windows > 2000, Windows > > > NT, Windows Me, Windows 98, Windows 95, and Windows Server 2003... > > > > > > My comments about 9x were just addressing your preference for a > > > portable method. > > > > > > > > > Cheers, > > > > > > Simon O'Connor > > > Programmer @ Acclaim > > > & Microsoft DirectX MVP > > > > > > > -----Original Message----- > > > > From: [email protected] > > > > [mailto:[email protected]] > > > On Behalf Of > > > > tweety > > > > Sent: 13 March 2004 21:55 > > > > To: [email protected] > > > > Subject: RE: [GD-Windows] retrieving the cluster size on xp > > > > > > > > I specified in the subject that I'm interested in > finding out the > > > > cluster size (it's not a hint, but not partitionmagic, I'm > > > just trying > > > > to find out the waste of space on my drive) on *xp*, not > > 9x/me. And > > > > I'd really, REALLY, REEEALY preffer not to go to the ddk... > > > > > > > > ---------------------------------- > > > > Peace and love, > > > > Tweety > > > > [email protected] - [email protected] > > > > YahooID: tweety_04_01 > > > > > > > > > > > > > > > > -----Original Message----- > > > > From: [email protected] > > > > [mailto:[email protected]] > > > On Behalf Of > > > > Simon O'Connor > > > > Sent: March 13, 2004 4:42 PM > > > > To: [email protected] > > > > Subject: RE: [GD-Windows] retrieving the cluster size on xp > > > > > > > > > > > > Hi Tweety, > > > > > > > > > > > > You can use GetDiskFreeSpace() to find the number of > sectors per > > > > cluster and the number of bytes per sector so simply > > > multiply them to > > > > find the size of a cluster. > > > > > > > > > > > > The docs for GetDiskFreeSpace() do mention that the > > returned sectors > > > > per cluster value can be inaccurate under Windows 9x/ME > > for drives > > > > with more than 64 sectors per cluster (the 80Gb drive in > > > this machine > > > > only has 8 per cluster so it might be a fairly unusual case). > > > > > > > > This is probably only an issue for you if your > > application needs to > > > > use this for something more than a "hint" (e.g. if > you're writing > > > > something like PartitionMagic etc). If you do need the totally > > > > accurate value, you could obtain the DDK and take a look at the > > > > Win9x/Me specific FS_GetDiskInfo() function. > > > > > > > > > > > > Cheers, > > > > > > > > Simon O'Connor > > > > Programmer @ Acclaim > > > > & Microsoft DirectX MVP > > > > > > > > > > > > ________________________________ > > > > > > > > From: [email protected] > > > > [mailto:[email protected]] > > > On Behalf Of > > > > tweety > > > > Sent: 11 March 2004 23:39 > > > > To: [email protected] > > > > Subject: [GD-Windows] retrieving the cluster size on xp > > > > > > > > > > > > Can someone please tell me how to get the cluster > > > allocation size in > > > > > > > windowsxp? of course, a portable way is the best, but just > > > 2000/xp is > > > > fine. > > > > i searched the internet far and wide and all i could find > > is how to > > > > find it on fat16/12 partitions and on w95/98/xp. i looked at > > > > deviceiocontrol's functions, but none seems to return the > > > cluster size > > > > or something that i could use... can you tell me? > > > > > > > > ---------------------------------- > > > > Peace and love, > > > > Tweety > > > > [email protected] - [email protected] > > > > YahooID: tweety_04_01 > > > > > > > > > > > > > > > > --- > > > > Incoming mail is certified Virus Free. > > > > Checked by AVG anti-virus system > (http://www.grisoft.com). > > > > Version: 6.0.596 / Virus Database: 379 - Release Date: > > 26/02/2004 > > > > > > > > > > > > > > > > --- > > > > Outgoing mail is certified Virus Free. > > > > Checked by AVG anti-virus system (http://www.grisoft.com). > > > > Version: 6.0.596 / Virus Database: 379 - Release Date: > 26/02/2004 > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux > > > > tutorial presented by Daniel Robbins, President and CEO > of GenToo > > > > technologies. Learn everything from fundamentals to system > > > > > > > > > > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > > > > _______________________________________________ > > > > Gamedevlists-windows mailing list > > > > [email protected] > > > > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux > > > > tutorial presented by Daniel Robbins, President and CEO > of GenToo > > > > technologies. Learn everything from fundamentals to system > > > > > > > > > > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > > > > _______________________________________________ > > > > Gamedevlists-windows mailing list > > > > [email protected] > > > > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > > > > > > > > --- > > > > Incoming mail is certified Virus Free. > > > > Checked by AVG anti-virus system (http://www.grisoft.com). > > > > Version: 6.0.596 / Virus Database: 379 - Release Date: > 26/02/2004 > > > > > > > > > > > > > > --- > > > Outgoing mail is certified Virus Free. > > > Checked by AVG anti-virus system (http://www.grisoft.com). > > > Version: 6.0.596 / Virus Database: 379 - Release Date: 26/02/2004 > > > > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux > > > tutorial presented by Daniel Robbins, President and CEO of GenToo > > > technologies. Learn everything from fundamentals to system > > > > > > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > > > _______________________________________________ > > > Gamedevlists-windows mailing list > > > [email protected] > > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux > > > tutorial presented by Daniel Robbins, President and CEO of GenToo > > > technologies. Learn everything from fundamentals to system > > > > > > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > > > _______________________________________________ > > > Gamedevlists-windows mailing list > > > [email protected] > > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux > > tutorial presented by Daniel Robbins, President and CEO of GenToo > > technologies. Learn everything from fundamentals to system > > administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=ick > > _______________________________________________ > > Gamedevlists-windows mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux > > tutorial presented by Daniel Robbins, President and CEO of GenToo > > technologies. Learn everything from fundamentals to system > > administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=ick > > _______________________________________________ > > Gamedevlists-windows mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials Free > Linux tutorial > presented by Daniel Robbins, President and CEO of GenToo > technologies. Learn > everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=ick > _______________________________________________ > Gamedevlists-windows mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=ick > _______________________________________________ > Gamedevlists-windows mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU5 > ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click _______________________________________________ Gamedevlists-windows mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU5