0

Windows Defender APIを使用して、フォルダーのマルウェアをスキャンしようとしています。ドキュメントに従って、私はコードを書きました:

MPRESOURCE_INFO ResourceInfo = { 0 };
MPSCAN_RESOURCES ScanResource = { 0 };
PMPRESOURCE_INFO ResourceInfoArray = NULL;
...
ResourceInfo.Scheme = L"dir";
ResourceInfo.Path = L"C:\\temp";
ResourceInfo.Class = 0;

// ResourceInfoArray was Allocated before
*ResourceInfoArray = ResourceInfo;
ScanResource.dwResourceCount = 1;
ScanResource.pResourceList = ResourceInfoArray;

// Opened hMpManager before using MpScanStart
hRetval = MpScanStart(hMpManager, MPSCAN_TYPE_RESOURCE, 0, &ScanResource, NULL, &ScanHnadle);

エラーメッセージが表示されます:An unexpected problem occurred. Install any available updates, and then try to start the program again. For information on installing updates, see Help and Support.

ただし、ResourceInfo 定義を次のように変更すると:

ResourceInfo.Scheme = L"file";
ResourceInfo.Path = L"C:\\temp\\MyFile.exe";
ResourceInfo.Class = 0;

それはうまく機能し、ファイルを正しい方法で検出します。結論として、コードはファイルに対しては機能しますが、ディレクトリに対しては機能しません。ディレクトリ検索で何が間違っているのか誰か知っていますか?

4

1 に答える 1