[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Where are UploadPrinterDriverPackage and InstallPrinterDriverFromPackage in winspool.drv

Posted on 2006-06-05
Medium Priority
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 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_7mgj.asp

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

AlexFM earned 2000 total points
ID: 16832020
Windows NT/2000/XP/Vista: Included in Windows Vista and later.

Do you serch this function in Vista or other version?

Author Comment

ID: 16832063
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

Expert Comment

ID: 22853993
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;

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses

872 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