当前位置: 首页>>代码示例>>C++>>正文


C++ DosOpen函数代码示例

本文整理汇总了C++中DosOpen函数的典型用法代码示例。如果您正苦于以下问题:C++ DosOpen函数的具体用法?C++ DosOpen怎么用?C++ DosOpen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DosOpen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CMD_DosOpen

//-------------------------------- CMD_DosOpen ---------------------------------
void CMD_DosOpen(HFILE hFile,LXIOCPA_DMN_CMDPARMPACKET* pParam
                 ,PLXDOSOPENSTRUCT p)
{
 pParam->rc=DosOpen(p->fileName,&p->hFile,&p->ulAction,p->cbFile
                    ,p->ulAttribute,p->fsOpenFlags,p->fsOpenMode
                    ,NULL);
}
开发者ID:OS2World,项目名称:DRV-LXAPI32,代码行数:8,代码来源:lxapid_cmd.c

示例2: OpenPort

BOOL OpenPort(THREAD *pstThd)
  {
  ULONG ulAction;
  APIRET rc;
  CHAR szMsgString[200];
  CHAR szCaption[80];

  if ((rc = DosOpen(pstThd->stCfg.szPortName,&pstThd->hCom,&ulAction,0L,0,0x0001,0x21c2,0L)) != 0)
    {
    WinQueryWindowText(pstThd->hwndFrame,sizeof(szCaption),szCaption);
//    WinLoadString(pstThd->habAnchorBlk,NUL,EATM_DOSOPEN,
//                  sizeof(szMsgString),szMsgString);
    sprintf(szMsgString,"Error opening %s\nError Code = %04X",pstThd->stCfg.szPortName,rc);

    WinMessageBox( HWND_DESKTOP,
                   pstThd->hwndDlg,
                   (PSZ)szMsgString,
                   (PSZ)szCaption,
                   NUL,
                   MB_MOVEABLE | MB_OK | MB_CUAWARNING );
    pstThd->hCom = 0;
    return(FALSE);
    }
  return(TRUE);
  }
开发者ID:OS2World,项目名称:APP-COMM-ComScope,代码行数:25,代码来源:util.c

示例3: GA_getSharedInfo

/****************************************************************************
REMARKS:
This function returns a pointer to the common graphics driver loaded in the
helper VxD. The memory for the VxD is shared between all processes via
the VxD, so that the VxD, 16-bit code and 32-bit code all see the same
state when accessing the graphics binary portable driver.
****************************************************************************/
GA_sharedInfo * NAPI GA_getSharedInfo(
    int device)
{
    /* Initialise the PM library and connect to our runtime DLL's */
    PM_init();

    /* Open our helper device driver */
    if (DosOpen(PMHELP_NAME,&hSDDHelp,&result,0,0,
	    FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
	    NULL))
	PM_fatalError("Unable to open SDDHELP$ helper device driver!");
    outLen = sizeof(result);
    DosDevIOCtl(hSDDHelp,PMHELP_IOCTL,PMHELP_GETSHAREDINFO,
	NULL, 0, NULL,
	&result, outLen, &outLen);
    DosClose(hSDDHelp);
    if (result) {
	/* We have found the shared Nucleus packet. Because not all processes
	 * map to SDDPMI.DLL, we need to ensure that we connect to this
	 * DLL so that it gets mapped into our address space (that is
	 * where the shared Nucleus packet is located). Simply doing a
	 * DosLoadModule on it is enough for this.
	 */
	HMODULE hModSDDPMI;
	char    buf[80];
	DosLoadModule((PSZ)buf,sizeof(buf),(PSZ)"SDDPMI.DLL",&hModSDDPMI);
	}
    return (GA_sharedInfo*)result;
}
开发者ID:A1DEVS,项目名称:lenovo_a1_07_uboot,代码行数:36,代码来源:aaos2.c

示例4: DosKillFastIo

APIRET
DosKillFastIo( PID pid )
{
  APIRET rc;
  HFILE  hfd;
  ULONG  action, plen;


  if(( rc = DosOpen((PSZ)"/dev/fastio$", (PHFILE)&hfd,
                    (PULONG)&action, (ULONG)0, FILE_SYSTEM, FILE_OPEN,
                    OPEN_SHARE_DENYNONE | OPEN_FLAGS_NOINHERIT | OPEN_ACCESS_READONLY,
                    (ULONG)0)) != NO_ERROR )
  {
    return rc;
  }

  if(( rc = DosDevIOCtl( hfd, (ULONG)0x76, (ULONG)0x65,
                        (PULONG*)&pid, sizeof(USHORT), &plen, NULL, 0, NULL)) != 0 )
  {
    DosClose( hfd );
    return rc;
  }

  DosClose(hfd);
  return NO_ERROR;
}
开发者ID:OS2World,项目名称:UTIL-WPS-XCENTER-wxTasks,代码行数:26,代码来源:wxtask.cpp

示例5: LocalOpen

sys_handle LocalOpen( char *name, open_access access )
{
    HFILE       hdl;
    USHORT      action;
    USHORT      openflags;
    USHORT      openmode;
    USHORT      rc;

    if( (access & OP_WRITE) == 0 ) {
        openmode = READONLY;
        access &= ~(OP_CREATE|OP_TRUNC);
    } else if( access & OP_READ ) {
        openmode = READWRITE;
    } else {
        openmode = WRITEONLY;
    }
    openmode |= 0x20c0;
    openflags = 0;
    if( access & OP_CREATE ) openflags |= 0x10;
    openflags |= (access & OP_TRUNC) ? 0x02 : 0x01;
    rc = DosOpen( name,         /* name */
                &hdl,           /* handle to be filled in */
                &action,        /* action taken */
                0,              /* initial allocation */
                0,              /* normal file */
                openflags,      /* open the file */
                openmode,       /* deny-none, inheritance */
                0 );            /* reserved */
    if( rc != 0 ) {
        StashErrCode( rc, OP_LOCAL );
        return( NIL_SYS_HANDLE );
    }
    return( hdl );
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:34,代码来源:os2filio.c

示例6: _wpi_filecreate

HFILE _wpi_filecreate( LPSTR filename, int format )
/*************************************************/
{

#if 0   // this definition seems to interfere with C lib IO
    PM1632_FILESIZETYPE         action;
    HFILE                       hfile;

    if( !(format & (OPEN_SHARE_DENYREAD | OPEN_SHARE_DENYWRITE
                        | OPEN_SHARE_DENYREADWRITE | OPEN_SHARE_DENYNONE)) ) {
        format |= OPEN_SHARE_DENYNONE;
    }

    if( DosOpen( (PSZ)filename, &hfile, &action, 0L, FILE_NORMAL,
                OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS,
                format, 0L ) != 0 ) {
        hfile = -1;
    }

#ifdef __FLAT__
    DosDevIOCtl( hfile, 0x08, 0x00, 0, 0, 0, 0, 512L, 0 );
#else
    // I don't know what to do here!
    // DosDevIOCtl( hfile, 0x08, 0x00, 0, 0, 0, 0, 512L, 0 );
#endif
    return( hfile );
#else
    return( _wpi_fileopen( filename, format ) );
#endif

} /* _wpi_filecreate */
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:31,代码来源:wpi_file.c

示例7: FcbGetFileSize

BOOL FcbGetFileSize(xfcb FAR * lpXfcb)
{
  COUNT FcbDrive, hndl;

  /* Build a traditional DOS file name                            */
  lpFcb = CommonFcbInit(lpXfcb, SecPathName, &FcbDrive);

  /* check for a device                                           */
  if (IsDevice(SecPathName) || (lpFcb->fcb_recsiz == 0))
  {
    return FALSE;
  }
  hndl = DosOpen(SecPathName, O_RDONLY);
  if (hndl >= 0)
  {
    LONG fsize;

    /* Get the size                                         */
    fsize = DosGetFsize(hndl);

    /* compute the size and update the fcb                  */
    lpFcb->fcb_rndm = fsize / lpFcb->fcb_recsiz;
    if ((fsize % lpFcb->fcb_recsiz) != 0)
      ++lpFcb->fcb_rndm;

    /* close the file and leave                             */
    return DosClose(hndl) == SUCCESS;
  }
  else
    return FALSE;
}
开发者ID:TijmenW,项目名称:FreeDOS,代码行数:31,代码来源:fcbfns.c

示例8: death

static
APIRET death(PID pid)
{
    APIRET rc;
    HFILE hfd;
    ULONG action,plen;
    USHORT param;

    if ((rc=DosOpen((PSZ)"/dev/fastio$", (PHFILE)&hfd, (PULONG)&action,
                    (ULONG)0, FILE_SYSTEM, FILE_OPEN,
                    OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY,
                    (ULONG)0))) {
        fputs("Error opening fastio$ driver...\n",stderr);
        fputs("Please install xf86sup.sys in config.sys!\n",stderr);
        return rc;
    }

    param = pid;

    if ((rc=DosDevIOCtl(hfd, (ULONG)0x76, (ULONG)0x65,
                        (PULONG*)&param,sizeof(USHORT),&plen,
                        NULL, 0, NULL)) != 0) {
        fprintf(stderr,"fastio$ driver: kill(%i,9) failed rc=%i\n",pid,rc);
        DosClose(hfd);
        return rc;
    }
    DosClose(hfd);
    return 0;
}
开发者ID:hadogenes,项目名称:halter,代码行数:29,代码来源:deathapi.c

示例9: main

void main()
{
    USHORT rc, Action;
    HFILE FileHandle;

    DosSetSigHandler(BrkHandler, NULL, NULL, SIGA_ACCEPT, SIG_CTRLC);
    DosSetSigHandler(BrkHandler, NULL, NULL, SIGA_ACCEPT, SIG_KILLPROCESS);
    DosSetSigHandler(BrkHandler, NULL, NULL, SIGA_ACCEPT, SIG_CTRLBREAK);

    DosSetPrty(PRTYS_PROCESS, PRTYC_IDLETIME, 0, 0);

    rc = DosOpen("Idlehlt$", &FileHandle, &Action, 0L,
                 FILE_NORMAL, FILE_OPEN, OPEN_SHARE_DENYNONE, 0L);

    if(!rc) {
        while(!ExitWhile)
            DosDevIOCtl(NULL, NULL, 0x01, 0x91, FileHandle);
        DosClose(FileHandle);
    } else {
        char buf[6], Message[36] = "HLT Driver not installed? rc=";
        char *src = buf, *dst = &Message[29];
        int len;

        utoa(rc, buf, 10);
        while(*dst++ = *src++);
        len = dst - Message;
        Message[len-1] = '\r';
        Message[len] = '\n';

        DosWrite(STDERR_FILENO, Message, len+1, &Action);
    }
}
开发者ID:OS2World,项目名称:DRV-IDLEHLT16,代码行数:32,代码来源:idlehlt.c

示例10: _dos_open

_WCRTLINK unsigned _dos_open( const char *name, unsigned mode, int *handle )
{
    APIRET      rc;
    OS_UINT     rwmode, actiontaken, openmode;
    HFILE       fhandle;
    int         share;
    unsigned    iomode_flags;

    while( *name == ' ' ) ++name;
    rwmode = mode & OPENMODE_ACCESS_MASK;
    if( rwmode == OPENMODE_ACCESS_WRONLY
#if defined(__OS2_286__)
        && !_RWD_osmode
        /* Can't open WRONLY file in bound application under DOS */
#endif
        ) {
        rwmode = OPENMODE_ACCESS_RDWR;
    }
    share = mode & OPENMODE_SHARE_MASK;
    if( share == OPENMODE_DENY_COMPAT ) {
        share = OPENMODE_DENY_NONE;
    }
    openmode = share+rwmode;
    rc = DosOpen( (PSZ)name, &fhandle, &actiontaken, 0ul,
        _A_NORMAL, OPENFLAG_OPEN_IF_EXISTS, openmode, 0ul );
    if( rc ) {
        return( __set_errno_dos_reterr( rc ) );
    }
    *handle = fhandle;
    if( rwmode == O_RDWR ) iomode_flags = _READ | _WRITE;
    if( rwmode == O_RDONLY) iomode_flags = _READ;
    if( rwmode == O_WRONLY) iomode_flags = _WRITE;
    __SetIOMode( fhandle, iomode_flags );
    return( 0 );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:35,代码来源:fileos2.c

示例11: os2err

void *__PHYSFS_platformOpenAppend(const char *filename)
{
    ULONG dummy = 0;
    HFILE hfile = NULLHANDLE;
    APIRET rc;

    /*
     * File must be opened SHARE_DENYWRITE and ACCESS_READWRITE, otherwise
     *  DosQueryFileInfo() will fail if we try to get a file length, etc.
     */
    rc = os2err(DosOpen(filename, &hfile, &dummy, 0, FILE_NORMAL,
                   OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW,
                   OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_LOCALITY |
                   OPEN_FLAGS_NOINHERIT | OPEN_SHARE_DENYWRITE |
                   OPEN_ACCESS_READWRITE, NULL));

    if (rc == NO_ERROR)
    {
        if (os2err(DosSetFilePtr(hfile, 0, FILE_END, &dummy)) != NO_ERROR)
        {
            DosClose(hfile);
            hfile = NULLHANDLE;
        } /* if */
    } /* if */

    return((void *) hfile);
} /* __PHYSFS_platformOpenAppend */
开发者ID:UIKit0,项目名称:paragui,代码行数:27,代码来源:os2.c

示例12: Krnl_Debug_Log

// Title и String - строки, которые надо записать.
VOID Krnl_Debug_Log( PCHAR Title, PCHAR String )
{
 // Если файла нет - создаем его.
 HFILE File = NULLHANDLE; ULONG Report = 0; ULONG New_size = 0; PEAOP2 EAs = NULL;

 ULONG Action = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
 ULONG Mode = OPEN_FLAGS_FAIL_ON_ERROR | OPEN_SHARE_DENYWRITE | OPEN_ACCESS_WRITEONLY;

 CHAR Log_file_name[ SIZE_OF_PATH ] = "";
 GetCurrentPath( Log_file_name ); strcat( Log_file_name, "\\_log.txt" );

 DosOpen( Log_file_name, &File, &Report, New_size, FILE_COMMON_ATTRIBUTES, Action, Mode, EAs );

 // Записываем строку.
 if( Report != FILE_CREATED )
  {
   DosSetFilePtr( File, 0, FILE_END, &Report );
   DosWrite( File, "\n", strlen( "\n" ), &Report );
  }

 if( Title[ 0 ] != 0 )
  {
   DosWrite( File, Title, strlen( Title ), &Report );
   DosWrite( File, ": ", strlen( ": " ), &Report );
  }

 DosWrite( File, String, strlen( String ), &Report );

 // Закрываем файл.
 DosClose( File ); File = NULLHANDLE;

 // Возврат.
 return;
}
开发者ID:OS2World,项目名称:UTIL-WPS-Nice_OS2_Enhancer,代码行数:35,代码来源:Debug_code.cpp

示例13: CreateFile

HFILE CreateFile(int iNr)
{
BYTE szFileName[20];
HFILE hFile;
#ifdef __IBMC__
APIRET rc;
ULONG ulAction;
#else
USHORT rc;
USHORT ulAction;
#endif

   sprintf(szFileName, "FILE%4.4u.DAT", iNr);

   rc = DosOpen(szFileName,
      &hFile,
      &ulAction,
      0L, /* new size */
      0,  /* attributes */
      FILE_CREATE | FILE_TRUNCATE,
      OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE,
      0L);
   if (rc)
      {
      printf("DosOpen on %s failed, rc = %u\n", szFileName, rc);
      getch();
      return 0;
      }

   return hFile;
}
开发者ID:OS2World,项目名称:DRV-FAT32,代码行数:31,代码来源:mfile.c

示例14: DosClose

char *ParsePortSpec( char * *spec )
{
    char        *parm;
    ULONG       action;
    char        port;
    static char name[] = "com?";

    parm = (spec == NULL) ? "" : *spec;

    port = '1';
    if( *parm >= '1' && *parm <= '9' ) {
        port = *parm++;
    }
    if( *parm != '\0' && *parm != '.' ) return( TRP_ERR_invalid_serial_port_number );
    if( spec != NULL ) *spec = parm;
    if( ComPort != 0 ) {
        DosClose( ComPort );
        ComPort = 0;
    }
    name[sizeof( name ) - 2] = port;
    if( DosOpen( (PSZ)name, &ComPort, &action, 0, 0, 1, 0x12, 0 ) ) {
        ComPort = 0;
        return( TRP_ERR_serial_port_not_available );
    }
    return( NULL );
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:26,代码来源:seros22.c

示例15: while

char far *InitAlias( char far * inname )
/**************************************/
{
    USHORT hdl,read;
    static char b[80];
    char *bp;
    unsigned long ppos,pos;
    USHORT action;
    char far *endname;
    static char noalias = 0;

    endname = inname;
    while( *endname == ' ' ) ++endname;
    for( ;; ) {
        if( *endname == '\0' ) {
            break;
        }
        if( *endname == ' ' ) {
            *endname = '\0';
            ++endname;
            break;
        }
        ++endname;
    }
    bp = b;
    while( *bp = *inname ) {
        ++bp;
        ++inname;
    }
    action=action;
    if( DosOpen( b, &hdl, &action, 0L, 0, 1, 0x10 ,0L ) == 0 ) {
        DosChgFilePtr( hdl, 0L, 2, &ppos );
        pos = ppos;
        DosChgFilePtr( hdl, 0L, 0, &ppos );
#ifdef DOS
        {
            static int alias_seg;
            DosAllocSeg( pos + 1 + ALIAS_SLACK, &alias_seg, 0 );
            *(((int far *)&AliasList)+0) = 0;
            *(((int far *)&AliasList)+1) = alias_seg;
            AliasSize = pos + ALIAS_SLACK;
        }
#else
        AliasList = AliasArea;
        AliasSize = 2047;
#endif
        DosRead( hdl, AliasList, pos, &read );
        if( pos > 0 && AliasList[ pos-1 ] != '\n' ) {
            AliasList[ pos+0 ] = '\r';
            AliasList[ pos+1 ] = '\n';
            AliasList[ pos+2 ] = '\0';
        } else {
            AliasList[ pos ] = '\0';
        }
        DosClose( hdl );
    } else {
        AliasList = &noalias;
    }
    return( endname );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:60,代码来源:cmdalias.c


注:本文中的DosOpen函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。