mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Issue #140: make auto-backup/restore feature stable against running multiple application instances:
* use unique date/time with milliseconds as ini sections * open ini file for each read + write, separately, don't keep it open all the time
This commit is contained in:
@ -346,6 +346,7 @@ type
|
||||
procedure Help(Sender: TObject; Anchor: String);
|
||||
function PortOpen(Port: Word): Boolean;
|
||||
function IsValidFilePath(FilePath: String): Boolean;
|
||||
function FileIsWritable(FilePath: String): Boolean;
|
||||
function GetProductInfo(dwOSMajorVersion, dwOSMinorVersion, dwSpMajorVersion, dwSpMinorVersion: DWORD; out pdwReturnedProductType: DWORD): BOOL stdcall; external kernel32 delayed;
|
||||
function RunningOnWindows10S: Boolean;
|
||||
function GetCurrentPackageFullName(out Len: Cardinal; Name: PWideChar): Integer; stdcall; external kernel32 delayed;
|
||||
@ -2936,6 +2937,22 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function FileIsWritable(FilePath: String): Boolean;
|
||||
var
|
||||
hFile: DWORD;
|
||||
begin
|
||||
// Check if file is writable
|
||||
if not FileExists(FilePath) then begin
|
||||
// Return true if file does not exist
|
||||
Result := True;
|
||||
end else begin
|
||||
hFile := CreateFile(PChar(FilePath), GENERIC_WRITE, 0, nil, OPEN_EXISTING, 0, 0);
|
||||
Result := hFile <> INVALID_HANDLE_VALUE;
|
||||
CloseHandle(hFile);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function RunningOnWindows10S: Boolean;
|
||||
const
|
||||
PRODUCT_CLOUD = $000000B2; //* Windows 10 S
|
||||
|
Reference in New Issue
Block a user