Skip to content

Commit 71b9e0c

Browse files
committed
Init
1 parent 6bcec6d commit 71b9e0c

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

src/Files.App.CsWin32/NativeMethods.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,4 @@ SetCurrentProcessExplicitAppUserModelID
222222
GdipCreateBitmapFromScan0
223223
BITMAP
224224
GetObject
225+
CancelIoEx

src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,6 @@ public static extern bool GetOverlappedResult(
115115
bool bWait
116116
);
117117

118-
[DllImport("api-ms-win-core-io-l1-1-1.dll")]
119-
public static extern bool CancelIo(
120-
IntPtr hFile
121-
);
122-
123-
[DllImport("api-ms-win-core-io-l1-1-1.dll")]
124-
public static extern bool CancelIoEx(
125-
IntPtr hFile,
126-
IntPtr lpOverlapped
127-
);
128-
129118
[DllImport("api-ms-win-core-synch-l1-2-0.dll")]
130119
public static extern uint WaitForMultipleObjectsEx(
131120
uint nCount,

src/Files.App/ViewModels/ShellViewModel.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
using System.Runtime.CompilerServices;
1515
using System.Runtime.InteropServices;
1616
using Vanara.Windows.Shell;
17+
using Windows.Win32;
18+
using Windows.Win32.Foundation;
1719
using Windows.Foundation;
1820
using Windows.Storage;
1921
using Windows.Storage.FileProperties;
@@ -2101,7 +2103,7 @@ await dispatcherQueue.EnqueueOrInvokeAsync(() =>
21012103
});
21022104
}
21032105

2104-
private void WatchForDirectoryChanges(string path, CloudDriveSyncStatus syncStatus)
2106+
private unsafe void WatchForDirectoryChanges(string path, CloudDriveSyncStatus syncStatus)
21052107
{
21062108
Debug.WriteLine($"WatchForDirectoryChanges: {path}");
21072109
var hWatchDir = Win32PInvoke.CreateFileFromApp(path, 1, 1 | 2 | 4,
@@ -2206,12 +2208,12 @@ private void WatchForDirectoryChanges(string path, CloudDriveSyncStatus syncStat
22062208
Debug.WriteLine("watcher canceled");
22072209
}
22082210

2209-
CancelIoEx(hWatchDir, IntPtr.Zero);
2210-
CloseHandle(hWatchDir);
2211+
PInvoke.CancelIoEx((HANDLE)hWatchDir);
2212+
PInvoke.CloseHandle((HANDLE)hWatchDir);
22112213
});
22122214
}
22132215

2214-
private void WatchForGitChanges()
2216+
private unsafe void WatchForGitChanges()
22152217
{
22162218
var hWatchDir = Win32PInvoke.CreateFileFromApp(
22172219
GitDirectory!,
@@ -2294,7 +2296,7 @@ private void WatchForGitChanges()
22942296
gitWatcherAction = null;
22952297
}
22962298

2297-
CancelIoEx(hWatchDir, IntPtr.Zero);
2299+
PInvoke.CancelIoEx((HANDLE)hWatchDir);
22982300
CloseHandle(hWatchDir);
22992301
});
23002302
}

0 commit comments

Comments
 (0)