[EMAIL PROTECTED] wrote:

Heh-heh... uhh.. actually I was having it screendump the information
to the client.  Which, yes, was messy... and extremely slow.

How can I do a memory dump of what (mp.dll? my_hack.dll?) is doing?
(Sorry, I'm new to this).  I'm guessing that I would also need to
know what was contained at the beginning of pvPrivateData in order to
tell where the relative location is.

I guess my question really is what tool(s)/method(s) do I need to do
this?

Offset 0 in pvPrivateData is the start of the MOD DLL C++ class data members. You can do a memory dump by doing something like this...

void PrintBuffer(char *pData, int length, char *pBuffer)
{
        int index;
        char *pDataPrev;

        *pBuffer = 0;
        pDataPrev = pData;

        for (index = 0; index < length; index++)
        {
                if (index % 16 == 8)
                   sprintf(pBuffer, "-%02X", (unsigned char)*pData);
                else
                   sprintf(pBuffer, " %02X", (unsigned char)*pData);

                pBuffer += 3;
                pData++;

                if ((index+1) % 16 == 0)
                {
                        *pBuffer++ = ' ';
                        *pBuffer++ = ' ';
                        *pBuffer++ = '|';

                        while (pDataPrev < pData)
                        {
                                if ((*pDataPrev >= ' ') && (*pDataPrev <= '~'))
                                        *pBuffer++ = *pDataPrev++;
                                else
                                {
                                        *pBuffer++ = '.';
                                        pDataPrev++;
                                }
                        }

                        *pBuffer++ = '|';
                        *pBuffer++ = '\n';
                }
        }

        if ((length % 16) != 0)
        {
                for (index=(length % 16); index < 16; index++)
                {
                        *pBuffer++ = ' ';
                        *pBuffer++ = ' ';
                        *pBuffer++ = ' ';
                }

                *pBuffer++ = ' ';
                *pBuffer++ = ' ';
                *pBuffer++ = '|';

                while (pDataPrev < pData)
                {
                        if ((*pDataPrev >= ' ') && (*pDataPrev <= '~'))
                                *pBuffer++ = *pDataPrev++;
                        else
                        {
                                *pBuffer++ = '.';
                                pDataPrev++;
                        }
                }

                for (index=(length % 16); index < 16; index++)
                        *pBuffer++ = ' ';

                *pBuffer++ = '|';
                *pBuffer++ = '\n';
        }

        *pBuffer = 0;
}


void Dump(void *pvPrivateData) { char *pData; char print_buffer[80]; FILE *fp;

   pData = pvPrivateData;
   fp = fopen("output.txt", "a");
   fprintf(fp, "Dumping bytes...\n\n");

   for (int lines=0; lines < 64; lines++)
   {
      // dump 16 bytes at a time...
      PrintBuffer(pData, 16, print_buffer);
      fprintf(fp, "%06x: s", lines*16, print_buffer);
      pData += 16;
   }
   fclose(fp);
}

--
Jeffrey "botman" Broome


_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders



Reply via email to