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.

953 lines
22 KiB

  1. /*++
  2. Copyright (c) 1991-1999, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. cpitest.c
  5. Abstract:
  6. Test module for NLS API GetCPInfo.
  7. NOTE: This code was simply hacked together quickly in order to
  8. test the different code modules of the NLS component.
  9. This is NOT meant to be a formal regression test.
  10. Revision History:
  11. 06-14-91 JulieB Created.
  12. --*/
  13. //
  14. // Include Files.
  15. //
  16. #include "nlstest.h"
  17. //
  18. // Constant Definitions.
  19. //
  20. #define CPI_UNICODE 1
  21. #define CPI_ANSI 2
  22. //
  23. // Forward Declarations.
  24. //
  25. int
  26. CPI_BadParamCheck();
  27. int
  28. CPI_NormalCase();
  29. BOOL
  30. CheckInfoStruct(
  31. LPCPINFO pInfo,
  32. UINT MaxCharSize,
  33. DWORD fExVer);
  34. BOOL
  35. CheckDBCSInfoStruct(
  36. LPCPINFO pInfo,
  37. DWORD fExVer);
  38. void
  39. PrintInfoStruct(
  40. LPCPINFO pInfo,
  41. DWORD fExVer);
  42. void
  43. CheckReturnCPInfo(
  44. int CurrentReturn,
  45. LPCPINFO pCurrentInfo,
  46. BOOL fIfDBCSInfo,
  47. UINT MaxCharSize,
  48. LPSTR pErrString,
  49. DWORD fExVer,
  50. int *pNumErrors);
  51. ////////////////////////////////////////////////////////////////////////////
  52. //
  53. // TestGetCPInfo
  54. //
  55. // Test routine for GetCPInfo API.
  56. //
  57. // 06-14-91 JulieB Created.
  58. ////////////////////////////////////////////////////////////////////////////
  59. int TestGetCPInfo()
  60. {
  61. int ErrCount = 0; // error count
  62. //
  63. // Print out what's being done.
  64. //
  65. printf("\n\nTESTING GetCPInfo...\n\n");
  66. //
  67. // Test bad parameters.
  68. //
  69. ErrCount += CPI_BadParamCheck();
  70. //
  71. // Test normal cases.
  72. //
  73. ErrCount += CPI_NormalCase();
  74. //
  75. // Print out result.
  76. //
  77. printf("\nGetCPInfo: ERRORS = %d\n", ErrCount);
  78. //
  79. // Return total number of errors found.
  80. //
  81. return (ErrCount);
  82. }
  83. ////////////////////////////////////////////////////////////////////////////
  84. //
  85. // CPI_BadParamCheck
  86. //
  87. // This routine passes in bad parameters to the API routine and checks to
  88. // be sure they are handled properly. The number of errors encountered
  89. // is returned to the caller.
  90. //
  91. // 06-14-91 JulieB Created.
  92. ////////////////////////////////////////////////////////////////////////////
  93. int CPI_BadParamCheck()
  94. {
  95. int NumErrors = 0; // error count - to be returned
  96. BOOL rc; // return code
  97. CPINFO Info; // CPINFO structure
  98. CPINFOEXW InfoEx; // CPINFOEXW structure
  99. CPINFOEXA InfoExA; // CPINFOEXA structure
  100. //
  101. // Null Pointers.
  102. //
  103. // Variation 1 - lpCPInfo = NULL
  104. rc = GetCPInfo( 1252,
  105. NULL );
  106. CheckReturnBadParam( rc,
  107. FALSE,
  108. ERROR_INVALID_PARAMETER,
  109. "lpCPInfo NULL",
  110. &NumErrors );
  111. //
  112. // Invalid Code Page.
  113. //
  114. // Variation 1 - CodePage = invalid
  115. rc = GetCPInfo( 5,
  116. &Info );
  117. CheckReturnBadParam( rc,
  118. FALSE,
  119. ERROR_INVALID_PARAMETER,
  120. "CodePage Invalid",
  121. &NumErrors );
  122. //
  123. // EX Version - Null Pointers.
  124. //
  125. // Variation 1 - lpCPInfo = NULL
  126. rc = GetCPInfoExW( 1252,
  127. 0,
  128. NULL );
  129. CheckReturnBadParam( rc,
  130. FALSE,
  131. ERROR_INVALID_PARAMETER,
  132. "Ex lpCPInfo NULL",
  133. &NumErrors );
  134. rc = GetCPInfoExA( 1252,
  135. 0,
  136. NULL );
  137. CheckReturnBadParam( rc,
  138. FALSE,
  139. ERROR_INVALID_PARAMETER,
  140. "A version Ex lpCPInfo NULL",
  141. &NumErrors );
  142. //
  143. // EX Version - Invalid Code Page.
  144. //
  145. // Variation 1 - CodePage = invalid
  146. rc = GetCPInfoExW( 5,
  147. 0,
  148. &InfoEx );
  149. CheckReturnBadParam( rc,
  150. FALSE,
  151. ERROR_INVALID_PARAMETER,
  152. "CodePage Invalid",
  153. &NumErrors );
  154. rc = GetCPInfoExA( 5,
  155. 0,
  156. &InfoExA );
  157. CheckReturnBadParam( rc,
  158. FALSE,
  159. ERROR_INVALID_PARAMETER,
  160. "A version CodePage Invalid",
  161. &NumErrors );
  162. //
  163. // EX Version - Invalid Flags.
  164. //
  165. // Variation 1 - Flags = invalid
  166. rc = GetCPInfoExW( 1252,
  167. 1,
  168. &InfoEx );
  169. CheckReturnBadParam( rc,
  170. FALSE,
  171. ERROR_INVALID_FLAGS,
  172. "Flags Invalid",
  173. &NumErrors );
  174. rc = GetCPInfoExA( 1252,
  175. 1,
  176. &InfoExA );
  177. CheckReturnBadParam( rc,
  178. FALSE,
  179. ERROR_INVALID_FLAGS,
  180. "A version Flags Invalid",
  181. &NumErrors );
  182. //
  183. // Return total number of errors found.
  184. //
  185. return (NumErrors);
  186. }
  187. ////////////////////////////////////////////////////////////////////////////
  188. //
  189. // CPI_NormalCase
  190. //
  191. // This routine tests the normal cases of the API routine.
  192. //
  193. // 06-14-91 JulieB Created.
  194. ////////////////////////////////////////////////////////////////////////////
  195. int CPI_NormalCase()
  196. {
  197. int NumErrors = 0; // error count - to be returned
  198. int rc; // return code
  199. CPINFO Info; // CPINFO structure
  200. CPINFOEXW InfoEx; // CPINFOEXW structure
  201. CPINFOEXA InfoExA; // CPINFOEXA structure
  202. #ifdef PERF
  203. DbgBreakPoint();
  204. #endif
  205. //
  206. // CodePage defaults.
  207. //
  208. // Variation 1 - CodePage = CP_ACP
  209. rc = GetCPInfo( CP_ACP,
  210. &Info );
  211. CheckReturnCPInfo( rc,
  212. &Info,
  213. FALSE,
  214. 1,
  215. "CodePage CP_ACP",
  216. 0,
  217. &NumErrors );
  218. // Variation 2 - CodePage = CP_OEMCP
  219. rc = GetCPInfo( CP_OEMCP,
  220. &Info );
  221. CheckReturnCPInfo( rc,
  222. &Info,
  223. FALSE,
  224. 1,
  225. "CodePage CP_OEMCP",
  226. 0,
  227. &NumErrors );
  228. //
  229. // CodePage 1252.
  230. //
  231. // Variation 1 - CodePage = 1252
  232. rc = GetCPInfo( 1252,
  233. &Info );
  234. CheckReturnCPInfo( rc,
  235. &Info,
  236. FALSE,
  237. 1,
  238. "CodePage 1252",
  239. 0,
  240. &NumErrors );
  241. //
  242. // CodePage 437.
  243. //
  244. // Variation 1 - CodePage = 437
  245. rc = GetCPInfo( 437,
  246. &Info );
  247. CheckReturnCPInfo( rc,
  248. &Info,
  249. FALSE,
  250. 1,
  251. "CodePage 437",
  252. 0,
  253. &NumErrors );
  254. //
  255. // CodePage 850.
  256. //
  257. // Variation 1 - CodePage = 850
  258. rc = GetCPInfo( 850,
  259. &Info );
  260. CheckReturnCPInfo( rc,
  261. &Info,
  262. FALSE,
  263. 1,
  264. "CodePage 850",
  265. 0,
  266. &NumErrors );
  267. //
  268. // CodePage 10000.
  269. //
  270. // Variation 1 - CodePage = 10000
  271. rc = GetCPInfo( 10000,
  272. &Info );
  273. CheckReturnCPInfo( rc,
  274. &Info,
  275. FALSE,
  276. 1,
  277. "CodePage 10000",
  278. 0,
  279. &NumErrors );
  280. //
  281. // CodePage 932.
  282. //
  283. // Variation 1 - CodePage = 932
  284. rc = GetCPInfo( 932,
  285. &Info );
  286. CheckReturnCPInfo( rc,
  287. &Info,
  288. TRUE,
  289. 2,
  290. "CodePage 932",
  291. 0,
  292. &NumErrors );
  293. //
  294. // CodePage UTF 7.
  295. //
  296. // Variation 1 - CodePage = UTF 7
  297. rc = GetCPInfo( CP_UTF7,
  298. &Info );
  299. CheckReturnCPInfo( rc,
  300. &Info,
  301. FALSE,
  302. 5,
  303. "CodePage UTF 7",
  304. 0,
  305. &NumErrors );
  306. //
  307. // CodePage UTF 8.
  308. //
  309. // Variation 1 - CodePage = UTF 8
  310. rc = GetCPInfo( CP_UTF8,
  311. &Info );
  312. CheckReturnCPInfo( rc,
  313. &Info,
  314. FALSE,
  315. 4,
  316. "CodePage UTF 8",
  317. 0,
  318. &NumErrors );
  319. // -------------------------------------------------------------
  320. //
  321. // Ex CodePage defaults.
  322. //
  323. // Variation 1 - CodePage = CP_ACP
  324. rc = GetCPInfoExW( CP_ACP,
  325. 0,
  326. &InfoEx );
  327. CheckReturnCPInfo( rc,
  328. (LPCPINFO)&InfoEx,
  329. FALSE,
  330. 1,
  331. "CodePage CP_ACP",
  332. CPI_UNICODE,
  333. &NumErrors );
  334. rc = GetCPInfoExA( CP_ACP,
  335. 0,
  336. &InfoExA );
  337. CheckReturnCPInfo( rc,
  338. (LPCPINFO)&InfoExA,
  339. FALSE,
  340. 1,
  341. "A version CodePage CP_ACP",
  342. CPI_ANSI,
  343. &NumErrors );
  344. // Variation 2 - CodePage = CP_OEMCP
  345. rc = GetCPInfoExW( CP_OEMCP,
  346. 0,
  347. &InfoEx );
  348. CheckReturnCPInfo( rc,
  349. (LPCPINFO)&InfoEx,
  350. FALSE,
  351. 1,
  352. "CodePage CP_OEMCP",
  353. CPI_UNICODE,
  354. &NumErrors );
  355. rc = GetCPInfoExA( CP_OEMCP,
  356. 0,
  357. &InfoExA );
  358. CheckReturnCPInfo( rc,
  359. (LPCPINFO)&InfoExA,
  360. FALSE,
  361. 1,
  362. "A version CodePage CP_OEMCP",
  363. CPI_ANSI,
  364. &NumErrors );
  365. //
  366. // CodePage 1252.
  367. //
  368. // Variation 1 - CodePage = 1252
  369. rc = GetCPInfoExW( 1252,
  370. 0,
  371. &InfoEx );
  372. CheckReturnCPInfo( rc,
  373. (LPCPINFO)&InfoEx,
  374. FALSE,
  375. 1,
  376. "CodePage 1252",
  377. CPI_UNICODE,
  378. &NumErrors );
  379. rc = GetCPInfoExA( 1252,
  380. 0,
  381. &InfoExA );
  382. CheckReturnCPInfo( rc,
  383. (LPCPINFO)&InfoExA,
  384. FALSE,
  385. 1,
  386. "A version CodePage 1252",
  387. CPI_ANSI,
  388. &NumErrors );
  389. //
  390. // CodePage 437.
  391. //
  392. // Variation 1 - CodePage = 437
  393. rc = GetCPInfoExW( 437,
  394. 0,
  395. &InfoEx );
  396. CheckReturnCPInfo( rc,
  397. (LPCPINFO)&InfoEx,
  398. FALSE,
  399. 1,
  400. "CodePage 437",
  401. CPI_UNICODE,
  402. &NumErrors );
  403. rc = GetCPInfoExA( 437,
  404. 0,
  405. &InfoExA );
  406. CheckReturnCPInfo( rc,
  407. (LPCPINFO)&InfoExA,
  408. FALSE,
  409. 1,
  410. "A version CodePage 437",
  411. CPI_ANSI,
  412. &NumErrors );
  413. //
  414. // CodePage 850.
  415. //
  416. // Variation 1 - CodePage = 850
  417. rc = GetCPInfoExW( 850,
  418. 0,
  419. &InfoEx );
  420. CheckReturnCPInfo( rc,
  421. (LPCPINFO)&InfoEx,
  422. FALSE,
  423. 1,
  424. "CodePage 850",
  425. CPI_UNICODE,
  426. &NumErrors );
  427. rc = GetCPInfoExA( 850,
  428. 0,
  429. &InfoExA );
  430. CheckReturnCPInfo( rc,
  431. (LPCPINFO)&InfoExA,
  432. FALSE,
  433. 1,
  434. "A version CodePage 850",
  435. CPI_ANSI,
  436. &NumErrors );
  437. //
  438. // CodePage 10000.
  439. //
  440. // Variation 1 - CodePage = 10000
  441. rc = GetCPInfoExW( 10000,
  442. 0,
  443. &InfoEx );
  444. CheckReturnCPInfo( rc,
  445. (LPCPINFO)&InfoEx,
  446. FALSE,
  447. 1,
  448. "CodePage 10000",
  449. CPI_UNICODE,
  450. &NumErrors );
  451. rc = GetCPInfoExA( 10000,
  452. 0,
  453. &InfoExA );
  454. CheckReturnCPInfo( rc,
  455. (LPCPINFO)&InfoExA,
  456. FALSE,
  457. 1,
  458. "A version CodePage 10000",
  459. CPI_ANSI,
  460. &NumErrors );
  461. //
  462. // CodePage 932.
  463. //
  464. // Variation 1 - CodePage = 932
  465. rc = GetCPInfoExW( 932,
  466. 0,
  467. &InfoEx );
  468. CheckReturnCPInfo( rc,
  469. (LPCPINFO)&InfoEx,
  470. TRUE,
  471. 2,
  472. "CodePage 932",
  473. CPI_UNICODE,
  474. &NumErrors );
  475. rc = GetCPInfoExA( 932,
  476. 0,
  477. &InfoExA );
  478. CheckReturnCPInfo( rc,
  479. (LPCPINFO)&InfoExA,
  480. TRUE,
  481. 2,
  482. "A version CodePage 932",
  483. CPI_ANSI,
  484. &NumErrors );
  485. //
  486. // CodePage UTF 7.
  487. //
  488. // Variation 1 - CodePage = UTF 7
  489. rc = GetCPInfoExW( CP_UTF7,
  490. 0,
  491. &InfoEx );
  492. CheckReturnCPInfo( rc,
  493. (LPCPINFO)&InfoEx,
  494. FALSE,
  495. 5,
  496. "CodePage UTF 7",
  497. CPI_UNICODE,
  498. &NumErrors );
  499. rc = GetCPInfoExA( CP_UTF7,
  500. 0,
  501. &InfoExA );
  502. CheckReturnCPInfo( rc,
  503. (LPCPINFO)&InfoExA,
  504. FALSE,
  505. 5,
  506. "A version CodePage UTF 7",
  507. CPI_ANSI,
  508. &NumErrors );
  509. //
  510. // CodePage UTF 8.
  511. //
  512. // Variation 1 - CodePage = UTF 8
  513. rc = GetCPInfoExW( CP_UTF8,
  514. 0,
  515. &InfoEx );
  516. CheckReturnCPInfo( rc,
  517. (LPCPINFO)&InfoEx,
  518. FALSE,
  519. 4,
  520. "CodePage UTF 8",
  521. CPI_UNICODE,
  522. &NumErrors );
  523. rc = GetCPInfoExA( CP_UTF8,
  524. 0,
  525. &InfoExA );
  526. CheckReturnCPInfo( rc,
  527. (LPCPINFO)&InfoExA,
  528. FALSE,
  529. 4,
  530. "A version CodePage UTF 8",
  531. CPI_ANSI,
  532. &NumErrors );
  533. //
  534. // Return total number of errors found.
  535. //
  536. return (NumErrors);
  537. }
  538. ////////////////////////////////////////////////////////////////////////////
  539. //
  540. // CheckInfoStruct
  541. //
  542. // This routine checks the CPINFO structure to be sure the values are
  543. // consistent with code page 1252.
  544. //
  545. // 06-14-91 JulieB Created.
  546. ////////////////////////////////////////////////////////////////////////////
  547. BOOL CheckInfoStruct(
  548. LPCPINFO pInfo,
  549. UINT MaxCharSize,
  550. DWORD fExVer)
  551. {
  552. int ctr; // loop counter
  553. //
  554. // Check MaxCharSize field.
  555. //
  556. if (pInfo->MaxCharSize != MaxCharSize)
  557. {
  558. printf("ERROR: MaxCharSize = %x\n", pInfo->MaxCharSize);
  559. return (FALSE);
  560. }
  561. //
  562. // Check DefaultChar field.
  563. //
  564. if (((pInfo->DefaultChar)[0] != (BYTE)0x3f) &&
  565. ((pInfo->DefaultChar)[1] != (BYTE)0))
  566. {
  567. printf("ERROR: DefaultChar = '%s'\n", pInfo->DefaultChar);
  568. return (FALSE);
  569. }
  570. //
  571. // Check LeadByte field.
  572. //
  573. for (ctr = 0; ctr < MAX_LEADBYTES; ctr++)
  574. {
  575. if (pInfo->LeadByte[ctr] != 0)
  576. {
  577. printf("ERROR: LeadByte not 0 - ctr = %x\n", ctr);
  578. return (FALSE);
  579. }
  580. }
  581. //
  582. // See if Ex version.
  583. //
  584. if (fExVer)
  585. {
  586. if (fExVer == CPI_ANSI)
  587. {
  588. LPCPINFOEXA pInfoA = (LPCPINFOEXA)pInfo;
  589. //
  590. // Check UnicodeDefaultChar field.
  591. //
  592. if (pInfoA->UnicodeDefaultChar != L'?')
  593. {
  594. printf("ERROR: UnicodeDefaultChar = '%x'\n", pInfoA->UnicodeDefaultChar);
  595. return (FALSE);
  596. }
  597. }
  598. else if (fExVer == CPI_UNICODE)
  599. {
  600. LPCPINFOEXW pInfoW = (LPCPINFOEXW)pInfo;
  601. //
  602. // Check UnicodeDefaultChar field.
  603. //
  604. if (pInfoW->UnicodeDefaultChar != L'?')
  605. {
  606. printf("ERROR: UnicodeDefaultChar = '%x'\n", pInfoW->UnicodeDefaultChar);
  607. return (FALSE);
  608. }
  609. }
  610. }
  611. //
  612. // Return success.
  613. //
  614. return (TRUE);
  615. }
  616. ////////////////////////////////////////////////////////////////////////////
  617. //
  618. // CheckDBCSInfoStruct
  619. //
  620. // This routine checks the CPINFO structure to be sure the values are
  621. // consistent with code page 932.
  622. //
  623. // 06-14-91 JulieB Created.
  624. ////////////////////////////////////////////////////////////////////////////
  625. BOOL CheckDBCSInfoStruct(
  626. LPCPINFO pInfo,
  627. DWORD fExVer)
  628. {
  629. int ctr; // loop counter
  630. //
  631. // Check MaxCharSize field.
  632. //
  633. if (pInfo->MaxCharSize != 2)
  634. {
  635. printf("ERROR: MaxCharSize = %x\n", pInfo->MaxCharSize);
  636. return (FALSE);
  637. }
  638. //
  639. // Check DefaultChar field.
  640. //
  641. if ((pInfo->DefaultChar)[0] != (BYTE)0x3f)
  642. {
  643. printf("ERROR: DefaultChar = '%s'\n", pInfo->DefaultChar);
  644. return (FALSE);
  645. }
  646. //
  647. // Check LeadByte field.
  648. //
  649. if ( ((pInfo->LeadByte)[0] != 0x81) ||
  650. ((pInfo->LeadByte)[1] != 0x9f) ||
  651. ((pInfo->LeadByte)[2] != 0xe0) ||
  652. ((pInfo->LeadByte)[3] != 0xfc) )
  653. {
  654. printf("ERROR: LeadByte not correct\n");
  655. return (FALSE);
  656. }
  657. for (ctr = 4; ctr < MAX_LEADBYTES; ctr++)
  658. {
  659. if (pInfo->LeadByte[ctr] != 0)
  660. {
  661. printf("ERROR: LeadByte not 0 - ctr = %x\n", ctr);
  662. return (FALSE);
  663. }
  664. }
  665. //
  666. // See if Ex version.
  667. //
  668. if (fExVer)
  669. {
  670. if (fExVer == CPI_ANSI)
  671. {
  672. LPCPINFOEXA pInfoA = (LPCPINFOEXA)pInfo;
  673. //
  674. // Check UnicodeDefaultChar field.
  675. //
  676. if (pInfoA->UnicodeDefaultChar != 0x30fb)
  677. {
  678. printf("ERROR: UnicodeDefaultChar = '%x'\n", pInfoA->UnicodeDefaultChar);
  679. return (FALSE);
  680. }
  681. }
  682. else if (fExVer == CPI_UNICODE)
  683. {
  684. LPCPINFOEXW pInfoW = (LPCPINFOEXW)pInfo;
  685. //
  686. // Check UnicodeDefaultChar field.
  687. //
  688. if (pInfoW->UnicodeDefaultChar != 0x30fb)
  689. {
  690. printf("ERROR: UnicodeDefaultChar = '%x'\n", pInfoW->UnicodeDefaultChar);
  691. return (FALSE);
  692. }
  693. }
  694. }
  695. //
  696. // Return success.
  697. //
  698. return (TRUE);
  699. }
  700. ////////////////////////////////////////////////////////////////////////////
  701. //
  702. // PrintInfoStruct
  703. //
  704. // This routine prints out the CPINFO structure.
  705. //
  706. // 06-14-91 JulieB Created.
  707. ////////////////////////////////////////////////////////////////////////////
  708. void PrintInfoStruct(
  709. LPCPINFO pInfo,
  710. DWORD fExVer)
  711. {
  712. int ctr; // loop counter
  713. //
  714. // Print out MaxCharSize field.
  715. //
  716. printf(" MaxCharSize = %x\n", pInfo->MaxCharSize);
  717. //
  718. // Print out DefaultChar field.
  719. //
  720. printf(" DefaultChar = %x %x\n",
  721. (pInfo->DefaultChar)[0], (pInfo->DefaultChar)[1] );
  722. //
  723. // Print out LeadByte field.
  724. //
  725. for (ctr = 0; ctr < MAX_LEADBYTES; ctr += 2)
  726. {
  727. printf(" LeadByte = %x %x\n",
  728. pInfo->LeadByte[ctr], pInfo->LeadByte[ctr + 1]);
  729. }
  730. //
  731. // See if we have the Ex version.
  732. //
  733. if (fExVer)
  734. {
  735. if (fExVer == CPI_ANSI)
  736. {
  737. LPCPINFOEXA pInfoA = (LPCPINFOEXA)pInfo;
  738. printf(" UnicodeDefaultChar = %x\n", pInfoA->UnicodeDefaultChar);
  739. printf(" CodePage = %d\n", pInfoA->CodePage);
  740. printf(" CodePageName = %s\n", pInfoA->CodePageName);
  741. }
  742. else if (fExVer == CPI_UNICODE)
  743. {
  744. LPCPINFOEXW pInfoW = (LPCPINFOEXW)pInfo;
  745. printf(" UnicodeDefaultChar = %x\n", pInfoW->UnicodeDefaultChar);
  746. printf(" CodePage = %d\n", pInfoW->CodePage);
  747. printf(" CodePageName = %ws\n", pInfoW->CodePageName);
  748. }
  749. }
  750. }
  751. ////////////////////////////////////////////////////////////////////////////
  752. //
  753. // CheckReturnCPInfo
  754. //
  755. // Checks the return code from the GetCPInfo call. It prints out
  756. // the appropriate error if the incorrect result is found.
  757. //
  758. // 06-14-91 JulieB Created.
  759. ////////////////////////////////////////////////////////////////////////////
  760. void CheckReturnCPInfo(
  761. int CurrentReturn,
  762. LPCPINFO pCurrentInfo,
  763. BOOL fIfDBCSInfo,
  764. UINT MaxCharSize,
  765. LPSTR pErrString,
  766. DWORD fExVer,
  767. int *pNumErrors)
  768. {
  769. if ( (CurrentReturn == FALSE) ||
  770. ( (fIfDBCSInfo == FALSE)
  771. ? (!CheckInfoStruct(pCurrentInfo, MaxCharSize, fExVer))
  772. : (!CheckDBCSInfoStruct(pCurrentInfo, fExVer)) ) )
  773. {
  774. printf("ERROR: %s - \n", pErrString);
  775. printf(" Return = %d, Expected = 0\n", CurrentReturn);
  776. printf(" LastError = %d, Expected = 0\n", GetLastError());
  777. PrintInfoStruct(pCurrentInfo, fExVer);
  778. (*pNumErrors)++;
  779. }
  780. else if (Verbose)
  781. {
  782. PrintInfoStruct(pCurrentInfo, fExVer);
  783. }
  784. }