diff --git a/pGina/src/Abstractions/WindowsApi/pInvokes.cs b/pGina/src/Abstractions/WindowsApi/pInvokes.cs index 7b300812..6c4d5e4c 100644 --- a/pGina/src/Abstractions/WindowsApi/pInvokes.cs +++ b/pGina/src/Abstractions/WindowsApi/pInvokes.cs @@ -1968,7 +1968,15 @@ public static Boolean UserGet(string username, string domain, ref structenums.US int lngReturn = SafeNativeMethods.NetUserGetInfo((String.IsNullOrEmpty(domain)) ? null : domain, username, 4, out bufPtr); if (lngReturn == 0) { - userinfo4 = (structenums.USER_INFO_4)Marshal.PtrToStructure(bufPtr, typeof(structenums.USER_INFO_4)); + try + { + userinfo4 = (structenums.USER_INFO_4)Marshal.PtrToStructure(bufPtr, typeof(structenums.USER_INFO_4)); + } + catch (Exception ex) + { + LibraryLogging.Error("UserGet Marshal.PtrToStructure error:{0}", ex.ToString()); + return false; + } } else if (lngReturn == 2221) {