var h: HINF; sClass: string; Context: TInfContext; ReturnBuffer: PChar; RequiredSize: DWORD; SourceId: UINT; begin sClass := GetInfClass(AInfFile); h := SetupOpenInfFile(PChar(AInfFile), PChar(sClass), INF_STYLE_WIN4, nil); if DWORD(h) <> INVALID_HANDLE_VALUE then try SetLastError(0); //I don't know how to use Context parameter,GetLastError return 3758096642 Context.Inf := h; Context.CurrentInf := h; Context.Section := 10; Context.Line := 10; SetupGetSourceFileLocation(h, @Context, nil, SourceId, nil, 0, @RequiredSize); if GetLastError() = ERROR_INSUFFICIENT_BUFFER then begin ReturnBuffer := GetMemory(RequiredSize); try SetupGetSourceFileLocation(h, @Context, nil, SourceId, ReturnBuffer, RequiredSize, nil); finally FreeMemory(ReturnBuffer); end; end else OutputDebugString(PChar(IntToStr(GetLastError()))); finally SetupCloseInfFile(h); end;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)