本文整理汇总了C++中NtUnmapViewOfSection函数的典型用法代码示例。如果您正苦于以下问题:C++ NtUnmapViewOfSection函数的具体用法?C++ NtUnmapViewOfSection怎么用?C++ NtUnmapViewOfSection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NtUnmapViewOfSection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GRAPHICS_BUFFER_Destroy
VOID
GRAPHICS_BUFFER_Destroy(IN OUT PCONSOLE_SCREEN_BUFFER Buffer)
{
PGRAPHICS_SCREEN_BUFFER Buff = (PGRAPHICS_SCREEN_BUFFER)Buffer;
/*
* IMPORTANT !! Reinitialize the type so that we don't enter a recursive
* infinite loop when calling CONSOLE_SCREEN_BUFFER_Destroy.
*/
Buffer->Header.Type = SCREEN_BUFFER;
/*
* Uninitialize the graphics screen buffer
* in the reverse way we initialized it.
*/
NtUnmapViewOfSection(Buff->ClientProcess, Buff->ClientBitMap);
NtUnmapViewOfSection(NtCurrentProcess(), Buff->BitMap);
NtClose(Buff->hSection);
NtDuplicateObject(Buff->ClientProcess, Buff->ClientMutex,
NULL, NULL, 0, 0, DUPLICATE_CLOSE_SOURCE);
NtClose(Buff->Mutex);
ConsoleFreeHeap(Buff->BitMapInfo);
CONSOLE_SCREEN_BUFFER_Destroy(Buffer);
}
示例2: UnmapViewOfFile
/*
* @implemented
*/
BOOL
NTAPI
UnmapViewOfFile(LPCVOID lpBaseAddress)
{
NTSTATUS Status;
/* Unmap the section */
Status = NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)lpBaseAddress);
if (!NT_SUCCESS(Status))
{
/* Check if the pages were protected */
if (Status == STATUS_INVALID_PAGE_PROTECTION)
{
/* Flush the region if it was a "secure memory cache" */
if (RtlFlushSecureMemoryCache((PVOID)lpBaseAddress, 0))
{
/* Now try to unmap again */
Status = NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)lpBaseAddress);
if (NT_SUCCESS(Status)) return TRUE;
}
}
/* We failed */
BaseSetLastNTError(Status);
return FALSE;
}
/* Otherwise, return sucess */
return TRUE;
}
示例3: WepCloseServerObjects
VOID WepCloseServerObjects(
VOID
)
{
if (WeServerSharedSection)
{
NtClose(WeServerSharedSection);
WeServerSharedSection = NULL;
}
if (WeServerSharedData)
{
NtUnmapViewOfSection(NtCurrentProcess(), WeServerSharedData);
WeServerSharedData = NULL;
}
if (WeServerSharedSectionLock)
{
NtClose(WeServerSharedSectionLock);
WeServerSharedSectionLock = NULL;
}
if (WeServerSharedSectionEvent)
{
NtClose(WeServerSharedSectionEvent);
WeServerSharedSectionEvent = NULL;
}
}
示例4: FreeLibrary
/*
* @implemented
*/
BOOL WINAPI FreeLibrary(HINSTANCE hLibModule)
{
NTSTATUS Status;
PIMAGE_NT_HEADERS NtHeaders;
if (LDR_IS_DATAFILE(hLibModule))
{
// FIXME: This SEH should go inside RtlImageNtHeader instead
_SEH2_TRY
{
/* This is a LOAD_LIBRARY_AS_DATAFILE module, check if it's a valid one */
NtHeaders = RtlImageNtHeader((PVOID)((ULONG_PTR)hLibModule & ~1));
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
NtHeaders = NULL;
} _SEH2_END
if (NtHeaders)
{
/* Unmap view */
Status = NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)((ULONG_PTR)hLibModule & ~1));
/* Unload alternate resource module */
LdrUnloadAlternateResourceModule(hLibModule);
}
else
Status = STATUS_INVALID_IMAGE_FORMAT;
}
else
{
示例5: PhLoadMappedImage
NTSTATUS PhLoadMappedImage(
_In_opt_ PWSTR FileName,
_In_opt_ HANDLE FileHandle,
_In_ BOOLEAN ReadOnly,
_Out_ PPH_MAPPED_IMAGE MappedImage
)
{
NTSTATUS status;
status = PhMapViewOfEntireFile(
FileName,
FileHandle,
ReadOnly,
&MappedImage->ViewBase,
&MappedImage->Size
);
if (NT_SUCCESS(status))
{
status = PhInitializeMappedImage(
MappedImage,
MappedImage->ViewBase,
MappedImage->Size
);
if (!NT_SUCCESS(status))
{
NtUnmapViewOfSection(NtCurrentProcess(), MappedImage->ViewBase);
}
}
return status;
}
示例6: OnUnmapViewClick
static int OnUnmapViewClick(HWND hDlg)
{
TFileTestData * pData = GetDialogData(hDlg);
NTSTATUS Status;
// Get the base address where it is mapped
if(SaveDialog2(hDlg) == ERROR_SUCCESS)
{
// Unmap the view from the base address
Status = NtUnmapViewOfSection(NtCurrentProcess(), pData->pvSectionMappedView);
// Clear the base address, so the next click on "MapView" will succeed
Hex2DlgTextPtr(hDlg, IDC_BASE_ADDRESS, NULL);
pData->pvSectionMappedView = NULL;
// Clear the view size, so the next click on "MapView" will succeed
Hex2DlgTextPtr(hDlg, IDC_VIEW_SIZE, 0);
pData->cbSectViewSize = 0;
// Show the result
SetResultInfo(hDlg, Status, pData->hSection);
UpdateDialog(hDlg, pData);
}
return TRUE;
}
示例7: PhUnloadMappedImage
NTSTATUS PhUnloadMappedImage(
_Inout_ PPH_MAPPED_IMAGE MappedImage
)
{
return NtUnmapViewOfSection(
NtCurrentProcess(),
MappedImage->ViewBase
);
}
示例8: PhUnloadMappedArchive
NTSTATUS PhUnloadMappedArchive(
_Inout_ PPH_MAPPED_ARCHIVE MappedArchive
)
{
return NtUnmapViewOfSection(
NtCurrentProcess(),
MappedArchive->ViewBase
);
}
示例9: UnmapPhysicalMemory
// UnmapPhysicalMemory
// Maps a view of a section.
//
VOID UnmapPhysicalMemory( DWORD Address )
{
NTSTATUS status;
status = NtUnmapViewOfSection( (HANDLE) -1, (PVOID) Address );
if( !NT_SUCCESS(status)) {
// PrintError("Unable to unmap view", status );
}
}
示例10: exit_thread
/***********************************************************************
* exit_thread
*/
void exit_thread( int status )
{
static void *prev_teb;
shmlocal_t *shmlocal;
sigset_t sigset;
TEB *teb;
if (status) /* send the exit code to the server (0 is already the default) */
{
SERVER_START_REQ( terminate_thread )
{
req->handle = wine_server_obj_handle( GetCurrentThread() );
req->exit_code = status;
wine_server_call( req );
}
SERVER_END_REQ;
}
if (interlocked_xchg_add( &nb_threads, 0 ) <= 1)
{
LdrShutdownProcess();
exit( status );
}
LdrShutdownThread();
RtlFreeThreadActivationContextStack();
shmlocal = interlocked_xchg_ptr( &NtCurrentTeb()->Reserved5[2], NULL );
if (shmlocal) NtUnmapViewOfSection( NtCurrentProcess(), shmlocal );
pthread_sigmask( SIG_BLOCK, &server_block_set, NULL );
if ((teb = interlocked_xchg_ptr( &prev_teb, NtCurrentTeb() )))
{
struct ntdll_thread_data *thread_data = (struct ntdll_thread_data *)teb->SpareBytes1;
if (thread_data->pthread_id)
{
pthread_join( thread_data->pthread_id, NULL );
signal_free_thread( teb );
}
}
sigemptyset( &sigset );
sigaddset( &sigset, SIGQUIT );
pthread_sigmask( SIG_BLOCK, &sigset, NULL );
if (interlocked_xchg_add( &nb_threads, -1 ) <= 1) _exit( status );
close( ntdll_get_thread_data()->wait_fd[0] );
close( ntdll_get_thread_data()->wait_fd[1] );
close( ntdll_get_thread_data()->reply_fd );
close( ntdll_get_thread_data()->request_fd );
pthread_exit( UIntToPtr(status) );
}
示例11: devmem_unmap
static void devmem_unmap(DWORD addr)
{
NTSTATUS r;
r = NtUnmapViewOfSection((HANDLE) -1, (PVOID)addr);
if(!NT_SUCCESS(r))
{
logerr(0, "NtUnmapViewOfSection failed");
errno = unix_err(RtlNtStatusToDosError(r));
}
}
示例12: CloseCabinet
/*
* FUNCTION: Closes the current cabinet
* RETURNS:
* Status of operation
*/
static ULONG
CloseCabinet(VOID)
{
if (FileBuffer)
{
NtUnmapViewOfSection(NtCurrentProcess(), FileBuffer);
NtClose(FileSectionHandle);
NtClose(FileHandle);
FileBuffer = NULL;
}
return 0;
}
示例13: Process32FirstW
/*
* @implemented
*/
BOOL
WINAPI
Process32FirstW(HANDLE hSnapshot, LPPROCESSENTRY32W lppe)
{
PTH32SNAPSHOT Snapshot;
LARGE_INTEGER SOffset;
SIZE_T ViewSize;
NTSTATUS Status;
CHECK_PARAM_SIZE(lppe, sizeof(PROCESSENTRY32W));
SOffset.QuadPart = 0;
ViewSize = 0;
Snapshot = NULL;
Status = NtMapViewOfSection(hSnapshot,
NtCurrentProcess(),
(PVOID*)&Snapshot,
0,
0,
&SOffset,
&ViewSize,
ViewShare,
0,
PAGE_READWRITE);
if(NT_SUCCESS(Status))
{
BOOL Ret;
if(Snapshot->ProcessListCount > 0)
{
LPPROCESSENTRY32W Entries = (LPPROCESSENTRY32W)OffsetToPtr(Snapshot, Snapshot->ProcessListOffset);
Snapshot->ProcessListIndex = 1;
RtlCopyMemory(lppe, &Entries[0], sizeof(PROCESSENTRY32W));
Ret = TRUE;
}
else
{
SetLastError(ERROR_NO_MORE_FILES);
Ret = FALSE;
}
NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot);
return Ret;
}
BaseSetLastNTError(Status);
return FALSE;
}
示例14: Heap32ListNext
/*
* @implemented
*/
BOOL
WINAPI
Heap32ListNext(HANDLE hSnapshot, LPHEAPLIST32 lphl)
{
PTH32SNAPSHOT Snapshot;
LARGE_INTEGER SOffset;
SIZE_T ViewSize;
NTSTATUS Status;
CHECK_PARAM_SIZE(lphl, sizeof(HEAPLIST32));
SOffset.QuadPart = 0;
ViewSize = 0;
Snapshot = NULL;
Status = NtMapViewOfSection(hSnapshot,
NtCurrentProcess(),
(PVOID*)&Snapshot,
0,
0,
&SOffset,
&ViewSize,
ViewShare,
0,
PAGE_READWRITE);
if(NT_SUCCESS(Status))
{
BOOL Ret;
if(Snapshot->HeapListCount > 0 &&
Snapshot->HeapListIndex < Snapshot->HeapListCount)
{
LPHEAPLIST32 Entries = (LPHEAPLIST32)OffsetToPtr(Snapshot, Snapshot->HeapListOffset);
RtlCopyMemory(lphl, &Entries[Snapshot->HeapListIndex++], sizeof(HEAPLIST32));
Ret = TRUE;
}
else
{
SetLastError(ERROR_NO_MORE_FILES);
Ret = FALSE;
}
NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot);
return Ret;
}
BaseSetLastNTError(Status);
return FALSE;
}
示例15: UnmapViewOfFile
/*
* @implemented
*/
BOOL
NTAPI
UnmapViewOfFile(LPCVOID lpBaseAddress)
{
NTSTATUS Status;
/* Unmap the section */
Status = NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)lpBaseAddress);
if (!NT_SUCCESS(Status))
{
/* We failed */
BaseSetLastNTError(Status);
return FALSE;
}
/* Otherwise, return sucess */
return TRUE;
}