亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? stream.c

?? FAT文件系統源代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
                break;
            }

            // posEnd advances, and clus becomes the new clusEnd

            posEnd += pvol->v_cbClus;

            if (clusEnd != UNKNOWN_CLUSTER)
                clusPrev = clusEnd;

            clusEnd = clus;

        } while (posEnd < cbNew);

        // If the stream has any new clusters at all...

        if (clusEnd != UNKNOWN_CLUSTER) {

            // If a PACK fails, we're having trouble writing to the FAT

            if (clus != UNKNOWN_CLUSTER) {
                if (PACK(pvol, clusEnd, EOF_CLUSTER, NULL) != ERROR_SUCCESS) {
                    DEBUGMSG(ZONE_ERRORS,(DBGTEXT("FATFS!ResizeStream: trouble terminating new FAT chain\r\n")));
                    clus = UNKNOWN_CLUSTER;
                }

                AppendRunList(&pstm->s_runList, posEnd, EOF_CLUSTER);
            }
            
            if (pstm->s_size != posEnd) {
                pstm->s_size = posEnd;
                pstm->s_flags |= STF_DIRTY;
            }

            // If we couldn't allocate all the clusters we needed,
            // then (try to) resize the stream to its original size.

            if (clus == UNKNOWN_CLUSTER) {
                DEBUGMSG(ZONE_ERRORS,(DBGTEXT("FATFS!ResizeStream: shrinking FAT chain back down...\r\n")));
                ResizeStream(pstm, oldSize, dwResizeFlags | RESIZESTREAM_SHRINK);
                dwError = ERROR_DISK_FULL;
            }
            else {

                // It's important that we record the cluster-granular
                // size for directories, because when CreateName grows a
                // directory, it uses this size to calculate how much data
                // has to be zeroed.  For all other streams, it's important
                // to record only the exact number of bytes requested.

                if (!(pstm->s_attr & ATTR_DIRECTORY)) {
                    pstm->s_size = cbNew;
                }

            }
        }

#ifdef TFAT
        // Need to update the parent dir in all cases for a file and only if the 
        // first cluster changed for a directory.
        if (pvol->v_fTfat && (!(pstm->s_attr & ATTR_DIRECTORY) || bFirstClusChanged))
            UpdateDirEntryCluster(pstm);
#endif

        // Commit and release FAT buffers now

        if (dwResizeFlags & RESIZESTREAM_UPDATEFAT) {
            
            BOOL fTempWriteThru = FALSE;            

            // If stream is write-through, but FAT stream is not, temporarily make it so that the 
            // modified FAT buffers will be write-through.            
            if ((pstm->s_flags & STF_WRITETHRU) && !(pvol->v_pstmFAT->s_flags & STF_WRITETHRU)) {
                 fTempWriteThru = TRUE;
                 pvol->v_pstmFAT->s_flags |= STF_WRITETHRU;
            }
            
            WriteAndReleaseStreamBuffers(pvol->v_pstmFAT);
            
            if (fTempWriteThru)
                pvol->v_pstmFAT->s_flags &= ~STF_WRITETHRU;
        }

        UnlockFAT(pvol);

        DEBUGMSG(ZONE_STREAMS || ZONE_ERRORS && dwError,(DBGTEXT("FATFS!ResizeStream(GROW) returned %d for '%.11hs'\r\n"), dwError, pstm->s_achOEM));
        return dwError;
    }

    // If shrinking was not enabled, then we're done

    if (!(dwResizeFlags & RESIZESTREAM_SHRINK))
        return ERROR_SUCCESS;

    // We enter the FAT's critical section even though we're just freeing
    // clusters, because in the process, we could alter the FAT stream's
    // current buffer, and that could mess up someone else accessing the FAT.

    LockFAT(pvol);

    // If clusEnd is NO_CLUSTER, then all the file's clusters can be freed;
    // set pstm->s_clusFirst to UNKNOWN_CLUSTER, which will get propagated
    // as ZERO to the DIRENTRY when the stream is committed (CommitStream will
    // eventually do that, because we also set STF_DIRTY, below).

    if (clusEnd == NO_CLUSTER) {

        // clusEnd becomes the first cluster to free.

        
        if (pstm->s_clusFirst != UNKNOWN_CLUSTER)
            pstm->s_flags |= STF_DIRTY_CLUS;

        clusEnd = pstm->s_clusFirst;
        pstm->s_clusFirst = UNKNOWN_CLUSTER;
        bFirstClusChanged = TRUE;
    }
    else {
        dwError = PACK(pvol, clusEnd, EOF_CLUSTER, &clusEnd);
    }

    // Update the stream's new size
    pstm->s_size = cbNew;
    pstm->s_flags |= STF_DIRTY;
    
    // Now free all the remaining clusters in the chain.

#ifdef TFAT    
    // TFAT - don't delete the cluster, freeze it instead
    if (pstm->s_pvol->v_fTfat) {
        DWORD clusFirst = NO_CLUSTER, clusNext = clusEnd;

        // Get the last cluster in the chain
        while (!dwError && clusNext >= DATA_CLUSTER && !ISEOF(pvol, clusNext))
        {
            if (NO_CLUSTER == clusFirst)
                clusFirst = clusEnd;
            
            clusEnd = clusNext;
            
            // get next cluster
            dwError = UNPACK( pvol, clusNext, &clusNext );
        }

        if (NO_CLUSTER != clusFirst)
            FreezeClusters (pvol, clusFirst, clusEnd);
        
        // Need to update the parent dir in all cases for a file and only if the 
        // first cluster changed for a directory.
        if (!(pstm->s_attr & ATTR_DIRECTORY) || bFirstClusChanged)       
            UpdateDirEntryCluster(pstm);
    }
    else 

#endif
    {
        while (!dwError && clusEnd >= DATA_CLUSTER && !ISEOF(pvol, clusEnd)) {
            FreeClustersOnDisk(pvol, clusEnd, 1);
            dwError = PACK(pvol, clusEnd, FREE_CLUSTER, &clusEnd);
        }

    }

    // Commit and release FAT buffers now.

    if (dwResizeFlags & RESIZESTREAM_UPDATEFAT)
        WriteAndReleaseStreamBuffers(pvol->v_pstmFAT);


    // We need to update the stream's run info

    dwError = TruncateRunList (&pstm->s_runList, cbNew);
    if (dwError == ERROR_SUCCESS) {
        DWORD dwEndPosition = (cbNew + pvol->v_cbClus - 1) & ~(pvol->v_cbClus - 1);  
        dwError = AppendRunList(&pstm->s_runList, dwEndPosition, EOF_CLUSTER);
    }

    UnlockFAT(pvol);
    
    DEBUGMSG(ZONE_STREAMS || ZONE_ERRORS && dwError,(DBGTEXT("FATFS!ResizeStream(SHRINK) returned %d for '%.11hs'\r\n"), dwError, pstm->s_achOEM));
    return dwError;
}


/*  CheckStreamHandles - Check for stream with open handles
 *
 *  ENTRY
 *      pvol - pointer to VOLUME
 *      psid - pointer to SID, or NULL to check all streams for open handles
 *
 *  EXIT
 *      TRUE if stream exists and has open handles, FALSE if not
 *
 *  NOTES
 *      This check excludes VOLUME-based handles, because it excludes VOLUME-
 *      based streams (ie, the FAT and root directory).
 */

BOOL CheckStreamHandles(PVOLUME pvol, PDSID psid)
{
    PDSTREAM pstm;
    BOOL fOpen = FALSE;

    EnterCriticalSection(&pvol->v_csStms);

    for (pstm = pvol->v_dlOpenStreams.pstmNext; pstm != (PDSTREAM)&pvol->v_dlOpenStreams; pstm = pstm->s_dlOpenStreams.pstmNext) {

        if (pstm->s_flags & STF_VOLUME)
            continue;

        if (psid == NULL || pstm->s_sid.sid_clusDir == psid->sid_clusDir && pstm->s_sid.sid_ordDir == psid->sid_ordDir) {
            fOpen = (pstm->s_dlOpenHandles.pfhNext != (PFHANDLE)&pstm->s_dlOpenHandles);
            if (psid || fOpen)
                break;
        }
    }
    LeaveCriticalSection(&pvol->v_csStms);
    return fOpen;
}


/*  UpdateSourceStream - Updates source stream after a MoveFile
 *
 *  ENTRY
 *      pvol - pointer to VOLUME
 *      psidSrc - pointer to SID of the source stream
 *      pdiDst - pointer to DIRINFO of destination file
 *      pstmDstParent - pointer to stream of parent directory of destination file
 *
 *  EXIT
 *      None
 *
 *  NOTES
 *      This is necessary in case there are open file handles that point to the
 *      source stream.
 */

VOID UpdateSourceStream (PVOLUME pvol, PDSID psidSrc, PDIRINFO pdiDst, PDSTREAM pstmDstParent)
{
    // Search through any open handles that carry the source stream
    // and update the stream to point to the destination
    PDSTREAM pstmSrc;

    EnterCriticalSection(&pvol->v_csStms);


    // Search for a stream that matches stream ID of source
    for (pstmSrc = pvol->v_dlOpenStreams.pstmNext; pstmSrc != (PDSTREAM)&pvol->v_dlOpenStreams;
       pstmSrc = pstmSrc->s_dlOpenStreams.pstmNext) {
        
        if (pstmSrc->s_sid.sid_clusDir == psidSrc->sid_clusDir && pstmSrc->s_sid.sid_ordDir == psidSrc->sid_ordDir) 
            break;
    }

    pstmSrc->s_refs++;
    LeaveCriticalSection(&pvol->v_csStms);

    // If we found a match, update stream's info so it refers to the destination file now
    if (pstmSrc != (PDSTREAM)&pvol->v_dlOpenStreams) {
        EnterCriticalSection (&pstmSrc->s_cs);

        memcpy(pstmSrc->s_achOEM, pdiDst->di_pde->de_name, sizeof(pdiDst->di_pde->de_name));
        pstmSrc->s_sid = pdiDst->di_sid;
        pstmSrc->s_sidParent = pstmDstParent->s_sid;
        pstmSrc->s_cwPath = pdiDst->di_cwName + pstmDstParent->s_cwPath + 1;

        if ((pstmDstParent->s_pbufCur) && !(pstmSrc->s_attr & ATTR_DIRECTORY)) {
            pstmSrc->s_blkDir = pstmDstParent->s_pbufCur->b_blk;
            pstmSrc->s_offDir = (PBYTE)pdiDst->di_pde - pstmDstParent->s_pbufCur->b_pdata;
        }

#ifdef TFAT
        // Update the parent stream, if needed
        if (pstmSrc->s_pvol->v_fTfat && pstmSrc->s_pstmParent && pstmSrc->s_pstmParent != pstmDstParent) {

            // Remove reference to the previous parent
            ASSERT(pstmSrc->s_pstmParent->s_refs);
            if(1 == pstmSrc->s_pstmParent->s_refs){
                EnterCriticalSection(&pstmSrc->s_pstmParent->s_cs);
                CloseStream(pstmSrc->s_pstmParent);
            } else{
                --pstmSrc->s_pstmParent->s_refs;
            }

            // Add reference to the new parent
            pstmSrc->s_pstmParent = pstmDstParent;
            pstmDstParent->s_refs++;
        }
#endif

        LeaveCriticalSection (&pstmSrc->s_cs);
    }

    pstmSrc->s_refs--;

}


/*  StreamOpenedForExclAccess - Check if file is already open for exclusive access
 *
 *  ENTRY
 *      pvol - pointer to VOLUME
 *
 *  EXIT
 *      TRUE if file is already open for exclusive access, FALSE if not
 *
 *  NOTES
 *      This check excludes VOLUME-based handles, because it excludes VOLUME-
 *      based streams (ie, the FAT and root directory).
 */

BOOL StreamOpenedForExclAccess(PVOLUME pvol, PDSID psid)
{
    PDSTREAM pstm;
    PFHANDLE pfh, pfhEnd;
    BOOL fOpenedForExclAccess = FALSE;

    ASSERT(psid);

    EnterCriticalSection(&pvol->v_csStms);

    for (pstm = pvol->v_dlOpenStreams.pstmNext; 
           !fOpenedForExclAccess && pstm != (PDSTREAM)&pvol->v_dlOpenStreams;
           pstm = pstm->s_dlOpenStreams.pstmNext) {

        if (pstm->s_sid.sid_clusDir == psid->sid_clusDir && pstm->s_sid.sid_ordDir == psid->sid_ordDir) {

            // Walk the handle list. Return TRUE if any are opened for exclusive access.
            for(pfh = pstm->s_dlOpenHandles.pfhNext, pfhEnd = (PFHANDLE)&pstm->s_dlOpenHandles;
                  pfh != pfhEnd; pfh = pfh->fh_dlOpenHandles.pfhNext) {
                
                if ( (!(pfh->fh_mode & FH_MODE_SHARE_READ) || (pfh->fh_mode & FH_MODE_WRITE)) && 
                       !(pfh->fh_mode & FH_MODE_SHARE_WRITE)) {
                    fOpenedForExclAccess = TRUE;
                    break;
                }
            }
        }
    }
    LeaveCriticalSection(&pvol->v_csStms);
    return fOpenedForExclAccess;
}

/*  CheckStreamSharing - Check requested mode against stream
 *
 *  ENTRY
 *      pstm - pointer to DSTREAM
 *      mode - requested mode
 *
 *  EXIT
 *      TRUE if all handles for stream permit the specified mode, FALSE if not
 */

BOOL CheckStreamSharing(PDSTREAM pstm, int mode, BOOL fTruncate)
{
    BYTE bRequiredShare = 0;
    BYTE bExcludedAccess = 0;
    PFHANDLE pfh, pfhEnd;

    ASSERT(pstm);
    ASSERT(OWNCRITICALSECTION(&pstm->s_cs));

    // If user wants to open a file for read and/or write, all
    // open handles must have been opened for read sharing and/or 
    // write sharing respectively. Also, if user wants to truncate,
    // other handles must have write sharing.
    
    if (mode & FH_MODE_READ)
        bRequiredShare |= FH_MODE_SHARE_READ;

    if (fTruncate || (mode & FH_MODE_WRITE))
        bRequiredShare |= FH_MODE_SHARE_WRITE;

    // If user disallows a file for read sharing and/or write 
    // sharing, open handles cannot have been opened for read and/or 
    // write respectively

    if (!(mode & FH_MODE_SHARE_READ))
        bExcludedAccess |= FH_MODE_READ;

    if (!(mode & FH_MODE_SHARE_WRITE))
        bExcludedAccess |= FH_MODE_WRITE;

    pfh = pstm->s_dlOpenHandles.pfhNext;
    pfhEnd = (PFHANDLE)&pstm->s_dlOpenHandles;

    while (pfh != pfhEnd) {
        if ((pfh->fh_mode & bRequiredShare) != bRequiredShare)
            return FALSE;
        if (pfh->fh_mode & bExcludedAccess)
            return FALSE;        
        pfh = pfh->fh_dlOpenHandles.pfhNext;
    }
    return TRUE;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产一区二区亚洲人成毛片 | 国产精品久久久久国产精品日日| 欧美激情一二三区| 日韩专区一卡二卡| caoporn国产精品| 日韩欧美一级二级三级久久久| 国产精品卡一卡二| 国产一区二区三区四区五区入口| 欧美怡红院视频| 中文字幕av一区二区三区免费看| 日日摸夜夜添夜夜添亚洲女人| youjizz久久| 国产香蕉久久精品综合网| 日本中文一区二区三区| 91麻豆swag| 亚洲视频在线观看三级| 国产69精品久久久久毛片| 精品少妇一区二区三区在线播放 | 91看片淫黄大片一级在线观看| 久久亚洲欧美国产精品乐播| 日本大胆欧美人术艺术动态| 色中色一区二区| 亚洲天堂网中文字| kk眼镜猥琐国模调教系列一区二区| 久久人人爽爽爽人久久久| 全国精品久久少妇| 欧美一区二区三区喷汁尤物| 午夜久久久影院| 欧美久久免费观看| 亚洲第四色夜色| 欧美巨大另类极品videosbest | 久久精品亚洲乱码伦伦中文 | 亚洲在线视频网站| 91女厕偷拍女厕偷拍高清| 国产精品沙发午睡系列990531| 国产在线不卡一区| 日本一区免费视频| 成人久久视频在线观看| 国产精品第四页| 91在线高清观看| 亚洲综合男人的天堂| 欧美亚洲自拍偷拍| 天天色综合成人网| 精品欧美久久久| 国产成人自拍高清视频在线免费播放| 久久久精品日韩欧美| 国产成人亚洲综合a∨婷婷| 欧美高清一级片在线观看| eeuss鲁片一区二区三区在线观看| 免费黄网站欧美| 91麻豆精品国产91久久久更新时间 | 亚洲永久精品国产| 欧美日韩二区三区| 激情五月婷婷综合网| 久久久国产精品午夜一区ai换脸| www.性欧美| 日韩高清在线不卡| 国产欧美视频一区二区三区| 色综合网站在线| 日本一不卡视频| 欧美国产精品久久| 欧美日韩在线播放| 国产精品一二三四| 一二三四社区欧美黄| 欧美大胆人体bbbb| 91网站黄www| 蜜桃一区二区三区在线| 国产精品国产成人国产三级| 欧美日韩一区中文字幕| 狠狠色狠狠色合久久伊人| 国产精品久久久久久久久快鸭| 欧美亚男人的天堂| 国产麻豆精品theporn| 亚洲精品免费看| 精品国产不卡一区二区三区| 91免费观看在线| 久久99久久精品| 亚洲欧美偷拍卡通变态| 欧美变态凌虐bdsm| 欧美影院午夜播放| 国产xxx精品视频大全| 午夜激情综合网| 中文字幕亚洲电影| 2023国产精品| 欧美日韩精品欧美日韩精品| 国产东北露脸精品视频| 免费的成人av| 亚洲国产精品久久不卡毛片| 国产精品色噜噜| 精品日韩99亚洲| 7777精品伊人久久久大香线蕉的| 成人的网站免费观看| 狠狠色丁香婷婷综合| 午夜精品视频在线观看| 亚洲精品国产a久久久久久 | 制服丝袜国产精品| 91高清视频免费看| av一区二区三区在线| 国产一区91精品张津瑜| 美女视频一区二区三区| 视频一区在线播放| 亚洲最色的网站| 亚洲天堂网中文字| 中文字幕在线免费不卡| 欧美国产日韩a欧美在线观看| 日韩视频免费观看高清完整版在线观看 | 久久精品国产99| 亚洲1区2区3区4区| 亚洲电影中文字幕在线观看| 成人免费在线播放视频| 国产精品乱人伦一区二区| 久久蜜桃一区二区| 欧美成人三级在线| 日韩欧美的一区| 欧美zozozo| 欧美va在线播放| 日韩欧美一级特黄在线播放| 欧美一区二区三区影视| 日韩一区二区电影在线| 欧美一级夜夜爽| 欧美mv日韩mv| 国产欧美综合色| 亚洲天堂久久久久久久| www.欧美色图| 99久久精品国产一区| 91亚洲男人天堂| 欧美日韩一区二区在线观看| 欧美日韩mp4| 欧美大片在线观看一区| 久久综合九色综合97婷婷| 国产欧美精品一区aⅴ影院| 国产精品免费观看视频| 亚洲男帅同性gay1069| 亚洲综合网站在线观看| 日韩国产精品91| 国产福利91精品| 91麻豆蜜桃一区二区三区| 欧美精品久久一区二区三区| 精品剧情v国产在线观看在线| 久久婷婷色综合| 中文字幕一区二区三区在线不卡| 亚洲视频在线一区观看| 日日夜夜一区二区| 高清免费成人av| 色婷婷av一区二区三区软件| 7777女厕盗摄久久久| 国产日韩三级在线| 亚洲自拍另类综合| 国产在线视频精品一区| 91小视频免费观看| 日韩视频一区二区在线观看| 中文字幕av一区二区三区高| 亚洲第一成年网| 风流少妇一区二区| 欧美精品久久久久久久久老牛影院| 精品少妇一区二区三区在线播放| 亚洲欧美一区二区三区国产精品| 免费在线观看不卡| 色综合天天综合网天天狠天天| 欧美一区二区三区在| 亚洲欧美自拍偷拍| 久久se精品一区精品二区| 91影院在线观看| 久久午夜羞羞影院免费观看| 亚洲图片你懂的| 国产一区 二区 三区一级| 3d动漫精品啪啪| 亚洲人xxxx| 福利91精品一区二区三区| 91精品国产入口在线| 亚洲乱码国产乱码精品精小说 | 日韩精品专区在线影院重磅| 中文字幕在线观看不卡视频| 日本欧美在线看| 色狠狠av一区二区三区| 首页综合国产亚洲丝袜| 99精品偷自拍| 国产精品五月天| 狠狠久久亚洲欧美| 日韩午夜激情电影| 亚洲高清免费一级二级三级| 91在线观看高清| 亚洲欧美在线aaa| 懂色av一区二区三区蜜臀| 久久综合色综合88| 免费在线观看一区| 在线不卡的av| 视频一区免费在线观看| 欧美伊人久久久久久久久影院| 中文字幕在线不卡一区二区三区| 国产精品自拍毛片| 337p粉嫩大胆色噜噜噜噜亚洲| 日韩综合小视频| 91精品久久久久久蜜臀| 一区二区在线观看不卡| 蜜桃精品在线观看| 欧美精品电影在线播放| 亚洲一区二区三区在线看| 日本道色综合久久| 亚洲精品免费在线观看|