DEP checking/enabling/disabling
Can anyone help me with issue. How I can check if DEP is enable, after that to disable it during the installation or something like that.
11 posts
!define PF_NX_ENABLED 12
System::Call kernel32::IsProcessorFeaturePresent(i${PF_NX_ENABLED})i.r0
${If} $0 != 0
DetailPrint "NX enabled"
${Else}
DetailPrint "NX disabled"
${EndIf}
I'm guessing there is some undocumented function that can be used on XP.SP2 and 2003 (See http://www.hanselman.com/blog/TheWee...gleChrome.aspx and http://www.uninformed.org/?v=2&a=4 for details about setting per process DEP on these systems)Originally Posted by Istaria View Post; take note that XP SP3 and earlier do not have this function, and return result is "error"
System::Call '*2147353301(&i1.r7)'
DetailPrint Policy=$7
;Get The DataExecutionPrevention Setting.
ReadRegDword $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\NoExecuteState" "LastNoExecuteRadioButtonState"
;Value Description
;----------------- ------------------------------------------------------------------
;0x000036BC(14012) DEP Is Enabled For Essential Windows Programs And Services Only.
;0x000036BD(14013) DEP Is Enabled For All Programs And Services Except Those Seleced.
;Blank Setting Not Found, Add Program Anyway, Just To be Sure.
;Check If Data Execution Prevention Is Enabled.
${Select} $0
${Case} "14012"
;Do Not Alter Registry Without Systems Adminstrator Consent.
;Enable DEP.
;WriteRegDWord HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\NoExecuteState" "LastNoExecuteRadioButtonState" 0x000036BD
;Add Your .exe To The Data Execution Prevention List.
;WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$EXE_DIR\$EXE_NAME" "DisableNXShowUI"
${Case} "14013"
;Add Your .exe To The Data Execution Prevention List.
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$EXE_DIR\$EXE_NAME" "DisableNXShowUI"
${CaseElse}
;Add Your .exe To The Data Execution Prevention List In Case It Is Enabled Later On.
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$EXE_DIR\$EXE_NAME" "DisableNXShowUI"
${EndSelect}