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
5b22afd3
Commit
5b22afd3
authored
Jul 20, 2010
by
Peter Urbanec
Committed by
Alexandre Julliard
Jul 21, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintab32: Avoid NULL pointer dereferences.
parent
2f7ec73a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
17 deletions
+61
-17
context.c
dlls/wintab32/context.c
+44
-6
wintab32.c
dlls/wintab32/wintab32.c
+17
-11
No files found.
dlls/wintab32/context.c
View file @
5b22afd3
...
...
@@ -155,7 +155,8 @@ static void LoadTablet(void)
{
TRACE
(
"Initializing the tablet to hwnd %p
\n
"
,
hwndDefault
);
gLoaded
=
TRUE
;
pLoadTabletInfo
(
hwndDefault
);
if
(
pLoadTabletInfo
)
pLoadTabletInfo
(
hwndDefault
);
}
int
TABLET_PostTabletMessage
(
LPOPENCONTEXT
newcontext
,
UINT
msg
,
WPARAM
wParam
,
...
...
@@ -558,6 +559,11 @@ int WINAPI WTPacketsGet(HCTX hCtx, int cMaxPkts, LPVOID lpPkts)
EnterCriticalSection
(
&
csTablet
);
context
=
TABLET_FindOpenContext
(
hCtx
);
if
(
!
context
)
{
LeaveCriticalSection
(
&
csTablet
);
return
0
;
}
if
(
lpPkts
!=
NULL
)
TABLET_BlankPacketData
(
context
,
lpPkts
,
cMaxPkts
);
...
...
@@ -608,6 +614,11 @@ BOOL WINAPI WTPacket(HCTX hCtx, UINT wSerial, LPVOID lpPkt)
EnterCriticalSection
(
&
csTablet
);
context
=
TABLET_FindOpenContext
(
hCtx
);
if
(
!
context
)
{
LeaveCriticalSection
(
&
csTablet
);
return
0
;
}
rc
=
TABLET_FindPacket
(
context
,
wSerial
,
&
wtp
);
...
...
@@ -642,6 +653,12 @@ BOOL WINAPI WTEnable(HCTX hCtx, BOOL fEnable)
EnterCriticalSection
(
&
csTablet
);
context
=
TABLET_FindOpenContext
(
hCtx
);
if
(
!
context
)
{
LeaveCriticalSection
(
&
csTablet
);
return
0
;
}
/* if we want to enable and it is not enabled then */
if
(
fEnable
&&
!
context
->
enabled
)
{
...
...
@@ -742,6 +759,12 @@ BOOL WINAPI WTGetA(HCTX hCtx, LPLOGCONTEXTA lpLogCtx)
EnterCriticalSection
(
&
csTablet
);
context
=
TABLET_FindOpenContext
(
hCtx
);
if
(
!
context
)
{
LeaveCriticalSection
(
&
csTablet
);
return
0
;
}
LOGCONTEXTWtoA
(
&
context
->
context
,
lpLogCtx
);
LeaveCriticalSection
(
&
csTablet
);
...
...
@@ -761,6 +784,12 @@ BOOL WINAPI WTGetW(HCTX hCtx, LPLOGCONTEXTW lpLogCtx)
EnterCriticalSection
(
&
csTablet
);
context
=
TABLET_FindOpenContext
(
hCtx
);
if
(
!
context
)
{
LeaveCriticalSection
(
&
csTablet
);
return
0
;
}
memmove
(
lpLogCtx
,
&
context
->
context
,
sizeof
(
LOGCONTEXTW
));
LeaveCriticalSection
(
&
csTablet
);
...
...
@@ -888,7 +917,7 @@ int WINAPI WTPacketsPeek(HCTX hCtx, int cMaxPkts, LPVOID lpPkts)
context
=
TABLET_FindOpenContext
(
hCtx
);
if
(
context
->
PacketsQueued
==
0
)
if
(
!
context
||
context
->
PacketsQueued
==
0
)
{
LeaveCriticalSection
(
&
csTablet
);
return
0
;
...
...
@@ -923,7 +952,7 @@ int WINAPI WTDataGet(HCTX hCtx, UINT wBegin, UINT wEnd,
context
=
TABLET_FindOpenContext
(
hCtx
);
if
(
context
->
PacketsQueued
==
0
)
if
(
!
context
||
context
->
PacketsQueued
==
0
)
{
LeaveCriticalSection
(
&
csTablet
);
return
0
;
...
...
@@ -981,7 +1010,7 @@ int WINAPI WTDataPeek(HCTX hCtx, UINT wBegin, UINT wEnd,
context
=
TABLET_FindOpenContext
(
hCtx
);
if
(
context
->
PacketsQueued
==
0
)
if
(
!
context
||
context
->
PacketsQueued
==
0
)
{
LeaveCriticalSection
(
&
csTablet
);
return
0
;
...
...
@@ -1028,7 +1057,7 @@ BOOL WINAPI WTQueuePacketsEx(HCTX hCtx, UINT *lpOld, UINT *lpNew)
context
=
TABLET_FindOpenContext
(
hCtx
);
if
(
context
->
PacketsQueued
)
if
(
context
&&
context
->
PacketsQueued
)
{
*
lpOld
=
context
->
PacketQueue
[
0
].
pkSerialNumber
;
*
lpNew
=
context
->
PacketQueue
[
context
->
PacketsQueued
-
1
].
pkSerialNumber
;
...
...
@@ -1050,14 +1079,18 @@ BOOL WINAPI WTQueuePacketsEx(HCTX hCtx, UINT *lpOld, UINT *lpNew)
int
WINAPI
WTQueueSizeGet
(
HCTX
hCtx
)
{
LPOPENCONTEXT
context
;
int
queueSize
=
0
;
TRACE
(
"(%p)
\n
"
,
hCtx
);
if
(
!
hCtx
)
return
0
;
EnterCriticalSection
(
&
csTablet
);
context
=
TABLET_FindOpenContext
(
hCtx
);
if
(
context
)
queueSize
=
context
->
QueueSize
;
LeaveCriticalSection
(
&
csTablet
);
return
context
->
Q
ueueSize
;
return
q
ueueSize
;
}
/***********************************************************************
...
...
@@ -1074,6 +1107,11 @@ BOOL WINAPI WTQueueSizeSet(HCTX hCtx, int nPkts)
EnterCriticalSection
(
&
csTablet
);
context
=
TABLET_FindOpenContext
(
hCtx
);
if
(
!
context
)
{
LeaveCriticalSection
(
&
csTablet
);
return
0
;
}
context
->
PacketQueue
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
context
->
PacketQueue
,
sizeof
(
WTPACKET
)
*
nPkts
);
...
...
dlls/wintab32/wintab32.c
View file @
5b22afd3
...
...
@@ -124,23 +124,29 @@ static LRESULT WINAPI TABLET_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
{
WTPACKET
packet
;
LPOPENCONTEXT
handler
;
pGetCurrentPacket
(
&
packet
);
handler
=
AddPacketToContextQueue
(
&
packet
,(
HWND
)
lParam
);
if
(
handler
&&
handler
->
context
.
lcOptions
&
CXO_MESSAGES
)
TABLET_PostTabletMessage
(
handler
,
_WT_PACKET
(
handler
->
context
.
lcMsgBase
),
(
WPARAM
)
packet
.
pkSerialNumber
,
(
LPARAM
)
handler
->
handle
,
FALSE
);
if
(
pGetCurrentPacket
)
{
pGetCurrentPacket
(
&
packet
);
handler
=
AddPacketToContextQueue
(
&
packet
,(
HWND
)
lParam
);
if
(
handler
&&
handler
->
context
.
lcOptions
&
CXO_MESSAGES
)
TABLET_PostTabletMessage
(
handler
,
_WT_PACKET
(
handler
->
context
.
lcMsgBase
),
(
WPARAM
)
packet
.
pkSerialNumber
,
(
LPARAM
)
handler
->
handle
,
FALSE
);
}
break
;
}
case
WT_PROXIMITY
:
{
WTPACKET
packet
;
LPOPENCONTEXT
handler
;
pGetCurrentPacket
(
&
packet
);
handler
=
AddPacketToContextQueue
(
&
packet
,(
HWND
)
wParam
);
if
(
handler
)
TABLET_PostTabletMessage
(
handler
,
WT_PROXIMITY
,
(
WPARAM
)
handler
->
handle
,
lParam
,
TRUE
);
if
(
pGetCurrentPacket
)
{
pGetCurrentPacket
(
&
packet
);
handler
=
AddPacketToContextQueue
(
&
packet
,(
HWND
)
wParam
);
if
(
handler
)
TABLET_PostTabletMessage
(
handler
,
WT_PROXIMITY
,
(
WPARAM
)
handler
->
handle
,
lParam
,
TRUE
);
}
break
;
}
}
...
...
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