widl: Updated to Wine 4.19.
diff --git a/mingw-w64-tools/widl/VERSION b/mingw-w64-tools/widl/VERSION
index 3be7927..8ae3d20 100644
--- a/mingw-w64-tools/widl/VERSION
+++ b/mingw-w64-tools/widl/VERSION
@@ -1 +1 @@
-WIDL version 4.14
+WIDL version 4.19
diff --git a/mingw-w64-tools/widl/configure b/mingw-w64-tools/widl/configure
index 8419aa5..07da577 100755
--- a/mingw-w64-tools/widl/configure
+++ b/mingw-w64-tools/widl/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for widl 4.14.
+# Generated by GNU Autoconf 2.69 for widl 4.19.
 #
 # Report bugs to <mingw-w64-public@lists.sourceforge.net>.
 #
@@ -580,8 +580,8 @@
 # Identity of this package.
 PACKAGE_NAME='widl'
 PACKAGE_TARNAME='widl'
-PACKAGE_VERSION='4.14'
-PACKAGE_STRING='widl 4.14'
+PACKAGE_VERSION='4.19'
+PACKAGE_STRING='widl 4.19'
 PACKAGE_BUGREPORT='mingw-w64-public@lists.sourceforge.net'
 PACKAGE_URL=''
 
@@ -1284,7 +1284,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures widl 4.14 to adapt to many kinds of systems.
+\`configure' configures widl 4.19 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1355,7 +1355,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of widl 4.14:";;
+     short | recursive ) echo "Configuration of widl 4.19:";;
    esac
   cat <<\_ACEOF
 
@@ -1457,7 +1457,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-widl configure 4.14
+widl configure 4.19
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2010,7 +2010,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by widl $as_me 4.14, which was
+It was created by widl $as_me 4.19, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2988,7 +2988,7 @@
 
 # Define the identity of the package.
  PACKAGE='widl'
- VERSION='4.14'
+ VERSION='4.19'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -5422,7 +5422,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by widl $as_me 4.14, which was
+This file was extended by widl $as_me 4.19, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5488,7 +5488,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-widl config.status 4.14
+widl config.status 4.19
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/mingw-w64-tools/widl/include/threadpoolapiset.h b/mingw-w64-tools/widl/include/threadpoolapiset.h
new file mode 100644
index 0000000..010ee3a
--- /dev/null
+++ b/mingw-w64-tools/widl/include/threadpoolapiset.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2019 Hans Leidekker 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _THREADPOOLAPISET_H_
+#define _THREADPOOLAPISET_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (CALLBACK *PTP_WIN32_IO_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PVOID,ULONG,ULONG_PTR,PTP_IO);
+
+WINBASEAPI void        WINAPI CancelThreadpoolIo(TP_IO*);
+WINBASEAPI void        WINAPI CloseThreadpool(PTP_POOL);
+WINBASEAPI void        WINAPI CloseThreadpoolCleanupGroup(PTP_CLEANUP_GROUP);
+WINBASEAPI void        WINAPI CloseThreadpoolCleanupGroupMembers(PTP_CLEANUP_GROUP,BOOL,PVOID);
+WINBASEAPI void        WINAPI CloseThreadpoolIo(TP_IO*);
+WINBASEAPI void        WINAPI CloseThreadpoolTimer(PTP_TIMER);
+WINBASEAPI void        WINAPI CloseThreadpoolWait(PTP_WAIT);
+WINBASEAPI void        WINAPI CloseThreadpoolWork(PTP_WORK);
+WINBASEAPI PTP_POOL    WINAPI CreateThreadpool(PVOID);
+WINBASEAPI PTP_CLEANUP_GROUP WINAPI CreateThreadpoolCleanupGroup(void);
+WINBASEAPI PTP_IO      WINAPI CreateThreadpoolIo(HANDLE,PTP_WIN32_IO_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON);
+WINBASEAPI PTP_TIMER   WINAPI CreateThreadpoolTimer(PTP_TIMER_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON);
+WINBASEAPI PTP_WAIT    WINAPI CreateThreadpoolWait(PTP_WAIT_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON);
+WINBASEAPI PTP_WORK    WINAPI CreateThreadpoolWork(PTP_WORK_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON);
+WINBASEAPI void        WINAPI DisassociateCurrentThreadFromCallback(PTP_CALLBACK_INSTANCE);
+WINBASEAPI void        WINAPI FreeLibraryWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HMODULE);
+WINBASEAPI BOOL        WINAPI IsThreadpoolTimerSet(PTP_TIMER);
+WINBASEAPI void        WINAPI LeaveCriticalSectionWhenCallbackReturns(PTP_CALLBACK_INSTANCE,RTL_CRITICAL_SECTION*);
+WINBASEAPI void        WINAPI ReleaseMutexWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HANDLE);
+WINBASEAPI void        WINAPI ReleaseSemaphoreWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HANDLE,DWORD);
+WINBASEAPI void        WINAPI SetEventWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HANDLE);
+WINBASEAPI void        WINAPI SetThreadpoolThreadMaximum(PTP_POOL,DWORD);
+WINBASEAPI BOOL        WINAPI SetThreadpoolThreadMinimum(PTP_POOL,DWORD);
+WINBASEAPI void        WINAPI SetThreadpoolTimer(PTP_TIMER,FILETIME*,DWORD,DWORD);
+WINBASEAPI void        WINAPI SetThreadpoolWait(PTP_WAIT,HANDLE,FILETIME *);
+WINBASEAPI void        WINAPI StartThreadpoolIo(TP_IO*);
+WINBASEAPI void        WINAPI SubmitThreadpoolWork(PTP_WORK);
+WINBASEAPI BOOL        WINAPI TrySubmitThreadpoolCallback(PTP_SIMPLE_CALLBACK,void*,TP_CALLBACK_ENVIRON*);
+WINBASEAPI void        WINAPI WaitForThreadpoolIoCallbacks(TP_IO*,BOOL);
+WINBASEAPI void        WINAPI WaitForThreadpoolTimerCallbacks(PTP_TIMER,BOOL);
+WINBASEAPI void        WINAPI WaitForThreadpoolWaitCallbacks(PTP_WAIT,BOOL);
+WINBASEAPI void        WINAPI WaitForThreadpoolWorkCallbacks(PTP_WORK,BOOL);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _THREADPOOLAPISET_H_ */
diff --git a/mingw-w64-tools/widl/include/winbase.h b/mingw-w64-tools/widl/include/winbase.h
index 7c2d680..90179b3 100644
--- a/mingw-w64-tools/widl/include/winbase.h
+++ b/mingw-w64-tools/widl/include/winbase.h
@@ -39,6 +39,7 @@
 
 #include <libloaderapi.h>
 #include <synchapi.h>
+#include <threadpoolapiset.h>
 
   /* Windows Exit Procedure flag values */
 #define	WEP_FREE_DLL        0
@@ -961,11 +962,29 @@
   BYTE    ACLineStatus;
   BYTE    BatteryFlag;
   BYTE    BatteryLifePercent;
-  BYTE    Reserved1;
+  BYTE    SystemStatusFlag;
   DWORD   BatteryLifeTime;
   DWORD   BatteryFullLifeTime;
 } SYSTEM_POWER_STATUS, *LPSYSTEM_POWER_STATUS;
 
+#define AC_LINE_OFFLINE         0x00
+#define AC_LINE_ONLINE          0x01
+#define AC_LINE_BACKUP_POWER    0x02
+#define AC_LINE_UNKNOWN         0xFF
+
+#define BATTERY_FLAG_HIGH           0x01
+#define BATTERY_FLAG_LOW            0x02
+#define BATTERY_FLAG_CRITICAL       0x04
+#define BATTERY_FLAG_CHARGING       0x08
+#define BATTERY_FLAG_NO_BATTERY     0x80
+#define BATTERY_FLAG_UNKNOWN        0xFF
+
+#define BATTERY_PERCENTAGE_UNKNOWN  0xFF
+
+#define SYSTEM_STATUS_FLAG_POWER_SAVING_ON  0x01
+
+#define BATTERY_LIFE_UNKNOWN 0xFFFFFFFF
+
 typedef struct _SYSTEM_INFO
 {
     union {
@@ -1809,12 +1828,6 @@
 #define                       ClearEventLog WINELIB_NAME_AW(ClearEventLog)
 WINADVAPI  BOOL        WINAPI CloseEventLog(HANDLE);
 WINBASEAPI BOOL        WINAPI CloseHandle(HANDLE);
-WINBASEAPI VOID        WINAPI CloseThreadpool(PTP_POOL);
-WINBASEAPI VOID        WINAPI CloseThreadpoolCleanupGroup(PTP_CLEANUP_GROUP);
-WINBASEAPI VOID        WINAPI CloseThreadpoolCleanupGroupMembers(PTP_CLEANUP_GROUP,BOOL,PVOID);
-WINBASEAPI VOID        WINAPI CloseThreadpoolTimer(PTP_TIMER);
-WINBASEAPI VOID        WINAPI CloseThreadpoolWait(PTP_WAIT);
-WINBASEAPI VOID        WINAPI CloseThreadpoolWork(PTP_WORK);
 WINBASEAPI BOOL        WINAPI CommConfigDialogA(LPCSTR,HWND,LPCOMMCONFIG);
 WINBASEAPI BOOL        WINAPI CommConfigDialogW(LPCWSTR,HWND,LPCOMMCONFIG);
 #define                       CommConfigDialog WINELIB_NAME_AW(CommConfigDialog)
@@ -1878,12 +1891,6 @@
 WINADVAPI  BOOL        WINAPI CreatePrivateObjectSecurity(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR*,BOOL,HANDLE,PGENERIC_MAPPING);
 WINADVAPI  BOOL        WINAPI CreatePrivateObjectSecurityEx(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR*,GUID*,BOOL,ULONG,HANDLE,PGENERIC_MAPPING);
 WINADVAPI  BOOL        WINAPI CreatePrivateObjectSecurityWithMultipleInheritance(PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR*,GUID**,ULONG,BOOL,ULONG,HANDLE,PGENERIC_MAPPING);
-WINBASEAPI PTP_POOL    WINAPI CreateThreadpool(PVOID);
-WINBASEAPI PTP_CLEANUP_GROUP WINAPI CreateThreadpoolCleanupGroup(void);
-WINBASEAPI PTP_IO      WINAPI CreateThreadpoolIo(HANDLE,PTP_WIN32_IO_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON);
-WINBASEAPI PTP_TIMER   WINAPI CreateThreadpoolTimer(PTP_TIMER_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON);
-WINBASEAPI PTP_WAIT    WINAPI CreateThreadpoolWait(PTP_WAIT_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON);
-WINBASEAPI PTP_WORK    WINAPI CreateThreadpoolWork(PTP_WORK_CALLBACK,PVOID,PTP_CALLBACK_ENVIRON);
 WINBASEAPI BOOL        WINAPI CreateProcessA(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,LPVOID,LPCSTR,LPSTARTUPINFOA,LPPROCESS_INFORMATION);
 WINBASEAPI BOOL        WINAPI CreateProcessW(LPCWSTR,LPWSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,LPVOID,LPCWSTR,LPSTARTUPINFOW,LPPROCESS_INFORMATION);
 #define                       CreateProcess WINELIB_NAME_AW(CreateProcess)
@@ -1958,7 +1965,6 @@
 WINADVAPI  BOOL        WINAPI DestroyPrivateObjectSecurity(PSECURITY_DESCRIPTOR*);
 WINBASEAPI BOOL        WINAPI DeviceIoControl(HANDLE,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
 WINBASEAPI BOOL        WINAPI DisableThreadLibraryCalls(HMODULE);
-WINBASEAPI VOID        WINAPI DisassociateCurrentThreadFromCallback(PTP_CALLBACK_INSTANCE);
 WINBASEAPI BOOL        WINAPI DisconnectNamedPipe(HANDLE);
 WINBASEAPI BOOL        WINAPI DnsHostnameToComputerNameA(LPCSTR,LPSTR,LPDWORD);
 WINBASEAPI BOOL        WINAPI DnsHostnameToComputerNameW(LPCWSTR,LPWSTR,LPDWORD);
@@ -2076,7 +2082,6 @@
 #define                       FreeEnvironmentStrings WINELIB_NAME_AW(FreeEnvironmentStrings)
 WINBASEAPI BOOL        WINAPI FreeLibrary(HMODULE);
 WINBASEAPI VOID DECLSPEC_NORETURN WINAPI FreeLibraryAndExitThread(HINSTANCE,DWORD);
-WINBASEAPI VOID        WINAPI FreeLibraryWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HMODULE);
 #define                       FreeModule(handle) FreeLibrary(handle)
 #define                       FreeProcInstance(proc) /*nothing*/
 WINBASEAPI BOOL        WINAPI FreeResource(HGLOBAL);
@@ -2154,6 +2159,9 @@
 #define                       GetFileAttributesEx WINELIB_NAME_AW(GetFileAttributesEx)
 WINBASEAPI BOOL        WINAPI GetFileInformationByHandle(HANDLE,BY_HANDLE_FILE_INFORMATION*);
 WINBASEAPI BOOL        WINAPI GetFileInformationByHandleEx(HANDLE,FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD);
+WINBASEAPI DWORD       WINAPI GetFinalPathNameByHandleA(HANDLE,LPSTR,DWORD,DWORD);
+WINBASEAPI DWORD       WINAPI GetFinalPathNameByHandleW(HANDLE,LPWSTR,DWORD,DWORD);
+#define                       GetFinalPathNameByHandle WINELIB_NAME_AW(GetFinalPathNameByHandle)
 WINADVAPI  BOOL        WINAPI GetFileSecurityA(LPCSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,DWORD,LPDWORD);
 WINADVAPI  BOOL        WINAPI GetFileSecurityW(LPCWSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,DWORD,LPDWORD);
 #define                       GetFileSecurity WINELIB_NAME_AW(GetFileSecurity)
@@ -2398,7 +2406,6 @@
 WINBASEAPI BOOL        WINAPI IsDebuggerPresent(void);
 WINBASEAPI BOOL        WINAPI IsSystemResumeAutomatic(void);
 WINADVAPI  BOOL        WINAPI IsTextUnicode(LPCVOID,INT,LPINT);
-WINBASEAPI BOOL        WINAPI IsThreadpoolTimerSet(PTP_TIMER);
 WINADVAPI  BOOL        WINAPI IsTokenRestricted(HANDLE);
 WINADVAPI  BOOL        WINAPI IsValidAcl(PACL);
 WINADVAPI  BOOL        WINAPI IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR);
@@ -2411,7 +2418,6 @@
 WINBASEAPI BOOL        WINAPI IsProcessInJob(HANDLE,HANDLE,PBOOL);
 WINBASEAPI BOOL        WINAPI IsProcessorFeaturePresent(DWORD);
 WINBASEAPI void        WINAPI LeaveCriticalSection(CRITICAL_SECTION *lpCrit);
-WINBASEAPI VOID        WINAPI LeaveCriticalSectionWhenCallbackReturns(PTP_CALLBACK_INSTANCE,CRITICAL_SECTION*);
 WINBASEAPI HMODULE     WINAPI LoadLibraryA(LPCSTR);
 WINBASEAPI HMODULE     WINAPI LoadLibraryW(LPCWSTR);
 #define                       LoadLibrary WINELIB_NAME_AW(LoadLibrary)
@@ -2574,9 +2580,7 @@
 WINBASEAPI HANDLE      WINAPI RegisterWaitForSingleObjectEx(HANDLE,WAITORTIMERCALLBACK,PVOID,ULONG,ULONG);
 WINBASEAPI VOID        WINAPI ReleaseActCtx(HANDLE);
 WINBASEAPI BOOL        WINAPI ReleaseMutex(HANDLE);
-WINBASEAPI VOID        WINAPI ReleaseMutexWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HANDLE);
 WINBASEAPI BOOL        WINAPI ReleaseSemaphore(HANDLE,LONG,LPLONG);
-WINBASEAPI VOID        WINAPI ReleaseSemaphoreWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HANDLE,DWORD);
 WINBASEAPI VOID        WINAPI ReleaseSRWLockExclusive(PSRWLOCK);
 WINBASEAPI VOID        WINAPI ReleaseSRWLockShared(PSRWLOCK);
 WINBASEAPI ULONG       WINAPI RemoveVectoredExceptionHandler(PVOID);
@@ -2627,7 +2631,6 @@
 #define                       SetEnvironmentVariable WINELIB_NAME_AW(SetEnvironmentVariable)
 WINBASEAPI UINT        WINAPI SetErrorMode(UINT);
 WINBASEAPI BOOL        WINAPI SetEvent(HANDLE);
-WINBASEAPI VOID        WINAPI SetEventWhenCallbackReturns(PTP_CALLBACK_INSTANCE,HANDLE);
 WINBASEAPI VOID        WINAPI SetFileApisToANSI(void);
 WINBASEAPI VOID        WINAPI SetFileApisToOEM(void);
 WINBASEAPI BOOL        WINAPI SetFileAttributesA(LPCSTR,DWORD);
@@ -2651,6 +2654,7 @@
 WINBASEAPI BOOL        WINAPI SetNamedPipeHandleState(HANDLE,LPDWORD,LPDWORD,LPDWORD);
 WINBASEAPI BOOL        WINAPI SetPriorityClass(HANDLE,DWORD);
 WINADVAPI  BOOL        WINAPI SetPrivateObjectSecurity(SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR*,PGENERIC_MAPPING,HANDLE);
+WINADVAPI  BOOL        WINAPI SetPrivateObjectSecurityEx(SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,PSECURITY_DESCRIPTOR*,ULONG,PGENERIC_MAPPING,HANDLE);
 WINBASEAPI BOOL        WINAPI SetProcessAffinityMask(HANDLE,DWORD_PTR);
 WINBASEAPI BOOL        WINAPI SetProcessPriorityBoost(HANDLE,BOOL);
 WINBASEAPI BOOL        WINAPI SetProcessShutdownParameters(DWORD,DWORD);
@@ -2663,6 +2667,7 @@
 WINADVAPI  BOOL        WINAPI SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR,PSID,BOOL);
 WINADVAPI  BOOL        WINAPI SetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR,BOOL,PACL,BOOL);
 WINBASEAPI BOOL        WINAPI SetStdHandle(DWORD,HANDLE);
+WINBASEAPI BOOL        WINAPI SetStdHandleEx(DWORD,HANDLE,HANDLE*);
 #define                       SetSwapAreaSize(w) (w)
 WINBASEAPI BOOL        WINAPI SetSystemPowerState(BOOL,BOOL);
 WINBASEAPI BOOL        WINAPI SetSystemTime(const SYSTEMTIME*);
@@ -2674,13 +2679,9 @@
 WINBASEAPI BOOL        WINAPI SetThreadErrorMode(DWORD,LPDWORD);
 WINBASEAPI DWORD       WINAPI SetThreadExecutionState(EXECUTION_STATE);
 WINBASEAPI DWORD       WINAPI SetThreadIdealProcessor(HANDLE,DWORD);
-WINBASEAPI VOID        WINAPI SetThreadpoolThreadMaximum(PTP_POOL,DWORD);
-WINBASEAPI BOOL        WINAPI SetThreadpoolThreadMinimum(PTP_POOL,DWORD);
 WINBASEAPI BOOL        WINAPI SetThreadPriority(HANDLE,INT);
 WINBASEAPI BOOL        WINAPI SetThreadPriorityBoost(HANDLE,BOOL);
 WINADVAPI  BOOL        WINAPI SetThreadToken(PHANDLE,HANDLE);
-WINBASEAPI VOID        WINAPI SetThreadpoolTimer(PTP_TIMER,FILETIME*,DWORD,DWORD);
-WINBASEAPI VOID        WINAPI SetThreadpoolWait(PTP_WAIT,HANDLE,FILETIME *);
 WINBASEAPI HANDLE      WINAPI SetTimerQueueTimer(HANDLE,WAITORTIMERCALLBACK,PVOID,DWORD,DWORD,BOOL);
 WINBASEAPI BOOL        WINAPI SetTimeZoneInformation(const TIME_ZONE_INFORMATION *);
 WINADVAPI  BOOL        WINAPI SetTokenInformation(HANDLE,TOKEN_INFORMATION_CLASS,LPVOID,DWORD);
@@ -2701,7 +2702,6 @@
 WINBASEAPI BOOL        WINAPI SleepConditionVariableCS(PCONDITION_VARIABLE,PCRITICAL_SECTION,DWORD);
 WINBASEAPI BOOL        WINAPI SleepConditionVariableSRW(PCONDITION_VARIABLE,PSRWLOCK,DWORD,ULONG);
 WINBASEAPI DWORD       WINAPI SleepEx(DWORD,BOOL);
-WINBASEAPI VOID        WINAPI SubmitThreadpoolWork(PTP_WORK);
 WINBASEAPI DWORD       WINAPI SuspendThread(HANDLE);
 WINBASEAPI void        WINAPI SwitchToFiber(LPVOID);
 WINBASEAPI BOOL        WINAPI SwitchToThread(void);
@@ -2719,7 +2719,6 @@
 WINBASEAPI BOOLEAN     WINAPI TryAcquireSRWLockExclusive(PSRWLOCK);
 WINBASEAPI BOOLEAN     WINAPI TryAcquireSRWLockShared(PSRWLOCK);
 WINBASEAPI BOOL        WINAPI TryEnterCriticalSection(CRITICAL_SECTION *lpCrit);
-WINBASEAPI BOOL        WINAPI TrySubmitThreadpoolCallback(PTP_SIMPLE_CALLBACK,void*,TP_CALLBACK_ENVIRON*);
 WINBASEAPI BOOL        WINAPI TzSpecificLocalTimeToSystemTime(const TIME_ZONE_INFORMATION*,const SYSTEMTIME*,LPSYSTEMTIME);
 WINBASEAPI LONG        WINAPI UnhandledExceptionFilter(PEXCEPTION_POINTERS);
 WINBASEAPI BOOL        WINAPI UnlockFile(HANDLE,DWORD,DWORD,DWORD,DWORD);
@@ -2756,9 +2755,6 @@
 WINBASEAPI DWORD       WINAPI WaitForMultipleObjectsEx(DWORD,const HANDLE*,BOOL,DWORD,BOOL);
 WINBASEAPI DWORD       WINAPI WaitForSingleObject(HANDLE,DWORD);
 WINBASEAPI DWORD       WINAPI WaitForSingleObjectEx(HANDLE,DWORD,BOOL);
-WINBASEAPI VOID        WINAPI WaitForThreadpoolTimerCallbacks(PTP_TIMER,BOOL);
-WINBASEAPI VOID        WINAPI WaitForThreadpoolWaitCallbacks(PTP_WAIT,BOOL);
-WINBASEAPI VOID        WINAPI WaitForThreadpoolWorkCallbacks(PTP_WORK,BOOL);
 WINBASEAPI BOOL        WINAPI WaitNamedPipeA(LPCSTR,DWORD);
 WINBASEAPI BOOL        WINAPI WaitNamedPipeW(LPCWSTR,DWORD);
 #define                       WaitNamedPipe WINELIB_NAME_AW(WaitNamedPipe)
diff --git a/mingw-w64-tools/widl/include/winnls.h b/mingw-w64-tools/widl/include/winnls.h
index e790da4..e810c44 100644
--- a/mingw-w64-tools/widl/include/winnls.h
+++ b/mingw-w64-tools/widl/include/winnls.h
@@ -833,6 +833,7 @@
 
 enum SYSGEOCLASS
 {
+    GEOCLASS_ALL = 0,
     GEOCLASS_REGION = 14,
     GEOCLASS_NATION = 16
 };
diff --git a/mingw-w64-tools/widl/include/winnt.h b/mingw-w64-tools/widl/include/winnt.h
index 67d33f0..9c39eb7 100644
--- a/mingw-w64-tools/widl/include/winnt.h
+++ b/mingw-w64-tools/widl/include/winnt.h
@@ -76,6 +76,16 @@
 # endif
 #endif
 
+#ifndef DECLSPEC_NOTHROW
+# if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
+#  define DECLSPEC_NOTHROW __declspec(nothrow)
+# elif defined(__GNUC__)
+#  define DECLSPEC_NOTHROW __attribute__((nothrow))
+# else
+#  define DECLSPEC_NOTHROW
+# endif
+#endif
+
 #ifndef DECLSPEC_CACHEALIGN
 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
 #endif
@@ -163,7 +173,11 @@
 # define DECLSPEC_HIDDEN
 #endif
 
-#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))) && (defined(__i386__) || defined(__x86_64__))
+#ifndef __has_attribute
+# define __has_attribute(x) 0
+#endif
+
+#if ((defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)))) || __has_attribute(ms_hook_prologue)) && (defined(__i386__) || defined(__x86_64__))
 #define DECLSPEC_HOTPATCH __attribute__((__ms_hook_prologue__))
 #else
 #define DECLSPEC_HOTPATCH
@@ -5603,7 +5617,8 @@
 	BOOLEAN BatteryPresent;
 	BOOLEAN Charging;
 	BOOLEAN Discharging;
-	BOOLEAN Spare1[4];
+	BOOLEAN Spare1[3];
+	BYTE Tag;
 	ULONG MaxCapacity;
 	ULONG RemainingCapacity;
 	ULONG Rate;
@@ -6602,7 +6617,6 @@
 typedef VOID (CALLBACK *PTP_WORK_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PTP_WORK);
 typedef VOID (CALLBACK *PTP_TIMER_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PTP_TIMER);
 typedef VOID (CALLBACK *PTP_WAIT_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PTP_WAIT,TP_WAIT_RESULT);
-typedef VOID (CALLBACK *PTP_WIN32_IO_CALLBACK)(PTP_CALLBACK_INSTANCE,PVOID,PVOID,ULONG,ULONG_PTR,PTP_IO);
 
 
 NTSYSAPI BOOLEAN NTAPI RtlGetProductInfo(DWORD,DWORD,DWORD,DWORD,PDWORD);
diff --git a/mingw-w64-tools/widl/src/typegen.c b/mingw-w64-tools/widl/src/typegen.c
index 1ad3e63..f37c7b0 100644
--- a/mingw-w64-tools/widl/src/typegen.c
+++ b/mingw-w64-tools/widl/src/typegen.c
@@ -3611,7 +3611,8 @@
         {
             int ptr_type;
             ptr_type = get_pointer_fc_context(type, attrs, context);
-            if (ptr_type != FC_RP || type_array_is_decl_as_ptr(type))
+            if (type_array_is_decl_as_ptr(type)
+                    || (ptr_type != FC_RP && context == TYPE_CONTEXT_TOPLEVELPARAM))
             {
                 unsigned int absoff = type->typestring_offset;
                 short reloff = absoff - (*typeformat_offset + 2);
@@ -3864,16 +3865,13 @@
         }
 
     case TGT_ARRAY:
-        if (get_pointer_fc(type, attrs, toplevel_param) == FC_RP)
+        switch (get_array_fc(type))
         {
-            switch (get_array_fc(type))
-            {
-            case FC_SMFARRAY:
-            case FC_LGFARRAY:
-                return type_array_get_dim(type) *
-                    get_required_buffer_size_type(type_array_get_element_type(type), name,
-                                                  NULL, FALSE, alignment);
-            }
+        case FC_SMFARRAY:
+        case FC_LGFARRAY:
+            return type_array_get_dim(type) *
+                get_required_buffer_size_type(type_array_get_element_type(type), name,
+                                              NULL, FALSE, alignment);
         }
         break;
 
diff --git a/mingw-w64-tools/widl/src/typelib.c b/mingw-w64-tools/widl/src/typelib.c
index 79e72e0..cf02755 100644
--- a/mingw-w64-tools/widl/src/typelib.c
+++ b/mingw-w64-tools/widl/src/typelib.c
@@ -64,7 +64,6 @@
   {"VARIANT",       VT_VARIANT},
   {"VARIANT_BOOL",  VT_BOOL}
 };
-#define NTYPES (sizeof(oatypes)/sizeof(oatypes[0]))
 #define KWP(p) ((const struct oatype *)(p))
 
 static int kw_cmp_func(const void *s1, const void *s2)
@@ -79,11 +78,11 @@
   const struct oatype *kwp;
   key.kw = kw;
 #ifdef KW_BSEARCH
-  kwp = bsearch(&key, oatypes, NTYPES, sizeof(oatypes[0]), kw_cmp_func);
+  kwp = bsearch(&key, oatypes, ARRAY_SIZE(oatypes), sizeof(oatypes[0]), kw_cmp_func);
 #else
   {
     unsigned int i;
-    for (kwp=NULL, i=0; i < NTYPES; i++)
+    for (kwp = NULL, i = 0; i < ARRAY_SIZE(oatypes); i++)
       if (!kw_cmp_func(&key, &oatypes[i])) {
         kwp = &oatypes[i];
         break;
diff --git a/mingw-w64-tools/widl/src/typelib_struct.h b/mingw-w64-tools/widl/src/typelib_struct.h
index 0d9f8eb..58dd95e 100644
--- a/mingw-w64-tools/widl/src/typelib_struct.h
+++ b/mingw-w64-tools/widl/src/typelib_struct.h
@@ -327,7 +327,7 @@
 } SLTG_BlkEntry;
 
 /* The order of the blocks in the file is given by starting at Block
-   entry firt_blk and stepping through using the next pointer */
+   entry first_blk and stepping through using the next pointer */
 
 /* These then get followed by this magic */
 typedef struct {
diff --git a/mingw-w64-tools/widl/src/utils.c b/mingw-w64-tools/widl/src/utils.c
index 9066887..20c6306 100644
--- a/mingw-w64-tools/widl/src/utils.c
+++ b/mingw-w64-tools/widl/src/utils.c
@@ -309,7 +309,7 @@
     size_t data_size = output_buffer_pos;
     size_t header_size = 5 * sizeof(unsigned int) + 2 * sizeof(unsigned short);
 
-    assert( nb_resources < sizeof(resources)/sizeof(resources[0]) );
+    assert( nb_resources < ARRAY_SIZE( resources ));
 
     if (type[0] != '#') header_size += (strlen( type ) + 1) * sizeof(unsigned short);
     else header_size += 2 * sizeof(unsigned short);
diff --git a/mingw-w64-tools/widl/src/utils.h b/mingw-w64-tools/widl/src/utils.h
index ec02fc7..74dba11 100644
--- a/mingw-w64-tools/widl/src/utils.h
+++ b/mingw-w64-tools/widl/src/utils.h
@@ -34,6 +34,8 @@
 #define __attribute__(X)
 #endif
 
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
 void parser_error(const char *s) __attribute__((noreturn));
 int parser_warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
 void error_loc(const char *s, ...) __attribute__((format (printf, 1, 2))) __attribute__((noreturn));
diff --git a/mingw-w64-tools/widl/src/widl.c b/mingw-w64-tools/widl/src/widl.c
index 9e38edd..bf69522 100644
--- a/mingw-w64-tools/widl/src/widl.c
+++ b/mingw-w64-tools/widl/src/widl.c
@@ -303,7 +303,7 @@
 
     if (!(p = strchr( spec, '-' ))) error( "Invalid target specification '%s'\n", target );
     *p++ = 0;
-    for (i = 0; i < sizeof(cpu_names)/sizeof(cpu_names[0]); i++)
+    for (i = 0; i < ARRAY_SIZE( cpu_names ); i++)
     {
         if (!strcmp( cpu_names[i].name, spec ))
         {
diff --git a/mingw-w64-tools/widl/wine-import.sh b/mingw-w64-tools/widl/wine-import.sh
index 34b66cc..3a93d8a 100755
--- a/mingw-w64-tools/widl/wine-import.sh
+++ b/mingw-w64-tools/widl/wine-import.sh
@@ -30,7 +30,8 @@
 	fi
 done
 
-for f in basetsd.h guiddef.h excpt.h ndrtypes.h poppack.h pshpack1.h pshpack2.h pshpack4.h pshpack8.h winbase.h windef.h winerror.h winnls.h winnt.h winnt.rh synchapi.h
+for f in basetsd.h guiddef.h excpt.h ndrtypes.h poppack.h pshpack1.h pshpack2.h pshpack4.h pshpack8.h threadpoolapiset.h \
+        winbase.h windef.h winerror.h winnls.h winnt.h winnt.rh synchapi.h
 do
 	cp $WINE_DIR/include/$f include
 done