;;;
;;; Hardlock sys
;;;
;;;
;;; Copyright (c) 2006, Aladdin Knwoledge Systems LTD.
;;;
[Version]
Signature = "$Windows NT$"
Provider = %Aks%
DriverVer = 11/9/2006,3.41
CatalogFile = hardlock.cat
[DestinationDirs]
DefaultDestDir = 12
Hlk.DriverFiles = 12
;%windir%\system32\drivers
;;
;; Default install sections
;;
[DefaultInstall]
OptionDesc = %HlkServiceDesc%
CopyFiles = Hlk.DriverFiles
[DefaultInstall.Services]
AddService = %HlkServiceName%,,Hlk.Service
;
; Services Section
;
[Hlk.Service]
DisplayName = %HlkServiceName%
Description = %HlkServiceDesc%
ServiceBinary = %12%\hardlock.sys
;%windir%\system32\drivers\hardlock.sys
ServiceType = 1 ;SERVICE_FILE_SYSTEM_DRIVER
StartType = 2 ;SERVICE_AUTO_START
ErrorControl = 1 ;SERVICE_ERROR_NORMAL
;
; Copy Files
;
[Hlk.DriverFiles]
hardlock.sys
[SourceDisksNames]
1 = %Disk1%
[SourceDisksFiles]
hardlock.sys = 1
;;
;; String Section
;;
[Strings]
Aks = "Aladdin Knowledge Systems"
HlkServiceDesc = "Aladdin Hardlock Legacy Driver"
HlkServiceName = "hardlock"
Disk1 = "File Source Media"
I've build a .cat using makecat -v hardlock.cdf from following file:
[CatalogHeader]
Name=hardlock.cat
PublicVersion=0x0000001
EncodingType=0x00010001
CATATTR1=0x10010001:OSAttr:2:6.0
[CatalogFiles]
then signed the cat with our own certificate whic is added on the test
machine in the Trusted Root Store and Trusted Publisher store. On the test
Vista X64 build 5744 the testsigned is on and when I've embedded sign the
drivber there is no problem to load the driver.
I've used the fvollowing program to add the .cat to the cat data base and I
see that it is added in the cat root.
#include
#include
typedef BOOL (__stdcall * PCryptCATAdminAcquireContext)(PVOID*
phCatAdmin,const GUID* pgSubsystem,DWORD dwFlags);
typedef BOOL (__stdcall* PCryptCATAdminReleaseContext)(PVOID hCatAdmin,DWORD
dwFlags);
typedef PVOID (__stdcall * PCryptCATAdminAddCatalog)(PVOID hCatAdmin, WCHAR*
pwszCatalogFile, WCHAR* pwszSelectBaseName,DWORD dwFlags);
typedef BOOL (__stdcall* PCryptCATAdminReleaseCatalogContext)( PVOID
hCatAdmin, PVOID hCatInfo, DWORD dwFlags);
typedef struct wintrust_functions{
PCryptCATAdminAcquireContext pCryptCATAdminAcquireContext;
PCryptCATAdminReleaseContext pCryptCATAdminReleaseContext;
PCryptCATAdminAddCatalog pCryptCATAdminAddCatalog;
PCryptCATAdminReleaseCatalogContext pCryptCATAdminReleaseCatalogContext;
}WINTRUST_FCT;
void Char2Wchar(char* cmdline,unsigned int Srcsizem,char* wcmdline,unsigned
int DestSize)
{
int i = 0;
memset(wcmdline,0x0,DestSize);
for(i=0;i
(PCryptCATAdminAcquireContext)GetProcAddress(wintr ust,"CryptCATAdminAcquireContext");
if( NULL == fct->pCryptCATAdminAcquireContext ){
printf("can not get address for CryptCATAdminAcquireContext\n");
exit(0);
}
fct->pCryptCATAdminReleaseContext =
(PCryptCATAdminReleaseContext)GetProcAddress(wintr ust,"CryptCATAdminReleaseContext");
if( NULL == fct->pCryptCATAdminReleaseContext ){
printf("can not get address for CryptCATAdminReleaseContext\n");
exit(0);
}
fct->pCryptCATAdminAddCatalog =
(PCryptCATAdminAddCatalog)GetProcAddress(wintrust, "CryptCATAdminAddCatalog");
if( NULL == fct->pCryptCATAdminAddCatalog ){
printf("can not get address for CryptCATAdminAddCatalog\n");
exit(0);
}
fct->pCryptCATAdminReleaseCatalogContext =
(PCryptCATAdminReleaseCatalogContext)GetProcAddres s(wintrust,"CryptCATAdminReleaseCatalogContext");
if( NULL == fct->pCryptCATAdminReleaseCatalogContext ){
printf("can not get address for CryptCATAdminReleaseCatalogContext\n");
exit(0);
}
return 1;
}
int main(int argc, char* argv[])
{
WINTRUST_FCT wintrust;
int status;
PVOID catAdmin;
PVOID hcat;
char wPath[2*MAX_PATH]={0};
printf("usage: instcat
if( argc != 2 ){
printf("usage: instcat
exit(0);
}
hhls_GetWinTrustFct(&wintrust);
if( FALSE == wintrust.pCryptCATAdminAcquireContext(&catAdmin,NU LL,0)){
printf("CryptCATAdminAcquireContext failed error %d\n",GetLastError());
exit(1);
}
Char2Wchar(argv[1],strlen(argv[1]),wPath,MAX_PATH);
hcat = wintrust.pCryptCATAdminAddCatalog(catAdmin,wPath,N ULL,0);
if( NULL == hcat ){
printf("CryptCATAdminAddCatalog failed error %d\n",GetLastError());
exit(1);
}
if( FALSE == wintrust.pCryptCATAdminReleaseCatalogContext(catAd min,hcat,0)
){
printf("CryptCATAdminReleaseCatalogContext failed error
%d\n",GetLastError());
exit(1);
}
if( FALSE == wintrust.pCryptCATAdminReleaseContext(catAdmin,0) ){
printf("CryptCATAdminReleaseContext failed error %d\n",GetLastError());
exit(1);
}
printf("cat succesfully installed\n");
return 0;
}
after running the program and cat is added to the cat database I'm
installing the driver by right clicking the mouse and choosing Install.
Driver is copyed to system32\drivers and no message reporting errors occurs.
No comments:
Post a Comment