Jump to content

DosSetFSInfo: Difference between revisions

From EDM2
Ak120 (talk | contribs)
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
==Description==
Sets information for a file system device.
Sets information for a file system device.


Line 14: Line 13:


ulrc = DosSetFSInfo(disknum, infolevel, pBuf, cbBuf);
ulrc = DosSetFSInfo(disknum, infolevel, pBuf, cbBuf);
</PRE>
</PRE>
==Parameters==
==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.  
;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.  
; 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.
; pBuf (PVOID) - input : Address of the storage area where the system gets the new file system information.
; cbBuf (ULONG) - input : The length, in bytes, of pBuf.


    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==
==Return Code==
  ulrc (APIRET) - returns
  ulrc (APIRET) - returns
DosSetFSInfo returns one of the following values:
DosSetFSInfo returns one of the following values:
 
* 0   NO_ERROR  
* 0     NO_ERROR  
* 15 ERROR_INVALID_DRIVE  
* 15       ERROR_INVALID_DRIVE  
* 82 ERROR_CANNOT_MAKE  
* 82       ERROR_CANNOT_MAKE  
* 122 ERROR_INSUFFICIENT_BUFFER  
* 122       ERROR_INSUFFICIENT_BUFFER  
* 123 ERROR_INVALID_NAME  
* 123       ERROR_INVALID_NAME  
* 124 ERROR_INVALID_LEVEL  
* 124       ERROR_INVALID_LEVEL  
* 154 ERROR_LABEL_TOO_LONG
* 154       ERROR_LABEL_TOO_LONG


==Remarks==
==Remarks==
Line 73: Line 66:
return NO_ERROR;
return NO_ERROR;
}
}
</PRE>


</PRE>
==Related Functions==
==Related Functions==
* [[OS2 API:CPI:DosQueryCurrentDisk|DosQueryCurrentDisk]]
* [[DosQueryCurrentDisk]]
* [[OS2 API:CPI:DosQueryFSInfo|DosQueryFSInfo]]
* [[DosQueryFSInfo]]
* [[OS2 API:CPI:DosQuerySysInfo|DosQuerySysInfo]]
* [[DosQuerySysInfo]]
* [[OS2 API:CPI:DosSetDefaultDisk|DosSetDefaultDisk]]
* [[DosSetDefaultDisk]]
 


[[Category:The OS/2 API Project]]
[[Category:Dos]]

Revision as of 07:59, 10 January 2017

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