I don't think that (re)writing a DLL is the easiest method. Why not use WMI to retrieve the wanted information (printers in this case)?
The following code is for retrieving all the locally installed printers:
(code samples borrowed from here)
ManagementScope objScope = new ManagementScope(ManagementPath.DefaultPath); //For the local Access
objScope.Connect();
SelectQuery selectQuery = new SelectQuery();
selectQuery.QueryString = "Select * from win32_Printer";
ManagementObjectSearcher MOS = new ManagementObjectSearcher(objScope, selectQuery);
ManagementObjectCollection MOC = MOS.Get();
foreach (ManagementObject mo in MOC) {
listBox1.Items.Add(mo["Name"].ToString().ToUpper());
}
To get the printers known accross a domain use this:
ConnectionOptions objConnection = new ConnectionOptions();
objConnection.Username = "USERNAME";
objConnection.Password = "PASSWORD";
objConnection.Authority = "ntlmdomain:DDI"; //Where DDI is the name of my domain
// Make sure the user you specified have enough permission to access the resource.
ManagementScope objScope = new ManagementScope(@"\\10.0.0.4\root\cimv2",objConnection); //For the local Access
objScope.Connect();
SelectQuery selectQuery = new SelectQuery();
selectQuery.QueryString = "Select * from win32_Printer";
ManagementObjectSearcher MOS = new ManagementObjectSearcher(objScope, selectQuery);
ManagementObjectCollection MOC = MOS.Get();
foreach (ManagementObject mo in MOC) {
listBox1.Items.Add(mo["Name"].ToString().ToUpper());
}
Of course, the list is not "filtered" as you would like as you didn't specify any criteria. But I'm sure you can manage from here on by yourself.