summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-19 12:32:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-19 12:32:25 +0000
commite3653bfe6fd1a4b13aeb0ba0a7a3e8dd3e8215f1 (patch)
tree4fc026ee6437b7829f28d5f2654b994a0616af63 /ext
parent21190be21cef311e095488ee3193144ca86850cc (diff)
etc.c: old VC
* ext/etc/etc.c (etc_uname): fix for old VC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/etc/etc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index 944b72217c4..7c88b8911c7 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -702,7 +702,11 @@ etc_uname(VALUE obj)
rb_w32_conv_from_wchar(v.szCSDVersion, rb_utf8_encoding()));
rb_hash_aset(result, ID2SYM(rb_intern("version")), version);
+# if defined _MSC_VER && _MSC_VER < 1300
+# define GET_COMPUTER_NAME(ptr, plen) GetComputerNameW(ptr, plen)
+# else
# define GET_COMPUTER_NAME(ptr, plen) GetComputerNameExW(ComputerNameDnsFullyQualified, ptr, len);
+# endif
GET_COMPUTER_NAME(NULL, &len);
buf = ALLOCV_N(WCHAR, vbuf, len);
if (GET_COMPUTER_NAME(buf, &len)) {
@@ -712,6 +716,15 @@ etc_uname(VALUE obj)
if (NIL_P(nodename)) nodename = rb_str_new(0, 0);
rb_hash_aset(result, ID2SYM(rb_intern("nodename")), nodename);
+# ifndef PROCESSOR_ARCHITECTURE_AMD64
+# define PROCESSOR_ARCHITECTURE_AMD64 9
+# endif
+# ifndef PROCESSOR_ARCHITECTURE_IA64
+# define PROCESSOR_ARCHITECTURE_IA64 6
+# endif
+# ifndef PROCESSOR_ARCHITECTURE_INTEL
+# define PROCESSOR_ARCHITECTURE_INTEL 0
+# endif
GetSystemInfo(&s);
switch (s.wProcessorArchitecture) {
case PROCESSOR_ARCHITECTURE_AMD64: