Jump to content

DosSetFSInfo

From EDM2
Revision as of 07:05, 9 January 2017 by Ak120 (talk | contribs) (Ak120 moved page OS2 API:CPI:DosSetFSInfo to DosSetFSInfo)

Description

Sets information for a file system device.

Syntax

#define INCL_DOSFILEMGR
#include <os2.h>

ULONG     disknum;
ULONG     infolevel;
PVOID     pBuf;
ULONG     cbBuf;
APIRET    ulrc;       /*  Return Code. */

ulrc = DosSetFSInfo(disknum, infolevel, pBuf, cbBuf);

Parameters

disknum (ULONG) - input
Logical drive number. Zero means the default drive, 1 means drive A, 2 means drive B, 3 means drive C, and so on. This represents the file system driver (FSD) for the media currently in that drive. A value of 0xFFFF means that pBuf contains the ASCIIZ path name of the FSD.
infolevel (ULONG) - input
Level of file information to be set. Only a value of 2 (FSIL_VOLSER) may be specified.
pBuf (PVOID) - input
Address of the storage area where the system gets the new file system information.
   Level 2 Information - Level 2 information is returned in the format of an FSINFO structure. 
cbBuf (ULONG) - input
The length, in bytes, of pBuf.

Return Code

ulrc (APIRET) - returns

DosSetFSInfo returns one of the following values:

  • 0 NO_ERROR
  • 15 ERROR_INVALID_DRIVE
  • 82 ERROR_CANNOT_MAKE
  • 122 ERROR_INSUFFICIENT_BUFFER
  • 123 ERROR_INVALID_NAME
  • 124 ERROR_INVALID_LEVEL
  • 154 ERROR_LABEL_TOO_LONG

Remarks

Trailing blanks supplied at the time the volume label is defined are not returned by DosQueryFSInfo.

File-system information can be set only if the volume is opened in a mode that allows write access.

Example Code

This example shows how to label the disk in drive "A" as "MYDISK". Before running this program, make sure that there is a disk in the drive.

#define INCL_DOSFILEMGR         /* File Manager values */
#define INCL_DOSERRORS          /* DOS Error values */
#include <os2.h>
#include <stdio.h>
#include <string.h>

int main(VOID) {

ULONG   DriveNumber   = 1;                    /* Drive 1=A: 2=B: 3=C: ... */
VOLUMELABEL FSInfoBuf = {0};                  /* File system info buffer */
APIRET  rc            = NO_ERROR;             /* Return code */

strcpy(FSInfoBuf.szVolLabel, "MYDISK");    /* Change vol label to MYDISK */
FSInfoBuf.cch = (BYTE) strlen(FSInfoBuf.szVolLabel);

rc = DosSetFSInfo(DriveNumber,            /* Drive number */
                  FSIL_VOLSER,            /* Level of information being set */
                  &FSInfoBuf,             /* Address of input buffer */
                  sizeof(VOLUMELABEL) );  /* Buffer size */
if (rc != NO_ERROR) {
   printf("DosSetFSInfo error: return code = %u\n", rc);
   return 1;
}

return NO_ERROR;
}

Related Functions