Partial implementation of advpack.RegInstall.

diff --git a/configure b/configure
index b09971a..58c7778 100755
--- a/configure
+++ b/configure
@@ -20276,7 +20276,7 @@
 MAKE_PROG_RULES=programs/Makeprog.rules
 
 
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/itss/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mlang/Makefile dlls/mlang/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/mscms/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/ole32/tests/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/quartz/tests/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/rsabase/tests/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/strmiids/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile fonts/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/advpack/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/itss/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mlang/Makefile dlls/mlang/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/mscms/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/ole32/tests/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/quartz/tests/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/rsabase/tests/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/strmiids/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile fonts/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
 
 
 cat >confcache <<\_ACEOF
@@ -20816,6 +20816,7 @@
   "dlls/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/Makefile" ;;
   "dlls/advapi32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/advapi32/Makefile" ;;
   "dlls/advapi32/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/advapi32/tests/Makefile" ;;
+  "dlls/advpack/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/advpack/Makefile" ;;
   "dlls/amstream/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/amstream/Makefile" ;;
   "dlls/atl/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/atl/Makefile" ;;
   "dlls/avicap32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/avicap32/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index 4f16aac..f579251 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1539,6 +1539,7 @@
 dlls/Makefile
 dlls/advapi32/Makefile
 dlls/advapi32/tests/Makefile
+dlls/advpack/Makefile
 dlls/amstream/Makefile
 dlls/atl/Makefile
 dlls/avicap32/Makefile
diff --git a/dlls/Makefile.in b/dlls/Makefile.in
index 1246bd3..ab0b82c 100644
--- a/dlls/Makefile.in
+++ b/dlls/Makefile.in
@@ -17,6 +17,7 @@
 
 BASEDIRS = \
 	advapi32 \
+	advpack \
 	amstream \
 	atl \
 	avicap32 \
@@ -242,6 +243,7 @@
 	$(EXTRADIRS:%=%.dll.so) \
 	@WIN16_FILES@ \
 	advapi32.dll.so \
+	advpack.dll.so \
 	amstream.dll.so \
 	atl.dll.so \
 	avicap32.dll.so \
@@ -408,6 +410,9 @@
 advapi32.dll.so: advapi32/advapi32.dll.so
 	$(RM) $@ && $(LN_S) advapi32/advapi32.dll.so $@
 
+advpack.dll.so: advpack/advpack.dll.so
+	$(RM) $@ && $(LN_S) advpack/advpack.dll.so $@
+
 amstream.dll.so: amstream/amstream.dll.so
 	$(RM) $@ && $(LN_S) amstream/amstream.dll.so $@
 
@@ -973,6 +978,7 @@
 
 IMPORT_LIBS = \
 	libadvapi32.$(IMPLIBEXT) \
+	libadvpack.$(IMPLIBEXT) \
 	libamstream.$(IMPLIBEXT) \
 	libatl.$(IMPLIBEXT) \
 	libavicap32.$(IMPLIBEXT) \
@@ -1110,6 +1116,11 @@
 libadvapi32.a: advapi32/advapi32.spec.def
 	$(DLLTOOL) -k -l $@ -d advapi32/advapi32.spec.def
 
+libadvpack.def: advpack/advpack.spec.def
+	$(RM) $@ && $(LN_S) advpack/advpack.spec.def $@
+libadvpack.a: advpack/advpack.spec.def
+	$(DLLTOOL) -k -l $@ -d advpack/advpack.spec.def
+
 libamstream.def: amstream/amstream.spec.def
 	$(RM) $@ && $(LN_S) amstream/amstream.spec.def $@
 libamstream.a: amstream/amstream.spec.def
@@ -1731,6 +1742,7 @@
 	$(DLLTOOL) -k -l $@ -d x11drv/x11drv.spec.def
 
 advapi32/advapi32.spec.def: $(WINEBUILD)
+advpack/advpack.spec.def: $(WINEBUILD)
 amstream/amstream.spec.def: $(WINEBUILD)
 atl/atl.spec.def: $(WINEBUILD)
 avicap32/avicap32.spec.def: $(WINEBUILD)
@@ -1862,6 +1874,7 @@
 # Map library name to the corresponding directory
 
 advapi32/advapi32.dll.so: advapi32
+advpack/advpack.dll.so: advpack
 amstream/amstream.dll.so: amstream
 atl/atl.dll.so: atl
 avicap32/avicap32.dll.so: avicap32
diff --git a/dlls/advpack/.cvsignore b/dlls/advpack/.cvsignore
new file mode 100644
index 0000000..6bb058f
--- /dev/null
+++ b/dlls/advpack/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+advpack.dll.dbg.c
+advpack.spec.def
diff --git a/dlls/advpack/Makefile.in b/dlls/advpack/Makefile.in
new file mode 100644
index 0000000..0da5d59
--- /dev/null
+++ b/dlls/advpack/Makefile.in
@@ -0,0 +1,15 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = advpack.dll
+IMPORTS   = setupapi user32 kernel32 ntdll
+EXTRALIBS = $(LIBUNICODE)
+
+C_SRCS = \
+	advpack.c \
+	reg.c
+
+@MAKE_DLL_RULES@
+
+### Dependencies:
diff --git a/dlls/advpack/advpack.c b/dlls/advpack/advpack.c
new file mode 100644
index 0000000..126a986
--- /dev/null
+++ b/dlls/advpack/advpack.c
@@ -0,0 +1,39 @@
+/*
+ * Advpack main
+ *
+ * Copyright 2004 Huw D M Davies
+ *
+ * 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
+ */
+
+#include <windef.h>
+#include <stdarg.h>
+#include <winbase.h>
+#include <wine/debug.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(advpack);
+
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+    TRACE("(%p, %ld, %p)\n",hinstDLL, fdwReason, lpvReserved);
+
+    if (fdwReason == DLL_PROCESS_ATTACH)
+        DisableThreadLibraryCalls(hinstDLL);
+
+    return TRUE;
+}
+
+
diff --git a/dlls/advpack/advpack.spec b/dlls/advpack/advpack.spec
new file mode 100644
index 0000000..9081780
--- /dev/null
+++ b/dlls/advpack/advpack.spec
@@ -0,0 +1,32 @@
+@ stub AddDelBackupEntry
+@ stub AdvInstallFile
+@ stub CloseINFEngine
+@ stub DelNode
+@ stub DelNodeRunDLL32
+@ stub DllMain
+@ stub DoInfInstall
+@ stub ExecuteCab
+@ stub ExtractFiles
+@ stub FileSaveMarkNotExist
+@ stub FileSaveRestore
+@ stub FileSaveRestoreOnINF
+@ stub GetVersionFromFile
+@ stub GetVersionFromFileEx
+@ stub IsNTAdmin
+@ stub LaunchINFSection
+@ stub LaunchINFSectionEx
+@ stub NeedReboot
+@ stub NeedRebootInit
+@ stub OpenINFEngine
+@ stub RebootCheckOnInstall
+@ stdcall RegInstall(ptr str ptr)
+@ stub RegRestoreAll
+@ stub RegSaveRestore
+@ stub RegSaveRestoreOnINF
+@ stub RegisterOCX
+@ stub RunSetupCommand
+@ stub SetPerUserSecValues
+@ stub TranslateInfString
+@ stub TranslateInfStringEx
+@ stub UserInstStubWrapper
+@ stub UserUnInstStubWrapper
diff --git a/dlls/advpack/reg.c b/dlls/advpack/reg.c
new file mode 100644
index 0000000..0cc6e65
--- /dev/null
+++ b/dlls/advpack/reg.c
@@ -0,0 +1,179 @@
+/*
+ * Advpack registry functions
+ *
+ * Copyright 2004 Huw D M Davies
+ *
+ * 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
+ */
+
+#include <windef.h>
+#include <stdarg.h>
+#include <winbase.h>
+#include <winreg.h>
+#include <winerror.h>
+#include <wine/unicode.h>
+#include <wine/debug.h>
+#include <winuser.h>
+#include <winternl.h>
+#include <setupapi.h>
+#include <advpub.h>
+
+
+WINE_DEFAULT_DEBUG_CHANNEL(advpack);
+
+static const WCHAR REGINST[] = {'R','E','G','I','N','S','T',0};
+static const WCHAR Strings[] = {'S','t','r','i','n','g','s',0};
+static const WCHAR MOD_PATH[] = {'_','M','O','D','_','P','A','T','H',0};
+static const WCHAR SYS_MOD_PATH[] = {'_','S','Y','S','_','M','O','D','_','P','A','T','H',0};
+static const WCHAR SystemRoot[] = {'S','y','s','t','e','m','R','o','o','t',0};
+static const WCHAR escaped_SystemRoot[] = {'%','S','y','s','t','e','m','R','o','o','t','%',0};
+
+static BOOL get_temp_ini_path(LPWSTR name)
+{
+    WCHAR tmp_dir[MAX_PATH];
+    WCHAR prefix[] = {'a','v','p',0};
+
+    if(!GetTempPathW(sizeof(tmp_dir)/sizeof(WCHAR), tmp_dir))
+       return FALSE;
+
+    if(!GetTempFileNameW(tmp_dir, prefix, 0, name))
+        return FALSE;
+    return TRUE;
+}
+
+static BOOL create_tmp_ini_file(HMODULE hm, WCHAR *ini_file)
+{
+    HRSRC hrsrc;
+    HGLOBAL hmem = NULL;
+    DWORD rsrc_size, bytes_written;
+    VOID *rsrc_data;
+    HANDLE hf = INVALID_HANDLE_VALUE;
+
+    if(!get_temp_ini_path(ini_file)) {
+        ERR("Can't get temp ini file path\n");
+        goto error;
+    }
+
+    if(!(hrsrc = FindResourceW(hm, REGINST, REGINST))) {
+        ERR("Can't find REGINST resource\n");
+        goto error;
+    }
+
+    rsrc_size = SizeofResource(hm, hrsrc);
+    hmem = LoadResource(hm, hrsrc);
+    rsrc_data = LockResource(hmem);
+
+    if(!rsrc_data || !rsrc_size) {
+        ERR("Can't load REGINST resource\n");
+        goto error;
+    }       
+
+    if((hf = CreateFileW(ini_file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+                         FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) {
+        ERR("Unable to create temp ini file\n");
+        goto error;
+    }
+    if(!WriteFile(hf, rsrc_data, rsrc_size, &bytes_written, NULL) || rsrc_size != bytes_written) {
+        ERR("Write failed\n");
+        goto error;
+    }
+    FreeResource(hmem);
+    CloseHandle(hf);
+    return TRUE;
+error:
+    if(hmem) FreeResource(hmem);
+    if(hf != INVALID_HANDLE_VALUE) CloseHandle(hf);
+    return FALSE;
+}
+
+/***********************************************************************
+ *          RegInstall (advpack.@)
+ *
+ */
+HRESULT WINAPI RegInstall(HMODULE hm, LPCSTR pszSection, LPCSTRTABLE pstTable)
+{
+    int i;
+    WCHAR tmp_ini_path[MAX_PATH];
+    WCHAR mod_path[MAX_PATH + 2], sys_mod_path[MAX_PATH + 2], sys_root[MAX_PATH];
+    HINF hinf;
+    WCHAR quote[] = {'\"',0};
+    UNICODE_STRING section;
+
+    TRACE("(%p %s %p)\n", hm, pszSection, pstTable);
+
+    for(i = 0; i < pstTable->cEntries; i++)
+        TRACE("%d: %s -> %s\n", i, pstTable->pse[i].pszName,
+             pstTable->pse[i].pszValue);
+
+    if(!create_tmp_ini_file(hm, tmp_ini_path))
+        return E_FAIL;
+
+    /* Write a couple of pre-defined strings */
+    mod_path[0] = '\"';
+    GetModuleFileNameW(hm, mod_path + 1, sizeof(mod_path)/sizeof(WCHAR) - 2);
+    strcatW(mod_path, quote);
+    WritePrivateProfileStringW(Strings, MOD_PATH, mod_path, tmp_ini_path);
+    
+    *sys_root = '\0';
+    GetEnvironmentVariableW(SystemRoot, sys_root, sizeof(sys_root)/sizeof(WCHAR));
+    if(!strncmpiW(sys_root, mod_path + 1, strlenW(sys_root))) {
+        sys_mod_path[0] = '\"';
+        strcpyW(sys_mod_path + 1, escaped_SystemRoot);
+        strcatW(sys_mod_path, mod_path + 1 + strlenW(sys_root));
+    } else {
+        FIXME("SYS_MOD_PATH needs more work\n");
+        strcpyW(sys_mod_path, mod_path);
+    }
+    WritePrivateProfileStringW(Strings, SYS_MOD_PATH, sys_mod_path, tmp_ini_path);
+
+    /* Write the additional string table */
+    for(i = 0; i < pstTable->cEntries; i++) {
+        char tmp_value[MAX_PATH + 2];
+        UNICODE_STRING name, value;
+        tmp_value[0] = '\"';
+        strcpy(tmp_value + 1, pstTable->pse[i].pszValue);
+        strcat(tmp_value, "\"");
+        RtlCreateUnicodeStringFromAsciiz(&name, pstTable->pse[i].pszName);
+        RtlCreateUnicodeStringFromAsciiz(&value, tmp_value);
+        WritePrivateProfileStringW(Strings, name.Buffer, value.Buffer, tmp_ini_path);
+        RtlFreeUnicodeString(&name);
+        RtlFreeUnicodeString(&value);
+    }
+    /* flush cache */
+    WritePrivateProfileStringW(NULL, NULL, NULL, tmp_ini_path);
+
+
+    if((hinf = SetupOpenInfFileW(tmp_ini_path, NULL, INF_STYLE_WIN4, NULL)) ==
+       INVALID_HANDLE_VALUE) {
+        ERR("Setupapi can't open inf\n");
+        return E_FAIL;
+    }
+
+    /* append any layout files */
+    SetupOpenAppendInfFileW(NULL, hinf, NULL);
+
+    /* Need to do a lot more here */
+    RtlCreateUnicodeStringFromAsciiz(&section, pszSection);
+    SetupInstallFromInfSectionW(NULL, hinf, section.Buffer,
+                                SPINST_INIFILES | SPINST_REGISTRY | SPINST_PROFILEITEMS,
+                                HKEY_LOCAL_MACHINE, NULL, 0, NULL, NULL, NULL, NULL);
+    RtlFreeUnicodeString(&section);
+
+    
+    SetupCloseInfFile(hinf);
+    DeleteFileW(tmp_ini_path);
+
+    return S_OK;
+}
diff --git a/include/Makefile.in b/include/Makefile.in
index 61677a8..9bc19b7 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -42,6 +42,7 @@
 	$(IDL_INCLUDES) \
 	accctrl.h \
 	aclapi.h \
+	advpub.h \
 	audevcod.h \
 	aviriff.h \
 	basetsd.h \
diff --git a/include/advpub.h b/include/advpub.h
new file mode 100644
index 0000000..243b1b9
--- /dev/null
+++ b/include/advpub.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004 Huw D M Davies
+ *
+ * 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
+ */
+#ifndef __WINE_ADVPUB_H
+#define __WINE_ADVPUB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _StrEntry {
+    LPSTR pszName;
+    LPSTR pszValue;
+} STRENTRY, *LPSTRENTRY;
+
+typedef const STRENTRY CSTRENTRY;
+typedef CSTRENTRY *LPCSTRENTRY;
+
+typedef struct _StrTable {
+    DWORD cEntries;
+    LPSTRENTRY pse;
+} STRTABLE, *LPSTRTABLE;
+
+typedef const STRTABLE CSTRTABLE;
+typedef CSTRTABLE *LPCSTRTABLE;
+
+HRESULT WINAPI RegInstall(HMODULE hm, LPCSTR pszSection, LPCSTRTABLE pstTable);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINE_ADVPUB_H */