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.

53 lines
1.5 KiB

  1. // Tweak the CABINETSTATE to disable name pretification by Diz
  2. // Syntax: pretty.exe [option]
  3. // on enables name prettification
  4. // off disables name pretification
  5. // help, ? display help text
  6. // [none] displays the current state
  7. #include "windows.h"
  8. #include "windowsx.h"
  9. #include "winuserp.h"
  10. #include "shlobj.h"
  11. #include "shellapi.h"
  12. #include "shlobjp.h"
  13. #include "stdio.h"
  14. int _cdecl main(int iArgC, LPTSTR pArgs[])
  15. {
  16. CABINETSTATE cs;
  17. LPTSTR pArg = pArg=pArgs[1];
  18. BOOL fOldDontPrettyNames;
  19. ReadCabinetState(&cs, sizeof(cs));
  20. fOldDontPrettyNames = cs.fDontPrettyNames;
  21. if (iArgC > 1)
  22. {
  23. if (*pArg==TEXT('-') || *pArg==TEXT('/'))
  24. pArg++;
  25. if (lstrcmpi(pArg, TEXT("on"))==0)
  26. {
  27. cs.fDontPrettyNames = FALSE;
  28. }
  29. else if (lstrcmpi(pArg, TEXT("off"))==0)
  30. {
  31. cs.fDontPrettyNames = TRUE;
  32. }
  33. else if (*pArg==TEXT('?') || lstrcmpi(pArg, TEXT("help"))==0)
  34. {
  35. printf(TEXT("Syntax: pretty.exe [on/off]\n"));
  36. return 0;
  37. }
  38. if (cs.fDontPrettyNames != fOldDontPrettyNames)
  39. WriteCabinetState(&cs);
  40. }
  41. printf(TEXT("Explorer name formatting is %s\n(Any change only become effective after next login)\n"),
  42. cs.fDontPrettyNames ? TEXT("off"):TEXT("on"));
  43. return 0;
  44. }