ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [펌] INF 파일구조
    Programming/ActiveX 2007. 12. 26. 09:48

    INF File Architecture

     

    INF file 은 하나 이상의 item 이 포함된 named section으로 이루어 졌으며

    section의 이름은 대괄호안에 묶이며 각각의 section들은 특정 목적을 지닌다(파일을 카피하거나 레지스트리에 엔트리를 넣는다거나)

     

    INF File Syntax

    Internet Component 의 경우 제대로 이해 되기 위해서는 다음의 syntax rule을 따라야 한다.

    모든 URL 은 특수 문자를 다루기 위해서 encode 되어야 한다.(URL encode 아시죠,예를 들어 공백은 %20)

    http://example.microsoft.com/sample%20control.ocx

     

    Main Sections of an INF File

    Internet 에서 다운로드된 component [Add.Code] [Setup Hooks] section을 찾는다 만약 두개의 section 이 없으면 이 INF file standard Win32 INF file 로 가정해 버린다.

     

    [Add.Code] section install 되어야 하는 모든 파일을 나열한다.

    [Add.Code]
    filename1=section-name1
    filename2=section-name2

    [Setup Hooks] section Add.Code에서 file들이 setting되기 전에 실행되어야 할 모든 hook들을 나열한다.

    hook= key conditional hook 에 이용된다.

    [Setup Hooks]
    hookname1=section-name4
    hookname2=section-name5

    hook을 이용하기 위해 inf file에 다음 라인이 필요하다.

    [Version]
    Signature="$CHICAGO$"
    AdvancedINF=2.0

    Valid Keys

    대괄호 안에 section 이름이 나오고 그뒤에 모든 key 값이 나온다

    [section-name1]
    key1=value1
    key2=value2

    다음은 INF file section에서 사용될수 있는 key들이다.

          File-%opersys%-%cpu%=[url|ignore|thiscab]

    %opersys% win32 mac 이 될수 있고 %cpu% x86 ,ppc,mips,alpha 가 될수 있다. url은 타겟 operating system cpu에 맞는 파일을 가리키고 ,ignore의 경우 현재의 플랫폼에서는 해당 이 필요없다는 것을 나타낸다 Internet Explorer는 플랫폼 독립적인 File= Key를 찾기전에 이 key를 뒤진다

          File=[url|thiscab]

    File key는 파일이 어디에서 다운로드 될수 있는지를 지정한다. thiscab의 경우는 INF file이 들어 있는 cab file의 위치를 가르키게 된다.

          ileVersion=a,b,c,d

    File Key가 가르키는 file의 최소 요구 버전 아무 값도 없으면 어떤 버전 이라도 받아들인다.

          Clsid ={nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn}

    Component CLSID

    n  DestDir=[10|11]

    10일 경우 파일을 \windows directory에 저장되고 11일 경우는 \Windows\System directory에다 두게 된다. 아무값도 없으면 \Cache directory 에 저장된다.

    o  RegisterServer=[yes|no]

    no 로 설정되면 fileOleSelfRefister로 표시되어 있어도 등록 되지 않는다.

     

    Hook Syntax

    Component 에 필요한 하나 이상의 install processoverride 하거나 customize하는 방법을 제공한다.

    unconditional 방법과 conditional 방법이있는데 unconditional은 항상 실행되고 conditional hook은 특정 조건이 TRUE일 때만 실행된다.

    hook=section-name3

    특정 CLSID가 가르키는 version section에서 명시된 최소요구 version보다 낮다거나,File=이나 File-%opersys%-%cpu%= key가 없다 거나 할 때 component downloader custom setup hook을 찾게 된다.

    [section-name3]
    key1=value1
    key2=value2

    여러 개의 다른 [Add.Code] section에서 동일한 [Setup Hooks] section을 가르키는 것은 정당한 방법이다.이 방법은 하나의 hook으로 여러 개의 component file install 할수 있는 방법이다.

    Hook section에서 지원하는 key는 다음과 같다.

     

    .File-%opersys%-%cpu%=[url | ignore]

    keyword thiscab 지원되지 않는다 .값을 비워두면 inf 파일이 위치한 cab file 뒤지게 된다.

     

    .File=[url]

    역시 keyword thiscab 지원되지 않는다 .값을 비워두면 inf 파일이 위치한 cab file 뒤지게 된다.

     

    .Run=[cmd-line]

    cab 파일에서 풀린 여러 파일 들과 함께 temporary directory에서 command line 실행 되게 된다.

    클라이언트 registry key 값에 바탕을 Win32 INF 포함할 있다. key 없으면 Win32 INF hook 실행시키기 위해 component downloader InfFile= InfSection key 찾게 된다.

     

    .InfFile=[cab file 내에 Win32 INF file 이름]

    특정 값이 setting 되어 있지 않으면 현재 INF 세팅 된다

    file 이나 component 위한 standard Win32 INF 이용할 있는 방법이다.

    .InfSection=[위의 key 의해 언급 InfFile 내의 section 이름]

    특정 값이 할당되어 있지 않으면 값은 InfFile= key 의해 명시된 파일의 [DefaultInstall] section 으로 setting 된다.

     

    When and How Use Hooks

     

    Unconditional Hooks

    Unconditional hook 항상 실행된다. hook [Setup Hooks] section 나열된다.

    CODEBASE example_setup.exe,example,ocx,example.inf file 포함 하는 cab 파일을 가져야 한다.

    [Setup Hooks]
    hook1=hook1
    [hook1]
    run=%EXTRACT_DIR%\example_setup.exe /q
    [Version]
    ; This section is required for compatibility on both Windows 95 and Windows NT.
    Signature="$CHICAGO$"
    AdvancedInf=2.0

    Conditional Hooks

    Conditional hook 특정 condition TRUE 판정 실행 된다.

    [Add.Code]
    example.ocx=example.ocx
    [example.ocx]
    Clsid={...}
    hook=hook1
    [hook1]
    run=%EXTRACT_DIR%\example_setup.exe /q
    [Version]
    ; This section is required for compatibility on both Windows 95 and Windows NT.
    Signature="$CHICAGO$"
    AdvancedInf=2.0

    Code Downloader example.ocx section 까지 진행 되면 CLSID 등록 되어 있지 않거나 클라이언트 컴퓨터에서 유효하지 않는 다는 것을 알게 되면 hook= key 지정한 hook1 실행하게 된다.

               

    Win32 INF Syntax and Variable Substitutions

     

    만약 INF file 에서 [Add.Code] [Setup Hooks] 둘다 없으면 INF file standard Win32 INF file 처리한다.

     

    .EXTRACT_DIR

    변수는 파일들이 풀린 디렉토리를 가르킨다. command line 파라미터로 쓸수 있다.

    run=%EXTRACT_DIR%\mysetup.exe

    .OBJECT_DIR

    Internet Explorer default destination directory Windows 아래에 Downloaded Program Files folder이다 디렉토리 내에서 파일이름의 충돌이 일어난다면 default destination directory 아래 CONFLICT.<n> folder 생성된다 OBJECT_DIR 최종 destination directory 가르킨다.

     

    Order of Processing and Execution of InF files

    [Add.Code] section 리스팅 순서대로 처리가 된다. 그러나 file indtall 되는 것은 역순으로 처리된다.

    INF file 에서 리스팅시에 Main OCX 처음에 놓고 다음에 dependent DLLs 놓아야 한다. 이렇게 하면  dependent DLLs 먼저 install 되고 다음에 main OCX 등록 된다.

    Unconditional hooks [Setup Hooks]에서 리스팅 순서대로 실행된다. Conditional Hook 경우에는 [Add.Code] section 순서에 따른다

Designed by Tistory.