diff --git a/PInvoke/Kernel32/IoApiSet.Threading.cs b/PInvoke/Kernel32/IoApiSet.Threading.cs index c654e4ed..530b84b2 100644 --- a/PInvoke/Kernel32/IoApiSet.Threading.cs +++ b/PInvoke/Kernel32/IoApiSet.Threading.cs @@ -54,10 +54,11 @@ namespace Vanara.PInvoke /// /// /// - public static Task DeviceIoControlAsync(HFILE hDev, uint ioControlCode, byte[] inputBuffer, byte[] outputBuffer) + public static async Task DeviceIoControlAsync(HFILE hDev, uint ioControlCode, byte[] inputBuffer, byte[] outputBuffer) { var buf = Pack(inputBuffer, outputBuffer); - return Task.Factory.FromAsync(BeginDeviceIoControl, EndDeviceIoControl, hDev, ioControlCode, buf, null); + var outputBytes = await Task.Factory.FromAsync(BeginDeviceIoControl, EndDeviceIoControl, hDev, ioControlCode, buf, null); + outputBytes.CopyTo(outputBuffer, 0); } ///