From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 754C2385B53B; Fri, 1 Dec 2023 09:51:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 754C2385B53B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1701424319; bh=vrpO5WF8V8Ka7C89lY2QKxQhXQwA7xhOjDXgJZyJx0o=; h=Date:From:To:Subject:Reply-To:References:In-Reply-To:From; b=SWrLjdwWVxs+N1yeAy9SCIPDxG5XMiWDZaHmnR9MookHfG9mJORkJpFQbO17BPAUl yxwRaPttQ72Plh1TzSDGiuGIDBS16WwonBc+/qsfOawROH1VlE9QU/ZclMV7n8Jsj4 s7LZeJZcGCgGK5T9A/LGrWUcireoKptTxVy/zbSw= Received: by calimero.vinschen.de (Postfix, from userid 500) id BD09EA80C32; Fri, 1 Dec 2023 10:51:57 +0100 (CET) Date: Fri, 1 Dec 2023 10:51:57 +0100 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Cygwin tools to read/write NTFS alternate data streams? Message-ID: Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: 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 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