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


C++ DosQueryPathInfo函数代码示例

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


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

示例1: OK

static MRESULT APIENTRY OK ( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) {

 /***************************************************************************
  * Find the instance data.                                                 *
  ***************************************************************************/

  PPROFILE_PARMS Parms = PPROFILE_PARMS ( WinQueryWindowPtr ( hwnd, QWL_USER ) ) ;

 /***************************************************************************
  * Verify the entered path.                                                *
  ***************************************************************************/

  BYTE Name [256] ;
  WinQueryDlgItemText ( hwnd, Parms->id+ENTRY, sizeof(Name), Name ) ;

  BYTE FullPath [256] ;
  if ( DosQueryPathInfo ( Name, FIL_QUERYFULLNAME, FullPath, sizeof(FullPath) ) ) {
    PSZ Message = PSZ ( "ERROR: Not a valid path." ) ;
    WinSetDlgItemText ( hwnd, Parms->id+ERR, Message ) ;
    WinAlarm ( HWND_DESKTOP, WA_ERROR ) ;
    WinSetFocus ( HWND_DESKTOP, WinWindowFromID ( hwnd, Parms->id+ENTRY ) ) ;
    return ( 0 ) ;
  }

  FILESTATUS3 Status ;
  if ( DosQueryPathInfo ( FullPath, FIL_STANDARD, &Status, sizeof(Status) ) ) {
    PSZ Message = PSZ ( "ERROR: Path does not exist." ) ;
    WinSetDlgItemText ( hwnd, Parms->id+ERR, Message ) ;
    WinAlarm ( HWND_DESKTOP, WA_ERROR ) ;
    WinSetFocus ( HWND_DESKTOP, WinWindowFromID ( hwnd, Parms->id+ENTRY ) ) ;
    return ( 0 ) ;
  }

  if ( ! ( Status.attrFile & FILE_DIRECTORY ) ) {
    PSZ Message = PSZ ( "ERROR: Specified path is not a directory." ) ;
    WinSetDlgItemText ( hwnd, Parms->id+ERR, Message ) ;
    WinAlarm ( HWND_DESKTOP, WA_ERROR ) ;
    WinSetFocus ( HWND_DESKTOP, WinWindowFromID ( hwnd, Parms->id+ENTRY ) ) ;
    return ( 0 ) ;
  }

 /***************************************************************************
  * Return the full path to the caller.                                     *
  ***************************************************************************/

  strncpy ( PCHAR(Parms->Path), PCHAR(FullPath), Parms->PathSize ) ;

 /***************************************************************************
  * Dismiss the dialog with a TRUE status.                                  *
  ***************************************************************************/

  WinDismissDlg ( hwnd, TRUE ) ;

  return ( 0 ) ;
}
开发者ID:OS2World,项目名称:APP-CLOCK-Clock,代码行数:55,代码来源:PROFILE.CPP

示例2: InitializeXPIStub

APIRET InitializeXPIStub()
{
  char szBuf[MAX_BUF];
  char szXPIStubFile[MAX_BUF];

  hXPIStubInst = NULL;

  /* get full path to xpistub.dll */
  if(DosQueryPathInfo("xpistub.dll", sizeof(szXPIStubFile), szXPIStubFile, NULL) == FALSE)
    PrintError("File not found: xpistub.dll", ERROR_CODE_SHOW, 2);

  /* load xpistub.dll */
  if((DosLoadModule(&szBuf, sizeof(szBuf), szXPIStubFile, &hXPIStubInst)) != NO_ERROR)
  {
    sprintf(szBuf, "Error loading library: %s\n", szXPIStubFile);
    PrintError(szBuf, ERROR_CODE_SHOW, 1);
  }
  if((pfnXpiInit = DosQueryProcAddr(hXPIStubInst, 1L, NULL,"XPI_Init")) == NULL)
  {
    sprintf(szBuf, "DosQueryProcAddr() failed: XPI_Init\n");
    PrintError(szBuf, ERROR_CODE_SHOW, 1);
  }
  if((pfnXpiInstall = DosQueryProcAddr(hXPIStubInst, 1L, NULL,"XPI_Install")) == NULL)
  {
    sprintf(szBuf, "DosQueryProcAddr() failed: XPI_Install\n");
    PrintError(szBuf, ERROR_CODE_SHOW, 1);
  }
  if((pfnXpiExit = DosQueryProcAddr(hXPIStubInst, 1L, NULL,"XPI_Exit")) == NULL)
  {
    sprintf(szBuf, "DosQueryProcAddr() failed: XPI_Exit\n");
    PrintError(szBuf, ERROR_CODE_SHOW, 1);
  }

  return(0);
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:35,代码来源:xpi.c

示例3: __F_NAME

_WCRTLINK int __F_NAME(access,_waccess)( const CHAR_TYPE *path, int pmode )
{
    APIRET          rc;
    OS_UINT         attr;
#ifndef _M_I86
    FILESTATUS3     fs;
#endif
#ifdef __WIDECHAR__
    char            mbPath[MB_CUR_MAX * _MAX_PATH]; /* single-byte char */

    if( wcstombs( mbPath, path, sizeof( mbPath ) ) == -1 ) {
        mbPath[0] = '\0';
    }
#endif
#ifdef _M_I86
    rc = DosQFileMode( (PSZ)__F_NAME(path,mbPath), &attr, 0 );
#else
    rc = DosQueryPathInfo( (PSZ)__F_NAME(path,mbPath), FIL_STANDARD, &fs, sizeof( fs ) );
    attr = fs.attrFile;
#endif
    if( rc ) {
        return( __set_errno_dos( rc ) );
    }
    if( (pmode & ACCESS_WR) && (attr & _A_RDONLY) ) {
        return( __set_errno_dos( ERROR_ACCESS_DENIED ) );   /* invalid access mode */
    }
    return( 0 );
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:28,代码来源:accssos2.c

示例4: _PR_MD_GETFILEINFO64

PRInt32
_PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info)
{
    PRFileInfo info32;
    PRInt32 rv = _PR_MD_GETFILEINFO(fn, &info32);
    if (rv != 0)
    {
        return rv;
    }
    info->type = info32.type;
    LL_UI2L(info->size,info32.size);
    info->modifyTime = info32.modifyTime;
    info->creationTime = info32.creationTime;
    
    if (isWSEB)
    {
        APIRET rc ;
        FILESTATUS3L fstatus;

        rc = DosQueryPathInfo(fn, FIL_STANDARDL, &fstatus, sizeof(fstatus));

        if (NO_ERROR != rc)
        {
            _PR_MD_MAP_OPEN_ERROR(rc);
            return -1;
        }

        if (! (fstatus.attrFile & FILE_DIRECTORY))
        {
            info->size = fstatus.cbFile;
        }
    }

    return rv;
}
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:35,代码来源:os2io.c

示例5: CopyFile

BOOL CopyFile(char szSourceSpec[],char szDestSpec[])
  {
  FILESTATUS3 stFileStatus;
  APIRET rc;

  if ((rc = DosCopy(szSourceSpec,szDestSpec,DCPY_EXISTING)) != NO_ERROR)
    {
    if (rc == ERROR_ACCESS_DENIED)
      {
      if (DosQueryPathInfo(szDestSpec,1,&stFileStatus,sizeof(FILESTATUS3)) == NO_ERROR)
        {
        if (stFileStatus.attrFile & FILE_HIDDEN)
          {
          stFileStatus.attrFile &= ~FILE_HIDDEN;
          DosSetPathInfo(szDestSpec,1,&stFileStatus,sizeof(FILESTATUS3),0);
          if ((rc = DosCopy(szSourceSpec,szDestSpec,DCPY_EXISTING)) != NO_ERROR)
            return(FALSE);
          }
        }
      else
        return(FALSE);
      }
    else
      return(FALSE);
    }
  ClearReadOnly(szDestSpec);
  return(TRUE);
  }
开发者ID:OS2World,项目名称:APP-COMM-ComScope,代码行数:28,代码来源:page.c

示例6: get_ea_size

unsigned int get_ea_size(char *name)
{
 #if TARGET==OS2
  #ifdef __32BIT__
   FILESTATUS4 fs;
  #else
   FILESTATUS2 fs;
  #endif
  unsigned int rc;

  #ifdef __32BIT__
   DosQueryPathInfo(name, FIL_QUERYEASIZE, (PVOID)&fs, sizeof(fs));
  #else
   DosQPathInfo(name, FIL_QUERYEASIZE, (PVOID)&fs, sizeof(fs), 0L);
  #endif
  rc=(fs.cbList>=4)?fs.cbList-4:fs.cbList;
  #ifdef __32BIT__
   rc>>=1;                             /* BUGBUG? */
  #endif
  return(rc);
 #elif TARGET==WIN32
  struct nt_sid *sid;
  unsigned long rc;

  if(!ea_supported||(sid=open_streams(name, 0))==NULL)
   return(0);
  rc=seek_stream_id(BACKUP_EA_DATA, sid);
  close_streams(sid);
  return((rc>0xFFFF)?0:rc);
 #else
  return(0);
 #endif
}
开发者ID:OPSF,项目名称:uClinux,代码行数:33,代码来源:ea_mgr.c

示例7: CMD_DosQueryPathInfo

//---------------------------- CMD_DosQueryPathInfo ----------------------------
void CMD_DosQueryPathInfo(HFILE hFile,LXIOCPA_DMN_CMDPARMPACKET* pParam
                          ,PLXDOSQUERYPATHINFOSTRUCT pi)
{
 pParam->rc=DosQueryPathInfo(pi->pathName,pi->ulInfoLevel
                             ,&pi->LXDOSQUERYPATHINFOUNION.fileStatus3
                             ,pi->cbInfoBuf);
}
开发者ID:OS2World,项目名称:DRV-LXAPI32,代码行数:8,代码来源:lxapid_cmd.c

示例8: os2Access

/*
** Check the existance and status of a file.
*/
static int os2Access(
  sqlite3_vfs *pVfs,        /* Not used on os2 */
  const char *zFilename,    /* Name of file to check */
  int flags,                /* Type of test to make on this file */
  int *pOut                 /* Write results here */
){
  FILESTATUS3 fsts3ConfigInfo;
  APIRET rc = NO_ERROR;
  char *zFilenameCp = convertUtf8PathToCp( zFilename );

  memset( &fsts3ConfigInfo, 0, sizeof(fsts3ConfigInfo) );
  rc = DosQueryPathInfo( (PSZ)zFilenameCp, FIL_STANDARD,
                         &fsts3ConfigInfo, sizeof(FILESTATUS3) );
  free( zFilenameCp );
  OSTRACE4( "ACCESS fsts3ConfigInfo.attrFile=%d flags=%d rc=%d\n",
            fsts3ConfigInfo.attrFile, flags, rc );
  switch( flags ){
    case SQLITE_ACCESS_READ:
    case SQLITE_ACCESS_EXISTS:
      rc = (rc == NO_ERROR);
      OSTRACE3( "ACCESS %s access of read and exists  rc=%d\n", zFilename, rc );
      break;
    case SQLITE_ACCESS_READWRITE:
      rc = (rc == NO_ERROR) && ( (fsts3ConfigInfo.attrFile & FILE_READONLY) == 0 );
      OSTRACE3( "ACCESS %s access of read/write  rc=%d\n", zFilename, rc );
      break;
    default:
      assert( !"Invalid flags argument" );
  }
  *pOut = rc;
  return SQLITE_OK;
}
开发者ID:erik-knudsen,项目名称:eCos-enhancements,代码行数:35,代码来源:os_os2.c

示例9: __PHYSFS_platformIsDirectory

int __PHYSFS_platformIsDirectory(const char *fname)
{
    FILESTATUS3 fs;
    APIRET rc = DosQueryPathInfo(fname, FIL_STANDARD, &fs, sizeof (fs));
    BAIL_IF_MACRO(os2err(rc) != NO_ERROR, NULL, 0)
    return((fs.attrFile & FILE_DIRECTORY) != 0);
} /* __PHYSFS_platformIsDirectory */
开发者ID:UIKit0,项目名称:paragui,代码行数:7,代码来源:os2.c

示例10: CompareFileDate

USHORT CompareFileDate(char szSourceFileSpec[],char szDestFileSpec[])
  {
  FILESTATUS3 stFileInfo;
  FDATE fdateSourceCreation;
  char szMessage[200];
  char szCaption[40];
  APIRET rc;

  DosQueryPathInfo(szSourceFileSpec,1,&stFileInfo,sizeof(FILESTATUS3));
  fdateSourceCreation = stFileInfo.fdateCreation;
  if ((rc = DosQueryPathInfo(szDestFileSpec,1,&stFileInfo,sizeof(FILESTATUS3))) == NO_ERROR)
    {
    if (fdateSourceCreation.year > stFileInfo.fdateCreation.year)
      return(MBID_YES);
    else
      if (fdateSourceCreation.year == stFileInfo.fdateCreation.year)
        if (fdateSourceCreation.month > stFileInfo.fdateCreation.month)
          return(MBID_YES);
        else
          if (fdateSourceCreation.month == stFileInfo.fdateCreation.month)
            if (fdateSourceCreation.day >= stFileInfo.fdateCreation.day)
              return(MBID_YES);
    sprintf(szMessage,"%s is the same, or newer, version than the file to be installed.\n\nDo you want to replace it?",szDestFileSpec);
    sprintf(szCaption,"Newer file exists!");
    return(WinMessageBox(HWND_DESKTOP,HWND_DESKTOP,szMessage,szCaption,
                         HLPP_MB_OLD_FILE,
                        (MB_MOVEABLE | MB_HELP | MB_YESNOCANCEL | MB_ICONQUESTION)));
    }
  else
    {
    if (rc == ERROR_SHARING_VIOLATION)
      {
      sprintf(szMessage,"%s is currently in open by another process.\n\nPlease correct and reinstall.",szDestFileSpec);
      sprintf(szCaption,"File Currently in Use!");
      WinMessageBox(HWND_DESKTOP,
                    HWND_DESKTOP,
                    szMessage,
                    szCaption,
                    HLPP_MB_FILE_INUSE,
                   (MB_MOVEABLE | MB_OK | MB_HELP));
      return(MBID_CANCEL);
      }
    }
  return(MBID_NO);
  }
开发者ID:OS2World,项目名称:APP-COMM-ComScope,代码行数:45,代码来源:page.c

示例11: fmFileSize

/* --------------------------------------------------------------------------
 Return the size of a file.
- Parameters -------------------------------------------------------------
 PSZ pszFile : file name.
- Return value -----------------------------------------------------------
 LONGLONG : file size or -1 in case of error.
-------------------------------------------------------------------------- */
LONGLONG fmFileSize(PSZ pszFile) {
   FILESTATUS3L fs;

   g.rc = DosQueryPathInfo(pszFile, FIL_STANDARDL, &fs, sizeof(fs));
   if (g.rc == NO_ERROR) return fs.cbFile;

   handleFileIOError(0, SZERR_FILESIZE2, pszFile, g.rc);
   return -1LL;
}
开发者ID:OS2World,项目名称:UTIL-FILE-FSJ,代码行数:16,代码来源:utils.c

示例12: Q_FileType

int Q_FileType (const char *path)
{
	FILESTATUS3 fs;
	APIRET rc = DosQueryPathInfo(path, FIL_STANDARD, &fs, sizeof(fs));
	if (rc != NO_ERROR) return FS_ENT_NONE;
	if (fs.attrFile & FILE_DIRECTORY)
		return FS_ENT_DIRECTORY;
	return FS_ENT_FILE;
}
开发者ID:svn2github,项目名称:uhexen2,代码行数:9,代码来源:util_io.c

示例13: hb_fsFileExists

HB_BOOL hb_fsFileExists( const char * pszFileName )
{
   HB_BOOL fExist = HB_FALSE;

   HB_TRACE( HB_TR_DEBUG, ( "hb_fsFileExists(%p)", pszFileName ) );

   if( pszFileName != NULL )
   {
#if defined( HB_OS_WIN )
      LPTSTR lpFree;
      LPCTSTR lpFileName = HB_FSNAMECONV( pszFileName, &lpFree );
      DWORD dwAttr;

      dwAttr = GetFileAttributes( lpFileName );
      fExist = ( dwAttr != INVALID_FILE_ATTRIBUTES ) &&
               ( dwAttr & ( FILE_ATTRIBUTE_DIRECTORY |
                            FILE_ATTRIBUTE_DEVICE ) ) == 0;

      if( lpFree )
         hb_xfree( lpFree );
#else
      char * pszFree = NULL;

      pszFileName = hb_fsNameConv( pszFileName, &pszFree );

      {
#  if defined( HB_OS_DOS )
#     if defined( __DJGPP__ ) || defined( __BORLANDC__ )
         int iAttr = _chmod( pszFileName, 0, 0 );
         fExist = iAttr != -1 && ( iAttr & 0x10 ) == 0;
#     else
         unsigned int iAttr = 0;
         fExist = _dos_getfileattr( pszFileName, &iAttr ) == 0 &&
                  ( iAttr & 0x10 ) == 0;
#     endif
#  elif defined( HB_OS_OS2 )
         FILESTATUS3 fs3;
         fExist = DosQueryPathInfo( ( PCSZ ) pszFileName, FIL_STANDARD,
                                    &fs3, sizeof( fs3 ) ) == NO_ERROR &&
                  ( fs3.attrFile & FILE_DIRECTORY ) == 0;
#  elif defined( HB_OS_UNIX )
         struct stat statbuf;

         fExist = stat( pszFileName, &statbuf ) == 0 &&
                  S_ISREG( statbuf.st_mode );
#  else
         int iTODO; /* To force warning */
#  endif
      }

      if( pszFree )
         hb_xfree( pszFree );
#endif
   }

   return fExist;
}
开发者ID:CsBela,项目名称:core,代码行数:57,代码来源:hbfsapi.c

示例14: Q_filesize

long Q_filesize (const char *path)
{
	FILESTATUS3 fs;
	APIRET rc = DosQueryPathInfo(path, FIL_STANDARD, &fs, sizeof(fs));
	if (rc != NO_ERROR) return -1;
	if (fs.attrFile & FILE_DIRECTORY)
		return -1;
	return (long)fs.cbFile;
}
开发者ID:svn2github,项目名称:uhexen2,代码行数:9,代码来源:util_io.c

示例15: LocalGetFileAttr

long LocalGetFileAttr( char *name )
/*********************************/
{
    FILESTATUS3 fileinfo;

    if( DosQueryPathInfo( name, FIL_STANDARD, &fileinfo, sizeof( fileinfo ) ) ) {
        return( -1 );
    }
    return( fileinfo.attrFile );
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:10,代码来源:localos2.c


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