Home > Software engineering >  There are ways to direct access to the PIDL corresponding files?
There are ways to direct access to the PIDL corresponding files?

Time:10-01

Including copy, delete the PIDL corresponding file, or access to its content,
Note that is accessed through PIDL directly, rather than to put it into a file name to access,

Concrete example is, such as USB/MTP protocol connect to PC, be able to get its PIDL, but cannot use SHGetPathFromIDList into the file name, how the object through the PIDL visit?

CodePudding user response:

The lower encapsulation? Pretending to be a direct access to the

CodePudding user response:

Access to these devices need to use CreateFile and introduced into a particular format string, at least Microsoft did not open directly using the PIDL read a file, such as communication port data, the path of the CreateFile can pass in the format string:

The native file:
X: \ path \ file ext
\ \? \ x: \ path \ file ext
The Shared file:
\ \ server \ share \ path \ file ext
\ \? \ UNC \ server \ share \ path \ file ext
Communication port (X for the decimal number)
COMX
LTPX
\ \? \ LTPX
\ \? \ COMX
Disk: (X for the decimal number)
\ \. \ CdRomX
\ \. \ PhysicalDiskX
\ \. \ Device \ HarddiskVolumeX

Above is the most, but I do not guarantee complete, in addition, the string is refers to the parameters of the actual content of the above, in C, Java, the backslash cleartext string need to escape, namely into two,

CodePudding user response:

From the application, need to pass the PIDL is converted to a path, and then use the API to access such as CreateFile

CodePudding user response:

 
Void CMyExploreView: : PopulateList (LPTVITEMDATA lptvid)
{//the from lptvid - & gt; Lpsfparent - & gt; Current_folder
LPSHELLFOLDER lpsf2=NULL;
Retrieves the hr;
//Initialize the list view to be empty.
CListCtrl & amp; RightList=GetListCtrl ();
RightList. DeleteAllItems ();
//ask for current folder
If (lptvid)
{
Hr=lptvid - & gt; LpsfParent - & gt; BindToObject (lptvid - & gt; Lpi,
0, IID_IShellFolder, (LPVOID *) & amp; Lpsf2);
If (SUCCEEDED (hr))
{//current dir oK
FillListView (lpsf2 lptvid - & gt; Lpifq);//
Lpsf2 - & gt; Release ();
//then sorting
RightList. SortItems (ListViewCompareProc, 0);//the name
}
}
}


hr=lptvid - & gt; LpsfParent - & gt; BindToObject (lptvid - & gt; Lpi,

CodePudding user response:

Where
Typedef struct tagID
{
LPSHELLFOLDER lpsfParent;
LPITEMIDLIST lpi;
LPITEMIDLIST lpifq;
} TVITEMDATA, * LPTVITEMDATA;
  • Related