MSI Spy – Microsoft Installer ASP.NET Project
- Get link
- X
- Other Apps
MSI Spy – Microsoft Installer ASP.NET Project
0
3702
MSI Spy – Microsoft Installer is a simple academic mini project implemented using ASP.NET framework. This software is developed with the aim of accessing information of MSI files that are installed in a computer.
The complete source code with properties files and resources files can be downloaded from the link below. There isn’t a project report or documentation for this software, so you can refer the description below as project synopsis.
Download MSI Spy – Microsoft Installer ASP.NET Project with Source Code
[sociallocker]
Download MSI Spy – Microsoft Installer ASP.NET Project with Source Code
[/sociallocker]
Project Abstract:
MSI Spy is a Microsoft utility or tool with the help of which you can look after the installation state of components of all the installed products on your machine. This tool can be run to check and keep track of all the components and determine the missing components on your computer. So, it is simply a tool to display component-level view of system.
The proposed MSI Spy – Microsoft Installer is a software that can be used to check installed MSI files. It uses spying concept of viewing files and looks after the installation state of components that are installed in a user computer without letting the main user know.
Sample Source Code:
CatalogForm.cs
CatalogForm.cs (MSI Spy - Microsoft Installer)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
using System;
using System.IO;
using System.Text;
using System.Windows.Forms;
namespace ProductCatalog
{
public partial class CatalogForm : Form
{
#region Declarations
private int _lastColumnClicked = 0;
private bool _ascending = true;
private ProductSearchSettings _findSettings = new ProductSearchSettings();
private bool _userChangedSelection = false;
public const int ColProdName = 0;
public const int ColProdCode = 1;
public const int ColVersion = 2;
public const int ColContext = 3;
public const int ColState = 4;
public const int ColModDate = 5;
#endregion
public CatalogForm()
{
InitializeComponent();
}
#region Form Events
private void CatalogForm_Load(object sender, EventArgs e)
{
PopulateList.PopulateProductList(productList);
productList.Sorting = SortOrder.Ascending;
Version ver = new Version(Application.ProductVersion);
tsVersion.Text = "v" + ver.ToString(2);
}
#endregion
#region List Events
private void productList_Resize(object sender, EventArgs e)
{
Control control = (Control)sender;
int wid = control.Size.Width;
for (int i = 1; i < productList.Columns.Count; i++)
{
ColumnHeader ch = productList.Columns[i];
wid -= ch.Width;
}
productList.Columns[ColProdName].Width = wid - (16 + 3); // 16 for scrollbar width
}
private void productList_ColumnClick(object sender, ColumnClickEventArgs e)
{
bool diffCol = _lastColumnClicked != e.Column;
_ascending = (diffCol) ? true : !_ascending;
this.productList.ListViewItemSorter = new CatalogListViewItemComparer(e.Column, productList.Columns.Count - 1, _ascending);
_lastColumnClicked = e.Column;
}
// Track user changes in selection
private void productList_SelectedIndexChanged(object sender, EventArgs e)
{
_userChangedSelection = true;
int count = productList.SelectedItems.Count;
switch (count)
{
case 0: tsSelCount.Text = "No items selected."; break;
case 1: tsSelCount.Text = "1 item selected."; break;
default: tsSelCount.Text = String.Format("{0} items selected.", count); break;
}
copyToolStripMenuItem.Enabled = (count > 0);
patchesToolStripMenuItem.Enabled = (count == 1);
featuresToolStripMenuItem.Enabled = (count == 1);
//componentsToolStripMenuItem.Enabled = (count == 1);
}
// Crude command router
private void productList_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.F)
{
Find(true);
e.Handled = true;
}
else if (e.KeyCode == Keys.Escape)
{
SelectAllListItems(false);
e.Handled = true;
}
}
#endregion
#region Menu Commands
private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
{
// TODO: It would be nice to preserve selection and improve redraw.
productList.SelectedItems.Clear(); // /To reset selection count
PopulateList.PopulateProductList(productList);
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveFile();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)
{
SelectAllListItems(true);
}
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
CopySelectedListItemsToClipboard();
}
private void findToolStripMenuItem_Click(object sender, EventArgs e)
{
Find(true);
}
private void findAgainToolStripMenuItem_Click(object sender, EventArgs e)
{
Find(false);
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
AboutForm about = new AboutForm();
about.ShowDialog();
}
#endregion
#region Context Menu Commands
private void patchesToolStripMenuItem_Click(object sender, EventArgs e)
{
if(productList.SelectedItems.Count == 1)
{
ListViewItem lvi = productList.SelectedItems[0];
string productCode = lvi.SubItems[CatalogForm.ColProdCode].Text;
PatchForm dlg = new PatchForm(productCode);
dlg.ShowDialog(this);
}
}
private void featuresToolStripMenuItem_Click(object sender, EventArgs e)
{
if(productList.SelectedItems.Count == 1)
{
ListViewItem lvi = productList.SelectedItems[0];
string productCode = lvi.SubItems[CatalogForm.ColProdCode].Text;
FeatureForm dlg = new FeatureForm(productCode);
dlg.ShowDialog(this);
}
}
private void componentsToolStripMenuItem_Click(object sender, EventArgs e)
{
}
#endregion
private void SelectAllListItems(bool select)
{
foreach (ListViewItem lvi in productList.Items)
{
lvi.Selected = select;
}
}
private void CopySelectedListItemsToClipboard()
{
StringBuilder sbClip = new StringBuilder();
foreach (ListViewItem lvi in productList.Items)
{
if (lvi.Selected)
{
AppendListViewItemToStringBuilder(lvi, ref sbClip);
}
}
if (sbClip.Length > 0)
{
Clipboard.Clear();
Clipboard.SetText(sbClip.ToString());
}
}
private void AppendListViewItemToStringBuilder(ListViewItem lvi, ref StringBuilder sb)
{
sb.Append(lvi.SubItems[ColProdName].Text);
sb.Append("\t");
sb.Append(lvi.SubItems[ColProdCode].Text);
sb.Append("\t");
sb.Append(lvi.SubItems[ColVersion].Text);
sb.Append("\t");
sb.Append(lvi.SubItems[ColContext].Text);
sb.Append("\t");
sb.Append(lvi.SubItems[ColState].Text);
sb.Append("\t");
sb.Append(lvi.SubItems[ColModDate].Text);
sb.Append("\r\n");
}
private void Find(bool withUI)
{
// If the user has changed the selection since the last search,
// Set the starting row at the row after the current first selection,
// or at 0 if no selection of the last line is selected
if (_userChangedSelection)
{
_findSettings.SearchStartingRow = 0;
int row = 0;
while (row < productList.Items.Count)
{
if (productList.Items[row].Selected)
{
_findSettings.SearchStartingRow = row + 1;
break;
}
row++;
}
_userChangedSelection = false;
}
if (withUI)
{
FindProductForm dlg = new FindProductForm(_findSettings);
dlg.Settings = _findSettings;
if (dlg.ShowDialog(this) == DialogResult.OK)
{
_findSettings = dlg.Settings;
// If nothing was found, reset search next time.
// If something was found, ignore selection changes made by finding.
bool result = Search.FindInProductList(productList, _findSettings);
_userChangedSelection = !result;
if (!result) productList.EnsureVisible(0);
findAgainToolStripMenuItem.Enabled = true;
}
}
else
{
if (_findSettings.IsValid)
{
bool result = Search.FindInProductList(productList, _findSettings);
_userChangedSelection = !result;
if (!result) productList.EnsureVisible(0);
}
}
}
private void SaveFile()
{
SaveFileDialog sfd = new SaveFileDialog();
Stream strm;
sfd.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
sfd.FilterIndex = 2;
sfd.RestoreDirectory = true;
if (sfd.ShowDialog() == DialogResult.OK)
{
if ((strm = sfd.OpenFile()) != null)
{
StringBuilder sb = new StringBuilder();
foreach (ListViewItem lvi in productList.Items)
AppendListViewItemToStringBuilder(lvi, ref sb);
StreamWriter sw = new StreamWriter(strm);
sw.Write(sb.ToString());
sw.Close();
strm.Close();
}
}
}
}
}
|
Program.cs
Program.cs (MSI Spy - Microsoft Installer)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ProductCatalog
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new CatalogForm());
}
}
}
|
MSI Spy can be used only to access information about MSI files installed. With this software, you can directly interact with API of the running windows installer session.
- Get link
- X
- Other Apps
Comments
Post a Comment