!include "MUI2.nsh" !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_LANGUAGE "Russian" OutFile "ns_setup.exe" ShowInstDetails show !macro ANSIToUTF8 SOURCE_STRING OUTPUT_STRING Push `${SOURCE_STRING}` System::Store SR2 System::Call "kernel32::MultiByteToWideChar(i0,i0,tR2,i-1,i0,i0)i.R1" IntOp $R1 $R1 * 2 System::Alloc $R1 Pop $R0 System::Call "kernel32::MultiByteToWideChar(i0,i0,tR2,i-1,iR0,iR1)" System::Call "kernel32::WideCharToMultiByte(i65001,i0,iR0,i-1,t.s,iR1,i0,i0)" System::Free $R0 System::Store L Pop `${OUTPUT_STRING}` !macroend Function .OnInit InitPluginsDir File "/oname=$PLUGINSDIR\unarc.dll" "unarc.dll" FunctionEnd Section !insertmacro ANSIToUTF8 "$EXEDIR\MiniGames.arc" "$R8" ;указываем путь к архиву.. Call ArcAbout Call ArcExtract SectionEnd Function ArcAbout System::Get "(t.r1,i.r4,i.r3,iR6)iss" Pop $R0 System::Call "$PLUGINSDIR\unarc::FreeArcExtract(kR0,t'l',t'--',tR8,t,t,t,t,t,t,t)i.s" ${Do} Pop $0 ${IfThen} $0 == "1" ${|}${Break}${|} ${If} $1 == "password?" abort ${ElseIf} $1 == "origsize" System::Call "shlwapi::StrFormatByteSize64(lr3,t.r3,i${NSIS_MAX_STRLEN})" StrCpy $7 $3 ${Break} ${ElseIf} $1 == "total_files" StrCpy $6 $4 ${EndIf} Push 1 System::Call $R0 ${Loop} FunctionEnd Function ArcExtract SetDetailsPrint textonly GetDlgItem $R5 $HWNDPARENT 1037 GetDlgItem $R6 $HWNDPARENT 1038 System::Get "(t.r1,i.r2,i.r3,t.r4)iss" Pop $R0 System::Call "$PLUGINSDIR\unarc::FreeArcExtract(kR0,t'x',t'-o+',tR8,t'-dp$R9',t,t,t,t,t)i.s" StrCpy $5 0 ${Do} Pop $0 ${IfThen} $0 == "1" ${|}${Break}${|} ${IfThen} $0 == "-1" ${|}${Break}${|} ${Select} $1 ${Case2} "error" "" MessageBox MB_ICONSTOP|MB_OK "$4" IDOK ${Break} ${Case} "filename" IntOp $5 $5 + 1 ${If} $3 <> 0 System::Call "user32::OemToChar(tr4,t.r4)" System::Call "shlwapi::StrFormatByteSize64(lr3,t.r8,i${NSIS_MAX_STRLEN})" DetailPrint "$4 [$8]" ${EndIf} ${Case} "write" System::Call "shlwapi::StrFormatByteSize64(lr3,t.r3,i${NSIS_MAX_STRLEN})" ${If} $3 != $R1 SendMessage $R5 ${WM_SETTEXT} 0 `STR:Размер архива $3/$7` StrCpy $R1 $3 ${EndIf} ${If} $5 != $R2 SendMessage $R6 ${WM_SETTEXT} 0 `STR:Файлов и папок: $5/$6` StrCpy $R2 $5 ${EndIf} ${EndSelect} Push 1 System::Call $R0 ${Loop} System::Free $R0 StrCmp $2 0 +3 MessageBox MB_ICONSTOP "Error code $2 $1 -$0" Abort SetDetailsPrint lastused FunctionEnd |