summaryrefslogtreecommitdiffstats
path: root/winpr/libwinpr/memory
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:24:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:24:41 +0000
commita9bcc81f821d7c66f623779fa5147e728eb3c388 (patch)
tree98676963bcdd537ae5908a067a8eb110b93486a6 /winpr/libwinpr/memory
parentInitial commit. (diff)
downloadfreerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.tar.xz
freerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.zip
Adding upstream version 3.3.0+dfsg1.upstream/3.3.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'winpr/libwinpr/memory')
-rw-r--r--winpr/libwinpr/memory/CMakeLists.txt22
-rw-r--r--winpr/libwinpr/memory/ModuleOptions.cmake9
-rw-r--r--winpr/libwinpr/memory/memory.c128
-rw-r--r--winpr/libwinpr/memory/memory.h30
-rw-r--r--winpr/libwinpr/memory/test/CMakeLists.txt23
-rw-r--r--winpr/libwinpr/memory/test/TestMemoryCreateFileMapping.c8
6 files changed, 220 insertions, 0 deletions
diff --git a/winpr/libwinpr/memory/CMakeLists.txt b/winpr/libwinpr/memory/CMakeLists.txt
new file mode 100644
index 0000000..5e28d3c
--- /dev/null
+++ b/winpr/libwinpr/memory/CMakeLists.txt
@@ -0,0 +1,22 @@
+# WinPR: Windows Portable Runtime
+# libwinpr-memory cmake build script
+#
+# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+winpr_module_add(memory.c memory.h)
+
+if(BUILD_TESTING)
+ add_subdirectory(test)
+endif()
diff --git a/winpr/libwinpr/memory/ModuleOptions.cmake b/winpr/libwinpr/memory/ModuleOptions.cmake
new file mode 100644
index 0000000..704ddca
--- /dev/null
+++ b/winpr/libwinpr/memory/ModuleOptions.cmake
@@ -0,0 +1,9 @@
+
+set(MINWIN_LAYER "1")
+set(MINWIN_GROUP "core")
+set(MINWIN_MAJOR_VERSION "1")
+set(MINWIN_MINOR_VERSION "2")
+set(MINWIN_SHORT_NAME "memory")
+set(MINWIN_LONG_NAME "Memory Functions")
+set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")
+
diff --git a/winpr/libwinpr/memory/memory.c b/winpr/libwinpr/memory/memory.c
new file mode 100644
index 0000000..83f4c07
--- /dev/null
+++ b/winpr/libwinpr/memory/memory.c
@@ -0,0 +1,128 @@
+/**
+ * WinPR: Windows Portable Runtime
+ * Memory Functions
+ *
+ * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <winpr/config.h>
+
+#include <winpr/crt.h>
+
+#include <winpr/memory.h>
+
+#ifdef WINPR_HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+/**
+ * api-ms-win-core-memory-l1-1-2.dll:
+ *
+ * AllocateUserPhysicalPages
+ * AllocateUserPhysicalPagesNuma
+ * CreateFileMappingFromApp
+ * CreateFileMappingNumaW
+ * CreateFileMappingW
+ * CreateMemoryResourceNotification
+ * FlushViewOfFile
+ * FreeUserPhysicalPages
+ * GetLargePageMinimum
+ * GetMemoryErrorHandlingCapabilities
+ * GetProcessWorkingSetSizeEx
+ * GetSystemFileCacheSize
+ * GetWriteWatch
+ * MapUserPhysicalPages
+ * MapViewOfFile
+ * MapViewOfFileEx
+ * MapViewOfFileFromApp
+ * OpenFileMappingW
+ * PrefetchVirtualMemory
+ * QueryMemoryResourceNotification
+ * ReadProcessMemory
+ * RegisterBadMemoryNotification
+ * ResetWriteWatch
+ * SetProcessWorkingSetSizeEx
+ * SetSystemFileCacheSize
+ * UnmapViewOfFile
+ * UnmapViewOfFileEx
+ * UnregisterBadMemoryNotification
+ * VirtualAlloc
+ * VirtualAllocEx
+ * VirtualAllocExNuma
+ * VirtualFree
+ * VirtualFreeEx
+ * VirtualLock
+ * VirtualProtect
+ * VirtualProtectEx
+ * VirtualQuery
+ * VirtualQueryEx
+ * VirtualUnlock
+ * WriteProcessMemory
+ */
+
+#ifndef _WIN32
+
+#include "memory.h"
+
+HANDLE CreateFileMappingA(HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes, DWORD flProtect,
+ DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName)
+{
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ return NULL; /* not yet implemented */
+ }
+
+ return NULL;
+}
+
+HANDLE CreateFileMappingW(HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes, DWORD flProtect,
+ DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCWSTR lpName)
+{
+ return NULL;
+}
+
+HANDLE OpenFileMappingA(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName)
+{
+ return NULL;
+}
+
+HANDLE OpenFileMappingW(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName)
+{
+ return NULL;
+}
+
+LPVOID MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh,
+ DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap)
+{
+ return NULL;
+}
+
+LPVOID MapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh,
+ DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress)
+{
+ return NULL;
+}
+
+BOOL FlushViewOfFile(LPCVOID lpBaseAddress, SIZE_T dwNumberOfBytesToFlush)
+{
+ return TRUE;
+}
+
+BOOL UnmapViewOfFile(LPCVOID lpBaseAddress)
+{
+ return TRUE;
+}
+
+#endif
diff --git a/winpr/libwinpr/memory/memory.h b/winpr/libwinpr/memory/memory.h
new file mode 100644
index 0000000..cc2492e
--- /dev/null
+++ b/winpr/libwinpr/memory/memory.h
@@ -0,0 +1,30 @@
+/**
+ * WinPR: Windows Portable Runtime
+ * Memory Functions
+ *
+ * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef WINPR_MEMORY_PRIVATE_H
+#define WINPR_MEMORY_PRIVATE_H
+
+#ifndef _WIN32
+
+#include <winpr/crt.h>
+#include <winpr/memory.h>
+
+#endif
+
+#endif /* WINPR_MEMORY_PRIVATE_H */
diff --git a/winpr/libwinpr/memory/test/CMakeLists.txt b/winpr/libwinpr/memory/test/CMakeLists.txt
new file mode 100644
index 0000000..d4fad51
--- /dev/null
+++ b/winpr/libwinpr/memory/test/CMakeLists.txt
@@ -0,0 +1,23 @@
+
+set(MODULE_NAME "TestMemory")
+set(MODULE_PREFIX "TEST_MEMORY")
+
+set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
+
+set(${MODULE_PREFIX}_TESTS
+ TestMemoryCreateFileMapping.c)
+
+create_test_sourcelist(${MODULE_PREFIX}_SRCS
+ ${${MODULE_PREFIX}_DRIVER}
+ ${${MODULE_PREFIX}_TESTS})
+
+add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
+
+set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
+
+foreach(test ${${MODULE_PREFIX}_TESTS})
+ get_filename_component(TestName ${test} NAME_WE)
+ add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
+endforeach()
+
+set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")
diff --git a/winpr/libwinpr/memory/test/TestMemoryCreateFileMapping.c b/winpr/libwinpr/memory/test/TestMemoryCreateFileMapping.c
new file mode 100644
index 0000000..e6e7552
--- /dev/null
+++ b/winpr/libwinpr/memory/test/TestMemoryCreateFileMapping.c
@@ -0,0 +1,8 @@
+
+#include <winpr/crt.h>
+#include <winpr/memory.h>
+
+int TestMemoryCreateFileMapping(int argc, char* argv[])
+{
+ return 0;
+}