1,486
社区成员
发帖
与我相关
我的任务
分享
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem in colItems
WScript.Echo objItem.CreationClassName
Next
Option Explicit
Private Declare Function GetModuleHandle _
Lib "kernel32" _
Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare Function LoadLibraryEx _
Lib "kernel32" _
Alias "LoadLibraryExA" (ByVal lpLibFileName As String, _
ByVal hFile As Long, _
ByVal dwFlags As Long) As Long
Private Declare Function GetProcAddress _
Lib "kernel32" (ByVal hModule As Long, _
ByVal lpProcName As String) As Long
Private Declare Function FreeLibrary _
Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Const DONT_RESOLVE_DLL_REFERENCES As Long = &H1
Private Type SYSTEM_INFO
wProcessorArchitecture As Integer
wReserved As Integer
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
wProcessorLevel As Integer
wProcessorRevision As Integer
End Type
Private Declare Sub GetNativeSystemInfo _
Lib "kernel32.dll" (ByRef lpSystemInfo As SYSTEM_INFO)
Private Const PROCESSOR_ARCHITECTURE_AMD64 As Long = &H9
Private Function APIFunctionPresent(ByVal FunctionName As String, ByVal DLLName As String) As Boolean
Dim lHandle As Long
Dim lAddr As Long
Dim FreeLib As Boolean
FreeLib = False
lHandle = GetModuleHandle(DLLName)
If lHandle = 0 Then
lHandle = LoadLibraryEx(DLLName, 0&, DONT_RESOLVE_DLL_REFERENCES)
FreeLib = True
End If
If lHandle <> 0 Then
lAddr = GetProcAddress(lHandle, FunctionName)
If FreeLib Then
FreeLibrary lHandle
End If
End If
APIFunctionPresent = (lAddr <> 0)
End Function
Private Function InfoVersion64bit() As String
Dim lngRet As Long
Dim strTemp As String
Dim Si As SYSTEM_INFO
'blnIsWin64bit = False
' If APIFunctionPresent("IsWow64Process", "kernel32") Then
' IsWow64Process GetCurrentProcess, lngRet
'
' If lngRet <> 0 Then
If APIFunctionPresent("GetNativeSystemInfo", "kernel32") Then 'N'existe qu'?partir d'XP => v閞if au cas o?2000 demande
GetNativeSystemInfo Si
If Si.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 Then
strTemp = "Windows for 64bits"
'blnIsWin64bit = True
Else
strTemp = "Windows for 32bits"
'blnIsWin64bit = False
End If
End If
InfoVersion64bit = strTemp
End Function
Private Sub Form_Load()
MsgBox (InfoVersion64bit)
End Sub
Dim hMod as Long
hMod=GetModuleHandle("ntdll.dll")
if GetProcAddress(hMod,"ZwWow64ReadVirtualMemory64" Then
MsgBox "64位"
else
MsgBox "32位"
end if
LPSYSTEM_INFO lpSystemInfo=new SYSTEM_INFO;
GetNativeSystemInfo(lpSystemInfo);
if (lpSystemInfo->wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)//这个地方的常数值挺多的,但我的Inter 64位是这个值
//64位
else
//32位
//-------------------------
delete lpSystemInfo;