我有一个Windows Mobile 6.5应用程序,试图监测一个更改档案。 如果我操作以下法典,那么我只收到关于临时档案变更的通知。
参考,Im 采用Windows Mobile 6.5 专业CEOS 5.2.23090.5.3.0。 而且,我与Windows Mobile 6.1专业 CEOS 5.2.21051.1.6.4有着同样的问题。
#include <vector>
int _tmain( int argc, _TCHAR* argv[] )
{
HANDLE change = ::FindFirstChangeNotification(
argv[ 1 ],
FALSE,
FILE_NOTIFY_CHANGE_CEGETINFO |
FILE_NOTIFY_CHANGE_LAST_WRITE |
FILE_NOTIFY_CHANGE_LAST_ACCESS |
FILE_NOTIFY_CHANGE_CREATION |
FILE_NOTIFY_CHANGE_ATTRIBUTES |
FILE_NOTIFY_CHANGE_SIZE );
if( INVALID_HANDLE_VALUE != change )
{
while( WAIT_OBJECT_0 == ::WaitForSingleObject( change, INFINITE ) )
{
NKDbgPrintfW( L"Change detected
" );
DWORD returned = 0;
DWORD available = 0;
if( ::CeGetFileNotificationInfo( change,
0,
NULL,
0,
&returned,
&available ) )
{
std::vector< BYTE > buffer( available );
if( ::CeGetFileNotificationInfo( change,
0,
&buffer.front(),
buffer.size(),
&returned,
&available ) )
{
BYTE* current = &buffer.front();
const FILE_NOTIFY_INFORMATION* info =
reinterpret_cast< const FILE_NOTIFY_INFORMATION* >( current );
for( current;
NULL != current && info->NextEntryOffset > 0;
current += info->NextEntryOffset )
{
info = reinterpret_cast< const FILE_NOTIFY_INFORMATION* >( current );
NKDbgPrintfW( L" %s: %#08x
", info->FileName, info->Action );
}
}
}
::FindNextChangeNotification( change );
}
::FindCloseChangeNotification( change );
}
return 0;
}
上文举例说明的产出是:
Change detected
667F.tmp: 0x00000003
667F.tmp: 0x00000003
667F.tmp: 0x00000003
667F.tmp: 0x00010000
如果我期望:
Change detected
Foo.txt: 0x00000003
Foo.txt: 0x00000003
Foo.txt: 0x00000003
Foo.txt: 0x00010000
我需要做些什么来改变这一功能?
Thanks, PaulH