Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,6 @@ public static extern bool SetEvent(
IntPtr hEvent
);

[DllImport("ole32.dll")]
public static extern uint CoWaitForMultipleObjects(
uint dwFlags,
uint dwMilliseconds,
ulong nHandles,
IntPtr[] pHandles,
out uint dwIndex
);

[DllImport("shell32.dll")]
public static extern IntPtr SHBrowseForFolder(
ref BROWSEINFO lpbi
Expand Down
34 changes: 2 additions & 32 deletions src/Files.App/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using System.Text;
using Windows.ApplicationModel.Activation;
using Windows.Storage;
using static Files.App.Helpers.Win32PInvoke;

namespace Files.App
{
Expand All @@ -21,9 +20,6 @@ namespace Files.App
/// </remarks>
internal sealed class Program
{
private const uint CWMO_DEFAULT = 0;
private const uint INFINITE = 0xFFFFFFFF;

public static Semaphore? Pool { get; set; }

static Program()
Expand Down Expand Up @@ -250,20 +246,7 @@ private static async void OnActivated(object? sender, AppActivationArguments arg
/// </remarks>
public static void RedirectActivationTo(AppInstance keyInstance, AppActivationArguments args)
{
IntPtr eventHandle = CreateEvent(IntPtr.Zero, true, false, null);

Task.Run(() =>
{
keyInstance.RedirectActivationToAsync(args).AsTask().Wait();
SetEvent(eventHandle);
});

_ = CoWaitForMultipleObjects(
CWMO_DEFAULT,
INFINITE,
1,
[eventHandle],
out uint handleIndex);
keyInstance.RedirectActivationToAsync(args).AsTask().Wait();
}

public static void OpenShellCommandInExplorer(string shellCommand, int pid)
Expand All @@ -273,20 +256,7 @@ public static void OpenShellCommandInExplorer(string shellCommand, int pid)

public static void OpenFileFromTile(string filePath)
{
IntPtr eventHandle = CreateEvent(IntPtr.Zero, true, false, null);

Task.Run(() =>
{
LaunchHelper.LaunchAppAsync(filePath, null, null).Wait();
SetEvent(eventHandle);
});

_ = CoWaitForMultipleObjects(
CWMO_DEFAULT,
INFINITE,
1,
[eventHandle],
out uint handleIndex);
LaunchHelper.LaunchAppAsync(filePath, null, null).Wait();
}
}
}
Loading