Skip to content

Commit 6250b39

Browse files
author
Dan Dees
committed
define exported extern "C" as declared
1 parent 182acf9 commit 6250b39

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

MemoryModule/Initialize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
PMMP_GLOBAL_DATA MmpGlobalDataPtr;
77

88
// DLL compliant access
9-
PMMP_GLOBAL_DATA NTAPI GetMmpGlobalDataPtr()
9+
extern "C" PMMP_GLOBAL_DATA NTAPI GetMmpGlobalDataPtr()
1010
{
1111
return MmpGlobalDataPtr;
1212
}

MemoryModule/LoadDllMemoryApi.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "stdafx.h"
22
#include <cstdlib>
33

4-
HMEMORYMODULE WINAPI LoadLibraryMemoryExW(
4+
extern "C" HMEMORYMODULE WINAPI LoadLibraryMemoryExW(
55
_In_ PVOID BufferAddress,
66
_In_ size_t Reserved,
77
_In_opt_ LPCWSTR DllBaseName,
@@ -15,7 +15,7 @@ HMEMORYMODULE WINAPI LoadLibraryMemoryExW(
1515
return hMemoryModule;
1616
}
1717

18-
HMEMORYMODULE WINAPI LoadLibraryMemoryExA(
18+
extern "C" HMEMORYMODULE WINAPI LoadLibraryMemoryExA(
1919
_In_ PVOID BufferAddress,
2020
_In_ size_t Reserved,
2121
_In_opt_ LPCSTR DllBaseName,
@@ -59,11 +59,11 @@ HMEMORYMODULE WINAPI LoadLibraryMemoryExA(
5959
return result;
6060
}
6161

62-
HMEMORYMODULE WINAPI LoadLibraryMemory(_In_ PVOID BufferAddress) {
62+
extern "C" HMEMORYMODULE WINAPI LoadLibraryMemory(_In_ PVOID BufferAddress) {
6363
return LoadLibraryMemoryExW(BufferAddress, 0, nullptr, nullptr, 0);
6464
}
6565

66-
BOOL WINAPI FreeLibraryMemory(_In_ HMEMORYMODULE hMemoryModule) {
66+
extern "C" BOOL WINAPI FreeLibraryMemory(_In_ HMEMORYMODULE hMemoryModule) {
6767
NTSTATUS status = LdrUnloadDllMemory(hMemoryModule);
6868
if (!NT_SUCCESS(status)) {
6969
SetLastError(RtlNtStatusToDosError(status));

MemoryModule/Loader.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ NTSTATUS NTAPI LdrMapDllMemory(
4444
return STATUS_SUCCESS;
4545
}
4646

47-
NTSTATUS NTAPI LdrLoadDllMemoryExW(
47+
extern "C" NTSTATUS NTAPI LdrLoadDllMemoryExW(
4848
_Out_ HMEMORYMODULE* BaseAddress,
4949
_Out_opt_ PVOID* LdrEntry,
5050
_In_ DWORD dwFlags,
@@ -217,7 +217,7 @@ NTSTATUS NTAPI LdrLoadDllMemoryExW(
217217
return status;
218218
}
219219

220-
NTSTATUS NTAPI LdrUnloadDllMemory(_In_ HMEMORYMODULE BaseAddress) {
220+
extern "C" NTSTATUS NTAPI LdrUnloadDllMemory(_In_ HMEMORYMODULE BaseAddress) {
221221
PLDR_DATA_TABLE_ENTRY CurEntry;
222222
ULONG count = 0;
223223
NTSTATUS status = STATUS_SUCCESS;
@@ -288,13 +288,14 @@ NTSTATUS NTAPI LdrUnloadDllMemory(_In_ HMEMORYMODULE BaseAddress) {
288288
return status;
289289
}
290290

291+
extern "C"
291292
DECLSPEC_NORETURN
292293
VOID NTAPI LdrUnloadDllMemoryAndExitThread(_In_ HMEMORYMODULE BaseAddress, _In_ DWORD dwExitCode) {
293294
LdrUnloadDllMemory(BaseAddress);
294295
RtlExitUserThread(dwExitCode);
295296
}
296297

297-
NTSTATUS NTAPI LdrQuerySystemMemoryModuleFeatures(_Out_ PDWORD pFeatures) {
298+
extern "C" NTSTATUS NTAPI LdrQuerySystemMemoryModuleFeatures(_Out_ PDWORD pFeatures) {
298299
NTSTATUS status = STATUS_SUCCESS;
299300
__try {
300301
*pFeatures = MmpGlobalDataPtr->MmpFeatures;

MemoryModule/MmpGlobalData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,4 @@ typedef struct _MMP_GLOBAL_DATA {
153153
)
154154

155155
extern PMMP_GLOBAL_DATA MmpGlobalDataPtr;
156-
PMMP_GLOBAL_DATA NTAPI GetMmpGlobalDataPtr() ;
156+
extern "C" PMMP_GLOBAL_DATA NTAPI GetMmpGlobalDataPtr() ;

0 commit comments

Comments
 (0)