Aggiunto controllo di permessi di amministratore ad installazione
git-svn-id: svn://10.65.10.50/branches/R_10_00@22667 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4be3336e19
commit
20fc8e1492
@ -15,6 +15,7 @@
|
|||||||
#include "ba1500.h"
|
#include "ba1500.h"
|
||||||
#include "ba1600.h"
|
#include "ba1600.h"
|
||||||
#include "ba1700a.h"
|
#include "ba1700a.h"
|
||||||
|
#include "ba1701.h"
|
||||||
|
|
||||||
// definizioni delle colonne dello sheet
|
// definizioni delle colonne dello sheet
|
||||||
#define C_MODULE 1
|
#define C_MODULE 1
|
||||||
@ -380,6 +381,9 @@ int TInstaller_mask::precheck_modules(bool only_newer)
|
|||||||
}
|
}
|
||||||
disable(DLG_USER);
|
disable(DLG_USER);
|
||||||
check_enabled = false; //..ed uscire
|
check_enabled = false; //..ed uscire
|
||||||
|
|
||||||
|
if (!run_as_admin())
|
||||||
|
warning_box("Per installare il modulo è necessario eseguire l'applicazione come amministratore.");
|
||||||
}
|
}
|
||||||
} //if(modnumber>=0...
|
} //if(modnumber>=0...
|
||||||
} //FOR_EACH_ARRAY_ROW...
|
} //FOR_EACH_ARRAY_ROW...
|
||||||
@ -1645,6 +1649,12 @@ void TInstaller_mask::install_selection()
|
|||||||
//richiesto aggiornamento da disco del modulo SY o del modulo SR da manutenzione/installazione moduli!
|
//richiesto aggiornamento da disco del modulo SY o del modulo SR da manutenzione/installazione moduli!
|
||||||
if (modulo == "sy" || modulo == "sr")
|
if (modulo == "sy" || modulo == "sr")
|
||||||
{
|
{
|
||||||
|
if (!run_as_admin())
|
||||||
|
{
|
||||||
|
error_box("Per installare il modulo sistema è necessario eseguire l'applicazione come amministratore");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!internet)
|
if (!internet)
|
||||||
{
|
{
|
||||||
bool file_copied = false;
|
bool file_copied = false;
|
||||||
|
24
ba/ba1701.cpp
Normal file
24
ba/ba1701.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include "ba1701.h"
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
bool run_as_admin()
|
||||||
|
{
|
||||||
|
bool yes = true;
|
||||||
|
|
||||||
|
TOKEN_ELEVATION_TYPE elevationType = (TOKEN_ELEVATION_TYPE)0; // N/A for < Vista
|
||||||
|
OSVERSIONINFO VerInfo;
|
||||||
|
VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||||
|
GetVersionEx(&VerInfo);
|
||||||
|
if (VerInfo.dwMajorVersion >= 6) // If Vista or newer,
|
||||||
|
{
|
||||||
|
HANDLE hToken; // read elevation type
|
||||||
|
BOOL bOK = OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken);
|
||||||
|
DWORD infoLen;
|
||||||
|
yes = GetTokenInformation(hToken, TokenElevationType, // type of info to retrieve
|
||||||
|
&elevationType, // receives return value
|
||||||
|
sizeof(elevationType), &infoLen) != 0; // receives returned length
|
||||||
|
}
|
||||||
|
return yes;
|
||||||
|
}
|
1
ba/ba1701.h
Normal file
1
ba/ba1701.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
bool run_as_admin();
|
@ -40,13 +40,17 @@ BEGIN
|
|||||||
FLAGS "D"
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
SPREADSHEET F_SHEET 0 -3
|
SPREADSHEET F_SHEET
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 4 ""
|
PROMPT 1 4 ""
|
||||||
ITEM "Campo@16"
|
ITEM "Campo@16"
|
||||||
ITEM "Campo@16"
|
ITEM "Campo@16"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
TOOLBAR "Topbar" 0 0 0 2
|
||||||
|
|
||||||
BUTTON DLG_OK 10 2
|
BUTTON DLG_OK 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -13 -1 ""
|
PROMPT -13 -1 ""
|
||||||
@ -66,7 +70,7 @@ ENDPAGE
|
|||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
|
||||||
PAGE "Fields" -1 -1 68 6
|
PAGE "Fields" -1 -1 68 4
|
||||||
|
|
||||||
STRING F_FLD_FROM 12
|
STRING F_FLD_FROM 12
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -80,6 +84,10 @@ BEGIN
|
|||||||
FLAGS "B"
|
FLAGS "B"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
TOOLBAR "Topbar" 0 0 0 2
|
||||||
|
|
||||||
BUTTON DLG_OK 10 2
|
BUTTON DLG_OK 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -12 -1 ""
|
PROMPT -12 -1 ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user