Rebase against e55aca8f498536af974a031c2e9a4d905de9a7cf

This commit is contained in:
Alistair Leslie-Hughes 2018-10-17 08:30:55 +11:00
parent a804fed0f7
commit 3d981b8d47
11 changed files with 59 additions and 947 deletions

View File

@ -1,4 +1,4 @@
From 166e7927af7f75184c6a785eb82626282830fc75 Mon Sep 17 00:00:00 2001
From 9db924ab804c76bd6b1dada8e46ba59aef2987e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 6 Aug 2017 02:08:05 +0200
Subject: [PATCH] server: Implement support for creating processes using a
@ -15,10 +15,10 @@ Subject: [PATCH] server: Implement support for creating processes using a
7 files changed, 59 insertions(+), 21 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 95e50e9..699f214 100644
index 396d12a..c06bcb2 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -2184,7 +2184,7 @@ static NTSTATUS alloc_object_attributes( const SECURITY_ATTRIBUTES *attr, struct
@@ -2201,7 +2201,7 @@ static NTSTATUS alloc_object_attributes( const SECURITY_ATTRIBUTES *attr, struct
* Create a new process. If hFile is a valid handle we have an exe
* file, otherwise it is a Winelib app.
*/
@ -27,7 +27,7 @@ index 95e50e9..699f214 100644
BOOL inherit, DWORD flags, const RTL_USER_PROCESS_PARAMETERS *params,
LPPROCESS_INFORMATION info, LPCSTR unixdir,
const pe_image_info_t *pe_info, int exec_only )
@@ -2285,6 +2285,7 @@ static BOOL create_process( HANDLE hFile, LPSECURITY_ATTRIBUTES psa, LPSECURITY_
@@ -2302,6 +2302,7 @@ static BOOL create_process( HANDLE hFile, LPSECURITY_ATTRIBUTES psa, LPSECURITY_
req->access = PROCESS_ALL_ACCESS;
req->cpu = pe_info->cpu;
req->info_size = startup_info_size;
@ -35,7 +35,7 @@ index 95e50e9..699f214 100644
wine_server_add_data( req, objattr, attr_len );
wine_server_add_data( req, startup_info, startup_info_size );
wine_server_add_data( req, params->Environment, (env_end - params->Environment) * sizeof(WCHAR) );
@@ -2401,7 +2402,7 @@ error:
@@ -2418,7 +2419,7 @@ error:
*
* Create a new VDM process for a 16-bit or DOS application.
*/
@ -44,7 +44,7 @@ index 95e50e9..699f214 100644
BOOL inherit, DWORD flags, const RTL_USER_PROCESS_PARAMETERS *params,
LPPROCESS_INFORMATION info, LPCSTR unixdir, int exec_only )
{
@@ -2450,7 +2451,7 @@ static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES
@@ -2467,7 +2468,7 @@ static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES
memset( &pe_info, 0, sizeof(pe_info) );
pe_info.cpu = CPU_x86;
@ -53,28 +53,28 @@ index 95e50e9..699f214 100644
RtlDestroyProcessParameters( new_params );
HeapFree( GetProcessHeap(), 0, new_cmd_line );
return ret;
@@ -2462,7 +2463,7 @@ static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES
@@ -2479,7 +2480,7 @@ static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES
*
* Create a new cmd shell process for a .BAT file.
*/
-static BOOL create_cmd_process( LPCWSTR cur_dir, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
+static BOOL create_cmd_process( HANDLE token, LPCWSTR cur_dir, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
-static BOOL create_cmd_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
+static BOOL create_cmd_process( HANDLE token, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit, DWORD flags, LPSTARTUPINFOW startup,
const RTL_USER_PROCESS_PARAMETERS *params,
LPPROCESS_INFORMATION info )
@@ -2491,9 +2492,9 @@ static BOOL create_cmd_process( LPCWSTR cur_dir, LPSECURITY_ATTRIBUTES psa, LPSE
strcatW( newcmdline, quotW );
@@ -2509,9 +2510,9 @@ static BOOL create_cmd_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES
strcatW( newcmdline, params->CommandLine.Buffer );
strcatW( newcmdline, quotW );
if (params->CurrentDirectory.DosPath.Length) cur_dir = params->CurrentDirectory.DosPath.Buffer;
- ret = CreateProcessW( comspec, newcmdline, psa, tsa, inherit,
+ ret = CreateProcessInternalW( token, comspec, newcmdline, psa, tsa, inherit,
flags, params->Environment, cur_dir,
flags | CREATE_UNICODE_ENVIRONMENT, params->Environment, cur_dir,
- startup, info );
+ startup, info, NULL );
HeapFree( GetProcessHeap(), 0, newcmdline );
return ret;
}
@@ -2606,7 +2607,9 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
@@ -2624,7 +2625,9 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
TRACE("app %s cmdline %s\n", debugstr_w(app_name), debugstr_w(cmd_line) );
@ -85,7 +85,7 @@ index 95e50e9..699f214 100644
if (new_token) FIXME("No support for returning created process token\n");
if (!(tidy_cmdline = get_file_name( app_name, cmd_line, name, ARRAY_SIZE( name ), &hFile, &is_64bit )))
@@ -2699,18 +2702,18 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
@@ -2692,18 +2695,18 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
debugstr_w(name), is_64bit_arch(pe_info.cpu) ? 64 : 32,
wine_dbgstr_longlong(pe_info.base), wine_dbgstr_longlong(pe_info.base + pe_info.map_size),
cpu_names[pe_info.cpu] );
@ -107,7 +107,7 @@ index 95e50e9..699f214 100644
inherit, flags, params, info, unixdir, &pe_info, FALSE );
break;
case BINARY_UNKNOWN:
@@ -2720,14 +2723,14 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
@@ -2713,14 +2716,14 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
if (!strcmpiW( p, comW ) || !strcmpiW( p, pifW ))
{
TRACE( "starting %s as DOS binary\n", debugstr_w(name) );
@ -119,12 +119,12 @@ index 95e50e9..699f214 100644
if (!strcmpiW( p, batW ) || !strcmpiW( p, cmdW ) )
{
TRACE( "starting %s as batch binary\n", debugstr_w(name) );
- retv = create_cmd_process( cur_dir, process_attr, thread_attr,
+ retv = create_cmd_process( token, cur_dir, process_attr, thread_attr,
- retv = create_cmd_process( process_attr, thread_attr,
+ retv = create_cmd_process( token, process_attr, thread_attr,
inherit, flags, startup_info, params, info );
break;
}
@@ -2836,11 +2839,11 @@ static void exec_process( LPCWSTR name )
@@ -2828,11 +2831,11 @@ static void exec_process( LPCWSTR name )
debugstr_w(name), is_64bit_arch(pe_info.cpu) ? 64 : 32,
wine_dbgstr_longlong(pe_info.base), wine_dbgstr_longlong(pe_info.base + pe_info.map_size),
cpu_names[pe_info.cpu] );
@ -138,7 +138,7 @@ index 95e50e9..699f214 100644
break;
case BINARY_UNKNOWN:
/* check for .com or .pif extension */
@@ -2849,7 +2852,7 @@ static void exec_process( LPCWSTR name )
@@ -2841,7 +2844,7 @@ static void exec_process( LPCWSTR name )
/* fall through */
case BINARY_WIN16:
TRACE( "starting %s as Win16/DOS binary\n", debugstr_w(name) );
@ -287,7 +287,7 @@ index 21e90cc..32dfe5f 100644
static inline const ACE_HEADER *ace_next( const ACE_HEADER *ace )
{
diff --git a/server/token.c b/server/token.c
index 1184241..5db97b4 100644
index de1d624..2804247 100644
--- a/server/token.c
+++ b/server/token.c
@@ -836,6 +836,12 @@ int token_assign_label( struct token *token, PSID label )
@ -303,7 +303,7 @@ index 1184241..5db97b4 100644
struct token *token_create_admin( void )
{
struct token *token = NULL;
@@ -1262,6 +1268,11 @@ const SID *token_get_primary_group( struct token *token )
@@ -1263,6 +1269,11 @@ const SID *token_get_primary_group( struct token *token )
return token->primary_group;
}

View File

@ -1,256 +0,0 @@
From dec395793651dfe805fcfb7e1443a2a57fcfb4b5 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 31 Aug 2018 15:22:03 +1000
Subject: [PATCH 1/5] include: Add natupnp.idl
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
include/Makefile.in | 1 +
include/natupnp.idl | 223 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 224 insertions(+)
create mode 100644 include/natupnp.idl
diff --git a/include/Makefile.in b/include/Makefile.in
index ffecb98..741af54 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -453,6 +453,7 @@ SOURCES = \
msxmldid.h \
mtxdm.h \
multimon.h \
+ natupnp.idl \
nb30.h \
ncrypt.h \
ndrtypes.h \
diff --git a/include/natupnp.idl b/include/natupnp.idl
new file mode 100644
index 0000000..9dbccf2
--- /dev/null
+++ b/include/natupnp.idl
@@ -0,0 +1,223 @@
+/*
+ * Copyright 2018 Alistair Leslie-Hughes
+ *
+ * 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
+ */
+import "oaidl.idl";
+import "ocidl.idl";
+
+#if !defined(progid) && !defined(__WIDL__)
+#define threading(model)
+#define progid(str)
+#define vi_progid(str)
+#endif
+
+[
+ object,
+ uuid(6F10711F-729B-41E5-93B8-F21D0F818DF1),
+ dual,
+ pointer_default(unique)
+]
+interface IStaticPortMapping : IDispatch
+{
+ [propget, id(1)]
+ HRESULT ExternalIPAddress ([out, retval] BSTR *value);
+
+ [propget, id(2)]
+ HRESULT ExternalPort([out, retval] long *value);
+
+ [propget, id(3)]
+ HRESULT InternalPort([out, retval] long *value);
+
+ [propget, id(4)]
+ HRESULT Protocol([out, retval] BSTR *value);
+
+ [propget, id(5)]
+ HRESULT InternalClient([out, retval] BSTR *value);
+
+ [propget, id(6)]
+ HRESULT Enabled([out, retval] VARIANT_BOOL *value);
+
+ [propget, id(7)]
+ HRESULT Description([out, retval] BSTR *value);
+
+ [id(8)]
+ HRESULT EditInternalClient ([in] BSTR client);
+
+ [id(9)]
+ HRESULT Enable ([in] VARIANT_BOOL enable);
+
+ [id(10)]
+ HRESULT EditDescription ([in] BSTR description);
+
+ [id(11)]
+ HRESULT EditInternalPort ([in] long port);
+};
+
+[
+ object,
+ uuid(cd1f3e77-66d6-4664-82c7-36dbb641d0f1),
+ dual,
+ pointer_default(unique)
+]
+interface IStaticPortMappingCollection : IDispatch
+{
+ [propget, id(DISPID_NEWENUM), hidden, restricted]
+ HRESULT _NewEnum([out, retval] IUnknown **value);
+
+ [propget, id(DISPID_VALUE)]
+ HRESULT Item([in] long port, [in] BSTR protocol, [out, retval] IStaticPortMapping **mapping);
+
+ [propget, id(1)]
+ HRESULT Count([out, retval] long *value);
+
+ [id(2)]
+ HRESULT Remove([in] long port, [in] BSTR protocol);
+
+ [id(3)]
+ HRESULT Add([in] long external, [in] BSTR protocol, [in] long internal, [in] BSTR client,
+ [in] VARIANT_BOOL enabled, [in] BSTR description, [out, retval] IStaticPortMapping **mapping);
+};
+
+[
+ object,
+ uuid(4FC80282-23B6-4378-9A27-CD8F17C9400C),
+ dual,
+ pointer_default(unique)
+]
+interface IDynamicPortMapping : IDispatch
+{
+ [propget, id(1)]
+ HRESULT ExternalIPAddress ([out, retval] BSTR *value);
+
+ [propget, id(2)]
+ HRESULT RemoteHost ([out, retval] BSTR *value);
+
+ [propget, id(3)]
+ HRESULT ExternalPort([out, retval] long *value);
+
+ [propget, id(4)]
+ HRESULT Protocol([out, retval] BSTR *value);
+
+ [propget, id(5)]
+ HRESULT InternalPort([out, retval] long *value);
+
+ [propget, id(6)]
+ HRESULT InternalClient([out, retval] BSTR *value);
+
+ [propget, id(7)]
+ HRESULT Enabled([out, retval] VARIANT_BOOL *value);
+
+ [propget, id(8)]
+ HRESULT Description([out, retval] BSTR *value);
+
+ [propget, id(9)]
+ HRESULT LeaseDuration([out, retval] long *value);
+
+ [id(10)]
+ HRESULT RenewLease([in] long desired, [out, retval] long *duration);
+
+ [id(11)]
+ HRESULT EditInternalClient ([in] BSTR client);
+
+ [id(12)]
+ HRESULT Enable ([in] VARIANT_BOOL enabled);
+
+ [id(13)]
+ HRESULT EditDescription ([in] BSTR description);
+
+ [id(14)]
+ HRESULT EditInternalPort ([in] long port);
+};
+
+[
+ object,
+ uuid(b60de00f-156e-4e8d-9ec1-3a2342c10899),
+ dual,
+ pointer_default(unique)
+]
+interface IDynamicPortMappingCollection : IDispatch
+{
+ [propget, id(DISPID_NEWENUM), hidden, restricted]
+ HRESULT _NewEnum([out, retval] IUnknown **value);
+
+ [propget, id(DISPID_VALUE)]
+ HRESULT Item([in] BSTR host, [in] long port, [in] BSTR orotocol,
+ [out, retval] IDynamicPortMapping **mapping);
+
+ [propget, id(1)]
+ HRESULT Count([out, retval] long *value);
+
+ [id(2)]
+ HRESULT Remove([in] BSTR host, [in] long port, [in] BSTR protocol);
+
+ [id(3)]
+ HRESULT Add([in] BSTR host, [in] long port, [in] BSTR protocol, [in] long internal,
+ [in] BSTR client, [in] VARIANT_BOOL enabled, [in] BSTR Description,
+ [in] long duration, [out, retval] IDynamicPortMapping **mapping);
+};
+
+[
+ object,
+ uuid(624bd588-9060-4109-b0b0-1adbbcac32df),
+ dual,
+ pointer_default(unique)
+]
+interface INATEventManager : IDispatch
+{
+ [id(1), propput]
+ HRESULT ExternalIPAddressCallback ([in] IUnknown *unk);
+
+ [id(2), propput]
+ HRESULT NumberOfEntriesCallback ([in] IUnknown *unk);
+};
+
+[
+ object,
+ uuid(b171c812-cc76-485a-94d8-b6b3a2794e99),
+ dual,
+ pointer_default(unique)
+]
+interface IUPnPNAT : IDispatch
+{
+ [propget, id(1)]
+ HRESULT StaticPortMappingCollection ([out, retval] IStaticPortMappingCollection **collection);
+
+ [propget, id(2)]
+ HRESULT DynamicPortMappingCollection ([out, retval] IDynamicPortMappingCollection **collection);
+
+ [propget, id(3)]
+ HRESULT NATEventManager ([out, retval] INATEventManager **manager);
+};
+
+[
+ uuid(1c565858-f302-471e-b409-f180aa4abec6),
+ version(1.0)
+]
+library NATUPNPLib
+{
+ importlib("stdole2.tlb");
+
+ [
+ vi_progid("HNetCfg.NATUPnP"),
+ progid("HNetCfg.NATUPnP.1"),
+ threading(both),
+ uuid(ae1e00aa-3fd5-403c-8a27-2bbdc30cd0e1)
+ ]
+ coclass UPnPNAT
+ {
+ [default] interface IUPnPNAT;
+ };
+};
--
1.9.1

View File

@ -1,22 +0,0 @@
From 3b4f9505365d6803c0205c6f16f19a15bf0cc24d Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 31 Aug 2018 15:32:13 +1000
Subject: [PATCH 2/5] hnetcfg: Register NATUPnP interface
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/hnetcfg/hnetcfg_tlb.idl | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/hnetcfg/hnetcfg_tlb.idl b/dlls/hnetcfg/hnetcfg_tlb.idl
index 33e8cc8..e368fe6 100644
--- a/dlls/hnetcfg/hnetcfg_tlb.idl
+++ b/dlls/hnetcfg/hnetcfg_tlb.idl
@@ -21,3 +21,4 @@
#pragma makedep regtypelib
#include "netfw.idl"
+#include "natupnp.idl"
--
1.9.1

View File

@ -1,284 +0,0 @@
From 12fda22718f88a772f8b389f7d85b79c91795552 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 3 Sep 2018 10:59:18 +1000
Subject: [PATCH 3/5] hnetcfg: Support IUPnPNAT interface
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=34711
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/hnetcfg/apps.c | 4 +-
dlls/hnetcfg/hnetcfg.c | 7 ++
dlls/hnetcfg/hnetcfg_private.h | 2 +
dlls/hnetcfg/manager.c | 1 +
dlls/hnetcfg/port.c | 167 +++++++++++++++++++++++++++++++++++++++++
5 files changed, 180 insertions(+), 1 deletion(-)
diff --git a/dlls/hnetcfg/apps.c b/dlls/hnetcfg/apps.c
index e671e8c..9972468 100644
--- a/dlls/hnetcfg/apps.c
+++ b/dlls/hnetcfg/apps.c
@@ -27,6 +27,7 @@
#include "winuser.h"
#include "ole2.h"
#include "netfw.h"
+#include "natupnp.h"
#include "wine/debug.h"
#include "wine/heap.h"
@@ -115,7 +116,8 @@ static REFIID tid_id[] =
&IID_INetFwOpenPorts,
&IID_INetFwPolicy,
&IID_INetFwPolicy2,
- &IID_INetFwProfile
+ &IID_INetFwProfile,
+ &IID_IUPnPNAT
};
HRESULT get_typeinfo( enum type_id tid, ITypeInfo **ret )
diff --git a/dlls/hnetcfg/hnetcfg.c b/dlls/hnetcfg/hnetcfg.c
index e56dbab..5cc24a1 100644
--- a/dlls/hnetcfg/hnetcfg.c
+++ b/dlls/hnetcfg/hnetcfg.c
@@ -25,6 +25,7 @@
#include "objbase.h"
#include "rpcproxy.h"
#include "netfw.h"
+#include "natupnp.h"
#include "wine/debug.h"
#include "hnetcfg_private.h"
@@ -114,6 +115,8 @@ static hnetcfg_cf fw_manager_cf = { { &hnetcfg_cf_vtbl }, NetFwMgr_create };
static hnetcfg_cf fw_app_cf = { { &hnetcfg_cf_vtbl }, NetFwAuthorizedApplication_create };
static hnetcfg_cf fw_openport_cf = { { &hnetcfg_cf_vtbl }, NetFwOpenPort_create };
static hnetcfg_cf fw_policy2_cf = { { &hnetcfg_cf_vtbl }, NetFwPolicy2_create };
+static hnetcfg_cf upnpnat_cf = { { &hnetcfg_cf_vtbl }, IUPnPNAT_create };
+
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID reserved)
{
@@ -156,6 +159,10 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv )
{
cf = &fw_policy2_cf.IClassFactory_iface;
}
+ else if (IsEqualGUID( rclsid, &CLSID_UPnPNAT ))
+ {
+ cf = &upnpnat_cf.IClassFactory_iface;
+ }
if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
return IClassFactory_QueryInterface( cf, iid, ppv );
diff --git a/dlls/hnetcfg/hnetcfg_private.h b/dlls/hnetcfg/hnetcfg_private.h
index 5245883..be2d0f3 100644
--- a/dlls/hnetcfg/hnetcfg_private.h
+++ b/dlls/hnetcfg/hnetcfg_private.h
@@ -27,6 +27,7 @@ enum type_id
INetFwPolicy2_tid,
INetFwProfile_tid,
INetFwRules_tid,
+ IUPnPNAT_tid,
last_tid
};
@@ -42,3 +43,4 @@ HRESULT NetFwAuthorizedApplications_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN
HRESULT NetFwOpenPorts_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
HRESULT NetFwOpenPort_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
HRESULT NetFwServices_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
+HRESULT IUPnPNAT_create(IUnknown *, void **) DECLSPEC_HIDDEN;
diff --git a/dlls/hnetcfg/manager.c b/dlls/hnetcfg/manager.c
index 1d548b4..d3f089e 100644
--- a/dlls/hnetcfg/manager.c
+++ b/dlls/hnetcfg/manager.c
@@ -28,6 +28,7 @@
#include "initguid.h"
#include "ole2.h"
#include "netfw.h"
+#include "natupnp.h"
#include "wine/debug.h"
#include "wine/unicode.h"
diff --git a/dlls/hnetcfg/port.c b/dlls/hnetcfg/port.c
index 7d74965..f497bcb 100644
--- a/dlls/hnetcfg/port.c
+++ b/dlls/hnetcfg/port.c
@@ -27,7 +27,9 @@
#include "winuser.h"
#include "ole2.h"
#include "netfw.h"
+#include "natupnp.h"
+#include "wine/heap.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "hnetcfg_private.h"
@@ -603,3 +605,168 @@ HRESULT NetFwOpenPorts_create( IUnknown *pUnkOuter, LPVOID *ppObj )
TRACE("returning iface %p\n", *ppObj);
return S_OK;
}
+
+typedef struct _upnpnat
+{
+ IUPnPNAT IUPnPNAT_iface;
+ LONG ref;
+} upnpnat;
+
+static inline upnpnat *impl_from_IUPnPNAT( IUPnPNAT *iface )
+{
+ return CONTAINING_RECORD(iface, upnpnat, IUPnPNAT_iface);
+}
+
+static HRESULT WINAPI upnpnat_QueryInterface(IUPnPNAT *iface, REFIID riid, void **object)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+
+ TRACE("%p %s %p\n", This, debugstr_guid( riid ), object );
+
+ if ( IsEqualGUID( riid, &IID_IUPnPNAT ) ||
+ IsEqualGUID( riid, &IID_IDispatch ) ||
+ IsEqualGUID( riid, &IID_IUnknown ) )
+ {
+ *object = iface;
+ }
+ else
+ {
+ FIXME("interface %s not implemented\n", debugstr_guid(riid));
+ return E_NOINTERFACE;
+ }
+ IUPnPNAT_AddRef( iface );
+ return S_OK;
+}
+
+static ULONG WINAPI upnpnat_AddRef(IUPnPNAT *iface)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ return InterlockedIncrement( &This->ref );
+}
+
+static ULONG WINAPI upnpnat_Release(IUPnPNAT *iface)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ LONG refs = InterlockedDecrement( &This->ref );
+ if (!refs)
+ {
+ heap_free( This );
+ }
+ return refs;
+}
+
+static HRESULT WINAPI upnpnat_GetTypeInfoCount(IUPnPNAT *iface, UINT *pctinfo)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+
+ TRACE("%p %p\n", This, pctinfo);
+ *pctinfo = 1;
+ return S_OK;
+}
+
+static HRESULT WINAPI upnpnat_GetTypeInfo(IUPnPNAT *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+
+ TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
+ return get_typeinfo( IUPnPNAT_tid, ppTInfo );
+}
+
+static HRESULT WINAPI upnpnat_GetIDsOfNames(IUPnPNAT *iface, REFIID riid, LPOLESTR *rgszNames,
+ UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ ITypeInfo *typeinfo;
+ HRESULT hr;
+
+ TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
+
+ hr = get_typeinfo( IUPnPNAT_tid, &typeinfo );
+ if (SUCCEEDED(hr))
+ {
+ hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
+ ITypeInfo_Release( typeinfo );
+ }
+ return hr;
+}
+
+static HRESULT WINAPI upnpnat_Invoke(IUPnPNAT *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
+ WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
+ UINT *puArgErr)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ ITypeInfo *typeinfo;
+ HRESULT hr;
+
+ TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
+ lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
+
+ hr = get_typeinfo( IUPnPNAT_tid, &typeinfo );
+ if (SUCCEEDED(hr))
+ {
+ hr = ITypeInfo_Invoke( typeinfo, &This->IUPnPNAT_iface, dispIdMember,
+ wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
+ ITypeInfo_Release( typeinfo );
+ }
+ return hr;
+}
+
+static HRESULT WINAPI upnpnat_get_StaticPortMappingCollection(IUPnPNAT *iface, IStaticPortMappingCollection **collection)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ FIXME("%p, %p\n", This, collection);
+ if(collection)
+ *collection = NULL;
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI upnpnat_get_DynamicPortMappingCollection(IUPnPNAT *iface, IDynamicPortMappingCollection **collection)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ FIXME("%p, %p\n", This, collection);
+ if(collection)
+ *collection = NULL;
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI upnpnat_get_NATEventManager(IUPnPNAT *iface, INATEventManager **manager)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ FIXME("%p, %p\n", This, manager);
+ if(manager)
+ *manager = NULL;
+ return E_NOTIMPL;
+}
+
+const static IUPnPNATVtbl upnpnat_vtbl =
+{
+ upnpnat_QueryInterface,
+ upnpnat_AddRef,
+ upnpnat_Release,
+ upnpnat_GetTypeInfoCount,
+ upnpnat_GetTypeInfo,
+ upnpnat_GetIDsOfNames,
+ upnpnat_Invoke,
+ upnpnat_get_StaticPortMappingCollection,
+ upnpnat_get_DynamicPortMappingCollection,
+ upnpnat_get_NATEventManager
+};
+
+
+HRESULT IUPnPNAT_create(IUnknown *outer, void **object)
+{
+ upnpnat *nat;
+
+ TRACE("(%p,%p)\n", outer, object);
+
+ nat = heap_alloc( sizeof(*nat) );
+ if (!nat) return E_OUTOFMEMORY;
+
+ nat->IUPnPNAT_iface.lpVtbl = &upnpnat_vtbl;
+ nat->ref = 1;
+
+ *object = &nat->IUPnPNAT_iface;
+
+ TRACE("returning iface %p\n", *object);
+ return S_OK;
+}
--
1.9.1

View File

@ -1,53 +0,0 @@
From 33ff7bd1532ee29512f289d8d07c53fe7583c27c Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 3 Sep 2018 11:20:03 +1000
Subject: [PATCH 4/5] hnetcfg: Linked to uuid
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/hnetcfg/Makefile.in | 2 +-
dlls/hnetcfg/manager.c | 2 --
dlls/uuid/uuid.c | 1 +
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/hnetcfg/Makefile.in b/dlls/hnetcfg/Makefile.in
index 44c9cb5..e4960ab 100644
--- a/dlls/hnetcfg/Makefile.in
+++ b/dlls/hnetcfg/Makefile.in
@@ -1,5 +1,5 @@
MODULE = hnetcfg.dll
-IMPORTS = oleaut32 ole32 advapi32 mpr
+IMPORTS = oleaut32 ole32 advapi32 mpr uuid
C_SRCS = \
apps.c \
diff --git a/dlls/hnetcfg/manager.c b/dlls/hnetcfg/manager.c
index d3f089e..2d89479 100644
--- a/dlls/hnetcfg/manager.c
+++ b/dlls/hnetcfg/manager.c
@@ -25,10 +25,8 @@
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
-#include "initguid.h"
#include "ole2.h"
#include "netfw.h"
-#include "natupnp.h"
#include "wine/debug.h"
#include "wine/unicode.h"
diff --git a/dlls/uuid/uuid.c b/dlls/uuid/uuid.c
index 913e99c..aa3b30c 100644
--- a/dlls/uuid/uuid.c
+++ b/dlls/uuid/uuid.c
@@ -79,6 +79,7 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
#include "perhist.h"
#include "netcon.h"
#include "netfw.h"
+#include "natupnp.h"
#include "msctf.h"
#include "sensevts.h"
#include "ocmm.h"
--
1.9.1

View File

@ -1,69 +0,0 @@
From e9fe08455e3545e0781fd86ce0688e1eb53ef2f7 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 7 Sep 2018 14:40:06 +1000
Subject: [PATCH 5/5] hnetcfg/tests: Add IUPnPNAT interface tests
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/hnetcfg/tests/policy.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/dlls/hnetcfg/tests/policy.c b/dlls/hnetcfg/tests/policy.c
index 208f583..61175f9 100644
--- a/dlls/hnetcfg/tests/policy.c
+++ b/dlls/hnetcfg/tests/policy.c
@@ -27,6 +27,7 @@
#include "wine/test.h"
#include "netfw.h"
+#include "natupnp.h"
static void test_policy2_rules(INetFwPolicy2 *policy2)
{
@@ -160,6 +161,35 @@ static void test_NetFwAuthorizedApplication(void)
INetFwAuthorizedApplication_Release(app);
}
+static void test_IUPnPNAT(void)
+{
+ IUPnPNAT *nat;
+ IStaticPortMappingCollection *static_ports;
+ IDynamicPortMappingCollection *dync_ports;
+ INATEventManager *manager;
+ HRESULT hr;
+
+ hr = CoCreateInstance(&CLSID_UPnPNAT, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, &IID_IUPnPNAT, (void**)&nat);
+ ok(hr == S_OK, "got: %08x\n", hr);
+
+ hr = IUPnPNAT_get_StaticPortMappingCollection(nat, &static_ports);
+ todo_wine ok(hr == S_OK, "got: %08x\n", hr);
+ if(hr == S_OK && static_ports)
+ IStaticPortMappingCollection_Release(static_ports);
+
+ hr = IUPnPNAT_get_DynamicPortMappingCollection(nat, &dync_ports);
+ ok(hr == S_OK || hr == E_NOTIMPL /* Windows 8.1 */, "got: %08x\n", hr);
+ if(hr == S_OK && dync_ports)
+ IDynamicPortMappingCollection_Release(dync_ports);
+
+ hr = IUPnPNAT_get_NATEventManager(nat, &manager);
+ todo_wine ok(hr == S_OK, "got: %08x\n", hr);
+ if(hr == S_OK && manager)
+ INATEventManager_Release(manager);
+
+ IUPnPNAT_Release(nat);
+}
+
START_TEST(policy)
{
INetFwMgr *manager;
@@ -180,6 +210,7 @@ START_TEST(policy)
test_interfaces();
test_NetFwAuthorizedApplication();
+ test_IUPnPNAT();
CoUninitialize();
}
--
1.9.1

View File

@ -1 +0,0 @@
Fixes: [34711] hnetcfg: Add Support for interface UPnPNAT

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "a303f9cd101a06b7baf6302a90c8b3f6eb29a03c"
echo "e55aca8f498536af974a031c2e9a4d905de9a7cf"
}
# Show version information
@ -149,7 +149,6 @@ patch_enable_all ()
enable_gdi32_Path_Metafile="$1"
enable_gdi32_Symbol_Truetype_Font="$1"
enable_gdiplus_Performance_Improvements="$1"
enable_hnetcfg_NATUPnP="$1"
enable_imagehlp_BindImageEx="$1"
enable_imagehlp_Cleanup="$1"
enable_imagehlp_ImageLoad="$1"
@ -297,7 +296,6 @@ patch_enable_all ()
enable_shell32_NewMenu_Interface="$1"
enable_shell32_Progress_Dialog="$1"
enable_shell32_SFGAO_HASSUBFOLDER="$1"
enable_shell32_SHELL_execute="$1"
enable_shell32_SHFileOperation_Move="$1"
enable_shell32_Toolbar_Bitmaps="$1"
enable_shell32_UnixFS="$1"
@ -614,9 +612,6 @@ patch_enable ()
gdiplus-Performance-Improvements)
enable_gdiplus_Performance_Improvements="$2"
;;
hnetcfg-NATUPnP)
enable_hnetcfg_NATUPnP="$2"
;;
imagehlp-BindImageEx)
enable_imagehlp_BindImageEx="$2"
;;
@ -1058,9 +1053,6 @@ patch_enable ()
shell32-SFGAO_HASSUBFOLDER)
enable_shell32_SFGAO_HASSUBFOLDER="$2"
;;
shell32-SHELL_execute)
enable_shell32_SHELL_execute="$2"
;;
shell32-SHFileOperation_Move)
enable_shell32_SHFileOperation_Move="$2"
;;
@ -3703,31 +3695,6 @@ if test "$enable_gdiplus_Performance_Improvements" -eq 1; then
) >> "$patchlist"
fi
# Patchset hnetcfg-NATUPnP
# |
# | This patchset fixes the following Wine bugs:
# | * [#34711] hnetcfg: Add Support for interface UPnPNAT
# |
# | Modified files:
# | * dlls/hnetcfg/Makefile.in, dlls/hnetcfg/apps.c, dlls/hnetcfg/hnetcfg.c, dlls/hnetcfg/hnetcfg_private.h,
# | dlls/hnetcfg/hnetcfg_tlb.idl, dlls/hnetcfg/manager.c, dlls/hnetcfg/port.c, dlls/hnetcfg/tests/policy.c,
# | dlls/uuid/uuid.c, include/Makefile.in, include/natupnp.idl
# |
if test "$enable_hnetcfg_NATUPnP" -eq 1; then
patch_apply hnetcfg-NATUPnP/0001-include-Add-natupnp.idl.patch
patch_apply hnetcfg-NATUPnP/0002-hnetcfg-Register-NATUPnP-interface.patch
patch_apply hnetcfg-NATUPnP/0003-hnetcfg-Support-IUPnPNAT-interface.patch
patch_apply hnetcfg-NATUPnP/0004-hnetcfg-Linked-to-uuid.patch
patch_apply hnetcfg-NATUPnP/0005-hnetcfg-tests-Add-IUPnPNAT-interface-tests.patch
(
printf '%s\n' '+ { "Alistair Leslie-Hughes", "include: Add natupnp.idl.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "hnetcfg: Register NATUPnP interface.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "hnetcfg: Support IUPnPNAT interface.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "hnetcfg: Linked to uuid.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "hnetcfg/tests: Add IUPnPNAT interface tests.", 1 },';
) >> "$patchlist"
fi
# Patchset imagehlp-BindImageEx
# |
# | This patchset fixes the following Wine bugs:
@ -6285,18 +6252,6 @@ if test "$enable_shell32_SFGAO_HASSUBFOLDER" -eq 1; then
) >> "$patchlist"
fi
# Patchset shell32-SHELL_execute
# |
# | Modified files:
# | * dlls/shell32/shlexec.c, dlls/shell32/tests/shlexec.c
# |
if test "$enable_shell32_SHELL_execute" -eq 1; then
patch_apply shell32-SHELL_execute/0001-shell32-Properly-fail-when-a-data-object-cannot-be-i.patch
(
printf '%s\n' '+ { "Mark Jansen", "shell32: Properly fail when a data object cannot be instantiated and expand environment strings in ShellExecute.", 1 },';
) >> "$patchlist"
fi
# Patchset shell32-Toolbar_Bitmaps
# |
# | This patchset fixes the following Wine bugs:

View File

@ -1,145 +0,0 @@
From ba48d35b9f8659c1463b6a70b1804df4b4cca4d6 Mon Sep 17 00:00:00 2001
From: Mark Jansen <learn0more+wine@gmail.com>
Date: Sun, 4 Jun 2017 22:12:20 +0200
Subject: [PATCH] shell32: Properly fail when a data object cannot be
instantiated and expand environment strings in ShellExecute
---
dlls/shell32/shlexec.c | 47 +++++++++++++++++++++++++++++++++++++++++++-
dlls/shell32/tests/shlexec.c | 14 ++++++-------
2 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index a2d4e5d20f..cdb8e7e152 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -1317,6 +1317,7 @@ static HRESULT shellex_load_object_and_run( HKEY hkey, LPCGUID guid, LPSHELLEXEC
if ( !dataobj )
{
ERR("failed to get data object\n");
+ r = E_FAIL;
goto end;
}
@@ -1575,6 +1576,26 @@ static void do_error_dialog( UINT_PTR retval, HWND hwnd )
MessageBoxW(hwnd, msg, NULL, MB_ICONERROR);
}
+static WCHAR *expand_environment( const WCHAR *str )
+{
+ WCHAR *buf;
+ DWORD len;
+
+ len = ExpandEnvironmentStringsW(str, NULL, 0);
+ if (!len) return NULL;
+
+ buf = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ if (!buf) return NULL;
+
+ len = ExpandEnvironmentStringsW(str, buf, len);
+ if (!len)
+ {
+ HeapFree(GetProcessHeap(), 0, buf);
+ return NULL;
+ }
+ return buf;
+}
+
/*************************************************************************
* SHELL_execute [Internal]
*/
@@ -1588,7 +1609,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
SEE_MASK_UNICODE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR;
WCHAR parametersBuffer[1024], dirBuffer[MAX_PATH], wcmdBuffer[1024];
- WCHAR *wszApplicationName, *wszParameters, *wszDir, *wcmd;
+ WCHAR *wszApplicationName, *wszParameters, *wszDir, *wcmd = NULL;
DWORD dwApplicationNameLen = MAX_PATH+2;
DWORD parametersLen = ARRAY_SIZE(parametersBuffer);
DWORD wcmdLen = ARRAY_SIZE(wcmdBuffer);
@@ -1694,6 +1715,29 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
TRACE("-- idlist=%p (%s)\n", sei_tmp.lpIDList, debugstr_w(wszApplicationName));
}
+ if (sei_tmp.fMask & SEE_MASK_DOENVSUBST)
+ {
+ WCHAR *tmp;
+
+ tmp = expand_environment(sei_tmp.lpFile);
+ if (!tmp)
+ {
+ retval = SE_ERR_OOM;
+ goto end;
+ }
+ HeapFree(GetProcessHeap(), 0, wszApplicationName);
+ sei_tmp.lpFile = wszApplicationName = tmp;
+
+ tmp = expand_environment(sei_tmp.lpDirectory);
+ if (!tmp)
+ {
+ retval = SE_ERR_OOM;
+ goto end;
+ }
+ if (wszDir != dirBuffer) HeapFree(GetProcessHeap(), 0, wszDir);
+ sei_tmp.lpDirectory = wszDir = tmp;
+ }
+
if ( ERROR_SUCCESS == ShellExecute_FromContextMenu( &sei_tmp ) )
{
sei->hInstApp = (HINSTANCE) 33;
@@ -1864,6 +1908,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
retval = (UINT_PTR)ShellExecuteW(sei_tmp.hwnd, sei_tmp.lpVerb, lpstrTmpFile, NULL, NULL, 0);
}
+end:
TRACE("retval %lu\n", retval);
heap_free(wszApplicationName);
diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index 7cdae878db..f5f1d77b43 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -1829,7 +1829,7 @@ static fileurl_tests_t fileurl_tests[]=
{"file:///", "%%TMPDIR%%\\test file.shlexec", 0, 0},
/* Test shortcuts vs. URLs */
- {"file://///", "%s\\test_shortcut_shlexec.lnk", 0, 0x1d},
+ {"file://///", "%s\\test_shortcut_shlexec.lnk", 0, 0x1c},
/* Confuse things by mixing protocols */
{"file://", "shlproto://foo/bar", USE_COLON, 0},
@@ -1975,11 +1975,11 @@ static void test_urls(void)
}
/* A .lnk ending does not turn a URL into a shortcut */
- todo_wait rc = shell_execute(NULL, "shlproto://foo/bar.lnk", NULL, NULL);
+ rc = shell_execute(NULL, "shlproto://foo/bar.lnk", NULL, NULL);
ok(rc > 32, "%s failed: rc=%lu\n", shell_call, rc);
okChildInt("argcA", 5);
- todo_wine okChildString("argvA3", "URL");
- todo_wine okChildString("argvA4", "shlproto://foo/bar.lnk");
+ okChildString("argvA3", "URL");
+ okChildString("argvA4", "shlproto://foo/bar.lnk");
/* Neither does a .exe extension */
rc = shell_execute(NULL, "shlproto://foo/bar.exe", NULL, NULL);
@@ -2182,13 +2182,13 @@ static void test_lnks(void)
get_long_path_name(params, filename, sizeof(filename));
okChildPath("argvA4", filename);
- todo_wait rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_DOENVSUBST, NULL, "%TMPDIR%\\test_shortcut_shlexec.lnk", NULL, NULL, NULL);
+ rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_DOENVSUBST, NULL, "%TMPDIR%\\test_shortcut_shlexec.lnk", NULL, NULL, NULL);
okShell(rc > 32, "failed: rc=%lu err=%u\n", rc, GetLastError());
okChildInt("argcA", 5);
- todo_wine okChildString("argvA3", "Open");
+ okChildString("argvA3", "Open");
sprintf(params, "%s\\test file.shlexec", tmpdir);
get_long_path_name(params, filename, sizeof(filename));
- todo_wine okChildPath("argvA4", filename);
+ okChildPath("argvA4", filename);
}
/* Should just run our executable */
--
2.16.2

View File

@ -1,19 +1,18 @@
From e7c54c4bc539e61088115e283e22932e423aa346 Mon Sep 17 00:00:00 2001
From 50b6f30c9b8c310d0fcc93c7dea04f5e4c781bc3 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 23 Dec 2015 19:37:37 +0800
Subject: widl: Add initial implementation of SLTG typelib generator.
Subject: [PATCH] widl: Add initial implementation of SLTG typelib generator.
---
tools/widl/Makefile.in | 3 +-
tools/widl/typelib.c | 5 +-
tools/widl/typelib.h | 1 +
tools/widl/widl.c | 8 +-
tools/widl/write_sltg.c | 558 ++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 572 insertions(+), 3 deletions(-)
tools/widl/write_sltg.c | 557 ++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 567 insertions(+), 2 deletions(-)
create mode 100644 tools/widl/write_sltg.c
diff --git a/tools/widl/Makefile.in b/tools/widl/Makefile.in
index b47a170e4ca..8eaedc3732e 100644
index e06d6cc..e7a41c3 100644
--- a/tools/widl/Makefile.in
+++ b/tools/widl/Makefile.in
@@ -14,7 +14,8 @@ C_SRCS = \
@ -26,34 +25,18 @@ index b47a170e4ca..8eaedc3732e 100644
LEX_SRCS = parser.l
BISON_SRCS = parser.y
diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index 6ac748f4041..aa3305c5e52 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -249,7 +249,10 @@ void end_typelib(void)
{
if (!typelib) return;
- create_msft_typelib(typelib);
+ if (do_typelib == 2)
+ create_sltg_typelib(typelib);
+ else
+ create_msft_typelib(typelib);
}
static void tlb_read(int fd, void *buf, int count)
diff --git a/tools/widl/typelib.h b/tools/widl/typelib.h
index 18e6cdbcc56..31f4a5a859f 100644
index 7df7d29..5d9f45a 100644
--- a/tools/widl/typelib.h
+++ b/tools/widl/typelib.h
@@ -85,4 +85,5 @@ enum VARENUM {
@@ -83,4 +83,5 @@ enum VARENUM {
extern unsigned short get_type_vt(type_t *t);
extern int create_msft_typelib(typelib_t *typelib);
+extern int create_sltg_typelib(typelib_t *typelib);
#endif
diff --git a/tools/widl/widl.c b/tools/widl/widl.c
index a38f9170ead..1180e65f009 100644
index a38f917..1180e65 100644
--- a/tools/widl/widl.c
+++ b/tools/widl/widl.c
@@ -163,7 +163,8 @@ enum {
@ -87,10 +70,10 @@ index a38f9170ead..1180e65f009 100644
break;
diff --git a/tools/widl/write_sltg.c b/tools/widl/write_sltg.c
new file mode 100644
index 00000000000..45cac801e7f
index 0000000..c4ddaed
--- /dev/null
+++ b/tools/widl/write_sltg.c
@@ -0,0 +1,558 @@
@@ -0,0 +1,557 @@
+/*
+ * Typelib (SLTG) generation
+ *
@ -619,7 +602,6 @@ index 00000000000..45cac801e7f
+ sprintf(typelib_id, "#%d", expr->cval);
+ add_output_to_resources("TYPELIB", typelib_id);
+ output_typelib_regscript(typelib->typelib);
+ flush_output_resources(typelib_name);
+ }
+ else flush_output_buffer(typelib_name);
+}
@ -650,5 +632,5 @@ index 00000000000..45cac801e7f
+ return 1;
+}
--
2.11.0
1.9.1

View File

@ -1,27 +1,32 @@
From 901d73cf56c406816555912ab2f089d80bba49db Mon Sep 17 00:00:00 2001
From 1182a02286e99d3521b95c3196beda99173ee393 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 20 Jan 2016 14:26:48 +0800
Subject: widl: Fix generation of resources containing an old typelib.
Subject: [PATCH] widl: Fix generation of resources containing an old typelib.
---
tools/widl/typelib.c | 2 +-
tools/widl/widl.c | 5 +++--
tools/widl/widl.h | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)
tools/widl/register.c | 7 ++++++-
tools/widl/widl.c | 5 +++--
tools/widl/widl.h | 1 +
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index aa3305c..3de8691 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -249,7 +249,7 @@ void end_typelib(void)
{
if (!typelib) return;
- if (do_typelib == 2)
+ if (do_old_typelib)
create_sltg_typelib(typelib);
else
create_msft_typelib(typelib);
diff --git a/tools/widl/register.c b/tools/widl/register.c
index 210fb74..1987ccf 100644
--- a/tools/widl/register.c
+++ b/tools/widl/register.c
@@ -286,7 +286,12 @@ void write_typelib_regscript( const statement_list_t *stmts )
if (count && !strendswith( typelib_name, ".res" ))
error( "Cannot store multiple typelibs into %s\n", typelib_name );
else
- create_msft_typelib( stmt->u.lib );
+ {
+ if (do_old_typelib)
+ create_sltg_typelib( stmt->u.lib );
+ else
+ create_msft_typelib( stmt->u.lib );
+ }
count++;
}
if (count && strendswith( typelib_name, ".res" )) flush_output_resources( typelib_name );
diff --git a/tools/widl/widl.c b/tools/widl/widl.c
index 1180e65..afeea39 100644
--- a/tools/widl/widl.c
@ -53,7 +58,7 @@ index 1180e65..afeea39 100644
case 'T':
typelib_name = xstrdup(optarg);
diff --git a/tools/widl/widl.h b/tools/widl/widl.h
index 09e7871..90b6366 100644
index 7530f9f..73b9152 100644
--- a/tools/widl/widl.h
+++ b/tools/widl/widl.h
@@ -38,6 +38,7 @@ extern int pedantic;
@ -65,5 +70,5 @@ index 09e7871..90b6366 100644
extern int do_client;
extern int do_server;
--
2.6.4
1.9.1