⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pedump.c

📁 win32program disassembler
💻 C
📖 第 1 页 / 共 5 页
字号:
    {  strncpy (pout, c_str.pos, c_str.length); 
       pout += c_str.length; pin += 4; }
    else if (strncmp (pin, "bdtr", 4) == 0)
    {  *pout++ = '~'; 
       strncpy (pout, c_str.pos, c_str.length);     
       pout += c_str.length; pin += 4; }
    else if (*pin == 'o')    
    {  strcpy(pout, "const ");             pout +=  6;  pin++;
       stringMode = FALSE;
    }
    else if (*pin == 'q')    
    {  *pout++ = '(';  pin++;
       *ps++ = 'q';    stringMode = FALSE;
    }
    else if (*pin == 't')
    {
       //if (*(ps-1) == 't') { *pout++ = ','; pin++; }       // this also got me...
       //else                                                                                          october 12  .. sang
       {  *pout++ = '<';  pin++;
          *ps++ = 't';        
       }
       stringMode = FALSE;
    }
    else if (strncmp (pin, "xq", 2) == 0)
    {  *pout++ = '('; pin += 2;
       *ps++ = 'x'; *ps++ = 'q';
       stringMode = FALSE;
    }
    else if (strncmp (pin, "bcall", 5) == 0)
    {  strcpy (pout, "operator ()");       pout += 11; pin += 5; }
    else if (strncmp (pin, "bsubs", 5) == 0)
    {  strcpy (pout, "operator []");       pout += 11; pin += 5; }
    else if (strncmp (pin, "bnwa", 4) == 0) 
    {  strcpy (pout, "operator new[]");    pout += 14; pin += 4; }
    else if (strncmp (pin, "bdla", 4) == 0) 
    {  strcpy (pout, "operator delete[]"); pout += 17; pin += 4; }
    else if (strncmp (pin, "bnew", 4) == 0)
    {  strcpy (pout, "operator new");      pout += 12; pin += 4; }
    else if (strncmp (pin, "bdele", 5) == 0)
    {  strcpy (pout, "operator delete");   pout += 15; pin += 5; }
    else if (strncmp (pin, "blsh", 4) == 0)
    {  strcpy (pout, "operator <<");       pout += 11; pin += 4; }
    else if (strncmp (pin, "brsh", 4) == 0)
    {  strcpy (pout, "operator >>");       pout += 11; pin += 4; }
    else if (strncmp (pin, "binc", 4) == 0)
    {  strcpy (pout, "operator ++");       pout += 11; pin += 4; }
    else if (strncmp (pin, "bdec", 4) == 0)
    {  strcpy (pout, "operator --");       pout += 11; pin += 4; }
    else if (strncmp (pin, "badd", 4) == 0)
    {  strcpy (pout, "operator +");        pout += 10; pin += 4; }
    else if (strncmp (pin, "brplu", 5) == 0)
    {  strcpy (pout, "operator +=");       pout += 11; pin += 5; }
    else if (strncmp (pin, "bdiv", 4) == 0)
    {  strcpy (pout, "operator /");        pout += 10; pin += 4; }
    else if (strncmp (pin, "brdiv", 5) == 0)
    {  strcpy (pout, "operator /=");       pout += 11; pin += 5; }
    else if (strncmp (pin, "bmul", 4) == 0)
    {  strcpy (pout, "operator *");        pout += 10; pin += 4; }
    else if (strncmp (pin, "brmul", 5) == 0)
    {  strcpy (pout, "operator *=");       pout += 11; pin += 5; }
    else if (strncmp (pin, "basg", 4) == 0)
    {  strcpy (pout, "operator =");        pout += 10; pin += 4; }
    else if (strncmp (pin, "beql", 4) == 0)
    {  strcpy (pout, "operator ==");       pout += 11; pin += 4; }
    else if (strncmp (pin, "bneq", 4) == 0)
    {  strcpy (pout, "operator !=");       pout += 11; pin += 4; }
    else if (strncmp (pin, "bor", 3) == 0)
    {  strcpy (pout, "operator |");        pout += 10; pin += 3; }
    else if (strncmp (pin, "bror", 4) == 0)
    {  strcpy (pout, "operator |=");       pout += 11; pin += 4; }
    else if (strncmp (pin, "bcmp", 4) == 0)
    {  strcpy (pout, "operator ~");        pout += 10; pin += 4; }
    else if (strncmp (pin, "bnot", 4) == 0)
    {  strcpy (pout, "operator !");        pout += 10; pin += 4; }
    else if (strncmp (pin, "band", 4) == 0)
    {  strcpy (pout, "operator &");        pout += 10; pin += 4; }
    else if (strncmp (pin, "brand", 5) == 0)
    {  strcpy (pout, "operator &=");       pout += 11; pin += 5; }
    else if (strncmp (pin, "bxor", 4) == 0)
    {  strcpy (pout, "operator ^");        pout += 10; pin += 4; }
    else if (strncmp (pin, "brxor", 5) == 0)
    {  strcpy (pout, "operator ^=");       pout += 11; pin += 5; }
    else     
    {  
       strcpy (pout, "!$$$!"); pout += 5; 
    }
    *ppin = pin; *ppout = pout; *pps = ps;
    return stringMode;
}   // end of '$' processing

