summaryrefslogtreecommitdiffstats
path: root/private/mvdm/wow16/toolhelp/usergdi1.c
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/mvdm/wow16/toolhelp/usergdi1.c
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/mvdm/wow16/toolhelp/usergdi1.c')
-rw-r--r--private/mvdm/wow16/toolhelp/usergdi1.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/private/mvdm/wow16/toolhelp/usergdi1.c b/private/mvdm/wow16/toolhelp/usergdi1.c
new file mode 100644
index 000000000..05aac84ce
--- /dev/null
+++ b/private/mvdm/wow16/toolhelp/usergdi1.c
@@ -0,0 +1,77 @@
+/**************************************************************************
+ * USERGDI1.C
+ *
+ * Returns information about USER.EXE and GDI.EXE
+ *
+ **************************************************************************/
+
+#include "toolpriv.h"
+
+/* SystemHeapInfo
+ * Returns information about USER's and GDI's heaps
+ */
+
+BOOL TOOLHELPAPI SystemHeapInfo(
+ SYSHEAPINFO FAR* lpSysHeap)
+{
+ MODULEENTRY ModuleEntry;
+#ifndef WOW
+ DWORD dw;
+ WORD wFreeK;
+ WORD wMaxHeapK;
+#endif
+
+ /* Check the structure version number and pointer */
+ if (!wLibInstalled || !lpSysHeap ||
+ lpSysHeap->dwSize != sizeof (SYSHEAPINFO))
+ return FALSE;
+
+ /* Find the user data segment */
+ ModuleEntry.dwSize = sizeof (MODULEENTRY);
+ lpSysHeap->hUserSegment =
+ UserGdiDGROUP(ModuleFindName(&ModuleEntry, "USER"));
+ lpSysHeap->hGDISegment =
+ UserGdiDGROUP(ModuleFindName(&ModuleEntry, "GDI"));
+
+#ifndef WOW
+ /* We get the information about the heap percentages differently in
+ * 3.0 and 3.1
+ */
+ if ((wTHFlags & TH_WIN30) || !lpfnGetFreeSystemResources)
+ {
+ /* Get the space information about USER's heap */
+ dw = UserGdiSpace(lpSysHeap->hUserSegment);
+ wFreeK = LOWORD(dw) / 1024;
+ wMaxHeapK = HIWORD(dw) / 1024;
+ if (wMaxHeapK)
+ lpSysHeap->wUserFreePercent = wFreeK * 100 / wMaxHeapK;
+ else
+ lpSysHeap->wUserFreePercent = 0;
+
+ /* Get the space information about GDI's heap */
+ dw = UserGdiSpace(lpSysHeap->hGDISegment);
+ wFreeK = LOWORD(dw) / 1024;
+ wMaxHeapK = HIWORD(dw) / 1024;
+ if (wMaxHeapK)
+ lpSysHeap->wGDIFreePercent = wFreeK * 100 / wMaxHeapK;
+ else
+ lpSysHeap->wGDIFreePercent = 0;
+ }
+
+ /* Get the information from USER in 3.1 */
+ else
+ {
+ lpSysHeap->wUserFreePercent =
+ (*(WORD (FAR PASCAL *)(WORD))lpfnGetFreeSystemResources)(2);
+ lpSysHeap->wGDIFreePercent =
+ (*(WORD (FAR PASCAL *)(WORD))lpfnGetFreeSystemResources)(1);
+ }
+#else
+
+ lpSysHeap->wUserFreePercent = GetFreeSystemResources(GFSR_USERRESOURCES);
+ lpSysHeap->wGDIFreePercent = GetFreeSystemResources(GFSR_GDIRESOURCES);
+
+#endif
+
+ return TRUE;
+}