Click here to Skip to main content
15,921,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Cursor & mouse freeze in Visual C++ 6.0, Win2kPro Pin
David Crow27-May-08 9:42
David Crow27-May-08 9:42 
GeneralRe: Cursor & mouse freeze in Visual C++ 6.0, Win2kPro Pin
Robert Palma Jr.27-May-08 9:49
Robert Palma Jr.27-May-08 9:49 
QuestionSaving/loading data in listbox from e.g. text file in MFC SDI ? Pin
phicho27-May-08 5:48
phicho27-May-08 5:48 
AnswerRe: Saving/loading data in listbox from e.g. text file in MFC SDI ? Pin
David Crow27-May-08 6:09
David Crow27-May-08 6:09 
AnswerRe: Saving/loading data in listbox from e.g. text file in MFC SDI ? Pin
phicho28-May-08 9:31
phicho28-May-08 9:31 
QuestionProblem with OpenSSL Pin
Dr. Kelwin27-May-08 4:21
Dr. Kelwin27-May-08 4:21 
QuestionRe: Problem with OpenSSL Pin
Moak27-May-08 5:24
Moak27-May-08 5:24 
AnswerRe: Problem with OpenSSL Pin
Dr. Kelwin27-May-08 5:39
Dr. Kelwin27-May-08 5:39 
some exampleSmile | :)

this is send function:

DWORD CSSLTLSLayer::Send(IN OVERLAPPED *pOverlapped,
                         IN WSABUF *pBuffer,
                         OUT PDWORD pdwWasSend)
{
    size_t iBuffered = BIO_write(m_pSSLBIO, pBuffer->buf, pBuffer->len);

    BIO_flush(m_pSSLBIO);
    iBuffered = (int)BIO_ctrl_pending(m_pNetworkBIO);

        if (iBuffered <= 0){
            return(WSA_IO_PENDING);
        }

    m_vcLayeredBuffer.clear();
    m_vcLayeredBuffer.resize(iBuffered);

    iBuffered = BIO_read(m_pNetworkBIO,
                         &m_vcLayeredBuffer.front(),
                         (int)iBuffered);

    pBuffer->buf = &m_vcLayeredBuffer.front();
    pBuffer->len = (u_long)m_vcLayeredBuffer.size();

    //Method of parent class which only send message as WSASend()
    DWORD dwStatus = __super::Send(pOverlapped, pBuffer, pdwWasSend);

    return(dwStatus);
}

this is receive function (common problem, because DWORD Send() work correctly):

DWORD CSSLTLSLayer::Receive(IN OVERLAPPED *pOverlapped,
                            IN WSABUF *pBuffer,
                            OUT PDWORD pdwWasRecv)
{
        if (!m_bKEXed){
            this->Handshake();
            this->InitBIOAbstractions();
            return 0;
        }

    //Receive method in parent class only do WSARecv()
    DWORD dwRet = __super::Receive(pOverlapped, pBuffer, pdwWasRecv);

    BIO_write(m_pNetworkBIO, pBuffer->buf, *pdwWasRecv);
    BIO_flush(m_pNetworkBIO);

    size_t iBuffered = BIO_ctrl_pending(m_pSSLBIO);

        if (iBuffered <= 0){
            return(WSA_IO_PENDING);
        }

    m_vcLayeredBuffer.clear();
    m_vcLayeredBuffer.resize(iBuffered);
    iBuffered = BIO_read(m_pSSLBIO, &m_vcLayeredBuffer.front(), (int)iBuffered);

    pBuffer->buf = &m_vcLayeredBuffer.front();
    pBuffer->len = (u_long)m_vcLayeredBuffer.size();

    return(dwRet);
}

and Handshake() method:

void CSSLTLSLayer::Handshake(void){

        if (!m_bKEXed && m_pSSL){
            SSL_set_fd(m_pSSL, (int)m_Socket);
            SSL_set_accept_state(m_pSSL);
            SSL_do_handshake(m_pSSL);
            m_bKEXed = true;
        }

    return;
}


maybe i can do handshake without using SSL_set_fd(), SSL_set_accept_state() and SSL_do_handshake()? Confused | :confused: Confused | :confused: Confused | :confused:

>>PS: Congrats for 2nd place with Ani Lorak [Smile]
Thanks! Smile | :)
Questionproblem in segmentation of an image Pin
hereimran27-May-08 4:04
hereimran27-May-08 4:04 
AnswerRe: problem in segmentation of an image Pin
CPallini27-May-08 4:19
mveCPallini27-May-08 4:19 
QuestionDraw on Dialog , capPreview Pin
cmos27-May-08 3:58
cmos27-May-08 3:58 
QuestionTrouble embedding files in executable in Visual C++ 08 Express Edition Pin
Sauce!27-May-08 2:53
Sauce!27-May-08 2:53 
AnswerRe: Trouble embedding files in executable in Visual C++ 08 Express Edition Pin
SandipG 27-May-08 2:58
SandipG 27-May-08 2:58 
GeneralRe: Trouble embedding files in executable in Visual C++ 08 Express Edition [modified] Pin
Sauce!27-May-08 2:59
Sauce!27-May-08 2:59 
GeneralRe: Trouble embedding files in executable in Visual C++ 08 Express Edition Pin
SandipG 27-May-08 3:06
SandipG 27-May-08 3:06 
GeneralRe: Trouble embedding files in executable in Visual C++ 08 Express Edition Pin
Sauce!27-May-08 3:11
Sauce!27-May-08 3:11 
GeneralRe: Trouble embedding files in executable in Visual C++ 08 Express Edition Pin
CPallini27-May-08 5:05
mveCPallini27-May-08 5:05 
GeneralRe: Trouble embedding files in executable in Visual C++ 08 Express Edition Pin
SandipG 28-May-08 1:20
SandipG 28-May-08 1:20 
GeneralRe: Trouble embedding files in executable in Visual C++ 08 Express Edition Pin
Sauce!1-Jun-08 19:59
Sauce!1-Jun-08 19:59 
QuestionPosting message to thread Pin
kuttiam27-May-08 2:22
kuttiam27-May-08 2:22 
AnswerRe: Posting message to thread Pin
CPallini27-May-08 2:34
mveCPallini27-May-08 2:34 
AnswerRe: Posting message to thread Pin
SandipG 27-May-08 2:52
SandipG 27-May-08 2:52 
AnswerRe: Posting message to thread Pin
Nibu babu thomas27-May-08 2:56
Nibu babu thomas27-May-08 2:56 
QuestionRe: Posting message to thread Pin
David Crow27-May-08 3:26
David Crow27-May-08 3:26 
QuestionBluesoleil SDK usage Pin
Sunshine Always27-May-08 2:05
Sunshine Always27-May-08 2:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.