Cygwin 1.1 Acces Violation in NTDLL.DLL

Robert Rose rrose@mass.co.uk
Fri Jun 2 05:07:00 GMT 2000


Hello anybody who can help,
 
CygwinDLL version 1.1 and version B20.1
 
Further to my email on 26-May-00 I have tried a different 
approach. However, I seem to get similar results.
 
My main problem is trying to link Visual C++ compatible C 
libraries developed by National Instruments with a GNU compiled dll which 
uses the Cygwin Win API dll (version B20.1).
 
I tried the 'How do I link against .lib files' appraoch but 
that did not work because I could not extract all the objects out of all the 
libraries. One of the libraries seem to have several references to a single 
dll. I can only seem to extract the first reference.
 
Having satisfied myself that GNU would understand the NI .lib 
files if I  simply by renaming them. I tried this approach. It linked, 
however, when I tried to execute the program, it fell over before the first 
line of code with a STATUS_ACCESS_VIOLATION.
 
Beacause the NI libraries are extensive I tried a different 
approach. This was to explicitly link to the GNU dll in a Visual C++ 
developed executable. This was possible because the dll had a C++ class 
interface. I cannot explicitly link to it without some knowledge of the 
class, in order to type cast the class methods into method 
pointers.
 
My next approach was to provide a further GNU developed 
wrapper dll which had a pure C style interface to the other dll. I could then 
expilicitly link to this in my Visual C++ executable.
 
This works fine until I actually try to invoke a function 
pointer retunred by GetProcAddress. It complains about an ACCESS VIOLATION 
to the NTDLL.DLL. This dll is called by the Cygwin1.dll which is being called 
by my wrapper dll.
 
I have written a simple program in GNU which links to my 
wrapper dll implicitly. This hangs when trying to invoke the first function 
in the dll.
 
I have also written a simple program which includes the dll 
object in its build. It also hangs when trying to access the first function 
call in the dll object.
 
I guess these are hanging for the same reason.
 
I have provided the strace output for each. The dll test 
program strace output is named dll_strace.txt and the non dll version is 
called main_strace.txt.
 
I have also provided the cygcheck output for each. Similarly 
named.
 
I linked all these programs with Cygwin 1.1.0, which appears 
to use a later version of the Cygwin1.dll to the dll I am providing a C 
wrapper for.
 
I would prefer to be able to explicitly link the GNU wrapper 
dll to a Visual C++ program. This appears to me to be the simplest solution, 
if only I could find it.
 
Could there be a bug with the new Cygwin1.dll and its 
interaction with the NTDLL.DLL. Would it be best to compile all the dll's and 
the executable with the same version of the Cygwin1.dll.
I am going to download B20.1 full.exe and I will get back to 
you.
 
If anyone can help then I would be very grateful.
 
Cheers,
 
Robert Rose.
***********************************************************************
 
This mail is intended only for the addressee shown 
above. It may contain information that is privileged, confidential or 
otherwise protected from disclosure.  Any review, publication, 
dissemination, copying or use of this mail or its contents by persons other 
than the addressee is strictly prohibited, unless prior authorisation is 
received from MASS. If you have recieved this mail in error please notify 
MASS immediately by telephone and delete the mail returning any 
hard copies in the post to MASS at the address below.
 
Mass Consultants Ltd, Grove House, Rampley Lane, Little 
Paxton, St Neots, Cambs, PE19 4EL  Tel: 01480 
222600
**********************************************
Program name: c:\working\vmetrodemo\mdrdll\mdrdll\bin\cMdrApi.exe
App version:  1001.0, api: 0.17
DLL version:  1001.0, api: 0.17
DLL build:    2000-03-01 00:15:19
OS version:   Windows NT-4.0
Date/Time:    2000-06-02 10:50:05
**********************************************
 3952    6808 [main] cMdrApi 1016 environ_init: !C:=C:\WINNT\Profiles\rrose.000\Desktop
  684    7492 [main] cMdrApi 1016 environ_init: COMPUTERNAME=MASSTOR1
 1065    8557 [main] cMdrApi 1016 environ_init: COMSPEC=C:\WINNT\system32\cmd.exe
  880    9437 [main] cMdrApi 1016 environ_init: HOMEDRIVE=C:
  614   10051 [main] cMdrApi 1016 environ_init: HOMEPATH=\
  568   10619 [main] cMdrApi 1016 environ_init: HOSTNAME=MASSTOR1
  556   11175 [main] cMdrApi 1016 environ_init: HOSTTYPE=i686
  573   11748 [main] cMdrApi 1016 environ_init: LOGONSERVER=\\HOMER
  605   12353 [main] cMdrApi 1016 environ_init: MACHTYPE=i686-pc-cygwin
  558   12911 [main] cMdrApi 1016 environ_init: MAKE_MODE=unix
  558   13469 [main] cMdrApi 1016 environ_init: NUMBER_OF_PROCESSORS=1
  606   14075 [main] cMdrApi 1016 environ_init: OLDPWD=/cygdrive/c/WINNT/Profiles/rrose.000/Desktop
  579   14654 [main] cMdrApi 1016 environ_init: OS2LIBPATH=C:\WINNT\system32\os2\dll;
  577   15231 [main] cMdrApi 1016 environ_init: OS=Windows_NT
  589   15820 [main] cMdrApi 1016 environ_init: OSTYPE=cygwin
  578   16398 [main] cMdrApi 1016 getwinenv: can't set native for PATH= since no environ yet
  649   17047 [main] cMdrApi 1016 mount_info::conv_to_posix_path: conv_to_posix_path (c:\CygwinGNU\bin, keep-rel)
  362   17409 [main] cMdrApi 1016 normalize_win32_path: c:\CygwinGNU\bin = normalize_win32_path (c:\CygwinGNU\bin)
  361   17770 [main] cMdrApi 1016 mount_info::conv_to_posix_path: /usr/bin = conv_to_posix_path (c:\CygwinGNU\bin)
  316   18086 [main] cMdrApi 1016 mount_info::conv_to_posix_path: conv_to_posix_path (c:\CygwinGNU\usr\local\bin, keep-rel)
  316   18402 [main] cMdrApi 1016 normalize_win32_path: c:\CygwinGNU\usr\local\bin = normalize_win32_path (c:\CygwinGNU\usr\local\bin)
  323   18725 [main] cMdrApi 1016 mount_info::conv_to_posix_path: /usr/local/bin = conv_to_posix_path (c:\CygwinGNU\usr\local\bin)
  315   19040 [main] cMdrApi 1016 mount_info::conv_to_posix_path: conv_to_posix_path (C:\Program Files\Reflection, keep-rel)
  317   19357 [main] cMdrApi 1016 normalize_win32_path: C:\Program Files\Reflection = normalize_win32_path (C:\Program Files\Reflection)
  767   20124 [main] cMdrApi 1016 mount_info::conv_to_posix_path: /cygdrive/c/Program Files/Reflection = conv_to_posix_path (C:\Program Files\Reflection)
  417   20541 [main] cMdrApi 1016 mount_info::conv_to_posix_path: conv_to_posix_path (C:\Program Files\ReflectionDemo, keep-rel)
  323   20864 [main] cMdrApi 1016 normalize_win32_path: C:\Program Files\ReflectionDemo = normalize_win32_path (C:\Program Files\ReflectionDemo)
  329   21193 [main] cMdrApi 1016 mount_info::conv_to_posix_path: /cygdrive/c/Program Files/ReflectionDemo = conv_to_posix_path (C:\Program Files\ReflectionDemo)
  325   21518 [main] cMdrApi 1016 mount_info::conv_to_posix_path: conv_to_posix_path (C:\WINNT\system32, keep-rel)
  314   21832 [main] cMdrApi 1016 normalize_win32_path: C:\WINNT\system32 = normalize_win32_path (C:\WINNT\system32)
  336   22168 [main] cMdrApi 1016 mount_info::conv_to_posix_path: /cygdrive/c/WINNT/system32 = conv_to_posix_path (C:\WINNT\system32)
  317   22485 [main] cMdrApi 1016 mount_info::conv_to_posix_path: conv_to_posix_path (C:\WINNT, keep-rel)
  310   22795 [main] cMdrApi 1016 normalize_win32_path: C:\WINNT = normalize_win32_path (C:\WINNT)
  314   23109 [main] cMdrApi 1016 mount_info::conv_to_posix_path: /cygdrive/c/WINNT = conv_to_posix_path (C:\WINNT)
  312   23421 [main] cMdrApi 1016 mount_info::conv_to_posix_path: conv_to_posix_path (C:\Enabler\Runtime, keep-rel)
  313   23734 [main] cMdrApi 1016 normalize_win32_path: C:\Enabler\Runtime = normalize_win32_path (C:\Enabler\Runtime)
  318   24052 [main] cMdrApi 1016 mount_info::conv_to_posix_path: /cygdrive/c/Enabler/Runtime = conv_to_posix_path (C:\Enabler\Runtime)
  350   24402 [main] cMdrApi 1016 mount_info::conv_to_posix_path: conv_to_posix_path (c:\measurementstudiodemo\VXIPNP\WINNT\BIN, keep-rel)
  321   24723 [main] cMdrApi 1016 normalize_win32_path: c:\measurementstudiodemo\VXIPNP\WINNT\BIN = normalize_win32_path (c:\measurementstudiodemo\VXIPNP\WINNT\BIN)
  331   25054 [main] cMdrApi 1016 mount_info::conv_to_posix_path: /cygdrive/c/measurementstudiodemo/VXIPNP/WINNT/BIN = conv_to_posix_path (c:\measurementstudiodemo\VXIPNP\WINNT\BIN)
  902   25956 [main] cMdrApi 1016 win_env::add_cache: posix /usr/bin:/usr/local/bin:/cygdrive/c/Program Files/Reflection:/cygdrive/c/Program Files/ReflectionDemo:/cygdrive/c/WINNT/system32:/cygdrive/c/WINNT:/cygdrive/c/Enabler/Runtime:/cygdrive/c/measurementstudiodemo/VXIPNP/WINNT/BIN
  339   26295 [main] cMdrApi 1016 win_env::add_cache: native PATH=c:\CygwinGNU\bin;c:\CygwinGNU\usr\local\bin;C:\Program Files\Reflection;C:\Program Files\ReflectionDemo;C:\WINNT\system32;C:\WINNT;C:\Enabler\Runtime;c:\measurementstudiodemo\VXIPNP\WINNT\BIN
  333   26628 [main] cMdrApi 1016 posify: env var converted to PATH=/usr/bin:/usr/local/bin:/cygdrive/c/Program Files/Reflection:/cygdrive/c/Program Files/ReflectionDemo:/cygdrive/c/WINNT/system32:/cygdrive/c/WINNT:/cygdrive/c/Enabler/Runtime:/cygdrive/c/measurementstudiodemo/VXIPNP/WINNT/BIN
  610   27238 [main] cMdrApi 1016 environ_init: PATH=/usr/bin:/usr/local/bin:/cygdrive/c/Program Files/Reflection:/cygdrive/c/Program Files/ReflectionDemo:/cygdrive/c/WINNT/system32:/cygdrive/c/WINNT:/cygdrive/c/Enabler/Runtime:/cygdrive/c/measurementstudiodemo/VXIPNP/WINNT/BIN
  633   27871 [main] cMdrApi 1016 environ_init: PATHEXT=.COM;.EXE;.BAT;.CMD
  579   28450 [main] cMdrApi 1016 environ_init: PROCESSOR_ARCHITECTURE=x86
  575   29025 [main] cMdrApi 1016 environ_init: PROCESSOR_IDENTIFIER=x86 Family 6 Model 3 Stepping 4, GenuineIntel
  600   29625 [main] cMdrApi 1016 environ_init: PROCESSOR_LEVEL=6
  573   30198 [main] cMdrApi 1016 environ_init: PROCESSOR_REVISION=0304
  582   30780 [main] cMdrApi 1016 environ_init: PROMPT=$P$G
  575   31355 [main] cMdrApi 1016 environ_init: PWD=/cygdrive/c/working/vmetrodemo/mdrdll/mdrdll/bin
  578   31933 [main] cMdrApi 1016 environ_init: SHELL=/bin/sh
  574   32507 [main] cMdrApi 1016 environ_init: SHLVL=1
  587   33094 [main] cMdrApi 1016 environ_init: SYSTEMDRIVE=C:
  574   33668 [main] cMdrApi 1016 environ_init: SYSTEMROOT=C:\WINNT
  573   34241 [main] cMdrApi 1016 environ_init: TEMP=C:\TEMP
  590   34831 [main] cMdrApi 1016 environ_init: TERM=cygwin
  572   35403 [main] cMdrApi 1016 environ_init: TMP=C:\TEMP
  574   35977 [main] cMdrApi 1016 environ_init: USERDOMAIN=SWDEVSECRET
  588   36565 [main] cMdrApi 1016 environ_init: USERNAME=rrose
  575   37140 [main] cMdrApi 1016 environ_init: USERPROFILE=C:\WINNT\Profiles\rrose.000
  578   37718 [main] cMdrApi 1016 environ_init: VXIPNPPATH=c:\measurementstudiodemo\VXIPNP
  594   38312 [main] cMdrApi 1016 environ_init: WINDIR=C:\WINNT
  573   38885 [main] cMdrApi 1016 environ_init: _=/usr/bin/strace
  444   39329 [main] cMdrApi 1016 pinfo_init: pid 1016, pgid 1016
 1157   40486 [main] cMdrApi 1016 hinfo::extend: size 32, fds 0xA040918
  837   41323 [main] cMdrApi 1016 sigproc_init: process/signal handling enabled(1)
 1337   42660 [main] cMdrApi 1016 hinfo::build_fhandler: /dev/conin - cb 128, fd 0, fh 0xA0409A0
  335   42995 [main] cMdrApi 1016 fhandler_base::set_io_handle: set handle to 0xB
  330   43325 [main] cMdrApi 1016 fhandler_base::init: created new fhandler_base for handle 0xB
  406   43731 [main] cMdrApi 1016 open_shared: name (null), shared 0x14040000, h 0x10
  357   44088 [main] cMdrApi 1016 fhandler_base::set_io_handle: set handle to 0xFFFFFFFF
 1220   45308 [main] cMdrApi 1016 fhandler_base::set_io_handle: set handle to 0xF
  499   45807 [main] cMdrApi 1016 fhandler_termios::set_ctty: attached tty1073741824 sid 1016, pid 1016, tty->pgid 1016, tty->sid 1016
  333   46140 [main] cMdrApi 1016 fhandler_termios::set_ctty: resetting tty1073741824 sid.  Was 1016, now 1016.  pgid was 1016, now 1016.
  377   46517 [main] cMdrApi 1016 fhandler_console::open: opened conin$ 0xF, conout$ 0x13
  408   46925 [main] cMdrApi 1016 fhandler_console::output_tcsetattr: 0 = tcsetattr (,14040018) (ENABLE FLAGS 3) (lflag 107 oflag 9)
  328   47253 [main] cMdrApi 1016 hinfo::init_std_file_from_handle: fd 0, handle 0xB
 1549   48802 [sig] cMdrApi 1016 wait_sig: sigcatch_nonmain 0x4C
  367   49169 [sig] cMdrApi 1016 wait_sig: Ready.  dwProcessid 197
13422   62591 [main] cMdrApi 1016 hinfo::build_fhandler: some disk file - cb 64, fd 1, fh 0xA040AB8
  357   62948 [main] cMdrApi 1016 fhandler_base::set_io_handle: set handle to 0x50
  326   63274 [main] cMdrApi 1016 fhandler_base::init: created new fhandler_base for handle 0x50
  328   63602 [main] cMdrApi 1016 hinfo::init_std_file_from_handle: fd 1, handle 0x50
 1261   64863 [main] cMdrApi 1016 hinfo::build_fhandler: /dev/conout - cb 128, fd 2, fh 0xA040BA0
  325   65188 [main] cMdrApi 1016 fhandler_base::set_io_handle: set handle to 0x17
  309   65497 [main] cMdrApi 1016 fhandler_base::init: created new fhandler_base for handle 0x17
  311   65808 [main] cMdrApi 1016 fhandler_base::set_io_handle: set handle to 0xFFFFFFFF
  421   66229 [main] cMdrApi 1016 fhandler_base::set_io_handle: set handle to 0xB
  485   66714 [main] cMdrApi 1016 fhandler_termios::set_ctty: attached tty1073741824 sid 1016, pid 1016, tty->pgid 1016, tty->sid 1016
  345   67059 [main] cMdrApi 1016 fhandler_termios::set_ctty: resetting tty1073741824 sid.  Was 1016, now 1016.  pgid was 1016, now 1016.
  339   67398 [main] cMdrApi 1016 fhandler_console::open: opened conin$ 0xB, conout$ 0x2B
  399   67797 [main] cMdrApi 1016 fhandler_console::output_tcsetattr: 0 = tcsetattr (,14040018) (ENABLE FLAGS 3) (lflag 107 oflag 9)
  341   68138 [main] cMdrApi 1016 hinfo::init_std_file_from_handle: fd 2, handle 0x17
  635   68773 [main] cMdrApi 1016 build_argv: argv[0] = 'cMdrApi'
  316   69089 [main] cMdrApi 1016 build_argv: argv[1] = '(null)'
  312   69401 [main] cMdrApi 1016 DllList::initAll: call to DllList::initAll
  409   69810 [main] cMdrApi 1016 dll_crt0_1: user_data->main 0x4010E0
  383   70193 [main] cMdrApi 1016 sig_send: pid 1016, signal -2, its_me 1
  386   70579 [main] cMdrApi 1016 sig_send: Waiting for thiscomplete 0x28
  308   70887 [sig] cMdrApi 1016 wait_sig: awake
  313   71200 [sig] cMdrApi 1016 wait_sig: processing signal -2
  341   71541 [sig] cMdrApi 1016 wait_sig: looping
  349   71890 [main] cMdrApi 1016 sig_send: returning 0 from sending signal -2
17104   88994 [main] cMdrApi 1016 internal_getlogin: Domain: SWDEVSECRET
  442   89436 [main] cMdrApi 1016 internal_getlogin: Logon Server: HOMER
  324   89760 [main] cMdrApi 1016 internal_getlogin: Windows Username: rrose
  409   90169 [main] cMdrApi 1016 lookup_name: name  : rrose
12221  102390 [main] cMdrApi 1016 lookup_name: sid : [1002]
  393  102783 [main] cMdrApi 1016 internal_getlogin: Cygwins Username: rrose
  392  103175 [main] cMdrApi 1016 _open: open (/etc/passwd, 0x0)
 5665  108840 [main] cMdrApi 1016 hinfo::build_fhandler: some disk file - cb 64, fd 3, fh 0xA040E58
  356  109196 [main] cMdrApi 1016 fhandler_disk_file::open: (/etc/passwd, 0x0)
  357  109553 [main] cMdrApi 1016 mount_info::conv_to_win32_path: conv_to_win32_path (/etc/passwd)
  334  109887 [main] cMdrApi 1016 normalize_posix_path: /etc/passwd = normalize_posix_path (/etc/passwd)
  348  110235 [main] cMdrApi 1016 mount_info::conv_to_win32_path: c:\CygwinGNU\etc\passwd(rel), c:\CygwinGNU\etc\passwd(abs) 0x2(flags) = conv_to_win32_path (/etc/passwd)
  664  110899 [main] cMdrApi 1016 symlink_check_one: GetFileAttributesA (c:\CygwinGNU\etc\passwd) failed
  335  111234 [main] cMdrApi 1016 ../../../../src/winsup/cygwin/path.cc:2134 seterrno: 2 (FILE_NOT_FOUND) -> 2
  384  111618 [main] cMdrApi 1016 symlink_check_one: 0 = symlink_check_one (c:\CygwinGNU\etc\passwd, 0x240F5E5, 260) (0x2)
  520  112138 [main] cMdrApi 1016 symlink_check_one: 0 = symlink_check_one (c:\CygwinGNU\etc, 0x240F5E5, 260) (0x240F53C)
 1428  113566 [main] cMdrApi 1016 fhandler_base::open: (c:\CygwinGNU\etc\passwd, 0x0)
  552  114118 [main] cMdrApi 1016 fhandler_base::open: -1 = CreateFileA (c:\CygwinGNU\etc\passwd, 0x80000000, 0x7, 0x61085940, 0x3, 0x80, 0)
  364  114482 [main] cMdrApi 1016 ../../../../src/winsup/cygwin/fhandler.cc:369 seterrno: 2 (FILE_NOT_FOUND) -> 2
  333  114815 [main] cMdrApi 1016 fhandler_base::open: 0 = fhandler_base::open (c:\CygwinGNU\etc\passwd, 0x0)
  333  115148 [main] cMdrApi 1016 fhandler_disk_file::open: 0 = fhandler_disk_file::open (c:\CygwinGNU\etc\passwd, 0x0)
 2870  118018 [main] cMdrApi 1016 _open: -1 = open (/etc/passwd, 0x0)
  325  118343 [main] cMdrApi 1016 read_etc_passwd: Emulating /etc/passwd
 3643  121986 [main] cMdrApi 1016 _open: open (/etc/group, 0x0)
 5735  127721 [main] cMdrApi 1016 hinfo::build_fhandler: some disk file - cb 64, fd 3, fh 0xA040FC0
  336  128057 [main] cMdrApi 1016 fhandler_disk_file::open: (/etc/group, 0x0)
  328  128385 [main] cMdrApi 1016 mount_info::conv_to_win32_path: conv_to_win32_path (/etc/group)
  317  128702 [main] cMdrApi 1016 normalize_posix_path: /etc/group = normalize_posix_path (/etc/group)
  328  129030 [main] cMdrApi 1016 mount_info::conv_to_win32_path: c:\CygwinGNU\etc\group(rel), c:\CygwinGNU\etc\group(abs) 0x2(flags) = conv_to_win32_path (/etc/group)
  558  129588 [main] cMdrApi 1016 symlink_check_one: GetFileAttributesA (c:\CygwinGNU\etc\group) failed
  346  129934 [main] cMdrApi 1016 ../../../../src/winsup/cygwin/path.cc:2134 seterrno: 2 (FILE_NOT_FOUND) -> 2
  333  130267 [main] cMdrApi 1016 symlink_check_one: 0 = symlink_check_one (c:\CygwinGNU\etc\group, 0x240F8B5, 260) (0x2)
  524  130791 [main] cMdrApi 1016 symlink_check_one: 0 = symlink_check_one (c:\CygwinGNU\etc, 0x240F8B5, 260) (0x240F604)
 1324  132115 [main] cMdrApi 1016 fhandler_base::open: (c:\CygwinGNU\etc\group, 0x0)
  538  132653 [main] cMdrApi 1016 fhandler_base::open: -1 = CreateFileA (c:\CygwinGNU\etc\group, 0x80000000, 0x7, 0x61085940, 0x3, 0x80, 0)
  359  133012 [main] cMdrApi 1016 ../../../../src/winsup/cygwin/fhandler.cc:369 seterrno: 2 (FILE_NOT_FOUND) -> 2
  328  133340 [main] cMdrApi 1016 fhandler_base::open: 0 = fhandler_base::open (c:\CygwinGNU\etc\group, 0x0)
  316  133656 [main] cMdrApi 1016 fhandler_disk_file::open: 0 = fhandler_disk_file::open (c:\CygwinGNU\etc\group, 0x0)
 2848  136504 [main] cMdrApi 1016 _open: -1 = open (/etc/group, 0x0)
  322  136826 [main] cMdrApi 1016 read_etc_group: Emulating /etc/group
 6785  143611 [main] cMdrApi 1016 fhandler_disk_file::fstat: 1 = GetFileInformationByHandle (some disk file, 80)
  891  144502 [main] cMdrApi 1016 fhandler_disk_file::fstat: 0 = fstat (, 0x240FB54) st_atime=3937834D st_size=14848, st_mode=0x81A4, st_ino=0, sizeof=64
  357  144859 [main] cMdrApi 1016 _fstat: 0 = fstat (1, 240FB54)
 1421  146280 [main] cMdrApi 1016 _write: write (1, 0xA041088, 38)
Welcome to my little dll test program
  333  146613 [main] cMdrApi 1016 fhandler_base::write: after write, name some disk file, rpos 38
  331  146944 [main] cMdrApi 1016 _write: 38 = write (1, 0xA041088, 38)


More information about the Cygwin mailing list