Skip to content

Commit 570b239

Browse files
author
dahall
committed
Fixed Clipboard.AnsiToUnicode after changes to MultibyteToWideChar function
1 parent 4420a18 commit 570b239

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

PInvoke/Shell32/Clipboard.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ public enum FD_FLAGS : uint
8888
/// <summary>Converts an ANSI string to Unicode.</summary>
8989
/// <param name="value">The ANSI string value.</param>
9090
/// <returns>The Unicode string value.</returns>
91-
public static string AnsiToUnicode(string value)
91+
public static string? AnsiToUnicode(byte[]? value)
9292
{
93-
if (string.IsNullOrEmpty(value)) return value;
94-
var sz = MultiByteToWideChar(0, 0, value, value.Length);
93+
if (value is null) return null;
94+
var sz = MultiByteToWideChar(0, 0, value, value.Length, default(byte[]), 0);
9595
var ret = new byte[sz];
9696
MultiByteToWideChar(0, 0, value, value.Length, ret, sz);
9797
return Encoding.Unicode.GetString(ret);

0 commit comments

Comments
 (0)