BOOL PEXPORT KpcExecuteF(LPSTR lpProgram, LISTID idArgs) { int i = 0; LPSTR st; LIST_LOOP loop; ATOMID idArg; strncpy(return_buffer, lpProgram, RET_BUFFER_LEN - 1); i = strlen(lpProgram); kpc_init_loop(idArgs, &loop); while (idArg = KppNextListElement(&loop)) { return_buffer[i++] = ' '; st = return_buffer + i; i += KppGetAtomName(idArg, st, RET_BUFFER_LEN - i - 1); } return_buffer[i] = '\0'; GlobalCompact(0L); if (WinExec(return_buffer, SW_SHOWNORMAL) < 32) return FALSE; KppWaitForInputCB(); return TRUE; }
WORD FAR PASCAL _export CIFDLLIni (WORD usReqTyp, DWORD ulPrm001, DWORD ulPrm002) { WORD usCmpCod; ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// GlobalCompact (0); ///////////////////////////////////////////////////////////////////////// // If (CIFINIREQ == usReqTyp), check for accelerator key ///////////////////////////////////////////////////////////////////////// if ((CIFSYSINI == usReqTyp) && (!ulPrm002 || !strlen ((LPSTR) ulPrm002))) { ///////////////////////////////////////////////////////////////////// // Check for accelerator key and/or AppKey/UsrKey combo ///////////////////////////////////////////////////////////////////// if (REGDEMKEY == ChkRegKey (CIFGlo.RelKeyArr, CIFGlo.SeqNumArr, &usCmpCod)) { switch (usCmpCod) { case 0xFFFE: MsgDspRes (CIFGlo.hLibIns, 0, IDS_INSMEMERR); break; case 0xFFFD: MsgDspRes (CIFGlo.hLibIns, 0, IDS_DOSMEMERR); break; default: MsgDspRes (CIFGlo.hLibIns, 0, IDS_ACCKEYNON); } return ((WORD) -1); } ///////////////////////////////////////////////////////////////////// // Load registration key from physical key [1] or string ///////////////////////////////////////////////////////////////////// if (!usCmpCod) CIFGlo.usRegKey = GetEncKey (CIFGlo.SeqNumArr, 1, &usCmpCod); else CIFGlo.usRegKey = ChkRegKey (CIFGlo.RelKeyArr, CIFGlo.SeqNumArr, &usCmpCod); } if ((CIFSYSINI == usReqTyp) && ulPrm002 && strlen ((LPSTR) ulPrm002)) { CIFGlo.usRegKey = ChkRegKey ((LPSTR) ulPrm002, CIFGlo.SeqNumArr, &usCmpCod); } ///////////////////////////////////////////////////////////////////////// // If (0 != usReqTyp), initialize internal structures and DLL's ///////////////////////////////////////////////////////////////////////// if (CIFSUBINI == usReqTyp) { AmpDLLIni (usReqTyp, ulPrm001, ulPrm002); } /********************************************************************/ /********************************************************************/ return (0); }
BOOL CEXPORT KpcExecute(LPSTR program, ...) { va_list ap; int i = 0; LPSTR st; va_start(ap, program); for (st = program; st; st = va_arg(ap, LPSTR)) { strcpy(return_buffer + i, st); i += strlen(st); return_buffer[i++] = ' '; } return_buffer[i - 1] = '\0'; GlobalCompact(0L); if (WinExec(return_buffer, SW_SHOWNORMAL) < 32) return KpcError(hInstThisDll, IDE_COULDNOTSTART, return_buffer, ""); KppWaitForInputCB(); return TRUE; }
/* * Init32BitTask - load and initialize the 32-bit application */ int Init32BitTask( HINSTANCE thishandle, HINSTANCE prevhandle, LPSTR cmdline, int cmdshow ) { WORD i,amount,bytes_read,j; WORD sel; int handle; tiny_ret_t rc; DWORD size,currsize,curroff,minmem,maxmem; DWORD relsize,exelen; struct wstart_vars __far *dataptr; void __far *aliasptr; DWORD __far *relptr; struct fpu_area __far *fpuptr; rex_exe exe; exe_data exedat; char file[128]; DWORD flags; version_info vi; DWORD file_header_size; BOOL tried_global_compact; DWORD save_maxmem; DWORD adata[2]; flags = GetWinFlags(); /* * verify that we are running on a 32-bit DPMI */ _fDPMIGetVersion( &vi ); if( !(vi.flags & VERSION_80386) ) { MessageBox( NULL, "Not running on a 386 DPMI implementation",MsgTitle, MB_OK | MB_ICONHAND | MB_TASKMODAL ); return( FALSE ); } /* * get exe to load */ GetModuleFileName( thishandle, file, 128 ); rc = _fTinyOpen( file, TIO_READ ); if( TINY_ERROR( rc ) ) { return( Fini( 2, (char _FAR *)"Error opening file", (char _FAR *)file) ); } handle = TINY_INFO( rc ); _TinySeek( handle, 0x38, TIO_SEEK_START ); _fTinyRead( handle, &exelen, sizeof( DWORD ) ); _TinySeek( handle, exelen, TIO_SEEK_START ); /* * check if we are being run by the debugger. When the debugger * sees the 'DEADBEEF' bytes at the start of the code segment * (see begin.asm), it swaps them to be BEEFDEAD. The debugger * then tells us to go, and if we see that we have BEEFDEAD, * we execute a breakpoint just before we call our 32-bit code. * Then the debugger traces a single instruction and it looks to * the user like the start of his/her code is the start of * the application. */ if( deadbeef == 0xBEEFDEAD ) { InDebugger = 0; } else { InDebugger = 1; } DPL = (CS() & 0x03) << 5; /* our privilege level */ /* * validate header signature */ _fTinyRead( handle, &exe, sizeof( rex_exe ) ); // BreakPoint(); if( !(exe.sig[0] == 'M' && exe.sig[1] == 'Q') ) { return( Fini( 1,(char _FAR *)"Invalid EXE" ) ); } file_header_size = (DWORD) exe.file_header * 16L; /* * exe.one is supposed to always contain a 1 for a .REX file. * However, to allow relocation tables bigger than 64K, the * we extended the linker to have the .one field contain the * number of full 64K chunks of relocations, minus 1. */ file_header_size += (exe.one-1)*0x10000L*16L; /* * get exe data - data start and stack start */ _TinySeek( handle, exelen + file_header_size + (long)exe.initial_eip, TIO_SEEK_START ); _fTinyRead( handle, &exedat, sizeof( exe_data ) ); /* * get file size */ size = (long) exe.file_size2 * 512L; if( exe.file_size1 > 0 ) { size += (long) exe.file_size1 - 512L; } /* * get stack size */ StackSize = Align4K( exe.initial_esp - ((exedat.stackstart+15) & ~15ul) ); if( StackSize < 0x1000 ) { StackSize = 0x1000; } /* * get minimum/maximum amounts of heap, then add in exe size * to get total area */ // BreakPoint(); minmem = (DWORD) exe.min_data *(DWORD) 4096L; if( exe.max_data == (WORD)-1 ) { maxmem = 4096L; } else { maxmem = (DWORD) exe.max_data*4096L; } minmem = Align4K( minmem + size + 0x10000ul ); maxmem = Align4K( maxmem + size + 0x10000ul ); if( minmem > maxmem ) { maxmem = minmem; } /* * get memory to load file */ tried_global_compact = FALSE; save_maxmem = maxmem; for(;;) { i = DPMIGet32( adata, maxmem ); if( i != 5 ) break; if( maxmem == minmem ) { if( tried_global_compact ) { return( Fini( 3, (char _FAR *)"Not enough memory for application\n(minimum ", dwordToStr( minmem ),(char _FAR *)" required)" )); } /* * GlobalCompact(-1) causes Windows to unfragment its * memory. This might give us a chance to get a linear * chunk big enough */ GlobalCompact( GlobalCompact( 0 ) ); maxmem = save_maxmem; tried_global_compact = TRUE; } else if( maxmem < 64L * 1024L ) { maxmem = minmem; } else { maxmem -= 64L * 1024L; if( maxmem < minmem ) { /* 09-aug-93 */ maxmem = minmem; } } } DataHandle = adata[1]; BaseAddr = adata[0] + 0x10000ul; #if FLAT i = InitFlatAddrSpace( BaseAddr, 0L ); #else i = InitFlatAddrSpace( BaseAddr, maxmem ); #endif BaseAddr = 0L; if( i ) { DPMIFreeMemoryBlock( DataHandle ); return( Fini( 2,(char _FAR *)"Allocation error ", dwordToStr( i ) ) ); } SaveSP = BaseAddr + StackSize; CodeLoadAddr = SaveSP; MyDataSelector = DataSelector; GetDataSelectorInfo(); CodeEntry.off = exe.initial_eip + CodeLoadAddr + sizeof( exe_data ); /* * this builds a collection of LDT selectors that are ready for * allocation */ if( InitSelectorCache() != 0 ) { return( Fini( 1,(char _FAR *)outOfSelectors) ); } /* * read the exe into memory */ currsize = size - file_header_size; _TinySeek( handle, exelen + file_header_size, TIO_SEEK_START ); i = DPMIGetAliases( CodeLoadAddr, (LPDWORD) &aliasptr, 0 ); if( i ) { return( Fini( 3,(char _FAR *)"Error ", dwordToStr( i ), (char _FAR *)" getting alias for read" ) ); } dataptr = aliasptr; sel = ((DWORD) dataptr) >> 16; curroff = CodeLoadAddr; while( currsize != 0 ) { if( currsize >= (DWORD) READSIZE ) { amount = READSIZE; } else { amount = (WORD) currsize; } rc = _fTinyRead( handle, dataptr, amount ); bytes_read = TINY_INFO( rc ); if( bytes_read != amount ) { return( Fini( 1,(char _FAR *)"Read error" ) ); } currsize -= (DWORD) amount; curroff += (DWORD) amount; DPMISetSegmentBaseAddress( sel, DataSelectorBase + curroff ); } EDataAddr = curroff; // 03-jan-95 DPMISetSegmentBaseAddress( sel, DataSelectorBase ); relptr = (DWORD __far *)aliasptr; // point to 32-bit stack area /* * get and apply relocation table */ relsize = sizeof( DWORD ) * (DWORD) exe.reloc_cnt; { DWORD realsize; WORD kcnt; realsize = file_header_size - (DWORD) exe.first_reloc; kcnt = realsize / (0x10000L*sizeof(DWORD)); relsize += kcnt * (0x10000L*sizeof(DWORD)); } if( relsize != 0 ) { _TinySeek( handle, exelen + (DWORD)exe.first_reloc, TIO_SEEK_START ); if( StackSize >= (DWORD) READSIZE ) { amount = READSIZE; } else { amount = (WORD) StackSize; } while( relsize != 0L ) { if( relsize < (DWORD)amount ) { amount = (WORD) relsize; } rc = _fTinyRead( handle, relptr, amount ); bytes_read = TINY_INFO( rc ); if( bytes_read != amount ) { return( Fini( 1,(char _FAR *)"Relocation read error" ) ); } CodeRelocate( relptr, amount/sizeof(DWORD) ); relsize -= (DWORD) amount; } } _TinyClose( handle ); /* initialize emulator 8087 save area 20-oct-94 */ fpuptr = (struct fpu_area __far *)((char __far *)aliasptr + FPU_AREA); _fmemset( fpuptr, 0, sizeof(struct fpu_area) ); fpuptr->control_word = 0x033F; fpuptr->tag_word = 0xFFFF; /* * set dataptr to special area in data segment of 32-bit app */ curroff = exedat.datastart; if( exe.reloc_cnt != 0 ) curroff += CodeLoadAddr; DPMISetSegmentBaseAddress( sel, DataSelectorBase + curroff ); /* * insert command line parms */ dataptr->thishandle = (WORD)thishandle; dataptr->prevhandle = (WORD)prevhandle; dataptr->cmdline = (DWORD) cmdline; dataptr->cmdshow = cmdshow; dataptr->_no87 = _no87; /* * set hardware selectors for screen memory */ dataptr->_A000H = (WORD) &_A000H; dataptr->_B000H = (WORD) &_B000H; dataptr->_B800H = (WORD) &_B800H; dataptr->_C000H = (WORD) &_C000H; dataptr->_D000H = (WORD) &_D000H; dataptr->_E000H = (WORD) &_E000H; dataptr->_F000H = (WORD) &_F000H; /* * ptrs to some data areas */ dataptr->CodeSelectorBase.seg = (WORD) FP_SEG( &CodeSelectorBase ); dataptr->CodeSelectorBase.off = (DWORD) FP_OFF( &CodeSelectorBase ); dataptr->DataSelectorBase.seg = (WORD) FP_SEG( &DataSelectorBase ); dataptr->DataSelectorBase.off = (DWORD) FP_OFF( &DataSelectorBase ); dataptr->_32BitCallBackAddr.seg = (WORD) FP_SEG( &_32BitCallBackAddr ); dataptr->_32BitCallBackAddr.off = (DWORD) FP_OFF( &_32BitCallBackAddr ); dataptr->_DLLEntryAddr.seg = (WORD) FP_SEG( &_DLLEntryAddr ); dataptr->_DLLEntryAddr.off = (DWORD) FP_OFF( &_DLLEntryAddr ); dataptr->_WEPAddr.seg = (WORD) FP_SEG( &_WEPAddr ); dataptr->_WEPAddr.off = (DWORD) FP_OFF( &_WEPAddr ); dataptr->_16BitCallBackAddr = &__CallBack; /* * insert glue routines into data area of caller */ for( j = 0; j < MaxGlueRoutines; j++ ) { dataptr->gluertns[j].seg = (WORD) FP_SEG( Glue[j].rtn ); dataptr->gluertns[j].off = (DWORD) FP_OFF( Glue[j].rtn ); } DPMIFreeAlias( sel ); /* * check for FPU and WGod */ if( flags & WF_80x87 ) { Has87 = TRUE; } else { Has87 = FALSE; } if( CheckWin386Debug() == WGOD_VERSION ) { // BreakPoint(); HasWGod = TRUE; if( !Has87 ) { EMUInit(); EMURegister( CodeEntry.seg, SaveSP - StackSize + FPU_AREA ); } } else { HasWGod = FALSE; } return( TRUE ); } /* Init32BitTask */
/* * HeapWalkProc - show task status */ BOOL FAR PASCAL HeapWalkProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { HMENU mh; HMENU mh2; HCURSOR hourglass; HCURSOR oldcursor; DLGPROC dlgproc; DWORD index; heap_list hl; GblWndInfo *info; RECT area; about_info ai; info = (GblWndInfo *)GetWindowLong( hwnd, 0 ); switch( msg ) { case WM_CREATE: InitPaintProc(); info = MemAlloc( sizeof( GblWndInfo ) ); if( info == NULL ) { ErrorBox( hwnd, STR_UNABLE_2_STARTUP, MB_OK | MB_ICONINFORMATION ); PostQuitMessage( 0 ); } memset( info, 0, sizeof( GblWndInfo ) ); SetWindowLong( hwnd, 0, (DWORD)info ); // hdc = GetDC( hwnd ); // ReleaseDC(hwnd, hdc); SetDisplayType( hwnd, &( info->list.title ), HEAPMENU_DISPLAY_INIT ); CreateListBox( hwnd, &info->list, GLOBAL_LB ); info->alloc_dlgproc = MakeProcInstance_DLG( AllocDlgProc, Instance ); info->alloc_dialog = JCreateDialog( Instance, "ALLOC_DLG", hwnd, info->alloc_dlgproc ); memset( &ResHwnd, 0, MAX_RES * sizeof( HWND ) ); break; case WM_MEASUREITEM: break; case WM_MOVE: GetWindowRect( hwnd, &area ); if( !info->minimized ) { Config.last_glob_xpos = Config.glob_xpos; Config.last_glob_ypos = Config.glob_ypos; Config.glob_xpos = area.left; Config.glob_ypos = area.top; } break; case WM_SIZE: ResizeListBox( LOWORD( lparam ), HIWORD( lparam ), &( info->list ) ); if( wparam == SIZE_MINIMIZED || wparam == SIZE_MAXIMIZED ) { Config.glob_xpos = Config.last_glob_xpos; Config.glob_ypos = Config.last_glob_ypos; } if( wparam == SIZE_MINIMIZED ) { info->minimized = TRUE; HideResources( TRUE ); } else if( info->minimized ) { HideResources( FALSE ); info->minimized = FALSE; } else if( wparam != SIZE_MAXIMIZED ) { GetWindowRect( hwnd, &area ); Config.glob_xsize = area.right - area.left; Config.glob_ysize = area.bottom - area.top; } return( DefWindowProc( hwnd, msg, wparam, lparam ) ); break; case WM_CLOSE: PostMessage( hwnd, WM_COMMAND, HEAPMENU_EXIT, 0L ); return( TRUE ); case WM_QUERYENDSESSION: SaveConfigFile( FALSE ); return( TRUE ); break; case WM_DESTROY: FiniPaintProc(); KillPushWin( info->list.title ); SaveConfigFile( FALSE ); if( info != NULL ) { FreeProcInstance_DLG( info->alloc_dlgproc ); MemFree( info ); } DestroyMonoFonts(); CvrCtl3dUnregister( Instance ); CvrCtl3DFini( Instance ); WWinHelp( hwnd, "heapwalk.hlp", HELP_QUIT, 0 ); PostQuitMessage( 0 ); break; case WM_ACTIVATEAPP: if( wparam && !NoRefresh ) { if( info->doing_add ) { info->need_refresh = TRUE; } else { InitHeapList( info->list.box, TRUE ); } } break; case WM_MENUSELECT: if( LOWORD( lparam & MF_POPUP ) ) { mh = GetMenu( hwnd ); mh2 = GetSubMenu( mh, 6 ); if( (HMENU)wparam == mh2 ) { ShowWindow( info->alloc_dialog, SW_SHOWNOACTIVATE ); } else if( (HMENU)wparam != GetSubMenu( mh2, 3 ) && (HMENU)wparam != GetSubMenu( mh2, 4 ) && (HMENU)wparam != GetSubMenu( mh2, 5 ) ) { ShowWindow( info->alloc_dialog, SW_HIDE ); } } return( DefWindowProc( hwnd, msg, wparam, lparam ) ); break; case WM_COMMAND: switch( wparam ) { case HEAPMENU_ABOUT: ai.owner = hwnd; ai.inst = Instance; ai.name = HWAllocRCString( STR_ABOUT_NAME ); ai.version = HWAllocRCString( STR_ABOUT_VERSION ); ai.title = HWAllocRCString( STR_ABOUT_TITLE ); DoAbout( &ai ); HWFreeRCString( ai.title ); HWFreeRCString( ai.version ); HWFreeRCString( ai.name ); break; case HEAPMENU_HELP_CONTENTS: WWinHelp( hwnd, "heapwalk.hlp", HELP_CONTENTS, 0 ); break; case HEAPMENU_HELP_SRCH: WWinHelp( hwnd, "heapwalk.hlp", HELP_PARTIALKEY, (HELP_DATA)(LPCSTR)"" ); break; case HEAPMENU_HELP_ON_HELP: WWinHelp( hwnd, "winhelp.hlp", HELP_HELPONHELP, 0 ); break; case HEAPEX_LIST: if( !info->doing_add ) { if( HIWORD( lparam ) == LBN_DBLCLK ) { ShowHeapObject( (HWND)LOWORD( lparam ) ); } } else { if( HIWORD( lparam ) == LBN_SELCHANGE || HIWORD( lparam ) == LBN_DBLCLK ) { RefreshAdd( info->add_dialog, info->list.box ); RedrawBox( info->list.box, index ); } } break; case HEAPMENU_GLOBAL_REFRESH: InitHeapList( info->list.box, TRUE ); break; case HEAPMENU_FONT: if( ChooseMonoFont( hwnd ) ) { ResetFont( info ); } break; case HEAPMENU_EXIT: DestroyWindow( hwnd ); FreeHeapList(); break; case HEAPMENU_DISPLAY_DPMI: case HEAPMENU_DISPLAY_ENTIRE: case HEAPMENU_DISPLAY_LRU: case HEAPMENU_DISPLAY_FREE: SetDisplayType( hwnd, &( info->list.title ), wparam ); InitHeapList( info->list.box, FALSE ); break; case HEAPMENU_SORT_ADDR: case HEAPMENU_SORT_HANDLE: case HEAPMENU_SORT_MODULE: case HEAPMENU_SORT_SIZE: case HEAPMENU_SORT_TYPE: case HEAPMENU_SORT_GRAN: case HEAPMENU_SORT_DPL: case HEAPMENU_SORT_FLAG: case HEAPMENU_SORT_LRU: mh = GetMenu( hwnd ); CheckMenuItem( mh, GSortType, MF_UNCHECKED | MF_BYCOMMAND ); CheckMenuItem( mh, wparam, MF_CHECKED | MF_BYCOMMAND ); if( GSortType != wparam ) { GSortType = wparam; SortHeapList(); ReDisplayHeapList( info->list.box, NULL ); } break; case HEAPMENU_OBJECT_SHOW: ShowHeapObject( info->list.box ); break; case HEAPMENU_OBJECT_DISCARD: if( GlobDiscardObj( info->list.box ) ) { InitHeapList( info->list.box, TRUE ); } break; case HEAPMENU_OBJECT_NEWEST: if( GlobSetObjPos( info->list.box, FALSE ) ) { if( GSortType == HEAPMENU_SORT_LRU ) { InitHeapList( info->list.box, TRUE ); } } break; case HEAPMENU_OBJECT_OLDEST: if( GlobSetObjPos( info->list.box, TRUE ) ) { if( GSortType == HEAPMENU_SORT_LRU ) { InitHeapList( info->list.box, TRUE ); } } break; case HEAPMENU_OBJECT_GET_SELECTOR: ShowSelector( info->list.box ); break; case HEAPMENU_GLOBAL_HEAPINFO: DisplayGlobHeapInfo( hwnd ); break; case HEAPMENU_GLOBAL_MEMORYINFO: DisplayMemManInfo( hwnd ); break; case HEAPMENU_GLOBAL_COMPACT: GlobalCompact( 0 ); InitHeapList( info->list.box, TRUE ); break; case HEAPMENU_GLOBAL_COMP_DISC: GlobalCompact( -1 ); InitHeapList( info->list.box, TRUE ); break; case HEAPMENU_GLOBAL_CODE_SIZE: dlgproc = MakeProcInstance_DLG( SetCodeDlgProc, Instance ); JDialogBox( Instance, "CODE_AREA_DLG", hwnd, dlgproc ); FreeProcInstance_DLG( dlgproc ); break; case HEAPMENU_FILE_SAVE: InitHeapList( info->list.box, TRUE ); SaveListBox( SLB_SAVE_TMP, PutOutGlobalHeader, DumpGlobalLine, Config.gfname, HeapWalkName, hwnd, info->list.box ); break; case HEAPMENU_FILE_SAVE_TO: InitHeapList( info->list.box, TRUE ); SaveListBox( SLB_SAVE_AS, PutOutGlobalHeader, DumpGlobalLine, Config.gfname, HeapWalkName, hwnd, info->list.box ); break; case HEAPMENU_SAVE_CONFIG: SaveConfigFile( TRUE ); break; case HEAPMENU_CONFIGURE: HWConfigure(); break; case HEAPMENU_LOCAL_MONITOR: index = CheckForLocalSelect( info ); if( index != LB_ERR ) { BeginMonitor( HeapList[index] ); } break; case HEAPMENU_COMPACT_AND_LOCALWALK: LocalCompact( -1 ); /* fall through */ case HEAPMENU_LOCAL_LOCALWALK: index = CheckForLocalSelect( info ); if( index != LB_ERR ) { LocalWalk( HeapList[index] ); } break; case HEAPMENU_GDI_LOCALWALK: if( GetDGroupItem( "GDI", &hl ) ) { LocalWalk( &hl ); } break; case HEAPMENU_USER_LOCALWALK: if( GetDGroupItem( "USER", &hl ) ) { LocalWalk( &hl ); } break; case HEAPMENU_FREE_ALL: MyFreeAllMem(); UpdateAllocInfo( info->alloc_dialog ); PaintAllWindows(); break; case HEAPMENU_FREE_1K: case HEAPMENU_FREE_2K: case HEAPMENU_FREE_5K: case HEAPMENU_FREE_10K: case HEAPMENU_FREE_25K: case HEAPMENU_FREE_50K: hourglass = LoadCursor( NULL, IDC_WAIT ); SetCapture( hwnd ); oldcursor= SetCursor( hourglass ); FreeSomeMem( wparam ); UpdateAllocInfo( info->alloc_dialog ); SetCursor( oldcursor ); ReleaseCapture(); PaintAllWindows(); break; case HEAPMENU_ALLOC_1K: case HEAPMENU_ALLOC_2K: case HEAPMENU_ALLOC_5K: case HEAPMENU_ALLOC_10K: case HEAPMENU_ALLOC_25K: case HEAPMENU_ALLOC_50K: hourglass = LoadCursor( NULL, IDC_WAIT ); SetCapture( hwnd ); oldcursor= SetCursor( hourglass ); AllocMore( wparam ); UpdateAllocInfo( info->alloc_dialog ); SetCursor( oldcursor ); ReleaseCapture(); PaintAllWindows(); break; case HEAPMENU_ALLOC_ALL: case HEAPMENU_ALLOC_BUT_1K: case HEAPMENU_ALLOC_BUT_2K: case HEAPMENU_ALLOC_BUT_5K: case HEAPMENU_ALLOC_BUT_10K: case HEAPMENU_ALLOC_BUT_25K: case HEAPMENU_ALLOC_BUT_50K: hourglass = LoadCursor( NULL, IDC_WAIT ); SetCapture( hwnd ); oldcursor= SetCursor( hourglass ); AllocAllBut( wparam ); UpdateAllocInfo( info->alloc_dialog ); SetCursor( oldcursor ); ReleaseCapture(); PaintAllWindows(); break; case HEAPMENU_ALLOC_NK: case HEAPMENU_ALLOC_BUT_NK: case HEAPMENU_FREE_NK: DoNBytes( hwnd, wparam ); UpdateAllocInfo( info->alloc_dialog ); PaintAllWindows(); break; case HEAPMENU_ADD: info->add_dialog = StartAdd( hwnd, &info->list ); if( info->add_dialog != NULL ) { info->doing_add = TRUE; info->need_refresh = FALSE; } else { ErrorBox( hwnd, STR_UNABLE_TO_ADD, MB_OK| MB_ICONINFORMATION ); } break; } break; case WM_USER: /* an owned window is being destroyed make sure * Windows doesn't take the focus away from us*/ NoRefresh = TRUE; SetFocus( hwnd ); NoRefresh = FALSE; break; default: return( DefWindowProc( hwnd, msg, wparam, lparam ) ); } return( FALSE ); } /* HeapWalkProc */