Exemplo n.º 1
0
void CTrack::Init(CAGDC* pDC, RECT& SymbolRect, RECT& BoundRect, RECT& PageRect, CAGMatrix& ViewToDeviceMatrix, CAGMatrix& SymbolMatrix, CGrid& Grid)
{
	ZeroData();

	m_pAGDC = pDC;
	m_ViewToDeviceMatrix = ViewToDeviceMatrix;
	m_OrigMatrix = SymbolMatrix;
	m_Matrix = m_OrigMatrix;
	m_Grid = Grid;

	m_PageRect = PageRect;
	m_BoundRectScreen = m_PageRect;

	// Setup the bounding rectangle
	m_Distort.Rect = SymbolRect;

	// Don't let the rect be empty in either dimension
	::InflateRect(&m_Distort.Rect, !WIDTH(m_Distort.Rect), !HEIGHT(m_Distort.Rect));

	m_Distort.RectOrig = m_Distort.Rect;
	m_Distort.p[0].x = m_Distort.Rect.left;
	m_Distort.p[0].y = m_Distort.Rect.top;
	m_Distort.p[1].x = m_Distort.Rect.right;
	m_Distort.p[1].y = m_Distort.Rect.top;
	m_Distort.p[2].x = m_Distort.Rect.right;
	m_Distort.p[2].y = m_Distort.Rect.bottom;
	m_Distort.p[3].x = m_Distort.Rect.left;
	m_Distort.p[3].y = m_Distort.Rect.bottom;
	m_ptCenter.x = (m_Distort.Rect.left + m_Distort.Rect.right)/2;
	m_ptCenter.y = (m_Distort.Rect.top  + m_Distort.Rect.bottom)/2;
	m_ptRotate.x = m_ptCenter.x;
	m_ptRotate.y = (m_Distort.Rect.top  + m_ptCenter.y)/2;
}
Exemplo n.º 2
0
static void WINAPI ServiceMain(DWORD dwArgc, LPTSTR lpszArgv[])
{
	if ((sshStatusHandle = RegisterServiceCtrlHandler(szServiceName, ServiceCtrl)) != NULL) {
		ZeroData(ssStatus);

		ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
		ssStatus.dwServiceSpecificExitCode = 0;

		if (ReportStatusToSCMgr(SERVICE_START_PENDING, NO_ERROR, SERVER_START_WAIT)) {
			ReportStatusToSCMgr(SERVICE_RUNNING, NO_ERROR, 0);

			/* Run server */
			int iSvrResult = SvrMain((int) dwArgc, lpszArgv);

			if (iSvrResult < 0) {

				AddToMessageLog(ErrGetErrorString(iSvrResult));

			}
		}

		ReportStatusToSCMgr(SERVICE_STOPPED, dwErr, 0);
	} else
		AddToMessageLog(_T("RegisterServiceCtrlHandler"));

}
Exemplo n.º 3
0
void CTrack::Init(CAGDC* pDC, int iWhatCanDo, DRAWPROC lpDrawProc, void* pData, CRect& SymbolRect, CRect& BoundRect, CRect& PageRect, CAGMatrix& ViewToDeviceMatrix, CAGMatrix& SymbolMatrix, CGrid& Grid)
{
	ZeroData();

	m_iWhatCanDo = 	iWhatCanDo;
	Mode(m_iWhatCanDo, false/*fDisplay*/);

	RotateConstrain(false/*bConstrainX*/, false/*bConstrainY*/);

	m_pAGDC = pDC;
	m_pDrawProc = lpDrawProc;
	m_pData = pData;

	m_ViewToDeviceMatrix = ViewToDeviceMatrix;
	m_OrigMatrix = SymbolMatrix;
	m_Matrix = m_OrigMatrix;
	m_Grid = Grid;

	m_PageRect = PageRect;
	if (m_iWhatCanDo & TR_BOUNDTOSYMBOL)
	{
		m_BoundRect = BoundRect;
		m_Matrix.Transform(m_BoundRect);
		m_BoundRectScreen = m_BoundRect;
		m_ViewToDeviceMatrix.Transform(m_BoundRectScreen);
	}
	else
		m_BoundRectScreen = m_PageRect;

	// Setup the bounding rectangle
	m_Distort.Rect = SymbolRect;

	// Don't let the rect be empty in either dimension
	m_Distort.Rect.InflateRect(!m_Distort.Rect.Width(), !m_Distort.Rect.Height());

	m_Distort.RectOrig = m_Distort.Rect;
	m_Distort.p[0].x = m_Distort.Rect.left;
	m_Distort.p[0].y = m_Distort.Rect.top;
	m_Distort.p[1].x = m_Distort.Rect.right;
	m_Distort.p[1].y = m_Distort.Rect.top;
	m_Distort.p[2].x = m_Distort.Rect.right;
	m_Distort.p[2].y = m_Distort.Rect.bottom;
	m_Distort.p[3].x = m_Distort.Rect.left;
	m_Distort.p[3].y = m_Distort.Rect.bottom;
	m_ptCenter.x = (m_Distort.Rect.left + m_Distort.Rect.right)/2;
	m_ptCenter.y = (m_Distort.Rect.top  + m_Distort.Rect.bottom)/2;
	m_ptRotate.x = m_ptCenter.x;
	m_ptRotate.y = (m_Distort.Rect.top  + m_ptCenter.y)/2;

	// init to no handles grabbed and no transforming done
	m_iHandleGrabbed = 0;

	m_bMoveOnly = true;

#ifdef READOUT
	m_fReadoutAngleX = m_fReadoutAngleY = 0;
	m_fReadoutScaleX = m_fReadoutScaleY = 1.0;
#endif READOUT
}
Exemplo n.º 4
0
CTrack::CTrack()
{
	ZeroData();
}
Exemplo n.º 5
0
CExtraItemData::~CExtraItemData(void)
{
    ZeroData();
}
Exemplo n.º 6
0
void HashInitNode(HashNode *pHNode)
{
    ZeroData(*pHNode);
    SYS_INIT_LIST_HEAD(&pHNode->Lnk);
}
Exemplo n.º 7
0
SSL* SSLMakeSession(SYS_SOCKET SockFD,
                    int iTimeOut,
                    int iIsServerCtx)
{
    char szSessionId[256];
    SYS_INET_ADDR addrInfo;
    const char* pszServerId = "Xmail_Server";
    const char* pszClientId = "Xmail_Client";
    const char* pszId = NULL;
    SSL_CTX* pSSLCtx = NULL;
    SSL* pSSLSession = NULL;

    ZeroData(addrInfo);

    SysGetPeerInfo(SockFD,
                   addrInfo);

    SysInetNToA(addrInfo,
                szSessionId, sizeof(szSessionId)); /* [i_a] */

    if(iSSLInit)
    {
        if(iIsServerCtx)
        {
            pSSLCtx = pSSLSrvCtx;
            pszId = pszServerId;
        }
        else
        {
            pSSLCtx = pSSLCliCtx;
            pszId = pszClientId;
        }

        StrNCat(szSessionId,
                pszId,
                CStringSize(szSessionId) - strlen(szSessionId));

        pSSLSession = SSL_new(pSSLCtx);

        if(pSSLSession != NULL)
        {
#ifdef DEBUG_SSL
            SSL_set_msg_callback(pSSLSession, msg_cb);
#endif
#if SSLEAY_VERSION_NUMBER >= 0x0922
            SSL_set_session_id_context(pSSLSession,
                                       (const unsigned char*)&szSessionId,
                                       (unsigned int)strlen(szSessionId));
#endif
            BIO_set_tcp_ndelay(SockFD, 1); /* [i_a] */
            SSL_set_fd(pSSLSession,
                       SockFD);

            if(iIsServerCtx)
            {
                SSL_set_accept_state(pSSLSession);
            }
            else
            {
                SSL_set_connect_state(pSSLSession);
            }

            time_t tTimeOut = time(NULL) + iTimeOut;

            for(;;)
            {
                int iResult;

                if(iIsServerCtx)
                {
                    iResult = SSL_accept(pSSLSession);
                }
                else
                {
                    iResult = SSL_connect(pSSLSession);
                }

                iResult = SSL_get_error(pSSLSession,
                                        iResult);
                switch(iResult)
                {
                case SSL_ERROR_NONE:

                    break;

                case SSL_ERROR_WANT_READ:
                case SSL_ERROR_WANT_WRITE:
                case SSL_ERROR_WANT_X509_LOOKUP:

                    if(time(NULL) < tTimeOut)
                    {
                        SysMsSleep(1);
                        continue;
                    }

                default:

                    SSL_free(pSSLSession);
                    pSSLSession = NULL;
                }

                break;
            }
        }
    }

    return (pSSLSession);
}