2017-12-14 27 views
1

wix의 ProgramFiles64Folder를 사용하여 Program Files 폴더 을 설치 프로그램에서 가져옵니다.wix로 Program Files 폴더의 지역화 된 값을 얻는 방법

문제는 프랑스어 값인 c : \ Programs 대신 c : \ Program Files가 표시된다는 것입니다.

여전히 올바른 폴더에 설치되지만 내 사용자는 에 프랑스어 값이 표시되지 않는지 묻습니다.

orca로 msi를 열었습니다. ProgramFiles64Folder를 참조하십시오. 위키의 특정 문제가 아니라 Windows 설치 프로그램 중 하나라고 생각됩니다.

wix로 Program Files 폴더의 현지화 된 값을 어떻게 얻을 수 있습니까?

+0

MSI 로그 파일을 공유 할 수 있습니까? ProgramFiles64Folder가 정확해야합니다. –

답변

2

Windows Vista에서 시작하여 더 이상 현지화되지 않은 Win32 파일 시스템 경로가 표시됩니다. 대신 쉘의 로컬 화 된 디스플레이 경로이 필요합니다.

Windows Installer는 기본 제공 UI에 파일 시스템 경로 만 표시합니다. 필자는 WiX Burn UI에 대해 확신 할 수 없지만 파일 시스템 경로 만 보여줄 가능성이 큽니다.

표시 경로를 얻으려면 DLL 사용자 지정 동작 (MSDNWiX 참조)을 작성할 수 있습니다.

다음은 파일 시스템 경로를 표시 경로로 변환하는 방법을 보여주는 간단한 콘솔 응용 프로그램의 C++ 코드입니다. 사용자 지정 작업에서 MsiGetProperty을 호출하여 설치 경로가 포함 된 디렉터리 속성의 값을 얻은 다음 예제와 비슷한 코드를 사용하여 표시 경로로 변환하고 마지막으로 MsiSetProperty을 호출하여 표시 할 다른 속성에 표시 경로를 할당합니다 UI에서.

#include <Windows.h> 
#include <ShlObj.h> // Shell API 
#include <Propkey.h> // PKEY_* constants 
#include <atlcomcli.h> // CComPtr 
#include <atlbase.h> // CComHeapPtr 
#include <iostream> 
#include <io.h> 
#include <fcntl.h> 

// Convert a filesystem path to the shell's localized display path. 
HRESULT GetDisplayPathFromFileSystemPath(LPCWSTR path, PWSTR* ppszDisplayPath) 
{ 
    CComPtr<IShellItem2> pItem; 
    HRESULT hr = SHCreateItemFromParsingName(path, nullptr, IID_PPV_ARGS(&pItem)); 
    if(FAILED(hr)) 
     return hr; 
    return pItem->GetString(PKEY_ItemPathDisplay, ppszDisplayPath); 
} 

int main() 
{ 
    CoInitialize(nullptr); // TODO: check return value 
    _setmode(_fileno(stdout), _O_U16TEXT); // for proper UTF-16 console output 

    LPCWSTR fileSystemPath = L"C:\\Users\\Public\\Pictures"; 
    CComHeapPtr<WCHAR> displayPath; 
    if(SUCCEEDED(GetDisplayPathFromFileSystemPath(fileSystemPath, &displayPath))) 
    { 
     // Output the localized display path 
     std::wcout << static_cast<LPCWSTR>(displayPath) << std::endl; 
    } 

    CoUninitialize(); 
} 

여기서 유일하게 중요한 코드는 GetDisplayPathFromFileSystemPath() 기능입니다. SHCreateItemFromParsingName()을 호출하여 파일 시스템 경로에서 IShellItem2 오브젝트를 작성합니다. 이 개체에서 관심있는 디스플레이 경로가 포함 된 PKEY_ItemPathDisplay 속성 값을 검색합니다.

+0

이 상세한 내용은이 답변을 찾지 못했을 것입니다. –