java - NTFS Listing All Files and Directories -


i'm trying make list of files , folders on mounted ntfs volume, , made 2 ways far, yielding different results (unfortunately).

(note: couldn't include additional sources here because link limit)

there few things cleared up:

(1) how come files/folders have weird unrecognizable characters in middle of name? , how write print them wstringstream , how write them wofstream?

example file path: c:\users\rahul\appdata\local\packages\winstore_cw5n1h2txyewy\localstate\cache\4\4-https∺∯∯wscont.apps.microsoft.com∯winstore∯6.3.0.1∯100∯us∯en-us∯ms∯482∯features1908650c-22a4-485e-8e88-b12d01c84f2f.json.dat

how appears if use dir in cmd: c:\users\rahul\appdata\local\packages\winstore_cw5n1h2txyewy\localstate\cache\4\4-https???wscont.apps.microsoft.com?winstore?6.3.0.1?100?us?en-us?ms?482?features1908650c-22a4-485e-8e88-b12d01c84f2f.json.dat

how appears if use wprintf in c++: c:\users\rahul\appdata\local\packages\winstore_cw5n1h2txyewy\localstate\cache\4\4-https

the file name shows in windows explorer, has trouble being printed in cmd. appears box in notepad++, if right-click, shows properly, notepad++ can display characters (sort-of, encoding change maybe?).

i'm using (ss stringstream, initialized wstingstream ss("");)

wstringstream ss(""); (my program methods here) wofstream out("...", wofstream::out); out << ss.rdbuf(); out.close(); 

i'm assuming encoding has @ least it, @ same time, i'm not sure flags use.

(2) files listed in mft? every link on ntfs says file information , attributes stored in mft, according open source ntfslib (have link limit, can found googling an-ntfs-parser-lib), there 131840 file records.

when run own program, end 50mb file (includes permissions , such). program uses fsctl_mft_enum_usn_data , createfile handles , getfileinformationbyhandle getting extended information. createfile takes in wchar* normally, , doesn't have weird null termination issues (i think, maybe, not sure anymore, might missing files are).

it shows there 129454 files read, i'm assuming other 131840-129454=2386 files files deleted still in usn journal.

(3) how come java version of code outputs more file records mft contains?

the output of java code 150mb file (includes permissions, enumerates names instead of symbols because don't know how not that, it's way bigger).

as can see here, there 161430 file records in one. that's more ntfslib said there are. yes, case many of 131840 file records 'additional names', explicitly avoided symlinks in java version. case 30000 files generated hardlinks or somehow having more names independent being symlinks?

solution (1):

you must write own library can write utf-16, since writing run cases characters misaligned , think there null, example: 0xd00a may run 0x00 character during misalign , terminate.

i used following 2 files write out unicode. handles wchar_t, wchar_t*, char, char*, unsigned long, , unsigned long long: utf16.h, utf16.c

(2,3):

yes, they're there. can find number of links in getinformationbyhandle method , count number of files java 1 contains.

still looking for: how list names of links file record in mft?


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -