Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
f3301c6b
Commit
f3301c6b
authored
Apr 07, 2004
by
Juan Lang
Committed by
Alexandre Julliard
Apr 07, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- comment fixes
- improved error checking and conformance with Windows - remove some spurious error messages
parent
78f1224f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
209 additions
and
157 deletions
+209
-157
cpanelfolder.c
dlls/shell32/cpanelfolder.c
+1
-1
pidl.c
dlls/shell32/pidl.c
+34
-111
pidl.h
dlls/shell32/pidl.h
+7
-7
shellpath.c
dlls/shell32/shellpath.c
+167
-38
No files found.
dlls/shell32/cpanelfolder.c
View file @
f3301c6b
...
...
@@ -131,7 +131,7 @@ HRESULT WINAPI IControlPanel_Constructor(IUnknown* pUnkOuter, REFIID riid, LPVOI
sf
->
lpVtblPersistFolder2
=
&
vt_PersistFolder2
;
sf
->
lpVtblShellExecuteHookW
=
&
vt_ShellExecuteHookW
;
sf
->
lpVtblShellExecuteHookA
=
&
vt_ShellExecuteHookA
;
sf
->
pidlRoot
=
_ILCreateControl
();
/* my qualified pidl */
sf
->
pidlRoot
=
_ILCreateControl
Panel
();
/* my qualified pidl */
sf
->
pUnkOuter
=
pUnkOuter
?
pUnkOuter
:
_IUnknown_
(
sf
);
if
(
!
SUCCEEDED
(
IUnknown_QueryInterface
(
_IUnknown_
(
sf
),
riid
,
ppv
)))
{
...
...
dlls/shell32/pidl.c
View file @
f3301c6b
...
...
@@ -1080,94 +1080,6 @@ LPITEMIDLIST WINAPI SHSimpleIDListFromPathAW(LPCVOID lpszPath)
}
/*************************************************************************
* SHGetSpecialFolderLocation [SHELL32.@]
*
* gets the folder locations from the registry and creates a pidl
* creates missing reg keys and directories
*
* PARAMS
* hwndOwner [I]
* nFolder [I] CSIDL_xxxxx
* ppidl [O] PIDL of a special folder
*
* NOTES
* In NT5, SHGetSpecialFolderLocation needs the <winntdir>/Recent
* directory. If the directory is missing it returns a x80070002.
*/
HRESULT
WINAPI
SHGetSpecialFolderLocation
(
HWND
hwndOwner
,
INT
nFolder
,
LPITEMIDLIST
*
ppidl
)
{
CHAR
szPath
[
MAX_PATH
];
HRESULT
hr
=
E_INVALIDARG
;
TRACE_
(
shell
)(
"(%p,0x%x,%p)
\n
"
,
hwndOwner
,
nFolder
,
ppidl
);
if
(
ppidl
)
{
*
ppidl
=
NULL
;
switch
(
nFolder
)
{
case
CSIDL_DESKTOP
:
*
ppidl
=
_ILCreateDesktop
();
break
;
case
CSIDL_DRIVES
:
*
ppidl
=
_ILCreateMyComputer
();
break
;
case
CSIDL_NETWORK
:
*
ppidl
=
_ILCreateNetwork
();
break
;
case
CSIDL_CONTROLS
:
*
ppidl
=
_ILCreateControl
();
break
;
case
CSIDL_PRINTERS
:
*
ppidl
=
_ILCreatePrinter
();
break
;
case
CSIDL_BITBUCKET
:
*
ppidl
=
_ILCreateBitBucket
();
break
;
default:
if
(
SHGetSpecialFolderPathA
(
hwndOwner
,
szPath
,
nFolder
,
TRUE
))
{
DWORD
attributes
=
0
;
TRACE_
(
shell
)(
"Value=%s
\n
"
,
szPath
);
hr
=
SHILCreateFromPathA
(
szPath
,
ppidl
,
&
attributes
);
}
}
if
(
*
ppidl
)
hr
=
NOERROR
;
}
TRACE_
(
shell
)(
"-- (new pidl %p)
\n
"
,
*
ppidl
);
return
hr
;
}
/*************************************************************************
* SHGetFolderLocation [SHELL32.@]
*
* NOTES
* the pidl can be a simple one. since we can't get the path out of the pidl
* we have to take all data from the pidl
*/
HRESULT
WINAPI
SHGetFolderLocation
(
HWND
hwnd
,
int
csidl
,
HANDLE
hToken
,
DWORD
dwFlags
,
LPITEMIDLIST
*
ppidl
)
{
FIXME
(
"%p 0x%08x %p 0x%08lx %p
\n
"
,
hwnd
,
csidl
,
hToken
,
dwFlags
,
ppidl
);
return
SHGetSpecialFolderLocation
(
hwnd
,
csidl
,
ppidl
);
}
/*************************************************************************
* SHGetDataFromIDListA [SHELL32.247]
*
* NOTES
...
...
@@ -1517,12 +1429,6 @@ HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCI
* ### 1. section creating pidls ###
*
*************************************************************************
* _ILCreateDesktop()
* _ILCreateIExplore()
* _ILCreateMyComputer()
* _ILCreateDrive()
* _ILCreateFolder()
* _ILCreateValue()
*/
LPITEMIDLIST
_ILCreateDesktop
()
{
TRACE
(
"()
\n
"
);
...
...
@@ -1539,16 +1445,42 @@ LPITEMIDLIST _ILCreateIExplore()
return
_ILCreateGuid
(
PT_GUID
,
&
CLSID_Internet
);
}
LPITEMIDLIST
_ILCreateControl
()
{
TRACE
(
"()
\n
"
);
/* FIXME: needs to be child of MyComputer */
return
_ILCreateGuid
(
PT_SHELLEXT
,
&
CLSID_ControlPanel
);
LPITEMIDLIST
_ILCreateControlPanel
()
{
LPITEMIDLIST
parent
=
_ILCreateGuid
(
PT_GUID
,
&
CLSID_MyComputer
),
ret
=
NULL
;
TRACE
(
"()
\n
"
);
if
(
parent
)
{
LPITEMIDLIST
cpl
=
_ILCreateGuid
(
PT_GUID
,
&
CLSID_ControlPanel
);
if
(
cpl
)
{
ret
=
ILCombine
(
parent
,
cpl
);
SHFree
(
cpl
);
}
SHFree
(
parent
);
}
return
ret
;
}
LPITEMIDLIST
_ILCreatePrinter
()
{
TRACE
(
"()
\n
"
);
/* FIXME: needs to be child of MyComputer */
return
_ILCreateGuid
(
PT_SHELLEXT
,
&
CLSID_Printers
);
LPITEMIDLIST
_ILCreatePrinters
()
{
LPITEMIDLIST
parent
=
_ILCreateGuid
(
PT_GUID
,
&
CLSID_MyComputer
),
ret
=
NULL
;
TRACE
(
"()
\n
"
);
if
(
parent
)
{
LPITEMIDLIST
printers
=
_ILCreateGuid
(
PT_GUID
,
&
CLSID_ControlPanel
);
if
(
printers
)
{
ret
=
ILCombine
(
parent
,
printers
);
SHFree
(
printers
);
}
SHFree
(
parent
);
}
return
ret
;
}
LPITEMIDLIST
_ILCreateNetwork
()
...
...
@@ -1561,11 +1493,6 @@ LPITEMIDLIST _ILCreateBitBucket()
return
_ILCreateGuid
(
PT_GUID
,
&
CLSID_RecycleBin
);
}
/**************************************************************************
* _ILCreateGuid()
* Creates a new PIDL with type type (which can be one of PT_SHELLEXT or
* PT_GUID) with the given GUID data.
*/
LPITEMIDLIST
_ILCreateGuid
(
PIDLTYPE
type
,
REFIID
guid
)
{
LPITEMIDLIST
pidlOut
;
...
...
@@ -1621,10 +1548,6 @@ LPITEMIDLIST _ILCreateWithTypeAndSize(PIDLTYPE type, UINT size)
return
pidlOut
;
}
/**************************************************************************
* _ILCreateFromFindDataA()
* Creates a new PIDL from stffile
*/
LPITEMIDLIST
_ILCreateFromFindDataA
(
WIN32_FIND_DATAA
*
stffile
)
{
char
buff
[
MAX_PATH
+
14
+
1
];
/* see WIN32_FIND_DATA */
...
...
dlls/shell32/pidl.h
View file @
f3301c6b
...
...
@@ -77,10 +77,10 @@
*
* (1) dummy byte is used, attributes are empty
* (2) IID_MyComputer = 20D04FE0L-3AEA-1069-A2D8-08002B30309D
* (3) two strings "workgroup" "
microsoft n
etwork"
* (4)
one string "\\sirius
"
* (5) one string "
whole n
etwork"
* (6)
one string "\\sirius\c
"
* (3) two strings "workgroup" "
Microsoft N
etwork"
* (4)
two strings "\\sirius" "Microsoft Network
"
* (5) one string "
Entire N
etwork"
* (6)
two strings "\\sirius\c" "Microsoft Network
"
* (7) contains string "mk:@MSITStore:C:\path\file.chm::/path/filename.htm"
* GUID 871C5380-42A0-1069-A2EA-08002B30309D
*/
...
...
@@ -136,7 +136,7 @@ typedef struct tagPIDLDATA
WORD
uFileTime
;
/*08*/
WORD
uFileAttribs
;
/*10*/
CHAR
szNames
[
1
];
/*12*/
/* Here are com
m
ing two strings. The first is the long name.
/* 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
...
...
@@ -204,8 +204,8 @@ LPITEMIDLIST _ILCreateFromPathA (LPCSTR szPath);
/* Other helpers */
LPITEMIDLIST
_ILCreateMyComputer
(
void
);
LPITEMIDLIST
_ILCreateIExplore
(
void
);
LPITEMIDLIST
_ILCreateControl
(
void
);
LPITEMIDLIST
_ILCreatePrinter
(
void
);
LPITEMIDLIST
_ILCreateControl
Panel
(
void
);
LPITEMIDLIST
_ILCreatePrinter
s
(
void
);
LPITEMIDLIST
_ILCreateNetwork
(
void
);
LPITEMIDLIST
_ILCreateBitBucket
(
void
);
LPITEMIDLIST
_ILCreateDrive
(
LPCSTR
);
...
...
dlls/shell32/shellpath.c
View file @
f3301c6b
...
...
@@ -40,6 +40,7 @@
#include "shlobj.h"
#include "shell32_main.h"
#include "undocshell.h"
#include "pidl.h"
#include "wine/unicode.h"
#include "shlwapi.h"
...
...
@@ -714,9 +715,10 @@ typedef struct
#define HKLM HKEY_LOCAL_MACHINE
#define HKCU HKEY_CURRENT_USER
#define HKEY_DISALLOWED (HKEY)0
#define HKEY_UNIMPLEMENTED (HKEY)1
#define HKEY_WINDOWSPATH (HKEY)2
#define HKEY_
EMPTY
(HKEY)3
#define HKEY_
NONEXISTENT
(HKEY)3
static
const
CSIDL_DATA
CSIDL_Data
[]
=
{
{
/* CSIDL_DESKTOP */
...
...
@@ -725,14 +727,14 @@ static const CSIDL_DATA CSIDL_Data[] =
"Desktop"
},
{
/* CSIDL_INTERNET */
0
,
HKEY_
UNIMPLEMENTED
,
/* FIXME */
0
,
HKEY_
DISALLOWED
,
NULL
,
NULL
,
},
{
/* CSIDL_PROGRAMS */
9
,
HKCU
,
"Programs"
,
"Start Menu
\\
Programs"
0
,
HKEY_DISALLOWED
,
NULL
,
NULL
,
},
{
/* CSIDL_CONTROLS (.CPL files) */
10
,
HKLM
,
...
...
@@ -770,9 +772,9 @@ static const CSIDL_DATA CSIDL_Data[] =
"SendTo"
},
{
/* CSIDL_BITBUCKET - Recycle Bin */
0
,
HKEY_UNIMPLEMENTED
,
/* FIXME */
0
,
HKEY_DISALLOWED
,
NULL
,
NULL
,
"recycled"
},
{
/* CSIDL_STARTMENU */
9
,
HKCU
,
...
...
@@ -789,7 +791,7 @@ static const CSIDL_DATA CSIDL_Data[] =
"My Music"
,
"My Documents
\\
My Music"
},
{
/* CSIDL_MY
MUSIC
*/
{
/* CSIDL_MY
VIDEO
*/
1
,
HKCU
,
"My Video"
,
"My Documents
\\
My Video"
...
...
@@ -805,14 +807,14 @@ static const CSIDL_DATA CSIDL_Data[] =
"Desktop"
},
{
/* CSIDL_DRIVES */
0
,
HKEY_UNIMPLEMENTED
,
/* FIXME */
0
,
HKEY_DISALLOWED
,
NULL
,
NULL
,
"My Computer"
},
{
/* CSIDL_NETWORK */
0
,
HKEY_EMPTY
,
0
,
HKEY_DISALLOWED
,
NULL
,
NULL
,
"Network Neighborhood"
},
{
/* CSIDL_NETHOOD */
9
,
HKCU
,
...
...
@@ -865,12 +867,12 @@ static const CSIDL_DATA CSIDL_Data[] =
"Local Settings
\\
Application Data"
,
},
{
/* CSIDL_ALTSTARTUP */
0
,
HKEY_
UNIMPLEMENTED
,
/* FIXME */
0
,
HKEY_
NONEXISTENT
,
NULL
,
NULL
},
{
/* CSIDL_COMMON_ALTSTARTUP */
0
,
HKEY_
UNIMPLEMENTED
,
/* FIXME */
0
,
HKEY_
NONEXISTENT
,
NULL
,
NULL
},
...
...
@@ -965,22 +967,22 @@ static const CSIDL_DATA CSIDL_Data[] =
"Start Menu
\\
Programs
\\
Administrative Tools"
},
{
/* CSIDL_CONNECTIONS */
0
,
0
,
/* FIXME */
0
,
HKEY_DISALLOWED
,
NULL
,
NULL
},
{
/* unassigned 32 */
0
,
0
,
0
,
HKEY_DISALLOWED
,
NULL
,
NULL
},
{
/* unassigned 33 */
0
,
0
,
0
,
HKEY_DISALLOWED
,
NULL
,
NULL
},
{
/* unassigned 34 */
0
,
0
,
0
,
HKEY_DISALLOWED
,
NULL
,
NULL
},
...
...
@@ -1056,22 +1058,20 @@ HRESULT WINAPI SHGetFolderPathW(
TRACE
(
"%p,%p,csidl=0x%04x
\n
"
,
hwndOwner
,
pszPath
,
csidl
);
if
(
!
pszPath
)
return
E_INVALIDARG
;
*
pszPath
=
'\0'
;
if
((
folder
>=
sizeof
(
CSIDL_Data
)
/
sizeof
(
CSIDL_Data
[
0
]))
||
(
CSIDL_Data
[
folder
].
hRootKey
==
0
))
{
ERR
(
"folder 0x%04lx unknown or not allowed
\n
"
,
folder
);
return
E_FAIL
;
}
(
CSIDL_Data
[
folder
].
hRootKey
==
HKEY_DISALLOWED
))
return
E_INVALIDARG
;
if
(
CSIDL_Data
[
folder
].
hRootKey
==
HKEY_UNIMPLEMENTED
)
{
FIXME
(
"folder 0x%04lx unknown, please add.
\n
"
,
folder
);
return
E_FAIL
;
}
if
(
CSIDL_Data
[
folder
].
hRootKey
==
HKEY_EMPTY
)
{
*
pszPath
=
'\0'
;
return
S_OK
;
}
if
(
CSIDL_Data
[
folder
].
hRootKey
==
HKEY_NONEXISTENT
)
return
S_FALSE
;
/* Special case for some values that don't exist in registry */
if
(
CSIDL_Data
[
folder
].
hRootKey
==
HKEY_WINDOWSPATH
)
...
...
@@ -1212,19 +1212,21 @@ HRESULT WINAPI SHGetFolderPathA(
DWORD
dwFlags
,
LPSTR
pszPath
)
{
WCHAR
szTemp
[
MAX_PATH
];
HRESULT
hr
;
WCHAR
szTemp
[
MAX_PATH
];
HRESULT
hr
;
hr
=
SHGetFolderPathW
(
hwndOwner
,
csidl
,
hToken
,
dwFlags
,
szTemp
);
if
(
hr
==
S_OK
)
{
if
(
!
WideCharToMultiByte
(
CP_ACP
,
0
,
szTemp
,
-
1
,
pszPath
,
MAX_PATH
,
NULL
,
NULL
))
pszPath
[
MAX_PATH
-
1
]
=
0
;
}
if
(
!
pszPath
)
return
E_INVALIDARG
;
TRACE
(
"%p,%p,csidl=0x%04x
\n
"
,
hwndOwner
,
pszPath
,
csidl
);
*
pszPath
=
'\0'
;
hr
=
SHGetFolderPathW
(
hwndOwner
,
csidl
,
hToken
,
dwFlags
,
szTemp
);
if
(
SUCCEEDED
(
hr
))
WideCharToMultiByte
(
CP_ACP
,
0
,
szTemp
,
-
1
,
pszPath
,
MAX_PATH
,
NULL
,
NULL
);
return
hr
;
TRACE
(
"%p,%p,csidl=0x%04x
\n
"
,
hwndOwner
,
pszPath
,
csidl
);
return
hr
;
}
/*************************************************************************
...
...
@@ -1275,3 +1277,130 @@ BOOL WINAPI SHGetSpecialFolderPathAW (
return
SHGetSpecialFolderPathW
(
hwndOwner
,
szPath
,
csidl
,
bCreate
);
return
SHGetSpecialFolderPathA
(
hwndOwner
,
szPath
,
csidl
,
bCreate
);
}
/*************************************************************************
* SHGetSpecialFolderLocation [SHELL32.@]
*
* gets the folder locations from the registry and creates a pidl
* creates missing reg keys and directories
*
* PARAMS
* hwndOwner [I]
* nFolder [I] CSIDL_xxxxx
* ppidl [O] PIDL of a special folder
*
* NOTES
* In NT5, SHGetSpecialFolderLocation needs the <winntdir>/Recent
* directory. If the directory is missing it returns a x80070002.
* In most cases, this forwards to SHGetSpecialFolderPath, but
* CSIDLs with virtual folders (not real paths) must be handled
* here.
*/
HRESULT
WINAPI
SHGetSpecialFolderLocation
(
HWND
hwndOwner
,
INT
nFolder
,
LPITEMIDLIST
*
ppidl
)
{
HRESULT
hr
=
E_INVALIDARG
;
TRACE
(
"(%p,0x%x,%p)
\n
"
,
hwndOwner
,
nFolder
,
ppidl
);
if
(
!
ppidl
)
return
E_INVALIDARG
;
*
ppidl
=
NULL
;
switch
(
nFolder
)
{
case
CSIDL_DESKTOP
:
*
ppidl
=
_ILCreateDesktop
();
break
;
case
CSIDL_INTERNET
:
*
ppidl
=
_ILCreateIExplore
();
break
;
case
CSIDL_CONTROLS
:
*
ppidl
=
_ILCreateControlPanel
();
break
;
case
CSIDL_PRINTERS
:
*
ppidl
=
_ILCreatePrinters
();
break
;
case
CSIDL_BITBUCKET
:
*
ppidl
=
_ILCreateBitBucket
();
break
;
case
CSIDL_DRIVES
:
*
ppidl
=
_ILCreateMyComputer
();
break
;
case
CSIDL_NETWORK
:
*
ppidl
=
_ILCreateNetwork
();
break
;
case
CSIDL_ALTSTARTUP
:
case
CSIDL_COMMON_ALTSTARTUP
:
hr
=
E_FAIL
;
break
;
case
CSIDL_COMPUTERSNEARME
:
hr
=
E_FAIL
;
break
;
default:
{
WCHAR
szPath
[
MAX_PATH
];
if
(
SHGetSpecialFolderPathW
(
hwndOwner
,
szPath
,
nFolder
,
TRUE
))
{
DWORD
attributes
=
0
;
TRACE
(
"Value=%s
\n
"
,
debugstr_w
(
szPath
));
hr
=
SHILCreateFromPathW
(
szPath
,
ppidl
,
&
attributes
);
}
}
}
if
(
*
ppidl
)
hr
=
NOERROR
;
TRACE
(
"-- (new pidl %p)
\n
"
,
*
ppidl
);
return
hr
;
}
/*************************************************************************
* SHGetFolderLocation [SHELL32.@]
*
* NOTES
* the pidl can be a simple one. since we can't get the path out of the pidl
* we have to take all data from the pidl
* Mostly we forward to SHGetSpecialFolderLocation, but a few special cases
* we handle here.
*/
HRESULT
WINAPI
SHGetFolderLocation
(
HWND
hwnd
,
int
csidl
,
HANDLE
hToken
,
DWORD
dwFlags
,
LPITEMIDLIST
*
ppidl
)
{
HRESULT
hr
;
TRACE_
(
shell
)(
"%p 0x%08x %p 0x%08lx %p
\n
"
,
hwnd
,
csidl
,
hToken
,
dwFlags
,
ppidl
);
if
(
!
ppidl
)
return
E_INVALIDARG
;
switch
(
csidl
)
{
case
CSIDL_ALTSTARTUP
:
case
CSIDL_COMMON_ALTSTARTUP
:
*
ppidl
=
NULL
;
hr
=
S_FALSE
;
break
;
default:
hr
=
SHGetSpecialFolderLocation
(
hwnd
,
csidl
,
ppidl
);
}
return
hr
;
}
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