Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
9ce1a6e3
Commit
9ce1a6e3
authored
Jun 21, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sxs: Build with msvcrt.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8a00b3fc
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
76 deletions
+74
-76
Makefile.in
dlls/sxs/Makefile.in
+2
-0
cache.c
dlls/sxs/cache.c
+55
-58
name.c
dlls/sxs/name.c
+15
-16
sxs_private.h
dlls/sxs/sxs_private.h
+2
-2
No files found.
dlls/sxs/Makefile.in
View file @
9ce1a6e3
...
...
@@ -2,6 +2,8 @@ MODULE = sxs.dll
IMPORTS
=
oleaut32 ole32
IMPORTLIB
=
sxs
EXTRADLLFLAGS
=
-mno-cygwin
C_SRCS
=
\
cache.c
\
name.c
\
...
...
dlls/sxs/cache.c
View file @
9ce1a6e3
...
...
@@ -31,7 +31,6 @@
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/unicode.h"
#include "sxs_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
sxs
);
...
...
@@ -112,16 +111,15 @@ static WCHAR *build_assembly_name( const WCHAR *arch, const WCHAR *name, const W
static
const
WCHAR
fmtW
[]
=
{
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'n'
,
'o'
,
'n'
,
'e'
,
'_'
,
'd'
,
'e'
,
'a'
,
'd'
,
'b'
,
'e'
,
'e'
,
'f'
,
0
};
unsigned
int
buflen
=
ARRAY_SIZE
(
fmtW
);
WCHAR
*
ret
,
*
p
;
WCHAR
*
ret
;
buflen
+=
strlenW
(
arch
);
buflen
+=
strlenW
(
name
);
buflen
+=
strlenW
(
token
);
buflen
+=
strlenW
(
version
);
buflen
+=
l
strlenW
(
arch
);
buflen
+=
l
strlenW
(
name
);
buflen
+=
l
strlenW
(
token
);
buflen
+=
l
strlenW
(
version
);
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buflen
*
sizeof
(
WCHAR
)
)))
return
NULL
;
*
len
=
sprintfW
(
ret
,
fmtW
,
arch
,
name
,
token
,
version
);
for
(
p
=
ret
;
*
p
;
p
++
)
*
p
=
tolowerW
(
*
p
);
return
ret
;
*
len
=
swprintf
(
ret
,
buflen
,
fmtW
,
arch
,
name
,
token
,
version
);
return
wcslwr
(
ret
);
}
static
WCHAR
*
build_manifest_path
(
const
WCHAR
*
arch
,
const
WCHAR
*
name
,
const
WCHAR
*
token
,
...
...
@@ -140,7 +138,7 @@ static WCHAR *build_manifest_path( const WCHAR *arch, const WCHAR *name, const W
HeapFree
(
GetProcessHeap
(),
0
,
path
);
return
NULL
;
}
s
printfW
(
ret
,
fmtW
,
sxsdir
,
path
);
s
wprintf
(
ret
,
len
,
fmtW
,
sxsdir
,
path
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
return
ret
;
}
...
...
@@ -151,15 +149,14 @@ static WCHAR *build_policy_name( const WCHAR *arch, const WCHAR *name, const WCH
static
const
WCHAR
fmtW
[]
=
{
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'n'
,
'o'
,
'n'
,
'e'
,
'_'
,
'd'
,
'e'
,
'a'
,
'd'
,
'b'
,
'e'
,
'e'
,
'f'
,
0
};
unsigned
int
buflen
=
ARRAY_SIZE
(
fmtW
);
WCHAR
*
ret
,
*
p
;
WCHAR
*
ret
;
buflen
+=
strlenW
(
arch
);
buflen
+=
strlenW
(
name
);
buflen
+=
strlenW
(
token
);
buflen
+=
l
strlenW
(
arch
);
buflen
+=
l
strlenW
(
name
);
buflen
+=
l
strlenW
(
token
);
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buflen
*
sizeof
(
WCHAR
)
)))
return
NULL
;
*
len
=
sprintfW
(
ret
,
fmtW
,
arch
,
name
,
token
);
for
(
p
=
ret
;
*
p
;
p
++
)
*
p
=
tolowerW
(
*
p
);
return
ret
;
*
len
=
swprintf
(
ret
,
buflen
,
fmtW
,
arch
,
name
,
token
);
return
wcslwr
(
ret
);
}
static
WCHAR
*
build_policy_path
(
const
WCHAR
*
arch
,
const
WCHAR
*
name
,
const
WCHAR
*
token
,
...
...
@@ -173,13 +170,13 @@ static WCHAR *build_policy_path( const WCHAR *arch, const WCHAR *name, const WCH
if
(
!
(
path
=
build_policy_name
(
arch
,
name
,
token
,
&
len
)))
return
NULL
;
len
+=
ARRAY_SIZE
(
fmtW
);
len
+=
build_sxs_path
(
sxsdir
);
len
+=
strlenW
(
version
);
len
+=
l
strlenW
(
version
);
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
path
);
return
NULL
;
}
s
printfW
(
ret
,
fmtW
,
sxsdir
,
path
,
version
);
s
wprintf
(
ret
,
len
,
fmtW
,
sxsdir
,
path
,
version
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
return
ret
;
}
...
...
@@ -235,8 +232,8 @@ static HRESULT WINAPI cache_QueryAssemblyInfo(
}
cache_lock
(
cache
);
if
(
!
strcmpW
(
type
,
win32W
))
path
=
build_manifest_path
(
arch
,
name
,
token
,
version
);
else
if
(
!
strcmpW
(
type
,
win32_policyW
))
path
=
build_policy_path
(
arch
,
name
,
token
,
version
);
if
(
!
wcscmp
(
type
,
win32W
))
path
=
build_manifest_path
(
arch
,
name
,
token
,
version
);
else
if
(
!
wcscmp
(
type
,
win32_policyW
))
path
=
build_policy_path
(
arch
,
name
,
token
,
version
);
else
{
hr
=
HRESULT_FROM_WIN32
(
ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE
);
...
...
@@ -253,8 +250,8 @@ static HRESULT WINAPI cache_QueryAssemblyInfo(
info
->
dwAssemblyFlags
=
ASSEMBLYINFO_FLAG_INSTALLED
;
TRACE
(
"assembly is installed
\n
"
);
}
if
((
p
=
strrchrW
(
path
,
'\\'
)))
*
p
=
0
;
len
=
strlenW
(
path
)
+
1
;
if
((
p
=
wcsrchr
(
path
,
'\\'
)))
*
p
=
0
;
len
=
l
strlenW
(
path
)
+
1
;
if
(
info
->
pszCurrentAssemblyPathBuf
)
{
if
(
info
->
cchBuf
<
len
)
...
...
@@ -262,7 +259,7 @@ static HRESULT WINAPI cache_QueryAssemblyInfo(
info
->
cchBuf
=
len
;
hr
=
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
);
}
else
strcpyW
(
info
->
pszCurrentAssemblyPathBuf
,
path
);
else
l
strcpyW
(
info
->
pszCurrentAssemblyPathBuf
,
path
);
}
done:
...
...
@@ -473,14 +470,14 @@ static HRESULT parse_assembly( IXMLDOMDocument *doc, struct assembly **assembly
a
->
arch
=
get_attribute_value
(
attrs
,
architectureW
);
a
->
token
=
get_attribute_value
(
attrs
,
tokenW
);
if
(
!
a
->
type
||
(
strcmpW
(
a
->
type
,
win32W
)
&&
strcmpW
(
a
->
type
,
win32_policyW
))
||
if
(
!
a
->
type
||
(
wcscmp
(
a
->
type
,
win32W
)
&&
wcscmp
(
a
->
type
,
win32_policyW
))
||
!
a
->
name
||
!
a
->
version
||
!
a
->
arch
||
!
a
->
token
)
{
WARN
(
"invalid win32 assembly
\n
"
);
hr
=
ERROR_SXS_MANIFEST_FORMAT_ERROR
;
goto
done
;
}
if
(
!
strcmpW
(
a
->
type
,
win32W
))
hr
=
parse_files
(
doc
,
a
);
if
(
!
wcscmp
(
a
->
type
,
win32W
))
hr
=
parse_files
(
doc
,
a
);
done:
if
(
attrs
)
IXMLDOMNamedNodeMap_Release
(
attrs
);
...
...
@@ -502,21 +499,21 @@ static WCHAR *build_policy_filename( const WCHAR *arch, const WCHAR *name, const
if
(
!
(
fullname
=
build_policy_name
(
arch
,
name
,
token
,
&
len
)))
return
NULL
;
len
+=
build_sxs_path
(
sxsdir
);
len
+=
ARRAY_SIZE
(
policiesW
)
-
1
;
len
+=
strlenW
(
version
);
len
+=
l
strlenW
(
version
);
len
+=
ARRAY_SIZE
(
suffixW
)
-
1
;
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
fullname
);
return
NULL
;
}
strcpyW
(
ret
,
sxsdir
);
strcatW
(
ret
,
policiesW
);
l
strcpyW
(
ret
,
sxsdir
);
l
strcatW
(
ret
,
policiesW
);
CreateDirectoryW
(
ret
,
NULL
);
strcatW
(
ret
,
name
);
l
strcatW
(
ret
,
name
);
CreateDirectoryW
(
ret
,
NULL
);
strcatW
(
ret
,
backslashW
);
strcatW
(
ret
,
version
);
strcatW
(
ret
,
suffixW
);
l
strcatW
(
ret
,
backslashW
);
l
strcatW
(
ret
,
version
);
l
strcatW
(
ret
,
suffixW
);
HeapFree
(
GetProcessHeap
(),
0
,
fullname
);
return
ret
;
...
...
@@ -549,16 +546,16 @@ static WCHAR *build_source_filename( const WCHAR *manifest, struct file *file )
const
WCHAR
*
p
;
int
len
;
p
=
strrchrW
(
manifest
,
'\\'
);
if
(
!
p
)
p
=
strrchrW
(
manifest
,
'/'
);
p
=
wcsrchr
(
manifest
,
'\\'
);
if
(
!
p
)
p
=
wcsrchr
(
manifest
,
'/'
);
if
(
!
p
)
return
strdupW
(
manifest
);
len
=
p
-
manifest
+
1
;
if
(
!
(
src
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
strlenW
(
file
->
name
)
+
1
)
*
sizeof
(
WCHAR
)
)))
if
(
!
(
src
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
l
strlenW
(
file
->
name
)
+
1
)
*
sizeof
(
WCHAR
)
)))
return
NULL
;
memcpy
(
src
,
manifest
,
len
*
sizeof
(
WCHAR
)
);
strcpyW
(
src
+
len
,
file
->
name
);
l
strcpyW
(
src
+
len
,
file
->
name
);
return
src
;
}
...
...
@@ -579,10 +576,10 @@ static WCHAR *build_manifest_filename( const WCHAR *arch, const WCHAR *name, con
HeapFree
(
GetProcessHeap
(),
0
,
fullname
);
return
NULL
;
}
strcpyW
(
ret
,
sxsdir
);
strcatW
(
ret
,
manifestsW
);
strcatW
(
ret
,
fullname
);
strcatW
(
ret
,
suffixW
);
l
strcpyW
(
ret
,
sxsdir
);
l
strcatW
(
ret
,
manifestsW
);
l
strcatW
(
ret
,
fullname
);
l
strcatW
(
ret
,
suffixW
);
HeapFree
(
GetProcessHeap
(),
0
,
fullname
);
return
ret
;
...
...
@@ -639,19 +636,19 @@ static HRESULT install_assembly( const WCHAR *manifest, struct assembly *assembl
{
if
(
!
(
src
=
build_source_filename
(
manifest
,
file
)))
goto
done
;
len
=
len_sxsdir
+
len_name
+
strlenW
(
file
->
name
);
len
=
len_sxsdir
+
len_name
+
l
strlenW
(
file
->
name
);
if
(
!
(
dst
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
2
)
*
sizeof
(
WCHAR
)
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
src
);
goto
done
;
}
strcpyW
(
dst
,
sxsdir
);
strcatW
(
dst
,
name
);
l
strcpyW
(
dst
,
sxsdir
);
l
strcatW
(
dst
,
name
);
CreateDirectoryW
(
dst
,
NULL
);
strcatW
(
dst
,
backslashW
);
strcatW
(
dst
,
file
->
name
);
for
(
p
=
dst
;
*
p
;
p
++
)
*
p
=
to
lowerW
(
*
p
);
l
strcatW
(
dst
,
backslashW
);
l
strcatW
(
dst
,
file
->
name
);
for
(
p
=
dst
;
*
p
;
p
++
)
*
p
=
to
wlower
(
*
p
);
ret
=
CopyFileW
(
src
,
dst
,
FALSE
);
HeapFree
(
GetProcessHeap
(),
0
,
src
);
...
...
@@ -695,7 +692,7 @@ static HRESULT WINAPI cache_InstallAssembly(
/* FIXME: verify name attributes */
if
(
!
strcmpW
(
assembly
->
type
,
win32_policyW
))
if
(
!
wcscmp
(
assembly
->
type
,
win32_policyW
))
hr
=
install_policy
(
path
,
assembly
);
else
hr
=
install_assembly
(
path
,
assembly
);
...
...
@@ -720,16 +717,16 @@ static HRESULT uninstall_assembly( struct assembly *assembly )
if
(
!
name
)
return
E_OUTOFMEMORY
;
if
(
!
(
dirname
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len_sxsdir
+
len_name
+
1
)
*
sizeof
(
WCHAR
)
)))
goto
done
;
strcpyW
(
dirname
,
sxsdir
);
strcpyW
(
dirname
+
len_sxsdir
,
name
);
l
strcpyW
(
dirname
,
sxsdir
);
l
strcpyW
(
dirname
+
len_sxsdir
,
name
);
LIST_FOR_EACH_ENTRY
(
file
,
&
assembly
->
files
,
struct
file
,
entry
)
{
len
=
len_sxsdir
+
len_name
+
1
+
strlenW
(
file
->
name
);
len
=
len_sxsdir
+
len_name
+
1
+
l
strlenW
(
file
->
name
);
if
(
!
(
filename
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
goto
done
;
strcpyW
(
filename
,
dirname
);
strcatW
(
filename
,
backslashW
);
strcatW
(
filename
,
file
->
name
);
l
strcpyW
(
filename
,
dirname
);
l
strcatW
(
filename
,
backslashW
);
l
strcatW
(
filename
,
file
->
name
);
if
(
!
DeleteFileW
(
filename
))
WARN
(
"failed to delete file %u
\n
"
,
GetLastError
()
);
HeapFree
(
GetProcessHeap
(),
0
,
filename
);
...
...
@@ -782,8 +779,8 @@ static HRESULT WINAPI cache_UninstallAssembly(
hr
=
E_INVALIDARG
;
goto
done
;
}
if
(
!
strcmpW
(
type
,
win32W
))
path
=
build_manifest_filename
(
arch
,
name
,
token
,
version
);
else
if
(
!
strcmpW
(
type
,
win32_policyW
))
path
=
build_policy_filename
(
arch
,
name
,
token
,
version
);
if
(
!
wcscmp
(
type
,
win32W
))
path
=
build_manifest_filename
(
arch
,
name
,
token
,
version
);
else
if
(
!
wcscmp
(
type
,
win32_policyW
))
path
=
build_policy_filename
(
arch
,
name
,
token
,
version
);
else
{
hr
=
E_INVALIDARG
;
...
...
@@ -798,12 +795,12 @@ static HRESULT WINAPI cache_UninstallAssembly(
if
((
hr
=
parse_assembly
(
doc
,
&
assembly
))
!=
S_OK
)
goto
done
;
if
(
!
DeleteFileW
(
path
))
WARN
(
"unable to remove manifest file %u
\n
"
,
GetLastError
()
);
else
if
((
p
=
strrchrW
(
path
,
'\\'
)))
else
if
((
p
=
wcsrchr
(
path
,
'\\'
)))
{
*
p
=
0
;
RemoveDirectoryW
(
path
);
}
if
(
!
strcmpW
(
assembly
->
type
,
win32W
))
hr
=
uninstall_assembly
(
assembly
);
if
(
!
wcscmp
(
assembly
->
type
,
win32W
))
hr
=
uninstall_assembly
(
assembly
);
done:
if
(
name_obj
)
IAssemblyName_Release
(
name_obj
);
...
...
dlls/sxs/name.c
View file @
9ce1a6e3
...
...
@@ -28,7 +28,6 @@
#include "winsxs.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "sxs_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
sxs
);
...
...
@@ -143,22 +142,22 @@ static HRESULT WINAPI name_GetDisplayName(
if
(
!
buflen
||
flags
)
return
E_INVALIDARG
;
len
=
strlenW
(
name
->
name
)
+
1
;
if
(
name
->
arch
)
len
+=
strlenW
(
archW
)
+
strlenW
(
name
->
arch
)
+
4
;
if
(
name
->
token
)
len
+=
strlenW
(
tokenW
)
+
strlenW
(
name
->
token
)
+
4
;
if
(
name
->
type
)
len
+=
strlenW
(
typeW
)
+
strlenW
(
name
->
type
)
+
4
;
if
(
name
->
version
)
len
+=
strlenW
(
versionW
)
+
strlenW
(
version
)
+
4
;
len
=
l
strlenW
(
name
->
name
)
+
1
;
if
(
name
->
arch
)
len
+=
lstrlenW
(
archW
)
+
l
strlenW
(
name
->
arch
)
+
4
;
if
(
name
->
token
)
len
+=
lstrlenW
(
tokenW
)
+
l
strlenW
(
name
->
token
)
+
4
;
if
(
name
->
type
)
len
+=
lstrlenW
(
typeW
)
+
l
strlenW
(
name
->
type
)
+
4
;
if
(
name
->
version
)
len
+=
lstrlenW
(
versionW
)
+
l
strlenW
(
version
)
+
4
;
if
(
len
>
*
buflen
)
{
*
buflen
=
len
;
return
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
);
}
strcpyW
(
buffer
,
name
->
name
);
len
=
strlenW
(
buffer
);
if
(
name
->
arch
)
len
+=
s
printfW
(
buffer
+
len
,
fmtW
,
archW
,
name
->
arch
);
if
(
name
->
token
)
len
+=
s
printfW
(
buffer
+
len
,
fmtW
,
tokenW
,
name
->
token
);
if
(
name
->
type
)
len
+=
s
printfW
(
buffer
+
len
,
fmtW
,
typeW
,
name
->
type
);
if
(
name
->
version
)
len
+=
s
printfW
(
buffer
+
len
,
fmtW
,
versionW
,
name
->
version
);
l
strcpyW
(
buffer
,
name
->
name
);
len
=
l
strlenW
(
buffer
);
if
(
name
->
arch
)
len
+=
s
wprintf
(
buffer
+
len
,
*
buflen
-
len
,
fmtW
,
archW
,
name
->
arch
);
if
(
name
->
token
)
len
+=
s
wprintf
(
buffer
+
len
,
*
buflen
-
len
,
fmtW
,
tokenW
,
name
->
token
);
if
(
name
->
type
)
len
+=
s
wprintf
(
buffer
+
len
,
*
buflen
-
len
,
fmtW
,
typeW
,
name
->
type
);
if
(
name
->
version
)
len
+=
s
wprintf
(
buffer
+
len
,
*
buflen
-
len
,
fmtW
,
versionW
,
name
->
version
);
return
S_OK
;
}
...
...
@@ -211,13 +210,13 @@ static HRESULT WINAPI name_GetName(
if
(
!
buflen
||
!
buffer
)
return
E_INVALIDARG
;
name
=
get_name_attribute
(
iface
,
NAME_ATTR_ID_NAME
);
len
=
strlenW
(
name
)
+
1
;
len
=
l
strlenW
(
name
)
+
1
;
if
(
len
>
*
buflen
)
{
*
buflen
=
len
;
return
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
);
}
strcpyW
(
buffer
,
name
);
l
strcpyW
(
buffer
,
name
);
*
buflen
=
len
+
3
;
return
S_OK
;
}
...
...
@@ -232,9 +231,9 @@ static HRESULT parse_version( WCHAR *version, DWORD *high, DWORD *low )
for
(
i
=
0
,
p
=
version
;
i
<
4
;
i
++
)
{
if
(
!*
p
)
break
;
q
=
strchrW
(
p
,
'.'
);
q
=
wcschr
(
p
,
'.'
);
if
(
q
)
*
q
=
0
;
ver
[
i
]
=
atolW
(
p
);
ver
[
i
]
=
wcstol
(
p
,
NULL
,
10
);
if
(
!
q
&&
i
<
3
)
break
;
p
=
q
+
1
;
}
...
...
dlls/sxs/sxs_private.h
View file @
9ce1a6e3
...
...
@@ -32,7 +32,7 @@ static inline WCHAR *strdupW( const WCHAR *src )
WCHAR
*
dst
;
if
(
!
src
)
return
NULL
;
dst
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
dst
)
strcpyW
(
dst
,
src
);
dst
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
l
strlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
dst
)
l
strcpyW
(
dst
,
src
);
return
dst
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment