阅读:914回复:1
CREATEFILE()参数dwFlagsAndAttributes的问题
CreateFile()函数的原形是:
HANDLE CreateFile( LPCTSTR lpFileName, // pointer to name of the file DWORD dwDesiredAccess, // access (read-write) mode DWORD dwShareMode, // share mode LPSECURITY_ATTRIBUTES lpSecurityAttributes, // pointer to security attributes DWORD dwCreationDisposition, // how to create DWORD dwFlagsAndAttributes, // file attributes HANDLE hTemplateFile // handle to file with attributes to // copy ); 我在打开驱动文件时,dwFlagsAndAttributes参数定义为FILE_ATTRIBUTE_NORMAL,此时驱动是同步打开还是异步? 我想应该是同步打开的,因为并没有指定FILE_FLAG_OVERLAPPED,可问题是,在写操作时用WriteFile(hDevice, &buf, 1, &nWritten, &lapp);同时使用::WaitForSingleObject(lapp.hEvent,INFINITE),一样可以等到lapp.hevent事件,是不是同步打开的驱动文件,读写完成时也会产生一个事件呢? |
|
|
沙发#
发布于:2003-01-15 17:04
读写完成时不会产生一个事件
|
|