Prevent crash when listview trace logging is on.
[wine] / dlls / user / bidi16.c
1 /*
2  * Win16 BiDi functions
3  * Copyright 2000 Erez Volk
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  * NOTE: Right now, most of these functions do nothing.
20  */
21
22 #include <string.h>
23 #include "winbase.h"
24 #include "wingdi.h"
25 #include "wine/winuser16.h"
26 #include "winerror.h"
27 #include "wine/debug.h"
28
29 WINE_DEFAULT_DEBUG_CHANNEL(relay);
30
31 /***********************************************************************
32  *              ChangeDialogTemplate   (USER.905)
33  * FIXME: The prototypes of this function have not been found yet.
34  */
35 LONG WINAPI ChangeDialogTemplate16(void) { FIXME("stub (no prototype)\n"); return 0; }
36
37 /***********************************************************************
38  *              BiDiMessageBoxEx   (USER.910)
39  * FIXME: The prototypes of this function have not been found yet.
40  */
41 LONG WINAPI BiDiMessageBoxEx16(void) { FIXME("stub (no prototype)\n"); return 0; }
42
43
44 /******************************************************************************
45  *                    ChangeKeyboardCodePage [USER.924]
46  * Change the keyboard layouts to a new pair.
47  * If the language IDs are set to -1, the language is not to be changed.
48  */
49 DWORD WINAPI ChangeKeyboardCodePage16( UINT16 iLangLeft, UINT16 iLangRight )
50 {
51     FIXME( "( %hu, %hu ): stub\n", iLangLeft, iLangRight );
52     return 0;
53 }
54
55
56 /******************************************************************************
57  *                    ChangeKeyboardLanguage [USER.912]
58  * Change the keyboard layouts to a new pair.
59  *
60  * RETURNS
61  *    The old keyboard layout pair.
62  */
63 DWORD WINAPI ChangeKeyboardLanguage16( UINT16 iLangLeft, UINT iLangRight )
64 {
65     FIXME( "( %hu, %hu ): stub\n", iLangLeft, iLangRight );
66     return 0;
67 }
68
69
70 /******************************************************************************
71  *                    CreateDialogIndirectParamML [USER.916]
72  */
73 HWND16 WINAPI CreateDialogIndirectParamML16( HINSTANCE16 hinstWnd,
74                                              const void * lpvDlgTmp,
75                                              HWND16 hwndOwner,
76                                              DLGPROC16 dlgProc,
77                                              LPARAM lParamInit,
78                                              UINT16 iCodePage, UINT16 iLang,
79                                              LPCSTR lpDlgName,
80                                              HINSTANCE16 hinstLoad )
81 {
82     FIXME( "( %04hx, %p, %04hx, %p, %08lx, %hu, %hu, %p, %04hx ): stub\n",
83            hinstWnd, lpvDlgTmp, hwndOwner, dlgProc, lParamInit,
84            iCodePage, iLang, lpDlgName, hinstLoad );
85     return 0;
86 }
87
88
89 /******************************************************************************
90  *                    DialogBoxIndirectParamML [USER.918]
91  */
92 HWND16 WINAPI DialogBoxIndirectParamML16( HINSTANCE16 hinstWnd,
93                                           HGLOBAL16 hglbDlgTemp,
94                                           HWND16 hwndOwner,
95                                           DLGPROC16 dlgprc,
96                                           LPARAM lParamInit,
97                                           UINT16 iCodePage, UINT16 iLang,
98                                           LPCSTR lpDlgName,
99                                           HINSTANCE16 hinstLoad )
100 {
101     FIXME( "( %04hx, %04hx, %04hx, %p, %08lx, %hu, %hu, %p, %04hx ): stub\n",
102            hinstWnd, hglbDlgTemp, hwndOwner, dlgprc, lParamInit,
103            iCodePage, iLang, lpDlgName, hinstLoad );
104     return 0;
105 }
106
107
108
109 /******************************************************************************
110  *                    FindLanguageResource [USER.923]
111  */
112 HRSRC16 WINAPI FindLanguageResource16( HINSTANCE16 hinst, LPCSTR lpRes,
113                                        LPCSTR lpResType, UINT16 iLang )
114 {
115     FIXME( "( %04hx, %p, %p, %hu ): stub\n", hinst, lpRes, lpResType, iLang );
116     return 0;
117 }
118
119
120 /******************************************************************************
121  *                    GetAppCodePage [USER.915]
122  * Returns the code page and language of the window
123  *
124  * RETURNS
125  *    The low word contains the code page, the high word contains the resource language.
126  */
127 DWORD WINAPI GetAppCodePage16( HWND16 hwnd )
128 {
129     FIXME( "( %04hx ): stub\n", hwnd );
130     return 0;
131 }
132
133
134 /******************************************************************************
135  *                    GetBaseCodePage [USER.922]
136  * Returns the base code page and resource language.
137  * For example, Hebrew windows will return HebrewCodePage in the low word
138  * and English in the high word.
139  */
140 DWORD WINAPI GetBaseCodePage16( void )
141 {
142     FIXME( ": stub\n" );
143     return 0;
144 }
145
146
147
148 /******************************************************************************
149  *                    GetCodePageSystemFont [USER.913]
150  * Returns the stock font for the requested code page.
151  */
152 HFONT16 WINAPI GetCodePageSystemFont16( UINT16 iFont, UINT16 iCodePage )
153 {
154     FIXME( "( %hu, %hu ): stub\n", iFont, iCodePage );
155     return 0;
156 }
157
158
159
160 /******************************************************************************
161  *                    GetLanguageName [USER.907]
162  * Returns the name of one language in (possibly) a different language.
163  * Currently only handles language 0 (english).
164  *
165  * RETURNS
166  *    Success: The number of bytes copied to the buffer, not including the null.
167  *    Failure: 0
168  */
169 UINT WINAPI GetLanguageName16( UINT16 iLang, UINT16 iName,
170                                LPSTR lpszName, UINT16 cbBuffer )
171 {
172     if ( (iLang == 0) && (iName == 0) ) {
173         if ( !lpszName || cbBuffer < 8 ) {
174             SetLastError( ERROR_INVALID_PARAMETER );
175             return 0;
176         }
177         strcpy( lpszName, "English" );
178         return 7;
179     }
180
181     FIXME( "( %hu, %hu, %p, %hu ): No BiDi16\n", iLang, iName, lpszName, cbBuffer );
182     return 0;
183 }
184
185
186 /******************************************************************************
187  *                    GetNumLanguages [USER.906]
188  * Returns the number of languages in the system.
189  */
190 UINT WINAPI GetNumLanguages16( void )
191 {
192     FIXME( ": No Bidi16\n" );
193     return 1;
194 }
195
196
197
198 /******************************************************************************
199  *                    GetProcessDefaultLayout [USER.1001]
200  *
201  * Gets the default layout for parentless windows.
202  * Right now, just returns 0 (left-to-right).
203  *
204  * RETURNS
205  *    Success: Nonzero
206  *    Failure: Zero
207  */
208 BOOL16 WINAPI GetProcessDefaultLayout16( DWORD *pdwDefaultLayout )
209 {
210     FIXME( "( %p ): no BiDi16\n", pdwDefaultLayout );
211     return GetProcessDefaultLayout( pdwDefaultLayout );
212 }
213
214
215 /******************************************************************************
216  *                   LoadLanguageString [USER.919]
217  * Loads a string for a specific language.
218  *
219  * RETURNS
220  *    SUCCESS: The length of the string loaded.
221  *    FAILURE: Zero.
222  */
223 UINT16 WINAPI LoadLanguageString16( HINSTANCE16 hinst, UINT16 id, UINT16 iLang,
224                                     LPSTR lpszText, INT16 nBytes )
225 {
226     FIXME( "( %04hx, %hu, %hu, %p, %hd ): stub\n", hinst, id, iLang, lpszText, nBytes );
227     return 0;
228 }
229
230
231
232 /******************************************************************************
233  *                   LoadSystemLanguageString [USER.902]
234  * Loads a string which is in one of the system language modules.
235  *
236  * RETURNS
237  *    Success: The length of the string loaded
238  *    Failure: Zero
239  */
240 UINT WINAPI LoadSystemLanguageString16( HINSTANCE16 hinstCaller, UINT16 id,
241                                         LPSTR lpszText, INT16 nBytes, UINT16 iLang )
242 {
243     FIXME( "( %04hx, %hu, %p, %hd, %hu ): stub\n", hinstCaller, id, lpszText, nBytes, iLang );
244     return 0;
245 }
246
247
248 /***********************************************************************
249  *           MessageBoxEx [USER.930]
250  * The multilingual version of MessageBox.
251  */
252 INT16 WINAPI MessageBoxEx16( HWND16 hwndParent, LPCSTR lpszText,
253                              LPCSTR lpszTitle, UINT16 fuStyle, UINT16 iLang )
254 {
255     FIXME( "( %04hx, %p, %p, %hu, %hu ): stub\n", hwndParent, lpszText, lpszTitle,
256            fuStyle, iLang );
257     return 0;
258 }
259
260
261 /***********************************************************************
262  *           QueryCodePage   [USER.914]
263  * Query code page specific data.
264  */
265 LRESULT WINAPI QueryCodePage16( UINT16 idxLang, UINT16 msg,
266                                 WPARAM16 wParam, LPARAM lParam )
267 {
268     FIXME( "( %hu, %hu, %04hx, %08lx ): stub\n", idxLang, msg, wParam, lParam );
269     return 0;
270 }
271
272 /***********************************************************************
273  *           SetAppCodePage   [USER.920]
274  * Set the code page and language of the window to new values.
275  *
276  * RETURNS
277  *    The low word contains the old code page, the high word contains
278  *       the old resource language.
279  */
280 DWORD WINAPI SetAppCodePage16( HWND16 hwnd, UINT16 iCodePage, UINT16 iLang,
281                                UINT16 fRedraw )
282 {
283     FIXME( "( %04hx, %hu, %hu, %hu ): stub\n", hwnd, iCodePage, iLang, fRedraw );
284     return 0;
285 }
286
287 /***********************************************************************
288  *           SetDlgItemTextEx   [USER.911]
289  * Sets the title or text of a control in a dialog box.
290  * Currently only works for language 0 (english)
291  */
292 void WINAPI SetDlgItemTextEx16( HWND16 hwnd, INT16 id,
293                                 LPCSTR lpszText, UINT16 iLang )
294 {
295     FIXME( "( %04hx, %hd, %p, %hu ): stub\n", hwnd, id, lpszText, iLang );
296 }
297
298 /******************************************************************************
299  *                    SetProcessDefaultLayout [USER.1000]
300  *
301  * Sets the default layout for parentless windows.
302  * Right now, only accepts 0 (left-to-right).
303  *
304  * RETURNS
305  *    Success: Nonzero
306  *    Failure: Zero
307  */
308 BOOL16 WINAPI SetProcessDefaultLayout16( DWORD dwDefaultLayout )
309 {
310     FIXME( "( %08lx ): No BiDi16\n", dwDefaultLayout );
311     return SetProcessDefaultLayout( dwDefaultLayout );
312 }
313
314 /******************************************************************************
315  *                    SetWindowTextEx [USER.909]
316  * Sets the given window's title to the specified text in the specified language.
317  */
318 void WINAPI SetWindowTextEx16( HWND16 hwnd, LPCSTR lpsz, UINT16 iLang )
319 {
320     FIXME( "( %04hx, %p, %hu ): stub\n", hwnd, lpsz, iLang );
321 }