From: Rafael Ottmann on
Hi there,

I´m having problems in creating a installer tool for a customized parport
class driver i´ve written, based on win2k sample parclass driver;

I am using SetuDiXX and SetupInstallXX apis for this purpose, but no success
so far; here goes some part of the code i am using, error handling omitted....

//system devices guid
GUID devGuid =
{0x4d36e97d,0xe325,0x11ce,{0xbf,0xc1,0x08,0x00,0x2b,0xe1,0x03,0x18}};

HDEVINFO devInfo = SetupDiCreateDeviceInfoList(&devGuid,g_hWnd);
SP_DEVINFO_DATA sp;
sp.cbSize = sizeof(sp);

SetupDiCreateDeviceInfo(devInfo,"BemaRawPort",&devGuid,"Bema Class
Driver",g_hWnd,DICD_GENERATE_ID ,&sp);
/*I wished to use "LPTENUM\\BemaRawPort" forthe device name, but it always
fails if i do so, no matter if i switch DICD_GENERATE_ID flag for
DICD_INHERIT_CLASSDRVS */

//then i open the inf file containing the service section i wish to install

HINF inf = SetupOpenInfFile(infFile,NULL ,INF_STYLE_WIN4 | INF_STYLE_OLDNT
,NULL);

//install the service passing the SP_DEVINFO_DATA filled by
//SetupDiCreateDeviceInfo

SetupInstallServicesFromInfSectionEx(inf,"disk.NT.Services",SPSVCINST_TAGTOFRONT,info,&sp, NULL,NULL);

SetupInstallFile(inf,NULL,".\\bemapar.sys",NULL,systemDir,SP_COPY_FORCE_NEWER|SP_COPY_SOURCE_ABSOLUTE ,NULL,NULL);

//HERE IS THE FAILURE
SetupDiInstallDevice(info,&sp);
//GetLastError returns ERROR_NO_ASSOCIATED_SERVICE
//I am stuck in here



I can only manage to install the driver through "Add New Hardware wizard",
choosing "System devices" , here goes my inf file:

[Version]
Signature="$Windows NT$"
Provider=%BEMA%
ClassGUID={4d36e97d-e325-11ce-bfc1-08002be10318}
Class=System Devices

DriverVer=09/27/2005

[DestinationDirs]
DefaultDestDir = 12

[Manufacturer]
%BEMA% = BEMA.Mfg

[BEMA.Mfg]
%BEMA.DeviceDesc0% = disk, LPTENUM\BemaRawPort

[disk.NT]
CopyFiles=bema_CopyFiles

[bema_CopyFiles]
bemapar.sys


; Service Installation
[disk.NT.Services]
AddService = BemaClassService, 0x00000002 , disk_Service_Inst

[disk_Service_Inst]
DisplayName = %disk.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_SYSTEM_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\bemapar.sys



; Source file information
[SourceDisksNames]
1 = %DiskId1%

[SourceDisksFiles]
bemapar.sys = 1

[Strings]

; Non-Localizable Strings
REG_SZ = 0x00000000
REG_MULTI_SZ = 0x00010000
REG_EXPAND_SZ = 0x00020000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
SERVICEROOT = "System\CurrentControlSet\Services"


; Localizable Strings

BEMA.DeviceDesc0 = "Bema Class Driver"
DiskId1 = "Bema Corp. Installation Disk #1 (DiskDrive)"
BEMA = "Bema Corp."
disk.SvcDesc="Bema Parallel Port Printer"

Thank you in advance,
Rafael



From: Eliyas Yakub [MSFT] on
Try DpInst from Driver installation package:
http://www.microsoft.com/whdc/driver/install/32-64bit_install.mspx

--
--
-Eliyas
This posting is provided "AS IS" with no warranties, and confers no rights.
http://www.microsoft.com/whdc/driver/default.mspx
http://www.microsoft.com/whdc/driver/kernel/KB-drv.mspx