diff options
author | hajny <hajny@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2006-07-01 20:23:23 +0000 |
---|---|---|
committer | hajny <hajny@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2006-07-01 20:23:23 +0000 |
commit | c9900ab126a329ba9118bb7d8d1635d2ce5539a3 (patch) | |
tree | c71e27e9633c14b3f4a5df85d2522b4a437960ac | |
parent | ce98e8fd9cc775d1cf2559be4e6d2ed83f91dc07 (diff) | |
download | fpc-c9900ab126a329ba9118bb7d8d1635d2ce5539a3.tar.gz |
* fix for (new) bug 7109
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@4039 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | rtl/win/dos.pp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/rtl/win/dos.pp b/rtl/win/dos.pp index 060cfd9690..4e65a6bbce 100644 --- a/rtl/win/dos.pp +++ b/rtl/win/dos.pp @@ -655,9 +655,14 @@ begin {Should return value load loaddoserror?} ret:=GetShortPathName(@buffer,@buffer,255); - if ret=0 then - p:=strpas(buffer); - GetShortName:=ret<>0; + if (Ret > 0) and (Ret <= 255) then + begin + Move (Buffer, P [1], Ret); + byte (P [0]) := Ret; + GetShortName := true; + end + else + GetShortName := false; end; { change to long filename if successful DOS call PM } @@ -680,9 +685,18 @@ begin {Should return value load loaddoserror?} ret:=GetFullPathName(@sfn,255,@lfn,filename); - if ret=0 then - p:=strpas(lfn); {lfn here returns full path, filename only fn} - GetLongName:=ret<>0; + {lfn here returns full path, filename only fn} + { If successful, Ret contains length of the long file name, + 0 is general error, return value larger than size of buffer (255) means + that the buffer size was not sufficient. } + if (Ret > 0) and (Ret <= 255) then + begin + Move (LFN, P [1], Ret); + byte (P [0]) := Ret; + GetLongName := true; + end + else + GetLongName := false; end; {****************************************************************************** |