Jump to content

wpQueryRealName

From EDM2

This instance method is **called to allow the object to query its physical file name**.

Syntax

_wpQueryRealName(somSelf, pszFilename, pcb, fQualified)

Parameters

somSelf (WPFileSystem *) - input
Pointer to the object on which the method is being invoked.
Points to an object of class WPFileSystem.
pszFilename (PSZ) - output
Pointer to the file name of the object.
The pointer to the buffer in which to place the real file name of the object.
pcb (PULONG) - in/out
Size of the file-name buffer.
If pszFilename is set to NULL, the actual length of the file is returned.
fQualified (BOOL) - input
Indicates whether or not to query fully qualified path.
    • TRUE**: Return the fully qualified file name.
    • FALSE**: Return the unqualified file name.

Returns

rc (BOOL) - returns
Success indicator.
    • TRUE**: Successful completion.
    • FALSE**: Error occurred.

Remarks

This method returns the fully qualified file name for this object. Generally, an object's real name and title are the same. For file systems that do not support the features of a title (e.g., specific characters, mixed case, and spaces), the title is stored in the **.LONGNAME extended attribute**, and then the title and real name may differ. The real name of the file object can be used with any of the DOSXXX functions that act on file names.

Usage

This method can be **called at any time in order to determine the physical file name for this object**.

How to Override

This method is **generally not overridden**.

Example Code

Declaration:

#define INCL_WINWORKPLACE
#include <os2.h>

WPFileSystem *somSelf;      /* Pointer to the object on which the method is being invoked. */
PSZ          pszFilename; /* Pointer to the file name of the object. */
PULONG       pcb;         /* Size of the file-name buffer. */
BOOL         fQualified;  /* Indicates whether or not to query fully qualified path. */
BOOL         rc;          /* Success indicator. */

rc = _wpQueryRealName(somSelf, pszFilename, pcb, fQualified);

This example shows how `_wpQueryRealName` is used within an override of `_wpSetup` to query the full-pathname of an object's file.

SOM_Scope BOOL SOMLINK myf_wpSetup(MYFILE *somSelf,
PSZ pszSetupString)
{
    MYFILEData *somThis = MYFILEGetData(somSelf);
    ULONG cbBytesWritten; /* Number of bytes written */
    APIRET rc; /* Return code */
    BOOL fSuccess; /* Success flag */
    HFILE hf; /* File handle */
    ULONG ulAction; /* Action taken by DosOpen */
    CHAR szObjectFilename[CCHMAXPATH]; /* Buffer for wpQueryRealName() */
    ULONG cb = sizeof(szObjectFilename); /* Size of object */
    PSZ pszDefaultText; /* Default text */
    BOOL rcParentCall; /* Result of parent's method */
    CHAR szValue[CCHMAXPATH+1];
    ULONG cbBuffer;
    MYFILEMethodDebug("MYFILE","myf_wpSetup");

    /* When the object is created from scratch, put some default
    text into the file on the hard disk */
    fSuccess =
        _wpQueryRealName( /* query full-pathname of object's file */
            somSelf, /* pointer to this object */
            szObjectFilename, /* return buffer */
            &cb, /* sizeof buffer */
            TRUE); /* request fully qualified pathname? */
    if (fSuccess)
    {
        rc = DosOpen(szObjectFilename, &hf, &ulAction, 20L, FILE_NORMAL,
        ...

Related Methods