> ## 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.

# WdLaunchRemoteGame

> WdLaunchRemoteGame

# WdLaunchRemoteGame

원격 기기에서 게임을 실행합니다.

## 구문

```cpp theme={null}
HRESULT WdLaunchRemoteGame(  
         _In_z_ const char* remoteDevice,  
         _In_z_ const char* remotePath,  
         _In_opt_z_ const char* args,  
         _In_opt_ const WdLaunchOptions* launchOptions,  
         _Out_opt_ uint32_t* processId,  
         _Out_opt_ uint32_t* threadId  
);  
```

### 매개 변수

`_In_z_ remoteDevice`\
형식: **const char\***

원격 기기의 호스트 이름 또는 IP 주소입니다(예: `"192.168.1.100"` 또는 `"MyDevKit"`).

`_In_z_ remotePath`\
형식: **const char\***

원격 기기에서 게임 실행 파일의 경로입니다. 절대 경로(예: `"D:\\Games\\MyGame\\game.exe"`)이거나 공통 루트를 기준으로 확인되는 상대 경로(예: `"MyGame\\game.exe"`)일 수 있습니다.

`_In_opt_z_ args`\
형식: **const char\***

선택 사항. 게임 실행 파일에 전달할 명령줄 인수입니다(예: `"-windowed -debug"`). 인수가 필요 없으면 `nullptr`을 전달하세요.

`_In_opt_ launchOptions`\
형식: **[WdLaunchOptions](/reference/remoting/structs/wdlaunchoptions)\***

선택 사항. 실행 모드와 공통 루트 별칭을 지정합니다. 기본 설정(`Immediate` 실행, 기본 공통 루트)을 사용하려면 `nullptr`을 전달하세요.

`_Out_opt_ processId`\
형식: **uint32\_t\***

선택 사항. 실행된 게임의 프로세스 ID를 받습니다. 프로세스 ID가 필요 없으면 `nullptr`을 전달하세요.

`_Out_opt_ threadId`\
형식: **uint32\_t\***

선택 사항. 실행된 게임의 메인 스레드의 스레드 ID를 받습니다. 스레드 ID가 필요 없으면 `nullptr`을 전달하세요.

### 반환 값

형식: **HRESULT**

성공 시 `S_OK`를 반환하고, 그렇지 않으면 오류 코드를 반환합니다.

#### 오류 코드

| 코드                      | 값          | 설명                             | 근본 원인                                                                             | 문제 해결                                                                                                   |
| ----------------------- | ---------- | ------------------------------ | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| E\_GAMEFILEPATHNOTEXIST | 0x8C114010 | 게임 파일 경로가 존재하지 않습니다.           | 제공된 게임 실행 파일 또는 패키지 경로가 원격 컴퓨터에서 잘못되었거나 액세스할 수 없습니다.                              | 원격 기기에 경로가 존재하는지 확인합니다. 복사 작업이 성공했는지 확인합니다.                                                             |
| E\_CONNECTIONERROR      | 0x8C114014 | 연결 오류입니다.                      | 네트워크 연결을 설정할 때의 일반적인 실패(전송 계층 오류)이며, IP 주소 유효성이나 원격 컴퓨터 이름 확인과는 무관합니다.            | 네트워크 연결, 방화벽 규칙, 원격 컴퓨터의 서비스 가용성을 확인합니다. 기기 간 가시성을 확인하고, 서로 ping이 가능해야 합니다. 로깅을 활성화한 상태에서 연결을 다시 시도합니다. |
| E\_NAMERESOLUTIONFAILED | 0x8C114012 | 원격 컴퓨터 이름을 확인할 수 없습니다.         | DNS 또는 로컬 이름 확인을 통해 호스트 이름을 확인할 수 없습니다.                                           | 호스트 이름 철자, DNS 구성 및 네트워크 연결을 확인합니다. 이름 확인 문제를 분리하려면 IP 주소를 사용합니다.                                       |
| E\_INVALIDADDRESS       | 0x8C114013 | 잘못된 주소입니다.                     | 잘못되었거나 형식이 맞지 않거나 지원되지 않는 네트워크 주소가 제공되었습니다(예: 잘못된 IP 형식, 잘못된 IP 또는 지원되지 않는 프로토콜). | 올바른 IP 주소인지 확인합니다. 주소 형식을 수정하고 IPv4 프로토콜을 사용하는지 확인합니다.                                                  |
| E\_CLIENTNOTAUTHORIZED  | 0x8C114008 | 기기가 클라이언트를 거부했습니다.             | 클라이언트가 기기의 신뢰할 수 있는 클라이언트 목록에 없습니다. 페어링 프로세스를 완료하기 전에 연결 시도가 시작되었습니다.             | pin 페어링 프로세스를 성공적으로 완료합니다. 연결 요청을 다시 실행합니다.                                                             |
| E\_SERVERNOTAUTHORIZED  | 0x8C114009 | 클라이언트가 기기를 거부했습니다.             | 대상 기기가 클라이언트의 신뢰할 수 있는 엔드포인트 목록에 없습니다. 페어링 프로세스를 완료하기 전에 연결 시도가 시작되었습니다.          | pin 페어링 프로세스를 성공적으로 완료합니다. 연결 요청을 다시 실행합니다.                                                             |
| E\_SERVERTOOOLD         | 0x8C114011 | 이 클라이언트에 대해 서버 버전이 너무 오래되었습니다. | 클라이언트 측 API 버전이 원격 기기의 엔드포인트 버전보다 최신입니다.                                          | 원격 컴퓨터의 wdEndpoint를 호환되는 버전으로 업데이트합니다.                                                                  |
| E\_ADMIN\_REQUIRED      | 0x8C114016 | 관리자 권한이 필요합니다.                 | 엔드포인트가 상승된 권한으로 실행 중이 아니며 작업에 관리자 수준 권한이 필요합니다.                                   | 관리자로 엔드포인트를 다시 실행합니다.                                                                                   |

