小编N.a*_*ham的帖子

WinVerifyTrust 函数需要很长时间才能执行

我在Windows 10 Pro上使用 Windows WinVerifyTrust函数来验证 dll 签名。当我第一次激活此函数时,该函数需要4 秒才能执行并返回第一个 dll 的验证状态。对于其他正在进行的 dll,该函数返回速度很快。

谁能帮助我了解延迟的可能原因?

需要 4 秒的调用是这样的:

  lStatus = WinVerifyTrust(
        NULL,
        &WVTPolicyGUID,
        &WinTrustData);
Run Code Online (Sandbox Code Playgroud)

我正在使用的包装函数如下所示:

#define _UNICODE 1
#define UNICODE 1

#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <Softpub.h>
#include <wincrypt.h>
#include <wintrust.h>

// Link with the Wintrust.lib file.
#pragma comment (lib, "wintrust")

BOOL VerifyEmbeddedSignature(LPCWSTR pwszSourceFile)
{
    LONG lStatus;
    DWORD dwLastError;

    // Initialize the WINTRUST_FILE_INFO structure.

    WINTRUST_FILE_INFO FileData;
    memset(&FileData, 0, sizeof(FileData));
    FileData.cbStruct = sizeof(WINTRUST_FILE_INFO);
    FileData.pcwszFilePath = pwszSourceFile; …
Run Code Online (Sandbox Code Playgroud)

winverifytrust signtool

6
推荐指数
1
解决办法
2005
查看次数

以编程方式获取 Azure 存储帐户属性

我在我的 C# web 应用程序中编写了一个从 Azure 存储帐户中删除旧 blob 的方法。

这是我的代码:

public void CleanupIotHubExpiredBlobs()
{
   const string StorageAccountName = "storageName";
   const string StorageAccountKey = "XXXXXXXXXX";
   const string StorageContainerName = "outputblob";
   string storageConnectionString = string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", StorageAccountName, StorageAccountKey);

   // Retrieve storage account from connection string.
   CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageConnectionString);
   // Create the blob client.
   CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
   // select container in which to look for old blobs.
   CloudBlobContainer container = blobClient.GetContainerReference(StorageContainerName);

   // set up Blob access condition option which will filter all the …
Run Code Online (Sandbox Code Playgroud)

c# azure azure-storage azure-storage-blobs

5
推荐指数
1
解决办法
2698
查看次数