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
5d74e575
Commit
5d74e575
authored
Feb 27, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 01, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Fix mask usage in SHSetWindowBits with tests.
parent
d970ea7f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
123 additions
and
35 deletions
+123
-35
ordinal.c
dlls/shlwapi/ordinal.c
+11
-9
Makefile.in
dlls/shlwapi/tests/Makefile.in
+1
-1
ordinal.c
dlls/shlwapi/tests/ordinal.c
+111
-25
No files found.
dlls/shlwapi/ordinal.c
View file @
5d74e575
...
...
@@ -1082,23 +1082,25 @@ HRESULT WINAPI IUnknown_Exec(IUnknown* lpUnknown, REFGUID pguidCmdGroup,
* PARAMS
* hWnd [I] Window to get value from
* offset [I] Offset of value
*
wMask [I] Mask for uiF
lags
*
wFlags
[I] Bits to set in window value
*
mask [I] Mask for f
lags
*
flags
[I] Bits to set in window value
*
* RETURNS
* The new value as it was set, or 0 if any parameter is invalid.
*
* NOTES
*
Any bits set in uiMask are cleared from the value, then any bits set in
*
uiFlags are set in the valu
e.
*
Only bits specified in mask are affected - set if present in flags and
*
reset otherwis
e.
*/
LONG
WINAPI
SHSetWindowBits
(
HWND
hwnd
,
INT
offset
,
UINT
wMask
,
UINT
wF
lags
)
LONG
WINAPI
SHSetWindowBits
(
HWND
hwnd
,
INT
offset
,
UINT
mask
,
UINT
f
lags
)
{
LONG
ret
=
GetWindowLong
A
(
hwnd
,
offset
);
LONG
new
Flags
=
(
wFlags
&
wMask
)
|
(
ret
&
~
wFlags
);
LONG
ret
=
GetWindowLong
W
(
hwnd
,
offset
);
LONG
new
_flags
=
(
flags
&
mask
)
|
(
ret
&
~
mask
);
if
(
newFlags
!=
ret
)
ret
=
SetWindowLongA
(
hwnd
,
offset
,
newFlags
);
TRACE
(
"%p %d %x %x
\n
"
,
hwnd
,
offset
,
mask
,
flags
);
if
(
new_flags
!=
ret
)
ret
=
SetWindowLongW
(
hwnd
,
offset
,
new_flags
);
return
ret
;
}
...
...
dlls/shlwapi/tests/Makefile.in
View file @
5d74e575
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
shlwapi.dll
IMPORTS
=
shlwapi
advapi32 ole32 oleaut
32 kernel32
IMPORTS
=
shlwapi
user32 ole32 oleaut32 advapi
32 kernel32
C_SRCS
=
\
assoc.c
\
...
...
dlls/shlwapi/tests/ordinal.c
View file @
5d74e575
...
...
@@ -43,6 +43,7 @@ static HRESULT(WINAPI *pIConnectionPoint_SimpleInvoke)(IConnectionPoint*,DISPID,
static
HRESULT
(
WINAPI
*
pIConnectionPoint_InvokeWithCancel
)(
IConnectionPoint
*
,
DISPID
,
DISPPARAMS
*
,
DWORD
,
DWORD
);
static
HRESULT
(
WINAPI
*
pConnectToConnectionPoint
)(
IUnknown
*
,
REFIID
,
BOOL
,
IUnknown
*
,
LPDWORD
,
IConnectionPoint
**
);
static
HRESULT
(
WINAPI
*
pSHPropertyBag_ReadLONG
)(
IPropertyBag
*
,
LPCWSTR
,
LPLONG
);
static
LONG
(
WINAPI
*
pSHSetWindowBits
)(
HWND
hwnd
,
INT
offset
,
UINT
wMask
,
UINT
wFlags
);
static
HMODULE
hmlang
;
static
HRESULT
(
WINAPI
*
pLcidToRfc1766A
)(
LCID
,
LPSTR
,
INT
);
...
...
@@ -1397,31 +1398,116 @@ static void test_SHPropertyBag_ReadLONG(void)
IUnknown_Release
((
IUnknown
*
)
pb
);
}
static
void
test_SHSetWindowBits
(
void
)
{
HWND
hwnd
;
DWORD
style
,
styleold
;
WNDCLASSA
clsA
;
if
(
!
pSHSetWindowBits
)
{
win_skip
(
"SHSetWindowBits is not available
\n
"
);
return
;
}
clsA
.
style
=
0
;
clsA
.
lpfnWndProc
=
DefWindowProcA
;
clsA
.
cbClsExtra
=
0
;
clsA
.
cbWndExtra
=
0
;
clsA
.
hInstance
=
GetModuleHandleA
(
NULL
);
clsA
.
hIcon
=
0
;
clsA
.
hCursor
=
LoadCursorA
(
0
,
IDC_ARROW
);
clsA
.
hbrBackground
=
NULL
;
clsA
.
lpszMenuName
=
NULL
;
clsA
.
lpszClassName
=
"Shlwapi test class"
;
RegisterClassA
(
&
clsA
);
hwnd
=
CreateWindowA
(
"Shlwapi test class"
,
"Test"
,
WS_VISIBLE
,
0
,
0
,
100
,
100
,
NULL
,
NULL
,
GetModuleHandle
(
NULL
),
0
);
ok
(
IsWindow
(
hwnd
),
"failed to create window
\n
"
);
/* null window */
SetLastError
(
0xdeadbeef
);
style
=
pSHSetWindowBits
(
NULL
,
GWL_STYLE
,
0
,
0
);
ok
(
style
==
0
,
"expected 0 retval, got %d
\n
"
,
style
);
ok
(
GetLastError
()
==
ERROR_INVALID_WINDOW_HANDLE
,
"expected ERROR_INVALID_WINDOW_HANDLE, got %d
\n
"
,
GetLastError
());
/* zero mask, zero flags */
styleold
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
style
=
pSHSetWindowBits
(
hwnd
,
GWL_STYLE
,
0
,
0
);
ok
(
styleold
==
style
,
"expected old style
\n
"
);
ok
(
styleold
==
GetWindowLongA
(
hwnd
,
GWL_STYLE
),
"expected to keep old style
\n
"
);
/* test mask */
styleold
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
ok
(
styleold
&
WS_VISIBLE
,
"expected WS_VISIBLE
\n
"
);
style
=
pSHSetWindowBits
(
hwnd
,
GWL_STYLE
,
WS_VISIBLE
,
0
);
ok
(
style
==
styleold
,
"expected previous style, got %x
\n
"
,
style
);
ok
((
GetWindowLongA
(
hwnd
,
GWL_STYLE
)
&
WS_VISIBLE
)
==
0
,
"expected updated style
\n
"
);
/* test mask, unset style bit used */
styleold
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
style
=
pSHSetWindowBits
(
hwnd
,
GWL_STYLE
,
WS_VISIBLE
,
0
);
ok
(
style
==
styleold
,
"expected previous style, got %x
\n
"
,
style
);
ok
(
styleold
==
GetWindowLongA
(
hwnd
,
GWL_STYLE
),
"expected to keep old style
\n
"
);
/* set back with flags */
styleold
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
style
=
pSHSetWindowBits
(
hwnd
,
GWL_STYLE
,
WS_VISIBLE
,
WS_VISIBLE
);
ok
(
style
==
styleold
,
"expected previous style, got %x
\n
"
,
style
);
ok
(
GetWindowLongA
(
hwnd
,
GWL_STYLE
)
&
WS_VISIBLE
,
"expected updated style
\n
"
);
/* reset and try to set without a mask */
pSHSetWindowBits
(
hwnd
,
GWL_STYLE
,
WS_VISIBLE
,
0
);
ok
((
GetWindowLongA
(
hwnd
,
GWL_STYLE
)
&
WS_VISIBLE
)
==
0
,
"expected updated style
\n
"
);
styleold
=
GetWindowLongA
(
hwnd
,
GWL_STYLE
);
style
=
pSHSetWindowBits
(
hwnd
,
GWL_STYLE
,
0
,
WS_VISIBLE
);
ok
(
style
==
styleold
,
"expected previous style, got %x
\n
"
,
style
);
ok
((
GetWindowLongA
(
hwnd
,
GWL_STYLE
)
&
WS_VISIBLE
)
==
0
,
"expected updated style
\n
"
);
DestroyWindow
(
hwnd
);
UnregisterClassA
(
"Shlwapi test class"
,
GetModuleHandleA
(
NULL
));
}
static
void
init_pointers
(
void
)
{
#define MAKEFUNC(f, ord) (p##f = (void*)GetProcAddress(hShlwapi, (LPSTR)(ord)))
MAKEFUNC
(
SHAllocShared
,
7
);
MAKEFUNC
(
SHLockShared
,
8
);
MAKEFUNC
(
SHUnlockShared
,
9
);
MAKEFUNC
(
SHFreeShared
,
10
);
MAKEFUNC
(
GetAcceptLanguagesA
,
14
);
MAKEFUNC
(
SHSetWindowBits
,
165
);
MAKEFUNC
(
ConnectToConnectionPoint
,
168
);
MAKEFUNC
(
SHSearchMapInt
,
198
);
MAKEFUNC
(
SHPackDispParams
,
282
);
MAKEFUNC
(
IConnectionPoint_InvokeWithCancel
,
283
);
MAKEFUNC
(
IConnectionPoint_SimpleInvoke
,
284
);
MAKEFUNC
(
SHPropertyBag_ReadLONG
,
496
);
#undef MAKEFUNC
}
START_TEST
(
ordinal
)
{
hShlwapi
=
GetModuleHandleA
(
"shlwapi.dll"
);
pGetAcceptLanguagesA
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
(
LPSTR
)
14
);
pSHSearchMapInt
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
(
LPSTR
)
198
);
pSHAllocShared
=
(
void
*
)
GetProcAddress
(
hShlwapi
,(
char
*
)
7
);
pSHLockShared
=
(
void
*
)
GetProcAddress
(
hShlwapi
,(
char
*
)
8
);
pSHUnlockShared
=
(
void
*
)
GetProcAddress
(
hShlwapi
,(
char
*
)
9
);
pSHFreeShared
=
(
void
*
)
GetProcAddress
(
hShlwapi
,(
char
*
)
10
);
pSHPackDispParams
=
(
void
*
)
GetProcAddress
(
hShlwapi
,(
char
*
)
282
);
pIConnectionPoint_SimpleInvoke
=
(
void
*
)
GetProcAddress
(
hShlwapi
,(
char
*
)
284
);
pIConnectionPoint_InvokeWithCancel
=
(
void
*
)
GetProcAddress
(
hShlwapi
,(
char
*
)
283
);
pConnectToConnectionPoint
=
(
void
*
)
GetProcAddress
(
hShlwapi
,(
char
*
)
168
);
pSHPropertyBag_ReadLONG
=
(
void
*
)
GetProcAddress
(
hShlwapi
,(
char
*
)
496
);
hmlang
=
LoadLibraryA
(
"mlang.dll"
);
pLcidToRfc1766A
=
(
void
*
)
GetProcAddress
(
hmlang
,
"LcidToRfc1766A"
);
test_GetAcceptLanguagesA
();
test_SHSearchMapInt
();
test_alloc_shared
();
test_fdsa
();
test_GetShellSecurityDescriptor
();
test_SHPackDispParams
();
test_IConnectionPoint
();
test_SHPropertyBag_ReadLONG
();
hShlwapi
=
GetModuleHandleA
(
"shlwapi.dll"
);
init_pointers
();
hmlang
=
LoadLibraryA
(
"mlang.dll"
);
pLcidToRfc1766A
=
(
void
*
)
GetProcAddress
(
hmlang
,
"LcidToRfc1766A"
);
test_GetAcceptLanguagesA
();
test_SHSearchMapInt
();
test_alloc_shared
();
test_fdsa
();
test_GetShellSecurityDescriptor
();
test_SHPackDispParams
();
test_IConnectionPoint
();
test_SHPropertyBag_ReadLONG
();
test_SHSetWindowBits
();
}
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