Windows can open *.doc files with command
$explorer example.doc
Several applications (for example russian accounting application "1C") use 
this command.

Wine can't do it.

I have prepared a patch to fix this bug. It works, but it seems a little bit 
hacky now.
Please, help me to implement it correctly.


-- 
Best regards,
Vitaly Perov
From cc4c05398c7dc993e2caea032c81eb69b5d4510e Mon Sep 17 00:00:00 2001
From: Vitaly Perov <[email protected]>
Date: Thu, 30 Jun 2011 18:19:36 +0400
Subject: [PATCH] programs/explorer: Try to open registered file types
 (eterbug #7398)

---
 programs/explorer/Makefile.in |    2 +-
 programs/explorer/explorer.c  |   12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/programs/explorer/Makefile.in b/programs/explorer/Makefile.in
index 6fe3fae..d317570 100644
--- a/programs/explorer/Makefile.in
+++ b/programs/explorer/Makefile.in
@@ -2,7 +2,7 @@ EXTRADEFS = -DWINE_NO_UNICODE_MACROS
 MODULE    = explorer.exe
 APPMODE   = -mwindows -municode
 IMPORTS   = rpcrt4 user32 gdi32 advapi32
-DELAYIMPORTS = comctl32  shell32 ole32
+DELAYIMPORTS = comctl32  shell32 ole32 shlwapi
 
 C_SRCS = \
 	appbar.c \
diff --git a/programs/explorer/explorer.c b/programs/explorer/explorer.c
index 0dc82cf..d328662 100644
--- a/programs/explorer/explorer.c
+++ b/programs/explorer/explorer.c
@@ -304,7 +304,7 @@ int WINAPI wWinMain(HINSTANCE hinstance,
                     LPWSTR cmdline,
                     int cmdshow)
 {
-
+    static const WCHAR action_open[] = {'o','p','e','n',0};
     parameters_struct   parameters;
     HRESULT hres;
     MSG msg;
@@ -313,6 +313,16 @@ int WINAPI wWinMain(HINSTANCE hinstance,
     memset(&parameters,0,sizeof(parameters));
     explorer_hInstance = hinstance;
     parse_command_line(cmdline,&parameters);
+
+    /* Try to open registered file types (eterbug #7398) */
+    if (parameters.root[0] && PathFileExistsW(parameters.root)
+                           && !PathIsDirectoryW(parameters.root))
+    {
+        hinstance = ShellExecuteW(NULL, action_open, parameters.root, NULL, NULL, SW_SHOWDEFAULT);
+        if (((int) hinstance) > 32) /* opened successfully */
+            return 0;
+    }
+
     hres = OleInitialize(NULL);
     if(!SUCCEEDED(hres))
     {
-- 
1.7.5.4



Reply via email to