Из MSDN
От: silentdash  
Дата: 14.01.03 16:12
Оценка:
Не знаю в какой стадии алкогольного опьянения это писалось




The Windows 2000 API includes the function VerifyVersionInfo, this function compares a set of operating system version requirements to the corresponding values for the currently running version of the system. When a new version of the operating system is released, your application will still install and run on it. There are actually many more options and ways to use VerifyVersionInfo, but to check if the operating system is new enough you could call using the three flags below, and check the major version, the minor version, and the service pack. You would be saying "My application needs Windows NT® version 4.0, with SP 2, or greater" and then ask VerifyVersionInfo "Is this OS that I'm running on up to that standard?" It would return either a true or a false.

Below is an example of these flags:

VerifyVersionInfo(&osvi,
VER_MAJORVERSION |
VER_MINORVERSION |
VER_SERVICEPACKMAJOR,
dwlConditionMask);

VerifyVersionInfo, is only available on Windows 2000 and later versions of the platform.

Ищите в Technical Articles \ Windows Platform \ Windows 2000 \ самый первый топик
PS это до-дотнетовский MSDN


14.01.03 22:43: Перенесено из 'Коллеги, улыбнитесь'
Re: Из MSDN
От: Admiral Украина  
Дата: 14.01.03 17:08
Оценка:
Здравствуйте, silentdash, Вы писали:

S>Не знаю в какой стадии алкогольного опьянения это писалось

S>...

А что не так в той статье и в цитате, в частности?
Re[2]: Из MSDN
От: Flamer Кипр http://users.livejournal.com/_flamer_/
Дата: 14.01.03 17:50
Оценка:
Здравствуйте, Admiral, Вы писали:

[]

A>А что не так в той статье и в цитате, в частности?


Осмелюсь предположить, что автору темы не понравилось это:

When a new version of the operating system is released, your application will still install and run on it.

Re: Из MSDN
От: adontz Грузия http://adontz.wordpress.com/
Дата: 14.01.03 18:31
Оценка:
Здравствуйте, silentdash, Вы писали:

В дот нетовском MSDN она здесь
ms-help://MS.VSCC/MS.MSDNVS/sysinfo/sysinfo_0usv.htm (вставить как адрес в IE)
или здесь
Windows Development
 Windows Base Services
  Windows System Information
   SDK Documentation
    Windows System Information
     System Information
      System Information Reference
       System Information Functions
        VerifyVerionInfo


И всё здесь правильно, просто у более поздних ОС версия может быть с меньшим номером и сравнивать как requaredVersion <= currentVersion не корректно. Ну и помогает проверить сервис паки.

Вот кстати, что там ДЕЙСТВИТЕЛЬНО написано

The VerifyVersionInfo function compares a set of operating system version requirements to the corresponding values for the currently running version of the system.

BOOL VerifyVersionInfo(
LPOSVERSIONINFOEX lpVersionInfo, // version info
DWORD dwTypeMask, // attributes
DWORDLONG dwlConditionMask // comparison type
);
Parameters
lpVersionInfo
[in] Pointer to an OSVERSIONINFOEX structure containing the operating system version requirements to compare. The dwTypeMask parameter indicates the members of this structure that contain information to compare.
You must set the dwOSVersionInfoSize member of this structure to sizeof(OSVERSIONINFOEX). You must also specify valid data for the members indicated by dwTypeMask. The function ignores structure members for which the corresponding dwTypeMask bit is not set.

dwTypeMask
[in] Specifies the members of the OSVERSIONINFOEX structure to test. This parameter can be one or more of the following values. Value Corresponding member
VER_BUILDNUMBER dwBuildNumber
VER_MAJORVERSION dwMajorVersion
VER_MINORVERSION dwMinorVersion
VER_PLATFORMID dwPlatformId
VER_SERVICEPACKMAJOR wServicePackMajor
VER_SERVICEPACKMINOR wServicePackMinor
VER_SUITENAME wSuiteMask
VER_PRODUCT_TYPE wProductType


dwlConditionMask
[in] A 64-bit value that indicates the type of comparison to use for each lpVersionInfo member being compared. To build this value, call the VerSetConditionMask function or the VER_SET_CONDITION macro once for each OSVERSIONINFOEX member being compared.
Return Values
If the currently running operating system satisfies the specified requirements, the return value is a nonzero value.

If the current system does not satisfy the requirements, the return value is zero and GetLastError returns ERROR_OLD_WIN_VERSION.

If the function fails, the return value is zero and GetLastError returns an error code other than ERROR_OLD_WIN_VERSION.

Remarks
The VerifyVersionInfo function retrieves version information about the currently running operating system and compares it to the valid members of the lpVersionInfo structure. This enables you to easily determine the presence of a required set of operating system version conditions. It is preferable to use VerifyVersionInfo rather than calling the GetVersionEx function to perform your own comparisons.

Typically, VerifyVersionInfo returns a nonzero value only if all specified tests succeed. However, major, minor, and service pack versions are tested in a hierarchical manner because the operating system version is a combination of these values. If a condition exists for the major version, it supersedes the conditions specified for minor version and service pack version. (You cannot test for major version greater than 5 and minor version less than or equal to 1. If you specify such a test, the function will change the request to test for a minor version greater than 1 because it is performing a greater than operation on the major version.)

The function tests these values in this order: major version, minor version, and service pack version. The function continues testing values while they are equal, and stops when one of the values does not meet the specified condition. For example, if you test for a system greater than or equal to version 5.1 service pack 1, the test succeeds if the current version is 6.0. (The major version is greater than the specified version, so the testing stops.) In the same way, if you test for a system greater than or equal to version 5.1 service pack 1, the test succeeds if the current version is 5.2. (The minor version is greater than the specified versions, so the testing stops.) However, if you test for a system greater than or equal to version 5.1 service pack 1, the test fails if the current version is 5.0 service pack 2. (The minor version is not greater than the specified version, so the testing stops.)

To verify a range of system versions, you must call VerifyVersionInfo twice. For example, to verify that the system version is greater than 5.0 but less than or equal to 5.1, first call VerifyVersionInfo to test that the major version is 5 and the minor version is greater than 0, then call VerifyVersionInfo again to test that the major version is 5 and the minor version is less than or equal to 1.

Identifying the current operating system is usually not the best way to determine whether a particular operating system feature is present. This is because the operating system may have had new features added in a redistributable DLL. Rather than using GetVersionEx to determine the operating system platform or version number, test for the presence of the feature itself. For more information, see Operating System Version.

A journey of a thousand miles must begin with a single step © Lau Tsu
Re: Из MSDN
От: Алексей Владимирович Миронов Россия  
Дата: 15.01.03 04:01
Оценка:
Здравствуйте, silentdash, Вы писали:

S>Не знаю в какой стадии алкогольного опьянения это писалось


А что не так? Функция довольно полезная, вот только припозднилась с ней Microsoft. Ее бы в оригинальную Win95... А так, все разработчики, озабоченные совместимостью с разными версиями Windows, уже давно наделали функций вроде bool is_winnt4_sp3_or_later (); и ей подобных. И вряд ли бросятся менять их на другие.
Re[3]: Из MSDN
От: siavol Россия  
Дата: 15.01.03 06:30
Оценка:
Здравствуйте, Flamer, Вы писали:

A>>А что не так в той статье и в цитате, в частности?


F>Осмелюсь предположить, что автору темы не понравилось это:

F>

F>When a new version of the operating system is released, your application will still install and run on it.


Или это:

You would be saying "My application needs Windows NT® version 4.0, with SP 2, or greater" and then ask VerifyVersionInfo "Is this OS that I'm running on up to that standard?"

На мне сейчас Kossовские уши и в них играет — Bt — Orbitus Teranium
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.