Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 25c7d3f

Browse files
committed
give a nice message when installer is launched w/o admin rights (closes #16561)
1 parent 9a4fc19 commit 25c7d3f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

PC/bdist_wininst/install.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,6 +1774,16 @@ static BOOL OpenLogfile(char *dir)
17741774

17751775
sprintf(buffer, "%s\\%s-wininst.log", dir, meta_name);
17761776
logfile = fopen(buffer, "a");
1777+
if (!logfile) {
1778+
char error[1024];
1779+
1780+
sprintf(error, "Can't create \"%s\" (%s).\n\n"
1781+
"Try to execute the installer as administrator.",
1782+
buffer, strerror(errno));
1783+
MessageBox(GetFocus(), error, NULL, MB_OK | MB_ICONSTOP);
1784+
return FALSE;
1785+
}
1786+
17771787
time(&ltime);
17781788
now = localtime(&ltime);
17791789
strftime(buffer, sizeof(buffer),

0 commit comments

Comments
 (0)