diff --git a/PdfScribeCore/PdfScribeInstaller.cs b/PdfScribeCore/PdfScribeInstaller.cs
index 64f14f2..85a5727 100644
--- a/PdfScribeCore/PdfScribeInstaller.cs
+++ b/PdfScribeCore/PdfScribeInstaller.cs
@@ -86,15 +86,22 @@ namespace PdfScribeCore
private int AddPdfScribePort()
{
- return DoXcvDataPortOperation(PORTNAME, "AddPort");
+ return DoXcvDataPortOperation(PORTNAME, PORTMONITOR, "AddPort");
}
- public void DeletePdfScribePort(string portName)
+ public void DeletePdfScribePort()
{
- DoXcvDataPortOperation(portName, "DeletePort");
+ DoXcvDataPortOperation(PORTNAME, PORTMONITOR, "DeletePort");
}
- private int DoXcvDataPortOperation(string portName, string xcvDataOperation)
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// I can't remember the name of the coder who wrote this code originally
+ private int DoXcvDataPortOperation(string portName, string portMonitor, string xcvDataOperation)
{
int win32ErrorCode;
@@ -107,7 +114,7 @@ namespace PdfScribeCore
IntPtr hPrinter = IntPtr.Zero;
- if (NativeMethods.OpenPrinter(",XcvMonitor " + PORTMONITOR, ref hPrinter, def) != 0)
+ if (NativeMethods.OpenPrinter(",XcvMonitor " + portMonitor, ref hPrinter, def) != 0)
{
if (!portName.EndsWith("\0"))
portName += "\0"; // Must be a null terminated string
@@ -467,7 +474,7 @@ namespace PdfScribeCore
DeletePdfScribePrinter();
RemovePDFScribePrinterDriver();
- DeletePdfScribePort(PORTNAME);
+ DeletePdfScribePort();
RemovePdfScribePortMonitor();
RemovePdfScribePortConfig();
return printerUninstalled;
@@ -669,11 +676,12 @@ namespace PdfScribeCore
bool registryChangesMade = false;
// Add all the registry info
// for the port and monitor
- RegistryKey portConfiguration = Registry.LocalMachine.CreateSubKey("SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors\\" +
- PORTMONITOR +
- "\\Ports\\" + PORTNAME);
+ RegistryKey portConfiguration;
try
{
+ portConfiguration = Registry.LocalMachine.CreateSubKey("SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors\\" +
+ PORTMONITOR +
+ "\\Ports\\" + PORTNAME);
portConfiguration.SetValue("Description", "PDF Scribe", RegistryValueKind.String);
portConfiguration.SetValue("Command", "", RegistryValueKind.String);
portConfiguration.SetValue("Arguments", "", RegistryValueKind.String);
diff --git a/PdfScribeUnitTests/UnitTests.cs b/PdfScribeUnitTests/UnitTests.cs
index c8775aa..cf63e7a 100644
--- a/PdfScribeUnitTests/UnitTests.cs
+++ b/PdfScribeUnitTests/UnitTests.cs
@@ -23,7 +23,7 @@ namespace PdfScribeUnitTests
public void Test_DeletePdfScribePort()
{
var scribeInstaller = new PdfScribeInstaller();
- scribeInstaller.DeletePdfScribePort("PDFSCRIBE:");
+ scribeInstaller.DeletePdfScribePort();
}
//[Test]