Add WSL NtPath support

This commit is contained in:
dmex
2023-03-06 11:16:44 +11:00
parent e4963958c1
commit 07d710ec64
3 changed files with 11 additions and 12 deletions
+3 -3
View File
@@ -699,7 +699,7 @@ VOID PhpProcessQueryStage1(
// Version info
if (!processItem->IsSubsystemProcess)
{
if (!PhIsNullOrEmptyString(processItem->FileName) && PhDoesFileExist(&processItem->FileName->sr))
if (!PhIsNullOrEmptyString(processItem->FileName))
{
Data->IconEntry = PhImageListExtractIcon(
processItem->FileName,
@@ -1006,9 +1006,9 @@ VOID PhpProcessQueryStage2(
}
}
if (PhEnableLinuxSubsystemSupport && processItem->FileNameWin32 && processItem->IsSubsystemProcess)
if (PhEnableLinuxSubsystemSupport && processItem->FileName && processItem->IsSubsystemProcess)
{
PhInitializeImageVersionInfoCached(&Data->VersionInfo, processItem->FileNameWin32, TRUE, PhEnableVersionShortText);
PhInitializeImageVersionInfoCached(&Data->VersionInfo, processItem->FileName, TRUE, PhEnableVersionShortText);
}
}
+2 -3
View File
@@ -5,7 +5,7 @@
*
* Authors:
*
* dmex 2019
* dmex 2019-2023
*
*/
@@ -14,10 +14,9 @@
EXTERN_C_START
_Success_(return)
BOOLEAN PhInitializeLxssImageVersionInfo(
_Inout_ PPH_IMAGE_VERSION_INFO ImageVersionInfo,
_In_ PPH_STRING FileName
_In_ PPH_STRINGREF FileName
);
_Success_(return)
+6 -6
View File
@@ -24,7 +24,7 @@ BOOLEAN NTAPI PhpWslDistributionNamesCallback(
_Success_(return)
BOOLEAN PhGetWslDistributionFromPath(
_In_ PPH_STRING FileName,
_In_ PPH_STRINGREF FileName,
_Out_opt_ PPH_STRING *LxssDistroName,
_Out_opt_ PPH_STRING *LxssDistroPath,
_Out_opt_ PPH_STRING *LxssFileName
@@ -66,8 +66,9 @@ BOOLEAN PhGetWslDistributionFromPath(
)))
{
PPH_STRING lxssBasePathName = PhQueryRegistryStringZ(subKeyHandle, L"BasePath");
PhMoveReference(&lxssBasePathName, PhDosPathNameToNtPathName(&lxssBasePathName->sr));
if (PhStartsWithString(FileName, lxssBasePathName, TRUE))
if (lxssBasePathName && PhStartsWithStringRef(FileName, &lxssBasePathName->sr, TRUE))
{
lxssDistributionName = PhQueryRegistryStringZ(subKeyHandle, L"DistributionName");
@@ -78,13 +79,13 @@ BOOLEAN PhGetWslDistributionFromPath(
if (LxssFileName)
{
lxssFileName = PhDuplicateString(FileName);
lxssFileName = PhCreateString2(FileName);
PhSkipStringRef(&lxssFileName->sr, lxssBasePathName->Length);
PhSkipStringRef(&lxssFileName->sr, sizeof(L"rootfs"));
}
}
PhDereferenceObject(lxssBasePathName);
PhClearReference(&lxssBasePathName);
NtClose(subKeyHandle);
}
@@ -139,10 +140,9 @@ BOOLEAN PhGetWslDistributionFromPath(
return FALSE;
}
_Success_(return)
BOOLEAN PhInitializeLxssImageVersionInfo(
_Inout_ PPH_IMAGE_VERSION_INFO ImageVersionInfo,
_In_ PPH_STRING FileName
_In_ PPH_STRINGREF FileName
)
{
static PH_STRINGREF lxssDpkgCommandLine = PH_STRINGREF_INIT(L"dpkg -S ");