Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect WOW64 through IsWow64Process(2) #769

Merged
merged 2 commits into from
Oct 26, 2022
Merged

Conversation

BillyONeal
Copy link
Member

… rather than inspecting PROCESSOR_ARCHITEW6432.

Copy link
Contributor

@ras0219-msft ras0219-msft left a comment

Choose a reason for hiding this comment

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

❤️

@BillyONeal BillyONeal changed the title Detect WOW64 through the IsWow64Process(2) Detect WOW64 through IsWow64Process(2) Oct 25, 2022
@BillyONeal BillyONeal merged commit 0473d3b into microsoft:main Oct 26, 2022
@BillyONeal BillyONeal deleted the wow64 branch October 26, 2022 20:24
BillyONeal added a commit to BillyONeal/vcpkg-tool that referenced this pull request Dec 5, 2023
…ect that Ninja is safe to use. There, despite being on an amd64 system, this block didn't detect that things were OK:

https://github.com/microsoft/vcpkg/blob/08c4e71048eb54733d9b180a28b9b1d7ce637454/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake#L55-L61

We are unable to replicate the problem, but suspect that they may be in an environment where PROCESSOR_ARCHITECTURE isn't set properly, similar to what we experienced in microsoft#769 .

Try to fix this problem by explicitly setting it to what it should be.

Before:

```console
PS D:\vcpkg> rm env:PROCESSOR_ARCHITECTURE
Remove-Item: Cannot find path 'Env:\PROCESSOR_ARCHITECTURE' because it does not exist.
PS D:\vcpkg> rm env:PROCESSOR_ARCHITEW6432
Remove-Item: Cannot find path 'Env:\PROCESSOR_ARCHITEW6432' because it does not exist.
PS D:\vcpkg> echo "PROCESSOR_ARCHITEW6432: $env:PROCESSOR_ARCHITEW6432 PROCESSOR_ARCHITECTURE: $env:PROCESSOR_ARCHITECTURE"
PROCESSOR_ARCHITEW6432:  PROCESSOR_ARCHITECTURE:
PS D:\vcpkg> .\vcpkg.exe env
Microsoft Windows [Version 10.0.22631.2715]
(c) Microsoft Corporation. All rights reserved.

D:\vcpkg>echo PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: %PROCESSOR_ARCHITECTURE%
PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: %PROCESSOR_ARCHITECTURE%

D:\vcpkg>exit
PS D:\vcpkg> echo "PROCESSOR_ARCHITEW6432: $env:PROCESSOR_ARCHITEW6432 PROCESSOR_ARCHITECTURE: $env:PROCESSOR_ARCHITECTURE"
PROCESSOR_ARCHITEW6432:  PROCESSOR_ARCHITECTURE:
PS D:\vcpkg> .\vcpkg.exe env C:\Windows\SysWOW64\cmd.exe
Microsoft Windows [Version 10.0.22631.2715]
(c) Microsoft Corporation. All rights reserved.

D:\vcpkg>echo PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: %PROCESSOR_ARCHITECTURE%
PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: %PROCESSOR_ARCHITECTURE%
```

After:

```console
PS D:\vcpkg> rm env:PROCESSOR_ARCHITECTURE
PS D:\vcpkg> rm env:PROCESSOR_ARCHITEW6432
Remove-Item: Cannot find path 'Env:\PROCESSOR_ARCHITEW6432' because it does not exist.
PS D:\vcpkg> echo "PROCESSOR_ARCHITEW6432: $env:PROCESSOR_ARCHITEW6432 PROCESSOR_ARCHITECTURE: $env:PROCESSOR_ARCHITECTURE"
PROCESSOR_ARCHITEW6432:  PROCESSOR_ARCHITECTURE:
PS D:\vcpkg> .\vcpkg.exe env
Microsoft Windows [Version 10.0.22631.2715]
(c) Microsoft Corporation. All rights reserved.

D:\vcpkg>echo PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: %PROCESSOR_ARCHITECTURE%
PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: AMD64

D:\vcpkg>exit
PS D:\vcpkg> echo "PROCESSOR_ARCHITEW6432: $env:PROCESSOR_ARCHITEW6432 PROCESSOR_ARCHITECTURE: $env:PROCESSOR_ARCHITECTURE"
PROCESSOR_ARCHITEW6432:  PROCESSOR_ARCHITECTURE:
PS D:\vcpkg> .\vcpkg.exe env C:\Windows\SysWOW64\cmd.exe
Microsoft Windows [Version 10.0.22631.2715]
(c) Microsoft Corporation. All rights reserved.

D:\vcpkg>echo PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: %PROCESSOR_ARCHITECTURE%
PROCESSOR_ARCHITEW6432: AMD64 PROCESSOR_ARCHITECTURE: x86
```
vicroms pushed a commit that referenced this pull request Dec 11, 2023
A customer reported a problem where sometimes `vcpkg-cmake` can't detect that Ninja is safe to use. There, despite being on an amd64 system, this block didn't detect that things were OK: 

