blob: 7e18f8866cb5841cb2dc141b3484ec5797de1bca [file] [log] [blame]
Alexandre Julliard234bc241994-12-10 13:02:28 +00001/*
Alexandre Julliardb817f4f1996-03-14 18:08:34 +00002 * Misc. USER functions
3 *
4 * Copyright 1993 Robert J. Amstadt
Alexandre Julliard2ace16a1996-04-28 15:09:19 +00005 * 1996 Alex Korobka
Alexandre Julliardb817f4f1996-03-14 18:08:34 +00006 */
7
Alexandre Julliard401710d1993-09-04 10:09:32 +00008#include <stdlib.h>
Marcus Meissner61afa331999-02-22 10:16:00 +00009#include "wine/winbase16.h"
Jeremy Whited3e22d92000-02-10 19:03:02 +000010#include "windef.h"
11#include "wingdi.h"
Marcus Meissner61afa331999-02-22 10:16:00 +000012#include "winuser.h"
Alexandre Julliard889f7421997-04-15 17:19:52 +000013#include "heap.h"
Alexandre Julliard401710d1993-09-04 10:09:32 +000014#include "user.h"
Alexandre Julliard2ace16a1996-04-28 15:09:19 +000015#include "task.h"
16#include "queue.h"
Alexandre Julliard7e56f681996-01-31 19:02:28 +000017#include "win.h"
Alexandre Julliard91222da2000-12-10 23:01:33 +000018#include "controls.h"
Ulrich Weigand1b938b11999-03-10 14:03:06 +000019#include "cursoricon.h"
Alexandre Julliard2ace16a1996-04-28 15:09:19 +000020#include "hook.h"
Alexandre Julliarde2abbb11995-03-19 17:39:39 +000021#include "toolhelp.h"
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +000022#include "message.h"
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000023#include "miscemu.h"
Alexandre Julliard646c5622000-07-31 23:32:47 +000024#include "sysmetrics.h"
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +000025#include "callback.h"
Patrik Stridvall8d8703c1999-02-04 14:05:38 +000026#include "local.h"
Alexandre Julliardbecb9a32000-12-11 03:48:15 +000027#include "module.h"
Alexandre Julliard06c275a1999-05-02 14:32:27 +000028#include "debugtools.h"
Alexandre Julliard401710d1993-09-04 10:09:32 +000029
Alexandre Julliard646c5622000-07-31 23:32:47 +000030DECLARE_DEBUG_CHANNEL(hook);
31DECLARE_DEBUG_CHANNEL(local);
32DECLARE_DEBUG_CHANNEL(system);
33DECLARE_DEBUG_CHANNEL(win);
34DECLARE_DEBUG_CHANNEL(win32);
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000035
Alexandre Julliarde2abbb11995-03-19 17:39:39 +000036/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +000037 * GetFreeSystemResources (USER.284)
Alexandre Julliarde2abbb11995-03-19 17:39:39 +000038 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000039WORD WINAPI GetFreeSystemResources16( WORD resType )
Alexandre Julliarde2abbb11995-03-19 17:39:39 +000040{
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000041 HINSTANCE16 gdi_inst;
42 WORD gdi_heap;
Alexandre Julliardcdcdede1996-04-21 14:57:41 +000043 int userPercent, gdiPercent;
Alexandre Julliarde2abbb11995-03-19 17:39:39 +000044
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000045 if ((gdi_inst = LoadLibrary16( "GDI" )) < 32) return 0;
46 gdi_heap = GlobalHandleToSel16( gdi_inst );
47
Alexandre Julliarde2abbb11995-03-19 17:39:39 +000048 switch(resType)
49 {
50 case GFSR_USERRESOURCES:
Alexandre Julliardcdcdede1996-04-21 14:57:41 +000051 userPercent = (int)LOCAL_CountFree( USER_HeapSel ) * 100 /
52 LOCAL_HeapSize( USER_HeapSel );
53 gdiPercent = 100;
Alexandre Julliarde2abbb11995-03-19 17:39:39 +000054 break;
55
56 case GFSR_GDIRESOURCES:
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000057 gdiPercent = (int)LOCAL_CountFree( gdi_inst ) * 100 /
58 LOCAL_HeapSize( gdi_inst );
Alexandre Julliardcdcdede1996-04-21 14:57:41 +000059 userPercent = 100;
Alexandre Julliarde2abbb11995-03-19 17:39:39 +000060 break;
61
62 case GFSR_SYSTEMRESOURCES:
Alexandre Julliardcdcdede1996-04-21 14:57:41 +000063 userPercent = (int)LOCAL_CountFree( USER_HeapSel ) * 100 /
64 LOCAL_HeapSize( USER_HeapSel );
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000065 gdiPercent = (int)LOCAL_CountFree( gdi_inst ) * 100 /
66 LOCAL_HeapSize( gdi_inst );
Alexandre Julliarde2abbb11995-03-19 17:39:39 +000067 break;
68
69 default:
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000070 userPercent = gdiPercent = 0;
71 break;
Alexandre Julliarde2abbb11995-03-19 17:39:39 +000072 }
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000073 FreeLibrary16( gdi_inst );
Francois Gouget6d77d3a2000-03-25 21:44:35 +000074 return (WORD)min( userPercent, gdiPercent );
Alexandre Julliarde2abbb11995-03-19 17:39:39 +000075}
76
77
Alexandre Julliard401710d1993-09-04 10:09:32 +000078/**********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +000079 * InitApp (USER.5)
Alexandre Julliard401710d1993-09-04 10:09:32 +000080 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000081INT16 WINAPI InitApp16( HINSTANCE16 hInstance )
Alexandre Julliard401710d1993-09-04 10:09:32 +000082{
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000083 /* Hack: restore the divide-by-zero handler */
84 /* FIXME: should set a USER-specific handler that displays a msg box */
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000085 INT_SetPMHandler( 0, INT_GetPMHandler( 0xff ) );
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000086
Ulrich Weigand0be24af1999-01-20 13:16:32 +000087 /* Create task message queue */
Alexandre Julliarda3960291999-02-26 11:11:13 +000088 if ( !GetFastQueue16() ) return 0;
Alexandre Julliardfb9a9191994-03-01 19:48:04 +000089
Alexandre Julliard401710d1993-09-04 10:09:32 +000090 return 1;
91}
Alexandre Julliard2ace16a1996-04-28 15:09:19 +000092
93/**********************************************************************
Alexandre Julliard77b99181997-09-14 17:17:23 +000094 * USER_ModuleUnload
95 */
96static void USER_ModuleUnload( HMODULE16 hModule )
97{
98 HOOK_FreeModuleHooks( hModule );
99 CLASS_FreeModuleClasses( hModule );
Ulrich Weigand1b938b11999-03-10 14:03:06 +0000100 CURSORICON_FreeModuleIcons( hModule );
Alexandre Julliard77b99181997-09-14 17:17:23 +0000101}
102
103/**********************************************************************
Stephane Lussier91bb1f91999-02-09 14:07:07 +0000104 * USER_QueueCleanup
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000105 */
Ulrich Weigande392a0c1999-04-01 11:44:52 +0000106static void USER_QueueCleanup( HQUEUE16 hQueue )
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000107{
Ulrich Weigand0be24af1999-01-20 13:16:32 +0000108 if ( hQueue )
109 {
Ulrich Weigand0be24af1999-01-20 13:16:32 +0000110 WND* desktop = WIN_GetDesktop();
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000111
Ulrich Weigande392a0c1999-04-01 11:44:52 +0000112 /* Patch desktop window */
113 if ( desktop->hmemTaskQ == hQueue )
114 {
115 HTASK16 nextTask = TASK_GetNextTask( GetCurrentTask() );
116 desktop->hmemTaskQ = GetTaskQueue16( nextTask );
117 }
118
Ulrich Weigand0be24af1999-01-20 13:16:32 +0000119 /* Patch resident popup menu window */
120 MENU_PatchResidentPopup( hQueue, NULL );
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +0000121
Ulrich Weigand0be24af1999-01-20 13:16:32 +0000122 TIMER_RemoveQueueTimers( hQueue );
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000123
Ulrich Weigand0be24af1999-01-20 13:16:32 +0000124 HOOK_FreeQueueHooks( hQueue );
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000125
Ulrich Weigand0be24af1999-01-20 13:16:32 +0000126 QUEUE_SetExitingQueue( hQueue );
127 WIN_ResetQueueWindows( desktop, hQueue, (HQUEUE16)0);
Ulrich Weigand0be24af1999-01-20 13:16:32 +0000128 QUEUE_SetExitingQueue( 0 );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000129
Ulrich Weigand0be24af1999-01-20 13:16:32 +0000130 /* Free the message queue */
131 QUEUE_DeleteMsgQueue( hQueue );
Francois Boisvert3a3cd9f1999-03-28 12:42:52 +0000132
133 WIN_ReleaseDesktop();
Ulrich Weigand0be24af1999-01-20 13:16:32 +0000134 }
Stephane Lussier91bb1f91999-02-09 14:07:07 +0000135}
136
137/**********************************************************************
138 * USER_AppExit
139 */
Alexandre Julliard7d5bc5c2001-01-15 20:09:09 +0000140static void USER_AppExit(void)
Stephane Lussier91bb1f91999-02-09 14:07:07 +0000141{
Alexandre Julliard7d5bc5c2001-01-15 20:09:09 +0000142 HINSTANCE16 hInstance = MapHModuleLS(0);
143
Noel Borthwick29700671999-09-03 15:17:57 +0000144 /* FIXME: maybe destroy menus (Windows only complains about them
145 * but does nothing);
146 */
147
Alexandre Julliard77b99181997-09-14 17:17:23 +0000148 /* ModuleUnload() in "Internals" */
149
150 hInstance = GetExePtr( hInstance );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000151 if( GetModuleUsage16( hInstance ) <= 1 )
Alexandre Julliard77b99181997-09-14 17:17:23 +0000152 USER_ModuleUnload( hInstance );
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000153}
154
Alexandre Julliard889f7421997-04-15 17:19:52 +0000155
156/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000157 * SignalProc (USER.314)
Alexandre Julliard77b99181997-09-14 17:17:23 +0000158 */
159void WINAPI USER_SignalProc( HANDLE16 hTaskOrModule, UINT16 uCode,
160 UINT16 uExitFn, HINSTANCE16 hInstance,
161 HQUEUE16 hQueue )
162{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000163 FIXME_(win)("Win 3.1 USER signal %04x\n", uCode );
Alexandre Julliard77b99181997-09-14 17:17:23 +0000164}
165
Ulrich Weigande392a0c1999-04-01 11:44:52 +0000166/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000167 * FinalUserInit (USER.400)
Ulrich Weigand98c30531999-07-27 17:10:06 +0000168 */
169void WINAPI FinalUserInit16( void )
170{
171 /* FIXME: Should chain to FinalGdiInit now. */
172}
173
174/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000175 * UserSignalProc (USER.391) (USER32.@)
Ulrich Weigande392a0c1999-04-01 11:44:52 +0000176 *
177 * For comments about the meaning of uCode and dwFlags
178 * see PROCESS_CallUserSignalProc.
179 *
180 */
181WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
182 DWORD dwFlags, HMODULE16 hModule )
183{
Ulrich Weigande392a0c1999-04-01 11:44:52 +0000184 /* FIXME: Proper reaction to most signals still missing. */
185
186 switch ( uCode )
187 {
188 case USIG_DLL_UNLOAD_WIN16:
189 case USIG_DLL_UNLOAD_WIN32:
190 USER_ModuleUnload( hModule );
191 break;
192
193 case USIG_DLL_UNLOAD_ORPHANS:
194 break;
195
196 case USIG_FAULT_DIALOG_PUSH:
197 case USIG_FAULT_DIALOG_POP:
198 break;
199
200 case USIG_THREAD_INIT:
201 break;
202
203 case USIG_THREAD_EXIT:
204 USER_QueueCleanup( GetThreadQueue16( dwThreadOrProcessID ) );
205 SetThreadQueue16( dwThreadOrProcessID, 0 );
206 break;
207
208 case USIG_PROCESS_CREATE:
Peter Ganten6619f5a2000-01-01 22:38:20 +0000209 break;
210
Ulrich Weigande392a0c1999-04-01 11:44:52 +0000211 case USIG_PROCESS_INIT:
212 case USIG_PROCESS_LOADED:
Peter Ganten6619f5a2000-01-01 22:38:20 +0000213 break;
Ulrich Weigande392a0c1999-04-01 11:44:52 +0000214 case USIG_PROCESS_RUNNING:
215 break;
216
217 case USIG_PROCESS_EXIT:
218 break;
219
Alexandre Julliard7d5bc5c2001-01-15 20:09:09 +0000220 case USIG_PROCESS_DESTROY:
221 USER_AppExit();
Peter Ganten6619f5a2000-01-01 22:38:20 +0000222 break;
Ulrich Weigande392a0c1999-04-01 11:44:52 +0000223
224 default:
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000225 FIXME_(win)("(%04x, %08lx, %04lx, %04x)\n",
Ulrich Weigande392a0c1999-04-01 11:44:52 +0000226 uCode, dwThreadOrProcessID, dwFlags, hModule );
227 break;
228 }
229
230 /* FIXME: Should chain to GdiSignalProc now. */
231
232 return 0;
233}
234
Ulrich Weigand937f4d31999-12-05 02:49:59 +0000235/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000236 * DllEntryPoint (USER.374)
Ulrich Weigand937f4d31999-12-05 02:49:59 +0000237 */
238BOOL WINAPI USER_DllEntryPoint( DWORD dwReason, HINSTANCE hInstDLL, WORD ds,
239 WORD wHeapSize, DWORD dwReserved1, WORD wReserved2 )
240{
241 switch ( dwReason )
242 {
243 case DLL_PROCESS_ATTACH:
244 /*
245 * We need to load the 32-bit library so as to be able
246 * to access the system resources stored there!
247 */
248 if ( !LoadLibraryA("USER32.DLL") )
249 {
250 ERR_(win)( "Could not load USER32.DLL\n" );
251 return FALSE;
252 }
253 }
254
255 return TRUE;
256}
Ulrich Weigande392a0c1999-04-01 11:44:52 +0000257
Alexandre Julliard77b99181997-09-14 17:17:23 +0000258
259/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000260 * ExitWindows (USER.7)
Alexandre Julliard889f7421997-04-15 17:19:52 +0000261 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000262BOOL16 WINAPI ExitWindows16( DWORD dwReturnCode, UINT16 wReserved )
Alexandre Julliard889f7421997-04-15 17:19:52 +0000263{
264 return ExitWindowsEx( EWX_LOGOFF, 0xffffffff );
265}
266
267
268/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000269 * ExitWindowsExec (USER.246)
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000270 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000271BOOL16 WINAPI ExitWindowsExec16( LPCSTR lpszExe, LPCSTR lpszParams )
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000272{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000273 TRACE_(system)("Should run the following in DOS-mode: \"%s %s\"\n",
Alexandre Julliardd37eb361997-07-20 16:23:21 +0000274 lpszExe, lpszParams);
275 return ExitWindowsEx( EWX_LOGOFF, 0xffffffff );
276}
277
278
279/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000280 * ExitWindowsEx (USER32.@)
Alexandre Julliard889f7421997-04-15 17:19:52 +0000281 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000282BOOL WINAPI ExitWindowsEx( UINT flags, DWORD reserved )
Alexandre Julliard889f7421997-04-15 17:19:52 +0000283{
284 int i;
Alexandre Julliarda3960291999-02-26 11:11:13 +0000285 BOOL result;
Alexandre Julliard889f7421997-04-15 17:19:52 +0000286 WND **list, **ppWnd;
287
288 /* We have to build a list of all windows first, as in EnumWindows */
289
Francois Boisvert3a3cd9f1999-03-28 12:42:52 +0000290 if (!(list = WIN_BuildWinArray( WIN_GetDesktop(), 0, NULL )))
291 {
292 WIN_ReleaseDesktop();
293 return FALSE;
294 }
Alexandre Julliard889f7421997-04-15 17:19:52 +0000295
296 /* Send a WM_QUERYENDSESSION message to every window */
297
298 for (ppWnd = list, i = 0; *ppWnd; ppWnd++, i++)
299 {
300 /* Make sure that the window still exists */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000301 if (!IsWindow( (*ppWnd)->hwndSelf )) continue;
Alexandre Julliard889f7421997-04-15 17:19:52 +0000302 if (!SendMessage16( (*ppWnd)->hwndSelf, WM_QUERYENDSESSION, 0, 0 ))
303 break;
304 }
305 result = !(*ppWnd);
306
307 /* Now notify all windows that got a WM_QUERYENDSESSION of the result */
308
309 for (ppWnd = list; i > 0; i--, ppWnd++)
310 {
Alexandre Julliarda3960291999-02-26 11:11:13 +0000311 if (!IsWindow( (*ppWnd)->hwndSelf )) continue;
Alexandre Julliard889f7421997-04-15 17:19:52 +0000312 SendMessage16( (*ppWnd)->hwndSelf, WM_ENDSESSION, result, 0 );
313 }
Francois Boisvert3a3cd9f1999-03-28 12:42:52 +0000314 WIN_ReleaseWinArray(list);
Alexandre Julliard889f7421997-04-15 17:19:52 +0000315
Ulrich Weigandc319c661999-05-22 16:18:36 +0000316 if (result) ExitKernel16();
Francois Boisvert3a3cd9f1999-03-28 12:42:52 +0000317 WIN_ReleaseDesktop();
Alexandre Julliard889f7421997-04-15 17:19:52 +0000318 return FALSE;
319}
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000320
Marcus Meissner5e2f50f1999-11-07 22:26:20 +0000321static void _dump_CDS_flags(DWORD flags) {
322#define X(x) if (flags & CDS_##x) MESSAGE(""#x ",");
323 X(UPDATEREGISTRY);X(TEST);X(FULLSCREEN);X(GLOBAL);
324 X(SET_PRIMARY);X(RESET);X(SETRECT);X(NORESET);
325#undef X
326}
Alexandre Julliard829fe321998-07-26 14:27:39 +0000327
328/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000329 * ChangeDisplaySettingsA (USER32.@)
Alexandre Julliard829fe321998-07-26 14:27:39 +0000330 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000331LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags )
Alexandre Julliard829fe321998-07-26 14:27:39 +0000332{
Marcus Meissner5e2f50f1999-11-07 22:26:20 +0000333 FIXME_(system)("(%p,0x%08lx), stub\n",devmode,flags);
334 MESSAGE("\tflags=");_dump_CDS_flags(flags);MESSAGE("\n");
335 if (devmode==NULL)
336 FIXME_(system)(" devmode=NULL (return to default mode)\n");
Alexandre Julliard646c5622000-07-31 23:32:47 +0000337 else if ( (devmode->dmBitsPerPel != GetSystemMetrics(SM_WINE_BPP))
338 || (devmode->dmPelsHeight != GetSystemMetrics(SM_CYSCREEN))
339 || (devmode->dmPelsWidth != GetSystemMetrics(SM_CXSCREEN)) )
Marcus Meissner5e2f50f1999-11-07 22:26:20 +0000340
341 {
342
343 if (devmode->dmFields & DM_BITSPERPEL)
344 FIXME_(system)(" bpp=%ld\n",devmode->dmBitsPerPel);
345 if (devmode->dmFields & DM_PELSWIDTH)
346 FIXME_(system)(" width=%ld\n",devmode->dmPelsWidth);
347 if (devmode->dmFields & DM_PELSHEIGHT)
348 FIXME_(system)(" height=%ld\n",devmode->dmPelsHeight);
349 FIXME_(system)(" (Putting X in this mode beforehand might help)\n");
350 /* we don't, but the program ... does not need to know */
351 return DISP_CHANGE_SUCCESSFUL;
352 }
353 return DISP_CHANGE_SUCCESSFUL;
354}
355
356/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000357 * ChangeDisplaySettingsExA (USER32.@)
Marcus Meissner5e2f50f1999-11-07 22:26:20 +0000358 */
359LONG WINAPI ChangeDisplaySettingsExA(
360 LPCSTR devname, LPDEVMODEA devmode, HWND hwnd, DWORD flags,
361 LPARAM lparam
362) {
363 FIXME_(system)("(%s,%p,0x%04x,0x%08lx,0x%08lx), stub\n",devname,devmode,hwnd,flags,lparam);
364 MESSAGE("\tflags=");_dump_CDS_flags(flags);MESSAGE("\n");
Alexandre Julliard829fe321998-07-26 14:27:39 +0000365 if (devmode==NULL)
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000366 FIXME_(system)(" devmode=NULL (return to default mode)\n");
Alexandre Julliard646c5622000-07-31 23:32:47 +0000367 else if ( (devmode->dmBitsPerPel != GetSystemMetrics(SM_WINE_BPP))
368 || (devmode->dmPelsHeight != GetSystemMetrics(SM_CYSCREEN))
369 || (devmode->dmPelsWidth != GetSystemMetrics(SM_CXSCREEN)) )
Alexandre Julliard829fe321998-07-26 14:27:39 +0000370
371 {
372
373 if (devmode->dmFields & DM_BITSPERPEL)
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000374 FIXME_(system)(" bpp=%ld\n",devmode->dmBitsPerPel);
Alexandre Julliard829fe321998-07-26 14:27:39 +0000375 if (devmode->dmFields & DM_PELSWIDTH)
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000376 FIXME_(system)(" width=%ld\n",devmode->dmPelsWidth);
Alexandre Julliard829fe321998-07-26 14:27:39 +0000377 if (devmode->dmFields & DM_PELSHEIGHT)
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000378 FIXME_(system)(" height=%ld\n",devmode->dmPelsHeight);
379 FIXME_(system)(" (Putting X in this mode beforehand might help)\n");
Marcus Meissner66cd3331998-10-27 15:41:54 +0000380 /* we don't, but the program ... does not need to know */
381 return DISP_CHANGE_SUCCESSFUL;
Alexandre Julliard829fe321998-07-26 14:27:39 +0000382 }
383 return DISP_CHANGE_SUCCESSFUL;
384}
385
Alexandre Julliarda11d7b11998-03-01 20:05:02 +0000386/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000387 * EnumDisplaySettingsA (USER32.@)
Marcus Meissner66cd3331998-10-27 15:41:54 +0000388 * FIXME: Currently uses static list of modes.
389 *
390 * RETURNS
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000391 * TRUE if nth setting exists found (described in the LPDEVMODEA struct)
Marcus Meissner66cd3331998-10-27 15:41:54 +0000392 * FALSE if we do not have the nth setting
Alexandre Julliarda11d7b11998-03-01 20:05:02 +0000393 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000394BOOL WINAPI EnumDisplaySettingsA(
Marcus Meissner66cd3331998-10-27 15:41:54 +0000395 LPCSTR name, /* [in] huh? */
396 DWORD n, /* [in] nth entry in display settings list*/
Alexandre Julliarda3960291999-02-26 11:11:13 +0000397 LPDEVMODEA devmode /* [out] devmode for that setting */
Marcus Meissner66cd3331998-10-27 15:41:54 +0000398) {
399#define NRMODES 5
400#define NRDEPTHS 4
401 struct {
402 int w,h;
403 } modes[NRMODES]={{512,384},{640,400},{640,480},{800,600},{1024,768}};
404 int depths[4] = {8,16,24,32};
405
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000406 TRACE_(system)("(%s,%ld,%p)\n",name,n,devmode);
Alexandre Julliarda11d7b11998-03-01 20:05:02 +0000407 if (n==0) {
Alexandre Julliard646c5622000-07-31 23:32:47 +0000408 devmode->dmBitsPerPel = GetSystemMetrics(SM_WINE_BPP);
409 devmode->dmPelsHeight = GetSystemMetrics(SM_CYSCREEN);
410 devmode->dmPelsWidth = GetSystemMetrics(SM_CXSCREEN);
Alexandre Julliarda11d7b11998-03-01 20:05:02 +0000411 return TRUE;
412 }
Marcus Meissner66cd3331998-10-27 15:41:54 +0000413 if ((n-1)<NRMODES*NRDEPTHS) {
414 devmode->dmBitsPerPel = depths[(n-1)/NRMODES];
415 devmode->dmPelsHeight = modes[(n-1)%NRMODES].h;
416 devmode->dmPelsWidth = modes[(n-1)%NRMODES].w;
417 return TRUE;
418 }
Alexandre Julliarda11d7b11998-03-01 20:05:02 +0000419 return FALSE;
420}
421
Juergen Schmied8e26b581998-10-23 12:51:38 +0000422/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000423 * EnumDisplaySettingsW (USER32.@)
Juergen Schmied8e26b581998-10-23 12:51:38 +0000424 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000425BOOL WINAPI EnumDisplaySettingsW(LPCWSTR name,DWORD n,LPDEVMODEW devmode) {
Marcus Meissner66cd3331998-10-27 15:41:54 +0000426 LPSTR nameA = HEAP_strdupWtoA(GetProcessHeap(),0,name);
Alexandre Julliarda3960291999-02-26 11:11:13 +0000427 DEVMODEA devmodeA;
428 BOOL ret = EnumDisplaySettingsA(nameA,n,&devmodeA);
Marcus Meissner66cd3331998-10-27 15:41:54 +0000429
430 if (ret) {
431 devmode->dmBitsPerPel = devmodeA.dmBitsPerPel;
432 devmode->dmPelsHeight = devmodeA.dmPelsHeight;
433 devmode->dmPelsWidth = devmodeA.dmPelsWidth;
434 /* FIXME: convert rest too, if they are ever returned */
Juergen Schmied8e26b581998-10-23 12:51:38 +0000435 }
Marcus Meissner66cd3331998-10-27 15:41:54 +0000436 HeapFree(GetProcessHeap(),0,nameA);
437 return ret;
Juergen Schmied8e26b581998-10-23 12:51:38 +0000438}
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000439
440/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000441 * EnumDisplayDevicesA (USER32.@)
Marcus Meissner8388f671999-09-19 12:09:23 +0000442 */
443BOOL WINAPI EnumDisplayDevicesA(
444 LPVOID unused,DWORD i,LPDISPLAY_DEVICEA lpDisplayDevice,DWORD dwFlags
445) {
446 if (i)
447 return FALSE;
448 FIXME_(system)("(%p,%ld,%p,0x%08lx), stub!\n",unused,i,lpDisplayDevice,dwFlags);
449 strcpy(lpDisplayDevice->DeviceName,"X11");
450 strcpy(lpDisplayDevice->DeviceString,"X 11 Windowing System");
451 lpDisplayDevice->StateFlags =
452 DISPLAY_DEVICE_ATTACHED_TO_DESKTOP |
453 DISPLAY_DEVICE_PRIMARY_DEVICE |
454 DISPLAY_DEVICE_VGA_COMPATIBLE;
455 return TRUE;
456}
457
458/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000459 * EnumDisplayDevicesW (USER32.@)
Marcus Meissner8388f671999-09-19 12:09:23 +0000460 */
461BOOL WINAPI EnumDisplayDevicesW(
462 LPVOID unused,DWORD i,LPDISPLAY_DEVICEW lpDisplayDevice,DWORD dwFlags
463) {
464 if (i)
465 return FALSE;
466 FIXME_(system)("(%p,%ld,%p,0x%08lx), stub!\n",unused,i,lpDisplayDevice,dwFlags);
Alexandre Julliard24a62ab2000-11-28 22:40:56 +0000467 MultiByteToWideChar( CP_ACP, 0, "X11", -1, lpDisplayDevice->DeviceName,
468 sizeof(lpDisplayDevice->DeviceName)/sizeof(WCHAR) );
469 MultiByteToWideChar( CP_ACP, 0, "X11 Windowing System", -1, lpDisplayDevice->DeviceString,
470 sizeof(lpDisplayDevice->DeviceString)/sizeof(WCHAR) );
Marcus Meissner8388f671999-09-19 12:09:23 +0000471 lpDisplayDevice->StateFlags =
472 DISPLAY_DEVICE_ATTACHED_TO_DESKTOP |
473 DISPLAY_DEVICE_PRIMARY_DEVICE |
474 DISPLAY_DEVICE_VGA_COMPATIBLE;
475 return TRUE;
476}
477
478/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000479 * SetEventHook (USER.321)
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000480 *
481 * Used by Turbo Debugger for Windows
482 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000483FARPROC16 WINAPI SetEventHook16(FARPROC16 lpfnEventHook)
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000484{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000485 FIXME_(hook)("(lpfnEventHook=%08x): stub\n", (UINT)lpfnEventHook);
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000486 return NULL;
487}
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000488
489/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000490 * UserSeeUserDo (USER.216)
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000491 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000492DWORD WINAPI UserSeeUserDo16(WORD wReqType, WORD wParam1, WORD wParam2, WORD wParam3)
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000493{
494 switch (wReqType)
495 {
496 case USUD_LOCALALLOC:
497 return LOCAL_Alloc(USER_HeapSel, wParam1, wParam3);
498 case USUD_LOCALFREE:
499 return LOCAL_Free(USER_HeapSel, wParam1);
500 case USUD_LOCALCOMPACT:
501 return LOCAL_Compact(USER_HeapSel, wParam3, 0);
502 case USUD_LOCALHEAP:
503 return USER_HeapSel;
504 case USUD_FIRSTCLASS:
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000505 FIXME_(local)("return a pointer to the first window class.\n");
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000506 return (DWORD)-1;
507 default:
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000508 WARN_(local)("wReqType %04x (unknown)", wReqType);
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000509 return (DWORD)-1;
510 }
511}
512
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000513/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000514 * GetSystemDebugState (USER.231)
Alexandre Julliard4220b291999-07-11 17:20:01 +0000515 */
516WORD WINAPI GetSystemDebugState16(void)
517{
518 return 0; /* FIXME */
519}
520
521/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000522 * RegisterLogonProcess (USER32.@)
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000523 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000524DWORD WINAPI RegisterLogonProcess(HANDLE hprocess,BOOL x) {
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000525 FIXME_(win32)("(%d,%d),stub!\n",hprocess,x);
Marcus Meissner8143acc1998-10-31 12:19:56 +0000526 return 1;
527}
528
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000529/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000530 * CreateWindowStationW (USER32.@)
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000531 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000532HWINSTA WINAPI CreateWindowStationW(
Marcus Meissner8143acc1998-10-31 12:19:56 +0000533 LPWSTR winstation,DWORD res1,DWORD desiredaccess,
534 LPSECURITY_ATTRIBUTES lpsa
535) {
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000536 FIXME_(win32)("(%s,0x%08lx,0x%08lx,%p),stub!\n",debugstr_w(winstation),
Marcus Meissner8143acc1998-10-31 12:19:56 +0000537 res1,desiredaccess,lpsa
538 );
François Gouget54300e52001-01-09 20:56:06 +0000539 return (HWINSTA)0xdeadcafe;
Marcus Meissner8143acc1998-10-31 12:19:56 +0000540}
541
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000542/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000543 * SetProcessWindowStation (USER32.@)
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000544 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000545BOOL WINAPI SetProcessWindowStation(HWINSTA hWinSta) {
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000546 FIXME_(win32)("(%d),stub!\n",hWinSta);
Marcus Meissner8143acc1998-10-31 12:19:56 +0000547 return TRUE;
548}
549
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000550/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000551 * SetUserObjectSecurity (USER32.@)
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000552 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000553BOOL WINAPI SetUserObjectSecurity(
554 HANDLE hObj,
Francois Gouget326e2ba2000-06-18 17:26:44 +0000555 PSECURITY_INFORMATION pSIRequested,
Juergen Schmied1ed51af1999-02-12 17:47:07 +0000556 PSECURITY_DESCRIPTOR pSID
Marcus Meissner8143acc1998-10-31 12:19:56 +0000557) {
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000558 FIXME_(win32)("(0x%08x,%p,%p),stub!\n",hObj,pSIRequested,pSID);
Marcus Meissner8143acc1998-10-31 12:19:56 +0000559 return TRUE;
560}
561
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000562/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000563 * CreateDesktopA (USER32.@)
Peter Gantenae3716d2000-07-15 15:13:56 +0000564 */
565HDESK WINAPI CreateDesktopA(
566 LPSTR lpszDesktop,LPSTR lpszDevice,LPDEVMODEA pDevmode,
567 DWORD dwFlags,DWORD dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa
568) {
569 FIXME_(win32)("(%s,%s,%p,0x%08lx,0x%08lx,%p),stub!\n",
570 lpszDesktop,lpszDevice,pDevmode,
571 dwFlags,dwDesiredAccess,lpsa
572 );
François Gougetd6515df2001-01-03 21:39:33 +0000573 return (HDESK)0xcafedead;
Peter Gantenae3716d2000-07-15 15:13:56 +0000574}
575
576/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000577 * CreateDesktopW (USER32.@)
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000578 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000579HDESK WINAPI CreateDesktopW(
580 LPWSTR lpszDesktop,LPWSTR lpszDevice,LPDEVMODEW pDevmode,
Marcus Meissner8143acc1998-10-31 12:19:56 +0000581 DWORD dwFlags,DWORD dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa
582) {
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000583 FIXME_(win32)("(%s,%s,%p,0x%08lx,0x%08lx,%p),stub!\n",
Marcus Meissner8143acc1998-10-31 12:19:56 +0000584 debugstr_w(lpszDesktop),debugstr_w(lpszDevice),pDevmode,
585 dwFlags,dwDesiredAccess,lpsa
586 );
François Gougetd6515df2001-01-03 21:39:33 +0000587 return (HDESK)0xcafedead;
Marcus Meissner8143acc1998-10-31 12:19:56 +0000588}
589
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000590/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000591 * EnumDesktopWindows (USER32.@)
Peter Gantenae3716d2000-07-15 15:13:56 +0000592 */
593BOOL WINAPI EnumDesktopWindows( HDESK hDesktop, WNDENUMPROC lpfn, LPARAM lParam ) {
594 FIXME_(win32)("(0x%08x, %p, 0x%08lx), stub!\n", hDesktop, lpfn, lParam );
595 return TRUE;
596}
597
598
599/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000600 * CloseWindowStation (USER32.@)
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000601 */
Sergey Turchanov2f5a1521999-04-10 16:48:46 +0000602BOOL WINAPI CloseWindowStation(HWINSTA hWinSta)
603{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000604 FIXME_(win32)("(0x%08x)\n", hWinSta);
Sergey Turchanov2f5a1521999-04-10 16:48:46 +0000605 return TRUE;
606}
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000607
608/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000609 * CloseDesktop (USER32.@)
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000610 */
Sergey Turchanov2f5a1521999-04-10 16:48:46 +0000611BOOL WINAPI CloseDesktop(HDESK hDesk)
612{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000613 FIXME_(win32)("(0x%08x)\n", hDesk);
Sergey Turchanov2f5a1521999-04-10 16:48:46 +0000614 return TRUE;
615}
616
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000617/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000618 * SetWindowStationUser (USER32.@)
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000619 */
Marcus Meissner8143acc1998-10-31 12:19:56 +0000620DWORD WINAPI SetWindowStationUser(DWORD x1,DWORD x2) {
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000621 FIXME_(win32)("(0x%08lx,0x%08lx),stub!\n",x1,x2);
Marcus Meissner8143acc1998-10-31 12:19:56 +0000622 return 1;
623}
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000624
625/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000626 * SetLogonNotifyWindow (USER32.@)
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000627 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000628DWORD WINAPI SetLogonNotifyWindow(HWINSTA hwinsta,HWND hwnd) {
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000629 FIXME_(win32)("(0x%x,%04x),stub!\n",hwinsta,hwnd);
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000630 return 1;
631}
632
633/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000634 * LoadLocalFonts (USER32.@)
Marcus Meissner9cfe2d51998-11-01 14:02:57 +0000635 */
636VOID WINAPI LoadLocalFonts(VOID) {
637 /* are loaded. */
638 return;
639}
Juergen Schmied80907841998-11-24 20:26:02 +0000640/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000641 * GetUserObjectInformationA (USER32.@)
Juergen Schmied80907841998-11-24 20:26:02 +0000642 */
Patrik Stridvall8276f691999-09-23 11:48:02 +0000643BOOL WINAPI GetUserObjectInformationA( HANDLE hObj, INT nIndex, LPVOID pvInfo, DWORD nLength, LPDWORD lpnLen )
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000644{ FIXME_(win32)("(0x%x %i %p %ld %p),stub!\n", hObj, nIndex, pvInfo, nLength, lpnLen );
Juergen Schmied80907841998-11-24 20:26:02 +0000645 return TRUE;
646}
647/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000648 * GetUserObjectInformationW (USER32.@)
Juergen Schmied80907841998-11-24 20:26:02 +0000649 */
Patrik Stridvall8276f691999-09-23 11:48:02 +0000650BOOL WINAPI GetUserObjectInformationW( HANDLE hObj, INT nIndex, LPVOID pvInfo, DWORD nLength, LPDWORD lpnLen )
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000651{ FIXME_(win32)("(0x%x %i %p %ld %p),stub!\n", hObj, nIndex, pvInfo, nLength, lpnLen );
Juergen Schmied80907841998-11-24 20:26:02 +0000652 return TRUE;
653}
Juergen Schmied535f32f1999-01-31 09:20:36 +0000654/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000655 * GetUserObjectSecurity (USER32.@)
Juergen Schmied535f32f1999-01-31 09:20:36 +0000656 */
Francois Gouget326e2ba2000-06-18 17:26:44 +0000657BOOL WINAPI GetUserObjectSecurity(HANDLE hObj, PSECURITY_INFORMATION pSIRequested,
Juergen Schmied535f32f1999-01-31 09:20:36 +0000658 PSECURITY_DESCRIPTOR pSID, DWORD nLength, LPDWORD lpnLengthNeeded)
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000659{ FIXME_(win32)("(0x%x %p %p len=%ld %p),stub!\n", hObj, pSIRequested, pSID, nLength, lpnLengthNeeded);
Juergen Schmied535f32f1999-01-31 09:20:36 +0000660 return TRUE;
661}
Lionel Ulmer5f5b5761999-03-28 13:42:12 +0000662
663/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000664 * SetSystemCursor (USER32.@)
Lionel Ulmer5f5b5761999-03-28 13:42:12 +0000665 */
666BOOL WINAPI SetSystemCursor(HCURSOR hcur, DWORD id)
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000667{ FIXME_(win32)("(%08x,%08lx),stub!\n", hcur, id);
Lionel Ulmer5f5b5761999-03-28 13:42:12 +0000668 return TRUE;
669}
Bertho Stultiensaf504741999-04-11 12:04:33 +0000670
671/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000672 * RegisterSystemThread (USER32.@)
Bertho Stultiensaf504741999-04-11 12:04:33 +0000673 */
Marcus Meissnerf203ab61999-04-15 15:12:40 +0000674void WINAPI RegisterSystemThread(DWORD flags, DWORD reserved)
Bertho Stultiensaf504741999-04-11 12:04:33 +0000675{
Alexandre Julliard06c275a1999-05-02 14:32:27 +0000676 FIXME_(win32)("(%08lx, %08lx)\n", flags, reserved);
Bertho Stultiensaf504741999-04-11 12:04:33 +0000677}
Marcus Meissner521c0e42000-07-10 10:58:16 +0000678
679/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000680 * RegisterDeviceNotificationA (USER32.@)
Marcus Meissner521c0e42000-07-10 10:58:16 +0000681 */
682HDEVNOTIFY WINAPI RegisterDeviceNotificationA(
683 HANDLE hnd, LPVOID notifyfilter, DWORD flags
684) {
685 FIXME_(win32)("(hwnd=%08x, filter=%p,flags=0x%08lx), STUB!\n",
686 hnd,notifyfilter,flags
687 );
688 return 0;
689}