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.

86 lines
1.4 KiB

  1. #include "headers.hxx"
  2. #include "..\dspecup.hpp"
  3. const wchar_t* RUNTIME_NAME = L"dspecup";
  4. Popup popup(L"dspecup.lib", false);
  5. DWORD DEFAULT_LOGGING_OPTIONS =
  6. Log::OUTPUT_TO_FILE
  7. | Log::OUTPUT_FUNCCALLS
  8. | Log::OUTPUT_LOGS
  9. | Log::OUTPUT_ERRORS
  10. | Log::OUTPUT_HEADER;
  11. HINSTANCE hResourceModuleHandle = 0;
  12. long total;
  13. void stepIt(long arg, void *)
  14. {
  15. printf("\r" "\r%ld",total+=arg);
  16. }
  17. void totalSteps(long arg, void *)
  18. {
  19. total=0;
  20. printf("\n%ld\n",arg);
  21. }
  22. void PrintError(HRESULT hr,
  23. const String &message)
  24. {
  25. LOG_FUNCTION(PrintError);
  26. if(hr==E_FAIL)
  27. {
  28. wprintf(L"%s\n",message.c_str());
  29. }
  30. else
  31. {
  32. if(message.empty())
  33. {
  34. wprintf(L"%s\n",GetErrorMessage(hr).c_str());
  35. }
  36. else
  37. {
  38. wprintf(L"%s\n",message.c_str());
  39. wprintf(L"%s\n",GetErrorMessage(hr).c_str());
  40. }
  41. }
  42. }
  43. int _cdecl main()
  44. {
  45. hResourceModuleHandle=::GetModuleHandle(NULL);
  46. HRESULT hr;
  47. hr = ::CoInitialize(0);
  48. ASSERT(SUCCEEDED(hr));
  49. PWSTR errorMsg=NULL;
  50. do
  51. {
  52. hr=UpgradeDisplaySpecifiers(false,&errorMsg,NULL,stepIt,totalSteps);
  53. BREAK_ON_FAILED_HRESULT(hr);
  54. } while(0);
  55. CoUninitialize();
  56. if(FAILED(hr))
  57. {
  58. String error;
  59. if(errorMsg!=NULL)
  60. {
  61. error=errorMsg;
  62. CoTaskMemFree(errorMsg);
  63. }
  64. PrintError(hr,error);
  65. }
  66. return 0;
  67. }