mirror of https://github.com/dahall/Vanara.git
Fixed bug #66 that forces all SafeMemString string representations to Empty when a size not known (like as a return value from a COM object).
parent
6aacdf6d91
commit
cca953eb5f
|
@ -37,6 +37,9 @@ namespace Vanara.InteropServices
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Prevents a default instance of the <see cref="SafeCoTaskMemString"/> class from being created.</summary>
|
||||||
|
private SafeCoTaskMemString() : base() { }
|
||||||
|
|
||||||
/// <summary>Initializes a new instance of the <see cref="SafeCoTaskMemString"/> class.</summary>
|
/// <summary>Initializes a new instance of the <see cref="SafeCoTaskMemString"/> class.</summary>
|
||||||
/// <param name="ptr">The PTR.</param>
|
/// <param name="ptr">The PTR.</param>
|
||||||
/// <param name="charSet">The character set.</param>
|
/// <param name="charSet">The character set.</param>
|
||||||
|
|
|
@ -186,6 +186,6 @@ namespace Vanara.InteropServices
|
||||||
|
|
||||||
/// <summary>Returns the string value held by this instance.</summary>
|
/// <summary>Returns the string value held by this instance.</summary>
|
||||||
/// <returns>A <see cref="System.String"/> value held by this instance or <c>null</c> if the handle is invalid.</returns>
|
/// <returns>A <see cref="System.String"/> value held by this instance or <c>null</c> if the handle is invalid.</returns>
|
||||||
public override string ToString() => IsInvalid ? null : StringHelper.GetString(handle, CharSet, Size);
|
public override string ToString() => IsInvalid ? null : StringHelper.GetString(handle, CharSet, Size == 0 ? long.MaxValue : (long)Size);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue