Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
b25fdbb2
Commit
b25fdbb2
authored
Aug 30, 2007
by
Francois Gouget
Committed by
Alexandre Julliard
Aug 30, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Move SHAddDataBlock() to the front and remove the forward declaration.
parent
56633069
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
97 deletions
+95
-97
clist.c
dlls/shlwapi/clist.c
+95
-97
No files found.
dlls/shlwapi/clist.c
View file @
b25fdbb2
...
...
@@ -34,8 +34,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
/* dwSignature for contained DATABLOCK_HEADER items */
#define CLIST_ID_CONTAINER (~0U)
HRESULT
WINAPI
SHAddDataBlock
(
LPDBLIST
*
,
const
DATABLOCK_HEADER
*
);
/*************************************************************************
* NextItem
*
...
...
@@ -49,6 +47,101 @@ static inline LPDATABLOCK_HEADER NextItem(LPDBLIST lpList)
}
/*************************************************************************
* @ [SHLWAPI.20]
*
* Insert a new item into a DataBlock list.
*
* PARAMS
* lppList [0] Pointer to the List
* lpNewItem [I] The new item to add to the list
*
* RETURNS
* Success: S_OK. The item is added to the list.
* Failure: An HRESULT error code.
*
* NOTES
* If the size of the element to be inserted is less than the size of a
* DATABLOCK_HEADER node, or the Id for the item is CLIST_ID_CONTAINER,
* the call returns S_OK but does not actually add the element.
* See SHWriteDataBlockList.
*/
HRESULT
WINAPI
SHAddDataBlock
(
LPDBLIST
*
lppList
,
const
DATABLOCK_HEADER
*
lpNewItem
)
{
LPDATABLOCK_HEADER
lpInsertAt
=
NULL
;
ULONG
ulSize
;
TRACE
(
"(%p,%p)
\n
"
,
lppList
,
lpNewItem
);
if
(
!
lppList
||
!
lpNewItem
)
return
E_INVALIDARG
;
if
(
lpNewItem
->
cbSize
<
sizeof
(
DATABLOCK_HEADER
)
||
lpNewItem
->
dwSignature
==
CLIST_ID_CONTAINER
)
return
S_OK
;
ulSize
=
lpNewItem
->
cbSize
;
if
(
ulSize
&
0x3
)
{
/* Tune size to a ULONG boundary, add space for container element */
ulSize
=
((
ulSize
+
0x3
)
&
0xFFFFFFFC
)
+
sizeof
(
DATABLOCK_HEADER
);
TRACE
(
"Creating container item, new size = %d
\n
"
,
ulSize
);
}
if
(
!*
lppList
)
{
/* An empty list. Allocate space for terminal ulSize also */
*
lppList
=
(
LPDATABLOCK_HEADER
)
LocalAlloc
(
LMEM_ZEROINIT
,
ulSize
+
sizeof
(
ULONG
));
lpInsertAt
=
*
lppList
;
}
else
{
/* Append to the end of the list */
ULONG
ulTotalSize
=
0
;
LPDATABLOCK_HEADER
lpIter
=
*
lppList
;
/* Iterate to the end of the list, calculating the total size */
while
(
lpIter
->
cbSize
)
{
ulTotalSize
+=
lpIter
->
cbSize
;
lpIter
=
NextItem
(
lpIter
);
}
/* Increase the size of the list */
lpIter
=
(
LPDATABLOCK_HEADER
)
LocalReAlloc
((
HLOCAL
)
*
lppList
,
ulTotalSize
+
ulSize
+
sizeof
(
ULONG
),
LMEM_ZEROINIT
|
LMEM_MOVEABLE
);
if
(
lpIter
)
{
*
lppList
=
lpIter
;
lpInsertAt
=
(
LPDATABLOCK_HEADER
)((
char
*
)
lpIter
+
ulTotalSize
);
/* At end */
}
}
if
(
lpInsertAt
)
{
/* Copy in the new item */
LPDATABLOCK_HEADER
lpDest
=
lpInsertAt
;
if
(
ulSize
!=
lpNewItem
->
cbSize
)
{
lpInsertAt
->
cbSize
=
ulSize
;
lpInsertAt
->
dwSignature
=
CLIST_ID_CONTAINER
;
lpDest
++
;
}
memcpy
(
lpDest
,
lpNewItem
,
lpNewItem
->
cbSize
);
/* Terminate the list */
lpInsertAt
=
NextItem
(
lpInsertAt
);
lpInsertAt
->
cbSize
=
0
;
return
lpNewItem
->
cbSize
;
}
return
S_OK
;
}
/*************************************************************************
* @ [SHLWAPI.17]
*
* Write a DataBlock list to an IStream object.
...
...
@@ -247,101 +340,6 @@ VOID WINAPI SHFreeDataBlockList(LPDBLIST lpList)
}
/*************************************************************************
* @ [SHLWAPI.20]
*
* Insert a new item into a DataBlock list.
*
* PARAMS
* lppList [0] Pointer to the List
* lpNewItem [I] The new item to add to the list
*
* RETURNS
* Success: S_OK. The item is added to the list.
* Failure: An HRESULT error code.
*
* NOTES
* If the size of the element to be inserted is less than the size of a
* DATABLOCK_HEADER node, or the Id for the item is CLIST_ID_CONTAINER,
* the call returns S_OK but does not actually add the element.
* See SHWriteDataBlockList.
*/
HRESULT
WINAPI
SHAddDataBlock
(
LPDBLIST
*
lppList
,
const
DATABLOCK_HEADER
*
lpNewItem
)
{
LPDATABLOCK_HEADER
lpInsertAt
=
NULL
;
ULONG
ulSize
;
TRACE
(
"(%p,%p)
\n
"
,
lppList
,
lpNewItem
);
if
(
!
lppList
||
!
lpNewItem
)
return
E_INVALIDARG
;
if
(
lpNewItem
->
cbSize
<
sizeof
(
DATABLOCK_HEADER
)
||
lpNewItem
->
dwSignature
==
CLIST_ID_CONTAINER
)
return
S_OK
;
ulSize
=
lpNewItem
->
cbSize
;
if
(
ulSize
&
0x3
)
{
/* Tune size to a ULONG boundary, add space for container element */
ulSize
=
((
ulSize
+
0x3
)
&
0xFFFFFFFC
)
+
sizeof
(
DATABLOCK_HEADER
);
TRACE
(
"Creating container item, new size = %d
\n
"
,
ulSize
);
}
if
(
!*
lppList
)
{
/* An empty list. Allocate space for terminal ulSize also */
*
lppList
=
(
LPDATABLOCK_HEADER
)
LocalAlloc
(
LMEM_ZEROINIT
,
ulSize
+
sizeof
(
ULONG
));
lpInsertAt
=
*
lppList
;
}
else
{
/* Append to the end of the list */
ULONG
ulTotalSize
=
0
;
LPDATABLOCK_HEADER
lpIter
=
*
lppList
;
/* Iterate to the end of the list, calculating the total size */
while
(
lpIter
->
cbSize
)
{
ulTotalSize
+=
lpIter
->
cbSize
;
lpIter
=
NextItem
(
lpIter
);
}
/* Increase the size of the list */
lpIter
=
(
LPDATABLOCK_HEADER
)
LocalReAlloc
((
HLOCAL
)
*
lppList
,
ulTotalSize
+
ulSize
+
sizeof
(
ULONG
),
LMEM_ZEROINIT
|
LMEM_MOVEABLE
);
if
(
lpIter
)
{
*
lppList
=
lpIter
;
lpInsertAt
=
(
LPDATABLOCK_HEADER
)((
char
*
)
lpIter
+
ulTotalSize
);
/* At end */
}
}
if
(
lpInsertAt
)
{
/* Copy in the new item */
LPDATABLOCK_HEADER
lpDest
=
lpInsertAt
;
if
(
ulSize
!=
lpNewItem
->
cbSize
)
{
lpInsertAt
->
cbSize
=
ulSize
;
lpInsertAt
->
dwSignature
=
CLIST_ID_CONTAINER
;
lpDest
++
;
}
memcpy
(
lpDest
,
lpNewItem
,
lpNewItem
->
cbSize
);
/* Terminate the list */
lpInsertAt
=
NextItem
(
lpInsertAt
);
lpInsertAt
->
cbSize
=
0
;
return
lpNewItem
->
cbSize
;
}
return
S_OK
;
}
/*************************************************************************
* @ [SHLWAPI.21]
*
* Remove an item from a DataBlock list.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment