a_inode *fsdb_lookup_aino_aname (a_inode *base, const TCHAR *aname) { FILE *f; f = get_fsdb (base, _T("r+b")); if (f == 0) { // if (currprefs.filesys_custom_uaefsdb && (base->volflags & MYVOLUMEINFO_STREAMS)) // return custom_fsdb_lookup_aino_aname (base, aname); return 0; } for (;;) { uae_u8 buf[1 + 4 + 257 + 257 + 81]; TCHAR *s; if (fread (buf, 1, sizeof buf, f) < sizeof buf) break; s = au ((char*)buf + 5); if (buf[0] != 0 && same_aname (s, aname)) { long pos = ftell (f) - sizeof buf; fclose (f); xfree (s); return aino_from_buf (base, buf, pos); } xfree (s); } fclose (f); return 0; }
static a_inode *custom_fsdb_lookup_aino (a_inode *base, const TCHAR *aname, int offset, int dontcreate) { uae_u8 fsdb[UAEFSDB2_LEN]; TCHAR *tmp1; HANDLE h; WIN32_FIND_DATA fd; static a_inode dummy; tmp1 = build_nname (base->nname, UAEFSDB_BEGINSX); if (!tmp1) return NULL; h = FindFirstFile (tmp1, &fd); if (h != INVALID_HANDLE_VALUE) { do { if (read_uaefsdb (base->nname, fd.cFileName, fsdb)) { TCHAR *s = au ((char*)fsdb + offset); if (same_aname (s, aname)) { int winmode; FindClose (h); xfree (tmp1); xfree (s); if (dontcreate) return &dummy; return aino_from_buf (base, fsdb, &winmode); } xfree (s); } } while (FindNextFile (h, &fd)); FindClose (h); } xfree (tmp1); return NULL; }
static a_inode *custom_fsdb_lookup_aino (a_inode *base, const TCHAR *aname, int offset, int dontcreate) { uae_u8 fsdb[UAEFSDB2_LEN]; TCHAR *tmp1; HANDLE h; WIN32_FIND_DATA fd; static a_inode dummy; const TCHAR *namep; TCHAR path[MAX_DPATH]; tmp1 = build_nname (base->nname, UAEFSDB_BEGINSX); if (!tmp1) return NULL; if (currprefs.win32_filesystem_mangle_reserved_names == false) { _tcscpy (path, PATHPREFIX); _tcscat (path, tmp1); namep = path; } else { namep = tmp1; } h = FindFirstFile (namep, &fd); if (h != INVALID_HANDLE_VALUE) { do { if (read_uaefsdb (base->nname, fd.cFileName, fsdb)) { TCHAR *s = au ((char*)fsdb + offset); if (same_aname (s, aname)) { int winmode; FindClose (h); xfree (tmp1); xfree (s); if (dontcreate) return &dummy; return aino_from_buf (base, fsdb, &winmode); } xfree (s); } } while (FindNextFile (h, &fd)); FindClose (h); } xfree (tmp1); return NULL; }
a_inode *fsdb_lookup_aino_aname (a_inode *base, const char *aname) { FILE *f = get_fsdb (base, "r+b"); if (f == 0) return 0; for (;;) { char buf[1 + 4 + 257 + 257 + 81]; if (fread (buf, 1, sizeof buf, f) < sizeof buf) break; if (buf[0] != 0 && same_aname (buf + 5, aname)) { long pos = ftell (f) - sizeof buf; fclose (f); return aino_from_buf (base, buf, pos); } } fclose (f); return 0; }
a_inode *fsdb_lookup_aino_aname (a_inode *base, const TCHAR *aname) { FILE *f; f = get_fsdb (base, _T("r+b")); if (f == 0) { return 0; } for (;;) { uae_u8 buf[1 + 4 + 257 + 257 + 81]; if (fread (buf, 1, sizeof buf, f) < sizeof buf) break; if (buf[0] != 0 && same_aname ((char*)buf + 5, aname)) { long pos = ftell (f) - sizeof buf; fclose (f); return aino_from_buf (base, buf, pos); } } fclose (f); return 0; }
a_inode *fsdb_lookup_aino_aname (a_inode *base, const char *aname) { FILE *f = get_fsdb (base, "rb"); long off = 0; if (f == 0) return 0; for (;;) { char buf[1 + 4 + 257 + 257 + 81]; if (fread (buf, 1, sizeof buf, f) < sizeof buf) break; if (buf[0] != 0 && same_aname (buf + 5, aname)) { fclose (f); return aino_from_buf (base, buf, off); } off += sizeof buf; } fclose (f); return 0; }
/**************************************************************** * my_issamevolume * * return FALSE, if one path is not inside the other: * * SYS:s and SYS:c are not the same path! * SYS:c/test and SYS:c *are*! * * return remaining different part in path: * * SYS:c and SYS: return "c" * * and the number of directory levels as a return code.. * * WARNING: This has never been tested! See od-win32 ****************************************************************/ int my_issamevolume(const TCHAR *path1, const TCHAR *path2, TCHAR *path) { TCHAR p1[MAX_DPATH]; TCHAR p2[MAX_DPATH]; int len, cnt; DebOut("WARNING: This has never been tested!\n"); DebOut("path1: %s, path2: %s\n", path1, path2); strncpy(p1, path1, MAX_DPATH); strncpy(p2, path2, MAX_DPATH); fullpath(p1, MAX_DPATH); fullpath(p2, MAX_DPATH); DebOut("p1: %s, p2: %s\n", p1, p2); len=_tcslen (p1); if (len>_tcslen (p2)) { len=_tcslen (p2); } /* len: MIN(len1, len2) */ if(!same_aname(p1, p2)) { DebOut("not same volume: %s and %s\n", path1, path2); return 0; } _tcscpy (path, p2 + len); cnt=0; for (int i = 0; i < _tcslen (path); i++) { if(path[i] == '/') { cnt++; } } write_log (_T("'%s' (%s) matched with '%s' (%s), extra = '%s'\n"), path1, p1, path2, p2, path); return cnt; }