Пример #1
0
int update_session_file_end(packetinfo *pi, signature *sig)
{
    files *tmpfiles;
    tmpfiles = pi->cxt->files;

    while (tmpfiles != NULL) {
        if ( tmpfiles->sig == sig) {
            if (ISSET_FILE_START(tmpfiles) && !ISSET_FILE_END(tmpfiles)) {
                if (ISSET_CONFIG_VERBOSE(config)) print_session(pi, sig->filetype);
                log_files_csv(pi, sig->filetype);
                SET_FILE_END(tmpfiles);
            }
            return 0;
        }
        tmpfiles = tmpfiles->next;
    }
    return 1;
}
Пример #2
0
static WORD SaveItems(HANDLE hData, WORD wOffset, WORD wType, WORD wSize)
{
#ifdef BINSAVE

    WORD wNumChunks;
    WORD wItemSize;
    GLOBALHANDLE hHdrChunk;
    LONG lRecordStartPos, lContentStartPos, lLength;

    wNumChunks = 0;
    
    /* Register the RECORD */
    lRecordStartPos = GET_FILE_POS(hData);
    if (!SaveKappaItemRecord(hData, wOffset, KNOWLEDGE_ITEMS_REC, 0L))
        return ERROR;

    /* Write header info to reserve space */
    lContentStartPos = GET_FILE_POS(hData);
    if (!WriteAdtSaveBuf(hData, wType, wSize, wNumChunks))
        return ERROR;

    /* Get the handle to the head chunk for this type */
    GetHandle(wType, &hHdrChunk, (WORD FAR *) &wItemSize, GET_CHUNK);
    if (!SaveItemChunks(hData, hHdrChunk, wSize, &wNumChunks))
        return ERROR;

    /* Update the length of the record */
    lLength = GET_FILE_POS(hData) - lContentStartPos;
    SET_FILE_POS(hData, lRecordStartPos);
    
    if (!SaveKappaItemRecord(hData, wOffset, KNOWLEDGE_ITEMS_REC, lLength))
        return ERROR;

    /* Update the number of chunks data */
    if (!WriteAdtSaveBuf(hData, wType, wSize, wNumChunks))
        return ERROR;

    SET_FILE_END(hData);

#endif

    return TRUE;
}