SetupCopyOEMInfW() function failing on 64 Bit Windows 7

I am installing NDIS Filter driver as a service using
SetupCopyOEMInfW(). It works fine on Windows XP and 32 Bit Windows 7
but on 64 Bit Windows 7 SetupCopyOEMInfW() function is returning below
error

SetupAPI log is as below

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

>> [SetupCopyOEMInf - C:\Windows\Inf\MyFltDrv.Inf]
>> Section start 2013/08/24 09:50:17.714
cmd: “C:\Windows\system32\ServiceInstaller.exe” -Embedding
sto: {Import Driver Package: C:\Windows\Inf\MyFltDrv.Inf} 09:50:17.730
sto: Importing driver package into Driver Store:
sto: Driver Store = C:\Windows\System32\DriverStore
(Online | 6.1.7601)
sto: Driver Package = C:\Windows\Inf\MyFltDrv.Inf
sto: Architecture = amd64
sto: Locale Name = neutral
sto: Flags = 0x00000008
sto: Copying driver package files to
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}’.
inf: Opened INF: ‘C:\Windows\Inf\MyFltDrv.Inf’ ([strings])
inf: Opened INF: ‘C:\Windows\Inf\MyFltDrv.Inf’ ([strings])
flq: {FILE_QUEUE_COPY}
flq: CopyStyle - 0x00000000
flq: SourceRootPath - ‘C:\Windows\Inf’
flq: SourceFilename - ‘MyFltDrv.cat’
flq: TargetDirectory-
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}’
flq: {FILE_QUEUE_COPY exit(0x00000000)}
flq: {FILE_QUEUE_COPY}
flq: CopyStyle - 0x00000000
flq: SourceRootPath - ‘C:\Windows\Inf’
flq: SourceFilename - ‘MyFltDrv.Inf’
flq: TargetDirectory-
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}’
flq: {FILE_QUEUE_COPY exit(0x00000000)}
flq: {_commit_file_queue}
flq: CommitQ DelNodes=0 RenNodes=0 CopyNodes=2
flq: {_commit_copy_subqueue}
flq: subqueue count=2
flq: source media:
flq: SourcePath - [C:\Windows\Inf]
flq: SourceFile - [MyFltDrv.cat]
flq: Flags - 0x00000000
flq: {_commit_copyfile}
flq: CopyFile: ‘C:\Windows\Inf\MyFltDrv.cat’
flq: to:
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}\SET5314.tmp’
flq: MoveFile:
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}\SET5314.tmp’
flq: to:
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}\MyFltDrv.cat’
flq: {_commit_copyfile exit OK}
flq: {_commit_copyfile}
flq: CopyFile: ‘C:\Windows\Inf\MyFltDrv.Inf’
flq: to:
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}\SET5315.tmp’
flq: MoveFile:
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}\SET5315.tmp’
flq: to:
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}\MyFltDrv.Inf’
flq: {_commit_copyfile exit OK}
flq: {_commit_copy_subqueue exit OK}
flq: {_commit_file_queue exit OK}
pol: {Driver package policy check} 09:50:17.886
pol: {Driver package policy check - exit(0x00000000)} 09:50:17.886
sto: {Stage Driver Package:
C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}\MyFltDrv.Inf}
09:50:17.886
inf: Opened INF:
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}\MyFltDrv.Inf’
([strings])
inf: Opened INF:
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}\MyFltDrv.Inf’
([strings])
sto: Copying driver package files:
sto: Source Path =
C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}
sto: Destination Path =
C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}
flq: {FILE_QUEUE_COPY}
flq: CopyStyle - 0x00000010
flq: SourceRootPath -
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}’
flq: SourceFilename - ‘MyFltDrv.cat’
flq: TargetDirectory-
‘C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}’
flq: {FILE_QUEUE_COPY exit(0x00000000)}
flq: {FILE_QUEUE_COPY}
flq: CopyStyle - 0x00000010
flq: SourceRootPath -
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}’
flq: SourceFilename - ‘MyFltDrv.Inf’
flq: TargetDirectory-
‘C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}’
flq: {FILE_QUEUE_COPY exit(0x00000000)}
flq: {_commit_file_queue}
flq: CommitQ DelNodes=0 RenNodes=0 CopyNodes=2
flq: {_commit_copy_subqueue}
flq: subqueue count=2
flq: source media:
flq: SourcePath -
[C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}]
flq: SourceFile - [MyFltDrv.cat]
flq: Flags - 0x00000000
flq: {_commit_copyfile}
flq: CopyFile:
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}\MyFltDrv.cat’
flq: to:
‘C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}\SET53B0.tmp’
flq: MoveFile:
‘C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}\SET53B0.tmp’
flq: to:
‘C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}\MyFltDrv.cat’
flq: {_commit_copyfile exit OK}
flq: {_commit_copyfile}
flq: CopyFile:
‘C:\Windows\TEMP{69571f18-6ae5-6cc3-b75d-2a71a582244e}\MyFltDrv.Inf’
flq: to:
‘C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}\SET53E0.tmp’
flq: MoveFile:
‘C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}\SET53E0.tmp’
flq: to:
‘C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}\MyFltDrv.Inf’
flq: {_commit_copyfile exit OK}
flq: {_commit_copy_subqueue exit OK}
flq: {_commit_file_queue exit OK}
sto: {DRIVERSTORE_IMPORT_NOTIFY_VALIDATE} 09:50:17.949
inf: Opened INF:
‘C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}\MyFltDrv.Inf’
([strings])
sig: {_VERIFY_FILE_SIGNATURE} 09:50:17.964
sig: Key = MyFltDrv.Inf
sig: FilePath =
C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}\MyFltDrv.Inf
sig: Catalog =
C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}\MyFltDrv.cat
flq: {SPFILENOTIFY_CABINETINFO}
flq: {SPFILENOTIFY_CABINETINFO - exit(0x00000000)}
flq: {SPFILENOTIFY_FILEEXTRACTED}
flq: {SPFILENOTIFY_FILEEXTRACTED - exit(0x00000000)}
! sig: Verifying file against specific (valid)
catalog failed! (0x800b0109)
! sig: Error 0x800b0109: A certificate chain
processed, but terminated in a root certificate which is not trusted
by the trust provider.
sig: {_VERIFY_FILE_SIGNATURE exit(0x800b0109)} 09:50:17.980
sig: {_VERIFY_FILE_SIGNATURE} 09:50:17.980
sig: Key = MyFltDrv.Inf
sig: FilePath =
C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}\MyFltDrv.Inf
sig: Catalog =
C:\Windows\System32\DriverStore\Temp{6729689b-7d3e-7542-55e7-6f1a2560e336}\MyFltDrv.cat
! sig: Verifying file against specific
Authenticode™ catalog failed! (0x800b0109)
! sig: Error 0x800b0109: A certificate chain
processed, but terminated in a root certificate which is not trusted
by the trust provider.
sig: {_VERIFY_FILE_SIGNATURE exit(0x800b0109)} 09:50:17.980
!!! sto: Catalog signer is untrusted. No error message
will be displayed as client is running in non-interactive mode.
!!! ndv: Driver package failed signature validation.
Error = 0xE0000247
sto: {DRIVERSTORE_IMPORT_NOTIFY_VALIDATE
exit(0xe0000247)} 09:50:17.980
!!! sto: Driver package failed signature verification.
Error = 0xE0000247
!!! sto: Failed to import driver package into Driver Store.
Error = 0xE0000247
sto: {Stage Driver Package: exit(0xe0000247)} 09:50:17.980
!!! sto: Failed to stage driver package to Driver Store. Error =
0xE0000247, Time = 234 ms
sto: {Import Driver Package: exit(0xe0000247)} 09:50:17.980
inf: Opened INF: ‘C:\Windows\Inf\MyFltDrv.Inf’ ([strings])
flq: {SPFILENOTIFY_CABINETINFO}
flq: {SPFILENOTIFY_CABINETINFO - exit(0x00000000)}
flq: {SPFILENOTIFY_FILEEXTRACTED}
flq: {SPFILENOTIFY_FILEEXTRACTED - exit(0x00000000)}
! inf: Add to Driver Store unsuccessful
! inf: Error 0xe0000247: A problem was encountered while attempting
to add the driver to the store.
!!! inf: returning failure to SetupCopyOEMInf
<<< Section end 2013/08/24 09:50:18.152
<<< [Exit status: FAILURE(0xe0000247)]

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Due to signature verification error, importing driver package into
Driver Store is failing.

When I execute “signtool.exe verify /v /pa MyFltDrv.sys” for my filter
driver, it checks Signature Certificate chain and Time Stamp
successfully without any warning and error.

What could be the reason SetCopyOEMInf() failing only on 64 bit
Windows 7 as same code is running fine on 32 bit Windows XP and 32 bit
Windows 7?

Regards,

PT

> When I execute “signtool.exe verify /v /pa MyFltDrv.sys” for my filter
driver

The signature verification error logged is against your .CAT file, not the
.SYS file.

What does signtool verify say about your .CAT file?

Good Luck,
Dave Cattley

Is your setup application 64 bit or 32 bit binary?

Prasad Talekar wrote:

I am installing NDIS Filter driver as a service using SetupCopyOEMInfW(). It works fine on Windows XP and 32 Bit Windows 7 but on 64 Bit Windows 7 SetupCopyOEMInfW() function is returning below error

Due to signature verification error, importing driver package into
Driver Store is failing.
When I execute “signtool.exe verify /v /pa MyFltDrv.sys” for my filter driver, it checks Signature Certificate chain and Time Stamp successfully without any warning and error.

You need to use the /kp switch to check the kernel signing policy, not
/pa. When you do, you should see the cross chain ending with the
Microsoft Code Verification Root. If not, then you are using the wrong
cross-certificate.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.