Heavy based on Chris Morgan's winebrowser i cut/paste a winehh, to use a Unix chm-file viewer. It works when there is no space in the path. How to do the transform from windows path to Unix path right?
You find a static linked Unix chm-file viewer on this URL http://www.herdsoft.com/ftp/chmviewer-0.1.tar.gz
Or get xchm from SourceForge
Apologize for wrongly spelling. mvh Acke Carlsson
Index: configure.ac =================================================================== RCS file: /mnt/hd/cvs/wine/wine/configure.ac,v retrieving revision 1.228 diff -u -r1.228 configure.ac --- configure.ac 9 Jan 2004 00:03:00 -0000 1.228 +++ configure.ac 9 Jan 2004 23:38:41 -0000 @@ -1657,6 +1657,7 @@ programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile +programs/winehh/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile Index: winedefault.reg =================================================================== RCS file: /mnt/hd/cvs/wine/wine/winedefault.reg,v retrieving revision 1.84 diff -u -r1.84 winedefault.reg --- winedefault.reg 6 Jan 2004 20:49:59 -0000 1.84 +++ winedefault.reg 9 Jan 2004 23:34:51 -0000 @@ -4614,6 +4614,16 @@ [HKEY_CLASSES_ROOT\http\shell\open\command] @="winebrowser %1"
+[HKEY_CLASSES_ROOT.chm] +@="chm.file" + +[HKEY_CLASSES_ROOT\chm.file] +@="Compiled HTML Help file" + +# Map requests to open "chm.file" entries to winehh +[HKEY_CLASSES_ROOT\chm.file\shell\open\command] +@="winehh %1" + # # Entries for DirectShow # Index: programs/Makefile.in =================================================================== RCS file: /mnt/hd/cvs/wine/wine/programs/Makefile.in,v retrieving revision 1.43 diff -u -r1.43 Makefile.in --- programs/Makefile.in 6 Jan 2004 20:49:59 -0000 1.43 +++ programs/Makefile.in 9 Jan 2004 23:47:00 -0000 @@ -27,6 +27,7 @@ wineconsole \ winedbg \ winefile \ + winehh \ winemenubuilder \ winemine \ winepath \ @@ -56,6 +57,7 @@ wineconsole \ winedbg \ winefile \ + winehh \ winemenubuilder \ winemine \ winepath \ @@ -78,6 +80,7 @@ wineconsole \ winedbg \ winefile \ + winehh \ winemine \ winepath \ winhelp @@ -107,6 +110,7 @@ wineconsole.exe \ winedbg.exe \ winefile.exe \ + winehh.exe \ winemenubuilder.exe \ winemine.exe \ winepath.exe \ @@ -227,6 +231,9 @@ winefile.exe$(DLLEXT): winefile/winefile.exe$(DLLEXT) $(RM) $@ && $(LN_S) winefile/winefile.exe$(DLLEXT) $@
+winehh.exe$(DLLEXT): winehh/winehh.exe$(DLLEXT) + $(RM) $@ && $(LN_S) winehh/winehh.exe$(DLLEXT) $@ + winemenubuilder.exe$(DLLEXT): winemenubuilder/winemenubuilder.exe$(DLLEXT) $(RM) $@ && $(LN_S) winemenubuilder/winemenubuilder.exe$(DLLEXT) $@
@@ -271,6 +278,7 @@ wineconsole/wineconsole.exe$(DLLEXT): wineconsole winedbg/winedbg.exe$(DLLEXT): winedbg winefile/winefile.exe$(DLLEXT): winefile +winehh/winehh.exe$(DLLEXT): winehh winemenubuilder/winemenubuilder.exe$(DLLEXT): winemenubuilder winemine/winemine.exe$(DLLEXT): winemine winepath/winepath.exe$(DLLEXT): winepath Index: programs/make_progs =================================================================== RCS file: /mnt/hd/cvs/wine/wine/programs/make_progs,v retrieving revision 1.2 diff -u -r1.2 make_progs --- programs/make_progs 6 Jan 2004 20:49:59 -0000 1.2 +++ programs/make_progs 9 Jan 2004 23:41:00 -0000 @@ -41,6 +41,7 @@ "wineconsole" => 1, "winedbg" => 1, "winefile" => 1, + "winehh" => 1, "winemine" => 1, "winepath" => 1, "winhelp" => 1, Index: tools/wineinstall =================================================================== RCS file: /mnt/hd/cvs/wine/wine/tools/wineinstall,v retrieving revision 1.64 diff -u -r1.64 wineinstall --- tools/wineinstall 6 Jan 2004 22:08:33 -0000 1.64 +++ tools/wineinstall 9 Jan 2004 23:43:59 -0000 @@ -146,6 +146,7 @@ link_app winhelp "$CROOT/windows/winhelp.exe" link_app winhelp "$CROOT/windows/winhlp32.exe" link_app winebrowser "$CROOT/windows/winebrowser.exe" + link_app winehh "$CROOT/windows/winehh.exe" }
# startup... --- /dev/null 1970-01-01 01:00:00.000000000 +0100 +++ programs/winehh/.cvsignore 2004-01-10 01:18:52.000000000 +0100 @@ -0,0 +1,3 @@ +Makefile +winehh.exe.dbg.c +winehh.exe.spec.c --- /dev/null 1970-01-01 01:00:00.000000000 +0100 +++ programs/winehh/Makefile.in 2004-01-10 00:42:30.000000000 +0100 @@ -0,0 +1,14 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = winehh.exe +APPMODE = cui +IMPORTS = shell32 user32 advapi32 kernel32 + +C_SRCS = \ + main.c + +@MAKE_PROG_RULES@ + +### Dependencies: --- /dev/null 1970-01-01 01:00:00.000000000 +0100 +++ programs/winehh/main.c 2004-01-10 04:16:11.000000000 +0100 @@ -0,0 +1,109 @@ +/* + * winehh winelib app to launch native OS chm-file viewer + * + * Copyright (C) 2004 Chris Morgan + * Copyright (C) 2004 Acke Carlsson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * NOTES: + * Winehh is a winelib application that will start the appropriate + * native chm-file viewer up for a wine installation that lacks a + * windows chm-file viewer. + */ + +#include "config.h" +#include "wine/port.h" + +#include <windows.h> +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> + +/***************************************************************************** + * Main entry point. This is a console application so we have a main() not a + * winmain(). + */ +int main (int argc, char *argv[]) +{ + static char path[MAX_PATH]; + + typedef BOOL (WINAPI *wine_get_unix_file_name_t) ( LPCWSTR dos, LPSTR buffer, DWORD len ); + wine_get_unix_file_name_t wine_get_unix_file_name_ptr = NULL; + + wine_get_unix_file_name_ptr = (wine_get_unix_file_name_t) + GetProcAddress(GetModuleHandle("KERNEL32"), "wine_get_unix_file_name"); + + fprintf(stderr, "winehh open: %s\n", argv[1]); + + WCHAR dosW[MAX_PATH]; + MultiByteToWideChar(CP_ACP, 0, argv[1], -1, dosW, MAX_PATH); + wine_get_unix_file_name_ptr(dosW, path, sizeof(path)); + + fprintf(stderr, "winehh open: %s\n", path); + + const char *argv_new[3]; + DWORD maxLength; + CHAR szChmViewer[256]; + DWORD type; + CHAR *defaultChmViewer = "displaychm,xchm"; + char *chmviewer; + HKEY hkey; + LONG r; + + /* is this necessary for a chmviewer */ + unsetenv("TEMP"); + unsetenv("TMP"); + + maxLength = sizeof(szChmViewer); + + if(RegCreateKeyEx( HKEY_CURRENT_USER, + "Software\Wine\WineHH", 0, NULL, + REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, + &hkey, NULL)) + { + fprintf( stderr, "winehh: cannot create config key\n" ); + return 1; + } + + r = RegQueryValueExA( hkey, "ChmViewer", 0, &type, szChmViewer, &maxLength); + if(r != ERROR_SUCCESS) + { + /* set value to the default */ + RegSetValueExA(hkey, "ChmViewer", 0, REG_SZ, + (LPBYTE)defaultChmViewer, lstrlen(defaultChmViewer) + 1); + strcpy( szChmViewer, defaultChmViewer ); + } + + RegCloseKey(hkey); + + + /* now go through the list of chmviewers until we run out or we find one that */ + /* works */ + chmviewer = strtok(szChmViewer, ","); + + while(chmviewer) + { + argv_new[0] = chmviewer; + argv_new[1] = path; + argv_new[2] = NULL; + + spawnvp(_P_OVERLAY, chmviewer, argv_new); /* only returns on error */ + + chmviewer = strtok(NULL, ","); /* grab the next chmviewer */ + } + fprintf( stderr, "winehh: could not find a chmviewer to run\n" ); + return 1; +}