Fbwf Api功能的问题 [英] Problems with Fbwf Api functions

查看:107
本文介绍了Fbwf Api功能的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调用FbwfGetVolumeList / FbwfFindFirst / FbwfFindNext / FbwfFindClose来查看缓存覆盖的内容,并想问几个问题。非常感谢您的帮助。

1)我获得了FbwfGetVolumeList的返回值234。在http://msdn.microsoft.com/en-us/library/bb521702%28WinEmbedded.51%29.aspx上,我看到No_Error,Error_Invalid_Parameter和Error_More_Data。我如何破译"234"。成为其中一个价值观?你能让我知道我做错了吗(在下面的代码中)?
2)我使用下面的代码为我的FbwfFindFirst和FbwfFindNext获得1的返回值。

我也尝试过使用"C:"。相反,在我的FbwfFindFirst中,是WCHAR szDrive [10] = L" C:" ;;
iErr = FbwfFindFirst(szDrive,Cache_detail,& cdSize);

得到了返回值234而不是1.我做错了什么?

我在下面列出了我的代码,以及我的重叠细节的结果。

代码:
=====
ULONG ulCurrentSession = 1;
ULONG cbSize = 32;
BYTE * pszVolumnList = new BYTE [32];

PFbwfCacheDetail Cache_detail;
Cache_detail =(PFbwfCacheDetail)malloc(sizeof(FbwfCacheDetail));
ULONG cdSize = sizeof(PFbwfCacheDetail);

int iErr = FbwfGetVolumeList(ulCurrentSession,pszVolumnList,& cbSize) ; //返回值:iErr = 1
fprintf(输出,"FbwfGetVolumeList返回值%d \ n",iErr); // iErr = 1

PWSTR v = *(PWSTR *)(pszVolumnList + sizeof(PWSTR));

iErr = FbwfFindFirst(v,Cache_detail,& cdSize) ; fprintf(输出,"FbwfFindFirst返回值%d \ n",iErr); // iErr = 1
fprintf(输出,"FbwfFindFirst fileName%s \ n",Cache_detail-> fileName); //在这里打出一些怪异的字符。

int i = 0;
int size = sizeof(pszVolumnList);

while(i< size)
{
i ++;
iErr = FbwfFindNext(Cache_detail,& cdSize);

fprintf(输出,"FbwfFindNext返回值%d \ n",iErr); // iErr = 1
fprintf(输出,"FbwfFindNext-Cache_detail%s \ n",Cache_detail-> fileName); //在这里打出一些怪异的字符。
}

iErr = FbwfFindClose();
fprintf(输出,"来自FbwfFindClose的错误%d \ n",iErr );

重叠细节:
= =============





当前会话的基于文件的写过滤器配置:

过滤器状态:已启用。
叠加缓存数据压缩状态:已禁用。
叠加缓存阈值:64 MB。叠加缓存预分配:已禁用。
尺寸显示:实际模式。
受保护的卷列表:
\设备\HarddiskVolume1
写入每个受保护卷的列表:
\设备\硬盘磁盘1:
\我的目录< ---这是我运行上面代码生成的可执行文件的地方。

解决方案

这些API将返回Win32错误代码,除非另有说明。错误234是ERROR_MORE_DATA。请参阅 http://msdn.microsoft.com/en-us/library/ms681382( VS.85).aspx 获取Win32错误代码的完整列表。

在您的情况下,您需要检查cbSize并重试正确的大小,例如,
ULONG错误= ERROR_SUCCESS;
PFbwfCacheDetail cacheDetail = NULL;
ULONG size = 0;

error = FbwfFindFirst(L" C:",cacheDetail,& size );这将因ERROR_MORE_DATA而失败,但'size'将包含cacheDetail所需的缓冲区大小。将'size'字节分配给cacheDetail并重试该呼叫。

Sean Liming的文章可能有助于解决几个相关概念( http://www.seanliming.com/Docs/FBWF_API.pdf

感谢
SRIKANTH

Hi, I am calling the FbwfGetVolumeList/FbwfFindFirst/FbwfFindNext/FbwfFindClose to look at the content of my cache overlay and would like to ask a few questions.  Thanks a lot for helping.

1)  I am getting a return value of 234 for FbwfGetVolumeList.  On http://msdn.microsoft.com/en-us/library/bb521702%28WinEmbedded.51%29.aspx I see No_Error, Error_Invalid_Parameter, and Error_More_Data.  How do I decipher "234" into one of these values?  And could you let me know what I did wrong (in the codes below)?

2) I am getting a return value of 1 for my FbwfFindFirst and FbwfFindNext using the codes below. 

I also tried using "C:" instead in my FbwfFindFirst,
      WCHAR szDrive[10] = L"C:";
      iErr = FbwfFindFirst(szDrive, Cache_detail, &cdSize);

and got a return value of 234 instead of 1.  Am I doing anything wrong?

I've included my codes below, as well as a result of my overlay details.

CODES:
=====
ULONG ulCurrentSession = 1;
    ULONG cbSize = 32;
    BYTE *pszVolumnList = new BYTE[32];

    PFbwfCacheDetail Cache_detail;   
    Cache_detail = (PFbwfCacheDetail)malloc (sizeof(FbwfCacheDetail));
    ULONG cdSize = sizeof(PFbwfCacheDetail);

    int iErr = FbwfGetVolumeList(ulCurrentSession, pszVolumnList, &cbSize); //Return value: iErr = 1
    fprintf(output, "FbwfGetVolumeList return value %d\n", iErr);   // iErr = 1

    PWSTR v = * (PWSTR*) (pszVolumnList + sizeof(PWSTR));

    iErr = FbwfFindFirst(v, Cache_detail, &cdSize);
    fprintf(output, "FbwfFindFirst return value %d\n", iErr);   // iErr = 1
    fprintf(output, "FbwfFindFirst fileName %s\n", Cache_detail->fileName); // Prints out some weird looking characters here.

    int i=0;
    int size = sizeof(pszVolumnList);

    while (i < size)
    {
        i++;
        iErr = FbwfFindNext(Cache_detail, &cdSize);

        fprintf(output, "FbwfFindNext return value %d\n", iErr); // iErr = 1
        fprintf(output, "FbwfFindNext-Cache_detail %s\n", Cache_detail->fileName); // Prints out some weird looking characters here.
    }

   iErr = FbwfFindClose();
   fprintf(output, "Error from FbwfFindClose %d\n", iErr);

OVERLAY DETAILS:
=============

File-based write filter configuration for the current session:

filters state: enabled.
overlay cache data compression state: disabled.
overlay cache threshold: 64 MB.
overlay cache pre-allocation: disabled.
size display: actual mode.
protected volume list:
   \Device\HarddiskVolume1
write through list of each protected volume:
   \Device\HarddiskVolume1:
      \My Directory <--- This is where I ran my executable generated by the codes above.

解决方案

These APIs will return Win32 error codes unless specified otherwise. Error 234 is ERROR_MORE_DATA . See http://msdn.microsoft.com/en-us/library/ms681382(VS.85).aspx for a full list of Win32 error codes.

In your case, you need to examine cbSize and retry with correct size, something like,

ULONG error = ERROR_SUCCESS;
PFbwfCacheDetail cacheDetail = NULL;
ULONG size = 0;

error = FbwfFindFirst(L"C:", cacheDetail, &size);

This will fail with ERROR_MORE_DATA but 'size' will contain the necessary buffer size for cacheDetail. Allocate 'size' bytes to cacheDetail and retry the call.

Sean Liming's article might help with several related concepts (http://www.seanliming.com/Docs/FBWF_API.pdf)

Thanks
Srikanth


这篇关于Fbwf Api功能的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