Skip to content

Reuse EG(windows_version_info) in php_get_uname() #17558

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

Merged
merged 1 commit into from
Feb 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions ext/standard/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,10 +659,10 @@ PHPAPI zend_string *php_get_uname(char mode)
ZEND_ASSERT(php_is_valid_uname_mode(mode));
#ifdef PHP_WIN32
char tmp_uname[256];
DWORD dwBuild=0;
DWORD dwVersion = GetVersion();
DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
OSVERSIONINFOEX osvi = EG(windows_version_info);
DWORD dwWindowsMajorVersion = osvi.dwMajorVersion;
DWORD dwWindowsMinorVersion = osvi.dwMinorVersion;
DWORD dwBuild = osvi.dwBuildNumber;
DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];

Expand All @@ -676,7 +676,6 @@ PHPAPI zend_string *php_get_uname(char mode)
php_uname = ComputerName;
} else if (mode == 'v') {
char *winver = php_get_windows_name();
dwBuild = (DWORD)(HIWORD(dwVersion));

ZEND_ASSERT(winver != NULL);

Expand All @@ -693,7 +692,6 @@ PHPAPI zend_string *php_get_uname(char mode)
ZEND_ASSERT(winver != NULL);

php_get_windows_cpu(wincpu, sizeof(wincpu));
dwBuild = (DWORD)(HIWORD(dwVersion));

/* Windows "version" 6.2 could be Windows 8/Windows Server 2012, but also Windows 8.1/Windows Server 2012 R2 */
if (dwWindowsMajorVersion == 6 && dwWindowsMinorVersion == 2) {
Expand Down
Loading