Skip to content
Merged
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
3 changes: 2 additions & 1 deletion src/ManagedShell.Common/Helpers/ShellHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ public static string GetPathForWindowHandle(IntPtr hWnd)
// get path
int len = outFileName.Capacity;
QueryFullProcessImageName(hProc, 0, outFileName, ref len);
CloseHandle(hProc);
}

return outFileName.ToString();
Expand Down Expand Up @@ -403,7 +404,7 @@ public static string GetAppUserModelIdForHandle(IntPtr hWnd)
StringBuilder outAumid = new StringBuilder((int)len);

GetApplicationUserModelId(hProcess, ref len, outAumid);
CloseHandle((int)hProcess);
CloseHandle(hProcess);

if (outAumid.Length > 0)
{
Expand Down
3 changes: 3 additions & 0 deletions src/ManagedShell.Interop/NativeMethods.Kernel32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public static extern SafeFileHandle CreateFile([MarshalAs(UnmanagedType.LPTStr)]
[DllImport(Kernel32_DllName)]
public static extern Int32 CloseHandle(Int32 Handle);

[DllImport(Kernel32_DllName)]
public static extern bool CloseHandle(IntPtr Handle);

[DllImport(Kernel32_DllName, SetLastError = true, CallingConvention = CallingConvention.Winapi)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool IsWow64Process(
Expand Down
2 changes: 1 addition & 1 deletion src/ManagedShell.WindowsTray/ExplorerTrayService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private void GetTrayItems()

VirtualFreeEx(hProcess, hBuffer, 0, AllocationType.Release);

CloseHandle((int)hProcess);
CloseHandle(hProcess);
}

private IntPtr FindExplorerTrayToolbarHwnd()
Expand Down