#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    25
    Rep Power
    0

    Problem with code


    I have some codes which I don't know how to continue writing. The code goes like this:

    HRSRC hrSrc = FindResource(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_LOCKUP_EXE), "Exe");
    HGLOBAL hGlobal = LoadResource(AfxGetResourceHandle(), hrSrc);
    LPVOID lpExe = LockResource(hGlobal);

    CFile file;
    file.Open("C:\Testing.exe", CFile::modeCreate | CFile::modeWrite | CFile::shareDenyNone);
    file.Write(lpExe, (UINT)SizeofResource(AfxGetResourceHandle(), hrSrc));
    file.Close();

    HANDLE hExe = LoadLibrary("C:\Testing.exe");
    HRSRC hrSrc2 = FindResource(hExe, MAKEINTRESOURCE(IDR_LOCK_FILE), "LOCKFILE");
    HGLOBAL hGlobal2 = LoadResource(hExe, hrSrc2);
    LPVOID lpExe2 = LockResource(hGlobal2);

    LPBYTE sExe2 = (LPBYTE)lpExe2;
    LPTSTR sExe3 = (LPTSTR)sExe2;

    CFile file2;
    file2.Open("C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe", CFile::typeBinary | CFile::modeRead | CFile::shareDenyNone);

    CFile file3;
    file3.Open(sExe3, CFile::modeWrite | CFile::shareDenyNone);
    file3.Write(???);
    file3.Close;

    For the ???, what should I put in there so that I can insert the AcroRd32.exe as a binary resource into Testing.exe (I don't want to add in the resource manually)? Or should I rewrite some parts of the code?
  2. #2
  3. No Profile Picture
    Offensive Member
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2002
    Location
    in the perfect world
    Posts
    622
    Rep Power
    28
    Is this some trojan ect? (IDR_LOCKUP_EXE) sounds bad.

    Convince me otherwise and I will tell you what is wrong.

    Otherwise PO!

    seems very similar to

    this
    The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.

    Frank Zappa
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    25
    Rep Power
    0
    Ya. That thread that you refered to is also posted by me. I have already solved the creating of another exe. I just need to solve the problem of storing a file with an exe. This is surely not a trojan. I need to do this program because it is part of my homework. So what is the solution to the problem that you have seen?
  6. #4
  7. not a fan of fascism (n00b)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Feb 2003
    Location
    ct
    Posts
    2,756
    Rep Power
    95
    why is everyone so judgemental around here? even if it were a Trojan its still programming. *sigh*
    Last edited by infamous41md; September 9th, 2003 at 12:04 AM.
  8. #5
  9. No Profile Picture
    Offensive Member
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2002
    Location
    in the perfect world
    Posts
    622
    Rep Power
    28
    >>even if it were a Trojan its still programming.

    Fine. But I don't have to help if it is.

    >>HRSRC hrSrc = FindResource(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_LOCKUP_EXE), "Exe");

    This line is wrong.
    The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.

    Frank Zappa

IMN logo majestic logo threadwatch logo seochat tools logo