Logo Eng2ita
ENG2ITA Community Versione lo-fi
18/01/2018, 13:05 *
Benvenuto, Visitatore. Per favore, effettua il login o registrati.
Hai perso la tua email di attivazione?

Login con username, password e lunghezza della sessione
E' stata disabilitata la ricerca ai visitatori! 
   Home   Sitemap Regolamento del forum Login Registrati  
Pagine: 1 
  Stampa  
Questo topic non e' stato ancora votato!
Non hai ancora votato questo topic. Seleziona una valutazione:
Autore Topic: Extract Cabinet Language Pack  (Letto 1367 volte)
0 Utenti e 1 Visitatore stanno guardando questo topic.
OnePiece
Hero Member
*****

Karma: -3278
Offline Offline

Post: 5219



« il: 25/01/2013, 03:20 »

lpkinstallEx.exe (Extract Cabinet Language Pack)
Aggiornato (Gennaio 25 2013)
Aggiornato (Gennaio 25 2013)
Aggiornato (Gennaio 25 2013)
Aggiornato (Gennaio 25 2013)
Aggiornato (Gennaio 25 2013)
Hash MD5 F05EA2F22BF68FD8BC3386AE9A8A16AD
Filesize: 370 KB (379127 byte)


per quelli che non vogliono includere il reshaker.exe nei loro exe, ecco un esempio (codice del lpkinstallEx.exe)
Codice:
;;OnePiece

#RequireAdmin

Global $aResName[1001][2] = [[0,1000]]

Local $lpkPath, $lpkFilename, $lpkBinary, $hFile

