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