1. Список говнокодов пользователя zhukas

    Всего: 10

  2. Си / Говнокод #17313

    +140

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    HIMAGELIST ImageList_LoadImageV(PVOID ImageBase, PCWSTR a[], int level)
    {
    	PIMAGE_RESOURCE_DATA_ENTRY pirde;
    	PBITMAPINFOHEADER pbih;
    	DWORD cx, cy, cb, n, ofs;
    	if (
    		0 <= LdrFindResource_U(ImageBase, a, level, &pirde) && 
    		0 <= LdrAccessResource(ImageBase, pirde, (void**)&pbih, &cb) &&
    		cb > sizeof(BITMAPINFOHEADER) &&
    		pbih->biSize >= sizeof(BITMAPINFOHEADER) &&
    		(cx = pbih->biWidth) <= (cy = pbih->biHeight) &&
    		!(cy % cx) &&
    		pbih->biBitCount == 32 &&
    		(ofs = pbih->biSize) + (cx * cy << 2) == cb
    		)
    	{
    		n = cy / cx, cb = cx * cx << 2;
    
    		if (HIMAGELIST himl = ImageList_Create(cx, cy, ILC_COLOR32, n, 0))
    		{
    			BITMAPINFO bi = { {sizeof(BITMAPINFOHEADER), cx, cx, 1, 32 } };
    
    			if (HDC hdc = GetDC(0))
    			{
    				if (HBITMAP hbmp = CreateCompatibleBitmap(hdc, cx, cx))
    				{
    					do ; while (
    						SetDIBits(hdc, hbmp, 0, cx, RtlOffsetToPointer(pbih, ofs), &bi, DIB_RGB_COLORS) &&
    						0 <= ImageList_Add(himl, hbmp, 0) &&
    						(ofs += cb, --n)
    						);
    
    					DeleteObject(hbmp);
    				}
    
    				ReleaseDC(0, hdc);
    			}
    
    			if (!n) return himl;
    
    			ImageList_Destroy(himl);
    		}
    	}
    
    	return 0;
    }

    zhukas, 14 Декабря 2014

    Комментарии (26)
  3. C++ / Говнокод #17214

    +51

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    PVOID ZDbgDoc::getVaByName(PCSTR name)
    {
    	PLIST_ENTRY head = &_dllListHead, entry = head;
    
    	while ((entry = entry->Flink) != head)
    	{
    		ZDll* pDll = static_cast<ZDll*>(entry);
    
    		if (PWSTR ImageName = pDll->_ImageName)
    		{
    			PCSTR sz = name;
    __loop:
    			int c = tolower(*sz++);
    
    			if (!c || c != towlower(*ImageName++))
    			{
    				continue;
    			}
    
    			if (c != '.')
    			{
    				goto __loop;
    			}
    
    			pDll->Parse(this);
    
    			return pDll->getVaByName(sz, this);
    		}
    	}
    
    	return 0;
    }

    zhukas, 29 Ноября 2014

    Комментарии (3)
  4. C++ / Говнокод #17207

    +53

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    BOOL IsNameInExpression(PCWSTR Expression, PCWSTR Name, DWORD len)
    {
    	WCHAR c, b;
    
    	while (c = *Expression++) 
    	{
    		if (c == L'*') 
    		{
    __loop:
    			switch (*Expression)
    			{
    			case '*':
    				Expression++;
    				goto __loop;
    			case 0:
    				return TRUE;
    			}
    
    			if (len)
    			{
    				do 
    				{
    					if (IsNameInExpression(Expression, Name++, len--)) return TRUE;
    				} while (len);
    			}
    
    			return FALSE;
    		}
    
    		if (!len--)
    		{
    			return FALSE;
    		}
    
    		b = *Name++;
    
    		if (c != L'?' && b != c) 
    		{
    			return FALSE;
    		} 
    	}
    
    	return !len;
    }
    
    BOOL IsNameInExpression(PCWSTR Expression, PUNICODE_STRING Name)
    {
    	RtlUpcaseUnicodeString(Name, Name, FALSE);
    	return IsNameInExpression(Expression, Name->Buffer, Name->Length >> 1);
    }

    zhukas, 28 Ноября 2014

    Комментарии (4)
  5. C++ / Говнокод #17194

    +50

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    size_t __stdcall ZAsmView::addrSet(DIS const *pDis, unsigned __int64 Va, wchar_t * buf, size_t cb, unsigned __int64 * displacement)
    {
    	FORMATDATA* pf = (FORMATDATA*)pDis->PvClient();
    	size_t fixupLen = pf->fixupLen;
    	pf->fixupLen = 0;
    	*displacement = 0;
    	BOOL f = TRUE;
    	PVOID _Va = (PVOID)Va;
    	ZDbgDoc* pDoc = pf->pDoc;
    	
    __loop:
    	if (PCSTR Name = pDoc->getNameByVa((PVOID)Va))
    	{
    		char cc[256];
    		PCSTR fName = unDNameEx(cc, Name, sizeof(cc), UNDNAME_NAME_ONLY);
    		int len = _snwprintf(buf, cb, L"%S(%p)", fName, Va);
    		if (len < 0)
    		{
    			buf[len = (DWORD)cb - 1] = 0;
    		}
    		else
    		{
    			buf[0] |= 0x4000, buf[len - 3 - 2*sizeof(PVOID)] |= 0x8000;
    		}
    		return len;
    	}
    
    	if (f && 2*sizeof(PVOID)+2<cb)
    	{
    		switch (pDis->Trmta())
    		{
    		case DIS::a_jmp_u_2:
    		case DIS::a_jmp_u_5:
    		case DIS::a_jmp_c_2:
    		case DIS::a_jmp_c_6:
    			_snwprintf(buf, cb, L"%p %c", (PVOID)Va, Va > pf->pLI->Va ? 0x2193 : 0x2191);
    			buf[0] |= 0x4000, buf[2*sizeof(PVOID)-1] |= 0x8000;
    			return 2*sizeof(PVOID)+2;
    		}
    	}
    
    	if (fixupLen)
    	{
    		if (0 <= pDoc->Read((PVOID)Va, &Va, sizeof(PVOID)))
    		{
    			fixupLen = 0, f = FALSE;
    			goto __loop;
    		}
    	}
    
    	if (2*sizeof(PVOID)+2<cb && pDoc->getDllByVaNoRef(_Va))
    	{
    		_snwprintf(buf, cb, L"%p", _Va);
    		buf[0] |= 0x4000, buf[2*sizeof(PVOID)-1] |= 0x8000;
    		return 2*sizeof(PVOID);
    	}
    
    	return 0;
    }

    zhukas, 27 Ноября 2014

    Комментарии (3)
  6. C++ / Говнокод #17123

    +53

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    int CALLBACK ZDll::Compare(ZDll* p, ZDll* q, LPARAM lParamSort)
    {
    	ULONG_PTR a, b;
    	int s = GET_Y_LPARAM(lParamSort) ? -1 : +1;
    	
    	switch (GET_X_LPARAM(lParamSort))
    	{
    	default: __assume(false);
    	case 0:
    		a = p->_index, b = q->_index;
    		break;
    	
    	case 1:
    		a = (ULONG_PTR)p->_BaseOfDll, b = (ULONG_PTR)q->_BaseOfDll;
    		break;
    
    	case 2:
    		a = p->_SizeOfImage, b = q->_SizeOfImage;
    		break;
    
    	case 3:
    		PCWSTR pa = p->_ImageName, pb = q->_ImageName;
    		if (!pa) return -s;
    		if (!pb) return +s;
    		return _wcsicmp(pa, pb)*s;
    	}
    
    	if (a < b) return -s;
    	if (a > b) return +s;
    	return 0;
    }
    
    INT_PTR ZModulesDlg::DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
    	switch (uMsg)
    	{
    	case WM_NOTIFY:
    		if (((LPNMHDR)lParam)->idFrom == IDC_LIST1)
    		{
    			LVITEM lvi;
    
    			switch (((LPNMHDR)lParam)->code)
    			{
    			case LVN_COLUMNCLICK:
    				if ((DWORD)(lvi.iSubItem = ((LPNMLISTVIEW)lParam)->iSubItem) < 4)
    				{
    					ListView_SortItems(((LPNMHDR)lParam)->hwndFrom, ZDll::Compare, 
    						MAKELPARAM(lvi.iSubItem, _bittestandcomplement(&_SortOrder, lvi.iSubItem)));
    				}
    				break;
    
    			case LVN_GETINFOTIP:
    				lvi.iItem = ((LPNMLVGETINFOTIP)lParam)->iItem;
    				lvi.mask = LVIF_PARAM;
    
    				if (ListView_GetItem(((LPNMHDR)lParam)->hwndFrom, &lvi))
    				{
    					if (PWSTR ImagePath = ((ZDll*)lvi.lParam)->_ImagePath)
    					{
    						if (DWORD n = ((LPNMLVGETINFOTIP)lParam)->cchTextMax)
    						{
    							WCHAR *pszText = ((LPNMLVGETINFOTIP)lParam)->pszText, c;
    							do 
    							{
    								*pszText++ = c = *ImagePath++;
    							} while (c && --n);
    
    							if (c)
    							{
    								pszText[-1] = 0;
    							}
    						}
    					}
    				}
    				break;
    			}
    		}
    		break;

    жесть

    zhukas, 17 Ноября 2014

    Комментарии (0)
  7. C++ / Говнокод #17122

    +49

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    void ZModulesDlg::OnDestroy(HWND hwnd)
    {
    	LVITEM lvi = { LVIF_PARAM };
    
    	if (lvi.iItem = ListView_GetItemCount(hwnd))
    	{
    		do 
    		{
    			lvi.iItem--;
    			if (ListView_GetItem(hwnd, &lvi))
    			{
    				((ZDll*)lvi.lParam)->Release();
    			}
    		} while (lvi.iItem);
    	}
    }

    zhukas, 17 Ноября 2014

    Комментарии (1)
  8. C++ / Говнокод #17119

    +53

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    const VS_FIXEDFILEINFO* GetFileVersion(PCWSTR name)
    {
    	HMODULE hmod = GetModuleHandle(name);
    	static LPCWSTR a[3] = { RT_VERSION, MAKEINTRESOURCE(1) };
    	PIMAGE_RESOURCE_DATA_ENTRY pirde;
    	PVOID pv;
    	DWORD size;
    
    	return !hmod || 
    		0 > LdrFindResource_U(hmod, a, 3, &pirde) || 
    		0 > LdrAccessResource(hmod, pirde, &pv, &size) ||
    		size < sizeof(VS_FIXEDFILEINFO)
    		? 0 : (VS_FIXEDFILEINFO*)findDWORD((size - sizeof(VS_FIXEDFILEINFO))/sizeof(DWORD) + 1, (PDWORD)pv, 0xfeef04bd);
    }

    zhukas, 17 Ноября 2014

    Комментарии (5)
  9. Assembler / Говнокод #17114

    +147

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    strnstr proc
    	jrcxz @@3
    	push rdi
    	push rsi
    	mov rdi,rdx
    	mov al,[r9]
    	inc r9
    	dec r8
    @@1:
    	repne scasb
    	jne @@2
    	cmp rcx,r8
    	jb @@2
    	mov rsi,r9
    	mov rdx,rdi
    	mov r10,rcx
    	mov rcx,r8
    	repe cmpsb
    	je @@2
    	mov rcx,r10
    	mov rdi,rdx
    	jmp @@1
    @@2:
    	sete al
    	movzx rax,al
    	neg rax
    	and rax,rdi
    	pop rsi
    	pop rdi
    	ret
    @@3:
    	xor rax,rax
    	ret
    strnstr endp

    PSTR __fastcall strnstr(SIZE_T n1, const void* str1, SIZE_T n2, const void* str2);

    zhukas, 15 Ноября 2014

    Комментарии (2)
  10. C++ / Говнокод #17113

    +53

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    void zxc()
    {
    	DWORD i = 256, j, k, l, nTry, N = 0;
    	ULONG_PTR a = 0, b = 0, aa = 0, bb = 0;
    	_PTE* pte = PXE(256);
    	do 
    	{
    		if (pte->Valid)
    		{
    			pte->Owner = 1;
    			__try
    			{
    				j = 0, nTry = 0;
    
    				_PTE* pte = PPE(i, 0);
    
    				do 
    				{
    					if (pte->Valid)
    					{
    						pte->Owner = 1;
    
    						__try
    						{
    							k = 0, nTry = 0;
    
    							_PTE* pte = PDE(i, j, 0);
    
    							do 
    							{
    								if (pte->Valid)
    								{
    									pte->Owner = 1;
    
    									if (pte->LargePage)
    									{
    										b = LA(i, j, k, 0);
    
    										if (!a)
    										{
    											a = b;
    										}
    										continue;
    									}
    									__try
    									{
    										l = 0, nTry = 0;
    
    										_PTE* pte = PTE(i, j, k, 0);
    
    										do 
    										{
    											b = LA(i, j, k, l);
    
    											if (pte->Valid)
    											{
    												pte->Owner = 1;
    
    												if (!a)
    												{
    													a = b;
    												}
    											}
    											else
    											{
    												if (!pte->Prototype && pte->Protection && pte->Protection < MM_NOCACHE)
    												{
    												}
    												else if (a)
    												{
    													aa = a, bb = b, a = 0, N++;
    												}
    											}
    										} while (nTry = 0, ++pte, ++l < PTE_PER_PAGE);
    									}
    									__except(OnPteException(pte, nTry)){}
    								}
    								else if (a)
    								{
    									aa = a, bb = LA(i, j, k, 0), a = 0, N++;
    								}
    							} while (nTry = 0, ++pte, ++k < PDE_PER_PAGE);
    						}
    						__except(OnPteException(pte, nTry)){}
    					}
    					else if (a)
    					{
    						aa = a, bb = LA(i, j, 0, 0), a = 0, N++;
    					}
    				} while (nTry = 0, ++pte, ++j < PPE_PER_PAGE);
    			}
    			__except(OnPteException(pte, nTry)){}
    		}
    		else if (a)
    		{
    			aa = a, bb = LA(i, 0, 0, 0), a = 0, N++;
    		}
    	} while (++pte, ++i < PXE_PER_PAGE);
    }

    #define LA(i, j, k, l) (0xFFFF000000000000 + \
    ((ULONG_PTR)(i) << PXI_SHIFT) + \
    ((ULONG_PTR)(j) << PPI_SHIFT) + \
    ((ULONG_PTR)(k) << PDI_SHIFT) + \
    ((ULONG_PTR)(l) << PTI_SHIFT))

    zhukas, 15 Ноября 2014

    Комментарии (0)
  11. C++ / Говнокод #17112

    +51

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    DWORD getDirectoryIndex()
    	{
    		STATIC_OBJECT_ATTRIBUTES(oa, "\\");
    		HANDLE hFile;
    		DWORD ObjectTypeIndex = 0;
    
    		if (0 <= ZwOpenDirectoryObject(&hFile, DIRECTORY_QUERY, &oa))
    		{
    			NTSTATUS status;
    			PVOID buf = 0, stack = alloca(guz);
    			DWORD cb = 0, rcb = 0x10000;
    
    			do 
    			{
    				if (cb < rcb) cb = RtlPointerToOffset(buf = alloca(rcb - cb), stack);
    
    				if (0 <= (status = ZwQuerySystemInformation(SystemExtendedHanfleInformation, buf, cb, &rcb)))
    				{
    					PSYSTEM_HANDLE_INFORMATION_EX pshti = (PSYSTEM_HANDLE_INFORMATION_EX)buf;
    
    					if (ULONG NumberOfHandles = (ULONG)pshti->NumberOfHandles)
    					{
    						PSYSTEM_HANDLE_TABLE_ENTRY_INFO_EX Handles = pshti->Handles;
    
    						ULONG_PTR UniqueProcessId = GetCurrentProcessId();
    						do 
    						{
    							if (Handles->UniqueProcessId == UniqueProcessId && Handles->HandleValue == (ULONG_PTR)hFile)
    							{
    								ObjectTypeIndex = Handles->ObjectTypeIndex;
    								break;
    							}
    
    						} while (Handles++, --NumberOfHandles);
    					}
    				}
    			} while (STATUS_INFO_LENGTH_MISMATCH == status);
    
    			ZwClose(hFile);
    		}
    
    		return ObjectTypeIndex;
    	}
    
    	ZOBJECT_ALL_TYPES_INFORMATION()
    	{
    		_TypeInformation = 0, _NumberOfTypes = 0;
    
    		if (DWORD DirectoryTypeIndex = getDirectoryIndex())
    		{
    			PVOID stack = alloca(guz);
    			OBJECT_ALL_TYPES_INFORMATION* poati = 0;
    			DWORD cb = 0, rcb = 0x2000;
    			NTSTATUS status;
    			do 
    			{
    				if (cb < rcb)
    				{
    					cb = RtlPointerToOffset(poati = (OBJECT_ALL_TYPES_INFORMATION*)alloca(rcb - cb), stack);
    				}
    
    				if (0 <= (status = ZwQueryObject(0, ObjectAllTypeInformation, poati, cb, &rcb)))
    				{
    					if (DWORD NumberOfTypes = poati->NumberOfTypes)
    					{
    						if (OBJECT_TYPE_INFORMATION* TypeInformation = (OBJECT_TYPE_INFORMATION*)LocalAlloc(0, rcb))
    						{
    							_NumberOfTypes = NumberOfTypes;
    							_TypeInformation = TypeInformation;
    
    							STATIC_UNICODE_STRING_(Directory);
    							OBJECT_TYPE_INFORMATION* pti = poati->TypeInformation;
    							PWSTR buf = (PWSTR)(TypeInformation + NumberOfTypes);
    							int Index = 0;
    							do 
    							{
    								if (RtlEqualUnicodeString(&Directory, &pti->TypeName, TRUE))
    								{
    									_firstObjectTypeIndex = DirectoryTypeIndex - Index;
    								}
    
    								DWORD Length = pti->TypeName.Length, MaximumLength = pti->TypeName.MaximumLength;
    								memcpy(buf, pti->TypeName.Buffer, Length);
    
    								*TypeInformation = *pti;
    								TypeInformation++->TypeName.Buffer = buf;
    
    								buf = (PWSTR)RtlOffsetToPointer(buf, Length);
    
    								pti = (OBJECT_TYPE_INFORMATION*)
    									(((ULONG_PTR)pti + sizeof(OBJECT_TYPE_INFORMATION) + MaximumLength + sizeof(PVOID)-1) & ~(sizeof(PVOID)-1));
    
    							} while (Index++, --NumberOfTypes);
    						}
    					}
    				}
    			} while (status == STATUS_INFO_LENGTH_MISMATCH);
    		}
    	}

    ObjectTypeIndex

    zhukas, 15 Ноября 2014

    Комментарии (32)