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.

732 lines
20 KiB

  1. //
  2. // OSI.C
  3. // Operating System Independent DLL
  4. // * Graphical Output tracking (DDI hook/display driver)
  5. // * Window/Task tracking (Window hook)
  6. //
  7. // Copyright(c) Microsoft 1997-
  8. //
  9. #include <as16.h>
  10. #include <version.h>
  11. #include <ndcgver.h>
  12. PALETTEENTRY CODESEG g_osiVgaPalette[16] =
  13. {
  14. {0x00, 0x00, 0x00, 0x00}, // Black 0x00
  15. {0x80, 0x00, 0x00, 0x00}, // Dk Red 0x01
  16. {0x00, 0x80, 0x00, 0x00}, // Dk Green 0x02
  17. {0x80, 0x80, 0x00, 0x00}, // Dk Yellow 0x03
  18. {0x00, 0x00, 0x80, 0x00}, // Dk Blue 0x04
  19. {0x80, 0x00, 0x80, 0x00}, // Dk Purple 0x05
  20. {0x00, 0x80, 0x80, 0x00}, // Dk Teal 0x06
  21. {0xC0, 0xC0, 0xC0, 0x00}, // Gray 0x07
  22. {0x80, 0x80, 0x80, 0x00}, // Dk Gray 0x08 or 0xF8
  23. {0xFF, 0x00, 0x00, 0x00}, // Red 0x09 or 0xF9
  24. {0x00, 0xFF, 0x00, 0x00}, // Green 0x0A or 0xFA
  25. {0xFF, 0xFF, 0x00, 0x00}, // Yellow 0x0B or 0xFB
  26. {0x00, 0x00, 0xFF, 0x00}, // Blue 0x0C or 0xFC
  27. {0xFF, 0x00, 0xFF, 0x00}, // Purple 0x0D or 0xFD
  28. {0x00, 0xFF, 0xFF, 0x00}, // Teal 0x0E or 0xFE
  29. {0xFF, 0xFF, 0xFF, 0x00} // White 0x0F or 0xFF
  30. };
  31. // --------------------------------------------------------------------------
  32. //
  33. // DllEntryPoint
  34. //
  35. // --------------------------------------------------------------------------
  36. BOOL WINAPI DllEntryPoint(DWORD dwReason, WORD hInst, WORD wDS,
  37. WORD wHeapSize, DWORD dwReserved1, WORD wReserved2)
  38. {
  39. switch (dwReason)
  40. {
  41. case DLL_PROCESS_ATTACH:
  42. // First app pulled us in
  43. if (g_cProcesses++ == 0)
  44. {
  45. g_hInstAs16 = (HINSTANCE)hInst;
  46. }
  47. break;
  48. case DLL_PROCESS_DETACH:
  49. // Last app went away
  50. if (--g_cProcesses == 0)
  51. {
  52. // Clean up anything that got left around
  53. OSITerm16(TRUE);
  54. }
  55. break;
  56. }
  57. return(TRUE);
  58. }
  59. //
  60. // OSILoad16
  61. // Called on process attach of mnmcpi32.dll, to establish the flat thunks
  62. // and return back our instance handle
  63. //
  64. void WINAPI OSILoad16
  65. (
  66. LPDWORD lpdwInstance
  67. )
  68. {
  69. DebugEntry(OSI_Load16);
  70. *lpdwInstance = (DWORD)(UINT)g_hInstAs16;
  71. DebugExitVOID(OSI_Load16);
  72. }
  73. // --------------------------------------------------------------------------
  74. //
  75. // OSIInit16
  76. //
  77. // Inits binary patcher, gdi + user patching, windows hooks, etc.
  78. //
  79. // --------------------------------------------------------------------------
  80. BOOL WINAPI OSIInit16
  81. (
  82. DWORD version,
  83. HWND hwndCore,
  84. ATOM atomTrack,
  85. LPDWORD ppSharedMem,
  86. LPDWORD ppoaSharedMem,
  87. LPDWORD ppimSharedMem,
  88. LPDWORD lpsbcEnabled,
  89. LPDWORD ppShuntBuffers,
  90. LPDWORD pBitmasks
  91. )
  92. {
  93. BOOL rc = FALSE;
  94. HGLOBAL hMem;
  95. HMODULE hModDisplay;
  96. DebugEntry(OSIInit16);
  97. //
  98. // Fill in our instance handle. We always return this so the 32-bit
  99. // code can free our library after having loaded it.
  100. //
  101. *lpsbcEnabled = FALSE;
  102. #ifdef DEBUG
  103. g_imSharedData.cbSize = sizeof(g_imSharedData);
  104. #endif
  105. *ppimSharedMem = (DWORD)MapSL(&g_imSharedData);
  106. ASSERT(*ppimSharedMem);
  107. if (version != DCS_MAKE_VERSION())
  108. {
  109. ERROR_OUT(("OSIInit16: failing, version mismatch 0x%lx (core) 0x%lx (dd)",
  110. version, DCS_MAKE_VERSION()));
  111. DC_QUIT;
  112. }
  113. // ONLY ALLOW ONE CLIENT TO INITIALIZE
  114. if (g_asMainWindow != NULL)
  115. {
  116. WARNING_OUT(("OSIInit16: mnmas16.dll was left around last time"));
  117. // If this task is no longer valid, then cleanup for it
  118. if (IsWindow(g_asMainWindow))
  119. {
  120. //
  121. // Uh oh. Somehow a previous version of NM is still around.
  122. // Do the safest thing--refuse to share.
  123. //
  124. ERROR_OUT(("OSIInit16: Another version of NetMeeting is still running!"));
  125. DC_QUIT;
  126. }
  127. // Cleanup (this is similar to the NT dd code)
  128. OSITerm16(TRUE);
  129. ASSERT(!g_asMainWindow);
  130. }
  131. //
  132. // Clear out shared IM memory.
  133. //
  134. g_imSharedData.imSuspended = FALSE;
  135. g_imSharedData.imControlled = FALSE;
  136. g_imSharedData.imPaused = FALSE;
  137. g_imSharedData.imUnattended = FALSE;
  138. g_asMainWindow = hwndCore;
  139. ASSERT(g_asMainWindow);
  140. g_asHostProp = atomTrack;
  141. ASSERT(g_asHostProp);
  142. g_hCoreTask = GetCurrentTask();
  143. g_osiDesktopWindow = GetDesktopWindow();
  144. ASSERT(g_osiDesktopWindow);
  145. //
  146. // DISPLAY DRIVER STUFF
  147. //
  148. hModDisplay = GetModuleHandle("DISPLAY");
  149. g_lpfnSetCursor = (SETCURSORPROC)GetProcAddress(hModDisplay,
  150. MAKEINTRESOURCE(ORD_OEMSETCURSOR));
  151. if (!hModDisplay || !g_lpfnSetCursor)
  152. {
  153. ERROR_OUT(("Couldn't find cursor entry points"));
  154. DC_QUIT;
  155. }
  156. // This doesn't always exist
  157. g_lpfnSaveBits = (SAVEBITSPROC)GetProcAddress(hModDisplay,
  158. MAKEINTRESOURCE(ORD_OEMSAVEBITS));
  159. //
  160. // KERNEL16 AND KERNEL32 STUFF
  161. //
  162. //
  163. // Get KRNL16's instance/module handle
  164. //
  165. g_hInstKrnl16 = LoadLibrary("KRNL386.EXE");
  166. ASSERT(g_hInstKrnl16);
  167. FreeLibrary(g_hInstKrnl16);
  168. g_hModKrnl16 = GetExePtr(g_hInstKrnl16);
  169. ASSERT(g_hModKrnl16);
  170. //
  171. // Get KERNEL32's instance/module handle
  172. //
  173. g_hInstKrnl32 = GetModuleHandle32("KERNEL32.DLL");
  174. ASSERT(g_hInstKrnl32);
  175. //
  176. // Get mapped 16-bit equivalent of KERNEL32's instance handle
  177. //
  178. g_hInstKrnl32MappedTo16 = MapInstance32(g_hInstKrnl32);
  179. ASSERT(g_hInstKrnl32MappedTo16);
  180. //
  181. // Get hold of MultiByteToWideChar() routine
  182. //
  183. g_lpfnAnsiToUni = (ANSITOUNIPROC)GetProcAddress32(g_hInstKrnl32,
  184. "MultiByteToWideChar");
  185. ASSERT(g_lpfnAnsiToUni);
  186. //
  187. // GDI16 AND GDI32 STUFF
  188. //
  189. //
  190. // Get GDI16's instance/module handle
  191. //
  192. g_hInstGdi16 = LoadLibrary("GDI.EXE");
  193. ASSERT(g_hInstGdi16);
  194. FreeLibrary(g_hInstGdi16);
  195. g_hModGdi16 = GetExePtr(g_hInstGdi16);
  196. ASSERT(g_hModGdi16);
  197. //
  198. // Get GDI32's instance/module handle
  199. //
  200. g_hInstGdi32 = GetModuleHandle32("GDI32.DLL");
  201. ASSERT(g_hInstGdi32);
  202. //
  203. // Get hold of GDI16 functions not exported but which are the target of
  204. // public GDI32 functions via flat thunks
  205. //
  206. if (!GetGdi32OnlyExport("ExtTextOutW", 0, (FARPROC FAR*)&g_lpfnExtTextOutW) ||
  207. !GetGdi32OnlyExport("TextOutW", 0, (FARPROC FAR*)&g_lpfnTextOutW) ||
  208. !GetGdi32OnlyExport("PolylineTo", 0, (FARPROC FAR*)&g_lpfnPolylineTo) ||
  209. !GetGdi32OnlyExport("PolyPolyline", 18, (FARPROC FAR*)&g_lpfnPolyPolyline))
  210. {
  211. ERROR_OUT(("Couldn't get hold of GDI32 routines"));
  212. DC_QUIT;
  213. }
  214. ASSERT(g_lpfnExtTextOutW);
  215. ASSERT(g_lpfnTextOutW);
  216. ASSERT(g_lpfnPolylineTo);
  217. ASSERT(g_lpfnPolyPolyline);
  218. //
  219. // USER16 and USER32 STUFF
  220. //
  221. //
  222. // Get USER16's instance/module handle
  223. //
  224. g_hInstUser16 = LoadLibrary("USER.EXE");
  225. ASSERT(g_hInstUser16);
  226. FreeLibrary(g_hInstUser16);
  227. g_hModUser16 = GetExePtr(g_hInstUser16);
  228. ASSERT(g_hModUser16);
  229. //
  230. // Get hold of USER32's instance handle. It has functions we
  231. // want to call which USER16 doesn't export.
  232. //
  233. g_hInstUser32 = GetModuleHandle32("USER32.DLL");
  234. ASSERT(g_hInstUser32);
  235. //
  236. // Get hold of USER16 functions not exported but which are the target of
  237. // public USER32 functions via flat thunks
  238. //
  239. if (!GetUser32OnlyExport("GetWindowThreadProcessId", (FARPROC FAR*)&g_lpfnGetWindowThreadProcessId))
  240. {
  241. ERROR_OUT(("Couldn't get hold of USER32 routines"));
  242. DC_QUIT;
  243. }
  244. ASSERT(g_lpfnGetWindowThreadProcessId);
  245. //
  246. // This exists in Memphis but not Win95
  247. //
  248. g_lpfnCDSEx = (CDSEXPROC)GetProcAddress(g_hModUser16, "ChangeDisplaySettingsEx");
  249. //
  250. // Allocate the shared memory we use to communicate with the 32-bit
  251. // share core.
  252. //
  253. ASSERT(!g_asSharedMemory);
  254. ASSERT(!g_poaData[0]);
  255. ASSERT(!g_poaData[1]);
  256. //
  257. // Allocate our blocks GMEM_SHARE so we aren't bound by the vagaries
  258. // of process ownership. We want our DLL to control them. Note that
  259. // we do the same thing with GDI objects we create--our module owns the.
  260. //
  261. // We use GMEM_FIXED since we map these to flat addresses for mnmcpi32.dll,
  262. // and we don't want the linear address of these memory blocks to move
  263. // afterwards.
  264. //
  265. hMem = GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT | GMEM_SHARE, sizeof(SHM_SHARED_MEMORY));
  266. g_asSharedMemory = MAKELP(hMem, 0);
  267. hMem = GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT | GMEM_SHARE, sizeof(OA_SHARED_DATA));
  268. g_poaData[0] = MAKELP(hMem, 0);
  269. hMem = GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT | GMEM_SHARE, sizeof(OA_SHARED_DATA));
  270. g_poaData[1] = MAKELP(hMem, 0);
  271. if (!g_asSharedMemory ||
  272. !g_poaData[0] ||
  273. !g_poaData[1])
  274. {
  275. ERROR_OUT(("OSIInit16: couldn't allocate shared memory blocks"));
  276. DC_QUIT;
  277. }
  278. //
  279. // Get current screen attributes
  280. //
  281. g_oeStockPalette = GetStockObject(DEFAULT_PALETTE);
  282. g_osiScreenRect.left = 0;
  283. g_osiScreenRect.top = 0;
  284. g_osiScreenRect.right = GetSystemMetrics(SM_CXSCREEN);
  285. g_osiScreenRect.bottom = GetSystemMetrics(SM_CYSCREEN);
  286. g_osiScreenDC = CreateDC("DISPLAY", 0L, 0L, 0L);
  287. g_osiMemoryDC = CreateCompatibleDC(g_osiScreenDC);
  288. g_osiMemoryBMP = CreateCompatibleBitmap(g_osiScreenDC, 1, 1);
  289. if (!g_osiScreenDC || !g_osiMemoryDC || !g_osiMemoryBMP)
  290. {
  291. ERROR_OUT(("Couldn't get screen dc"));
  292. DC_QUIT;
  293. }
  294. SetObjectOwner(g_osiScreenDC, g_hInstAs16);
  295. SetObjectOwner(g_osiMemoryDC, g_hInstAs16);
  296. SetObjectOwner(g_osiMemoryBMP, g_hInstAs16);
  297. MakeObjectPrivate(g_osiMemoryBMP, TRUE);
  298. g_osiScreenBitsPlane = GetDeviceCaps(g_osiScreenDC, BITSPIXEL);
  299. g_osiScreenPlanes = GetDeviceCaps(g_osiScreenDC, PLANES);
  300. g_osiScreenBPP = (g_osiScreenBitsPlane * g_osiScreenPlanes);
  301. //
  302. // Get the color masks
  303. //
  304. g_osiScreenRedMask = 0x000000FF;
  305. g_osiScreenGreenMask = 0x0000FF00;
  306. g_osiScreenBlueMask = 0x00FF0000;
  307. //
  308. // Only displays with more than 8bpp (palettized) might have color
  309. // masks. Use our 1 pixel scratch bitmap to get them.
  310. //
  311. if (g_osiScreenBPP > 8)
  312. {
  313. DIB4 dib4T;
  314. //
  315. // Get the header
  316. //
  317. dib4T.bi.biSize = sizeof(BITMAPINFOHEADER);
  318. dib4T.bi.biBitCount = 0;
  319. GetDIBits(g_osiScreenDC, g_osiMemoryBMP, 0, 1, NULL, (LPBITMAPINFO)&dib4T.bi,
  320. DIB_RGB_COLORS);
  321. //
  322. // Get the mask
  323. //
  324. GetDIBits(g_osiScreenDC, g_osiMemoryBMP, 0, 1, NULL, (LPBITMAPINFO)&dib4T.bi,
  325. DIB_RGB_COLORS);
  326. if (dib4T.bi.biCompression == BI_BITFIELDS)
  327. {
  328. g_osiScreenRedMask = dib4T.ct[0];
  329. g_osiScreenGreenMask = dib4T.ct[1];
  330. g_osiScreenBlueMask = dib4T.ct[2];
  331. }
  332. }
  333. g_osiMemoryOld = SelectBitmap(g_osiMemoryDC, g_osiMemoryBMP);
  334. //
  335. // Initialize the bmiHeader so OEConvertColor() doesn't have to do it
  336. // over and over, when the header isn't touched by GDI.
  337. //
  338. g_osiScreenBMI.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
  339. g_osiScreenBMI.bmiHeader.biPlanes = 1;
  340. g_osiScreenBMI.bmiHeader.biBitCount = g_osiScreenBPP;
  341. g_osiScreenBMI.bmiHeader.biCompression = BI_RGB;
  342. g_osiScreenBMI.bmiHeader.biSizeImage = 0;
  343. g_osiScreenBMI.bmiHeader.biXPelsPerMeter = 1000;
  344. g_osiScreenBMI.bmiHeader.biYPelsPerMeter = 1000;
  345. g_osiScreenBMI.bmiHeader.biClrUsed = 0;
  346. g_osiScreenBMI.bmiHeader.biClrImportant = 0;
  347. g_osiScreenBMI.bmiHeader.biWidth = 1;
  348. g_osiScreenBMI.bmiHeader.biHeight = 1;
  349. //
  350. // Init the various display driver components
  351. //
  352. BA_DDInit();
  353. if (!CM_DDInit(g_osiScreenDC))
  354. {
  355. ERROR_OUT(("CM failed to init"));
  356. DC_QUIT;
  357. }
  358. if (!SSI_DDInit())
  359. {
  360. ERROR_OUT(("SSI failed to init"));
  361. DC_QUIT;
  362. }
  363. if (!OE_DDInit())
  364. {
  365. ERROR_OUT(("OE failed to init"));
  366. DC_QUIT;
  367. }
  368. if (!IM_DDInit())
  369. {
  370. ERROR_OUT(("IM failed to init"));
  371. DC_QUIT;
  372. }
  373. if (!HET_DDInit())
  374. {
  375. ERROR_OUT(("HET failed to init"));
  376. DC_QUIT;
  377. }
  378. //
  379. // If we're here, all succeeded initializing
  380. //
  381. //
  382. // Map ptrs to flat addresses so they can be used in 32-bit code. This
  383. // can't fail unless kernel is so messed up Windows is about to keel
  384. // over and die.
  385. //
  386. ASSERT(ppSharedMem);
  387. *ppSharedMem = (DWORD)MapSL(g_asSharedMemory);
  388. ASSERT(*ppSharedMem);
  389. ASSERT(ppoaSharedMem);
  390. ppoaSharedMem[0] = (DWORD)MapSL(g_poaData[0]);
  391. ASSERT(ppoaSharedMem[0]);
  392. ppoaSharedMem[1] = (DWORD)MapSL(g_poaData[1]);
  393. ASSERT(ppoaSharedMem[1]);
  394. rc = TRUE;
  395. DC_EXIT_POINT:
  396. DebugExitBOOL(OSIInit16, rc);
  397. return(rc);
  398. }
  399. // --------------------------------------------------------------------------
  400. //
  401. // OSITerm16
  402. // Cleans up binary patcher, gdi + user patching, windows hooks, etc.
  403. //
  404. // We do this on normal OSI stop, and on catastrophic failure.
  405. //
  406. // --------------------------------------------------------------------------
  407. void WINAPI OSITerm16(BOOL fUnloading)
  408. {
  409. DebugEntry(OSITerm16);
  410. if (!g_hCoreTask)
  411. {
  412. // Nothing to cleanup.
  413. DC_QUIT;
  414. }
  415. //
  416. // Is the task that actually caused us to allocate our resources? In
  417. // other words, we don't want to clean up if
  418. // App A loads mnmas16.dll, and gets it inited
  419. // App B somehow starts up, loads mnmas16.dll, but mnmas16.dll
  420. // doesn't init for sharing because cProcesses is > 1
  421. // App B shuts down
  422. // App B calls OSITerm16
  423. //
  424. // So in the 'dll is really about to go away case', we always cleanup.
  425. // But in normal term of sharing, we cleanup if the current task is the
  426. // current one.
  427. //
  428. if (fUnloading || (g_hCoreTask == GetCurrentTask()))
  429. {
  430. //
  431. // Term other pieces that depend on layout of shared memory
  432. //
  433. HET_DDTerm();
  434. IM_DDTerm();
  435. OE_DDTerm();
  436. SSI_DDTerm();
  437. CM_DDTerm();
  438. //
  439. // Free memory blocks
  440. //
  441. if (g_poaData[1])
  442. {
  443. GlobalFree((HGLOBAL)SELECTOROF(g_poaData[1]));
  444. g_poaData[1] = NULL;
  445. }
  446. if (g_poaData[0])
  447. {
  448. GlobalFree((HGLOBAL)SELECTOROF(g_poaData[0]));
  449. g_poaData[0] = NULL;
  450. }
  451. if (g_asSharedMemory)
  452. {
  453. GlobalFree((HGLOBAL)SELECTOROF(g_asSharedMemory));
  454. g_asSharedMemory = NULL;
  455. }
  456. if (g_osiMemoryOld)
  457. {
  458. SelectBitmap(g_osiMemoryDC, g_osiMemoryOld);
  459. g_osiMemoryOld = NULL;
  460. }
  461. if (g_osiMemoryBMP)
  462. {
  463. SysDeleteObject(g_osiMemoryBMP);
  464. g_osiMemoryBMP = NULL;
  465. }
  466. if (g_osiMemoryDC)
  467. {
  468. DeleteDC(g_osiMemoryDC);
  469. g_osiMemoryDC = NULL;
  470. }
  471. if (g_osiScreenDC)
  472. {
  473. DeleteDC(g_osiScreenDC);
  474. g_osiScreenDC = NULL;
  475. }
  476. g_asMainWindow = NULL;
  477. g_asHostProp = 0;
  478. g_hCoreTask = NULL;
  479. }
  480. DC_EXIT_POINT:
  481. DebugExitVOID(OSITerm16);
  482. }
  483. // --------------------------------------------------------------------------
  484. //
  485. // OSIFunctionRequest16
  486. //
  487. // Communication function with 32-bit MNMCPI32.DLL
  488. //
  489. // --------------------------------------------------------------------------
  490. BOOL WINAPI OSIFunctionRequest16(DWORD fnEscape, LPOSI_ESCAPE_HEADER lpOsiEsc,
  491. DWORD cbEscInfo)
  492. {
  493. BOOL rc = FALSE;
  494. DebugEntry(OSIFunctionRequest16);
  495. //
  496. // Check the data is long enough to store our standard escape header.
  497. // If it is not big enough this must be an escape request for another
  498. // driver.
  499. //
  500. if (cbEscInfo < sizeof(OSI_ESCAPE_HEADER))
  501. {
  502. ERROR_OUT(("Escape block not big enough"));
  503. DC_QUIT;
  504. }
  505. //
  506. // Check for our escape ID. If it is not our escape ID this must be an
  507. // escape request for another driver.
  508. //
  509. if (lpOsiEsc->identifier != OSI_ESCAPE_IDENTIFIER)
  510. {
  511. ERROR_OUT(("Bogus Escape header ID"));
  512. DC_QUIT;
  513. }
  514. else if (lpOsiEsc->version != DCS_MAKE_VERSION())
  515. {
  516. ERROR_OUT(("Mismatched display driver and NetMeeting"));
  517. DC_QUIT;
  518. }
  519. if ((fnEscape >= OSI_ESC_FIRST) && (fnEscape <= OSI_ESC_LAST))
  520. {
  521. rc = OSI_DDProcessRequest((UINT)fnEscape, lpOsiEsc, cbEscInfo);
  522. }
  523. else if ((fnEscape >= OSI_OE_ESC_FIRST) && (fnEscape <= OSI_OE_ESC_LAST))
  524. {
  525. rc = OE_DDProcessRequest((UINT)fnEscape, lpOsiEsc, cbEscInfo);
  526. }
  527. else if ((fnEscape >= OSI_HET_ESC_FIRST) && (fnEscape <= OSI_HET_ESC_LAST))
  528. {
  529. rc = HET_DDProcessRequest((UINT)fnEscape, lpOsiEsc, cbEscInfo);
  530. }
  531. else if ((fnEscape >= OSI_SBC_ESC_FIRST) && (fnEscape <= OSI_SBC_ESC_LAST))
  532. {
  533. // Do nothing
  534. }
  535. else if ((fnEscape >= OSI_SSI_ESC_FIRST) && (fnEscape <= OSI_SSI_ESC_LAST))
  536. {
  537. rc = SSI_DDProcessRequest((UINT)fnEscape, lpOsiEsc, cbEscInfo);
  538. }
  539. else if ((fnEscape >= OSI_CM_ESC_FIRST) && (fnEscape <= OSI_CM_ESC_LAST))
  540. {
  541. rc = CM_DDProcessRequest((UINT)fnEscape, lpOsiEsc, cbEscInfo);
  542. }
  543. else if ((fnEscape >= OSI_OA_ESC_FIRST) && (fnEscape <= OSI_OA_ESC_LAST))
  544. {
  545. rc = OA_DDProcessRequest((UINT)fnEscape, lpOsiEsc, cbEscInfo);
  546. }
  547. else if ((fnEscape >= OSI_BA_ESC_FIRST) && (fnEscape <= OSI_BA_ESC_LAST))
  548. {
  549. rc = BA_DDProcessRequest((UINT)fnEscape, lpOsiEsc, cbEscInfo);
  550. }
  551. else if ((fnEscape >= OSI_HET_WO_ESC_FIRST) && (fnEscape <= OSI_HET_WO_ESC_LAST))
  552. {
  553. rc = HET_DDProcessRequest((UINT)fnEscape, lpOsiEsc, cbEscInfo);
  554. }
  555. else
  556. {
  557. ERROR_OUT(("Unknown function request"));
  558. }
  559. DC_EXIT_POINT:
  560. DebugExitBOOL(OSIFunctionRequest16, rc);
  561. return(rc);
  562. }
  563. //
  564. // OSI_DDProcessRequest()
  565. // Handles OSI generic escapes
  566. //
  567. BOOL OSI_DDProcessRequest
  568. (
  569. UINT fnEscape,
  570. LPOSI_ESCAPE_HEADER pResult,
  571. DWORD cbResult
  572. )
  573. {
  574. BOOL rc;
  575. DebugEntry(OSI_DDProcessRequest);
  576. switch (fnEscape)
  577. {
  578. case OSI_ESC_SYNC_NOW:
  579. {
  580. ASSERT(cbResult == sizeof(OSI_ESCAPE_HEADER));
  581. //
  582. // Resync with the 32-bit ring 3 core. This happens when
  583. // somebody joins or leaves a share.
  584. //
  585. BA_ResetBounds();
  586. OA_DDSyncUpdatesNow();
  587. rc = TRUE;
  588. }
  589. break;
  590. default:
  591. {
  592. ERROR_OUT(("Unrecognized OSI escape"));
  593. rc = FALSE;
  594. }
  595. break;
  596. }
  597. DebugExitBOOL(OSI_DDProcessRequest, rc);
  598. return(rc);
  599. }