75 return m_cLetter != 0;
91 TCHAR a[] = { m_cLetter,
':',
'\\', 0 };
92 return ::GetDriveType(a);
104 TCHAR a[] = { m_cLetter,
':',
'\\', 0 };
118 case DRIVE_REMOVABLE:
162 if (
GetType() == DRIVE_FIXED )
183 if (
GetType() == DRIVE_FIXED )
206 DWORD
FormatDlg(HWND hWnd,
bool hasCheckDlg =
false)
const
208 DWORD r = 0xFFFFFFFEL;
211 HMODULE hInst = ::LoadLibraryA(
"shell32.dll");
214 DWORD (WINAPI *pShFormatDrive)(HWND hWnd, UINT drive, UINT fmdID, UINT options);
215 TNB::ForceSet(pShFormatDrive, ::GetProcAddress(hInst,
"SHFormatDrive"));
216 if ( pShFormatDrive != NULL )
218 UINT nowMode = ::SetErrorMode(0);
221 ::SetErrorMode(nowMode | SEM_FAILCRITICALERRORS);
225 ::SetErrorMode(nowMode & ~SEM_FAILCRITICALERRORS);
227 int d = (m_cLetter | 0x20) -
'a';
228 r = (pShFormatDrive)(hWnd, d, 0xFFFF, 0x0);
229 ::SetErrorMode(nowMode);
231 ::FreeLibrary(hInst);
246 int r = (cLetter | 0x20) -
'a';
247 if ( r >= 0 && r <= 25 )
249 DWORD d = ::GetLogicalDrives();
250 return (d &
_BIT(r)) != 0;
262 DWORD d = ::GetLogicalDrives();
265 if ( (d &
_BIT(i)) != 0 )
267 r.
Add(
static_cast<TCHAR
>(_T(
'A') + i));
285 if ( ! ::GetVolumePathName(lpszPath, s1.
GetBuffer(1024), 1024) )
291 if ( ! ::GetVolumeNameForVolumeMountPoint(s1, vol.
GetBuffer(1024), 1024) )
297 HANDLE h = ::CreateFile(vol, FILE_READ_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
298 VOLUME_DISK_EXTENTS buf;
299 DWORD returnedSize = 0;
300 BOOL r = ::DeviceIoControl(
301 h, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0, &buf,
sizeof(buf), &returnedSize, NULL);
302 DWORD le = _GetLastError(
"DeviceIoControl");
303 if ( r && buf.NumberOfDiskExtents == 1 )
305 _pdn.
Add(buf.Extents[0].DiskNumber);
309 if ( le != ERROR_MORE_DATA )
314 size_t bs =
sizeof(buf.NumberOfDiskExtents) +
sizeof(buf.Extents) * buf.NumberOfDiskExtents;
316 VOLUME_DISK_EXTENTS* p =
reinterpret_cast<VOLUME_DISK_EXTENTS *
>(w.
Ref());
317 r = ::DeviceIoControl(
318 h, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0, p, bs, &returnedSize, NULL);
319 le = _GetLastError(
"DeviceIoControl");
322 loop ( i, p->NumberOfDiskExtents )
324 _pdn.
Add(p->Extents[i].DiskNumber);
#define loop(VAR, CNT)
loop構文.
開発用に、メモリの状態を文字列にする関数があります。
bool GetVendorId(CStr &_id, bool withRevision=false) const
[取得] ベンダID 取得.
int Send_TestUnit(void)
[送信] TEST UNIT CDB送信.
bool OpenLetter(TCHAR driveLetter)
[操作] オープン.
virtual bool CanWrite(void) const
[確認] 書込み可能か?
void ReleaseBuffer(void)
[操作] 割り当てたバッファを開放.
CStrT & TrimRight(TYP t=' ')
[処理] 末尾から文字をトリム.
TYP * GetBuffer(size_t iLength=0)
[操作] 書き込みバッファ要求.
virtual bool RemoveAll(void)
[削除] 空化
virtual INDEX Add(const TYP &t)
[追加] 要素一つ追加.
const TYP * Ref(void) const
[取得] ポインタ取得