(#1297)https://github.com/microsoft/vcpkg/blob/08c4e71048eb54733d9b180a28b9b1d7ce637454/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake#L55-L61

We are unable to replicate the problem, but suspect that they may be in an environment where PROCESSOR_ARCHITECTURE isn't set properly, similar to what we experienced in #769 .

Try to fix this problem by explicitly setting it to what it should be.

Before:

```console
PS D:\vcpkg> rm env:PROCESSOR_ARCHITECTURE
Remove-Item: Cannot find path 'Env:\PROCESSOR_ARCHITECTURE' because it does not exist.
PS D:\vcpkg> rm env:PROCESSOR_ARCHITEW6432
Remove-Item: Cannot find path 'Env:\PROCESSOR_ARCHITEW6432' because it does not exist.
PS D:\vcpkg> echo "PROCESSOR_ARCHITEW6432: $env:PROCESSOR_ARCHITEW6432 PROCESSOR_ARCHITECTURE: $env:PROCESSOR_ARCHITECTURE"
PROCESSOR_ARCHITEW6432:  PROCESSOR_ARCHITECTURE:
PS D:\vcpkg> .\vcpkg.exe env
Microsoft Windows [Version 10.0.22631.2715]
(c) Microsoft Corporation. All rights reserved.

D:\vcpkg>echo PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: %PROCESSOR_ARCHITECTURE%
PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: %PROCESSOR_ARCHITECTURE%

D:\vcpkg>exit
PS D:\vcpkg> echo "PROCESSOR_ARCHITEW6432: $env:PROCESSOR_ARCHITEW6432 PROCESSOR_ARCHITECTURE: $env:PROCESSOR_ARCHITECTURE"
PROCESSOR_ARCHITEW6432:  PROCESSOR_ARCHITECTURE:
PS D:\vcpkg> .\vcpkg.exe env C:\Windows\SysWOW64\cmd.exe
Microsoft Windows [Version 10.0.22631.2715]
(c) Microsoft Corporation. All rights reserved.

D:\vcpkg>echo PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: %PROCESSOR_ARCHITECTURE%
PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: %PROCESSOR_ARCHITECTURE%
```

After:

```console
PS D:\vcpkg> rm env:PROCESSOR_ARCHITECTURE
PS D:\vcpkg> rm env:PROCESSOR_ARCHITEW6432
Remove-Item: Cannot find path 'Env:\PROCESSOR_ARCHITEW6432' because it does not exist.
PS D:\vcpkg> echo "PROCESSOR_ARCHITEW6432: $env:PROCESSOR_ARCHITEW6432 PROCESSOR_ARCHITECTURE: $env:PROCESSOR_ARCHITECTURE"
PROCESSOR_ARCHITEW6432:  PROCESSOR_ARCHITECTURE:
PS D:\vcpkg> .\vcpkg.exe env
Microsoft Windows [Version 10.0.22631.2715]
(c) Microsoft Corporation. All rights reserved.

D:\vcpkg>echo PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: %PROCESSOR_ARCHITECTURE%
PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: AMD64

D:\vcpkg>exit
PS D:\vcpkg> echo "PROCESSOR_ARCHITEW6432: $env:PROCESSOR_ARCHITEW6432 PROCESSOR_ARCHITECTURE: $env:PROCESSOR_ARCHITECTURE"
PROCESSOR_ARCHITEW6432:  PROCESSOR_ARCHITECTURE:
PS D:\vcpkg> .\vcpkg.exe env C:\Windows\SysWOW64\cmd.exe
Microsoft Windows [Version 10.0.22631.2715]
(c) Microsoft Corporation. All rights reserved.

D:\vcpkg>echo PROCESSOR_ARCHITEW6432: %PROCESSOR_ARCHITEW6432% PROCESSOR_ARCHITECTURE: %PROCESSOR_ARCHITECTURE%
PROCESSOR_ARCHITEW6432: AMD64 PROCESSOR_ARCHITECTURE: x86
```
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.

2 participants