gpt4 book ai didi

delphi - 如何在Delphi中阅读ISO 9660?

转载 作者:行者123 更新时间:2023-12-03 19:13:43 24 4
gpt4 key购买 nike

我目前正在研究一个项目,需要知道DVD何时刻录(DVD刻录的日期)。就我搜索和查找而言,发现所有类似ISO 9660格式的数据,但我找不到如何访问或读取它的方法,还尝试了一些相关的组件包和库,但它们都无法正常工作我期望和需要。

也找到了此链接:How to find out when a disc (DVD) has been written/burned?,但是我找不到在Delphi中使用它们的方法。
如何运作?

最佳答案

链接到此答案之后:How to find out when a disc (DVD) has been written/burned?给出从何处读取磁盘上的日期和时间信息:

读取16个字符以及从位置33582开始的一个额外字节将使DVD创建时间为:


YYYYMMDDHHMMSSCCO


其中CC是厘米,O是每15分钟间隔距GMT的偏移量,存储为8位整数(二进制补码)。

以下代码可用于读取(另请参见How to read raw block from an USB storage device with Delphi?):

function GetDVDCreationDate: String;
// Sector size is 2048 on ISO9660 optical data discs
const
sector_size = 2048;
rdPos = (33582 DIV sector_size); // 33582
rdOfs = (33582 MOD sector_size) - 1;
var
RawMBR : array [0..sector_size-1] of byte;
btsIO : DWORD;
hDevice : THandle;
i : Integer;
GMTofs : ShortInt;
begin
Result := '';
hDevice := CreateFile('\\.\E:', GENERIC_READ, // Select drive
FILE_SHARE_READ or FILE_SHARE_WRITE, nil,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if hDevice <> INVALID_HANDLE_VALUE then
begin
SetFilePointer(hDevice,sector_size * rdPos,nil,FILE_BEGIN);
ReadFile(hDevice, RawMBR[0], sector_size, btsIO, nil);
if (btsIO = sector_size) then begin
for i := 0 to 15 do begin
Result := Result + AnsiChar(RawMBR[rdOfs+i]);
end;
GMTofs := ShortInt(RawMBR[rdOfs+16]); // Handle GMT offset if important
end;
CloseHandle(hDevice);
end;
end;




请注意,从光盘读取原始数据必须从偶数扇区大小的位置开始。对于 ISO 9660磁盘,扇区大小为2048。

关于delphi - 如何在Delphi中阅读ISO 9660?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37509966/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com