亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? mfccddb.cpp

?? MfcCDDB v1.11 A freeware MFC class to support access to CDDB servers Welcome to MfcCDDB, a collectio
?? CPP
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):




CCDDB::CCDDB() : m_sProductName(_T("MfcCDDDB")), m_sProductVersion(_T("0.9"))
{
  m_dwLastError = 0;
#ifdef _DEBUG
  m_dwTimeout = 60000; //timeout is set to 60 seconds for debug
#else
  m_dwTimeout = 2000; //2 seconds for release builds
#endif
}

CCDDB::~CCDDB()
{
}

DWORD CCDDB::GetLastError() const 
{ 
  if (m_dwLastError)
    return m_dwLastError; 
  else
    return ::GetLastError();
}

CString CCDDB::GetErrorMessage() const
{
  CString sError;
  if (m_dwLastError)
  {
    TCHAR sMessage[129];
    mciGetErrorString(m_dwLastError, sMessage, 128);
    sError = sMessage;
  }
  else
  {
    //Use the SDK function ::FormatMessage to create a string for us
	  LPTSTR lpBuffer = NULL;
    DWORD dwLastError = ::GetLastError();
    BOOL bSuccess = ::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, 
			                              NULL, dwLastError, MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT), (LPTSTR) &lpBuffer, 0, NULL);
	  if (bSuccess)
	  {
		  sError = lpBuffer;

      //Don't forget to free the memory ::FormatMessage allocated for us
		  LocalFree(lpBuffer);
	  }
    else
    {
      //Restore the error if FormatMessage failed
      SetLastError(dwLastError);
    }
  }

  return sError;
}

DWORD CCDDB::ComputeDiscID(const CArray<CCDDBTrackPosition, CCDDBTrackPosition&>& tracks)
{
  int nTracks = tracks.GetSize() - 1; //Number of tracks is 1 less than the size
                                      //of the array as it also contains the lead 
                                      //out position
  //Validate our parameters
  ASSERT(nTracks > 0);

  //Iterate across all the tracks
  int n=0;
  for (int i=0; i<nTracks; i++)
  {
    int sum = 0;
    int j = tracks[i].m_nMinute*60 + tracks[i].m_nSecond;
    while (j > 0)
    {
      sum += j%10;
      j /=10;
    }
    n += sum;
  }

  //Compute total track length in seconds
  int t = tracks[nTracks].m_nMinute*60 + tracks[nTracks].m_nSecond - tracks[0].m_nMinute - tracks[0].m_nSecond;

  //Compute DISC ID
  DWORD dwDiscID = ((n % 0xFF) << 24 | t << 8 | nTracks);
  return dwDiscID;
}

BOOL CCDDB::GetTrackPositions(CArray<CCDDBTrackPosition, CCDDBTrackPosition&>& tracks, LPCTSTR pszDrive)
{
  //Remove any tracks already in the array
  tracks.RemoveAll();

  //Open the specified "cdaudio" MCI device
  MCI_OPEN_PARMS mciOpenParms;
  mciOpenParms.lpstrDeviceType = _T("cdaudio");
  mciOpenParms.lpstrElementName = pszDrive;
  m_dwLastError = ::mciSendCommand(0, MCI_OPEN, MCI_OPEN_SHAREABLE | MCI_OPEN_TYPE | (pszDrive ? MCI_OPEN_ELEMENT : 0), (DWORD) &mciOpenParms);
  if (m_dwLastError)
  {
    TRACE(_T("Failed to open the cdaudio MCI device, GetLastError:%d, %s\n"), GetLastError(), GetErrorMessage());
    return FALSE;
  }

  //Set the time format to Minute/Second/Frame (MSF) format
  MCI_SET_PARMS mciSetParms;
  mciSetParms.dwTimeFormat = MCI_FORMAT_MSF;
  m_dwLastError = ::mciSendCommand(mciOpenParms.wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD) &mciSetParms);
  if (m_dwLastError)
  {
    //Dont forget to close the MCI device
    ::mciSendCommand(mciOpenParms.wDeviceID, MCI_CLOSE, 0, 0);

    TRACE(_T("Failed to set cdaudio MCI device to MSF format, GetLastError:%d, %s\n"), GetLastError(), GetErrorMessage());
    return FALSE;
  }

  //Get the total track count
  MCI_STATUS_PARMS mciStatusParms;
  mciStatusParms.dwItem = MCI_STATUS_NUMBER_OF_TRACKS;
  m_dwLastError = ::mciSendCommand(mciOpenParms.wDeviceID, MCI_STATUS, MCI_STATUS_ITEM, (DWORD) &mciStatusParms);
  if (m_dwLastError)
  {
    //Dont forget to close the MCI device
    ::mciSendCommand(mciOpenParms.wDeviceID, MCI_CLOSE, 0, 0);

    TRACE(_T("Failed to get number of cdaudio tracks, GetLastError:%d, %s\n"), GetLastError(), GetErrorMessage());
    return FALSE;
  }

  //Iterate through all the tracks getting their starting position
  int nTotalTracks = (int) mciStatusParms.dwReturn;
  tracks.SetSize(nTotalTracks + 1);
  for (int i=1; i<=nTotalTracks; i++)
  {                      
    mciStatusParms.dwItem = MCI_STATUS_POSITION;
    mciStatusParms.dwTrack = i;
    m_dwLastError = mciSendCommand(mciOpenParms.wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK, (DWORD) &mciStatusParms);
    if (m_dwLastError)
    {
      //Dont forget to close the MCI device
      ::mciSendCommand(mciOpenParms.wDeviceID, MCI_CLOSE, 0, 0);

      //Remove all the fields if we have an error getting any of the tracks
      tracks.RemoveAll();

      TRACE(_T("Failed to get track %d's starting position, GetLastError:%d, %s\n"), GetLastError(), GetErrorMessage());
      return FALSE;
    }

    //Save the track position in MSF format
    CCDDBTrackPosition trackPosition;
    trackPosition.m_nMinute = MCI_MSF_MINUTE(mciStatusParms.dwReturn);
    trackPosition.m_nSecond = MCI_MSF_SECOND(mciStatusParms.dwReturn);
    trackPosition.m_nFrame  = MCI_MSF_FRAME(mciStatusParms.dwReturn);

    //Store the value in the array
    tracks.SetAt(i-1, trackPosition);
  }

  //Get the last track's length
  mciStatusParms.dwItem = MCI_STATUS_LENGTH;
  mciStatusParms.dwTrack = nTotalTracks;
  m_dwLastError = mciSendCommand(mciOpenParms.wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_TRACK, (DWORD) &mciStatusParms);
  if (m_dwLastError)
  {
    //Dont forget to close the MCI device
    ::mciSendCommand(mciOpenParms.wDeviceID, MCI_CLOSE, 0, 0);

    //Remove all the fields if we have an error getting any of the tracks
    tracks.RemoveAll();

    TRACE(_T("Failed to get track %d's length, GetLastError:%d, %s\n"), GetLastError(), GetErrorMessage());
    return FALSE;
  }


  //Compute lead-out track position

  DWORD dwLenM = MCI_MSF_MINUTE(mciStatusParms.dwReturn);
  DWORD dwLenS = MCI_MSF_SECOND(mciStatusParms.dwReturn);
  DWORD dwLenF = MCI_MSF_FRAME(mciStatusParms.dwReturn) + 1; //Fix MCI Windows bug according to CDDB Howto doc
  DWORD dwPosM = tracks[nTotalTracks-1].m_nMinute;
  DWORD dwPosS = tracks[nTotalTracks-1].m_nSecond;
  DWORD dwPosF = tracks[nTotalTracks-1].m_nFrame;

  //Compute lead out track position (in frame format)
  DWORD dwPos = (dwPosM*60*75) + (dwPosS*75) + dwPosF + (dwLenM*60*75) + (dwLenS*75) + dwLenF;

  //Convert dwPos back to MSF format
  CCDDBTrackPosition trackPosition;
  trackPosition.m_nFrame = dwPos % 75;
  dwPos /= 75;
  trackPosition.m_nSecond = dwPos % 60;
  dwPos /= 60;
  trackPosition.m_nMinute = dwPos;

  //And store in the array
  tracks.SetAt(nTotalTracks, trackPosition);

  //Dont forget to close the MCI device
  ::mciSendCommand(mciOpenParms.wDeviceID, MCI_CLOSE, 0, 0);

  return TRUE;
}

