aescryptworkerthreads.h

来自「AES, 即Advanced Encryption Standard高级加密标准」· C头文件 代码 · 共 64 行

H
64
字号
/*
 *  AESCryptWorkerThreads.h
 *
 *  Copyright (C) 2006
 *  Paul E. Jones <paulej@arid.us>
 *  All Rights Reserved.
 *
 ******************************************************************************
 *  $Id: AESCryptWorkerThreads.h,v 1.2 2007/05/14 10:41:07 paulej Exp $
 ******************************************************************************
 *
 *  This file defines the AESCryptWorkerThreads class, which is
 *  responsible for all background encryption and decryption functions.
 *
 */

#pragma once

struct WorkerData;

class AESCryptWorkerThreads
{
    private:
        CRITICAL_SECTION    Critical_Section;
        int                 Thread_Count;
        std::list<HANDLE>   Terminated_Threads;

        bool StartThread(   StringList *file_list,
                            TCHAR *passwd,
                            bool encrypt);

        inline void DoMessageLoop();

        void EncryptFiles(  StringList *file_list,
							TCHAR *passwd);

        void DecryptFiles(  StringList *file_list,
                            TCHAR *passwd);

    public:
        AESCryptWorkerThreads();
        ~AESCryptWorkerThreads();

        // Indicates whether threads are working
        bool IsBusy();

        // Process files for encryption (true) or decryption (false)
        void ProcessFiles(  StringList *file_list,
                            bool encrypt);

        // This should only be called by threads
        // spawned by this class.
        void ThreadEntry(   WorkerData *worker_data);
};

struct WorkerData
{
    StringList              *file_list;
    TCHAR                   passwd[MAX_PASSWD_LEN+1];
    bool                    encrypt;
    HANDLE                  thread_handle;
    AESCryptWorkerThreads   *aes_crypt_worker_threads;
};

⌨️ 快捷键说明

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