最新消息:

CPUFeatures为NSIS提供获取cpu信息的插件

nsis 永恒心锁 2354浏览 0评论
!define /date BUILD_DATE "%Y-%m-%d"
Caption "CPUFeatures Test-Suite"
BrandingText "Built on ${BUILD_DATE}"
!addincludedir "....Include"
!ifdef NSIS_UNICODE
!addplugindir "....PluginsRelease_Unicode"
OutFile "CPUFeatures-Unicode.exe"
!else
!addplugindir "....PluginsRelease_ANSI"
OutFile "CPUFeatures-ANSI.exe"
!endif
; include first in order to enable LogicLib support
!include "LogicLib.nsh"
; include to enable CPUFeatures functions
!include "CPUFeatures.nsh"
RequestExecutionLevel user
ShowInstDetails show
; Query basic CPU information
Section
DetailPrint "--- Test #1 ---"
${CPUFeatures.GetFlags} $0
DetailPrint "CPU Flags: $0"
${CPUFeatures.GetCount} $0
DetailPrint "CPU Count: $0"
${CPUFeatures.GetFeatures} $0
DetailPrint "CPU Features: $0"
${CPUFeatures.GetVendor} $0
DetailPrint "CPU Vendor: $0"
SectionEnd
; Check individual feature flags
; Find a list of supported feature flags in CPUFeatures.nsh!
Section
DetailPrint "--- Test #2 ---"
${CPUFeatures.CheckFeature} "MMX1" $0
DetailPrint "Has MMX: $0"
${CPUFeatures.CheckFeature} "MMX2" $0
DetailPrint "Has MMX2: $0"
${CPUFeatures.CheckFeature} "SSE1" $0
DetailPrint "Has SSE: $0"
${CPUFeatures.CheckFeature} "SSE2" $0
DetailPrint "Has SSE2: $0"
${CPUFeatures.CheckFeature} "SSE3" $0
DetailPrint "Has SSE3: $0"
${CPUFeatures.CheckFeature} "SSSE3" $0
DetailPrint "Has SSSE3: $0"
${CPUFeatures.CheckFeature} "SSE4.2" $0
DetailPrint "Has SSE4.2: $0"
${CPUFeatures.CheckFeature} "AVX1" $0
DetailPrint "Has AVX: $0"
${CPUFeatures.CheckFeature} "AVX2" $0
DetailPrint "Has AVX2: $0"
${CPUFeatures.CheckFeature} "3DNOW" $0
DetailPrint "Has 3DNOW: $0"
${CPUFeatures.CheckFeature} "3DNOW_EX" $0
DetailPrint "Has 3DNOW_EX: $0"
${CPUFeatures.CheckFeature} "FMA3" $0
DetailPrint "Has FMA3: $0"
${CPUFeatures.CheckFeature} "FMA4" $0
DetailPrint "Has FMA4: $0"
; Next call is supposed to fail!
${CPUFeatures.CheckFeature} "SSE7" $0
DetailPrint "Has SSE7: $0"
SectionEnd
; Check multiple features at once
; Returns only "yes", if *all* features are supported
Section
DetailPrint "--- Test #3 ---"
${CPUFeatures.CheckAllFeatures} "MMX1,SSE1" $0
DetailPrint "Has MMX+SSE: $0"
${CPUFeatures.CheckAllFeatures} "MMX1,3DNOW" $0
DetailPrint "Has MMX1+3DNOW: $0"
${CPUFeatures.CheckAllFeatures} "MMX1,SSE1,SSE2,SSE3,SSSE3" $0
DetailPrint "Has MMX+SSE+SSE2+SSE3+SSSE3: $0"
${CPUFeatures.CheckAllFeatures} "MMX1,SSE1,SSE2,SSE3,SSSE3,SSE4" $0
DetailPrint "Has MMX+SSE+SSE2+SSE3+SSSE3+SSE4: $0"
; Next call is supposed to fail!
${CPUFeatures.CheckAllFeatures} "MMX1,SSE1,SSE2,SSE3,SSSE3,SSE7" $0
DetailPrint "Has MMX+SSE+SSE2+SSE3+SSSE3+SSE7: $0"
SectionEnd
; Use LogicLib to check CPU features
Section
DetailPrint "--- Test #4 ---"
${If} ${CPUSupports} "MMX1"
DetailPrint "This CPU spports MMX"
${EndIf}
${If} ${CPUSupports} "SSE1"
DetailPrint "This CPU spports SSE"
${EndIf}
${If} ${CPUSupports} "SSSE3"
DetailPrint "This CPU spports SSSE3"
${EndIf}
${If} ${CPUSupports} "3DNOW"
DetailPrint "This CPU spports SSSE3"
${EndIf}
${If} ${CPUSupports} "AVX1"
DetailPrint "This CPU spports AVX"
${EndIf}
${If} ${CPUSupportsAll} "MMX1,SSE1"
DetailPrint "This CPU spports MMX+SSE"
${EndIf}
${If} ${CPUSupportsAll} "MMX1,3DNOW"
DetailPrint "This CPU spports MMX+3DNOW"
${EndIf}
${If} ${CPUSupportsAll} "MMX1,SSSE3"
DetailPrint "This CPU spports MMX+SSSE3"
${EndIf}
${If} ${CPUSupportsAll} "MMX1,AVX1"
DetailPrint "This CPU spports MMX+AVX"
${EndIf}
${If} ${CPUIsIntel}
DetailPrint "This CPU is an Intel"
${EndIf}
${If} ${CPUIsAMD}
DetailPrint "This CPU is an AMD"
${EndIf}
SectionEnd
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » CPUFeatures为NSIS提供获取cpu信息的插件

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址