• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetMem函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetMem函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMem函数的具体用法?C++ GetMem怎么用?C++ GetMem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetMem函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: NGCUnFreezeBlock

/****************************************************************************
 * NGCUnFreezeBlock
 ***************************************************************************/
int
NGCUnFreezeBlock (char *name, uint8 * block, int size)
{
	char buffer[20], *e;
	int len = 0;
	int rem = 0;

	GetMem (buffer, 11);

	if (strncmp (buffer, name, 3) != 0 || buffer[3] != ':' ||
	buffer[10] != ':' || (len = strtol (&buffer[4], &e, 10)) == 0 ||
	e != buffer + 10)
	{
		bufoffset -= 11; // go back to where we started
		return WRONG_FORMAT;
	}

	if (len > size)
	{
		rem = len - size;
		len = size;
	}

	ZeroMemory (block, size);

	GetMem ((char *) block, len);

	if (rem)
	{
		bufoffset += rem;
	}

	return SUCCESS;
}
开发者ID:feraligatr,项目名称:snes9xgx,代码行数:37,代码来源:freeze.cpp


示例2: return

static void *amgmalloc (size_t n)
{
        #ifndef DYNAMIC_MEMORY_ALLOCMODEL
  return(GetMem(MGHEAP(amgMG),n,FROM_BOTTOM));
        #else
  return(GetMem(MGHEAP(amgMG),n,FROM_TOP));
        #endif
}
开发者ID:rolk,项目名称:ug,代码行数:8,代码来源:amg_ug.c


示例3: main

int main() {
  printf("Enter number of nodes: ");
  scanf("%d", &N);
  if (N < 3)
    return 0;

  GetMem(N);

  //    printf("Enter left edge: ");
  //    scanf("%e", &a);
  //    printf("Enter right edge: ");
  //    scanf("%e", &b);
  a = -1.0;
  b = 1.0;
  if (a >= b)
    return 0;

  Interpolate(N);

  printf("Retcode: %d", DrawWindow(DrawWindowContent, KeyPressFunction));
  delete x;
  delete fv;
  delete d;
  delete w;
  return 0;
}
开发者ID:tokar1,项目名称:mech-math,代码行数:26,代码来源:test.cpp


示例4: PRINTF

int cN2Prov0501::ProcessBx(unsigned char *data, int len, int pos)
{
  if(data[pos-1]!=0xBC) {
    PRINTF(L_SYS_EMU,"%04X: bad nano %02X for ROM 120",id,data[pos-1]);
    return -1;
    }
  if(pos!=(0x93-0x80)) { // maybe exploitable
    PRINTF(L_SYS_EMU,"%04X: refuse to execute from %04x",id,0x80+pos);
    return -1;
    }
  if(Init(id,120)) {
    SetMem(0x80,data,len);
    SetPc(0x80+pos);
    SetSp(0x0FFF,0x0FE0);
    Set(0x0001,0xFF);
    Set(0x000E,0xFF);
    Set(0x0000,0x04);
    ClearBreakpoints();
    AddBreakpoint(0x821f);
    AddBreakpoint(0x0000);
    AddRomCallbacks();
    while(!Run(hasMaprom ? 20000:5000)) {
      if(GetPc()==0x821f) {
        GetMem(0x80,data,len);
        return a;
        }
      else if(GetPc()==0x0000) break;
      else if(!RomCallbacks()) break;
      }
    }
  return -1;
}
开发者ID:3PO,项目名称:vdr-plugin-sc,代码行数:32,代码来源:nagra2-0501.c


示例5:

bool MemoryBlockLE::Read128(const u64 addr, u128* value)
{
	if(!IsMyAddress(addr)) return false;

	*value = *(u128*)GetMem(FixAddr(addr));
	return true;
}
开发者ID:TheGeekAndrew,项目名称:rpcs3,代码行数:7,代码来源:Memory.cpp


示例6: NewListCDSByLevel

/**
 * Create new list by level
 */
PLISTCDSBYLEVEL NewListCDSByLevel(PLISTCDSBYLEVEL plcdsbylevel) {
	plcdsbylevel = (PLISTCDSBYLEVEL) GetMem(1, sizeof(LISTCDSBYLEVEL), "NewListCDSByLevel");
	plcdsbylevel->pFirstLCDS = NULL;
	plcdsbylevel->NElem = 0;
	plcdsbylevel->MaxNElem = 0;
	return plcdsbylevel;
}
开发者ID:josmanual,项目名称:DivSRegOnGrid,代码行数:10,代码来源:listCDSimplexByLevel.c