Local $lpkPath = FileOpenDialog("seleziona Language Pack Installer", @DesktopDir & "\", "Language Pack Installer (*.exe)", 1 + 4)
If @Error Then
    MsgBox(4096, "", "Nessun file di selezionato")
Exit
EndIf

$lpkFilename = FileGetVersion($lpkPath, "OriginalFilename")
If $lpkFilename = "" Then $lpkFilename = "LanguagePackInstaller.cab"
$lpkFilename = StringTrimRight($lpkFilename, 4) & ".cab"

$lpkBinary = _ResourceGetEx("", 10, 0, 0, $lpkPath)
If @Error Then
    MsgBox(16, "Error", @Error)
Exit
EndIf

$hFile = FileOpen(@DesktopDir & "\" & $lpkFilename, 26)
FileWrite($hFile, $lpkBinary)
FileClose($hFile)

;;;; http://msdn.microsoft.com/en-us/library/windows/desktop/ff468901%28v=vs.85%29.aspx
;;;; http://www.autoitscript.com/forum/topic/51103-resources-udf/
Func _ResourceGetEx($ResName, $ResType = 10, $ResLang = 0, $iFlags = 0, $DLL = -1) ; $RT_RCDATA = 10
Local $hInstance, $TypeResName = "wstr", $InfoBlock, $GlobalMemoryBlock, $MemoryPointer, $ResSize, $ResData, $aResult

If $DLL = -1 Then
$hInstance = DllCall("kernel32.dll", "handle", "GetModuleHandleW", "ptr", 0)
Else
$hInstance = DllCall("kernel32.dll", "handle", "LoadLibraryExW", "wstr", $DLL, "ptr", 0, "dword", 2)
EndIf
If @Error Or Not $hInstance[0] Then Return SetError(1, @Error, 0)
$hInstance = $hInstance[0]

If $ResName = "" Then
$aResName[0][0] = 0
_ResourceEnumNames($hInstance, $ResType)
If Not $aResName[0][0] Then Return SetError(3, 0, 0)
$ResName = $aResName[1][0]
If $aResName[1][1] Then $TypeResName = "int"
ElseIf StringIsDigit($ResName) Then
$ResName = "#" & Number($ResName)
EndIf

If $ResLang <> 0 Then
$InfoBlock = DllCall("kernel32.dll", "ptr", "FindResourceExW", "ptr", $hInstance, "int", $ResType, $TypeResName, $ResName, "WORD", $ResLang)
Else
$InfoBlock = DllCall("kernel32.dll", "ptr", "FindResourceW", "ptr", $hInstance, $TypeResName, $ResName, "int", $ResType)
EndIf
If @Error Or Not $InfoBlock[0] Then Return SetError(2, @Error, 0)
$InfoBlock = $InfoBlock[0]

$ResSize = DllCall("kernel32.dll", "dword", "SizeofResource", "ptr", $hInstance, "ptr", $InfoBlock)
If @Error Or Not $ResSize[0] Then Return SetError(3, @Error, 0)
$ResSize = $ResSize[0]

$GlobalMemoryBlock = DllCall("kernel32.dll", "ptr", "LoadResource", "ptr", $hInstance, "ptr", $InfoBlock)
If @Error Or Not $GlobalMemoryBlock[0] Then Return SetError(4, @Error, 0)
$GlobalMemoryBlock = $GlobalMemoryBlock[0]

$MemoryPointer = DllCall("kernel32.dll", "ptr", "LockResource", "ptr", $GlobalMemoryBlock)
If @Error Or Not $MemoryPointer[0] Then Return SetError(5, @Error, 0)
$MemoryPointer = $MemoryPointer[0]

If BitAND($iFlags, 1) = 1 Then
$ResData = DllStructGetData(DllStructCreate("char[" & $ResSize & "]", $MemoryPointer), 1)
ElseIf BitAND($iFlags, 2) = 2 Then
$ResData = DllStructGetData(DllStructCreate("wchar[" & $ResSize & "]", $MemoryPointer), 1)
Else
$ResData = DllStructGetData(DllStructCreate("byte[" & $ResSize & "]", $MemoryPointer), 1)
EndIf

If $DLL <> -1 Then DllCall("kernel32.dll", "bool", "FreeLibrary", "handle", $hInstance)
If @Error Then Return SetError(6, @Error, 0)

Return $ResData
EndFunc

Func _ResourceEnumNames($hModule, $iType)
Local $aRet, $hEnumProc = DllCallbackRegister('__EnumResNamesProc', 'int', 'ptr;ptr;ptr;long_ptr')
If IsString($hModule) Then
$hModule = DllCall("kernel32.dll", "handle", "LoadLibraryExW", "wstr", $hModule, "ptr", 0, "dword", 2)
If @Error Or $hModule[0] = 0 Then Return SetError(1, DllCallbackFree($hEnumProc), 0)
$aRet = DllCall("kernel32.dll", "int", "EnumResourceNamesW", "ptr", $hModule[0], "int", $iType, "ptr", DllCallbackGetPtr($hEnumProc), "long_ptr", 0)
DllCallbackFree($hEnumProc)
DllCall("kernel32.dll", "bool", "FreeLibrary", "handle", $hModule[0])
Else
$aRet = DllCall("kernel32.dll", "int", "EnumResourceNamesW", "ptr", $hModule, "int", $iType, "ptr", DllCallbackGetPtr($hEnumProc), "long_ptr", 0)
DllCallbackFree($hEnumProc)
EndIf
EndFunc

Func __EnumResNamesProc($hModule, $pType, $pName, $lParam)
#forceref $hModule, $pType, $lParam
Local $aRet = DllCall("kernel32.dll", "int", "lstrlenW", "ptr", $pName)
If @Error Or Not $aRet[0] Then
$aResName[0][0] += 1
$aResName[$aResName[0][0]][0] = Number($pName)
$aResName[$aResName[0][0]][1] = 1
Else
$aResName[0][0] += 1
$aResName[$aResName[0][0]][0] = DllStructGetData(DllStructCreate("wchar[" & ($aRet[0] + 1) & "]", $pName), 1)
EndIf
If $aResName[0][0] = $aResName[0][1] Then
$aResName[0][1] *= 2
ReDim $aResName[$aResName[0][1]  + 1][2]
EndIf
Return 1
EndFunc

per di pi
http://msdn.microsoft.com/en-us/library/windows/desktop/ff468901%28v=vs.85%29.aspx
http://www.autoitscript.com/forum/topic/51103-resources-udf/
http://www.autoitscript.com/forum/topic/98712-winapiex-udf/

Ciao a tutti.
« Ultima modifica: 25/01/2013, 03:36 da OnePiece » Loggato

   
ENG2ITA Community
« il: 25/01/2013, 03:20 »

 Loggato
Pagine: 1 
  Stampa  
 
Salta a:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines | Sitemap XHTML 1.0 Valido! CSS Valido!

Eng2ita.net - Tutti i diritti riservati 2006-2015   |   Privacy policy |   Licenza Creative Commons