From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Cygwin tools to read/write NTFS alternate data streams?
Date: Fri, 1 Dec 2023 10:51:57 +0100 [thread overview]
Message-ID: <ZWmsvW0bmko_9Qcc@calimero.vinschen.de> (raw)
In-Reply-To: <CANH4o6N7UONfYy1ir7WZXpOnthSxF=fcqaPe37dPsdU_AoPoLw@mail.gmail.com>
On Nov 30 04:55, Martin Wege via Cygwin wrote:
> Hello,
>
> Does Cygwin have tools (modified /usr/bin/dd ?) to read/write NTFS
> alternate data streams?
No. As you know, the colon is translated to a normal filename
character, and there's no POSIX-like API to expose ADS raw to user
space.
There is, however, an old function we still expose to user space
for backward compat:
#include <sys/cygwin.h>
int cygwin_attach_handle_to_fd (char *name,
int fd,
HANDLE handle,
mode_t bin,
DWORD myaccess);
This allows to sneak in a HANDLE into a Cygwin file descriptor
representation, kind of like this:
HANDLE h;
int fd;
h = CreateFile ("foo:bar", GENERIC_READ, FILE_SHARE_VALID_FLAGS,
NULL, OPEN_EXISTING, 0, NULL);
if (h != INVALID_HANDLE_VALUE)
{
fd = cygwin_attach_handle_to_fd ("foo", -1, h, 0, GENERIC_READ);
if (fd < 0)
bail_out;
}
For the bin parameter, only 0, O_BINARY or O_TEXT are acceptable,
for myaccess, only GENERIC_READ and/or GENERIC_WRITE are acceptable.
Corinna
next prev parent reply other threads:[~2023-12-01 9:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 3:55 Martin Wege
2023-12-01 9:51 ` Corinna Vinschen [this message]
2023-12-18 17:47 ` Martin Wege
2024-01-08 14:09 ` Corinna Vinschen
2024-01-11 14:00 ` Martin Wege
2024-01-11 16:41 ` Corinna Vinschen
2024-01-12 5:15 ` Roland Mainz
2024-01-12 9:24 ` Cedric Blancher
2024-01-12 9:57 ` Corinna Vinschen
2024-01-12 5:03 ` Roland Mainz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZWmsvW0bmko_9Qcc@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).