// DICOMSRV.cpp : Defines the class behaviors for the application. // //*************************************************************************** // PLEASE Read the SRVRMDB.DOC file for information about the database that // this demo uses. // A sample database has been provided for you in the \IMAGES directory. // This demo requires a working directory. // Create a working directory such as D:\DICOM // In the source code, you must set the working directory to that directory. // Recompile this demo. // Copy the MDB file to the working directory. // Copy the three sample .DIC files from \IMAGES to the working directory. // Rename the .DIC files: // IMAGE1.DIC ==> 1.DIC // IMAGE2.DIC ==> 2.DIC // IMAGE3.DIC ==> 3.DIC // When you first run this demo, you can use the Administration dialog to // configure the server. //*************************************************************************** #include "stdafx.h" #include "DICOMSRV.h" #include "SRVDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CDICOMSRVApp BEGIN_MESSAGE_MAP(CDICOMSRVApp, CWinApp) //{{AFX_MSG_MAP(CDICOMSRVApp) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG ON_COMMAND(ID_HELP, CWinApp::OnHelp) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDICOMSRVApp construction CDICOMSRVApp::CDICOMSRVApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance m_strCACertName = ""; m_strServerCertName = ""; m_bValidPrivateKeyPassword = FALSE; m_strPrivateKeyPassword = ""; m_hWndParent = 0; } ///////////////////////////////////////////////////////////////////////////// // The one and only CDICOMSRVApp object CDICOMSRVApp theApp; ///////////////////////////////////////////////////////////////////////////// // CDICOMSRVApp initialization BOOL CDICOMSRVApp::InitInstance() { AfxEnableControlContainer(); CoInitialize(NULL); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif CDICOMSRVDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } CoUninitialize(); // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; } char *CDICOMSRVApp::GetTLSErrorString(int nError) { char *pszError = ""; switch (nError) { case DICOM_ERROR_FORMAT: pszError = "Error Format"; break; case DICOM_ERROR_TLS_CLOSE_NOTIFY: pszError = "Error TLS Close Notify"; break; case DICOM_ERROR_TLS_UNEXPECTED_MESSAGE: pszError = "Error TLS Unexpected Message"; break; case DICOM_ERROR_TLS_BAD_RECORD_MAC: pszError = "Error TLS Bad Record MAC"; break; case DICOM_ERROR_TLS_DECRYPT_FAILED: pszError = "Error TLS Decrypt Failed"; break; case DICOM_ERROR_TLS_RECORD_OVERFLOW: pszError = "Error TLS Record Overflow"; break; case DICOM_ERROR_TLS_DECOMPRESSION_FAILURE: pszError = "Error TLS Decompression Failure"; break; case DICOM_ERROR_TLS_HANDSHAKE_FAILURE: pszError = "Error TLS Handshake Failure"; break; case DICOM_ERROR_TLS_BAD_CERTIFICATE: pszError = "Error TLS Bad Certificate"; break; case DICOM_ERROR_TLS_UNSUPPORTED_CERTIFICATE: pszError = "Error TLS Unsupported Certificate"; break; case DICOM_ERROR_TLS_CERTIFICATE_REVOKED: pszError = "Error TLS Certificate Revoked"; break; case DICOM_ERROR_TLS_CERTIFICATE_EXPIRED: pszError = "Error TLS Certificate Expired"; break; case DICOM_ERROR_TLS_CERTIFICATE_UNKNOWN: pszError = "Error TLS Certificate Unknown"; break; case DICOM_ERROR_TLS_ILLEGAL_PARAMETER: pszError = "Error TLS Illegal Parameter"; break; case DICOM_ERROR_TLS_UNKNOWN_CA: pszError = "Error TLS Unknown CA"; break; case DICOM_ERROR_TLS_ACCESS_DENIED: pszError = "Error TLS Access Denied"; break; case DICOM_ERROR_TLS_DECODE_ERROR: pszError = "Error TLS Decode Error"; break; case DICOM_ERROR_TLS_DECRYPT_ERROR: pszError = "Error TLS Decrypt Error"; break; case DICOM_ERROR_TLS_EXPORT_RESTRICTION: pszError = "Error TLS Export Restriction"; break; case DICOM_ERROR_TLS_PROTOCOL_VERSION: pszError = "Error TLS Protocol Version"; break; case DICOM_ERROR_TLS_INSUFFICIENT_SECURITY: pszError = "Error TLS Insufficient Security"; break; case DICOM_ERROR_TLS_INTERNAL_ERROR: pszError = "Error TLS Internal Error"; break; case DICOM_ERROR_TLS_USER_CANCELED: pszError = "Error TLS User Canceled"; break; case DICOM_ERROR_TLS_NO_RENEGOTIATION: pszError = "Error TLS No Renegotiation"; break; case DICOM_ERROR_TLS_NO_KEEPALIVE: pszError = "Error TLS No Keepalive"; break; case DICOM_ERROR_TLS_CLOSED_CONTROLLED: pszError = "Error TLS Closed Controlled"; break; case DICOM_ERROR_TLS_UNABLE_TO_GET_ISSUER_CERT: pszError = "Error TLS UNABLE TO GET ISSUER_CERT"; break; case DICOM_ERROR_TLS_UNABLE_TO_GET_CRL: pszError = "Error TLS UNABLE TO GET CRL"; break; case DICOM_ERROR_TLS_UNABLE_TO_DECRYPT_CERT_SIGNATURE: pszError = "Error TLS UNABLE TO DECRYPT CERT SIGNATURE"; break; case DICOM_ERROR_TLS_UNABLE_TO_DECRYPT_CRL_SIGNATURE: pszError = "Error TLS UNABLE TO DECRYPT CRL SIGNATURE"; break; case DICOM_ERROR_TLS_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: pszError = "Error TLS UNABLE TO DECODE ISSUER PUBLIC KEY"; break; case DICOM_ERROR_TLS_CERT_SIGNATURE_FAILURE: pszError = "Error TLS Cert Signature Failure"; break; case DICOM_ERROR_TLS_CRL_SIGNATURE_FAILURE: pszError = "Error TLS Crl Signature Failure"; break; case DICOM_ERROR_TLS_CERT_NOT_YET_VALID: pszError = "Error TLS CERT NOT YET VALID"; break; case DICOM_ERROR_TLS_CERT_HAS_EXPIRED: pszError = "Error TLS Cert Has Expired"; break; case DICOM_ERROR_TLS_CRL_NOT_YET_VALID: pszError = "Error TLS CRL Not Yet Valid"; break; case DICOM_ERROR_TLS_CRL_HAS_EXPIRED: pszError = "Error TLS CRL Has Expired"; break; case DICOM_ERROR_TLS_ERROR_IN_CERT_NOT_BEFORE_FIELD: pszError = "Error TLS Error In Cert Not Before Field"; break; case DICOM_ERROR_TLS_ERROR_IN_CERT_NOT_AFTER_FIELD: pszError = "Error TLS Error In Cert Not After Field"; break; case DICOM_ERROR_TLS_ERROR_IN_CRL_LAST_UPDATE_FIELD: pszError = "Error TLS Error In Crl Last Update Field"; break; case DICOM_ERROR_TLS_ERROR_IN_CRL_NEXT_UPDATE_FIELD: pszError = "Error TLS Error In Crl Next Update Field"; break; case DICOM_ERROR_TLS_OUT_OF_MEM: pszError = "Error TLS Out Of Memory"; break; case DICOM_ERROR_TLS_DEPTH_ZERO_SELF_SIGNED_CERT: pszError = "Error TLS Depth Zero Self Signed Cert"; break; case DICOM_ERROR_TLS_SELF_SIGNED_CERT_IN_CHAIN: pszError = "Error TLS Self Signed Cert In Chain"; break; case DICOM_ERROR_TLS_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: pszError = "Error TLS Unable To Get Issuer Cert Locally"; break; case DICOM_ERROR_TLS_UNABLE_TO_VERIFY_LEAF_SIGNATURE: pszError = "Error TLS Unable To Verify Leaf Signature"; break; case DICOM_ERROR_TLS_CERT_CHAIN_TOO_LONG: pszError = "Error TLS Cert Chain Too Long"; break; case DICOM_ERROR_TLS_CERT_REVOKED: pszError = "Error TLS Cert Revoked"; break; case DICOM_ERROR_TLS_INVALID_CA: pszError = "Error TLS Invalid CA"; break; case DICOM_ERROR_TLS_PATH_LENGTH_EXCEEDED: pszError = "Error TLS Path Length Exceeded"; break; case DICOM_ERROR_TLS_INVALID_PURPOSE: pszError = "Error TLS Invalid Purpose"; break; case DICOM_ERROR_TLS_CERT_UNTRUSTED: pszError = "Error TLS Cert Untrusted"; break; case DICOM_ERROR_TLS_CERT_REJECTED: pszError = "Error TLS Cert Rejected"; break; case DICOM_ERROR_TLS_SUBJECT_ISSUER_MISMATCH: pszError = "Error TLS Subject Issuer Mismatch"; break; case DICOM_ERROR_TLS_AKID_SKID_MISMATCH: pszError = "Error TLS Akid Skid Mismatch"; break; case DICOM_ERROR_TLS_AKID_ISSUER_SERIAL_MISMATCH: pszError = "Error TLS Akid Issuer Serial Mismatch"; break; case DICOM_ERROR_TLS_KEYUSAGE_NO_CERTSIGN: pszError = "Error TLS Keyusage No Certsign"; break; case DICOM_ERROR_TLS_APPLICATION_VERIFICATION: pszError = "Error TLS Application Verification"; break; case DICOM_ERROR_TLS_INVALID_CTX: pszError = "Error TLS Invalid CTX"; break; case DICOM_ERROR_TLS_INVALID_CTX_VERIFY_DEPTH: pszError = "Error TLS Invalid CTX Verify Depth"; break; case DICOM_ERROR_TLS_INVALID_CTX_VERIFY_MODE: pszError = "Error TLS Invalid CTX Verify Mode"; break; case DICOM_ERROR_TLS_INVALID_CTX_CAFILE: pszError = "Error TLS Invalid CTX Cafile"; break; case DICOM_ERROR_TLS_INVALID_CTX_OPTIONS: pszError = "Error TLS Invalid CTX Options"; break; } return pszError; }