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
5136f57f
Commit
5136f57f
authored
Jan 03, 2006
by
Michael Jung
Committed by
Alexandre Julliard
Jan 03, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Helper function for unicode support in folder and file pidls.
parent
b34868df
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
4 deletions
+64
-4
pidl.c
dlls/shell32/pidl.c
+49
-4
pidl.h
dlls/shell32/pidl.h
+15
-0
No files found.
dlls/shell32/pidl.c
View file @
5136f57f
...
...
@@ -1811,15 +1811,21 @@ DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize)
*/
DWORD
_ILSimpleGetTextW
(
LPCITEMIDLIST
pidl
,
LPWSTR
szOut
,
UINT
uOutSize
)
{
DWORD
dwReturn
;
DWORD
dwReturn
;
char
szTemp
[
MAX_PATH
];
FileStructW
*
pFileStructW
=
_ILGetFileStructW
(
pidl
);
TRACE
(
"(%p %p %x)
\n
"
,
pidl
,
szOut
,
uOutSize
);
dwReturn
=
_ILSimpleGetText
(
pidl
,
szTemp
,
uOutSize
);
if
(
pFileStructW
)
{
lstrcpynW
(
szOut
,
pFileStructW
->
wszName
,
uOutSize
);
dwReturn
=
lstrlenW
(
pFileStructW
->
wszName
);
}
else
{
dwReturn
=
_ILSimpleGetText
(
pidl
,
szTemp
,
MAX_PATH
);
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
szTemp
,
-
1
,
szOut
,
MAX_PATH
))
*
szOut
=
0
;
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
szTemp
,
-
1
,
szOut
,
uOutSize
))
*
szOut
=
0
;
}
TRACE
(
"-- (%p=%s 0x%08lx)
\n
"
,
szOut
,
debugstr_w
(
szOut
),
dwReturn
);
return
dwReturn
;
...
...
@@ -1938,6 +1944,45 @@ IID* _ILGetGUIDPointer(LPCITEMIDLIST pidl)
return
NULL
;
}
/******************************************************************************
* _ILGetFileStructW [Internal]
*
* Get pointer the a SHITEMID's FileStructW field if present
*
* PARAMS
* pidl [I] The SHITEMID
*
* RETURNS
* Success: Pointer to pidl's FileStructW field.
* Failure: NULL
*/
FileStructW
*
_ILGetFileStructW
(
LPCITEMIDLIST
pidl
)
{
FileStructW
*
pFileStructW
;
WORD
cbOffset
;
if
(
!
(
_ILIsValue
(
pidl
)
||
_ILIsFolder
(
pidl
)))
return
NULL
;
cbOffset
=
*
(
WORD
*
)((
LPBYTE
)
pidl
+
pidl
->
mkid
.
cb
-
sizeof
(
WORD
));
pFileStructW
=
(
FileStructW
*
)((
LPBYTE
)
pidl
+
cbOffset
);
/* Currently I don't see a fool prove way to figure out if a pidl is for sure of WinXP
* style with a FileStructW member. If we switch all our shellfolder-implementations to
* the new format, this won't be a problem. For now, we do as many sanity checks as possible. */
if
(
cbOffset
&
0x1
||
/* FileStructW member is word aligned in the pidl */
/* FileStructW is positioned after FileStruct */
cbOffset
<
sizeof
(
pidl
->
mkid
.
cb
)
+
sizeof
(
PIDLTYPE
)
+
sizeof
(
FileStruct
)
||
/* There has to be enough space at cbOffset in the pidl to hold FileStructW and cbOffset */
cbOffset
>
pidl
->
mkid
.
cb
-
sizeof
(
cbOffset
)
-
sizeof
(
FileStructW
)
||
pidl
->
mkid
.
cb
!=
cbOffset
+
pFileStructW
->
cbLen
)
{
WARN
(
"Invalid pidl format (cbOffset = %d)!
\n
"
,
cbOffset
);
return
NULL
;
}
return
pFileStructW
;
}
/*************************************************************************
* _ILGetFileDateTime
*
...
...
dlls/shell32/pidl.h
View file @
5136f57f
...
...
@@ -143,6 +143,20 @@ typedef struct tagFileStruct
The second the dos name when needed or just 0x00 */
}
FileStruct
;
/* At least on WinXP, this struct is appended with 2-byte-alignment to FileStruct. There follows
* a WORD member after the wszName string, which gives the offset from the beginning of the PIDL
* to the FileStructW member. */
typedef
struct
tagFileStructW
{
WORD
cbLen
;
BYTE
dummy1
[
6
];
WORD
uCreationDate
;
WORD
uCreationTime
;
WORD
uLastAccessDate
;
WORD
uLastAccessTime
;
BYTE
dummy2
[
4
];
WCHAR
wszName
[
1
];
}
FileStructW
;
typedef
struct
tagValueW
{
WCHAR
name
[
1
];
...
...
@@ -240,6 +254,7 @@ LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST);
LPSTR
_ILGetTextPointer
(
LPCITEMIDLIST
);
LPSTR
_ILGetSTextPointer
(
LPCITEMIDLIST
);
IID
*
_ILGetGUIDPointer
(
LPCITEMIDLIST
pidl
);
FileStructW
*
_ILGetFileStructW
(
LPCITEMIDLIST
pidl
);
/*
* debug helper
...
...
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