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
15000f32
Commit
15000f32
authored
Dec 17, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Move the 16-bit menu functions to user16.c.
parent
8494682f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
89 deletions
+114
-89
menu.c
dlls/user32/menu.c
+10
-80
user16.c
dlls/user32/user16.c
+104
-0
win.c
dlls/user32/win.c
+0
-9
No files found.
dlls/user32/menu.c
View file @
15000f32
...
...
@@ -51,9 +51,6 @@
#include "winbase.h"
#include "wingdi.h"
#include "winnls.h"
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "wownt32.h"
#include "wine/server.h"
#include "wine/unicode.h"
#include "wine/exception.h"
...
...
@@ -2132,10 +2129,10 @@ static MENUITEM *MENU_InsertItem( HMENU hMenu, UINT pos, UINT flags )
*
* NOTE: flags is equivalent to the mtOption field
*/
static
LPCSTR
MENU_ParseResource
(
LPCSTR
res
,
HMENU
hMenu
,
BOOL
unicode
)
static
LPCSTR
MENU_ParseResource
(
LPCSTR
res
,
HMENU
hMenu
)
{
WORD
flags
,
id
=
0
;
LPCSTR
str
;
LPC
W
STR
str
;
BOOL
end_flag
;
do
...
...
@@ -2150,23 +2147,18 @@ static LPCSTR MENU_ParseResource( LPCSTR res, HMENU hMenu, BOOL unicode )
id
=
GET_WORD
(
res
);
res
+=
sizeof
(
WORD
);
}
str
=
res
;
if
(
!
unicode
)
res
+=
strlen
(
str
)
+
1
;
else
res
+=
(
strlenW
((
LPCWSTR
)
str
)
+
1
)
*
sizeof
(
WCHAR
);
str
=
(
LPCWSTR
)
res
;
res
+=
(
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
flags
&
MF_POPUP
)
{
HMENU
hSubMenu
=
CreatePopupMenu
();
if
(
!
hSubMenu
)
return
NULL
;
if
(
!
(
res
=
MENU_ParseResource
(
res
,
hSubMenu
,
unicode
)))
return
NULL
;
if
(
!
unicode
)
AppendMenuA
(
hMenu
,
flags
,
(
UINT_PTR
)
hSubMenu
,
str
);
else
AppendMenuW
(
hMenu
,
flags
,
(
UINT_PTR
)
hSubMenu
,
(
LPCWSTR
)
str
);
if
(
!
(
res
=
MENU_ParseResource
(
res
,
hSubMenu
)))
return
NULL
;
AppendMenuW
(
hMenu
,
flags
,
(
UINT_PTR
)
hSubMenu
,
str
);
}
else
/* Not a popup */
{
if
(
!
unicode
)
AppendMenuA
(
hMenu
,
flags
,
id
,
*
str
?
str
:
NULL
);
else
AppendMenuW
(
hMenu
,
flags
,
id
,
*
(
LPCWSTR
)
str
?
(
LPCWSTR
)
str
:
NULL
);
AppendMenuW
(
hMenu
,
flags
,
id
,
*
str
?
str
:
NULL
);
}
}
while
(
!
end_flag
);
return
res
;
...
...
@@ -3791,7 +3783,7 @@ static void MENU_mnu2mnuii( UINT flags, UINT_PTR id, LPCWSTR str,
pmii
->
dwTypeData
=
(
LPWSTR
)
str
;
}
else
if
(
flags
&
MFT_BITMAP
){
pmii
->
fMask
|=
MIIM_BITMAP
|
MIIM_STRING
;
pmii
->
hbmpItem
=
HBITMAP_32
(
LOWORD
(
str
));
pmii
->
hbmpItem
=
ULongToHandle
(
LOWORD
(
str
));
}
if
(
flags
&
MF_OWNERDRAW
){
pmii
->
fMask
|=
MIIM_DATA
;
...
...
@@ -4326,39 +4318,6 @@ BOOL WINAPI EndMenu(void)
}
/***********************************************************************
* LookupMenuHandle (USER.217)
*/
HMENU16
WINAPI
LookupMenuHandle16
(
HMENU16
hmenu
,
INT16
id
)
{
HMENU
hmenu32
=
HMENU_32
(
hmenu
);
UINT
id32
=
id
;
if
(
!
MENU_FindItem
(
&
hmenu32
,
&
id32
,
MF_BYCOMMAND
))
return
0
;
else
return
HMENU_16
(
hmenu32
);
}
/**********************************************************************
* LoadMenu (USER.150)
*/
HMENU16
WINAPI
LoadMenu16
(
HINSTANCE16
instance
,
LPCSTR
name
)
{
HRSRC16
hRsrc
;
HGLOBAL16
handle
;
HMENU16
hMenu
;
if
(
HIWORD
(
name
)
&&
name
[
0
]
==
'#'
)
name
=
ULongToPtr
(
atoi
(
name
+
1
));
if
(
!
name
)
return
0
;
instance
=
GetExePtr
(
instance
);
if
(
!
(
hRsrc
=
FindResource16
(
instance
,
name
,
(
LPSTR
)
RT_MENU
)))
return
0
;
if
(
!
(
handle
=
LoadResource16
(
instance
,
hRsrc
)))
return
0
;
hMenu
=
LoadMenuIndirect16
(
LockResource16
(
handle
));
FreeResource16
(
handle
);
return
hMenu
;
}
/*****************************************************************
* LoadMenuA (USER32.@)
*/
...
...
@@ -4382,35 +4341,6 @@ HMENU WINAPI LoadMenuW( HINSTANCE instance, LPCWSTR name )
/**********************************************************************
* LoadMenuIndirect (USER.220)
*/
HMENU16
WINAPI
LoadMenuIndirect16
(
LPCVOID
template
)
{
HMENU
hMenu
;
WORD
version
,
offset
;
LPCSTR
p
=
template
;
TRACE
(
"(%p)
\n
"
,
template
);
version
=
GET_WORD
(
p
);
p
+=
sizeof
(
WORD
);
if
(
version
)
{
WARN
(
"version must be 0 for Win16
\n
"
);
return
0
;
}
offset
=
GET_WORD
(
p
);
p
+=
sizeof
(
WORD
)
+
offset
;
if
(
!
(
hMenu
=
CreateMenu
()))
return
0
;
if
(
!
MENU_ParseResource
(
p
,
hMenu
,
FALSE
))
{
DestroyMenu
(
hMenu
);
return
0
;
}
return
HMENU_16
(
hMenu
);
}
/**********************************************************************
* LoadMenuIndirectW (USER32.@)
*/
HMENU
WINAPI
LoadMenuIndirectW
(
LPCVOID
template
)
...
...
@@ -4428,7 +4358,7 @@ HMENU WINAPI LoadMenuIndirectW( LPCVOID template )
offset
=
GET_WORD
(
p
);
p
+=
sizeof
(
WORD
)
+
offset
;
if
(
!
(
hMenu
=
CreateMenu
()))
return
0
;
if
(
!
MENU_ParseResource
(
p
,
hMenu
,
TRUE
))
if
(
!
MENU_ParseResource
(
p
,
hMenu
))
{
DestroyMenu
(
hMenu
);
return
0
;
...
...
@@ -4784,7 +4714,7 @@ static BOOL MENU_NormalizeMenuItemInfoStruct( const MENUITEMINFOW *pmii_in,
pmii_out
->
fMask
|=
MIIM_STRING
;
}
else
if
(
(
pmii_out
->
fType
)
&
MFT_BITMAP
){
pmii_out
->
fMask
|=
MIIM_BITMAP
;
pmii_out
->
hbmpItem
=
HBITMAP_32
(
LOWORD
(
pmii_out
->
dwTypeData
));
pmii_out
->
hbmpItem
=
UlongToHandle
(
LOWORD
(
pmii_out
->
dwTypeData
));
}
}
return
TRUE
;
...
...
dlls/user32/user16.c
View file @
15000f32
...
...
@@ -190,6 +190,15 @@ BOOL16 WINAPI GetCursorPos16( POINT16 *pt )
}
/*******************************************************************
* AnyPopup (USER.52)
*/
BOOL16
WINAPI
AnyPopup16
(
void
)
{
return
AnyPopup
();
}
/***********************************************************************
* SetCursor (USER.69)
*/
...
...
@@ -511,6 +520,27 @@ INT16 WINAPI GetClipboardFormatName16( UINT16 id, LPSTR buffer, INT16 maxlen )
/**********************************************************************
* LoadMenu (USER.150)
*/
HMENU16
WINAPI
LoadMenu16
(
HINSTANCE16
instance
,
LPCSTR
name
)
{
HRSRC16
hRsrc
;
HGLOBAL16
handle
;
HMENU16
hMenu
;
if
(
HIWORD
(
name
)
&&
name
[
0
]
==
'#'
)
name
=
ULongToPtr
(
atoi
(
name
+
1
));
if
(
!
name
)
return
0
;
instance
=
GetExePtr
(
instance
);
if
(
!
(
hRsrc
=
FindResource16
(
instance
,
name
,
(
LPSTR
)
RT_MENU
)))
return
0
;
if
(
!
(
handle
=
LoadResource16
(
instance
,
hRsrc
)))
return
0
;
hMenu
=
LoadMenuIndirect16
(
LockResource16
(
handle
));
FreeResource16
(
handle
);
return
hMenu
;
}
/**********************************************************************
* CreateMenu (USER.151)
*/
HMENU16
WINAPI
CreateMenu16
(
void
)
...
...
@@ -869,6 +899,80 @@ DWORD WINAPI UserSeeUserDo16(WORD wReqType, WORD wParam1, WORD wParam2, WORD wPa
}
/***********************************************************************
* LookupMenuHandle (USER.217)
*/
HMENU16
WINAPI
LookupMenuHandle16
(
HMENU16
hmenu
,
INT16
id
)
{
FIXME
(
"%04x %04x: stub
\n
"
,
hmenu
,
id
);
return
hmenu
;
}
static
LPCSTR
parse_menu_resource
(
LPCSTR
res
,
HMENU
hMenu
)
{
WORD
flags
,
id
=
0
;
LPCSTR
str
;
BOOL
end_flag
;
do
{
flags
=
GET_WORD
(
res
);
end_flag
=
flags
&
MF_END
;
/* Remove MF_END because it has the same value as MF_HILITE */
flags
&=
~
MF_END
;
res
+=
sizeof
(
WORD
);
if
(
!
(
flags
&
MF_POPUP
))
{
id
=
GET_WORD
(
res
);
res
+=
sizeof
(
WORD
);
}
str
=
res
;
res
+=
strlen
(
str
)
+
1
;
if
(
flags
&
MF_POPUP
)
{
HMENU
hSubMenu
=
CreatePopupMenu
();
if
(
!
hSubMenu
)
return
NULL
;
if
(
!
(
res
=
parse_menu_resource
(
res
,
hSubMenu
)))
return
NULL
;
AppendMenuA
(
hMenu
,
flags
,
(
UINT_PTR
)
hSubMenu
,
str
);
}
else
/* Not a popup */
{
AppendMenuA
(
hMenu
,
flags
,
id
,
*
str
?
str
:
NULL
);
}
}
while
(
!
end_flag
);
return
res
;
}
/**********************************************************************
* LoadMenuIndirect (USER.220)
*/
HMENU16
WINAPI
LoadMenuIndirect16
(
LPCVOID
template
)
{
HMENU
hMenu
;
WORD
version
,
offset
;
LPCSTR
p
=
template
;
TRACE
(
"(%p)
\n
"
,
template
);
version
=
GET_WORD
(
p
);
p
+=
sizeof
(
WORD
);
if
(
version
)
{
WARN
(
"version must be 0 for Win16
\n
"
);
return
0
;
}
offset
=
GET_WORD
(
p
);
p
+=
sizeof
(
WORD
)
+
offset
;
if
(
!
(
hMenu
=
CreateMenu
()))
return
0
;
if
(
!
parse_menu_resource
(
p
,
hMenu
))
{
DestroyMenu
(
hMenu
);
return
0
;
}
return
HMENU_16
(
hMenu
);
}
/*************************************************************************
* ScrollDC (USER.221)
*/
...
...
dlls/user32/win.c
View file @
15000f32
...
...
@@ -3082,15 +3082,6 @@ BOOL WINAPI EnumChildWindows( HWND parent, WNDENUMPROC func, LPARAM lParam )
/*******************************************************************
* AnyPopup (USER.52)
*/
BOOL16
WINAPI
AnyPopup16
(
void
)
{
return
AnyPopup
();
}
/*******************************************************************
* AnyPopup (USER32.@)
*/
BOOL
WINAPI
AnyPopup
(
void
)
...
...
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