您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DosGetInfoBlocks函数代码示例

51自学网 2021-06-01 20:29:33
  C++
这篇教程C++ DosGetInfoBlocks函数代码示例写得很实用,希望能帮到您。

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

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

示例1: __PHYSFS_platformGetThreadID

PHYSFS_uint64 __PHYSFS_platformGetThreadID(void){    PTIB ptib;    PPIB ppib;    /*     * Allegedly, this API never fails, but we'll punt and return a     *  default value (zero might as well do) if it does.     */    BAIL_IF_MACRO(os2err(DosGetInfoBlocks(&ptib, &ppib)) != NO_ERROR, 0, 0);    return((PHYSFS_uint64) ptib->tib_ordinal);} /* __PHYSFS_platformGetThreadID */
开发者ID:UIKit0,项目名称:paragui,代码行数:12,


示例2: _sendQuery

static BOOL _sendQuery(PGROPDATA pGrop, PGROPQUERY pQuery, BOOL fPrivateEvSem){  ULONG      ulRC;  BOOL       fSuccess;  PTIB       tib;  PPIB       pib;  DosGetInfoBlocks( &tib, &pib );  if ( tib->tib_ptib2->tib2_ultid == pGrop->tid )  {    // Query send from callback function.    debug( "Query send from callback function." );    pQuery->hevReady = NULLHANDLE;    _wmGropQuery( pGrop, pQuery );    return pQuery->fSuccess;/*    return (BOOL)WinSendMsg( pGrop->hwnd, WM_GROP_QUERY, MPFROMP( pQuery ), 0 )             && pQuery->fSuccess;*/  }  if ( fPrivateEvSem )  {    ulRC = DosCreateEventSem( NULL, &pQuery->hevReady, 0, FALSE );    if ( ulRC != NO_ERROR )    {      debug( "DosCreateEventSem(), rc = %u.", ulRC );      return FALSE;    }  }  else    pQuery->hevReady = pGrop->hevReady;  fSuccess = WinPostMsg( pGrop->hwnd, WM_GROP_QUERY, MPFROMP( pQuery ), 0 );  if ( !fSuccess )  {    debug( "WinPostMsg() failed" );  }  else  {    ulRC = DosWaitEventSem( pQuery->hevReady, 3000 );    if ( ulRC != NO_ERROR )    {      debug( "DosWaitEventSem(), rc = %u.", ulRC );    }    fSuccess = pQuery->fSuccess;  }  if ( fPrivateEvSem )    DosCloseEventSem( pQuery->hevReady );  return fSuccess;}
开发者ID:OS2World,项目名称:LIB-SDL-2014,代码行数:52,


示例3: os2MutexNotheld

static int os2MutexNotheld(sqlite3_mutex *p){  TID tid;  PID pid;  ULONG ulCount;  PTIB ptib;  if( p!= 0 ) {    DosQueryMutexSem(p->mutex, &pid, &tid, &ulCount);  } else {    DosGetInfoBlocks(&ptib, NULL);    tid = ptib->tib_ptib2->tib2_ultid;  }  return p==0 || p->nRef==0 || p->owner!=tid;}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:13,


示例4: DosGetInfoBlocks

static unsigned char *get_cmdline( void )   {   PTIB            ptib;   PPIB            ppib;   /* Get a pointer to the first through n arguments that were entered on     */   /* the command line.                                                       */   DosGetInfoBlocks( &ptib, &ppib );   return (ppib->pib_pchcmd);   }
开发者ID:OS2World,项目名称:DEV-SAMPLES-WorkFrame2,代码行数:13,


示例5: morph

void morph(void){PPIB ppib = NULL;PTIB ptib = NULL;APIRET rc;	rc = DosGetInfoBlocks(&ptib,&ppib);	if (rc != NO_ERROR)		{		printf("DosGetInfoBlocks Error : %d/n",rc);		exit(-1);		}	ppib->pib_ultype = 3;}
开发者ID:komh,项目名称:hanedit2,代码行数:14,


示例6: return

    static char *OS_GET_CMD_LINE( void )    {        PTIB    tib;        PPIB    pib;        char    *cmd;        if( DosGetInfoBlocks(&tib, &pib) )            return( NULL );        cmd = pib->pib_pchcmd;        while( *cmd ) ++cmd;    /* skip over second copy of program name */        ++cmd;        return( cmd );    }
开发者ID:NoSuchProcess,项目名称:open-watcom-v2,代码行数:14,


示例7: EnumConfigPaths

bool EnumConfigPaths(char *Path,int Number){#ifdef _EMX  static char RARFileName[NM];  if (Number==-1)    strcpy(RARFileName,Path);  if (Number!=0)    return(false);  if (_osmode==OS2_MODE)  {    PTIB ptib;    PPIB ppib;    DosGetInfoBlocks(&ptib, &ppib);    DosQueryModuleName(ppib->pib_hmte,NM,Path);  }  else    strcpy(Path,RARFileName);  RemoveNameFromPath(Path);  return(true);#elif defined(_UNIX)  if (Number==0)  {    char *EnvStr=getenv("HOME");    if (EnvStr==NULL)      return(false);    strncpy(Path,EnvStr,NM);    Path[NM-1]=0;    return(true);  }  static const char *AltPath[]={    "/etc","/usr/lib","/usr/local/lib","/usr/local/etc"  };  Number--;  if (Number<0 || Number>=(int)(sizeof(AltPath)/sizeof(AltPath[0])))    return(false);  strcpy(Path,AltPath[Number]);  return(true);#elif defined(_WIN_32)  if (Number!=0)    return(false);#if !defined(_LINUX)  GetModuleFileName(NULL,Path,NM);  RemoveNameFromPath(Path);#endif  return(true);#else  return(false);#endif}
开发者ID:1ibraheem,项目名称:xbmc,代码行数:49,


示例8: enable_os2_iostreams

  static  void  enable_os2_iostreams( void )  {    PTIB  thread_block;    PPIB  process_block;    /* XXX : This is a very nasty hack, it fools OS/2 and let the program */    /*       call PM functions, even though stdin/stdout/stderr are still */    /*       directed to the standard i/o streams..                       */    /*       The program must be compiled with WINDOWCOMPAT               */    /*                                                                    */    /*   Credits go to Michal for finding this !!                         */    /*                                                                    */    DosGetInfoBlocks( &thread_block, &process_block );    process_block->pib_ultype = 3;  }
开发者ID:Frankie-666,项目名称:color-emoji.freetype2-demos,代码行数:16,


示例9: getSGID

ULONG APIENTRY getSGID( VOID ){    PQTOPLEVEL  pQTopLevel = ( PQTOPLEVEL )m_achSysState;    PPIB        ppib;    if( m_ulSGID != ( ULONG )-1 )        return m_ulSGID;    DosGetInfoBlocks( NULL, &ppib );    DosQuerySysState( 0x01, 0, ppib->pib_ulpid, 1, pQTopLevel, BUF_SIZE );    m_ulSGID = pQTopLevel->procdata->sessid;    return m_ulSGID;}
开发者ID:OS2World,项目名称:UTIL-SHELL-KShell,代码行数:16,


示例10: archdep_init

int archdep_init(int *argc, char **argv){    /* This is right way to do this in OS/2 (not via argv[0]) */    TIB *pTib;    PIB *pPib;    DosGetInfoBlocks(&pTib, &pPib);    DosQueryModuleName(pPib->pib_hmte, CCHMAXPATH, argv0);    orig_workdir = (char *)getcwd(NULL, CCHMAXPATH);    atexit(restore_workdir);    PM_open();#if !defined __X1541__ && !defined __PETCAT__    archdep_create_mutex_sem(&hmtxSpawn, "Spawn", FALSE);#endif    return 0;}
开发者ID:BigBoss21X,项目名称:vice-emu,代码行数:20,


示例11: init_pm

int init_pm(void){    PPIB pib;    PTIB tib;    APIRET rc;    HMODULE hMte = 0;    char loadErr[256];    if(hab || hmq)        return 0;    rc = DosGetInfoBlocks(&tib, &pib);    rc = DosQueryModuleHandle("PMWIN", &hMte);    if(rc)        return 1;    pib->pib_ultype = 3;    rc = DosLoadModule(loadErr, sizeof(loadErr), "PMWIN", &hMte);    if(rc)        return 1;    rc = DosQueryProcAddr(hMte, 707, 0, (PFN*)&_inCloseClipbrd);    rc = DosQueryProcAddr(hMte, 716, 0, (PFN*)&_inCreateMsgQueue);    rc = DosQueryProcAddr(hMte, 726, 0, (PFN*)&_inDestroyMsgQueue);    rc = DosQueryProcAddr(hMte, 733, 0, (PFN*)&_inEmptyClipbrd);    rc = DosQueryProcAddr(hMte, 763, 0, (PFN*)&_inInitialize);    rc = DosQueryProcAddr(hMte, 793, 0, (PFN*)&_inOpenClipbrd);    rc = DosQueryProcAddr(hMte, 806, 0, (PFN*)&_inQueryClipbrdData);    rc = DosQueryProcAddr(hMte, 807, 0, (PFN*)&_inQueryClipbrdFmtInfo);    rc = DosQueryProcAddr(hMte, 854, 0, (PFN*)&_inSetClipbrdData);    rc = DosQueryProcAddr(hMte, 888, 0, (PFN*)&_inTerminate);    hab = _inInitialize(0);    hmq = _inCreateMsgQueue(hab, 0);    return 0;}
开发者ID:OS2World,项目名称:UTIL-CLIPBOARD-Clip,代码行数:41,


示例12: __objc_thread_get_priority

/* Return the current thread's priority. */int__objc_thread_get_priority(void){  PTIB ptib;  PPIB ppib;  /* get information about current thread */  DosGetInfoBlocks (&ptib,&ppib);  switch (ptib->tib_ptib2->tib2_ulpri)    {    case PRTYC_IDLETIME:    case PRTYC_REGULAR:    case PRTYC_TIMECRITICAL:    case PRTYC_FOREGROUNDSERVER:    default:      return OBJC_THREAD_INTERACTIVE_PRIORITY;    }  return -1;}
开发者ID:DJHartley,项目名称:iphone-dev,代码行数:22,


示例13: RTSysInit

unsigned        RTSysInit( void ) {//===========================    if( RTSysInitialized ) return( 0 );#if defined( __OS2__ ) && defined( __386__ )    {        #define INCL_DOSPROCESS        #include <os2.h>        TIB     *ptib;        PIB     *ppib;        DosGetInfoBlocks( &ptib, &ppib );        if( ppib->pib_ultype == 3 ) {            if( _WindowsStdout == 0 ) {                __FAppType = FAPP_GUI;            } else {                __FAppType = FAPP_DEFAULT_GUI;            }        }    }#elif defined( __NT__ )    {        if( _WindowsStdout != 0 ) {            __FAppType = FAPP_DEFAULT_GUI;        }    }#endif    // WATFOR-77 calls __ErrorInit() when it starts    __ErrorInit( _LpPgmName );    RTSysInitialized = 1;    __InitRTData(); // for main thread    _ExceptionInit();    // call to RTSysFini() is done in LGSysFini() for load'n go    // (i.e. we must call RTSysFini() after each time we execute, not when    // WATFOR-77 exits in case we are operating in batch mode)    atexit( &RTSysFini );    return( 0 );}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:39,


示例14: DosGetInfoBlocks

/*--------------------------------------------------------------------------------------*/ * UApm : intialize()                                                                   */*--------------------------------------------------------------------------------------*/UApm                   &UApm::initialize(void){    TIB    *ptib;                       /* Thread information block */    PIB    *ppib;                       /* Process information block */    char   *pcTemp;                                        /* Query the fully qualified path APM/2 was loaded from.                                           Once we know the language to use we replace ".exe"                                           by e.g. "xx.msg" where xx is the NLS message file,                                           but for now we assume English as this one is shipped                                           with APM/2 for sure */    DosGetInfoBlocks(&ptib, &ppib);    DosQueryModuleName(ppib->pib_hmte, sizeof(acMessageFileUs), (PCHAR)acMessageFileUs);    pcCommandline=strdup(strchr(ppib->pib_pchcmd, '/0')+1);    pcTemp=strrchr(acMessageFileUs, '.');    if(pcTemp!=0)        strcpy(pcTemp, "Us.msg");    strcpy(acMessageFileNls, acMessageFileUs);                                        /* Query the version we're running */    DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR, ulVersion, sizeof(ulVersion));    return(*this);}
开发者ID:OS2World,项目名称:CMD-Tools,代码行数:25,


示例15: DosScanEnv

APIRET APIENTRY  DosScanEnv(PCSZ  pszName,                            PSZ  *ppszValue){  char varname[CCHMAXPATH];  PPIB pib;  PTIB tib;  int  i;  char *p, *q, *env;  /* Get application info blocks */  DosGetInfoBlocks(&tib, &pib);  /* get the environment */  env = pib->pib_pchenv;  /* search for needed env variable */  for (p = env; *p; p += strlen(p) + 1)  {    // move until '=' sign is encountered    for (i = 0, q = p; *q && *q != '=' && i < CCHMAXPATH - 1; q++, i++) ;    /* copy to name buffer  */    strncpy(varname, p, i);    /* add ending zero byte */    varname[i] = '/0';    if (!strcasecmp(varname, pszName))    {      /* variable found */      *ppszValue = q + 1;      return NO_ERROR;    }  }  return ERROR_ENVVAR_NOT_FOUND;}
开发者ID:ErisBlastar,项目名称:osfree,代码行数:37,


示例16: MyExit

void MyExit( void ){ ESP_QUE_ELEMENT  Qelement; USHORT           PidOfThisEsp; TIB             *pTib; PIB             *pPib; /****************************************************************************/ /* - If we get an error in a child probe, then we need to bring that        */ /*   probe session to the foreground and display the message.               */ /****************************************************************************/ if( IsParent() == FALSE ) {  DosGetInfoBlocks(&pTib,&pPib);  PidOfThisEsp = (USHORT)pPib->pib_ulpid;  Qelement.ChildPid = PidOfThisEsp;  if( UseExecPgm() == FALSE )   SendMsgToEspQue( ESP_QMSG_SELECT_ESP, &Qelement, sizeof(Qelement) );  DosSleep(15000); } exit(0);}
开发者ID:OS2World,项目名称:DEV-SAMPLES-The-IBM-Developer-Connection-Release-12,代码行数:24,


示例17: switch

/*** The sqlite3_mutex_alloc() routine allocates a new** mutex and returns a pointer to it.  If it returns NULL** that means that a mutex could not be allocated. ** SQLite will unwind its stack and return an error.  The argument** to sqlite3_mutex_alloc() is one of these integer constants:**** <ul>** <li>  SQLITE_MUTEX_FAST               0** <li>  SQLITE_MUTEX_RECURSIVE          1** <li>  SQLITE_MUTEX_STATIC_MASTER      2** <li>  SQLITE_MUTEX_STATIC_MEM         3** <li>  SQLITE_MUTEX_STATIC_PRNG        4** </ul>**** The first two constants cause sqlite3_mutex_alloc() to create** a new mutex.  The new mutex is recursive when SQLITE_MUTEX_RECURSIVE** is used but not necessarily so when SQLITE_MUTEX_FAST is used.** The mutex implementation does not need to make a distinction** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does** not want to.  But SQLite will only request a recursive mutex in** cases where it really needs one.  If a faster non-recursive mutex** implementation is available on the host platform, the mutex subsystem** might return such a mutex in response to SQLITE_MUTEX_FAST.**** The other allowed parameters to sqlite3_mutex_alloc() each return** a pointer to a static preexisting mutex.  Three static mutexes are** used by the current version of SQLite.  Future versions of SQLite** may add additional static mutexes.  Static mutexes are for internal** use by SQLite only.  Applications that use SQLite mutexes should** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or** SQLITE_MUTEX_RECURSIVE.**** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()** returns a different mutex on every call.  But for the static** mutex types, the same mutex is returned on every call that has** the same type number.*/static sqlite3_mutex *os2MutexAlloc(int iType){  sqlite3_mutex *p = NULL;  switch( iType ){    case SQLITE_MUTEX_FAST:    case SQLITE_MUTEX_RECURSIVE: {      p = sqlite3MallocZero( sizeof(*p) );      if( p ){        p->id = iType;        if( DosCreateMutexSem( 0, &p->mutex, 0, FALSE ) != NO_ERROR ){          sqlite3_free( p );          p = NULL;        }      }      break;    }    default: {      static volatile int isInit = 0;      static sqlite3_mutex staticMutexes[] = {        { OS2_MUTEX_INITIALIZER, },        { OS2_MUTEX_INITIALIZER, },        { OS2_MUTEX_INITIALIZER, },        { OS2_MUTEX_INITIALIZER, },        { OS2_MUTEX_INITIALIZER, },        { OS2_MUTEX_INITIALIZER, },      };      if ( !isInit ){        APIRET rc;        PTIB ptib;        PPIB ppib;        HMTX mutex;        char name[32];        DosGetInfoBlocks( &ptib, &ppib );        sqlite3_snprintf( sizeof(name), name, "//SEM32//SQLITE%04x",                          ppib->pib_ulpid );        while( !isInit ){          mutex = 0;          rc = DosCreateMutexSem( name, &mutex, 0, FALSE);          if( rc == NO_ERROR ){            int i;            if( !isInit ){              for( i = 0; i < sizeof(staticMutexes)/sizeof(staticMutexes[0]); i++ ){                DosCreateMutexSem( 0, &staticMutexes[i].mutex, 0, FALSE );              }              isInit = 1;            }            DosCloseMutexSem( mutex );          }else if( rc == ERROR_DUPLICATE_NAME ){            DosSleep( 1 );          }else{            return p;          }        }      }      assert( iType-2 >= 0 );      assert( iType-2 < sizeof(staticMutexes)/sizeof(staticMutexes[0]) );      p = &staticMutexes[iType-2];      p->id = iType;      break;    }  }  return p;//.........这里部分代码省略.........
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:101,


示例18: GetSpecialSystemDirectory

//.........这里部分代码省略.........#if defined(XP_UNIX)        case Unix_LocalDirectory:            return NS_NewNativeLocalFile(nsDependentCString("/usr/local/netscape/"),                                         true,                                         aFile);        case Unix_LibDirectory:            return NS_NewNativeLocalFile(nsDependentCString("/usr/local/lib/netscape/"),                                         true,                                         aFile);        case Unix_HomeDirectory:            return GetUnixHomeDir(aFile);        case Unix_XDG_Desktop:        case Unix_XDG_Documents:        case Unix_XDG_Download:        case Unix_XDG_Music:        case Unix_XDG_Pictures:        case Unix_XDG_PublicShare:        case Unix_XDG_Templates:        case Unix_XDG_Videos:            return GetUnixXDGUserDirectory(aSystemSystemDirectory, aFile);#endif#ifdef XP_OS2        case OS2_SystemDirectory:        {            ULONG ulBootDrive = 0;            char  buffer[] = " ://OS2//System//";            DosQuerySysInfo( QSV_BOOT_DRIVE, QSV_BOOT_DRIVE,                             &ulBootDrive, sizeof ulBootDrive);            buffer[0] = 'A' - 1 + ulBootDrive; // duh, 1-based index...            return NS_NewNativeLocalFile(nsDependentCString(buffer),                                         true,                                         aFile);        }     case OS2_OS2Directory:        {            ULONG ulBootDrive = 0;            char  buffer[] = " ://OS2//";            DosQuerySysInfo( QSV_BOOT_DRIVE, QSV_BOOT_DRIVE,                             &ulBootDrive, sizeof ulBootDrive);            buffer[0] = 'A' - 1 + ulBootDrive; // duh, 1-based index...            return NS_NewNativeLocalFile(nsDependentCString(buffer),                                         true,                                         aFile);        }     case OS2_HomeDirectory:        {            nsresult rv;            char *tPath = PR_GetEnv("MOZILLA_HOME");            char buffer[CCHMAXPATH];            /* If MOZILLA_HOME is not set, use GetCurrentProcessDirectory */            /* To ensure we get a long filename system */            if (!tPath || !*tPath) {                PPIB ppib;                PTIB ptib;                DosGetInfoBlocks( &ptib, &ppib);                DosQueryModuleName( ppib->pib_hmte, CCHMAXPATH, buffer);                *strrchr( buffer, '//') = '/0'; // XXX DBCS misery                tPath = buffer;            }            rv = NS_NewNativeLocalFile(nsDependentCString(tPath),                                       true,                                       aFile);            PrfWriteProfileString(HINI_USERPROFILE, "Mozilla", "Home", tPath);            return rv;        }        case OS2_DesktopDirectory:        {            char szPath[CCHMAXPATH + 1];            BOOL fSuccess;            fSuccess = WinQueryActiveDesktopPathname (szPath, sizeof(szPath));            if (!fSuccess) {                // this could happen if we are running without the WPS, return                // the Home directory instead                return GetSpecialSystemDirectory(OS2_HomeDirectory, aFile);            }            int len = strlen (szPath);            if (len > CCHMAXPATH -1)                break;            szPath[len] = '//';            szPath[len + 1] = '/0';            return NS_NewNativeLocalFile(nsDependentCString(szPath),                                         true,                                         aFile);        }#endif        default:            break;    }    return NS_ERROR_NOT_AVAILABLE;}
开发者ID:FunkyVerb,项目名称:devtools-window,代码行数:101,


示例19: if

char *get_path(const char *filename){	char *homedir;	char *buff;#ifdef __MINGW32__	static char *config_dir = "/mplayer";#else	static char *config_dir = "/.mplayer";#endif	int len;#ifdef CONFIG_MACOSX_BUNDLE	struct stat dummy;	CFIndex maxlen=256;	CFURLRef res_url_ref=NULL;	CFURLRef bdl_url_ref=NULL;	char *res_url_path = NULL;	char *bdl_url_path = NULL;#endif	if ((homedir = getenv("MPLAYER_HOME")) != NULL)		config_dir = "";	else if ((homedir = getenv("HOME")) == NULL)#if defined(__MINGW32__) || defined(__CYGWIN__)	/* Hack to get fonts etc. loaded outside of Cygwin environment. */	{		int i,imax=0;		char exedir[260];		GetModuleFileNameA(NULL, exedir, 260);		for (i=0; i< strlen(exedir); i++)			if (exedir[i] =='//')				{exedir[i]='/'; imax=i;}		exedir[imax]='/0';		homedir = exedir;	}#elif defined(__OS2__)    {        PPIB ppib;        char path[260];        // Get process info blocks        DosGetInfoBlocks(NULL, &ppib);        // Get full path of the executable        DosQueryModuleName(ppib->pib_hmte, sizeof( path ), path);        // Truncate name part including last backslash        *strrchr(path, '//') = 0;        // Convert backslash to slash        _fnslashify(path);        homedir = path;    }#else	return NULL;#endif	len = strlen(homedir) + strlen(config_dir) + 1;	if (filename == NULL) {		if ((buff = malloc(len)) == NULL)			return NULL;		sprintf(buff, "%s%s", homedir, config_dir);	} else {		len += strlen(filename) + 1;		if ((buff = malloc(len)) == NULL)			return NULL;		sprintf(buff, "%s%s/%s", homedir, config_dir, filename);	}#ifdef CONFIG_MACOSX_BUNDLE	if (stat(buff, &dummy)) {		res_url_ref=CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());		bdl_url_ref=CFBundleCopyBundleURL(CFBundleGetMainBundle());		if (res_url_ref&&bdl_url_ref) {			res_url_path=malloc(maxlen);			bdl_url_path=malloc(maxlen);			while (!CFURLGetFileSystemRepresentation(res_url_ref, true, res_url_path, maxlen)) {				maxlen*=2;				res_url_path=realloc(res_url_path, maxlen);			}			CFRelease(res_url_ref);			while (!CFURLGetFileSystemRepresentation(bdl_url_ref, true, bdl_url_path, maxlen)) {				maxlen*=2;				bdl_url_path=realloc(bdl_url_path, maxlen);			}			CFRelease(bdl_url_ref);			if (strcmp(res_url_path, bdl_url_path) == 0)				res_url_path = NULL;		}		if (res_url_path&&filename) {			if ((strlen(filename)+strlen(res_url_path)+2)>maxlen) {				maxlen=strlen(filename)+strlen(res_url_path)+2;			}			free(buff);			buff = malloc(maxlen);//.........这里部分代码省略.........
开发者ID:dreamerc,项目名称:mplayer,代码行数:101,


示例20: GetCurrentProcessDirectory

//----------------------------------------------------------------------------------------static void GetCurrentProcessDirectory(nsFileSpec& aFileSpec)//----------------------------------------------------------------------------------------{#if defined (XP_WIN)    char buf[MAX_PATH];    if ( ::GetModuleFileName(0, buf, sizeof(buf)) ) {        // chop of the executable name by finding the rightmost backslash        char* lastSlash = PL_strrchr(buf, '//');        if (lastSlash)            *(lastSlash + 1) = '/0';        aFileSpec = buf;        return;    }#elif defined(XP_OS2)    PPIB ppib;    PTIB ptib;    char buffer[CCHMAXPATH];    DosGetInfoBlocks( &ptib, &ppib);    DosQueryModuleName( ppib->pib_hmte, CCHMAXPATH, buffer);    *strrchr( buffer, '//') = '/0'; // XXX DBCS misery    aFileSpec = buffer;    return;#elif defined(XP_UNIX)    // In the absence of a good way to get the executable directory let    // us try this for unix:    //	- if MOZILLA_FIVE_HOME is defined, that is it    //	- else give the current directory    char buf[MAXPATHLEN];    char *moz5 = PR_GetEnv("MOZILLA_FIVE_HOME");    if (moz5)    {        aFileSpec = moz5;        return;    }    else    {#if defined(DEBUG)        static PRBool firstWarning = PR_TRUE;        if(firstWarning) {            // Warn that MOZILLA_FIVE_HOME not set, once.            printf("Warning: MOZILLA_FIVE_HOME not set./n");            firstWarning = PR_FALSE;        }#endif /* DEBUG */        // Fall back to current directory.        if (getcwd(buf, sizeof(buf)))        {            aFileSpec = buf;            return;        }    }#elif defined(XP_BEOS)    char *moz5 = getenv("MOZILLA_FIVE_HOME");    if (moz5)    {        aFileSpec = moz5;        return;    }    else    {      static char buf[MAXPATHLEN];      int32 cookie = 0;      image_info info;      char *p;      *buf = 0;      if(get_next_image_info(0, &cookie, &info) == B_OK)      {        strcpy(buf, info.name);        if((p = strrchr(buf, '/')) != 0)        {          *p = 0;          aFileSpec = buf;          return;        }      }    }#endif    NS_ERROR("unable to get current process directory");} // GetCurrentProcessDirectory()
开发者ID:rn10950,项目名称:RetroZilla,代码行数:90,


示例21: stunnel_process_id

unsigned long stunnel_process_id(void) {    PTIB ptib=NULL;    DosGetInfoBlocks(&ptib, NULL);    return (unsigned long)ptib->tib_ordinal;}
开发者ID:madnessw,项目名称:thesnow,代码行数:5,


示例22: DosGetInfoBlocks

/*-------------------------------------------------- * Returns the current process identifier *--------------------------------------------------*/PID PMGUI::pid(){  PPIB ppib;  DosGetInfoBlocks( NULL, &ppib );  return ppib->pib_ulpid;}
开发者ID:OS2World,项目名称:UTIL-INTERNATIONAL-Characters-Map-2,代码行数:9,


示例23: stunnel_thread_id

unsigned long stunnel_thread_id(void) {    PPIB ppib=NULL;    DosGetInfoBlocks(NULL, &ppib);    return (unsigned long)ppib->pib_ulpid;}
开发者ID:madnessw,项目名称:thesnow,代码行数:5,


示例24: NS_ENSURE_ARG_POINTER

//.........这里部分代码省略.........        localFile->InitWithNativePath(nsDependentCString(szPath));        *aFile = localFile;        return NS_OK;    }#endif    // The MOZ_DEFAULT_VBOX_XPCOM_HOME variable can be set at configure time with    // a --with-default-mozilla-five-home=foo autoconf flag.    //    // The idea here is to allow for builds that have a default VBOX_XPCOM_HOME    // regardless of the environment.  This makes it easier to write apps that    // embed mozilla without having to worry about setting up the environment    //    // We do this py putenv()ing the default value into the environment.  Note that    // we only do this if it is not already set.#ifdef MOZ_DEFAULT_VBOX_XPCOM_HOME    if (PR_GetEnv("VBOX_XPCOM_HOME") == nsnull)    {        putenv("VBOX_XPCOM_HOME=" MOZ_DEFAULT_VBOX_XPCOM_HOME);    }#endif    char *moz5 = PR_GetEnv("VBOX_XPCOM_HOME");    if (moz5)    {        if (realpath(moz5, buf)) {            localFile->InitWithNativePath(nsDependentCString(buf));            *aFile = localFile;            return NS_OK;        }    }#if defined(DEBUG)    static PRBool firstWarning = PR_TRUE;    if(!moz5 && firstWarning) {        // Warn that VBOX_XPCOM_HOME not set, once.        printf("Warning: VBOX_XPCOM_HOME not set./n");        firstWarning = PR_FALSE;    }#endif /* DEBUG */    // Fall back to current directory.    if (getcwd(buf, sizeof(buf)))    {        localFile->InitWithNativePath(nsDependentCString(buf));        *aFile = localFile;        return NS_OK;    }#elif defined(XP_OS2)    PPIB ppib;    PTIB ptib;    char buffer[CCHMAXPATH];    DosGetInfoBlocks( &ptib, &ppib);    DosQueryModuleName( ppib->pib_hmte, CCHMAXPATH, buffer);    *strrchr( buffer, '//') = '/0'; // XXX DBCS misery    localFile->InitWithNativePath(nsDependentCString(buffer));    *aFile = localFile;    return NS_OK;#elif defined(XP_BEOS)    char *moz5 = getenv("VBOX_XPCOM_HOME");    if (moz5)    {        localFile->InitWithNativePath(nsDependentCString(moz5));        localFile->Normalize();        *aFile = localFile;        return NS_OK;    }    else    {      static char buf[MAXPATHLEN];      int32 cookie = 0;      image_info info;      char *p;      *buf = 0;      if(get_next_image_info(0, &cookie, &info) == B_OK)      {        strcpy(buf, info.name);        if((p = strrchr(buf, '/')) != 0)        {          *p = 0;          localFile->InitWithNativePath(nsDependentCString(buf));          *aFile = localFile;          return NS_OK;        }      }    }#endif    NS_RELEASE(localFile);    NS_ERROR("unable to get current process directory");    return NS_ERROR_FAILURE;} // GetCurrentProcessDirectory()
开发者ID:etiago,项目名称:vbox,代码行数:101,


示例25: defined

nsresultnsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal){  // Copied from nsAppFileLocationProvider (more or less)  nsresult rv;  nsCOMPtr<nsIFile> localDir;#if defined(XP_MACOSX)  FSRef fsRef;  OSType folderType;  if (aLocal) {    folderType = kCachedDataFolderType;  } else {#ifdef MOZ_THUNDERBIRD    folderType = kDomainLibraryFolderType;#else    folderType = kApplicationSupportFolderType;#endif  }  OSErr err = ::FSFindFolder(kUserDomain, folderType, kCreateFolder, &fsRef);  NS_ENSURE_FALSE(err, NS_ERROR_FAILURE);  rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(localDir));  NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsILocalFileMac> dirFileMac = do_QueryInterface(localDir);  NS_ENSURE_TRUE(dirFileMac, NS_ERROR_UNEXPECTED);  rv = dirFileMac->InitWithFSRef(&fsRef);  NS_ENSURE_SUCCESS(rv, rv);  localDir = do_QueryInterface(dirFileMac, &rv);#elif defined(XP_WIN)  nsString path;  if (aLocal) {    rv = GetShellFolderPath(CSIDL_LOCAL_APPDATA, path);    if (NS_FAILED(rv))      rv = GetRegWindowsAppDataFolder(aLocal, path);  }  if (!aLocal || NS_FAILED(rv)) {    rv = GetShellFolderPath(CSIDL_APPDATA, path);    if (NS_FAILED(rv)) {      if (!aLocal)        rv = GetRegWindowsAppDataFolder(aLocal, path);    }  }  NS_ENSURE_SUCCESS(rv, rv);  rv = NS_NewLocalFile(path, true, getter_AddRefs(localDir));#elif defined(XP_OS2)#if 0 /* For OS/2 we want to always use MOZILLA_HOME */  // we want an environment variable of the form  // FIREFOX_HOME, etc  if (!gAppData)    return NS_ERROR_FAILURE;  nsDependentCString envVar(nsDependentCString(gAppData->name));  envVar.Append("_HOME");  char *pHome = getenv(envVar.get());#endif  char *pHome = getenv("MOZILLA_HOME");  if (pHome && *pHome) {    rv = NS_NewNativeLocalFile(nsDependentCString(pHome), true,                               getter_AddRefs(localDir));  } else {    PPIB ppib;    PTIB ptib;    char appDir[CCHMAXPATH];    DosGetInfoBlocks(&ptib, &ppib);    DosQueryModuleName(ppib->pib_hmte, CCHMAXPATH, appDir);    *strrchr(appDir, '//') = '/0';    rv = NS_NewNativeLocalFile(nsDependentCString(appDir), true, getter_AddRefs(localDir));  }#elif defined(MOZ_WIDGET_GONK)  rv = NS_NewNativeLocalFile(NS_LITERAL_CSTRING("/data/b2g"), true,                             getter_AddRefs(localDir));#elif defined(XP_UNIX)  const char* homeDir = getenv("HOME");  if (!homeDir || !*homeDir)    return NS_ERROR_FAILURE;#ifdef ANDROID /* We want (ProfD == ProfLD) on Android. */  aLocal = false;#endif  if (aLocal) {    // If $XDG_CACHE_HOME is defined use it, otherwise use $HOME/.cache.    const char* cacheHome = getenv("XDG_CACHE_HOME");    if (cacheHome && *cacheHome) {      rv = NS_NewNativeLocalFile(nsDependentCString(cacheHome), true,                                 getter_AddRefs(localDir));    } else {      rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), true,                                 getter_AddRefs(localDir));      if (NS_SUCCEEDED(rv))        rv = localDir->AppendNative(NS_LITERAL_CSTRING(".cache"));    }  } else {    rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), true,                               getter_AddRefs(localDir));//.........这里部分代码省略.........
开发者ID:julianpistorius,项目名称:gp-revolution-gecko,代码行数:101,


示例26: VBGLR3DECL

/** * Daemonize the process for running in the background. * * This is supposed to do the same job as the BSD daemon() call. * * @returns 0 on success * * @param   fNoChDir    Pass false to change working directory to root. * @param   fNoClose    Pass false to redirect standard file streams to /dev/null. * @param   fRespawn    Restart the daemonised process after five seconds if it *                      terminates abnormally. * @param   pcRespawn   Where to store a count of how often we have respawned, *                      intended for avoiding error spamming.  Optional. * * @todo    Use RTProcDaemonize instead of this. * @todo    Implement fRespawn on OS/2. * @todo    Make the respawn interval configurable.  But not until someone *          actually needs that. */VBGLR3DECL(int) VbglR3Daemonize(bool fNoChDir, bool fNoClose, bool fRespawn, unsigned *pcRespawn){#if defined(RT_OS_OS2)    PPIB pPib;    PTIB pTib;    DosGetInfoBlocks(&pTib, &pPib);    AssertRelease(!fRespawn);    /* Get the full path to the executable. */    char szExe[CCHMAXPATH];    APIRET rc = DosQueryModuleName(pPib->pib_hmte, sizeof(szExe), szExe);    if (rc)        return RTErrConvertFromOS2(rc);    /* calc the length of the command line. */    char *pch = pPib->pib_pchcmd;    size_t cch0 = strlen(pch);    pch += cch0 + 1;    size_t cch1 = strlen(pch);    pch += cch1 + 1;    char *pchArgs;    if (cch1 && *pch)    {        do  pch = strchr(pch, '/0') + 1;        while (*pch);        size_t cchTotal = pch - pPib->pib_pchcmd;        pchArgs = (char *)alloca(cchTotal + sizeof("--daemonized/0/0"));        memcpy(pchArgs, pPib->pib_pchcmd, cchTotal - 1);        memcpy(pchArgs + cchTotal - 1, "--daemonized/0/0", sizeof("--daemonized/0/0"));    }    else    {        size_t cchTotal = pch - pPib->pib_pchcmd + 1;        pchArgs = (char *)alloca(cchTotal + sizeof(" --daemonized "));        memcpy(pchArgs, pPib->pib_pchcmd, cch0 + 1);        pch = pchArgs + cch0 + 1;        memcpy(pch, " --daemonized ", sizeof(" --daemonized ") - 1);        pch += sizeof(" --daemonized ") - 1;        if (cch1)            memcpy(pch, pPib->pib_pchcmd + cch0 + 1, cch1 + 2);        else            pch[0] = pch[1] = '/0';    }    /* spawn a detach process  */    char szObj[128];    RESULTCODES ResCodes = { 0, 0 };    szObj[0] = '/0';    rc = DosExecPgm(szObj, sizeof(szObj), EXEC_BACKGROUND, (PCSZ)pchArgs, NULL, &ResCodes, (PCSZ)szExe);    if (rc)    {        /** @todo Change this to some standard log/print error?? */        /* VBoxServiceError("DosExecPgm failed with rc=%d and szObj='%s'/n", rc, szObj); */        return RTErrConvertFromOS2(rc);    }    DosExit(EXIT_PROCESS, 0);    return VERR_GENERAL_FAILURE;#elif defined(RT_OS_WINDOWS)# error "PORTME"#else /* the unices */    /*     * Fork the child process in a new session and quit the parent.     *     * - fork once and create a new session (setsid). This will detach us     *   from the controlling tty meaning that we won't receive the SIGHUP     *   (or any other signal) sent to that session.     * - The SIGHUP signal is ignored because the session/parent may throw     *   us one before we get to the setsid.     * - When the parent exit(0) we will become an orphan and re-parented to     *   the init process.     * - Because of the Linux / System V semantics of assigning the controlling     *   tty automagically when a session leader first opens a tty, we will     *   fork() once more on Linux to get rid of the session leadership role.     */    struct sigaction OldSigAct;    struct sigaction SigAct;    RT_ZERO(SigAct);//.........这里部分代码省略.........
开发者ID:bhanug,项目名称:virtualbox,代码行数:101,



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


C++ DosLoadModule函数代码示例
C++ DosFreeModule函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。