Added file_name argument to QueryDirectory.

This commit is contained in:
gibbed 2014-01-19 02:05:51 -08:00
parent 71de4e77dc
commit c7276454d7
15 changed files with 34 additions and 27 deletions

View File

@ -65,7 +65,7 @@ X_STATUS DiscImageEntry::QueryInfo(XFileInfo* out_info) {
}
X_STATUS DiscImageEntry::QueryDirectory(
XDirectoryInfo* out_info, size_t length, bool restart) {
XDirectoryInfo* out_info, size_t length, const char* file_name, bool restart) {
XEASSERTNOTNULL(out_info);
if (restart == true && gdfx_entry_iterator_ != gdfx_entry_->children.end()) {

View File

@ -33,7 +33,8 @@ public:
GDFXEntry* gdfx_entry() const { return gdfx_entry_; }
virtual X_STATUS QueryInfo(XFileInfo* out_info);
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, bool restart);
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
size_t length, const char* file_name, bool restart);
virtual bool can_map() { return true; }
virtual MemoryMapping* CreateMemoryMapping(

View File

@ -44,9 +44,9 @@ X_STATUS DiscImageFile::QueryInfo(XFileInfo* out_info) {
return entry_->QueryInfo(out_info);
}
X_STATUS DiscImageFile::QueryDirectory(
XDirectoryInfo* out_info, size_t length, bool restart) {
return entry_->QueryDirectory(out_info, length, restart);
X_STATUS DiscImageFile::QueryDirectory(XDirectoryInfo* out_info,
size_t length, const char* file_name, bool restart) {
return entry_->QueryDirectory(out_info, length, file_name, restart);
}
X_STATUS DiscImageFile::ReadSync(

View File

@ -35,7 +35,7 @@ public:
virtual X_STATUS QueryInfo(XFileInfo* out_info);
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
size_t length, bool restart);
size_t length, const char* file_name, bool restart);
protected:
virtual X_STATUS ReadSync(

View File

@ -74,7 +74,7 @@ X_STATUS HostPathEntry::QueryInfo(XFileInfo* out_info) {
}
X_STATUS HostPathEntry::QueryDirectory(
XDirectoryInfo* out_info, size_t length, bool restart) {
XDirectoryInfo* out_info, size_t length, const char* file_name, bool restart) {
XEASSERTNOTNULL(out_info);
WIN32_FIND_DATA ffd;

View File

@ -30,7 +30,8 @@ public:
const xechar_t* local_path() { return local_path_; }
virtual X_STATUS QueryInfo(XFileInfo* out_info);
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, bool restart);
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
size_t length, const char* file_name, bool restart);
virtual bool can_map() { return true; }
virtual MemoryMapping* CreateMemoryMapping(

View File

@ -44,8 +44,9 @@ X_STATUS HostPathFile::QueryInfo(XFileInfo* out_info) {
return entry_->QueryInfo(out_info);
}
X_STATUS HostPathFile::QueryDirectory(XDirectoryInfo* out_info, size_t length, bool restart) {
return entry_->QueryDirectory(out_info, length, restart);
X_STATUS HostPathFile::QueryDirectory(XDirectoryInfo* out_info,
size_t length, const char* file_name, bool restart) {
return entry_->QueryDirectory(out_info, length, file_name, restart);
}
X_STATUS HostPathFile::ReadSync(

View File

@ -35,7 +35,7 @@ public:
virtual X_STATUS QueryInfo(XFileInfo* out_info);
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
size_t length, bool restart);
size_t length, const char* file_name, bool restart);
protected:
virtual X_STATUS ReadSync(

View File

@ -44,7 +44,7 @@ X_STATUS STFSContainerEntry::QueryInfo(XFileInfo* out_info) {
}
X_STATUS STFSContainerEntry::QueryDirectory(
XDirectoryInfo* out_info, size_t length, bool restart) {
XDirectoryInfo* out_info, size_t length, const char* file_name, bool restart) {
XEASSERTNOTNULL(out_info);
if (restart && stfs_entry_iterator_ != stfs_entry_->children.end()) {

View File

@ -33,7 +33,8 @@ public:
STFSEntry* stfs_entry() const { return stfs_entry_; }
virtual X_STATUS QueryInfo(XFileInfo* out_info);
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, bool restart);
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
size_t length, const char* file_name, bool restart);
virtual X_STATUS Open(
KernelState* kernel_state,

View File

@ -44,9 +44,9 @@ X_STATUS STFSContainerFile::QueryInfo(XFileInfo* out_info) {
return entry_->QueryInfo(out_info);
}
X_STATUS STFSContainerFile::QueryDirectory(
XDirectoryInfo* out_info, size_t length, bool restart) {
return entry_->QueryDirectory(out_info, length, restart);
X_STATUS STFSContainerFile::QueryDirectory(XDirectoryInfo* out_info,
size_t length, const char* file_name, bool restart) {
return entry_->QueryDirectory(out_info, length, file_name, restart);
}
X_STATUS STFSContainerFile::ReadSync(

View File

@ -35,7 +35,7 @@ public:
virtual X_STATUS QueryInfo(XFileInfo* out_info);
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
size_t length, bool restart);
size_t length, const char* file_name, bool restart);
protected:
virtual X_STATUS ReadSync(

View File

@ -60,7 +60,8 @@ public:
const char* name() const { return name_; }
virtual X_STATUS QueryInfo(XFileInfo* out_info) = 0;
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, bool restart) = 0;
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
size_t length, const char* file_name, bool restart) = 0;
virtual bool can_map() { return false; }
virtual MemoryMapping* CreateMemoryMapping(

View File

@ -95,7 +95,8 @@ public:
void set_position(size_t value) { position_ = value; }
virtual X_STATUS QueryInfo(XFileInfo* out_info) = 0;
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info, size_t length, bool restart) = 0;
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
size_t length, const char* file_name, bool restart) = 0;
X_STATUS Read(void* buffer, size_t buffer_length, size_t byte_offset,
size_t* out_bytes_read);

View File

@ -60,6 +60,9 @@ SHIM_CALL NtCreateFile_shim(
uint32_t info = X_FILE_DOES_NOT_EXIST;
uint32_t handle;
FileSystem* fs = state->file_system();
Entry* entry;
XFile* root_file = NULL;
if (attrs.root_directory != 0xFFFFFFFD) { // ObDosDevices
result = state->object_table()->GetObject(
@ -70,8 +73,7 @@ SHIM_CALL NtCreateFile_shim(
}
// Resolve the file using the virtual file system.
FileSystem* fs = state->file_system();
Entry* entry = fs->ResolvePath(attrs.object_name.buffer);
entry = fs->ResolvePath(attrs.object_name.buffer);
XFile* file = NULL;
if (entry && entry->type() == Entry::kTypeFile) {
// Open the file.
@ -513,15 +515,14 @@ SHIM_CALL NtQueryDirectoryFile_shim(
return;
}
/*
const char* file_name = NULL;
if (file_name_ptr != 0) {
// it's a PANSI_STRING or whatever.
if (SHIM_MEM_16(file_name_ptr + 0) != 0 ||
SHIM_MEM_16(file_name_ptr + 2) != 0) {
const char* file_name = (const char *)SHIM_MEM_ADDR(SHIM_MEM_32(file_name_ptr + 4));
XEASSERT(strcmp(file_name, "*.*") == 0);
file_name = (const char*)SHIM_MEM_ADDR(SHIM_MEM_32(file_name_ptr + 4));
}
}
*/
X_STATUS result = X_STATUS_UNSUCCESSFUL;
uint32_t info = 0;
@ -531,7 +532,7 @@ SHIM_CALL NtQueryDirectoryFile_shim(
file_handle, (XObject**)&file);
if (XSUCCEEDED(result)) {
XDirectoryInfo* dir_info = (XDirectoryInfo*)xe_calloc(length);
result = file->QueryDirectory(dir_info, length, restart_scan != 0);
result = file->QueryDirectory(dir_info, length, file_name, restart_scan != 0);
if (XSUCCEEDED(result)) {
dir_info->Write(SHIM_MEM_BASE, file_info_ptr);
info = length;