wined3d: Remove the bytesPerPixel field from IWineD3DSurfaceImpl and IWineD3DVolumeImpl.
[wine] / dlls / wintrust / softpub.c
index d110e2c..9a78838 100644 (file)
@@ -128,7 +128,8 @@ static BOOL SOFTPUB_GetSIP(CRYPT_PROVIDER_DATA *data)
 /* Assumes data->u.pPDSip has been loaded, and data->u.pPDSip->pSip allocated.
  * Calls data->u.pPDSip->pSip->pfGet to construct data->hMsg.
  */
-static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data)
+static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file,
+ LPCWSTR filePath)
 {
     BOOL ret;
     LPBYTE buf = NULL;
@@ -144,9 +145,8 @@ static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data)
 
     data->u.pPDSip->psSipSubjectInfo->cbSize = sizeof(SIP_SUBJECTINFO);
     data->u.pPDSip->psSipSubjectInfo->pgSubjectType = &data->u.pPDSip->gSubject;
-    data->u.pPDSip->psSipSubjectInfo->hFile = data->pWintrustData->u.pFile->hFile;
-    data->u.pPDSip->psSipSubjectInfo->pwsFileName =
-     data->pWintrustData->u.pFile->pcwszFilePath;
+    data->u.pPDSip->psSipSubjectInfo->hFile = file;
+    data->u.pPDSip->psSipSubjectInfo->pwsFileName = filePath;
     data->u.pPDSip->psSipSubjectInfo->hProv = data->hProv;
     ret = data->u.pPDSip->pSip->pfGet(data->u.pPDSip->psSipSubjectInfo,
      &data->dwEncoding, 0, &size, 0);
@@ -317,7 +317,8 @@ static BOOL SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data)
     ret = SOFTPUB_GetSIP(data);
     if (!ret)
         goto error;
-    ret = SOFTPUB_GetMessageFromFile(data);
+    ret = SOFTPUB_GetMessageFromFile(data, data->pWintrustData->u.pFile->hFile,
+     data->pWintrustData->u.pFile->pcwszFilePath);
     if (!ret)
         goto error;
     ret = SOFTPUB_CreateStoreFromMessage(data);
@@ -328,6 +329,43 @@ error:
     return ret;
 }
 
+static BOOL SOFTPUB_LoadCatalogMessage(CRYPT_PROVIDER_DATA *data)
+{
+    BOOL ret;
+    HANDLE catalog = INVALID_HANDLE_VALUE;
+
+    if (!data->pWintrustData->u.pCatalog)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+    catalog = CreateFileW(data->pWintrustData->u.pCatalog->pcwszCatalogFilePath,
+     GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
+     NULL);
+    if (catalog == INVALID_HANDLE_VALUE)
+        return FALSE;
+    ret = CryptSIPRetrieveSubjectGuid(
+     data->pWintrustData->u.pCatalog->pcwszCatalogFilePath, catalog,
+     &data->u.pPDSip->gSubject);
+    if (!ret)
+        goto error;
+    ret = SOFTPUB_GetSIP(data);
+    if (!ret)
+        goto error;
+    ret = SOFTPUB_GetMessageFromFile(data, catalog,
+     data->pWintrustData->u.pCatalog->pcwszCatalogFilePath);
+    if (!ret)
+        goto error;
+    ret = SOFTPUB_CreateStoreFromMessage(data);
+    if (!ret)
+        goto error;
+    ret = SOFTPUB_DecodeInnerContent(data);
+    /* FIXME: this loads the catalog file, but doesn't validate the member. */
+error:
+    CloseHandle(catalog);
+    return ret;
+}
+
 HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
 {
     BOOL ret;
@@ -345,6 +383,9 @@ HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
     case WTD_CHOICE_FILE:
         ret = SOFTPUB_LoadFileMessage(data);
         break;
+    case WTD_CHOICE_CATALOG:
+        ret = SOFTPUB_LoadCatalogMessage(data);
+        break;
     default:
         FIXME("unimplemented for %d\n", data->pWintrustData->dwUnionChoice);
         SetLastError(ERROR_INVALID_PARAMETER);
@@ -754,7 +795,7 @@ HRESULT WINAPI GenericChainCertificateTrust(CRYPT_PROVIDER_DATA *data)
 {
     BOOL ret;
     WTD_GENERIC_CHAIN_POLICY_DATA *policyData =
-     (WTD_GENERIC_CHAIN_POLICY_DATA *)data->pWintrustData->pPolicyCallbackData;
+     data->pWintrustData->pPolicyCallbackData;
 
     TRACE("(%p)\n", data);
 
@@ -920,7 +961,7 @@ HRESULT WINAPI GenericChainFinalProv(CRYPT_PROVIDER_DATA *data)
 {
     HRESULT err = NO_ERROR; /* not a typo, MS confused the types */
     WTD_GENERIC_CHAIN_POLICY_DATA *policyData =
-     (WTD_GENERIC_CHAIN_POLICY_DATA *)data->pWintrustData->pPolicyCallbackData;
+     data->pWintrustData->pPolicyCallbackData;
 
     TRACE("(%p)\n", data);