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
Original file line number Diff line number Diff line change
Expand Up @@ -3088,7 +3088,7 @@ public static void WriteSendAsTrustedIssuerProperty(X509Certificate2 cert, strin
}
else
{
throw Marshal.GetExceptionForHR(Security.NativeMethods.NTE_NOT_SUPPORTED);
Marshal.ThrowExceptionForHR(Security.NativeMethods.NTE_NOT_SUPPORTED);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,14 @@ internal static unsafe string GetDisplayName(IAssemblyName nameObject, ASM_DISPL

if (hr != ERROR_INSUFFICIENT_BUFFER)
{
throw Marshal.GetExceptionForHR(hr);
Marshal.ThrowExceptionForHR(hr);
}

byte[] data = new byte[(int)characterCountIncludingTerminator * 2];
fixed (byte* p = data)
{
hr = nameObject.GetDisplayName(p, ref characterCountIncludingTerminator, displayFlags);
if (hr != 0)
{
throw Marshal.GetExceptionForHR(hr);
}
Marshal.ThrowExceptionForHR(hr);

return Marshal.PtrToStringUni((IntPtr)p, (int)characterCountIncludingTerminator - 1);
}
Expand All @@ -162,17 +159,14 @@ internal static unsafe byte[] GetPropertyBytes(IAssemblyName nameObject, Propert

if (hr != ERROR_INSUFFICIENT_BUFFER)
{
throw Marshal.GetExceptionForHR(hr);
Marshal.ThrowExceptionForHR(hr);
}

byte[] data = new byte[(int)size];
fixed (byte* p = data)
{
hr = nameObject.GetProperty(propertyId, p, ref size);
if (hr != 0)
{
throw Marshal.GetExceptionForHR(hr);
}
Marshal.ThrowExceptionForHR(hr);
}

return data;
Expand Down Expand Up @@ -210,10 +204,7 @@ internal static unsafe Version GetVersion(IAssemblyName nameObject)
uint result;
uint size = sizeof(uint);
int hr = nameObject.GetProperty(propertyId, &result, ref size);
if (hr != 0)
{
throw Marshal.GetExceptionForHR(hr);
}
Marshal.ThrowExceptionForHR(hr);

if (size == 0)
{
Expand Down
3 changes: 1 addition & 2 deletions src/System.Management.Automation/security/SecuritySupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -900,8 +900,7 @@ private string AppendFilter(

if (newfilter.Contains("=") || newfilter.Contains("&"))
{
throw Marshal.GetExceptionForHR(
Security.NativeMethods.E_INVALID_DATA);
Marshal.ThrowExceptionForHR(Security.NativeMethods.E_INVALID_DATA);
}

newfilter = name + "=" + newfilter;
Expand Down