DeviceIOControl failure

soya protein <[email protected]> Sat, 27 Aug 2005 11:15:39 +0200
Newsgroups gmane.comp.lang.delphi.jedi
Message-ID <[email protected]>
 I'm trying to get this block of code to work, but i don't know why it fails.
It's a direct conversion.

------CODE------
const
  ndisuio_device : array[0..16] of Char = '\\\\.\\\\Ndisuio'#0;
begin
  file_handle := CreateFile (ndisuio_device,
                             GENERIC_READ or GENERIC_WRITE,
                             0,
                             nil,
                             OPEN_EXISTING,
                             FILE_ATTRIBUTE_NORMAL,
                             INVALID_HANDLE_VALUE);
  if (file_handle <> 0) then
    last_status := DeviceIoControl (file_handle,
                                    IOCTL_NDISUIO_BIND_WAIT,
                                    nil,
                                    0,
                                    nil,
                                    0,
                                    bytes_returned,
                                    nil);
end;
------CODE------


 CreateFile() function goes through fine (i get non-null handle), but
DeviceIOControl() still throws error. GetLastError() shows number 6,
which should correspond to ERROR_INVALID_HANDLE.

 What am i doing wrong ?

-- 
Best regards,
 soya                          mailto:[email protected]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/i7folB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/Delphi-JEDI/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/