Skip to content

Commit 03cfe51

Browse files
Merge pull request #37 from AtariDreams/patch-1
Use kernel function instead of deprecated GetVersionExA
2 parents 2e823e3 + 7770ba1 commit 03cfe51

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

cups/usersys.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,20 @@ cupsSetUserAgent(const char *user_agent)/* I - User-Agent string or `NULL` */
522522
* Gather Windows version information for the User-Agent string...
523523
*/
524524

525-
version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
526-
GetVersionExA(&version);
525+
typedef LONG NTSTATUS, *PNTSTATUS;
526+
typedef NTSTATUS(WINAPI * RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
527+
528+
RtlGetVersionPtr RtlGetVersionInternal = (RtlGetVersionPtr)GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "RtlGetVersion");
529+
if (RtlGetVersionInternal)
530+
{
531+
version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
532+
RtlGetVersionInternal((PRTL_OSVERSIONINFOW)&version);
533+
}
534+
else
535+
{
536+
ZeroMemory(&version, sizeof(version));
537+
}
538+
527539
GetNativeSystemInfo(&sysinfo);
528540

529541
switch (sysinfo.wProcessorArchitecture)

0 commit comments

Comments
 (0)