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.

89 lines
2.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows NT Security
  4. // Copyright (C) Microsoft Corporation, 1992 - 1999
  5. //
  6. // File: acui.cpp
  7. //
  8. // Contents: Entry point for the Authenticode UI Provider
  9. //
  10. // History: 08-May-97 kirtd Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #include <stdpch.h>
  14. //+---------------------------------------------------------------------------
  15. //
  16. // Function: ACUIProviderInvokeUI
  17. //
  18. // Synopsis: Authenticode UI invokation entry point (see acui.h)
  19. //
  20. // Arguments: [pInvokeInfo] -- ACUI invoke information
  21. //
  22. // Returns: S_OK if the subject is trusted
  23. // TRUST_E_SUBJECT_NOT_TRUSTED if the subject is not trusted
  24. // Any other valid HRESULT
  25. //
  26. // Notes:
  27. //
  28. //----------------------------------------------------------------------------
  29. HRESULT WINAPI ACUIProviderInvokeUI (PACUI_INVOKE_INFO pInvokeInfo)
  30. {
  31. HRESULT hr;
  32. HWND hDisplay;
  33. //
  34. // Initialize rich edit control DLL
  35. //
  36. if ( LoadLibrary(TEXT("riched32.dll")) == NULL )
  37. {
  38. return( E_FAIL );
  39. }
  40. //
  41. // Validate the invoke info structure
  42. //
  43. if (!(pInvokeInfo) ||
  44. !(WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(ACUI_INVOKE_INFO, pInvokeInfo->cbSize, pPersonalTrustDB)))
  45. {
  46. return( E_INVALIDARG );
  47. }
  48. //
  49. // Pull out the display window handle and make sure it's valid
  50. //
  51. hDisplay = pInvokeInfo->hDisplay;
  52. if ( hDisplay == NULL )
  53. {
  54. if ( (hDisplay = GetDesktopWindow()) == NULL )
  55. {
  56. return( HRESULT_FROM_WIN32(GetLastError()) );
  57. }
  58. }
  59. //
  60. // Instantiate an invoke helper
  61. //
  62. CInvokeInfoHelper iih(pInvokeInfo, hr);
  63. IACUIControl* pUI = NULL;
  64. if ( hr != S_OK )
  65. {
  66. return( hr );
  67. }
  68. //
  69. // Get the UI control and invoke the UI
  70. //
  71. hr = iih.GetUIControl(&pUI);
  72. if ( hr == S_OK )
  73. {
  74. hr = pUI->InvokeUI(hDisplay);
  75. iih.ReleaseUIControl(pUI);
  76. }
  77. return( hr );
  78. }