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
bbdd20d5
Commit
bbdd20d5
authored
Apr 14, 2004
by
Juan Lang
Committed by
Alexandre Julliard
Apr 14, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct some PIDL types and eliminate some magic numbers in PIDL
allocation; correct a copy-pasto from a previous patch.
parent
77beaca7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
65 deletions
+82
-65
cpanelfolder.c
dlls/shell32/cpanelfolder.c
+2
-2
debughlp.c
dlls/shell32/debughlp.c
+2
-4
pidl.c
dlls/shell32/pidl.c
+42
-35
pidl.h
dlls/shell32/pidl.h
+36
-24
No files found.
dlls/shell32/cpanelfolder.c
View file @
bbdd20d5
...
@@ -239,7 +239,7 @@ static LPITEMIDLIST _ILCreateCPanelApplet(LPCSTR name, LPCSTR displayName,
...
@@ -239,7 +239,7 @@ static LPITEMIDLIST _ILCreateCPanelApplet(LPCSTR name, LPCSTR displayName,
int
size
=
size0
;
int
size
=
size0
;
int
l
;
int
l
;
tmp
.
type
=
0
;
tmp
.
type
=
PT_CPLAPPLET
;
tmp
.
u
.
cpanel
.
dummy
=
0
;
tmp
.
u
.
cpanel
.
dummy
=
0
;
tmp
.
u
.
cpanel
.
iconIdx
=
iconIdx
;
tmp
.
u
.
cpanel
.
iconIdx
=
iconIdx
;
...
@@ -281,7 +281,7 @@ static PIDLCPanelStruct* _ILGetCPanelPointer(LPCITEMIDLIST pidl)
...
@@ -281,7 +281,7 @@ static PIDLCPanelStruct* _ILGetCPanelPointer(LPCITEMIDLIST pidl)
{
{
LPPIDLDATA
pdata
=
_ILGetDataPointer
(
pidl
);
LPPIDLDATA
pdata
=
_ILGetDataPointer
(
pidl
);
if
(
pdata
&&
pdata
->
type
==
0
)
if
(
pdata
&&
pdata
->
type
==
PT_CPLAPPLET
)
return
(
PIDLCPanelStruct
*
)
&
(
pdata
->
u
.
cpanel
);
return
(
PIDLCPanelStruct
*
)
&
(
pdata
->
u
.
cpanel
);
return
NULL
;
return
NULL
;
...
...
dlls/shell32/debughlp.c
View file @
bbdd20d5
...
@@ -200,9 +200,7 @@ void pdump (LPCITEMIDLIST pidl)
...
@@ -200,9 +200,7 @@ void pdump (LPCITEMIDLIST pidl)
char
szName
[
MAX_PATH
];
char
szName
[
MAX_PATH
];
_dbg_ILSimpleGetText
(
pidltemp
,
szName
,
MAX_PATH
);
_dbg_ILSimpleGetText
(
pidltemp
,
szName
,
MAX_PATH
);
if
(
PT_FOLDER
==
type
)
if
(
PT_FOLDER
==
type
||
PT_VALUE
==
type
)
dwAttrib
=
pData
->
u
.
folder
.
uFileAttribs
;
else
if
(
PT_VALUE
==
type
)
dwAttrib
=
pData
->
u
.
file
.
uFileAttribs
;
dwAttrib
=
pData
->
u
.
file
.
uFileAttribs
;
MESSAGE
(
"[%p] size=%04u type=%lx attr=0x%08lx name=
\"
%s
\"
(%s,%s)
\n
"
,
MESSAGE
(
"[%p] size=%04u type=%lx attr=0x%08lx name=
\"
%s
\"
(%s,%s)
\n
"
,
...
@@ -229,7 +227,7 @@ BOOL pcheck (LPCITEMIDLIST pidl)
...
@@ -229,7 +227,7 @@ BOOL pcheck (LPCITEMIDLIST pidl)
{
do
{
do
{
type
=
_dbg_ILGetDataPointer
(
pidltemp
)
->
type
;
{
type
=
_dbg_ILGetDataPointer
(
pidltemp
)
->
type
;
switch
(
type
)
switch
(
type
)
{
case
PT_
DESKTOP
:
{
case
PT_
CPLAPPLET
:
case
PT_GUID
:
case
PT_GUID
:
case
PT_SHELLEXT
:
case
PT_SHELLEXT
:
case
PT_DRIVE
:
case
PT_DRIVE
:
...
...
dlls/shell32/pidl.c
View file @
bbdd20d5
...
@@ -1440,9 +1440,38 @@ HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCI
...
@@ -1440,9 +1440,38 @@ HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCI
*
*
*************************************************************************
*************************************************************************
*/
*/
LPITEMIDLIST
_ILAlloc
(
PIDLTYPE
type
,
size_t
size
)
{
LPITEMIDLIST
pidlOut
=
NULL
;
if
((
pidlOut
=
SHAlloc
(
size
+
5
)))
{
LPPIDLDATA
pData
;
LPITEMIDLIST
pidlNext
;
ZeroMemory
(
pidlOut
,
size
+
5
);
pidlOut
->
mkid
.
cb
=
size
+
3
;
if
((
pData
=
_ILGetDataPointer
(
pidlOut
)))
pData
->
type
=
type
;
if
((
pidlNext
=
ILGetNext
(
pidlOut
)))
pidlNext
->
mkid
.
cb
=
0x00
;
TRACE
(
"-- (pidl=%p, size=%u)
\n
"
,
pidlOut
,
size
);
}
return
pidlOut
;
}
LPITEMIDLIST
_ILCreateDesktop
()
LPITEMIDLIST
_ILCreateDesktop
()
{
TRACE
(
"()
\n
"
);
{
return
_ILCreateWithTypeAndSize
(
PT_DESKTOP
,
0
);
LPITEMIDLIST
ret
;
TRACE
(
"()
\n
"
);
ret
=
SHAlloc
(
2
);
if
(
ret
)
ret
->
mkid
.
cb
=
0
;
return
ret
;
}
}
LPITEMIDLIST
_ILCreateMyComputer
()
LPITEMIDLIST
_ILCreateMyComputer
()
...
@@ -1481,7 +1510,7 @@ LPITEMIDLIST _ILCreatePrinters()
...
@@ -1481,7 +1510,7 @@ LPITEMIDLIST _ILCreatePrinters()
TRACE
(
"()
\n
"
);
TRACE
(
"()
\n
"
);
if
(
parent
)
if
(
parent
)
{
{
LPITEMIDLIST
printers
=
_ILCreateGuid
(
PT_GUID
,
&
CLSID_
ControlPanel
);
LPITEMIDLIST
printers
=
_ILCreateGuid
(
PT_GUID
,
&
CLSID_
Printers
);
if
(
printers
)
if
(
printers
)
{
{
...
@@ -1509,7 +1538,7 @@ LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, REFIID guid)
...
@@ -1509,7 +1538,7 @@ LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, REFIID guid)
if
(
type
==
PT_SHELLEXT
||
type
==
PT_GUID
)
if
(
type
==
PT_SHELLEXT
||
type
==
PT_GUID
)
{
{
pidlOut
=
_IL
CreateWithTypeAndSize
(
type
,
2
+
2
+
sizeof
(
GUID
));
pidlOut
=
_IL
Alloc
(
type
,
sizeof
(
GUIDStruct
));
if
(
pidlOut
)
if
(
pidlOut
)
{
{
LPPIDLDATA
pData
=
_ILGetDataPointer
(
pidlOut
);
LPPIDLDATA
pData
=
_ILGetDataPointer
(
pidlOut
);
...
@@ -1539,30 +1568,11 @@ LPITEMIDLIST _ILCreateGuidFromStrA(LPCSTR szGUID)
...
@@ -1539,30 +1568,11 @@ LPITEMIDLIST _ILCreateGuidFromStrA(LPCSTR szGUID)
return
_ILCreateGuid
(
PT_GUID
,
&
iid
);
return
_ILCreateGuid
(
PT_GUID
,
&
iid
);
}
}
LPITEMIDLIST
_ILCreateWithTypeAndSize
(
PIDLTYPE
type
,
UINT
size
)
{
LPITEMIDLIST
pidlOut
=
NULL
,
pidlTemp
=
NULL
;
LPPIDLDATA
pData
;
if
(
!
(
pidlOut
=
SHAlloc
(
size
+
2
)))
return
NULL
;
ZeroMemory
(
pidlOut
,
size
+
2
);
pidlOut
->
mkid
.
cb
=
size
;
if
((
pData
=
_ILGetDataPointer
(
pidlOut
)))
pData
->
type
=
type
;
if
((
pidlTemp
=
ILGetNext
(
pidlOut
)))
pidlTemp
->
mkid
.
cb
=
0x00
;
TRACE
(
"-- (pidl=%p, size=%u)
\n
"
,
pidlOut
,
size
);
return
pidlOut
;
}
LPITEMIDLIST
_ILCreateFromFindDataA
(
WIN32_FIND_DATAA
*
stffile
)
LPITEMIDLIST
_ILCreateFromFindDataA
(
WIN32_FIND_DATAA
*
stffile
)
{
{
char
buff
[
MAX_PATH
+
14
+
1
];
/* see WIN32_FIND_DATA */
char
buff
[
MAX_PATH
+
14
+
1
];
/* see WIN32_FIND_DATA */
char
*
pbuff
=
buff
;
char
*
pbuff
=
buff
;
ULONG
len
,
len1
;
size_t
len
,
len1
;
LPITEMIDLIST
pidl
;
LPITEMIDLIST
pidl
;
PIDLTYPE
type
;
PIDLTYPE
type
;
...
@@ -1581,8 +1591,10 @@ LPITEMIDLIST _ILCreateFromFindDataA(WIN32_FIND_DATAA * stffile )
...
@@ -1581,8 +1591,10 @@ LPITEMIDLIST _ILCreateFromFindDataA(WIN32_FIND_DATAA * stffile )
type
=
(
stffile
->
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
?
PT_FOLDER
:
type
=
(
stffile
->
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
?
PT_FOLDER
:
PT_VALUE
;
PT_VALUE
;
/* FIXME: magic #s! */
/* FileStruct already has one byte for the first name, so use len - 1 in
if
((
pidl
=
_ILCreateWithTypeAndSize
(
type
,
2
+
12
+
len
+
len1
)))
* size calculation
*/
if
((
pidl
=
_ILAlloc
(
type
,
sizeof
(
FileStruct
)
+
(
len
-
1
)
+
len1
)))
{
{
LPPIDLDATA
pData
;
LPPIDLDATA
pData
;
LPSTR
pszDest
;
LPSTR
pszDest
;
...
@@ -1591,9 +1603,9 @@ LPITEMIDLIST _ILCreateFromFindDataA(WIN32_FIND_DATAA * stffile )
...
@@ -1591,9 +1603,9 @@ LPITEMIDLIST _ILCreateFromFindDataA(WIN32_FIND_DATAA * stffile )
if
((
pData
=
_ILGetDataPointer
(
pidl
)))
if
((
pData
=
_ILGetDataPointer
(
pidl
)))
{
{
pData
->
type
=
type
;
pData
->
type
=
type
;
FileTimeToDosDateTime
(
&
(
stffile
->
ftLastWriteTime
),
&
pData
->
u
.
f
older
.
uFileDate
,
&
pData
->
u
.
folder
.
uFileTime
);
FileTimeToDosDateTime
(
&
(
stffile
->
ftLastWriteTime
),
&
pData
->
u
.
f
ile
.
uFileDate
,
&
pData
->
u
.
file
.
uFileTime
);
pData
->
u
.
f
older
.
dwFileSize
=
stffile
->
nFileSizeLow
;
pData
->
u
.
f
ile
.
dwFileSize
=
stffile
->
nFileSizeLow
;
pData
->
u
.
f
older
.
uFileAttribs
=
(
WORD
)
stffile
->
dwFileAttributes
;
pData
->
u
.
f
ile
.
uFileAttribs
=
(
WORD
)
stffile
->
dwFileAttributes
;
}
}
if
((
pszDest
=
_ILGetTextPointer
(
pidl
)))
if
((
pszDest
=
_ILGetTextPointer
(
pidl
)))
{
{
...
@@ -1630,8 +1642,7 @@ LPITEMIDLIST _ILCreateDrive( LPCSTR lpszNew)
...
@@ -1630,8 +1642,7 @@ LPITEMIDLIST _ILCreateDrive( LPCSTR lpszNew)
sTemp
[
3
]
=
0x00
;
sTemp
[
3
]
=
0x00
;
TRACE
(
"(%s)
\n
"
,
sTemp
);
TRACE
(
"(%s)
\n
"
,
sTemp
);
/* FIXME: magic #s! */
if
((
pidlOut
=
_ILAlloc
(
PT_DRIVE
,
sizeof
(
DriveStruct
))))
if
((
pidlOut
=
_ILCreateWithTypeAndSize
(
PT_DRIVE
,
25
)))
{
{
LPSTR
pszDest
;
LPSTR
pszDest
;
...
@@ -1971,8 +1982,6 @@ BOOL _ILGetFileDateTime(LPCITEMIDLIST pidl, FILETIME *pFt)
...
@@ -1971,8 +1982,6 @@ BOOL _ILGetFileDateTime(LPCITEMIDLIST pidl, FILETIME *pFt)
switch
(
pdata
->
type
)
switch
(
pdata
->
type
)
{
{
case
PT_FOLDER
:
case
PT_FOLDER
:
DosDateTimeToFileTime
(
pdata
->
u
.
folder
.
uFileDate
,
pdata
->
u
.
folder
.
uFileTime
,
pFt
);
break
;
case
PT_VALUE
:
case
PT_VALUE
:
DosDateTimeToFileTime
(
pdata
->
u
.
file
.
uFileDate
,
pdata
->
u
.
file
.
uFileTime
,
pFt
);
DosDateTimeToFileTime
(
pdata
->
u
.
file
.
uFileDate
,
pdata
->
u
.
file
.
uFileTime
,
pFt
);
break
;
break
;
...
@@ -2130,8 +2139,6 @@ DWORD _ILGetFileAttributes(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
...
@@ -2130,8 +2139,6 @@ DWORD _ILGetFileAttributes(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
switch
(
pData
->
type
)
switch
(
pData
->
type
)
{
{
case
PT_FOLDER
:
case
PT_FOLDER
:
wAttrib
=
pData
->
u
.
folder
.
uFileAttribs
;
break
;
case
PT_VALUE
:
case
PT_VALUE
:
wAttrib
=
pData
->
u
.
file
.
uFileAttribs
;
wAttrib
=
pData
->
u
.
file
.
uFileAttribs
;
break
;
break
;
...
...
dlls/shell32/pidl.h
View file @
bbdd20d5
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
* internal pidl functions
* internal pidl functions
*
*
* Copyright 1998 Juergen Schmied
* Copyright 1998 Juergen Schmied
* Copyright 2004 Juan Lang
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* modify it under the terms of the GNU Lesser General Public
...
@@ -85,7 +86,7 @@
...
@@ -85,7 +86,7 @@
* GUID 871C5380-42A0-1069-A2EA-08002B30309D
* GUID 871C5380-42A0-1069-A2EA-08002B30309D
*/
*/
#define PT_
DESKTOP 0x00
/* internal */
#define PT_
CPLAPPLET 0x00
#define PT_GUID 0x1F
#define PT_GUID 0x1F
#define PT_DRIVE 0x23
#define PT_DRIVE 0x23
#define PT_DRIVE2 0x25
#define PT_DRIVE2 0x25
...
@@ -116,29 +117,37 @@ typedef struct tagPIDLCPanelStruct
...
@@ -116,29 +117,37 @@ typedef struct tagPIDLCPanelStruct
CHAR
szName
[
1
];
/*10*/
/* terminated by 0x00, followed by display name and comment string */
CHAR
szName
[
1
];
/*10*/
/* terminated by 0x00, followed by display name and comment string */
}
PIDLCPanelStruct
;
}
PIDLCPanelStruct
;
typedef
struct
tagGUIDStruct
{
BYTE
dummy
;
/* offset 01 is unknown */
GUID
guid
;
/* offset 02 */
}
GUIDStruct
;
typedef
struct
tagDriveStruct
{
CHAR
szDriveName
[
20
];
/*01*/
WORD
unknown
;
/*21*/
}
DriveStruct
;
typedef
struct
tagFileStruct
{
BYTE
dummy
;
/*01 is 0x00 for files or dirs */
DWORD
dwFileSize
;
/*02*/
WORD
uFileDate
;
/*06*/
WORD
uFileTime
;
/*08*/
WORD
uFileAttribs
;
/*10*/
CHAR
szNames
[
1
];
/*12*/
/* Here are coming two strings. The first is the long name.
The second the dos name when needed or just 0x00 */
}
FileStruct
;
typedef
struct
tagPIDLDATA
typedef
struct
tagPIDLDATA
{
PIDLTYPE
type
;
/*00*/
{
PIDLTYPE
type
;
/*00*/
union
union
{
struct
{
{
BYTE
dummy
;
/*01*/
struct
tagGUIDStruct
guid
;
GUID
guid
;
/*02*/
struct
tagDriveStruct
drive
;
BYTE
dummy1
;
/*18*/
struct
tagFileStruct
file
;
}
guid
;
struct
{
CHAR
szDriveName
[
20
];
/*01*/
DWORD
dwUnknown
;
/*21*/
/* the drive seems to be 25 bytes every time */
}
drive
;
struct
{
BYTE
dummy
;
/*01 is 0x00 for files or dirs */
DWORD
dwFileSize
;
/*02*/
WORD
uFileDate
;
/*06*/
WORD
uFileTime
;
/*08*/
WORD
uFileAttribs
;
/*10*/
CHAR
szNames
[
1
];
/*12*/
/* Here are coming two strings. The first is the long name.
The second the dos name when needed or just 0x00 */
}
file
,
folder
,
generic
;
struct
struct
{
WORD
dummy
;
/*01*/
{
WORD
dummy
;
/*01*/
CHAR
szNames
[
1
];
/*03*/
CHAR
szNames
[
1
];
/*03*/
...
@@ -183,10 +192,13 @@ BOOL _ILIsCPanelStruct (LPCITEMIDLIST pidl);
...
@@ -183,10 +192,13 @@ BOOL _ILIsCPanelStruct (LPCITEMIDLIST pidl);
* simple pidls
* simple pidls
*/
*/
/* Basic PIDL constructor. Allocates size + 2 bytes (to include space for the
/* Basic PIDL constructor. Allocates size + 5 bytes, where:
* NULL PIDL terminator), and sets type to type.
* - two bytes are SHITEMID.cb
* - one byte is PIDLDATA.type
* - two bytes are the NULL PIDL terminator
* Sets type of the returned PIDL to type.
*/
*/
LPITEMIDLIST
_IL
CreateWithTypeAndSize
(
PIDLTYPE
type
,
UINT
size
);
LPITEMIDLIST
_IL
Alloc
(
PIDLTYPE
type
,
size_t
size
);
/* Creates a PIDL with guid format and type type, which must be either PT_GUID
/* Creates a PIDL with guid format and type type, which must be either PT_GUID
* or PT_SHELLEXT.
* or PT_SHELLEXT.
...
...
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