> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XPersistentLocalStorageMountForPackage

> XPersistentLocalStorageMountForPackage

# XPersistentLocalStorageMountForPackage

지정된 패키지의 PLS(영구 로컬 스토리지)를 읽기 전용 디스크로 탑재합니다.

## 구문

```cpp theme={null}
HRESULT XPersistentLocalStorageMountForPackage (   
         const char* packageIdentifier,   
         XPackageMountHandle* mountHandle 
) 
```

### 매개 변수

*packageIdentifier*   \_In\_\
형식: char\*

PLS가 속한 스토어 패키지를 고유하게 식별하는 문자열입니다. 패키지 식별자에 대한 자세한 내용은 [다운로드 가능한 콘텐츠(DLC) 관리 및 라이선스](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-manage-and-license-optional-packages)를 참조하세요.

*mountHandle*   \_Out\_writes\_to\_(pathSize,*pathUsed)\
형식: XPackageMountHandle*

PLS가 탑재된 디스크에 대한 탑재 핸들입니다.

### 반환 값

형식: [HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

성공하면 **S\_OK**를 반환하고, 그렇지 않으면 오류 코드를 반환합니다. 오류 코드 목록은 [오류 코드](/reference/errorcodes)를 참조하세요. 지정된 타이틀의 PLS가 존재하지 않아 함수가 실패하는 경우 **FILE\_NOT\_FOUND**로 설정됩니다. 공유 가능한 영구 로컬 스토리지를 활성화하지 않은 타이틀의 PLS에 액세스하려고 시도하여 함수가 실패하는 경우 **ACCESS\_DENIED**를 받게 됩니다.

## 설명

<Note>이 함수는 시간에 민감한 스레드에서 호출해서는 안전하지 않습니다. 자세한 내용은 [시간에 민감한 스레드](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)를 참조하세요.</Note>

타이틀에서 공유 가능한 PLS를 지원하려면 MicrosoftGame.config에 이를 선언해야 합니다. 공유 가능한 영구 로컬 스토리지에 대한 자세한 내용은 [로컬 스토리지](/build/console-features/storage/local-storage)를 참조하세요.

<Note>타이틀에서 PLS를 공유 가능으로 표시하는 경우 게임을 일시 중단하기 전에 PLS에 대한 모든 핸들을 닫아야 합니다. 그렇지 않으면 게임 일시 중단이 실패하고 게임이 종료됩니다.</Note>

다음 코드 조각은 다른 타이틀의 공유 가능한 PLS에 액세스하는 예제를 보여줍니다.

```cpp theme={null}

HRESULT MountPersistentLocalStorageForPackage(char* packageIdentifier) 
{      
    XPackageMountHandle* mountHandle; 
    HRESULT hr = XPersistentLocalStorageMountForPackage (packageIdentifier, &mountHandle); 

    if (FAILED(hr)) return hr; 
    size_t pathSize; 
    hr = XGetMountPathSize(mountHandle, &pathSize); 
    if (FAILED(hr)) 
    { 
        XPackageCloseMountHandle(mountHandle); 
        return hr; 
    } 
 
    char* path = new (std::nothrow) char[pathSize]; 
    if (path == nullptr) 
    { 
        XPackageCloseMountHandle (mountHandle); 
        return E_OUTOFMEMORY; 
    } 
 
    hr = XPackageGetMountPath (mountHandle, pathSize, path); 
    if (FAILED(hr)) 
    { 
        XPackageCloseMountHandle(mountHandle); 
        delete[] path; 
        return hr; 
    } 
 
    printf("PLS %s mounted at path %s\n", packageIdentifier, path); 
    delete[] path; 
 
    // 이것이 마지막 핸들인 경우 PLS 경로를 마운트 해제합니다.
    XPackageCloseMountHandle(mountHandle); 
    return S_OK; 
} 

```

## 요구 사항

**헤더:** XPersistentLocalStorage.h

**라이브러리:** xgameruntime.lib

**지원 플랫폼:** Windows, XBOX One 제품군 콘솔 및 XBOX Series 콘솔

## 개념 문서

* [시간에 민감한 스레드](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 함께 보기

[XPersistentLocalStorage](/reference/system/xpersistentlocalstorage/xpersistentlocalstorage_members)\
[새 MicrosoftGame.config 파일 사용 방법](/build/core-features/common/game-config/MicrosoftGameConfig-toc)\
[로컬 스토리지](/build/console-features/storage/local-storage)


## Related topics

- [XPersistentLocalStorage](/ko/reference/system/xpersistentlocalstorage/xpersistentlocalstorage_members.md)
- [XPersistentLocalStorageSpaceInfo](/ko/reference/system/xpersistentlocalstorage/structs/xpersistentlocalstoragespaceinfo.md)
- [XPersistentLocalStorageGetPath](/ko/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpath.md)
- [XPersistentLocalStorageGetSpaceInfo](/ko/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetspaceinfo.md)
- [XPersistentLocalStorageGetPathSize](/ko/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpathsize.md)
