Professional Web Applications Themes

detecting Win95/Win98/WinME - Ruby

Some of the File#flock arguments do not work on Win95/Win98/WinME (namely LOCK_SH and LOCK_NB), so I'm looking for a way to detect what kind of windows the process is running on. RUBY_PLATFORM and rbconfig.rb do not seem to help. Any ideas?...

  1. #1

    Default detecting Win95/Win98/WinME


    Some of the File#flock arguments do not work on Win95/Win98/WinME
    (namely LOCK_SH and LOCK_NB), so I'm looking for a way to detect what
    kind of windows the process is running on. RUBY_PLATFORM and rbconfig.rb
    do not seem to help.

    Any ideas?



    Joel Guest

  2. #2

    Default Re: detecting Win95/Win98/WinME

    Hi,
    ----- Original Message -----
    From: "Joel VanderWerf" <Berkeley.EDU>
    To: "ruby-talk ML" <org>
    Sent: Tuesday, January 20, 2004 8:29 AM
    Subject: detecting Win95/Win98/WinME

     
    How about `ver` ?

    C:\>irb
    irb(main):001:0> `ver`
    => "\nMicrosoft Windows 2000 [Version 5.00.2195]\n"

    Regards,
    Park Heesob




    Park Guest

  3. #3

    Default Re: detecting Win95/Win98/WinME

    > irb(main):001:0> `ver` 

    Thanks, that does the trick.



    Joel Guest

  4. #4

    Default Re: detecting Win95/Win98/WinME

    In article <berkeley.edu>,
    Joel VanderWerf <Berkeley.EDU> wrote: 
    >
    >Thanks, that does the trick.[/ref]

    Hmmm... but that's not exactly cross-platform.
    Is ver available on all flavors of Windows?

    BTW: you could probably check some section of the Registry, but it's not
    very straightforward in my experience.

    Phil
    Phil Guest

  5. #5

    Default Re: detecting Win95/Win98/WinME

    Phil Tomson wrote: 
    >>
    >>Thanks, that does the trick.[/ref]
    >
    >
    > Hmmm... but that's not exactly cross-platform.
    > Is ver available on all flavors of Windows?[/ref]

    I've tried it on ME, and Park Heesob tried it on Win2K, so now we know
    it works on two.

    Actually, this page suggests that it is standard:

    http://www.computerhope.com/verhlp.htm

    But this page is wrong about the output on ME. It says 'Windows ME
    4.90.3000', but I got something like 'Windows Millenium ...'. So I'm
    assuming it could be either.
     

    I quail at the thought :(



    Joel Guest

  6. #6

    Default Re: detecting Win95/Win98/WinME

    Hi,

    At Tue, 20 Jan 2004 14:01:12 +0900,
    Joel VanderWerf wrote: 
    > >
    > >
    > > Hmmm... but that's not exactly cross-platform.
    > > Is ver available on all flavors of Windows?[/ref]
    >
    > I've tried it on ME, and Park Heesob tried it on Win2K, so now we know
    > it works on two.[/ref]

    ver command has been available from DOS, 2.x at least AFAIK.

    However, it tells about the command interpreter but not about
    the system. It can be changed by COMSPEC.

    --
    Nobu Nakada


    nobu.nokada@softhome.net Guest

  7. #7

    Default Re: detecting Win95/Win98/WinME

    Joel VanderWerf <Berkeley.EDU> wrote in message news:<berkeley.edu>... 

    This is stolen from Moonwolf's "init.rb" file (part of the win32/winbase module).

    require "Win32API"

    buf = [148].pack("L")+"\0"*144
    b = Win32API.new('kernel32','GetVersionExA','P','I').c all(buf)
    if b != 0
    (size,major,minor,build,platform,version)=buf.unpa ck("LLLLLA128")
    WINVER = (major << 8) | minor
    WINVER_MAJOR = major
    WINVER_MINOR = minor
    WINVER_BUILD = build
    WIN32_WINDOWS = WINVER
    case platform
    when 0 #Win32s
    WINVER_OSNAME = "Win32s"
    WINPLATFORM = "Win32s"
    UNICODE = false
    WIN32_IE = 0x000
    when 1 #Win95/98
    WINPLATFORM = "Win95"
    UNICODE = false
    if minor==0 #Win95
    if build >= 1212 #Win95OSR2.5
    WINVER_OSNAME = "Win95OSR2.5"
    WIN32_IE = 0x300
    elsif build >= 1111 #Win95OSR2
    WINVER_OSNAME = "Win95OSR2"
    WIN32_IE = 0x300
    else #Win95
    WINVER_OSNAME = "Win95"
    WIN32_IE = 0x200
    end
    else #Win98/98SE/Me
    case minor
    when 0x10 #98/98SE
    if build>=2222 #98SE
    WINVER_OSNAME = "Win98SE"
    WIN32_IE = 0x400
    else #98
    WINVER_OSNAME = "Win98"
    WIN32_IE = 0x400
    end
    when 0x90 #Me
    WINVER_OSNAME = "WinMe"
    WIN32_IE = 0x500
    else
    WINVER_OSNAME = "Win98???"
    WIN32_IE = 0x400
    end
    end
    when 2 #WinNT/2000
    WINPLATFORM = "WinNT"
    if major==4 #WinNT4
    WINVER_OSNAME = "WinNT4"
    UNICODE = true
    WIN32_IE = 0x300
    elsif major==5 #Win2000
    WINVER_OSNAME = "Win2000"
    UNICODE = true
    WIN32_IE = 0x400
    else #WinNT3.5
    WINVER_OSNAME = "WinNT3.x???"
    UNICODE = true
    WIN32_IE = 0x000
    end
    end
    else
    WINVER_OSNAME = "???"
    UNICODE = false
    WINVER = 0x400
    WIN32_WINDOWS = 0x400
    WIN32_IE = 0x300
    end

    puts WINVER_OSNAME

    Regards,

    Dan
    Daniel Guest

  8. #8

    Default Re: detecting Win95/Win98/WinME

    com (Daniel Berger) wrote in message news:<google.com>... 
    >
    > This is stolen from Moonwolf's "init.rb" file (part of the win32/winbase module).
    >
    > require "Win32API"
    >
    > buf = [148].pack("L")+"\0"*144
    > b = Win32API.new('kernel32','GetVersionExA','P','I').c all(buf)
    > if b != 0
    > (size,major,minor,build,platform,version)=buf.unpa ck("LLLLLA128")
    > WINVER = (major << 8) | minor
    > WINVER_MAJOR = major
    > WINVER_MINOR = minor
    > WINVER_BUILD = build
    > WIN32_WINDOWS = WINVER
    > case platform
    > when 0 #Win32s
    > WINVER_OSNAME = "Win32s"
    > WINPLATFORM = "Win32s"
    > UNICODE = false
    > WIN32_IE = 0x000
    > when 1 #Win95/98
    > WINPLATFORM = "Win95"
    > UNICODE = false
    > if minor==0 #Win95
    > if build >= 1212 #Win95OSR2.5
    > WINVER_OSNAME = "Win95OSR2.5"
    > WIN32_IE = 0x300
    > elsif build >= 1111 #Win95OSR2
    > WINVER_OSNAME = "Win95OSR2"
    > WIN32_IE = 0x300
    > else #Win95
    > WINVER_OSNAME = "Win95"
    > WIN32_IE = 0x200
    > end
    > else #Win98/98SE/Me
    > case minor
    > when 0x10 #98/98SE
    > if build>=2222 #98SE
    > WINVER_OSNAME = "Win98SE"
    > WIN32_IE = 0x400
    > else #98
    > WINVER_OSNAME = "Win98"
    > WIN32_IE = 0x400
    > end
    > when 0x90 #Me
    > WINVER_OSNAME = "WinMe"
    > WIN32_IE = 0x500
    > else
    > WINVER_OSNAME = "Win98???"
    > WIN32_IE = 0x400
    > end
    > end
    > when 2 #WinNT/2000
    > WINPLATFORM = "WinNT"
    > if major==4 #WinNT4
    > WINVER_OSNAME = "WinNT4"
    > UNICODE = true
    > WIN32_IE = 0x300
    > elsif major==5 #Win2000
    > WINVER_OSNAME = "Win2000"
    > UNICODE = true
    > WIN32_IE = 0x400
    > else #WinNT3.5
    > WINVER_OSNAME = "WinNT3.x???"
    > UNICODE = true
    > WIN32_IE = 0x000
    > end
    > end
    > else
    > WINVER_OSNAME = "???"
    > UNICODE = false
    > WINVER = 0x400
    > WIN32_WINDOWS = 0x400
    > WIN32_IE = 0x300
    > end
    >
    > puts WINVER_OSNAME
    >[/ref]


    What about XP? I suspect it falls somewhere in the WinNT/2000 case.

    Phil
    Phil Guest

  9. #9

    Default Re: detecting Win95/Win98/WinME

    Daniel Berger wrote:
    ... 

    Thanks. I'll keep that in mind in case the `ver` solution doesn't work
    out. (Or is there a strong case for using the Win32API GetVersionExA
    call anyway?)



    Joel Guest

  10. #10

    Default Re: detecting Win95/Win98/WinME

    Hi,

    At Wed, 21 Jan 2004 10:20:00 +0900,
    Phil Tomson wrote: 

    It is NT 5.1, isn't it?

    --
    Nobu Nakada


    nobu.nokada@softhome.net Guest

  11. #11

    Default Re: detecting Win95/Win98/WinME

    Phil Tomson wrote:
     
    AFAIK, XP is NT 5.1 (major == 5, minor == 1).

    emmanuel


    Emmanuel Guest

Similar Threads

  1. install dw to winME
    By kytron in forum Dreamweaver AppDev
    Replies: 2
    Last Post: May 21st, 06:04 PM
  2. CF 6.1 on WinMe/98
    By _Roudh in forum Coldfusion - Getting Started
    Replies: 0
    Last Post: March 31st, 03:24 AM
  3. Win95
    By Bob Friedman in forum Macromedia Director Basics
    Replies: 1
    Last Post: January 13th, 03:59 PM
  4. Debian 3.0r0 and WinME
    By Ayn Sof in forum Linux Setup, Configuration & Administration
    Replies: 6
    Last Post: October 31st, 08:10 AM
  5. networking xp/win95
    By Steve Winograd [MVP] in forum Windows Networking
    Replies: 0
    Last Post: July 15th, 07:38 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139