How to read metafiles of NTFS file system using C - c++

Can anyone show me how to directly access metafiles ($MFT, $Volume, $Bitmap...) ?
I need to get info from these files.

You can use the ioctl function, FSCTL_GET_NTFS_FILE_RECORD.

Related

reading snappy file in Java Map reduce

Can we use snappy file as input file to Map reduce application without using a Custom Input Class?
I was not able to find any information about this.
Regards,
Nish
Yes you can do that but you may have to decompress the file first to use it.
CompressionCodec codec = (CompressionCodec) ReflectionUtils.newInstance(SnappyCodec.class, new Configuration());
After creating an instance of codec, call createInputStream and pass the hadoop path.
codec.createInputStream

Is a sendfile() like operation possible with linux-aio?

I want to send data from one file descriptor to another via linux-aio without buffering and without transferring data to and from user space. Is such a sendfile64() funktion possible with linux-aio?
I looked at some linux-aio examples (in C/C++) and simple file-copy programs. All these examples do reading -> buffer -> writing.
regards,
philip
It's possible if you mmap the file, then you can make a aio sendfile. It's faster then sendfile via do_splice and should not sync at i_mutex.
Look at the lighttp linux_aio module.

How to get file type on linux?

I need to get file type without using file extensions on linux. There is "file" utility, which can do this. How can I do the same using C/C++? Not 'system(const char *)', of course... Thanks)
AFAIK file is implemented over libmagic. For more reference see:
file sources
and maybe this link: http://linux.die.net/man/3/libmagic.
Either call file as a child process or emulate what it does. There are no other options if you want to intelligently examine a file's content to guess what it contains.

Create file with certain size

Is there any method to create a file of desired size whenever I create a file using CreateFile().
Thanks.
SetEndOfFile can be used to extend or truncate a file.
I think (in case you are sitting in front of a *nix box) you can handle this with the default low-lewel write() / fsync() APIs.
Regards,
dley
you might use, at the prompt (with admin credentials), "fsutil file createnew" followed by the file name and the desired size (in bytes)

Edit the frame rate of an avi file

Is it possible to change the frame rate of an avi file using the Video for windows library? I tried the following steps but did not succeed.
AviFileInit
AviFileOpen(OF_READWRITE)
pavi1 = AviFileGetStream
avi_info = AviStreamInfo
avi_info.dwrate = 15
EditStreamSetInfo(dwrate) returns -2147467262.
I'm pretty sure the AVIFile* APIs don't support this. (Disclaimer: I was the one who defined those APIs, but it was over 15 years ago...)
You can't just call EditStreamSetInfo on an plain AVIStream, only one returned from CreateEditableStream.
You could use AVISave, then, but that would obviously re-copy the whole file.
So, yes, you would probably want to do this by parsing the AVI file header enough to find the one DWORD you want to change. There are lots of documents on the RIFF and AVI file formats out there, such as http://www.opennet.ru/docs/formats/avi.txt.
I don't know anything about VfW, but you could always try hex-editing the file. The framerate is probably a field somewhere in the header of the AVI file.
Otherwise, you can script some tool like mencoder[1] to copy the stream to a new file under a different framerate.
[1] http://www.mplayerhq.hu/
HRESULT: 0x80004002 (2147500034)
Name: E_NOINTERFACE
Description: The requested COM interface is not available
Severity code: Failed
Facility Code: FACILITY_NULL (0)
Error Code: 0x4002 (16386)
Does it work if you DON'T call EditStreamSetInfo?
Can you post up the code you use to set the stream info?