Advertisement
thebigbum

Untitled

Jan 31st, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. int __cdecl sub_10012FA0()
  2. {
  3. HMODULE v0; // edi@1
  4. int v2; // esi@11
  5. unsigned int v3; // ecx@15
  6. FARPROC v4; // [sp+8h] [bp-224h]@5
  7. FARPROC v5; // [sp+Ch] [bp-220h]@7
  8. int v6; // [sp+10h] [bp-21Ch]@11
  9. FARPROC v7; // [sp+14h] [bp-218h]@6
  10. int v8; // [sp+18h] [bp-214h]@8
  11. unsigned int v9; // [sp+1Ch] [bp-210h]@11
  12. const WCHAR LibFileName[2]; // [sp+20h] [bp-20Ch]@11
  13. int v11; // [sp+24h] [bp-208h]@20
  14. int v12; // [sp+28h] [bp-204h]@20
  15. int v13; // [sp+2Ch] [bp-200h]@20
  16. int v14; // [sp+30h] [bp-1FCh]@20
  17. int v15; // [sp+34h] [bp-1F8h]@20
  18. int v16; // [sp+38h] [bp-1F4h]@20
  19. int v17; // [sp+3Ch] [bp-1F0h]@20
  20. __int16 v18[244]; // [sp+40h] [bp-1ECh]@20
  21. unsigned int v19; // [sp+228h] [bp-4h]@1
  22. int v20; // [sp+22Ch] [bp+0h]@1
  23.  
  24. v19 = (unsigned int)&v20 ^ __security_cookie;
  25. v0 = LoadLibraryExW(L"ADVAPI32.DLL", 0, 0x800u);
  26. if ( !v0 )
  27. {
  28. if ( GetLastError() != 87 || (v0 = LoadLibraryExW(L"ADVAPI32.DLL", 0, 0)) == 0 )
  29. return sub_10011014((unsigned int)&v20 ^ v19);
  30. }
  31. v4 = GetProcAddress(v0, "RegOpenKeyExW");
  32. if ( !v4 || (v7 = GetProcAddress(v0, "RegQueryValueExW")) == 0 || (v5 = GetProcAddress(v0, "RegCloseKey")) == 0 )
  33. return sub_10011014((unsigned int)&v20 ^ v19);
  34. if ( ((int (__stdcall *)(signed int, _DWORD, _DWORD, signed int, int *))v4)(
  35. -2147483646,
  36. L"SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VC",
  37. 0,
  38. 1,
  39. &v8) )
  40. {
  41. FreeLibrary(v0);
  42. return sub_10011014((unsigned int)&v20 ^ v19);
  43. }
  44. v9 = 520;
  45. v2 = ((int (__stdcall *)(int, _DWORD, _DWORD, int *, const WCHAR *, unsigned int *))v7)(
  46. v8,
  47. L"ProductDir",
  48. 0,
  49. &v6,
  50. LibFileName,
  51. &v9);
  52. ((void (__stdcall *)(int))v5)(v8);
  53. FreeLibrary(v0);
  54. if ( v2 || v6 != 1 || v9 & 1 || v9 >> 1 < 2 || (v3 = (v9 >> 1) - 1, LibFileName[v3]) )
  55. return sub_10011014((unsigned int)&v20 ^ v19);
  56. if ( *((_WORD *)&v9 + v3 + 1) != 92 )
  57. LibFileName[v3++] = 92;
  58. if ( -1 - v3 < 0x12 || v3 + 17 > 0x104 )
  59. return sub_10011014((unsigned int)&v20 ^ v19);
  60. *(_DWORD *)&LibFileName[v3] = dword_1001607C;
  61. *(int *)((char *)&v11 + 2 * v3) = dword_10016080;
  62. *(int *)((char *)&v12 + 2 * v3) = dword_10016084;
  63. *(int *)((char *)&v13 + 2 * v3) = dword_10016088;
  64. *(int *)((char *)&v14 + 2 * v3) = dword_1001608C;
  65. *(int *)((char *)&v15 + 2 * v3) = dword_10016090;
  66. *(int *)((char *)&v16 + 2 * v3) = dword_10016094;
  67. *(int *)((char *)&v17 + 2 * v3) = dword_10016098;
  68. v18[v3] = word_1001609C;
  69. if ( !LoadLibraryExW(LibFileName, 0, 0x900u) )
  70. {
  71. if ( GetLastError() == 87 )
  72. LoadLibraryExW(LibFileName, 0, 8u);
  73. }
  74. return sub_10011014((unsigned int)&v20 ^ v19);
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement