From: GMayko@gmail.com on
Peter wrote:
> In my *.inf file is section:
> [AAAMP.AddService.AddReg]
> HKR, Parameters, "MyDir", 0, %01%
>
> That creates value equal to path where is installed driver.sys from.
> This path is necessary to have in registry for my driver operation.
> Problem is, that when user uninstalls driver and tries to install it from
> different directory, in Windows\Inf still exist oemXX.inf and oemXX.PNF files
> and I think that there is stored still previous MyDir value, so after
> installation my driver uses bad MyDir value.
--
Probably neither the Version nor Date is not changed in your INF file,
so Windows decided to use the existing oem*.inf file even if your user,
during next installations, points to another INF file in different
location.

In this case you can try to use your own class installer or/and driver
specific co-installer that will participate in driver selection by
handling the DIF_SELECTBESTCOMPATDRV/DIF_SELECTDEVICE requests (using,
for ex., INF file names/path as a criteria to select the proper one).

Another option is to ask user to select the directory manually in the
additional page during driver installation (for ex., by handling
DIF_NEWDEVICEWIZARD_FINISHINSTALL request in your co-installer). Of
course, this is only useful if you install your driver as a
"client-side" installation.

Regards,
Gennady Mayko

From: Mayko on


Peter wrote:
> In my *.inf file is section:
> [AAAMP.AddService.AddReg]
> HKR, Parameters, "MyDir", 0, %01%
>
> That creates value equal to path where is installed driver.sys from.
> This path is necessary to have in registry for my driver operation.
> Problem is, that when user uninstalls driver and tries to install it from
> different directory, in Windows\Inf still exist oemXX.inf and oemXX.PNF files
> and I think that there is stored still previous MyDir value, so after
> installation my driver uses bad MyDir value.
--
Probably neither the Version nor Date is not changed in your INF file,
so Windows decided to use the existing oem*.inf file even if your user,

during next installations, points to another INF file in different
location.

In this case you can try to use your own class installer or/and driver
specific co-installer that will participate in driver selection by
handling the DIF_SELECTBESTCOMPATDRV/DIF_SE­LECTDEVICE requests
(using,
for ex., INF file names/path as a criteria to select the proper one).

Another option is to ask user to select the directory manually in the
additional page during driver installation (for ex., by handling
DIF_NEWDEVICEWIZARD_FINISHINST­ALL request in your co-installer). Of
course, this is only useful if you install your driver as a
"client-side" installation.

Regards,
Gennady Mayko

From: Alexander Grigoriev on
You should not keep a reference to the driver installation directory. The
driver may be installed from removable media and the directory is not valid
anymore.

Copy the files you need to a directory with permanent name, for example a
folder under Program Files. If you want to keep all set of files for
reinstallation, copy all of them there.

"Peter" <Peter(a)discussions.microsoft.com> wrote in message
news:BC3E441E-6033-448D-98A4-46290DCD21F8(a)microsoft.com...
> "the old INF" I mean *.inf created in previous driver installation.
> In my case that is IM driver.
> I need to delete not only oemXX.inf but also oemXX.PNF - because
> in *.inf I use:
> [AAAMP.AddService.AddReg]
> HKR, Parameters, "MyDir", 0, %01%
>
> Registry value under "MyDir" driver uses after loading,
> and if product is uninstalled and reinstalled from different directory,
> installation does not update "MyDir" in *.PNF compiled from previous
> installation.
>
> Peter
>
> "Ray Trent" wrote:
>
>> Define "the old INF". Remember that multiple people (including
>> Microsoft) can write drivers for the same device so PnP IDs are out,
>> companies and products change their names so those are out, etc., etc.
>>
>> Any such API would eventually lead to annoying breakage. If Microsoft
>> does it, everyone complains, if you do it only your customer's complain.
>>
>> Personally, though, it does seem like if Microsoft *wanted* to
>> facilitate this, they could add a field to INFs that you'd put a GUID
>> in, and you could optionally delete INFs with that GUID.
>>
>> BTW, that's pretty much how we did it back in the days when we thought
>> it was a good idea... why is it that you think you need to delete the
>> old INFs?
>>
>> Peter wrote:
>> > Yes SetupUnistallOEMInf can help, but first I must to know file name.
>> > It seems that only one way to find file name is to iterate through
>> > every oemXX.inf, read it into buffer, search for some string (product
>> > name
>> > or something else that is unique unique)
>> > then if string matches delete file.
>> > I cannot believe that Microsoft OS developers designed it by this
>> > way...
>> > Does not really exist some *.inf directive or flag that deletes old
>> > *.inf ?
>> >
>> > Peter
>> >
>> > "Pavel A." <pavel_a(a)NOwritemeNO.com> wrote in message
>> > news:OeK62X0cFHA.2180(a)TK2MSFTNGP12.phx.gbl...
>> >> "Peter" <Peter(a)discussions.microsoft.com> wrote in message
>> >> news:DC371AFA-560E-42C7-8D81-8490F77289F2(a)microsoft.com...
>> >>> Does exist some *.inf directive or flag, that deletes previsously
>> >>> created
>> >>> oemXX.inf and oemXX.PNF before creating new ?
>> >>> Or does exist some API function with help of it I can to find
>> >>> corresponding
>> >>> oemXX.inf and oemXX.PNF file names in Windows/inf - if yes no problem
>> >>> to
>> >>> delete it with some API function.
>> >> See: SetupUninstallOEMInf
>> >>
>> >> Regards,
>> >> --PA
>> >>
>> >>
>> >
>> >
>>
>>
>> --
>> .../ray\..
>>


From: Peter on
Exactly the way described by you is my case.
Peter

"Alexander Grigoriev" wrote:

> You should not keep a reference to the driver installation directory. The
> driver may be installed from removable media and the directory is not valid
> anymore.
>
> Copy the files you need to a directory with permanent name, for example a
> folder under Program Files. If you want to keep all set of files for
> reinstallation, copy all of them there.
>
> "Peter" <Peter(a)discussions.microsoft.com> wrote in message
> news:BC3E441E-6033-448D-98A4-46290DCD21F8(a)microsoft.com...
> > "the old INF" I mean *.inf created in previous driver installation.
> > In my case that is IM driver.
> > I need to delete not only oemXX.inf but also oemXX.PNF - because
> > in *.inf I use:
> > [AAAMP.AddService.AddReg]
> > HKR, Parameters, "MyDir", 0, %01%
> >
> > Registry value under "MyDir" driver uses after loading,
> > and if product is uninstalled and reinstalled from different directory,
> > installation does not update "MyDir" in *.PNF compiled from previous
> > installation.
> >
> > Peter
> >
> > "Ray Trent" wrote:
> >
> >> Define "the old INF". Remember that multiple people (including
> >> Microsoft) can write drivers for the same device so PnP IDs are out,
> >> companies and products change their names so those are out, etc., etc.
> >>
> >> Any such API would eventually lead to annoying breakage. If Microsoft
> >> does it, everyone complains, if you do it only your customer's complain.
> >>
> >> Personally, though, it does seem like if Microsoft *wanted* to
> >> facilitate this, they could add a field to INFs that you'd put a GUID
> >> in, and you could optionally delete INFs with that GUID.
> >>
> >> BTW, that's pretty much how we did it back in the days when we thought
> >> it was a good idea... why is it that you think you need to delete the
> >> old INFs?
> >>
> >> Peter wrote:
> >> > Yes SetupUnistallOEMInf can help, but first I must to know file name.
> >> > It seems that only one way to find file name is to iterate through
> >> > every oemXX.inf, read it into buffer, search for some string (product
> >> > name
> >> > or something else that is unique unique)
> >> > then if string matches delete file.
> >> > I cannot believe that Microsoft OS developers designed it by this
> >> > way...
> >> > Does not really exist some *.inf directive or flag that deletes old
> >> > *.inf ?
> >> >
> >> > Peter
> >> >
> >> > "Pavel A." <pavel_a(a)NOwritemeNO.com> wrote in message
> >> > news:OeK62X0cFHA.2180(a)TK2MSFTNGP12.phx.gbl...
> >> >> "Peter" <Peter(a)discussions.microsoft.com> wrote in message
> >> >> news:DC371AFA-560E-42C7-8D81-8490F77289F2(a)microsoft.com...
> >> >>> Does exist some *.inf directive or flag, that deletes previsously
> >> >>> created
> >> >>> oemXX.inf and oemXX.PNF before creating new ?
> >> >>> Or does exist some API function with help of it I can to find
> >> >>> corresponding
> >> >>> oemXX.inf and oemXX.PNF file names in Windows/inf - if yes no problem
> >> >>> to
> >> >>> delete it with some API function.
> >> >> See: SetupUninstallOEMInf
> >> >>
> >> >> Regards,
> >> >> --PA
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >> --
> >> .../ray\..
> >>
>
>
>