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.

127 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. basewin.c
  5. Abstract:
  6. Program to run BaseWinOptions for a given inf file.
  7. Author:
  8. Ted Miller (tedm) 27-Sep-1995
  9. Revision History:
  10. Andrew Ritz (AndrewR) 13-Mar-2000 -- retool to call into syssetup export
  11. since basewinoptions is obsolete
  12. --*/
  13. #include <windows.h>
  14. #include <tchar.h>
  15. #include <setupapi.h>
  16. #include <stdio.h>
  17. #include "setuplog.h"
  18. #include "sputils.h"
  19. VOID
  20. InitializeSetupLog(
  21. IN PSETUPLOG_CONTEXT Context
  22. );
  23. VOID
  24. TerminateSetupLog(
  25. IN PSETUPLOG_CONTEXT Context
  26. );
  27. BOOL
  28. DoInstallComponentInfs(
  29. IN HWND hwndParent,
  30. IN HWND hProgress, OPTIONAL
  31. IN UINT ProgressMessage,
  32. IN HINF InfHandle,
  33. IN PCWSTR InfSection
  34. );
  35. VOID
  36. Usage(
  37. VOID
  38. )
  39. {
  40. _tprintf(TEXT("basewin installs the components in the specified inf\n"));
  41. _tprintf(TEXT("Usage: basewin <inf name> <section name>\n"));
  42. }
  43. VOID
  44. __cdecl
  45. main(
  46. IN int argc,
  47. IN char *argv[]
  48. )
  49. {
  50. PWSTR InfName;
  51. PWSTR SectionName;
  52. HINF InfHandle;
  53. BOOL b;
  54. SETUPLOG_CONTEXT Context;
  55. if(argc != 3) {
  56. Usage();
  57. goto c0;
  58. }
  59. if(!pSetupInitializeUtils()) {
  60. printf("Initialize failed\n");
  61. goto c0;
  62. }
  63. InitializeSetupLog(&Context);
  64. InfName = pSetupAnsiToUnicode(argv[1]);
  65. if(!InfName) {
  66. printf("Unable to convert %s to unicode\n",argv[1]);
  67. goto c1;
  68. }
  69. SectionName = pSetupAnsiToUnicode(argv[2]);
  70. if (!SectionName) {
  71. printf("Unable to convert %s to unicode\n",argv[2]);
  72. goto c2;
  73. }
  74. InfHandle = SetupOpenInfFile(InfName,NULL,INF_STYLE_WIN4,NULL);
  75. if(InfHandle == INVALID_HANDLE_VALUE) {
  76. printf("Unable to open inf %s\n",argv[1]);
  77. goto c3;
  78. }
  79. b = DoInstallComponentInfs(
  80. NULL,
  81. NULL,
  82. 0,
  83. InfHandle,
  84. SectionName);
  85. _tprintf(TEXT("DoInstallComponentInfs returns %s\n"),b? TEXT("TRUE") : TEXT("FALSE"));
  86. TerminateSetupLog(&Context);
  87. SetupCloseInfFile(InfHandle);
  88. c3:
  89. pSetupFree(SectionName);
  90. c2:
  91. pSetupFree(InfName);
  92. c1:
  93. pSetupUninitializeUtils();
  94. c0:
  95. return;
  96. }