|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* WinPR: Windows Portable Runtime
|
|
Packit |
1fb8d4 |
* Memory Functions
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
Packit |
1fb8d4 |
* you may not use this file except in compliance with the License.
|
|
Packit |
1fb8d4 |
* You may obtain a copy of the License at
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Unless required by applicable law or agreed to in writing, software
|
|
Packit |
1fb8d4 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
1fb8d4 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
1fb8d4 |
* See the License for the specific language governing permissions and
|
|
Packit |
1fb8d4 |
* limitations under the License.
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#ifdef HAVE_CONFIG_H
|
|
Packit |
1fb8d4 |
#include "config.h"
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include <winpr/crt.h>
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include <winpr/memory.h>
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#ifdef HAVE_UNISTD_H
|
|
Packit |
1fb8d4 |
#include <unistd.h>
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
/**
|
|
Packit |
1fb8d4 |
* api-ms-win-core-memory-l1-1-2.dll:
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* AllocateUserPhysicalPages
|
|
Packit |
1fb8d4 |
* AllocateUserPhysicalPagesNuma
|
|
Packit |
1fb8d4 |
* CreateFileMappingFromApp
|
|
Packit |
1fb8d4 |
* CreateFileMappingNumaW
|
|
Packit |
1fb8d4 |
* CreateFileMappingW
|
|
Packit |
1fb8d4 |
* CreateMemoryResourceNotification
|
|
Packit |
1fb8d4 |
* FlushViewOfFile
|
|
Packit |
1fb8d4 |
* FreeUserPhysicalPages
|
|
Packit |
1fb8d4 |
* GetLargePageMinimum
|
|
Packit |
1fb8d4 |
* GetMemoryErrorHandlingCapabilities
|
|
Packit |
1fb8d4 |
* GetProcessWorkingSetSizeEx
|
|
Packit |
1fb8d4 |
* GetSystemFileCacheSize
|
|
Packit |
1fb8d4 |
* GetWriteWatch
|
|
Packit |
1fb8d4 |
* MapUserPhysicalPages
|
|
Packit |
1fb8d4 |
* MapViewOfFile
|
|
Packit |
1fb8d4 |
* MapViewOfFileEx
|
|
Packit |
1fb8d4 |
* MapViewOfFileFromApp
|
|
Packit |
1fb8d4 |
* OpenFileMappingW
|
|
Packit |
1fb8d4 |
* PrefetchVirtualMemory
|
|
Packit |
1fb8d4 |
* QueryMemoryResourceNotification
|
|
Packit |
1fb8d4 |
* ReadProcessMemory
|
|
Packit |
1fb8d4 |
* RegisterBadMemoryNotification
|
|
Packit |
1fb8d4 |
* ResetWriteWatch
|
|
Packit |
1fb8d4 |
* SetProcessWorkingSetSizeEx
|
|
Packit |
1fb8d4 |
* SetSystemFileCacheSize
|
|
Packit |
1fb8d4 |
* UnmapViewOfFile
|
|
Packit |
1fb8d4 |
* UnmapViewOfFileEx
|
|
Packit |
1fb8d4 |
* UnregisterBadMemoryNotification
|
|
Packit |
1fb8d4 |
* VirtualAlloc
|
|
Packit |
1fb8d4 |
* VirtualAllocEx
|
|
Packit |
1fb8d4 |
* VirtualAllocExNuma
|
|
Packit |
1fb8d4 |
* VirtualFree
|
|
Packit |
1fb8d4 |
* VirtualFreeEx
|
|
Packit |
1fb8d4 |
* VirtualLock
|
|
Packit |
1fb8d4 |
* VirtualProtect
|
|
Packit |
1fb8d4 |
* VirtualProtectEx
|
|
Packit |
1fb8d4 |
* VirtualQuery
|
|
Packit |
1fb8d4 |
* VirtualQueryEx
|
|
Packit |
1fb8d4 |
* VirtualUnlock
|
|
Packit |
1fb8d4 |
* WriteProcessMemory
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#ifndef _WIN32
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include "memory.h"
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
HANDLE CreateFileMappingA(HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes, DWORD flProtect,
|
|
Packit Service |
5a9772 |
DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
if (hFile != INVALID_HANDLE_VALUE)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
return NULL; /* not yet implemented */
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
return NULL;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
HANDLE CreateFileMappingW(HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes, DWORD flProtect,
|
|
Packit Service |
5a9772 |
DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCWSTR lpName)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
return NULL;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
HANDLE OpenFileMappingA(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
return NULL;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
HANDLE OpenFileMappingW(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
return NULL;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
LPVOID MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh,
|
|
Packit Service |
5a9772 |
DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
return NULL;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
LPVOID MapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh,
|
|
Packit Service |
5a9772 |
DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
return NULL;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
BOOL FlushViewOfFile(LPCVOID lpBaseAddress, SIZE_T dwNumberOfBytesToFlush)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
return TRUE;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
BOOL UnmapViewOfFile(LPCVOID lpBaseAddress)
|
|
Packit |
1fb8d4 |
{
|
|
Packit |
1fb8d4 |
return TRUE;
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#endif
|