kernel: Documentation cleanups.
This commit is contained in:
parent
de9400262e
commit
9ba1876c40
|
@ -52,17 +52,20 @@ static unsigned int page_size;
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* VirtualAlloc (KERNEL32.@)
|
* VirtualAlloc (KERNEL32.@)
|
||||||
* Reserves or commits a region of pages in virtual address space
|
*
|
||||||
|
* Reserves or commits a region of pages in virtual address space.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* addr [I] Address of region to reserve or commit.
|
||||||
|
* size [I] Size of region.
|
||||||
|
* type [I] Type of allocation.
|
||||||
|
* protect [I] Type of access protection.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Base address of allocated region of pages
|
* Success: Base address of allocated region of pages.
|
||||||
* NULL: Failure
|
* Failure: NULL.
|
||||||
*/
|
*/
|
||||||
LPVOID WINAPI VirtualAlloc(
|
LPVOID WINAPI VirtualAlloc( LPVOID addr, SIZE_T size, DWORD type, DWORD protect )
|
||||||
LPVOID addr, /* [in] Address of region to reserve or commit */
|
|
||||||
SIZE_T size, /* [in] Size of region */
|
|
||||||
DWORD type, /* [in] Type of allocation */
|
|
||||||
DWORD protect)/* [in] Type of access protection */
|
|
||||||
{
|
{
|
||||||
return VirtualAllocEx( GetCurrentProcess(), addr, size, type, protect );
|
return VirtualAllocEx( GetCurrentProcess(), addr, size, type, protect );
|
||||||
}
|
}
|
||||||
|
@ -73,16 +76,20 @@ LPVOID WINAPI VirtualAlloc(
|
||||||
*
|
*
|
||||||
* Seems to be just as VirtualAlloc, but with process handle.
|
* Seems to be just as VirtualAlloc, but with process handle.
|
||||||
*
|
*
|
||||||
|
* PARAMS
|
||||||
|
* hProcess [I] Handle to process to do mem operation.
|
||||||
|
* addr [I] Address of region to reserve or commit.
|
||||||
|
* size [I] Size of region.
|
||||||
|
* type [I] Type of allocation.
|
||||||
|
* protect [I] Type of access protection.
|
||||||
|
*
|
||||||
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Base address of allocated region of pages
|
* Success: Base address of allocated region of pages.
|
||||||
* NULL: Failure
|
* Failure: NULL.
|
||||||
*/
|
*/
|
||||||
LPVOID WINAPI VirtualAllocEx(
|
LPVOID WINAPI VirtualAllocEx( HANDLE hProcess, LPVOID addr, SIZE_T size,
|
||||||
HANDLE hProcess, /* [in] Handle of process to do mem operation */
|
DWORD type, DWORD protect )
|
||||||
LPVOID addr, /* [in] Address of region to reserve or commit */
|
|
||||||
SIZE_T size, /* [in] Size of region */
|
|
||||||
DWORD type, /* [in] Type of allocation */
|
|
||||||
DWORD protect ) /* [in] Type of access protection */
|
|
||||||
{
|
{
|
||||||
LPVOID ret = addr;
|
LPVOID ret = addr;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
@ -98,28 +105,38 @@ LPVOID WINAPI VirtualAllocEx(
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* VirtualFree (KERNEL32.@)
|
* VirtualFree (KERNEL32.@)
|
||||||
* Release or decommits a region of pages in virtual address space.
|
*
|
||||||
|
* Releases or decommits a region of pages in virtual address space.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* addr [I] Address of region of committed pages.
|
||||||
|
* size [I] Size of region.
|
||||||
|
* type [I] Type of operation.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* TRUE: Success
|
* Success: TRUE.
|
||||||
* FALSE: Failure
|
* Failure: FALSE.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI VirtualFree(
|
BOOL WINAPI VirtualFree( LPVOID addr, SIZE_T size, DWORD type )
|
||||||
LPVOID addr, /* [in] Address of region of committed pages */
|
{
|
||||||
SIZE_T size, /* [in] Size of region */
|
|
||||||
DWORD type /* [in] Type of operation */
|
|
||||||
) {
|
|
||||||
return VirtualFreeEx( GetCurrentProcess(), addr, size, type );
|
return VirtualFreeEx( GetCurrentProcess(), addr, size, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* VirtualFreeEx (KERNEL32.@)
|
* VirtualFreeEx (KERNEL32.@)
|
||||||
* Release or decommits a region of pages in virtual address space.
|
*
|
||||||
|
* Releases or decommits a region of pages in virtual address space.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* process [I] Handle to process.
|
||||||
|
* addr [I] Address of region to free.
|
||||||
|
* size [I] Size of region.
|
||||||
|
* type [I] Type of operation.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* TRUE: Success
|
* Success: TRUE.
|
||||||
* FALSE: Failure
|
* Failure: FALSE.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI VirtualFreeEx( HANDLE process, LPVOID addr, SIZE_T size, DWORD type )
|
BOOL WINAPI VirtualFreeEx( HANDLE process, LPVOID addr, SIZE_T size, DWORD type )
|
||||||
{
|
{
|
||||||
|
@ -131,17 +148,22 @@ BOOL WINAPI VirtualFreeEx( HANDLE process, LPVOID addr, SIZE_T size, DWORD type
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* VirtualLock (KERNEL32.@)
|
* VirtualLock (KERNEL32.@)
|
||||||
* Locks the specified region of virtual address space
|
|
||||||
*
|
*
|
||||||
* NOTE
|
* Locks the specified region of virtual address space.
|
||||||
* Always returns TRUE
|
*
|
||||||
|
* PARAMS
|
||||||
|
* addr [I] Address of first byte of range to lock.
|
||||||
|
* size [I] Number of bytes in range to lock.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* TRUE: Success
|
* Success: TRUE.
|
||||||
* FALSE: Failure
|
* Failure: FALSE.
|
||||||
|
*
|
||||||
|
* NOTES
|
||||||
|
* Always returns TRUE.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI VirtualLock( LPVOID addr, /* [in] Address of first byte of range to lock */
|
BOOL WINAPI VirtualLock( LPVOID addr, SIZE_T size )
|
||||||
SIZE_T size ) /* [in] Number of bytes in range to lock */
|
|
||||||
{
|
{
|
||||||
NTSTATUS status = NtLockVirtualMemory( GetCurrentProcess(), &addr, &size, 1 );
|
NTSTATUS status = NtLockVirtualMemory( GetCurrentProcess(), &addr, &size, 1 );
|
||||||
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
||||||
|
@ -151,17 +173,22 @@ BOOL WINAPI VirtualLock( LPVOID addr, /* [in] Address of first byte of range to
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* VirtualUnlock (KERNEL32.@)
|
* VirtualUnlock (KERNEL32.@)
|
||||||
* Unlocks a range of pages in the virtual address space
|
|
||||||
*
|
*
|
||||||
* NOTE
|
* Unlocks a range of pages in the virtual address space.
|
||||||
* Always returns TRUE
|
*
|
||||||
|
* PARAMS
|
||||||
|
* addr [I] Address of first byte of range.
|
||||||
|
* size [I] Number of bytes in range.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* TRUE: Success
|
* Success: TRUE.
|
||||||
* FALSE: Failure
|
* Failure: FALSE.
|
||||||
|
*
|
||||||
|
* NOTES
|
||||||
|
* Always returns TRUE.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI VirtualUnlock( LPVOID addr, /* [in] Address of first byte of range */
|
BOOL WINAPI VirtualUnlock( LPVOID addr, SIZE_T size )
|
||||||
SIZE_T size ) /* [in] Number of bytes in range */
|
|
||||||
{
|
{
|
||||||
NTSTATUS status = NtUnlockVirtualMemory( GetCurrentProcess(), &addr, &size, 1 );
|
NTSTATUS status = NtUnlockVirtualMemory( GetCurrentProcess(), &addr, &size, 1 );
|
||||||
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
||||||
|
@ -171,37 +198,44 @@ BOOL WINAPI VirtualUnlock( LPVOID addr, /* [in] Address of first byte of range *
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* VirtualProtect (KERNEL32.@)
|
* VirtualProtect (KERNEL32.@)
|
||||||
* Changes the access protection on a region of committed pages
|
*
|
||||||
|
* Changes the access protection on a region of committed pages.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* addr [I] Address of region of committed pages.
|
||||||
|
* size [I] Size of region.
|
||||||
|
* new_prot [I] Desired access protection.
|
||||||
|
* old_prot [O] Address of variable to get old protection.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* TRUE: Success
|
* Success: TRUE.
|
||||||
* FALSE: Failure
|
* Failure: FALSE.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI VirtualProtect(
|
BOOL WINAPI VirtualProtect( LPVOID addr, SIZE_T size, DWORD new_prot, LPDWORD old_prot)
|
||||||
LPVOID addr, /* [in] Address of region of committed pages */
|
{
|
||||||
SIZE_T size, /* [in] Size of region */
|
|
||||||
DWORD new_prot, /* [in] Desired access protection */
|
|
||||||
LPDWORD old_prot /* [out] Address of variable to get old protection */
|
|
||||||
) {
|
|
||||||
return VirtualProtectEx( GetCurrentProcess(), addr, size, new_prot, old_prot );
|
return VirtualProtectEx( GetCurrentProcess(), addr, size, new_prot, old_prot );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* VirtualProtectEx (KERNEL32.@)
|
* VirtualProtectEx (KERNEL32.@)
|
||||||
|
*
|
||||||
* Changes the access protection on a region of committed pages in the
|
* Changes the access protection on a region of committed pages in the
|
||||||
* virtual address space of a specified process
|
* virtual address space of a specified process.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* process [I] Handle of process.
|
||||||
|
* addr [I] Address of region of committed pages.
|
||||||
|
* size [I] Size of region.
|
||||||
|
* new_prot [I] Desired access protection.
|
||||||
|
* old_prot [O] Address of variable to get old protection.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* TRUE: Success
|
* Success: TRUE.
|
||||||
* FALSE: Failure
|
* Failure: FALSE.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI VirtualProtectEx(
|
BOOL WINAPI VirtualProtectEx( HANDLE process, LPVOID addr, SIZE_T size,
|
||||||
HANDLE process, /* [in] Handle of process */
|
DWORD new_prot, LPDWORD old_prot )
|
||||||
LPVOID addr, /* [in] Address of region of committed pages */
|
|
||||||
SIZE_T size, /* [in] Size of region */
|
|
||||||
DWORD new_prot, /* [in] Desired access protection */
|
|
||||||
LPDWORD old_prot /* [out] Address of variable to get old protection */ )
|
|
||||||
{
|
{
|
||||||
NTSTATUS status = NtProtectVirtualMemory( process, &addr, &size, new_prot, old_prot );
|
NTSTATUS status = NtProtectVirtualMemory( process, &addr, &size, new_prot, old_prot );
|
||||||
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
||||||
|
@ -211,34 +245,42 @@ BOOL WINAPI VirtualProtectEx(
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* VirtualQuery (KERNEL32.@)
|
* VirtualQuery (KERNEL32.@)
|
||||||
* Provides info about a range of pages in virtual address space
|
*
|
||||||
|
* Provides info about a range of pages in virtual address space.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* addr [I] Address of region.
|
||||||
|
* info [O] Address of info buffer.
|
||||||
|
* len [I] Size of buffer.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Number of bytes returned in information buffer
|
* Number of bytes returned in information buffer or 0 if
|
||||||
* or 0 if addr is >= 0xc0000000 (kernel space).
|
* addr >= 0xc0000000 (kernel space).
|
||||||
*/
|
*/
|
||||||
SIZE_T WINAPI VirtualQuery(
|
SIZE_T WINAPI VirtualQuery( LPCVOID addr, PMEMORY_BASIC_INFORMATION info,
|
||||||
LPCVOID addr, /* [in] Address of region */
|
SIZE_T len )
|
||||||
PMEMORY_BASIC_INFORMATION info, /* [out] Address of info buffer */
|
{
|
||||||
SIZE_T len /* [in] Size of buffer */
|
|
||||||
) {
|
|
||||||
return VirtualQueryEx( GetCurrentProcess(), addr, info, len );
|
return VirtualQueryEx( GetCurrentProcess(), addr, info, len );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* VirtualQueryEx (KERNEL32.@)
|
* VirtualQueryEx (KERNEL32.@)
|
||||||
|
*
|
||||||
* Provides info about a range of pages in virtual address space of a
|
* Provides info about a range of pages in virtual address space of a
|
||||||
* specified process
|
* specified process.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* process [I] Handle to process.
|
||||||
|
* addr [I] Address of region.
|
||||||
|
* info [O] Address of info buffer.
|
||||||
|
* len [I] Size of buffer.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Number of bytes returned in information buffer
|
* Number of bytes returned in information buffer.
|
||||||
*/
|
*/
|
||||||
SIZE_T WINAPI VirtualQueryEx(
|
SIZE_T WINAPI VirtualQueryEx( HANDLE process, LPCVOID addr,
|
||||||
HANDLE process, /* [in] Handle of process */
|
PMEMORY_BASIC_INFORMATION info, SIZE_T len )
|
||||||
LPCVOID addr, /* [in] Address of region */
|
|
||||||
PMEMORY_BASIC_INFORMATION info, /* [out] Address of info buffer */
|
|
||||||
SIZE_T len /* [in] Size of buffer */ )
|
|
||||||
{
|
{
|
||||||
SIZE_T ret;
|
SIZE_T ret;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
@ -254,20 +296,23 @@ SIZE_T WINAPI VirtualQueryEx(
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* CreateFileMappingA (KERNEL32.@)
|
* CreateFileMappingA (KERNEL32.@)
|
||||||
* Creates a named or unnamed file-mapping object for the specified file
|
*
|
||||||
|
* Creates a named or unnamed file-mapping object for the specified file.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* hFile [I] Handle to the file to map.
|
||||||
|
* sa [I] Optional security attributes.
|
||||||
|
* protect [I] Protection for mapping object.
|
||||||
|
* size_high [I] High-order 32 bits of object size.
|
||||||
|
* size_low [I] Low-order 32 bits of object size.
|
||||||
|
* name [I] Name of file-mapping object.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Handle: Success
|
* Success: Handle.
|
||||||
* 0: Mapping object does not exist
|
* Failure: NULL. Mapping object does not exist.
|
||||||
* NULL: Failure
|
|
||||||
*/
|
*/
|
||||||
HANDLE WINAPI CreateFileMappingA(
|
HANDLE WINAPI CreateFileMappingA( HANDLE hFile, SECURITY_ATTRIBUTES *sa,
|
||||||
HANDLE hFile, /* [in] Handle of file to map */
|
DWORD protect, DWORD size_high, DWORD size_low, LPCSTR name )
|
||||||
SECURITY_ATTRIBUTES *sa, /* [in] Optional security attributes*/
|
|
||||||
DWORD protect, /* [in] Protection for mapping object */
|
|
||||||
DWORD size_high, /* [in] High-order 32 bits of object size */
|
|
||||||
DWORD size_low, /* [in] Low-order 32 bits of object size */
|
|
||||||
LPCSTR name /* [in] Name of file-mapping object */ )
|
|
||||||
{
|
{
|
||||||
WCHAR buffer[MAX_PATH];
|
WCHAR buffer[MAX_PATH];
|
||||||
|
|
||||||
|
@ -284,6 +329,7 @@ HANDLE WINAPI CreateFileMappingA(
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* CreateFileMappingW (KERNEL32.@)
|
* CreateFileMappingW (KERNEL32.@)
|
||||||
|
*
|
||||||
* See CreateFileMappingA.
|
* See CreateFileMappingA.
|
||||||
*/
|
*/
|
||||||
HANDLE WINAPI CreateFileMappingW( HANDLE hFile, LPSECURITY_ATTRIBUTES sa,
|
HANDLE WINAPI CreateFileMappingW( HANDLE hFile, LPSECURITY_ATTRIBUTES sa,
|
||||||
|
@ -359,16 +405,19 @@ HANDLE WINAPI CreateFileMappingW( HANDLE hFile, LPSECURITY_ATTRIBUTES sa,
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* OpenFileMappingA (KERNEL32.@)
|
* OpenFileMappingA (KERNEL32.@)
|
||||||
|
*
|
||||||
* Opens a named file-mapping object.
|
* Opens a named file-mapping object.
|
||||||
*
|
*
|
||||||
|
* PARAMS
|
||||||
|
* access [I] Access mode.
|
||||||
|
* inherit [I] Inherit flag.
|
||||||
|
* name [I] Name of file-mapping object.
|
||||||
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Handle: Success
|
* Success: Handle.
|
||||||
* NULL: Failure
|
* Failure: NULL.
|
||||||
*/
|
*/
|
||||||
HANDLE WINAPI OpenFileMappingA(
|
HANDLE WINAPI OpenFileMappingA( DWORD access, BOOL inherit, LPCSTR name )
|
||||||
DWORD access, /* [in] Access mode */
|
|
||||||
BOOL inherit, /* [in] Inherit flag */
|
|
||||||
LPCSTR name ) /* [in] Name of file-mapping object */
|
|
||||||
{
|
{
|
||||||
WCHAR buffer[MAX_PATH];
|
WCHAR buffer[MAX_PATH];
|
||||||
|
|
||||||
|
@ -385,6 +434,7 @@ HANDLE WINAPI OpenFileMappingA(
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* OpenFileMappingW (KERNEL32.@)
|
* OpenFileMappingW (KERNEL32.@)
|
||||||
|
*
|
||||||
* See OpenFileMappingA.
|
* See OpenFileMappingA.
|
||||||
*/
|
*/
|
||||||
HANDLE WINAPI OpenFileMappingW( DWORD access, BOOL inherit, LPCWSTR name)
|
HANDLE WINAPI OpenFileMappingW( DWORD access, BOOL inherit, LPCWSTR name)
|
||||||
|
@ -420,19 +470,23 @@ HANDLE WINAPI OpenFileMappingW( DWORD access, BOOL inherit, LPCWSTR name)
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* MapViewOfFile (KERNEL32.@)
|
* MapViewOfFile (KERNEL32.@)
|
||||||
* Maps a view of a file into the address space
|
*
|
||||||
|
* Maps a view of a file into the address space.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* mapping [I] File-mapping object to map.
|
||||||
|
* access [I] Access mode.
|
||||||
|
* offset_high [I] High-order 32 bits of file offset.
|
||||||
|
* offset_low [I] Low-order 32 bits of file offset.
|
||||||
|
* count [I] Number of bytes to map.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Starting address of mapped view
|
* Success: Starting address of mapped view.
|
||||||
* NULL: Failure
|
* Failure: NULL.
|
||||||
*/
|
*/
|
||||||
LPVOID WINAPI MapViewOfFile(
|
LPVOID WINAPI MapViewOfFile( HANDLE mapping, DWORD access,
|
||||||
HANDLE mapping, /* [in] File-mapping object to map */
|
DWORD offset_high, DWORD offset_low, SIZE_T count )
|
||||||
DWORD access, /* [in] Access mode */
|
{
|
||||||
DWORD offset_high, /* [in] High-order 32 bits of file offset */
|
|
||||||
DWORD offset_low, /* [in] Low-order 32 bits of file offset */
|
|
||||||
SIZE_T count /* [in] Number of bytes to map */
|
|
||||||
) {
|
|
||||||
return MapViewOfFileEx( mapping, access, offset_high,
|
return MapViewOfFileEx( mapping, access, offset_high,
|
||||||
offset_low, count, NULL );
|
offset_low, count, NULL );
|
||||||
}
|
}
|
||||||
|
@ -440,20 +494,24 @@ LPVOID WINAPI MapViewOfFile(
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* MapViewOfFileEx (KERNEL32.@)
|
* MapViewOfFileEx (KERNEL32.@)
|
||||||
* Maps a view of a file into the address space
|
*
|
||||||
|
* Maps a view of a file into the address space.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* handle [I] File-mapping object to map.
|
||||||
|
* access [I] Access mode.
|
||||||
|
* offset_high [I] High-order 32 bits of file offset.
|
||||||
|
* offset_low [I] Low-order 32 bits of file offset.
|
||||||
|
* count [I] Number of bytes to map.
|
||||||
|
* addr [I] Suggested starting address for mapped view.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Starting address of mapped view
|
* Success: Starting address of mapped view.
|
||||||
* NULL: Failure
|
* Failure: NULL.
|
||||||
*/
|
*/
|
||||||
LPVOID WINAPI MapViewOfFileEx(
|
LPVOID WINAPI MapViewOfFileEx( HANDLE handle, DWORD access,
|
||||||
HANDLE handle, /* [in] File-mapping object to map */
|
DWORD offset_high, DWORD offset_low, SIZE_T count, LPVOID addr )
|
||||||
DWORD access, /* [in] Access mode */
|
{
|
||||||
DWORD offset_high, /* [in] High-order 32 bits of file offset */
|
|
||||||
DWORD offset_low, /* [in] Low-order 32 bits of file offset */
|
|
||||||
SIZE_T count, /* [in] Number of bytes to map */
|
|
||||||
LPVOID addr /* [in] Suggested starting address for mapped view */
|
|
||||||
) {
|
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
LARGE_INTEGER offset;
|
LARGE_INTEGER offset;
|
||||||
ULONG protect;
|
ULONG protect;
|
||||||
|
@ -478,16 +536,20 @@ LPVOID WINAPI MapViewOfFileEx(
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* UnmapViewOfFile (KERNEL32.@)
|
* UnmapViewOfFile (KERNEL32.@)
|
||||||
|
*
|
||||||
* Unmaps a mapped view of a file.
|
* Unmaps a mapped view of a file.
|
||||||
*
|
*
|
||||||
|
* PARAMS
|
||||||
|
* addr [I] Address where mapped view begins.
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* Success: TRUE.
|
||||||
|
* Failure: FALSE.
|
||||||
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* Should addr be an LPCVOID?
|
* Should addr be an LPCVOID?
|
||||||
*
|
|
||||||
* RETURNS
|
|
||||||
* TRUE: Success
|
|
||||||
* FALSE: Failure
|
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI UnmapViewOfFile( LPVOID addr ) /* [in] Address where mapped view begins */
|
BOOL WINAPI UnmapViewOfFile( LPVOID addr )
|
||||||
{
|
{
|
||||||
NTSTATUS status = NtUnmapViewOfSection( GetCurrentProcess(), addr );
|
NTSTATUS status = NtUnmapViewOfSection( GetCurrentProcess(), addr );
|
||||||
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
||||||
|
@ -497,14 +559,18 @@ BOOL WINAPI UnmapViewOfFile( LPVOID addr ) /* [in] Address where mapped view beg
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* FlushViewOfFile (KERNEL32.@)
|
* FlushViewOfFile (KERNEL32.@)
|
||||||
* Writes to the disk a byte range within a mapped view of a file
|
*
|
||||||
|
* Writes to the disk a byte range within a mapped view of a file.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* base [I] Start address of byte range to flush.
|
||||||
|
* size [I] Number of bytes in range.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* TRUE: Success
|
* Success: TRUE.
|
||||||
* FALSE: Failure
|
* Failure: FALSE.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI FlushViewOfFile( LPCVOID base, /* [in] Start address of byte range to flush */
|
BOOL WINAPI FlushViewOfFile( LPCVOID base, SIZE_T size )
|
||||||
SIZE_T size ) /* [in] Number of bytes in range */
|
|
||||||
{
|
{
|
||||||
NTSTATUS status = NtFlushVirtualMemory( GetCurrentProcess(), &base, &size, 0 );
|
NTSTATUS status = NtFlushVirtualMemory( GetCurrentProcess(), &base, &size, 0 );
|
||||||
if (status)
|
if (status)
|
||||||
|
@ -521,13 +587,14 @@ BOOL WINAPI FlushViewOfFile( LPCVOID base, /* [in] Start address of byte range
|
||||||
*
|
*
|
||||||
* Check for read access on a memory block.
|
* Check for read access on a memory block.
|
||||||
*
|
*
|
||||||
|
* ptr [I] Address of memory block.
|
||||||
|
* size [I] Size of block.
|
||||||
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* FALSE: Process has read access to entire block
|
* Success: TRUE.
|
||||||
* TRUE: Otherwise
|
* Failure: FALSE. Process has read access to entire block.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI IsBadReadPtr(
|
BOOL WINAPI IsBadReadPtr( LPCVOID ptr, UINT size )
|
||||||
LPCVOID ptr, /* [in] Address of memory block */
|
|
||||||
UINT size ) /* [in] Size of block */
|
|
||||||
{
|
{
|
||||||
if (!size) return FALSE; /* handle 0 size case w/o reference */
|
if (!size) return FALSE; /* handle 0 size case w/o reference */
|
||||||
if (!ptr) return TRUE;
|
if (!ptr) return TRUE;
|
||||||
|
@ -563,13 +630,15 @@ BOOL WINAPI IsBadReadPtr(
|
||||||
*
|
*
|
||||||
* Check for write access on a memory block.
|
* Check for write access on a memory block.
|
||||||
*
|
*
|
||||||
|
* PARAMS
|
||||||
|
* ptr [I] Address of memory block.
|
||||||
|
* size [I] Size of block in bytes.
|
||||||
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* FALSE: Process has write access to entire block
|
* Success: TRUE.
|
||||||
* TRUE: Otherwise
|
* Failure: FALSE. Process has write access to entire block.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI IsBadWritePtr(
|
BOOL WINAPI IsBadWritePtr( LPVOID ptr, UINT size )
|
||||||
LPVOID ptr, /* [in] Address of memory block */
|
|
||||||
UINT size ) /* [in] Size of block in bytes */
|
|
||||||
{
|
{
|
||||||
if (!size) return FALSE; /* handle 0 size case w/o reference */
|
if (!size) return FALSE; /* handle 0 size case w/o reference */
|
||||||
if (!ptr) return TRUE;
|
if (!ptr) return TRUE;
|
||||||
|
@ -604,14 +673,16 @@ BOOL WINAPI IsBadWritePtr(
|
||||||
*
|
*
|
||||||
* Check for read access on a memory block.
|
* Check for read access on a memory block.
|
||||||
*
|
*
|
||||||
|
* PARAMS
|
||||||
|
* ptr [I] Address of memory block.
|
||||||
|
* size [I] Size of block.
|
||||||
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* FALSE: Process has read access to entire block
|
* Success: TRUE.
|
||||||
* TRUE: Otherwise
|
* Failure: FALSE. Process has read access to entire block.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI IsBadHugeReadPtr(
|
BOOL WINAPI IsBadHugeReadPtr( LPCVOID ptr, UINT size )
|
||||||
LPCVOID ptr, /* [in] Address of memory block */
|
{
|
||||||
UINT size /* [in] Size of block */
|
|
||||||
) {
|
|
||||||
return IsBadReadPtr( ptr, size );
|
return IsBadReadPtr( ptr, size );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,14 +692,16 @@ BOOL WINAPI IsBadHugeReadPtr(
|
||||||
*
|
*
|
||||||
* Check for write access on a memory block.
|
* Check for write access on a memory block.
|
||||||
*
|
*
|
||||||
|
* PARAMS
|
||||||
|
* ptr [I] Address of memory block.
|
||||||
|
* size [I] Size of block.
|
||||||
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* FALSE: Process has write access to entire block
|
* Success: TRUE.
|
||||||
* TRUE: Otherwise
|
* Failure: FALSE. Process has write access to entire block.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI IsBadHugeWritePtr(
|
BOOL WINAPI IsBadHugeWritePtr( LPVOID ptr, UINT size )
|
||||||
LPVOID ptr, /* [in] Address of memory block */
|
{
|
||||||
UINT size /* [in] Size of block */
|
|
||||||
) {
|
|
||||||
return IsBadWritePtr( ptr, size );
|
return IsBadWritePtr( ptr, size );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -638,11 +711,14 @@ BOOL WINAPI IsBadHugeWritePtr(
|
||||||
*
|
*
|
||||||
* Check for read access on a memory address.
|
* Check for read access on a memory address.
|
||||||
*
|
*
|
||||||
|
* PARAMS
|
||||||
|
* ptr [I] Address of function.
|
||||||
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* FALSE: Process has read access to specified memory
|
* Success: TRUE.
|
||||||
* TRUE: Otherwise
|
* Failure: FALSE. Process has read access to specified memory.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI IsBadCodePtr( FARPROC ptr ) /* [in] Address of function */
|
BOOL WINAPI IsBadCodePtr( FARPROC ptr )
|
||||||
{
|
{
|
||||||
return IsBadReadPtr( ptr, 1 );
|
return IsBadReadPtr( ptr, 1 );
|
||||||
}
|
}
|
||||||
|
@ -653,13 +729,15 @@ BOOL WINAPI IsBadCodePtr( FARPROC ptr ) /* [in] Address of function */
|
||||||
*
|
*
|
||||||
* Check for read access on a range of memory pointed to by a string pointer.
|
* Check for read access on a range of memory pointed to by a string pointer.
|
||||||
*
|
*
|
||||||
|
* PARAMS
|
||||||
|
* str [I] Address of string.
|
||||||
|
* max [I] Maximum size of string.
|
||||||
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* FALSE: Read access to all bytes in string
|
* Success: TRUE.
|
||||||
* TRUE: Else
|
* Failure: FALSE. Read access to all bytes in string.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI IsBadStringPtrA(
|
BOOL WINAPI IsBadStringPtrA( LPCSTR str, UINT max )
|
||||||
LPCSTR str, /* [in] Address of string */
|
|
||||||
UINT max ) /* [in] Maximum size of string */
|
|
||||||
{
|
{
|
||||||
if (!str) return TRUE;
|
if (!str) return TRUE;
|
||||||
|
|
||||||
|
@ -680,6 +758,7 @@ BOOL WINAPI IsBadStringPtrA(
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* IsBadStringPtrW (KERNEL32.@)
|
* IsBadStringPtrW (KERNEL32.@)
|
||||||
|
*
|
||||||
* See IsBadStringPtrA.
|
* See IsBadStringPtrA.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT max )
|
BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT max )
|
||||||
|
|
Loading…
Reference in New Issue