Source code of Windows XP (NT5)
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.

1553 lines
44 KiB

  1. //
  2. // MCIOLE - OLE handler DLL for MCI objects
  3. //
  4. //
  5. // NOTES:
  6. // The whole reason for this handler DLL is to supply the function
  7. //
  8. // OleQueryObjPos()
  9. //
  10. // this function gives information to the server application on the
  11. // location (in the client document) of the activated OLE object.
  12. // the server can use this information to play the object in place
  13. // or position the server window correctly
  14. //
  15. // IMPLEMENTION:
  16. //
  17. // in theory all this DLL (handler) has to do is save the information
  18. // passed to OleActivate(). But in reality no app correctly calls
  19. // OleActivate(). They either pass no information or the wrong
  20. // information.
  21. //
  22. // this DLL is a OLE handler, because of global data (vtblDef!) it
  23. // can only be a handler for one class at a time.
  24. //
  25. // the handler intercepts the OleDraw, OleActivate, and all the
  26. // creation/destuction OLE APIs. for each OLE object a info
  27. // structure is maintained (a OBJINFO structure) when ever the
  28. // client draws (using OleDraw...) the drawing position, and the
  29. // window drawn to is remembered.
  30. //
  31. // when the client calls OleActivate, the saved draw location is
  32. // recalled, or if the app never called OleDraw() (plays
  33. // the meta-file itself) then the rectangle passed to OleActivate()
  34. // is used. (if one is supplied)
  35. //
  36. // there are many classes of apps:
  37. //
  38. // calls OleActivate() with correct info
  39. // calls OleActivate() with incorrect info
  40. // calls OleActivate() with no info
  41. //
  42. // calls OleDraw()
  43. // does not call OleDraw()
  44. //
  45. // here is a table of known OLE Clients....
  46. //
  47. // OleDraw OleActivate()
  48. // App Y or N Y, N, X
  49. // (X = wrong info)
  50. // ------------- ---------- ------------
  51. // Write Y N
  52. // CardFile Y N
  53. // Packager Y N
  54. //
  55. // Excel N N (uses DDE)
  56. // Excel 4.0 N N (uses DDE)
  57. // PowerPnt 2.0 N N (uses DDE)
  58. //
  59. // WinWord N N
  60. // WinWorks Y X
  61. // PowerPnt 3.0 N Y
  62. // MsPublisher N X
  63. // ClTest Y N
  64. // Cirus Y X
  65. // WinProj ? ?
  66. //
  67. // AmiPro Y ?
  68. //
  69. #include <windows.h>
  70. #include "ole.h"
  71. #include "shellapi.h"
  72. #include "mciole.h"
  73. HANDLE ghInstance;
  74. OLEOBJECTVTBL vtblDll; // these are our functions.
  75. OLEOBJECTVTBL vtblDef; // these are the default functions.
  76. HBITMAP hbmStock;
  77. #ifdef DEBUG
  78. RECT rcNull = {0,0,0,0};
  79. #define PUSHRC(prc) *((prc) ? (prc) : &rcNull)
  80. #define CARETPOS() // {POINT pt; GetCaretPos(&pt); DPRINTF(("CaretPos: [%d, %d]", pt.x, pt.y));}
  81. #endif
  82. /****************************************************************************
  83. ****************************************************************************/
  84. void ReplaceFunctions(LPOLEOBJECT);
  85. BOOL CanReplace(LPOLEOBJECT);
  86. /****************************************************************************
  87. FUNCTION: LibMain(HANDLE hInstance)
  88. ****************************************************************************/
  89. BOOL NEAR PASCAL LibMain (HANDLE hInstance)
  90. {
  91. HDC hdc;
  92. HBITMAP hbm;
  93. ghInstance = hInstance;
  94. //
  95. // get the stock 1x1 mono bitmap.
  96. //
  97. hbm = CreateBitmap(1,1,1,1,NULL);
  98. hdc = CreateCompatibleDC(NULL);
  99. hbmStock = SelectObject(hdc, hbm);
  100. SelectObject(hdc, hbmStock);
  101. DeleteDC(hdc);
  102. DeleteObject(hbm);
  103. // // register clipboard formats.
  104. // cfObjectLink = RegisterClipboardFormat("ObjectLink");
  105. // cfOwnerLink = RegisterClipboardFormat("OwnerLink");
  106. // cfNative = RegisterClipboardFormat("Native");
  107. return TRUE;
  108. }
  109. /****************************************************************************
  110. FUNCTION: WEP(int)
  111. PURPOSE: Standard exit routine for the DLL
  112. ****************************************************************************/
  113. int FAR PASCAL _loadds WEP(nParameter)
  114. int nParameter;
  115. {
  116. return 1;
  117. }
  118. /****************************************************************************
  119. ****************************************************************************/
  120. BOOL NEAR PASCAL IsApp(LPSTR szApp)
  121. {
  122. char ach[80];
  123. int i;
  124. WORD wStack;
  125. _asm mov wStack,ss
  126. GetModuleFileName((HINSTANCE)wStack, ach, sizeof(ach));
  127. for (i = lstrlen(ach);
  128. i > 0 && ach[i-1] != '\\' && ach[i-1] != '/' && ach[i] != ':';
  129. i--)
  130. ;
  131. return lstrcmpi(ach + i, szApp) == 0;
  132. }
  133. /****************************************************************************
  134. ****************************************************************************/
  135. BOOL NEAR PASCAL IsDcMemory(HDC hdc)
  136. {
  137. HBITMAP hbmT;
  138. if (hbmT = SelectObject(hdc, hbmStock))
  139. SelectObject(hdc, hbmT);
  140. return hbmT != NULL;
  141. }
  142. /****************************************************************************
  143. ****************************************************************************/
  144. typedef struct _OBJINFO {
  145. struct _OBJINFO*poiNext;
  146. LPOLEOBJECT lpobj; // client side LPOLEOBJECT
  147. HWND hwnd; // client window (passed to OleActivate)
  148. RECT rcActivate; // activation rectangle (passed to OleActivate)
  149. HWND hwndDraw; // active window at time of OleDraw
  150. RECT rcDraw; // rectangle of draw
  151. } OBJINFO;
  152. #ifdef DEBUG
  153. int nObjects = 0;
  154. #endif
  155. OBJINFO *poiFirst = NULL;
  156. LPOLEOBJECT lpobjActive;
  157. BOOL RegSetGetData(OBJINFO *poi, BOOL Write);
  158. OBJINFO *FindObj(LPOLEOBJECT lpobj)
  159. {
  160. OBJINFO *poi;
  161. for (poi=poiFirst; poi; poi=poi->poiNext)
  162. if (poi->lpobj == lpobj)
  163. return poi;
  164. DPRINTF(("FindObj: Unable to find object %lx", lpobj));
  165. return NULL;
  166. }
  167. void DelObj(LPOLEOBJECT lpobj)
  168. {
  169. OBJINFO *poi;
  170. OBJINFO *poiT;
  171. for (poiT=NULL,poi=poiFirst; poi; poiT=poi,poi=poi->poiNext)
  172. {
  173. if (poi->lpobj == lpobj)
  174. {
  175. if (poiT)
  176. poiT->poiNext = poi->poiNext;
  177. else
  178. poiFirst = poi->poiNext;
  179. poi->lpobj = NULL;
  180. LocalFree((HLOCAL)poi);
  181. DPRINTF(("DelObj(%lx): %d objects", lpobj, --nObjects));
  182. return;
  183. }
  184. }
  185. DPRINTF(("DelObj(%lx): Cant find object to delete.", lpobj));
  186. }
  187. BOOL RegSetGetData(OBJINFO *poi, BOOL Write)
  188. {
  189. static char szKey[] = "PlayData";
  190. static char szFormat[] = "%ld %ld %d %d %d %d %d %d %d %d";
  191. if (Write) {
  192. LONG Rc;
  193. char Data[100];
  194. //
  195. // Store hwnd, hwnddraw, rcDraw, rcActivate
  196. //
  197. #ifdef WIN32
  198. wsprintf(Data, szFormat,
  199. (LONG)poi->hwnd,
  200. (LONG)poi->hwndDraw,
  201. poi->rcDraw.left,
  202. poi->rcDraw.right,
  203. poi->rcDraw.top,
  204. poi->rcDraw.bottom,
  205. poi->rcActivate.left,
  206. poi->rcActivate.right,
  207. poi->rcActivate.top,
  208. poi->rcActivate.bottom);
  209. #else
  210. wsprintf(Data, szFormat,
  211. (LONG)(poi->hwnd == NULL ? (LONG)0 : MAKELONG(poi->hwnd, 0xFFFF)),
  212. (LONG)(poi->hwndDraw == NULL ? (LONG)0 : MAKELONG(poi->hwndDraw, 0xFFFF)),
  213. poi->rcDraw.left,
  214. poi->rcDraw.right,
  215. poi->rcDraw.top,
  216. poi->rcDraw.bottom,
  217. poi->rcActivate.left,
  218. poi->rcActivate.right,
  219. poi->rcActivate.top,
  220. poi->rcActivate.bottom);
  221. #endif
  222. Rc = RegSetValue(HKEY_CLASSES_ROOT,
  223. szKey,
  224. REG_SZ,
  225. Data,
  226. lstrlen(Data));
  227. return Rc == ERROR_SUCCESS;
  228. } else {
  229. #ifdef WIN32
  230. LONG Rc;
  231. CHAR Data[100];
  232. DWORD hwnd, hwndDraw;
  233. LONG Length;
  234. Length = sizeof(Data);
  235. Rc = RegQueryValue(HKEY_CLASSES_ROOT, szKey,
  236. Data, &Length);
  237. RegSetValue(HKEY_CLASSES_ROOT, szKey, REG_SZ, "", 0);
  238. //
  239. // Extract our data - sscanf doesn't work yet!!!
  240. //
  241. if (Rc == ERROR_SUCCESS) {
  242. LONG OurData[10];
  243. int i;
  244. LPTSTR lpData;
  245. for (i = 0, lpData = Data; i < 10; i++) {
  246. OurData[i] = atol(lpData);
  247. while (*lpData != ' ' && *lpData != '\0') {
  248. lpData++;
  249. }
  250. if (*lpData == ' ') {
  251. lpData++;
  252. }
  253. }
  254. poi->hwnd = (HWND)OurData[0];
  255. poi->hwndDraw = (HWND)OurData[1];
  256. poi->rcDraw.left = OurData[2];
  257. poi->rcDraw.right = OurData[3];
  258. poi->rcDraw.top = OurData[4];
  259. poi->rcDraw.bottom = OurData[5];
  260. poi->rcActivate.left = OurData[6];
  261. poi->rcActivate.right = OurData[7];
  262. poi->rcActivate.top = OurData[8];
  263. poi->rcActivate.bottom = OurData[9];
  264. }
  265. return Rc == ERROR_SUCCESS && Length != 0;
  266. #else
  267. return FALSE;
  268. #endif
  269. }
  270. }
  271. //
  272. // for some reason we dont get all the OleDelete() calls that we should
  273. // so lets try to "weed out the bad apples" so we dont choke.
  274. //
  275. void CleanObjects()
  276. {
  277. OBJINFO *poi;
  278. again:
  279. for (poi=poiFirst; poi; poi=poi->poiNext)
  280. {
  281. if (IsBadReadPtr(poi->lpobj, 0))
  282. {
  283. DPRINTF(("Freeing bad object %lx", poi->lpobj));
  284. DelObj(poi->lpobj);
  285. goto again;
  286. }
  287. }
  288. }
  289. OBJINFO *NewObj(LPOLEOBJECT lpobj)
  290. {
  291. OBJINFO *poi;
  292. CleanObjects();
  293. if (poi = FindObj(lpobj))
  294. {
  295. DPRINTF(("NewObj(%lx): Trying to add object twice!", lpobj));
  296. return poi;
  297. }
  298. if (poi = (OBJINFO*)LocalAlloc(LPTR, sizeof(OBJINFO)))
  299. {
  300. poi->lpobj = lpobj;
  301. poi->hwnd = NULL;
  302. poi->hwndDraw = NULL;
  303. SetRectEmpty(&poi->rcDraw);
  304. SetRectEmpty(&poi->rcActivate);
  305. poi->poiNext = poiFirst;
  306. poiFirst = poi;
  307. DPRINTF(("NewObj(%lx): %d objects", lpobj, ++nObjects));
  308. }
  309. else
  310. {
  311. DPRINTF(("NewObj(%lx): Out of room in the object table", lpobj));
  312. }
  313. return poi;
  314. }
  315. /****************************************************************************
  316. ****************************************************************************/
  317. HWND LookForDC(HWND hwndP, HDC hdc)
  318. {
  319. RECT rc;
  320. DWORD dw;
  321. HWND hwnd;
  322. if (hwndP == NULL)
  323. return NULL;
  324. dw = GetDCOrg(hdc);
  325. for (hwnd = hwndP; hwnd; hwnd = GetWindow(hwnd, GW_HWNDNEXT))
  326. {
  327. GetClientRect(hwnd, &rc);
  328. ClientToScreen(hwnd, (LPPOINT)&rc);
  329. ClientToScreen(hwnd, (LPPOINT)&rc+1);
  330. if ((int)LOWORD(dw) == rc.left && (int)HIWORD(dw) == rc.top)
  331. return hwnd;
  332. if (PtInRect(&rc, MAKEPOINT(dw)) && (hwndP = GetWindow(hwnd, GW_CHILD)))
  333. if (hwndP = LookForDC(hwndP,hdc))
  334. return hwndP;
  335. }
  336. return NULL;
  337. }
  338. HWND WindowFromDC(HDC hdc)
  339. {
  340. return LookForDC(GetDesktopWindow(), hdc);
  341. }
  342. /****************************************************************************
  343. ****************************************************************************/
  344. BOOL RectSameSize(LPRECT lprc1, LPRECT lprc2)
  345. {
  346. return lprc1->right - lprc1->left == lprc2->right - lprc2->left &&
  347. lprc1->bottom - lprc1->top == lprc2->bottom - lprc2->top;
  348. }
  349. /****************************************************************************
  350. OleQueryObjPos - this function retuns the last drawn or activated
  351. position of a object
  352. ****************************************************************************/
  353. OLESTATUS FAR PASCAL _loadds OleQueryObjPos(
  354. LPOLEOBJECT lpobj, /* object to query */
  355. HWND FAR * lphwnd, /* window of the document containing the object */
  356. LPRECT lprc, /* rect (client cords) of object. */
  357. LPRECT lprcWBounds)/* rect (client cords) of bounding rect. */
  358. {
  359. OBJINFO *poi;
  360. //
  361. // we dont do this any more
  362. //
  363. if (lprcWBounds)
  364. SetRectEmpty(lprcWBounds);
  365. //
  366. // because the server side calls this API the passed lpobj is
  367. // a server side LPOLEOBJECT, we can't search our table for this
  368. // object.
  369. //
  370. // this API is only callable by the server during the DoVerb
  371. // server callback
  372. //
  373. //!!! this only works for the last active object!!!!
  374. DPRINTF(("OleQueryObjPos(%lx)", lpobj));
  375. if (lpobjActive != NULL && (poi = FindObj(lpobjActive)))
  376. {
  377. //
  378. // set lpobjActive to NULL so we will never retrive the
  379. // wrong info again.
  380. //
  381. lpobjActive = NULL;
  382. *lphwnd = poi->hwnd;
  383. // if (IsRectEmpty(&poi->rcActivate))
  384. if (!IsRectEmpty(&poi->rcDraw))
  385. {
  386. DPRINTF(("Using the OleDraw() rectange...."));
  387. //
  388. // use the draw rectangle
  389. //
  390. *lprc = poi->rcDraw;
  391. if (poi->hwndDraw)
  392. {
  393. ClientToScreen(poi->hwndDraw, (LPPOINT)lprc);
  394. ClientToScreen(poi->hwndDraw, (LPPOINT)lprc+1);
  395. }
  396. ScreenToClient(poi->hwnd, (LPPOINT)lprc);
  397. ScreenToClient(poi->hwnd, (LPPOINT)lprc+1);
  398. }
  399. else
  400. {
  401. //
  402. // use the activate rectangle
  403. //
  404. *lprc = poi->rcActivate;
  405. }
  406. if (poi->hwnd && !IsRectEmpty(lprc))
  407. return OLE_OK;
  408. else
  409. return OLE_ERROR_BLANK; // return a error, we dont know about this OBJ
  410. }
  411. else
  412. {
  413. *lphwnd = NULL;
  414. SetRectEmpty(lprc);
  415. return OLE_ERROR_BLANK; // return a error, we dont know about this OBJ
  416. }
  417. }
  418. /****************************************************************************
  419. ****************************************************************************/
  420. OLESTATUS FAR PASCAL _loadds DllLoadFromStream (lpstream, lpprotocol, lpclient, lhclientdoc, lpobjname, lplpobj, objType, aClass, cfFormat)
  421. LPOLESTREAM lpstream;
  422. LPSTR lpprotocol;
  423. LPOLECLIENT lpclient;
  424. LHCLIENTDOC lhclientdoc;
  425. LPSTR lpobjname;
  426. LPOLEOBJECT FAR * lplpobj;
  427. LONG objType;
  428. ATOM aClass;
  429. OLECLIPFORMAT cfFormat;
  430. {
  431. OLESTATUS retVal;
  432. DPRINTF(("OleLoadFromStream(%s,%s)", lpprotocol, lpobjname));
  433. retVal = DefLoadFromStream (lpstream, lpprotocol, lpclient,
  434. lhclientdoc, lpobjname, lplpobj,
  435. objType, aClass, cfFormat);
  436. if (retVal <= OLE_WAIT_FOR_RELEASE)
  437. ReplaceFunctions(*lplpobj);
  438. return retVal;
  439. }
  440. /****************************************************************************
  441. ****************************************************************************/
  442. OLESTATUS FAR PASCAL _loadds DllCreateFromClip (lpprotocol, lpclient, lhclientdoc, lpobjname, lplpobj, optRender, cfFormat, objType)
  443. LPSTR lpprotocol;
  444. LPOLECLIENT lpclient;
  445. LHCLIENTDOC lhclientdoc;
  446. LPSTR lpobjname;
  447. LPOLEOBJECT FAR * lplpobj;
  448. OLEOPT_RENDER optRender;
  449. OLECLIPFORMAT cfFormat;
  450. LONG objType;
  451. {
  452. OLESTATUS retVal;
  453. DPRINTF(("OleCreateFromClip(%s,%s)", lpprotocol, lpobjname));
  454. retVal = DefCreateFromClip (lpprotocol, lpclient,
  455. lhclientdoc, lpobjname, lplpobj,
  456. optRender, cfFormat, objType);
  457. if (retVal <= OLE_WAIT_FOR_RELEASE)
  458. ReplaceFunctions(*lplpobj);
  459. return retVal;
  460. }
  461. /****************************************************************************
  462. ****************************************************************************/
  463. OLESTATUS FAR PASCAL _loadds DllCreateLinkFromClip (lpprotocol, lpclient, lhclientdoc, lpobjname, lplpobj, optRender, cfFormat)
  464. LPSTR lpprotocol;
  465. LPOLECLIENT lpclient;
  466. LHCLIENTDOC lhclientdoc;
  467. LPSTR lpobjname;
  468. LPOLEOBJECT FAR * lplpobj;
  469. OLEOPT_RENDER optRender;
  470. OLECLIPFORMAT cfFormat;
  471. {
  472. OLESTATUS retVal;
  473. BOOL bReplace = FALSE;
  474. DPRINTF(("OleCreateLinkFromClip(%s,%s)", lpprotocol, lpobjname));
  475. retVal = DefCreateLinkFromClip (lpprotocol, lpclient,
  476. lhclientdoc, lpobjname, lplpobj,
  477. optRender, cfFormat);
  478. if (retVal <= OLE_WAIT_FOR_RELEASE)
  479. ReplaceFunctions(*lplpobj);
  480. return retVal;
  481. }
  482. /****************************************************************************
  483. ****************************************************************************/
  484. OLESTATUS FAR PASCAL _loadds DllCreateFromTemplate (lpprotocol, lpclient, lptemplate, lhclientdoc, lpobjname, lplpobj, optRender, cfFormat)
  485. LPSTR lpprotocol;
  486. LPOLECLIENT lpclient;
  487. LPSTR lptemplate;
  488. LHCLIENTDOC lhclientdoc;
  489. LPSTR lpobjname;
  490. LPOLEOBJECT FAR * lplpobj;
  491. OLEOPT_RENDER optRender;
  492. OLECLIPFORMAT cfFormat;
  493. {
  494. OLESTATUS retVal;
  495. DPRINTF(("OleCreateFromTemplate(%s,%s,%s)", lpprotocol, lptemplate, lpobjname));
  496. retVal = DefCreateFromTemplate (lpprotocol, lpclient, lptemplate,
  497. lhclientdoc, lpobjname, lplpobj,
  498. optRender, cfFormat);
  499. if (retVal <= OLE_WAIT_FOR_RELEASE)
  500. ReplaceFunctions(*lplpobj);
  501. return retVal;
  502. }
  503. /****************************************************************************
  504. ****************************************************************************/
  505. OLESTATUS FAR PASCAL _loadds DllCreate (lpprotocol, lpclient, lpclass, lhclientdoc, lpobjname, lplpobj, optRender, cfFormat)
  506. LPSTR lpprotocol;
  507. LPOLECLIENT lpclient;
  508. LPSTR lpclass;
  509. LHCLIENTDOC lhclientdoc;
  510. LPSTR lpobjname;
  511. LPOLEOBJECT FAR * lplpobj;
  512. OLEOPT_RENDER optRender;
  513. OLECLIPFORMAT cfFormat;
  514. {
  515. OLESTATUS retVal;
  516. DPRINTF(("OleCreate(%s,%s,%s)", lpprotocol, lpclass, lpobjname));
  517. retVal = DefCreate (lpprotocol, lpclient, lpclass,
  518. lhclientdoc, lpobjname, lplpobj,
  519. optRender, cfFormat);
  520. if (retVal <= OLE_WAIT_FOR_RELEASE)
  521. ReplaceFunctions(*lplpobj);
  522. return retVal;
  523. }
  524. /****************************************************************************
  525. ****************************************************************************/
  526. OLESTATUS FAR PASCAL _loadds DllCreateFromFile (lpprotocol, lpclient, lpclass, lpfile, lhclientdoc, lpobjname, lplpobj, optRender, cfFormat)
  527. LPSTR lpprotocol;
  528. LPOLECLIENT lpclient;
  529. LPSTR lpclass;
  530. LPSTR lpfile;
  531. LHCLIENTDOC lhclientdoc;
  532. LPSTR lpobjname;
  533. LPOLEOBJECT FAR * lplpobj;
  534. OLEOPT_RENDER optRender;
  535. OLECLIPFORMAT cfFormat;
  536. {
  537. OLESTATUS retVal;
  538. DPRINTF(("OleCreateFromFile(%s,%s,%s,%s)", lpprotocol, lpclass, lpfile, lpobjname));
  539. retVal = DefCreateFromFile (lpprotocol, lpclient, lpclass, lpfile,
  540. lhclientdoc, lpobjname, lplpobj,
  541. optRender, cfFormat);
  542. if (retVal <= OLE_WAIT_FOR_RELEASE)
  543. ReplaceFunctions(*lplpobj);
  544. return retVal;
  545. }
  546. /****************************************************************************
  547. ****************************************************************************/
  548. OLESTATUS FAR PASCAL _loadds DllCreateLinkFromFile (lpprotocol, lpclient, lpclass, lpfile, lpitem, lhclientdoc, lpobjname, lplpobj, optRender, cfFormat)
  549. LPSTR lpprotocol;
  550. LPOLECLIENT lpclient;
  551. LPSTR lpclass;
  552. LPSTR lpfile;
  553. LPSTR lpitem;
  554. LHCLIENTDOC lhclientdoc;
  555. LPSTR lpobjname;
  556. LPOLEOBJECT FAR * lplpobj;
  557. OLEOPT_RENDER optRender;
  558. OLECLIPFORMAT cfFormat;
  559. {
  560. OLESTATUS retVal;
  561. DPRINTF(("OleCreateLinkFromFile(%s,%s,%s,%s,%s)", lpprotocol, lpclass, lpfile, lpitem, lpobjname));
  562. retVal = DefCreateLinkFromFile (lpprotocol, lpclient,
  563. lpclass, lpfile, lpitem,
  564. lhclientdoc, lpobjname, lplpobj,
  565. optRender, cfFormat);
  566. if (retVal <= OLE_WAIT_FOR_RELEASE)
  567. ReplaceFunctions(*lplpobj);
  568. return retVal;
  569. }
  570. /****************************************************************************
  571. ****************************************************************************/
  572. void ReplaceFunctions(LPOLEOBJECT lpobj)
  573. {
  574. // OBJINFO *poi;
  575. if (!CanReplace(lpobj))
  576. return;
  577. NewObj(lpobj);
  578. //
  579. // get the default handlers
  580. //
  581. if (vtblDef.Draw == NULL) // only get the handlers once!
  582. vtblDef = *lpobj->lpvtbl; // save default handlers
  583. //
  584. // make the OLE object use our handlers
  585. //
  586. lpobj->lpvtbl = (LPOLEOBJECTVTBL)&vtblDll;
  587. //
  588. // init our VTBL, ie replace any handlers we want to override.
  589. // any handlers we dont replace we set the the default ones.
  590. //
  591. vtblDll = vtblDef;
  592. ////(FARPROC)vtblDll.QueryProtocol = (FARPROC)DllQueryProtocol;
  593. ////(FARPROC)vtblDll.Release = (FARPROC)DllRelease;
  594. ////(FARPROC)vtblDll.Show = (FARPROC)DllShow;
  595. ////(FARPROC)vtblDll.DoVerb = (FARPROC)DllDoVerb;
  596. ////(FARPROC)vtblDll.GetData = (FARPROC)DllGetData;
  597. ////(FARPROC)vtblDll.SetData = (FARPROC)DllSetData;
  598. ////(FARPROC)vtblDll.SetTargetDevice = (FARPROC)DllSetTargetDevice;
  599. ////(FARPROC)vtblDll.SetBounds = (FARPROC)DllSetBounds;
  600. ////(FARPROC)vtblDll.EnumFormats = (FARPROC)DllEnumFormats;
  601. ////(FARPROC)vtblDll.SetColorScheme = (FARPROC)DllSetColorScheme;
  602. (FARPROC)vtblDll.Delete = (FARPROC)DllDelete;
  603. ////(FARPROC)vtblDll.SetHostNames = (FARPROC)DllSetHostNames;
  604. ////(FARPROC)vtblDll.SaveToStream = (FARPROC)DllSaveToStream;
  605. (FARPROC)vtblDll.Clone = (FARPROC)DllClone;
  606. (FARPROC)vtblDll.CopyFromLink = (FARPROC)DllCopyFromLink;
  607. ////(FARPROC)vtblDll.Equal = (FARPROC)DllEqual;
  608. ////(FARPROC)vtblDll.CopyToClipboard = (FARPROC)DllCopyToClipboard;
  609. (FARPROC)vtblDll.Draw = (FARPROC)DllDraw;
  610. (FARPROC)vtblDll.Activate = (FARPROC)DllActivate;
  611. ////(FARPROC)vtblDll.Execute = (FARPROC)DllExecute;
  612. ////(FARPROC)vtblDll.Close = (FARPROC)DllClose;
  613. ////(FARPROC)vtblDll.Update = (FARPROC)DllUpdate;
  614. ////(FARPROC)vtblDll.Reconnect = (FARPROC)DllReconnect;
  615. (FARPROC)vtblDll.ObjectConvert = (FARPROC)DllObjectConvert;
  616. ////(FARPROC)vtblDll.GetLinkUpdateOptions = (FARPROC)DllGetLinkUpdateOptions;
  617. ////(FARPROC)vtblDll.SetLinkUpdateOptions = (FARPROC)DllSetLinkUpdateOptions;
  618. ////(FARPROC)vtblDll.Rename = (FARPROC)DllRename;
  619. ////(FARPROC)vtblDll.QueryName = (FARPROC)DllQueryName;
  620. ////(FARPROC)vtblDll.QueryType = (FARPROC)DllQueryType;
  621. ////(FARPROC)vtblDll.QueryBounds = (FARPROC)DllQueryBounds;
  622. ////(FARPROC)vtblDll.QuerySize = (FARPROC)DllQuerySize;
  623. ////(FARPROC)vtblDll.QueryOpen = (FARPROC)DllQueryOpen;
  624. ////(FARPROC)vtblDll.QueryOutOfDate = (FARPROC)DllQueryOutOfDate;
  625. ////(FARPROC)vtblDll.QueryReleaseStatus = (FARPROC)DllQueryReleaseStatus;
  626. ////(FARPROC)vtblDll.QueryReleaseError = (FARPROC)DllQueryReleaseError;
  627. ////(FARPROC)vtblDll.QueryReleaseMethod = (FARPROC)DllQueryReleaseMethod;
  628. ////(FARPROC)vtblDll.RequestData = (FARPROC)DllRequestData;
  629. ////(FARPROC)vtblDll.ObjectLong = (FARPROC)DllObjectLong;
  630. ////(FARPROC)vtblDll.ChangeData = (FARPROC)DllChangeData;
  631. }
  632. /****************************************************************************
  633. ****************************************************************************/
  634. BOOL CanReplace(LPOLEOBJECT lpobj)
  635. {
  636. #if 0 // did not work anyway.
  637. //
  638. // we dont work on the wierd OLE shipped with PenWindows so don't load
  639. //
  640. #pragma message("Disabling handler because we are on PenWindows...")
  641. if (GetSystemMetrics(SM_PENWINDOWS))
  642. return FALSE;
  643. #endif
  644. return TRUE;
  645. }
  646. /****************************************************************************
  647. ****************************************************************************/
  648. LPVOID GetData(LPOLEOBJECT lpobj, WORD cf)
  649. {
  650. HANDLE h;
  651. if ( (*vtblDef.GetData)(lpobj, cf, &h) != OLE_OK || h == NULL)
  652. return NULL;
  653. return GlobalLock(h);
  654. }
  655. /****************************************************************************
  656. these are the actual handlers.....
  657. ****************************************************************************/
  658. /****************************************************************************
  659. ****************************************************************************/
  660. LPVOID FAR PASCAL _loadds DllQueryProtocol (
  661. LPOLEOBJECT lpobj,
  662. LPSTR lpsz)
  663. {
  664. DPRINTF(("OleQueryProtocol(%ls)", lpsz));
  665. return vtblDef.QueryProtocol(lpobj, lpsz);
  666. }
  667. /****************************************************************************
  668. ****************************************************************************/
  669. OLESTATUS FAR PASCAL _loadds DllRelease (
  670. LPOLEOBJECT lpobj)
  671. {
  672. DPRINTF(("OleRelease()"));
  673. return vtblDef.Release(lpobj);
  674. }
  675. /****************************************************************************
  676. ****************************************************************************/
  677. OLESTATUS FAR PASCAL _loadds DllShow (
  678. LPOLEOBJECT lpobj,
  679. BOOL fShow)
  680. {
  681. DPRINTF(("OleShow(%d)", fShow));
  682. return vtblDef.Show(lpobj, fShow);
  683. }
  684. /****************************************************************************
  685. ****************************************************************************/
  686. OLESTATUS FAR PASCAL _loadds DllDoVerb (
  687. LPOLEOBJECT lpobj,
  688. WORD verb,
  689. BOOL fShow,
  690. BOOL fActivate)
  691. {
  692. DPRINTF(("OleDoVerb(%d, %d, %d)", verb, fShow, fActivate));
  693. return vtblDef.DoVerb(lpobj, verb, fShow, fActivate);
  694. }
  695. /****************************************************************************
  696. ****************************************************************************/
  697. OLESTATUS FAR PASCAL _loadds DllGetData (
  698. LPOLEOBJECT lpobj,
  699. OLECLIPFORMAT cf,
  700. LPHANDLE lph)
  701. {
  702. DPRINTF(("OleGetData(%d)", cf));
  703. return vtblDef.GetData(lpobj, cf, lph);
  704. }
  705. /****************************************************************************
  706. ****************************************************************************/
  707. OLESTATUS FAR PASCAL _loadds DllSetData (
  708. LPOLEOBJECT lpobj,
  709. OLECLIPFORMAT cf,
  710. HANDLE h)
  711. {
  712. DPRINTF(("OleSetData(%d, %d)", cf, h));
  713. return vtblDef.SetData(lpobj, cf, h);
  714. }
  715. /****************************************************************************
  716. ****************************************************************************/
  717. OLESTATUS FAR PASCAL _loadds DllSetTargetDevice (
  718. LPOLEOBJECT lpobj,
  719. HANDLE h)
  720. {
  721. DPRINTF(("OleSetTargetDevice()"));
  722. return vtblDef.SetTargetDevice(lpobj, h);
  723. }
  724. /****************************************************************************
  725. ****************************************************************************/
  726. OLESTATUS FAR PASCAL _loadds DllSetBounds (
  727. LPOLEOBJECT lpobj,
  728. LPRECT lprc)
  729. {
  730. DPRINTF(("OleSetBounds([%d,%d,%d,%d])", PUSHRC(lprc)));
  731. return vtblDef.SetBounds(lpobj, lprc);
  732. }
  733. /****************************************************************************
  734. ****************************************************************************/
  735. OLECLIPFORMAT FAR PASCAL _loadds DllEnumFormats (
  736. LPOLEOBJECT lpobj,
  737. OLECLIPFORMAT cf)
  738. {
  739. DPRINTF(("OleEnumFormats(%d)", cf));
  740. return vtblDef.EnumFormats(lpobj, cf);
  741. }
  742. /****************************************************************************
  743. ****************************************************************************/
  744. OLESTATUS FAR PASCAL _loadds DllSetColorScheme (
  745. LPOLEOBJECT lpobj,
  746. LPLOGPALETTE lppal)
  747. {
  748. DPRINTF(("OleSetColorScheme()"));
  749. return vtblDef.SetColorScheme(lpobj, lppal);
  750. }
  751. /****************************************************************************
  752. ****************************************************************************/
  753. OLESTATUS FAR PASCAL _loadds DllDelete (
  754. LPOLEOBJECT lpobj)
  755. {
  756. DPRINTF(("OleDelete(%lx)", lpobj));
  757. DelObj(lpobj);
  758. CleanObjects();
  759. return vtblDef.Delete(lpobj);
  760. }
  761. /****************************************************************************
  762. ****************************************************************************/
  763. OLESTATUS FAR PASCAL _loadds DllSetHostNames (
  764. LPOLEOBJECT lpobj,
  765. LPSTR szClientName,
  766. LPSTR szDocName)
  767. {
  768. DPRINTF(("OleSetHostNames(%ls,%ls)", szClientName, szDocName));
  769. return vtblDef.SetHostNames(lpobj, szClientName, szDocName);
  770. }
  771. /****************************************************************************
  772. ****************************************************************************/
  773. OLESTATUS FAR PASCAL _loadds DllSaveToStream (
  774. LPOLEOBJECT lpobj,
  775. LPOLESTREAM lpstream)
  776. {
  777. DPRINTF(("OleSaveToStream()"));
  778. return vtblDef.SaveToStream(lpobj, lpstream);
  779. }
  780. /****************************************************************************
  781. ****************************************************************************/
  782. OLESTATUS FAR PASCAL _loadds DllClone (
  783. LPOLEOBJECT lpobj,
  784. LPOLECLIENT lpClient,
  785. LHCLIENTDOC lhClientDoc,
  786. LPSTR szObjName,
  787. LPOLEOBJECT FAR*lplpobj)
  788. {
  789. OLESTATUS err;
  790. DPRINTF(("OleClone(%ls)", szObjName));
  791. err = vtblDef.Clone(lpobj, lpClient, lhClientDoc, szObjName, lplpobj);
  792. //
  793. // if the object cloned correctly then clone our object information
  794. //
  795. if (err <= OLE_WAIT_FOR_RELEASE)
  796. {
  797. OBJINFO *poi, *poiT;
  798. if ((poiT = FindObj(lpobj)) && (poi = NewObj(NULL)))
  799. {
  800. poi->lpobj = *lplpobj;
  801. poi->hwnd = poiT->hwnd;
  802. poi->rcActivate = poiT->rcActivate;
  803. poi->hwndDraw = poiT->hwndDraw;
  804. poi->rcDraw = poiT->rcDraw;
  805. }
  806. }
  807. return err;
  808. }
  809. /****************************************************************************
  810. ****************************************************************************/
  811. OLESTATUS FAR PASCAL _loadds DllCopyFromLink (
  812. LPOLEOBJECT lpobj,
  813. LPOLECLIENT lpClient,
  814. LHCLIENTDOC lhClientDoc,
  815. LPSTR szObjName,
  816. LPOLEOBJECT FAR*lplpobj)
  817. {
  818. OLESTATUS err;
  819. DPRINTF(("OleCopyFromLink(%ls)", szObjName));
  820. err = vtblDef.CopyFromLink(lpobj, lpClient, lhClientDoc, szObjName, lplpobj);
  821. if (err <= OLE_WAIT_FOR_RELEASE)
  822. NewObj(*lplpobj);
  823. return err;
  824. }
  825. /****************************************************************************
  826. ****************************************************************************/
  827. OLESTATUS FAR PASCAL _loadds DllEqual (
  828. LPOLEOBJECT lpobj1,
  829. LPOLEOBJECT lpobj2)
  830. {
  831. DPRINTF(("OleEqual()"));
  832. return vtblDef.Equal(lpobj1, lpobj2);
  833. }
  834. /****************************************************************************
  835. ****************************************************************************/
  836. OLESTATUS FAR PASCAL _loadds DllCopyToClipboard (
  837. LPOLEOBJECT lpobj)
  838. {
  839. DPRINTF(("OleCopyToClipboard()"));
  840. return vtblDef.CopyToClipboard(lpobj);
  841. }
  842. /****************************************************************************
  843. ****************************************************************************/
  844. OLESTATUS FAR PASCAL _loadds DllDraw (
  845. LPOLEOBJECT lpobj,
  846. HDC hdc,
  847. LPRECT lprcBounds,
  848. LPRECT lprcWBounds,
  849. HDC hdcFormat)
  850. {
  851. OBJINFO *poi;
  852. RECT rc;
  853. DWORD dw;
  854. DPRINTF(("OleDraw(%lx,[%d,%d,%d,%d], [%d,%d,%d,%d])", lpobj, PUSHRC(lprcBounds), PUSHRC(lprcWBounds)));
  855. #ifdef DEBUG
  856. if (OleIsDcMeta(hdc))
  857. DPRINTF(("OleDraw: drawing to a meta-file"));
  858. else if (IsDcMemory(hdc))
  859. DPRINTF(("OleDraw: drawing to a bitmap"));
  860. #endif
  861. if ((poi = FindObj(lpobj)) && !OleIsDcMeta(hdc) && !IsDcMemory(hdc))
  862. {
  863. //!!!get the window from the HDC!!!
  864. poi->hwndDraw = WindowFromDC(hdc);
  865. DPRINTF(("OleDraw: hwndDraw = %04X", poi->hwndDraw));
  866. if (lprcBounds && !IsRectEmpty(lprcBounds))
  867. {
  868. poi->rcDraw = *lprcBounds;
  869. //
  870. // convert the bound rectange into coordinates.
  871. // relative to hwndDraw
  872. //
  873. LPtoDP(hdc, (LPPOINT)&poi->rcDraw, 2);
  874. if (poi->hwndDraw == NULL)
  875. {
  876. dw = GetDCOrg(hdc);
  877. OffsetRect(&poi->rcDraw, LOWORD(dw), HIWORD(dw));
  878. }
  879. }
  880. if (GetClipBox(hdc, &rc) == NULLREGION)
  881. return OLE_OK;
  882. }
  883. return vtblDef.Draw(lpobj, hdc, lprcBounds, lprcWBounds, hdcFormat);
  884. }
  885. /****************************************************************************
  886. scan WinWords stack and "extract" the info it should have passed to
  887. OleActivate() this has been tested with WinWord 2.0 and 2.0a.
  888. we expect future verisons of WinWord to pass the correct info to
  889. OleActivate() so we will never get here.
  890. ****************************************************************************/
  891. BOOL NEAR PASCAL GetOpusRect(LPRECT lprcBound)
  892. {
  893. LPRECT lprc;
  894. LPVOID lp;
  895. // int i,dx,dy;
  896. //
  897. // see if the current app is WinWord
  898. //
  899. if (!IsApp("WINWORD.EXE"))
  900. return FALSE;
  901. //
  902. // lets scan the stack looking for a RECT, this is a total
  903. // hack to get MSWORD to work.
  904. //
  905. _asm
  906. {
  907. mov bx,ss:[bp] ; get saved BP DllActivate()
  908. and bx, not 1
  909. mov bx,ss:[bx] ; get saved saved BP OleActivate()
  910. and bx, not 1
  911. mov bx,ss:[bx] ; get saved saved saved BP "winword"
  912. and bx, not 1
  913. mov word ptr lp[0], bx
  914. mov word ptr lp[2], ss
  915. }
  916. #ifdef DEBUG
  917. DPRINTF(("****** SCANING WINWORDs STACK ********"));
  918. lprc = lp;
  919. for (i=0; i<1000; i++)
  920. {
  921. dx = lprc->right - lprc->left;
  922. dy = lprc->bottom - lprc->top;
  923. if (dx >= 158 && dx <= 162 &&
  924. dy >= 118 && dy <= 122)
  925. {
  926. DPRINTF(("found a RECT at offset %d, [%d, %d, %d, %d]",
  927. (LPBYTE)lprc - (LPBYTE)lp, PUSHRC(lprc)));
  928. }
  929. ((LPBYTE)lprc)++;
  930. }
  931. DPRINTF(("**************************************"));
  932. #endif
  933. lprc = (LPRECT)((LPBYTE)lp + 6);
  934. if (lprc->right - lprc->left > 0 && lprc->bottom - lprc->top > 0)
  935. {
  936. DPRINTF(("*** HACK FOR WINWORD, [%d, %d, %d, %d]", PUSHRC(lprc)));
  937. *lprcBound = *lprc;
  938. return TRUE;
  939. }
  940. return FALSE;
  941. }
  942. /****************************************************************************
  943. ****************************************************************************/
  944. OLESTATUS FAR PASCAL _loadds DllActivate (
  945. LPOLEOBJECT lpobj,
  946. WORD verb,
  947. BOOL fShow,
  948. BOOL fActivate,
  949. HWND hwnd,
  950. LPRECT lprcBound)
  951. {
  952. OBJINFO *poi;
  953. RECT rc;
  954. DPRINTF(("OleActivate(%lx, %d, %d, %d, %04X, [%d,%d,%d,%d])", lpobj, verb, fShow, fActivate, hwnd, PUSHRC(lprcBound)));
  955. //
  956. // hack for Write
  957. //
  958. if (IsWindow(fActivate))
  959. {
  960. DPRINTF(("OleActivate: Write pre-realase work around"));
  961. hwnd = fActivate;
  962. fActivate = TRUE;
  963. }
  964. if (poi = FindObj(lpobj))
  965. {
  966. lpobjActive = lpobj;
  967. poi->hwnd = hwnd;
  968. if (poi->hwnd == NULL)
  969. {
  970. if (GetFocus())
  971. {
  972. DPRINTF(("OleActivate: no window specifed, using the focus window"));
  973. poi->hwnd = GetFocus();
  974. }
  975. else
  976. {
  977. DPRINTF(("OleActivate: no window specifed, using the active window"));
  978. poi->hwnd = GetActiveWindow();
  979. }
  980. }
  981. if (lprcBound && !IsRectEmpty(lprcBound))
  982. {
  983. poi->rcActivate = *lprcBound;
  984. }
  985. else
  986. {
  987. GetOpusRect(&poi->rcActivate);
  988. }
  989. //
  990. // MS-Publisher gives use the *wrong* rectangle in the OleActivate call
  991. // and never calls OleDraw() we are hosed!
  992. //
  993. // so we check if the rect is off in space, and dont use it if so.
  994. //
  995. if (poi->hwnd)
  996. {
  997. GetClientRect(poi->hwnd, &rc);
  998. IntersectRect(&rc,&rc,&poi->rcActivate);
  999. if (IsRectEmpty(&rc))
  1000. {
  1001. DPRINTF(("OleActivate: rectangle specifed is not valid"));
  1002. SetRectEmpty(&poi->rcActivate);
  1003. }
  1004. }
  1005. if (IsRectEmpty(&poi->rcActivate))
  1006. {
  1007. DPRINTF(("OleActivate: stupid ole app!!!"));
  1008. }
  1009. //
  1010. // Shove it in the registry
  1011. //
  1012. {
  1013. RegSetGetData(poi, TRUE);
  1014. }
  1015. }
  1016. return vtblDef.Activate(lpobj, verb, fShow, fActivate, hwnd, lprcBound);
  1017. }
  1018. /****************************************************************************
  1019. ****************************************************************************/
  1020. OLESTATUS FAR PASCAL _loadds DllExecute (
  1021. LPOLEOBJECT lpobj,
  1022. HANDLE hCmds,
  1023. WORD reserved)
  1024. {
  1025. DPRINTF(("OleExecute(%ls)", GlobalLock(hCmds)));
  1026. return vtblDef.Execute(lpobj, hCmds, reserved);
  1027. }
  1028. /****************************************************************************
  1029. ****************************************************************************/
  1030. OLESTATUS FAR PASCAL _loadds DllClose (
  1031. LPOLEOBJECT lpobj)
  1032. {
  1033. DPRINTF(("OleClose(%lx)", lpobj));
  1034. ////DelObj(lpobj);
  1035. return vtblDef.Close(lpobj);
  1036. }
  1037. /****************************************************************************
  1038. ****************************************************************************/
  1039. OLESTATUS FAR PASCAL _loadds DllUpdate (
  1040. LPOLEOBJECT lpobj)
  1041. {
  1042. DPRINTF(("OleUpdate()"));
  1043. return vtblDef.Update(lpobj);
  1044. }
  1045. /****************************************************************************
  1046. ****************************************************************************/
  1047. OLESTATUS FAR PASCAL _loadds DllReconnect (
  1048. LPOLEOBJECT lpobj)
  1049. {
  1050. DPRINTF(("OleReconnect()"));
  1051. return vtblDef.Reconnect(lpobj);
  1052. }
  1053. /****************************************************************************
  1054. ****************************************************************************/
  1055. OLESTATUS FAR PASCAL _loadds DllObjectConvert (
  1056. LPOLEOBJECT lpobj,
  1057. LPSTR szProtocol,
  1058. LPOLECLIENT lpClient,
  1059. LHCLIENTDOC lhClientDoc,
  1060. LPSTR szObjName,
  1061. LPOLEOBJECT FAR*lplpobj)
  1062. {
  1063. OLESTATUS err;
  1064. DPRINTF(("OleObjectConvert(%ls,%ls)", szProtocol, szObjName));
  1065. err = vtblDef.ObjectConvert(lpobj, szProtocol, lpClient, lhClientDoc, szObjName, lplpobj);
  1066. if (err <= OLE_WAIT_FOR_RELEASE)
  1067. NewObj(*lplpobj);
  1068. return err;
  1069. }
  1070. /****************************************************************************
  1071. ****************************************************************************/
  1072. OLESTATUS FAR PASCAL _loadds DllGetLinkUpdateOptions (
  1073. LPOLEOBJECT lpobj,
  1074. OLEOPT_UPDATE FAR *lpoleopt)
  1075. {
  1076. DPRINTF(("OleGetLinkUpdateOptions()"));
  1077. return vtblDef.GetLinkUpdateOptions(lpobj, lpoleopt);
  1078. }
  1079. /****************************************************************************
  1080. ****************************************************************************/
  1081. OLESTATUS FAR PASCAL _loadds DllSetLinkUpdateOptions (
  1082. LPOLEOBJECT lpobj,
  1083. OLEOPT_UPDATE oleopt)
  1084. {
  1085. DPRINTF(("OleSetLinkUpdateOptions()"));
  1086. return vtblDef.SetLinkUpdateOptions(lpobj, oleopt);
  1087. }
  1088. /****************************************************************************
  1089. ****************************************************************************/
  1090. OLESTATUS FAR PASCAL _loadds DllRename (
  1091. LPOLEOBJECT lpobj,
  1092. LPSTR szName)
  1093. {
  1094. DPRINTF(("OleRename(%ls)", szName));
  1095. return vtblDef.Rename(lpobj, szName);
  1096. }
  1097. /****************************************************************************
  1098. ****************************************************************************/
  1099. OLESTATUS FAR PASCAL _loadds DllQueryName (
  1100. LPOLEOBJECT lpobj,
  1101. LPSTR szObjName,
  1102. WORD FAR * lpwSize)
  1103. {
  1104. DPRINTF(("OleQueryName(%ls)", szObjName));
  1105. return vtblDef.QueryName(lpobj, szObjName, lpwSize);
  1106. }
  1107. /****************************************************************************
  1108. ****************************************************************************/
  1109. OLESTATUS FAR PASCAL _loadds DllQueryType (
  1110. LPOLEOBJECT lpobj,
  1111. LPLONG lpType)
  1112. {
  1113. DPRINTF(("OleQueryType()"));
  1114. return vtblDef.QueryType(lpobj, lpType);
  1115. }
  1116. /****************************************************************************
  1117. ****************************************************************************/
  1118. OLESTATUS FAR PASCAL _loadds DllQueryBounds (
  1119. LPOLEOBJECT lpobj,
  1120. LPRECT lprc)
  1121. {
  1122. DPRINTF(("OleQueryBounds()"));
  1123. return vtblDef.QueryBounds(lpobj, lprc);
  1124. }
  1125. /****************************************************************************
  1126. ****************************************************************************/
  1127. OLESTATUS FAR PASCAL _loadds DllQuerySize (
  1128. LPOLEOBJECT lpobj,
  1129. DWORD FAR * lpdwSize)
  1130. {
  1131. DPRINTF(("OleQuerySize()"));
  1132. return vtblDef.QuerySize(lpobj, lpdwSize);
  1133. }
  1134. /****************************************************************************
  1135. ****************************************************************************/
  1136. OLESTATUS FAR PASCAL _loadds DllQueryOpen (
  1137. LPOLEOBJECT lpobj)
  1138. {
  1139. DPRINTF(("OleQueryOpen()"));
  1140. return vtblDef.QueryOpen(lpobj);
  1141. }
  1142. /****************************************************************************
  1143. ****************************************************************************/
  1144. OLESTATUS FAR PASCAL _loadds DllQueryOutOfDate (
  1145. LPOLEOBJECT lpobj)
  1146. {
  1147. DPRINTF(("OleQueryOutOfDate()"));
  1148. return vtblDef.QueryOutOfDate(lpobj);
  1149. }
  1150. /****************************************************************************
  1151. ****************************************************************************/
  1152. OLESTATUS FAR PASCAL _loadds DllQueryReleaseStatus (
  1153. LPOLEOBJECT lpobj)
  1154. {
  1155. DPRINTF(("OleQueryReleaseStatus()"));
  1156. return vtblDef.QueryReleaseStatus(lpobj);
  1157. }
  1158. /****************************************************************************
  1159. ****************************************************************************/
  1160. OLESTATUS FAR PASCAL _loadds DllQueryReleaseError (
  1161. LPOLEOBJECT lpobj)
  1162. {
  1163. DPRINTF(("OleQueryReleaseError()"));
  1164. return vtblDef.QueryReleaseError(lpobj);
  1165. }
  1166. /****************************************************************************
  1167. ****************************************************************************/
  1168. OLESTATUS FAR PASCAL _loadds DllRequestData (
  1169. LPOLEOBJECT lpobj,
  1170. OLECLIPFORMAT cf)
  1171. {
  1172. DPRINTF(("OleRequestData(%d)", cf));
  1173. return vtblDef.RequestData(lpobj, cf);
  1174. }
  1175. /****************************************************************************
  1176. ****************************************************************************/
  1177. OLESTATUS FAR PASCAL _loadds DllObjectLong (
  1178. LPOLEOBJECT lpobj,
  1179. WORD w,
  1180. LPLONG lpl)
  1181. {
  1182. DPRINTF(("OleObjectLong()"));
  1183. return vtblDef.ObjectLong(lpobj, w, lpl);
  1184. }
  1185. /****************************************************************************
  1186. ****************************************************************************/
  1187. OLE_RELEASE_METHOD FAR PASCAL _loadds DllQueryReleaseMethod (
  1188. LPOLEOBJECT lpobj)
  1189. {
  1190. DPRINTF(("OleQueryReleaseMethod()"));
  1191. return vtblDef.QueryReleaseMethod(lpobj);
  1192. }
  1193. /****************************************************************************
  1194. ****************************************************************************/
  1195. OLESTATUS FAR PASCAL _loadds DllChangeData (
  1196. LPOLEOBJECT lpobj,
  1197. HANDLE h,
  1198. LPOLECLIENT lpClient,
  1199. BOOL f)
  1200. {
  1201. DPRINTF(("OleChangeData()"));
  1202. return vtblDef.ChangeData(lpobj, h, lpClient, f);
  1203. }
  1204. ///////////////////////////////////////////////////////////////////////////////
  1205. //
  1206. // DEBUG STUFF
  1207. //
  1208. ///////////////////////////////////////////////////////////////////////////////
  1209. #ifdef DEBUG
  1210. void FAR cdecl dprintf(LPSTR szFormat, ...)
  1211. {
  1212. char ach[128];
  1213. extern FAR PASCAL OutputDebugStr(LPSTR);
  1214. lstrcpy(ach, "MCIOLE: ");
  1215. wvsprintf(ach + 8,szFormat,(LPSTR)(&szFormat+1));
  1216. lstrcat(ach,"\r\n");
  1217. OutputDebugString(ach);
  1218. }
  1219. #endif