当前位置: 首页>>代码示例>>C++>>正文


C++ GetVolumeInformation函数代码示例

本文整理汇总了C++中GetVolumeInformation函数的典型用法代码示例。如果您正苦于以下问题:C++ GetVolumeInformation函数的具体用法?C++ GetVolumeInformation怎么用?C++ GetVolumeInformation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetVolumeInformation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: max_filename

    static int
        max_filename()
    {
        DWORD maxflen;
        int status = 0;

        status = GetVolumeInformation((LPTSTR)0, (LPTSTR)0, 0
            , (LPDWORD)0, &maxflen, (LPDWORD)0, (LPTSTR)0, 0);
        if (status) return maxflen;
        else return 0;
    }
开发者ID:barthouse,项目名称:NetHackOld,代码行数:11,代码来源:ws_winnt.cpp

示例2: GetVolumeSn

String GetVolumeSn(const String &vol, int len) {
	dword sn;
	
	// Win API
	if(!GetVolumeInformation(vol, NULL, 0, &sn, NULL, NULL, NULL, 0)) sn = 71511731;
#ifdef _WITH_DEBUG
RLOG("GetVolumeSn():sn = " + AsString(sn));
#endif	
	
	return String(AsString(sn)).Right(len);
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:11,代码来源:utils.cpp

示例3: IsUTCVolume

/* Tony Hoyle's function for testing whether a given volume uses UTC or 
 * local time to record file modification times
 * 
 * Reproduced here with permission of Tony Hoyle.
 * 
 * This code is copyright by Tony Hoyle and is licensed under the Gnu 
 * Public License. (See above)
 *
 * NTFS, HPFS, and OWFS store file times as UTC times.
 * FAT stores file times as local time.
 *
 * INPUTS:
 *      LPCSTR name: fully qualified path
 *
 * OUTPUTS:
 *      Return true if the file system on the volume in question 
 *      stores file times as UTC
 */
BOOL IsUTCVolume ( LPCTSTR name )
{
    _TCHAR szDrive[_MAX_DRIVE + 1] = _T("");
    _TCHAR szFs[32]=_T("");
    _tsplitpath(name, szDrive, NULL, NULL, NULL);

    _tcscat(szDrive, _T("\\"));
    GetVolumeInformation( szDrive, NULL, 0, NULL, NULL, NULL, szFs, 32 );
    return ! ( _tcsicmp( szFs, _T("NTFS") ) 
               && _tcsicmp( szFs, _T("HPFS") ) 
               && _tcsicmp( szFs, _T("OWFS") ) );
}
开发者ID:sumikawa,项目名称:cvs-ipv6,代码行数:30,代码来源:JmgStat.c

示例4: TfrmLogoDiALab

//===========================================================================
void __fastcall TfrmMain::FormCreate(TObject *Sender)
{
   // ---------------------------------------------------
    frmLogoDiALab = new TfrmLogoDiALab(NULL);
    //frmLogoDiALab->Show();
    Application->ProcessMessages();
    Sleep(2300);
   // ---------------------------------------------------
      WhoUseProgram = wupSensei;
      //WhoUseProgram = wupTsisarzh;
      //WhoUseProgram = wupTanjaKvant;

      if (WhoUseProgram == wupTsisarzh) { // ---- ѕровер¤ем винты ------// || WhoUseProgram == wupSensei
            unsigned long  aa = MAX_PATH;
            char           VolumeName[MAX_PATH], FileSystemName[MAX_PATH];
            unsigned long  VolumeSerialNo;
            unsigned long  MaxComponentLength, FileSystemFlags;

            GetVolumeInformation("C:\\", VolumeName, aa, &VolumeSerialNo,
                                 &MaxComponentLength,&FileSystemFlags,
                                 FileSystemName,aa);

            AnsiString  HexVolumeSerialNo = IntToHex((int)VolumeSerialNo,8);

            if ( HexVolumeSerialNo != "0D471DF1" && HexVolumeSerialNo != "104E16FB" && HexVolumeSerialNo != "256E13FC") {
                Error_None_LicenseProgram(Handle);
                ExitProcess(0);
            }
      }

   // ---------------------------------------------------
      Left   = 0;
      Top    = 0;
      Height = 730;
      EnabledTVModivication = true;

   // ---- –егистрирую в ¬индовсе расширение ------------
      RegisterFileType("dls", Application->ExeName, 1);
      AddNewFileToMainMenu(pmFile, "Load", LoadProjectFromMenu);

   // ------- «аполн¤ем “ри¬ью —писками элементов -----
      SetupTreeView();

   // -------
      aAllAction(aNewScheme);

   // ------- »нициализаци¤ пути ќпен и —айф ƒиалога --------
      OpenDialog1->InitialDir =  ExtractFilePath( Application->ExeName );
      SaveDialog1->InitialDir =  ExtractFilePath( Application->ExeName );

   // -----
      TimerLogo->Enabled = true;
}
开发者ID:Medcheg,项目名称:sources_old,代码行数:54,代码来源:Unit_Main.cpp

示例5: GetVolumeInformation

	void Win32DiskInfoProvider::ConstructInfo()
	{
		TCHAR VolumeNameBuffer[MAX_PATH+1];
		DWORD VolumeSerialNumber=0;
		DWORD MaximumComponentLength=0;
		DWORD FileSystemFlags=0;
		TCHAR FileSystemNameBuffer[MAX_PATH+1];
		BOOL b = GetVolumeInformation(driveName.c_str(), VolumeNameBuffer, MAX_PATH+1,
			&VolumeSerialNumber, &MaximumComponentLength, &FileSystemFlags,
			FileSystemNameBuffer, MAX_PATH+1);

		if (!b)
		{
			valid = false;
			info = "error";
			return;
		}

		ULARGE_INTEGER totalNrBytes;
		totalNrBytes.QuadPart = 0;
		GetDiskFreeSpaceEx(driveName.c_str(), NULL, &totalNrBytes, NULL);

		std::string strType;
		switch (GetDriveType(driveName.c_str()))
		{
		case DRIVE_UNKNOWN:
			strType += "unknown volume type";
			break;
		case DRIVE_NO_ROOT_DIR:
			strType += "invalid root dir";
			break;
		case DRIVE_REMOVABLE:
			strType += "removable volume";
			break;
		case DRIVE_FIXED:
			strType += "fixed volume";
			break;
		case DRIVE_REMOTE:
			strType += "remote volume";
			break;
		case DRIVE_CDROM:
			strType += "CD-ROM";
			break;
		case DRIVE_RAMDISK:
			strType += "RAM disk";
			break;
		}
		info = driveName+
			" type:<"+strType+
			">, name:<"+VolumeNameBuffer+
			">, system name:<"+FileSystemNameBuffer+
			">, "+RichBool::ToString(totalNrBytes)+" bytes";
	}
开发者ID:MarkVanPeteghem,项目名称:ModAssert,代码行数:53,代码来源:Win32DiskSpace.cpp

示例6: IsVolumeNTFS

BOOL
IsVolumeNTFS(
    PWCHAR path
    )
{
    //
    //  Scan backwards through the path looking for \ and trying at each level until we
    //  get to the root. We'll terminate it there and pass it to GetVolumeInformation
    //

    PWCHAR LastBackSlash = path + wcslen( path );
    WCHAR c;
    BOOL b;
    ULONG i;
    WCHAR PhysicalName[MAX_PATH];

    
    while (TRUE) {
        while (TRUE) {
            if (LastBackSlash < path) {
                DisplayError();
                return FALSE;
            }

            if (*LastBackSlash == L'\\') {
                break;
            }

            LastBackSlash--;
        }

        c = LastBackSlash[1];
        LastBackSlash[1] = L'\0';

        b = GetVolumeInformation(
            path,
            NULL,
            0,
            NULL,
            &i,
            &i,
            PhysicalName,
            sizeof(PhysicalName)/sizeof(WCHAR)
            );

        LastBackSlash[1] = c;
        LastBackSlash--;

        if ( b ) {
            return _wcsicmp( PhysicalName, L"NTFS" ) == 0;
        }
    }
}
开发者ID:Nevermore2015,项目名称:ndas4windows,代码行数:53,代码来源:utility.c

示例7: AfxFullPath

// turn a file, relative path or other into an absolute path
BOOL AFXAPI AfxFullPath(LPTSTR lpszPathOut, LPCTSTR lpszFileIn)
	// lpszPathOut = buffer of _MAX_PATH
	// lpszFileIn = file, relative path or absolute path
	// (both in ANSI character set)
{
	ASSERT(AfxIsValidAddress(lpszPathOut, _MAX_PATH));

	// first, fully qualify the path name
	LPTSTR lpszFilePart;
	if (!GetFullPathName(lpszFileIn, _MAX_PATH, lpszPathOut, &lpszFilePart))
	{
#ifdef _DEBUG
		if (lpszFileIn[0] != '\0')
			TRACE1("Warning: could not parse the path '%s'.\n", lpszFileIn);
#endif
		lstrcpyn(lpszPathOut, lpszFileIn, _MAX_PATH); // take it literally
		return FALSE;
	}

#ifndef _MAC
	CString strRoot;
	// determine the root name of the volume
	AfxGetRoot(lpszPathOut, strRoot);

	// get file system information for the volume
	DWORD dwFlags, dwDummy;
	if (!GetVolumeInformation(strRoot, NULL, 0, NULL, &dwDummy, &dwFlags,
		NULL, 0))
	{
		TRACE1("Warning: could not get volume information '%s'.\n",
			(LPCTSTR)strRoot);
		return FALSE;   // preserving case may not be correct
	}

	// not all characters have complete uppercase/lowercase
	if (!(dwFlags & FS_CASE_IS_PRESERVED))
		CharUpper(lpszPathOut);

	// assume non-UNICODE file systems, use OEM character set
	if (!(dwFlags & FS_UNICODE_STORED_ON_DISK))
	{
		WIN32_FIND_DATA data;
		HANDLE h = FindFirstFile(lpszFileIn, &data);
		if (h != INVALID_HANDLE_VALUE)
		{
			FindClose(h);
			lstrcpy(lpszFilePart, data.cFileName);
		}
	}
#endif
	return TRUE;
}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:53,代码来源:filecore.cpp

示例8: GetHdiskID

bool GetHdiskID(TCHAR DiskID[10])
{
	DWORD Serial;
	DWORD Length;
	BOOL success = GetVolumeInformation(_T("C:\\"), NULL, MAX_PATH, &Serial, &Length, NULL, NULL, MAX_PATH);
	if (!success)
	{
		return false;
	}

	wsprintf(DiskID, _T("%x"), Serial);
	return true;
} 
开发者ID:Echo-M,项目名称:producingManagementAK47,代码行数:13,代码来源:Computer_Information.cpp

示例9: _splitpath_s

void TautoPresetProps::getVolume(void)
{
    const char_t *flnm=deci->getSourceName();
    char_t dsk[MAX_PATH];
    _splitpath_s(flnm,dsk,MAX_PATH,NULL,0,NULL,0,NULL,0);
    DWORD serial,maximumComponentLength,volumeFlags;
    ffstring disk(dsk);
    disk += _l("\\");
    wasVolume=GetVolumeInformation(disk.c_str(),volumeName,256,&serial,&maximumComponentLength,&volumeFlags,NULL,0);
    if (wasVolume) {
        tsnprintf_s(volumeSerial, countof(volumeSerial), _TRUNCATE, _l("%X-%X"),(int)HIWORD(serial),(int)LOWORD(serial));
    }
}
开发者ID:JERUKA9,项目名称:ffdshow-tryouts,代码行数:13,代码来源:TpresetSettings.cpp

示例10: memset

bool IdentClient::SendParaSysStorage()
{
	bool bRet = false;
	if (m_IsSvrConnected)
	{
		memset(&m_cmdTransfer,0x00,sizeof(m_cmdTransfer));
		size_t szAllDriveStrings = GetLogicalDriveStrings(0,NULL);
		char *pDriveStrings = new char[szAllDriveStrings + sizeof((""))];
		GetLogicalDriveStrings(szAllDriveStrings,pDriveStrings);
		size_t szDriveString = strlen(pDriveStrings);
		int iMaxnumDrive = sizeof(g_stGlobal_Flash.sysstoragepara.storageconfig.diskdesc)/sizeof(g_stGlobal_Flash.sysstoragepara.storageconfig.diskdesc[0]);
		int DriveIndex = 0;
		for(DriveIndex = 0; DriveIndex < iMaxnumDrive && szDriveString > 0; DriveIndex++)
		{
			strcpy((char *)g_stGlobal_Flash.sysstoragepara.storageconfig.diskdesc[DriveIndex].disk_name,pDriveStrings);
			unsigned long long FreeAv,TotalBytes,FreeBytes;
			if (GetDiskFreeSpaceEx(pDriveStrings,&FreeAv,&TotalBytes,&FreeBytes))
			{
				g_stGlobal_Flash.sysstoragepara.storageconfig.diskdesc[DriveIndex].realsize = TotalBytes.QuadPart/(unsigned long long)(1024*1024);
				g_stGlobal_Flash.sysstoragepara.storageconfig.diskdesc[DriveIndex].emptysize = FreeAv.QuadPart/(unsigned long long)(1024*1024);
			}
			g_stGlobal_Flash.sysstoragepara.storageconfig.diskdesc[DriveIndex].drive_type = (DRIVE_TYPE)GetDriveType(pDriveStrings);
			char drive_fs_type[128];
			if(!GetVolumeInformation(pDriveStrings,NULL,0,NULL,NULL,NULL,drive_fs_type,128))
			{
				g_stGlobal_Flash.sysstoragepara.storageconfig.diskdesc[DriveIndex].drive_fstype = DRIVE_FS_TYPE_UNKNOWN;
			}
			else
			{
				if(!strcmp(drive_fs_type,"NTFS"))
				{
					g_stGlobal_Flash.sysstoragepara.storageconfig.diskdesc[DriveIndex].drive_fstype = DRIVE_FS_TYPE_NTFS;
				}
				else if(!strcmp(drive_fs_type,"FAT32"))
				{
					g_stGlobal_Flash.sysstoragepara.storageconfig.diskdesc[DriveIndex].drive_fstype = DRIVE_FS_TYPE_FAT32;
				}
				else
				{
					g_stGlobal_Flash.sysstoragepara.storageconfig.diskdesc[DriveIndex].drive_fstype = DRIVE_FS_TYPE_UNKNOWN;
				}
			}
			pDriveStrings += szDriveString + 1;
			szDriveString = strlen(pDriveStrings);
		}
		g_stGlobal_Flash.sysstoragepara.storageconfig.diskcount = DriveIndex;
		bRet = CONSTRUCT_CMD(CMD_NUM_SYS_STORAGE_RESPONSE,(char *)&g_stGlobal_Variable.globalflash.sysstoragepara,sizeof(SYS_STORAGE_PARA),&m_cmdTransfer);
		bRet &= SendParaMsg();
	}
	return bRet;
}
开发者ID:NearZhxiAo,项目名称:3730,代码行数:51,代码来源:IdentClient.cpp

示例11: get_host_id

    boost::uint32_t get_host_id() {
#ifdef UHD_PLATFORM_WIN32
        //extract volume serial number
        char szVolName[MAX_PATH+1], szFileSysName[MAX_PATH+1];
        DWORD dwSerialNumber, dwMaxComponentLen, dwFileSysFlags;
        GetVolumeInformation("C:\\", szVolName, MAX_PATH,
            &dwSerialNumber, &dwMaxComponentLen,
            &dwFileSysFlags, szFileSysName, sizeof(szFileSysName));

        return boost::uint32_t(dwSerialNumber);
#else
        return boost::uint32_t(gethostid());
#endif
    }
开发者ID:Bobakka,项目名称:uhd,代码行数:14,代码来源:platform.cpp

示例12: wxStrcpy

bool CVolumeDescriptionEnumeratorThread::GetDrive(const wxChar* pDrive, const int len)
{
	wxChar* pVolume = new wxChar[len + 1];
	wxStrcpy(pVolume, pDrive);
	if (pVolume[len - 1] == '\\')
		pVolume[len - 1] = 0;
	if (!*pVolume)
	{
		delete [] pVolume;
		return false;
	}

	// Check if it is a network share
	wxChar *share_name = new wxChar[512];
	DWORD dwSize = 511;
	if (!WNetGetConnection(pVolume, share_name, &dwSize))
	{
		m_crit_section.Enter();
		t_VolumeInfoInternal volumeInfo;
		volumeInfo.pVolume = pVolume;
		volumeInfo.pVolumeName = share_name;
		m_volumeInfo.push_back(volumeInfo);
		m_crit_section.Leave();
		pDrive += len + 1;
		return true;
	}
	else
		delete [] share_name;

	// Get the label of the drive
	wxChar* pVolumeName = new wxChar[501];
	int oldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
	BOOL res = GetVolumeInformation(pDrive, pVolumeName, 500, 0, 0, 0, 0, 0);
	SetErrorMode(oldErrorMode);
	if (res && pVolumeName[0])
	{
		m_crit_section.Enter();
		t_VolumeInfoInternal volumeInfo;
		volumeInfo.pVolume = pVolume;
		volumeInfo.pVolumeName = pVolumeName;
		m_volumeInfo.push_back(volumeInfo);
		m_crit_section.Leave();
		return true;
	}

	delete [] pVolumeName;
	delete [] pVolume;

	return false;
}
开发者ID:AbelTian,项目名称:filezilla,代码行数:50,代码来源:volume_enumerator.cpp

示例13: volume_name

std::string volume_name(const std::string &path)
{
    wchar_t volume_name[MAX_PATH + 1];
    if (GetVolumeInformation(
                to_windows_path(path).c_str(),
                volume_name,
                sizeof(volume_name) / sizeof(*volume_name),
                NULL, NULL, NULL, NULL, 0))
    {
        return from_utf16(volume_name);
    }

    return std::string();
}
开发者ID:darkphase,项目名称:LXiMedia,代码行数:14,代码来源:path.cpp

示例14: Java_sage_Sage_getFileSystemType

/*
 * Class:     sage_Sage
 * Method:    getFileSystemType
 * Signature: (Ljava/lang/String;)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_sage_Sage_getFileSystemType(JNIEnv *env, jclass jc, jstring volRoot)
{
	const char* rootStr = env->GetStringUTFChars(volRoot, 0);
	DWORD maxNameLen;
	DWORD fsFlags;
	TCHAR daBuf[64];
	jstring rv;
	if (GetVolumeInformation(rootStr, NULL, 0, NULL, &maxNameLen, &fsFlags, daBuf, 64))
		rv = env->NewStringUTF(daBuf);
	else
		rv = NULL;
	env->ReleaseStringUTFChars(volRoot, rootStr);
	return rv;
}
开发者ID:JREkiwi,项目名称:sagetv,代码行数:19,代码来源:SageTVWin32DLL.cpp

示例15: is_ntfs

BOOL
is_ntfs(const char * file) {

    char drive[255];
    char FSType[20];
    char tmpbuf[256];
    char *machinename;
    char *sharename;
    char filename[1024];

    REQUIRE(filename != NULL);

    if (isc_file_absolutepath(file, filename,
                              sizeof(filename)) != ISC_R_SUCCESS) {
        return (FALSE);
    }

    /*
     * Look for c:\path\... style, c:/path/... or \\computer\shar\path...
     * the UNC style file specs
     */
    if (isalpha(filename[0]) && filename[1] == ':' &&
            (filename[2] == '\\' || filename[2] == '/')) {
        strncpy(drive, filename, 3);
        drive[3] = '\0';
    }

    else if ((filename[0] == '\\') && (filename[1] == '\\')) {
        /* Find the machine and share name and rebuild the UNC */
        strcpy(tmpbuf, filename);
        machinename = strtok(tmpbuf, "\\");
        sharename = strtok(NULL, "\\");
        strcpy(drive, "\\\\");
        strcat(drive, machinename);
        strcat(drive, "\\");
        strcat(drive, sharename);
        strcat(drive, "\\");

    }
    else /* Not determinable */
        return (FALSE);

    GetVolumeInformation(drive, NULL, 0, NULL, 0, NULL, FSType,
                         sizeof(FSType));
    if(strcmp(FSType,"NTFS") == 0)
        return (TRUE);
    else
        return (FALSE);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:49,代码来源:fsaccess.c


注:本文中的GetVolumeInformation函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。