Пример #1
0
/**
 * ファイルのタイム スタンプを得る
 * @param[in] hFile ファイル ハンドル
 * @param[out] dosdate DOSDATE
 * @param[out] dostime DOSTIME
 * @retval 0 成功
 * @retval -1 失敗
 */
short DOSIOCALL file_getdatetime(FILEH hFile, DOSDATE* dosdate, DOSTIME* dostime)
{
	FILETIME ft;
	if (!::GetFileTime(hFile, NULL, NULL, &ft))
	{
		return -1;
	}
	return (convertDateTime(ft, dosdate, dostime)) ? 0 : -1;
}
// ----------------------------------------------------------------------------
// UntrustedCertificateInfoSymbian::ConstructL()
// ----------------------------------------------------------------------------
//
void UntrustedCertificateInfoSymbian::ConstructL(const QByteArray &aEncodedCert)
{
    TPtrC8 encodedCert( reinterpret_cast<const TText8*>( aEncodedCert.constData() ),
        aEncodedCert.length() );

    ASSERT( mCert == 0 );
    mCert = CX509Certificate::NewL( encodedCert );

    HBufC16* subjectBuf = NULL;
    X509CertNameParser::SubjectFullNameL( *mCert, subjectBuf );
    CleanupStack::PushL( subjectBuf );
    QT_TRYCATCH_LEAVING( mSubjectName =
        QString::fromUtf16(subjectBuf->Ptr(), subjectBuf->Length()) );
    CleanupStack::PopAndDestroy( subjectBuf );

    HBufC16* issuerBuf = NULL;
    X509CertNameParser::IssuerFullNameL( *mCert, issuerBuf );
    CleanupStack::PushL( issuerBuf );
    QT_TRYCATCH_LEAVING( mIssuerName =
        QString::fromUtf16(issuerBuf->Ptr(), issuerBuf->Length()));
    CleanupStack::PopAndDestroy( issuerBuf );

    TPtrC8 fingerprint = mCert->Fingerprint();
    QT_TRYCATCH_LEAVING( mFingerprint = QByteArray::fromRawData(
        reinterpret_cast<const char*>(fingerprint.Ptr()), fingerprint.Length()) );

    mMd5Fingerprint = Md5FingerprintL( mCert->Encoding() );

    TPtrC8 serialNumber = mCert->SerialNumber();
    QT_TRYCATCH_LEAVING( mSerialNumber = QByteArray::fromRawData(
        reinterpret_cast<const char*>(serialNumber.Ptr()), serialNumber.Length()) );

    const CValidityPeriod& validityPeriod = mCert->ValidityPeriod();
    convertDateTime(validityPeriod.Start(), mValidFrom);
    convertDateTime(validityPeriod.Finish(), mValidTo);

    mFormat = X509Certificate;

    const CSigningAlgorithmIdentifier& alg = mCert->SigningAlgorithm();
    mDigestAlgorithm = mapAlgorithm(alg.DigestAlgorithm().Algorithm());
    mAsymmetricAlgorithm = mapAlgorithm(alg.AsymmetricAlgorithm().Algorithm());
}
Пример #3
0
/**
 * WIN32_FIND_DATA を FLINFO に変換
 * @param[in] w32fd WIN32_FIND_DATA
 * @param[out] fli FLINFO
 * @retval true 成功
 * @retval false 失敗
 */
static bool DOSIOCALL setFLInfo(const WIN32_FIND_DATA& w32fd, FLINFO *fli)
{
#if !defined(_WIN32_WCE)
	if ((w32fd.dwFileAttributes & FILEATTR_DIRECTORY) && (w32fd.cFileName[0] == '.'))
	{
		return false;
	}
#endif	// !defined(_WIN32_WCE)

	if (fli)
	{
		fli->caps = FLICAPS_SIZE | FLICAPS_ATTR | FLICAPS_DATE | FLICAPS_TIME;
		fli->size = w32fd.nFileSizeLow;
		fli->attr = w32fd.dwFileAttributes;
		convertDateTime(w32fd.ftLastWriteTime, &fli->date, &fli->time);
		file_cpyname(fli->path, w32fd.cFileName, NELEMENTS(fli->path));
	}
	return true;
}