示例7: re

__forceinline void MemoryBlock::FastWrite<u128>(const u64 addr, const u128 value)
{
	u128 res;
	res.lo = re(value.hi);
	res.hi = re(value.lo);
	*(u128*)GetMem(addr) = res;
}
开发者ID:TheGeekAndrew,项目名称:rpcs3,代码行数:7,代码来源:Memory.cpp


示例8: memcpy

bool MemoryBlock::SetMemFromAddr(void* src, const u64 addr, const u32 size)
{
    if(!IsMyAddress(addr) || FixAddr(addr) + size > GetSize()) return false;

    memcpy(GetMem(FixAddr(addr)), src, size);

    return true;
}
开发者ID:sireq,项目名称:rpcs3,代码行数:8,代码来源:Memory.cpp


示例9: switch

unsigned int Cpu::GetData(unsigned char Addressing, unsigned int Argument)
{
	switch(Addressing)
	{
	case 0:
		return GetReg(Argument);
	case 1:
		return GetMem(GetReg(Argument));
	case 2:
		return Argument;
	case 3:
		return GetMem(Argument);
	default:
		CoreCrash("Unknow addressing: %d", Addressing);
		return 0;
	}
}
开发者ID:RonxBulld,项目名称:anvm,代码行数:17,代码来源:Cpu.cpp


示例10: GetMem

bool MemoryBlock::GetMemFFromAddr(void* dst, const u64 addr)
{
    if(!IsMyAddress(addr)) return false;

    dst = GetMem(FixAddr(addr));

    return true;
}
开发者ID:sireq,项目名称:rpcs3,代码行数:8,代码来源:Memory.cpp


示例11: Interpolate

void Interpolate(int n) {
  FreeMem();
  GetMem(n);

  GetMaxMin();
  GetNodesAndValues(n);
  GetWeights(n);
}
开发者ID:tokar1,项目名称:mech-math,代码行数:8,代码来源:test.cpp


示例12: NewLCDSNodeByLevel

/**
 * New node by level
 */
PLCDSNODEBYLEVEL NewLCDSNodeByLevel(PLISTCDS plcds) {
	PLCDSNODEBYLEVEL plcsnbylevel;

	plcsnbylevel = (PLCDSNODEBYLEVEL) GetMem((SIZE) 1, (SIZE) sizeof(LCDSNODEBYLEVEL), "NewLCDSNodeByLevel");
	plcsnbylevel->plcds = plcds;
	plcsnbylevel->level = -1;
	plcsnbylevel->pnext = NULL;

	return plcsnbylevel;
}
开发者ID:josmanual,项目名称:DivSRegOnGrid,代码行数:13,代码来源:listCDSimplexByLevel.c


示例13: offsetStringToInt

int offsetStringToInt(unsigned int type, const char* offsetBuffer)
{
	int offset = -1;

	if (sscanf(offsetBuffer,"%4X",&offset) == EOF)
	{
		return -1;
	}

	if (type & BT_P)
	{
		return offset & 0x3FFF;
	}
	else if (type & BT_S)
	{
		return offset & 0x00FF;
	}
	else // BT_C
	{
		if (GameInfo->type == GIT_NSF) { //NSF Breakpoint keywords
			if (strcmp(offsetBuffer,"LOAD") == 0) return (NSFHeader.LoadAddressLow | (NSFHeader.LoadAddressHigh<<8));
			if (strcmp(offsetBuffer,"INIT") == 0) return (NSFHeader.InitAddressLow | (NSFHeader.InitAddressHigh<<8));
			if (strcmp(offsetBuffer,"PLAY") == 0) return (NSFHeader.PlayAddressLow | (NSFHeader.PlayAddressHigh<<8));
		}
		else if (GameInfo->type == GIT_FDS) { //FDS Breakpoint keywords
			if (strcmp(offsetBuffer,"NMI1") == 0) return (GetMem(0xDFF6) | (GetMem(0xDFF7)<<8));
			if (strcmp(offsetBuffer,"NMI2") == 0) return (GetMem(0xDFF8) | (GetMem(0xDFF9)<<8));
			if (strcmp(offsetBuffer,"NMI3") == 0) return (GetMem(0xDFFA) | (GetMem(0xDFFB)<<8));
			if (strcmp(offsetBuffer,"RST") == 0) return (GetMem(0xDFFC) | (GetMem(0xDFFD)<<8));
			if ((strcmp(offsetBuffer,"IRQ") == 0) || (strcmp(offsetBuffer,"BRK") == 0)) return (GetMem(0xDFFE) | (GetMem(0xDFFF)<<8));
		}
		else { //NES Breakpoint keywords
			if ((strcmp(offsetBuffer,"NMI") == 0) || (strcmp(offsetBuffer,"VBL") == 0)) return (GetMem(0xFFFA) | (GetMem(0xFFFB)<<8));
			if (strcmp(offsetBuffer,"RST") == 0) return (GetMem(0xFFFC) | (GetMem(0xFFFD)<<8));
			if ((strcmp(offsetBuffer,"IRQ") == 0) || (strcmp(offsetBuffer,"BRK") == 0)) return (GetMem(0xFFFE) | (GetMem(0xFFFF)<<8));
		}
	}

	return offset;
}
开发者ID:dmitrysmagin,项目名称:fceu320-rzx50,代码行数:40,代码来源:debug.cpp


示例14: sizeof

    void* Context::Allocate(std::size_t sz)
    {
    	struct TaggedObj* obj;

    	if (POOL && sz < 8192)
    	{
    		std::vector<void*>& poolForSize = pools[sz];
    		if (poolForSize.size() > 0)
    		{
    			obj = reinterpret_cast<struct TaggedObj*>(poolForSize.back());
    			poolForSize.pop_back();
    		}
    		else
    			obj = reinterpret_cast<struct TaggedObj*>(GetMem(sz + sizeof(Context*)));
    	}
    	else
    		obj = reinterpret_cast<struct TaggedObj*>(GetMem(sz + sizeof(Context*)));


		obj->context = this;
		return &(obj->body);
    }
开发者ID:tosca-lang,项目名称:tosca,代码行数:22,代码来源:ts.cpp


示例15: AddProtectedProcess

VOID AddProtectedProcess(HANDLE ParentProcessId, HANDLE ProcessId) {
	PPROTECTED_PROCESS CurrentProcess = ProtectedProcess;

	// Если список ещё пуст:
	if (ProtectedProcess == NULL) {
		CurrentProcess = GetMem(sizeof(PROTECTED_PROCESS));
		FillProtectionStruct(CurrentProcess, ParentProcessId, ProcessId);
		ProtectedProcess = CurrentProcess;
		return;
	}

	// Ищем последний элемент в списке:
	while (CurrentProcess->NextEntry != NULL) {
		if (CurrentProcess->ProcessID == ProcessId) return;
		CurrentProcess = CurrentProcess->NextEntry;
	}

	if (CurrentProcess->ProcessID == ProcessId) return;

	CurrentProcess->NextEntry = GetMem(sizeof(PROTECTED_PROCESS));
	FillProtectionStruct(CurrentProcess->NextEntry, ParentProcessId, ProcessId);
}
开发者ID:tetratec,项目名称:EnjoyTheRing0,代码行数:22,代码来源:Protection.c


示例16: Lock

void CMyList::PushHead(void *tagData)
{
    Lock();
    MYLIST_NODE *pNewNode = (MYLIST_NODE *) GetMem(sizeof(MYLIST_NODE));
    pNewNode->pData = tagData;
    pNewNode->pNext = m_MyListHead;
    if (m_MyListHead == NULL)
    {
        m_MyListTail = pNewNode;
    }
    m_MyListHead = pNewNode;
    m_NodeCount++;
    UnLock();
}
开发者ID:vagabond1132,项目名称:Code,代码行数:14,代码来源:mylist.cpp


示例17: GetKeyValue

