GetCurrentPDB

3.0

  UINT GetCurrentPDB(void)    

The GetCurrentPDB function returns the selector address of the current MS-DOS program database (PDB), also known as the program segment prefix (PSP).

Parameters

This function has no parameters.

Return Value

The return value is the selector address of the current PDB if the function is successful.

Example

The following example uses the GetCurrentPDB function to list the current command tail:

typedef struct {
    WORD pspInt20;            /* Int 20h instruction             */
    WORD pspNextParagraph;    /* segment addr. of next paragraph */
    BYTE res1;                /* reserved                        */
    BYTE pspDispatcher[5];    /* long call to MS-DOS             */
    DWORD pspTerminateVector; /* termination address (Int 22h)   */
    DWORD pspControlCVector;  /* addr of CTRL+C (Int 23h)        */
    DWORD pspCritErrorVector; /* addr of Crit-Error (Int 24h)    */
    WORD res2[11];            /* reserved                        */
    WORD pspEnvironment;      /* segment address of environment  */
    WORD res3[23];            /* reserved                        */
    BYTE pspFCB_1[16];        /* default FCB #1                  */
    BYTE pspFCB_2[16];        /* default FCB #2                  */
    DWORD res4;               /* reserved                        */
    BYTE pspCommandTail[128]; /* command tail (also default DTA) */
} PSP, FAR* LPSP;

    LPSP lpsp = (LPSP) MAKELP(GetCurrentPDB(), 0);

    MessageBox(NULL, lpsp->pspCommandTail, "PDB Command Tail", MB_OK);