Skip to content

Commit df55ef8

Browse files
committed
Fix build regression on Win7
1 parent 440dbab commit df55ef8

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

phlib/include/phconfig.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ PhIsExecutingInWow64(
8282
VOID
8383
);
8484

85+
//
8586
DECLSPEC_NORETURN
8687
FORCEINLINE
8788
VOID
@@ -92,7 +93,7 @@ PhExitApplication(
9293
#if (PHNT_VERSION >= PHNT_WIN7)
9394
RtlExitUserProcess(Status);
9495
#else
95-
PhTerminateProcess(NtCurrentProcess(), Status);
96+
ExitProcess(Status);
9697
#endif
9798
}
9899

phlib/util.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,19 +1700,31 @@ PVOID PhGetFileVersionInfo(
17001700
_In_ PWSTR FileName
17011701
)
17021702
{
1703-
PVOID imageBaseAddress;
1704-
PVOID imageVersionInfo;
1703+
PVOID libraryModule;
1704+
PVOID versionInfo;
17051705

1706-
if (!NT_SUCCESS(PhLoadLibraryAsImageResource(FileName, &imageBaseAddress)))
1706+
libraryModule = LoadLibraryEx(
1707+
FileName,
1708+
NULL,
1709+
LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE
1710+
);
1711+
1712+
if (!libraryModule)
17071713
return NULL;
17081714

1709-
if (PhLoadResource(imageBaseAddress, MAKEINTRESOURCE(VS_VERSION_INFO), VS_FILE_INFO, NULL, &imageVersionInfo))
1715+
if (PhLoadResource(
1716+
libraryModule,
1717+
MAKEINTRESOURCE(VS_VERSION_INFO),
1718+
VS_FILE_INFO,
1719+
NULL,
1720+
&versionInfo
1721+
))
17101722
{
1711-
PhFreeLibraryAsImageResource(imageBaseAddress);
1712-
return imageVersionInfo;
1723+
FreeLibrary(libraryModule);
1724+
return versionInfo;
17131725
}
17141726

1715-
PhFreeLibraryAsImageResource(imageBaseAddress);
1727+
FreeLibrary(libraryModule);
17161728
return NULL;
17171729
}
17181730

tools/peview/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ INT WINAPI wWinMain(
9494
L"Most features will not work correctly.\n\n"
9595
L"Please run the 64-bit version of PE Viewer instead."
9696
);
97-
RtlExitUserProcess(STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT);
97+
PhExitApplication(STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT);
9898
}
9999
#endif
100100

@@ -154,7 +154,7 @@ INT WINAPI wWinMain(
154154
NULL
155155
))
156156
{
157-
RtlExitUserProcess(STATUS_SUCCESS);
157+
PhExitApplication(STATUS_SUCCESS);
158158
}
159159

160160
PhDereferenceObject(applicationFileName);

0 commit comments

Comments
 (0)