Author Topic: Parallel port in Windows XP issue  (Read 23507 times)

Henny

  • Member
  • ***
  • Posts: 1
Parallel port in Windows XP issue
« on: November 08, 2011, 03:40:35 pm »
Hi Jan,
 
I used the “int GetAddressLptPortInTheMemory(int myPort)” function as described in http://www.janaxelson.com/jansfaq.htm
in a Cbuilder5 project running in Windows 98 and it works fine there.
Now I would like to apply the same code in the same CBuilder 5 application but running in Windows XP.

But:
         int portAddresses[]={0,0,0,0,0};
         BOOL rtn=0;
         DWORD cbLen=0;
         rtn = myProcPointer
         (0,
         (LPCVOID *) 0x408,
         portAddresses,
         8,
         NULL) ;
 
==>>    rtn results in 0 in Windows XP
 
I read in the same article:
Q: If a logic 1 is written to the Control Port, bit 0, (Strobe), the PC clears all of the port bits once every five seconds for about a minute.
A: Some versions of Windows XP look for devices by periodically writing to the port. A registry key can disable this behavior.
   The following registry setting disables the port writes:
      [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Parport\Parameters]"DisableWarmPoll"=dword:00000001
   The following registry setting enables the port writes:
      [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Parport\Parameters]"DisableWarmPoll"=dword:00000000
 
Indeed RegEdit tells me”:      [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Parport\Parameters]"DisableWarmPoll"=dword:00000001
 
My question: if I change this to
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Parport\Parameters]"DisableWarmPoll"=dword:00000000

I might misinterpret that text but do you mean with that, that the “int GetAddressLptPortInTheMemory(int myPort)” function workes fine then?
 
I’m willing to change the regsitry ONLY when I’m sure that it is necessary and safe.
 
Vriendelijke groeten / Bien cordialement / Best regards, Henny Barten
« Last Edit: July 13, 2014, 10:07:08 pm by Jan Axelson »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Parallel port in Windows XP issue
« Reply #1 on: November 08, 2011, 03:58:06 pm »
Setting the value to zero may cause the OS to periodically write to the port to look for attached devices. It won't help you find the port address.

The code you referred to predates WinXP. It's not my code, and I haven't tested it on XP. But because XP is most like NT, I would try the code in:

GetAddressLptPortInTheRegistry

Jan