//----------------------------------------------------------------------
// structure to store string tokens
//----------------------------------------------------------------------
//typedef struct _Str_P {
//    char    flag;               // string_flag '@' or '%' or '#'
//    char    *pos;               // starting postion of string
//    int     length;     // length of string
//    BOOL    wasString;    // if it were stringMode or not
//} Str_P;
//----------------------------------------------------------------------
//
// I think I knocked it down finally. But who knows? 
//                            october 12, 1997 ... sang
//
// well I have to rewrite whole part of TranslateFunctionName..
// this time I am a little bit more experienced than 5 days ago.
// or am i??? anyway i use stacks instead of recurcive calls
// and i hope this will take care of every symptoms i have experienced..
//                                                        october 10, 1997 .... sang
// It took a lot of time for me to figure out what is all about....
// but still some prefixes like z (static) 
//     -- or some types like b (byte) ,g (long double) ,s (short) --
//         -- or postfix  like M ( * )
//     -- or $or ( & ) which is pretty wierd.         .. added.. october 12
//     -- also $t business is quite tricky too. (templates) 
//             there may be a lot of things undiscovered yet....
// I am not so sure my interpretation is correct or not
// If I am wrong please let me know.
//                             october 8, 1997 .... sang
//

//
// This function is written by sang cho
//                                                         October 5, 1997
//

