Alternative data streams
How can i delete alternative data stream Zone.Identifier using NSIS?
6 posts
!include Win\COM.nsh
Section
!ifndef CLSID_PersistentZoneIdentifier
!define CLSID_PersistentZoneIdentifier {0968e258-16c7-4dba-aa86-462dd61e31a3}
!endif
!ifndef IID_IZoneIdentifier
!define IID_IZoneIdentifier {cd45f185-1b21-48e2-967b-ead743a8914e}
${NSISCOMIFACEDECL}IZoneIdentifier GetId 3 (*i)i
${NSISCOMIFACEDECL}IZoneIdentifier SetId 4 (i)i
${NSISCOMIFACEDECL}IZoneIdentifier Remove 5 ()i
!endif
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_PersistentZoneIdentifier} ${IID_IZoneIdentifier} r0 ""
${If} $0 P<> 0
${IZoneIdentifier::Remove} $0 '()'
${IUnknown::QueryInterface} $0 '("${IID_IPersistFile}",.r1)'
${If} $1 P<> 0
${IPersistFile::Save} $1 '("C:\mypath\myfile.txt",1)'
${IUnknown::Release} $1 ""
${EndIf}
${IUnknown::Release} $0 ""
${EndIf}
SectionEnd As a hack you can use the .ini function directly to just remove the zone:System::Call 'KERNEL32::WritePrivateProfileString(t "ZoneTransfer", t "ZoneId", p 0, t "C:\test.txt:Zone.Identifier")' or the entire zone section:System::Call 'KERNEL32::WritePrivateProfileString(t "ZoneTransfer", p 0, p 0, t "C:\test.txt:Zone.Identifier")' (Does NOT delete the stream unlike IZoneIdentifier::Remove)System::Call 'KERNEL32::DeleteFile(t"C:\test.txt:secret")' You cannot use the NSIS native instructions because they don't allow the stream suffix in paths.where do you find this?Originally Posted by Anders View PostThere is a documented API
It is documented on MSDN. I just made the NSIS definitions for you.Originally Posted by mnga View Post
where do you find this?