RTX – расширение реального времени для Windows NT

Allocate.shtml


#include <windows.h>

#include <stdio.h>

#include <rtapi.h>

static PVOID vAddress;  // virtual memory address returned by RtAllocateLockedMemory void main(void) { // Allocate memory vAddress = RtAllocateLockedMemory(size); if (!vAddress) { printf("\nFailure on RtAllocateLockedMemory\t"); printf("Error=%d\n", GetLastError()); break; // if this fails - no use to continue } else { printf("\nSuccess on RtAllocateLockedMemory\n"); printf("Virtual memory address = 0x%08X\n", vAddress); // Write to the memory *vAddress= 0; } // Free memory if (!RtFreeLockedMemory(vAddress)) { printf("\nFailure on RtFreeLockedMemory(0x%08X).\t", vAddress); printf("Error Code = %d\n", GetLastError()); } else { printf("Success on RtFreeLockedMemory(0x%X).\n", vAddress); }  ExitProcess(0); }



Содержание раздела