diff --git a/configure b/configure
index 784b34492e696c96354224070449c5a01a42b048..57c9f703b02bec995e523b845465c971dfb50ee7 100755
--- a/configure
+++ b/configure
@@ -19985,7 +19985,7 @@ MAKE_LIB_RULES=libs/Makelib.rules
 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/advpack/Makefile dlls/advpack/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/cryptdll/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/lzexpand/tests/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/mscms/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msi/tests/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/rsaenh/Makefile dlls/rsaenh/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/advpack/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/cryptdll/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/lzexpand/tests/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/mscms/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msi/tests/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/rsaenh/Makefile dlls/rsaenh/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/wtsapi32/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
@@ -20718,6 +20718,7 @@ do
   "dlls/wintrust/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/wintrust/Makefile" ;;
   "dlls/wow32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/wow32/Makefile" ;;
   "dlls/wsock32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/wsock32/Makefile" ;;
+  "dlls/wtsapi32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/wtsapi32/Makefile" ;;
   "dlls/x11drv/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/x11drv/Makefile" ;;
   "documentation/Makefile" ) CONFIG_FILES="$CONFIG_FILES documentation/Makefile" ;;
   "fonts/Makefile" ) CONFIG_FILES="$CONFIG_FILES fonts/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index b7acb6af4e76262f7280c8e3c644238ec3938cbc..e83fa2d4fa03dc5bbf633c74e9171b110e6890ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1703,6 +1703,7 @@ dlls/wintab32/Makefile
 dlls/wintrust/Makefile
 dlls/wow32/Makefile
 dlls/wsock32/Makefile
+dlls/wtsapi32/Makefile
 dlls/x11drv/Makefile
 documentation/Makefile
 fonts/Makefile
diff --git a/dlls/Makefile.in b/dlls/Makefile.in
index 45684d182cf8afb9a5b86703543270a0568f081e..b392dc4e3dd5979a5a733469e2a61df316289f81 100644
--- a/dlls/Makefile.in
+++ b/dlls/Makefile.in
@@ -163,7 +163,8 @@ BASEDIRS = \
 	wintab32 \
 	wintrust \
 	wow32 \
-	wsock32
+	wsock32 \
+	wtsapi32
 
 SUBDIRS = \
 	$(BASEDIRS) \
@@ -396,7 +397,8 @@ SYMLINKS_SO = \
 	wnaspi32.dll.so \
 	wow32.dll.so \
 	ws2_32.dll.so \
-	wsock32.dll.so
+	wsock32.dll.so \
+	wtsapi32.dll.so
 
 # Main target
 
@@ -965,6 +967,9 @@ winsock.dll.so : ws2_32.dll.so
 wsock32.dll.so: wsock32/wsock32.dll.so
 	$(RM) $@ && $(LN_S) wsock32/wsock32.dll.so $@
 
+wtsapi32.dll.so: wtsapi32/wtsapi32.dll.so
+	$(RM) $@ && $(LN_S) wtsapi32/wtsapi32.dll.so $@
+
 x11drv.dll.so: x11drv/x11drv.dll.so
 	$(RM) $@ && $(LN_S) x11drv/x11drv.dll.so $@
 
@@ -1114,6 +1119,7 @@ IMPORT_LIBS = \
 	libwow32.$(IMPLIBEXT) \
 	libws2_32.$(IMPLIBEXT) \
 	libwsock32.$(IMPLIBEXT) \
+	libwtsapi32.$(IMPLIBEXT) \
 	libx11drv.$(IMPLIBEXT) \
 	libdxerr8.a \
 	libdxerr9.a \
@@ -1758,6 +1764,11 @@ libwsock32.def: wsock32/wsock32.spec.def
 libwsock32.a: wsock32/wsock32.spec.def
 	$(DLLTOOL) -k -l $@ -d wsock32/wsock32.spec.def
 
+libwtsapi32.def: wtsapi32/wtsapi32.spec.def
+	$(RM) $@ && $(LN_S) wtsapi32/wtsapi32.spec.def $@
+libwtsapi32.a: wtsapi32/wtsapi32.spec.def
+	$(DLLTOOL) -k -l $@ -d wtsapi32/wtsapi32.spec.def
+
 libx11drv.def: x11drv/x11drv.spec.def
 	$(RM) $@ && $(LN_S) x11drv/x11drv.spec.def $@
 libx11drv.a: x11drv/x11drv.spec.def
@@ -1890,6 +1901,7 @@ winaspi/wnaspi32.spec.def: $(WINEBUILD)
 wow32/wow32.spec.def: $(WINEBUILD)
 winsock/ws2_32.spec.def: $(WINEBUILD)
 wsock32/wsock32.spec.def: $(WINEBUILD)
+wtsapi32/wtsapi32.spec.def: $(WINEBUILD)
 x11drv/x11drv.spec.def: $(WINEBUILD)
 
 $(BUILDSUBDIRS): $(IMPORT_LIBS)
@@ -2053,6 +2065,7 @@ winaspi/wnaspi32.dll.so: winaspi
 wow32/wow32.dll.so: wow32
 winsock/ws2_32.dll.so: winsock
 wsock32/wsock32.dll.so: wsock32
+wtsapi32/wtsapi32.dll.so: wtsapi32
 x11drv/x11drv.dll.so: x11drv
 dxerr8/libdxerr8.a: dxerr8
 dxerr9/libdxerr9.a: dxerr9
diff --git a/dlls/wtsapi32/.cvsignore b/dlls/wtsapi32/.cvsignore
new file mode 100644
index 0000000000000000000000000000000000000000..aaacc8e4a0406a51e4e49aef34eafbcfc1f95022
--- /dev/null
+++ b/dlls/wtsapi32/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+wtsapi32.dll.dbg.c
+wtsapi32.spec.def
diff --git a/dlls/wtsapi32/Makefile.in b/dlls/wtsapi32/Makefile.in
new file mode 100644
index 0000000000000000000000000000000000000000..b76079f0c380a65fdd7bdc510ba13774296dd4cb
--- /dev/null
+++ b/dlls/wtsapi32/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = wtsapi32.dll
+IMPORTS   = kernel32
+
+C_SRCS = \
+	wtsapi32.c
+
+@MAKE_DLL_RULES@
+
+### Dependencies:
diff --git a/dlls/wtsapi32/wtsapi32.c b/dlls/wtsapi32/wtsapi32.c
new file mode 100644
index 0000000000000000000000000000000000000000..09a3c65d3f8891cbc77d27f4b5ef4aa115471443
--- /dev/null
+++ b/dlls/wtsapi32/wtsapi32.c
@@ -0,0 +1,77 @@
+/* Copyright 2005 Ulrich Czekalla
+ *
+ * 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 "config.h"
+#include <stdarg.h>
+#include <stdlib.h>
+#include "windef.h"
+#include "winbase.h"
+#include "wtsapi32.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wtsapi);
+
+HMODULE WTSAPI32_hModule = 0;
+
+BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+    TRACE("%p,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
+
+    switch (fdwReason) {
+        case DLL_PROCESS_ATTACH:
+        {
+            DisableThreadLibraryCalls(hinstDLL);
+            WTSAPI32_hModule = hinstDLL;
+            break;
+        }
+        case DLL_PROCESS_DETACH:
+        {
+            break;
+        }
+    }
+
+    return TRUE;
+}
+
+
+/************************************************************
+ *                WTSQuerySessionInformationW  (WTSAPI32.@)
+ */
+BOOL WINAPI WTSQuerySessionInformationW(
+    HANDLE hServer,
+    DWORD SessionId,
+    WTS_INFO_CLASS WTSInfoClass,
+    LPWSTR* Buffer,
+    DWORD* BytesReturned)
+{
+    /* FIXME: Forward request to winsta.dll::WinStationQueryInformationW */
+    FIXME("Stub %p 0x%08lx %d %p %p\n", hServer, SessionId, WTSInfoClass,
+        Buffer, BytesReturned);
+
+    return FALSE;
+}
+
+
+/************************************************************
+ *                WTSWaitSystemEvent (WTSAPI32.@)
+ */
+BOOL WINAPI WTSWaitSystemEvent(HANDLE hServer, DWORD Mask, DWORD* Flags)
+{
+    /* FIXME: Forward request to winsta.dll::WinStationWaitSystemEvent */
+    FIXME("Stub %p 0x%08lx %p\n", hServer, Mask, Flags);
+    return FALSE;
+}
diff --git a/dlls/wtsapi32/wtsapi32.spec b/dlls/wtsapi32/wtsapi32.spec
new file mode 100644
index 0000000000000000000000000000000000000000..108540ba2ee163db77c8c67e8e0b11ccf77ea9f6
--- /dev/null
+++ b/dlls/wtsapi32/wtsapi32.spec
@@ -0,0 +1,32 @@
+@ stub WTSCloseServer
+@ stub WTSDisconnectSession
+@ stub WTSEnumerateProcessA
+@ stub WTSEnumerateProcessW
+@ stub WTSEnumerateServersA
+@ stub WTSEnumerateServersW
+@ stub WTSEnumerateSessionsA
+@ stub WTSEnumerateSessionsW
+@ stub WTSFreeMemory
+@ stub WTSLogoffSession
+@ stub WTSOpenServerA
+@ stub WTSOpenServerW
+@ stub WTSQuerySessionInformationA
+@ stdcall WTSQuerySessionInformationW(long long long ptr ptr)
+@ stub WTSQueryUserConfigA
+@ stub WTSQueryUserConfigW
+@ stub WTSSendMessageA
+@ stub WTSSendMessageW
+@ stub WTSSetSessionInformationA
+@ stub WTSSetSessionInformationW
+@ stub WTSSetUserConfigA
+@ stub WTSSetUserConfigW
+@ stub WTSShutdownSystem
+@ stub WTSTerminateProcess
+@ stub WTSVirtualChannelClose
+@ stub WTSVirtualChannelOpen
+@ stub WTSVirtualChannelPurgeInput
+@ stub WTSVirtualChannelPurgeOutput
+@ stub WTSVirtualChannelQuery
+@ stub WTSVirtualChannelRead
+@ stub WTSVirtualChannelWrite
+@ stdcall WTSWaitSystemEvent(long long ptr)
diff --git a/include/Makefile.in b/include/Makefile.in
index a18bc795d74496a235a0ee840e14486755a4b7ca..9d45e4dcf100c8119f04bff18a3536b7a2684315 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -254,6 +254,7 @@ WINDOWS_INCLUDES = \
 	wshisotp.h \
 	wsipx.h \
 	wsnwlink.h \
+	wtsapi32.h \
 	xcmc.h \
 	zmouse.h
 
diff --git a/include/wtsapi32.h b/include/wtsapi32.h
new file mode 100644
index 0000000000000000000000000000000000000000..246adcf55cdb3ccd74ac4a7e894cc1085cc1437e
--- /dev/null
+++ b/include/wtsapi32.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2005 Ulrich Czekalla (For CodeWeavers)
+ *
+ * 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_WTSAPI32_H
+#define __WINE_WTSAPI32_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef enum tagWTS_INFO_CLASS
+{
+    WTSInitialProgram,
+    WTSApplicationName,
+    WTSWorkingDirectory,
+    WTSOEMId,
+    WTSSessionId,
+    WTSUserName,
+    WTSWinStationName,
+    WTSDomainName,
+    WTSConnectState,
+    WTSClientBuildNumber,
+    WTSClientName,
+    WTSClientDirectory,
+    WTSClientProductId,
+    WTSClientHardwareId,
+    WTSClientAddress,
+    WTSClientDisplay,
+    WTSClientProtocolType,
+} WTS_INFO_CLASS;
+
+
+BOOL WINAPI WTSQuerySessionInformationW(
+    HANDLE hServer,
+    DWORD SessionId,
+    WTS_INFO_CLASS WTSInfoClass,
+    LPWSTR * Buffer,
+    DWORD * BytesReturned
+    );
+
+BOOL WINAPI WTSQuerySessionInformationA(
+    HANDLE hServer,
+    DWORD SessionId,
+    WTS_INFO_CLASS WTSInfoClass,
+    LPSTR * Buffer,
+    DWORD * BytesReturned
+    );
+#define WTSQuerySessionInformation WINELIB_NAME_AW(WTSQuerySessionInformation)
+
+BOOL WINAPI WTSWaitSystemEvent(HANDLE hServer, DWORD Mask, DWORD* Flags);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif