Final
parent
62c6f340e8
commit
bfc40c743a
|
@ -13329,6 +13329,12 @@ and activate SWL Spotting on the Panadapter</value>
|
|||
<data name="reportBugToolStripMenuItem.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="menuDonateItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>59, 18</value>
|
||||
</data>
|
||||
<data name="menuDonateItem.Text" xml:space="preserve">
|
||||
<value>Donate</value>
|
||||
</data>
|
||||
<data name="menuStrip1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
|
@ -22298,6 +22304,12 @@ and activate SWL Spotting on the Panadapter</value>
|
|||
<data name=">>reportBugToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>menuDonateItem.Name" xml:space="preserve">
|
||||
<value>menuDonateItem</value>
|
||||
</data>
|
||||
<data name=">>menuDonateItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>openFileDialog1.Name" xml:space="preserve">
|
||||
<value>openFileDialog1</value>
|
||||
</data>
|
||||
|
|
|
@ -36,80 +36,80 @@ using Microsoft.Win32;
|
|||
|
||||
namespace PortTalk
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Class1.
|
||||
/// </summary>
|
||||
public class Parallel
|
||||
{
|
||||
#region Dll Variable and Method Definition
|
||||
// ======================================================
|
||||
// DLL Variable and Method Definition
|
||||
// ======================================================
|
||||
/// <summary>
|
||||
/// Summary description for Class1.
|
||||
/// </summary>
|
||||
public class Parallel
|
||||
{
|
||||
#region Dll Variable and Method Definition
|
||||
// ======================================================
|
||||
// DLL Variable and Method Definition
|
||||
// ======================================================
|
||||
|
||||
[DllImport("PortTalk.dll", EntryPoint = "InitPortTalk")]
|
||||
public static extern void InitPortTalkDll();
|
||||
public static void InitPortTalk()
|
||||
{
|
||||
if (Environment.OSVersion.ToString() == "Microsoft Windows NT 5.1.2600.0")
|
||||
{
|
||||
// check for driver file and copy if needed
|
||||
if (!File.Exists(Environment.SystemDirectory + "\\drivers\\porttalk.sys"))
|
||||
File.Copy(Application.StartupPath + "\\porttalk.sys", Environment.SystemDirectory + "\\drivers\\porttalk.sys");
|
||||
[DllImport("inpout32.dll", EntryPoint="IsInpOutDriverOpen")]
|
||||
public static extern void InitPortTalkDll();
|
||||
public static void InitPortTalk()
|
||||
{
|
||||
if(Environment.OSVersion.ToString() == "Microsoft Windows NT 5.1.2600.0")
|
||||
{
|
||||
// check for driver file and copy if needed
|
||||
if(!File.Exists(Environment.SystemDirectory+"\\drivers\\inpoutx64.sys"))
|
||||
File.Copy(Application.StartupPath+"\\inpoutx64.sys", Environment.SystemDirectory+"\\drivers\\inpoutx64.sys");
|
||||
|
||||
// check for registry entry
|
||||
RegistryKey rk = null;
|
||||
RegistryKey hklm = Registry.LocalMachine.OpenSubKey("SYSTEM", true);
|
||||
if (hklm != null) hklm = hklm.OpenSubKey("CurrentControlSet", true);
|
||||
if (hklm != null) hklm = hklm.OpenSubKey("Services", true);
|
||||
if (hklm != null) rk = hklm.OpenSubKey("PortTalk", true);
|
||||
if (rk == null) rk = hklm.CreateSubKey("PortTalk");
|
||||
// check for registry entry
|
||||
RegistryKey rk = null;
|
||||
RegistryKey hklm = Registry.LocalMachine.OpenSubKey("SYSTEM", true);
|
||||
if(hklm != null) hklm = hklm.OpenSubKey("CurrentControlSet", true);
|
||||
if(hklm != null) hklm = hklm.OpenSubKey("Services", true);
|
||||
if(hklm != null) rk = hklm.OpenSubKey("inpoutx64", true);
|
||||
if(rk == null) rk = hklm.CreateSubKey("inpoutx64");
|
||||
|
||||
if (rk != null)
|
||||
{
|
||||
string[] names = rk.GetValueNames();
|
||||
int val;
|
||||
foreach (string s in names)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case "ErrorControl":
|
||||
val = (int)rk.GetValue("ErrorControl");
|
||||
if (val != 1) rk.SetValue("ErrorControl", 1);
|
||||
break;
|
||||
case "Start":
|
||||
val = (int)rk.GetValue("Start");
|
||||
if (val != 2) rk.SetValue("Start", 2);
|
||||
break;
|
||||
case "Type":
|
||||
val = (int)rk.GetValue("Type");
|
||||
if (val != 1) rk.SetValue("Type", 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // key not found, could not create it
|
||||
{
|
||||
MessageBox.Show("Error initializing PortTalk");
|
||||
}
|
||||
}
|
||||
if(rk != null)
|
||||
{
|
||||
string[] names = rk.GetValueNames();
|
||||
int val;
|
||||
foreach(string s in names)
|
||||
{
|
||||
switch(s)
|
||||
{
|
||||
case "ErrorControl":
|
||||
val = (int)rk.GetValue("ErrorControl");
|
||||
if(val != 1) rk.SetValue("ErrorControl", 1);
|
||||
break;
|
||||
case "Start":
|
||||
val = (int)rk.GetValue("Start");
|
||||
if(val != 2) rk.SetValue("Start", 2);
|
||||
break;
|
||||
case "Type":
|
||||
val = (int)rk.GetValue("Type");
|
||||
if(val != 1) rk.SetValue("Type", 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // key not found, could not create it
|
||||
{
|
||||
MessageBox.Show("Error initializing PortTalk");
|
||||
}
|
||||
}
|
||||
|
||||
InitPortTalkDll();
|
||||
}
|
||||
|
||||
InitPortTalkDll();
|
||||
}
|
||||
[DllImport("inpout32.dll", EntryPoint="IsInpOutDriverOpen")]
|
||||
public static extern void ExitPortTalk();
|
||||
|
||||
[DllImport("PortTalk.dll")]
|
||||
public static extern void ExitPortTalk();
|
||||
[DllImport("inpout32.dll", EntryPoint="Out32")]
|
||||
public static extern void outport(ushort addr, byte val);
|
||||
// public static void outport(ushort addr, byte val)
|
||||
// {
|
||||
// Debug.WriteLine("outport: "+addr.ToString("X")+"-"+val.ToString("X"));
|
||||
// outport_dll(addr, val);
|
||||
// }
|
||||
|
||||
[DllImport("PortTalk.dll", EntryPoint = "outport")]
|
||||
public static extern void outport(ushort addr, byte val);
|
||||
// public static void outport(ushort addr, byte val)
|
||||
// {
|
||||
// Debug.WriteLine("outport: "+addr.ToString("X")+"-"+val.ToString("X"));
|
||||
// outport_dll(addr, val);
|
||||
// }
|
||||
[DllImport("inpout32.dll", EntryPoint="Inp32")]
|
||||
public static extern byte inport(ushort addr);
|
||||
|
||||
[DllImport("PortTalk.dll")]
|
||||
public static extern byte inport(ushort addr);
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue