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
ca30176c
Commit
ca30176c
authored
May 18, 2005
by
Dimi Paun
Committed by
Alexandre Julliard
May 18, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the LOCAL_*() functions from GDI.
parent
0a308f2d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
34 deletions
+84
-34
gdiobj.c
dlls/gdi/gdiobj.c
+84
-34
No files found.
dlls/gdi/gdiobj.c
View file @
ca30176c
...
...
@@ -30,8 +30,8 @@
#include "wingdi.h"
#include "winreg.h"
#include "winerror.h"
#include "winternl.h"
#include "local.h"
#include "gdi.h"
#include "gdi_private.h"
#include "wine/debug.h"
...
...
@@ -709,7 +709,7 @@ inline static GDIOBJHDR *alloc_large_heap( WORD size, HGDIOBJ *handle )
*/
void
*
GDI_AllocObject
(
WORD
size
,
WORD
magic
,
HGDIOBJ
*
handle
,
const
struct
gdi_obj_funcs
*
funcs
)
{
GDIOBJHDR
*
obj
;
GDIOBJHDR
*
obj
=
NULL
;
HLOCAL16
hlocal
;
_EnterSysLevel
(
&
GDI_level
);
...
...
@@ -719,10 +719,18 @@ void *GDI_AllocObject( WORD size, WORD magic, HGDIOBJ *handle, const struct gdi_
case
BRUSH_MAGIC
:
if
(
GDI_HeapSel
)
{
if
(
!
(
hlocal
=
LOCAL_Alloc
(
GDI_HeapSel
,
LMEM_MOVEABLE
,
size
)))
goto
error
;
assert
(
hlocal
&
2
);
obj
=
(
GDIOBJHDR
*
)
LOCAL_Lock
(
GDI_HeapSel
,
hlocal
);
*
handle
=
(
HGDIOBJ
)(
ULONG_PTR
)
hlocal
;
STACK16FRAME
*
stack16
=
MapSL
((
SEGPTR
)
NtCurrentTeb
()
->
WOW32Reserved
);
HANDLE16
oldDS
=
stack16
->
ds
;
stack16
->
ds
=
GDI_HeapSel
;
if
((
hlocal
=
LocalAlloc16
(
LMEM_MOVEABLE
,
size
)))
{
assert
(
hlocal
&
2
);
obj
=
MapSL
(
LocalLock16
(
hlocal
));
*
handle
=
(
HGDIOBJ
)(
ULONG_PTR
)
hlocal
;
}
stack16
->
ds
=
oldDS
;
if
(
!
hlocal
)
goto
error
;
break
;
}
/* fall through */
...
...
@@ -755,34 +763,39 @@ error:
void
*
GDI_ReallocObject
(
WORD
size
,
HGDIOBJ
handle
,
void
*
object
)
{
HGDIOBJ
new_handle
;
void
*
new_ptr
=
NULL
;
if
((
UINT_PTR
)
handle
&
2
)
/* GDI heap handle */
{
STACK16FRAME
*
stack16
=
MapSL
((
SEGPTR
)
NtCurrentTeb
()
->
WOW32Reserved
);
HANDLE16
oldDS
=
stack16
->
ds
;
HLOCAL16
h
=
LOWORD
(
handle
);
LOCAL_Unlock
(
GDI_HeapSel
,
h
);
if
((
new_handle
=
(
HGDIOBJ
)(
ULONG_PTR
)
LOCAL_ReAlloc
(
GDI_HeapSel
,
h
,
size
,
LMEM_MOVEABLE
)))
stack16
->
ds
=
GDI_HeapSel
;
LocalUnlock16
(
h
);
if
((
new_handle
=
(
HGDIOBJ
)(
ULONG_PTR
)
LocalReAlloc16
(
h
,
size
,
LMEM_MOVEABLE
)))
{
assert
(
new_handle
==
handle
);
/* moveable handle cannot change */
return
LOCAL_Lock
(
GDI_HeapSel
,
h
);
new_ptr
=
MapSL
(
LocalLock16
(
h
)
);
}
stack16
->
ds
=
oldDS
;
}
else
{
int
i
=
((
ULONG_PTR
)
handle
>>
2
)
-
FIRST_LARGE_HANDLE
;
if
(
i
>=
0
&&
i
<
MAX_LARGE_HANDLES
&&
large_handles
[
i
])
{
void
*
new_ptr
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
large_handles
[
i
],
size
);
if
(
new_ptr
)
{
large_handles
[
i
]
=
new_ptr
;
return
new_ptr
;
}
new_ptr
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
large_handles
[
i
],
size
);
if
(
new_ptr
)
large_handles
[
i
]
=
new_ptr
;
}
else
ERR
(
"Invalid handle %p
\n
"
,
handle
);
}
TRACE
(
"(%p): leave %ld
\n
"
,
handle
,
GDI_level
.
crst
.
RecursionCount
);
_LeaveSysLevel
(
&
GDI_level
);
return
NULL
;
if
(
!
new_ptr
)
{
TRACE
(
"(%p): leave %ld
\n
"
,
handle
,
GDI_level
.
crst
.
RecursionCount
);
_LeaveSysLevel
(
&
GDI_level
);
}
return
new_ptr
;
}
...
...
@@ -797,9 +810,14 @@ BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr )
object
->
funcs
=
NULL
;
if
((
UINT_PTR
)
handle
&
2
)
/* GDI heap handle */
{
STACK16FRAME
*
stack16
=
MapSL
((
SEGPTR
)
NtCurrentTeb
()
->
WOW32Reserved
);
HANDLE16
oldDS
=
stack16
->
ds
;
HLOCAL16
h
=
LOWORD
(
handle
);
LOCAL_Unlock
(
GDI_HeapSel
,
h
);
LOCAL_Free
(
GDI_HeapSel
,
h
);
stack16
->
ds
=
GDI_HeapSel
;
LocalUnlock16
(
h
);
LocalFree16
(
h
);
stack16
->
ds
=
oldDS
;
}
else
/* large heap handle */
{
...
...
@@ -832,18 +850,23 @@ void *GDI_GetObjPtr( HGDIOBJ handle, WORD magic )
if
((
UINT_PTR
)
handle
&
2
)
/* GDI heap handle */
{
STACK16FRAME
*
stack16
=
MapSL
((
SEGPTR
)
NtCurrentTeb
()
->
WOW32Reserved
);
HANDLE16
oldDS
=
stack16
->
ds
;
HLOCAL16
h
=
LOWORD
(
handle
);
ptr
=
(
GDIOBJHDR
*
)
LOCAL_Lock
(
GDI_HeapSel
,
h
);
stack16
->
ds
=
GDI_HeapSel
;
ptr
=
MapSL
(
LocalLock16
(
h
));
if
(
ptr
)
{
if
(((
magic
!=
MAGIC_DONTCARE
)
&&
(
GDIMAGIC
(
ptr
->
wMagic
)
!=
magic
))
||
(
GDIMAGIC
(
ptr
->
wMagic
)
<
FIRST_MAGIC
)
||
(
GDIMAGIC
(
ptr
->
wMagic
)
>
LAST_MAGIC
))
{
L
OCAL_Unlock
(
GDI_HeapSel
,
h
);
L
ocalUnlock16
(
h
);
ptr
=
NULL
;
}
}
stack16
->
ds
=
oldDS
;
}
else
/* large heap handle */
{
...
...
@@ -872,7 +895,15 @@ void *GDI_GetObjPtr( HGDIOBJ handle, WORD magic )
*/
void
GDI_ReleaseObj
(
HGDIOBJ
handle
)
{
if
((
UINT_PTR
)
handle
&
2
)
LOCAL_Unlock
(
GDI_HeapSel
,
LOWORD
(
handle
)
);
if
((
UINT_PTR
)
handle
&
2
)
{
STACK16FRAME
*
stack16
=
MapSL
((
SEGPTR
)
NtCurrentTeb
()
->
WOW32Reserved
);
HANDLE16
oldDS
=
stack16
->
ds
;
stack16
->
ds
=
GDI_HeapSel
;
LocalUnlock16
(
LOWORD
(
handle
)
);
stack16
->
ds
=
oldDS
;
}
TRACE
(
"(%p): leave %ld
\n
"
,
handle
,
GDI_level
.
crst
.
RecursionCount
);
_LeaveSysLevel
(
&
GDI_level
);
}
...
...
@@ -1448,20 +1479,31 @@ DWORD WINAPI GdiSetBatchLimit( DWORD limit )
DWORD
WINAPI
GdiSeeGdiDo16
(
WORD
wReqType
,
WORD
wParam1
,
WORD
wParam2
,
WORD
wParam3
)
{
STACK16FRAME
*
stack16
=
MapSL
((
SEGPTR
)
NtCurrentTeb
()
->
WOW32Reserved
);
HANDLE16
oldDS
=
stack16
->
ds
;
DWORD
ret
=
~
0UL
;
stack16
->
ds
=
GDI_HeapSel
;
switch
(
wReqType
)
{
case
0x0001
:
/* LocalAlloc */
return
LOCAL_Alloc
(
GDI_HeapSel
,
wParam1
,
wParam3
);
ret
=
LocalAlloc16
(
wParam1
,
wParam3
);
break
;
case
0x0002
:
/* LocalFree */
return
LOCAL_Free
(
GDI_HeapSel
,
wParam1
);
ret
=
LocalFree16
(
wParam1
);
break
;
case
0x0003
:
/* LocalCompact */
return
LOCAL_Compact
(
GDI_HeapSel
,
wParam3
);
ret
=
LocalCompact16
(
wParam3
);
break
;
case
0x0103
:
/* LocalHeap */
return
GDI_HeapSel
;
ret
=
GDI_HeapSel
;
break
;
default:
WARN
(
"(wReqType=%04x): Unknown
\n
"
,
wReqType
);
return
~
0UL
;
break
;
}
stack16
->
ds
=
oldDS
;
return
ret
;
}
/***********************************************************************
...
...
@@ -1477,11 +1519,12 @@ WORD WINAPI GdiSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
* GdiInit2 (GDI.403)
*
* See "Undocumented Windows"
*
* PARAMS
* h1 [I] GDI object
* h2 [I] global data
*/
HANDLE16
WINAPI
GdiInit216
(
HANDLE16
h1
,
/* [in] GDI object */
HANDLE16
h2
/* [in] global data */
)
HANDLE16
WINAPI
GdiInit216
(
HANDLE16
h1
,
HANDLE16
h2
)
{
FIXME
(
"(%04x, %04x), stub.
\n
"
,
h1
,
h2
);
if
(
h2
==
0xffff
)
...
...
@@ -1501,8 +1544,15 @@ void WINAPI FinalGdiInit16( HBRUSH16 hPattern /* [in] fill pattern of desktop */
*/
WORD
WINAPI
GdiFreeResources16
(
DWORD
reserve
)
{
return
(
WORD
)(
(
int
)
LOCAL_CountFree
(
GDI_HeapSel
)
*
100
/
(
int
)
LOCAL_HeapSize
(
GDI_HeapSel
)
);
STACK16FRAME
*
stack16
=
MapSL
((
SEGPTR
)
NtCurrentTeb
()
->
WOW32Reserved
);
HANDLE16
oldDS
=
stack16
->
ds
;
WORD
ret
;
stack16
->
ds
=
GDI_HeapSel
;
ret
=
(
WORD
)(
(
int
)
LocalCountFree16
()
*
100
/
(
int
)
LocalHeapSize16
()
);
stack16
->
ds
=
oldDS
;
return
ret
;
}
...
...
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