wintrust: Simplify error handling in SoftpubLoadSignature.
[wine] / dlls / user.exe16 / user_private.h
1 /*
2  * USER private definitions
3  *
4  * Copyright 1993, 2009 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #ifndef __WINE_USER_PRIVATE_H
22 #define __WINE_USER_PRIVATE_H
23
24 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winuser.h"
29 #include "winreg.h"
30 #include "winternl.h"
31 #include "wine/windef16.h"
32
33 /* Wow handlers */
34
35 /* the structures must match the corresponding ones in user32 */
36 struct wow_handlers16
37 {
38     LRESULT (*button_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
39     LRESULT (*combo_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
40     LRESULT (*edit_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
41     LRESULT (*listbox_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
42     LRESULT (*mdiclient_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
43     LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
44     LRESULT (*static_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
45     DWORD   (*wait_message)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
46     HWND    (*create_window)(CREATESTRUCTW*,LPCWSTR,HINSTANCE,BOOL);
47     LRESULT (*call_window_proc)(HWND,UINT,WPARAM,LPARAM,LRESULT*,void*);
48     LRESULT (*call_dialog_proc)(HWND,UINT,WPARAM,LPARAM,LRESULT*,void*);
49     HICON   (*alloc_icon_handle)(UINT);
50     struct tagCURSORICONINFO *(*get_icon_ptr)(HICON);
51     void    (*release_icon_ptr)(HICON,struct tagCURSORICONINFO*);
52     int     (*free_icon_handle)(HICON);
53 };
54
55 struct wow_handlers32
56 {
57     LRESULT (*button_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
58     LRESULT (*combo_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
59     LRESULT (*edit_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
60     LRESULT (*listbox_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
61     LRESULT (*mdiclient_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
62     LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
63     LRESULT (*static_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
64     DWORD   (*wait_message)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
65     HWND    (*create_window)(CREATESTRUCTW*,LPCWSTR,HINSTANCE,BOOL);
66     HWND    (*get_win_handle)(HWND);
67     WNDPROC (*alloc_winproc)(WNDPROC,BOOL);
68     struct tagDIALOGINFO *(*get_dialog_info)(HWND,BOOL);
69     INT     (*dialog_box_loop)(HWND,HWND);
70 };
71
72 extern struct wow_handlers32 wow_handlers32 DECLSPEC_HIDDEN;
73
74 extern HWND create_window16(CREATESTRUCTW*,LPCWSTR,HINSTANCE,BOOL) DECLSPEC_HIDDEN;
75 extern void free_module_classes(HINSTANCE16) DECLSPEC_HIDDEN;
76 extern void register_wow_handlers(void) DECLSPEC_HIDDEN;
77 extern void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new,
78                                             struct wow_handlers32 *orig );
79
80 static inline HWND WIN_Handle32( HWND16 hwnd16 )
81 {
82     return wow_handlers32.get_win_handle( (HWND)(ULONG_PTR)hwnd16 );
83 }
84
85 typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
86                                        LRESULT *result, void *arg );
87 typedef LRESULT (*winproc_callback16_t)( HWND16 hwnd, UINT16 msg, WPARAM16 wp, LPARAM lp,
88                                          LRESULT *result, void *arg );
89
90 extern WNDPROC16 WINPROC_GetProc16( WNDPROC proc, BOOL unicode ) DECLSPEC_HIDDEN;
91 extern WNDPROC WINPROC_AllocProc16( WNDPROC16 func ) DECLSPEC_HIDDEN;
92 extern LRESULT WINPROC_CallProc16To32A( winproc_callback_t callback, HWND16 hwnd, UINT16 msg,
93                                         WPARAM16 wParam, LPARAM lParam, LRESULT *result, void *arg ) DECLSPEC_HIDDEN;
94 extern LRESULT WINPROC_CallProc32ATo16( winproc_callback16_t callback, HWND hwnd, UINT msg,
95                                         WPARAM wParam, LPARAM lParam, LRESULT *result, void *arg ) DECLSPEC_HIDDEN;
96
97 extern LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode ) DECLSPEC_HIDDEN;
98
99 #define GET_WORD(ptr)  (*(const WORD *)(ptr))
100 #define GET_DWORD(ptr) (*(const DWORD *)(ptr))
101
102 #define WM_SYSTIMER 0x0118
103
104 /* Dialog info structure (must match the user32 one) */
105 typedef struct tagDIALOGINFO
106 {
107     HWND      hwndFocus;   /* Current control with focus */
108     HFONT     hUserFont;   /* Dialog font */
109     HMENU     hMenu;       /* Dialog menu */
110     UINT      xBaseUnit;   /* Dialog units (depends on the font) */
111     UINT      yBaseUnit;
112     INT       idResult;    /* EndDialog() result / default pushbutton ID */
113     UINT      flags;       /* EndDialog() called for this dialog */
114 } DIALOGINFO;
115
116 #define DF_END  0x0001
117 #define DF_OWNERENABLED 0x0002
118
119 /* HANDLE16 <-> HANDLE conversions */
120 #define HCURSOR_16(h32)    (LOWORD(h32))
121 #define HICON_16(h32)      (LOWORD(h32))
122 #define HINSTANCE_16(h32)  (LOWORD(h32))
123
124 #define HCURSOR_32(h16)    ((HCURSOR)(ULONG_PTR)(h16))
125 #define HICON_32(h16)      ((HICON)(ULONG_PTR)(h16))
126 #define HINSTANCE_32(h16)  ((HINSTANCE)(ULONG_PTR)(h16))
127 #define HMODULE_32(h16)    ((HMODULE)(ULONG_PTR)(h16))
128
129 extern DWORD USER16_AlertableWait DECLSPEC_HIDDEN;
130 extern WORD USER_HeapSel DECLSPEC_HIDDEN;
131
132 #endif /* __WINE_USER_PRIVATE_H */