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.

1752 lines
45 KiB

  1. /*++
  2. Copyright (c) 1991-1999, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. glitest.c
  5. Abstract:
  6. Test module for NLS API GetLocaleInfo.
  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 Declarations.
  19. //
  20. #define BUFSIZE 50 // buffer size in wide chars
  21. #define LCTYPE_INVALID 0x0000100 // invalid LCTYPE
  22. #define LANG_INVALID 0x0417 // invalid lang id
  23. #define S_ILANGUAGE L"0409"
  24. #define S_SLANGUAGE L"English (United States)"
  25. #define S_SMONTHNAME1_RUSSIAN L"\x042f\x043d\x0432\x0430\x0440\x044c"
  26. #define S_SMONTHNAME2_RUSSIAN L"\x0424\x0435\x0432\x0440\x0430\x043b\x044c"
  27. #define FONTSIG_ENGLISH L"\x00af\x8000\x38cb\x0000\x0000\x0000\x0000\x0000\x0001\x0000\x0000\x8000\x01ff\x003f\x8000\xffff"
  28. #define FONTSIG_RUSSIAN L"\x0203\x8000\x3848\x0000\x0000\x0000\x0000\x0000\x0004\x0000\x0000\x0002\x0004\x0000\x0000\x0202"
  29. #define FONTSIG_ENGLISH_A "\xaf\x00\x00\x80\xcb\x38\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x80\xff\x01\x3f\x00\x00\x80\xff\xff"
  30. #define FONTSIG_RUSSIAN_A "\x03\x02\x00\x80\x48\x38\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x02\x00\x04\x00\x00\x00\x00\x00\x02\x02"
  31. //
  32. // Global Variables.
  33. //
  34. LCID Locale;
  35. WCHAR lpLCData[BUFSIZE];
  36. BYTE lpLCDataA[BUFSIZE];
  37. //
  38. // pLocaleFlag and pLocaleString must have the same number of entries.
  39. //
  40. LCTYPE pLocaleFlag[] =
  41. {
  42. LOCALE_ILANGUAGE,
  43. LOCALE_SLANGUAGE,
  44. LOCALE_SENGLANGUAGE,
  45. LOCALE_SABBREVLANGNAME,
  46. LOCALE_SNATIVELANGNAME,
  47. LOCALE_ICOUNTRY,
  48. LOCALE_SCOUNTRY,
  49. LOCALE_SENGCOUNTRY,
  50. LOCALE_SABBREVCTRYNAME,
  51. LOCALE_SNATIVECTRYNAME,
  52. LOCALE_IGEOID,
  53. LOCALE_SSORTNAME,
  54. LOCALE_IDEFAULTLANGUAGE,
  55. LOCALE_IDEFAULTCOUNTRY,
  56. LOCALE_IDEFAULTANSICODEPAGE,
  57. LOCALE_IDEFAULTCODEPAGE,
  58. LOCALE_IDEFAULTMACCODEPAGE,
  59. LOCALE_IDEFAULTEBCDICCODEPAGE,
  60. LOCALE_SLIST,
  61. LOCALE_IMEASURE,
  62. LOCALE_IPAPERSIZE,
  63. LOCALE_SDECIMAL,
  64. LOCALE_STHOUSAND,
  65. LOCALE_SGROUPING,
  66. LOCALE_IDIGITS,
  67. LOCALE_ILZERO,
  68. LOCALE_SNATIVEDIGITS,
  69. LOCALE_SCURRENCY,
  70. LOCALE_SINTLSYMBOL,
  71. LOCALE_SENGCURRNAME,
  72. LOCALE_SNATIVECURRNAME,
  73. LOCALE_SMONDECIMALSEP,
  74. LOCALE_SMONTHOUSANDSEP,
  75. LOCALE_SMONGROUPING,
  76. LOCALE_ICURRDIGITS,
  77. LOCALE_IINTLCURRDIGITS,
  78. LOCALE_ICURRENCY,
  79. LOCALE_INEGCURR,
  80. LOCALE_SPOSITIVESIGN,
  81. LOCALE_SNEGATIVESIGN,
  82. LOCALE_IPOSSIGNPOSN,
  83. LOCALE_INEGSIGNPOSN,
  84. LOCALE_IPOSSYMPRECEDES,
  85. LOCALE_IPOSSEPBYSPACE,
  86. LOCALE_INEGSYMPRECEDES,
  87. LOCALE_INEGSEPBYSPACE,
  88. LOCALE_STIMEFORMAT,
  89. LOCALE_STIME,
  90. LOCALE_ITIME,
  91. LOCALE_ITLZERO,
  92. LOCALE_ITIMEMARKPOSN,
  93. LOCALE_S1159,
  94. LOCALE_S2359,
  95. LOCALE_SSHORTDATE,
  96. LOCALE_SDATE,
  97. LOCALE_IDATE,
  98. LOCALE_ICENTURY,
  99. LOCALE_IDAYLZERO,
  100. LOCALE_IMONLZERO,
  101. LOCALE_SYEARMONTH,
  102. LOCALE_SLONGDATE,
  103. LOCALE_ILDATE,
  104. LOCALE_ICALENDARTYPE,
  105. LOCALE_IOPTIONALCALENDAR,
  106. LOCALE_IFIRSTDAYOFWEEK,
  107. LOCALE_IFIRSTWEEKOFYEAR,
  108. LOCALE_SDAYNAME1,
  109. LOCALE_SDAYNAME2,
  110. LOCALE_SDAYNAME3,
  111. LOCALE_SDAYNAME4,
  112. LOCALE_SDAYNAME5,
  113. LOCALE_SDAYNAME6,
  114. LOCALE_SDAYNAME7,
  115. LOCALE_SABBREVDAYNAME1,
  116. LOCALE_SABBREVDAYNAME2,
  117. LOCALE_SABBREVDAYNAME3,
  118. LOCALE_SABBREVDAYNAME4,
  119. LOCALE_SABBREVDAYNAME5,
  120. LOCALE_SABBREVDAYNAME6,
  121. LOCALE_SABBREVDAYNAME7,
  122. LOCALE_SMONTHNAME1,
  123. LOCALE_SMONTHNAME2,
  124. LOCALE_SMONTHNAME3,
  125. LOCALE_SMONTHNAME4,
  126. LOCALE_SMONTHNAME5,
  127. LOCALE_SMONTHNAME6,
  128. LOCALE_SMONTHNAME7,
  129. LOCALE_SMONTHNAME8,
  130. LOCALE_SMONTHNAME9,
  131. LOCALE_SMONTHNAME10,
  132. LOCALE_SMONTHNAME11,
  133. LOCALE_SMONTHNAME12,
  134. LOCALE_SMONTHNAME13,
  135. LOCALE_SABBREVMONTHNAME1,
  136. LOCALE_SABBREVMONTHNAME2,
  137. LOCALE_SABBREVMONTHNAME3,
  138. LOCALE_SABBREVMONTHNAME4,
  139. LOCALE_SABBREVMONTHNAME5,
  140. LOCALE_SABBREVMONTHNAME6,
  141. LOCALE_SABBREVMONTHNAME7,
  142. LOCALE_SABBREVMONTHNAME8,
  143. LOCALE_SABBREVMONTHNAME9,
  144. LOCALE_SABBREVMONTHNAME10,
  145. LOCALE_SABBREVMONTHNAME11,
  146. LOCALE_SABBREVMONTHNAME12,
  147. LOCALE_SABBREVMONTHNAME13
  148. };
  149. #define NUM_LOCALE_FLAGS ( sizeof(pLocaleFlag) / sizeof(LCTYPE) )
  150. LPWSTR pLocaleString[] =
  151. {
  152. L"0409",
  153. L"English (United States)",
  154. L"English",
  155. L"ENU",
  156. L"English",
  157. L"1",
  158. L"United States",
  159. L"United States",
  160. L"USA",
  161. L"United States",
  162. L"244",
  163. L"Default",
  164. L"0409",
  165. L"1",
  166. L"1252",
  167. L"437",
  168. L"10000",
  169. L"037",
  170. L",",
  171. L"1",
  172. L"1",
  173. L".",
  174. L",",
  175. L"3;0",
  176. L"2",
  177. L"1",
  178. L"0123456789",
  179. L"$",
  180. L"USD",
  181. L"US Dollar",
  182. L"US Dollar",
  183. L".",
  184. L",",
  185. L"3;0",
  186. L"2",
  187. L"2",
  188. L"0",
  189. L"0",
  190. L"",
  191. L"-",
  192. L"3",
  193. L"0",
  194. L"1",
  195. L"0",
  196. L"1",
  197. L"0",
  198. L"h:mm:ss tt",
  199. L":",
  200. L"0",
  201. L"0",
  202. L"0",
  203. L"AM",
  204. L"PM",
  205. L"M/d/yyyy",
  206. L"/",
  207. L"0",
  208. L"1",
  209. L"0",
  210. L"0",
  211. L"MMMM, yyyy",
  212. L"dddd, MMMM dd, yyyy",
  213. L"0",
  214. L"1",
  215. L"0",
  216. L"6",
  217. L"0",
  218. L"Monday",
  219. L"Tuesday",
  220. L"Wednesday",
  221. L"Thursday",
  222. L"Friday",
  223. L"Saturday",
  224. L"Sunday",
  225. L"Mon",
  226. L"Tue",
  227. L"Wed",
  228. L"Thu",
  229. L"Fri",
  230. L"Sat",
  231. L"Sun",
  232. L"January",
  233. L"February",
  234. L"March",
  235. L"April",
  236. L"May",
  237. L"June",
  238. L"July",
  239. L"August",
  240. L"September",
  241. L"October",
  242. L"November",
  243. L"December",
  244. L"",
  245. L"Jan",
  246. L"Feb",
  247. L"Mar",
  248. L"Apr",
  249. L"May",
  250. L"Jun",
  251. L"Jul",
  252. L"Aug",
  253. L"Sep",
  254. L"Oct",
  255. L"Nov",
  256. L"Dec",
  257. L""
  258. };
  259. //
  260. // pLocaleIntFlag and pLocaleInt must have the same number of entries.
  261. //
  262. LCTYPE pLocaleIntFlag[] =
  263. {
  264. LOCALE_ILANGUAGE,
  265. LOCALE_ICOUNTRY,
  266. LOCALE_IDEFAULTLANGUAGE,
  267. LOCALE_IDEFAULTCOUNTRY,
  268. LOCALE_IDEFAULTANSICODEPAGE,
  269. LOCALE_IDEFAULTCODEPAGE,
  270. LOCALE_IDEFAULTMACCODEPAGE,
  271. LOCALE_IGEOID,
  272. LOCALE_IMEASURE,
  273. LOCALE_IDIGITS,
  274. LOCALE_ILZERO,
  275. LOCALE_ICURRDIGITS,
  276. LOCALE_IINTLCURRDIGITS,
  277. LOCALE_ICURRENCY,
  278. LOCALE_INEGCURR,
  279. LOCALE_IPOSSIGNPOSN,
  280. LOCALE_INEGSIGNPOSN,
  281. LOCALE_IPOSSYMPRECEDES,
  282. LOCALE_IPOSSEPBYSPACE,
  283. LOCALE_INEGSYMPRECEDES,
  284. LOCALE_INEGSEPBYSPACE,
  285. LOCALE_ITIME,
  286. LOCALE_ITLZERO,
  287. LOCALE_ITIMEMARKPOSN,
  288. LOCALE_IDATE,
  289. LOCALE_ICENTURY,
  290. LOCALE_IDAYLZERO,
  291. LOCALE_IMONLZERO,
  292. LOCALE_ILDATE,
  293. LOCALE_ICALENDARTYPE,
  294. LOCALE_IOPTIONALCALENDAR,
  295. LOCALE_IFIRSTDAYOFWEEK,
  296. LOCALE_IFIRSTWEEKOFYEAR
  297. };
  298. #define NUM_LOCALE_INT_FLAGS ( sizeof(pLocaleIntFlag) / sizeof(LCTYPE) )
  299. DWORD pLocaleInt[] =
  300. {
  301. 0x0409,
  302. 1,
  303. 0x0409,
  304. 1,
  305. 1252,
  306. 437,
  307. 10000,
  308. 244,
  309. 1,
  310. 2,
  311. 1,
  312. 2,
  313. 2,
  314. 0,
  315. 0,
  316. 3,
  317. 0,
  318. 1,
  319. 0,
  320. 1,
  321. 0,
  322. 0,
  323. 0,
  324. 0,
  325. 0,
  326. 1,
  327. 0,
  328. 0,
  329. 0,
  330. 1,
  331. 0,
  332. 6,
  333. 0
  334. };
  335. //
  336. // Forward Declarations.
  337. //
  338. BOOL
  339. InitGetLocInfo();
  340. int
  341. GLI_BadParamCheck();
  342. int
  343. GLI_NormalCase();
  344. int
  345. GLI_Ansi();
  346. int
  347. VER_NormalCase();
  348. ////////////////////////////////////////////////////////////////////////////
  349. //
  350. // TestGetLocaleInfo
  351. //
  352. // Test routine for GetLocaleInfoW API.
  353. //
  354. // 06-14-91 JulieB Created.
  355. ////////////////////////////////////////////////////////////////////////////
  356. int TestGetLocaleInfo()
  357. {
  358. int ErrCount = 0; // error count
  359. //
  360. // Print out what's being done.
  361. //
  362. printf("\n\nTESTING GetLocaleInfoW...\n\n");
  363. //
  364. // Initialize global variables.
  365. //
  366. if (!InitGetLocInfo())
  367. {
  368. printf("\nABORTED TestGetLocaleInfo: Could not Initialize.\n");
  369. return (1);
  370. }
  371. //
  372. // Test bad parameters.
  373. //
  374. ErrCount += GLI_BadParamCheck();
  375. //
  376. // Test normal cases.
  377. //
  378. ErrCount += GLI_NormalCase();
  379. //
  380. // Test Ansi version.
  381. //
  382. ErrCount += GLI_Ansi();
  383. //
  384. // Test Version Routines.
  385. //
  386. ErrCount += VER_NormalCase();
  387. //
  388. // Print out result.
  389. //
  390. printf("\nGetLocaleInfoW: ERRORS = %d\n", ErrCount);
  391. //
  392. // Return total number of errors found.
  393. //
  394. return (ErrCount);
  395. }
  396. ////////////////////////////////////////////////////////////////////////////
  397. //
  398. // InitGetLocInfo
  399. //
  400. // This routine initializes the global variables. If no errors were
  401. // encountered, then it returns TRUE. Otherwise, it returns FALSE.
  402. //
  403. // 06-14-91 JulieB Created.
  404. ////////////////////////////////////////////////////////////////////////////
  405. BOOL InitGetLocInfo()
  406. {
  407. //
  408. // Make a Locale.
  409. //
  410. Locale = MAKELCID(0x0409, 0);
  411. //
  412. // Return success.
  413. //
  414. return (TRUE);
  415. }
  416. ////////////////////////////////////////////////////////////////////////////
  417. //
  418. // GLI_BadParamCheck
  419. //
  420. // This routine passes in bad parameters to the API routines and checks to
  421. // be sure they are handled properly. The number of errors encountered
  422. // is returned to the caller.
  423. //
  424. // 06-14-91 JulieB Created.
  425. ////////////////////////////////////////////////////////////////////////////
  426. int GLI_BadParamCheck()
  427. {
  428. int NumErrors = 0; // error count - to be returned
  429. int rc; // return code
  430. //
  431. // Bad Locale.
  432. //
  433. // Variation 1 - Bad Locale
  434. rc = GetLocaleInfoW( (LCID)333,
  435. LOCALE_ILANGUAGE,
  436. lpLCData,
  437. BUFSIZE );
  438. CheckReturnBadParam( rc,
  439. 0,
  440. ERROR_INVALID_PARAMETER,
  441. "Bad Locale",
  442. &NumErrors );
  443. //
  444. // Null Pointers.
  445. //
  446. // Variation 1 - lpLCData = NULL
  447. rc = GetLocaleInfoW( Locale,
  448. LOCALE_ILANGUAGE,
  449. NULL,
  450. BUFSIZE );
  451. CheckReturnBadParam( rc,
  452. 0,
  453. ERROR_INVALID_PARAMETER,
  454. "lpLCData NULL",
  455. &NumErrors );
  456. //
  457. // Bad Counts.
  458. //
  459. // Variation 1 - cbBuf < 0
  460. rc = GetLocaleInfoW( Locale,
  461. LOCALE_ILANGUAGE,
  462. lpLCData,
  463. -1 );
  464. CheckReturnBadParam( rc,
  465. 0,
  466. ERROR_INVALID_PARAMETER,
  467. "cbBuf < 0",
  468. &NumErrors );
  469. //
  470. // Zero or Invalid Type.
  471. //
  472. // Variation 1 - LCType = invalid
  473. rc = GetLocaleInfoW( Locale,
  474. LCTYPE_INVALID,
  475. lpLCData,
  476. BUFSIZE );
  477. CheckReturnBadParam( rc,
  478. 0,
  479. ERROR_INVALID_FLAGS,
  480. "LCType invalid",
  481. &NumErrors );
  482. // Variation 2 - LCType = 0
  483. rc = GetLocaleInfoW( Locale,
  484. 0,
  485. lpLCData,
  486. BUFSIZE );
  487. CheckReturnBadParam( rc,
  488. 0,
  489. ERROR_INVALID_FLAGS,
  490. "LCType zero",
  491. &NumErrors );
  492. // Variation 3 - Use CP ACP, LCType = invalid
  493. rc = GetLocaleInfoW( Locale,
  494. LOCALE_USE_CP_ACP | LCTYPE_INVALID,
  495. lpLCData,
  496. BUFSIZE );
  497. CheckReturnBadParam( rc,
  498. 0,
  499. ERROR_INVALID_FLAGS,
  500. "Use CP ACP, LCType invalid",
  501. &NumErrors );
  502. //
  503. // Buffer Too Small.
  504. //
  505. // Variation 1 - cbBuf = too small
  506. rc = GetLocaleInfoW( Locale,
  507. LOCALE_ILANGUAGE,
  508. lpLCData,
  509. 2 );
  510. CheckReturnBadParam( rc,
  511. 0,
  512. ERROR_INSUFFICIENT_BUFFER,
  513. "cbBuf too small",
  514. &NumErrors );
  515. //
  516. // Bad locale - Not valid in RC file.
  517. //
  518. // Variation 1 - SLANGUAGE - invalid
  519. rc = GetLocaleInfoW( LANG_INVALID,
  520. LOCALE_SLANGUAGE,
  521. lpLCData,
  522. BUFSIZE );
  523. CheckReturnBadParam( rc,
  524. 0,
  525. ERROR_INVALID_PARAMETER,
  526. "invalid locale - invalid",
  527. &NumErrors );
  528. //
  529. // RETURN_NUMBER flag.
  530. //
  531. // Variation 1 - invalid flags
  532. rc = GetLocaleInfoW( 0x0409,
  533. LOCALE_SLANGUAGE | LOCALE_RETURN_NUMBER,
  534. lpLCData,
  535. BUFSIZE );
  536. CheckReturnBadParam( rc,
  537. 0,
  538. ERROR_INVALID_FLAGS,
  539. "invalid flags - RETURN_NUMBER",
  540. &NumErrors );
  541. // Variation 2 - insufficent buffer
  542. rc = GetLocaleInfoW( 0x0409,
  543. LOCALE_ILANGUAGE | LOCALE_RETURN_NUMBER,
  544. lpLCData,
  545. 1 );
  546. CheckReturnBadParam( rc,
  547. 0,
  548. ERROR_INSUFFICIENT_BUFFER,
  549. "insufficient buffer 1 - RETURN_NUMBER",
  550. &NumErrors );
  551. // Variation 3 - insufficent buffer
  552. rc = GetLocaleInfoW( 0x0409,
  553. LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
  554. lpLCData,
  555. 1 );
  556. CheckReturnBadParam( rc,
  557. 0,
  558. ERROR_INSUFFICIENT_BUFFER,
  559. "insufficient buffer 2 - RETURN_NUMBER",
  560. &NumErrors );
  561. //
  562. // Return total number of errors found.
  563. //
  564. return (NumErrors);
  565. }
  566. ////////////////////////////////////////////////////////////////////////////
  567. //
  568. // GLI_NormalCase
  569. //
  570. // This routine tests the normal cases of the API routine.
  571. //
  572. // 06-14-91 JulieB Created.
  573. ////////////////////////////////////////////////////////////////////////////
  574. int GLI_NormalCase()
  575. {
  576. int NumErrors = 0; // error count - to be returned
  577. int rc; // return code
  578. int ctr; // loop counter
  579. #ifdef PERF
  580. DbgBreakPoint();
  581. #endif
  582. //
  583. // Locales.
  584. //
  585. // Variation 1 - System Default Locale
  586. rc = GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT,
  587. LOCALE_ILANGUAGE,
  588. lpLCData,
  589. BUFSIZE );
  590. CheckReturnEqual( rc,
  591. 0,
  592. "system default locale",
  593. &NumErrors );
  594. // Variation 2 - Current User Locale
  595. rc = GetLocaleInfoW( LOCALE_USER_DEFAULT,
  596. LOCALE_ILANGUAGE,
  597. lpLCData,
  598. BUFSIZE );
  599. CheckReturnEqual( rc,
  600. 0,
  601. "current user locale",
  602. &NumErrors );
  603. //
  604. // Use CP ACP.
  605. //
  606. // Variation 1 - Use CP ACP, System Default Locale
  607. rc = GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT,
  608. LOCALE_USE_CP_ACP | LOCALE_ILANGUAGE,
  609. lpLCData,
  610. BUFSIZE );
  611. CheckReturnEqual( rc,
  612. 0,
  613. "Use CP ACP, system default locale",
  614. &NumErrors );
  615. //
  616. // cbBuf.
  617. //
  618. // Variation 1 - cbBuf = size of lpLCData buffer
  619. rc = GetLocaleInfoW( Locale,
  620. LOCALE_ILANGUAGE,
  621. lpLCData,
  622. BUFSIZE );
  623. CheckReturnValidW( rc,
  624. -1,
  625. lpLCData,
  626. S_ILANGUAGE,
  627. "cbBuf = bufsize",
  628. &NumErrors );
  629. // Variation 2 - cbBuf = 0
  630. lpLCData[0] = 0x0000;
  631. rc = GetLocaleInfoW( Locale,
  632. LOCALE_ILANGUAGE,
  633. lpLCData,
  634. 0 );
  635. CheckReturnValidW( rc,
  636. -1,
  637. NULL,
  638. S_ILANGUAGE,
  639. "cbBuf zero",
  640. &NumErrors );
  641. // Variation 3 - cbBuf = 0, lpLCData = NULL
  642. rc = GetLocaleInfoW( Locale,
  643. LOCALE_ILANGUAGE,
  644. NULL,
  645. 0 );
  646. CheckReturnValidW( rc,
  647. -1,
  648. NULL,
  649. S_ILANGUAGE,
  650. "cbBuf (NULL ptr)",
  651. &NumErrors );
  652. //
  653. // LCTYPE values.
  654. //
  655. for (ctr = 0; ctr < NUM_LOCALE_FLAGS; ctr++)
  656. {
  657. rc = GetLocaleInfoW( Locale,
  658. pLocaleFlag[ctr],
  659. lpLCData,
  660. BUFSIZE );
  661. CheckReturnValidLoopW( rc,
  662. -1,
  663. lpLCData,
  664. pLocaleString[ctr],
  665. "Locale Flag",
  666. pLocaleFlag[ctr],
  667. &NumErrors );
  668. }
  669. //
  670. // RC file - SLANGUAGE and SCOUNTRY.
  671. //
  672. // Variation 1 - SLANGUAGE - Czech
  673. rc = GetLocaleInfoW( 0x0405,
  674. LOCALE_SLANGUAGE,
  675. lpLCData,
  676. BUFSIZE );
  677. CheckReturnValidW( rc,
  678. -1,
  679. lpLCData,
  680. L"Czech",
  681. "SLANGUAGE (Czech)",
  682. &NumErrors );
  683. // Variation 2 - SCOUNTRY - Czech
  684. rc = GetLocaleInfoW( 0x0405,
  685. LOCALE_SCOUNTRY,
  686. lpLCData,
  687. BUFSIZE );
  688. CheckReturnValidW( rc,
  689. -1,
  690. lpLCData,
  691. L"Czech Republic",
  692. "SCOUNTRY (Czech)",
  693. &NumErrors );
  694. // Variation 3 - SCOUNTRY - Slovak
  695. rc = GetLocaleInfoW( 0x041B,
  696. LOCALE_SCOUNTRY,
  697. lpLCData,
  698. BUFSIZE );
  699. CheckReturnValidW( rc,
  700. -1,
  701. lpLCData,
  702. L"Slovakia",
  703. "SCOUNTRY (Slovak)",
  704. &NumErrors );
  705. // Variation 4 - SENGCOUNTRY - Czech
  706. rc = GetLocaleInfoW( 0x0405,
  707. LOCALE_SENGCOUNTRY,
  708. lpLCData,
  709. BUFSIZE );
  710. CheckReturnValidW( rc,
  711. -1,
  712. lpLCData,
  713. L"Czech Republic",
  714. "SENGCOUNTRY (Czech)",
  715. &NumErrors );
  716. // Variation 5 - SENGCOUNTRY - Slovak
  717. rc = GetLocaleInfoW( 0x041B,
  718. LOCALE_SENGCOUNTRY,
  719. lpLCData,
  720. BUFSIZE );
  721. CheckReturnValidW( rc,
  722. -1,
  723. lpLCData,
  724. L"Slovakia",
  725. "SENGCOUNTRY (Slovak)",
  726. &NumErrors );
  727. //
  728. // Language Neutral.
  729. //
  730. // Variation 1 - SLANGUAGE - neutral
  731. rc = GetLocaleInfoW( 0x0000,
  732. LOCALE_SLANGUAGE,
  733. lpLCData,
  734. BUFSIZE );
  735. CheckReturnValidW( rc,
  736. -1,
  737. lpLCData,
  738. S_SLANGUAGE,
  739. "SLANGUAGE (neutral)",
  740. &NumErrors );
  741. // Variation 2 - SLANGUAGE - sys default
  742. rc = GetLocaleInfoW( 0x0400,
  743. LOCALE_SLANGUAGE,
  744. lpLCData,
  745. BUFSIZE );
  746. CheckReturnValidW( rc,
  747. -1,
  748. lpLCData,
  749. S_SLANGUAGE,
  750. "SLANGUAGE (sys default)",
  751. &NumErrors );
  752. // Variation 3 - SLANGUAGE - user default
  753. rc = GetLocaleInfoW( 0x0800,
  754. LOCALE_SLANGUAGE,
  755. lpLCData,
  756. BUFSIZE );
  757. CheckReturnValidW( rc,
  758. -1,
  759. lpLCData,
  760. S_SLANGUAGE,
  761. "SLANGUAGE (user default)",
  762. &NumErrors );
  763. // Variation 4 - SLANGUAGE - sub lang neutral US
  764. rc = GetLocaleInfoW( 0x0009,
  765. LOCALE_SLANGUAGE,
  766. lpLCData,
  767. BUFSIZE );
  768. CheckReturnValidW( rc,
  769. -1,
  770. lpLCData,
  771. S_SLANGUAGE,
  772. "SLANGUAGE (sub lang neutral US)",
  773. &NumErrors );
  774. // Variation 5 - SLANGUAGE - sub lang neutral Czech
  775. rc = GetLocaleInfoW( 0x0005,
  776. LOCALE_SLANGUAGE,
  777. lpLCData,
  778. BUFSIZE );
  779. CheckReturnValidW( rc,
  780. -1,
  781. lpLCData,
  782. L"Czech",
  783. "SLANGUAGE (sub lang neutral Czech)",
  784. &NumErrors );
  785. //
  786. // Test Russian Month Names.
  787. //
  788. // Variation 1 - SMONTHNAME1
  789. rc = GetLocaleInfoW( 0x0419,
  790. LOCALE_SMONTHNAME1,
  791. lpLCData,
  792. BUFSIZE );
  793. CheckReturnValidW( rc,
  794. -1,
  795. lpLCData,
  796. S_SMONTHNAME1_RUSSIAN,
  797. "Russian SMONTHNAME1",
  798. &NumErrors );
  799. // Variation 2 - SMONTHNAME2
  800. rc = GetLocaleInfoW( 0x0419,
  801. LOCALE_SMONTHNAME2,
  802. lpLCData,
  803. BUFSIZE );
  804. CheckReturnValidW( rc,
  805. -1,
  806. lpLCData,
  807. S_SMONTHNAME2_RUSSIAN,
  808. "Russian SMONTHNAME2",
  809. &NumErrors );
  810. //
  811. // Test Font Signature.
  812. //
  813. // Variation 1 - FONTSIGNATURE
  814. rc = GetLocaleInfoW( 0x0409,
  815. LOCALE_FONTSIGNATURE,
  816. lpLCData,
  817. BUFSIZE );
  818. CheckReturnValidW( rc,
  819. 16,
  820. lpLCData,
  821. FONTSIG_ENGLISH,
  822. "English FONTSIGNATURE",
  823. &NumErrors );
  824. // Variation 2 - FONTSIGNATURE
  825. rc = GetLocaleInfoW( 0x0419,
  826. LOCALE_FONTSIGNATURE,
  827. lpLCData,
  828. BUFSIZE );
  829. CheckReturnValidW( rc,
  830. 16,
  831. lpLCData,
  832. FONTSIG_RUSSIAN,
  833. "Russian FONTSIGNATURE",
  834. &NumErrors );
  835. //
  836. // Test Return Number flag.
  837. //
  838. // Variation 1 - RETURN_NUMBER
  839. rc = GetLocaleInfoW( 0x0409,
  840. LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
  841. lpLCData,
  842. BUFSIZE );
  843. CheckReturnValidInt( rc,
  844. 2,
  845. *((LPDWORD)lpLCData),
  846. 1252,
  847. "Return_Number - ansi codepage for 0x0409",
  848. &NumErrors );
  849. rc = GetLocaleInfoW( 0x0409,
  850. LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
  851. NULL,
  852. 0 );
  853. CheckReturnValidInt( rc,
  854. 2,
  855. 1252,
  856. 1252,
  857. "Return_Number - ansi codepage for 0x0409 (no cchData)",
  858. &NumErrors );
  859. // Variation 2 - RETURN_NUMBER
  860. rc = GetLocaleInfoW( 0x041f,
  861. LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
  862. lpLCData,
  863. BUFSIZE );
  864. CheckReturnValidInt( rc,
  865. 2,
  866. *((LPDWORD)lpLCData),
  867. 1254,
  868. "Return_Number - ansi codepage for 0x041f",
  869. &NumErrors );
  870. rc = GetLocaleInfoW( 0x041f,
  871. LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
  872. NULL,
  873. 0 );
  874. CheckReturnValidInt( rc,
  875. 2,
  876. 1254,
  877. 1254,
  878. "Return_Number - ansi codepage for 0x041f (no cchData)",
  879. &NumErrors );
  880. // Variation 3 - RETURN_NUMBER
  881. rc = GetLocaleInfoW( 0x0409,
  882. LOCALE_ILANGUAGE | LOCALE_RETURN_NUMBER,
  883. lpLCData,
  884. BUFSIZE );
  885. CheckReturnValidInt( rc,
  886. 2,
  887. *((LPDWORD)lpLCData),
  888. 0x0409,
  889. "Return_Number - iLanguage",
  890. &NumErrors );
  891. rc = GetLocaleInfoW( 0x0409,
  892. LOCALE_ILANGUAGE | LOCALE_RETURN_NUMBER,
  893. NULL,
  894. 0 );
  895. CheckReturnValidInt( rc,
  896. 2,
  897. 0x0409,
  898. 0x0409,
  899. "Return_Number - iLanguage (no cchData)",
  900. &NumErrors );
  901. //
  902. // Try all INT flags with LOCALE_RETURN_NUMBER flag.
  903. //
  904. for (ctr = 0; ctr < NUM_LOCALE_INT_FLAGS; ctr++)
  905. {
  906. rc = GetLocaleInfoW( 0x0409,
  907. pLocaleIntFlag[ctr] | LOCALE_RETURN_NUMBER,
  908. lpLCData,
  909. BUFSIZE );
  910. CheckReturnValidInt( rc,
  911. 2,
  912. *((LPDWORD)lpLCData),
  913. pLocaleInt[ctr],
  914. "Locale Int Flag",
  915. &NumErrors );
  916. }
  917. //
  918. // Test SSORTNAME.
  919. //
  920. // Variation 1 - SSORTNAME
  921. rc = GetLocaleInfoW( 0x00000407,
  922. LOCALE_SSORTNAME,
  923. lpLCData,
  924. BUFSIZE );
  925. CheckReturnValidW( rc,
  926. -1,
  927. lpLCData,
  928. L"Dictionary",
  929. "SSORTNAME 0x00000407",
  930. &NumErrors );
  931. // Variation 2 - SSORTNAME
  932. rc = GetLocaleInfoW( 0x00010407,
  933. LOCALE_SSORTNAME,
  934. lpLCData,
  935. BUFSIZE );
  936. CheckReturnValidW( rc,
  937. -1,
  938. lpLCData,
  939. L"Phone Book (DIN)",
  940. "SSORTNAME 0x00010407",
  941. &NumErrors );
  942. // Variation 3 - SSORTNAME
  943. rc = GetLocaleInfoW( 0x0000040a,
  944. LOCALE_SSORTNAME,
  945. lpLCData,
  946. BUFSIZE );
  947. CheckReturnValidW( rc,
  948. -1,
  949. lpLCData,
  950. L"Traditional",
  951. "SSORTNAME 0x0000040a",
  952. &NumErrors );
  953. // Variation 4 - SSORTNAME
  954. rc = GetLocaleInfoW( 0x00000c0a,
  955. LOCALE_SSORTNAME,
  956. lpLCData,
  957. BUFSIZE );
  958. CheckReturnValidW( rc,
  959. -1,
  960. lpLCData,
  961. L"International",
  962. "SSORTNAME 0x00000c0a",
  963. &NumErrors );
  964. // Variation 5 - SSORTNAME
  965. rc = GetLocaleInfoW( 0x00000404,
  966. LOCALE_SSORTNAME,
  967. lpLCData,
  968. BUFSIZE );
  969. CheckReturnValidW( rc,
  970. -1,
  971. lpLCData,
  972. L"Stroke Count",
  973. "SSORTNAME 0x00000404",
  974. &NumErrors );
  975. // Variation 7 - SSORTNAME
  976. rc = GetLocaleInfoW( 0x00020404,
  977. LOCALE_SSORTNAME,
  978. lpLCData,
  979. BUFSIZE );
  980. CheckReturnBadParam( rc,
  981. 0,
  982. ERROR_INVALID_PARAMETER,
  983. "SSORTNAME 0x00020404",
  984. &NumErrors );
  985. // Variation 8 - SSORTNAME
  986. rc = GetLocaleInfoW( 0x00000804,
  987. LOCALE_SSORTNAME,
  988. lpLCData,
  989. BUFSIZE );
  990. CheckReturnValidW( rc,
  991. -1,
  992. lpLCData,
  993. L"Pronunciation",
  994. "SSORTNAME 0x00000804",
  995. &NumErrors );
  996. // Variation 10 - SSORTNAME
  997. rc = GetLocaleInfoW( 0x00020804,
  998. LOCALE_SSORTNAME,
  999. lpLCData,
  1000. BUFSIZE );
  1001. CheckReturnValidW( rc,
  1002. -1,
  1003. lpLCData,
  1004. L"Stroke Count",
  1005. "SSORTNAME 0x00020804",
  1006. &NumErrors );
  1007. //
  1008. // Return total number of errors found.
  1009. //
  1010. return (NumErrors);
  1011. }
  1012. ////////////////////////////////////////////////////////////////////////////
  1013. //
  1014. // GLI_Ansi
  1015. //
  1016. // This routine tests the Ansi version of the API routine.
  1017. //
  1018. // 06-14-91 JulieB Created.
  1019. ////////////////////////////////////////////////////////////////////////////
  1020. int GLI_Ansi()
  1021. {
  1022. int NumErrors = 0; // error count - to be returned
  1023. int rc; // return code
  1024. int ctr; // loop counter
  1025. //
  1026. // GetLocaleInfoA.
  1027. //
  1028. // Variation 1 - ILANGUAGE
  1029. rc = GetLocaleInfoA( Locale,
  1030. LOCALE_ILANGUAGE,
  1031. lpLCDataA,
  1032. BUFSIZE );
  1033. CheckReturnValidA( rc,
  1034. -1,
  1035. lpLCDataA,
  1036. "0409",
  1037. NULL,
  1038. "A version ILANGUAGE",
  1039. &NumErrors );
  1040. // Variation 2 - ILANGUAGE
  1041. rc = GetLocaleInfoA( Locale,
  1042. LOCALE_ILANGUAGE,
  1043. NULL,
  1044. 0 );
  1045. CheckReturnValidA( rc,
  1046. -1,
  1047. NULL,
  1048. "0409",
  1049. NULL,
  1050. "A version ILANGUAGE, no Dest",
  1051. &NumErrors );
  1052. // Variation 3 - ILANGUAGE
  1053. rc = GetLocaleInfoA( Locale,
  1054. LOCALE_ILANGUAGE,
  1055. NULL,
  1056. BUFSIZE );
  1057. CheckReturnBadParam( rc,
  1058. 0,
  1059. ERROR_INVALID_PARAMETER,
  1060. "A version bad lpLCData",
  1061. &NumErrors );
  1062. // Variation 4 - SSHORTDATE
  1063. rc = GetLocaleInfoA( Locale,
  1064. LOCALE_SSHORTDATE,
  1065. lpLCDataA,
  1066. BUFSIZE );
  1067. CheckReturnValidA( rc,
  1068. -1,
  1069. lpLCDataA,
  1070. "M/d/yyyy",
  1071. NULL,
  1072. "A version SSHORTDATE",
  1073. &NumErrors );
  1074. // Variation 5 - SSHORTDATE
  1075. rc = GetLocaleInfoA( Locale,
  1076. LOCALE_SSHORTDATE,
  1077. NULL,
  1078. 0 );
  1079. CheckReturnValidA( rc,
  1080. -1,
  1081. NULL,
  1082. "M/d/yyyy",
  1083. NULL,
  1084. "A version SSHORTDATE, no Dest",
  1085. &NumErrors );
  1086. //
  1087. // Use CP ACP.
  1088. //
  1089. // Variation 1 - Use CP ACP, ILANGUAGE
  1090. rc = GetLocaleInfoA( Locale,
  1091. LOCALE_USE_CP_ACP | LOCALE_ILANGUAGE,
  1092. lpLCDataA,
  1093. BUFSIZE );
  1094. CheckReturnValidA( rc,
  1095. -1,
  1096. lpLCDataA,
  1097. "0409",
  1098. NULL,
  1099. "A version Use CP ACP, ILANGUAGE",
  1100. &NumErrors );
  1101. //
  1102. // Make sure the A and W versions set the same error value.
  1103. //
  1104. SetLastError( 0 );
  1105. rc = GetLocaleInfoA( Locale,
  1106. LOCALE_SLIST,
  1107. lpLCDataA,
  1108. -1 );
  1109. CheckReturnBadParam( rc,
  1110. 0,
  1111. ERROR_INVALID_PARAMETER,
  1112. "A and W error returns same - A version",
  1113. &NumErrors );
  1114. SetLastError( 0 );
  1115. rc = GetLocaleInfoW( Locale,
  1116. LOCALE_SLIST,
  1117. lpLCData,
  1118. -1 );
  1119. CheckReturnBadParam( rc,
  1120. 0,
  1121. ERROR_INVALID_PARAMETER,
  1122. "A and W error returns same - W version",
  1123. &NumErrors );
  1124. //
  1125. // Test Font Signature.
  1126. //
  1127. // Variation 1 - FONTSIGNATURE
  1128. rc = GetLocaleInfoA( 0x0409,
  1129. LOCALE_FONTSIGNATURE,
  1130. lpLCDataA,
  1131. BUFSIZE );
  1132. CheckReturnValidA( rc,
  1133. 32,
  1134. lpLCDataA,
  1135. FONTSIG_ENGLISH_A,
  1136. NULL,
  1137. "A Version English FONTSIGNATURE",
  1138. &NumErrors );
  1139. // Variation 2 - FONTSIGNATURE
  1140. rc = GetLocaleInfoA( 0x0419,
  1141. LOCALE_FONTSIGNATURE,
  1142. lpLCDataA,
  1143. BUFSIZE );
  1144. CheckReturnValidA( rc,
  1145. 32,
  1146. lpLCDataA,
  1147. FONTSIG_RUSSIAN_A,
  1148. NULL,
  1149. "A Version Russian FONTSIGNATURE",
  1150. &NumErrors );
  1151. //
  1152. // Test Return Number flag.
  1153. //
  1154. // Variation 1 - RETURN_NUMBER
  1155. rc = GetLocaleInfoA( 0x0409,
  1156. LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
  1157. lpLCDataA,
  1158. BUFSIZE );
  1159. CheckReturnValidInt( rc,
  1160. 4,
  1161. *((LPDWORD)lpLCDataA),
  1162. 1252,
  1163. "A Version Return_Number - ansi codepage for 0x0409",
  1164. &NumErrors );
  1165. rc = GetLocaleInfoA( 0x0409,
  1166. LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
  1167. NULL,
  1168. 0 );
  1169. CheckReturnValidInt( rc,
  1170. 4,
  1171. 1252,
  1172. 1252,
  1173. "A Version Return_Number - ansi codepage for 0x0409 (no cchData)",
  1174. &NumErrors );
  1175. // Variation 2 - RETURN_NUMBER
  1176. rc = GetLocaleInfoA( 0x041f,
  1177. LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
  1178. lpLCDataA,
  1179. BUFSIZE );
  1180. CheckReturnValidInt( rc,
  1181. 4,
  1182. *((LPDWORD)lpLCDataA),
  1183. 1254,
  1184. "A Version Return_Number - ansi codepage for 0x041f",
  1185. &NumErrors );
  1186. rc = GetLocaleInfoA( 0x041f,
  1187. LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
  1188. NULL,
  1189. 0 );
  1190. CheckReturnValidInt( rc,
  1191. 4,
  1192. 1254,
  1193. 1254,
  1194. "A Version Return_Number - ansi codepage for 0x041f (no cchData)",
  1195. &NumErrors );
  1196. // Variation 3 - RETURN_NUMBER
  1197. rc = GetLocaleInfoA( 0x0409,
  1198. LOCALE_ILANGUAGE | LOCALE_RETURN_NUMBER,
  1199. lpLCDataA,
  1200. BUFSIZE );
  1201. CheckReturnValidInt( rc,
  1202. 4,
  1203. *((LPDWORD)lpLCDataA),
  1204. 0x0409,
  1205. "A Version Return_Number - iLanguage",
  1206. &NumErrors );
  1207. rc = GetLocaleInfoA( 0x0409,
  1208. LOCALE_ILANGUAGE | LOCALE_RETURN_NUMBER,
  1209. NULL,
  1210. 0 );
  1211. CheckReturnValidInt( rc,
  1212. 4,
  1213. 0x0409,
  1214. 0x0409,
  1215. "A Version Return_Number - iLanguage (no cchData)",
  1216. &NumErrors );
  1217. //
  1218. // Try all INT flags with LOCALE_RETURN_NUMBER flag.
  1219. //
  1220. for (ctr = 0; ctr < NUM_LOCALE_INT_FLAGS; ctr++)
  1221. {
  1222. rc = GetLocaleInfoA( 0x0409,
  1223. pLocaleIntFlag[ctr] | LOCALE_RETURN_NUMBER,
  1224. lpLCDataA,
  1225. BUFSIZE );
  1226. CheckReturnValidInt( rc,
  1227. 4,
  1228. *((LPDWORD)lpLCDataA),
  1229. pLocaleInt[ctr],
  1230. "A Version Locale Int Flag",
  1231. &NumErrors );
  1232. }
  1233. //
  1234. // Test SSORTNAME.
  1235. //
  1236. // Variation 1 - SSORTNAME
  1237. rc = GetLocaleInfoA( 0x00000407,
  1238. LOCALE_SSORTNAME,
  1239. lpLCDataA,
  1240. BUFSIZE );
  1241. CheckReturnValidA( rc,
  1242. -1,
  1243. lpLCDataA,
  1244. "Dictionary",
  1245. NULL,
  1246. "A version SSORTNAME 0x00000407",
  1247. &NumErrors );
  1248. // Variation 2 - SSORTNAME
  1249. rc = GetLocaleInfoA( 0x00010407,
  1250. LOCALE_SSORTNAME,
  1251. lpLCDataA,
  1252. BUFSIZE );
  1253. CheckReturnValidA( rc,
  1254. -1,
  1255. lpLCDataA,
  1256. "Phone Book (DIN)",
  1257. NULL,
  1258. "A version SSORTNAME 0x00010407",
  1259. &NumErrors );
  1260. // Variation 3 - SSORTNAME
  1261. rc = GetLocaleInfoA( 0x0000040a,
  1262. LOCALE_SSORTNAME,
  1263. lpLCDataA,
  1264. BUFSIZE );
  1265. CheckReturnValidA( rc,
  1266. -1,
  1267. lpLCDataA,
  1268. "Traditional",
  1269. NULL,
  1270. "A version SSORTNAME 0x0000040a",
  1271. &NumErrors );
  1272. // Variation 4 - SSORTNAME
  1273. rc = GetLocaleInfoA( 0x00000c0a,
  1274. LOCALE_SSORTNAME,
  1275. lpLCDataA,
  1276. BUFSIZE );
  1277. CheckReturnValidA( rc,
  1278. -1,
  1279. lpLCDataA,
  1280. "International",
  1281. NULL,
  1282. "A version SSORTNAME 0x00000c0a",
  1283. &NumErrors );
  1284. // Variation 5 - SSORTNAME
  1285. rc = GetLocaleInfoA( 0x00000404,
  1286. LOCALE_SSORTNAME,
  1287. lpLCDataA,
  1288. BUFSIZE );
  1289. CheckReturnValidA( rc,
  1290. -1,
  1291. lpLCDataA,
  1292. "Stroke Count",
  1293. NULL,
  1294. "A version SSORTNAME 0x00000404",
  1295. &NumErrors );
  1296. // Variation 7 - SSORTNAME
  1297. rc = GetLocaleInfoA( 0x00020404,
  1298. LOCALE_SSORTNAME,
  1299. lpLCDataA,
  1300. BUFSIZE );
  1301. CheckReturnBadParam( rc,
  1302. 0,
  1303. ERROR_INVALID_PARAMETER,
  1304. "A version SSORTNAME 0x00020404",
  1305. &NumErrors );
  1306. // Variation 8 - SSORTNAME
  1307. rc = GetLocaleInfoA( 0x00000804,
  1308. LOCALE_SSORTNAME,
  1309. lpLCDataA,
  1310. BUFSIZE );
  1311. CheckReturnValidA( rc,
  1312. -1,
  1313. lpLCDataA,
  1314. "Pronunciation",
  1315. NULL,
  1316. "A version SSORTNAME 0x00000804",
  1317. &NumErrors );
  1318. // Variation 10 - SSORTNAME
  1319. rc = GetLocaleInfoA( 0x00020804,
  1320. LOCALE_SSORTNAME,
  1321. lpLCDataA,
  1322. BUFSIZE );
  1323. CheckReturnValidA( rc,
  1324. -1,
  1325. lpLCDataA,
  1326. "Stroke Count",
  1327. NULL,
  1328. "A version SSORTNAME 0x00020804",
  1329. &NumErrors );
  1330. //
  1331. // Return total number of errors found.
  1332. //
  1333. return (NumErrors);
  1334. }
  1335. ////////////////////////////////////////////////////////////////////////////
  1336. //
  1337. // VER_NormalCase
  1338. //
  1339. // This routine tests the normal cases of the VERSION API routines.
  1340. //
  1341. // 06-14-91 JulieB Created.
  1342. ////////////////////////////////////////////////////////////////////////////
  1343. int VER_NormalCase()
  1344. {
  1345. int NumErrors = 0; // error count - to be returned
  1346. int rc; // return code
  1347. BYTE pVersionA[BUFSIZE]; // byte buffer for string
  1348. WCHAR pVersionW[BUFSIZE]; // word buffer for string
  1349. //
  1350. // VerLanguageNameW
  1351. //
  1352. // Variation 1 - U.S.
  1353. rc = VerLanguageNameW( 0x0409,
  1354. pVersionW,
  1355. BUFSIZE );
  1356. CheckReturnValidW( rc,
  1357. 23,
  1358. pVersionW,
  1359. L"English (United States)",
  1360. "VerLanguageNameW (US)",
  1361. &NumErrors );
  1362. // Variation 2 - Czech
  1363. rc = VerLanguageNameW( 0x0405,
  1364. pVersionW,
  1365. BUFSIZE );
  1366. CheckReturnValidW( rc,
  1367. 5,
  1368. pVersionW,
  1369. L"Czech",
  1370. "VerLanguageNameW (Czech)",
  1371. &NumErrors );
  1372. //
  1373. // VerLanguageNameA
  1374. //
  1375. // Variation 1 - U.S.
  1376. rc = VerLanguageNameA( 0x0409,
  1377. pVersionA,
  1378. BUFSIZE );
  1379. CheckReturnValidA( rc,
  1380. 23,
  1381. pVersionA,
  1382. "English (United States)",
  1383. NULL,
  1384. "VerLanguageNameA (US)",
  1385. &NumErrors );
  1386. // Variation 2 - Czech
  1387. rc = VerLanguageNameA( 0x0405,
  1388. pVersionA,
  1389. BUFSIZE );
  1390. CheckReturnValidA( rc,
  1391. 5,
  1392. pVersionA,
  1393. "Czech",
  1394. NULL,
  1395. "VerLanguageNameA (Czech)",
  1396. &NumErrors );
  1397. //
  1398. // Bad locale - Not valid in RC file.
  1399. //
  1400. // Variation 1 - SLANGUAGE - invalid (W)
  1401. rc = VerLanguageNameW( LANG_INVALID,
  1402. pVersionW,
  1403. BUFSIZE );
  1404. CheckReturnValidW( rc,
  1405. 16,
  1406. pVersionW,
  1407. L"Language Neutral",
  1408. "VerLanguageNameW (invalid)",
  1409. &NumErrors );
  1410. // Variation 2 - SLANGUAGE - invalid (A)
  1411. rc = VerLanguageNameA( LANG_INVALID,
  1412. pVersionA,
  1413. BUFSIZE );
  1414. CheckReturnValidA( rc,
  1415. 16,
  1416. pVersionA,
  1417. "Language Neutral",
  1418. NULL,
  1419. "VerLanguageNameA (invalid)",
  1420. &NumErrors );
  1421. //
  1422. // Invalid parameters.
  1423. //
  1424. // Variation 1 - wSize - invalid (W)
  1425. pVersionW[0] = 0;
  1426. rc = VerLanguageNameW( 0x0409,
  1427. pVersionW,
  1428. 0 );
  1429. CheckReturnValidW( rc,
  1430. 0,
  1431. NULL,
  1432. NULL,
  1433. "VerLanguageNameW (invalid size)",
  1434. &NumErrors );
  1435. // Variation 2 - wSize - invalid (A)
  1436. pVersionA[0] = 0;
  1437. rc = VerLanguageNameA( 0x0409,
  1438. pVersionA,
  1439. 0 );
  1440. CheckReturnValidA( rc,
  1441. 0,
  1442. NULL,
  1443. NULL,
  1444. NULL,
  1445. "VerLanguageNameA (invalid size)",
  1446. &NumErrors );
  1447. // Variation 3 - szLang - invalid (W)
  1448. rc = VerLanguageNameW( 0x0409,
  1449. NULL,
  1450. BUFSIZE );
  1451. CheckReturnValidW( rc,
  1452. 0,
  1453. NULL,
  1454. NULL,
  1455. "VerLanguageNameW (invalid buffer)",
  1456. &NumErrors );
  1457. // Variation 4 - szLang - invalid (A)
  1458. pVersionA[0] = 0;
  1459. rc = VerLanguageNameA( 0x0409,
  1460. NULL,
  1461. BUFSIZE );
  1462. CheckReturnValidA( rc,
  1463. 0,
  1464. NULL,
  1465. NULL,
  1466. NULL,
  1467. "VerLanguageNameA (invalid buffer)",
  1468. &NumErrors );
  1469. //
  1470. // Return total number of errors found.
  1471. //
  1472. return (NumErrors);
  1473. }