Roffild - 2020-01-19

There seems to be no error in this function. But when installing with the "Install & for all users" checkbox, the folder is created in CSIDL_PROGRAMS instead of CSIDL_COMMON_PROGRAMS.

void GetProgramPath (HWND hwndDlg, wchar_t *path)
{
    ITEMIDLIST *i;
    HRESULT res;

    if (bForAllUsers)
        res = SHGetSpecialFolderLocation (hwndDlg, CSIDL_COMMON_PROGRAMS, &i);
    else
        res = SHGetSpecialFolderLocation (hwndDlg, CSIDL_PROGRAMS, &i);

    SHGetPathFromIDList (i, path);
}

Windows 10
I work as a regular user. "Run as administrator" is a separate account.