【问题标题】:ReadDirectoryChangesW implementationReadDirectoryChangesW 实现
【发布时间】:2009-07-08 03:06:49
【问题描述】:

最初我与此调用相关联,因此我可以记录对某个文件的所有访问并捕获对它的所有更改。

我已经完成了几个示例,但都失败了。甚至 代码也无法为我编译。

谁能给我一个小的工作 sn-p 来监控文件并记录更改?

或者至少一些指针?

谢谢

【问题讨论】:

    标签: msdn c msdn


    【解决方案1】:

    您可能没有声明ReadDirectoryChangesW 的标头,或者您需要将#define _WIN32_WINNT 设置为大于或等于0x0400。如果是前者,您可以手动获取地址到 ReadDirectoryChangesW 并调用:

    HANDLE kernel32_dll_handle= LoadLibrary("kernel32.dll");
    FARPROC ReadDirectoryChangesWAddress= GetProcAddress(kernel32_dll_handle, "ReadDirectoryChangesW");
    
    typedef BOOL WINAPI (*ReadDirectoryChangesWDeclaration)(
      __in         HANDLE hDirectory,
      __out        LPVOID lpBuffer,
      __in         DWORD nBufferLength,
      __in         BOOL bWatchSubtree,
      __in         DWORD dwNotifyFilter,
      __out_opt    LPDWORD lpBytesReturned,
      __inout_opt  LPOVERLAPPED lpOverlapped,
      __in_opt     LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
    );
    
    ReadDirectoryChangesWDeclaration ReadDirectoryChangesW= (ReadDirectoryChangesWDeclaration)ReadDirectoryChangesWAddress;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-04
      • 1970-01-01
      • 2020-05-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多