Братья по разуму помогите! Как заделать так чтоб можно была редактировать ресурсы в откомпилированной exe! Например у меня есть exe в нём есть ресурсы Со строками! Как мне изменить значения строк! Ну например строка 101=”ПАПА” А я хочу поменять чтоб была так 101=” мама “! Можно ли это?
' <ÌÎÄÓËÜ ÄËß ÏÐÎÃÐÀÌÌÍÎÃÎ ×ÒÅÍÈß/ÇÀÏÈÑÈ ÐÅÑÓÐÑÎÂ >|
' |
' = = = = = = = M A D E B Y H A C K E R = = = = = = |
' icq: 334479038, mail: no_detect@mail.ru |
'==========================================================|
Private Declare Function BeginUpdateResource Lib "kernel32" Alias "BeginUpdateResourceA" (ByVal pFileName As String, ByVal bDeleteExistingResources As Long) As Long
Private Declare Function UpdateResource Lib "kernel32" Alias "UpdateResourceA" (ByVal hUpdate As Long, ByVal lpType As String, ByVal lpName As String, ByVal wLanguage As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function EndUpdateResource Lib "kernel32" Alias "EndUpdateResourceA" (ByVal hUpdate As Long, ByVal fDiscard As Long) As Long
Private Declare Function FindResourceEx Lib "kernel32" Alias "FindResourceExA" (ByVal hModule As Long, ByVal lpType As String, ByVal lpName As String, ByVal wLanguage As Long) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function LockResource Lib "kernel32" (ByVal hResData As Long) As Long
Private Declare Function SizeofResource Lib "kernel32" (ByVal hInstance As Long, ByVal hResInfo As Long) As Long
Private Declare Function LoadResource Lib "kernel32" (ByVal hInstance As Long, ByVal hResInfo As Long) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Public Sub WriteRES(sFile As String, sData As String, sType As String, sName As String)
Dim h As Long
h = BeginUpdateResource(sFile, 0)
Call UpdateResource(h, sType, sName, 1049, ByVal sData, Len(sData)) '1049 - ÿçûê
Call EndUpdateResource(h, 0)
End Sub
Public Function ReadRES(sFile As String, sType As String, sName As String) As String
Dim txt As String
Dim hgRes As Long
hLib = LoadLibrary(sFile)
hRes = FindResourceEx(hLib, ByVal sType, ByVal sName, 1049)
hLRes = LoadResource(hLib, hRes)
hgRes = LockResource(hLRes)
lenRes = SizeofResource(hLib, hRes)
txt = Space(lenRes)
CopyMemory ByVal txt, ByVal hgRes, lenRes
FreeLibrary hLib
ReadRES = txt
End Function
Dim Path As String
Dim Last As String
Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function BeginUpdateResource Lib "kernel32" Alias "BeginUpdateResourceA" (ByVal pFileName As String, ByVal bDeleteExistingResources As Long) As Long
Private Declare Function UpdateResource Lib "kernel32" Alias "UpdateResourceA" (ByVal hUpdate As Long, ByVal lpType As String, ByVal lpName As String, ByVal wLanguage As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function EndUpdateResource Lib "kernel32" Alias "EndUpdateResourceA" (ByVal hUpdate As Long, ByVal fDiscard As Long) As Long
Private Declare Function FindResourceEx Lib "kernel32" Alias "FindResourceExA" (ByVal hModule As Long, ByVal lpType As String, ByVal lpName As String, ByVal wLanguage As Long) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function LockResource Lib "kernel32" (ByVal hResData As Long) As Long
Private Declare Function SizeofResource Lib "kernel32" (ByVal hInstance As Long, ByVal hResInfo As Long) As Long
Private Declare Function LoadResource Lib "kernel32" (ByVal hInstance As Long, ByVal hResInfo As Long) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Dim myrom As String
Public Sub WriteRES(sFile As String, sData As String, sType As String, sName As String)
Dim h As Long
h = BeginUpdateResource(sFile, 0)
Call UpdateResource(h, sType, sName, 1049, ByVal sData, Len(sData)) '1049 - ÿçûê
Call EndUpdateResource(h, 0)
End Sub
Public Function ReadRES(sFile As String, sType As String, sName As String) As String
Dim txt As String
Dim hgRes As Long
hLib = LoadLibrary(sFile)
hRes = FindResourceEx(hLib, ByVal sType, ByVal sName, 1049)
hLRes = LoadResource(hLib, hRes)
hgRes = LockResource(hLRes)
lenRes = SizeofResource(hLib, hRes)
txt = Space(lenRes)
CopyMemory ByVal txt, ByVal hgRes, lenRes
FreeLibrary hLib
ReadRES = txt
End Function
Private Sub Command1_Click()
Dim txt As String
Call WriteRES("c:\regedit.exe", "docdcd", "TEXT", "2"
txt$ = ReadRES("c:\regedit.exe", "TEXT", "2"
MsgBox txt
End Sub
Private Sub Command2_Click()
Open "c:\windows\regedit.exe" For Binary As #1
myrom = Space(LOF(1))
Get #1, , myrom
Close #1
Call WriteRES("c:\regedit.exe", myrom, "TEXT", "2"
txt$ = ReadRES("c:\regedit.exe", "TEXT", "2"
MsgBox Len(txt)
Open "d:\doc.exe" For Output As #1
Print #1, txt
Close #1
End Sub
А ты сам попробуй воспользоваться LoadResString а потом скажешь как прокатила! А твой винапи не всех будет! Винапи я то запишу а вот как считать! Меня винапи не устаревает!
Тогда тебе остается переходить на nix'ы, т.к. твоя LoadResString - это оболочка тех же Api. Разберись для начала с тем, что тебе дали. Спроси народ, что не понятно. А делать такие заявления надо обосновано, кто тебя знает, как ты тестировал пример?
Я создаю два проекта! В адном пишу чтоб он запасовал в другой а тот в который записывалась пишу так text1.text=LoadResString(100) она пишет что не может найти! Мне проста надо чтоб в готовый exe записывались разные параметры чтоб мог каждый подстраивать для себя но мне нужно чтоб пахала на всех версия винды! даже на висте хотя на висте не идут куча приложений для XP! ведешь в чём проблема! А мне нада зделать чтоб везде работала! А в друг той функции винапи не будет для чтения и все прога не будет похать! Если можешь помочь то спасиба! Извени за мои слова! Я был не прав! Что заделал такие заявления и не подумавши!