Skip to content

Instantly share code, notes, and snippets.

@sredna
Last active August 20, 2019 18:39
Show Gist options
  • Save sredna/eed0a8e3a12754db8dc033faea02a5f2 to your computer and use it in GitHub Desktop.
Save sredna/eed0a8e3a12754db8dc033faea02a5f2 to your computer and use it in GitHub Desktop.
Temp
System::Get '(m.r1)ir2r0'
Pop $9
Var /global tries
again:
intop $tries $tries + 1
System::Call 'kernel32::EnumSystemLocalesA(k r9, i 0)i.r0' ; K$9 will be Cloned. PrepareProc:PT_NOTHING changes proc from K$9 to clone
loop:
StrCpy $2 $0 8 ; v2 callback id hack
StrCmp $2 "callback" 0 done
#DetailPrint "Locale: $1"
StrCpy $2 1 ; EnumLocalesProc return value
System::Call $9 ; return from EnumLocalesProc | << (m.r1) part issue | Param#1 in clone is AllocStr'ed.
Goto loop
done:
StrCmp $tries 42 0 again
System::Free $9 ; This never frees the clone
/*
Why is the AllocStr param never marked as something that needs to be released?
Why does ParamsDeAllocate only free '*' pointer types?
Trying to free with ParamsDeAllocate in System::Free on the clone helps a little bit but does not fix everything.
*/
;-----
; W32 long path test
ManifestLongPathAware true #docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#<windowsSettings xmlns:ws2="https://schemas.microsoft.com/SMI/2016/WindowsSettings"><ws2:longPathAware>true</ws2:longPathAware></windowsSettings>
Page Components
Page InstFiles
Section "Info"
ReadRegStr $0 HKEY_LOCAL_MACHINE "System\CurrentControlSet\Policies" "LongPathsEnabled" #superuser.com/questions/1119883/windows-10-enable-ntfs-long-paths-policy-option-missing
DetailPrint "Registry(Old)=$0"
ReadRegStr $0 HKEY_LOCAL_MACHINE "System\CurrentControlSet\Control\FileSystem" "LongPathsEnabled"
DetailPrint "Registry=$0"
System::Call 'NTDLL::RtlAreLongPathsEnabled()b.r0'
DetailPrint "RtlAreLongPathsEnabled=$0"
SectionEnd
!include LogicLib.nsh
Section /o "Create Win32 Long Path"
StrCpy $1 ""
StrCpy $2 "c:\test"
${Do}
IntOp $1 $1 + 1
IntFmt $3 "%.2u" $1
StrCpy $2 "$2\$3______"
StrLen $3 $2
${If} $3 U> 260
DetailPrint "DBG:Exceeded 260, stopping."
${Break}
${EndIf}
ClearErrors
CreateDirectory $2
${IfThen} ${Errors} ${|} ${Break} ${|}
SetOutPath $2
${Loop}
SetOutPath $SysDir
${Do}
ClearErrors
RMDir $2
${IfThen} ${Errors} ${|} ${Break} ${|}
GetFullPathName $2 "$2\.."
${Loop}
SectionEnd
;-----
; DllGetVersion
!include LogicLib.nsh
!macro PrintDllGetVersion dllpath
System::Call *(&l4,i0,i,i,i)p.r1
System::Call 'KERNEL32::LoadLibrary(t "${dllpath}")p.s'
System::Call 'KERNEL32::GetProcAddress(pss,m "DllGetVersion")p.r3'
${If} $3 P<> 0
System::Call '::$3(pr1)'
${EndIf}
System::Call 'KERNEL32::FreeLibrary(ps)'
System::Call '*$1(i,i.R1,i.R2,i.R3)'
System::Free $1
DetailPrint "$R1.$R2.$R3 ${dllpath}"
!macroend
!insertmacro PrintDllGetVersion "$SysDir\SHDOCVW.dll"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment