00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FXWINLINKS_H
00023 #define FXWINLINKS_H
00024
00025 #include "FXString.h"
00026
00027 namespace FX {
00028
00033 class QFileInfo;
00034
00094 struct FXAPI FXWinShellLink
00095 {
00096 struct FXAPI Header
00097 {
00098 FXuint length;
00099 char guid[16];
00100 union Flags
00101 {
00102 struct
00103 {
00104 FXuint hasItemIdList : 1;
00105 FXuint pointsToFileOrDir : 1;
00106 FXuint hasDescription : 1;
00107 FXuint hasRelativePath : 1;
00108 FXuint hasWorkingDir : 1;
00109 FXuint hasCmdLineArgs : 1;
00110 FXuint hasCustomIcon : 1;
00111 FXuint useWorkingDir : 1;
00112 FXuint unused : 24;
00113 };
00114 FXuint raw;
00115 } flags;
00116 union FileAttribs
00117 {
00118 struct
00119 {
00120 FXuint isReadOnly : 1;
00121 FXuint isHidden : 1;
00122 FXuint isSystem : 1;
00123 FXuint isVolumeLabel : 1;
00124 FXuint isDir : 1;
00125 FXuint isModified : 1;
00126 FXuint isEncrypted : 1;
00127 FXuint isNormal : 1;
00128 FXuint isTemporary : 1;
00129 FXuint isSparse : 1;
00130 FXuint hasReparsePoint : 1;
00131 FXuint isCompressed : 1;
00132 FXuint isOffline : 1;
00133 FXuint unused : 19;
00134 };
00135 FXuint raw;
00136 } fileattribs;
00137 FXulong creation, modified, lastAccess;
00138 FXuint filelength;
00139 FXuint iconno;
00140 enum ShowWnd
00141 {
00142 HIDE=0,
00143 NORMAL,
00144 SHOWMINIMIZED,
00145 SHOWMAXIMIZED
00146 };
00147 ShowWnd showWnd;
00148 FXuint hotkey;
00149 FXuint unknown1, unknown2;
00150
00151 Header()
00152 {
00153 memset(this, 0, sizeof(*this));
00154 static const char linkguid[]={
00155 0x01, 0x14, 0x02, 0x00,
00156 0x00, 0x00,
00157 0x00, 0x00,
00158 (char) 0xc0, 0x00,
00159 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 };
00160 length=0x4c;
00161 memcpy(guid, linkguid, sizeof(guid));
00162 showWnd=NORMAL;
00163 }
00164
00165 friend FXAPI FXStream &operator<<(FXStream &s, const Header &i);
00166 friend FXAPI FXStream &operator>>(FXStream &s, Header &i);
00167 } header;
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197 struct FXAPI ItemIdListTag
00198 {
00199 FXushort length;
00200 char path1[260];
00201 FXnchar path2[260];
00202 ItemIdListTag()
00203 {
00204 memset(this, 0, sizeof(*this));
00205 }
00206 friend FXAPI FXStream &operator<<(FXStream &s, const ItemIdListTag &i);
00207 friend FXAPI FXStream &operator>>(FXStream &s, ItemIdListTag &i);
00208 char originalPath[260];
00209 } itemIdList;
00210 struct FXAPI FileLocationTag
00211 {
00212 FXuint length;
00213 FXuint firstOffset;
00214 union Flags
00215 {
00216 struct
00217 {
00218 FXuint onLocalVolume : 1;
00219 FXuint onNetworkShare : 1;
00220 FXuint unused : 30;
00221 };
00222 FXuint raw;
00223 } flags;
00224 struct FXAPI LocalVolume
00225 {
00226 FXuint length;
00227 enum Type
00228 {
00229 Unknown=0,
00230 NoRoot,
00231 Removable,
00232 Fixed,
00233 Remote,
00234 CDROM,
00235 RamDrive
00236 };
00237 Type type;
00238 FXuint serialNo;
00239 char volumeLabel[64];
00240 LocalVolume()
00241 {
00242 memset(this, 0, sizeof(*this));
00243 }
00244 friend FXAPI FXStream &operator<<(FXStream &s, const LocalVolume &i);
00245 friend FXAPI FXStream &operator>>(FXStream &s, LocalVolume &i);
00246 } localVolume;
00247 char basePath[260];
00248 struct FXAPI NetworkVolume
00249 {
00250 FXuint length;
00251 FXuint type;
00252 FXchar shareName[260];
00253 NetworkVolume()
00254 {
00255 memset(this, 0, sizeof(*this));
00256 type=0x2;
00257 }
00258 friend FXAPI FXStream &operator<<(FXStream &s, const NetworkVolume &i);
00259 friend FXAPI FXStream &operator>>(FXStream &s, NetworkVolume &i);
00260 } networkVolume;
00261 char remainingPath[64];
00262
00263 FileLocationTag()
00264 {
00265 memset(this, 0, sizeof(*this));
00266 firstOffset=0x1c;
00267 }
00268 friend FXAPI FXStream &operator<<(FXStream &s, const FileLocationTag &i);
00269 friend FXAPI FXStream &operator>>(FXStream &s, FileLocationTag &i);
00270 } fileLocation;
00271 struct FXAPI StringTag
00272 {
00273 FXushort length;
00274 FXnchar string[260];
00275 StringTag() { memset(this, 0, sizeof(*this)); }
00276 friend FXAPI FXStream &operator<<(FXStream &s, const StringTag &i);
00277 friend FXAPI FXStream &operator>>(FXStream &s, StringTag &i);
00278 };
00279 StringTag description;
00280 StringTag relativePath;
00281 StringTag workingDir;
00282 StringTag cmdLineArgs;
00283 StringTag customIcon;
00284 friend FXAPI FXStream &operator>>(FXStream &s, FXWinShellLink &i);
00285
00288 void write(FXStream s, const QFileInfo &whereTo);
00289
00292 static FXString read(const FXString &path, bool doDriveConversion=true);
00295 static void write(const FXString &path, const QFileInfo &whereTo);
00296
00297 };
00298
00299
00325 struct FXAPI FXWinJunctionPoint
00326 {
00327 private:
00328 FXWinJunctionPoint();
00329 ~FXWinJunctionPoint();
00330 public:
00332 static bool test(const FXString &path);
00334 static FXString read(const FXString &path);
00336 static void write(const FXString &path, const QFileInfo &whereTo);
00338 static void remove(const FXString &path);
00339 };
00340
00341 }
00342
00343 #endif