delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/05/15/06:13:33

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A41C3858D33
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1715768011;
bh=6u1kHC1BtN3nIbWl/LtWybpn/xFoXjn8StWLyhs4PnQ=;
h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=Pn4LX0SoAkrqze8UP9roxlS6fvqWJkAmGvNk6qWVZ2b0l56nYyXigcOQ2t5oYw9+P
gErHTR13Nux2D9P2/aFR8FSRLLpba9WyjgR92pVz6Cwr+ky0cdWrtqVt15Ss121BHf
8s6XaHixgjF8lKzHn2GvzKGbp/Uv/RFoulc3y8rY=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D24C33858D20
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D24C33858D20
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715767990; cv=none;
b=l+oqlECJueeiZfR9wK2D57kHtQwrrtyVlMnXe+RILjV4ils7c92ZHwxQh6AZbGt/86CQ9gkWiTq1LLpIhIpfj0KVcxW+AjJFUl8Ft5ZhXAA3wixiXSfxs0s1+sKiTgletEc6y0KA/S4JsV48lmh32Tu6H3CnoXOlPupUDYkrnpg=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1715767990; c=relaxed/simple;
bh=KIQEEFeRjU8yycwSXuocx8czID6//Qlx4UcEmzYefAo=;
h=MIME-Version:From:Date:Message-ID:Subject:To;
b=Uczw8Lg3i8Eb9irX/m7U8SodDEiz9oNDymFcs6qazIhPNj1LfukPxHxtf4gC7h5mkPuta5ZNhZXe8U0hD2JBs8KOSnqOdWQKMebCHSFz00aBwsDWUsdMXR+UlUi7xk/bs3M4Dc/UQKINdl2f//DcUfTB6aceMv2xpXp3MvClX6s=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1715767987; x=1716372787;
h=content-transfer-encoding:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=BnQnWK/OYzOFYpI09v18o5vrH/xUEqutlhOduB2G1nU=;
b=d7iOdoP1NKtcOgs8UPuhj0t+2wbIXSQztRxdjXF7y7mC6EDy4OaNEbOX2Cqire7ygo
mr4GG5YvGL/546dA6ObErQIM3fOSrFKFO+x6p9zqMpFxfsClJbP7oSoiLpt11tDjxPZj
5ouRCcDdRzIYg3xHsxJtjuJMRJpdsvZ0UMudrmN3dHXcUnXNJrc5OsanhM5uuDwgLUJM
jY45QazfonEU1Jx7Etkn6Az2uDX8PawpPpcniwm7mJbTI4bbN1x58x4Y78VJY4jY11t/
UwHpwF5CDS+q3oe/nK/gvf0bN0V2xL8fRIbfwf9A8SBlIHVpIy5DjBH7apbNChsl1HJr
3STg==
X-Gm-Message-State: AOJu0Yz32tgziHRQiTH9EBC5yciAl0WVn4q0K61CeikdgivBN2ij59Wr
XNUB3DgJ9f1M38rQNLNjq3MyMkh5s1Qzn2oha2lKhuduI1qbE77jHvZbDoohkDum7w9ueM+M62e
A/Brc6y3xjNgf4ZHP1iNyNO1ixdo+mJ3i
X-Google-Smtp-Source: AGHT+IG3I46XPj6jSEP0DYNCOM0jt6SJPqfHlsZTxk1nEx/dW3/DcbZO06g8c3YC8zwSBinZIq0X/QgNilwf2jxa0HM=
X-Received: by 2002:a05:6602:21c2:b0:7e1:839e:5ab1 with SMTP id
ca18e2360f4ac-7e1b520c50bmr2351744239f.18.1715767986502; Wed, 15 May 2024
03:13:06 -0700 (PDT)
MIME-Version: 1.0
References: <CAKAoaQ=+MnexxHnoapGLk2iL0G49iBpqK-AoP_28KfD_00Q46Q AT mail DOT gmail DOT com>
<de5b72e5-6168-45ae-b9d8-7f94175720b7 AT SystematicSW DOT ab DOT ca>
In-Reply-To: <de5b72e5-6168-45ae-b9d8-7f94175720b7@SystematicSW.ab.ca>
Date: Wed, 15 May 2024 12:12:40 +0200
Message-ID: <CAKAoaQ=8oN4z49+8_DWzCZrXqoOLaMpO0kyFn=kdZAvmQsbwGQ@mail.gmail.com>
Subject: Re: Wrong value for |FileNormalizedNameInfo| (|24| vs. |48|) in
Cygwin 3.6 /usr/include ...
To: cygwin AT cygwin DOT com
X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,
FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,
KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,
SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
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-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: Roland Mainz via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Roland Mainz <roland DOT mainz AT nrubsig DOT org>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 44FADX0V1916263

On Sat, May 11, 2024 at 6:17 PM Brian Inglis via Cygwin
<cygwin AT cygwin DOT com> wrote:
> On 2024-05-11 05:30, Roland Mainz via Cygwin wrote:
> > I'm writing a test program for |FileNormalizedNameInfo| right now (see
> > https://rovema.kpaste.net/07074abc).
> > Per https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ne-minwinbase-file_info_by_handle_class
> > |FileNormalizedNameInfo| should be |24|, but on Cygwin 3.6 I get the
> > value |48|.
> > Since |GetFileInformationByHandleEx()| gives me error 87 (="Invalid
> > Parameter") for |48|, but works as intended for |24| I assume that the
> > Cygwin header is wrong.
> >
> > Could someone please check the Cygwin header files ?
>
> Could someone please read the enum constant names and classes carefully?
>
> Package w32api-headers:
>
> > Headers:
> > ---- snip ----
> > $ grep -r FileNormalizedNameInfo /usr/include/
> > /usr/include/w32api/ddk/wdm.h:  FileNormalizedNameInformation,
> > /usr/include/w32api/minwinbase.h:    *FileNormalizedNameInfo*,
> > /usr/include/w32api/winternl.h:    FileNormalizedNameInformation = 48,
> > ---- snip ----
>
> *FileNormalizedNameInfo* 24/0x18 is defined in minwinbase.h
> FILE_INFO_BY_HANDLE_CLASS for GetFileInformationByHandleEx whereas
> *FileNormalizedNameInformation* 44/0x2e is defined in winternl.h
> FILE_INFORMATION_CLASS for NtQueryInformationFile:
>
> https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-ntqueryinformationfile
>
> ditto in ddk/wdm.h!

Something is still wrong on my side, with Cygwin 3.6 on Windows 10:

Example:
---- snip ----
#define UNICODE 1
#define _UNICODE 1

#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
#include <stdbool.h>

int main(int ac, char *av[])
{
    (void)printf("FileNormalizedNameInfo=%d/0x%x\n",
        (int)FileNormalizedNameInfo,
        (int)FileNormalizedNameInfo);

    return EXIT_SUCCESS;
}
---- snip ----

Compiling this with $ gcc -Wall test4.c -o test4 # and running it returns this:
---- snip ----
$ ./test4
FileNormalizedNameInfo=22/0x16
---- snip ----
The expected output would be "FileNormalizedNameInfo=24/0x18", because
in https://learn.microsoft.com/de-de/windows/win32/api/minwinbase/ne-minwinbase-file_info_by_handle_class
|FileNormalizedNameInfo| is in position 24.

Looking at /usr/include/w32api/minwinbase.h:
---- snip ----
  typedef enum _FILE_INFO_BY_HANDLE_CLASS {
   FileBasicInfo /* is zero? */,
   FileStandardInfo,
   FileNameInfo,
   FileRenameInfo,
   FileDispositionInfo,
   FileAllocationInfo,
   FileEndOfFileInfo,
   FileStreamInfo,
   FileCompressionInfo,
   FileAttributeTagInfo,
   FileIdBothDirectoryInfo,
   FileIdBothDirectoryRestartInfo,
   FileIoPriorityHintInfo,
   FileRemoteProtocolInfo,
   FileFullDirectoryInfo,
   FileFullDirectoryRestartInfo,
#if _WIN32_WINNT >= 0x0602
   FileStorageInfo,
   FileAlignmentInfo,
   FileIdInfo,
   FileIdExtdDirectoryInfo,
   FileIdExtdDirectoryRestartInfo,
#endif
#if _WIN32_WINNT >= 0x0A000002
   FileDispositionInfoEx,
   FileRenameInfoEx,
#endif
   FileCaseSensitiveInfo,
   FileNormalizedNameInfo,
   MaximumFileInfoByHandleClass
 } FILE_INFO_BY_HANDLE_CLASS, *PFILE_INFO_BY_HANDLE_CLASS;
#endif
---- snip ----

This code cannot work, because the integer value for
|FileNormalizedNameInfo| enum shift with different Windows versions,
e.g. |FileNormalizedNameInfo| has value |22| if |_WIN32_WINNT==0x0602|
but value |24| if |_WIN32_WINNT==0x0A000002|.

I filed https://github.com/mingw-w64/mingw-w64/issues/48 for the
issue, but it would be nice if this can be fixed in both Cygwin 3.5
and 3.6...

----

Bye,
Roland
-- 
  __ .  . __
 (o.\ \/ /.o) roland DOT mainz AT nrubsig DOT org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

-- 
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019