Skip to content

Instantly share code, notes, and snippets.

@jayint3z3r
Created June 27, 2017 20:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jayint3z3r/b100339590b27cffacd8eab488c82c0d to your computer and use it in GitHub Desktop.
Save jayint3z3r/b100339590b27cffacd8eab488c82c0d to your computer and use it in GitHub Desktop.
#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