From 88cfaa9167440d3d196b1d41415b0de11bc339c0 Mon Sep 17 00:00:00 2001 From: toby Date: Wed, 5 Oct 2005 15:27:38 +0000 Subject: [PATCH] Add Dirk Luetjen's ssphys libraries and command-line tool git-svn-id: http://vss2svn.googlecode.com/svn/trunk@60 2cfd5912-9055-84bd-9a12-e3c18a4b6e42 --- ssphys/ReadMe.txt | 101 + ssphys/SSAPI/Resource.h | 23 + ssphys/SSAPI/SSAPI.cpp | 95 + ssphys/SSAPI/SSAPI.def | 9 + ssphys/SSAPI/SSAPI.dsp | 376 +++ ssphys/SSAPI/SSAPI.h | 5023 +++++++++++++++++++++++++++++ ssphys/SSAPI/SSAPI.idl | 650 ++++ ssphys/SSAPI/SSAPI.rc | 130 + ssphys/SSAPI/SSAPIps.def | 11 + ssphys/SSAPI/SSAPIps.mk | 16 + ssphys/SSAPI/StdAfx.cpp | 12 + ssphys/SSAPI/StdAfx.h | 32 + ssphys/SSAPI/VSSApp.cpp | 15 + ssphys/SSAPI/VSSApp.h | 35 + ssphys/SSAPI/VSSApp.rgs | 26 + ssphys/SSAPI/VSSDatabase.cpp | 135 + ssphys/SSAPI/VSSDatabase.h | 54 + ssphys/SSAPI/VSSDatabase.rgs | 25 + ssphys/SSAPI/VSSItem.cpp | 234 ++ ssphys/SSAPI/VSSItem.h | 79 + ssphys/SSAPI/VSSItem.rgs | 26 + ssphys/SSAPI/VSSItems.cpp | 48 + ssphys/SSAPI/VSSItems.h | 46 + ssphys/SSAPI/VSSItems.rgs | 26 + ssphys/SSAPI/VSSVersions.cpp | 23 + ssphys/SSAPI/VSSVersions.h | 61 + ssphys/SSAPI/VSSVersions.rgs | 26 + ssphys/SSAPI/dlldata.c | 38 + ssphys/SSAPI/ssauterr.h | 136 + ssphys/SSLib.net/vss.xsd | 81 + ssphys/SSLib/IniFile.cpp | 529 +++ ssphys/SSLib/IniFile.h | 119 + ssphys/SSLib/Readme.txt | 24 + ssphys/SSLib/SSDatabase.cpp | 341 ++ ssphys/SSLib/SSDatabase.h | 59 + ssphys/SSLib/SSItem.cpp | 451 +++ ssphys/SSLib/SSItem.h | 182 ++ ssphys/SSLib/SSLib.dsp | 141 + ssphys/SSLib/SSVersion.cpp | 66 + ssphys/SSLib/SSVersion.h | 67 + ssphys/SSLib/StdAfx.cpp | 6 + ssphys/SSLib/StdAfx.h | 29 + ssphys/SSLib/tokenarray.h | 175 + ssphys/SSPhys/Arguments.cpp | 11 + ssphys/SSPhys/Arguments.h | 16 + ssphys/SSPhys/Command.cpp | 28 + ssphys/SSPhys/Command.h | 43 + ssphys/SSPhys/CommandFactory.cpp | 69 + ssphys/SSPhys/CommandFactory.h | 28 + ssphys/SSPhys/CommandLine.cpp | 117 + ssphys/SSPhys/CommandLine.h | 44 + ssphys/SSPhys/FileTypeCommand.cpp | 48 + ssphys/SSPhys/FileTypeCommand.h | 28 + ssphys/SSPhys/Formatter.cpp | 324 ++ ssphys/SSPhys/Formatter.h | 65 + ssphys/SSPhys/GetCommand.cpp | 617 ++++ ssphys/SSPhys/GetCommand.h | 33 + ssphys/SSPhys/GlobalOptions.cpp | 122 + ssphys/SSPhys/GlobalOptions.h | 48 + ssphys/SSPhys/HelpCommand.cpp | 40 + ssphys/SSPhys/HelpCommand.h | 35 + ssphys/SSPhys/HistoryCommand.cpp | 86 + ssphys/SSPhys/HistoryCommand.h | 33 + ssphys/SSPhys/InfoCommand.cpp | 98 + ssphys/SSPhys/InfoCommand.h | 33 + ssphys/SSPhys/Options.cpp | 92 + ssphys/SSPhys/Options.h | 114 + ssphys/SSPhys/PropertiesCommand.cpp | 71 + ssphys/SSPhys/PropertiesCommand.h | 32 + ssphys/SSPhys/SSTests.cpp | 212 ++ ssphys/SSPhys/SSTests.h | 23 + ssphys/SSPhys/StdAfx.cpp | 8 + ssphys/SSPhys/StdAfx.h | 54 + ssphys/SSPhys/ValidateCommand.cpp | 53 + ssphys/SSPhys/ValidateCommand.h | 30 + ssphys/SSPhys/VersionFilter.cpp | 11 + ssphys/SSPhys/VersionFilter.h | 54 + ssphys/SSPhys/ssphys.cpp | 174 + ssphys/SSPhys/ssphys.dsp | 237 ++ ssphys/SSPhysLib/FileName.cpp | 61 + ssphys/SSPhysLib/FileName.h | 257 ++ ssphys/SSPhysLib/Readme.txt | 24 + ssphys/SSPhysLib/SSBranchFileObject.cpp | 42 + ssphys/SSPhysLib/SSBranchFileObject.h | 34 + ssphys/SSPhysLib/SSCheckOutObject.cpp | 40 + ssphys/SSPhysLib/SSCheckOutObject.h | 40 + ssphys/SSPhysLib/SSCommentObject.cpp | 37 + ssphys/SSPhysLib/SSCommentObject.h | 31 + ssphys/SSPhysLib/SSException.cpp | 11 + ssphys/SSPhysLib/SSException.h | 70 + ssphys/SSPhysLib/SSFiles.cpp | 764 +++++ ssphys/SSPhysLib/SSFiles.h | 251 ++ ssphys/SSPhysLib/SSItemInfoObject.cpp | 343 ++ ssphys/SSPhysLib/SSItemInfoObject.h | 137 + ssphys/SSPhysLib/SSName.cpp | 76 + ssphys/SSPhysLib/SSName.h | 38 + ssphys/SSPhysLib/SSNameObject.cpp | 77 + ssphys/SSPhysLib/SSNameObject.h | 76 + ssphys/SSPhysLib/SSObject.cpp | 139 + ssphys/SSPhysLib/SSObject.h | 92 + ssphys/SSPhysLib/SSParentFolderObject.cpp | 52 + ssphys/SSPhysLib/SSParentFolderObject.h | 33 + ssphys/SSPhysLib/SSPhysLib.dsp | 241 ++ ssphys/SSPhysLib/SSProjectObject.cpp | 165 + ssphys/SSPhysLib/SSProjectObject.h | 50 + ssphys/SSPhysLib/SSRecord.cpp | 140 + ssphys/SSPhysLib/SSRecord.h | 70 + ssphys/SSPhysLib/SSTypes.cpp | 39 + ssphys/SSPhysLib/SSTypes.h | 476 +++ ssphys/SSPhysLib/SSVersionObject.cpp | 521 +++ ssphys/SSPhysLib/SSVersionObject.h | 409 +++ ssphys/SSPhysLib/StdAfx.cpp | 6 + ssphys/SSPhysLib/StdAfx.h | 53 + ssphys/SSPhysLib/XML.h | 121 + ssphys/SSPhysLib/crc.cpp | 114 + ssphys/SSPhysLib/crc.h | 15 + ssphys/SSRep/Formatter.cpp | 276 ++ ssphys/SSRep/Formatter.h | 39 + ssphys/SSRep/Options.cpp | 238 ++ ssphys/SSRep/Options.h | 80 + ssphys/SSRep/StdAfx.cpp | 40 + ssphys/SSRep/StdAfx.h | 53 + ssphys/SSRep/VersionFilter.cpp | 11 + ssphys/SSRep/VersionFilter.h | 54 + ssphys/SSRep/ssrep.cpp | 287 ++ ssphys/SSRep/ssrep.dsp | 135 + ssphys/TODO | 23 + ssphys/ssphys.dsw | 92 + ssphys/test/lib/Vss2Svn.pm | 34 + ssphys/test/lib/Vss2Svn/VSS.pm | 880 +++++ ssphys/test/lib/VssCmd.pm | 429 +++ ssphys/test/lib/VssOle.pm | 556 ++++ ssphys/test/lib/VssPath.pm | 256 ++ ssphys/test/t/ssrep_1.t | 227 ++ ssphys/test/test.BAT | 5 + ssphys/test/test.pl | 10 + ssphys/test/test.sh | 1 + ssphys/utils/LeakWatcher.h | 26 + 138 files changed, 21809 insertions(+) create mode 100644 ssphys/ReadMe.txt create mode 100644 ssphys/SSAPI/Resource.h create mode 100644 ssphys/SSAPI/SSAPI.cpp create mode 100644 ssphys/SSAPI/SSAPI.def create mode 100644 ssphys/SSAPI/SSAPI.dsp create mode 100644 ssphys/SSAPI/SSAPI.h create mode 100644 ssphys/SSAPI/SSAPI.idl create mode 100644 ssphys/SSAPI/SSAPI.rc create mode 100644 ssphys/SSAPI/SSAPIps.def create mode 100644 ssphys/SSAPI/SSAPIps.mk create mode 100644 ssphys/SSAPI/StdAfx.cpp create mode 100644 ssphys/SSAPI/StdAfx.h create mode 100644 ssphys/SSAPI/VSSApp.cpp create mode 100644 ssphys/SSAPI/VSSApp.h create mode 100644 ssphys/SSAPI/VSSApp.rgs create mode 100644 ssphys/SSAPI/VSSDatabase.cpp create mode 100644 ssphys/SSAPI/VSSDatabase.h create mode 100644 ssphys/SSAPI/VSSDatabase.rgs create mode 100644 ssphys/SSAPI/VSSItem.cpp create mode 100644 ssphys/SSAPI/VSSItem.h create mode 100644 ssphys/SSAPI/VSSItem.rgs create mode 100644 ssphys/SSAPI/VSSItems.cpp create mode 100644 ssphys/SSAPI/VSSItems.h create mode 100644 ssphys/SSAPI/VSSItems.rgs create mode 100644 ssphys/SSAPI/VSSVersions.cpp create mode 100644 ssphys/SSAPI/VSSVersions.h create mode 100644 ssphys/SSAPI/VSSVersions.rgs create mode 100644 ssphys/SSAPI/dlldata.c create mode 100644 ssphys/SSAPI/ssauterr.h create mode 100644 ssphys/SSLib.net/vss.xsd create mode 100644 ssphys/SSLib/IniFile.cpp create mode 100644 ssphys/SSLib/IniFile.h create mode 100644 ssphys/SSLib/Readme.txt create mode 100644 ssphys/SSLib/SSDatabase.cpp create mode 100644 ssphys/SSLib/SSDatabase.h create mode 100644 ssphys/SSLib/SSItem.cpp create mode 100644 ssphys/SSLib/SSItem.h create mode 100644 ssphys/SSLib/SSLib.dsp create mode 100644 ssphys/SSLib/SSVersion.cpp create mode 100644 ssphys/SSLib/SSVersion.h create mode 100644 ssphys/SSLib/StdAfx.cpp create mode 100644 ssphys/SSLib/StdAfx.h create mode 100644 ssphys/SSLib/tokenarray.h create mode 100644 ssphys/SSPhys/Arguments.cpp create mode 100644 ssphys/SSPhys/Arguments.h create mode 100644 ssphys/SSPhys/Command.cpp create mode 100644 ssphys/SSPhys/Command.h create mode 100644 ssphys/SSPhys/CommandFactory.cpp create mode 100644 ssphys/SSPhys/CommandFactory.h create mode 100644 ssphys/SSPhys/CommandLine.cpp create mode 100644 ssphys/SSPhys/CommandLine.h create mode 100644 ssphys/SSPhys/FileTypeCommand.cpp create mode 100644 ssphys/SSPhys/FileTypeCommand.h create mode 100644 ssphys/SSPhys/Formatter.cpp create mode 100644 ssphys/SSPhys/Formatter.h create mode 100644 ssphys/SSPhys/GetCommand.cpp create mode 100644 ssphys/SSPhys/GetCommand.h create mode 100644 ssphys/SSPhys/GlobalOptions.cpp create mode 100644 ssphys/SSPhys/GlobalOptions.h create mode 100644 ssphys/SSPhys/HelpCommand.cpp create mode 100644 ssphys/SSPhys/HelpCommand.h create mode 100644 ssphys/SSPhys/HistoryCommand.cpp create mode 100644 ssphys/SSPhys/HistoryCommand.h create mode 100644 ssphys/SSPhys/InfoCommand.cpp create mode 100644 ssphys/SSPhys/InfoCommand.h create mode 100644 ssphys/SSPhys/Options.cpp create mode 100644 ssphys/SSPhys/Options.h create mode 100644 ssphys/SSPhys/PropertiesCommand.cpp create mode 100644 ssphys/SSPhys/PropertiesCommand.h create mode 100644 ssphys/SSPhys/SSTests.cpp create mode 100644 ssphys/SSPhys/SSTests.h create mode 100644 ssphys/SSPhys/StdAfx.cpp create mode 100644 ssphys/SSPhys/StdAfx.h create mode 100644 ssphys/SSPhys/ValidateCommand.cpp create mode 100644 ssphys/SSPhys/ValidateCommand.h create mode 100644 ssphys/SSPhys/VersionFilter.cpp create mode 100644 ssphys/SSPhys/VersionFilter.h create mode 100644 ssphys/SSPhys/ssphys.cpp create mode 100644 ssphys/SSPhys/ssphys.dsp create mode 100644 ssphys/SSPhysLib/FileName.cpp create mode 100644 ssphys/SSPhysLib/FileName.h create mode 100644 ssphys/SSPhysLib/Readme.txt create mode 100644 ssphys/SSPhysLib/SSBranchFileObject.cpp create mode 100644 ssphys/SSPhysLib/SSBranchFileObject.h create mode 100644 ssphys/SSPhysLib/SSCheckOutObject.cpp create mode 100644 ssphys/SSPhysLib/SSCheckOutObject.h create mode 100644 ssphys/SSPhysLib/SSCommentObject.cpp create mode 100644 ssphys/SSPhysLib/SSCommentObject.h create mode 100644 ssphys/SSPhysLib/SSException.cpp create mode 100644 ssphys/SSPhysLib/SSException.h create mode 100644 ssphys/SSPhysLib/SSFiles.cpp create mode 100644 ssphys/SSPhysLib/SSFiles.h create mode 100644 ssphys/SSPhysLib/SSItemInfoObject.cpp create mode 100644 ssphys/SSPhysLib/SSItemInfoObject.h create mode 100644 ssphys/SSPhysLib/SSName.cpp create mode 100644 ssphys/SSPhysLib/SSName.h create mode 100644 ssphys/SSPhysLib/SSNameObject.cpp create mode 100644 ssphys/SSPhysLib/SSNameObject.h create mode 100644 ssphys/SSPhysLib/SSObject.cpp create mode 100644 ssphys/SSPhysLib/SSObject.h create mode 100644 ssphys/SSPhysLib/SSParentFolderObject.cpp create mode 100644 ssphys/SSPhysLib/SSParentFolderObject.h create mode 100644 ssphys/SSPhysLib/SSPhysLib.dsp create mode 100644 ssphys/SSPhysLib/SSProjectObject.cpp create mode 100644 ssphys/SSPhysLib/SSProjectObject.h create mode 100644 ssphys/SSPhysLib/SSRecord.cpp create mode 100644 ssphys/SSPhysLib/SSRecord.h create mode 100644 ssphys/SSPhysLib/SSTypes.cpp create mode 100644 ssphys/SSPhysLib/SSTypes.h create mode 100644 ssphys/SSPhysLib/SSVersionObject.cpp create mode 100644 ssphys/SSPhysLib/SSVersionObject.h create mode 100644 ssphys/SSPhysLib/StdAfx.cpp create mode 100644 ssphys/SSPhysLib/StdAfx.h create mode 100644 ssphys/SSPhysLib/XML.h create mode 100644 ssphys/SSPhysLib/crc.cpp create mode 100644 ssphys/SSPhysLib/crc.h create mode 100644 ssphys/SSRep/Formatter.cpp create mode 100644 ssphys/SSRep/Formatter.h create mode 100644 ssphys/SSRep/Options.cpp create mode 100644 ssphys/SSRep/Options.h create mode 100644 ssphys/SSRep/StdAfx.cpp create mode 100644 ssphys/SSRep/StdAfx.h create mode 100644 ssphys/SSRep/VersionFilter.cpp create mode 100644 ssphys/SSRep/VersionFilter.h create mode 100644 ssphys/SSRep/ssrep.cpp create mode 100644 ssphys/SSRep/ssrep.dsp create mode 100644 ssphys/TODO create mode 100644 ssphys/ssphys.dsw create mode 100644 ssphys/test/lib/Vss2Svn.pm create mode 100644 ssphys/test/lib/Vss2Svn/VSS.pm create mode 100644 ssphys/test/lib/VssCmd.pm create mode 100644 ssphys/test/lib/VssOle.pm create mode 100644 ssphys/test/lib/VssPath.pm create mode 100644 ssphys/test/t/ssrep_1.t create mode 100644 ssphys/test/test.BAT create mode 100644 ssphys/test/test.pl create mode 100644 ssphys/test/test.sh create mode 100644 ssphys/utils/LeakWatcher.h diff --git a/ssphys/ReadMe.txt b/ssphys/ReadMe.txt new file mode 100644 index 0000000..0de3c7a --- /dev/null +++ b/ssphys/ReadMe.txt @@ -0,0 +1,101 @@ +======================================================================== + CONSOLE APPLICATION : ssphys +======================================================================== + + +ssphys is a replacment application for ss.exe, a Visual Source Safe reporting +utility. ssphys reads and interpretes the physical files of an Source Safe +archive. + + +///////////////////////////////////////////////////////////////////////////// +Notes: + +Source Safe stores its information in several file: + +1.) physical data files: + these are all those file, that can be found in "data\[a..z]\[aaaaaaaa...zzzzzzzz]" +2.) project information files: + special files in data\[a..z] that tell VSS which files make up a project +3.) names.dat +4.) um.dat + User Management +5.) CRC.dat +6.) Rights.dat +7.) srcsafe.ini + + +Most these files are made from special records that contain a header with +length, type and crc information. The type is a two character code like "EL", +"MC" or "FD". + +There are two types of these record based files. One with a 52 byte big file +header (SSHeaderFile), and others that only contain these special records +(SSPlainFile), and others that are simply binary files, without special records. + +The basic building of ssphys is based on these records (SSRecords). The records +are read without any interpretation from a SSFile and can be wrapped by higher +level special objects, depending on the type. The SSObject::MakeObject factory +function builds a special SSObject derived object depending on the type. + +With this it is possible to build a basic history reporting. + +The binary layout for all special records can be found in the SSTypes.h header. + +///////////////////////////////////////////////////////////////////////////// + +Reverse Delta: +VSS stores all checkins as reverse deltas in "FD" records. Reverse delta means, +that the last version of the file is kept and delta to the previous version is +stored. The last version is stored in a file named from the physical item plus +an extension ".A" or ".B". These two extensions are used alternately. + +Rebuilding an older item is possible by retrieving the last version, and reverse +apply all deltas up to the required version. + +The delta format is a very easy stream with only three commands with the following +layout +{ data} { data} ... + +command: +0 = take bytes from the stream and append them to the output file +1 = take bytes from the last file, starting at offset and append + them to the output file +2 = + +///////////////////////////////////////////////////////////////////////////// + +VSS Special notes: + +-- Shares +SS support shares, but only for files. Shares are implemented in the way, that the +reference count for the item is increased and the same physical entry is refrenced +in another project. Additionally a shared flag is set. For each share a special "PF" +record is appended tothe data file. There is no version information attached to +these "PF" records. So the item can't tell when a share was made (only implicitly by +the linear order of the history activity). + +Shares are only supported for files. If you recursivly share a project a new subproject +is created in the share target project and all subitems are really shared into this +new project. This means e.g. that the shared project does not have the same history. + +In each project record the ("last") specification of the parent record is stored and +the physical item for the parent. The fact, that shares are not supported for projects +allows us to exactly specify the parent path specification. + +-- Renames +Renaming an item in VSS mainly done in tne parent project. There is a name variable +in the item physical file that always carries the last name, but all historic activities +are recorded in the parent. + +Sadly, the project structure is not recorded with FD records. As with files, the last +state is stored in a special file, but no reverse deltas exits. To get the correct +names for older items, one have to reverse apply all actions beginning from the last +state. + + +Renaming a project item will have additional effects. Since all sub projects will +exactly record the parent specification, all parent specifications within the subprojects +of the renamed parent have to be renamed also. Therefor the items will only know the last +valid full parent specification (and the physical name), but no historic information. + diff --git a/ssphys/SSAPI/Resource.h b/ssphys/SSAPI/Resource.h new file mode 100644 index 0000000..90435a5 --- /dev/null +++ b/ssphys/SSAPI/Resource.h @@ -0,0 +1,23 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by SSAPI.rc +// +#define IDS_PROJNAME 100 +#define IDS_VSSAPP_DESC 103 +#define IDS_VSSDATABASE_DESC 104 +#define IDR_VSSAPP 105 +#define IDR_VSSDATABASE 106 +#define IDR_VSSITEM 107 +#define IDR_VSSITEMS 108 +#define IDR_VSSVERSIONS 109 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 202 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/ssphys/SSAPI/SSAPI.cpp b/ssphys/SSAPI/SSAPI.cpp new file mode 100644 index 0000000..eb8f1d3 --- /dev/null +++ b/ssphys/SSAPI/SSAPI.cpp @@ -0,0 +1,95 @@ +// SSAPI.cpp : Implementation of DLL Exports. + + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f SSAPIps.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include +#include "SSAPI.h" + +#include "SSAPI_i.c" +#include "VSSApp.h" +#include "VSSDatabase.h" + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +OBJECT_ENTRY(CLSID_VSSApp, CVSSApp) +OBJECT_ENTRY(CLSID_VSSDatabase, CVSSDatabase) +//OBJECT_ENTRY(CLSID_VSSItem, CVSSItem) +//OBJECT_ENTRY(CLSID_VSSItems, CVSSItems) +//OBJECT_ENTRY(CLSID_VSSVersions, CVSSVersions) +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DLL Entry Point + +extern "C" +BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, hInstance, &LIBID_SourceSafeTypeLib); + DisableThreadLibraryCalls(hInstance); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} + +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + return _Module.UnregisterServer(TRUE); +} + +//--------------------------------------------------------------------------- +void Info (const char* message) +{ + ATLTRACE ("INFO: %s", message); +} + +void Notice (const char* message) +{ + ATLTRACE ("NOTICE: %s", message); +} + +void Warning (const char* message) +{ + ATLTRACE ("WARNING: %s", message); +} + +void Error (const char* message) +{ + ATLTRACE ("ERROR: %s", message); +} diff --git a/ssphys/SSAPI/SSAPI.def b/ssphys/SSAPI/SSAPI.def new file mode 100644 index 0000000..dc05d8d --- /dev/null +++ b/ssphys/SSAPI/SSAPI.def @@ -0,0 +1,9 @@ +; SSAPI.def : Declares the module parameters. + +LIBRARY "SSAPI.DLL" + +EXPORTS + DllCanUnloadNow @1 PRIVATE + DllGetClassObject @2 PRIVATE + DllRegisterServer @3 PRIVATE + DllUnregisterServer @4 PRIVATE diff --git a/ssphys/SSAPI/SSAPI.dsp b/ssphys/SSAPI/SSAPI.dsp new file mode 100644 index 0000000..b041324 --- /dev/null +++ b/ssphys/SSAPI/SSAPI.dsp @@ -0,0 +1,376 @@ +# Microsoft Developer Studio Project File - Name="SSAPI" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=SSAPI - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "SSAPI.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "SSAPI.mak" CFG="SSAPI - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "SSAPI - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "SSAPI - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "SSAPI - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "SSAPI - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "SSAPI - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "SSAPI - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "SSAPI - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "SSAPI___Win32_Debug" +# PROP BASE Intermediate_Dir "SSAPI___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "SSAPI___Win32_Debug" +# PROP Intermediate_Dir "SSAPI___Win32_Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib COMSUPP.LIB /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# Begin Custom Build - Performing registration +OutDir=.\SSAPI___Win32_Debug +TargetPath=.\SSAPI___Win32_Debug\SSAPI.dll +InputPath=.\SSAPI___Win32_Debug\SSAPI.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "SSAPI - Win32 Unicode Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "SSAPI___Win32_DebugU" +# PROP BASE Intermediate_Dir "SSAPI___Win32_DebugU" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "SSAPI___Win32_DebugU" +# PROP Intermediate_Dir "SSAPI___Win32_DebugU" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# Begin Custom Build - Performing registration +OutDir=.\SSAPI___Win32_DebugU +TargetPath=.\SSAPI___Win32_DebugU\SSAPI.dll +InputPath=.\SSAPI___Win32_DebugU\SSAPI.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "SSAPI - Win32 Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinSize" +# PROP BASE Intermediate_Dir "ReleaseMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinSize" +# PROP Intermediate_Dir "ReleaseMinSize" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinSize +TargetPath=.\ReleaseMinSize\SSAPI.dll +InputPath=.\ReleaseMinSize\SSAPI.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "SSAPI - Win32 Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinDependency" +# PROP BASE Intermediate_Dir "ReleaseMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinDependency" +# PROP Intermediate_Dir "ReleaseMinDependency" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinDependency +TargetPath=.\ReleaseMinDependency\SSAPI.dll +InputPath=.\ReleaseMinDependency\SSAPI.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "SSAPI - Win32 Unicode Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinSize" +# PROP BASE Intermediate_Dir "ReleaseUMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinSize" +# PROP Intermediate_Dir "ReleaseUMinSize" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinSize +TargetPath=.\ReleaseUMinSize\SSAPI.dll +InputPath=.\ReleaseUMinSize\SSAPI.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "SSAPI - Win32 Unicode Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinDependency" +# PROP BASE Intermediate_Dir "ReleaseUMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinDependency" +# PROP Intermediate_Dir "ReleaseUMinDependency" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinDependency +TargetPath=.\ReleaseUMinDependency\SSAPI.dll +InputPath=.\ReleaseUMinDependency\SSAPI.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "SSAPI - Win32 Debug" +# Name "SSAPI - Win32 Unicode Debug" +# Name "SSAPI - Win32 Release MinSize" +# Name "SSAPI - Win32 Release MinDependency" +# Name "SSAPI - Win32 Unicode Release MinSize" +# Name "SSAPI - Win32 Unicode Release MinDependency" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\SSAPI.cpp +# End Source File +# Begin Source File + +SOURCE=.\SSAPI.def +# End Source File +# Begin Source File + +SOURCE=.\SSAPI.idl +# ADD MTL /tlb ".\SSAPI.tlb" /h "SSAPI.h" /iid "SSAPI_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\SSAPI.rc +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\VSSApp.cpp +# End Source File +# Begin Source File + +SOURCE=.\VSSDatabase.cpp +# End Source File +# Begin Source File + +SOURCE=.\VSSItem.cpp +# End Source File +# Begin Source File + +SOURCE=.\VSSItems.cpp +# End Source File +# Begin Source File + +SOURCE=.\VSSVersions.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\ssauterr.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\VSSApp.h +# End Source File +# Begin Source File + +SOURCE=.\VSSDatabase.h +# End Source File +# Begin Source File + +SOURCE=.\VSSItem.h +# End Source File +# Begin Source File + +SOURCE=.\VSSItems.h +# End Source File +# Begin Source File + +SOURCE=.\VSSVersions.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\VSSApp.rgs +# End Source File +# Begin Source File + +SOURCE=.\VSSDatabase.rgs +# End Source File +# Begin Source File + +SOURCE=.\VSSItem.rgs +# End Source File +# Begin Source File + +SOURCE=.\VSSItems.rgs +# End Source File +# Begin Source File + +SOURCE=.\VSSVersions.rgs +# End Source File +# End Group +# End Target +# End Project diff --git a/ssphys/SSAPI/SSAPI.h b/ssphys/SSAPI/SSAPI.h new file mode 100644 index 0000000..e3b1964 --- /dev/null +++ b/ssphys/SSAPI/SSAPI.h @@ -0,0 +1,5023 @@ +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Fri Mar 11 00:07:28 2005 + */ +/* Compiler settings for F:\src\vss2svn\ssphys\SSAPI\SSAPI.idl: + Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data +*/ +//@@MIDL_FILE_HEADING( ) + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 440 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __SSAPI_h__ +#define __SSAPI_h__ + +#ifdef __cplusplus +extern "C"{ +#endif + +/* Forward Declarations */ + +#ifndef __IVSSItemOld_FWD_DEFINED__ +#define __IVSSItemOld_FWD_DEFINED__ +typedef interface IVSSItemOld IVSSItemOld; +#endif /* __IVSSItemOld_FWD_DEFINED__ */ + + +#ifndef __IVSSItem_FWD_DEFINED__ +#define __IVSSItem_FWD_DEFINED__ +typedef interface IVSSItem IVSSItem; +#endif /* __IVSSItem_FWD_DEFINED__ */ + + +#ifndef __IVSSVersions_FWD_DEFINED__ +#define __IVSSVersions_FWD_DEFINED__ +typedef interface IVSSVersions IVSSVersions; +#endif /* __IVSSVersions_FWD_DEFINED__ */ + + +#ifndef __IVSSVersionOld_FWD_DEFINED__ +#define __IVSSVersionOld_FWD_DEFINED__ +typedef interface IVSSVersionOld IVSSVersionOld; +#endif /* __IVSSVersionOld_FWD_DEFINED__ */ + + +#ifndef __IVSSVersion_FWD_DEFINED__ +#define __IVSSVersion_FWD_DEFINED__ +typedef interface IVSSVersion IVSSVersion; +#endif /* __IVSSVersion_FWD_DEFINED__ */ + + +#ifndef __IVSSItems_FWD_DEFINED__ +#define __IVSSItems_FWD_DEFINED__ +typedef interface IVSSItems IVSSItems; +#endif /* __IVSSItems_FWD_DEFINED__ */ + + +#ifndef __IVSSCheckouts_FWD_DEFINED__ +#define __IVSSCheckouts_FWD_DEFINED__ +typedef interface IVSSCheckouts IVSSCheckouts; +#endif /* __IVSSCheckouts_FWD_DEFINED__ */ + + +#ifndef __IVSSCheckout_FWD_DEFINED__ +#define __IVSSCheckout_FWD_DEFINED__ +typedef interface IVSSCheckout IVSSCheckout; +#endif /* __IVSSCheckout_FWD_DEFINED__ */ + + +#ifndef __IVSSDatabaseOld_FWD_DEFINED__ +#define __IVSSDatabaseOld_FWD_DEFINED__ +typedef interface IVSSDatabaseOld IVSSDatabaseOld; +#endif /* __IVSSDatabaseOld_FWD_DEFINED__ */ + + +#ifndef __IVSSDatabase_FWD_DEFINED__ +#define __IVSSDatabase_FWD_DEFINED__ +typedef interface IVSSDatabase IVSSDatabase; +#endif /* __IVSSDatabase_FWD_DEFINED__ */ + + +#ifndef __IVSSUser_FWD_DEFINED__ +#define __IVSSUser_FWD_DEFINED__ +typedef interface IVSSUser IVSSUser; +#endif /* __IVSSUser_FWD_DEFINED__ */ + + +#ifndef __IVSSUsers_FWD_DEFINED__ +#define __IVSSUsers_FWD_DEFINED__ +typedef interface IVSSUsers IVSSUsers; +#endif /* __IVSSUsers_FWD_DEFINED__ */ + + +#ifndef __IVSSEventsOld_FWD_DEFINED__ +#define __IVSSEventsOld_FWD_DEFINED__ +typedef interface IVSSEventsOld IVSSEventsOld; +#endif /* __IVSSEventsOld_FWD_DEFINED__ */ + + +#ifndef __IVSSEvents_FWD_DEFINED__ +#define __IVSSEvents_FWD_DEFINED__ +typedef interface IVSSEvents IVSSEvents; +#endif /* __IVSSEvents_FWD_DEFINED__ */ + + +#ifndef __IVSS_FWD_DEFINED__ +#define __IVSS_FWD_DEFINED__ +typedef interface IVSS IVSS; +#endif /* __IVSS_FWD_DEFINED__ */ + + +#ifndef __IVSSEventHandler_FWD_DEFINED__ +#define __IVSSEventHandler_FWD_DEFINED__ +typedef interface IVSSEventHandler IVSSEventHandler; +#endif /* __IVSSEventHandler_FWD_DEFINED__ */ + + +#ifndef __VSSItem_FWD_DEFINED__ +#define __VSSItem_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class VSSItem VSSItem; +#else +typedef struct VSSItem VSSItem; +#endif /* __cplusplus */ + +#endif /* __VSSItem_FWD_DEFINED__ */ + + +#ifndef __VSSItems_FWD_DEFINED__ +#define __VSSItems_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class VSSItems VSSItems; +#else +typedef struct VSSItems VSSItems; +#endif /* __cplusplus */ + +#endif /* __VSSItems_FWD_DEFINED__ */ + + +#ifndef __VSSVersions_FWD_DEFINED__ +#define __VSSVersions_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class VSSVersions VSSVersions; +#else +typedef struct VSSVersions VSSVersions; +#endif /* __cplusplus */ + +#endif /* __VSSVersions_FWD_DEFINED__ */ + + +#ifndef __VSSVersion_FWD_DEFINED__ +#define __VSSVersion_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class VSSVersion VSSVersion; +#else +typedef struct VSSVersion VSSVersion; +#endif /* __cplusplus */ + +#endif /* __VSSVersion_FWD_DEFINED__ */ + + +#ifndef __VSSCheckout_FWD_DEFINED__ +#define __VSSCheckout_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class VSSCheckout VSSCheckout; +#else +typedef struct VSSCheckout VSSCheckout; +#endif /* __cplusplus */ + +#endif /* __VSSCheckout_FWD_DEFINED__ */ + + +#ifndef __VSSDatabase_FWD_DEFINED__ +#define __VSSDatabase_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class VSSDatabase VSSDatabase; +#else +typedef struct VSSDatabase VSSDatabase; +#endif /* __cplusplus */ + +#endif /* __VSSDatabase_FWD_DEFINED__ */ + + +#ifndef __VSSUser_FWD_DEFINED__ +#define __VSSUser_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class VSSUser VSSUser; +#else +typedef struct VSSUser VSSUser; +#endif /* __cplusplus */ + +#endif /* __VSSUser_FWD_DEFINED__ */ + + +#ifndef __VSSApp_FWD_DEFINED__ +#define __VSSApp_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class VSSApp VSSApp; +#else +typedef struct VSSApp VSSApp; +#endif /* __cplusplus */ + +#endif /* __VSSApp_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + + +#ifndef __SourceSafeTypeLib_LIBRARY_DEFINED__ +#define __SourceSafeTypeLib_LIBRARY_DEFINED__ + +/* library SourceSafeTypeLib */ +/* [helpcontext][helpfile][helpstring][version][uuid] */ + + + + + + + + + + + + + + + + + +typedef /* [public][helpstring][uuid] */ +enum __MIDL___MIDL_itf_SSAPI_0000_0001 + { VSSFLAG_USERRONO = 1, + VSSFLAG_USERROYES = 2, + VSSFLAG_TIMENOW = 4, + VSSFLAG_TIMEMOD = 8, + VSSFLAG_TIMEUPD = 12, + VSSFLAG_EOLCR = 16, + VSSFLAG_EOLLF = 32, + VSSFLAG_EOLCRLF = 48, + VSSFLAG_REPASK = 64, + VSSFLAG_REPREPLACE = 128, + VSSFLAG_REPSKIP = 192, + VSSFLAG_REPMERGE = 256, + VSSFLAG_CMPFULL = 512, + VSSFLAG_CMPTIME = 1024, + VSSFLAG_CMPCHKSUM = 1536, + VSSFLAG_CMPFAIL = 2048, + VSSFLAG_RECURSNO = 4096, + VSSFLAG_RECURSYES = 8192, + VSSFLAG_FORCEDIRNO = 16384, + VSSFLAG_FORCEDIRYES = 32768, + VSSFLAG_KEEPNO = 65536, + VSSFLAG_KEEPYES = 131072, + VSSFLAG_DELNO = 262144, + VSSFLAG_DELYES = 524288, + VSSFLAG_DELNOREPLACE = 786432, + VSSFLAG_BINTEST = 1048576, + VSSFLAG_BINBINARY = 2097152, + VSSFLAG_BINTEXT = 3145728, + VSSFLAG_DELTAYES = 4194304, + VSSFLAG_DELTANO = 8388608, + VSSFLAG_UPDASK = 16777216, + VSSFLAG_UPDUPDATE = 33554432, + VSSFLAG_UPDUNCH = 50331648, + VSSFLAG_GETYES = 67108864, + VSSFLAG_GETNO = 134217728, + VSSFLAG_CHKEXCLUSIVEYES = 268435456, + VSSFLAG_CHKEXCLUSIVENO = 536870912, + VSSFLAG_HISTIGNOREFILES = 1073741824 + } VSSFlags; + +typedef /* [public][helpstring][uuid] */ +enum __MIDL___MIDL_itf_SSAPI_0000_0002 + { VSSFILE_NOTCHECKEDOUT = 0, + VSSFILE_CHECKEDOUT = 1, + VSSFILE_CHECKEDOUT_ME = 2 + } VSSFileStatus; + +typedef /* [public][helpstring][uuid] */ +enum __MIDL___MIDL_itf_SSAPI_0000_0003 + { VSSITEM_PROJECT = 0, + VSSITEM_FILE = 1 + } VSSItemType; + +typedef /* [public][helpstring][uuid] */ +enum __MIDL___MIDL_itf_SSAPI_0000_0004 + { VSSRIGHTS_READ = 1, + VSSRIGHTS_CHKUPD = 2, + VSSRIGHTS_ADDRENREM = 4, + VSSRIGHTS_DESTROY = 8, + VSSRIGHTS_ALL = 15, + VSSRIGHTS_INHERITED = 16 + } VSSRights; + + +EXTERN_C const IID LIBID_SourceSafeTypeLib; + +#ifndef __IVSSItemOld_INTERFACE_DEFINED__ +#define __IVSSItemOld_INTERFACE_DEFINED__ + +/* interface IVSSItemOld */ +/* [object][oleautomation][dual][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSItemOld; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("783CD4E1-9D54-11CF-B8EE-00608CC9A71F") + IVSSItemOld : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Spec( + /* [retval][out] */ BSTR __RPC_FAR *pSpec) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Binary( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbBinary) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Binary( + /* [in] */ VARIANT_BOOL pbBinary) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Deleted( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbDeleted) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Deleted( + /* [in] */ VARIANT_BOOL pbDeleted) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Type( + /* [retval][out] */ int __RPC_FAR *piType) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_LocalSpec( + /* [retval][out] */ BSTR __RPC_FAR *pLocal) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_LocalSpec( + /* [in] */ BSTR pLocal) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Name( + /* [retval][out] */ BSTR __RPC_FAR *pName) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Name( + /* [in] */ BSTR pName) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Parent( + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIParent) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_VersionNumber( + /* [retval][out] */ long __RPC_FAR *piVersion) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Items( + /* [defaultvalue][optional][in] */ VARIANT_BOOL IncludeDeleted, + /* [retval][out] */ IVSSItems __RPC_FAR *__RPC_FAR *ppIItems) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Get( + /* [optional][out][in] */ BSTR __RPC_FAR *Local, + /* [defaultvalue][optional][in] */ long iFlags = 0) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Checkout( + /* [defaultvalue][optional][in] */ BSTR Comment = L"", + /* [defaultvalue][optional][in] */ BSTR Local = L"", + /* [defaultvalue][optional][in] */ long iFlags = 0) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Checkin( + /* [defaultvalue][optional][in] */ BSTR Comment = L"", + /* [defaultvalue][optional][in] */ BSTR Local = L"", + /* [defaultvalue][optional][in] */ long iFlags = 0) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE UndoCheckout( + /* [defaultvalue][optional][in] */ BSTR Local = L"", + /* [defaultvalue][optional][in] */ long iFlags = 0) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_IsCheckedOut( + /* [retval][out] */ long __RPC_FAR *piStatus) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Checkouts( + /* [retval][out] */ IVSSCheckouts __RPC_FAR *__RPC_FAR *ppICheckouts) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_IsDifferent( + /* [defaultvalue][optional][in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbDifferent) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Add( + /* [in] */ BSTR Local, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ long iFlags, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE NewSubproject( + /* [in] */ BSTR Name, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Share( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [defaultvalue][optional][in] */ BSTR Comment = L"", + /* [defaultvalue][optional][in] */ long iFlags = 0) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Destroy( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Move( + /* [in] */ IVSSItem __RPC_FAR *pINewParent) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Label( + /* [in] */ BSTR Label, + /* [defaultvalue][optional][in] */ BSTR Comment = L"") = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Versions( + /* [defaultvalue][optional][in] */ long iFlags, + /* [retval][out] */ IVSSVersions __RPC_FAR *__RPC_FAR *pIVersions) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Version( + /* [optional][in] */ VARIANT Version, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSItemOldVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSItemOld __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSItemOld __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSItemOld __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IVSSItemOld __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IVSSItemOld __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IVSSItemOld __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IVSSItemOld __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Spec )( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pSpec); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Binary )( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbBinary); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Binary )( + IVSSItemOld __RPC_FAR * This, + /* [in] */ VARIANT_BOOL pbBinary); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Deleted )( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbDeleted); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Deleted )( + IVSSItemOld __RPC_FAR * This, + /* [in] */ VARIANT_BOOL pbDeleted); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Type )( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ int __RPC_FAR *piType); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_LocalSpec )( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pLocal); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_LocalSpec )( + IVSSItemOld __RPC_FAR * This, + /* [in] */ BSTR pLocal); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Name )( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Name )( + IVSSItemOld __RPC_FAR * This, + /* [in] */ BSTR pName); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Parent )( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIParent); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VersionNumber )( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piVersion); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Items )( + IVSSItemOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ VARIANT_BOOL IncludeDeleted, + /* [retval][out] */ IVSSItems __RPC_FAR *__RPC_FAR *ppIItems); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Get )( + IVSSItemOld __RPC_FAR * This, + /* [optional][out][in] */ BSTR __RPC_FAR *Local, + /* [defaultvalue][optional][in] */ long iFlags); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Checkout )( + IVSSItemOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ BSTR Local, + /* [defaultvalue][optional][in] */ long iFlags); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Checkin )( + IVSSItemOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ BSTR Local, + /* [defaultvalue][optional][in] */ long iFlags); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *UndoCheckout )( + IVSSItemOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Local, + /* [defaultvalue][optional][in] */ long iFlags); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_IsCheckedOut )( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piStatus); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Checkouts )( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ IVSSCheckouts __RPC_FAR *__RPC_FAR *ppICheckouts); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_IsDifferent )( + IVSSItemOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbDifferent); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Add )( + IVSSItemOld __RPC_FAR * This, + /* [in] */ BSTR Local, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ long iFlags, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *NewSubproject )( + IVSSItemOld __RPC_FAR * This, + /* [in] */ BSTR Name, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Share )( + IVSSItemOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ long iFlags); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Destroy )( + IVSSItemOld __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Move )( + IVSSItemOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pINewParent); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Label )( + IVSSItemOld __RPC_FAR * This, + /* [in] */ BSTR Label, + /* [defaultvalue][optional][in] */ BSTR Comment); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Versions )( + IVSSItemOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ long iFlags, + /* [retval][out] */ IVSSVersions __RPC_FAR *__RPC_FAR *pIVersions); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Version )( + IVSSItemOld __RPC_FAR * This, + /* [optional][in] */ VARIANT Version, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + END_INTERFACE + } IVSSItemOldVtbl; + + interface IVSSItemOld + { + CONST_VTBL struct IVSSItemOldVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSItemOld_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSItemOld_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSItemOld_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSItemOld_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IVSSItemOld_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IVSSItemOld_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IVSSItemOld_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IVSSItemOld_get_Spec(This,pSpec) \ + (This)->lpVtbl -> get_Spec(This,pSpec) + +#define IVSSItemOld_get_Binary(This,pbBinary) \ + (This)->lpVtbl -> get_Binary(This,pbBinary) + +#define IVSSItemOld_put_Binary(This,pbBinary) \ + (This)->lpVtbl -> put_Binary(This,pbBinary) + +#define IVSSItemOld_get_Deleted(This,pbDeleted) \ + (This)->lpVtbl -> get_Deleted(This,pbDeleted) + +#define IVSSItemOld_put_Deleted(This,pbDeleted) \ + (This)->lpVtbl -> put_Deleted(This,pbDeleted) + +#define IVSSItemOld_get_Type(This,piType) \ + (This)->lpVtbl -> get_Type(This,piType) + +#define IVSSItemOld_get_LocalSpec(This,pLocal) \ + (This)->lpVtbl -> get_LocalSpec(This,pLocal) + +#define IVSSItemOld_put_LocalSpec(This,pLocal) \ + (This)->lpVtbl -> put_LocalSpec(This,pLocal) + +#define IVSSItemOld_get_Name(This,pName) \ + (This)->lpVtbl -> get_Name(This,pName) + +#define IVSSItemOld_put_Name(This,pName) \ + (This)->lpVtbl -> put_Name(This,pName) + +#define IVSSItemOld_get_Parent(This,ppIParent) \ + (This)->lpVtbl -> get_Parent(This,ppIParent) + +#define IVSSItemOld_get_VersionNumber(This,piVersion) \ + (This)->lpVtbl -> get_VersionNumber(This,piVersion) + +#define IVSSItemOld_get_Items(This,IncludeDeleted,ppIItems) \ + (This)->lpVtbl -> get_Items(This,IncludeDeleted,ppIItems) + +#define IVSSItemOld_Get(This,Local,iFlags) \ + (This)->lpVtbl -> Get(This,Local,iFlags) + +#define IVSSItemOld_Checkout(This,Comment,Local,iFlags) \ + (This)->lpVtbl -> Checkout(This,Comment,Local,iFlags) + +#define IVSSItemOld_Checkin(This,Comment,Local,iFlags) \ + (This)->lpVtbl -> Checkin(This,Comment,Local,iFlags) + +#define IVSSItemOld_UndoCheckout(This,Local,iFlags) \ + (This)->lpVtbl -> UndoCheckout(This,Local,iFlags) + +#define IVSSItemOld_get_IsCheckedOut(This,piStatus) \ + (This)->lpVtbl -> get_IsCheckedOut(This,piStatus) + +#define IVSSItemOld_get_Checkouts(This,ppICheckouts) \ + (This)->lpVtbl -> get_Checkouts(This,ppICheckouts) + +#define IVSSItemOld_get_IsDifferent(This,Local,pbDifferent) \ + (This)->lpVtbl -> get_IsDifferent(This,Local,pbDifferent) + +#define IVSSItemOld_Add(This,Local,Comment,iFlags,ppIItem) \ + (This)->lpVtbl -> Add(This,Local,Comment,iFlags,ppIItem) + +#define IVSSItemOld_NewSubproject(This,Name,Comment,ppIItem) \ + (This)->lpVtbl -> NewSubproject(This,Name,Comment,ppIItem) + +#define IVSSItemOld_Share(This,pIItem,Comment,iFlags) \ + (This)->lpVtbl -> Share(This,pIItem,Comment,iFlags) + +#define IVSSItemOld_Destroy(This) \ + (This)->lpVtbl -> Destroy(This) + +#define IVSSItemOld_Move(This,pINewParent) \ + (This)->lpVtbl -> Move(This,pINewParent) + +#define IVSSItemOld_Label(This,Label,Comment) \ + (This)->lpVtbl -> Label(This,Label,Comment) + +#define IVSSItemOld_get_Versions(This,iFlags,pIVersions) \ + (This)->lpVtbl -> get_Versions(This,iFlags,pIVersions) + +#define IVSSItemOld_get_Version(This,Version,ppIItem) \ + (This)->lpVtbl -> get_Version(This,Version,ppIItem) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_Spec_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pSpec); + + +void __RPC_STUB IVSSItemOld_get_Spec_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_Binary_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbBinary); + + +void __RPC_STUB IVSSItemOld_get_Binary_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_put_Binary_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [in] */ VARIANT_BOOL pbBinary); + + +void __RPC_STUB IVSSItemOld_put_Binary_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_Deleted_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbDeleted); + + +void __RPC_STUB IVSSItemOld_get_Deleted_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_put_Deleted_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [in] */ VARIANT_BOOL pbDeleted); + + +void __RPC_STUB IVSSItemOld_put_Deleted_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_Type_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ int __RPC_FAR *piType); + + +void __RPC_STUB IVSSItemOld_get_Type_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_LocalSpec_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pLocal); + + +void __RPC_STUB IVSSItemOld_get_LocalSpec_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_put_LocalSpec_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [in] */ BSTR pLocal); + + +void __RPC_STUB IVSSItemOld_put_LocalSpec_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_Name_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + +void __RPC_STUB IVSSItemOld_get_Name_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_put_Name_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [in] */ BSTR pName); + + +void __RPC_STUB IVSSItemOld_put_Name_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_Parent_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIParent); + + +void __RPC_STUB IVSSItemOld_get_Parent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_VersionNumber_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piVersion); + + +void __RPC_STUB IVSSItemOld_get_VersionNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_Items_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ VARIANT_BOOL IncludeDeleted, + /* [retval][out] */ IVSSItems __RPC_FAR *__RPC_FAR *ppIItems); + + +void __RPC_STUB IVSSItemOld_get_Items_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_Get_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [optional][out][in] */ BSTR __RPC_FAR *Local, + /* [defaultvalue][optional][in] */ long iFlags); + + +void __RPC_STUB IVSSItemOld_Get_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_Checkout_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ BSTR Local, + /* [defaultvalue][optional][in] */ long iFlags); + + +void __RPC_STUB IVSSItemOld_Checkout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_Checkin_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ BSTR Local, + /* [defaultvalue][optional][in] */ long iFlags); + + +void __RPC_STUB IVSSItemOld_Checkin_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_UndoCheckout_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Local, + /* [defaultvalue][optional][in] */ long iFlags); + + +void __RPC_STUB IVSSItemOld_UndoCheckout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_IsCheckedOut_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piStatus); + + +void __RPC_STUB IVSSItemOld_get_IsCheckedOut_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_Checkouts_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [retval][out] */ IVSSCheckouts __RPC_FAR *__RPC_FAR *ppICheckouts); + + +void __RPC_STUB IVSSItemOld_get_Checkouts_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_IsDifferent_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbDifferent); + + +void __RPC_STUB IVSSItemOld_get_IsDifferent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_Add_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [in] */ BSTR Local, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ long iFlags, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + +void __RPC_STUB IVSSItemOld_Add_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_NewSubproject_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [in] */ BSTR Name, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + +void __RPC_STUB IVSSItemOld_NewSubproject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_Share_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ long iFlags); + + +void __RPC_STUB IVSSItemOld_Share_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_Destroy_Proxy( + IVSSItemOld __RPC_FAR * This); + + +void __RPC_STUB IVSSItemOld_Destroy_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_Move_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pINewParent); + + +void __RPC_STUB IVSSItemOld_Move_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_Label_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [in] */ BSTR Label, + /* [defaultvalue][optional][in] */ BSTR Comment); + + +void __RPC_STUB IVSSItemOld_Label_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_Versions_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ long iFlags, + /* [retval][out] */ IVSSVersions __RPC_FAR *__RPC_FAR *pIVersions); + + +void __RPC_STUB IVSSItemOld_get_Versions_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItemOld_get_Version_Proxy( + IVSSItemOld __RPC_FAR * This, + /* [optional][in] */ VARIANT Version, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + +void __RPC_STUB IVSSItemOld_get_Version_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSItemOld_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSItem_INTERFACE_DEFINED__ +#define __IVSSItem_INTERFACE_DEFINED__ + +/* interface IVSSItem */ +/* [object][oleautomation][dual][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSItem; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2A0DE0E7-2E9F-11D0-9236-00AA00A1EB95") + IVSSItem : public IVSSItemOld + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Links( + /* [retval][out] */ IVSSItems __RPC_FAR *__RPC_FAR *ppIItems) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Branch( + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ long iFlags, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSItemVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSItem __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSItem __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSItem __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IVSSItem __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IVSSItem __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IVSSItem __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IVSSItem __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Spec )( + IVSSItem __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pSpec); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Binary )( + IVSSItem __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbBinary); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Binary )( + IVSSItem __RPC_FAR * This, + /* [in] */ VARIANT_BOOL pbBinary); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Deleted )( + IVSSItem __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbDeleted); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Deleted )( + IVSSItem __RPC_FAR * This, + /* [in] */ VARIANT_BOOL pbDeleted); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Type )( + IVSSItem __RPC_FAR * This, + /* [retval][out] */ int __RPC_FAR *piType); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_LocalSpec )( + IVSSItem __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pLocal); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_LocalSpec )( + IVSSItem __RPC_FAR * This, + /* [in] */ BSTR pLocal); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Name )( + IVSSItem __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Name )( + IVSSItem __RPC_FAR * This, + /* [in] */ BSTR pName); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Parent )( + IVSSItem __RPC_FAR * This, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIParent); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VersionNumber )( + IVSSItem __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piVersion); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Items )( + IVSSItem __RPC_FAR * This, + /* [defaultvalue][optional][in] */ VARIANT_BOOL IncludeDeleted, + /* [retval][out] */ IVSSItems __RPC_FAR *__RPC_FAR *ppIItems); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Get )( + IVSSItem __RPC_FAR * This, + /* [optional][out][in] */ BSTR __RPC_FAR *Local, + /* [defaultvalue][optional][in] */ long iFlags); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Checkout )( + IVSSItem __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ BSTR Local, + /* [defaultvalue][optional][in] */ long iFlags); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Checkin )( + IVSSItem __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ BSTR Local, + /* [defaultvalue][optional][in] */ long iFlags); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *UndoCheckout )( + IVSSItem __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Local, + /* [defaultvalue][optional][in] */ long iFlags); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_IsCheckedOut )( + IVSSItem __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piStatus); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Checkouts )( + IVSSItem __RPC_FAR * This, + /* [retval][out] */ IVSSCheckouts __RPC_FAR *__RPC_FAR *ppICheckouts); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_IsDifferent )( + IVSSItem __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbDifferent); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Add )( + IVSSItem __RPC_FAR * This, + /* [in] */ BSTR Local, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ long iFlags, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *NewSubproject )( + IVSSItem __RPC_FAR * This, + /* [in] */ BSTR Name, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Share )( + IVSSItem __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ long iFlags); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Destroy )( + IVSSItem __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Move )( + IVSSItem __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pINewParent); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Label )( + IVSSItem __RPC_FAR * This, + /* [in] */ BSTR Label, + /* [defaultvalue][optional][in] */ BSTR Comment); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Versions )( + IVSSItem __RPC_FAR * This, + /* [defaultvalue][optional][in] */ long iFlags, + /* [retval][out] */ IVSSVersions __RPC_FAR *__RPC_FAR *pIVersions); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Version )( + IVSSItem __RPC_FAR * This, + /* [optional][in] */ VARIANT Version, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Links )( + IVSSItem __RPC_FAR * This, + /* [retval][out] */ IVSSItems __RPC_FAR *__RPC_FAR *ppIItems); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Branch )( + IVSSItem __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ long iFlags, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + END_INTERFACE + } IVSSItemVtbl; + + interface IVSSItem + { + CONST_VTBL struct IVSSItemVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSItem_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSItem_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSItem_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSItem_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IVSSItem_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IVSSItem_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IVSSItem_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IVSSItem_get_Spec(This,pSpec) \ + (This)->lpVtbl -> get_Spec(This,pSpec) + +#define IVSSItem_get_Binary(This,pbBinary) \ + (This)->lpVtbl -> get_Binary(This,pbBinary) + +#define IVSSItem_put_Binary(This,pbBinary) \ + (This)->lpVtbl -> put_Binary(This,pbBinary) + +#define IVSSItem_get_Deleted(This,pbDeleted) \ + (This)->lpVtbl -> get_Deleted(This,pbDeleted) + +#define IVSSItem_put_Deleted(This,pbDeleted) \ + (This)->lpVtbl -> put_Deleted(This,pbDeleted) + +#define IVSSItem_get_Type(This,piType) \ + (This)->lpVtbl -> get_Type(This,piType) + +#define IVSSItem_get_LocalSpec(This,pLocal) \ + (This)->lpVtbl -> get_LocalSpec(This,pLocal) + +#define IVSSItem_put_LocalSpec(This,pLocal) \ + (This)->lpVtbl -> put_LocalSpec(This,pLocal) + +#define IVSSItem_get_Name(This,pName) \ + (This)->lpVtbl -> get_Name(This,pName) + +#define IVSSItem_put_Name(This,pName) \ + (This)->lpVtbl -> put_Name(This,pName) + +#define IVSSItem_get_Parent(This,ppIParent) \ + (This)->lpVtbl -> get_Parent(This,ppIParent) + +#define IVSSItem_get_VersionNumber(This,piVersion) \ + (This)->lpVtbl -> get_VersionNumber(This,piVersion) + +#define IVSSItem_get_Items(This,IncludeDeleted,ppIItems) \ + (This)->lpVtbl -> get_Items(This,IncludeDeleted,ppIItems) + +#define IVSSItem_Get(This,Local,iFlags) \ + (This)->lpVtbl -> Get(This,Local,iFlags) + +#define IVSSItem_Checkout(This,Comment,Local,iFlags) \ + (This)->lpVtbl -> Checkout(This,Comment,Local,iFlags) + +#define IVSSItem_Checkin(This,Comment,Local,iFlags) \ + (This)->lpVtbl -> Checkin(This,Comment,Local,iFlags) + +#define IVSSItem_UndoCheckout(This,Local,iFlags) \ + (This)->lpVtbl -> UndoCheckout(This,Local,iFlags) + +#define IVSSItem_get_IsCheckedOut(This,piStatus) \ + (This)->lpVtbl -> get_IsCheckedOut(This,piStatus) + +#define IVSSItem_get_Checkouts(This,ppICheckouts) \ + (This)->lpVtbl -> get_Checkouts(This,ppICheckouts) + +#define IVSSItem_get_IsDifferent(This,Local,pbDifferent) \ + (This)->lpVtbl -> get_IsDifferent(This,Local,pbDifferent) + +#define IVSSItem_Add(This,Local,Comment,iFlags,ppIItem) \ + (This)->lpVtbl -> Add(This,Local,Comment,iFlags,ppIItem) + +#define IVSSItem_NewSubproject(This,Name,Comment,ppIItem) \ + (This)->lpVtbl -> NewSubproject(This,Name,Comment,ppIItem) + +#define IVSSItem_Share(This,pIItem,Comment,iFlags) \ + (This)->lpVtbl -> Share(This,pIItem,Comment,iFlags) + +#define IVSSItem_Destroy(This) \ + (This)->lpVtbl -> Destroy(This) + +#define IVSSItem_Move(This,pINewParent) \ + (This)->lpVtbl -> Move(This,pINewParent) + +#define IVSSItem_Label(This,Label,Comment) \ + (This)->lpVtbl -> Label(This,Label,Comment) + +#define IVSSItem_get_Versions(This,iFlags,pIVersions) \ + (This)->lpVtbl -> get_Versions(This,iFlags,pIVersions) + +#define IVSSItem_get_Version(This,Version,ppIItem) \ + (This)->lpVtbl -> get_Version(This,Version,ppIItem) + + +#define IVSSItem_get_Links(This,ppIItems) \ + (This)->lpVtbl -> get_Links(This,ppIItems) + +#define IVSSItem_Branch(This,Comment,iFlags,ppIItem) \ + (This)->lpVtbl -> Branch(This,Comment,iFlags,ppIItem) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItem_get_Links_Proxy( + IVSSItem __RPC_FAR * This, + /* [retval][out] */ IVSSItems __RPC_FAR *__RPC_FAR *ppIItems); + + +void __RPC_STUB IVSSItem_get_Links_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSItem_Branch_Proxy( + IVSSItem __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Comment, + /* [defaultvalue][optional][in] */ long iFlags, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + +void __RPC_STUB IVSSItem_Branch_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSItem_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSVersions_INTERFACE_DEFINED__ +#define __IVSSVersions_INTERFACE_DEFINED__ + +/* interface IVSSVersions */ +/* [object][oleautomation][dual][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSVersions; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("783CD4E7-9D54-11CF-B8EE-00608CC9A71F") + IVSSVersions : public IDispatch + { + public: + virtual /* [hidden][restricted][id] */ HRESULT STDMETHODCALLTYPE _NewEnum( + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppIEnum) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSVersionsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSVersions __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSVersions __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSVersions __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IVSSVersions __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IVSSVersions __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IVSSVersions __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IVSSVersions __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [hidden][restricted][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *_NewEnum )( + IVSSVersions __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppIEnum); + + END_INTERFACE + } IVSSVersionsVtbl; + + interface IVSSVersions + { + CONST_VTBL struct IVSSVersionsVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSVersions_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSVersions_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSVersions_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSVersions_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IVSSVersions_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IVSSVersions_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IVSSVersions_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IVSSVersions__NewEnum(This,ppIEnum) \ + (This)->lpVtbl -> _NewEnum(This,ppIEnum) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [hidden][restricted][id] */ HRESULT STDMETHODCALLTYPE IVSSVersions__NewEnum_Proxy( + IVSSVersions __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppIEnum); + + +void __RPC_STUB IVSSVersions__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSVersions_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSVersionOld_INTERFACE_DEFINED__ +#define __IVSSVersionOld_INTERFACE_DEFINED__ + +/* interface IVSSVersionOld */ +/* [object][oleautomation][dual][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSVersionOld; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("783CD4E8-9D54-11CF-B8EE-00608CC9A71F") + IVSSVersionOld : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Username( + /* [retval][out] */ BSTR __RPC_FAR *pUsername) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_VersionNumber( + /* [retval][out] */ long __RPC_FAR *piVersion) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Action( + /* [retval][out] */ BSTR __RPC_FAR *pAction) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Date( + /* [retval][out] */ DATE __RPC_FAR *pDate) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Comment( + /* [retval][out] */ BSTR __RPC_FAR *pComment) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Label( + /* [retval][out] */ BSTR __RPC_FAR *pLabel) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_VSSItem( + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSVersionOldVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSVersionOld __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSVersionOld __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSVersionOld __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IVSSVersionOld __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IVSSVersionOld __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IVSSVersionOld __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IVSSVersionOld __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Username )( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pUsername); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VersionNumber )( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piVersion); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Action )( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pAction); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Date )( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ DATE __RPC_FAR *pDate); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Comment )( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pComment); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Label )( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pLabel); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VSSItem )( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + END_INTERFACE + } IVSSVersionOldVtbl; + + interface IVSSVersionOld + { + CONST_VTBL struct IVSSVersionOldVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSVersionOld_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSVersionOld_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSVersionOld_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSVersionOld_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IVSSVersionOld_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IVSSVersionOld_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IVSSVersionOld_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IVSSVersionOld_get_Username(This,pUsername) \ + (This)->lpVtbl -> get_Username(This,pUsername) + +#define IVSSVersionOld_get_VersionNumber(This,piVersion) \ + (This)->lpVtbl -> get_VersionNumber(This,piVersion) + +#define IVSSVersionOld_get_Action(This,pAction) \ + (This)->lpVtbl -> get_Action(This,pAction) + +#define IVSSVersionOld_get_Date(This,pDate) \ + (This)->lpVtbl -> get_Date(This,pDate) + +#define IVSSVersionOld_get_Comment(This,pComment) \ + (This)->lpVtbl -> get_Comment(This,pComment) + +#define IVSSVersionOld_get_Label(This,pLabel) \ + (This)->lpVtbl -> get_Label(This,pLabel) + +#define IVSSVersionOld_get_VSSItem(This,ppIItem) \ + (This)->lpVtbl -> get_VSSItem(This,ppIItem) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSVersionOld_get_Username_Proxy( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pUsername); + + +void __RPC_STUB IVSSVersionOld_get_Username_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSVersionOld_get_VersionNumber_Proxy( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piVersion); + + +void __RPC_STUB IVSSVersionOld_get_VersionNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSVersionOld_get_Action_Proxy( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pAction); + + +void __RPC_STUB IVSSVersionOld_get_Action_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSVersionOld_get_Date_Proxy( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ DATE __RPC_FAR *pDate); + + +void __RPC_STUB IVSSVersionOld_get_Date_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSVersionOld_get_Comment_Proxy( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pComment); + + +void __RPC_STUB IVSSVersionOld_get_Comment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSVersionOld_get_Label_Proxy( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pLabel); + + +void __RPC_STUB IVSSVersionOld_get_Label_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSVersionOld_get_VSSItem_Proxy( + IVSSVersionOld __RPC_FAR * This, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + +void __RPC_STUB IVSSVersionOld_get_VSSItem_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSVersionOld_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSVersion_INTERFACE_DEFINED__ +#define __IVSSVersion_INTERFACE_DEFINED__ + +/* interface IVSSVersion */ +/* [object][oleautomation][dual][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSVersion; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2A0DE0E9-2E9F-11D0-9236-00AA00A1EB95") + IVSSVersion : public IVSSVersionOld + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_LabelComment( + /* [retval][out] */ BSTR __RPC_FAR *pComment) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSVersionVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSVersion __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSVersion __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSVersion __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IVSSVersion __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IVSSVersion __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IVSSVersion __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IVSSVersion __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Username )( + IVSSVersion __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pUsername); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VersionNumber )( + IVSSVersion __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piVersion); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Action )( + IVSSVersion __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pAction); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Date )( + IVSSVersion __RPC_FAR * This, + /* [retval][out] */ DATE __RPC_FAR *pDate); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Comment )( + IVSSVersion __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pComment); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Label )( + IVSSVersion __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pLabel); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VSSItem )( + IVSSVersion __RPC_FAR * This, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_LabelComment )( + IVSSVersion __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pComment); + + END_INTERFACE + } IVSSVersionVtbl; + + interface IVSSVersion + { + CONST_VTBL struct IVSSVersionVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSVersion_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSVersion_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSVersion_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSVersion_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IVSSVersion_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IVSSVersion_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IVSSVersion_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IVSSVersion_get_Username(This,pUsername) \ + (This)->lpVtbl -> get_Username(This,pUsername) + +#define IVSSVersion_get_VersionNumber(This,piVersion) \ + (This)->lpVtbl -> get_VersionNumber(This,piVersion) + +#define IVSSVersion_get_Action(This,pAction) \ + (This)->lpVtbl -> get_Action(This,pAction) + +#define IVSSVersion_get_Date(This,pDate) \ + (This)->lpVtbl -> get_Date(This,pDate) + +#define IVSSVersion_get_Comment(This,pComment) \ + (This)->lpVtbl -> get_Comment(This,pComment) + +#define IVSSVersion_get_Label(This,pLabel) \ + (This)->lpVtbl -> get_Label(This,pLabel) + +#define IVSSVersion_get_VSSItem(This,ppIItem) \ + (This)->lpVtbl -> get_VSSItem(This,ppIItem) + + +#define IVSSVersion_get_LabelComment(This,pComment) \ + (This)->lpVtbl -> get_LabelComment(This,pComment) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSVersion_get_LabelComment_Proxy( + IVSSVersion __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pComment); + + +void __RPC_STUB IVSSVersion_get_LabelComment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSVersion_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSItems_INTERFACE_DEFINED__ +#define __IVSSItems_INTERFACE_DEFINED__ + +/* interface IVSSItems */ +/* [object][oleautomation][dual][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSItems; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("783CD4E5-9D54-11CF-B8EE-00608CC9A71F") + IVSSItems : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long __RPC_FAR *piCount) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Item( + /* [in] */ VARIANT sItem, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem) = 0; + + virtual /* [hidden][restricted][id] */ HRESULT STDMETHODCALLTYPE _NewEnum( + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppIEnum) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSItemsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSItems __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSItems __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSItems __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IVSSItems __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IVSSItems __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IVSSItems __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IVSSItems __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Count )( + IVSSItems __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piCount); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Item )( + IVSSItems __RPC_FAR * This, + /* [in] */ VARIANT sItem, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + /* [hidden][restricted][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *_NewEnum )( + IVSSItems __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppIEnum); + + END_INTERFACE + } IVSSItemsVtbl; + + interface IVSSItems + { + CONST_VTBL struct IVSSItemsVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSItems_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSItems_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSItems_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSItems_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IVSSItems_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IVSSItems_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IVSSItems_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IVSSItems_get_Count(This,piCount) \ + (This)->lpVtbl -> get_Count(This,piCount) + +#define IVSSItems_get_Item(This,sItem,ppIItem) \ + (This)->lpVtbl -> get_Item(This,sItem,ppIItem) + +#define IVSSItems__NewEnum(This,ppIEnum) \ + (This)->lpVtbl -> _NewEnum(This,ppIEnum) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItems_get_Count_Proxy( + IVSSItems __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piCount); + + +void __RPC_STUB IVSSItems_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSItems_get_Item_Proxy( + IVSSItems __RPC_FAR * This, + /* [in] */ VARIANT sItem, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIItem); + + +void __RPC_STUB IVSSItems_get_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [hidden][restricted][id] */ HRESULT STDMETHODCALLTYPE IVSSItems__NewEnum_Proxy( + IVSSItems __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppIEnum); + + +void __RPC_STUB IVSSItems__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSItems_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSCheckouts_INTERFACE_DEFINED__ +#define __IVSSCheckouts_INTERFACE_DEFINED__ + +/* interface IVSSCheckouts */ +/* [object][oleautomation][dual][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSCheckouts; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8903A770-F55F-11CF-9227-00AA00A1EB95") + IVSSCheckouts : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long __RPC_FAR *piCount) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Item( + /* [in] */ VARIANT sItem, + /* [retval][out] */ IVSSCheckout __RPC_FAR *__RPC_FAR *ppICheckout) = 0; + + virtual /* [hidden][restricted][id] */ HRESULT STDMETHODCALLTYPE _NewEnum( + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppIEnum) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSCheckoutsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSCheckouts __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSCheckouts __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSCheckouts __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IVSSCheckouts __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IVSSCheckouts __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IVSSCheckouts __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IVSSCheckouts __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Count )( + IVSSCheckouts __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piCount); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Item )( + IVSSCheckouts __RPC_FAR * This, + /* [in] */ VARIANT sItem, + /* [retval][out] */ IVSSCheckout __RPC_FAR *__RPC_FAR *ppICheckout); + + /* [hidden][restricted][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *_NewEnum )( + IVSSCheckouts __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppIEnum); + + END_INTERFACE + } IVSSCheckoutsVtbl; + + interface IVSSCheckouts + { + CONST_VTBL struct IVSSCheckoutsVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSCheckouts_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSCheckouts_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSCheckouts_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSCheckouts_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IVSSCheckouts_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IVSSCheckouts_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IVSSCheckouts_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IVSSCheckouts_get_Count(This,piCount) \ + (This)->lpVtbl -> get_Count(This,piCount) + +#define IVSSCheckouts_get_Item(This,sItem,ppICheckout) \ + (This)->lpVtbl -> get_Item(This,sItem,ppICheckout) + +#define IVSSCheckouts__NewEnum(This,ppIEnum) \ + (This)->lpVtbl -> _NewEnum(This,ppIEnum) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSCheckouts_get_Count_Proxy( + IVSSCheckouts __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piCount); + + +void __RPC_STUB IVSSCheckouts_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSCheckouts_get_Item_Proxy( + IVSSCheckouts __RPC_FAR * This, + /* [in] */ VARIANT sItem, + /* [retval][out] */ IVSSCheckout __RPC_FAR *__RPC_FAR *ppICheckout); + + +void __RPC_STUB IVSSCheckouts_get_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [hidden][restricted][id] */ HRESULT STDMETHODCALLTYPE IVSSCheckouts__NewEnum_Proxy( + IVSSCheckouts __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppIEnum); + + +void __RPC_STUB IVSSCheckouts__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSCheckouts_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSCheckout_INTERFACE_DEFINED__ +#define __IVSSCheckout_INTERFACE_DEFINED__ + +/* interface IVSSCheckout */ +/* [object][oleautomation][dual][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSCheckout; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("783CD4E6-9D54-11CF-B8EE-00608CC9A71F") + IVSSCheckout : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Username( + /* [retval][out] */ BSTR __RPC_FAR *pUsername) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Date( + /* [retval][out] */ DATE __RPC_FAR *pDate) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_LocalSpec( + /* [retval][out] */ BSTR __RPC_FAR *pLocal) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Machine( + /* [retval][out] */ BSTR __RPC_FAR *pMachine) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Project( + /* [retval][out] */ BSTR __RPC_FAR *pProject) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Comment( + /* [retval][out] */ BSTR __RPC_FAR *pComment) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_VersionNumber( + /* [retval][out] */ long __RPC_FAR *piVersion) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSCheckoutVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSCheckout __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSCheckout __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSCheckout __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IVSSCheckout __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IVSSCheckout __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IVSSCheckout __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IVSSCheckout __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Username )( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pUsername); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Date )( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ DATE __RPC_FAR *pDate); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_LocalSpec )( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pLocal); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Machine )( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pMachine); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Project )( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pProject); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Comment )( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pComment); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VersionNumber )( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piVersion); + + END_INTERFACE + } IVSSCheckoutVtbl; + + interface IVSSCheckout + { + CONST_VTBL struct IVSSCheckoutVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSCheckout_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSCheckout_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSCheckout_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSCheckout_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IVSSCheckout_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IVSSCheckout_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IVSSCheckout_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IVSSCheckout_get_Username(This,pUsername) \ + (This)->lpVtbl -> get_Username(This,pUsername) + +#define IVSSCheckout_get_Date(This,pDate) \ + (This)->lpVtbl -> get_Date(This,pDate) + +#define IVSSCheckout_get_LocalSpec(This,pLocal) \ + (This)->lpVtbl -> get_LocalSpec(This,pLocal) + +#define IVSSCheckout_get_Machine(This,pMachine) \ + (This)->lpVtbl -> get_Machine(This,pMachine) + +#define IVSSCheckout_get_Project(This,pProject) \ + (This)->lpVtbl -> get_Project(This,pProject) + +#define IVSSCheckout_get_Comment(This,pComment) \ + (This)->lpVtbl -> get_Comment(This,pComment) + +#define IVSSCheckout_get_VersionNumber(This,piVersion) \ + (This)->lpVtbl -> get_VersionNumber(This,piVersion) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSCheckout_get_Username_Proxy( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pUsername); + + +void __RPC_STUB IVSSCheckout_get_Username_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSCheckout_get_Date_Proxy( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ DATE __RPC_FAR *pDate); + + +void __RPC_STUB IVSSCheckout_get_Date_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSCheckout_get_LocalSpec_Proxy( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pLocal); + + +void __RPC_STUB IVSSCheckout_get_LocalSpec_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSCheckout_get_Machine_Proxy( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pMachine); + + +void __RPC_STUB IVSSCheckout_get_Machine_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSCheckout_get_Project_Proxy( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pProject); + + +void __RPC_STUB IVSSCheckout_get_Project_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSCheckout_get_Comment_Proxy( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pComment); + + +void __RPC_STUB IVSSCheckout_get_Comment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSCheckout_get_VersionNumber_Proxy( + IVSSCheckout __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piVersion); + + +void __RPC_STUB IVSSCheckout_get_VersionNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSCheckout_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSDatabaseOld_INTERFACE_DEFINED__ +#define __IVSSDatabaseOld_INTERFACE_DEFINED__ + +/* interface IVSSDatabaseOld */ +/* [object][oleautomation][dual][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSDatabaseOld; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("783CD4E2-9D54-11CF-B8EE-00608CC9A71F") + IVSSDatabaseOld : public IDispatch + { + public: + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Open( + /* [defaultvalue][optional][in] */ BSTR SrcSafeIni = L"", + /* [defaultvalue][optional][in] */ BSTR Username = L"", + /* [defaultvalue][optional][in] */ BSTR Password = L"") = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_SrcSafeIni( + /* [retval][out] */ BSTR __RPC_FAR *pSrcSafeIni) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_DatabaseName( + /* [retval][out] */ BSTR __RPC_FAR *pDatabaseName) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Username( + /* [retval][out] */ BSTR __RPC_FAR *pUsername) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_CurrentProject( + /* [retval][out] */ BSTR __RPC_FAR *pPrj) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_CurrentProject( + /* [in] */ BSTR pPrj) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_VSSItem( + /* [in] */ BSTR Spec, + /* [defaultvalue][optional][in] */ VARIANT_BOOL Deleted, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIVSSItem) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSDatabaseOldVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSDatabaseOld __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSDatabaseOld __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSDatabaseOld __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IVSSDatabaseOld __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IVSSDatabaseOld __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IVSSDatabaseOld __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IVSSDatabaseOld __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Open )( + IVSSDatabaseOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR SrcSafeIni, + /* [defaultvalue][optional][in] */ BSTR Username, + /* [defaultvalue][optional][in] */ BSTR Password); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_SrcSafeIni )( + IVSSDatabaseOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pSrcSafeIni); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_DatabaseName )( + IVSSDatabaseOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pDatabaseName); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Username )( + IVSSDatabaseOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pUsername); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_CurrentProject )( + IVSSDatabaseOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pPrj); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_CurrentProject )( + IVSSDatabaseOld __RPC_FAR * This, + /* [in] */ BSTR pPrj); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VSSItem )( + IVSSDatabaseOld __RPC_FAR * This, + /* [in] */ BSTR Spec, + /* [defaultvalue][optional][in] */ VARIANT_BOOL Deleted, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIVSSItem); + + END_INTERFACE + } IVSSDatabaseOldVtbl; + + interface IVSSDatabaseOld + { + CONST_VTBL struct IVSSDatabaseOldVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSDatabaseOld_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSDatabaseOld_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSDatabaseOld_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSDatabaseOld_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IVSSDatabaseOld_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IVSSDatabaseOld_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IVSSDatabaseOld_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IVSSDatabaseOld_Open(This,SrcSafeIni,Username,Password) \ + (This)->lpVtbl -> Open(This,SrcSafeIni,Username,Password) + +#define IVSSDatabaseOld_get_SrcSafeIni(This,pSrcSafeIni) \ + (This)->lpVtbl -> get_SrcSafeIni(This,pSrcSafeIni) + +#define IVSSDatabaseOld_get_DatabaseName(This,pDatabaseName) \ + (This)->lpVtbl -> get_DatabaseName(This,pDatabaseName) + +#define IVSSDatabaseOld_get_Username(This,pUsername) \ + (This)->lpVtbl -> get_Username(This,pUsername) + +#define IVSSDatabaseOld_get_CurrentProject(This,pPrj) \ + (This)->lpVtbl -> get_CurrentProject(This,pPrj) + +#define IVSSDatabaseOld_put_CurrentProject(This,pPrj) \ + (This)->lpVtbl -> put_CurrentProject(This,pPrj) + +#define IVSSDatabaseOld_get_VSSItem(This,Spec,Deleted,ppIVSSItem) \ + (This)->lpVtbl -> get_VSSItem(This,Spec,Deleted,ppIVSSItem) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSDatabaseOld_Open_Proxy( + IVSSDatabaseOld __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR SrcSafeIni, + /* [defaultvalue][optional][in] */ BSTR Username, + /* [defaultvalue][optional][in] */ BSTR Password); + + +void __RPC_STUB IVSSDatabaseOld_Open_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSDatabaseOld_get_SrcSafeIni_Proxy( + IVSSDatabaseOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pSrcSafeIni); + + +void __RPC_STUB IVSSDatabaseOld_get_SrcSafeIni_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSDatabaseOld_get_DatabaseName_Proxy( + IVSSDatabaseOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pDatabaseName); + + +void __RPC_STUB IVSSDatabaseOld_get_DatabaseName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSDatabaseOld_get_Username_Proxy( + IVSSDatabaseOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pUsername); + + +void __RPC_STUB IVSSDatabaseOld_get_Username_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSDatabaseOld_get_CurrentProject_Proxy( + IVSSDatabaseOld __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pPrj); + + +void __RPC_STUB IVSSDatabaseOld_get_CurrentProject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IVSSDatabaseOld_put_CurrentProject_Proxy( + IVSSDatabaseOld __RPC_FAR * This, + /* [in] */ BSTR pPrj); + + +void __RPC_STUB IVSSDatabaseOld_put_CurrentProject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSDatabaseOld_get_VSSItem_Proxy( + IVSSDatabaseOld __RPC_FAR * This, + /* [in] */ BSTR Spec, + /* [defaultvalue][optional][in] */ VARIANT_BOOL Deleted, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIVSSItem); + + +void __RPC_STUB IVSSDatabaseOld_get_VSSItem_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSDatabaseOld_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSDatabase_INTERFACE_DEFINED__ +#define __IVSSDatabase_INTERFACE_DEFINED__ + +/* interface IVSSDatabase */ +/* [object][oleautomation][dual][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSDatabase; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2A0DE0E2-2E9F-11D0-9236-00AA00A1EB95") + IVSSDatabase : public IVSSDatabaseOld + { + public: + virtual /* [id] */ HRESULT STDMETHODCALLTYPE AddUser( + /* [in] */ BSTR User, + /* [in] */ BSTR Password, + /* [in] */ VARIANT_BOOL ReadOnly, + /* [retval][out] */ IVSSUser __RPC_FAR *__RPC_FAR *ppIUser) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_User( + /* [in] */ BSTR Name, + /* [retval][out] */ IVSSUser __RPC_FAR *__RPC_FAR *ppIUser) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Users( + /* [retval][out] */ IVSSUsers __RPC_FAR *__RPC_FAR *ppIUsers) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_ProjectRightsEnabled( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pEnabled) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_ProjectRightsEnabled( + /* [in] */ VARIANT_BOOL pEnabled) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_DefaultProjectRights( + /* [retval][out] */ long __RPC_FAR *pRights) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_DefaultProjectRights( + /* [in] */ long pRights) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSDatabaseVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSDatabase __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSDatabase __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSDatabase __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IVSSDatabase __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IVSSDatabase __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IVSSDatabase __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IVSSDatabase __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Open )( + IVSSDatabase __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR SrcSafeIni, + /* [defaultvalue][optional][in] */ BSTR Username, + /* [defaultvalue][optional][in] */ BSTR Password); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_SrcSafeIni )( + IVSSDatabase __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pSrcSafeIni); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_DatabaseName )( + IVSSDatabase __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pDatabaseName); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Username )( + IVSSDatabase __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pUsername); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_CurrentProject )( + IVSSDatabase __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pPrj); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_CurrentProject )( + IVSSDatabase __RPC_FAR * This, + /* [in] */ BSTR pPrj); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VSSItem )( + IVSSDatabase __RPC_FAR * This, + /* [in] */ BSTR Spec, + /* [defaultvalue][optional][in] */ VARIANT_BOOL Deleted, + /* [retval][out] */ IVSSItem __RPC_FAR *__RPC_FAR *ppIVSSItem); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddUser )( + IVSSDatabase __RPC_FAR * This, + /* [in] */ BSTR User, + /* [in] */ BSTR Password, + /* [in] */ VARIANT_BOOL ReadOnly, + /* [retval][out] */ IVSSUser __RPC_FAR *__RPC_FAR *ppIUser); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_User )( + IVSSDatabase __RPC_FAR * This, + /* [in] */ BSTR Name, + /* [retval][out] */ IVSSUser __RPC_FAR *__RPC_FAR *ppIUser); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Users )( + IVSSDatabase __RPC_FAR * This, + /* [retval][out] */ IVSSUsers __RPC_FAR *__RPC_FAR *ppIUsers); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_ProjectRightsEnabled )( + IVSSDatabase __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pEnabled); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_ProjectRightsEnabled )( + IVSSDatabase __RPC_FAR * This, + /* [in] */ VARIANT_BOOL pEnabled); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_DefaultProjectRights )( + IVSSDatabase __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pRights); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_DefaultProjectRights )( + IVSSDatabase __RPC_FAR * This, + /* [in] */ long pRights); + + END_INTERFACE + } IVSSDatabaseVtbl; + + interface IVSSDatabase + { + CONST_VTBL struct IVSSDatabaseVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSDatabase_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSDatabase_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSDatabase_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSDatabase_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IVSSDatabase_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IVSSDatabase_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IVSSDatabase_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IVSSDatabase_Open(This,SrcSafeIni,Username,Password) \ + (This)->lpVtbl -> Open(This,SrcSafeIni,Username,Password) + +#define IVSSDatabase_get_SrcSafeIni(This,pSrcSafeIni) \ + (This)->lpVtbl -> get_SrcSafeIni(This,pSrcSafeIni) + +#define IVSSDatabase_get_DatabaseName(This,pDatabaseName) \ + (This)->lpVtbl -> get_DatabaseName(This,pDatabaseName) + +#define IVSSDatabase_get_Username(This,pUsername) \ + (This)->lpVtbl -> get_Username(This,pUsername) + +#define IVSSDatabase_get_CurrentProject(This,pPrj) \ + (This)->lpVtbl -> get_CurrentProject(This,pPrj) + +#define IVSSDatabase_put_CurrentProject(This,pPrj) \ + (This)->lpVtbl -> put_CurrentProject(This,pPrj) + +#define IVSSDatabase_get_VSSItem(This,Spec,Deleted,ppIVSSItem) \ + (This)->lpVtbl -> get_VSSItem(This,Spec,Deleted,ppIVSSItem) + + +#define IVSSDatabase_AddUser(This,User,Password,ReadOnly,ppIUser) \ + (This)->lpVtbl -> AddUser(This,User,Password,ReadOnly,ppIUser) + +#define IVSSDatabase_get_User(This,Name,ppIUser) \ + (This)->lpVtbl -> get_User(This,Name,ppIUser) + +#define IVSSDatabase_get_Users(This,ppIUsers) \ + (This)->lpVtbl -> get_Users(This,ppIUsers) + +#define IVSSDatabase_get_ProjectRightsEnabled(This,pEnabled) \ + (This)->lpVtbl -> get_ProjectRightsEnabled(This,pEnabled) + +#define IVSSDatabase_put_ProjectRightsEnabled(This,pEnabled) \ + (This)->lpVtbl -> put_ProjectRightsEnabled(This,pEnabled) + +#define IVSSDatabase_get_DefaultProjectRights(This,pRights) \ + (This)->lpVtbl -> get_DefaultProjectRights(This,pRights) + +#define IVSSDatabase_put_DefaultProjectRights(This,pRights) \ + (This)->lpVtbl -> put_DefaultProjectRights(This,pRights) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSDatabase_AddUser_Proxy( + IVSSDatabase __RPC_FAR * This, + /* [in] */ BSTR User, + /* [in] */ BSTR Password, + /* [in] */ VARIANT_BOOL ReadOnly, + /* [retval][out] */ IVSSUser __RPC_FAR *__RPC_FAR *ppIUser); + + +void __RPC_STUB IVSSDatabase_AddUser_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSDatabase_get_User_Proxy( + IVSSDatabase __RPC_FAR * This, + /* [in] */ BSTR Name, + /* [retval][out] */ IVSSUser __RPC_FAR *__RPC_FAR *ppIUser); + + +void __RPC_STUB IVSSDatabase_get_User_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSDatabase_get_Users_Proxy( + IVSSDatabase __RPC_FAR * This, + /* [retval][out] */ IVSSUsers __RPC_FAR *__RPC_FAR *ppIUsers); + + +void __RPC_STUB IVSSDatabase_get_Users_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSDatabase_get_ProjectRightsEnabled_Proxy( + IVSSDatabase __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pEnabled); + + +void __RPC_STUB IVSSDatabase_get_ProjectRightsEnabled_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IVSSDatabase_put_ProjectRightsEnabled_Proxy( + IVSSDatabase __RPC_FAR * This, + /* [in] */ VARIANT_BOOL pEnabled); + + +void __RPC_STUB IVSSDatabase_put_ProjectRightsEnabled_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSDatabase_get_DefaultProjectRights_Proxy( + IVSSDatabase __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pRights); + + +void __RPC_STUB IVSSDatabase_get_DefaultProjectRights_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IVSSDatabase_put_DefaultProjectRights_Proxy( + IVSSDatabase __RPC_FAR * This, + /* [in] */ long pRights); + + +void __RPC_STUB IVSSDatabase_put_DefaultProjectRights_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSDatabase_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSUser_INTERFACE_DEFINED__ +#define __IVSSUser_INTERFACE_DEFINED__ + +/* interface IVSSUser */ +/* [object][oleautomation][dual][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSUser; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2A0DE0E3-2E9F-11D0-9236-00AA00A1EB95") + IVSSUser : public IDispatch + { + public: + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Delete( void) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Name( + /* [retval][out] */ BSTR __RPC_FAR *pName) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Name( + /* [in] */ BSTR pName) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Password( + /* [in] */ BSTR rhs) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_ReadOnly( + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pReadOnly) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_ReadOnly( + /* [in] */ VARIANT_BOOL pReadOnly) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_ProjectRights( + /* [defaultvalue][optional][in] */ BSTR Project, + /* [retval][out] */ long __RPC_FAR *piRightsOut) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_ProjectRights( + /* [defaultvalue][optional][in] */ BSTR Project, + /* [in] */ long piRightsOut) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE RemoveProjectRights( + /* [in] */ BSTR Project) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSUserVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSUser __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSUser __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSUser __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IVSSUser __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IVSSUser __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IVSSUser __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IVSSUser __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Delete )( + IVSSUser __RPC_FAR * This); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Name )( + IVSSUser __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Name )( + IVSSUser __RPC_FAR * This, + /* [in] */ BSTR pName); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Password )( + IVSSUser __RPC_FAR * This, + /* [in] */ BSTR rhs); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_ReadOnly )( + IVSSUser __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pReadOnly); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_ReadOnly )( + IVSSUser __RPC_FAR * This, + /* [in] */ VARIANT_BOOL pReadOnly); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_ProjectRights )( + IVSSUser __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Project, + /* [retval][out] */ long __RPC_FAR *piRightsOut); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_ProjectRights )( + IVSSUser __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Project, + /* [in] */ long piRightsOut); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RemoveProjectRights )( + IVSSUser __RPC_FAR * This, + /* [in] */ BSTR Project); + + END_INTERFACE + } IVSSUserVtbl; + + interface IVSSUser + { + CONST_VTBL struct IVSSUserVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSUser_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSUser_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSUser_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSUser_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IVSSUser_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IVSSUser_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IVSSUser_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IVSSUser_Delete(This) \ + (This)->lpVtbl -> Delete(This) + +#define IVSSUser_get_Name(This,pName) \ + (This)->lpVtbl -> get_Name(This,pName) + +#define IVSSUser_put_Name(This,pName) \ + (This)->lpVtbl -> put_Name(This,pName) + +#define IVSSUser_put_Password(This,rhs) \ + (This)->lpVtbl -> put_Password(This,rhs) + +#define IVSSUser_get_ReadOnly(This,pReadOnly) \ + (This)->lpVtbl -> get_ReadOnly(This,pReadOnly) + +#define IVSSUser_put_ReadOnly(This,pReadOnly) \ + (This)->lpVtbl -> put_ReadOnly(This,pReadOnly) + +#define IVSSUser_get_ProjectRights(This,Project,piRightsOut) \ + (This)->lpVtbl -> get_ProjectRights(This,Project,piRightsOut) + +#define IVSSUser_put_ProjectRights(This,Project,piRightsOut) \ + (This)->lpVtbl -> put_ProjectRights(This,Project,piRightsOut) + +#define IVSSUser_RemoveProjectRights(This,Project) \ + (This)->lpVtbl -> RemoveProjectRights(This,Project) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSUser_Delete_Proxy( + IVSSUser __RPC_FAR * This); + + +void __RPC_STUB IVSSUser_Delete_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSUser_get_Name_Proxy( + IVSSUser __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + +void __RPC_STUB IVSSUser_get_Name_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IVSSUser_put_Name_Proxy( + IVSSUser __RPC_FAR * This, + /* [in] */ BSTR pName); + + +void __RPC_STUB IVSSUser_put_Name_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IVSSUser_put_Password_Proxy( + IVSSUser __RPC_FAR * This, + /* [in] */ BSTR rhs); + + +void __RPC_STUB IVSSUser_put_Password_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSUser_get_ReadOnly_Proxy( + IVSSUser __RPC_FAR * This, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pReadOnly); + + +void __RPC_STUB IVSSUser_get_ReadOnly_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IVSSUser_put_ReadOnly_Proxy( + IVSSUser __RPC_FAR * This, + /* [in] */ VARIANT_BOOL pReadOnly); + + +void __RPC_STUB IVSSUser_put_ReadOnly_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSUser_get_ProjectRights_Proxy( + IVSSUser __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Project, + /* [retval][out] */ long __RPC_FAR *piRightsOut); + + +void __RPC_STUB IVSSUser_get_ProjectRights_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE IVSSUser_put_ProjectRights_Proxy( + IVSSUser __RPC_FAR * This, + /* [defaultvalue][optional][in] */ BSTR Project, + /* [in] */ long piRightsOut); + + +void __RPC_STUB IVSSUser_put_ProjectRights_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE IVSSUser_RemoveProjectRights_Proxy( + IVSSUser __RPC_FAR * This, + /* [in] */ BSTR Project); + + +void __RPC_STUB IVSSUser_RemoveProjectRights_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSUser_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSUsers_INTERFACE_DEFINED__ +#define __IVSSUsers_INTERFACE_DEFINED__ + +/* interface IVSSUsers */ +/* [object][oleautomation][dual][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSUsers; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2A0DE0E4-2E9F-11D0-9236-00AA00A1EB95") + IVSSUsers : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long __RPC_FAR *piCount) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Item( + /* [in] */ VARIANT sItem, + /* [retval][out] */ IVSSUser __RPC_FAR *__RPC_FAR *ppIUser) = 0; + + virtual /* [hidden][restricted][id] */ HRESULT STDMETHODCALLTYPE _NewEnum( + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppIEnum) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSUsersVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSUsers __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSUsers __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSUsers __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IVSSUsers __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IVSSUsers __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IVSSUsers __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IVSSUsers __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Count )( + IVSSUsers __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piCount); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Item )( + IVSSUsers __RPC_FAR * This, + /* [in] */ VARIANT sItem, + /* [retval][out] */ IVSSUser __RPC_FAR *__RPC_FAR *ppIUser); + + /* [hidden][restricted][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *_NewEnum )( + IVSSUsers __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppIEnum); + + END_INTERFACE + } IVSSUsersVtbl; + + interface IVSSUsers + { + CONST_VTBL struct IVSSUsersVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSUsers_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSUsers_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSUsers_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSUsers_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IVSSUsers_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IVSSUsers_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IVSSUsers_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IVSSUsers_get_Count(This,piCount) \ + (This)->lpVtbl -> get_Count(This,piCount) + +#define IVSSUsers_get_Item(This,sItem,ppIUser) \ + (This)->lpVtbl -> get_Item(This,sItem,ppIUser) + +#define IVSSUsers__NewEnum(This,ppIEnum) \ + (This)->lpVtbl -> _NewEnum(This,ppIEnum) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSUsers_get_Count_Proxy( + IVSSUsers __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *piCount); + + +void __RPC_STUB IVSSUsers_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSSUsers_get_Item_Proxy( + IVSSUsers __RPC_FAR * This, + /* [in] */ VARIANT sItem, + /* [retval][out] */ IVSSUser __RPC_FAR *__RPC_FAR *ppIUser); + + +void __RPC_STUB IVSSUsers_get_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [hidden][restricted][id] */ HRESULT STDMETHODCALLTYPE IVSSUsers__NewEnum_Proxy( + IVSSUsers __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppIEnum); + + +void __RPC_STUB IVSSUsers__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSUsers_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSEventsOld_INTERFACE_DEFINED__ +#define __IVSSEventsOld_INTERFACE_DEFINED__ + +/* interface IVSSEventsOld */ +/* [object][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSEventsOld; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("783CD4E9-9D54-11CF-B8EE-00608CC9A71F") + IVSSEventsOld : public IUnknown + { + public: + virtual HRESULT __stdcall BeforeAdd( + /* [in] */ IVSSItem __RPC_FAR *pIPrj, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterAdd( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local) = 0; + + virtual HRESULT __stdcall BeforeCheckout( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterCheckout( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local) = 0; + + virtual HRESULT __stdcall BeforeCheckin( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterCheckin( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local) = 0; + + virtual HRESULT __stdcall BeforeUndoCheckout( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterUndoCheckout( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local) = 0; + + virtual HRESULT __stdcall BeforeRename( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR NewName, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterRename( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR OldName) = 0; + + virtual HRESULT __stdcall BeforeBranch( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterBranch( + /* [in] */ IVSSItem __RPC_FAR *pIItem) = 0; + + virtual HRESULT __stdcall BeforeEvent( + /* [in] */ long iEvent, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Str, + /* [in] */ VARIANT var, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterEvent( + /* [in] */ long iEvent, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Str, + /* [in] */ VARIANT var) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSEventsOldVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSEventsOld __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSEventsOld __RPC_FAR * This); + + HRESULT ( __stdcall __RPC_FAR *BeforeAdd )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIPrj, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterAdd )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local); + + HRESULT ( __stdcall __RPC_FAR *BeforeCheckout )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterCheckout )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local); + + HRESULT ( __stdcall __RPC_FAR *BeforeCheckin )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterCheckin )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local); + + HRESULT ( __stdcall __RPC_FAR *BeforeUndoCheckout )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterUndoCheckout )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local); + + HRESULT ( __stdcall __RPC_FAR *BeforeRename )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR NewName, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterRename )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR OldName); + + HRESULT ( __stdcall __RPC_FAR *BeforeBranch )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterBranch )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem); + + HRESULT ( __stdcall __RPC_FAR *BeforeEvent )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ long iEvent, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Str, + /* [in] */ VARIANT var, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterEvent )( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ long iEvent, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Str, + /* [in] */ VARIANT var); + + END_INTERFACE + } IVSSEventsOldVtbl; + + interface IVSSEventsOld + { + CONST_VTBL struct IVSSEventsOldVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSEventsOld_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSEventsOld_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSEventsOld_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSEventsOld_BeforeAdd(This,pIPrj,Local,pbContinue) \ + (This)->lpVtbl -> BeforeAdd(This,pIPrj,Local,pbContinue) + +#define IVSSEventsOld_AfterAdd(This,pIItem,Local) \ + (This)->lpVtbl -> AfterAdd(This,pIItem,Local) + +#define IVSSEventsOld_BeforeCheckout(This,pIItem,Local,pbContinue) \ + (This)->lpVtbl -> BeforeCheckout(This,pIItem,Local,pbContinue) + +#define IVSSEventsOld_AfterCheckout(This,pIItem,Local) \ + (This)->lpVtbl -> AfterCheckout(This,pIItem,Local) + +#define IVSSEventsOld_BeforeCheckin(This,pIItem,Local,pbContinue) \ + (This)->lpVtbl -> BeforeCheckin(This,pIItem,Local,pbContinue) + +#define IVSSEventsOld_AfterCheckin(This,pIItem,Local) \ + (This)->lpVtbl -> AfterCheckin(This,pIItem,Local) + +#define IVSSEventsOld_BeforeUndoCheckout(This,pIItem,Local,pbContinue) \ + (This)->lpVtbl -> BeforeUndoCheckout(This,pIItem,Local,pbContinue) + +#define IVSSEventsOld_AfterUndoCheckout(This,pIItem,Local) \ + (This)->lpVtbl -> AfterUndoCheckout(This,pIItem,Local) + +#define IVSSEventsOld_BeforeRename(This,pIItem,NewName,pbContinue) \ + (This)->lpVtbl -> BeforeRename(This,pIItem,NewName,pbContinue) + +#define IVSSEventsOld_AfterRename(This,pIItem,OldName) \ + (This)->lpVtbl -> AfterRename(This,pIItem,OldName) + +#define IVSSEventsOld_BeforeBranch(This,pIItem,pbContinue) \ + (This)->lpVtbl -> BeforeBranch(This,pIItem,pbContinue) + +#define IVSSEventsOld_AfterBranch(This,pIItem) \ + (This)->lpVtbl -> AfterBranch(This,pIItem) + +#define IVSSEventsOld_BeforeEvent(This,iEvent,pIItem,Str,var,pbContinue) \ + (This)->lpVtbl -> BeforeEvent(This,iEvent,pIItem,Str,var,pbContinue) + +#define IVSSEventsOld_AfterEvent(This,iEvent,pIItem,Str,var) \ + (This)->lpVtbl -> AfterEvent(This,iEvent,pIItem,Str,var) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT __stdcall IVSSEventsOld_BeforeAdd_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIPrj, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEventsOld_BeforeAdd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEventsOld_AfterAdd_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local); + + +void __RPC_STUB IVSSEventsOld_AfterAdd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEventsOld_BeforeCheckout_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEventsOld_BeforeCheckout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEventsOld_AfterCheckout_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local); + + +void __RPC_STUB IVSSEventsOld_AfterCheckout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEventsOld_BeforeCheckin_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEventsOld_BeforeCheckin_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEventsOld_AfterCheckin_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local); + + +void __RPC_STUB IVSSEventsOld_AfterCheckin_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEventsOld_BeforeUndoCheckout_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEventsOld_BeforeUndoCheckout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEventsOld_AfterUndoCheckout_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local); + + +void __RPC_STUB IVSSEventsOld_AfterUndoCheckout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEventsOld_BeforeRename_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR NewName, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEventsOld_BeforeRename_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEventsOld_AfterRename_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR OldName); + + +void __RPC_STUB IVSSEventsOld_AfterRename_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEventsOld_BeforeBranch_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEventsOld_BeforeBranch_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEventsOld_AfterBranch_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem); + + +void __RPC_STUB IVSSEventsOld_AfterBranch_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEventsOld_BeforeEvent_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ long iEvent, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Str, + /* [in] */ VARIANT var, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEventsOld_BeforeEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEventsOld_AfterEvent_Proxy( + IVSSEventsOld __RPC_FAR * This, + /* [in] */ long iEvent, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Str, + /* [in] */ VARIANT var); + + +void __RPC_STUB IVSSEventsOld_AfterEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSEventsOld_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSEvents_INTERFACE_DEFINED__ +#define __IVSSEvents_INTERFACE_DEFINED__ + +/* interface IVSSEvents */ +/* [object][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSEvents; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2A0DE0E8-2E9F-11D0-9236-00AA00A1EB95") + IVSSEvents : public IUnknown + { + public: + virtual HRESULT __stdcall BeforeAdd( + /* [in] */ IVSSItem __RPC_FAR *pIPrj, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterAdd( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment) = 0; + + virtual HRESULT __stdcall BeforeCheckout( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterCheckout( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment) = 0; + + virtual HRESULT __stdcall BeforeCheckin( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterCheckin( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment) = 0; + + virtual HRESULT __stdcall BeforeUndoCheckout( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterUndoCheckout( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local) = 0; + + virtual HRESULT __stdcall BeforeRename( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR NewName, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterRename( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR OldName) = 0; + + virtual HRESULT __stdcall BeforeBranch( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Comment, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterBranch( + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Comment) = 0; + + virtual HRESULT __stdcall BeginCommand( + /* [in] */ long unused, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall EndCommand( + /* [in] */ long unused) = 0; + + virtual HRESULT __stdcall BeforeEvent( + /* [in] */ long iEvent, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Str, + /* [in] */ VARIANT var, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue) = 0; + + virtual HRESULT __stdcall AfterEvent( + /* [in] */ long iEvent, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Str, + /* [in] */ VARIANT var) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSEventsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSEvents __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSEvents __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSEvents __RPC_FAR * This); + + HRESULT ( __stdcall __RPC_FAR *BeforeAdd )( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIPrj, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterAdd )( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment); + + HRESULT ( __stdcall __RPC_FAR *BeforeCheckout )( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterCheckout )( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment); + + HRESULT ( __stdcall __RPC_FAR *BeforeCheckin )( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterCheckin )( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment); + + HRESULT ( __stdcall __RPC_FAR *BeforeUndoCheckout )( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterUndoCheckout )( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local); + + HRESULT ( __stdcall __RPC_FAR *BeforeRename )( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR NewName, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterRename )( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR OldName); + + HRESULT ( __stdcall __RPC_FAR *BeforeBranch )( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Comment, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterBranch )( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Comment); + + HRESULT ( __stdcall __RPC_FAR *BeginCommand )( + IVSSEvents __RPC_FAR * This, + /* [in] */ long unused, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *EndCommand )( + IVSSEvents __RPC_FAR * This, + /* [in] */ long unused); + + HRESULT ( __stdcall __RPC_FAR *BeforeEvent )( + IVSSEvents __RPC_FAR * This, + /* [in] */ long iEvent, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Str, + /* [in] */ VARIANT var, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + HRESULT ( __stdcall __RPC_FAR *AfterEvent )( + IVSSEvents __RPC_FAR * This, + /* [in] */ long iEvent, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Str, + /* [in] */ VARIANT var); + + END_INTERFACE + } IVSSEventsVtbl; + + interface IVSSEvents + { + CONST_VTBL struct IVSSEventsVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSEvents_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSEvents_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSEvents_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSEvents_BeforeAdd(This,pIPrj,Local,Comment,pbContinue) \ + (This)->lpVtbl -> BeforeAdd(This,pIPrj,Local,Comment,pbContinue) + +#define IVSSEvents_AfterAdd(This,pIItem,Local,Comment) \ + (This)->lpVtbl -> AfterAdd(This,pIItem,Local,Comment) + +#define IVSSEvents_BeforeCheckout(This,pIItem,Local,Comment,pbContinue) \ + (This)->lpVtbl -> BeforeCheckout(This,pIItem,Local,Comment,pbContinue) + +#define IVSSEvents_AfterCheckout(This,pIItem,Local,Comment) \ + (This)->lpVtbl -> AfterCheckout(This,pIItem,Local,Comment) + +#define IVSSEvents_BeforeCheckin(This,pIItem,Local,Comment,pbContinue) \ + (This)->lpVtbl -> BeforeCheckin(This,pIItem,Local,Comment,pbContinue) + +#define IVSSEvents_AfterCheckin(This,pIItem,Local,Comment) \ + (This)->lpVtbl -> AfterCheckin(This,pIItem,Local,Comment) + +#define IVSSEvents_BeforeUndoCheckout(This,pIItem,Local,pbContinue) \ + (This)->lpVtbl -> BeforeUndoCheckout(This,pIItem,Local,pbContinue) + +#define IVSSEvents_AfterUndoCheckout(This,pIItem,Local) \ + (This)->lpVtbl -> AfterUndoCheckout(This,pIItem,Local) + +#define IVSSEvents_BeforeRename(This,pIItem,NewName,pbContinue) \ + (This)->lpVtbl -> BeforeRename(This,pIItem,NewName,pbContinue) + +#define IVSSEvents_AfterRename(This,pIItem,OldName) \ + (This)->lpVtbl -> AfterRename(This,pIItem,OldName) + +#define IVSSEvents_BeforeBranch(This,pIItem,Comment,pbContinue) \ + (This)->lpVtbl -> BeforeBranch(This,pIItem,Comment,pbContinue) + +#define IVSSEvents_AfterBranch(This,pIItem,Comment) \ + (This)->lpVtbl -> AfterBranch(This,pIItem,Comment) + +#define IVSSEvents_BeginCommand(This,unused,pbContinue) \ + (This)->lpVtbl -> BeginCommand(This,unused,pbContinue) + +#define IVSSEvents_EndCommand(This,unused) \ + (This)->lpVtbl -> EndCommand(This,unused) + +#define IVSSEvents_BeforeEvent(This,iEvent,pIItem,Str,var,pbContinue) \ + (This)->lpVtbl -> BeforeEvent(This,iEvent,pIItem,Str,var,pbContinue) + +#define IVSSEvents_AfterEvent(This,iEvent,pIItem,Str,var) \ + (This)->lpVtbl -> AfterEvent(This,iEvent,pIItem,Str,var) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT __stdcall IVSSEvents_BeforeAdd_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIPrj, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEvents_BeforeAdd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_AfterAdd_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment); + + +void __RPC_STUB IVSSEvents_AfterAdd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_BeforeCheckout_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEvents_BeforeCheckout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_AfterCheckout_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment); + + +void __RPC_STUB IVSSEvents_AfterCheckout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_BeforeCheckin_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEvents_BeforeCheckin_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_AfterCheckin_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [in] */ BSTR Comment); + + +void __RPC_STUB IVSSEvents_AfterCheckin_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_BeforeUndoCheckout_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEvents_BeforeUndoCheckout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_AfterUndoCheckout_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Local); + + +void __RPC_STUB IVSSEvents_AfterUndoCheckout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_BeforeRename_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR NewName, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEvents_BeforeRename_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_AfterRename_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR OldName); + + +void __RPC_STUB IVSSEvents_AfterRename_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_BeforeBranch_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Comment, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEvents_BeforeBranch_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_AfterBranch_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Comment); + + +void __RPC_STUB IVSSEvents_AfterBranch_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_BeginCommand_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ long unused, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEvents_BeginCommand_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_EndCommand_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ long unused); + + +void __RPC_STUB IVSSEvents_EndCommand_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_BeforeEvent_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ long iEvent, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Str, + /* [in] */ VARIANT var, + /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbContinue); + + +void __RPC_STUB IVSSEvents_BeforeEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT __stdcall IVSSEvents_AfterEvent_Proxy( + IVSSEvents __RPC_FAR * This, + /* [in] */ long iEvent, + /* [in] */ IVSSItem __RPC_FAR *pIItem, + /* [in] */ BSTR Str, + /* [in] */ VARIANT var); + + +void __RPC_STUB IVSSEvents_AfterEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSEvents_INTERFACE_DEFINED__ */ + + +#ifndef __IVSS_INTERFACE_DEFINED__ +#define __IVSS_INTERFACE_DEFINED__ + +/* interface IVSS */ +/* [object][oleautomation][dual][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSS; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("783CD4EB-9D54-11CF-B8EE-00608CC9A71F") + IVSS : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_VSSDatabase( + /* [retval][out] */ IVSSDatabase __RPC_FAR *__RPC_FAR *ppIVSSDatabase) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSS __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSS __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSS __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + IVSS __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + IVSS __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + IVSS __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + IVSS __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VSSDatabase )( + IVSS __RPC_FAR * This, + /* [retval][out] */ IVSSDatabase __RPC_FAR *__RPC_FAR *ppIVSSDatabase); + + END_INTERFACE + } IVSSVtbl; + + interface IVSS + { + CONST_VTBL struct IVSSVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSS_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSS_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSS_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSS_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define IVSS_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define IVSS_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define IVSS_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define IVSS_get_VSSDatabase(This,ppIVSSDatabase) \ + (This)->lpVtbl -> get_VSSDatabase(This,ppIVSSDatabase) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE IVSS_get_VSSDatabase_Proxy( + IVSS __RPC_FAR * This, + /* [retval][out] */ IVSSDatabase __RPC_FAR *__RPC_FAR *ppIVSSDatabase); + + +void __RPC_STUB IVSS_get_VSSDatabase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSS_INTERFACE_DEFINED__ */ + + +#ifndef __IVSSEventHandler_INTERFACE_DEFINED__ +#define __IVSSEventHandler_INTERFACE_DEFINED__ + +/* interface IVSSEventHandler */ +/* [object][helpstring][uuid] */ + + +EXTERN_C const IID IID_IVSSEventHandler; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("783CD4EA-9D54-11CF-B8EE-00608CC9A71F") + IVSSEventHandler : public IUnknown + { + public: + virtual HRESULT __stdcall Init( + /* [in] */ IVSS __RPC_FAR *pIVSS) = 0; + + }; + +#else /* C style interface */ + + typedef struct IVSSEventHandlerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + IVSSEventHandler __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + IVSSEventHandler __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + IVSSEventHandler __RPC_FAR * This); + + HRESULT ( __stdcall __RPC_FAR *Init )( + IVSSEventHandler __RPC_FAR * This, + /* [in] */ IVSS __RPC_FAR *pIVSS); + + END_INTERFACE + } IVSSEventHandlerVtbl; + + interface IVSSEventHandler + { + CONST_VTBL struct IVSSEventHandlerVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IVSSEventHandler_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IVSSEventHandler_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IVSSEventHandler_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IVSSEventHandler_Init(This,pIVSS) \ + (This)->lpVtbl -> Init(This,pIVSS) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT __stdcall IVSSEventHandler_Init_Proxy( + IVSSEventHandler __RPC_FAR * This, + /* [in] */ IVSS __RPC_FAR *pIVSS); + + +void __RPC_STUB IVSSEventHandler_Init_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IVSSEventHandler_INTERFACE_DEFINED__ */ + + +EXTERN_C const CLSID CLSID_VSSItem; + +#ifdef __cplusplus + +class DECLSPEC_UUID("783CD4E3-9D54-11CF-B8EE-00608CC9A71F") +VSSItem; +#endif + +EXTERN_C const CLSID CLSID_VSSItems; + +#ifdef __cplusplus + +class DECLSPEC_UUID("783CD4F0-9D54-11CF-B8EE-00608CC9A71F") +VSSItems; +#endif + +EXTERN_C const CLSID CLSID_VSSVersions; + +#ifdef __cplusplus + +class DECLSPEC_UUID("783CD4F1-9D54-11CF-B8EE-00608CC9A71F") +VSSVersions; +#endif + +EXTERN_C const CLSID CLSID_VSSVersion; + +#ifdef __cplusplus + +class DECLSPEC_UUID("783CD4EC-9D54-11CF-B8EE-00608CC9A71F") +VSSVersion; +#endif + +EXTERN_C const CLSID CLSID_VSSCheckout; + +#ifdef __cplusplus + +class DECLSPEC_UUID("2A0DE0E0-2E9F-11D0-9236-00AA00A1EB95") +VSSCheckout; +#endif + +EXTERN_C const CLSID CLSID_VSSDatabase; + +#ifdef __cplusplus + +class DECLSPEC_UUID("783CD4E4-9D54-11CF-B8EE-00608CC9A71F") +VSSDatabase; +#endif + +EXTERN_C const CLSID CLSID_VSSUser; + +#ifdef __cplusplus + +class DECLSPEC_UUID("2A0DE0E5-2E9F-11D0-9236-00AA00A1EB95") +VSSUser; +#endif + +EXTERN_C const CLSID CLSID_VSSApp; + +#ifdef __cplusplus + +class DECLSPEC_UUID("2A0DE0E1-2E9F-11D0-9236-00AA00A1EB95") +VSSApp; +#endif +#endif /* __SourceSafeTypeLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ssphys/SSAPI/SSAPI.idl b/ssphys/SSAPI/SSAPI.idl new file mode 100644 index 0000000..3613bb5 --- /dev/null +++ b/ssphys/SSAPI/SSAPI.idl @@ -0,0 +1,650 @@ +// Generated .IDL file (by the OLE/COM Object Viewer) +import "oaidl.idl"; +// +// typelib filename: SSAPI.DLL + +[ + uuid(783CD4E0-9D54-11CF-B8EE-00608CC9A71F), + version(5.1), + helpstring("Microsoft SourceSafe 6.0 Type Library"), + helpfile("ssauto.hlp"), + helpcontext(00000000) +] +library SourceSafeTypeLib +{ + // TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046} + importlib("Stdole2.tlb"); + + // Forward declare all types defined in this typelib + interface IVSSItemOld; + interface IVSSItem; + interface IVSSVersions; + interface IVSSVersionOld; + interface IVSSVersion; + interface IVSSItems; + interface IVSSCheckouts; + interface IVSSCheckout; + interface IVSSDatabaseOld; + interface IVSSDatabase; + interface IVSSUser; + interface IVSSUsers; + interface IVSSEventsOld; + interface IVSSEvents; + interface IVSS; + interface IVSSEventHandler; + + typedef [uuid(783CD4EF-9D54-11CF-B8EE-00608CC9A71F), helpstring("SourceSafe operation flags")] + enum { + VSSFLAG_USERRONO = 1, + VSSFLAG_USERROYES = 2, + VSSFLAG_TIMENOW = 4, + VSSFLAG_TIMEMOD = 8, + VSSFLAG_TIMEUPD = 12, + VSSFLAG_EOLCR = 16, + VSSFLAG_EOLLF = 32, + VSSFLAG_EOLCRLF = 48, + VSSFLAG_REPASK = 64, + VSSFLAG_REPREPLACE = 128, + VSSFLAG_REPSKIP = 192, + VSSFLAG_REPMERGE = 256, + VSSFLAG_CMPFULL = 512, + VSSFLAG_CMPTIME = 1024, + VSSFLAG_CMPCHKSUM = 1536, + VSSFLAG_CMPFAIL = 2048, + VSSFLAG_RECURSNO = 4096, + VSSFLAG_RECURSYES = 8192, + VSSFLAG_FORCEDIRNO = 16384, + VSSFLAG_FORCEDIRYES = 32768, + VSSFLAG_KEEPNO = 65536, + VSSFLAG_KEEPYES = 131072, + VSSFLAG_DELNO = 262144, + VSSFLAG_DELYES = 524288, + VSSFLAG_DELNOREPLACE = 786432, + VSSFLAG_BINTEST = 1048576, + VSSFLAG_BINBINARY = 2097152, + VSSFLAG_BINTEXT = 3145728, + VSSFLAG_DELTAYES = 4194304, + VSSFLAG_DELTANO = 8388608, + VSSFLAG_UPDASK = 16777216, + VSSFLAG_UPDUPDATE = 33554432, + VSSFLAG_UPDUNCH = 50331648, + VSSFLAG_GETYES = 67108864, + VSSFLAG_GETNO = 134217728, + VSSFLAG_CHKEXCLUSIVEYES = 268435456, + VSSFLAG_CHKEXCLUSIVENO = 536870912, + VSSFLAG_HISTIGNOREFILES = 1073741824 + } VSSFlags; + + typedef [uuid(783CD4ED-9D54-11CF-B8EE-00608CC9A71F), helpstring("SourceSafe file checkout status")] + enum { + VSSFILE_NOTCHECKEDOUT = 0, + VSSFILE_CHECKEDOUT = 1, + VSSFILE_CHECKEDOUT_ME = 2 + } VSSFileStatus; + + typedef [uuid(783CD4EE-9D54-11CF-B8EE-00608CC9A71F), helpstring("SourceSafe item type")] + enum { + VSSITEM_PROJECT = 0, + VSSITEM_FILE = 1 + } VSSItemType; + + typedef [uuid(2A0DE0E6-2E9F-11D0-9236-00AA00A1EB95), helpstring("SourceSafe rights values")] + enum { + VSSRIGHTS_READ = 1, + VSSRIGHTS_CHKUPD = 2, + VSSRIGHTS_ADDRENREM = 4, + VSSRIGHTS_DESTROY = 8, + VSSRIGHTS_ALL = 15, + VSSRIGHTS_INHERITED = 16 + } VSSRights; + + [ + odl, + uuid(783CD4E1-9D54-11CF-B8EE-00608CC9A71F), + helpstring("SourceSafe item interface"), + dual, + oleautomation + ] + interface IVSSItemOld : IDispatch { + [id(0x00000001), propget] + HRESULT Spec([out, retval] BSTR* pSpec); + [id(0x00000002), propget] + HRESULT Binary([out, retval] VARIANT_BOOL* pbBinary); + [id(0x00000002), propput] + HRESULT Binary([in] VARIANT_BOOL pbBinary); + [id(0x00000003), propget] + HRESULT Deleted([out, retval] VARIANT_BOOL* pbDeleted); + [id(0x00000003), propput] + HRESULT Deleted([in] VARIANT_BOOL pbDeleted); + [id(0x00000004), propget] + HRESULT Type([out, retval] int* piType); + [id(0x00000005), propget] + HRESULT LocalSpec([out, retval] BSTR* pLocal); + [id(0x00000005), propput] + HRESULT LocalSpec([in] BSTR pLocal); + [id(0x00000006), propget] + HRESULT Name([out, retval] BSTR* pName); + [id(0x00000006), propput] + HRESULT Name([in] BSTR pName); + [id(0x00000007), propget] + HRESULT Parent([out, retval] IVSSItem** ppIParent); + [id(0x00000008), propget] + HRESULT VersionNumber([out, retval] long* piVersion); + [id(0x00000009), propget] + HRESULT Items( + [in, optional, defaultvalue(0)] VARIANT_BOOL IncludeDeleted, + [out, retval] IVSSItems** ppIItems); + [id(0x0000000a)] + HRESULT Get( +// [in, out, optional, defaultvalue("")] BSTR* Local, + [in, out, optional] BSTR* Local, + [in, optional, defaultvalue(0)] long iFlags); + [id(0x0000000b)] + HRESULT Checkout( + [in, optional, defaultvalue("")] BSTR Comment, + [in, optional, defaultvalue("")] BSTR Local, + [in, optional, defaultvalue(0)] long iFlags); + [id(0x0000000c)] + HRESULT Checkin( + [in, optional, defaultvalue("")] BSTR Comment, + [in, optional, defaultvalue("")] BSTR Local, + [in, optional, defaultvalue(0)] long iFlags); + [id(0x0000000d)] + HRESULT UndoCheckout( + [in, optional, defaultvalue("")] BSTR Local, + [in, optional, defaultvalue(0)] long iFlags); + [id(0x0000000e), propget] + HRESULT IsCheckedOut([out, retval] long* piStatus); + [id(0x0000000f), propget] + HRESULT Checkouts([out, retval] IVSSCheckouts** ppICheckouts); + [id(0x00000010), propget] + HRESULT IsDifferent( + [in, optional, defaultvalue("")] BSTR Local, + [out, retval] VARIANT_BOOL* pbDifferent); + [id(0x00000011)] + HRESULT Add( + [in] BSTR Local, + [in, optional, defaultvalue("")] BSTR Comment, + [in, optional, defaultvalue(0)] long iFlags, + [out, retval] IVSSItem** ppIItem); + [id(0x00000012)] + HRESULT NewSubproject( + [in] BSTR Name, + [in, optional, defaultvalue("")] BSTR Comment, + [out, retval] IVSSItem** ppIItem); + [id(0x00000013)] + HRESULT Share( + [in] IVSSItem* pIItem, + [in, optional, defaultvalue("")] BSTR Comment, + [in, optional, defaultvalue(0)] long iFlags); + [id(0x00000014)] + HRESULT Destroy(); + [id(0x00000015)] + HRESULT Move([in] IVSSItem* pINewParent); + [id(0x00000016)] + HRESULT Label( + [in] BSTR Label, + [in, optional, defaultvalue("")] BSTR Comment); + [id(0x00000017), propget] + HRESULT Versions( + [in, optional, defaultvalue(0)] long iFlags, + [out, retval] IVSSVersions** pIVersions); + [id(0x00000018), propget] + HRESULT Version( + [in, optional] VARIANT Version, + [out, retval] IVSSItem** ppIItem); + }; + + [ + odl, + uuid(2A0DE0E7-2E9F-11D0-9236-00AA00A1EB95), + helpstring("SourceSafe item interface"), + dual, + oleautomation + ] + interface IVSSItem : IVSSItemOld { + [id(0x00000019), propget] + HRESULT Links([out, retval] IVSSItems** ppIItems); + [id(0x0000001a)] + HRESULT Branch( + [in, optional, defaultvalue("")] BSTR Comment, + [in, optional, defaultvalue(0)] long iFlags, + [out, retval] IVSSItem** ppIItem); + }; + + [ + odl, + uuid(783CD4E7-9D54-11CF-B8EE-00608CC9A71F), + helpstring("SourceSafe versions collection"), + dual, + oleautomation + ] + interface IVSSVersions : IDispatch { + [id(0xfffffffc), restricted, hidden] + HRESULT _NewEnum([out, retval] IUnknown** ppIEnum); + }; + + [ + odl, + uuid(783CD4E8-9D54-11CF-B8EE-00608CC9A71F), + helpstring("SourceSafe version information"), + dual, + oleautomation + ] + interface IVSSVersionOld : IDispatch { + [id(0x00000001), propget] + HRESULT Username([out, retval] BSTR* pUsername); + [id(0x00000002), propget] + HRESULT VersionNumber([out, retval] long* piVersion); + [id(0x00000003), propget] + HRESULT Action([out, retval] BSTR* pAction); + [id(0x00000004), propget] + HRESULT Date([out, retval] DATE* pDate); + [id(0x00000005), propget] + HRESULT Comment([out, retval] BSTR* pComment); + [id(0x00000006), propget] + HRESULT Label([out, retval] BSTR* pLabel); + [id(0x00000007), propget] + HRESULT VSSItem([out, retval] IVSSItem** ppIItem); + }; + + [ + odl, + uuid(2A0DE0E9-2E9F-11D0-9236-00AA00A1EB95), + helpstring("SourceSafe version information"), + dual, + oleautomation + ] + interface IVSSVersion : IVSSVersionOld { + [id(0x00000008), propget] + HRESULT LabelComment([out, retval] BSTR* pComment); + }; + + [ + odl, + uuid(783CD4E5-9D54-11CF-B8EE-00608CC9A71F), + helpstring("SourceSafe items collection interface"), + dual, + oleautomation + ] + interface IVSSItems : IDispatch { + [id(0x00000001), propget] + HRESULT Count([out, retval] long* piCount); + [id(00000000), propget] + HRESULT Item( + [in] VARIANT sItem, + [out, retval] IVSSItem** ppIItem); + [id(0xfffffffc), restricted, hidden] + HRESULT _NewEnum([out, retval] IUnknown** ppIEnum); + }; + + [ + odl, + uuid(8903A770-F55F-11CF-9227-00AA00A1EB95), + helpstring("SourceSafe checkouts collection interface"), + dual, + oleautomation + ] + interface IVSSCheckouts : IDispatch { + [id(0x00000001), propget] + HRESULT Count([out, retval] long* piCount); + [id(00000000), propget] + HRESULT Item( + [in] VARIANT sItem, + [out, retval] IVSSCheckout** ppICheckout); + [id(0xfffffffc), restricted, hidden] + HRESULT _NewEnum([out, retval] IUnknown** ppIEnum); + }; + + [ + odl, + uuid(783CD4E6-9D54-11CF-B8EE-00608CC9A71F), + helpstring("SourceSafe checkouts interface"), + dual, + oleautomation + ] + interface IVSSCheckout : IDispatch { + [id(0x00000001), propget] + HRESULT Username([out, retval] BSTR* pUsername); + [id(0x00000002), propget] + HRESULT Date([out, retval] DATE* pDate); + [id(0x00000003), propget] + HRESULT LocalSpec([out, retval] BSTR* pLocal); + [id(0x00000004), propget] + HRESULT Machine([out, retval] BSTR* pMachine); + [id(0x00000005), propget] + HRESULT Project([out, retval] BSTR* pProject); + [id(0x00000006), propget] + HRESULT Comment([out, retval] BSTR* pComment); + [id(0x00000007), propget] + HRESULT VersionNumber([out, retval] long* piVersion); + }; + + [ + odl, + uuid(783CD4E2-9D54-11CF-B8EE-00608CC9A71F), + helpstring("SourceSafe database object interface"), + dual, + oleautomation + ] + interface IVSSDatabaseOld : IDispatch { + [id(0x00000001)] + HRESULT Open( + [in, optional, defaultvalue("")] BSTR SrcSafeIni, + [in, optional, defaultvalue("")] BSTR Username, + [in, optional, defaultvalue("")] BSTR Password); + [id(0x00000002), propget] + HRESULT SrcSafeIni([out, retval] BSTR* pSrcSafeIni); + [id(0x00000003), propget] + HRESULT DatabaseName([out, retval] BSTR* pDatabaseName); + [id(0x00000004), propget] + HRESULT Username([out, retval] BSTR* pUsername); + [id(0x00000005), propget] + HRESULT CurrentProject([out, retval] BSTR* pPrj); + [id(0x00000005), propput] + HRESULT CurrentProject([in] BSTR pPrj); + [id(0x00000006), propget] + HRESULT VSSItem( + [in] BSTR Spec, + [in, optional, defaultvalue(0)] VARIANT_BOOL Deleted, + [out, retval] IVSSItem** ppIVSSItem); + }; + + [ + odl, + uuid(2A0DE0E2-2E9F-11D0-9236-00AA00A1EB95), + helpstring("SourceSafe database object interface"), + dual, + oleautomation + ] + interface IVSSDatabase : IVSSDatabaseOld { + [id(0x00000007)] + HRESULT AddUser( + [in] BSTR User, + [in] BSTR Password, + [in] VARIANT_BOOL ReadOnly, + [out, retval] IVSSUser** ppIUser); + [id(0x00000008), propget] + HRESULT User( + [in] BSTR Name, + [out, retval] IVSSUser** ppIUser); + [id(0x00000009), propget] + HRESULT Users([out, retval] IVSSUsers** ppIUsers); + [id(0x0000000a), propget] + HRESULT ProjectRightsEnabled([out, retval] VARIANT_BOOL* pEnabled); + [id(0x0000000a), propput] + HRESULT ProjectRightsEnabled([in] VARIANT_BOOL pEnabled); + [id(0x0000000b), propget] + HRESULT DefaultProjectRights([out, retval] long* pRights); + [id(0x0000000b), propput] + HRESULT DefaultProjectRights([in] long pRights); + }; + + [ + odl, + uuid(2A0DE0E3-2E9F-11D0-9236-00AA00A1EB95), + helpstring("SourceSafe user object interface"), + dual, + oleautomation + ] + interface IVSSUser : IDispatch { + [id(0x00000001)] + HRESULT Delete(); + [id(0x00000002), propget] + HRESULT Name([out, retval] BSTR* pName); + [id(0x00000002), propput] + HRESULT Name([in] BSTR pName); + [id(0x00000003), propput] + HRESULT Password([in] BSTR rhs); + [id(0x00000004), propget] + HRESULT ReadOnly([out, retval] VARIANT_BOOL* pReadOnly); + [id(0x00000004), propput] + HRESULT ReadOnly([in] VARIANT_BOOL pReadOnly); + [id(0x00000005), propget] + HRESULT ProjectRights( + [in, optional, defaultvalue("$/")] BSTR Project, + [out, retval] long* piRightsOut); + [id(0x00000005), propput] + HRESULT ProjectRights( + [in, optional, defaultvalue("$/")] BSTR Project, + [in] long piRightsOut); + [id(0x00000006)] + HRESULT RemoveProjectRights([in] BSTR Project); + }; + + [ + odl, + uuid(2A0DE0E4-2E9F-11D0-9236-00AA00A1EB95), + helpstring("SourceSafe users collection interface"), + dual, + oleautomation + ] + interface IVSSUsers : IDispatch { + [id(0x00000001), propget] + HRESULT Count([out, retval] long* piCount); + [id(00000000), propget] + HRESULT Item( + [in] VARIANT sItem, + [out, retval] IVSSUser** ppIUser); + [id(0xfffffffc), restricted, hidden] + HRESULT _NewEnum([out, retval] IUnknown** ppIEnum); + }; + + [ + uuid(783CD4E3-9D54-11CF-B8EE-00608CC9A71F), + noncreatable + ] + coclass VSSItem { + [default] interface IVSSItem; + interface IVSSItemOld; + }; + + [ + uuid(783CD4F0-9D54-11CF-B8EE-00608CC9A71F), + noncreatable + ] + coclass VSSItems { + [default] interface IVSSItems; + }; + + [ + uuid(783CD4F1-9D54-11CF-B8EE-00608CC9A71F), + helpstring("VSSVersions Class") + ] + coclass VSSVersions + { + [default] interface IVSSVersions; + }; + + [ + uuid(783CD4EC-9D54-11CF-B8EE-00608CC9A71F), + noncreatable + ] + coclass VSSVersion { + [default] interface IVSSVersion; + }; + + [ + uuid(2A0DE0E0-2E9F-11D0-9236-00AA00A1EB95), + noncreatable + ] + coclass VSSCheckout { + [default] interface IVSSCheckout; + }; + + [ + uuid(783CD4E4-9D54-11CF-B8EE-00608CC9A71F) + ] + coclass VSSDatabase { + [default] interface IVSSDatabase; + interface IVSSDatabaseOld; + }; + + [ + uuid(2A0DE0E5-2E9F-11D0-9236-00AA00A1EB95), + noncreatable + ] + coclass VSSUser { + [default] interface IVSSUser; + }; + + [ + odl, + uuid(783CD4E9-9D54-11CF-B8EE-00608CC9A71F), + helpstring("SourceSafe event interface") + ] + interface IVSSEventsOld : IUnknown { + HRESULT _stdcall BeforeAdd( + [in] IVSSItem* pIPrj, + [in] BSTR Local, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterAdd( + [in] IVSSItem* pIItem, + [in] BSTR Local); + HRESULT _stdcall BeforeCheckout( + [in] IVSSItem* pIItem, + [in] BSTR Local, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterCheckout( + [in] IVSSItem* pIItem, + [in] BSTR Local); + HRESULT _stdcall BeforeCheckin( + [in] IVSSItem* pIItem, + [in] BSTR Local, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterCheckin( + [in] IVSSItem* pIItem, + [in] BSTR Local); + HRESULT _stdcall BeforeUndoCheckout( + [in] IVSSItem* pIItem, + [in] BSTR Local, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterUndoCheckout( + [in] IVSSItem* pIItem, + [in] BSTR Local); + HRESULT _stdcall BeforeRename( + [in] IVSSItem* pIItem, + [in] BSTR NewName, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterRename( + [in] IVSSItem* pIItem, + [in] BSTR OldName); + HRESULT _stdcall BeforeBranch( + [in] IVSSItem* pIItem, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterBranch([in] IVSSItem* pIItem); + HRESULT _stdcall BeforeEvent( + [in] long iEvent, + [in] IVSSItem* pIItem, + [in] BSTR Str, + [in] VARIANT var, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterEvent( + [in] long iEvent, + [in] IVSSItem* pIItem, + [in] BSTR Str, + [in] VARIANT var); + }; + + [ + odl, + uuid(2A0DE0E8-2E9F-11D0-9236-00AA00A1EB95), + helpstring("SourceSafe event interface") + ] + interface IVSSEvents : IUnknown { + HRESULT _stdcall BeforeAdd( + [in] IVSSItem* pIPrj, + [in] BSTR Local, + [in] BSTR Comment, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterAdd( + [in] IVSSItem* pIItem, + [in] BSTR Local, + [in] BSTR Comment); + HRESULT _stdcall BeforeCheckout( + [in] IVSSItem* pIItem, + [in] BSTR Local, + [in] BSTR Comment, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterCheckout( + [in] IVSSItem* pIItem, + [in] BSTR Local, + [in] BSTR Comment); + HRESULT _stdcall BeforeCheckin( + [in] IVSSItem* pIItem, + [in] BSTR Local, + [in] BSTR Comment, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterCheckin( + [in] IVSSItem* pIItem, + [in] BSTR Local, + [in] BSTR Comment); + HRESULT _stdcall BeforeUndoCheckout( + [in] IVSSItem* pIItem, + [in] BSTR Local, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterUndoCheckout( + [in] IVSSItem* pIItem, + [in] BSTR Local); + HRESULT _stdcall BeforeRename( + [in] IVSSItem* pIItem, + [in] BSTR NewName, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterRename( + [in] IVSSItem* pIItem, + [in] BSTR OldName); + HRESULT _stdcall BeforeBranch( + [in] IVSSItem* pIItem, + [in] BSTR Comment, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterBranch( + [in] IVSSItem* pIItem, + [in] BSTR Comment); + HRESULT _stdcall BeginCommand( + [in] long unused, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall EndCommand([in] long unused); + HRESULT _stdcall BeforeEvent( + [in] long iEvent, + [in] IVSSItem* pIItem, + [in] BSTR Str, + [in] VARIANT var, + [out, retval] VARIANT_BOOL* pbContinue); + HRESULT _stdcall AfterEvent( + [in] long iEvent, + [in] IVSSItem* pIItem, + [in] BSTR Str, + [in] VARIANT var); + }; + + [ + odl, + uuid(783CD4EB-9D54-11CF-B8EE-00608CC9A71F), + helpstring("SourceSafe application interface"), + dual, + oleautomation + ] + interface IVSS : IDispatch { + [id(0x00000001), propget] + HRESULT VSSDatabase([out, retval] IVSSDatabase** ppIVSSDatabase); + }; + + [ + odl, + uuid(783CD4EA-9D54-11CF-B8EE-00608CC9A71F), + helpstring("SourceSafe event interface") + ] + interface IVSSEventHandler : IUnknown { + HRESULT _stdcall Init([in] IVSS* pIVSS); + }; + + [ + uuid(2A0DE0E1-2E9F-11D0-9236-00AA00A1EB95), + noncreatable + ] + coclass VSSApp { + [default] interface IVSS; + [default, source] interface IVSSEvents; + [source] interface IVSSEventsOld; + }; +}; diff --git a/ssphys/SSAPI/SSAPI.rc b/ssphys/SSAPI/SSAPI.rc new file mode 100644 index 0000000..5ef85bb --- /dev/null +++ b/ssphys/SSAPI/SSAPI.rc @@ -0,0 +1,130 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// German (Germany) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) +#ifdef _WIN32 +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""SSAPI.tlb""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "SSAPI Module\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SSAPI\0" + VALUE "LegalCopyright", "Copyright 2005\0" + VALUE "OriginalFilename", "SSAPI.DLL\0" + VALUE "ProductName", "SSAPI Module\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "OLESelfRegister", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_VSSAPP REGISTRY DISCARDABLE "VSSApp.rgs" +IDR_VSSDATABASE REGISTRY DISCARDABLE "VSSDatabase.rgs" +IDR_VSSITEM REGISTRY DISCARDABLE "VSSItem.rgs" +IDR_VSSITEMS REGISTRY DISCARDABLE "VSSItems.rgs" +IDR_VSSVERSIONS REGISTRY DISCARDABLE "VSSVersions.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "SSAPI" + IDS_VSSAPP_DESC "VSSApp Class" + IDS_VSSDATABASE_DESC "VSSDatabase Class" +END + +#endif // German (Germany) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "SSAPI.tlb" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/ssphys/SSAPI/SSAPIps.def b/ssphys/SSAPI/SSAPIps.def new file mode 100644 index 0000000..421252c --- /dev/null +++ b/ssphys/SSAPI/SSAPIps.def @@ -0,0 +1,11 @@ + +LIBRARY "SSAPIPS" + +DESCRIPTION 'Proxy/Stub DLL' + +EXPORTS + DllGetClassObject @1 PRIVATE + DllCanUnloadNow @2 PRIVATE + GetProxyDllInfo @3 PRIVATE + DllRegisterServer @4 PRIVATE + DllUnregisterServer @5 PRIVATE diff --git a/ssphys/SSAPI/SSAPIps.mk b/ssphys/SSAPI/SSAPIps.mk new file mode 100644 index 0000000..0d8de2d --- /dev/null +++ b/ssphys/SSAPI/SSAPIps.mk @@ -0,0 +1,16 @@ + +SSAPIps.dll: dlldata.obj SSAPI_p.obj SSAPI_i.obj + link /dll /out:SSAPIps.dll /def:SSAPIps.def /entry:DllMain dlldata.obj SSAPI_p.obj SSAPI_i.obj \ + kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \ + +.c.obj: + cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \ + $< + +clean: + @del SSAPIps.dll + @del SSAPIps.lib + @del SSAPIps.exp + @del dlldata.obj + @del SSAPI_p.obj + @del SSAPI_i.obj diff --git a/ssphys/SSAPI/StdAfx.cpp b/ssphys/SSAPI/StdAfx.cpp new file mode 100644 index 0000000..b39052a --- /dev/null +++ b/ssphys/SSAPI/StdAfx.cpp @@ -0,0 +1,12 @@ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#include +#endif + +#include diff --git a/ssphys/SSAPI/StdAfx.h b/ssphys/SSAPI/StdAfx.h new file mode 100644 index 0000000..7f03713 --- /dev/null +++ b/ssphys/SSAPI/StdAfx.h @@ -0,0 +1,32 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__5EE013C3_C4F7_410D_94DA_6D31DED1F5D2__INCLUDED_) +#define AFX_STDAFX_H__5EE013C3_C4F7_410D_94DA_6D31DED1F5D2__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define STRICT +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif +#define _ATL_APARTMENT_THREADED + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include + +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__5EE013C3_C4F7_410D_94DA_6D31DED1F5D2__INCLUDED) diff --git a/ssphys/SSAPI/VSSApp.cpp b/ssphys/SSAPI/VSSApp.cpp new file mode 100644 index 0000000..71aedd5 --- /dev/null +++ b/ssphys/SSAPI/VSSApp.cpp @@ -0,0 +1,15 @@ +// VSSAPP.cpp : Implementation of CVSS +#include "stdafx.h" +#include "SSAPI.h" +#include "VSSApp.h" + +///////////////////////////////////////////////////////////////////////////// +// CVSS + + +STDMETHODIMP CVSSApp::get_VSSDatabase(IVSSDatabase **pVal) +{ + // TODO: Add your implementation code here + + return S_OK; +} diff --git a/ssphys/SSAPI/VSSApp.h b/ssphys/SSAPI/VSSApp.h new file mode 100644 index 0000000..ede7db5 --- /dev/null +++ b/ssphys/SSAPI/VSSApp.h @@ -0,0 +1,35 @@ +// VSSApp.h : Declaration of the CVSSApp + +#ifndef __VSSAPP_H_ +#define __VSSAPP_H_ + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CVSSApp +class ATL_NO_VTABLE CVSSApp : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CVSSApp() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_VSSAPP) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CVSSApp) + COM_INTERFACE_ENTRY(IVSS) +//DEL COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY2(IDispatch, IVSS) +END_COM_MAP() + +// IVSS +public: + STDMETHOD(get_VSSDatabase)(/*[out, retval]*/ IVSSDatabase* *pVal); +}; + +#endif //__VSSAPP_H_ diff --git a/ssphys/SSAPI/VSSApp.rgs b/ssphys/SSAPI/VSSApp.rgs new file mode 100644 index 0000000..3db196e --- /dev/null +++ b/ssphys/SSAPI/VSSApp.rgs @@ -0,0 +1,26 @@ +HKCR +{ + SSAPI.VSSApp.1 = s 'VSSApp Class' + { + CLSID = s '{37FECF37-ACF3-4F75-8D15-E6053847B20D}' + } + SSAPI.VSSApp = s 'VSSApp Class' + { + CLSID = s '{37FECF37-ACF3-4F75-8D15-E6053847B20D}' + CurVer = s 'SSAPI.VSSApp.1' + } + NoRemove CLSID + { + ForceRemove {37FECF37-ACF3-4F75-8D15-E6053847B20D} = s 'VSSApp Class' + { + ProgID = s 'SSAPI.VSSApp.1' + VersionIndependentProgID = s 'SSAPI.VSSApp' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{ACE602F2-0901-4C05-B2C9-DA376C633A25}' + } + } +} diff --git a/ssphys/SSAPI/VSSDatabase.cpp b/ssphys/SSAPI/VSSDatabase.cpp new file mode 100644 index 0000000..2e32d54 --- /dev/null +++ b/ssphys/SSAPI/VSSDatabase.cpp @@ -0,0 +1,135 @@ +// VSSDatabase.cpp : Implementation of CVSSDatabase +#include "stdafx.h" +#include "SSAPI.h" +#include "VSSDatabase.h" +#include "VSSItem.h" +#include "atlconv.h" +#include "ssauterr.h" + +///////////////////////////////////////////////////////////////////////////// +// CVSSDatabase + +STDMETHODIMP CVSSDatabase::Open(BSTR SrcSafeIni, BSTR Username, BSTR Password) +{ + ATLASSERT (SrcSafeIni); + ATLASSERT (Username); + ATLASSERT (Password); + _bstr_t _SrcSafeIni (SrcSafeIni); + _bstr_t _Username (Username); + _bstr_t _Password (Password); + ATLTRACE (_T("CVSSDatabase::Open(BSTR %s, BSTR %s, BSTR %s"), (LPCTSTR)_SrcSafeIni, (LPCTSTR)_Username, (LPCTSTR)_Password); + + if (!m_Database.Open ((LPCTSTR)_SrcSafeIni, (LPCTSTR)_Username, (LPCTSTR)_Password)) + return E_FAIL; + + return NO_ERROR; +} + +STDMETHODIMP CVSSDatabase::get_SrcSafeIni (BSTR * pSrcSafeIni) +{ + if (pSrcSafeIni == NULL) + return E_POINTER; + + _bstr_t srcSafeIni = m_Database.GetSrcSafeIni ().c_str(); + *pSrcSafeIni = srcSafeIni.copy(); + + return NO_ERROR; +} +STDMETHODIMP CVSSDatabase::get_DatabaseName (BSTR * pDatabaseName) +{ + if (pDatabaseName == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +STDMETHODIMP CVSSDatabase::get_Username (BSTR * pUsername) +{ + if (pUsername == NULL) + return E_POINTER; + + _bstr_t srcSafeIni = m_Database.GetUsername ().c_str(); + *pUsername = srcSafeIni.copy(); + + return NO_ERROR; +} +STDMETHODIMP CVSSDatabase::get_CurrentProject (BSTR * pPrj) +{ + if (pPrj == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +STDMETHODIMP CVSSDatabase::put_CurrentProject (BSTR pPrj) +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSDatabase::get_VSSItem (BSTR Spec, VARIANT_BOOL Deleted, IVSSItem * * ppIVSSItem) +{ + if (ppIVSSItem == NULL) + return E_POINTER; + + if (!m_Database.IsOpen ()) + return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NULL, 11251); + + USES_CONVERSION; + SSItem* pItem = m_Database.GetSSItem (OLE2CA(Spec), Deleted); + if (!pItem) + return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NULL, ESS_VS_NOT_FOUND); + + CComObject* pVssItem; + HRESULT hRes = CComObject::CreateInstance(&pVssItem); + if (FAILED(hRes)) + return hRes; + + pVssItem->AddRef(); + pVssItem->Init (pItem); + + *ppIVSSItem = pVssItem; + + return NO_ERROR; +} + + +STDMETHODIMP CVSSDatabase::get_ProjectRightsEnabled (VARIANT_BOOL * pEnabled) +{ + if (pEnabled == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +STDMETHODIMP CVSSDatabase::put_ProjectRightsEnabled (VARIANT_BOOL pEnabled) +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSDatabase::get_DefaultProjectRights (LONG * pRights) +{ + if (pRights == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +STDMETHODIMP CVSSDatabase::put_DefaultProjectRights (LONG pRights) +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSDatabase::AddUser (BSTR User, BSTR Password, VARIANT_BOOL ReadOnly, IVSSUser * * ppIUser) +{ + if (ppIUser == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +STDMETHODIMP CVSSDatabase::get_User (BSTR Name, IVSSUser * * ppIUser) +{ + if (ppIUser == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +STDMETHODIMP CVSSDatabase::get_Users (IVSSUsers * * ppIUsers) +{ + if (ppIUsers == NULL) + return E_POINTER; + + return E_NOTIMPL; +} diff --git a/ssphys/SSAPI/VSSDatabase.h b/ssphys/SSAPI/VSSDatabase.h new file mode 100644 index 0000000..49f8ebd --- /dev/null +++ b/ssphys/SSAPI/VSSDatabase.h @@ -0,0 +1,54 @@ +// VSSDatabase.h : Declaration of the CVSSDatabase + +#ifndef __VSSDATABASE_H_ +#define __VSSDATABASE_H_ + +#include "resource.h" // main symbols +#include + +///////////////////////////////////////////////////////////////////////////// +// CVSSDatabase +class ATL_NO_VTABLE CVSSDatabase : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CVSSDatabase() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_VSSDATABASE) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CVSSDatabase) +//DEL COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY2(IDispatch, IVSSDatabase) + COM_INTERFACE_ENTRY(IVSSDatabase) +END_COM_MAP() + +public: +// IVSSDatabase + STDMETHOD(get_ProjectRightsEnabled)(VARIANT_BOOL * pEnabled); + STDMETHOD(put_ProjectRightsEnabled)(VARIANT_BOOL pEnabled); + STDMETHOD(get_DefaultProjectRights)(LONG * pRights); + STDMETHOD(put_DefaultProjectRights)(LONG pRights); + STDMETHOD(AddUser)(BSTR User, BSTR Password, VARIANT_BOOL ReadOnly, IVSSUser * * ppIUser); + STDMETHOD(get_User)(BSTR Name, IVSSUser * * ppIUser); + STDMETHOD(get_Users)(IVSSUsers * * ppIUsers); + +// IVSSDatabaseOld + STDMETHOD(Open)(BSTR SrcSafeIni, BSTR Username, BSTR Password); + STDMETHOD(get_SrcSafeIni)(BSTR * pSrcSafeIni); + STDMETHOD(get_DatabaseName)(BSTR * pDatabaseName); + STDMETHOD(get_Username)(BSTR * pUsername); + STDMETHOD(get_CurrentProject)(BSTR * pPrj); + STDMETHOD(put_CurrentProject)(BSTR pPrj); + STDMETHOD(get_VSSItem)(BSTR Spec, VARIANT_BOOL Deleted, IVSSItem * * ppIVSSItem); + +private: + SSDatabase m_Database; +}; + +#endif //__VSSDATABASE_H_ diff --git a/ssphys/SSAPI/VSSDatabase.rgs b/ssphys/SSAPI/VSSDatabase.rgs new file mode 100644 index 0000000..3338598 --- /dev/null +++ b/ssphys/SSAPI/VSSDatabase.rgs @@ -0,0 +1,25 @@ +HKCR +{ + SSAPI.VSSDatabase.1 = s 'VSSDatabase Class' + { + CLSID = s '{783CD4E4-9D54-11CF-B8EE-00608CC9A71F}' + } + SSAPI.VSSDatabase = s 'VSSDatabase Class' + { + CLSID = s '{783CD4E4-9D54-11CF-B8EE-00608CC9A71F}' + CurVer = s 'SSAPI.VSSDatabase.1' + } + NoRemove CLSID + { + ForceRemove {783CD4E4-9D54-11CF-B8EE-00608CC9A71F} = s 'VSSDatabase Class' + { + ProgID = s 'SSAPI.VSSDatabase.1' + VersionIndependentProgID = s 'SSAPI.VSSDatabase' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + } + 'TypeLib' = s '{783CD4E0-9D54-11CF-B8EE-00608CC9A71F}' + } + } +} diff --git a/ssphys/SSAPI/VSSItem.cpp b/ssphys/SSAPI/VSSItem.cpp new file mode 100644 index 0000000..a4ae2bd --- /dev/null +++ b/ssphys/SSAPI/VSSItem.cpp @@ -0,0 +1,234 @@ +// VSSItem.cpp : Implementation of CVSSItem +#include "stdafx.h" +#include "SSAPI.h" +#include "VSSItem.h" +#include "VSSItems.h" +#include "VSSVersions.h" + +///////////////////////////////////////////////////////////////////////////// +// CVSSItem + +STDMETHODIMP CVSSItem::get_Spec (BSTR * pSpec) +{ + if (pSpec == NULL) + return E_POINTER; + + ATLASSERT (m_pSSItem); + *pSpec = _bstr_t (m_pSSItem->GetSpec().c_str ()).copy (); + + return NO_ERROR; +} +STDMETHODIMP CVSSItem::get_Binary (VARIANT_BOOL * pbBinary) +{ + if (pbBinary == NULL) + return E_POINTER; + + ATLASSERT (m_pSSItem); + *pbBinary = _variant_t (m_pSSItem->GetBinary()); + + return NO_ERROR; +} +STDMETHODIMP CVSSItem::put_Binary (VARIANT_BOOL pbBinary) +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::get_Deleted (VARIANT_BOOL * pbDeleted) +{ + if (pbDeleted == NULL) + return E_POINTER; + + ATLASSERT (m_pSSItem); + *pbDeleted = _variant_t (m_pSSItem->GetDeleted()); + + return NO_ERROR; +} +STDMETHODIMP CVSSItem::put_Deleted (VARIANT_BOOL pbDeleted) +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::get_Type (INT * piType) +{ + if (piType == NULL) + return E_POINTER; + + ATLASSERT (m_pSSItem); + *piType = m_pSSItem->GetType() == SSITEM_FILE ? VSSITEM_FILE : VSSITEM_PROJECT; + + return NO_ERROR; +} +STDMETHODIMP CVSSItem::get_LocalSpec (BSTR * pLocal) +{ + if (pLocal == NULL) + return E_POINTER; + + ATLASSERT (m_pSSItem); + *pLocal = _bstr_t (m_pSSItem->GetLocalSpec().c_str()).copy (); + + return NO_ERROR; +} +STDMETHODIMP CVSSItem::put_LocalSpec (BSTR pLocal) +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::get_Name (BSTR * pName) +{ + if (pName == NULL) + return E_POINTER; + + ATLASSERT (m_pSSItem); + *pName = _bstr_t (m_pSSItem->GetName().c_str()).copy (); + + return NO_ERROR; +} +STDMETHODIMP CVSSItem::put_Name (BSTR pName) +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::get_Parent (IVSSItem * * ppIParent) +{ + if (ppIParent == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::get_VersionNumber (LONG * piVersion) +{ + if (piVersion == NULL) + return E_POINTER; + + ATLASSERT (m_pSSItem); + *piVersion = _variant_t (m_pSSItem->GetVersionNumber()); + + return NO_ERROR; +} +STDMETHODIMP CVSSItem::get_Items (VARIANT_BOOL IncludeDeleted, IVSSItems * * ppIItems) +{ + if (ppIItems == NULL) + return E_POINTER; + + ATLASSERT (m_pSSItem); + SSItems* pItems = m_pSSItem->GetItems (IncludeDeleted); + + CComObject* pVssItems; + HRESULT hRes = CComObject::CreateInstance(&pVssItems); + if (FAILED(hRes)) + return hRes; + + pVssItems->AddRef(); + pVssItems->Init (pItems); + + *ppIItems = pVssItems; + + return NO_ERROR; +} +STDMETHODIMP CVSSItem::Get (BSTR * Local, LONG iFlags) +{ + if (Local == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::Checkout (BSTR Comment, BSTR Local, LONG iFlags) +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::Checkin (BSTR Comment, BSTR Local, LONG iFlags) +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::UndoCheckout (BSTR Local, LONG iFlags) +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::get_IsCheckedOut (LONG * piStatus) +{ + if (piStatus == NULL) + return E_POINTER; + + ATLASSERT (m_pSSItem); + *piStatus = _variant_t (m_pSSItem->GetIsCheckedOut()); + + return NO_ERROR; +} +STDMETHODIMP CVSSItem::get_Checkouts (IVSSCheckouts * * ppICheckouts) +{ + if (ppICheckouts == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::get_IsDifferent (BSTR Local, VARIANT_BOOL * pbDifferent) +{ + if (pbDifferent == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::Add (BSTR Local, BSTR Comment, LONG iFlags, IVSSItem * * ppIItem) +{ + if (ppIItem == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::NewSubproject (BSTR Name, BSTR Comment, IVSSItem * * ppIItem) +{ + if (ppIItem == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::Share (IVSSItem * pIItem, BSTR Comment, LONG iFlags) +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::Destroy () +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::Move (IVSSItem * pINewParent) +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::Label (BSTR Label, BSTR Comment) +{ + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::get_Versions (LONG iFlags, IVSSVersions * * pIVersions) +{ + if (pIVersions == NULL) + return E_POINTER; + + CComObject* pVssVersions; + HRESULT hRes = CComObject::CreateInstance(&pVssVersions); + if (FAILED(hRes)) + return hRes; + + pVssVersions->AddRef(); + + *pIVersions = pVssVersions; + + return NO_ERROR; +} +STDMETHODIMP CVSSItem::get_Version (VARIANT Version, IVSSItem * * ppIItem) +{ + if (ppIItem == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +// IVSSItem +STDMETHODIMP CVSSItem::get_Links (IVSSItems * * ppIItems) +{ + if (ppIItems == NULL) + return E_POINTER; + + return E_NOTIMPL; +} +STDMETHODIMP CVSSItem::Branch (BSTR Comment, LONG iFlags, IVSSItem * * ppIItem) +{ + if (ppIItem == NULL) + return E_POINTER; + + return E_NOTIMPL; +} diff --git a/ssphys/SSAPI/VSSItem.h b/ssphys/SSAPI/VSSItem.h new file mode 100644 index 0000000..11da827 --- /dev/null +++ b/ssphys/SSAPI/VSSItem.h @@ -0,0 +1,79 @@ +// VSSItem.h : Declaration of the CVSSItem + +#ifndef __VSSITEM_H_ +#define __VSSITEM_H_ + +#include "resource.h" // main symbols +#include + +///////////////////////////////////////////////////////////////////////////// +// CVSSItem +class ATL_NO_VTABLE CVSSItem : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CVSSItem() + : m_pSSItem (NULL) + { + } + + void Init (SSItem* pItem) + { + m_pSSItem = pItem; + } + +private: + SSItem* m_pSSItem; + +public: +DECLARE_REGISTRY_RESOURCEID(IDR_VSSITEM) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CVSSItem) +//DEL COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY2(IDispatch, IVSSItem) + COM_INTERFACE_ENTRY(IVSSItem) +END_COM_MAP() + +// IVSSItem +public: +// IVSSItemOld + STDMETHOD(get_Spec)(BSTR * pSpec); + STDMETHOD(get_Binary)(VARIANT_BOOL * pbBinary); + STDMETHOD(put_Binary)(VARIANT_BOOL pbBinary); + STDMETHOD(get_Deleted)(VARIANT_BOOL * pbDeleted); + STDMETHOD(put_Deleted)(VARIANT_BOOL pbDeleted); + STDMETHOD(get_Type)(INT * piType); + STDMETHOD(get_LocalSpec)(BSTR * pLocal); + STDMETHOD(put_LocalSpec)(BSTR pLocal); + STDMETHOD(get_Name)(BSTR * pName); + STDMETHOD(put_Name)(BSTR pName); + STDMETHOD(get_Parent)(IVSSItem * * ppIParent); + STDMETHOD(get_VersionNumber)(LONG * piVersion); + STDMETHOD(get_Items)(VARIANT_BOOL IncludeDeleted, IVSSItems * * ppIItems); + STDMETHOD(Get)(BSTR * Local, LONG iFlags); + STDMETHOD(Checkout)(BSTR Comment, BSTR Local, LONG iFlags); + STDMETHOD(Checkin)(BSTR Comment, BSTR Local, LONG iFlags); + STDMETHOD(UndoCheckout)(BSTR Local, LONG iFlags); + STDMETHOD(get_IsCheckedOut)(LONG * piStatus); + STDMETHOD(get_Checkouts)(IVSSCheckouts * * ppICheckouts); + STDMETHOD(get_IsDifferent)(BSTR Local, VARIANT_BOOL * pbDifferent); + STDMETHOD(Add)(BSTR Local, BSTR Comment, LONG iFlags, IVSSItem * * ppIItem); + STDMETHOD(NewSubproject)(BSTR Name, BSTR Comment, IVSSItem * * ppIItem); + STDMETHOD(Share)(IVSSItem * pIItem, BSTR Comment, LONG iFlags); + STDMETHOD(Destroy)(); + STDMETHOD(Move)(IVSSItem * pINewParent); + STDMETHOD(Label)(BSTR Label, BSTR Comment); + STDMETHOD(get_Versions)(LONG iFlags, IVSSVersions * * pIVersions); + STDMETHOD(get_Version)(VARIANT Version, IVSSItem * * ppIItem); + +// IVSSItem + STDMETHOD(get_Links)(IVSSItems * * ppIItems); + STDMETHOD(Branch)(BSTR Comment, LONG iFlags, IVSSItem * * ppIItem); + +}; + +#endif //__VSSITEM_H_ diff --git a/ssphys/SSAPI/VSSItem.rgs b/ssphys/SSAPI/VSSItem.rgs new file mode 100644 index 0000000..38681d7 --- /dev/null +++ b/ssphys/SSAPI/VSSItem.rgs @@ -0,0 +1,26 @@ +HKCR +{ + SSAPI.VSSItem.1 = s 'VSSItem Class' + { + CLSID = s '{783CD4E3-9D54-11CF-B8EE-00608CC9A71F}' + } + SSAPI.VSSItem = s 'VSSItem Class' + { + CLSID = s '{783CD4E3-9D54-11CF-B8EE-00608CC9A71F}' + CurVer = s 'SSAPI.VSSItem.1' + } + NoRemove CLSID + { + ForceRemove {783CD4E3-9D54-11CF-B8EE-00608CC9A71F} = s 'VSSItem Class' + { + ProgID = s 'SSAPI.VSSItem.1' + VersionIndependentProgID = s 'SSAPI.VSSItem' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{783CD4E0-9D54-11CF-B8EE-00608CC9A71F}' + } + } +} diff --git a/ssphys/SSAPI/VSSItems.cpp b/ssphys/SSAPI/VSSItems.cpp new file mode 100644 index 0000000..a7d94c6 --- /dev/null +++ b/ssphys/SSAPI/VSSItems.cpp @@ -0,0 +1,48 @@ +// VSSItems.cpp : Implementation of CVSSItems +#include "stdafx.h" +#include "SSAPI.h" +#include "VSSItems.h" +#include "VSSItem.h" + +///////////////////////////////////////////////////////////////////////////// +// CVSSItems + +STDMETHODIMP CVSSItems::get_Count(LONG * piCount) +{ + if (piCount == NULL) + return E_POINTER; + + ATLASSERT (m_pSSItems); + *piCount = m_pSSItems->GetCount (); + + return NO_ERROR; +} +STDMETHODIMP CVSSItems::get_Item(VARIANT sItem, IVSSItem * * ppIItem) +{ + if (ppIItem == NULL) + return E_POINTER; + + ATLASSERT (m_pSSItems); + // starts counting with 1 + long count = _variant_t(sItem); + SSItem* pItem = m_pSSItems->GetItem (count - 1); + + CComObject* pVssItem; + HRESULT hRes = CComObject::CreateInstance(&pVssItem); + if (FAILED(hRes)) + return hRes; + + pVssItem->AddRef(); + pVssItem->Init (pItem); + + *ppIItem = pVssItem; + + return NO_ERROR; +} +STDMETHODIMP CVSSItems::_NewEnum(IUnknown * * ppIEnum) +{ + if (ppIEnum == NULL) + return E_POINTER; + + return E_NOTIMPL; +} diff --git a/ssphys/SSAPI/VSSItems.h b/ssphys/SSAPI/VSSItems.h new file mode 100644 index 0000000..27397cb --- /dev/null +++ b/ssphys/SSAPI/VSSItems.h @@ -0,0 +1,46 @@ +// VSSItems.h : Declaration of the CVSSItems + +#ifndef __VSSITEMS_H_ +#define __VSSITEMS_H_ + +#include "resource.h" // main symbols +#include + +///////////////////////////////////////////////////////////////////////////// +// CVSSItems +class ATL_NO_VTABLE CVSSItems : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CVSSItems() + : m_pSSItems (NULL) + { + } + + void Init (SSItems* pItems) + { + m_pSSItems = pItems; + } +private: + SSItems* m_pSSItems; + +public: +DECLARE_REGISTRY_RESOURCEID(IDR_VSSITEMS) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CVSSItems) + COM_INTERFACE_ENTRY(IVSSItems) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +public: +// IVSSItems + STDMETHOD(get_Count)(LONG * piCount); + STDMETHOD(get_Item)(VARIANT sItem, IVSSItem * * ppIItem); + STDMETHOD(_NewEnum)(IUnknown * * ppIEnum); +}; + +#endif //__VSSITEMS_H_ diff --git a/ssphys/SSAPI/VSSItems.rgs b/ssphys/SSAPI/VSSItems.rgs new file mode 100644 index 0000000..ec90422 --- /dev/null +++ b/ssphys/SSAPI/VSSItems.rgs @@ -0,0 +1,26 @@ +HKCR +{ + SSAPI.VSSItems.1 = s 'VSSItems Class' + { + CLSID = s '{656ABA1F-EA6F-43E3-9383-28DCDE381FFB}' + } + SSAPI.VSSItems = s 'VSSItems Class' + { + CLSID = s '{656ABA1F-EA6F-43E3-9383-28DCDE381FFB}' + CurVer = s 'SSAPI.VSSItems.1' + } + NoRemove CLSID + { + ForceRemove {656ABA1F-EA6F-43E3-9383-28DCDE381FFB} = s 'VSSItems Class' + { + ProgID = s 'SSAPI.VSSItems.1' + VersionIndependentProgID = s 'SSAPI.VSSItems' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{783CD4E0-9D54-11CF-B8EE-00608CC9A71F}' + } + } +} diff --git a/ssphys/SSAPI/VSSVersions.cpp b/ssphys/SSAPI/VSSVersions.cpp new file mode 100644 index 0000000..8afc68e --- /dev/null +++ b/ssphys/SSAPI/VSSVersions.cpp @@ -0,0 +1,23 @@ +// VSSVersions.cpp : Implementation of CVSSVersions +#include "stdafx.h" +#include "SSAPI.h" +#include "VSSVersions.h" + +///////////////////////////////////////////////////////////////////////////// +// CVSSVersions + +STDMETHODIMP CVSSVersions::_NewEnum (IUnknown * * ppIEnum) +{ + if (ppIEnum == NULL) + return E_POINTER; + +// CComQIPtr spEnum (this); +// HRESULT hRes = spEnum.CoCreateInstance(IID_IEnumVARIANT); +// if (FAILED(hRes)) +// return hRes; + + *ppIEnum = this->_GetRawUnknown(); + (*ppIEnum)->AddRef(); + + return NO_ERROR; +} diff --git a/ssphys/SSAPI/VSSVersions.h b/ssphys/SSAPI/VSSVersions.h new file mode 100644 index 0000000..4442309 --- /dev/null +++ b/ssphys/SSAPI/VSSVersions.h @@ -0,0 +1,61 @@ +// VSSVersions.h : Declaration of the CVSSVersions + +#ifndef __VSSVERSIONS_H_ +#define __VSSVERSIONS_H_ + +#include "resource.h" // main symbols +//#import "C:\WINDOWS\system32\Stdole2.tlb" raw_interfaces_only, raw_native_types, no_namespace, named_guids + +///////////////////////////////////////////////////////////////////////////// +// CVSSVersions +class ATL_NO_VTABLE CVSSVersions : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl, + public IEnumVARIANT +{ +public: + CVSSVersions() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_VSSVERSIONS) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CVSSVersions) + COM_INTERFACE_ENTRY(IVSSVersions) + COM_INTERFACE_ENTRY(IEnumVARIANT) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +public: +// IVSSVersions + STDMETHOD(_NewEnum)(IUnknown * * ppIEnum); + +// IEnumVARIANT + STDMETHOD(Next)(ULONG celt, VARIANT * rgvar, ULONG * pceltFetched) + { + if (pceltFetched == NULL) + return E_POINTER; + + return E_NOTIMPL; + } + STDMETHOD(Skip)(ULONG celt) + { + return E_NOTIMPL; + } + STDMETHOD(Reset)() + { + return E_NOTIMPL; + } + STDMETHOD(Clone)(IEnumVARIANT * * ppenum) + { + if (ppenum == NULL) + return E_POINTER; + + return E_NOTIMPL; + } +}; + +#endif //__VSSVERSIONS_H_ diff --git a/ssphys/SSAPI/VSSVersions.rgs b/ssphys/SSAPI/VSSVersions.rgs new file mode 100644 index 0000000..cd8f396 --- /dev/null +++ b/ssphys/SSAPI/VSSVersions.rgs @@ -0,0 +1,26 @@ +HKCR +{ + SSAPI.VSSVersions.1 = s 'VSSVersions Class' + { + CLSID = s '{27808E78-2421-452A-978A-9BE02035CD85}' + } + SSAPI.VSSVersions = s 'VSSVersions Class' + { + CLSID = s '{27808E78-2421-452A-978A-9BE02035CD85}' + CurVer = s 'SSAPI.VSSVersions.1' + } + NoRemove CLSID + { + ForceRemove {27808E78-2421-452A-978A-9BE02035CD85} = s 'VSSVersions Class' + { + ProgID = s 'SSAPI.VSSVersions.1' + VersionIndependentProgID = s 'SSAPI.VSSVersions' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{783CD4E0-9D54-11CF-B8EE-00608CC9A71F}' + } + } +} diff --git a/ssphys/SSAPI/dlldata.c b/ssphys/SSAPI/dlldata.c new file mode 100644 index 0000000..191617b --- /dev/null +++ b/ssphys/SSAPI/dlldata.c @@ -0,0 +1,38 @@ +/********************************************************* + DllData file -- generated by MIDL compiler + + DO NOT ALTER THIS FILE + + This file is regenerated by MIDL on every IDL file compile. + + To completely reconstruct this file, delete it and rerun MIDL + on all the IDL files in this DLL, specifying this file for the + /dlldata command line option + +*********************************************************/ + +#define PROXY_DELEGATION + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_PROXY_FILE( SSAPI ) + + +PROXYFILE_LIST_START +/* Start of list */ + REFERENCE_PROXY_FILE( SSAPI ), +/* End of list */ +PROXYFILE_LIST_END + + +DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) + +#ifdef __cplusplus +} /*extern "C" */ +#endif + +/* end of generated dlldata file */ diff --git a/ssphys/SSAPI/ssauterr.h b/ssphys/SSAPI/ssauterr.h new file mode 100644 index 0000000..e051970 --- /dev/null +++ b/ssphys/SSAPI/ssauterr.h @@ -0,0 +1,136 @@ +//***************************************************************************** +// ssauterr.h +// +// +// Copyright (c) 1995 by Microsoft Corporation, All Rights Reserved +//***************************************************************************** + +#define MAKEHR(iStat) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, (USHORT) (iStat)) + +#define ESS_CORRUPT MAKEHR(-10600) // File %s may be corrupt +#define ESS_DT_BADDATESTR MAKEHR(-10159) // Invalid date string: "%s" +#define ESS_DT_INVALID MAKEHR(-10161) // Invalid time or date string +#define ESS_NOMORE_HANDLES MAKEHR(-10164) // Too many file handles open. +#define ESS_FILE_ACCESSDENIED MAKEHR(-10165) // Access to file "%s" denied +#define ESS_FILE_BADDRIVE MAKEHR(-10166) // Invalid drive: %s +#define ESS_FILE_BADHANDLE MAKEHR(-10167) // Invalid handle. +#define ESS_FILE_BADNAME MAKEHR(-10168) // Invalid filename: "%s" +#define ESS_FILE_BADPARAM MAKEHR(-10170) // Invalid access code (bad parameter) +#define ESS_FILE_BADPATH MAKEHR(-10171) // Invalid DOS path: %s +#define ESS_FILE_CURRENTDIR MAKEHR(-10172) // Folder %s is in use +#define ESS_FILE_DISKFULL MAKEHR(-10173) // Disk full +#define ESS_FILE_EXISTS MAKEHR(-10175) // File "%s" already exists +#define ESS_FILE_LOCKED MAKEHR(-10176) // File "%s" is locked +#define ESS_FILE_NOTFOUND MAKEHR(-10178) // File "%s" not found +#define ESS_FILE_READ MAKEHR(-10180) // Error reading from file +#define ESS_FILE_SHARE MAKEHR(-10181) // File %s is already open +#define ESS_FILE_TOOMANY MAKEHR(-10182) // Too many file handles open +#define ESS_FILE_VOLNOTSAME MAKEHR(-10183) // Cannot rename to another volume +#define ESS_FILE_WRITE MAKEHR(-10184) // Error writing to file +#define ESS_INI_BADBOOL MAKEHR(-10200) // Initialization variable "%s" must be set to "Yes" or "No" +#define ESS_INI_BADLINE MAKEHR(-10201) // Invalid syntax on line %d of file %s +#define ESS_INI_BADNUMBER MAKEHR(-10202) // Initialization variable ""%s"" set to invalid number +#define ESS_INI_BADPATH MAKEHR(-10203) // Initialization variable ""%s"" set to invalid path +#define ESS_INI_BADVALUE MAKEHR(-10205) // Initialization variable ""%s"" set to invalid value +#define ESS_INI_NOSUCHVAR MAKEHR(-10206) // Cannot find initialization variable "%s" +#define ESS_INI_NUMRANGE MAKEHR(-10207) // Initialization variable "%s" must be between %d and %d +#define ESS_INI_TOO_MANY_ENV MAKEHR(-10208) // Too many SS.INI environment strings +#define ESS_LOCK_TIMEOUT MAKEHR(-10266) // Timeout locking file: %s +#define ESS_MEM_NOMEMORY MAKEHR(-10270) // Out of memory +#define ESS_NO_TWEAK_CHKDOUT MAKEHR(-10625) // You cannot modify the properties of a file that is checked out. +#define ESS_NOMERGE_BIN_NODELTA MAKEHR(-10279) // You cannot perform a merge on a binary file, or a file that stores latest version only. +#define ESS_NOMULTI_BINARY MAKEHR(-10280) // Cannot check out %s. It is binary and is already checked out. +#define ESS_NOMULTI_NODELTA MAKEHR(-10281) // %s stores only the latest version and is already checked out. +#define ESS_OS_NOT_EXE MAKEHR(-10285) // Error executing: %s +#define ESS_SS_ADDPRJASSOCFILE MAKEHR(-10626) // %s is a SourceSafe configuration file and cannot be added. +#define ESS_SS_ADMIN_LOCKOUT MAKEHR(-10456) // The SourceSafe database has been locked by the Administrator. +#define ESS_SS_BADRENAME MAKEHR(-10402) // Unable to rename %s to %s. +#define ESS_SS_CANT_FIND_SSINI MAKEHR(-10403) // Cannot find SS.INI file for user %s +#define ESS_SS_CHECKED_OUT MAKEHR(-10405) // File %s is currently checked out by %s +#define ESS_SS_CHECKED_OUT_YOU MAKEHR(-10406) // You currently have file %s checked out +#define ESS_SS_CHECKOUT_OLD MAKEHR(-10408) // Cannot check out an old version of a file +#define ESS_SS_CHKOUT_USER MAKEHR(-10413) // File %s is currently checked out by %s +#define ESS_SS_CONFLICTS MAKEHR(-10415) // An automatic merge has occurred and there are conflicts.\nEdit %s to resolve them. +#define ESS_SS_DEL_ROOT MAKEHR(-10418) // Cannot delete the root project +#define ESS_SS_DEL_SHARED MAKEHR(-10419) // A deleted link to %s already exists +#define ESS_SS_FILE_NOTFOUND MAKEHR(-10421) // File ""%s"" not found +#define ESS_SS_HISTOPEN MAKEHR(-10404) // A history operation is already in progress +#define ESS_SS_INSUFRIGHTS MAKEHR(-10423) // You do not have access rights to %s +#define ESS_SS_LATERCHKEDOUT MAKEHR(-10426) // A more recent version is checked out +#define ESS_SS_LOCALRW MAKEHR(-10427) // A writable copy of %s already exists +#define ESS_SS_MOVE_CHANGENAME MAKEHR(-10428) // Move does not change the name of a project +#define ESS_SS_MOVE_NOPARENT MAKEHR(-10429) // Project %s does not exist +#define ESS_SS_MOVE_ROOT MAKEHR(-10430) // Cannot move the root project +#define ESS_SS_MUST_USE_VERS MAKEHR(-10431) // Cannot roll back to the most recent version of %s +#define ESS_SS_NOCOMMANCESTOR MAKEHR(-10432) // Files have no common ancestor +#define ESS_SS_NOCONFLICTS2 MAKEHR(-10434) // %s has been merged with no conflicts. +#define ESS_SS_NODOLLAR MAKEHR(-10435) // File %s is invalid. Files may not begin with $. +#define ESS_SS_NOT_CHKEDOUT MAKEHR(-10436) // File %s is not checked out +#define ESS_SS_NOT_SHARED MAKEHR(-10437) // File %s is not shared by any other projects +#define ESS_SS_NOTSEPARATED MAKEHR(-10438) // Files are not branched +#define ESS_SS_OPEN_LOGGIN MAKEHR(-10457) // Unable to open user login file %s. +#define ESS_SS_PATHTOOLONG MAKEHR(-10439) // Path %s too long +#define ESS_SS_RENAME_MOVE MAKEHR(-10442) // Rename does not move an item to another project +#define ESS_SS_RENAME_ROOT MAKEHR(-10443) // Cannot Rename the root project +#define ESS_SS_ROLLBACK_NOTOLD MAKEHR(-10447) // Cannot Rollback to the most recent version of %s +#define ESS_SS_SHARE_ANCESTOR MAKEHR(-10449) // A project cannot be shared under a descendant. +#define ESS_SS_SHARED MAKEHR(-10450) // File %s is already shared by this project +#define ESS_SSPEC_SYNTAX MAKEHR(-10515) // Invalid SourceSafe syntax: "%s" +#define ESS_UM_BAD_CHAR MAKEHR(-10550) // Bad username syntax: "%s" +#define ESS_UM_BAD_PASSWORD MAKEHR(-10551) // Invalid password +#define ESS_UM_BADVERSION MAKEHR(-10552) // Incompatible database version +#define ESS_UM_DEL_ADMIN MAKEHR(-10553) // Cannot delete the Admin user +#define ESS_UM_PERM_DENIED MAKEHR(-10554) // Permission denied +#define ESS_UM_RENAME_ADMIN MAKEHR(-10555) // Can not rename the Admin user +#define ESS_UM_TOO_LONG MAKEHR(-10556) // Username too long +#define ESS_UM_USER_EXISTS MAKEHR(-10557) // User "%s" already exists +#define ESS_UM_USER_NOT_FOUND MAKEHR(-10558) // User "%s" not found +#define ESS_URL_BADPATH MAKEHR(-10192) // The URL for project %s was not set properly. +#define ESS_VS_CHECKED_OUT MAKEHR(-10601) // File %s checked out +#define ESS_VS_CHILD_NOT_FOUND MAKEHR(-10602) // Subproject or file not found +#define ESS_VS_COLLISION MAKEHR(-10603) // Collision accessing database, please try again. +#define ESS_VS_EXCLUSIVE_CHECKED_OUT MAKEHR(-10614) // File %s is exclusively checked out. +#define ESS_VS_ITEMEXISTS MAKEHR(-10604) // An item with the name %s already exists +#define ESS_VS_LONGNAME MAKEHR(-10605) // %s is an invalid %s name +#define ESS_VS_MOVE_CYCLE MAKEHR(-10606) // You can not move a project under itself +#define ESS_VS_NO_DELTA MAKEHR(-10607) // File %s does not retain old versions of itself +#define ESS_VS_NOT_CHECKED_OUT MAKEHR(-10608) // File %s cannot be checked into this project +#define ESS_VS_NOT_FOUND MAKEHR(-10609) // File or project not found +#define ESS_VS_PARENT_NOT_FOUND MAKEHR(-10610) // Parent not found +#define ESS_VS_VERS_NOT_FOUND MAKEHR(-10615) // Version not found +#define ESS_VS_WANT_FILE MAKEHR(-10616) // This command only works on files. +#define ESS_VS_WANT_PRJ MAKEHR(-10617) // This command only works on projects. +#define ESS_URL_BUFOVERFLOW MAKEHR(-10194) // A link in %s was ignored because it was longer than SourceSafe can understand +#define ESS_URL_CANTCHECKHTML MAKEHR(-10193) // An error occurred while trying to check hyperlinks for %s +#define ESS_SS_ADDINFAILED MAKEHR(-10440) // Error loading SourceSafe add-in: %s +#define ESS_CANCEL MAKEHR(-32766) +#define ESS_LOADSTRING_FAILED MAKEHR(-10999) // Error loading resource string + +// SourceSafe questions answered affirmatively. +// +// A deleted copy of this %s file already exists in this project.\nDo you want to recover the existing file? +// Folder %s not found, create? +// Have any conflicts in %s been properly resolved? +// File %s is currently checked out by %s.\nProceed anyway? +// File %s was checked out to folder %s.\nProceed in %s? +// File %s is checked out to project %s, and you are in %s.\nProceed anyway? +// File %s is currently checked out by %s. Delete anyway? +// You currently have file %s checked out. Delete anyway? +// An item named %s was already deleted from this project.\nPurge the old item and delete this one now? +// This version of %s already has a label: overwrite? +// The label %s is already used. Remove the old label? +// %s has been merged with no conflicts.\nCheck in now? +// Redo the automatic merge? +// Delete local file: %s? +// %s is already checked out, continue? +// File %s has been destroyed, and cannot be rebuilt.\nContinue anyway? +// Project $%s has been destroyed, and cannot be rebuilt.\nContinue anyway? +// $%s was moved out of this project, and cannot be rebuilt.\nContinue anyway? +// %s has changed. Undo check out and lose changes? +// +// SourceSafe questions answered in the negative. +// +// A deleted file of the same name already exists in this SourceSafe project.\nDo you want to recover the deleted file instead of adding your local %s? +// %s is writable, replace? +// %s is checked out, replace? + diff --git a/ssphys/SSLib.net/vss.xsd b/ssphys/SSLib.net/vss.xsd new file mode 100644 index 0000000..6581f85 --- /dev/null +++ b/ssphys/SSLib.net/vss.xsd @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ssphys/SSLib/IniFile.cpp b/ssphys/SSLib/IniFile.cpp new file mode 100644 index 0000000..b0ca230 --- /dev/null +++ b/ssphys/SSLib/IniFile.cpp @@ -0,0 +1,529 @@ +#include "StdAfx.h" +#include "inifile.h" + +using namespace std; + +CIniFile::CIniFile(void) // Default constructor +{ +} + +CIniFile::~CIniFile(void) +{ +} + +// A function to trim whitespace from both sides of a given string +void Trim(std::string& str, const std::string & ChrsToTrim = " \t\n\r", int TrimDir = 0) +{ + size_t startIndex = str.find_first_not_of(ChrsToTrim); + if (startIndex == std::string::npos){str.erase(); return;} + if (TrimDir < 2) str = str.substr(startIndex, str.size()-startIndex); + if (TrimDir!=1) str = str.substr(0, str.find_last_not_of(ChrsToTrim) + 1); +} + +//inline void TrimRight(std::string& str, const std::string & ChrsToTrim = " \t\n\r") +//{ +// Trim(str, ChrsToTrim, 2); +//} + +//inline void TrimLeft(std::string& str, const std::string & ChrsToTrim = " \t\n\r") +//{ +// Trim(str, ChrsToTrim, 1); +//} + +// A function to transform a string to uppercase if neccessary +void UCase(string& str, bool ucase) +{ + if(ucase) transform(str.begin(), str.end(), str.begin(), toupper); +} + +bool CIniFile::Load(string FileName, vector& content) +{ + string s; // Holds the current line from the ini file + string CurrentSection; // Holds the current section name + + ifstream inFile (FileName.c_str()); // Create an input filestream + if (!inFile.is_open()) return false; // If the input file doesn't open, then return + content.clear(); // Clear the content vector + + string comments = ""; // A string to store comments in + + while(!std::getline(inFile, s).eof()) // Read until the end of the file + { + Trim(s); // Trim whitespace from the ends + if(!s.empty()) // Make sure its not a blank line + { + IniRecord r; // Define a new record + + if((s[0]=='#')||(s[0]==';')) // Is this a commented line? + { + if ((s.find('[')==string::npos)&& // If there is no [ or = + (s.find('=')==string::npos)) // Then it's a comment + { + comments += s + '\n'; // Add the comment to the current comments string + } else { + r.Commented = s[0]; // Save the comment character + s.erase(s.begin()); // Remove the comment for further processing + Trim(s); + }// Remove any more whitespace + } else r.Commented = ' '; // else mark it as not being a comment + + if(s.find('[')!=string::npos) // Is this line a section? + { + s.erase(s.begin()); // Erase the leading bracket + s.erase(s.find(']')); // Erase the trailing bracket + r.Comments = comments; // Add the comments string (if any) + comments = ""; // Clear the comments for re-use + r.Section = s; // Set the Section value + r.Key = ""; // Set the Key value + r.Value = ""; // Set the Value value + CurrentSection = s; + } + + if(s.find('=')!=string::npos) // Is this line a Key/Value? + { + r.Comments = comments; // Add the comments string (if any) + comments = ""; // Clear the comments for re-use + r.Section = CurrentSection; // Set the section to the current Section + r.Key = s.substr(0,s.find('=')); // Set the Key value to everything before the = sign + UCase (r.Key, true); + r.Value = s.substr(s.find('=')+1); // Set the Value to everything after the = sign + + Trim (r.Key); + Trim (r.Value); + } + if(comments == "") // Don't add a record yet if its a comment line + content.push_back(r); // Add the record to content + } + } + + inFile.close(); // Close the file + return true; +} + +bool CIniFile::Save(string FileName, vector& content) +{ + ofstream outFile (FileName.c_str()); // Create an output filestream + if (!outFile.is_open()) return false; // If the output file doesn't open, then return + + for (int i=0;i<(int)content.size();i++) // Loop through each vector + { + outFile << content[i].Comments; // Write out the comments + if(content[i].Key == "") // Is this a section? + outFile << content[i].Commented << "[" + << content[i].Section << "]" << endl; // Then format the section + else + outFile << content[i].Commented << content[i].Key + << "=" << content[i].Value << endl; // Else format a key/value + } + + outFile.close(); // Close the file + return true; +} + +string CIniFile::Content(string FileName) +{ + string s=""; // Hold our return string + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file loads + { + for (int i=0;i<(int)content.size();i++) // Loop through the content + { + if(content[i].Comments != "") s += content[i].Comments; // Add the comments + if(content[i].Commented != ' ') s += content[i].Commented; // If this is commented, then add it + if((content[i].Key == "")) // Is this a section? + s += '[' + content[i].Section + ']'; // Add the section + else s += content[i].Key + '=' + content[i].Value; // Or the Key value to the return srting + + if (i != content.size()) s += '\n'; // If this is not the last line, add a CrLf + } + return s; // Return the contents + } + + return ""; +} + +vector CIniFile::GetSectionNames(string FileName) +{ + vector data; // Holds the return data + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + for (int i=0;i<(int)content.size();i++) // Loop through the content + { + if(content[i].Key =="") // If there is no key value, then its a section + data.push_back(content[i].Section); // Add the section to the return data + } + } + + return data; // Return the data +} + +vector CIniFile::GetSection(string SectionName, string FileName) +{ + vector data; // Holds the return data + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + for (int i=0;i<(int)content.size();i++) // Loop through the content + { + if((content[i].Section == SectionName) && // If this is the section name we want + (content[i].Key != "")) // but not the section name itself + data.push_back(content[i]); // Add the record to the return data + } + } + + return data; // Return the data +} + +bool CIniFile::RecordExists(string KeyName, string SectionName, string FileName) +{ + vector content; // Holds the current record // Holds the current record + if (Load(FileName, content)) // Make sure the file is loaded + { + UCase (KeyName, true); + vector::iterator iter = std::find_if(content.begin(), + content.end(), + CIniFile::RecordSectionKeyIs(SectionName,KeyName)); // Locate the Section/Key + + if (iter == content.end()) return false; // The Section/Key was not found + } + return true; // The Section/Key was found +} + +bool CIniFile::SectionExists(string SectionName, string FileName) +{ + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + vector::iterator iter = std::find_if(content.begin(), + content.end(), + CIniFile::RecordSectionIs(SectionName)); // Locate the Section + + if (iter == content.end()) return false; // The Section was not found + } + return true; // The Section was found +} + +vector CIniFile::GetRecord(string KeyName, string SectionName, string FileName) +{ + vector data; // Holds the return data + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + UCase (KeyName, true); + vector::iterator iter = std::find_if(content.begin(), + content.end(), + CIniFile::RecordSectionKeyIs(SectionName,KeyName)); // Locate the IniRecord + + if (iter == content.end()) return data; // The IniRecord was not found + + data.push_back (*iter); // The IniRecord was found + } + return data; // Return the IniRecord +} + +string CIniFile::GetValue(string KeyName, string SectionName, string FileName) +{ + vector content = GetRecord(KeyName,SectionName, FileName); // Get the IniRecord + + if(!content.empty()) // Make sure there is a value to return + return content[0].Value; // And return the value + + return ""; // No value was found +} + +bool CIniFile::SetValue(string KeyName, string Value, string SectionName, string FileName) +{ + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + UCase (KeyName, true); + if(!SectionExists(SectionName,FileName)) // If the Section doesn't exist + { + IniRecord s ("",' ',SectionName,"",""); // Define a new section + IniRecord r ("",' ',SectionName,KeyName,Value); // Define a new record + content.push_back(s); // Add the section + content.push_back(r); // Add the record + return Save(FileName,content); // Save + } + + if(!RecordExists(KeyName,SectionName,FileName)) // If the Key doesn't exist + { + vector::iterator iter = std::find_if(content.begin(), + content.end(), + CIniFile::RecordSectionIs(SectionName)); // Locate the Section + iter++; // Advance just past the section + IniRecord r ("",' ',SectionName,KeyName,Value); // Define a new record + content.insert(iter,r); // Add the record + return Save(FileName,content); // Save + } + + vector::iterator iter = std::find_if(content.begin(), + content.end(), + CIniFile::RecordSectionKeyIs(SectionName,KeyName)); // Locate the IniRecord + + iter->Value = Value; // Insert the correct value + return Save(FileName,content); // Save + } + + return false; // In the event the file does not load +} + +bool CIniFile::RenameSection(string OldSectionName, string NewSectionName, string FileName) +{ + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + for(vector::iterator iter = content.begin(); + iter < content.end(); iter++) // Loop through the records + { + if(iter->Section == OldSectionName) // Is this the OldSectionName? + iter->Section = NewSectionName; // Now its the NewSectionName + } + return Save(FileName,content); // Save + } + + return false; // In the event the file does not load +} + +bool CIniFile::CommentRecord(CommentChar cc, string KeyName,string SectionName,string FileName) +{ + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + UCase (KeyName, true); + vector::iterator iter = std::find_if(content.begin(), + content.end(), + CIniFile::RecordSectionKeyIs(SectionName,KeyName)); // Locate the Section/Key + + if (iter == content.end()) return false; // The Section/Key was not found + + iter->Commented = cc; // Change the Comment value + return Save(FileName,content); // Save + + } + return false; // In the event the file does not load +} + +bool CIniFile::UnCommentRecord(string KeyName,string SectionName,string FileName) +{ + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + UCase (KeyName, true); + vector::iterator iter = std::find_if(content.begin(), + content.end(), + CIniFile::RecordSectionKeyIs(SectionName,KeyName)); // Locate the Section/Key + + if (iter == content.end()) return false; // The Section/Key was not found + + iter->Commented = ' '; // Remove the Comment value + return Save(FileName,content); // Save + + } + return false; // In the event the file does not load +} + +bool CIniFile::CommentSection(char CommentChar, string SectionName, string FileName) +{ + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + for(vector::iterator iter = content.begin(); iter < content.end(); iter++) + { + if(iter->Section == SectionName) // Is this the right section? + iter->Commented = CommentChar; // Change the comment value + } + return Save(FileName,content); // Save + } + + return false; // In the event the file does not load +} + +bool CIniFile::UnCommentSection(string SectionName, string FileName) +{ + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + for(vector::iterator iter = content.begin(); iter < content.end(); iter++) + { + if(iter->Section == SectionName) // Is this the right section? + iter->Commented = ' '; // Remove the comment value + } + return Save(FileName,content); // Save + } + + return false; // In the event the file does not load +} + +bool CIniFile::DeleteRecord(string KeyName, string SectionName, string FileName) +{ + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + UCase (KeyName, true); + vector::iterator iter = std::find_if(content.begin(), + content.end(), + CIniFile::RecordSectionKeyIs(SectionName,KeyName)); // Locate the Section/Key + + if (iter == content.end()) return false; // The Section/Key was not found + + content.erase(iter); // Remove the IniRecord + return Save(FileName,content); // Save + + } + + return false; // In the event the file does not load +} + +bool CIniFile::DeleteSection(string SectionName, string FileName) +{ + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + for(int i=(int)content.size()-1;i>-1;i--) // Iterate backwards through the content + { + if(content[i].Section == SectionName) // Is this related to the Section? + content.erase (content.begin()+i); // Then erase it + } + + return Save(FileName,content); // Save + } + return false; // In the event the file does not load +} + +bool CIniFile::SetSectionComments(string Comments, string SectionName, string FileName) +{ + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + for(vector::iterator iter = content.begin(); iter < content.end(); iter++) // Loop through the records + { + if((iter->Section == SectionName) && // Is this the Section? + (iter->Key == "")) // And not a record + { + if (Comments.size() >= 2) // Is there a comment? + { + if (Comments.substr(Comments.size()-2) != "\n") // Does the string end in a newline? + Comments += "\n"; // If not, add one + } + iter->Comments = Comments; // Set the comments + + return Save(FileName,content); // Save + } + } + } + return false; // In the event the file does not load +} + +bool CIniFile::SetRecordComments(string Comments, string KeyName, string SectionName, string FileName) +{ + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + UCase (KeyName, true); + vector::iterator iter = std::find_if(content.begin(), + content.end(), + CIniFile::RecordSectionKeyIs(SectionName,KeyName)); // Locate the Section/Key + + if (iter == content.end()) return false; // The Section/Key was not found + + if (Comments.size() >= 2) // Is there a comment? + { + if (Comments.substr(Comments.size()-2) != "\n") // Does the string end in a newline? + Comments += "\n"; // If not, add one + } + iter->Comments = Comments; // Set the comments + return Save(FileName,content); // Save + + } + + return false; // In the event the file does not load +} + +vector CIniFile::GetSections(string FileName) +{ + vector data; // Holds the return data + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + for (int i=0;i<(int)content.size();i++) // Loop through the content + { + if(content[i].Key == "") // If this is a section + data.push_back(content[i]); // Add the record to the return data + } + } + + return data; // Return the data +} + +bool CIniFile::Sort(string FileName, bool Descending) +{ + vector content; // Used to hold the sorted content + vector sections = GetSections(FileName); // Get a list of Sections + + if(!sections.empty()) // Is there anything to process? + { + + if(Descending) // Descending or Ascending? + std::sort(sections.begin(), sections.end(), DescendingSectionSort()); + else // Sort the Sections + std::sort(sections.begin(), sections.end(), AscendingSectionSort()); + + for(vector::iterator iter = sections.begin(); iter < sections.end(); iter++) // For each Section + { + content.push_back(*iter); // Add the sorted Section to the content + + vector records = GetSection(iter->Section ,FileName); // Get a list of Records for this section + + if(Descending) // Descending or Ascending? + std::sort(records.begin(), records.end(), DescendingRecordSort()); + else // Sort the Records + std::sort(records.begin(), records.end(), AscendingRecordSort()); + + for(vector::iterator it = records.begin(); it < records.end(); it++) // For each IniRecord + content.push_back(*it); // Add the sorted IniRecord to the content + } + + return Save(FileName,content); // Save + } + + return false; // There were no sections +} + +bool CIniFile::AddSection(string SectionName, string FileName) +{ + vector content; // Holds the current record // Holds the current record + + if (Load(FileName, content)) // Make sure the file is loaded + { + IniRecord s ("",' ',SectionName,"",""); // Define a new section + content.push_back(s); // Add the section + return Save(FileName,content); // Save + } + + return false; // The file did not open +} + +bool CIniFile::Create(string FileName) +{ + vector content; // Create empty content + return Save(FileName,content); // Save +} + diff --git a/ssphys/SSLib/IniFile.h b/ssphys/SSLib/IniFile.h new file mode 100644 index 0000000..6989ff7 --- /dev/null +++ b/ssphys/SSLib/IniFile.h @@ -0,0 +1,119 @@ +#pragma once +#include +#include +#include +#include +#include +#include + +class CIniFile +{ +public: + struct IniRecord + { + IniRecord () + { + } + IniRecord (std::string comments, char commented, std::string section, std::string key, std::string value) + : Comments (comments), Commented (commented), Section (section), Key (key), Value (value) + { + } + std::string Comments; + char Commented; + std::string Section; + std::string Key; + std::string Value; + }; + + enum CommentChar + { + Pound = '#', + SemiColon = ';' + }; + + CIniFile(void); + virtual ~CIniFile(void); + + static bool AddSection(std::string SectionName, std::string FileName); + static bool CommentRecord(CommentChar cc, std::string KeyName,std::string SectionName,std::string FileName); + static bool CommentSection(char CommentChar, std::string SectionName, std::string FileName); + static std::string Content(std::string FileName); + static bool Create(std::string FileName); + static bool DeleteRecord(std::string KeyName, std::string SectionName, std::string FileName); + static bool DeleteSection(std::string SectionName, std::string FileName); + static std::vector GetRecord(std::string KeyName, std::string SectionName, std::string FileName); + static std::vector GetSection(std::string SectionName, std::string FileName); + static std::vector GetSectionNames(std::string FileName); + static std::string GetValue(std::string KeyName, std::string SectionName, std::string FileName); + static bool RecordExists(std::string KeyName, std::string SectionName, std::string FileName); + static bool RenameSection(std::string OldSectionName, std::string NewSectionName, std::string FileName); + static bool SectionExists(std::string SectionName, std::string FileName); + static bool SetRecordComments(std::string Comments, std::string KeyName, std::string SectionName, std::string FileName); + static bool SetSectionComments(std::string Comments, std::string SectionName, std::string FileName); + static bool SetValue(std::string KeyName, std::string Value, std::string SectionName, std::string FileName); + static bool Sort(std::string FileName, bool Descending); + static bool UnCommentRecord(std::string KeyName,std::string SectionName,std::string FileName); + static bool UnCommentSection(std::string SectionName, std::string FileName); + +private: + static std::vector GetSections(std::string FileName); + static bool Load(std::string FileName, std::vector& content); + static bool Save(std::string FileName, std::vector& content); + + struct RecordSectionIs : std::unary_function + { + std::string section_; + + RecordSectionIs(const std::string& section): section_(section){} + + bool operator()( const IniRecord& rec ) const + { + return rec.Section == section_; + } + }; + + struct RecordSectionKeyIs : std::unary_function + { + std::string section_; + std::string key_; + + RecordSectionKeyIs(const std::string& section, const std::string& key): section_(section),key_(key){} + + bool operator()( const IniRecord& rec ) const + { + return ((rec.Section == section_)&&(rec.Key == key_)); + } + }; + + struct AscendingSectionSort + { + bool operator()(IniRecord& Start, IniRecord& End) + { + return Start.Section < End.Section; + } + }; + + struct DescendingSectionSort + { + bool operator()(IniRecord& Start, IniRecord& End) + { + return Start.Section > End.Section; + } + }; + + struct AscendingRecordSort + { + bool operator()(IniRecord& Start, IniRecord& End) + { + return Start.Key < End.Key; + } + }; + + struct DescendingRecordSort + { + bool operator()(IniRecord& Start, IniRecord& End) + { + return Start.Key > End.Key; + } + }; +}; \ No newline at end of file diff --git a/ssphys/SSLib/Readme.txt b/ssphys/SSLib/Readme.txt new file mode 100644 index 0000000..bf4c3e3 --- /dev/null +++ b/ssphys/SSLib/Readme.txt @@ -0,0 +1,24 @@ +======================================================================== + STATIC LIBRARY : SSLib +======================================================================== + + +AppWizard has created this SSLib library for you. + +This file contains a summary of what you will find in each of the files that +make up your SSLib application. + +///////////////////////////////////////////////////////////////////////////// + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named SSLib.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + + +///////////////////////////////////////////////////////////////////////////// diff --git a/ssphys/SSLib/SSDatabase.cpp b/ssphys/SSLib/SSDatabase.cpp new file mode 100644 index 0000000..57c070e --- /dev/null +++ b/ssphys/SSLib/SSDatabase.cpp @@ -0,0 +1,341 @@ +// SSDatabase.cpp: implementation of the SSDatabase class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSDatabase.h" +#include "IniFile.h" +#include +#include + +#define ASH_NO_REGEX +#include "tokenarray.h" +typedef ash::tokenarray tarray; + +#include +#include +namespace fs = boost::filesystem; + +#include +#include +#include +#include +using namespace std; + +//--------------------------------------------------------------------------- +#include "LeakWatcher.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +//--------------------------------------------------------------------------- +SSDatabase* SSDatabase::m_pCurrentDatabase = NULL; +SSDatabase* SSDatabase::GetCurrentDatabase () +{ + return m_pCurrentDatabase; +} + +struct RootProjectFile +{ + RootProjectFile () + { +// memset (this, sizeof (this), 0); +// memcpy (FileHeader, "SourceSafe@Microsoft", 20); + + ProjectEntry.type = SSITEM_PROJECT; + ProjectEntry.flags = 0; + ProjectEntry.name.flags = 0; + strncpy (ProjectEntry.name.name, "$/", 3); // the official name of the root project is $/ and not $ + ProjectEntry.name.nsmap = 0; + ProjectEntry.type = SSITEM_PROJECT; + strncpy (ProjectEntry.phys, "AAAAAAAA", 9); + ProjectEntry.pinnedToVersion = 0; + + RecordHeader.checksum = calc_crc16 (&ProjectEntry, sizeof (PROJECT_ENTRY)); + strncpy (RecordHeader.type, "JP", 2); + RecordHeader.size = sizeof (PROJECT_ENTRY); + } +// char FileHeader[52]; + RECORD_HEADER RecordHeader; + PROJECT_ENTRY ProjectEntry; +}; +static RootProjectFile sRootProjectFile; + + + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +SSDatabase::SSDatabase() +: m_bOpen (false) +{ + +} + +SSDatabase::~SSDatabase() +{ + +} + +bool SSDatabase::Open (const std::string& srcsafeini, const std::string& user, const std::string& password) +{ + if (srcsafeini.empty ()) + return false; + + m_SrcSafeIni = srcsafeini; + m_User = user; + m_Password = password; + m_bOpen = true; + + fs::path basePath = fs::path(m_SrcSafeIni, fs::native); + if (fs::exists(basePath) && !fs::is_directory(basePath) && basePath.has_leaf()) + { + basePath = basePath.branch_path (); + m_SrcSafeIni = basePath.string (); + } + + std::string database; // = options.GetDatabase (); +// if (!database.empty()) +// { +// database = " (" + database + ")"; +// } + + if (!basePath.empty ()) + { + fs::path srcSafeIni = basePath / "srcsafe.ini"; + fs::path userIni = basePath / "users" / m_User / "ss.ini"; + fs::path dataPath = basePath / CIniFile::GetValue("Data_Path" + database, "", srcSafeIni.string()); + fs::path usersPath = basePath / CIniFile::GetValue("Users_Path"+ database, "", srcSafeIni.string()); + fs::path usersText = basePath / CIniFile::GetValue("Users_Text"+ database, "", srcSafeIni.string()); + fs::path tempPath = basePath / CIniFile::GetValue("Temp_Path" + database, "", srcSafeIni.string()); + fs::path namesPath = basePath / "names.dat"; + + m_DataPath= dataPath.string (); + m_UserIni = userIni.string (); + m_NamesCache.SetFile (new SSNamesCacheFile (namesPath.string ())); + m_bOpen = true; + } + + return m_bOpen; +} + +bool SSDatabase::IsOpen() +{ + return m_bOpen; +} + +std::string SSDatabase::GetSrcSafeIni () +{ + return m_SrcSafeIni; +} + +std::string SSDatabase::GetUsername() +{ + return m_User; +} + +std::string SSDatabase::GetDatabaseName() +{ + if (!IsOpen()) + return ""; + + return CIniFile::GetValue ("Database_Name", "", m_SrcSafeIni); +} + +std::string SSDatabase::GetCurrentProject () const +{ + return CIniFile::GetValue ("Project", "", m_UserIni); +} + +int SSDatabase::SetCurrentProject (std::string cp) +{ + if (cp.empty() && cp.length() < 2) + return 0; + + if (cp[0] != '$' && cp[1] != '/') + throw SSException ("only absolute project pathes are supported"); + + return CIniFile::SetValue ("Project", cp, "", m_UserIni) ? 0 : 1; +} + +time_t timeFromString (const std::string& str) +{ + using namespace std; + locale loc ("German"); + basic_stringstream< char > pszGetF, pszPutF, pszGetI, pszPutI; + ios_base::iostate st = 0; + struct tm t; + memset(&t, 0, sizeof(struct tm)); + + pszGetF << str; + pszGetF.imbue( loc ); + basic_istream::_Iter i = _USE (loc, time_get) + .get_date(basic_istream::_Iter(pszGetF.rdbuf( ) ), basic_istream::_Iter(0), pszGetF, st, &t); + + if ( st & ios_base::failbit ) + cout << "time_get("<< pszGetF.rdbuf( )->str( )<< ") FAILED on char: " << *i << endl; + else + + cout << "time_get("<< pszGetF.rdbuf( )->str( )<< ") =" + << "\ntm_sec: " << t.tm_sec + << "\ntm_min: " << t.tm_min + << "\ntm_hour: " << t.tm_hour + << "\ntm_mday: " << t.tm_mday + << "\ntm_mon: " << t.tm_mon + << "\ntm_year: " << t.tm_year + << "\ntm_wday: " << t.tm_wday + << "\ntm_yday: " << t.tm_yday + << "\ntm_isdst: " << t.tm_isdst + << endl; + + return mktime (&t); +} + +time_t SSDatabase::GetVersionDate () +{ + if (!m_VersionStr.empty ()) + return timeFromString(m_VersionStr); + return (time_t)(LONG_MAX); +} + + +// Interpretation of the specification +// the specification is a little problematic, since the roots project spec is not '$' but '$/' +// This leads to the following behavoir, (name is any valid item name not starting with $) +// name or $name: the item in the current project (file item or project item) +// 1.) $/: the root project +// 2.) $ or $. or . : the current project +// 3.) .. or $..: the project relative to the current project +// +// so the interpretation is, that the spec is always relative to the current project, except +// the specification starts with "$/" +// all "$" are removed and the relative path specifiers are flattened + +SSItemPtr SSDatabase::GetSSItem (const std::string& spec, bool bDeleted) +{ + if (!IsOpen ()) + throw SSException ("database not open"); + + if (spec.empty()) + return SSItemPtr(); + + std::string localSpec = spec; + if (spec.size () < 2 || spec.compare (0, 2, "$/") != 0) + { + localSpec = GetCurrentProject (); + if (localSpec.empty()) + localSpec = "$/"; + + if (!spec.empty ()) + { + std::string tmpSpec (spec); + if (tmpSpec[0] == '$') + tmpSpec.erase(0, 1); + + if (!localSpec.empty() && *localSpec.rbegin() != '/' && !tmpSpec.empty () && * tmpSpec.begin () != '/') + localSpec += '/'; + localSpec += tmpSpec; + } + } + + SSItemPtr pItem; + + tarray items (localSpec, "/\\"); + tarray::const_iterator ps; + for (ps = items.begin (); ps != items.end (); ++ps) + { +// std::cout << *ps << std::endl; + + if ((*ps).empty ()) + continue; + + std::string project = (*ps); + int pos = project.find (';'); + + std::string name (project); + std::string version; + if (pos >= 0) + { + name = project.substr(0, pos); + version = project.substr(pos+1); + } + + if (!pItem) + { + if (name != "$") + throw std::exception ("project must start with the root project $/"); + + SSProjectFile projectFile (new CMemoryIO (&sRootProjectFile, sizeof (RootProjectFile))); + SSRecordPtr recordPtr = projectFile.GetFirstRecord (); + SSProjectObject project (recordPtr); + pItem.reset (new SSItem (this, SSItemPtr(), project)); + } + else if (!name.empty ()) + { + std::auto_ptr pItems (pItem->GetItems (bDeleted)); + bool bFound = false; + for (int i = 0; i < pItems->GetCount(); i++) + { + SSItemPtr pNewItem = pItems->GetItem(i); + +#pragma message ("Was passiert, wenn nach einem Project gefragt wird, welches den selben Namen wie ein File hat?") + if (pNewItem->GetName () == name && pNewItem->GetDeleted() == bDeleted) + { + if (bFound) + throw SSException ("duplicate entry found"); + pItem = pNewItem; + bFound = true; + // continue searching to check for duplicate entries + } + } + + if (!bFound) + { + // throw SSException ("is not an existing filename or project"); + std::string spec = pItem->GetSpec (); + if (*spec.rbegin() != '/') + spec += "/"; + spec += name; + + std::cout << spec << " is not an existing filename or project" << std::endl; + std::cout << "possible items are:" << std::endl; + for (int i = 0; i < pItems->GetCount(); i++) + { + SSItemPtr pNewItem = pItems->GetItem(i); + std::cout << pNewItem->GetName () << std::endl; + } + return SSItemPtr (); + } + } + + // retirieve the version here, since the version specification can stand befind the / like: + // $;100 or $/;100 + // $/subproject;100 or // $/subproject/;100 + if (!version.empty ()) + pItem = pItem->GetVersion(version); + } + + return pItem; +} + +SSHistoryFile* SSDatabase::GetDataFile (const std::string& phys) +{ + return new SSHistoryFile (MakePath (phys)); +} + +std::string SSDatabase::MakePath (std::string phys) +{ + if (phys.empty()) + return m_DataPath; + + return m_DataPath + "\\" + phys[0] + "\\" + phys; +} + +SSNamesCache *SSDatabase::GetNamesService () +{ + return &m_NamesCache; +} diff --git a/ssphys/SSLib/SSDatabase.h b/ssphys/SSLib/SSDatabase.h new file mode 100644 index 0000000..017359f --- /dev/null +++ b/ssphys/SSLib/SSDatabase.h @@ -0,0 +1,59 @@ +// SSDatabase.h: interface for the SSDatabase class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSDATABASE_H__5C786BA0_F380_4FC0_BEC0_6D97821C43D8__INCLUDED_) +#define AFX_SSDATABASE_H__5C786BA0_F380_4FC0_BEC0_6D97821C43D8__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SSItem.h" +#include + +class SSDatabase +{ +public: + SSDatabase (); + virtual ~SSDatabase(); + + static SSDatabase* GetCurrentDatabase (); + + bool Open (const std::string& srcsafeini, const std::string& user, const std::string& password); + bool IsOpen (); + + std::string GetSrcSafeIni (); + std::string GetUsername (); + std::string GetDatabaseName (); + + time_t GetVersionDate (); + void SetVersionDate (std::string versionDate) { m_VersionStr = versionDate; } + + SSItemPtr GetSSItem (const std::string& spec, bool bDeleted); + + SSHistoryFile* GetDataFile (const std::string& phys); + SSNamesCache* GetNamesService (); + + std::string GetCurrentProject () const; + int SetCurrentProject (std::string cp); + +private: + std::string MakePath (std::string phys); + + static SSDatabase* m_pCurrentDatabase; + + std::string m_SrcSafeIni; + std::string m_UserIni; + std::string m_User; + std::string m_Password; + + std::string m_VersionStr; + + std::string m_DataPath; + bool m_bOpen; + + SSNamesCache m_NamesCache; +}; + +#endif // !defined(AFX_SSDATABASE_H__5C786BA0_F380_4FC0_BEC0_6D97821C43D8__INCLUDED_) diff --git a/ssphys/SSLib/SSItem.cpp b/ssphys/SSLib/SSItem.cpp new file mode 100644 index 0000000..5caea54 --- /dev/null +++ b/ssphys/SSLib/SSItem.cpp @@ -0,0 +1,451 @@ +// SSItem.cpp: implementation of the SSItem class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSItem.h" +#include "SSVersion.h" +#include "SSDatabase.h" +#include + +//--------------------------------------------------------------------------- +#include "LeakWatcher.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + + +/* +SSItem::SSItem() + : m_pDatabase (NULL), + m_nVersionNumber(0) +{ +} + +SSItem::SSItem(SSHistoryFile& rFile, int nVersion) + : m_pDatabase (NULL), + m_nVersionNumber(nVersion) +{ +} + +SSItem::SSItem(SSDatabase* pDb, const std::string& spec, const std::string& phys) + : m_pDatabase (pDb), + m_MySpec (spec), + m_Phys (phys), + m_nVersionNumber(0) +{ +} +*/ + +//SSItem::SSItem(SSDatabase* pDb) +// : m_pDatabase (pDb), +// m_pParent (NULL), +// // m_ItemDescr (project), +// m_nVersionNumber(0) +//{ +// m_ItemDescr.type = SSITEM_PROJECT; +// m_ItemDescr.flags = 0; +// m_ItemDescr.name.flags = 0; +// strncpy (m_ItemDescr.name.name, "$", 2); +// m_ItemDescr.name.nsmap = 0; +// strncpy (m_ItemDescr.phys, "AAAAAAAA", 9); +//} + +SSItem::SSItem(SSDatabase* pDb, SSItemPtr pParent, SSProjectObject project, int version) + : m_pDatabase (pDb), + m_pParent (pParent), + m_ItemDescr (project) +{ + m_ItemDescr.Pin (version); +} + +SSItem::SSItem(SSDatabase* pDb, SSItemPtr pParent, SSProjectObject project) + : m_pDatabase (pDb), + m_pParent (pParent), + m_ItemDescr (project) +{ +} + +SSItem::~SSItem() +{ +} + +bool SSItem::GetBinary () +{ + return m_ItemDescr.IsStoreBinaryDiff (); +} + +bool SSItem::GetDeleted () +{ + return m_ItemDescr.IsDeleted (); +} + +int SSItem::GetType () +{ + return m_ItemDescr.GetType (); +} + +std::string SSItem::GetSpec () +{ + // Here is a minor oddity in the naming of the specification + // The spec of the root project is $/, but the name of any subproject is + // $/subproject (note without the slash at the end) + + // The encoding of the path specification leads to the small problem, that + // a pinned version of the root project is written in the form $/;10. Chaining + // subproject to that form of the root project specification leads to + // $/;10project;20. To be unambigous in this way, we need to introduce another + // path sperator: $/;10/project;20, even if this looks strange + + // Due to the nature ss handles the specification $;10 is valid. It is the version 10 + // of the current project. + std::string spec; + SSItemPtr pParent (m_pParent); + + spec = GetName (); + if (!pParent) + { + if (spec.size() < 2 && spec.compare(0, 2, "$/") != 0) + throw SSException ("internal error: the root project must start with $/"); + } + + while (pParent) + { + std::string parentSpec = pParent->GetSpec(); + + if (*parentSpec.rbegin() != '/') + parentSpec += "/"; + + spec = parentSpec + spec; + pParent = pParent->GetParent(); + } + + return spec; +} + +std::string SSItem::GetLocalSpec () +{ + return ""; +} + +std::string SSItem::GetName () +{ + return m_ItemDescr.GetName (); +} + +long SSItem::GetVersionNumber ( ) +{ + int pin = m_ItemDescr.GetPinnedToVersion(); + if (pin) + return pin; + +// std::auto_ptr pFile (m_pDatabase->GetDataFile (m_ItemDescr.GetPhysFile())); +// if (pFile.get()) +// { +// pFile->Open (); +// std::auto_ptr version (pFile->GetLastVersion()); +// return version->GetVersionNumber (); +// } +// else +// throw SSException (std::string ("Could not open File: ") + pFile->GetFileName()); + + return 0; +} + +long SSItem::GetIsCheckedOut ( ) +{ + return 0; +} + +SSItemPtr SSItem::GetParent () +{ + return m_pParent; +} + +SSItems* SSItem::GetItems (bool bIncludeDeleted) +{ + // valid only for project items + if (GetType () != SSITEM_PROJECT) + return NULL; + + // get the correct phys file + std::auto_ptr pFile (m_pDatabase->GetDataFile (m_ItemDescr.GetPhysFile())); + if (pFile.get()) + { + pFile->Open (); + SSProjectFile projectFile (pFile->GetFileName () + pFile->GetLatestExt ()); + SSItems* pItems = new SSItems (shared_from_this(), projectFile, true); + + // reverse apply the history + SSVersionObject version = pFile->GetLastVersion(); + int myVersion = GetVersionNumber (); + while (version && ( (myVersion > 0 && version.GetVersionNumber() > myVersion) ) +/* || (versionPtr->GetDate() > m_pDatabase->GetVersionDate ()) */) + { + SSAction* pAction = version.GetAction(); + if (!pAction->Accept (*pItems)) + throw SSException("unsupported action"); + + version = pFile->GetPrevVersion (version); + } + return pItems; + } + else + throw SSException (std::string ("Could not open File: ") + pFile->GetFileName()); + + return NULL; +} + +SSItemPtr SSItem::GetVersion (std::string version) +{ + int v = atoi (version.c_str()); + return SSItemPtr (new SSItem (m_pDatabase, m_pParent, m_ItemDescr, v)); +} + +SSVersions* SSItem::GetVersions (long iFlags) +{ + return new SSVersions (shared_from_this(), m_ItemDescr.GetPhysFile(), iFlags); +} + +std::string SSItem::GetPhysical() +{ + return m_ItemDescr.GetPhysFile(); +} + + +void SSItem::Recover() +{ + m_ItemDescr.Recover (); +} + +void SSItem::Delete() +{ + m_ItemDescr.Delete (); +} + +void SSItem::Rename(SSNAME oldName, SSNAME newName) +{ + m_ItemDescr.Rename (oldName, newName); +} + + + +SSItems::~SSItems () +{ +} + +SSItems::SSItems (SSItemPtr pParentItem, SSProjectFile& rFile, bool bIncludeDeleted) + : m_pParent (pParentItem) +{ + BuildList (pParentItem, rFile, bIncludeDeleted); +} + +SSItemPtr SSItems::GetItem (long i) +{ + assert (i < GetCount ()); + if (i(NULL); +} + +void SSItems::BuildList (SSItemPtr pParentItem, SSProjectFile& rFile, bool bIncludeDeleted) +{ + // iterate all records and add the items to the collection + SSRecordPtr recordPtr = rFile.GetFirstRecord (); + while (recordPtr) + { + if (recordPtr->GetType() == eProjectEntry) + { + SSProjectObject project (recordPtr); + if (!project.IsDeleted() || bIncludeDeleted) + { + m_Items.push_back (SSItemPtr(new SSItem (pParentItem->GetDatabase (), pParentItem, project))); + } + } + + recordPtr = rFile.GetNextRecord (recordPtr); + } +} + +bool SSItems::Apply (const SSLabeledAction& rAction) +{ + return true; +} + +bool SSItems::Apply (const SSCreatedProjectAction& rAction) +{ + return true; +} + +bool SSItems::Apply (const SSCreatedFileAction& rAction) +{ + return true; +} + +bool SSItems::Apply (const SSDestroyedFileAction& rAction) +{ + // durch map wahrscheinlich besser zu lösen + if (GetPhysicalItem (rAction.GetPhysical())) + throw SSException ("adding already existing item"); + + PROJECT_ENTRY pe; +// pe.flags = ??; + pe.name = rAction.GetSSName (); + strncpy (pe.phys, rAction.GetPhysical().c_str(), 8); + pe.phys[8] = '\0'; + pe.pinnedToVersion = 0; +// pe.type = ?? + SSProjectObject pr (pe); + SSItemPtr pItem (new SSItem (m_pParent->GetDatabase(), m_pParent, pr)); + + m_Items.push_back (pItem); + + return true; +} +bool SSItems::Apply (const SSDestroyedProjectAction& rAction) +{ + // durch map wahrscheinlich besser zu lösen + if (GetPhysicalItem (rAction.GetPhysical())) + throw SSException ("adding already existing item"); + + PROJECT_ENTRY pe; +// pe.flags = ??; + pe.name = rAction.GetSSName (); + strncpy (pe.phys, rAction.GetPhysical().c_str(), 8); + pe.phys[8] = '\0'; + pe.pinnedToVersion = 0; +// pe.type = ?? + SSProjectObject pr (pe); + SSItemPtr pItem (new SSItem (m_pParent->GetDatabase(), m_pParent, pr)); + + m_Items.push_back (pItem); + + return true; +} +bool SSItems::Apply (const SSAddedFileAction& rAction) +{ + SSItemPtr pItem = GetPhysicalItem (rAction.GetPhysical()); + std::vector::iterator itor = std::find (m_Items.begin(), m_Items.end(), pItem); + + if (itor != m_Items.end()) + m_Items.erase(itor); + else + throw SSException ("item not found"); + + return true; +} +bool SSItems::Apply (const SSAddedProjectAction& rAction) +{ + SSItemPtr pItem = GetPhysicalItem (rAction.GetPhysical()); + std::vector::iterator itor = std::find (m_Items.begin(), m_Items.end(), pItem); + + if (itor != m_Items.end()) + m_Items.erase(itor); + else + throw SSException ("item not found"); + + return true; +} + +bool SSItems::Apply (const SSDeletedFileAction& rAction) +{ + SSItemPtr pItem = GetPhysicalItem (rAction.GetPhysical()); + if (pItem) + pItem->Recover (); + else + throw SSException ("item not found"); + + return true; +} +bool SSItems::Apply (const SSDeletedProjectAction& rAction) +{ + SSItemPtr pItem = GetPhysicalItem (rAction.GetPhysical()); + if (pItem) + pItem->Recover (); + else + throw SSException ("item not found"); + + return true; +} + +//bool SSItems::DeleteFile (SSAction& rAction) +//{ +// SSItemPtr pItem = GetPhysicalItem (rAction.GetPhysical()); +// if (pItem) +// pItem->Delete (); +// else +// throw SSException ("item not found"); +// +// return true; +//} +//bool SSItems::DeleteProject (SSAction& rAction) +//{ +// return DeleteFile (pAction); +//} + +bool SSItems::Apply (const SSRenamedProjectAction& rAction) //, SSNAME oldName, SSNAME newName) +{ + SSItemPtr pItem = GetPhysicalItem (rAction.GetPhysical()); + if (!pItem) + throw SSException ("item not found"); + + pItem->Rename (rAction.GetSSName(), rAction.GetNewSSName ()); + return true; +} + +bool SSItems::Apply (const SSRenamedFileAction& rAction) //, SSNAME oldName, SSNAME newName) +{ + SSItemPtr pItem = GetPhysicalItem (rAction.GetPhysical()); + if (!pItem) + throw SSException ("item not found"); + + pItem->Rename (rAction.GetSSName(), rAction.GetNewSSName ()); + return true; +} + +bool SSItems::Apply (const SSCheckedInAction& rAction) +{ + return true; +} + +SSItemPtr SSItems::GetPhysicalItem (std::string physical) +{ +#pragma message ("speed up by using a map and no full search") + std::vector::iterator itor; + std::vector::iterator end = m_Items.end(); + + SSItemPtr foundItemPtr; + for (itor = m_Items.begin(); itor != end; ++itor) + { + SSItemPtr itemPtr = *itor; +// std::cout << itemPtr->GetPhysical () << std::endl; + std::string current = itemPtr->GetPhysical (); + if (current == physical) + { + if (foundItemPtr) + throw SSException ("duplicate entry"); + + foundItemPtr = itemPtr; + } + } + + return foundItemPtr; +} + +void SSItems::Dump (std::ostream& os) const +{ + std::vector::iterator itor; + std::vector::iterator end = m_Items.end(); + + for (itor = m_Items.begin(); itor != end; ++itor) + { + oss << (*itor)->GetPhysical () << ": " << (*itor)->GetName () << std::endl; + } +} \ No newline at end of file diff --git a/ssphys/SSLib/SSItem.h b/ssphys/SSLib/SSItem.h new file mode 100644 index 0000000..63df990 --- /dev/null +++ b/ssphys/SSLib/SSItem.h @@ -0,0 +1,182 @@ +// SSItem.h: interface for the SSItem class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSITEM_H__CB9B12A5_D0F5_4015_BB9A_18DEC6265E3A__INCLUDED_) +#define AFX_SSITEM_H__CB9B12A5_D0F5_4015_BB9A_18DEC6265E3A__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include +#include +#include +#include +#include + +// forward declaration +// #include "SSDatabase.h" +class SSDatabase; +class SSItems; +class SSVersions; + +class SSItem; +typedef boost::shared_ptr SSItemPtr; + +class SSItem : public boost::enable_shared_from_this +{ +public: +// SSItem(); +// SSItem(SSHistoryFile& rFile, int nVersion); +// SSItem(SSDatabase* pDb); + SSItem(SSDatabase* pDb, SSItemPtr pParent, SSProjectObject project, int version); + SSItem(SSDatabase* pDb, SSItemPtr pParent, SSProjectObject project); + virtual ~SSItem(); + +// _bstr_t GetSpec ( ); + std::string GetSpec (); + +// VARIANT_BOOL GetBinary ( ); +// void PutBinary ( +// VARIANT_BOOL pbBinary ); + bool GetBinary (); + +// VARIANT_BOOL GetDeleted ( ); +// void PutDeleted ( +// VARIANT_BOOL pbDeleted ); + bool GetDeleted (); + +// int GetType ( ); + int GetType ( ); + +// _bstr_t GetLocalSpec ( ); +// void PutLocalSpec ( +// _bstr_t pLocal ); + std::string GetLocalSpec (); + +// _bstr_t GetName ( ); +// void PutName ( +// _bstr_t pName ); + std::string GetName (); + +// IVSSItemPtr GetParent ( ); + SSItemPtr GetParent (); + +// long GetVersionNumber ( ); + long GetVersionNumber ( ); + +// IVSSItemsPtr GetItems ( +// VARIANT_BOOL IncludeDeleted ); + SSItems* GetItems (bool includeDeleted); + +// HRESULT Get ( +// BSTR * Local, +// long iFlags ); + +// HRESULT Checkout ( +// _bstr_t Comment, +// _bstr_t Local, +// long iFlags ); + +// HRESULT Checkin ( +// _bstr_t Comment, +// _bstr_t Local, +// long iFlags ); + +// HRESULT UndoCheckout ( +// _bstr_t Local, +// long iFlags ); + + long GetIsCheckedOut ( ); + +// IVSSCheckoutsPtr GetCheckouts ( ); + +// VARIANT_BOOL GetIsDifferent ( +// _bstr_t Local ); + +// IVSSItemPtr Add ( +// _bstr_t Local, +// _bstr_t Comment, +// long iFlags ); + +// IVSSItemPtr NewSubproject ( +// _bstr_t Name, +// _bstr_t Comment ); + +// HRESULT Share ( +// struct IVSSItem * pIItem, +// _bstr_t Comment, +// long iFlags ); + +// HRESULT Destroy ( ); + +// HRESULT Move ( +// struct IVSSItem * pINewParent ); + +// HRESULT Label ( +// _bstr_t Label, +// _bstr_t Comment ); + +// IVSSVersionsPtr GetVersions ( +// long iFlags ); + SSVersions* GetVersions ( long iFlags ); + +// IVSSItemPtr GetVersion ( +// const _variant_t & Version = vtMissing ); + SSItemPtr GetVersion (std::string v); + + SSDatabase* GetDatabase () { return m_pDatabase; } + + std::string GetPhysical (); + + void Delete (); + void Recover (); + void Rename (SSNAME oldName, SSNAME newName); + +protected: + + SSProjectObject m_ItemDescr; + SSItemPtr m_pParent; +// long m_nVersionNumber; + SSDatabase* m_pDatabase; +}; + + +class SSItems : public ISSActionVisitor +{ +public: + SSItems (SSItemPtr pParent, SSProjectFile& rFile, bool bIncludeDeleted); + ~SSItems (); + + long GetCount () { return m_Items.size (); } + SSItemPtr GetItem (long i); + SSItemPtr GetPhysicalItem (std::string physical); + + // ISSActionVisitor Interface for Undo + virtual bool Apply (const SSLabeledAction& rAction); + virtual bool Apply (const SSCreatedProjectAction& rAction); + virtual bool Apply (const SSCreatedFileAction& rAction); + virtual bool Apply (const SSDestroyedFileAction& rAction); + virtual bool Apply (const SSDestroyedProjectAction& rAction); + virtual bool Apply (const SSAddedFileAction& rAction); + virtual bool Apply (const SSAddedProjectAction& rAction); + virtual bool Apply (const SSDeletedFileAction& rAction); + virtual bool Apply (const SSDeletedProjectAction& rAction); + virtual bool Apply (const SSRenamedProjectAction& rAction); //, SSNAME oldName, SSNAME newName); + virtual bool Apply (const SSRenamedFileAction& rAction); //, SSNAME oldName, SSNAME newName); + virtual bool Apply (const SSCheckedInAction& rAction); + +// bool DeleteFile (SSAction& rAction); +// bool DeleteProject (SSAction& rAction); + + + void Dump (std::ostream& os) const; +private: + void BuildList (SSItemPtr rParent, SSProjectFile& rFile, bool bIncludeDeleted); + + SSItemPtr m_pParent; + std::vector m_Items; +}; + +#endif // !defined(AFX_SSITEM_H__CB9B12A5_D0F5_4015_BB9A_18DEC6265E3A__INCLUDED_) diff --git a/ssphys/SSLib/SSLib.dsp b/ssphys/SSLib/SSLib.dsp new file mode 100644 index 0000000..48cfe99 --- /dev/null +++ b/ssphys/SSLib/SSLib.dsp @@ -0,0 +1,141 @@ +# Microsoft Developer Studio Project File - Name="SSLib" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=SSLib - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "SSLib.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "SSLib.mak" CFG="SSLib - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "SSLib - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "SSLib - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "SSLib - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I ".." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "SSLib - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".." /I "..\Utils" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "SSLib - Win32 Release" +# Name "SSLib - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\IniFile.cpp +# End Source File +# Begin Source File + +SOURCE=.\SSDatabase.cpp +# End Source File +# Begin Source File + +SOURCE=.\SSItem.cpp +# End Source File +# Begin Source File + +SOURCE=.\SSVersion.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\IniFile.h +# End Source File +# Begin Source File + +SOURCE=.\SSDatabase.h +# End Source File +# Begin Source File + +SOURCE=.\SSItem.h +# End Source File +# Begin Source File + +SOURCE=.\SSVersion.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\tokenarray.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\Readme.txt +# End Source File +# End Target +# End Project diff --git a/ssphys/SSLib/SSVersion.cpp b/ssphys/SSLib/SSVersion.cpp new file mode 100644 index 0000000..c3ba3e8 --- /dev/null +++ b/ssphys/SSLib/SSVersion.cpp @@ -0,0 +1,66 @@ +// SSVersion.cpp: implementation of the SSVersion class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSVersion.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +SSVersion::SSVersion() +{ + +} + +SSVersion::~SSVersion() +{ + +} + +std::string SSVersion::GetUsername () +{ + return m_pVersion->GetUsername(); +} + +long SSVersion::GetVersionNumber ( ) +{ + return m_pVersion->GetVersionNumber(); +} + +std::string SSVersion::GetAction ( ) +{ + return m_pVersion->GetActionString(); +} + +// DATE SSVersion::GetDate ( ); + +std::string SSVersion::GetComment ( ) +{ + return m_pVersion->GetComment(); +} + +std::string SSVersion::GetLabel ( ) +{ +#pragma message ("fix") +// return m_pVersion->GetLabel(); + return ""; +} + +std::string SSVersion::GetLabelComment ( ) +{ +#pragma message ("fix") +// return m_pVersion->GetLabelComment(); + return ""; +} + +SSItemPtr SSVersion::GetVSSItem ( ) +{ + return SSItemPtr(); +} + + +SSVersions::SSVersions (SSItemPtr itemPtr, std::string physFile, long iFlags) +{ +} diff --git a/ssphys/SSLib/SSVersion.h b/ssphys/SSLib/SSVersion.h new file mode 100644 index 0000000..7b165c7 --- /dev/null +++ b/ssphys/SSLib/SSVersion.h @@ -0,0 +1,67 @@ +// SSVersion.h: interface for the SSVersion class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSVERSION_H__A783C194_B621_44E3_A58B_CE8E87BB85FF__INCLUDED_) +#define AFX_SSVERSION_H__A783C194_B621_44E3_A58B_CE8E87BB85FF__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include +#include "SSItem.h" + +class SSVersion; +typedef boost::shared_ptr SSVersionPtr; + +class SSVersion +{ +public: + SSVersion(); + virtual ~SSVersion(); + +// _bstr_t GetUsername ( ); + std::string GetUsername (); + +// long GetVersionNumber ( ); + long GetVersionNumber ( ); + +// _bstr_t GetAction ( ); + std::string GetAction ( ); + +// DATE GetDate ( ); +// DATE GetDate ( ); + +// _bstr_t GetComment ( ); + std::string GetComment ( ); + +// _bstr_t GetLabel ( ); + std::string GetLabel ( ); + +// _bstr_t GetLabelComment ( ); + std::string GetLabelComment ( ); + +// IVSSItemPtr GetVSSItem ( ); + SSItemPtr GetVSSItem ( ); + +private: + SSVersionObject* m_pVersion; +}; + +class SSVersions +{ +public: + SSVersions (SSItemPtr itemPtr, std::string physFile, long iFlags); + ~SSVersions (); + + long GetCount () { return m_Items.size (); } + SSVersionPtr GetVersion (long i); + +private: + + std::vector m_Items; +}; + + +#endif // !defined(AFX_SSVERSION_H__A783C194_B621_44E3_A58B_CE8E87BB85FF__INCLUDED_) diff --git a/ssphys/SSLib/StdAfx.cpp b/ssphys/SSLib/StdAfx.cpp new file mode 100644 index 0000000..7eb1d63 --- /dev/null +++ b/ssphys/SSLib/StdAfx.cpp @@ -0,0 +1,6 @@ +// stdafx.cpp : source file that includes just the standard includes +// SSLib.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + diff --git a/ssphys/SSLib/StdAfx.h b/ssphys/SSLib/StdAfx.h new file mode 100644 index 0000000..130ea3b --- /dev/null +++ b/ssphys/SSLib/StdAfx.h @@ -0,0 +1,29 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__CB10DD16_AE3B_4281_83D3_D0DF683706A8__INCLUDED_) +#define AFX_STDAFX_H__CB10DD16_AE3B_4281_83D3_D0DF683706A8__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include "assert.h" + +#pragma warning (disable: 4786) +#include +#include +#include +#include + +#include + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__CB10DD16_AE3B_4281_83D3_D0DF683706A8__INCLUDED_) diff --git a/ssphys/SSLib/tokenarray.h b/ssphys/SSLib/tokenarray.h new file mode 100644 index 0000000..d89708a --- /dev/null +++ b/ssphys/SSLib/tokenarray.h @@ -0,0 +1,175 @@ +// $Id$ +// Tokenize a string into an array of strings. The delimeter can be either +// a set of chars (as a C string) or a Boost regular expression. +// Provides a read-only random access iterator. The array is not +// sortable, or otherwise writeable. +// +// Each token in the input string is only extracted when it is asked +// for. On construction, the postions of the token delimeters are +// found and stored in a std::vector. +// +// Written by C. Ashley Sanders, a.sanders@man.ac.uk, University of +// Manchester, 16/7/2004. + +# ifndef TOKENARRAY_HH_ +# define TOKENARRAY_HH_ + +# include +# include +# ifndef ASH_NO_REGEX +# include +# endif + +namespace ash { + template + class tokenarray { + public: + typedef tokenarray _Myt; + typedef typename std::basic_string String; +# ifndef ASH_NO_REGEX + typedef typename boost::basic_regex RegExp; +# endif + typedef typename String::size_type string_size_type; + typedef std::vector > tarray; + typedef typename tarray::size_type size_type; + + class const_iterator { + public: + // This class could derive from std::iterator rather than have all + // the typedefs below. However, neither of the two versions of the + // STL I have seem to cut the mustard when it comes to std::iterator. + typedef std::random_access_iterator_tag iterator_category; + typedef String value_type; + typedef typename tarray::size_type difference_type; + typedef String* pointer; + typedef String& reference; + + private: + const tokenarray *pvs; + difference_type i; + public: + const_iterator () : pvs(0), i(0) {} + const_iterator (const const_iterator &s) + : pvs(s.pvs), i(s.i) {}; + const_iterator (const tokenarray *ps, difference_type d) + : pvs(ps), i(d) {}; + const_iterator& operator= (const const_iterator &s) { + if (this != &s) + { + pvs = s.pvs; + i = s.i; + } + return *this; + } + const_iterator& operator++ () { *this += 1; return *this; }; + const const_iterator operator++ (int) { + const_iterator s (*this); + ++*this; + return s; + }; + const_iterator& operator+= (difference_type d) { i += d; return *this; } + const_iterator operator+ (difference_type d) const { + const_iterator s (*this); + return s += d; + } + const_iterator& operator-- () { *this -= 1; return *this; }; + const const_iterator operator-- (int) { + const_iterator s (*this); + --*this; + return s; + }; + const_iterator& operator-= (difference_type d) { i -= d; return *this; } + const_iterator operator- (difference_type d) const { + const_iterator s (*this); + return s -= d; + } + difference_type operator- (const const_iterator &s) const { + return i - s.i; + } + bool operator== (const const_iterator &s) const { + return i == s.i; + } + bool operator< (const const_iterator &s) const { + return i < s.i; + } + bool operator<= (const const_iterator &s) const { + return i <= s.i; + } + bool operator> (const const_iterator &s) const { + return i > s.i; + } + bool operator>= (const const_iterator &s) const { + return i >= s.i; + } + bool operator!= (const const_iterator &s) const { + return i != s.i; + } + const value_type operator[] (difference_type d) const { + return (*pvs)[i+d]; + } + const value_type operator* () const { + return (*pvs)[i]; + }; + }; + + private: + tarray vsz; + String st; + + + public: + tokenarray () {}; + tokenarray (const String &s, const CharT *pc) : st(s) { + string_size_type pos; + for (pos = 0; (pos = st.find_first_of (pc, pos)) != String::npos; ++pos) + vsz.push_back (std::make_pair (pos, pos+1)); + } +# ifndef ASH_NO_REGEX + tokenarray (const String &s, const RegExp &re) : st(s) { + boost::match_results match; + typename String::const_iterator pc = st.begin (), pcEnd = st.end (); + string_size_type szOffset = 0; + while (boost::regex_search (pc, pcEnd, match, re)) + { + vsz.push_back (std::make_pair (szOffset + match.position (), + szOffset + match.position () + match.length ())); + pc = match[0].second; + szOffset += match.position() + match.length(); + } + } +# endif // ASH_NO_REGEX + tokenarray (const tokenarray& s) : vsz(s.vsz), st(s.st) {}; + tokenarray& operator= (const tokenarray &s) { + tokenarray tmp (s); + swap (tmp); + return *this; + } + void swap (tokenarray &s) { + vsz.swap (s.vsz); + st.swap (s.st); + } + String data () const { return st; } + void data (const String &s, const CharT *pc) { + tokenarray tmp (s, pc); + swap (tmp); + } + size_type size () const { + return st.empty () ? 0 : vsz.size () + 1; + }; + const String operator[] (size_type i) const { + // Note: no bounds checking on vsz. + string_size_type start = (i) ? vsz[i-1].second : 0; + string_size_type len = (i < size ()-1) ? vsz[i].first - start : String::npos; + return st.substr (start, len); + } + const_iterator begin () const { + return const_iterator (this, 0); + } + const_iterator end () const { + return const_iterator (this, size ()); + } + }; + +} // namespace ash + +# endif // TOKENARRAY_HH_ diff --git a/ssphys/SSPhys/Arguments.cpp b/ssphys/SSPhys/Arguments.cpp new file mode 100644 index 0000000..abeacce --- /dev/null +++ b/ssphys/SSPhys/Arguments.cpp @@ -0,0 +1,11 @@ +// Arguments.cpp: implementation of the CArguments class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Arguments.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + diff --git a/ssphys/SSPhys/Arguments.h b/ssphys/SSPhys/Arguments.h new file mode 100644 index 0000000..d700156 --- /dev/null +++ b/ssphys/SSPhys/Arguments.h @@ -0,0 +1,16 @@ +// Arguments.h: interface for the CArguments class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_ARGUMENTS_H__3EDDAD52_EC79_4EB6_9B3B_056D85DB96C4__INCLUDED_) +#define AFX_ARGUMENTS_H__3EDDAD52_EC79_4EB6_9B3B_056D85DB96C4__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include +typedef std::queue CArguments; + + +#endif // !defined(AFX_ARGUMENTS_H__3EDDAD52_EC79_4EB6_9B3B_056D85DB96C4__INCLUDED_) diff --git a/ssphys/SSPhys/Command.cpp b/ssphys/SSPhys/Command.cpp new file mode 100644 index 0000000..329f3f1 --- /dev/null +++ b/ssphys/SSPhys/Command.cpp @@ -0,0 +1,28 @@ +// Command.cpp: implementation of the CCommand class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Command.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CCommand::CCommand (std::string commandName) + : m_CommandName (commandName) +{ +} + +CCommand::~CCommand () +{ +} + +void CCommand::PrintUsage () const +{ + std::cout << GetCommandName() << ":" << std::endl; + COptions::PrintUsage (); +} + + + diff --git a/ssphys/SSPhys/Command.h b/ssphys/SSPhys/Command.h new file mode 100644 index 0000000..088968d --- /dev/null +++ b/ssphys/SSPhys/Command.h @@ -0,0 +1,43 @@ +// Command.h: interface for the CCommand class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_COMMAND_H__A42CF41F_0E40_40BA_A36B_CAAEC8A6D34E__INCLUDED_) +#define AFX_COMMAND_H__A42CF41F_0E40_40BA_A36B_CAAEC8A6D34E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Options.h" +#include "Arguments.h" + +//--------------------------------------------------------------------------- +class CCommand : public COptions +{ +public: + CCommand (std::string commandName); + virtual ~CCommand (); + + std::string GetCommandName () const + { + return m_CommandName; + } + + virtual bool SetArguments (CArguments& args) + { + return false; + } + + virtual void Execute () = 0; + + virtual void PrintUsage () const; + +protected: + std::string m_CommandName; +}; + + + + +#endif // !defined(AFX_COMMAND_H__A42CF41F_0E40_40BA_A36B_CAAEC8A6D34E__INCLUDED_) diff --git a/ssphys/SSPhys/CommandFactory.cpp b/ssphys/SSPhys/CommandFactory.cpp new file mode 100644 index 0000000..374a3aa --- /dev/null +++ b/ssphys/SSPhys/CommandFactory.cpp @@ -0,0 +1,69 @@ +// CommandFactory.cpp: implementation of the CCommandFactory class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "CommandFactory.h" + +#include "GlobalOptions.h" +#include "HelpCommand.h" +#include "HistoryCommand.h" +#include "InfoCommand.h" +#include "ValidateCommand.h" +#include "GetCommand.h" +#include "FileTypeCommand.h" +#include "PropertiesCommand.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CCommandFactory::CCommandFactory() +{ +} + +CCommandFactory::~CCommandFactory() +{ +} + +CCommand* CCommandFactory::MakeCommand (std::string command) +{ + CCommand* pCommand = NULL; + if (command == "help") + pCommand = new CHelpCommand (this); + else if (command == "info") + pCommand = new CInfoCommand (); + else if (command == "history") + pCommand = new CHistoryCommand (); + else if (command == "validate") + pCommand = new CValidateCommand (); + else if (command == "get") + pCommand = new CGetCommand (); + else if (command == "filetype") + pCommand = new CFileTypeCommand (); + else if (command == "properties") + pCommand = new CPropertiesCommand (); + else + throw SSException ("unknown command"); + + return pCommand; +} + +void CCommandFactory::PrintUsage () const +{ + // foreach command + CHelpCommand helpCommand; + helpCommand.PrintUsage (); + + CHistoryCommand historyCommand; + historyCommand.PrintUsage (); + + CInfoCommand infoCommand; + infoCommand.PrintUsage (); + + CValidateCommand validateCommand; + validateCommand.PrintUsage (); + + CGetCommand getCommand; + getCommand.PrintUsage (); +} diff --git a/ssphys/SSPhys/CommandFactory.h b/ssphys/SSPhys/CommandFactory.h new file mode 100644 index 0000000..383dc81 --- /dev/null +++ b/ssphys/SSPhys/CommandFactory.h @@ -0,0 +1,28 @@ +// CommandFactory.h: interface for the CCommandFactory class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_COMMANDFACTORY_H__1ACA9B5D_0D2A_42A2_8C4A_A34C1D867A2A__INCLUDED_) +#define AFX_COMMANDFACTORY_H__1ACA9B5D_0D2A_42A2_8C4A_A34C1D867A2A__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Command.h" + +class CCommandLine; + +class CCommandFactory +{ +public: + CCommandFactory(); + virtual ~CCommandFactory(); + + CCommand* MakeCommand (std::string command); + + void PrintUsage () const; +protected: +}; + +#endif // !defined(AFX_COMMANDFACTORY_H__1ACA9B5D_0D2A_42A2_8C4A_A34C1D867A2A__INCLUDED_) diff --git a/ssphys/SSPhys/CommandLine.cpp b/ssphys/SSPhys/CommandLine.cpp new file mode 100644 index 0000000..a6bf2fe --- /dev/null +++ b/ssphys/SSPhys/CommandLine.cpp @@ -0,0 +1,117 @@ +// CommandLine.cpp: implementation of the CCommandLine class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "CommandLine.h" +#include "Command.h" + +//--------------------------------------------------------------------------- +tristate ToTristate (const char ch) +{ + if (!ch) + return undefined; + if (ch == '-') + return cleared; + else if (ch == '+') + return set; + + return undefined; +} + + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +CCommandLine::CCommandLine () +{ +} + +CCommandLine::~CCommandLine () +{ +} + + +void CCommandLine::Parse (int argc, char* argv[]) +{ + for (int i = 1; i< argc; ++i) + { + if (argv[i][0] == '-') + { + COptionInfoList::const_iterator itor = m_OptionsInfo.begin (); + COption option; + while (itor != m_OptionsInfo.end ()) + { + const COptionInfo& info = *itor; + if (IsArgChar (argv[i][1], info.m_shortOption) || IsLongArgument (&argv[i][1], info.m_longOption.c_str())) + { + option.id = info.m_Id; + switch (info.m_needArg) + { + case COptionInfo::requiredArgument: + if (++i < argc) + option.value = argv[i]; + else + throw SSException ("missing command line parameter"); + break; + case COptionInfo::optionalArgument: + if (++i < argc) + option.value = argv[i]; + break; + case COptionInfo::tristateArgument: + option.value = ToTristate (argv[i][2]); + break; + } + + break; + } + ++itor; + } + + if (itor == m_OptionsInfo.end ()) + throw SSException ("unknown command line parameter"); + + m_Options.push_back (option); + } + else + { + if (m_Command.empty ()) + { + m_Command = argv[i]; + std::auto_ptr pCommand (m_pCommandFactory->MakeCommand (m_Command)); + COptionInfoList commandOptions = pCommand->GetOptionsInfo (); + m_OptionsInfo.insert (m_OptionsInfo.end (), commandOptions.begin (), commandOptions.end ()); + } + else + { + m_Args.push (argv[i]); + } + } + } +} + + +bool CCommandLine::IsLongArgument (const char* ch, const char* arg) +{ + if (!ch) + return false; + + std::string str = (ch[0] == '-') ? &ch[1] : &ch[0]; + if (str == arg) + return true; + + return false; +} + +bool CCommandLine::IsArgChar (const char ch, const char arg) +{ + if (!ch) + return false; + else if (ch == arg) + return true; + else if (tolower(ch) == arg) + return true; + else if (toupper(ch) == arg) + return true; + return false; +} diff --git a/ssphys/SSPhys/CommandLine.h b/ssphys/SSPhys/CommandLine.h new file mode 100644 index 0000000..c79c28f --- /dev/null +++ b/ssphys/SSPhys/CommandLine.h @@ -0,0 +1,44 @@ +// CommandLine.h: interface for the CCommandLine class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_COMMANDLINE_H__094560AC_AAF6_4054_8536_4D6F421ACBCE__INCLUDED_) +#define AFX_COMMANDLINE_H__094560AC_AAF6_4054_8536_4D6F421ACBCE__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Arguments.h" +#include "Options.h" +#include "CommandFactory.h" +#include + +//--------------------------------------------------------------------------- +class CCommandLine +{ +public: + CCommandLine (); + virtual ~CCommandLine (); + + void Parse (int argc, char* argv[]); + + void SetCommandFactory (CCommandFactory* pFactory) { m_pCommandFactory = pFactory; } + void SetOptionsInfo (COptionInfoList optionsInfo) { m_OptionsInfo = optionsInfo; } + + COptionsList GetOptions () { return m_Options; } + CArguments GetArgs () { return m_Args; } + std::string GetCommand () { return m_Command; } + +protected: + bool IsLongArgument (const char* ch, const char* arg); + bool IsArgChar (const char ch, const char arg); + + CCommandFactory *m_pCommandFactory; + CArguments m_Args; + COptionsList m_Options; + COptionInfoList m_OptionsInfo; + std::string m_Command; +}; + +#endif // !defined(AFX_COMMANDLINE_H__094560AC_AAF6_4054_8536_4D6F421ACBCE__INCLUDED_) diff --git a/ssphys/SSPhys/FileTypeCommand.cpp b/ssphys/SSPhys/FileTypeCommand.cpp new file mode 100644 index 0000000..7f02a51 --- /dev/null +++ b/ssphys/SSPhys/FileTypeCommand.cpp @@ -0,0 +1,48 @@ +// FileTypeCommand.cpp: implementation of the CFileTypeCommand class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "FileTypeCommand.h" +#include "Formatter.h" +#include +#include + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +//--------------------------------------------------------------------------- +CFileTypeCommand::CFileTypeCommand () + : CCommand ("filetype") +{ +} + +COptionInfoList CFileTypeCommand::GetOptionsInfo () const +{ + COptionInfoList options = CCommand::GetOptionsInfo(); + return options; +} + +bool CFileTypeCommand::SetOption (const COption& option) +{ + return false; +} + +bool CFileTypeCommand::SetArguments (CArguments& args) +{ + if (args.empty ()) + throw SSException ("no argument"); + + m_PhysFile = args.front (); + args.pop (); + return true; +} + +void CFileTypeCommand::Execute () +{ + SSHistoryFile file (m_PhysFile); + std::auto_ptr info (file.GetItemInfo ()); + if (info.get()) + g_pFormatter->Format (*info); +} \ No newline at end of file diff --git a/ssphys/SSPhys/FileTypeCommand.h b/ssphys/SSPhys/FileTypeCommand.h new file mode 100644 index 0000000..ce91cd9 --- /dev/null +++ b/ssphys/SSPhys/FileTypeCommand.h @@ -0,0 +1,28 @@ +// FileTypeCommand.h: interface for the CFileTypeCommand class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_FILETYPECOMMAND_H__A66D5425_5DF0_46BD_8664_EF74FE905B1B__INCLUDED_) +#define AFX_FILETYPECOMMAND_H__A66D5425_5DF0_46BD_8664_EF74FE905B1B__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Command.h" + +class CFileTypeCommand : public CCommand +{ +public: + CFileTypeCommand (); + + virtual COptionInfoList GetOptionsInfo () const; + virtual bool SetOption (const COption& option); + virtual bool SetArguments (CArguments& args); + void Execute (); + +protected: + std::string m_PhysFile; +}; + +#endif // !defined(AFX_FILETYPECOMMAND_H__A66D5425_5DF0_46BD_8664_EF74FE905B1B__INCLUDED_) diff --git a/ssphys/SSPhys/Formatter.cpp b/ssphys/SSPhys/Formatter.cpp new file mode 100644 index 0000000..60b1ab7 --- /dev/null +++ b/ssphys/SSPhys/Formatter.cpp @@ -0,0 +1,324 @@ +// IFormatter.cpp: implementation of the IFormatter class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Formatter.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +class CSSObjectVisitor : public ISSObjectVisitor +{ + virtual void Apply(const SSVersionObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } + virtual void Apply(const SSCheckOutObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } + virtual void Apply(const SSNameObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } + virtual void Apply(const SSCommentObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } + virtual void Apply(const SSProjectObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } + virtual void Apply(const SSParentFolderObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } + virtual void Apply(const SSBranchFileObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } + + virtual void Apply(const SSFileItem& object, const ISSContext* pCtx) { Apply ((SSItemInfoObject&) object, pCtx); } + virtual void Apply(const SSProjectItem& object, const ISSContext* pCtx) { Apply ((SSItemInfoObject&) object, pCtx); } + +protected: + virtual void Apply(const SSItemInfoObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } + virtual void Apply(const SSObject& object, const ISSContext* pCtx) = 0; +}; + +///////////////////////////////////////////////////////////////////// +class CPhysFormatter : public CFormatter +{ +public: + virtual bool SetOption (const COption& option) + { + return false; + } + + void Format (const SSObject& object, const ISSContext* pCtx) + { + object.Dump (std::cout); + } + +protected: + +}; + +////////////////////////////////////////////////////////////////////// +class CXMLFormatter : public CFormatter +{ +public: + CXMLFormatter () + : m_pXMLNode (NULL) + { + } + ~CXMLFormatter () + { + delete m_pXMLNode; + } + void SetFileName (std::string fileName) + { + AttribMap map; + map ["Name"]=fileName; + m_pXMLNode = new XMLNode (NULL, "File", map); + } + + virtual bool SetOption (const COption& option) + { + return false; + } + + void Format (const SSObject& object, const ISSContext* pCtx) + { + AttribMap map; + map ["offset"] = boost::lexical_cast(object.GetOffset ()); + XMLNode node (m_pXMLNode, object.GetName (), map); + object.ToXml (&node); + } + +protected: + XMLNode* m_pXMLNode; +}; + +////////////////////////////////////////////////////////////////////// +void hexdump( const unsigned char *buffer, int size ) +{ + int i = 0; + + while( i < size ) + { + int j = 0; + char str[256]; + char* p = str; + + for( j = 0; j < 16 && i + j < size; j++ ) + p += sprintf (p, "%02x ", buffer[i + j]); + + //if not entire line + for( ; j < 16; j++ ) + p += sprintf (p, " " ); + + p += sprintf (p, " | " ); + + for( j = 0; j < 16 && i + j < size; j++ ) + p += sprintf (p, "%c", buffer[i + j] < ' ' || buffer[i + j] >= 127 ? '.' : buffer[i + j] ); + + //filler + for( ; j < 16; j++ ) + p += sprintf (p, " " ); + + p += sprintf (p, " |\n" ); + + i += 16; + + std::cout << str; + } +} + + +class CBinaryFormatter : public CFormatter +{ +public: + CBinaryFormatter (tristate value) + : m_Value (value) + { + } + + virtual bool SetOption (const COption& option) + { + return false; + } + + void Format (const SSObject& object, const ISSContext* pCtx) + { + const SSRecordPtr pRecord = object.GetRecord (); + std::cout << "Offset: " << pRecord->GetOffset (); + std::cout << " Type: " << SSRecord::TypeToString(pRecord->GetType()); + std::cout << " Len: " << pRecord->GetLen(); + + if (m_Value == set) + { + std::cout << std::endl; + hexdump (object.GetRecord()->GetBuffer(), object.GetRecord()->GetLen()); + } + } + +private: + tristate m_Value; +}; + + +////////////////////////////////////////////////////////////////////// +class CVssFormatter : public CFormatter, public CSSObjectVisitor +{ +public: + CVssFormatter () + : n_bPhysicalID (true) + { + } + virtual void Apply (const SSVersionObject& object, const ISSContext* pCtx); + virtual void Apply (const SSFileItem& object, const ISSContext* pCtx); + virtual void Apply (const SSProjectItem& object, const ISSContext* pCtx); + virtual void Apply (const SSProjectObject& object, const ISSContext* pCtx); + virtual void Apply (const SSCommentObject& object, const ISSContext* pCtx); + virtual void Apply (const SSNameObject& object, const ISSContext* pCtx); + + virtual bool SetOption (const COption& option) + { + return false; + } + + void Format (const SSObject& object, const ISSContext* pCtx) + { + object.Accept (*this, pCtx); + } +protected: + virtual void Apply(const class SSObject &object, const ISSContext* pCtx) + { + std::cout << "not implemented" << std::endl; + } + + bool n_bPhysicalID; +}; + +void CVssFormatter::Apply (const SSVersionObject& rObject, const ISSContext* pCtx) +{ + // ***************** Version 1 ***************** + // User: Admin Date: 21.11.94 Time: 18:59 + // Created + const char* format1 = "***************** Version %d *****************"; + const char* format2 = "User: %-12s Date: %-8s Time: %s"; + + char line1[60]; _snprintf (line1, 60, format1, rObject.GetVersionNumber ()); + char date[12]; + char time[12]; + time_t versionDate = rObject.GetDate (); + const tm* ttm = gmtime (&versionDate);//localtime (&versionDate); + strftime (date, countof (date), "%x", ttm); + strftime (time, countof (time), "%X", ttm); + char line2[60]; _snprintf (line2, 60, format2, rObject.GetUsername ().c_str (), date, time); + + std::cout << line1 << std::endl; + if (rObject.GetActionID() == Labeled) + std::cout << "Label: \"" << rObject.GetLabel() << "\"" << std::endl; + std::cout << line2 << std::endl; + std::cout << rObject.GetActionString() << std::endl; + + if (n_bPhysicalID) + { + ISSItemAction* pAction = dynamic_cast (rObject.GetAction()); + if (pAction) + std::cout << "Physical: " << pAction->GetPhysical() << std::endl; + } + + if (!rObject.GetComment ().empty()) + std::cout << rObject.GetComment () << std::endl; + if (rObject.GetActionID() == Labeled) + std::cout << "Label Comment: " << rObject.GetLabelComment () << std::endl; + + std::cout << std::endl; +} + +void CVssFormatter::Apply (const SSFileItem& object, const ISSContext* pCtx) +{ + const IFormattingContext* pFormattingContext = dynamic_cast (pCtx); + if (pFormattingContext && pFormattingContext->GetExtendedOutput ()) + { + //File: $/Modules/bin/z.dll + //Type: Binary + //Size: 92160 bytes + //Store only latest version: No + //Latest: Last Label: 1.9.3 + // Version: 1 Version: 178 + // Date: 8.11.02 17:03 Date: 15.11.04 17:13 + //Comment: doxygen and graphviz + + // TODO: output the parent, but which? + std::cout << "File: " << object.GetName () << std::endl; + std::string type = object.GetFileType () == eFileTypeBinary ? "Binary" : "Text"; + std::cout << "Type: " << type << std::endl; + // TODO: calculate the size, is it in the record?? + std::cout << "Size: " << "???" << std::endl; + // TODO: + std::cout << "Store only latest version: " << "???" << std::endl; + std::cout << "Latest: Last Label: " << "???" << std::endl; +// std::cout << " Version: " << object.GetVersion () << " Version: ???" << std::endl; +// std::cout << " Date: " << object.GetDate () << " Date: ???" << std::endl; + } + else + { + std::string type = object.GetFileType () == eFileTypeBinary ? "Binary" : "Text"; + std::cout << object.GetName () << "\t" << type << std::endl; + } +} + +void CVssFormatter::Apply (const SSProjectItem& object, const ISSContext* pCtx) +{ + const IFormattingContext* pFormattingContext = dynamic_cast (pCtx); + if (pFormattingContext && pFormattingContext->GetExtendedOutput ()) + { + //Project: $/Modules/bin + //Contains: + // 98 Files ( +2 deleted ) + // 0 Subproject(s) + //Latest: Last Label: 1.9.3 + // Version: 113 Version: 178 + // Date: 8.10.04 16:10 Date: 15.11.04 17:13 + //Comment: + } + else + { + std::cout << "$" << object.GetName () << "\tProject" << std::endl; + } + +} + +void CVssFormatter::Apply(const SSProjectObject& object, const ISSContext* pCtx) +{ + std::string type; + if (object.GetType () == SSITEM_FILE) + type = object.GetFileType () == eFileTypeBinary ? "Binary" : "Text"; + else + type = "Project"; + + std::cout << object.GetName () << "\t" << type << std::endl; +} + +void CVssFormatter::Apply (const SSCommentObject& object, const ISSContext* pCtx) +{ + std::cout << object.GetComment () << std::endl; +} + +void CVssFormatter::Apply (const SSNameObject& object, const ISSContext* pCtx) +{ + std::cout << "Entries: " << object.size () << std::endl; + + SSNameObject::const_iterator iter = object.begin (); + for (; iter != object.end (); ++iter) + { + std::cout << "id(" << (*iter).first << ") "/*, offset (" << pEntry->offset << ")*/ "= " << (*iter).second < CFormatterFactory::MakeFormatter (eStyle style, tristate value) +{ + if (style == eBinary) + return new CBinaryFormatter (value); + if (style == eXML) + return new CXMLFormatter (); + if (style == eVSS) + return new CVssFormatter (); + if (style == eDump) + return new CPhysFormatter (); + + return NULL; +} + diff --git a/ssphys/SSPhys/Formatter.h b/ssphys/SSPhys/Formatter.h new file mode 100644 index 0000000..6dac244 --- /dev/null +++ b/ssphys/SSPhys/Formatter.h @@ -0,0 +1,65 @@ +// IFormatter.h: interface for the IFormatter class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_IFORMATTER_H__41F6915F_65BC_4A55_B2C8_1C125237E7CB__INCLUDED_) +#define AFX_IFORMATTER_H__41F6915F_65BC_4A55_B2C8_1C125237E7CB__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Options.h" +#include + +enum eStyle {eBinary, eXML, eVSS, eDump}; + +class IFormattingContext : public ISSContext +{ +public: + virtual bool GetExtendedOutput () const = 0; +}; + +//class CFormatter : public COptions, public ISSObjectVisitor +//{ +//public: +// virtual void Apply(const SSVersionObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } +// virtual void Apply(const SSCheckOutObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } +// virtual void Apply(const SSNameObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } +// virtual void Apply(const SSCommentObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } +// virtual void Apply(const SSProjectObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } +// virtual void Apply(const SSParentFolderObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } +// virtual void Apply(const SSBranchFileObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } +// +// virtual void Apply(const SSFileItem& object, const ISSContext* pCtx) { Apply ((SSItemInfoObject&) object, pCtx); } +// virtual void Apply(const SSProjectItem& object, const ISSContext* pCtx) { Apply ((SSItemInfoObject&) object, pCtx); } +// +// // The xml formatter needs to output the physical filename +// virtual void SetFileName (std::string fileName) {}; +// +//protected: +// virtual void Apply(const SSItemInfoObject& object, const ISSContext* pCtx) { Apply ((SSObject&) object, pCtx); } +// virtual void Apply(const SSObject& object, const ISSContext* pCtx) = 0; +//}; + +class CFormatter : public COptions +{ +public: + // The xml formatter needs to output the physical filename + virtual void SetFileName (std::string fileName) {}; + + virtual void Format (const SSObject& object, const ISSContext* pCtx = NULL) = 0; +}; + +////////////////////////////////////////////////////////////////////// +extern std::auto_ptr g_pFormatter; + +////////////////////////////////////////////////////////////////////// +class CFormatterFactory +{ +public: + static std::auto_ptr MakeFormatter (eStyle style, tristate value); +}; + + +#endif // !defined(AFX_IFORMATTER_H__41F6915F_65BC_4A55_B2C8_1C125237E7CB__INCLUDED_) diff --git a/ssphys/SSPhys/GetCommand.cpp b/ssphys/SSPhys/GetCommand.cpp new file mode 100644 index 0000000..1e171fe --- /dev/null +++ b/ssphys/SSPhys/GetCommand.cpp @@ -0,0 +1,617 @@ +// GetCommand.cpp: implementation of the GetCommand class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "GetCommand.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "windows.h" +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +bool fexists (const char* file) +{ + FILE* pFile = fopen (file, "r"); + if (pFile) + { + fclose (pFile); + return true; + } + return false; +} + +//--------------------------------------------------------------------------- +CGetCommand::CGetCommand () + : CCommand ("get"), + m_Version (-1), + m_bForceOverwrite (false), + m_bBulkGet (false) +{ +} + +COptionInfoList CGetCommand::GetOptionsInfo () const +{ + COptionInfoList options = CCommand::GetOptionsInfo(); + options.push_back (COptionInfo ('v', 'v', "version", "version to get", COptionInfo::requiredArgument)); + options.push_back (COptionInfo ('f', 'f', "force-overwrite", "overwrite target file", COptionInfo::noArgument)); + options.push_back (COptionInfo ('b', 'b', "bulk", "bulk operation: get all intermediate files with the same name as the source name", COptionInfo::noArgument)); + return options; +} + +bool CGetCommand::SetOption (const COption& option) +{ + switch (option.id) + { + case 'v': + m_Version = atoi ((const char*) option.value); + break; + case 'f': + m_bForceOverwrite = true; + break; + case 'b': + m_bBulkGet = true; + break; + default: + return false; + } + return true; +} + +bool CGetCommand::SetArguments (CArguments& args) +{ + if (args.empty ()) + throw SSException ("no argument"); + + m_PhysFile = args.front (); + args.pop (); + + if (args.empty ()) + throw SSException ("missing argument"); + + m_DestFile = args.front (); + args.pop (); + + return true; + +} + + +class CActionVisitor : public ISSActionVisitor +{ +public: + virtual ~CActionVisitor () {} + + virtual bool Apply (const SSLabeledAction& rAction) { return Apply ((const SSAction&) rAction); } +// virtual bool Apply (const SSSingleFileAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSCreatedProjectAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSCreatedFileAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSAddedProjectAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSAddedFileAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSDeletedProjectAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSDeletedFileAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSRecoveredProjectAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSRecoveredFileAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSRollbackAction& rAction) { return Apply ((const SSAction&) rAction); } + + virtual bool Apply (const SSDestroyedProjectAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSDestroyedFileAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSRenamedProjectAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSRenamedFileAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSCheckedInAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSSharedAction& rAction) { return Apply ((const SSAction&) rAction); } + +protected: + virtual bool Apply (const SSAction& rAction) + { + return true; + } +}; + + +std::string CreateTempFile ( const char* pzPrefix = NULL, const char* pzPath = NULL) +{ + return tempnam( pzPath, pzPrefix ); +// while( true ) + { +// std::string cPath = tempnam( pzPath, pzPrefix ); +// if (Open (cPath, O_RDWR | O_CREAT | O_EXCL ) < 0) +// { +// if ( errno == EEXIST ) +// { +// continue; +// } +// else +// { +//// throw errno_exception( "Failed to create file" ); +// } +// } +// else +// { +// Close (); +// break; +// } + } +} + +class CAutoFile +{ +public: + CAutoFile (std::string name, bool bDelete = true) + : m_FileName (name), + m_bDeleteFile (bDelete) + { + } + + CAutoFile (CAutoFile const & r) + : m_bDeleteFile (r.m_bDeleteFile), + m_FileName (r.Detatch ()) + { + } + + CAutoFile& operator= (CAutoFile const & r) + { + if (this != &r) + { + if (m_FileName != r.GetPath()) + { + if (m_bDeleteFile) + Unlink (); + m_bDeleteFile = r.m_bDeleteFile; + } + else if (r.m_bDeleteFile) + m_bDeleteFile = r.m_bDeleteFile; + m_FileName = r.Detatch(); + } + return (*this); + } + + ~CAutoFile() + { + if (m_bDeleteFile) + Unlink (); + } + + std::string GetPath () const { return m_FileName; } + + std::string Detatch() const; + int Unlink(); + +protected: + + std::string m_FileName; + mutable bool m_bDeleteFile; +}; + +std::string CAutoFile::Detatch() const +{ + m_bDeleteFile = false; + return m_FileName; +} + +int CAutoFile::Unlink() +{ + if ( m_bDeleteFile ) + { + m_bDeleteFile = false; + return( unlink( m_FileName.c_str () ) ); + } + else + { + return( 0 ); + } +} + + + +class CReverseDelta +{ +public: + CReverseDelta (const char* buffer, size_t length) + : m_pBuffer (buffer), m_length (length) + { + } + + bool operator () (std::istream& input, std::ostream& output) const + { + for (long i = 0; i < m_length; ) + { + const FD* pfd = (const FD*) (m_pBuffer+i); + i += sizeof(FD); +// printf ("fd: %d, start %d, len %d\n", pfd->command, pfd->start, pfd->end); + + switch (pfd->command) + { + case 2: + // assert finito + break; + case 1: + { + char b[256]; + long size = pfd->end; + input.seekg(pfd->start); + if (input.fail ()) + throw SSException ("reverse delta: invalid seek beyond file size"); + + while (size > 0) + { + long s = __min (size, sizeof (b)); + input.read (b, s); + output.write (b, s); + size -= s; + } + } + break; + case 0: + output.write (m_pBuffer+i, pfd->end); + i += pfd->end; + break; + default: + std::strstream msg; + msg << "unknown reverse delta command " << pfd->command; + throw SSException (msg.str()); + break; + } + } + + return true; + } +protected: + const char* m_pBuffer; + size_t m_length; +}; + + +class CHistoryHandler : public CActionVisitor +{ +public: + CHistoryHandler (std::string src) + : m_File (src, false) + { + } + + std::string GetPath () + { + return m_File.GetPath(); + } + + virtual bool SaveAs (std::string name, bool overwrite = false) = 0; + +protected: + CAutoFile m_File; + +}; + +class CReverseHistoryHandler : public CHistoryHandler +{ +public: + CReverseHistoryHandler (std::string src) + : CHistoryHandler (src) + { + } + + virtual bool Apply (const SSCheckedInAction& rAction) + { + SSRecordPtr pRecord = rAction.GetFileDelta(); + CAutoFile targetFile (CreateTempFile()); + + std::ifstream input (m_File.GetPath().c_str(), std::ios::in|std::ios::binary); + if (!input.is_open()) + return false; + std::ofstream output (targetFile.GetPath().c_str(), std::ios::out|std::ios::binary); + if (!output.is_open()) + return false; + + CReverseDelta revDelta ((const char*)pRecord->GetBuffer(), pRecord->GetLen()); + bool ret = revDelta (input, output); + + input.close(); + output.close (); + + if (ret) + { + m_File = targetFile; + } + return ret; + } + + virtual bool SaveAs (std::string name, bool overwrite = false) + { + return ::CopyFile (GetPath ().c_str(), name.c_str(), !overwrite) != 0; + } + + virtual bool Apply (const SSAction& rAction) + { + throw SSException ("unsuported action in CReverseHistoryHandler"); + } + +}; + +class CProjectHistoryHandler : public CHistoryHandler +{ +public: + CProjectHistoryHandler (std::string src) + : CHistoryHandler (src) + { + SSProjectFile projectFile (GetPath ()); + BuildList (projectFile); + } + + virtual bool SaveAs (std::string name, bool overwrite = false) + { + return false; + } + + virtual bool Apply (const SSLabeledAction& rAction) { /* nothing to do */ return true; } +//// virtual bool Apply (const SSSingleFileAction& rAction) { return Apply ((const SSAction&) rAction); } + virtual bool Apply (const SSCreatedProjectAction& rAction) { /* nothing to do */ return true; } + virtual bool Apply (const SSCreatedFileAction& rAction) { /* nothing to do */ return true; } + virtual bool Apply (const SSAddedProjectAction& rAction); + virtual bool Apply (const SSAddedFileAction& rAction); + virtual bool Apply (const SSDeletedProjectAction& rAction); + virtual bool Apply (const SSDeletedFileAction& rAction); + virtual bool Apply (const SSRecoveredProjectAction& rAction); + virtual bool Apply (const SSRecoveredFileAction& rAction); + + virtual bool Apply (const SSDestroyedProjectAction& rAction); + virtual bool Apply (const SSDestroyedFileAction& rAction); + virtual bool Apply (const SSRenamedProjectAction& rAction); + virtual bool Apply (const SSRenamedFileAction& rAction); +// virtual bool Apply (const SSCheckedInAction& rAction) { return Apply ((const SSAction&) rAction); } +// TODO: +// virtual bool Apply (const SSSharedFileAction& rAction) { return Apply ((const SSAction&) rAction); } + +protected: + virtual bool Apply (const SSAction& rAction) + { + throw SSException ("unsuported action in CProjectHistoryHandler"); + } + + typedef std::vector::iterator iterator; + std::vector m_Items; + + void BuildList (SSProjectFile& rFile); + iterator FindItem (std::string physFile); + iterator InsertItem (SSProjectObject object); + +}; + + +void CProjectHistoryHandler::BuildList (SSProjectFile& rFile) +{ + // iterate all records and add them to the collection + SSRecordPtr recordPtr = rFile.GetFirstRecord (); + while (recordPtr) + { + if (recordPtr->GetType() == eProjectEntry) + { + SSProjectObject projectObject (recordPtr); + m_Items.push_back (projectObject); + } + + recordPtr = rFile.GetNextRecord (recordPtr); + } +} + +CProjectHistoryHandler::iterator CProjectHistoryHandler::FindItem (std::string physFile) +{ + iterator itor; + iterator end = m_Items.end(); + iterator found = end; + + for (itor = m_Items.begin(); itor != end; ++itor) + { + SSProjectObject& po = *itor; + // std::cout << itemPtr->GetPhysical () << std::endl; + if (physFile == po.GetPhysFile()) + { + if (found != end) + throw SSException ("duplicate entry"); + + found = itor; + } + } + + return found; +} + +CProjectHistoryHandler::iterator CProjectHistoryHandler::InsertItem (SSProjectObject object) +{ + m_Items.push_back (object); + iterator last = m_Items.end(); + return --last; +} + +bool CProjectHistoryHandler::Apply (const SSAddedFileAction& rAction) +{ + iterator itor = FindItem (rAction.GetPhysical()); + if (itor != m_Items.end()) + m_Items.erase(itor); + else + throw SSException ("item not found"); + + return true; +} + +bool CProjectHistoryHandler::Apply (const SSAddedProjectAction& rAction) +{ + iterator itor = FindItem (rAction.GetPhysical()); + if (itor != m_Items.end()) + m_Items.erase(itor); + else + throw SSException ("item not found"); + + return true; +} + +bool CProjectHistoryHandler::Apply (const SSDeletedFileAction& rAction) +{ + iterator itor = FindItem (rAction.GetPhysical()); + if (itor != m_Items.end ()) + { + SSProjectObject& po = *itor; + po.Recover (); + } + else + throw SSException ("item not found"); + + return true; +} +bool CProjectHistoryHandler::Apply (const SSDeletedProjectAction& rAction) +{ + iterator itor = FindItem (rAction.GetPhysical()); + if (itor != m_Items.end ()) + { + SSProjectObject& po = *itor; + po.Recover (); + } + else + throw SSException ("item not found"); + + return true; +} +bool CProjectHistoryHandler::Apply (const SSRecoveredFileAction& rAction) +{ + iterator itor = FindItem (rAction.GetPhysical()); + if (itor != m_Items.end ()) + { + SSProjectObject& po = *itor; + po.Delete (); + } + else + throw SSException ("item not found"); + + return true; +} +bool CProjectHistoryHandler::Apply (const SSRecoveredProjectAction& rAction) +{ + iterator itor = FindItem (rAction.GetPhysical()); + if (itor != m_Items.end ()) + { + SSProjectObject& po = *itor; + po.Delete (); + } + else + throw SSException ("item not found"); + + return true; +} + +bool CProjectHistoryHandler::Apply (const SSDestroyedProjectAction& rAction) +{ + if (FindItem (rAction.GetPhysical ()) != m_Items.end ()) + throw SSException ("adding already existing item"); + + PROJECT_ENTRY pe; +// pe.flags = ??; + pe.name = rAction.GetSSName (); + strncpy (pe.phys, rAction.GetPhysical().c_str(), 8); + pe.phys[8] = '\0'; + pe.pinnedToVersion = 0; +// pe.type = ?? + SSProjectObject pr (pe); + InsertItem (pr); + + return true; +} + +bool CProjectHistoryHandler::Apply (const SSDestroyedFileAction& rAction) +{ + // durch map wahrscheinlich besser zu lösen + if (FindItem (rAction.GetPhysical()) != m_Items.end ()) + throw SSException ("adding already existing item"); + + PROJECT_ENTRY pe; +// pe.flags = ??; + pe.name = rAction.GetSSName (); + strncpy (pe.phys, rAction.GetPhysical().c_str(), 8); + pe.phys[8] = '\0'; + pe.pinnedToVersion = 0; +// pe.type = ?? + SSProjectObject pr (pe); + InsertItem (pr); + + return true; +} + +bool CProjectHistoryHandler::Apply (const SSRenamedProjectAction& rAction) +{ + iterator itor = FindItem (rAction.GetPhysical()); + if (itor == m_Items.end ()) + throw SSException ("item not found"); + + SSProjectObject& po = *itor; + po.Rename (rAction.GetNewSSName (), rAction.GetSSName()); + return true; +} + +bool CProjectHistoryHandler::Apply (const SSRenamedFileAction& rAction) +{ + iterator itor = FindItem (rAction.GetPhysical()); + if (itor == m_Items.end ()) + throw SSException ("item not found"); + + SSProjectObject& po = *itor; + po.Rename (rAction.GetNewSSName (), rAction.GetSSName()); + return true; +} + + + + + + +void CGetCommand::Execute () +{ + if (m_DestFile.empty ()) + throw SSException ("please specify a destination file for the get operation"); + + if (fexists (m_DestFile.c_str ()) && !m_bForceOverwrite) + throw SSException ("destination file exists. Please use overwrite flag"); + + SSHistoryFile file(m_PhysFile); + std::auto_ptr pItem (file.GetItemInfo()); + if (!pItem.get ()) + throw SSException ("no information object found"); + + std::auto_ptr pVisitor; + std::string lastDataFileName = pItem->GetDataFileName (); + + if (pItem->GetType() == SSITEM_FILE) + pVisitor = std::auto_ptr (new CReverseHistoryHandler (lastDataFileName)); + else + pVisitor = std::auto_ptr (new CProjectHistoryHandler (lastDataFileName)); + + + SSVersionObject version (pItem->GetHistoryLast ()); + while (version && version.GetVersionNumber() > m_Version) + { + if (version.GetAction()) + { + version.GetAction ()->Accept (*pVisitor.get()); + if (m_bBulkGet) + { + char buffer[66]; + CFileName fname (m_PhysFile.c_str ()); + fname.SetExt (itoa (version.GetVersionNumber (), buffer, 10)); + + if (!pVisitor->SaveAs (fname.GetFileName ().c_str(), false)) + throw SSException ("failed to create target file" + fname.GetFileName ()); + } + } + + version = version.GetPreviousObject (); + } + + if (!pVisitor->SaveAs (m_DestFile.c_str(), m_bForceOverwrite)) + throw SSException ("failed to create target file"); +} + diff --git a/ssphys/SSPhys/GetCommand.h b/ssphys/SSPhys/GetCommand.h new file mode 100644 index 0000000..9779686 --- /dev/null +++ b/ssphys/SSPhys/GetCommand.h @@ -0,0 +1,33 @@ +// GetCommand.h: interface for the GetCommand class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_GETCOMMAND_H__26EB05F6_F335_4169_8754_A7BEEF5FB29E__INCLUDED_) +#define AFX_GETCOMMAND_H__26EB05F6_F335_4169_8754_A7BEEF5FB29E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Command.h" + +//--------------------------------------------------------------------------- +class CGetCommand : public CCommand +{ +public: + CGetCommand (); + + virtual COptionInfoList GetOptionsInfo () const; + virtual bool SetOption (const COption& option); + virtual bool SetArguments (CArguments& args); + void Execute (); + +protected: + std::string m_PhysFile; + std::string m_DestFile; + bool m_bForceOverwrite; + bool m_bBulkGet; + int m_Version; +}; + +#endif // !defined(AFX_GETCOMMAND_H__26EB05F6_F335_4169_8754_A7BEEF5FB29E__INCLUDED_) diff --git a/ssphys/SSPhys/GlobalOptions.cpp b/ssphys/SSPhys/GlobalOptions.cpp new file mode 100644 index 0000000..0d7010c --- /dev/null +++ b/ssphys/SSPhys/GlobalOptions.cpp @@ -0,0 +1,122 @@ +// GlobalOptions.cpp: implementation of the CGlobalOptions class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "GlobalOptions.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CGlobalOptions::CGlobalOptions () + : m_bIntegrityCheck (false), +// m_bIncludeDeadRecords (false), +// m_bOnlyLabels (false), +// m_bIncludeLabels (true), + m_bHelp (false), + m_bAllRecords (false), + m_bOnlyRecords (false), + m_pVersionFilter (NULL), + m_Version (0), + m_bForceOverwrite (false), + m_Style (eVSS) +{ +} + +CGlobalOptions::~CGlobalOptions () +{ + DELETE (m_pVersionFilter); +} + +COptionInfoList CGlobalOptions::GetOptionsInfo () const +{ + COptionInfoList options = COptions::GetOptionsInfo(); + options.push_back (COptionInfo ('h', 'h', "help", "print help information", COptionInfo::noArgument)); + options.push_back (COptionInfo ('n', 'n', "names", "filename of the the names.dat file to use", COptionInfo::requiredArgument)); + options.push_back (COptionInfo ('b', 'b', "binary", "binary dump the output", COptionInfo::tristateArgument)); + options.push_back (COptionInfo ('s', 's', "style", "define the output style {binary|xml|vss|dump}", COptionInfo::requiredArgument)); + return options; +// if (IsArgChar (argv[i][1], 'l')) +// { +// m_bOnlyLabels = true; +// m_bIncludeLabels = ToBool (argv[i][2]); +// } +// else if (IsLongArgument (&argv[i][1], "del")) +// { +// m_bIncludeDeadRecords = true; +// } +// else +// if (IsArgChar (argv[i][1], 'h') || IsLongArgument (&argv[i][1], "help")) +// { +// m_bHelp = true; +// } +// else if (IsArgChar (argv[i][1], 'n') || IsLongArgument (&argv[i][1], "names")) +// { +// if (++i < argc) +// m_NamesDat = argv[i]; +// } +// else if (IsArgChar (argv[i][1], 'a') || IsLongArgument (&argv[i][1], "all")) +// { +// m_bAllRecords = true; +// } +// else if (IsArgChar (argv[i][1], 'r')) +// { +// m_bOnlyRecords = true; +// } +// else if (IsArgChar (argv[i][1], 'f') || IsLongArgument (&argv[i][1], "force")) +// { +// m_bForceOverwrite = true; +// } +// else if (IsArgChar (argv[i][1], 'v') || IsLongArgument (&argv[i][1], "version")) +// { +// std::string filter; +// if (IsArgChar (argv[i][1], 'v')) +// filter = &argv[i][2]; +// else if (++i < argc) +// filter = argv[i]; +// +// int start; +// char tilde; +// std::istrstream ist (filter.c_str (), filter.length()); +// ist >> start; +// int end = start; +// ist >> tilde; +// ist >> end; +// +// DELETE (m_pVersionFilter); +// m_pVersionFilter = new CVersionRangeFilter (end, start); +// +// m_Version = start; +// } +} + +bool CGlobalOptions::SetOption (const COption& option) +{ + switch (option.id) + { + case 'h': + m_bHelp = true; break; + case 'n': + m_NamesDat = (const char*)option.value; break; + case 'b': + m_Style = eBinary; + m_StyleValue = option.value; + break; + case 's': + if (stricmp ("binary", option.value) == 0) + m_Style = eBinary; + else if (stricmp ("XML", option.value) == 0) + m_Style = eXML; + else if (stricmp ("vss", option.value) == 0) + m_Style = eVSS; + else if (stricmp ("dump", option.value) == 0) + m_Style = eDump; + else + throw SSException ("unkown style"); + break; + default: + return false; + } + return true; +} diff --git a/ssphys/SSPhys/GlobalOptions.h b/ssphys/SSPhys/GlobalOptions.h new file mode 100644 index 0000000..640f121 --- /dev/null +++ b/ssphys/SSPhys/GlobalOptions.h @@ -0,0 +1,48 @@ +// GlobalOptions.h: interface for the CGlobalOptions class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_GLOBALOPTIONS_H__AD5486F4_24B4_42E6_AB0A_0E11E9284F30__INCLUDED_) +#define AFX_GLOBALOPTIONS_H__AD5486F4_24B4_42E6_AB0A_0E11E9284F30__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Options.h" +#include "VersionFilter.h" +#include "Formatter.h" + + +class CGlobalOptions : public COptions +{ +public: + CGlobalOptions (); + virtual ~CGlobalOptions (); + + virtual COptionInfoList GetOptionsInfo () const; + virtual bool SetOption (const COption& option); + + bool GetHelp () const { return m_bHelp; } +// std::string GetNamesCache () const { return m_NamesDat; } + bool GetAllRecords () const { return m_bAllRecords; } + bool GetOnlyRecords () const { return m_bOnlyRecords; } + + eStyle GetStyle () const { return m_Style; } + + std::string m_Command; + bool m_bIntegrityCheck; + bool m_bHelp; + bool m_bAllRecords; + bool m_bOnlyRecords; + std::string m_NamesDat; + CVersionFilter* m_pVersionFilter; + int m_Version; + std::string m_Dest; + bool m_bForceOverwrite; + eStyle m_Style; + tristate m_StyleValue; + +}; + +#endif // !defined(AFX_GLOBALOPTIONS_H__AD5486F4_24B4_42E6_AB0A_0E11E9284F30__INCLUDED_) diff --git a/ssphys/SSPhys/HelpCommand.cpp b/ssphys/SSPhys/HelpCommand.cpp new file mode 100644 index 0000000..08e1de1 --- /dev/null +++ b/ssphys/SSPhys/HelpCommand.cpp @@ -0,0 +1,40 @@ +// HelpCommand.cpp: implementation of the CHelpCommand class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "HelpCommand.h" +#include "CommandFactory.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +extern void PrintUsage (); + +bool CHelpCommand::SetArguments (CArguments& args) +{ + if (m_pFactory && !args.empty ()) + { + m_pCommand = std::auto_ptr (m_pFactory->MakeCommand (args.front ())); + args.pop (); + return true; + } + return false; +} + +void CHelpCommand::Execute () +{ + if (m_pCommand.get ()) + { + m_pCommand->PrintUsage (); + } + else if (m_pFactory) + { + ::PrintUsage (); + } +} + +bool CHelpCommand::SetOption (const COption& option) +{ + return false; +} diff --git a/ssphys/SSPhys/HelpCommand.h b/ssphys/SSPhys/HelpCommand.h new file mode 100644 index 0000000..c8a9551 --- /dev/null +++ b/ssphys/SSPhys/HelpCommand.h @@ -0,0 +1,35 @@ +// HelpCommand.h: interface for the CHelpCommand class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_HELPCOMMAND_H__653D5862_B13A_46B2_8AA1_55E8D414AE54__INCLUDED_) +#define AFX_HELPCOMMAND_H__653D5862_B13A_46B2_8AA1_55E8D414AE54__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Command.h" +#include + +class CCommandFactory; +//--------------------------------------------------------------------------- +class CHelpCommand : public CCommand +{ +public: + CHelpCommand (CCommandFactory* pFactory = NULL) + : CCommand ("help"), m_pFactory (pFactory) + { + } + + virtual bool SetOption (const COption& option); + virtual bool SetArguments (CArguments& args); + void Execute (); + +protected: + CCommandFactory* m_pFactory; + std::auto_ptr m_pCommand; +}; + + +#endif // !defined(AFX_HELPCOMMAND_H__653D5862_B13A_46B2_8AA1_55E8D414AE54__INCLUDED_) diff --git a/ssphys/SSPhys/HistoryCommand.cpp b/ssphys/SSPhys/HistoryCommand.cpp new file mode 100644 index 0000000..ce33f60 --- /dev/null +++ b/ssphys/SSPhys/HistoryCommand.cpp @@ -0,0 +1,86 @@ +// HistoryCommand.cpp: implementation of the CHistoryCommand class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "HistoryCommand.h" +#include "VersionFilter.h" +#include "Formatter.h" +#include + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +//--------------------------------------------------------------------------- +CHistoryCommand::CHistoryCommand () + : CCommand ("history"), + m_bIncludeDeadRecords (false), + m_bIncludeLabels (false), + m_bIncludeActions (true) +{ +} + +COptionInfoList CHistoryCommand::GetOptionsInfo () const +{ + COptionInfoList options = CCommand::GetOptionsInfo(); + options.push_back (COptionInfo ('d', 'd', "dead", "include dead records", COptionInfo::tristateArgument)); + options.push_back (COptionInfo ('l', 'l', "label", "include label records", COptionInfo::tristateArgument)); + return options; +} + +bool CHistoryCommand::SetOption (const COption& option) +{ + switch (option.id) + { + case 'd': + m_bIncludeDeadRecords = true; + m_bOnlyDeadRecords &= option.value.pTristateValue; + break; + case 'l': + m_bIncludeLabels = true; + if (option.value.pTristateValue == set) + m_bIncludeActions = false; + else if (option.value.pTristateValue == cleared) + m_bIncludeLabels = false; + break; + default: + return false; + } + return true; +} + +bool CHistoryCommand::SetArguments (CArguments& args) +{ + if (args.empty ()) + throw SSException ("no argument"); + + m_PhysFile = args.front (); + args.pop (); + return true; +} + +void CHistoryCommand::Execute () +{ + SSHistoryFile file(m_PhysFile); + + const CVersionFilter* pFilter = NULL; // m_pOptions->GetVersionFilter (); +// std::auto_ptr pFormatter (CVssFormatterFactory::MakeFormatter()); + + SSVersionObject version = file.GetLastVersion(); + while (version) + { + bool bFiltered = pFilter ? pFilter->Filter(&version) : false; + + if (!m_bIncludeLabels && version.GetActionID () == Labeled) + bFiltered = true; + + if (!m_bIncludeActions && version.GetActionID () != Labeled) + bFiltered = true; + + if (!bFiltered) + g_pFormatter->Format (version); + + version = file.GetPrevVersion(version); + } +} diff --git a/ssphys/SSPhys/HistoryCommand.h b/ssphys/SSPhys/HistoryCommand.h new file mode 100644 index 0000000..f90faf6 --- /dev/null +++ b/ssphys/SSPhys/HistoryCommand.h @@ -0,0 +1,33 @@ +// HistoryCommand.h: interface for the CHistoryCommand class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_HISTORYCOMMAND_H__1B5F69F1_AF4A_40D2_A135_954A4DF610BC__INCLUDED_) +#define AFX_HISTORYCOMMAND_H__1B5F69F1_AF4A_40D2_A135_954A4DF610BC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Command.h" + +//--------------------------------------------------------------------------- +class CHistoryCommand : public CCommand +{ +public: + CHistoryCommand (); + + virtual COptionInfoList GetOptionsInfo () const; + virtual bool SetOption (const COption& option); + virtual bool SetArguments (CArguments& args); + void Execute (); + +protected: + std::string m_PhysFile; + bool m_bIncludeDeadRecords; + bool m_bOnlyDeadRecords; + bool m_bIncludeLabels; + bool m_bIncludeActions; +}; + +#endif // !defined(AFX_HISTORYCOMMAND_H__1B5F69F1_AF4A_40D2_A135_954A4DF610BC__INCLUDED_) diff --git a/ssphys/SSPhys/InfoCommand.cpp b/ssphys/SSPhys/InfoCommand.cpp new file mode 100644 index 0000000..0fcdcb0 --- /dev/null +++ b/ssphys/SSPhys/InfoCommand.cpp @@ -0,0 +1,98 @@ +// InfoCommand.cpp: implementation of the CInfoCommand class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "InfoCommand.h" +#include "Formatter.h" +#include +#include + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CInfoCommand::CInfoCommand() + : CCommand ("info"), + m_bOnlyRecords (false), + m_bAllRecords (false), + m_bDisplayAtOffset (false), + m_Offset (0) +{ + +} + +COptionInfoList CInfoCommand::GetOptionsInfo () const +{ + COptionInfoList options = CCommand::GetOptionsInfo(); + options.push_back (COptionInfo ('a', 'a', "all", "display information about all records", COptionInfo::noArgument)); + options.push_back (COptionInfo ('r', 'r', "records", "display basic information about the records", COptionInfo::noArgument)); + options.push_back (COptionInfo ('o', 'o', "offset", "display record at specific offset", COptionInfo::requiredArgument)); + return options; +} + +bool CInfoCommand::SetOption (const COption& option) +{ + switch (option.id) + { + case 'a': + m_bAllRecords = true; + break; + case 'r': + m_bOnlyRecords = true; + break; + case 'o': + m_bDisplayAtOffset = true; + m_Offset = atoi ((const char*) option.value); + break; + default: + return false; + } + return true; +} + +bool CInfoCommand::SetArguments (CArguments& args) +{ + if (args.empty ()) + throw SSException ("no argument"); + + m_PhysFile = args.front (); + args.pop (); + return true; +} + +void CInfoCommand::Execute () +{ + std::auto_ptr pFile (SSRecordFile::MakeFile (m_PhysFile)); + g_pFormatter->SetFileName (m_PhysFile); +// std::auto_ptr pFormatter (CPhysFormatterFactory::MakeFormatter ()); + if (pFile.get ()) + { + if (m_bAllRecords) + { + SSRecordPtr pRecord = pFile->GetFirstRecord(); + while (pRecord) + { + if (m_bOnlyRecords) + { + pRecord->Dump (std::cout); + } + else + { + std::auto_ptr pObject (SSObject::MakeObject(pRecord)); + g_pFormatter->Format (*pObject); + std::cout << std::endl; + } + pRecord = pFile->FindNextRecord(pRecord); + } + } + else if (m_bDisplayAtOffset) + { + SSRecordPtr pRecord = pFile->GetRecord(m_Offset); + std::auto_ptr pObject (SSObject::MakeObject(pRecord)); + g_pFormatter->Format (*pObject); + } + else + pFile->Dump (std::cout); + } +} \ No newline at end of file diff --git a/ssphys/SSPhys/InfoCommand.h b/ssphys/SSPhys/InfoCommand.h new file mode 100644 index 0000000..6d28806 --- /dev/null +++ b/ssphys/SSPhys/InfoCommand.h @@ -0,0 +1,33 @@ +// InfoCommand.h: interface for the CInfoCommand class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_INFOCOMMAND_H__44ECA882_85A1_410E_B764_E2AF098446C7__INCLUDED_) +#define AFX_INFOCOMMAND_H__44ECA882_85A1_410E_B764_E2AF098446C7__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Command.h" + +//--------------------------------------------------------------------------- +class CInfoCommand : public CCommand +{ +public: + CInfoCommand (); + + virtual COptionInfoList GetOptionsInfo () const; + virtual bool SetOption (const COption& option); + virtual bool SetArguments (CArguments& args); + void Execute (); + +protected: + std::string m_PhysFile; + bool m_bAllRecords; + bool m_bOnlyRecords; + bool m_bDisplayAtOffset; + int m_Offset; +}; + +#endif // !defined(AFX_INFOCOMMAND_H__44ECA882_85A1_410E_B764_E2AF098446C7__INCLUDED_) diff --git a/ssphys/SSPhys/Options.cpp b/ssphys/SSPhys/Options.cpp new file mode 100644 index 0000000..ac7337c --- /dev/null +++ b/ssphys/SSPhys/Options.cpp @@ -0,0 +1,92 @@ +// Options.cpp: implementation of the COptions class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Options.h" +#include + +//--------------------------------------------------------------------------- +#include "LeakWatcher.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + + + + +//--------------------------------------------------------------------------- +COptionInfo::COptionInfo (int id, char shortOption, std::string longOption, std::string descr, eArgType needArg) +: m_Id (id), + m_shortOption (shortOption), + m_longOption (longOption), + m_Description (descr), + m_needArg (needArg) +{ +} + +std::ostream& operator<<(std::ostream& os, const COptionInfo& info) +{ + os << " "; + if (info.m_shortOption) + { + os << " -" << info.m_shortOption; + switch (info.m_needArg) + { + case COptionInfo::requiredArgument: + os << " ARG"; + break; + case COptionInfo::optionalArgument: + os << " [ARG]"; + break; + case COptionInfo::tristateArgument: + os << "[+|-]"; + break; + } + + if (!info.m_longOption.empty ()) + os << ","; + } + else + os << " "; + + if (!info.m_longOption.empty ()) + os << " --" << info.m_longOption; + + switch (info.m_needArg) + { + case COptionInfo::requiredArgument: + os << " ARG"; + break; + case COptionInfo::optionalArgument: + os << " [ARG]"; + break; + case COptionInfo::tristateArgument: + os << "[+|-]"; + break; + } + + os << "\t" << info.m_Description << std::endl; + + return os; +} + + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +void COptions::PrintUsage () const +{ + COptionInfoList optionsList (GetOptionsInfo ()); + COptionInfoList::const_iterator itor = optionsList.begin (); + while (itor != optionsList.end ()) + { + const COptionInfo& info = *itor++; + std::cout << info; + } + std::cout << std::endl; +} \ No newline at end of file diff --git a/ssphys/SSPhys/Options.h b/ssphys/SSPhys/Options.h new file mode 100644 index 0000000..e1e605e --- /dev/null +++ b/ssphys/SSPhys/Options.h @@ -0,0 +1,114 @@ +// Options.h: interface for the COptions class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OPTIONS_H__8B59AD68_C12F_44E7_9236_3C800593E961__INCLUDED_) +#define AFX_OPTIONS_H__8B59AD68_C12F_44E7_9236_3C800593E961__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include + + +//--------------------------------------------------------------------------- +enum tristate { cleared, undefined, set }; + +inline void operator &= (bool& _bool, tristate _tristate) +{ + _bool = _tristate == undefined ? _bool : _tristate == cleared ? false : true; +} + + +//--------------------------------------------------------------------------- +struct CValue +{ + CValue () + : m_Type (typeUndefined) + { } + CValue (tristate val) + : m_Type (typeTristate), pTristateValue (val) + { } + CValue (const char* pVal) + : m_Type (typeString), m_pStringValue (pVal) + { } + CValue (const bool val) + : m_Type (typeBool), pBoolValue(val) + { } + + enum { typeUndefined, typeTristate, typeBool, typeString} m_Type; + union { + tristate pTristateValue; + bool pBoolValue; + const char* m_pStringValue; + }; + + operator const char* () const + { + assert (m_Type == typeString); + return m_pStringValue; + } + + operator tristate () const + { + assert (m_Type == typeTristate); + return pTristateValue; + } + +}; + +struct COption +{ + int id; + CValue value; +}; + +typedef std::list COptionsList; + +struct COptionInfo +{ +public: + enum eArgType { noArgument, requiredArgument, optionalArgument, tristateArgument }; + + COptionInfo (int id, char shortOption, std::string longOption, std::string descr, eArgType needArg); + + int m_Id; + char m_shortOption; + std::string m_longOption; + std::string m_Description; + eArgType m_needArg; +}; + +std::ostream& operator<<(std::ostream& os, const COptionInfo& info); + +typedef std::list COptionInfoList; + + +class COptions +{ +public: + virtual ~COptions () {}; + + virtual COptionInfoList GetOptionsInfo () const + { + return COptionInfoList (); + } + void SetOptions (const COptionsList& options) + { + COptionsList::const_iterator itor = options.begin (); + while (itor != options.end()) + { +// if (!SetOption (*itor)) +// throw SSException ("unknown option"); + SetOption (*itor); + ++itor; + } + } + virtual bool SetOption (const COption& option) = 0; + + virtual void PrintUsage () const; +}; + + +#endif // !defined(AFX_OPTIONS_H__8B59AD68_C12F_44E7_9236_3C800593E961__INCLUDED_) diff --git a/ssphys/SSPhys/PropertiesCommand.cpp b/ssphys/SSPhys/PropertiesCommand.cpp new file mode 100644 index 0000000..142dc53 --- /dev/null +++ b/ssphys/SSPhys/PropertiesCommand.cpp @@ -0,0 +1,71 @@ +// PropertiesCommand.cpp: implementation of the CPropertiesCommand class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "PropertiesCommand.h" +#include "Formatter.h" +#include +#include +#include + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +//--------------------------------------------------------------------------- +CPropertiesCommand::CPropertiesCommand () + : CCommand ("properties") +{ +} + +COptionInfoList CPropertiesCommand::GetOptionsInfo () const +{ + COptionInfoList options = CCommand::GetOptionsInfo(); + return options; +} + +bool CPropertiesCommand::SetOption (const COption& option) +{ + return false; +} + +bool CPropertiesCommand::SetArguments (CArguments& args) +{ + if (args.empty ()) + throw SSException ("no argument"); + + m_PhysFile = args.front (); + args.pop (); + return true; +} + +void CPropertiesCommand::Execute () +{ + std::auto_ptr file (SSRecordFile::MakeFile(m_PhysFile)); + if (file.get ()) + { + SSHistoryFile* pHistory = dynamic_cast (file.get()); + SSProjectFile* pProject = dynamic_cast (file.get()); + + if (pHistory) + { + std::auto_ptr info (pHistory->GetItemInfo ()); + if (info.get()) + g_pFormatter->Format (*info, this); + } + else if (pProject) + { + SSRecordPtr record (pProject->GetFirstRecord()); + while (record) + { + SSProjectObject project (record); + g_pFormatter->Format (project, this); + record = pProject->GetNextRecord(record); + } + + } + else + throw SSException ("xxx is not a history file, nor a project file"); + } +} \ No newline at end of file diff --git a/ssphys/SSPhys/PropertiesCommand.h b/ssphys/SSPhys/PropertiesCommand.h new file mode 100644 index 0000000..06f3e7b --- /dev/null +++ b/ssphys/SSPhys/PropertiesCommand.h @@ -0,0 +1,32 @@ +// PropertiesCommand.h: interface for the CPropertiesCommand class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_PROPERTIESCOMMAND_H__0F1C2110_04E9_4DC1_A999_D40711F4DE15__INCLUDED_) +#define AFX_PROPERTIESCOMMAND_H__0F1C2110_04E9_4DC1_A999_D40711F4DE15__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Command.h" +#include "Formatter.h" + +class CPropertiesCommand : public CCommand, public IFormattingContext +{ +public: + CPropertiesCommand (); + + virtual COptionInfoList GetOptionsInfo () const; + virtual bool SetOption (const COption& option); + virtual bool SetArguments (CArguments& args); + void Execute (); + + // IFormattingContext + virtual bool GetExtendedOutput () const { return true; } + +protected: + std::string m_PhysFile; +}; + +#endif // !defined(AFX_PROPERTIESCOMMAND_H__0F1C2110_04E9_4DC1_A999_D40711F4DE15__INCLUDED_) diff --git a/ssphys/SSPhys/SSTests.cpp b/ssphys/SSPhys/SSTests.cpp new file mode 100644 index 0000000..b673a17 --- /dev/null +++ b/ssphys/SSPhys/SSTests.cpp @@ -0,0 +1,212 @@ +// SSTests.cpp: implementation of the SSTests class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSTests.h" +#include +#include +#include + +//#include +//namespace fs = boost::filesystem; + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +void TestComments (SSFile& file) +{ + SSRecordPtr pRecord; + int nCommentRecords = 0; + int nComments = 0; + for (pRecord = file.GetFirstRecord (); pRecord; ) + { + if (pRecord->GetType () == eCommentRecord) + { + nCommentRecords++; + } + else if (pRecord->GetType () == eHistoryRecord) + { +// std::auto_ptr pVersion (SSVersionObject::MakeVersion(pRecord)); +// SSLabeledAction* pAction = dynamic_cast (pVersion.get()); + std::auto_ptr pVersion (new SSVersionObject (file.GetFileImp(), pRecord)); + SSLabeledAction* pAction = dynamic_cast (pVersion.get()); + + // es gibt bishet anscheinend immer nur einen Comment oder einen LabelComment, + // bzw. Comment und LabelComment sind identisch + if (!pVersion->GetComment ().empty() || (pAction && pAction->GetLabelComment ().empty())) + { + nComments++; + } + } + pRecord = file.GetNextRecord (pRecord); + } + + assert (nComments == nCommentRecords); +} + +void CheckOffsetsToComment (SSFile& file) +{ +#if 0 + SSRecordPtr pRecord; + for (pRecord = file.GetFirstRecord (); pRecord; ) + { + if (pRecord->GetType () == eHistoryRecord) + { + std::auto_ptr pVersion (SSVersionObject::MakeVersion(pRecord)); + const VERSION_RECORD* pV = reinterpret_cast (pVersion->GetDataPtr ()); + +// std::cout << std::hex << pV->offsetToLabelComment <offsetToLabelComment) + { + SSRecordPtr pNext = file.GetRecord (pV->offsetToLabelComment); +// assert (pNext->GetType () == eCommentRecord); + } + + // im Labeled Fall zeigt offsetToNextRecordOrComment immer auf einen MC record + if (pVersion->GetActionId () == Labeled && pV->offsetToNextRecordOrComment) + { + SSRecordPtr pNext = file.GetRecord (pV->offsetToNextRecordOrComment); +// assert (pNext->GetType () == eCommentRecord); + } + + // offsetToNextRecordOrComment zeigt immer auf den nächsten in der List + if (pV->offsetToNextRecordOrComment) + { +// assert (pV->offsetToNextRecordOrComment == pRecord->GetNextOffset ()); + } + + } + pRecord = file.GetNextRecord (pRecord); + } +#endif +} + +void CheckLabelValid (SSFile& file) +{ +#if 0 + SSRecordPtr pRecord; + for (pRecord = file.GetFirstRecord (); pRecord; ) + { + if (pRecord->GetType () == eHistoryRecord) + { + std::auto_ptr pVersion (SSVersionObject::MakeVersion(pRecord)); + const VERSION_RECORD* pV = reinterpret_cast (pVersion->GetDataPtr ()); + SSLabeledAction* pAction = dynamic_cast (pVersion.get()); + + if (pAction) + { + if (pV->offsetToLabelComment) + { + SSRecordPtr pComment1 = file.GetRecord (pV->offsetToLabelComment); + assert (pV->lengthLabelComment == pComment1->GetLen ()); + } + // BUG: Nach dem Löschen eines Labels wird eigentlich das erste char des Label auf 0 gesetzt und der + // Label comment gelöscht. (neuer MC eintrag mit Länge 1) der Comment wird nicht angefaßt. Anscheinend + // kann es aber passieren, daß die Länge des Comment auf 0 gesetzt wird, obwohl der Eintrag auf einen + // leeren 1 Byte langen Comment verweist. + // Ich bin mir noch nicht sicher, ob das ein Bug oder ein Feature ist + if (pV->lengthComment != 0 && + pV->offsetToNextRecordOrComment && pV->offsetToNextRecordOrComment != pV->offsetToLabelComment ) + { + SSRecordPtr pComment2 = file.GetRecord (pV->offsetToNextRecordOrComment); + assert (pV->lengthComment == pComment2->GetLen ()); + } + } + + } + pRecord = file.GetNextRecord (pRecord); + } +#endif +} + +void CheckFileSize (SSHistoryFile& file) +{ + std::auto_ptr pItem (file.GetItemInfo()); + assert (pItem.get () && "no item found in this file"); +} + +void IntegrityCheck (SSHistoryFile& file) +{ + // 1.) run the linear list of records, one record is succeeded by another record + try { + SSRecordPtr pRecord = file.GetFirstRecord (); + while (pRecord) + { + pRecord = file.GetNextRecord (pRecord); + } + } + catch (SSException& ex) + { + std::cout << "Warning while testing linear: " << ex.what () << std::endl; + } + + // 2.) run the linked list of records + try { + std::auto_ptr pItem (file.GetItemInfo()); + if (pItem.get ()) + { + for (int i = pItem->GetNumberOfActions (); i> 0; i--) + { + std::auto_ptr pVersion (pItem->GetVersion (i)); + std::string pComment = pVersion->GetComment(); + } + } + } + catch (SSException& ex) { + std::cout << "Warning while testing linked history list: " << ex.what () << std::endl; + } + + // 3.) run the parent project linked list +// try { +// SSItemInfo* pItem = file.GetItem (); +// if (pItem) +// { +// for (int i = pItem->GetNumberOfParents (); i> 0; i--) +// { +// SSVersionObject* pVersion = pItem->GetParent (i); +// } +// } +// } +// catch (SSException& ex) { +// std::cout << "Warning while testing linked parent project list: " << ex.what () << std::endl; +// } +} + + +void DumpNamesCache (SSNamesCacheFile& namesCache) +{ + SSRecordPtr pRecord; + for (pRecord = namesCache.GetFirstRecord (); pRecord; ) + { + if (pRecord->GetType () == eNameCacheEntry) + { + SSNameObject name (namesCache.GetFileImp(), pRecord); + name.Dump (std::cout); + } + pRecord = namesCache.GetNextRecord (pRecord); + } +} + + +//void TestSrcSafeIni (const COptions& options) +//{ +// fs::path basePath = fs::path(options.GetSrcSafeIniPath (), fs::native); +// +// std::string database = options.GetDatabase (); +// if (!database.empty()) +// { +// database = " (" + database + ")"; +// } +// +// if (!basePath.empty ()) +// { +// fs::path srcSafeIni = basePath / "srcsafe.ini"; +// fs::path dataPath = basePath / CIniFile::GetValue("Data_Path" + database, "", srcSafeIni.string()); +// fs::path usersPath = basePath / CIniFile::GetValue("Users_Path"+ database, "", srcSafeIni.string()); +// fs::path usersText = basePath / CIniFile::GetValue("Users_Text"+ database, "", srcSafeIni.string()); +// fs::path tempPath = basePath / CIniFile::GetValue("Temp_Path" + database, "", srcSafeIni.string()); +// } +//} diff --git a/ssphys/SSPhys/SSTests.h b/ssphys/SSPhys/SSTests.h new file mode 100644 index 0000000..a898431 --- /dev/null +++ b/ssphys/SSPhys/SSTests.h @@ -0,0 +1,23 @@ +// SSTests.h: interface for the SSTests class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSTESTS_H__E200002C_BA5E_4EE9_8CA6_8991A0BE378F__INCLUDED_) +#define AFX_SSTESTS_H__E200002C_BA5E_4EE9_8CA6_8991A0BE378F__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include +#include "CommandLine.h" + +void CheckOffsetsToComment (SSRecordFile& file); +void CheckLabelValid (SSRecordFile& file); +void CheckFileSize (SSHistoryFile& file); +void DumpNamesCache (SSNamesCacheFile& namesCache); +void TestSrcSafeIni (const CCommandLine& options); + + + +#endif // !defined(AFX_SSTESTS_H__E200002C_BA5E_4EE9_8CA6_8991A0BE378F__INCLUDED_) diff --git a/ssphys/SSPhys/StdAfx.cpp b/ssphys/SSPhys/StdAfx.cpp new file mode 100644 index 0000000..d31e390 --- /dev/null +++ b/ssphys/SSPhys/StdAfx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// ssphys.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/ssphys/SSPhys/StdAfx.h b/ssphys/SSPhys/StdAfx.h new file mode 100644 index 0000000..91953e5 --- /dev/null +++ b/ssphys/SSPhys/StdAfx.h @@ -0,0 +1,54 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__2A1522EC_5D1E_4342_944F_2A3917F67CA6__INCLUDED_) +#define AFX_STDAFX_H__2A1522EC_5D1E_4342_944F_2A3917F67CA6__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include + +// TODO: reference additional headers your program requires here +#include "assert.h" + +#pragma warning (disable: 4786) +#include +#include +#include +#include + +#include + +//--------------------------------------------------------------------------- +#define countof(x) (sizeof(x) / sizeof(x[0])) +//#define RELEASE(x) if (x) (x)->Release (); +#define DELETE(x) { delete (x); x = NULL; } + +typedef std::vector StringVector; + +//--------------------------------------------------------------------------- +void Info (const char* message); +void Notice (const char* message); +void Warning (const char* message); +void Error (const char* message); + +#define warn_if(x) (x) ? Warning (#x), false : true; +#define warn_with_msg_if(x,y) (x) ? Warning (y), false : true; + + + +#include + + + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__2A1522EC_5D1E_4342_944F_2A3917F67CA6__INCLUDED_) diff --git a/ssphys/SSPhys/ValidateCommand.cpp b/ssphys/SSPhys/ValidateCommand.cpp new file mode 100644 index 0000000..4f7a16d --- /dev/null +++ b/ssphys/SSPhys/ValidateCommand.cpp @@ -0,0 +1,53 @@ +// ValidateCommand.cpp: implementation of the ValidateCommand class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ValidateCommand.h" +#include +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +//--------------------------------------------------------------------------- +CValidateCommand::CValidateCommand () + : CCommand ("validate") +{ +} + +COptionInfoList CValidateCommand::GetOptionsInfo () const +{ + COptionInfoList options = CCommand::GetOptionsInfo(); + return options; +} + +bool CValidateCommand::SetOption (const COption& option) +{ + return true; +} + +bool CValidateCommand::SetArguments (CArguments& args) +{ + if (args.empty ()) + throw SSException ("no argument"); + + m_PhysFile = args.front (); + args.pop (); + return true; +} + +void CValidateCommand::Execute () +{ + try + { + std::auto_ptr pFile (SSRecordFile::MakeFile (m_PhysFile)); + if (pFile.get()) + { + pFile->Validate (); + } + } + catch (SSException& ex) + { + std::cerr << "error: " << ex.what() << std::endl; + } +} diff --git a/ssphys/SSPhys/ValidateCommand.h b/ssphys/SSPhys/ValidateCommand.h new file mode 100644 index 0000000..f9154bc --- /dev/null +++ b/ssphys/SSPhys/ValidateCommand.h @@ -0,0 +1,30 @@ +// ValidateCommand.h: interface for the ValidateCommand class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_VALIDATECOMMAND_H__9B7719D1_E912_4A98_BD7A_A4581CBCEE9B__INCLUDED_) +#define AFX_VALIDATECOMMAND_H__9B7719D1_E912_4A98_BD7A_A4581CBCEE9B__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Command.h" + +//--------------------------------------------------------------------------- +class CValidateCommand : public CCommand +{ +public: + CValidateCommand (); + + virtual COptionInfoList GetOptionsInfo () const; + virtual bool SetOption (const COption& option); + virtual bool SetArguments (CArguments& args); + void Execute (); + +protected: + std::string m_PhysFile; +}; + + +#endif // !defined(AFX_VALIDATECOMMAND_H__9B7719D1_E912_4A98_BD7A_A4581CBCEE9B__INCLUDED_) diff --git a/ssphys/SSPhys/VersionFilter.cpp b/ssphys/SSPhys/VersionFilter.cpp new file mode 100644 index 0000000..f42846b --- /dev/null +++ b/ssphys/SSPhys/VersionFilter.cpp @@ -0,0 +1,11 @@ +// VersionFilter.cpp: implementation of the CVersionFilter class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "VersionFilter.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + diff --git a/ssphys/SSPhys/VersionFilter.h b/ssphys/SSPhys/VersionFilter.h new file mode 100644 index 0000000..fab1e13 --- /dev/null +++ b/ssphys/SSPhys/VersionFilter.h @@ -0,0 +1,54 @@ +// VersionFilter.h: interface for the CVersionFilter class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_VERSIONFILTER_H__66CEFF72_78D5_4F75_A69C_FCEC324CF8FD__INCLUDED_) +#define AFX_VERSIONFILTER_H__66CEFF72_78D5_4F75_A69C_FCEC324CF8FD__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include +#include + +class CVersionFilter +{ +public: + virtual ~CVersionFilter () {} + virtual bool Filter (SSObject* pObject) const = 0; +}; + +class CVersionRangeFilter : public CVersionFilter +{ +public: + CVersionRangeFilter (int lower, int upper) + : m_Lower (lower), m_Upper (upper) + { + } + + virtual bool Filter (SSObject* pObject) const + { + SSVersionObject* pAction = dynamic_cast (pObject); + if (pAction) + { + if (pAction->GetVersionNumber() >= m_Lower && pAction->GetVersionNumber() <= m_Upper) + return true; + } + return false; + } + +private: + int m_Lower, m_Upper; +}; + +class CVersionSingleFilter : public CVersionRangeFilter +{ +public: + CVersionSingleFilter (int version) + : CVersionRangeFilter (version, version) + { + } +}; + +#endif // !defined(AFX_VERSIONFILTER_H__66CEFF72_78D5_4F75_A69C_FCEC324CF8FD__INCLUDED_) diff --git a/ssphys/SSPhys/ssphys.cpp b/ssphys/SSPhys/ssphys.cpp new file mode 100644 index 0000000..d84d46a --- /dev/null +++ b/ssphys/SSPhys/ssphys.cpp @@ -0,0 +1,174 @@ +// ssphys.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" + +#include "SSTests.h" +#include "CommandLine.h" +#include "Command.h" +#include "GlobalOptions.h" + +//--------------------------------------------------------------------------- +void Info (const char* message) +{ + std::cerr << "INFO: " << message << std::endl; +} + +void Notice (const char* message) +{ + std::cerr << "NOTICE: " << message << std::endl; +} + +void Warning (const char* message) +{ + std::cerr << "WARNING: " << message << std::endl; +} + +void Error (const char* message) +{ + std::cerr << "ERROR: " << message << std::endl; +} + + +//--------------------------------------------------------------------------- +void PrintUsage () +{ + std::cout << "ssphys v0.16:" << std::endl; + std::cout << std::endl; + std::cout << "usage:" << std::endl; + + CGlobalOptions globalOptions; + std::cout << "general options: " << std::endl; + globalOptions.PrintUsage (); + + CCommandFactory factory; + factory.PrintUsage (); +} + +//--------------------------------------------------------------------------- +extern std::auto_ptr g_pFormatter (NULL); + +//--------------------------------------------------------------------------- +int main(int argc, char* argv[]) +{ + CCommandLine commandline; + CGlobalOptions globalOptions; + CCommandFactory factory; + + commandline.SetOptionsInfo (globalOptions.GetOptionsInfo ()); + commandline.SetCommandFactory (&factory); + + try + { + commandline.Parse (argc, argv); + + COptionsList options = commandline.GetOptions (); + + globalOptions.SetOptions (options); + if (globalOptions.GetHelp ()) + { + PrintUsage(); + return 0; + } + + // Load the names cache +// SSNamesCacheFile namesCache; +// if (!options.GetNamesCache ().empty ()) +// { +// try { +// if (namesCache.Open (options.GetNamesCache ())) +// g_NamesCache.SetFile (&namesCache); +// } +// catch (SSException& ex) +// { +// std::cerr << "names cache error: " << ex.what() << std::endl; +// } +// } + + g_pFormatter = CFormatterFactory::MakeFormatter (globalOptions.GetStyle (), globalOptions.m_StyleValue); +// g_pFormatter->SetOptions (options); + + std::auto_ptr pCommand (factory.MakeCommand (commandline.GetCommand ())); + if (pCommand.get ()) + { + pCommand->SetOptions (options); + + CArguments& args= commandline.GetArgs (); + while (!args.empty ()) + { + pCommand->SetArguments (args); + pCommand->Execute(); + } + } + + delete g_pFormatter.release(); + } + catch (std::exception& ex) + { + std::cerr << "error: " << ex.what() << std::endl; + PrintUsage (); +// exit (ex->GetError ()); + return 1; + } + + return 0; + +#if 0 + if (options.GetHelp () || options.GetCommand () == "help") + { + exit (0); + } + + // TODO: set this to the correct locale + tzset (); + setlocale (LC_TIME, "German"); + + // Load the names cache +// SSNamesCacheFile namesCache; +// if (!options.GetNamesCache ().empty ()) +// { +// try { +// if (namesCache.Open (options.GetNamesCache ())) +// g_NamesCache.SetFile (&namesCache); +// } +// catch (SSException& ex) +// { +// std::cerr << "names cache error: " << ex.what() << std::endl; +// } +// } + +// std::auto_ptr pFormatter (CPhysFormatterFactory::MakeFormatter()); + + StringVector physFiles = options.GetPhysFiles (); + StringVector::const_iterator iter = physFiles.begin (); + + try + { + for (; iter != physFiles.end (); ++iter) + { + if (options.GetIntegrityCheck ()) + { + SSHistoryFile file ((*iter).c_str ()); + // IntegrityCheck (file); + CheckOffsetsToComment (file); + CheckLabelValid (file); + CheckFileSize (file); + // TestComments (file); + } + else if (options.GetCommand () == "get") + pFormatter->DoGet (*iter, options); + else if (options.GetCommand () == "validate") + pFormatter->DoValidate (*iter, options); + else + throw std::runtime_error ("unknown command line argument"); + } + } + catch (std::exception& ex) + { + std::cerr << "error: " << ex.what() << std::endl; + options.PrintUsage (); + } +#endif + return 0; +} + diff --git a/ssphys/SSPhys/ssphys.dsp b/ssphys/SSPhys/ssphys.dsp new file mode 100644 index 0000000..d88ceab --- /dev/null +++ b/ssphys/SSPhys/ssphys.dsp @@ -0,0 +1,237 @@ +# Microsoft Developer Studio Project File - Name="ssphys" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=ssphys - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "ssphys.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ssphys.mak" CFG="ssphys - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ssphys - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "ssphys - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ssphys - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GR /GX /O2 /I "..\\" /I "..\Utils" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "ssphys - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "..\\" /I "..\Utils" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "ssphys - Win32 Release" +# Name "ssphys - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\Arguments.cpp +# End Source File +# Begin Source File + +SOURCE=.\Command.cpp +# End Source File +# Begin Source File + +SOURCE=.\CommandFactory.cpp +# End Source File +# Begin Source File + +SOURCE=.\CommandLine.cpp +# End Source File +# Begin Source File + +SOURCE=.\FileTypeCommand.cpp +# End Source File +# Begin Source File + +SOURCE=.\Formatter.cpp +# End Source File +# Begin Source File + +SOURCE=.\GetCommand.cpp +# End Source File +# Begin Source File + +SOURCE=.\GlobalOptions.cpp +# End Source File +# Begin Source File + +SOURCE=.\HelpCommand.cpp +# End Source File +# Begin Source File + +SOURCE=.\HistoryCommand.cpp +# End Source File +# Begin Source File + +SOURCE=.\InfoCommand.cpp +# End Source File +# Begin Source File + +SOURCE=.\Options.cpp +# End Source File +# Begin Source File + +SOURCE=.\PropertiesCommand.cpp +# End Source File +# Begin Source File + +SOURCE=.\ssphys.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\ValidateCommand.cpp +# End Source File +# Begin Source File + +SOURCE=.\VersionFilter.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Arguments.h +# End Source File +# Begin Source File + +SOURCE=.\Command.h +# End Source File +# Begin Source File + +SOURCE=.\CommandFactory.h +# End Source File +# Begin Source File + +SOURCE=.\CommandLine.h +# End Source File +# Begin Source File + +SOURCE=.\FileTypeCommand.h +# End Source File +# Begin Source File + +SOURCE=.\Formatter.h +# End Source File +# Begin Source File + +SOURCE=.\GetCommand.h +# End Source File +# Begin Source File + +SOURCE=.\GlobalOptions.h +# End Source File +# Begin Source File + +SOURCE=.\HelpCommand.h +# End Source File +# Begin Source File + +SOURCE=.\HistoryCommand.h +# End Source File +# Begin Source File + +SOURCE=.\InfoCommand.h +# End Source File +# Begin Source File + +SOURCE=.\Options.h +# End Source File +# Begin Source File + +SOURCE=.\PropertiesCommand.h +# End Source File +# Begin Source File + +SOURCE=.\SSTests.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\ValidateCommand.h +# End Source File +# Begin Source File + +SOURCE=.\VersionFilter.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/ssphys/SSPhysLib/FileName.cpp b/ssphys/SSPhysLib/FileName.cpp new file mode 100644 index 0000000..e18d91c --- /dev/null +++ b/ssphys/SSPhysLib/FileName.cpp @@ -0,0 +1,61 @@ +// FileName.cpp: implementation of the CFileName class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "FileName.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +void CFileName::Normalize () +{ +// int n = 0; +// int isAbsolute = IsFullPath (); +// int isUNCPath = IsUNCPath(); +// +// int minCount = 0; +// if (isUNCPath) +// minCount = 1; // do not drop the computer during ".." resolution. +// +// // break the path into peaces +// CString dir (m_szDir); +// CStringList elements; +// do +// { +// CString element = SysTokenize (dir, _T("\\/"), n); +// +// if( n != -1 ) +// { +// if (element == _T("..")) +// { +// // drop the last directory if we are not a relative path +// if (elements.GetCount () > minCount) +// elements.RemoveTail (); +// else if (!isAbsolute) +// elements.AddTail (element); +// } +// else if (element != _T(".")) +// elements.AddTail (element); +// } +// } while( n != -1 ); +// +// // resamble the Path +// if (isUNCPath) +// dir = _T("\\\\"); +// else if (isAbsolute) +// dir = _T("\\"); +// else +// dir.Empty(); +// +// POSITION pos = elements.GetHeadPosition (); +// while (pos != NULL) +// { +// CString element = elements.GetNext(pos); +// dir += element + _T("\\"); +// } +// +// _tcsncpy (m_szDir, dir, _MAX_DIR); +} + diff --git a/ssphys/SSPhysLib/FileName.h b/ssphys/SSPhysLib/FileName.h new file mode 100644 index 0000000..52396e7 --- /dev/null +++ b/ssphys/SSPhysLib/FileName.h @@ -0,0 +1,257 @@ +// FileName.h: interface for the CFileName class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_FILENAME_H__5778DD0A_6746_4301_A8C4_B82F7CC70FC9__INCLUDED_) +#define AFX_FILENAME_H__5778DD0A_6746_4301_A8C4_B82F7CC70FC9__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +// Siehe auch CFileSpec auf http://www.codeproject.com/cpp/cfilespec.asp +// oder CPath auf http://www.thecodeproject.com/file/cpath.asp + +#include +#include + +class CFileName +{ +public: + CFileName (LPCTSTR pFilename = NULL) + { + m_szDrive[0] = m_szDir[0] = m_szFileTitle[0] = m_szExt[0] = _T('\0'); + + if (pFilename) + SetFilePath (pFilename); + } + +// CFileName (HMODULE hModule) +// { +// TCHAR szPathName[_MAX_PATH]; +// if (::GetModuleFileName(hModule, szPathName, _MAX_PATH)) +// SetFilePath (szPathName); +// else +// { +// DWORD dwError = GetLastError(); +// TRACE (_T("CFileName(HMODULE) failed: GetLastError returned %d\n"), dwError); +// } +// +// } + + // set the full path name including filename and extension (e.g.: "c:\WinNT\system32\kernel32.sys") + void SetFilePath (LPCTSTR pFilepath) + { + assert(pFilepath != NULL); +// assert(AfxIsValidString(pFilepath)); + + _tsplitpath (pFilepath, m_szDrive, m_szDir, m_szFileTitle, m_szExt); + } + // return full path name including filename and extension (e.g.: "c:\WinNT\system32\kernel32.sys") + std::string GetFilePath () const + { + TCHAR str[_MAX_PATH]; + _tmakepath (str, m_szDrive, m_szDir, m_szFileTitle, m_szExt); + return str; + } + + // set the drive name (e.g.: "c:") + void SetDrive (LPCTSTR pStr) + { + assert(pStr != NULL); +// assert(AfxIsValidString(pStr)); + + _tcsncpy (m_szDrive, pStr, _MAX_DRIVE); + } +// // return the drive name (e.g.: "c:") +// std::string GetDrive () const +// { +// CString str; +// str.Format(_T("%.*s"), _MAX_DRIVE, m_szDrive); +// return str; +// } + + // set the directory, _including_ the trailing slash (e.g.: "WinNT\system32\") + void SetDir (LPCTSTR pStr) + { + assert (IsTrailingSlash (pStr) || _tcslen (pStr) == 0); + _tcsncpy (m_szDir, pStr, _MAX_DIR); + } +// // return the directory, including a trailing slash (e.g.: "WinNT\system32\") +// CString GetDir () const +// { +// CString str; +// str.Format(_T("%.*s"), _MAX_DIR, m_szDir); +// return str; +// } + + // set the file title (e.g.: "kernel32") + void SetFileTitle (LPCTSTR pStr) + { + assert(pStr != NULL); +// assert(AfxIsValidString(pStr)); + + _tcsncpy (m_szFileTitle, pStr, _MAX_FNAME); + } +// // return the file title (e.g.: "kernel32") +// CString GetFileTitle () const +// { +// CString str; +// str.Format(_T("%.*s"), _MAX_FNAME, m_szFileTitle); +// return str; +// } + + // set the extension, with or without the leading dot (e.g.: "sys" or ".sys") + void SetExt (LPCTSTR str) + { + if (IsLeadingDot (str)) + _tcsncpy (m_szExt, str, _MAX_EXT); + else + { + TCHAR* lpsz = m_szExt; + _tcsncpy (lpsz, _T("."), 1); + lpsz = _tcsinc (lpsz); + _tcsncpy (lpsz, str, _MAX_EXT-1); + } + } +// // return the extension without the leading dot (e.g.: "sys") +// CString GetExt () const +// { +// CString str; str.Format(_T("%.*s"), _MAX_EXT, m_szExt); return StripLeadingDot (str); +// } +// // return the extension including the leading dot (e.g.: ".sys") +// CString GetDotExt () const +// { +// CString str; str.Format(_T("%.*s"), _MAX_EXT, m_szExt); return str; +// } + + // set the full path to the file, _including_ a trailing slash (e.g.: "c:\WinNT\system32\") + void SetPath (LPCTSTR pStr) + { + assert (IsTrailingSlash (pStr) || _tcslen (pStr) == 0); + _tsplitpath (pStr, m_szDrive, m_szDir, 0, 0); + } +// // return the full path to the file, including a trailing slash (e.g.: "c:\WinNT\system32\") +// CString GetPath () const +// { +// CString str; +// LPTSTR p = str.GetBuffer(_MAX_PATH); +// _tmakepath (p, m_szDrive, m_szDir, NULL, NULL); +// str.ReleaseBuffer(); +// return str; +// } +// // return the relative Path to another location +// CString GetRelativePathFrom (LPCTSTR pszFrom) const; +// CString GetRelativePathTo (LPCTSTR pszTo) const; + +// // return this as an absolute path +// CString GetAbsolutePath () const; + + // set the file title including the extension (e.g.: "kernel32.sys") + void SetFileName (LPCTSTR pStr) + { + assert(pStr != NULL); +// assert(AfxIsValidString(pStr)); + + _tsplitpath (pStr, 0, 0, m_szFileTitle, m_szExt); + } +// // return the file title including the extension (e.g.: "kernel32.sys") + std::string GetFileName () const + { + TCHAR str[_MAX_PATH]; + _tmakepath (str, NULL, NULL, m_szFileTitle, m_szExt); + return str; + } + + // Accept '/' or '\\' as a path separator on all platforms. + static BOOL IsPathSeparator(TCHAR ch) + { + return (ch == _T('/') || ch == _T('\\')); + } + + // returns wether the path is a UNC path (e.g.: \\computer\c$\windows\kernel32.sys) + BOOL IsUNCPath() const + { + return IsUNCPath(m_szDir); + } + + // returns wether the path is a UNC path (e.g.: \\computer\c$\windows\kernel32.sys) + static BOOL IsUNCPath(LPCTSTR szPath) + { + assert(szPath != NULL); +// assert(AfxIsValidString(szPath)); + + if (_tcslen(szPath) < 2) + return FALSE; + + return (szPath[0] == '\\' && szPath[1] == '\\'); + } + + BOOL IsFullPath () + { + std::string path = GetFilePath(); + + return(IsPathSeparator(path[0]) +#if !PLATFORM_UNIX + || (_istalpha(path[0]) && path[1] == _T(':')) +#endif // !PLATFORM_UNIX + ); + } + + + // remove all unnecessary elements from path like path/to/./subpath, or path/to//subpath + void Normalize (); + +protected: + bool IsTrailingSlash (LPCTSTR lpstr) const + { + assert(lpstr != NULL); +// assert(AfxIsValidString(lpstr)); + + int len = _tcslen (lpstr); + if (len == 0) + return false; + + LPCTSTR lpsz = _tcsninc(lpstr, len-1); + return (_tcsncmp (lpsz, _T("\\"), 1) == 0 || _tcsncmp (lpsz, _T("/"), 1) == 0); + } + + bool IsLeadingDot (LPCTSTR pStr) const + { + assert(pStr != NULL); +// assert(AfxIsValidString(pStr)); + + return (_tcsncmp (pStr, _T("."), 1) == 0); + } + +// CString StripLeadingDot (CString str) const +// { +// while (IsLeadingDot (str)) +// str = str.Right (str.GetLength() - 1); +// return str; +// } + + void SplitComputer () + { + // If UNC name + if ( !_tcsncmp(m_szDir, _T("\\\\"), 2)) + { + // Get the computername + _tcsncpy(m_szComputer, _tcsstr(m_szDir, _T("\\\\"))+2, sizeof(m_szComputer)-1 ); + _tcsnset(_tcsstr(m_szComputer, _T("\\")), 0, 1); + + // Strip the computername from the directory + _tcsncpy(m_szDir, _tcsstr(m_szDir, _T("\\\\"))+2, sizeof(m_szDir)-1 ); + _tcsncpy(m_szDir, _tcsstr(m_szDir, _T("\\")), sizeof(m_szDir)-1 ); + } + } + + + TCHAR m_szDrive[_MAX_DRIVE]; + TCHAR m_szDir[_MAX_DIR]; + TCHAR m_szFileTitle[_MAX_FNAME]; + TCHAR m_szExt[_MAX_EXT]; + TCHAR m_szComputer[_MAX_FNAME]; +}; + +#endif // !defined(AFX_FILENAME_H__5778DD0A_6746_4301_A8C4_B82F7CC70FC9__INCLUDED_) diff --git a/ssphys/SSPhysLib/Readme.txt b/ssphys/SSPhysLib/Readme.txt new file mode 100644 index 0000000..cafe029 --- /dev/null +++ b/ssphys/SSPhysLib/Readme.txt @@ -0,0 +1,24 @@ +======================================================================== + STATIC LIBRARY : SSPhysLib +======================================================================== + + +AppWizard has created this SSPhysLib library for you. + +This file contains a summary of what you will find in each of the files that +make up your SSPhysLib application. + +///////////////////////////////////////////////////////////////////////////// + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named SSPhysLib.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + + +///////////////////////////////////////////////////////////////////////////// diff --git a/ssphys/SSPhysLib/SSBranchFileObject.cpp b/ssphys/SSPhysLib/SSBranchFileObject.cpp new file mode 100644 index 0000000..616ffde --- /dev/null +++ b/ssphys/SSPhysLib/SSBranchFileObject.cpp @@ -0,0 +1,42 @@ +// SSBranchFileObject.cpp: implementation of the SSBranchFileObject class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSBranchFileObject.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +SSBranchFileObject::SSBranchFileObject(SSRecordPtr pRecord) +: SSObject (pRecord, eBranchFile) +{ + if (pRecord->GetLen() < sizeof (BF)) + throw SSRecordException ("not enough data for branch file (BF) object"); +} + +SSBranchFileObject::~SSBranchFileObject() +{ + +} + +SSBranchFileObject* SSBranchFileObject::GetPrevious () +{ + SSRecordPtr pRecord = GetFile()->GetRecord(GetPreviousOffset ()); + return new SSBranchFileObject (pRecord); +} + +void SSBranchFileObject::ToXml (XMLNode* pParent) const +{ + XMLElement previous (pParent, "PreviousOffset", GetPreviousOffset()); + XMLElement branch (pParent, "BranchToPhys", GetBranchToPhys()); +} + +void SSBranchFileObject::Dump (std::ostream& os) const +{ + SSObject::Dump (os); + + os << "Previous : 0x" << std::hex << GetPreviousOffset() << std::dec << std::endl; + os << "BranchToPhys: " << GetBranchToPhys() << std::endl; +} diff --git a/ssphys/SSPhysLib/SSBranchFileObject.h b/ssphys/SSPhysLib/SSBranchFileObject.h new file mode 100644 index 0000000..852aab1 --- /dev/null +++ b/ssphys/SSPhysLib/SSBranchFileObject.h @@ -0,0 +1,34 @@ +// SSBranchFileObject.h: interface for the SSBranchFileObject class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSBRANCHFILEOBJECT_H__A0EACDCC_E735_4F39_B5F4_609876C5878B__INCLUDED_) +#define AFX_SSBRANCHFILEOBJECT_H__A0EACDCC_E735_4F39_B5F4_609876C5878B__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SSObject.h" + +class SSBranchFileObject : public SSObject +{ +public: + SSBranchFileObject(SSRecordPtr pRecord); + virtual ~SSBranchFileObject(); + + ulong GetPreviousOffset () const { return GetData ()->PreviousOffset; } + std::string GetBranchToPhys () const { return GetData ()->BranchToPhys; } + + SSBranchFileObject* GetPrevious (); + + virtual void Accept (ISSObjectVisitor& rVisitor, const ISSContext* pCtx = NULL) const { rVisitor.Apply (*this, pCtx); } + const BF* GetData () const { return reinterpret_cast (SSObject::GetData ()); } + + void ToXml (XMLNode* pParent) const; + void Dump (std::ostream& os) const; +private: +}; + + +#endif // !defined(AFX_SSBRANCHFILEOBJECT_H__A0EACDCC_E735_4F39_B5F4_609876C5878B__INCLUDED_) diff --git a/ssphys/SSPhysLib/SSCheckOutObject.cpp b/ssphys/SSPhysLib/SSCheckOutObject.cpp new file mode 100644 index 0000000..45e6eb5 --- /dev/null +++ b/ssphys/SSPhysLib/SSCheckOutObject.cpp @@ -0,0 +1,40 @@ +// SSCheckOutObject.cpp: implementation of the SSCheckOutObject class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSCheckOutObject.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +SSCheckOutObject::SSCheckOutObject (SSRecordPtr pRecord) + : SSObject (pRecord, eCheckOutRecord) +{ + if (pRecord->GetLen() < sizeof (CF)) + throw SSRecordException ("not enough data for checkout (CF) object"); +} + +SSCheckOutObject::~SSCheckOutObject () +{ +} + +void SSCheckOutObject::ToXml (XMLNode* pParent) const +{ + XMLElement User (pParent, "User", GetUser()); + XMLElement CheckOutFolder (pParent, "Folder", GetCheckOutFolder()); + XMLElement Computer (pParent, "Computer", GetComputer()); + XMLElement ParentSpec (pParent, "ParentSpec", GetParentSpec()); + XMLElement Comment (pParent, "Comment", GetComment()); +} + +void SSCheckOutObject::Dump (std::ostream& os) const +{ + SSObject::Dump (os); + + os << "User: " << GetUser () << std::endl; + os << "CheckOutFolder: " << GetCheckOutFolder() << std::endl; + os << "Computer: " << GetComputer() << std::endl; + os << "ParentSpec: " << GetParentSpec() << std::endl; + os << "Comment: " << GetComment() << std::endl; +} diff --git a/ssphys/SSPhysLib/SSCheckOutObject.h b/ssphys/SSPhysLib/SSCheckOutObject.h new file mode 100644 index 0000000..286fa30 --- /dev/null +++ b/ssphys/SSPhysLib/SSCheckOutObject.h @@ -0,0 +1,40 @@ +// SSCheckOutObject.h: interface for the SSCheckOutObject class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSCHECKOUTOBJECT_H__D987E1D1_744F_4D0F_BB42_A2D3A52F0171__INCLUDED_) +#define AFX_SSCHECKOUTOBJECT_H__D987E1D1_744F_4D0F_BB42_A2D3A52F0171__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SSObject.h" + +class SSCheckOutObject : public SSObject +{ +public: + SSCheckOutObject(SSRecordPtr pRecord); + virtual ~SSCheckOutObject(); + + // accessors + std::string GetUser () const { return std::string (GetData()->User, 32); } + std::string GetCheckOutFolder () const { return std::string (GetData()->CheckOutFolder, 256); } + std::string GetComputer () const { return std::string (GetData()->Computer, 32); } + std::string GetParentSpec () const { return std::string (GetData()->ParentSpec, 260); } + std::string GetComment () const { return std::string (GetData()->Comment, 13); } + char GetFlag1 () const { return GetData()->Flag1; } + char GetFlag2 () const { return GetData()->Flag2; } + char GetFlag3 () const { return GetData()->Flag3; } + int GetNumberOfVersions () const { return GetData()->NumberOfVersions; } + + virtual void Accept (ISSObjectVisitor& rVisitor, const ISSContext* pCtx = NULL) const { rVisitor.Apply (*this, pCtx); } + const CF* GetData () const { return reinterpret_cast (SSObject::GetData ()); } + + void ToXml (XMLNode* pParent) const; + void Dump (std::ostream& os) const; +protected: +}; + + +#endif // !defined(AFX_SSCHECKOUTOBJECT_H__D987E1D1_744F_4D0F_BB42_A2D3A52F0171__INCLUDED_) diff --git a/ssphys/SSPhysLib/SSCommentObject.cpp b/ssphys/SSPhysLib/SSCommentObject.cpp new file mode 100644 index 0000000..0e8d2aa --- /dev/null +++ b/ssphys/SSPhysLib/SSCommentObject.cpp @@ -0,0 +1,37 @@ +// SSCommentObject.cpp: implementation of the SSCommentObject class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSCommentObject.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +SSCommentObject::SSCommentObject(SSRecordPtr pRecord) + : SSObject (pRecord, eCommentRecord) +{ + m_Comment = std::string (reinterpret_cast (pRecord->GetBuffer()), pRecord->GetLen ()); +} + +SSCommentObject::~SSCommentObject() +{ + +} + +std::string SSCommentObject::GetComment () const +{ + return m_Comment; +} + +void SSCommentObject::ToXml (XMLNode* pParent) const +{ + XMLValue commentValue (pParent, GetComment ()); +} + +void SSCommentObject::Dump (std::ostream& os) const +{ + SSObject::Dump (os); + os << GetComment () << std::endl; +} \ No newline at end of file diff --git a/ssphys/SSPhysLib/SSCommentObject.h b/ssphys/SSPhysLib/SSCommentObject.h new file mode 100644 index 0000000..412818f --- /dev/null +++ b/ssphys/SSPhysLib/SSCommentObject.h @@ -0,0 +1,31 @@ +// SSCommentObject.h: interface for the SSCommentObject class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSCOMMENTOBJECT_H__CA1555B2_0C25_42AE_9720_D670E5E447D6__INCLUDED_) +#define AFX_SSCOMMENTOBJECT_H__CA1555B2_0C25_42AE_9720_D670E5E447D6__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SSObject.h" + +class SSCommentObject : public SSObject +{ +public: + SSCommentObject(SSRecordPtr pRecord); + virtual ~SSCommentObject(); + + std::string SSCommentObject::GetComment () const; + + virtual void Accept (ISSObjectVisitor& rVisitor, const ISSContext* pCtx = NULL) const { rVisitor.Apply (*this, pCtx); } + + void ToXml (XMLNode* pParent) const; + void Dump (std::ostream& os) const; + +protected: + std::string m_Comment; +}; + +#endif // !defined(AFX_SSCOMMENTOBJECT_H__CA1555B2_0C25_42AE_9720_D670E5E447D6__INCLUDED_) diff --git a/ssphys/SSPhysLib/SSException.cpp b/ssphys/SSPhysLib/SSException.cpp new file mode 100644 index 0000000..52e1d1a --- /dev/null +++ b/ssphys/SSPhysLib/SSException.cpp @@ -0,0 +1,11 @@ +// SSException.cpp: implementation of the SSException class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSException.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + diff --git a/ssphys/SSPhysLib/SSException.h b/ssphys/SSPhysLib/SSException.h new file mode 100644 index 0000000..87a4642 --- /dev/null +++ b/ssphys/SSPhysLib/SSException.h @@ -0,0 +1,70 @@ +// SSException.h: interface for the SSException class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSEXCEPTION_H__56E9DD10_4947_45AB_A7C5_F732DE0538A5__INCLUDED_) +#define AFX_SSEXCEPTION_H__56E9DD10_4947_45AB_A7C5_F732DE0538A5__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include +#include "SSRecord.h" + +//--------------------------------------------------------------------------- +class SSException : public std::exception +{ +public: + SSException(const std::string& str) + : exception (""), m_Str (str) + { + } + virtual ~SSException() + {} + virtual const char *what() const + {return (m_Str.c_str()); } +protected: + virtual void _Doraise() const + {_RAISE(*this); } + + std::string m_Str; +}; + + + +//--------------------------------------------------------------------------- +class SSRecordException : public SSException +{ +public: + SSRecordException(const std::string& str) + : SSException (str) + { + } +protected: + virtual void _Doraise() const + {_RAISE(*this); } +private: +}; + +//--------------------------------------------------------------------------- +#include +class SSUnknownActionException : public SSException +{ +public: + SSUnknownActionException (short action, SSRecordPtr record) + : m_Action (action), m_record (record), SSException ("unknown action") + { + } + virtual const char *what() const + { + std::ostringstream stream; + stream << m_Str << " " << m_Action << " at offset 0x" << std::hex << m_record->GetOffset(); + return (stream.str().c_str ()); + } +private: + short m_Action; + SSRecordPtr m_record; +}; + +#endif // !defined(AFX_SSEXCEPTION_H__56E9DD10_4947_45AB_A7C5_F732DE0538A5__INCLUDED_) diff --git a/ssphys/SSPhysLib/SSFiles.cpp b/ssphys/SSPhysLib/SSFiles.cpp new file mode 100644 index 0000000..bca52fb --- /dev/null +++ b/ssphys/SSPhysLib/SSFiles.cpp @@ -0,0 +1,764 @@ +// SSFiles.cpp: implementation of the SSFiles class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSFiles.h" +#include "SSItemInfoObject.h" + +//--------------------------------------------------------------------------- +#include "LeakWatcher.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +CBaseIO::~CBaseIO () +{ +} +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +CFileIO::CFileIO (const std::string& fileName) + : m_pFile (NULL), m_FileName (fileName) +{ +} +CFileIO::~CFileIO () +{ + if (m_pFile) + fclose (m_pFile); +} +bool CFileIO::Open (const char* mode) +{ + if (!m_pFile) + m_pFile = fopen (m_FileName.c_str (), mode); + + return m_pFile != NULL; +} +void CFileIO::Close () +{ + if (m_pFile) + { + fclose (m_pFile); + m_pFile = NULL; + } +} +size_t CFileIO::Read (void* ptr, size_t size, size_t count) +{ + bool bClose = !m_pFile; + if (bClose && !Open ("rb")) + throw ("could not open file for reading"); + + size_t retval = fread (ptr, size, count, m_pFile); + + if (bClose) + Close (); + + return retval; +} +size_t CFileIO::Write (const void* ptr, size_t size, size_t count) +{ + bool bClose = !m_pFile; + if (bClose && !Open ("a+b")) + throw ("could not open file for writing"); + + size_t retval = fwrite (ptr, size, count, m_pFile); + + if (bClose) + Close (); + + return retval; +} +bool CFileIO::Seek (size_t offset, int whence) +{ + bool bClose = !m_pFile; + if (bClose && !Open ("rb")) + throw SSException ("could not open file for reading"); + + int retval = fseek (m_pFile, offset, whence); + + if (bClose) + Close (); + + return retval == 0; +} +long CFileIO::Size () +{ + bool bClose = !m_pFile; + if (!Open ("rb")) + throw SSException ("could not open file for reading"); + + fseek (m_pFile, 0, SEEK_END); + long retval = ftell (m_pFile); + + if (bClose) + Close (); + + return retval; +} +std::string CFileIO::FileName () +{ + return m_FileName; +} + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +CMemoryIO::CMemoryIO (const void* ptr, long size) + : m_Ptr (ptr), m_Size (size), m_CurrentPos (0) +{ +} +CMemoryIO::~CMemoryIO () +{ +} +bool CMemoryIO::Open (const char*) +{ + return true; +} +void CMemoryIO::Close () +{ +} +size_t CMemoryIO::Read (void* ptr, size_t size, size_t count) +{ + for (size_t i = 0; i= size) + { + memcpy (ptr, (byte*)m_Ptr + m_CurrentPos, size); + m_CurrentPos += size; + ptr = (byte*)ptr + size; + } + } + + return i; +} +size_t CMemoryIO::Write (const void* ptr, size_t size, size_t count) +{ + for (size_t i = 0; i= size) + { + memcpy ((byte*)m_Ptr + m_CurrentPos, ptr, size); + m_CurrentPos += size; + ptr = (byte*)ptr + size; + } + } + + return i; +} + +bool CMemoryIO::Seek (size_t offset, int whence) +{ + if (whence == SEEK_SET) + m_CurrentPos = offset; + else if (whence == SEEK_END) + m_CurrentPos = m_Size-offset-1; + else if (whence == SEEK_CUR) + m_CurrentPos += offset; + + return m_CurrentPos < m_Size; +} +long CMemoryIO::Size () +{ + return m_Size; +} +std::string CMemoryIO::FileName () +{ + return (""); +} + + + + + + +SSFileImp::SSFileImp (const std::string& fileName, bool bOpen /* = false */) + : m_pIO (NULL) +{ + m_pIO = new CFileIO (fileName); + if (bOpen && !Open ("rb")) + throw SSException ("could not load file"); +} + + +SSFileImp::SSFileImp (CBaseIO* pio, bool bOpen /* = false */) + : m_pIO (pio) +{ + if (!m_pIO) + throw SSException ("no io specified"); + + if (bOpen && !Open ("rb")) + throw SSException ("could not load file"); +} + +SSFileImp::~SSFileImp () +{ + Close (); + delete m_pIO; m_pIO = NULL; + +// std::map ::iterator itor = m_Records.begin (); +// for (; itor != m_Records.end (); ++itor) +// { +// if ((*itor).second.use_count () != 1) +// throw std::logic_error ("the reference count for this SSRecord should be one"); +// } + +// m_Records.empty (); +} + +bool SSFileImp::Open (const char* mode) const +{ + assert (m_pIO); +// m_pFile = fopen (filename.c_str (), "rb"); + if (m_pIO->Open (mode)) + { + return true; + } + + return false; +} + +void SSFileImp::Close () const +{ + assert (m_pIO); + m_pIO->Close (); +} + +long SSFileImp::Size () +{ + assert (m_pIO); + return m_pIO->Size (); +} + +std::string SSFileImp::GetFileName () +{ + assert (m_pIO); + return m_pIO->FileName (); +} + +size_t SSFileImp::Read (void* ptr, size_t size, size_t count) const +{ + return m_pIO->Read (ptr, size, count); +} + +bool SSFileImp::Read (long offset, void* ptr, int len) const +{ + bool bClose = true; // !IsOpen (); + if (bClose && !Open ("rb")) + throw SSException ("could not open file for reading"); + + if (!m_pIO->Seek (offset, SEEK_SET)) + { + if (bClose) Close (); + return false; + } + if (1 != m_pIO->Read (ptr, len, 1)) + { + if (bClose) Close (); + return false; + } + + if (bClose) Close (); + return true; +} + +bool SSFileImp::Seek (size_t offset, int pos) const +{ + assert (m_pIO); + return m_pIO->Seek (offset, pos); +} + +size_t SSFileImp::Write (const void* ptr, size_t size, size_t count) const +{ + assert (m_pIO); + return m_pIO->Write (ptr, size, count); +} + +SSRecordPtr SSFileImp::GetRecord (long offset) +{ + if (offset >= m_pIO->Size ()) + return SSRecordPtr (); + + SSRecordPtr recordPtr; +// std::map ::iterator itor = m_Records.find (offset); +// if (itor == m_Records.end()) +// { + recordPtr.reset (ReadRecord (shared_from_this(), offset)); +// m_Records[offset] = recordPtr; +// } +// else +// { +// recordPtr = SSRecordPtr ((*itor).second); +// } + + return recordPtr; +} + +SSRecord* SSFileImp::ReadRecord (SSFileImpPtr fileImp, long offset) +{ + SSRecord* pRecord = new SSRecord (fileImp, offset); + return pRecord; +} + + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +//SSRecordFile::SSRecordFile () +// : m_pFile (NULL), m_FileName ("") +//{ +//} +// +SSFile::SSFile (const std::string& fileName, bool bOpen /* = false */) + : m_FileImpPtr (new SSFileImp (fileName, bOpen)) +{ +} + +SSFile::SSFile (SSFileImpPtr filePtr) + : m_FileImpPtr (filePtr) +{ +} + +SSFile::SSFile (CBaseIO* pio, bool bOpen /* = false */) + : m_FileImpPtr (new SSFileImp (pio, bOpen)) +{ +} + + +SSFile::~SSFile () +{ + Close (); +} + +bool SSFile::Open () +{ + assert (m_FileImpPtr); + if (m_FileImpPtr->Open ("rb")) + { + assert (Validate ()); + return true; + } + return false; +} + +void SSFile::Close () +{ + if (m_FileImpPtr) + m_FileImpPtr->Close (); +} + +//long SSRecordFile::Size () +//{ +// assert (m_FileImpPtr); +// return m_FileImpPtr->Size (); +//} + +std::string SSFile::GetFileName () +{ + assert (m_FileImpPtr); + return m_FileImpPtr->GetFileName (); +} + +//SSFileImpPtr SSFile::GetFileImp () +//{ +// return m_FileImpPtr; +//} + +////////////////////////////////////////////////////////////////////// +SSBinaryFile::SSBinaryFile (const std::string& fileName, bool bOpen /* = false */) + : SSFile (fileName, bOpen) +{ +} + +SSBinaryFile::SSBinaryFile (SSFileImpPtr filePtr) + : SSFile (filePtr) +{ +} + +SSBinaryFile::SSBinaryFile (CBaseIO* pio) + : SSFile (pio) +{ +} + +////////////////////////////////////////////////////////////////////// +SSRecordFile::SSRecordFile(const std::string& fileName, bool bOpen /* = false */) + : SSBinaryFile (fileName, bOpen) +{ +} + +SSRecordFile::SSRecordFile (CBaseIO* pio) + : SSBinaryFile (pio) +{ +} + +SSRecordFile::~SSRecordFile () +{ +} + +SSRecordFile* SSRecordFile::MakeFile (const std::string& fileName) +{ + std::map fileTypeMap; + fileTypeMap[eItemRecord] = 0; + fileTypeMap[eNamesCache] = 1; + fileTypeMap[eProjectEntry] = 2; + fileTypeMap[eUsersHeader] = 3; + + eType type = eNone; + + try { + SSPlainFile plainFile (fileName); + SSRecordPtr pRecord = plainFile.GetFirstRecord(); + if (pRecord) + type = pRecord->GetType (); + } + catch (SSException&) + { + } + + if (fileTypeMap.find (type) == fileTypeMap.end ()) + { + try { + SSHeaderFile headerFile (fileName); + SSRecordPtr pRecord = headerFile.GetFirstRecord(); + if (pRecord) + type = pRecord->GetType (); + } + catch (SSException&) + { + } + } + + if (fileTypeMap.find (type) == fileTypeMap.end ()) + return NULL; + + switch (fileTypeMap[type]) + { + case 0: return new SSHistoryFile (fileName); + case 1: return new SSNamesCacheFile (fileName); + case 2: return new SSProjectFile (fileName); + case 3: return new SSUserFile (fileName); + default: + throw SSException ("unknown file type"); + } + return NULL; +} + +SSRecordPtr SSRecordFile::GetFirstRecord () +{ + return GetRecord (GetHeaderLength ()); +} + +SSRecordPtr SSRecordFile::GetNextRecord (SSRecordPtr pRecord) +{ + SSRecordPtr pNext; + if (pRecord && pRecord->IsValid ()) + { + pNext = GetRecord (pRecord->GetNextOffset ()); + +// if (pNext && (pNext->GetType () == eNone || pNext->GetType () == eUnknown)) +// throw SSException ("unknwon record type" + pNext->GetRecordType ()); + } + return pNext; +} + +SSRecordPtr SSRecordFile::FindNextRecord (SSRecordPtr pRecord) +{ + SSRecordPtr pNext; + if (pRecord && pRecord->IsValid ()) + { + long offset = pRecord->GetNextOffset (); + while (!pNext && offset < m_FileImpPtr->Size () - sizeof (RECORD_HEADER)) + { + try{ + pNext = GetRecord (offset); + } + catch (SSRecordException&) + { + ++offset; + } + } + } + return pNext; +} + +//bool SSRecordFile::Read (long offset, void* ptr, int len) +//{ +// assert (m_FileImpPtr); +// return m_FileImpPtr->Read(offset, ptr, len); +//} + +SSRecordPtr SSRecordFile::GetRecord (long offset) +{ + assert (m_FileImpPtr); + return m_FileImpPtr->GetRecord (offset); +} + +void SSRecordFile::Dump (std::ostream& os) +{ +// oss << "SourceSafe physical file: " << m_FileName << std::endl; +} + +//void SSRecordFile::DumpRecords (std::ostream& oss) +//{ +// SSRecordPtr pRecord; +// for (pRecord = GetFirstRecord (); pRecord; ) +// { +// oss << ">>> offset: 0x" << std::hex << pRecord->GetOffset() << std::dec; +// oss << " Type: " << pRecord->GetRecordType () << std::endl; +// std::auto_ptr pObject (SSObject::MakeObject(GetFileImp (), pRecord)); +// pObject->Dump (oss); +// oss << std::endl; +// +// pRecord = GetNextRecord (pRecord); +// } +//} + +bool SSRecordFile::Validate () +{ + bool retval = true; + + SSRecordPtr pRecord; + for (pRecord = GetFirstRecord (); pRecord; ) + { + std::auto_ptr pObject (SSObject::MakeObject(pRecord)); + retval &= pObject->Validate (); + + pRecord = GetNextRecord (pRecord); + } + return retval; +} + +//--------------------------------------------------------------------------- +//SSHeaderFile::SSHeaderFile () +//: SSRecordFile () +//{ +//} + +SSHeaderFile::SSHeaderFile (const std::string& fileName, bool bOpen /*= false*/) +: SSRecordFile (fileName, bOpen) +{ +} + +long SSHeaderFile::GetHeaderLength () +{ + return (sizeof (m_Header)); +} + +void SSHeaderFile::Dump (std::ostream& os) +{ + SSRecordFile::Dump (os); +} + +//--------------------------------------------------------------------------- +//SSPlainFile::SSPlainFile () +//: SSRecordFile () +//{ +//} + +SSPlainFile::SSPlainFile (const std::string& fileName, bool bOpen /*= false*/) +: SSRecordFile (fileName, bOpen) +{ +} + +SSPlainFile::SSPlainFile (CBaseIO* pio) +: SSRecordFile (pio) +{ +} + +long SSPlainFile::GetHeaderLength () +{ + return (0); +} + +void SSPlainFile::Dump (std::ostream& os) +{ + SSRecordFile::Dump (os); +} + +//--------------------------------------------------------------------------- +//SSHistoryFile::SSHistoryFile () +// : SSHeaderFile () +//{ +//} + +SSHistoryFile::SSHistoryFile (const std::string& fileName, bool bOpen /*= false*/) + : SSHeaderFile (fileName, false), m_pItemInfo (NULL) +{ + if (bOpen && !Open ()) + throw std::runtime_error ("could not load file"); +} + +SSHistoryFile::~SSHistoryFile () +{ + delete m_pItemInfo; +} + +bool SSHistoryFile::CheckHeader () +{ + // Read SourceSafeHeader + assert (m_FileImpPtr); + int size = m_FileImpPtr->Read (m_Header, sizeof (m_Header), 1); + if (size != 1) + throw SSException ("Could not read the SourceSafe header"); + + // Check SourceSafeHeader + warn_if (strncmp (m_Header, "SourceSafe@Microsoft", 20) != 0); + + for (int i = 21; i < countof (m_Header); i++) + { + // folgende Beobachtungen bisher gemacht + if (i==32) + { + // File oder Project? + warn_if (m_Header[i] != 1 && m_Header[i] != 2); + } + else if (i==34) + { + // Archive version nummer + warn_if (m_Header[i] != 6); + } + else + warn_if (m_Header[i] != 0); + } + return true; +} + +std::auto_ptr SSHistoryFile::GetItemInfo () +{ +// std::list::iterator itor; +// for (itor = m_Records.begin (); itor != m_Records.end (); ++itor) +// { +// if ((*itor)->GetType () == eItemRecord) +// return *itor; +// } +// return NULL; + return SSItemInfoObject::MakeItemInfo (GetRecord (GetHeaderLength ())); +} + +SSVersionObject SSHistoryFile::GetLastVersion () +{ + std::auto_ptr pItemInfo (GetItemInfo ()); + SSRecordPtr pRecord = GetRecord (pItemInfo->GetHistoryOffsetLast()); + return SSVersionObject (pRecord); +} + +SSVersionObject SSHistoryFile::GetPrevVersion (const SSVersionObject& version) +{ + return version.GetPreviousObject(); +} + +void SSHistoryFile::Dump (std::ostream& os) +{ +// SSRecordFile::Dump (oss); +// SSItemInfoObject* pItem = GetItemInfo (); +// if (pItem) +// pItem->Dump (oss); +} + +bool SSHistoryFile::IsProject () +{ + return GetItemInfo ()->GetType() == SSITEM_PROJECT; +} + +bool SSHistoryFile::IsFile () +{ + return GetItemInfo ()->GetType() == SSITEM_FILE; +} + +std::string SSHistoryFile::GetLatestExt() +{ + return GetItemInfo ()->GetLatestExt(); +} + +//--------------------------------------------------------------------------- +//SSUserFile::SSUserFile () +// : SSHeaderFile () +//{ +//} + +SSUserFile::SSUserFile (const std::string& fileName, bool bOpen /*= false*/) + : SSHeaderFile (fileName, false) +{ + if (bOpen && !Open ()) + throw std::runtime_error ("could not load file"); +} + +bool SSUserFile::CheckHeader () +{ + // Read SourceSafeHeader + assert (m_FileImpPtr); + int size = m_FileImpPtr->Read (m_Header, sizeof (m_Header), 1); + if (size != 1) + throw SSException ("Could not read the SourceSafe header"); + + // Check SourceSafeHeader + warn_if (strncmp (m_Header, "UserManagement@Microsoft", 25) != 0); + + for (int i = 26; i < countof (m_Header); i++) + { + // folgende Beobachtungen bisher gemacht + if (i==32) + { + warn_if (m_Header[i] != 8); + } + else + warn_if (m_Header[i] != 0); + } + return true; +} + +void SSUserFile::Dump (std::ostream& os) +{ + SSHeaderFile::Dump (os); +} + + + +//--------------------------------------------------------------------------- +//SSNamesCacheFile::SSNamesCacheFile() +// : SSPlainFile () +//{ +//} + +SSNamesCacheFile::SSNamesCacheFile (const std::string& fileName, bool bOpen /*= false*/) + : SSPlainFile (fileName, false) +{ + if (bOpen && !Open ()) + throw std::runtime_error ("could not load file"); +} + + +void SSNamesCacheFile::Dump (std::ostream& os) +{ + SSPlainFile::Dump (os); +} + + + +//--------------------------------------------------------------------------- +//SSProjectFile::SSProjectFile () +// : SSPlainFile () +//{ +//} + +SSProjectFile::SSProjectFile (const std::string& fileName, bool bOpen /*= false*/) + : SSPlainFile (fileName, false) +{ + if (bOpen && !Open ()) + throw std::runtime_error ("could not load file"); +} + +SSProjectFile::SSProjectFile (CBaseIO* pio) +: SSPlainFile (pio) +{ +} + +void SSProjectFile::Dump (std::ostream& os) +{ + SSPlainFile::Dump (os); +} diff --git a/ssphys/SSPhysLib/SSFiles.h b/ssphys/SSPhysLib/SSFiles.h new file mode 100644 index 0000000..ad3acc4 --- /dev/null +++ b/ssphys/SSPhysLib/SSFiles.h @@ -0,0 +1,251 @@ +// SSFiles.h: interface for the SSFiles class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSFILES_H__A748503F_FA76_42CB_9EE0_A4FED9F1779B__INCLUDED_) +#define AFX_SSFILES_H__A748503F_FA76_42CB_9EE0_A4FED9F1779B__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +class SSItemInfoObject; +class SSVersionObject; +class SSRecord; +typedef boost::shared_ptr SSRecordPtr; + +class CBaseIO +{ +public: + virtual ~CBaseIO (); + + virtual bool Open (const char* mode) = 0; + virtual void Close () = 0; + virtual bool Seek (size_t offset, int whence) = 0; + virtual size_t Read (void* ptr, size_t size, size_t count) = 0; + virtual size_t Write (const void* ptr, size_t size, size_t count) = 0; + virtual long Size () = 0; + + virtual std::string FileName () = 0; +}; + +class CFileIO : public CBaseIO +{ +public: + CFileIO (const std::string& fileName); + virtual ~CFileIO (); + + virtual bool Open (const char* mode); + virtual void Close (); + virtual bool Seek (size_t offset, int whence); + virtual size_t Read (void* ptr, size_t size, size_t count); + virtual size_t Write (const void* ptr, size_t size, size_t count); + virtual long Size (); + + virtual std::string FileName (); +private: + FILE* m_pFile; + std::string m_FileName; +}; + +class CMemoryIO : public CBaseIO +{ +public: + CMemoryIO (const void* ptr, long size); + virtual ~CMemoryIO (); + + virtual bool Open (const char* mode); + virtual void Close (); + virtual bool Seek (size_t offset, int whence); + virtual size_t Read (void* ptr, size_t size, size_t count); + virtual size_t Write (const void* ptr, size_t size, size_t count); + virtual long Size (); + + virtual std::string FileName (); +private: + const void* m_Ptr; + long m_Size; + long m_CurrentPos; +}; + +class SSFileImp; +typedef boost::shared_ptr SSFileImpPtr; + +class SSFileImp : public boost::enable_shared_from_this +{ +public: + SSFileImp (const std::string& fileName, bool bOpen = false); + SSFileImp (CBaseIO* pio, bool bOpen = false); + virtual ~SSFileImp (); + + bool Open (const char*) const; + void Close () const; + + bool Seek (size_t offset, int pos) const; + bool Read (long offset, void* ptr, int len) const; + size_t Read (void* ptr, size_t size, size_t count) const; + size_t Write (const void* ptr, size_t size, size_t count) const; + long Size (); + + std::string GetFileName (); + + SSRecordPtr GetRecord (long offset); + +protected: + SSRecord* ReadRecord (SSFileImpPtr fileImp, long offset); +// friend SSRecord; +// void ReleaseRecord (SSRecord* record); + +// std::map m_Records; + CBaseIO* m_pIO; +}; + + + +class SSFile +{ +public: + SSFile (); + SSFile (const std::string& fileName, bool bOpen = false); + SSFile (SSFileImpPtr filePtr); + SSFile (CBaseIO* pio, bool bOpen = false); + virtual ~SSFile (); + + std::string GetFileName (); // { return m_FileName; } + +// bool IsOpen (); + bool Open (); + void Close (); + + virtual bool Validate () { return true; } + +protected: + SSFileImpPtr m_FileImpPtr; +}; + +class SSTextFile : public SSFile +{ +public: + SSTextFile (const std::string& fileName, bool bOpen = false); + +}; + +class SSBinaryFile : public SSFile +{ +public: + SSBinaryFile (const std::string& fileName, bool bOpen = false); + SSBinaryFile (SSFileImpPtr filePtr); + SSBinaryFile (CBaseIO* pio); +}; + + +class SSRecordFile : public SSBinaryFile +{ +public: +// SSRecordFile (); + SSRecordFile (const std::string& fileName, bool bOpen = false); + SSRecordFile (CBaseIO* pio); + virtual ~SSRecordFile (); + + static SSRecordFile* MakeFile (const std::string& fileName); + + virtual bool CheckHeader () { return true; } + virtual long GetHeaderLength () = 0; + + SSRecordPtr GetRecord (long offset); + SSRecordPtr GetFirstRecord (); + SSRecordPtr GetNextRecord (SSRecordPtr pRecord); + SSRecordPtr FindNextRecord (SSRecordPtr pRecord); + + virtual void Dump (std::ostream& os); +// virtual void DumpRecords (std::ostream& os); + virtual bool Validate (); +}; + + +class SSHeaderFile : public SSRecordFile +{ +public: +// SSHeaderFile (); + SSHeaderFile (const std::string& fileName, bool bOpen = false); + + virtual long GetHeaderLength (); + + virtual void Dump (std::ostream& os); + +protected: + char m_Header[52]; +}; + +class SSPlainFile : public SSRecordFile +{ +public: +// SSPlainFile (); + SSPlainFile (const std::string& fileName, bool bOpen = false); + SSPlainFile (CBaseIO* pio); + + virtual long GetHeaderLength (); + + SSItemInfoObject* GetItemInfo (); + virtual void Dump (std::ostream& os); + +protected: +}; + +class SSHistoryFile : public SSHeaderFile +{ +public: +// SSHistoryFile (); + SSHistoryFile (const std::string& fileName, bool bOpen = false); + ~SSHistoryFile (); + + virtual bool CheckHeader (); + + bool IsProject (); + bool IsFile (); + std::string GetLatestExt (); + + SSVersionObject GetLastVersion (); + SSVersionObject GetPrevVersion (const SSVersionObject& version); + + virtual void Dump (std::ostream& os); + + std::auto_ptr GetItemInfo (); + +protected: + SSItemInfoObject* m_pItemInfo; +}; + +class SSNamesCacheFile : public SSPlainFile +{ +public: +// SSNamesCacheFile (); + SSNamesCacheFile (const std::string& fileName, bool bOpen = false); + virtual void Dump (std::ostream& os); +}; + +class SSProjectFile : public SSPlainFile +{ +public: +// SSProjectFile (); + SSProjectFile (const std::string& fileName, bool bOpen = false); + SSProjectFile (CBaseIO* pio); + + virtual void Dump (std::ostream& os); +}; + +class SSUserFile : public SSHeaderFile +{ +public: +// SSUserFile (); + SSUserFile (const std::string& fileName, bool bOpen = false); + + virtual bool CheckHeader (); + + virtual void Dump (std::ostream& os); + +private: +}; + +#endif // !defined(AFX_SSFILES_H__A748503F_FA76_42CB_9EE0_A4FED9F1779B__INCLUDED_) diff --git a/ssphys/SSPhysLib/SSItemInfoObject.cpp b/ssphys/SSPhysLib/SSItemInfoObject.cpp new file mode 100644 index 0000000..a69260d --- /dev/null +++ b/ssphys/SSPhysLib/SSItemInfoObject.cpp @@ -0,0 +1,343 @@ +// SSItemInfoObject.cpp: implementation of the SSItems class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSFiles.h" +#include "SSName.h" +#include "SSItemInfoObject.h" +#include "SSParentFolderObject.h" +#include "SSBranchFileObject.h" + +//--------------------------------------------------------------------------- +#include "LeakWatcher.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +SSItemInfoObject::SSItemInfoObject (SSRecordPtr pRecord) + : SSObject (pRecord, eItemRecord) +{ + if (pRecord->GetLen() < sizeof (DH)) + throw SSRecordException ("not enough data for info object"); + + memcpy (&m_InfoItem, pRecord->GetBuffer(), sizeof (DH)); +} + +SSItemInfoObject::~SSItemInfoObject () +{ +} + +SSItemInfoObject* SSItemInfoObject::MakeItemInfo (SSRecordPtr pRecord) +{ + if (pRecord->GetLen () < sizeof (DH)) + throw SSException ("not enough bytes for DH Header in record"); + + const DH* pDh = reinterpret_cast (pRecord->GetBuffer ()); + if (pDh->Type == 1) + return new SSProjectItem (pRecord); + else if (pDh->Type == 2) + return new SSFileItem (pRecord); + else + throw SSException ("unsupported item type"); + + return (SSItemInfoObject*) NULL; +} + + + +SSVersionObject SSItemInfoObject::GetVersion (int i) +{ + SSFileImpPtr filePtr = GetFile (); + + // TODO: Cache versions + SSVersionObject version (filePtr->GetRecord (GetHistoryOffsetLast ())); + + while (version && version.GetVersionNumber () != i) + { + version = version.GetPreviousObject(); + } + + return version; +} + + +bool SSItemInfoObject::Get (int ver, const char* dest) +{ +// SSFileImpPtr filePtr = GetFile (); +// +// std::string lastVersion = filePtr->GetFileName () + GetLatestExt (); +// char tmrFile[2][255]; +// char* ptr[2] = {tmrFile[0], (char*)dest}; +// ptr[0] = tmpnam (ptr[0]); +// +// CopyFile (lastVersion.c_str(), ptr[0]); +// +// SSVersionObject version (filePtr->GetRecord (GetHistoryOffsetLast ())); +// +// while (version && version.GetVersionNumber() > ver) +// { +// if (version.GetActionId() == Checked_in) +// { +// SSCheckedInAction* pAction = dynamic_cast (version.GetAction()); +// SSRecordPtr pRecord = pAction->GetFileDelta(); +// ReverseDelta (ptr[0], pRecord->GetBuffer(), pRecord->GetLen(), ptr[1]); +// std::swap (ptr[0], ptr[1]); +// } +// +// version = version.GetPrevious (); +// } +// +// if (0 != strcmp (ptr[0], dest)) +// { +// CopyFile (ptr[0], dest); +// _unlink (ptr[0]); +// } +// else +// { +// _unlink (ptr[1]); +// } + return false; +} + +bool SSItemInfoObject::Validate() +{ + SSFileImpPtr filePtr = GetFile (); + + bool retval = true; + retval &= warn_if (GetLatestExt() != ".A" && GetLatestExt() != ".B"); + retval &= warn_if (GetHistoryOffsetEnd() != filePtr->Size()); + retval &= warn_if (filePtr->GetRecord (GetHistoryOffsetLast ())->GetType() != eHistoryRecord); + retval &= warn_if (filePtr->GetRecord (GetHistoryOffsetBegin ())->GetType() != eHistoryRecord); + retval &= warn_if (filePtr->GetRecord (GetHistoryOffsetBegin ())->GetType() != eHistoryRecord); + + int nCount = 0; + long offset = GetHistoryOffsetLast (); + do { + SSRecordPtr pRecord = filePtr->GetRecord (offset); + retval &= warn_if (pRecord->GetType() != eHistoryRecord); + + std::auto_ptr objectPtr (SSObject::MakeObject(pRecord)); + SSVersionObject* pVersion = dynamic_cast (objectPtr.get ()); + if (pVersion) + { + SSVersionObject previous (pVersion->GetPreviousObject ()); + offset = previous ? previous.GetOffset() : NULL; + } + else + offset = NULL; + + ++nCount; + } while (offset != NULL /*GetHistoryOffsetBegin ()*/); + + retval &= warn_if (nCount != GetNumberOfActions ()); + return retval; +} + +void SSItemInfoObject::ToXml (XMLNode* pParent) const +{ + XMLElement type (pParent, "Type", GetType()); + XMLElement data (pParent, "DataFileName", GetDataFileName ()); + XMLElement ext (pParent, "LatestExt", GetLatestExt()); + GetSSName().ToXml (pParent); + XMLElement noActions (pParent, "NumberOfActions", GetNumberOfActions()); +} + +void SSItemInfoObject::Dump (std::ostream& os) const +{ + SSObject::Dump (os); + + SSFileImpPtr filePtr = GetFile (); + + os << "Item Type: "; + + switch (m_InfoItem.Type) + { + case 1: os << "Project" << std::endl; break; + case 2: os << "File" << std::endl; break; + default: os << "Unknown (" << m_InfoItem.Type << ")" << std::endl; break; + } + + SSName ssName (GetSSName ()); + os << "Last Name: " << ssName << std::endl; +// os << "Number Of Records: " << GetNumberOfRecords () << std::endl; + os << "LatestExt of last version: " << m_InfoItem.LatestExt[0] << m_InfoItem.LatestExt[1] << std::endl; + os << "Offset to first History record: 0x" << std::hex << GetHistoryOffsetBegin()<< std::dec << std::endl; + os << "Offset to last History record: 0x" << std::hex << GetHistoryOffsetLast() << std::dec << std::endl; + os << "Offset to the end of the file: 0x" << std::hex << GetHistoryOffsetEnd() << std::dec << std::endl; + os << "Size of the file: 0x" << std::hex << filePtr->Size() << std::dec << std::endl; +} + + + + + +//--------------------------------------------------------------------------- +SSProjectItem::SSProjectItem (SSRecordPtr pRecord) + : SSItemInfoObject (pRecord) +{ + if (pRecord->GetLen() < sizeof (DH_PROJECT)) + throw SSRecordException ("not enough data for project info object"); +} + +std::string SSProjectItem::GetName () const +{ + return ("ProjectItem"); +} +void SSProjectItem::ToXml (XMLNode* pParent) const +{ + SSItemInfoObject::ToXml (pParent); + XMLElement spec (pParent, "ParentSpec", GetParentSpec ()); + XMLElement phys (pParent, "ParentPhys", GetParentPhys ()); + XMLElement noitems (pParent, "NumberOfItems", GetNumberOfItems ()); + XMLElement noProjects (pParent, "NumberOfProjects", GetNumberOfProjects ()); +} + +void SSProjectItem::Dump (std::ostream& os) const +{ + SSItemInfoObject::Dump (os); + +// Hexdump (oss, dummy4, 20); + os << "last parent spec: " << GetParentSpec () << std::endl; + os << "parentPhys: " << GetParentPhys () << std::endl; + os << "Number of Items: " << GetNumberOfItems () << std::endl; + os << "Number of Projects: " << GetNumberOfProjects () << std::endl; +} + + + + +//--------------------------------------------------------------------------- +SSFileItem::SSFileItem (SSRecordPtr pRecord) + : SSItemInfoObject (pRecord) +{ + if (pRecord->GetLen() < sizeof (DH_FILE)) + throw SSRecordException ("not enough data for file info object"); +} + +bool SSFileItem::Validate() +{ + SSItemInfoObject::Validate (); + + const DH_FILE* pFileInfoItem = GetData(); + + bool retval = true; + retval &= warn_if (pFileInfoItem->NumberOfItems > 0); + retval &= warn_if (pFileInfoItem->NumberOfProjects > 0); + + byte knownFlags[] = + { + 0x00, 0x02, 0x04, 0x41, 0x42, 0x20, 0x22 + }; + for (int i = 0; i < countof (knownFlags); i++) + if (pFileInfoItem->Flag == knownFlags[i]) + break; + retval &= warn_if (i == countof (knownFlags)); + + return retval; +} + +eFileType SSFileItem::GetFileType () const +{ + if ((GetFlag () & 0x02) == 0x02) + return eFileTypeBinary; + + return eFileTypeText; +} + +bool SSFileItem::GetStoreOnlyLatestRev () const +{ + if ((GetFlag () & 0x04) == 0x04) + return true; + + return false; +} + +bool SSFileItem::GetCheckedOut () const +{ + if ((GetFlag () & 0x41) == 0x41) + return true; + + return false; +} + +bool SSFileItem::GetShared () const +{ + if ((GetFlag () & 0x20) == 0x20) + return true; + + return false; +} + +SSParentFolderObject* SSFileItem::GetFirstParentFolder () +{ + SSRecordPtr pRecord = GetFile()->GetRecord(GetOffsetPFRecord ()); + return new SSParentFolderObject (pRecord); +} + +SSBranchFileObject* SSFileItem::GetFirstBranchFile () +{ + SSRecordPtr pRecord = GetFile()->GetRecord(GetOffsetBFRecord ()); + return new SSBranchFileObject (pRecord); +} + +std::string SSFileItem::GetName () const +{ + return ("FileItem"); +} +void SSFileItem::ToXml (XMLNode* pParent) const +{ + SSItemInfoObject::ToXml (pParent); + XMLElement binary (pParent, "Binary", GetFileType () == eFileTypeBinary ? true : false); + XMLElement store (pParent, "StoreOnlyLatestRev", GetStoreOnlyLatestRev ()); + XMLElement checkedOut (pParent, "CheckedOut", GetCheckedOut ()); + XMLElement shared (pParent, "Shared", GetShared ()); + XMLElement sharedSrc (pParent, "ShareSrc", GetShareSrcPhys()); + XMLElement ref (pParent, "NumberOfReferences", GetNumberOfReferences()); + XMLElement branch (pParent, "NumberOfBranches", GetNumberOfBranches ()); +} + +void SSFileItem::Dump (std::ostream& os) const +{ + SSItemInfoObject::Dump (os); + +// Hexdump (oss, dummy4, 20); + + const DH_FILE* pFileInfoItem = GetData (); + os << "Status: 0x" << std::hex << pFileInfoItem->Flag << std::dec << " "; + if (pFileInfoItem->Flag == 0x00) + os << "normal"; + else if (pFileInfoItem->Flag == 0x02) + os << "binary"; + else if (pFileInfoItem->Flag == 0x04) + os << "store only latest revision"; + else if (pFileInfoItem->Flag == 0x41) + os << "checked out, locked"; + else if (pFileInfoItem->Flag == 0x43) + os << "binary, checked out, locked"; + else if (pFileInfoItem->Flag == 0x20) + os << "shared"; + else if (pFileInfoItem->Flag == 0x22) + os << "binary, shared"; + else + os << "unknown"; + os << std::endl; + + os << "Share source physical file: " << pFileInfoItem->ShareSrcSpec << std::endl; + + os << "Offset to first parent record: 0x" << std::hex << pFileInfoItem->OffsetPFRecord << std::dec << std::endl; + os << "Reference count: " << pFileInfoItem->NumberOfReferences << std::endl; + os << "Offset to 1st checkout record: 0x" << std::hex << pFileInfoItem->OffsetCFRecord1 << std::dec << std::endl; + os << "Offset to 2nd checkout record: 0x" << std::hex << pFileInfoItem->OffsetCFRecord2 << std::dec << std::endl; + + os << "Number of Items: " << std::hex << pFileInfoItem->NumberOfItems << std::dec << std::endl; + os << "Number of Projects: " << std::hex << pFileInfoItem->NumberOfProjects << std::dec << std::endl; +} + diff --git a/ssphys/SSPhysLib/SSItemInfoObject.h b/ssphys/SSPhysLib/SSItemInfoObject.h new file mode 100644 index 0000000..f1c6dfd --- /dev/null +++ b/ssphys/SSPhysLib/SSItemInfoObject.h @@ -0,0 +1,137 @@ +// SSItemInfoObject.h: interface for the SSItems class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSITEMS_H__716758E6_2B77_471C_B08A_424412E9B758__INCLUDED_) +#define AFX_SSITEMS_H__716758E6_2B77_471C_B08A_424412E9B758__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SSObject.h" +#include "SSVersionObject.h" + +//------------------------------------------------------------------------------ +class SSItemInfoObject : public SSObject +{ +protected: + SSItemInfoObject (SSRecordPtr pRecord); + +public: + ~SSItemInfoObject (); + static SSItemInfoObject* MakeItemInfo (SSRecordPtr pRecord); + +// const char* GetSpec () { return NULL; /* return m_InfoItem.spec; */ } +// const char* GetLocalSpec () { return NULL; /* return m_InfoItem.spec; */ } +// const char* GetName () { return NULL; /* return m_InfoItem.spec; */ } +// SSItemInfoObject* GetParent () { return NULL; } + + // BOOST_PP_SEQ_FOR_EACH(DEFINE_ACCESSORS, GetData(), DH_SEQ); + short GetType () const { return GetData()->Type; } + short GetNumberOfActions () const { return GetData()->NumberOfActions; } + SSName GetSSName () const { return GetData()->SSName; } + std::string GetLatestExt () const { return std::string (GetData()->LatestExt, 2); } + ulong GetHistoryOffsetBegin () const { return GetData()->HistoryOffsetBegin; } + ulong GetHistoryOffsetLast () const { return GetData()->HistoryOffsetLast; } + ulong GetHistoryOffsetEnd () const { return GetData()->HistoryOffsetEnd; } + + // return the last known name of the item + std::string GetName () const { SSName name (GetSSName ()); return name.GetFullName(); } + + SSVersionObject GetHistoryLast () const { return SSVersionObject (GetFile ()->GetRecord (GetHistoryOffsetLast())); } + std::string GetDataFileName () const { return GetFile ()->GetFileName () + GetLatestExt (); } + +// bool GetDeleted () { return 0; } +// bool GetCheckedOut () { return 0; } +// bool GetDifferent () { return 0; } +// bool GetBinary () { return false; } +// int GetVersionNumber () { return 0; } + +// SSItems* GetItems (); +// SSItems* GetCheckouts (); +// SSItem* GetVersion (time_t date) { return NULL; } +// SSItem* GetVersion (int v) { return NULL; } +// SSItems* GetVersions () { return NULL; } + + bool Get (int version, const char* dest); + SSVersionObject GetVersion (int i); + + virtual void Accept (ISSObjectVisitor& rVisitor, const ISSContext* pCtx = NULL) const { rVisitor.Apply (*this, pCtx); } + virtual bool Validate (); + + const DH* GetData () const { return reinterpret_cast (SSObject::GetData ()); } + + void ToXml (XMLNode* pParent) const; + void Dump (std::ostream& os) const; + +private: + DH m_InfoItem; +}; + + +class SSProjectItem : public SSItemInfoObject +{ +protected: + friend SSItemInfoObject* SSItemInfoObject::MakeItemInfo (SSRecordPtr pRecord); + SSProjectItem (SSRecordPtr pRecord); + +public: + std::string GetParentSpec () const { return GetData()->ParentSpec; } + std::string GetParentPhys () const { return GetData()->ParentPhys; } + short GetNumberOfItems () const { return GetData()->NumberOfItems; } + short GetNumberOfProjects () const { return GetData()->NumberOfProjects; } + + virtual void Accept (ISSObjectVisitor& rVisitor, const ISSContext* pCtx = NULL) const { rVisitor.Apply (*this, pCtx); } + + const DH_PROJECT* GetData () const { return reinterpret_cast (SSObject::GetData ()); } + + std::string GetName () const; + void ToXml (XMLNode* pParent) const; + void Dump (std::ostream& os) const; + +private: +}; + + +class SSFileItem : public SSItemInfoObject +{ +protected: + friend SSItemInfoObject* SSItemInfoObject::MakeItemInfo (SSRecordPtr pRecord); + SSFileItem (SSRecordPtr pRecord); + +public: + // accessors + short GetFlag () const { return GetData ()->Flag; } + std::string GetShareSrcPhys () const { return std::string (GetData ()->ShareSrcSpec, 8); } + ulong GetOffsetBFRecord () const { return GetData ()->OffsetBFRecord; } + ulong GetOffsetPFRecord () const { return GetData ()->OffsetPFRecord; } + short GetNumberOfBranches () const { return GetData ()->NumberOfBranches; } + short GetNumberOfReferences () const { return GetData ()->NumberOfReferences; } + ulong GetOffsetCFRecord1() const { return GetData ()->OffsetCFRecord1; } + ulong GetOffsetCFRecord2() const { return GetData ()->OffsetCFRecord2; } +// short GetNumberOfItems() const { return GetData ()->NumberOfItems; } +// short GetNumberOfProjects() const { return GetData ()->NumberOfProjects; } + + // specialized accessors + eFileType GetFileType () const; + bool GetStoreOnlyLatestRev () const; + bool GetCheckedOut () const; + bool GetShared () const; + + SSParentFolderObject* GetFirstParentFolder (); + SSBranchFileObject* GetFirstBranchFile (); + + virtual void Accept (ISSObjectVisitor& rVisitor, const ISSContext* pCtx = NULL) const { rVisitor.Apply (*this, pCtx); } + virtual bool Validate (); + + const DH_FILE* GetData () const { return reinterpret_cast (SSObject::GetData ()); } + + std::string GetName () const; + void ToXml (XMLNode* pParent) const; + void Dump (std::ostream& os) const; + +private: +}; + +#endif // !defined(AFX_SSITEMS_H__716758E6_2B77_471C_B08A_424412E9B758__INCLUDED_) diff --git a/ssphys/SSPhysLib/SSName.cpp b/ssphys/SSPhysLib/SSName.cpp new file mode 100644 index 0000000..5dce145 --- /dev/null +++ b/ssphys/SSPhysLib/SSName.cpp @@ -0,0 +1,76 @@ +// SSName.cpp: implementation of the SSName class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSName.h" +//#include "SSDatabase.h" + + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +SSName::SSName(SSNAME ssname, SSNamesCache* pNameService) + : m_ssName (ssname), + m_pNamesService (pNameService) +{ +// if (!m_pNamesService && SSDatabase::GetCurrentDatabase ()) +// m_pNamesService = SSDatabase::GetCurrentDatabase ()->GetNamesService (); +} + +SSName::~SSName() +{ + +} + +//--------------------------------------------------------------------------- +long SSName::GetOffset () const +{ + return m_ssName.nsmap; +} + +//--------------------------------------------------------------------------- +std::string SSName::GetType () const +{ + switch (m_ssName.flags) + { + case 0: + return "file"; + case 1: + return "project"; + } + return "type unknown"; +} + +//--------------------------------------------------------------------------- +std::string SSName::GetFullName () const +{ + std::string name = m_ssName.name; + if (m_pNamesService && m_ssName.nsmap != NULL) + { + std::string altName = m_pNamesService->GetName (m_ssName.flags, m_ssName.nsmap); + if (!altName.empty ()) + name = altName; + } + return name; +} + +//--------------------------------------------------------------------------- +std::ostream& operator<<(std::ostream& os, const SSName& ssname) +{ + os << ssname.GetFullName (); + + return os; +} + +// --------------------------------------------------------------- +void SSName::ToXml (XMLNode* pParent, std::string name /*= "SSName"*/) +{ + std::stringstream stream; + stream << GetOffset (); + AttribMap map; + map["type"] = GetType (); + map["offset"] = stream.str(); + XMLElement node (pParent, name, map, GetFullName ()); +}; diff --git a/ssphys/SSPhysLib/SSName.h b/ssphys/SSPhysLib/SSName.h new file mode 100644 index 0000000..2469d8a --- /dev/null +++ b/ssphys/SSPhysLib/SSName.h @@ -0,0 +1,38 @@ +// SSName.h: interface for the SSName class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSNAME_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_) +#define AFX_SSNAME_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SSTypes.h" +#include "SSNameObject.h" + +class SSName +{ +public: + SSName(SSNAME ssname, SSNamesCache* pNamesService = NULL); + virtual ~SSName(); + + std::string GetFullName () const; + long GetOffset () const; + std::string GetType () const; + + void ToXml (XMLNode* pParent, std::string name = "SSName"); + operator const SSNAME () + { + return m_ssName; + } + +private: + SSNAME m_ssName; + SSNamesCache* m_pNamesService; +}; + +std::ostream& operator<<(std::ostream& os, const SSName& ssname); + +#endif // !defined(AFX_SSNAME_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_) diff --git a/ssphys/SSPhysLib/SSNameObject.cpp b/ssphys/SSPhysLib/SSNameObject.cpp new file mode 100644 index 0000000..9deecd5 --- /dev/null +++ b/ssphys/SSPhysLib/SSNameObject.cpp @@ -0,0 +1,77 @@ +// SSNameObject.cpp: implementation of the SSNameObject class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" + +#pragma warning (disable: 4786) +#include +#include +#include + +#include "SSNameObject.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +SSNameObject::SSNameObject (SSRecordPtr pRecord) + : SSObject (pRecord, eNameCacheEntry) +{ + Init (pRecord); +} + +void SSNameObject::Init (SSRecordPtr pRecord) +{ + if (pRecord->GetLen () < sizeof (NSMAP) + sizeof (NSMAP)) + throw SSRecordException ("not enough data for name object"); + + const NSMAP* pMap = (NSMAP*) pRecord->GetBuffer(); + const NSENTRY* pEntry = (NSENTRY*) ((byte*)pMap + sizeof (NSMAP)); + const char* pNames = (const char*) ((byte*)pEntry + sizeof (NSENTRY) * pMap->num); + + for (int i = 0; inum; ++i) + { + warn_if (pEntry->id != 1 && pEntry->id != 2 && pEntry->id != 3 && pEntry->id != 10); + + m_NamesMap[pEntry->id] = pNames + pEntry->offset; + + ++pEntry; + } +} + +std::string SSNameObject::GetName (short id) +{ + std::map::iterator iter = m_NamesMap.find (id); + if (iter != m_NamesMap.end ()) + return (*iter).second; + + return ""; +} + + +void SSNameObject::ToXml (XMLNode* pParent) const +{ + XMLElement entries (pParent, "NrOfEntries", size ()); + + std::map::const_iterator iter = m_NamesMap.begin (); + for (; iter != m_NamesMap.end (); ++iter) + { + AttribMap map; + map["id"] = boost::lexical_cast ((*iter).first); + XMLElement name (pParent, "Entry", map, (*iter).second); + } +} + +void SSNameObject::Dump (std::ostream& os) const +{ + SSObject::Dump (os); + + os << "Entries: " << m_NamesMap.size () << std::endl; + + std::map::const_iterator iter = m_NamesMap.begin (); + for (; iter != m_NamesMap.end (); ++iter) + { + os << "id(" << (*iter).first << ") "/*, offset (" << pEntry->offset << ")*/ "= " << (*iter).second < 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SSObject.h" +#include "SSFiles.h" + + +//------------------------------------------------------------------------------ +class SSNameObject : public SSObject +{ +public: + typedef std::map::const_iterator const_iterator; + typedef std::map::size_type size_type; + + SSNameObject (SSRecordPtr pRecord); + + const_iterator begin () const { return m_NamesMap.begin (); } + const_iterator end () const { return m_NamesMap.end (); } + size_type size () const { return m_NamesMap.size (); } + + std::string GetName (short id); + + virtual void Accept (ISSObjectVisitor& rVisitor, const ISSContext* pCtx = NULL) const { rVisitor.Apply (*this, pCtx); } + + void ToXml (XMLNode* pParent) const; + void Dump (std::ostream& os) const; + +protected: + void Init (SSRecordPtr pRecord); + + std::map m_NamesMap; +}; + +//------------------------------------------------------------------------------ +class SSNamesCache +{ +public: + SSNamesCache () + : m_pFile (NULL) + { + } + + ~SSNamesCache () + { + delete m_pFile; + } + + void SetFile (SSNamesCacheFile* pFile) + { + m_pFile = pFile; + } + + std::string GetName (short flag, long offset, int cp=0) + { + if (!m_pFile) + return ""; + + SSRecordPtr pRecord = m_pFile->GetRecord (offset); + SSNameObject names (pRecord); + return names.GetName (flag << 3 | 2); + } + +private: + SSNamesCacheFile* m_pFile; +}; + + +#endif // !defined(AFX_SSNAMEOBJECT_H__8116FB34_17A5_40BB_829F_28413D2A00DA__INCLUDED_) diff --git a/ssphys/SSPhysLib/SSObject.cpp b/ssphys/SSPhysLib/SSObject.cpp new file mode 100644 index 0000000..3558bbe --- /dev/null +++ b/ssphys/SSPhysLib/SSObject.cpp @@ -0,0 +1,139 @@ +// SSObject.cpp: implementation of the SSObject class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSObject.h" +#include "SSItemInfoObject.h" +#include "SSNameObject.h" +#include "SSCheckOutObject.h" +#include "SSProjectObject.h" +#include "SSCommentObject.h" +#include "SSParentFolderObject.h" +#include "SSBranchFileObject.h" + +//--------------------------------------------------------------------------- +#include "LeakWatcher.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +SSObject::SSObject (SSRecordPtr pRecord, eType type) + : m_pRecord (pRecord) +{ + if (pRecord && pRecord->GetType () != type) + throw SSRecordException ("wrong record type"); +} + +SSObject::SSObject () +{ +} + +SSObject::~SSObject () +{ +} + +SSObject* SSObject::MakeObject (SSRecordPtr pRecord) +{ + assert (pRecord); + switch (pRecord->GetType ()) + { + case eItemRecord: + return SSItemInfoObject::MakeItemInfo (pRecord); + case eNameCacheEntry: + return new SSNameObject (pRecord); + case eHistoryRecord: + return new SSVersionObject (pRecord); + case eCheckOutRecord: + return new SSCheckOutObject (pRecord); + case eProjectEntry: + return new SSProjectObject (pRecord); + case eCommentRecord: + return new SSCommentObject (pRecord); + case eParentFolder: + return new SSParentFolderObject (pRecord); + case eBranchFile: + return new SSBranchFileObject (pRecord); + case eFileDelta: + case eNamesCache: + case eUsersHeader: + case eUser: + return new SSObject (pRecord, pRecord->GetType ()); + default: + { + std::ostringstream ost; + ost << "unknwon record type \"" << pRecord->GetRecordType() << "\" detected "; + ost << "(offset 0x" << std::hex << pRecord->GetOffset() << std::dec << ")"; + throw SSRecordException (ost.str()); + } + } + return static_cast (NULL); +} + +//const byte* SSObject::GetDataPtr () const +//{ +// assert (m_pRecord); +// return m_pRecord->GetBuffer (); +//} +// +//byte* SSObject::GetDataPtr () +//{ +// assert (m_pRecord); +// return m_pRecord->GetBuffer (); +//} + +std::string SSObject::GetName () const +{ + assert (*this); + switch (GetType ()) + { + case eItemRecord: + return "ItemInfo"; + case eNameCacheEntry: + return "NameCacheEntry"; + case eHistoryRecord: + return "Version"; + case eCheckOutRecord: + return "CheckOut"; + case eProjectEntry: + return "Project"; + case eCommentRecord: + return "Comment"; + case eParentFolder: + return "ParentFolder"; + case eBranchFile: + return "BranchFile"; + case eFileDelta: + return "FileDelta"; + case eNamesCache: + return "NamesCache"; + case eUsersHeader: + return "UsersHeader"; + case eUser: + return "User"; + }; + + std::ostringstream ost; + ost << GetRecord ()->GetRecordType(); + return ost.str(); +} + +void SSObject::ToXml (XMLNode* pParent) const +{ + std::cout << "" << std::endl; +} + +void SSObject::Dump (std::ostream& os) const +{ + os << "*** "; + os << "Type: " << SSRecord::TypeToString (GetType ()); + os << ", Offset: 0x" << std::hex << GetOffset () << std::dec; + os << " ***" << std::endl; +} \ No newline at end of file diff --git a/ssphys/SSPhysLib/SSObject.h b/ssphys/SSPhysLib/SSObject.h new file mode 100644 index 0000000..a3674ee --- /dev/null +++ b/ssphys/SSPhysLib/SSObject.h @@ -0,0 +1,92 @@ +// SSObject.h: interface for the SSObject class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSOBJECT_H__C8DBBC42_EE5F_4F9B_8935_5831008AB2BF__INCLUDED_) +#define AFX_SSOBJECT_H__C8DBBC42_EE5F_4F9B_8935_5831008AB2BF__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SSRecord.h" +#include "XML.h" +#include + +class SSObject; +class SSVersionObject; +class SSCheckOutObject; +class SSNameObject; +class SSCommentObject; +class SSProjectObject; +class SSParentFolderObject; +class SSBranchFileObject; +//class SSItemInfoObject; +class SSFileItem; +class SSProjectItem; + +class ISSContext +{ +public: + virtual ~ISSContext () {}; +}; + +class ISSObjectVisitor +{ +public: + virtual void Apply(const SSObject& object, const ISSContext* pCtx) = 0; + + virtual void Apply(const SSVersionObject& object, const ISSContext* pCtx) = 0; + virtual void Apply(const SSCheckOutObject& object, const ISSContext* pCtx) = 0; + virtual void Apply(const SSNameObject& object, const ISSContext* pCtx) = 0; + virtual void Apply(const SSCommentObject& object, const ISSContext* pCtx) = 0; + virtual void Apply(const SSProjectObject& object, const ISSContext* pCtx) = 0; + virtual void Apply(const SSParentFolderObject& object, const ISSContext* pCtx) = 0; + virtual void Apply(const SSBranchFileObject& object, const ISSContext* pCtx) = 0; + +// virtual void Apply(const SSItemInfoObject& object, const ISSContext* pCtx) = 0; + virtual void Apply(const SSFileItem& object, const ISSContext* pCtx) = 0; + virtual void Apply(const SSProjectItem& object, const ISSContext* pCtx) = 0; +}; + + + +class SSObject +{ +protected: + SSObject (SSRecordPtr pRecord, eType type); + SSObject (); + +public: + virtual ~SSObject (); + + static SSObject* MakeObject (SSRecordPtr pRecord); + + virtual void Accept (ISSObjectVisitor& rVisitor, const ISSContext* pCtx = NULL) const { rVisitor.Apply (*this, pCtx); }; + virtual bool Validate () { return true; } + + SSFileImpPtr GetFile () const { return m_pRecord->GetFileImp (); } + eType GetType () const { return m_pRecord->GetType (); } + long GetOffset () const { return m_pRecord->GetOffset(); } + + const byte* GetData () const { return m_pRecord->GetBuffer (); } + + SSRecordPtr GetRecord () const { return m_pRecord; } + + operator bool () const { return m_pRecord; } + + virtual std::string GetName () const; + virtual void ToXml (XMLNode* pParent) const; + virtual void Dump (std::ostream& os) const; + +protected: +// const byte* GetDataPtr () const; +// byte* GetDataPtr (); + +private: + + SSRecordPtr m_pRecord; +}; + + +#endif // !defined(AFX_SSOBJECT_H__C8DBBC42_EE5F_4F9B_8935_5831008AB2BF__INCLUDED_) diff --git a/ssphys/SSPhysLib/SSParentFolderObject.cpp b/ssphys/SSPhysLib/SSParentFolderObject.cpp new file mode 100644 index 0000000..e33260f --- /dev/null +++ b/ssphys/SSPhysLib/SSParentFolderObject.cpp @@ -0,0 +1,52 @@ +// SSParentFolderObject.cpp: implementation of the SSParentFolderObject class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSParentFolderObject.h" +#include "SSFiles.h" + +//--------------------------------------------------------------------------- +#include "LeakWatcher.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +SSParentFolderObject::SSParentFolderObject(SSRecordPtr pRecord) +: SSObject (pRecord, eParentFolder) +{ + if (pRecord->GetLen() < sizeof (PF)) + throw SSRecordException ("not enough data for parent folder (PF) object"); +} + +SSParentFolderObject::~SSParentFolderObject() +{ + +} + +SSParentFolderObject* SSParentFolderObject::GetPrevious () +{ + SSRecordPtr pRecord = GetFile()->GetRecord(GetPreviousOffset ()); + return new SSParentFolderObject (pRecord); +} + +void SSParentFolderObject::ToXml (XMLNode* pParent) const +{ + XMLElement previous (pParent, "PreviousOffset", GetPreviousOffset()); + XMLElement parent (pParent, "ParentPhys", GetParentPhys()); +} + +void SSParentFolderObject::Dump (std::ostream& os) const +{ + SSObject::Dump (os); + + os << "Previous: 0x" << std::hex << GetPreviousOffset() << std::dec << std::endl; + os << "Parent : " << GetParentPhys() << std::endl; +} \ No newline at end of file diff --git a/ssphys/SSPhysLib/SSParentFolderObject.h b/ssphys/SSPhysLib/SSParentFolderObject.h new file mode 100644 index 0000000..96ef7d4 --- /dev/null +++ b/ssphys/SSPhysLib/SSParentFolderObject.h @@ -0,0 +1,33 @@ +// SSParentFolderObject.h: interface for the SSParentFolderObject class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSPARENTFOLDEROBJECT_H__B896F3FB_BA6B_4A5E_B7E4_0FEDB9B6B930__INCLUDED_) +#define AFX_SSPARENTFOLDEROBJECT_H__B896F3FB_BA6B_4A5E_B7E4_0FEDB9B6B930__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SSObject.h" + +class SSParentFolderObject : public SSObject +{ +public: + SSParentFolderObject(SSRecordPtr pRecord); + virtual ~SSParentFolderObject(); + + ulong GetPreviousOffset () const { return GetData ()->PreviousOffset; } + std::string GetParentPhys () const { return GetData ()->ParentPhys; } + + SSParentFolderObject* GetPrevious (); + + virtual void Accept (ISSObjectVisitor& rVisitor, const ISSContext* pCtx = NULL) const { rVisitor.Apply (*this, pCtx); } + const PF* GetData () const { return reinterpret_cast (SSObject::GetData ()); } + + void ToXml (XMLNode* pParent) const; + void Dump (std::ostream& os) const; +private: +}; + +#endif // !defined(AFX_SSPARENTFOLDEROBJECT_H__B896F3FB_BA6B_4A5E_B7E4_0FEDB9B6B930__INCLUDED_) diff --git a/ssphys/SSPhysLib/SSPhysLib.dsp b/ssphys/SSPhysLib/SSPhysLib.dsp new file mode 100644 index 0000000..5d5bd9f --- /dev/null +++ b/ssphys/SSPhysLib/SSPhysLib.dsp @@ -0,0 +1,241 @@ +# Microsoft Developer Studio Project File - Name="SSPhysLib" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=SSPhysLib - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "SSPhysLib.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "SSPhysLib.mak" CFG="SSPhysLib - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "SSPhysLib - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "SSPhysLib - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "SSPhysLib - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GR /GX /O2 /I "..\Utils" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "SSPhysLib - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "..\Utils" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Yu"stdafx.h" /FD /GZ /Zm200 /c +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "SSPhysLib - Win32 Release" +# Name "SSPhysLib - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=crc.cpp +# End Source File +# Begin Source File + +SOURCE=.\FileName.cpp +# End Source File +# Begin Source File + +SOURCE=.\SSException.cpp +# End Source File +# Begin Source File + +SOURCE=SSFiles.cpp +# End Source File +# Begin Source File + +SOURCE=SSName.cpp +# End Source File +# Begin Source File + +SOURCE=SSRecord.cpp +# End Source File +# Begin Source File + +SOURCE=.\SSTypes.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=crc.h +# End Source File +# Begin Source File + +SOURCE=.\FileName.h +# End Source File +# Begin Source File + +SOURCE=.\SSException.h +# End Source File +# Begin Source File + +SOURCE=SSFiles.h +# End Source File +# Begin Source File + +SOURCE=SSName.h +# End Source File +# Begin Source File + +SOURCE=SSRecord.h +# End Source File +# Begin Source File + +SOURCE=SSTypes.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\XML.h +# End Source File +# End Group +# Begin Group "SSObjects" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\SSBranchFileObject.cpp +# End Source File +# Begin Source File + +SOURCE=.\SSBranchFileObject.h +# End Source File +# Begin Source File + +SOURCE=SSCheckOutObject.cpp +# End Source File +# Begin Source File + +SOURCE=SSCheckOutObject.h +# End Source File +# Begin Source File + +SOURCE=SSCommentObject.cpp +# End Source File +# Begin Source File + +SOURCE=SSCommentObject.h +# End Source File +# Begin Source File + +SOURCE=SSItemInfoObject.cpp +# End Source File +# Begin Source File + +SOURCE=SSItemInfoObject.h +# End Source File +# Begin Source File + +SOURCE=SSNameObject.cpp +# End Source File +# Begin Source File + +SOURCE=SSNameObject.h +# End Source File +# Begin Source File + +SOURCE=SSObject.cpp +# End Source File +# Begin Source File + +SOURCE=SSObject.h +# End Source File +# Begin Source File + +SOURCE=SSParentFolderObject.cpp +# End Source File +# Begin Source File + +SOURCE=SSParentFolderObject.h +# End Source File +# Begin Source File + +SOURCE=SSProjectObject.cpp +# End Source File +# Begin Source File + +SOURCE=SSProjectObject.h +# End Source File +# Begin Source File + +SOURCE=SSVersionObject.cpp +# End Source File +# Begin Source File + +SOURCE=SSVersionObject.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\Readme.txt +# End Source File +# End Target +# End Project diff --git a/ssphys/SSPhysLib/SSProjectObject.cpp b/ssphys/SSPhysLib/SSProjectObject.cpp new file mode 100644 index 0000000..e4ea876 --- /dev/null +++ b/ssphys/SSPhysLib/SSProjectObject.cpp @@ -0,0 +1,165 @@ +// SSProjectObject.cpp: implementation of the SSProjectObject class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSProjectObject.h" +#include "SSName.h" +#include + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +SSProjectObject::SSProjectObject(const PROJECT_ENTRY& pe) + : SSObject(SSRecordPtr (new SSRecord (eProjectEntry, &pe, sizeof (PROJECT_ENTRY))), eProjectEntry) +{ + if (GetRecord()->GetLen() < sizeof (PROJECT_ENTRY)) + throw SSRecordException ("not enough data for project object"); + + m_pProjectEntry = (PROJECT_ENTRY*) SSObject::GetData (); +} + +SSProjectObject::SSProjectObject(SSRecordPtr pRecord) + : SSObject(pRecord, eProjectEntry) +{ + if (pRecord->GetLen() < sizeof (PROJECT_ENTRY)) + throw SSRecordException ("not enough data for project object"); + + m_pProjectEntry = (PROJECT_ENTRY*) SSObject::GetData (); +} + +SSProjectObject::~SSProjectObject() +{ + +} + +std::string SSProjectObject::GetName () const +{ + SSName name (m_pProjectEntry->name); + std::string fullName (name.GetFullName()); +// if (IsShared()) + if (GetPinnedToVersion() != 0) + { + char buffer[66]; + fullName += ";"; + fullName += itoa (GetPinnedToVersion(), buffer, 10); + } + return fullName; +} + +std::string SSProjectObject::GetPhysFile () const +{ + return std::string (m_pProjectEntry->phys, 8); +} + +int SSProjectObject::GetType () const +{ + return (m_pProjectEntry->type); +} + +eFileType SSProjectObject::GetFileType () const +{ + if (IsStoreBinaryDiff ()) + return eFileTypeBinary; + + return eFileTypeText; +} + +bool SSProjectObject::IsDeleted () const +{ + return (m_pProjectEntry->flags & 0x01) != 0; +} + +bool SSProjectObject::IsStoreBinaryDiff () const +{ + return (m_pProjectEntry->flags & 0x02) != 0; +} + +bool SSProjectObject::IsStoreLatestRev () const +{ + return (m_pProjectEntry->flags & 0x04) != 0; +} + +bool SSProjectObject::IsShared () const +{ + return (m_pProjectEntry->flags & 0x08) != 0; +} + +int SSProjectObject::GetPinnedToVersion () const +{ + return (m_pProjectEntry->pinnedToVersion); +} + +// 0x08 shared +// 0x02 store binary diffs +// 0x01 deleted +std::string FlagsToString (short flags) +{ + std::ostringstream ost; + if (flags & 0x01) + ost << "deleted"; + if (flags & 0x02) + ost << " binary"; + if (flags & 0x08) + ost << " shared"; + if (flags & 0xf4) + ost << " unknown(" << flags << ")"; + + ost << '\0'; + return ost.str (); +} + +std::string TypeToString (short type) +{ + warn_if (type != 1 && type != 2); + + char* types[2] = { "project", "file" }; + if (type == 1 || type == 2) + return types[type-1]; + + std::ostringstream ost; + ost << "unknown type 0x" << std::hex << type << std::endl; + return ost.str(); +} + +//void SSProjectObject::Dump (std::ostream& os) +//{ +// oss << "Type: " << TypeToString (m_pProjectEntry->type) << std::endl; +// oss << "Flags: 0x" << std::hex << m_pProjectEntry->flags << std::dec << " " << FlagsToString (m_pProjectEntry->flags) << std::endl; +// SSName ssName (m_pProjectEntry->name); +// oss << "SSName: " << ssName << std::endl; +// if (m_pProjectEntry->pinnedToVersion) +// oss << "Pinned to version: " << m_pProjectEntry->pinnedToVersion << std::endl; +// oss << "Phys file: " << m_pProjectEntry->phys << std::endl; +//} + +void SSProjectObject::Delete () +{ + m_pProjectEntry->flags &= 0x01; +} +void SSProjectObject::Recover () +{ + m_pProjectEntry->flags &= ~0x01; +} +void SSProjectObject::Rename (SSNAME oldName, SSNAME newName) +{ + if (memcmp (&oldName, &m_pProjectEntry->name, sizeof (SSNAME)) != 0) + throw SSException ("old name does not match"); + + m_pProjectEntry->name = newName; +} + +void SSProjectObject::Pin (int version) +{ + m_pProjectEntry->pinnedToVersion = version; +} + +//void SSProjectObject::ToXml (XMLNode* pParent) const +//{ +//} +void SSProjectObject::Dump (std::ostream& os) const +{ + SSObject::Dump (os); + +} diff --git a/ssphys/SSPhysLib/SSProjectObject.h b/ssphys/SSPhysLib/SSProjectObject.h new file mode 100644 index 0000000..b51de54 --- /dev/null +++ b/ssphys/SSPhysLib/SSProjectObject.h @@ -0,0 +1,50 @@ +// SSProjectObject.h: interface for the SSProjectObject class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSPROJECTOBJECT_H__77FEAD1D_3579_4375_BF98_912CB41B8F96__INCLUDED_) +#define AFX_SSPROJECTOBJECT_H__77FEAD1D_3579_4375_BF98_912CB41B8F96__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SSObject.h" + +class SSProjectObject : public SSObject +{ +public: + SSProjectObject(const PROJECT_ENTRY& pe); + SSProjectObject(SSRecordPtr pRecord); + virtual ~SSProjectObject(); + + std::string GetName () const; + std::string GetPhysFile () const; + + int GetType () const; + eFileType GetFileType () const; + int GetPinnedToVersion () const; + + bool IsDeleted () const; + bool IsStoreBinaryDiff () const; + bool IsStoreLatestRev () const; + bool IsShared () const; + + void Delete (); + void Recover (); + void Rename (SSNAME oldName, SSNAME newName); + void Pin (int version); + + virtual void Accept (ISSObjectVisitor& rVisitor, const ISSContext* pCtx = NULL) const { rVisitor.Apply (*this, pCtx); } + + const PROJECT_ENTRY* GetData () const { return (const PROJECT_ENTRY*) SSObject::GetData (); } + +// void ToXml (XMLNode* pParent) const; + void Dump (std::ostream& os) const; + +protected: + // convinience pointer into the data buffer + PROJECT_ENTRY* m_pProjectEntry; +}; + +#endif // !defined(AFX_SSPROJECTOBJECT_H__77FEAD1D_3579_4375_BF98_912CB41B8F96__INCLUDED_) diff --git a/ssphys/SSPhysLib/SSRecord.cpp b/ssphys/SSPhysLib/SSRecord.cpp new file mode 100644 index 0000000..19de9c0 --- /dev/null +++ b/ssphys/SSPhysLib/SSRecord.cpp @@ -0,0 +1,140 @@ +// SSRecord.cpp: implementation of the SSRecord class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSRecord.h" +#include "SSFiles.h" +#include "crc.h" + +//--------------------------------------------------------------------------- +#include "LeakWatcher.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + + +struct TypeMap { + char _string[3]; + eType _eType; +}; + +TypeMap g_TypeMap[] = { + {"DH", eItemRecord}, + {"MC", eCommentRecord}, + {"EL", eHistoryRecord}, + {"CF", eCheckOutRecord}, + {"PF", eParentFolder}, + {"FD", eFileDelta}, + {"HN", eNamesCache}, + {"SN", eNameCacheEntry}, + {"JP", eProjectEntry}, + {"HU", eUsersHeader}, + {"UU", eUser}, + {"BF", eBranchFile}, +}; + +eType SSRecord::StringToType (const char type[2]) +{ + for (int i = 0; i< countof(g_TypeMap); ++i) + { + if (0 == memcmp (type, g_TypeMap[i]._string, 2)) + return g_TypeMap[i]._eType; + } + + return eUnknown; +} + +std::string SSRecord::TypeToString (eType type) +{ + for (int i = 0; i< countof(g_TypeMap); ++i) + { + if (type == g_TypeMap[i]._eType) + return std::string (g_TypeMap[i]._string, 2); + } + + if (type == eNone) + return "none"; + + return "unknown"; +} + +bool SSRecord::IsValid () const +{ + // TODO: check checksum + return m_pBuffer != NULL; +} + +eType SSRecord::GetType () const +{ + if (!m_pBuffer) + return eNone; + return SSRecord::StringToType (m_Header.type); +} + +SSRecord::SSRecord (SSFileImpPtr filePtr, long offset) + : m_FileImpPtr (filePtr), m_Offset(offset), m_pBuffer(NULL), m_Len (0) +{ + if (!m_FileImpPtr->Read (offset, &m_Header, sizeof(m_Header))) + throw SSException ("could not read record header"); + + // OPTIMIZE: We do not nead to read all the record payload in advance (esp. for FD records) + if (m_Header.size > 0) + { + int fileLength = m_FileImpPtr->Size (); + if (offset + sizeof(m_Header) + m_Header.size > fileLength) + throw SSRecordException ("bad header: length variable exceeds file size"); + + m_pBuffer = new byte[m_Header.size]; + if (!m_FileImpPtr->Read (offset + sizeof(m_Header), m_pBuffer, m_Header.size)) + throw SSException ("could not read record data"); + + short crc = calc_crc16 (m_pBuffer, m_Header.size); + if (m_Header.checksum != (short)crc && m_Header.checksum != 0) + { + SSRecordException ex("wrong checksum"); + Warning (ex.what()); + _RAISE (ex); + } + } + + m_Len = m_Header.size; +} + +SSRecord::SSRecord (eType type, const void* buffer, int len) + : m_Offset(0), m_pBuffer(NULL), m_Len (0) +{ + m_Header.checksum = calc_crc16 (buffer, len); + strncpy (m_Header.type, TypeToString (type).c_str(), 2); + m_Header.size = len; + + // OPTIMIZE: We do not nead to read all the record payload in advance (esp. for FD records) + if (m_Header.size > 0) + { + m_pBuffer = new byte[m_Header.size]; + memcpy (m_pBuffer, buffer, m_Header.size); + } + + m_Len = m_Header.size; +} + +void SSRecord::Dump (std::ostream& os) const +{ + os << "Offset: " << GetOffset (); + os << " Type: " << GetRecordType (); + os << " Len: " << GetLen(); + std::string validity = IsValid() ? "valid" : "invalid"; + os << " crc: " << m_Header.checksum << " -> " << validity << std::endl; +} + +SSRecord::~SSRecord () +{ + delete [] m_pBuffer; +} diff --git a/ssphys/SSPhysLib/SSRecord.h b/ssphys/SSPhysLib/SSRecord.h new file mode 100644 index 0000000..6b2eb52 --- /dev/null +++ b/ssphys/SSPhysLib/SSRecord.h @@ -0,0 +1,70 @@ +// SSRecord.h: interface for the SSRecord class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSRECORD_H__2A40F202_FFA7_401B_87D7_FDA36EF531B9__INCLUDED_) +#define AFX_SSRECORD_H__2A40F202_FFA7_401B_87D7_FDA36EF531B9__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +#include "SSTypes.h" +#include "SSFiles.h" + +//--------------------------------------------------------------------------- +enum eType { + eNone, + eItemRecord, // DH, DH_PROJECT, DH_FILE + eHistoryRecord, // EL + eCommentRecord, // MC + eCheckOutRecord, // CF + eParentFolder, // PF + eFileDelta, // FD + eNamesCache, // HN + eNameCacheEntry, // SN + eProjectEntry, // JP + eUsersHeader, // HU + eUser, // UU + eBranchFile, // BF + eUnknown +}; + +class SSRecord +{ + friend SSFileImp; + SSRecord (SSFileImpPtr filePtr, long offset); +public: + SSRecord (eType type, const void* buffer, int len); + ~SSRecord (); + + static eType StringToType (const char type[2]); + static std::string TypeToString (eType type); + + bool IsValid () const; + + const byte* GetBuffer () const { return m_pBuffer; } + byte* GetBuffer () { return m_pBuffer; } + int GetLen () const { return m_Len; } + long GetOffset () const { return m_Offset; } + long GetNextOffset () const { return m_Offset + m_Len + sizeof(m_Header); } + std::string GetRecordType () const { return std::string (m_Header.type, 2); } + eType GetType () const; + + SSFileImpPtr GetFileImp () const { return m_FileImpPtr; } + + void Dump (std::ostream& os) const; + +private: + RECORD_HEADER m_Header; + byte* m_pBuffer; + int m_Len; + long m_Offset; + SSFileImpPtr m_FileImpPtr; +}; + +typedef boost::shared_ptr SSRecordPtr; + + +#endif // !defined(AFX_SSRECORD_H__2A40F202_FFA7_401B_87D7_FDA36EF531B9__INCLUDED_) diff --git a/ssphys/SSPhysLib/SSTypes.cpp b/ssphys/SSPhysLib/SSTypes.cpp new file mode 100644 index 0000000..f8adf39 --- /dev/null +++ b/ssphys/SSPhysLib/SSTypes.cpp @@ -0,0 +1,39 @@ +// SSTypes.cpp: +// +////////////////////////////////////////////////////////////////////// + +#include "StdAfx.h" +#include "SSTypes.h" + +//--------------------------------------------------------------------------- +extern char* g_szActions[] = { + "Labeled", // = 0 + "Created Project", // = 1 + "Added Project", // = 2 + "Added File", // = 3 + "Destroyed Project", // = 4 + "Destroyed File", // = 5 + "Deleted Project", // = 6 + "Deleted File", // = 7 + "Recovered Project", // = 8 + "Recovered File", // = 9 + "Renamed Project", // = 10 + "Renamed File", // = 11 + "Action 12", // missing action 12 + "Action 13", // missing action 13 + "Shared File", // = 14 + "Branch File", // = 15 ??? + "Created File", // = 16 + "Checked in", // = 17 + "Action 18", // missing action 18 + "RollBack" // = 19 + // missing known actions: branches, archives, restores +}; + +const char* CAction::ActionToString (eAction e) +{ + if (e < countof (g_szActions)) + return g_szActions[e]; + return ("unknown"); +} + diff --git a/ssphys/SSPhysLib/SSTypes.h b/ssphys/SSPhysLib/SSTypes.h new file mode 100644 index 0000000..ae903c4 --- /dev/null +++ b/ssphys/SSPhysLib/SSTypes.h @@ -0,0 +1,476 @@ +// SSTypes.h:structure definitions for SourceSafe files +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSTYPES_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_) +#define AFX_SSTYPES_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +#include "time.h" +#include +#include +#include + +typedef unsigned char byte; +typedef unsigned long ulong; +typedef unsigned short ushort; + +inline std::string toString (const char* ch, int len) +{ + return std::string (ch, len); +} + +inline std::string timeToString (const time_t& t, int len) +{ + char date[12]; + char time[12]; + const char* format2 = "Date: %-8s Time: %s"; + const tm* ttm = gmtime (&t);//localtime (&versionDate); + strftime (date, countof (date), "%x", ttm); + strftime (time, countof (time), "%X", ttm); + char line2[60]; _snprintf (line2, 60, format2, date, time); + return line2; +} + +//--------------------------------------------------------------------------- +// OLE API documentation +// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvss/html/vssauto.asp + +//--------------------------------------------------------------------------- +//struct RECORD_HEADER { +// ulong size; +// char type[2]; +// short checksum; +//}; + +#define SS_TYPE_I(T) BOOST_PP_SEQ_ELEM(0, T) +#define SS_VARIABLE_I(T) BOOST_PP_SEQ_ELEM(1, T) +#define SS_ARRAYSIZE_I(T) BOOST_PP_SEQ_ELEM(2, T) +#define SS_RETURNTYPE_I(T) BOOST_PP_SEQ_ELEM(3, T) +#define SS_CONVFUNC_I(T) BOOST_PP_SEQ_ELEM(4, T) + +#define SS_IS_ARRAY_I(T) BOOST_PP_IF (BOOST_PP_GREATER(BOOST_PP_SEQ_SIZE(T),2), BOOST_PP_GREATER(SS_ARRAYSIZE_I(T),1), 0) +#define SS_ARRAY_DECL(T) BOOST_PP_CAT([, BOOST_PP_CAT(SS_ARRAYSIZE_I(T), ])) + +#define SS_IS_RETURNTYPE_I(T) BOOST_PP_GREATER(BOOST_PP_SEQ_SIZE(T),3) +#define SS_IS_CONVFUNC_I(T) BOOST_PP_GREATER(BOOST_PP_SEQ_SIZE(T),4) + +#define SS_TYPE(T) SS_TYPE_I(T) +#define SS_NAME(T) SS_VARIABLE_I(T) +#define SS_VARIABLE_DECL(T) BOOST_PP_IF(SS_IS_ARRAY_I(T), BOOST_PP_CAT(SS_VARIABLE_I(T), SS_ARRAY_DECL(T)), SS_VARIABLE_I(T)) +#define SS_RETURNTYPE(T) BOOST_PP_IF(SS_IS_RETURNTYPE_I(T), SS_RETURNTYPE_I(T), SS_TYPE_I(T)) + +#define SS_ACCESSOR(DATA, T) return (DATA->SS_NAME(T)); +#define SS_CONVERTER(DATA, T, FUNC) return FUNC (DATA->SS_NAME(T), SS_ARRAYSIZE_I(T)); + + +#define DEFINE_ELEMENTS(r, data, T) \ + SS_TYPE(T) SS_VARIABLE_DECL(T); + +#define SS_STRUCT(name, fields) \ + struct name \ + { \ + BOOST_PP_SEQ_FOR_EACH(DEFINE_ELEMENTS, ~, fields) \ + }; + +#define DEFINE_ACCESSORS(R, DATA, T) \ + SS_RETURNTYPE(T) BOOST_PP_CAT (Get, SS_NAME(T)) () const\ + { \ + BOOST_PP_IF(SS_IS_CONVFUNC_I(T), SS_CONVERTER(DATA, T, SS_CONVFUNC_I(T)), SS_ACCESSOR(DATA, T)); \ + } + + +#define RECORD_HEADER_SEQ \ + ((ulong) (size)) \ + ((char) (type) (2) (std::string) (toString)) \ + ((short) (checksum)) + +SS_STRUCT(RECORD_HEADER, RECORD_HEADER_SEQ); + + +//struct SSNAME { +// short flags; // 00 = item, 01 == project +// char name[34]; // short name +// ulong nsmap; // offset into the names.dat +// +//}; + +#define SSNAME_SEQ \ + ((short) (flags)) /* 00 = item, 01 == project */ \ + ((char) (name) (34) (std::string) (toString)) /* short name */ \ + ((ulong) (nsmap)) /* offset into the names.dat */ + +SS_STRUCT(SSNAME, SSNAME_SEQ); + +// TODO: in the OLE API: VSSITEM_PROJECT = 0; VSSITEM_FILE = 1 +#define SSITEM_PROJECT 1 +#define SSITEM_FILE 2 + +enum eFileType +{ + eFileTypeBinary, + eFileTypeText +}; + + +//struct DH { +// short type; // 1 Project, 2 File +// +// short numberOfRecords; +// +// // This is the last name that was given to the item +// SSNAME name; +// char dummy2[2]; +// char fileExt[2]; // .A or .B +// +// // offsets for records +// ulong i1; // first EL Header +// ulong i2; // last EL oder FD HEader +// ulong i3; // size of the file +//}; + +#define DH_SEQ \ + ((short) (Type)) /* 1 Project, 2 File */ \ + ((short) (NumberOfActions)) \ + \ + /* This is the last name that was given to the item */ \ + ((SSNAME) (SSName)) \ + ((char) (Dummy) (2) (std::string) (toString)) \ + ((char) (LatestExt) (2) (std::string) (toString)) /* .A or .B */ \ + \ + /* offsets for records */ \ + ((ulong) (HistoryOffsetBegin)) /* first EL Header */ \ + ((ulong) (HistoryOffsetLast)) /* last EL oder FD HEader */ \ + ((ulong) (HistoryOffsetEnd)) /* size of the file */ + +SS_STRUCT (DH, DH_SEQ); + + + +struct DH_FILE : public DH { + char dummy4[20]; + + // 0x00 == initial + // 0x02 == binary + // 0x04 == store only latest revision + // 0x41 == checked out + // 0x20 == shared + short Flag; + char ShareSrcSpec[10]; + + ulong OffsetBFRecord; // offset to the last BR record in the file + ulong OffsetPFRecord; // offset to the last PF record in the file + short NumberOfBranches; // number of the BF records + short NumberOfReferences; // Reference count for the item + + ulong OffsetCFRecord1; // file checked out, ptr to CF record + ulong OffsetCFRecord2; // file not checked out, ptr to CF record + int unknown; // changes after checkin + + char dummy5[8]; + + // diese scheinen immer Paare zu bilden, nach einem Checkin ändert sich + // der d11, d21 + // d12 == d22 == d32 + short d11; + short d12; + short d21; + short d22; + short d31; + short d32; + + char dummy6[4]; + + // dito wie dxx, jedoch zum ersten mal nach einem Checkin + short e11; + short e12; + short e21; + short e22; + short e31; + short e32; + + char dummy7[200]; + + short NumberOfItems; // including projects + short NumberOfProjects; // number of subprojects +}; + +struct DH_PROJECT : public DH { + char dummy4[20]; + + char ParentSpec[258]; // of last checkout + short dummy7; + + char ParentPhys[10]; + char dummy8[2]; + + short NumberOfItems; // including projects + short NumberOfProjects; +}; + +enum eAction { + Labeled = 0, + Created_Project = 1, + Added_Project = 2, + Added_File = 3, + Destroyed_Project = 4, + Destroyed_File = 5, + Deleted_Project = 6, + Deleted_File = 7, + Recovered_Project = 8, + Recovered_File = 9, + Renamed_Project = 10, + Renamed_File = 11, + // missing action 12, + // missing action 13 + Shared_File = 14, // Share, Pin, Unpin + Branch_File = 15, // reported as Rollback im Parent Project + Created_File = 16, + Checked_in = 17, + // missing action 18 + RollBack = 19 + // missing known actions: archives, restores +}; + +inline eAction ushortToAction (const ushort& v, int) +{ + return static_cast (v); +} + +#define VERSION_RECORD_SEQ \ + ((ulong) (Previous)) /* previous VERSION_RECORD */ \ + ((ushort) (ActionID) (1) (eAction) (ushortToAction)) /* eAction action */ \ + ((short) (VersionNumber)) \ + ((time_t) (Date) (1) (std::string) (timeToString)) \ + ((char) (Username) (32) (std::string) (toString)) \ + \ + ((char) (Label) (32) (std::string) (toString)) \ + \ + /* This seems to be always be a pointer to the next record \ + If (lengthComment != 0) this next record is the comment record */ \ + ((ulong) (OffsetToNextRecordOrComment)) \ + \ + /* This offset seems to be NULL in most cases \ + In case of a LabelAction this is the offset to the so called LabelComment Record \ + In addition the lengthLabelComment is > 0 */ \ + ((ulong) (OffsetToLabelComment)) \ + \ + /* Length of the comment strings */ \ + ((short) (LengthComment)) \ + ((short) (LengthLabelComment)) + +SS_STRUCT (VERSION_RECORD, VERSION_RECORD_SEQ); + +//struct VERSION_RECORD { +// ulong previous; // previous VERSION_RECORD +// ushort action; // eAction action; +// short version; +// time_t date; +// char user[32]; +// +// char label[32]; +// +// // This seems to be always be a pointer to the next record +// // If (lengthComment != 0) this next record is the comment record +// ulong offsetToNextRecordOrComment; +// +// // This offset seems to be NULL in most cases +// // In case of a LabelAction this is the offset to the so called LabelComment Record +// // In addition the lengthLabelComment is > 0 +// ulong offsetToLabelComment; +// +// // Length of the comment strings +// short lengthComment; +// short lengthLabelComment; +//}; + +struct ITEM_ACTION { + SSNAME name; + char physical[10]; +} ; + +//struct CREATED_PROJECT_ACTION { +// SSNAME name; +// char physical[10]; +//} ; + +//struct ADDED_PROJECT_ACTION { +// SSNAME name; +// char physical[10]; +//} ; + +//struct ADDED_FILE_ACTION { +// SSNAME name; +// char physical[10]; +//} ; + +struct DESTROYED_ACTION { + SSNAME name; + short padding; + char physical[10]; +} ; + +//struct DESTROYED_PROJECT_ACTION { +// SSNAME name; +// short padding; +// char physical[10]; +//} ; +// +//struct DESTROYED_FILE_ACTION { +// SSNAME name; +// short padding; +// char physical[10]; +//} ; + +//struct DELETED_PROJECT_ACTION { +// SSNAME name; +// char physical[10]; +//} ; +// +//struct DELETED_FILE_ACTION { +// SSNAME name; +// char physical[10]; +//} ; +// +//struct RECOVERED_PROJECT_ACTION { +// SSNAME name; +// char physical[10]; +//} ; +// +//struct RECOVERED_FILE_ACTION { +// SSNAME name; +// char physical[10]; +//} ; + +struct RENAMED_ACTION { + SSNAME newName; + SSNAME name; // old name + char physical[10]; +} ; + +struct SHARED_FILE_ACTION { + char srcPathSpec[260]; + SSNAME name; + short pinnedToVersion; // -1: shared, 0: pinned; >0 unpinned und letzte Version? + short version; // >0: version, ==0 unpinned + short padding2; // reference ins project file? Nr des shares? + char physical[10]; +} ; + +//struct CREATED_FILE_ACTION { +// SSNAME name; +// char physical[10]; +//} ; + +struct CHECKED_IN_ACTION { + ulong offsetFileDelta; + long padding; + char checkInSpec[260]; +}; + +struct ROLLBACK_ACTION { + SSNAME name; + char physical[10]; + char parent[10]; +}; + + +struct CF { + char User[32]; + char Padding[4]; + // zusammen 260? + char CheckOutFolder[256]; + char Padding2[4]; + char Computer[32]; + // zusammen 260 +// char parentSpec[80]; +// char fileSpec2[60]; +// char padding3[120]; + char ParentSpec[260]; + + char Comment[13]; + char Padding4[51]; + + // initial alles 0 + // Check Out: flag1=01, flag2=40, flag3=00 + // Check In : flag1=00, flag2=00, flag3=10 + char Flag1; + char Padding5; + char Flag2; + char Padding6[8]; + char Flag3; + int NumberOfVersions; +} ; + +struct FD { + short command; // 01 copy, 00 replace, 02 + short dummy; + ulong start; + ulong end; +} ; + +struct PF { + ulong PreviousOffset; + char ParentPhys[10]; + short padding; +} ; + +struct BF { + ulong PreviousOffset; + char BranchToPhys[10]; + short padding; +} ; + +//--------------------------------------------------------------------------- +struct PROJECT_ENTRY{ + short type; + // 0x01 deleted + // 0x02 store binary diffs + // 0x04 store only latest revision + // 0x08 shared + short flags; + SSNAME name; + short pinnedToVersion; + char phys[10]; +} ; + +//--------------------------------------------------------------------------- +struct HN { + ulong size; + char type[2]; + short checksum; + char unknown1[16]; + ulong fileLen; + char unknown2[60]; +}; + +struct NSENTRY{ + // 1: 8.3 Name + // 2: voller name + // 3: 28.3 Name //? + // 10: Projekte + short id; + short offset; +} ; + +struct NSMAP{ + short num; + short unknown; +} ; + + + +//--------------------------------------------------------------------------- +class CAction +{ +public: + static const char* ActionToString (eAction e); +}; + + + +#endif // !defined(AFX_SSTYPES_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_) diff --git a/ssphys/SSPhysLib/SSVersionObject.cpp b/ssphys/SSPhysLib/SSVersionObject.cpp new file mode 100644 index 0000000..fcaaef8 --- /dev/null +++ b/ssphys/SSPhysLib/SSVersionObject.cpp @@ -0,0 +1,521 @@ +// SSVersionObject.cpp: implementation of the SSVersionObject class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "SSVersionObject.h" +#include "SSFiles.h" +#include "SSName.h" + +//--------------------------------------------------------------------------- +#include "LeakWatcher.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +SSVersionObject::SSVersionObject (SSRecordPtr pRecord) + : SSObject (pRecord, eHistoryRecord), + m_pAction (NULL) +{ + if (pRecord) + { + if (pRecord->GetLen() < sizeof (VERSION_RECORD)) + throw SSRecordException ("not enough data for version object"); + + m_pAction = SSAction::MakeAction (pRecord); + } +} + +SSVersionObject::~SSVersionObject () +{ + delete m_pAction; +} + +SSVersionObject::SSVersionObject (SSVersionObject& object) + : SSObject (object), + m_pAction (NULL) +{ + m_pAction = SSAction::MakeAction (GetRecord()); +} + +SSVersionObject& SSVersionObject::operator= (SSVersionObject const & object) +{ + if (&object != this) + { + *(SSObject*)this = object; + m_pAction = SSAction::MakeAction (GetRecord()); + } + return *this; +} + +std::string SSVersionObject::GetComment () const +{ + if (GetOffsetToNextRecordOrComment() && GetLengthComment()) + { + SSCommentObject comment (GetFile ()->GetRecord (GetOffsetToNextRecordOrComment())); + return comment.GetComment(); + } + return ""; +} + +//std::string SSVersionObject::GetLabel () const +//{ +// const SSLabeledAction* pLabeledAction = dynamic_cast (m_pAction); +// return pLabeledAction ? pLabeledAction->GetLabel () : ""; +//} +std::string SSVersionObject::GetLabelComment () const +{ + const SSLabeledAction* pLabeledAction = dynamic_cast (m_pAction); + return pLabeledAction ? pLabeledAction->GetLabelComment () : ""; +} + +SSVersionObject SSVersionObject::GetPreviousObject () const +{ + if (GetPrevious () == 0) + return SSVersionObject (SSRecordPtr()); + + return SSVersionObject (GetFile ()->GetRecord (GetPrevious ())); +} + +bool SSVersionObject::Validate () +{ + bool retval = true; + + SSRecordPtr pLabelCommentRecord; + SSRecordPtr pNext; + SSRecordPtr pPrevious; + + const VERSION_RECORD* pVersion = GetData (); + if (pVersion->OffsetToLabelComment) + pLabelCommentRecord = GetFile ()->GetRecord (pVersion->OffsetToLabelComment); + if (pVersion->OffsetToNextRecordOrComment) + pNext = GetFile ()->GetRecord (pVersion->OffsetToNextRecordOrComment); + if (pVersion->Previous) + pPrevious = GetFile ()->GetRecord (pVersion->Previous); + + if ( (pVersion->LengthLabelComment == 0 && pVersion->OffsetToLabelComment != 0) + || (pVersion->LengthLabelComment != 0 && pVersion->OffsetToLabelComment == 0) ) + { + Warning ("invalid length and offset combination"); + retval &= false; + } + + if (pVersion->LengthLabelComment) + { + retval &= warn_with_msg_if (!pLabelCommentRecord, "the expected comment record is invalid") + + retval &= warn_with_msg_if (pLabelCommentRecord->GetType () != eCommentRecord, + "the record pointed to by offsetToLabelComment is expected to be a comment record"); + return false; + } + + if (pVersion->LengthComment) + { + retval &= warn_with_msg_if (!pNext, "the expected comment record is invalid"); + + retval &= warn_with_msg_if (pNext->GetType () != eCommentRecord, + "the record pointed to by offsetToNextRecordOrComment is expected to be a comment record"); + } + + if (pVersion->Previous && !pPrevious) + { + Warning ("a previous record is specified, but the record could not be read"); + retval &= false; + } + + if (pPrevious) + { + retval = warn_with_msg_if (pPrevious->GetType () != eHistoryRecord, + "the record pointed to by previous is expected to be a history record"); + } + + return retval; +} + // --------------------------------------------------------------- + class ActionNode : public XMLNode + { + public: + ActionNode (XMLNode* pParent, eAction actionid) + : XMLNode (pParent, "Action", ToAttribMap(actionid)) + { + } + + static AttribMap ToAttribMap (eAction actionid) + { + std::string actionString = CAction::ActionToString (actionid); + actionString.erase (std::remove (actionString.begin (), actionString.end (), ' ')); + + return ToAttribMap (actionString); + } + static AttribMap ToAttribMap (std::string actionString) + { + AttribMap map; + map["ActionId"] = actionString; + return map; + } + }; + + +void SSVersionObject::ToXml (XMLNode* pParent) const +{ + XMLElement versionNumber (pParent, "VersionNumber", GetVersionNumber()); + XMLElement useName (pParent, "UserName", GetUsername()); + XMLElement date (pParent, "Date", GetDate()); + if (!GetComment ().empty ()) + { + XMLElement date (pParent, "Comment", GetComment()); + } + + if (GetAction ()) + { + SSAction* pAction = GetAction (); + ActionNode node (pParent, pAction->GetActionID()); + + pAction->ToXml (&node); + } +} + +void SSVersionObject::Dump (std::ostream& os) const +{ + SSRecordPtr pLabelCommentRecord; + SSRecordPtr pNext; + const VERSION_RECORD* pVersion = GetData (); + + if (pVersion->OffsetToLabelComment) + pLabelCommentRecord = GetFile ()->GetRecord (pVersion->OffsetToLabelComment); + if (pVersion->OffsetToNextRecordOrComment) + pNext = GetFile ()->GetRecord (pVersion->OffsetToNextRecordOrComment); + + // dump basic information + SSObject::Dump (os); + + SSVersionObject previous = GetPreviousObject (); + os << "Previous: "; + if (previous) + { + os << "Type " << SSRecord::TypeToString (previous.GetType ()) << ", "; + os << "Offset 0x" << std::hex << previous.GetOffset () << std::dec; + os << std::endl; + } + else + os << "NULL" << std::endl; + + os << "Action " << GetActionID() << " : " << CAction::ActionToString (GetActionID()) << std::endl; + os << "ActionStr: " << GetActionString () << std::endl; + os << "Version: " << GetVersionNumber () << std::endl; +// os << "Date" << std::endl; + os << "User: " << GetUsername () << std::endl; + os << "Comment: " << GetComment () << std::endl; + + os << "Comment Offset 0x" << std::hex << pVersion->OffsetToNextRecordOrComment << std::dec << ", Length " << pVersion->LengthComment; + if (pNext) + os << ", Type " << pNext->GetRecordType (); + os << std::endl; + + os << "LabelComment Offset 0x" << std::hex << pVersion->OffsetToLabelComment << std::dec << ", Length " << pVersion->LengthLabelComment; + if (pLabelCommentRecord) + os << ", Type " << pLabelCommentRecord->GetRecordType (); + os << std::endl; + + SSAction* pAction = GetAction (); + if (pAction) + pAction->Dump (os); +} + +//--------------------------------------------------------------------------- +SSAction::SSAction (SSRecordPtr pRecord) +{ + const VERSION_RECORD* pVersion = GetHistoryRecordPtr (pRecord); + + m_ActionId = static_cast (pVersion->ActionID); +} + +SSAction::~SSAction () +{ +} + +SSAction* SSAction::MakeAction (SSRecordPtr pRecord) +{ + if (!pRecord) + return NULL; + + if (pRecord->GetLen () < sizeof (VERSION_RECORD)) + throw SSException ("not enough bytes for Version Header in record"); + + const VERSION_RECORD* pVersion = reinterpret_cast (pRecord->GetBuffer ()); + + if (pVersion->ActionID == Labeled) + return new SSLabeledAction (pRecord); + else if (pVersion->ActionID == Created_Project) + return new SSCreatedProjectAction (pRecord); + else if (pVersion->ActionID == Added_Project) + return new SSAddedProjectAction (pRecord); + else if (pVersion->ActionID == Added_File) + return new SSAddedFileAction (pRecord); + else if (pVersion->ActionID == Destroyed_Project) + return new SSDestroyedProjectAction(pRecord); + else if (pVersion->ActionID == Destroyed_File) + return new SSDestroyedFileAction (pRecord); + else if (pVersion->ActionID == Deleted_Project) + return new SSDeletedProjectAction (pRecord); + else if (pVersion->ActionID == Deleted_File) + return new SSDeletedFileAction (pRecord); + else if (pVersion->ActionID == Recovered_Project) + return new SSRecoveredProjectAction (pRecord); + else if (pVersion->ActionID == Recovered_File) + return new SSRecoveredFileAction (pRecord); + else if (pVersion->ActionID == Renamed_Project) + return new SSRenamedProjectAction (pRecord); + else if (pVersion->ActionID == Renamed_File) + return new SSRenamedFileAction (pRecord); +// else if (pVersion->ActionID == missing action 12) +// return new SSVersionObject (pRecord); +// else if (pVersion->ActionID == missing action 13) +// return new SSVersionObject (pRecord); + else if (pVersion->ActionID == Shared_File) + return new SSSharedAction (pRecord); + else if (pVersion->ActionID == Branch_File) + return new SSRollbackAction (pRecord); + else if (pVersion->ActionID == Created_File) + return new SSCreatedFileAction (pRecord); + else if (pVersion->ActionID == Checked_in) + return new SSCheckedInAction (pRecord); +// else if (pVersion->ActionID == // missing action 18) +// return new SSVersionObject (pRecord); + else if (pVersion->ActionID == RollBack) + return new SSRollbackAction (pRecord); + else + throw SSUnknownActionException (pVersion->ActionID, pRecord); + + return NULL; +} + +const VERSION_RECORD* SSAction::GetHistoryRecordPtr (SSRecordPtr pRecord) const +{ + assert (pRecord->GetBuffer ()); + return reinterpret_cast (pRecord->GetBuffer ()); +} + +void SSAction::Dump (std::ostream& os) const +{ +} + +//--------------------------------------------------------------------------- +SSLabeledAction::SSLabeledAction (SSRecordPtr pRecord) + : SSActionEx (pRecord) +{ + const VERSION_RECORD* pVersion = GetHistoryRecordPtr (pRecord); + + m_Label = std::string (pVersion->Label); + + if (pVersion->OffsetToLabelComment && pVersion->LengthLabelComment > 0) + { + try { + SSCommentObject commentObject (pRecord->GetFileImp ()->GetRecord (pVersion->OffsetToLabelComment)); + m_LabelComment = commentObject.GetComment(); + } + catch (SSRecordException&) + { + } + } +} + +SSLabeledAction::~SSLabeledAction () +{ +} + +std::string SSLabeledAction::FormatActionString () +{ + return "Labeled " + m_Label; +} + +void SSLabeledAction::ToXml (XMLNode* pParent) const +{ + XMLElement label (pParent, "Label", GetLabel()); + XMLElement comment (pParent, "LabelComment", GetLabelComment()); + +} + +void SSLabeledAction::Dump (std::ostream& os) const +{ + SSActionEx::Dump (os); +} + +//--------------------------------------------------------------------------- +template +SSItemAction::SSItemAction (SSRecordPtr pRecord, std::string actionString) + : SSActionEx (pRecord), + m_ActionString (actionString) +{ + memcpy (&m_Action, pRecord->GetBuffer()+sizeof(VERSION_RECORD), sizeof(STRUCT)); +} + +template +std::string SSItemAction::FormatActionString () +{ + return m_ActionString + GetName (); +} + +template +void SSItemAction::ToXml (XMLNode* pParent) const +{ + XMLElement physical (pParent, "Physical", GetPhysical()); + GetSSName().ToXml (pParent); +} + +template +void SSItemAction::Dump (std::ostream& os) const +{ + SSActionEx::Dump (os); +} + +//--------------------------------------------------------------------------- +template +SSDestroyedAction::SSDestroyedAction (SSRecordPtr pRecord, std::string prefix) + : SSItemAction (pRecord, ""), + m_Prefix (prefix) +{ +} + +template +std::string SSDestroyedAction::FormatActionString () +{ + std::string action (m_Prefix); + action += GetName () + " Destroyed"; + return action; +} + +//--------------------------------------------------------------------------- +template +SSRenamedAction::SSRenamedAction (SSRecordPtr pRecord, std::string prefix) + : SSItemAction (pRecord, ""), + m_Prefix (prefix) +{ +} + +template +std::string SSRenamedAction::FormatActionString () +{ + SSName ssOldName (GetSSName ()); + SSName ssNewName (m_Action.newName); + std::string action (m_Prefix); + action += ssOldName.GetFullName (); + action += " renamedto " + m_Prefix; + action += ssNewName.GetFullName (); + return action; +} + +template +void SSRenamedAction::ToXml (XMLNode* pParent) const +{ + SSItemAction::ToXml (pParent); + + GetNewSSName().ToXml (pParent, "NewSSName"); +} + +template +void SSRenamedAction::Dump (std::ostream& os) const +{ + SSItemAction::Dump (os); +} + +//--------------------------------------------------------------------------- +SSCheckedInAction::SSCheckedInAction (SSRecordPtr pRecord) + : SSActionEx (pRecord), + m_FilePtr (pRecord->GetFileImp ()) +{ + memcpy (&m_Action, pRecord->GetBuffer()+sizeof(VERSION_RECORD), sizeof(CHECKED_IN_ACTION)); +} + +SSCheckedInAction::~SSCheckedInAction () +{ +} + +std::string SSCheckedInAction::FormatActionString () +{ + std::string action = "Checked In "; + action += std::string (m_Action.checkInSpec); + return action; +} + +SSRecordPtr SSCheckedInAction::GetFileDelta () const +{ + if (!m_pFileDelta && m_Action.offsetFileDelta) + { + m_pFileDelta = m_FilePtr->GetRecord (m_Action.offsetFileDelta); + } + + return m_pFileDelta; +} + +void SSCheckedInAction::ToXml (XMLNode* pParent) const +{ + XMLElement checkInNode (pParent, "CheckInSpec", GetFileSepc()); + XMLElement offsetNode (pParent, "Offset", GetOffset()); +} + +void SSCheckedInAction::Dump (std::ostream& os) const +{ + SSActionEx::Dump (os); +} + +//--------------------------------------------------------------------------- +SSSharedAction::SSSharedAction (SSRecordPtr pRecord) + : SSItemAction (pRecord, "") +{ +} + +SSSharedAction::~SSSharedAction () +{ +} + +std::string SSSharedAction::FormatActionString () +{ + std::ostringstream str; + SSName name (m_Action.name); + if (m_Action.pinnedToVersion == -1) + str << m_Action.srcPathSpec << "/" << name.GetFullName() << ";" << m_Action.version << " shared"; + else if (m_Action.pinnedToVersion == 0) + str << m_Action.srcPathSpec << "/" << name.GetFullName() << " pinned to version " << m_Action.version; + else if (m_Action.version == 0) + str << m_Action.srcPathSpec << "/" << name.GetFullName() << " unpinned"; + else + throw SSException ("bad share/pin/unpin action: version should be 0"); + + return str.str(); +} + + +void SSSharedAction::ToXml (XMLNode* pParent) const +{ + SSItemAction::ToXml(pParent); + + XMLElement srcPathNode (pParent, "SrcPath", GetSrcPathSpec ()); + XMLElement pinnedNode (pParent, "PinnedToVersion", GetPinnedToVersion ()); + XMLElement versionNode (pParent, "Version", GetVersion ()); +} + +void SSSharedAction::Dump (std::ostream& os) const +{ + SSItemAction::Dump(os); +} + +//--------------------------------------------------------------------------- +void SSRollbackAction::ToXml (XMLNode* pParent) const +{ + SSItemAction::ToXml (pParent); + + XMLElement parentNode (pParent, "Parent", GetParent()); +} + +void SSRollbackAction::Dump (std::ostream& os) const +{ + SSItemAction::Dump (os); +} diff --git a/ssphys/SSPhysLib/SSVersionObject.h b/ssphys/SSPhysLib/SSVersionObject.h new file mode 100644 index 0000000..96982a1 --- /dev/null +++ b/ssphys/SSPhysLib/SSVersionObject.h @@ -0,0 +1,409 @@ +// SSVersionObject.h: interface for the SSActions class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SSHISTORYOBJECT_H__58F12C7C_FE74_43B1_9BF6_9E803182D8D7__INCLUDED_) +#define AFX_SSHISTORYOBJECT_H__58F12C7C_FE74_43B1_9BF6_9E803182D8D7__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SSObject.h" +#include "SSCommentObject.h" +#include "SSName.h" +//#include "SSItem.h" + +//class SSItemAction; +class SSLabeledAction; // Labeled = 0, +class SSCreatedProjectAction; // Created_Project = 1, +class SSAddedProjectAction; // Added_Project = 2, +class SSAddedFileAction; // Added_File = 3, +class SSDestroyedProjectAction; // Destroyed_Project = 4, +class SSDestroyedFileAction; // Destroyed_File = 5, +class SSDeletedProjectAction; // Deleted_Project = 6, +class SSDeletedFileAction; // Deleted_File = 7, +class SSRecoveredProjectAction; // Recovered_Project = 8, +class SSRecoveredFileAction; // Recovered_File = 9, +class SSRenamedProjectAction; // Renamed_Project = 10, +class SSRenamedFileAction; // Renamed_File = 11, +//class SSAction12 // missing action 12, +//class SSAction13 // missing action 13 +class SSSharedAction; // Shared_File = 14, +class SSRollbackAction; // RollBack_File = 15, +class SSCreatedFileAction; // Created_File = 16, +class SSCheckedInAction; // Checked_in = 17, +//class SSAction18 // missing action 18 +//class SSRollBackAction // RollBack = 19 + +class ISSActionVisitor +{ +public: + virtual bool Apply (const SSLabeledAction& rAction) = 0; + virtual bool Apply (const SSCreatedProjectAction& rAction) = 0; + virtual bool Apply (const SSCreatedFileAction& rAction) = 0; + virtual bool Apply (const SSAddedProjectAction& rAction) = 0; + virtual bool Apply (const SSAddedFileAction& rAction) = 0; + virtual bool Apply (const SSDeletedProjectAction& rAction) = 0; + virtual bool Apply (const SSDeletedFileAction& rAction) = 0; + virtual bool Apply (const SSRecoveredProjectAction& rAction) = 0; + virtual bool Apply (const SSRecoveredFileAction& rAction) = 0; + virtual bool Apply (const SSRollbackAction& rAction) = 0; + + virtual bool Apply (const SSDestroyedProjectAction& rAction) = 0; + virtual bool Apply (const SSDestroyedFileAction& rAction) = 0; + virtual bool Apply (const SSRenamedProjectAction& rAction) = 0; + virtual bool Apply (const SSRenamedFileAction& rAction) = 0; + virtual bool Apply (const SSCheckedInAction& rAction) = 0; + virtual bool Apply (const SSSharedAction& rAction) = 0; +}; + +//--------------------------------------------------------------------------- +class SSAction +{ +public: + SSAction (SSRecordPtr pRecord); + virtual ~SSAction (); + + static SSAction* MakeAction (SSRecordPtr pRecord); + + eAction GetActionID () const { return m_ActionId; } + + virtual std::string FormatActionString () = 0; + virtual bool Accept (ISSActionVisitor& rVisitor) = 0; + + virtual void ToXml (XMLNode* pParent) const = 0; + virtual void Dump (std::ostream& os) const; + +protected: + const VERSION_RECORD* GetHistoryRecordPtr (SSRecordPtr pRecord) const; + eAction m_ActionId; +}; + +//--------------------------------------------------------------------------- +class SSVersionObject : public SSObject +{ +public: + SSVersionObject (SSRecordPtr pRecord); + virtual ~SSVersionObject (); + + // handle copy constructor und assigment + SSVersionObject (SSVersionObject& object); + SSVersionObject& operator= (SSVersionObject const & object); + +// BOOST_PP_SEQ_FOR_EACH(DEFINE_ACCESSORS, GetData(), VERSION_RECORD_SEQ); + ulong GetPrevious () const { return GetData ()->Previous; } + eAction GetActionID () const { return static_cast (GetData ()->ActionID); } + short GetVersionNumber () const { return GetData ()->VersionNumber; } + time_t GetDate () const { return GetData ()->Date; } + std::string GetUsername () const { return std::string (GetData ()->Username, 32); } + std::string GetLabel () const { return std::string (GetData ()->Label, 32); } + ulong GetOffsetToNextRecordOrComment () const { return GetData ()->OffsetToNextRecordOrComment; } + ulong GetOffsetToLabelComment () const { return GetData ()->OffsetToLabelComment; } + short GetLengthComment () const { return GetData ()->LengthComment; } + short GetLengthLabelComment () const { return GetData ()->LengthLabelComment; } + +// std::string GetUsername () const { return GetData ()->user; } +// int GetVersionNumber () const { return GetData ()->version; } +// eAction GetActionId () const { return static_cast (GetData ()->action); } + std::string GetActionString () const { return m_pAction ? m_pAction->FormatActionString () : CAction::ActionToString (GetActionID()); } +// time_t GetDate () const { return GetData ()->date; } + std::string GetComment () const; + + // special Label Action functions +// std::string GetLabel () const; + std::string GetLabelComment () const; + + // reporting functions + virtual void Accept (ISSObjectVisitor& rVisitor, const ISSContext* pCtx = NULL) const { rVisitor.Apply (*this, pCtx); } + + const VERSION_RECORD* GetData () const { return (const VERSION_RECORD*) SSObject::GetData (); } + + SSAction* GetAction () const { return m_pAction; } + SSVersionObject GetPreviousObject () const; + SSCommentObject GetCommentObject () const; + + virtual bool Validate (); + + virtual void ToXml (XMLNode* pParent) const; + virtual void Dump (std::ostream& os) const; + +protected: + + SSAction* m_pAction; +}; + + +//--------------------------------------------------------------------------- +template +class SSActionEx : public SSAction +{ +public: + SSActionEx (SSRecordPtr pRecord) + : SSAction (pRecord) + { + } + + bool Accept (ISSActionVisitor& rVisitor) + { + return rVisitor.Apply(*This()); + } + + // return a pointer to the most derived class + ACTION * This() + { + return static_cast(this); + } +}; + + +//--------------------------------------------------------------------------- +class SSLabeledAction : public SSActionEx +{ +public: + SSLabeledAction (SSRecordPtr pRecord); + virtual ~SSLabeledAction (); + + std::string GetLabel () const { return m_Label; } + std::string GetLabelComment () const { return m_LabelComment; } + + virtual std::string FormatActionString (); + + virtual void ToXml (XMLNode* pParent) const; + virtual void Dump (std::ostream& os) const; + +private: + std::string m_Label; + std::string m_LabelComment; +}; + +//--------------------------------------------------------------------------- +class ISSItemAction +{ +public: + virtual std::string GetPhysical () const = 0; + virtual SSName GetSSName () const = 0; +}; + +//--------------------------------------------------------------------------- +template +class SSItemAction : public SSActionEx, public ISSItemAction +{ +public: + SSItemAction (SSRecordPtr pRecord, std::string actionString); + + std::string GetPhysical () const { return std::string (m_Action.physical, 8); } + SSName GetSSName () const { return m_Action.name; } + + std::string GetName () const { SSName name (GetSSName ()); return name.GetFullName (); } + + virtual std::string FormatActionString (); + + virtual void ToXml (XMLNode* pParent) const; + virtual void Dump (std::ostream& os) const; + +protected: + STRUCT m_Action; + std::string m_ActionString; +}; + +class SSCreatedProjectAction : public SSItemAction +{ +public: + SSCreatedProjectAction (SSRecordPtr pRecord) + : SSItemAction (pRecord, "Created Project $") + { + } +}; + +class SSCreatedFileAction : public SSItemAction +{ +public: + SSCreatedFileAction (SSRecordPtr pRecord) + : SSItemAction (pRecord, "Created File ") + { + } +}; + +class SSAddedProjectAction : public SSItemAction +{ +public: + SSAddedProjectAction (SSRecordPtr pRecord) + : SSItemAction (pRecord, "Added Project $") + { + } +}; + +class SSAddedFileAction : public SSItemAction +{ +public: + SSAddedFileAction (SSRecordPtr pRecord) + : SSItemAction (pRecord, "Added File ") + { + } +}; + +class SSDeletedProjectAction : public SSItemAction +{ +public: + SSDeletedProjectAction (SSRecordPtr pRecord) + : SSItemAction (pRecord, "Deleted Project $") + { + } +}; + +class SSDeletedFileAction : public SSItemAction +{ +public: + SSDeletedFileAction (SSRecordPtr pRecord) + : SSItemAction (pRecord, "Deleted File ") + { + } +}; + +class SSRecoveredProjectAction : public SSItemAction +{ +public: + SSRecoveredProjectAction (SSRecordPtr pRecord) + : SSItemAction (pRecord, "Recovered Project ") + { + } +}; + +class SSRecoveredFileAction : public SSItemAction +{ +public: + SSRecoveredFileAction (SSRecordPtr pRecord) + : SSItemAction (pRecord, "Recovered File ") + { + } +}; + +//--------------------------------------------------------------------------- +class SSRollbackAction : public SSItemAction +{ +public: + SSRollbackAction (SSRecordPtr pRecord) + : SSItemAction (pRecord, "Rolled back ") + { + } + + std::string GetParent () const { return std::string (m_Action.parent, 8); } + + virtual void ToXml (XMLNode* pParent) const; + virtual void Dump (std::ostream& os) const; +}; + +//--------------------------------------------------------------------------- + +template +class SSDestroyedAction : public SSItemAction +{ +public: + SSDestroyedAction (SSRecordPtr pRecord, std::string prefix); + + virtual std::string FormatActionString (); + +private: + std::string m_Prefix; +}; + +class SSDestroyedProjectAction : public SSDestroyedAction +{ +public: + SSDestroyedProjectAction (SSRecordPtr pRecord) + : SSDestroyedAction (pRecord, "$") + {} +}; + +class SSDestroyedFileAction : public SSDestroyedAction +{ +public: + SSDestroyedFileAction (SSRecordPtr pRecord) + : SSDestroyedAction (pRecord, "") + {} +}; + + +//--------------------------------------------------------------------------- + +template +class SSRenamedAction : public SSItemAction +{ +public: + SSRenamedAction (SSRecordPtr pRecord, std::string prefix); + + std::string GetNewName () const { SSName name (m_Action.newName); return name.GetFullName (); } + SSName GetNewSSName () const { return m_Action.newName; } + + virtual std::string FormatActionString (); + + virtual void ToXml (XMLNode* pParent) const; + virtual void Dump (std::ostream& os) const; + +private: + std::string m_Prefix; +}; + +class SSRenamedProjectAction : public SSRenamedAction +{ +public: + SSRenamedProjectAction (SSRecordPtr pRecord) + : SSRenamedAction (pRecord, "$") + {} +}; + +class SSRenamedFileAction : public SSRenamedAction +{ +public: + SSRenamedFileAction (SSRecordPtr pRecord) + : SSRenamedAction (pRecord, "") + {} +}; + +//--------------------------------------------------------------------------- + +class SSCheckedInAction : public SSActionEx +{ +public: + SSCheckedInAction ( SSRecordPtr pRecord); + ~SSCheckedInAction (); + + std::string GetFileSepc () const { return m_Action.checkInSpec; } + long GetOffset () const { return m_Action.offsetFileDelta; } + SSRecordPtr GetFileDelta () const; + + virtual std::string FormatActionString (); + virtual bool Accept (ISSActionVisitor& rVisitor) { return rVisitor.Apply (*this); } + + virtual void ToXml (XMLNode* pParent) const; + virtual void Dump (std::ostream& os) const; + +private: + CHECKED_IN_ACTION m_Action; + mutable SSRecordPtr m_pFileDelta; + SSFileImpPtr m_FilePtr; +}; + + +//--------------------------------------------------------------------------- + +class SSSharedAction : public SSItemAction +{ +public: + SSSharedAction ( SSRecordPtr pRecord); + ~SSSharedAction (); + + std::string GetSrcPathSpec () const { return m_Action.srcPathSpec; } + short GetPinnedToVersion () const { return m_Action.pinnedToVersion; } + short GetVersion () const { return m_Action.version; } + + virtual std::string FormatActionString (); + + virtual void ToXml (XMLNode* pParent) const; + virtual void Dump (std::ostream& os) const; +}; + + + +#endif // !defined(AFX_SSHISTORYOBJECT_H__58F12C7C_FE74_43B1_9BF6_9E803182D8D7__INCLUDED_) diff --git a/ssphys/SSPhysLib/StdAfx.cpp b/ssphys/SSPhysLib/StdAfx.cpp new file mode 100644 index 0000000..37a42b1 --- /dev/null +++ b/ssphys/SSPhysLib/StdAfx.cpp @@ -0,0 +1,6 @@ +// stdafx.cpp : source file that includes just the standard includes +// SSPhysLib.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + diff --git a/ssphys/SSPhysLib/StdAfx.h b/ssphys/SSPhysLib/StdAfx.h new file mode 100644 index 0000000..e5c6dbc --- /dev/null +++ b/ssphys/SSPhysLib/StdAfx.h @@ -0,0 +1,53 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__F2230523_26E5_44C1_9257_A6FC51587248__INCLUDED_) +#define AFX_STDAFX_H__F2230523_26E5_44C1_9257_A6FC51587248__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + + +#include + +// TODO: reference additional headers your program requires here +#include "assert.h" + +#pragma warning (disable: 4786) +#include +#include +#include +#include + +#include + +//--------------------------------------------------------------------------- +#define countof(x) (sizeof(x) / sizeof(x[0])) +//#define RELEASE(x) if (x) (x)->Release (); +#define DELETE(x) { delete (x); x = NULL; } + +typedef std::vector StringVector; + +//--------------------------------------------------------------------------- +void Info (const char* message); +void Notice (const char* message); +void Warning (const char* message); +void Error (const char* message); + +#define warn_if(x) (x) ? Warning (#x), false : true; +#define warn_with_msg_if(x,y) (x) ? Warning (y), false : true; + + +#include "SSException.h" + + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__F2230523_26E5_44C1_9257_A6FC51587248__INCLUDED_) diff --git a/ssphys/SSPhysLib/XML.h b/ssphys/SSPhysLib/XML.h new file mode 100644 index 0000000..25837b1 --- /dev/null +++ b/ssphys/SSPhysLib/XML.h @@ -0,0 +1,121 @@ +// XML.h:structure definitions for SourceSafe files +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_XML_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_) +#define AFX_XML_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +typedef std::map AttribMap; + +// --------------------------------------------------------------- +class XMLEntity +{ +protected: + static bool isSpecialChar (std::string::value_type v) + { + std::string punct = "&<>'\""; + std::string::iterator it = punct.begin(); + + while(it != punct.end()) + if(v == *it++) + return true; + + return false; + } + + template + void ToXml (const T& element) + { + std::cout << element; + } + void ToXml (const std::string& element) + { + if (std::find_if (element.begin (), element.end (), isSpecialChar) == element.end ()) + std::cout << element; + else + std::cout << ""; + } + void ToXml (const char& element) + { + if (std::find_if (&element, &element + strlen (&element), isSpecialChar) == &element+ strlen (&element)) + std::cout << element; + else + std::cout << ""; + } + +}; + +// --------------------------------------------------------------- +class XMLNode : protected XMLEntity +{ +public: + XMLNode (XMLNode* pParent, std::string name) + : m_pParent (pParent), m_Name (name) + { + std::cout << "<" << name << ">" << std::endl; + } + + XMLNode (XMLNode* pParent, std::string name, AttribMap attrib) + : m_pParent (pParent), m_Name (name) + { + std::cout << "<" << name; + AttribMap::iterator itor = attrib.begin (); + for (; itor != attrib.end (); ++itor) + { + std::cout << " " << itor->first << "=\"" << itor->second << "\""; + } + std::cout << ">" << std::endl; + } + ~XMLNode () + { + std::cout << "" << std::endl; + } + +protected: + XMLNode* m_pParent; + std::string m_Name; +}; + + +class XMLElement : protected XMLEntity +{ +public: + template + XMLElement (XMLNode* pParent, std::string name, const T& element) + { + std::cout << "<" << name << ">"; + ToXml(element); + std::cout << "" << std::endl; + } + + template + XMLElement (XMLNode* pParent, std::string name, AttribMap attrib, const T& element) + { + std::cout << "<" << name; + AttribMap::iterator itor = attrib.begin (); + for (; itor != attrib.end (); ++itor) + { + std::cout << " " << itor->first << "=\"" << itor->second << "\""; + } + std::cout << ">"; + ToXml(element); + std::cout << "" << std::endl; + } +}; + +class XMLValue : protected XMLEntity +{ +public: + template + XMLValue (XMLNode* pParent, const T& element) + { + ToXml(element); + } + +}; + +#endif // !defined(AFX_XML_H__6602C07F_65ED_4FD7_A730_6D416805378A__INCLUDED_) diff --git a/ssphys/SSPhysLib/crc.cpp b/ssphys/SSPhysLib/crc.cpp new file mode 100644 index 0000000..7be2211 --- /dev/null +++ b/ssphys/SSPhysLib/crc.cpp @@ -0,0 +1,114 @@ +// crc.cpp: implementation of the crc class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "crc.h" + +//------------------------------------------------------------------------------ +// +// This code implements the AUTODIN II polynomial +// The variable corresponding to the macro argument "crc" should +// be an unsigned long. +// Oroginal code by Spencer Garrett +// + +// generated using the AUTODIN II polynomial +// x^32 + x^26 + x^23 + x^22 + x^16 + +// x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1 +// +//------------------------------------------------------------------------------ + +static const unsigned crc32tab[256] = +{ + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, + 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, + 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, + 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, + 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, + 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, + 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, + 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, + 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, + 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, + 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, + 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, + 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, + 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, + 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, + 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, + 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, + 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, +}; + + +//------------------------------------------------------------------------------ + +unsigned calc_crc32(const void* buf, unsigned size) +{ +// unsigned crc = (unsigned)~0; + unsigned crc = (unsigned)0; + const unsigned char* p; + unsigned len = 0; + unsigned nr = size; + + for (len += nr, p = (unsigned char*)buf; nr--; ++p) + { + crc = ((crc >> 8) & 0xffffff) ^ crc32tab[(crc ^ *p) & 0xff]; + } +// return ~crc; + return crc; +} + +unsigned calc_crc16(const void* buf, unsigned size) +{ + unsigned crc = calc_crc32(buf, size); + crc ^= crc >> 16; + return crc; +} diff --git a/ssphys/SSPhysLib/crc.h b/ssphys/SSPhysLib/crc.h new file mode 100644 index 0000000..2aa0448 --- /dev/null +++ b/ssphys/SSPhysLib/crc.h @@ -0,0 +1,15 @@ +// crc.h: interface for the crc class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_CRC_H__47066454_F128_4446_94CE_29295817E6CE__INCLUDED_) +#define AFX_CRC_H__47066454_F128_4446_94CE_29295817E6CE__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +unsigned calc_crc32(const void* buf, unsigned size); +unsigned calc_crc16(const void* buf, unsigned size); + +#endif // !defined(AFX_CRC_H__47066454_F128_4446_94CE_29295817E6CE__INCLUDED_) diff --git a/ssphys/SSRep/Formatter.cpp b/ssphys/SSRep/Formatter.cpp new file mode 100644 index 0000000..7dac9f3 --- /dev/null +++ b/ssphys/SSRep/Formatter.cpp @@ -0,0 +1,276 @@ +// Formatter.cpp: implementation of the CFormatter class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Formatter.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +class CVssFormatter : public IFormatter +{ +public: + virtual int DoWhoAmI (const COptions& options); + virtual int DoProject (const SSDatabase& database, const COptions& options); + + virtual int DoDirectory (const SSItemPtr pItem, const COptions& options); + virtual int DoProperties (const SSItemPtr pItem, const COptions& options); + virtual int DoFiletype (const SSItemPtr pItem, const COptions& options); + virtual int DoHistory (const SSItemPtr pItem, const COptions& options); +}; + + + +int CVssFormatter::DoWhoAmI (const COptions& options) +{ + if (options.GetUser().empty ()) + { + // TODO: get the current windows user name + return 100; // unknown user + } + std::cout << options.GetUser () << std::endl; + + return 0; +} + + +int CVssFormatter::DoProject (const SSDatabase& database, const COptions& options) +{ + std::string cp = database.GetCurrentProject(); + if (cp.empty ()) + { + throw SSException ("could not read current project"); + } + std::cout << "Current project is " << cp << std::endl; + + return 0; +} + + + +int CVssFormatter::DoDirectory (SSItemPtr pItem, const COptions& options) +{ + assert (pItem); + try + { + if (pItem->GetType () != SSITEM_PROJECT) + throw SSException ("please specify a project item"); + + // Header + std::cout << pItem->GetSpec() << ":" << std::endl; + + std::auto_ptr pItems (pItem->GetItems (options.GetDeleted())); + if (!pItems.get ()) + { + std::cout << "No items found under " << pItem->GetSpec() << std::endl; + return 1; + } + + // filter items + std::vector filtered; + for (long i = 0; i < pItems->GetCount (); ++i) + { + SSItemPtr pItem = pItems->GetItem(i); + bool bInclude = true; + + // filter delted items + if ( pItem->GetDeleted () && options.GetDeleted() + || !pItem->GetDeleted() && !(options.GetOnlyDeleted() && options.GetDeleted())) + bInclude &= true; + else + bInclude &= false; + + // filter file/project items + if ( pItem->GetType() == SSITEM_FILE && options.GetFiles() + || pItem->GetType() == SSITEM_PROJECT && !(options.GetOnlyFiles() && options.GetFiles())) + bInclude &= true; + else + bInclude &= false; + + if (bInclude) + { + filtered.push_back(pItem); + } + } + + // first print all project items + std::vector ::iterator itor; + std::vector ::iterator end = filtered.end (); + for (itor = filtered.begin(); itor != end; ++itor) + { + SSItemPtr pItem = *itor; + if (pItem->GetType () == SSITEM_PROJECT) + { + std::cout << "$" << pItem->GetName(); + if (options.GetPhysOutput()) + std::cout << "\t" << pItem->GetPhysical(); + std::cout << std::endl; + } + } + + // second print all file items + for (itor = filtered.begin(); itor != end; ++itor) + { + SSItemPtr pItem = *itor; + if (pItem->GetType () == SSITEM_FILE) + { + std::cout << pItem->GetName(); + if (options.GetExtendedOutput () && pItem->GetIsCheckedOut()) + { + // User\tDate\Time\CheckouPath, z.B.: + // ValidatingEdit.cpp Mirco 4.06.04 13:07 C:\Mirco + // ValidatingEdit.h Mirco 4.06.04 13:07 C:\Mirco + std::cout << "\tTODO: Display check out information"; + } else if (options.GetPhysOutput()) + std::cout << "\t" << pItem->GetPhysical(); + + std::cout << std::endl; + } + } + + std::cout << std::endl; + + // recurse into all subdirectories + if (options.GetRecursive()) + { + for (itor = filtered.begin(); itor != end; ++itor) + { + SSItemPtr pItem = *itor; + if (pItem->GetType () == SSITEM_PROJECT) + DoDirectory (pItem, options); + } + } + } + catch (SSException& ex) + { + std::cerr << "error: " << ex.what() << std::endl; + return 1; + } + + return 0; +} + + +int CVssFormatter::DoProperties (SSItemPtr pItem, const COptions& options) +{ + assert (pItem); + try + { + if (pItem->GetType () == SSITEM_PROJECT) + { + std::auto_ptr pItems (pItem->GetItems (true)); + int files = 0; + int projects = 0; + int deleted = 0; + for (long i = 0; i < pItems->GetCount (); ++i) + { + SSItemPtr pItem = pItems->GetItem(i); + // filter delted items + if ( pItem->GetDeleted ()) + ++deleted; + else if ( pItem->GetType () == SSITEM_PROJECT) + ++projects; + else if ( pItem->GetType () == SSITEM_FILE) + ++files; + } + + //Project: $/ + //Contains: + // 2 Files ( +30 deleted ) + // 12 Subproject(s) + std::cout << "Project: " << pItem->GetSpec() << std::endl; + std::cout << "Contains: " << std::endl; + std::cout << files << " Files ( +" << deleted << " deleted )" << std::endl; + std::cout << projects << " Subproject(s)" << std::endl; + } + else if (pItem->GetType () == SSITEM_FILE) + { + //File: $/ValidatingEdit.h + //Type: Text + //Size: 624 bytes 31 lines + //Store only latest version: No + } + + //Latest: Last Label: 1.9.3 + // Version: 178 Version: 178 + // Date: 15.11.04 17:13 Date: 15.11.04 17:13 + + } + catch (SSException& ex) + { + std::cerr << "error: " << ex.what() << std::endl; + return 1; + } + + return 0; +} + + +int CVssFormatter::DoFiletype (const SSItemPtr pItem, const COptions& options) +{ + if (!pItem) + return 1; + + try + { + if (pItem->GetType () == SSITEM_PROJECT) + { + std::auto_ptr pItems (pItem->GetItems (options.GetDeleted())); + for (long i = 0; i < pItems->GetCount (); ++i) + { + SSItemPtr pItem = pItems->GetItem(i); + + if ( pItem->GetType () == SSITEM_PROJECT) + std::cout << "\n\n" << pItem->GetSpec () << std::endl; + else if ( pItem->GetType () == SSITEM_FILE) + { + std::string binary = pItem->GetBinary() ? "Binary" : "Text"; + std::cout << pItem->GetName () << "\t" << binary << std::endl; + } + + } + } + else if (pItem->GetType () == SSITEM_FILE) + { + std::string binary = pItem->GetBinary() ? "Binary" : "Text"; + std::cout << pItem->GetName () << "\t" << binary << std::endl; + } + } + catch (SSException& ex) + { + std::cerr << "error: " << ex.what() << std::endl; + return 1; + } + return 0; +} + + +int CVssFormatter::DoHistory (const SSItemPtr pItem, const COptions& options) +{ + assert (pItem); + try + { +// std::auto_ptr pVersions = pItem->GetVersions(0); +// for (long i = 0; i < pVersions->GetCount (); ++i) +// { +// SSVersionPtr pVersions (pVersions->GetVersion(i)); +// pVersions->ReportVssStyle +// } + } + catch (SSException& ex) + { + std::cerr << "error: " << ex.what() << std::endl; + return 1; + } + + return 0; +} + + +IFormatter* CVssFormatterFactory::MakeFormatter () +{ + return new CVssFormatter (); +} + diff --git a/ssphys/SSRep/Formatter.h b/ssphys/SSRep/Formatter.h new file mode 100644 index 0000000..8227587 --- /dev/null +++ b/ssphys/SSRep/Formatter.h @@ -0,0 +1,39 @@ +// Formatter.h: interface for the CFormatter class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_FORMATTER_H__A5506F2B_A8AC_4232_A73E_3892242D51E3__INCLUDED_) +#define AFX_FORMATTER_H__A5506F2B_A8AC_4232_A73E_3892242D51E3__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "Options.h" +#include +#include + +////////////////////////////////////////////////////////////////////// +class IFormatter +{ +public: + virtual int DoWhoAmI (const COptions& options) = 0; + virtual int DoProject (const SSDatabase& database, const COptions& options) = 0; + + virtual int DoDirectory (const SSItemPtr pItem, const COptions& options) = 0; + virtual int DoProperties (const SSItemPtr pItem, const COptions& options) = 0; + virtual int DoFiletype (const SSItemPtr pItem, const COptions& options) = 0; + virtual int DoHistory (const SSItemPtr pItem, const COptions& options) = 0; +}; + + + + +////////////////////////////////////////////////////////////////////// +class CVssFormatterFactory +{ +public: + static IFormatter* MakeFormatter (); +}; + +#endif // !defined(AFX_FORMATTER_H__A5506F2B_A8AC_4232_A73E_3892242D51E3__INCLUDED_) diff --git a/ssphys/SSRep/Options.cpp b/ssphys/SSRep/Options.cpp new file mode 100644 index 0000000..3f515ec --- /dev/null +++ b/ssphys/SSRep/Options.cpp @@ -0,0 +1,238 @@ +// Options.cpp: implementation of the COptions class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Options.h" +#include "strstream" + +//--------------------------------------------------------------------------- +#include "LeakWatcher.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +// TODO: replace the complete COptions class with a better design + +COptions::COptions () + : m_bIntegrityCheck (false), + m_bIncludeLabels (true), + m_bOnlyLabels (false), + m_bIncludeDeleted (false), + m_bOnlyDeleted (false), + m_bIncludeFiles (true), + m_bOnlyFiles (false), + m_bHelp (false), + m_bAllRecords (false), + m_pVersionFilter (NULL), + m_Version (0), + m_bForceOverwrite (false), + m_bRecursive (false), + m_bExtended (false), + m_bPhys (false) +{ + +} + +COptions::~COptions () +{ + DELETE (m_pVersionFilter); +} + +void COptions::PrintUsage () +{ + std::cout << "ssrep v0.8:" << std::endl; + std::cout << std::endl; + std::cout << "usage:" << std::endl; + std::cout << "general options: " << std::endl; + std::cout << " -Y user,password" << std::endl; + std::cout << " -d include deleted files" << std::endl; + std::cout << " -d+ only deleted files" << std::endl; + std::cout << " -f include files (default)" << std::endl; + std::cout << " -f+ only files" << std::endl; + std::cout << " -f- only projects" << std::endl; + std::cout << " -v# specific version number" << std::endl; + std::cout << std::endl; + std::cout << std::endl; + std::cout << "ssrep dir [file] displays directory information about the project" << std::endl; +// std::cout << "ssrep info [file] displays basic information about the item" << std::endl; +// std::cout << "options: " << std::endl; +// std::cout << " -a process all records within the file" << std::endl; +// std::cout << "ssrep history [item] displays the history of the specific item" << std::endl; +// std::cout << "options: " << std::endl; +// std::cout << " -L<-|+> Filter versions by labels (-) all versions without labels" << std::endl; +// std::cout << " (+) only versions that have labels" << std::endl; +// std::cout << " --del include dead records" << std::endl; +// std::cout << std::endl; +// std::cout << "ssrep get [item] [target] retrieve a specific version of the item" << std::endl; +// std::cout << "options: " << std::endl; +// std::cout << " -f force overwrite of target file" << std::endl; +// std::cout << " -v# specifies the version to get" << std::endl; + std::cout << std::endl; + std::cout << " -h --help print help text" << std::endl; +} + +void COptions::ParseCommandLine (int argc, char* argv[]) +{ + for (int i = 1; i< argc; ++i) + { + if (argv[i][0] == '-') + { + if (IsArgChar (argv[i][1], '?')) + { + m_bHelp = true; + } + else if (IsArgChar (argv[i][1], 'a') || IsLongArgument (&argv[i][1], "all")) + { + m_bAllRecords = true; + } + else if (IsArgChar (argv[i][1], 'd')) + { + m_bIncludeDeleted = true; + m_bOnlyDeleted = ToBool (argv[i][2], m_bOnlyDeleted); + } + else if (IsArgChar (argv[i][1], 'e')) + { + m_bExtended = true; + } + else if (IsArgChar (argv[i][1], 'f')) + { + m_bIncludeFiles = true; + m_bOnlyFiles = ToBool (argv[i][2], m_bIncludeFiles ); + } + else if (IsLongArgument (&argv[i][1], "force")) + { + m_bForceOverwrite = true; + } + else if (IsArgChar (argv[i][1], 'h') || IsLongArgument (&argv[i][1], "help")) + { + m_bHelp = true; + } + else if (IsArgChar (argv[i][1], 'i')) + { +// Ignore: Do not ask for input under any circumstances. +// m_bIgnore = true; +// m_bIgnore = ToBool (argv[i][2], m_bIgnore); + } + else if (IsArgChar (argv[i][1], 'l')) + { + m_bOnlyLabels = true; + m_bIncludeLabels = ToBool (argv[i][2], m_bOnlyLabels); + } + else if (IsArgChar (argv[i][1], 'n') || IsLongArgument (&argv[i][1], "names")) + { + if (++i < argc) + m_NamesDat = argv[i]; + } + else if (IsArgChar (argv[i][1], 'o')) + { + m_LogFile = &argv[i][2]; + } + else if (IsArgChar (argv[i][1], 'p')) + { + m_bPhys = true; + m_bPhys = ToBool (argv[i][2], m_bPhys); + } + + else if (IsArgChar (argv[i][1], 'r') || IsLongArgument (&argv[i][1], "recursive")) + { + m_bRecursive = true; + m_bRecursive = ToBool (argv[i][2], m_bRecursive); + } + else if (IsArgChar (argv[i][1], 's')) + { + m_SrcSafeIniPath = &argv[i][2]; + } + else if (IsArgChar (argv[i][1], 'v') || IsLongArgument (&argv[i][1], "version")) + { + std::string filter; + if (IsArgChar (argv[i][1], 'v')) + filter = &argv[i][2]; + else if (++i < argc) + filter = argv[i]; + + int start; + char tilde; + std::istrstream ist (filter.c_str (), filter.length()); + ist >> start; + int end = start; + ist >> tilde; + ist >> end; + + DELETE (m_pVersionFilter); + m_pVersionFilter = new CVersionRangeFilter (end, start); + + m_Version = start; + m_VersionDate = filter; + } + else if (IsArgChar (argv[i][1], 'y')) + { + std::string userpw = &argv[i][2]; + m_User = userpw.substr(0, userpw.find (',')); + m_Password = userpw.substr(userpw.find (',')+1); + } + } + else + { + if (m_Command.empty ()) + { + m_Command = argv[i]; + // TODO: tolower bekommt ein (int) als parameter, std::string ist aber ein uchar --> Probleme mit negativen chars + std::transform (m_Command.begin(), m_Command.end(), m_Command.begin(), tolower); + } + else + m_Items.push_back (argv[i]); + } + } + + if (m_Command == "get" && m_Items.size () > 1) + { + m_Dest = m_Items.back(); + m_Items.pop_back(); + } +} + + +bool COptions::IsLongArgument (const char* ch, const char* arg) +{ + if (!ch) + return false; + + std::string str = (ch[0] == '-') ? &ch[1] : &ch[0]; + if (str == arg) + return true; + + return false; +} + +bool COptions::IsArgChar (const char ch, const char arg) +{ + if (!ch) + return false; + else if (ch == arg) + return true; + else if (tolower(ch) == arg) + return true; + else if (toupper(ch) == arg) + return true; + return false; +} + +bool COptions::ToBool (const char ch, bool& val) +{ + if (!ch) + return val; + if (ch == '-') + val = false; + else if (ch == '+') + val = true; + + return val; +} diff --git a/ssphys/SSRep/Options.h b/ssphys/SSRep/Options.h new file mode 100644 index 0000000..9e0f328 --- /dev/null +++ b/ssphys/SSRep/Options.h @@ -0,0 +1,80 @@ +// Options.h: interface for the COptions class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OPTIONS_H__8B59AD68_C12F_44E7_9236_3C800593E961__INCLUDED_) +#define AFX_OPTIONS_H__8B59AD68_C12F_44E7_9236_3C800593E961__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "VersionFilter.h" + +class COptions +{ +public: + COptions (); + virtual ~COptions (); + + void PrintUsage (); + void ParseCommandLine (int argc, char* argv[]); + + StringVector GetItems () const { return m_Items; } + std::string GetCommand () const { return m_Command; } + bool GetIntegrityCheck () const { return m_bIntegrityCheck; } + bool GetIncludeLabels () const { return m_bIncludeLabels; } + bool GetOnlyLabels () const { return m_bOnlyLabels; } + bool GetDeleted () const { return m_bIncludeDeleted; } + bool GetOnlyDeleted () const { return m_bOnlyDeleted; } + bool GetFiles () const { return m_bIncludeFiles; } + bool GetOnlyFiles () const { return m_bOnlyFiles; } + bool GetHelp () const { return m_bHelp; } + bool GetRecursive () const { return m_bRecursive; } + std::string GetSrcSafeIniPath () const{ return m_SrcSafeIniPath; } + std::string GetNamesCache () const { return m_NamesDat; } + bool GetAllRecords () const { return m_bAllRecords; } + CVersionFilter* GetVersionFilter () const { return m_pVersionFilter; } + int GetVersion () const { return m_Version; } + std::string GetVersionDate () const { return m_VersionDate; } + std::string GetDestination () const { return m_Dest; } + bool GetForceOverwrite () const { return m_bForceOverwrite; } + bool GetExtendedOutput () const { return m_bExtended; } + bool GetPhysOutput () const { return m_bPhys; } + + std::string GetUser () const { return m_User; } + std::string GetPassword () const { return m_Password; } + + std::string GetLogFile () const { return m_LogFile; } +protected: + bool IsLongArgument (const char* ch, const char* arg); + bool IsArgChar (const char ch, const char arg); + bool ToBool (const char ch, bool& val); + + StringVector m_Items; + std::string m_Command; + bool m_bIntegrityCheck; + bool m_bIncludeLabels; + bool m_bOnlyLabels; + bool m_bIncludeDeleted; + bool m_bOnlyDeleted; + bool m_bIncludeFiles; + bool m_bOnlyFiles; + bool m_bHelp; + bool m_bRecursive; + bool m_bAllRecords; + std::string m_NamesDat; + std::string m_SrcSafeIniPath; + CVersionFilter* m_pVersionFilter; + int m_Version; + std::string m_VersionDate; + std::string m_Dest; + bool m_bForceOverwrite; + std::string m_User; + std::string m_Password; + std::string m_LogFile; + bool m_bExtended; + bool m_bPhys; +}; + +#endif // !defined(AFX_OPTIONS_H__8B59AD68_C12F_44E7_9236_3C800593E961__INCLUDED_) diff --git a/ssphys/SSRep/StdAfx.cpp b/ssphys/SSRep/StdAfx.cpp new file mode 100644 index 0000000..cb72fa4 --- /dev/null +++ b/ssphys/SSRep/StdAfx.cpp @@ -0,0 +1,40 @@ +// stdafx.cpp : source file that includes just the standard includes +// ssphys.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file + + +#ifndef _INC_CRTDBG +#include +#endif + +#pragma warning (disable:4073) // get rid of warning for putting initializers in library initialization area +#pragma init_seg(lib) + +struct crt_mem_leak_checker +{ + enum + { + DBG_FLAGS = _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF + }; + + crt_mem_leak_checker() + { + _CrtSetDbgFlag(DBG_FLAGS); + } + + ~crt_mem_leak_checker() + { + if (_CrtDumpMemoryLeaks()) + { +// ::MessageBeep(MB_ICONHAND); + } + } + +} the_checker; + +#pragma warning (default:4073) \ No newline at end of file diff --git a/ssphys/SSRep/StdAfx.h b/ssphys/SSRep/StdAfx.h new file mode 100644 index 0000000..471bf59 --- /dev/null +++ b/ssphys/SSRep/StdAfx.h @@ -0,0 +1,53 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__2A1522EC_5D1E_4342_944F_2A3917F67CA6__INCLUDED_) +#define AFX_STDAFX_H__2A1522EC_5D1E_4342_944F_2A3917F67CA6__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include + +// TODO: reference additional headers your program requires here +#include "assert.h" + +#pragma warning (disable: 4786) +#include +#include +#include +#include + +#include + +//--------------------------------------------------------------------------- +#define countof(x) (sizeof(x) / sizeof(x[0])) +//#define RELEASE(x) if (x) (x)->Release (); +#define DELETE(x) { delete (x); x = NULL; } + +typedef std::vector StringVector; + +//--------------------------------------------------------------------------- +void Info (const char* message); +void Notice (const char* message); +void Warning (const char* message); +void Error (const char* message); + +#define warn_if(x) (x) ? Warning (#x), false : true; +#define warn_with_msg_if(x,y) (x) ? Warning (y), false : true; + + + +#include + + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__2A1522EC_5D1E_4342_944F_2A3917F67CA6__INCLUDED_) diff --git a/ssphys/SSRep/VersionFilter.cpp b/ssphys/SSRep/VersionFilter.cpp new file mode 100644 index 0000000..f42846b --- /dev/null +++ b/ssphys/SSRep/VersionFilter.cpp @@ -0,0 +1,11 @@ +// VersionFilter.cpp: implementation of the CVersionFilter class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "VersionFilter.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + diff --git a/ssphys/SSRep/VersionFilter.h b/ssphys/SSRep/VersionFilter.h new file mode 100644 index 0000000..fab1e13 --- /dev/null +++ b/ssphys/SSRep/VersionFilter.h @@ -0,0 +1,54 @@ +// VersionFilter.h: interface for the CVersionFilter class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_VERSIONFILTER_H__66CEFF72_78D5_4F75_A69C_FCEC324CF8FD__INCLUDED_) +#define AFX_VERSIONFILTER_H__66CEFF72_78D5_4F75_A69C_FCEC324CF8FD__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include +#include + +class CVersionFilter +{ +public: + virtual ~CVersionFilter () {} + virtual bool Filter (SSObject* pObject) const = 0; +}; + +class CVersionRangeFilter : public CVersionFilter +{ +public: + CVersionRangeFilter (int lower, int upper) + : m_Lower (lower), m_Upper (upper) + { + } + + virtual bool Filter (SSObject* pObject) const + { + SSVersionObject* pAction = dynamic_cast (pObject); + if (pAction) + { + if (pAction->GetVersionNumber() >= m_Lower && pAction->GetVersionNumber() <= m_Upper) + return true; + } + return false; + } + +private: + int m_Lower, m_Upper; +}; + +class CVersionSingleFilter : public CVersionRangeFilter +{ +public: + CVersionSingleFilter (int version) + : CVersionRangeFilter (version, version) + { + } +}; + +#endif // !defined(AFX_VERSIONFILTER_H__66CEFF72_78D5_4F75_A69C_FCEC324CF8FD__INCLUDED_) diff --git a/ssphys/SSRep/ssrep.cpp b/ssphys/SSRep/ssrep.cpp new file mode 100644 index 0000000..683fd93 --- /dev/null +++ b/ssphys/SSRep/ssrep.cpp @@ -0,0 +1,287 @@ +// ssphys.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" + +#include "Options.h" +#include +#include +#include // _getcwd +#include "Formatter.h" +#include "fstream" + +//--------------------------------------------------------------------------- +#include "LeakWatcher.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + + +//--------------------------------------------------------------------------- +void Debug (const std::string& message) +{ +// std::cerr << "INFO: " << message << std::endl; +} + +void Info (const char* message) +{ + std::cerr << "INFO: " << message << std::endl; +} + +void Notice (const char* message) +{ + std::cerr << "NOTICE: " << message << std::endl; +} + +void Warning (const char* message) +{ + std::cerr << "WARNING: " << message << std::endl; +} + +void Error (const char* message) +{ + std::cerr << "ERROR: " << message << std::endl; +} + + + + + + +bool fexists (const char* file) +{ + FILE* pFile = fopen (file, "r"); + if (pFile) + { + fclose (pFile); + return true; + } + return false; +} + +void VssGet (const std::string& physFile, const COptions& options) +{ + try + { + if (options.GetDestination ().empty ()) + throw SSException ("please specify a destination for get operation"); + + if (fexists (options.GetDestination ().c_str ()) && !options.GetForceOverwrite ()) + throw SSException ("destination file exists. Please use overwrite flag"); + + + SSHistoryFile file (physFile); +#if 0 + { + std::auto_ptr pItem (file.GetItemInfo ()); + if (pItem->GetType() == SSITEM_PROJECT) + throw SSException ("get does not work on project files"); + + std::auto_ptr pVersion (pItem->GetVersion (options.GetVersion ())); + if (pVersion.get()) + { + pItem->Get (options.GetVersion (), options.GetDestination ().c_str()); + } + } +#endif + } + catch (SSException& ex) + { + std::cerr << "error: " << ex.what() << std::endl; + } +} + +void VssInfo (const std::string& physFile, const COptions& options) +{ + SSRecordFile* pFile = NULL; + try + { + pFile = SSRecordFile::MakeFile (physFile); + if (pFile) + { + pFile->Dump (std::cout); + if (options.GetAllRecords ()) + pFile->DumpRecords (std::cout); + } + } + catch (SSException& ex) + { + std::cerr << "error: " << ex.what() << std::endl; + } + + DELETE (pFile); +} + +void VssValidate (const std::string& physFile, const COptions& options) +{ + try + { + std::auto_ptr pFile (SSRecordFile::MakeFile (physFile)); + if (pFile.get()) + { + pFile->Validate (); + } + } + catch (SSException& ex) + { + std::cerr << "error: " << ex.what() << std::endl; + } +} + +int VssCurrentProject (SSDatabase& dataBase, IFormatter* pFormatter, const COptions& options) +{ + int errorVal = 0; + + StringVector items = options.GetItems (); + if (!items.empty()) + errorVal = dataBase.SetCurrentProject (items.front()); + + if (errorVal == 0) + return pFormatter->DoProject (dataBase, options); + + return errorVal; +} + +int main(int argc, char* argv[]) +{ + COptions options; + options.ParseCommandLine (argc, argv); + + // redirect stdout + std::ofstream logfile; // log file + std::streambuf *sb = NULL; + if (!options.GetLogFile().empty()) + { + logfile.open(options.GetLogFile().c_str(), std::ios_base::app | std::ios_base::out); // log file + sb = std::cout.rdbuf(); // save old sb + std::cout.rdbuf(logfile.rdbuf()); // redirect + } + + if (options.GetHelp () || options.GetCommand () == "help") + { + options.PrintUsage (); + if (sb) std::cout.rdbuf(sb); + return (0); + } + + // TODO: set this to the correct locale + tzset (); + setlocale (LC_TIME, "German"); + + // Load the names cache +// SSNamesCacheFile namesCache; +// if (!options.GetNamesCache ().empty ()) +// { +// try { +// if (namesCache.Open (options.GetNamesCache ())) +// g_NamesCache.SetFile (&namesCache); +// } +// catch (SSException& ex) +// { +// std::cerr << "names cache error: " << ex.what() << std::endl; +// } +// } + + int exitCode = 0; + try + { + + std::string iniPath = options.GetSrcSafeIniPath(); + if (iniPath.empty ()) + { + // grab the path form the environment + const char* p = getenv ("SSDIR"); + if (p) + iniPath = p; + + if (!iniPath.empty ()) + Debug (std::string("SSDIR=") + iniPath); + } + + if (iniPath.empty ()) + { + // take the current directory + char buffer[_MAX_PATH]; + if (_getcwd (buffer, _MAX_PATH) != NULL) + iniPath = buffer; + + if (!iniPath.empty ()) + Debug (std::string("CWD=") + iniPath); + } + + SSDatabase dataBase; + if (!dataBase.Open (iniPath, options.GetUser(), options.GetPassword())) + { + throw SSException (std::string ("could not open database: ") + iniPath); + } + +// dataBase.SetVersionDate (options.GetVersionDate ()); + + std::auto_ptr pFormatter (CVssFormatterFactory::MakeFormatter()); + + if (options.GetCommand () == "whoami") + exitCode = pFormatter->DoWhoAmI (options); + else if (options.GetCommand () == "project") + exitCode = pFormatter->DoProject (dataBase, options); + else if (options.GetCommand () == "cp") + exitCode = VssCurrentProject (dataBase, pFormatter.get(), options); + else + { + // get the list of work items + StringVector items = options.GetItems (); + + // if now items are specified at the command line, we get the current project + if (items.empty ()) + items.push_back (std::string (".")); + + StringVector::const_iterator iter; + for (iter = items.begin (); iter != items.end (); ++iter) + { + SSItemPtr pItem = dataBase.GetSSItem (*iter, false); + if (!pItem) + continue; + + // SSItemPtr pItem = pItem->GetVersion (1); + // assert (pItem->GetVersionNumber() == 1); +// pItem = pItem->GetVersion(options.GetVersionDate ()); +// if (!pItem) +// continue; + + if (options.GetCommand () == "history") + exitCode = pFormatter->DoHistory (pItem, options); + else if (options.GetCommand () == "properties") + exitCode = pFormatter->DoProperties (pItem, options); + else if (options.GetCommand () == "filetype") + exitCode = pFormatter->DoFiletype (pItem, options); + else if (options.GetCommand () == "dir") + exitCode = pFormatter->DoDirectory (pItem, options); + else if (options.GetCommand () == "get") + VssGet (*iter, options); + else if (options.GetCommand () == "info") + VssInfo (*iter, options); + else if (options.GetCommand () == "validate") + VssValidate (*iter, options); + else + throw std::runtime_error (std::string ("unsupported command: ") + options.GetCommand()); + } + } + } + catch (std::exception& ex) + { + std::cout << "error: " << ex.what() << std::endl; + options.PrintUsage (); + exitCode = 1; + } + + if (sb) + { + std::cout.rdbuf(sb); // restore sb + logfile.close (); + } + + return exitCode; +} + diff --git a/ssphys/SSRep/ssrep.dsp b/ssphys/SSRep/ssrep.dsp new file mode 100644 index 0000000..c28915f --- /dev/null +++ b/ssphys/SSRep/ssrep.dsp @@ -0,0 +1,135 @@ +# Microsoft Developer Studio Project File - Name="ssrep" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=ssrep - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "ssrep.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ssrep.mak" CFG="ssrep - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ssrep - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "ssrep - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ssrep - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /profile /machine:I386 + +!ELSEIF "$(CFG)" == "ssrep - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "..\\" /I "..\Utils" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "ssrep - Win32 Release" +# Name "ssrep - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\Formatter.cpp +# End Source File +# Begin Source File + +SOURCE=.\Options.cpp +# End Source File +# Begin Source File + +SOURCE=.\ssrep.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Formatter.h +# End Source File +# Begin Source File + +SOURCE=.\LeakWatcher.h +# End Source File +# Begin Source File + +SOURCE=.\Options.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/ssphys/TODO b/ssphys/TODO new file mode 100644 index 0000000..c168c08 --- /dev/null +++ b/ssphys/TODO @@ -0,0 +1,23 @@ +TODO: + ++++ General +++ + * better exception handling and error reporting + * better command line argument handling + * handle the missing actions + Recovered_Project + Recovered_File + action 12 + action 13 + Shared_File + Branch_File + action 18 + RollBack + ++++ ssphys.exe +++ + * see what is needed for an integration with another scripting tool + ++++ ssrep.exe +++ + * start the work on the ss.exe replacment tool again + ++++ ssapi.lib +++ + * abandon the project diff --git a/ssphys/ssphys.dsw b/ssphys/ssphys.dsw new file mode 100644 index 0000000..3b3c14a --- /dev/null +++ b/ssphys/ssphys.dsw @@ -0,0 +1,92 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "SSAPI"=.\SSAPI\SSAPI.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name SSPhysLib + End Project Dependency +}}} + +############################################################################### + +Project: "SSLib"=.\SSLib\SSLib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name SSPhysLib + End Project Dependency +}}} + +############################################################################### + +Project: "SSPhysLib"=.\SSPhysLib\SSPhysLib.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "ssphys"=.\SSPhys\ssphys.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name SSPhysLib + End Project Dependency +}}} + +############################################################################### + +Project: "ssrep"=.\SSRep\ssrep.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name SSLib + End Project Dependency + Begin Project Dependency + Project_Dep_Name SSPhysLib + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/ssphys/test/lib/Vss2Svn.pm b/ssphys/test/lib/Vss2Svn.pm new file mode 100644 index 0000000..4626d25 --- /dev/null +++ b/ssphys/test/lib/Vss2Svn.pm @@ -0,0 +1,34 @@ +############################################################################### +# package Vss2Svn # +############################################################################### + +package Vss2Svn; + +require 5.005_62; +use strict; +use warnings; + +use File::Path; +use File::Copy; + +use Carp; + +our $VERSION = '1.00'; + +############################################################################### +# set_user +############################################################################### +sub set_user { + my($self, $user, $passwd) = @_; + + $self->{user} = $user; + + { + no warnings 'uninitialized'; # we want to undef passwd if none passed + $self->{passwd} = $passwd unless $passwd eq ''; + } + +} # End set_user + + +1; diff --git a/ssphys/test/lib/Vss2Svn/VSS.pm b/ssphys/test/lib/Vss2Svn/VSS.pm new file mode 100644 index 0000000..4c16a75 --- /dev/null +++ b/ssphys/test/lib/Vss2Svn/VSS.pm @@ -0,0 +1,880 @@ +############################################################################### +# package Vss2Svn::VSS # +############################################################################### + +package Vss2Svn::VSS; + +require 5.005_62; +use strict; +use warnings; + +use base 'Vss2Svn'; +use File::Path; +use File::Copy; +use Win32::TieRegistry (Delimiter => '/'); +use Time::ParseDate; + +use Cwd; +use Cwd 'chdir'; + +sub first(&@); + +use Carp; +our $VERSION = '1.05'; + +our(%gCfg, %gErrMatch, %gHistLineMatch, @gDevPatterns); + +############################################################################### +# new +############################################################################### +sub new { + my($class, $db, $project, $args) = @_; + + if (!defined $db) { + croak "Must specify VSS database path"; + } + + $db =~ s/[\/\\]?(srcsafe.ini)?$//i; + + if (defined $project && $project ne '' + && $project ne '$' && $project !~ /^\$\//) { + croak "Project path must be absolute (begin with $/)"; + } + + $project = first {defined} $project, '$/'; + $args = first {defined} $args, {}; + + my $self = bless + { + database => $db, + interactive => 0, + user => undef, + passwd => undef, + silent => undef, + verbose => undef, + paginate => 0, + ss_output => undef, + ss_error => undef, + get_readonly => 1, + get_compare => 1, + get_eol_type => 0, + implicit_projects => undef, + use_tempfiles => 0, + timebias => 0, + executable => "ss", + _tempdir => undef, + _debug => 0, + _whoami => undef, + %$args, + }, $class; + + # test to ensure 'ss' command is available + $self->ss("WHOAMI", -2) or + croak "Could not run VSS 'ss' command: ensure it is in your PATH"; + + $self->{_whoami} = $self->{ss_output}; + $self->{_whoami} =~ s/\s*$//; + $self->{_whoami} =~ s/^.*\n//; + + if ($self->{ss_output} =~ /changing project/im || + !$self->_check_ss_inifile) { + croak "FATAL ERROR: You must not set the Force_Dir or Force_Prj VSS\n" + . "variables when running SourceSync. These variables can be\n" + . "cleared by unchecking the two \"Assume...\" boxes in SourceSafe\n" + . "Explorer under Tools -> Options -> Command Line Options.\n "; + } + + if ($project eq '') { + $self->ss('PROJECT', -2); + + $project = $self->{ss_output}; + $project =~ s/^Current project is *//i; + $project .= '/' unless $project =~ m/\/$/; + + $self->{project} = $project; + } else { + $self->set_project($project); + } + + return $self; + +} #End new + +############################################################################### +# _check_ss_inifile +############################################################################### +sub _check_ss_inifile { + my($self) = @_; + + my $user = lc($self->{_whoami}); + my $path = "$self->{database}/users/$user/ss.ini"; + + open SSINI, $path or croak "Could not open user init file $path"; + my $success = 1; + +LINE: + while () { + if (m/Force_/i) { + $success = 0; + last LINE; + } + } + + close SSINI; + return $success; + +} # End _check_ss_inifile + +############################################################################### +# set_project +############################################################################### +sub set_project { + my($self, $project) = @_; + + $project .= '/' unless $project =~ m/\/$/; + + $self->ss("CP \"$project\"", -2) or + croak "Could not set current project to $project:\n" + . " $self->{ss_output}\n "; + + $self->{project} = $project; + +} # End set_project + +############################################################################### +# project_tree +############################################################################### +sub project_tree { + my($self, $project, $recursive, $remove_dev) = @_; + + # returns a nested-hash "tree" of all subprojects and files below the given + # project; the "leaves" of regular files are the value "1". + + $project = $self->full_path($project); + $recursive = 1 unless defined $recursive; + $remove_dev = 0 unless defined $remove_dev; + + if ($self->filetype($project) ) { # projects are type 0 + carp "project_tree(): '$project' is not a valid project"; + return undef; + } + + my $cmd = "DIR \"$project\""; + $cmd .= ($recursive)? ' -R' : ' -R-'; + + $self->ss($cmd, -2) or return undef; + + # It would be nice if Microsoft made it easy for scripts to pick useful + # information out of the project 'DIR' listings, but unfortunately that's + # not the case. It appears that project listings always follow blank + # lines, and begin with the full project path with a colon appended. + # Within a listing, subprojects come first and begin with a dollar sign, + # then files are listed alphabetically. If there are no items in a project, + # it prints out a message saying so. And at the end of it all, you get + # a statement like "7 item(s)". + + my %tree = (); + my $branch_ref = \%tree; + + my $seen_blank_line = 0; + my($current_project); + my $match_project = quotemeta($project); + +LINE: + foreach my $line (split "\n", $self->{ss_output}) { + $line =~ s/\s+$//; + + if ($line eq '') { + if ($seen_blank_line) { + carp "project_tree(): an internal error has occured -- 1"; + return undef; + } + + $seen_blank_line = 1; + next LINE; + } + + $seen_blank_line = 0; + + if ($line =~ m/^\d+\s+item\(s\)$/i) { + # this is a count of # of items found; ignore + next LINE; + + } elsif ($line =~ m/^No items found under/i) { + # extraneous info + next LINE; + + } elsif ($line =~ m/^(\$\/.*):$/) { + # this is the beginning of a project's listing + $current_project = $1; + # make current project relative to initial + $current_project =~ s/^$match_project\/?//i; + $current_project =~ s/^\$\///; # take off initial $/ if still there + + $branch_ref = \%tree; + + if ($current_project ne '') { + # get a reference to the end branch of subprojects + ($branch_ref) = reverse(map {$branch_ref = $branch_ref->{$_}} + split('/', $current_project)); + } + + if (!defined $branch_ref) { + carp "project_tree(): an internal error has occured -- 2"; + return undef; + } + + next LINE; + } elsif ($line =~ m/^\$(.*)/) { + # this is a subproject; create empty hash if not already there + if (!defined $current_project) { + carp "project_tree(): an internal error has occured -- 3"; + return undef; + } + + $branch_ref->{$1} = {} unless defined($branch_ref->{$1}); + } else { + # just a regular file + if (!defined $current_project) { + carp "project_tree(): an internal error has occured -- 4"; + return undef; + } + + if ($remove_dev) { + foreach my $pattern (@gDevPatterns) { + next LINE if $line =~ m/$pattern/i; + } + } + + $branch_ref->{$line} = 1; + } + + } + + return \%tree; + +} # End project_tree + +############################################################################### +# parse_date_time_user +############################################################################### +sub parse_date_time_user { + my($self, $line) = @_; + + my ($user,$date,$time,$year,$month,$day,$hour,$min,$ampm); + + $line =~ m/$gHistLineMatch{userdttm}/; + if ($gCfg{dateFormat} == 1) { + # DD-MM-YY + ($user, $day, $month, $year, $hour, $min, $ampm) + = ($1, $2, $3, $4, $5, $6, $7); + } elsif ($gCfg{dateFormat} == 2) { + # YY-MM-DD + ($user, $year, $month, $day, $hour, $min, $ampm) + = ($1, $2, $3, $4, $5, $6, $7); + } else { + # MM-DD-YY + ($user, $month, $day, $year, $hour, $min, $ampm) + = ($1, $2, $3, $4, $5, $6, $7); + } + + $year = ($year > 79)? "19$year" : "20$year"; + + if ($ampm =~ /p/i && $hour < 12) { + $hour += 12; + } elsif ($ampm =~ /a/i && $hour == 12) { + $hour = 0; + } + + if ($self->{timebias} != 0) { + my $basis = parsedate("$year/$month/$day $hour:$min"); + (my $bias = $self->{timebias}) =~ s/^(\d+)/+ $1/; + my $epoch_secs = parsedate("$bias minutes", + NOW => $basis); + + (undef,$min,$hour,$day,$month,$year) + = localtime($epoch_secs); + + $month += 1; + $year += 1900; #no, not a Y2K bug; $year = 100 in 2000 + } + + $date = sprintf("%4.4i-%2.2i-%2.2i", + $year, $month, $day); + $time = sprintf("%2.2i:%2.2i", $hour, $min); + + my $result = + { user => $user, + date => $date, + time => $time,}; + + return $result; +} + +############################################################################### +# file_history +############################################################################### +sub file_history { + my($self, $file, $versionNumber) = @_; + # returns an array ref of hash refs from earliest to most recent; + # each hash has the following items: + # version: version (revision) number + # user : name of user who committed change + # date : date in YYYYMMDD format + # time : time in HH:MM (24h) format + # comment: checkin comment + + $file = $self->full_path($file); + + my $cmd = "HISTORY -f- -l- "; + $cmd .= "-v$versionNumber~$versionNumber " if (defined $versionNumber && $versionNumber >= 0); + $cmd .= "\"$file\""; + my $tmpfile = ''; + + my $success = $self->ss($cmd, -2); + return undef if (!$success); + + my $hist = []; + my $labels = []; + + my $state = 0; # what type was the last line read? + # 0=start: look for a line with stars + # 2=version line + # 3=empty star line + # 4=user/date/time + # 5=label line + # 6=action line + # 7=comment line + # 8=additional comment lines + # 9=record finished + my $laststate = $state; + my $initstate = 1; # perform specific action when entering a state + + my $last_version = -1; + + my $rev = {}; # hash of info for the lastent revision + my $comment = ''; + +HISTLINE: + foreach my $line (split "\n", $self->{ss_output}) { + + my $line_processed = 0; + my $error = ''; + + while (!$line_processed) { + if ($state == 0) { # search for the start of a record (a star line) + if ($line =~ m/$gHistLineMatch{version}/) { + $state = 2; + } elsif ($line =~ m/$gHistLineMatch{stars22}/) { + $state = 3; + } else { + # drop all other lines + $line_processed = 1; + } + } elsif ($state == 2) { # version record + if ($initstate) { + if ($line =~ m/$gHistLineMatch{version}/) { + $rev->{version} = $1; + $line_processed = 1; + } else { + $error = "wrong state condition ($state): version line expected\n"; + } + } elsif ($line =~ m/$gHistLineMatch{label}/) { + $state = 5; + } elsif ($line =~ m/$gHistLineMatch{userdttm}/) { + $state = 4; + } else { + $error = "internal consistency failure, label or date/user line expected"; + } + } elsif ($state == 3) { # project label + if ($initstate) { + if ($line =~ m/$gHistLineMatch{stars22}/) { + $line_processed = 1; + } else { + $error = "wrong state condition ($state): star line expected\n"; + } + } elsif ($line =~ m/$gHistLineMatch{label}/) { + $state = 5; + } else { + $error = "internal consistency failure, label line expected"; + } + } elsif ($state == 4) { # user and date line + if ($initstate) { + if ($line =~ m/$gHistLineMatch{userdttm}/) { + %$rev = (%$rev, %{$self->parse_date_time_user ($line)}); + $line_processed = 1; + } else { + $error = "wrong state condition ($state): date/user line expected\n"; + } + } elsif ($line =~ m/$gHistLineMatch{action}/) { + $state = 6; + } elsif ($line =~ m/$gHistLineMatch{action0}/) { + $state = 6; + } elsif ($line =~ m/$gHistLineMatch{action1}/) { + $state = 6; + } elsif ($line =~ m/$gHistLineMatch{action11}/) { + $state = 6; + } elsif ($line =~ m/$gHistLineMatch{action2}/) { + $state = 6; + } elsif ($line =~ m/$gHistLineMatch{action3}/) { + $state = 6; + } else { + $error = "internal consistency failure, action line expected"; + } + } elsif ($state == 5) { # label line + if ($initstate) { + if ($line =~ m/$gHistLineMatch{label}/) { + $rev->{label} = $1; + $line_processed = 1; + } else { + $error = "wrong state condition ($state): label line expected\n"; + } + } elsif ($line =~ m/$gHistLineMatch{userdttm}/) { + $state = 4; + } else { + $error = "internal consistency failure, date/user line expected"; + } + } elsif ($state == 6) { # action line + if ($initstate) { + if ($line =~ m/$gHistLineMatch{action}/) { + $rev->{action} = $line; + $rev->{path} = $2; + $line_processed = 1; + } elsif ($line =~ m/$gHistLineMatch{action0}/) { + $rev->{action} = $line; + $line_processed = 1; + } elsif ($line =~ m/$gHistLineMatch{action1}/) { + $rev->{path} = $1; + $rev->{action} = $2 . " " . $1; # translate to OLE string + $line_processed = 1; + } elsif ($line =~ m/$gHistLineMatch{action11}/) { # shared + # $1 is the path the share came from + # $2 is the name of the item + $rev->{path} = $2; + $rev->{action} = "Shared \$/$1$2"; # translate to OLE string + $line_processed = 1; + } elsif ($line =~ m/$gHistLineMatch{action2}/) { + $rev->{path} = $1; + $rev->{action} = "Renamed $1 to $2"; + $line_processed = 1; + } elsif ($line =~ m/$gHistLineMatch{action3}/) { + $rev->{path} = $1; + $rev->{action} = "Pinned $1 to Version $2"; + $line_processed = 1; + } else { + $error = "wrong state condition ($state): action line expected\n"; + } + } elsif ($line =~ m/$gHistLineMatch{comment}/) { + $state = 7; + } elsif ($line eq '') { + $state = 9; + } else { + $error = "internal consistency failure, comment or empty line expected\n"; + } + } elsif ($state == 7) { # comment line (begin) + if ($initstate) { + if ($line =~ m/$gHistLineMatch{comment}/) { + $comment = $2; + $line_processed = 1; + } else { + $error = "wrong state condition ($state): comment line expected\n"; + } + } elsif ($line =~ m/$gHistLineMatch{stars}/) { + $state = 9; + } else { + $state = 8; + } + } elsif ($state == 8) { # additional comment lines + if ($line =~ m/$gHistLineMatch{stars}/) { + $state = 9; + } else { + # accumulate all other comment lines + $comment .= "\n$line"; + $line_processed = 1; + } + } elsif ($state == 9) { # create the record + # clean up comment text + $comment =~ s/\s+$//; + $comment =~ s/^\s+//; + if ($comment eq '') { + $comment = '(no comment)'; + } + + $rev->{comment} = $comment; + + if (exists $rev->{version} && defined $rev->{version} && $rev->{version} ne '') { + warn "DEBUG: Version record: $rev->{version}, $rev->{user}, $rev->{date}, $rev->{time}: $rev->{comment}\n"; + + $rev->{labels} = $labels; + $labels = []; + + unshift @$hist, $rev; + } elsif ($rev->{label} ne '') { + warn "DEBUG: Label record: $rev->{label}: $rev->{comment}\n"; + unshift @$labels, $rev; + } + + $rev = {}; + $comment = ''; + + # drop to state 0, start looking for the next record + $state = 0; + } + + if ($state ne $laststate) { + $initstate = 1; + } else { + $initstate = 0; + } + + $laststate = $state; + + + if ($error ne '') { # report an error an bail out + if ($self->{_debug}) { + warn "DEBUG:($state)<$line>\n"; + } + warn "DEBUG: file_history(): $error\n"; + return undef; + } + } + + if ($self->{_debug}) { + warn "DEBUG:($state)<$line>\n"; + } + + next HISTLINE; + } + + # the last record isn't finished if we are not in the initial state + if ($state > 0) { + # clean up comment text + $comment =~ s/\s+$//; + $comment =~ s/^\s+//; + if ($comment eq '') { + $comment = '(no comment)'; + } + + $rev->{comment} = $comment; + + if (exists $rev->{version} && defined $rev->{version} && $rev->{version} ne '') { + warn "DEBUG: Version record: $rev->{version}, $rev->{user}, $rev->{date}, $rev->{time}: $rev->{comment}\n"; + + $rev->{labels} = $labels; + $labels = []; + + unshift @$hist, $rev; + } elsif ($rev->{label} ne '') { + warn "DEBUG: Label record: $rev->{label}: $rev->{comment}\n"; + unshift @$labels, $rev; + } + } + + return $hist; +} + + +############################################################################### +# filetype +############################################################################### +sub filetype { + # -1: error + # 0: project + # 1: text + # 2: binary + + my($self, $file) = @_; + return -1 unless defined $file; + + #$file =~ s/\s//g; + + # special cases + return 0 if $file eq '$/'; + return -1 if $file eq '$'; + + # special cases with version numbers ($;10 or $/;10) + if ($file =~ m/\$\;\d*/mi) { + return 0; + } + elsif ($file =~ m/\$\/\;\d/mi) { + return 0; + } + + # VSS has no decent way of determining whether an item is a project or + # a file, so we do this in a somewhat roundabout way + + $file =~ s/[\/\\]$//; + + my $bare = $file; + $bare =~ s/.*[\/\\]//; + $bare = quotemeta($bare); + + $self->ss("PROPERTIES \"$file\" -R-", -3) or return -1; + + my $match_isproject = "^Project:.*$bare\\s*\$"; + my $match_notfound = "$bare\\s*is not an existing filename or project"; + + if ($self->{ss_output} =~ m/$match_isproject/mi) { + return 0; + } elsif ($self->{ss_output} =~ m/$match_notfound/mi) { + return -1; + } else { + $self->ss("FILETYPE \"$file\"", -3) or return -1; + + if ($self->{ss_output} =~ m/^$bare\s*Text/mi) { + return 1; + } else { + return 2; + } + + } + +} # End filetype + +############################################################################### +# full_path +############################################################################### +sub full_path { + # returns the full VSS path to a given project file. + + my($self, $file) = @_; + + $file =~ s/^\s+//; + $file =~ s/\s+$//; + $file =~ s/\/$// unless $file eq '$/'; + + return $file if $self->{implicit_projects}; + + $file = "$self->{project}$file" unless $file =~ m/^\$/; + $file =~ s/\/$// unless $file eq '$/'; # in case empty string was passed + + return $file; +} # End full_path + +############################################################################### +# ss +############################################################################### +sub ss { + my($self, $cmd, $silent) = @_; + + # SS command-line tool access. + + # silent values: + # 0: print everything + # 1: print program output only + # 2: print err msgs only + # 3: print nothing + # -n: use 'n' only if 'silent' attribute not set + + if (defined($silent) && $silent < 0) { + $silent = first {defined} $self->{silent}, $silent; + } else { + $silent = first {defined} $silent, $self->{silent}, 0; + } + + $silent = abs($silent); + + $cmd =~ s/^\s+//; + $cmd =~ s/\s+$//; + + (my $cmd_word = lc($cmd)) =~ s/^(ss(\.exe)?\s+)?(\S+).*/$3/i; + + $cmd = $self->{executable} . " $cmd" unless ($cmd =~ m/^ss(\.exe)?\s/i); + + if ($self->{interactive} =~ m/^y/i) { + $cmd = "$cmd -I-Y"; + } elsif ($self->{interactive} =~ m/^n/i) { + $cmd = "$cmd -I-N"; + } elsif (!$self->{interactive}) { + $cmd = "$cmd -I-" + } + + my $disp_cmd = $cmd; + + if (defined $self->{user} && $cmd !~ /\s-Y/i) { + if (defined $self->{passwd}) { + $disp_cmd = "$cmd -Y$self->{user},******"; + $cmd = "$cmd -Y$self->{user},$self->{passwd}"; + } else { + $disp_cmd = $cmd = "$cmd -Y$self->{user}"; + } + } + + my($rv, $output); + + warn "DEBUG: $disp_cmd\n\n" if $self->{_debug}; + + $ENV{SSDIR} = $self->{database}; + + if ($self->{use_tempfiles} && + $cmd_word =~ /^(dir|filetype|history|properties)$/) { + my $tmpfile = "$self->{use_tempfiles}/${cmd_word}_cmd.txt"; + unlink $tmpfile; + $cmd = "$cmd \"-O\&$tmpfile\""; + system $cmd; + + if (open SS_OUTPUT, "$tmpfile") { + local $/; + $output = scalar ; + close SS_OUTPUT; + unlink $tmpfile; + } else { + warn "Can't open '$cmd_word' tempfile $tmpfile"; + undef $output; + } + + } else { + open SS_OUTPUT, '-|', "$cmd 2>&1"; + + while () { + $output .= $_; + } + + close SS_OUTPUT; + $output =~ s/\s+$// if defined $output; + } + + if ($silent <= 1) { + if ($self->{paginate}) { + my $linecount = 1; + + foreach my $line (split "\n", $output) { + print "$line\n"; + + unless ($linecount++ % $self->{paginate}) { + print "Hit ENTER to continue...\r"; + ; + + print " \r"; + + } + + } + + } else { + print "$output\n"; + } + + } + + my $ev = $? >> 8; + + # SourceSafe returns 1 to indicate warnings, such as no results returned + # from a 'DIR'. We don't want to consider these an error. + my $success = !($ev > 1); + + if ($success) { + # This is interesting. If a command only partially fails (such as GET-ing + # multiple files), that's apparently considered a success. So we have to + # try to fix that. + my $base_cmd = uc($cmd); + $base_cmd =~ s/^(ss\s*)?(\w+).*/$2/i; + + my $err_match; + + if (defined($err_match = $gErrMatch{$base_cmd}) && + $output =~ m/$err_match/m) { + $success = 0; + } + + } + + if ($success) { + $self->{ss_error} = undef; + } else { + $self->{ss_error} = "$disp_cmd\n$output"; + } + + if (!$success && ($silent == 0 || $silent == 2)) { + + carp "\nERROR in Vss2Svn::VSS-\>ss\n" + . "Command was: $disp_cmd\n " + . "(Error $ev) $output\n "; + warn "\n"; + + } + + $self->{ss_output} = $output; + return $success; + +} # End ss + +############################################################################### +# _msg +############################################################################### +sub _msg { + my $self = shift; + print @_ unless $self->{silent}; +} # End _msg + +############################################################################### +# _vm -- "verbose message" +############################################################################### +sub _vm { + my $self = shift; + print @_ if $self->{verbose}; +} # End _vm + +############################################################################### +# Initialize +############################################################################### +sub Initialize { + my $dateFormat = $Registry->{'HKEY_CURRENT_USER/Control Panel/' + . 'International/iDate'} || 0; + my $dateSep = $Registry->{'HKEY_CURRENT_USER/Control Panel/' + . 'International/sDate'} || '/'; + my $timeSep = $Registry->{'HKEY_CURRENT_USER/Control Panel/' + . 'International/sTime'} || ':'; + $gCfg{dateFormat} = $dateFormat; + + if ($dateFormat == 1) { + $gCfg{dateString} = "DD${dateSep}MM${dateSep}YY"; + } elsif ($dateFormat == 2) { + $gCfg{dateString} = "YY${dateSep}MM${dateSep}DD"; + } else { + $gCfg{dateString} = "MM${dateSep}DD${dateSep}YY"; + } + + $gCfg{timeString} = "HH${timeSep}MM"; + + # see ss method for explanation of this + %gErrMatch = ( + GET => 'is not an existing filename or project', + CREATE => 'Cannot change project to', + CP => 'Cannot change project to', + ); + + %gHistLineMatch = ( + version => qr/^\*+\s*Version\s+(\d+)\s*\*+\s*$/, + userdttm => qr/^User:\s+(.*?)\s+ + Date:\s+(\d+)$dateSep(\d+)$dateSep(\d+)\s+ + Time:\s+(\d+)$timeSep(\d+)([ap]*)\s*$/x, + comment => qr/^(Comment|Label comment): (.*)/, + label => qr/^Label:\s+"(.*)"/, + stars => qr/^\*{5,22}/, + stars22 => qr/^\*{22}/, + action => qr/^(Checked in|Labeled|Created)\s*(.*)/, + action0 => qr/^Rolled back/, + action1 => qr/^(.*)\s+(added|deleted|destroyed|purged|recovered|unpinned)$/, + action11 => qr/^\$\/(.*\/)?(.*) shared$/, + action2 => qr/^(.*) renamed to (.*)$/, + action3 => qr/^(.*) pinned to version (.*)$/, + empty => qr//, + ); + + # patterns to match development files that project_tree will ignore + @gDevPatterns = ( + qr/\.vspscc$/, + qr/\.vssscc$/, + qr/^vssver\.scc$/, + ); + +} # End Initialize + +sub first(&@) { + my $code = shift; + &$code && return $_ for @_; + return undef; +} + +1; diff --git a/ssphys/test/lib/VssCmd.pm b/ssphys/test/lib/VssCmd.pm new file mode 100644 index 0000000..9a66231 --- /dev/null +++ b/ssphys/test/lib/VssCmd.pm @@ -0,0 +1,429 @@ +# Copyright 2004 Ed Price. +# +# This file is part of vss2svn2 (see http://vss2svn2.tigris.org/). +# +# vss2svn2 is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# vss2svn2 is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with vss2svn2; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +package VssCmd; + +our $VERSION = '0.5.6'; + +# + +use warnings; +use strict; +use Carp; + +sub first(&@); +our(%gErrMatch); + + +# provides access to real VSS repository. +# +# uses SS.EXE command. + +# XXX TODO: +# +# * consider "-S" or "-S-" to enable/disable "smart mode". +# * consider "-NL" (long filename mode) +# * consider all the crazy "-G" Get (et al) options... +# * use "-C@file" for multiline comments. + +#use VssPath; + +# required options: +# +# * vss_dir +# * vss_user +# +# optional options: +# +# * vss_pass +# +# XXX TODO: add nowarn, nodebug. +# XXX mostly duplicated from VssOle.pm. +sub new +{ + my ($class, %options) = @_; + + my $vss_dir = File::Spec->rel2abs($options{vss_dir}); + my $vss_log = File::Spec->rel2abs($options{vss_log}); + + my $self = + { + vss_cmd => exists $options{vss_cmd} ? $options{vss_cmd} : "ss", + vss_dir => $vss_dir, + vss_user => $options{vss_user}, + vss_pass => exists $options{vss_pass} ? $options{vss_pass} : "", + vss_log => $vss_log, + use_tempfiles => 1, + }; + + bless $self, $class; +} + +# creates an empty repository. +# +# currently requires VSS admin tools in PATH: +# +# * mkss.exe +# * ddupd.exe +# * ddconv.exe +# +# note: if vss_dir (as supplied to VssOle->new) does not exist, it will +# be created. if it does exist, it MUST BE EMPTY. +# +# XXX duplicated from VssOle.pm. +sub create +{ + my ($self) = @_; + croak "repository already open" if defined $self->{vss}; + + my $vss_cmd = $self->{vss_cmd}; + my $vss_dir = $self->{vss_dir}; + my $vss_user = $self->{vss_user}; + + # XXX only "admin" seems to work. + $self->WARN ("VSS user besides 'admin' probably wont work") + unless lc($vss_user) eq "admin"; + + # XXX dont know how to set password. + $self->WARN ("password not supported") + if $self->{vss_pass}; + + my $srcsafe_ini = $vss_dir . "/srcsafe.ini"; + my $users_txt = $vss_dir . "/users.txt"; + my $data_dir = $vss_dir . "/data"; + my $users_dir = $vss_dir . "/users"; + my $user_dir = $vss_dir . "/users/$vss_user"; + my $ss_ini = $vss_dir . "/users/$vss_user/ss.ini"; + + # create VSS dir, if necessary + if (not -e $vss_dir) + { + mkdir $vss_dir or croak "error creating VSS dir ($vss_dir): $!"; + } + # make sure VSS dir is empty + { + opendir(DH, $vss_dir) or croak "error opening VSS dir ($vss_dir): $!"; + my @files = grep { $_ ne "." and $_ ne ".." } readdir(DH); + croak "VSS dir ($vss_dir) not empty" if @files; + closedir(DH); + } + + # create srcsafe.ini + open FH, ">$srcsafe_ini" or croak "error opening srcsafe.ini ($srcsafe_ini): $!"; + print FH "Data_path = data\n"; + print FH "Temp_path = temp\n"; + print FH "Users_path = users\n"; + print FH "Users_Txt = users.txt"; + close FH or warn "error closing srcsafe.ini ($srcsafe_ini): $!"; + + # create users.txt + open FH, ">$users_txt" or croak "error creating users.txt ($users_txt): $!"; + print FH "$vss_user = users\\$vss_user\\ss.ini\n"; + close FH or warn "error closing users.txt ($users_txt): $!"; + + # create users dir, and users/ + mkdir $users_dir or croak "error creating users dir ($users_dir): $!"; + mkdir $user_dir or croak "error creating user dir ($user_dir): $!"; + + # create (empty) "ss.ini" file for vss_user. + open FH, ">$ss_ini" or croak "error opening user ss.ini ($ss_ini): $!"; + close FH or warn "error closing user ss.ini ($ss_ini): $!"; + + # create data dir + mkdir $data_dir or croak "error creating data dir ($data_dir): $!"; + + # + # now populate data dir (the fun part). + # + + # 1. create empty VSS repository in version 4 format. + # + # "mkss" adds the following files to $data_dir: + # + # * um.dat (user management) + # * aaaaaaaa + # * aaaaaaaa.a + # * aaaaaaaa.cnt + + $self->_exec ("mkss", $data_dir); + + # 2. convert to version 5 format. + # + # "ddupd" prints "File um.dat may be corrupt" (why?) + # and adds a "loggedin" folder. + + # XXX that message probably causes non-zero exit status... + eval { $self->_exec ("ddupd", $data_dir); } or + warn "ignoring DDUPD.EXE non-zero exit status"; + + # 3. convert to version 6 format. + # + # "ddconv" adds all the one-letter folders and some other stuff. + + $self->_exec ("ddconv", $data_dir); +} + +# +# SS.EXE "subcommand" list (from MSDN): +# +# XXX TODO: which ones do wildcard matching, -R for recursion, etc. +# +# command priority +# ------- -------- +# About - +# Add 1 +# Branch 2 +# Checkin 1 +# Checkout - +# Cloak - +# CP 0 (blocks everything) +# Create 1 (mkdir, essentially? XXX whats diff b/t project and dir??) +# Decloak - +# Delete 1 +# Deploy - +# Destroy 2 +# Difference - +# Directory 3 ("ls" basically) +# Filetype 3 (gets/sets whether file is Text vs Binary) +# FindinFiles - +# Get 1 +# Help - +# History 3 +# Label 2 +# Links 3 +# Merge 3 +# Move 1 +# Password - +# Paths 3 +# Pin 2 +# Project - (shows "CurrentProject") +# Properties - +# Purge 2 +# Recover 2 +# Rename 1 +# Rollback 3 +# Share 2 +# Status - +# Undocheckout - +# Unpin 2 +# View - +# Whoami - +# WorkFold 0 (blocks everything) + +# XXX in general maybe better to use hash args, eg: +# +# recurse => 1, +# file => "a.txt", +# comment => "blah blah", etc. + +# ---------- +# priority 0 +# ---------- +# +# CP 0 (blocks everything) +# WorkFold 0 (blocks everything) +# +# note: renamed "CP" to "CurrentProject" to prevent confusion wrt +# 'copy'. + +sub CurrentProject { + my ($self, $proj) = @_; + $self->_ss ("CP", $proj); +} + +sub WorkFold { + my ($self, $path) = @_; + $path = File::Spec->rel2abs ($path); + $self->_ss ("WorkFold", $path); +} + +# ---------- +# priority 1 +# ---------- +# +# Add 1 +# Checkin 1 +# Create 1 (mkdir, essentially? XXX whats diff b/t project and dir??) +# Delete 1 +# Get 1 +# Move 1 +# Rename 1 + +# XXX can this add a dir? or just a file? +sub Add { + my ($self, $file) = @_; + $self->_ss ("Add", $file); +} + +sub Checkin { + my ($self, $file) = @_; + $self->_ss ("Checkin", $file); +} + +sub Create { + my ($self, $dir) = @_; + $self->_ss ("Create", $dir); +} + +sub Delete { + my ($self, $file) = @_; + $self->_ss ("Delete", $file); +} + +sub Dir { + my ($self, $file) = @_; + return $self->_ss ("Dir", $file); +} + +sub Get { + my ($self, $file) = @_; + $self->_ss ("Get", $file); +} + +sub Move { + my ($self, $src_file, $tgt_dir) = @_; + $self->_ss ("Move", $src_file, $tgt_dir); +} + +sub Rename { + my ($self, $old_file, $new_file) = @_; + $self->_ss ("Rename", $old_file, $new_file); +} + +# ---------- +# priority 2 +# ---------- +# +# Branch 2 +# Destroy 2 +# Label 2 +# Pin 2 +# Purge 2 +# Recover 2 +# Share 2 +# Unpin 2 + +# ---------- +# priority 3 +# ---------- +# +# Directory 3 ("ls" basically) +# Filetype 3 (gets/sets whether file is Text vs Binary) +# History 3 +# Links 3 +# Merge 3 +# Paths 3 +# Rollback 3 + +# --------------- +# everything else +# --------------- +# +# About - +# Checkout - +# Cloak - +# Decloak - +# Deploy - +# Difference - +# FindinFiles - +# Help - +# Password - +# Project - (shows "CurrentProject") +# Properties - +# Status - +# Undocheckout - +# View - +# Whoami - + +# +# internal methods +# + +sub _ss +{ + my ($self, $verb, @args) = @_; + + $ENV{SSDIR} = $self->{vss_dir}; + + my @other = (); + { + push @other, "-I-Y"; # Yes to all prompts; XXX dubious... + push @other, "-Y" . $self->{vss_user} . "," . $self->{vss_pass}; + push @other, "-O" . $self->{vss_log}; + #push @other, "-W"; # writable working copy; XXX doesnt work with all commands + } + + return $self->_exec ($self->{vss_cmd}, $verb, @args, @other); +} + +sub _exec +{ + my ($self, @command) = @_; + + $self->LOG ("EXEC: @command"); + my $ans = system (@command); + + # error-checking based on "perldoc -f system". + die "error running '@command': $!" if $ans == -1; + $ans /= 256; + die "error ($ans) from '@command'" if $ans != 0; +} + +# logging + +sub ERROR { + my ($self, $msg) = @_; + print "# XXX (ERROR) $msg\n"; +} + +sub WARN { + my ($self, $msg) = @_; + print "# XXX (WARNING) $msg\n" unless $self->{nowarn}; +} + +sub DEBUG { + my ($self, $msg) = @_; + print "# $msg\n" unless $self->{nodebug}; +} + +sub LOG { + my ($self, $msg) = @_; + print "# $msg\n"; +} + + +############################################################################### +# Initialize +############################################################################### +sub Initialize { + # see ss method for explanation of this + %gErrMatch = ( + GET => 'is not an existing filename or project', + CREATE => 'Cannot change project to', + CP => 'Cannot change project to', + ); +} # End Initialize + +sub first(&@) { + my $code = shift; + &$code && return $_ for @_; + return undef; +} + + +1; diff --git a/ssphys/test/lib/VssOle.pm b/ssphys/test/lib/VssOle.pm new file mode 100644 index 0000000..032917c --- /dev/null +++ b/ssphys/test/lib/VssOle.pm @@ -0,0 +1,556 @@ +# Copyright 2004 Ed Price. +# +# This file is part of vss2svn2 (see http://vss2svn2.tigris.org/). +# +# vss2svn2 is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# vss2svn2 is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with vss2svn2; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +package VssOle; + +our $VERSION = '0.5.6'; + +# + +use warnings; +use strict; +use Carp; + +# provides access to real VSS repository. +# +# uses Win32::OLE currently. + +use Win32::OLE; +use Win32::OLE::Const "Microsoft SourceSafe 6.0 Type Library"; +eval { defined VSSFLAG_RECURSYES } or die "sanity check failed, VSSFLAG_RECURSYES undefined"; + +use VssPath; + +# required options: +# +# * vss_dir +# * vss_user +# +# optional options: +# +# * vss_pass +# +# XXX TODO: add nowarn, nodebug. +sub new +{ + my ($class, %options) = @_; + + my $self = + { + vss_dir => $options{vss_dir}, + vss_user => $options{vss_user}, + vss_pass => $options{vss_pass}, + vss => undef, # defined by "open" + }; + + bless $self, $class; +} + +# creates an empty repository. +# +# currently requires VSS admin tools in PATH: +# +# * mkss.exe +# * ddupd.exe +# * ddconv.exe +# +# note: if vss_dir (as supplied to VssOle->new) does not exist, it will +# be created. if it does exist, it MUST BE EMPTY. + +sub create +{ + my ($self) = @_; + croak "repository already open" if defined $self->{vss}; + + my $vss_dir = $self->{vss_dir}; + my $vss_user = $self->{vss_user}; + + # XXX only "admin" seems to work. + $self->WARN ("VSS user besides 'admin' probably wont work") + unless lc($vss_user) eq "admin"; + + # XXX dont know how to set password. + $self->WARN ("password not supported") + if $self->{vss_pass}; + + my $srcsafe_ini = $vss_dir . "/srcsafe.ini"; + my $users_txt = $vss_dir . "/users.txt"; + my $data_dir = $vss_dir . "/data"; + my $users_dir = $vss_dir . "/users"; + my $user_dir = $vss_dir . "/users/$vss_user"; + my $ss_ini = $vss_dir . "/users/$vss_user/ss.ini"; + + # create VSS dir, if necessary + if (not -e $vss_dir) + { + mkdir $vss_dir or croak "error creating VSS dir ($vss_dir): $!"; + } + # make sure VSS dir is empty + { + opendir(DH, $vss_dir) or croak "error opening VSS dir ($vss_dir): $!"; + my @files = grep { $_ ne "." and $_ ne ".." } readdir(DH); + croak "VSS dir ($vss_dir) not empty" if @files; + closedir(DH); + } + + # create srcsafe.ini + open FH, ">$srcsafe_ini" or croak "error opening srcsafe.ini ($srcsafe_ini): $!"; + print FH "Data_path = data\n"; + print FH "Temp_path = temp\n"; + print FH "Users_path = users\n"; + print FH "Users_Txt = users.txt"; + close FH or warn "error closing srcsafe.ini ($srcsafe_ini): $!"; + + # create users.txt + open FH, ">$users_txt" or croak "error creating users.txt ($users_txt): $!"; + print FH "$vss_user = users\\$vss_user\\ss.ini\n"; + close FH or warn "error closing users.txt ($users_txt): $!"; + + # create users dir, and users/ + mkdir $users_dir or croak "error creating users dir ($users_dir): $!"; + mkdir $user_dir or croak "error creating user dir ($user_dir): $!"; + + # create (empty) "ss.ini" file for vss_user. + open FH, ">$ss_ini" or croak "error opening user ss.ini ($ss_ini): $!"; + close FH or warn "error closing user ss.ini ($ss_ini): $!"; + + # create data dir + mkdir $data_dir or croak "error creating data dir ($data_dir): $!"; + + # + # now populate data dir (the fun part). + # + + # 1. create empty VSS repository in version 4 format. + # + # "mkss" adds the following files to $data_dir: + # + # * um.dat (user management) + # * aaaaaaaa + # * aaaaaaaa.a + # * aaaaaaaa.cnt + + system ("mkss $data_dir"); # XXX error-checking? + + # 2. convert to version 5 format. + # + # "ddupd" prints "File um.dat may be corrupt" (why?) + # and adds a "loggedin" folder. + + system ("ddupd $data_dir"); # XXX error-checking? + + # 3. convert to version 6 format. + # + # "ddconv" adds all the one-letter folders and some other stuff. + + system ("ddconv $data_dir"); # XXX error-checking? +} + +# opens VSS repository. +sub open +{ + my ($self) = @_; + + if (defined$self->{vss}) + { + croak "already open"; + return; + } + + $self->DEBUG ("initializing VSS..."); + my $vss = Win32::OLE->new ("SourceSafe"); + _oerr(); + + my $vss_dir = $self->{vss_dir} . "\\foo"; # XXX weird, but... + my $vss_user = $self->{vss_user}; + my $vss_pass = $self->{vss_pass}; + + $self->DEBUG ("opening VSS..."); + $vss->Open ($vss_dir, $vss_user, $vss_pass); + _oerr(); + + $self->{vss} = $vss; +} + +# retrieves actual file given VssPath string and output file +# XXX just auto-convert string in get_file_from_vss_path instead? +sub get_file_from_vss_path_string +{ + my ($self, $vss_path_string, $output_file) = @_; + $self->get_file_from_vss_path (VssPath->new($vss_path_string), $output_file); +} + +# retrieves actual file given VssPath and output file +sub get_file_from_vss_path +{ + my ($self, $vss_path, $output_file) = @_; + + $self->DEBUG("vss path: ". $vss_path->toString); + $self->DEBUG("output file: $output_file"); + + my $vss_item = $self->get_item_from_vss_path ($vss_path); + + $vss_item->Get($output_file); + _oerr(); +} + +# returns VSSItem (OLE object) given simple VSS path. +# (wrapper on VSS OLE "VSSItem" method.) +sub OLE_VSSItem +{ + my ($self, $simple_path_string) = @_; + my $ans = $self->{vss}->VSSItem ($simple_path_string); + _oerr(); + # XXX check for undef? + return $ans; +} + +# ------------------- +# VssPath <-> VSSItem +# ------------------- + +# returns VssPath for given VSSItem (OLE object) +sub get_vss_path_from_item +{ + my ($self, $item) = @_; + + my $name = $item->{Name}; + my $version = $item->{VersionNumber}; + my $parent = $item->{Parent}; + _oerr(); + + $self->DEBUG ("get_vss_path_from_item: v$version of $name"); + + # stop recursion at root. + + if ($name eq "") + { + $self->ERROR ("root item name not empty: $name") unless $item->{Spec} eq '$/'; + _owarn(); + return VssPath->new->push("", $version); + } + + # otherwise, recurse. + + my $ans = $self->get_vss_path_from_item ($parent); + $ans->push($name, $version); + return $ans; +} + +# returns VSSItem (OLE object) for given VssPath +sub get_item_from_vss_path +{ + my ($self, $vss_path) = @_; + # XXX if $vss_path is a String instead of a VssPath, it might be nice + # to autoinstantiate a VssPath. what's the std way to do that in perl? + + my $item = undef; + foreach ($vss_path->toArray) + { + my ($name, $version) = @$_; # each elt is [name, version] + + # top of path must be root + if (not defined $item) + { + die "vss_path root name not empty: $name" unless $name eq ""; + + my $vss = $self->{vss}; + confess "no vss (need VssOle 'open' maybe?)" unless defined $vss; + + $self->DEBUG ("getting vss_path root: no version"); + my $root = $vss->VSSItem("/"); + _oerr(); + confess "error getting VSS root" unless defined $root; + + $self->DEBUG ("getting vss_path root: v$version"); + $item = $root->Version($version); + _oerr(); + confess "error getting VSS root v$version" unless defined $item; + } + else + { + $self->DEBUG ("getting vss_path: v$version of $name"); + my $sub_item_hash = $self->get_sub_item_name_hash_from_item ($item); + if (exists $sub_item_hash->{$name}) + { + $item = $sub_item_hash->{$name}; + $item = $item->Version ($version); + _oerr(); + if (not defined $item) + { + $self->ERROR ("error getting sub-item (by version): v$version of '$name' from " . $vss_path->toString); + return undef; + } + } + else + { + $self->ERROR ("error getting sub-item: '$name' from " . $vss_path->toString); + return undef; + } + } + } + return $item; +} + +# --------- +# VSS stuff +# --------- + +# returns list of VSSVersion (OLE objects) given VSSItem (OLE object) +sub get_versions_from_item +{ + my ($self, $item) = @_; + + # NB: VSS_FLAG_HISTIGNOREFILES means to exclude file + # checkin history from PROJECT (ie directory) versions + # enumeration. it seems to have no effect on versions + # enumeration on FILE items. + + my $flags = VSSFLAG_RECURSNO | VSSFLAG_HISTIGNOREFILES; + + my @ans = $self->_get_enum_list ($item->Versions($flags)); + + return @ans if @ans; + + # XXX this can fail (with unpatched SSAPI.DLL...) due + # to 0x80020009 OLE error on rename of component of + # path "above" the item (ie parent dir, grandparent + # dir, etc.) + # + # one could attempt to workaround that by using the + # new name... + # + # but it happens with deletes too, where there is + # there is no "new name" to use instead :( + + carp "get_versions_from_item problem..."; + $self->ERROR ("get_versions_from_item problem..."); + + return (); +} + +# returns VSSItem (OLE object) corresponding to given VSSVersion (OLE object). +sub get_item_from_version +{ + my ($self, $version) = @_; + return $version->{VSSItem}; +} + +# returns list of VSSItem (OLE objects) which are "links" of the given item, +# ie "shared" nodes. XXX DOES NOT WORK DUE TO OLE BUGS. +sub get_links_from_item +{ + my ($self, $item) = @_; + return $self->_get_enum_list ($item->Links); +} + +# returns list of VSSItem (OLE objects) given VSSItem (OLE object). +# the returned list consists of all the "sub-items" of the given item. +# ie, for a directory, returns all the directory entries. +# (returns empty list for a file.) +# XXX appears to return empty list on error too; thats probably wrong... +sub get_sub_items_from_item +{ + my ($self, $item) = @_; + return () if $item->{Type} != 0; + + my $enum = $item->Items; + + # NOTE: i thought $items->Items(1) would be better because + # i thought that would make "IncludeDeleted" flag true, + # but actually, it didn't work that way. adding "(1)" + # resulted in deleted items NOT being listed. + + return () if not defined $enum; + return $self->_get_enum_list ($enum); +} + +# takes a single VSSItem (OLE object) argument. +# +# returns a hashref mapping item "name" to item +# (VSSItem OLE object) for all sub-items of the +# given item, ie: +# +# { String sub_item_name => VSSItem sub_item } +# +sub get_sub_item_name_hash_from_item +{ + my ($self, $item) = @_; + my @items = $self->get_sub_items_from_item ($item); + my $ans = {}; + foreach (@items) + { + my $name = $_->{Name}; + + if (exists $ans->{$name}) + { + # XXX Should Not Happen. but some full + # repository testing by dirk did find them! + # his examples had one normal version number + # and one crazy (> 40,000,000) version number. + # so we'll try picking the lowest version... + + my $prev_item = $ans->{$name}; + my $prev_version = $prev_item->{VersionNumber}; + + my $dupe_item = $_; + my $dupe_version = $dupe_item->{VersionNumber}; + + _oerr (); + + if ($dupe_version < $prev_version) + { + $ans->{$name} = $dupe_item; + $self->WARN ("replacing duplicate sub-item (lower version): v$prev_version -> v$dupe_version of $name"); + } + elsif ($dupe_version == $prev_version) + { + $self->WARN ("ignoring duplicate sub-item name (same version): v$dupe_version of $name"); + } + else + { + $self->WARN ("ignoring duplicate sub-item name (higher version): v$dupe_version (vs v$prev_version) of $name"); + } + } + else + { + $ans->{$name} = $_; + } + } + return $ans; +} + +# takes two VSSItem (OLE object) arguments. the first is the "current +# item" and the second is the "previous item" (intended for an item +# and a previous version of the same item). +# +# returns a two-element list. +# +# the first element is an arrayref of ADDED items (VSSItem OLE objects). +# the second elemnt is an arrayref of DELETED items (VSSItem OLE objects). +sub diff_sub_items +{ + my ($self, $curr_item, $prev_item) = @_; + + my $curr_sub_items = $self->get_sub_item_name_hash_from_item ($curr_item); + my $prev_sub_items = $self->get_sub_item_name_hash_from_item ($prev_item); + + my @adds; + my @dels; + + # what exists in CURR but not in PREV? these were ADDED. + + foreach (keys %$curr_sub_items) + { + push @adds, $curr_sub_items->{$_} if not exists $prev_sub_items->{$_}; + } + + # what exists in PREV but not in CURR? these were DELETED. + + foreach (keys %$prev_sub_items) + { + push @dels, $prev_sub_items->{$_} if not exists $curr_sub_items->{$_}; + } + + # return the adds and deletes. + + return (\@adds, \@dels); +} + +# +# OLE enumerations and dates. +# + +sub _get_enum_list +{ + my ($self, $enum_property) = @_; + Carp::confess ("undefined enum_property") unless $enum_property; + my $enum = Win32::OLE::Enum->new($enum_property); + _owarn (); + return () unless $enum; # XXX ignoring 0x80020009 OLE exception + + # NOTE: it seems that one MUST loop through the entire + # enumeration (done by ->All), and one MUST NOT call "Reset". + # + # otherwise the next attempt to use a (the same? or any?) + # VSSVersions object will result in an OLE error ("history + # operation is already in progress"). + + my @ans = $enum->All; + _oerr (); + + return @ans; +} + +# given Win32::OLE::Variant date, returns "YYYY-MM-DD HH:MI:SS". +sub _get_string_from_variant_date +{ + my ($self, $ole_variant_date) = @_; + # XXX check ISA Win32::OLE::Variant or something? + my $ymd = $ole_variant_date->Date("yyyy-MM-dd"); + my $hms = $ole_variant_date->Time("HH:mm:ss"); + _oerr(); + # XXX can we get timezone?? + return "$ymd $hms"; +} + +# +# OLE error checking +# + +sub _oerr { + my ($self) = @_; + my $error = Win32::OLE->LastError(); + if ($error) { Carp::confess($error); } + 1; +} + +sub _owarn { + my ($self) = @_; + my $error = Win32::OLE->LastError(); + if ($error) + { + $self->WARN ("OLE WARNING: $error"); + Carp::carp($error) unless $self->{nodebug}; + } + 1; +} + +# logging + +sub ERROR { + my ($self, $msg) = @_; + print "# XXX (ERROR) $msg\n"; +} + +sub WARN { + my ($self, $msg) = @_; + print "# XXX (WARNING) $msg\n" unless $self->{nowarn}; +} + +sub DEBUG { + my ($self, $msg) = @_; + print "# $msg\n" unless $self->{nodebug}; +} + +sub LOG { + my ($self, $msg) = @_; + print "# $msg\n"; +} + +1; diff --git a/ssphys/test/lib/VssPath.pm b/ssphys/test/lib/VssPath.pm new file mode 100644 index 0000000..192a9f7 --- /dev/null +++ b/ssphys/test/lib/VssPath.pm @@ -0,0 +1,256 @@ +# Copyright 2004 Ed Price. +# +# This file is part of vss2svn2 (see http://vss2svn2.tigris.org/). +# +# vss2svn2 is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# vss2svn2 is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with vss2svn2; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +package VssPath; + +our $VERSION = '0.5.6'; + +=head1 NAME + +VssPath - unambiguous specification of a version of a VSS item. + +=head1 DESCRIPTION + +A VssPath is like a regular "path" except that each component of the +path has a version number. So it's a "versioned path", consisting of +a list of (Version, Name) pairs. + +A VssPath unambiguously identifies a unique version of a "node" in a +VSS repository. + +=head2 Constraints + + * Version is a positive integer. + * Name is a string (without any "/" characters). + +Addtionally, although it's not currently enforced here, the following +appear generally true of VSS: + + * root node has empty Name (zero-length ""). + * non-root node must have non-empty Name. + * only the last path component can have version 1. + +=head2 Textual representation + + * each path "component" represented as ":". + * multiple components separated by slash ("/"). + +Examples: + + * root => 1: + * toplevel dir => 2:/1:foo + * toplevel file => 2:/1:foo + +=head2 Note on uniqueness + +Although a VssPath is unambiguous, it is I unique. There can be +(and generally are) multiple VssPaths which identify the same version +of the same VSS item. + +For example, consider the following history: + + 1: + mkdir foo 2:/1:foo + mkdir bar 3:/1:bar + +Note that there is only one version of "/foo", but it can be accessed +through both v2 and v3 of the root. + +So the following are equivalent: + + 2:/1:foo + 3:/1:foo + +=cut + +use warnings; +use strict; +use Carp; + +# + +sub new +{ + my ($class, $string) = @_; + my $self = defined $string ? _parse_string ($string) : []; + bless $self, $class; +} + +sub copy +{ + my ($self) = @_; + return VssPath->new($self->toString); +} + +sub push +{ + my ($self, $name, $version) = @_; + _validate ($name, $version); + push @$self, [$name, $version]; + return $self; +} + +# returns [name, version] of the "end" of the path, and removes it from the path. +# returns undef (???) if path is root. (huh? doesnt root have name and version??) + +sub pop +{ + my ($self) = @_; + pop @$self; +} + +# returns textual representation + +sub toString +{ + my ($self) = @_; + my $ans; + foreach (@$self) + { + my ($name, $version) = @$_; + $ans .= "/" if defined $ans; + $ans .= "$version:$name"; + } + return $ans; +} + +# returns "normal" unversioned path (as string). + +sub toSimplePath +{ + my ($self) = @_; + my $ans; + foreach (@$self) + { + my ($name, $version) = @$_; + $ans .= "/" if defined $ans; + $ans .= $name; + } + return $ans; +} + +# parses textual representation + +sub fromString +{ + my ($class, $string) = @_; + bless _parse_string ($string), $class; +} + +# returns array of [name, version] pairs + +sub toArray +{ + my ($self) = @_; + return @{$self->copy}; +} + +# return 'depth' of path. root is considered depth zero, "/foo" is 1, etc. +# +# XXX TODO tests! + +sub depth +{ + my ($self) = @_; + return scalar @$self; +} + +# this returns true if self matches a PREFIX of another given VssPath. +# "matching" means that names are equal, and version numbers in self +# are GREATER THAN OR EQUAL to those in the other VssPath. +# +# examples: +# +# self other matchesPrefix? +# -------- -------- ------------------------------------------ +# 1: 1: yes +# 2: 1: yes +# 1: 2: no (version is less than other) +# 1:/1:foo 1: no (cant match prefix of shorter path) +# 1: 1:/1:foo yes (1: matches 1:) +# 2: 1:/1:foo yes (2: matches 1:) +# 1: 2:/1:foo no (1: does not match 2:) +# 1:/1:foo 1:/1:foo yes (complete match) +# 2:/2:foo 1:/1:foo yes (complete match) +# 1:/1:foo 1:/2:foo no (1:foo version less than 2:foo) + +sub matchesPrefix +{ + my ($self, $other) = @_; + + my @self_stack = @$self; + my @other_stack = @$other; + + # longer path cant match prefix of shorter path. + return 0 if $#self_stack > $#other_stack; + + for (my $i = 0; $i <= $#self_stack; $i++) + { + my ($self_name, $self_version) = @{$self_stack[$i]}; + my ($other_name, $other_version) = @{$other_stack[$i]}; + + return 0 if $self_name ne $other_name; # XXX case sensitivity? + return 0 if $self_version < $other_version; + } + + return 1; +} + +# +# INTERNAL METHODS +# + +sub _parse_string +{ + my $string = shift; + croak "bad input (trailing slash): $string" if $string =~ m|/$|; + my @pieces = split /\//, $string; + croak "bad input (no pieces?!): $string" unless @pieces; + my $ans = []; + for (@pieces) + { + croak "bad input (piece): $_ of $string" unless m|(\d+):(.*)|; + my ($version, $name) = ($1, $2); + _validate ($name, $version); + CORE::push @$ans, [$name, $version]; + } + return $ans; +} + +sub _validate +{ + my ($name, $version) = @_; + _validate_name ($name); + _validate_version ($version); +} + +sub _validate_name +{ + my $name = shift; + croak "slash ('/') in name: $name" if $name =~ m|/|; +} + +sub _validate_version +{ + my $version = shift; + croak "non-decimal version: $version" unless $version =~ m|^\d+$|; + croak "non-integer version: $version" unless $version eq int $version; + croak "non-positive version: $version" unless $version > 0; +} + +1; diff --git a/ssphys/test/t/ssrep_1.t b/ssphys/test/t/ssrep_1.t new file mode 100644 index 0000000..b903378 --- /dev/null +++ b/ssphys/test/t/ssrep_1.t @@ -0,0 +1,227 @@ +use Test::More 'no_plan'; +use strict; +use File::Temp qw(tempdir); +use VssCmd; +use Vss2Svn::VSS; + +# XXX only runs on windows (ss.exe) + +# +# XXX everything from here ... +my $temp_dir = tempdir("tmpvssXXXXXX", CLEANUP => 0); +$temp_dir = File::Spec->rel2abs($temp_dir); +my $vss_log = $temp_dir . "\\vsscmd.log"; +my $work_dir = $temp_dir . "\\vss_wc"; +my $vss_dir = $temp_dir . "\\vss_repos"; +my $vss_proj = '$/'; +my $vss_user = "admin"; +mkdir $work_dir or die "error on 'mkdir $work_dir': $!"; +my $vss = VssCmd->new (vss_dir => $vss_dir, vss_user => $vss_user, vss_log => $vss_log); +$vss->create(); +$vss->CurrentProject ($vss_proj); +$vss->WorkFold ($work_dir); + +our ($TREE, $VSS); +&Vss2Svn::VSS::Initialize; +my $vss_args = { +# interactive => 'Y', +# timebias => $gCfg{timebias}, + user => $vss_user, +# passwd => 'admin', + executable => "ssrep", + silent => 0, + _debug => 1, + }; + +$VSS = Vss2Svn::VSS->new($vss_dir, $vss_proj, $vss_args); + +# XXX ... to here, could/should be wrapped up in some kinda library subroutine. +# + +my $orig_cwd = Cwd->cwd(); +chdir $work_dir or die "chdir $work_dir: $!"; +# allow tempdir CLEANUP to work +END { chdir $orig_cwd; } + +# END OF CUTANDPASTE... + +sub diff_items +{ + my ($self, $curr_items, $prev_items) = @_; + + my @adds; + my @dels; + + # what exists in CURR but not in PREV? these were ADDED. + + foreach (keys %$curr_items) + { + push @adds, $curr_items->{$_} if not exists $prev_items->{$_}; + } + + # what exists in PREV but not in CURR? these were DELETED. + + foreach (keys %$prev_items) + { + push @dels, $prev_items->{$_} if not exists $curr_items->{$_}; + } + + # return the adds and deletes. + + return (\@adds, \@dels); +} + +sub checkListing +{ + my ($self, $curr_items, $prev_items) = @_; + +print ("curr: $curr_items\n"); +print ("prev: $prev_items\n"); + my ($add_aref, $del_aref) = diff_items ($curr_items, $prev_items); + + my @adds = @$add_aref; + my @dels = @$del_aref; + + # for ok, we want no euality of both lists (no addition, no deletion) + ok (1) if $#dels == 0 and $#adds == 0; + + if ($#adds < 0) { fail ("failed, no added item."); } + if ($#dels < 0) { fail ("failed, no deleted item."); } + if ($#adds > 0) { fail ("failed, more than one added item."); } + if ($#dels > 0) { fail ("failed, more than one deleted item."); } + + return undef; +} + +sub assert_project +{ + my ($listing, $project) = @_; + if ($listing->{$project} eq undef) { + fail ("$project not found in listing"); + } elsif (ref ($listing->{$project}) ne 'HASH') { + fail ("$project is not a project"); + } +} + +sub assert_file +{ + my ($listing, $file) = @_; + if ($listing->{$file} eq undef) { + fail ("$file not found in listing"); + } elsif ($listing->{$file} ne 1) { + fail ("$file is not a file"); + } +} + +my @sequence = ( ['add', 'test1'], + ['add', 'test2'], + ['create', 'project1'], + ['cp', 'project1'], + ['add', 'test1'], + ['add', 'test2'], + ); + +sub createFile +{ + my ($filename) = @_; + # create empty file + open(FH,">$work_dir\\$filename") or die "error creating file '$filename'"; + close FH; +} + +sub createProject +{ + my ($filename) = @_; + mkdir ("$work_dir\\$filename") or die "error creating directory '$filename'"; +} + +my $filename; + +$filename = 'test1'; +createFile ($filename); +$vss->Add($filename); + +$filename = 'test2'; +createFile ($filename); +$vss->Add($filename); + +$filename = 'project1'; +createProject ($filename); +$vss->Create($filename); + +$filename = 'project1\\test3'; +createFile ($filename); +$vss->Add($filename); + +$filename = 'project1\\test4'; +createFile ($filename); +$vss->Add($filename); + +$filename = 'project2'; +createProject ($filename); +$vss->Create($filename); + +$filename = 'project2\\test5'; +createFile ($filename); +$vss->Add($filename); + +$filename = 'project2\\test6'; +createFile ($filename); +$vss->Add($filename); + + + +my $listing; + +# directory list of tip revision +$listing = $VSS->project_tree("",0) + or fail ("dir \"\""); + +$listing = $VSS->project_tree("\$/",0) + or fail ("dir \$/"); + +$listing = $VSS->project_tree("\$/;4/project1",0) + or fail ("dir \$/;4/project1"); +ok (1, "dir"); + + +sub dumpListing +{ + my ($listing) = @_; + foreach my $key (sort keys %$listing) { + my $val = $listing->{$key}; + print ("$key => $val\n"); + } +} + +# compare specific versions +$listing = $VSS->project_tree("$/;1",0); +#checkListing ($listing, ()); +$listing = $VSS->project_tree("$/;2",0); +#checkListing ($listing, ("test1")); +$listing = $VSS->project_tree("$/;3",0); +#checkListing ($listing, ("test1", "test2")); +$listing = $VSS->project_tree("$/;4",0); +#checkListing ($listing, ("test1", "test2", "\$project1")); +assert_file ($listing, "test1"); +assert_file ($listing, "test2"); +assert_project ($listing, "project1"); + + + + +# relative directory +# VSS.pm can not handle relative directories +#$TREE = $VSS->project_tree("\$",0) +#$TREE = $VSS->project_tree(";1",0) +#$TREE = $VSS->project_tree("\$;1/",0) +#$TREE = $VSS->project_tree("\$;4/project1",0); + +# set cp to subdir +$vss->CurrentProject ("\$/project1"); +#$TREE = $VSS->project_tree("",0) +#$TREE = $VSS->project_tree(".",0) +$TREE = $VSS->project_tree("\$/",0) + or fail ("dir \$/"); + +ok (1, "dir"); diff --git a/ssphys/test/test.BAT b/ssphys/test/test.BAT new file mode 100644 index 0000000..77b4a7d --- /dev/null +++ b/ssphys/test/test.BAT @@ -0,0 +1,5 @@ +@set oldPath=%PATH% +@set PATH=%PATH%;f:\src\vss2svn\vss\test\win32 +@set PATH=%PATH%;f:\src\vss2svn\vss\test\win32;f:\src\vss2svn\ssphys\ssrep\debug +perl -Ilib test.pl +@set PATH=%oldPath% diff --git a/ssphys/test/test.pl b/ssphys/test/test.pl new file mode 100644 index 0000000..33677e3 --- /dev/null +++ b/ssphys/test/test.pl @@ -0,0 +1,10 @@ +use strict; + +use Test::Harness; + +# XXX does not work when run outside "src"! +my @tests = glob "t/*.t"; + +$Test::Harness::verbose=1; +runtests(@tests); + diff --git a/ssphys/test/test.sh b/ssphys/test/test.sh new file mode 100644 index 0000000..8cd813b --- /dev/null +++ b/ssphys/test/test.sh @@ -0,0 +1 @@ +perl -Ilib test.pl diff --git a/ssphys/utils/LeakWatcher.h b/ssphys/utils/LeakWatcher.h new file mode 100644 index 0000000..5325df0 --- /dev/null +++ b/ssphys/utils/LeakWatcher.h @@ -0,0 +1,26 @@ +//--------------------------------------------------------------------------- +// LeakWatcher.h + +#ifndef IMWATCHINGYOULEAK +#define IMWATCHINGYOULEAK + +#include + +#ifdef _DEBUG +inline void* operator new(size_t nSize, const char * lpszFileName, int nLine) +{ + return ::operator new(nSize, 1, lpszFileName, nLine); +} +#define DEBUG_NEW new(THIS_FILE, __LINE__) + +inline void operator delete(void* pMem, const char* pszFilename, int nLine) +{ + ::operator delete(pMem); +} + +#define MALLOC_DBG(x) _malloc_dbg(x, 1, THIS_FILE, __LINE__); +#define malloc(x) MALLOC_DBG(x) + +#endif // _DEBUG + +#endif // #include guard -- 2.11.4.GIT