19 #define HELP_CONTEXT 0x0001
20 #define HELP_QUIT 0x0002
21 #define HELP_INDEX 0x0003
22 #define HELP_CONTENTS 0x0003
23 #define HELP_HELPONHELP 0x0004
24 #define HELP_SETINDEX 0x0005
25 #define HELP_SETCONTENTS 0x0005
26 #define HELP_CONTEXTPOPUP 0x0008
27 #define HELP_FORCEFILE 0x0009
28 #define HELP_KEY 0x0101
29 #define HELP_COMMAND 0x0102
30 #define HELP_PARTIALKEY 0x0105
31 #define HELP_MULTIKEY 0x0201
32 #define HELP_SETWINPOS 0x0203
35 /***********************************************************************
38 * Clean-up everything and exit the Wine process.
39 * This is the back-end of ExitWindows(), called when all windows
40 * have agreed to be terminated.
42 void EXEC_ExitWindows( int retCode
)
44 /* Do the clean-up stuff */
53 /***********************************************************************
54 * ExitWindows (USER.7)
56 BOOL
ExitWindows( DWORD dwReturnCode
, WORD wReserved
)
62 api_assert("ExitWindows", wReserved
== 0);
63 api_assert("ExitWindows", HIWORD(dwReturnCode
) == 0);
65 /* We have to build a list of all windows first, as in EnumWindows */
67 if (!(list
= WIN_BuildWinArray( WIN_GetDesktop() ))) return FALSE
;
69 /* Send a WM_QUERYENDSESSION message to every window */
71 for (ppWnd
= list
, i
= 0; *ppWnd
; ppWnd
++, i
++)
73 /* Make sure that the window still exists */
74 if (!IsWindow( (*ppWnd
)->hwndSelf
)) continue;
75 if (!SendMessage16( (*ppWnd
)->hwndSelf
, WM_QUERYENDSESSION
, 0, 0 ))
80 /* Now notify all windows that got a WM_QUERYENDSESSION of the result */
82 for (ppWnd
= list
; i
> 0; i
--, ppWnd
++)
84 if (!IsWindow( (*ppWnd
)->hwndSelf
)) continue;
85 SendMessage16( (*ppWnd
)->hwndSelf
, WM_ENDSESSION
, result
, 0 );
87 HeapFree( SystemHeap
, 0, list
);
89 if (result
) EXEC_ExitWindows( LOWORD(dwReturnCode
) );
94 /**********************************************************************
97 BOOL
WinHelp(HWND hWnd
, LPSTR lpHelpFile
, WORD wCommand
, DWORD dwData
)
99 static WORD WM_WINHELP
=0;
105 if (wCommand
!= HELP_QUIT
) /* FIXME */
106 if(WinExec("winhelp.exe -x",SW_SHOWNORMAL
)<=32)
108 /* FIXME: Should be directed yield, to let winhelp open the window */
111 WM_WINHELP
=RegisterWindowMessage32A("WM_WINHELP");
115 hDest
= FindWindow32A( "MS_WINHELP", NULL
);
122 case HELP_SETCONTENTS
:
123 case HELP_CONTEXTPOPUP
:
125 case HELP_HELPONHELP
:
130 case HELP_PARTIALKEY
:
132 data
= PTR_SEG_TO_LIN(dwData
);
133 dsize
= strlen(data
)+1;
136 data
= PTR_SEG_TO_LIN(dwData
);
137 dsize
= ((LPMULTIKEYHELP
)data
) -> mkSize
;
140 data
= PTR_SEG_TO_LIN(dwData
);
141 dsize
= ((LPHELPWININFO
)data
) -> wStructSize
;
144 fprintf(stderr
,"Unknown help command %d\n",wCommand
);
148 nlen
= strlen(lpHelpFile
)+1;
151 size
= sizeof(WINHELP
) + nlen
+ dsize
;
152 hwh
= GlobalAlloc16(0,size
);
153 lpwh
= GlobalLock16(hwh
);
155 lpwh
->command
= wCommand
;
157 lpwh
->ofsFilename
= sizeof(WINHELP
);
158 strcpy(((char*)lpwh
) + sizeof(WINHELP
),lpHelpFile
);
161 memcpy(((char*)lpwh
)+sizeof(WINHELP
)+nlen
,data
,dsize
);
162 lpwh
->ofsData
= sizeof(WINHELP
)+nlen
;
166 return SendMessage16(hDest
,WM_WINHELP
,hWnd
,hwh
);