GVKun编程网logo

获取Windows版本(获取系统版本)

9

对于想了解获取Windows版本的读者,本文将是一篇不可错过的文章,我们将详细介绍获取系统版本,并且为您提供关于asp-classic–经典的ASP页面是否会运行在Windows7之后的Windows

对于想了解获取Windows版本的读者,本文将是一篇不可错过的文章,我们将详细介绍获取系统版本,并且为您提供关于asp-classic – 经典的ASP页面是否会运行在Windows 7之后的Windows版本上?、C# 获取Windows 设备信息、C++通用WMI接口实现获取Windows操作系统内核版本号、Delphi 10.3版本获取windows系统版本和CPU信息的有价值信息。

本文目录一览:

获取Windows版本(获取系统版本)

获取Windows版本(获取系统版本)

有没有简单的方法来获得Windows版(家庭,专业等)?

我可以使用单声道的AOTfunction本地“预编译”.NET DLL / EXE,使他们更难以逆向工程?

禁用屏幕保护程序给用户

孤立的存储误解

WIA 2.0双面扫描

如何以编程方式检查WCF Http / Non-Http Activation组件?

几个这样做的方法:

您可以在WMI中解析Win32_OperatingSystem类的caption字段。

您可以查看WMI中的Win32_OperatingSystem类中的OSProductSuite和OperatingSystemSKU字段。

你可以使用P / Invoke来移植这个C ++程序 。

这个博客文章详细介绍了获取Windows(XP / Vista / 7 /等)的“主要”版本,紧接着这篇博客文章详细介绍了如何使用WMI获取额外的信息。

在第二个链接的代码是有点长,我不知道从外部网站的大块代码复制没有明显的许可证,所以我不把代码放在这个答案。

如果你引用了Microsoft.VisualBasic.Devices命名空间,你可以这样做:

ComputerInfo computerInfo = new ComputerInfo(); string fullName = computerInfo.OSFullName; // ie "Microsoft Windows 7 Ultimate"

您可以在您的c#应用程序中使用Microsoft.VisualBasic – 就像任何其他库一样。

有点。 以这种方式使用这个类 。

简单的答案? 只要看看注册表。

HKLM SOFTWARE Microsoft Windows NT CurrentVersion ProductName

HKLM SOFTWARE Microsoft Windows NT CurrentVersion CSDVersion

它没有WMI的开销(每次调用50ms),并给出了全名。

asp-classic – 经典的ASP页面是否会运行在Windows 7之后的Windows版本上?

asp-classic – 经典的ASP页面是否会运行在Windows 7之后的Windows版本上?

我们有一个使用传统ASP和VB6 / COM的遗留系统,并计划迁移到.NET堆栈.

我们正在尝试制定迁移计划,一个关键的驱动点是“我们的旧东西什么时候停止工作?”.

对于VB6 / COM,微软已声明它没有计划在Windows 7之后的Windows版本中包含VB6运行时(是的,我知道这可以解释).

我还没有找到类似的经典ASP声明.我见过人们参考了Windows 2008 Server R2的Microsoft生命周期计划(这是2018年的某个时间)并推断:

(a)因为经典的ASP在Win2008R2上运行
(b)Win2008R2在2018年之前是好的
(c)经典ASP直到2018年才有效.

我不确定是否购买,特别是因为我们有合同义务在它们出来后的几个月内支持新版本的Windows xx,因此保留Win2008R2作为解决方案不是一种选择.

任何人都可以向我指出微软关于经典ASP的生命终结的事情吗?

解决方法

根据 this blog post,它将在未来几年内与我们在一起:

Here’s some interesting news from 07001 and team. I was wondering what the lifecycle for ASP “Classic” was. I looked on the Microsoft Lifecycle page and didn’t see it. I was fortunate enough to talk to 07001 as well as 07003 and was told:

Classic ASP is actually very much alive. It will ship again with Windows Vista and Windows Longhorn Server – so will be supported at least 10 years from that ship date. – 07001




Asp.DLL is part of VISTA so the runtime will continue to be supported based on the Vista support lifecycle.

All classic ASP development tools (i.e.,Visual Interdev) are Now in their extended support period and we will not be updating tools for classic ASP.

To get the best tooling/platform option ASP.NET is the way to go. – 07003

据我所知,Windows Vista的最终发布日期是2007年1月30日,因此这意味着至少在2017年之前,新版本将支持经典ASP,可能会更进一步.

Scott Guthrie是微软的Corporate Vice President,Server & Tools Business,所以他知道他在谈论什么.

编辑:最后(2012年1月30日) – official confirmation经典ASP将与我们在一起很长时间,包括Windows 8:

The next major version of Internet information Services (IIS) will be shipped as part of the Windows 8 operating system. The use of ASP pages will be supported on Windows 8 for a minimum of 10 years from the Windows 8 release date.

C# 获取Windows 设备信息

C# 获取Windows 设备信息

 1 namespace Beisen.Native
 2 {
 3     using Beisen.Pdf;
 4     using System;
 5     using System.Runtime.InteropServices;
 6 
 7     internal sealed class DeviceInfo
 8     {
 9         private static DeviceInfo _Instance;
10 
11         public static DeviceInfo Instance
12         {
13             get
14             {
15                 if (_Instance == null)
16                 {
17                     _Instance = new DeviceInfo();
18                 }
19                 return _Instance;
20             }
21         }
22 
23         public string Id
24         {
25             get
26             {
27                 uint volumeSerialNumber = 0;
28                 uint num = 0u;
29                 uint num2 = 0;
30                 uint num3 = 0;
31                 uint num4 = 0;
32                 uint num5 = 0;
33                 string systemDirectory = Environment.SystemDirectory;
34                 if ((systemDirectory != null) && (systemDirectory.Length > 0))
35                 {
36                     uint num6;
37                     FileSystemFeature fileSystemFeature;
38                     Platform.GetVolumeInformation(string.Format("{0}:\\", systemDirectory[0]), null, 0, out num, out num6, out fileSystemFeature, null, 0);
39                 }
40                 string g = RegistryWOW6432.GetRegKey32<string>(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\Microsoft\Cryptography", "MachineGuid");
41                 if ((g == null) || (g.Trim() == ""))
42                 {
43                     g = RegistryWOW6432.GetRegKey64<string>(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\Microsoft\Cryptography", "MachineGuid");
44                 }
45                 if (g != null)
46                 {
47                     byte[] buffer = new Guid(g).ToByteArray();
48                     if (buffer != null)
49                     {
50                         num2 = BitConverter.ToUInt32(buffer, 0);
51                         num3 = BitConverter.ToUInt32(buffer, 4);
52                         num4 = BitConverter.ToUInt32(buffer, 8);
53                         num5 = BitConverter.ToUInt32(buffer, 12);
54                     }
55                 }
56                 return $"{volumeSerialNumber}-{num2}-{num3}-{num4}-{num5}";
57             }
58         }
59     }
60 }

 

C++通用WMI接口实现获取Windows操作系统内核版本号

C++通用WMI接口实现获取Windows操作系统内核版本号

    作为一名Windows开发者,能熟练掌握WMI技术,在开发Windows应用程序的时候往往能够事半功倍。今天来给大家分享一个使用WMI来获取Windows操作系统内核版本号的例子。

    首先我们打开WMI测试器,连接ROOT\CIMV2命名空间,输入WQL查询语句SELECT * FROM Win32_OperatingSystem,

    

    然后在查询的结果里我们找到Version属性,发现内核版本号为10.0.16299,即为我们所需要的结果。

    

    那么,这个结果如何在程序中被使用,如何用C++语言来实现呢?首先我们要包含comdef.h和Wbemidl.h头文件,然后调用wbemuuid.lib库帮助我们实现WMI的功能,代码及测试程序如下:

    

#include <iostream>
#include <Windows.h>
#include <stdlib.h>
#include <string>
#include <comdef.h>
#include <Wbemidl.h>
 
using namespace std;
 
#pragma comment(lib, "wbemuuid.lib")
 
int GetSystemVersion(char* pSystemVersion)
{
    HRESULT hres;
    hres = CoInitializeEx(0, COINIT_MULTITHREADED);
    if (FAILED(hres))
    {
        return -1;
    }
 
    hres = CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);
    if (FAILED(hres))
    {
        CoUninitialize();
        return -1;
    }
 
    IWbemLocator *pLoc = NULL;
    hres = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID *)&pLoc);
    if (FAILED(hres))
    {
        CoUninitialize();
        return -1;
    }
 
    IWbemServices *pSvc = NULL;
    hres = pLoc->ConnectServer(_bstr_t(L"ROOT\\CIMV2"), NULL, NULL, 0, NULL, 0, 0, &pSvc);
    if (FAILED(hres))
    {
        pLoc->Release();
        CoUninitialize();
        return -1;
    }
 
    hres = CoSetProxyBlanket(pSvc, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE);
    if (FAILED(hres))
    {
        pSvc->Release();
        pLoc->Release();
        CoUninitialize();
        return -1;
    }
 
    IEnumWbemClassObject* pEnumerator = NULL;
    hres = pSvc->ExecQuery(bstr_t("WQL"), bstr_t("SELECT * FROM Win32_OperatingSystem"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator);
    if (FAILED(hres))
    {
        pSvc->Release();
        pLoc->Release();
        CoUninitialize();
        return -1;
    }
 
    IWbemClassObject *pclsObj = NULL;
    ULONG uReturn = 0;
    while (pEnumerator)
    {
        HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
        if (0 == uReturn)
        {
            break;
        }
 
        VARIANT vtProp;
        hr = pclsObj->Get(L"Version", 0, &vtProp, 0, 0);
        WcharToChar(vtProp.bstrVal, pSystemVersion, 64);
        VariantClear(&vtProp);
        pclsObj->Release();
    }
    pSvc->Release();
    pLoc->Release();
    pEnumerator->Release();
    CoUninitialize();
 
    return 0;
}
 
int _tmain(int argc, _TCHAR* argv[])
{
    char pVersion[20];
    int retcode = 0;
    const char* s = "10.0.";
    char *p;
    retcode = GetSystemVersion(pVersion);
    if(retcode == 0)
    {
        p = strstr(pVersion,s);
        if(p!=NULL)
        {
            cout << "Current Windows is 2016 Server! " << endl;
            getchar();
            return 2;
        }
        else
        {
            cout << "Current Windows is not 2016 Server! " << endl;
            getchar();
            return 0;
        }
    }
    return 0;
}

 

  •  

Delphi 10.3版本获取windows系统版本和CPU信息

Delphi 10.3版本获取windows系统版本和CPU信息

procedure TForm1.Button1Click(Sender: TObject);
var
 mm:TRegistry;
 cpu:string;
begin
   mm:=TRegistry.Create;
   with mm do
   begin
     RootKey:=HKEY_LOCAL_MACHINE;
     if OpenKeyReadOnly(''\Hardware\Description\System\CentralProcessor\0'') then
     begin
      cpu := ReadString(''ProcessorNameString'');
      Memo1.Lines.Add(''处理器:''+cpu);
    end;
   end;
   Memo1.Lines.Add(''系统版本:''+TOSVersion.ToString);
end;

需要引用 System.Win.Registry单元

关于获取Windows版本获取系统版本的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于asp-classic – 经典的ASP页面是否会运行在Windows 7之后的Windows版本上?、C# 获取Windows 设备信息、C++通用WMI接口实现获取Windows操作系统内核版本号、Delphi 10.3版本获取windows系统版本和CPU信息等相关内容,可以在本站寻找。

本文标签: