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.

132 lines
2.6 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. migid.c
  5. Abstract:
  6. Implements a small program that loads a migration DLL and prints
  7. its vendor info.
  8. Author:
  9. <full name> (<alias>) <date>
  10. Revision History:
  11. <alias> <date> <comments>
  12. --*/
  13. #include "pch.h"
  14. VOID
  15. HelpAndExit (
  16. VOID
  17. )
  18. {
  19. printf ("Command Line Syntax:\n\n"
  20. "migid [directory]\n\n"
  21. "directory - Specifies the directory migrate.dll is in.\n"
  22. " If not specified, the current directory is\n"
  23. " used.\n"
  24. );
  25. exit (1);
  26. }
  27. INT
  28. __cdecl
  29. main (
  30. INT argc,
  31. CHAR *argv[]
  32. )
  33. {
  34. HANDLE Library;
  35. TCHAR Path[MAX_TCHAR_PATH];
  36. DWORD d;
  37. P_QUERY_VERSION QueryVersion;
  38. PCSTR ProductID = NULL;
  39. UINT DllVersion = 0;
  40. PINT CodePageArray;
  41. PCSTR ExeNamesBuf;
  42. PVENDORINFO VendorInfo = NULL;
  43. BOOL SpecCompliant = TRUE;
  44. if (argc == 0 || argc > 2) {
  45. HelpAndExit();
  46. }
  47. if (argc == 2) {
  48. d = GetFileAttributes (argv[1]);
  49. if (d == INVALID_ATTRIBUTES) {
  50. HelpAndExit();
  51. }
  52. if (!(d & FILE_ATTRIBUTE_DIRECTORY)) {
  53. HelpAndExit();
  54. }
  55. lstrcpy (Path, argv[1]);
  56. lstrcat (Path, TEXT("\\"));
  57. } else {
  58. lstrcpy (Path, TEXT(".\\"));
  59. }
  60. lstrcat (Path, TEXT("migrate.dll"));
  61. Library = LoadLibrary (Path);
  62. if (!Library) {
  63. fprintf (stderr, "Can't open %s\n", Path);
  64. return 1;
  65. }
  66. (FARPROC) QueryVersion = GetProcAddress (Library, "QueryVersion");
  67. if (!QueryVersion) {
  68. fprintf (stderr, "%s is not spec-compliant\n", Path);
  69. return 1;
  70. }
  71. __try {
  72. QueryVersion (&ProductID, &DllVersion, &CodePageArray, &ExeNamesBuf, &VendorInfo);
  73. if (!ProductID || !VendorInfo) {
  74. SpecCompliant = FALSE;
  75. }
  76. printf ("Product ID: %s\n"
  77. "DLL Version: %u\n"
  78. "Company Name: %s\n"
  79. "Support Number: %s\n"
  80. "Support URL: %s\n"
  81. "Failure Help: %s\n",
  82. ProductID ? ProductID : "(nul)",
  83. DllVersion,
  84. VendorInfo ? VendorInfo->CompanyName : "(nul)",
  85. VendorInfo ? VendorInfo->SupportNumber : "(nul)",
  86. VendorInfo ? VendorInfo->SupportUrl : "(nul)",
  87. VendorInfo ? VendorInfo->InstructionsToUser : "(nul)"
  88. );
  89. }
  90. __except (TRUE) {
  91. SpecCompliant = FALSE;
  92. }
  93. if (!SpecCompliant) {
  94. fprintf (stderr, "%s is not spec-compliant\n", Path);
  95. return 1;
  96. }
  97. return 0;
  98. }