Article ID: 157714 - View products that this article applies to.
This article was previously published under Q157714
This article has been archived. It is offered "as is" and will no longer be updated.
When files are added to Visual SourceSafe, the file names are "mangled" and placed into the database. There is no documentation on how SourceSafe knows to place files in the appropriate data sub-directory.
SourceSafe translates all files and projects into a corresponding "internal" file number. The name of the file, TBAAAAAA for instance, represents the actual file number.
How to Find File NumberSourceSafe uses base-26 math (left to right) to get the file number. The letter maps to a number where A=0 and Z=25. Take the actual file name and break the letters down to a series of multiples using the base of 26. For example, the file number for TBAAAAAA may be found by:
Therefore, the file number of TBAAAAAA is 45. By using a file number rather than a name, SourceSafe gains several advantages:
T = 19 * 26^0 = 19 B = 1 * 26^1 = 26 A = 0 * 26^2 = 0 A = 0 * 26^3 = 0 A = 0 * 26^4 = 0 A = 0 * 26^5 = 0 A = 0 * 26^6 = 0 A = 0 * 26^7 = 0 TOTAL = 45
How SourceSafe Finds Next FileIn the DATA directory, there is a text file called AAAAAAAA.CNT. The contents of this file consist of the last filename that was added in the database. When a new project or file is added, SourceSafe opens this file and adds one (1) to the file number. This new file is then generated in the SourceSafe database. It is possible to put something like ZZZZZAAA in the AAAAAAAAA.CNT file. SourceSafe will add 1 to this file number and write the new file in the database. If a user is unaware of this and continues to use SourceSafe and add files or projects, ANALYZE may not be able to run and the database will not be able to be repaired. Because all read/write users need read/write access to this file, a malicious user can cause some serious database problems that may not be detected until it is too late.
If AAAAAAAA.CNT is Set IncorrectlyIf the file in AAAAAAAA.CNT is incorrect, then SourceSafe will try the next file number until it is able to create the new file. Obviously, SourceSafe will be much slower when creating files or projects but there will be no data loss. If the file is missing for some reason, create a new AAAAAAAA.CNT file and put AAAAAAAA as the only text in the file. SourceSafe will start writing files in the first available open file number.
Article ID: 157714 - Last Review: February 21, 2014 - Revision: 2.1
Contact us for more help