libwinpr-memory: start stubbing
This commit is contained in:
parent
d4486b3205
commit
80449cd2c5
@ -27,12 +27,27 @@
|
|||||||
#include <winpr/winpr.h>
|
#include <winpr/winpr.h>
|
||||||
|
|
||||||
#include <winpr/string.h>
|
#include <winpr/string.h>
|
||||||
#include <winpr/memory.h>
|
#include <winpr/heap.h>
|
||||||
|
|
||||||
/* Data Alignment */
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
|
#define CopyMemory(Destination, Source, Length) memcpy((Destination), (Source), (Length))
|
||||||
|
#define MoveMemory(Destination, Source, Length) memmove((Destination), (Source), (Length))
|
||||||
|
#define FillMemory(Destination, Length, Fill) memset((Destination), (Fill), (Length))
|
||||||
|
#define ZeroMemory(Destination, Length) memset((Destination), 0, (Length))
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
WINPR_API PVOID SecureZeroMemory(PVOID ptr, SIZE_T cnt);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Data Alignment */
|
||||||
|
|
||||||
#ifndef _ERRNO_T_DEFINED
|
#ifndef _ERRNO_T_DEFINED
|
||||||
#define _ERRNO_T_DEFINED
|
#define _ERRNO_T_DEFINED
|
||||||
typedef int errno_t;
|
typedef int errno_t;
|
||||||
|
@ -102,6 +102,20 @@
|
|||||||
#define FILE_FLAG_OPEN_NO_RECALL 0x00100000
|
#define FILE_FLAG_OPEN_NO_RECALL 0x00100000
|
||||||
#define FILE_FLAG_FIRST_PIPE_INSTANCE 0x00080000
|
#define FILE_FLAG_FIRST_PIPE_INSTANCE 0x00080000
|
||||||
|
|
||||||
|
#define SECTION_MAP_EXECUTE_EXPLICIT 0x00020
|
||||||
|
#define SECTION_EXTEND_SIZE 0x00010
|
||||||
|
#define SECTION_MAP_READ 0x00004
|
||||||
|
#define SECTION_MAP_WRITE 0x00002
|
||||||
|
#define SECTION_QUERY 0x00001
|
||||||
|
#define SECTION_MAP_EXECUTE 0x00008
|
||||||
|
#define SECTION_ALL_ACCESS 0xF001F
|
||||||
|
|
||||||
|
#define FILE_MAP_COPY SECTION_QUERY
|
||||||
|
#define FILE_MAP_WRITE SECTION_MAP_WRITE
|
||||||
|
#define FILE_MAP_READ SECTION_MAP_READ
|
||||||
|
#define FILE_MAP_ALL_ACCESS SECTION_ALL_ACCESS
|
||||||
|
#define FILE_MAP_EXECUTE SECTION_MAP_EXECUTE_EXPLICIT
|
||||||
|
|
||||||
#define CREATE_NEW 1
|
#define CREATE_NEW 1
|
||||||
#define CREATE_ALWAYS 2
|
#define CREATE_ALWAYS 2
|
||||||
#define OPEN_EXISTING 3
|
#define OPEN_EXISTING 3
|
||||||
|
@ -17,27 +17,48 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef WINPR_CRT_MEMORY_H
|
#ifndef WINPR_MEMORY_H
|
||||||
#define WINPR_CRT_MEMORY_H
|
#define WINPR_MEMORY_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <winpr/winpr.h>
|
#include <winpr/winpr.h>
|
||||||
#include <winpr/wtypes.h>
|
#include <winpr/wtypes.h>
|
||||||
|
|
||||||
|
#include <winpr/file.h>
|
||||||
|
#include <winpr/heap.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
#define CopyMemory(Destination, Source, Length) memcpy((Destination), (Source), (Length))
|
#ifdef __cplusplus
|
||||||
#define MoveMemory(Destination, Source, Length) memmove((Destination), (Source), (Length))
|
extern "C" {
|
||||||
#define FillMemory(Destination, Length, Fill) memset((Destination), (Fill), (Length))
|
#endif
|
||||||
#define ZeroMemory(Destination, Length) memset((Destination), 0, (Length))
|
|
||||||
|
|
||||||
WINPR_API PVOID SecureZeroMemory(PVOID ptr, SIZE_T cnt);
|
WINPR_API HANDLE CreateFileMappingA(HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes, DWORD flProtect,
|
||||||
|
DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName);
|
||||||
|
WINPR_API HANDLE CreateFileMappingW(HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes, DWORD flProtect,
|
||||||
|
DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCWSTR lpName);
|
||||||
|
|
||||||
|
WINPR_API HANDLE OpenFileMappingA(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName);
|
||||||
|
WINPR_API HANDLE OpenFileMappingW(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName);
|
||||||
|
|
||||||
|
WINPR_API LPVOID MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh,
|
||||||
|
DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap);
|
||||||
|
|
||||||
|
WINPR_API LPVOID MapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh,
|
||||||
|
DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress);
|
||||||
|
|
||||||
|
WINPR_API BOOL FlushViewOfFile(LPCVOID lpBaseAddress, SIZE_T dwNumberOfBytesToFlush);
|
||||||
|
|
||||||
|
WINPR_API BOOL UnmapViewOfFile(LPCVOID lpBaseAddress);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <winpr/heap.h>
|
#endif /* WINPR_MEMORY_H */
|
||||||
|
|
||||||
#endif /* WINPR_CRT_MEMORY_H */
|
|
||||||
|
|
||||||
|
@ -371,6 +371,38 @@ typedef struct _TOKEN_APPCONTAINER_INFORMATION
|
|||||||
PSID TokenAppContainer;
|
PSID TokenAppContainer;
|
||||||
} TOKEN_APPCONTAINER_INFORMATION, *PTOKEN_APPCONTAINER_INFORMATION;
|
} TOKEN_APPCONTAINER_INFORMATION, *PTOKEN_APPCONTAINER_INFORMATION;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
WINPR_API BOOL InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision);
|
||||||
|
WINPR_API DWORD GetSecurityDescriptorLength(PSECURITY_DESCRIPTOR pSecurityDescriptor);
|
||||||
|
WINPR_API BOOL IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor);
|
||||||
|
|
||||||
|
WINPR_API BOOL GetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||||
|
PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision);
|
||||||
|
WINPR_API BOOL SetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||||
|
SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest, SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet);
|
||||||
|
|
||||||
|
WINPR_API BOOL GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, PACL* pDacl, LPBOOL lpbDaclDefaulted);
|
||||||
|
WINPR_API BOOL SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted);
|
||||||
|
|
||||||
|
WINPR_API BOOL GetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID* pGroup, LPBOOL lpbGroupDefaulted);
|
||||||
|
WINPR_API BOOL SetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pGroup, BOOL bGroupDefaulted);
|
||||||
|
|
||||||
|
WINPR_API BOOL GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID* pOwner, LPBOOL lpbOwnerDefaulted);
|
||||||
|
WINPR_API BOOL SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pOwner, BOOL bOwnerDefaulted);
|
||||||
|
|
||||||
|
WINPR_API DWORD GetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl);
|
||||||
|
WINPR_API DWORD SetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl);
|
||||||
|
|
||||||
|
WINPR_API BOOL GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbSaclPresent, PACL* pSacl, LPBOOL lpbSaclDefaulted);
|
||||||
|
WINPR_API BOOL SetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bSaclPresent, PACL pSacl, BOOL bSaclDefaulted);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* WINPR_SECURITY_H */
|
#endif /* WINPR_SECURITY_H */
|
||||||
|
@ -268,6 +268,8 @@ typedef struct _SECURITY_DESCRIPTOR
|
|||||||
PACL Dacl;
|
PACL Dacl;
|
||||||
} SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
|
} SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
|
||||||
|
|
||||||
|
typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
|
||||||
|
|
||||||
typedef struct _SECURITY_ATTRIBUTES
|
typedef struct _SECURITY_ATTRIBUTES
|
||||||
{
|
{
|
||||||
DWORD nLength;
|
DWORD nLength;
|
||||||
|
51
winpr/libwinpr/memory/CMakeLists.txt
Normal file
51
winpr/libwinpr/memory/CMakeLists.txt
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
set(MODULE_NAME "winpr-memory")
|
||||||
|
set(MODULE_PREFIX "WINPR_MEMORY")
|
||||||
|
|
||||||
|
set(${MODULE_PREFIX}_SRCS
|
||||||
|
memory.c
|
||||||
|
memory.h)
|
||||||
|
|
||||||
|
if(MSVC AND (NOT MONOLITHIC_BUILD))
|
||||||
|
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_complex_library(MODULE ${MODULE_NAME} TYPE "OBJECT"
|
||||||
|
MONOLITHIC ${MONOLITHIC_BUILD}
|
||||||
|
SOURCES ${${MODULE_PREFIX}_SRCS})
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib")
|
||||||
|
|
||||||
|
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
||||||
|
MONOLITHIC ${MONOLITHIC_BUILD} INTERNAL
|
||||||
|
MODULE winpr
|
||||||
|
MODULES winpr-crt)
|
||||||
|
|
||||||
|
if(MONOLITHIC_BUILD)
|
||||||
|
|
||||||
|
else()
|
||||||
|
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||||
|
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} EXPORT WinPRTargets)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR")
|
||||||
|
|
||||||
|
if(BUILD_TESTING)
|
||||||
|
add_subdirectory(test)
|
||||||
|
endif()
|
9
winpr/libwinpr/memory/ModuleOptions.cmake
Normal file
9
winpr/libwinpr/memory/ModuleOptions.cmake
Normal file
@ -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}")
|
||||||
|
|
126
winpr/libwinpr/memory/memory.c
Normal file
126
winpr/libwinpr/memory/memory.c
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
|
#include <winpr/memory.h>
|
||||||
|
|
||||||
|
#ifdef 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)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
|
34
winpr/libwinpr/memory/memory.h
Normal file
34
winpr/libwinpr/memory/memory.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* 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 */
|
||||||
|
|
||||||
|
|
3
winpr/libwinpr/memory/module.def
Normal file
3
winpr/libwinpr/memory/module.def
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
LIBRARY "libwinpr-memory"
|
||||||
|
EXPORTS
|
||||||
|
|
2
winpr/libwinpr/memory/test/.gitignore
vendored
Normal file
2
winpr/libwinpr/memory/test/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
TestMemory
|
||||||
|
TestMemory.c
|
30
winpr/libwinpr/memory/test/CMakeLists.txt
Normal file
30
winpr/libwinpr/memory/test/CMakeLists.txt
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
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_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
||||||
|
MONOLITHIC ${MONOLITHIC_BUILD}
|
||||||
|
MODULE winpr
|
||||||
|
MODULES winpr-crt)
|
||||||
|
|
||||||
|
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||||
|
|
||||||
|
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")
|
9
winpr/libwinpr/memory/test/TestMemoryCreateFileMapping.c
Normal file
9
winpr/libwinpr/memory/test/TestMemoryCreateFileMapping.c
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/memory.h>
|
||||||
|
|
||||||
|
int TestMemoryCreateFileMapping(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -85,13 +85,6 @@
|
|||||||
* GetKernelObjectSecurity
|
* GetKernelObjectSecurity
|
||||||
* GetLengthSid
|
* GetLengthSid
|
||||||
* GetPrivateObjectSecurity
|
* GetPrivateObjectSecurity
|
||||||
* GetSecurityDescriptorControl
|
|
||||||
* GetSecurityDescriptorDacl
|
|
||||||
* GetSecurityDescriptorGroup
|
|
||||||
* GetSecurityDescriptorLength
|
|
||||||
* GetSecurityDescriptorOwner
|
|
||||||
* GetSecurityDescriptorRMControl
|
|
||||||
* GetSecurityDescriptorSacl
|
|
||||||
* GetSidIdentifierAuthority
|
* GetSidIdentifierAuthority
|
||||||
* GetSidLengthRequired
|
* GetSidLengthRequired
|
||||||
* GetSidSubAuthority
|
* GetSidSubAuthority
|
||||||
@ -102,11 +95,9 @@
|
|||||||
* ImpersonateLoggedOnUser
|
* ImpersonateLoggedOnUser
|
||||||
* ImpersonateSelf
|
* ImpersonateSelf
|
||||||
* InitializeAcl
|
* InitializeAcl
|
||||||
* InitializeSecurityDescriptor
|
|
||||||
* InitializeSid
|
* InitializeSid
|
||||||
* IsTokenRestricted
|
* IsTokenRestricted
|
||||||
* IsValidAcl
|
* IsValidAcl
|
||||||
* IsValidSecurityDescriptor
|
|
||||||
* IsValidSid
|
* IsValidSid
|
||||||
* IsWellKnownSid
|
* IsWellKnownSid
|
||||||
* MakeAbsoluteSD
|
* MakeAbsoluteSD
|
||||||
@ -127,12 +118,6 @@
|
|||||||
* SetPrivateObjectSecurity
|
* SetPrivateObjectSecurity
|
||||||
* SetPrivateObjectSecurityEx
|
* SetPrivateObjectSecurityEx
|
||||||
* SetSecurityAccessMask
|
* SetSecurityAccessMask
|
||||||
* SetSecurityDescriptorControl
|
|
||||||
* SetSecurityDescriptorDacl
|
|
||||||
* SetSecurityDescriptorGroup
|
|
||||||
* SetSecurityDescriptorOwner
|
|
||||||
* SetSecurityDescriptorRMControl
|
|
||||||
* SetSecurityDescriptorSacl
|
|
||||||
* SetTokenInformation
|
* SetTokenInformation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -140,5 +125,82 @@
|
|||||||
|
|
||||||
#include "security.h"
|
#include "security.h"
|
||||||
|
|
||||||
|
BOOL InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD GetSecurityDescriptorLength(PSECURITY_DESCRIPTOR pSecurityDescriptor)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL GetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||||
|
PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL SetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||||
|
SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest, SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, PACL* pDacl, LPBOOL lpbDaclDefaulted)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL GetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID* pGroup, LPBOOL lpbGroupDefaulted)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL SetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pGroup, BOOL bGroupDefaulted)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID* pOwner, LPBOOL lpbOwnerDefaulted)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pOwner, BOOL bOwnerDefaulted)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD GetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD SetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbSaclPresent, PACL* pSacl, LPBOOL lpbSaclDefaulted)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL SetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bSaclPresent, PACL pSacl, BOOL bSaclDefaulted)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <winpr/collections.h>
|
#include <winpr/collections.h>
|
||||||
#include <winpr/memory.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* C equivalent of the C# ListDictionary Class:
|
* C equivalent of the C# ListDictionary Class:
|
||||||
|
Loading…
Reference in New Issue
Block a user