Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

147 Neutral

About laiyierjiangsu

  • Rank

Personal Information

  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. laiyierjiangsu

    Enumoutputs do not work in Win10

    Thanks, I see.
  2. laiyierjiangsu

    Enumoutputs do not work in Win10

    Thank you very much ! I have found the reason, but I still have another doubt. bool D3D11EnumComponent::Check_DifferentDevice() { HRESULT hr = S_OK; // get supported driver types D3D_DRIVER_TYPE* pDriverTypes = nullptr; int numDriverTypes = 0; D3D_DRIVER_TYPE vecDriverTypeSupported[] = { D3D_DRIVER_TYPE_HARDWARE, D3D_DRIVER_TYPE_WARP, D3D_DRIVER_TYPE_REFERENCE }; pDriverTypes = vecDriverTypeSupported; numDriverTypes = sizeof(vecDriverTypeSupported)/sizeof(vecDriverTypeSupported[0]); int numberofFeature = 1; D3D_FEATURE_LEVEL vecFeatureLevelsSupported[] = { D3D_FEATURE_LEVEL_11_0, }; // for each type of driver, check device available. for (int iDriverTypeIndex = 0; iDriverTypeIndex < numDriverTypes; iDriverTypeIndex++) { // device creation flag UINT creationFlags = 0; #if defined(_DEBUG) creationFlags |= D3D11_CREATE_DEVICE_DEBUG; #endif ID3D11Device* pD3dDevice = NULL; ID3D11DeviceContext* pd3dDeviceContext = NULL; D3D_FEATURE_LEVEL eMaxFeatureLevel ; auto drivertype = pDriverTypes[iDriverTypeIndex]; hr = D3D11CreateDevice( drivertype == D3D_DRIVER_TYPE_UNKNOWN ? g_pAdapter : nullptr, // should be null if driver type not D3D_DRIVER_TYPE_UNKNOWN drivertype, nullptr, creationFlags, vecFeatureLevelsSupported, numberofFeature, D3D11_SDK_VERSION, &pD3dDevice, &eMaxFeatureLevel, &pd3dDeviceContext); if (FAILED(hr)) { continue; } // update adapter interface IDXGIDevice* pDXGIDev = NULL; IDXGIAdapter* pAdapter = nullptr; hr = pD3dDevice->QueryInterface(__uuidof(IDXGIDevice), (LPVOID*)&pDXGIDev); if (SUCCEEDED(hr) && pDXGIDev) { hr = pDXGIDev->GetAdapter(&pAdapter); if (!SUCCEEDED(hr)) { assert(false); } else { if(pAdapter != g_pAdapter) { // assert(false); MessageBox(nullptr,L"a",L"bbbb",MB_OK); } } } else { assert(false); } SAFE_RELEASE(pDXGIDev); } return true; g_pAdapter is the best adapter I selected from Dxfactory, and it was the first adapter enumerated by dxfactory. After I created the device, I got the adpter from the device , the two device wasn't same. I cann't figure out why . How does D3D11CreateDevice choose a adapter to using? I think there is something I do not know, Please help me!
  3. for (Foundation::UInt32 i = 0; ; i++) { hr = pAdapterInfo->pDXGIAdapter->EnumOutputs(i, &pDXGIOutput); if (SUCCEEDED(hr)) { //EnumDisplayModes(pOutputInfo) } SAFE_RELEASE(pDXGIOutput); } else { //None output will be found if (i==0) { //error("EnumOupput error i:%u, error %s", i,str); } break; } } return true; } Hi , guys! I used the upper code to get all resolutions supported by video card which will be selected by players. But the code works perfectly in win7 , but it couldn't find any output in win10, I read a lot of papers ,but can not find why. If anyone else has encountered this problem before ,please gives me some insight! Thanks a lot!
  4. Thank you , It's caused by relocation , I have some wrong knowledge of PE. Really appreciate you.
  5. hi, ApochPiQ ! If I use the code above to check exe files , it works correctly. Is there some difference between the .text section of dll and pe files, I am really confused. I have uploaded the test code. I 'll take a deep learning to find why this happened. codesectionCheck.7z
  6. Hi guys ! I want check if the code section in file(test.dll) is the same with which I loaded into process memory. Here is the code. Firstly I get the crc of code section in PE file hFile = CreateFile( szFileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if( hFile != INVALID_HANDLE_VALUE ) { FileSize=GetFileSize(hFile,&szTemp); if (FileSize == 0xFFFFFFFF) return FALSE; pBuffer = new TCHAR [FileSize]; if(ReadFile(hFile, pBuffer, FileSize, &szTemp, NULL)==NULL) return FALSE; } else { printf("I can't access file!"); return false; } pDosHeader=(PIMAGE_DOS_HEADER)pBuffer; pNtHeader=(PIMAGE_NT_HEADERS32)((DWORD)pDosHeader+pDosHeader->e_lfanew); IMAGE_FILE_HEADER *pFileHeader = &pNtHeader->FileHeader; pSecHeader=IMAGE_FIRST_SECTION(pNtHeader); for(int i = 0 ; i < pFileHeader->NumberOfSections;i++) { if((strcmp((char*)pSecHeader->Name,".text") == 0)) { break; } pSecHeader++; } BYTE* pBuffStart = (BYTE*)(pBuffer+pSecHeader->PointerToRawData); szCRC32=Crc32_ComputeBuf(pBuffStart,pSecHeader->Misc.VirtualSize); Secondly, I get the crc in memory scapce PIMAGE_DOS_HEADER pDosHeader = nullptr; PIMAGE_NT_HEADERS pNTHeader = nullptr; PIMAGE_SECTION_HEADER pSectionHeader = nullptr; DWORD ImageBase, OriginalCRC32; ImageBase = (DWORD)GetModuleHandleA(pModuleName); pDosHeader = (PIMAGE_DOS_HEADER)ImageBase; pNTHeader = (PIMAGE_NT_HEADERS32)((DWORD)pDosHeader + pDosHeader->e_lfanew); OriginalCRC32 = *((DWORD*)((DWORD)pNTHeader - 4)); printf("Original Crc read from file: %08x\n",OriginalCRC32); pSectionHeader = IMAGE_FIRST_SECTION(pNTHeader); IMAGE_FILE_HEADER* pFileHeader = &pNTHeader->FileHeader; for (int i = 0; i < pFileHeader->NumberOfSections;i++) { if((strcmp((char*)pSectionHeader->Name,".text") == 0)) { break; } pSectionHeader++; } printf("ImageCodeSectionCrc32 first section name:%s\n",pSectionHeader->Name); BYTE* pBuffStart = (BYTE*)(ImageBase + pSectionHeader->VirtualAddress); crc32 = Crc32_ComputeBuf(pBuffStart,pSectionHeader->Misc.VirtualSize); The two crc values are not match, I also can't find the original code buff of pe file in the code section of dll image. Does I make a mistake here? I sincerely hope someone can help me find out why.
  7. laiyierjiangsu

    How to get the addr of code buff in x64 platform!

    Thanks, I just use this methed to detect that if my core code is being debugging . If someone wants to hack , it's achieveable.
  8. laiyierjiangsu

    How to get the addr of code buff in x64 platform!

    Thanks , Lactose ! My English is poor,
  9. laiyierjiangsu

    How to get the addr of code buff in x64 platform!

    Why? I have pasted the code screenshot, but it didn't show. So I add the code here!
  10. As the following picture shows , I can get the code buff with asm in x86 platform. Has anyone know how to do this in x64 platform??? bool CheckCodeSnipeCrc32() { DWORD addr1, addr2, size; _asm mov addr1, offset codeBegin; _asm mov addr2, offset codeEnd; codeBegin: //OutputDebugString(L"test"); //OutputDebugString(L"test0"); //OutputDebugString(L"test1"); int a = 0; a = a + 1; a = a - 1; codeEnd: size = addr2 - addr1; DWORD curcrc32 = Crc32_ComputeBuf((void*)addr1, size); DWORD oldCrc32 = 0xbcf07446; assert(oldCrc32 == curcrc32); }
  11. Thanks ,you guys give me some inspire, I will try it.
  12. Hi, guys! My prograss crashs with a stackoverflow exception in some pcs. I changed the stacksize of thread from default(1M) to (2M) for fixing this problem. But I have got confused with some doubts. 1、Why this exception happens in some pcs not all? I think the logic is the same ,so the stack used must be identified too. 2、Why the default stack size is 1M? Just for saving the memory of process or have some other reasons? 3、Can there any tools or methods for me to find the logic where using so much stack?
  13. laiyierjiangsu

    Lullaby: Google's C++ Library for VR

    Nice project, but I just want to  know how many developers will use it.
  14. Thanks ,I will try it latter
  15. Hi ,all     Our game has some problems with memory, there are two many third party library in our game . most of them  are closed source, I have some trouble with profilering it . I am newbie for this ,I  hope I can have some insight here.     Situation:            After running a long time ,  allocing memory will be failed.     Analyzing:           Reason 1: There may be some memory leak when game running.          Reason 2:  After a long time running , there may be memory fragmentation in the memory space!     Question:         For reason 1,  I tried to hook heapalloc and heapfree , then output some log for analyzing , but if I hooked these api ,the game run very slowly, which will lead to net error happenning , the test failed;  I also try umdh in windows debugging tools,  it has help me find some leak. Is there any other way help me to find a leak in the third party library???       For reason 2, I use vmmap to see the unused space.  Is there some other way to find the code which caused these memeory fragment? Is there any suggestions for memory manangement with so many third party library in a game?
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!