BOOL CCDDB::ComputeDiscID(DWORD& dwDiscID, LPCTSTR pszDrive)
{
  //Get the track details
  CArray<CCDDBTrackPosition, CCDDBTrackPosition&> tracks;
  if (!GetTrackPositions(tracks, pszDrive))
    return FALSE;
  
  //Compute the DISC ID now that we have got all the track information
  dwDiscID = ComputeDiscID(tracks);
  
  return TRUE;    
}
    
void CCDDB::GetCDROMDrives(CStringArray& drives)
{
  //empty out the array
  drives.RemoveAll();

  //Iterate across all the drive letters to find out which ones are CDROMs
  for (int i=1; i<=26; i++)
  {
    CString sDrive;
    sDrive.Format(_T("%c:"), i-1+'A');
    if (GetDriveType(sDrive) == DRIVE_CDROM)
      drives.Add(sDrive);
  }
}

BOOL CCDDB::ReadResponse(CHTTPSocket& socket, LPSTR pszBuffer, int nInitialBufSize, LPSTR pszTerminator, LPSTR* ppszOverFlowBuffer, int nGrowBy, DWORD dwHint)
{
  ASSERT(ppszOverFlowBuffer);          //Must have a valid string pointer
  ASSERT(*ppszOverFlowBuffer == NULL); //Initially it must point to a NULL string

  //The local variables which will receive the data
  LPSTR pszRecvBuffer = pszBuffer;
  int nBufSize = nInitialBufSize;
  
  //Retrieve the reponse using until we
	//get the terminator or a timeout occurs
	BOOL bFoundTerminator = FALSE;
  BOOL bContinue = TRUE;
	int nReceived = 0;
	DWORD dwStartTicks = ::GetTickCount();
	while (!bFoundTerminator && bContinue)
	{
		//Has the timeout occured
		if ((::GetTickCount() - dwStartTicks) >	m_dwTimeout)
		{
      if (pszRecvBuffer && nReceived)
      {
		    pszRecvBuffer[nReceived] = '\0';
        m_sLastCommandResponse = pszRecvBuffer; //Hive away the last command reponse
      }
      SetLastError(WSAETIMEDOUT);
      m_dwLastError = 0;
			return FALSE;
		}

    //check the socket for readability
    BOOL bReadible;
    if (!socket.IsReadible(bReadible))
    {
      if (pszRecvBuffer && nReceived)
      {
	      pszRecvBuffer[nReceived] = '\0';
        m_sLastCommandResponse = pszRecvBuffer; //Hive away the last command reponse
      }
      m_dwLastError = 0;
			return FALSE;
    }
    else if (!bReadible) //no data to receive, just loop around
    {
      Sleep(250); //Sleep for a while before we loop around again
      continue;
    }

		//receive the data from the socket
    int nBufRemaining = nBufSize-nReceived-1; //Allows allow one space for the NULL terminator
    if (nBufRemaining<0)
      nBufRemaining = 0;
	  int nData = socket.Receive(pszRecvBuffer+nReceived, nBufRemaining);

    if (nData)
    {
      //Reset the idle timeout if data was received
			dwStartTicks = ::GetTickCount();

      //Increment the count of data received
		  nReceived += nData;							   
    }

    //If an error occurred receiving the data
		if (nData == SOCKET_ERROR)
		{
      //NULL terminate the data received
      if (pszRecvBuffer)
		    pszBuffer[nReceived] = '\0';

      m_dwLastError = 0;
      m_sLastCommandResponse = pszRecvBuffer; //Hive away the last command reponse
		  return FALSE; 
		}
		else
		{
      //NULL terminate the data received
      if (pszRecvBuffer)
		    pszRecvBuffer[nReceived] = '\0';

      if (nBufRemaining-nData == 0) //No space left in the current buffer
      {
        //Allocate the new receive buffer
        nBufSize += nGrowBy; //Grow the buffer by the specified amount
        LPSTR pszNewBuf = new char[nBufSize];   
        pszNewBuf[0] = '\0'; //Initially NULL terminate the data

        //copy the old contents over to the new buffer and assign 
        //the new buffer to the local variable used for Retrieveing 
        //from the socket
        if (pszRecvBuffer)
          strcpy(pszNewBuf, pszRecvBuffer);
        pszRecvBuffer = pszNewBuf;

        //delete the old buffer if it was allocated
        if (*ppszOverFlowBuffer)
          delete [] *ppszOverFlowBuffer;
        
        //Remember the overflow buffer for the next time around
        *ppszOverFlowBuffer = pszNewBuf;        
      }
		}

    //Special case code for reading a Query response
    if (dwHint == READ_RESPONSE_QUERY)
    {
      if (pszRecvBuffer && strlen(pszRecvBuffer))
      {
        //Extract the HTTP body from the response;
        LPSTR pszBody = FindHTTPBody(pszRecvBuffer);

        //From the HTTP body get the CDDB response code
        int nResponseCode = GetCDDBReponseCode(pszBody);

        //Only continue to receive data if the response code indicates more data is to be received
        if ((nResponseCode < 210 || nResponseCode > 219))
          bContinue = FALSE;          
      }
    }
    else if (dwHint == READ_RESPONSE_SUBMIT)    //Special case code for reading a submit response
    {
      if (pszRecvBuffer && strlen(pszRecvBuffer))
      {
        //Extract the HTTP body from the response;
        LPSTR pszBody = FindHTTPBody(pszRecvBuffer);

        //From the HTTP body get the CDDB response code
        int nResponseCode = GetCDDBReponseCode(pszBody);

        //Only continue to receive data if the response code indicates more data is to be received
        if ((nResponseCode < 210 || nResponseCode > 219))
          bContinue = FALSE;          
      }
    }


    //Check to see if the terminator character(s) have been found
		bFoundTerminator = (strstr(pszRecvBuffer, pszTerminator) != NULL);
	}

	//Remove the terminator from the response data
  if (bFoundTerminator)
    pszRecvBuffer[nReceived - strlen(pszTerminator)] = '\0';

  return TRUE;
}

CString CCDDB::GetUserName()
{
  //Get the user name 
  TCHAR sComputerName[_MAX_PATH];
  DWORD dwSize = _MAX_PATH;
  ::GetUserName(sComputerName, &dwSize);

  return sComputerName;
}

CString CCDDB::GetHostName()
{
  CString sHost;
  char pszHost[_MAX_PATH];
  if (gethostname(pszHost, _MAX_PATH) == 0)
    sHost = pszHost;
  return sHost;
}

CString CCDDB::GetHelloCommand()
{
  CString sCommand;
  sCommand.Format(_T("hello=%s+%s+%s+%s&proto=4"), GetUserName(), GetHostName(), m_sProductName, m_sProductVersion);
  return sCommand;
}

LPSTR CCDDB::FindHTTPBody(LPCSTR pszResponse)
{
  //Validate our parameters
  ASSERT(pszResponse);
  ASSERT(strlen(pszResponse));

  //Find the HTTP body
  LPSTR pszData = strstr(pszResponse, "\r\n\r\n");
  
  //If found, skip over the 2 lines
  if (pszData)
    pszData += 4;

  return pszData;  
}

LPSTR CCDDB::SkipToNextLine(LPSTR pszLine)
{
  //Validate our parameters
  ASSERT(pszLine);

  //Find the next line. Both Dos (\r\n) 
  //and Unix (\n) terminators are valid. First try to
  //find a DOS EOL
  LPSTR lpszData = strstr(pszLine, "\r\n");
  if (lpszData)
    lpszData += 2;
  else
  {
    lpszData = strstr(pszLine, "\n");
    if (lpszData)
      lpszData++;
  }

  return lpszData;  
}

