INF File Functions

Hi, All!

I’ve got a simple question on how to use INF File Functions,
“SetupInstallServicesFromInfSection” function namely
When we try to install service, using this function, it always fails
and service isn’t added.

/*******************************************/
Here is the part of our *inf file

[Test_Inst.NT.Services]
AddService=Test,Test_Service

[Test_Service]
DisplayName = “Test”
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 0
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\Test.sys

;/******************************************/

and here is our code used to add this service:
//we’ve allready abtained hInf handler, called
//SetupInstallFilesFromInfSection and
//SetupCommitFileQueue to copy Test.sys to
//winnt\system32\drivers directory

WCHAR ServiceW[100];
BOOL bResult = FALSE;

swprintf(ServiceW,L"Test_Inst.NT.Services");

bResult = SetupInstallServicesFromInfSection(hInf,ServiceW,0);
if(!bResult)
{
return FALSE;
}

/*******************************************/
bResult is always FALSE

did we do something wrong?


Chat with friends online, try MSN Messenger: http://messenger.msn.com

GetLastError returns 2, as i understand that means system cannot find the
file specified (ERROR_FILE_NOT_FOUND), what exactly does
system need?
also the function (SetupInstallServicesFromInfSection) succeeds if service
already exists in registry
and if some of the values in service key are deleted(manualy) it successfuly
adds them(such as DisplayName or ImagePath).
it seems, it fails to add values of REG_DWORD type

From: “Srikanth R”
>To: “‘Shaggy Head’”
>Subject: RE: [ntdev] INF File Functions
>Date: Thu, 4 Jul 2002 14:00:55 +0530
>
>What is the last error if you do a GetLastError at the point where it
>fails ?
>-Srikanth
>
>
>-----Original Message-----
>From: xxxxx@lists.osr.com
>[mailto:xxxxx@lists.osr.com] On Behalf Of Shaggy Head
>Sent: Thursday, July 04, 2002 1:09 PM
>To: NT Developers Interest List
>Subject: [ntdev] INF File Functions
>
>
>Hi, All!
>
>I’ve got a simple question on how to use INF File Functions,
>“SetupInstallServicesFromInfSection” function namely When we try to
>install service, using this function, it always fails and service isn’t
>added.
>
>/**/
>Here is the part of our inf file
>
> [Test_Inst.NT.Services]
> AddService=Test,Test_Service
>
> [Test_Service]
> DisplayName = “Test”
> ServiceType = 1 ; SERVICE_KERNEL_DRIVER
> StartType = 0
> ErrorControl = 1 ; SERVICE_ERROR_NORMAL
> ServiceBinary = %12%\Test.sys
>
>;/
/
>
>and here is our code used to add this service:
>//we’ve allready abtained hInf handler, called
>//SetupInstallFilesFromInfSection and //SetupCommitFileQueue to copy
>Test.sys to //winnt\system32\drivers directory
>
> WCHAR ServiceW[100];
> BOOL bResult = FALSE;
>
> swprintf(ServiceW,L"Test_Inst.NT.Services");
>
> bResult = SetupInstallServicesFromInfSection(hInf,ServiceW,0);
> if(!bResult)
> {
> return FALSE;
> }
>
>/ ******************************************* /
>bResult is always FALSE
>
>did we do something wrong?
>
>
>Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
>
>—
>You are currently subscribed to ntdev as: xxxxx@wipro.com To
>unsubscribe send a blank email to %%email.unsub%%
>
><< Wipro_Disclaimer.txt >>


Chat with friends online, try MSN Messenger: http://messenger.msn.com