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
93e3f905
Commit
93e3f905
authored
Feb 25, 1999
by
Francois Boisvert
Committed by
Alexandre Julliard
Feb 25, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding of new functions to make the wnd struct thread safe. Adding of
irefCount in wnd struct.
parent
f544507b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
1 deletion
+101
-1
win.h
include/win.h
+6
-0
win.c
windows/win.c
+95
-1
No files found.
include/win.h
View file @
93e3f905
...
@@ -79,6 +79,7 @@ typedef struct tagWND
...
@@ -79,6 +79,7 @@ typedef struct tagWND
DWORD
helpContext
;
/* Help context ID */
DWORD
helpContext
;
/* Help context ID */
WORD
flags
;
/* Misc. flags (see below) */
WORD
flags
;
/* Misc. flags (see below) */
HMENU16
hSysMenu
;
/* window's copy of System Menu */
HMENU16
hSysMenu
;
/* window's copy of System Menu */
int
irefCount
;
/* window's reference count*/
DWORD
userdata
;
/* User private data */
DWORD
userdata
;
/* User private data */
struct
_WND_DRIVER
*
pDriver
;
/* Window driver */
struct
_WND_DRIVER
*
pDriver
;
/* Window driver */
void
*
pDriverData
;
/* Window driver data */
void
*
pDriverData
;
/* Window driver data */
...
@@ -133,7 +134,12 @@ typedef struct
...
@@ -133,7 +134,12 @@ typedef struct
#define BWA_SKIPICONIC 0x0008
#define BWA_SKIPICONIC 0x0008
/* Window functions */
/* Window functions */
extern
void
WIN_LockWnds
();
extern
void
WIN_UnlockWnds
();
extern
int
WIN_SuspendWndsLock
();
extern
void
WIN_RestoreWndsLock
(
int
ipreviousLock
);
extern
WND
*
WIN_FindWndPtr
(
HWND32
hwnd
);
extern
WND
*
WIN_FindWndPtr
(
HWND32
hwnd
);
extern
void
WIN_ReleaseWndPtr
(
WND
*
wndPtr
);
extern
WND
*
WIN_GetDesktop
(
void
);
extern
WND
*
WIN_GetDesktop
(
void
);
extern
void
WIN_DumpWindow
(
HWND32
hwnd
);
extern
void
WIN_DumpWindow
(
HWND32
hwnd
);
extern
void
WIN_WalkWindows
(
HWND32
hwnd
,
int
indent
);
extern
void
WIN_WalkWindows
(
HWND32
hwnd
,
int
indent
);
...
...
windows/win.c
View file @
93e3f905
...
@@ -52,6 +52,68 @@ static HWND32 hwndSysModal = 0;
...
@@ -52,6 +52,68 @@ static HWND32 hwndSysModal = 0;
static
WORD
wDragWidth
=
4
;
static
WORD
wDragWidth
=
4
;
static
WORD
wDragHeight
=
3
;
static
WORD
wDragHeight
=
3
;
/* thread safeness */
static
CRITICAL_SECTION
WIN_CritSection
;
static
int
ilockCounter
=
0
;
/***********************************************************************
* WIN_LockWnds
*
* Locks access to all WND structures for thread safeness
*/
void
WIN_LockWnds
()
{
EnterCriticalSection
(
&
WIN_CritSection
);
ilockCounter
++
;
TRACE
(
win
,
"All windows hinstances have been locked (lock #%i)
\n
"
,
ilockCounter
);
}
/***********************************************************************
* WIN_UnlockWnds
*
* Unlocks access to all WND structures
*/
void
WIN_UnlockWnds
()
{
TRACE
(
win
,
"Lock #%i been unlocked
\n
"
,
ilockCounter
+
1
);
ilockCounter
--
;
if
(
ilockCounter
==
0
)
{
LeaveCriticalSection
(
&
WIN_CritSection
);
TRACE
(
win
,
"All windows hinstances have been unlocked
\n
"
);
}
else
if
(
ilockCounter
<
0
)
{
ERR
(
win
,
"Negative lock reference ==> missing call to WIN_Lock!
\n
"
);
}
}
/***********************************************************************
* WIN_SuspendWndsLock
*
* Suspend the lock on WND structures.
* Returns the number of locks suspended
*/
int
WIN_SuspendWndsLock
()
{
int
isuspendedLocks
=
ilockCounter
;
ilockCounter
=
0
;
LeaveCriticalSection
(
&
WIN_CritSection
);
TRACE
(
win
,
"All windows hinstances locks have been suspended
\n
"
);
return
isuspendedLocks
;
}
/***********************************************************************
* WIN_RestoreWndsLock
*
* Restore the suspended locks on WND structures
*/
void
WIN_Unlock
(
int
ipreviousLocks
)
{
EnterCriticalSection
(
&
WIN_CritSection
);
ilockCounter
=
ipreviousLocks
;
}
/***********************************************************************
/***********************************************************************
* WIN_FindWndPtr
* WIN_FindWndPtr
*
*
...
@@ -61,8 +123,13 @@ WND * WIN_FindWndPtr( HWND32 hwnd )
...
@@ -61,8 +123,13 @@ WND * WIN_FindWndPtr( HWND32 hwnd )
{
{
WND
*
ptr
;
WND
*
ptr
;
if
(
!
hwnd
||
HIWORD
(
hwnd
))
goto
error
;
if
(
!
hwnd
||
HIWORD
(
hwnd
))
goto
error
2
;
ptr
=
(
WND
*
)
USER_HEAP_LIN_ADDR
(
hwnd
);
ptr
=
(
WND
*
)
USER_HEAP_LIN_ADDR
(
hwnd
);
/* Lock all WND structures for thread safeness
WIN_LockWnds();
and increment destruction monitoring value
ptr->irefCount++;
*/
if
(
ptr
->
dwMagic
!=
WND_MAGIC
)
goto
error
;
if
(
ptr
->
dwMagic
!=
WND_MAGIC
)
goto
error
;
if
(
ptr
->
hwndSelf
!=
hwnd
)
if
(
ptr
->
hwndSelf
!=
hwnd
)
{
{
...
@@ -72,10 +139,37 @@ WND * WIN_FindWndPtr( HWND32 hwnd )
...
@@ -72,10 +139,37 @@ WND * WIN_FindWndPtr( HWND32 hwnd )
}
}
return
ptr
;
return
ptr
;
error:
error:
/* Unlock all WND structures for thread safeness
WIN_UnlockWnds();
and decrement destruction monitoring value
ptr->irefCount--;
*/
error2:
SetLastError
(
ERROR_INVALID_WINDOW_HANDLE
);
SetLastError
(
ERROR_INVALID_WINDOW_HANDLE
);
return
NULL
;
return
NULL
;
}
}
/***********************************************************************
* WIN_ReleaseWndPtr
*
* Release the pointer to the WND structure.
*/
void
WIN_ReleaseWndPtr
(
WND
*
wndPtr
)
{
/*Decrement destruction monitoring value
wndPtr->irefCount--;
Check if it's time to release the memory
if(wndPtr->irefCount == 0)
{
Add memory releasing code here
}
unlock all WND structures for thread safeness
WIN_UnlockWnds();
*/
}
/***********************************************************************
/***********************************************************************
* WIN_DumpWindow
* WIN_DumpWindow
...
...
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