Jump to content
Tuts 4 You

Problem when creating Loader in Purebasic


Pushad

Recommended Posts

Posted

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

 

Posted

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.

Posted

Thank you so much Rogers

Posted

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

  • Like 3

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
×
×
  • Create New...