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

    Всего: 1

  2. C++ / Говнокод #6523

    +159

    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
    #define цой_жив(...) , ## __VA_ARGS__
    
    #define COUNT_PARMS2(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _, ...) _
    #define REPEAT_PARAMS(...) (__VA_ARGS__)
    #define COUNT_PARMS(...) \
       COUNT_PARMS2 REPEAT_PARAMS(цой_жив(__VA_ARGS__) 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
    
    template<class>
    struct call_type;
    
    #define NUM_ARGS 13
    
    #define C_CALL_REPEAT(z,n,data) \
    	template<class R BOOST_PP_ENUM_TRAILING_PARAMS(n,class A)> \
    	struct call_type<R __cdecl(BOOST_PP_ENUM_PARAMS(n,A))> \
    	{ \
    	enum{j}; \
    	};
    
    BOOST_PP_REPEAT(BOOST_PP_INC(NUM_ARGS),C_CALL_REPEAT,~);
    
    #define STD_CALL_REPEAT(z,n,data) \
    	template<class R BOOST_PP_ENUM_TRAILING_PARAMS(n,class A)> \
    	struct call_type<R __stdcall(BOOST_PP_ENUM_PARAMS(n,A))> \
    	{ \
    	enum{j=1}; \
    	}; 
    
    BOOST_PP_REPEAT(BOOST_PP_INC(NUM_ARGS),STD_CALL_REPEAT,~);
    
    #define VAR_CALL_REPEAT(z,n,data) \
    	template<class R BOOST_PP_ENUM_TRAILING_PARAMS(n,class A)> \
    	struct call_type<R __cdecl(BOOST_PP_ENUM_PARAMS(n,A) BOOST_PP_COMMA_IF(n) ...)> \
    	{ \
    	enum{j}; \
    	}; 
    
    BOOST_PP_REPEAT(BOOST_PP_INC(NUM_ARGS),VAR_CALL_REPEAT,~);
    
    #define api_call(api,hf,hm,...) \
    	((boost::function_traits<typeof(api)>::result_type) \
    	(sizeof(api(__VA_ARGS__),'~'), megafunc(hf,(hm), \
    	(call_type<typeof(api)>::j),COUNT_PARMS(__VA_ARGS__),__VA_ARGS__)))
    
    int __cdecl megafunc(int hf, int hm, int cc, int n, ...)
    {
    	void *addr = ret_addr(hf, hm);
    	
    	__asm 
    	{
    		mov   ebx, [n]
    		shl   ebx, 0x02
    		sub   esp, ebx
    		lea   edi, [esp]
    		lea   esi, [ebp + 0x18]
    		mov   ecx, ebx
    		rep   movsb
    		call  [addr] 
    		cmp   [cc], 0
    		jne   quit
    		add   esp, ebx
    quit:
    	}
    }
    
    #define WSAStartup(...) api_call(WSAStartup,0xcdde757d,0xd6bc4bcc,__VA_ARGS__)
    #define sprintf(...) api_call(sprintf,0x2d3a75e1,0xb634b9cd,__VA_ARGS__)
    ...

    4c7497f8e9d9462d, 01 Мая 2011

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