Re: cygwin application hangs on closing console

2024-05-15 Thread Brian Inglis via Cygwin

On 2024-05-15 09:48, Johannes Khoshnazar-Thoma via Cygwin wrote:

Hi again,

Am 15.05.24 um 17:37 schrieb Johannes Khoshnazar-Thoma:

Hi again,

Am 23.04.24 um 12:26 schrieb Takashi Yano:

Thanks for the report. Could you please test cygwin1.dll 3.5.3-1
wihch is the latest cygwin release?



We retried the tests with cygwin1.dll 3.5.3-1 and it looks like
the issue is still there. Here's an excerpt from the gdb debug
session:


Sorry somehow the formatting got messed up I try again:

(gdb) info thread
   Id   Target Id Frame
* 1    Thread 0x11cc 0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
   2    Thread 0x8ec  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
   3    Thread 0x55c  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
   4    Thread 0x131c 0x7ffe579d95f4 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
   5    Thread 0x9b8  0x7ffe579d95f4 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll

(gdb) thread 1
[Switching to thread 1 (Thread 0x11cc)]
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll

(gdb) bt
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffe54156d1f in WaitForSingleObjectEx () from 
C:\src\dlls-syms\KERNELBASE.dll\660F5EEC21e000\KERNELBASE.dll
#2  0x7ffe4a2033a0 in fhandler_console::close (this=0x89030) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/fhandler/console.cc:1914
#3  0x7ffe4a1f6ce7 in fhandler_base::close_with_arch (this=0x89030) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/fhandler/base.cc:1288
#4  0x7ffe4a26a4cd in init_cygheap::close_ctty (this=0x8) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/mm/cygheap.cc:135
#5  0x7ffe4a1c7c4e in close_all_files (norelease=norelease@entry=false) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/syscalls.cc:81
#6  0x7ffe4a146840 in do_exit (status=0) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1128
#7  0x7ffe4a1469f7 in _exit (n=) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1243
#8  0x7ffe4a2a4bb9 in exit (code=0) at 
/usr/src/debug/cygwin-3.5.3-1/newlib/libc/stdlib/exit.c:65
#9  0x7ffe4a1469e7 in cygwin_exit (n=5392) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1237
#10 0x7ffe4a14809a in dll_crt0_1 () at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1002
#11 0x7ffe4a145e08 in _cygtls::call2 (this=0x7ce00, func=0x7ffe4a146fb8 
, arg=0x0, buf=buf@entry=0x7cdf0) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:41
#12 0x7ffe4a145e86 in _cygtls::call (func=, arg=out>) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:28

#13 0x in ?? ()
(gdb) thread 2
[Switching to thread 2 (Thread 0x8ec)]
#0  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll

(gdb) bt
#0  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffe5415e704 in ReadFile () from 
C:\src\dlls-syms\KERNELBASE.dll\660F5EEC21e000\KERNELBASE.dll
#2  0x7ffe4a1bada6 in wait_sig () at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/sigproc.cc:1324
#3  0x7ffe4a144d5f in cygthread::callfunc (this=this@entry=0x7ffe4a335560 
, issimplestub=issimplestub@entry=false) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygthread.cc:48
#4  0x7ffe4a145270 in cygthread::stub (arg=arg@entry=0x7ffe4a335560 
) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygthread.cc:91
#5  0x7ffe4a145e08 in _cygtls::call2 (this=0xdbce00, func=0x7ffe4a1451ea 
, arg=0x7ffe4a335560 , buf=buf@entry=0xdbcd50) 
at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:41
#6  0x7ffe4a145e86 in _cygtls::call (func=, arg=out>) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:28
#7  0x7ffe84d4 in KERNEL32!BaseThreadInitThunk () from 
C:\src\dlls-syms\kernel32.dll\640993B0ad000\kernel32.dll
#8  0x7ffe57981791 in ntdll!RtlUserThreadStart () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll

#9  0x in ?? ()
(gdb) thread 3
[Switching to thread 3 (Thread 0x55c)]
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll

(gdb) bt
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffe54156d1f in WaitForSingleObjectEx () from 
C:\src\dlls-syms\KERNELBASE.dll\660F5EEC21e000\KERNELBASE.dll
#2  0x7ffe4a1452ab in cygthread::stub (arg=arg@entry=0x7ffe4a3355b8 
) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygthread.cc:112
#3  

Re: cygwin application hangs on closing console

2024-05-15 Thread Johannes Khoshnazar-Thoma via Cygwin

Hi again,

Am 15.05.24 um 17:37 schrieb Johannes Khoshnazar-Thoma:

Hi again,

Am 23.04.24 um 12:26 schrieb Takashi Yano:

Thanks for the report. Could you please test cygwin1.dll 3.5.3-1
wihch is the latest cygwin release?



We retried the tests with cygwin1.dll 3.5.3-1 and it looks like
the issue is still there. Here's an excerpt from the gdb debug
session:


Sorry somehow the formatting got messed up I try again:

(gdb) info thread
  Id   Target Id Frame
* 1Thread 0x11cc 0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  2Thread 0x8ec  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  3Thread 0x55c  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  4Thread 0x131c 0x7ffe579d95f4 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  5Thread 0x9b8  0x7ffe579d95f4 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) thread 1
[Switching to thread 1 (Thread 0x11cc)]
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) bt
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffe54156d1f in WaitForSingleObjectEx () from 
C:\src\dlls-syms\KERNELBASE.dll\660F5EEC21e000\KERNELBASE.dll
#2  0x7ffe4a2033a0 in fhandler_console::close (this=0x89030) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/fhandler/console.cc:1914
#3  0x7ffe4a1f6ce7 in fhandler_base::close_with_arch (this=0x89030) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/fhandler/base.cc:1288
#4  0x7ffe4a26a4cd in init_cygheap::close_ctty (this=0x8) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/mm/cygheap.cc:135
#5  0x7ffe4a1c7c4e in close_all_files (norelease=norelease@entry=false) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/syscalls.cc:81
#6  0x7ffe4a146840 in do_exit (status=0) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1128
#7  0x7ffe4a1469f7 in _exit (n=) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1243
#8  0x7ffe4a2a4bb9 in exit (code=0) at 
/usr/src/debug/cygwin-3.5.3-1/newlib/libc/stdlib/exit.c:65
#9  0x7ffe4a1469e7 in cygwin_exit (n=5392) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1237
#10 0x7ffe4a14809a in dll_crt0_1 () at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1002
#11 0x7ffe4a145e08 in _cygtls::call2 (this=0x7ce00, func=0x7ffe4a146fb8 
, arg=0x0, buf=buf@entry=0x7cdf0) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:41
#12 0x7ffe4a145e86 in _cygtls::call (func=, arg=) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:28
#13 0x in ?? ()
(gdb) thread 2
[Switching to thread 2 (Thread 0x8ec)]
#0  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) bt
#0  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffe5415e704 in ReadFile () from 
C:\src\dlls-syms\KERNELBASE.dll\660F5EEC21e000\KERNELBASE.dll
#2  0x7ffe4a1bada6 in wait_sig () at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/sigproc.cc:1324
#3  0x7ffe4a144d5f in cygthread::callfunc (this=this@entry=0x7ffe4a335560 
, issimplestub=issimplestub@entry=false) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygthread.cc:48
#4  0x7ffe4a145270 in cygthread::stub (arg=arg@entry=0x7ffe4a335560 
) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygthread.cc:91
#5  0x7ffe4a145e08 in _cygtls::call2 (this=0xdbce00, func=0x7ffe4a1451ea 
, arg=0x7ffe4a335560 , buf=buf@entry=0xdbcd50) 
at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:41
#6  0x7ffe4a145e86 in _cygtls::call (func=, arg=) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:28
#7  0x7ffe84d4 in KERNEL32!BaseThreadInitThunk () from 
C:\src\dlls-syms\kernel32.dll\640993B0ad000\kernel32.dll
#8  0x7ffe57981791 in ntdll!RtlUserThreadStart () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#9  0x in ?? ()
(gdb) thread 3
[Switching to thread 3 (Thread 0x55c)]
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) bt
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffe54156d1f in WaitForSingleObjectEx () from 
C:\src\dlls-syms\KERNELBASE.dll\660F5EEC21e000\KERNELBASE.dll
#2  0x7ffe4a1452ab in cygthread::stub (arg=arg@entry=0x7ffe4a3355b8 
) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygthread.cc:112
#3  0x7ffe4a145e08 in _cygtls::call2 (this=0x2aece00, func=0x7ffe4a1451ea 
, arg=0x7ffe4a3355b8 

Re: cygwin application hangs on closing console

2024-05-15 Thread Johannes Khoshnazar-Thoma via Cygwin

Hi again,

Am 23.04.24 um 12:26 schrieb Takashi Yano:

Thanks for the report. Could you please test cygwin1.dll 3.5.3-1
wihch is the latest cygwin release?



We retried the tests with cygwin1.dll 3.5.3-1 and it looks like
the issue is still there. Here's an excerpt from the gdb debug
session:

(gdb) info thread
  Id   Target Id Frame  

 * 
1Thread 0x11cc 0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  2Thread 0x8ec  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  3Thread 0x55c  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () 
from C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll

 4Thread 0x131c 0x7ffe579d95f4 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
  5Thread 0x9b8  0x7ffe579d95f4 in 
ntdll!ZwWaitForWorkViaWorkerFactory () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll 
  (gdb) thread 1
[Switching to thread 1 (Thread 0x11cc)] 

 #0 
 0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) bt
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffe54156d1f in WaitForSingleObjectEx () from 
C:\src\dlls-syms\KERNELBASE.dll\660F5EEC21e000\KERNELBASE.dll
#2  0x7ffe4a2033a0 in fhandler_console::close (this=0x89030) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/fhandler/console.cc:1914
#3  0x7ffe4a1f6ce7 in fhandler_base::close_with_arch (this=0x89030) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/fhandler/base.cc:1288
#4  0x7ffe4a26a4cd in init_cygheap::close_ctty (this=0x8) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/mm/cygheap.cc:135
#5  0x7ffe4a1c7c4e in close_all_files (norelease=norelease@entry=false) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/syscalls.cc:81
#6  0x7ffe4a146840 in do_exit (status=0) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1128
#7  0x7ffe4a1469f7 in _exit (n=) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1243
#8  0x7ffe4a2a4bb9 in exit (code=0) at 
/usr/src/debug/cygwin-3.5.3-1/newlib/libc/stdlib/exit.c:65
#9  0x7ffe4a1469e7 in cygwin_exit (n=5392) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1237
#10 0x7ffe4a14809a in dll_crt0_1 () at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/dcrt0.cc:1002
#11 0x7ffe4a145e08 in _cygtls::call2 (this=0x7ce00, func=0x7ffe4a146fb8 
, arg=0x0, buf=buf@entry=0x7cdf0) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:41
#12 0x7ffe4a145e86 in _cygtls::call (func=, arg=) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:28
#13 0x in ?? ()
(gdb) thread 2
[Switching to thread 2 (Thread 0x8ec)]
#0  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
(gdb) bt
#0  0x7ffe579d5ee4 in ntdll!ZwReadFile () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#1  0x7ffe5415e704 in ReadFile () from 
C:\src\dlls-syms\KERNELBASE.dll\660F5EEC21e000\KERNELBASE.dll
#2  0x7ffe4a1bada6 in wait_sig () at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/sigproc.cc:1324
#3  0x7ffe4a144d5f in cygthread::callfunc (this=this@entry=0x7ffe4a335560 
, issimplestub=issimplestub@entry=false) at 
/usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygthread.cc:48
#4  0x7ffe4a145270 in cygthread::stub (arg=arg@entry=0x7ffe4a335560 
) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygthread.cc:91
#5  0x7ffe4a145e08 in _cygtls::call2 (this=0xdbce00, func=0x7ffe4a1451ea 
, arg=0x7ffe4a335560 , buf=buf@entry=0xdbcd50) 
at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:41
#6  0x7ffe4a145e86 in _cygtls::call (func=, arg=) at /usr/src/debug/cygwin-3.5.3-1/winsup/cygwin/cygtls.cc:28
#7  0x7ffe84d4 in KERNEL32!BaseThreadInitThunk () from 
C:\src\dlls-syms\kernel32.dll\640993B0ad000\kernel32.dll
#8  0x7ffe57981791 in ntdll!RtlUserThreadStart () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll
#9  0x in ?? ()
(gdb) thread 3
[Switching to thread 3 (Thread 0x55c)]
#0  0x7ffe579d5ea4 in ntdll!ZwWaitForSingleObject () from 
C:\src\dlls-syms\ntdll.dll\6502806A1cf000\ntdll.dll

RE: [EXTERNAL] Re: Wrong value for |FileNormalizedNameInfo| (|24| vs. |48|) in Cygwin 3.6 /usr/include ...

2024-05-15 Thread Lavrentiev, Anton (NIH/NLM/NCBI) [C] via 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 >= 0x0A02
>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


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


Re: [EXTERNAL] Re: Wrong value for |FileNormalizedNameInfo| (|24| vs. |48|) in Cygwin 3.6 /usr/include ...

2024-05-15 Thread Brian Inglis via Cygwin

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

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


Re: Wrong value for |FileNormalizedNameInfo| (|24| vs. |48|) in Cygwin 3.6 /usr/include ...

2024-05-15 Thread Roland Mainz via Cygwin
On Sat, May 11, 2024 at 6:17 PM Brian Inglis via Cygwin
 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 
#include 
#include 
#include 

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 >= 0x0A02
   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==0x0A02|.

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.ma...@nrubsig.org
  \__\/\/__/  MPEG specialist, C&&& 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