@@ -208,38 +208,16 @@ public Result Result(string query, IPublicAPI api)
208208
209209 private void Launch ( bool elevated = false )
210210 {
211- var info = new ProcessStartInfo
211+ if ( Main . IsAdmin && elevated )
212212 {
213- FileName = FullPath ,
214- WorkingDirectory = ParentDirectory ,
215- UseShellExecute = true ,
216- Verb = elevated ? "runas" : "" ,
217- } ;
218-
219- if ( Main . IsAdmin )
220- {
221- if ( elevated )
213+ // Since we are already elevated, we need to create UAC dialog manually
214+ if ( UACDialog . Show ( IcoPath , Name , FullPath ) != MessageBoxResult . Yes )
222215 {
223- // Since we are already elevated, we need to create UAC dialog manually
224- if ( UACDialog . Show ( IcoPath , Name , FullPath ) != MessageBoxResult . Yes )
225- {
226- return ;
227- }
228- }
229- else
230- {
231- // Use explorer.exe as workaround to start process as standard user
232- info = new ProcessStartInfo
233- {
234- FileName = "explorer.exe" ,
235- Arguments = $ "\" { FullPath } \" ",
236- WorkingDirectory = ParentDirectory ,
237- UseShellExecute = true ,
238- } ;
216+ return ;
239217 }
240218 }
241219
242- _ = Task . Run ( ( ) => Main . StartProcess ( Process . Start , info ) ) . ConfigureAwait ( false ) ;
220+ _ = Task . Run ( ( ) => Main . Context . API . StartProcess ( FullPath , ParentDirectory , "" , elevated ) ) . ConfigureAwait ( false ) ;
243221 }
244222
245223 public List < Result > ContextMenus ( IPublicAPI api )
0 commit comments