blob: 7bbf2bd346ed7988cb4b613cc287ac1e760b365f [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
20std::string sys::osName() {
21 return "Windows";
22}
23
24std::string sys::osVersion() {
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}