1

の使用について 1 つ質問があります。CreateFile

私のコードシーケンスは次のとおりです。

CreateFile to get handle A
.....
Close handle A
GetDiskFreeSpace  // if handle A is not closed, this API fails...
.....         
CreateFile to get handle B  // for File writing Ex. f:\test.dat
WriteFile via handle B      // write file
Close handle B                        
.....
CreateFile to get handle C  // where handle C and A points to the same target !

私の発見は次のとおりです。それまでに遅延がない場合、「エラー:5アクセスが拒否されました」"CreateFile to get handle C"というエラーメッセージが表示されました

しかし、その前に 1 秒の遅延 (例: Sleep(1000)) を追加すると、すべて問題なく、ハンドル C が有効になります。

誰かコメントをくれませんか?

@ プラットフォーム: VS2008、Win7、テスト ドライブは USB フラッシュ ペン ドライブ

4

0 に答える 0