⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getdrivetype.cpp

📁 浏览所有的PCI设备
💻 CPP
字号:
#include "stdafx.h"

/****************************************************************************
*                                getDriveType
* Inputs:
*       LPCTSTR fullpath: Full path to some destination
* Result: UINT
*       DRIVE_ value as returned by GetDriveType
* Effect: 
*       Properly splits up the input string and figures out how to call
*       GetDriveType 
* Notes:
*	Handles the special case of \\.\name\, and a path that includes
*	a file name
****************************************************************************/

UINT getDriveType(LPCTSTR fullpath)
    {
     TCHAR drv[_MAX_PATH];
     TCHAR path[_MAX_PATH];
     TCHAR filename[_MAX_PATH];
     TCHAR ext[_MAX_PATH];

     _splitpath(fullpath, drv, path, filename, ext);
     if(lstrlen(drv) != 0)
        { /* drv */
	 return GetDriveType(drv);
	} /* drv */
     else
        { /* what else? */
	 // The trick here is that if the path starts with \\, we try 
	 // GetDeviceType. If it returns DRIVE_NO_ROOT_DIR, we call
	 // this function recursively
	 // If it does not start with \\, we return the result directly
	 UINT result = GetDriveType(path);
	 if(lstrlen(path) > 4 && path[0] == _T('\\') && path[1] == _T('\\')
                              && path[2] == _T('.') && path[3] == _T('\\'))
	    { /* \\. */
	     LPTSTR p = &path[4]; //  \\.\c
	     			  //      ^
             LPTSTR b = strchr(p, _T('\\'));
	     if(b != NULL)
		*b = _T(':');
             else
		lstrcat(p, _T(":"));
	     return GetDriveType(p);
	    } /* \\. */
	 if(lstrlen(path) < 2 || path[0] != _T('\\') || path[1] != _T('\\'))
	    return result;
         return GetDriveType(path);
	} /* what else? */
	    
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -