Index: src/ca/serverca/scasched/scawebsvcext.cpp
===================================================================
--- src/ca/serverca/scasched/scawebsvcext.cpp	(revision 2)
+++ src/ca/serverca/scasched/scawebsvcext.cpp	(working copy)
@@ -1,16 +1,16 @@
 //-------------------------------------------------------------------------------------------------
 // <copyright file="scawebsvcext.h" company="Microsoft">
 //    Copyright (c) Microsoft Corporation.  All rights reserved.
-//    
+//
 //    The use and distribution terms for this software are covered by the
 //    Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
 //    which can be found in the file CPL.TXT at the root of this distribution.
 //    By using this software in any fashion, you are agreeing to be bound by
 //    the terms of this license.
-//    
+//
 //    You must not remove this notice, or any other, from this software.
 // </copyright>
-// 
+//
 // <summary>
 //    IIS Web Service Extension Table functions for CustomActions
 // </summary>
@@ -40,6 +40,9 @@
     PMSIHANDLE hView, hRec;
     SCA_WEBSVCEXT* psWebSvcExt = NULL;
 
+    INSTALLSTATE isInstalled;
+    INSTALLSTATE isAction;
+
     LPWSTR pwzData = NULL;
 
     // check to see if necessary tables are specified
@@ -55,37 +58,47 @@
     ExitOnFailure(hr, "Failed to open view on IIsWebServiceExtension table");
     while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
     {
-        hr = AddWebSvcExtToList(ppsWseList);
-        ExitOnFailure(hr, "failed to add element to web svc ext list");
-
-        psWebSvcExt = *ppsWseList;
-        Assert(psWebSvcExt);
-
         // get component install state
         hr = WcaGetRecordString(hRec, ldqComponent, &pwzData);
         ExitOnFailure(hr, "Failed to get Component for WebSvcExt");
 
-        er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pwzData, &(psWebSvcExt->isInstalled), &(psWebSvcExt->isAction));
+        er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pwzData, &isInstalled, &isAction);
         hr = HRESULT_FROM_WIN32(er);
         ExitOnFailure(hr, "Failed to get Component state for WebSvcExt");
 
-        hr = WcaGetRecordFormattedString(hRec, ldqFile, &pwzData);
-        ExitOnFailure(hr, "Failed to get File for WebSvcExt");
-        hr = StringCchCopyW(psWebSvcExt->wzFile, countof(psWebSvcExt->wzFile), pwzData);
-        ExitOnFailure(hr, "Failed to copy File for WebSvcExt");
+        if (!WcaIsInstalling(isInstalled, isAction) && !WcaIsUninstalling(isInstalled, isAction))
+        {
+          WcaLog(LOGMSG_VERBOSE, "Skipping AddWebSvcExtToList() because IIsWebServiceExtension is not being installed and not being uninstalled.");
+        }
+        else
+        {
+          hr = AddWebSvcExtToList(ppsWseList);
+          ExitOnFailure(hr, "failed to add element to web svc ext list");
 
-        hr = WcaGetRecordFormattedString(hRec, ldqDescription, &pwzData);
-        ExitOnFailure(hr, "Failed to get Description for WebSvcExt");
-        hr = StringCchCopyW(psWebSvcExt->wzDescription, countof(psWebSvcExt->wzDescription), pwzData);
-        ExitOnFailure(hr, "Failed to copy Description for WebSvcExt");
+          psWebSvcExt = *ppsWseList;
+          Assert(psWebSvcExt);
 
-        hr = WcaGetRecordFormattedString(hRec, ldqGroup, &pwzData);
-        ExitOnFailure(hr, "Failed to get Group for WebSvcExt");
-        hr = StringCchCopyW(psWebSvcExt->wzGroup, countof(psWebSvcExt->wzGroup), pwzData);
-        ExitOnFailure(hr, "Failed to copy Group for WebSvcExt");
+          psWebSvcExt->isInstalled = isInstalled;
+          psWebSvcExt->isAction = isAction;
 
-        hr = WcaGetRecordInteger(hRec, ldqAttributes, &psWebSvcExt->iAttributes);
-        ExitOnFailure(hr, "Failed to get Attributes for WebSvcExt");
+          hr = WcaGetRecordFormattedString(hRec, ldqFile, &pwzData);
+          ExitOnFailure(hr, "Failed to get File for WebSvcExt");
+          hr = StringCchCopyW(psWebSvcExt->wzFile, countof(psWebSvcExt->wzFile), pwzData);
+          ExitOnFailure(hr, "Failed to copy File for WebSvcExt");
+
+          hr = WcaGetRecordFormattedString(hRec, ldqDescription, &pwzData);
+          ExitOnFailure(hr, "Failed to get Description for WebSvcExt");
+          hr = StringCchCopyW(psWebSvcExt->wzDescription, countof(psWebSvcExt->wzDescription), pwzData);
+          ExitOnFailure(hr, "Failed to copy Description for WebSvcExt");
+
+          hr = WcaGetRecordFormattedString(hRec, ldqGroup, &pwzData);
+          ExitOnFailure(hr, "Failed to get Group for WebSvcExt");
+          hr = StringCchCopyW(psWebSvcExt->wzGroup, countof(psWebSvcExt->wzGroup), pwzData);
+          ExitOnFailure(hr, "Failed to copy Group for WebSvcExt");
+
+          hr = WcaGetRecordInteger(hRec, ldqAttributes, &psWebSvcExt->iAttributes);
+          ExitOnFailure(hr, "Failed to get Attributes for WebSvcExt");
+        }
     }
 
     if (E_NOMOREITEMS == hr)
@@ -201,11 +214,11 @@
     if (S_FALSE != hr)
     {
         // we found a match on the File now check for Group and Description
-        LPWSTR pwzGroupAndDescription = NULL;    
+        LPWSTR pwzGroupAndDescription = NULL;
         hr = StrAllocFormatted(
             &pwzGroupAndDescription,
             L"%s,%s",
-            psWseList->wzGroup, 
+            psWseList->wzGroup,
             psWseList->wzDescription);
         ExitOnFailure(hr, "Failure allocating space for Group & Description string");
 
@@ -219,12 +232,12 @@
     iAllow = (psWseList->iAttributes & 1);
     iUiDeletable = ((psWseList->iAttributes >> 1) & 1);
     hr = StrAllocFormatted(
-            &pwzWebSvcExt, 
+            &pwzWebSvcExt,
             L"%d,%s,%d,%s,%s",
-            iAllow, 
-            psWseList->wzFile, 
-            iUiDeletable, 
-            psWseList->wzGroup, 
+            iAllow,
+            psWseList->wzFile,
+            iUiDeletable,
+            psWseList->wzGroup,
             psWseList->wzDescription);
     ExitOnFailure(hr, "Failure allocating space for web service extensions");
 
@@ -242,7 +255,7 @@
 
 LExit:
     ReleaseStr(pwzWebSvcExt);
-    
+
     return hr;
 }
 
@@ -316,10 +329,10 @@
     HRESULT hr = S_OK;
     SCA_WEBSVCEXT* psWse = (SCA_WEBSVCEXT*)MemAlloc(sizeof(SCA_WEBSVCEXT), TRUE);
     ExitOnNull(psWse, hr, E_OUTOFMEMORY, "failed to allocate element for web svc ext list");
-    
+
     psWse->psWseNext = *ppsWseList;
     *ppsWseList = psWse;
-    
+
 LExit:
     return hr;
 }
