Signed ghostscript postscript print driver - windows

I am using the Windows postscript print driver that is shipped with ghostscript (lib/ghostpdf.inf) to generate postscript files from print jobs.
However the postscript driver is not digitally signed, so Windows 8 and Windows Server 2012 won't allow installing it without booting into the "allow unsigned drivers"-mode.
Do you know if there is any signed version out there to be used with the latest Windows versions?
If thats not the case, I am fine compiling and signing it myself, however I was not able to find the source code for the postscript print driver within the git repo available at http://git.ghostscript.com/ghostpdl.git.
May I've just overseen it since I am not familiar with building drivers.
Can one give me a hint where I can find the postscript driver files to compile it myself?
EDIT: How does the .INF file tell windows where the driver binaries are located? I've looked into the "ClassGUID" however its the same for all drivers and the registry entry says something about C:\Windows\System32\ntprint.dll. I don't think this is important for the problem, is it?

To sign "the ghostscript driver" you just have to sign the INF-file that comes with Ghostscript.
There's an article on technet describing the steps required to do so.
The steps are:
1) Create/acquire a certificate
2) Ensure that your computer trusts the certificate (place it in your cert store if required)
3) Download and install the Windows Driver Kit (WDK)
4) Change the CatalogFile=oemprint.cat in the INF file to ghostpdf.cat
5) Change the DriverVer=01/02/2007,1.0.0.1 to DriverVer=01/01/2013,1.0.0.1 (maybe you need some other date, you'll see that in the next step)
6) Use the Inf2Cat tool to create a cat file (was at C:\Program Files (x86)\Windows Kits\8.0\bin\x86 for me):
NOTE
Use cmd.exe not powershell, as powershell gives Parameter format not correct. error all the time
Command:
inf2cat.exe /driver:c:\path\to\folder\whereCatFileIsIn /os:7_X86,7_X64,8_X86,8_X64[,other OS you'd like to support]
7) Sign the cat file using the signtool (Same directory as the Inf2Cat tool)
Command:
SignTool.exe sign /f "C:Path\to\my.pfx" /t http://timestamp.verisign.com/scripts/timestamp.dll "C:\Path\To\ghostpdf.cat"
(See the signtool docs for more informations about the available paramters)

.inf files are not drivers, they are just text files with some installer information. There is no signed version of this, nor do you need it, you can use the output of any PostScript driver with Ghostscript.
You can't compile a .inf file, because there is nothing to compile, I have no idea how you go about signing such a thing in the latest versions of Windows, but if you want to give it a try you can open the .inf file with a text editor.

Q: Do you know if there is any signed version out there to be used with the latest Windows versions?
* Workaround *
A: For my Postscript driver issue I re-used the already signed driver from freeware PDF generator PDFil Writer.
https://www.pdfill.com/freewriter.html
In my case, I am a Sybase Powerbuilder developer, and my application depends on the Ghostscript Postscript driver.
I hope this helps.

Related

changing drivers through batch file

Is there a way to forcibly change drivers for particular devices in a batch file?
What my issue is here is that I'm trying to automate the process of selecting the correct driver for a projector that is connected to a computer and right now the projector is turned on automatically after the computer is started through a batch file.
However generic drivers are selected instead of the proper driver for that projector.
Is there a command I can use to forcibly change the driver for that projector or is there another way to change the default driver from the generic to the one I need automatically rather than manually?
In your batch file you need to find out:
Windows x86 (32 bit) or Windows x64 (64 bit) for example with:
if "%ProgramFiles(x86)%" == "" goto Driver32Bit
:Driver64Bit
echo Detected Windows x64
rem Commands for installing correct 64 bit driver after determining Windows version.
goto :EOF
:Driver32Bit
echo Detected Windows x86
rem Commands for installing correct 32 bit driver after determining Windows version.
goto :EOF
Windows version using command ver for selecting correct driver directory.
In each directory containing the driver files for appropriate Windows there should be dpinst32.exe or dpinst64.exe to install the driver. See Driver Package Installer (DPInst) for details about this free Microsoft application for installing drivers.
Very often the manufacturer of the driver delivers the driver packages already with dpinst32.exe and dpinst64.exe as often used by their own driver installers, too. Otherwise you need to download Windows Driver Kit and extract those two files from WDK package. Installing WDK is not necessary.

program to install firefox exetension in windows?

Is it possible to build a installer(or program) in windows 7, that can install extension to firefox (if the browser installed on the machine).
or atleast help me by providing command to install firefox extension through command line in windows7.
("firefox addon.xpi" command is available in linux)
Thanks
Installation of extension in Firefox is very simple.
You need to launch Firefox.exe with your .xpi file as parameter
The official documentation says you should use -install-global-extension switch (not sure why, it should worked also without it, at least in older versions it did).
firefox.exe -install-global-extension "<path>\extension-file.xpi"
Details here: http://kb.mozillazine.org/Command_line_arguments
If you want to create whole installer with this feature, let's say in NSIS:
Function InstallFirefoxExt
InitPluginsDir
SetOutpath "$PLUGINSDIR\"
File "extension-file.xpi" # Extract file to temporary directory
Exec '"<path>\firefox.exe" -install-global-extension "$PLUGINSDIR\\extension-file.xpi"'
FunctionEnd
If you use other installation system it is very similar.
To install a Firefox extension on Windows you should simply add a value to the Windows registry. This can be done by opening a .reg file or running reg.exe with the right parameters, a custom Windows application to add it would also be trivial. Adding to HKEY_CURRENT_USER can be done without advanced privileges (no UAC prompt), adding to HKEY_LOCAL_MACHINE (for all users) requires administrator privileges.
I would advise against using -install-global-extension since that adds the extension to the Firefox application directory - you have to know where Firefox is installed, administrator privileges are always required and updating/uninstalling the extension is non-trivial. Also, firefox addon.xpi will install into the default user profile - in addition to the disadvantages of -install-global-extension this doesn't consider the fact that more user profiles could exist on the computer (or be created in future).
Firefox path can be detected by reading this registry key:
"HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\20.0.1 (en-US)\Main" "PathToExe"
On my PC this PathToExe looks like "C:\Program Files\Mozilla Firefox\firefox.exe" so this is exactly the value you need.
However this is a little tricky because the key contains Firefox version 20.0.1 (en-US)
To get this version at first read this key:
"HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox" "CurrentVersion"
which will return 20.0.1 (en-US)
Simply join all parts together:
"HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\" + <CurrentVersion> + "\Main"
to get whole key.

