[4/5] comctl32/dpa: Implement DPA_GetSize()

Nikolay Sivov bunglehead at gmail.com
Sun Sep 13 13:37:31 CDT 2009


Changelog:
    - Implement DPA_GetSize()

>From 49312d605ce5c3ce86037e45cbafb69009771284 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Sun, 13 Sep 2009 03:13:42 +0400
Subject: Implement DPA_GetSize()

---
 dlls/comctl32/comctl32.spec |    1 +
 dlls/comctl32/dpa.c         |   25 +++++++++++++++++++++++--
 include/commctrl.h          |    1 +
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/comctl32.spec b/dlls/comctl32/comctl32.spec
index e852916..4249d56 100644
--- a/dlls/comctl32/comctl32.spec
+++ b/dlls/comctl32/comctl32.spec
@@ -125,6 +125,7 @@
 @ stdcall DestroyPropertySheetPage(long)
 @ stdcall -private DllGetVersion(ptr)
 @ stdcall -private DllInstall(long wstr)
+@ stdcall DPA_GetSize(ptr)
 @ stdcall DrawShadowText(long wstr long ptr long long long long long)
 @ stdcall DrawStatusText(long ptr ptr long) DrawStatusTextA
 @ stdcall DrawStatusTextW(long ptr wstr long)
diff --git a/dlls/comctl32/dpa.c b/dlls/comctl32/dpa.c
index beab967..6a72604 100644
--- a/dlls/comctl32/dpa.c
+++ b/dlls/comctl32/dpa.c
@@ -45,14 +45,14 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(dpa);
 
-struct _DPA
+typedef struct _DPA
 {
     INT    nItemCount;
     LPVOID   *ptrs;
     HANDLE hHeap;
     INT    nGrow;
     INT    nMaxCount;
-};
+} DPA;
 
 typedef struct _STREAMDATA
 {
@@ -997,3 +997,24 @@ void WINAPI DPA_DestroyCallback (HDPA hdpa, PFNDPAENUMCALLBACK enumProc,
     DPA_EnumCallback (hdpa, enumProc, lParam);
     DPA_Destroy (hdpa);
 }
+
+/**************************************************************************
+ * DPA_GetSize [COMCTL32.@]
+ *
+ * Returns all array allocated memory size
+ *
+ * PARAMS
+ *     hdpa     [I] handle to the dynamic pointer array
+ *
+ * RETURNS
+ *     Size in bytes
+ */
+ULONGLONG WINAPI DPA_GetSize(HDPA hdpa)
+{
+    TRACE("(%p)\n", hdpa);
+
+    if (!hdpa) return 0;
+
+    return sizeof(DPA) + hdpa->nMaxCount*sizeof(PVOID);
+}
+
diff --git a/include/commctrl.h b/include/commctrl.h
index bda13de..ae417c0 100644
--- a/include/commctrl.h
+++ b/include/commctrl.h
@@ -5003,6 +5003,7 @@ BOOL   WINAPI DPA_DeleteAllPtrs(HDPA);
 BOOL   WINAPI DPA_SetPtr(HDPA, INT, LPVOID);
 LPVOID WINAPI DPA_GetPtr(HDPA, INT);
 INT    WINAPI DPA_GetPtrIndex(HDPA, LPCVOID);
+ULONGLONG WINAPI DPA_GetSize(HDPA);
 BOOL   WINAPI DPA_Grow(HDPA, INT);
 INT    WINAPI DPA_InsertPtr(HDPA, INT, LPVOID);
 BOOL   WINAPI DPA_Sort(HDPA, PFNDPACOMPARE, LPARAM);
-- 
1.5.6.5







More information about the wine-patches mailing list