[sword-svn] r92 - in trunk/src/Installer_BC: . bin include lib

bdrake at www.crosswire.org bdrake at www.crosswire.org
Wed Feb 6 07:23:59 MST 2008


Author: bdrake
Date: 2008-02-06 07:23:58 -0700 (Wed, 06 Feb 2008)
New Revision: 92

Added:
   trunk/src/Installer_BC/SRInstallMGR.cpp
   trunk/src/Installer_BC/SRInstaller.bdsproj
   trunk/src/Installer_BC/SRInstaller.bdsproj.local
   trunk/src/Installer_BC/SRInstaller.bpf
   trunk/src/Installer_BC/SRInstaller.res
   trunk/src/Installer_BC/bin/
   trunk/src/Installer_BC/bin/rapi.dll
   trunk/src/Installer_BC/include/
   trunk/src/Installer_BC/include/ce_setup.h
   trunk/src/Installer_BC/include/ceapimap.h
   trunk/src/Installer_BC/include/cefltmap.h
   trunk/src/Installer_BC/include/cesync.h
   trunk/src/Installer_BC/include/ceutil.h
   trunk/src/Installer_BC/include/dccole.h
   trunk/src/Installer_BC/include/dccole2.h
   trunk/src/Installer_BC/include/rapi.h
   trunk/src/Installer_BC/include/replerr.h
   trunk/src/Installer_BC/include/replfilt.h
   trunk/src/Installer_BC/lib/
   trunk/src/Installer_BC/lib/rapi_S.lib
   trunk/src/Installer_BC/utils.cpp
Log:
Re-write of SwordReader Module Manager to build under Borland C++ Builder (free edition) and also with commandline tools.  Depends on Fox widgets.  Avoids need for Visual C++ runtimes and .NET framework.

