Click here to Skip to main content
15,868,340 members
Articles / Programming Languages / C++
Article

The Windows NT print spool shadow file format

Rate me:
Please Sign up or sign in to vote.
4.38/5 (4 votes)
2 Mar 2005CPOL2 min read 116.3K   27   26
Describes the (undocumented) layout of the .shd file.

Introduction

The shd file (spool shadow file) is a small file that accompanies each spooled print job. It contains the information that is used when you query a print job (with the GetJob API) and it is kept in a separate file so that this operation doesn't interfere with the spooling and despooling of a print job. The format of this file is not documented and so it is liable to change between versions of the windows operating system.

Currently it is like this:

  • [INT32] SpoolShadowFileFormat

This can be one of:

Public Enum SpoolShadowFileFormats
  SHD_SIGNATURE_WIN98 = &H494B
  SHD_SIGNATURE_WINNT = &H4966
  SHD_SIGNATURE_WIN2K = &H4967
  SHD_SIGNATURE_WIN2003 = &H4968
End Enum

Then for the newest two spool shadow file formats, we have:

  • [INT32] HeaderSize - The size of the fixed part of this record.
  • [INT16] Status - the job status flags.
  • [INT16] Padding - I'm not sure what (if anything) this is used for though it does often contain non zero values.
  • [INT32] JobId - the unique number of the print job, which is the JobId parameter in any call to GetJob() etc..
  • [INT32] Priority - A number between 1-99 which is the print job priority (higher is more priority).
  • [INT32] OffsetUserName - The offset of the user name that submitted the print job.
  • [INT32] Offset_NotifyName - Offset to the name of the user to notify when the job status changes.
  • [INT32] Offset_DocumentName - Offset to the document name.
  • [INT32] Offset_Port - Offset to the printer port name.
  • [INT32] Offset_PrinterName - Offset to the printer device name.
  • [INT32] Offset_DriverName - Offset to the printer driver name.
  • [INT32] Offset_DEVMODE - Offset to the DEVMODE structure in the file.
  • [INT32] Offset_PrintProcessorName - The offset in the file to the print processor name in the file.
  • [INT32] Offset_DataType - The offset in the file to the data type of the spool file...can be EMF or RAW.
  • [INT16] Year - The year of the date of submission of the print job.
  • [INT16] Month
  • [INT16] Day of week
  • [INT16] Day
  • [INT16] Hour
  • [INT16] Minute
  • [INT16] Second
  • [INT16] Millisecond
  • [INT32] StartTime - The start of the time window for this job.
  • [INT32] EndTime - The end of the time window for this job.
  • [INT32] SpoolFileSize - the size (in bytes) of the spool file.
  • [INT32] PageCount - and lastly the page count of the job.

Note that the dmCopies in this DEVMODE will hold the wrong value when the Microsoft Word multiple copies bug occurs.

Portions of this article based on www.undocprint.org/formats/winspool/shd. These portions are subject to the GNU Free Documentation License and are copyright © 2003-2005 Free Software Foundation, Inc.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Ireland Ireland
C# / SQL Server developer
Microsoft MVP (Azure) 2017
Microsoft MVP (Visual Basic) 2006, 2007

Comments and Discussions

 
QuestionJOB STAUS FLAG VALUES Pin
Member 85806854-Jun-14 21:49
Member 85806854-Jun-14 21:49 
AnswerRe: JOB STAUS FLAG VALUES Pin
Duncan Edwards Jones4-Jun-14 22:01
professionalDuncan Edwards Jones4-Jun-14 22:01 
GeneralRe: JOB STAUS FLAG VALUES Pin
Member 85806854-Jun-14 22:12
Member 85806854-Jun-14 22:12 
GeneralRe: JOB STAUS FLAG VALUES Pin
Duncan Edwards Jones4-Jun-14 23:10
professionalDuncan Edwards Jones4-Jun-14 23:10 
GeneralRe: JOB STAUS FLAG VALUES Pin
Member 85806855-Jun-14 0:15
Member 85806855-Jun-14 0:15 
GeneralRe: JOB STAUS FLAG VALUES Pin
Duncan Edwards Jones5-Jun-14 0:24
professionalDuncan Edwards Jones5-Jun-14 0:24 
QuestionMonitor Print Job Status Pin
MatthysDT18-Aug-11 2:47
MatthysDT18-Aug-11 2:47 
AnswerRe: Monitor Print Job Status Pin
Duncan Edwards Jones7-May-14 5:53
professionalDuncan Edwards Jones7-May-14 5:53 
GeneralOn 64 bit platforms ... Pin
theGyre24-May-07 4:58
theGyre24-May-07 4:58 
SHD files created on 64 bit platforms will have offsets that are INT64 not INT32. (i.e. XP-64, Win2003-64, etc.)

An easy method for determining which platform your file was created on is checking the header size. 64 bit = 184 bytes, 32 bit = 120 bytes

- theGyre
GeneralRe: On 64 bit platforms ... Pin
Duncan Edwards Jones24-May-07 7:43
professionalDuncan Edwards Jones24-May-07 7:43 
GeneralIsn't this dangerous Pin
Tony Edgecombe13-Nov-05 0:13
Tony Edgecombe13-Nov-05 0:13 
GeneralRe: Isn't this dangerous Pin
Duncan Edwards Jones14-Nov-05 4:39
professionalDuncan Edwards Jones14-Nov-05 4:39 
GeneralHi, about how to parsing .spl files Pin
ankea12-Nov-05 15:57
ankea12-Nov-05 15:57 
GeneralRe: Hi, about how to parsing .spl files Pin
Duncan Edwards Jones14-Nov-05 4:45
professionalDuncan Edwards Jones14-Nov-05 4:45 
QuestionHow to preview a Job in the Queue or Get the Contents of a Job in the Queue Pin
ankea1-Sep-05 22:45
ankea1-Sep-05 22:45 
AnswerRe: How to preview a Job in the Queue or Get the Contents of a Job in the Queue Pin
Duncan Edwards Jones1-Sep-05 23:01
professionalDuncan Edwards Jones1-Sep-05 23:01 
GeneralRe: How to preview a Job in the Queue or Get the Contents of a Job in the Queue Pin
ankea6-Sep-05 23:51
ankea6-Sep-05 23:51 
GeneralRe: How to preview a Job in the Queue or Get the Contents of a Job in the Queue Pin
Duncan Edwards Jones7-Sep-05 0:28
professionalDuncan Edwards Jones7-Sep-05 0:28 
GeneralIntercepting a print job Pin
AlexEvans2-Jul-05 16:44
AlexEvans2-Jul-05 16:44 
GeneralRe: Intercepting a print job Pin
Duncan Edwards Jones2-Jul-05 23:47
professionalDuncan Edwards Jones2-Jul-05 23:47 
GeneralRe: Intercepting a print job Pin
Alex Evans3-Jul-05 11:22
Alex Evans3-Jul-05 11:22 
GeneralRe: Intercepting a print job Pin
Duncan Edwards Jones3-Jul-05 21:57
professionalDuncan Edwards Jones3-Jul-05 21:57 
Generalwhy are there wrong in "pagecount" sometimes Pin
seaiam21-Jun-05 22:10
seaiam21-Jun-05 22:10 
GeneralRe: why are there wrong in "pagecount" sometimes Pin
Duncan Edwards Jones21-Jun-05 22:34
professionalDuncan Edwards Jones21-Jun-05 22:34 
GeneralRe: why are there wrong in "pagecount" sometimes Pin
fabioff28-Mar-07 3:00
fabioff28-Mar-07 3:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.