Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
da1f834e
Commit
da1f834e
authored
Feb 19, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 19, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fusion: Convert to Unicode.
parent
a76c1535
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
80 deletions
+83
-80
asmcache.c
dlls/fusion/asmcache.c
+35
-23
assembly.c
dlls/fusion/assembly.c
+24
-53
fusionpriv.h
dlls/fusion/fusionpriv.h
+24
-4
No files found.
dlls/fusion/asmcache.c
View file @
da1f834e
...
@@ -41,24 +41,24 @@
...
@@ -41,24 +41,24 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
fusion
);
WINE_DEFAULT_DEBUG_CHANNEL
(
fusion
);
static
BOOL
create_full_path
(
LPCSTR
path
)
static
BOOL
create_full_path
(
LPC
W
STR
path
)
{
{
LPSTR
new_path
;
LP
W
STR
new_path
;
BOOL
ret
=
TRUE
;
BOOL
ret
=
TRUE
;
int
len
;
int
len
;
new_path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lstrlenA
(
path
)
+
1
);
new_path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
path
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
!
new_path
)
if
(
!
new_path
)
return
FALSE
;
return
FALSE
;
lstrcpyA
(
new_path
,
path
);
strcpyW
(
new_path
,
path
);
while
((
len
=
lstrlenA
(
new_path
))
&&
new_path
[
len
-
1
]
==
'\\'
)
while
((
len
=
strlenW
(
new_path
))
&&
new_path
[
len
-
1
]
==
'\\'
)
new_path
[
len
-
1
]
=
0
;
new_path
[
len
-
1
]
=
0
;
while
(
!
CreateDirectory
A
(
new_path
,
NULL
))
while
(
!
CreateDirectory
W
(
new_path
,
NULL
))
{
{
LPSTR
slash
;
LP
W
STR
slash
;
DWORD
last_error
=
GetLastError
();
DWORD
last_error
=
GetLastError
();
if
(
last_error
==
ERROR_ALREADY_EXISTS
)
if
(
last_error
==
ERROR_ALREADY_EXISTS
)
...
@@ -70,7 +70,7 @@ static BOOL create_full_path(LPCSTR path)
...
@@ -70,7 +70,7 @@ static BOOL create_full_path(LPCSTR path)
break
;
break
;
}
}
if
(
!
(
slash
=
strrchr
(
new_path
,
'\\'
)))
if
(
!
(
slash
=
strrchr
W
(
new_path
,
'\\'
)))
{
{
ret
=
FALSE
;
ret
=
FALSE
;
break
;
break
;
...
@@ -91,6 +91,18 @@ static BOOL create_full_path(LPCSTR path)
...
@@ -91,6 +91,18 @@ static BOOL create_full_path(LPCSTR path)
return
ret
;
return
ret
;
}
}
static
BOOL
get_assembly_directory
(
LPWSTR
dir
,
DWORD
size
)
{
static
const
WCHAR
gac
[]
=
{
'\\'
,
'a'
,
's'
,
's'
,
'e'
,
'm'
,
'b'
,
'l'
,
'y'
,
'\\'
,
'G'
,
'A'
,
'C'
,
'_'
,
'M'
,
'S'
,
'I'
,
'L'
,
0
};
FIXME
(
"Ignoring assembly architecture
\n
"
);
GetWindowsDirectoryW
(
dir
,
size
);
strcatW
(
dir
,
gac
);
return
TRUE
;
}
/* IAssemblyCache */
/* IAssemblyCache */
typedef
struct
{
typedef
struct
{
...
@@ -228,14 +240,17 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
...
@@ -228,14 +240,17 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
LPCWSTR
pszManifestFilePath
,
LPCWSTR
pszManifestFilePath
,
LPCFUSION_INSTALL_REFERENCE
pRefData
)
LPCFUSION_INSTALL_REFERENCE
pRefData
)
{
{
static
const
WCHAR
format
[]
=
{
'%'
,
's'
,
'\\'
,
'%'
,
's'
,
'\\'
,
'%'
,
's'
,
'_'
,
'_'
,
'%'
,
's'
,
'\\'
,
0
};
ASSEMBLY
*
assembly
;
ASSEMBLY
*
assembly
;
LPSTR
filename
;
LP
W
STR
filename
;
LPSTR
name
=
NULL
;
LP
W
STR
name
=
NULL
;
LPSTR
token
=
NULL
;
LP
W
STR
token
=
NULL
;
LPSTR
version
=
NULL
;
LP
W
STR
version
=
NULL
;
LPSTR
asmpath
=
NULL
;
LP
W
STR
asmpath
=
NULL
;
CHAR
path
[
MAX_PATH
];
W
CHAR
path
[
MAX_PATH
];
CHAR
win
dir
[
MAX_PATH
];
WCHAR
asm
dir
[
MAX_PATH
];
LPWSTR
ext
;
LPWSTR
ext
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -276,12 +291,9 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
...
@@ -276,12 +291,9 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
goto
done
;
goto
done
;
GetWindowsDirectoryA
(
windir
,
MAX_PATH
);
get_assembly_directory
(
asmdir
,
MAX_PATH
);
FIXME
(
"Ignoring assembly architecture!
\n
"
);
sprintf
(
path
,
"%s
\\
assembly
\\
GAC_MSIL
\\
%s
\\
%s__%s
\\
"
,
windir
,
name
,
sprintfW
(
path
,
format
,
asmdir
,
name
,
version
,
token
);
version
,
token
);
create_full_path
(
path
);
create_full_path
(
path
);
...
@@ -289,10 +301,10 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
...
@@ -289,10 +301,10 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
goto
done
;
goto
done
;
filename
=
PathFindFileName
A
(
asmpath
);
filename
=
PathFindFileName
W
(
asmpath
);
lstrcatA
(
path
,
filename
);
strcatW
(
path
,
filename
);
if
(
!
CopyFile
A
(
asmpath
,
path
,
FALSE
))
if
(
!
CopyFile
W
(
asmpath
,
path
,
FALSE
))
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
done:
done:
...
...
dlls/fusion/assembly.c
View file @
da1f834e
...
@@ -52,7 +52,7 @@ typedef struct tagCLRTABLE
...
@@ -52,7 +52,7 @@ typedef struct tagCLRTABLE
struct
tagASSEMBLY
struct
tagASSEMBLY
{
{
LPSTR
path
;
LP
W
STR
path
;
HANDLE
hfile
;
HANDLE
hfile
;
HANDLE
hmap
;
HANDLE
hmap
;
...
@@ -76,22 +76,6 @@ struct tagASSEMBLY
...
@@ -76,22 +76,6 @@ struct tagASSEMBLY
BYTE
*
blobs
;
BYTE
*
blobs
;
};
};
static
LPSTR
strdupWtoA
(
LPCWSTR
str
)
{
LPSTR
ret
=
NULL
;
DWORD
len
;
if
(
!
str
)
return
ret
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
if
(
ret
)
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
,
NULL
,
NULL
);
return
ret
;
}
static
DWORD
rva_to_offset
(
IMAGE_NT_HEADERS
*
nthdrs
,
DWORD
rva
)
static
DWORD
rva_to_offset
(
IMAGE_NT_HEADERS
*
nthdrs
,
DWORD
rva
)
{
{
DWORD
offset
=
rva
,
limit
;
DWORD
offset
=
rva
,
limit
;
...
@@ -684,7 +668,7 @@ HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file)
...
@@ -684,7 +668,7 @@ HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file)
if
(
!
assembly
)
if
(
!
assembly
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
assembly
->
path
=
strdupW
toA
(
file
);
assembly
->
path
=
strdupW
(
file
);
if
(
!
assembly
->
path
)
if
(
!
assembly
->
path
)
{
{
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
...
@@ -743,16 +727,21 @@ HRESULT assembly_release(ASSEMBLY *assembly)
...
@@ -743,16 +727,21 @@ HRESULT assembly_release(ASSEMBLY *assembly)
return
S_OK
;
return
S_OK
;
}
}
static
LPSTR
assembly_dup_str
(
ASSEMBLY
*
assembly
,
DWORD
index
)
static
LP
W
STR
assembly_dup_str
(
ASSEMBLY
*
assembly
,
DWORD
index
)
{
{
int
len
;
LPWSTR
cpy
;
LPSTR
str
=
(
LPSTR
)
&
assembly
->
strings
[
index
];
LPSTR
str
=
(
LPSTR
)
&
assembly
->
strings
[
index
];
LPSTR
cpy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
str
)
+
1
);
if
(
cpy
)
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
strcpy
(
cpy
,
str
);
if
((
cpy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
))))
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
cpy
,
len
);
return
cpy
;
return
cpy
;
}
}
HRESULT
assembly_get_name
(
ASSEMBLY
*
assembly
,
LPSTR
*
name
)
HRESULT
assembly_get_name
(
ASSEMBLY
*
assembly
,
LP
W
STR
*
name
)
{
{
BYTE
*
ptr
;
BYTE
*
ptr
;
LONG
offset
;
LONG
offset
;
...
@@ -779,20 +768,22 @@ HRESULT assembly_get_name(ASSEMBLY *assembly, LPSTR *name)
...
@@ -779,20 +768,22 @@ HRESULT assembly_get_name(ASSEMBLY *assembly, LPSTR *name)
return
S_OK
;
return
S_OK
;
}
}
HRESULT
assembly_get_path
(
ASSEMBLY
*
assembly
,
LPSTR
*
path
)
HRESULT
assembly_get_path
(
ASSEMBLY
*
assembly
,
LP
W
STR
*
path
)
{
{
LP
STR
cpy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
assembly
->
path
)
+
1
);
LP
WSTR
cpy
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
assembly
->
path
)
+
1
)
*
sizeof
(
WCHAR
)
);
*
path
=
cpy
;
*
path
=
cpy
;
if
(
cpy
)
if
(
cpy
)
strcpy
(
cpy
,
assembly
->
path
);
strcpy
W
(
cpy
,
assembly
->
path
);
else
else
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
return
S_OK
;
return
S_OK
;
}
}
HRESULT
assembly_get_version
(
ASSEMBLY
*
assembly
,
LPSTR
*
version
)
HRESULT
assembly_get_version
(
ASSEMBLY
*
assembly
,
LP
W
STR
*
version
)
{
{
static
const
WCHAR
format
[]
=
{
'%'
,
'u'
,
'.'
,
'%'
,
'u'
,
'.'
,
'%'
,
'u'
,
'.'
,
'%'
,
'u'
,
0
};
ASSEMBLYTABLE
*
asmtbl
;
ASSEMBLYTABLE
*
asmtbl
;
LONG
offset
;
LONG
offset
;
...
@@ -806,11 +797,11 @@ HRESULT assembly_get_version(ASSEMBLY *assembly, LPSTR *version)
...
@@ -806,11 +797,11 @@ HRESULT assembly_get_version(ASSEMBLY *assembly, LPSTR *version)
if
(
!
asmtbl
)
if
(
!
asmtbl
)
return
E_FAIL
;
return
E_FAIL
;
*
version
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
"%u.%u.%u.%u"
)
+
4
*
strlen
(
"65535"
));
*
version
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
format
)
+
4
*
strlen
(
"65535"
)
*
sizeof
(
WCHAR
));
if
(
!*
version
)
if
(
!*
version
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
sprintf
(
*
version
,
"%u.%u.%u.%u"
,
asmtbl
->
MajorVersion
,
asmtbl
->
MinorVersion
,
sprintf
W
(
*
version
,
format
,
asmtbl
->
MajorVersion
,
asmtbl
->
MinorVersion
,
asmtbl
->
BuildNumber
,
asmtbl
->
RevisionNumber
);
asmtbl
->
BuildNumber
,
asmtbl
->
RevisionNumber
);
return
S_OK
;
return
S_OK
;
...
@@ -827,26 +818,7 @@ static BYTE *assembly_get_blob(ASSEMBLY *assembly, WORD index, ULONG *size)
...
@@ -827,26 +818,7 @@ static BYTE *assembly_get_blob(ASSEMBLY *assembly, WORD index, ULONG *size)
return
GetData
(
&
assembly
->
blobs
[
index
],
size
);
return
GetData
(
&
assembly
->
blobs
[
index
],
size
);
}
}
static
void
bytes_to_str
(
BYTE
*
bytes
,
DWORD
len
,
LPSTR
str
)
HRESULT
assembly_get_pubkey_token
(
ASSEMBLY
*
assembly
,
LPWSTR
*
token
)
{
DWORD
i
;
static
const
char
hexval
[
16
]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
};
for
(
i
=
0
;
i
<
len
;
i
++
)
{
str
[
i
*
2
]
=
hexval
[((
bytes
[
i
]
>>
4
)
&
0xF
)];
str
[
i
*
2
+
1
]
=
hexval
[(
bytes
[
i
])
&
0x0F
];
}
}
#define BYTES_PER_TOKEN 8
#define CHARS_PER_BYTE 2
#define TOKEN_LENGTH (BYTES_PER_TOKEN * CHARS_PER_BYTE + 1)
HRESULT
assembly_get_pubkey_token
(
ASSEMBLY
*
assembly
,
LPSTR
*
token
)
{
{
ASSEMBLYTABLE
*
asmtbl
;
ASSEMBLYTABLE
*
asmtbl
;
ULONG
i
,
size
;
ULONG
i
,
size
;
...
@@ -857,7 +829,7 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPSTR *token)
...
@@ -857,7 +829,7 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPSTR *token)
BYTE
*
pubkey
;
BYTE
*
pubkey
;
BYTE
tokbytes
[
BYTES_PER_TOKEN
];
BYTE
tokbytes
[
BYTES_PER_TOKEN
];
HRESULT
hr
=
E_FAIL
;
HRESULT
hr
=
E_FAIL
;
LPSTR
tok
;
LP
W
STR
tok
;
*
token
=
NULL
;
*
token
=
NULL
;
...
@@ -898,15 +870,14 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPSTR *token)
...
@@ -898,15 +870,14 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPSTR *token)
for
(
i
=
size
-
1
;
i
>=
size
-
8
;
i
--
)
for
(
i
=
size
-
1
;
i
>=
size
-
8
;
i
--
)
tokbytes
[
size
-
i
-
1
]
=
hashdata
[
i
];
tokbytes
[
size
-
i
-
1
]
=
hashdata
[
i
];
tok
=
HeapAlloc
(
GetProcessHeap
(),
0
,
TOKEN_LENGTH
);
tok
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
TOKEN_LENGTH
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
!
tok
)
if
(
!
tok
)
{
{
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
goto
done
;
goto
done
;
}
}
bytes_to_str
(
tokbytes
,
BYTES_PER_TOKEN
,
tok
);
token_to_str
(
tokbytes
,
tok
);
tok
[
TOKEN_LENGTH
-
1
]
=
'\0'
;
*
token
=
tok
;
*
token
=
tok
;
hr
=
S_OK
;
hr
=
S_OK
;
...
...
dlls/fusion/fusionpriv.h
View file @
da1f834e
...
@@ -430,11 +430,11 @@ typedef struct tagASSEMBLY ASSEMBLY;
...
@@ -430,11 +430,11 @@ typedef struct tagASSEMBLY ASSEMBLY;
HRESULT
assembly_create
(
ASSEMBLY
**
out
,
LPCWSTR
file
);
HRESULT
assembly_create
(
ASSEMBLY
**
out
,
LPCWSTR
file
);
HRESULT
assembly_release
(
ASSEMBLY
*
assembly
);
HRESULT
assembly_release
(
ASSEMBLY
*
assembly
);
HRESULT
assembly_get_name
(
ASSEMBLY
*
assembly
,
LPSTR
*
name
);
HRESULT
assembly_get_name
(
ASSEMBLY
*
assembly
,
LP
W
STR
*
name
);
HRESULT
assembly_get_path
(
ASSEMBLY
*
assembly
,
LPSTR
*
path
);
HRESULT
assembly_get_path
(
ASSEMBLY
*
assembly
,
LP
W
STR
*
path
);
HRESULT
assembly_get_version
(
ASSEMBLY
*
assembly
,
LPSTR
*
version
);
HRESULT
assembly_get_version
(
ASSEMBLY
*
assembly
,
LP
W
STR
*
version
);
HRESULT
assembly_get_architecture
(
ASSEMBLY
*
assembly
,
DWORD
fixme
);
HRESULT
assembly_get_architecture
(
ASSEMBLY
*
assembly
,
DWORD
fixme
);
HRESULT
assembly_get_pubkey_token
(
ASSEMBLY
*
assembly
,
LPSTR
*
token
);
HRESULT
assembly_get_pubkey_token
(
ASSEMBLY
*
assembly
,
LP
W
STR
*
token
);
static
inline
LPWSTR
strdupW
(
LPCWSTR
src
)
static
inline
LPWSTR
strdupW
(
LPCWSTR
src
)
{
{
...
@@ -450,4 +450,24 @@ static inline LPWSTR strdupW(LPCWSTR src)
...
@@ -450,4 +450,24 @@ static inline LPWSTR strdupW(LPCWSTR src)
return
dest
;
return
dest
;
}
}
#define BYTES_PER_TOKEN 8
#define CHARS_PER_BYTE 2
#define TOKEN_LENGTH (BYTES_PER_TOKEN * CHARS_PER_BYTE + 1)
static
inline
void
token_to_str
(
BYTE
*
bytes
,
LPWSTR
str
)
{
DWORD
i
;
static
const
WCHAR
hexval
[
16
]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
};
for
(
i
=
0
;
i
<
BYTES_PER_TOKEN
;
i
++
)
{
str
[
i
*
2
]
=
hexval
[((
bytes
[
i
]
>>
4
)
&
0xF
)];
str
[
i
*
2
+
1
]
=
hexval
[(
bytes
[
i
])
&
0x0F
];
}
str
[
i
*
2
]
=
0
;
}
#endif
/* __WINE_FUSION_PRIVATE__ */
#endif
/* __WINE_FUSION_PRIVATE__ */
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