diff --git a/Sources/SwiftWin32/App and Environment/Device.swift b/Sources/SwiftWin32/App and Environment/Device.swift index dd3b0765..65d715ae 100644 --- a/Sources/SwiftWin32/App and Environment/Device.swift +++ b/Sources/SwiftWin32/App and Environment/Device.swift @@ -15,7 +15,7 @@ public struct Device { let value: [WCHAR] = Array(unsafeUninitializedCapacity: Int(MAX_COMPUTERNAME_LENGTH) + 1) { var nSize: DWORD = DWORD($0.count) - $1 = GetComputerNameW($0.baseAddress!, &nSize) ? Int(nSize) : 0 + $1 = GetComputerNameW($0.baseAddress!, &nSize) ? Int(nSize) + 1 : 0 } return String(decodingCString: value, as: UTF16.self) }