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.

746 lines
18 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1994-1995 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: private.c
  6. * Content: DirectDraw Private Client Data support
  7. * History:
  8. * Date By Reason
  9. * ==== == ======
  10. * 10/08/97 jeffno Initial Implementation
  11. * 24/11/97 t-craigs Added support for palettes, flags, et al
  12. *
  13. ***************************************************************************/
  14. #include "ddrawpr.h"
  15. void FreePrivateDataNode(LPPRIVATEDATANODE pData)
  16. {
  17. /*
  18. * Check to see whether we should release the
  19. * memory our data pointer might be pointing to.
  20. */
  21. if (pData->dwFlags & DDSPD_IUNKNOWNPOINTER)
  22. {
  23. IUnknown *pUnk = (IUnknown *) pData->pData;
  24. /*
  25. * Better try-except, or Gershon will get on my back
  26. */
  27. TRY
  28. {
  29. pUnk->lpVtbl->Release(pUnk);
  30. }
  31. EXCEPT( EXCEPTION_EXECUTE_HANDLER )
  32. {
  33. DPF_ERR( "Exception encountered releasing private IUnknown pointer" );
  34. }
  35. }
  36. else
  37. {
  38. MemFree(pData->pData);
  39. }
  40. MemFree(pData);
  41. }
  42. void FreeAllPrivateData(LPPRIVATEDATANODE * ppListHead)
  43. {
  44. LPPRIVATEDATANODE pData = (*ppListHead);
  45. while(pData)
  46. {
  47. LPPRIVATEDATANODE pPrevious = pData;
  48. pData=pData->pNext;
  49. FreePrivateDataNode(pPrevious);
  50. }
  51. (*ppListHead) = NULL;
  52. }
  53. /*
  54. * Helpers called from API entry points
  55. */
  56. HRESULT InternalFreePrivateData(LPPRIVATEDATANODE * ppListHead, REFGUID rGuid)
  57. {
  58. LPPRIVATEDATANODE pData = * ppListHead;
  59. LPPRIVATEDATANODE pPrevious = NULL;
  60. while (pData)
  61. {
  62. if ( IsEqualGUID(&pData->guid, rGuid))
  63. {
  64. /*
  65. * Check to see whether we should release the
  66. * memory our data pointer might be pointing to.
  67. */
  68. if (pPrevious)
  69. pPrevious->pNext = pData->pNext;
  70. else
  71. *ppListHead = pData->pNext;
  72. FreePrivateDataNode(pData);
  73. return DD_OK;
  74. }
  75. pPrevious = pData;
  76. pData=pData->pNext;
  77. }
  78. return DDERR_NOTFOUND;
  79. }
  80. HRESULT InternalSetPrivateData(
  81. LPPRIVATEDATANODE *ppListHead,
  82. REFGUID rGuid,
  83. LPVOID pData,
  84. DWORD cbData,
  85. DWORD dwFlags,
  86. DWORD dwContentsStamp)
  87. {
  88. HRESULT hr = DD_OK;
  89. LPPRIVATEDATANODE pDataNode = NULL;
  90. BOOL bPtr;
  91. if( 0UL == cbData )
  92. {
  93. DPF_ERR( "Zero is invalid size of private data");
  94. return DDERR_INVALIDPARAMS;
  95. }
  96. if( !VALID_IID_PTR( rGuid ) )
  97. {
  98. DPF_ERR( "GUID reference is invalid" );
  99. return DDERR_INVALIDPARAMS;
  100. }
  101. if( !VALID_PTR( pData, cbData ) )
  102. {
  103. DPF_ERR( "Private data pointer is invalid" );
  104. return DDERR_INVALIDPARAMS;
  105. }
  106. if( dwFlags & ~DDSPD_VALID )
  107. {
  108. DPF_ERR( "Invalid flags" );
  109. return DDERR_INVALIDPARAMS;
  110. }
  111. bPtr = dwFlags & DDSPD_IUNKNOWNPOINTER;
  112. /*
  113. * First check if GUID already exists, squish it if so.
  114. * Don't care about return value.
  115. */
  116. InternalFreePrivateData(ppListHead, rGuid);
  117. /*
  118. * Now we can add the guid and know it's unique
  119. */
  120. pDataNode = MemAlloc(sizeof(PRIVATEDATANODE));
  121. if (!pDataNode)
  122. return DDERR_OUTOFMEMORY;
  123. /*
  124. * If we have a "special" pointer, as indicated by one of the flags,
  125. * then we copy that pointer.
  126. * Otherwise we copy a certain number of bytes from
  127. * the location pointed to.
  128. */
  129. if (bPtr)
  130. {
  131. IUnknown * pUnk;
  132. if (sizeof(IUnknown*) != cbData)
  133. {
  134. MemFree(pDataNode);
  135. DPF_ERR("cbData must be set to sizeof(IUnknown *) when DDSPD_IUNKNOWNPOINTER is used");
  136. return DDERR_INVALIDPARAMS;
  137. }
  138. pDataNode->pData = pData;
  139. /*
  140. * Now addref the pointer. We'll release it again when the data are freed
  141. */
  142. pUnk = (IUnknown*) pData;
  143. TRY
  144. {
  145. pUnk->lpVtbl->AddRef(pUnk);
  146. }
  147. EXCEPT( EXCEPTION_EXECUTE_HANDLER )
  148. {
  149. MemFree(pDataNode);
  150. DPF_ERR( "Exception encountered releasing private IUnknown pointer" );
  151. return DDERR_INVALIDPARAMS;
  152. }
  153. }
  154. else
  155. {
  156. pDataNode->pData = MemAlloc(cbData);
  157. if (!pDataNode->pData)
  158. {
  159. MemFree(pDataNode);
  160. return DDERR_OUTOFMEMORY;
  161. }
  162. memcpy(pDataNode->pData,pData,cbData);
  163. }
  164. memcpy(&pDataNode->guid,rGuid,sizeof(*rGuid));
  165. pDataNode->cbData = cbData;
  166. pDataNode->dwFlags = dwFlags;
  167. pDataNode->dwContentsStamp = dwContentsStamp;
  168. /*
  169. * Insert the node at the head of the list
  170. */
  171. pDataNode->pNext = *ppListHead;
  172. *ppListHead = pDataNode;
  173. return DD_OK;
  174. }
  175. HRESULT InternalGetPrivateData(
  176. LPPRIVATEDATANODE *ppListHead,
  177. REFGUID rGuid,
  178. LPVOID pData,
  179. LPDWORD pcbData,
  180. DWORD dwCurrentStamp)
  181. {
  182. HRESULT hr = DD_OK;
  183. LPPRIVATEDATANODE pDataNode = *ppListHead;
  184. if( !VALID_PTR( pcbData, sizeof(DWORD) ) )
  185. {
  186. DPF_ERR( "Private data count pointer is invalid" );
  187. return DDERR_INVALIDPARAMS;
  188. }
  189. if( !VALID_IID_PTR( rGuid ) )
  190. {
  191. *pcbData = 0;
  192. DPF_ERR( "GUID reference is invalid" );
  193. return DDERR_INVALIDPARAMS;
  194. }
  195. if (*pcbData)
  196. {
  197. if( !VALID_PTR( pData, *pcbData ) )
  198. {
  199. *pcbData = 0;
  200. DPF_ERR( "Private data pointer is invalid" );
  201. return DDERR_INVALIDPARAMS;
  202. }
  203. }
  204. while (pDataNode)
  205. {
  206. if ( IsEqualGUID(&pDataNode->guid, rGuid))
  207. {
  208. /*
  209. * Check if possibly volatile contents are still valid.
  210. */
  211. if (pDataNode->dwFlags & DDSPD_VOLATILE)
  212. {
  213. if ((dwCurrentStamp == 0) || (pDataNode->dwContentsStamp != dwCurrentStamp))
  214. {
  215. DPF_ERR("Private data is volatile and state has changed");
  216. *pcbData = 0;
  217. return DDERR_EXPIRED;
  218. }
  219. }
  220. if (*pcbData < pDataNode->cbData)
  221. {
  222. *pcbData = pDataNode->cbData;
  223. return DDERR_MOREDATA;
  224. }
  225. if (pDataNode->dwFlags & DDSPD_IUNKNOWNPOINTER)
  226. {
  227. memcpy(pData,&(pDataNode->pData),pDataNode->cbData);
  228. }
  229. else
  230. {
  231. memcpy(pData,pDataNode->pData,pDataNode->cbData);
  232. }
  233. *pcbData = pDataNode->cbData;
  234. return DD_OK;
  235. }
  236. pDataNode=pDataNode->pNext;
  237. }
  238. return DDERR_NOTFOUND;
  239. }
  240. /*
  241. * API entry points
  242. */
  243. /*
  244. * SetPrivateData - Surface
  245. */
  246. HRESULT DDAPI DD_Surface_SetPrivateData(
  247. LPDIRECTDRAWSURFACE lpDDSurface,
  248. REFGUID rGuid,
  249. LPVOID pData,
  250. DWORD cbData,
  251. DWORD dwFlags)
  252. {
  253. LPDDRAWI_DDRAWSURFACE_INT this_int;
  254. LPDDRAWI_DDRAWSURFACE_LCL this_lcl;
  255. HRESULT hr = DD_OK;
  256. ENTER_DDRAW();
  257. DPF(2,A,"ENTERAPI: DD_Surface_SetPrivateData");
  258. TRY
  259. {
  260. this_int = (LPDDRAWI_DDRAWSURFACE_INT) lpDDSurface;
  261. if( !VALID_DIRECTDRAWSURFACE_PTR( this_int ) )
  262. {
  263. DPF_ERR( "Invalid surface description passed" );
  264. LEAVE_DDRAW();
  265. return DDERR_INVALIDOBJECT;
  266. }
  267. this_lcl = this_int->lpLcl;
  268. DDASSERT( NULL != this_lcl );
  269. hr = InternalSetPrivateData(
  270. &this_lcl->lpSurfMore->pPrivateDataHead,
  271. rGuid,
  272. pData,
  273. cbData,
  274. dwFlags,
  275. GET_LPDDRAWSURFACE_GBL_MORE( this_lcl->lpGbl )->dwContentsStamp );
  276. LEAVE_DDRAW();
  277. return hr;
  278. }
  279. EXCEPT( EXCEPTION_EXECUTE_HANDLER )
  280. {
  281. LEAVE_DDRAW();
  282. DPF_ERR( "Exception encountered validating parameters" );
  283. return DDERR_INVALIDPARAMS;
  284. }
  285. }
  286. /*
  287. * GetPrivateData - Surface
  288. */
  289. HRESULT DDAPI DD_Surface_GetPrivateData(
  290. LPDIRECTDRAWSURFACE lpDDSurface,
  291. REFGUID rGuid,
  292. LPVOID pData,
  293. LPDWORD pcbData)
  294. {
  295. LPDDRAWI_DDRAWSURFACE_INT this_int;
  296. LPDDRAWI_DDRAWSURFACE_LCL this_lcl;
  297. HRESULT hr = DD_OK;
  298. ENTER_DDRAW();
  299. DPF(2,A,"ENTERAPI: DD_Surface_GetPrivateData");
  300. TRY
  301. {
  302. this_int = (LPDDRAWI_DDRAWSURFACE_INT) lpDDSurface;
  303. if( !VALID_DIRECTDRAWSURFACE_PTR( this_int ) )
  304. {
  305. *pcbData = 0;
  306. DPF_ERR( "Invalid surface description passed" );
  307. LEAVE_DDRAW();
  308. return DDERR_INVALIDOBJECT;
  309. }
  310. this_lcl = this_int->lpLcl;
  311. DDASSERT( NULL != this_lcl );
  312. hr = InternalGetPrivateData(
  313. &this_lcl->lpSurfMore->pPrivateDataHead,
  314. rGuid,
  315. pData,
  316. pcbData,
  317. GET_LPDDRAWSURFACE_GBL_MORE( this_lcl->lpGbl )->dwContentsStamp );
  318. LEAVE_DDRAW();
  319. return hr;
  320. }
  321. EXCEPT( EXCEPTION_EXECUTE_HANDLER )
  322. {
  323. DPF_ERR( "Exception encountered validating parameters" );
  324. LEAVE_DDRAW();
  325. return DDERR_INVALIDPARAMS;
  326. }
  327. }
  328. /*
  329. * FreePrivateData - Surface
  330. */
  331. HRESULT DDAPI DD_Surface_FreePrivateData(
  332. LPDIRECTDRAWSURFACE lpDDSurface,
  333. REFGUID rGuid)
  334. {
  335. LPDDRAWI_DDRAWSURFACE_INT this_int;
  336. LPDDRAWI_DDRAWSURFACE_LCL this_lcl;
  337. HRESULT hr = DD_OK;
  338. ENTER_DDRAW();
  339. DPF(2,A,"ENTERAPI: DD_Surface_FreePrivateData");
  340. TRY
  341. {
  342. this_int = (LPDDRAWI_DDRAWSURFACE_INT) lpDDSurface;
  343. if( !VALID_DIRECTDRAWSURFACE_PTR( this_int ) )
  344. {
  345. DPF_ERR( "Invalid surface description passed" );
  346. LEAVE_DDRAW();
  347. return DDERR_INVALIDOBJECT;
  348. }
  349. this_lcl = this_int->lpLcl;
  350. DDASSERT( NULL != this_lcl );
  351. if( !VALID_IID_PTR( rGuid ) )
  352. {
  353. DPF_ERR( "GUID reference is invalid" );
  354. LEAVE_DDRAW();
  355. return DDERR_INVALIDPARAMS;
  356. }
  357. hr = InternalFreePrivateData( &this_lcl->lpSurfMore->pPrivateDataHead, rGuid);
  358. LEAVE_DDRAW();
  359. return hr;
  360. }
  361. EXCEPT( EXCEPTION_EXECUTE_HANDLER )
  362. {
  363. DPF_ERR( "Exception encountered validating parameters" );
  364. LEAVE_DDRAW();
  365. return DDERR_INVALIDPARAMS;
  366. }
  367. }
  368. /*
  369. * SetPrivateData - Palette
  370. */
  371. HRESULT DDAPI DD_Palette_SetPrivateData(
  372. LPDIRECTDRAWPALETTE lpDDPalette,
  373. REFGUID rGuid,
  374. LPVOID pData,
  375. DWORD cbData,
  376. DWORD dwFlags)
  377. {
  378. LPDDRAWI_DDRAWPALETTE_INT this_int;
  379. LPDDRAWI_DDRAWPALETTE_LCL this_lcl;
  380. HRESULT hr = DD_OK;
  381. ENTER_DDRAW();
  382. DPF(2,A,"ENTERAPI: DD_Palette_SetPrivateData");
  383. TRY
  384. {
  385. this_int = (LPDDRAWI_DDRAWPALETTE_INT) lpDDPalette;
  386. if( !VALID_DIRECTDRAWPALETTE_PTR( this_int ) )
  387. {
  388. DPF_ERR( "Invalid palette pointer passed" );
  389. LEAVE_DDRAW();
  390. return DDERR_INVALIDOBJECT;
  391. }
  392. this_lcl = this_int->lpLcl;
  393. DDASSERT( NULL != this_lcl );
  394. hr = InternalSetPrivateData(
  395. &this_lcl->pPrivateDataHead,
  396. rGuid,
  397. pData,
  398. cbData,
  399. dwFlags,
  400. this_lcl->lpGbl->dwContentsStamp );
  401. LEAVE_DDRAW();
  402. return hr;
  403. }
  404. EXCEPT( EXCEPTION_EXECUTE_HANDLER )
  405. {
  406. LEAVE_DDRAW();
  407. DPF_ERR( "Exception encountered validating parameters" );
  408. return DDERR_INVALIDPARAMS;
  409. }
  410. }
  411. /*
  412. * GetPrivateData - Palette
  413. */
  414. HRESULT DDAPI DD_Palette_GetPrivateData(
  415. LPDIRECTDRAWPALETTE lpDDPalette,
  416. REFGUID rGuid,
  417. LPVOID pData,
  418. LPDWORD pcbData)
  419. {
  420. LPDDRAWI_DDRAWPALETTE_INT this_int;
  421. LPDDRAWI_DDRAWPALETTE_LCL this_lcl;
  422. HRESULT hr = DD_OK;
  423. ENTER_DDRAW();
  424. DPF(2,A,"ENTERAPI: DD_Palette_GetPrivateData");
  425. TRY
  426. {
  427. this_int = (LPDDRAWI_DDRAWPALETTE_INT) lpDDPalette;
  428. if( !VALID_DIRECTDRAWPALETTE_PTR( this_int ) )
  429. {
  430. *pcbData = 0;
  431. DPF_ERR( "Invalid palette pointer passed" );
  432. LEAVE_DDRAW();
  433. return DDERR_INVALIDOBJECT;
  434. }
  435. this_lcl = this_int->lpLcl;
  436. DDASSERT( NULL != this_lcl );
  437. hr = InternalGetPrivateData(
  438. &this_lcl->pPrivateDataHead,
  439. rGuid,
  440. pData,
  441. pcbData,
  442. this_lcl->lpGbl->dwContentsStamp );
  443. LEAVE_DDRAW();
  444. return hr;
  445. }
  446. EXCEPT( EXCEPTION_EXECUTE_HANDLER )
  447. {
  448. DPF_ERR( "Exception encountered validating parameters" );
  449. LEAVE_DDRAW();
  450. return DDERR_INVALIDPARAMS;
  451. }
  452. }
  453. /*
  454. * FreePrivateData - Palette
  455. */
  456. HRESULT DDAPI DD_Palette_FreePrivateData(
  457. LPDIRECTDRAWPALETTE lpDDPalette,
  458. REFGUID rGuid)
  459. {
  460. LPDDRAWI_DDRAWPALETTE_INT this_int;
  461. LPDDRAWI_DDRAWPALETTE_LCL this_lcl;
  462. HRESULT hr = DD_OK;
  463. ENTER_DDRAW();
  464. DPF(2,A,"ENTERAPI: DD_Palette_FreePrivateData");
  465. TRY
  466. {
  467. this_int = (LPDDRAWI_DDRAWPALETTE_INT) lpDDPalette;
  468. if( !VALID_DIRECTDRAWPALETTE_PTR( this_int ) )
  469. {
  470. DPF_ERR( "Invalid palette pointer passed");
  471. LEAVE_DDRAW();
  472. return DDERR_INVALIDOBJECT;
  473. }
  474. this_lcl = this_int->lpLcl;
  475. DDASSERT( NULL != this_lcl );
  476. if( !VALID_IID_PTR( rGuid ) )
  477. {
  478. DPF_ERR( "GUID reference is invalid" );
  479. LEAVE_DDRAW();
  480. return DDERR_INVALIDPARAMS;
  481. }
  482. hr = InternalFreePrivateData( & this_lcl->pPrivateDataHead, rGuid);
  483. LEAVE_DDRAW();
  484. return hr;
  485. }
  486. EXCEPT( EXCEPTION_EXECUTE_HANDLER )
  487. {
  488. DPF_ERR( "Exception encountered validating parameters" );
  489. LEAVE_DDRAW();
  490. return DDERR_INVALIDPARAMS;
  491. }
  492. }
  493. /*
  494. * GetUniquenessValue - Surface
  495. */
  496. HRESULT EXTERN_DDAPI DD_Surface_GetUniquenessValue(
  497. LPDIRECTDRAWSURFACE lpDDSurface,
  498. LPDWORD lpValue )
  499. {
  500. LPDDRAWI_DDRAWSURFACE_INT this_int;
  501. LPDDRAWI_DDRAWSURFACE_LCL this_lcl;
  502. HRESULT hr = DD_OK;
  503. ENTER_DDRAW();
  504. DPF(2,A,"ENTERAPI: DD_Surface_GetUniquenessValue");
  505. TRY
  506. {
  507. this_int = (LPDDRAWI_DDRAWSURFACE_INT) lpDDSurface;
  508. if( !VALID_DIRECTDRAWSURFACE_PTR( this_int ) )
  509. {
  510. DPF_ERR( "Invalid surface pointer passed");
  511. LEAVE_DDRAW();
  512. return DDERR_INVALIDOBJECT;
  513. }
  514. this_lcl = this_int->lpLcl;
  515. DDASSERT( NULL != this_lcl );
  516. if (!VALID_PTR(lpValue, sizeof(LPVOID)))
  517. {
  518. DPF_ERR("lpValue may not be NULL");
  519. LEAVE_DDRAW();
  520. return DDERR_INVALIDPARAMS;
  521. }
  522. (*lpValue) = GET_LPDDRAWSURFACE_GBL_MORE( this_lcl->lpGbl )->dwContentsStamp;
  523. LEAVE_DDRAW();
  524. return hr;
  525. }
  526. EXCEPT( EXCEPTION_EXECUTE_HANDLER )
  527. {
  528. DPF_ERR( "Exception encountered validating parameters" );
  529. LEAVE_DDRAW();
  530. return DDERR_INVALIDPARAMS;
  531. }
  532. }
  533. /*
  534. * GetUniquenessValue - Palette
  535. */
  536. HRESULT EXTERN_DDAPI DD_Palette_GetUniquenessValue(
  537. LPDIRECTDRAWPALETTE lpDDPalette,
  538. LPDWORD lpValue )
  539. {
  540. LPDDRAWI_DDRAWPALETTE_INT this_int;
  541. LPDDRAWI_DDRAWPALETTE_LCL this_lcl;
  542. HRESULT hr = DD_OK;
  543. ENTER_DDRAW();
  544. DPF(2,A,"ENTERAPI: DD_Palette_GetUniquenessValue");
  545. TRY
  546. {
  547. this_int = (LPDDRAWI_DDRAWPALETTE_INT) lpDDPalette;
  548. if( !VALID_DIRECTDRAWPALETTE_PTR( this_int ) )
  549. {
  550. DPF_ERR( "Invalid palette pointer passed");
  551. LEAVE_DDRAW();
  552. return DDERR_INVALIDOBJECT;
  553. }
  554. this_lcl = this_int->lpLcl;
  555. DDASSERT( NULL != this_lcl );
  556. if (!VALID_PTR(lpValue, sizeof(LPVOID)))
  557. {
  558. DPF_ERR("lpValue may not be NULL");
  559. LEAVE_DDRAW();
  560. return DDERR_INVALIDPARAMS;
  561. }
  562. (*lpValue) = this_lcl->lpGbl->dwContentsStamp;
  563. LEAVE_DDRAW();
  564. return hr;
  565. }
  566. EXCEPT( EXCEPTION_EXECUTE_HANDLER )
  567. {
  568. DPF_ERR( "Exception encountered validating parameters" );
  569. LEAVE_DDRAW();
  570. return DDERR_INVALIDPARAMS;
  571. }
  572. }
  573. /*
  574. * ChangeUniquenessValue - Surface
  575. */
  576. HRESULT EXTERN_DDAPI DD_Surface_ChangeUniquenessValue(
  577. LPDIRECTDRAWSURFACE lpDDSurface )
  578. {
  579. LPDDRAWI_DDRAWSURFACE_INT this_int;
  580. LPDDRAWI_DDRAWSURFACE_LCL this_lcl;
  581. HRESULT hr = DD_OK;
  582. ENTER_DDRAW();
  583. DPF(2,A,"ENTERAPI: DD_Surface_ChangeUniquenessValue");
  584. TRY
  585. {
  586. this_int = (LPDDRAWI_DDRAWSURFACE_INT) lpDDSurface;
  587. if( !VALID_DIRECTDRAWSURFACE_PTR( this_int ) )
  588. {
  589. DPF_ERR( "Invalid surface pointer passed");
  590. LEAVE_DDRAW();
  591. return DDERR_INVALIDOBJECT;
  592. }
  593. this_lcl = this_int->lpLcl;
  594. DDASSERT( NULL != this_lcl );
  595. BUMP_SURFACE_STAMP(this_lcl->lpGbl);
  596. LEAVE_DDRAW();
  597. return hr;
  598. }
  599. EXCEPT( EXCEPTION_EXECUTE_HANDLER )
  600. {
  601. DPF_ERR( "Exception encountered validating parameters" );
  602. LEAVE_DDRAW();
  603. return DDERR_INVALIDPARAMS;
  604. }
  605. }
  606. /*
  607. * ChangeUniquenessValue - Palette
  608. */
  609. HRESULT EXTERN_DDAPI DD_Palette_ChangeUniquenessValue(
  610. LPDIRECTDRAWPALETTE lpDDPalette )
  611. {
  612. LPDDRAWI_DDRAWPALETTE_INT this_int;
  613. LPDDRAWI_DDRAWPALETTE_LCL this_lcl;
  614. HRESULT hr = DD_OK;
  615. ENTER_DDRAW();
  616. DPF(2,A,"ENTERAPI: DD_Palette_ChangeUniquenessValue");
  617. TRY
  618. {
  619. this_int = (LPDDRAWI_DDRAWPALETTE_INT) lpDDPalette;
  620. if( !VALID_DIRECTDRAWPALETTE_PTR( this_int ) )
  621. {
  622. DPF_ERR( "Invalid palette pointer passed");
  623. LEAVE_DDRAW();
  624. return DDERR_INVALIDOBJECT;
  625. }
  626. this_lcl = this_int->lpLcl;
  627. DDASSERT( NULL != this_lcl );
  628. BUMP_PALETTE_STAMP(this_lcl->lpGbl);
  629. LEAVE_DDRAW();
  630. return hr;
  631. }
  632. EXCEPT( EXCEPTION_EXECUTE_HANDLER )
  633. {
  634. DPF_ERR( "Exception encountered validating parameters" );
  635. LEAVE_DDRAW();
  636. return DDERR_INVALIDPARAMS;
  637. }
  638. }