Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int Iso9660_abrir_arquivo(unsigned char * path, unsigned char **imagem)
- {
- int encontrou = 0;
- //recuperar diretório raiz
- unsigned char *dir;
- unsigned int tamanho;
- Cdir *dir_aux;
- Iso9660_carregar_info_disco();
- Iso9660_recuperar_diretorio(&dir,"");
- char * trecho = strtok(path, "/");
- while(trecho != NULL)
- {
- unsigned pos = 0;
- encontrou = 0;
- while(dir[pos] > 0)
- {
- dir_aux = (Cdir*)&dir[pos];
- char nome[256];
- memset(nome,'\0',sizeof(nome));
- for(int aux = 0; aux < dir_aux->namelen; aux++)
- {
- if( dir_aux->name[aux] != ';')
- {
- nome[aux] = dir_aux->name[aux];
- }
- else
- {
- nome[aux] = '\0';
- }
- }
- if(!strcmp(trecho, nome))
- {
- Iso9660_recuperar_arquivo(&dir,*(unsigned int*)dir_aux->dloc,*(unsigned int*)dir_aux->dlen);
- encontrou = 1;
- tamanho = *(unsigned int*)dir_aux->dlen;
- break;
- }
- pos+= (unsigned int)dir[pos];
- }
- if(!encontrou) return -1;
- trecho = strtok(NULL, "/");
- }
- *imagem = dir;
- return tamanho;
- }
Add Comment
Please, Sign In to add comment