示例#1
0
void CStatistic::ReplacePlaceholders( CString & szUrl, const CString & szType, const CString & szAction )
{
    if (szUrl.IsEmpty())
    {
        ATLASSERT(FALSE);
        return;
    }

    if (m_szPID.IsEmpty())
    {
        m_szPID = GetPID();
    }

    if (m_szMID.IsEmpty())
    {
        GetMID(m_szMID.GetBufferSetLength(MAX_PATH), MAX_PATH);
    }

    if (m_szAppVer.IsEmpty())
    {
        WCHAR szFile[MAX_PATH] = {};
        GetModuleFileName(g_hModule, szFile, MAX_PATH);
        PathRemoveFileSpec(szFile);
        PathRemoveFileSpec(szFile);
        PathAppend(szFile, APP_NAME);

        GetFileVer(szFile, m_szAppVer.GetBufferSetLength(MAX_PATH), MAX_PATH);
    }

    if (m_szModVer.IsEmpty())
    {
        WCHAR szFile[MAX_PATH] = {};
        GetModuleFileName(g_hModule, szFile, MAX_PATH);

        GetFileVer(szFile, m_szModVer.GetBufferSetLength(MAX_PATH), MAX_PATH);
    }

    if (szUrl.Find(URL_PID) > 0)
    {
        szUrl.Replace(URL_PID, m_szPID);
    }

    if (szUrl.Find(URL_MID) > 0)
    {
        szUrl.Replace(URL_MID, m_szMID);
    }

    if (szUrl.Find(URL_APP_VER) > 0)
    {
        szUrl.Replace(URL_APP_VER, m_szAppVer);
    }

    if (szUrl.Find(URL_MOD_VER) > 0)
    {
        szUrl.Replace(URL_MOD_VER, m_szModVer);
    }

    if (szUrl.Find(URL_TYPE) > 0)
    {
        szUrl.Replace(URL_TYPE, szType);
    }

    if (szUrl.Find(URL_ACTION) > 0)
    {
        szUrl.Replace(URL_ACTION, szAction);
    }
}
示例#2
0
void writedriveletter(cwindow *pwin0, cwindow *pwin1)
{
    char				str[65],strX[35],strPriOrLog[10],strActive[10],szfat[9];
    YG_PARTITION_INFO	*p;
    BYTE				btitem = 0;
    MID 				mid;
    //find disk number
    p = g_pCurFixDiskInfo;
    while(p != NULL)
    {
        g_pCurFixDiskInfo = g_pCurFixDiskInfo->pNext;
        free(g_pCurFixDiskInfo);
        p = g_pCurFixDiskInfo;
    }

    GetFixDiskInfo(pwin0->m_pitemactive->btItem);

    p = g_pCurFixDiskInfo;
    pwin1->emptyitem();
    pwin1->emptyscreen();
    while(p != NULL)
    {
        _fmemset(str,0x20,65);
        _fstrcpy(str, SELPREFIX);
        if(p->dwSystemFlag)
        {
            if((int)p->DriveLetter< 0x40 )
            {
                _fmemset(szfat,32,9);
                _fstrcat(str, "    ");
                str[SELPREFIXLEN]='*';
                str[9]= 0x20;
                switch(p->dwSystemFlag)
                {
                case 0x0b:
                case 0x0c:
                    _fmemcpy(szfat,"FAT32",5);
                    break;
                case 0x01:
                case 0x04:
                case 0x06:
                case 0x0e:
                    _fmemcpy(szfat, "FAT",3);
                    break;
                case 0x1b:
                case 0x1c:
                    _fmemcpy(szfat, "H-FAT32",7);
                    break;
                case 0x11:
                case 0x14:
                case 0x16:
                case 0x1e:
                    _fmemcpy(szfat, "H-FAT",5);
                    break;
                case 0x17:
                    _fmemcpy(szfat, "H-NTFS",6);
                    break;
                case 0x07:
                    _fmemcpy(szfat, "NTFS",4);
                    break;
                case 0x82:
                    _fmemcpy(szfat, "LinSwap",7);
                    break;
                case 0x83:
                    _fmemcpy(szfat, "LinExt2",7);
                    break;
                default:
                    if(!p->dwSystemFlag)
                        _fmemcpy(szfat,"FREE",4);
                    else
                        sprintf(szfat,UNKNOWNFILESYSTEM,p->dwSystemFlag);
                    break;
                }
                for(int i=0; i<9; i++)
                    if(szfat[i]==0) szfat[i]=32;

                _fmemcpy(&str[19],szfat,8);
                str[27]=0;
                if(p->bLogic)
                    _fstrcpy(strPriOrLog,"LOGICAL");
                else
                    _fstrcpy(strPriOrLog,"PRIMARY");
                _fstrcpy(strActive,"   -    ");
                sprintf(strX,PAR,p->dwPartSize/2048,strActive,strPriOrLog);
                _fstrcat(str,strX);
            }
            else
            {
                _fmemset(&mid,0x20,sizeof(MID));
                GetMID(p->DriveLetter-'A'+1,&mid);
                _fstrcat(str, " :\\");
                str[SELPREFIXLEN] = p->DriveLetter;
                for(int i=0; i<11; i++)
                {
                    if(mid.midVolLabel[i]==0)
                        mid.midVolLabel[i]=0x20;
                }
                _fmemcpy(&str[SELPREFIXLEN+3],mid.midVolLabel,11);
                switch(p->dwSystemFlag)
                {
                case 0x0b:
                case 0x0c:
                    _fmemcpy(&str[19],"FAT32   ",8);
                    break;
                case 0x01:
                case 0x04:
                case 0x06:
                case 0x0e:
                    _fmemcpy(&str[19],"FAT     ",8);
                    break;
                default:
                    break;
                }
                str[27]=0;
                if(p->bLogic)
                    _fstrcpy(strPriOrLog,"LOGICAL");
                else
                    _fstrcpy(strPriOrLog,"PRIMARY");

                if(p->BootFlag==0x80)  _fstrcpy(strActive,"Active");
                else  _fstrcpy(strActive,"   -    ");
                if(p->BootFlag!=0x80)
                    sprintf(strX,PAR,p->dwPartSize/2048,strActive,strPriOrLog);
                else
                    sprintf(strX,PAR1,p->dwPartSize/2048,strActive,strPriOrLog);
                _fstrcat(str,strX);
            }
            pwin1->additemNotSort(str,btitem);
        }
        p = p->pNext;
        btitem ++;
    }
    pwin1->enabledscroll();
}