IsWindowsServer function version

int IsWindowsServer()

Indicates if the current OS is a Windows Server release. Applications that need to distinguish between server and client versions of Windows should call this function.

Implementation

int IsWindowsServer() {
  final osvi = calloc<OSVERSIONINFOEX>()..ref.wProductType = VER_NT_SERVER;
  final dwlConditionMask =
      VerSetConditionMask(0, VER_FLAGS.VER_PRODUCT_TYPE, VER_EQUAL);

  try {
    return VerifyVersionInfo(
      osvi,
      VER_FLAGS.VER_PRODUCT_TYPE,
      dwlConditionMask,
    );
  } finally {
    free(osvi);
  }
}