+ if(message == WM_NOTIFY && (((LPNMHDR)lParam)->code == PSN_SETACTIVE)) {
+ if(!elevated && !has_full_access) {
+ OSVERSIONINFO winverinfo;
+ memset(&winverinfo, 0, sizeof(OSVERSIONINFO));
+ winverinfo.dwOSVersionInfoSize = sizeof(winverinfo);
+ if (GetVersionEx(&winverinfo) && winverinfo.dwMajorVersion >= 5) {
+ /* we're on Vista, were asked to install for all users, but don't have
+ priviledges to do so. Ask to spawn the process elevated. */
+ char exename[MAX_PATH];
+ GetModuleFileName(NULL, exename, sizeof(exename));
+ if((int)ShellExecute(0, "runas", exename, "elevated", NULL, SW_SHOWNORMAL)>32) {
+ /* that worked- the second process will do the work */
+ exit(0);
+ }
+ }
+ }
+ }