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.

265 lines
4.7 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. loctool.c
  5. Abstract:
  6. Loctool provides a platform for various localized version testing.
  7. Author:
  8. Marc R. Whitten (marcw) 24-Mar-1999
  9. Revision History:
  10. <full name> (<alias>) <date> <comments>
  11. --*/
  12. #include "pch.h"
  13. HANDLE g_hHeap;
  14. HINSTANCE g_hInst;
  15. BOOL WINAPI MigUtil_Entry (HINSTANCE, DWORD, PVOID);
  16. BOOL
  17. pCallEntryPoints (
  18. DWORD Reason
  19. )
  20. {
  21. HINSTANCE Instance;
  22. //
  23. // Simulate DllMain
  24. //
  25. Instance = g_hInst;
  26. //
  27. // Initialize the common libs
  28. //
  29. if (!MigUtil_Entry (Instance, Reason, NULL)) {
  30. return FALSE;
  31. }
  32. //
  33. // TODO: Add others here if needed (don't forget to prototype above)
  34. //
  35. return TRUE;
  36. }
  37. BOOL
  38. Init (
  39. VOID
  40. )
  41. {
  42. g_hHeap = GetProcessHeap();
  43. g_hInst = GetModuleHandle (NULL);
  44. return pCallEntryPoints (DLL_PROCESS_ATTACH);
  45. }
  46. VOID
  47. Terminate (
  48. VOID
  49. )
  50. {
  51. pCallEntryPoints (DLL_PROCESS_DETACH);
  52. }
  53. VOID
  54. HelpAndExit (
  55. VOID
  56. )
  57. {
  58. //
  59. // This routine is called whenever command line args are wrong
  60. //
  61. _ftprintf (
  62. stderr,
  63. TEXT("Command Line Syntax:\n\n")
  64. //
  65. // TODO: Describe command line syntax(es), indent 2 spaces
  66. //
  67. TEXT(" cmntool [/F:file]\n")
  68. TEXT("\nDescription:\n\n")
  69. //
  70. // TODO: Describe tool, indent 2 spaces
  71. //
  72. TEXT(" cmntool is a stub!\n")
  73. TEXT("\nArguments:\n\n")
  74. //
  75. // TODO: Describe args, indent 2 spaces, say optional if necessary
  76. //
  77. TEXT(" /F Specifies optional file name\n")
  78. );
  79. exit (1);
  80. }
  81. INT
  82. __cdecl
  83. _tmain (
  84. INT argc,
  85. PCTSTR argv[]
  86. )
  87. {
  88. INT i;
  89. PCTSTR FileArg;
  90. HKEY key;
  91. PTSTR p;
  92. TCHAR buffer[MEMDB_MAX];
  93. //
  94. // TODO: Parse command line here
  95. //
  96. for (i = 1 ; i < argc ; i++) {
  97. if (argv[i][0] == TEXT('/') || argv[i][0] == TEXT('-')) {
  98. switch (_totlower (_tcsnextc (&argv[i][1]))) {
  99. case TEXT('f'):
  100. //
  101. // Sample option - /f:file
  102. //
  103. if (argv[i][2] == TEXT(':')) {
  104. FileArg = &argv[i][3];
  105. } else if (i + 1 < argc) {
  106. FileArg = argv[++i];
  107. } else {
  108. HelpAndExit();
  109. }
  110. break;
  111. default:
  112. HelpAndExit();
  113. }
  114. } else {
  115. //
  116. // Parse other args that don't require / or -
  117. //
  118. // None
  119. HelpAndExit();
  120. }
  121. }
  122. //
  123. // Begin processing
  124. //
  125. if (!Init()) {
  126. return 0;
  127. }
  128. printf (
  129. "GetKeyboardType (0) : %u\n"
  130. "GetKeyboardType (1) : %u\n",
  131. GetKeyboardType(0),
  132. GetKeyboardType(1)
  133. );
  134. printf ("ACP: %u\n", GetACP ());
  135. printf (
  136. "Version Info:\n"
  137. "MajorVersion: %u\n"
  138. "MinorVersion: %u\n"
  139. "Build (High/Low): %u (%u/%u)\n"
  140. "PlatformID %u\n"
  141. "VerString %s\n",
  142. g_OsInfo.dwMajorVersion,
  143. g_OsInfo.dwMinorVersion,
  144. g_OsInfo.dwBuildNumber,
  145. HIWORD(g_OsInfo.dwBuildNumber),
  146. LOWORD(g_OsInfo.dwBuildNumber),
  147. g_OsInfo.dwPlatformId,
  148. g_OsInfo.szCSDVersion
  149. );
  150. printf ("Build: %u/%u\n", HIWORD(g_OsInfo.dwBuildNumber), LOWORD(g_OsInfo.dwBuildNumber));
  151. key = OpenRegKeyStr ("HKCU\\Control Panel\\desktop\\ResourceLocale");
  152. if (key) {
  153. p = GetRegValueString (key, "");
  154. CloseRegKey (key);
  155. }
  156. printf ("Default locale (registry): %s\n", p);
  157. GetLocaleInfo (
  158. LOCALE_SYSTEM_DEFAULT,
  159. LOCALE_IDEFAULTLANGUAGE,
  160. buffer,
  161. MEMDB_MAX
  162. );
  163. printf ("LOCALE_SYSTEM_DEFAULT: %s\n", buffer);
  164. GetLocaleInfo (
  165. LOCALE_USER_DEFAULT,
  166. LOCALE_IDEFAULTLANGUAGE,
  167. buffer,
  168. MEMDB_MAX
  169. );
  170. printf ("LOCALE_USER_DEFAULT: %s\n", buffer);
  171. GetLocaleInfo (
  172. LOCALE_SYSTEM_DEFAULT,
  173. LOCALE_IDEFAULTCODEPAGE,
  174. buffer,
  175. MEMDB_MAX
  176. );
  177. printf ("IDEFAULTCODEPAGE: %s\n", buffer);
  178. GetLocaleInfo (
  179. LOCALE_SYSTEM_DEFAULT,
  180. LOCALE_IDEFAULTANSICODEPAGE,
  181. buffer,
  182. MEMDB_MAX
  183. );
  184. printf ("IDEFAULTANSICODEPAGE: %s\n", buffer);
  185. //
  186. // End of processing
  187. //
  188. Terminate();
  189. return 0;
  190. }