forked from enlightenment/efl
Evil: fix mmap() and define HAVE_MMAP
Summary: add size of file mapping to fix invalid parameter Test Plan: compilation (edje succeeds) and elm_test Reviewers: zmike, cedric, raster Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9913
This commit is contained in:
parent
3307e55874
commit
c00d70982f
|
@ -144,7 +144,7 @@ struct Dl_info
|
||||||
*/
|
*/
|
||||||
EAPI void *dlopen(const char* path, int mode);
|
EAPI void *dlopen(const char* path, int mode);
|
||||||
#ifndef HAVE_DLOPEN
|
#ifndef HAVE_DLOPEN
|
||||||
#define HAVE_DLOPEN 1
|
# define HAVE_DLOPEN 1
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* @brief Close a dynamic-link library.
|
* @brief Close a dynamic-link library.
|
||||||
|
|
|
@ -58,6 +58,8 @@ mmap(void *addr EVIL_UNUSED,
|
||||||
DWORD acs = 0;
|
DWORD acs = 0;
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
void *data;
|
void *data;
|
||||||
|
DWORD low;
|
||||||
|
DWORD high;
|
||||||
|
|
||||||
/* get protection */
|
/* get protection */
|
||||||
protect = _evil_mmap_protection_get(prot);
|
protect = _evil_mmap_protection_get(prot);
|
||||||
|
@ -89,7 +91,15 @@ mmap(void *addr EVIL_UNUSED,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fm = CreateFileMapping(handle, NULL, protect, 0, 0, NULL);
|
#ifdef _WIN64
|
||||||
|
low = (DWORD)((len >> 32) & 0x00000000ffffffff);
|
||||||
|
low = (DWORD)(len & 0x00000000ffffffff);
|
||||||
|
#else
|
||||||
|
high = 0L;
|
||||||
|
low = len;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fm = CreateFileMapping(handle, NULL, protect, high, low, NULL);
|
||||||
if (!fm)
|
if (!fm)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[Evil] [mmap] CreateFileMapping failed: %s\n",
|
fprintf(stderr, "[Evil] [mmap] CreateFileMapping failed: %s\n",
|
||||||
|
|
|
@ -114,6 +114,10 @@ EAPI void *mmap(void *addr,
|
||||||
int fd,
|
int fd,
|
||||||
off_t offset);
|
off_t offset);
|
||||||
|
|
||||||
|
#ifndef HAVE_MMAP
|
||||||
|
# define HAVE_MMAP 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unmaps a mapped view of a file from the calling process's
|
* Unmaps a mapped view of a file from the calling process's
|
||||||
* address space.
|
* address space.
|
||||||
|
|
|
@ -116,7 +116,7 @@ EAPI int mkstemps(char *__template, int suffixlen);
|
||||||
*/
|
*/
|
||||||
EAPI char *realpath(const char *file_name, char *resolved_name);
|
EAPI char *realpath(const char *file_name, char *resolved_name);
|
||||||
#ifndef HAVE_REALPATH
|
#ifndef HAVE_REALPATH
|
||||||
#define HAVE_REALPATH 1
|
# define HAVE_REALPATH 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue