ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

pidl.h
Go to the documentation of this file.
00001 /*
00002  * internal pidl functions
00003  *
00004  * Copyright 1998 Juergen Schmied
00005  * Copyright 2004 Juan Lang
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00020  *
00021  * NOTES:
00022  *
00023  * DO NOT use this definitions outside the shell32.dll !
00024  *
00025  * The contents of a pidl should never used from a application
00026  * directly.
00027  *
00028  * Undocumented:
00029  * MS says: the abID of SHITEMID should be treated as binary data and not
00030  * be interpreted by applications. Applies to everyone but MS itself.
00031  * Word95 interprets the contents of abID (Filesize/Date) so we have to go
00032  * for binary compatibility here.
00033  */
00034 
00035 #ifndef __WINE_PIDL_H
00036 #define __WINE_PIDL_H
00037 
00038 #include <stdarg.h>
00039 
00040 #include <windef.h>
00041 #include <winbase.h>
00042 #include <winuser.h>
00043 #include <shlobj.h>
00044 
00045 /*
00046 * the pidl does cache fileattributes to speed up SHGetAttributes when
00047 * displaying a big number of files.
00048 *
00049 * a pidl of NULL means the desktop
00050 *
00051 * The structure of the pidl seems to be a union. The first byte of the
00052 * PIDLDATA describes the type of pidl.
00053 *
00054 *   object        ! first byte /  ! format       ! living space
00055 *                 ! size
00056 *   ----------------------------------------------------------------
00057 *   my computer 0x1F/20     guid (2)    (usual)
00058 *   network     0x1F        guid
00059 *   bitbucket   0x1F        guid
00060 *   drive       0x23/25     drive       (usual)
00061 *   drive       0x25/25     drive       (lnk/persistent)
00062 *   drive       0x29/25     drive
00063 *   shell extension 0x2E        guid
00064 *   drive       0x2F        drive       (lnk/persistent)
00065 *   folder/file 0x30        folder/file (1) (lnk/persistent)
00066 *   folder      0x31        folder      (usual)
00067 *   valueA      0x32        file        (ANSI file name)
00068 *   valueW      0x34        file        (Unicode file name)
00069 *   workgroup   0x41        network (3)
00070 *   computer    0x42        network (4)
00071 *   net provider    0x46        network
00072 *   whole network   0x47        network (5)
00073 *   MSITStore   0x61        htmlhlp (7)
00074 *   printers/ras connections    0x70        guid
00075 *   history/favorites 0xb1      file
00076 *   share       0xc3        network (6)
00077 *
00078 * guess: the persistent elements are non tracking
00079 *
00080 * (1) dummy byte is used, attributes are empty
00081 * (2) IID_MyComputer = 20D04FE0L-3AEA-1069-A2D8-08002B30309D
00082 * (3) two strings   "workgroup" "Microsoft Network"
00083 * (4) two strings   "\\sirius" "Microsoft Network"
00084 * (5) one string    "Entire Network"
00085 * (6) two strings   "\\sirius\c" "Microsoft Network"
00086 * (7) contains string   "mk:@MSITStore:C:\path\file.chm::/path/filename.htm"
00087 *       GUID    871C5380-42A0-1069-A2EA-08002B30309D
00088 */
00089 
00090 #define PT_CPLAPPLET    0x00
00091 #define PT_GUID     0x1F
00092 #define PT_DRIVE    0x23
00093 #define PT_DRIVE2   0x25
00094 #define PT_DRIVE3   0x29
00095 #define PT_SHELLEXT 0x2E
00096 #define PT_DRIVE1   0x2F
00097 #define PT_FOLDER1  0x30
00098 #define PT_FOLDER   0x31
00099 #define PT_VALUE    0x32
00100 #define PT_VALUEW       0x34
00101 #define PT_WORKGRP  0x41
00102 #define PT_COMP     0x42
00103 #define PT_NETPROVIDER  0x46
00104 #define PT_NETWORK  0x47
00105 #define PT_IESPECIAL1   0x61
00106 #define PT_YAGUID   0x70 /* yet another guid.. */
00107 #define PT_CPEXT    0x71
00108 #define PT_IESPECIAL2   0xb1
00109 #define PT_SHARE    0xc3
00110 
00111 #include "pshpack1.h"
00112 typedef BYTE PIDLTYPE;
00113 
00114 typedef struct tagPIDLCPanelStruct
00115 {
00116     BYTE dummy;         /*01 is 0x00 */
00117     DWORD iconIdx;      /*02 negative icon ID */
00118     WORD offsDispName;      /*06*/
00119     WORD offsComment;       /*08*/
00120     CHAR szName[1];     /*10*/ /* terminated by 0x00, followed by display name and comment string */
00121 } PIDLCPanelStruct;
00122 
00123 typedef struct tagPIDLFontStruct
00124 {
00125     BYTE dummy;
00126     WORD offsFile;
00127     WCHAR szName[1];
00128 } PIDLFontStruct;
00129 
00130 typedef struct tagPIDLPrinterStruct
00131 {
00132     BYTE dummy;
00133     DWORD Attributes;
00134     WORD offsServer;
00135     WCHAR szName[1];
00136 } PIDLPrinterStruct;
00137 
00138 typedef struct tagPIDLRecycleStruct
00139 {
00140     FILETIME LastModification;
00141     FILETIME DeletionTime;
00142     ULARGE_INTEGER FileSize;
00143     ULARGE_INTEGER PhysicalFileSize;
00144     DWORD Attributes;
00145     WCHAR szName[1];
00146 } PIDLRecycleStruct;
00147 
00148 typedef struct tagGUIDStruct
00149 {
00150     BYTE dummy; /* offset 01 is unknown */
00151     GUID guid;  /* offset 02 */
00152 } GUIDStruct;
00153 
00154 typedef struct tagDriveStruct
00155 {
00156     CHAR szDriveName[20];   /*01*/
00157     WORD unknown;       /*21*/
00158 } DriveStruct;
00159 
00160 typedef struct tagFileStruct
00161 {
00162     BYTE dummy;         /*01 is 0x00 for files or dirs */
00163     DWORD dwFileSize;       /*02*/
00164     WORD uFileDate;     /*06*/
00165     WORD uFileTime;     /*08*/
00166     WORD uFileAttribs;      /*10*/
00167     CHAR szNames[1];        /*12*/
00168     /* Here are coming two strings. The first is the long name.
00169     The second the dos name when needed or just 0x00 */
00170 } FileStruct;
00171 
00172 /* At least on WinXP, this struct is appended with 2-byte-alignment to FileStruct. There follows
00173  * a WORD member after the wszName string, which gives the offset from the beginning of the PIDL
00174  * to the FileStructW member. */
00175 typedef struct tagFileStructW {
00176     WORD cbLen;
00177     BYTE dummy1[6];
00178     WORD uCreationDate;
00179     WORD uCreationTime;
00180     WORD uLastAccessDate;
00181     WORD uLastAccessTime;
00182     BYTE dummy2[4];
00183     WCHAR wszName[1];
00184 } FileStructW;
00185 
00186 typedef struct tagValueW
00187 {
00188     WCHAR name[1];
00189 } ValueWStruct;
00190 
00191 typedef struct tagPIDLDATA
00192 {   PIDLTYPE type;          /*00*/
00193     union
00194     {
00195         struct tagGUIDStruct guid;
00196         struct tagDriveStruct drive;
00197         struct tagFileStruct file;
00198         struct
00199         {   WORD dummy;     /*01*/
00200             CHAR szNames[1];    /*03*/
00201         } network;
00202         struct
00203         {   WORD dummy;     /*01*/
00204             DWORD dummy1;   /*02*/
00205             CHAR szName[1]; /*06*/ /* terminated by 0x00 0x00 */
00206         } htmlhelp;
00207         struct tagPIDLCPanelStruct cpanel;
00208         struct tagValueW valueW;
00209         struct tagPIDLFontStruct cfont;
00210         struct tagPIDLPrinterStruct cprinter;
00211         struct tagPIDLRecycleStruct crecycle;
00212     } u;
00213 } PIDLDATA, *LPPIDLDATA;
00214 #include "poppack.h"
00215 
00216 /*
00217  * getting special values from simple pidls
00218  */
00219 DWORD   _ILSimpleGetText    (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
00220 DWORD   _ILSimpleGetTextW   (LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize);
00221 BOOL    _ILGetFileDate      (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
00222 DWORD   _ILGetFileSize      (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
00223 BOOL    _ILGetExtension     (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
00224 void    _ILGetFileType      (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
00225 DWORD   _ILGetFileAttributes    (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize);
00226 
00227 BOOL    _ILGetFileDateTime  (LPCITEMIDLIST pidl, FILETIME *ft);
00228 DWORD   _ILGetDrive     (LPCITEMIDLIST, LPSTR, UINT);
00229 
00230 /*
00231  * testing simple pidls
00232  */
00233 BOOL    _ILIsUnicode        (LPCITEMIDLIST pidl);
00234 BOOL    _ILIsDesktop        (LPCITEMIDLIST pidl);
00235 BOOL    _ILIsMyComputer     (LPCITEMIDLIST pidl);
00236 BOOL    _ILIsPrinter        (LPCITEMIDLIST pidl);
00237 BOOL    _ILIsMyDocuments       (LPCITEMIDLIST pidl);
00238 BOOL    _ILIsControlPanel       (LPCITEMIDLIST pidl);
00239 BOOL    _ILIsBitBucket      (LPCITEMIDLIST pidl);
00240 BOOL    _ILIsAdminTools (LPCITEMIDLIST pidl);
00241 BOOL    _ILIsNetHood      (LPCITEMIDLIST pidl);
00242 BOOL    _ILIsDrive      (LPCITEMIDLIST pidl);
00243 BOOL    _ILIsFolder     (LPCITEMIDLIST pidl);
00244 BOOL    _ILIsValue      (LPCITEMIDLIST pidl);
00245 BOOL    _ILIsSpecialFolder  (LPCITEMIDLIST pidl);
00246 BOOL    _ILIsPidlSimple     (LPCITEMIDLIST pidl);
00247 BOOL    _ILIsCPanelStruct   (LPCITEMIDLIST pidl);
00248 static BOOL __inline _ILIsEqualSimple        (LPCITEMIDLIST pidlA, LPCITEMIDLIST pidlB)
00249 {
00250     return (pidlA->mkid.cb > 0 && !memcmp(pidlA, pidlB, pidlA->mkid.cb)) ||
00251            (!pidlA->mkid.cb && !pidlB->mkid.cb);
00252 }
00253 static
00254 BOOL  __inline _ILIsEmpty              (LPCITEMIDLIST pidl) {
00255     return _ILIsDesktop(pidl);
00256 }
00257 
00258 /*
00259  * simple pidls
00260  */
00261 
00262 /* Creates a PIDL with guid format and type type, which must be one of PT_GUID,
00263  * PT_SHELLEXT, or PT_YAGUID.
00264  */
00265 LPITEMIDLIST    _ILCreateGuid(PIDLTYPE type, REFIID guid);
00266 
00267 /* Like _ILCreateGuid, but using the string szGUID. */
00268 LPITEMIDLIST    _ILCreateGuidFromStrA(LPCSTR szGUID);
00269 LPITEMIDLIST    _ILCreateGuidFromStrW(LPCWSTR szGUID);
00270 
00271 /* Commonly used PIDLs representing file system objects. */
00272 LPITEMIDLIST    _ILCreateDesktop    (void);
00273 LPITEMIDLIST    _ILCreateFromFindDataW(const WIN32_FIND_DATAW *stffile);
00274 HRESULT     _ILCreateFromPathW  (LPCWSTR szPath, LPITEMIDLIST* ppidl);
00275 
00276 /* Other helpers */
00277 LPITEMIDLIST    _ILCreateMyComputer (void);
00278 LPITEMIDLIST    _ILCreateMyDocuments    (void);
00279 LPITEMIDLIST    _ILCreateIExplore   (void);
00280 LPITEMIDLIST    _ILCreateControlPanel   (void);
00281 LPITEMIDLIST    _ILCreatePrinters   (void);
00282 LPITEMIDLIST    _ILCreateNetwork    (void);
00283 LPITEMIDLIST    _ILCreateNetHood    (void);
00284 LPITEMIDLIST    _ILCreateAdminTools (void);
00285 LPITEMIDLIST    _ILCreateFont       (void);
00286 LPITEMIDLIST    _ILCreateBitBucket  (void);
00287 LPITEMIDLIST    _ILCreateDrive      (LPCWSTR);
00288 
00289 /*
00290  * helper functions (getting struct-pointer)
00291  */
00292 LPPIDLDATA  _ILGetDataPointer   (LPCITEMIDLIST);
00293 LPSTR       _ILGetTextPointer   (LPCITEMIDLIST);
00294 IID     *_ILGetGUIDPointer  (LPCITEMIDLIST pidl);
00295 FileStructW     *_ILGetFileStructW      (LPCITEMIDLIST pidl);
00296 
00297 /*
00298  * debug helper
00299  */
00300 void    pdump   (LPCITEMIDLIST pidl);
00301 BOOL    pcheck  (LPCITEMIDLIST pidl);
00302 
00303 /*
00304  * aPidl helper
00305  */
00306 void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl);
00307 LPITEMIDLIST * _ILCopyaPidl(const LPCITEMIDLIST * apidlsrc, UINT cidl);
00308 LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, const CIDA * cida);
00309 
00310 BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type);
00311 
00312 #endif

Generated on Sat May 26 2012 04:25:01 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.