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
5bfd7044
Commit
5bfd7044
authored
Oct 17, 2007
by
Mikolaj Zalewski
Committed by
Alexandre Julliard
Oct 18, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Support for UTF-16 manifests with reverse endianness.
parent
9f4001f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
11 deletions
+46
-11
actctx.c
dlls/kernel32/tests/actctx.c
+23
-3
actctx.c
dlls/ntdll/actctx.c
+23
-8
No files found.
dlls/kernel32/tests/actctx.c
View file @
5bfd7044
...
...
@@ -216,7 +216,7 @@ static BOOL create_manifest_file(const char *filename, const char *manifest, int
return
TRUE
;
}
static
BOOL
create_wide_manifest
(
const
char
*
filename
,
const
char
*
manifest
,
BOOL
fBOM
)
static
BOOL
create_wide_manifest
(
const
char
*
filename
,
const
char
*
manifest
,
BOOL
fBOM
,
BOOL
fReverse
)
{
WCHAR
*
wmanifest
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlen
(
manifest
)
+
2
)
*
sizeof
(
WCHAR
));
BOOL
ret
;
...
...
@@ -224,6 +224,12 @@ static BOOL create_wide_manifest(const char *filename, const char *manifest, BOO
MultiByteToWideChar
(
CP_ACP
,
0
,
manifest
,
-
1
,
&
wmanifest
[
1
],
(
strlen
(
manifest
)
+
1
)
*
sizeof
(
WCHAR
));
wmanifest
[
0
]
=
0xfeff
;
if
(
fReverse
)
{
int
i
;
for
(
i
=
0
;
i
<
strlen
(
manifest
)
+
1
;
i
++
)
wmanifest
[
i
]
=
(
wmanifest
[
i
]
<<
8
)
|
((
wmanifest
[
i
]
>>
8
)
&
0xff
);
}
ret
=
create_manifest_file
(
filename
,
(
char
*
)
&
wmanifest
[
offset
],
(
strlen
(
manifest
)
+
1
-
offset
)
*
sizeof
(
WCHAR
),
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
wmanifest
);
return
ret
;
...
...
@@ -625,7 +631,7 @@ static void test_create_wide_and_fail(const char *manifest, BOOL fBOM)
actctx
.
cbSize
=
sizeof
(
ACTCTXW
);
actctx
.
lpSource
=
path
;
create_wide_manifest
(
"bad.manifest"
,
manifest
,
fBOM
);
create_wide_manifest
(
"bad.manifest"
,
manifest
,
fBOM
,
FALSE
);
handle
=
pCreateActCtxW
(
&
actctx
);
ok
(
handle
==
INVALID_HANDLE_VALUE
,
"handle != INVALID_HANDLE_VALUE
\n
"
);
ok
(
GetLastError
()
==
ERROR_SXS_CANT_GEN_ACTCTX
,
"GetLastError == %u
\n
"
,
GetLastError
());
...
...
@@ -1021,7 +1027,21 @@ static void test_actctx(void)
RemoveDirectoryW
(
work_dir_subdir
);
trace
(
"UTF-16 manifest1, with BOM
\n
"
);
if
(
!
create_wide_manifest
(
"test1.manifest"
,
manifest1
,
TRUE
))
{
if
(
!
create_wide_manifest
(
"test1.manifest"
,
manifest1
,
TRUE
,
FALSE
))
{
skip
(
"Could not create manifest file
\n
"
);
return
;
}
handle
=
test_create
(
"test1.manifest"
,
manifest1
);
DeleteFileA
(
"test1.manifest"
);
if
(
handle
!=
INVALID_HANDLE_VALUE
)
{
test_detailed_info
(
handle
,
&
detailed_info1
);
test_info_in_assembly
(
handle
,
1
,
&
manifest1_info
);
pReleaseActCtx
(
handle
);
}
trace
(
"UTF-16 manifest1, reverse endian, with BOM
\n
"
);
if
(
!
create_wide_manifest
(
"test1.manifest"
,
manifest1
,
TRUE
,
TRUE
))
{
skip
(
"Could not create manifest file
\n
"
);
return
;
}
...
...
dlls/ntdll/actctx.c
View file @
5bfd7044
...
...
@@ -1498,8 +1498,29 @@ static NTSTATUS parse_manifest( struct actctx_loader* acl, struct assembly_ident
assembly
->
manifest
.
type
=
assembly
->
manifest
.
info
?
ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE
:
ACTIVATION_CONTEXT_PATH_TYPE_NONE
;
unicode_tests
=
IS_TEXT_UNICODE_SIGNATURE
;
if
(
!
RtlIsTextUnicode
(
buffer
,
size
,
&
unicode_tests
))
unicode_tests
=
IS_TEXT_UNICODE_SIGNATURE
|
IS_TEXT_UNICODE_REVERSE_SIGNATURE
;
if
(
RtlIsTextUnicode
(
buffer
,
size
,
&
unicode_tests
))
{
xmlbuf
.
ptr
=
buffer
;
xmlbuf
.
end
=
xmlbuf
.
ptr
+
size
/
sizeof
(
WCHAR
);
status
=
parse_manifest_buffer
(
acl
,
assembly
,
ai
,
&
xmlbuf
);
}
else
if
(
unicode_tests
&
IS_TEXT_UNICODE_REVERSE_SIGNATURE
)
{
const
WCHAR
*
buf
=
buffer
;
WCHAR
*
new_buff
;
unsigned
int
i
;
if
(
!
(
new_buff
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
size
)))
return
STATUS_NO_MEMORY
;
for
(
i
=
0
;
i
<
size
/
sizeof
(
WCHAR
);
i
++
)
new_buff
[
i
]
=
RtlUshortByteSwap
(
buf
[
i
]
);
xmlbuf
.
ptr
=
new_buff
;
xmlbuf
.
end
=
xmlbuf
.
ptr
+
size
/
sizeof
(
WCHAR
);
status
=
parse_manifest_buffer
(
acl
,
assembly
,
ai
,
&
xmlbuf
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
new_buff
);
}
else
{
/* let's assume utf-8 for now */
int
len
=
wine_utf8_mbstowcs
(
0
,
buffer
,
size
,
NULL
,
0
);
...
...
@@ -1518,12 +1539,6 @@ static NTSTATUS parse_manifest( struct actctx_loader* acl, struct assembly_ident
status
=
parse_manifest_buffer
(
acl
,
assembly
,
ai
,
&
xmlbuf
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
new_buff
);
}
else
{
xmlbuf
.
ptr
=
buffer
;
xmlbuf
.
end
=
xmlbuf
.
ptr
+
size
/
sizeof
(
WCHAR
);
status
=
parse_manifest_buffer
(
acl
,
assembly
,
ai
,
&
xmlbuf
);
}
return
status
;
}
...
...
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