00001 /* Declaration of PIDL for remote system directory listing and manager class 00002 00003 Copyright (C) 2007 Alexander Lamaison <awl03@doc.ic.ac.uk> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License along 00016 with this program; if not, write to the Free Software Foundation, Inc., 00017 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 00020 #ifndef REMOTEPIDLMANAGER_H 00021 #define REMOTEPIDLMANAGER_H 00022 00023 #if _MSC_VER > 1000 00024 #pragma once 00025 #endif // _MSC_VER > 1000 00026 00027 #include <string.h> 00028 #include "remotelimits.h" 00029 #include "PidlManager.h" 00030 00031 // PIDL for storing connection data object details 00032 static const DWORD REMOTEPIDL_FINGERPRINT = 0x533aaf69; 00033 #pragma pack(1) 00034 struct REMOTEPIDL 00035 { 00036 USHORT cb; 00037 DWORD dwFingerprint; 00038 BOOL fIsFolder; 00039 WCHAR wszPath[MAX_PATH_LENZ]; 00040 WCHAR wszOwner[MAX_USERNAME_LENZ]; 00041 WCHAR wszGroup[MAX_USERNAME_LENZ]; 00042 DWORD dwPermissions; 00043 WORD wPadding; 00044 ULONGLONG uSize; 00045 time_t dtModified; 00046 }; 00047 #pragma pack() 00048 typedef UNALIGNED REMOTEPIDL *PREMOTEPIDL; 00049 typedef const UNALIGNED REMOTEPIDL *PCREMOTEPIDL; 00050 00051 class CRemotePidlManager : public CPidlManager 00052 { 00053 public: 00054 HRESULT Create( LPCWSTR pwszPath, LPCWSTR pwszOwner, LPCWSTR pwszGroup, 00055 DWORD dwPermissions, ULONGLONG uSize, time_t dtModified, 00056 BOOL fIsFolder, PITEMID_CHILD *ppidlOut ); 00057 00058 PREMOTEPIDL Validate( PCIDLIST_RELATIVE ); 00059 HRESULT IsValid( PCIDLIST_RELATIVE ); 00060 00061 // All accessors take a LPCITEMIDLIST as they may be multilevel 00062 // where only the last SHITEMID is of specific type 00063 CString GetPath( LPCITEMIDLIST pidl ); 00064 CString GetOwner( LPCITEMIDLIST pidl ); 00065 CString GetGroup( LPCITEMIDLIST pidl ); 00066 DWORD GetPermissions( LPCITEMIDLIST pidl ); 00067 CString GetPermissionsStr( LPCITEMIDLIST pidl ); 00068 ULONGLONG GetFileSize( LPCITEMIDLIST pidl ); 00069 CTime GetLastModified( LPCITEMIDLIST pidl ); 00070 BOOL IsFolder( LPCITEMIDLIST pidl ); 00071 private: 00072 PREMOTEPIDL GetDataSegment( LPCITEMIDLIST pidl ); 00073 }; 00074 00075 #endif // REMOTEPIDLMANAGER_H