On Mon, 2022-03-28 at 14:01 +0300, Paul Gofman wrote:
- if (dwObjectType != CERT_QUERY_OBJECT_FILE)
- if (dwObjectType == CERT_QUERY_OBJECT_BLOB)
{
WARN("don't know what to do for type %ld embedded signed messages\n",dwObjectType);
WCHAR temp_path[MAX_PATH], temp_name[MAX_PATH];const CERT_BLOB *b = pvObject;TRACE("cbData %lu, pbData %p.\n", b->cbData, b->pbData);if (!GetTempPathW(MAX_PATH, temp_path) || !GetTempFileNameW(temp_path, L"blb", 0, temp_name)){ERR("Failed getting temp file name.\n");return FALSE;}file = CreateFileW(temp_name, GENERIC_READ | GENERIC_WRITE, 0,NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL);if (file == INVALID_HANDLE_VALUE){ERR("Could not create temp file.\n");SetLastError(ERROR_OUTOFMEMORY);return FALSE;
It would be nice to avoid creating a temporary file. Perhaps we could factor out a helper that operates on memory and rewrite CryptSIPRetrieveSubjectGuid() to use a file mapping?