mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 01:49:25 +02:00
LCL: changed INVALID_HANDLE_VALUE from 0 to LCLType.Handle(-1), -1 is the Windows value
git-svn-id: trunk@41517 -
This commit is contained in:
parent
2eaea5eb94
commit
822ca4c2e1
@ -380,7 +380,7 @@ var
|
||||
FindData: TWin32FindDataW;
|
||||
begin
|
||||
Hnd := FindFirstFileW(PWideChar(UTF8ToUTF16(FileName)), FindData);
|
||||
if Hnd <> INVALID_HANDLE_VALUE then
|
||||
if Hnd <> Windows.INVALID_HANDLE_VALUE then
|
||||
begin
|
||||
Windows.FindClose(Hnd);
|
||||
if (FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = 0 then
|
||||
@ -534,7 +534,7 @@ begin
|
||||
{ $1e = faHidden or faSysFile or faVolumeID or faDirectory }
|
||||
{ FindFirstFile is a Win32 Call }
|
||||
Rslt.FindHandle:=Windows.FindFirstFileW( PWideChar(UTF8Decode(Path)),find);
|
||||
If Rslt.FindHandle=Invalid_Handle_value then
|
||||
If Rslt.FindHandle=Windows.Invalid_Handle_value then
|
||||
begin
|
||||
Result:=GetLastError;
|
||||
Exit;
|
||||
|
@ -55,6 +55,9 @@ uses
|
||||
IpUtils,
|
||||
IpConst;
|
||||
|
||||
const
|
||||
IpFileOpenFailed = -1;
|
||||
|
||||
{ TIpMemMapStream }
|
||||
type
|
||||
TIpMemMapStream = class(TStream)
|
||||
@ -1580,12 +1583,12 @@ end;
|
||||
|
||||
constructor TIpDownloadFileStream.Create(const aPath : string);
|
||||
begin
|
||||
FHandle := INVALID_HANDLE_VALUE;
|
||||
FHandle := IpFileOpenFailed;
|
||||
inherited Create;
|
||||
dfsMakeTempFile(aPath);
|
||||
|
||||
FHandle := THandle(FileOpen(FFileName, fmShareDenyNone + fmOpenReadWrite));
|
||||
if (Handle = INVALID_HANDLE_VALUE) then
|
||||
if (Handle = IpFileOpenFailed) then
|
||||
{$IFDEF Version6OrHigher}
|
||||
RaiseLastOSError;
|
||||
{$ELSE}
|
||||
@ -1651,7 +1654,7 @@ begin
|
||||
{$IFNDEF IP_LAZARUS}
|
||||
CloseHandle(Handle);
|
||||
{$ENDIF}
|
||||
FHandle := INVALID_HANDLE_VALUE;
|
||||
FHandle := IpFileOpenFailed;
|
||||
{calculate the full new name}
|
||||
NewFullName := FPath + '\' + aNewName;
|
||||
{rename the file}
|
||||
@ -1671,7 +1674,7 @@ begin
|
||||
{ do nothing }
|
||||
end;
|
||||
|
||||
if (Handle = INVALID_HANDLE_VALUE) then
|
||||
if (Handle = IpFileOpenFailed) then
|
||||
{$IFDEF Version6OrHigher}
|
||||
RaiseLastOSError;
|
||||
{$ELSE}
|
||||
@ -1690,7 +1693,7 @@ begin
|
||||
{$IFNDEF IP_LAZARUS}
|
||||
CloseHandle(Handle);
|
||||
{$ENDIF}
|
||||
FHandle := INVALID_HANDLE_VALUE;
|
||||
FHandle := IpFileOpenFailed;
|
||||
{copy the file} {!!.01}
|
||||
{$IFDEF Version6OrHigher}
|
||||
{$IFNDEF IP_LAZARUS}
|
||||
@ -1710,7 +1713,7 @@ begin
|
||||
{ do nothing }
|
||||
end;
|
||||
|
||||
if (Handle = INVALID_HANDLE_VALUE) then
|
||||
if (Handle = IpFileOpenFailed) then
|
||||
{$IFDEF Version6OrHigher}
|
||||
RaiseLastOSError;
|
||||
{$ELSE}
|
||||
|
@ -152,7 +152,7 @@ type
|
||||
PHKEY = ^HKEY;
|
||||
|
||||
const
|
||||
INVALID_HANDLE_VALUE = 0;
|
||||
INVALID_HANDLE_VALUE = HANDLE(-1); // prior to 1.1 it was 0, see for example FileOpen
|
||||
|
||||
MAXBYTE = Byte($FF);
|
||||
MAXWORD = Word($FFFF);
|
||||
|
Loading…
Reference in New Issue
Block a user