Jump to content

DosSetFSInfo: Difference between revisions

From EDM2
Ak120 (talk | contribs)
Ak120 (talk | contribs)
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Description==
Sets information for a file system device.
Sets information for a file system device.


==Syntax==
==Syntax==
<PRE>
  DosSetFSInfo(disknum, infolevel, pBuf, cbBuf)
#define INCL_DOSFILEMGR
#include <os2.h>
 
ULONG    disknum;
ULONG    infolevel;
PVOID    pBuf;
ULONG    cbBuf;
APIRET    ulrc;      /* Return Code. */
 
ulrc = DosSetFSInfo(disknum, infolevel, pBuf, cbBuf);


</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:
 
* 0   NO_ERROR
DosSetFSInfo returns one of the following values:
* 15 ERROR_INVALID_DRIVE
 
* 82 ERROR_CANNOT_MAKE
* 0     NO_ERROR  
* 122 ERROR_INSUFFICIENT_BUFFER
* 15       ERROR_INVALID_DRIVE  
* 123 ERROR_INVALID_NAME
* 82       ERROR_CANNOT_MAKE  
* 124 ERROR_INVALID_LEVEL
* 122       ERROR_INSUFFICIENT_BUFFER  
* 154 ERROR_LABEL_TOO_LONG
* 123       ERROR_INVALID_NAME  
* 124       ERROR_INVALID_LEVEL  
* 154       ERROR_LABEL_TOO_LONG


==Remarks==
==Remarks==
Trailing blanks supplied at the time the volume label is defined are not returned by DosQueryFSInfo.
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.  
File-system information can be set only if the volume is opened in a mode that allows write access.


==Example Code==
==Example Code==
Line 54: Line 36:


int main(VOID) {
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 */


ULONG   DriveNumber  = 1;                    /* Drive 1=A: 2=B: 3=C: ... */
   strcpy(FSInfoBuf.szVolLabel, "MYDISK");    /* Change vol label to MYDISK */
VOLUMELABEL FSInfoBuf = {0};                  /* File system info buffer */
  FSInfoBuf.cch = (BYTE) strlen(FSInfoBuf.szVolLabel);
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 */
  rc = DosSetFSInfo(DriveNumber,            /* Drive number */
                  FSIL_VOLSER,            /* Level of information being set */
                    FSIL_VOLSER,            /* Level of information being set */
                  &FSInfoBuf,            /* Address of input buffer */
                    &FSInfoBuf,            /* Address of input buffer */
                  sizeof(VOLUMELABEL) );  /* Buffer size */
                    sizeof(VOLUMELABEL) );  /* Buffer size */
if (rc != NO_ERROR) {
  if (rc != NO_ERROR) {
  printf("DosSetFSInfo error: return code = %u\n", rc);
    printf("DosSetFSInfo error: return code = %u\n", rc);
  return 1;
    return 1;
}
  }
 
  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]]

Latest revision as of 22:08, 27 April 2019

Sets information for a file system device.

Syntax

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