<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=iso-8859-1" http-equiv="Content-Type">
  <style>
     pre { 
  white-space: pre-wrap;       /* css-3 */
  white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
  white-space: -pre-wrap;      /* Opera 4-6 */
  white-space: -o-pre-wrap;    /* Opera 7 */
  word-wrap: break-word;       /* Internet Explorer 5.5+ */
}

  </style>
</head>
<body bgcolor="#ffffff" text="#000000">

<div>
Thanks for the comments.<br />Not sure i understand them though.<br /><br />The whole point of the test was to test what happens when you use a wrong handle. The actual bug i fixed was that it was possible to for programs to send invalid handles to IoControl. Cygwin was infact sending handles to ntdll.dll which originated from GetStdHandle().<br /><br />So i think using this API for testing is relevant, as the point of the test is to verify that handles of the completely wrong class are rejected, and not just &quot;bad handles&quot;.<br /><br />Thanks,<br /><br />/pedro<br /><br /> ----- Original meddelelse -----<br /><blockquote class="webmail-quote" style="padding-right: 0px; padding-left: 5px; margin-left: 5px; border-left: #000000 2px solid; margin-right: 0px"><b>Fra:</b> Alexandre Julliard &lt;julliard@winehq.org&gt;<br /><b>Til:</b> Peter Dons Tychsen &lt;donpedro@tdcadsl.dk&gt;<br /><b>Cc:</b> wine-devel@winehq.org<br /><b>Dato:</b> Tir, 08. sep 2009 22:25<br /><b>Emne:</b> Re: ntdll: Do not accept device control requests with invalid and/or incompatible handles<br /><br /> Peter Dons Tychsen &lt;donpedro@tdcadsl.dk&gt; writes:<br /><br />&gt; +static void test_device_control(void)<br />&gt; +{<br />&gt; + IO_STATUS_BLOCK io;<br />&gt; + NTSTATUS status;<br />&gt; +<br />&gt; + /* Try using a bugus handle for I/O control */<br />&gt; + HANDLE handle = (HANDLE)0xdeadbeef;<br />&gt; + status = pNtDeviceIoControlFile(handle, NULL, NULL, NULL, &amp;io, IOCTL_SERIAL_SET_BAUD_RATE, NULL, 0, NULL, 0);<br />&gt; + ok(status == STATUS_INVALID_HANDLE, &quot;Expected %08X, got %08X\n&quot;, STATUS_INVALID_HANDLE, status);<br />&gt; +<br />&gt; + /* Try using an valid (but wrong) handle for I/O control */<br />&gt; + handle = GetStdHandle(STD_INPUT_HANDLE);<br />&gt; + status = pNtDeviceIoControlFile(handle, NULL, NULL, NULL, &amp;io, IOCTL_SERIAL_SET_BAUD_RATE, NULL, 0, NULL, 0);<br />&gt; + ok(status == STATUS_INVALID_HANDLE, &quot;Expected %08X, got %08X\n&quot;, STATUS_INVALID_HANDLE, status);<br /><br />GetStdHandle returns a console handle which is not a valid ntdll handle,<br />so you are not testing what you think.<br /><br />-- <br />Alexandre Julliard<br />julliard@winehq.org<br /></blockquote>
</div>




</body>
</html>