## 설명

원격 기기에서는 한 번에 하나의 게임 프로세스만 실행할 수 있습니다. 게임이 이미 실행 중이면 이 함수는 자동으로 종료한 후 다시 실행합니다. 새 게임을 실행하기 전에 [WdTerminateRemoteGame](/reference/remoting/functions/wdterminateremotegame)을 사용하여 기존 게임을 종료할 수 있습니다.

[WdLaunchMode::Suspended](/reference/remoting/enums/wdlaunchmode)로 실행하면 게임 프로세스가 일시 중단 상태로 시작됩니다. 실행을 재개하려면 [WdResumeRemoteGame](/reference/remoting/functions/wdresumeremotegame)을 사용하세요. 게임이 실행을 시작하기 전에 디버거를 연결하는 데 유용합니다.

## 예제

### 예제 1: 원격 기기에서 게임 실행

기본 설정(즉시 실행, 기본 공통 루트)을 사용하여 이전에 복사된 게임 실행 파일을 실행합니다.

```cpp theme={null}
// LaunchGame.cpp
// 원격 기기에서 게임 실행 파일을 실행합니다.
// 빌드: wdremoteapi.lib에 링크

#include <windows.h>
#include <stdio.h>
#include "WdRemoteIteration.h"

int main()
{
    // TODO: 원격 기기의 IP 주소 또는 호스트 이름으로 바꾸세요
    const char* remoteDevice = "192.168.1.100";

    // TODO: 원격 기기의 게임 실행 파일 경로로 바꾸세요.
    // 상대 경로는 기본 공통 루트를 기준으로 확인됩니다.
    const char* remotePath = "MyGame\\Binaries\\MyGame.exe";

    uint32_t processId = 0;
    uint32_t threadId  = 0;

    HRESULT hr = WdLaunchRemoteGame(
        remoteDevice,
        remotePath,
        nullptr,       // args — 명령줄 인수 없음
        nullptr,       // launchOptions — 기본값: Immediate 모드, 기본 공통 루트
        &processId,
        &threadId);

    if (SUCCEEDED(hr))
    {
        printf("Game launched — PID: %u, TID: %u\n", processId, threadId);
    }
    else
    {
        printf("Launch failed: HRESULT 0x%08X\n", hr);
    }

    return hr;
}
```

### 예제 2: 디버깅을 위한 일시 중단 모드 실행

디버거가 실행 시작 전에 연결될 수 있도록 게임을 일시 중단 상태로 실행합니다. 디버거가 연결된 후 사용자가 Enter 키를 눌러 프로세스를 재개합니다.

```cpp theme={null}
// LaunchSuspended.cpp
// 게임을 일시 중단 모드로 실행하고 디버거 연결을 기다린 다음 재개합니다.
// 빌드: wdremoteapi.lib에 링크

#include <windows.h>
#include <stdio.h>
#include "WdRemoteIteration.h"

int main()
{
    const char* remoteDevice = "192.168.1.100";
    const char* remotePath   = "MyGame\\Binaries\\MyGame.exe";

    WdLaunchOptions launchOptions = {};
    launchOptions.launchMode     = WdLaunchMode::Suspended;
    launchOptions.commonRootAlias = nullptr;  // 기본 공통 루트 사용

    uint32_t processId = 0;
    uint32_t threadId  = 0;

    HRESULT hr = WdLaunchRemoteGame(
        remoteDevice,
        remotePath,
        "-debug -log",    // 실행 파일에 전달되는 명령줄 인수
        &launchOptions,
        &processId,
        &threadId);

    if (FAILED(hr))
    {
        printf("Launch failed: HRESULT 0x%08X\n", hr);
        return hr;
    }

    printf("Game suspended — PID: %u\n", processId);
    printf("Attach your debugger to the remote process, then press Enter to resume...\n");
    getchar();

    hr = WdResumeRemoteGame(remoteDevice);
    if (SUCCEEDED(hr))
    {
        printf("Game resumed.\n");
    }
    else
    {
        printf("Resume failed: HRESULT 0x%08X\n", hr);
    }

    return hr;
}
```

### 예제 3: 복사 및 실행 워크플로

일반적인 반복 주기를 보여줍니다: 원격 기기로 게임 파일을 복사한 다음 실행 파일을 실행합니다. XBOX PC Remote Iteration API에서 가장 일반적인 종단 간 워크플로입니다.

```cpp theme={null}
// CopyAndLaunch.cpp
// 원격 기기로 게임 파일을 복사한 다음 게임을 실행합니다.
// 빌드: wdremoteapi.lib에 링크

#include <windows.h>
#include <stdio.h>
#include "WdRemoteIteration.h"

int main()
{
    // TODO: 이 값들을 자신의 값으로 바꾸세요
    const char* remoteDevice   = "192.168.1.100";
    const char* localBuildPath = "C:\\builds\\MyGame";
    const char* gameFolderName = "MyGame";
    const char* gameExePath    = "MyGame\\Binaries\\MyGame.exe";

    // 1단계: 원격 기기로 게임 파일 복사
    printf("Copying files...\n");
    HRESULT hr = WdRemoteCopy(
        remoteDevice,
        localBuildPath,
        gameFolderName,
        nullptr, nullptr, nullptr, nullptr);

    if (FAILED(hr))
    {
        printf("Copy failed: HRESULT 0x%08X\n", hr);
        return hr;
    }

    // 2단계: 게임 실행
    printf("Launching game...\n");
    hr = WdLaunchRemoteGame(
        remoteDevice,
        gameExePath,
        nullptr, nullptr, nullptr, nullptr);

    if (FAILED(hr))
    {
        printf("Launch failed: HRESULT 0x%08X\n", hr);
        return hr;
    }

    printf("Game files copied and launched successfully.\n");
    return 0;
}
```

## 요구 사항

| 요구 사항       | 값                   |
| ----------- | ------------------- |
| **헤더**      | WdRemoteIteration.h |
| **라이브러리**   | wdremoteapi.lib     |
| **지원 OS**   | Windows 11 이상       |
| **지원 아키텍처** | x64, ARM64          |

## 함께 보기

* [WdResumeRemoteGame](/reference/remoting/functions/wdresumeremotegame)
* [WdTerminateRemoteGame](/reference/remoting/functions/wdterminateremotegame)
* [WdLaunchOptions](/reference/remoting/structs/wdlaunchoptions)
* [WdLaunchMode](/reference/remoting/enums/wdlaunchmode)
* [XBOX PC Remote Iteration API 오류 코드](/reference/remoting/error-codes)
* [XBOX PC Remote Iteration API](/reference/remoting/remoteiteration_members)


## Related topics

- [WdLaunchMode](/ko/reference/remoting/enums/wdlaunchmode.md)
- [WdLaunchOptions](/ko/reference/remoting/structs/wdlaunchoptions.md)
- [WdResumeRemoteGame](/ko/reference/remoting/functions/wdresumeremotegame.md)
- [WdTerminateRemoteGame](/ko/reference/remoting/functions/wdterminateremotegame.md)
- [WdRegisterRemoteXboxGame](/ko/reference/remoting/functions/wdregisterremotexboxgame.md)
