void CInFile::CorrectDeviceSize()
{ // maybe we must decrease kClusterSize to 1 << 12, if we want correct size at tail staticconst UInt32 kClusterSize = 1 << 14;
UInt64 pos = Size & ~(UInt64)(kClusterSize - 1);
UInt64 realNewPosition; if (!Seek(pos, realNewPosition)) return;
Byte *buf = (Byte *)MidAlloc(kClusterSize);
bool needbackward = true;
for (;;)
{
UInt32 processed = 0; // up test is slow for "PhysicalDrive". // processed size for latest block for "PhysicalDrive0" is 0. if (!Read1(buf, kClusterSize, processed)) break; if (processed == 0) break;
needbackward = false;
Size = pos + processed; if (processed != kClusterSize) break;
pos += kClusterSize;
}
if (needbackward && pos != 0)
{
pos -= kClusterSize; for (;;)
{ // break; if (!Seek(pos, realNewPosition)) break; if (!buf)
{
buf = (Byte *)MidAlloc(kClusterSize); if (!buf) break;
}
UInt32 processed = 0; // that code doesn't work for "PhysicalDrive0" if (!Read1(buf, kClusterSize, processed)) break; if (processed != 0)
{
Size = pos + processed; break;
} if (pos == 0) break;
pos -= kClusterSize;
}
}
MidFree(buf);
}
HDD \\.\PhysicalDrive0 (MBR): GetPartitionInfo == GeometryEx : corrrect size? (includes tail) Geometry : smaller than GeometryEx (no tail, maybe correct too?) MyGetDiskFreeSpace : FAIL Size correction is slow and block size (kClusterSize) must be small?
HDD partition \\.\N: (NTFS): MyGetDiskFreeSpace : Size of NTFS clusters. Same size can be calculated after correction GetPartitionInfo : size of partition data: NTFS clusters + TAIL; TAIL contains extra empty sectors and copy of first sector of NTFS Geometry / CdRomGeometry / GeometryEx : size of HDD (not that partition)
CD-ROM drive (ISO): MyGetDiskFreeSpace : correct size. Same size can be calculated after correction Geometry == CdRomGeometry : smaller than corrrect size GetPartitionInfo == GeometryEx : larger than corrrect size
Floppy \\.\a: (FAT): Geometry : correct size. CdRomGeometry / GeometryEx / GetPartitionInfo / MyGetDiskFreeSpace - FAIL correction works OK for FAT. correction works OK for non-FAT, if kClusterSize = 512.
*/
// ReadFile and WriteFile functions in Windows have BUG: // If you Read or Write 64MB or more (probably min_failure_size = 64MB - 32KB + 1) // from/to Network file, it returns ERROR_NO_SYSTEM_RESOURCES // (Insufficient system resources exist to complete the requested service).
// Probably in some version of Windows there are problems with other sizes: // for 32 MB (maybe also for 16 MB). // And message can be "Network connection was lost"
bool COutFile::SetLength(UInt64 length) throw()
{
UInt64 newPosition; if (!Seek(length, newPosition)) returnfalse; if (newPosition != length) returnfalse; return SetEndOfFile();
}
}}}
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.1Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.