Skip to content

Commit 9b99a45

Browse files
committed
GetUserNameExW returns 0 on error, non-zero on success
I know Microsoft is not consistent on this, but yes.
1 parent 19e3979 commit 9b99a45

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/FoundationEssentials/ProcessInfo/ProcessInfo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ final class _ProcessInfo: Sendable {
229229
_ = GetUserNameExW(NameDisplay, nil, &ulLength)
230230

231231
return withUnsafeTemporaryAllocation(of: WCHAR.self, capacity: Int(ulLength)) { wszBuffer in
232-
guard GetUserNameExW(NameDisplay, wszBuffer.baseAddress!, &ulLength) == 0 else {
232+
guard GetUserNameExW(NameDisplay, wszBuffer.baseAddress!, &ulLength) != 0 else {
233233
return ""
234234
}
235235
return String(decoding: wszBuffer.prefix(Int(ulLength)), as: UTF16.self)

0 commit comments

Comments
 (0)