added a non-published boolean public property 'WindowsAdminCheck' (default=true)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5668 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
597d6f9b37
commit
9571180d03
@ -127,6 +127,10 @@ msgstr ""
|
|||||||
msgid "A new version %s is available. Would you like to download it?"
|
msgid "A new version %s is available. Would you like to download it?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: ulazautoupdate.rsapplicationu
|
||||||
|
msgid "Application update"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: ulazautoupdate.rscancelledyou
|
#: ulazautoupdate.rscancelledyou
|
||||||
msgid "Cancelled. You can download and update to the new version later."
|
msgid "Cancelled. You can download and update to the new version later."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -139,6 +143,10 @@ msgstr ""
|
|||||||
msgid "Download failed. (HTTP Errorcode %d) Try again later"
|
msgid "Download failed. (HTTP Errorcode %d) Try again later"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: ulazautoupdate.rsonlywindowsu
|
||||||
|
msgid "Only Windows users whith Administrator status can update this application.%sPlease log off, then log on as an administrator (or switch users to an administrator account),%sthen try again. This restriction is for the safety and security of your Windows system.%sClick OK to continue"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: ulazautoupdate.rsthisapplicat
|
#: ulazautoupdate.rsthisapplicat
|
||||||
msgid "This application is up-to-date"
|
msgid "This application is up-to-date"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<EditorIndex Value="6"/>
|
<EditorIndex Value="6"/>
|
||||||
<CursorPos X="33" Y="27"/>
|
<CursorPos X="33" Y="27"/>
|
||||||
<UsageCount Value="46"/>
|
<UsageCount Value="47"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<TopLine Value="64"/>
|
<TopLine Value="64"/>
|
||||||
<CursorPos X="19" Y="103"/>
|
<CursorPos X="19" Y="103"/>
|
||||||
<UsageCount Value="46"/>
|
<UsageCount Value="47"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<WindowIndex Value="1"/>
|
<WindowIndex Value="1"/>
|
||||||
<TopLine Value="3"/>
|
<TopLine Value="3"/>
|
||||||
<CursorPos X="76" Y="8"/>
|
<CursorPos X="76" Y="8"/>
|
||||||
<UsageCount Value="29"/>
|
<UsageCount Value="30"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
@ -46,14 +46,13 @@
|
|||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<IsVisibleTab Value="True"/>
|
<IsVisibleTab Value="True"/>
|
||||||
<EditorIndex Value="4"/>
|
<EditorIndex Value="4"/>
|
||||||
<TopLine Value="483"/>
|
<CursorPos X="70" Y="493"/>
|
||||||
<CursorPos Y="545"/>
|
|
||||||
<ExtraEditorCount Value="2"/>
|
<ExtraEditorCount Value="2"/>
|
||||||
<ExtraEditor1>
|
<ExtraEditor1>
|
||||||
<IsVisibleTab Value="True"/>
|
<IsVisibleTab Value="True"/>
|
||||||
<WindowIndex Value="1"/>
|
<WindowIndex Value="1"/>
|
||||||
<TopLine Value="539"/>
|
<TopLine Value="555"/>
|
||||||
<CursorPos Y="548"/>
|
<CursorPos Y="564"/>
|
||||||
</ExtraEditor1>
|
</ExtraEditor1>
|
||||||
<ExtraEditor2>
|
<ExtraEditor2>
|
||||||
<EditorIndex Value="-1"/>
|
<EditorIndex Value="-1"/>
|
||||||
@ -166,123 +165,123 @@
|
|||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="..\open_ssl.pas"/>
|
<Filename Value="..\open_ssl.pas"/>
|
||||||
<Caret Line="14" TopLine="3"/>
|
<Caret Line="25"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="..\open_ssl.pas"/>
|
<Filename Value="..\open_ssl.pas"/>
|
||||||
<Caret Line="22" TopLine="3"/>
|
<Caret Line="26" Column="8" TopLine="2"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="..\open_ssl.pas"/>
|
<Filename Value="..\open_ssl.pas"/>
|
||||||
<Caret Line="20" Column="7" TopLine="7"/>
|
<Caret Line="16" TopLine="3"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="..\open_ssl.pas"/>
|
<Filename Value="..\open_ssl.pas"/>
|
||||||
<Caret Line="25"/>
|
<Caret Line="26" Column="2" TopLine="5"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="..\open_ssl.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="24"/>
|
<Caret Line="56" Column="27" TopLine="28"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="..\open_ssl.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="25"/>
|
<Caret Line="52" Column="19" TopLine="28"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="..\open_ssl.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="26" Column="8" TopLine="2"/>
|
<Caret Line="56" Column="19" TopLine="28"/>
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="..\open_ssl.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="16" TopLine="3"/>
|
<Caret Line="926" Column="38" TopLine="889"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="..\open_ssl.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="26" Column="2" TopLine="5"/>
|
<Caret Line="55" Column="27" TopLine="29"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="56" Column="27" TopLine="28"/>
|
<Caret Line="926" Column="38" TopLine="892"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="52" Column="19" TopLine="28"/>
|
<Caret Line="1083" Column="39" TopLine="1045"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="56" Column="19" TopLine="28"/>
|
<Caret Line="51" Column="22" TopLine="28"/>
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="926" Column="38" TopLine="889"/>
|
<Caret Line="52" Column="19" TopLine="28"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="55" Column="27" TopLine="29"/>
|
<Caret Line="55" Column="19" TopLine="28"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="umainform.pas"/>
|
||||||
<Caret Line="926" Column="38" TopLine="892"/>
|
<Caret Line="53" Column="103" TopLine="32"/>
|
||||||
</Position15>
|
</Position15>
|
||||||
<Position16>
|
<Position16>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="umainform.pas"/>
|
||||||
<Caret Line="1083" Column="39" TopLine="1045"/>
|
<Caret Line="82" Column="9" TopLine="47"/>
|
||||||
</Position16>
|
</Position16>
|
||||||
<Position17>
|
<Position17>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="umainform.pas"/>
|
||||||
<Caret Line="51" Column="22" TopLine="28"/>
|
<Caret Line="89" Column="30" TopLine="58"/>
|
||||||
</Position17>
|
</Position17>
|
||||||
<Position18>
|
<Position18>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="umainform.pas"/>
|
||||||
<Caret Line="52" Column="19" TopLine="28"/>
|
<Caret Line="15" Column="23"/>
|
||||||
</Position18>
|
</Position18>
|
||||||
<Position19>
|
<Position19>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="umainform.pas"/>
|
||||||
<Caret Line="55" Column="19" TopLine="28"/>
|
<Caret Line="79" Column="26" TopLine="53"/>
|
||||||
</Position19>
|
</Position19>
|
||||||
<Position20>
|
<Position20>
|
||||||
<Filename Value="umainform.pas"/>
|
<Filename Value="umainform.pas"/>
|
||||||
<Caret Line="53" Column="103" TopLine="32"/>
|
<Caret Line="157" Column="94" TopLine="115"/>
|
||||||
</Position20>
|
</Position20>
|
||||||
<Position21>
|
<Position21>
|
||||||
<Filename Value="umainform.pas"/>
|
<Filename Value="umainform.pas"/>
|
||||||
<Caret Line="82" Column="9" TopLine="47"/>
|
<Caret Line="95" TopLine="64"/>
|
||||||
</Position21>
|
</Position21>
|
||||||
<Position22>
|
<Position22>
|
||||||
<Filename Value="umainform.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="89" Column="30" TopLine="58"/>
|
<Caret Line="518" Column="16" TopLine="483"/>
|
||||||
</Position22>
|
</Position22>
|
||||||
<Position23>
|
<Position23>
|
||||||
<Filename Value="umainform.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="15" Column="23"/>
|
<Caret Line="1823" Column="4" TopLine="1796"/>
|
||||||
</Position23>
|
</Position23>
|
||||||
<Position24>
|
<Position24>
|
||||||
<Filename Value="umainform.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="79" Column="26" TopLine="53"/>
|
<Caret Line="577" Column="7" TopLine="544"/>
|
||||||
</Position24>
|
</Position24>
|
||||||
<Position25>
|
<Position25>
|
||||||
<Filename Value="umainform.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="157" Column="94" TopLine="115"/>
|
<Caret Line="539" Column="7" TopLine="516"/>
|
||||||
</Position25>
|
</Position25>
|
||||||
<Position26>
|
<Position26>
|
||||||
<Filename Value="umainform.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="95" TopLine="64"/>
|
<Caret Line="331" Column="71" TopLine="300"/>
|
||||||
</Position26>
|
</Position26>
|
||||||
<Position27>
|
<Position27>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="518" Column="16" TopLine="483"/>
|
<Caret Line="1869" TopLine="1830"/>
|
||||||
</Position27>
|
</Position27>
|
||||||
<Position28>
|
<Position28>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="1823" Column="4" TopLine="1796"/>
|
<Caret Line="228" Column="23" TopLine="199"/>
|
||||||
</Position28>
|
</Position28>
|
||||||
<Position29>
|
<Position29>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="577" Column="7" TopLine="544"/>
|
<Caret Line="331" Column="88" TopLine="309"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
<Position30>
|
<Position30>
|
||||||
<Filename Value="..\ulazautoupdate.pas"/>
|
<Filename Value="..\ulazautoupdate.pas"/>
|
||||||
<Caret Line="539" Column="7" TopLine="516"/>
|
<Caret Line="1514" TopLine="1489"/>
|
||||||
</Position30>
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectSession>
|
</ProjectSession>
|
||||||
|
@ -175,6 +175,12 @@ resourcestring
|
|||||||
rsDownloadFail = 'Download failed. (HTTP Errorcode %d) Try again later';
|
rsDownloadFail = 'Download failed. (HTTP Errorcode %d) Try again later';
|
||||||
rsCancelledYou2 = 'Cancelled. You can download the new version later.';
|
rsCancelledYou2 = 'Cancelled. You can download the new version later.';
|
||||||
rsThisApplicat = 'This application is up-to-date';
|
rsThisApplicat = 'This application is up-to-date';
|
||||||
|
rsOnlyWindowsU = 'Only Windows users whith Administrator status can update '
|
||||||
|
+'this application.%sPlease log off, then log on as an administrator (or '
|
||||||
|
+'switch users to an administrator account),%sthen try again. This '
|
||||||
|
+'restriction is for the safety and security of your Windows system.%'
|
||||||
|
+'sClick OK to continue';
|
||||||
|
rsApplicationU = 'Application update';
|
||||||
|
|
||||||
type
|
type
|
||||||
tc = class(tthread)
|
tc = class(tthread)
|
||||||
@ -225,6 +231,7 @@ type
|
|||||||
fGUIOnlineVersion: string;
|
fGUIOnlineVersion: string;
|
||||||
fShowDialogs: boolean;
|
fShowDialogs: boolean;
|
||||||
fDownloadInprogress: boolean;
|
fDownloadInprogress: boolean;
|
||||||
|
fWindowsAdminCheck:Boolean;
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
FUpdateHMProcess: TAsyncProcess;
|
FUpdateHMProcess: TAsyncProcess;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -327,6 +334,7 @@ type
|
|||||||
property FPCVersion: string read fFPCVersion;
|
property FPCVersion: string read fFPCVersion;
|
||||||
property LastCompiled: string read fLastCompiled;
|
property LastCompiled: string read fLastCompiled;
|
||||||
property TargetOS: string read fTargetOS;
|
property TargetOS: string read fTargetOS;
|
||||||
|
property WindowsAdminCheck:Boolean read fWindowsAdminCheck write fWindowsAdminCheck;
|
||||||
published
|
published
|
||||||
// Events
|
// Events
|
||||||
property OnNewVersionAvailable: TOnNewVersionAvailable
|
property OnNewVersionAvailable: TOnNewVersionAvailable
|
||||||
@ -477,6 +485,14 @@ begin
|
|||||||
ShowMessage(fApplicationVersionString);
|
ShowMessage(fApplicationVersionString);
|
||||||
end;
|
end;
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF WINDOWS}
|
||||||
|
|
||||||
|
procedure ShowAdminCheckMessage;
|
||||||
|
Var sMessage:String;
|
||||||
|
begin
|
||||||
|
sMessage:=Format(rsOnlyWindowsU, [lineending, lineending, lineending]);
|
||||||
|
MessageDlg(rsApplicationU, sMessage, mtInformation, [MBOK], 0);
|
||||||
|
end;
|
||||||
|
|
||||||
function IsWindowsAdmin: Boolean;
|
function IsWindowsAdmin: Boolean;
|
||||||
const
|
const
|
||||||
SECURITY_NT_AUTHORITY: TSIDIdentifierAuthority =
|
SECURITY_NT_AUTHORITY: TSIDIdentifierAuthority =
|
||||||
@ -638,6 +654,7 @@ begin
|
|||||||
fFPCVersion := GetCompilerInfo;
|
fFPCVersion := GetCompilerInfo;
|
||||||
fLastCompiled := GetCompiledDate;
|
fLastCompiled := GetCompiledDate;
|
||||||
fTargetOS := GetOS;
|
fTargetOS := GetOS;
|
||||||
|
fWindowsAdminCheck:=TRUE;
|
||||||
|
|
||||||
|
|
||||||
// AboutBox properties
|
// AboutBox properties
|
||||||
@ -1700,6 +1717,14 @@ var
|
|||||||
szAppDir, szParams: string;
|
szAppDir, szParams: string;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
{$IFDEF WINDOWS}
|
||||||
|
If fWindowsAdminCheck then
|
||||||
|
If NOT IsWindowsAdmin then
|
||||||
|
begin
|
||||||
|
ShowAdminCheckMessage;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
szAppDir := AppendPathDelim(ExtractFilePath(fAppFilename));
|
szAppDir := AppendPathDelim(ExtractFilePath(fAppFilename));
|
||||||
|
|
||||||
// read the VMT once
|
// read the VMT once
|
||||||
@ -1818,6 +1843,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TLazAutoUpdate.UpdateToNewVersion: boolean;
|
function TLazAutoUpdate.UpdateToNewVersion: boolean;
|
||||||
|
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF WINDOWS}
|
||||||
@ -1844,14 +1870,10 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF WINDOWS}
|
||||||
|
If fWindowsAdminCheck then
|
||||||
If NOT IsWindowsAdmin then
|
If NOT IsWindowsAdmin then
|
||||||
begin
|
begin
|
||||||
szParams:='Only Windows users whith Administrator status can update this application.' + lineending;
|
ShowAdminCheckMessage;
|
||||||
szParams+='Please log off, then log on as an administrator (or switch users to an administrator account),' + lineending;
|
|
||||||
szParams+='then try again. This restriction is for the safety and security of your Windows system.' + lineending;
|
|
||||||
szParams+='Click OK to continue';
|
|
||||||
MessageDlg('Application update',szParams,mtInformation,[MBOK],0);
|
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
Loading…
Reference in New Issue
Block a user