* Path for renames during restore and renames during share (thanks to Bryan Aldrich...
[vss2svn.git] / ssphys / SSPhysLib / SSTypes.h
blob7d5699827e8a290e6af5954a65b3d41a00367909
1 // SSTypes.h:structure definitions for SourceSafe files
2 //
3 //////////////////////////////////////////////////////////////////////
5 #if !defined(AFX_SSTYPES_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_)
6 #define AFX_SSTYPES_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_
8 #if _MSC_VER > 1000
9 #pragma once
10 #endif // _MSC_VER > 1000
12 #include "time.h"
14 typedef unsigned char byte;
15 typedef unsigned long ulong;
16 typedef unsigned short ushort;
18 #if !defined(_MSC_VER)
19 // for non-Windows compilation, choose a 32-bit unsigned type here
20 #include <sys/types.h>
21 typedef u_int32_t __time32_t;
22 #endif
24 //---------------------------------------------------------------------------
25 // OLE API documentation
26 // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvss/html/vssauto.asp
27 //---------------------------------------------------------------------------
29 struct RECORD_HEADER {
30 ulong size;
31 char type[2];
32 short checksum;
35 struct SSNAME {
36 short flags; // 00 = item, 01 == project
37 char name[34]; // short name
38 ulong nsmap; // offset into the names.dat
42 // TODO: in the OLE API: VSSITEM_PROJECT = 0; VSSITEM_FILE = 1
43 #define SSITEM_PROJECT 1
44 #define SSITEM_FILE 2
46 enum eFileType
48 eFileTypeBinary,
49 eFileTypeText
53 struct DH {
54 short type; // 1 Project, 2 File
56 short numberOfActions;
58 // This is the last name that was given to the item
59 SSNAME name;
60 char dummy[2];
61 char latestExt[2]; // .A or .B
63 // offsets for records
64 ulong historyOffsetBegin; // first EL Header
65 ulong historyOffsetLast; // last EL oder FD HEader
66 ulong historyOffsetEnd; // size of the file
69 struct DH_FILE : public DH {
70 char dummy4[20];
72 // 0x00 == initial
73 // 0x01 == locked
74 // 0x02 == binary
75 // 0x04 == store only latest revision
76 // 0x20 == shared
77 // 0x40 == checked out
78 short flag;
79 char shareSrcSpec[10];
81 ulong offsetBFRecord; // offset to the last BR record in the file
82 ulong offsetPFRecord; // offset to the last PF record in the file
83 short numberOfBranches; // number of the BF records
84 short numberOfReferences; // Reference count for the item
86 ulong offsetCFRecord1; // file checked out, ptr to CF record
87 ulong offsetCFRecord2; // file not checked out, ptr to CF record
88 int unknown; // changes after checkin
90 char dummy5[8];
92 // diese scheinen immer Paare zu bilden, nach einem Checkin ändert sich
93 // der d11, d21
94 // d12 == d22 == d32
95 short d11;
96 short d12;
97 short d21;
98 short d22;
99 short d31;
100 short d32;
102 char dummy6[4];
104 // dito wie dxx, jedoch zum ersten mal nach einem Checkin
105 short e11;
106 short e12;
107 short e21;
108 short e22;
109 short e31;
110 short e32;
112 char dummy7[200];
114 short numberOfItems; // including projects
115 short numberOfProjects; // number of subprojects
118 struct DH_PROJECT : public DH {
119 char dummy4[20];
121 char parentSpec[258]; // of last checkout
122 short dummy7;
124 char parentPhys[10];
125 char dummy8[2];
127 short numberOfItems; // including projects
128 short numberOfProjects;
131 enum eAction {
132 Labeled = 0,
133 Created_Project = 1,
134 Added_Project = 2,
135 Added_File = 3,
136 Destroyed_Project = 4,
137 Destroyed_File = 5,
138 Deleted_Project = 6,
139 Deleted_File = 7,
140 Recovered_Project = 8,
141 Recovered_File = 9,
142 Renamed_Project = 10,
143 Renamed_File = 11,
144 Moved_Project_From = 12,
145 Moved_Project_To = 13,
146 Shared_File = 14, // Share, Pin, Unpin
147 Branch_File = 15, // reported as Rollback im Parent Project
148 Created_File = 16,
149 Checked_in = 17,
150 // missing action 18
151 RollBack = 19,
152 ArchiveVersion_File = 20,
153 // missing action 21, probably RestoreVersion_File
154 Archive_File = 22,
155 Archive_Project = 23,
156 Restore_File = 24,
157 Restore_Project = 25,
159 /// --- pseudo actions ---
160 Pinned_File = 26,
161 Unpinned_File = 27
166 struct VERSION_RECORD {
167 ulong previous; // previous VERSION_RECORD
168 ushort actionID; // eAction action;
169 short versionNumber;
170 __time32_t date;
171 char username[32];
173 char label[32];
175 // This seems to be always be a pointer to the next record
176 // If (lengthComment != 0) this next record is the comment record
177 ulong offsetToNextRecordOrComment;
179 // This offset seems to be NULL in most cases
180 // In case of a LabelAction this is the offset to the so called LabelComment Record
181 // In addition the lengthLabelComment is > 0
182 ulong offsetToLabelComment;
184 // Length of the comment strings
185 short lengthComment;
186 short lengthLabelComment;
189 struct ITEM_ACTION {
190 SSNAME name;
191 char physical[10];
194 //struct CREATED_PROJECT_ACTION {
195 // SSNAME name;
196 // char physical[10];
197 //} ;
199 //struct ADDED_PROJECT_ACTION {
200 // SSNAME name;
201 // char physical[10];
202 //} ;
204 //struct ADDED_FILE_ACTION {
205 // SSNAME name;
206 // char physical[10];
207 //} ;
209 struct DESTROYED_ACTION {
210 SSNAME name;
211 short padding;
212 char physical[10];
215 //struct DESTROYED_PROJECT_ACTION {
216 // SSNAME name;
217 // short padding;
218 // char physical[10];
219 //} ;
221 //struct DESTROYED_FILE_ACTION {
222 // SSNAME name;
223 // short padding;
224 // char physical[10];
225 //} ;
227 //struct DELETED_PROJECT_ACTION {
228 // SSNAME name;
229 // char physical[10];
230 //} ;
232 //struct DELETED_FILE_ACTION {
233 // SSNAME name;
234 // char physical[10];
235 //} ;
237 //struct RECOVERED_PROJECT_ACTION {
238 // SSNAME name;
239 // char physical[10];
240 //} ;
242 //struct RECOVERED_FILE_ACTION {
243 // SSNAME name;
244 // char physical[10];
245 //} ;
247 struct RENAMED_ACTION {
248 SSNAME newName;
249 SSNAME name; // old name
250 char physical[10];
253 struct SHARED_FILE_ACTION {
254 char srcPathSpec[260];
255 SSNAME name;
256 short subActionAndVersion; // -1: shared, 0: pinned; >0 unpinned, number denotes the Version which was unpinned
257 short pinnedToVersion; // >0: pinned to version, ==0 unpinned
258 short padding2; // reference ins project file? Nr des shares?
259 char physical[10];
262 struct MOVED_PROJECT_ACTION {
263 char pathSpec[260];
264 SSNAME name;
265 char physical[10];
268 //struct CREATED_FILE_ACTION {
269 // SSNAME name;
270 // char physical[10];
271 //} ;
273 struct CHECKED_IN_ACTION {
274 ulong offsetFileDelta;
275 long padding;
276 char checkInSpec[260];
279 struct ROLLBACK_ACTION {
280 SSNAME name;
281 char physical[10];
282 char parent[10];
285 struct ARCHIVE_VERSIONS_ACTION {
286 SSNAME name;
287 char physical[10];
288 char unknown2[14];
289 short archiveVersion;
290 char targetFile[252];
293 struct BRANCH_FILE_ACTION {
294 SSNAME name;
295 char physical[10];
296 char parent[10];
299 typedef struct {
300 SSNAME name;
301 char physical[10];
302 short dummy;
303 char filename[264];
304 } ARCHIVE_ACTION;
306 typedef struct {
307 SSNAME name;
308 char physical[10];
309 short dummy;
310 char filename[264];
311 } RESTORE_ACTION;
313 struct CF {
314 char user[32];
315 char padding[4];
316 // zusammen 260?
317 char checkOutFolder[256];
318 char padding2[4];
319 char computer[32];
320 // zusammen 260
321 // char parentSpec[80];
322 // char fileSpec2[60];
323 // char padding3[120];
324 char parentSpec[260];
326 char comment[13];
327 char padding4[51];
329 // initial alles 0
330 // Check Out: flag1=01, flag2=40, flag3=00
331 // Check In : flag1=00, flag2=00, flag3=10
332 char flag1;
333 char padding5;
334 char flag2;
335 char padding6[8];
336 char flag3;
337 int numberOfVersions;
340 struct FD {
341 short command; // 01 copy, 00 replace, 02
342 short dummy;
343 ulong start;
344 ulong end;
347 struct PF {
348 ulong previousOffset;
349 char parentPhys[10];
350 short padding;
353 struct BF {
354 ulong previousOffset;
355 char branchToPhys[10];
356 short padding;
359 //---------------------------------------------------------------------------
360 struct PROJECT_ENTRY{
361 short type;
362 // 0x01 deleted
363 // 0x02 store binary diffs
364 // 0x04 store only latest revision
365 // 0x08 shared
366 // 0x100 ??, or only one byte??
367 // 0x200 ??
368 short flags;
369 SSNAME name;
370 short pinnedToVersion;
371 char phys[10];
374 //---------------------------------------------------------------------------
375 struct HN {
376 ulong size;
377 char type[2];
378 short checksum;
379 char unknown1[16];
380 ulong fileLen;
381 char unknown2[60];
384 struct NSENTRY{
385 // 1: 8.3 Name
386 // 2: voller name
387 // 3: 28.3 Name //?
388 // 10: Projekte
389 short id;
390 short offset;
393 struct NSMAP{
394 short num;
395 short unknown;
400 //---------------------------------------------------------------------------
401 class CAction
403 public:
404 static const char* ActionToString (eAction e);
409 #endif // !defined(AFX_SSTYPES_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_)