posted by 범벙이 2013. 1. 8. 21:52

아래에 이어서 2번째...

아래는 폴더째 7zip로 압축해서 SolveigMM Video Splitter 폴더가 2개가 생성 되었습니다..

 

이번엔 SolveigMM Video Splitter 폴더안의 파일만 압축 하는 방식 입니다..

그럼 폴더가 1개만 생성 되겠죠..

레지스트를 수정할 경우 문제가 복잡해 지기 때문에 폴더가

1개만 생성 되는게 좋겠습니다....

 

SolveigMM_Video_.au3

 

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
if _Singleton(@ScriptName,1) = 0 Then                         
    MsgBox(0, 'ERROR', '이미 프로그램이 실행중입니다.' ,1)  
    Exit                                                      
EndIf                                                         

$i = 1
while $i
$temp = @tempdir & "\SolveigMM Video Splitter"  
$i = FileExists($temp)   
WEnd
$unzip = $temp & "\7za.exe"  
$zip = $temp & "\SolveigMM Video Splitter.7z"  
$insreg = $temp & "\ins.reg"   
$delreg = $temp & "\del.reg"   
$run = $temp & "\SMMVSplitter.exe"  
DirCreate($temp)
FileSetAttrib(@TempDir & "\SolveigMM Video Splitter", "+S+H")  
FileInstall("7za.exe",$unzip,0)  
FileInstall("SolveigMM Video Splitter.7z",$zip,0)
RunWait( '"' & $unzip & '" x -t7z "' & $zip & '" -o"' & $temp & '"',"",@SW_HIDE)  
if FileExists($insreg) then   
RunWait('regedit /s ins.reg',$temp)  
endif
DirCreate(@HomeDrive & "\SolveigMM Video Splitter")  
DirCopy($temp & "\Solveig Multimedia", @HomeDrive & "\SolveigMM Video Splitter\Solveig Multimedia")
FileCopy($temp & "\aaa.dll", @HomeDrive & "\aaa.dll")
RunWait($run,$temp)
if FileExists($delreg) then  
RunWait('regedit /s del.reg',$temp)  
endif
while FileExists($temp)
DirRemove($temp,1)  
DirRemove(@HomeDrive & "\SolveigMM Video Splitter" ,1)
DirRemove(@AppDataDir & "\Solveig Multimedia" ,1)
FileDelete(@HomeDrive & "\aaa.dll")
Wend

Func _Singleton($sOccurenceName, $iFlag = 0)
    Local Const $ERROR_ALREADY_EXISTS = 183
    Local Const $SECURITY_DESCRIPTOR_REVISION = 1
    Local $handle, $lastError, $pSecurityAttributes = 0

    If BitAND($iFlag, 2) Then
        Local $structSecurityDescriptor = DllStructCreate("dword[5]")
        Local $pSecurityDescriptor = DllStructGetPtr($structSecurityDescriptor)
        Local $aRet = DllCall("advapi32.dll", "int", "InitializeSecurityDescriptor", _
                "ptr", $pSecurityDescriptor, "dword", $SECURITY_DESCRIPTOR_REVISION)
        If Not @error And $aRet[0] Then
            $aRet = DllCall("advapi32.dll", "int", "SetSecurityDescriptorDacl", _
                    "ptr", $pSecurityDescriptor, "int", 1, "ptr", 0, "int", 0)
            If Not @error And $aRet[0] Then
                Local $structSecurityAttributes = DllStructCreate("dword;ptr;int")
                DllStructSetData($structSecurityAttributes, 1, DllStructGetSize($structSecurityAttributes))
                DllStructSetData($structSecurityAttributes, 2, $pSecurityDescriptor)
                DllStructSetData($structSecurityAttributes, 3, 0)
                $pSecurityAttributes = DllStructGetPtr($structSecurityAttributes)
            EndIf
        EndIf
    EndIf

    $handle = DllCall("kernel32.dll", "int", "CreateMutex", "ptr", $pSecurityAttributes, "long", 1, "str", $sOccurenceName)
    $lastError = DllCall("kernel32.dll", "int", "GetLastError")
    If $lastError[0] = $ERROR_ALREADY_EXISTS Then
        If BitAND($iFlag, 1) Then
            Return SetError($lastError[0], $lastError[0], 0)
        Else
            Exit -1
        EndIf
    EndIf
    Return $handle[0]
EndFunc