Re: eugtk history

new topic     » goto parent     » topic index » view thread      » older message » newer message

Would this be helpful? It's what I use to determine what version of Windows my users are running:

include std/dll.e 
include std/machine.e 
 
function getWinOSVersion() 
atom kernel32, OSVersion, ptOS, junk, major, minor, build, platf 
sequence OS = "" 
	kernel32 = open_dll("kernel32.dll") 
	OSVersion = define_c_func(kernel32, "GetVersionExA", {C_POINTER}, C_INT) 
	 
	ptOS = allocate( 148 ) 
	poke4(ptOS,148) 
	if OSVersion > 0 then    
	   junk = c_func(OSVersion, { ptOS } ) 
 
	   major = peek4u(ptOS+4) 
	   minor = peek4u(ptOS+8) 
	   build = peek4u(ptOS+12) 
	   platf = peek4u(ptOS+16) 
 
	   if major = 3 then --NT3.51 
	      OS = "Windows NT 3.51" 
	   elsif major = 4 then --95,98,ME,NT4 
	      if minor = 0 then 
	         if platf = 0 then 
	            OS = "Windows 95" 
	         elsif platf = 2 then 
	            OS = "Windows NT 4.0" 
	         end if              
	      elsif minor = 10 then 
	            OS = "Windows 98" 
	      elsif minor = 90 then 
	            OS = "Windows ME" 
	      end if     
	   elsif major = 5 then --2k,XP,.Net Server 
	      if minor = 0 then 
	         OS = "Windows 2000" 
	      elsif minor = 1 then 
	         OS = "Windows XP or .Net Server" 
	      elsif minor = 2 then 
	      	OS = "Windows XP Professional" 
	      end if 
	   elsif major = 6 then -- Vista 
			if minor = 1 then 
				OS = "Windows 7" 
			elsif minor=2 then 
				OS = "Windows 8" 
			elsif minor = 0 then 
				OS = "Windows Vista" 
			end if 
	   end if 
   end if 
	   if length(OS) = 0 then 
	   	OS = "Unable to determine OS!" 
	   	?major ?minor ?build ?platf 
	   end if 
   free(ptOS) 
   return OS 
end function 
 
-- usage example: 
--puts(1,"\n" & getWinOSVersion()) 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu