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
54479863
Commit
54479863
authored
Sep 14, 2023
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Nov 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add some tests for CreateActCtx() with different structure sizes.
Signed-off-by:
Dmitry Timoshkov
<
dmitry@baikal.ru
>
parent
26909848
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
106 additions
and
1 deletion
+106
-1
actctx.c
dlls/kernel32/tests/actctx.c
+106
-1
No files found.
dlls/kernel32/tests/actctx.c
View file @
54479863
...
@@ -2800,18 +2800,123 @@ static void test_CreateActCtx(void)
...
@@ -2800,18 +2800,123 @@ static void test_CreateActCtx(void)
{
{
static
const
DWORD
flags
[]
=
{
LOAD_LIBRARY_AS_DATAFILE
,
LOAD_LIBRARY_AS_IMAGE_RESOURCE
,
static
const
DWORD
flags
[]
=
{
LOAD_LIBRARY_AS_DATAFILE
,
LOAD_LIBRARY_AS_IMAGE_RESOURCE
,
LOAD_LIBRARY_AS_IMAGE_RESOURCE
|
LOAD_LIBRARY_AS_DATAFILE
};
LOAD_LIBRARY_AS_IMAGE_RESOURCE
|
LOAD_LIBRARY_AS_DATAFILE
};
CHAR
path
[
MAX_PATH
],
dir
[
MAX_PATH
],
dll
[
MAX_PATH
];
static
const
struct
{
DWORD
size
,
flags
,
error
;
}
test
[]
=
{
{
FIELD_OFFSET
(
ACTCTXW
,
lpSource
),
0
,
ERROR_INVALID_PARAMETER
},
{
FIELD_OFFSET
(
ACTCTXW
,
wProcessorArchitecture
),
0
,
0
},
{
FIELD_OFFSET
(
ACTCTXW
,
lpAssemblyDirectory
),
ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID
,
ERROR_INVALID_PARAMETER
},
{
FIELD_OFFSET
(
ACTCTXW
,
lpResourceName
),
ACTCTX_FLAG_RESOURCE_NAME_VALID
,
ERROR_INVALID_PARAMETER
},
{
FIELD_OFFSET
(
ACTCTXW
,
hModule
),
ACTCTX_FLAG_RESOURCE_NAME_VALID
|
ACTCTX_FLAG_HMODULE_VALID
,
ERROR_INVALID_PARAMETER
},
};
char
path
[
MAX_PATH
],
dir
[
MAX_PATH
],
dll
[
MAX_PATH
],
source
[
MAX_PATH
];
WCHAR
pathW
[
MAX_PATH
],
dirW
[
MAX_PATH
],
sourceW
[
MAX_PATH
];
ACTCTXA
actctx
;
ACTCTXA
actctx
;
ACTCTXW
ctxW
;
HANDLE
handle
;
HANDLE
handle
;
int
i
;
int
i
;
GetTempPathA
(
ARRAY_SIZE
(
path
),
path
);
GetTempPathA
(
ARRAY_SIZE
(
path
),
path
);
strcpy
(
dir
,
path
);
strcat
(
path
,
"main_wndcls.manifest"
);
strcat
(
path
,
"main_wndcls.manifest"
);
write_manifest
(
"testdep1.manifest"
,
manifest_wndcls1
);
write_manifest
(
"testdep1.manifest"
,
manifest_wndcls1
);
write_manifest
(
"testdep2.manifest"
,
manifest_wndcls2
);
write_manifest
(
"testdep2.manifest"
,
manifest_wndcls2
);
write_manifest
(
"main_wndcls.manifest"
,
manifest_wndcls_main
);
write_manifest
(
"main_wndcls.manifest"
,
manifest_wndcls_main
);
GetModuleFileNameA
(
NULL
,
source
,
ARRAY_SIZE
(
source
));
GetModuleFileNameW
(
NULL
,
sourceW
,
ARRAY_SIZE
(
sourceW
));
GetTempPathW
(
ARRAY_SIZE
(
pathW
),
pathW
);
wcscpy
(
dirW
,
pathW
);
wcscat
(
pathW
,
L"main_wndcls.manifest"
);
memset
(
&
ctxW
,
0
,
sizeof
(
ctxW
));
ctxW
.
cbSize
=
sizeof
(
ctxW
);
ctxW
.
dwFlags
=
ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID
|
ACTCTX_FLAG_RESOURCE_NAME_VALID
|
ACTCTX_FLAG_HMODULE_VALID
;
ctxW
.
lpSource
=
pathW
;
ctxW
.
lpAssemblyDirectory
=
dirW
;
ctxW
.
lpResourceName
=
(
LPWSTR
)
124
;
ctxW
.
hModule
=
GetModuleHandleW
(
NULL
);
handle
=
CreateActCtxW
(
&
ctxW
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"CreateActCtx error %lu
\n
"
,
GetLastError
());
ReleaseActCtx
(
handle
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
test
);
i
++
)
{
winetest_push_context
(
"%i"
,
i
);
ctxW
.
cbSize
=
test
[
i
].
size
;
ctxW
.
dwFlags
=
test
[
i
].
flags
;
SetLastError
(
0xdeadbeef
);
handle
=
CreateActCtxW
(
&
ctxW
);
if
(
!
test
[
i
].
error
)
{
todo_wine
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"CreateActCtx error %lu
\n
"
,
GetLastError
());
ReleaseActCtx
(
handle
);
}
else
{
ok
(
handle
==
INVALID_HANDLE_VALUE
,
"CreateActCtx should fail
\n
"
);
ok
(
test
[
i
].
error
==
GetLastError
(),
"expected %lu, got %lu
\n
"
,
test
[
i
].
error
,
GetLastError
());
}
ctxW
.
cbSize
+=
sizeof
(
void
*
);
if
((
ctxW
.
dwFlags
&
(
ACTCTX_FLAG_RESOURCE_NAME_VALID
|
ACTCTX_FLAG_HMODULE_VALID
))
==
ACTCTX_FLAG_RESOURCE_NAME_VALID
)
ctxW
.
lpSource
=
sourceW
;
/* source without hModule must point to valid PE */
SetLastError
(
0xdeadbeef
);
handle
=
CreateActCtxW
(
&
ctxW
);
todo_wine_if
(
i
!=
4
)
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"CreateActCtx error %lu
\n
"
,
GetLastError
());
ReleaseActCtx
(
handle
);
winetest_pop_context
();
}
memset
(
&
actctx
,
0
,
sizeof
(
actctx
));
actctx
.
cbSize
=
sizeof
(
actctx
);
actctx
.
dwFlags
=
ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID
|
ACTCTX_FLAG_RESOURCE_NAME_VALID
|
ACTCTX_FLAG_HMODULE_VALID
;
actctx
.
lpSource
=
path
;
actctx
.
lpAssemblyDirectory
=
dir
;
actctx
.
lpResourceName
=
(
LPSTR
)
124
;
actctx
.
hModule
=
GetModuleHandleW
(
NULL
);
handle
=
CreateActCtxA
(
&
actctx
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"CreateActCtx error %lu
\n
"
,
GetLastError
());
ReleaseActCtx
(
handle
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
test
);
i
++
)
{
winetest_push_context
(
"%i"
,
i
);
actctx
.
cbSize
=
test
[
i
].
size
;
actctx
.
dwFlags
=
test
[
i
].
flags
;
SetLastError
(
0xdeadbeef
);
handle
=
CreateActCtxA
(
&
actctx
);
if
(
!
test
[
i
].
error
)
{
todo_wine
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"CreateActCtx error %lu
\n
"
,
GetLastError
());
ReleaseActCtx
(
handle
);
}
else
{
ok
(
handle
==
INVALID_HANDLE_VALUE
,
"CreateActCtx should fail
\n
"
);
ok
(
test
[
i
].
error
==
GetLastError
(),
"expected %lu, got %lu
\n
"
,
test
[
i
].
error
,
GetLastError
());
}
actctx
.
cbSize
+=
sizeof
(
void
*
);
if
((
actctx
.
dwFlags
&
(
ACTCTX_FLAG_RESOURCE_NAME_VALID
|
ACTCTX_FLAG_HMODULE_VALID
))
==
ACTCTX_FLAG_RESOURCE_NAME_VALID
)
actctx
.
lpSource
=
source
;
/* source without hModule must point to valid PE */
SetLastError
(
0xdeadbeef
);
handle
=
CreateActCtxA
(
&
actctx
);
todo_wine_if
(
i
!=
4
)
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"CreateActCtx error %lu
\n
"
,
GetLastError
());
ReleaseActCtx
(
handle
);
winetest_pop_context
();
}
memset
(
&
actctx
,
0
,
sizeof
(
ACTCTXA
));
memset
(
&
actctx
,
0
,
sizeof
(
ACTCTXA
));
actctx
.
cbSize
=
sizeof
(
ACTCTXA
);
actctx
.
cbSize
=
sizeof
(
ACTCTXA
);
actctx
.
lpSource
=
path
;
actctx
.
lpSource
=
path
;
...
...
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