[英]Where can I find more information on using Microsoft Windows SLAPI?
In particular, I'm trying to find out how to use it to differentiate between server and server core editions of Windows.特别是,我试图找出如何使用它来区分 Windows 的服务器和服务器核心版本。 The
SLGetWindowsInformation()
looks simple enough to use, but I don't know what info names are available. SLGetWindowsInformation()
看起来使用起来很简单,但我不知道有哪些信息名称可用。
SLAPI = Software Licensing API SLAPI =软件许可 API
If you don't want to use GetProductInfo() you can call SLQueryInformationDWORD and specify Kernel-ProductInfo for the name parameter.如果您不想使用 GetProductInfo(),您可以调用SLQueryInformationDWORD并为 name 参数指定 Kernel-ProductInfo。 The returned values are the same as GetProductInfo():D (at least on my testsystem)
返回的值与 GetProductInfo():D 相同(至少在我的测试系统上)
You can check this using the GetProductInformation API for that, just check the pdwReturnedProductType parameter for one of the server core values.您可以使用GetProductInformation API 对此进行检查,只需检查 pdwReturnedProductType 参数以获取服务器核心值之一。
Example code (Delphi but not hard to translate to c(++)):示例代码(Delphi 但不难翻译成 c(++)):
function IsServerCore: Boolean;
var
osvi: OSVERSIONINFOEX;
dwPT: DWORD;
begin
ZeroMemory(@osvi, SizeOf(osvi));
osvi.dwOSVersionInfoSize := SizeOf(osvi);
Win32Check(GetVersionEx(osvi));
Win32Check(GetProductInfo(osvi.dwMajorVersion, osvi.dwMinorVersion,
osvi.wServicePackMajor, osvi.wServicePackMinor, dwPT));
case dwPT of
PRODUCT_DATACENTER_SERVER_CORE,
PRODUCT_STANDARD_SERVER_CORE,
PRODUCT_ENTERPRISE_SERVER_CORE,
PRODUCT_WEB_SERVER_CORE,
PRODUCT_DATACENTER_SERVER_CORE_V,
PRODUCT_STANDARD_SERVER_CORE_V,
PRODUCT_ENTERPRISE_SERVER_CORE_V,
PRODUCT_STORAGE_EXPRESS_SERVER_CORE,
PRODUCT_STORAGE_STANDARD_SERVER_CORE,
PRODUCT_STORAGE_WORKGROUP_SERVER_CORE,
PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE,
PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE,
PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE,
PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE: Result := True
else
Result := False;
end;
end;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.