Hello, I have windows device driver which creates a symbolic link for
the path ‘\.\MyDevice’. In C I can then use CreateFile() to open this
device, e.g.
—[c
snippet]------------------------------------------------------------------
handle = CreateFile( “\\.\MyDevice”, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
WriteFile( handle, data, len, &written, NULL );
CloseHandle( handle );
—[c
snippet]------------------------------------------------------------------
However in Ruby, I should be able to simple use something like:
—[ruby
snippet]---------------------------------------------------------------
handle = open( “\\.\MyDevice”, File::RDWR )
handle.syswrite( data )
handle.close
—[ruby
snippet]---------------------------------------------------------------
but it does not work and segfaults the ruby interpreter during the open!
Can anybody please help as to what I am doing wrong. How do you open a
file handle to a device in windows?
Thanks!