Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1402 lines
45 KiB

  1. /*++
  2. *
  3. * WOW v1.0
  4. *
  5. * Copyright (c) 1991, Microsoft Corporation
  6. *
  7. * WUDLG.C
  8. * WOW32 16-bit User API support
  9. *
  10. * History:
  11. * Created 07-Mar-1991 by Jeff Parsons (jeffpar)
  12. --*/
  13. #include "precomp.h"
  14. #pragma hdrstop
  15. MODNAME(wudlg.c);
  16. // SendDlgItemMessage cache
  17. extern HWND hdlgSDIMCached ;
  18. /*++
  19. void CheckDlgButton(<hDlg>, <nIDButton>, <wCheck>)
  20. HWND <hDlg>;
  21. int <nIDButton>;
  22. WORD <wCheck>;
  23. The %CheckDlgButton% function places a checkmark next to or removes a
  24. checkmark from a button control, or changes the state of a three-state
  25. button. The %CheckDlgButton% function sends a BM_SETCHECK message to the
  26. button control that has the specified ID in the given dialog box.
  27. <hDlg>
  28. Identifies the dialog box that contains the button.
  29. <nIDButton>
  30. Specifies the button control to be modified.
  31. <wCheck>
  32. Specifies the action to take. If the <wCheck> parameter is
  33. nonzero, the %CheckDlgButton% function places a checkmark next to the
  34. button; if zero, the checkmark is removed. For three-state buttons, if
  35. <wCheck> is 2, the button is grayed; if <wCheck> is 1, it is checked; if
  36. <wCheck> is 0, the checkmark is removed.
  37. This function does not return a value.
  38. --*/
  39. ULONG FASTCALL WU32CheckDlgButton(PVDMFRAME pFrame)
  40. {
  41. register PCHECKDLGBUTTON16 parg16;
  42. GETARGPTR(pFrame, sizeof(CHECKDLGBUTTON16), parg16);
  43. CheckDlgButton(
  44. HWND32(parg16->f1),
  45. WORD32(parg16->f2),
  46. WORD32(parg16->f3)
  47. );
  48. FREEARGPTR(parg16);
  49. RETURN(0);
  50. }
  51. /*++
  52. void CheckRadioButton(<hDlg>, <nIDFirstButton>, <nIDLastButton>,
  53. <nIDCheckButton>)
  54. HWND <hDlg>;
  55. int <nIDFirstButton>;
  56. int <nIDLastButton>;
  57. int <nIDCheckButton>;
  58. The %CheckRadioButton% function checks the radio button specified by the
  59. <nIDCheckButton> parameter and removes the checkmark from all other radio
  60. buttons in the group of buttons specified by the <nIDFirstButton> and
  61. <nIDLastButton> parameters. The %CheckRadioButton% function sends a
  62. BM_SETCHECK message to the radio-button control that has the specified ID in
  63. the given dialog box.
  64. <hDlg>
  65. Identifies the dialog box.
  66. <nIDFirstButton>
  67. Specifies the integer identifier of the first radio button in the
  68. group.
  69. <nIDLastButton>
  70. Specifies the integer identifier of the last radio button in the
  71. group.
  72. <nIDCheckButton>
  73. Specifies the integer identifier of the radio button to be
  74. checked.
  75. This function does not return a value.
  76. --*/
  77. ULONG FASTCALL WU32CheckRadioButton(PVDMFRAME pFrame)
  78. {
  79. register PCHECKRADIOBUTTON16 parg16;
  80. GETARGPTR(pFrame, sizeof(CHECKRADIOBUTTON16), parg16);
  81. CheckRadioButton(
  82. HWND32(parg16->f1),
  83. WORD32(parg16->f2),
  84. WORD32(parg16->f3),
  85. WORD32(parg16->f4)
  86. );
  87. FREEARGPTR(parg16);
  88. RETURN(0);
  89. }
  90. //***************************************************************************
  91. // HWND WINAPI CreateDialog(HINSTANCE, LPCSTR, HWND, DLGPROC);
  92. // HWND WINAPI CreateDialogIndirect(HINSTANCE, const void FAR*, HWND, DLGPROC);
  93. // HWND WINAPI CreateDialogParam(HINSTANCE, LPCSTR, HWND, DLGPROC, LPARAM);
  94. // HWND WINAPI CreateDialogIndirectParam(HINSTANCE, const void FAR*, HWND, DLGPROC, LPARAM);
  95. //
  96. // int WINAPI DialogBox(HINSTANCE, LPCSTR, HWND, DLGPROC);
  97. // int WINAPI DialogBoxIndirect(HINSTANCE, HGLOBAL, HWND, DLGPROC);
  98. // int WINAPI DialogBoxParam(HINSTANCE, LPCSTR, HWND, DLGPROC, LPARAM);
  99. // int WINAPI DialogBoxIndirectParam(HINSTANCE, HGLOBAL, HWND, DLGPROC, LPARAM);
  100. //
  101. // This is a common entry point for all the apis above. We distinguish
  102. // between 'create' and 'dialogbox' apis by a bool flag (parg16->f7).
  103. // TRUE implies 'dialogbox' apis else 'create' apis.
  104. //
  105. // - nanduri
  106. //***************************************************************************
  107. ULONG FASTCALL WU32DialogBoxParam(PVDMFRAME pFrame)
  108. {
  109. ULONG ul=(ULONG)-1;
  110. PVOID pDlg;
  111. DWORD cb, cb16;
  112. register PDIALOGBOXPARAM16 parg16;
  113. BYTE abT[1024];
  114. WNDPROC vpDlgProc = NULL;
  115. GETARGPTR(pFrame, sizeof(DIALOGBOXPARAM16), parg16);
  116. if (DWORD32(parg16->f4)) {
  117. // mark the proc as WOW proc and save the high bits in the RPL
  118. MarkWOWProc (parg16->f4,vpDlgProc);
  119. }
  120. if (!(cb16 = parg16->f6)) {
  121. cb = ConvertDialog16(NULL, DWORD32(parg16->f2), 0, cb16);
  122. }
  123. else {
  124. // The idea is eliminate a call to ConverDialog16
  125. //
  126. // the maximum size that 32bit dlgtemplate would be is twice
  127. // the 16bit dlgtemplate.
  128. //
  129. // this assumption is true cause - we convert most words to dwords
  130. // and ansi strings to unicode strings - since we know that a
  131. // DWORD is twice the sizeof a WORD a unicode character is 2bytes
  132. // therefore maxsize of dlgtemplate cannot exceed cb * 2.
  133. //
  134. // - nanduri
  135. cb = cb16 * max(sizeof(DWORD) / sizeof(WORD), sizeof(WCHAR)/sizeof(BYTE));
  136. WOW32ASSERT(cb >= ConvertDialog16(NULL, DWORD32(parg16->f2), 0, cb16));
  137. }
  138. pDlg = (cb > sizeof(abT)) ? malloc_w(cb) : (PVOID)abT;
  139. if (cb && pDlg) {
  140. cb = ConvertDialog16(pDlg, DWORD32(parg16->f2), cb, cb16);
  141. if (parg16->f7) {
  142. ul = GETINT16(DialogBoxIndirectParamAorW(HMODINST32(parg16->f1),
  143. pDlg, HWND32(parg16->f3),
  144. vpDlgProc,
  145. (LPARAM) DWORD32(parg16->f5), SCDLG_ANSI));
  146. }
  147. else {
  148. ul = GETHWND16((pfnOut.pfnServerCreateDialog)(HMODINST32(parg16->f1), (LPDLGTEMPLATE)pDlg,
  149. cb, HWND32(parg16->f3),
  150. vpDlgProc,
  151. (LPARAM) DWORD32(parg16->f5), SCDLG_CLIENT | SCDLG_ANSI | SCDLG_NOREVALIDATE));
  152. }
  153. if (pDlg != (PVOID)abT) {
  154. free_w (pDlg);
  155. }
  156. }
  157. // Invalidate SendDlgItemMessage cache
  158. hdlgSDIMCached = NULL ;
  159. FREEARGPTR(parg16);
  160. RETURN(ul);
  161. }
  162. /*++
  163. int DlgDirList(<hDlg>, <lpPathSpec>, <nIDListBox>, <nIDStaticPath>,
  164. <wFiletype>)
  165. HWND <hDlg>;
  166. LPSTR <lpPathSpec>;
  167. int <nIDListBox>;
  168. int <nIDStaticPath>;
  169. WORD <wFiletype>;
  170. The %DlgDirList% function fills a list-box control with a file or directory
  171. listing. It fills the list box specified by the <nIDListBox> parameter with
  172. the names of all files matching the pathname given by the <lpPathSpec>
  173. parameter.
  174. The %DlgDirList% function shows subdirectories enclosed in square brackets
  175. ([ ]), and shows drives in the form [-<x>-], where <x> is the drive letter.
  176. The <lpPathSpec> parameter has the following form:
  177. [drive:] [ [\u]directory[\idirectory]...\u] [filename]
  178. In this example, <drive> is a drive letter, <directory> is a valid directory
  179. name, and <filename> is a valid filename that must contain at least one
  180. wildcard character. The wildcard characters are a question mark (?), meaning
  181. match any character, and an asterisk (*), meaning match any number of
  182. characters.
  183. If the <lpPathSpec> parameter includes a drive and/or directory name, the
  184. current drive and directory are changed to the designated drive and
  185. directory before the list box is filled. The text control identified by the
  186. <nIDStaticPath> parameter is also updated with the new drive and/or
  187. directory name.
  188. After the list box is filled, <lpPathSpec> is updated by removing the drive
  189. and/or directory portion of the pathname.
  190. %DlgDirList% sends LB_RESETCONTENT and LB_DIR messages to the list box.
  191. <hDlg>
  192. Identifies the dialog box that contains the list box.
  193. <lpPathSpec>
  194. Points to a pathname string. The string must be a
  195. null-terminated character string.
  196. <nIDListBox>
  197. Specifies the identifier of a list-box control. If <nIDListBox> is
  198. zero, %DlgDirList% assumes that no list box exists and does not attempt
  199. to fill it.
  200. <nIDStaticPath>
  201. Specifies the identifier of the static-text control used for
  202. displaying the current drive and directory. If <nIDStaticPath> is zero,
  203. %DlgDirList% assumes that no such text control is present.
  204. <wFiletype>
  205. Specifies the attributes of the files to be displayed. It can be any
  206. combination of the following values:
  207. 0x0000
  208. Read/write data files with no additional attributes
  209. 0x0001
  210. Read-only files
  211. 0x0002
  212. Hidden files
  213. 0x0004
  214. System files
  215. 0x0010
  216. Subdirectories
  217. 0x0020
  218. Archives
  219. 0x2000
  220. LB_DIR flag. If the LB_DIR flag is set, Windows places the messages
  221. generated by %DlgDirList% in the application's queue; otherwise they are
  222. sent directly to the dialog function.
  223. 0x4000
  224. Drives
  225. 0x8000
  226. Exclusive bit. If the exclusive bit is set, only files of the specified
  227. type are listed. Otherwise, files of the specified type are listed in
  228. addition to normal files.
  229. The return value specifies the outcome of the function. It is nonzero if a
  230. listing was made, even an empty listing. A zero return value implies that
  231. the input string did not contain a valid search path.
  232. The <wFiletype> parameter specifies the DOS attributes of the files to be
  233. listed. Table 4.6 describes these attributes.
  234. --*/
  235. ULONG FASTCALL WU32DlgDirList(PVDMFRAME pFrame)
  236. {
  237. ULONG ul;
  238. PSZ psz2;
  239. register PDLGDIRLIST16 parg16;
  240. UpdateDosCurrentDirectory(DIR_DOS_TO_NT);
  241. GETARGPTR(pFrame, sizeof(DLGDIRLIST16), parg16);
  242. GETPSZPTR(parg16->f2, psz2);
  243. //
  244. // KidPix passes an invalid filetype flag (0x1000) that Win3.1 doesn't
  245. // check for. Win32 does, and fails the API, so mask that flag off here.
  246. // John Vert (jvert) 11-Jun-1993
  247. //
  248. ul = GETINT16(DlgDirList(
  249. HWND32(parg16->f1),
  250. psz2,
  251. WORD32(parg16->f3),
  252. WORD32(parg16->f4),
  253. WORD32(parg16->f5) & DDL_VALID
  254. ));
  255. UpdateDosCurrentDirectory(DIR_NT_TO_DOS);
  256. FREEPSZPTR(psz2);
  257. FREEARGPTR(parg16);
  258. RETURN(ul);
  259. }
  260. /*++
  261. int DlgDirListComboBox(<hDlg>, <lpPathSpec>, <nIDComboBox>, <nIDStaticPath>,
  262. <wFiletype>)
  263. HWND <hDlg>;
  264. LPSTR <lpPathSpec>;
  265. int <nIDComboBox>;
  266. int <nIDStaticPath>;
  267. WORD <wFiletype>;
  268. The %DlgDirListComboBox% function fills the list box of a combo-box control
  269. with a file or directory listing. It fills the list box of the combo box
  270. specified by the <nIDComboBox> parameter with the names of all files
  271. matching the pathname given by the <lpPathSpec> parameter.
  272. The %DlgDirListComboBox% function shows subdirectories enclosed in square
  273. brackets ([ ]), and shows drives in the form [-<x>-], where <x> is the drive
  274. letter.
  275. The <lpPathSpec> parameter has the following form:
  276. [drive:] [ [\u]directory[\idirectory]...\u] [filename]
  277. In this example, <drive> is a drive letter, <directory> is a valid directory
  278. name, and <filename> is a valid filename that must contain at least one
  279. wildcard character. The wildcard characters are a question mark (?), meaning
  280. match any character, and an asterisk (*), meaning match any number of
  281. characters.
  282. If the <lpPathSpec> parameter includes a drive and/or directory name, the
  283. current drive and directory are changed to the designated drive and
  284. directory before the list box is filled. The text control identified by the
  285. <nIDStaticPath> parameter is also updated with the new drive and/or
  286. directory name.
  287. After the combo-box list box is filled, <lpPathSpec> is updated by removing
  288. the drive and/or directory portion of the pathname.
  289. %DlgDirListComboBox% sends CB_RESETCONTENT and CB_DIR messages to the combo
  290. box.
  291. <hDlg>
  292. Identifies the dialog box that contains the combo box.
  293. <lpPathSpec>
  294. Points to a pathname string. The string must be a
  295. null-terminated string.
  296. <nIDComboBox>
  297. Specifies the identifier of a combo-box control in a dialog box.
  298. If <nIDComboBox> is zero, %DlgDirListComboBox% assumes that no combo box
  299. exists and does not attempt to fill it.
  300. <nIDStaticPath>
  301. Specifies the identifier of the static-text control used for
  302. displaying the current drive and directory. If <nIDStaticPath> is zero,
  303. %DlgDirListComboBox% assumes that no such text control is present.
  304. <wFiletype>
  305. Specifies DOS file attributes of the files to be displayed. It
  306. can be any combination of the following values:
  307. The return value specifies the outcome of the function. It is nonzero if a
  308. listing was made, even an empty listing. A zero return value implies that
  309. the input string did not contain a valid search path.
  310. --*/
  311. ULONG FASTCALL WU32DlgDirListComboBox(PVDMFRAME pFrame)
  312. {
  313. ULONG ul;
  314. PSZ psz2;
  315. register PDLGDIRLISTCOMBOBOX16 parg16;
  316. UpdateDosCurrentDirectory(DIR_DOS_TO_NT);
  317. GETARGPTR(pFrame, sizeof(DLGDIRLISTCOMBOBOX16), parg16);
  318. GETPSZPTR(parg16->f2, psz2);
  319. ul = GETINT16(DlgDirListComboBox(
  320. HWND32(parg16->f1),
  321. psz2,
  322. WORD32(parg16->f3),
  323. WORD32(parg16->f4),
  324. WORD32(parg16->f5)
  325. ));
  326. UpdateDosCurrentDirectory(DIR_NT_TO_DOS);
  327. FREEPSZPTR(psz2);
  328. FREEARGPTR(parg16);
  329. RETURN(ul);
  330. }
  331. /*++
  332. BOOL DlgDirSelectEx(<hDlg>, <lpString>, <nIDListBox>)
  333. HWND <hDlg>;
  334. LPSTR <lpString>;
  335. int <nIDListBox>;
  336. The %DlgDirSelectEx% function retrieves the current selection from a list
  337. box. It assumes that the list box has been filled by the %DlgDirList%
  338. function and that the selection is a drive letter, a file, or a directory
  339. name.
  340. The %DlgDirSelectEx% function copies the selection to the buffer given by the
  341. <lpString> parameter. If the current selection is a directory name or drive
  342. letter, %DlgDirSelectEx% removes the enclosing square brackets (and hyphens,
  343. for drive letters) so that the name or letter is ready to be inserted into a
  344. new pathname. If there is no selection, <lpString> does not change.
  345. %DlgDirSelectEx% sends LB_GETCURSEL and LB_GETTEXT messages to the list box.
  346. <hDlg>
  347. Identifies the dialog box that contains the list box.
  348. <lpString>
  349. Points to a buffer that is to receive the selected pathname.
  350. <nIDListBox>
  351. Specifies the integer ID of a list-box control in the dialog box.
  352. The return value specifies the status of the current list-box selection. It
  353. is TRUE if the current selection is a directory name. Otherwise, it is
  354. FALSE.
  355. The %DlgDirSelectEx% function does not allow more than one filename to be
  356. returned from a list box.
  357. The list box must not be a multiple-selection list box. If it is, this
  358. function will not return a zero value and <lpString> will remain unchanged.
  359. --*/
  360. ULONG FASTCALL WU32DlgDirSelect(PVDMFRAME pFrame)
  361. {
  362. ULONG ul;
  363. PSZ psz2;
  364. VPVOID vp;
  365. register PDLGDIRSELECT16 parg16;
  366. GETARGPTR(pFrame, sizeof(DLGDIRSELECT16), parg16);
  367. ALLOCVDMPTR(parg16->f2, MAX_VDMFILENAME, psz2);
  368. vp = parg16->f2;
  369. ul = GETBOOL16(DlgDirSelectEx(
  370. HWND32(parg16->f1),
  371. psz2,
  372. SIZE_BOGUS,
  373. WORD32(parg16->f3)
  374. ));
  375. // special case to keep common dialog structs in sync (see wcommdlg.c)
  376. Check_ComDlg_pszptr(CURRENTPTD()->CommDlgTd, vp);
  377. FLUSHVDMPTR(parg16->f2, strlen(psz2)+1, psz2);
  378. FREEVDMPTR(psz2);
  379. FREEARGPTR(parg16);
  380. RETURN(ul);
  381. }
  382. /*++
  383. BOOL DlgDirSelectComboBoxEx(<hDlg>, <lpString>, <nIDComboBox>)
  384. HWND <hDlg>;
  385. LPSTR <lpString>;
  386. int <nIDComboBox>;
  387. The %DlgDirSelectComboBoxEx% function retrieves the current selection from the
  388. list box of a combo box created with the CBS_SIMPLE style. It cannot be used
  389. with combo boxes created with either the CBS_DROPDOWN or CBS_DROPDOWNLIST
  390. style. It assumes that the list box has been filled by the
  391. %DlgDirListComboBox% function and that the selection is a drive letter, a
  392. file, or a directory name.
  393. The %DlgDirSelectComboBoxEx% function copies the selection to the buffer given
  394. by the <lpString> parameter. If the current selection is a directory name or
  395. drive letter, %DlgDirSelectComboBoxEx% removes the enclosing square brackets
  396. (and hyphens, for drive letters) so that the name or letter is ready to be
  397. inserted into a new pathname. If there is no selection, <lpString> does not
  398. change.
  399. %DlgDirSelectComboBoxEx% sends CB_GETCURSEL and CB_GETLBTEXT messages to the
  400. combo box.
  401. <hDlg>
  402. Identifies the dialog box that contains the combo box.
  403. <lpString>
  404. Points to a buffer that is to receive the selected pathname.
  405. <nIDComboBox>
  406. Specifies the integer ID of the combo-box control in the dialog
  407. box.
  408. The return value specifies the status of the current combo-box selection. It
  409. is TRUE if the current selection is a directory name. Otherwise, it is
  410. FALSE.
  411. The %DlgDirSelectComboBoxEx% function does not allow more than one filename to
  412. be returned from a combo box.
  413. --*/
  414. ULONG FASTCALL WU32DlgDirSelectComboBox(PVDMFRAME pFrame)
  415. {
  416. ULONG ul;
  417. PSZ psz2;
  418. VPVOID vp;
  419. register PDLGDIRSELECTCOMBOBOX16 parg16;
  420. GETARGPTR(pFrame, sizeof(DLGDIRSELECTCOMBOBOX16), parg16);
  421. ALLOCVDMPTR(parg16->f2, MAX_VDMFILENAME, psz2);
  422. vp = parg16->f2;
  423. ul = GETBOOL16(DlgDirSelectComboBoxEx(
  424. HWND32(parg16->f1),
  425. psz2,
  426. SIZE_BOGUS,
  427. WORD32(parg16->f3)
  428. ));
  429. // special case to keep common dialog structs in sync (see wcommdlg.c)
  430. Check_ComDlg_pszptr(CURRENTPTD()->CommDlgTd, vp);
  431. FLUSHVDMPTR(parg16->f2, strlen(psz2)+1, psz2);
  432. FREEVDMPTR(psz2);
  433. FREEARGPTR(parg16);
  434. RETURN(ul);
  435. }
  436. /*++
  437. void EndDialog(<hDlg>, <nResult>)
  438. HWND <hDlg>;
  439. int <nResult>;
  440. The %EndDialog% function terminates a modal dialog box and returns the given
  441. result to the %DialogBox% function that created the dialog box. The
  442. %EndDialog% function is required to complete processing whenever the
  443. %DialogBox% function is used to create a modal dialog box. The function must
  444. be used in the dialog function of the modal dialog box and should not be
  445. used for any other purpose.
  446. The dialog function can call %EndDialog% at any time, even during the
  447. processing of the WM_INITDIALOG message. If called during the WM_INITDIALOG
  448. message, the dialog box is terminated before it is shown or before the input
  449. focus is set.
  450. %EndDialog% does not terminate the dialog box immediately. Instead, it sets
  451. a flag that directs the dialog box to terminate as soon as the dialog
  452. function ends. The %EndDialog% function returns to the dialog function, so
  453. the dialog function must return control to Windows.
  454. <hDlg>
  455. Identifies the dialog box to be destroyed.
  456. <nResult>
  457. Specifies the value to be returned from the dialog box to the
  458. %DialogBox% function that created it.
  459. This function does not return a value.
  460. --*/
  461. ULONG FASTCALL WU32EndDialog(PVDMFRAME pFrame)
  462. {
  463. HWND hwnd;
  464. register PENDDIALOG16 parg16;
  465. GETARGPTR(pFrame, sizeof(ENDDIALOG16), parg16);
  466. hwnd = HWND32(parg16->f1);
  467. if(!EndDialog(hwnd, INT32(parg16->f2)) && IsWindow(hwnd)){
  468. CHAR szType[8];
  469. if(GetLastError() == ERROR_WINDOW_NOT_DIALOG ||
  470. (RealGetWindowClass(hwnd,szType,8) && WOW32_strnicmp(szType,"#32770",6))) {
  471. // jarbats
  472. // App is trying to close window created by CreateWindow
  473. // via EndDialog! whistler bug #231059
  474. DestroyWindow(hwnd);
  475. }
  476. }
  477. FREEARGPTR(parg16);
  478. RETURN(0);
  479. }
  480. /*++
  481. LONG GetDialogBaseUnits(VOID)
  482. The %GetDialogBaseUnits% function returns the dialog base units used by
  483. Windows when creating dialog boxes. An application should use these values
  484. to calculate the average width of characters in the system font.
  485. This function has no parameters.
  486. The return value specifies the dialog base units. The high-order word
  487. contains the height in pixels of the current dialog base height unit derived
  488. from the height of the system font, and the low-order word contains the
  489. width in pixels of the current dialog base width unit derived from the width
  490. of the system font.
  491. The values returned represent dialog base units before being scaled to
  492. actual dialog units. The actual dialog unit in the <x> direction is
  493. 1/4th of the width returned by %GetDialogBaseUnits%. The actual dialog
  494. unit in the <y> direction is 1/8th of the height returned by the
  495. function.
  496. To determine the actual height and width in pixels of a control, given the
  497. height (x) and width (y) in dialog units and the return value
  498. (lDlgBaseUnits) from calling %GetDialogBaseUnits%, use the following
  499. formula:
  500. (x * LOWORD(lDlgBaseUnits))/4
  501. (y * HIWORD(lDlgBaseUnits))/8
  502. To avoid rounding problems, perform the multiplication before the division
  503. in case the dialog base units are not evenly divisible by four.
  504. --*/
  505. ULONG FASTCALL WU32GetDialogBaseUnits(PVDMFRAME pFrame)
  506. {
  507. ULONG ul;
  508. UNREFERENCED_PARAMETER(pFrame);
  509. ul = GETLONG16(GetDialogBaseUnits());
  510. RETURN(ul);
  511. }
  512. /*++
  513. int GetDlgCtrlID(<hwnd>)
  514. HWND <hwnd>;
  515. The %GetDlgCtrlID% function returns the ID value of the child window
  516. identified by the <hwnd> parameter.
  517. <hwnd>
  518. Identifies the child window.
  519. The return value is the numeric identifier of the child window if the
  520. function is successful. If the function fails, or if <hwnd> is not a valid
  521. window handle, the return value is NULL.
  522. Since top-level windows do not have an ID value, the return value of this
  523. function is invalid if the <hwnd> parameter identifies a top-level window.
  524. --*/
  525. ULONG FASTCALL WU32GetDlgCtrlID(PVDMFRAME pFrame)
  526. {
  527. ULONG ul;
  528. register PGETDLGCTRLID16 parg16;
  529. GETARGPTR(pFrame, sizeof(GETDLGCTRLID16), parg16);
  530. ul = GETINT16(GetDlgCtrlID(
  531. HWND32(parg16->f1)
  532. ));
  533. FREEARGPTR(parg16);
  534. RETURN(ul);
  535. }
  536. /*++
  537. WORD GetDlgItemInt(<hDlg>, <nIDDlgItem>, <lpTranslated>, <bSigned>)
  538. HWND <hDlg>;
  539. int <nIDDlgItem>;
  540. BOOL FAR *<lpTranslated>;
  541. BOOL <bSigned>;
  542. The %GetDlgItemInt% function translates the text of a control in the given
  543. dialog box into an integer value. The %GetDlgItemInt% function retrieves the
  544. text of the control identified by the <nIDDlgItem> parameter. It translates
  545. the text by stripping any extra spaces at the beginning of the text and
  546. converting decimal digits, stopping the translation when it reaches the end
  547. of the text or encounters any nonnumeric character. If the <bSigned>
  548. parameter is TRUE, %GetDlgItemInt% checks for a minus sign (-) at the
  549. beginning of the text and translates the text into a signed number.
  550. Otherwise, it creates an unsigned value.
  551. %GetDlgItemInt% returns zero if the translated number is greater than 32,767
  552. (for signed numbers) or 65,535 (for unsigned). When errors occur, such as
  553. encountering nonnumeric characters and exceeding the given maximum,
  554. %GetDlgItemInt% copies zero to the location pointed to by the <lpTranslated>
  555. parameter. If there are no errors, <lpTranslated> receives a nonzero value.
  556. If <lpTranslated> is NULL, %GetDlgItemInt% does not warn about errors.
  557. %GetDlgItemInt% sends a WM_GETTEXT message to the control.
  558. <hDlg>
  559. Identifies the dialog box.
  560. <nIDDlgItem>
  561. Specifies the integer identifier of the dialog-box item to be
  562. translated.
  563. <lpTranslated>
  564. Points to the Boolean variable that is to receive the
  565. translated flag.
  566. <bSigned>
  567. Specifies whether the value to be retrieved is signed.
  568. The return value specifies the translated value of the dialog-box item text.
  569. Since zero is a valid return value, the <lpTranslated> parameter must be
  570. used to detect errors. If a signed return value is desired, it should be
  571. cast as an %int% type.
  572. --*/
  573. ULONG FASTCALL WU32GetDlgItemInt(PVDMFRAME pFrame)
  574. {
  575. ULONG ul;
  576. BOOL t3;
  577. register PGETDLGITEMINT16 parg16;
  578. GETARGPTR(pFrame, sizeof(GETDLGITEMINT16), parg16);
  579. ul = GETWORD16(GetDlgItemInt(
  580. HWND32(parg16->f1),
  581. WORD32(parg16->f2), // see comment in wu32getdlgitem
  582. &t3,
  583. BOOL32(parg16->f4)
  584. ));
  585. PUTBOOL16(parg16->f3, t3);
  586. FREEARGPTR(parg16);
  587. RETURN(ul);
  588. }
  589. /*++
  590. int GetDlgItemText(<hDlg>, <nIDDlgItem>, <lpString>, <nMaxCount>)
  591. HWND <hDlg>;
  592. int <nIDDlgItem>;
  593. LPSTR <lpString>;
  594. int <nMaxCount>;
  595. The %GetDlgItemText% function retrieves the caption or text associated with
  596. a control in a dialog box. The %GetDlgItemText% function copies the text to
  597. the location pointed to by the <lpString> parameter and returns a count of
  598. the number of characters it copies.
  599. %GetDlgItemText% sends a WM_GETTEXT message to the control.
  600. <hDlg>
  601. Identifies the dialog box that contains the control.
  602. <nIDDlgItem>
  603. Specifies the integer identifier of the dialog-box item whose
  604. caption or text is to be retrieved.
  605. <lpString>
  606. Points to the buffer to receive the text.
  607. <nMaxCount>
  608. Specifies the maximum length (in bytes) of the string to be copied
  609. to <lpString>. If the string is longer than <nMaxCount>, it is
  610. truncated.
  611. The return value specifies the actual number of characters copied to the
  612. buffer. It is zero if no text is copied.
  613. --*/
  614. ULONG FASTCALL WU32GetDlgItemText(PVDMFRAME pFrame)
  615. {
  616. ULONG ul;
  617. PSZ psz3;
  618. VPVOID vp;
  619. register PGETDLGITEMTEXT16 parg16;
  620. GETARGPTR(pFrame, sizeof(GETDLGITEMTEXT16), parg16);
  621. ALLOCVDMPTR(parg16->f3, parg16->f4, psz3);
  622. vp = parg16->f3;
  623. ul = GETINT16(GetDlgItemText(
  624. HWND32(parg16->f1),
  625. WORD32(parg16->f2), // see comment in wu32getdlgitem
  626. psz3,
  627. WORD32(parg16->f4)
  628. ));
  629. // special case to keep common dialog structs in sync (see wcommdlg.c)
  630. Check_ComDlg_pszptr(CURRENTPTD()->CommDlgTd, vp);
  631. FLUSHVDMPTR(parg16->f3, strlen(psz3)+1, psz3);
  632. FREEVDMPTR(psz3);
  633. FREEARGPTR(parg16);
  634. RETURN(ul);
  635. }
  636. /*++
  637. HWND GetNextDlgGroupItem(<hDlg>, <hCtl>, <bPrevious>)
  638. HWND <hDlg>;
  639. HWND <hCtl>;
  640. BOOL <bPrevious>;
  641. The %GetNextDlgGroupItem% function searches for the next (or previous)
  642. control within a group of controls in the dialog box identified by the
  643. <hDlg> parameter. A group of controls consists of one or more controls with
  644. WS_GROUP style.
  645. <hDlg>
  646. Identifies the dialog box being searched.
  647. <hCtl>
  648. Identifies the control in the dialog box where the search starts.
  649. <bPrevious>
  650. Specifies how the function is to search the group of controls in the
  651. dialog box. If the <bPrevious> parameter is zero, the function searches
  652. for the previous control in the group. If -<bPrevious> is TRUE, the
  653. function searches for the next control in the group.
  654. The return value identifies the next or previous control in the group.
  655. If the current item is the last item in the group and <bPrevious> is FALSE,
  656. the %GetNextDlgGroupItem% function returns the window handle of the first
  657. item in the group. If the current item is the first item in the group and
  658. <bPrevious> is TRUE, %GetNextDlgGroupItem% returns the window handle of the
  659. last item in the group.
  660. --*/
  661. ULONG FASTCALL WU32GetNextDlgGroupItem(PVDMFRAME pFrame)
  662. {
  663. ULONG ul;
  664. register PGETNEXTDLGGROUPITEM16 parg16;
  665. GETARGPTR(pFrame, sizeof(GETNEXTDLGGROUPITEM16), parg16);
  666. ul = GETHWND16(GetNextDlgGroupItem(HWND32(parg16->f1),
  667. HWND32(parg16->f2),
  668. BOOL32(parg16->f3)));
  669. FREEARGPTR(parg16);
  670. RETURN(ul);
  671. }
  672. /*++
  673. HWND GetNextDlgTabItem(<hDlg>, <hCtl>, <bPrevious>)
  674. HWND <hDlg>;
  675. HWND <hCtl>;
  676. BOOL <bPrevious>;
  677. The %GetNextDlgTabItem% function obtains the handle of the first control
  678. that has the WS_TABSTOP style that precedes (or follows) the control
  679. identified by the <hCtl> parameter.
  680. <hDlg>
  681. Identifies the dialog box being searched.
  682. <hCtl>
  683. Identifies the control to be used as a starting point for the
  684. search.
  685. <bPrevious>
  686. Specifies how the function is to search the dialog box. If the
  687. <bPrevious> parameter is FALSE, the function searches for the previous
  688. control in the dialog box. If <bPrevious> is TRUE, the function searches
  689. for the next control in the dialog box. Identifies the control to be
  690. used as a starting point for the search.
  691. The return value identifies the previous (or next) control that has the
  692. WS_TABSTOP style set.
  693. --*/
  694. ULONG FASTCALL WU32GetNextDlgTabItem(PVDMFRAME pFrame)
  695. {
  696. ULONG ul;
  697. register PGETNEXTDLGTABITEM16 parg16;
  698. GETARGPTR(pFrame, sizeof(GETNEXTDLGTABITEM16), parg16);
  699. ul = GETHWND16(GetNextDlgTabItem(HWND32(parg16->f1),
  700. HWND32(parg16->f2),
  701. BOOL32(parg16->f3)));
  702. FREEARGPTR(parg16);
  703. RETURN(ul);
  704. }
  705. /*++
  706. BOOL IsDialogMessage(<hDlg>, <lpMsg>)
  707. HWND <hDlg>;
  708. LPMSG <lpMsg>;
  709. The %IsDialogMessage% function determines whether the given message is
  710. intended for the modeless dialog box specified by the <hDlg> parameter, and
  711. automatically processes the message if it is. When the %IsDialogMessage%
  712. function processes a message, it checks for keyboard messages and converts
  713. them into selection commands for the corresponding dialog box. For example,
  714. the ^TAB^ key selects the next control or group of controls, and the ^DOWN^
  715. key selects the next control in a group.
  716. If a message is processed by %IsDialogMessage%, it must not be passed to the
  717. %TranslateMessage% or %DispatchMessage% function. This is because
  718. %IsDialogMessage% performs all necessary translating and dispatching of
  719. messages.
  720. %IsDialogMessage% sends WM_GETDLGCODE messages to the dialog function to
  721. determine which keys should be processed.
  722. <hDlg>
  723. Identifies the dialog box.
  724. <lpMsg>
  725. Points to an %MSG% structure that contains the message to
  726. be checked.
  727. The return value specifies whether or not the given message has been
  728. processed. It is TRUE if the message has been processed. Otherwise, it is
  729. FALSE.
  730. Although %IsDialogMessage% is intended for modeless dialog boxes, it can be
  731. used with any window that contains controls to provide the same keyboard
  732. selection as in a dialog box.
  733. --*/
  734. ULONG FASTCALL WU32IsDialogMessage(PVDMFRAME pFrame)
  735. {
  736. ULONG ul;
  737. MSG t2;
  738. register PISDIALOGMESSAGE16 parg16;
  739. MSGPARAMEX mpex;
  740. PMSG16 pMsg16;
  741. GETARGPTR(pFrame, sizeof(ISDIALOGMESSAGE16), parg16);
  742. GETMISCPTR(parg16->f2, pMsg16);
  743. mpex.Parm16.WndProc.hwnd = pMsg16->hwnd;
  744. mpex.Parm16.WndProc.wMsg = pMsg16->message;
  745. mpex.Parm16.WndProc.wParam = pMsg16->wParam;
  746. mpex.Parm16.WndProc.lParam = pMsg16->lParam;
  747. mpex.iMsgThunkClass = WOWCLASS_WIN16;
  748. ThunkMsg16(&mpex);
  749. GETFRAMEPTR(((PTD)CURRENTPTD())->vpStack, pFrame);
  750. GETARGPTR(pFrame, sizeof(ISDIALOGMESSAGE16), parg16);
  751. t2.message = mpex.uMsg;
  752. t2.wParam = mpex.uParam;
  753. t2.lParam = mpex.lParam;
  754. t2.hwnd = HWND32(FETCHWORD(pMsg16->hwnd));
  755. t2.time = FETCHLONG(pMsg16->time);
  756. t2.pt.x = FETCHSHORT(pMsg16->pt.x);
  757. t2.pt.y = FETCHSHORT(pMsg16->pt.y);
  758. ul = GETBOOL16(IsDialogMessage(
  759. HWND32(parg16->f1),
  760. &t2
  761. ));
  762. if (MSG16NEEDSTHUNKING(&mpex)) {
  763. mpex.uMsg = t2.message;
  764. mpex.uParam = t2.wParam;
  765. mpex.lParam = t2.lParam;
  766. (mpex.lpfnUnThunk16)(&mpex);
  767. }
  768. FREEARGPTR(parg16);
  769. RETURN(ul);
  770. }
  771. /*++
  772. WORD IsDlgButtonChecked(<hDlg>, <nIDButton>)
  773. HWND <hDlg>;
  774. int <nIDButton>;
  775. The %IsDlgButtonChecked% function determines whether a button control has a
  776. checkmark next to it, and whether a three-state button control is grayed,
  777. checked, or neither. The %IsDlgButtonChecked% function sends a BM_GETCHECK
  778. message to the button control.
  779. <hDlg>
  780. Identifies the dialog box that contains the button control.
  781. <nIDButton>
  782. Specifies the integer identifier of the button control.
  783. The return value specifies the outcome of the function. It is nonzero if the
  784. given control has a checkmark next to it. Otherwise, it is zero. For
  785. three-state buttons, the return value is 2 if the button is grayed, 1 if the
  786. button has a checkmark next to it, and zero otherwise.
  787. --*/
  788. ULONG FASTCALL WU32IsDlgButtonChecked(PVDMFRAME pFrame)
  789. {
  790. ULONG ul;
  791. register PISDLGBUTTONCHECKED16 parg16;
  792. GETARGPTR(pFrame, sizeof(ISDLGBUTTONCHECKED16), parg16);
  793. ul = GETWORD16(IsDlgButtonChecked(
  794. HWND32(parg16->f1),
  795. WORD32(parg16->f2)
  796. ));
  797. FREEARGPTR(parg16);
  798. RETURN(ul);
  799. }
  800. /*++
  801. void MapDialogRect(<hDlg>, <lpRect>)
  802. HDLG <hDlg>;
  803. LPRECT <lpRect>;
  804. The %MapDialogRect% function converts the dialog-box units given in the
  805. <lpRect> parameter to screen units. Dialog-box units are stated in terms of
  806. the current dialog base unit derived from the average width and height of
  807. characters in the system font. One horizontal unit is one-fourth of the
  808. dialog base width unit, and one vertical unit is one-eighth of the dialog
  809. base height unit. The %GetDialogBaseUnits% function returns the dialog base
  810. units in pixels.
  811. The %MapDialogRect% function replaces the dialog-box units in <lpRect> with
  812. screen units (pixels), so that the rectangle can be used to create a dialog
  813. box or position a control within a box.
  814. <hDlg>
  815. Identifies a dialog box.
  816. <lpRect>
  817. Points to a %RECT% structure that contains the dialog-box
  818. coordinates to be converted.
  819. This function does not return a value.
  820. The <hDlg> parameter must be created by using the %CreateDialog% or
  821. %DialogBox% function.
  822. --*/
  823. ULONG FASTCALL WU32MapDialogRect(PVDMFRAME pFrame)
  824. {
  825. RECT t2;
  826. register PMAPDIALOGRECT16 parg16;
  827. GETARGPTR(pFrame, sizeof(MAPDIALOGRECT16), parg16);
  828. WOW32VERIFY(GETRECT16(parg16->f2, &t2));
  829. MapDialogRect(
  830. HWND32(parg16->f1),
  831. &t2
  832. );
  833. PUTRECT16(parg16->f2, &t2);
  834. FREEARGPTR(parg16);
  835. RETURN(0);
  836. }
  837. /*++
  838. int MessageBox(<hwndParent>, <lpText>, <lpCaption>, <wType>)
  839. HWND <hwndParent>;
  840. LPSTR <lpText>;
  841. LPSTR <lpCaption>;
  842. WORD <wType>;
  843. The %MessageBox% function creates and displays a window that contains an
  844. application-supplied message and caption, plus any combination of the
  845. predefined icons and push buttons described in the following list.
  846. <hwndParent>
  847. Identifies the window that owns the message box.
  848. <lpText>
  849. Points to a null-terminated string containing the message to be
  850. displayed.
  851. <lpCaption>
  852. Points to a null-terminated string to be used for the dialog-box
  853. caption. If the <lpCaption> parameter is NULL, the default caption Error
  854. is used.
  855. <wType>
  856. Specifies the contents of the dialog box. It can be any
  857. combination of the following values:
  858. MB_ABORTRETRYIGNORE
  859. Message box contains three push buttons: Abort, Retry, and Ignore.
  860. MB_APPLMODAL
  861. The user must respond to the message box before continuing work in the
  862. window identified by the <hwndParent> parameter. However, the user can
  863. move to the windows of other applications and work in those windows.
  864. MB_APPLMODAL is the default if neither MB_SYSTEMMODAL nor MB_TASKMODAL
  865. are specified.
  866. MB_DEFBUTTON1
  867. First button is the default. Note that the first button is always the
  868. default unless MB_DEFBUTTON2 or MB_DEFBUTTON3 is specified.
  869. MB_DEFBUTTON2
  870. Second button is the default.
  871. MB_DEFBUTTON3
  872. Third button is the default.
  873. MB_ICONASTERISK
  874. Same as MB_ICONINFORMATION.
  875. MB_ICONEXCLAMATION
  876. An exclamation-point icon appears in the message box.
  877. MB_ICONHAND
  878. Same as MB_ICONSTOP.
  879. MB_ICONINFORMATION
  880. An icon consisting of a lowercase i in a circle appears in the message
  881. box.
  882. MB_ICONQUESTION
  883. A question-mark icon appears in the message box.
  884. MB_ICONSTOP
  885. A stop sign icon appears in the message box.
  886. MB_OK
  887. Message box contains one push button: OK.
  888. MB_OKCANCEL
  889. Message box contains two push buttons: OK and Cancel.
  890. MB_RETRYCANCEL
  891. Message box contains two push buttons: Retry and Cancel.
  892. MB_SYSTEMMODAL
  893. All applications are suspended until the user responds to the message
  894. box. Unless the application specifies MB_ICONHAND, the message box does
  895. not become modal until after it is created; consequently, the parent
  896. window and other windows continue to receive messages resulting from its
  897. activation. System-modal message boxes are used to notify the user of
  898. serious, potentially damaging errors that require immediate attention
  899. (for example, running out of memory).
  900. MB_TASKMODAL
  901. Same as MB_APPMODAL except that all the top-level windows belonging to
  902. the current task are disabled if the <hwndOwner> parameter is NULL. This
  903. flag should be used when the calling application or library does not
  904. have a window handle available, but still needs to prevent input to
  905. other windows in the current application without suspending other
  906. applications.
  907. MB_YESNO
  908. Message box contains two push buttons: Yes and No.
  909. MB_YESNOCANCEL
  910. Message box contains three push buttons: Yes, No, and Cancel.
  911. The return value specifies the outcome of the function. It is zero if there
  912. is not enough memory to create the message box. Otherwise, it is one of the
  913. following menu-item values returned by the dialog box:
  914. IDABORT Abort button pressed.
  915. IDCANCEL Cancel button pressed.
  916. IDIGNORE Ignore button pressed.
  917. IDNO No button pressed.
  918. IDOK OK button pressed.
  919. IDRETRY Retry button pressed.
  920. IDYES Yes button pressed.
  921. If a message box has a Cancel button, the IDCANCEL value will be returned if
  922. either the ^ESCAPE^ key or Cancel button is pressed. If the message box has
  923. no Cancel button, pressing the ^ESCAPE^ key has no effect.
  924. When a system-modal message box is created to indicate that the system is
  925. low on memory, the strings passed as the <lpText> and <lpCaption> parameters
  926. should not be taken from a resource file, since an attempt to load the
  927. resource may fail.
  928. When an application calls the %MessageBox% function and specifies the
  929. MB_ICONHAND and MB_SYSTEMMODAL flags for the <wType> parameter, Windows will
  930. display the resulting message box regardless of available memory. When these
  931. flags are specified, Windows limits the length of the message-box text to
  932. one line.
  933. If a message box is created while a dialog box is present, use the handle of
  934. the dialog box as the <hwndParent> parameter. The <hwndParent> parameter
  935. should not identify a child window, such as a dialog-box control.
  936. --*/
  937. ULONG FASTCALL WU32MessageBox(PVDMFRAME pFrame)
  938. {
  939. ULONG ul;
  940. UINT uType;
  941. PSZ psz2;
  942. PSZ psz3;
  943. register PMESSAGEBOX16 parg16;
  944. GETARGPTR(pFrame, sizeof(MESSAGEBOX16), parg16);
  945. GETPSZPTR(parg16->f2, psz2);
  946. GETPSZPTR(parg16->f3, psz3);
  947. // WHISTLER RAID BUG #348251
  948. // A messagebox posted by artgalry.exe would remain behind autosketches window
  949. // after it was invoked. In order to move the messagebox to the foreground we
  950. // need to set its MB_SETFOREGROUND bit. Since this will be applied to all
  951. // 16bit MessageBox's we will only set this bit if the MessageBox does not
  952. // have the MB_NOFOCUS bit. This fix works in conjunction with the
  953. // GACF2_GIVEUPFOREGROUND compat flag.
  954. uType = (UINT)parg16->f4;
  955. if(!(uType & MB_NOFOCUS))
  956. {
  957. uType |= MB_SETFOREGROUND;
  958. }
  959. ul = GETINT16(MessageBox(
  960. HWND32(parg16->f1),
  961. psz2,
  962. psz3,
  963. uType
  964. ));
  965. FREEPSZPTR(psz2);
  966. FREEPSZPTR(psz3);
  967. FREEARGPTR(parg16);
  968. RETURN(ul);
  969. }
  970. /*++
  971. void SetDlgItemInt(<hDlg>, <nIDDlgItem>, <wValue>, <bSigned>)
  972. HWND <hDlg>;
  973. int <nIDDlgItem>;
  974. WORD <wValue>;
  975. BOOL <bSigned>;
  976. The %SetDlgItemInt% function sets the text of a control in the given dialog
  977. box to the string that represents the integer value given by the <wValue>
  978. parameter. The %SetDlgItemInt% function converts <wValue> to a string that
  979. consists of decimal digits, and then copies the string to the control. If
  980. the <bSigned> parameter is TRUE, <wValue> is assumed to be signed. If
  981. <wValue> is signed and less than zero, the function places a minus sign
  982. before the first digit in the string.
  983. %SetDlgItemInt% sends a WM_SETTEXT message to the given control.
  984. <hDlg>
  985. Identifies the dialog box that contains the control.
  986. <nIDDlgItem>
  987. Specifies the control to be modified.
  988. <wValue>
  989. Specifies the value to be set.
  990. <bSigned>
  991. Specifies whether or not the integer value is signed.
  992. This function does not return a value.
  993. --*/
  994. ULONG FASTCALL WU32SetDlgItemInt(PVDMFRAME pFrame)
  995. {
  996. HWND hwnd;
  997. register PSETDLGITEMINT16 parg16;
  998. GETARGPTR(pFrame, sizeof(SETDLGITEMINT16), parg16);
  999. hwnd = HWND32(parg16->f1);
  1000. SetDlgItemInt(
  1001. hwnd,
  1002. WORD32(parg16->f2), // see comment in wu32getdlgitem
  1003. (parg16->f4) ? INT32(parg16->f3) : WORD32(parg16->f3),
  1004. BOOL32(parg16->f4)
  1005. );
  1006. FREEARGPTR(parg16);
  1007. RETURN(0);
  1008. }
  1009. /*++
  1010. void SetDlgItemText(<hDlg>, <nIDDlgItem>, <lpString>)
  1011. HWND <hDlg>;
  1012. int <nIDDlgItem>;
  1013. LPSTR <lpString>;
  1014. The %SetDlgItemText% function sets the caption or text of a control in the
  1015. dialog box specified by the <hDlg> parameter. The %SetDlgItemText% function
  1016. sends a WM_SETTEXT message to the given control.
  1017. <hDlg>
  1018. Identifies the dialog box that contains the control.
  1019. <nIDDlgItem>
  1020. Specifies the control whose text is to be set.
  1021. <lpString>
  1022. Points to the null-terminated string that is to be copied to the
  1023. control.
  1024. This function does not return a value.
  1025. --*/
  1026. ULONG FASTCALL WU32SetDlgItemText(PVDMFRAME pFrame)
  1027. {
  1028. HWND hwnd;
  1029. PSZ psz3;
  1030. register PSETDLGITEMTEXT16 parg16;
  1031. GETARGPTR(pFrame, sizeof(SETDLGITEMTEXT16), parg16);
  1032. GETPSZPTR(parg16->f3, psz3);
  1033. hwnd = HWND32(parg16->f1);
  1034. if (NULL != psz3) {
  1035. AddParamMap((DWORD)psz3, FETCHDWORD(parg16->f3));
  1036. }
  1037. SetDlgItemText(
  1038. hwnd,
  1039. WORD32(parg16->f2), // see comment in wu32getdlgitem
  1040. psz3
  1041. );
  1042. if (NULL != psz3) {
  1043. DeleteParamMap((DWORD)psz3, PARAM_32, NULL);
  1044. }
  1045. FREEPSZPTR(psz3);
  1046. FREEARGPTR(parg16);
  1047. RETURN(0);
  1048. }
  1049. /*++
  1050. No REF header file
  1051. --*/
  1052. ULONG FASTCALL WU32SysErrorBox(PVDMFRAME pFrame)
  1053. {
  1054. DWORD dwExitCode;
  1055. PSZ pszText;
  1056. PSZ pszCaption;
  1057. register PSYSERRORBOX16 parg16;
  1058. GETARGPTR(pFrame, sizeof(SYSERRORBOX16), parg16);
  1059. // WARNING - If things go wrong during boot, this routine can be called in
  1060. // real mode (v86 mode). So be very careful which GetPtr routines you
  1061. // use to convert from 16:16 to flat pointers
  1062. pszText = WOWGetVDMPointer(FETCHDWORD(parg16->vpszText),0,fWowMode);
  1063. pszCaption = WOWGetVDMPointer(FETCHDWORD(parg16->vpszCaption),0,fWowMode);
  1064. LOGDEBUG(5,(" SYSERRORBOX: %s\n", pszText));
  1065. dwExitCode = WOWSysErrorBox(
  1066. pszCaption,
  1067. pszText,
  1068. parg16->sBtn1,
  1069. parg16->sBtn2,
  1070. parg16->sBtn3
  1071. );
  1072. FREEPSZPTR(pszCaption);
  1073. FREEPSZPTR(pszText);
  1074. FREEARGPTR(parg16);
  1075. RETURN(dwExitCode);
  1076. }