* Wrong value for |FileNormalizedNameInfo| (|24| vs. |48|) in Cygwin 3.6 /usr/include ...
@ 2024-05-11 11:30 Roland Mainz
2024-05-11 16:17 ` Brian Inglis
0 siblings, 1 reply; 5+ messages in thread
From: Roland Mainz @ 2024-05-11 11:30 UTC (permalink / raw)
To: cygwin; +Cc: Roland Mainz
Hi!
----
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 ?
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 ----
Cygwin version:
---- snip ----
$ uname -a
CYGWIN_NT-10.0-19045 okkoto 3.6.0-0.115.g579064bf4d40.x86_64
2024-04-09 21:11 UTC x86_64 Cygwin
---- snip ----
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz@nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Wrong value for |FileNormalizedNameInfo| (|24| vs. |48|) in Cygwin 3.6 /usr/include ...
2024-05-11 11:30 Wrong value for |FileNormalizedNameInfo| (|24| vs. |48|) in Cygwin 3.6 /usr/include Roland Mainz
@ 2024-05-11 16:17 ` Brian Inglis
2024-05-15 10:12 ` Roland Mainz
[not found] ` <DM8PR09MB7095035B890E1D7401D8DBB6A5E22@DM8PR09MB7095.namprd09.prod.outlook.com>
0 siblings, 2 replies; 5+ messages in thread
From: Brian Inglis @ 2024-05-11 16:17 UTC (permalink / raw)
To: cygwin
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!
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut
-- Antoine de Saint-Exupéry
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Wrong value for |FileNormalizedNameInfo| (|24| vs. |48|) in Cygwin 3.6 /usr/include ...
2024-05-11 16:17 ` Brian Inglis
@ 2024-05-15 10:12 ` Roland Mainz
2024-05-15 14:45 ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
[not found] ` <DM8PR09MB7095035B890E1D7401D8DBB6A5E22@DM8PR09MB7095.namprd09.prod.outlook.com>
1 sibling, 1 reply; 5+ messages in thread
From: Roland Mainz @ 2024-05-15 10:12 UTC (permalink / raw)
To: cygwin
On Sat, May 11, 2024 at 6:17 PM Brian Inglis via Cygwin
<cygwin@cygwin.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.mainz@nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [EXTERNAL] Re: Wrong value for |FileNormalizedNameInfo| (|24| vs. |48|) in Cygwin 3.6 /usr/include ...
[not found] ` <DM8PR09MB7095035B890E1D7401D8DBB6A5E22@DM8PR09MB7095.namprd09.prod.outlook.com>
@ 2024-05-15 14:14 ` Brian Inglis
0 siblings, 0 replies; 5+ messages in thread
From: Brian Inglis @ 2024-05-15 14:14 UTC (permalink / raw)
To: cygwin; +Cc: Lavrentiev, Anton (NIH/NLM/NCBI) [C]
On 2024-05-13 07:34, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote:
>> *FileNormalizedNameInformation* 44/0x2e is defined in winternl.h
>> FILE_INFORMATION_CLASS for NtQueryInformationFile:
>
> I see it's defined as 48/0x30 there, though...
Good catch and point!
My computer glasses did not seem to be working well last weekend!
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut
-- Antoine de Saint-Exupéry
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [EXTERNAL] Re: Wrong value for |FileNormalizedNameInfo| (|24| vs. |48|) in Cygwin 3.6 /usr/include ...
2024-05-15 10:12 ` Roland Mainz
@ 2024-05-15 14:45 ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
0 siblings, 0 replies; 5+ messages in thread
From: Lavrentiev, Anton (NIH/NLM/NCBI) [C] @ 2024-05-15 14:45 UTC (permalink / raw)
To: Roland Mainz; +Cc: cygwin
> 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 ----
FWIW, this is how it is defined by the native M$ SDK:
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
typedef enum _FILE_INFO_BY_HANDLE_CLASS {
FileBasicInfo,
FileStandardInfo,
FileNameInfo,
FileRenameInfo,
FileDispositionInfo,
FileAllocationInfo,
FileEndOfFileInfo,
FileStreamInfo,
FileCompressionInfo,
FileAttributeTagInfo,
FileIdBothDirectoryInfo,
FileIdBothDirectoryRestartInfo,
FileIoPriorityHintInfo,
FileRemoteProtocolInfo,
FileFullDirectoryInfo,
FileFullDirectoryRestartInfo,
#if (NTDDI_VERSION >= NTDDI_WIN8)
FileStorageInfo,
FileAlignmentInfo,
FileIdInfo,
FileIdExtdDirectoryInfo,
FileIdExtdDirectoryRestartInfo,
#endif
#if (NTDDI_VERSION >= NTDDI_WIN10_RS1)
FileDispositionInfoEx,
FileRenameInfoEx,
#endif
#if (NTDDI_VERSION >= NTDDI_WIN10_19H1)
FileCaseSensitiveInfo,
FileNormalizedNameInfo,
#endif
MaximumFileInfoByHandleClass
} FILE_INFO_BY_HANDLE_CLASS, *PFILE_INFO_BY_HANDLE_CLASS;
#endif
Anton Lavrentiev
Contractor NIH/NLM/NCBI
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-05-15 14:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-11 11:30 Wrong value for |FileNormalizedNameInfo| (|24| vs. |48|) in Cygwin 3.6 /usr/include Roland Mainz
2024-05-11 16:17 ` Brian Inglis
2024-05-15 10:12 ` Roland Mainz
2024-05-15 14:45 ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
[not found] ` <DM8PR09MB7095035B890E1D7401D8DBB6A5E22@DM8PR09MB7095.namprd09.prod.outlook.com>
2024-05-15 14:14 ` Brian Inglis
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).