Jump to content
Tuts 4 You
Sign in to follow this  
Pushad

Problem when creating Loader in Purebasic

Recommended Posts

Pushad

i create a loader in vb6 and it work but in purebasic not working

this in vb6

Dim ProcExecS As Long
ProcExecS = CreateProcess("File.exe", ByVal 0&, ByVal 0&, ByVal 0&, 1&, NORMAL_PRIORITY_CLASS, ByVal 0&, sNull, sInfo, pInfo)
If ProcExecS Then
WriteProcessMemory pInfo.hProcess, &H47DBF4, &HEB19, 2, 0&
WriteProcessMemory pInfo.hProcess, &H47DBF4 + 2, &H9090, 2, 0&
WriteProcessMemory pInfo.hProcess, &H47DBF4 + 4, &H9090, 2, 0&
CloseHandle pInfo.hProcess
End If

this in PB

ProcExecS = CreateProcess_("File.exe", $0, #NUL, #NUL, #False, NORMAL_PRIORITY_CLASS, #NUL, #NUL, @StartInfo, @ProcessInfo)

If ProcExecS 
WriteProcessMemory_(ProcessInfo\hProcess, $47DBF4, $EB19, 2, $0)
WriteProcessMemory_(ProcessInfo\hProcess, $47DBF4 + 2, $9090, 2, $0)
WriteProcessMemory_(ProcessInfo\hProcess, $47DBF4 + 4, $9090, 2, $0)
CloseHandle_(ProcessInfo\hProcess)
EndIf

 

Share this post


Link to post
Teddy Rogers

Not much to work off from your code snippet. Are you sure you have write access?

ProcessInfo.PROCESS_INFORMATION
StartInfo.STARTUPINFO

If CreateProcess_("C:\upx.exe", #Null, #Null, #Null, #False, #CREATE_SUSPENDED, #Null, #Null, @StartInfo, @ProcessInfo)
  If ReadProcessMemory_(ProcessInfo\hProcess, $400000, @lpBuffer1.w, 2, #Null)
    If WriteProcessMemory_(ProcessInfo\hProcess, $410000, @lpBuffer1.w, 2, #Null)
      
      ; Verify we have written the read bytes to the destination address...
      
      If ReadProcessMemory_(ProcessInfo\hProcess, $410000, @lpBuffer2.w, 2, #Null)
        Debug "Read Bytes : $" + lpBuffer1
        Debug "Write Bytes : $" + lpBuffer2
      EndIf
      
    EndIf
  EndIf
  
  If lpBuffer2
    ResumeThread_(ProcessInfo\hThread)
  Else
    TerminateProcess_(ProcessInfo\hProcess, #Null)
  EndIf
  
  CloseHandle_(ProcessInfo\hProcess)
EndIf

Ted.

Share this post


Link to post
Pushad

Thank you so much Rogers

Share this post


Link to post
Nemo

Popad .. (sorry i have a stupid sense of humour.. lol)

  • Like 3

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×
×
  • Create New...