mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Disable SSH tunnel connections on Windows 10 S, as a requirement for publishing HeidiSQL in the Windows App store, #60.
This commit is contained in:
@ -6325,3 +6325,9 @@ msgstr "Go to tab 5"
|
|||||||
|
|
||||||
msgid "Reached maximum number of result tabs (%d). To display more results, increase setting in Preferences > SQL"
|
msgid "Reached maximum number of result tabs (%d). To display more results, increase setting in Preferences > SQL"
|
||||||
msgstr "Reached maximum number of result tabs (%d). To display more results, increase setting in Preferences > SQL"
|
msgstr "Reached maximum number of result tabs (%d). To display more results, increase setting in Preferences > SQL"
|
||||||
|
|
||||||
|
msgid "Does not work on Windows 10 S"
|
||||||
|
msgstr "Does not work on Windows 10 S"
|
||||||
|
|
||||||
|
msgid "The network type defined for this session is not compatible to your Windows 10 S"
|
||||||
|
msgstr "The network type defined for this session is not compatible to your Windows 10 S"
|
||||||
|
@ -338,7 +338,8 @@ type
|
|||||||
procedure Help(Sender: TObject; Anchor: String);
|
procedure Help(Sender: TObject; Anchor: String);
|
||||||
function PortOpen(Port: Word): Boolean;
|
function PortOpen(Port: Word): Boolean;
|
||||||
function IsValidFilePath(FilePath: String): Boolean;
|
function IsValidFilePath(FilePath: String): Boolean;
|
||||||
|
function GetProductInfo(dwOSMajorVersion, dwOSMinorVersion, dwSpMajorVersion, dwSpMinorVersion: DWORD; out pdwReturnedProductType: DWORD): BOOL stdcall; external kernel32 delayed;
|
||||||
|
function RunningOnWindows10S: Boolean;
|
||||||
|
|
||||||
var
|
var
|
||||||
AppSettings: TAppSettings;
|
AppSettings: TAppSettings;
|
||||||
@ -2834,6 +2835,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function RunningOnWindows10S: Boolean;
|
||||||
|
const
|
||||||
|
PRODUCT_CLOUD = $000000B2; //* Windows 10 S
|
||||||
|
PRODUCT_CLOUDN = $000000B3; //* Windows 10 S N
|
||||||
|
PRODUCT_CORE = $00000065; //* Windows 10 Home
|
||||||
|
var
|
||||||
|
pdwReturnedProductType: DWORD;
|
||||||
|
begin
|
||||||
|
// Detect if we're running on Windows 10 S
|
||||||
|
// Taken from https://forums.embarcadero.com/message.jspa?messageID=900804
|
||||||
|
Result := False;
|
||||||
|
if GetProductInfo(10, 10, 0, 0, pdwReturnedProductType) then begin
|
||||||
|
Result := (pdwReturnedProductType = PRODUCT_CLOUD) OR (pdwReturnedProductType = PRODUCT_CLOUDN);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ Threading stuff }
|
{ Threading stuff }
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ end;
|
|||||||
|
|
||||||
procedure Tconnform.FormCreate(Sender: TObject);
|
procedure Tconnform.FormCreate(Sender: TObject);
|
||||||
var
|
var
|
||||||
LastActiveSession: String;
|
LastActiveSession, NetTypeStr: String;
|
||||||
LastSessions: TStringList;
|
LastSessions: TStringList;
|
||||||
PSess: PConnectionParameters;
|
PSess: PConnectionParameters;
|
||||||
nt: TNetType;
|
nt: TNetType;
|
||||||
@ -244,8 +244,13 @@ begin
|
|||||||
|
|
||||||
comboNetType.Clear;
|
comboNetType.Clear;
|
||||||
Params := TConnectionParameters.Create;
|
Params := TConnectionParameters.Create;
|
||||||
for nt:=Low(nt) to High(nt) do
|
for nt:=Low(nt) to High(nt) do begin
|
||||||
comboNetType.Items.Add(Params.NetTypeName(nt, True));
|
NetTypeStr := Params.NetTypeName(nt, True);
|
||||||
|
if RunningOnWindows10S and (not Params.IsCompatibleToWin10S(nt)) then begin
|
||||||
|
NetTypeStr := NetTypeStr + ' ['+_('Does not work on Windows 10 S')+']';
|
||||||
|
end;
|
||||||
|
comboNetType.Items.Add(NetTypeStr);
|
||||||
|
end;
|
||||||
Params.Free;
|
Params.Free;
|
||||||
|
|
||||||
// Init sessions tree
|
// Init sessions tree
|
||||||
|
@ -221,6 +221,7 @@ type
|
|||||||
function CreateConnection(AOwner: TComponent): TDBConnection;
|
function CreateConnection(AOwner: TComponent): TDBConnection;
|
||||||
function CreateQuery(AOwner: TComponent): TDBQuery;
|
function CreateQuery(AOwner: TComponent): TDBQuery;
|
||||||
function NetTypeName(NetType: TNetType; LongFormat: Boolean): String;
|
function NetTypeName(NetType: TNetType; LongFormat: Boolean): String;
|
||||||
|
class function IsCompatibleToWin10S(NetType: TNetType): Boolean;
|
||||||
function GetNetTypeGroup: TNetTypeGroup;
|
function GetNetTypeGroup: TNetTypeGroup;
|
||||||
function IsMySQL: Boolean;
|
function IsMySQL: Boolean;
|
||||||
function IsMSSQL: Boolean;
|
function IsMSSQL: Boolean;
|
||||||
@ -1277,6 +1278,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
class function TConnectionParameters.IsCompatibleToWin10S(NetType: TNetType): Boolean;
|
||||||
|
begin
|
||||||
|
// Using plink on 10S is not possible
|
||||||
|
Result := NetType <> ntMySQL_SSHtunnel;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TConnectionParameters.GetNetTypeGroup: TNetTypeGroup;
|
function TConnectionParameters.GetNetTypeGroup: TNetTypeGroup;
|
||||||
begin
|
begin
|
||||||
case FNetType of
|
case FNetType of
|
||||||
@ -1622,6 +1630,12 @@ var
|
|||||||
PasswordChangeDialog: TfrmPasswordChange;
|
PasswordChangeDialog: TfrmPasswordChange;
|
||||||
begin
|
begin
|
||||||
if Value and (FHandle = nil) then begin
|
if Value and (FHandle = nil) then begin
|
||||||
|
|
||||||
|
// Die if trying to run plink on Win10S
|
||||||
|
if RunningOnWindows10S and (not FParameters.IsCompatibleToWin10S(FParameters.NetType)) then begin
|
||||||
|
raise EDatabaseError.Create(_('The network type defined for this session is not compatible to your Windows 10 S'));
|
||||||
|
end;
|
||||||
|
|
||||||
DoBeforeConnect;
|
DoBeforeConnect;
|
||||||
|
|
||||||
// Get handle
|
// Get handle
|
||||||
|
Reference in New Issue
Block a user