Skip to content

Commit

Permalink
Increased the buffer size for QueryDosDevice in ImScsiOpenScsiAdapter()
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcdos committed Jun 6, 2023
1 parent c448ce9 commit 52dcc56
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.exe
*.dll
*.dcu
*.bkm
*.drc
15 changes: 12 additions & 3 deletions Definitions.pas
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ DRIVE_LAYOUT_INFORMATION = record
PDriveLayoutInformation = ^TDriveLayoutInformation;

const
MAX_DOS_NAMES = 20000; // enough room to handle all possible block and serial devices on an average PC, sometimes it might not be enough !!!
MAX_DOS_NAMES = 125000; // enough room to handle all possible block and serial devices on an average PC, sometimes it might not be enough !!!
OBJ_CASE_INSENSITIVE = $00000040;
FILE_NON_DIRECTORY_FILE = $00000040;
FILE_SYNCHRONOUS_IO_NONALERT = $00000020;
Expand Down Expand Up @@ -381,7 +381,7 @@ procedure InitializeObjectAttributes(var InitializedAttributes: TObjectAttribute
if len = 0 then
begin
tmp:=GetLastError;
raise Exception.Create(SysErrorMessage(tmp));
raise Exception.Create('ImScsiOpenScsiAdapter:QueryDosDevice = ' + SysErrorMessage(tmp));
end;
for i:=1 to len Do
if dosDevs[i] = #0 then dosDevs[i]:= #13;
Expand All @@ -397,7 +397,16 @@ procedure InitializeObjectAttributes(var InitializedAttributes: TObjectAttribute
portNum:=StrToInt(Copy(devices[i],5,Length(devices[i])-5));
if portNum < 256 Then
Begin
if QueryDosDevice(PAnsiChar(devices[i]), PAnsiChar(target), Length(target)) = 0 then RaiseLastOSError;
if QueryDosDevice(PAnsiChar(devices[i]), PAnsiChar(target), Length(target)) = 0 then
try
RaiseLastOSError;
except
on E:Exception do
Begin
E.Message:= 'ImScsiOpenScsiAdapter:QueryDosDevice[' + IntToStr(i) + '] = ' + E.Message;
raise E;
end;
end;
if (Pos(scsiport_prefix, target) = 1) Or (Pos(storport_prefix, target) = 1) then
Begin
RtlInitUnicodeString(@devName, PWideChar(WideString(target)));
Expand Down
10 changes: 5 additions & 5 deletions RamdiskUI.dof
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ ActiveLang=
ProjectLang=
RootDir=C:\Program Files (x86)\Borland\Delphi7\Bin\
[Version Info]
IncludeVerInfo=0
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
MinorVer=1
Release=1
Build=2
Debug=0
PreRelease=0
Special=0
Expand All @@ -126,7 +126,7 @@ CodePage=1251
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
FileVersion=1.1.1.2
InternalName=
LegalCopyright=
LegalTrademarks=
Expand Down
Binary file modified RamdiskUI.res
Binary file not shown.

0 comments on commit 52dcc56

Please sign in to comment.