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.

99 lines
2.5 KiB

  1. //*********************************************************************
  2. //* Microsoft Windows **
  3. //* Copyright (c) 1994-1998 Microsoft Corporation
  4. //*********************************************************************
  5. //
  6. // CALLOUT.C - Functions to call out to external components to install
  7. // devices
  8. //
  9. // HISTORY:
  10. //
  11. // 11/27/94 jeremys Created.
  12. // 96/03/24 markdu Replaced memset with ZeroMemory for consistency.
  13. //
  14. #include "wizard.h"
  15. // global variables
  16. static const char c_szModemCPL[] = "rundll32.exe Shell32.dll,Control_RunDLL modem.cpl,,add";
  17. /*******************************************************************
  18. NAME: InvokeModemWizard
  19. SYNOPSIS: Starts the modem install wizard
  20. ENTRY: hwndToHide - this window, if non-NULL, will be hidden while
  21. the modem CPL runs
  22. EXIT: ERROR_SUCCESS if successful, or a standard error code
  23. NOTES: launches RUNDLL32 as a process to run the modem wizard.
  24. Blocks on the completion of that process before returning.
  25. hwndToHide is not necessarily the calling window!
  26. For instance, in a property sheet hwndToHide should not be the
  27. dialog (hDlg), but GetParent(hDlg) so that we hide the property
  28. sheet itself instead of just the current page.
  29. ********************************************************************/
  30. UINT InvokeModemWizard(HWND hwndToHide)
  31. {
  32. BOOL bSleepNeeded = FALSE;
  33. if (TRUE == IsNT())
  34. {
  35. BOOL bNeedsStart;
  36. //
  37. // Call into icfg32 dll
  38. //
  39. if (NULL != lpIcfgInstallModem)
  40. {
  41. lpIcfgInstallModem(hwndToHide, 0L, &bNeedsStart);
  42. return ERROR_SUCCESS;
  43. }
  44. else
  45. return ERROR_GEN_FAILURE;
  46. }
  47. else
  48. {
  49. PROCESS_INFORMATION pi;
  50. BOOL fRet;
  51. STARTUPINFO sti;
  52. UINT err = ERROR_SUCCESS;
  53. CHAR szWindowTitle[255];
  54. ZeroMemory(&sti,sizeof(STARTUPINFO));
  55. sti.cb = sizeof(STARTUPINFO);
  56. // run the modem wizard
  57. fRet = CreateProcess(NULL, (LPSTR)c_szModemCPL,
  58. NULL, NULL, FALSE, 0, NULL, NULL,
  59. &sti, &pi);
  60. if (fRet)
  61. {
  62. CloseHandle(pi.hThread);
  63. // wait for the modem wizard process to complete
  64. MsgWaitForMultipleObjectsLoop(pi.hProcess);
  65. CloseHandle(pi.hProcess);
  66. }
  67. else
  68. err = GetLastError();
  69. // show the parent window again
  70. if (hwndToHide)
  71. {
  72. ShowWindow(hwndToHide,SW_SHOW);
  73. }
  74. return err;
  75. }
  76. }