Skip to content

Commit 649b6fb

Browse files
committed
Revert changes to WatchForGitChanges()
1 parent e3408e9 commit 649b6fb

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ public static extern bool SetPropW(
6363
IntPtr hData
6464
);
6565

66+
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
67+
public static extern IntPtr CreateEvent(
68+
IntPtr lpEventAttributes,
69+
bool bManualReset,
70+
bool bInitialState,
71+
string lpName
72+
);
73+
6674
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
6775
public static extern int GetDpiForWindow(
6876
IntPtr hwnd

src/Files.App/ViewModels/ShellViewModel.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
using System.Runtime.CompilerServices;
1515
using System.Runtime.InteropServices;
1616
using Vanara.Windows.Shell;
17-
using Windows.Win32;
1817
using Windows.Foundation;
1918
using Windows.Storage;
2019
using Windows.Storage.FileProperties;
@@ -2125,7 +2124,7 @@ private void WatchForDirectoryChanges(string path, CloudDriveSyncStatus syncStat
21252124
notifyFilters |= FILE_NOTIFY_CHANGE_ATTRIBUTES;
21262125

21272126
var overlapped = new OVERLAPPED();
2128-
overlapped.hEvent = PInvoke.CreateEvent(null, false, false, null).DangerousGetHandle();
2127+
overlapped.hEvent = CreateEvent(IntPtr.Zero, false, false, null);
21292128
const uint INFINITE = 0xFFFFFFFF;
21302129

21312130
while (x.Status != AsyncStatus.Canceled)
@@ -2236,7 +2235,7 @@ private void WatchForGitChanges()
22362235
var notifyFilters = FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_CREATION;
22372236

22382237
var overlapped = new OVERLAPPED();
2239-
overlapped.hEvent = PInvoke.CreateEvent(null, false, false, null).DangerousGetHandle();
2238+
overlapped.hEvent = CreateEvent(IntPtr.Zero, false, false, null);
22402239
const uint INFINITE = 0xFFFFFFFF;
22412240

22422241
while (x.Status != AsyncStatus.Canceled)

0 commit comments

Comments
 (0)