Have anyone experienced random problems with delphi programs using the aspi version that comes with windows 95/98? I’m having such problems… it gives me access violations on random parts of code… and for eg. if I change something on code the access violation is raised in another place of code… very odd… If I update aspi there are no problems but for eg. with programs made with C++ Builder I get no problems even with original w98 aspi…
for eg. try to compile this:
function SendASPI32Command(LPSRB : pointer) : DWORD; cdecl; external 'WNASPI32';
type SRB_GetDiskInfo = packed record
SRB_Cmd,
SRB_Status,
SRB_HaId,
SRB_Flags : BYTE;
SRB_Hdr_Rsvd : DWORD;
SRB_Target,
SRB_Lun,
SRB_DriveFlags,
SRB_Int13HDriveInfo,
SRB_Heads,
SRB_Sectors : BYTE;
SRB_Rsvd1 : array [0..9] of byte;
end;
function getdriveletter(ha, id, lun : byte) : string;
var srb : SRB_GetDiskInfo;
begin
FillChar(srb, sizeof(srb), 0);
srb.SRB_Cmd := 6; //SC_GET_DISK_INFO
srb.SRB_HaId := ha;
srb.SRB_Target := id;
srb.SRB_Lun := lun;
SendASPI32Command(@srb);
result := chr(ord('A') + (srb.SRB_Int13HDriveInfo - 1));
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
showmessage(getdriveletter(0,0,0));
end;
then try to run it in win95 or 98 with original aspi and you will get access violation…
then try to put all code in FormCreate instead of use getdriveletter function… and it works fine… very odd problem… I tried different versions of delphi and happens with all, I tried to make a similar thing with BC++ and works fine… any clue?