Click here to Skip to main content
Licence CPOL
First Posted 2 Mar 2005
Views 67,246
Bookmarked 26 times

The Windows NT print spool shadow file format

By | 2 Mar 2005 | Article
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)

About the Author

Duncan Edwards Jones

Software Developer (Senior)
JP Morgan
Ireland Ireland

Member

Follow on Twitter Follow on Twitter
C# / SQL Server developer
Microsoft MVP 2006, 2007
Visual Basic .NET

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionMonitor Print Job Status PinmemberMatthysDT2:47 18 Aug '11  
GeneralOn 64 bit platforms ... PinmembertheGyre4:58 24 May '07  
GeneralRe: On 64 bit platforms ... PinmemberDuncan Edwards Jones7:43 24 May '07  
GeneralIsn't this dangerous PinmemberTony Edgecombe0:13 13 Nov '05  
GeneralRe: Isn't this dangerous PinmemberDuncan Edwards Jones4:39 14 Nov '05  
GeneralHi, about how to parsing .spl files Pinmemberankea15:57 12 Nov '05  
GeneralRe: Hi, about how to parsing .spl files PinmemberDuncan Edwards Jones4:45 14 Nov '05  
QuestionHow to preview a Job in the Queue or Get the Contents of a Job in the Queue Pinmemberankea22:45 1 Sep '05  
AnswerRe: How to preview a Job in the Queue or Get the Contents of a Job in the Queue PinmemberMerrion23:01 1 Sep '05  
GeneralRe: How to preview a Job in the Queue or Get the Contents of a Job in the Queue Pinmemberankea23:51 6 Sep '05  
GeneralRe: How to preview a Job in the Queue or Get the Contents of a Job in the Queue PinmemberMerrion0:28 7 Sep '05  
GeneralIntercepting a print job PinmemberAlexEvans16:44 2 Jul '05  
GeneralRe: Intercepting a print job PinmemberMerrion23:47 2 Jul '05  
GeneralRe: Intercepting a print job PinmemberAlex Evans11:22 3 Jul '05  
GeneralRe: Intercepting a print job PinmemberMerrion21:57 3 Jul '05  
Generalwhy are there wrong in "pagecount" sometimes Pinmemberseaiam22:10 21 Jun '05  
GeneralRe: why are there wrong in "pagecount" sometimes PinmemberMerrion22:34 21 Jun '05  
GeneralRe: why are there wrong in "pagecount" sometimes Pinmemberfabioff3:00 28 Mar '07  
GeneralRe: why are there wrong in "pagecount" sometimes Pinmemberkavirajan6:41 15 Apr '09  

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

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

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 2 Mar 2005
Article Copyright 2005 by Duncan Edwards Jones
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid