掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
OSのバージョンを詳細に表示するには? (ID:54964)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
YuOさん いつもいつもありがとうございます!! OSVERSIONINFOEX構造体も、6.0と.NETでは、中身が違うんですね〜 最初は6.0で書いていたのですが、コンパイルできなかったので.NETに変えちゃいました(6.0の方が使い慣れているんですよね〜)。 ちなみにこんな感じで、取得させてみました。 OSVERSIONINFOEX ovi; //OSのバージョンを取得 ovi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if(GetVersionEx((LPOSVERSIONINFO)&ovi) == FALSE) { sprintf(OSVersion, "OSのバージョン情報取得に失敗しました。"); } else { //Windows95/98系 if(ovi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { //Windows 95 if(ovi.dwMinorVersion == 0) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows 95"); } else { sprintf(OSVersion, "Microsoft Windows 95 with Servise Pack %d", ovi.wServicePackMajor); } } //Windows 98 else if(ovi.dwMinorVersion == 10) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows 98"); } else { sprintf(OSVersion, "Microsoft Windows 98 with Servise Pack %d", ovi.wServicePackMajor); } } //Windows Me else if(ovi.dwMinorVersion == 90) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows Me"); } else { sprintf(OSVersion, "Microsoft Windows Me with Servise Pack %d", ovi.wServicePackMajor); } } else { sprintf(OSVersion, "OSのバージョンが不明です(Windows 95系)。"); } } //あまりあり得ないが、Windows3.1系 else if(ovi.dwPlatformId == VER_PLATFORM_WIN32s) { sprintf(OSVersion, "Microsoft Windows 3.1"); } //Windows NT系 else if(ovi.dwPlatformId == VER_PLATFORM_WIN32_NT) { //Windows NT 3.51 if(ovi.dwMinorVersion == 51) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows NT 3.51"); } else { sprintf(OSVersion, "Microsoft Windows NT 3.51 with Servise Pack %d", ovi.wServicePackMajor); } } //Windows NT 4 else if(ovi.dwMinorVersion == 0 && ovi.dwMajorVersion == 4) { //Workstation if(ovi.wProductType == VER_NT_WORKSTATION) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows NT Workstation 4.0"); } else { sprintf(OSVersion, "Microsoft Windows NT Workstation 4.0 with Servise Pack %d", ovi.wServicePackMajor); } } //Server else { //Enterprise if(ovi.wSuiteMask == VER_SUITE_ENTERPRISE) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows NT Server 4.0 Enterprise Edition"); } else { sprintf(OSVersion, "Microsoft Windows NT Workstation 4.0 Enterprise Edition with Servise Pack %d", ovi.wServicePackMajor); } } //その他は通常のServerと判断させる else { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows NT Server 4.0"); } else { sprintf(OSVersion, "Microsoft Windows NT Workstation 4.0 with Servise Pack %d", ovi.wServicePackMajor); } } } } //Windows 2000 else if(ovi.dwMinorVersion == 0 && ovi.dwMajorVersion == 5) { //Professional if(ovi.wProductType == VER_NT_WORKSTATION) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows 2000 Professional"); } else { sprintf(OSVersion, "Microsoft Windows 2000 Professional with Servise Pack %d", ovi.wServicePackMajor); } } //Server else { //Datacenter Server if(ovi.wSuiteMask == VER_SUITE_DATACENTER) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows 2000 Datacenter server"); } else { sprintf(OSVersion, "Microsoft Windows 2000 Datacenter server with Servise Pack %d", ovi.wServicePackMajor); } } //Advanced Server else if(ovi.wSuiteMask == VER_SUITE_ENTERPRISE) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows 2000 Advanced server"); } else { sprintf(OSVersion, "Microsoft Windows 2000 Advanced server with Servise Pack %d", ovi.wServicePackMajor); } } //その他は Serverと判断 else { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows 2000 Server"); } else { sprintf(OSVersion, "Microsoft Windows 2000 Server with Servise Pack %d", ovi.wServicePackMajor); } } } } //Windows XP else if(ovi.dwMinorVersion == 1) { //Home Edition if(ovi.wSuiteMask == VER_SUITE_PERSONAL) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows XP Home"); } else { sprintf(OSVersion, "Microsoft Windows XP Home with Servise Pack %d", ovi.wServicePackMajor); } } //XP Embedded else if(ovi.wSuiteMask == VER_SUITE_EMBEDDEDNT) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows XP Embedded"); } else { sprintf(OSVersion, "Microsoft Windows XP Embedded with Servise Pack %d", ovi.wServicePackMajor); } } //Professional Edition else { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows XP Professional"); } else { sprintf(OSVersion, "Microsoft Windows XP Professional with Servise Pack %d", ovi.wServicePackMajor); } } } //Windows Server 2003 else if(ovi.dwMinorVersion == 2) { //Enterprise Edition if(ovi.wSuiteMask == VER_SUITE_ENTERPRISE) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows Server 2003 Enterprise Edition"); } else { sprintf(OSVersion, "Microsoft Windows Server 2003 Enterprise Edition with Servise Pack %d", ovi.wServicePackMajor); } } //Datacenter Edition else if(ovi.wSuiteMask == VER_SUITE_DATACENTER) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows Server 2003 Datacenter Edition"); } else { sprintf(OSVersion, "Microsoft Windows Server 2003 Datacenter Edition with Servise Pack %d", ovi.wServicePackMajor); } } //Web Edition else if(ovi.wSuiteMask == VER_SUITE_BLADE) { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows Server 2003 Web Edition"); } else { sprintf(OSVersion, "Microsoft Windows Server 2003 Web Edition with Servise Pack %d", ovi.wServicePackMajor); } } //他は Standard Editionと判断 else { if(ovi.wServicePackMajor == 0) { sprintf(OSVersion, "Microsoft Windows Server 2003 Standard Edition"); } else { sprintf(OSVersion, "Microsoft Windows Server 2003 Standard Edition with Servise Pack %d", ovi.wServicePackMajor); } } } } else { sprintf(OSVersion, "不明なOSのバージョンです(最新?)"); } } 細かく・・・とか言いながら、けっこういい加減です(笑)。 おかげで助かっちゃいました☆ ありがとうございます。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.