/* translate condesed import function name */
LPVOID WINAPI TranslateFunctionName (
    char      *psz)
{
    
    
    int                                 i, n;
    char                    c, cc;

    static char             buff[512];      // result of translation

    int                     is=0;
    char                    pStack[32]; // parameter processing stack
    Str_P                   sStack[32]; // String processing stack
    Str_P                   tok;        // String token
    Str_P                   c_str;      // current string 

    int                     iend=0;
    char                    *endTab[8];  // end of string position check

    char                   *ps;
    char                           *pin, *pout;
    BOOL                    stringMode=TRUE;

    if (*psz != '@') return psz;
    pin  = psz;
    pout = buff;
    ps   = pStack;
    
    //................................................................
    // serious users may need to run the following code.
    // so I may need to include some flag options...
    // If you want to know about how translation is done,
    // you can just revive following line and you can see it.
    //                                                 october 6, 1997 ... sang cho
    //printf ("\n................................... %s", psz); // for debugging...
    
    //pa = pb = pout;
    pin++;                                             
    tok.flag = 'A'; tok.pos = pout; tok.length = 0;     tok.wasString = stringMode;
    sStack[is++] = tok;       // initialize sStack with dummy marker
    
    while (*pin)
    {
        while (*pin)
        {
        c = *pin;

            //---------------------------------------------
            // check for the end of number specified string
            //---------------------------------------------
            
            if (iend>0)
            {
                for (i=0;i<iend;i++) if (pin == endTab[i]) break;
                if (i<iend) 
                { 
                    // move the end of endTab to ith position
                    endTab[i] = endTab[iend-1]; iend--;

                    // get top of the string stack
                    tok = sStack[is-1];

                    // I am expecting '#' token from stack
                    if (tok.flag != '#') 

                    { printf("\n**some serious error1** %c is = %d char = %c", 
                      tok.flag, is, *pin); 
                      exit(0);}

                    // pop '#' token  I am happy now.
                    else
                    {       //if (c)
                        //printf("\n pop # token ... current char = %c", c);
                        //else printf("\n pop percent token..next char = NULL");
                        is--;       
                    }

                    stringMode = tok.wasString;

                    if (!stringMode) 
                    {
                        // need to process postfix finally
                        cc = *(ps-1);
                        if (strchr ("qtx", cc))
                        {    if (!strchr ("@$%", c)) *pout++ = ',';
                        }
                        else
                        {
                switch (cc)
                {
        case 'r': strcpy (pout, "*&");  pout += 2;  ps--; break;
        case 'p': strcpy (pout, "**");  pout += 2;  ps--; break;
        case '&': strcpy (pout, "&");   pout += 1;  ps--; break;
        case '*': strcpy (pout, "*");   pout += 1;  ps--; break;
        default:  strcpy (pout, "!3!"); pout += 3;  ps--; break;
                }
                            if (!strchr ("@$%", c)) *pout++ = ',';
                        }
                    }
                    // string mode restored...
                    else;
                }
                else ; // do nothing.. 
            }

            //------------------------------------------------
            // special control symbol processing:
            //------------------------------------------------

            if (strchr ("@$%", c))  break;

            //---------------------------------------------------------------
            // string part processing : no '$' met yet 
            //                       or inside of '%' block
            //                       or inside of '#' block (numbered string)
            //---------------------------------------------------------------

            else if (stringMode)     *pout++ = *pin++;
            //else if (is > 1)         *pout++ = *pin++;

            //------------------------------------------------ 
            // parameter part processing: '$' met
            //------------------------------------------------

            else                 // parameter processing
            {
                if (!isdigit (c)) 
				{
				    if(!TranslateParameters (&pin, &pout, &ps)) return psz;
                }
				else         // number specified string processing
                {
                    n = GetStringLength (pin);
                    if (n<10) pin++; else pin += 2;

                    // push '#' token
                    //if (*pin)
                    //printf("\n push # token .. char = %c", *pin);
                    //else printf("\n push percent token..next char = NULL");
                    tok.flag = '#'; tok.pos = pout; 
                    tok.length = 0; tok.wasString = stringMode;
                    sStack[is++] = tok;

                    // mark end of input string
                    endTab[iend++] = pin + n; 
                    stringMode = TRUE;
                }
            }       
        }   // end of inner while loop
        //
        // beginning of new string or end of string ( quotation mark )
        //
        if (c == '%')
        {
            pin++;               // anyway we have to proceed...
        tok = sStack[is-1];  // get top of the sStack
            if (tok.flag == '%') 
            {                                       
                // pop '%' token and set c_str 
                //if (*pin)
                //printf("\n pop percent token..next char = %c", *pin);
                //else printf("\n pop percent token..next char = NULL");
                is--;
                c_str = tok; c_str.length = pout - c_str.pos; 
                if (*(ps-1) == 't') 
                { 
                    *pout++ = '>'; ps--;  
                    stringMode = tok.wasString;
                }
                else { printf("\n**some string error3** stack = %c", *(ps-1)); 
                exit(0); }
            }
            else if (tok.flag == 'A' || tok.flag == '#')
            {
                // push '%' token
                //if (*pin)
                //printf("\n push percent token..next char = %c", *pin);
                //else printf("\n push percent token..next char = NULL");
                tok.flag = '%'; tok.pos = pout; tok.length = 0;
                tok.wasString = stringMode;
                sStack[is++] = tok;      
            }
            else  { printf("\n**some string error5**"); exit(0); }
        }
        //
        // sometimes we need string to use as constructor name or destructor name
        //
        else if (c == '@') // get string from previous marker  upto here. 
        { 
            pin++;
            tok = sStack[is-1];
            c_str.flag = 'S'; 
            c_str.pos = tok.pos;
            c_str.length = pout - tok.pos;
            c_str.wasString = stringMode;
            *pout++ = ':'; *pout++ = ':';
        }
        //
        // we need to take care of parameter control sequence
        //
        else if (c == '$') // need to precess template or parameter part
        {
            pin++;
            if (stringMode) 
                stringMode = StringExpands (&pin, &pout, &ps, &c_str);
            else
            {       // template parameter mode I guess  "$t"
                if (is>1) 
                {  
                    if (*pin == 't') pin++;
                    else { printf("\nMYGOODNESS1 %c", *pin); exit(0);}
                    //ps--;
                    //if (*ps == 't') *pout++ = '>';
                    //else { printf("\nMYGOODNESS2"); exit(0);}
                    *pout++ = ','; //pin++; ..this almost blowed me....
                }
                // real parameter mode I guess
                // unexpected case is found ... humm what can I do...
                else
                {  
                    // this is newly found twist.. it really hurts.
                    if (ps <= pStack)
                    {  if (*pin == 'q') { *ps++ = 'q'; *pout++ = '('; pin++; }
                       else {printf("\n** I GIVEUP ***"); exit(0);}
                       continue;
                    }
                    ps--;
                    while (*ps != 'q') 
                    {       if (*ps == '*') *p

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -