bool CWebCDCovers::SearchCovers(CString strKeywords, HWND hwndList, HWND hwndProgress, HWND hwndStatus)
{
	bool bSuccess = false;

	//if (!CHttpReqSocket::IsInternetConnected ())
	//{
	//	AfxMessageBox (IDS_INTERNETERROR_IMAGES, MB_ICONEXCLAMATION);
	//	m_nError = -1;
	//	return false;
	//}

	CString strMsg;
	strMsg.Format (IDS_SEARCHING, (LPSTR) (LPCTSTR) strKeywords);

	if (m_dwDownloadId == gl_stkDownloads.back ())
	{
		::SendMessage (hwndProgress, PBM_SETPOS, 0, 0);
		::ShowWindow (hwndProgress, SW_SHOW);
	}

	LVITEM lvItem;
	for (int i = 0; i < ListView_GetItemCount (hwndList); i++)
	{
		ListView_GetItem (hwndList, &lvItem);
		//delete (COVERIMAGES*) lvItem.lParam;
	}
	ListView_DeleteAllItems (hwndList);

	// do the downloads
	bSuccess = RetrieveList (WCC_SEARCH, CHttpReqSocket::URLEncode (strKeywords),
		hwndList, NULL, hwndProgress, hwndStatus, strMsg);

	if (m_dwDownloadId == gl_stkDownloads.back ())
	{
		for (int i = 1; i <= 4; i++)
			::SendMessage (hwndStatus, SB_SETTEXT, i, (LPARAM) "");
		::ShowWindow (hwndProgress, SW_HIDE);
	}

	return bSuccess;
}
bool CWebCDCovers::GetList(CString strLetter, HWND hwndList, HTREEITEM htiParent, HWND hwndProgress, HWND hwndStatus)
{
	bool bSuccess = false;

	//if (!CHttpReqSocket::IsInternetConnected ())
	//{
	//	AfxMessageBox (IDS_INTERNETERROR_IMAGES, MB_ICONEXCLAMATION);
	//	m_nError = -1;
	//	return false;
	//}

	CString strMsg;
	strMsg.LoadString (IDS_DOWNLOADING_LIST);

	if (m_dwDownloadId == gl_stkDownloads.back ())
	{
		::SendMessage (hwndProgress, PBM_SETPOS, 0, 0);
		::ShowWindow (hwndProgress, SW_SHOW);
	}
/*
	for (int i = 0; i < pList->GetItemCount (); i++)
		delete (COVERIMAGES*) pList->GetItemData (i);
	pList->DeleteAllItems ();
*/
	// do the downloads
	bSuccess = RetrieveList (WCC_LIST, strLetter, hwndList, htiParent, hwndProgress, hwndStatus, strMsg);

	if (m_dwDownloadId == gl_stkDownloads.back ())
	{
		for (int i = 1; i <= 4; i++)
			::SendMessage (hwndStatus, SB_SETTEXT, i, (LPARAM) "");
		::ShowWindow (hwndProgress, SW_HIDE);
	}

	return bSuccess;
}
Ejemplo n.º 3
0
NET_API_STATUS
GetMasterName( XPORTINFO *TestedXportInfo,
               INT       iNumOfTestedXports,
               INT       index,
               LPTSTR    Domain,
               LPTSTR    Master)
{
NET_API_STATUS  Status;

    //
    // For IPX we need a hack.  GetNetBiosMasterName will fail in Daytona (NT3.5)
    // and NT3.1.  So we find the BackUp on NwlnkIpx , retrieve the List from one
    // of those through NwLnkNb and see who is the master in the List
    //
    if((TestedXportInfo[index].index == IPX) && bIPXHack){

          TCHAR  wcBackUpBrowsers[MAXBACKUPS][CNSLASHLEN+1];
          INT    i, ibcount=0;
          ULONG  ulNumBackUps = 0;
          DWORD  dwEntriesInList;
          DWORD  dwTotalEntries;
          PVOID  pvServerList;
          PSERVER_INFO_101 pServerInfo101_l1;

          //
          // If the local browse master is not started then we cannot get the backup
          // list in nwlnkipx so we use nwlnknb.
          //
          if(lpLocMachineInfo->BrowserServiceStarted)
             Status = GetBList(TestedXportInfo[index].Transport, Domain, TRUE, &ulNumBackUps, wcBackUpBrowsers);
          else {
             for(i = 0; i < iNumOfTestedXports && TestedXportInfo[i].index != NBIPX; i++);
             if(i < iNumOfTestedXports)
                Status = GetBList(TestedXportInfo[i].Transport, Domain, TRUE, &ulNumBackUps, wcBackUpBrowsers);
             else
                return(!NERR_Success);
          }

          if(Status == NERR_Success) {

              if(ulNumBackUps){

                 do{

                    if((Status = RetrieveList(wcBackUpBrowsers[ibcount],  L"\\Device\\NwlnkNb", &pvServerList,
                            &dwEntriesInList, &dwTotalEntries, (SV_TYPE_ALTERNATE_XPORT | SV_TYPE_MASTER_BROWSER), NULL, NULL, FALSE)) == NERR_Success){

                        if(dwEntriesInList) {
                           pServerInfo101_l1 = pvServerList;
                           wcscpy(Master, pServerInfo101_l1[0].sv101_name);

                        } else {

                           Status = (!NERR_Success);
                        }

                     }// Retrieve List

                    NetApiBufferFree(pvServerList);
                    ibcount++;

                 }while((Status != NERR_Success) && (ibcount < (INT)ulNumBackUps));

              } else  // If got any BackUp
                 return (!NERR_Success);

          } // If GetBList

          return Status;
    }

    //
    // For TCP we need to clear the local cache before making a new call
    // to GetNetBiosMasterName
    //
    if(TestedXportInfo[index].index == TCP)
//        system("NbtStat -R");
       ClearNbtNameTableCache(TestedXportInfo[index].Transport);


    Status = GetNetBiosMasterName(
                        TestedXportInfo[index].Transport.Buffer,
                        Domain,
                        Master,
                        NULL);



 return Status;
}