Where are UploadPrinterDriverPackage and InstallPrinterDriverFromPackage in winspool.drv

Posted on 2006-06-05
Last Modified: 2008-10-31
I have searched really hard to find how to call the methods UploadPrinterDriverPackage and InstallPrinterDriverFromPackage that are described in the "Printing and Print spooler functions" described on MSDN for Windows GDI. The documentation describes those methods and several other methods that are not found either. It refers to winspool as header and library and I assume that they then should be available in winspool.drv as the other methods described and working.

When I run Dumpbin on winspool.drv I dont find some of the functions described in the documentation on

I am coding from both VB.NET but mainly from C#.NET in VS 2005 and uses many of the existing methods today in winspool.drv

I also have anothor smaller question related to calling e.g. winspool.drv methods, is it unsafe to use this kind of DllImport calls or can a application using this be successfully tested in Microsofts test program within Microsoft Certified partner program?

I really need help from you mega experts out there to solve this (the first question about winspool methods).


/ Mikael
Question by:activephoto
    LVL 48

    Accepted Solution

    Windows NT/2000/XP/Vista: Included in Windows Vista and later.

    Do you serch this function in Vista or other version?
    LVL 6

    Author Comment

    Hi AlexFM,
    Thanx for you eagle eyes :-) . My eyes was reading included in XP etc..... sometimes even the brain gets blind ;-)

    thanks, you just saved me from searching on something thats not even there!

    p.s. Maybe you know another way to solve this before vista?

    / Mikael
    LVL 1

    Expert Comment

    These functions are not properly exported in the Winspool.drv, you can use LoadLibrary() and GetProcAddress() to get hold of those functions. Here is a sample code you can use:

    #include "Winspool.h"

    typedef HRESULT (*LPUploadPrinterDriverPackage)(
            LPCTSTR  pszServer,
            LPCTSTR  pszInfPath,
            LPCTSTR  pszEnvironment,
            DWORD    dwFlags,
            HWND     hwnd,
            LPTSTR   pszDestInfPath,
            PULONG   pcchDestInfPath

    typedef HRESULT (*LPInstallPrinterDriverFromPackage)(
      LPCTSTR  pszServer,
      LPCTSTR  pszInfPath,
      LPCTSTR  pszDriverName,
      LPCTSTR  pszEnvironment,
      DWORD    dwFlags

    DWORD MyInstallDriver(HWND     hwnd)
          TCHAR szDestInfPath[MAX_PATH*2 + 1];
          DWORD dwDestLen = MAX_PATH*2;
          LPUploadPrinterDriverPackage pUploadPackage = NULL;
          HINSTANCE hInstance = ::LoadLibrary(_TEXT("Winspool.drv"));
          pUploadPackage = (LPUploadPrinterDriverPackage)GetProcAddress(hInstance, "UploadPrinterDriverPackageW");
                return 0L;
          HRESULT lResult = pUploadPackage(
                                          _TEXT("Windows NT x86"),
                                          UPDP_SILENT_UPLOAD | UPDP_UPLOAD_ALWAYS,

          LPInstallPrinterDriverFromPackage pInstallPackage = NULL;
          pInstallPackage = (LPInstallPrinterDriverFromPackage)GetProcAddress(hInstance, "InstallPrinterDriverFromPackageW");
                lResult = pInstallPackage(NULL,
                                        _TEXT("My Driver Name"),
                                        _TEXT("Windows NT x86"),
          return (DWORD)lResult;

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    Problem with Pie chart in Jsp 20 155
    Opening a Access Database 5 104
    countHi2 challenge 7 30
    firstChar challenge 13 56
    How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now