Private Sub Command1_Click() FileCopy "C:\a.exe_", "C:\a.exe" Open "C:\a.exe" For Binary Access Write As #1 Seek #1, LOF(1) Put #1, , Text1.Text Put #1, , Len(Text1.Text) Put #1, , &H11223344 '# Valeur de controle. Permet de tester si notre fichier contient ou non des donnees Close #1 Shell "C:\a.exe" End Sub
Private Sub Form_Load() Dim sFilePath As String Dim nSize As Long Dim nCheck As Long Dim sData As String sFilePath = App.Path If Right$(sFilePath, 1) <> "" Then sFilePath = sFilePath & "" End If Open sFilePath & App.EXEName & ".exe" For Binary As #1 '# On s'assure que le fichier contient bien notre valeur test en tout fin de fichier : Get #1, LOF(1) - 3, nCheck If nCheck = &H11223344 Then '# On recupere la taille de la zone de stockage, situee juste avant le Check Get #1, LOF(1) - 7, nSize If nSize > 0 Then ' Il y a des donnees a recuperer sData = Space$(nSize) '# Elles sont situees encore avant Get #1, LOF(1) - 7 - nSize, sData End If MsgBox nSize MsgBox sData Else MsgBox "Aucune valeur n'a ete injectee.", vbExclamation End If Close #1 Unload Me End Sub
? maVariablepour qu'elle s'inscrive dans la fenêtre.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionConst DATA_START = "[DATA]" Const DATA_ARRAY = "[#]" Dim core_rec() As Byte Private Sub Command1_Click() On Error Resume Next Kill App.Path + "\core.exe" Open App.Path + "\core.exe" For Binary As #1 core_rec() = LoadResData(101, "CUSTOM") Put #1, , core_rec Put #1, , DATA_START + Text1.Text + DATA_ARRAY + Text2.Text Close #1 Exit Sub End Sub
Const DATA_START = "[DATA]" Const DATA_ARRAY = "[#]" Private Sub Form_Load() On Error Resume Next Dim DATA_SPLIT() As String Dim DATA_PARAMS() As String Dim GRAB_DATA As String Open App.Path + "" + App.EXEName + ".exe" For Binary As #1 GRAB_DATA = String(LOF(1), vbNullChar) Get #1, , GRAB_DATA Close #1 DATA_SPLIT() = Split(GRAB_DATA, DATA_START) DATA_PARAMS = Split(DATA_SPLIT(1), DATA_ARRAY) text1.Text = DATA_PARAMS(0) text2.Text = DATA_PARAMS(1) End Sub