Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.73 KB | None | 0 0
  1. Index: tss_pe.cpp
  2. ===================================================================
  3. --- tss_pe.cpp (revision 466)
  4. +++ tss_pe.cpp (revision 467)
  5. @@ -112,14 +112,27 @@
  6.  
  7. //Definitions required by implementation
  8.  
  9. - #if (_MSC_VER < 1300) || (_MSC_VER > 1900) // 1300 == VC++ 7.0, 1900 == VC++ 14.0
  10. - typedef void (__cdecl *_PVFV)();
  11. - #define INIRETSUCCESS
  12. - #define PVAPI void __cdecl
  13. + #if (_MSC_VER < 1300) || ((_MSC_VER > 1900) && (_MSC_VER < 1910)) // 1300 == VC++ 7.0, 1900 == VC++ 14.0, 1910 == VC++ 2017
  14. + typedef void ( __cdecl *_PVFV_ )();
  15. + typedef void ( __cdecl *_PIFV_ )();
  16. + #define INIRETSUCCESS_V
  17. + #define INIRETSUCCESS_I
  18. + #define PVAPI_V void __cdecl
  19. + #define PVAPI_I void __cdecl
  20. + #elif (_MSC_VER >= 1910)
  21. + typedef void ( __cdecl *_PVFV_ )();
  22. + typedef int ( __cdecl *_PIFV_ )();
  23. + #define INIRETSUCCESS_V
  24. + #define INIRETSUCCESS_I 0
  25. + #define PVAPI_V void __cdecl
  26. + #define PVAPI_I int __cdecl
  27. #else
  28. - typedef int (__cdecl *_PVFV)();
  29. - #define INIRETSUCCESS 0
  30. - #define PVAPI int __cdecl
  31. + typedef int ( __cdecl *_PVFV_ )();
  32. + typedef int ( __cdecl *_PIFV_ )();
  33. + #define INIRETSUCCESS_V 0
  34. + #define INIRETSUCCESS_I 0
  35. + #define PVAPI_V int __cdecl
  36. + #define PVAPI_I int __cdecl
  37. #endif
  38.  
  39. typedef void (NTAPI* _TLSCB)(HINSTANCE, DWORD, PVOID);
  40. @@ -136,9 +149,9 @@
  41. {
  42. //Forward declarations
  43.  
  44. - static PVAPI on_tls_prepare();
  45. - static PVAPI on_process_init();
  46. - static PVAPI on_process_term();
  47. + static PVAPI_I on_tls_prepare();
  48. + static PVAPI_V on_process_init();
  49. + static PVAPI_V on_process_term();
  50. static void NTAPI on_tls_callback(HINSTANCE, DWORD, PVOID);
  51.  
  52. //The .CRT$Xxx information is taken from Codeguru:
  53. @@ -150,9 +163,9 @@
  54. #pragma section(".CRT$XTU",long,read)
  55. #pragma section(".CRT$XLC",long,read)
  56. __declspec(allocate(".CRT$XLC")) _TLSCB __xl_ca=on_tls_callback;
  57. - __declspec(allocate(".CRT$XIU"))_PVFV p_tls_prepare = on_tls_prepare;
  58. - __declspec(allocate(".CRT$XCU"))_PVFV p_process_init = on_process_init;
  59. - __declspec(allocate(".CRT$XTU"))_PVFV p_process_term = on_process_term;
  60. + __declspec(allocate(".CRT$XIU"))_PIFV_ p_tls_prepare = on_tls_prepare;
  61. + __declspec(allocate(".CRT$XCU"))_PVFV_ p_process_init = on_process_init;
  62. + __declspec(allocate(".CRT$XTU"))_PVFV_ p_process_term = on_process_term;
  63. #else
  64. #if (_MSC_VER >= 1300) // 1300 == VC++ 7.0
  65. # pragma data_seg(push, old_seg)
  66. @@ -164,13 +177,13 @@
  67. //this could be changed easily if required.
  68.  
  69. #pragma data_seg(".CRT$XIU")
  70. - static _PVFV p_tls_prepare = on_tls_prepare;
  71. + static _PIFV_ p_tls_prepare = on_tls_prepare;
  72. #pragma data_seg()
  73.  
  74. //Callback after all global ctors.
  75.  
  76. #pragma data_seg(".CRT$XCU")
  77. - static _PVFV p_process_init = on_process_init;
  78. + static _PVFV_ p_process_init = on_process_init;
  79. #pragma data_seg()
  80.  
  81. //Callback for tls notifications.
  82. @@ -181,7 +194,7 @@
  83. //Callback for termination.
  84.  
  85. #pragma data_seg(".CRT$XTU")
  86. - static _PVFV p_process_term = on_process_term;
  87. + static _PVFV_ p_process_term = on_process_term;
  88. #pragma data_seg()
  89. #if (_MSC_VER >= 1300) // 1300 == VC++ 7.0
  90. # pragma data_seg(pop, old_seg)
  91. @@ -193,7 +206,7 @@
  92. #pragma warning(disable:4189)
  93. #endif
  94.  
  95. - PVAPI on_tls_prepare()
  96. + PVAPI_I on_tls_prepare()
  97. {
  98. //The following line has an important side effect:
  99. //if the TLS directory is not already there, it will
  100. @@ -228,13 +241,13 @@
  101. *pfdst = 0;
  102. #endif
  103.  
  104. - return INIRETSUCCESS;
  105. + return INIRETSUCCESS_I;
  106. }
  107. #ifdef BOOST_MSVC
  108. #pragma warning(pop)
  109. #endif
  110.  
  111. - PVAPI on_process_init()
  112. + PVAPI_V on_process_init()
  113. {
  114. //Schedule on_thread_exit() to be called for the main
  115. //thread before destructors of global objects have been
  116. @@ -251,13 +264,13 @@
  117.  
  118. boost::on_process_enter();
  119.  
  120. - return INIRETSUCCESS;
  121. + return INIRETSUCCESS_V;
  122. }
  123.  
  124. - PVAPI on_process_term()
  125. + PVAPI_V on_process_term()
  126. {
  127. boost::on_process_exit();
  128. - return INIRETSUCCESS;
  129. + return INIRETSUCCESS_V;
  130. }
  131.  
  132. void NTAPI on_tls_callback(HINSTANCE /*h*/, DWORD dwReason, PVOID /*pv*/)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement