| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 0647338618E3 |
| DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
| s=default; t=1701424358; | |
| bh=H8KSXzCQzt+zCm83PvpAgnJVVkr/9hYwPyISFTAc3GU=; | |
| h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: | |
| List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: | |
| From; | |
| b=LMx/d7YzbcAI3TNrrwUTUdV5wRp2esp9H5HKY06RrtqLUzbtammwisuqCHkKitnxZ | |
| RrmJ5tAzNhkY7rHdoCCg1Ek9FkRrm8eH/2JZGPuaSj7QsoT0iYmWBsW4Ju6URgFtoS | |
| jTi18JoFCY4JjLxwHt57E+UXw7aCDZhPUjVbERvA= | |
| X-Original-To: | cygwin AT cygwin DOT com |
| Delivered-To: | cygwin AT cygwin DOT com |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 754C2385B53B |
| Date: | Fri, 1 Dec 2023 10:51:57 +0100 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Cygwin tools to read/write NTFS alternate data streams? |
| Message-ID: | <ZWmsvW0bmko_9Qcc@calimero.vinschen.de> |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| References: | <CANH4o6N7UONfYy1ir7WZXpOnthSxF=fcqaPe37dPsdU_AoPoLw AT mail DOT gmail DOT com> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <CANH4o6N7UONfYy1ir7WZXpOnthSxF=fcqaPe37dPsdU_AoPoLw@mail.gmail.com> |
| X-BeenThere: | cygwin AT cygwin DOT com |
| X-Mailman-Version: | 2.1.30 |
| List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
| List-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
| List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
| List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
| From: | Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com> |
| Reply-To: | cygwin AT cygwin DOT com |
| Cc: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| Errors-To: | cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com |
| Sender: | "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT 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
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |