Notes on a USB Key – Chapter 2

February 17, 2006 – 8:44 pm

wendyI changed the code for my project “Wendy” once again. In the former version of nstart.exe, the file had to be copied to the Notes executable directory.

This is no longer necessary now; you can copy nstart.exe to i.e the “root” directory of your USB key, regardless of where your Notes Client is installed. nstart.exe locates the notes.ini and notes.exe, makes the necessary changes and starts the client.

This is NOT project “WANDA”, IBM announced at Lotusphere2006. It is my solution on how to put a Notes client “installation” on a USB key. But I’m eager to see what IBM’s solution will look like.

Does anyone have some information about project “WANDA” ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/////////////////////////////////////////////////////////////////////////////
//  nstart.cpp
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "nstart.h"
#include "SADirRead.h"
 
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
 
/////////////////////////////////////////////////////////////////////////////
#define NOTES_INI "notes.ini"
#define NOTES_PRG "notes.exe"
#define BACKSLASH ":\\"
 
CString Drives ="CDEFGHIJKLMNOPQRSTUVWXYZcdefghijklmnopqrstuvwxyz";
CFile* fin =	NULL;
CFile* fout =	NULL;
CWinApp			theApp;
CSADirRead		FSearch;
CFileException	ex;
CString			THE_NOTES_INI;
CString			THE_NOTES_EXE;
char			AppPath[MAX_PATH];
char			pbuf[99999];
int				i, j, m, n;
using namespace std;
 
/////////////////////////////////////////////////////////////////////////////
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;
 
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
	{
		cerr < < _T("Fatal Error: MFC initialization failed") << endl;
		nRetCode = 1;
	}
 
	else
 
	try
	{
		GetModuleFileName(AfxGetApp()->m_hInstance,AppPath,MAX_PATH);
 
		CString BS(_T(BACKSLASH));
		CString strPath(AppPath);
		CString ThisDrive (strPath.Left(1) + BS);
 
		FSearch.ClearDirs();
		FSearch.GetDirs(ThisDrive, true);
		FSearch.ClearFiles();
		FSearch.GetFiles(NOTES_INI);
 
		CSADirRead::SAFileVector &IniFile = FSearch.Files();
 
		for (CSADirRead::SAFileVector::const_iterator m = IniFile.begin();
			m!=IniFile.end(); m++) {
 
			THE_NOTES_INI = ("%s\n", (*m).m_sName);
		}
 
		fin =	new CFile( THE_NOTES_INI,
				CFile::modeRead | CFile::shareDenyNone);
 
		// read NOTES.INI
		ULONGLONG dwLength = fin->GetLength();
		ULONGLONG nBytesRead = fin->Read( pbuf,dwLength );
		fin->Close();
 
		CString buffer(pbuf);
 
		// replace drive letters with current drive
		for	(i=0; i < Drives.GetLength() ; i++ ) {
 
			CString DriveLetter (_T(Drives.GetAt(i) + BS));
		    j = buffer.Replace(_T(DriveLetter), _T(ThisDrive));
		}
 
		// write notes.ini
		fout =	new CFile( THE_NOTES_INI ,
				CFile::modeWrite | CFile::shareDenyWrite);
 
		fout->Write(_T(buffer),dwLength);
		fout->Flush();
		fout->Close();
 
		// search Notes executable
		FSearch.ClearDirs();
		FSearch.GetDirs(ThisDrive, true);
		FSearch.ClearFiles();
		FSearch.GetFiles(NOTES_PRG);
 
		CSADirRead::SAFileVector &ExeFile = FSearch.Files();
 
		for (CSADirRead::SAFileVector::const_iterator n = ExeFile.begin();
			n!=ExeFile.end(); n++) {
 
			THE_NOTES_EXE = ("%s\n", (*n).m_sName);
		}
 
		// start the client
		ShellExecute(0, "open", THE_NOTES_EXE, 0, 0, 1);
	}
 
	catch (CFileException* pEx)
	{
		// if an error occurs, just make a message box
		pEx->ReportError();
		pEx->Delete();
		nRetCode = 1;
	}
	catch (...)
	{
		nRetCode = 1;
	}
 
	return nRetCode;
}

Related posts:

  1. Chapter No.8 – ‘What’s New In Notes/Domino 8.5 Development’
  2. IBM Lotus Notes Traveler 8.5
  3. Project Wanda = Lotus Notes Nomad
  4. Notes Client On USB Key – The Starter
  5. Notes Client on USB key

  1. 5 Responses to “Notes on a USB Key – Chapter 2”

  2. Hi Ulrich,

    funktioniert jetzt wunderbar, sogar eine Erstinstallation. Nur: Warum startest Du die Notes.exe und nicht die nlnotes.exe? Starten über die nlnotes.exe hätte den Vorteil, das man den “USB-Client” als weiteren Client starten kann (z. B. um mehrere Notes-Client-Versionen zu testen, ja sogar Clients auf Vorrat zu halten, z.B. für Testzwecke).

    Ansonsten: Wozu IBM, wenn man Leute wie Dich hat. Vielen Dank!!

    GrüÃ?e aus München
    Wolfgang

    By Wolfgang Haderlein on Feb 21, 2006

  3. nstart.exe now starts nlnotes.exe instead of notes.exe.
    HINT: After the DOS Box closes, it take some 2 or 3 seconds for the client to appear. So please be patient :roll:

    By Administrator on Feb 21, 2006

  4. Wunderbar, funktioniert.

    Danke!!!

    By Wolfgang Haderlein on Feb 21, 2006

  5. Hallo Ulrich, heute bin ich mal dazu gekommen den USB starter zu testen. Sehr gute Arbeit. Das Programm ist echt eine feine Sache. Ach noch mal vielen Dank, dass Du dieses Tool der Allgemeinheit bereitstellst.

    Liebe GrüÃ?e

    Christopher

    By Christopher on Mar 24, 2006

  6. Thank you very much for the feedback, Christopher.

    I’m currently working on a new version of “Wendy”. It will have a GUI where you can select from different versions of Notes clients on the key.

    By Administrator on Mar 24, 2006

Sorry, comments for this entry are closed at this time.