| 1 | /*++ |
| 2 | |
| 3 | Copyright (c) Microsoft. All rights reserved. |
| 4 | |
| 5 | Module Name: |
| 6 | |
| 7 | binfmt.h |
| 8 | |
| 9 | Abstract: |
| 10 | |
| 11 | This file contains declarations for the Windows interop binfmt interpreter. |
| 12 | |
| 13 | --*/ |
| 14 | |
| 15 | #pragma once |
| 16 | |
| 17 | // |
| 18 | // Name of the WSL binfmt_misc interpreter. |
| 19 | // |
| 20 | |
| 21 | #define LX_INIT_BINFMT_NAME "WSLInterop" |
| 22 | #define BINFMT_MISC_MOUNT_TARGET "/proc/sys/fs/binfmt_misc" |
| 23 | #define BINFMT_MISC_REGISTER_FILE BINFMT_MISC_MOUNT_TARGET "/register" |
| 24 | |
| 25 | // |
| 26 | // N.B. The 'P' flag preserves Argv[0]. The 'F' flag (fix-binary) opens the interpreter at |
| 27 | // registration time, making it available across mount namespaces and chroot environments. |
| 28 | // WSL1 (lxcore) does not support the 'F' flag, so it must only be used in WSL2 (VM) paths. |
| 29 | // |
| 30 | |
| 31 | #define BINFMT_INTEROP_REGISTRATION_STRING(Name) ":" Name ":M::MZ::" LX_INIT_PATH ":P" |
| 32 | #define BINFMT_INTEROP_REGISTRATION_STRING_VM(Name) ":" Name ":M::MZ::" LX_INIT_PATH ":FP" |
| 33 | |
| 34 | int CreateNtProcess(int Argc, char* Argv[]); |