NTSTATUS GetKeyValue(HANDLE hKey, LPWSTR ValueName, PVOID OutputBuffer, ULONG BufferSize, OUT OPTIONAL PULONG BytesReturned) {
	if (BytesReturned != NULL) *BytesReturned = 0;
	
	UNICODE_STRING UnicodeValueName;
	RtlInitUnicodeString(&UnicodeValueName, ValueName);
	
	ULONG PartialInformationSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + BufferSize - 1;
	PKEY_VALUE_PARTIAL_INFORMATION PartialInformation = GetMem(PartialInformationSize);
	
	ULONG ResultLength = 0;
	NTSTATUS Status = ZwQueryValueKey(hKey, &UnicodeValueName, KeyValuePartialInformation, PartialInformation, PartialInformationSize, &ResultLength);
	
	if NT_SUCCESS(Status) {
		RtlCopyMemory(OutputBuffer, PartialInformation->Data, PartialInformation->DataLength);
		if (BytesReturned != NULL) *BytesReturned = PartialInformation->DataLength;
	} else if ((BytesReturned != NULL) && ((Status == STATUS_BUFFER_OVERFLOW) || (Status == STATUS_BUFFER_TOO_SMALL))) {
开发者ID:MrTrojan,项目名称:EnjoyTheRing0,代码行数:16,代码来源:RegistryUtils.c


示例18: handleDump

void handleDump(char* start, char* end) {
    int s = strtol(start, NULL, 16);
    int e = strtol(end, NULL, 16);
    bool ok = true;
    if(s > e){
        printf("Error, start address is larger than end address\n");
        ok = false;
    }
    if(e > 32767){
        printf("Error: end address out of range 0x0 - 0x7FFF\n");
        ok = false;
    }
    if(s < 0){
        printf("Error: start address is negative");
        ok = false;
    }
    if (ok) {
        printf("dumping from 0x%X to 0x%X\n", s, e);
        int i = 0;
        int temp = 0;
        printf("          +0 +1 +2 +3 +4 +5 +6 +7    +8 +9 +A +B +C +D +E +F\n");
        while (i < s % 16) {
            if(i == 0) printf("0x%06X: ", s);
            printf("-- ");
            if(i == 7) printf("|| ");
            i++;
        }
        if(s % 16 == 0) printf("0x%06X: ", s);
        while (s <= e) {
            GetMem(s, &temp, 0);
            printf("%2X ", temp);
            temp = s%16;
            if(temp == 7) printf("|| ");
            if(temp == 15 && s < e) printf("\n0x%06X: ", s);
            s++;
        }
        i = 0;
        temp = e%16;
        while(i + temp < 15){
            printf("-- ");
            if(i + temp == 6) printf("|| ");
            i++;
        }
        printf("\n");
    }
}// </editor-fold>
开发者ID:Brandon-Barajas,项目名称:CMPE-Phase4,代码行数:46,代码来源:Command.c


示例19: SetSp

int cN2Prov0501::RunEmu(unsigned char *data, int len, unsigned short load, unsigned short run, unsigned short stop, unsigned short fetch, int fetch_len)
{
  if(Init(id,120)) {
    SetSp(0x0FFF,0x0EF8);
    SetMem(load,data,len);
    SetPc(run);
    ClearBreakpoints();
    AddBreakpoint(stop);
    if(stop!=0x0000) AddBreakpoint(0x0000);
    AddRomCallbacks();
    while(!Run(100000)) {
      if(GetPc()==0x0000 || GetPc()==stop) {
        GetMem(fetch,data,fetch_len);
        return 1;
        }
      else if(!RomCallbacks()) break;
      }
    }
  return -1;
}
开发者ID:3PO,项目名称:vdr-plugin-sc,代码行数:20,代码来源:nagra2-0501.c


示例20: GetSharedData

PSHARED_DISP_DATA GetSharedData()
{
	PSHARED_DISP_DATA* pData = (PSHARED_DISP_DATA*)GetMem();

	if (!*pData)
	{
		KdPrint(("Shared data not allocated, creating\n"));

		*pData = (PSHARED_DISP_DATA) ExAllocatePool (NonPagedPool, sizeof(SHARED_DISP_DATA));

		if (!*pData)
		{
			KdPrint (("ExAllocatePool failed\n"));
			return NULL;
		}

		memset (*pData, 0, sizeof(SHARED_DISP_DATA));

		(*pData)->Signature = SHARED_SIGNATURE;
	}

	return *pData;
}
开发者ID:340211173,项目名称:hf-2011,代码行数:23,代码来源:ngdbg.cpp



注:本文中的GetMem函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetMember函数代码示例发布时间:2022-05-30
下一篇:
C++ GetMaxY函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap