Skip to content

GetUserNameExW returns 0 on error, non-zero on success#1642

Open
SiliconA-Z wants to merge 1 commit intoswiftlang:mainfrom
SiliconA-Z:guard-wrong
Open

GetUserNameExW returns 0 on error, non-zero on success#1642
SiliconA-Z wants to merge 1 commit intoswiftlang:mainfrom
SiliconA-Z:guard-wrong

Conversation

@SiliconA-Z
Copy link
Copy Markdown
Contributor

I know Microsoft is not consistent on this, but GetUserNameExW returns 0 on error.

@SiliconA-Z SiliconA-Z force-pushed the guard-wrong branch 2 times, most recently from 9b99a45 to 274e0ca Compare December 16, 2025 23:40
I know Microsoft is not consistent on this, but yes.
}

#if os(macOS)
#if canImport(Darwin) || os(Windows)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like when adding the Windows conditional here you also changed the macOS conditional to canImport(Darwin) - was there a reason for that? This will fail to build on platforms like iOS because ProcessInfo.userName is unavailable on those platforms

Copy link
Copy Markdown
Contributor

@itingliu itingliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately we don't have an IOS CI, but I agree with Jeremy that the test won't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants