[vlc-commits] unc: fix calling Wide Win32 API with UTF-8 strings
Steve Lhomme
git at videolan.org
Mon Jul 15 09:22:31 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jul 10 08:00:10 2019 +0200| [c87c0e990ea1528189c290e019e1cbbd5955c691] | committer: Steve Lhomme
unc: fix calling Wide Win32 API with UTF-8 strings
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c87c0e990ea1528189c290e019e1cbbd5955c691
---
modules/access/unc.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/access/unc.c b/modules/access/unc.c
index 3903643396..86d51c463b 100644
--- a/modules/access/unc.c
+++ b/modules/access/unc.c
@@ -69,9 +69,12 @@ static void Win32AddConnection(stream_t *access, const char *server,
*delim = '\0';
const char *msg;
- net_resource.lpRemoteName = remote_name;
+ net_resource.lpRemoteName = ToWide(remote_name);
- switch (WNetAddConnection2(&net_resource, pwd, user, 0))
+ wchar_t *wpwd = pwd ? ToWide(pwd) : NULL;
+ wchar_t *wuser = user ? ToWide(user) : NULL;
+
+ switch (WNetAddConnection2(&net_resource, wpwd, wuser, 0))
{
case NO_ERROR:
msg = "connected to %s";
@@ -83,6 +86,9 @@ static void Win32AddConnection(stream_t *access, const char *server,
default:
msg = "failed to connect to %s";
}
+ free(net_resource.lpRemoteName);
+ free(wpwd);
+ free(wuser);
msg_Dbg(access, msg, remote_name);
}
More information about the vlc-commits
mailing list