Ветеран
Сообщения: 604
Благодарности: 133
|
Профиль
|
Отправить PM
| Цитировать
amel27
Помоги пожалуйста, пытаюсь создать zip-архив:
Код: 
$hDLL = DllOpen("zip32.dll")
$hCallBack_Print = DllCallbackRegister("_Print", "int", "str;long")
$hCallBack_Password = DllCallbackRegister("_Password", "int", "str;int;str;str")
$hCallBack_Comment = DllCallbackRegister("_Comment", "int", "str")
$hCallBack_Progress = DllCallbackRegister("_Progress", "int", "str;long")
$ZIPUSERFUNCTIONS = DllStructCreate("ptr print;ptr pwd;ptr comment;ptr progress")
DllStructSetData($ZIPUSERFUNCTIONS, "print", DllCallbackGetPtr($hCallBack_Print))
DllStructSetData($ZIPUSERFUNCTIONS, "pwd", DllCallbackGetPtr($hCallBack_Password))
DllStructSetData($ZIPUSERFUNCTIONS, "comment", DllCallbackGetPtr($hCallBack_Comment))
DllStructSetData($ZIPUSERFUNCTIONS, "progress", DllCallbackGetPtr($hCallBack_Progress))
$ZPOPT = DllStructCreate("ptr Date;ptr szRootDir;ptr szTempDir;int fTemp;int fSuffix;int fEncrypt;int fSystem;int fVolume;" & _
"int fExtra;int fNoDirEntries;int fExcludeDate;int fIncludeDate;int fVerbose;int fQuiet;int fCRLFLF;" & _
"int fLFCRLF;int fJunkDir;int fGrow;int fForce;int fMove;int fDeleteEntries;int fUpdate;int fFreshen;" & _
"int fJunkSFX;int fLatestTime;int fComment;int fOffsets;int fPrivilege;int fEncryption;int fRecurse;" & _
"int fRepair;byte fLevel")
$Date = DllStructCreate("char[256]")
DllStructSetData($Date, 1, "07/10/08")
$RootDir = DllStructCreate("char[256]")
DllStructSetData($Date, 1, "D:\Work\UnZIP")
$TempDir = DllStructCreate("char[256]")
DllStructSetData($TempDir, 1, "D:\Work\UnZIP")
$Level = DllStructCreate("char[1]")
DllStructSetData($Level, 1, 9)
DllStructSetData($ZPOPT, "Date", DllStructGetPtr($Date))
DllStructSetData($ZPOPT, "szRootDir", DllStructGetPtr($RootDir))
DllStructSetData($ZPOPT, "szTempDir", DllStructGetPtr($TempDir))
DllStructSetData($ZPOPT, "fTemp", 0)
;DllStructSetData($ZPOPT, "fSuffix", 0)
DllStructSetData($ZPOPT, "fEncrypt", 0)
DllStructSetData($ZPOPT, "fSystem", 1)
DllStructSetData($ZPOPT, "fVolume", 0)
DllStructSetData($ZPOPT, "fExtra", 1)
DllStructSetData($ZPOPT, "fNoDirEntries", 0)
DllStructSetData($ZPOPT, "fExcludeDate", 1)
DllStructSetData($ZPOPT, "fIncludeDate", 0)
DllStructSetData($ZPOPT, "fVerbose", 0)
DllStructSetData($ZPOPT, "fQuiet", 0)
DllStructSetData($ZPOPT, "fCRLFLF", 0)
DllStructSetData($ZPOPT, "fLFCRLF", 0)
DllStructSetData($ZPOPT, "fJunkDir", 0)
DllStructSetData($ZPOPT, "fGrow", 0)
DllStructSetData($ZPOPT, "fForce", 0)
DllStructSetData($ZPOPT, "fMove", 0)
DllStructSetData($ZPOPT, "fDeleteEntries", 0)
DllStructSetData($ZPOPT, "fUpdate", 0)
DllStructSetData($ZPOPT, "fFreshen", 0)
DllStructSetData($ZPOPT, "fJunkSFX", 0)
DllStructSetData($ZPOPT, "fLatestTime", 0)
DllStructSetData($ZPOPT, "fComment", 0)
DllStructSetData($ZPOPT, "fOffsets", 0)
DllStructSetData($ZPOPT, "fPrivilege", 0)
DllStructSetData($ZPOPT, "fEncryption", 0)
DllStructSetData($ZPOPT, "fRecurse", 1)
DllStructSetData($ZPOPT, "fRepair", 0)
DllStructSetData($ZPOPT, "fLevel", 0)
$aRet = DllCall($hDLL, "int", "ZpSetOptions", "ptr", DllStructGetPtr($ZPOPT))
ConsoleWrite($aRet[0] & @LF)
;$aRet = DllCall($hDLL, "int", "ZpGetOptions", "ptr", DllStructGetPtr($ZPOPT))
;ConsoleWrite($aRet[0] & @LF)
$aRet = DllCall($hDLL, "int", "ZpInit", "ptr", DllStructGetPtr($ZIPUSERFUNCTIONS))
ConsoleWrite($aRet[0] & @LF)
;============================ZpArchive()==========================================================
$ArchName = DllStructCreate("char[256]")
DllStructSetData($ArchName, 1, "test.zip")
$FileName = DllStructCreate("char[256]")
DllStructSetData($FileName, 1, "test.jpg")
$ZpArchive_Struct = DllStructCreate("int count;ptr arc;ptr file")
DllStructSetData($ZpArchive_Struct, "count", 1)
DllStructSetData($ZpArchive_Struct, "arc", DllStructGetPtr($ArchName))
DllStructSetData($ZpArchive_Struct, "file", DllStructGetPtr($FileName))
$aRet = DllCall($hDLL, "int", "ZpArchive", "ptr", DllStructGetPtr($ZpArchive_Struct))
ConsoleWrite("!> ZpArchive: " & $aRet[0] & @LF)
;=============================================================================================
DllCallbackFree($hCallBack_Print)
DllCallbackFree($hCallBack_Password)
DllCallbackFree($hCallBack_Comment)
DllCallbackFree($hCallBack_Progress)
Func _Print($sFile, $sPos)
ConsoleWrite($sFile & @LF)
EndFunc
Func _Password($sPWD, $sX, $sS2, $sName)
ConsoleWrite("Password" & @LF)
EndFunc
Func _Comment($sComment)
ConsoleWrite("!> File " & $sComment & " is overwrite" & @LF)
EndFunc
Func _Progress($sName, $sSize)
ConsoleWrite("---> Arch name: " & $sName & @LF & _
"---> Pos: " & $sSize & @LF)
EndFunc
Прилагаю dll-ку и help-файл
|