Commit 085e95cd authored by Jactry Zeng's avatar Jactry Zeng Committed by Alexandre Julliard

msi: Use CreateFileW() for handling path from cabinet_open() instead.

parent 9ef92747
...@@ -109,6 +109,8 @@ static INT_PTR CDECL cabinet_open(char *pszFile, int oflag, int pmode) ...@@ -109,6 +109,8 @@ static INT_PTR CDECL cabinet_open(char *pszFile, int oflag, int pmode)
DWORD dwAccess = 0; DWORD dwAccess = 0;
DWORD dwShareMode = 0; DWORD dwShareMode = 0;
DWORD dwCreateDisposition = OPEN_EXISTING; DWORD dwCreateDisposition = OPEN_EXISTING;
HANDLE handle;
WCHAR *path;
switch (oflag & _O_ACCMODE) switch (oflag & _O_ACCMODE)
{ {
...@@ -131,8 +133,10 @@ static INT_PTR CDECL cabinet_open(char *pszFile, int oflag, int pmode) ...@@ -131,8 +133,10 @@ static INT_PTR CDECL cabinet_open(char *pszFile, int oflag, int pmode)
else if (oflag & _O_CREAT) else if (oflag & _O_CREAT)
dwCreateDisposition = CREATE_ALWAYS; dwCreateDisposition = CREATE_ALWAYS;
return (INT_PTR)CreateFileA(pszFile, dwAccess, dwShareMode, NULL, path = strdupUtoW(pszFile);
dwCreateDisposition, 0, NULL); handle = CreateFileW(path, dwAccess, dwShareMode, NULL, dwCreateDisposition, 0, NULL);
free(path);
return (INT_PTR)handle;
} }
static UINT CDECL cabinet_read(INT_PTR hf, void *pv, UINT cb) static UINT CDECL cabinet_read(INT_PTR hf, void *pv, UINT cb)
...@@ -577,11 +581,11 @@ static BOOL extract_cabinet( MSIPACKAGE* package, MSIMEDIAINFO *mi, LPVOID data ...@@ -577,11 +581,11 @@ static BOOL extract_cabinet( MSIPACKAGE* package, MSIMEDIAINFO *mi, LPVOID data
return FALSE; return FALSE;
} }
cabinet = strdupWtoA( mi->cabinet ); cabinet = strdupWtoU( mi->cabinet );
if (!cabinet) if (!cabinet)
goto done; goto done;
cab_path = strdupWtoA( mi->sourcedir ); cab_path = strdupWtoU( mi->sourcedir );
if (!cab_path) if (!cab_path)
goto done; goto done;
......
...@@ -1168,4 +1168,30 @@ static inline LPWSTR strdupAtoW( LPCSTR str ) ...@@ -1168,4 +1168,30 @@ static inline LPWSTR strdupAtoW( LPCSTR str )
return ret; return ret;
} }
static inline char *strdupWtoU( LPCWSTR str )
{
LPSTR ret = NULL;
DWORD len;
if (!str) return ret;
len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
ret = malloc( len );
if (ret)
WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL );
return ret;
}
static inline LPWSTR strdupUtoW( LPCSTR str )
{
LPWSTR ret = NULL;
DWORD len;
if (!str) return ret;
len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 );
ret = malloc( len * sizeof(WCHAR) );
if (ret)
MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len );
return ret;
}
#endif /* __WINE_MSI_PRIVATE__ */ #endif /* __WINE_MSI_PRIVATE__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment