• C

DPMILOAD.EXE ??

Hi,
When I compile program in Win98 DOS section or pure MS-DOS 6.0, I got a error message "Failed to locate protected mode loader (DPMILOAD.EXE)".
All I have to do is to get one? Or anything else?
I search on internet, all are patch document.
Any one can send one to me!
Thanks.

Lin Wei-Chang
william@ellcon.com.tw
ginaaAsked:
Who is Participating?
 
matth012098Connect With a Mentor Commented:
Hi ginaa

   Here is a site you can download DPMILOAD.EXE from

http://www.heim2.tu-clausthal.de/PROJEKT/PRG/PCGAMES/index-e.html

goto the bottom of the page and under the heading .EXE files you will find it

matth

0
 
rbrCommented:
Which compiler to you use?
0
 
ginaaAuthor Commented:
Oh, I use djgpp\gcc to compile.
Is these any difference?

Lin

0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
ginaaAuthor Commented:
Oh, by the way, my company compile it in Win95 OSR2 version'
DOS section and never has his problem.
And I can't find the program "dpmiload.exe" in his computer, why?

Lin
0
 
ginaaAuthor Commented:
Oh, by the way, my company compile it in Win95 OSR2 version'
DOS section and never has his problem.
And I can't find the program "dpmiload.exe" in his computer, why?

Lin
0
 
ginaaAuthor Commented:
I got it, I get a djgpp' make.exe, then there is no problem any more.
But if has any other solution, I still wait.
Now I have another question.
When I compile program, the message are too many, and scroll too fast. I press pause or direct to a file won't work. So I can't see all the compile message, help !!

lin

0
 
bflVijayCommented:
Hi,
    Doesn't the pipe (|) work either?
0
 
bertvermeerbergenCommented:
Concerning your messages scrolling of screen:
Under dos, the command.com interpreter does not allow you to specify redirection for anything else that stdin and stdout (or file descriptors 0 and 1).  Your messages are probably send to stderr (file descriptor 2).  This is a limit in the syntax accepted by the command line interpreter, not in the os itself.
You could use a 'program shell', a small c program that will setup the redirection and then exec's your program.  This program will inherit the open filedescriptors, and voila.
I suppose Win98 still uses this limited command interpreter.
If you want, I can post the old dos program code for such a shell I once wrote.  However, I can not and will not guarantee that it will work the same under Win98.
0
 
ginaaAuthor Commented:
That will be fine.
Thank you
Or you can mail to me
william@ellcon.com.tw

0
 
bertvermeerbergenCommented:
/*===========================================================================
Application: BVREDIRF
Module     : BVREDIRF

Description:
  - DOS 'shell' program to redirect all standard C streams to disk files

Author     : Bert Vermeerbergen

Version    : V1.0  27/11/94
               Redirect the 5 standard C streams and run program supplied as
               argument.
===========================================================================*/

#include "stdlib.h"
#include "stdio.h"
#include "direct.h"
#include "io.h"
#include "string.h"
#include "process.h"
#include "assert.h"

/*-------------------------------------------------------------------------*/

