Changeset 9325


Ignore:
Timestamp:
Apr 29, 2008, 10:07:29 AM (11 years ago)
Author:
gb
Message:

Use Windows functions (not #_uname) for machine/software-type/version.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/win64/lib/misc.lisp

    r8837 r9325  
    3030(defun machine-instance ()
    3131  "Return a string giving the name of the local machine."
    32   (%uname 1))
     32  #-windows-target (%uname 1)
     33  #+windows-target
     34  (rlet ((nsize #>DWORD 0))
     35    (if (eql 0 (#_GetComputerNameExW #$ComputerNameDnsFullyQualified
     36                                     +null-ptr+
     37                                     nsize))
     38      (%stack-block ((buf (* 2 (pref nsize #>DWORD))))
     39        (#_GetComputerNameExW #$ComputerNameDnsFullyQualified
     40                              buf
     41                              nsize)
     42        (%get-native-utf-16-cstring buf))
     43      "localhost"))
     44  )
    3345
    3446
    3547(defun machine-type ()
    3648  "Returns a string describing the type of the local machine."
    37   (%uname 4))
     49  #-windows-target (%uname 4)
     50  #+windows-target
     51  (rlet ((info #>SYSTEM_INFO))
     52    (#_GetSystemInfo info)
     53    (case (pref info #>SYSTEM_INFO.nil.nil.wProcessorArchitecture)
     54      (#.#$PROCESSOR_ARCHITECTURE_AMD64 "x64")
     55      (#.#$PROCESSOR_ARCHITECTURE_INTEL "x86")
     56      (t "unknown")))
     57  )
    3858
    3959
     
    89109                  1)))
    90110            #+windows-target
    91             "fix this"
     111            (getenv "PROCESSOR_IDENTIFIER")
    92112            )))
    93113
     
    95115(defun software-type ()
    96116  "Return a string describing the supporting software."
    97   (%uname 0))
     117  #-windows-target (%uname 0)
     118  #+windows-target "Microsoft Windows")
    98119
    99120
     
    101122  "Return a string describing version of the supporting software, or NIL
    102123   if not available."
    103   (%uname 2))
     124  #-windows-target (%uname 2)
     125  #+windows-target
     126  (rletZ ((info #>OSVERSIONINFOEX))
     127    (setf (pref info #>OSVERSIONINFOEX.dwOSVersionInfoSize)
     128          (record-length #>OSVERSIONINFOEX))
     129    (#_GetVersionExA info)
     130    (format nil "~d.~d Build ~d (~a)"
     131            (pref info #>OSVERSIONINFOEX.dwMajorVersion)
     132            (pref info #>OSVERSIONINFOEX.dwMinorVersion)
     133            (pref info #>OSVERSIONINFOEX.dwBuildNumber)
     134            (if (eql (pref info #>OSVERSIONINFOEX.wProductType)
     135                     #$VER_NT_WORKSTATION)
     136              "Workstation"
     137              "Server")))
     138  )
    104139
    105140
Note: See TracChangeset for help on using the changeset viewer.