Skip to content

Commit

Permalink
If Setup was starting in administrative install mode it would ask Win…
Browse files Browse the repository at this point in the history
…dows to create any missing {usercf}, {userpf}, and {usersavedgames} folders. It no longer does this because it violates the used user areas warning.
  • Loading branch information
martijnlaan committed Feb 14, 2024
1 parent 8ff0021 commit 9c09134
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Projects/Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1386,21 +1386,24 @@ procedure InitMainNonSHFolderConsts;

{ Get dirs which have no CSIDL equivalent and cannot be retrieved using SHGetFolderPath. }
if Assigned(SHGetKnownFolderPathFunc) and (WindowsVersion shr 16 >= $0600) then begin
if SHGetKnownFolderPathFunc(FOLDERID_UserProgramFiles {Windows 7+}, KF_FLAG_CREATE, 0, Path) = S_OK then begin
var dwFlags: DWORD := 0;
if not IsAdminInstallMode then
dwFlags := dwFlags or KF_FLAG_CREATE;
if SHGetKnownFolderPathFunc(FOLDERID_UserProgramFiles {Windows 7+}, dwFlags, 0, Path) = S_OK then begin
try
ProgramFilesUserDir := WideCharToString(Path);
finally
CoTaskMemFree(Path);
end;
end;
if SHGetKnownFolderPathFunc(FOLDERID_UserProgramFilesCommon {Windows 7+}, KF_FLAG_CREATE, 0, Path) = S_OK then begin
if SHGetKnownFolderPathFunc(FOLDERID_UserProgramFilesCommon {Windows 7+}, dwFlags, 0, Path) = S_OK then begin
try
CommonFilesUserDir := WideCharToString(Path);
finally
CoTaskMemFree(Path);
end;
end;
if SHGetKnownFolderPathFunc(FOLDERID_SavedGames {Vista+}, KF_FLAG_CREATE, 0, Path) = S_OK then begin
if SHGetKnownFolderPathFunc(FOLDERID_SavedGames {Vista+}, dwFlags, 0, Path) = S_OK then begin
try
SavedGamesUserDir := WideCharToString(Path);
finally
Expand Down
1 change: 1 addition & 0 deletions whatsnew.htm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

<p><a name="6.2.3"></a><span class="ver">6.2.3-dev </span><span class="date">(?)</span></p>
<ul>
<li>If Setup was starting in administrative install mode it would ask Windows to create any missing <tt>{usercf}</tt>, <tt>{userpf}</tt>, and <tt>{usersavedgames}</tt> folders. It no longer does this because it violates the <a href="https://jrsoftware.org/ishelp/index.php?topic=setup_useduserareaswarning">used user areas warning</a>.</li>
<li>Added support for IIS group users identifiers (<tt>iisiusrs</tt>) for use in <tt>Permissions</tt> parameters, contributed by Achim Stuy.</li>
<li>Added official Korean translation.</li>
</ul>
Expand Down

0 comments on commit 9c09134

Please sign in to comment.