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.

71 lines
1.3 KiB

  1. #include "headers.hxx"
  2. #include "..\dspecup.hpp"
  3. #include <windows.h>
  4. void stepIt(long arg, void *vTotal)
  5. {
  6. long *total=(long *)vTotal;
  7. printf("\r" "\r%ld",(*total)+=arg);
  8. }
  9. void totalSteps(long arg, void *vTotal)
  10. {
  11. long *total=(long *)vTotal;
  12. *total=0;
  13. printf("\n%ld\n",arg);
  14. }
  15. void __cdecl wmain(int argc,wchar_t *argv[])
  16. {
  17. char *usage;
  18. usage="\nYou should pass one or more guids to specify the operation(s).\n "
  19. "Ex: test.exe 4444c516-f43a-4c12-9c4b-b5c064941d61 ffa5ee3c-1405-476d"
  20. "-b344-7ad37d69cc25\n";
  21. if(argc<2) {printf(usage);return;}
  22. GUID guid;
  23. long total=0;
  24. HRESULT hr=S_OK;
  25. wchar_t curDir[MAX_PATH+1];
  26. GetCurrentDirectory(MAX_PATH,curDir);
  27. PWSTR errorMsg=NULL;
  28. do
  29. {
  30. for(int cont=1;cont<argc;cont++)
  31. {
  32. if(UuidFromString(argv[cont],&guid)!=RPC_S_OK) {printf(usage);return;}
  33. hr=UpgradeDisplaySpecifiers
  34. (
  35. curDir,
  36. &guid,
  37. false,
  38. &errorMsg,
  39. &total,
  40. stepIt,
  41. totalSteps
  42. );
  43. if(FAILED(hr)) break;
  44. }
  45. } while(0);
  46. if(FAILED(hr))
  47. {
  48. if(errorMsg!=NULL)
  49. {
  50. wprintf(L"%s\n",errorMsg);
  51. LocalFree(errorMsg);
  52. }
  53. }
  54. }