4 * Copyright 1995 Martin von Loewis
7 /* This file contains only wrappers to existing Wine functions or trivial
8 stubs. 'Real' implementations go into context specific files */
15 #include "stackframe.h"
17 /* Structure copy functions */
18 static void MSG16to32(MSG
*msg16
,struct WIN32_MSG
*msg32
)
20 msg32
->hwnd
=(DWORD
)msg16
->hwnd
;
21 msg32
->message
=msg16
->message
;
22 msg32
->wParam
=msg16
->wParam
;
23 msg32
->lParam
=msg16
->lParam
;
24 msg32
->time
=msg16
->time
;
25 msg32
->pt
.x
=msg16
->pt
.x
;
26 msg32
->pt
.y
=msg16
->pt
.y
;
29 static void MSG32to16(struct WIN32_MSG
*msg32
,MSG
*msg16
)
31 msg16
->hwnd
=(HWND
)msg32
->hwnd
;
32 msg16
->message
=msg32
->message
;
33 msg16
->wParam
=msg32
->wParam
;
34 msg16
->lParam
=msg32
->lParam
;
35 msg16
->time
=msg32
->time
;
36 msg16
->pt
.x
=msg32
->pt
.x
;
37 msg16
->pt
.y
=msg32
->pt
.y
;
40 /***********************************************************************
41 * RegisterClassA (USER32.426)
43 ATOM
USER32_RegisterClassA(WNDCLASSA
* wndclass
)
47 copy
.style
=wndclass
->style
;
48 ALIAS_RegisterAlias(0,0,(DWORD
)wndclass
->lpfnWndProc
);
49 copy
.lpfnWndProc
=wndclass
->lpfnWndProc
;
50 copy
.cbClsExtra
=wndclass
->cbClsExtra
;
51 copy
.cbWndExtra
=wndclass
->cbWndExtra
;
52 copy
.hInstance
=(HINSTANCE
)wndclass
->hInstance
;
53 copy
.hIcon
=(HICON
)wndclass
->hIcon
;
54 copy
.hCursor
=(HCURSOR
)wndclass
->hCursor
;
55 copy
.hbrBackground
=(HBRUSH
)wndclass
->hbrBackground
;
56 if(wndclass
->lpszMenuName
)
58 s1
=alloca(strlen(wndclass
->lpszMenuName
)+1);
59 strcpy(s1
,wndclass
->lpszMenuName
);
60 copy
.lpszMenuName
=MAKE_SEGPTR(s1
);
63 if(wndclass
->lpszClassName
)
65 s2
=alloca(strlen(wndclass
->lpszClassName
)+1);
66 strcpy(s2
,wndclass
->lpszClassName
);
67 copy
.lpszClassName
=MAKE_SEGPTR(s2
);
69 return RegisterClass(©
);
72 /***********************************************************************
73 * DefWindowProcA (USER32.125)
75 LRESULT
USER32_DefWindowProcA(DWORD hwnd
,DWORD msg
,DWORD wParam
,DWORD lParam
)
77 /* some messages certainly need special casing. We come to that later */
78 return DefWindowProc((HWND
)hwnd
,msg
,wParam
,lParam
);
81 /***********************************************************************
82 * GetMessageA (USER32.269)
84 BOOL
USER32_GetMessageA(struct WIN32_MSG
* lpmsg
,DWORD hwnd
,DWORD min
,DWORD max
)
88 ret
=GetMessage(MAKE_SEGPTR(&msg
),(HWND
)hwnd
,min
,max
);
89 MSG16to32(&msg
,lpmsg
);
93 /***********************************************************************
94 * BeginPaint (USER32.9)
96 HDC
USER32_BeginPaint(DWORD hwnd
,struct WIN32_PAINTSTRUCT
*lpps
)
100 ret
=BeginPaint((HWND
)hwnd
,&ps
);
101 lpps
->hdc
=(DWORD
)ps
.hdc
;
102 lpps
->fErase
=ps
.fErase
;
103 lpps
->rcPaint
.top
=ps
.rcPaint
.top
;
104 lpps
->rcPaint
.left
=ps
.rcPaint
.left
;
105 lpps
->rcPaint
.right
=ps
.rcPaint
.right
;
106 lpps
->rcPaint
.bottom
=ps
.rcPaint
.bottom
;
107 lpps
->fRestore
=ps
.fRestore
;
108 lpps
->fIncUpdate
=ps
.fIncUpdate
;
112 /***********************************************************************
113 * EndPaint (USER32.175)
115 BOOL
USER32_EndPaint(DWORD hwnd
,struct WIN32_PAINTSTRUCT
*lpps
)
118 ps
.hdc
=(HDC
)lpps
->hdc
;
119 ps
.fErase
=lpps
->fErase
;
120 ps
.rcPaint
.top
=lpps
->rcPaint
.top
;
121 ps
.rcPaint
.left
=lpps
->rcPaint
.left
;
122 ps
.rcPaint
.right
=lpps
->rcPaint
.right
;
123 ps
.rcPaint
.bottom
=lpps
->rcPaint
.bottom
;
124 ps
.fRestore
=lpps
->fRestore
;
125 ps
.fIncUpdate
=lpps
->fIncUpdate
;
126 EndPaint((HWND
)hwnd
,&ps
);
130 /***********************************************************************
131 * DispatchMessageA (USER32.140)
133 LONG
USER32_DispatchMessageA(struct WIN32_MSG
* lpmsg
)
137 MSG32to16(lpmsg
,&msg
);
138 ret
=DispatchMessage(&msg
);
139 MSG16to32(&msg
,lpmsg
);
143 /***********************************************************************
144 * CreateWindowExA (USER32.82)
146 DWORD
USER32_CreateWindowExA(long flags
,char* class,char *title
,
147 long style
,int x
,int y
,int width
,int height
,DWORD parent
,DWORD menu
,
148 DWORD instance
,DWORD param
)
150 char *classbuf
, *titlebuf
;
151 /*Have to translate CW_USEDEFAULT */
152 if(x
==0x80000000)x
=CW_USEDEFAULT
;
153 if(width
==0x80000000)width
=CW_USEDEFAULT
;
154 classbuf
= alloca( strlen(class)+1 );
155 strcpy( classbuf
, class );
156 titlebuf
= alloca( strlen(title
)+1 );
157 strcpy( titlebuf
, title
);
158 return (DWORD
) CreateWindowEx(flags
,MAKE_SEGPTR(classbuf
),
159 MAKE_SEGPTR(titlebuf
),style
,x
,y
,width
,height
,
160 (HWND
)parent
,(HMENU
)menu
,(HINSTANCE
)instance
,