Using SetupGetTargetPath

  • Thread starter Thread starter Jerry West
  • Start date Start date
J

Jerry West

I've been attempting to use SetupGetTargetPath to return the path of a
driver's destination folder. I do indeed get it to return a path but it
always is the wrong path. For example, for a network card I have the drivers
get placed in a folder several levels deep from my system folder. Yet the
API always returns just the system folder. Why is this? If I were to install
the files in the folder the API indicated the driver would fail! So why
doesn't it provide a full path? Here is my code:

Declare Function SetupGetTargetPath Lib "setupapi.dll" Alias
"SetupGetTargetPathA" (ByVal Handle As Long, ByVal Context As Any, ByVal
Section As String, ByVal ReturnBuffer As String, ByVal ReturnBufferSize As
Long, ByRef RequiredSize As Long) As Long

lRet& = SetupGetTargetPath(lHwnd&, 0&, sInfCopyFilesSection$, vbNull, 0,
lReqSize&)

sSourcePath$ = Space(lReqSize&)

If lReqSize& Then lRet& = SetupGetTargetPath(lHwnd&, 0&,
sInfCopyFilesSection$, sSourcePath$, Len(sSourcePath$), lReqSize&)

Any insight would be appreciated!

JW
 
Back
Top