[URLMON] Sync with Wine 3.0. CORE-14225
[reactos.git] / dll / win32 / urlmon / axinstall.c
index ca1aef6..c84adbb 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#define OEMRESOURCE
+#include "urlmon_main.h"
 
 #include <assert.h>
 
-#include "urlmon_main.h"
 #include "resource.h"
 
-#include "advpub.h"
-#include "fdi.h"
-
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
-
 static const WCHAR ctxW[] = {'c','t','x',0};
 static const WCHAR cab_extW[] = {'.','c','a','b',0};
 static const WCHAR infW[] = {'i','n','f',0};
@@ -251,12 +243,25 @@ static HRESULT install_inf_file(install_ctx_t *ctx)
 
     len = GetPrivateProfileStringW(add_codeW, NULL, NULL, buf, sizeof(buf)/sizeof(*buf), ctx->install_file);
     if(len) {
-        FIXME("[Add.Code] section not supported\n");
+        default_install = FALSE;
 
-        /* Don't throw an error if we successfully ran setup hooks;
-           installation is likely to be complete enough */
-        if(default_install)
-            return E_NOTIMPL;
+        for(key = buf; *key; key += strlenW(key)+1) {
+            TRACE("[Add.Code] key: %s\n", debugstr_w(key));
+
+            len = GetPrivateProfileStringW(add_codeW, key, NULL, sect_name, sizeof(sect_name)/sizeof(*sect_name),
+                    ctx->install_file);
+            if(!len) {
+                WARN("Could not get key value\n");
+                return E_FAIL;
+            }
+
+            hres = RunSetupCommandW(ctx->hwnd, ctx->install_file, sect_name,
+                    ctx->tmp_dir, NULL, NULL, RSC_FLAG_INF, NULL);
+            if(FAILED(hres)) {
+                WARN("RunSetupCommandW failed: %08x\n", hres);
+                return hres;
+            }
+        }
     }
 
     if(default_install) {
@@ -447,7 +452,7 @@ static HRESULT install_file(install_ctx_t *ctx, const WCHAR *cache_file)
         if(!ext)
             ext = ptr;
 
-        if(!strcmpW(ext, cab_extW)) {
+        if(!strcmpiW(ext, cab_extW)) {
             hres = install_cab_file(ctx);
         }else {
             FIXME("Unsupported extension %s\n", debugstr_w(ext));