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