MRESULT EXPENTRY aboutProcR( HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2 ) { INT i; switch ( msg ) { case WM_INITDLG: return WinDefDlgProc( hwndDlg, msg, mp1, mp2 ); case WM_COMMAND: switch( SHORT1FROMMP( mp1 ) ) { case DID_CANCEL : WinShowWindow(WinWindowFromID(hwndDlg, DID_CANCEL), FALSE); for( i=0;i<4;i++ ) { WinShowWindow(WinWindowFromID(hwndDlg, ID_BEGSCREEN), FALSE); DosSleep(200); WinShowWindow(WinWindowFromID(hwndDlg, ID_BEGSCREEN), TRUE); DosSleep(200); } WinDismissDlg( hwndDlg, TRUE ); break; default : return WinDefDlgProc( hwndDlg, msg, mp1, mp2 ); } break; default : return WinDefDlgProc( hwndDlg, msg, mp1, mp2 ); } return (MRESULT) FALSE; }
int main(void) { APIRET apiret; DATETIME dt; ULONG sec = 5; printf(__FILE__ " main function invoked\n"); printf("Test basic library functioality\n"); printf("Three beeps should follow this message\n"); DosBeep(0, 0); DosSleep(125); DosBeep(0, 0); DosSleep(125); DosBeep(0, 0); apiret = DosGetDateTime(&dt); displaytime(&dt); printf("Sleeping for %d seconds\n", (int)sec); DosSleep(sec * 1000); apiret = DosGetDateTime(&dt); displaytime(&dt); return 0; }
static VOID FAR alarm_thread ( VOID ) { while(1) { if (bAlarmRunning) { DosSleep(1000L); uTime--; if (uTime==0L) { // send signal to the main process.. I could have put raise() here // however that would require the use of the multithreaded library, // and it does not contain raise()! // I tried it with the standard library, this signaled ok, but a // test printf in the signal would not work and even caused SEGV. // So I signal the process through OS/2 and then the process // signals itself. if (bAlarmRunning) DosFlagProcess(pidMain,FLGP_PID, PFLG_A,1); bAlarmRunning=FALSE; } } else DosSleep(500L); } }
int main(void) { APIRET16 apiret; char *str1 = "First string"; char *str2 = "Second string"; printf(__FILE__ " main function invoked\n"); printf("Test VIO functions\n"); DosSleep(2000); /* move the cursor around some */ apiret = VioSetCurPos(0, 0, 0); DosSleep(1000); apiret = VioSetCurPos(1, 0, 0); DosSleep(1000); apiret = VioSetCurPos(2, 0, 0); DosSleep(1000); apiret = VioSetCurPos(3, 0, 0); DosSleep(1000); apiret = VioSetCurPos(4, 0, 0); DosSleep(1000); apiret = VioSetCurPos(5, 0, 0); DosSleep(1000); /* write some strings */ VioWrtTTY(str1, strlen(str1), 0); DosSleep(2000); apiret = VioSetCurPos(6, 0, 0); VioWrtTTY(str2, strlen(str2), 0); DosSleep(2000); return 0; }
void main(int argc, char **argv) { APIRET rc; ULONG ulAction = 0; TID tid = 0; char szTemp[] = "NPU4011$"; char szDevName[128] = "\\DEV\\"; if (argc > 1) { strcpy(szTemp, argv[1]); szTemp[0]++; } strcat(szDevName, szTemp); printf("MPUTRACE - Theta Band Software MPU-401 Driver Trace Utility\n"); printf("%d Trace Messages supported\n", NUM_TRACES); printf("Opening %s\n", szDevName); rc = DosOpen((PSZ) szDevName, &hfile, &ulAction, 0, 0, OPEN_FLAG, OPEN_MODE, NULL); if (rc) { printf("Error %d while trying to open MPU-401 device driver\n", rc); return; } ULONG ulSize1; ULONG ulSize2 = sizeof(STATUS); rc = DosDevIOCtl(hfile, 0x80, 0, NULL, ulSize1, &ulSize1, &status, ulSize2, &ulSize2); if (rc) { printf("Error %d while trying to get MPU-401 status\n", rc); return; } PrintStatus(); printf("Creating thread\n"); rc = DosCreateThread(&tid, (PFNTHREAD) Thread, 0, CREATE_READY | STACK_COMMITTED, 8192); if (rc) { printf("DosCreateThread failed with RC = %lu\n", rc); return; } while (!fRunning) DosSleep(100); printf("Hit any key to quit. Program will then exit after the next message.\n"); getch(); printf("Quitting ...\n"); fQuit = TRUE; while (fRunning) DosSleep(100); DosSleep(500); // wait until the thread really ends DosClose(hfile); }
// poplog( ) // // Open the popuplog and sent to printsys( ) // void poplog(struct PROGRAMOPTS *prgoptions) { int start = 1; char buffer[256]; FILE *popfile; if(access(prgoptions->popupfile, F_OK) == 0) { popfile = fopen(prgoptions->popupfile, "rt"); while(!feof(popfile)) { fgets(buffer, 256, popfile); if(start == 1) { printsys(" --< START POPUPLOG ENTRY >-- "); start = 0; } if((int)buffer[0] == 45) { printsys(" --< END POPUPLOG ENTRY >-- "); start = 1; } else if((int)buffer[0] != 0) printsys( buffer ); DosSleep(20L); } printsys(" --< END POPUPLOG ENTRY >-- "); fclose(popfile); remove(prgoptions->popupfile); } if(access(prgoptions->flashlog, F_OK) == 0) { popfile = fopen(prgoptions->flashlog, "rt"); while(!feof(popfile)) { fgets(buffer, 256, popfile); printsys( buffer ); DosSleep(20L); } fclose(popfile); remove(prgoptions->flashlog); } }
VOID StdLib_Retard( VOID ) { // Ждем некоторое время. #ifdef I386_ARCHITECTURE DosSleep( 50 ); #else DosSleep( 10 ); #endif // Возврат. return; }
/* priority_thread This thread controls the priority of the drawing thread. With these changes, if a saver module runs on low priority (this is the default setting), it rises to normal priority twice a second for 0.1 seconds. This should solve the problem that, when very time-consuming processes were running, the module seemed not to become active at all (in fact it became active, but did not get enough CPU time to do its saver action). There should be no reason to alter the code. */ void priority_thread(void *args) { DosSetPriority(PRTYS_THREAD, PRTYC_TIMECRITICAL, 0, 0); for(;!stop_priority_thread;){ int i; DosSetPriority(PRTYS_THREAD, PRTYC_REGULAR, 0, tidDraw); DosSleep(100); DosSetPriority(PRTYS_THREAD, PRTYC_IDLETIME, 0, tidDraw); for(i=0;!stop_priority_thread && i<4;i++) DosSleep(100); } }
static void PostListens( void ) { int i; DosSleep( 0 ); for( i = NUM_REC_BUFFS-1; i >= 0; --i ) { if( !InUse( RecECB[i] ) ) { PostAListen( i ); } } /* make sure other side get the listens up */ DosSleep( 100 ); }
void omni_thread::sleep(unsigned long secs, unsigned long nanosecs) { if (secs <= MAX_SLEEP_SECONDS) { DosSleep(secs * 1000 + nanosecs / 1000000); return; } ULONG no_of_max_sleeps = secs / MAX_SLEEP_SECONDS; for (ULONG i = 0; i < no_of_max_sleeps; i++) DosSleep(MAX_SLEEP_SECONDS * 1000); DosSleep((secs % MAX_SLEEP_SECONDS) * 1000 + nanosecs / 1000000); }
static void thread_getkey () { KBDKEYINFO keyInfo; int n; while (!atEnd) { /* at end is a flag */ set_kbd(); KbdCharIn(&keyInfo, IO_NOWAIT, 0); /* get a character */ if (keyInfo.fbStatus & 0x040) { /* found a char process it */ if (keyInfo.chChar == SLang_Abort_Char) { if (SLang_Ignore_User_Abort == 0) SLang_set_error (SL_USER_BREAK); SLKeyBoard_Quit = 1; } n = (endBuf + 1) % BUFFER_LEN; if (n == startBuf) { DosBeep (500, 20); KbdFlushBuffer(0); continue; } RequestSem(); threadKeys [n].ascii = keyInfo.chChar; threadKeys [n].scan = keyInfo.chScan; /* threadKeys [n].shift = keyInfo.fsState; */ endBuf = n; ReleaseSem(); } else /* no char available*/ DosSleep (20); } }
/** * Cleans up after system_Init() and system_Configure(). */ void system_End(void) { if( tidIPCFirst == _gettid()) { HPIPE hpipe; ULONG ulAction; ULONG cbActual; ULONG rc; do { rc = DosOpen( VLC_IPC_PIPE, &hpipe, &ulAction, 0, 0, OPEN_ACTION_OPEN_IF_EXISTS, OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYREADWRITE | OPEN_FLAGS_FAIL_ON_ERROR, NULL ); if( rc == ERROR_PIPE_BUSY ) DosWaitNPipe( VLC_IPC_PIPE, -1 ); else if( rc ) DosSleep( 1 ); } while( rc ); /* Ask for IPCHelper to quit */ ULONG ulCmd = IPC_CMD_QUIT; DosWrite( hpipe, &ulCmd, sizeof( ulCmd ), &cbActual ); DosClose( hpipe ); TID tid = tidIPCHelper; DosWaitThread( &tid, DCWW_WAIT ); } }
RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies) { LogFlow(("RTThreadSleep: cMillies=%d\n", cMillies)); DosSleep(cMillies); LogFlow(("RTThreadSleep: returning (cMillies=%d)\n", cMillies)); return VINF_SUCCESS; }
void RemoteDisco( void ) { int i; DosSleep( 500 ); /* make sure last packet gets sent */ Listening = 0; _INITSPXECB( Conn, 1, 0, 0 ); if( SpxTerminateConnection( Connection, &ConnECB ) == 0 ) { while( InUse( ConnECB ) ) IPXRelinquishControl(); } for( i = NUM_REC_BUFFS-1; i >= 0; --i ) { if( InUse( RecECB[i] ) ) { SpxCancelPacket( &RecECB[i] ); } } if( InUse( SendECB ) ) { SpxCancelPacket( &SendECB ); } for( i = NUM_REC_BUFFS-1; i >= 0; --i ) { ZeroArray( RecHead[i] ); ZeroArray( RecECB[i] ); } ZeroArray( ConnHead ); ZeroArray( SendHead ); ZeroArray( ConnECB ); ZeroArray( SendECB ); }
void Eingang() { DosBeep(3000,300); DosSleep(1000); DosBeep(4000,200); DosExit(0,0); }
static void WaitForSlip(void) { int FirstTime = 1; APIRET rc; short Seconds = Timeout; do { rc = DosOpenEventSem("\\sem32\\slip\\monitor", &slip_running); if (rc) { if (FirstTime) { printf("[ Waiting for SLIP - maximum wait = %d seconds ]\n", Timeout); FirstTime = 0; } Seconds--; if (Seconds >= 0) { if (Debug) { fprintf(stderr, "."); fflush(stderr); } DosSleep(1000L); } } } while (rc && (Seconds >= 0)); if (Debug) { fprintf(stderr, "\n"); } if (Seconds < 0) { printf("The SLIP driver appears not to have started.\n"); exit(1); } } // WaitForSlip()
/* =============== RunThreadsOn =============== */ void RunThreadsOn (threadfunc_t func) { LONG i; if (numthreads <= 1) { work_threads[0] = -1; func (NULL); return; } workfunc = func; for (i = 0; i < numthreads; i++) { work_threads[i] = _beginthread(ThreadWorkerFunc, NULL, stacksiz, (void *)i); if (work_threads[i] == -1) COM_Error ("_beginthread() failed"); } for (i = 0; i < numthreads; i++) { while (work_threads[i] != -1) DosSleep (100); } }
static void hb_taskFreeze( HB_MAXINT wakeup ) { #if defined( HB_OS_DOS ) while( wakeup > hb_taskTimeStop( 0 ) ) { union REGS regs; regs.h.ah = 2; regs.HB_XREGS.ax = 0x1680; HB_DOS_INT86( 0x2F, ®s, ®s ); } #else wakeup -= hb_taskTimeStop( 0 ); if( wakeup > 0 ) { # if defined( __DJGPP__ ) usleep( wakeup * 1000 ); # elif defined( HB_OS_WIN ) Sleep( wakeup ); # elif defined( HB_OS_OS2 ) DosSleep( wakeup ); /* Duration is in milliseconds */ # elif defined( HB_OS_UNIX ) struct timeval tv; tv.tv_sec = wakeup / 1000; tv.tv_usec = ( wakeup % 1000 ) * 1000; select( 0, NULL, NULL, NULL, &tv ); # endif } #endif }
/* _WM_Lock(wmlock) wmlock = a pointer to a value returns nothing Attempts to set a lock on the MDI tree so that only 1 library command may access it at any time. If lock fails the process retries until successful. */ void _WM_Lock(int * wmlock) { LOCK_START: /* Check if lock is clear, if so set it */ if (__builtin_expect(((*wmlock) == 0), 1)) { (*wmlock)++; /* Now that the lock is set, make sure we * don't have a race condition. If so, * decrement the lock by one and retry. */ if (__builtin_expect(((*wmlock) == 1), 1)) { return; /* Lock cleanly set */ } (*wmlock)--; } #ifdef _WIN32 Sleep(10); #elif defined(__OS2__) || defined(__EMX__) DosSleep(10); #elif defined(WILDMIDI_AMIGA) Delay(1); #elif defined(__vita__) sceKernelDelayThread(500); #elif defined(__SWITCH__) svcSleepThread(500 * 1000); #else usleep(500); #endif goto LOCK_START; }
extern "C" APIRET APIENTRY _F_SendCmdToServer(void *recvobj, int ncmd, int data) { int rc; LOCK(AccessF_pipe_cli); rc = ((class NPipe *)(recvobj))->SendCmdToServer(ncmd, data); if(rc == ERROR_BROKEN_PIPE) /* attempt to reconnect till timeout */ { int raz; debug(1, 1)(__FUNCTION__ " Broken Pipe, Try to reconnect...\n"); for(raz = 0;raz < 10; raz++) { delete ((class NPipe *)(recvobj)); recvobj = NULL; DosSleep(100+raz*10); recvobj = new NPipe(PipeName,CLIENT_MODE); rc = ((class NPipe *)(recvobj))->Open(); if(rc) { debug(1, 1)(__FUNCTION__ " Broken Pipe, Server still down...\n"); } else { rc = ((class NPipe *)(recvobj))->HandShake(); if(rc == HAND_SHAKE_ERROR) { debug(1, 0)("Error handshake %i, pipe %s\n",rc,PipeName); } else { break; } } } } UNLOCK(AccessF_pipe_cli); return rc; }
video_canvas_t video_canvas_create(const char *title, UINT *width, UINT *height, int mapped, canvas_redraw_t exposure_handler, const palette_t *palette, struct video_frame_buffer_s *fb) { video_canvas_t canvas_new; DEBUG(("Creating canvas width=%d height=%d", *width, *height)); if (palette->num_entries > 255) { log_error(video_log, "Too many colors requested."); return (video_canvas_t) NULL; } vidlog("canvas alloc",1); canvas_new = lib_calloc(1,sizeof(struct _canvas)); if (!canvas_new) return (video_canvas_t) NULL; canvas_new->init_ready = FALSE; // canvas_new not yet initialized canvas_new->width = *width; canvas_new->height = *height; canvas_new->pbmi_initialized = FALSE; // pbmi not yet initialized rc=DosCreateMutexSem("\\SEM32\\GFX", &hmtx, 0, FALSE); // gfx init begin vidlog("Create: ",rc); _beginthread(PM_mainloop,NULL,0x4000,&canvas_new); while (!canvas_new->pbmi_initialized) DosSleep(1); video_canvas_set_palette(canvas_new, palette); canvas_new->exposure_handler = exposure_handler; return canvas_new; }
/*@ XBitmap::Load(const char* filename, XBitmapFilter * params, BOOL releaseParams) @group loading a bitmap @remarks Load a bitmap from a file. <P><I>If this method is used, GBM.DLL and OLLGLIB.DLL must be in the LIBPATH.</I> <P>Due a bug (?) in OS/2-GPI you should specify params->cBitCount = BFP_BPP_TRUECOLOR if you want to modify or resave the bitmap. @parameters <t 'ø' c=2> øchar * fileName øfilename of the file to load øXBitmapFilter * params øfiletype specific filter informations. An initialized structure has to be created by XBitmap :: GetImportFilterStruct () or XGLibFileDialog. (default is NULL) øBOOL releaseParams øfilter informations will be released after usages <\t> @exceptions If the method fails to create a new bitmap an exception of the type XException is thrown. */ void XBitmap :: Load (const char* filename, XBitmapFilter* params, BOOL releaseParams) { if (hbm) GpiDeleteBitmap(hbm); hbm = NULLHANDLE; XResourceLibrary* lib = new XResourceLibrary ("OOLGLIB"); XGLibProcIO* func = (XGLibProcIO*) lib->LoadFunction ("OOL_GLIB_IMP"); DosSleep(100); if (NULL != func) { if (owner) hps = WinGetPS (owner->GetHandle()); ULONG rc; if (NULL == params) params = GetImportFilterStruct (filename); params->hps = hps; params->hbm = hbm; params->hab = XApplication :: GetApplication ()->GetAnchorBlock (); if (BFE_OK != (rc = func (filename, __XBMFProfile__, params, 0))) { if (releaseParams) ReleaseFilterStruct (params); OOLThrow (GetLastErrorMessage (lib, &rc, params), rc); } hbm = params->hbm; if (releaseParams) ReleaseFilterStruct (params); lib->UnLoadFunction ((PFNWP) func); } else { if (releaseParams) ReleaseFilterStruct (params); ULONG error = WinGetLastError (XApplication :: GetApplication ()->GetAnchorBlock ()); OOLThrow("Could not load function \"OOL_GLIB_IMP\" from library \"OOLGLIB.DLL\".", error); } delete lib; XSize s; GetDimensions(&s); width = cx = s.GetWidth(); height = cy = s.GetHeight(); }
void plNuke(HWND hWnd) { PSTRINGLIST pFirst = (PSTRINGLIST)WinQueryWindowPtr(hWnd, QWP_PLAYLIST); PSTRINGLIST pEntry = pFirst; PSTRINGLIST pTmp = pEntry; if(pFirst == NULL) return; do { pEntry = pEntry->next; delete pTmp->pszString; delete pTmp; pTmp = pEntry; DosSleep(0); }while(pTmp != pFirst); // reset playlist info WinSetWindowPtr(hWnd, QWP_PLAYLIST, (PVOID)NULL); WinSetWindowPtr(hWnd, QWP_CURRENTENTRY, (PVOID)NULL); WinSetWindowULong(hWnd, QWL_PLAYLISTENTRIES, 0); }
/*@ XBitmap::Save(const char* filename, XBitmapFilter * params, BOOL releaseParams) @group saving a bitmap @remarks Save a bitmap from a file. <P><I>If this method is used, GBM.DLL and OLLGLIB.DLL must be in the LIBPATH.</I> <P>Due a bug (?) in OS/2-GPI the bitmap should be in 24-bit-format. @parameters <t 'ø' c=2> øchar * fileName øfilename of the file to load øXBitmapFilter * params øfiletype specific filter informations. An initialized structure has to be created by XBitmap :: GetImportFilterStruct () or XGLibFileDialog. (default is NULL) øBOOL releaseParams øfilter informations will be released after usages <\t> @exceptions If the method fails to create a new bitmap an exception of the type XException is thrown. */ void XBitmap :: Save (const char* filename, XBitmapFilter* params, BOOL releaseParams) { XResourceLibrary* lib = new XResourceLibrary ("OOLGLIB"); XGLibProcIO* func = (XGLibProcIO*) lib->LoadFunction ("OOL_GLIB_EXP"); DosSleep(100); if (NULL != func) { ULONG rc; if (NULL == params) params = GetExportFilterStruct (filename); params->hps = hps; params->hbm = hbm; params->hab = XApplication :: GetApplication ()->GetAnchorBlock (); if (BFE_OK != (rc = func (filename, __XBMFProfile__, params, 0))) { if (releaseParams) ReleaseFilterStruct (params); OOLThrow (GetLastErrorMessage (lib, &rc, params), rc); } if (releaseParams) ReleaseFilterStruct (params); lib->UnLoadFunction ((PFNWP) func); } else { if (releaseParams) ReleaseFilterStruct (params); ULONG error = WinGetLastError (XApplication :: GetApplication ()->GetAnchorBlock ()); OOLThrow("Could not load function \"OOL_GLIB_EXP\" from library \"OOLGLIB.DLL\".", error); } delete lib; }
// sleep(int milliseconds) -- // -- sleeps during the specified time (in milliseconds) void GOS::sleep(int milliseconds) { #if defined(UNIX) struct timeval tv; tv.tv_sec = milliseconds / 1000; tv.tv_usec = (milliseconds - (tv.tv_sec * 1000)) * 1000; # if defined(THREADMODEL) && (THREADMODEL==COTHREADS) GThread::select(0, NULL, NULL, NULL, &tv); # else select(0, NULL, NULL, NULL, &tv); # endif #elif defined(WIN32) Sleep(milliseconds); #elif defined(OS2) DosSleep(milliseconds); #elif defined(macintosh) unsigned long tick = ticks(), now; while (1) { now = ticks(); if ((tick+milliseconds) < now) break; GThread::yield(); } #endif }
void XBitmap :: SetupExportFilter (const XWindow* owner, const char* filename, XBitmapFilter* params) { CheckFilterProfile (); if (NULL == owner) OOLThrow("invalid parameters", 1); if (NULL == filename) OOLThrow("invalid parameters", 2); if (NULL == params) OOLThrow("invalid parameters", 3); XResourceLibrary* lib = new XResourceLibrary ("OOLGLIB"); XGLibProcSetup* func = (XGLibProcSetup*) lib->LoadFunction ("OOL_GLIB_EXP_SETUP"); DosSleep(100); if (NULL != func) { ULONG rc; params->hab = XApplication :: GetApplication ()->GetAnchorBlock (); if (BFE_OK != (rc = func (owner->GetHandle (), filename, __XBMFProfile__, params))) OOLThrow (GetLastErrorMessage (lib, &rc, params), rc); lib->UnLoadFunction ((PFNWP) func); } else { ULONG error = WinGetLastError (XApplication :: GetApplication ()->GetAnchorBlock ()); OOLThrow("Could not load function \"OOL_GLIB_EXP_SETUP\" from library \"OOLGLIB.DLL\".", error); } delete lib; }
void TEventQueue::keyboardThread( void * arg ) { arg = arg; KBDKEYINFO *info = &TThreads::tiled->keyboardInfo; while (1) { jsSuspendThread USHORT errCode = KbdCharIn( info, IO_NOWAIT, 0 ); jsSuspendThread if ( errCode || (info->fbStatus & 0xC0)!=0x40 || info->fbStatus & 1) { // no char keyboardEvent.what = evNothing; DosSleep(keyboardPollingDelay); if (keyboardPollingDelay < 500) keyboardPollingDelay += 5; } else { keyboardEvent.what = evKeyDown; if ((info->fbStatus & 2) && (info->chChar==0xE0)) info->chChar=0; // OS/2 cursor keys. keyboardEvent.keyDown.charScan.charCode=info->chChar; keyboardEvent.keyDown.charScan.scanCode=info->chScan; shiftState = info->fsState & 0xFF; jsSuspendThread assert(! DosPostEventSem(TThreads::hevKeyboard1) ); jsSuspendThread assert(! DosWaitEventSem(TThreads::hevKeyboard2, SEM_INDEFINITE_WAIT) ); keyboardEvent.what = evNothing; ULONG dummy; jsSuspendThread assert(! DosResetEventSem(TThreads::hevKeyboard2, &dummy) ); keyboardPollingDelay=0; } } TThreads::deadEnd(); }
XBitmapFilter* XBitmap :: GetExportFilterStruct (const char* filename) { XBitmapFilter* filter; XBitmapFilter dummy; dummy.cbFix = 0; CheckFilterProfile (); XResourceLibrary* lib = new XResourceLibrary ("OOLGLIB"); XGLibProcFltInit* func = (XGLibProcFltInit*) lib->LoadFunction ("OOL_GLIB_EXP_INIT"); DosSleep(100); if (NULL != func) { ULONG rc; if (0 == (rc = func (filename, __XBMFProfile__, NULL, 0))) OOLThrow (GetLastErrorMessage (lib, &rc, &dummy), rc); DosAllocMem ((PPVOID) &filter, rc, PAG_READ | PAG_WRITE | PAG_COMMIT); filter->cbFix = rc; filter->hab = XApplication :: GetApplication ()->GetAnchorBlock (); if (BFE_OK != (rc = func (filename, __XBMFProfile__, filter, 0))) OOLThrow (GetLastErrorMessage (lib, &rc, filter), rc); lib->UnLoadFunction ((PFNWP) func); } else { ULONG error = WinGetLastError (XApplication :: GetApplication ()->GetAnchorBlock ()); OOLThrow("Could not load function \"OOL_GLIB_EXP_INIT\" from library \"OOLGLIB.DLL\".", error); } delete lib; return filter; }
/******************************************************************************* Wait for a particular message *******************************************************************************/ int waitformessage(HAB hab, int idmsg, PUPSSTATUS pups) { QMSG qmsg; int retcode; ULONG poll, time = clock(); if(!threadid) return threadfail; for(;;) { if(!threadid) break; if(!lastmessage) { if(!WaitFlag && !idmsg) break; else if(!WaitFlag && (curmessage == idmsg)) break; } DosSleep(1); poll = ((clock() - time) * 1000) / CLOCKS_PER_SEC; if(poll > MAX_POLL_INTERVAL) return ERROR_UPS_TIMEOUT; } if(!threadid) return threadfail; if(WaitFlag) return ERROR_UPS_BUSY; if(pups) { memmove(&(pups->upsstatus), &(upst.upsstatus), sizeUPSstat(pups)); pups->infostr = infostr; } return NO_ERROR; }
void XBitmap :: CheckFilterProfile () { if (NULL == __XBMFProfile__) { XResourceLibrary* lib = new XResourceLibrary ("OOLGLIB"); XGLibProcProfInit* func = (XGLibProcProfInit*) lib->LoadFunction ("OOL_GLIB_INIT"); XBitmapFilter dummy; dummy.cbFix = 0; DosSleep(100); if (NULL != func) { ULONG rc; if (0 == (rc = func (NULL, 0, 0, 0))) { ULONG error = WinGetLastError (XApplication :: GetApplication ()->GetAnchorBlock ()); OOLThrow (GetLastErrorMessage (lib, &rc, &dummy), rc); } DosAllocMem ((PPVOID) &__XBMFProfile__, rc, PAG_READ | PAG_WRITE | PAG_COMMIT); __XBMFProfile__->cbFix = rc; if (BFE_OK != (rc = func (__XBMFProfile__, 0, 0, 0))) { ULONG error = WinGetLastError (XApplication :: GetApplication ()->GetAnchorBlock ()); OOLThrow (GetLastErrorMessage (lib, &rc, &dummy), rc); } lib->UnLoadFunction ((PFNWP) func); } else { ULONG error = WinGetLastError (XApplication :: GetApplication ()->GetAnchorBlock ()); OOLThrow("Could not load function \"OOL_GLIB_INIT\" from library \"OOLGLIB.DLL\".", error); } delete lib; } }