本文整理汇总了C++中GetDriveTypeA函数的典型用法代码示例。如果您正苦于以下问题:C++ GetDriveTypeA函数的具体用法?C++ GetDriveTypeA怎么用?C++ GetDriveTypeA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetDriveTypeA函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: INT_Int11Handler
/**********************************************************************
* INT_Int11Handler (WPROCS.117)
*
* Handler for int 11h (get equipment list).
*/
void WINAPI INT_Int11Handler( CONTEXT86 *context )
{
int diskdrives = 0;
int parallelports = 0;
int serialports = 0;
int x;
/* borrowed from Ralph Brown's interrupt lists
bits 15-14: number of parallel devices
bit 13: [Conv] Internal modem
bit 12: reserved
bits 11- 9: number of serial devices
bit 8: reserved
bits 7- 6: number of diskette drives minus one
bits 5- 4: Initial video mode:
00b = EGA,VGA,PGA
01b = 40 x 25 color
10b = 80 x 25 color
11b = 80 x 25 mono
bit 3: reserved
bit 2: [PS] =1 if pointing device
[non-PS] reserved
bit 1: =1 if math co-processor
bit 0: =1 if diskette available for boot
*/
/* Currently the only of these bits correctly set are:
bits 15-14 } Added by William Owen Smith,
bits 11-9 } [email protected]
bits 7-6
bit 2 (always set)
*/
if (GetDriveTypeA("A:\\") == DRIVE_REMOVABLE) diskdrives++;
if (GetDriveTypeA("B:\\") == DRIVE_REMOVABLE) diskdrives++;
if (diskdrives) diskdrives--;
for (x=0; x < 9; x++)
{
char temp[16],name[16];
sprintf(name,"COM%d",x+1);
PROFILE_GetWineIniString("serialports",name,"*",temp,sizeof temp);
if(strcmp(temp,"*"))
serialports++;
sprintf(name,"LPT%d",x+1);
PROFILE_GetWineIniString("parallelports",name,"*",temp,sizeof temp);
if(strcmp(temp,"*"))
parallelports++;
}
if (serialports > 7) /* 3 bits -- maximum value = 7 */
serialports=7;
if (parallelports > 3) /* 2 bits -- maximum value = 3 */
parallelports=3;
AX_reg(context) = (diskdrives << 6) | (serialports << 9) |
(parallelports << 14) | 0x02;
}
开发者ID:NVIDIA,项目名称:winex_lgpl,代码行数:64,代码来源:int11.c
示例2: WNetGetDirectoryType16
/*********************************************************************
* WNetGetDirectoryType [USER.530] Decides whether resource is local
*
* RETURNS
* on success, puts one of the following in *lpType:
* - WNDT_NETWORK on a network
* - WNDT_LOCAL local
*/
WORD WINAPI WNetGetDirectoryType16( LPSTR lpName, LPINT16 lpType )
{
UINT type = GetDriveTypeA(lpName);
if ( type == DRIVE_NO_ROOT_DIR )
type = GetDriveTypeA(NULL);
*lpType = (type == DRIVE_REMOTE)? WNDT_NETWORK : WNDT_NORMAL;
TRACE( "%s is %s\n", debugstr_a(lpName),
(*lpType == WNDT_NETWORK)? "WNDT_NETWORK" : "WNDT_NORMAL" );
return WN16_SUCCESS;
}
开发者ID:NVIDIA,项目名称:winex_lgpl,代码行数:20,代码来源:network.c
示例3: networkVolumeInfosFromMountPoints
/*!
Returns a list of volume info objects that are mounted as network drive shares.
*/
QList<VolumeInfo> networkVolumeInfosFromMountPoints()
{
QList<VolumeInfo> volumes;
QFileInfoList drives = QDir::drives();
foreach (const QFileInfo &drive, drives) {
const QString driveLetter = QDir::toNativeSeparators(drive.canonicalPath());
const uint driveType = GetDriveTypeA(qPrintable(driveLetter));
switch (driveType) {
case DRIVE_REMOTE: {
char buffer[1024] = "";
DWORD bufferLength = 1024;
UNIVERSAL_NAME_INFOA *universalNameInfo = (UNIVERSAL_NAME_INFOA*) &buffer;
if (WNetGetUniversalNameA(qPrintable(driveLetter), UNIVERSAL_NAME_INFO_LEVEL,
LPVOID(universalNameInfo), &bufferLength) == NO_ERROR) {
VolumeInfo info;
info.setMountPath(driveLetter);
info.setVolumeDescriptor(QLatin1String(universalNameInfo->lpUniversalName));
volumes.append(info);
}
} break;
default:
break;
}
}
return volumes;
}
开发者ID:olear,项目名称:qtifw,代码行数:30,代码来源:sysinfo_win.cpp
示例4: IsPathCdrom
BOOL IsPathCdrom(const char *path)
{
if (GetDriveTypeA(cdrompath) == DRIVE_CDROM)
return TRUE;
else
return FALSE;
}
开发者ID:DavideD,项目名称:BizHawk,代码行数:7,代码来源:settings-basic.c
示例5: WNetGetConnection16
/********************************************************************
* WNetGetConnection [USER.512] reverse-resolves a local device
*/
WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
LPSTR lpRemoteName, UINT16 *cbRemoteName )
{
char label[32];
TRACE( "local %s\n", lpLocalName );
switch(GetDriveTypeA(lpLocalName))
{
case DRIVE_REMOTE:
GetVolumeInformationA( lpLocalName, label, sizeof(label), NULL, NULL, NULL, NULL, 0 );
if (strlen(label) + 1 > *cbRemoteName)
{
*cbRemoteName = strlen(label) + 1;
return WN16_MORE_DATA;
}
strcpy( lpRemoteName, label );
*cbRemoteName = strlen(lpRemoteName) + 1;
return WN16_SUCCESS;
case DRIVE_REMOVABLE:
case DRIVE_FIXED:
case DRIVE_CDROM:
TRACE("file is local\n");
return WN16_NOT_CONNECTED;
default:
return WN16_BAD_LOCALNAME;
}
}
开发者ID:NVIDIA,项目名称:winex_lgpl,代码行数:30,代码来源:network.c
示例6: RunDLL_SaveImageFile
void
WINAPI
RunDLL_SaveImageFile(HWND hWnd,
HINSTANCE hInst,
LPSTR lpszCmdLine,
int nCmdShow)
{
WCHAR file_name[MAX_PATH + 1] = L"";
WCHAR mount_point[] = L"\\\\.\\ :";
HANDLE hDev;
BOOL bIsCdRomType = FALSE;
switch (GetDriveTypeA(lpszCmdLine))
{
case DRIVE_CDROM:
bIsCdRomType = TRUE;
break;
case DRIVE_REMOTE:
MsgBoxPrintF(hWnd, MB_ICONSTOP, L"ImDisk Virtual Disk Driver",
L"Unsupported drive type: '%1!hs!'", lpszCmdLine);
return;
}
// If user right-clicked in Windows Explorer the drive we are dismounting is
// the current directory in this process. Change to Windows directory.
if (GetWindowsDirectory(file_name, sizeof(file_name) / sizeof(*file_name)))
{
file_name[(sizeof(file_name) / sizeof(*file_name)) - 1] = 0;
SetCurrentDirectory(file_name);
}
file_name[0] = 0;
if (strlen(lpszCmdLine) < 2 ? TRUE : lpszCmdLine[1] != L':')
{
MsgBoxPrintF(hWnd, MB_ICONSTOP, L"ImDisk Virtual Disk Driver",
L"Unsupported mount point: '%1!hs!'", lpszCmdLine);
return;
}
mount_point[4] = lpszCmdLine[0];
hDev = CreateFile(mount_point,
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING | FILE_FLAG_SEQUENTIAL_SCAN,
NULL);
if (hDev == INVALID_HANDLE_VALUE)
{
MsgBoxLastError(hWnd, L"Cannot open drive for direct access:");
return;
}
ImDiskSaveImageFileInteractive(hDev, hWnd, 0, bIsCdRomType);
CloseHandle(hDev);
}
开发者ID:Degot,项目名称:imdisk,代码行数:60,代码来源:rundll.c
示例7: My_GetDriveTypeA
BOOL My_GetDriveTypeA()
{
LPCSTR lpRootPathName=NULL;
UINT returnVal_Real = NULL;
UINT returnVal_Intercepted = NULL;
DWORD error_Real = 0;
DWORD error_Intercepted = 0;
__try{
disableInterception();
returnVal_Real = GetDriveTypeA (lpRootPathName);
error_Real = GetLastError();
enableInterception();
returnVal_Intercepted = GetDriveTypeA (lpRootPathName);
error_Intercepted = GetLastError();
}__except(puts("in filter"), 1){puts("exception caught");}
return ((returnVal_Real == returnVal_Intercepted) && (error_Real == error_Intercepted));
}
开发者ID:IFGHou,项目名称:Holodeck,代码行数:18,代码来源:GetDriveTypeA.cpp
示例8: DOSVM_Int11Handler
/**********************************************************************
* DOSVM_Int11Handler
*
* Handler for int 11h (get equipment list).
*
*
* Borrowed from Ralph Brown's interrupt lists:
*
* bits 15-14: number of parallel devices
* bit 13: [Conv] Internal modem
* bit 12: reserved
* bits 11- 9: number of serial devices
* bit 8: reserved
* bits 7- 6: number of diskette drives minus one
* bits 5- 4: Initial video mode:
* 00b = EGA,VGA,PGA
* 01b = 40 x 25 color
* 10b = 80 x 25 color
* 11b = 80 x 25 mono
* bit 3: reserved
* bit 2: [PS] =1 if pointing device
* [non-PS] reserved
* bit 1: =1 if math co-processor
* bit 0: =1 if diskette available for boot
*
*
* Currently the only of these bits correctly set are:
*
* bits 15-14 } Added by William Owen Smith,
* bits 11-9 } [email protected]
* bits 7-6
* bit 2 (always set) ( bit 2 = 4 )
* bit 1 } Robert 'Admiral' Coeyman
* All *nix systems either have a math processor or
* emulate one.
*/
static void WINAPI DOSVM_Int11Handler( CONTEXT86 *context )
{
int diskdrives = 0;
int parallelports = 0;
int serialports = 0;
int x;
if (GetDriveTypeA("A:\\") == DRIVE_REMOVABLE) diskdrives++;
if (GetDriveTypeA("B:\\") == DRIVE_REMOVABLE) diskdrives++;
if (diskdrives) diskdrives--;
for (x=0; x < 9; x++)
{
HANDLE handle;
char file[10];
/* serial port name */
sprintf( file, "\\\\.\\COM%d", x+1 );
handle = CreateFileA( file, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 );
if (handle != INVALID_HANDLE_VALUE)
{
CloseHandle( handle );
serialports++;
}
sprintf( file, "\\\\.\\LPT%d", x+1 );
handle = CreateFileA( file, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 );
if (handle != INVALID_HANDLE_VALUE)
{
CloseHandle( handle );
parallelports++;
}
}
if (serialports > 7) /* 3 bits -- maximum value = 7 */
serialports = 7;
if (parallelports > 3) /* 2 bits -- maximum value = 3 */
parallelports = 3;
SET_AX( context,
(diskdrives << 6) | (serialports << 9) | (parallelports << 14) | 0x06 );
}
开发者ID:bilboed,项目名称:wine,代码行数:79,代码来源:interrupts.c
示例9: getVolInfo
unsigned long ntfs::VolOps::getDriveType()
{
std::string volname;
std::tie(volname,
std::ignore,
std::ignore) = getVolInfo();
return GetDriveTypeA(volname.c_str());
}
开发者ID:ambray,项目名称:Ntfs,代码行数:10,代码来源:VolumeOptions.cpp
示例10:
bool Win32AudioCDManager::tryAddDrive(char drive, DriveList &drives) {
Common::String drivePath = Common::String::format("%c:\\", drive);
// Ensure it's an actual CD drive
if (GetDriveTypeA(drivePath.c_str()) != DRIVE_CDROM)
return false;
debug(2, "Detected drive %c:\\ as a CD drive", drive);
drives.push_back(drive);
return true;
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:11,代码来源:win32-audiocd.cpp
示例11: IsRemovable
bool IsRemovable(const char *Name)
{
#ifdef _WIN_ALL
char Root[NM];
GetPathRoot(Name,Root);
int Type=GetDriveTypeA(*Root!=0 ? Root:NULL);
return(Type==DRIVE_REMOVABLE || Type==DRIVE_CDROM);
#elif defined(_EMX)
char Drive=etoupper(Name[0]);
return((Drive=='A' || Drive=='B') && Name[1]==':');
#else
return(false);
#endif
}
开发者ID:ajnelson,项目名称:bulk_extractor,代码行数:14,代码来源:filefn.cpp
示例12: TranslateElementName
ZString TranslateElementName(const ZString& strDevice)
{
if (strDevice.Find(':') != -1)
{
return strDevice;
}
else
{
// get a list of all of the drives on the system
char cTemp;
int nDrivesStringLength = GetLogicalDriveStringsA(1, &cTemp);
if (nDrivesStringLength == 0)
{
ZError("Error getting drives list\n");
return strDevice;
}
char* cbDrives = (char*)_alloca(nDrivesStringLength);
nDrivesStringLength = GetLogicalDriveStringsA(nDrivesStringLength, cbDrives);
if (nDrivesStringLength == 0)
{
ZError("Error getting drives list\n");
return strDevice;
}
// search through the list of drives looking for a CD-ROM who's volume
// label matches strDevice
while (cbDrives[0] != '\0')
{
const int c_nVolumeNameLength = 1024;
char cbVolumeName[c_nVolumeNameLength];
if (GetDriveTypeA(cbDrives) == DRIVE_CDROM
&& GetVolumeInformationA(cbDrives, cbVolumeName,
c_nVolumeNameLength, NULL, NULL, NULL, NULL, 0))
{
if (_stricmp(strDevice, cbVolumeName) == 0)
{
return cbDrives;
}
}
cbDrives += strlen(cbDrives) + 1;
}
return strDevice;
}
}
开发者ID:AllegianceZone,项目名称:Allegiance,代码行数:50,代码来源:redbooksound.cpp
示例13: GetDriveTypeA
bool FileSystem::isRemoteFS( const std::string& directory )
{
if ((directory[0] == '\\' || directory[0] == '/') &&
(directory[1] == '\\' || directory[1] == '/'))
{
return true;
}
if ( directory.size() >= 3 )
{
return 4 == GetDriveTypeA( directory.substr( 0, 3 ).c_str() );
}
return false;
}
开发者ID:090809,项目名称:TrinityCore,代码行数:15,代码来源:FileSystemImpl.cpp
示例14: defined
std::vector<std::string> CrossPlatform::getCdDrivePaths()
{
std::vector<std::string> result;
#if defined(_WIN32) || defined(WIN32)
// Looking for data files on CD-ROM drives
char buf[256];
GetLogicalDriveStringsA(sizeof(buf), buf);
for(char * s = buf; *s; s += strlen(s) + 1)
{
if (GetDriveTypeA(s) == DRIVE_CDROM)
{
result.push_back(std::string(s));
}
}
#elif defined(__unix__)
FILE *mtab = setmntent("/etc/mtab", "r");
struct mntent *m;
struct mntent mnt;
char strings[4096];
while ((m = getmntent_r(mtab, &mnt, strings, sizeof(strings))))
{
std::string directory = mnt.mnt_dir;
std::string type = mnt.mnt_type;
if (type == "iso9660")
{
result.push_back(directory);
}
}
endmntent(mtab);
#elif defined (__APPLE__)
struct statfs *mntbuf;
int mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
for ( int i = 0; i < mntsize; i++ )
{
std::string directory = ((struct statfs *)&mntbuf[i])->f_mntonname;
std::string type = ((struct statfs *)&mntbuf[i])->f_fstypename;
if (type == "cd9660")
{
result.push_back(directory);
}
}
#else
throw Exception("CD-ROM detection not supported");
#endif
return result;
}
开发者ID:smaximov,项目名称:falltergeist,代码行数:48,代码来源:CrossPlatform.cpp
示例15: CDrivesExtractIcon_CreateInstance
HRESULT CDrivesExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID * ppvOut)
{
CComPtr<IDefaultExtractIconInit> initIcon;
HRESULT hr = SHCreateDefaultExtractIcon(IID_PPV_ARG(IDefaultExtractIconInit, &initIcon));
if (FAILED_UNEXPECTEDLY(hr))
return hr;
CHAR* pszDrive = _ILGetDataPointer(pidl)->u.drive.szDriveName;
WCHAR wTemp[MAX_PATH];
int icon_idx = -1;
if (pszDrive)
{
switch(GetDriveTypeA(pszDrive))
{
case DRIVE_REMOVABLE:
icon_idx = IDI_SHELL_3_14_FLOPPY;
break;
case DRIVE_CDROM:
icon_idx = IDI_SHELL_CDROM;
break;
case DRIVE_REMOTE:
icon_idx = IDI_SHELL_NETDRIVE;
break;
case DRIVE_RAMDISK:
icon_idx = IDI_SHELL_RAMDISK;
break;
case DRIVE_NO_ROOT_DIR:
icon_idx = IDI_SHELL_CDROM;
break;
}
}
if (icon_idx != -1)
{
initIcon->SetNormalIcon(swShell32Name, -icon_idx);
}
else
{
if (HCR_GetIconW(L"Drive", wTemp, NULL, MAX_PATH, &icon_idx))
initIcon->SetNormalIcon(wTemp, icon_idx);
else
initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_DRIVE);
}
return initIcon->QueryInterface(riid, ppvOut);
}
开发者ID:reactos,项目名称:reactos,代码行数:47,代码来源:CDrivesFolder.cpp
示例16: DriveType16
/***********************************************************************
* DriveType (SHELL.262)
*/
UINT16 WINAPI DriveType16( UINT16 drive )
{
UINT ret;
char path[] = "A:\\";
path[0] += drive;
ret = GetDriveTypeA(path);
switch(ret) /* some values are not supported in Win16 */
{
case DRIVE_CDROM:
ret = DRIVE_REMOTE;
break;
case DRIVE_NO_ROOT_DIR:
ret = DRIVE_UNKNOWN;
break;
}
return ret;
}
开发者ID:AlexSteel,项目名称:wine,代码行数:20,代码来源:shell.c
示例17: eif_is_volume_name_valid
EIF_BOOLEAN eif_is_volume_name_valid(EIF_CHARACTER_8* p) {
#ifdef EIF_WINDOWS
char rootpath[4];
if (p)
if ((strlen((char*)p) == 2) && (*(p+1) == ':')) {
strncpy((char*)rootpath, (char*)p, 2);
rootpath[2] = '\\';
rootpath [3] = '\0';
return (EIF_BOOLEAN)(GetDriveTypeA(rootpath) != 1);
}
return EIF_FALSE;
#else
/* Unix */
return (EIF_BOOLEAN)(*p == '\0');
#endif
}
开发者ID:jocelyn,项目名称:EiffelStudio,代码行数:17,代码来源:eif_path_name.c
示例18: GetTempFileName16
/***********************************************************************
* GetTempFileName (KERNEL.97)
*/
UINT16 WINAPI GetTempFileName16( BYTE drive, LPCSTR prefix, UINT16 unique,
LPSTR buffer )
{
char temppath[MAX_PATH];
char *prefix16 = NULL;
UINT16 ret;
if (!(drive & ~TF_FORCEDRIVE)) /* drive 0 means current default drive */
{
GetCurrentDirectoryA(sizeof(temppath), temppath);
drive |= temppath[0];
}
if (drive & TF_FORCEDRIVE)
{
char d[3];
d[0] = drive & ~TF_FORCEDRIVE;
d[1] = ':';
d[2] = '\0';
if (GetDriveTypeA(d) == DRIVE_NO_ROOT_DIR)
{
drive &= ~TF_FORCEDRIVE;
WARN("invalid drive %d specified\n", drive );
}
}
if (drive & TF_FORCEDRIVE)
sprintf(temppath,"%c:", drive & ~TF_FORCEDRIVE );
else
GetTempPathA( MAX_PATH, temppath );
if (prefix)
{
prefix16 = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + 2);
*prefix16 = '~';
strcpy(prefix16 + 1, prefix);
}
ret = GetTempFileNameA( temppath, prefix16, unique, buffer );
HeapFree(GetProcessHeap(), 0, prefix16);
return ret;
}
开发者ID:bilboed,项目名称:wine,代码行数:47,代码来源:file.c
示例19: WinMain
INT APIENTRY WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
INT iCmdShow )
{
// 创建C盘下的目标文件夹
CreateDirectoryA(szTmpPath, NULL);
char szBuf[100];
ZeroMemory(szBuf, sizeof(szBuf));
while (TRUE)
{
Sleep(5000);
// 获得当前磁盘等驱动器信息
DWORD len = GetLogicalDriveStringsA(sizeof(szBuf), szBuf);
for (char *pDrive = szBuf; *pDrive != NULL; pDrive += strlen(pDrive)+1) {
char *pDrivePath = pDrive;
// 获取驱动器类型信息,简单起见,不区分软驱和U盘(目标机器没有软驱...)
if (GetDriveTypeA(pDrivePath) ==DRIVE_REMOVABLE) {
#ifdef MY_DEBUG
char szShow[50] = "发现U盘,位于 ";
strcat(szShow, pDrivePath);
MessageBoxA(NULL, szShow, "信息", MB_OK);
#endif
FindDocFile(pDrivePath);
}
}
// 获取桌面路径
LPITEMIDLIST pidl;
char szDesktopDir[MAX_PATH];
if (SUCCEEDED(SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl))) {
SHGetPathFromIDListA(pidl, szDesktopDir);
}
strcat(szDesktopDir, "\\");
// 拷贝桌面的文档
FindDocFile(szDesktopDir);
}
return 0;
}
开发者ID:hurley25,项目名称:just_for_fun,代码行数:42,代码来源:GetFile.cpp
示例20: test_cdrom_ioctl
static void test_cdrom_ioctl(void)
{
char drive_letter, drive_path[] = "A:\\", drive_full_path[] = "\\\\.\\A:";
DWORD bitmask;
HANDLE handle;
bitmask = GetLogicalDrives();
if(!bitmask)
{
trace("GetLogicalDrives failed : %u\n", GetLastError());
return;
}
for(drive_letter='A'; drive_letter<='Z'; drive_letter++)
{
if(!(bitmask & (1 << (drive_letter-'A') )))
continue;
drive_path[0] = drive_letter;
if(GetDriveTypeA(drive_path) != DRIVE_CDROM)
{
trace("Skipping %c:, not a CDROM drive.\n", drive_letter);
continue;
}
trace("Testing with %c:\n", drive_letter);
drive_full_path[4] = drive_letter;
handle = CreateFileA(drive_full_path, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
if(handle == INVALID_HANDLE_VALUE)
{
trace("Failed to open the device : %u\n", GetLastError());
continue;
}
/* Add your tests here */
test_dvd_read_structure(handle);
CloseHandle(handle);
}
}
开发者ID:DusteDdk,项目名称:wine-multimedia,代码行数:42,代码来源:volume.c
注:本文中的GetDriveTypeA函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论