这篇教程C++ GetLogicalDrives函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetLogicalDrives函数的典型用法代码示例。如果您正苦于以下问题:C++ GetLogicalDrives函数的具体用法?C++ GetLogicalDrives怎么用?C++ GetLogicalDrives使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetLogicalDrives函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: drive_exists/* drive_exists: * Checks whether the specified drive is valid. */static int drive_exists(int x){ #ifdef ALLEGRO_DOS /* DOS implementation */ unsigned int old; int ret = FALSE; __dpmi_regs r; /* get actual drive */ r.h.ah = 0x19; __dpmi_int(0x21, &r); old = r.h.al; /* see if drive x is assigned as a valid drive */ r.h.ah = 0x0E; r.h.dl = x; __dpmi_int(0x21, &r); r.h.ah = 0x19; __dpmi_int(0x21, &r); if (r.h.al == x) { /* ok, now check if it is a logical drive or not... */ r.x.ax = 0x440E; r.h.bl = x+1; __dpmi_int(0x21, &r); if ((r.x.flags & 1) || /* call failed */ (r.h.al == 0) || /* has no logical drives */ (r.h.al == (x+1))) /* not a logical drive */ ret = TRUE; } /* now we set the old drive */ r.h.ah = 0x0E; r.h.dl = old; __dpmi_int(0x21, &r); return ret; #elif defined ALLEGRO_WINDOWS /* Windows implementation */ return GetLogicalDrives() & (1 << x); #elif defined ALLEGRO_MPW /* MacOs implementation */ return GetLogicalDrives() & (1 << x); #else /* unknown platform */ return TRUE; #endif}
开发者ID:albinoz,项目名称:raine,代码行数:61,
示例2: RETURN_IF_ERROROP_STATUSWindowsOpFolderLister::Construct(const uni_char* path, const uni_char* pattern){ m_find_handle = INVALID_HANDLE_VALUE; RETURN_IF_ERROR(m_path_pattern.Set(path)); if (!m_path_pattern.Length() || m_path_pattern[m_path_pattern.Length() - 1] != '//') { RETURN_IF_ERROR(m_path_pattern.Append("//")); } m_path = OP_NEWA(uni_char, m_path_pattern.Length() + MAX_PATH + 1); if (m_path == NULL) return OpStatus::ERR_NO_MEMORY; m_path_length = m_path_pattern.Length(); uni_strcpy(m_path, m_path_pattern.CStr()); RETURN_IF_ERROR(m_path_pattern.Append(pattern)); if (!m_path_pattern.Compare(UNI_L("//*"))) { if ((m_drives = GetLogicalDrives()) == 0) return OpStatus::ERR; } else if (m_path_pattern[0] == '//' && m_path_pattern[1] != '//') // remove / before drive name if present but not from network paths { m_path_pattern.Delete(0, 1); } return OpStatus::OK;}
开发者ID:prestocore,项目名称:browser,代码行数:30,
示例3: GetLogicalDrivesint CUpdateBase::GetUDisk(char pDiskName[], int len){ DWORD MaxDriveSet; DWORD drive; TCHAR szDrvName[33]; int count = 0; MaxDriveSet = GetLogicalDrives();//GetLogicalDrives for (drive = 0; drive < 32; drive++) { if ( MaxDriveSet & (1 << drive) ) { DWORD temp = 1<<drive; _stprintf(szDrvName, _T("%c://"), 'A'+drive);//szDrvName if(GetDriveType(szDrvName)== DRIVE_REMOVABLE && (drive > 1)) { pDiskName[count++] = 'A'+ (char)drive; if(count >= len) { break; } } } } return count;}
开发者ID:Lamobo,项目名称:Lamobo-D1,代码行数:29,
示例4: GetLogicalDrivesvoid CMountPoints::GetDriveVolumes(){ m_drive.SetSize(32); DWORD drives= GetLogicalDrives(); int i; DWORD mask= 0x00000001; for (i=0; i < 32; i++, mask <<= 1) { CString volume; if ((drives & mask) != 0) { CString s; s.Format(_T("%c://"), i + _T('A')); BOOL b= m_va.GetVolumeNameForVolumeMountPoint(s, volume.GetBuffer(_MAX_PATH), _MAX_PATH); volume.ReleaseBuffer(); if (!b) { TRACE(_T("GetVolumeNameForVolumeMountPoint(%s) failed./n"), s); volume.Empty(); } } m_drive[i]= volume; }}
开发者ID:Meitinger,项目名称:windirstat,代码行数:29,
示例5: SendMessagevoid CIRC::FindDrives(void){ char szDrive[MSG_SIZE]="", szVolumeName[MSG_SIZE]="", szFileSystem[MSG_SIZE]=""; DWORD dwDrives=0, dwSerial, dwMask=1, dwDamn1, dwDamn2; int iTemp=65; SendMessage("Start of drive listing"); dwDrives = GetLogicalDrives(); for(int i=0; i<26; i++) { if((dwDrives & dwMask)) { sprintf(szDrive, "%c://", iTemp); GetVolumeInformation(szDrive, szVolumeName, MSG_SIZE, &dwSerial, &dwDamn1, &dwDamn2, szFileSystem, MSG_SIZE); sprintf(szDrive, "%c:// %s %s", iTemp, szVolumeName, szFileSystem); SendMessage(szDrive); memset(szDrive, 0, MSG_SIZE); memset(szVolumeName, 0, MSG_SIZE); memset(szFileSystem, 0, MSG_SIZE); } iTemp+=1; dwMask *= 2; } SendMessage("End of drive listing");}
开发者ID:fatenocaster,项目名称:obfuscation-crypto-repo,代码行数:32,
示例6: GetLogicalDrives//================================================================================================================vector<string> CGlobal::GetAvailableDrives(){ DWORD bitmask = GetLogicalDrives(); vector<string> drivesAvailable; vector<string> driveList; //Can add the rest of the alphabet. driveList.push_back("a:"); driveList.push_back("b:"); driveList.push_back("c:"); driveList.push_back("d:"); driveList.push_back("e:"); driveList.push_back("f:"); driveList.push_back("g:"); driveList.push_back("h:"); driveList.push_back("i:"); for (int i = 0; i < driveList.size(); i++) { string drive = driveList[i]; if ((bitmask & (1 << i)) == 0) //Shift bitmask and if 0 drive is free { // Free and does not exist in the system } else { drivesAvailable.push_back(drive); } } return drivesAvailable;}
开发者ID:henriyl,项目名称:ZShadeSandboxOld,代码行数:35,
示例7: frontend_win32_parse_drive_liststatic int frontend_win32_parse_drive_list(void *data, bool load_content){#ifdef HAVE_MENU file_list_t *list = (file_list_t*)data; enum msg_hash_enums enum_idx = load_content ? MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR : MSG_UNKNOWN; size_t i = 0; unsigned drives = GetLogicalDrives(); char drive[] = " ://"; for (i = 0; i < 32; i++) { drive[0] = 'A' + i; if (drives & (1 << i)) menu_entries_append_enum(list, drive, msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), enum_idx, FILE_TYPE_DIRECTORY, 0, 0); }#endif return 0;}
开发者ID:leiradel,项目名称:RetroArch,代码行数:25,
示例8: get_disk_info_allvoid get_disk_info_all(){ DWORD dwNumBytesForDriveStrings; char DriveStrings[255]; char* dp = DriveStrings; dwNumBytesForDriveStrings = GetLogicalDriveStrings(254,dp); if (dwNumBytesForDriveStrings != 0) { /* GetLogicalDriveStringsIs supported on this platform */ while (*dp != 0) { output_drive_info(dp); dp = strchr(dp,0) +1; } } else { /* GetLogicalDriveStrings is not supported (some old W95) */ DWORD dwDriveMask = GetLogicalDrives(); int nDriveNum; char drivename[]="A://"; /*printf("DriveName95 DriveType BytesAvail BytesTotal BytesTotalFree/n");*/ for (nDriveNum = 0; dwDriveMask != 0;nDriveNum++) { if (dwDriveMask & 1) { drivename[0]='A'+ nDriveNum; output_drive_info(drivename); } dwDriveMask = dwDriveMask >> 1; } }}
开发者ID:0x00evil,项目名称:otp,代码行数:28,
示例9: playlist_loaddir_get_driveinfosstatic void playlist_loaddir_get_driveinfos(void){ DWORD drivesbits,i,vlen; loaddir_clear_driveinfos(0); drivesbits=GetLogicalDrives(); if(!drivesbits) return; i=LOADDIR_FIRSTDRIVE; drivesbits>>=LOADDIR_FIRSTDRIVE; do{ if(drivesbits&1){ mpxplay_drivemap_info_t *di=&drivemap_infos[i]; di->type=pds_chkdrive(i); loaddir_build_drivename(i,di->drivename); if((i>=2) || (di->type!=DRIVE_TYPE_FLOPPY)){ if(di->type==DRIVE_TYPE_NETWORK){ vlen=LOADDIR_DRIVE_VOLUMENAME_LEN; WNetGetConnection(di->drivename,&di->volumename[0],&vlen); } if((di->type!=DRIVE_TYPE_NETWORK) || !di->volumename[0]) pds_drive_getvolumelabel(i,&di->volumename[0],LOADDIR_DRIVE_VOLUMENAME_LEN); } if(loaddir_lastvaliddrive<i) loaddir_lastvaliddrive=i; } drivesbits>>=1; i++; }while(i<LOADDIR_MAX_LOCAL_DRIVES); loaddir_diskdrives_mount_localdisks();}
开发者ID:en-vorobiov,项目名称:mpxplay,代码行数:34,
示例10: GetCryptKeystatic void GetCryptKey(uint32_t* cryptKey, unsigned numElements){ char volName[] = "C://"; int index = 0; DWORD logicalDrives = GetLogicalDrives(); for (int i = 0; i < 32; ++i) { if (logicalDrives & (1 << i)) { volName[0] = ('C' + i); DWORD volSerialNum = 0; BOOL result = GetVolumeInformation( volName, //LPCTSTR lpRootPathName, NULL, //LPTSTR lpVolumeNameBuffer, 0, //DWORD nVolumeNameSize, &volSerialNum, //LPDWORD lpVolumeSerialNumber, NULL, //LPDWORD lpMaximumComponentLength, NULL, //LPDWORD lpFileSystemFlags, NULL, //LPTSTR lpFileSystemNameBuffer, 0 //DWORD nFileSystemNameSize ); cryptKey[index] = (cryptKey[index] ^ volSerialNum); index = (++index) % numElements; } }}
开发者ID:Asteral,项目名称:Plasma,代码行数:30,
示例11: SetRedrawvoid CTreeFileCtrl::DisplayDrives(HTREEITEM hParent, BOOL bUseSetRedraw){ CWaitCursor c; //Speed up the job by turning off redraw if (bUseSetRedraw) SetRedraw(FALSE); //Remove any items currently in the tree DeleteAllItems(); //Enumerate the drive letters and add them to the tree control DWORD dwDrives = GetLogicalDrives(); DWORD dwMask = 1; for (int i=0; i<32; i++) { if (dwDrives & dwMask) { CString sDrive; sDrive.Format(_T("%c://"), i + _T('A')); InsertFileItem(sDrive, sDrive, hParent); } dwMask <<= 1; } if (bUseSetRedraw) SetRedraw(TRUE);}
开发者ID:5432935,项目名称:genesis3d,代码行数:28,
示例12: SetErrorModeconst std::deque<VolumeInfo> CVolumeEnumerator::enumerateVolumesImpl(){ std::deque<VolumeInfo> volumes; const auto oldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); EXEC_ON_SCOPE_EXIT([oldErrorMode]() {SetErrorMode(oldErrorMode);}); DWORD drives = GetLogicalDrives(); if (drives == 0) { qInfo() << "GetLogicalDrives() returned an error:" << ErrorStringFromLastError(); return volumes; } for (char driveLetter = 'A'; drives != 0 && driveLetter <= 'Z'; ++driveLetter, drives >>= 1) { if ((drives & 0x1) == 0) continue; const auto volumeInfo = volumeInfoForDriveLetter(QString(driveLetter) + QStringLiteral("://")); if (!volumeInfo.isEmpty()) volumes.push_back(volumeInfo); } return volumes;}
开发者ID:VioletGiraffe,项目名称:file-commander,代码行数:26,
示例13: do_pathsstatic int do_paths(int sel) { path_sel *paths = new path_sel(); paths->add_item(getenv("HOME"));#ifdef RAINE_UNIX int pipe_opened = 0; FILE *f = fopen("/etc/mtab","r"); if (!f) { // Darwin doesn't seem to have a file for that, so let's use popen... f = popen("mount","r"); pipe_opened = 1; } if (f) { char buff[2048]; while (!feof(f)) { fgets(buff,2048,f); if (strncmp(buff,"/dev/",5)) // keep only the /dev entries continue; char *s1 = strchr(buff,' '); if (!s1) continue; char *s2 = strchr(s1+1,' '); if (!s2) continue; *s2 = 0; if (!strcmp(s1+1,"on")) { // darwin speciality, just ignore it s1 = s2; s2 = strchr(s1+1,'('); if (!s2) continue; s2[-1] = 0; } paths->add_item(s1+1); } if (pipe_opened) pclose(f); else fclose(f); }#else // windows paths->add_item(getenv("PROGRAMFILES")); paths->add_item(getenv("USERPROFILE")); int drives = GetLogicalDrives(); int n; char path[3]; strcpy(path,"x:"); for (n=0; n<32; n++) { if (drives & (1<<n)) { path[0]=65+n; paths->add_item(path); } }#endif selected_path = -1; TMenu *menu = new TPathDlg((char*)_("Path selection"),paths->get_menu()); menu->execute(); if (selected_path >= 0) dlg->set_dir((char*)paths->get_menu()[selected_path].label); delete menu; delete paths; return 0;}
开发者ID:albinoz,项目名称:raine,代码行数:60,
示例14: GetLogicalDriveschar *Bgetsystemdrives(void){#ifdef _WIN32 char *str, *p; DWORD drv, mask; int number=0; drv = GetLogicalDrives(); if (drv == 0) return NULL; for (mask=1; mask<0x8000000l; mask<<=1) { if ((drv&mask) == 0) continue; number++; } str = p = (char *)malloc(1 + (3*number)); if (!str) return NULL; number = 0; for (mask=1; mask<0x8000000l; mask<<=1, number++) { if ((drv&mask) == 0) continue; *(p++) = 'A' + number; *(p++) = ':'; *(p++) = 0; } *(p++) = 0; return str;#else // Perhaps have Unix OS's put /, /home/user, and /mnt/* in the "drives" list? return NULL;#endif}
开发者ID:TermiT,项目名称:Shadow-Warrior-iOS,代码行数:33,
示例15: DiskDriveQueryDeviceMapULONG DiskDriveQueryDeviceMap(VOID){#ifndef _WIN64 PROCESS_DEVICEMAP_INFORMATION deviceMapInfo;#else PROCESS_DEVICEMAP_INFORMATION_EX deviceMapInfo;#endif memset(&deviceMapInfo, 0, sizeof(deviceMapInfo)); if (NT_SUCCESS(NtQueryInformationProcess( NtCurrentProcess(), ProcessDeviceMap, &deviceMapInfo, sizeof(deviceMapInfo), NULL ))) { return deviceMapInfo.Query.DriveMap; } else { return GetLogicalDrives(); }}
开发者ID:digitalsensejbkim,项目名称:processhacker2,代码行数:25,
示例16: GetLogicalDriveschar CFileManager::GetFirstNextDriveLetter( bool first ){ if( first ){ FirstNext=0; DriveLetterMask = GetLogicalDrives(); } else FirstNext++; char creturn = 0; for( int n=FirstNext;n<32;n++ ){ if( ((DriveLetterMask & (1 << n )) > 0) ){ creturn = 'A'; creturn += n; FirstNext=n; return creturn; } } return creturn; }
开发者ID:TerrahKitsune,项目名称:TerrahIRC,代码行数:27,
示例17: lsvol_devstatic NTSTATUS lsvol_dev(PWSTR DeviceName){ NTSTATUS Result; PWCHAR VolumeListBuf, VolumeListBufEnd; SIZE_T VolumeListSize; DWORD LogicalDrives; WCHAR Drive[3] = L"/0:"; Result = FspToolGetVolumeList(DeviceName, &VolumeListBuf, &VolumeListSize); if (!NT_SUCCESS(Result)) return Result; VolumeListBufEnd = (PVOID)((PUINT8)VolumeListBuf + VolumeListSize); LogicalDrives = GetLogicalDrives(); for (PWCHAR P = VolumeListBuf, VolumeName = P; VolumeListBufEnd > P; P++) if (L'/0' == *P) { Drive[0] = FspToolGetDriveLetter(&LogicalDrives, VolumeName); info("%-4S%S", Drive[0] ? Drive : L"", VolumeName); VolumeName = P + 1; } MemFree(VolumeListBuf); return STATUS_SUCCESS;}
开发者ID:billziss-gh,项目名称:winfsp,代码行数:26,
示例18: FillDriveListstatic BOOL FillDriveList(){ DRIVE_INFO di; TCHAR chDrive = TEXT('A'); DWORD dwDrives = GetLogicalDrives(); // This failing is not fatal to this function // Make sure the partition table is up to date afs_status_t nStatus; int nResult = ReadPartitionTable(&nStatus); ASSERT(nResult); while (dwDrives) { if (dwDrives & 1) { memset(&di, 0, sizeof(di)); if (GetDriveInfo(chDrive, di)) { FASTLISTADDITEM ai = { 0, di.nImage, IMAGE_NOIMAGE, di.szRootDir, di.bDisabled, di.dwFlags }; HLISTITEM hItem = FastList_AddItem(m_hDriveList, &ai); FastList_SetItemText(m_hDriveList, hItem, 1, di.szVolName); FastList_SetItemText(m_hDriveList, hItem, 2, di.szSize); } } chDrive++; dwDrives >>= 1; } return TRUE;}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:31,
示例19: getLogicalDrivesBOOL CSysInfo::getLogicalDrives( CLogicalDriveList *pMyList){ CLogicalDrive cLogicalDrive; UINT uIndex; DWORD dwValue; CString csDrive; // First, try WMI if (m_wmiInfo.GetLogicalDrives( pMyList)) return TRUE; // Last, use GetLogicalDrives API pMyList->RemoveAll(); if ((dwValue = GetLogicalDrives()) != 0) { for (uIndex=0; uIndex<=26; uIndex++) { // Check if the logical drive uIndex really exists if (dwValue & 1) { // Yes => Construct the root directory csDrive.Format( _T( "%c://"), 'A'+uIndex); // Check if this is a local Hard Disk cLogicalDrive.RetrieveDriveInfo( csDrive); // Add the logical drive to the list pMyList->AddTail( cLogicalDrive); } // Bit shift the logical drives mask dwValue >>= 1; } } return TRUE;}
开发者ID:GoGoogle,项目名称:WindowsAgent,代码行数:32,
示例20: malloc/* opendir implementation which emulates a virtual root with the drive letters presented as directories. */UNFS3_WIN_DIR *win_opendir(const char *name){ wchar_t *winpath; UNFS3_WIN_DIR *ret; ret = malloc(sizeof(UNFS3_WIN_DIR)); if (!ret) { logmsg(LOG_CRIT, "win_opendir: Unable to allocate memory"); return NULL; } if (!strcmp("/", name)) { /* Emulate root */ ret->stream = NULL; ret->currentdrive = 0; ret->logdrives = GetLogicalDrives(); } else { winpath = intpath2winpath(name); if (!winpath) { free(ret); errno = EINVAL; return NULL; } ret->stream = _wopendir(winpath); free(winpath); if (ret->stream == NULL) { free(ret); ret = NULL; } } return ret;}
开发者ID:lavenresearch,项目名称:cloudStorageService,代码行数:38,
示例21: chars/* pick the first available drive, starting with E: drive must be able to store two chars (e.g. "F:") */char *get_default_mount_point(char *mount_point){ DWORD mask, drive_bit; char drive_char; mount_point[0] = '/0'; mask = GetLogicalDrives(); if (mask != 0) { /* scan for an available drive (0 bit) */ drive_bit = 1 << 4; /* E: */ drive_char = 'E'; while (drive_char <= 'Z' && (mask & drive_bit)) { drive_bit <<= 1; drive_char++; } if (drive_char <= 'Z') { mount_point[0] = drive_char; mount_point[1] = ':'; mount_point[2] = '/0'; } } /* will return empty string on error/no available drives the program will either set a user-specified drive or abort later */ return mount_point;}
开发者ID:snsl,项目名称:pvfs2-osd,代码行数:34,
示例22: getDrivesui32 getDrives(){ #if defined(_WIN32)||defined(_WIN_32) return GetLogicalDrives(); #endif // _WIN_32}
开发者ID:wizebin,项目名称:ulti,代码行数:7,
示例23: PreSubclassWindow/////////////////////////////////////////////////////////////////////////////// CDriverBox message handlers//创建控件时调用,该函数中查找所有可用的驱动器//并将其名称保存到列表字符列表中和加入到显示列表中void CDriverBox::PreSubclassWindow() { // TODO: Add your specialized code here and/or call the base class CComboBox::PreSubclassWindow(); DWORD drives=GetLogicalDrives(); int nums=0; drives>>=2; char disk[]=_T("c://"); while(drives) { if(drives&0x01) { UINT type=GetDriveType(disk); if(type==DRIVE_FIXED||type==DRIVE_REMOTE) { disk[2]=0; AddString(disk); m_drvList.AddTail(disk); disk[2]='//'; } } disk[0]++; drives>>=1; } }
开发者ID:hgl888,项目名称:nashtest,代码行数:31,
示例24: getDriveNumberFromLetterint getDriveNumberFromLetter(char lookingforname){ unsigned long driveMask = GetLogicalDrives(); int i = 0; ULONG pID; while (driveMask != 0) { if (driveMask & 1) { // the "A" in drivename will get incremented by the # of bits // we've shifted char drivename[] = "////.//A://"; drivename[4] += i; if (checkDriveType(drivename, &pID)) { if (lookingforname == drivename[4]) { return pID; } } } driveMask >>= 1; ++i; } return -1;}
开发者ID:davidferguson,项目名称:CommandLineDiskImager,代码行数:28,
注:本文中的GetLogicalDrives函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetMDIParent函数代码示例 C++ GetLogicalDriveStrings函数代码示例 |