コード例 #1
0
ファイル: NativePlayer.cpp プロジェクト: rprouse/CDLite.NET
NativePlayer::NativePlayer() 
    : m_wDeviceID( 0 ), m_callback( 0 ), m_currentDevice( 0 ), m_strCdRomDrives( nullptr )
{
    m_szLastError[0] = '\0';

    // List all valid CD-ROM Devices
    unsigned int nCount = 0;
    wchar_t  strTemp[4];
    wchar_t  strTemp2[32];

    DWORD nDriveMask = ::GetLogicalDrives();
    for ( unsigned int nDrive = 0; nDrive < 32; nDrive++ )
    {
        if ( nDriveMask & ( 1 << nDrive ) )
        {
            //This drive is available
            swprintf_s( strTemp, TEXT( "%c:\\" ), nDrive + 'A' );
            unsigned int nType = ::GetDriveType( strTemp );
            if ( nType == DRIVE_CDROM ) 
            {
                //Only report on CDROM drives
                strTemp2[nCount] = (wchar_t)( nDrive + 'A' );
                nCount++;
            }
        }
    }
    m_numDevices = nCount;
    m_strCdRomDrives = new wchar_t[nCount+1];
    wcsncpy_s( m_strCdRomDrives, nCount*sizeof(wchar_t), strTemp2, nCount );
    m_strCdRomDrives[nCount] = '\0';

    SetDriveID( 0 );
}
コード例 #2
0
ファイル: utility.cpp プロジェクト: Runcy/FastCopy-M
BOOL DriveMng::IsSameDrive(const WCHAR *_root1, const WCHAR *_root2)
{
	WCHAR	root1[MAX_PATH], root2[MAX_PATH];

	::CharUpperW(wcscpy(root1, _root1));
	::CharUpperW(wcscpy(root2, _root2));

	int	idx1 = SetDriveID(root1);
	int	idx2 = SetDriveID(root2);

	if (idx1 == idx2) return TRUE;
	if (idx1 < 0 || idx2 < 0) return FALSE;

	return	drvID[idx1].len == drvID[idx2].len
		&&	memcmp(drvID[idx1].data, drvID[idx2].data, drvID[idx1].len) == 0;
}
コード例 #3
0
ファイル: utility.cpp プロジェクト: BrunoReX/fastcopy
BOOL DriveMng::IsSameDrive(int drvLetter1, int drvLetter2)
{
	drvLetter1 = toupper(drvLetter1);
	drvLetter2 = toupper(drvLetter2);

	if (drvLetter1 == drvLetter2)
		return	TRUE;

	int	idx1 = LetterToIndex(drvLetter1);
	int	idx2 = LetterToIndex(drvLetter2);

	if (drvID[idx1].len == 0)
		SetDriveID(drvLetter1);

	if (drvID[idx2].len == 0)
		SetDriveID(drvLetter2);

	return	drvID[idx1].len == drvID[idx2].len
		&&	memcmp(drvID[idx1].data, drvID[idx2].data, drvID[idx1].len) == 0
		&&	(IS_WINNT_V ? drvID[idx1].len != 1 : (drvID[idx1].len == 0 && noIdCnt == 1));
}