This is part of Family API which allow to create dual-os version of program runs under OS/2 and DOS

Note: This is legacy API call. It is recommended to use 32-bit equivalent

DosQCurDir

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 Binding

#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 Binding

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

Note

Text based on http://www.edm2.com/index.php/DosQCurDir

Family API
DOS	Process Manager	DosBeep DosExit DosSleep DosExecPgm
File Manager	DosChDir DosChgFilePtr DosClose DosDelete DosDupHandle DosMkDir DosMove DosQCurDir DosQCurDisk DosSetFileMode DosOpen DosQFileInfo DosRead DosQFileMode DosQFSInfo DosQVerify DosRmDir DosSelectDisk DosFindClose DosFindFirst DosFindNext DosSetFileInfo DosSetVerify DosWrite DosFileLocks DosSetFHandState DosNewSize DosBufReset DosQFHandState DosSetFSinfo DosShutdown
Memory Manager	DosFreeSeg DosSubAlloc DosSubFree DosSubSet DosAllocHuge DosAllocSeg DosReallocHuge DosReallocSeg DosGetHugeShift DosCreateCSAlias
NLS	DosCaseMap DosGetCtryInfo DosGetDBCSEv DosSetCtryCode DosGetCollate DosGetMessage DosInsMessage DosPutMessage
Date and Time	DosSetDateTime DosGetDateTime
Devices	DosDevConfig DosDevIOCtl DosDevIOCtl2
Signals	DosHoldSignal DosSetSigHandler
Misc	BadDynLink DosGetEnv DosGetMachineMode DosGetVersion DosError DosErrClass DosSetVec
KBD	KbdCharIn KbdFlushBuffer KbdGetStatus KbdSetStatus KbdStringIn KbdPeek
VIO	VioGetBuf VioGetConfig VioGetCurPos VioGetCurType VioGetPhysBuf VioReadCellStr VioReadCharStr VioScrollUp VioScrollDn VioScrollLf VioScrollRt VioScrUnLock VioSetCurPos VioSetCurType VioSetMode VioGetMode VioShowBuf VioWrtCellStr VioWrtCharStr VioWrtCharStrAtt VioWrtNAttr VioWrtNCell VioWrtNChar VioWrtTTY VioScrLock VioPopUp
Tools	BIND
Modules	DOSCALLS.DLL VIOCALLS.DLL KBDCALLS.DLL MSG.DLL
Libraries	API.LIB OS2386.LIB FAPI.LIB DOSCALLS.LIB SUBCALLS.LIB