LPSTR CCDDB::GetNextLine(LPSTR pszLine)
{
  //validate our parameters
  ASSERT(pszLine);
  ASSERT(strlen(pszLine));

  //Find the start of the next line. Both Dos (\r\n) 
  //and Unix (\n) terminators are valid. First try to
  //find a DOS EOL

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
自拍偷拍亚洲综合| 91黄色免费版| 色屁屁一区二区| 欧美午夜精品理论片a级按摩| 欧美日韩在线三区| 欧美电影免费观看高清完整版在| 精品国产伦一区二区三区观看方式| 亚洲国产成人在线| 一区二区三区四区国产精品| 日本欧美大码aⅴ在线播放| 国产自产高清不卡| gogogo免费视频观看亚洲一| 欧美性猛交xxxxxx富婆| 日韩免费高清av| 中文字幕一区二区三区不卡| 香蕉久久一区二区不卡无毒影院| 另类欧美日韩国产在线| 91在线云播放| 日韩欧美综合在线| 亚洲欧洲av在线| 免费人成网站在线观看欧美高清| 成人免费高清在线| 91麻豆精品国产91久久久久久| 国产日韩v精品一区二区| 亚洲午夜精品久久久久久久久| 久色婷婷小香蕉久久| 91亚洲精品久久久蜜桃| 精品区一区二区| 亚洲综合色婷婷| 国产成人自拍高清视频在线免费播放| 一道本成人在线| 久久精品在线观看| 日韩不卡在线观看日韩不卡视频| 成人国产电影网| 日韩三级.com| 香港成人在线视频| 色综合久久久久综合体| 久久久久久久电影| 日韩精品一级二级| 色天使色偷偷av一区二区| 国产亚洲综合av| 裸体一区二区三区| 欧美影视一区在线| 自拍偷自拍亚洲精品播放| 国产精品18久久久久久久久久久久| 欧美老年两性高潮| 亚洲另类在线一区| 成人性生交大片免费看在线播放| 偷拍一区二区三区| 91视频观看视频| 国产欧美精品一区二区三区四区| 日本成人在线电影网| 欧美午夜在线观看| 日韩一区日韩二区| 成人一区二区三区视频| 久久亚洲捆绑美女| 老司机精品视频一区二区三区| 欧美三级视频在线| 亚洲欧美激情视频在线观看一区二区三区| 国产真实乱偷精品视频免| 欧美一区二区大片| 日日摸夜夜添夜夜添亚洲女人| 色狠狠av一区二区三区| 专区另类欧美日韩| 99免费精品在线| 国产精品久久久久久久岛一牛影视 | 国产精品女上位| 国产精品综合av一区二区国产馆| 精品国产伦一区二区三区观看体验 | av影院午夜一区| 日本一区二区成人| 成人国产精品视频| 国产精品久久久久久一区二区三区 | 在线播放视频一区| 亚洲6080在线| 4438x亚洲最大成人网| 亚洲一区二区在线观看视频| 色94色欧美sute亚洲线路一ni | 91在线无精精品入口| 欧美国产日韩一二三区| 成人毛片视频在线观看| 国产精品女主播av| 色婷婷综合久久久中文字幕| 亚洲免费在线视频一区 二区| 91精品1区2区| 亚洲福利视频一区二区| 69堂亚洲精品首页| 奇米色777欧美一区二区| 精品国产一区二区三区忘忧草| 精品一区中文字幕| 久久这里只精品最新地址| 国产高清精品久久久久| 欧美国产97人人爽人人喊| 不卡一区二区三区四区| 悠悠色在线精品| 欧美日韩在线一区二区| 久草在线在线精品观看| 久久免费午夜影院| 99视频热这里只有精品免费| 一区二区三区色| 69久久99精品久久久久婷婷| 久久66热re国产| 成人欧美一区二区三区白人| 欧洲一区二区三区在线| 免费观看一级欧美片| 国产亚洲综合色| 97精品电影院| 亚洲成av人影院在线观看网| 日韩视频免费观看高清完整版| 国产成人免费高清| 亚洲免费观看高清完整版在线| 91.成人天堂一区| 国产精品一区在线观看乱码| 亚洲欧美成aⅴ人在线观看| 制服丝袜国产精品| 国产真实乱对白精彩久久| 中文字幕在线一区免费| 欧美视频一区二区三区四区| 久久99久久99| 国产精品国产馆在线真实露脸| 欧美在线视频不卡| 精品亚洲欧美一区| 一区二区三区色| 欧美精品一区二区三区蜜桃| 色综合久久综合| 免费在线视频一区| 亚洲三级电影全部在线观看高清| 91精品国产乱| 91香蕉国产在线观看软件| 欧美aa在线视频| 亚洲精品自拍动漫在线| 日韩亚洲欧美中文三级| 91麻豆免费看| 韩国精品在线观看| 9色porny自拍视频一区二区| 国产精品一二三| 欧洲av在线精品| 日韩一级大片在线| 亚洲视频一区二区免费在线观看| 狠狠久久亚洲欧美| 在线视频综合导航| 国产一区在线精品| 丝袜美腿一区二区三区| ...av二区三区久久精品| 欧美亚洲日本国产| 午夜亚洲国产au精品一区二区| 欧美亚洲高清一区二区三区不卡| 91精品国产综合久久国产大片| 亚洲精选一二三| 色综合久久久久久久久久久| 久久精品av麻豆的观看方式| 精品欧美一区二区久久| 国产精品白丝jk白祙喷水网站| 欧美精品三级日韩久久| 久久久亚洲精品一区二区三区| 亚洲自拍都市欧美小说| 一本一本大道香蕉久在线精品| www一区二区| 亚洲国产另类av| 91亚洲国产成人精品一区二三| 国产欧美一区二区精品仙草咪| 视频一区二区三区入口| 91麻豆精品国产自产在线 | 中文字幕一区二区三区蜜月| 成人深夜在线观看| 国产精品视频线看| 99精品欧美一区二区三区综合在线| 亚洲国产高清不卡| 7777精品伊人久久久大香线蕉经典版下载| 91网站在线观看视频| 高清不卡在线观看| 国产精品1区二区.| 国产精品资源在线| 国产一区二区主播在线| 久久97超碰国产精品超碰| 男人操女人的视频在线观看欧美| 一区二区不卡在线视频 午夜欧美不卡在 | 亚洲欧美日韩国产一区二区三区| 国产v综合v亚洲欧| 亚洲三级视频在线观看| 欧美高清hd18日本| 日韩中文字幕麻豆| 日韩一区二区三区免费看| 午夜视频一区二区三区| 3d动漫精品啪啪一区二区竹菊| 午夜视黄欧洲亚洲| 欧美四级电影在线观看| 免费黄网站欧美| 精品处破学生在线二十三| 99国产精品久久久久久久久久| 91精品在线免费| 99精品1区2区| 亚洲午夜在线电影| 51精品国自产在线| 成人高清视频在线观看| 亚洲欧美在线观看| 日本韩国精品一区二区在线观看| 综合分类小说区另类春色亚洲小说欧美| www.成人网.com| 国产精品久久久久影院|