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.

75 lines
1.1 KiB

  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. #include "dpmtbls.h"
  16. USHORT demDeleteLabel(BYTE Drive)
  17. {
  18. CHAR szStr[32];
  19. sprintf(szStr, "%c:\\", Drive);
  20. if(!SetVolumeLabelOem(szStr, NULL))
  21. return(1);
  22. else
  23. return(0);
  24. }
  25. USHORT demCreateLabel(BYTE Drive, LPSTR lpszName)
  26. {
  27. CHAR szStr[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. }
  51. szTmp[i] = '\0';
  52. if(!SetVolumeLabelOem(szStr, szTmp))
  53. return(1);
  54. else
  55. return(0);
  56. }