2 static char RCSId[] = "$Id: user.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
3 static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
13 #include "sysmetrics.h"
24 #define USER_HEAP_SIZE 0x10000
27 LPSTR USER_Heap
= NULL
;
28 WORD USER_HeapSel
= 0;
31 /***********************************************************************
32 * GetFreeSystemResources (USER.284)
34 WORD
GetFreeSystemResources( WORD resType
)
40 case GFSR_USERRESOURCES
:
41 user
= GetHeapSpaces( USER_HeapSel
);
45 case GFSR_GDIRESOURCES
:
46 gdi
= GetHeapSpaces( GDI_HeapSel
);
50 case GFSR_SYSTEMRESOURCES
:
51 user
= GetHeapSpaces( USER_HeapSel
);
52 gdi
= GetHeapSpaces( GDI_HeapSel
);
58 if (user
> gdi
) return LOWORD(gdi
) * 100 / HIWORD(gdi
);
59 else return LOWORD(user
) * 100 / HIWORD(user
);
63 /***********************************************************************
64 * SystemHeapInfo (TOOLHELP.71)
66 BOOL
SystemHeapInfo( SYSHEAPINFO
*pHeapInfo
)
68 pHeapInfo
->wUserFreePercent
= GetFreeSystemResources( GFSR_USERRESOURCES
);
69 pHeapInfo
->wGDIFreePercent
= GetFreeSystemResources( GFSR_GDIRESOURCES
);
70 pHeapInfo
->hUserSegment
= USER_HeapSel
;
71 pHeapInfo
->hGDISegment
= GDI_HeapSel
;
76 /***********************************************************************
77 * TimerCount (TOOLHELP.80)
79 BOOL
TimerCount( TIMERINFO
*pTimerInfo
)
82 * In standard mode, dwmsSinceStart = dwmsThisVM
84 * I tested this, under Windows in enhanced mode, and
85 * if you never switch VM (ie start/stop DOS) these
86 * values should be the same as well.
88 * Also, Wine should adjust for the hardware timer
89 * to reduce the amount of error to ~1ms.
90 * I can't be bothered, can you?
92 pTimerInfo
->dwmsSinceStart
= pTimerInfo
->dwmsThisVM
= GetTickCount();
96 /***********************************************************************
99 BOOL
USER_HeapInit(void)
101 if (!(USER_HeapSel
= GlobalAlloc(GMEM_FIXED
,USER_HEAP_SIZE
))) return FALSE
;
102 USER_Heap
= GlobalLock( USER_HeapSel
);
103 LocalInit( USER_HeapSel
, 0, USER_HEAP_SIZE
-1 );
109 /**********************************************************************
112 int USER_InitApp(HINSTANCE hInstance
)
116 /* Create task message queue */
117 queueSize
= GetProfileInt( "windows", "DefaultQueueSize", 8 );
118 if (!SetMessageQueue( queueSize
)) return 0;