이 코드 샘플은 프로그래밍 방식으로 WSL 배포판 안의 사용자를 조회할 수 있는 방법을 설명합니다. Win32 API를 주로 사용하였고, 일부 편의를 위하여 C# 코드를 이용했지만, C++ 코드에서도 같은 기능을 구현할 수 있습니다.
프로그램 코드를 테스트해보기 위해서는 .NET 5 이상의 SDK를 설치해야 합니다. 그 다음, 이 Gist 리포지터리를 Git으로 체크아웃하고 dotnet run
명령으로 실행해봅니다.
FROM mcr.microsoft.com/dotnet/sdk:6.0-windowsservercore-ltsc2022 AS build | |
RUN powershell.exe -Command \ | |
Invoke-WebRequest -UseBasicParsing 'https://www.linqpad.net/GetFile.aspx?LINQPad7Setup.exe' -OutFile "$home/LINQPad7Setup.exe"; \ | |
Start-Process -FilePath "$home/LINQPad7Setup.exe" -ArgumentList "/SP-","/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART","/NOICONS" -NoNewWindow -Wait; \ | |
rm -Force "$home/LINQPad7Setup.exe"; && \ | |
setx.exe /M PATH "%PROGRAMFILES%\LINQPad7;%PATH%" | |
FROM build |
FROM mcr.microsoft.com/dotnet/sdk:6.0-windowsservercore-ltsc2022 AS build | |
RUN powershell.exe -Command \ | |
Invoke-WebRequest -UseBasicParsing 'https://www.linqpad.net/GetFile.aspx?LINQPad7Setup.exe' -OutFile "$home/LINQPad7Setup.exe"; \ | |
Start-Process -FilePath "$home/LINQPad7Setup.exe" -ArgumentList "/SP-","/VERYSILENT","/SUPPRESSMSGBOXES","/NORESTART","/NOICONS" -NoNewWindow -Wait; \ | |
rm -Force "$home/LINQPad7Setup.exe"; && \ | |
setx.exe /M PATH "%PROGRAMFILES%\LINQPad7;%PATH%" | |
FROM build |
function ConvertTo-AnimatedGif { | |
param ( | |
[string]$VideoFilePath = $(Read-Host -Prompt 'Enter a video file path.'), | |
[int]$FramePerSeconds = 10, | |
[int]$Scale = 320, | |
[switch]$Verbose | |
) | |
$ffmpegCommand = (Get-Command -ErrorAction Ignore 'ffmpeg.exe') |
@echo off | |
pushd "%~dp0" | |
REM Please run this batch script inside Windows SDK or Visual Studio command prompt. | |
SET CN=MyCN | |
if exist CA.cer ( | |
certutil.exe -user -delstore Root CA.cer | |
del /f CA.cer |
#include "pch.h" | |
#include "CTest.h" | |
using System::Runtime::InteropServices::Marshal; | |
CTest::CTest() | |
{ | |
this->pVaListener = new CVaListenerUnmanaged(); | |
this->pVaListenerManaged = gcnew CVaListenerManaged(); | |
} |
@echo off | |
pushd "%~dp0" | |
rem Example: docker2wsl ubuntu:latest myubuntu | |
docker pull %1 | |
docker run -d --name %2 %1 /bin/sh > %TEMP%\ctrid.txt | |
set /p CTRID= < %TEMP%\ctrid.txt | |
if exist %TEMP%\ctrid.txt del /f /q %TEMP%\ctrid.txt |
#include <tchar.h> | |
#include <stdio.h> | |
#include <combaseapi.h> | |
int __stdcall GetStringArrayDataW(OUT LPWSTR** lpArrayDest, OUT SIZE_T* pArrayLength); | |
void __stdcall FreeStringArrayW(OUT LPWSTR** lpArrayDest, IN SIZE_T nArrayLength); | |
int __stdcall GetStringArrayDataA(OUT LPSTR** lpArrayDest, OUT SIZE_T* pArrayLength); | |
void __stdcall FreeStringArrayA(OUT LPSTR** lpArrayDest, IN SIZE_T nArrayLength); |
The following terms are used throughout this agreement: