Changeset 601 for trunk


Ignore:
Timestamp:
Aug 21, 2008, 10:55:43 AM (16 years ago)
Author:
イグトランス (egtra)
Message:

PlatformIDで#198を回避

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/ablib/src/Classes/System/OperatingSystem.ab

    r497 r601  
    1515    End Sub
    1616
    17     Sub OperatingSystem(vi As OSVERSIONINFOA)
    18         pf = vi.dwPlatformId As PlatformID
     17    Sub OperatingSystem(ByRef vi As OSVERSIONINFOA)
     18        pf = ToPlatformID(vi.dwPlatformId)
    1919        ver = New Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber)
    2020        sp = New String(vi.szCSDVersion As PCSTR)
    2121    End Sub
    2222
    23     Sub OperatingSystem(vi As OSVERSIONINFOW)
    24         pf = vi.dwPlatformId As PlatformID
     23    Sub OperatingSystem(ByRef vi As OSVERSIONINFOW)
     24        pf = ToPlatformID(vi.dwPlatformId)
    2525        ver = New Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber)
    26         sp = New String(vi.szCSDVersion As PCSTR)
     26        sp = New String(vi.szCSDVersion As PCWSTR)
    2727    End Sub
    2828
     
    7272    ver As Version
    7373    sp As String
     74
     75    Static Function ToPlatformID(platformId As DWord) As PlatformID
     76        Select Case platformId
     77            Case VER_PLATFORM_WIN32s
     78                Return PlatformID.Win32S
     79            Case VER_PLATFORM_WIN32_WINDOWS
     80                Return PlatformID.Win32Windows
     81            Case VER_PLATFORM_WIN32_NT
     82                Return PlatformID.Win32NT
     83            Case VER_PLATFORM_WIN32_CE
     84                Return PlatformID.WinCE
     85            Case Else
     86                Return PlatformID.Unix
     87        End Select
     88    End Function
    7489End Class
    7590
Note: See TracChangeset for help on using the changeset viewer.