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.

969 lines
26 KiB

  1. /*++
  2. Copyright (c) 1991-1999, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. gcitest.c
  5. Abstract:
  6. Test module for NLS API GetCalendarInfo.
  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. 03-10-98 JulieB Created.
  12. --*/
  13. //
  14. // Include Files.
  15. //
  16. #include "nlstest.h"
  17. //
  18. // Constant Declarations.
  19. //
  20. #define BUFSIZE 50 // buffer size in wide chars
  21. #define CALTYPE_INVALID 0x0000100 // invalid CALTYPE
  22. #define LANG_INVALID 0x0417 // invalid lang id
  23. #define S_ITWODIGITYEARMAX L"2029"
  24. #define I_ITWODIGITYEARMAX 2029
  25. //
  26. // Global Variables.
  27. //
  28. LCID Locale;
  29. WCHAR lpCalData[BUFSIZE];
  30. BYTE lpCalDataA[BUFSIZE];
  31. //
  32. // pCalInfoFlag and pCalString must have the same number of entries.
  33. //
  34. CALTYPE pCalInfoFlag[] =
  35. {
  36. CAL_ICALINTVALUE,
  37. CAL_SCALNAME,
  38. CAL_ITWODIGITYEARMAX,
  39. CAL_IYEAROFFSETRANGE,
  40. CAL_SERASTRING,
  41. CAL_SSHORTDATE,
  42. CAL_SLONGDATE,
  43. CAL_SYEARMONTH,
  44. CAL_SDAYNAME1,
  45. CAL_SMONTHNAME1,
  46. CAL_SMONTHNAME13
  47. };
  48. #define NUM_CAL_FLAGS ( sizeof(pCalInfoFlag) / sizeof(CALTYPE) )
  49. LPWSTR pCalString[] =
  50. {
  51. L"1",
  52. L"Gregorian Calendar",
  53. L"2029",
  54. L"0",
  55. L"",
  56. L"M/d/yyyy",
  57. L"dddd, MMMM dd, yyyy",
  58. L"MMMM, yyyy",
  59. L"Monday",
  60. L"January",
  61. L""
  62. };
  63. LPWSTR pCalStringJapan[] =
  64. {
  65. L"3",
  66. L"\x548c\x66a6",
  67. L"99",
  68. L"1989",
  69. L"\x5e73\x6210",
  70. L"gg y/M/d",
  71. L"gg y'\x5e74'M'\x6708'd'\x65e5'",
  72. L"gg y'\x5e74'M'\x6708'",
  73. L"\x6708\x66dc\x65e5",
  74. L"1\x6708",
  75. L""
  76. };
  77. LPWSTR pCalStringHebrew[] =
  78. {
  79. L"8",
  80. L"\x05dc\x05d5\x05d7\x00a0\x05e9\x05e0\x05d4\x00a0\x05e2\x05d1\x05e8\x05d9",
  81. L"5790",
  82. L"0",
  83. L"",
  84. L"dd/MMM/yyyy",
  85. L"dddd dd MMMM yyyy",
  86. L"MMMM yyyy",
  87. L"\x05d9\x05d5\x05dd\x00a0\x05e9\x05e0\x05d9",
  88. L"\x05ea\x05e9\x05e8\x05d9",
  89. L"\x05d0\x05dc\x05d5\x05dc"
  90. };
  91. //
  92. // pCalIntFlag and pCalInt must have the same number of entries.
  93. //
  94. CALTYPE pCalIntFlag[] =
  95. {
  96. CAL_ICALINTVALUE,
  97. CAL_ITWODIGITYEARMAX,
  98. CAL_IYEAROFFSETRANGE,
  99. };
  100. #define NUM_CAL_INT_FLAGS ( sizeof(pCalIntFlag) / sizeof(CALTYPE) )
  101. int pCalInt[] =
  102. {
  103. 1,
  104. 2029,
  105. 0
  106. };
  107. int pCalIntJapan[] =
  108. {
  109. 3,
  110. 99,
  111. 1989
  112. };
  113. //
  114. // Forward Declarations.
  115. //
  116. BOOL
  117. InitGetCalInfo();
  118. int
  119. GCI_BadParamCheck();
  120. int
  121. GCI_NormalCase();
  122. int
  123. GCI_Ansi();
  124. ////////////////////////////////////////////////////////////////////////////
  125. //
  126. // TestGetCalendarInfo
  127. //
  128. // Test routine for GetCalendarInfoW API.
  129. //
  130. // 03-10-98 JulieB Created.
  131. ////////////////////////////////////////////////////////////////////////////
  132. int TestGetCalendarInfo()
  133. {
  134. int ErrCount = 0; // error count
  135. //
  136. // Print out what's being done.
  137. //
  138. printf("\n\nTESTING GetCalendarInfoW...\n\n");
  139. //
  140. // Initialize global variables.
  141. //
  142. if (!InitGetCalInfo())
  143. {
  144. printf("\nABORTED TestGetCalendarInfo: Could not Initialize.\n");
  145. return (1);
  146. }
  147. //
  148. // Test bad parameters.
  149. //
  150. ErrCount += GCI_BadParamCheck();
  151. //
  152. // Test normal cases.
  153. //
  154. ErrCount += GCI_NormalCase();
  155. //
  156. // Test Ansi version.
  157. //
  158. ErrCount += GCI_Ansi();
  159. //
  160. // Print out result.
  161. //
  162. printf("\nGetCalendarInfoW: ERRORS = %d\n", ErrCount);
  163. //
  164. // Return total number of errors found.
  165. //
  166. return (ErrCount);
  167. }
  168. ////////////////////////////////////////////////////////////////////////////
  169. //
  170. // InitGetCalInfo
  171. //
  172. // This routine initializes the global variables. If no errors were
  173. // encountered, then it returns TRUE. Otherwise, it returns FALSE.
  174. //
  175. // 03-10-98 JulieB Created.
  176. ////////////////////////////////////////////////////////////////////////////
  177. BOOL InitGetCalInfo()
  178. {
  179. //
  180. // Make a Locale.
  181. //
  182. Locale = MAKELCID(0x0409, 0);
  183. //
  184. // Return success.
  185. //
  186. return (TRUE);
  187. }
  188. ////////////////////////////////////////////////////////////////////////////
  189. //
  190. // GCI_BadParamCheck
  191. //
  192. // This routine passes in bad parameters to the API routines and checks to
  193. // be sure they are handled properly. The number of errors encountered
  194. // is returned to the caller.
  195. //
  196. // 03-10-98 JulieB Created.
  197. ////////////////////////////////////////////////////////////////////////////
  198. int GCI_BadParamCheck()
  199. {
  200. DWORD dwValue; // value
  201. int NumErrors = 0; // error count - to be returned
  202. int rc; // return code
  203. //
  204. // Bad Locale.
  205. //
  206. // Variation 1 - Bad Locale
  207. rc = GetCalendarInfoW( (LCID)333,
  208. CAL_GREGORIAN,
  209. CAL_ITWODIGITYEARMAX,
  210. lpCalData,
  211. BUFSIZE,
  212. NULL );
  213. CheckReturnBadParam( rc,
  214. 0,
  215. ERROR_INVALID_PARAMETER,
  216. "Bad Locale",
  217. &NumErrors );
  218. // Variation 2 - Bad Locale
  219. rc = GetCalendarInfoW( LANG_INVALID,
  220. CAL_GREGORIAN,
  221. CAL_ITWODIGITYEARMAX,
  222. lpCalData,
  223. BUFSIZE,
  224. NULL );
  225. CheckReturnBadParam( rc,
  226. 0,
  227. ERROR_INVALID_PARAMETER,
  228. "invalid locale - invalid",
  229. &NumErrors );
  230. //
  231. // Null Pointers.
  232. //
  233. // Variation 1 - lpCalData = NULL
  234. rc = GetCalendarInfoW( Locale,
  235. CAL_GREGORIAN,
  236. CAL_ITWODIGITYEARMAX,
  237. NULL,
  238. BUFSIZE,
  239. NULL );
  240. CheckReturnBadParam( rc,
  241. 0,
  242. ERROR_INVALID_PARAMETER,
  243. "lpCalData NULL",
  244. &NumErrors );
  245. //
  246. // Bad Counts.
  247. //
  248. // Variation 1 - cchData < 0
  249. rc = GetCalendarInfoW( Locale,
  250. CAL_GREGORIAN,
  251. CAL_ITWODIGITYEARMAX,
  252. lpCalData,
  253. -1,
  254. NULL );
  255. CheckReturnBadParam( rc,
  256. 0,
  257. ERROR_INVALID_PARAMETER,
  258. "cchData < 0",
  259. &NumErrors );
  260. //
  261. // Zero or Invalid Type.
  262. //
  263. // Variation 1 - CalType = invalid
  264. rc = GetCalendarInfoW( Locale,
  265. CAL_GREGORIAN,
  266. CALTYPE_INVALID,
  267. lpCalData,
  268. BUFSIZE,
  269. NULL );
  270. CheckReturnBadParam( rc,
  271. 0,
  272. ERROR_INVALID_FLAGS,
  273. "CalType invalid",
  274. &NumErrors );
  275. // Variation 2 - CalType = 0
  276. rc = GetCalendarInfoW( Locale,
  277. CAL_GREGORIAN,
  278. 0,
  279. lpCalData,
  280. BUFSIZE,
  281. NULL );
  282. CheckReturnBadParam( rc,
  283. 0,
  284. ERROR_INVALID_FLAGS,
  285. "CalType zero",
  286. &NumErrors );
  287. // Variation 3 - Use CP ACP, CalType = invalid
  288. rc = GetCalendarInfoW( Locale,
  289. CAL_GREGORIAN,
  290. CAL_USE_CP_ACP | CALTYPE_INVALID,
  291. lpCalData,
  292. BUFSIZE,
  293. NULL );
  294. CheckReturnBadParam( rc,
  295. 0,
  296. ERROR_INVALID_FLAGS,
  297. "Use CP ACP, CalType invalid",
  298. &NumErrors );
  299. //
  300. // Buffer Too Small.
  301. //
  302. // Variation 1 - cchData = too small
  303. rc = GetCalendarInfoW( Locale,
  304. CAL_GREGORIAN,
  305. CAL_ITWODIGITYEARMAX,
  306. lpCalData,
  307. 1,
  308. NULL );
  309. CheckReturnBadParam( rc,
  310. 0,
  311. ERROR_INSUFFICIENT_BUFFER,
  312. "cchData too small",
  313. &NumErrors );
  314. //
  315. // RETURN_NUMBER flag.
  316. //
  317. // Variation 1 - invalid flags
  318. rc = GetCalendarInfoW( Locale,
  319. CAL_GREGORIAN,
  320. CAL_SCALNAME | CAL_RETURN_NUMBER,
  321. NULL,
  322. 0,
  323. &dwValue );
  324. CheckReturnBadParam( rc,
  325. 0,
  326. ERROR_INVALID_FLAGS,
  327. "invalid flags - RETURN_NUMBER",
  328. &NumErrors );
  329. // Variation 2 - wrong buffer 1
  330. rc = GetCalendarInfoW( Locale,
  331. CAL_GREGORIAN,
  332. CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
  333. lpCalData,
  334. BUFSIZE,
  335. NULL );
  336. CheckReturnBadParam( rc,
  337. 0,
  338. ERROR_INVALID_PARAMETER,
  339. "wrong buffer 1 - RETURN_NUMBER",
  340. &NumErrors );
  341. // Variation 3 - wrong buffer 2
  342. rc = GetCalendarInfoW( Locale,
  343. CAL_GREGORIAN,
  344. CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
  345. lpCalData,
  346. 0,
  347. &dwValue );
  348. CheckReturnBadParam( rc,
  349. 0,
  350. ERROR_INVALID_PARAMETER,
  351. "wrong buffer 2 - RETURN_NUMBER",
  352. &NumErrors );
  353. // Variation 4 - wrong buffer 3
  354. rc = GetCalendarInfoW( Locale,
  355. CAL_GREGORIAN,
  356. CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
  357. NULL,
  358. BUFSIZE,
  359. &dwValue );
  360. CheckReturnBadParam( rc,
  361. 0,
  362. ERROR_INVALID_PARAMETER,
  363. "wrong buffer 3 - RETURN_NUMBER",
  364. &NumErrors );
  365. //
  366. // Wrong Buffer.
  367. //
  368. // Variation 1 - wrong buffer 1
  369. rc = GetCalendarInfoW( Locale,
  370. CAL_GREGORIAN,
  371. CAL_ITWODIGITYEARMAX,
  372. lpCalData,
  373. BUFSIZE,
  374. &dwValue );
  375. CheckReturnBadParam( rc,
  376. 0,
  377. ERROR_INVALID_PARAMETER,
  378. "wrong buffer 1",
  379. &NumErrors );
  380. // Variation 2 - wrong buffer 2
  381. rc = GetCalendarInfoW( Locale,
  382. CAL_GREGORIAN,
  383. CAL_ITWODIGITYEARMAX,
  384. NULL,
  385. 0,
  386. &dwValue );
  387. CheckReturnBadParam( rc,
  388. 0,
  389. ERROR_INVALID_PARAMETER,
  390. "wrong buffer 2",
  391. &NumErrors );
  392. // Variation 3 - wrong buffer 3
  393. rc = GetCalendarInfoW( Locale,
  394. CAL_GREGORIAN,
  395. CAL_ITWODIGITYEARMAX,
  396. lpCalData,
  397. 0,
  398. &dwValue );
  399. CheckReturnBadParam( rc,
  400. 0,
  401. ERROR_INVALID_PARAMETER,
  402. "wrong buffer 3",
  403. &NumErrors );
  404. //
  405. // Return total number of errors found.
  406. //
  407. return (NumErrors);
  408. }
  409. ////////////////////////////////////////////////////////////////////////////
  410. //
  411. // GCI_NormalCase
  412. //
  413. // This routine tests the normal cases of the API routine.
  414. //
  415. // 03-10-98 JulieB Created.
  416. ////////////////////////////////////////////////////////////////////////////
  417. int GCI_NormalCase()
  418. {
  419. DWORD dwValue; // value
  420. int NumErrors = 0; // error count - to be returned
  421. int rc; // return code
  422. int ctr; // loop counter
  423. #ifdef PERF
  424. DbgBreakPoint();
  425. #endif
  426. //
  427. // Locales.
  428. //
  429. // Variation 1 - System Default Locale
  430. rc = GetCalendarInfoW( LOCALE_SYSTEM_DEFAULT,
  431. CAL_GREGORIAN,
  432. CAL_ITWODIGITYEARMAX,
  433. lpCalData,
  434. BUFSIZE,
  435. NULL );
  436. CheckReturnEqual( rc,
  437. 0,
  438. "system default locale",
  439. &NumErrors );
  440. // Variation 2 - Current User Locale
  441. rc = GetCalendarInfoW( LOCALE_USER_DEFAULT,
  442. CAL_GREGORIAN,
  443. CAL_ITWODIGITYEARMAX,
  444. lpCalData,
  445. BUFSIZE,
  446. NULL );
  447. CheckReturnEqual( rc,
  448. 0,
  449. "current user locale",
  450. &NumErrors );
  451. //
  452. // Use CP ACP.
  453. //
  454. // Variation 1 - Use CP ACP, System Default Locale
  455. rc = GetCalendarInfoW( LOCALE_SYSTEM_DEFAULT,
  456. CAL_GREGORIAN,
  457. CAL_USE_CP_ACP | CAL_ITWODIGITYEARMAX,
  458. lpCalData,
  459. BUFSIZE,
  460. NULL );
  461. CheckReturnEqual( rc,
  462. 0,
  463. "Use CP ACP, system default locale",
  464. &NumErrors );
  465. //
  466. // cchData.
  467. //
  468. // Variation 1 - cchData = size of lpCalData buffer
  469. rc = GetCalendarInfoW( Locale,
  470. CAL_GREGORIAN,
  471. CAL_ITWODIGITYEARMAX,
  472. lpCalData,
  473. BUFSIZE,
  474. NULL );
  475. CheckReturnValidW( rc,
  476. -1,
  477. lpCalData,
  478. S_ITWODIGITYEARMAX,
  479. "cchData = bufsize",
  480. &NumErrors );
  481. // Variation 2 - cchData = 0
  482. lpCalData[0] = 0x0000;
  483. rc = GetCalendarInfoW( Locale,
  484. CAL_GREGORIAN,
  485. CAL_ITWODIGITYEARMAX,
  486. lpCalData,
  487. 0,
  488. NULL );
  489. CheckReturnValidW( rc,
  490. -1,
  491. NULL,
  492. S_ITWODIGITYEARMAX,
  493. "cchData zero",
  494. &NumErrors );
  495. // Variation 3 - cchData = 0, lpCalData = NULL
  496. rc = GetCalendarInfoW( Locale,
  497. CAL_GREGORIAN,
  498. CAL_ITWODIGITYEARMAX,
  499. NULL,
  500. 0,
  501. NULL );
  502. CheckReturnValidW( rc,
  503. -1,
  504. NULL,
  505. S_ITWODIGITYEARMAX,
  506. "cchData (NULL ptr)",
  507. &NumErrors );
  508. //
  509. // CALTYPE values.
  510. //
  511. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  512. {
  513. rc = GetCalendarInfoW( Locale,
  514. CAL_GREGORIAN,
  515. pCalInfoFlag[ctr],
  516. lpCalData,
  517. BUFSIZE,
  518. NULL );
  519. CheckReturnValidLoopW( rc,
  520. -1,
  521. lpCalData,
  522. pCalString[ctr],
  523. "Calendar Flag",
  524. pCalInfoFlag[ctr],
  525. &NumErrors );
  526. }
  527. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  528. {
  529. rc = GetCalendarInfoW( 0x0411,
  530. CAL_JAPAN,
  531. pCalInfoFlag[ctr],
  532. lpCalData,
  533. BUFSIZE,
  534. NULL );
  535. CheckReturnValidLoopW( rc,
  536. -1,
  537. lpCalData,
  538. pCalStringJapan[ctr],
  539. "Japan Calendar Flag",
  540. pCalInfoFlag[ctr],
  541. &NumErrors );
  542. }
  543. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  544. {
  545. rc = GetCalendarInfoW( 0x040d,
  546. CAL_HEBREW,
  547. pCalInfoFlag[ctr],
  548. lpCalData,
  549. BUFSIZE,
  550. NULL );
  551. CheckReturnValidLoopW( rc,
  552. -1,
  553. lpCalData,
  554. pCalStringHebrew[ctr],
  555. "Hebrew Calendar Flag",
  556. pCalInfoFlag[ctr],
  557. &NumErrors );
  558. }
  559. //
  560. // Language Neutral.
  561. //
  562. // Variation 1 - language neutral
  563. rc = GetCalendarInfoW( 0x0000,
  564. CAL_GREGORIAN,
  565. CAL_ITWODIGITYEARMAX,
  566. lpCalData,
  567. BUFSIZE,
  568. NULL );
  569. CheckReturnValidW( rc,
  570. -1,
  571. lpCalData,
  572. S_ITWODIGITYEARMAX,
  573. "language neutral",
  574. &NumErrors );
  575. // Variation 2 - sys default
  576. rc = GetCalendarInfoW( 0x0400,
  577. CAL_GREGORIAN,
  578. CAL_ITWODIGITYEARMAX,
  579. lpCalData,
  580. BUFSIZE,
  581. NULL );
  582. CheckReturnValidW( rc,
  583. -1,
  584. lpCalData,
  585. S_ITWODIGITYEARMAX,
  586. "sys default",
  587. &NumErrors );
  588. // Variation 3 - user default
  589. rc = GetCalendarInfoW( 0x0800,
  590. CAL_GREGORIAN,
  591. CAL_ITWODIGITYEARMAX,
  592. lpCalData,
  593. BUFSIZE,
  594. NULL );
  595. CheckReturnValidW( rc,
  596. -1,
  597. lpCalData,
  598. S_ITWODIGITYEARMAX,
  599. "user default",
  600. &NumErrors );
  601. // Variation 4 - sub lang neutral US
  602. rc = GetCalendarInfoW( 0x0009,
  603. CAL_GREGORIAN,
  604. CAL_ITWODIGITYEARMAX,
  605. lpCalData,
  606. BUFSIZE,
  607. NULL );
  608. CheckReturnValidW( rc,
  609. -1,
  610. lpCalData,
  611. S_ITWODIGITYEARMAX,
  612. "sub lang neutral US",
  613. &NumErrors );
  614. //
  615. // Test Return Number flag.
  616. //
  617. // Variation 1 - RETURN_NUMBER
  618. rc = GetCalendarInfoW( Locale,
  619. CAL_GREGORIAN,
  620. CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
  621. NULL,
  622. 0,
  623. &dwValue );
  624. CheckReturnValidInt( rc,
  625. 2,
  626. dwValue,
  627. 2029,
  628. "Return_Number - two digit year max",
  629. &NumErrors );
  630. //
  631. // Try all INT flags with CAL_RETURN_NUMBER flag.
  632. //
  633. for (ctr = 0; ctr < NUM_CAL_INT_FLAGS; ctr++)
  634. {
  635. rc = GetCalendarInfoW( Locale,
  636. CAL_GREGORIAN,
  637. pCalIntFlag[ctr] | CAL_RETURN_NUMBER,
  638. NULL,
  639. 0,
  640. &dwValue );
  641. CheckReturnValidInt( rc,
  642. 2,
  643. dwValue,
  644. pCalInt[ctr],
  645. "Calendar Int Flag",
  646. &NumErrors );
  647. }
  648. for (ctr = 0; ctr < NUM_CAL_INT_FLAGS; ctr++)
  649. {
  650. rc = GetCalendarInfoW( 0x0411,
  651. CAL_JAPAN,
  652. pCalIntFlag[ctr] | CAL_RETURN_NUMBER,
  653. NULL,
  654. 0,
  655. &dwValue );
  656. CheckReturnValidInt( rc,
  657. 2,
  658. dwValue,
  659. pCalIntJapan[ctr],
  660. "Japan Calendar Int Flag",
  661. &NumErrors );
  662. }
  663. //
  664. // Return total number of errors found.
  665. //
  666. return (NumErrors);
  667. }
  668. ////////////////////////////////////////////////////////////////////////////
  669. //
  670. // GCI_Ansi
  671. //
  672. // This routine tests the Ansi version of the API routine.
  673. //
  674. // 03-10-98 JulieB Created.
  675. ////////////////////////////////////////////////////////////////////////////
  676. int GCI_Ansi()
  677. {
  678. DWORD dwValue; // value
  679. int NumErrors = 0; // error count - to be returned
  680. int rc; // return code
  681. int ctr; // loop counter
  682. //
  683. // GetCalendarInfoA.
  684. //
  685. // Variation 1 - ITWODIGITYEARMAX
  686. rc = GetCalendarInfoA( Locale,
  687. CAL_GREGORIAN,
  688. CAL_ITWODIGITYEARMAX,
  689. lpCalDataA,
  690. BUFSIZE,
  691. NULL );
  692. CheckReturnValidA( rc,
  693. -1,
  694. lpCalDataA,
  695. "2029",
  696. NULL,
  697. "A version ITWODIGITYEARMAX",
  698. &NumErrors );
  699. // Variation 2 - ITWODIGITYEARMAX
  700. rc = GetCalendarInfoA( Locale,
  701. CAL_GREGORIAN,
  702. CAL_ITWODIGITYEARMAX,
  703. NULL,
  704. 0,
  705. NULL );
  706. CheckReturnValidA( rc,
  707. -1,
  708. NULL,
  709. "2029",
  710. NULL,
  711. "A version ITWODIGITYEARMAX, no Dest",
  712. &NumErrors );
  713. // Variation 3 - ITWODIGITYEARMAX
  714. rc = GetCalendarInfoA( Locale,
  715. CAL_GREGORIAN,
  716. CAL_ITWODIGITYEARMAX,
  717. NULL,
  718. BUFSIZE,
  719. NULL );
  720. CheckReturnBadParam( rc,
  721. 0,
  722. ERROR_INVALID_PARAMETER,
  723. "A version bad lpCalData",
  724. &NumErrors );
  725. //
  726. // Use CP ACP.
  727. //
  728. // Variation 1 - Use CP ACP, ITWODIGITYEARMAX
  729. rc = GetCalendarInfoA( Locale,
  730. CAL_GREGORIAN,
  731. CAL_USE_CP_ACP | CAL_ITWODIGITYEARMAX,
  732. lpCalDataA,
  733. BUFSIZE,
  734. NULL );
  735. CheckReturnValidA( rc,
  736. -1,
  737. lpCalDataA,
  738. "2029",
  739. NULL,
  740. "A version Use CP ACP, ITWODIGITYEARMAX",
  741. &NumErrors );
  742. //
  743. // Make sure the A and W versions set the same error value.
  744. //
  745. SetLastError( 0 );
  746. rc = GetCalendarInfoA( Locale,
  747. CAL_GREGORIAN,
  748. CAL_ITWODIGITYEARMAX,
  749. lpCalDataA,
  750. -1,
  751. NULL );
  752. CheckReturnBadParam( rc,
  753. 0,
  754. ERROR_INVALID_PARAMETER,
  755. "A and W error returns same - A version",
  756. &NumErrors );
  757. SetLastError( 0 );
  758. rc = GetCalendarInfoW( Locale,
  759. CAL_GREGORIAN,
  760. CAL_ITWODIGITYEARMAX,
  761. lpCalData,
  762. -1,
  763. NULL );
  764. CheckReturnBadParam( rc,
  765. 0,
  766. ERROR_INVALID_PARAMETER,
  767. "A and W error returns same - W version",
  768. &NumErrors );
  769. //
  770. // Test Return Number flag.
  771. //
  772. // Variation 1 - RETURN_NUMBER
  773. rc = GetCalendarInfoA( Locale,
  774. CAL_GREGORIAN,
  775. CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
  776. NULL,
  777. 0,
  778. &dwValue );
  779. CheckReturnValidInt( rc,
  780. 4,
  781. dwValue,
  782. 2029,
  783. "A Version Return_Number - two digit year max",
  784. &NumErrors );
  785. //
  786. // Try all INT flags with CAL_RETURN_NUMBER flag.
  787. //
  788. for (ctr = 0; ctr < NUM_CAL_INT_FLAGS; ctr++)
  789. {
  790. rc = GetCalendarInfoA( Locale,
  791. CAL_GREGORIAN,
  792. pCalIntFlag[ctr] | CAL_RETURN_NUMBER,
  793. NULL,
  794. 0,
  795. &dwValue );
  796. CheckReturnValidInt( rc,
  797. 4,
  798. dwValue,
  799. pCalInt[ctr],
  800. "A Version Calendar Int Flag",
  801. &NumErrors );
  802. }
  803. //
  804. // Return total number of errors found.
  805. //
  806. return (NumErrors);
  807. }