00001 /* Declaration of the host folder PIDL type and specific PIDL 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 HOSTPIDLMANAGER_H 00021 #define HOSTPIDLMANAGER_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 HOSTPIDL_FINGERPRINT = 0x496c1066; 00033 #pragma pack(1) 00034 struct HOSTPIDL 00035 { 00036 USHORT cb; 00037 DWORD dwFingerprint; 00038 WCHAR wszLabel[MAX_LABEL_LENZ]; 00039 WCHAR wszUser[MAX_USERNAME_LENZ]; 00040 WCHAR wszHost[MAX_HOSTNAME_LENZ]; 00041 WCHAR wszPath[MAX_PATH_LENZ]; 00042 USHORT uPort; 00043 }; 00044 #pragma pack() 00045 typedef UNALIGNED HOSTPIDL *PHOSTPIDL; 00046 typedef const UNALIGNED HOSTPIDL *PCHOSTPIDL; 00047 00048 class CHostPidlManager : public CPidlManager 00049 { 00050 public: 00051 HRESULT Create( LPCWSTR pwszLabel, LPCWSTR pwszUser, LPCWSTR pwszHost, 00052 LPCWSTR pwszPath, USHORT uPort, PITEMID_CHILD *ppidlOut ); 00053 00054 PHOSTPIDL Validate( LPCITEMIDLIST ); 00055 HRESULT IsValid( LPCITEMIDLIST ); 00056 00057 // All accessors take a LPCITEMIDLIST as they may be multilevel 00058 // where only the last SHITEMID is of specific type 00059 CString GetLabel( LPCITEMIDLIST pidl ); 00060 CString GetUser( LPCITEMIDLIST pidl ); 00061 CString GetHost( LPCITEMIDLIST pidl ); 00062 CString GetPath( LPCITEMIDLIST pidl ); 00063 USHORT GetPort( LPCITEMIDLIST pidl ); 00064 CString GetPortStr( LPCITEMIDLIST pidl ); 00065 00066 private: 00067 PHOSTPIDL GetDataSegment( LPCITEMIDLIST pidl ); 00068 }; 00069 00070 #endif // HOSTPIDLMANAGER_H