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.

76 lines
934 B

  1. /* demlabel.c - functions for working this volume labels.
  2. *
  3. * demDeleteLabel()
  4. * demCreateLabel()
  5. *
  6. * Modification History:
  7. *
  8. * YST 1-Feb-1993 Created
  9. *
  10. */
  11. #include "dem.h"
  12. #include "demmsg.h"
  13. #include <softpc.h>
  14. #include <winbase.h>
  15. USHORT demDeleteLabel(BYTE Drive)
  16. {
  17. CHAR szStr[32];
  18. sprintf(szStr, "%c:\\", Drive);
  19. if(!SetVolumeLabelA(szStr, NULL))
  20. return(1);
  21. else
  22. return(0);
  23. }
  24. USHORT demCreateLabel(BYTE Drive, LPSTR lpszName)
  25. {
  26. CHAR szStr[32];
  27. CHAR szAnsi[32];
  28. CHAR szTmp[32];
  29. CHAR *p, *s;
  30. int i = 0;
  31. sprintf(szStr, "%c:\\", Drive);
  32. s = lpszName;
  33. p = szTmp;
  34. while(s) {
  35. if(*s != '.') {
  36. *p = *s;
  37. i++;
  38. p++;
  39. }
  40. else {
  41. while(i < 8) {
  42. *p++ = ' ';
  43. i++;
  44. }
  45. }
  46. s++;
  47. if(i > 11)
  48. break;
  49. }
  50. szTmp[i] = '\0';
  51. OemToAnsi(szTmp, szAnsi);
  52. if(!SetVolumeLabelA(szStr, szAnsi))
  53. return(1);
  54. else
  55. return(0);
  56. }