/* DriveGet, Type, Type, %A_WinDir% Type: "REMOVABLE" (可移动) "FIXED" (内置盘) "NETWORK" (网络盘) "CDROM" (光驱) "RAMDISK" (内存盘) */ MsgBox, % "系统盘为:" (DriveIsSDD(A_WinDir)?"固态":"机械") MsgBox % "系统内存容量:" GetPhysicallyInstalledSystemMemory() return DriveIsSDD(vDrive){ local if InStr(vDrive, ":\") SplitPath, vDrive,,,,, vDrive else if (StrLen(vDrive) = 1) vDrive .= ":" ;FILE_SHARE_DELETE := 0x4 ;FILE_SHARE_WRITE := 0x2 ;FILE_SHARE_READ := 0x1 ;OPEN_EXISTING := 3 hDev := DllCall("kernel32\CreateFile" (A_IsUnicode?"W":"A"), WStr,"\\.\" vDrive, UInt,0, UInt,0x7, Ptr,0, UInt,3, UInt,0, Ptr,0, Ptr) if (hDev = -1) || (ErrorLevel != 0) return ;StorageDeviceSeekPenaltyProperty := 7 ;PropertyStandardQuery := 0 VarSetCapacity(STORAGE_PROPERTY_QUERY, vSizeQ:=12, 0) NumPut(7, &STORAGE_PROPERTY_QUERY, 0, "Int") ;PropertyId VarSetCapacity(DEVICE_SEEK_PENALTY_DESCRIPTOR, vSizeD:=12, 0) vBytesRet := 0 ;IOCTL_STORAGE_QUERY_PROPERTY := 0x002D1400 if DllCall("kernel32\DeviceIoControl", Ptr,hDev, UInt,0x002D1400, Ptr,&STORAGE_PROPERTY_QUERY, UInt,vSizeQ, Ptr,&DEVICE_SEEK_PENALTY_DESCRIPTOR, UInt,vSizeD, UIntP,vBytesRet, Ptr,0) { DllCall("kernel32\CloseHandle", Ptr,hDev) return !NumGet(DEVICE_SEEK_PENALTY_DESCRIPTOR, 8, "UChar") ;IncursSeekPenalty } ;check: ;IOCTL_ATA_PASS_THROUGH := 0x0004D02C ;ATA_PASS_THROUGH_EX ;IDENTIFY_DEVICE_DATA - NominalMediaRotationRate ;Sending ATA commands directly to device in Windows? - Stack Overflow ;https://stackoverflow.com/questions/5070987/sending-ata-commands-directly-to-device-in-windows DllCall("kernel32\CloseHandle", Ptr,hDev) return 0 } GetPhysicallyInstalledSystemMemory(){ ;获取内存条内存大小 if !(DllCall("kernel32.dll\GetPhysicallyInstalledSystemMemory", "UInt64*", TotalMemory)) return DllCall("kernel32.dll\GetLastError") return Floor(TotalMemory/1024**2)>0?Ceil(TotalMemory/1024**2) "G":Ceil(TotalMemory/1024) "K" }
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。
评论(0)