VOID SetVadInfo(PMMVAD pVad, PVAD_INFO pVadInfo) { pVadInfo->pAddress = (ULONG)pVad; pVadInfo->pControlArea = (PCONTROL_AREA)GetControlArea(pVad); pVadInfo->pFileObject = (PFILE_OBJECT)GetFileObject(pVad); pVadInfo->Name = (PUNICODE_STRING)GetVADName(pVad); return; }
HRESULT FileSystem::FileSystem_impl::WriteFile( const String& file, const void * buf, unsigned long len ) const { boost::shared_ptr< FileObjectProxyBase > fileobj = GetFileObject( file, EOM_WRITE ); if( fileobj ) { return fileobj->WriteFile( buf, len ); } return XFXERR_NOTFOUND; }
HRESULT FileSystem::FileSystem_impl::GetFileSize( const String& file, unsigned long& len ) const { boost::shared_ptr< FileObjectProxyBase > fileobj = GetFileObject( file, EOM_READ ); if( fileobj ) { return fileobj->GetFileSize( len ); } return XFXERR_NOTFOUND; }
HRESULT FileSystem::FileSystem_impl::ReadFile( const String& file, void * buf ) const { boost::shared_ptr< FileObjectProxyBase > fileobj = GetFileObject( file, EOM_READ ); if( fileobj ) { return fileobj->ReadFile( buf ); } return XFXERR_NOTFOUND; }
PUNICODE_STRING GetVADName(PMMVAD pVad) { PFILE_OBJECT pFileObject = NULL; pFileObject = GetFileObject(pVad); if (MmIsAddressValid((PULONG)pFileObject) == FALSE) return NULL; if (MmIsAddressValid((PULONG)((PUCHAR)&pFileObject->FileName)) == FALSE) return NULL; /* IoQueryFileDosDeviceName */ return &pFileObject->FileName; }
VOID CFileObject::OnDestroy(_In_ WDFOBJECT FileObject) { FunctionEntry("..."); CFileObject *pFileObject = GetFileObject(FileObject); NT_ASSERT(pFileObject != nullptr); if (pFileObject->m_FileObject == FileObject) { // File object constructed using placement 'new' so explicitly invoke destructor pFileObject->~CFileObject(); } FunctionReturnVoid(); }
HRESULT FileSystem::FileSystem_impl::FindFile( const String& file, boost::shared_ptr< class Pack > * pack, String * phys_path ) const { boost::shared_ptr< FileObjectProxyBase > fileobj = GetFileObject( file, EOM_READ ); if( fileobj.get( ) ) { if( pack ) *pack = fileobj->GetPack( ); if( phys_path ) *phys_path = fileobj->PhysicalPath( ); return S_OK; } return XFXERR_NOTFOUND; }
/* * In this implementation of FSManager, GetNewFileObject is wholly * equivalent to GetFileObject. GetNewFileObject exists for the * server's FSManager since it would otherwise be impossible to get * a brand new file object for writing, as the DoesExist checks * would fail for every file system checked. This implementation has * ambiguities between URL's and file systems, so there is no * different functionality needed. */ STDMETHODIMP HXFileSystemManager::GetNewFileObject(IHXRequest* pRequest, IHXAuthenticator* pAuthenticator) { return GetFileObject(pRequest, pAuthenticator); }