亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? vmarray.h

?? Windows via C/C++, Fifth Edition圖書源代碼
?? H
字號:
/******************************************************************************
Module:  VMArray.h
Notices: Copyright (c) 2008 Jeffrey Richter & Christophe Nasarre
******************************************************************************/


#pragma once


///////////////////////////////////////////////////////////////////////////////


// NOTE: This C++ class is not thread safe. You cannot have multiple threads
// creating and destroying objects of this class at the same time. 

// However, once created, multiple threads can access different CVMArray 
// objects simultaneously and you can have multiple threads accessing a single
// CVMArray object if you manually synchronize access to the object yourself.


///////////////////////////////////////////////////////////////////////////////


template <class TYPE>
class CVMArray {
public:
   // Reserves sparse array of elements
   CVMArray(DWORD dwReserveElements);

   // Frees sparse array of elements
   virtual ~CVMArray();

   // Allows accessing an element in the array
   operator TYPE*()             { return(m_pArray); }
   operator const TYPE*() const { return(m_pArray); }

   // Can be called for fine-tuned handling if commit fails
   LONG ExceptionFilter(PEXCEPTION_POINTERS pep, 
      BOOL bRetryUntilSuccessful = FALSE);

protected:
   // Override this to fine-tune handling of access violation
   virtual LONG OnAccessViolation(PVOID pvAddrTouched, BOOL bAttemptedRead,
      PEXCEPTION_POINTERS pep, BOOL bRetryUntilSuccessful);

private:
   static CVMArray* sm_pHead;    // Address of first object
   CVMArray* m_pNext;            // Address of next  object

   TYPE* m_pArray;               // Pointer to reserved region array
   DWORD m_cbReserve;            // Size of reserved region array (in bytes)

private:
   // Address of previous unhandled exception filter
   static PTOP_LEVEL_EXCEPTION_FILTER sm_pfnUnhandledExceptionFilterPrev;

   // Our global unhandled exception filter for instances of this class
   static LONG WINAPI UnhandledExceptionFilter(PEXCEPTION_POINTERS pep);
};


///////////////////////////////////////////////////////////////////////////////


// The head of the linked-list of objects
template <class TYPE>
CVMArray<TYPE>* CVMArray<TYPE>::sm_pHead = NULL;

// Address of previous unhandled exception filter
template <class TYPE>
PTOP_LEVEL_EXCEPTION_FILTER CVMArray<TYPE>::sm_pfnUnhandledExceptionFilterPrev;

   
///////////////////////////////////////////////////////////////////////////////


template <class TYPE>
CVMArray<TYPE>::CVMArray(DWORD dwReserveElements) {

   if (sm_pHead == NULL) {
      // Install our global unhandled exception filter when
      // creating the first instance of the class.
      sm_pfnUnhandledExceptionFilterPrev = 
         SetUnhandledExceptionFilter(UnhandledExceptionFilter);
   }

   m_pNext = sm_pHead;  // The next node was at the head
   sm_pHead = this;     // This node is now at the head

   m_cbReserve = sizeof(TYPE) * dwReserveElements;

   // Reserve a region for the entire array
   m_pArray = (TYPE*) VirtualAlloc(NULL, m_cbReserve, 
      MEM_RESERVE | MEM_TOP_DOWN, PAGE_READWRITE);
   chASSERT(m_pArray != NULL);
}


///////////////////////////////////////////////////////////////////////////////


template <class TYPE>
CVMArray<TYPE>::~CVMArray() {

   // Free the array's region (decommitting all storage within it)
   VirtualFree(m_pArray, 0, MEM_RELEASE);

   // Remove this object from the linked list
   CVMArray* p = sm_pHead; 
   if (p == this) {     // Removing the head node
      sm_pHead = p->m_pNext; 
   } else {

      BOOL bFound = FALSE;

      // Walk list from head and fix pointers
      for (; !bFound && (p->m_pNext != NULL); p = p->m_pNext) {
         if (p->m_pNext == this) { 
            // Make the node that points to us point to the next node
            p->m_pNext = p->m_pNext->m_pNext; 
            break; 
         }
      }
      chASSERT(bFound);
   }
}


///////////////////////////////////////////////////////////////////////////////


// Default handling of access violations attempts to commit storage
template <class TYPE>
LONG CVMArray<TYPE>::OnAccessViolation(PVOID pvAddrTouched, 
   BOOL bAttemptedRead, PEXCEPTION_POINTERS pep, BOOL bRetryUntilSuccessful) {

   BOOL bCommittedStorage = FALSE;  // Assume committing storage fails

   do {
      // Attempt to commit storage
      bCommittedStorage = (NULL != VirtualAlloc(pvAddrTouched, 
         sizeof(TYPE), MEM_COMMIT, PAGE_READWRITE));

      // If storage could not be committed and we're supposed to keep trying
      // until we succeed, prompt user to free storage
      if (!bCommittedStorage && bRetryUntilSuccessful) {
         MessageBox(NULL, 
            TEXT("Please close some other applications and Press OK."), 
            TEXT("Insufficient Memory Available"), MB_ICONWARNING | MB_OK);
      }
   } while (!bCommittedStorage && bRetryUntilSuccessful);

   // If storage committed, try again. If not, execute the handler
   return(bCommittedStorage 
      ? EXCEPTION_CONTINUE_EXECUTION : EXCEPTION_EXECUTE_HANDLER);
}


///////////////////////////////////////////////////////////////////////////////


// The filter associated with a single CVMArray object
template <class TYPE>
LONG CVMArray<TYPE>::ExceptionFilter(PEXCEPTION_POINTERS pep, 
   BOOL bRetryUntilSuccessful) {

   // Default to trying another filter (safest thing to do)
   LONG lDisposition = EXCEPTION_CONTINUE_SEARCH;

   // We only fix access violations
   if (pep->ExceptionRecord->ExceptionCode != EXCEPTION_ACCESS_VIOLATION)
      return(lDisposition);

   // Get address of attempted access and get attempted read or write
   PVOID pvAddrTouched = (PVOID) pep->ExceptionRecord->ExceptionInformation[1];
   BOOL bAttemptedRead = (pep->ExceptionRecord->ExceptionInformation[0] == 0);

   // Is attempted access within this VMArray's reserved region?
   if ((m_pArray <= pvAddrTouched) && 
       (pvAddrTouched < ((PBYTE) m_pArray + m_cbReserve))) {

      // Access is in this array; try to fix the problem
      lDisposition = OnAccessViolation(pvAddrTouched, bAttemptedRead, 
         pep, bRetryUntilSuccessful);
   }

   return(lDisposition);
}


///////////////////////////////////////////////////////////////////////////////


// The filter associated with all CVMArray objects
template <class TYPE>
LONG WINAPI CVMArray<TYPE>::UnhandledExceptionFilter(PEXCEPTION_POINTERS pep) {

   // Default to trying another filter (safest thing to do)
   LONG lDisposition = EXCEPTION_CONTINUE_SEARCH;

   // We only fix access violations
   if (pep->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION) {

      // Walk all the nodes in the linked-list
      for (CVMArray* p = sm_pHead; p != NULL; p = p->m_pNext) {

         // Ask this node if it can fix the problem.
         // NOTE: The problem MUST be fixed or the process will be terminated!
         lDisposition = p->ExceptionFilter(pep, TRUE);

         // If we found the node and it fixed the problem, stop the loop
         if (lDisposition != EXCEPTION_CONTINUE_SEARCH)
            break;
      }
   }

   // If no node fixed the problem, try the previous exception filter
   if (lDisposition == EXCEPTION_CONTINUE_SEARCH)
      lDisposition = sm_pfnUnhandledExceptionFilterPrev(pep);

   return(lDisposition);
}


//////////////////////////////// End of File //////////////////////////////////

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产制服丝袜高跟| 日韩成人伦理电影在线观看| 久久久精品中文字幕麻豆发布| 欧美一区二区久久久| 欧美高清激情brazzers| 欧美电影影音先锋| 欧美一区二区三区在线观看 | 欧美日韩一区二区三区四区五区 | 91亚洲精华国产精华精华液| av亚洲精华国产精华| 91欧美激情一区二区三区成人| 99国产欧美另类久久久精品| 91香蕉国产在线观看软件| 色综合久久久久网| 欧美性猛交一区二区三区精品| 欧美体内she精视频| 亚洲免费在线视频| 亚洲激情六月丁香| 同产精品九九九| 蜜臀av亚洲一区中文字幕| 久久se精品一区精品二区| 国产在线观看一区二区| 成人黄色av电影| 欧美性色欧美a在线播放| 7777女厕盗摄久久久| 欧美mv和日韩mv国产网站| 国产日韩欧美精品一区| 亚洲免费在线播放| 美腿丝袜一区二区三区| 国产精品一二三四| 色丁香久综合在线久综合在线观看 | 国产日韩av一区| 日韩理论在线观看| 日韩av一区二区在线影视| 国产在线精品一区二区三区不卡| 粉嫩av一区二区三区粉嫩| 色综合视频一区二区三区高清| 欧美另类videos死尸| 久久久精品蜜桃| 亚洲自拍偷拍九九九| 久久精品国产久精国产| 成人av高清在线| 91精品国产91久久久久久最新毛片| 久久久久久久久久久久电影| 综合婷婷亚洲小说| 免费视频一区二区| 99国内精品久久| 精品剧情在线观看| 亚洲天堂中文字幕| 国产在线精品一区二区三区不卡| 99re8在线精品视频免费播放| 欧美丰满少妇xxxxx高潮对白 | 日韩国产一区二| 菠萝蜜视频在线观看一区| 欧美精品一二三| 亚洲欧洲精品一区二区三区 | 国产精品69久久久久水密桃| 在线视频综合导航| 久久老女人爱爱| 亚洲线精品一区二区三区| 国产麻豆欧美日韩一区| 欧美日韩三级一区| 国产精品传媒视频| 久久国产精品色婷婷| 欧洲亚洲国产日韩| 国产精品国模大尺度视频| 久久精品久久综合| 欧美性xxxxxxxx| 国产精品网站一区| 狠狠色狠狠色综合| 欧美日韩国产在线观看| 亚洲色图20p| 丁香桃色午夜亚洲一区二区三区| 亚洲成人免费视| 国产suv精品一区二区883| 日韩精品综合一本久道在线视频| 一区二区三区欧美久久| 99免费精品视频| 国产欧美一区二区精品性| 日本欧美一区二区三区乱码| 在线视频观看一区| 亚洲免费观看高清完整版在线观看 | 蜜臀av性久久久久蜜臀aⅴ四虎 | 欧美精品亚洲二区| 亚洲第一久久影院| 色综合久久久久综合| 国产精品电影院| 高清shemale亚洲人妖| 日韩精品一区二区三区视频在线观看| 亚洲一区二区在线免费看| 一本久道久久综合中文字幕| 国产精品久久久久影院色老大| 国产精品综合一区二区三区| 日韩精品一区二区三区视频播放| 爽好多水快深点欧美视频| 欧美优质美女网站| 一区二区三区国产精华| 欧美在线影院一区二区| 亚洲精品网站在线观看| 91视频xxxx| 亚洲精品视频在线看| 色欧美片视频在线观看| 亚洲人成小说网站色在线| 一本一道久久a久久精品| 亚洲欧美一区二区三区久本道91| 99国内精品久久| 亚洲黄色尤物视频| 欧美色倩网站大全免费| 亚洲午夜免费电影| 欧美久久一二三四区| 日本最新不卡在线| 欧美成va人片在线观看| 国产在线不卡一区| 国产精品乱码人人做人人爱 | 欧美性色黄大片| 丝瓜av网站精品一区二区| 日韩免费高清av| 国产精品亚洲视频| 国产精品久久久久久久第一福利 | 成人性视频免费网站| 亚洲欧洲精品一区二区三区 | 中文字幕 久热精品 视频在线 | 亚洲激情在线播放| 欧美精品高清视频| 国产在线视频不卡二| 国产精品国产自产拍在线| 在线亚洲精品福利网址导航| 亚洲成人免费看| 久久这里只有精品视频网| 成人美女在线观看| 亚洲伊人色欲综合网| 日韩一区二区三区视频在线| 国产黄色精品视频| 亚洲精品老司机| 日韩欧美成人一区二区| 国产91露脸合集magnet| 亚洲精品国产无天堂网2021| 欧美二区乱c少妇| 国产精品18久久久久久vr| 亚洲桃色在线一区| 欧美一区日韩一区| 成人网页在线观看| 天堂久久久久va久久久久| 国产校园另类小说区| 欧美色视频在线观看| 国产精品一区二区你懂的| 亚洲免费成人av| 精品国产凹凸成av人网站| 99re视频这里只有精品| 欧美aaa在线| 亚洲女子a中天字幕| 日韩欧美国产麻豆| 91黄色激情网站| 久久精品国产999大香线蕉| 中文字幕日韩欧美一区二区三区| 这里只有精品视频在线观看| 成人h精品动漫一区二区三区| 日日嗨av一区二区三区四区| 国产精品欧美综合在线| 日韩一区二区在线免费观看| 91视频在线观看免费| 久久精品国产色蜜蜜麻豆| 亚洲精品成人少妇| 欧美激情综合五月色丁香| 日韩欧美精品在线| 色视频欧美一区二区三区| 国产毛片精品视频| 日韩精品一二区| 亚洲欧美日韩在线| 国产精品色在线观看| 欧美大片免费久久精品三p| 在线观看不卡一区| bt7086福利一区国产| 久久99国产精品免费网站| 亚洲一二三四在线观看| 中文字幕一区三区| 久久久精品蜜桃| 日韩精品在线一区| 欧美日韩国产小视频在线观看| 成人国产精品免费网站| 国产一区二区伦理片| 午夜电影一区二区| 亚洲最大成人网4388xx| 国产精品美女一区二区| 久久久久久97三级| 精品福利一区二区三区| 91.麻豆视频| 欧美日韩免费观看一区三区| 91老司机福利 在线| 成人黄色软件下载| 大胆欧美人体老妇| 风流少妇一区二区| 国产激情一区二区三区四区| 精品一区二区三区在线播放| 日韩精品一二三四| 青草av.久久免费一区| 日韩经典中文字幕一区| 亚洲成人手机在线| 首页欧美精品中文字幕| 婷婷国产v国产偷v亚洲高清|