开发者

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. The SLGetWindowsInformation() looks simple enough to use, but I don't know what info names are available.

SLAPI = Software Licensin开发者_开发技巧g API


If you don't want to use GetProductInfo() you can call SLQueryInformationDWORD and specify Kernel-ProductInfo for the name parameter. The returned values are the same as GetProductInfo() :D (at least on my testsystem)


You can check this using the GetProductInformation API for that, just check the pdwReturnedProductType parameter for one of the server core values.

Example code (Delphi but not hard to translate to 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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