예제 #1
0
UnicodeString far_get_current_dir() {
  UnicodeString curr_dir;
  int size = static_cast<int>(g_fsf.GetCurrentDirectory(0, NULL));
  g_fsf.GetCurrentDirectory(size, curr_dir.buf(size));
  curr_dir.set_size();
  return del_trailing_slash(curr_dir);
}
예제 #2
0
bool get_device_path( const wstring& volume_guid_path, wstring& volume_dev_path ) {
	const wstring c_prefix( L"\\\\?\\" );
	if ( volume_guid_path.size( ) < c_prefix.size( ) || volume_guid_path.substr( 0, c_prefix.size( ) ) != c_prefix ) {
		return false;
		}
	unsigned buf_size = MAX_PATH;
	unique_ptr<wchar_t[ ]> buffer( new wchar_t[ buf_size ] );
	SetLastError( NO_ERROR );
	DWORD len = QueryDosDeviceW( del_trailing_slash( volume_guid_path ).substr( 4 ).c_str( ), buffer.get( ), buf_size );
	if ( len == 0 || GetLastError( ) != NO_ERROR ) {
		return false;
		}
	volume_dev_path.assign( buffer.get( ) );
	return true;
	}