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
bbb7358d
Commit
bbb7358d
authored
Jul 12, 2013
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 12, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Some tests for FindActCtxSectionGuid().
parent
104adb74
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
125 additions
and
0 deletions
+125
-0
actctx.c
dlls/kernel32/tests/actctx.c
+125
-0
No files found.
dlls/kernel32/tests/actctx.c
View file @
bbb7358d
...
...
@@ -24,6 +24,8 @@
#include <winnls.h>
#include <stdio.h>
#include "initguid.h"
static
BOOL
(
WINAPI
*
pActivateActCtx
)(
HANDLE
,
ULONG_PTR
*
);
static
HANDLE
(
WINAPI
*
pCreateActCtxW
)(
PCACTCTXW
);
static
BOOL
(
WINAPI
*
pDeactivateActCtx
)(
DWORD
,
ULONG_PTR
);
...
...
@@ -32,6 +34,7 @@ static BOOL (WINAPI *pGetCurrentActCtx)(HANDLE *);
static
BOOL
(
WINAPI
*
pIsDebuggerPresent
)(
void
);
static
BOOL
(
WINAPI
*
pQueryActCtxW
)(
DWORD
,
HANDLE
,
PVOID
,
ULONG
,
PVOID
,
SIZE_T
,
SIZE_T
*
);
static
VOID
(
WINAPI
*
pReleaseActCtx
)(
HANDLE
);
static
BOOL
(
WINAPI
*
pFindActCtxSectionGuid
)(
DWORD
,
const
GUID
*
,
ULONG
,
const
GUID
*
,
PACTCTX_SECTION_KEYED_DATA
);
static
const
char
*
strw
(
LPCWSTR
x
)
{
...
...
@@ -43,6 +46,18 @@ static const char* strw(LPCWSTR x)
return
buffer
;
}
static
const
char
*
debugstr_guid
(
REFIID
riid
)
{
static
char
buf
[
50
];
sprintf
(
buf
,
"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"
,
riid
->
Data1
,
riid
->
Data2
,
riid
->
Data3
,
riid
->
Data4
[
0
],
riid
->
Data4
[
1
],
riid
->
Data4
[
2
],
riid
->
Data4
[
3
],
riid
->
Data4
[
4
],
riid
->
Data4
[
5
],
riid
->
Data4
[
6
],
riid
->
Data4
[
7
]);
return
buf
;
}
#ifdef __i386__
#define ARCH "x86"
#elif defined __x86_64__
...
...
@@ -68,12 +83,21 @@ static const char manifest2[] =
"</dependency>"
"</assembly>"
;
DEFINE_GUID
(
IID_CoTest
,
0x12345678
,
0x1234
,
0x5678
,
0x12
,
0x34
,
0x11
,
0x11
,
0x22
,
0x22
,
0x33
,
0x33
);
DEFINE_GUID
(
IID_TlibTest
,
0x99999999
,
0x8888
,
0x7777
,
0x66
,
0x66
,
0x55
,
0x55
,
0x55
,
0x55
,
0x55
,
0x55
);
static
const
char
manifest3
[]
=
"<assembly xmlns=
\"
urn:schemas-microsoft-com:asm.v1
\"
manifestVersion=
\"
1.0
\"
>"
"<assemblyIdentity version=
\"
1.2.3.4
\"
name=
\"
Wine.Test
\"
type=
\"
win32
\"
"
" publicKeyToken=
\"
6595b6414666f1df
\"
/>"
"<file name=
\"
testlib.dll
\"
>"
"<windowClass>wndClass</windowClass>"
" <comClass description=
\"
Test com class
\"
"
" clsid=
\"
{12345678-1234-5678-1234-111122223333}
\"
"
" tlbid=
\"
{99999999-8888-7777-6666-555555555555}
\"
"
" threadingModel=
\"
Neutral
\"
"
" progid=
\"
ProgId.ProgId
\"
"
" />"
"</file>"
"</assembly>"
;
...
...
@@ -965,6 +989,105 @@ static void test_basic_info(HANDLE handle, int line)
}
}
enum
comclass_threadingmodel
{
ThreadingModel_Apartment
=
1
,
ThreadingModel_Free
=
2
,
ThreadingModel_Both
=
4
,
ThreadingModel_Neutral
=
5
};
enum
comclass_miscfields
{
MiscStatus
=
0x1
,
MiscStatusIcon
=
0x2
,
MiscStatusContent
=
0x4
,
MiscStatusThumbnail
=
0x8
};
struct
comclass_keyed_data
{
DWORD
size
;
BYTE
reserved
;
BYTE
miscmask
;
BYTE
unk
[
2
];
DWORD
model
;
GUID
clsid
;
GUID
unkguid
;
GUID
clsid2
;
GUID
tlid
;
DWORD
modulename_len
;
DWORD
modulename_offset
;
DWORD
progid_len
;
DWORD
progid_offset
;
DWORD
res2
[
7
];
WCHAR
strdata
[
1
];
};
static
void
test_find_com_redirection
(
HANDLE
handle
,
const
GUID
*
clsid
,
const
GUID
*
tlid
,
ULONG
exid
,
int
line
)
{
struct
comclass_keyed_data
*
comclass
;
ACTCTX_SECTION_KEYED_DATA
data
;
BOOL
ret
;
memset
(
&
data
,
0xfe
,
sizeof
(
data
));
data
.
cbSize
=
sizeof
(
data
);
ret
=
pFindActCtxSectionGuid
(
0
,
NULL
,
ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION
,
clsid
,
&
data
);
todo_wine
ok_
(
__FILE__
,
line
)(
ret
,
"FindActCtxSectionGuid failed: %u
\n
"
,
GetLastError
());
if
(
!
ret
)
{
skip
(
"couldn't find guid %s
\n
"
,
debugstr_guid
(
clsid
));
return
;
}
comclass
=
(
struct
comclass_keyed_data
*
)
data
.
lpData
;
ok_
(
__FILE__
,
line
)(
data
.
cbSize
==
sizeof
(
data
),
"data.cbSize=%u
\n
"
,
data
.
cbSize
);
ok_
(
__FILE__
,
line
)(
data
.
ulDataFormatVersion
==
1
,
"data.ulDataFormatVersion=%u
\n
"
,
data
.
ulDataFormatVersion
);
ok_
(
__FILE__
,
line
)(
data
.
lpData
!=
NULL
,
"data.lpData == NULL
\n
"
);
ok_
(
__FILE__
,
line
)(
comclass
->
size
==
FIELD_OFFSET
(
struct
comclass_keyed_data
,
strdata
),
"got %d for header size
\n
"
,
comclass
->
size
);
if
(
data
.
lpData
&&
comclass
->
size
==
FIELD_OFFSET
(
struct
comclass_keyed_data
,
strdata
))
{
static
const
WCHAR
progid
[]
=
{
'P'
,
'r'
,
'o'
,
'g'
,
'I'
,
'd'
,
'.'
,
'P'
,
'r'
,
'o'
,
'g'
,
'I'
,
'd'
,
0
};
WCHAR
*
ptr
;
ULONG
len
;
ok_
(
__FILE__
,
line
)(
comclass
->
reserved
==
0
,
"got reserved as %d
\n
"
,
comclass
->
reserved
);
ok_
(
__FILE__
,
line
)(
comclass
->
miscmask
==
0
,
"got miscmask as %02x
\n
"
,
comclass
->
miscmask
);
ok_
(
__FILE__
,
line
)(
comclass
->
unk
[
0
]
==
0
,
"got unk[0] as %02x
\n
"
,
comclass
->
unk
[
0
]);
ok_
(
__FILE__
,
line
)(
comclass
->
unk
[
1
]
==
0
,
"got unk[1] as %02x
\n
"
,
comclass
->
unk
[
1
]);
ok_
(
__FILE__
,
line
)(
comclass
->
model
==
ThreadingModel_Neutral
,
"got model %d
\n
"
,
comclass
->
model
);
ok_
(
__FILE__
,
line
)(
IsEqualGUID
(
&
comclass
->
clsid
,
clsid
),
"got wrong clsid %s
\n
"
,
debugstr_guid
(
&
comclass
->
clsid
));
ok_
(
__FILE__
,
line
)(
IsEqualGUID
(
&
comclass
->
clsid2
,
clsid
),
"got wrong clsid2 %s
\n
"
,
debugstr_guid
(
&
comclass
->
clsid2
));
ok_
(
__FILE__
,
line
)(
IsEqualGUID
(
&
comclass
->
tlid
,
tlid
),
"got wrong tlid %s
\n
"
,
debugstr_guid
(
&
comclass
->
tlid
));
ok_
(
__FILE__
,
line
)(
comclass
->
modulename_len
>
0
,
"got modulename len %d
\n
"
,
comclass
->
modulename_len
);
ok_
(
__FILE__
,
line
)(
comclass
->
progid_offset
==
comclass
->
size
,
"got progid offset %d
\n
"
,
comclass
->
progid_offset
);
ptr
=
(
WCHAR
*
)((
BYTE
*
)
comclass
+
comclass
->
size
);
ok_
(
__FILE__
,
line
)(
!
lstrcmpW
(
ptr
,
progid
),
"got wrong progid %s, expected %s
\n
"
,
wine_dbgstr_w
(
ptr
),
wine_dbgstr_w
(
progid
));
ok_
(
__FILE__
,
line
)(
lstrlenW
(
ptr
)
*
sizeof
(
WCHAR
)
==
comclass
->
progid_len
,
"got progid name length %d, expected %d
\n
"
,
comclass
->
progid_len
,
lstrlenW
(
ptr
));
/* data length is simply header length + string data length including nulls */
len
=
comclass
->
size
+
comclass
->
progid_len
+
sizeof
(
WCHAR
);
ok_
(
__FILE__
,
line
)(
data
.
ulLength
==
len
,
"got wrong data length %d, expected %d
\n
"
,
data
.
ulLength
,
len
);
/* keyed data structure doesn't include module name, it's available from section data */
ok_
(
__FILE__
,
line
)(
data
.
ulSectionTotalLength
>
comclass
->
modulename_offset
,
"got wrong offset %d
\n
"
,
comclass
->
modulename_offset
);
}
ok_
(
__FILE__
,
line
)(
data
.
lpSectionGlobalData
!=
NULL
,
"data.lpSectionGlobalData == NULL
\n
"
);
ok_
(
__FILE__
,
line
)(
data
.
ulSectionGlobalDataLength
>
0
,
"data.ulSectionGlobalDataLength=%u
\n
"
,
data
.
ulSectionGlobalDataLength
);
ok_
(
__FILE__
,
line
)(
data
.
lpSectionBase
!=
NULL
,
"data.lpSectionBase == NULL
\n
"
);
ok_
(
__FILE__
,
line
)(
data
.
ulSectionTotalLength
>
0
,
"data.ulSectionTotalLength=%u
\n
"
,
data
.
ulSectionTotalLength
);
ok_
(
__FILE__
,
line
)(
data
.
hActCtx
==
NULL
,
"data.hActCtx=%p
\n
"
,
data
.
hActCtx
);
ok_
(
__FILE__
,
line
)(
data
.
ulAssemblyRosterIndex
==
exid
,
"data.ulAssemblyRosterIndex=%u, expected %u
\n
"
,
data
.
ulAssemblyRosterIndex
,
exid
);
}
static
void
test_actctx
(
void
)
{
ULONG_PTR
cookie
;
...
...
@@ -1104,6 +1227,7 @@ static void test_actctx(void)
ok
(
b
,
"ActivateActCtx failed: %u
\n
"
,
GetLastError
());
test_find_dll_redirection
(
handle
,
testlib_dll
,
1
,
__LINE__
);
test_find_dll_redirection
(
handle
,
testlib_dll
,
1
,
__LINE__
);
test_find_com_redirection
(
handle
,
&
IID_CoTest
,
&
IID_TlibTest
,
1
,
__LINE__
);
test_find_string_fail
();
b
=
pDeactivateActCtx
(
0
,
cookie
);
ok
(
b
,
"DeactivateActCtx failed: %u
\n
"
,
GetLastError
());
...
...
@@ -1278,6 +1402,7 @@ static BOOL init_funcs(void)
X
(
IsDebuggerPresent
);
X
(
QueryActCtxW
);
X
(
ReleaseActCtx
);
X
(
FindActCtxSectionGuid
);
#undef X
return
TRUE
;
...
...
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