home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1996 August / VPR9608A.BIN / del20try / install / data.z / WINSPOOL.PAS < prev    next >
Pascal/Delphi Source File  |  1996-05-08  |  50KB  |  1,096 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Run-time Library                         }
  5. {       Windows 32bit API Interface Unit                }
  6. {                                                       }
  7. {       Copyright (c) 1996 Borland International        }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit WinSpool;
  12.  
  13. interface
  14.  
  15. uses Windows;
  16.  
  17. type
  18.   PPrinterInfo1A = ^TPrinterInfo1A;
  19.   PPrinterInfo1W = ^TPrinterInfo1W;
  20.   PPrinterInfo1 = PPrinterInfo1A;
  21.   TPrinterInfo1A = record
  22.     Flags: DWORD;
  23.     pDescription: PAnsiChar;
  24.     pName: PAnsiChar;
  25.     pComment: PAnsiChar;
  26.   end;
  27.   TPrinterInfo1W = record
  28.     Flags: DWORD;
  29.     pDescription: PWideChar;
  30.     pName: PWideChar;
  31.     pComment: PWideChar;
  32.   end;
  33.   TPrinterInfo1 = TPrinterInfo1A;
  34.  
  35.   PPrinterInfo2A = ^TPrinterInfo2A;
  36.   PPrinterInfo2W = ^TPrinterInfo2W;
  37.   PPrinterInfo2 = PPrinterInfo2A;
  38.   TPrinterInfo2A = record
  39.     pServerName: PAnsiChar;
  40.     pPrinterName: PAnsiChar;
  41.     pShareName: PAnsiChar;
  42.     pPortName: PAnsiChar;
  43.     pDriverName: PAnsiChar;
  44.     pComment: PAnsiChar;
  45.     pLocation: PAnsiChar;
  46.     pDevMode: PDeviceModeA;
  47.     pSepFile: PAnsiChar;
  48.     pPrintProcessor: PAnsiChar;
  49.     pDatatype: PAnsiChar;
  50.     pParameters: PAnsiChar;
  51.     pSecurityDescriptor: PSecurityDescriptor;
  52.     Attributes: DWORD;
  53.     Priority: DWORD;
  54.     DefaultPriority: DWORD;
  55.     StartTime: DWORD;
  56.     UntilTime: DWORD;
  57.     Status: DWORD;
  58.     cJobs: DWORD;
  59.     AveragePPM: DWORD;
  60.   end;
  61.   TPrinterInfo2W = record
  62.     pServerName: PWideChar;
  63.     pPrinterName: PWideChar;
  64.     pShareName: PWideChar;
  65.     pPortName: PWideChar;
  66.     pDriverName: PWideChar;
  67.     pComment: PWideChar;
  68.     pLocation: PWideChar;
  69.     pDevMode: PDeviceModeW;
  70.     pSepFile: PWideChar;
  71.     pPrintProcessor: PWideChar;
  72.     pDatatype: PWideChar;
  73.     pParameters: PWideChar;
  74.     pSecurityDescriptor: PSecurityDescriptor;
  75.     Attributes: DWORD;
  76.     Priority: DWORD;
  77.     DefaultPriority: DWORD;
  78.     StartTime: DWORD;
  79.     UntilTime: DWORD;
  80.     Status: DWORD;
  81.     cJobs: DWORD;
  82.     AveragePPM: DWORD;
  83.   end;
  84.   TPrinterInfo2 = TPrinterInfo2A;
  85.  
  86.   PPrinterInfo3A = ^TPrinterInfo3A;
  87.   PPrinterInfo3W = ^TPrinterInfo3W;
  88.   PPrinterInfo3 = PPrinterInfo3A;
  89.   TPrinterInfo3A = record
  90.     pSecurityDescriptor: PSecurityDescriptor;
  91.   end;
  92.   TPrinterInfo3W = record
  93.     pSecurityDescriptor: PSecurityDescriptor;
  94.   end;
  95.   TPrinterInfo3 = TPrinterInfo3A;
  96.  
  97.   PPrinterInfo4A = ^TPrinterInfo4A;
  98.   PPrinterInfo4W = ^TPrinterInfo4W;
  99.   PPrinterInfo4 = PPrinterInfo4A;
  100.   TPrinterInfo4A = record
  101.     pPrinterName: PAnsiChar;
  102.     pServerName: PAnsiChar;
  103.     Attributes: DWORD;
  104.   end;
  105.   TPrinterInfo4W = record
  106.     pPrinterName: PWideChar;
  107.     pServerName: PWideChar;
  108.     Attributes: DWORD;
  109.   end;
  110.   TPrinterInfo4 = TPrinterInfo4A;
  111.  
  112.   PPrinterInfo5A = ^TPrinterInfo5A;
  113.   PPrinterInfo5W = ^TPrinterInfo5W;
  114.   PPrinterInfo5 = PPrinterInfo5A;
  115.   TPrinterInfo5A = record
  116.     pPrinterName: PAnsiChar;
  117.     pPortName: PAnsiChar;
  118.     Attributes: DWORD;
  119.     DeviceNotSelectedTimeout: DWORD;
  120.     TransmissionRetryTimeout: DWORD;
  121.   end;
  122.   TPrinterInfo5W = record
  123.     pPrinterName: PWideChar;
  124.     pPortName: PWideChar;
  125.     Attributes: DWORD;
  126.     DeviceNotSelectedTimeout: DWORD;
  127.     TransmissionRetryTimeout: DWORD;
  128.   end;
  129.   TPrinterInfo5 = TPrinterInfo5A;
  130.  
  131. const
  132.   PRINTER_CONTROL_PAUSE            = 1;
  133.   PRINTER_CONTROL_RESUME           = 2;
  134.   PRINTER_CONTROL_PURGE            = 3;
  135.   PRINTER_CONTROL_SET_STATUS       = 4;
  136.  
  137.   PRINTER_STATUS_PAUSED            = $00000001;
  138.   PRINTER_STATUS_ERROR             = $00000002;
  139.   PRINTER_STATUS_PENDING_DELETION  = $00000004;
  140.   PRINTER_STATUS_PAPER_JAM         = $00000008;
  141.   PRINTER_STATUS_PAPER_OUT         = $00000010;
  142.   PRINTER_STATUS_MANUAL_FEED       = $00000020;
  143.   PRINTER_STATUS_PAPER_PROBLEM     = $00000040;
  144.   PRINTER_STATUS_OFFLINE           = $00000080;
  145.   PRINTER_STATUS_IO_ACTIVE         = $00000100;
  146.   PRINTER_STATUS_BUSY              = $00000200;
  147.   PRINTER_STATUS_PRINTING          = $00000400;
  148.   PRINTER_STATUS_OUTPUT_BIN_FULL   = $00000800;
  149.   PRINTER_STATUS_NOT_AVAILABLE     = $00001000;
  150.   PRINTER_STATUS_WAITING           = $00002000;
  151.   PRINTER_STATUS_PROCESSING        = $00004000;
  152.   PRINTER_STATUS_INITIALIZING      = $00008000;
  153.   PRINTER_STATUS_WARMING_UP        = $00010000;
  154.   PRINTER_STATUS_TONER_LOW         = $00020000;
  155.   PRINTER_STATUS_NO_TONER          = $00040000;
  156.   PRINTER_STATUS_PAGE_PUNT         = $00080000;
  157.   PRINTER_STATUS_USER_INTERVENTION = $00100000;
  158.   PRINTER_STATUS_OUT_OF_MEMORY     = $00200000;
  159.   PRINTER_STATUS_DOOR_OPEN         = $00400000;
  160.   PRINTER_STATUS_SERVER_UNKNOWN    = $00800000;
  161.   PRINTER_STATUS_POWER_SAVE        = $01000000;
  162.  
  163.   PRINTER_ATTRIBUTE_QUEUED         = $00000001;
  164.   PRINTER_ATTRIBUTE_DIRECT         = $00000002;
  165.   PRINTER_ATTRIBUTE_DEFAULT        = $00000004;
  166.   PRINTER_ATTRIBUTE_SHARED         = $00000008;
  167.   PRINTER_ATTRIBUTE_NETWORK        = $00000010;
  168.   PRINTER_ATTRIBUTE_HIDDEN         = $00000020;
  169.   PRINTER_ATTRIBUTE_LOCAL          = $00000040;
  170.  
  171.   PRINTER_ATTRIBUTE_ENABLE_DEVQ       = $00000080;
  172.   PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS   = $00000100;
  173.   PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST = $00000200;
  174.  
  175.   PRINTER_ATTRIBUTE_WORK_OFFLINE   = $00000400;
  176.   PRINTER_ATTRIBUTE_ENABLE_BIDI    = $00000800;
  177.  
  178.  
  179.   NO_PRIORITY   = 0;
  180.   MAX_PRIORITY = 99;
  181.   MIN_PRIORITY  = 1;
  182.   DEF_PRIORITY  = 1;
  183.  
  184. type
  185.   PJobInfo1A = ^TJobInfo1A;
  186.   PJobInfo1W = ^TJobInfo1W;
  187.   PJobInfo1 = PJobInfo1A;
  188.   TJobInfo1A = record
  189.    JobId: DWORD;
  190.    pPrinterName: PAnsiChar;
  191.    pMachineName: PAnsiChar;
  192.    pUserName: PAnsiChar;
  193.    pDocument: PAnsiChar;
  194.    pDatatype: PAnsiChar;
  195.    pStatus: PAnsiChar;
  196.    Status: DWORD;
  197.    Priority: DWORD;
  198.    Position: DWORD;
  199.    TotalPages: DWORD;
  200.    PagesPrinted: DWORD;
  201.    Submitted: TSystemTime;
  202.   end;
  203.   TJobInfo1W = record
  204.    JobId: DWORD;
  205.    pPrinterName: PWideChar;
  206.    pMachineName: PWideChar;
  207.    pUserName: PWideChar;
  208.    pDocument: PWideChar;
  209.    pDatatype: PWideChar;
  210.    pStatus: PWideChar;
  211.    Status: DWORD;
  212.    Priority: DWORD;
  213.    Position: DWORD;
  214.    TotalPages: DWORD;
  215.    PagesPrinted: DWORD;
  216.    Submitted: TSystemTime;
  217.   end;
  218.   TJobInfo1 = TJobInfo1A;
  219.  
  220.   PJobInfo2A = ^TJobInfo2A;
  221.   PJobInfo2W = ^TJobInfo2W;
  222.   PJobInfo2 = PJobInfo2A;
  223.   TJobInfo2A = record
  224.    JobId: DWORD;
  225.    pPrinterName: PAnsiChar;
  226.    pMachineName: PAnsiChar;
  227.    pUserName: PAnsiChar;
  228.    pDocument: PAnsiChar;
  229.    pNotifyName: PAnsiChar;
  230.    pDatatype: PAnsiChar;
  231.    pPrintProcessor: PAnsiChar;
  232.    pParameters: PAnsiChar;
  233.    pDriverName: PAnsiChar;
  234.    pDevMode: PDeviceModeA;
  235.    pStatus: PAnsiChar;
  236.    pSecurityDescriptor: PSECURITY_DESCRIPTOR;
  237.    Status: DWORD;
  238.    Priority: DWORD;
  239.    Position: DWORD;
  240.    StartTime: DWORD;
  241.    UntilTime: DWORD;
  242.    TotalPages: DWORD;
  243.    Size: DWORD;
  244.    Submitted: TSystemTime;   { Time the job was spooled }
  245.    Time: DWORD;              { How many seconds the job has been printing }
  246.    PagesPrinted: DWORD;
  247.   end;
  248.   TJobInfo2W = record
  249.    JobId: DWORD;
  250.    pPrinterName: PWideChar;
  251.    pMachineName: PWideChar;
  252.    pUserName: PWideChar;
  253.    pDocument: PWideChar;
  254.    pNotifyName: PWideChar;
  255.    pDatatype: PWideChar;
  256.    pPrintProcessor: PWideChar;
  257.    pParameters: PWideChar;
  258.    pDriverName: PWideChar;
  259.    pDevMode: PDeviceModeW;
  260.    pStatus: PWideChar;
  261.    pSecurityDescriptor: PSECURITY_DESCRIPTOR;
  262.    Status: DWORD;
  263.    Priority: DWORD;
  264.    Position: DWORD;
  265.    StartTime: DWORD;
  266.    UntilTime: DWORD;
  267.    TotalPages: DWORD;
  268.    Size: DWORD;
  269.    Submitted: TSystemTime;   { Time the job was spooled }
  270.    Time: DWORD;              { How many seconds the job has been printing }
  271.    PagesPrinted: DWORD;
  272.   end;
  273.   TJobInfo2 = TJobInfo2A;
  274.  
  275. const
  276.   JOB_CONTROL_PAUSE              = 1;
  277.   JOB_CONTROL_RESUME             = 2;
  278.   JOB_CONTROL_CANCEL             = 3;
  279.   JOB_CONTROL_RESTART            = 4;
  280.   JOB_CONTROL_DELETE             = 5;
  281.  
  282.   JOB_STATUS_PAUSED       = $00000001;
  283.   JOB_STATUS_ERROR        = $00000002;
  284.   JOB_STATUS_DELETING     = $00000004;
  285.   JOB_STATUS_SPOOLING     = $00000008;
  286.   JOB_STATUS_PRINTING     = $00000010;
  287.   JOB_STATUS_OFFLINE      = $00000020;
  288.   JOB_STATUS_PAPEROUT     = $00000040;
  289.   JOB_STATUS_PRINTED      = $00000080;
  290.   JOB_STATUS_DELETED      = $00000100;
  291.   JOB_STATUS_BLOCKED_DEVQ = $00000200;
  292.   JOB_STATUS_USER_INTERVENTION   = $00000400;
  293.  
  294.   JOB_POSITION_UNSPECIFIED       = 0;
  295.  
  296. type
  297.   PAddJobInfo1A = ^TAddJobInfo1A;
  298.   PAddJobInfo1W = ^TAddJobInfo1W;
  299.   PAddJobInfo1 = PAddJobInfo1A;
  300.   TAddJobInfo1A = record
  301.     Path: PAnsiChar;
  302.     JobId: DWORD;
  303.   end;
  304.   TAddJobInfo1W = record
  305.     Path: PWideChar;
  306.     JobId: DWORD;
  307.   end;
  308.   TAddJobInfo1 = TAddJobInfo1A;
  309.  
  310.   PDriverInfo1A = ^TDriverInfo1A;
  311.   PDriverInfo1W = ^TDriverInfo1W;
  312.   PDriverInfo1 = PDriverInfo1A;
  313.   TDriverInfo1A = record
  314.     pName: PAnsiChar;              { QMS 810 }
  315.   end;
  316.   TDriverInfo1W = record
  317.     pName: PWideChar;              { QMS 810 }
  318.   end;
  319.   TDriverInfo1 = TDriverInfo1A;
  320.  
  321.   PDriverInfo2A = ^TDriverInfo2A;
  322.   PDriverInfo2W = ^TDriverInfo2W;
  323.   PDriverInfo2 = PDriverInfo2A;
  324.   TDriverInfo2A = record
  325.     cVersion: DWORD;
  326.     pName: PAnsiChar;              { QMS 810 }
  327.     pEnvironment: PAnsiChar;       { Win32 x86 }
  328.     pDriverPath: PAnsiChar;        { c:\drivers\pscript.dll }
  329.     pDataFile: PAnsiChar;          { c:\drivers\QMS810.PPD }
  330.     pConfigFile: PAnsiChar;        { c:\drivers\PSCRPTUI.DLL }
  331.   end;
  332.   TDriverInfo2W = record
  333.     cVersion: DWORD;
  334.     pName: PWideChar;              { QMS 810 }
  335.     pEnvironment: PWideChar;       { Win32 x86 }
  336.     pDriverPath: PWideChar;        { c:\drivers\pscript.dll }
  337.     pDataFile: PWideChar;          { c:\drivers\QMS810.PPD }
  338.     pConfigFile: PWideChar;        { c:\drivers\PSCRPTUI.DLL }
  339.   end;
  340.   TDriverInfo2 = TDriverInfo2A;
  341.  
  342.   PDriverInfo3A = ^TDriverInfo3A;
  343.   PDriverInfo3W = ^TDriverInfo3W;
  344.   PDriverInfo3 = PDriverInfo3A;
  345.   TDriverInfo3A = record
  346.     cVersion: DWORD;
  347.     pName: PAnsiChar;                    { QMS 810 }
  348.     pEnvironment: PAnsiChar;             { Win32 x86 }
  349.     pDriverPath: PAnsiChar;              { c:\drivers\pscript.dll }
  350.     pDataFile: PAnsiChar;                { c:\drivers\QMS810.PPD }
  351.     pConfigFile: PAnsiChar;              { c:\drivers\PSCRPTUI.DLL }
  352.     pHelpFile: PAnsiChar;                { c:\drivers\PSCRPTUI.HLP }
  353.     pDependentFiles: PAnsiChar;          { PSCRIPT.DLL\0QMS810.PPD\0PSCRIPTUI.DLL\0PSCRIPTUI.HLP\0PSTEST.TXT\0\0 }
  354.     pMonitorName: PAnsiChar;             { "PJL monitor" }
  355.     pDefaultDataType: PAnsiChar;         { "EMF" }
  356.   end;
  357.   TDriverInfo3W = record
  358.     cVersion: DWORD;
  359.     pName: PWideChar;                    { QMS 810 }
  360.     pEnvironment: PWideChar;             { Win32 x86 }
  361.     pDriverPath: PWideChar;              { c:\drivers\pscript.dll }
  362.     pDataFile: PWideChar;                { c:\drivers\QMS810.PPD }
  363.     pConfigFile: PWideChar;              { c:\drivers\PSCRPTUI.DLL }
  364.     pHelpFile: PWideChar;                { c:\drivers\PSCRPTUI.HLP }
  365.     pDependentFiles: PWideChar;          { PSCRIPT.DLL\0QMS810.PPD\0PSCRIPTUI.DLL\0PSCRIPTUI.HLP\0PSTEST.TXT\0\0 }
  366.     pMonitorName: PWideChar;             { "PJL monitor" }
  367.     pDefaultDataType: PWideChar;         { "EMF" }
  368.   end;
  369.   TDriverInfo3 = TDriverInfo3A;
  370.  
  371.   PDocInfo1A = ^TDocInfo1A;
  372.   PDocInfo1W = ^TDocInfo1W;
  373.   PDocInfo1 = PDocInfo1A;
  374.   TDocInfo1A = record
  375.     pDocName: PAnsiChar;
  376.     pOutputFile: PAnsiChar;
  377.     pDatatype: PAnsiChar;
  378.   end;
  379.   TDocInfo1W = record
  380.     pDocName: PWideChar;
  381.     pOutputFile: PWideChar;
  382.     pDatatype: PWideChar;
  383.   end;
  384.   TDocInfo1 = TDocInfo1A;
  385.  
  386.   PFormInfo1A = ^TFormInfo1A;
  387.   PFormInfo1W = ^TFormInfo1W;
  388.   PFormInfo1 = PFormInfo1A;
  389.   TFormInfo1A = record
  390.     Flags: DWORD;
  391.     pName: PAnsiChar;
  392.     Size: TSize;
  393.     ImageableArea: TRect;
  394.   end;
  395.   TFormInfo1W = record
  396.     Flags: DWORD;
  397.     pName: PWideChar;
  398.     Size: TSize;
  399.     ImageableArea: TRect;
  400.   end;
  401.   TFormInfo1 = TFormInfo1A;
  402.  
  403.   PDocInfo2A = ^TDocInfo2A;
  404.   PDocInfo2W = ^TDocInfo2W;
  405.   PDocInfo2 = PDocInfo2A;
  406.   TDocInfo2A = record
  407.     pDocName: PAnsiChar;
  408.     pOutputFile: PAnsiChar;
  409.     pDatatype: PAnsiChar;
  410.     dwMode: DWORD;
  411.     JobId: DWORD;
  412.   end;
  413.   TDocInfo2W = record
  414.     pDocName: PWideChar;
  415.     pOutputFile: PWideChar;
  416.     pDatatype: PWideChar;
  417.     dwMode: DWORD;
  418.     JobId: DWORD;
  419.   end;
  420.   TDocInfo2 = TDocInfo2A;
  421.  
  422. const
  423.   DI_CHANNEL              = 1;    { start direct read/write channel, }
  424.   DI_CHANNEL_WRITE        = 2;    { Direct write only - background read thread ok }
  425.   DI_READ_SPOOL_JOB       = 3;
  426.  
  427.   FORM_BUILTIN    = $00000001;
  428.  
  429. type
  430.   PPrintProcessorInfo1A = ^TPrintProcessorInfo1A;
  431.   PPrintProcessorInfo1W = ^TPrintProcessorInfo1W;
  432.   PPrintProcessorInfo1 = PPrintProcessorInfo1A;
  433.   TPrintProcessorInfo1A = record
  434.     pName: PAnsiChar;
  435.   end;
  436.   TPrintProcessorInfo1W = record
  437.     pName: PWideChar;
  438.   end;
  439.   TPrintProcessorInfo1 = TPrintProcessorInfo1A;
  440.  
  441.   PPortInfo1A = ^TPortInfo1A;
  442.   PPortInfo1W = ^TPortInfo1W;
  443.   PPortInfo1 = PPortInfo1A;
  444.   TPortInfo1A = record
  445.     pName: PAnsiChar;
  446.   end;
  447.   TPortInfo1W = record
  448.     pName: PWideChar;
  449.   end;
  450.   TPortInfo1 = TPortInfo1A;
  451.  
  452.   PPortInfo2A = ^TPortInfo2A;
  453.   PPortInfo2W = ^TPortInfo2W;
  454.   PPortInfo2 = PPortInfo2A;
  455.   TPortInfo2A = record
  456.     pPortName: PAnsiChar;
  457.     pMonitorName: PAnsiChar;
  458.     pDescription: PAnsiChar;
  459.     fPortType: DWORD;
  460.     Reserved: DWORD;
  461.   end;
  462.   TPortInfo2W = record
  463.     pPortName: PWideChar;
  464.     pMonitorName: PWideChar;
  465.     pDescription: PWideChar;
  466.     fPortType: DWORD;
  467.     Reserved: DWORD;
  468.   end;
  469.   TPortInfo2 = TPortInfo2A;
  470.  
  471. const
  472.   PORT_TYPE_WRITE         = $0001;
  473.   PORT_TYPE_READ          = $0002;
  474.   PORT_TYPE_REDIRECTED    = $0004;
  475.   PORT_TYPE_NET_ATTACHED  = $0008;
  476.  
  477. type
  478.   PMonitorInfo1A = ^TMonitorInfo1A;
  479.   PMonitorInfo1W = ^TMonitorInfo1W;
  480.   PMonitorInfo1 = PMonitorInfo1A;
  481.   TMonitorInfo1A = record
  482.     pName: PAnsiChar;
  483.   end;
  484.   TMonitorInfo1W = record
  485.     pName: PWideChar;
  486.   end;
  487.   TMonitorInfo1 = TMonitorInfo1A;
  488.  
  489.   PMonitorInfo2A = ^TMonitorInfo2A;
  490.   PMonitorInfo2W = ^TMonitorInfo2W;
  491.   PMonitorInfo2 = PMonitorInfo2A;
  492.   TMonitorInfo2A = record
  493.     pName: PAnsiChar;
  494.     pEnvironment: PAnsiChar;
  495.     pDLLName: PAnsiChar;
  496.   end;
  497.   TMonitorInfo2W = record
  498.     pName: PWideChar;
  499.     pEnvironment: PWideChar;
  500.     pDLLName: PWideChar;
  501.   end;
  502.   TMonitorInfo2 = TMonitorInfo2A;
  503.  
  504.   PDatatypesInfo1A = ^TDatatypesInfo1A;
  505.   PDatatypesInfo1W = ^TDatatypesInfo1W;
  506.   PDatatypesInfo1 = PDatatypesInfo1A;
  507.   TDatatypesInfo1A = record
  508.     pName: PAnsiChar;
  509.   end;
  510.   TDatatypesInfo1W = record
  511.     pName: PWideChar;
  512.   end;
  513.   TDatatypesInfo1 = TDatatypesInfo1A;
  514.  
  515.   PPrinterDefaultsA = ^TPrinterDefaultsA;
  516.   PPrinterDefaultsW = ^TPrinterDefaultsW;
  517.   PPrinterDefaults = PPrinterDefaultsA;
  518.   TPrinterDefaultsA = record
  519.     pDatatype: PAnsiChar;
  520.     pDevMode: PDeviceModeA;
  521.     DesiredAccess: ACCESS_MASK;
  522.   end;
  523.   TPrinterDefaultsW = record
  524.     pDatatype: PWideChar;
  525.     pDevMode: PDeviceModeW;
  526.     DesiredAccess: ACCESS_MASK;
  527.   end;
  528.   TPrinterDefaults = TPrinterDefaultsA;
  529.  
  530. function EnumPrintersA(Flags: DWORD; Name: PAnsiChar; Level: DWORD;
  531.   pPrinterEnum: Pointer; cbBuf: DWORD; var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  532. function EnumPrintersW(Flags: DWORD; Name: PWideChar; Level: DWORD;
  533.   pPrinterEnum: Pointer; cbBuf: DWORD; var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  534. function EnumPrinters(Flags: DWORD; Name: PChar; Level: DWORD;
  535.   pPrinterEnum: Pointer; cbBuf: DWORD; var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  536.  
  537. const
  538.   PRINTER_ENUM_DEFAULT     = $00000001;
  539.   PRINTER_ENUM_LOCAL       = $00000002;
  540.   PRINTER_ENUM_CONNECTIONS = $00000004;
  541.   PRINTER_ENUM_FAVORITE    = $00000004;
  542.   PRINTER_ENUM_NAME        = $00000008;
  543.   PRINTER_ENUM_REMOTE      = $00000010;
  544.   PRINTER_ENUM_SHARED      = $00000020;
  545.   PRINTER_ENUM_NETWORK     = $00000040;
  546.  
  547.   PRINTER_ENUM_EXPAND      = $00004000;
  548.   PRINTER_ENUM_CONTAINER   = $00008000;
  549.  
  550.   PRINTER_ENUM_ICONMASK    = $00ff0000;
  551.   PRINTER_ENUM_ICON1       = $00010000;
  552.   PRINTER_ENUM_ICON2       = $00020000;
  553.   PRINTER_ENUM_ICON3       = $00040000;
  554.   PRINTER_ENUM_ICON4       = $00080000;
  555.   PRINTER_ENUM_ICON5       = $00100000;
  556.   PRINTER_ENUM_ICON6       = $00200000;
  557.   PRINTER_ENUM_ICON7       = $00400000;
  558.   PRINTER_ENUM_ICON8       = $00800000;
  559.  
  560. function OpenPrinterA(pPrinterName: PAnsiChar; var phPrinter: THandle; pDefault: PPrinterDefaultsA): BOOL; stdcall;
  561. function OpenPrinterW(pPrinterName: PWideChar; var phPrinter: THandle; pDefault: PPrinterDefaultsW): BOOL; stdcall;
  562. function OpenPrinter(pPrinterName: PChar; var phPrinter: THandle; pDefault: PPrinterDefaults): BOOL; stdcall;
  563. function ResetPrinterA(hPrinter: THandle; pDefault: PPrinterDefaultsA): BOOL; stdcall;
  564. function ResetPrinterW(hPrinter: THandle; pDefault: PPrinterDefaultsW): BOOL; stdcall;
  565. function ResetPrinter(hPrinter: THandle; pDefault: PPrinterDefaults): BOOL; stdcall;
  566. function SetJobA(hPrinter: THandle; JobId: DWORD; Level: DWORD; pJob: Pointer; Command: DWORD): BOOL; stdcall;
  567. function SetJobW(hPrinter: THandle; JobId: DWORD; Level: DWORD; pJob: Pointer; Command: DWORD): BOOL; stdcall;
  568. function SetJob(hPrinter: THandle; JobId: DWORD; Level: DWORD; pJob: Pointer; Command: DWORD): BOOL; stdcall;
  569. function GetJobA(hPrinter: THandle; JobId: DWORD; Level: DWORD; pJob: Pointer; cbBuf: DWORD; pcbNeeded: PDWORD): BOOL; stdcall;
  570. function GetJobW(hPrinter: THandle; JobId: DWORD; Level: DWORD; pJob: Pointer; cbBuf: DWORD; pcbNeeded: PDWORD): BOOL; stdcall;
  571. function GetJob(hPrinter: THandle; JobId: DWORD; Level: DWORD; pJob: Pointer; cbBuf: DWORD; pcbNeeded: PDWORD): BOOL; stdcall;
  572. function EnumJobsA(hPrinter: THandle; FirstJob, NoJobs, Level: DWORD; pJob: Pointer; cbBuf: DWORD;
  573.   var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  574. function EnumJobsW(hPrinter: THandle; FirstJob, NoJobs, Level: DWORD; pJob: Pointer; cbBuf: DWORD;
  575.   var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  576. function EnumJobs(hPrinter: THandle; FirstJob, NoJobs, Level: DWORD; pJob: Pointer; cbBuf: DWORD;
  577.   var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  578. function AddPrinterA(pName: PAnsiChar; Level: DWORD; pPrinter: Pointer): THandle; stdcall;
  579. function AddPrinterW(pName: PWideChar; Level: DWORD; pPrinter: Pointer): THandle; stdcall;
  580. function AddPrinter(pName: PChar; Level: DWORD; pPrinter: Pointer): THandle; stdcall;
  581. function DeletePrinter(hPrinter: THandle): BOOL; stdcall;
  582. function SetPrinterA(hPrinter: THandle; Level: DWORD; pPrinter: Pointer; Command: DWORD): BOOL; stdcall;
  583. function SetPrinterW(hPrinter: THandle; Level: DWORD; pPrinter: Pointer; Command: DWORD): BOOL; stdcall;
  584. function SetPrinter(hPrinter: THandle; Level: DWORD; pPrinter: Pointer; Command: DWORD): BOOL; stdcall;
  585. function GetPrinterA(hPrinter: THandle; Level: DWORD; pPrinter: Pointer; cbBuf: DWORD; pcbNeeded: PDWORD): BOOL; stdcall;
  586. function GetPrinterW(hPrinter: THandle; Level: DWORD; pPrinter: Pointer; cbBuf: DWORD; pcbNeeded: PDWORD): BOOL; stdcall;
  587. function GetPrinter(hPrinter: THandle; Level: DWORD; pPrinter: Pointer; cbBuf: DWORD; pcbNeeded: PDWORD): BOOL; stdcall;
  588. function AddPrinterDriverA(pName: PAnsiChar; Level: DWORD; pDriverInfo: Pointer): BOOL; stdcall;
  589. function AddPrinterDriverW(pName: PWideChar; Level: DWORD; pDriverInfo: Pointer): BOOL; stdcall;
  590. function AddPrinterDriver(pName: PChar; Level: DWORD; pDriverInfo: Pointer): BOOL; stdcall;
  591. function EnumPrinterDriversA(pName, pEnvironment: PAnsiChar; Level: DWORD;
  592.   pDriverInfo: Pointer; cbBuf: DWORD; var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  593. function EnumPrinterDriversW(pName, pEnvironment: PWideChar; Level: DWORD;
  594.   pDriverInfo: Pointer; cbBuf: DWORD; var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  595. function EnumPrinterDrivers(pName, pEnvironment: PChar; Level: DWORD;
  596.   pDriverInfo: Pointer; cbBuf: DWORD; var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  597. function GetPrinterDriverA(hPrinter: THandle; pEnvironment: PAnsiChar; Level: DWORD;
  598.   pDriverInfo: Pointer; cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  599. function GetPrinterDriverW(hPrinter: THandle; pEnvironment: PWideChar; Level: DWORD;
  600.   pDriverInfo: Pointer; cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  601. function GetPrinterDriver(hPrinter: THandle; pEnvironment: PChar; Level: DWORD;
  602.   pDriverInfo: Pointer; cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  603. function GetPrinterDriverDirectoryA(pName, pEnvironment: PAnsiChar; Level: DWORD;
  604.   pDriverDirectory: Pointer; cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  605. function GetPrinterDriverDirectoryW(pName, pEnvironment: PWideChar; Level: DWORD;
  606.   pDriverDirectory: Pointer; cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  607. function GetPrinterDriverDirectory(pName, pEnvironment: PChar; Level: DWORD;
  608.   pDriverDirectory: Pointer; cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  609. function DeletePrinterDriverA(pName, pEnvironment, pDriverName: PAnsiChar): BOOL; stdcall;
  610. function DeletePrinterDriverW(pName, pEnvironment, pDriverName: PWideChar): BOOL; stdcall;
  611. function DeletePrinterDriver(pName, pEnvironment, pDriverName: PChar): BOOL; stdcall;
  612. function AddPrintProcessorA(pName, pEnvironment, pPathName, pPrintProcessorName: PAnsiChar): BOOL; stdcall;
  613. function AddPrintProcessorW(pName, pEnvironment, pPathName, pPrintProcessorName: PWideChar): BOOL; stdcall;
  614. function AddPrintProcessor(pName, pEnvironment, pPathName, pPrintProcessorName: PChar): BOOL; stdcall;
  615. function EnumPrintProcessorsA(pName, pEnvironment: PAnsiChar; Level: DWORD; pPrintProcessorInfo: Pointer;
  616.   cbBuf: DWORD; var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  617. function EnumPrintProcessorsW(pName, pEnvironment: PWideChar; Level: DWORD; pPrintProcessorInfo: Pointer;
  618.   cbBuf: DWORD; var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  619. function EnumPrintProcessors(pName, pEnvironment: PChar; Level: DWORD; pPrintProcessorInfo: Pointer;
  620.   cbBuf: DWORD; var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  621. function GetPrintProcessorDirectoryA(pName, pEnvironment: PAnsiChar; Level: DWORD;
  622.   pPrintProcessorInfo: Pointer; cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  623. function GetPrintProcessorDirectoryW(pName, pEnvironment: PWideChar; Level: DWORD;
  624.   pPrintProcessorInfo: Pointer; cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  625. function GetPrintProcessorDirectory(pName, pEnvironment: PChar; Level: DWORD;
  626.   pPrintProcessorInfo: Pointer; cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  627. function EnumPrintProcessorDatatypesA(pName, pPrintProcessorName: PAnsiChar; Level: DWORD;
  628.   pDatatypes: Pointer; cbBuf: DWORD; var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  629. function EnumPrintProcessorDatatypesW(pName, pPrintProcessorName: PWideChar; Level: DWORD;
  630.   pDatatypes: Pointer; cbBuf: DWORD; var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  631. function EnumPrintProcessorDatatypes(pName, pPrintProcessorName: PChar; Level: DWORD;
  632.   pDatatypes: Pointer; cbBuf: DWORD; var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  633. function DeletePrintProcessorA(pName, pEnvironment, pPrintProcessorName: PAnsiChar): BOOL; stdcall;
  634. function DeletePrintProcessorW(pName, pEnvironment, pPrintProcessorName: PWideChar): BOOL; stdcall;
  635. function DeletePrintProcessor(pName, pEnvironment, pPrintProcessorName: PChar): BOOL; stdcall;
  636. function StartDocPrinterA(hPrinter: THandle; Level: DWORD; pDocInfo: Pointer): DWORD; stdcall;
  637. function StartDocPrinterW(hPrinter: THandle; Level: DWORD; pDocInfo: Pointer): DWORD; stdcall;
  638. function StartDocPrinter(hPrinter: THandle; Level: DWORD; pDocInfo: Pointer): DWORD; stdcall;
  639. function StartPagePrinter(hPrinter: THandle): BOOL; stdcall;
  640. function WritePrinter(hPrinter: THandle; pBuf: Pointer; cbBuf: DWORD; var pcWritten: DWORD): BOOL; stdcall;
  641. function EndPagePrinter(hPrinter: THandle): BOOL; stdcall;
  642. function AbortPrinter(hPrinter: THandle): BOOL; stdcall;
  643. function ReadPrinter(hPrinter: THandle; pBuf: Pointer; cbBuf: DWORD; var pNoBytesRead: DWORD): BOOL; stdcall;
  644. function EndDocPrinter(hPrinter: THandle): BOOL; stdcall;
  645. function AddJobA(hPrinter: THandle; Level: DWORD; pData: Pointer; cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  646. function AddJobW(hPrinter: THandle; Level: DWORD; pData: Pointer; cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  647. function AddJob(hPrinter: THandle; Level: DWORD; pData: Pointer; cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  648. function ScheduleJob(hPrinter: THandle; JobId: DWORD): BOOL; stdcall;
  649. function PrinterProperties(hWnd: HWND; hPrinter: THandle): BOOL; stdcall;
  650. function DocumentPropertiesA(hWnd: HWND; hPrinter: THandle; pDeviceName: PAnsiChar;
  651.   const pDevModeOutput: TDeviceModeA; var pDevModeInput: TDeviceModeA; 
  652.   fMode: DWORD): Longint; stdcall;
  653. function DocumentPropertiesW(hWnd: HWND; hPrinter: THandle; pDeviceName: PWideChar;
  654.   const pDevModeOutput: TDeviceModeW; var pDevModeInput: TDeviceModeW; 
  655.   fMode: DWORD): Longint; stdcall;
  656. function DocumentProperties(hWnd: HWND; hPrinter: THandle; pDeviceName: PChar;
  657.   const pDevModeOutput: TDeviceMode; var pDevModeInput: TDeviceMode; 
  658.   fMode: DWORD): Longint; stdcall;
  659. function AdvancedDocumentPropertiesA(hWnd: HWND; hPrinter: THandle; pDeviceName: PAnsiChar;
  660.   pDevModeOutput, pDevModeInput: PDeviceModeA): Longint; stdcall;
  661. function AdvancedDocumentPropertiesW(hWnd: HWND; hPrinter: THandle; pDeviceName: PWideChar;
  662.   pDevModeOutput, pDevModeInput: PDeviceModeW): Longint; stdcall;
  663. function AdvancedDocumentProperties(hWnd: HWND; hPrinter: THandle; pDeviceName: PChar;
  664.   pDevModeOutput, pDevModeInput: PDeviceMode): Longint; stdcall;
  665. function GetPrinterDataA(hPrinter: THandle; pValueName: PAnsiChar; pType: PDWORD; pData: Pointer;
  666.   nSize: DWORD; var pcbNeeded: DWORD): DWORD; stdcall;
  667. function GetPrinterDataW(hPrinter: THandle; pValueName: PWideChar; pType: PDWORD; pData: Pointer;
  668.   nSize: DWORD; var pcbNeeded: DWORD): DWORD; stdcall;
  669. function GetPrinterData(hPrinter: THandle; pValueName: PChar; pType: PDWORD; pData: Pointer;
  670.   nSize: DWORD; var pcbNeeded: DWORD): DWORD; stdcall;
  671. function SetPrinterDataA(hPrinter: THandle; pValueName: PAnsiChar; dwType: DWORD; pData: Pointer; cbData: DWORD): DWORD; stdcall;
  672. function SetPrinterDataW(hPrinter: THandle; pValueName: PWideChar; dwType: DWORD; pData: Pointer; cbData: DWORD): DWORD; stdcall;
  673. function SetPrinterData(hPrinter: THandle; pValueName: PChar; dwType: DWORD; pData: Pointer; cbData: DWORD): DWORD; stdcall;
  674.  
  675. const
  676.   PRINTER_NOTIFY_TYPE = $00;
  677.   JOB_NOTIFY_TYPE     = $01;
  678.  
  679.   PRINTER_NOTIFY_FIELD_SERVER_NAME             = $00;
  680.   PRINTER_NOTIFY_FIELD_PRINTER_NAME            = $01;
  681.   PRINTER_NOTIFY_FIELD_SHARE_NAME              = $02;
  682.   PRINTER_NOTIFY_FIELD_PORT_NAME               = $03;
  683.   PRINTER_NOTIFY_FIELD_DRIVER_NAME             = $04;
  684.   PRINTER_NOTIFY_FIELD_COMMENT                 = $05;
  685.   PRINTER_NOTIFY_FIELD_LOCATION                = $06;
  686.   PRINTER_NOTIFY_FIELD_DEVMODE                 = $07;
  687.   PRINTER_NOTIFY_FIELD_SEPFILE                 = $08;
  688.   PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR         = $09;
  689.   PRINTER_NOTIFY_FIELD_PARAMETERS              = $0A;
  690.   PRINTER_NOTIFY_FIELD_DATATYPE                = $0B;
  691.   PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR     = $0C;
  692.   PRINTER_NOTIFY_FIELD_ATTRIBUTES              = $0D;
  693.   PRINTER_NOTIFY_FIELD_PRIORITY                = $0E;
  694.   PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY        = $0F;
  695.   PRINTER_NOTIFY_FIELD_START_TIME              = $10;
  696.   PRINTER_NOTIFY_FIELD_UNTIL_TIME              = $11;
  697.   PRINTER_NOTIFY_FIELD_STATUS                  = $12;
  698.   PRINTER_NOTIFY_FIELD_STATUS_STRING           = $13;
  699.   PRINTER_NOTIFY_FIELD_CJOBS                   = $14;
  700.   PRINTER_NOTIFY_FIELD_AVERAGE_PPM             = $15;
  701.   PRINTER_NOTIFY_FIELD_TOTAL_PAGES             = $16;
  702.   PRINTER_NOTIFY_FIELD_PAGES_PRINTED           = $17;
  703.   PRINTER_NOTIFY_FIELD_TOTAL_BYTES             = $18;
  704.   PRINTER_NOTIFY_FIELD_BYTES_PRINTED           = $19;
  705.  
  706.   JOB_NOTIFY_FIELD_PRINTER_NAME                = $00;
  707.   JOB_NOTIFY_FIELD_MACHINE_NAME                = $01;
  708.   JOB_NOTIFY_FIELD_PORT_NAME                   = $02;
  709.   JOB_NOTIFY_FIELD_USER_NAME                   = $03;
  710.   JOB_NOTIFY_FIELD_NOTIFY_NAME                 = $04;
  711.   JOB_NOTIFY_FIELD_DATATYPE                    = $05;
  712.   JOB_NOTIFY_FIELD_PRINT_PROCESSOR             = $06;
  713.   JOB_NOTIFY_FIELD_PARAMETERS                  = $07;
  714.   JOB_NOTIFY_FIELD_DRIVER_NAME                 = $08;
  715.   JOB_NOTIFY_FIELD_DEVMODE                     = $09;
  716.   JOB_NOTIFY_FIELD_STATUS                      = $0A;
  717.   JOB_NOTIFY_FIELD_STATUS_STRING               = $0B;
  718.   JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR         = $0C;
  719.   JOB_NOTIFY_FIELD_DOCUMENT                    = $0D;
  720.   JOB_NOTIFY_FIELD_PRIORITY                    = $0E;
  721.   JOB_NOTIFY_FIELD_POSITION                    = $0F;
  722.   JOB_NOTIFY_FIELD_SUBMITTED                   = $10;
  723.   JOB_NOTIFY_FIELD_START_TIME                  = $11;
  724.   JOB_NOTIFY_FIELD_UNTIL_TIME                  = $12;
  725.   JOB_NOTIFY_FIELD_TIME                        = $13;
  726.   JOB_NOTIFY_FIELD_TOTAL_PAGES                 = $14;
  727.   JOB_NOTIFY_FIELD_PAGES_PRINTED               = $15;
  728.   JOB_NOTIFY_FIELD_TOTAL_BYTES                 = $16;
  729.   JOB_NOTIFY_FIELD_BYTES_PRINTED               = $17;
  730.  
  731.  
  732. type
  733.   PPrinterNotifyOptionsType = ^TPrinterNotifyOptionsType;
  734.   TPrinterNotifyOptionsType = record
  735.     wType: Word;
  736.     Reserved0: Word;
  737.     Reserved1: DWORD;
  738.     Reserved2: DWORD;
  739.     Count: DWORD;
  740.     pFields: PWord;
  741.   end;
  742.  
  743. const
  744.   PRINTER_NOTIFY_OPTIONS_REFRESH  = $01;
  745.  
  746. type
  747.   PPrinterNotifyOptions = ^TPrinterNotifyOptions;
  748.   TPrinterNotifyOptions = record
  749.     Version: DWORD;
  750.     Flags: DWORD;
  751.     Count: DWORD;
  752.     pTypes: PPrinterNotifyOptionsType;
  753.   end;
  754.  
  755. const
  756.   PRINTER_NOTIFY_INFO_DISCARDED       = $01;
  757.  
  758. type
  759.   PPrinterNotifyInfoData = ^TPrinterNotifyInfoData;
  760.   TPrinterNotifyInfoData = record
  761.     wType: Word;
  762.     Field: Word;
  763.     Reserved: DWORD;
  764.     Id: DWORD;
  765.     NotifyData: record
  766.       case Integer of
  767.         0: (adwData: array[0..1] of DWORD);
  768.         1: (Data: record 
  769.               cbBuf: DWORD; 
  770.               pBuf: Pointer; 
  771.             end);
  772.     end;
  773.   end;
  774.  
  775.   PPrinterNotifyInfo = ^TPrinterNotifyInfo;
  776.   TPrinterNotifyInfo = record
  777.     Version: DWORD;
  778.     Flags: DWORD;
  779.     Count: DWORD;
  780.     aData: array[0..0] of TPrinterNotifyInfoData;
  781.   end;
  782.  
  783. function WaitForPrinterChange(hPrinter: THandle; Flags: DWORD): DWORD; stdcall;
  784. function FindFirstPrinterChangeNotification(hPrinter: THandle; fdwFlags: DWORD;
  785.   fdwOptions: DWORD; pPrinterNotifyOptions: Pointer): THandle; stdcall;
  786. function FindNextPrinterChangeNotification(hChange: THandle; var pdwChange: DWORD;
  787.   pvReserved: Pointer; var ppPrinterNotifyInfo: Pointer): BOOL; stdcall;
  788. function FreePrinterNotifyInfo(pPrinterNotifyInfo: PPrinterNotifyInfo): BOOL; stdcall;
  789. function FindClosePrinterChangeNotification(hChange: THandle): BOOL; stdcall;
  790.  
  791. const
  792.   PRINTER_CHANGE_ADD_PRINTER              = $00000001;
  793.   PRINTER_CHANGE_SET_PRINTER              = $00000002;
  794.   PRINTER_CHANGE_DELETE_PRINTER           = $00000004;
  795.   PRINTER_CHANGE_FAILED_CONNECTION_PRINTER    = $00000008;
  796.   PRINTER_CHANGE_PRINTER                  = $000000FF;
  797.   PRINTER_CHANGE_ADD_JOB                  = $00000100;
  798.   PRINTER_CHANGE_SET_JOB                  = $00000200;
  799.   PRINTER_CHANGE_DELETE_JOB               = $00000400;
  800.   PRINTER_CHANGE_WRITE_JOB                = $00000800;
  801.   PRINTER_CHANGE_JOB                      = $0000FF00;
  802.   PRINTER_CHANGE_ADD_FORM                 = $00010000;
  803.   PRINTER_CHANGE_SET_FORM                 = $00020000;
  804.   PRINTER_CHANGE_DELETE_FORM              = $00040000;
  805.   PRINTER_CHANGE_FORM                     = $00070000;
  806.   PRINTER_CHANGE_ADD_PORT                 = $00100000;
  807.   PRINTER_CHANGE_CONFIGURE_PORT           = $00200000;
  808.   PRINTER_CHANGE_DELETE_PORT              = $00400000;
  809.   PRINTER_CHANGE_PORT                     = $00700000;
  810.   PRINTER_CHANGE_ADD_PRINT_PROCESSOR      = $01000000;
  811.   PRINTER_CHANGE_DELETE_PRINT_PROCESSOR   = $04000000;
  812.   PRINTER_CHANGE_PRINT_PROCESSOR          = $07000000;
  813.   PRINTER_CHANGE_ADD_PRINTER_DRIVER       = $10000000;
  814.   PRINTER_CHANGE_SET_PRINTER_DRIVER       = $20000000;
  815.   PRINTER_CHANGE_DELETE_PRINTER_DRIVER    = $40000000;
  816.   PRINTER_CHANGE_PRINTER_DRIVER           = $70000000;
  817.   PRINTER_CHANGE_TIMEOUT                  = $80000000;
  818.   PRINTER_CHANGE_ALL                      = $7777FFFF;
  819.  
  820. function PrinterMessageBoxA(hPrinter: THandle; Error: DWORD; hWnd: HWND; pText, pCaption: PAnsiChar;
  821.   dwType: DWORD): DWORD; stdcall;
  822. function PrinterMessageBoxW(hPrinter: THandle; Error: DWORD; hWnd: HWND; pText, pCaption: PWideChar;
  823.   dwType: DWORD): DWORD; stdcall;
  824. function PrinterMessageBox(hPrinter: THandle; Error: DWORD; hWnd: HWND; pText, pCaption: PChar;
  825.   dwType: DWORD): DWORD; stdcall;
  826.  
  827. const
  828.   PRINTER_ERROR_INFORMATION   = $80000000;
  829.   PRINTER_ERROR_WARNING       = $40000000;
  830.   PRINTER_ERROR_SEVERE        = $20000000;
  831.  
  832.   PRINTER_ERROR_OUTOFPAPER    = $00000001;
  833.   PRINTER_ERROR_JAM           = $00000002;
  834.   PRINTER_ERROR_OUTOFTONER    = $00000004;
  835.  
  836. function ClosePrinter(hPrinter: THandle): BOOL; stdcall;
  837. function AddFormA(hPrinter: THandle; Level: DWORD; pForm: Pointer): BOOL; stdcall;
  838. function AddFormW(hPrinter: THandle; Level: DWORD; pForm: Pointer): BOOL; stdcall;
  839. function AddForm(hPrinter: THandle; Level: DWORD; pForm: Pointer): BOOL; stdcall;
  840. function DeleteFormA(hPrinter: THandle; pFormName: PAnsiChar): BOOL; stdcall;
  841. function DeleteFormW(hPrinter: THandle; pFormName: PWideChar): BOOL; stdcall;
  842. function DeleteForm(hPrinter: THandle; pFormName: PChar): BOOL; stdcall;
  843. function GetFormA(hPrinter: THandle; pFormName: PAnsiChar; Level: DWORD; pForm: Pointer;
  844.   cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  845. function GetFormW(hPrinter: THandle; pFormName: PWideChar; Level: DWORD; pForm: Pointer;
  846.   cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  847. function GetForm(hPrinter: THandle; pFormName: PChar; Level: DWORD; pForm: Pointer;
  848.   cbBuf: DWORD; var pcbNeeded: DWORD): BOOL; stdcall;
  849. function SetFormA(hPrinter: THandle; pFormName: PAnsiChar; Level: DWORD; pForm: Pointer): BOOL; stdcall;
  850. function SetFormW(hPrinter: THandle; pFormName: PWideChar; Level: DWORD; pForm: Pointer): BOOL; stdcall;
  851. function SetForm(hPrinter: THandle; pFormName: PChar; Level: DWORD; pForm: Pointer): BOOL; stdcall;
  852. function EnumFormsA(hPrinter: THandle; Level: DWORD; pForm: Pointer; cbBuf: DWORD;
  853.   var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  854. function EnumFormsW(hPrinter: THandle; Level: DWORD; pForm: Pointer; cbBuf: DWORD;
  855.   var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  856. function EnumForms(hPrinter: THandle; Level: DWORD; pForm: Pointer; cbBuf: DWORD;
  857.   var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  858. function EnumMonitorsA(pName: PAnsiChar; Level: DWORD; pMonitors: Pointer; cbBuf: DWORD;
  859.   var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  860. function EnumMonitorsW(pName: PWideChar; Level: DWORD; pMonitors: Pointer; cbBuf: DWORD;
  861.   var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  862. function EnumMonitors(pName: PChar; Level: DWORD; pMonitors: Pointer; cbBuf: DWORD;
  863.   var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  864. function AddMonitorA(pName: PAnsiChar; Level: DWORD; pMonitors: Pointer): BOOL; stdcall;
  865. function AddMonitorW(pName: PWideChar; Level: DWORD; pMonitors: Pointer): BOOL; stdcall;
  866. function AddMonitor(pName: PChar; Level: DWORD; pMonitors: Pointer): BOOL; stdcall;
  867. function DeleteMonitorA(pName, pEnvironment, pMonitorName: PAnsiChar): BOOL; stdcall;
  868. function DeleteMonitorW(pName, pEnvironment, pMonitorName: PWideChar): BOOL; stdcall;
  869. function DeleteMonitor(pName, pEnvironment, pMonitorName: PChar): BOOL; stdcall;
  870. function EnumPortsA(pName: PAnsiChar; Level: DWORD; pPorts: Pointer; cbBuf: DWORD;
  871.   var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  872. function EnumPortsW(pName: PWideChar; Level: DWORD; pPorts: Pointer; cbBuf: DWORD;
  873.   var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  874. function EnumPorts(pName: PChar; Level: DWORD; pPorts: Pointer; cbBuf: DWORD;
  875.   var pcbNeeded, pcReturned: DWORD): BOOL; stdcall;
  876. function AddPortA(pName: PAnsiChar; hWnd: HWND; pMonitorName: PAnsiChar): BOOL; stdcall;
  877. function AddPortW(pName: PWideChar; hWnd: HWND; pMonitorName: PWideChar): BOOL; stdcall;
  878. function AddPort(pName: PChar; hWnd: HWND; pMonitorName: PChar): BOOL; stdcall;
  879. function ConfigurePortA(pName: PAnsiChar; hWnd: HWND; pPortName: PAnsiChar): BOOL; stdcall;
  880. function ConfigurePortW(pName: PWideChar; hWnd: HWND; pPortName: PWideChar): BOOL; stdcall;
  881. function ConfigurePort(pName: PChar; hWnd: HWND; pPortName: PChar): BOOL; stdcall;
  882. function DeletePortA(pName: PAnsiChar; hWnd: HWND; pPortName: PAnsiChar): BOOL; stdcall;
  883. function DeletePortW(pName: PWideChar; hWnd: HWND; pPortName: PWideChar): BOOL; stdcall;
  884. function DeletePort(pName: PChar; hWnd: HWND; pPortName: PChar): BOOL; stdcall;
  885. function AddPrinterConnectionA(pName: PAnsiChar): BOOL; stdcall;
  886. function AddPrinterConnectionW(pName: PWideChar): BOOL; stdcall;
  887. function AddPrinterConnection(pName: PChar): BOOL; stdcall;
  888. function DeletePrinterConnectionA(pName: PAnsiChar): BOOL; stdcall;
  889. function DeletePrinterConnectionW(pName: PWideChar): BOOL; stdcall;
  890. function DeletePrinterConnection(pName: PChar): BOOL; stdcall;
  891. function ConnectToPrinterDlg(hwnd: HWND; Flags: DWORD): THandle; stdcall;
  892.  
  893. type
  894.   PProvidorInfo1A = ^TProvidorInfo1A;
  895.   PProvidorInfo1W = ^TProvidorInfo1W;
  896.   PProvidorInfo1 = PProvidorInfo1A;
  897.   TProvidorInfo1A = record
  898.     pName: PAnsiChar;
  899.     pEnvironment: PAnsiChar;
  900.     pDLLName: PAnsiChar;
  901.   end;
  902.   TProvidorInfo1W = record
  903.     pName: PWideChar;
  904.     pEnvironment: PWideChar;
  905.     pDLLName: PWideChar;
  906.   end;
  907.   TProvidorInfo1 = TProvidorInfo1A;
  908.  
  909. function AddPrintProvidorA(pName: PAnsiChar; level: DWORD; pProvidorInfo: Pointer): BOOL; stdcall;
  910. function AddPrintProvidorW(pName: PWideChar; level: DWORD; pProvidorInfo: Pointer): BOOL; stdcall;
  911. function AddPrintProvidor(pName: PChar; level: DWORD; pProvidorInfo: Pointer): BOOL; stdcall;
  912. function DeletePrintProvidorA(pName, pEnvironment, pPrintProvidorName: PAnsiChar): BOOL; stdcall;
  913. function DeletePrintProvidorW(pName, pEnvironment, pPrintProvidorName: PWideChar): BOOL; stdcall;
  914. function DeletePrintProvidor(pName, pEnvironment, pPrintProvidorName: PChar): BOOL; stdcall;
  915.  
  916. const
  917.   SERVER_ACCESS_ADMINISTER    = $00000001;
  918.   SERVER_ACCESS_ENUMERATE     = $00000002;
  919.   PRINTER_ACCESS_ADMINISTER   = $00000004;
  920.   PRINTER_ACCESS_USE          = $00000008;
  921.   JOB_ACCESS_ADMINISTER       = $00000010;
  922.  
  923. { Access rights for print servers }
  924.  
  925.   SERVER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or 
  926.     SERVER_ACCESS_ADMINISTER or SERVER_ACCESS_ENUMERATE);
  927.   SERVER_READ = (STANDARD_RIGHTS_READ or SERVER_ACCESS_ENUMERATE);
  928.   SERVER_WRITE = (STANDARD_RIGHTS_WRITE or 
  929.     SERVER_ACCESS_ADMINISTER or SERVER_ACCESS_ENUMERATE);
  930.   SERVER_EXECUTE = (STANDARD_RIGHTS_EXECUTE or SERVER_ACCESS_ENUMERATE);
  931.  
  932. { Access rights for printers }
  933.  
  934.   PRINTER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or 
  935.     PRINTER_ACCESS_ADMINISTER or PRINTER_ACCESS_USE);
  936.   PRINTER_READ = (STANDARD_RIGHTS_READ or PRINTER_ACCESS_USE);
  937.   PRINTER_WRITE = (STANDARD_RIGHTS_WRITE or PRINTER_ACCESS_USE);
  938.   PRINTER_EXECUTE = (STANDARD_RIGHTS_EXECUTE or PRINTER_ACCESS_USE);
  939.  
  940. { Access rights for jobs }
  941.  
  942.   JOB_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or JOB_ACCESS_ADMINISTER);
  943.   JOB_READ = (STANDARD_RIGHTS_READ or JOB_ACCESS_ADMINISTER);
  944.   JOB_WRITE = (STANDARD_RIGHTS_WRITE or JOB_ACCESS_ADMINISTER);
  945.   JOB_EXECUTE = (STANDARD_RIGHTS_EXECUTE or JOB_ACCESS_ADMINISTER);
  946.  
  947. const
  948.   winspl = 'winspool.drv';
  949.  
  950. implementation
  951.  
  952. function AbortPrinter; external winspl name 'AbortPrinter';
  953. function AddFormA; external winspl name 'AddFormA';
  954. function AddFormW; external winspl name 'AddFormW';
  955. function AddForm; external winspl name 'AddFormA';
  956. function AddJobA; external winspl name 'AddJobA';
  957. function AddJobW; external winspl name 'AddJobW';
  958. function AddJob; external winspl name 'AddJobA';
  959. function AddMonitorA; external winspl name 'AddMonitorA';
  960. function AddMonitorW; external winspl name 'AddMonitorW';
  961. function AddMonitor; external winspl name 'AddMonitorA';
  962. function AddPortA; external winspl name 'AddPortA';
  963. function AddPortW; external winspl name 'AddPortW';
  964. function AddPort; external winspl name 'AddPortA';
  965. function AddPrinterA; external winspl name 'AddPrinterA';
  966. function AddPrinterW; external winspl name 'AddPrinterW';
  967. function AddPrinter; external winspl name 'AddPrinterA';
  968. function AddPrinterConnectionA; external winspl name 'AddPrinterConnectionA';
  969. function AddPrinterConnectionW; external winspl name 'AddPrinterConnectionW';
  970. function AddPrinterConnection; external winspl name 'AddPrinterConnectionA';
  971. function AddPrinterDriverA; external winspl name 'AddPrinterDriverA';
  972. function AddPrinterDriverW; external winspl name 'AddPrinterDriverW';
  973. function AddPrinterDriver; external winspl name 'AddPrinterDriverA';
  974. function AddPrintProcessorA; external winspl name 'AddPrintProcessorA';
  975. function AddPrintProcessorW; external winspl name 'AddPrintProcessorW';
  976. function AddPrintProcessor; external winspl name 'AddPrintProcessorA';
  977. function AddPrintProvidorA; external winspl name 'AddPrintProvidorA';
  978. function AddPrintProvidorW; external winspl name 'AddPrintProvidorW';
  979. function AddPrintProvidor; external winspl name 'AddPrintProvidorA';
  980. function AdvancedDocumentPropertiesA; external winspl name 'AdvancedDocumentPropertiesA';
  981. function AdvancedDocumentPropertiesW; external winspl name 'AdvancedDocumentPropertiesW';
  982. function AdvancedDocumentProperties; external winspl name 'AdvancedDocumentPropertiesA';
  983. function ClosePrinter; external winspl name 'ClosePrinter';
  984. function ConfigurePortA; external winspl name 'ConfigurePortA';
  985. function ConfigurePortW; external winspl name 'ConfigurePortW';
  986. function ConfigurePort; external winspl name 'ConfigurePortA';
  987. function ConnectToPrinterDlg; external winspl name 'ConnectToPrinterDlg';
  988. function DeleteFormA; external winspl name 'DeleteFormA';
  989. function DeleteFormW; external winspl name 'DeleteFormW';
  990. function DeleteForm; external winspl name 'DeleteFormA';
  991. function DeleteMonitorA; external winspl name 'DeleteMonitorA';
  992. function DeleteMonitorW; external winspl name 'DeleteMonitorW';
  993. function DeleteMonitor; external winspl name 'DeleteMonitorA';
  994. function DeletePortA; external winspl name 'DeletePortA';
  995. function DeletePortW; external winspl name 'DeletePortW';
  996. function DeletePort; external winspl name 'DeletePortA';
  997. function DeletePrinter; external winspl name 'DeletePrinter';
  998. function DeletePrinterConnectionA; external winspl name 'DeletePrinterConnectionA';
  999. function DeletePrinterConnectionW; external winspl name 'DeletePrinterConnectionW';
  1000. function DeletePrinterConnection; external winspl name 'DeletePrinterConnectionA';
  1001. function DeletePrinterDriverA; external winspl name 'DeletePrinterDriverA';
  1002. function DeletePrinterDriverW; external winspl name 'DeletePrinterDriverW';
  1003. function DeletePrinterDriver; external winspl name 'DeletePrinterDriverA';
  1004. function DeletePrintProcessorA; external winspl name 'DeletePrintProcessorA';
  1005. function DeletePrintProcessorW; external winspl name 'DeletePrintProcessorW';
  1006. function DeletePrintProcessor; external winspl name 'DeletePrintProcessorA';
  1007. function DeletePrintProvidorA; external winspl name 'DeletePrintProvidorA';
  1008. function DeletePrintProvidorW; external winspl name 'DeletePrintProvidorW';
  1009. function DeletePrintProvidor; external winspl name 'DeletePrintProvidorA';
  1010. function DocumentPropertiesA; external winspl name 'DocumentPropertiesA';
  1011. function DocumentPropertiesW; external winspl name 'DocumentPropertiesW';
  1012. function DocumentProperties; external winspl name 'DocumentPropertiesA';
  1013. function EndDocPrinter; external winspl name 'EndDocPrinter';
  1014. function EndPagePrinter; external winspl name 'EndPagePrinter';
  1015. function EnumFormsA; external winspl name 'EnumFormsA';
  1016. function EnumFormsW; external winspl name 'EnumFormsW';
  1017. function EnumForms; external winspl name 'EnumFormsA';
  1018. function EnumJobsA; external winspl name 'EnumJobsA';
  1019. function EnumJobsW; external winspl name 'EnumJobsW';
  1020. function EnumJobs; external winspl name 'EnumJobsA';
  1021. function EnumMonitorsA; external winspl name 'EnumMonitorsA';
  1022. function EnumMonitorsW; external winspl name 'EnumMonitorsW';
  1023. function EnumMonitors; external winspl name 'EnumMonitorsA';
  1024. function EnumPortsA; external winspl name 'EnumPortsA';
  1025. function EnumPortsW; external winspl name 'EnumPortsW';
  1026. function EnumPorts; external winspl name 'EnumPortsA';
  1027. function EnumPrinterDriversA; external winspl name 'EnumPrinterDriversA';
  1028. function EnumPrinterDriversW; external winspl name 'EnumPrinterDriversW';
  1029. function EnumPrinterDrivers; external winspl name 'EnumPrinterDriversA';
  1030. function EnumPrintersA; external winspl name 'EnumPrintersA';
  1031. function EnumPrintersW; external winspl name 'EnumPrintersW';
  1032. function EnumPrinters; external winspl name 'EnumPrintersA';
  1033. function EnumPrintProcessorDatatypesA; external winspl name 'EnumPrintProcessorDatatypesA';
  1034. function EnumPrintProcessorDatatypesW; external winspl name 'EnumPrintProcessorDatatypesW';
  1035. function EnumPrintProcessorDatatypes; external winspl name 'EnumPrintProcessorDatatypesA';
  1036. function EnumPrintProcessorsA; external winspl name 'EnumPrintProcessorsA';
  1037. function EnumPrintProcessorsW; external winspl name 'EnumPrintProcessorsW';
  1038. function EnumPrintProcessors; external winspl name 'EnumPrintProcessorsA';
  1039. function FindClosePrinterChangeNotification; external winspl name 'FindClosePrinterChangeNotification';
  1040. function FindFirstPrinterChangeNotification; external winspl name 'FindFirstPrinterChangeNotification';
  1041. function FindNextPrinterChangeNotification; external winspl name 'FindNextPrinterChangeNotification';
  1042. function FreePrinterNotifyInfo; external winspl name 'FreePrinterNotifyInfo';
  1043. function GetFormA; external winspl name 'GetFormA';
  1044. function GetFormW; external winspl name 'GetFormW';
  1045. function GetForm; external winspl name 'GetFormA';
  1046. function GetJobA; external winspl name 'GetJobA';
  1047. function GetJobW; external winspl name 'GetJobW';
  1048. function GetJob; external winspl name 'GetJobA';
  1049. function GetPrinterA; external winspl name 'GetPrinterA';
  1050. function GetPrinterW; external winspl name 'GetPrinterW';
  1051. function GetPrinter; external winspl name 'GetPrinterA';
  1052. function GetPrinterDataA; external winspl name 'GetPrinterDataA';
  1053. function GetPrinterDataW; external winspl name 'GetPrinterDataW';
  1054. function GetPrinterData; external winspl name 'GetPrinterDataA';
  1055. function GetPrinterDriverA; external winspl name 'GetPrinterDriverA';
  1056. function GetPrinterDriverW; external winspl name 'GetPrinterDriverW';
  1057. function GetPrinterDriver; external winspl name 'GetPrinterDriverA';
  1058. function GetPrinterDriverDirectoryA; external winspl name 'GetPrinterDriverDirectoryA';
  1059. function GetPrinterDriverDirectoryW; external winspl name 'GetPrinterDriverDirectoryW';
  1060. function GetPrinterDriverDirectory; external winspl name 'GetPrinterDriverDirectoryA';
  1061. function GetPrintProcessorDirectoryA; external winspl name 'GetPrintProcessorDirectoryA';
  1062. function GetPrintProcessorDirectoryW; external winspl name 'GetPrintProcessorDirectoryW';
  1063. function GetPrintProcessorDirectory; external winspl name 'GetPrintProcessorDirectoryA';
  1064. function OpenPrinterA; external winspl name 'OpenPrinterA';
  1065. function OpenPrinterW; external winspl name 'OpenPrinterW';
  1066. function OpenPrinter; external winspl name 'OpenPrinterA';
  1067. function PrinterMessageBoxA; external winspl name 'PrinterMessageBoxA';
  1068. function PrinterMessageBoxW; external winspl name 'PrinterMessageBoxW';
  1069. function PrinterMessageBox; external winspl name 'PrinterMessageBoxA';
  1070. function PrinterProperties; external winspl name 'PrinterProperties';
  1071. function ReadPrinter; external winspl name 'ReadPrinter';
  1072. function ResetPrinterA; external winspl name 'ResetPrinterA';
  1073. function ResetPrinterW; external winspl name 'ResetPrinterW';
  1074. function ResetPrinter; external winspl name 'ResetPrinterA';
  1075. function ScheduleJob; external winspl name 'ScheduleJob';
  1076. function SetFormA; external winspl name 'SetFormA';
  1077. function SetFormW; external winspl name 'SetFormW';
  1078. function SetForm; external winspl name 'SetFormA';
  1079. function SetJobA; external winspl name 'SetJobA';
  1080. function SetJobW; external winspl name 'SetJobW';
  1081. function SetJob; external winspl name 'SetJobA';
  1082. function SetPrinterA; external winspl name 'SetPrinterA';
  1083. function SetPrinterW; external winspl name 'SetPrinterW';
  1084. function SetPrinter; external winspl name 'SetPrinterA';
  1085. function SetPrinterDataA; external winspl name 'SetPrinterDataA';
  1086. function SetPrinterDataW; external winspl name 'SetPrinterDataW';
  1087. function SetPrinterData; external winspl name 'SetPrinterDataA';
  1088. function StartDocPrinterA; external winspl name 'StartDocPrinterA';
  1089. function StartDocPrinterW; external winspl name 'StartDocPrinterW';
  1090. function StartDocPrinter; external winspl name 'StartDocPrinterA';
  1091. function StartPagePrinter; external winspl name 'StartPagePrinter';
  1092. function WaitForPrinterChange; external winspl name 'WaitForPrinterChange';
  1093. function WritePrinter; external winspl name 'WritePrinter';
  1094.  
  1095. end.
  1096.