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.

8113 lines
216 KiB

  1. /****************************** Module Header ******************************\
  2. * Module Name: ntcb.h
  3. *
  4. * Copyright (c) 1985 - 1999, Microsoft Corporation
  5. *
  6. * Kernel mode sending stubs
  7. *
  8. * 07-06-91 ScottLu Created.
  9. \***************************************************************************/
  10. /*
  11. * Reserved bit in the Drive Letter bit mask of a
  12. * WM_DEVICECHANGE message for the following wParam
  13. * (DBT_DEVICEREMOVECOMPLETE or DBT_DEVICEARRIVAL)
  14. * If this bit is set, then this message describes a change with
  15. * global drive letters and we should check if the drive letters
  16. * already exist in the receiver's LUID DosDevices.
  17. * If drive letter exists in the user's LUID DosDevices, then
  18. * un-set this drive letter in the msg's bitmask.
  19. */
  20. #define DBV_FILTER_MSG 0x40000000
  21. // If SERVER is UNICODE
  22. // Copy UNICODE -> UNICODE
  23. // or Copy ANSI -> UNICODE
  24. // prototypes to client side functions only called by these stubs
  25. // ddetrack.c
  26. DWORD _ClientCopyDDEIn1(HANDLE hClient, PINTDDEINFO pi);
  27. VOID _ClientCopyDDEIn2(PINTDDEINFO pi);
  28. HANDLE _ClientCopyDDEOut1(PINTDDEINFO pi);
  29. BOOL xxxClientCopyDDEIn2(PINTDDEINFO pi);
  30. BOOL FixupDdeExecuteIfNecessary(HGLOBAL *phCommands, BOOL fNeedUnicode);
  31. BOOL _ClientCopyDDEOut2(PINTDDEINFO pi);
  32. BOOL _ClientFreeDDEHandle(HANDLE hDDE, DWORD flags);
  33. DWORD _ClientGetDDEFlags(HANDLE hDDE, DWORD flags);
  34. /*
  35. * prototype for checking the drive letters used in the LUID DosDevice
  36. * map. Does not check if the drive letters are used in the Global
  37. * DosDevices
  38. */
  39. #ifdef RECVSIDE
  40. DWORD GetLUIDDosDrivesOnly();
  41. #endif // RECVSIDE
  42. typedef struct _GENERICHOOKHEADER {
  43. DWORD nCode;
  44. WPARAM wParam;
  45. ULONG_PTR xParam;
  46. PROC xpfnProc;
  47. } GENERICHOOKHEADER, * LPGENERICHOOKHEADER;
  48. #ifdef RECVSIDE
  49. ULONG_PTR CallHookWithSEH(GENERICHOOKHEADER *pmsg, LPVOID pData, LPDWORD pFlags, ULONG_PTR retval) {
  50. try {
  51. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  52. pmsg->nCode,
  53. pmsg->wParam,
  54. pData,
  55. pmsg->xParam);
  56. } except ((*pFlags & HF_GLOBAL) ? W32ExceptionHandler(FALSE, RIP_WARNING) : EXCEPTION_CONTINUE_SEARCH) {
  57. RIPMSG0(RIP_WARNING, "Hook Faulted");
  58. *pFlags |= HF_HOOKFAULTED;
  59. }
  60. return retval;
  61. }
  62. #endif // RECVSIDE
  63. /**************************************************************************\
  64. * fnOUTDWORDDWORD
  65. *
  66. * 14-Aug-1992 mikeke created
  67. \**************************************************************************/
  68. typedef struct _FNOUTDWORDDWORDMSG {
  69. PWND pwnd;
  70. UINT msg;
  71. ULONG_PTR xParam;
  72. PROC xpfnProc;
  73. } FNOUTDWORDDWORDMSG;
  74. #ifdef SENDSIDE
  75. SMESSAGECALL(OUTDWORDDWORD)
  76. {
  77. SETUPPWND(FNOUTDWORDDWORD)
  78. UNREFERENCED_PARAMETER(dwSCMSFlags);
  79. BEGINSEND(FNOUTDWORDDWORD)
  80. LPDWORD lpdwW = (LPDWORD)wParam;
  81. LPDWORD lpdwL = (LPDWORD)lParam;
  82. MSGDATA()->pwnd = pwndClient;
  83. MSGDATA()->msg = msg;
  84. MSGDATA()->xParam = xParam;
  85. MSGDATA()->xpfnProc = xpfnProc;
  86. LOCKPWND();
  87. MAKECALL(FNOUTDWORDDWORD);
  88. UNLOCKPWND();
  89. CHECKRETURN();
  90. BEGINCOPYOUT()
  91. try {
  92. *lpdwW = ProbeAndReadUlong((LPDWORD)pcbs->pOutput);
  93. *lpdwL = ProbeAndReadUlong((LPDWORD)pcbs->pOutput + 1);
  94. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  95. MSGERROR();
  96. }
  97. ENDCOPYOUT()
  98. TRACECALLBACKMSG("SfnOUTDWORDDWORD");
  99. ENDSEND(LRESULT,0);
  100. }
  101. #endif // SENDSIDE
  102. #ifdef RECVSIDE
  103. RECVCALL(fnOUTDWORDDWORD, FNOUTDWORDDWORDMSG)
  104. {
  105. DWORD adwOut[2];
  106. BEGINRECV(0, adwOut, sizeof(adwOut));
  107. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  108. CALLDATA(pwnd),
  109. CALLDATA(msg),
  110. &adwOut[0],
  111. &adwOut[1],
  112. CALLDATA(xParam));
  113. ENDRECV();
  114. }
  115. #endif // RECVSIDE
  116. /**************************************************************************\
  117. * fnOUTDWORDINDWORD
  118. *
  119. * 04-May-1993 IanJa created (for MN_FINDMENUWINDOWFROMPOINT)
  120. \**************************************************************************/
  121. typedef struct _FNOUTDWORDINDWORDMSG {
  122. PWND pwnd;
  123. UINT msg;
  124. WPARAM wParam;
  125. LPARAM lParam;
  126. ULONG_PTR xParam;
  127. PROC xpfnProc;
  128. } FNOUTDWORDINDWORDMSG;
  129. #ifdef SENDSIDE
  130. SMESSAGECALL(OUTDWORDINDWORD)
  131. {
  132. SETUPPWND(FNOUTDWORDINDWORD)
  133. UNREFERENCED_PARAMETER(dwSCMSFlags);
  134. BEGINSEND(FNOUTDWORDINDWORD)
  135. LPDWORD lpdwW = (LPDWORD)wParam;
  136. MSGDATA()->pwnd = pwndClient;
  137. MSGDATA()->msg = msg;
  138. MSGDATA()->lParam = lParam;
  139. MSGDATA()->xParam = xParam;
  140. MSGDATA()->xpfnProc = xpfnProc;
  141. LOCKPWND();
  142. MAKECALL(FNOUTDWORDINDWORD);
  143. UNLOCKPWND();
  144. CHECKRETURN();
  145. BEGINCOPYOUT()
  146. try {
  147. *lpdwW = ProbeAndReadUlong((LPDWORD)pcbs->pOutput);
  148. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  149. MSGERROR();
  150. }
  151. ENDCOPYOUT()
  152. TRACECALLBACKMSG("SfnOUTDWORDINDWORD");
  153. ENDSEND(LRESULT,0);
  154. }
  155. #endif // SENDSIDE
  156. #ifdef RECVSIDE
  157. RECVCALL(fnOUTDWORDINDWORD, FNOUTDWORDINDWORDMSG)
  158. {
  159. DWORD dwOut;
  160. BEGINRECV(0, &dwOut, sizeof(dwOut));
  161. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  162. CALLDATA(pwnd),
  163. CALLDATA(msg),
  164. &dwOut,
  165. CALLDATA(lParam),
  166. CALLDATA(xParam));
  167. ENDRECV();
  168. }
  169. #endif // RECVSIDE
  170. /**************************************************************************\
  171. * fnOPTOUTLPDWORDOPTOUTLPDWORD
  172. *
  173. * 25-Nov-1992 JonPa created
  174. \**************************************************************************/
  175. typedef struct _FNOPTOUTLPDWORDOPTOUTLPDWORDMSG {
  176. PWND pwnd;
  177. UINT msg;
  178. ULONG_PTR xParam;
  179. PROC xpfnProc;
  180. } FNOPTOUTLPDWORDOPTOUTLPDWORDMSG;
  181. #ifdef SENDSIDE
  182. SMESSAGECALL(OPTOUTLPDWORDOPTOUTLPDWORD)
  183. {
  184. SETUPPWND(FNOPTOUTLPDWORDOPTOUTLPDWORD)
  185. UNREFERENCED_PARAMETER(dwSCMSFlags);
  186. BEGINSEND(FNOPTOUTLPDWORDOPTOUTLPDWORD)
  187. LPDWORD lpdwW = (LPDWORD)wParam;
  188. LPDWORD lpdwL = (LPDWORD)lParam;
  189. MSGDATA()->pwnd = pwndClient;
  190. MSGDATA()->msg = msg;
  191. MSGDATA()->xParam = xParam;
  192. MSGDATA()->xpfnProc = xpfnProc;
  193. LOCKPWND();
  194. MAKECALL(FNOPTOUTLPDWORDOPTOUTLPDWORD);
  195. UNLOCKPWND();
  196. CHECKRETURN();
  197. BEGINCOPYOUT()
  198. try {
  199. if (lpdwW != NULL)
  200. *lpdwW = ProbeAndReadUlong((LPDWORD)pcbs->pOutput);
  201. if (lpdwL != NULL)
  202. *lpdwL = ProbeAndReadUlong((LPDWORD)pcbs->pOutput + 1);
  203. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  204. MSGERROR();
  205. }
  206. ENDCOPYOUT()
  207. TRACECALLBACKMSG("SfnOPTOUTLPDWORDOPTOUTLPDWORD");
  208. ENDSEND(LRESULT,0);
  209. }
  210. #endif // SENDSIDE
  211. #ifdef RECVSIDE
  212. RECVCALL(fnOPTOUTLPDWORDOPTOUTLPDWORD, FNOPTOUTLPDWORDOPTOUTLPDWORDMSG)
  213. {
  214. DWORD adwOut[2];
  215. BEGINRECV(0, adwOut, sizeof(adwOut));
  216. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  217. CALLDATA(pwnd),
  218. CALLDATA(msg),
  219. &adwOut[0],
  220. &adwOut[1],
  221. CALLDATA(xParam));
  222. ENDRECV();
  223. }
  224. #endif // RECVSIDE
  225. /**************************************************************************\
  226. * fnDWORDOPTINLPMSG
  227. *
  228. * 03-30-92 scottlu Created
  229. \**************************************************************************/
  230. typedef struct _FNDWORDOPTINLPMSGMSG {
  231. PWND pwnd;
  232. UINT msg;
  233. WPARAM wParam;
  234. LPMSG pmsgstruct;
  235. ULONG_PTR xParam;
  236. PROC xpfnProc;
  237. MSG msgstruct;
  238. } FNDWORDOPTINLPMSGMSG;
  239. #ifdef SENDSIDE
  240. SMESSAGECALL(DWORDOPTINLPMSG)
  241. {
  242. SETUPPWND(FNDWORDOPTINLPMSG)
  243. UNREFERENCED_PARAMETER(dwSCMSFlags);
  244. UNREFERENCED_PARAMETER(psms);
  245. BEGINSEND(FNDWORDOPTINLPMSG)
  246. LPMSG pmsgstruct = (LPMSG)lParam;
  247. MSGDATA()->pwnd = pwndClient;
  248. MSGDATA()->msg = msg;
  249. MSGDATA()->wParam = wParam;
  250. COPYSTRUCTOPT(msgstruct);
  251. MSGDATA()->xParam = xParam;
  252. MSGDATA()->xpfnProc = xpfnProc;
  253. LOCKPWND();
  254. MAKECALL(FNDWORDOPTINLPMSG);
  255. UNLOCKPWND();
  256. CHECKRETURN();
  257. TRACECALLBACKMSG("SfnDWORDOPTINLPMSG");
  258. ENDSEND(LRESULT,0);
  259. }
  260. #endif // SENDSIDE
  261. #ifdef RECVSIDE
  262. RECVCALL(fnDWORDOPTINLPMSG, FNDWORDOPTINLPMSGMSG)
  263. {
  264. BEGINRECV(0, NULL, 0);
  265. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  266. CALLDATA(pwnd),
  267. CALLDATA(msg),
  268. CALLDATA(wParam),
  269. PCALLDATAOPT(msgstruct),
  270. CALLDATA(xParam));
  271. ENDRECV();
  272. }
  273. #endif // RECVSIDE
  274. /**************************************************************************\
  275. * fnCOPYGLOBALDATA
  276. *
  277. * 6-20-92 Sanfords created
  278. \**************************************************************************/
  279. typedef struct _FNCOPYGLOBALDATAMSG {
  280. CAPTUREBUF CaptureBuf;
  281. DWORD cbSize;
  282. PBYTE pData;
  283. } FNCOPYGLOBALDATAMSG;
  284. #ifdef SENDSIDE
  285. SMESSAGECALL(COPYGLOBALDATA)
  286. {
  287. PBYTE pData = (PBYTE)lParam;
  288. SETUPPWND(FNCOPYGLOBALDATA)
  289. UNREFERENCED_PARAMETER(msg);
  290. UNREFERENCED_PARAMETER(xParam);
  291. UNREFERENCED_PARAMETER(xpfnProc);
  292. UNREFERENCED_PARAMETER(dwSCMSFlags);
  293. UNREFERENCED_PARAMETER(psms);
  294. BEGINSENDCAPTURE(FNCOPYGLOBALDATA, 1, wParam, TRUE)
  295. if (pData == 0) {
  296. MSGERROR();
  297. }
  298. MSGDATA()->cbSize = (DWORD)wParam;
  299. LARGECOPYBYTES(pData, (DWORD)wParam);
  300. LOCKPWND();
  301. MAKECALLCAPTURE(FNCOPYGLOBALDATA);
  302. UNLOCKPWND();
  303. CHECKRETURN();
  304. TRACECALLBACKMSG("SfnCOPYGLOBALDATA");
  305. ENDSENDCAPTURE(LRESULT,0);
  306. }
  307. #endif // SENDSIDE
  308. #ifdef RECVSIDE
  309. RECVCALL(fnCOPYGLOBALDATA, FNCOPYGLOBALDATAMSG)
  310. {
  311. PBYTE p;
  312. BEGINRECV(0, NULL, 0);
  313. FIXUPPOINTERS();
  314. retval = (ULONG_PTR)GlobalAlloc(GMEM_MOVEABLE, CALLDATA(cbSize));
  315. if (p = GlobalLock((HANDLE)retval)) {
  316. memcpy(p, (PVOID)CALLDATA(pData), CALLDATA(cbSize));
  317. USERGLOBALUNLOCK((HANDLE)retval);
  318. }
  319. ENDRECV();
  320. }
  321. #endif // RECVSIDE
  322. /**************************************************************************\
  323. * fnCOPYDATA
  324. *
  325. * 7-14-92 Sanfords created
  326. \**************************************************************************/
  327. typedef struct _FNCOPYDATAMSG {
  328. CAPTUREBUF CaptureBuf;
  329. PWND pwnd;
  330. UINT msg;
  331. HWND hwndFrom;
  332. BOOL fDataPresent;
  333. COPYDATASTRUCT cds;
  334. ULONG_PTR xParam;
  335. PROC xpfnProc;
  336. } FNCOPYDATAMSG;
  337. #ifdef SENDSIDE
  338. SMESSAGECALL(COPYDATA)
  339. {
  340. HWND hwndFrom = (HWND)wParam;
  341. PCOPYDATASTRUCT pcds = (PCOPYDATASTRUCT)lParam;
  342. DWORD cCapture, cbCapture;
  343. SETUPPWND(FNCOPYDATA)
  344. UNREFERENCED_PARAMETER(dwSCMSFlags);
  345. UNREFERENCED_PARAMETER(psms);
  346. if (pcds == NULL) {
  347. cCapture = cbCapture = 0;
  348. } else {
  349. cCapture = 1;
  350. cbCapture = pcds->cbData;
  351. }
  352. BEGINSENDCAPTURE(FNCOPYDATA, cCapture, cbCapture, TRUE);
  353. MSGDATA()->pwnd = pwndClient;
  354. MSGDATA()->msg = msg;
  355. MSGDATA()->hwndFrom = hwndFrom;
  356. if (pcds != NULL) {
  357. MSGDATA()->fDataPresent = TRUE;
  358. MSGDATA()->cds = *pcds;
  359. LARGECOPYBYTES2(pcds->lpData, cbCapture, cds.lpData);
  360. } else {
  361. MSGDATA()->fDataPresent = FALSE;
  362. }
  363. MSGDATA()->xParam = xParam;
  364. MSGDATA()->xpfnProc = xpfnProc;
  365. LOCKPWND();
  366. MAKECALLCAPTURE(FNCOPYDATA);
  367. UNLOCKPWND();
  368. CHECKRETURN();
  369. TRACECALLBACKMSG("SfnCOPYDATA");
  370. ENDSENDCAPTURE(LRESULT,0);
  371. }
  372. #endif // SENDSIDE
  373. #ifdef RECVSIDE
  374. RECVCALL(fnCOPYDATA, FNCOPYDATAMSG)
  375. {
  376. BEGINRECV(0, NULL, 0);
  377. FIXUPPOINTERS();
  378. retval = CALLPROC(CALLDATA(xpfnProc))(
  379. CALLDATA(pwnd),
  380. CALLDATA(msg),
  381. CALLDATA(hwndFrom),
  382. CALLDATA(fDataPresent) ? PCALLDATA(cds) : NULL,
  383. CALLDATA(xParam));
  384. ENDRECV();
  385. }
  386. #endif // RECVSIDE
  387. /**************************************************************************\
  388. * fnSENTDDEMSG
  389. *
  390. * 11-5-92 Sanfords created
  391. *
  392. * This thunks DDE messages that SHOULD be posted. It will only work for
  393. * WOW apps. This thunking is strictly for WOW compatability. No 32 bit
  394. * app should be allowed to get away with this practice because it opens
  395. * the DDE protocol up to deadlocks.
  396. \**************************************************************************/
  397. typedef struct _FNSENTDDEMSGMSG {
  398. PWND pwnd;
  399. UINT msg;
  400. WPARAM wParam;
  401. LPARAM lParam;
  402. ULONG_PTR xParam;
  403. PROC xpfnProc;
  404. BOOL fIsUnicodeProc;
  405. } FNSENTDDEMSGMSG;
  406. #ifdef SENDSIDE
  407. SMESSAGECALL(SENTDDEMSG)
  408. {
  409. MSG msgs;
  410. SETUPPWND(FNSENTDDEMSG)
  411. UNREFERENCED_PARAMETER(psms);
  412. BEGINSEND(FNSENTDDEMSG)
  413. msg &= ~MSGFLAG_DDE_SPECIAL_SEND;
  414. if (msg & MSGFLAG_DDE_MID_THUNK) {
  415. /*
  416. * complete the thunking here.
  417. */
  418. msgs.hwnd = HW(pwnd);
  419. msgs.message = msg & ~MSGFLAG_DDE_MID_THUNK;
  420. msgs.wParam = wParam;
  421. msgs.lParam = lParam;
  422. xxxDDETrackGetMessageHook((PMSG)&msgs);
  423. MSGDATA()->pwnd = (PWND)((PBYTE)PW(msgs.hwnd) -
  424. pti->ulClientDelta);
  425. MSGDATA()->msg = msgs.message;
  426. MSGDATA()->wParam = msgs.wParam;
  427. MSGDATA()->lParam = msgs.lParam;
  428. } else {
  429. MSGDATA()->pwnd = pwndClient;
  430. MSGDATA()->msg = msg;
  431. MSGDATA()->wParam = wParam;
  432. MSGDATA()->lParam = lParam;
  433. }
  434. MSGDATA()->xParam = xParam;
  435. MSGDATA()->xpfnProc = xpfnProc;
  436. MSGDATA()->fIsUnicodeProc = !(dwSCMSFlags & SCMS_FLAGS_ANSI);
  437. LOCKPWND();
  438. MAKECALL(FNSENTDDEMSG);
  439. UNLOCKPWND();
  440. CHECKRETURN();
  441. TRACECALLBACKMSG("SfnSENTDDEMSG");
  442. ENDSEND(LRESULT,0);
  443. }
  444. #endif // SENDSIDE
  445. #ifdef RECVSIDE
  446. RECVCALL(fnSENTDDEMSG, FNSENTDDEMSGMSG)
  447. {
  448. BEGINRECV(0, NULL, 0);
  449. /*
  450. * A DDE message may have been sent via CallWindowProc due to subclassing.
  451. * Since IsWindowUnicode() cannot properly tell what proc a message will
  452. * ultimately reach, we make sure that the Ansi/Unicode form of any
  453. * WM_DDE_EXECUTE data is correct for the documented convention and
  454. * translate it as necessary.
  455. */
  456. if (CALLDATA(msg) == WM_DDE_EXECUTE) {
  457. BOOL fHandleChanged;
  458. fHandleChanged = FixupDdeExecuteIfNecessary((HGLOBAL *)PCALLDATA(lParam),
  459. CALLDATA(fIsUnicodeProc) &&
  460. IsWindowUnicode((HWND)CALLDATA(wParam)));
  461. /*
  462. * NOTE:
  463. * If the app didn't allocate this DDE memory GMEM_MOVEABLE,
  464. * the fixup may require the handle value to change.
  465. * If this happens things will fall appart when the other side
  466. * or the tracking layer tries to free the old handle value.
  467. */
  468. UserAssert(!fHandleChanged);
  469. }
  470. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  471. CALLDATA(pwnd),
  472. CALLDATA(msg),
  473. CALLDATA(wParam),
  474. CALLDATA(lParam),
  475. CALLDATA(xParam));
  476. ENDRECV();
  477. }
  478. #endif // RECVSIDE
  479. /**************************************************************************\
  480. * fnDWORD
  481. *
  482. * 22-Jul-1991 mikeke Created
  483. \**************************************************************************/
  484. typedef struct _FNDWORDMSG {
  485. PWND pwnd;
  486. UINT msg;
  487. WPARAM wParam;
  488. LPARAM lParam;
  489. ULONG_PTR xParam;
  490. PROC xpfnProc;
  491. } FNDWORDMSG;
  492. #ifdef SENDSIDE
  493. SMESSAGECALL(DWORD)
  494. {
  495. SETUPPWND(FNDWORD)
  496. UNREFERENCED_PARAMETER(dwSCMSFlags);
  497. UNREFERENCED_PARAMETER(psms);
  498. BEGINSEND(FNDWORD)
  499. MSGDATA()->pwnd = pwndClient;
  500. MSGDATA()->msg = msg;
  501. MSGDATA()->wParam = wParam;
  502. MSGDATA()->lParam = lParam;
  503. MSGDATA()->xParam = xParam;
  504. MSGDATA()->xpfnProc = xpfnProc;
  505. LOCKPWND();
  506. MAKECALL(FNDWORD);
  507. UNLOCKPWND();
  508. CHECKRETURN();
  509. TRACECALLBACKMSG("SfnDWORD");
  510. ENDSEND(LRESULT,0);
  511. }
  512. #endif // SENDSIDE
  513. #ifdef RECVSIDE
  514. RECVCALL(fnDWORD, FNDWORDMSG)
  515. {
  516. BEGINRECV(0, NULL, 0);
  517. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  518. CALLDATA(pwnd),
  519. CALLDATA(msg),
  520. CALLDATA(wParam),
  521. CALLDATA(lParam),
  522. CALLDATA(xParam));
  523. ENDRECV();
  524. }
  525. #endif // RECVSIDE
  526. /**************************************************************************\
  527. * fnNCDESTROY
  528. *
  529. * 07-24-00 MHamid Created
  530. \**************************************************************************/
  531. typedef struct _FNNCDESTROYMSG {
  532. PWND pwnd;
  533. UINT msg;
  534. WPARAM wParam;
  535. LPARAM lParam;
  536. ULONG_PTR xParam;
  537. PROC xpfnProc;
  538. } FNNCDESTROYMSG;
  539. #ifdef SENDSIDE
  540. SMESSAGECALL(NCDESTROY)
  541. {
  542. SETUPPWND(FNNCDESTROY)
  543. UNREFERENCED_PARAMETER(dwSCMSFlags);
  544. UNREFERENCED_PARAMETER(psms);
  545. BEGINSEND(FNNCDESTROY)
  546. MSGDATA()->pwnd = pwndClient;
  547. MSGDATA()->msg = msg;
  548. MSGDATA()->wParam = wParam;
  549. MSGDATA()->lParam = lParam;
  550. MSGDATA()->xParam = xParam;
  551. MSGDATA()->xpfnProc = xpfnProc;
  552. LOCKPWND();
  553. MAKECALL(FNNCDESTROY);
  554. pwnd->pActCtx = NULL;
  555. UNLOCKPWND();
  556. CHECKRETURN();
  557. TRACECALLBACKMSG("SfnNCDESTROY");
  558. ENDSEND(LRESULT, 0);
  559. }
  560. #endif // SENDSIDE
  561. #ifdef RECVSIDE
  562. RECVCALL(fnNCDESTROY, FNNCDESTROYMSG)
  563. {
  564. BEGINRECV(0, NULL, 0);
  565. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  566. CALLDATA(pwnd),
  567. CALLDATA(msg),
  568. CALLDATA(wParam),
  569. CALLDATA(lParam),
  570. CALLDATA(xParam));
  571. if (CALLDATA(pwnd)->pActCtx) {
  572. RtlReleaseActivationContext(CALLDATA(pwnd)->pActCtx);
  573. }
  574. #ifdef LAME_BUTTON
  575. if (GetProp(HW(CALLDATA(pwnd)), MAKEINTATOM(gatomLameButton)) != NULL) {
  576. UserLocalFree(GetProp(HW(CALLDATA(pwnd)), MAKEINTATOM(gatomLameButton)));
  577. SetProp(HW(CALLDATA(pwnd)), MAKEINTATOM(gatomLameButton), NULL);
  578. }
  579. #endif // LAME_BUTTON
  580. ENDRECV();
  581. }
  582. #endif // RECVSIDE
  583. /**************************************************************************\
  584. * fnINWPARAMCHAR
  585. *
  586. * 22-Jul-1991 mikeke Created
  587. \**************************************************************************/
  588. typedef struct _FNINWPARAMCHARMSG {
  589. PWND pwnd;
  590. UINT msg;
  591. WPARAM wParam;
  592. LPARAM lParam;
  593. ULONG_PTR xParam;
  594. PROC xpfnProc;
  595. } FNINWPARAMCHARMSG;
  596. #ifdef SENDSIDE
  597. SMESSAGECALL(INWPARAMCHAR)
  598. {
  599. SETUPPWND(FNINWPARAMCHAR)
  600. UNREFERENCED_PARAMETER(psms);
  601. BEGINSEND(FNINWPARAMCHAR)
  602. MSGDATA()->pwnd = pwndClient;
  603. MSGDATA()->msg = msg;
  604. /*
  605. * WM_CHARTOITEM has an index in the hi-word of wParam
  606. */
  607. if (dwSCMSFlags & SCMS_FLAGS_ANSI) {
  608. if (msg == WM_CHARTOITEM || msg == WM_MENUCHAR) {
  609. WPARAM dwT = wParam & 0xFFFF; // mask of caret pos
  610. RtlWCSMessageWParamCharToMB(msg, &dwT); // convert key portion
  611. UserAssert(HIWORD(dwT) == 0);
  612. wParam = MAKELONG(LOWORD(dwT),HIWORD(wParam)); // rebuild pos & key wParam
  613. } else {
  614. RtlWCSMessageWParamCharToMB(msg, &wParam);
  615. }
  616. }
  617. MSGDATA()->wParam = wParam;
  618. MSGDATA()->lParam = lParam;
  619. MSGDATA()->xParam = xParam;
  620. MSGDATA()->xpfnProc = xpfnProc;
  621. LOCKPWND();
  622. MAKECALL(FNDWORD);
  623. UNLOCKPWND();
  624. CHECKRETURN();
  625. TRACECALLBACKMSG("SfnINWPARAMCHAR");
  626. ENDSEND(LRESULT,0);
  627. }
  628. #endif // SENDSIDE
  629. #ifdef RECVSIDE
  630. /*
  631. * The fnDWORD routine is used for this message
  632. */
  633. #endif // RECVSIDE
  634. /**************************************************************************\
  635. * fnINWPARAMDBCSCHAR
  636. *
  637. * 12-Feb-1996 hideyukn Created
  638. \**************************************************************************/
  639. typedef struct _FNINWPARAMDBCSCHARMSG {
  640. PWND pwnd;
  641. UINT msg;
  642. WPARAM wParam;
  643. LPARAM lParam;
  644. ULONG_PTR xParam;
  645. PROC xpfnProc;
  646. BOOL bAnsi;
  647. } FNINWPARAMDBCSCHARMSG;
  648. #ifdef SENDSIDE
  649. SMESSAGECALL(INWPARAMDBCSCHAR)
  650. {
  651. SETUPPWND(FNINWPARAMDBCSCHAR)
  652. UNREFERENCED_PARAMETER(psms);
  653. BEGINSEND(FNINWPARAMDBCSCHAR)
  654. MSGDATA()->pwnd = pwndClient;
  655. MSGDATA()->msg = msg;
  656. MSGDATA()->bAnsi = dwSCMSFlags & SCMS_FLAGS_ANSI;
  657. /*
  658. * wParam in WM_CHAR/EM_SETPASSWORDCHAR should be converted to ANSI
  659. * ,if target is ANSI.
  660. */
  661. if (dwSCMSFlags & SCMS_FLAGS_ANSI) {
  662. RtlWCSMessageWParamCharToMB(msg, &wParam);
  663. }
  664. MSGDATA()->wParam = wParam;
  665. MSGDATA()->lParam = lParam;
  666. MSGDATA()->xParam = xParam;
  667. MSGDATA()->xpfnProc = xpfnProc;
  668. LOCKPWND();
  669. MAKECALL(FNINWPARAMDBCSCHAR);
  670. UNLOCKPWND();
  671. CHECKRETURN();
  672. TRACECALLBACKMSG("SfnINWPARAMDBCSCHAR");
  673. ENDSEND(LRESULT,0);
  674. }
  675. #endif // SENDSIDE
  676. #ifdef RECVSIDE
  677. RECVCALL(fnINWPARAMDBCSCHAR, FNINWPARAMDBCSCHARMSG)
  678. {
  679. BOOL bAnsiWndProc;
  680. BEGINRECV(0,NULL,0);
  681. bAnsiWndProc = CALLDATA(bAnsi);
  682. if (bAnsiWndProc) {
  683. PKERNEL_MSG pmsgDbcsCB = GetCallBackDbcsInfo();
  684. WPARAM wParam = pmsg->wParam;
  685. BOOL bDbcsMessaging = FALSE;
  686. //
  687. // Check wParam has Dbcs character or not..
  688. //
  689. if (IS_DBCS_MESSAGE(pmsg->wParam)) {
  690. if (pmsg->wParam & WMCR_IR_DBCSCHAR) {
  691. //
  692. // This is reply for WM_IME_REPORT:IR_DBCSCHAR, then
  693. // We send DBCS chararcter at one time...
  694. // (Do not need to send twice for DBCS LeadByte and TrailByte).
  695. //
  696. // Validation for wParam.. (mask off the secret bit).
  697. //
  698. wParam = (pmsg->wParam & 0x0000FFFF);
  699. } else {
  700. //
  701. // Mark the wParam keeps Dbcs character..
  702. //
  703. bDbcsMessaging = TRUE;
  704. //
  705. // Backup current message. this backupped message will be used
  706. // when Apps peek (or get) message from thier WndProc.
  707. // (see GetMessageA(), PeekMessageA()...)
  708. //
  709. // pmsgDbcsCB->hwnd = HW(pmsg->pwnd);
  710. // pmsgDbcsCB->message = pmsg->msg;
  711. // pmsgDbcsCB->wParam = pmsg->wParam;
  712. // pmsgDbcsCB->lParam = pmsg->lParam;
  713. // pmsgDbcsCB->time = pmsg->time;
  714. // pmsgDbcsCB->pt = pmsg->pt;
  715. //
  716. COPY_MSG_TO_KERNELMSG(pmsgDbcsCB,(PMSG)pmsg);
  717. //
  718. // pwnd should be converted to hwnd.
  719. //
  720. pmsgDbcsCB->hwnd = HW(pmsg->pwnd);
  721. //
  722. // DbcsLeadByte will be sent below soon, we just need DbcsTrailByte
  723. // for further usage..
  724. //
  725. pmsgDbcsCB->wParam = (pmsg->wParam & 0x000000FF);
  726. //
  727. // Pass the LeadingByte of the DBCS character to an ANSI WndProc.
  728. //
  729. wParam = (pmsg->wParam & 0x0000FF00) >> 8;
  730. }
  731. }
  732. //
  733. // Forward Dbcs LeadingByte or Sbcs character to Apps WndProc.
  734. //
  735. retval = CALLPROC(CALLDATA(xpfnProc))(
  736. CALLDATA(pwnd),
  737. CALLDATA(msg),
  738. wParam,
  739. CALLDATA(lParam),
  740. CALLDATA(xParam) );
  741. //
  742. // Check we need to send trailing byte or not, if the wParam has Dbcs character.
  743. //
  744. if (bDbcsMessaging && pmsgDbcsCB->wParam) {
  745. //
  746. // If an app didn't peek (or get) the trailing byte from within
  747. // WndProc, and then pass the DBCS TrailingByte to the ANSI WndProc here
  748. // pmsgDbcsCB->wParam has DBCS TrailingByte here.. see above..
  749. //
  750. wParam = KERNEL_WPARAM_TO_WPARAM(pmsgDbcsCB->wParam);
  751. //
  752. // Invalidate cached message.
  753. //
  754. pmsgDbcsCB->wParam = 0;
  755. retval = CALLPROC(CALLDATA(xpfnProc))(
  756. CALLDATA(pwnd),
  757. CALLDATA(msg),
  758. wParam,
  759. CALLDATA(lParam),
  760. CALLDATA(xParam) );
  761. } else {
  762. //
  763. // If an app called Get/PeekMessageA from its
  764. // WndProc, do not do anything.
  765. //
  766. }
  767. } else {
  768. //
  769. // Only LOWORD of WPARAM is valid for WM_CHAR....
  770. // (Mask off DBCS messaging information.)
  771. //
  772. pmsg->wParam &= 0x0000FFFF;
  773. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  774. pmsg->pwnd,
  775. pmsg->msg,
  776. pmsg->wParam,
  777. pmsg->lParam,
  778. pmsg->xParam);
  779. }
  780. ENDRECV();
  781. }
  782. #endif // RECVSIDE
  783. /**************************************************************************\
  784. * yyy
  785. *
  786. * 22-Jul-1991 mikeke Created
  787. \**************************************************************************/
  788. typedef struct _FNINOUTDRAGMSG {
  789. PWND pwnd;
  790. UINT msg;
  791. WPARAM wParam;
  792. ULONG_PTR xParam;
  793. PROC xpfnProc;
  794. DROPSTRUCT ds;
  795. } FNINOUTDRAGMSG;
  796. #ifdef SENDSIDE
  797. SMESSAGECALL(INOUTDRAG)
  798. {
  799. SETUPPWND(FNINOUTDRAG)
  800. UNREFERENCED_PARAMETER(dwSCMSFlags);
  801. BEGINSEND(FNINOUTDRAG)
  802. LPDROPSTRUCT pds = (LPDROPSTRUCT)lParam;
  803. MSGDATA()->pwnd = pwndClient;
  804. MSGDATA()->msg = msg;
  805. MSGDATA()->wParam = wParam;
  806. MSGDATA()->ds = *pds;
  807. MSGDATA()->xParam = xParam;
  808. MSGDATA()->xpfnProc = xpfnProc;
  809. LOCKPWND();
  810. MAKECALL(FNINOUTDRAG);
  811. UNLOCKPWND();
  812. CHECKRETURN();
  813. BEGINCOPYOUT()
  814. OUTSTRUCT(pds, DROPSTRUCT);
  815. ENDCOPYOUT()
  816. TRACECALLBACKMSG("SfnINOUTDRAG");
  817. ENDSEND(LRESULT,0);
  818. }
  819. #endif // SENDSIDE
  820. #ifdef RECVSIDE
  821. RECVCALL(fnINOUTDRAG, FNINOUTDRAGMSG)
  822. {
  823. BEGINRECV(0, &pmsg->ds, sizeof(pmsg->ds));
  824. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  825. pmsg->pwnd,
  826. pmsg->msg,
  827. pmsg->wParam,
  828. &pmsg->ds,
  829. pmsg->xParam);
  830. ENDRECV();
  831. }
  832. #endif // RECVSIDE
  833. /**************************************************************************\
  834. * fnGETTEXTLENGTHS
  835. *
  836. * Gets the Unicode & ANSI lengths
  837. * Internally, lParam pints to the ANSI length in bytes and the return value
  838. * is the Unicode length in bytes. However, the public definition is maintained
  839. * on the client side, where lParam is not used and either ANSI or Unicode is
  840. * returned.
  841. *
  842. * 10-Feb-1992 IanJa Created
  843. \**************************************************************************/
  844. typedef struct _FNGETTEXTLENGTHSMSG {
  845. PWND pwnd;
  846. UINT msg;
  847. WPARAM wParam;
  848. ULONG_PTR xParam;
  849. PROC xpfnProc;
  850. } FNGETTEXTLENGTHSMSG;
  851. #ifdef SENDSIDE
  852. SMESSAGECALL(GETTEXTLENGTHS)
  853. {
  854. SETUPPWND(FNGETTEXTLENGTHS)
  855. UNREFERENCED_PARAMETER(lParam);
  856. UNREFERENCED_PARAMETER(dwSCMSFlags);
  857. UNREFERENCED_PARAMETER(psms);
  858. BEGINSEND(FNGETTEXTLENGTHS)
  859. MSGDATA()->pwnd = pwndClient;
  860. MSGDATA()->msg = msg;
  861. MSGDATA()->wParam = wParam;
  862. MSGDATA()->xParam = xParam;
  863. MSGDATA()->xpfnProc = xpfnProc;
  864. LOCKPWND();
  865. MAKECALL(FNGETTEXTLENGTHS);
  866. UNLOCKPWND();
  867. CHECKRETURN();
  868. /*
  869. * ANSI client wndproc returns us cbANSI. We want cchUnicode,
  870. * so we guess cchUnicode = cbANSI. (It may be less if
  871. * multi-byte characters are involved, but it will never be more).
  872. * Save cbANSI in *lParam in case the server ultimately returns
  873. * the length to an ANSI caller.
  874. *
  875. * Unicode client wndproc returns us cchUnicode. If we want to know
  876. * cbANSI, we must guess how many 'ANSI' chars we would need.
  877. * We guess cbANSI = cchUnicode * 2. (It may be this much if all
  878. * 'ANSI' characters are multi-byte, but it will never be more).
  879. *
  880. * Return cchUnicode (server code is all Unicode internally).
  881. * Put cbANSI in *lParam to be passed along within the server in case
  882. * we ultimately need to return it to the client.
  883. *
  884. * NOTE: this will sometimes cause text lengths to be misreported
  885. * up to twice the real length, but that is expected to be harmless.
  886. * This will only * happen if an app sends WM_GETcode TEXTLENGTH to a
  887. * window with an ANSI client-side wndproc, or a ANSI WM_GETTEXTLENGTH
  888. * is sent to a Unicode client-side wndproc.
  889. */
  890. TRACECALLBACKMSG("SfnGETTEXTLENGTHS");
  891. ENDSEND(LRESULT,0);
  892. }
  893. #endif // SENDSIDE
  894. #ifdef RECVSIDE
  895. RECVCALL(fnGETTEXTLENGTHS, FNGETTEXTLENGTHSMSG)
  896. {
  897. BEGINRECV(0, NULL, 0);
  898. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  899. pmsg->pwnd,
  900. pmsg->msg,
  901. pmsg->wParam,
  902. 0, // so we don't pass &cbAnsi to apps
  903. pmsg->xParam);
  904. ENDRECV();
  905. }
  906. #endif // RECVSIDE
  907. /**************************************************************************\
  908. * yyy
  909. *
  910. * 22-Jul-1991 mikeke Created
  911. \**************************************************************************/
  912. typedef struct _FNINLPCREATESTRUCTMSG {
  913. CAPTUREBUF CaptureBuf;
  914. PWND pwnd;
  915. UINT msg;
  916. WPARAM wParam;
  917. LPARAM lParam;
  918. CREATESTRUCT cs;
  919. ULONG_PTR xParam;
  920. PROC xpfnProc;
  921. } FNINLPCREATESTRUCTMSG;
  922. #ifdef SENDSIDE
  923. SMESSAGECALL(INLPCREATESTRUCT)
  924. {
  925. PCREATESTRUCTEX pcreatestruct = (PCREATESTRUCTEX)lParam;
  926. DWORD cbName = 0, cbClass = 0;
  927. DWORD cCapture = 0;
  928. BOOL fAnsiReceiver = (dwSCMSFlags & SCMS_FLAGS_ANSI);
  929. SETUPPWND(FNINLPCREATESTRUCT)
  930. UNREFERENCED_PARAMETER(psms);
  931. /*
  932. * Compute ANSI capture lengths. Don't capture if
  933. * the strings are in the client's address space.
  934. */
  935. if (pcreatestruct) {
  936. if (pcreatestruct->cs.lpszName &&
  937. ((BOOL)pcreatestruct->strName.bAnsi != fAnsiReceiver ||
  938. IS_SYSTEM_ADDRESS((PVOID)pcreatestruct->cs.lpszName))) {
  939. CALC_SIZE_IN(cbName, &pcreatestruct->strName);
  940. cCapture++;
  941. }
  942. if (IS_PTR(pcreatestruct->cs.lpszClass) &&
  943. ((BOOL)pcreatestruct->strClass.bAnsi != fAnsiReceiver ||
  944. IS_SYSTEM_ADDRESS((PVOID)pcreatestruct->cs.lpszClass))) {
  945. CALC_SIZE_IN(cbClass, &pcreatestruct->strClass);
  946. cCapture++;
  947. }
  948. }
  949. BEGINSENDCAPTURE(FNINLPCREATESTRUCT, cCapture, cbName + cbClass, TRUE)
  950. MSGDATA()->pwnd = pwndClient;
  951. MSGDATA()->msg = msg;
  952. MSGDATA()->wParam = wParam;
  953. MSGDATA()->lParam = lParam; // this could be NULL in WOW apps!
  954. if (pcreatestruct != NULL) {
  955. MSGDATA()->cs = pcreatestruct->cs;
  956. // Make it a "Large" copy because it could be an Edit control
  957. if (cbName) {
  958. if (!pcreatestruct->strName.bAnsi) {
  959. WORD wOrdinal;
  960. try {
  961. wOrdinal = *(PWORD)pcreatestruct->cs.lpszName;
  962. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  963. goto errorexit;
  964. }
  965. if (wOrdinal == 0xffff) {
  966. /*
  967. * Copy out an ordinal of the form 0xffff, ID.
  968. * If the receiver is ANSI, skip the first 0xff.
  969. */
  970. if (fAnsiReceiver) {
  971. if (!NT_SUCCESS(CaptureCallbackData(&mp->CaptureBuf,
  972. (PBYTE)pcreatestruct->cs.lpszName + 1,
  973. 3, (PVOID *)&mp->cs.lpszName)))
  974. goto errorexit;
  975. } else {
  976. if (!NT_SUCCESS(CaptureCallbackData(&mp->CaptureBuf,
  977. (PBYTE)pcreatestruct->cs.lpszName,
  978. 4, (PVOID *)&mp->cs.lpszName)))
  979. goto errorexit;
  980. }
  981. } else if (fAnsiReceiver) {
  982. LARGECOPYSTRINGLPWSTRA(&pcreatestruct->strName, cs.lpszName);
  983. } else {
  984. LARGECOPYSTRINGLPWSTR(&pcreatestruct->strName, cs.lpszName);
  985. }
  986. } else {
  987. BYTE bOrdinal;
  988. try {
  989. bOrdinal = *(PBYTE)pcreatestruct->cs.lpszName;
  990. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  991. goto errorexit;
  992. }
  993. if (bOrdinal == 0xff) {
  994. /*
  995. * Copy out an ordinal of the form 0xff, ID.
  996. * If the receiver is UNICODE, expand the 0xff to 0xffff.
  997. */
  998. if (fAnsiReceiver) {
  999. if (!NT_SUCCESS(CaptureCallbackData(&mp->CaptureBuf,
  1000. (PBYTE)pcreatestruct->cs.lpszName,
  1001. 3, (PVOID *)&mp->cs.lpszName)))
  1002. goto errorexit;
  1003. } else {
  1004. DWORD dwOrdinal;
  1005. try {
  1006. dwOrdinal = MAKELONG(0xffff,
  1007. (*(DWORD UNALIGNED *)pcreatestruct->cs.lpszName >> 8));
  1008. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  1009. goto errorexit;
  1010. }
  1011. if (!NT_SUCCESS(CaptureCallbackData(&mp->CaptureBuf,
  1012. &dwOrdinal,
  1013. 4, (PVOID *)&mp->cs.lpszName)))
  1014. goto errorexit;
  1015. }
  1016. } else if (fAnsiReceiver) {
  1017. LARGECOPYSTRINGLPSTR(&pcreatestruct->strName, cs.lpszName);
  1018. } else {
  1019. LARGECOPYSTRINGLPSTRW(&pcreatestruct->strName, cs.lpszName);
  1020. }
  1021. }
  1022. }
  1023. if (cbClass) {
  1024. if (!pcreatestruct->strClass.bAnsi) {
  1025. if (fAnsiReceiver) {
  1026. LARGECOPYSTRINGLPWSTRA(&pcreatestruct->strClass, cs.lpszClass);
  1027. } else {
  1028. LARGECOPYSTRINGLPWSTR(&pcreatestruct->strClass, cs.lpszClass);
  1029. }
  1030. } else {
  1031. if (fAnsiReceiver) {
  1032. LARGECOPYSTRINGLPSTR(&pcreatestruct->strClass, cs.lpszClass);
  1033. } else {
  1034. LARGECOPYSTRINGLPSTRW(&pcreatestruct->strClass, cs.lpszClass);
  1035. }
  1036. }
  1037. }
  1038. }
  1039. MSGDATA()->xParam = xParam;
  1040. MSGDATA()->xpfnProc = xpfnProc;
  1041. LOCKPWND();
  1042. MAKECALLCAPTURE(FNINLPCREATESTRUCT);
  1043. UNLOCKPWND();
  1044. CHECKRETURN();
  1045. TRACECALLBACKMSG("SfnINLPCREATESTRUCT");
  1046. ENDSENDCAPTURE(LRESULT,0);
  1047. }
  1048. #endif // SENDSIDE
  1049. #ifdef RECVSIDE
  1050. RECVCALL(fnINLPCREATESTRUCT, FNINLPCREATESTRUCTMSG)
  1051. {
  1052. LPARAM lParam;
  1053. BEGINRECV(0, NULL, 0);
  1054. FIXUPPOINTERS();
  1055. if (pmsg->lParam != 0) {
  1056. if ((ULONG_PTR)pmsg->cs.lpszName > gHighestUserAddress)
  1057. pmsg->cs.lpszName = REBASEPTR(pmsg->pwnd, pmsg->cs.lpszName);
  1058. if ((ULONG_PTR)pmsg->cs.lpszClass > gHighestUserAddress)
  1059. pmsg->cs.lpszClass = REBASEPTR(pmsg->pwnd, pmsg->cs.lpszClass);
  1060. lParam = (LPARAM)&pmsg->cs;
  1061. if ((pmsg->cs.lpCreateParams != NULL) &&
  1062. (TestWF(pmsg->pwnd, WEFMDICHILD))) {
  1063. // Note -- do not test the flag in cs.dwExStyle -- it gets zapped for Old UI apps, like Quicken
  1064. ((LPMDICREATESTRUCT)(pmsg->cs.lpCreateParams))->szClass = pmsg->cs.lpszClass;
  1065. ((LPMDICREATESTRUCT)(pmsg->cs.lpCreateParams))->szTitle = pmsg->cs.lpszName;
  1066. }
  1067. } else
  1068. lParam = 0;
  1069. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1070. pmsg->pwnd,
  1071. pmsg->msg,
  1072. pmsg->wParam,
  1073. lParam,
  1074. pmsg->xParam);
  1075. ENDRECV();
  1076. }
  1077. #endif // RECVSIDE
  1078. /**************************************************************************\
  1079. * fnINLPMDICREATESTRUCT
  1080. *
  1081. * 22-Jul-1991 mikeke Created
  1082. \**************************************************************************/
  1083. typedef struct _FNINLPMDICREATESTRUCTMSG {
  1084. CAPTUREBUF CaptureBuf;
  1085. PWND pwnd;
  1086. UINT msg;
  1087. WPARAM wParam;
  1088. MDICREATESTRUCT mdics;
  1089. ULONG_PTR xParam;
  1090. PROC xpfnProc;
  1091. int szClass;
  1092. int szTitle;
  1093. } FNINLPMDICREATESTRUCTMSG;
  1094. #ifdef SENDSIDE
  1095. SMESSAGECALL(INLPMDICREATESTRUCT)
  1096. {
  1097. PMDICREATESTRUCTEX pmdicreatestruct = (PMDICREATESTRUCTEX)lParam;
  1098. DWORD cbTitle = 0, cbClass = 0;
  1099. DWORD cCapture = 0;
  1100. BOOL fAnsiReceiver = (dwSCMSFlags & SCMS_FLAGS_ANSI);
  1101. SETUPPWND(FNINLPMDICREATESTRUCT)
  1102. UNREFERENCED_PARAMETER(psms);
  1103. /*
  1104. * Compute ANSI capture lengths. Don't capture if
  1105. * the strings are in the client's address space and
  1106. * are Unicode.
  1107. */
  1108. if (pmdicreatestruct->mdics.szTitle &&
  1109. (IS_SYSTEM_ADDRESS((PVOID)pmdicreatestruct->mdics.szTitle) ||
  1110. ((BOOL)pmdicreatestruct->strTitle.bAnsi != fAnsiReceiver))) {
  1111. CALC_SIZE_IN(cbTitle, &pmdicreatestruct->strTitle);
  1112. cCapture = 1;
  1113. }
  1114. if (IS_PTR(pmdicreatestruct->mdics.szClass) &&
  1115. (IS_SYSTEM_ADDRESS((PVOID)pmdicreatestruct->mdics.szClass) ||
  1116. ((BOOL)pmdicreatestruct->strClass.bAnsi != fAnsiReceiver))) {
  1117. CALC_SIZE_IN(cbClass, &pmdicreatestruct->strClass);
  1118. cCapture++;
  1119. }
  1120. BEGINSENDCAPTURE(FNINLPMDICREATESTRUCT, cCapture, cbTitle + cbClass, TRUE)
  1121. MSGDATA()->pwnd = pwndClient;
  1122. MSGDATA()->msg = msg;
  1123. MSGDATA()->wParam = wParam;
  1124. MSGDATA()->mdics = pmdicreatestruct->mdics;
  1125. if (cbTitle) {
  1126. if (!pmdicreatestruct->strTitle.bAnsi) {
  1127. if (fAnsiReceiver) {
  1128. LARGECOPYSTRINGLPWSTRA(&pmdicreatestruct->strTitle, mdics.szTitle);
  1129. } else {
  1130. LARGECOPYSTRINGLPWSTR(&pmdicreatestruct->strTitle, mdics.szTitle);
  1131. }
  1132. } else {
  1133. if (fAnsiReceiver) {
  1134. LARGECOPYSTRINGLPSTR(&pmdicreatestruct->strTitle, mdics.szTitle);
  1135. } else {
  1136. LARGECOPYSTRINGLPSTRW(&pmdicreatestruct->strTitle, mdics.szTitle);
  1137. }
  1138. }
  1139. }
  1140. if (cbClass) {
  1141. if (!pmdicreatestruct->strClass.bAnsi) {
  1142. if (fAnsiReceiver) {
  1143. LARGECOPYSTRINGLPWSTRA(&pmdicreatestruct->strClass, mdics.szClass);
  1144. } else {
  1145. LARGECOPYSTRINGLPWSTR(&pmdicreatestruct->strClass, mdics.szClass);
  1146. }
  1147. } else {
  1148. if (fAnsiReceiver) {
  1149. LARGECOPYSTRINGLPSTR(&pmdicreatestruct->strClass, mdics.szClass);
  1150. } else {
  1151. LARGECOPYSTRINGLPSTRW(&pmdicreatestruct->strClass, mdics.szClass);
  1152. }
  1153. }
  1154. }
  1155. MSGDATA()->xParam = xParam;
  1156. MSGDATA()->xpfnProc = xpfnProc;
  1157. LOCKPWND();
  1158. MAKECALLCAPTURE(FNINLPMDICREATESTRUCT);
  1159. UNLOCKPWND();
  1160. CHECKRETURN();
  1161. TRACECALLBACKMSG("SfnINLPMDICREATESTRUCT");
  1162. ENDSENDCAPTURE(LRESULT,0);
  1163. DBG_UNREFERENCED_PARAMETER(wParam);
  1164. }
  1165. #endif // SENDSIDE
  1166. #ifdef RECVSIDE
  1167. RECVCALL(fnINLPMDICREATESTRUCT, FNINLPMDICREATESTRUCTMSG)
  1168. {
  1169. BEGINRECV(0, NULL, 0);
  1170. FIXUPPOINTERS();
  1171. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1172. pmsg->pwnd,
  1173. pmsg->msg,
  1174. pmsg->wParam,
  1175. &pmsg->mdics,
  1176. pmsg->xParam);
  1177. ENDRECV();
  1178. }
  1179. #endif // RECVSIDE
  1180. /**************************************************************************\
  1181. * fnINPAINTCLIPBRD
  1182. *
  1183. * lParam is a supposed to be a Global Handle to DDESHARE memory.
  1184. *
  1185. * 22-Jul-1991 johnc Created
  1186. \**************************************************************************/
  1187. typedef struct _FNINPAINTCLIPBRDMSG {
  1188. PWND pwnd;
  1189. UINT msg;
  1190. WPARAM wParam;
  1191. PAINTSTRUCT ps;
  1192. ULONG_PTR xParam;
  1193. PROC xpfnProc;
  1194. } FNINPAINTCLIPBRDMSG;
  1195. #ifdef SENDSIDE
  1196. SMESSAGECALL(INPAINTCLIPBRD)
  1197. {
  1198. PWND pwndDCOwner;
  1199. /*
  1200. * We need to check clipboard access rights because the app could
  1201. * get the clipboard owner's window handle by enumeration etc and
  1202. * send this message
  1203. */
  1204. SETUPPWND(FNINPAINTCLIPBRD)
  1205. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1206. UNREFERENCED_PARAMETER(psms);
  1207. BEGINSEND(FNINPAINTCLIPBRD)
  1208. LPPAINTSTRUCT pps = (LPPAINTSTRUCT)lParam;
  1209. if (RtlAreAllAccessesGranted(PpiCurrent()->amwinsta,
  1210. WINSTA_ACCESSCLIPBOARD)) {
  1211. MSGDATA()->pwnd = pwndClient;
  1212. MSGDATA()->msg = msg;
  1213. MSGDATA()->wParam = wParam;
  1214. MSGDATA()->ps = *pps;
  1215. MSGDATA()->xParam = xParam;
  1216. MSGDATA()->xpfnProc = xpfnProc;
  1217. /*
  1218. * We can't just set the owner of the DC and pass the original DC
  1219. * because currently GDI won't let you query the current owner
  1220. * and we don't know if it is a public or privately owned DC
  1221. */
  1222. pwndDCOwner = _WindowFromDC(pps->hdc);
  1223. MSGDATA()->ps.hdc = _GetDC(pwndDCOwner);
  1224. LOCKPWND();
  1225. MAKECALL(FNINPAINTCLIPBRD);
  1226. UNLOCKPWND();
  1227. CHECKRETURN();
  1228. _ReleaseDC(MSGDATA()->ps.hdc);
  1229. }
  1230. TRACECALLBACKMSG("SfnINPAINTCLIPBRD");
  1231. ENDSEND(LRESULT,0);
  1232. }
  1233. #endif // SENDSIDE
  1234. #ifdef RECVSIDE
  1235. RECVCALL(fnINPAINTCLIPBRD, FNINPAINTCLIPBRDMSG)
  1236. {
  1237. LPPAINTSTRUCT lpps;
  1238. BEGINRECV(0, NULL, 0);
  1239. lpps = (LPPAINTSTRUCT)GlobalAlloc(GMEM_FIXED | GMEM_DDESHARE, sizeof(PAINTSTRUCT));
  1240. UserAssert(lpps);
  1241. if (lpps) {
  1242. *lpps = pmsg->ps;
  1243. UserAssert(lpps->hdc);
  1244. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1245. pmsg->pwnd,
  1246. pmsg->msg,
  1247. pmsg->wParam,
  1248. lpps,
  1249. pmsg->xParam);
  1250. GlobalFree((HGLOBAL)lpps);
  1251. }
  1252. ENDRECV();
  1253. }
  1254. #endif // RECVSIDE
  1255. /**************************************************************************\
  1256. * fnINSIZECLIPBRD
  1257. *
  1258. * lParam is a supposed to be a Global Handle to DDESHARE memory.
  1259. *
  1260. * 11-Jun-1992 sanfords Created
  1261. \**************************************************************************/
  1262. typedef struct _FNINSIZECLIPBRDMSG {
  1263. PWND pwnd;
  1264. UINT msg;
  1265. WPARAM wParam;
  1266. RECT rc;
  1267. ULONG_PTR xParam;
  1268. PROC xpfnProc;
  1269. } FNINSIZECLIPBRDMSG;
  1270. #ifdef SENDSIDE
  1271. SMESSAGECALL(INSIZECLIPBRD)
  1272. {
  1273. /*
  1274. * We need to check clipboard access rights because the app could
  1275. * get the clipboard owner's window handle by enumeration etc and
  1276. * send this message
  1277. */
  1278. SETUPPWND(FNINSIZECLIPBRD)
  1279. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1280. UNREFERENCED_PARAMETER(psms);
  1281. BEGINSEND(FNINSIZECLIPBRD)
  1282. LPRECT prc = (LPRECT)lParam;
  1283. if (RtlAreAllAccessesGranted(PpiCurrent()->amwinsta,
  1284. WINSTA_ACCESSCLIPBOARD)) {
  1285. MSGDATA()->pwnd = pwndClient;
  1286. MSGDATA()->msg = msg;
  1287. MSGDATA()->wParam = wParam;
  1288. MSGDATA()->rc = *prc;
  1289. MSGDATA()->xParam = xParam;
  1290. MSGDATA()->xpfnProc = xpfnProc;
  1291. LOCKPWND();
  1292. MAKECALL(FNINSIZECLIPBRD);
  1293. UNLOCKPWND();
  1294. CHECKRETURN();
  1295. }
  1296. TRACECALLBACKMSG("SfnINSIZECLIPBRD");
  1297. ENDSEND(LRESULT,0);
  1298. }
  1299. #endif // SENDSIDE
  1300. #ifdef RECVSIDE
  1301. RECVCALL(fnINSIZECLIPBRD, FNINSIZECLIPBRDMSG)
  1302. {
  1303. LPRECT lprc;
  1304. BEGINRECV(0, NULL, 0);
  1305. lprc = (LPRECT)GlobalAlloc(GMEM_FIXED | GMEM_DDESHARE, sizeof(RECT));
  1306. UserAssert(lprc);
  1307. if (lprc) {
  1308. *lprc = pmsg->rc;
  1309. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1310. pmsg->pwnd,
  1311. pmsg->msg,
  1312. pmsg->wParam,
  1313. lprc,
  1314. pmsg->xParam);
  1315. GlobalFree((HGLOBAL)lprc);
  1316. }
  1317. ENDRECV();
  1318. }
  1319. #endif // RECVSIDE
  1320. /**************************************************************************\
  1321. * fnINDESTROYCLIPBRD
  1322. *
  1323. * Special handler so we can call ClientEmptyClipboard on client
  1324. *
  1325. * 01-16-93 scottlu Created
  1326. \**************************************************************************/
  1327. typedef struct _FNINDESTROYCLIPBRDMSG {
  1328. PWND pwnd;
  1329. UINT msg;
  1330. WPARAM wParam;
  1331. LPARAM lParam;
  1332. ULONG_PTR xParam;
  1333. PROC xpfnProc;
  1334. } FNINDESTROYCLIPBRDMSG;
  1335. #ifdef SENDSIDE
  1336. SMESSAGECALL(INDESTROYCLIPBRD)
  1337. {
  1338. SETUPPWND(FNINDESTROYCLIPBRD)
  1339. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1340. UNREFERENCED_PARAMETER(psms);
  1341. BEGINSEND(FNINDESTROYCLIPBRD)
  1342. MSGDATA()->pwnd = pwndClient;
  1343. MSGDATA()->msg = msg;
  1344. MSGDATA()->wParam = wParam;
  1345. MSGDATA()->lParam = lParam;
  1346. MSGDATA()->xParam = xParam;
  1347. MSGDATA()->xpfnProc = xpfnProc;
  1348. LOCKPWND();
  1349. MAKECALL(FNINDESTROYCLIPBRD);
  1350. UNLOCKPWND();
  1351. CHECKRETURN();
  1352. TRACECALLBACKMSG("SfnINDESTROYCLIPBRD");
  1353. ENDSEND(LRESULT,0);
  1354. }
  1355. #endif // SENDSIDE
  1356. #ifdef RECVSIDE
  1357. RECVCALL(fnINDESTROYCLIPBRD, FNINDESTROYCLIPBRDMSG)
  1358. {
  1359. void ClientEmptyClipboard(void);
  1360. BEGINRECV(0, NULL, 0);
  1361. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1362. pmsg->pwnd,
  1363. pmsg->msg,
  1364. pmsg->wParam,
  1365. pmsg->lParam,
  1366. pmsg->xParam);
  1367. /*
  1368. * Now empty the client side clipboard cache.
  1369. * Don't do this if this is a 16bit app. We don't want to clear out the
  1370. * clipboard just because one app is going away. All of the 16bit apps
  1371. * share one clipboard.
  1372. */
  1373. if ((GetClientInfo()->CI_flags & CI_16BIT) == 0) {
  1374. ClientEmptyClipboard();
  1375. }
  1376. ENDRECV();
  1377. }
  1378. #endif // RECVSIDE
  1379. /**************************************************************************\
  1380. * yyy
  1381. *
  1382. * 22-Jul-1991 mikeke Created
  1383. \**************************************************************************/
  1384. typedef struct _FNINOUTLPSCROLLINFOMSG {
  1385. PWND pwnd;
  1386. UINT msg;
  1387. WPARAM wParam;
  1388. SCROLLINFO info;
  1389. ULONG_PTR xParam;
  1390. PROC xpfnProc;
  1391. } FNINOUTLPSCROLLINFOMSG;
  1392. #ifdef SENDSIDE
  1393. SMESSAGECALL(INOUTLPSCROLLINFO)
  1394. {
  1395. SETUPPWND(FNINOUTLPSCROLLINFO)
  1396. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1397. BEGINSEND(FNINOUTLPSCROLLINFO)
  1398. LPSCROLLINFO pinfo = (LPSCROLLINFO)lParam;
  1399. MSGDATA()->pwnd = pwndClient;
  1400. MSGDATA()->msg = msg;
  1401. MSGDATA()->wParam = wParam;
  1402. MSGDATA()->info = *pinfo;
  1403. MSGDATA()->xParam = xParam;
  1404. MSGDATA()->xpfnProc = xpfnProc;
  1405. LOCKPWND();
  1406. MAKECALL(FNINOUTLPSCROLLINFO);
  1407. UNLOCKPWND();
  1408. CHECKRETURN();
  1409. BEGINCOPYOUT()
  1410. OUTSTRUCT(pinfo, SCROLLINFO);
  1411. ENDCOPYOUT()
  1412. TRACECALLBACKMSG("SfnINOUTLPSCROLLINFO");
  1413. ENDSEND(LRESULT,0);
  1414. }
  1415. #endif // SENDSIDE
  1416. #ifdef RECVSIDE
  1417. RECVCALL(fnINOUTLPSCROLLINFO, FNINOUTLPSCROLLINFOMSG)
  1418. {
  1419. BEGINRECV(0, &pmsg->info, sizeof(pmsg->info));
  1420. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1421. pmsg->pwnd,
  1422. pmsg->msg,
  1423. pmsg->wParam,
  1424. &pmsg->info,
  1425. pmsg->xParam);
  1426. ENDRECV();
  1427. }
  1428. #endif // RECVSIDE
  1429. /**************************************************************************\
  1430. * yyy
  1431. *
  1432. * 22-Jul-1991 mikeke Created
  1433. \**************************************************************************/
  1434. typedef struct _FNINOUTLPPOINT5MSG {
  1435. PWND pwnd;
  1436. UINT msg;
  1437. WPARAM wParam;
  1438. POINT5 point5;
  1439. ULONG_PTR xParam;
  1440. PROC xpfnProc;
  1441. } FNINOUTLPPOINT5MSG;
  1442. #ifdef SENDSIDE
  1443. SMESSAGECALL(INOUTLPPOINT5)
  1444. {
  1445. SETUPPWND(FNINOUTLPPOINT5)
  1446. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1447. BEGINSEND(FNINOUTLPPOINT5)
  1448. LPPOINT5 ppoint5 = (LPPOINT5)lParam;
  1449. MSGDATA()->pwnd = pwndClient;
  1450. MSGDATA()->msg = msg;
  1451. MSGDATA()->wParam = wParam;
  1452. MSGDATA()->point5 = *ppoint5;
  1453. MSGDATA()->xParam = xParam;
  1454. MSGDATA()->xpfnProc = xpfnProc;
  1455. LOCKPWND();
  1456. MAKECALL(FNINOUTLPPOINT5);
  1457. UNLOCKPWND();
  1458. CHECKRETURN();
  1459. BEGINCOPYOUT()
  1460. OUTSTRUCT(ppoint5, POINT5);
  1461. ENDCOPYOUT()
  1462. TRACECALLBACKMSG("SfnINOUTLPPOINT5");
  1463. ENDSEND(LRESULT,0);
  1464. }
  1465. #endif // SENDSIDE
  1466. #ifdef RECVSIDE
  1467. RECVCALL(fnINOUTLPPOINT5, FNINOUTLPPOINT5MSG)
  1468. {
  1469. BEGINRECV(0, &pmsg->point5, sizeof(POINT5));
  1470. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1471. pmsg->pwnd,
  1472. pmsg->msg,
  1473. pmsg->wParam,
  1474. &pmsg->point5,
  1475. pmsg->xParam);
  1476. ENDRECV();
  1477. }
  1478. #endif // RECVSIDE
  1479. /**************************************************************************\
  1480. * yyy
  1481. *
  1482. * 22-Jul-1991 mikeke Created
  1483. \**************************************************************************/
  1484. typedef struct _FNINOUTLPRECTMSG {
  1485. PWND pwnd;
  1486. UINT msg;
  1487. WPARAM wParam;
  1488. RECT rect;
  1489. ULONG_PTR xParam;
  1490. PROC xpfnProc;
  1491. } FNINOUTLPRECTMSG;
  1492. #ifdef SENDSIDE
  1493. SMESSAGECALL(INOUTLPRECT)
  1494. {
  1495. SETUPPWND(FNINOUTLPRECT)
  1496. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1497. BEGINSEND(FNINOUTLPRECT)
  1498. LPRECT prect = (LPRECT)lParam;
  1499. MSGDATA()->pwnd = pwndClient;
  1500. MSGDATA()->msg = msg;
  1501. MSGDATA()->wParam = wParam;
  1502. MSGDATA()->rect = *prect;
  1503. MSGDATA()->xParam = xParam;
  1504. MSGDATA()->xpfnProc = xpfnProc;
  1505. LOCKPWND();
  1506. MAKECALL(FNINOUTLPRECT);
  1507. UNLOCKPWND();
  1508. CHECKRETURN();
  1509. BEGINCOPYOUT()
  1510. OUTSTRUCT(prect, RECT);
  1511. ENDCOPYOUT()
  1512. TRACECALLBACKMSG("SfnINOUTLPRECT");
  1513. ENDSEND(LRESULT,0);
  1514. }
  1515. #endif // SENDSIDE
  1516. #ifdef RECVSIDE
  1517. RECVCALL(fnINOUTLPRECT, FNINOUTLPRECTMSG)
  1518. {
  1519. BEGINRECV(0, &pmsg->rect, sizeof(pmsg->rect));
  1520. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1521. pmsg->pwnd,
  1522. pmsg->msg,
  1523. pmsg->wParam,
  1524. &pmsg->rect,
  1525. pmsg->xParam);
  1526. ENDRECV();
  1527. }
  1528. #endif // RECVSIDE
  1529. /**************************************************************************\
  1530. * yyy
  1531. *
  1532. * 11-25-92 ScottLu Created.
  1533. \**************************************************************************/
  1534. typedef struct _FNINOUTNCCALCSIZEMSG {
  1535. PWND pwnd;
  1536. UINT msg;
  1537. WPARAM wParam;
  1538. ULONG_PTR xParam;
  1539. PROC xpfnProc;
  1540. union {
  1541. RECT rc;
  1542. struct {
  1543. NCCALCSIZE_PARAMS params;
  1544. WINDOWPOS pos;
  1545. } p;
  1546. } u;
  1547. } FNINOUTNCCALCSIZEMSG;
  1548. typedef struct _OUTNCCALCSIZE {
  1549. NCCALCSIZE_PARAMS params;
  1550. WINDOWPOS pos;
  1551. } OUTNCCALCSIZE, *POUTNCCALCSIZE;
  1552. #ifdef SENDSIDE
  1553. SMESSAGECALL(INOUTNCCALCSIZE)
  1554. {
  1555. SETUPPWND(FNINOUTNCCALCSIZE)
  1556. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1557. BEGINSEND(FNINOUTNCCALCSIZE)
  1558. LPWINDOWPOS lppos;
  1559. UINT cbCallback;
  1560. MSGDATA()->pwnd = pwndClient;
  1561. MSGDATA()->msg = msg;
  1562. MSGDATA()->wParam = wParam;
  1563. MSGDATA()->xParam = xParam;
  1564. MSGDATA()->xpfnProc = xpfnProc;
  1565. /*
  1566. * If wParam != 0, lParam points to a NCCALCSIZE_PARAMS structure,
  1567. * otherwise it points to a rectangle.
  1568. */
  1569. if (wParam != 0) {
  1570. MSGDATA()->u.p.params = *((LPNCCALCSIZE_PARAMS)lParam);
  1571. MSGDATA()->u.p.pos = *(MSGDATA()->u.p.params.lppos);
  1572. cbCallback = sizeof(FNINOUTNCCALCSIZEMSG);
  1573. } else {
  1574. MSGDATA()->u.rc = *((LPRECT)lParam);
  1575. cbCallback = FIELD_OFFSET(FNINOUTNCCALCSIZEMSG, u) +
  1576. sizeof(RECT);
  1577. }
  1578. /*
  1579. * Don't use the MAKECALL macro so we can
  1580. * select the callback data size
  1581. */
  1582. LOCKPWND();
  1583. LeaveCrit();
  1584. Status = (DWORD)KeUserModeCallback(
  1585. FI_FNINOUTNCCALCSIZE,
  1586. mp,
  1587. cbCallback,
  1588. &pcbs,
  1589. &cbCBStatus);
  1590. EnterCrit();
  1591. UNLOCKPWND();
  1592. CHECKRETURN();
  1593. BEGINCOPYOUT()
  1594. try {
  1595. ProbeForRead(pcbs->pOutput, pcbs->cbOutput, sizeof(DWORD));
  1596. if (wParam != 0) {
  1597. lppos = ((LPNCCALCSIZE_PARAMS)lParam)->lppos;
  1598. *((LPNCCALCSIZE_PARAMS)lParam) =
  1599. ((POUTNCCALCSIZE)pcbs->pOutput)->params;
  1600. *lppos = ((POUTNCCALCSIZE)pcbs->pOutput)->pos;
  1601. ((LPNCCALCSIZE_PARAMS)lParam)->lppos = lppos;
  1602. } else {
  1603. *((LPRECT)lParam) = *(PRECT)pcbs->pOutput;
  1604. }
  1605. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  1606. MSGERROR();
  1607. }
  1608. ENDCOPYOUT()
  1609. TRACECALLBACKMSG("SfnINOUTNCCALCSIZE");
  1610. ENDSEND(LRESULT,0);
  1611. }
  1612. #endif // SENDSIDE
  1613. #ifdef RECVSIDE
  1614. RECVCALL(fnINOUTNCCALCSIZE, FNINOUTNCCALCSIZEMSG)
  1615. {
  1616. BEGINRECV(0, &pmsg->u, sizeof(pmsg->u));
  1617. if (CALLDATA(wParam) != 0)
  1618. CALLDATA(u.p.params).lppos = PCALLDATA(u.p.pos);
  1619. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1620. pmsg->pwnd,
  1621. pmsg->msg,
  1622. pmsg->wParam,
  1623. (LPARAM)&pmsg->u,
  1624. pmsg->xParam);
  1625. ENDRECV();
  1626. }
  1627. #endif // RECVSIDE
  1628. /**************************************************************************\
  1629. * yyy
  1630. *
  1631. * 9/30/94 Sanfords created
  1632. \**************************************************************************/
  1633. typedef struct _FNINOUTSTYLECHANGEMSG {
  1634. PWND pwnd;
  1635. UINT msg;
  1636. WPARAM wParam;
  1637. STYLESTRUCT ss;
  1638. ULONG_PTR xParam;
  1639. PROC xpfnProc;
  1640. } FNINOUTSTYLECHANGEMSG;
  1641. #ifdef SENDSIDE
  1642. SMESSAGECALL(INOUTSTYLECHANGE)
  1643. {
  1644. SETUPPWND(FNINOUTSTYLECHANGE)
  1645. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1646. UNREFERENCED_PARAMETER(psms);
  1647. BEGINSEND(FNINOUTSTYLECHANGE)
  1648. MSGDATA()->pwnd = pwndClient;
  1649. MSGDATA()->msg = msg;
  1650. MSGDATA()->wParam = wParam;
  1651. MSGDATA()->xParam = xParam;
  1652. MSGDATA()->xpfnProc = xpfnProc;
  1653. MSGDATA()->ss = *((LPSTYLESTRUCT)lParam);
  1654. LOCKPWND();
  1655. MAKECALL(FNINOUTSTYLECHANGE);
  1656. UNLOCKPWND();
  1657. CHECKRETURN();
  1658. if (msg == WM_STYLECHANGING)
  1659. OUTSTRUCT(((LPSTYLESTRUCT)lParam), STYLESTRUCT);
  1660. TRACECALLBACKMSG("SfnINOUTSTYLECHANGE");
  1661. ENDSEND(LRESULT,0);
  1662. }
  1663. #endif // SENDSIDE
  1664. #ifdef RECVSIDE
  1665. RECVCALL(fnINOUTSTYLECHANGE, FNINOUTSTYLECHANGEMSG)
  1666. {
  1667. BEGINRECV(0, &pmsg->ss, sizeof(pmsg->ss));
  1668. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  1669. CALLDATA(pwnd),
  1670. CALLDATA(msg),
  1671. CALLDATA(wParam),
  1672. (LPARAM)&pmsg->ss,
  1673. pmsg->xParam);
  1674. ENDRECV();
  1675. }
  1676. #endif // RECVSIDE
  1677. /**************************************************************************\
  1678. * yyy
  1679. *
  1680. * 22-Jul-1991 mikeke Created
  1681. \**************************************************************************/
  1682. typedef struct _FNOUTLPRECTMSG {
  1683. PWND pwnd;
  1684. UINT msg;
  1685. WPARAM wParam;
  1686. ULONG_PTR xParam;
  1687. PROC xpfnProc;
  1688. } FNOUTLPRECTMSG;
  1689. #ifdef SENDSIDE
  1690. SMESSAGECALL(OUTLPRECT)
  1691. {
  1692. SETUPPWND(FNOUTLPRECT)
  1693. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1694. BEGINSEND(FNOUTLPRECT)
  1695. LPRECT prect = (LPRECT)lParam;
  1696. MSGDATA()->pwnd = pwndClient;
  1697. MSGDATA()->msg = msg;
  1698. MSGDATA()->wParam = wParam;
  1699. MSGDATA()->xParam = xParam;
  1700. MSGDATA()->xpfnProc = xpfnProc;
  1701. LOCKPWND();
  1702. MAKECALL(FNOUTLPRECT);
  1703. UNLOCKPWND();
  1704. CHECKRETURN();
  1705. BEGINCOPYOUT()
  1706. OUTSTRUCT(prect, RECT);
  1707. ENDCOPYOUT()
  1708. TRACECALLBACKMSG("SfnOUTLPRECT");
  1709. ENDSEND(LRESULT,0);
  1710. }
  1711. #endif // SENDSIDE
  1712. #ifdef RECVSIDE
  1713. RECVCALL(fnOUTLPRECT, FNOUTLPRECTMSG)
  1714. {
  1715. RECT rc;
  1716. BEGINRECV(0, &rc, sizeof(rc));
  1717. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1718. pmsg->pwnd,
  1719. pmsg->msg,
  1720. pmsg->wParam,
  1721. &rc,
  1722. pmsg->xParam);
  1723. ENDRECV();
  1724. }
  1725. #endif // RECVSIDE
  1726. /**************************************************************************\
  1727. * yyy
  1728. *
  1729. * 22-Jul-1991 mikeke Created
  1730. \**************************************************************************/
  1731. typedef struct _FNINLPCOMPAREITEMSTRUCTMSG {
  1732. PWND pwnd;
  1733. UINT msg;
  1734. WPARAM wParam;
  1735. COMPAREITEMSTRUCT compareitemstruct;
  1736. ULONG_PTR xParam;
  1737. PROC xpfnProc;
  1738. } FNINLPCOMPAREITEMSTRUCTMSG;
  1739. #ifdef SENDSIDE
  1740. SMESSAGECALL(INLPCOMPAREITEMSTRUCT)
  1741. {
  1742. SETUPPWND(FNINLPCOMPAREITEMSTRUCT)
  1743. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1744. UNREFERENCED_PARAMETER(psms);
  1745. BEGINSEND(FNINLPCOMPAREITEMSTRUCT)
  1746. LPCOMPAREITEMSTRUCT pcompareitemstruct = (LPCOMPAREITEMSTRUCT)lParam;
  1747. MSGDATA()->pwnd = pwndClient;
  1748. MSGDATA()->msg = msg;
  1749. MSGDATA()->wParam = wParam;
  1750. MSGDATA()->compareitemstruct = *pcompareitemstruct;
  1751. MSGDATA()->xParam = xParam;
  1752. MSGDATA()->xpfnProc = xpfnProc;
  1753. LOCKPWND();
  1754. MAKECALL(FNINLPCOMPAREITEMSTRUCT);
  1755. UNLOCKPWND();
  1756. CHECKRETURN();
  1757. TRACECALLBACKMSG("SfnINLPCOMPAREITEMSTRUCT");
  1758. ENDSEND(LRESULT,0);
  1759. }
  1760. #endif // SENDSIDE
  1761. #ifdef RECVSIDE
  1762. RECVCALL(fnINLPCOMPAREITEMSTRUCT, FNINLPCOMPAREITEMSTRUCTMSG)
  1763. {
  1764. BEGINRECV(0, NULL, 0);
  1765. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1766. pmsg->pwnd,
  1767. pmsg->msg,
  1768. pmsg->wParam,
  1769. &(pmsg->compareitemstruct),
  1770. pmsg->xParam);
  1771. ENDRECV();
  1772. }
  1773. #endif // RECVSIDE
  1774. /**************************************************************************\
  1775. * yyy
  1776. *
  1777. * 22-Jul-1991 mikeke Created
  1778. \**************************************************************************/
  1779. typedef struct _FNINLPDELETEITEMSTRUCTMSG {
  1780. PWND pwnd;
  1781. UINT msg;
  1782. WPARAM wParam;
  1783. DELETEITEMSTRUCT deleteitemstruct;
  1784. ULONG_PTR xParam;
  1785. PROC xpfnProc;
  1786. } FNINLPDELETEITEMSTRUCTMSG;
  1787. #ifdef SENDSIDE
  1788. SMESSAGECALL(INLPDELETEITEMSTRUCT)
  1789. {
  1790. SETUPPWND(FNINLPDELETEITEMSTRUCT)
  1791. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1792. UNREFERENCED_PARAMETER(psms);
  1793. BEGINSEND(FNINLPDELETEITEMSTRUCT)
  1794. LPDELETEITEMSTRUCT pdeleteitemstruct = (LPDELETEITEMSTRUCT)lParam;
  1795. MSGDATA()->pwnd = pwndClient;
  1796. MSGDATA()->msg = msg;
  1797. MSGDATA()->wParam = wParam;
  1798. MSGDATA()->deleteitemstruct = *pdeleteitemstruct;
  1799. MSGDATA()->xParam = xParam;
  1800. MSGDATA()->xpfnProc = xpfnProc;
  1801. LOCKPWND();
  1802. MAKECALL(FNINLPDELETEITEMSTRUCT);
  1803. UNLOCKPWND();
  1804. CHECKRETURN();
  1805. TRACECALLBACKMSG("SfnINLPDELETEITEMSTRUCT");
  1806. ENDSEND(LRESULT,0);
  1807. }
  1808. #endif // SENDSIDE
  1809. #ifdef RECVSIDE
  1810. RECVCALL(fnINLPDELETEITEMSTRUCT, FNINLPDELETEITEMSTRUCTMSG)
  1811. {
  1812. BEGINRECV(0, NULL, 0);
  1813. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1814. pmsg->pwnd,
  1815. pmsg->msg,
  1816. pmsg->wParam,
  1817. &(pmsg->deleteitemstruct),
  1818. pmsg->xParam);
  1819. ENDRECV();
  1820. }
  1821. #endif // RECVSIDE
  1822. /**************************************************************************\
  1823. * FNINHLPSTRUCT
  1824. *
  1825. * 06-08-92 SanfordS Created
  1826. \**************************************************************************/
  1827. typedef struct _FNINLPHLPSTRUCTMSG {
  1828. CAPTUREBUF CaptureBuf;
  1829. PWND pwnd;
  1830. UINT msg;
  1831. WPARAM wParam;
  1832. LPHLP lphlp;
  1833. ULONG_PTR xParam;
  1834. PROC xpfnProc;
  1835. } FNINLPHLPSTRUCTMSG;
  1836. #ifdef SENDSIDE
  1837. SMESSAGECALL(INLPHLPSTRUCT)
  1838. {
  1839. LPHLP lphlp = (LPHLP)lParam;
  1840. SETUPPWND(FNINLPHLPSTRUCT)
  1841. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1842. UNREFERENCED_PARAMETER(psms);
  1843. BEGINSENDCAPTURE(FNINLPHLPSTRUCT, 1, lphlp->cbData, TRUE)
  1844. MSGDATA()->pwnd = pwndClient;
  1845. MSGDATA()->msg = msg;
  1846. MSGDATA()->wParam = wParam;
  1847. COPYBYTES(lphlp, lphlp->cbData);
  1848. MSGDATA()->xParam = xParam;
  1849. MSGDATA()->xpfnProc = xpfnProc;
  1850. LOCKPWND();
  1851. MAKECALLCAPTURE(FNINLPHLPSTRUCT);
  1852. UNLOCKPWND();
  1853. CHECKRETURN();
  1854. TRACECALLBACKMSG("SfnINLPHLPSTRUCT");
  1855. ENDSENDCAPTURE(LRESULT,0);
  1856. }
  1857. #endif // SENDSIDE
  1858. #ifdef RECVSIDE
  1859. RECVCALL(fnINLPHLPSTRUCT, FNINLPHLPSTRUCTMSG)
  1860. {
  1861. BEGINRECV(0, NULL, 0);
  1862. FIXUPPOINTERS();
  1863. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1864. pmsg->pwnd,
  1865. pmsg->msg,
  1866. pmsg->wParam,
  1867. FIXUP(lphlp),
  1868. pmsg->xParam);
  1869. ENDRECV();
  1870. }
  1871. #endif // RECVSIDE
  1872. #ifndef WINHELP4
  1873. /**************************************************************************\
  1874. * FNINHELPINFOSTRUCT
  1875. *
  1876. * 06-08-92 SanfordS Created
  1877. \**************************************************************************/
  1878. typedef struct _FNINLPHELPFINFOSTRUCTMSG {
  1879. CAPTUREBUF CaptureBuf;
  1880. PWND pwnd;
  1881. UINT msg;
  1882. WPARAM wParam;
  1883. LPHELPINFO lphlp;
  1884. ULONG_PTR xParam;
  1885. PROC xpfnProc;
  1886. } FNINLPHELPINFOSTRUCTMSG;
  1887. #ifdef SENDSIDE
  1888. SMESSAGECALL(INLPHELPINFOSTRUCT)
  1889. {
  1890. LPHELPINFO lphlp = (LPHELPINFO)lParam;
  1891. SETUPPWND(FNINLPHELPINFOSTRUCT)
  1892. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1893. UNREFERENCED_PARAMETER(psms);
  1894. BEGINSENDCAPTURE(FNINLPHELPINFOSTRUCT, 1, lphlp->cbSize, TRUE)
  1895. MSGDATA()->pwnd = pwndClient;
  1896. MSGDATA()->msg = msg;
  1897. MSGDATA()->wParam = wParam;
  1898. COPYBYTES(lphlp, lphlp->cbSize);
  1899. MSGDATA()->xParam = xParam;
  1900. MSGDATA()->xpfnProc = xpfnProc;
  1901. LOCKPWND();
  1902. MAKECALLCAPTURE(FNINLPHELPINFOSTRUCT);
  1903. UNLOCKPWND();
  1904. CHECKRETURN();
  1905. TRACECALLBACKMSG("SfnINLPHELPINFOSTRUCT");
  1906. ENDSENDCAPTURE(LRESULT,0);
  1907. }
  1908. #endif // SENDSIDE
  1909. #ifdef RECVSIDE
  1910. RECVCALL(fnINLPHELPINFOSTRUCT, FNINLPHELPINFOSTRUCTMSG)
  1911. {
  1912. BEGINRECV(0, NULL, 0);
  1913. FIXUPPOINTERS();
  1914. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1915. pmsg->pwnd,
  1916. pmsg->msg,
  1917. pmsg->wParam,
  1918. FIXUP(lphlp),
  1919. pmsg->xParam);
  1920. ENDRECV();
  1921. }
  1922. #endif // RECVSIDE
  1923. #endif // WINHELP4
  1924. /**************************************************************************\
  1925. * yyy
  1926. *
  1927. * 22-Jul-1991 mikeke Created
  1928. \**************************************************************************/
  1929. typedef struct _FNINLPDRAWITEMSTRUCTMSG {
  1930. PWND pwnd;
  1931. UINT msg;
  1932. WPARAM wParam;
  1933. DRAWITEMSTRUCT drawitemstruct;
  1934. ULONG_PTR xParam;
  1935. PROC xpfnProc;
  1936. } FNINLPDRAWITEMSTRUCTMSG;
  1937. #ifdef SENDSIDE
  1938. SMESSAGECALL(INLPDRAWITEMSTRUCT)
  1939. {
  1940. SETUPPWND(FNINLPDRAWITEMSTRUCT)
  1941. UNREFERENCED_PARAMETER(dwSCMSFlags);
  1942. UNREFERENCED_PARAMETER(psms);
  1943. BEGINSEND(FNINLPDRAWITEMSTRUCT)
  1944. LPDRAWITEMSTRUCT pdrawitemstruct = (LPDRAWITEMSTRUCT)lParam;
  1945. HDC hdcOriginal = (HDC)NULL;
  1946. /*
  1947. * Make sure that this is not an OLE inter-process DrawItem
  1948. */
  1949. if (GreGetObjectOwner((HOBJ)pdrawitemstruct->hDC, DC_TYPE) !=
  1950. W32GetCurrentPID()) {
  1951. if (pdrawitemstruct->hDC) {
  1952. PWND pwndItem;
  1953. pwndItem = _WindowFromDC(pdrawitemstruct->hDC);
  1954. if (pwndItem) {
  1955. hdcOriginal = pdrawitemstruct->hDC;
  1956. pdrawitemstruct->hDC = _GetDC(pwndItem);
  1957. }
  1958. }
  1959. }
  1960. MSGDATA()->pwnd = pwndClient;
  1961. MSGDATA()->msg = msg;
  1962. MSGDATA()->wParam = wParam;
  1963. MSGDATA()->drawitemstruct = *pdrawitemstruct;
  1964. MSGDATA()->xParam = xParam;
  1965. MSGDATA()->xpfnProc = xpfnProc;
  1966. LOCKPWND();
  1967. MAKECALL(FNINLPDRAWITEMSTRUCT);
  1968. UNLOCKPWND();
  1969. CHECKRETURN();
  1970. if (hdcOriginal) {
  1971. _ReleaseDC(pdrawitemstruct->hDC);
  1972. pdrawitemstruct->hDC = hdcOriginal;
  1973. }
  1974. TRACECALLBACKMSG("SfnINLPDRAWITEMSTRUCT");
  1975. ENDSEND(LRESULT,0);
  1976. }
  1977. #endif // SENDSIDE
  1978. #ifdef RECVSIDE
  1979. RECVCALL(fnINLPDRAWITEMSTRUCT, FNINLPDRAWITEMSTRUCTMSG)
  1980. {
  1981. BEGINRECV(0, NULL, 0);
  1982. if (pmsg->drawitemstruct.hDC == NULL)
  1983. MSGERRORCODE(ERROR_INVALID_HANDLE);
  1984. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  1985. pmsg->pwnd,
  1986. pmsg->msg,
  1987. pmsg->wParam,
  1988. &(pmsg->drawitemstruct),
  1989. pmsg->xParam);
  1990. ENDRECV();
  1991. }
  1992. #endif // RECVSIDE
  1993. /**************************************************************************\
  1994. * fnINOUTLPMEASUREITEMSTRUCT
  1995. *
  1996. * 22-Jul-1991 mikeke Created
  1997. \**************************************************************************/
  1998. typedef struct _FNINOUTLPMEASUREITEMSTRUCTMSG {
  1999. PWND pwnd;
  2000. UINT msg;
  2001. WPARAM wParam;
  2002. MEASUREITEMSTRUCT measureitemstruct;
  2003. ULONG_PTR xParam;
  2004. PROC xpfnProc;
  2005. } FNINOUTLPMEASUREITEMSTRUCTMSG;
  2006. #ifdef SENDSIDE
  2007. SMESSAGECALL(INOUTLPMEASUREITEMSTRUCT)
  2008. {
  2009. SETUPPWND(FNINOUTLPMEASUREITEMSTRUCT)
  2010. BEGINSEND(FNINOUTLPMEASUREITEMSTRUCT)
  2011. PMEASUREITEMSTRUCT pmeasureitemstruct = (PMEASUREITEMSTRUCT)lParam;
  2012. MSGDATA()->pwnd = pwndClient;
  2013. MSGDATA()->msg = msg & ~MSGFLAG_MASK;
  2014. MSGDATA()->wParam = wParam;
  2015. MSGDATA()->measureitemstruct = *pmeasureitemstruct;
  2016. MSGDATA()->xParam = xParam;
  2017. MSGDATA()->xpfnProc = xpfnProc;
  2018. LOCKPWND();
  2019. MAKECALL(FNINOUTLPMEASUREITEMSTRUCT);
  2020. UNLOCKPWND();
  2021. CHECKRETURN();
  2022. BEGINCOPYOUT()
  2023. OUTSTRUCT(pmeasureitemstruct, MEASUREITEMSTRUCT);
  2024. ENDCOPYOUT()
  2025. TRACECALLBACKMSG("SfnINOUTLPMEASUREITEMSTRUCT");
  2026. ENDSEND(LRESULT,0);
  2027. }
  2028. #endif // SENDSIDE
  2029. #ifdef RECVSIDE
  2030. RECVCALL(fnINOUTLPMEASUREITEMSTRUCT, FNINOUTLPMEASUREITEMSTRUCTMSG)
  2031. {
  2032. BEGINRECV(0, &pmsg->measureitemstruct, sizeof(pmsg->measureitemstruct));
  2033. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  2034. pmsg->pwnd,
  2035. pmsg->msg,
  2036. pmsg->wParam,
  2037. &pmsg->measureitemstruct,
  2038. pmsg->xParam);
  2039. ENDRECV();
  2040. }
  2041. #endif // RECVSIDE
  2042. /**************************************************************************\
  2043. * fnINSTRING
  2044. *
  2045. * 22-Jul-1991 mikeke Created
  2046. * 27-Jan-1992 IanJa Unicode/ANSI
  2047. \**************************************************************************/
  2048. typedef struct _FNINSTRINGMSG {
  2049. CAPTUREBUF CaptureBuf;
  2050. PWND pwnd;
  2051. UINT msg;
  2052. WPARAM wParam;
  2053. ULONG_PTR xParam;
  2054. PROC xpfnProc;
  2055. LPTSTR pwsz;
  2056. } FNINSTRINGMSG;
  2057. #ifdef SENDSIDE
  2058. SMESSAGECALL(INSTRING)
  2059. {
  2060. PLARGE_STRING pstr = (PLARGE_STRING)lParam;
  2061. DWORD cbCapture;
  2062. DWORD cCapture;
  2063. BOOL fAnsiReceiver = (dwSCMSFlags & SCMS_FLAGS_ANSI);
  2064. SETUPPWND(FNINSTRING)
  2065. UNREFERENCED_PARAMETER(psms);
  2066. /*
  2067. * Compute ANSI capture lengths. Don't capture if
  2068. * the strings are in the client's address space and
  2069. * of the correct type.
  2070. */
  2071. if (pstr &&
  2072. (IS_SYSTEM_ADDRESS((PVOID)pstr->Buffer) ||
  2073. ((BOOL)pstr->bAnsi != fAnsiReceiver))) {
  2074. cCapture = 1;
  2075. CALC_SIZE_IN(cbCapture, pstr);
  2076. } else {
  2077. cbCapture = 0;
  2078. cCapture = 0;
  2079. }
  2080. BEGINSENDCAPTURE(FNINSTRING, cCapture, cbCapture, TRUE)
  2081. MSGDATA()->pwnd = pwndClient;
  2082. MSGDATA()->msg = msg;
  2083. MSGDATA()->wParam = wParam;
  2084. if (cCapture) {
  2085. if (!pstr->bAnsi) {
  2086. if (fAnsiReceiver) {
  2087. LARGECOPYSTRINGLPWSTRA(pstr, pwsz);
  2088. } else {
  2089. LARGECOPYSTRINGLPWSTR(pstr, pwsz);
  2090. }
  2091. } else {
  2092. if (fAnsiReceiver) {
  2093. LARGECOPYSTRINGLPSTR(pstr, pwsz);
  2094. } else {
  2095. LARGECOPYSTRINGLPSTRW(pstr, pwsz);
  2096. }
  2097. }
  2098. } else {
  2099. MSGDATA()->pwsz = (pstr ? pstr->Buffer : NULL);
  2100. }
  2101. MSGDATA()->xParam = xParam;
  2102. MSGDATA()->xpfnProc = xpfnProc;
  2103. LOCKPWND();
  2104. MAKECALLCAPTURE(FNINSTRING);
  2105. UNLOCKPWND();
  2106. CHECKRETURN();
  2107. TRACECALLBACKMSG("SfnINSTRING");
  2108. ENDSENDCAPTURE(LRESULT,0);
  2109. }
  2110. #endif // SENDSIDE
  2111. #ifdef RECVSIDE
  2112. RECVCALL(fnINSTRING, FNINSTRINGMSG)
  2113. {
  2114. BEGINRECV(0, NULL, 0);
  2115. FIXUPPOINTERS();
  2116. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  2117. pmsg->pwnd,
  2118. pmsg->msg,
  2119. pmsg->wParam,
  2120. pmsg->pwsz,
  2121. pmsg->xParam);
  2122. ENDRECV();
  2123. }
  2124. #endif // RECVSIDE
  2125. /**************************************************************************\
  2126. * fnINSTRINGNULL
  2127. *
  2128. * Server-side stub translates Unicode to ANSI if required.
  2129. *
  2130. * 22-Jul-1991 mikeke Created
  2131. * 28-Jan-1992 IanJa Unicode/ANSI (Server translate to ANSI if rquired)
  2132. \**************************************************************************/
  2133. typedef struct _FNINSTRINGNULLMSG {
  2134. CAPTUREBUF CaptureBuf;
  2135. PWND pwnd;
  2136. UINT msg;
  2137. WPARAM wParam;
  2138. ULONG_PTR xParam;
  2139. PROC xpfnProc;
  2140. LPTSTR pwsz;
  2141. } FNINSTRINGNULLMSG;
  2142. #ifdef SENDSIDE
  2143. SMESSAGECALL(INSTRINGNULL)
  2144. {
  2145. PLARGE_STRING pstr = (PLARGE_STRING)lParam;
  2146. DWORD cbCapture;
  2147. DWORD cCapture;
  2148. BOOL fAnsiReceiver = (dwSCMSFlags & SCMS_FLAGS_ANSI);
  2149. SETUPPWND(FNINSTRINGNULL)
  2150. UNREFERENCED_PARAMETER(psms);
  2151. cCapture = 0;
  2152. cbCapture = 0;
  2153. if (pstr) {
  2154. /*
  2155. * Compute ANSI capture lengths. Don't capture if
  2156. * the strings are in the client's address space and
  2157. * of the correct type.
  2158. */
  2159. if (IS_SYSTEM_ADDRESS((PVOID)pstr->Buffer) ||
  2160. (BOOL)pstr->bAnsi != fAnsiReceiver) {
  2161. cCapture = 1;
  2162. CALC_SIZE_IN(cbCapture, pstr);
  2163. }
  2164. }
  2165. BEGINSENDCAPTURE(FNINSTRINGNULL, cCapture, cbCapture, TRUE)
  2166. MSGDATA()->pwnd = pwndClient;
  2167. MSGDATA()->msg = msg;
  2168. MSGDATA()->wParam = wParam;
  2169. if (cCapture) {
  2170. if (!pstr->bAnsi) {
  2171. if (fAnsiReceiver) {
  2172. LARGECOPYSTRINGLPWSTRA(pstr, pwsz);
  2173. } else {
  2174. LARGECOPYSTRINGLPWSTR(pstr, pwsz);
  2175. }
  2176. } else {
  2177. if (fAnsiReceiver) {
  2178. LARGECOPYSTRINGLPSTR(pstr, pwsz);
  2179. } else {
  2180. LARGECOPYSTRINGLPSTRW(pstr, pwsz);
  2181. }
  2182. }
  2183. } else
  2184. MSGDATA()->pwsz = pstr ? pstr->Buffer : NULL;
  2185. MSGDATA()->xParam = xParam;
  2186. MSGDATA()->xpfnProc = xpfnProc;
  2187. LOCKPWND();
  2188. MAKECALLCAPTURE(FNINSTRINGNULL);
  2189. UNLOCKPWND();
  2190. CHECKRETURN();
  2191. TRACECALLBACKMSG("SfnINSTRINGNULL");
  2192. ENDSENDCAPTURE(LRESULT,0);
  2193. }
  2194. #endif // SENDSIDE
  2195. #ifdef RECVSIDE
  2196. RECVCALL(fnINSTRINGNULL, FNINSTRINGNULLMSG)
  2197. {
  2198. BEGINRECV(0, NULL, 0);
  2199. FIXUPPOINTERS();
  2200. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  2201. pmsg->pwnd,
  2202. pmsg->msg,
  2203. pmsg->wParam,
  2204. pmsg->pwsz,
  2205. pmsg->xParam);
  2206. ENDRECV();
  2207. }
  2208. #endif // RECVSIDE
  2209. /**************************************************************************\
  2210. * yyy
  2211. *
  2212. * 27-May-1997 GregoryW Created
  2213. \**************************************************************************/
  2214. typedef struct _FNINLPKDRAWSWITCHWNDMSG {
  2215. CAPTUREBUF CaptureBuf;
  2216. PWND pwnd;
  2217. UINT msg;
  2218. WPARAM wParam;
  2219. ULONG_PTR xParam;
  2220. PROC xpfnProc;
  2221. LPWSTR pwsz;
  2222. RECT rcRect;
  2223. } FNINLPKDRAWSWITCHWNDMSG;
  2224. #ifdef SENDSIDE
  2225. SMESSAGECALL(INLPKDRAWSWITCHWND)
  2226. {
  2227. PLARGE_UNICODE_STRING pstr = &((LPKDRAWSWITCHWND *)lParam)->strName;
  2228. DWORD cbCapture;
  2229. DWORD cCapture = 1; // Always capture the string
  2230. PWND pwndDCOwner;
  2231. HDC hdcSwitch;
  2232. COLORREF clrOldText, clrOldBk;
  2233. HFONT hOldFont;
  2234. BOOL fAnsiReceiver = FALSE; // The string is always Unicode
  2235. SETUPPWND(FNINLPKDRAWSWITCHWND)
  2236. UNREFERENCED_PARAMETER(psms);
  2237. UNREFERENCED_PARAMETER(dwSCMSFlags);
  2238. CALC_SIZE_IN(cbCapture, pstr);
  2239. BEGINSENDCAPTURE(FNINLPKDRAWSWITCHWND, cCapture, cbCapture, TRUE)
  2240. LARGECOPYSTRINGLPWSTR(pstr, pwsz);
  2241. pwndDCOwner = _WindowFromDC((HDC)wParam);
  2242. hdcSwitch = _GetDC(pwndDCOwner);
  2243. clrOldText = GreSetTextColor(hdcSwitch, SYSRGB(BTNTEXT));
  2244. clrOldBk = GreSetBkColor(hdcSwitch, SYSRGB(3DFACE));
  2245. hOldFont = GreSelectFont(hdcSwitch, gpsi->hCaptionFont);
  2246. MSGDATA()->pwnd = pwndClient;
  2247. MSGDATA()->msg = msg;
  2248. MSGDATA()->wParam = (WPARAM)hdcSwitch;
  2249. MSGDATA()->rcRect = ((LPKDRAWSWITCHWND *)lParam)->rcRect;
  2250. MSGDATA()->xParam = xParam;
  2251. MSGDATA()->xpfnProc = xpfnProc;
  2252. LOCKPWND();
  2253. MAKECALLCAPTURE(FNINLPKDRAWSWITCHWND);
  2254. UNLOCKPWND();
  2255. GreSelectFont(hdcSwitch, hOldFont);
  2256. GreSetBkColor(hdcSwitch, clrOldBk);
  2257. GreSetTextColor(hdcSwitch, clrOldText);
  2258. _ReleaseDC(hdcSwitch);
  2259. CHECKRETURN();
  2260. TRACECALLBACKMSG("SfnINLPKDRAWSWITCHWND");
  2261. ENDSENDCAPTURE(LRESULT,0);
  2262. }
  2263. #endif // SENDSIDE
  2264. #ifdef RECVSIDE
  2265. RECVCALL(fnINLPKDRAWSWITCHWND, FNINLPKDRAWSWITCHWNDMSG)
  2266. {
  2267. DRAWTEXTPARAMS dtp;
  2268. BEGINRECV(0, NULL, 0);
  2269. FIXUPPOINTERS();
  2270. dtp.cbSize = sizeof(dtp);
  2271. dtp.iLeftMargin = 0;
  2272. dtp.iRightMargin = 0;
  2273. retval = DrawTextExW(
  2274. (HDC)pmsg->wParam,
  2275. pmsg->pwsz,
  2276. -1,
  2277. &(pmsg->rcRect),
  2278. DT_NOPREFIX | DT_END_ELLIPSIS | DT_SINGLELINE,
  2279. &dtp
  2280. );
  2281. ENDRECV();
  2282. }
  2283. #endif // RECVSIDE
  2284. typedef struct _FNINDEVICECHANGEMSG {
  2285. CAPTUREBUF CaptureBuf;
  2286. PWND pwnd;
  2287. UINT msg;
  2288. WPARAM wParam;
  2289. ULONG_PTR xParam;
  2290. PROC xpfnProc;
  2291. LPTSTR pwsz;
  2292. BOOL fAnsi;
  2293. } FNINDEVICECHANGEMSG;
  2294. #ifdef SENDSIDE
  2295. SMESSAGECALL(INDEVICECHANGE)
  2296. {
  2297. PVOID pstr = (PVOID)lParam;
  2298. DWORD cbCapture;
  2299. BOOL fAnsiReceiver = (dwSCMSFlags & SCMS_FLAGS_ANSI);
  2300. BOOL fPtr = (BOOL)((wParam & 0x8000) == 0x8000);
  2301. SETUPPWND(FNINDEVICECHANGE)
  2302. UNREFERENCED_PARAMETER(psms);
  2303. cbCapture = 0;
  2304. if (fPtr && (pstr != NULL)) {
  2305. /*
  2306. * Compute ANSI capture lengths. Don't capture if
  2307. * the strings are in the client's address space and
  2308. * of the correct type.
  2309. */
  2310. if (IS_SYSTEM_ADDRESS((PVOID)pstr)) {
  2311. cbCapture = *((DWORD *)pstr);
  2312. }
  2313. }
  2314. BEGINSENDCAPTURE(FNINDEVICECHANGE, 1, cbCapture, TRUE)
  2315. MSGDATA()->pwnd = pwndClient;
  2316. MSGDATA()->msg = msg;
  2317. MSGDATA()->wParam = wParam;
  2318. if (cbCapture) {
  2319. LARGECOPYBYTES2(pstr, *((DWORD *)pstr), pwsz);
  2320. } else {
  2321. MSGDATA()->pwsz = (LPTSTR)pstr;
  2322. }
  2323. MSGDATA()->fAnsi = fAnsiReceiver;
  2324. MSGDATA()->xParam = xParam;
  2325. MSGDATA()->xpfnProc = xpfnProc;
  2326. LOCKPWND();
  2327. MAKECALLCAPTURE(FNINDEVICECHANGE);
  2328. UNLOCKPWND();
  2329. CHECKRETURN();
  2330. TRACECALLBACKMSG("SfnINDEVICECHANGE");
  2331. ENDSENDCAPTURE(LRESULT,0);
  2332. }
  2333. #endif // SENDSIDE
  2334. #ifdef RECVSIDE
  2335. RECVCALL(fnINDEVICECHANGE, FNINDEVICECHANGEMSG)
  2336. {
  2337. struct _DEV_BROADCAST_HEADER *pHdr;
  2338. PDEV_BROADCAST_PORT_A pPortA = NULL;
  2339. PDEV_BROADCAST_PORT_W pPortW;
  2340. PDEV_BROADCAST_DEVICEINTERFACE_A pInterfaceA = NULL;
  2341. PDEV_BROADCAST_DEVICEINTERFACE_W pInterfaceW;
  2342. PDEV_BROADCAST_HANDLE pHandleA = NULL;
  2343. PDEV_BROADCAST_HANDLE pHandleW;
  2344. PDEV_BROADCAST_VOLUME pVolume;
  2345. int iStr, iSize;
  2346. LPSTR lpStr;
  2347. LPARAM lParam;
  2348. BEGINRECV(0, NULL, 0);
  2349. FIXUPPOINTERS();
  2350. lParam = (LPARAM)pmsg->pwsz;
  2351. pHdr = (struct _DEV_BROADCAST_HEADER *)lParam;
  2352. if (!lParam || !(pmsg->wParam & 0x8000) ||
  2353. (!pmsg->fAnsi &&
  2354. ((pHdr->dbcd_devicetype != DBT_DEVTYP_VOLUME) || (pmsg->msg != WM_DEVICECHANGE))
  2355. )) {
  2356. goto shipit;
  2357. }
  2358. switch (pHdr->dbcd_devicetype) {
  2359. case DBT_DEVTYP_PORT:
  2360. pPortW = (PDEV_BROADCAST_PORT_W)lParam;
  2361. iStr = wcslen(pPortW->dbcp_name);
  2362. iSize = FIELD_OFFSET(DEV_BROADCAST_PORT_A, dbcp_name) + DBCS_CHARSIZE*(iStr+1);
  2363. pPortA = UserLocalAlloc(0, iSize);
  2364. if (pPortA == NULL)
  2365. MSGERROR();
  2366. RtlCopyMemory(pPortA, pPortW, FIELD_OFFSET(DEV_BROADCAST_PORT_A, dbcp_name));
  2367. lpStr = pPortA->dbcp_name;
  2368. if (iStr) {
  2369. WCSToMB(pPortW->dbcp_name, -1, &lpStr, iStr, FALSE);
  2370. }
  2371. lpStr[iStr] = 0;
  2372. pPortA->dbcp_size = iSize;
  2373. lParam = (LPARAM)pPortA;
  2374. break;
  2375. case DBT_DEVTYP_DEVICEINTERFACE:
  2376. pInterfaceW = (PDEV_BROADCAST_DEVICEINTERFACE_W)lParam;
  2377. iStr = wcslen(pInterfaceW->dbcc_name);
  2378. iSize = FIELD_OFFSET(DEV_BROADCAST_DEVICEINTERFACE_A, dbcc_name) + DBCS_CHARSIZE*(iStr+1);
  2379. pInterfaceA = UserLocalAlloc(0, iSize);
  2380. if (pInterfaceA == NULL)
  2381. MSGERROR();
  2382. RtlCopyMemory(pInterfaceA, pInterfaceW, FIELD_OFFSET(DEV_BROADCAST_DEVICEINTERFACE_A, dbcc_name));
  2383. lpStr = pInterfaceA->dbcc_name;
  2384. if (iStr) {
  2385. WCSToMB(pInterfaceW->dbcc_name, -1, &lpStr, iStr, FALSE);
  2386. }
  2387. lpStr[iStr] = 0;
  2388. pInterfaceA->dbcc_size = iSize;
  2389. lParam = (LPARAM)pInterfaceA;
  2390. break;
  2391. case DBT_DEVTYP_HANDLE:
  2392. pHandleW = (PDEV_BROADCAST_HANDLE)lParam;
  2393. if ((pmsg->wParam != DBT_CUSTOMEVENT) || (pHandleW->dbch_nameoffset < 0)) break;
  2394. iStr = wcslen((LPWSTR)(pHandleW->dbch_data+pHandleW->dbch_nameoffset));
  2395. iSize = pHandleW->dbch_size;
  2396. /*
  2397. * MB size can't be bigger than UNICODE size
  2398. */
  2399. pHandleA = UserLocalAlloc(0, iSize);
  2400. if (pHandleA == NULL)
  2401. MSGERROR();
  2402. RtlCopyMemory(pHandleA, pHandleW, FIELD_OFFSET(DEV_BROADCAST_HANDLE, dbch_data)+ pHandleW->dbch_nameoffset);
  2403. lpStr = pHandleA->dbch_data+pHandleA->dbch_nameoffset;
  2404. if (iStr) {
  2405. WCSToMB((LPWSTR)(pHandleW->dbch_data+pHandleW->dbch_nameoffset), -1, &lpStr, iStr, FALSE);
  2406. }
  2407. lpStr[iStr] = 0;
  2408. pHandleA->dbch_size = iSize;
  2409. lParam = (LPARAM)pHandleA;
  2410. break;
  2411. case DBT_DEVTYP_VOLUME:
  2412. pVolume = (PDEV_BROADCAST_VOLUME)lParam;
  2413. if (((pmsg->wParam == DBT_DEVICEREMOVECOMPLETE) ||
  2414. (pmsg->wParam == DBT_DEVICEARRIVAL)) &&
  2415. (pVolume->dbcv_unitmask & DBV_FILTER_MSG)) {
  2416. DWORD LUIDDriveMask, ResultDriveMask;
  2417. LUIDDriveMask = GetLUIDDosDrivesOnly();
  2418. /*
  2419. * Filter out the common drive letter bits & DBV_FILTER_MSG
  2420. */
  2421. ResultDriveMask = (((LUIDDriveMask & pVolume->dbcv_unitmask) ^
  2422. pVolume->dbcv_unitmask) ^
  2423. DBV_FILTER_MSG);
  2424. if (ResultDriveMask == 0) {
  2425. goto cleanup;
  2426. }
  2427. pVolume->dbcv_unitmask = ResultDriveMask;
  2428. lParam = (LPARAM)pVolume;
  2429. }
  2430. break;
  2431. }
  2432. shipit:
  2433. retval = (ULONG_PTR)CALLPROC(pmsg->xpfnProc)(
  2434. pmsg->pwnd,
  2435. pmsg->msg,
  2436. pmsg->wParam,
  2437. lParam,
  2438. pmsg->xParam);
  2439. cleanup:
  2440. if (pInterfaceA) UserLocalFree(pInterfaceA);
  2441. if (pPortA) UserLocalFree(pPortA);
  2442. if (pHandleA) UserLocalFree(pHandleA);
  2443. ENDRECV();
  2444. }
  2445. #endif // RECVSIDE
  2446. /**************************************************************************\
  2447. * fnOUTSTRING
  2448. *
  2449. * Warning this message copies but does not count the NULL in retval
  2450. * as in WM_GETTEXT
  2451. *
  2452. * 22-Jul-1991 mikeke Created
  2453. \**************************************************************************/
  2454. typedef struct _FNOUTSTRINGMSG {
  2455. CAPTUREBUF CaptureBuf;
  2456. PWND pwnd;
  2457. UINT msg;
  2458. WPARAM wParam;
  2459. ULONG_PTR xParam;
  2460. PROC xpfnProc;
  2461. PBYTE pOutput;
  2462. DWORD cbOutput;
  2463. } FNOUTSTRINGMSG;
  2464. #ifdef SENDSIDE
  2465. SMESSAGECALL(OUTSTRING)
  2466. {
  2467. PLARGE_STRING pstr = (PLARGE_STRING)lParam;
  2468. DWORD cbCapture;
  2469. BOOL fAnsiReceiver = (dwSCMSFlags & SCMS_FLAGS_ANSI);
  2470. BOOL bInflateWParam = FALSE;
  2471. SETUPPWND(FNOUTSTRING)
  2472. CALC_SIZE_OUT_STRING(cbCapture, pstr);
  2473. BEGINSENDCAPTURE(FNOUTSTRING, 1, cbCapture, FALSE)
  2474. MSGDATA()->pwnd = pwndClient;
  2475. MSGDATA()->msg = msg;
  2476. /*
  2477. * Need to wParam MBCS bytes may be required to form wParam Unicode bytes
  2478. */
  2479. if (fAnsiReceiver && !(pstr->bAnsi)) {
  2480. /*
  2481. * Unicode -> Ansi
  2482. */
  2483. MSGDATA()->wParam = (wParam * sizeof(WCHAR));
  2484. PtiCurrent()->TIF_flags |= TIF_ANSILENGTH;
  2485. bInflateWParam = TRUE;
  2486. } else {
  2487. /*
  2488. * if wParam is already adjusted for ANSI, we need to re-adjust for Unicode...
  2489. *
  2490. * This logic is for following cases...
  2491. *
  2492. * +========+===============+=============+================+=============+
  2493. * |WndProc |Unicode WndProc->Ansi WndProc->Unicode WndProc->Ansi WndProc|
  2494. * +--------+---------------+-------------+----------------+-------------+
  2495. * |Length | X -> (X * 2) -> X -> (X * 2) |
  2496. * +--------+---------------+-------------+----------------+-------------+
  2497. */
  2498. if (!fAnsiReceiver && (PtiCurrent()->TIF_flags & TIF_ANSILENGTH)) {
  2499. /* adjust limit also... */
  2500. MSGDATA()->wParam = wParam / sizeof(WCHAR);
  2501. PtiCurrent()->TIF_flags &= ~TIF_ANSILENGTH;
  2502. } else {
  2503. MSGDATA()->wParam = wParam;
  2504. }
  2505. }
  2506. MSGDATA()->xParam = xParam;
  2507. MSGDATA()->xpfnProc = xpfnProc;
  2508. RESERVEBYTES(cbCapture, pOutput, cbOutput);
  2509. LOCKPWND();
  2510. MAKECALLCAPTURE(FNOUTSTRING);
  2511. UNLOCKPWND();
  2512. CHECKRETURN();
  2513. BEGINCOPYOUT()
  2514. if (retval) {
  2515. /*
  2516. * Non-zero retval means some text to copy out. Do not copy out
  2517. * more than the requested byte count 'wParam'.
  2518. */
  2519. COPYOUTLPWSTRLIMIT(pstr, (int)wParam);
  2520. } else {
  2521. /*
  2522. * A dialog function returning FALSE means no text to copy out,
  2523. * but an empty string also has retval == 0: put a null char in
  2524. * pstr for the latter case.
  2525. */
  2526. if (wParam != 0) {
  2527. if (pstr->bAnsi) {
  2528. *(PCHAR)pstr->Buffer = 0;
  2529. } else {
  2530. *(PWCHAR)pstr->Buffer = 0;
  2531. }
  2532. }
  2533. }
  2534. ENDCOPYOUT()
  2535. TRACECALLBACKMSG("SfnOUTSTRING");
  2536. ENDSENDCAPTUREOUTSTRING(LRESULT,0);
  2537. }
  2538. #endif // SENDSIDE
  2539. #ifdef RECVSIDE
  2540. RECVCALL(fnOUTSTRING, FNOUTSTRINGMSG)
  2541. {
  2542. BYTE abOutput[CALLBACKSTACKLIMIT];
  2543. BEGINRECV(0, NULL, pmsg->cbOutput);
  2544. FIXUPPOINTERS();
  2545. if (pmsg->cbOutput <= CALLBACKSTACKLIMIT)
  2546. CallbackStatus.pOutput = abOutput;
  2547. else
  2548. CallbackStatus.pOutput = pmsg->pOutput;
  2549. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  2550. CALLDATA(pwnd),
  2551. CALLDATA(msg),
  2552. CALLDATA(wParam),
  2553. (LPARAM)KPVOID_TO_PVOID(CallbackStatus.pOutput),
  2554. CALLDATA(xParam));
  2555. ENDRECV();
  2556. }
  2557. #endif // RECVSIDE
  2558. /**************************************************************************\
  2559. * fnINCNTOUTSTRING
  2560. *
  2561. * Does NOT NULL terminate string
  2562. *
  2563. * 22-Jul-1991 mikeke Created
  2564. \**************************************************************************/
  2565. typedef struct _FNINCNTOUTSTRING {
  2566. CAPTUREBUF CaptureBuf;
  2567. PWND pwnd;
  2568. UINT msg;
  2569. WPARAM wParam;
  2570. ULONG_PTR xParam;
  2571. PROC xpfnProc;
  2572. WORD cchMax;
  2573. PBYTE pOutput;
  2574. DWORD cbOutput;
  2575. } FNINCNTOUTSTRINGMSG;
  2576. #ifdef SENDSIDE
  2577. SMESSAGECALL(INCNTOUTSTRING)
  2578. {
  2579. PLARGE_STRING pstr = (PLARGE_STRING)lParam;
  2580. DWORD cbCapture;
  2581. WORD cchOriginal;
  2582. BOOL fAnsiReceiver = (dwSCMSFlags & SCMS_FLAGS_ANSI);
  2583. SETUPPWND(FNINCNTOUTSTRING)
  2584. CALC_SIZE_OUT(cbCapture, pstr);
  2585. BEGINSENDCAPTURE(FNINCNTOUTSTRING, 1, cbCapture, FALSE)
  2586. MSGDATA()->pwnd = pwndClient;
  2587. MSGDATA()->msg = msg;
  2588. MSGDATA()->wParam = wParam;
  2589. cchOriginal = (WORD)pstr->MaximumLength;
  2590. if (!pstr->bAnsi)
  2591. cchOriginal /= sizeof(WCHAR);
  2592. MSGDATA()->cchMax = (WORD)min(cchOriginal, 0xffff);
  2593. MSGDATA()->xParam = xParam;
  2594. MSGDATA()->xpfnProc = xpfnProc;
  2595. RESERVEBYTES(cbCapture, pOutput, cbOutput);
  2596. LOCKPWND();
  2597. MAKECALLCAPTURE(FNINCNTOUTSTRING)
  2598. UNLOCKPWND();
  2599. CHECKRETURN();
  2600. /*
  2601. * We don't want to do the copy out of the sender died or if
  2602. * this message was just sent as part of a CALLWNDPROC hook processing
  2603. */
  2604. BEGINCOPYOUT()
  2605. if (retval) {
  2606. /*
  2607. * Non-zero retval means some text to copy out. Do not copy out
  2608. * more than the requested char count 'wParam'.
  2609. */
  2610. COPYOUTLPWSTRLIMIT(pstr, (int)cchOriginal);
  2611. } else {
  2612. /*
  2613. * A dialog function returning FALSE means no text to copy out,
  2614. * but an empty string also has retval == 0: put a null char in
  2615. * pstr for the latter case.
  2616. */
  2617. if (pstr->bAnsi) {
  2618. *(PCHAR)pstr->Buffer = 0;
  2619. } else {
  2620. *(PWCHAR)pstr->Buffer = 0;
  2621. }
  2622. }
  2623. ENDCOPYOUT()
  2624. TRACECALLBACKMSG("SfnINCNTOUTSTRING");
  2625. ENDSENDCAPTURE(LRESULT,0);
  2626. }
  2627. #endif // SENDSIDE
  2628. #ifdef RECVSIDE
  2629. RECVCALL(fnINCNTOUTSTRING, FNINCNTOUTSTRINGMSG)
  2630. {
  2631. BYTE abOutput[CALLBACKSTACKLIMIT];
  2632. BEGINRECV(0, NULL, pmsg->cbOutput);
  2633. FIXUPPOINTERS();
  2634. if (pmsg->cbOutput <= CALLBACKSTACKLIMIT)
  2635. CallbackStatus.pOutput = abOutput;
  2636. else
  2637. CallbackStatus.pOutput = pmsg->pOutput;
  2638. *(KPWORD)CallbackStatus.pOutput = CALLDATA(cchMax);
  2639. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  2640. CALLDATA(pwnd),
  2641. CALLDATA(msg),
  2642. CALLDATA(wParam),
  2643. (LPARAM)KPVOID_TO_PVOID(CallbackStatus.pOutput),
  2644. CALLDATA(xParam));
  2645. ENDRECV();
  2646. }
  2647. #endif // RECVSIDE
  2648. /**************************************************************************\
  2649. * fnINCNTOUTSTRINGNULL
  2650. *
  2651. * wParam specifies the maximum number of bytes to copy
  2652. * the string is NULL terminated
  2653. *
  2654. * 22-Jul-1991 mikeke Created
  2655. \**************************************************************************/
  2656. typedef struct _FNINCNTOUTSTRINGNULL {
  2657. CAPTUREBUF CaptureBuf;
  2658. PWND pwnd;
  2659. UINT msg;
  2660. WPARAM wParam;
  2661. ULONG_PTR xParam;
  2662. PROC xpfnProc;
  2663. PBYTE pOutput;
  2664. DWORD cbOutput;
  2665. } FNINCNTOUTSTRINGNULLMSG;
  2666. #ifdef SENDSIDE
  2667. SMESSAGECALL(INCNTOUTSTRINGNULL)
  2668. {
  2669. PLARGE_STRING pstr = (PLARGE_STRING)lParam;
  2670. DWORD cbCapture;
  2671. BOOL fAnsiReceiver = (dwSCMSFlags & SCMS_FLAGS_ANSI);
  2672. SETUPPWND(FNINCNTOUTSTRINGNULL)
  2673. CALC_SIZE_OUT(cbCapture, pstr);
  2674. BEGINSENDCAPTURE(FNINCNTOUTSTRINGNULL, 1, cbCapture, FALSE)
  2675. if (wParam < 2) { // However unlikely, this prevents a possible GP
  2676. MSGERROR(); // on the server side.
  2677. }
  2678. MSGDATA()->pwnd = pwndClient;
  2679. MSGDATA()->msg = msg;
  2680. MSGDATA()->wParam = wParam;
  2681. MSGDATA()->xParam = xParam;
  2682. MSGDATA()->xpfnProc = xpfnProc;
  2683. RESERVEBYTES(cbCapture, pOutput, cbOutput);
  2684. LOCKPWND();
  2685. MAKECALLCAPTURE(FNINCNTOUTSTRINGNULL)
  2686. UNLOCKPWND();
  2687. CHECKRETURN();
  2688. /*
  2689. * We don't want to do the copy out of the sender died or if
  2690. * this message was just sent as part of a CALLWNDPROC hook processing
  2691. */
  2692. BEGINCOPYOUT()
  2693. if (pcbs->cbOutput != 0) {
  2694. /*
  2695. * Buffer changed means some text to copy out. Do not copy out
  2696. * more than the requested byte count 'wParam'.
  2697. */
  2698. COPYOUTLPWSTRLIMIT(pstr, (int)wParam);
  2699. }
  2700. ENDCOPYOUT()
  2701. TRACECALLBACKMSG("SfnINCNTOUTSTRINGNULL");
  2702. ENDSENDCAPTURE(LRESULT,0);
  2703. }
  2704. #endif // SENDSIDE
  2705. #ifdef RECVSIDE
  2706. RECVCALL(fnINCNTOUTSTRINGNULL, FNINCNTOUTSTRINGNULLMSG)
  2707. {
  2708. BYTE abOutput[CALLBACKSTACKLIMIT];
  2709. BEGINRECV(0, NULL, pmsg->cbOutput);
  2710. FIXUPPOINTERS();
  2711. if (pmsg->cbOutput <= CALLBACKSTACKLIMIT)
  2712. CallbackStatus.pOutput = abOutput;
  2713. else
  2714. CallbackStatus.pOutput = pmsg->pOutput;
  2715. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  2716. CALLDATA(pwnd),
  2717. CALLDATA(msg),
  2718. CALLDATA(wParam),
  2719. (LPARAM)KPVOID_TO_PVOID(CallbackStatus.pOutput),
  2720. CALLDATA(xParam));
  2721. ENDRECV();
  2722. }
  2723. #endif // RECVSIDE
  2724. /**************************************************************************\
  2725. * fnPOUTLPINT
  2726. *
  2727. * 22-Jul-1991 mikeke Created
  2728. \**************************************************************************/
  2729. typedef struct _FNPOUTLPINTMSG {
  2730. CAPTUREBUF CaptureBuf;
  2731. PWND pwnd;
  2732. UINT msg;
  2733. WPARAM wParam;
  2734. ULONG_PTR xParam;
  2735. PROC xpfnProc;
  2736. PBYTE pOutput;
  2737. DWORD cbOutput;
  2738. } FNPOUTLPINTMSG;
  2739. #ifdef SENDSIDE
  2740. SMESSAGECALL(POUTLPINT)
  2741. {
  2742. DWORD cbCapture;
  2743. LPINT pint = (LPINT)lParam;
  2744. SETUPPWND(FNPOUTLPINT)
  2745. cbCapture = (UINT)wParam * sizeof(INT);
  2746. BEGINSENDCAPTURE(FNPOUTLPINT, 1, cbCapture, FALSE)
  2747. MSGDATA()->pwnd = pwndClient;
  2748. MSGDATA()->msg = msg;
  2749. MSGDATA()->wParam = wParam;
  2750. MSGDATA()->xParam = xParam;
  2751. MSGDATA()->xpfnProc = xpfnProc;
  2752. /*
  2753. * Hooks should see the buffer content
  2754. */
  2755. if (dwSCMSFlags & SCMS_FLAGS_INONLY) {
  2756. MSGDATA()->cbOutput = cbCapture;
  2757. LARGECOPYBYTES2(pint, cbCapture, pOutput);
  2758. } else {
  2759. RESERVEBYTES(cbCapture, pOutput, cbOutput);
  2760. }
  2761. LOCKPWND();
  2762. MAKECALLCAPTURE(FNPOUTLPINT);
  2763. UNLOCKPWND();
  2764. CHECKRETURN();
  2765. BEGINCOPYOUT()
  2766. try {
  2767. ProbeForRead(pcbs->pOutput, pcbs->cbOutput, sizeof(DWORD));
  2768. memcpy(pint, pcbs->pOutput, cbCapture);
  2769. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  2770. MSGERROR();
  2771. }
  2772. ENDCOPYOUT()
  2773. TRACECALLBACKMSG("SfnPOUTLPINT");
  2774. ENDSENDCAPTURE(LRESULT,0);
  2775. }
  2776. #endif // SENDSIDE
  2777. #ifdef RECVSIDE
  2778. RECVCALL(fnPOUTLPINT, FNPOUTLPINTMSG)
  2779. {
  2780. BYTE abOutput[CALLBACKSTACKLIMIT];
  2781. BEGINRECV(0, NULL, pmsg->cbOutput);
  2782. FIXUPPOINTERS();
  2783. if (pmsg->cbOutput <= CALLBACKSTACKLIMIT)
  2784. CallbackStatus.pOutput = abOutput;
  2785. else
  2786. CallbackStatus.pOutput = pmsg->pOutput;
  2787. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  2788. CALLDATA(pwnd),
  2789. CALLDATA(msg),
  2790. CALLDATA(wParam),
  2791. (LPARAM)KPVOID_TO_PVOID(CallbackStatus.pOutput),
  2792. CALLDATA(xParam));
  2793. ENDRECV();
  2794. }
  2795. #endif // RECVSIDE
  2796. /**************************************************************************\
  2797. * fnPOPTINLPUINT
  2798. *
  2799. * NOTE!!! -- This function actually thunks arrays of INTs (32bit) and not
  2800. * WORDs (16bit). The name was left the same to prevent a global rebuild
  2801. * of client and server. The name should be changed to fnPOPTINLPINT as
  2802. * soon as we ship the beta! The corresponding callforward function in
  2803. * cf2.h should also have its name changed.
  2804. *
  2805. * 22-Jul-1991 mikeke Created
  2806. * 07-Jan-1993 JonPa Changed to pass INTs instead of WORDs
  2807. \**************************************************************************/
  2808. typedef struct _FNPOPTINLPUINTMSG {
  2809. CAPTUREBUF CaptureBuf;
  2810. PWND pwnd;
  2811. UINT msg;
  2812. WPARAM wParam;
  2813. LPWORD pw;
  2814. ULONG_PTR xParam;
  2815. PROC xpfnProc;
  2816. } FNPOPTINLPUINTMSG;
  2817. #ifdef SENDSIDE
  2818. SMESSAGECALL(POPTINLPUINT)
  2819. {
  2820. LPWORD pw = (LPWORD)lParam;
  2821. DWORD cCapture, cbCapture;
  2822. SETUPPWND(FNPOPTINLPUINT);
  2823. UNREFERENCED_PARAMETER(dwSCMSFlags);
  2824. UNREFERENCED_PARAMETER(psms);
  2825. if (lParam) {
  2826. cCapture = 1;
  2827. cbCapture = (UINT)wParam * sizeof(UINT);
  2828. } else {
  2829. cCapture = cbCapture = 0;
  2830. }
  2831. BEGINSENDCAPTURE(FNPOPTINLPUINT, cCapture, cbCapture, TRUE)
  2832. MSGDATA()->pwnd = pwndClient;
  2833. MSGDATA()->msg = msg;
  2834. MSGDATA()->wParam = wParam;
  2835. COPYBYTESOPT(pw, cbCapture);
  2836. MSGDATA()->xParam = xParam;
  2837. MSGDATA()->xpfnProc = xpfnProc;
  2838. LOCKPWND();
  2839. MAKECALLCAPTURE(FNPOPTINLPUINT);
  2840. UNLOCKPWND();
  2841. CHECKRETURN();
  2842. TRACECALLBACKMSG("SfnPOPTINLPUINT");
  2843. ENDSENDCAPTURE(LRESULT,0);
  2844. }
  2845. #endif // SENDSIDE
  2846. #ifdef RECVSIDE
  2847. RECVCALL(fnPOPTINLPUINT, FNPOPTINLPUINTMSG)
  2848. {
  2849. BEGINRECV(0, NULL, 0);
  2850. FIXUPPOINTERS();
  2851. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  2852. CALLDATA(pwnd),
  2853. CALLDATA(msg),
  2854. CALLDATA(wParam),
  2855. (LPDWORD)FIRSTFIXUPOPT(pw),
  2856. CALLDATA(xParam));
  2857. ENDRECV();
  2858. }
  2859. #endif // RECVSIDE
  2860. /**************************************************************************\
  2861. * fnINOUTLPWINDOWPOS (for WM_WINDOWPOSCHANGING message)
  2862. *
  2863. * 08-11-91 darrinm Created.
  2864. \**************************************************************************/
  2865. typedef struct _FNINOUTLPWINDOWPOSMSG {
  2866. PWND pwnd;
  2867. UINT msg;
  2868. WPARAM wParam;
  2869. WINDOWPOS wp;
  2870. ULONG_PTR xParam;
  2871. PROC xpfnProc;
  2872. } FNINOUTLPWINDOWPOSMSG;
  2873. #ifdef SENDSIDE
  2874. SMESSAGECALL(INOUTLPWINDOWPOS)
  2875. {
  2876. SETUPPWND(FNINOUTLPWINDOWPOS)
  2877. UNREFERENCED_PARAMETER(dwSCMSFlags);
  2878. BEGINSEND(FNINOUTLPWINDOWPOS)
  2879. LPWINDOWPOS pwp = (LPWINDOWPOS)lParam;
  2880. MSGDATA()->pwnd = pwndClient;
  2881. MSGDATA()->msg = msg;
  2882. MSGDATA()->wParam = wParam;
  2883. MSGDATA()->wp = *pwp;
  2884. MSGDATA()->xParam = xParam;
  2885. MSGDATA()->xpfnProc = xpfnProc;
  2886. LOCKPWND();
  2887. MAKECALL(FNINOUTLPWINDOWPOS);
  2888. UNLOCKPWND();
  2889. CHECKRETURN();
  2890. BEGINCOPYOUT()
  2891. OUTSTRUCT(pwp, WINDOWPOS);
  2892. ENDCOPYOUT()
  2893. TRACECALLBACKMSG("SfnINOUTLPWINDOWPOS");
  2894. ENDSEND(LRESULT,0);
  2895. }
  2896. #endif // SENDSIDE
  2897. #ifdef RECVSIDE
  2898. RECVCALL(fnINOUTLPWINDOWPOS, FNINOUTLPWINDOWPOSMSG)
  2899. {
  2900. BEGINRECV(0, &pmsg->wp, sizeof(pmsg->wp));
  2901. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  2902. pmsg->pwnd,
  2903. pmsg->msg,
  2904. pmsg->wParam,
  2905. PCALLDATA(wp),
  2906. pmsg->xParam);
  2907. ENDRECV();
  2908. }
  2909. #endif // RECVSIDE
  2910. /**************************************************************************\
  2911. * fnINLPWINDOWPOS (for WM_WINDOWPOSCHANGED message)
  2912. *
  2913. * 08-11-91 darrinm Created.
  2914. \**************************************************************************/
  2915. typedef struct _FNINLPWINDOWPOSMSG {
  2916. PWND pwnd;
  2917. UINT msg;
  2918. WPARAM wParam;
  2919. WINDOWPOS wp;
  2920. ULONG_PTR xParam;
  2921. PROC xpfnProc;
  2922. } FNINLPWINDOWPOSMSG;
  2923. #ifdef SENDSIDE
  2924. SMESSAGECALL(INLPWINDOWPOS)
  2925. {
  2926. SETUPPWND(FNINLPWINDOWPOS)
  2927. UNREFERENCED_PARAMETER(dwSCMSFlags);
  2928. UNREFERENCED_PARAMETER(psms);
  2929. BEGINSEND(FNINLPWINDOWPOS)
  2930. LPWINDOWPOS pwp = (LPWINDOWPOS)lParam;
  2931. MSGDATA()->pwnd = pwndClient;
  2932. MSGDATA()->msg = msg;
  2933. MSGDATA()->wParam = wParam;
  2934. MSGDATA()->wp = *pwp;
  2935. MSGDATA()->xParam = xParam;
  2936. MSGDATA()->xpfnProc = xpfnProc;
  2937. LOCKPWND();
  2938. MAKECALL(FNINLPWINDOWPOS);
  2939. UNLOCKPWND();
  2940. CHECKRETURN();
  2941. TRACECALLBACKMSG("SfnINLPWINDOWPOS");
  2942. ENDSEND(LRESULT,0);
  2943. }
  2944. #endif // SENDSIDE
  2945. #ifdef RECVSIDE
  2946. RECVCALL(fnINLPWINDOWPOS, FNINLPWINDOWPOSMSG)
  2947. {
  2948. BEGINRECV(0, NULL, 0);
  2949. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  2950. CALLDATA(pwnd),
  2951. CALLDATA(msg),
  2952. CALLDATA(wParam),
  2953. PCALLDATA(wp),
  2954. CALLDATA(xParam));
  2955. ENDRECV();
  2956. }
  2957. #endif // RECVSIDE
  2958. /**************************************************************************\
  2959. * fnINOUTNEXTMENU
  2960. *
  2961. * 22-Jul-1991 mikeke Created
  2962. \**************************************************************************/
  2963. typedef struct _FNINOUTNEXTMENUMSG {
  2964. PWND pwnd;
  2965. UINT msg;
  2966. WPARAM wParam;
  2967. MDINEXTMENU mnm;
  2968. ULONG_PTR xParam;
  2969. PROC xpfnProc;
  2970. } FNINOUTNEXTMENUMSG;
  2971. #ifdef SENDSIDE
  2972. SMESSAGECALL(INOUTNEXTMENU)
  2973. {
  2974. SETUPPWND(FNINOUTNEXTMENU)
  2975. UNREFERENCED_PARAMETER(dwSCMSFlags);
  2976. BEGINSEND(FNINOUTNEXTMENU)
  2977. MSGDATA()->pwnd = pwndClient;
  2978. MSGDATA()->msg = msg;
  2979. MSGDATA()->wParam = wParam;
  2980. MSGDATA()->xParam = xParam;
  2981. MSGDATA()->xpfnProc = xpfnProc;
  2982. MSGDATA()->mnm = *((PMDINEXTMENU)lParam);
  2983. LOCKPWND();
  2984. MAKECALL(FNINOUTNEXTMENU);
  2985. UNLOCKPWND();
  2986. CHECKRETURN();
  2987. BEGINCOPYOUT()
  2988. OUTSTRUCT(((PMDINEXTMENU)lParam), MDINEXTMENU);
  2989. ENDCOPYOUT()
  2990. TRACECALLBACKMSG("SfnINOUTNEXTMENU");
  2991. ENDSEND(LRESULT,0);
  2992. }
  2993. #endif // SENDSIDE
  2994. #ifdef RECVSIDE
  2995. RECVCALL(fnINOUTNEXTMENU, FNINOUTNEXTMENUMSG)
  2996. {
  2997. BEGINRECV(0, &pmsg->mnm, sizeof(pmsg->mnm));
  2998. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  2999. CALLDATA(pwnd),
  3000. CALLDATA(msg),
  3001. CALLDATA(wParam),
  3002. &CALLDATA(mnm),
  3003. CALLDATA(xParam));
  3004. ENDRECV();
  3005. }
  3006. #endif // RECVSIDE
  3007. /**************************************************************************\
  3008. * fnHkINLPCBTCREATESTRUCT
  3009. *
  3010. * 22-Jul-1991 mikeke Created
  3011. \**************************************************************************/
  3012. typedef struct _CREATESTRUCTDATA {
  3013. CREATESTRUCT cs;
  3014. HWND hwndInsertAfter;
  3015. } CREATESTRUCTDATA;
  3016. typedef struct _FNHKINLPCBTCREATESTRUCTMSG {
  3017. CAPTUREBUF CaptureBuf;
  3018. PWND pwnd;
  3019. UINT msg;
  3020. WPARAM wParam;
  3021. CREATESTRUCTDATA d;
  3022. PROC xpfnProc;
  3023. BOOL bAnsi;
  3024. } FNHKINLPCBTCREATESTRUCTMSG;
  3025. #ifdef SENDSIDE
  3026. LRESULT fnHkINLPCBTCREATESTRUCT(
  3027. UINT msg,
  3028. WPARAM wParam,
  3029. LPCBT_CREATEWND pcbt,
  3030. PROC xpfnProc,
  3031. BOOL fAnsiReceiver)
  3032. {
  3033. DWORD cbTitle = 0, cbClass = 0;
  3034. DWORD cCapture = 0;
  3035. CREATESTRUCTDATA csdOut;
  3036. PCREATESTRUCTEX pcreatestruct;
  3037. PWND pwnd = _GetDesktopWindow();
  3038. SETUPPWND(FNHKINLPCBTCREATESTRUCT)
  3039. /*
  3040. * Compute ANSI capture lengths. Don't capture if
  3041. * the strings are in the client's address space.
  3042. */
  3043. pcreatestruct = (PCREATESTRUCTEX)pcbt->lpcs;
  3044. if (pcreatestruct->cs.lpszName &&
  3045. ((BOOL)pcreatestruct->strName.bAnsi != fAnsiReceiver ||
  3046. IS_SYSTEM_ADDRESS((PVOID)pcreatestruct->cs.lpszName))) {
  3047. CALC_SIZE_IN(cbTitle, &pcreatestruct->strName);
  3048. cCapture++;
  3049. }
  3050. if (IS_PTR(pcreatestruct->cs.lpszClass) &&
  3051. ((BOOL)pcreatestruct->strClass.bAnsi != fAnsiReceiver ||
  3052. IS_SYSTEM_ADDRESS((PVOID)pcreatestruct->cs.lpszClass))) {
  3053. CALC_SIZE_IN(cbClass, &pcreatestruct->strClass);
  3054. cCapture++;
  3055. }
  3056. BEGINSENDCAPTURE(FNHKINLPCBTCREATESTRUCT, cCapture, cbTitle + cbClass, TRUE)
  3057. MSGDATA()->pwnd = pwndClient;
  3058. MSGDATA()->msg = msg;
  3059. MSGDATA()->wParam = wParam;
  3060. MSGDATA()->d.cs = *(pcbt->lpcs);
  3061. if (cbTitle) {
  3062. if (!pcreatestruct->strName.bAnsi) {
  3063. WORD wOrdinal;
  3064. try {
  3065. wOrdinal = *(PWORD)pcreatestruct->cs.lpszName;
  3066. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  3067. goto errorexit;
  3068. }
  3069. if (wOrdinal == 0xffff) {
  3070. /*
  3071. * Copy out an ordinal of the form 0xffff, ID.
  3072. * If the receiver is ANSI, skip the first 0xff.
  3073. */
  3074. if (fAnsiReceiver) {
  3075. if (!NT_SUCCESS(CaptureCallbackData(&mp->CaptureBuf,
  3076. (PBYTE)pcreatestruct->cs.lpszName + 1,
  3077. 3, (PVOID *)&mp->d.cs.lpszName)))
  3078. goto errorexit;
  3079. } else {
  3080. if (!NT_SUCCESS(CaptureCallbackData(&mp->CaptureBuf,
  3081. (PBYTE)pcreatestruct->cs.lpszName,
  3082. 4, (PVOID *)&mp->d.cs.lpszName)))
  3083. goto errorexit;
  3084. }
  3085. } else if (fAnsiReceiver) {
  3086. LARGECOPYSTRINGLPWSTRA(&pcreatestruct->strName, d.cs.lpszName);
  3087. } else {
  3088. LARGECOPYSTRINGLPWSTR(&pcreatestruct->strName, d.cs.lpszName);
  3089. }
  3090. } else {
  3091. BYTE bOrdinal;
  3092. try {
  3093. bOrdinal = *(PBYTE)pcreatestruct->cs.lpszName;
  3094. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  3095. goto errorexit;
  3096. }
  3097. if (bOrdinal == 0xff) {
  3098. /*
  3099. * Copy out an ordinal of the form 0xff, ID.
  3100. * If the receiver is UNICODE, expand the 0xff to 0xffff.
  3101. */
  3102. if (fAnsiReceiver) {
  3103. if (!NT_SUCCESS(CaptureCallbackData(&mp->CaptureBuf,
  3104. (PBYTE)pcreatestruct->cs.lpszName,
  3105. 3, (PVOID *)&mp->d.cs.lpszName)))
  3106. goto errorexit;
  3107. } else {
  3108. DWORD dwOrdinal;
  3109. try {
  3110. dwOrdinal = MAKELONG(0xffff,
  3111. (*(DWORD UNALIGNED *)pcreatestruct->cs.lpszName >> 8));
  3112. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  3113. goto errorexit;
  3114. }
  3115. if (!NT_SUCCESS(CaptureCallbackData(&mp->CaptureBuf,
  3116. &dwOrdinal,
  3117. 4, (PVOID *)&mp->d.cs.lpszName)))
  3118. goto errorexit;
  3119. }
  3120. } else if (fAnsiReceiver) {
  3121. LARGECOPYSTRINGLPSTR(&pcreatestruct->strName, d.cs.lpszName);
  3122. } else {
  3123. LARGECOPYSTRINGLPSTRW(&pcreatestruct->strName, d.cs.lpszName);
  3124. }
  3125. }
  3126. }
  3127. if (cbClass) {
  3128. if (!pcreatestruct->strClass.bAnsi) {
  3129. if (fAnsiReceiver) {
  3130. LARGECOPYSTRINGLPWSTRA(&pcreatestruct->strClass, d.cs.lpszClass);
  3131. } else {
  3132. LARGECOPYSTRINGLPWSTR(&pcreatestruct->strClass, d.cs.lpszClass);
  3133. }
  3134. } else {
  3135. if (fAnsiReceiver) {
  3136. LARGECOPYSTRINGLPSTR(&pcreatestruct->strClass, d.cs.lpszClass);
  3137. } else {
  3138. LARGECOPYSTRINGLPSTRW(&pcreatestruct->strClass, d.cs.lpszClass);
  3139. }
  3140. }
  3141. }
  3142. MSGDATA()->d.hwndInsertAfter = pcbt->hwndInsertAfter;
  3143. MSGDATA()->xpfnProc = xpfnProc;
  3144. MSGDATA()->bAnsi = fAnsiReceiver;
  3145. LOCKPWND();
  3146. MAKECALLCAPTURE(FNHKINLPCBTCREATESTRUCT);
  3147. UNLOCKPWND();
  3148. CHECKRETURN();
  3149. /*
  3150. * Probe output data
  3151. */
  3152. OUTSTRUCT(&csdOut, CREATESTRUCTDATA);
  3153. // MS Visual C centers its dialogs with the CBT_CREATEHOOK
  3154. pcbt->hwndInsertAfter = csdOut.hwndInsertAfter;
  3155. pcbt->lpcs->x = csdOut.cs.x;
  3156. pcbt->lpcs->y = csdOut.cs.y;
  3157. pcbt->lpcs->cx = csdOut.cs.cx;
  3158. pcbt->lpcs->cy = csdOut.cs.cy;
  3159. TRACECALLBACK("SfnHkINLPCBTCREATESTRUCT");
  3160. ENDSENDCAPTURE(DWORD,0);
  3161. }
  3162. #endif // SENDSIDE
  3163. #ifdef RECVSIDE
  3164. RECVCALL(fnHkINLPCBTCREATESTRUCT, FNHKINLPCBTCREATESTRUCTMSG)
  3165. {
  3166. CBT_CREATEWND cbt;
  3167. BEGINRECV(0, &pmsg->d, sizeof(pmsg->d));
  3168. FIXUPPOINTERS();
  3169. cbt.lpcs = &pmsg->d.cs;
  3170. cbt.hwndInsertAfter = pmsg->d.hwndInsertAfter;
  3171. if ((ULONG_PTR)pmsg->d.cs.lpszName > gHighestUserAddress)
  3172. pmsg->d.cs.lpszName = REBASEPTR(pmsg->pwnd, pmsg->d.cs.lpszName);
  3173. if ((ULONG_PTR)pmsg->d.cs.lpszClass > gHighestUserAddress)
  3174. pmsg->d.cs.lpszClass = REBASEPTR(pmsg->pwnd, pmsg->d.cs.lpszClass);
  3175. if (pmsg->bAnsi) {
  3176. retval = DispatchHookA(
  3177. pmsg->msg,
  3178. pmsg->wParam,
  3179. (LPARAM)&cbt,
  3180. (HOOKPROC)pmsg->xpfnProc);
  3181. } else {
  3182. retval = DispatchHookW(
  3183. pmsg->msg,
  3184. pmsg->wParam,
  3185. (LPARAM)&cbt,
  3186. (HOOKPROC)pmsg->xpfnProc);
  3187. }
  3188. pmsg->d.hwndInsertAfter = cbt.hwndInsertAfter;
  3189. pmsg->d.cs.x = cbt.lpcs->x;
  3190. pmsg->d.cs.y = cbt.lpcs->y;
  3191. pmsg->d.cs.cx = cbt.lpcs->cx;
  3192. pmsg->d.cs.cy = cbt.lpcs->cy;
  3193. ENDRECV();
  3194. }
  3195. #endif // RECVSIDE
  3196. #ifdef REDIRECTION
  3197. /**************************************************************************\
  3198. * fnHkINLPPOINT
  3199. *
  3200. * 29-Jan-1999 clupu Created
  3201. \**************************************************************************/
  3202. typedef struct _FNHKINLPPOINTMSG {
  3203. DWORD nCode;
  3204. WPARAM wParam;
  3205. POINT pt;
  3206. ULONG_PTR xParam;
  3207. PROC xpfnProc;
  3208. } FNHKINLPPOINTMSG;
  3209. #ifdef SENDSIDE
  3210. LRESULT fnHkINLPPOINT(
  3211. IN DWORD nCode,
  3212. IN WPARAM wParam,
  3213. IN OUT LPPOINT ppt,
  3214. IN ULONG_PTR xParam,
  3215. IN PROC xpfnProc)
  3216. {
  3217. SETUP(FNHKINLPPOINT)
  3218. BEGINSEND(FNHKINLPPOINT)
  3219. MSGDATA()->nCode = nCode;
  3220. MSGDATA()->wParam = wParam;
  3221. MSGDATA()->pt = *ppt;
  3222. MSGDATA()->xParam = xParam;
  3223. MSGDATA()->xpfnProc = xpfnProc;
  3224. MAKECALL(FNHKINLPPOINT);
  3225. CHECKRETURN();
  3226. /*
  3227. * Probe output data
  3228. */
  3229. OUTSTRUCT(ppt, POINT);
  3230. TRACECALLBACK("SfnHkINLPPOINT");
  3231. ENDSEND(DWORD,0);
  3232. }
  3233. #endif // SENDSIDE
  3234. #ifdef RECVSIDE
  3235. RECVCALL(fnHkINLPPOINT, FNHKINLPPOINTMSG)
  3236. {
  3237. BEGINRECV(0, &pmsg->pt, sizeof(POINT));
  3238. retval = (DWORD)CALLPROC(pmsg->xpfnProc)(
  3239. pmsg->nCode,
  3240. pmsg->wParam,
  3241. PCALLDATA(pt),
  3242. pmsg->xParam);
  3243. ENDRECV();
  3244. }
  3245. #endif // RECVSIDE
  3246. #endif // REDIRECTION
  3247. /**************************************************************************\
  3248. * fnHkINLPRECT
  3249. *
  3250. * 22-Jul-1991 mikeke Created
  3251. \**************************************************************************/
  3252. typedef struct _FNHKINLPRECTMSG {
  3253. DWORD nCode;
  3254. WPARAM wParam;
  3255. RECT rect;
  3256. ULONG_PTR xParam;
  3257. PROC xpfnProc;
  3258. } FNHKINLPRECTMSG;
  3259. #ifdef SENDSIDE
  3260. LRESULT fnHkINLPRECT(
  3261. IN DWORD nCode,
  3262. IN WPARAM wParam,
  3263. IN OUT LPRECT prect,
  3264. IN ULONG_PTR xParam,
  3265. IN PROC xpfnProc)
  3266. {
  3267. SETUP(FNHKINLPRECT)
  3268. BEGINSEND(FNHKINLPRECT)
  3269. MSGDATA()->nCode = nCode;
  3270. MSGDATA()->wParam = wParam;
  3271. MSGDATA()->rect = *prect;
  3272. MSGDATA()->xParam = xParam;
  3273. MSGDATA()->xpfnProc = xpfnProc;
  3274. MAKECALL(FNHKINLPRECT);
  3275. CHECKRETURN();
  3276. /*
  3277. * Probe output data
  3278. */
  3279. OUTSTRUCT(prect, RECT);
  3280. TRACECALLBACK("SfnHkINLPRECT");
  3281. ENDSEND(DWORD,0);
  3282. }
  3283. #endif // SENDSIDE
  3284. #ifdef RECVSIDE
  3285. RECVCALL(fnHkINLPRECT, FNHKINLPRECTMSG)
  3286. {
  3287. BEGINRECV(0, &pmsg->rect, sizeof(RECT));
  3288. retval = (DWORD)CALLPROC(pmsg->xpfnProc)(
  3289. pmsg->nCode,
  3290. pmsg->wParam,
  3291. PCALLDATA(rect),
  3292. pmsg->xParam);
  3293. ENDRECV();
  3294. }
  3295. #endif // RECVSIDE
  3296. /**************************************************************************\
  3297. * yyy
  3298. *
  3299. * 22-Jul-1991 mikeke Created
  3300. \**************************************************************************/
  3301. typedef struct _FNHKINDWORDMSG {
  3302. GENERICHOOKHEADER ghh;
  3303. DWORD flags;
  3304. LPARAM lParam;
  3305. } FNHKINDWORDMSG;
  3306. #ifdef SENDSIDE
  3307. LRESULT fnHkINDWORD(
  3308. IN DWORD nCode,
  3309. IN WPARAM wParam,
  3310. IN LPARAM lParam,
  3311. IN ULONG_PTR xParam,
  3312. IN PROC xpfnProc,
  3313. IN OUT LPDWORD lpFlags)
  3314. {
  3315. SETUP(FNHKINDWORD)
  3316. BEGINSEND(FNHKINDWORD)
  3317. MSGDATA()->ghh.nCode = nCode;
  3318. MSGDATA()->ghh.wParam = wParam;
  3319. MSGDATA()->lParam = lParam;
  3320. MSGDATA()->ghh.xParam = xParam;
  3321. MSGDATA()->ghh.xpfnProc = xpfnProc;
  3322. MSGDATA()->flags = *lpFlags;
  3323. MAKECALL(FNHKINDWORD);
  3324. CHECKRETURN();
  3325. /*
  3326. * Probe output data
  3327. */
  3328. OUTBITMASK(lpFlags, DWORD, HF_HOOKFAULTED);
  3329. TRACECALLBACK("SfnHkINDWORD");
  3330. ENDSEND(DWORD,0);
  3331. }
  3332. #endif // SENDSIDE
  3333. #ifdef RECVSIDE
  3334. RECVCALL(fnHkINDWORD, FNHKINDWORDMSG)
  3335. {
  3336. BEGINRECV(0, &pmsg->flags, sizeof(pmsg->flags));
  3337. retval = CallHookWithSEH((LPGENERICHOOKHEADER)pmsg, (LPVOID)pmsg->lParam, &pmsg->flags, retval);
  3338. ENDRECV();
  3339. }
  3340. #endif // RECVSIDE
  3341. /**************************************************************************\
  3342. * yyy
  3343. *
  3344. * 22-Jul-1991 mikeke Created
  3345. \**************************************************************************/
  3346. typedef struct _FNHKINLPMSGDATA {
  3347. MSG msg;
  3348. DWORD flags;
  3349. } FNHKINLPMSGDATA;
  3350. typedef struct _FNHKINLPMSGMSG {
  3351. GENERICHOOKHEADER ghh;
  3352. FNHKINLPMSGDATA d;
  3353. } FNHKINLPMSGMSG;
  3354. #ifdef SENDSIDE
  3355. LRESULT fnHkINLPMSG(
  3356. DWORD nCode,
  3357. WPARAM wParam,
  3358. LPMSG pmsg,
  3359. ULONG_PTR xParam,
  3360. PROC xpfnProc,
  3361. BOOL bAnsi,
  3362. LPDWORD lpFlags)
  3363. {
  3364. SETUP(FNHKINLPMSG)
  3365. WPARAM wParamOriginal;
  3366. BEGINSEND(FNHKINLPMSG)
  3367. MSGDATA()->ghh.nCode = nCode;
  3368. MSGDATA()->ghh.wParam = wParam;
  3369. MSGDATA()->d.msg = *pmsg;
  3370. if (((WM_CHAR == pmsg->message) || (WM_SYSCHAR == pmsg->message)) && bAnsi) {
  3371. wParamOriginal = pmsg->wParam;
  3372. RtlWCSMessageWParamCharToMB(pmsg->message, &(MSGDATA()->d.msg.wParam));
  3373. }
  3374. MSGDATA()->ghh.xParam = xParam;
  3375. MSGDATA()->ghh.xpfnProc = xpfnProc;
  3376. MSGDATA()->d.flags = *lpFlags;
  3377. MAKECALL(FNHKINLPMSG);
  3378. CHECKRETURN();
  3379. /*
  3380. * Probe output data
  3381. */
  3382. try {
  3383. ProbeForRead(pcbs->pOutput, sizeof(FNHKINLPMSGDATA), sizeof(DWORD));
  3384. *pmsg = ((FNHKINLPMSGDATA *)pcbs->pOutput)->msg;
  3385. COPY_FLAG(*lpFlags, ((FNHKINLPMSGDATA *)pcbs->pOutput)->flags, HF_HOOKFAULTED);
  3386. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  3387. MSGERROR();
  3388. }
  3389. if (((WM_CHAR == pmsg->message) || (WM_SYSCHAR == pmsg->message)) && bAnsi) {
  3390. /*
  3391. * LATER, DBCS should be handled correctly.
  3392. */
  3393. /*
  3394. * If the ANSI hook didn't change the wParam we sent it, restore
  3395. * the Unicode value we started with, otherwise we just collapse
  3396. * Unicode chars to an ANSI codepage (best visual fit or ?)
  3397. * The rotten "Intellitype" point32.exe does this.
  3398. */
  3399. if (MSGDATA()->d.msg.wParam == pmsg->wParam) {
  3400. pmsg->wParam = wParamOriginal;
  3401. } else {
  3402. RtlMBMessageWParamCharToWCS(pmsg->message, &pmsg->wParam);
  3403. }
  3404. }
  3405. TRACECALLBACK("SfnHkINLPMSG");
  3406. ENDSEND(DWORD,0);
  3407. }
  3408. #endif // SENDSIDE
  3409. #ifdef RECVSIDE
  3410. RECVCALL(fnHkINLPMSG, FNHKINLPMSGMSG)
  3411. {
  3412. BEGINRECV(0, &pmsg->d, sizeof(pmsg->d));
  3413. /*
  3414. * LATER, DBCS should be handled correctly.
  3415. */
  3416. retval = CallHookWithSEH((LPGENERICHOOKHEADER)pmsg, &pmsg->d.msg, &pmsg->d.flags, retval);
  3417. ENDRECV();
  3418. }
  3419. #endif // RECVSIDE
  3420. /**************************************************************************\
  3421. * yyy
  3422. *
  3423. * 22-Jul-1991 mikeke Created
  3424. \**************************************************************************/
  3425. typedef struct _FNHKINLPMOUSEHOOKSTRUCTEXMSG {
  3426. GENERICHOOKHEADER ghh;
  3427. DWORD flags;
  3428. MOUSEHOOKSTRUCTEX mousehookstructex;
  3429. } FNHKINLPMOUSEHOOKSTRUCTEXMSG;
  3430. #ifdef SENDSIDE
  3431. LRESULT fnHkINLPMOUSEHOOKSTRUCTEX(
  3432. IN DWORD nCode,
  3433. IN WPARAM wParam,
  3434. IN LPMOUSEHOOKSTRUCTEX pmousehookstructex,
  3435. IN ULONG_PTR xParam,
  3436. IN PROC xpfnProc,
  3437. IN OUT LPDWORD lpFlags)
  3438. {
  3439. SETUP(FNHKINLPMOUSEHOOKSTRUCTEX)
  3440. BEGINSEND(FNHKINLPMOUSEHOOKSTRUCTEX)
  3441. MSGDATA()->ghh.nCode = nCode;
  3442. MSGDATA()->ghh.wParam = wParam;
  3443. MSGDATA()->mousehookstructex = *pmousehookstructex;
  3444. MSGDATA()->ghh.xParam = xParam;
  3445. MSGDATA()->ghh.xpfnProc = xpfnProc;
  3446. MSGDATA()->flags = *lpFlags;
  3447. MAKECALL(FNHKINLPMOUSEHOOKSTRUCTEX);
  3448. CHECKRETURN();
  3449. /*
  3450. * Probe output data
  3451. */
  3452. OUTBITMASK(lpFlags, DWORD, HF_HOOKFAULTED);
  3453. TRACECALLBACK("SfnHkINLPMOUSEHOOKSTRUCTEX");
  3454. ENDSEND(DWORD,0);
  3455. }
  3456. #endif // SENDSIDE
  3457. #ifdef RECVSIDE
  3458. RECVCALL(fnHkINLPMOUSEHOOKSTRUCTEX, FNHKINLPMOUSEHOOKSTRUCTEXMSG)
  3459. {
  3460. BEGINRECV(0, &pmsg->flags, sizeof(pmsg->flags));
  3461. retval = CallHookWithSEH((LPGENERICHOOKHEADER)pmsg, &pmsg->mousehookstructex, &pmsg->flags, retval);
  3462. ENDRECV();
  3463. }
  3464. #endif // RECVSIDE
  3465. /**************************************************************************\
  3466. * kbdll
  3467. *
  3468. * 06-Jun-1996 clupu Created
  3469. \**************************************************************************/
  3470. typedef struct _FNHKINLPKBDLLHOOKSTRUCTMSG {
  3471. GENERICHOOKHEADER ghh;
  3472. KBDLLHOOKSTRUCT kbdllhookstruct;
  3473. } FNHKINLPKBDLLHOOKSTRUCTMSG;
  3474. #ifdef SENDSIDE
  3475. LRESULT fnHkINLPKBDLLHOOKSTRUCT(
  3476. IN DWORD nCode,
  3477. IN WPARAM wParam,
  3478. IN LPKBDLLHOOKSTRUCT pkbdllhookstruct,
  3479. IN ULONG_PTR xParam,
  3480. IN PROC xpfnProc)
  3481. {
  3482. SETUP(FNHKINLPKBDLLHOOKSTRUCT)
  3483. BEGINSEND(FNHKINLPKBDLLHOOKSTRUCT)
  3484. MSGDATA()->ghh.nCode = nCode;
  3485. MSGDATA()->ghh.wParam = wParam;
  3486. MSGDATA()->kbdllhookstruct = *pkbdllhookstruct;
  3487. MSGDATA()->ghh.xParam = xParam;
  3488. MSGDATA()->ghh.xpfnProc = xpfnProc;
  3489. MAKECALL(FNHKINLPKBDLLHOOKSTRUCT);
  3490. CHECKRETURN();
  3491. TRACECALLBACK("SfnHkINLPKBDLLHOOKSTRUCT");
  3492. ENDSEND(DWORD,0);
  3493. }
  3494. #endif // SENDSIDE
  3495. #ifdef RECVSIDE
  3496. RECVCALL(fnHkINLPKBDLLHOOKSTRUCT, FNHKINLPKBDLLHOOKSTRUCTMSG)
  3497. {
  3498. BEGINRECV(0, &pmsg->kbdllhookstruct, sizeof(pmsg->kbdllhookstruct));
  3499. retval = (DWORD)CALLPROC(pmsg->ghh.xpfnProc)(
  3500. pmsg->ghh.nCode,
  3501. pmsg->ghh.wParam,
  3502. &pmsg->kbdllhookstruct,
  3503. pmsg->ghh.xParam);
  3504. ENDRECV();
  3505. }
  3506. #endif // RECVSIDE
  3507. /**************************************************************************\
  3508. * msll
  3509. *
  3510. * 06-Jun-1996 clupu Created
  3511. \**************************************************************************/
  3512. typedef struct _FNHKINLPMSLLHOOKSTRUCTMSG {
  3513. GENERICHOOKHEADER ghh;
  3514. MSLLHOOKSTRUCT msllhookstruct;
  3515. } FNHKINLPMSLLHOOKSTRUCTMSG;
  3516. #ifdef SENDSIDE
  3517. LRESULT fnHkINLPMSLLHOOKSTRUCT(
  3518. IN DWORD nCode,
  3519. IN WPARAM wParam,
  3520. IN LPMSLLHOOKSTRUCT pmsllhookstruct,
  3521. IN ULONG_PTR xParam,
  3522. IN PROC xpfnProc)
  3523. {
  3524. SETUP(FNHKINLPMSLLHOOKSTRUCT)
  3525. BEGINSEND(FNHKINLPMSLLHOOKSTRUCT)
  3526. MSGDATA()->ghh.nCode = nCode;
  3527. MSGDATA()->ghh.wParam = wParam;
  3528. MSGDATA()->msllhookstruct = *pmsllhookstruct;
  3529. MSGDATA()->ghh.xParam = xParam;
  3530. MSGDATA()->ghh.xpfnProc = xpfnProc;
  3531. MAKECALL(FNHKINLPMSLLHOOKSTRUCT);
  3532. CHECKRETURN();
  3533. TRACECALLBACK("SfnHkINLPMSLLHOOKSTRUCT");
  3534. ENDSEND(DWORD,0);
  3535. }
  3536. #endif // SENDSIDE
  3537. #ifdef RECVSIDE
  3538. RECVCALL(fnHkINLPMSLLHOOKSTRUCT, FNHKINLPMSLLHOOKSTRUCTMSG)
  3539. {
  3540. BEGINRECV(0, &pmsg->msllhookstruct, sizeof(pmsg->msllhookstruct));
  3541. retval = (DWORD)CALLPROC(pmsg->ghh.xpfnProc)(
  3542. pmsg->ghh.nCode,
  3543. pmsg->ghh.wParam,
  3544. &pmsg->msllhookstruct,
  3545. pmsg->ghh.xParam);
  3546. ENDRECV();
  3547. }
  3548. #endif // RECVSIDE
  3549. #ifdef REDIRECTION
  3550. /**************************************************************************\
  3551. * ht
  3552. *
  3553. * 21-Jan-1999 clupu Created
  3554. \**************************************************************************/
  3555. typedef struct _FNHKINLPHTHOOKSTRUCTMSG {
  3556. GENERICHOOKHEADER ghh;
  3557. HTHOOKSTRUCT hthookstruct;
  3558. } FNHKINLPHTHOOKSTRUCTMSG;
  3559. #ifdef SENDSIDE
  3560. LRESULT fnHkINLPHTHOOKSTRUCT(
  3561. IN DWORD nCode,
  3562. IN WPARAM wParam,
  3563. IN OUT LPHTHOOKSTRUCT phthookstruct,
  3564. IN ULONG_PTR xParam,
  3565. IN PROC xpfnProc)
  3566. {
  3567. SETUP(FNHKINLPHTHOOKSTRUCT)
  3568. BEGINSEND(FNHKINLPHTHOOKSTRUCT)
  3569. MSGDATA()->ghh.nCode = nCode;
  3570. MSGDATA()->ghh.wParam = wParam;
  3571. MSGDATA()->hthookstruct = *phthookstruct;
  3572. MSGDATA()->ghh.xParam = xParam;
  3573. MSGDATA()->ghh.xpfnProc = xpfnProc;
  3574. MAKECALL(FNHKINLPHTHOOKSTRUCT);
  3575. CHECKRETURN();
  3576. /*
  3577. * Probe output data
  3578. */
  3579. if (phthookstruct != NULL)
  3580. OUTSTRUCT(phthookstruct, HTHOOKSTRUCT);
  3581. TRACECALLBACK("SfnHkINLPHTHOOKSTRUCT");
  3582. ENDSEND(DWORD,0);
  3583. }
  3584. #endif // SENDSIDE
  3585. #ifdef RECVSIDE
  3586. RECVCALL(fnHkINLPHTHOOKSTRUCT, FNHKINLPHTHOOKSTRUCTMSG)
  3587. {
  3588. BEGINRECV(0, &pmsg->hthookstruct, sizeof(pmsg->hthookstruct));
  3589. retval = (DWORD)CALLPROC(pmsg->ghh.xpfnProc)(
  3590. pmsg->ghh.nCode,
  3591. pmsg->ghh.wParam,
  3592. &pmsg->hthookstruct,
  3593. pmsg->ghh.xParam);
  3594. ENDRECV();
  3595. }
  3596. #endif // RECVSIDE
  3597. #endif // REDIRECTION
  3598. /**************************************************************************\
  3599. * yyy
  3600. *
  3601. * 22-Jul-1991 mikeke Created
  3602. \**************************************************************************/
  3603. typedef struct _FNHKOPTINLPEVENTMSGMSG {
  3604. DWORD nCode;
  3605. WPARAM wParam;
  3606. LPEVENTMSGMSG peventmsgmsg;
  3607. ULONG_PTR xParam;
  3608. PROC xpfnProc;
  3609. EVENTMSG eventmsgmsg;
  3610. } FNHKOPTINLPEVENTMSGMSG;
  3611. #ifdef SENDSIDE
  3612. LRESULT fnHkOPTINLPEVENTMSG(
  3613. IN DWORD nCode,
  3614. IN WPARAM wParam,
  3615. IN OUT LPEVENTMSGMSG peventmsgmsg,
  3616. IN ULONG_PTR xParam,
  3617. IN PROC xpfnProc)
  3618. {
  3619. SETUP(FNHKOPTINLPEVENTMSG)
  3620. BEGINSEND(FNHKOPTINLPEVENTMSG)
  3621. MSGDATA()->nCode = nCode;
  3622. MSGDATA()->wParam = wParam;
  3623. COPYSTRUCTOPT(eventmsgmsg);
  3624. MSGDATA()->xParam = xParam;
  3625. MSGDATA()->xpfnProc = xpfnProc;
  3626. MAKECALL(FNHKOPTINLPEVENTMSG);
  3627. CHECKRETURN();
  3628. /*
  3629. * Probe output data
  3630. */
  3631. if (peventmsgmsg != NULL)
  3632. OUTSTRUCT(peventmsgmsg, EVENTMSG);
  3633. TRACECALLBACK("SfnHkOPTINLPEVENTMSG");
  3634. ENDSEND(DWORD,-1);
  3635. }
  3636. #endif // SENDSIDE
  3637. #ifdef RECVSIDE
  3638. RECVCALL(fnHkOPTINLPEVENTMSG, FNHKOPTINLPEVENTMSGMSG)
  3639. {
  3640. PHOOK phk;
  3641. BEGINRECV(-1, &pmsg->eventmsgmsg, sizeof(pmsg->eventmsgmsg));
  3642. if (pmsg->wParam) {
  3643. phk = (PHOOK)HMValidateHandle((HANDLE)pmsg->wParam, TYPE_HOOK);
  3644. if (phk != NULL) {
  3645. /*
  3646. * The HF_NEEDHC_SKIP bit is passed on from the pti when we need to
  3647. * pass on a HC_SKIP
  3648. */
  3649. if ((phk->flags & HF_NEEDHC_SKIP) &&
  3650. (HIWORD(pmsg->nCode) == WH_JOURNALPLAYBACK)) {
  3651. UserAssert(LOWORD(pmsg->nCode) == HC_GETNEXT);
  3652. CALLPROC(pmsg->xpfnProc)(
  3653. MAKELONG(HC_SKIP, HIWORD(pmsg->nCode)),
  3654. 0,
  3655. 0,
  3656. pmsg->xParam);
  3657. }
  3658. /*
  3659. * Make sure the hook wasn't free'd during the last call to the app
  3660. */
  3661. if (HMIsMarkDestroy(phk)) {
  3662. retval = (DWORD)-1;
  3663. goto AllDoneHere;
  3664. }
  3665. }
  3666. }
  3667. pmsg->wParam = 0;
  3668. retval = (DWORD)CALLPROC(pmsg->xpfnProc)(
  3669. pmsg->nCode,
  3670. pmsg->wParam,
  3671. PCALLDATAOPT(eventmsgmsg),
  3672. pmsg->xParam);
  3673. AllDoneHere:
  3674. ENDRECV();
  3675. }
  3676. #endif // RECVSIDE
  3677. /**************************************************************************\
  3678. * yyy
  3679. *
  3680. * 22-Jul-1991 mikeke Created
  3681. \**************************************************************************/
  3682. /*
  3683. * Create a structure big enough to hold the larges item LPARAM points to.
  3684. */
  3685. typedef union _DEBUGLPARAM {
  3686. MSG msg; // WH_GETMESSAGE, WH_MSGFILTER, WH_SYSMSGFILTER
  3687. CWPSTRUCT cwp; // WH_CALLWNDPROC
  3688. CWPRETSTRUCT cwpret; // WH_CALLWNDPROCRET
  3689. MOUSEHOOKSTRUCTEX mhs; // WH_MOUSE, HCBT_CLICKSKIPPED
  3690. EVENTMSG em; // WH_JOURNALRECORD, WH_JOURNALPLAYBACK
  3691. CBTACTIVATESTRUCT as; // HCBT_ACTIVATE
  3692. CBT_CREATEWND cw; // HCBT_CREATEWND
  3693. RECT rc; // HCBT_MOVESIZE
  3694. } DEBUGLPARAM;
  3695. typedef struct _FNHKINLPDEBUGHOOKSTRUCTMSG {
  3696. DWORD nCode;
  3697. WPARAM wParam;
  3698. DEBUGHOOKINFO debughookstruct;
  3699. DEBUGLPARAM dbgLParam;
  3700. DWORD cbDbgLParam;
  3701. ULONG_PTR xParam;
  3702. PROC xpfnProc;
  3703. } FNHKINLPDEBUGHOOKSTRUCTMSG;
  3704. #ifdef SENDSIDE
  3705. LRESULT fnHkINLPDEBUGHOOKSTRUCT(
  3706. IN DWORD nCode,
  3707. IN WPARAM wParam,
  3708. IN LPDEBUGHOOKINFO pdebughookstruct,
  3709. IN ULONG_PTR xParam,
  3710. IN PROC xpfnProc)
  3711. {
  3712. SETUP(FNHKINLPDEBUGHOOKSTRUCT)
  3713. BEGINSEND(FNHKINLPDEBUGHOOKSTRUCT)
  3714. MSGDATA()->nCode = nCode;
  3715. MSGDATA()->wParam = wParam;
  3716. MSGDATA()->debughookstruct = *pdebughookstruct;
  3717. MSGDATA()->xParam = xParam;
  3718. MSGDATA()->xpfnProc = xpfnProc;
  3719. MSGDATA()->cbDbgLParam = GetDebugHookLParamSize(wParam, pdebughookstruct);
  3720. switch(wParam) {
  3721. case WH_MOUSE_LL:
  3722. case WH_KEYBOARD_LL:
  3723. return 0;
  3724. }
  3725. /*
  3726. * if LPARAM in the debug hook points to struct then copy it over
  3727. */
  3728. if (MSGDATA()->cbDbgLParam) {
  3729. try {
  3730. RtlCopyMemory(&MSGDATA()->dbgLParam, (BYTE *)pdebughookstruct->lParam,
  3731. MSGDATA()->cbDbgLParam);
  3732. } except (W32ExceptionHandler(FALSE, RIP_WARNING)) {
  3733. MSGERROR();
  3734. }
  3735. }
  3736. MAKECALL(FNHKINLPDEBUGHOOKSTRUCT);
  3737. CHECKRETURN();
  3738. TRACECALLBACK("SfnHkINLPDEBUGHOOKSTRUCT");
  3739. ENDSEND(DWORD,0);
  3740. }
  3741. #endif // SENDSIDE
  3742. #ifdef RECVSIDE
  3743. RECVCALL(fnHkINLPDEBUGHOOKSTRUCT, FNHKINLPDEBUGHOOKSTRUCTMSG)
  3744. {
  3745. BEGINRECV(0, NULL, 0);
  3746. if (pmsg->cbDbgLParam) {
  3747. pmsg->debughookstruct.lParam = (LPARAM)&(pmsg->dbgLParam);
  3748. }
  3749. retval = (DWORD)CALLPROC(pmsg->xpfnProc)(
  3750. pmsg->nCode,
  3751. pmsg->wParam,
  3752. &(pmsg->debughookstruct),
  3753. pmsg->xParam);
  3754. ENDRECV();
  3755. }
  3756. #endif // RECVSIDE
  3757. DWORD GetDebugHookLParamSize(
  3758. IN WPARAM wParam,
  3759. IN PDEBUGHOOKINFO pdebughookstruct)
  3760. {
  3761. DWORD cbDbgLParam = 0;
  3762. switch(wParam) {
  3763. case WH_MSGFILTER:
  3764. case WH_SYSMSGFILTER:
  3765. case WH_GETMESSAGE:
  3766. cbDbgLParam = sizeof(MSG);
  3767. break;
  3768. case WH_CALLWNDPROC:
  3769. cbDbgLParam = sizeof(CWPSTRUCT);
  3770. break;
  3771. case WH_CALLWNDPROCRET:
  3772. cbDbgLParam = sizeof(CWPRETSTRUCT);
  3773. break;
  3774. case WH_MOUSE:
  3775. cbDbgLParam = sizeof(MOUSEHOOKSTRUCTEX);
  3776. break;
  3777. case WH_JOURNALRECORD:
  3778. case WH_JOURNALPLAYBACK:
  3779. cbDbgLParam = sizeof(EVENTMSG);
  3780. break;
  3781. case WH_CBT:
  3782. switch (pdebughookstruct->code) {
  3783. case HCBT_ACTIVATE:
  3784. cbDbgLParam = sizeof(CBTACTIVATESTRUCT);
  3785. break;
  3786. case HCBT_CLICKSKIPPED:
  3787. cbDbgLParam = sizeof(MOUSEHOOKSTRUCTEX);
  3788. break;
  3789. case HCBT_CREATEWND:
  3790. cbDbgLParam = sizeof(CBT_CREATEWND);
  3791. break;
  3792. case HCBT_MOVESIZE:
  3793. cbDbgLParam = sizeof(RECT);
  3794. break;
  3795. }
  3796. break;
  3797. case WH_SHELL:
  3798. if (pdebughookstruct->code == HSHELL_GETMINRECT) {
  3799. cbDbgLParam = sizeof(RECT);
  3800. }
  3801. break;
  3802. }
  3803. return cbDbgLParam;
  3804. }
  3805. /**************************************************************************\
  3806. * fnHkINLPCBTACTIVATESTRUCT
  3807. *
  3808. * 17-Mar-1992 jonpa Created
  3809. \**************************************************************************/
  3810. typedef struct _FNHKINLPCBTACTIVATESTRUCTMSG {
  3811. DWORD nCode;
  3812. WPARAM wParam;
  3813. CBTACTIVATESTRUCT cbtactivatestruct;
  3814. ULONG_PTR xParam;
  3815. PROC xpfnProc;
  3816. } FNHKINLPCBTACTIVATESTRUCTMSG;
  3817. #ifdef SENDSIDE
  3818. LRESULT fnHkINLPCBTACTIVATESTRUCT(
  3819. IN DWORD nCode,
  3820. IN WPARAM wParam,
  3821. IN LPCBTACTIVATESTRUCT pcbtactivatestruct,
  3822. IN ULONG_PTR xParam,
  3823. IN PROC xpfnProc)
  3824. {
  3825. SETUP(FNHKINLPCBTACTIVATESTRUCT)
  3826. BEGINSEND(FNHKINLPCBTACTIVATESTRUCT)
  3827. MSGDATA()->nCode = nCode;
  3828. MSGDATA()->wParam = wParam;
  3829. MSGDATA()->cbtactivatestruct = *pcbtactivatestruct;
  3830. MSGDATA()->xParam = xParam;
  3831. MSGDATA()->xpfnProc = xpfnProc;
  3832. MAKECALL(FNHKINLPCBTACTIVATESTRUCT);
  3833. CHECKRETURN();
  3834. TRACECALLBACK("SfnHkINLPCBTACTIVATESTRUCT");
  3835. ENDSEND(DWORD,0);
  3836. }
  3837. #endif // SENDSIDE
  3838. #ifdef RECVSIDE
  3839. RECVCALL(fnHkINLPCBTACTIVATESTRUCT, FNHKINLPCBTACTIVATESTRUCTMSG)
  3840. {
  3841. BEGINRECV(0, NULL, 0);
  3842. retval = (DWORD)CALLPROC(pmsg->xpfnProc)(
  3843. pmsg->nCode,
  3844. pmsg->wParam,
  3845. &(pmsg->cbtactivatestruct),
  3846. pmsg->xParam);
  3847. ENDRECV();
  3848. }
  3849. #endif // RECVSIDE
  3850. /**************************************************************************\
  3851. * ClientLoadMenu
  3852. *
  3853. * 22-Jul-1991 mikeke Created
  3854. \**************************************************************************/
  3855. typedef struct _CLIENTLOADMENUMSG {
  3856. CAPTUREBUF CaptureBuf;
  3857. HANDLE hmod;
  3858. UNICODE_STRING strName;
  3859. } CLIENTLOADMENUMSG;
  3860. #ifdef SENDSIDE
  3861. PMENU xxxClientLoadMenu(
  3862. IN HANDLE hmod,
  3863. IN PUNICODE_STRING pstrName)
  3864. {
  3865. DWORD cCapture, cbCapture;
  3866. SETUP(CLIENTLOADMENU)
  3867. if (pstrName->MaximumLength) {
  3868. cCapture = 1;
  3869. cbCapture = pstrName->MaximumLength;
  3870. } else
  3871. cCapture = cbCapture = 0;
  3872. BEGINSENDCAPTURE(CLIENTLOADMENU, cCapture, cbCapture, TRUE)
  3873. MSGDATA()->hmod = hmod;
  3874. COPYSTRINGID(strName);
  3875. MAKECALLCAPTURE(CLIENTLOADMENU);
  3876. CHECKRETURN();
  3877. retval = (ULONG_PTR)HtoP((HMENU)retval);
  3878. TRACECALLBACK("ClientLoadMenu");
  3879. ENDSENDCAPTURE(PMENU,0);
  3880. }
  3881. #endif // SENDSIDE
  3882. #ifdef RECVSIDE
  3883. RECVCALL(ClientLoadMenu, CLIENTLOADMENUMSG)
  3884. {
  3885. BEGINRECV(0, NULL, 0);
  3886. FIXUPPOINTERS();
  3887. retval = (ULONG_PTR)LoadMenu(
  3888. CALLDATA(hmod) ? CALLDATA(hmod) : hmodUser,
  3889. (LPTSTR)FIXUPSTRINGID(strName));
  3890. ENDRECV();
  3891. }
  3892. #endif // RECVSIDE
  3893. /**************************************************************************\
  3894. * xxxClientLoadImage
  3895. *
  3896. * 28-Aug-1995 ChrisWil Created
  3897. \**************************************************************************/
  3898. typedef struct _CLIENTLOADIMAGEMSG {
  3899. CAPTUREBUF CaptureBuf;
  3900. UNICODE_STRING strModName;
  3901. UNICODE_STRING strName;
  3902. UINT uImageType;
  3903. int cxDesired;
  3904. int cyDesired;
  3905. UINT LR_flags;
  3906. BOOL fWallpaper;
  3907. } CLIENTLOADIMAGEMSG;
  3908. #ifdef SENDSIDE
  3909. HANDLE xxxClientLoadImage(
  3910. IN PUNICODE_STRING pstrName,
  3911. IN ATOM atomModName,
  3912. IN WORD wImageType,
  3913. IN int cxDesired,
  3914. IN int cyDesired,
  3915. IN UINT LR_flags,
  3916. IN BOOL fWallpaper)
  3917. {
  3918. DWORD cCapture;
  3919. DWORD cbCapture;
  3920. WCHAR awszModName[MAX_PATH];
  3921. UNICODE_STRING strModName;
  3922. PUNICODE_STRING pstrModName = &strModName;
  3923. SETUP(CLIENTLOADIMAGE)
  3924. if (pstrName->MaximumLength) {
  3925. cCapture = 1;
  3926. cbCapture = pstrName->MaximumLength;
  3927. } else {
  3928. cCapture =
  3929. cbCapture = 0;
  3930. }
  3931. if (atomModName && atomModName != atomUSER32) {
  3932. UserGetAtomName(atomModName, awszModName, MAX_PATH);
  3933. RtlInitUnicodeString(&strModName, awszModName);
  3934. } else {
  3935. strModName.Length = strModName.MaximumLength = 0;
  3936. strModName.Buffer = NULL;
  3937. }
  3938. if (pstrModName->MaximumLength) {
  3939. cCapture++;
  3940. cbCapture += pstrModName->MaximumLength;
  3941. }
  3942. BEGINSENDCAPTURE(CLIENTLOADIMAGE, cCapture, cbCapture, TRUE)
  3943. COPYSTRINGOPT(strModName);
  3944. COPYSTRINGID(strName);
  3945. MSGDATA()->uImageType = (UINT)wImageType;
  3946. MSGDATA()->cxDesired = cxDesired;
  3947. MSGDATA()->cyDesired = cyDesired;
  3948. MSGDATA()->LR_flags = LR_flags;
  3949. MSGDATA()->fWallpaper = fWallpaper;
  3950. MAKECALLCAPTURE(CLIENTLOADIMAGE);
  3951. CHECKRETURN();
  3952. if (retval && (wImageType != IMAGE_BITMAP)) {
  3953. retval = (ULONG_PTR)HMRevalidateHandle((HANDLE)retval);
  3954. }
  3955. TRACECALLBACK("ClientLoadImage");
  3956. ENDSENDCAPTURE(PCURSOR,0);
  3957. }
  3958. #endif // SENDSIDE
  3959. #ifdef RECVSIDE
  3960. RECVCALL(ClientLoadImage, CLIENTLOADIMAGEMSG)
  3961. {
  3962. HMODULE hmod;
  3963. LPTSTR filepart;
  3964. LPTSTR lpszName;
  3965. TCHAR szFullPath[MAX_PATH];
  3966. TCHAR szExpandedPath[MAX_PATH];
  3967. DWORD dwRet;
  3968. BEGINRECV(0, NULL, 0);
  3969. FIXUPPOINTERS();
  3970. if (hmod = (HMODULE)FIXUPSTRINGIDOPT(strModName)) {
  3971. if ((hmod = GetModuleHandle((LPTSTR)hmod)) == NULL) {
  3972. MSGERROR();
  3973. }
  3974. }
  3975. /*
  3976. * Find the file. This normalizes the filename.
  3977. */
  3978. lpszName = (LPTSTR)FIXUPSTRINGID(strName);
  3979. if (CALLDATA(fWallpaper)) {
  3980. /*
  3981. * Expand any environment strings in the path. This is beneficial
  3982. * for people using roaming profiles. See bug #89188.
  3983. */
  3984. dwRet = ExpandEnvironmentStrings(lpszName, szExpandedPath, MAX_PATH);
  3985. /*
  3986. * dwRet > MAX_PATH means that the buffer we supplied was too small. If
  3987. * this happens, there's no way the LoadImage can succeed - even if the
  3988. * buffer were big enough, as the filename can't possibly refer to a
  3989. * valid file - so fail the call.
  3990. */
  3991. if (dwRet == 0 || dwRet > MAX_PATH) {
  3992. MSGERROR();
  3993. }
  3994. if (!SearchPath(NULL,
  3995. szExpandedPath,
  3996. TEXT(".bmp"),
  3997. ARRAY_SIZE(szFullPath),
  3998. szFullPath,
  3999. &filepart)) {
  4000. MSGERROR();
  4001. }
  4002. lpszName = szFullPath;
  4003. }
  4004. retval = (ULONG_PTR)LoadImage(hmod,
  4005. lpszName,
  4006. CALLDATA(uImageType),
  4007. CALLDATA(cxDesired),
  4008. CALLDATA(cyDesired),
  4009. CALLDATA(LR_flags));
  4010. ENDRECV();
  4011. }
  4012. #endif // RECVSIDE
  4013. /***********************************************************************\
  4014. * xxxClientCopyImage
  4015. *
  4016. * Returns: hIconCopy - note LR_flags could cause this to be the same as
  4017. * what came in.
  4018. *
  4019. * 11/3/1995 Created SanfordS
  4020. \***********************************************************************/
  4021. typedef struct _CLIENTCOPYIMAGEMSG {
  4022. HANDLE hImage;
  4023. UINT uImageType;
  4024. int cxDesired;
  4025. int cyDesired;
  4026. UINT LR_flags;
  4027. } CLIENTCOPYIMAGEMSG;
  4028. #ifdef SENDSIDE
  4029. HANDLE xxxClientCopyImage(
  4030. IN HANDLE hImage,
  4031. IN UINT uImageType,
  4032. IN int cxDesired,
  4033. IN int cyDesired,
  4034. IN UINT LR_flags)
  4035. {
  4036. SETUP(CLIENTCOPYIMAGE)
  4037. BEGINSEND(CLIENTCOPYIMAGE)
  4038. MSGDATA()->hImage = hImage;
  4039. MSGDATA()->uImageType = uImageType;
  4040. MSGDATA()->cxDesired = cxDesired;
  4041. MSGDATA()->cyDesired = cyDesired;
  4042. MSGDATA()->LR_flags = LR_flags;
  4043. MAKECALL(CLIENTCOPYIMAGE);
  4044. CHECKRETURN();
  4045. if (retval && (uImageType != IMAGE_BITMAP)) {
  4046. retval = (ULONG_PTR)HMRevalidateHandle((HANDLE)retval);
  4047. }
  4048. TRACECALLBACK("ClientCopyImage");
  4049. ENDSEND(HANDLE,0);
  4050. }
  4051. #endif // SENDSIDE
  4052. #ifdef RECVSIDE
  4053. RECVCALL(ClientCopyImage, CLIENTCOPYIMAGEMSG)
  4054. {
  4055. BEGINRECV(0, NULL, 0);
  4056. retval = (ULONG_PTR)InternalCopyImage(CALLDATA(hImage),
  4057. CALLDATA(uImageType),
  4058. CALLDATA(cxDesired),
  4059. CALLDATA(cyDesired),
  4060. CALLDATA(LR_flags));
  4061. ENDRECV();
  4062. }
  4063. #endif // RECVSIDE
  4064. /**************************************************************************\
  4065. * yyy
  4066. *
  4067. * 22-Jul-1991 mikeke Created
  4068. \**************************************************************************/
  4069. typedef struct _CLIENTGETLISTBOXSTRINGMSG {
  4070. CAPTUREBUF CaptureBuf;
  4071. PWND pwnd;
  4072. UINT msg;
  4073. WPARAM wParam;
  4074. ULONG_PTR xParam;
  4075. PROC xpfn;
  4076. PBYTE pOutput;
  4077. DWORD cbOutput;
  4078. } CLIENTGETLISTBOXSTRINGMSG;
  4079. #ifdef SENDSIDE
  4080. DWORD ClientGetListboxString(
  4081. IN PWND pwnd,
  4082. IN UINT msg,
  4083. IN WPARAM wParam,
  4084. OUT PVOID pdata,
  4085. IN ULONG_PTR xParam,
  4086. IN PROC xpfn,
  4087. IN DWORD dwSCMSFlags,
  4088. IN BOOL bNotString,
  4089. IN PSMS psms)
  4090. {
  4091. DWORD cbCapture;
  4092. DWORD cchRet;
  4093. PLARGE_STRING pstr;
  4094. BOOL fAnsiReceiver = (dwSCMSFlags & SCMS_FLAGS_ANSI);
  4095. SETUPPWND(CLIENTGETLISTBOXSTRING)
  4096. CheckLock(pwnd);
  4097. pstr = (PLARGE_STRING)pdata;
  4098. cbCapture = pstr->MaximumLength;
  4099. BEGINSENDCAPTURE(CLIENTGETLISTBOXSTRING, 1, cbCapture, FALSE)
  4100. MSGDATA()->pwnd = pwndClient;
  4101. MSGDATA()->msg = msg;
  4102. MSGDATA()->wParam = wParam;
  4103. MSGDATA()->xParam = xParam;
  4104. MSGDATA()->xpfn = xpfn;
  4105. RESERVEBYTES(cbCapture, pOutput, cbOutput);
  4106. LOCKPWND();
  4107. MAKECALLCAPTURE(CLIENTGETLISTBOXSTRING);
  4108. UNLOCKPWND();
  4109. CHECKRETURN();
  4110. BEGINCOPYOUT()
  4111. if (bNotString) {
  4112. /*
  4113. * This is a 4-byte "object" for ownerdraw listboxes without
  4114. * the LBS_HASSTRINGS style.
  4115. */
  4116. OUTSTRUCT((PULONG_PTR)pstr->Buffer, ULONG_PTR);
  4117. } else {
  4118. COPYOUTLPWSTRLIMIT(pstr,
  4119. pstr->bAnsi ? (int)pstr->MaximumLength :
  4120. (int)pstr->MaximumLength / sizeof(WCHAR));
  4121. }
  4122. cchRet = pstr->Length;
  4123. if (!pstr->bAnsi)
  4124. cchRet *= sizeof(WCHAR);
  4125. if (!bNotString && retval != LB_ERR && retval > cchRet) {
  4126. RIPMSG2(RIP_WARNING, "GetListBoxString: limit %lX chars to %lX\n",
  4127. retval, cchRet);
  4128. retval = cchRet;
  4129. }
  4130. ENDCOPYOUT()
  4131. TRACECALLBACK("ClientGetListboxString");
  4132. ENDSENDCAPTURE(DWORD,0);
  4133. }
  4134. #endif // SENDSIDE
  4135. #ifdef RECVSIDE
  4136. RECVCALL(ClientGetListboxString, CLIENTGETLISTBOXSTRINGMSG)
  4137. {
  4138. BYTE abOutput[CALLBACKSTACKLIMIT];
  4139. BEGINRECV(0, NULL, pmsg->cbOutput);
  4140. FIXUPPOINTERS();
  4141. if (pmsg->cbOutput <= CALLBACKSTACKLIMIT)
  4142. CallbackStatus.pOutput = abOutput;
  4143. else
  4144. CallbackStatus.pOutput = pmsg->pOutput;
  4145. retval = (DWORD)_ClientGetListboxString(
  4146. CALLDATA(pwnd),
  4147. CALLDATA(msg),
  4148. CALLDATA(wParam),
  4149. (LPSTR)KPVOID_TO_PVOID(CallbackStatus.pOutput),
  4150. CALLDATA(xParam),
  4151. CALLDATA(xpfn));
  4152. ENDRECV();
  4153. }
  4154. #endif // RECVSIDE
  4155. /**************************************************************************\
  4156. * yyy
  4157. *
  4158. * 22-Jul-1991 mikeke Created
  4159. \**************************************************************************/
  4160. typedef struct _CLIENTLOADLIBRARYMSG {
  4161. CAPTUREBUF CaptureBuf;
  4162. UNICODE_STRING strLib;
  4163. ULONG_PTR offPfnInitUserApiHook;
  4164. } CLIENTLOADLIBRARYMSG;
  4165. #ifdef SENDSIDE
  4166. HANDLE ClientLoadLibrary(
  4167. IN PUNICODE_STRING pstrLib,
  4168. IN ULONG_PTR offPfnInitUserApiHook)
  4169. {
  4170. SETUP(CLIENTLOADLIBRARY)
  4171. BEGINSENDCAPTURE(CLIENTLOADLIBRARY, 1, pstrLib->MaximumLength, TRUE)
  4172. MSGDATA()->offPfnInitUserApiHook = offPfnInitUserApiHook;
  4173. COPYSTRING(strLib);
  4174. MAKECALLCAPTURE(CLIENTLOADLIBRARY);
  4175. CHECKRETURN();
  4176. TRACECALLBACK("ClientLoadLibrary");
  4177. ENDSENDCAPTURE(HANDLE,0);
  4178. }
  4179. #endif // SENDSIDE
  4180. #ifdef RECVSIDE
  4181. RECVCALL(ClientLoadLibrary, CLIENTLOADLIBRARYMSG)
  4182. {
  4183. BEGINRECV(0, NULL, 0);
  4184. FIXUPPOINTERS();
  4185. retval = (ULONG_PTR)LoadLibraryEx((LPTSTR)FIXUPSTRING(strLib), NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
  4186. /*
  4187. * If we're loading the module containing the UserApiHook's,
  4188. * make sure it's correctly initialized.
  4189. */
  4190. if ((retval != 0) && CALLDATA(offPfnInitUserApiHook)) {
  4191. if (!InitUserApiHook((HMODULE)retval, CALLDATA(offPfnInitUserApiHook))) {
  4192. FreeLibrary((HMODULE)retval);
  4193. retval = 0;
  4194. MSGERROR();
  4195. }
  4196. }
  4197. ENDRECV();
  4198. }
  4199. #endif // RECVSIDE
  4200. /**************************************************************************\
  4201. * yyy
  4202. *
  4203. * 22-Jul-1991 mikeke Created
  4204. \**************************************************************************/
  4205. typedef struct _CLIENTFREELIBRARYMSG {
  4206. HANDLE hmod;
  4207. } CLIENTFREELIBRARYMSG;
  4208. #ifdef SENDSIDE
  4209. BOOL ClientFreeLibrary(
  4210. IN HANDLE hmod)
  4211. {
  4212. SETUP(CLIENTFREELIBRARY)
  4213. BEGINSEND(CLIENTFREELIBRARY)
  4214. MSGDATA()->hmod = hmod;
  4215. MAKECALL(CLIENTFREELIBRARY);
  4216. CHECKRETURN();
  4217. TRACECALLBACK("ClientFreeLibrary");
  4218. ENDSEND(BOOL,0);
  4219. }
  4220. #endif // SENDSIDE
  4221. #ifdef RECVSIDE
  4222. RECVCALL(ClientFreeLibrary, CLIENTFREELIBRARYMSG)
  4223. {
  4224. BEGINRECV(0, NULL, 0);
  4225. /*
  4226. * Make sure we don't free a UserApiHook module that's in use.
  4227. */
  4228. if (!ClearUserApiHook(CALLDATA(hmod))) {
  4229. MSGERROR();
  4230. }
  4231. retval = (DWORD)FreeLibrary(CALLDATA(hmod));
  4232. ENDRECV();
  4233. }
  4234. #endif // RECVSIDE
  4235. #ifdef MESSAGE_PUMP_HOOK
  4236. /**************************************************************************\
  4237. * GetMessageMPH()
  4238. *
  4239. * 06-Dec-2000 JStall Created
  4240. \**************************************************************************/
  4241. typedef struct _CLIENTGETMESSAGEMPHMSG {
  4242. HWND hwndFilter;
  4243. UINT msgMin;
  4244. UINT msgMax;
  4245. UINT flags;
  4246. BOOL fGetMessage;
  4247. } CLIENTGETMESSAGEMPHMSG;
  4248. #ifdef SENDSIDE
  4249. BOOL ClientGetMessageMPH(
  4250. IN MSG * pmsg,
  4251. IN HWND hwndFilter,
  4252. IN UINT msgMin,
  4253. IN UINT msgMax,
  4254. IN UINT flags,
  4255. IN BOOL fGetMessage)
  4256. {
  4257. SETUP(CLIENTGETMESSAGEMPH)
  4258. BEGINSEND(CLIENTGETMESSAGEMPH)
  4259. MSGDATA()->hwndFilter = hwndFilter;
  4260. MSGDATA()->msgMin = msgMin;
  4261. MSGDATA()->msgMax = msgMax;
  4262. MSGDATA()->flags = flags;
  4263. MSGDATA()->fGetMessage = fGetMessage;
  4264. MAKECALL(CLIENTGETMESSAGEMPH);
  4265. CHECKRETURN();
  4266. OUTSTRUCT(pmsg, MSG);
  4267. TRACECALLBACK("ClientGetMessageMPH");
  4268. ENDSEND(BOOL,0);
  4269. }
  4270. #endif // SENDSIDE
  4271. #ifdef RECVSIDE
  4272. RECVCALL(ClientGetMessageMPH, CLIENTGETMESSAGEMPHMSG)
  4273. {
  4274. MSG msg;
  4275. BEGINRECV(0, &msg, sizeof(msg));
  4276. retval = (ULONG_PTR)(gmph.pfnInternalGetMessage)(&msg, CALLDATA(hwndFilter),
  4277. CALLDATA(msgMin), CALLDATA(msgMax), CALLDATA(flags), CALLDATA(fGetMessage));
  4278. ENDRECV();
  4279. }
  4280. #endif // RECVSIDE
  4281. /**************************************************************************\
  4282. * WaitMessageMPH()
  4283. *
  4284. * 06-Dec-2000 JStall Created
  4285. \**************************************************************************/
  4286. typedef struct _CLIENTWAITMESSAGEEXMPHMSG {
  4287. UINT fsWakeMask;
  4288. DWORD Timeout;
  4289. } CLIENTWAITMESSAGEEXMPHMSG;
  4290. #ifdef SENDSIDE
  4291. BOOL ClientWaitMessageExMPH(
  4292. IN UINT fsWakeMask,
  4293. IN DWORD Timeout)
  4294. {
  4295. SETUP(CLIENTWAITMESSAGEEXMPH)
  4296. BEGINSEND(CLIENTWAITMESSAGEEXMPH)
  4297. MSGDATA()->fsWakeMask = fsWakeMask;
  4298. MSGDATA()->Timeout = Timeout;
  4299. MAKECALL(CLIENTWAITMESSAGEEXMPH);
  4300. CHECKRETURN();
  4301. TRACECALLBACK("ClientWaitMessageExMPH");
  4302. ENDSEND(BOOL,0);
  4303. }
  4304. #endif // SENDSIDE
  4305. #ifdef RECVSIDE
  4306. RECVCALL(ClientWaitMessageExMPH, CLIENTWAITMESSAGEEXMPHMSG)
  4307. {
  4308. BEGINRECV(0, NULL, 0);
  4309. retval = (ULONG_PTR)(gmph.pfnWaitMessageEx)(CALLDATA(fsWakeMask), CALLDATA(Timeout));
  4310. ENDRECV();
  4311. }
  4312. #endif // RECVSIDE
  4313. #endif // MESSAGE_PUMP_HOOK
  4314. /**************************************************************************\
  4315. * xxxClientGetCharsetInfo
  4316. *
  4317. * 96-06-11 IanJa Created
  4318. \**************************************************************************/
  4319. typedef struct _CLIENTGETCHARSETINFOMSG {
  4320. LCID lcid;
  4321. CHARSETINFO cs;
  4322. } CLIENTGETCHARSETINFOMSG;
  4323. #ifdef SENDSIDE
  4324. BOOL xxxClientGetCharsetInfo(
  4325. IN LCID lcid,
  4326. OUT PCHARSETINFO pcs)
  4327. {
  4328. SETUP(CLIENTGETCHARSETINFO)
  4329. BEGINSEND(CLIENTGETSCHARSETINFO)
  4330. MSGDATA()->lcid = lcid;
  4331. MAKECALL(CLIENTGETCHARSETINFO);
  4332. CHECKRETURN();
  4333. OUTSTRUCT(pcs, CHARSETINFO);
  4334. TRACECALLBACK("ClientGetCharsetInfo");
  4335. ENDSEND(BOOL,0);
  4336. }
  4337. #endif // SENDSIDE
  4338. #ifdef RECVSIDE
  4339. RECVCALL(ClientGetCharsetInfo, CLIENTGETCHARSETINFOMSG)
  4340. {
  4341. BEGINRECV(0, &pmsg->cs, sizeof(CHARSETINFO));
  4342. // TCI_SRCLOCALE = 0x1000
  4343. // Sundown: lcid value should be zero-extended in the TCI_SRCLOCALE case.
  4344. retval = (DWORD)TranslateCharsetInfo((DWORD *)ULongToPtr( pmsg->lcid ), &pmsg->cs, TCI_SRCLOCALE);
  4345. ENDRECV();
  4346. }
  4347. #endif // RECVSIDE
  4348. /**************************************************************************\
  4349. * ClientFreeDDEHandle
  4350. *
  4351. * 9-29-91 sanfords Created.
  4352. \**************************************************************************/
  4353. typedef struct _CLIENTFREEDDEHANDLEMSG {
  4354. HANDLE hClient;
  4355. DWORD flags;
  4356. } CLIENTFREEDDEHANDLEMSG;
  4357. #ifdef SENDSIDE
  4358. DWORD ClientFreeDDEHandle(
  4359. IN HANDLE hClient,
  4360. IN DWORD flags)
  4361. {
  4362. SETUP(CLIENTFREEDDEHANDLE)
  4363. BEGINSEND(CLIENTFREEDDEHANDLE)
  4364. MSGDATA()->hClient = hClient;
  4365. MSGDATA()->flags = flags;
  4366. MAKECALL(CLIENTFREEDDEHANDLE);
  4367. CHECKRETURN();
  4368. TRACECALLBACK("ClientFreeDDEHandle");
  4369. ENDSEND(DWORD, 0);
  4370. }
  4371. #endif // SENDSIDE
  4372. #ifdef RECVSIDE
  4373. RECVCALL(ClientFreeDDEHandle, CLIENTFREEDDEHANDLEMSG)
  4374. {
  4375. BEGINRECV(0, NULL, 0);
  4376. _ClientFreeDDEHandle(CALLDATA(hClient), CALLDATA(flags));
  4377. ENDRECV();
  4378. }
  4379. #endif // RECVSIDE
  4380. /**************************************************************************\
  4381. * ClientGetDDEFlags
  4382. *
  4383. * This function is used to get a peek at the wStatus flags packed within
  4384. * DDE handles - this could either be within the DdePack structure directly
  4385. * or within the direct data handle given or referenced via the DdePack
  4386. * structure. flags is used to figure out the right thing to do.
  4387. *
  4388. * 9-29-91 sanfords Created.
  4389. \**************************************************************************/
  4390. typedef struct _CLIENTGETDDEFLAGSMSG {
  4391. HANDLE hClient;
  4392. DWORD flags;
  4393. } CLIENTGETDDEFLAGSMSG;
  4394. #ifdef SENDSIDE
  4395. DWORD ClientGetDDEFlags(
  4396. IN HANDLE hClient,
  4397. IN DWORD flags)
  4398. {
  4399. SETUP(CLIENTGETDDEFLAGS)
  4400. BEGINSEND(CLIENTGETDDEFLAGS)
  4401. MSGDATA()->hClient = hClient;
  4402. MSGDATA()->flags = flags;
  4403. MAKECALL(CLIENTGETDDEFLAGS);
  4404. CHECKRETURN();
  4405. TRACECALLBACK("ClientGetDDEFlags");
  4406. ENDSEND(DWORD, 0);
  4407. }
  4408. #endif // SENDSIDE
  4409. #ifdef RECVSIDE
  4410. RECVCALL(ClientGetDDEFlags, CLIENTGETDDEFLAGSMSG)
  4411. {
  4412. BEGINRECV(0, NULL, 0);
  4413. retval = _ClientGetDDEFlags(CALLDATA(hClient), CALLDATA(flags));
  4414. ENDRECV();
  4415. }
  4416. #endif // RECVSIDE
  4417. /************************************************************************
  4418. * ClientCopyDDEIn1
  4419. *
  4420. * History:
  4421. * 10-22-91 sanfords Created
  4422. \***********************************************************************/
  4423. typedef struct _CLIENTCOPYDDEIN1MSG {
  4424. HANDLE hClient; // client side DDE handle - non-0 on initial call
  4425. DWORD flags;
  4426. } CLIENTCOPYDDEIN1MSG;
  4427. #ifdef SENDSIDE
  4428. DWORD xxxClientCopyDDEIn1(
  4429. HANDLE hClient,
  4430. DWORD flags,
  4431. PINTDDEINFO *ppi)
  4432. {
  4433. PINTDDEINFO pi;
  4434. INTDDEINFO IntDdeInfo;
  4435. SETUP(CLIENTCOPYDDEIN1)
  4436. BEGINSEND(CLIENTCOPYDDEIN1)
  4437. retval = FAIL_POST;
  4438. *ppi = NULL;
  4439. MSGDATA()->hClient = hClient;
  4440. MSGDATA()->flags = flags;
  4441. MAKECALL(CLIENTCOPYDDEIN1);
  4442. CHECKRETURN();
  4443. if (retval != DO_POST) {
  4444. MSGERROR();
  4445. }
  4446. try {
  4447. OUTSTRUCT(&IntDdeInfo, INTDDEINFO);
  4448. pi = (PINTDDEINFO)UserAllocPool(
  4449. sizeof(INTDDEINFO) + IntDdeInfo.cbDirect +
  4450. IntDdeInfo.cbIndirect, TAG_DDE);
  4451. if (pi != NULL) {
  4452. *ppi = pi;
  4453. *pi = IntDdeInfo;
  4454. if (IntDdeInfo.cbDirect) {
  4455. RtlCopyMemory((PBYTE)pi + sizeof(INTDDEINFO),
  4456. IntDdeInfo.pDirect,
  4457. IntDdeInfo.cbDirect);
  4458. }
  4459. if (IntDdeInfo.cbIndirect) {
  4460. RtlCopyMemory((PBYTE)pi + sizeof(INTDDEINFO) +
  4461. IntDdeInfo.cbDirect,
  4462. IntDdeInfo.pIndirect,
  4463. IntDdeInfo.cbIndirect);
  4464. }
  4465. xxxClientCopyDDEIn2(pi);
  4466. } else {
  4467. retval = FAILNOFREE_POST;
  4468. }
  4469. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  4470. if (pi != NULL)
  4471. UserFreePool(pi);
  4472. retval = FAILNOFREE_POST;
  4473. MSGERROR();
  4474. }
  4475. TRACECALLBACK("ClientCopyDDEIn1");
  4476. ENDSEND(DWORD, retval);
  4477. }
  4478. #endif // SENDSIDE
  4479. #ifdef RECVSIDE
  4480. RECVCALL(ClientCopyDDEIn1, CLIENTCOPYDDEIN1MSG)
  4481. {
  4482. INTDDEINFO IntDdeInfo;
  4483. BEGINRECV(0, &IntDdeInfo, sizeof(INTDDEINFO));
  4484. IntDdeInfo.flags = CALLDATA(flags);
  4485. retval = _ClientCopyDDEIn1(CALLDATA(hClient), &IntDdeInfo);
  4486. ENDRECV();
  4487. }
  4488. #endif // RECVSIDE
  4489. /************************************************************************
  4490. * ClientCopyDDEIn2
  4491. *
  4492. * History:
  4493. * 9-3-91 sanfords Created
  4494. \***********************************************************************/
  4495. typedef struct _CLIENTCOPYDDEIN2MSG {
  4496. INTDDEINFO IntDdeInfo;
  4497. } CLIENTCOPYDDEIN2MSG;
  4498. #ifdef SENDSIDE
  4499. BOOL xxxClientCopyDDEIn2(
  4500. PINTDDEINFO pi)
  4501. {
  4502. SETUP(CLIENTCOPYDDEIN2)
  4503. BEGINSEND(CLIENTCOPYDDEIN2)
  4504. MSGDATA()->IntDdeInfo = *pi;
  4505. MAKECALL(CLIENTCOPYDDEIN2);
  4506. CHECKRETURN();
  4507. TRACECALLBACK("ClientCopyDDEIn2");
  4508. ENDSEND(BOOL, 0);
  4509. }
  4510. #endif // SENDSIDE
  4511. #ifdef RECVSIDE
  4512. RECVCALL(ClientCopyDDEIn2, CLIENTCOPYDDEIN2MSG)
  4513. {
  4514. BEGINRECV(0, NULL, 0);
  4515. _ClientCopyDDEIn2(PCALLDATA(IntDdeInfo));
  4516. ENDRECV();
  4517. }
  4518. #endif // RECVSIDE
  4519. /************************************************************************
  4520. * ClientCopyDDEOut2
  4521. *
  4522. * History:
  4523. * 10-22-91 sanfords Created
  4524. \***********************************************************************/
  4525. typedef struct _CLIENTCOPYDDEOUT2MSG {
  4526. INTDDEINFO IntDdeInfo;
  4527. } CLIENTCOPYDDEOUT2MSG;
  4528. #ifdef SENDSIDE
  4529. DWORD xxxClientCopyDDEOut2(
  4530. PINTDDEINFO pi)
  4531. {
  4532. SETUP(CLIENTCOPYDDEOUT2)
  4533. BEGINSEND(CLIENTCOPYDDEOUT2)
  4534. MSGDATA()->IntDdeInfo = *pi;
  4535. MAKECALL(CLIENTCOPYDDEOUT2);
  4536. /*
  4537. * This read is covered by a try/except in ClientCopyDDEOut1.
  4538. */
  4539. pi->hDirect = MSGDATA()->IntDdeInfo.hDirect;
  4540. CHECKRETURN();
  4541. TRACECALLBACK("ClientCopyDDEOut2");
  4542. ENDSEND(DWORD, 0);
  4543. }
  4544. #endif // SENDSIDE
  4545. #ifdef RECVSIDE
  4546. RECVCALL(ClientCopyDDEOut2, CLIENTCOPYDDEOUT2MSG)
  4547. {
  4548. BEGINRECV(0, NULL, 0);
  4549. retval = _ClientCopyDDEOut2(PCALLDATA(IntDdeInfo));
  4550. ENDRECV();
  4551. }
  4552. #endif // RECVSIDE
  4553. /************************************************************************
  4554. * ClientCopyDDEOut1
  4555. *
  4556. * History:
  4557. * 10-22-91 sanfords Created
  4558. \***********************************************************************/
  4559. typedef struct _CLIENTCOPYDDEOUT1MSG {
  4560. INTDDEINFO IntDdeInfo;
  4561. } CLIENTCOPYDDEOUT1MSG;
  4562. #ifdef SENDSIDE
  4563. HANDLE xxxClientCopyDDEOut1(
  4564. PINTDDEINFO pi)
  4565. {
  4566. INTDDEINFO IntDdeInfo;
  4567. SETUP(CLIENTCOPYDDEOUT1)
  4568. BEGINSEND(CLIENTCOPYDDEOUT1)
  4569. MSGDATA()->IntDdeInfo = *pi;
  4570. MAKECALL(CLIENTCOPYDDEOUT1);
  4571. CHECKRETURN();
  4572. if (retval) {
  4573. try {
  4574. OUTSTRUCT(&IntDdeInfo, INTDDEINFO);
  4575. if (pi->cbDirect) {
  4576. ProbeForWrite(IntDdeInfo.pDirect,
  4577. pi->cbDirect,
  4578. sizeof(BYTE));
  4579. RtlCopyMemory(IntDdeInfo.pDirect,
  4580. (PBYTE)pi + sizeof(INTDDEINFO),
  4581. pi->cbDirect);
  4582. }
  4583. if (pi->cbIndirect) {
  4584. ProbeForWrite(IntDdeInfo.pIndirect,
  4585. pi->cbIndirect,
  4586. sizeof(BYTE));
  4587. RtlCopyMemory(IntDdeInfo.pIndirect,
  4588. (PBYTE)pi + sizeof(INTDDEINFO) + pi->cbDirect,
  4589. pi->cbIndirect);
  4590. }
  4591. if (IntDdeInfo.hDirect != NULL) {
  4592. BOOL fSuccess = xxxClientCopyDDEOut2(&IntDdeInfo);
  4593. if (fSuccess && IntDdeInfo.flags & XS_EXECUTE) {
  4594. /*
  4595. * In case value was changed by Execute Fixup.
  4596. */
  4597. retval = (ULONG_PTR)IntDdeInfo.hDirect;
  4598. }
  4599. }
  4600. *pi = IntDdeInfo;
  4601. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  4602. retval = 0;
  4603. MSGERROR();
  4604. }
  4605. }
  4606. TRACECALLBACK("ClientCopyDDEOut1");
  4607. ENDSEND(HANDLE, 0);
  4608. }
  4609. #endif // SENDSIDE
  4610. #ifdef RECVSIDE
  4611. RECVCALL(ClientCopyDDEOut1, CLIENTCOPYDDEOUT1MSG)
  4612. {
  4613. BEGINRECV(0, &pmsg->IntDdeInfo, sizeof(INTDDEINFO));
  4614. retval = (ULONG_PTR)_ClientCopyDDEOut1(&pmsg->IntDdeInfo);
  4615. ENDRECV();
  4616. }
  4617. #endif // RECVSIDE
  4618. /**************************************************************************\
  4619. * ClientEventCallback
  4620. *
  4621. * 11-11-91 sanfords Created
  4622. \**************************************************************************/
  4623. typedef struct _CLIENTEVENTCALLBACKMSG {
  4624. CAPTUREBUF CaptureBuf;
  4625. PVOID pcii;
  4626. PVOID pep;
  4627. } CLIENTEVENTCALLBACKMSG;
  4628. #ifdef SENDSIDE
  4629. DWORD ClientEventCallback(
  4630. IN PVOID pcii,
  4631. IN PEVENT_PACKET pep)
  4632. {
  4633. DWORD cbCapture = pep->cbEventData +
  4634. sizeof(EVENT_PACKET) - sizeof(DWORD);
  4635. SETUP(CLIENTEVENTCALLBACK)
  4636. BEGINSENDCAPTURE(CLIENTEVENTCALLBACK, 1, cbCapture, TRUE)
  4637. MSGDATA()->pcii = pcii;
  4638. COPYBYTES(pep, cbCapture);
  4639. MAKECALLCAPTURE(CLIENTEVENTCALLBACK);
  4640. CHECKRETURN();
  4641. TRACECALLBACK("ClientEventCallback");
  4642. ENDSENDCAPTURE(DWORD,0);
  4643. }
  4644. #endif // SENDSIDE
  4645. #ifdef RECVSIDE
  4646. RECVCALL(ClientEventCallback, CLIENTEVENTCALLBACKMSG)
  4647. {
  4648. BEGINRECV(0, NULL, 0);
  4649. FIXUPPOINTERS();
  4650. _ClientEventCallback(CALLDATA(pcii), (PEVENT_PACKET)FIXUP(pep));
  4651. ENDRECV();
  4652. }
  4653. #endif // RECVSIDE
  4654. /**************************************************************************\
  4655. * ClientGetDDEHookData
  4656. *
  4657. * 11-11-91 sanfords Created
  4658. \**************************************************************************/
  4659. typedef struct _CLIENTGETDDEHOOKDATAMSG {
  4660. UINT message;
  4661. LPARAM lParam;
  4662. DDEML_MSG_HOOK_DATA dmhd;
  4663. } CLIENTGETDDEHOOKDATAMSG;
  4664. #ifdef SENDSIDE
  4665. DWORD ClientGetDDEHookData(
  4666. IN UINT message,
  4667. IN LPARAM lParam,
  4668. OUT PDDEML_MSG_HOOK_DATA pdmhd)
  4669. {
  4670. SETUP(CLIENTGETDDEHOOKDATA)
  4671. BEGINSEND(CLIENTGETDDEHOOKDATA)
  4672. MSGDATA()->lParam = lParam;
  4673. MSGDATA()->message = message;
  4674. MAKECALL(CLIENTGETDDEHOOKDATA);
  4675. CHECKRETURN();
  4676. OUTSTRUCT(pdmhd, DDEML_MSG_HOOK_DATA);
  4677. TRACECALLBACK("ClientGetDDEHookData");
  4678. ENDSEND(DWORD,0);
  4679. }
  4680. #endif // SENDSIDE
  4681. #ifdef RECVSIDE
  4682. RECVCALL(ClientGetDDEHookData, CLIENTGETDDEHOOKDATAMSG)
  4683. {
  4684. BEGINRECV(0, &pmsg->dmhd, sizeof(DDEML_MSG_HOOK_DATA));
  4685. _ClientGetDDEHookData(CALLDATA(message), CALLDATA(lParam),
  4686. (PDDEML_MSG_HOOK_DATA)&pmsg->dmhd);
  4687. ENDRECV();
  4688. }
  4689. #endif // RECVSIDE
  4690. /**************************************************************************\
  4691. *
  4692. *
  4693. * 22-Jul-1991 mikeke Created
  4694. \**************************************************************************/
  4695. typedef struct _CLIENTCHARTOWCHARMSG {
  4696. WORD CodePage;
  4697. WORD wch;
  4698. } CLIENTCHARTOWCHARMSG;
  4699. #ifdef SENDSIDE
  4700. WCHAR xxxClientCharToWchar(
  4701. IN WORD CodePage,
  4702. IN WORD wch)
  4703. {
  4704. SETUP(CLIENTCHARTOWCHAR)
  4705. BEGINSEND(CLIENTCHARTOWCHAR)
  4706. MSGDATA()->CodePage = CodePage;
  4707. MSGDATA()->wch = wch;
  4708. MAKECALL(CLIENTCHARTOWCHAR);
  4709. CHECKRETURN();
  4710. TRACECALLBACK("ClientCharToWchar");
  4711. ENDSEND(WCHAR, L'_');
  4712. }
  4713. #endif // SENDSIDE
  4714. #ifdef RECVSIDE
  4715. RECVCALL(ClientCharToWchar, CLIENTCHARTOWCHARMSG)
  4716. {
  4717. char ach[2];
  4718. WCHAR wch = L'_';
  4719. BEGINRECV(0, NULL, 0);
  4720. ach[0] = LOBYTE(CALLDATA(wch));
  4721. ach[1] = HIBYTE(CALLDATA(wch));
  4722. MultiByteToWideChar(
  4723. CALLDATA(CodePage), // CP_THREAD_ACP, 437, 850 etc.
  4724. MB_PRECOMPOSED | MB_USEGLYPHCHARS, // visual map to precomposed
  4725. ach, ach[1] ? 2 : 1, // source & length
  4726. &wch, // destination
  4727. 1); // max poss. precomposed length
  4728. retval = (DWORD)wch;
  4729. ENDRECV();
  4730. }
  4731. #endif // RECVSIDE
  4732. /**************************************************************************\
  4733. *
  4734. *
  4735. * 22-Jul-1991 mikeke Created
  4736. \**************************************************************************/
  4737. typedef struct _CLIENTFINDMNEMCHARMSG {
  4738. CAPTUREBUF CaptureBuf;
  4739. UNICODE_STRING strSrc;
  4740. WCHAR ch;
  4741. BOOL fFirst;
  4742. BOOL fPrefix;
  4743. } CLIENTFINDMNEMCHARMSG;
  4744. #ifdef SENDSIDE
  4745. int xxxClientFindMnemChar(
  4746. IN PUNICODE_STRING pstrSrc,
  4747. IN WCHAR ch,
  4748. IN BOOL fFirst,
  4749. IN BOOL fPrefix)
  4750. {
  4751. SETUP(CLIENTFINDMNEMCHAR)
  4752. BEGINSENDCAPTURE(CLIENTFINDMNEMCHAR, 1, pstrSrc->MaximumLength, TRUE)
  4753. MSGDATA()->ch = ch;
  4754. MSGDATA()->fFirst = fFirst;
  4755. MSGDATA()->fPrefix = fPrefix;
  4756. COPYSTRING(strSrc);
  4757. MAKECALLCAPTURE(CLIENTFINDMNEMCHAR);
  4758. CHECKRETURN();
  4759. TRACECALLBACK("ClientFindMnemChar");
  4760. ENDSENDCAPTURE(BOOL,0);
  4761. }
  4762. #endif // SENDSIDE
  4763. #ifdef RECVSIDE
  4764. RECVCALL(ClientFindMnemChar, CLIENTFINDMNEMCHARMSG)
  4765. {
  4766. BEGINRECV(0, NULL, 0);
  4767. FIXUPPOINTERS();
  4768. retval = (DWORD)FindMnemChar((LPWSTR)FIXUPSTRING(strSrc),
  4769. CALLDATA(ch), CALLDATA(fFirst), CALLDATA(fPrefix));
  4770. ENDRECV();
  4771. }
  4772. #endif // RECVSIDE
  4773. /**************************************************************************\
  4774. * xxxClientPSMTextOut
  4775. *
  4776. * Called when a client-side LanguagePack (LPK) is installed
  4777. *
  4778. * 18-Sep-1996 GregoryW Created
  4779. * 11-Dec-1997 SamerA Calling LPK with user-mode accessible DC
  4780. \**************************************************************************/
  4781. typedef struct _CLIENTPSMTEXTOUTMSG {
  4782. CAPTUREBUF CaptureBuf;
  4783. UNICODE_STRING strSrc;
  4784. HDC hdc;
  4785. int xLeft;
  4786. int yTop;
  4787. int cch;
  4788. DWORD dwFlags;
  4789. } CLIENTPSMTEXTOUTMSG;
  4790. #ifdef SENDSIDE
  4791. void xxxClientPSMTextOut(
  4792. IN HDC hdc,
  4793. IN int xLeft,
  4794. IN int yTop,
  4795. IN PUNICODE_STRING pstrSrc,
  4796. IN int cch,
  4797. IN DWORD dwFlags)
  4798. {
  4799. SETUPDC(CLIENTPSMTEXTOUT)
  4800. /*
  4801. * Make sure this routine is called when a client LanguagePack (LPK)
  4802. * is installed.
  4803. */
  4804. UserAssert(CALL_LPK(PtiCurrentShared()));
  4805. BEGINSENDCAPTUREVOIDDC(CLIENTPSMTEXTOUT, 1, pstrSrc->MaximumLength, TRUE)
  4806. CheckPublicDC ("xxxClientPSMTextOut: Public DC passed to LPK. hdcUse=%lX", hdcUse);
  4807. MSGDATA()->hdc = hdcUse;
  4808. MSGDATA()->xLeft = xLeft;
  4809. MSGDATA()->yTop = yTop;
  4810. MSGDATA()->cch = cch;
  4811. MSGDATA()->dwFlags = dwFlags;
  4812. COPYSTRING(strSrc);
  4813. MAKECALLCAPTUREDC(CLIENTPSMTEXTOUT);
  4814. CHECKRETURN();
  4815. TRACECALLBACK("ClientPSMTextOut");
  4816. ENDSENDCAPTUREVOIDDC();
  4817. }
  4818. #endif // SENDSIDE
  4819. #ifdef RECVSIDE
  4820. RECVCALL(ClientPSMTextOut, CLIENTPSMTEXTOUTMSG)
  4821. {
  4822. BEGINRECV(0, NULL, 0);
  4823. FIXUPPOINTERS();
  4824. PSMTextOut(CALLDATA(hdc), CALLDATA(xLeft), CALLDATA(yTop),
  4825. (LPWSTR)FIXUPSTRING(strSrc), CALLDATA(cch), CALLDATA(dwFlags));
  4826. retval = 0;
  4827. ENDRECV();
  4828. }
  4829. #endif // RECVSIDE
  4830. /**************************************************************************\
  4831. * xxxClientLpkDrawTextEx
  4832. *
  4833. * Called when a client-side LanguagePack (LPK) is installed
  4834. *
  4835. * 18-Sep-1996 GregoryW Created
  4836. * 11-Dec-1997 SamerA Calling LPK with user-mode accessible DC
  4837. \**************************************************************************/
  4838. typedef struct _CLIENTLPKDRAWTEXTEXMSG {
  4839. CAPTUREBUF CaptureBuf;
  4840. UNICODE_STRING strSrc;
  4841. HDC hdc;
  4842. int xLeft;
  4843. int yTop;
  4844. int nCount;
  4845. BOOL fDraw;
  4846. UINT wFormat;
  4847. DRAWTEXTDATA DrawInfo;
  4848. UINT bAction;
  4849. int iCharSet;
  4850. } CLIENTLPKDRAWTEXTEXMSG;
  4851. #ifdef SENDSIDE
  4852. int xxxClientLpkDrawTextEx(
  4853. IN HDC hdc,
  4854. IN int xLeft,
  4855. IN int yTop,
  4856. IN LPCWSTR lpsz,
  4857. IN int nCount,
  4858. IN BOOL fDraw,
  4859. IN UINT wFormat,
  4860. IN LPDRAWTEXTDATA lpDrawInfo,
  4861. IN UINT bAction,
  4862. IN int iCharSet)
  4863. {
  4864. SETUPDC(CLIENTLPKDRAWTEXTEX)
  4865. UNICODE_STRING strSrc;
  4866. UNICODE_STRING *pstrSrc = &strSrc;
  4867. /*
  4868. * Make sure this routine is called when a client LanguagePack (LPK)
  4869. * is installed.
  4870. */
  4871. UserAssert(CALL_LPK(PtiCurrentShared()));
  4872. RtlInitUnicodeString(pstrSrc, lpsz);
  4873. BEGINSENDCAPTUREDC(CLIENTLPKDRAWTEXTEX, 1, nCount, TRUE)
  4874. CheckPublicDC ("xxxClientLpkDrawTextEx: Public DC passed to LPK. hdcUse=%lX", hdcUse);
  4875. MSGDATA()->hdc = hdcUse;
  4876. MSGDATA()->xLeft = xLeft;
  4877. MSGDATA()->yTop = yTop;
  4878. MSGDATA()->nCount = nCount;
  4879. MSGDATA()->fDraw = fDraw;
  4880. MSGDATA()->wFormat = wFormat;
  4881. MSGDATA()->DrawInfo = *lpDrawInfo;
  4882. MSGDATA()->bAction = bAction;
  4883. MSGDATA()->iCharSet = iCharSet;
  4884. COPYSTRING(strSrc);
  4885. MAKECALLCAPTUREDC(CLIENTLPKDRAWTEXTEX);
  4886. CHECKRETURN();
  4887. TRACECALLBACK("ClientLpkDrawTextEx");
  4888. ENDSENDCAPTUREDC(int, 0);
  4889. }
  4890. #endif // SENDSIDE
  4891. #ifdef RECVSIDE
  4892. RECVCALL(ClientLpkDrawTextEx, CLIENTLPKDRAWTEXTEXMSG)
  4893. {
  4894. BEGINRECV(0, NULL, 0);
  4895. FIXUPPOINTERS();
  4896. retval = (*fpLpkDrawTextEx)(CALLDATA(hdc), CALLDATA(xLeft), CALLDATA(yTop),
  4897. (LPWSTR)FIXUPSTRING(strSrc), CALLDATA(nCount), CALLDATA(fDraw),
  4898. CALLDATA(wFormat), PCALLDATA(DrawInfo), CALLDATA(bAction), CALLDATA(iCharSet));
  4899. ENDRECV();
  4900. }
  4901. #endif // RECVSIDE
  4902. /**************************************************************************\
  4903. * xxxClientExtTextOutW
  4904. *
  4905. * Called when a client-side LanguagePack (LPK) is installed
  4906. *
  4907. * 26-Jan-1997 GregoryW Created
  4908. * 11-Dec-1997 SamerA Calling LPK with user-mode accessible DC
  4909. \**************************************************************************/
  4910. typedef struct _CLIENTEXTTEXTOUTW {
  4911. CAPTUREBUF CaptureBuf;
  4912. UNICODE_STRING strSrc;
  4913. HDC hdc;
  4914. int x;
  4915. int y;
  4916. int flOpts;
  4917. RECT rcl;
  4918. UINT cwc;
  4919. BOOL fNullRect;
  4920. } CLIENTEXTTEXTOUTWMSG;
  4921. #ifdef SENDSIDE
  4922. BOOL xxxClientExtTextOutW(
  4923. IN HDC hdc,
  4924. IN int x,
  4925. IN int y,
  4926. IN int flOpts,
  4927. IN RECT *prcl,
  4928. IN LPCWSTR pwsz,
  4929. IN UINT cwc,
  4930. IN INT *pdx)
  4931. {
  4932. SETUPDC(CLIENTEXTTEXTOUTW)
  4933. UNICODE_STRING strSrc;
  4934. UNICODE_STRING *pstrSrc = &strSrc;
  4935. /*
  4936. * Make sure this routine is called when a client LanguagePack (LPK)
  4937. * is installed.
  4938. */
  4939. UserAssert(CALL_LPK(PtiCurrentShared()));
  4940. RtlInitUnicodeString(pstrSrc, pwsz);
  4941. BEGINSENDCAPTUREDC(CLIENTEXTTEXTOUTW, 1, cwc, TRUE)
  4942. CheckPublicDC ("xxxClientExtTextOutW: Public DC passed to LPK. hdcUse=%lX", hdcUse);
  4943. MSGDATA()->hdc = hdcUse;
  4944. MSGDATA()->x = x;
  4945. MSGDATA()->y = y;
  4946. MSGDATA()->flOpts = flOpts;
  4947. /* In order not to pass a NULL ptr */
  4948. if( prcl ){
  4949. MSGDATA()->rcl = *prcl;
  4950. MSGDATA()->fNullRect=TRUE;
  4951. }
  4952. else {
  4953. MSGDATA()->fNullRect=FALSE;
  4954. }
  4955. MSGDATA()->cwc = cwc;
  4956. COPYSTRING(strSrc);
  4957. MAKECALLCAPTUREDC(CLIENTEXTTEXTOUTW);
  4958. CHECKRETURN();
  4959. TRACECALLBACK("ClientExtTextOutW");
  4960. ENDSENDCAPTUREDC(BOOL, 0);
  4961. UNREFERENCED_PARAMETER(pdx);
  4962. }
  4963. #endif // SENDSIDE
  4964. #ifdef RECVSIDE
  4965. RECVCALL(ClientExtTextOutW, CLIENTEXTTEXTOUTWMSG)
  4966. {
  4967. BEGINRECV(0, NULL, 0);
  4968. FIXUPPOINTERS();
  4969. retval = ExtTextOutW(CALLDATA(hdc), CALLDATA(x), CALLDATA(y),
  4970. CALLDATA(flOpts), (CALLDATA(fNullRect)) ? PCALLDATA(rcl) : NULL , (LPWSTR)FIXUPSTRING(strSrc),
  4971. CALLDATA(cwc), NULL);
  4972. ENDRECV();
  4973. }
  4974. #endif // RECVSIDE
  4975. /**************************************************************************\
  4976. * xxxClientGetTextExtentPointW
  4977. *
  4978. * Called when a client-side LanguagePack (LPK) is installed
  4979. *
  4980. * 06-Feb-1997 GregoryW Created
  4981. * 19-Jan-1998 SamerA EIP_ERROR if a public DC is passed other than hdcGray
  4982. \**************************************************************************/
  4983. typedef struct _CLIENTGETTEXTEXTENTPOINTW {
  4984. CAPTUREBUF CaptureBuf;
  4985. UNICODE_STRING strSrc;
  4986. HDC hdc;
  4987. int cch;
  4988. SIZE size;
  4989. } CLIENTGETTEXTEXTENTPOINTWMSG;
  4990. #ifdef SENDSIDE
  4991. BOOL xxxClientGetTextExtentPointW(
  4992. IN HDC hdc,
  4993. IN LPCWSTR lpstr,
  4994. IN int cch,
  4995. OUT PSIZE psize)
  4996. {
  4997. SETUPDC(CLIENTGETTEXTEXTENTPOINTW)
  4998. UNICODE_STRING strSrc;
  4999. UNICODE_STRING *pstrSrc = &strSrc;
  5000. /*
  5001. * Make sure this routine is called when a client LanguagePack (LPK)
  5002. * is installed.
  5003. */
  5004. UserAssert(CALL_LPK(PtiCurrentShared()));
  5005. RtlInitUnicodeString(pstrSrc, lpstr);
  5006. BEGINSENDCAPTUREDC(CLIENTGETTEXTEXTENTPOINTW, 1, cch, TRUE)
  5007. CheckPublicDC ("xxxGetTextExtentPointW: Public DC passed to LPK. hdcUse=%lX", hdcUse);
  5008. MSGDATA()->hdc = hdcUse;
  5009. MSGDATA()->cch = cch;
  5010. COPYSTRING(strSrc);
  5011. MAKECALLCAPTUREDC(CLIENTGETTEXTEXTENTPOINTW);
  5012. CHECKRETURN();
  5013. OUTSTRUCT(psize, SIZE);
  5014. TRACECALLBACK("ClientGetTextExtentPointW");
  5015. ENDSENDCAPTUREDC(BOOL, 0);
  5016. }
  5017. #endif // SENDSIDE
  5018. #ifdef RECVSIDE
  5019. RECVCALL(ClientGetTextExtentPointW, CLIENTGETTEXTEXTENTPOINTWMSG)
  5020. {
  5021. BEGINRECV(0, &pmsg->size, sizeof(SIZE));
  5022. FIXUPPOINTERS();
  5023. retval = GetTextExtentPointW(CALLDATA(hdc), (LPWSTR)FIXUPSTRING(strSrc),
  5024. CALLDATA(cch), PCALLDATA(size));
  5025. ENDRECV();
  5026. }
  5027. #endif // RECVSIDE
  5028. /**************************************************************************\
  5029. *
  5030. *
  5031. * 22-Jul-1991 mikeke Created
  5032. \**************************************************************************/
  5033. typedef struct _CLIENTADDFONTRESOURCEWMSG {
  5034. CAPTUREBUF CaptureBuf;
  5035. UNICODE_STRING strSrc;
  5036. DWORD dwFlags;
  5037. DESIGNVECTOR dv;
  5038. } CLIENTADDFONTRESOURCEWMSG;
  5039. #ifdef SENDSIDE
  5040. int xxxClientAddFontResourceW(
  5041. IN PUNICODE_STRING pstrSrc,
  5042. IN DWORD dwFlags,
  5043. IN DESIGNVECTOR *pdv)
  5044. {
  5045. SETUP(CLIENTADDFONTRESOURCEW)
  5046. BEGINSENDCAPTURE(CLIENTADDFONTRESOURCEW, 1, pstrSrc->MaximumLength, TRUE)
  5047. COPYSTRING(strSrc);
  5048. MSGDATA()->dwFlags = dwFlags;
  5049. if (pdv && pdv->dvNumAxes) {
  5050. MSGDATA()->dv = *pdv;
  5051. } else {
  5052. MSGDATA()->dv.dvNumAxes = 0;
  5053. }
  5054. MAKECALLCAPTURE(CLIENTADDFONTRESOURCEW);
  5055. CHECKRETURN();
  5056. TRACECALLBACK("ClientAddFontResourceW");
  5057. ENDSENDCAPTURE(int,0);
  5058. }
  5059. #endif // SENDSIDE
  5060. #ifdef RECVSIDE
  5061. RECVCALL(ClientAddFontResourceW, CLIENTADDFONTRESOURCEWMSG)
  5062. {
  5063. DWORD AddFont(LPWSTR, DWORD, DESIGNVECTOR*);
  5064. BEGINRECV(0, NULL, 0);
  5065. FIXUPPOINTERS();
  5066. retval = GdiAddFontResourceW((LPWSTR)FIXUPSTRING(strSrc),
  5067. CALLDATA(dwFlags), CALLDATA(dv).dvNumAxes ? &CALLDATA(dv) : NULL);
  5068. ENDRECV();
  5069. }
  5070. #endif // RECVSIDE
  5071. /******************************Public*Routine******************************\
  5072. *
  5073. * FontSweep()
  5074. *
  5075. * History:
  5076. * 23-Oct-1995 -by- Bodin Dresevic [BodinD]
  5077. * Wrote it.
  5078. \**************************************************************************/
  5079. #ifdef SENDSIDE
  5080. VOID ClientFontSweep(VOID)
  5081. {
  5082. PVOID p;
  5083. ULONG cb;
  5084. LeaveCrit();
  5085. KeUserModeCallback(
  5086. FI_CLIENTFONTSWEEP,
  5087. NULL,
  5088. 0,
  5089. &p,
  5090. &cb);
  5091. EnterCrit();
  5092. return;
  5093. }
  5094. #endif // SENDSIDE
  5095. #ifdef RECVSIDE
  5096. DWORD __ClientFontSweep(
  5097. PVOID p)
  5098. {
  5099. UNREFERENCED_PARAMETER(p);
  5100. vFontSweep();
  5101. return NtCallbackReturn(NULL, 0, STATUS_SUCCESS);
  5102. }
  5103. #endif // RECVSIDE
  5104. /******************************Public*Routine******************************\
  5105. *
  5106. * VOID ClientLoadLocalT1Fonts(VOID)
  5107. * very similar to above, only done for t1 fonts
  5108. *
  5109. * History:
  5110. * 25-Apr-1996 -by- Bodin Dresevic [BodinD]
  5111. * Wrote it.
  5112. \**************************************************************************/
  5113. #ifdef SENDSIDE
  5114. VOID ClientLoadLocalT1Fonts(VOID)
  5115. {
  5116. PVOID p;
  5117. ULONG cb;
  5118. LeaveCrit();
  5119. KeUserModeCallback(
  5120. FI_CLIENTLOADLOCALT1FONTS,
  5121. NULL,
  5122. 0,
  5123. &p,
  5124. &cb);
  5125. EnterCrit();
  5126. return;
  5127. }
  5128. #endif // SENDSIDE
  5129. #ifdef RECVSIDE
  5130. DWORD __ClientLoadLocalT1Fonts(
  5131. PVOID p)
  5132. {
  5133. UNREFERENCED_PARAMETER(p);
  5134. vLoadLocalT1Fonts();
  5135. return NtCallbackReturn(NULL, 0, STATUS_SUCCESS);
  5136. }
  5137. #endif // RECVSIDE
  5138. /******************************Public*Routine******************************\
  5139. *
  5140. * VOID ClientLoadRemoteT1Fonts(VOID)
  5141. * very similar to above, only done for t1 fonts
  5142. *
  5143. * History:
  5144. * 25-Apr-1996 -by- Bodin Dresevic [BodinD]
  5145. * Wrote it.
  5146. \**************************************************************************/
  5147. #ifdef SENDSIDE
  5148. VOID ClientLoadRemoteT1Fonts(VOID)
  5149. {
  5150. PVOID p;
  5151. ULONG cb;
  5152. LeaveCrit();
  5153. KeUserModeCallback(
  5154. FI_CLIENTLOADREMOTET1FONTS,
  5155. NULL,
  5156. 0,
  5157. &p,
  5158. &cb);
  5159. EnterCrit();
  5160. return;
  5161. }
  5162. #endif // SENDSIDE
  5163. #ifdef RECVSIDE
  5164. DWORD __ClientLoadRemoteT1Fonts(
  5165. PVOID p)
  5166. {
  5167. UNREFERENCED_PARAMETER(p);
  5168. vLoadRemoteT1Fonts();
  5169. return NtCallbackReturn(NULL, 0, STATUS_SUCCESS);
  5170. }
  5171. #endif // RECVSIDE
  5172. /**************************************************************************\
  5173. * pppUserModeCallback
  5174. *
  5175. * Same as xxxUserModeCallback except not leaving/re-entering critical section
  5176. *
  5177. * 12/9/97 LingyunW Copied from xxxUserModeCallback
  5178. \**************************************************************************/
  5179. #ifdef SENDSIDE
  5180. NTSTATUS pppUserModeCallback (ULONG uApi, PVOID pIn, ULONG cbIn, PVOID pOut, ULONG cbOut)
  5181. {
  5182. NTSTATUS Status;
  5183. PVOID pLocalOut;
  5184. ULONG cbLocalOut;
  5185. /*
  5186. * Call the client
  5187. */
  5188. Status = KeUserModeCallback(uApi, pIn, cbIn, &pLocalOut, &cbLocalOut);
  5189. /*
  5190. * If it failed, bail
  5191. */
  5192. if (!NT_SUCCESS(Status)) {
  5193. return Status;
  5194. }
  5195. /*
  5196. * If we didn't get the right amount of data, fail.
  5197. */
  5198. if (cbLocalOut != cbOut) {
  5199. RIPMSG3(RIP_WARNING, "pppUserModeCallback: uAPi: %#lx cbOut: %#lx cbLocalOut: %#lx",
  5200. uApi, cbOut, cbLocalOut);
  5201. return STATUS_UNSUCCESSFUL;
  5202. }
  5203. /*
  5204. * If we were expecting some data, copy it.
  5205. */
  5206. if (cbOut != 0) {
  5207. try {
  5208. ProbeForRead(pLocalOut, cbLocalOut, sizeof(DWORD));
  5209. RtlCopyMemory(pOut, pLocalOut, cbLocalOut);
  5210. } except (W32ExceptionHandler(FALSE, RIP_WARNING)) {
  5211. RIPMSG2(RIP_WARNING, "pppUserModeCallback: uAPi: %#lx Exception: %#lx", uApi, GetExceptionCode());
  5212. Status = STATUS_UNSUCCESSFUL;
  5213. }
  5214. }
  5215. return Status;
  5216. }
  5217. #endif // SENDSIDE
  5218. /******************************Public*Routine******************************\
  5219. * ClientPrinterThunk
  5220. *
  5221. * Callback used as the kernel-to-user transport layer.
  5222. *
  5223. * Note: User critical section is not held by the caller.
  5224. *
  5225. * History:
  5226. * 22-Jun-1997 -by- Gilman Wong [gilmanw]
  5227. * 11/13/97 -by- Lingyun Wang [lingyunw] clean up
  5228. *
  5229. * Wrote it.
  5230. \**************************************************************************/
  5231. #define CLIENTPRINTERTHUNKMSG UMTHDR
  5232. #ifdef SENDSIDE
  5233. DWORD ClientPrinterThunk(PVOID pvIn, ULONG cjIn, PVOID pvOut, ULONG cjOut)
  5234. {
  5235. NTSTATUS Status;
  5236. /*
  5237. * (Temporarly..) we return failure if we are holding USERK's crit section
  5238. */
  5239. if (ExIsResourceAcquiredExclusiveLite(gpresUser)
  5240. || (ExIsResourceAcquiredSharedLite(gpresUser) != 0)) {
  5241. RIPMSG0(RIP_ERROR, "ClientPrinterThunk: Holding USERK critical section!");
  5242. return 0xffffffff;
  5243. }
  5244. /*
  5245. * The pvIn buffer must have at least a CLIENTPRINTERTHUNK header.
  5246. */
  5247. UserAssertMsg1(cjIn >= sizeof(CLIENTPRINTERTHUNKMSG), "ClientPrinterThunk: incorrect cjIn:%#lx", cjIn);
  5248. /*
  5249. * Set the private cjOut. The receive-side uses this to allocate
  5250. * a return buffer.
  5251. */
  5252. ((CLIENTPRINTERTHUNKMSG *) pvIn)->ulReserved1 = cjOut;
  5253. ((CLIENTPRINTERTHUNKMSG *) pvIn)->ulReserved2 = 0;
  5254. /*
  5255. * Do the callback.
  5256. */
  5257. Status = pppUserModeCallback(FI_CLIENTPRINTERTHUNK, pvIn, cjIn, pvOut, cjOut);
  5258. return (NT_SUCCESS(Status) ? 0 : 0xFFFFFFFF);
  5259. }
  5260. #endif // SENDSIDE
  5261. #ifdef RECVSIDE
  5262. DWORD __ClientPrinterThunk(CLIENTPRINTERTHUNKMSG *pMsg)
  5263. {
  5264. PVOID pv;
  5265. ULONG aul[526];
  5266. NTSTATUS Status;
  5267. /*
  5268. * Check that the local buffer is big enough.
  5269. */
  5270. if (pMsg->ulReserved1 <= sizeof(aul)) {
  5271. pv = (PVOID) aul;
  5272. /*
  5273. * Call GDI to process command.
  5274. */
  5275. if (GdiPrinterThunk((UMTHDR *) pMsg, pv, pMsg->ulReserved1) != GPT_ERROR) {
  5276. Status = STATUS_SUCCESS;
  5277. } else {
  5278. RIPMSG0(RIP_WARNING, "ClientPrinterThunk failed");
  5279. Status = STATUS_UNSUCCESSFUL;
  5280. }
  5281. } else {
  5282. RIPMSG0(RIP_WARNING, "ClientPrinterThunk: buffer too big!");
  5283. Status = STATUS_NO_MEMORY;
  5284. }
  5285. /*
  5286. * Return to kernel.
  5287. */
  5288. if (NT_SUCCESS(Status)) {
  5289. return UserCallbackReturn(pv, pMsg->ulReserved1, Status);
  5290. } else {
  5291. return UserCallbackReturn(NULL, 0, Status);
  5292. }
  5293. }
  5294. #endif // RECVSIDE
  5295. /**************************************************************************\
  5296. *
  5297. *
  5298. * 22-Jul-1991 mikeke Created
  5299. \**************************************************************************/
  5300. #ifdef SENDSIDE
  5301. VOID ClientNoMemoryPopup(VOID)
  5302. {
  5303. PVOID p;
  5304. ULONG cb;
  5305. LeaveCrit();
  5306. KeUserModeCallback(
  5307. FI_CLIENTNOMEMORYPOPUP,
  5308. NULL,
  5309. 0,
  5310. &p,
  5311. &cb);
  5312. EnterCrit();
  5313. return;
  5314. }
  5315. #endif // SENDSIDE
  5316. #ifdef RECVSIDE
  5317. DWORD __ClientNoMemoryPopup(
  5318. PVOID p)
  5319. {
  5320. WCHAR szNoMem[200];
  5321. UNREFERENCED_PARAMETER(p);
  5322. if (LoadStringW(hmodUser, STR_NOMEMBITMAP, szNoMem,
  5323. sizeof(szNoMem) / sizeof(WCHAR))) {
  5324. MessageBoxW(GetActiveWindow(), szNoMem, NULL, MB_OK);
  5325. }
  5326. return NtCallbackReturn(NULL, 0, STATUS_SUCCESS);
  5327. }
  5328. #endif // RECVSIDE
  5329. /**************************************************************************\
  5330. * ClientThreadSetup
  5331. *
  5332. * Callback to the client to perform thread initialization.
  5333. *
  5334. * 04-07-95 JimA Created.
  5335. \**************************************************************************/
  5336. #ifdef SENDSIDE
  5337. NTSTATUS xxxClientThreadSetup(VOID)
  5338. {
  5339. PVOID p;
  5340. ULONG cb;
  5341. NTSTATUS Status;
  5342. LeaveCrit();
  5343. Status = KeUserModeCallback(
  5344. FI_CLIENTTHREADSETUP,
  5345. NULL,
  5346. 0,
  5347. &p,
  5348. &cb);
  5349. EnterCrit();
  5350. return Status;
  5351. }
  5352. #endif // SENDSIDE
  5353. #ifdef RECVSIDE
  5354. DWORD __ClientThreadSetup(
  5355. PVOID p)
  5356. {
  5357. BOOL fSuccess;
  5358. BOOL ClientThreadSetup(VOID);
  5359. UNREFERENCED_PARAMETER(p);
  5360. fSuccess = ClientThreadSetup();
  5361. return NtCallbackReturn(NULL, 0,
  5362. fSuccess ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
  5363. }
  5364. #endif // RECVSIDE
  5365. /**************************************************************************\
  5366. * ClientDeliverUserApc
  5367. *
  5368. * Callback to the client to handle a user APC. This is needed to
  5369. * ensure that a thread will exit promptly when terminated.
  5370. *
  5371. * 08-12-95 JimA Created.
  5372. \**************************************************************************/
  5373. #ifdef SENDSIDE
  5374. VOID ClientDeliverUserApc(VOID)
  5375. {
  5376. PVOID p;
  5377. ULONG cb;
  5378. LeaveCrit();
  5379. KeUserModeCallback(
  5380. FI_CLIENTDELIVERUSERAPC,
  5381. NULL,
  5382. 0,
  5383. &p,
  5384. &cb);
  5385. EnterCrit();
  5386. }
  5387. #endif // SENDSIDE
  5388. #ifdef RECVSIDE
  5389. DWORD __ClientDeliverUserApc(
  5390. PVOID p)
  5391. {
  5392. UNREFERENCED_PARAMETER(p);
  5393. return NtCallbackReturn(NULL, 0, STATUS_SUCCESS);
  5394. }
  5395. #endif // RECVSIDE
  5396. /**************************************************************************\
  5397. * ClientImmLoadLayout
  5398. *
  5399. * 29-Jan-1996 wkwok Created
  5400. \**************************************************************************/
  5401. typedef struct _CLIENTIMMLOADLAYOUTMSG {
  5402. HKL hKL;
  5403. } CLIENTIMMLOADLAYOUTMSG;
  5404. #ifdef SENDSIDE
  5405. BOOL ClientImmLoadLayout(
  5406. IN HKL hKL,
  5407. OUT PIMEINFOEX piiex)
  5408. {
  5409. SETUP(CLIENTIMMLOADLAYOUT)
  5410. BEGINSEND(CLIENTIMMLOADLAYOUT)
  5411. MSGDATA()->hKL = hKL;
  5412. MAKECALL(CLIENTIMMLOADLAYOUT);
  5413. CHECKRETURN();
  5414. if (retval)
  5415. OUTSTRUCT(piiex, IMEINFOEX);
  5416. TRACECALLBACK("ClientImmLoadLayout");
  5417. ENDSEND(BOOL, 0);
  5418. }
  5419. #endif // SENDSIDE
  5420. #ifdef RECVSIDE
  5421. RECVCALL(ClientImmLoadLayout, CLIENTIMMLOADLAYOUTMSG)
  5422. {
  5423. IMEINFOEX iiex;
  5424. BEGINRECV(0, &iiex, sizeof(iiex));
  5425. retval = fpImmLoadLayout(CALLDATA(hKL), &iiex);
  5426. ENDRECV();
  5427. }
  5428. #endif // RECVSIDE
  5429. /**************************************************************************\
  5430. * ClientImmProcessKey
  5431. *
  5432. * 03-Mar-1996 TakaoK Created
  5433. \**************************************************************************/
  5434. typedef struct _CLIENTIMMPROCESSKEYMSG {
  5435. HWND hWnd;
  5436. HKL hkl;
  5437. UINT uVKey;
  5438. LPARAM lParam;
  5439. DWORD dwHotKeyID;
  5440. } CLIENTIMMPROCESSKEYMSG;
  5441. #ifdef SENDSIDE
  5442. DWORD ClientImmProcessKey(
  5443. IN HWND hWnd,
  5444. IN HKL hkl,
  5445. IN UINT uVKey,
  5446. IN LPARAM lParam,
  5447. IN DWORD dwHotKeyID)
  5448. {
  5449. SETUP(CLIENTIMMPROCESSKEY)
  5450. UserAssert(IS_IME_ENABLED());
  5451. BEGINSEND(CLIENTIMMPROCESSKEY)
  5452. MSGDATA()->hWnd = hWnd,
  5453. MSGDATA()->hkl = hkl;
  5454. MSGDATA()->uVKey = uVKey;
  5455. MSGDATA()->lParam = lParam;
  5456. MSGDATA()->dwHotKeyID = dwHotKeyID;
  5457. MAKECALL(CLIENTIMMPROCESSKEY);
  5458. CHECKRETURN();
  5459. TRACECALLBACK("ClientImmProcessKey");
  5460. ENDSEND(DWORD, 0);
  5461. }
  5462. #endif // SENDSIDE
  5463. #ifdef RECVSIDE
  5464. RECVCALL(ClientImmProcessKey, CLIENTIMMPROCESSKEYMSG)
  5465. {
  5466. BEGINRECV(0, NULL, 0);
  5467. retval = fpImmProcessKey(CALLDATA(hWnd),
  5468. CALLDATA(hkl),
  5469. CALLDATA(uVKey),
  5470. CALLDATA(lParam),
  5471. CALLDATA(dwHotKeyID));
  5472. ENDRECV();
  5473. }
  5474. #endif // RECVSIDE
  5475. /**************************************************************************\
  5476. * fnIMECONTROL
  5477. *
  5478. * 22-Apr-1996 wkwok Created
  5479. \**************************************************************************/
  5480. typedef struct _FNIMECONTROL {
  5481. CAPTUREBUF CaptureBuf;
  5482. PWND pwnd;
  5483. UINT msg;
  5484. WPARAM wParam;
  5485. union {
  5486. PCANDIDATEFORM pCandForm;
  5487. PCOMPOSITIONFORM pCompForm;
  5488. PLOGFONTA pLogFontA;
  5489. PLOGFONTW pLogFontW;
  5490. PSOFTKBDDATA pSoftKbdData;
  5491. LPARAM lParam;
  5492. } u;
  5493. ULONG_PTR xParam;
  5494. PROC xpfnProc;
  5495. PBYTE pOutput;
  5496. DWORD cbOutput;
  5497. } FNIMECONTROLMSG;
  5498. #ifdef SENDSIDE
  5499. void CopyLogFontAtoW(
  5500. PLOGFONTW pdest,
  5501. PLOGFONTA psrc)
  5502. {
  5503. LPSTR lpstrFont = (LPSTR)(&psrc->lfFaceName);
  5504. LPWSTR lpstrFontW = (LPWSTR)(&pdest->lfFaceName);
  5505. memcpy((LPBYTE)pdest, psrc, sizeof(LOGFONTA) - LF_FACESIZE);
  5506. memset(pdest->lfFaceName, 0, LF_FACESIZE * sizeof(WCHAR));
  5507. MBToWCS(lpstrFont, -1, &lpstrFontW, LF_FACESIZE, FALSE);
  5508. }
  5509. SMESSAGECALL(IMECONTROL)
  5510. {
  5511. DWORD cCapture, cbCapture;
  5512. SETUPPWND(FNIMECONTROL)
  5513. switch (wParam) {
  5514. case IMC_GETCANDIDATEPOS:
  5515. case IMC_SETCANDIDATEPOS:
  5516. cCapture = 1;
  5517. cbCapture = sizeof(CANDIDATEFORM);
  5518. break;
  5519. case IMC_GETCOMPOSITIONWINDOW:
  5520. case IMC_SETCOMPOSITIONWINDOW:
  5521. cCapture = 1;
  5522. cbCapture = sizeof(COMPOSITIONFORM);
  5523. break;
  5524. case IMC_GETCOMPOSITIONFONT:
  5525. case IMC_SETCOMPOSITIONFONT:
  5526. case IMC_GETSOFTKBDFONT:
  5527. cCapture = 1;
  5528. cbCapture = (dwSCMSFlags & SCMS_FLAGS_ANSI)
  5529. ? sizeof(LOGFONTA) : sizeof(LOGFONTW) ;
  5530. break;
  5531. case IMC_SETSOFTKBDDATA:
  5532. cCapture = 1;
  5533. cbCapture = FIELD_OFFSET(SOFTKBDDATA, wCode[0])
  5534. + ((PSOFTKBDDATA)lParam)->uCount * sizeof(WORD) * 256;
  5535. break;
  5536. default:
  5537. cCapture = 0;
  5538. cbCapture = 0;
  5539. break;
  5540. }
  5541. BEGINSENDCAPTURE(FNIMECONTROL, cCapture, cbCapture, TRUE);
  5542. MSGDATA()->pwnd = pwndClient;
  5543. MSGDATA()->msg = msg;
  5544. MSGDATA()->wParam = wParam;
  5545. MSGDATA()->u.lParam = lParam;
  5546. MSGDATA()->xParam = xParam;
  5547. MSGDATA()->xpfnProc = xpfnProc;
  5548. LOCKPWND();
  5549. switch (wParam) {
  5550. case IMC_GETCANDIDATEPOS:
  5551. case IMC_GETCOMPOSITIONWINDOW:
  5552. case IMC_GETCOMPOSITIONFONT:
  5553. case IMC_GETSOFTKBDFONT:
  5554. RESERVEBYTES(cbCapture, pOutput, cbOutput);
  5555. MAKECALLCAPTURE(FNIMECONTROL);
  5556. UNLOCKPWND();
  5557. CHECKRETURN();
  5558. BEGINCOPYOUT()
  5559. try {
  5560. ProbeForRead(pcbs->pOutput, pcbs->cbOutput, sizeof(DWORD));
  5561. switch (wParam) {
  5562. case IMC_GETCANDIDATEPOS:
  5563. case IMC_GETCOMPOSITIONWINDOW:
  5564. memcpy((LPBYTE)lParam, pcbs->pOutput, cbCapture);
  5565. break;
  5566. case IMC_GETCOMPOSITIONFONT:
  5567. case IMC_GETSOFTKBDFONT:
  5568. if (dwSCMSFlags & SCMS_FLAGS_ANSI) {
  5569. CopyLogFontAtoW((PLOGFONTW)lParam, (PLOGFONTA)pcbs->pOutput);
  5570. }
  5571. else {
  5572. memcpy((LPBYTE)lParam, pcbs->pOutput, cbCapture);
  5573. }
  5574. break;
  5575. }
  5576. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  5577. MSGERROR();
  5578. }
  5579. ENDCOPYOUT()
  5580. break;
  5581. case IMC_SETCANDIDATEPOS:
  5582. case IMC_SETCOMPOSITIONWINDOW:
  5583. case IMC_SETCOMPOSITIONFONT:
  5584. case IMC_SETSOFTKBDDATA:
  5585. if (wParam == IMC_SETCANDIDATEPOS) {
  5586. PCANDIDATEFORM pCandForm = (PCANDIDATEFORM)lParam;
  5587. LARGECOPYBYTES2(pCandForm, sizeof(CANDIDATEFORM), u.pCandForm);
  5588. }
  5589. else if (wParam == IMC_SETCOMPOSITIONWINDOW) {
  5590. PCOMPOSITIONFORM pCompForm = (PCOMPOSITIONFORM)lParam;
  5591. LARGECOPYBYTES2(pCompForm, sizeof(COMPOSITIONFORM), u.pCompForm);
  5592. }
  5593. else if (wParam == IMC_SETCOMPOSITIONFONT) {
  5594. if (dwSCMSFlags & SCMS_FLAGS_ANSI) {
  5595. LOGFONTA LogFontA;
  5596. LPSTR lpstrFontA = LogFontA.lfFaceName;
  5597. LPWSTR lpstrFontW = ((PLOGFONTW)lParam)->lfFaceName;
  5598. memcpy(&LogFontA, (PBYTE)lParam, sizeof(LOGFONTA)-LF_FACESIZE);
  5599. memset(lpstrFontA, 0, LF_FACESIZE * sizeof(CHAR));
  5600. WCSToMB(lpstrFontW, -1, &lpstrFontA, LF_FACESIZE, FALSE);
  5601. LARGECOPYBYTES2(&LogFontA, sizeof(LOGFONTA), u.pLogFontA);
  5602. }
  5603. else {
  5604. PLOGFONTW pLogFontW = (PLOGFONTW)lParam;
  5605. LARGECOPYBYTES2(pLogFontW, sizeof(LOGFONTW), u.pLogFontW);
  5606. }
  5607. }
  5608. else if (wParam == IMC_SETSOFTKBDDATA) {
  5609. PSOFTKBDDATA pSoftKbdData;
  5610. if (dwSCMSFlags & SCMS_FLAGS_ANSI) {
  5611. PWORD pCodeA;
  5612. PWSTR pCodeW;
  5613. CHAR ch[2];
  5614. PSTR pch = (PSTR)&ch;
  5615. UINT i;
  5616. pSoftKbdData = (PSOFTKBDDATA)UserAllocPool(cbCapture, TAG_IME);
  5617. if (pSoftKbdData == NULL)
  5618. MSGERROR();
  5619. pCodeA = &pSoftKbdData->wCode[0][0];
  5620. pCodeW = (PWSTR)&((PSOFTKBDDATA)lParam)->wCode[0][0];
  5621. pSoftKbdData->uCount = ((PSOFTKBDDATA)lParam)->uCount;
  5622. i = pSoftKbdData->uCount * 256;
  5623. while (i--) {
  5624. pch[1] = '\0';
  5625. WCSToMBEx(THREAD_CODEPAGE(), pCodeW, 1, &pch, 2, FALSE);
  5626. if (pch[1]) {
  5627. *pCodeA = MAKEWORD(pch[1], pch[0]);
  5628. } else {
  5629. *pCodeA = MAKEWORD(pch[0], 0);
  5630. }
  5631. pCodeA++; pCodeW++;
  5632. }
  5633. LARGECOPYBYTES2(pSoftKbdData, cbCapture, u.pSoftKbdData);
  5634. UserFreePool(pSoftKbdData);
  5635. }
  5636. else {
  5637. pSoftKbdData = (PSOFTKBDDATA)lParam;
  5638. LARGECOPYBYTES2(pSoftKbdData, cbCapture, u.pSoftKbdData);
  5639. }
  5640. }
  5641. /*
  5642. * Fall thur.
  5643. */
  5644. default:
  5645. MAKECALLCAPTURE(FNIMECONTROL);
  5646. UNLOCKPWND();
  5647. CHECKRETURN();
  5648. break;
  5649. }
  5650. TRACECALLBACKMSG("SfnINSTRINGNULL");
  5651. ENDSENDCAPTURE(LRESULT,0);
  5652. }
  5653. #endif // SENDSIDE
  5654. #ifdef RECVSIDE
  5655. RECVCALL(fnIMECONTROL, FNIMECONTROLMSG)
  5656. {
  5657. BYTE abOutput[CALLBACKSTACKLIMIT];
  5658. LPARAM lParam;
  5659. BEGINRECV(0, NULL, pmsg->cbOutput);
  5660. FIXUPPOINTERS();
  5661. if (pmsg->cbOutput <= CALLBACKSTACKLIMIT)
  5662. CallbackStatus.pOutput = abOutput;
  5663. else
  5664. CallbackStatus.pOutput = pmsg->pOutput;
  5665. switch (CALLDATA(wParam)) {
  5666. case IMC_GETCANDIDATEPOS:
  5667. case IMC_GETCOMPOSITIONWINDOW:
  5668. case IMC_GETCOMPOSITIONFONT:
  5669. case IMC_GETSOFTKBDFONT:
  5670. lParam = (LPARAM)CallbackStatus.pOutput;
  5671. break;
  5672. case IMC_SETCANDIDATEPOS:
  5673. case IMC_SETCOMPOSITIONWINDOW:
  5674. case IMC_SETCOMPOSITIONFONT:
  5675. case IMC_SETSOFTKBDDATA:
  5676. lParam = FIRSTFIXUP(u.lParam);
  5677. break;
  5678. default:
  5679. lParam = CALLDATA(u.lParam);
  5680. break;
  5681. }
  5682. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  5683. CALLDATA(pwnd),
  5684. CALLDATA(msg),
  5685. CALLDATA(wParam),
  5686. lParam,
  5687. CALLDATA(xParam));
  5688. ENDRECV();
  5689. }
  5690. #endif // RECVSIDE
  5691. /**************************************************************************\
  5692. * fnIMEREQUEST
  5693. *
  5694. * 22-Apr-1996 Created
  5695. \**************************************************************************/
  5696. #ifdef LATER
  5697. typedef struct _FNIMEREQUEST {
  5698. CAPTUREBUF CaptureBuf;
  5699. PWND pwnd;
  5700. UINT msg;
  5701. WPARAM wParam;
  5702. union {
  5703. LPCANDIDATEFORM pCandidateForm;
  5704. LPLOGFONTA pLogFontA;
  5705. LPLOGFONTW pLogFontW;
  5706. LPCOMPOSITIONFORM pCompositionForm;
  5707. LPRECONVERTSTRING pReconvertString;
  5708. LPPrivateIMECHARPOSITION pImeCharPosition;
  5709. LPARAM lParam;
  5710. } u;
  5711. ULONG_PTR xParam;
  5712. PROC xpfnProc;
  5713. PBYTE pOutput;
  5714. DWORD cbOutput;
  5715. BOOL fAnsi;
  5716. } FNIMEREQUESTMSG;
  5717. #ifdef SENDSIDE
  5718. SMESSAGECALL(IMEREQUEST)
  5719. {
  5720. DWORD cCapture, cbCapture;
  5721. SETUPPWND(FNIMEREQUEST)
  5722. //
  5723. // IMEREQUEST assumes the callback is within the thread
  5724. // (see MESSAGECALL(IMEREQUEST) in kernel/ntstubs.c.)
  5725. //
  5726. // All the data pointed by lParam should point the valid
  5727. // client side address. Thus all the validation and copy
  5728. // (if needed) will be done in the receiver side.
  5729. //
  5730. UserAssert(psms == NULL || psms->ptiSender == psms->ptiReceiver);
  5731. switch (wParam) {
  5732. case IMR_CANDIDATEWINDOW:
  5733. cCapture = 1;
  5734. cbCapture = sizeof(CANDIDATEFORM);
  5735. break;
  5736. case IMR_COMPOSITIONWINDOW:
  5737. cCapture = 1;
  5738. cbCapture = sizeof(COMPOSITIONFORM);
  5739. break;
  5740. case IMR_CONFIRMRECONVERTSTRING:
  5741. case IMR_RECONVERTSTRING:
  5742. case IMR_DOCUMENTFEED:
  5743. case IMR_QUERYCHARPOSITION:
  5744. cCapture = 0;
  5745. cbCapture = 0;
  5746. break;
  5747. case IMR_COMPOSITIONFONT: // only the exception to the rule above.
  5748. cCapture = 1;
  5749. cbCapture = (dwSCMSFlags & SCMS_FLAGS_ANSI) ? sizeof(LOGFONTA) : sizeof(LOGFONTW);
  5750. break;
  5751. default:
  5752. UserAssert(FALSE);
  5753. cCapture = 0;
  5754. cbCapture = 0;
  5755. break;
  5756. }
  5757. BEGINSENDCAPTURE(FNIMEREQUEST, cCapture, cbCapture, TRUE);
  5758. MSGDATA()->pwnd = pwndClient;
  5759. MSGDATA()->msg = msg;
  5760. MSGDATA()->wParam = wParam;
  5761. MSGDATA()->u.lParam = lParam;
  5762. MSGDATA()->xParam = xParam;
  5763. MSGDATA()->xpfnProc = xpfnProc;
  5764. MSGDATA()->fAnsi = (dwSCMSFlags & SCMS_FLAGS_ANSI);
  5765. LOCKPWND();
  5766. //
  5767. // Preparation
  5768. //
  5769. switch (wParam) {
  5770. case IMR_COMPOSITIONFONT:
  5771. RESERVEBYTES(cbCapture, pOutput, cbOutput);
  5772. break;
  5773. }
  5774. MAKECALLCAPTURE(FNIMEREQUEST);
  5775. UNLOCKPWND();
  5776. CHECKRETURN();
  5777. BEGINCOPYOUT()
  5778. try {
  5779. switch (wParam) {
  5780. case IMR_COMPOSITIONFONT:
  5781. ProbeForRead(pcbs->pOutput, pcbs->cbOutput, sizeof(DWORD));
  5782. if (dwSCMSFlags & SCMS_FLAGS_ANSI) {
  5783. CopyLogFontAtoW((PLOGFONTW)lParam, (PLOGFONTA)pcbs->pOutput);
  5784. }
  5785. else {
  5786. memcpy((LPBYTE)lParam, pcbs->pOutput, cbCapture);
  5787. }
  5788. break;
  5789. }
  5790. } except (EXCEPTION_EXECUTE_HANDLER) {
  5791. MSGERROR();
  5792. }
  5793. ENDCOPYOUT()
  5794. TRACECALLBACKMSG("SfnIMEREQUEST");
  5795. ENDSENDCAPTURE(LRESULT,0);
  5796. }
  5797. #endif // SENDSIDE
  5798. #ifdef RECVSIDE
  5799. RECVCALL(fnIMEREQUEST, FNIMEREQUESTMSG)
  5800. {
  5801. BYTE abOutput[CALLBACKSTACKLIMIT];
  5802. LPVOID pvNew = NULL;
  5803. LPARAM lParam;
  5804. BEGINRECV(0, NULL, pmsg->cbOutput);
  5805. FIXUPPOINTERS();
  5806. if (pmsg->cbOutput <= CALLBACKSTACKLIMIT)
  5807. CallbackStatus.pOutput = abOutput;
  5808. else
  5809. CallbackStatus.pOutput = pmsg->pOutput;
  5810. lParam = CALLDATA(u.lParam);
  5811. switch (CALLDATA(wParam)) {
  5812. case IMR_COMPOSITIONWINDOW:
  5813. case IMR_CANDIDATEWINDOW:
  5814. // lParam = CALLDATA(lParam);
  5815. break;
  5816. case IMR_COMPOSITIONFONT:
  5817. lParam = (LPARAM)CallbackStatus.pOutput;
  5818. break;
  5819. case IMR_QUERYCHARPOSITION:
  5820. if (CALLDATA(fAnsi)) {
  5821. LPPrivateIMECHARPOSITION lpCharPos;
  5822. pvNew = UserLocalAlloc(0, sizeof(PrivateIMECHARPOSITION));
  5823. if (pvNew == NULL) {
  5824. goto error_return;
  5825. }
  5826. lpCharPos = pvNew;
  5827. *lpCharPos = *CALLDATA(u.pImeCharPosition);
  5828. lpCharPos->dwCharPos = lpCharPos->dwCharPositionA;
  5829. }
  5830. break;
  5831. case IMR_RECONVERTSTRING:
  5832. case IMR_CONFIRMRECONVERTSTRING:
  5833. case IMR_DOCUMENTFEED:
  5834. // Real W/A conversion may be needed.
  5835. if (CALLDATA(fAnsi) && lParam) {
  5836. PRECONVERTSTRING Source = (LPRECONVERTSTRING)lParam;
  5837. // Do conversion.
  5838. DWORD dwNewSize = ImmGetReconvertTotalSize(((LPRECONVERTSTRING)lParam)->dwSize, FROM_IME, TRUE);
  5839. if (dwNewSize == 0) {
  5840. goto error_return;
  5841. }
  5842. pvNew = UserLocalAlloc(0, dwNewSize);
  5843. if (pvNew == NULL) {
  5844. goto error_return;
  5845. }
  5846. lParam = (LPARAM)pvNew;
  5847. #define lpReconv ((LPRECONVERTSTRING)lParam)
  5848. // setup the information in the allocated structure
  5849. lpReconv->dwVersion = 0;
  5850. lpReconv->dwSize = dwNewSize;
  5851. if (CALLDATA(wParam) == IMR_CONFIRMRECONVERTSTRING) {
  5852. ImmReconversionWorker(lpReconv, (LPRECONVERTSTRING)lParam, TRUE, CP_ACP);
  5853. }
  5854. }
  5855. break;
  5856. default:
  5857. lParam = CALLDATA(u.lParam);
  5858. break;
  5859. }
  5860. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  5861. CALLDATA(pwnd),
  5862. CALLDATA(msg),
  5863. CALLDATA(wParam),
  5864. lParam,
  5865. CALLDATA(xParam));
  5866. switch (CALLDATA(wParam)) {
  5867. case IMR_RECONVERTSTRING:
  5868. case IMR_DOCUMENTFEED:
  5869. if (CALLDATA(fAnsi)) {
  5870. retval = ImmGetReconvertTotalSize((DWORD)retval, FROM_APP, TRUE);
  5871. if (lParam) {
  5872. retval = ImmReconversionWorker((LPRECONVERTSTRING)CALLDATA(u.lParam), (LPRECONVERTSTRING)pvNew, FALSE, CP_ACP);
  5873. }
  5874. }
  5875. break;
  5876. }
  5877. if (pvNew) {
  5878. UserLocalFree(pvNew);
  5879. }
  5880. error_return:
  5881. ENDRECV();
  5882. }
  5883. #undef lpReconv
  5884. #endif // RECVSIDE
  5885. #endif
  5886. /**************************************************************************\
  5887. * fnGETDBCSTEXTLENGTHS (DBCS-aware Version)
  5888. *
  5889. * Gets the Unicode & ANSI lengths
  5890. * Internally, lParam pints to the ANSI length in bytes and the return value
  5891. * is the Unicode length in bytes. However, the public definition is maintained
  5892. * on the client side, where lParam is not used and either ANSI or Unicode is
  5893. * returned.
  5894. *
  5895. * 14-Mar-1996 HideyukN Created
  5896. \**************************************************************************/
  5897. #if (WM_GETTEXTLENGTH - WM_GETTEXT) != 1
  5898. #error "WM_GETTEXT Messages no longer 1 apart. Error in code."
  5899. #endif
  5900. #if (LB_GETTEXTLEN - LB_GETTEXT) != 1
  5901. #error "LB_GETTEXT Messages no longer 1 apart. Error in code."
  5902. #endif
  5903. #if (CB_GETLBTEXTLEN - CB_GETLBTEXT) != 1
  5904. #error "CB_GETLBTEXT Messages no longer 1 apart. Error in code."
  5905. #endif
  5906. typedef struct _FNGETDBCSTEXTLENGTHSMSG {
  5907. PWND pwnd;
  5908. UINT msg;
  5909. WPARAM wParam;
  5910. ULONG_PTR xParam;
  5911. PROC xpfnProc;
  5912. } FNGETDBCSTEXTLENGTHSMSG;
  5913. #ifdef SENDSIDE
  5914. SMESSAGECALL(GETDBCSTEXTLENGTHS)
  5915. {
  5916. BOOL fAnsiSender = !!(BOOL)lParam;
  5917. BOOL fAnsiReceiver = ((dwSCMSFlags & SCMS_FLAGS_ANSI) != 0);
  5918. LPVOID pfnSavedWndProc = pwnd->lpfnWndProc;
  5919. SETUPPWND(FNGETDBCSTEXTLENGTHS)
  5920. BEGINSEND(FNGETDBCSTEXTLENGTHS)
  5921. UserAssert((fAnsiReceiver & 1) == fAnsiReceiver && (fAnsiSender & 1) == fAnsiSender);
  5922. MSGDATA()->pwnd = pwndClient;
  5923. MSGDATA()->msg = msg;
  5924. MSGDATA()->wParam = wParam;
  5925. MSGDATA()->xParam = xParam;
  5926. MSGDATA()->xpfnProc = xpfnProc;
  5927. LOCKPWND();
  5928. MAKECALL(FNGETTEXTLENGTHS);
  5929. UNLOCKPWND();
  5930. CHECKRETURN1();
  5931. /*
  5932. * ANSI client wndproc returns us cbANSI. We want cchUnicode,
  5933. * so we guess cchUnicode = cbANSI. (It may be less if
  5934. * multi-byte characters are involved, but it will never be more).
  5935. * Save cbANSI in *lParam in case the server ultimately returns
  5936. * the length to an ANSI caller.
  5937. *
  5938. * Unicode client wndproc returns us cchUnicode. If we want to know
  5939. * cbANSI, we must guess how many 'ANSI' chars we would need.
  5940. * We guess cbANSI = cchUnicode * 2. (It may be this much if all
  5941. * 'ANSI' characters are multi-byte, but it will never be more).
  5942. *
  5943. * Return cchUnicode (server code is all Unicode internally).
  5944. * Put cbANSI in *lParam to be passed along within the server in case
  5945. * we ultimately need to return it to the client.
  5946. *
  5947. * NOTE: this will sometimes cause text lengths to be misreported
  5948. * up to twice the real length, but that is expected to be harmless.
  5949. * This will only * happen if an app sends WM_GETcode TEXTLENGTH to a
  5950. * window with an ANSI client-side wndproc, or a ANSI WM_GETTEXTLENGTH
  5951. * is sent to a Unicode client-side wndproc.
  5952. */
  5953. BEGINCOPYOUT()
  5954. //
  5955. // retval can be [CB|LB]_ERR (-1) or [CB|LB]_ERRSPACE (-2)
  5956. // then, it should be grater then zero. otherwise we can handle
  5957. // it as error, or zero length string.
  5958. //
  5959. if ((LONG)retval > 0) {
  5960. //
  5961. // Check we need to Ansi <-> Unicode conversion.
  5962. //
  5963. if (fAnsiSender != fAnsiReceiver) {
  5964. if (pwnd->lpfnWndProc != pfnSavedWndProc) {
  5965. // The window procedure is changed during the first callback.
  5966. // Let's take a guess for the worst case.
  5967. RIPMSG1(RIP_WARNING, "GETTEXTLENGTHS(pwnd=%x): The subclass status of winproc changed during 1st callback.",
  5968. pwnd);
  5969. retval *= 2;
  5970. }
  5971. else {
  5972. BOOL bNotString = FALSE; // default is string....
  5973. if (msg != WM_GETTEXTLENGTH) {
  5974. DWORD dw;
  5975. if (!RevalidateHwnd(HW(pwnd))) {
  5976. MSGERROR1();
  5977. }
  5978. //
  5979. // Get window style.
  5980. //
  5981. dw = pwnd->style;
  5982. if (msg == LB_GETTEXTLEN) {
  5983. //
  5984. // See if the control is ownerdraw and does not have the LBS_HASSTRINGS
  5985. // style.
  5986. //
  5987. bNotString = (!(dw & LBS_HASSTRINGS) &&
  5988. (dw & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)));
  5989. } else if (msg == CB_GETLBTEXTLEN) {
  5990. //
  5991. // See if the control is ownerdraw and does not have the CBS_HASSTRINGS
  5992. // style.
  5993. //
  5994. bNotString = (!(dw & CBS_HASSTRINGS) &&
  5995. (dw & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)));
  5996. } else {
  5997. MSGERROR1();
  5998. }
  5999. //
  6000. // if so, the length should be ULONG_PTR.
  6001. //
  6002. if (bNotString) {
  6003. retval = sizeof(ULONG_PTR);
  6004. }
  6005. }
  6006. //
  6007. // if the target data is "string", get it, and compute the length
  6008. //
  6009. if (!bNotString) {
  6010. if (PtiCurrent()->TIF_flags & TIF_INGETTEXTLENGTH) {
  6011. if (fAnsiSender) {
  6012. UserAssert(!fAnsiReceiver);
  6013. //
  6014. // retval has Unicode character count, guessed DBCS length.
  6015. //
  6016. retval *= 2;
  6017. }
  6018. } else {
  6019. //
  6020. // fAnsiReceiver == 1, retval has MBCS character count.
  6021. // fAnsiReceiver == 0, retval has Unicode character count.
  6022. //
  6023. // Add 1 to make room for zero-terminator.
  6024. //
  6025. DWORD cchText = (DWORD)retval + 1;
  6026. DWORD cbCapture = cchText;
  6027. SETUPPWND(FNOUTSTRING)
  6028. PtiCurrent()->TIF_flags |= TIF_INGETTEXTLENGTH;
  6029. //
  6030. // if reciver is Unicode, The buffder should be reserved as musg as
  6031. // (TextLength * sizeof(WCHAR).
  6032. //
  6033. if (!fAnsiReceiver) {
  6034. cbCapture *= sizeof(WCHAR);
  6035. }
  6036. BEGINSENDCAPTURE(FNOUTSTRING, 1, cbCapture, FALSE)
  6037. MSGDATA()->pwnd = pwndClient;
  6038. //
  6039. // Use (msg-1) for sending the WM_GETTEXT, LB_GETTEXT or CB_GETLBTEXT
  6040. // since the above precompiler checks passed.
  6041. //
  6042. MSGDATA()->msg = msg-1;
  6043. if (msg == WM_GETTEXTLENGTH) {
  6044. //
  6045. // WM_GETTEXT:
  6046. // wParam = cchTextMax; // number of character to copy.
  6047. // lParam = lpszText; // address of buffer for text.
  6048. //
  6049. MSGDATA()->wParam = cchText;
  6050. } else {
  6051. //
  6052. // LB_GETTEXT:
  6053. // CB_GETLBTEXT:
  6054. // wParam = index; // item index
  6055. // lParam = lpszText; // address of buffer for text.
  6056. //
  6057. MSGDATA()->wParam = wParam;
  6058. }
  6059. MSGDATA()->xParam = xParam;
  6060. MSGDATA()->xpfnProc = xpfnProc;
  6061. RESERVEBYTES(cbCapture, pOutput, cbOutput);
  6062. LOCKPWND();
  6063. MAKECALLCAPTURE(FNOUTSTRING);
  6064. UNLOCKPWND();
  6065. CHECKRETURN();
  6066. BEGINCOPYOUT()
  6067. //
  6068. // retval can be [CB|LB]_ERR (-1) or [CB|LB]_ERRSPACE (-2)
  6069. // then, it should be grater then zero.
  6070. //
  6071. if ((LONG)retval > 0) {
  6072. /*
  6073. * Non-zero retval means some text to copy out.
  6074. */
  6075. CALC_SIZE_STRING_OUT((LONG)retval);
  6076. }
  6077. ENDCOPYOUT()
  6078. PtiCurrent()->TIF_flags &= ~TIF_INGETTEXTLENGTH;
  6079. TRACECALLBACKMSG("SfnOUTSTRING");
  6080. ENDSENDCAPTURE(LRESULT,0);
  6081. }
  6082. }
  6083. }
  6084. }
  6085. }
  6086. ENDCOPYOUT()
  6087. TRACECALLBACKMSG("SfnGETDBCSTEXTLENGTHS");
  6088. ENDSEND1(LRESULT,0);
  6089. }
  6090. #endif // SENDSIDE
  6091. #ifdef RECVSIDE
  6092. /*
  6093. * The fnGETTEXTLENGTHS routine is used for this message (see... client\dispcb.tpl)
  6094. */
  6095. #endif // RECVSIDE
  6096. /***************************************************************************\
  6097. * xxxClientMonitorEnumProc
  6098. *
  6099. * Calls the client callback given to EnumDisplayMonitors.
  6100. *
  6101. * History:
  6102. * 05-Sep-1996 adams Created.
  6103. \***************************************************************************/
  6104. typedef struct _CLIENTMONITORENUMPROCMSG {
  6105. HMONITOR hMonitor;
  6106. HDC hdcMonitor;
  6107. RECT rc;
  6108. LPARAM dwData;
  6109. MONITORENUMPROC xpfnProc;
  6110. } CLIENTMONITORENUMPROCMSG;
  6111. #ifdef SENDSIDE
  6112. BOOL xxxClientMonitorEnumProc(
  6113. HMONITOR hMonitor,
  6114. HDC hdcMonitor,
  6115. LPRECT lprc,
  6116. LPARAM dwData,
  6117. MONITORENUMPROC xpfnProc)
  6118. {
  6119. SETUP(CLIENTMONITORENUMPROC)
  6120. BEGINSEND(CLIENTMONITORENUMPROCMSG)
  6121. MSGDATA()->hMonitor = hMonitor;
  6122. MSGDATA()->hdcMonitor = hdcMonitor;
  6123. MSGDATA()->rc = *lprc;
  6124. MSGDATA()->dwData = dwData;
  6125. MSGDATA()->xpfnProc = xpfnProc;
  6126. MAKECALL(CLIENTMONITORENUMPROC);
  6127. CHECKRETURN();
  6128. TRACECALLBACK("SxxxClientMonitorEnumProc");
  6129. ENDSEND(BOOL,FALSE);
  6130. }
  6131. #endif // SENDSIDE
  6132. #ifdef RECVSIDE
  6133. RECVCALL(ClientMonitorEnumProc, CLIENTMONITORENUMPROCMSG)
  6134. {
  6135. BEGINRECV(FALSE, NULL, 0);
  6136. retval = (DWORD)CALLPROC(pmsg->xpfnProc)(
  6137. CALLDATA(hMonitor),
  6138. CALLDATA(hdcMonitor),
  6139. PCALLDATA(rc),
  6140. CALLDATA(dwData));
  6141. ENDRECV();
  6142. }
  6143. #endif // RECVSIDE
  6144. /**************************************************************************\
  6145. * xxxUserModeCallback
  6146. *
  6147. * Generic kernel callback stub
  6148. *
  6149. * 10/28/96 GerardoB Created
  6150. \**************************************************************************/
  6151. #ifdef SENDSIDE
  6152. NTSTATUS xxxUserModeCallback (ULONG uApi, PVOID pIn, ULONG cbIn, PVOID pOut, ULONG cbOut)
  6153. {
  6154. NTSTATUS Status;
  6155. PVOID pLocalOut;
  6156. ULONG cbLocalOut;
  6157. /*
  6158. * Call the client
  6159. */
  6160. LeaveCrit();
  6161. Status = KeUserModeCallback(uApi, pIn, cbIn, &pLocalOut, &cbLocalOut);
  6162. EnterCrit();
  6163. /*
  6164. * If it failed, bail
  6165. */
  6166. if (!NT_SUCCESS(Status)) {
  6167. return Status;
  6168. }
  6169. /*
  6170. * If we didn't get the right amount of data, fail.
  6171. */
  6172. if (cbLocalOut != cbOut) {
  6173. RIPMSG3(RIP_WARNING, "xxxUserModeCallback: uAPi: %#lx cbOut: %#lx cbLocalOut: %#lx",
  6174. uApi, cbOut, cbLocalOut);
  6175. return STATUS_UNSUCCESSFUL;
  6176. }
  6177. /*
  6178. * If we were expecting some data, copy it.
  6179. */
  6180. if (cbOut != 0) {
  6181. try {
  6182. ProbeForRead(pLocalOut, cbLocalOut, sizeof(DWORD));
  6183. RtlCopyMemory(pOut, pLocalOut, cbLocalOut);
  6184. } except (W32ExceptionHandler(FALSE, RIP_WARNING)) {
  6185. RIPMSG2(RIP_WARNING, "xxxUserModeCallback: uAPi: %#lx Exception: %#lx", uApi, GetExceptionCode());
  6186. Status = STATUS_UNSUCCESSFUL;
  6187. }
  6188. }
  6189. return Status;
  6190. }
  6191. #endif // SENDSIDE
  6192. /**************************************************************************\
  6193. * fnINOUTMENUGETOBJECT
  6194. *
  6195. * 11/12/96 GerardoB Created
  6196. \**************************************************************************/
  6197. typedef struct _FNINOUTMENUGETOBJECTMSG {
  6198. PWND pwnd;
  6199. UINT msg;
  6200. WPARAM wParam;
  6201. MENUGETOBJECTINFO mngoi;
  6202. ULONG_PTR xParam;
  6203. PROC xpfnProc;
  6204. } FNINOUTMENUGETOBJECTMSG;
  6205. #ifdef SENDSIDE
  6206. SMESSAGECALL(INOUTMENUGETOBJECT)
  6207. {
  6208. SETUPPWND(FNINOUTMENUGETOBJECT)
  6209. UNREFERENCED_PARAMETER(dwSCMSFlags);
  6210. BEGINSEND(FNOUTDWORDINDWORD)
  6211. PMENUGETOBJECTINFO pmngoi = (PMENUGETOBJECTINFO)lParam;
  6212. MSGDATA()->pwnd = pwndClient;
  6213. MSGDATA()->msg = msg;
  6214. MSGDATA()->wParam = wParam;
  6215. MSGDATA()->mngoi = *pmngoi;
  6216. MSGDATA()->xParam = xParam;
  6217. MSGDATA()->xpfnProc = xpfnProc;
  6218. LOCKPWND();
  6219. MAKECALL(FNINOUTMENUGETOBJECT);
  6220. UNLOCKPWND();
  6221. CHECKRETURN();
  6222. BEGINCOPYOUT()
  6223. try {
  6224. UserAssert(pcbs->cbOutput == sizeof(pmngoi->pvObj));
  6225. ProbeForRead(pcbs->pOutput, sizeof(pmngoi->pvObj), sizeof(DWORD));
  6226. pmngoi->pvObj = *((PVOID *)(pcbs->pOutput));
  6227. } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
  6228. MSGERROR();
  6229. }
  6230. ENDCOPYOUT()
  6231. TRACECALLBACKMSG("SfnINOUTMENUGETOBJECT");
  6232. ENDSEND(LRESULT, 0);
  6233. }
  6234. #endif // SENDSIDE
  6235. #ifdef RECVSIDE
  6236. RECVCALL(fnINOUTMENUGETOBJECT, FNINOUTMENUGETOBJECTMSG)
  6237. {
  6238. BEGINRECV(0, &(pmsg->mngoi.pvObj), sizeof(pmsg->mngoi.pvObj));
  6239. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  6240. CALLDATA(pwnd),
  6241. CALLDATA(msg),
  6242. CALLDATA(wParam),
  6243. PCALLDATA(mngoi),
  6244. CALLDATA(xParam));
  6245. ENDRECV();
  6246. }
  6247. #endif // RECVSIDE
  6248. /**************************************************************************\
  6249. * fnLOGONNOTIFY
  6250. *
  6251. * 2/1/97 JerrySh Created
  6252. \**************************************************************************/
  6253. typedef struct _FNLOGONNOTIFYMSG {
  6254. PWND pwnd;
  6255. UINT msg;
  6256. WPARAM wParam;
  6257. LPARAM lParam;
  6258. POWERSTATEPARAMS psParams;
  6259. ULONG_PTR xParam;
  6260. PROC xpfnProc;
  6261. } FNLOGONNOTIFYMSG;
  6262. #ifdef SENDSIDE
  6263. SMESSAGECALL(LOGONNOTIFY)
  6264. {
  6265. SETUPPWND(FNLOGONNOTIFY)
  6266. UNREFERENCED_PARAMETER(dwSCMSFlags);
  6267. UNREFERENCED_PARAMETER(psms);
  6268. BEGINSEND(FNLOGONNOTIFY)
  6269. PPOWERSTATEPARAMS ppsParams = (PPOWERSTATEPARAMS)lParam;
  6270. if (wParam == LOGON_POWERSTATE ||
  6271. wParam == LOGON_REMOVE_POWER_MESSAGE ||
  6272. wParam == LOGON_SHOW_POWER_MESSAGE) {
  6273. MSGDATA()->psParams = *((PPOWERSTATEPARAMS)lParam);
  6274. }
  6275. MSGDATA()->pwnd = pwndClient;
  6276. MSGDATA()->msg = msg;
  6277. MSGDATA()->wParam = wParam;
  6278. MSGDATA()->lParam = lParam;
  6279. MSGDATA()->xParam = xParam;
  6280. MSGDATA()->xpfnProc = xpfnProc;
  6281. LOCKPWND();
  6282. MAKECALL(FNLOGONNOTIFY);
  6283. UNLOCKPWND();
  6284. CHECKRETURN();
  6285. if (wParam == LOGON_POWERSTATE) {
  6286. BEGINCOPYOUT()
  6287. OUTSTRUCT(ppsParams, POWERSTATEPARAMS);
  6288. ENDCOPYOUT()
  6289. }
  6290. TRACECALLBACKMSG("SfnLOGONNOTIFY");
  6291. ENDSEND(LRESULT, 0);
  6292. }
  6293. #endif // SENDSIDE
  6294. #ifdef RECVSIDE
  6295. RECVCALL(fnLOGONNOTIFY, FNLOGONNOTIFYMSG)
  6296. {
  6297. BEGINRECV(0, &pmsg->psParams, sizeof(pmsg->psParams));
  6298. if (CALLDATA(wParam) == LOGON_POWERSTATE ||
  6299. CALLDATA(wParam) == LOGON_REMOVE_POWER_MESSAGE ||
  6300. CALLDATA(wParam) == LOGON_SHOW_POWER_MESSAGE) {
  6301. CALLDATA(lParam) = (LPARAM)&CALLDATA(psParams);
  6302. }
  6303. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  6304. CALLDATA(pwnd),
  6305. CALLDATA(msg),
  6306. CALLDATA(wParam),
  6307. CALLDATA(lParam),
  6308. CALLDATA(xParam));
  6309. ENDRECV();
  6310. }
  6311. #endif // RECVSIDE
  6312. /**************************************************************************\
  6313. * xxxClientCallWinEventProc
  6314. *
  6315. * cf. Win'97 Call32BitEventProc() in user_40\user32\user.c
  6316. *
  6317. * 1996-10-18 IanJa Created
  6318. \**************************************************************************/
  6319. typedef struct _CLIENTCALLWINEVENTPROCMSG {
  6320. WINEVENTPROC pfn;
  6321. HWINEVENTHOOK hWinEventHook;
  6322. DWORD event;
  6323. HWND hwnd;
  6324. LONG idObject;
  6325. LONG idChild;
  6326. DWORD idEventThread;
  6327. DWORD dwmsEventTime;
  6328. } CLIENTCALLWINEVENTPROCMSG;
  6329. #ifdef SENDSIDE
  6330. BOOL xxxClientCallWinEventProc(
  6331. WINEVENTPROC pfn,
  6332. PEVENTHOOK pEventHook,
  6333. PNOTIFY pNotify)
  6334. {
  6335. SETUP(CLIENTCALLWINEVENTPROC)
  6336. BEGINSEND(CLIENTCALLWINEVENTPROC)
  6337. MSGDATA()->pfn = pfn;
  6338. MSGDATA()->hWinEventHook = (HWINEVENTHOOK)PtoH(pEventHook);
  6339. MSGDATA()->hwnd = pNotify->hwnd;
  6340. MSGDATA()->event = pNotify->event;
  6341. MSGDATA()->idObject = pNotify->idObject;
  6342. MSGDATA()->idChild = pNotify->idChild;
  6343. MSGDATA()->idEventThread = pNotify->idSenderThread;
  6344. MSGDATA()->dwmsEventTime = pNotify->dwEventTime;
  6345. MAKECALL(CLIENTCALLWINEVENTPROC);
  6346. CHECKRETURN();
  6347. TRACECALLBACK("xxxClientCallWinEventProc");
  6348. ENDSEND(BOOL, FALSE);
  6349. }
  6350. #endif // SENDSIDE
  6351. #ifdef RECVSIDE
  6352. RECVCALL(ClientCallWinEventProc, CLIENTCALLWINEVENTPROCMSG)
  6353. {
  6354. BEGINRECV(FALSE, NULL, 0);
  6355. retval = (DWORD)CALLPROC(pmsg->pfn)(
  6356. CALLDATA(hWinEventHook),
  6357. CALLDATA(event),
  6358. CALLDATA(hwnd),
  6359. CALLDATA(idObject),
  6360. CALLDATA(idChild),
  6361. CALLDATA(idEventThread),
  6362. CALLDATA(dwmsEventTime));
  6363. ENDRECV();
  6364. }
  6365. #endif // RECVSIDE
  6366. /**************************************************************************\
  6367. * WOWGetProcModule
  6368. *
  6369. * 3/25/97 FritzS created
  6370. \**************************************************************************/
  6371. typedef struct _CLIENTWOWGETPROCMODULEMSG {
  6372. WNDPROC_PWND pfn;
  6373. } CLIENTWOWGETPROCMODULEMSG;
  6374. #ifdef SENDSIDE
  6375. WORD xxxClientWOWGetProcModule(
  6376. WNDPROC_PWND pfn)
  6377. {
  6378. SETUP(CLIENTWOWGETPROCMODULE)
  6379. BEGINSEND(CLIENTWOWGETPROCMODULE)
  6380. MSGDATA()->pfn = pfn;
  6381. MAKECALL(CLIENTWOWGETPROCMODULE);
  6382. CHECKRETURN();
  6383. TRACECALLBACK("xxxWOWGetProcModule");
  6384. ENDSEND(WORD, FALSE);
  6385. }
  6386. #endif // SENDSIDE
  6387. #ifdef RECVSIDE
  6388. RECVCALL(ClientWOWGetProcModule, CLIENTWOWGETPROCMODULEMSG)
  6389. {
  6390. ULONG ulReal;
  6391. BEGINRECV(0, NULL, 0);
  6392. if ((pfnWowGetProcModule == NULL) || !IsWOWProc(CALLDATA(pfn))) {
  6393. retval = 0;
  6394. } else {
  6395. UnMarkWOWProc(CALLDATA(pfn),ulReal);
  6396. retval = (pfnWowGetProcModule)(ulReal);
  6397. }
  6398. ENDRECV();
  6399. }
  6400. #endif // RECVSIDE
  6401. /**************************************************************************\
  6402. * WOWTask16SchedNotify
  6403. *
  6404. * 12/20/00 ARR created
  6405. \**************************************************************************/
  6406. typedef struct _CLIENTWOWTASK16SCHEDNOTIFYMSG {
  6407. DWORD NotifyParm;
  6408. DWORD dwParam;
  6409. } CLIENTWOWTASK16SCHEDNOTIFYMSG;
  6410. #ifdef SENDSIDE
  6411. DWORD xxxClientWOWTask16SchedNotify(
  6412. DWORD NotifyParm,
  6413. DWORD dwParam)
  6414. {
  6415. SETUP(CLIENTWOWTASK16SCHEDNOTIFY)
  6416. BEGINSEND(CLIENTWOWTASK16SCHEDNOTIFY)
  6417. MSGDATA()->NotifyParm = NotifyParm;
  6418. MSGDATA()->dwParam = dwParam;
  6419. MAKECALL(CLIENTWOWTASK16SCHEDNOTIFY);
  6420. CHECKRETURN();
  6421. TRACECALLBACK("xxxWOWTask16SchedNotify");
  6422. ENDSEND(DWORD, FALSE);
  6423. }
  6424. #endif // SENDSIDE
  6425. #ifdef RECVSIDE
  6426. RECVCALL(ClientWOWTask16SchedNotify, CLIENTWOWTASK16SCHEDNOTIFYMSG)
  6427. {
  6428. BEGINRECV(0, NULL, 0);
  6429. if (pfnWowTask16SchedNotify == NULL) {
  6430. retval = 1;
  6431. } else {
  6432. retval = (pfnWowTask16SchedNotify)(CALLDATA(NotifyParm),CALLDATA(dwParam));
  6433. }
  6434. ENDRECV();
  6435. }
  6436. #endif // RECVSIDE
  6437. /**************************************************************************\
  6438. * xxxClientLoadStringW
  6439. *
  6440. * Called to load per user ToolTip strings
  6441. *
  6442. * 24-Feb-2000 Mhamid Created
  6443. \**************************************************************************/
  6444. typedef struct _CLIENTLOADSTRINGWMSG {
  6445. CAPTUREBUF CaptureBuf;
  6446. UINT StrID;
  6447. int cch;
  6448. PBYTE pOutput;
  6449. DWORD cbOutput;
  6450. } CLIENTLOADSTRINGWMSG;
  6451. #ifdef SENDSIDE
  6452. int xxxClientLoadStringW(
  6453. IN UINT StrID,
  6454. OUT LPWSTR szText,
  6455. IN int cch)
  6456. {
  6457. DWORD cbCapture;
  6458. PLARGE_STRING pstr;
  6459. BOOL fAnsiReceiver = FALSE;
  6460. LARGE_UNICODE_STRING strName;
  6461. SETUP(CLIENTLOADSTRINGW)
  6462. cbCapture = cch * sizeof(WCHAR);
  6463. RtlInitLargeUnicodeString(&strName, szText, cbCapture);
  6464. pstr = (PLARGE_STRING)&strName;
  6465. BEGINSENDCAPTURE(CLIENTLOADSTRINGW, 1, cbCapture, FALSE)
  6466. MSGDATA()->StrID = StrID;
  6467. MSGDATA()->cch = cch;
  6468. RESERVEBYTES(cbCapture, pOutput, cbOutput);
  6469. MAKECALLCAPTURE(CLIENTLOADSTRINGW);
  6470. CHECKRETURN();
  6471. COPYOUTLPWSTRLIMIT(pstr,cch);
  6472. TRACECALLBACK("ClientLoadStringW");
  6473. ENDSENDCAPTURE(int, 0);
  6474. }
  6475. #endif // SENDSIDE
  6476. #ifdef RECVSIDE
  6477. VOID CheckMsgFontDimensions();
  6478. RECVCALL(ClientLoadStringW, CLIENTLOADSTRINGWMSG)
  6479. {
  6480. BYTE abOutput[CALLBACKSTACKLIMIT];
  6481. BEGINRECV(0, NULL, pmsg->cbOutput);
  6482. FIXUPPOINTERS();
  6483. if (pmsg->cbOutput <= CALLBACKSTACKLIMIT)
  6484. CallbackStatus.pOutput = abOutput;
  6485. else
  6486. CallbackStatus.pOutput = pmsg->pOutput;
  6487. retval = (DWORD)LoadStringOrError(
  6488. hmodUser,
  6489. CALLDATA(StrID),
  6490. (LPWSTR)KPVOID_TO_PVOID(CallbackStatus.pOutput),
  6491. CALLDATA(cch),
  6492. 0);
  6493. ENDRECV();
  6494. }
  6495. #endif // RECVSIDE
  6496. /**************************************************************************\
  6497. * fnOUTLPCOMBOBOXINFO (for CB_GETCOMBOBOXINFO message)
  6498. *
  6499. * 05/12/00 MHamid Created
  6500. \**************************************************************************/
  6501. typedef struct _FNOUTLPCOMBOBOXINFOMSG {
  6502. PWND pwnd;
  6503. UINT msg;
  6504. WPARAM wParam;
  6505. COMBOBOXINFO cbinfo;
  6506. ULONG_PTR xParam;
  6507. PROC xpfnProc;
  6508. } FNOUTLPCOMBOBOXINFOMSG;
  6509. #ifdef SENDSIDE
  6510. SMESSAGECALL(OUTLPCOMBOBOXINFO)
  6511. {
  6512. SETUPPWND(FNOUTLPCOMBOBOXINFO)
  6513. UNREFERENCED_PARAMETER(dwSCMSFlags);
  6514. BEGINSEND(FNOUTLPCOMBOBOXINFO)
  6515. PCOMBOBOXINFO pcbinfo = (PCOMBOBOXINFO)lParam;
  6516. MSGDATA()->pwnd = pwndClient;
  6517. MSGDATA()->msg = msg;
  6518. MSGDATA()->wParam = wParam;
  6519. MSGDATA()->cbinfo = *pcbinfo;
  6520. MSGDATA()->xParam = xParam;
  6521. MSGDATA()->xpfnProc = xpfnProc;
  6522. LOCKPWND();
  6523. MAKECALL(FNOUTLPCOMBOBOXINFO);
  6524. UNLOCKPWND();
  6525. CHECKRETURN();
  6526. BEGINCOPYOUT()
  6527. OUTSTRUCT(pcbinfo, COMBOBOXINFO);
  6528. ENDCOPYOUT()
  6529. TRACECALLBACKMSG("SfnOUTLPCOMBOBOXINFO");
  6530. ENDSEND(LRESULT,0);
  6531. }
  6532. #endif // SENDSIDE
  6533. #ifdef RECVSIDE
  6534. RECVCALL(fnOUTLPCOMBOBOXINFO, FNOUTLPCOMBOBOXINFOMSG)
  6535. {
  6536. BEGINRECV(0, &pmsg->cbinfo, sizeof(pmsg->cbinfo));
  6537. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  6538. pmsg->pwnd,
  6539. pmsg->msg,
  6540. pmsg->wParam,
  6541. PCALLDATA(cbinfo),
  6542. pmsg->xParam);
  6543. ENDRECV();
  6544. }
  6545. #endif // RECVSIDE
  6546. /**************************************************************************\
  6547. * fnOUTLPSCROLLBARINFO (for SBM_GETSCROLLBARINFO message)
  6548. *
  6549. * 05/12/00 MHamid Created
  6550. \**************************************************************************/
  6551. typedef struct _FNOUTLPSCROLLBARINFOMSG {
  6552. PWND pwnd;
  6553. UINT msg;
  6554. WPARAM wParam;
  6555. SCROLLBARINFO sbinfo;
  6556. ULONG_PTR xParam;
  6557. PROC xpfnProc;
  6558. } FNOUTLPSCROLLBARINFOMSG;
  6559. #ifdef SENDSIDE
  6560. SMESSAGECALL(OUTLPSCROLLBARINFO)
  6561. {
  6562. SETUPPWND(FNOUTLPSCROLLBARINFO)
  6563. UNREFERENCED_PARAMETER(dwSCMSFlags);
  6564. BEGINSEND(FNOUTLPSCROLLBARINFO)
  6565. PSCROLLBARINFO psbinfo = (PSCROLLBARINFO)lParam;
  6566. MSGDATA()->pwnd = pwndClient;
  6567. MSGDATA()->msg = msg;
  6568. MSGDATA()->wParam = wParam;
  6569. MSGDATA()->sbinfo = *psbinfo;
  6570. MSGDATA()->xParam = xParam;
  6571. MSGDATA()->xpfnProc = xpfnProc;
  6572. LOCKPWND();
  6573. MAKECALL(FNOUTLPSCROLLBARINFO);
  6574. UNLOCKPWND();
  6575. CHECKRETURN();
  6576. BEGINCOPYOUT()
  6577. OUTSTRUCT(psbinfo, SCROLLBARINFO);
  6578. ENDCOPYOUT()
  6579. TRACECALLBACKMSG("SfnOUTLPSCROLLBARINFO");
  6580. ENDSEND(LRESULT,0);
  6581. }
  6582. #endif // SENDSIDE
  6583. #ifdef RECVSIDE
  6584. RECVCALL(fnOUTLPSCROLLBARINFO, FNOUTLPSCROLLBARINFOMSG)
  6585. {
  6586. BEGINRECV(0, &pmsg->sbinfo, sizeof(pmsg->sbinfo));
  6587. retval = (ULONG_PTR)CALLPROC(CALLDATA(xpfnProc))(
  6588. pmsg->pwnd,
  6589. pmsg->msg,
  6590. pmsg->wParam,
  6591. PCALLDATA(sbinfo),
  6592. pmsg->xParam);
  6593. ENDRECV();
  6594. }
  6595. #endif // RECVSIDE
  6596. /**************************************************************************\
  6597. * GetLUIDDosDrivesOnly
  6598. *
  6599. * Called to check the drive letters used in the LUID DosDevice
  6600. * map. Does not check if the drive letters are used in the Global
  6601. * DosDevices
  6602. *
  6603. * 08/18/00 ELi Created
  6604. \**************************************************************************/
  6605. #ifdef RECVSIDE
  6606. __inline DWORD GetLUIDDosDrivesOnly()
  6607. {
  6608. NTSTATUS Status;
  6609. PROCESS_DEVICEMAP_INFORMATION_EX ProcessDeviceMapInfoEx;
  6610. ProcessDeviceMapInfoEx.Flags = PROCESS_LUID_DOSDEVICES_ONLY;
  6611. Status = NtQueryInformationProcess( NtCurrentProcess(),
  6612. ProcessDeviceMap,
  6613. &ProcessDeviceMapInfoEx,
  6614. sizeof( ProcessDeviceMapInfoEx ),
  6615. NULL
  6616. );
  6617. if (NT_SUCCESS( Status )) {
  6618. return ProcessDeviceMapInfoEx.Query.DriveMap;
  6619. }
  6620. else {
  6621. return 0;
  6622. }
  6623. }
  6624. #endif // RECVSIDE