views:

17

answers:

0

I am trying to create a Stream_Handle for a harddisk device. Here is the piece of code.

ntStatus = NtCreateFile(source, DesiredAccess, &oa, &ios, NULL, FileAttributes, ShareAccess, 
              CreateDisposition, CreateOptions, NULL, 0);

//Create ReadStream
  boost::asio::io_service io_service; 
  boost::asio::windows::stream_handle readStream(io_service);
  readStream.assign(source);

The NtCreateFile is returning success. When I run the program, the statement

readStream.assign(source)

throws an the following run time error - "The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."

May I know the correct way of usage for assign function or any other better way to read the file.

Thanks