Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

[C++] How do I know FILE_FLAG_OVERLAPPED has been set in the file handle ?

Posted on 2013-12-29
2
Medium Priority
?
1,043 Views
Last Modified: 2013-12-30
Hello Experts,

I want to know FILE_FLAG_OVERLAPPED flag has been set in the file handle.

I got a file handle from DuplicateHandle() and that is HANDLE_TYPE_FILE and
my target file name.
I want to read that file by using duplicated handle, but I don't know
FILE_FLAG_OVERLAPPED flag has been set or not into that file handle.

If I know that flag information, I can call ReadFile() with/without OVERLAPPED
structure pointer.

Any hints welcome.

Windows 7 32bit
C++Builder

Nobuo Miwa
0
Comment
Question by:NobMiwa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 39747239
>>I want to read that file by using duplicated handle, but I don't know
>>FILE_FLAG_OVERLAPPED flag has been set or not into that file handle.

>>If I know that flag information, I can call ReadFile() with/without OVERLAPPED
>>structure pointer.

It's actually quite easy: Even though there is no documented means to find out if that flag has been set, you can deal with this in both ways

- just don't pass an OVERLAPPED pointer, use NULL instead. The operation will be carried out synchronously (setting that flag does not mean you have to use the HANDLE in any async calls)

- pass an OVERLAPPED pointer anyway. If the flag was not set, the operation will be carried out synchronously. If it was set, use the means of async I/O.

A little more here: http://blogs.msdn.com/b/oldnewthing/archive/2012/04/05/10290954.aspx ("You can use an OVERLAPPED structure with synchronous I/O, too")
0
 

Author Closing Comment

by:NobMiwa
ID: 39747343
Great thanks !
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question