ZMRS Class

Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    Mako is insane. ThePhailure772 is offline
    MemberRank
    Sep 2007 Join Date
    1,115Posts

    ZMRS Class

    Alright so, I'm currently working on an open-source MRS class. I started on it last night and I'm now up to reading the file + extracting it. I still need to add checking to see if the archive is a ZIP, MRS, or encrypted. I'll be adding a little method for you to place your won encryption for the MRS files, and soon I'll be moving Gunz to 7z as ColdFX keeps bitching at me to do.

    Example of ZMRS.cpp:

    Code:
    #include "Stdafx.h"
    #include "ZMRS.h"
    
    ZMRS::ZMRS(char *szFile)
    {
        FHeaderTemp = new FileHeader( );
        EndOfDir = new EndOfDirectory( );
        MRS *zMRS = new MRS( );
    
        FileHandle = CreateFileA ( szFile, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, 0 );
        
        if ( FileHandle == INVALID_HANDLE_VALUE ) return;
    
        SetFilePointer ( FileHandle, -22, NULL, FILE_END );
        Temp = (unsigned char *)malloc(26);
    
        if(readData (Temp,26))
        {
            memcpy ( EndOfDir,Temp,26);
            if ( EndOfDir->Signature == 0x5030208 )
            {
                SetFilePointer(FileHandle,(EndOfDir->SizeOfDirectory + EndOfDir->ZipFileCommentLen + 22) * -1,NULL,FILE_END);
                FileCount = EndOfDir->NumOfFiles;
                
                for ( int i = 0; i < FileCount; i++)
                {
    
                    if (!readData(FHeaderTemp,46))
                        return;
                    strcpy ( FHeaderTemp->FileName , getString ( FHeaderTemp->FileNameLen ));
                    FHeaderTemp->FileName[FHeaderTemp->FileNameLen] = 0;
                    strcpy(zMRS->szFile,FHeaderTemp->FileName);
                    zMRS->dwCRC = FHeaderTemp->CRC332;
                    zMRS->dwMagic = FHeaderTemp->RelativeOffset;
    
                    MRSFiles.push_back(zMRS);
                    zMRS = new MRS( );
                    FHeaderTemp = new FileHeader( );
    
                }
    
            }
        }
    }
    
    ZMRS::~ZMRS(void)
    {
    }
    
    void ZMRS::decryptData ( BYTE *pBuffer, int iLen)
    {
        for ( ; iLen >= 0; iLen--, pBuffer++ )
            *pBuffer = ~static_cast<unsigned char>((*pBuffer>>3)|(*pBuffer<<5));
    }
    
    void ZMRS::encryptData ( BYTE *pBuffer, int iLen)
    {
        for ( ; iLen >= 0; iLen--, pBuffer++ )
            *pBuffer = ~static_cast<unsigned char>((*pBuffer>>5)|(*pBuffer<<3));
    }
    
    
    bool ZMRS::readData ( void *pBuffer, int iLen )
    {
        DWORD dwReadBytes = 0;
    
        if (!ReadFile ( FileHandle, pBuffer, iLen, &dwReadBytes, NULL))
            return false;
    
        unsigned char *mall = (unsigned char *)malloc ( dwReadBytes );
        memcpy ( mall, pBuffer, dwReadBytes );
        decryptData ( mall , dwReadBytes );
        memcpy ( pBuffer, mall, dwReadBytes);
        return true;
    }
    
    char *ZMRS::getString ( int iCount )
    {
        char *szBuffer = ( char * ) malloc ( iCount );
        ZeroMemory ( szBuffer , iCount );
        if ( !readData ( szBuffer, iCount ) ) return NULL;
        return szBuffer;
    }
    
    void ZMRS::printData ( )
    {
        for each (MRS *mrs in MRSFiles)
        {
            printf ("File: [%s]. CRC32: [%u]. Relative Offset: [%u]\n",mrs->szFile, mrs->dwCRC, mrs->dwMagic);
        }
    }

    A lot of thanks to T6 for helping me out, lol. Also, Buga and Coldfx don't come bitching about me not freeing the memory. I was having slight issues with using free(); Like in readData(); I did:
    Code:
    free(&mall);
    and I get a heap error. Was annoying so I just left it.


  2. #2
    Reverse Engineer ThievingSix is offline
    MemberRank
    Mar 2007 Join Date
    CaliforniaLocation
    901Posts

    Re: ZMRS Class

    There is already an open source MRS class out there. People just won't use it....

    Also I really don't see the benefits of 7z..waste of time.

    Move the stuff(signatures, sizes, etc) to constants.

    Why are you reading to a temp variable then moving it..?

    Drop the FILE_FLAG's, they don't work like they should.

    Why are you zeroing memory right before you fill it with something..?

    Why are you allowing a delete share when you are reading from the file..?


    Kay, done with rant lmfao. I'm up really late so don't mind me xD

  3. #3
    Account Upgraded | Title Enabled! Guy is offline
    MemberRank
    Apr 2009 Join Date
    919Posts

    Re: ZMRS Class

    Quote Originally Posted by ThievingSix View Post
    There is already an open source MRS class out there. People just won't use it....

    Also I really don't see the benefits of 7z..waste of time.

    Move the stuff(signatures, sizes, etc) to constants.

    Why are you reading to a temp variable then moving it..?

    Drop the FILE_FLAG's, they don't work like they should.

    Why are you zeroing memory right before you fill it with something..?

    Why are you allowing a delete share when you are reading from the file..?


    Kay, done with rant lmfao. I'm up really late so don't mind me xD
    Considering the boost you receive for file compression over MZIP, ZIP, RAR, etc I'd consider that a pretty substantial benefit.

    And I already pointed Jacob to CBWhiz'z old makeshift function - granted, there's still been others, iirc..

    Also, why aren't you using free()?!

  4. #4
    Reverse Engineer ThievingSix is offline
    MemberRank
    Mar 2007 Join Date
    CaliforniaLocation
    901Posts

    Re: ZMRS Class

    Eh size isn't a big deal to me is all, probably is to others xD.

    "And I already pointed Jacob to CBWhiz'z old makeshift function - granted, there's still been others, iirc.."

    ?

  5. #5
    Account Upgraded | Title Enabled! Guy is offline
    MemberRank
    Apr 2009 Join Date
    919Posts

    Re: ZMRS Class

    Quote Originally Posted by ThievingSix View Post
    Eh size isn't a big deal to me is all, probably is to others xD.

    "And I already pointed Jacob to CBWhiz'z old makeshift function - granted, there's still been others, iirc.."

    ?
    There is already an open source MRS class out there. People just won't use it....
    Jacob's problems on MSN were mainly encrypting/decrypting the MZIP archive - I recommended he take a look at the couplet of functions for encryption/decryption CB had released eons ago - or, just take a look at the source of the projects you've worked on, relating to MZIP.

  6. #6
    Mako is insane. ThePhailure772 is offline
    MemberRank
    Sep 2007 Join Date
    1,115Posts

    Re: ZMRS Class

    Quote Originally Posted by gWX0 View Post
    Jacob's problems on MSN were mainly encrypting/decrypting the MZIP archive - I recommended he take a look at the couplet of functions for encryption/decryption CB had released eons ago - or, just take a look at the source of the projects you've worked on, relating to MZIP.
    No my main issue was using zlib and read what I said about free() nab

  7. #7
    Reverse Engineer ThievingSix is offline
    MemberRank
    Mar 2007 Join Date
    CaliforniaLocation
    901Posts

    Re: ZMRS Class

    I gave you zlib source...do you want source on how to use it? Should have juts asked.

  8. #8
    Mako is insane. ThePhailure772 is offline
    MemberRank
    Sep 2007 Join Date
    1,115Posts

    Re: ZMRS Class

    It was before that when I was having issues, lol. It was like 4 pm when I talked to him

  9. #9
    Account Upgraded | Title Enabled! Guy is offline
    MemberRank
    Apr 2009 Join Date
    919Posts

    Re: ZMRS Class

    Quote Originally Posted by ThePhailure772 View Post
    No my main issue was using zlib and read what I said about free() nab
    That's not what she said.

  10. #10
    Proficient Member Gunner54 is offline
    MemberRank
    Aug 2006 Join Date
    183Posts

    Re: ZMRS Class

    The point of making this project of yours public is 0... as T6 said. No one used his. I doub't many people will know how to compile it anyway. People can already write their own encryptions. When they write their encryption into this, they will ask how they can write it into their Gunz.exe

    You might aswell keep it a private project...

  11. #11
    Account Upgraded | Title Enabled! Guy is offline
    MemberRank
    Apr 2009 Join Date
    919Posts

    Re: ZMRS Class

    Quote Originally Posted by Gunner54 View Post
    The point of making this project of yours public is 0... as T6 said. No one used his. I doub't many people will know how to compile it anyway. People can already write their own encryptions. When they write their encryption into this, they will ask how they can write it into their Gunz.exe

    You might aswell keep it a private project...
    Part of the project is a signature searcher for finding the MRS algorithm in a specific client, then replacing it.

    Anyways, this topic is just intended to provide assistance to Phail - not to convince him to quit his project altogether.

  12. #12
    Reverse Engineer ThievingSix is offline
    MemberRank
    Mar 2007 Join Date
    CaliforniaLocation
    901Posts

    Re: ZMRS Class

    Quote Originally Posted by gWX0 View Post
    Anyways, this topic is just intended to provide assistance to Phail - not to convince him to quit his project altogether.
    Damn, I seemed to miss the entire point of this thread =(

  13. #13
    Proficient Member Gunner54 is offline
    MemberRank
    Aug 2006 Join Date
    183Posts

    Re: ZMRS Class

    You might aswell keep it a private project...
    Thats why i said that ^

  14. #14
    Account Upgraded | Title Enabled! Guy is offline
    MemberRank
    Apr 2009 Join Date
    919Posts

    Re: ZMRS Class

    Quote Originally Posted by Gunner54 View Post
    Thats why i said that ^
    That has nothing to do with what anyone has said..

  15. #15
    Account Upgraded | Title Enabled! shortymant is offline
    MemberRank
    Nov 2008 Join Date
    606Posts

    Re: ZMRS Class

    Quote Originally Posted by Gunner54 View Post
    The point of making this project of yours public is 0... as T6 said. No one used his. I doub't many people will know how to compile it anyway. People can already write their own encryptions. When they write their encryption into this, they will ask how they can write it into their Gunz.exe

    You might aswell keep it a private project...
    I tried T6's delphi sources, but I'm not at delphi yet...
    And yes, there are people that would know how to use this.



Page 1 of 2 12 LastLast

Advertisement