最新消息:

NSIS 检测注册表键存在

nsis 永恒心锁 1088浏览 0评论
; OpenReg.nsi
; 检查某注册表键是否存在的NSIS例子
;--------------------------------
;定义注册表主键
!define HKEY_CLASSES_ROOT 0x80000000
!define HKEY_CURRENT_USER 0x80000001
!define HKEY_LOCAL_MACHINE 0x80000002
!define HKEY_USERS 0x80000003

OutFile OpenReg.exe

XPStyle on

!include LogicLib.nsh

;--------------------------------
Name OpenReg

Section Nil
SectionEnd

Function .onInit
System::Call "*(i 0) i .R0"
Push "SOFTWARE\TENCENT\QQPinYin"
system::call 'Advapi32::RegOpenKey(i ${HKEY_LOCAL_MACHINE}, t s, i R0) .iR1'
system::call 'Advapi32::RegCloseKey(i R0)'
system::free
${If} $R1 == 0
Messagebox mb_ok "Key Exists!"
${ElseIf} $R1 == 2
Messagebox mb_ok "Key doesn't Exists!"
${Else}
Messagebox mb_ok "error!"
${EndIf}
Pop $R1
Pop $R0
Quit
FunctionEnd
永恒心锁,版权所有丨如未注明,均为转载丨本网站采用BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » NSIS 检测注册表键存在

您必须 登录 才能发表评论!