ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

vol.c
Go to the documentation of this file.
00001 /*
00002  *  VOL.C - vol internal command.
00003  *
00004  *
00005  *  History:
00006  *
00007  *    03-Dec-1998 (Eric Kohl)
00008  *        Replaced DOS calls by Win32 calls.
00009  *
00010  *    08-Dec-1998 (Eric Kohl)
00011  *        Added help text ("/?").
00012  *
00013  *    07-Jan-1999 (Eric Kohl)
00014  *        Cleanup.
00015  *
00016  *    18-Jan-1999 (Eric Kohl)
00017  *        Unicode ready!
00018  *
00019  *    20-Jan-1999 (Eric Kohl)
00020  *        Redirection ready!
00021  */
00022 
00023 #include <precomp.h>
00024 
00025 #ifdef INCLUDE_CMD_VOL
00026 
00027 
00028 static INT
00029 PrintVolumeHeader (LPTSTR pszRootPath)
00030 {
00031     TCHAR szVolName[80];
00032     DWORD dwSerialNr;
00033 
00034     /* get the volume information of the drive */
00035     if(!GetVolumeInformation (pszRootPath,
00036                   szVolName,
00037                   80,
00038                   &dwSerialNr,
00039                   NULL,
00040                   NULL,
00041                   NULL,
00042                   0))
00043     {
00044         ErrorMessage (GetLastError (), _T(""));
00045         return 1;
00046     }
00047 
00048     /* print drive info */
00049     if (szVolName[0] != '\0')
00050     {
00051         ConOutResPrintf(STRING_VOL_HELP1, pszRootPath[0],szVolName);
00052     }
00053     else
00054     {
00055         ConOutResPrintf(STRING_VOL_HELP2, pszRootPath[0]);
00056     }
00057 
00058     /* print the volume serial number */
00059     ConOutResPrintf(STRING_VOL_HELP3, HIWORD(dwSerialNr), LOWORD(dwSerialNr));
00060     return 0;
00061 }
00062 
00063 
00064 INT cmd_vol (LPTSTR param)
00065 {
00066     TCHAR szRootPath[] = _T("A:\\");
00067     TCHAR szPath[MAX_PATH];
00068 
00069     if (!_tcsncmp (param, _T("/?"), 2))
00070     {
00071         ConOutResPaging(TRUE,STRING_VOL_HELP4);
00072         return 0;
00073     }
00074 
00075   nErrorLevel = 0;
00076 
00077     if (param[0] == _T('\0'))
00078     {
00079         GetCurrentDirectory (MAX_PATH, szPath);
00080         szRootPath[0] = szPath[0];
00081     }
00082     else
00083     {
00084         _tcsupr (param);
00085         if (param[1] == _T(':'))
00086             szRootPath[0] = param[0];
00087         else
00088         {
00089             error_invalid_drive ();
00090       nErrorLevel = 1;
00091             return 1;
00092         }
00093     }
00094 
00095     if (!IsValidPathName (szRootPath))
00096     {
00097         error_invalid_drive ();
00098      nErrorLevel = 1;
00099         return 1;
00100     }
00101 
00102     /* print the header */
00103     if (!PrintVolumeHeader (szRootPath))
00104   {
00105         nErrorLevel = 1;
00106         return 1;
00107   }
00108 
00109     return 0;
00110 }
00111 
00112 #endif

Generated on Sat May 26 2012 04:17:10 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.