[help]open file/exe as binary data send through winsock and write back to file

Discussion in 'Archives' started by halojunkie, Jun 27, 2007.

[help]open file/exe as binary data send through winsock and write back to file
  1. Unread #1 - Jun 27, 2007 at 3:49 AM
  2. halojunkie
    Joined:
    Dec 17, 2005
    Posts:
    232
    Referrals:
    0
    Sythe Gold:
    0

    halojunkie Active Member

    [help]open file/exe as binary data send through winsock and write back to file

    I need the code to open a file as binary data. Such as an exe or jpg.
    The send through winsock i pretty much got

    and the receive...but how would i recompile into original format?
     
  3. Unread #2 - Jun 27, 2007 at 4:27 AM
  4. Jazz00006
    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0

    Jazz00006 Apprentice
    Visual Basic Programmers

    [help]open file/exe as binary data send through winsock and write back to file

    assuming you have the recive data correctly coded:

    Code:
    WriteInfo App.Path & "\lol.exe", ENTIREDATAHERE
    Code:
    Public Sub WriteInfo(ByVal EXEPath As String, ByVal WriteData As Variant)
        Dim lonFF As Long, lonLen As Long
       
        'Get an available file handle.
        lonFF = FreeFile
        'Start the file length at 0
        lonLen = 0
       
        'Open the EXE file in binary write mode because it is a binary file.
        Open EXEPath For Binary Access Write As #lonFF
            'Write the data to the end of the file.
            Put #lonFF, (lonLen + 1), WriteData
        Close #lonFF 'Close the file.
       
    End Sub
     
  5. Unread #3 - Jun 28, 2007 at 1:05 PM
  6. halojunkie
    Joined:
    Dec 17, 2005
    Posts:
    232
    Referrals:
    0
    Sythe Gold:
    0

    halojunkie Active Member

    [help]open file/exe as binary data send through winsock and write back to file

    Thank you Jazz!
     
< free acc training | <~ipod's training-questing-mming~> >

Users viewing this thread
1 guest


 
 
Adblock breaks this site