blob: 4fabc78adebf6b13658e36e9d45f41d58b92bdfe [file] [log] [blame]
Daniel Dunbarbb146722008-10-02 01:17:28 +00001//===- llvm/System/Win32/Host.inc -------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the Win32 Host support.
11//
12//===----------------------------------------------------------------------===//
13
14#include "Win32.h"
15#include <cstdio>
16#include <string>
17
18using namespace llvm;
19
Chris Lattnerb67c9582009-01-22 19:53:00 +000020std::string sys::getOSName() {
Daniel Dunbarbb146722008-10-02 01:17:28 +000021 return "Windows";
22}
23
Chris Lattnerb67c9582009-01-22 19:53:00 +000024std::string sys::getOSVersion() {
Anton Korobeynikovfc09f642008-11-02 11:47:11 +000025 OSVERSIONINFO osvi;
26
27 memset(&osvi, 0, sizeof(osvi));
Daniel Dunbarbb146722008-10-02 01:17:28 +000028 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
29
30 if (!GetVersionEx(&osvi))
31 return "";
Daniel Dunbarbb146722008-10-02 01:17:28 +000032
Anton Korobeynikovfc09f642008-11-02 11:47:11 +000033 char buf[64];
34 sprintf(buf, "%d.%d", (int)osvi.dwMajorVersion, (int)osvi.dwMinorVersion);
35
36 return buf;
Daniel Dunbarbb146722008-10-02 01:17:28 +000037}