2 * Undocumented functions from COMCTL32.DLL
4 * Copyright 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de>
7 * All of these functions are UNDOCUMENTED!! And I mean UNDOCUMENTED!!!!
8 * Do NOT rely on names of undocumented structures and types!!!
9 * These functions are used by EXPLORER.EXE, IEXPLORE.EXE and
10 * COMCTL32.DLL (internally).
13 * - Fix DSA_InsertItem.
15 * - Write documentation.
24 typedef struct _DSA_DATA
31 } DSA_DATA
, *LPDSA_DATA
;
34 typedef struct _DPA_DATA
40 } DPA_DATA
, *LPDPA_DATA
;
43 DWORD WINAPI
DSA_Create (DWORD
, DWORD
);
46 DWORD WINAPI
DPA_Create (DWORD
);
47 DWORD WINAPI
DPA_GetPtr (DWORD
, DWORD
);
48 DWORD WINAPI
DPA_InsertPtr (DWORD
, DWORD
, DWORD
);
55 COMCTL32_Alloc (DWORD dwParam
)
59 dwPtr
= (DWORD
)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
, dwParam
);
61 TRACE (commctrl
, "(0x%08lx) ret=0x%08lx\n", dwParam
, dwPtr
);
68 COMCTL32_ReAlloc (DWORD dwParam1
, DWORD dwParam2
)
73 dwPtr
= (DWORD
)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
76 dwPtr
= (DWORD
)HeapReAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
77 (LPVOID
)dwParam1
, dwParam2
);
79 TRACE (commctrl
, "(0x%08lx 0x%08lx) ret=0x%08lx\n",
80 dwParam1
, dwParam2
, dwPtr
);
87 COMCTL32_Free (DWORD dwParam
)
89 TRACE (commctrl
, "(0x%08lx)\n", dwParam
);
90 HeapFree (GetProcessHeap (), 0, (LPVOID
)dwParam
);
97 COMCTL32_GetSize (DWORD dwParam
)
99 TRACE (commctrl
, "(0x%08lx)\n", dwParam
);
100 return (HeapSize (GetProcessHeap (), 0, (LPVOID
)dwParam
));
106 DSA_Create (DWORD dwParam1
, DWORD dwParam2
)
110 dsaPtr
= (LPDSA_DATA
)HeapAlloc (SystemHeap
, HEAP_ZERO_MEMORY
, sizeof(DSA_DATA
));
111 dsaPtr
->dwInitial
= dwParam1
;
112 dsaPtr
->dwGrow
= dwParam2
;
114 TRACE (commctrl
, "(0x%08lx 0x%08lx) ret=0x%08lx\n",
115 dwParam1
, dwParam2
, (DWORD
)dsaPtr
);
117 return (DWORD
)dsaPtr
;
122 DSA_Destroy (DWORD dwParam1
)
124 LPDSA_DATA dsaPtr
= (LPDSA_DATA
)dwParam1
;
127 TRACE (commctrl
, "(0x%08lx):semi-stub!\n", dwParam1
);
130 for (i
= 0; i
< dsaPtr
->dwEntryCount
; i
++) {
132 HeapFree (SystemHeap
, 0, (LPSTR
)dsaPtr
->ptrs
[i
]);
136 HeapFree (SystemHeap
, 0, dsaPtr
);
143 DSA_GetItem (DWORD dwParam1
, DWORD dwParam2
, DWORD dwParam3
)
145 FIXME (commctrl
, "(0x%08lx 0x%08lx 0x%08lx): stub!\n",
146 dwParam1
, dwParam2
, dwParam3
);
153 DSA_GetItemPtr (DWORD dwParam1
, DWORD dwParam2
)
155 LPDSA_DATA dsaPtr
= (LPDSA_DATA
)dwParam1
;
157 TRACE (commctrl
, "(0x%08lx 0x%08lx)\n", dwParam1
, dwParam2
);
161 if (dsaPtr
->ptrs
== NULL
)
163 if ((dwParam2
< 0) || (dwParam2
>= dsaPtr
->dwEntryCount
))
166 TRACE (commctrl
, "ret=0x%08lx\n", (DWORD
)dsaPtr
->ptrs
[dwParam2
]);
168 return (DWORD
)dsaPtr
->ptrs
[dwParam2
];
173 DSA_InsertItem (DWORD dwParam1
, DWORD dwParam2
, DWORD dwParam3
)
175 LPDSA_DATA dsaPtr
= (LPDSA_DATA
)dwParam1
;
179 TRACE (commctrl
, "(0x%08lx 0x%08lx \"%s\"):semi-stub!\n",
180 dwParam1
, dwParam2
, (LPSTR
)dwParam3
);
182 if (dsaPtr
->ptrs
== NULL
) {
183 dsaPtr
->ptrs
= (LPSTR
*)HeapAlloc (SystemHeap
, HEAP_ZERO_MEMORY
,
184 dsaPtr
->dwInitial
* sizeof(LPVOID
));
185 dsaPtr
->dwMaxCount
= dsaPtr
->dwInitial
;
187 len
= lstrlen32A ((LPSTR
)dwParam3
);
188 dsaPtr
->ptrs
[dwIndex
] =
189 (LPSTR
)HeapAlloc (SystemHeap
, HEAP_ZERO_MEMORY
, len
+1);
190 lstrcpy32A (dsaPtr
->ptrs
[dwIndex
], (LPSTR
)dwParam3
);
193 TRACE (commctrl
, "(0x%08lx 0x%08lx)\n",
194 dsaPtr
->dwEntryCount
, dsaPtr
->dwMaxCount
);
195 if (dwParam2
>= dsaPtr
->dwEntryCount
) {
196 if (dsaPtr
->dwEntryCount
< dsaPtr
->dwMaxCount
) {
197 dwIndex
= dsaPtr
->dwEntryCount
;
198 len
= lstrlen32A ((LPSTR
)dwParam3
);
199 dsaPtr
->ptrs
[dwIndex
] =
200 (LPSTR
)HeapAlloc (SystemHeap
, HEAP_ZERO_MEMORY
, len
+1);
201 lstrcpy32A (dsaPtr
->ptrs
[dwIndex
], (LPSTR
)dwParam3
);
204 FIXME (commctrl
, "resizing array! stub!\n");
211 FIXME (commctrl
, "inserting! stub!\n");
217 dsaPtr
->dwEntryCount
++;
219 TRACE (commctrl
, "ret=0x%08lx\n", dwIndex
);
228 DSA_DeleteItem (DWORD dwParam1
, DWORD dwParam2
)
230 LPDSA_DATA dsaPtr
= (LPDSA_DATA
)dwParam1
;
232 TRACE (commctrl
, "(0x%08lx 0x%08lx):semi-stub!\n",
236 if (dsaPtr
->dwEntryCount
== 1) {
237 if (dsaPtr
->ptrs
[dwParam2
])
238 HeapFree (SystemHeap
, 0, dsaPtr
->ptrs
[dwParam2
]);
239 dsaPtr
->dwEntryCount
--;
242 LPSTR
*oldPtrs
= dsaPtr
->ptrs
;
243 TRACE (commctrl
, "complex delete!\n");
245 if (dsaPtr
->ptrs
[dwParam2
])
246 HeapFree (SystemHeap
, 0, dsaPtr
->ptrs
[dwParam2
]);
248 dsaPtr
->dwEntryCount
--;
250 (LPSTR
*)HeapAlloc (SystemHeap
, HEAP_ZERO_MEMORY
,
251 dsaPtr
->dwEntryCount
* sizeof(LPVOID
));
253 memcpy (&dsaPtr
->ptrs
[0], &oldPtrs
[0],
254 dwParam2
* sizeof(LPSTR
));
257 if (dwParam2
< dsaPtr
->dwEntryCount
) {
258 memcpy (&dsaPtr
->ptrs
[dwParam2
], &oldPtrs
[dwParam2
+1],
259 (dsaPtr
->dwEntryCount
- dwParam2
) * sizeof(LPSTR
));
261 HeapFree (SystemHeap
, 0, oldPtrs
);
264 if (dsaPtr
->dwEntryCount
== 0) {
265 HeapFree (SystemHeap
, 0, dsaPtr
->ptrs
);
278 DPA_Create (DWORD dwParam1
)
282 TRACE (commctrl
, "(0x%08lx)\n", dwParam1
);
284 dpaPtr
= (LPDPA_DATA
)HeapAlloc (SystemHeap
, HEAP_ZERO_MEMORY
, sizeof(DPA_DATA
));
285 dpaPtr
->dwGrow
= dwParam1
;
287 TRACE (commctrl
, "ret=0x%08lx\n", (DWORD
)dpaPtr
);
289 return (DWORD
)dpaPtr
;
295 DPA_GetPtr (DWORD dwParam1
, DWORD dwParam2
)
297 LPDPA_DATA dpaPtr
= (LPDPA_DATA
)dwParam1
;
299 TRACE (commctrl
, "(0x%08lx 0x%08lx)\n", dwParam1
, dwParam2
);
303 if (dpaPtr
->ptrs
== NULL
)
305 if ((dwParam2
< 0) || (dwParam2
>= dpaPtr
->dwEntryCount
))
308 TRACE (commctrl
, "ret=0x%08lx\n", (DWORD
)dpaPtr
->ptrs
[dwParam2
]);
310 return (DWORD
)dpaPtr
->ptrs
[dwParam2
];
316 DPA_InsertPtr (DWORD dwParam1
, DWORD dwParam2
, DWORD dwParam3
)
318 LPDPA_DATA dpaPtr
= (LPDPA_DATA
)dwParam1
;
321 TRACE (commctrl
, "(0x%08lx 0x%08lx 0x%lx)\n",
322 dwParam1
, dwParam2
, dwParam3
);
324 if (dpaPtr
->ptrs
== NULL
) {
325 dpaPtr
->ptrs
= (LPDWORD
)HeapAlloc (SystemHeap
, HEAP_ZERO_MEMORY
,
326 dpaPtr
->dwGrow
* sizeof(LPVOID
));
327 dpaPtr
->dwMaxCount
= dpaPtr
->dwGrow
;
329 dpaPtr
->ptrs
[dwIndex
] = dwParam3
;
332 FIXME (commctrl
, "adding to existing array! stub!\n");
338 dpaPtr
->dwEntryCount
++;
345 COMCTL32_StrChrA (LPSTR lpString
, CHAR cChar
)
347 return strchr (lpString
, cChar
);