Get windows build number in Haskell

62 Views Asked by At

How can I get windows build number in Haskell? I think I can use readProcess and ver, but maybe there are more clear methods.

2

There are 2 best solutions below

2
chi On BEST ANSWER

The Win32 package seems to allow to access the build number, within the IO monad. Untested.

import System.Win32.Info.Version -- from Win32 package

main :: IO ()
main = do
   osVersionInfo <- getVersionEx
   print (dwBuildNumber osVersionInfo)
0
arrowd On

Is there a native C function in WinAPI that returns Windows build number?

If yes, you can easily call it from Haskell using ForeignFunctionInterface extension.