コード例 #1
0
ファイル: SCSIModeSense.cpp プロジェクト: jmullins/efficacy
std::string CSCSIModeSense::GetFormattedSenseData() 
{
	std::string ret;

	if(m_commandBuf.GetDataBuffer().GetSize() <= 0)
	{
		m_fmtString="";
		return m_fmtString;
	}

	const UCHAR *databuf=m_commandBuf.GetDataBuffer().GetData();

	char buf[1024];
	sprintf(buf,"Header : %s\n",GetHexString(databuf,8).c_str());

	ret+=buf;

	sprintf(buf,"Block Descriptor  : %s\n\n",GetHexString(&databuf[8],8).c_str());
	
	ret+=buf;

	int datalen=(databuf[0]<<0x08)+databuf[1];
	int offset=16;

	while(offset < datalen)
	{
		int pageNum=databuf[offset]&0x3F;
		int pageLen=databuf[offset+1];
		const UCHAR *pageBuf=&databuf[offset];

		sprintf(buf,"Page %02X: %s\n",pageNum,GetHexString(pageBuf,pageLen+2).c_str());
		ret+=buf;

		offset+=pageLen+2;
	}

	m_fmtString=ret;
	
	return m_fmtString;
};
コード例 #2
0
ファイル: MyPropertyPage.cpp プロジェクト: hiplayer/mpc_hc
    MyPropertyPage::MyPropertyPage(SharedWaveFormat inputFormat, const AudioDevice* pDevice,
                                   std::vector<std::wstring> processors, bool externalClock, bool live)
        : CUnknown(L"SaneAudioRenderer::MyPropertyPage", nullptr)
    {
        std::wstring adapterField = (pDevice && pDevice->GetAdapterName()) ? *pDevice->GetAdapterName() : L"-";

        std::wstring endpointField = (pDevice && pDevice->GetEndpointName()) ? *pDevice->GetEndpointName() : L"-";

        std::wstring exclusiveField = (pDevice ? (pDevice->IsExclusive() ? L"Yes" : L"No") : L"-");

        std::wstring bufferField = (pDevice ? std::to_wstring(pDevice->GetBufferDuration()) + L"ms" : L"-");

        const bool bitstreaming = (inputFormat && DspFormatFromWaveFormat(*inputFormat) == DspFormat::Unknown);

        std::wstring bitstreamingField = (inputFormat ? (bitstreaming ? L"Yes" : L"No") : L"-");

        std::wstring slavingField = live ? L"Live Source" : externalClock ? L"Graph Clock" : L"Audio Device";

        std::wstring channelsInputField = (inputFormat && !bitstreaming) ? std::to_wstring(inputFormat->nChannels) +
                                              L" (" + GetHexString(DspMatrix::GetChannelMask(*inputFormat)) + L")" : L"-";
        std::wstring channelsDeviceField = (pDevice && !bitstreaming) ? std::to_wstring(pDevice->GetWaveFormat()->nChannels) +
                                              L" (" + GetHexString(DspMatrix::GetChannelMask(*pDevice->GetWaveFormat())) + L")" : L"-";
        std::wstring channelsField = (channelsInputField == channelsDeviceField) ?
                                         channelsInputField : channelsInputField + L" -> " + channelsDeviceField;

        std::wstring formatInputField = (inputFormat ? GetFormatString(*inputFormat) : L"-");
        std::wstring formatDeviceField = (pDevice ? GetFormatString(*pDevice->GetWaveFormat()) : L"-");
        std::wstring formatField = (formatInputField == formatDeviceField) ?
                                       formatInputField : formatInputField + L" -> " + formatDeviceField;

        std::wstring rateInputField = (inputFormat && !bitstreaming) ? std::to_wstring(inputFormat->nSamplesPerSec) : L"-";
        std::wstring rateDeviceField = (pDevice && !bitstreaming) ? std::to_wstring(pDevice->GetWaveFormat()->nSamplesPerSec) : L"-";
        std::wstring rateField = (rateInputField == rateDeviceField) ?
                                      rateInputField : rateInputField + L" -> " + rateDeviceField;

        std::wstring processorsField;
        for (const auto& s : processors)
        {
            if (!processorsField.empty())
                processorsField += L", ";

            processorsField += s;
        }
        if (processorsField.empty())
            processorsField = L"-";

        WriteDialogHeader(m_dialogData, L"MS Shell Dlg", 8);
        WriteDialogItem(m_dialogData, BS_GROUPBOX, 0x0080FFFF, 5, 5, 210, 150, L"Renderer Status");
        WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 20,  60,  8, L"Adapter:");
        WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT,  0x0082FFFF, 73, 20,  130, 8, adapterField);
        WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 32,  60,  8, L"Endpoint:");
        WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT,  0x0082FFFF, 73, 32,  130, 8, endpointField);
        WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 44,  60,  8, L"Exclusive:");
        WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT,  0x0082FFFF, 73, 44,  130, 8, exclusiveField);
        WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 56,  60,  8, L"Buffer:");
        WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT,  0x0082FFFF, 73, 56,  130, 8, bufferField);
        WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 68,  60,  8, L"Bitstreaming:");
        WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT,  0x0082FFFF, 73, 68,  130, 8, bitstreamingField);
        WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 80,  60,  8, L"Slaving:");
        WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT,  0x0082FFFF, 73, 80,  130, 8, slavingField);
        WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 92,  60,  8, L"Format:");
        WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT,  0x0082FFFF, 73, 92,  130, 8, formatField);
        WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 104, 60,  8, L"Channels:");
        WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT,  0x0082FFFF, 73, 104, 130, 8, channelsField);
        WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 116, 60,  8, L"Rate:");
        WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT,  0x0082FFFF, 73, 116, 130, 8, rateField);
        WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 128, 60,  8, L"Processors:");
        WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT,  0x0082FFFF, 73, 128, 130, 24, processorsField);
    }
コード例 #3
0
ファイル: llctrace.c プロジェクト: BillTheBest/WinNT4
//
//  Procedure makes the post mortem dump of the given number of last frames.
//  The output should look very much like in Sniffer.
//  This routine doesn't supprot source routing info, but its implementatin
//  should not be a very big thing.
//
VOID
LlcTraceDump( 
    IN UINT    LastEvents,
    IN UINT    AdapterNumber,
    IN PUCHAR  pRemoteNode
    )
{
    PUCHAR      pDest, pSrc, pCommand, pDlcHeader, pDirection, pTmp;
    UINT        i;
    UCHAR       Buffer1[13], Buffer2[13];
    UCHAR       CmdResp, PollFinal;
    LLC_HEADER  LlcHeader;
    BOOLEAN     IsEthernet;
    PLLC_TRACE_HEADER pTrace;
    UCHAR       DataBuffer[18];
    USHORT      EthernetType;

RtlZeroMemory( DataBuffer, sizeof( DataBuffer ));
LlcTraceWrite( 
    LLC_TRACE_RECEIVE_FRAME, AdapterNumber, sizeof(DataBuffer), DataBuffer );
 
    if (!TraceEnabled)
        return;
    ACQUIRE_SPIN_LOCK( &TraceLock );
    
    printf( 
 "#    Time      Adpt Local Node      Remote Node  Dsp Ssp   Cmd    Nr  Ns\n");
//0---------1---------2---------3---------4---------5---------6---------7-----
//5    10        5    13              13           4   4   9        4   4
    for (
        pTrace = pTraceBufferHead, i = 0;
        i < LastEvents;
        i++)
    {
        EthernetType = 0;
        if (pTrace != pTraceBufferBase)
        {
            pTrace--;
        }
        else
        {
	    pTrace = pTraceBufferTop - 2;
        }

        if (pTrace->Event == LLC_TRACE_END_OF_DATA)
        {
            break;
        }
        //
        //  The highest bit is set in the adapter number, if
        //  it's a token-ring adapter.
        //
        if (pTrace->AdapterNumber & 0x80)
        {
            IsEthernet = FALSE;
        }
        else
            IsEthernet = TRUE;
    
        pDlcHeader = &pTrace->Buffer[14];
        if (IsEthernet)
        {
            pSrc = &pTrace->Buffer[6];
            pDest = pTrace->Buffer;

            //
            //  Discard all non ieee 802.2 frames, but support
            //  the SNA dix headers.
            //
            if (pTrace->Buffer[12] == 0x80 &&
                pTrace->Buffer[13] == 0xd5)
            {
                pDlcHeader = &pTrace->Buffer[17];
            }
            else if (pTrace->Buffer[12] >= 64)
            {
                EthernetType = (USHORT)
                    (((USHORT)pTrace->Buffer[12] << 8) + 
                     pTrace->Buffer[13]
                     );
            }
        }
        else
        {
            pSrc = &pTrace->Buffer[8];
            pDest = &pTrace->Buffer[2];

            //
            //  Skip the source souting info
            //
            if (pTrace->Buffer[8] & 0x80)
                pDlcHeader += pTrace->Buffer[14] & 0x1f;

                //
                //  Discard all non ieee 802.2 frames
                //
            if (pTrace->Buffer[1] != 0x40)
                continue;
        }
        memcpy( (PUCHAR)&LlcHeader, pDlcHeader, 4 );
    
        if (AdapterNumber != -1 && 
            AdapterNumber != ((UINT)pTrace->AdapterNumber & 0x7f))
            continue;

        if (pTrace->Event == LLC_TRACE_SEND_FRAME)
        {
            if (pRemoteNode != NULL && memcmp( pDest, pRemoteNode, 6))
                continue;
            pTmp = pDest;
            pDest = pSrc;
            pSrc = pTmp;
            pDirection = "->";
        }
        else if (pTrace->Event == LLC_TRACE_RECEIVE_FRAME)
        {
            if (pRemoteNode != NULL && memcmp( pSrc, pRemoteNode, 6))
                continue;
            pDirection = "<-";
        }
        else
        {
            continue;
        }
        if (EthernetType != 0)
        {
            printf(
                "%-4u %-9lu %3u  %12s %2s %12s  DIX type %x\n",
                i,
                pTrace->TimerTick,
                pTrace->AdapterNumber & 0x7f,
                GetHexString( pDest, 6, Buffer1 ),
                pDirection,
                GetHexString( pSrc, 6, Buffer2 ),
                EthernetType
                );

        }
        //
        //  Handle first I frames, they are the most common!
        //
        else if (!(LlcHeader.U.Command & LLC_NOT_I_FRAME))
        {
            PollFinal = ' ';
            if (LlcHeader.I.Ssap & LLC_SSAP_RESPONSE)
            {
                CmdResp = 'r';
                if (LlcHeader.I.Nr & LLC_I_S_POLL_FINAL)
                {
                    PollFinal = 'f';
                }
            }
            else
            {
                CmdResp = 'c';
                if (LlcHeader.I.Nr & LLC_I_S_POLL_FINAL)
                {
                    PollFinal = 'p';
                }
            }
            pCommand =  "I";
            printf(
                "%-4u %-9lu %3u  %12s %2s %12s  %-2x  %-2x %5s-%c%c %-3u %-3u\n",
                i,
                pTrace->TimerTick,
                pTrace->AdapterNumber & 0x7f,
                GetHexString( pDest, 6, Buffer1 ),
                pDirection,
                GetHexString( pSrc, 6, Buffer2 ),
                LlcHeader.U.Dsap,
                LlcHeader.U.Ssap & 0xfe,
                pCommand,
                CmdResp,
                PollFinal,
                LlcHeader.I.Nr >> 1,
                LlcHeader.I.Ns >> 1
                ); 
        }
        else if (!(LlcHeader.S.Command & LLC_U_TYPE_BIT))