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.

660 lines
21 KiB

  1. /*
  2. * OLEUTL.C
  3. *
  4. * Miscellaneous utility functions for OLE 2.0 Applications:
  5. *
  6. * Function Purpose
  7. * -------------------------------------------------------------------
  8. * SetDCToDrawInHimetricRect Sets up an HIMETRIC mapping mode in a DC.
  9. * ResetOrigDC Performs the opposite of
  10. * SetDCToDrawInHimetricRect
  11. * XformWidthInPixelsToHimetric Converts an int width into HiMetric units
  12. * XformWidthInHimetricToPixels Converts an int width from HiMetric units
  13. * XformHeightInPixelsToHimetric Converts an int height into HiMetric units
  14. * XformHeightInHimetricToPixels Converts an int height from HiMetric units
  15. * XformRectInPixelsToHimetric Converts a rect into HiMetric units
  16. * XformRectInHimetricToPixels Converts a rect from HiMetric units
  17. * XformSizeInPixelsToHimetric Converts a SIZEL into HiMetric units
  18. * XformSizeInHimetricToPixels Converts a SIZEL from HiMetric units
  19. * AreRectsEqual Compares to Rect's
  20. *
  21. * ParseCmdLine Determines if -Embedding exists
  22. * OpenOrCreateRootStorage Creates a root docfile for OLE storage
  23. * CommitStorage Commits all changes in a docfile
  24. * CreateChildStorage Creates child storage in another storage
  25. * OpenChildStorage Opens child storage in another storage
  26. *
  27. *
  28. * Copyright (c)1992 Microsoft Corporation, All Right Reserved
  29. */
  30. #define STRICT 1
  31. #include "ole2ui.h"
  32. #include <stdlib.h>
  33. #include <ctype.h>
  34. //Internal function to this module. No need for UNICODE in this function
  35. static LPSTR GetWord(LPSTR lpszSrc, LPSTR lpszDst);
  36. /*
  37. * SetDCToAnisotropic
  38. *
  39. * Purpose:
  40. * Setup the correspondence between the rect in device unit (Viewport) and
  41. * the rect in logical unit (Window) so that the proper scaling of
  42. * coordinate systems will be calculated. set up both the Viewport and
  43. * the window as follows:
  44. *
  45. * 1) ------------------ ( 2
  46. * | |
  47. * | |
  48. * | |
  49. * | |
  50. * | |
  51. * 3) ------------------ ( 4
  52. *
  53. * Origin = P3
  54. * X extent = P2x - P3x
  55. * Y extent = P2y - P3y
  56. *
  57. * Parameters:
  58. * hDC HDC to affect
  59. * lprcPhysical LPRECT containing the physical (device) extents of DC
  60. * lprcLogical LPRECT containing the logical extents
  61. * lprcWindowOld LPRECT in which to preserve the window for ResetOrigDC
  62. * lprcViewportOld LPRECT in which to preserver the viewport for ResetOrigDC
  63. *
  64. * Return Value:
  65. * int The original mapping mode of the DC.
  66. */
  67. STDAPI_(int) SetDCToAnisotropic(
  68. HDC hDC,
  69. LPRECT lprcPhysical, LPRECT lprcLogical,
  70. LPRECT lprcWindowOld, LPRECT lprcViewportOld)
  71. {
  72. int nMapModeOld=SetMapMode(hDC, MM_ANISOTROPIC);
  73. SetWindowOrgEx(hDC, lprcLogical->left, lprcLogical->bottom, (LPPOINT)&lprcWindowOld->left);
  74. SetWindowExtEx(hDC, (lprcLogical->right-lprcLogical->left), (lprcLogical->top-lprcLogical->bottom), (LPSIZE)&lprcWindowOld->right);
  75. SetViewportOrgEx(hDC, lprcPhysical->left, lprcPhysical->bottom, (LPPOINT)&lprcViewportOld->left);
  76. SetViewportExtEx(hDC, (lprcPhysical->right-lprcPhysical->left), (lprcPhysical->top-lprcPhysical->bottom), (LPSIZE)&lprcViewportOld->right);
  77. return nMapModeOld;
  78. }
  79. /*
  80. * SetDCToDrawInHimetricRect
  81. *
  82. * Purpose:
  83. * Setup the correspondence between the rect in pixels (Viewport) and
  84. * the rect in HIMETRIC (Window) so that the proper scaling of
  85. * coordinate systems will be calculated. set up both the Viewport and
  86. * the window as follows:
  87. *
  88. * 1) ------------------ ( 2
  89. * | |
  90. * | |
  91. * | |
  92. * | |
  93. * | |
  94. * 3) ------------------ ( 4
  95. *
  96. * Origin = P3
  97. * X extent = P2x - P3x
  98. * Y extent = P2y - P3y
  99. *
  100. * Parameters:
  101. * hDC HDC to affect
  102. * lprcPix LPRECT containing the pixel extents of DC
  103. * lprcHiMetric LPRECT to receive the himetric extents
  104. * lprcWindowOld LPRECT in which to preserve the window for ResetOrigDC
  105. * lprcViewportOld LPRECT in which to preserver the viewport for ResetOrigDC
  106. *
  107. * Return Value:
  108. * int The original mapping mode of the DC.
  109. */
  110. STDAPI_(int) SetDCToDrawInHimetricRect(
  111. HDC hDC,
  112. LPRECT lprcPix, LPRECT lprcHiMetric,
  113. LPRECT lprcWindowOld, LPRECT lprcViewportOld)
  114. {
  115. int nMapModeOld=SetMapMode(hDC, MM_ANISOTROPIC);
  116. BOOL fSystemDC =FALSE;
  117. if (NULL==hDC)
  118. {
  119. hDC=GetDC(NULL);
  120. fSystemDC=TRUE;
  121. }
  122. XformRectInPixelsToHimetric(hDC, lprcPix, lprcHiMetric);
  123. SetWindowOrgEx(hDC, lprcHiMetric->left, lprcHiMetric->bottom, (LPPOINT)&lprcWindowOld->left);
  124. SetWindowExtEx(hDC, (lprcHiMetric->right-lprcHiMetric->left), (lprcHiMetric->top-lprcHiMetric->bottom), (LPSIZE)&lprcWindowOld->right);
  125. SetViewportOrgEx(hDC, lprcPix->left, lprcPix->bottom, (LPPOINT)&lprcViewportOld->left);
  126. SetViewportExtEx(hDC, (lprcPix->right-lprcPix->left), (lprcPix->top-lprcPix->bottom), (LPSIZE)&lprcViewportOld->right);
  127. if (fSystemDC)
  128. ReleaseDC(NULL, hDC);
  129. return nMapModeOld;
  130. }
  131. /*
  132. * ResetOrigDC
  133. *
  134. * Purpose:
  135. * Restores a DC set to draw in himetric from SetDCToDrawInHimetricRect.
  136. *
  137. * Parameters:
  138. * hDC HDC to restore
  139. * nMapModeOld int original mapping mode of hDC
  140. * lprcWindowOld LPRECT filled in SetDCToDrawInHimetricRect
  141. * lprcViewportOld LPRECT filled in SetDCToDrawInHimetricRect
  142. *
  143. * Return Value:
  144. * int Same as nMapModeOld.
  145. */
  146. STDAPI_(int) ResetOrigDC(
  147. HDC hDC, int nMapModeOld,
  148. LPRECT lprcWindowOld, LPRECT lprcViewportOld)
  149. {
  150. POINT pOld;
  151. SetMapMode(hDC, nMapModeOld);
  152. SetWindowOrgEx(hDC, lprcWindowOld->left, lprcWindowOld->top, (LPPOINT)&pOld);
  153. SetWindowExtEx(hDC, lprcWindowOld->right, lprcWindowOld->bottom, (LPSIZE)&pOld);
  154. SetViewportOrgEx(hDC, lprcViewportOld->left, lprcViewportOld->top, (LPPOINT)&pOld);
  155. SetViewportExtEx(hDC, lprcViewportOld->right, lprcViewportOld->bottom, (LPSIZE)&pOld);
  156. return nMapModeOld;
  157. }
  158. /*
  159. * XformWidthInPixelsToHimetric
  160. * XformWidthInHimetricToPixels
  161. * XformHeightInPixelsToHimetric
  162. * XformHeightInHimetricToPixels
  163. *
  164. * Functions to convert an int between a device coordinate system and
  165. * logical HiMetric units.
  166. *
  167. * Parameters:
  168. * hDC HDC providing reference to the pixel mapping. If
  169. * NULL, a screen DC is used.
  170. *
  171. * Size Functions:
  172. * lpSizeSrc LPSIZEL providing the structure to convert. This
  173. * contains pixels in XformSizeInPixelsToHimetric and
  174. * logical HiMetric units in the complement function.
  175. * lpSizeDst LPSIZEL providing the structure to receive converted
  176. * units. This contains pixels in
  177. * XformSizeInPixelsToHimetric and logical HiMetric
  178. * units in the complement function.
  179. *
  180. * Width Functions:
  181. * iWidth int containing the value to convert.
  182. *
  183. * Return Value:
  184. * Size Functions: None
  185. * Width Functions: Converted value of the input parameters.
  186. *
  187. * NOTE:
  188. * When displaying on the screen, Window apps display everything enlarged
  189. * from its actual size so that it is easier to read. For example, if an
  190. * app wants to display a 1in. horizontal line, that when printed is
  191. * actually a 1in. line on the printed page, then it will display the line
  192. * on the screen physically larger than 1in. This is described as a line
  193. * that is "logically" 1in. along the display width. Windows maintains as
  194. * part of the device-specific information about a given display device:
  195. * LOGPIXELSX -- no. of pixels per logical in along the display width
  196. * LOGPIXELSY -- no. of pixels per logical in along the display height
  197. *
  198. * The following formula converts a distance in pixels into its equivalent
  199. * logical HIMETRIC units:
  200. *
  201. * DistInHiMetric = (HIMETRIC_PER_INCH * DistInPix)
  202. * -------------------------------
  203. * PIXELS_PER_LOGICAL_IN
  204. *
  205. */
  206. STDAPI_(int) XformWidthInPixelsToHimetric(HDC hDC, int iWidthInPix)
  207. {
  208. int iXppli; //Pixels per logical inch along width
  209. int iWidthInHiMetric;
  210. BOOL fSystemDC=FALSE;
  211. if (NULL==hDC)
  212. {
  213. hDC=GetDC(NULL);
  214. fSystemDC=TRUE;
  215. }
  216. iXppli = GetDeviceCaps (hDC, LOGPIXELSX);
  217. //We got pixel units, convert them to logical HIMETRIC along the display
  218. iWidthInHiMetric = MAP_PIX_TO_LOGHIM(iWidthInPix, iXppli);
  219. if (fSystemDC)
  220. ReleaseDC(NULL, hDC);
  221. return iWidthInHiMetric;
  222. }
  223. STDAPI_(int) XformWidthInHimetricToPixels(HDC hDC, int iWidthInHiMetric)
  224. {
  225. int iXppli; //Pixels per logical inch along width
  226. int iWidthInPix;
  227. BOOL fSystemDC=FALSE;
  228. if (NULL==hDC)
  229. {
  230. hDC=GetDC(NULL);
  231. fSystemDC=TRUE;
  232. }
  233. iXppli = GetDeviceCaps (hDC, LOGPIXELSX);
  234. //We got logical HIMETRIC along the display, convert them to pixel units
  235. iWidthInPix = MAP_LOGHIM_TO_PIX(iWidthInHiMetric, iXppli);
  236. if (fSystemDC)
  237. ReleaseDC(NULL, hDC);
  238. return iWidthInPix;
  239. }
  240. STDAPI_(int) XformHeightInPixelsToHimetric(HDC hDC, int iHeightInPix)
  241. {
  242. int iYppli; //Pixels per logical inch along height
  243. int iHeightInHiMetric;
  244. BOOL fSystemDC=FALSE;
  245. if (NULL==hDC)
  246. {
  247. hDC=GetDC(NULL);
  248. fSystemDC=TRUE;
  249. }
  250. iYppli = GetDeviceCaps (hDC, LOGPIXELSY);
  251. //* We got pixel units, convert them to logical HIMETRIC along the display
  252. iHeightInHiMetric = MAP_PIX_TO_LOGHIM(iHeightInPix, iYppli);
  253. if (fSystemDC)
  254. ReleaseDC(NULL, hDC);
  255. return iHeightInHiMetric;
  256. }
  257. STDAPI_(int) XformHeightInHimetricToPixels(HDC hDC, int iHeightInHiMetric)
  258. {
  259. int iYppli; //Pixels per logical inch along height
  260. int iHeightInPix;
  261. BOOL fSystemDC=FALSE;
  262. if (NULL==hDC)
  263. {
  264. hDC=GetDC(NULL);
  265. fSystemDC=TRUE;
  266. }
  267. iYppli = GetDeviceCaps (hDC, LOGPIXELSY);
  268. //* We got logical HIMETRIC along the display, convert them to pixel units
  269. iHeightInPix = MAP_LOGHIM_TO_PIX(iHeightInHiMetric, iYppli);
  270. if (fSystemDC)
  271. ReleaseDC(NULL, hDC);
  272. return iHeightInPix;
  273. }
  274. /*
  275. * XformRectInPixelsToHimetric
  276. * XformRectInHimetricToPixels
  277. *
  278. * Purpose:
  279. * Convert a rectangle between pixels of a given hDC and HIMETRIC units
  280. * as manipulated in OLE. If the hDC is NULL, then a screen DC is used
  281. * and assumes the MM_TEXT mapping mode.
  282. *
  283. * Parameters:
  284. * hDC HDC providing reference to the pixel mapping. If
  285. * NULL, a screen DC is used.
  286. * lprcSrc LPRECT providing the rectangle to convert. This
  287. * contains pixels in XformRectInPixelsToHimetric and
  288. * logical HiMetric units in the complement function.
  289. * lprcDst LPRECT providing the rectangle to receive converted units.
  290. * This contains pixels in XformRectInPixelsToHimetric and
  291. * logical HiMetric units in the complement function.
  292. *
  293. * Return Value:
  294. * None
  295. *
  296. * NOTE:
  297. * When displaying on the screen, Window apps display everything enlarged
  298. * from its actual size so that it is easier to read. For example, if an
  299. * app wants to display a 1in. horizontal line, that when printed is
  300. * actually a 1in. line on the printed page, then it will display the line
  301. * on the screen physically larger than 1in. This is described as a line
  302. * that is "logically" 1in. along the display width. Windows maintains as
  303. * part of the device-specific information about a given display device:
  304. * LOGPIXELSX -- no. of pixels per logical in along the display width
  305. * LOGPIXELSY -- no. of pixels per logical in along the display height
  306. *
  307. * The following formula converts a distance in pixels into its equivalent
  308. * logical HIMETRIC units:
  309. *
  310. * DistInHiMetric = (HIMETRIC_PER_INCH * DistInPix)
  311. * -------------------------------
  312. * PIXELS_PER_LOGICAL_IN
  313. *
  314. * Rect in Pixels (MM_TEXT):
  315. *
  316. * 0---------- X
  317. * |
  318. * | 1) ------------------ ( 2 P1 = (rc.left, rc.top)
  319. * | | | P2 = (rc.right, rc.top)
  320. * | | | P3 = (rc.left, rc.bottom)
  321. * | | | P4 = (rc.right, rc.bottom)
  322. * | |
  323. * Y | |
  324. * 3) ------------------ ( 4
  325. *
  326. * NOTE: Origin = (P1x, P1y)
  327. * X extent = P4x - P1x
  328. * Y extent = P4y - P1y
  329. *
  330. *
  331. * Rect in Himetric (MM_HIMETRIC):
  332. *
  333. *
  334. * 1) ------------------ ( 2 P1 = (rc.left, rc.top)
  335. * Y | | P2 = (rc.right, rc.top)
  336. * | | P3 = (rc.left, rc.bottom)
  337. * | | | P4 = (rc.right, rc.bottom)
  338. * | | |
  339. * | | |
  340. * | 3) ------------------ ( 4
  341. * |
  342. * 0---------- X
  343. *
  344. * NOTE: Origin = (P3x, P3y)
  345. * X extent = P2x - P3x
  346. * Y extent = P2y - P3y
  347. *
  348. *
  349. */
  350. STDAPI_(void) XformRectInPixelsToHimetric(
  351. HDC hDC, LPRECT lprcPix, LPRECT lprcHiMetric)
  352. {
  353. int iXppli; //Pixels per logical inch along width
  354. int iYppli; //Pixels per logical inch along height
  355. int iXextInPix=(lprcPix->right-lprcPix->left);
  356. int iYextInPix=(lprcPix->bottom-lprcPix->top);
  357. BOOL fSystemDC=FALSE;
  358. if (NULL==hDC || GetDeviceCaps(hDC, LOGPIXELSX) == 0)
  359. {
  360. hDC=GetDC(NULL);
  361. fSystemDC=TRUE;
  362. }
  363. iXppli = GetDeviceCaps (hDC, LOGPIXELSX);
  364. iYppli = GetDeviceCaps (hDC, LOGPIXELSY);
  365. //We got pixel units, convert them to logical HIMETRIC along the display
  366. lprcHiMetric->right = MAP_PIX_TO_LOGHIM(iXextInPix, iXppli);
  367. lprcHiMetric->top = MAP_PIX_TO_LOGHIM(iYextInPix, iYppli);
  368. lprcHiMetric->left = 0;
  369. lprcHiMetric->bottom = 0;
  370. if (fSystemDC)
  371. ReleaseDC(NULL, hDC);
  372. return;
  373. }
  374. STDAPI_(void) XformRectInHimetricToPixels(
  375. HDC hDC, LPRECT lprcHiMetric, LPRECT lprcPix)
  376. {
  377. int iXppli; //Pixels per logical inch along width
  378. int iYppli; //Pixels per logical inch along height
  379. int iXextInHiMetric=(lprcHiMetric->right-lprcHiMetric->left);
  380. int iYextInHiMetric=(lprcHiMetric->bottom-lprcHiMetric->top);
  381. BOOL fSystemDC=FALSE;
  382. if (NULL==hDC || GetDeviceCaps(hDC, LOGPIXELSX) == 0)
  383. {
  384. hDC=GetDC(NULL);
  385. fSystemDC=TRUE;
  386. }
  387. iXppli = GetDeviceCaps (hDC, LOGPIXELSX);
  388. iYppli = GetDeviceCaps (hDC, LOGPIXELSY);
  389. //We got pixel units, convert them to logical HIMETRIC along the display
  390. lprcPix->right = MAP_LOGHIM_TO_PIX(iXextInHiMetric, iXppli);
  391. lprcPix->top = MAP_LOGHIM_TO_PIX(iYextInHiMetric, iYppli);
  392. lprcPix->left = 0;
  393. lprcPix->bottom= 0;
  394. if (fSystemDC)
  395. ReleaseDC(NULL, hDC);
  396. return;
  397. }
  398. /*
  399. * XformSizeInPixelsToHimetric
  400. * XformSizeInHimetricToPixels
  401. *
  402. * Functions to convert a SIZEL structure (Size functions) or
  403. * an int (Width functions) between a device coordinate system and
  404. * logical HiMetric units.
  405. *
  406. * Parameters:
  407. * hDC HDC providing reference to the pixel mapping. If
  408. * NULL, a screen DC is used.
  409. *
  410. * Size Functions:
  411. * lpSizeSrc LPSIZEL providing the structure to convert. This
  412. * contains pixels in XformSizeInPixelsToHimetric and
  413. * logical HiMetric units in the complement function.
  414. * lpSizeDst LPSIZEL providing the structure to receive converted
  415. * units. This contains pixels in
  416. * XformSizeInPixelsToHimetric and logical HiMetric
  417. * units in the complement function.
  418. *
  419. * Width Functions:
  420. * iWidth int containing the value to convert.
  421. *
  422. * Return Value:
  423. * Size Functions: None
  424. * Width Functions: Converted value of the input parameters.
  425. *
  426. * NOTE:
  427. * When displaying on the screen, Window apps display everything enlarged
  428. * from its actual size so that it is easier to read. For example, if an
  429. * app wants to display a 1in. horizontal line, that when printed is
  430. * actually a 1in. line on the printed page, then it will display the line
  431. * on the screen physically larger than 1in. This is described as a line
  432. * that is "logically" 1in. along the display width. Windows maintains as
  433. * part of the device-specific information about a given display device:
  434. * LOGPIXELSX -- no. of pixels per logical in along the display width
  435. * LOGPIXELSY -- no. of pixels per logical in along the display height
  436. *
  437. * The following formula converts a distance in pixels into its equivalent
  438. * logical HIMETRIC units:
  439. *
  440. * DistInHiMetric = (HIMETRIC_PER_INCH * DistInPix)
  441. * -------------------------------
  442. * PIXELS_PER_LOGICAL_IN
  443. *
  444. */
  445. STDAPI_(void) XformSizeInPixelsToHimetric(
  446. HDC hDC, LPSIZEL lpSizeInPix, LPSIZEL lpSizeInHiMetric)
  447. {
  448. int iXppli; //Pixels per logical inch along width
  449. int iYppli; //Pixels per logical inch along height
  450. BOOL fSystemDC=FALSE;
  451. if (NULL==hDC || GetDeviceCaps(hDC, LOGPIXELSX) == 0)
  452. {
  453. hDC=GetDC(NULL);
  454. fSystemDC=TRUE;
  455. }
  456. iXppli = GetDeviceCaps (hDC, LOGPIXELSX);
  457. iYppli = GetDeviceCaps (hDC, LOGPIXELSY);
  458. //We got pixel units, convert them to logical HIMETRIC along the display
  459. lpSizeInHiMetric->cx = (long)MAP_PIX_TO_LOGHIM((int)lpSizeInPix->cx, iXppli);
  460. lpSizeInHiMetric->cy = (long)MAP_PIX_TO_LOGHIM((int)lpSizeInPix->cy, iYppli);
  461. if (fSystemDC)
  462. ReleaseDC(NULL, hDC);
  463. return;
  464. }
  465. STDAPI_(void) XformSizeInHimetricToPixels(
  466. HDC hDC, LPSIZEL lpSizeInHiMetric, LPSIZEL lpSizeInPix)
  467. {
  468. int iXppli; //Pixels per logical inch along width
  469. int iYppli; //Pixels per logical inch along height
  470. BOOL fSystemDC=FALSE;
  471. if (NULL==hDC || GetDeviceCaps(hDC, LOGPIXELSX) == 0)
  472. {
  473. hDC=GetDC(NULL);
  474. fSystemDC=TRUE;
  475. }
  476. iXppli = GetDeviceCaps (hDC, LOGPIXELSX);
  477. iYppli = GetDeviceCaps (hDC, LOGPIXELSY);
  478. //We got logical HIMETRIC along the display, convert them to pixel units
  479. lpSizeInPix->cx = (long)MAP_LOGHIM_TO_PIX((int)lpSizeInHiMetric->cx, iXppli);
  480. lpSizeInPix->cy = (long)MAP_LOGHIM_TO_PIX((int)lpSizeInHiMetric->cy, iYppli);
  481. if (fSystemDC)
  482. ReleaseDC(NULL, hDC);
  483. return;
  484. }
  485. #if defined( OBSOLETE )
  486. // This function has been converted to a macro
  487. /* AreRectsEqual
  488. ** -------------
  489. */
  490. STDAPI_(BOOL) AreRectsEqual(LPRECT lprc1, LPRECT lprc2)
  491. {
  492. if ((lprc1->top == lprc2->top) &&
  493. (lprc1->left == lprc2->left) &&
  494. (lprc1->right == lprc2->right) &&
  495. (lprc1->bottom == lprc2->bottom))
  496. return TRUE;
  497. return FALSE;
  498. }
  499. #endif // OBSOLETE
  500. /*
  501. * ParseCmdLine
  502. *
  503. * Parses the Windows command line which was passed to WinMain.
  504. * This function determines if the -Embedding switch has been given.
  505. *
  506. */
  507. STDAPI_(void) ParseCmdLine(
  508. LPSTR lpszLine,
  509. BOOL FAR* lpfEmbedFlag,
  510. LPSTR szFileName)
  511. {
  512. int i=0;
  513. CHAR szBuf[256];
  514. if(lpfEmbedFlag)
  515. *lpfEmbedFlag = FALSE;
  516. szFileName[0]='\0'; // NULL string
  517. // skip blanks
  518. while(isspace(*lpszLine)) lpszLine++;
  519. if(!*lpszLine) // No filename or options, so start a fresh document.
  520. return;
  521. // Check for "-Embedding" or "/Embedding" and set fEmbedding.
  522. if(lpfEmbedFlag && (*lpszLine == '-' || *lpszLine == '/')) {
  523. lpszLine++;
  524. lpszLine = GetWord(lpszLine, szBuf);
  525. *lpfEmbedFlag = (BOOL) !strcmp(szBuf, EMBEDDINGFLAG);
  526. }
  527. // skip blanks
  528. while(isspace(*lpszLine)) lpszLine++;
  529. // set szFileName to argument
  530. while(lpszLine[i]) {
  531. szFileName[i]=lpszLine[i];
  532. i++;
  533. }
  534. szFileName[i]='\0';
  535. }
  536. /* GetWord
  537. * -------
  538. *
  539. * LPSTR lpszSrc - Pointer to a source string
  540. * LPSTR lpszDst - Pointer to destination buffer
  541. *
  542. * Will copy one space-terminated or null-terminated word from the source
  543. * string to the destination buffer.
  544. * returns: pointer to next character following the word.
  545. */
  546. static LPSTR GetWord(LPSTR lpszSrc, LPSTR lpszDst)
  547. {
  548. while (*lpszSrc && !isspace(*lpszSrc))
  549. *lpszDst++ = *lpszSrc++;
  550. *lpszDst = '\0';
  551. return lpszSrc;
  552. }
  553.