Boost logo

Boost Users :

Subject: Re: [Boost-users] Exception on windows::stream_handle!
From: Lloyd (lloyd_at_[hidden])
Date: 2010-05-28 01:30:18


I would like to post the reason for this exception, may it will be useful for someone else :)

The create file was not created with the "Overlapped IO attribute"

It should look like this

CreateFile(("MyFile",GENERIC_WRITE,0,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OVERLAPPED,NULL);

  ----- Original Message -----
  From: Lloyd
  To: boost-users_at_[hidden]
  Sent: Wednesday, May 26, 2010 2:35 PM
  Subject: Exception on windows::stream_handle!

  Hello,

  We are trying to create a "windows::stream_handle" from a native Windows HANDLE. But it throws an exception with "The parameter is incorrect". The code is given below. What could be the reason? (Another IOservice is already running in the system)

  HANDLE FileHandle=CreateFile("MyFile",FILE_WRITE_DATA,0,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);

  if(FileHandle==INVALID_HANDLE_VALUE)

  {

  return;

  }

  try

  {

  io_service ios;

  windows::stream_handle StreamHandle(ios,FileHandle);

  ...

  ...

  }

  catch(std::exception& e)

  {

  Log(e.what()); //The parameter is incorrect

  }

  Thanks,

    Lloyd

______________________________________
Scanned and protected by Email scanner



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net