#define About(ver)  { char szProg[_MAX_FNAME]; \
    _splitpath(argv[0], NULL, NULL, szProg, NULL); \
    fprintf(stderr, "%s  " #ver "  (c) '94 Bert Vermeerbergen\n", szProg); }

/*-------------------------------------------------------------------------*/

struct _redirFile {
    char szName[_MAX_FNAME];      //-- redirection filename
    int  nDupHandle;                  //-- original stream handle
    FILE *pfRedir;                        //-- redirection stream
} redirFile [5];                        //-- indexed by handle

int  iDriveWork = 0;            //-- optional working drive
char szDirWork[_MAX_PATH];      //-- optional working directory to run in

/*-------------------------------------------------------------------------*/

void Help (char *pArg0)
{
    char szProg[_MAX_FNAME];

    _splitpath(pArg0, NULL, NULL, szProg, NULL);
    fprintf(stderr, "\nUsage: %s [/?] [/ioeap=filenname] [/@[drv:]dir] programname [arg...]\n", szProg);
    fprintf(stderr, "    Run program with standard C stream(s) redirected to disk file\n");
    fprintf(stderr, "\nOptions:\n");
    fprintf(stderr, "    /?              you're reading it now\n");
    fprintf(stderr, "    /i=inputfile    redirect stdin  (#0) stream\n");
    fprintf(stderr, "    /o=outputfile            stdout (#1)\n");
    fprintf(stderr, "    /e=errorfile             stderr (#2)\n");
    fprintf(stderr, "    /a=auxfile               stdaux (#3)\n");
    fprintf(stderr, "    /p=printerfile           stdprt (#4)\n");
    fprintf(stderr, "    /@[drv:]dir     working directory for program to run\n");
    fprintf(stderr, "    programname     filename of program to run\n");
    fprintf(stderr, "    arglist         arguments to program\n");

    exit(0);
}

/*-------------------------------------------------------------------------*/

char *GetOpt (char *pArgv)
{
    char ch1, ch2;

      if (!pArgv)
            return(NULL);

    ch1 = *pArgv;
    ch2 = (char)toupper(*(pArgv+1));
    if ((ch1 == '?') ||
            ((ch1 == '/') && ((ch2 == '?') || (ch2 == 'H'))) ||
            (stricmp(pArgv, "HELP") == 0))
    {
            pArgv[1] = '?';
            return(pArgv+1);
    }
    else if ((ch1 == '/') || (ch1 == '-'))
    {
            pArgv[1] = (char)toupper(pArgv[1]);
            return(pArgv+1);
    }
    else
    {
            return(NULL);      /* stop scan when no more options */
    }
}

/*-------------------------------------------------------------------------*/

int main (int argc, char **argv)
{
    int  nRslt, nf, nErr;
    int  nArg;
    int  nOptCnt;
    char *pszOpt;
    int  iDriveOld;
    char szDirOld[_MAX_PATH];

    /*-- show me --*/
    About(1.0);

    /*-- get user options --*/
    nOptCnt = 1;
    while ((pszOpt = GetOpt(argv[nOptCnt])) != NULL)
    {
        switch (pszOpt[0])
        {
          case '?':
                  Help(argv[0]);
                  break;

          case 'I':
          case 'O':
          case 'E':
          case 'A':
          case 'P':
            if ((pszOpt[1] == '=') && (pszOpt[2] != '\0'))
            {
                switch(pszOpt[0])
                {
                  case 'I': strcpy(redirFile[0].szName, &pszOpt[2]); break;
                  case 'O': strcpy(redirFile[1].szName, &pszOpt[2]); break;
                  case 'E': strcpy(redirFile[2].szName, &pszOpt[2]); break;
                  case 'A': strcpy(redirFile[3].szName, &pszOpt[2]); break;
                  case 'P': strcpy(redirFile[4].szName, &pszOpt[2]); break;
                  default:
                        fprintf(stderr, "Error in option %s, skipped\n", argv[nOptCnt]);
                }
            }
            else
                       fprintf(stderr, "Error in option %s, skipped\n", argv[nOptCnt]);
            break;

          case '@':
            if ((strlen(pszOpt) >= 3) && (pszOpt[2] == ':'))      //-- @c:xxx
            {
                iDriveWork = pszOpt[1] - 'A' + 1;
                strcpy(szDirWork, &pszOpt[3]);
            }    
            else                                            //-- @xxx
            {
                iDriveWork = 0;
                strcpy(szDirWork, &pszOpt[1]);      
            }
            break;

          default:
                     fprintf(stderr, "Unknown option %s, skipped\n", argv[nOptCnt]);
        }
        nOptCnt++;
    }

    //-- nOptCnt is # programname argument, is required
    if (!(nOptCnt < argc))
    {
            fprintf(stderr, "\nREQUIRED ARGUMENT programname MISSING\n");
            Help(argv[0]);
    }

    //-- redirect streams
    for (nf = 0; nf < 5; nf++)
    {
        if (redirFile[nf].szName[0] != '\0')      //-- filename given for stream #nf
        {
            //-- save handle of stream to be redirected to file
            redirFile[nf].nDupHandle = _dup(nf);
            //-- open redirection stream
            redirFile[nf].pfRedir = fopen(redirFile[nf].szName, (nf == 0 ? "rt" : "wt"));
                  assert(redirFile[nf].pfRedir != NULL);
                  //-- redirect filedescripter to new stream file    
                  nErr = _dup2(_fileno(redirFile[nf].pfRedir), nf);
                  assert(nErr == 0);
            }
    }

    //-- shift program argument list
    for (nArg = 0; nArg < argc - nOptCnt; nArg++)
    {
        argv[nArg] = argv[nArg+nOptCnt];
    }
    argv[nArg] = NULL;

    //-- save current working directory
    iDriveOld = _getdrive();
    _getcwd(szDirOld, sizeof(szDirOld));

    //-- change to specified working directory
    if (iDriveWork != 0)
        _chdrive(iDriveWork);
    if (szDirWork[0] != '\0')
        _chdir(szDirWork);
   
    //-- launch program using redirection
    nRslt = _spawnvp(_P_WAIT, argv[0], argv);

    //-- return to original working directory
    if (iDriveWork != 0)
        _chdrive(iDriveOld);
    if (szDirWork[0] != '\0')
        _chdir(szDirOld);
   
    //-- restore streams
    for (nf = 0; nf < 5; nf++)
    {
        if (redirFile[nf].szName[0] != '\0')      //-- filename given for stream #nf
        {
                  //-- flush buffers and close the redirection file
                  fflush(redirFile[nf].pfRedir);
                  fclose(redirFile[nf].pfRedir);
                  //-- restore original stream
                  nErr = _dup2(redirFile[nf].nDupHandle, nf);
                  assert(nErr == 0);
            }
    }

    //-- report if launch error
    if (nRslt < 0)
        fprintf(stderr, "spawn error %d: %s\n", nRslt, strerror(errno));

    return(0);
}

/*=========================================================================*/

0
 
bertvermeerbergenCommented:
Sorry for the indentation problems, these must be tab characters that are not used consistently.
Don't be alarmed by the size of the 'small' shell.  Most of the code concerns option handling.  The core starts around the lines:
    //-- redirect streams
    for (nf = 0; nf < 5; nf++)
       ...
in main()

It compiles and seems to work under Win95 (using Visual C++ 5.0) as a 32-bit console application.

Example of use:
  bvredirf /o=ttt /e=ttt2 xcopy /I x y
will create file ttt containing one line:
     0 file copied
and the file ttt2 containing the line:
  File not found - x
(Assuming of course that there was no file x to copy)

Please feel free to use and or modify it.
0
 
ginaaAuthor Commented:
Though I don't need it any more, but you answer the origin question, so thank you any way

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.