Wget 1.19.1 update (#2948)
* 1. Updated wget to 1.19.1
2. Added patch for support of windows cert store
3. Added patch for taskbar progress using cmd
4. Minor changes to PKGBUILD to fix gettext issue after running autoconf
* Modified dependency to ${MINGW_PACKAGE_PREFIX}-libidn
* switch dependency back to libidn2 for proper compile in build system
* Fix 32bit build; build without c-ares for now makes it work
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
_realname=wget
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
|
||||
pkgver=1.18
|
||||
pkgver=1.19.1
|
||||
pkgrel=1
|
||||
pkgdesc='Wget retrieves files using HTTP, HTTPS and FTP (mingw-w64)'
|
||||
arch=('any')
|
||||
@@ -13,32 +13,54 @@ url='https://www.gnu.org/software/wget/'
|
||||
license=('GPL3')
|
||||
|
||||
depends=("${MINGW_PACKAGE_PREFIX}-pcre"
|
||||
"${MINGW_PACKAGE_PREFIX}-libidn"
|
||||
"${MINGW_PACKAGE_PREFIX}-libidn2"
|
||||
"${MINGW_PACKAGE_PREFIX}-openssl"
|
||||
)
|
||||
"${MINGW_PACKAGE_PREFIX}-c-ares"
|
||||
"${MINGW_PACKAGE_PREFIX}-gpgme")
|
||||
|
||||
source=("https://ftp.gnu.org/gnu/${_realname}/${_realname}-${pkgver}.tar.xz")
|
||||
sha256sums=('b5b55b75726c04c06fe253daec9329a6f1a3c0c1878e3ea76ebfebc139ea9cc1')
|
||||
source=("https://ftp.gnu.org/gnu/${_realname}/${_realname}-${pkgver}.tar.xz"
|
||||
taskbar-progress.patch
|
||||
openssl-windows-cert-store.patch
|
||||
gettext-reconfigure.patch)
|
||||
sha256sums=('0c950b9671881222a4d385b013c9604e98a8025d1988529dfca0e93617744cd2'
|
||||
'd5b662a4ee3f85d1c7d2f6e221c7e45f19189925e6774102114045fbfb2953b7'
|
||||
'528369e9339eeeec7066632a1badc91a190decc2842810a6bd89a49c62565423'
|
||||
'01cc37b22cb7f1fb0b9246f96422af703b877beb3145b50636f438fa2802ed29')
|
||||
options=('strip' '!libtool' 'staticlibs')
|
||||
|
||||
prepare() {
|
||||
cd $srcdir/${_realname}-${pkgver}
|
||||
#Patch for support of taskbar-progress in windows cmd
|
||||
patch -p1 -i $srcdir/taskbar-progress.patch
|
||||
#Patch for supporting windows certificate store if openssl cacerts is not found
|
||||
patch -p1 -i $srcdir/openssl-windows-cert-store.patch
|
||||
autoreconf -fiv
|
||||
}
|
||||
|
||||
build() {
|
||||
cd $srcdir/${_realname}-${pkgver}
|
||||
./configure --prefix=${MINGW_PREFIX} \
|
||||
local -a configure_opts
|
||||
if [ "$MINGW_CHOST" == "x86_64-w64-mingw32" ]; then
|
||||
configure_opts+=("--with-cares")
|
||||
fi
|
||||
|
||||
[[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
|
||||
mkdir -p ${srcdir}/build-${MINGW_CHOST} && cd ${srcdir}/build-${MINGW_CHOST}
|
||||
../${_realname}-${pkgver}/configure --prefix=${MINGW_PREFIX} \
|
||||
--build=${MINGW_CHOST} \
|
||||
--host=${MINGW_CHOST} \
|
||||
--target=${MINGW_CHOST} \
|
||||
--with-ssl=openssl
|
||||
|
||||
make
|
||||
--with-ssl=openssl \
|
||||
--with-metalink \
|
||||
--with-libidn=${MINGW_PREFIX} \
|
||||
--disable-xattr \
|
||||
"${configure_opts[@]}" \
|
||||
LIBS="-lole32"
|
||||
make GETTEXT_MACRO_VERSION="0.19"
|
||||
}
|
||||
|
||||
package() {
|
||||
cd ${srcdir}/${_realname}-${pkgver}
|
||||
make install DESTDIR="${pkgdir}"
|
||||
cd ${srcdir}/build-${MINGW_CHOST}
|
||||
make DESTDIR="${pkgdir}" GETTEXT_MACRO_VERSION="0.19" install
|
||||
|
||||
# Licenses
|
||||
install -Dm644 "${srcdir}/${_realname}-${pkgver}/README" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/README"
|
||||
|
||||
26
mingw-w64-wget/gettext-reconfigure.patch
Normal file
26
mingw-w64-wget/gettext-reconfigure.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 686f040..b704755 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -184,7 +184,7 @@ dnl
|
||||
dnl Gettext
|
||||
dnl
|
||||
AM_GNU_GETTEXT([external],[need-ngettext])
|
||||
-AM_GNU_GETTEXT_VERSION([0.18.1])
|
||||
+AM_GNU_GETTEXT_VERSION([0.19.8])
|
||||
|
||||
AC_PROG_RANLIB
|
||||
|
||||
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
|
||||
index 895218b..8277581 100644
|
||||
--- a/m4/gnulib-comp.m4
|
||||
+++ b/m4/gnulib-comp.m4
|
||||
@@ -513,7 +513,7 @@ AC_DEFUN([gl_INIT],
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([getsockname])
|
||||
dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac.
|
||||
- AM_GNU_GETTEXT_VERSION([0.18.1])
|
||||
+ AM_GNU_GETTEXT_VERSION([0.19.8])
|
||||
AC_SUBST([LIBINTL])
|
||||
AC_SUBST([LTLIBINTL])
|
||||
gl_GETTIME
|
||||
113
mingw-w64-wget/openssl-windows-cert-store.patch
Normal file
113
mingw-w64-wget/openssl-windows-cert-store.patch
Normal file
@@ -0,0 +1,113 @@
|
||||
diff --git a/src/openssl.c b/src/openssl.c
|
||||
index 0404d2d..f1cae1c 100644
|
||||
--- a/src/openssl.c
|
||||
+++ b/src/openssl.c
|
||||
@@ -169,6 +169,71 @@ static int ssl_true_initialized = 0;
|
||||
|
||||
Returns true on success, false otherwise. */
|
||||
|
||||
+/* Start: Windows SSL Cert Changes */
|
||||
+#ifdef WINDOWS
|
||||
+/* Local version of CERT_CONTEXT, to prevent from bringing in a specific
|
||||
+ version of the Windows SDK */
|
||||
+typedef struct _CERT_CONTEXT
|
||||
+{
|
||||
+ unsigned int dwCertEncodingType;
|
||||
+ unsigned char *pbCertEncoded;
|
||||
+ unsigned int cbCertEncoded;
|
||||
+ void* pCertInfo;
|
||||
+ void* hCertStore;
|
||||
+} CERT_CONTEXT, *PCERT_CONTEXT;typedef const CERT_CONTEXT *PCCERT_CONTEXT;
|
||||
+
|
||||
+/* Load crypt32.dll manually to prevent bringing it in unless used */
|
||||
+HMODULE Local_Crypt32()
|
||||
+{
|
||||
+ static HMODULE ret = NULL;
|
||||
+ if (!ret)
|
||||
+ {
|
||||
+ ret = LoadLibraryA("Crypt32.dll");
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+/* Bounce these APIs to our loaded version of crypt32.dll */
|
||||
+void* Local_CertOpenSystemStoreA(void* hprov, char* szSubsystemProtocol)
|
||||
+{
|
||||
+ if (Local_Crypt32())
|
||||
+ {
|
||||
+ static FARPROC ret = NULL;
|
||||
+ if (!ret)
|
||||
+ {
|
||||
+ ret = GetProcAddress(Local_Crypt32(), "CertOpenSystemStoreA");
|
||||
+ }
|
||||
+ if (ret)
|
||||
+ {
|
||||
+ typedef void* (WINAPI * PFN_Func)(void*, char*);
|
||||
+ return ((PFN_Func) ret)(hprov, szSubsystemProtocol);
|
||||
+ }
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+void* Local_CertEnumCertificatesInStore(void* hCertStore, void* pPrevCertContext)
|
||||
+{
|
||||
+ if (Local_Crypt32())
|
||||
+ {
|
||||
+ static FARPROC ret = NULL;
|
||||
+ if (!ret)
|
||||
+ {
|
||||
+ ret = GetProcAddress(Local_Crypt32(), "CertEnumCertificatesInStore");
|
||||
+ }
|
||||
+ if (ret)
|
||||
+ {
|
||||
+ typedef void* (WINAPI * PFN_Func)(void*, void*);
|
||||
+ return ((PFN_Func) ret)(hCertStore, pPrevCertContext);
|
||||
+ }
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+#define PKCS_7_ASN_ENCODING 0x00010000
|
||||
+#endif
|
||||
+/* End: Windows SSL Cert Changes */
|
||||
+
|
||||
bool
|
||||
ssl_init (void)
|
||||
{
|
||||
@@ -272,6 +337,36 @@ ssl_init (void)
|
||||
SSL_CTX_set_cipher_list (ssl_ctx, "HIGH:MEDIUM:!RC4:!SRP:!PSK:!RSA:!aNULL@STRENGTH");
|
||||
|
||||
SSL_CTX_set_default_verify_paths (ssl_ctx);
|
||||
+
|
||||
+ /* Start: Windows SSL Cert Changes */
|
||||
+#ifdef WINDOWS
|
||||
+ /* Only attempt to use the Windows store if one is not specified */
|
||||
+ if (!opt.ca_cert)
|
||||
+ {
|
||||
+ /* Open the default Windows cert store */
|
||||
+ void* hStore = Local_CertOpenSystemStoreA(NULL, "ROOT");
|
||||
+ if (hStore)
|
||||
+ {
|
||||
+ /* And then open the OpenSSL store */
|
||||
+ X509_STORE * store = SSL_CTX_get_cert_store(ssl_ctx);
|
||||
+ CERT_CONTEXT * pCertCtx = NULL;
|
||||
+ /* Loop through all the certs in the Windows cert store */
|
||||
+ for ( pCertCtx = Local_CertEnumCertificatesInStore(hStore, NULL);
|
||||
+ pCertCtx != NULL;
|
||||
+ pCertCtx = Local_CertEnumCertificatesInStore(hStore, pCertCtx) )
|
||||
+ {
|
||||
+ if (!((pCertCtx->dwCertEncodingType & PKCS_7_ASN_ENCODING) == PKCS_7_ASN_ENCODING))
|
||||
+ {
|
||||
+ /* Add all certs we find to OpenSSL's store */
|
||||
+ X509 *cert = d2i_X509(NULL, (const unsigned char**)&pCertCtx->pbCertEncoded, pCertCtx->cbCertEncoded);
|
||||
+ X509_STORE_add_cert(store, cert);
|
||||
+ X509_free(cert);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+ /* End: Windows SSL Cert Changes */
|
||||
SSL_CTX_load_verify_locations (ssl_ctx, opt.ca_cert, opt.ca_directory);
|
||||
|
||||
if (opt.crl_file)
|
||||
237
mingw-w64-wget/taskbar-progress.patch
Normal file
237
mingw-w64-wget/taskbar-progress.patch
Normal file
@@ -0,0 +1,237 @@
|
||||
src/Makefile.am | 5 +-
|
||||
src/mswindows.c | 3 +
|
||||
src/tbprogress.c | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/tbprogress.h | 6 ++
|
||||
4 files changed, 176 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index 28c0be2..356a21e 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -54,13 +54,14 @@ wget_SOURCES = connect.c convert.c cookies.c ftp.c \
|
||||
ftp-basic.c ftp-ls.c hash.c host.c hsts.c html-parse.c html-url.c \
|
||||
http.c init.c log.c main.c netrc.c progress.c ptimer.c \
|
||||
recur.c res.c retr.c spider.c url.c warc.c $(XATTR_OBJ) \
|
||||
- utils.c exits.c build_info.c $(IRI_OBJ) $(METALINK_OBJ) \
|
||||
+ utils.c exits.c tbprogress.c build_info.c \
|
||||
+ $(IRI_OBJ) $(METALINK_OBJ) \
|
||||
css-url.h css-tokens.h connect.h convert.h cookies.h \
|
||||
ftp.h hash.h host.h hsts.h html-parse.h html-url.h \
|
||||
http.h http-ntlm.h init.h log.h mswindows.h netrc.h \
|
||||
options.h progress.h ptimer.h recur.h res.h retr.h \
|
||||
spider.h ssl.h sysdep.h url.h warc.h utils.h wget.h iri.h \
|
||||
- exits.h version.h metalink.h xattr.h
|
||||
+ exits.h version.h metalink.h tbprogress.h xattr.h
|
||||
nodist_wget_SOURCES = version.c
|
||||
EXTRA_wget_SOURCES = iri.c
|
||||
LDADD = $(LIBOBJS) ../lib/libgnu.a $(GETADDRINFO_LIB) $(HOSTENT_LIB)\
|
||||
diff --git a/src/mswindows.c b/src/mswindows.c
|
||||
index 90e6ec4..f8ed2da 100644
|
||||
--- a/src/mswindows.c
|
||||
+++ b/src/mswindows.c
|
||||
@@ -43,6 +43,7 @@ as that of the covered work. */
|
||||
#include "utils.h"
|
||||
#include "url.h"
|
||||
#include "exits.h"
|
||||
+#include "tbprogress.h"
|
||||
|
||||
#ifndef ES_SYSTEM_REQUIRED
|
||||
#define ES_SYSTEM_REQUIRED 0x00000001
|
||||
@@ -86,6 +87,7 @@ windows_main (char **exec_name)
|
||||
static void
|
||||
ws_cleanup (void)
|
||||
{
|
||||
+ SetTBProgress(-1);
|
||||
xfree (exec_name);
|
||||
WSACleanup ();
|
||||
}
|
||||
@@ -399,6 +401,7 @@ ws_percenttitle (double percentage_float)
|
||||
|
||||
sprintf (title_buf, "Wget [%d%%] %s", percentage, curr_url);
|
||||
SetConsoleTitle (title_buf);
|
||||
+ SetTBProgress((int)(percentage_float * 10.0));
|
||||
}
|
||||
|
||||
/* Returns a pointer to the fully qualified name of the directory that
|
||||
diff --git a/src/tbprogress.c b/src/tbprogress.c
|
||||
new file mode 100644
|
||||
index 0000000..59645c0
|
||||
--- /dev/null
|
||||
+++ b/src/tbprogress.c
|
||||
@@ -0,0 +1,164 @@
|
||||
+/*
|
||||
+ * Adapted from:
|
||||
+ * https://eternallybored.org/misc/wget.old/src/taskbar-progress.patch
|
||||
+ */
|
||||
+
|
||||
+#if !defined(__cplusplus)
|
||||
+ #define CINTERFACE
|
||||
+ #define COBJMACROS
|
||||
+#endif
|
||||
+
|
||||
+#include "config.h"
|
||||
+
|
||||
+#ifndef _WIN32_WINNT
|
||||
+#define _WIN32_WINNT 0x0500
|
||||
+#endif
|
||||
+
|
||||
+#include <windows.h>
|
||||
+#include <commctrl.h>
|
||||
+#include <objbase.h>
|
||||
+#include <shobjidl.h>
|
||||
+
|
||||
+#include "tbprogress.h"
|
||||
+
|
||||
+#if !defined(_SHLOBJIDL_H) && !defined(__ITaskbarList3_INTERFACE_DEFINED__)
|
||||
+#error This file is not for you. Set ENABLE_TASKBAR=0.
|
||||
+#endif
|
||||
+
|
||||
+const GUID CLSID_TaskbarList = { 0x56FDF344, 0xFD6D, 0x11d0, { 0x95,0x8A,0x00,0x60,0x97,0xC9,0xA0,0x90 } };
|
||||
+const GUID IID_ITaskbarList1 = { 0x56FDF342, 0xFD6D, 0x11d0, { 0x95,0x8A,0x00,0x60,0x97,0xC9,0xA0,0x90 } };
|
||||
+const GUID IID_ITaskbarList3 = { 0xea1afb91, 0x9e28, 0x4b86, { 0x90,0xe9,0x9e,0x9f,0x8a,0x5e,0xef,0xaf } };
|
||||
+
|
||||
+#if !defined(__ITaskbarList3_INTERFACE_DEFINED__)
|
||||
+ typedef enum {
|
||||
+ TBPF_NOPROGRESS = 0, /* Normal state / no progress bar */
|
||||
+ TBPF_INDETERMINATE = 1, /* Marquee style progress bar */
|
||||
+ TBPF_NORMAL = 2, /* Standard progress bar */
|
||||
+ TBPF_ERROR = 4, /* Red taskbar button to indicate an error occurred */
|
||||
+ TBPF_PAUSED = 8 /* Yellow taskbar button to indicate user attention */
|
||||
+ } TBPFLAG;
|
||||
+
|
||||
+ typedef void* LPTHUMBBUTTON; /* dummy typedef! */
|
||||
+ typedef enum { TBATF_DUMMY } TBATFLAG;
|
||||
+
|
||||
+ #undef INTERFACE
|
||||
+ #define INTERFACE ITaskbarList3
|
||||
+ DECLARE_INTERFACE_(ITaskbarList3,IUnknown)
|
||||
+ {
|
||||
+ STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
|
||||
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
+
|
||||
+ /* ITaskbarList(1) */
|
||||
+ STDMETHOD(HrInit)(THIS) PURE;
|
||||
+ STDMETHOD(AddTab)(THIS, HWND hwnd) PURE;
|
||||
+ STDMETHOD(DeleteTab)(THIS, HWND hwnd) PURE;
|
||||
+ STDMETHOD(ActivateTab)(THIS, HWND hwnd) PURE;
|
||||
+ STDMETHOD(SetActiveAlt)(THIS, HWND hwnd) PURE;
|
||||
+
|
||||
+ /* ITaskbarList2 */
|
||||
+ STDMETHOD(MarkFullscreenWindow)(THIS, HWND hwnd, BOOL fFullscreen) PURE;
|
||||
+
|
||||
+ /* ITaskbarList3 */
|
||||
+ STDMETHOD(SetProgressValue)(THIS, HWND hwnd, ULONGLONG ullCompleted, ULONGLONG ullTotal) PURE;
|
||||
+ STDMETHOD(SetProgressState)(THIS, HWND hwnd, TBPFLAG tbpFlags) PURE;
|
||||
+ STDMETHOD(RegisterTab)(THIS, HWND hwndTab, HWND hwndMDI) PURE;
|
||||
+ STDMETHOD(UnregisterTab)(THIS, HWND hwndTab) PURE;
|
||||
+ STDMETHOD(SetTabOrder)(THIS, HWND hwndTab,HWND hwndInsertBefore) PURE;
|
||||
+ STDMETHOD(SetTabActive)(THIS, HWND hwndTab,HWND hwndMDI, TBATFLAG tbatFlags) PURE;
|
||||
+ STDMETHOD(ThumbBarAddButtons)(THIS, HWND hwnd,UINT cButtons, LPTHUMBBUTTON pButton) PURE;
|
||||
+ STDMETHOD(ThumbBarUpdateButtons)(THIS, HWND hwnd,UINT cButtons, LPTHUMBBUTTON pButton) PURE;
|
||||
+ STDMETHOD(ThumbBarSetImageList)(THIS, HWND hwnd, HIMAGELIST himl) PURE;
|
||||
+ STDMETHOD(SetOverlayIcon)(THIS, HWND hwnd, HICON hIcon, LPCWSTR pszDescription) PURE;
|
||||
+ STDMETHOD(SetThumbnailTooltip)(THIS, HWND hwnd, LPCWSTR pszTip);
|
||||
+ STDMETHOD(SetThumbnailClip)(THIS, HWND hwnd, RECT *prcClip);
|
||||
+
|
||||
+ STDMETHOD(QueryContextMenu)(THIS_ HMENU,UINT,UINT,UINT,UINT) PURE;
|
||||
+ STDMETHOD(InvokeCommand)(THIS_ LPCMINVOKECOMMANDINFO) PURE;
|
||||
+ STDMETHOD(GetCommandString)(THIS_ UINT,UINT,PUINT,LPSTR,UINT) PURE;
|
||||
+ STDMETHOD(HandleMenuMsg)(THIS_ UINT,WPARAM,LPARAM) PURE;
|
||||
+ };
|
||||
+ #undef INTERFACE
|
||||
+#endif /* __ITaskbarList3_INTERFACE_DEFINED__ */
|
||||
+
|
||||
+static ITaskbarList3 *g_pTL = NULL;
|
||||
+static HWND g_hwndConsole = NULL;
|
||||
+static int TB_status = 0;
|
||||
+
|
||||
+/* Use these macros to gets to the methods.
|
||||
+ */
|
||||
+#ifdef __cplusplus
|
||||
+ #define COCREATEINSTANCE(cls,iunk,ctx,iid,pv) CoCreateInstance (cls,iunk,gtx,iid,pv)
|
||||
+ #define HRINIT(iface) iface->HrInit()
|
||||
+ #define RELEASE(iface) iface->Release()
|
||||
+ #define SETPROGRESSVALUE(iface,hwnd,permille,max) iface->SetProgressValue (hwnd, permille, max)
|
||||
+ #define SETPROGRESSSTATE(iface,hwnd,state) iface->SetProgressState (hwnd, state)
|
||||
+#else
|
||||
+ #define COCREATEINSTANCE(cls,iunk,ctx,iid,pv) CoCreateInstance ((REFCLSID)&(cls),iunk,ctx,(REFCLSID)&(iid),pv)
|
||||
+ #define HRINIT(iface) ITaskbarList3_HrInit (iface)
|
||||
+ #define RELEASE(iface) ITaskbarList3_Release (iface)
|
||||
+ #define SETPROGRESSVALUE(iface,hwnd,permille,max) ITaskbarList3_SetProgressValue (iface,hwnd,permille,max)
|
||||
+ #define SETPROGRESSSTATE(iface,hwnd,state) ITaskbarList3_SetProgressState (iface,hwnd,state)
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+void SetTBProgress (int permille)
|
||||
+{
|
||||
+ /* Already stopped; quit */
|
||||
+ if (g_pTL == NULL && permille < 0)
|
||||
+ return;
|
||||
+
|
||||
+ /* Prior attempt failed; quit */
|
||||
+ if (TB_status != 0)
|
||||
+ return;
|
||||
+
|
||||
+ /* Clamp to max 100% */
|
||||
+ if (permille > 1000)
|
||||
+ permille = 1000;
|
||||
+
|
||||
+ /* 1st attempt; init */
|
||||
+ if (g_pTL == NULL) {
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ g_hwndConsole = GetConsoleWindow();
|
||||
+ if (!g_hwndConsole) {
|
||||
+ TB_status = -1;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ hr = CoInitializeEx (NULL, COINIT_APARTMENTTHREADED);
|
||||
+ if (!SUCCEEDED(hr)) {
|
||||
+ CoUninitialize();
|
||||
+ TB_status = -1;
|
||||
+ return;
|
||||
+ }
|
||||
+ COCREATEINSTANCE (CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER,
|
||||
+ IID_ITaskbarList3, (void**)&g_pTL);
|
||||
+ if (g_pTL == NULL) {
|
||||
+ CoUninitialize();
|
||||
+ TB_status = -1;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ hr = HRINIT (g_pTL);
|
||||
+ if (!SUCCEEDED(hr)) {
|
||||
+ TB_status = -1;
|
||||
+ RELEASE (g_pTL);
|
||||
+ g_pTL = NULL;
|
||||
+ CoUninitialize();
|
||||
+ return;
|
||||
+ }
|
||||
+ TB_status = 0;
|
||||
+ }
|
||||
+
|
||||
+ if (permille >= 0) {
|
||||
+ SETPROGRESSVALUE (g_pTL, g_hwndConsole, permille, 1000);
|
||||
+ }
|
||||
+ else {
|
||||
+ SETPROGRESSSTATE (g_pTL, g_hwndConsole, TBPF_NOPROGRESS);
|
||||
+ RELEASE (g_pTL);
|
||||
+ g_pTL = NULL;
|
||||
+ CoUninitialize();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
diff --git a/src/tbprogress.h b/src/tbprogress.h
|
||||
new file mode 100644
|
||||
index 0000000..a59ad6d
|
||||
--- /dev/null
|
||||
+++ b/src/tbprogress.h
|
||||
@@ -0,0 +1,6 @@
|
||||
+#ifndef tbprogress_h
|
||||
+#define tbprogress_h
|
||||
+
|
||||
+extern void SetTBProgress(int permille); // 0 - 1000
|
||||
+
|
||||
+#endif
|
||||
Reference in New Issue
Block a user