From bf8f3ca3a5d2b336301463aaa9950f0e3b7357aa Mon Sep 17 00:00:00 2001 From: Leilei Zhang Date: Wed, 4 Jun 2025 11:38:41 +0800 Subject: [PATCH] add logger and fix types --- .../ext/Microsoft.CmdPal.Ext.Apps/Programs/ReparsePoint.cs | 5 ++--- .../cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/UWP.cs | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/ReparsePoint.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/ReparsePoint.cs index 42883f8fe5..e10c84eea9 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/ReparsePoint.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/ReparsePoint.cs @@ -208,9 +208,8 @@ public static partial class ReparsePoint out int pBytesReturned, IntPtr lpOverlapped); - [LibraryImport("kernel32.dll", SetLastError = true, StringMarshalling = StringMarshalling.Utf8)] - [return: MarshalAs(UnmanagedType.SysInt)] - internal static partial IntPtr CreateFile( + [LibraryImport("kernel32.dll", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] + internal static partial int CreateFile( string lpFileName, FileAccessType dwDesiredAccess, FileShareType dwShareMode, diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/UWP.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/UWP.cs index 198264d7d9..15d7c079db 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/UWP.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/UWP.cs @@ -87,9 +87,10 @@ public partial class UWP return valid; }).ToList(); } - catch (Exception) + catch (Exception ex) { Apps = Array.Empty(); + Logger.LogError($"Failed to initialize UWP app info for {Name} ({FullName}): {ex.Message}"); return; } }