Jump to content

DosQCurDir: Difference between revisions

From EDM2
Ak120 (talk | contribs)
Ak120 (talk | contribs)
mNo edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[image:legacy.png]]
This function has been renamed to "[[OS2_API:CPI:DosQueryCurrentDir|DosQueryCurrentDir]]". [https://books.google.com.ec/books?id=u7WbsmbttwYC&pg=PT372&lpg=PT372&dq#v=onepage&q&f=false]
==Description==
This call returns the full path name of the current directory for the requesting process for the specified drive.
This call returns the full path name of the current directory for the requesting process for the specified drive.


==Syntax==
==Syntax==
<PRE>
  DosQCurDir (DriveNumber, DirPath, DirPathLen)
  DosQCurDir


    (DriveNumber, DirPath, DirPathLen)
</PRE>
==Parameters==
==Parameters==
; DriveNumber (USHORT) - input : Drive number, for example:
;DriveNumber (USHORT) - input : Drive number, for example:<tt><br/> Value<br/>     Definition 0<br/>    default 1<br/>    A 2<br/>    B ...</tt>
 
;DirPath (PBYTE) - output : Address of the fully qualified path name of current directory.
     Value
;DirPathLen (PUSHORT) - input/output : Address of the length of the DirPath buffer. On input, this field contains the length of the directory path buffer in bytes. On output, if an error is returned because the buffer is too small, this field contains the required length.
        Definition 0
        default 1
        A 2
        B .
    .
    .
 
; DirPath (PBYTE) - output : Address of the fully qualified path name of current directory.  
 
; DirPathLen (PUSHORT) - input/output : Address of the length of the DirPath buffer. On input, this field contains the length of the directory path buffer in bytes. On output, if an error is returned because the buffer is too small, this field contains the required length.
 


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
* 0 NO_ERROR
Return code descriptions are:
* 15 ERROR_INVALID_DRIVE
 
* 26 ERROR_NOT_DOS_DISK
* 0         NO_ERROR  
*108 ERROR_DRIVE_LOCKED
* 15       ERROR_INVALID_DRIVE  
*111 ERROR_BUFFER_OVERFLOW
* 26       ERROR_NOT_DOS_DISK  
* 108       ERROR_DRIVE_LOCKED  
* 111       ERROR_BUFFER_OVERFLOW
 


==Remarks==
==Remarks==
Line 45: Line 22:
The system returns the length of the returned DirPath string in DirPathLen, which does not include the terminating null byte. In the case where the DirPath buffer is of insufficient length to hold the current directory path string, the system returns the required length (in bytes) for DirPath in DirPathLen.
The system returns the length of the returned DirPath string in DirPathLen, which does not include the terminating null byte. In the case where the DirPath buffer is of insufficient length to hold the current directory path string, the system returns the required length (in bytes) for DirPath in DirPathLen.


For FSDs, the case of the current directory is set according to the DirName passed in, not according to the case of the directories on disk. For example, if the directory "c:\bin" is created and DosChDir is called with DirName "c:\bin", the current directory returned by DosQCurDir will be "c:\bin".
For FSDs, the case of the current directory is set according to the DirName passed in, not according to the case of the directories on disk. For example, if the directory "c:\bin" is created and [[DosChDir]] is called with DirName "c:\bin", the current directory returned by DosQCurDir will be "c:\bin".


Programs running without the NEWFILES bit set are allowed to DosChDir to a non-8.3 filename format directory.
Programs running without the NEWFILES bit set are allowed to DosChDir to a non-8.3 filename format directory.


DosQSysInfo must be used by an application to determine the maximum path length supported by OS/2. The returned value should be used to dynamically allocate buffers that are to be used to store paths.  
[[DosQSysInfo]] must be used by an application to determine the maximum path length supported by OS/2. The returned value should be used to dynamically allocate buffers that are to be used to store paths.


==Example Code==
==Bindings==
===C Binding===
===C===
<PRE>
<PRE>
#define INCL_DOSFILEMGR
#define INCL_DOSFILEMGR
Line 58: Line 35:
USHORT  rc = DosQCurDir(DriveNumber, DirPath, DirPathLen);
USHORT  rc = DosQCurDir(DriveNumber, DirPath, DirPathLen);


USHORT           DriveNumber;  /* Drive number */
USHORT DriveNumber;  /* Drive number */
PBYTE           DirPath;      /* Directory path buffer (returned) */
PBYTE   DirPath;      /* Directory path buffer (returned) */
PUSHORT         DirPathLen;    /* Directory path buffer length
PUSHORT DirPathLen;    /* Directory path buffer length (returned) */
                                    (returned) */


USHORT           rc;            /* return code */
USHORT rc;            /* return code */
</PRE>
</PRE>


===MASM Binding===
===MASM===
<PRE>
<PRE>
EXTRN  DosQCurDir:FAR
EXTRN  DosQCurDir:FAR
Line 78: Line 54:
Returns WORD
Returns WORD
</PRE>
</PRE>
==Related Functions==
*


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

Latest revision as of 06:03, 26 January 2020

This call returns the full path name of the current directory for the requesting process for the specified drive.

Syntax

DosQCurDir (DriveNumber, DirPath, DirPathLen)

Parameters

DriveNumber (USHORT) - input
Drive number, for example:
Value
Definition 0
default 1
A 2
B ...
DirPath (PBYTE) - output
Address of the fully qualified path name of current directory.
DirPathLen (PUSHORT) - input/output
Address of the length of the DirPath buffer. On input, this field contains the length of the directory path buffer in bytes. On output, if an error is returned because the buffer is too small, this field contains the required length.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 15 ERROR_INVALID_DRIVE
  • 26 ERROR_NOT_DOS_DISK
  • 108 ERROR_DRIVE_LOCKED
  • 111 ERROR_BUFFER_OVERFLOW

Remarks

The drive letter is not part of the returned string. The string does not begin with a backslash and is terminated by a byte containing 00H.

The system returns the length of the returned DirPath string in DirPathLen, which does not include the terminating null byte. In the case where the DirPath buffer is of insufficient length to hold the current directory path string, the system returns the required length (in bytes) for DirPath in DirPathLen.

For FSDs, the case of the current directory is set according to the DirName passed in, not according to the case of the directories on disk. For example, if the directory "c:\bin" is created and DosChDir is called with DirName "c:\bin", the current directory returned by DosQCurDir will be "c:\bin".

Programs running without the NEWFILES bit set are allowed to DosChDir to a non-8.3 filename format directory.

DosQSysInfo must be used by an application to determine the maximum path length supported by OS/2. The returned value should be used to dynamically allocate buffers that are to be used to store paths.

Bindings

C

#define INCL_DOSFILEMGR

USHORT  rc = DosQCurDir(DriveNumber, DirPath, DirPathLen);

USHORT  DriveNumber;   /* Drive number */
PBYTE   DirPath;       /* Directory path buffer (returned) */
PUSHORT DirPathLen;    /* Directory path buffer length (returned) */

USHORT  rc;            /* return code */

MASM

EXTRN  DosQCurDir:FAR
INCL_DOSFILEMGR     EQU 1

PUSH   WORD    DriveNumber   ;Drive number
PUSH@  OTHER   DirPath       ;Directory path buffer (returned)
PUSH@  WORD    DirPathLen    ;Directory path buffer length (returned)
CALL   DosQCurDir

Returns WORD