int writeDirEntry(int fd, struct INode* in, int linkNo, struct DirEntry* dent){ lseek(fd, getDirEntryAddress(linkNo, in), SEEK_SET); printf("\tWriting directory entry %s at %d\n",dent->d_entry.d_name, getDirEntryAddress(linkNo, in)); write(fd, dent, sizeof(struct DirEntry)); write(fd2, "\n", 1); write(fd2, dent, sizeof(struct DirEntry)); }
IMAGE_RESOURCE_DIRECTORY* ResourceDirWrapper::mainResourceDir() { offset_t rva = getDirEntryAddress(); BYTE *ptr = m_Exe->getContentAt(rva, Executable::RVA, sizeof(IMAGE_RESOURCE_DIRECTORY)); return (IMAGE_RESOURCE_DIRECTORY*) ptr; }
int freeDirEntry(int fd, struct INode* in, int linkNo){ struct DirEntry last; readDirEntry(fd, in, in->i_nlinks-1, &last); writeDirEntry(fd, in, linkNo, &last); lseek(fd, getDirEntryAddress(in->i_nlinks-1, in), SEEK_SET); write(fd, &nullbuf, sizeof(struct DirEntry)); in->i_nlinks--; }
void* LdConfigDirWrapper::getLdConfigDirPtr() { offset_t rva = getDirEntryAddress(); bufsize_t dirSize = getLdConfigDirSize(); BYTE *ptr = m_Exe->getContentAt(rva, Executable::RVA, dirSize); return ptr; }
int readDirEntry(int fd, struct INode* in, int linkNo, struct DirEntry* dent){ lseek(fd, getDirEntryAddress(linkNo, in), SEEK_SET); read(fd, dent, sizeof(struct DirEntry)); printf("Read Dir Entry %s\n",dent->d_entry.d_name); }