Welcome, Guest
Username: Password: Remember me
CodeTyphon MS Windows (Win7, Win8.x, Win10 and Win11) OS Development, discussions and problems
  • Page:
  • 1

TOPIC:

Bug on GetPrinterType function CT 4.3 SVN 41480 10 years 6 months ago #4452

  • Maximiliano
  • Maximiliano's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 47
  • Thank you received: 3
I have found a bug in the unit winprinters.inc line 906
function TWinPrinter.GetPrinterType: TPrinterType;
var
  Size: Dword;
  InfoPrt: Pointer;
begin
  Result := ptLocal;
  //On Win9X all printers are local
  if Win32Platform <> VER_PLATFORM_WIN32_NT then Exit;
  
  GetPrinter(fPrinterHandle, 4, nil, 0, @Size);
  GetMem(InfoPrt, Size);
  try
  if not GetPrinter(fPRinterHandle, 4, InfoPrt, Size, @Size)
  then
    raise EPrinter.CreateFmt('GetPrinterType failed : %s',
        [SysErrorMessage(GetLastError)]);
  if PPRINTER_INFO_4(InfoPrt)^.Attributes = PRINTER_ATTRIBUTE_NETWORK then
     Result := ptNetwork;
  finally
    FreeMem(InfoPrt);
  end;

end;        

Must be say
  if PPRINTER_INFO_4(InfoPrt)^.Attributes AND PRINTER_ATTRIBUTE_NETWORK = PRINTER_ATTRIBUTE_NETWORK then

Always return ptLocal

Please Log in or Create an account to join the conversation.

Last edit: by Maximiliano.
  • Page:
  • 1