Detect 64bit Opreation System ,,,

Post new topic   Reply to topic

View previous topic View next topic Go down

Detect 64bit Opreation System ,,,

Post  ~Fleck on Sat Jul 04, 2009 9:44 am

the idea is calling IsWow64Process API , but u can't declare it when u don't have 64 system ,, so get it's handle 4m kernel32 , if it's exist , then u r in 64 OS !!!

Code:
Private Declare Function GetProcAddress Lib "kernel32" _
    (ByVal hModule As Long, _
    ByVal lpProcName As String) As Long
   
Private Declare Function GetModuleHandle Lib "kernel32" _
    Alias "GetModuleHandleA" _
    (ByVal lpModuleName As String) As Long
   
Private Declare Function GetCurrentProcess Lib "kernel32" _
    () As Long

Private Declare Function IsWow64Process Lib "kernel32" _
    (ByVal hProc As Long, _
    bWow64Process As Boolean) As Long

Public Function Is64bit() As Boolean
    Dim handle As Long, bolFunc As Boolean

    ' Assume initially that this is not a Wow64 process
    bolFunc = False

    ' Now check to see if IsWow64Process function exists
    handle = GetProcAddress(GetModuleHandle _
                          ("kernel32"), "IsWow64Process")

    If handle > 0 Then ' IsWow64Process function exists
        ' Now use the function to determine if
        ' we are running under Wow64.
        IsWow64Process GetCurrentProcess(), bolFunc
    End If

    Is64bit = bolFunc

End Function

_________________

Thanks to FusioN for this awesome sig :]

~Fleck
Moderator
Moderator

Posts: 274
Activity: -258
Reputation: 8
Join date: 2009-06-28
Age: 16
Location: 127.0.0.1

Back to top Go down

View previous topic View next topic Back to top


Post new topic   Reply to topic
Permissions of this forum:
You cannot reply to topics in this forum