Added: trunk/src/Installer_BC/SRInstallMGR.cpp
===================================================================
--- trunk/src/Installer_BC/SRInstallMGR.cpp	                        (rev 0)
+++ trunk/src/Installer_BC/SRInstallMGR.cpp	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,603 @@
+/********************************************************************************
+*                                                                               *
+*     SwordReader Install Manager                                 *
+*                                                                               *
+*********************************************************************************
+* Copyright (C) 2008 Barry Drake.   All Rights Reserved.        *
+********************************************************************************/
+#include <windows.h>
+#include <tchar.h>
+#include <rapi.h>
+#include <dirent.h>
+#include <dir.h>
+#include "fx.h"
+
+#define UNICODE
+extern bool DeleteDirectory(const char*);
+
+WCHAR swordPath[MAX_PATH];
+HANDLE hEvent;
+
+// Main Window
+class SRInstallMGR : public FXMainWindow {
+  // Macro for class hierarchy declarations
+  FXDECLARE(SRInstallMGR)
+private:
+  FXVerticalFrame   *buttonFrame;	// Button frame
+  FXSwitcher        *switcher;
+  FXButton			*button;
+protected:
+  SRInstallMGR(){}
+public:
+  FXLabel           *captionText;
+public:
+  // Message handlers
+  long onCmdInstall(FXObject*,FXSelector,void*);
+  void BadExit (char*);
+  const char* stristr(const char*, const char*);
+  char* wstrtostr(const wchar_t*);
+  wchar_t* strtowstr(const char*);
+  void copyconfs(WCHAR*);
+  void CopyOver (WCHAR*, WCHAR*);
+  wchar_t* PrintDirectory(LPWSTR, UINT);
+  void removeModule (LPCWSTR);
+  void getModulePath (LPCWSTR, char&);
+  bool fileExists(char*);
+  void deleteCEFiles (LPCWSTR);
+
+public:
+  // Messages for our class
+  enum{
+    ID_BEGIN=FXMainWindow::ID_LAST,
+    ID_DOINSTALL,
+    ID_LAST
+    };
+
+public:
+  // SRInstallMGR's constructor
+  SRInstallMGR(FXApp* a);
+
+  // Initialize
+  virtual void create();
+
+  virtual ~SRInstallMGR();
+  };
+
+// Message Map for the SRInstallMGR class
+FXDEFMAP(SRInstallMGR) SRInstallMGRMap[]={
+  //________Message_Type_____________________ID____________Message_Handler_______
+
+  FXMAPFUNC(SEL_COMMAND, SRInstallMGR::ID_DOINSTALL, SRInstallMGR::onCmdInstall),
+  };
+
+// Macro for the SRInstallMGR class hierarchy implementation
+FXIMPLEMENT(SRInstallMGR,FXMainWindow,SRInstallMGRMap,ARRAYNUMBER(SRInstallMGRMap))
+
+// Construct a SRInstallMGR
+SRInstallMGR::SRInstallMGR(FXApp *a):FXMainWindow(a,"SR Manager",NULL,NULL,DECOR_ALL,0,0,180,250){
+  // RIGHT pane for the buttons
+  buttonFrame=new FXVerticalFrame(this,FRAME_SUNKEN|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT,0,0,0,0,10,10,10,10);
+  button = new FXButton(buttonFrame,"&Click to begin installation\n\nOnly press this if your handheld\ndevice is connected and\nActiveSync is running.\tThis will start the install process.",NULL,this,ID_DOINSTALL,FRAME_THICK|FRAME_RAISED);
+  captionText = new FXLabel(buttonFrame,"Please wait while I catalogue\nyour existing modules, and start\nInstallManager.\n\nThis may take a minute. Then\nplease close InstallManager.\n\nAfterwards, I will need a few\nminutes to transport the module\nfiles over to your mobile device.",NULL,LAYOUT_FILL_Y|JUSTIFY_CENTER_X|JUSTIFY_CENTER_Y);
+}
+
+SRInstallMGR::~SRInstallMGR(){
+  }
+
+// Create and initialize
+void SRInstallMGR::create(){
+
+  // Create the windows
+  FXMainWindow::create();
+
+  // Make the main window appear
+  show(PLACEMENT_SCREEN);
+  }
+
+BOOL IsDots(const CHAR* str) {
+   if(strcmp(str,".") && strcmp(str,"..")) return FALSE;
+   return TRUE;
+}
+
+const char* SRInstallMGR::stristr(const char *haystack, const char *needle){ // not mine - nicked this off the 'net
+if ( !*needle )
+	return haystack;
+for ( ; *haystack; ++haystack ){
+	if ( toupper(*haystack) == toupper(*needle) ){
+		const char *h, *n;
+		for ( h = haystack, n = needle; *h && *n; ++h, ++n ){
+			if ( toupper(*h) != toupper(*n) )break;
+			}
+			if ( !*n ) 
+				return haystack; //return the start of the match
+		}
+	}
+return 0;
+}
+
+char* SRInstallMGR::wstrtostr(const wchar_t *str) {  // this came out of original SwordReader code - is there a better way?
+  static char *buffer = 0;
+  if (buffer)
+	delete [] buffer;
+  int len = wcslen(str) + 1;    // how much space is needed
+  buffer = new char[len];
+  wcstombs(buffer, str,len);
+  return buffer;
+}
+
+wchar_t* SRInstallMGR::strtowstr(const char *str) {
+  static wchar_t *buffer = 0;
+  if (buffer)
+	delete [] buffer;
+  int len = strlen(str) + 1;    // how much space is needed
+  buffer = new wchar_t[len];
+  mbstowcs(buffer, str, len); // convert char to WCHAR
+  return buffer;
+}
+
+void SRInstallMGR::copyconfs(WCHAR *confName) {
+	WCHAR wszSrcFile[MAX_PATH];
+	TCHAR tszDestFile[MAX_PATH];
+	BYTE  Buffer[10000];
+	HANDLE hSrc, hDest;
+	DWORD dwNumRead, dwNumWritten;
+
+	wcscpy(wszSrcFile, swordPath);
+	wcscat(wszSrcFile, L"mods.d\\");
+	wcscat(wszSrcFile, confName);
+	strcpy(tszDestFile, "mods.d\\");
+	strcat(tszDestFile, wstrtostr(confName));
+	hSrc = CeCreateFile(wszSrcFile, GENERIC_READ, FILE_SHARE_READ,
+        NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+	if (INVALID_HANDLE_VALUE == hSrc) {
+	FXMessageBox::error(this,MBOX_OK,"Process failed","Sorry, I'm struggling to open a file on your mobile device.");
+	exit (-1);
+	}
+	hDest = CreateFile (tszDestFile, GENERIC_WRITE, FILE_SHARE_READ,
+		NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+	if (INVALID_HANDLE_VALUE == hDest) {
+	FXMessageBox::error(this,MBOX_OK,"Process failed","Sorry, I can't seem to write\n files to your PC. \n\nDo you have a mods.d directory where\n you put me?");
+	exit (-1);
+	}	
+	if (CeReadFile(hSrc, &Buffer, sizeof(Buffer), &dwNumRead, NULL)) {
+		if (!WriteFile(hDest, &Buffer, dwNumRead, &dwNumWritten, NULL)) {
+	FXMessageBox::error(this,MBOX_OK,"Process failed","Sorry, I can't seem to read the files on your mobile device.");
+	exit (-1);
+		}
+	}
+	else {
+	FXMessageBox::error(this,MBOX_OK,"Process failed","Sorry, I can't seem to read the files on your mobile device.");
+	exit (-1);
+	}
+	if (hSrc){
+		CeCloseHandle(hSrc);
+		hSrc = NULL;
+	}
+	if (hDest){
+		CloseHandle (hDest);
+		hDest = NULL;
+	}
+}
+
+WCHAR* SRInstallMGR::PrintDirectory(LPWSTR Path, UINT Indent){ // recurse through device from root
+    DWORD          foundCount;
+    LPCE_FIND_DATA findDataArray;
+    WCHAR searchPath[MAX_PATH];
+
+	wcscpy(searchPath, Path);
+	wcscat(searchPath, L"*");
+    if(!CeFindAllFiles(searchPath, FAF_ATTRIBUTES | FAF_NAME, &foundCount, &findDataArray)) {
+	FXMessageBox::error(this,MBOX_OK,"CeFindAllFiles Process Failed","Sorry, I can't seem to read the files on your mobile device.");
+	exit (-1);
+	}
+    if(!foundCount) return(NULL);
+	for(UINT i = 0; i < foundCount; i++) {
+		if(findDataArray[i].dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { // directory found
+			WCHAR newPath[MAX_PATH];
+			wcscpy(newPath, Path);
+			wcscat(newPath, findDataArray[i].cFileName);
+			wcscat(newPath, L"\\");
+			PrintDirectory(newPath, Indent + 1);
+		}		
+		else if ((stristr(wstrtostr(Path), "MODS.D"))){ // not directory - this is a file
+			const char* modstr = stristr(wstrtostr(Path), "MODS.D");
+			wcscpy(swordPath, Path);
+			int len = strlen (modstr);
+			int swlen = wcslen (swordPath);
+			while (len--) swlen--;
+			swordPath[swlen] = 0; // global swordPath now set to CE sword dir
+
+/************************************************************************
+// this refers to files on your mobile device, not your PC.
+// I don't want to do anything with files except when they are in your 
+// MODS.D directory, so 'swordPath' at this point should be your sword 
+// home directory+mods.d, so save it use return from stristr to truncate 
+// I have assumed that mods.d occurs only once!!!  There is one possible 
+// additional instance (at least) ....
+//
+// TODO
+// note: have not checked for more than one installation: it is possible 
+// for someone to have installed into several different locations - really! 
+**************************************************************************/
+			copyconfs(findDataArray[i].cFileName);
+		} // else if ((stristr(wstrtostr ......
+	} // for(UINT i = 0; ........
+	if (findDataArray)
+        RapiFreeBuffer(findDataArray);
+	return (swordPath); // swordPath is global ....... I don't like globals ...  maybe a 'new' const wchar string would be better??
+}
+
+void SRInstallMGR::CopyOver (WCHAR* sourceName, WCHAR* destName) {
+	HANDLE hSrc, hCeDest;
+	BYTE  Buffer[10000];
+	DWORD dwNumRead, dwNumWritten;
+	hSrc = CreateFile(wstrtostr(sourceName), GENERIC_READ, FILE_SHARE_READ,
+		NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+	if (INVALID_HANDLE_VALUE == hSrc) {
+
+	FXMessageBox::error(this,MBOX_OK,"Process failed","Sorry, I can't seem able to open source/host file on PC");
+	exit (-1);
+		}
+	hCeDest = CeCreateFile(destName, GENERIC_WRITE, FILE_SHARE_READ,
+		NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+	if (INVALID_HANDLE_VALUE == hCeDest ) {
+	FXMessageBox::error(this,MBOX_OK,"Process failed","Sorry, I can't seem able to open destination file file on your mobile device for writing");
+	exit (-1);
+		}
+	do {
+		if (ReadFile(hSrc, &Buffer, sizeof(Buffer), &dwNumRead, NULL)) {
+		  if (!CeWriteFile(hCeDest, &Buffer, dwNumRead, &dwNumWritten, NULL)) {
+		  FXMessageBox::error(this,MBOX_OK,"Process failed","Sorry, I can't seem able to open destination file file on your mobile device for writing");
+		  exit (-1);
+		  }
+		}
+		else {
+		FXMessageBox::error(this,MBOX_OK,"Process failed","Sorry, I can't seem able to open the source file file on your mobile device for writing");
+		exit (-1);
+		}
+	  } while (dwNumRead);
+	if (hCeDest){
+		CeCloseHandle(hCeDest);
+		hCeDest = NULL;
+	}
+	if (hSrc){
+		CloseHandle (hSrc);
+		hSrc = NULL;
+	}
+}
+
+bool SRInstallMGR::fileExists(char *thisFile) {
+	//char *thisFile = "sword.exe";
+	HANDLE isFile;
+	isFile = CreateFile((const char*)thisFile, GENERIC_READ, FILE_SHARE_READ,
+		NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+	if (INVALID_HANDLE_VALUE == isFile) {
+		CloseHandle (isFile);
+		return false;
+  }
+  CloseHandle (isFile);
+  return true;
+}
+
+
+void SRInstallMGR::getModulePath (LPCWSTR confName, char &outBuffer) {
+	// each .conf file in mods.d comes here with name
+	char longstr[10000];
+	const char *pathstr;
+	char mPath[MAX_PATH];
+	char *modulePath = mPath;
+	char thisName[MAX_PATH];
+	//BOOL isopen = FALSE;
+	HANDLE modFile;
+	DWORD BytesToRead;
+	DWORD BytesRead = 0;
+	WCHAR namstr[MAX_PATH];
+	WCHAR* name = namstr;
+	wcscpy (name, L"mods.d\\");
+	wcscat (name, confName);
+	BytesToRead = sizeof(longstr)-1;
+	wcstombs(thisName, name,MAX_PATH);
+	modFile = CreateFile(thisName,  GENERIC_READ, FILE_SHARE_READ,
+			NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+	if (INVALID_HANDLE_VALUE == modFile) {
+	FXMessageBox::error(this,MBOX_OK,"Process failed","Sorry, I can't seem to read files in your mods.d directory.  Do you have a mods.d directory where you put me?");
+		exit (-1);
+		}
+	// read the entire .conf file into our buffer - biggest I know of
+	// now is a 5k .conf, so I've gone for a 10,000 byte buffer ....
+	//isopen = ReadFile(modFile, &longstr, BytesToRead, &BytesRead, NULL);
+	ReadFile(modFile, &longstr, BytesToRead, &BytesRead, NULL);
+	// TODO we ought to check for success 'if isopen' and do something
+	if (modFile){
+		CloseHandle(modFile);
+		modFile = NULL;
+	}
+	pathstr = stristr (longstr, "DataPath=.");
+	if (!pathstr){
+	FXMessageBox::error(this,MBOX_OK,"Process failed","Failed to make string match for DataPath=.");
+	exit (-1);
+	}
+	pathstr+=10;  // move pointer to end of 'DataPath=.'
+	strcpy (modulePath, "");// this will need to be the swordPath
+	int i = 0;
+	int p = (strlen(modulePath));
+	p--;
+	while (*(pathstr+i) != 10 && *(pathstr+i) != 13) { // some confs have cr/lf and some only lf (why?)
+		*(modulePath+p++) = *(pathstr+i);
+		i++;
+	}
+		--p;  // if we don't want trailing slash
+	*(modulePath+p) = 0; // at end of trailing slash in pathstring
+	// TODO - lexdicts are handled differently in pathing 
+	char *tmp = modulePath;
+	while (*(tmp++))if (*tmp == 47) *tmp = 92; // change '/' into '\'
+	tmp = &outBuffer;
+	strcpy (tmp, modulePath);
+}
+
+void SRInstallMGR::deleteCEFiles (LPCWSTR CEPath) { // delete all files in mobile device directory then delete directory
+	WCHAR ThisFile[MAX_PATH];
+	DWORD foundCount;
+    LPCE_FIND_DATA findDataArray;
+
+	wcscpy(ThisFile, CEPath);
+	wcscat(ThisFile, L"*");
+	if(!CeFindAllFiles(ThisFile, FAF_ATTRIBUTES | FAF_NAME, &foundCount, &findDataArray)) {
+	//	_tprintf( TEXT("*** CeFindAllFiles failed. ***\n"));
+		return;
+// TODO needs error MessageBox here and bomb out 
+	}
+    if(!foundCount) return;
+// TODO needs error MessageBox here and bomb out
+	WCHAR newPath[MAX_PATH];
+    for(UINT i = 0; i < foundCount; i++) {
+			wcscpy(newPath, CEPath);
+			wcscat(newPath, findDataArray[i].cFileName);
+			CeDeleteFile(newPath);
+	} // for(UINT i = 0; i </
+	// now delete the directory
+	CeRemoveDirectory(CEPath);
+}
+
+void SRInstallMGR::removeModule (LPCWSTR moduleConf) { // come here with name of .conf file
+	char mPath[MAX_PATH];
+	WCHAR ThisFile[MAX_PATH];
+	//WCHAR WmPath[MAX_PATH];
+	copyconfs ((wchar_t*)moduleConf); // get the .conf file from the mobile
+	getModulePath (moduleConf, *mPath); // read the module files path
+	//mbstowcs( WmPath, mPath, strlen(mPath)+1); // convert char to WCHAR
+	wcscpy (ThisFile, swordPath) ;
+	wcscat (ThisFile, strtowstr(mPath));
+	wcscat (ThisFile, L"\\");
+	deleteCEFiles (ThisFile); // delete all the module files and directory
+	wcscpy (ThisFile, swordPath) ;
+	wcscat (ThisFile, L"mods.d\\");
+	wcscat (ThisFile, moduleConf) ;
+	CeDeleteFile(ThisFile); // now delete the .conf file
+}
+
+// Handle the install message
+long SRInstallMGR::onCmdInstall(FXObject*,FXSelector,void*){
+	char swPath[MAX_PATH];
+	HANDLE hFile=NULL;                       // Handle to directory
+	HANDLE modDir=NULL;
+	WIN32_FIND_DATA FileInformation;    // File information
+	WIN32_FIND_DATA modFileInformation;    // File information
+	char mPath[MAX_PATH];
+	char m2Path[MAX_PATH];
+	WCHAR wszSrcFile[MAX_PATH];
+	WCHAR tszCEDestFile[MAX_PATH];
+	WCHAR* oldConfs[1000];  // array of pointers to oldConf files before Install Manager
+	WCHAR* newConfs[1000];  // array of pointers to Conf files after Install Manager session
+	if (fileExists("Sword.exe")) {
+	FXMessageBox::error(this,MBOX_OK,"Process failed","I'm shutting down because there is a copy of sword.exe in this directory.  You must NOT run this installer in your Sword directory.");
+	exit (-1);
+		}
+	RAPIINIT ri = { sizeof(RAPIINIT) };
+	if ( SUCCEEDED(CeRapiInitEx(&ri))) {
+	// wait for 10 seconds for the connection...
+	if ( (WaitForSingleObject(ri.heRapiInit, 10000) == WAIT_OBJECT_0) &&
+		SUCCEEDED(ri.hrRapiInit) ) {
+		// CreateDirectory does not have a problem if the directory
+		// named exists already
+		SECURITY_ATTRIBUTES sa;
+		SECURITY_DESCRIPTOR sd;
+		InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION);
+		SetSecurityDescriptorDacl(&sd,TRUE,NULL,FALSE);
+		SetSecurityDescriptorGroup(&sd,NULL, FALSE );
+		SetSecurityDescriptorSacl(&sd, FALSE, NULL, FALSE );
+		sa.nLength = sizeof(SECURITY_ATTRIBUTES);
+		sa.lpSecurityDescriptor = &sd;
+		sa.bInheritHandle = TRUE;
+		CreateDirectory( "mods.d", &sa );
+		CreateDirectory( "modules", &sa );
+		WCHAR* swordPath = PrintDirectory( L"\\", 0);
+		if (*swordPath != NULL)
+		// we now should have TCHAR *swordPath and char *swordPathString 
+		// both holding the full sword path from the mobile device
+		// and the mods.d directory on the pc is now containing copies 
+		// of all the mods.d files that are on the mobile device
+		// *plus* we definitely have a mods.d and modules directory as 
+		// these are not checked for by InstallManager (It bombs out!).
+		// now put all the mods.d names into an array
+		hFile = FindFirstFile(TEXT("mods.d\\*.conf"), &FileInformation);
+		if(hFile == INVALID_HANDLE_VALUE) {
+		FXMessageBox::error(this,MBOX_OK,"Process failed","Sorry, I can't seem to open the files in local mods.d directory");
+		exit (-1);
+				}
+		// START this pass storing .conf file names *ok* (see second pass) 
+	int n=0;
+		do {
+	// store the conf names (LPCWSTR FileInformation.cFileName) in an array
+	int len = wcslen (strtowstr (FileInformation.cFileName))+1;
+	WCHAR *newSpace = new WCHAR[len]; // allocate with new
+// copy to new space
+	wcscpy (newSpace, strtowstr(FileInformation.cFileName));
+	oldConfs[n] = newSpace;            // save pointer
+	n++;  // TODO don't forget to delete new items later
+		}while(FindNextFile(hFile, &FileInformation) == TRUE);
+	oldConfs[n] = 0;
+		if (hFile){
+			FindClose(hFile);
+			hFile = NULL;
+		}
+		// END this pass - *ok* (see second pass)
+		STARTUPINFO si;
+		PROCESS_INFORMATION pi;
+		ZeroMemory( &si, sizeof(si) );
+		si.cb = sizeof(si);
+		ZeroMemory( &pi, sizeof(pi) );
+		// Start the child process - InstallManager.
+		if( !CreateProcess( TEXT("InstallManager.exe"), TEXT(\
+"Install Manager.exe"), // Command line.
+			NULL, NULL, FALSE,	0, NULL, NULL, &si, &pi )) {
+		FXMessageBox::error(this,MBOX_OK,"Process failed","Sorry, I could not activate\n InstallManager.");
+		exit (-1);
+			}
+		// Wait until InstallManager exits.
+		WaitForSingleObject( pi.hProcess, INFINITE );
+		// Close process and thread handles.
+		CloseHandle( pi.hProcess );
+		CloseHandle( pi.hThread );
+		n=0;
+		hFile = FindFirstFile(TEXT("mods.d\\*.conf"), &FileInformation);
+		if(hFile != INVALID_HANDLE_VALUE)
+		{
+		do { // each .conf file in mods.d comes here with name etc
+		// START this pass storing .conf file name
+
+			char mPath[MAX_PATH];
+			strcpy (mPath, FileInformation.cFileName);
+			int len = strlen(mPath) + 1;    // how much space is needed
+			WCHAR *newSpace = new WCHAR[len]; // allocate with new
+			mbstowcs( newSpace, mPath, strlen(mPath)+1); // convert char to WCHAR
+			newConfs[n] = newSpace;            // save pointer
+			n++; // TODO don't forget to delete new items later
+			// END this pass -  *NOT ok* (see first pass)
+			getModulePath (newSpace, *mPath);
+			DIR *mods = opendir(mPath);
+			if(mods){   
+				closedir(mods);
+				mods = NULL;
+				// if there is no directory under 'modules\thismodulepath' skip this
+				strcat (mPath, "\\*");
+				int len = strlen(mPath)+1;
+				wchar_t *wText = new wchar_t[len];
+				wcscpy (wText, strtowstr(mPath));
+				modDir = FindFirstFile(mPath, &modFileInformation);
+				if(modDir == INVALID_HANDLE_VALUE){
+				FXMessageBox::error(this,MBOX_OK,"Process Failed","Sorry, I can't seem to read files\nfrom your newly downloaded module.");
+				exit (-1);
+				}
+					len = wcslen (wText);
+					len --;
+					*(wText+len) = 0;
+					len = strlen(mPath);
+					*(mPath +len - 1) = 0;
+					 do { // copy each of module files onto mobile device followed by .conf
+						// create the path on the mobile device here
+						wcscpy (tszCEDestFile, swordPath);
+						wcscat (tszCEDestFile, wText);  // full path to create
+						CeCreateDirectory(tszCEDestFile, 0);
+						// TODO - should do a check for creation here 
+						// file copy will fail else
+						wcscpy(wszSrcFile, wText);
+						wcscat(wszSrcFile, strtowstr(modFileInformation.cFileName));
+						char destMP[MAX_PATH];
+						char *destModPath = destMP;
+						strcpy (destModPath, wstrtostr(swordPath));
+						strcat (destModPath, mPath);
+						wcscpy( tszCEDestFile, strtowstr(destModPath));
+						wcscat( tszCEDestFile, strtowstr(modFileInformation.cFileName));
+						if(!(modFileInformation.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { // directory found
+						CopyOver (wszSrcFile, tszCEDestFile);
+						} // if(!(modFileInformation.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY
+					 }while(FindNextFile(modDir, &modFileInformation) == TRUE);
+				if (modDir){
+					FindClose (modDir);
+					modDir = NULL;
+				}
+				// now copy over the module .conf file
+				wcscpy (tszCEDestFile, swordPath);
+				wcscat (tszCEDestFile, strtowstr("mods.d\\"));
+				wcscat (tszCEDestFile, strtowstr(FileInformation.cFileName));
+				wcscpy (wszSrcFile, strtowstr("mods.d\\"));
+				wcscat (wszSrcFile, strtowstr(FileInformation.cFileName));
+				CopyOver (wszSrcFile, tszCEDestFile);
+
+			} // if (Directory::Exists - this was changed to 'if (mods); //delete ptr;
+			if (mods)  {
+				closedir(mods);
+				mods = NULL; }
+		  }while(FindNextFile(hFile, &FileInformation) == TRUE);
+		newConfs[n] = 0;
+		}
+// removeModule (TEXT("phillips.conf")); // for debug
+		int Old = 0;
+		int New = 0;
+		do {  // loop through all .conf files.  If one is missing from
+				// the start, the user wants to delete this module
+			bool moduleDeleted = TRUE;
+			while (newConfs[New]){ // for each Old module
+				if (!wcscmp (oldConfs[Old], newConfs[New++])) {
+					moduleDeleted = FALSE; // this one is still there
+				}
+			}  
+			if (moduleDeleted) { // this one is missing after Install MGR
+				removeModule (oldConfs[Old]); // so delete from mobile
+			}
+			New = 0;
+		} while (oldConfs[++Old]); // keep going till all have been checked
+		if (modDir){            // TODO locks up if I try to close ....
+			FindClose (modDir);
+			modDir = NULL;
+		} 	// Close handles
+		if (hFile){
+			FindClose(hFile);
+			hFile = NULL;
+		}
+		CeRapiUninit();
+		// TODO delete the two Conf arrays
+		// now remove all the files from the pc
+		//killFiles("mods.d");
+		//RemoveDirectory("mods.d");
+		//killFiles("modules");
+		//killFiles("modules"); // to remove empty directories
+		// RemoveDirectory("modules");
+		//return (swordPathString);
+		} // if ( (WaitForSingleObject(ri.heRapiInit .....
+	else {
+		FXMessageBox::error(this,MBOX_OK,"CeRapiInit failed","Sorry, I could not connect to your mobile device");
+		CeRapiUninit();
+		exit (-1);
+ //		Application::Exit();
+
+		}
+     if ( CeRapiInit() != E_FAIL ) {
+		}
+	else {
+		FXMessageBox::error(this,MBOX_OK,"CeRapiInit failed","Sorry, I could not connect to your mobile device");
+		CeRapiUninit();
+		exit (-1);
+		}
+	} // if ( SUCCEEDED(CeRapiInitEx
+ exit (0);
+ return 0; // to avoid the warning ....
+}
+
+// Here we begin
+int main(int argc,char *argv[]){
+  DeleteDirectory("mods.d");
+  DeleteDirectory("modules");
+  // Make application
+  FXApp application("SRInstallMGR","FoxVersion");
+  // Start app
+  application.init(argc,argv);
+  // SRInstallMGR window
+  new SRInstallMGR(&application);
+  // Create the application's windows
+  application.create();
+  // Run the application
+  return application.run();
+ }
+

Added: trunk/src/Installer_BC/SRInstaller.bdsproj
===================================================================
--- trunk/src/Installer_BC/SRInstaller.bdsproj	                        (rev 0)
+++ trunk/src/Installer_BC/SRInstaller.bdsproj	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,296 @@
+<?xml version="1.0" encoding="utf-8"?>
+<BorlandProject>
+	<PersonalityInfo>
+		<Option>
+			<Option Name="Personality">CPlusPlusBuilder.Personality</Option>
+			<Option Name="ProjectType">CppConsoleApplication</Option>
+			<Option Name="Version">1.0</Option>
+			<Option Name="GUID">{16DCE1E3-CDDF-4FD1-B616-7A30730615DD}</Option>
+		</Option>
+	</PersonalityInfo>
+	<CPlusPlusBuilder.Personality>
+		<Source>
+			<Source Name="MainSource">SRInstaller.bpf</Source>
+		</Source>
+		<BCBPROJECT>
+      <project version="10.0">
+        <property category="build.config" name="active" value="1"/>
+        <property category="build.config" name="count" value="1"/>
+        <property category="build.config" name="excludedefaultforzero" value="0"/>
+        <property category="build.config.0" name="builddir" value="Debug"/>
+        <property category="build.config.0" name="key" value="Debug_Build"/>
+        <property category="build.config.0" name="name" value="Debug Build"/>
+        <property category="build.config.0" name="settings.win32b" value="default"/>
+        <property category="build.config.0" name="type" value="Toolset"/>
+        <property category="build.config.0" name="win32.win32b.builddir" value="Debug_Build"/>
+        <property category="build.config.1" name="key" value="Release_Build"/>
+        <property category="build.config.1" name="name" value="Release Build"/>
+        <property category="build.config.1" name="settings.win32b" value="default"/>
+        <property category="build.config.1" name="type" value="Toolset"/>
+        <property category="build.config.1" name="win32.win32b.builddir" value="Release_Build"/>
+        <property category="build.node" name="name" value="SRInstaller.exe"/>
+        <property category="build.node" name="packages" value="vclx;vcl;rtl;dbrtl;vcldb;dbxcds;dbexpress;xmlrtl;vclie;inet;inetdbbde;inetdbxpress;soaprtl;dsnap;adortl;bdertl;vcldbx"/>
+        <property category="build.node" name="use_packages" value="0"/>
+        <property category="build.platform" name="active" value="win32"/>
+        <property category="build.platform" name="win32.Debug_Build.toolset" value="win32b"/>
+        <property category="build.platform" name="win32.Release_Build.toolset" value="win32b"/>
+        <property category="build.platform" name="win32.default" value="win32b"/>
+        <property category="build.platform" name="win32.enabled" value="1"/>
+        <property category="build.platform" name="win32.win32b.enabled" value="1"/>
+        <property category="win32.*.win32b.dcc32" name="param.filenames.merge" value="1"/>
+        <property category="win32.*.win32b.tasm32" name="param.listfile.merge" value="1"/>
+        <property category="win32.*.win32b.tasm32" name="param.objfile.merge" value="1"/>
+        <property category="win32.*.win32b.tasm32" name="param.xreffile.merge" value="1"/>
+        <property category="win32.Debug_Build.win32b.bcc32" name="container.SelectedOptimizations.containerenabled" value="0"/>
+        <property category="win32.Debug_Build.win32b.bcc32" name="container.SelectedWarnings.containerenabled" value="1"/>
+        <property category="win32.Debug_Build.win32b.bcc32" name="option.D.arg.1" value="_DEBUG"/>
+        <property category="win32.Debug_Build.win32b.bcc32" name="option.D.arg.merge" value="1"/>
+        <property category="win32.Debug_Build.win32b.bcc32" name="option.D.enabled" value="1"/>
+        <property category="win32.Debug_Build.win32b.bcc32" name="option.Od.enabled" value="1"/>
+        <property category="win32.Debug_Build.win32b.bcc32" name="option.disablewarns.enabled" value="0"/>
+        <property category="win32.Debug_Build.win32b.bcc32" name="option.k.enabled" value="1"/>
+        <property category="win32.Debug_Build.win32b.bcc32" name="option.r.enabled" value="0"/>
+        <property category="win32.Debug_Build.win32b.bcc32" name="option.v.enabled" value="1"/>
+        <property category="win32.Debug_Build.win32b.bcc32" name="option.vi.enabled" value="0"/>
+        <property category="win32.Debug_Build.win32b.bcc32" name="option.w.enabled" value="0"/>
+        <property category="win32.Debug_Build.win32b.bcc32" name="option.y.enabled" value="1"/>
+        <property category="win32.Debug_Build.win32b.dcc32" name="option.$D.enabled" value="1"/>
+        <property category="win32.Debug_Build.win32b.dcc32" name="option.$O.enabled" value="0"/>
+        <property category="win32.Debug_Build.win32b.dcc32" name="option.D.arg.1" value="DEBUG"/>
+        <property category="win32.Debug_Build.win32b.dcc32" name="option.D.arg.merge" value="1"/>
+        <property category="win32.Debug_Build.win32b.dcc32" name="option.D.enabled" value="1"/>
+        <property category="win32.Debug_Build.win32b.dcc32" name="option.V.enabled" value="1"/>
+        <property category="win32.Debug_Build.win32b.ilink32" name="option.L.arg.1" value="$(BDS)\lib\debug"/>
+        <property category="win32.Debug_Build.win32b.ilink32" name="option.L.arg.merge" value="1"/>
+        <property category="win32.Debug_Build.win32b.ilink32" name="option.L.enabled" value="1"/>
+        <property category="win32.Debug_Build.win32b.tasm32" name="option.z.enabled" value="1"/>
+        <property category="win32.Debug_Build.win32b.tasm32" name="option.zd.enabled" value="0"/>
+        <property category="win32.Debug_Build.win32b.tasm32" name="option.zi.enabled" value="1"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="container.SelectedOptimizations.containerenabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="container.SelectedWarnings.containerenabled" value="1"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.4.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.5.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.6.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.A.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.AK.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.AU.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.D.arg.1" value="NDEBUG"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.D.arg.merge" value="1"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.D.enabled" value="1"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.Jgi.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.Jgx.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.O1.enabled" value="1"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.V0.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.V1.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.Vmd.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.Vmm.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.Vms.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.align-1.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.align-2.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.align-3.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.align-5.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.disablewarns.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.k.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.noregistervars.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.p.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.pm.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.pr.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.ps.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.r.enabled" value="1"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.rd.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.vi.enabled" value="1"/>
+        <property category="win32.Release_Build.win32b.bcc32" name="option.w.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.dcc32" name="option.$D.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.dcc32" name="option.$O.enabled" value="1"/>
+        <property category="win32.Release_Build.win32b.dcc32" name="option.V.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.ilink32" name="container.SelectedWarnings.containerenabled" value="1"/>
+        <property category="win32.Release_Build.win32b.ilink32" name="option.L.arg.1" value="$(BDS)\lib\release"/>
+        <property category="win32.Release_Build.win32b.ilink32" name="option.L.arg.merge" value="1"/>
+        <property category="win32.Release_Build.win32b.ilink32" name="option.L.enabled" value="1"/>
+        <property category="win32.Release_Build.win32b.ilink32" name="option.m.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.ilink32" name="option.map_segments.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.ilink32" name="option.s.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.tasm32" name="option.z.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.tasm32" name="option.zd.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.tasm32" name="option.zi.enabled" value="0"/>
+        <property category="win32.Release_Build.win32b.tasm32" name="option.zn.enabled" value="1"/>
+        <optionset name="all_configurations">
+          <property category="node" name="displayname" value="All Configurations"/>
+          <property category="win32.*.win32b.bcc32" name="container.SelectedOptimizations.containerenabled" value="1"/>
+          <property category="win32.*.win32b.bcc32" name="option.D.arg.1" value="-DNDEBUG -DFOX_BIGENDIAN=0 -DWIN32 -D_WINDOWS"/>
+          <property category="win32.*.win32b.bcc32" name="option.D.arg.merge" value="1"/>
+          <property category="win32.*.win32b.bcc32" name="option.D.enabled" value="1"/>
+          <property category="win32.*.win32b.bcc32" name="option.H=.arg.1" value="$(BDS)\lib\vcl100.csm"/>
+          <property category="win32.*.win32b.bcc32" name="option.H=.arg.merge" value="1"/>
+          <property category="win32.*.win32b.bcc32" name="option.H=.enabled" value="1"/>
+          <property category="win32.*.win32b.bcc32" name="option.Hc.enabled" value="1"/>
+          <property category="win32.*.win32b.bcc32" name="option.I.arg.1" value="C:\Prog\swordreader\src\Installer - Borland+Fox"/>
+          <property category="win32.*.win32b.bcc32" name="option.I.arg.2" value="$(BDS)\include"/>
+          <property category="win32.*.win32b.bcc32" name="option.I.arg.3" value="..\..\..\fox-1.6.31\include"/>
+          <property category="win32.*.win32b.bcc32" name="option.I.arg.4" value="$(BDS)\include\dinkumware"/>
+          <property category="win32.*.win32b.bcc32" name="option.I.arg.5" value="$(BDS)\include\vcl"/>
+          <property category="win32.*.win32b.bcc32" name="option.I.arg.merge" value="1"/>
+          <property category="win32.*.win32b.bcc32" name="option.I.enabled" value="1"/>
+          <property category="win32.*.win32b.bcc32" name="option.O1.enabled" value="0"/>
+          <property category="win32.*.win32b.bcc32" name="option.O2.enabled" value="0"/>
+          <property category="win32.*.win32b.bcc32" name="option.Od.enabled" value="0"/>
+          <property category="win32.*.win32b.bcc32" name="option.Ve.enabled" value="0"/>
+          <property category="win32.*.win32b.bcc32" name="option.b.enabled" value="0"/>
+          <property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.1" value="_RTLDLL"/>
+          <property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.2" value="NO_STRICT"/>
+          <property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.3" value="_NO_VCL"/>
+          <property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.merge" value="1"/>
+          <property category="win32.*.win32b.bcc32" name="option.sysdefines.enabled" value="1"/>
+          <property category="win32.*.win32b.bcc32" name="option.tW.enabled" value="0"/>
+          <property category="win32.*.win32b.bcc32" name="option.tWC.enabled" value="1"/>
+          <property category="win32.*.win32b.bcc32" name="option.tWD.enabled" value="0"/>
+          <property category="win32.*.win32b.bcc32" name="option.tWM.enabled" value="0"/>
+          <property category="win32.*.win32b.dcc32" name="option.I.arg.1" value="C:\Prog\swordreader\src\Installer - Borland+Fox"/>
+          <property category="win32.*.win32b.dcc32" name="option.I.arg.merge" value="1"/>
+          <property category="win32.*.win32b.dcc32" name="option.I.enabled" value="0"/>
+          <property category="win32.*.win32b.dcc32" name="option.O.arg.1" value="C:\Prog\swordreader\src\Installer - Borland+Fox"/>
+          <property category="win32.*.win32b.dcc32" name="option.O.arg.merge" value="1"/>
+          <property category="win32.*.win32b.dcc32" name="option.O.enabled" value="0"/>
+          <property category="win32.*.win32b.dcc32" name="option.R.arg.1" value="C:\Prog\swordreader\src\Installer - Borland+Fox"/>
+          <property category="win32.*.win32b.dcc32" name="option.R.arg.merge" value="1"/>
+          <property category="win32.*.win32b.dcc32" name="option.R.enabled" value="0"/>
+          <property category="win32.*.win32b.dcc32" name="option.U.arg.1" value="C:\Prog\swordreader\src\Installer - Borland+Fox"/>
+          <property category="win32.*.win32b.dcc32" name="option.U.arg.2" value="C:\Documents and Settings\q\My Documents\Borland Studio Projects"/>
+          <property category="win32.*.win32b.dcc32" name="option.U.arg.3" value="$(BDS)\lib"/>
+          <property category="win32.*.win32b.dcc32" name="option.U.arg.4" value="$(BDS)\lib\obj"/>
+          <property category="win32.*.win32b.dcc32" name="option.U.arg.merge" value="1"/>
+          <property category="win32.*.win32b.dcc32" name="option.U.enabled" value="1"/>
+          <property category="win32.*.win32b.dcc32" name="param.filenames.merge" value="1"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.1" value="C:\Prog\swordreader\src\Installer"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.10" value="C:\Prog\swordreader\src\Installer"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.11" value="-"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.12" value="Borland+Fox"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.13" value="C:\Prog\swordreader\src\Installer"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.14" value="-"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.15" value="Borland+Fox"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.16" value="C:\Prog\swordreader\src\Installer"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.17" value="-"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.18" value="Borland+Fox"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.19" value="C:\Prog\swordreader\src\Installer"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.2" value="-"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.20" value="-"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.21" value="Borland+Fox"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.22" value="C:\Prog\swordreader\src\Installer"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.23" value="-"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.24" value="Borland+Fox"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.25" value="C:\Prog\swordreader\src\Installer"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.26" value="-"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.27" value="Borland+Fox"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.3" value="Borland+Fox"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.4" value="C:\Prog\swordreader\src\Installer"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.5" value="-"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.6" value="Borland+Fox"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.7" value="C:\Prog\swordreader\src\Installer"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.8" value="-"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.9" value="Borland+Fox"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.arg.merge" value="1"/>
+          <property category="win32.*.win32b.idl2cpp" name="option.I.enabled" value="1"/>
+          <property category="win32.*.win32b.ilink32" name="container.SelectedWarnings.containerenabled" value="1"/>
+          <property category="win32.*.win32b.ilink32" name="option.-w-.enabled" value="0"/>
+          <property category="win32.*.win32b.ilink32" name="option.Gi.enabled" value="0"/>
+          <property category="win32.*.win32b.ilink32" name="option.Gpd.enabled" value="0"/>
+          <property category="win32.*.win32b.ilink32" name="option.Gpr.enabled" value="0"/>
+          <property category="win32.*.win32b.ilink32" name="option.L.arg.1" value="C:\Prog\swordreader\src\Installer - Borland+Fox"/>
+          <property category="win32.*.win32b.ilink32" name="option.L.arg.2" value="$(BDS)\lib"/>
+          <property category="win32.*.win32b.ilink32" name="option.L.arg.3" value="$(BDS)\lib\obj"/>
+          <property category="win32.*.win32b.ilink32" name="option.L.arg.4" value="$(BDS)\lib\psdk"/>
+          <property category="win32.*.win32b.ilink32" name="option.L.arg.merge" value="1"/>
+          <property category="win32.*.win32b.ilink32" name="option.L.enabled" value="1"/>
+          <property category="win32.*.win32b.ilink32" name="option.Tpd.enabled" value="0"/>
+          <property category="win32.*.win32b.ilink32" name="option.Tpe.enabled" value="1"/>
+          <property category="win32.*.win32b.ilink32" name="option.Tpp.enabled" value="0"/>
+          <property category="win32.*.win32b.ilink32" name="option.aa.enabled" value="1"/>
+          <property category="win32.*.win32b.ilink32" name="option.ap.enabled" value="0"/>
+          <property category="win32.*.win32b.ilink32" name="option.dynamicrtl.enabled" value="1"/>
+          <property category="win32.*.win32b.ilink32" name="option.j.arg.1" value="C:\Prog\swordreader\src\Installer - Borland+Fox"/>
+          <property category="win32.*.win32b.ilink32" name="option.j.arg.merge" value="1"/>
+          <property category="win32.*.win32b.ilink32" name="option.j.enabled" value="0"/>
+          <property category="win32.*.win32b.ilink32" name="option.w.enabled" value="0"/>
+          <property category="win32.*.win32b.ilink32" name="param.libfiles.1" value="import32.lib"/>
+          <property category="win32.*.win32b.ilink32" name="param.libfiles.2" value="cw32i.lib"/>
+          <property category="win32.*.win32b.ilink32" name="param.libfiles.merge" value="1"/>
+          <property category="win32.*.win32b.ilink32" name="param.objfiles.1" value="c0x32.obj"/>
+          <property category="win32.*.win32b.ilink32" name="param.objfiles.2" value="$(PACKAGES)"/>
+          <property category="win32.*.win32b.ilink32" name="param.objfiles.merge" value="1"/>
+        </optionset>
+      </project>
+      <FILELIST>
+        <FILE FILENAME="SRInstaller.bpf" CONTAINERID="BPF" LOCALCOMMAND="" UNITNAME="SRInstaller" FORMNAME="" DESIGNCLASS=""/>
+        <FILE FILENAME="SRInstaller.res" CONTAINERID="ResTool" LOCALCOMMAND="" UNITNAME="SRInstaller.res" FORMNAME="" DESIGNCLASS=""/>
+        <FILE FILENAME="SRInstallMGR.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="SRInstallMGR" FORMNAME="" DESIGNCLASS=""/>
+        <FILE FILENAME="utils.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="utils" FORMNAME="" DESIGNCLASS=""/>
+        <FILE FILENAME="..\..\..\fox-1.6.31\src\FOX-1.6.lib" CONTAINERID="LibTool" LOCALCOMMAND="" UNITNAME="FOX-1.6" FORMNAME="" DESIGNCLASS=""/>
+        <FILE FILENAME="C:\Program Files\Borland\BDS\4.0\lib\rapi.lib" CONTAINERID="LibTool" LOCALCOMMAND="" UNITNAME="rapi" FORMNAME="" DESIGNCLASS=""/>
+      </FILELIST>
+      <IDEOPTIONS>
+        <VersionInfo>
+          <VersionInfo Name="IncludeVerInfo">False</VersionInfo>
+          <VersionInfo Name="AutoIncBuild">False</VersionInfo>
+          <VersionInfo Name="MajorVer">1</VersionInfo>
+          <VersionInfo Name="MinorVer">0</VersionInfo>
+          <VersionInfo Name="Release">0</VersionInfo>
+          <VersionInfo Name="Build">0</VersionInfo>
+          <VersionInfo Name="Debug">False</VersionInfo>
+          <VersionInfo Name="PreRelease">False</VersionInfo>
+          <VersionInfo Name="Special">False</VersionInfo>
+          <VersionInfo Name="Private">False</VersionInfo>
+          <VersionInfo Name="DLL">False</VersionInfo>
+          <VersionInfo Name="Locale">2057</VersionInfo>
+          <VersionInfo Name="CodePage">1252</VersionInfo>
+        </VersionInfo>
+        <VersionInfoKeys>
+          <VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
+          <VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
+          <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+          <VersionInfoKeys Name="InternalName"></VersionInfoKeys>
+          <VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
+          <VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
+          <VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
+          <VersionInfoKeys Name="ProductName"></VersionInfoKeys>
+          <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+          <VersionInfoKeys Name="Comments"></VersionInfoKeys>
+        </VersionInfoKeys>
+        <Debugging>
+          <Debugging Name="DebugSourceDirs"></Debugging>
+        </Debugging>
+        <Parameters>
+          <Parameters Name="RunParams"></Parameters>
+          <Parameters Name="Launcher"></Parameters>
+          <Parameters Name="UseLauncher">False</Parameters>
+          <Parameters Name="DebugCWD"></Parameters>
+          <Parameters Name="HostApplication"></Parameters>
+          <Parameters Name="RemoteHost"></Parameters>
+          <Parameters Name="RemotePath"></Parameters>
+          <Parameters Name="RemoteParams"></Parameters>
+          <Parameters Name="RemoteLauncher"></Parameters>
+          <Parameters Name="UseRemoteLauncher">False</Parameters>
+          <Parameters Name="RemoteCWD"></Parameters>
+          <Parameters Name="RemoteDebug">False</Parameters>
+          <Parameters Name="Debug Symbols Search Path"></Parameters>
+          <Parameters Name="LoadAllSymbols">True</Parameters>
+          <Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
+        </Parameters>
+        <Excluded_Packages>
+          <Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclib100.bpl">Borland InterBase Express Components</Excluded_Packages>
+          <Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclIntraweb_80_100.bpl">Intraweb 8.0 Design Package for Borland Development Studio 2006</Excluded_Packages>
+          <Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclindy100.bpl">Internet Direct Version 9 (Indy) Property and Component Editors</Excluded_Packages>
+          <Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\bcbofficexp100.bpl">Borland C++Builder Office XP Servers Package</Excluded_Packages>
+          <Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclbcbsmp100.bpl">Borland Sample Controls Design Time Package</Excluded_Packages>
+          <Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\bcbie100.bpl">Borland C++Builder Internet Explorer 5 Components Package</Excluded_Packages>
+          <Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dcltee100.bpl">TeeChart Components</Excluded_Packages>
+        </Excluded_Packages>
+        <Linker>
+          <Linker Name="LibPrefix"></Linker>
+          <Linker Name="LibSuffix"></Linker>
+          <Linker Name="LibVersion"></Linker>
+        </Linker>
+      </IDEOPTIONS>
+    </BCBPROJECT>
+		<buildevents/>
+	</CPlusPlusBuilder.Personality>
+</BorlandProject>

Added: trunk/src/Installer_BC/SRInstaller.bdsproj.local
===================================================================
--- trunk/src/Installer_BC/SRInstaller.bdsproj.local	                        (rev 0)
+++ trunk/src/Installer_BC/SRInstaller.bdsproj.local	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<BorlandProject>
+	<Transactions>
+    <Transaction>2008/01/29 14:16:33.500.bdsproj,C:\Documents and Settings\q\My Documents\Borland Studio Projects\Project1.bdsproj=C:\Prog\swordreader\src\Installer - Borland+Fox\W_SRInstaller.bdsproj</Transaction>
+    <Transaction>2008/01/29 22:20:43.812.bdsproj,C:\Prog\swordreader\src\Installer - Borland+Fox\W_SRInstaller.bdsproj=C:\Prog\swordreader\src\Installer - Borland+Fox\SRInstaller.bdsproj</Transaction>
+    <Transaction>2008/01/31 15:30:42.875.cpp,C:\Prog\swordreader\src\Installer - Borland+Fox\doInstall.cpp=</Transaction>
+    <Transaction>2008/02/05 21:47:08.734.cpp,C:\Prog\swordreader\src\InstallerBC\deldir.cpp=</Transaction>
+    <Transaction>2008/02/06 12:23:10.984.cpp,C:\Prog\swordreader\src\InstallerBC\utils.cpp=</Transaction>
+  </Transactions>
+</BorlandProject>

Added: trunk/src/Installer_BC/SRInstaller.bpf
===================================================================
--- trunk/src/Installer_BC/SRInstaller.bpf	                        (rev 0)
+++ trunk/src/Installer_BC/SRInstaller.bpf	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,5 @@
+This file is used by the project manager only and should be treated like the project file
+
+To add a file to this project use the Project menu 'Add to Project'
+
+WinMain
\ No newline at end of file

Added: trunk/src/Installer_BC/SRInstaller.res
===================================================================
(Binary files differ)


Property changes on: trunk/src/Installer_BC/SRInstaller.res
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/Installer_BC/bin/rapi.dll
===================================================================
(Binary files differ)


Property changes on: trunk/src/Installer_BC/bin/rapi.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/Installer_BC/include/ce_setup.h
===================================================================
--- trunk/src/Installer_BC/include/ce_setup.h	                        (rev 0)
+++ trunk/src/Installer_BC/include/ce_setup.h	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,105 @@
+//
+// CE_SETUP.H
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// This public header file specifies function prototypes that WCELOAD.EXE will call
+// in the ISV application's "SETUP.DLL", as well as the supported return values.
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//
+// Install_Init
+//
+// @comm    Called before any part of the application is installed
+//
+typedef enum
+{
+    codeINSTALL_INIT_CONTINUE  = 0,     // @comm Continue with the installation
+    codeINSTALL_INIT_CANCEL             // @comm Immediately cancel the installation
+}
+codeINSTALL_INIT;
+
+codeINSTALL_INIT
+Install_Init(
+    HWND        hwndParent,
+    BOOL        fFirstCall,     // is this the first time this function is being called?
+    BOOL        fPreviouslyInstalled,
+    LPCTSTR     pszInstallDir
+);
+
+typedef codeINSTALL_INIT (*pfnINSTALL_INIT)( HWND, BOOL, BOOL, LPCTSTR );
+const TCHAR szINSTALL_INIT[]    = TEXT("Install_Init");
+
+//
+// Install_Exit
+//
+// @comm    Called after the application is installed
+//
+typedef enum
+{
+    codeINSTALL_EXIT_DONE       = 0,    // @comm Exit the installation successfully
+    codeINSTALL_EXIT_UNINSTALL          // @comm Uninstall the application before exiting the installation
+}
+codeINSTALL_EXIT;
+
+codeINSTALL_EXIT
+Install_Exit(
+    HWND    hwndParent,
+    LPCTSTR pszInstallDir,      // final install directory
+    WORD    cFailedDirs,
+    WORD    cFailedFiles,
+    WORD    cFailedRegKeys,
+    WORD    cFailedRegVals,
+    WORD    cFailedShortcuts
+);
+
+typedef codeINSTALL_EXIT (*pfnINSTALL_EXIT)( HWND, LPCTSTR, WORD, WORD, WORD, WORD, WORD );
+const TCHAR szINSTALL_EXIT[]    = TEXT("Install_Exit");
+
+//
+// Uninstall_Init
+//
+// @comm    Called before the application is uninstalled
+//
+typedef enum
+{
+    codeUNINSTALL_INIT_CONTINUE = 0,    // @comm Continue with the uninstallation
+    codeUNINSTALL_INIT_CANCEL           // @comm Immediately cancel the uninstallation
+}
+codeUNINSTALL_INIT;
+
+codeUNINSTALL_INIT
+Uninstall_Init(
+    HWND        hwndParent,
+    LPCTSTR     pszInstallDir
+);
+
+typedef codeUNINSTALL_INIT (*pfnUNINSTALL_INIT)( HWND, LPCTSTR );
+const TCHAR szUNINSTALL_INIT[]  = TEXT("Uninstall_Init");
+
+//
+// Uninstall_Exit
+//
+// @comm    Called after the application is uninstalled
+//
+typedef enum
+{
+    codeUNINSTALL_EXIT_DONE     = 0     // @comm Exit the uninstallation successfully
+}
+codeUNINSTALL_EXIT;
+
+codeUNINSTALL_EXIT
+Uninstall_Exit(
+    HWND    hwndParent
+);
+
+typedef codeUNINSTALL_EXIT (*pfnUNINSTALL_EXIT)( HWND );
+const TCHAR szUNINSTALL_EXIT[]  = TEXT("Uninstall_Exit");
+
+#ifdef __cplusplus
+}       // extern "C"
+#endif
+

Added: trunk/src/Installer_BC/include/ceapimap.h
===================================================================
--- trunk/src/Installer_BC/include/ceapimap.h	                        (rev 0)
+++ trunk/src/Installer_BC/include/ceapimap.h	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,198 @@
+/*++
+
+    Copyright (c) Microsoft Corporation. All rights reserved.
+    
+    File: ceapimap.h
+    
+    Abstract:
+    
+    Contents:  This file contains mappings for all the WinCE API names, 
+               structures and constants to the new names.
+
+               Eg. PEGOID -> CEOID
+                   PegCreateDatabase -> CeCreateDatabase
+
+--*/
+
+#ifndef _CEAPIMAP_H
+#define _CEAPIMAP_H
+
+//
+// Prop Ids for WinCE Properties:
+//
+typedef CEPROPID                    PEGPROPID;
+typedef PEGPROPID                   *PPEGPROPID;
+
+//
+// Unique identifier for all WINCE objects
+//
+typedef CEOID                       PEGOID;
+typedef PEGOID                      *PPEGOID;
+
+//
+// Structures:
+//
+#ifdef RAPI_H
+typedef CE_FIND_DATA        PEG_FIND_DATA;
+typedef LPCE_FIND_DATA      LPPEG_FIND_DATA;
+typedef LPLPCE_FIND_DATA    LPLPPEG_FIND_DATA;
+
+#ifndef UNDER_CE
+typedef CEDB_FIND_DATA      PEGDB_FIND_DATA;
+typedef LPCEDB_FIND_DATA    LPPEGDB_FIND_DATA;
+typedef LPLPCEDB_FIND_DATA  LPLPPEGDB_FIND_DATA;
+#endif
+#endif
+
+typedef CEFILEINFO                  PEGFILEINFO;
+typedef PEGFILEINFO                 *PPEGFILEINFO;
+
+typedef CEDIRINFO                   PEGDIRINFO;                  
+typedef PEGDIRINFO                  *PPEGDIRINFO;                
+
+typedef CERECORDINFO                PEGRECORDINFO;              
+typedef PEGRECORDINFO               *PPEGRECORDINFO;             
+
+#define PEGDB_SORT_DESCENDING       CEDB_SORT_DESCENDING
+#define PEGDB_SORT_CASEINSENSITIVE  CEDB_SORT_CASEINSENSITIVE
+#define PEGDB_SORT_UNKNOWNFIRST     CEDB_SORT_UNKNOWNFIRST
+#define PEGDB_SORT_GENERICORDER     CEDB_SORT_GENERICORDER
+
+#define PEGDB_MAXDBASENAMELEN       CEDB_MAXDBASENAMELEN
+#define PEGDB_MAXSORTORDER          CEDB_MAXSORTORDER
+
+//
+// Values for flag:
+//
+#define PEGDB_VALIDNAME             CEDB_VALIDNAME
+#define PEGDB_VALIDTYPE             CEDB_VALIDTYPE
+#define PEGDB_VALIDSORTSPEC         CEDB_VALIDSORTSPEC
+#define PEGDB_VALIDMODTIME          CEDB_VALIDMODTIME
+
+typedef CEDBASEINFO                 PEGDBASEINFO; 
+typedef PEGDBASEINFO                *PPEGDBASEINFO;               
+
+typedef CEOIDINFO                   PEGOIDINFO;   
+typedef PEGOIDINFO                  *PPEGOIDINFO;                
+
+//
+// Flags for open database - use low word:
+//
+#define PEGDB_AUTOINCREMENT         CEDB_AUTOINCREMENT
+ 
+#define PEGDB_SEEK_PEGOID           CEDB_SEEK_CEOID   
+#define PEGDB_SEEK_BEGINNING        CEDB_SEEK_BEGINNING
+#define PEGDB_SEEK_END              CEDB_SEEK_END
+#define PEGDB_SEEK_CURRENT          CEDB_SEEK_CURRENT
+#define PEGDB_SEEK_VALUESMALLER     CEDB_SEEK_VALUESMALLER   
+#define PEGDB_SEEK_VALUEFIRSTEQUAL  CEDB_SEEK_VALUEFIRSTEQUAL
+#define PEGDB_SEEK_VALUEGREATER     CEDB_SEEK_VALUEGREATER   
+#define PEGDB_SEEK_VALUENEXTEQUAL   CEDB_SEEK_VALUENEXTEQUAL 
+
+typedef CEBLOB                      PEGBLOB;
+typedef PEGBLOB                     *PPEGBLOB;
+
+#define PEGVT_I2                    CEVT_I2
+#define PEGVT_UI2                   CEVT_UI2                    
+#define PEGVT_I4                    CEVT_I4                     
+#define PEGVT_UI4                   CEVT_UI4                            
+#define PEGVT_FILETIME              CEVT_FILETIME               
+#define PEGVT_LPWSTR                CEVT_LPWSTR                 
+#define PEGVT_BLOB                  CEVT_BLOB                   
+
+typedef CEVALUNION                  PEGVALUNION;
+typedef PEGVALUNION                 *PPEGVALUNION;
+
+#define PEGDB_PROPNOTFOUND          CEDB_PROPNOTFOUND            
+#define PEGDB_PROPDELETE            CEDB_PROPDELETE              
+
+typedef CEPROPVAL                   PEGPROPVAL; 
+typedef PEGPROPVAL                  *PPEGPROPVAL; 
+
+#define PEGDB_MAXDATABLOCKSIZE      CEDB_MAXDATABLOCKSIZE 
+#define PEGDB_MAXPROPDATASIZE       CEDB_MAXPROPDATASIZE  
+#define PEGDB_MAXRECORDSIZE         CEDB_MAXRECORDSIZE
+
+#define PEGDB_ALLOWREALLOC          CEDB_ALLOWREALLOC  
+
+#ifndef UNDER_CE
+typedef CEOSVERSIONINFO             PEGOSVERSIONINFO;
+typedef LPCEOSVERSIONINFO           LPPEGOSVERSIONINFO;
+#endif
+
+#define PegCreateDatabase         CeCreateDatabase
+#define PegDeleteDatabase         CeDeleteDatabase
+#define PegDeleteRecord           CeDeleteRecord
+#define PegFindFirstDatabase      CeFindFirstDatabase
+#define PegFindNextDatabase       CeFindNextDatabase
+#define PegOidGetInfo             CeOidGetInfo
+#define PegOpenDatabase           CeOpenDatabase
+#define PegReadRecordProps        CeReadRecordProps
+#define PegSeekDatabase           CeSeekDatabase
+#define PegSetDatabaseInfo        CeSetDatabaseInfo
+#define PegWriteRecordProps       CeWriteRecordProps
+
+#ifndef UNDER_CE
+#define PegFindFirstFile          CeFindFirstFile
+#define PegFindNextFile           CeFindNextFile
+#define PegFindClose              CeFindClose
+#define PegGetFileAttributes      CeGetFileAttributes
+#define PegSetFileAttributes      CeSetFileAttributes
+#define PegCreateFile             CeCreateFile
+#define PegReadFile               CeReadFile
+#define PegWriteFile              CeWriteFile
+#define PegCloseHandle            CeCloseHandle
+#define PegFindAllFiles           CeFindAllFiles
+#define PegFindAllDatabases       CeFindAllDatabases
+#define PegSetFilePointer         CeSetFilePointer
+#define PegSetEndOfFile           CeSetEndOfFile
+#define PegCreateDirectory        CeCreateDirectory
+#define PegRemoveDirectory        CeRemoveDirectory
+#define PegCreateProcess          CeCreateProcess
+#define PegMoveFile               CeMoveFile
+#define PegCopyFile               CeCopyFile
+#define PegDeleteFile             CeDeleteFile
+#define PegGetFileSize            CeGetFileSize
+#define PegRegOpenKeyEx           CeRegOpenKeyEx
+#define PegRegEnumKeyEx           CeRegEnumKeyEx
+#define PegRegCreateKeyEx         CeRegCreateKeyEx
+#define PegRegCloseKey            CeRegCloseKey
+#define PegRegDeleteKey           CeRegDeleteKey
+#define PegRegEnumValue           CeRegEnumValue
+#define PegRegDeleteValue         CeRegDeleteValue
+#define PegRegQueryInfoKey        CeRegQueryInfoKey
+#define PegRegQueryValueEx        CeRegQueryValueEx
+#define PegRegSetValueEx          CeRegSetValueEx
+#define PegGetStoreInformation    CeGetStoreInformation
+#define PegGetSystemMetrics       CeGetSystemMetrics
+#define PegGetDesktopDeviceCaps   CeGetDesktopDeviceCaps
+#define PegGetSystemInfo          CeGetSystemInfo
+#define PegSHCreateShortcut       CeSHCreateShortcut
+#define PegSHGetShortcutTarget    CeSHGetShortcutTarget
+#define PegCheckPassword          CeCheckPassword
+#define PegGetFileTime            CeGetFileTime
+#define PegSetFileTime            CeSetFileTime
+#define PegGetVersionEx           CeGetVersionEx
+#define PegGetWindow              CeGetWindow
+#define PegGetWindowLong          CeGetWindowLong
+#define PegGetWindowText          CeGetWindowText
+#define PegGetClassName           CeGetClassName
+#define PegGlobalMemoryStatus     CeGlobalMemoryStatus
+#define PegGetSystemPowerStatusEx CeGetSystemPowerStatusEx
+#define PegGetTempPath            CeGetTempPath
+#define PegGetSpecialFolderPath   CeGetSpecialFolderPath
+
+#define PegRapiInitEx             CeRapiInitEx
+#define PegRapiInit               CeRapiInit
+#define PegRapiUninit             CeRapiUninit
+#define PegGetLastError           CeGetLastError
+#define RapiFreeBuffer            CeRapiFreeBuffer
+#define GetRapiError              CeRapiGetError
+#endif
+
+#ifdef CONN_INTERNAL
+#include <pceapimp.h>  // internal defines
+#endif
+
+#endif // _CEAPIMAP_H
+

Added: trunk/src/Installer_BC/include/cefltmap.h
===================================================================
--- trunk/src/Installer_BC/include/cefltmap.h	                        (rev 0)
+++ trunk/src/Installer_BC/include/cefltmap.h	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,43 @@
+/****************************************************************************
+*                                                                           *
+* Cefilt.h -- Windows CE Services filter procedure declarations,            *
+*             structures, constant definitions and macros mapping.          *
+*                                                                           *
+* Copyright (c) Microsoft Corporation. All rights reserved.		            *
+*                                                                           *
+****************************************************************************/
+
+#ifndef _CEFLTMAP_
+#define _CEFLTMAP_
+
+// {6C5C05E0-97A2-11cf-8011-00A0C90A8F78}
+DEFINE_GUID(IID_IPegasusFileFilterSite, 
+0x6c5c05e0, 0x97a2, 0x11cf, 0x80, 0x11, 0x0, 0xa0, 0xc9, 0xa, 0x8f, 0x78);
+// {6C5C05E1-97A2-11cf-8011-00A0C90A8F78}
+DEFINE_GUID(IID_IPegasusFileFilter, 
+0x6c5c05e1, 0x97a2, 0x11cf, 0x80, 0x11, 0x0, 0xa0, 0xc9, 0xa, 0x8f, 0x78);
+// {6C5C05E2-97A2-11cf-8011-00A0C90A8F78}
+DEFINE_GUID(IID_IPegasusFileFilterOptions, 
+0x6c5c05e2, 0x97a2, 0x11cf, 0x80, 0x11, 0x0, 0xa0, 0xc9, 0xa, 0x8f, 0x78);
+
+
+#define HRESULT_TO_PFERROR    HRESULT_TO_CFERROR
+
+typedef CF_ERROR              PF_ERROR;
+typedef CFF_DESTINATIONFILE   PFF_DESTINATIONFILE; 
+typedef CFF_CONVERTINFO       PFF_CONVERTINFO; 
+typedef CFF_SOURCEFILE        PFF_SOURCEFILE;
+
+#define PF_OPENFLAT           CF_OPENFLAT     
+#define PF_OPENCOMPOUND       CF_OPENCOMPOUND 
+#define PF_OPENDONT           CF_OPENDONT     
+#define PF_OPENASKMEHOW       CF_OPENASKMEHOW 
+
+typedef CFF_CONVERTOPTIONS    PFF_CONVERTOPTIONS;
+
+#define IPegasusFileFilterSite      ICeFileFilterSite
+#define IPegasusFileFilter          ICeFileFilter
+#define IPegasusFileFilterOptions   ICeFileFilterOptions
+
+#endif /* !_CEFLTMAP_ */
+

Added: trunk/src/Installer_BC/include/cesync.h
===================================================================
--- trunk/src/Installer_BC/include/cesync.h	                        (rev 0)
+++ trunk/src/Installer_BC/include/cesync.h	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,504 @@
+/*++
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+Module Name:
+
+
+    cesync.h
+
+Abstract:
+
+    Include file for synchronization modules for Windows CE
+
+--*/
+#ifndef _INC_CESYNC_H
+#define _INC_CESYNC_H
+
+// max size of the object type name
+#define MAX_OBJTYPE_NAME    100
+
+// max. size of a packet in IReplObjHandler::GetPacket & IReplObjHandler::SetPacket (about 254K)
+#define MAX_PACKET_SIZE     260000
+
+#define MAX_ACTIVE_VOL      16                  // up to 16 active volumes (including the default system volume) can be synchronized during each connection
+
+typedef struct _tagReplSetup *PREPLSETUP;
+
+typedef TCHAR   OBJTYPENAME[ MAX_OBJTYPE_NAME ];
+typedef char    OBJTYPENAMEA[ MAX_OBJTYPE_NAME ];
+typedef WCHAR   OBJTYPENAMEW[ MAX_OBJTYPE_NAME ];
+
+#define FACILITY_CESYNC     0x14
+#define MAKE_RERR(code)     ((HRESULT)(MAKE_SCODE( SEVERITY_ERROR, FACILITY_CESYNC, code )))
+#define MAKE_RWRN(code)     ((HRESULT)(MAKE_SCODE( SEVERITY_SUCCESS, FACILITY_CESYNC, code )))
+
+#ifndef UNDER_CE
+typedef struct _REPLOBJ FAR *HREPLOBJ;
+typedef struct _REPLITEM FAR *HREPLITEM;
+typedef struct _REPLFLD FAR *HREPLFLD;
+
+#endif
+
+// Error/Return code used
+#define RERR_SHUT_DOWN      MAKE_RERR( 0x0001 ) // serious error, asking implementation to shut down immediately
+#define RERR_STORE_REPLACED MAKE_RERR( 0x0002 ) // the store was replaced.
+#define RERR_CANCEL         MAKE_RERR( 0x0003 ) // user cancel the operation
+#define RERR_RESTART        MAKE_RERR( 0x0004 ) // restart the operation, applicable in RSC_END_SYNC & RSC_END_CHECK
+#define RERR_IGNORE         MAKE_RERR( 0x0005 ) // used by IReplStore::GetConflictInfo.
+#define RERR_UNLOAD         MAKE_RERR( 0x0006 ) // used by IReplStore::ActivateDialog or IReplStore::IsFolderChanged to request unloading of replication modules
+#define RERR_OBJECT_DELETED MAKE_RERR( 0x0007 ) // used by IReplStore::IsValidObject, indicates the object identified by the hObject is deleted
+#define RERR_CORRUPT        MAKE_RERR( 0x0008 ) // used by IReplStore::IsValidObject, indicates the object identified by the hObject is corrupted
+#define RERR_NO_DEVICE      MAKE_RERR( 0x0009 ) // returned by IReplNotify::QueryDevice. indicates no selected or connected device exists
+#define RERR_NO_ERR_PROMPT  MAKE_RERR( 0x0010 ) // returned by IReplStore::Initialize. indicates error initializing. No UI is needed to show this error.
+#define RERR_DISCARD        MAKE_RERR( 0x0011 ) // returned by IReplObjHandler::SetPacket. indicates this object should be discarded from the device immediately.
+#define RERR_DISCARD_LOCAL  MAKE_RERR( 0x0012 ) // returned by IReplObjHandler::SetPaket. indicates this object should be discarded from the desktop only.
+#define RERR_VOL_INACTIVE   MAKE_RERR( 0x0013 ) // returned by IReplObjHandler::GetPacket && IReplObjHandler::SetPacket, the volume has become inactive.
+#define RERR_BIG_OBJ_TYPE   MAKE_RERR( 0x0014 ) // returned by IReplNotify::QueryDevice on QDC_SYNC_DATA
+#define RERR_BIG_CODE       MAKE_RERR( 0x0015 ) // returned by IReplNotify::QueryDevice on QDC_SYNC_DATA
+#define RERR_UNMATCHED      MAKE_RERR( 0x0016 ) // returned by IReplNotify::QueryDevice on QDC_SYNC_DATA
+#define RERR_DEVICE_WIN     MAKE_RERR( 0x0017 ) // returned by IReplStore::GetConflictInfo, resolve the conflict so device object wins
+#define RERR_DESKTOP_WIN    MAKE_RERR( 0x0018 ) // returned by IReplStore::GetConflictInfo, resolve the conflict so desktop object wins
+#define RERR_SKIP_ALL_OBJ   MAKE_RERR( 0x0019 ) // returned by IReplStore::ReportStatus on RSC_WRITE_OBJ_FAILED, skip sync of all remaining objects
+
+// use by IReplObjHandler
+#define RERR_SKIP_ALL       MAKE_RERR( 0x0100 )  // skip all incoming packets because of write errors
+#define RERR_BAD_OBJECT     MAKE_RERR( 0x0101 )  // this is a bad object because of read error, server should not try to replicate it again
+#define RERR_TRY_AGAIN      MAKE_RERR( 0x0102 )  // this is a bad object because of read error, server should can try to replicate it again later
+#define RERR_USER_SKIP      MAKE_RERR( 0x0103 )  // object skipped by the user
+
+// these are warning codes
+#define RWRN_LAST_PACKET    MAKE_RWRN( 0x0001 )
+
+// flags used in RSC_BEGIN_SYNC
+#define BSF_AUTO_SYNC           ((UINT)0x00000001)  // This flag is being obsoleted in ActiveSync 3.0
+#define BSF_REMOTE_SYNC         ((UINT)0x00000002)  // consistent with RSC_REMOTE_SYNC, set if we are sync'ing remotely
+#define BSF_SHOW_FATAL_ERRORS   ((UINT)0x00000004)  // If an error occurs which prevents the SSP from synchronizing at all, it can show the error to the user when this flag is set
+#define BSF_SHOW_RESOLVE_ERRORS ((UINT)0x00000008)  // The SSP can show any error messages that it comes across as during the resolve items phase
+#define BSF_RESERVED            ((UINT)0x80000000)  // Reserved by ActiveSync server.
+
+// Code for ReportStatus
+#define RSC_BEGIN_SYNC          ((UINT)1)   // Synchronization is about to start, uReserved is combination of bit flags, see BSF_* above
+#define RSC_END_SYNC            ((UINT)2)   // Synchronization is about to end
+#define RSC_BEGIN_CHECK         ((UINT)3)   // FindFirstItem is about to be called, followed by FindNextItem
+#define RSC_END_CHECK           ((UINT)4)   // FindItemClose has been called
+#define RSC_DATE_CHANGED        ((UINT)5)   // System Date has changed, this is called for each known desktop object, unless when both hFolder & hItem are NULL
+#define RSC_RELEASE             ((UINT)6)   // Replication is about to release the store
+#define RSC_REMOTE_SYNC         ((UINT)7)   // Indicates if remote sync is enabled. uParam will TRUE if all sync
+                                            // will be remote until this status is reported again with uParam set to FALSE
+#define RSC_INTERRUPT           ((UINT)8)   // interrupt current operation
+#define RSC_BEGIN_SYNC_OBJ      ((UINT)9)   // Synchronization is about to start on an object type. uReserved points to
+#define RSC_END_SYNC_OBJ        ((UINT)10)  // Synchronization is about to end on an object type.
+#define RSC_OBJ_TYPE_ENABLED    ((UINT)11)  // Synchronization of the given object is enabled, hFolder is indeed a pointer to a string (object type name)
+#define RSC_OBJ_TYPE_DISABLED   ((UINT)12)  // Synchronization of the given object is disabled, hFolder is indeed a pointer to a string (object type name)
+#define RSC_BEGIN_BATCH_WRITE   ((UINT)13)  // A series of SetPacket will be called on a number of objects, this is the right time for some service providers to start a transaction
+#define RSC_END_BATCH_WRITE     ((UINT)14)  // above write ends, this is the right time for some service providers to commit the transaction
+#define RSC_CONNECTION_CHG      ((UINT)15)  // connection status has changed. uParam is TRUE if connection established. FALSE otherwise.
+#define RSC_WRITE_OBJ_FAILED    ((UINT)16)  // failed writing an object on the device. uParam is the HRESULT code.
+#define RSC_DELETE_OBJ_FAILED   ((UINT)17)  // failed deleting an object on the device. uParam is the HRESULT code.
+#define RSC_WRITE_OBJ_SUCCESS   ((UINT)18)  // writing of an object succeeded on the device. uParam is a pointer to SDREQUEST (with (lpbData, cbData) representing the volume ID)
+#define RSC_DELETE_OBJ_SUCCESS  ((UINT)19)  // deletion of an object succeeded on the device. uParam is a pointer to SDREQUEST (with (lpbData, cbData) representing the volume ID)
+#define RSC_READ_OBJ_FAILED     ((UINT)20)  // failed to read an object from the device. uParam is the HRESULT code
+#define RSC_TIME_CHANGED        ((UINT)21)  // System time has changed, this is called only once.
+
+#define RSC_BEGIN_BACKUP        ((UINT)22)  // Backup is about to start.
+#define RSC_END_BACKUP          ((UINT)23)  // Backup has ended.
+#define RSC_BEGIN_RESTORE       ((UINT)24)  // Restore is about to start.
+
+#define RSC_PREPARE_SYNC_FLD    ((UINT)26)  // Prepare to sync one specific folder whether or not any objects of the type are dirty. hFolder is a pointer to the object name that will be synced. 
+
+//
+//========================= IReplNotify ==============================
+//
+
+typedef struct tagDevInfo
+{
+    DWORD   pid;                // device ID
+    char    szName[ MAX_PATH ]; // device name
+    char    szType[ 80 ];       // device type
+    char    szPath[ MAX_PATH ]; // device path
+} DEVINFO, *PDEVINFO;
+
+// a structure used to get/set custom sync. data from/to the device
+typedef struct SDREQUEST
+{
+    OBJTYPENAME szObjType;  // the object type where this data is coming from
+    BOOL        fSet;       // TRUE if sending data down and FALSE if getting data up
+    UINT        uCode;      // for getting data from the device, this code must be less than 8
+    LPBYTE      lpbData;
+    UINT        cbData;
+} SDREQUEST, *PSDREQUEST;
+
+// code for QueryDevice
+#define QDC_SEL_DEVICE      1   // Selected device info, *ppvData points to DEVINFO
+#define QDC_CON_DEVICE      2   // Connected device info, *ppvData points to DEVINFO
+#define QDC_SEL_DEVICE_KEY  3   // get a registry key that can be used to store selected device specific settings.
+                                // *ppvData points to HKEY, caller must close reg key when its usage is over
+#define QDC_CON_DEVICE_KEY  4   // get a registry key that can be used to store connnected device specific settings.
+                                // *ppvData points to HKEY, caller must close reg key when its usage is over
+#define QDC_SYNC_DATA   5       // get or set custom sync data from the device, *ppvData points to SDREQUEST
+
+#define INF_OVERRIDE        ((UINT)0x0001000)   // used for OnItemNotify, override the default action of "delete wins over change"
+
+#undef  INTERFACE
+#define INTERFACE   IReplNotify
+DECLARE_INTERFACE_( IReplNotify, IUnknown )
+{
+#ifndef UNDER_CE
+    STDMETHOD(       SetStatusText)     ( THIS_ LPSTR lpszText ) PURE;  // lpszText can have special syntax, see programmer's guide
+    STDMETHOD_(HWND, GetWindow)         ( THIS_ UINT uFlags ) PURE;
+    STDMETHOD(       OnItemNotify )     ( THIS_ UINT uCode, LPSTR lpszProgId, LPSTR lpszName, HREPLITEM hItem, ULONG ulFlags ) PURE;
+    STDMETHOD(       QueryDevice )      ( THIS_ UINT uCode, LPVOID *ppvData ) PURE;
+#endif
+
+    // Internal use only
+    STDMETHOD(       OnItemCompleted )  ( THIS_ PREPLSETUP pSetup ) PURE;
+};
+
+#define RNC_CREATED     1
+#define RNC_MODIFIED    2
+#define RNC_DELETED     3
+#define RNC_SHUTDOWN    4
+#define RNC_IDLE        5
+
+#ifndef UNDER_CE
+
+#define SCF_SINGLE_THREAD   ((UINT)0x00000001)  // set if the implementation only supports single thread operation.
+#define SCF_SIMULATE_RTS    ((UINT)0x00000002)  // set if the implementation wants to simulate detection of real-time change/deletes
+
+typedef struct tagStoreInfo
+{
+    UINT    cbStruct;               // Size of this structure
+    UINT    uFlags;                 // Miscelleanous flags on the store, see SCF_xxx above
+    TCHAR   szProgId[ 256 ];        // Output, ProgID name of the store object
+    TCHAR   szStoreDesc[ 200 ];     // Output, description of the store, will be displayed to the user
+    UINT    uTimerRes;              // Input/Output, resolution of timer in micro-seconds. 5000 by default.
+
+    UINT    cbMaxStoreId;           // Input, max. size of the store ID that can be stored in buffer pointed by lpbStoreId.
+    UINT    cbStoreId;              // Output, actual size of the store ID stored in buffer pointed by lpbStoreId
+    LPBYTE  lpbStoreId;             // Output pointer to a buffer of anything that uniquely
+                                    // identifies the current store instance (Eg. a schedule file)
+} STOREINFO, *PSTOREINFO;
+
+typedef struct tagObjUIData
+{
+    UINT        cbStruct;               // size of this structure
+    HICON       hIconLarge;             // Handle of a large icon used in the list view display in Synchronization Status
+    HICON       hIconSmall;             // Handle of a small icon used in the list view display in Synchronization Status
+    char        szName[ MAX_PATH ];     // Text displayed in the "Name" column in Synchronization Status
+    char        szSyncText[ MAX_PATH ]; // Text displayed in the  "Sync Copy In" column in Synchronization Status
+    char        szTypeText[ 80 ];       // Text displayed in the  "Type" column in Synchronization Status
+    char        szPlTypeText[ 80 ];     // Plural form of text displayed in the  "Type" column in Synchronization Status
+} OBJUIDATA, *POBJUIDATA;
+
+enum ReplDialogs
+{
+    OPTIONS_DIALOG
+};
+
+//
+//========================= IEnumReplItem ==============================
+//
+DEFINE_GUID( IID_IEnumReplItem,              /* a417bc0e-7be1-11ce-ad82-00aa006ec559 */
+    0xa417bc0e,
+    0x7be1,
+    0x11ce,
+    0xad, 0x82, 0x00, 0xaa, 0x00, 0x6e, 0xc5, 0x59
+);
+
+#undef  INTERFACE
+#define INTERFACE   IEnumReplItem
+DECLARE_INTERFACE_( IEnumReplItem, IUnknown )
+{
+    STDMETHOD(Next)                         ( THIS_ ULONG celt, HREPLITEM *phItem, ULONG *pceltFetched ) PURE;
+    STDMETHOD(Skip)                         ( THIS_ ULONG celt ) PURE;
+    STDMETHOD(Reset)                        ( THIS ) PURE;
+    STDMETHOD(Clone)                        ( THIS_ IEnumReplItem **ppenum ) PURE;
+    STDMETHOD_( HREPLFLD, GetFolderHandle)  ( THIS ) PURE;
+};
+
+typedef struct tagConfInfo
+{
+    UINT        cbStruct;
+    HREPLFLD    hFolder;
+    HREPLITEM   hLocalItem;
+    HREPLITEM   hRemoteItem;
+
+    OBJTYPENAME szLocalName;
+    TCHAR       szLocalDesc[ 512 ];
+
+    OBJTYPENAME szRemoteName;
+    TCHAR       szRemoteDesc[ 512 ];
+} CONFINFO, *PCONFINFO;
+
+// flags for uParam of IReplStore::ReportStatus
+#define PSA_RESET_INTERRUPT ((UINT)0x00000001)  // this flag is set if we're clearing the interrupt state (ie. we go back to normal operation)
+#define PSA_SYS_SHUTDOWN    ((UINT)0x00000002)  // Windows is shutting down
+
+// Actions for Setup
+#define RSTP_SETUP          ((WORD)0x0001)  // New setup
+#define RSTP_CREATE         ((WORD)0x0002)  // New profile
+#define RSTP_RENAME         ((WORD)0x0003)  // Rename profile
+#define RSTP_DELETE         ((WORD)0x0004)  // Delete profile
+
+//========================= IReplSetup ==============================
+//
+
+DEFINE_GUID( IID_IReplSetup, /* 60178ec0-c670-11d0-837a-0000f80220b9 */
+    0x60178ec0,
+    0xc670,
+    0x11d0,
+    0x83, 0x7a, 0x00, 0x00, 0xf8, 0x02, 0x20, 0xb9
+);
+
+#undef  INTERFACE
+#define INTERFACE   IReplSetup
+
+//
+//  IReplSetup is included but is obsolete
+//
+DECLARE_INTERFACE_( IReplSetup, IUnknown )
+{
+    // *** IReplSetup methods ***
+    STDMETHOD(          Setup )             ( THIS_ HWND hwndParent, DWORD dwDeviceId, WORD wAction ) PURE;
+};
+
+//
+//========================= IReplStore ==============================
+//
+DEFINE_GUID (IID_IReplStore,            // a417bc0f-7be1-11ce-ad82-00aa006ec559
+    0xa417bc0f,
+    0x7be1,
+    0x11ce,
+    0xad, 0x82, 0x00, 0xaa, 0x00, 0x6e, 0xc5, 0x59
+);
+
+// Flags for Initialize
+#define ISF_SELECTED_DEVICE     ((UINT)0x00000001)  // set if the store is initialized for selected device
+                                                    // otherwise it's initialized for connected device
+#define ISF_REMOTE_CONNECTED    ((UINT)0x00000002)  // set if the store is initialized during remote connection, all UI should be suppressed.
+
+#undef  INTERFACE
+#define INTERFACE   IReplStore
+DECLARE_INTERFACE_( IReplStore, IUnknown )
+{
+    // *** IReplStore methods ***
+    STDMETHOD(          Initialize )        ( THIS_ IReplNotify *pNotify, UINT uFlags ) PURE;
+    STDMETHOD(          GetStoreInfo )      ( THIS_ PSTOREINFO pStoreInfo ) PURE;
+    STDMETHOD(          ReportStatus )      ( THIS_ HREPLFLD hFld, HREPLITEM hItem, UINT uStatus, UINT uParam ) PURE;
+    STDMETHOD_( int,    CompareStoreIDs)    ( THIS_ LPBYTE, UINT, LPBYTE, UINT ) PURE;
+
+    // Item related routines
+    STDMETHOD_( int,    CompareItem )       ( THIS_ HREPLITEM hItem1, HREPLITEM hItem2 ) PURE;
+    STDMETHOD_( BOOL,   IsItemChanged)      ( THIS_ HREPLFLD hFld, HREPLITEM hItem, HREPLITEM hItemComp ) PURE;
+    STDMETHOD_( BOOL,   IsItemReplicated )  ( THIS_ HREPLFLD hFld, HREPLITEM hItem ) PURE;
+    STDMETHOD_( void,   UpdateItem )        ( THIS_ HREPLFLD hFld, HREPLITEM hItemDst, HREPLITEM hItemSrc ) PURE;
+
+    // Folder related routines
+    STDMETHOD(          GetFolderInfo )     ( THIS_ LPSTR lpszObjType, HREPLFLD *phFld, IUnknown ** ) PURE;
+    STDMETHOD(          IsFolderChanged )   ( THIS_ HREPLFLD hFld, BOOL *pfChanged ) PURE;
+
+    // Enumeration of folders
+    STDMETHOD(          FindFirstItem )     ( THIS_ HREPLFLD hFld,  HREPLITEM *phItem, BOOL *pfExist ) PURE;   // get first object the folder
+    STDMETHOD(          FindNextItem )      ( THIS_ HREPLFLD hFld,  HREPLITEM *phItem, BOOL *pfExist ) PURE;   // get next object the folder
+    STDMETHOD(          FindItemClose )     ( THIS_ HREPLFLD hFld ) PURE;                   // done enumerating
+
+    // Object management routines
+    STDMETHOD_(UINT,    ObjectToBytes )     ( THIS_ HREPLOBJ hObject, LPBYTE lpb ) PURE;
+    STDMETHOD_(HREPLOBJ,BytesToObject )     ( THIS_ LPBYTE lpb, UINT cb ) PURE;
+    STDMETHOD_(void,    FreeObject )        ( THIS_ HREPLOBJ hObject ) PURE;
+    STDMETHOD_(BOOL,    CopyObject )        ( THIS_ HREPLOBJ hObjSrc, HREPLOBJ hObjDest ) PURE;
+    STDMETHOD(          IsValidObject )     ( THIS_ HREPLFLD hFld, HREPLITEM hObject, UINT uFlags ) PURE;
+
+    // UI related routines
+    STDMETHOD(          ActivateDialog)     ( THIS_ UINT uidDialog, HWND hwndParent, HREPLFLD hFld, IEnumReplItem *penumItem ) PURE;
+    STDMETHOD(          GetObjTypeUIData)   ( THIS_ HREPLFLD hFld, POBJUIDATA pData ) PURE;
+    STDMETHOD(          GetConflictInfo )   ( THIS_ PCONFINFO pConfInfo ) PURE;
+    STDMETHOD(          RemoveDuplicates )  ( THIS_ LPSTR lpszObjType, UINT uFlags ) PURE;
+};
+
+#endif
+
+//
+//=========== Section for object serializing & deserializing interfaces ==========
+//
+#define RSF_CONFLICT_OBJECT             0x00000001  // this is about getting/writting a conflicting object
+#define RSF_NEW_OBJECT                  0x00000002  // this is a new object to be written
+#define RSF_DUPLICATED_OBJECT           0x00000004  // the object is an exact duplicate of an existing object
+#define RSF_COMBINE                     0x00000008  // the object is being writen to desktop during a combine operation
+#define RSF_SYNC_DEVICE_ONLY            0x00000010  // the object should be sync'ed from device to desktop only
+#define RSF_SYNC_DESKTOP_ONLY           0x00000020  // the object should be sync'ed from desktop to device only
+#define RSF_UPDATED_HANDLE              0x00000040  // this is a new object, but the oid already exists (eg, file rename)
+#define RSF_DISCARDED_OBJ               0x00000080  // used in DeleteObj. indicates the object is deleted as a result of RERR_DISCARD being returned by SetPacket
+#define RSF_NEW_VOLUME                  0x00000100  // used by ActiveSync manager only.
+#define RSF_AUTO_COMBINE                0x00000200  // the object is being written to the desktop, similar to RSF_COMBINE except there were no items on the desktop to combine with
+
+#define RSF_RESERVED1                   0x00100000  // reserved by ActiveSync manager: DO NOT USE THESE
+#define RSF_RESERVED2                   0x00200000
+#define RSF_RESERVED3                   0x00400000
+#define RSF_RESERVED4                   0x00800000  
+
+typedef struct _tagReplSetup
+{
+    UINT        cbStruct;
+    BOOL        fRead;
+    DWORD       dwFlags;                // see RSF_xxx above.
+    HRESULT     hr;
+    OBJTYPENAME szObjType;
+    IReplNotify *pNotify;
+
+    DWORD       oid;
+    DWORD       oidNew;
+
+#ifndef UNDER_CE
+    IReplStore  *pStore;
+
+    HREPLFLD    hFolder;
+    HREPLITEM   hItem;
+#endif
+
+    LPBYTE  lpbVolumeID;    // ID of the volume for the object. NULL if the object is in the default volume
+    UINT    cbVolumeID;     // size of above ID in bytes
+} REPLSETUP, *PREPLSETUP;
+
+
+//========================= IReplObjHandler ==============================
+//
+// Specifies the interface for replication object handler
+// (object serializer/deserializer)
+#undef  INTERFACE
+#define INTERFACE   IReplObjHandler
+DECLARE_INTERFACE_( IReplObjHandler, IUnknown )
+{
+    //  Called everytime when an object is about to be serialized/deserialized
+    STDMETHOD( Setup )  ( THIS_ PREPLSETUP pSetup ) PURE;
+
+    //  Called everytime when it's the time to clean up the serializer/deserializer for the object
+    STDMETHOD( Reset ) ( THIS_ PREPLSETUP pSetup ) PURE;
+
+    /* A request to get a data packet (serialize the object)
+    handler should pass back the buffer along with the size bytes */
+    STDMETHOD( GetPacket )(  THIS_ LPBYTE *lppbData,  DWORD *pcbData, DWORD cbRecommend ) PURE;
+
+    /* A request to set a data packet (deserialize the byte stream) */
+    STDMETHOD( SetPacket )( THIS_ LPBYTE lpbData, DWORD cbData ) PURE;
+
+    /* A request to delete the given object */
+    STDMETHOD( DeleteObj )( THIS_ PREPLSETUP pSetup ) PURE;
+};
+
+typedef struct tagObjTypeInfo
+{
+    UINT            cbStruct;       // Input. Size of the structure in bytes.
+    OBJTYPENAMEW    szObjType;      // Input, the object type name
+    UINT            uFlags;         // Reserved. Not in use yet.
+    WCHAR           szName[ 80 ];   // Output, the name of a file system object storing all these object
+    UINT            cObjects;       // Output, number of existing objects
+    UINT            cbAllObj;       // Output, total number of bytes used to store existing objects
+    FILETIME        ftLastModified; // Output, last time any object is modified
+} OBJTYPEINFO, *POBJTYPEINFO;
+
+#ifdef UNDER_CE
+
+#define ONF_FILE            ((UINT)0x00000001)
+#define ONF_DIRECTORY       ((UINT)0x00000002)
+#define ONF_DATABASE        ((UINT)0x00000004)
+#define ONF_RECORD          ((UINT)0x00000008)
+
+#define ONF_CHANGED         ((UINT)0x00000010)  // set if the file system object is changed
+#define ONF_DELETED         ((UINT)0x00000020)  // set if the file system object is deleted
+
+#define ONF_CLEAR_CHANGE    ((UINT)0x00000040)  // client should clear the change bit for the object whose object id is pointed at by poid
+#define ONF_CALL_BACK       ((UINT)0x00000080)  // Output, client asks server to call ObjectNotify 2 sec. later. (ObjectNotify is callback 
+                                                // function, see definition of POBJNOTIFYPROC)
+#define ONF_CALLING_BACK    ((UINT)0x00000100)  // set if this call is a result of ONF_CALL_BACK being set earlier
+
+/*  Definitions of cOidChg, cOidDel and poid
+    in all cases, poid points to a list of object id's
+
+1) when ONF_CHANGED is set, cOidChg is the number of object id's in the list that should be synchronized. cOidDel is not used
+2) when ONF_DELETED is set, cOidChg is not used, cOidDel is the number of deleted object id's in the list that should be synchronized
+3) when both ONF_CHANGED & ONF_DELETED is not set,
+    cOidChg is count of object id's in the first part of the list for objects that are changed
+    cOidDel is count of object id's in the later part of the list for objects that are not changed
+
+*/
+
+typedef struct tagObjNotify
+{
+    UINT        cbStruct;       // Input. Size of the structure in bytes.
+    OBJTYPENAME szObjType;      // Input, the object type name
+    UINT        uFlags;         // Input, Flags, see ONF_xxx above
+    UINT        uPartnerBit;    // Input, which partner this
+    CEOID       oidObject;      // Input. CEOID of the file system object changed/deleted
+    CEOIDINFO   oidInfo;        // Input. Information about the file system object
+
+    UINT        cOidChg;        // Output, see above comment for definition.
+    UINT        cOidDel;        // Output, see above comment for definition.
+    UINT        *poid;          // Output, see above comment for definition.
+                                // Note that, memory pointed to by this pointer is owned by the clients.
+                                // It will not be freed by replication.
+    LPBYTE      lpbVolumeID;    // ID of the volume where all above objects lives. NULL if the objects are in RAM
+    UINT        cbVolumeID;     // size of above ID in bytes
+} OBJNOTIFY, *POBJNOTIFY;
+
+#define FO_MORE_VOLUME      ((UINT)0x00000001)  // set by ActiveSync module. there are more volumes of objects
+#define FO_DONE_ONE_VOL     ((UINT)0x00000002)  // set by ActiveSync manager, let ActiveSync module to free up the memory allocated in FINDOBJINFO
+
+typedef struct tagFindObjInfo
+{
+    UINT        uFlags;         // See FO_* above
+    OBJTYPENAME szObjType;      // what object type we need to enumerate
+
+    UINT        *poid;          // points to list of object ID's,
+                                // first part is for unchanged objects, last part is for changed objects
+
+    UINT        cUnChg;         // # of unchanged object ID's in above list
+    UINT        cChg;           // # of changed object ID's in above list
+
+    LPBYTE      lpbVolumeID;    // ID of the volume where all above objects lives. NULL if the objects are in RAM
+    UINT        cbVolumeID;     // size of above ID in bytes
+
+    LPVOID      lpvUser;        // an ActiveSync module can save anything it wants in this variable
+} FINDOBJINFO, *PFINDOBJINFO;
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+// Functions exported by client's device module
+
+// for Function: InitObjType
+typedef BOOL (*PINITOBJPROC)( LPWSTR lpszObjType, IReplObjHandler **ppObjHandler, UINT uPartnerBit );
+
+// for Function: ObjectNofity
+typedef BOOL (*POBJNOTIFYPROC)( POBJNOTIFY );
+
+// for Function: GetObjTypeInfo
+typedef BOOL (*PGETOBJTYPEINFO)( POBJTYPEINFO );
+
+// for Function: ReportStatus
+typedef BOOL (*PREPORTSTATUS)( LPWSTR lpszObjType, UINT uCode, UINT uParam );
+
+// for Function: FindObjects
+typedef HRESULT (*PFINDOBJECTS)( PFINDOBJINFO );
+
+// for Function: SyncData
+typedef HRESULT (*PSYNCDATA )( PSDREQUEST psd );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // UNDER_CE
+
+#define SZ_OUTSTORE_PROG_ID     TEXT( "MS.WinCE.OutLook" )
+#define SZ_SCDSTORE_PROG_ID     TEXT( "MS.WinCE.SchedulePlus" )
+
+#define SZ_APPT                 TEXT( "Appointment" )
+#define SZ_CONTACT              TEXT( "Contact" )
+#define SZ_TASK                 TEXT( "Task" )
+#define SZ_FILE                 TEXT( "File" )
+#define SZ_INBOX                TEXT( "Inbox" )
+#define SZ_CHANNELS             TEXT( "Channel" )
+#endif  // _INC_CESYNC_H

Added: trunk/src/Installer_BC/include/ceutil.h
===================================================================
--- trunk/src/Installer_BC/include/ceutil.h	                        (rev 0)
+++ trunk/src/Installer_BC/include/ceutil.h	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,117 @@
+/*++
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+Module Name:
+
+    ceutil.h
+
+Abstract:
+
+    Declaration and implementation of Service helper functions
+
+    Contains all registry manipulation functions for the Windows CE Services.
+    Note: The Windows CE Services path is always
+        "Software\\Microsoft\\Windows CE Services"
+    under HKCU or HKLM
+
+
+Environment:
+
+    WIN32
+
+--*/
+#ifndef _INC_CEREG_H
+#define _INC_CEREG_H
+
+#ifdef __cplusplus
+extern "C" {            /* Assume C declarations for C++ */
+#endif  /* __cplusplus */
+
+typedef HKEY  HCESVC;
+typedef PHKEY PHCESVC;
+typedef DWORD DEVICEID;
+
+#define DEVICE_GUEST    (DEVICEID)-1
+#define DEVICE_INVALID  (DEVICEID)0
+
+enum {
+    CESVC_ROOT_COMMON=0,
+    CESVC_ROOT_MACHINE = CESVC_ROOT_COMMON,
+    CESVC_ROOT_USER,
+    CESVC_DEVICES,
+    CESVC_DEVICEX,
+    CESVC_DEVICE,
+    CESVC_DEVICE_SELECTED,
+    CESVC_SERVICES,
+    CESVC_SERVICES_USER = CESVC_SERVICES,
+    CESVC_SERVICES_COMMON,
+    CESVC_SYNC,
+    CESVC_SYNC_COMMON,
+    CESVC_FILTERS,
+    CESVC_SPECIAL_DEFAULTS,
+    CESVC_CUSTOM_MENUS,
+    CESVC_SYNCX };
+
+#define SVC_FLAG_GUEST            0x0001
+#define SVC_FLAG_CURRENT_PROFILE  0x0002
+#define SVC_FLAG_PROFILE          0x0004  // specify profile id
+#define SVC_FLAG_ALL_PROFILES     0x0008  // all ids
+#define SVC_FLAG_COMMON           0x0010  // shared crud
+#define SVC_FLAG_ALL              0x001F
+
+typedef struct {
+    DWORD   cbSize;
+    DWORD   Flags;
+    DWORD   ProfileId;
+    BOOL    Enabled;
+} SVCINFO_GENERIC;
+
+typedef struct {
+    DWORD   cbSize;
+    DWORD   Flags;
+    DWORD   ProfileId;
+    BOOL    Enabled;
+    LPTSTR  DisplayName;        // sync app name
+    LPTSTR  ProgId;
+} SVCINFO_SYNC;
+
+//
+// Prototypes:
+//
+
+//
+//  Obsolete APIs 
+//
+HRESULT __stdcall CeSvcAdd( LPTSTR pszSvcName, LPTSTR pszSvcClass, LPVOID pSvcInfo );
+HRESULT __stdcall CeSvcRemove(LPTSTR pszSvcName, LPTSTR pszSvcClass, DWORD dwSvcFlags );
+HRESULT __stdcall CeSvcQueryInfo( LPTSTR pszSvcName, LPTSTR pszSvcClass, LPVOID pSvcInfo, DWORD cbBuffer );
+HRESULT __stdcall CeSvcDelete( HCESVC hSvc );
+//
+//  End of obsolete APIs
+//
+
+
+HRESULT __stdcall CeSvcOpen( UINT uSvc, LPTSTR pszPath, BOOL fCreate, PHCESVC phSvc );
+HRESULT __stdcall CeSvcOpenEx( HCESVC hSvcRoot, LPTSTR pszPath, BOOL fCreate, PHCESVC phSvc );
+HRESULT __stdcall CeSvcClose( HCESVC hSvc );
+
+HRESULT __stdcall CeSvcGetString( HCESVC hSvc, LPCTSTR pszValName, LPTSTR pszVal, DWORD cbVal );
+HRESULT __stdcall CeSvcSetString( HCESVC hSvc, LPCTSTR pszValName, LPCTSTR pszVal );
+HRESULT __stdcall CeSvcGetDword( HCESVC hSvc, LPCTSTR pszValName, LPDWORD pdwVal );
+HRESULT __stdcall CeSvcSetDword( HCESVC hSvc, LPCTSTR pszValName, DWORD dwVal );
+HRESULT __stdcall CeSvcGetBinary( HCESVC hSvc, LPCTSTR pszValName, LPBYTE pszVal, LPDWORD pcbVal );
+HRESULT __stdcall CeSvcSetBinary( HCESVC hSvc, LPCTSTR pszValName, LPBYTE pszVal, DWORD cbVal );
+HRESULT __stdcall CeSvcDeleteVal( HCESVC hSvc, LPCTSTR pszValName );
+
+DEVICEID __stdcall CeGetDeviceId( void );
+DEVICEID __stdcall CeGetSelectedDeviceId( void );
+
+HRESULT __stdcall CeSvcEnumProfiles(PHCESVC phSvc, DWORD lProfileIndex, PDWORD plProfile);
+
+#ifdef __cplusplus
+}       /* End of extern "C" { */
+#endif /* __cplusplus */
+
+#endif  // _INC_CEREG_H
+

Added: trunk/src/Installer_BC/include/dccole.h
===================================================================
--- trunk/src/Installer_BC/include/dccole.h	                        (rev 0)
+++ trunk/src/Installer_BC/include/dccole.h	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,89 @@
+/*++
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+Module Name:
+
+    dccole.h
+
+Abstract:
+
+    This file defines the OLE interface to the DCCMAN module (Desktop Only)
+    
+Environment:
+
+    User Mode - Win32
+
+--*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+// {A7B88840-A812-11cf-8011-00A0C90A8F78}
+DEFINE_GUID(IID_IDccManSink, 
+0xa7b88840, 0xa812, 0x11cf, 0x80, 0x11, 0x0, 0xa0, 0xc9, 0xa, 0x8f, 0x78);
+// {A7B88841-A812-11cf-8011-00A0C90A8F78}
+DEFINE_GUID(IID_IDccMan, 
+0xa7b88841, 0xa812, 0x11cf, 0x80, 0x11, 0x0, 0xa0, 0xc9, 0xa, 0x8f, 0x78);
+// {499C0C20-A766-11cf-8011-00A0C90A8F78}
+DEFINE_GUID(CLSID_DccMan, 
+0x499c0c20, 0xa766, 0x11cf, 0x80, 0x11, 0x0, 0xa0, 0xc9, 0xa, 0x8f, 0x78);
+
+#ifndef _DCCOLEH_
+#define _DCCOLEH_
+
+//============================== OLE INTERFACE ===================================
+
+#undef  INTERFACE
+#define INTERFACE   IDccManSink
+
+DECLARE_INTERFACE_ (IDccManSink,  IUnknown)
+{
+ 	// These methods corespond to GW_LOG messages generated by the Win95 DCC
+    STDMETHOD(OnLogIpAddr) (THIS_ DWORD dwIpAddr) PURE;
+    STDMETHOD(OnLogTerminated) (THIS) PURE;
+    STDMETHOD(OnLogActive) (THIS) PURE;
+	STDMETHOD(OnLogInactive) (THIS) PURE;
+	STDMETHOD(OnLogAnswered) (THIS) PURE;
+	STDMETHOD(OnLogListen) (THIS) PURE;
+	STDMETHOD(OnLogDisconnection) (THIS) PURE;
+	STDMETHOD(OnLogError) (THIS) PURE;
+};
+typedef IDccManSink *LPDCCMANSINK;
+
+#undef  INTERFACE
+#define INTERFACE   IDccMan
+
+DECLARE_INTERFACE_ (IDccMan,  IUnknown)
+{
+    STDMETHOD(Advise) (THIS_
+		IN	IDccManSink * pDccSink,	// The advise sink that is requesting notification
+		OUT DWORD * pdwContext		// Identifies the context for future calls to the Unadvise method
+	) PURE;
+	
+	STDMETHOD(Unadvise) (THIS_
+		DWORD dwContext				// As returned by Advise()
+	) PURE;
+   
+	STDMETHOD(ShowCommSettings) (THIS) PURE;	// Displays the Communication Property Sheet on the screen
+												// If a connection is active, the sheet is in read-only mode
+	STDMETHOD(AutoconnectEnable) (THIS) PURE;
+	STDMETHOD(AutoconnectDisable) (THIS) PURE;
+
+	STDMETHOD(ConnectNow) (THIS) PURE;			// Active only when Autoconnect is Disabled
+	STDMETHOD(DisconnectNow) (THIS) PURE;		// Active only when Autoconnect is Disabled
+	
+	STDMETHOD(SetIconDataTransferring) (THIS) PURE;
+	STDMETHOD(SetIconNoDataTransferring) (THIS) PURE;
+	STDMETHOD(SetIconError) (THIS) PURE;
+};
+typedef IDccMan *LPDCCMAN;
+
+
+#endif /* end, ifdef _DCCOLEH_  */
+
+#ifdef __cplusplus
+}
+#endif  /* __cplusplus */
+

Added: trunk/src/Installer_BC/include/dccole2.h
===================================================================
--- trunk/src/Installer_BC/include/dccole2.h	                        (rev 0)
+++ trunk/src/Installer_BC/include/dccole2.h	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,109 @@
+/*++
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+Module Name:
+
+    dccole2.h
+
+Abstract:
+
+    This file defines OLE interface to the DCCMAN module (Desktop Only). 
+    It includes the old interfaces from dccole.h and contains 
+    a new IDCCManSink2 interface for IPv6 support.
+    
+Environment:
+
+    User Mode - Win32
+
+--*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+// {A7B88840-A812-11cf-8011-00A0C90A8F78}
+DEFINE_GUID(IID_IDccManSink, 
+0xa7b88840, 0xa812, 0x11cf, 0x80, 0x11, 0x0, 0xa0, 0xc9, 0xa, 0x8f, 0x78);
+// {A7B88841-A812-11cf-8011-00A0C90A8F78}
+DEFINE_GUID(IID_IDccMan, 
+0xa7b88841, 0xa812, 0x11cf, 0x80, 0x11, 0x0, 0xa0, 0xc9, 0xa, 0x8f, 0x78);
+// {499C0C20-A766-11cf-8011-00A0C90A8F78}
+DEFINE_GUID(CLSID_DccMan, 
+0x499c0c20, 0xa766, 0x11cf, 0x80, 0x11, 0x0, 0xa0, 0xc9, 0xa, 0x8f, 0x78);
+
+// {1317003A-9A62-4040-98F1-9CE9EFD8298B}
+DEFINE_GUID(IID_IDccManSink2, 
+0x1317003a, 0x9a62, 0x4040, 0x98, 0xf1, 0x9c, 0xe9, 0xef, 0xd8, 0x29, 0x8b);
+
+#ifndef _DCCOLEH_
+#define _DCCOLEH_
+
+#undef  INTERFACE
+#define INTERFACE   IDccManSink
+
+DECLARE_INTERFACE_ (IDccManSink,  IUnknown)
+{
+ 	// These methods corespond to GW_LOG messages generated by the Win95 DCC
+    STDMETHOD(OnLogIpAddr) (THIS_ DWORD dwIpAddr) PURE;
+    STDMETHOD(OnLogTerminated) (THIS) PURE;
+    STDMETHOD(OnLogActive) (THIS) PURE;
+	STDMETHOD(OnLogInactive) (THIS) PURE;
+	STDMETHOD(OnLogAnswered) (THIS) PURE;
+	STDMETHOD(OnLogListen) (THIS) PURE;
+	STDMETHOD(OnLogDisconnection) (THIS) PURE;
+	STDMETHOD(OnLogError) (THIS) PURE;
+};
+typedef IDccManSink *LPDCCMANSINK;
+
+#undef  INTERFACE
+#define INTERFACE   IDccMan
+
+DECLARE_INTERFACE_ (IDccMan,  IUnknown)
+{
+    STDMETHOD(Advise) (THIS_
+		IN	IDccManSink * pDccSink,	// The advise sink that is requesting notification
+		OUT DWORD * pdwContext		// Identifies the context for future calls to the Unadvise method
+	) PURE;
+	
+	STDMETHOD(Unadvise) (THIS_
+		DWORD dwContext				// As returned by Advise()
+	) PURE;
+   
+	STDMETHOD(ShowCommSettings) (THIS) PURE;	// Displays the Communication Property Sheet on the screen
+												// If a connection is active, the sheet is in read-only mode
+	STDMETHOD(AutoconnectEnable) (THIS) PURE;
+	STDMETHOD(AutoconnectDisable) (THIS) PURE;
+
+	STDMETHOD(ConnectNow) (THIS) PURE;			// Active only when Autoconnect is Disabled
+	STDMETHOD(DisconnectNow) (THIS) PURE;		// Active only when Autoconnect is Disabled
+	
+	STDMETHOD(SetIconDataTransferring) (THIS) PURE;
+	STDMETHOD(SetIconNoDataTransferring) (THIS) PURE;
+	STDMETHOD(SetIconError) (THIS) PURE;
+};
+typedef IDccMan *LPDCCMAN;
+
+#endif /* end, ifdef _DCCOLEH_  */
+
+//================ New Sink Interface for IPv6 support ========================
+#ifndef _DCCOLE2H_
+#define _DCCOLE2H_
+
+#include <winsock2.h>
+#undef  INTERFACE
+#define INTERFACE   IDccManSink2
+
+DECLARE_INTERFACE_ (IDccManSink2,  IDccManSink)
+{
+    STDMETHOD(OnLogIpAddrEx) (THIS_ const SOCKADDR_STORAGE* pIpAddr) PURE;
+};
+typedef IDccManSink2 *LPDCCMANSINK2;
+
+#endif /*_DCCOLE2H_*/
+
+
+#ifdef __cplusplus
+}
+#endif  /* __cplusplus */
+

Added: trunk/src/Installer_BC/include/rapi.h
===================================================================
--- trunk/src/Installer_BC/include/rapi.h	                        (rev 0)
+++ trunk/src/Installer_BC/include/rapi.h	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,441 @@
+// --------------------------------------------------------------------------
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// Module:
+//
+//     rapi.h
+//
+// Purpose:
+//
+//    Master include file for Windows CE Remote API
+//
+// --------------------------------------------------------------------------
+
+#ifndef RAPI_H
+#define RAPI_H
+
+#include <windows.h>
+
+//
+// The Windows CE WIN32_FIND_DATA structure differs from the
+// Windows WIN32_FIND_DATA stucture so we copy the Windows CE
+// definition to here so that both sides match.
+//
+typedef struct _CE_FIND_DATA {
+    DWORD    dwFileAttributes;
+    FILETIME ftCreationTime;
+    FILETIME ftLastAccessTime;
+    FILETIME ftLastWriteTime;
+    DWORD    nFileSizeHigh;
+    DWORD    nFileSizeLow;
+    DWORD    dwOID;
+    WCHAR    cFileName[MAX_PATH];
+} CE_FIND_DATA, *LPCE_FIND_DATA;
+
+typedef CE_FIND_DATA** LPLPCE_FIND_DATA;
+
+//
+// These are flags for CeFindAllFiles
+//
+#define FAF_ATTRIBUTES      ((DWORD) 0x01)
+#define FAF_CREATION_TIME   ((DWORD) 0x02)
+#define FAF_LASTACCESS_TIME ((DWORD) 0x04)
+#define FAF_LASTWRITE_TIME  ((DWORD) 0x08)
+#define FAF_SIZE_HIGH       ((DWORD) 0x10)
+#define FAF_SIZE_LOW        ((DWORD) 0x20)
+#define FAF_OID             ((DWORD) 0x40)
+#define FAF_NAME            ((DWORD) 0x80)
+#define FAF_FLAG_COUNT      ((UINT)  8)
+#define FAF_ATTRIB_CHILDREN ((DWORD)			0x01000)
+#define FAF_ATTRIB_NO_HIDDEN ((DWORD)			0x02000)
+#define FAF_FOLDERS_ONLY    ((DWORD)			0x04000)
+#define FAF_NO_HIDDEN_SYS_ROMMODULES ((DWORD)	0x08000)
+#define FAF_GETTARGET	    ((DWORD)			0x10000)
+
+#define FAD_OID             ((WORD) 0x01)
+#define FAD_FLAGS           ((WORD) 0x02)
+#define FAD_NAME            ((WORD) 0x04)
+#define FAD_TYPE            ((WORD) 0x08)
+#define FAD_NUM_RECORDS     ((WORD) 0x10)
+#define FAD_NUM_SORT_ORDER  ((WORD) 0x20)
+#define FAD_SIZE            ((WORD) 0x40)
+#define FAD_LAST_MODIFIED   ((WORD) 0x80)
+#define FAD_SORT_SPECS      ((WORD) 0x100)
+#define FAD_FLAG_COUNT      ((UINT) 9)
+
+#ifndef FILE_ATTRIBUTE_INROM
+#define FILE_ATTRIBUTE_INROM        0x00000040
+#endif
+#ifndef FILE_ATTRIBUTE_ROMSTATICREF
+#define FILE_ATTRIBUTE_ROMSTATICREF 0x00001000
+#endif
+#ifndef FILE_ATTRIBUTE_ROMMODULE
+#define FILE_ATTRIBUTE_ROMMODULE    0x00002000
+#endif
+
+//
+// The following is not a standard Windows CE File Attribute.
+//
+#ifndef FILE_ATTRIBUTE_HAS_CHILDREN
+#define FILE_ATTRIBUTE_HAS_CHILDREN 0x00010000
+#endif
+#ifndef FILE_ATTRIBUTE_SHORTCUT
+#define FILE_ATTRIBUTE_SHORTCUT		0x00020000
+#endif
+
+#undef  INTERFACE
+#define INTERFACE   IRAPIStream
+
+typedef enum tagRAPISTREAMFLAG
+{
+	STREAM_TIMEOUT_READ
+} RAPISTREAMFLAG;
+
+DECLARE_INTERFACE_ (IRAPIStream,  IStream)
+{
+		STDMETHOD(SetRapiStat)( THIS_ RAPISTREAMFLAG Flag, DWORD dwValue) PURE;
+		STDMETHOD(GetRapiStat)( THIS_ RAPISTREAMFLAG Flag, DWORD *pdwValue) PURE;
+};
+
+// RAPI extension on Windows CE (e.g., MyFunctionFOO) called via CeRapiInvoke should be declared as:
+// EXTERN_C RAPIEXT MyFunctionFOO;
+typedef  HRESULT (STDAPICALLTYPE RAPIEXT)(
+		 DWORD			cbInput,			// [IN]
+		 BYTE			*pInput,			// [IN]
+		 DWORD			*pcbOutput,	 		// [OUT]
+		 BYTE			**ppOutput,			// [OUT]
+		 IRAPIStream	*pIRAPIStream		// [IN]
+		 );
+
+//
+// The following definitions are for the client side only,
+// because they are already defined on Windows CE.
+//
+#ifndef UNDER_CE
+
+#include <stddef.h>
+
+typedef struct STORE_INFORMATION {
+	DWORD dwStoreSize;
+	DWORD dwFreeSize;
+} STORE_INFORMATION, *LPSTORE_INFORMATION;
+
+typedef DWORD CEPROPID;
+typedef CEPROPID *PCEPROPID;
+#define TypeFromPropID(propid) LOWORD(propid)
+
+typedef DWORD CEOID;
+typedef CEOID *PCEOID;
+
+typedef struct  _CEGUID {
+    DWORD Data1;
+	DWORD Data2;
+	DWORD Data3;
+	DWORD Data4;
+}	CEGUID;
+typedef CEGUID *PCEGUID;
+
+typedef struct _CENOTIFICATION {
+	DWORD dwSize;
+	DWORD dwParam;
+	UINT  uType;
+	CEGUID guid;
+	CEOID  oid;
+	CEOID  oidParent;
+} CENOTIFICATION;
+
+#define CEDB_EXNOTIFICATION	0x00000001
+typedef struct _CENOTIFYREQUEST {
+    DWORD dwSize;
+    HWND  hwnd;
+    DWORD dwFlags;
+    HANDLE hHeap;
+	DWORD  dwParam;
+} CENOTIFYREQUEST;
+typedef CENOTIFYREQUEST *PCENOTIFYREQUEST;
+
+typedef struct _CEFILEINFO {
+    DWORD   dwAttributes;
+    CEOID   oidParent;
+    WCHAR   szFileName[MAX_PATH];
+    FILETIME ftLastChanged;
+    DWORD   dwLength;
+} CEFILEINFO;
+
+typedef struct _CEDIRINFO {
+    DWORD   dwAttributes;
+    CEOID   oidParent;
+    WCHAR   szDirName[MAX_PATH];
+} CEDIRINFO;
+
+typedef struct _CERECORDINFO {
+    CEOID  oidParent;
+} CERECORDINFO;
+
+#define CEDB_SORT_DESCENDING        0x00000001
+#define CEDB_SORT_CASEINSENSITIVE   0x00000002
+#define CEDB_SORT_UNKNOWNFIRST      0x00000004
+#define CEDB_SORT_GENERICORDER      0x00000008
+
+typedef struct _SORTORDERSPEC {
+    CEPROPID  propid;
+    DWORD     dwFlags;
+} SORTORDERSPEC;
+
+#define CEDB_MAXDBASENAMELEN  32
+#define CEDB_MAXSORTORDER     4
+
+#define CEDB_VALIDNAME      0x0001
+#define CEDB_VALIDTYPE      0x0002
+#define CEDB_VALIDSORTSPEC  0x0004
+#define CEDB_VALIDMODTIME   0x0008
+#define CEDB_VALIDDBFLAGS   0x0010
+#define CEDB_VALIDCREATE (CEDB_VALIDNAME|CEDB_VALIDTYPE|CEDB_VALIDSORTSPEC|CEDB_VALIDDBFLAGS)
+
+#define CEDB_NOCOMPRESS     0x00010000
+
+typedef struct _CEDBASEINFO {
+    DWORD   dwFlags;
+    WCHAR   szDbaseName[CEDB_MAXDBASENAMELEN];
+    DWORD   dwDbaseType;
+    WORD    wNumRecords;
+    WORD    wNumSortOrder;
+    DWORD   dwSize;
+    FILETIME ftLastModified;
+    SORTORDERSPEC rgSortSpecs[CEDB_MAXSORTORDER];
+} CEDBASEINFO;
+
+typedef struct _CEDB_FIND_DATA {
+    CEOID       OidDb;
+    CEDBASEINFO DbInfo;
+} CEDB_FIND_DATA, *LPCEDB_FIND_DATA;
+
+typedef CEDB_FIND_DATA ** LPLPCEDB_FIND_DATA;
+
+#define OBJTYPE_INVALID     0
+#define OBJTYPE_FILE        1
+#define OBJTYPE_DIRECTORY   2
+#define OBJTYPE_DATABASE    3
+#define OBJTYPE_RECORD      4
+
+typedef struct _CEOIDINFO {
+    WORD  wObjType;
+    WORD  wPad;
+    union {
+        CEFILEINFO   infFile;
+        CEDIRINFO    infDirectory;
+        CEDBASEINFO  infDatabase;
+        CERECORDINFO infRecord;
+    };
+} CEOIDINFO;
+
+#define CEDB_AUTOINCREMENT      0x00000001
+
+#define CEDB_SEEK_CEOID         0x00000001
+#define CEDB_SEEK_BEGINNING     0x00000002
+#define CEDB_SEEK_END           0x00000004
+#define CEDB_SEEK_CURRENT       0x00000008
+#define CEDB_SEEK_VALUESMALLER     0x00000010
+#define CEDB_SEEK_VALUEFIRSTEQUAL  0x00000020
+#define CEDB_SEEK_VALUEGREATER     0x00000040
+#define CEDB_SEEK_VALUENEXTEQUAL   0x00000080
+
+typedef struct _CEBLOB {
+    DWORD       dwCount;
+    LPBYTE      lpb;
+} CEBLOB;
+
+#define CEVT_I2       2
+#define CEVT_UI2      18
+#define CEVT_I4       3
+#define CEVT_UI4      19
+#define CEVT_FILETIME 64
+#define CEVT_LPWSTR   31
+#define CEVT_BLOB     65
+#define CEVT_BOOL     11
+#define	CEVT_R8       5
+
+typedef union _CEVALUNION {
+    short           iVal;
+    USHORT          uiVal;
+    long            lVal;
+    ULONG           ulVal;
+    FILETIME        filetime;
+    LPWSTR          lpwstr;
+    CEBLOB          blob;
+    BOOL            boolVal;
+    double          dblVal;
+} CEVALUNION;
+ 
+#define CEDB_PROPNOTFOUND 0x0100
+#define CEDB_PROPDELETE   0x0200
+typedef struct _CEPROPVAL {
+    CEPROPID    propid;
+    WORD        wLenData;
+    WORD        wFlags;
+    CEVALUNION  val;
+} CEPROPVAL, *PCEPROPVAL;
+
+#define CEDB_MAXDATABLOCKSIZE  4092
+#define CEDB_MAXPROPDATASIZE   (CEDB_MAXDATABLOCKSIZE*16)
+#define CEDB_MAXRECORDSIZE     (128*1024)
+
+#define CEDB_ALLOWREALLOC  0x00000001
+
+#define CREATE_SYSTEMGUID(pguid) (memset((pguid), 0, sizeof(CEGUID)))
+#define CREATE_INVALIDGUID(pguid) (memset((pguid), -1, sizeof(CEGUID)))
+
+#define CHECK_SYSTEMGUID(pguid) !((pguid)->Data1|(pguid)->Data2|(pguid)->Data3|(pguid)->Data4)
+#define CHECK_INVALIDGUID(pguid) !~((pguid)->Data1&(pguid)->Data2&(pguid)->Data3&(pguid)->Data4)
+
+#define SYSMEM_CHANGED	0
+#define SYSMEM_MUSTREBOOT 1
+#define SYSMEM_REBOOTPENDING 2
+#define SYSMEM_FAILED 3
+
+typedef struct _CEOSVERSIONINFO{
+    DWORD dwOSVersionInfoSize; 
+    DWORD dwMajorVersion; 
+    DWORD dwMinorVersion; 
+    DWORD dwBuildNumber; 
+    DWORD dwPlatformId; 
+    WCHAR szCSDVersion[ 128 ]; 
+} CEOSVERSIONINFO, *LPCEOSVERSIONINFO;
+
+#define AC_LINE_OFFLINE                 0x00
+#define AC_LINE_ONLINE                  0x01
+#define AC_LINE_BACKUP_POWER            0x02
+#define AC_LINE_UNKNOWN                 0xFF
+
+#define BATTERY_FLAG_HIGH               0x01
+#define BATTERY_FLAG_LOW                0x02
+#define BATTERY_FLAG_CRITICAL           0x04
+#define BATTERY_FLAG_CHARGING           0x08
+#define BATTERY_FLAG_NO_BATTERY         0x80
+#define BATTERY_FLAG_UNKNOWN            0xFF
+
+#define BATTERY_PERCENTAGE_UNKNOWN      0xFF
+
+#define BATTERY_LIFE_UNKNOWN        0xFFFFFFFF
+
+typedef struct _SYSTEM_POWER_STATUS_EX {
+    BYTE ACLineStatus;
+    BYTE BatteryFlag;
+    BYTE BatteryLifePercent;
+    BYTE Reserved1;
+    DWORD BatteryLifeTime;
+    DWORD BatteryFullLifeTime;
+    BYTE Reserved2;
+    BYTE BackupBatteryFlag;
+    BYTE BackupBatteryLifePercent;
+    BYTE Reserved3;
+    DWORD BackupBatteryLifeTime;
+    DWORD BackupBatteryFullLifeTime;
+}   SYSTEM_POWER_STATUS_EX, *PSYSTEM_POWER_STATUS_EX, *LPSYSTEM_POWER_STATUS_EX;
+
+//
+// MessageId: CERAPI_E_ALREADYINITIALIZED
+//
+//  CeRapiInit(Ex) has already been successfully called
+//
+#define CERAPI_E_ALREADYINITIALIZED     0x80041001
+
+typedef struct _RAPIINIT
+{
+    DWORD cbSize;
+    HANDLE heRapiInit;
+    HRESULT hrRapiInit;
+} RAPIINIT;
+
+STDAPI CeRapiInitEx(RAPIINIT*);
+STDAPI CeRapiInit();
+STDAPI CeRapiUninit();
+STDAPI CeRapiGetError(void);
+STDAPI CeRapiFreeBuffer(LPVOID);
+STDAPI_( HRESULT ) CeRapiInvoke(LPCWSTR, LPCWSTR,DWORD,BYTE *, DWORD *,BYTE **, IRAPIStream **,DWORD);
+
+STDAPI_(CEOID)  CeCreateDatabase     (LPWSTR, DWORD, WORD, SORTORDERSPEC*);
+STDAPI_(BOOL  ) CeDeleteDatabase     (CEOID);
+STDAPI_(BOOL  ) CeDeleteRecord       (HANDLE, CEOID);
+STDAPI_(HANDLE) CeFindFirstDatabase  (DWORD);
+STDAPI_(CEOID)  CeFindNextDatabase    (HANDLE);
+STDAPI_(BOOL  ) CeOidGetInfo         (CEOID, CEOIDINFO*);
+STDAPI_(HANDLE) CeOpenDatabase       (PCEOID, LPWSTR, CEPROPID, DWORD, HWND);
+STDAPI_(CEOID)  CeReadRecordProps    (HANDLE, DWORD, LPWORD, CEPROPID*, LPBYTE*, LPDWORD);
+STDAPI_(CEOID)  CeSeekDatabase       (HANDLE, DWORD, DWORD, LPDWORD);
+STDAPI_(BOOL  ) CeSetDatabaseInfo    (CEOID, CEDBASEINFO*);
+STDAPI_(CEOID)  CeWriteRecordProps   (HANDLE, CEOID, WORD, CEPROPVAL*);
+STDAPI_(HANDLE) CeFindFirstFile      (LPCWSTR, LPCE_FIND_DATA);
+STDAPI_(BOOL  ) CeFindNextFile       (HANDLE, LPCE_FIND_DATA);
+STDAPI_(BOOL  ) CeFindClose          (HANDLE);
+STDAPI_(DWORD ) CeGetFileAttributes  (LPCWSTR);
+STDAPI_(BOOL  ) CeSetFileAttributes  (LPCWSTR, DWORD);
+STDAPI_(HANDLE) CeCreateFile         (LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
+STDAPI_(BOOL  ) CeReadFile           (HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED);
+STDAPI_(BOOL  ) CeWriteFile          (HANDLE, LPCVOID, DWORD, LPDWORD, LPOVERLAPPED);
+STDAPI_(BOOL  ) CeCloseHandle        (HANDLE);
+STDAPI_(BOOL  ) CeFindAllFiles       (LPCWSTR, DWORD, LPDWORD, LPLPCE_FIND_DATA);
+STDAPI_(BOOL  ) CeFindAllDatabases   (DWORD, WORD, LPWORD, LPLPCEDB_FIND_DATA);
+STDAPI_(DWORD ) CeGetLastError       (void);
+STDAPI_(DWORD ) CeSetFilePointer     (HANDLE, LONG, PLONG, DWORD);
+STDAPI_(BOOL  ) CeSetEndOfFile       (HANDLE);
+STDAPI_(BOOL  ) CeCreateDirectory    (LPCWSTR, LPSECURITY_ATTRIBUTES);
+STDAPI_(BOOL  ) CeRemoveDirectory    (LPCWSTR);
+STDAPI_(BOOL  ) CeCreateProcess      (LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPWSTR, LPSTARTUPINFO, LPPROCESS_INFORMATION);
+STDAPI_(BOOL  ) CeMoveFile           (LPCWSTR, LPCWSTR);
+STDAPI_(BOOL  ) CeCopyFile           (LPCWSTR, LPCWSTR, BOOL);
+STDAPI_(BOOL  ) CeDeleteFile         (LPCWSTR);
+STDAPI_(DWORD ) CeGetFileSize        (HANDLE, LPDWORD);
+STDAPI_(LONG  ) CeRegOpenKeyEx       (HKEY, LPCWSTR, DWORD, REGSAM, PHKEY);
+STDAPI_(LONG  ) CeRegEnumKeyEx       (HKEY, DWORD, LPWSTR, LPDWORD, LPDWORD, LPWSTR, LPDWORD, PFILETIME);
+STDAPI_(LONG  ) CeRegCreateKeyEx     (HKEY, LPCWSTR, DWORD, LPWSTR, DWORD, REGSAM, LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD);
+STDAPI_(LONG  ) CeRegCloseKey        (HKEY);
+STDAPI_(LONG  ) CeRegDeleteKey       (HKEY, LPCWSTR);
+STDAPI_(LONG  ) CeRegEnumValue       (HKEY, DWORD, LPWSTR, LPDWORD, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
+STDAPI_(LONG  ) CeRegDeleteValue     (HKEY, LPCWSTR);
+STDAPI_(LONG  ) CeRegQueryInfoKey    (HKEY, LPWSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, PFILETIME);
+STDAPI_(LONG  ) CeRegQueryValueEx    (HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
+STDAPI_(LONG  ) CeRegSetValueEx      (HKEY, LPCWSTR, DWORD, DWORD, LPBYTE, DWORD);
+STDAPI_(BOOL  ) CeGetStoreInformation(LPSTORE_INFORMATION);
+STDAPI_(INT   ) CeGetSystemMetrics   (INT);
+STDAPI_(INT   ) CeGetDesktopDeviceCaps(INT);
+STDAPI_(VOID  ) CeGetSystemInfo      (LPSYSTEM_INFO);
+STDAPI_(DWORD ) CeSHCreateShortcut   (LPWSTR, LPWSTR);
+STDAPI_(BOOL  ) CeSHGetShortcutTarget(LPWSTR, LPWSTR, INT);
+STDAPI_(BOOL  ) CeCheckPassword      (LPWSTR);
+STDAPI_(BOOL  ) CeGetFileTime        (HANDLE, LPFILETIME, LPFILETIME, LPFILETIME);
+STDAPI_(BOOL  ) CeSetFileTime        (HANDLE, LPFILETIME, LPFILETIME, LPFILETIME);
+STDAPI_(BOOL  ) CeGetVersionEx       (LPCEOSVERSIONINFO);
+STDAPI_(HWND  ) CeGetWindow          (HWND, UINT);
+STDAPI_(LONG  ) CeGetWindowLong      (HWND, int);
+STDAPI_(int   ) CeGetWindowText      (HWND, LPWSTR, int);
+STDAPI_(int   ) CeGetClassName       (HWND, LPWSTR, int);
+STDAPI_(VOID  ) CeGlobalMemoryStatus (LPMEMORYSTATUS);
+STDAPI_(BOOL  ) CeGetSystemPowerStatusEx(PSYSTEM_POWER_STATUS_EX, BOOL);
+STDAPI_(DWORD ) CeGetTempPath        (DWORD, LPWSTR);
+STDAPI_(DWORD ) CeGetSpecialFolderPath(int, DWORD, LPWSTR);
+STDAPI_(HANDLE) CeFindFirstDatabaseEx (PCEGUID, DWORD);
+STDAPI_(CEOID ) CeFindNextDatabaseEx (HANDLE, PCEGUID);
+STDAPI_(CEOID ) CeCreateDatabaseEx   (PCEGUID, CEDBASEINFO*);
+STDAPI_(BOOL  ) CeSetDatabaseInfoEx  (PCEGUID, CEOID, CEDBASEINFO*);
+STDAPI_(HANDLE) CeOpenDatabaseEx     (PCEGUID, PCEOID, LPWSTR, CEPROPID, DWORD, CENOTIFYREQUEST *);
+STDAPI_(BOOL  ) CeDeleteDatabaseEx   (PCEGUID, CEOID);
+STDAPI_(CEOID ) CeReadRecordPropsEx  (HANDLE, DWORD, LPWORD, CEPROPID*, LPBYTE*, LPDWORD, HANDLE);
+STDAPI_(CEOID ) CeWriteRecordProps   (HANDLE, CEOID, WORD, CEPROPVAL*);
+STDAPI_(BOOL  ) CeMountDBVol         (PCEGUID, LPWSTR, DWORD);
+STDAPI_(BOOL  ) CeUnmountDBVol       (PCEGUID);
+STDAPI_(BOOL  ) CeFlushDBVol         (PCEGUID);
+STDAPI_(BOOL  ) CeEnumDBVolumes      (PCEGUID, LPWSTR, DWORD);
+STDAPI_(BOOL  ) CeOidGetInfoEx       (PCEGUID, CEOID, CEOIDINFO*);
+
+
+#endif // #ifndef UNDER_CE
+
+#include <ceapimap.h>
+
+#ifdef CONN_INTERNAL
+#include <prapi.h>  // internal defines
+#endif
+
+#endif // #ifndef RAPI_H

Added: trunk/src/Installer_BC/include/replerr.h
===================================================================
--- trunk/src/Installer_BC/include/replerr.h	                        (rev 0)
+++ trunk/src/Installer_BC/include/replerr.h	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,25 @@
+/****************************************************************************
+*                                                                           *
+* replerr.h -- Pegasus filter error codes                                   *
+*                                                                           *
+* Copyright (c) Microsoft Corporation. All rights reserved.		            *
+*                                                                           *
+****************************************************************************/
+
+#ifndef _REPLERR_
+#define _REPLERR_
+
+/*
+ * Define how errors are declared
+ */
+#define CF_DECLARE_ERROR(e)  (0x80040000 | e)
+#define PF_DECLARE_ERROR(e)  CF_DECLARE_ERROR(e)
+
+/*
+ * Predefined error messages
+ */
+#define ERROR_ALREADYCONVERTING  CF_DECLARE_ERROR(0x5000)  // conversion is not reentrant
+#define ERROR_UNKNOWNCONVERSION  CF_DECLARE_ERROR(0x5001)  // conversion is not recognized by converter dll
+#define ERROR_BADFILE            CF_DECLARE_ERROR(0x5002)  // generic error that indicates that the format of a file was not understood
+
+#endif /* !_REPLERR_ */

Added: trunk/src/Installer_BC/include/replfilt.h
===================================================================
--- trunk/src/Installer_BC/include/replfilt.h	                        (rev 0)
+++ trunk/src/Installer_BC/include/replfilt.h	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,183 @@
+/****************************************************************************
+*                                                                           *
+* replfilt.h -- Pegasus filter procedure declarations, structures,          *
+*               constant definitions and macros                             *
+*                                                                           *
+* Copyright (c) Microsoft Corporation. All rights reserved.		            *
+*                                                                           *
+****************************************************************************/
+
+// {6C5C05E0-97A2-11cf-8011-00A0C90A8F78}
+DEFINE_GUID(IID_ICeFileFilterSite, 
+0x6c5c05e0, 0x97a2, 0x11cf, 0x80, 0x11, 0x0, 0xa0, 0xc9, 0xa, 0x8f, 0x78);
+// {6C5C05E1-97A2-11cf-8011-00A0C90A8F78}
+DEFINE_GUID(IID_ICeFileFilter, 
+0x6c5c05e1, 0x97a2, 0x11cf, 0x80, 0x11, 0x0, 0xa0, 0xc9, 0xa, 0x8f, 0x78);
+// {6C5C05E2-97A2-11cf-8011-00A0C90A8F78}
+DEFINE_GUID(IID_ICeFileFilterOptions, 
+0x6c5c05e2, 0x97a2, 0x11cf, 0x80, 0x11, 0x0, 0xa0, 0xc9, 0xa, 0x8f, 0x78);
+
+#ifndef _REPLFILT_
+#define _REPLFILT_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef LONG CF_ERROR;
+
+#define HRESULT_TO_CFERROR(_hr, _def) \
+    (SUCCEEDED(_hr) ? ERROR_SUCCESS : (HRESULT_FACILITY(_hr)==FACILITY_WIN32 ? HRESULT_CODE(_hr) : (_def)))
+
+//
+// ICeFileFilterSite interface provided by Windows CE Services
+//
+#undef  INTERFACE
+#define INTERFACE   ICeFileFilterSite
+
+DECLARE_INTERFACE_(ICeFileFilterSite, IUnknown)
+{
+    // *** IUnknown methods ***
+    STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
+    STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
+    STDMETHOD_(ULONG, Release) (THIS) PURE;
+
+    // *** ICeFileFilterSite methods ***
+	STDMETHOD(OpenSourceFile) (THIS_
+		int nHowToOpenFile,
+		LPVOID *ppObj
+	) PURE; 
+	STDMETHOD(OpenDestinationFile) (THIS_
+		int nHowToOpenFile,
+        LPCTSTR pszFullpath,
+		LPVOID *ppObj
+	) PURE; 
+	STDMETHOD(CloseSourceFile) (THIS_
+		LPUNKNOWN pObj
+	) PURE; 
+	STDMETHOD(CloseDestinationFile) (THIS_
+    	BOOL bKeepFile,
+		LPUNKNOWN pObj
+	) PURE; 
+	STDMETHOD(ReportProgress) (THIS_
+	    UINT nPercent
+	) PURE; 
+	STDMETHOD(ReportLoss) (THIS_
+	    DWORD dw,
+    	LPCTSTR psz,
+    	va_list args
+	) PURE; 
+};
+
+
+//
+// Structures passed to ICeFileFilter methods
+//
+typedef struct tagCFF_CONVERTINFO
+{
+    BOOL bImport;
+    HWND hwndParent;
+    BOOL bYesToAll;
+	ICeFileFilterSite *pffs;
+} CFF_CONVERTINFO; 
+
+typedef struct tagCFF_DESTINATIONFILE
+{
+    TCHAR szFullpath[_MAX_PATH];
+    TCHAR szPath[_MAX_PATH];
+    TCHAR szFilename[_MAX_FNAME];
+    TCHAR szExtension[_MAX_EXT];
+} CFF_DESTINATIONFILE; 
+
+typedef struct tagCFF_SOURCEFILE
+{
+    TCHAR szFullpath[_MAX_PATH];
+    TCHAR szPath[_MAX_PATH];
+    TCHAR szFilename[_MAX_FNAME];
+    TCHAR szExtension[_MAX_EXT];
+    DWORD cbSize;
+    FILETIME ftCreated;
+    FILETIME ftModified;
+} CFF_SOURCEFILE; 
+
+
+//
+// ICeFileFilter interface to be implemented by a file filter
+//
+#undef  INTERFACE
+#define INTERFACE   ICeFileFilter
+
+DECLARE_INTERFACE_(ICeFileFilter, IUnknown)
+{
+    // *** IUnknown methods ***
+    STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
+    STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
+    STDMETHOD_(ULONG, Release) (THIS) PURE;
+
+    // *** ICeFileFilter methods ***
+	STDMETHOD(NextConvertFile) (THIS_
+        int nConversion,
+	    CFF_CONVERTINFO* pci,
+		CFF_SOURCEFILE* psf,
+	    CFF_DESTINATIONFILE* pdf,
+	    volatile BOOL *pbCancel,
+        CF_ERROR *perr
+	) PURE;
+	STDMETHOD(FilterOptions) (THIS_
+	    HWND hwndParent
+	) PURE; 
+    STDMETHOD(FormatMessage) (THIS_
+        DWORD  dwFlags,
+        DWORD  dwMessageId,
+        DWORD  dwLanguageId,
+        LPTSTR  lpBuffer,
+        DWORD  nSize,
+        va_list *  Arguments,
+        DWORD  *pcb
+    ) PURE;
+};
+
+
+/*
+ * Flags for how to open files
+ */
+#define CF_OPENFLAT      0
+#define CF_OPENCOMPOUND  1
+#define CF_OPENDONT      2
+#define CF_OPENASKMEHOW  3
+
+//
+// Structures passed to ICeFileFilterOptions methods
+//
+typedef struct tagCFF_CONVERTOPTIONS
+{
+    ULONG   cbSize;
+    BOOL    bNoModalUI;
+} CFF_CONVERTOPTIONS; 
+
+
+//
+// ICeFileFilterOptions interface to be implemented by a v2 file filter
+//
+#undef  INTERFACE
+#define INTERFACE   ICeFileFilterOptions
+
+DECLARE_INTERFACE_(ICeFileFilterOptions, IUnknown)
+{
+    // *** IUnknown methods ***
+    STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
+    STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
+    STDMETHOD_(ULONG, Release) (THIS) PURE;
+
+    // *** ICeFileFilterOptions methods ***
+	STDMETHOD(SetFilterOptions) (THIS_
+	    CFF_CONVERTOPTIONS* pco
+	) PURE; 
+};
+
+#ifdef __cplusplus
+}
+#endif  /* __cplusplus */
+
+#include <CeFltMap.h>
+#endif /* !_REPLFILT_ */

Added: trunk/src/Installer_BC/lib/rapi_S.lib
===================================================================
(Binary files differ)


Property changes on: trunk/src/Installer_BC/lib/rapi_S.lib
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/Installer_BC/utils.cpp
===================================================================
--- trunk/src/Installer_BC/utils.cpp	                        (rev 0)
+++ trunk/src/Installer_BC/utils.cpp	2008-02-06 14:23:58 UTC (rev 92)
@@ -0,0 +1,91 @@
+//---------------------------------------------------------------------------
+
+#include <windows.h>
+#pragma hdrstop
+
+//---------------------------------------------------------------------------
+
+#pragma argsused
+
+#include <windows.h>
+#include <tchar.h>
+#include <rapi.h>
+#include <dirent.h>
+#include <dir.h>
+#include <stdio.h>
+
+
+BOOL IsDots(const CHAR* str) {
+   if(strcmp(str,".") && strcmp(str,"..")) return FALSE;
+   return TRUE;
+}
+
+
+BOOL DeleteDirectory(const CHAR* sPath) {
+   HANDLE hFind;    // file handle
+   WIN32_FIND_DATA FindFileData;
+
+   TCHAR DirPath[MAX_PATH];
+   TCHAR FileName[MAX_PATH];
+
+   strcpy(DirPath,sPath);
+   strcat(DirPath,"\\*");    // searching all files
+   strcpy(FileName,sPath);
+   strcat(FileName,"\\");
+
+   // find the first file
+   hFind = FindFirstFile(DirPath,&FindFileData);
+   if(hFind == INVALID_HANDLE_VALUE) return FALSE;
+   strcpy(DirPath,FileName);
+
+   bool bSearch = true;
+   while(bSearch) {    // until we find an entry
+      if(FindNextFile(hFind,&FindFileData)) {
+		 if(IsDots(FindFileData.cFileName)) continue;
+		 strcat(FileName,FindFileData.cFileName);
+         if((FindFileData.dwFileAttributes &
+            FILE_ATTRIBUTE_DIRECTORY)) {
+
+            // we have found a directory, recurse
+            if(!DeleteDirectory(FileName)) {
+                FindClose(hFind);
+                return FALSE;    // directory couldn't be deleted
+            }
+            // remove the empty directory
+            RemoveDirectory(FileName);
+			 strcpy(FileName,DirPath);
+         }
+         else {
+                  if(!DeleteFile(FileName)) {    // delete the file
+                    FindClose(hFind);
+                    return FALSE;
+               }
+			   strcpy(FileName,DirPath);
+         }
+      }
+	  else {
+         // no more files there
+         if(GetLastError() == ERROR_NO_MORE_FILES)
+         bSearch = false;
+         else {
+            // some error occurred; close the handle and return FALSE
+               FindClose(hFind);
+               return FALSE;
+         }
+
+      }
+
+   }
+   FindClose(hFind);                  // close the file handle
+
+   return RemoveDirectory(sPath);     // remove the empty directory
+
+}    
+
+WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
+{
+	DeleteDirectory("mods.d");
+	DeleteDirectory("modules");
+	return 0;
+}
+//---------------------------------------------------------------------------




More information about the sword-cvs mailing list