Installer for windows 7/8 driver

I have a .inf file and a .sys file and a couple of dll's.
to install the driver manually i do from elevated command prompt :
devcon install driver.inf HID\driver
I want some pointers on how to make the installer for this driver .
Thanks.
PS: I am a complete noob when it comes to things related to drivers.
We can use a simple installer based on NSIS that copies the files and executes the command . Also devcon binary is not redistibutable but we can copy parts of the devcon source that we need in order to create a specific driver installer binary.

What is PnPUtil.exe location in 64bit systems?

I would like to install my USB device driver [.inf file] using PnPUtil.exe utility on both 32bit and 64bit systems for Windows Vista and Windows 7.
I tested on my machine [Windows 7 32bit] and everything was fine because PnpUtil.exe is located in: C:\Windows\System32\PnPUtil.exe.
But in 64bit Windows 7 the utility is not in this directory.
When I tried installing driver on different Windows 7 - 64bit machine I could found PnPUtil.exe in this location: C:\WIndows\winsxs\amd64_microsoft-windows-pnputil_31bf3856ad364e35_6.1.7600.16385_none_5958b438d6388d15\pnputil.exe
and the test was also fine.
So how can I exactly detect this directory on all platforms?
I noticed the path is dependent on built of Windows version - 6.1.7600.16385 - but how to detect the rest of path?
Or is the path always the same on all 64 bit platforms? And what about Vista?
The location of PnPUtil.exe seen from you installer application depends on the bitness of your installer:
32bit installer on 32bit Windows: %WinDir%\System32
64bit installer on 64bit Windows: %WinDir%\System32
32bit installer on 64bit Windows: %WinDir%\Sysnative (Windows Vista and up)
More info here:
http://www.samlogic.net/articles/sysnative-folder-64-bit-windows.htm
I recently came across this problem while trying to create an installer for ReplicatorG, which includes the Arduino drivers and some drivers specific to the Makerbot Replicator.
It seemed that there isn't any way to determine the location of PnPutil, and I instead had to acquire Microsoft's DIFx and use their redistributable DPinst.
There were a couple of strange things about DPinst that made it difficult to use. The first is that it didn't seem to run properly if it was located in a directory tree with spaces in the path. Who knows why. The second was that, because the Arduino drivers are unsigned, it needed to be run in legacy mode to keep from popping up a big, red dialog warning the user. To run it in legacy mode you use the /lm flag, but the flag must be lowercase. Again, it's unclear why.
In the end, I had the installer copy dpinst and each of the drivers to a folder in the temporary directory and then run dpinst. It pops up a nice little wizard and tells the user which drivers were installed.
From C:\WIndows\winsxs\
dir /s PnPUtil.*
will scan subdirectories

Where can I get the cabarc utility?

I'm trying to compile a program which uses cabarc.exe, but I don't have cabarc.exe. The problem is that the Microsoft Cabinet SDK is no longer available so I can't get it from there either.
Where can I get this file?
P.S. I'm looking for a download from a trusted source such as microsoft.com
It appears that the cabarc.exe utility has been replaced with makecab.exe, which comes with Windows [source].
It should be located in:
C:\WINDOWS\system32
The cabarc documentation can be found here.
The makecab documentation can be found here.
cabarc.exe is available as a part of the Windows XP Service Pack 2 Support Tools.
You can extract only this utility using commands like these (if you don't run XP):
WindowsXP-KB838079-SupportTools-ENU.exe /C /T:%TEMP%
extract /E %TEMP%\support.cab cabarc.exe
You can download the CabSDK from here:
Download the Microsoft Cabinet SDK version 4.71.410.0
In Windows 7 (and possibly Vista) instead of extract you use expand. The syntax is slightly different, but see below for the one that worked for me. Replace %TEMP% in the second command with wherever you want the cabarc.exe file to end up.
WindowsXP-KB838079-SupportTools-ENU.exe /C /T:%TEMP%
expand %TEMP%\support.cab -F:cabarc.exe %TEMP%
You can find cabarc.exe in the Internet Explorer Administration Kit.
Strangely though, IEAK 11 has cabarc.exe version 5.0.2147.1, while IEAK 10 has version 6.2.9200.16521.
For Windows 8 and Windows 8.1 use the Windows ADK
Download and install the Windows ADK from this website.
for the expand.exe command refer to
http://technet.microsoft.com/en-us/library/hh825253.aspx
The destination directory has to exist before executing the expand command. For example:
expand Dell-WinPE-Drivers-A02.CAB Dell-WinPE-Drivers-A02 -f:*

Resources